“On undoing, fixing, or removing commits in git” is a web page which guides you when Git doesn’t do as you want to.
Characters that you need to be able to distinguish clearly:
0O – Zero and upper case o
l1I – Lower case L, one, upper case i
Z2 – Upper case z and two
S5 – Upper case s and five
G6 – Upper case g and six
B8 – Upper case b and eight
71 – seven and one
lI – Lower case L, upper case i
vy – lower case v and lower case y
Just copy and paste into your favorite code editor.
Fonts you should try:
From my series “The Next Best Thing“:
Often, you will find yourself in a debugger, trying to follow some insanely complicated code to find the root cause of a bug.
I would like to see a button in my IDE which reads “New Test Case”. It should example the current program state, determine (with my help) what part of the code I want to test and then copy the current state into a unit test. In a second step, I could then trim down the unit tests but I would have all the input, all necessary dependencies would be there, correctly initialized.
It would also be great if the IDE would track the state of the code from which the unit test was generated. If the code changes too much (indicating that the unit test might become outdated), I’d like to see that. Or maybe the IDE could figure out by itself when code tested in such a way deviates “too much.”
Along the same lines, the IDE should be able to inject probes into the product code. As I click buttons and enter data in the UI, the IDE should generate a series of unit tests under the hood as described here. If you’re using frameworks like Spring, the tests should come with minimal (or mocked) dependencies.
Google asks to “Just Say No to More End-to-End Tests” – just go and read it.
The suggestion in the document is to have a testing pyramid. A few (slow, expensive, dangerous) End-to-End (E2E) tests, more integration tests (IT) and a whole lot of unit tests.
My approach is to aim for 100% unit tests by breaking down the E2E and integration tests into chains of unit tests.
Example: You want to test whether you can save a UI field in a database.
The naive approach would be to create the UI, create a DB, simulate user input, click the save button, check the data in the database, update the UI afterwards.
My approach is to cut this into individual steps and use the output of test X as input for X+1. For unit tests, output is always a constant, so this doesn’t create dependencies between the tests except for the fact that some are the logical next steps. Tests can still be executed in any order.
But back to the example. The first set of tests would put various values in the UI, simulating user input. The tests would just read the values from the fields and compare them against expected values.
The next set of tests would be for the input validation. These tests would reuse some of the “expected output” values from the previous tests. No UI would be necessary (the code to test the display of validation messages would be in another set). We’re only interested in “do we get the correct error for input value FOO” where FOO is a constant.
The input validation tests can be grouped into two sets: One where the input value passes the validation and another (probably a much bigger) where the validation fails.
For all the inputs where the validation succeeds, we write a test that writes this value (again taken from a constant) into the database.
Lastly, to update the UI, we write a set of tests which examine the state of the database. And another set which tests that a certain state appears correctly in the UI.
As you can see, at no time we have a runtime dependency of tests. Tests work in any order. If the output of one test changes, only a small number of tests need to be updated (if at all). The IDE will help you locate all tests which are connected.
Instead of using the constant directly in an assert inside of a test, you can refer to it from an annotation. Now you can write tests that make sure that an output value is also used as an input somewhere.
If a test fails, only a single test fails. If the validation changes and a value isn’t valid anymore, the DB test might still pass. This is good: We don’t want code to fail unless it’s really broken. The DB interface might be able to write “illegal” values into the database but the validation layer is responsible to catch them. Don’t mix responsibilities.
In E2E or integration tests, a single failure somewhere in the whole chain of operations breaks the whole test. With the approach outlined above, a single failure just breaks very few tests. Each test still runs only a small number of code lines, making it easier to locate the cause of the problem. Tests are fast, you can run tests for a subset of the chain – why test the database when you’re improving validation? Or start the whole UI? You can run fast tests all the time and mark slow ones (UI, DB) for “run only on CI server“.
Locate Linux drivers on http://download.ebz.epson.net/dsc/search/01/search/?OSC=LX
Search for “v300”
The search gives two results:
You need both. The first one is
esci-interpreter-gt-f720-0.1.1-2.* which is a necessary plugin for
iscan to enable the software to talk to the scanner via USB. Without it, you get odd “Permission denied” errors and “
scanimage --list-devices” will come back with “No scanners were identified.”
iscan-2.30.1-1.usb0.1.ltdl3.x86_64.rpm (not sure what those files with a ~ in the name at the top are) plus
iscan-data-1.36.0-1.noarch.rpm from the second search result.
Install all three of them at the same time.
xsane should now be able to detect and use the scanner.
I’m back from SoCraTes Day Switzerland where I help a Code&Hack session called “Testing the Impossible”.
After signing up, you’ll find yourself in the documents page:
Click “Create” to create a new one. I’d like to design an office chair, so I’ll use “Office Chair” as document name.
Onshape will now display the workbench:
Read “Interface Basics” to learn how to manipulate the UI. I’d like to get started with my chair. The first thing that it needs is wheels.
Let’s create a circle … circle … where is the circle? Where is anything???
Turns out that Onshape wants to you to create a “sketch” first. Think of a sketch as an outline of something. With the tools that you can see now, you can turn this outline into a 3D object. Sounds a bit dry but wait for it. To create a sketch, click on the “Sketch” button (next to the pencil).
There are three important points here:
What does that “a sketch plane” mean? Onshape is a 3D CAD but you probably only have a 2D mouse. That means Onshape somehow has to reduce one dimension. It does that by letting you select a plane on which all your lines, rectangles and circles will be. We’ll see how that works out later when we create more complex shapes.
Currently, we want to create a wheel and a wheel should stand on the floor (or it won’t move). So we have the choice of the “Front” and the “Right” plane. I chose the “Front” plane. Just move the mouse over the plane you want and it should turn yellow. If you click, the “selection” will be added to the sketch:
As you can see, the blue field turned white, the text changed to “Front plane” and there is now an additional rectangle in the 3D view. If you rotate the view, you’ll see that the new rectangle is always parallel to the “Front” rectangle which is what we want.
Also the missing primitive drawing tools (line, rectangle, circle) are now available.
Let’s build a wheel. Let’s start with a circle. Click the green button and … Where did the drawing tools go??? Where is my sketch? What is going on?
Well, the drawing tools are only visible as long as you’re editing a sketch. So double-click on “Sketch 1” or right-click it and select “Edit”. And the tools are back.
Let’s add a circle:
I had my first doubt here: How do I enter a diameter or radius? How am I supposed to construct something instead of simply sketching a design? Turns out that Onshape has solved this problem in a really nice and intuitive way. But let’s assume that we have no idea and we just continue working.
If you rotate the view, then the planes “Front”, “Sketch 1” and the circle should look like they are parallel.
Your workspace should now look like this: “Sketch 1” in the list of features and a dull grey circle. Let’s turn the circle into a cylinder. Click “Extrude” (first button to the right of sketch).
Important things here: The extrude operation has been added after the sketch. That means it can use our sketch as outline for the operation.
The options for extrude are what we want (“Solid” and “New”). The next option (active) is the outline to extrude. Hover inside the circle and it will turn yellow. When you click, the magic will happen.
If you drag the arrow around, you can see that the number in the Extrude form changes. That’s the amount by which the outline gets extruded. You can also edit the value directly. Enter “1 cm”. The software will display “0.394 in” and update the cylinder. If you edit the value, you’ll see “1 cm” again. So the software remembers what you originally wanted. Keep that in mind.
Most wheels have round edges. The “Fillet” tool does that for us. Click on the tool without closing the “Extrude 1” form:
As you can see, the last tool was finished for us and a new one was added. “Fillet 1” is waiting for us to select the corners we want to round. If you hover over the two ends of the cylinder, they’ll turn yellow (as in the image above). When they do, click to add them. There is no need for Ctrl or Shift, Onshape always toggles the selection when you click on something.
You’ll notice something strange: When you select the first circle, the edge will be rounded. But when you select the second one, the effect will be gone. Why?
In the form, you can see that the correct edges are selected. The problem is that the radius of the fillet (0.2 in) is too big; 0.4 in is greater than 1 cm, so Onshape simply can’t do what we want. Enter “3 mm” to fix that:
Select “Centimeters”. The form won’t update right away, you have to close and reopen it.
Let’s add an axis around which the wheel should rotate. Create a new sketch (“Sketch 2”). Select the side of the wheel as “sketch plane” which is closest to the plane of “Sketch 1”.
Add a circle. This time, hover the mouse near the center of the wheel until the center point lights up. That tells Onshape that you want a circle which has the same center as the first one:
The important part here is the little icon with the two lines and the white point. This is a constraint, specifically the “Coincident constraint” which makes sure that those two points will stay in the same place, even when you move one. This will start to make sense later.
After adding the circle, we want to make sure it’s exactly 1 cm. How do we do that?
With the dimension tool. Click it and the circle. You’ll get an entry field where you can enter “1 cm” to set the diameter of the circle:
Click extrude to add a 6 mm long cylinder. You need to click inside of the new circle to make this happen. If you click on the circle, you get a hollow cylinder. We want a massive one.
Important bits here:
To create the second wheel, we add a mirror operation. Click “Mirror”, select the wheel somewhere. It will turn yellow-ish:
The field “Mirror plane” is red, indicating some kind of problem. Note that the field with “Part 1” is active, so click anything would change this field. We don’t want that. Click on the field “Mirror plane,” instead. You should now be able to select the top of the axis:
which will give you this result:
Two wheels, connected with an axis.
How big are the wheels? If you remember, we just dragged a circle. Dimension tool to the rescue!
Double click “Sketch 1” to edit it. Everything else will be hidden.
Apply the dimension tool to the circle. Enter “6 cm”. Click the green button to get:
And that’s the power of Onshape: The tool remembers all the steps that you made to create something. If you go back and change a step, it will adjust all the later steps. That means you can really “sketch” (as in “quickly draw something”). When you feel the need to improve a step, go back to it, make the change and everything else will be updated.
As the last part of this tutorial, let’s add the handle which connects the axis between the wheels and the base of the chair.
I’ll construct a simple handle from a box and a cylinder. For the box, I first need a rectangle which goes between the wheels.
While I could rotate the view carefully and aim between the wheels, there is a more simple way: Hide the second wheel for a moment. To do this, right-click on “Mirror 1” and select “Suppress” from the context menu:
We can now easily create a sketch in the same plane as the extruded tip of the axis. Draw a rectangle around the axis which should extend somewhat to the left side of the wheel without extending over the wheel itself:
Extrude it. Options: “Solid”, “New”, Change “Blind” to “Symmetric”, “0.8 cm” thick, and make sure you click on the area of the rectangle outside of the circle which marks the axis. That way, we get a hole in the new box for free:
If you don’t get a hole, remove the selection of “Face of Sketch 3” with the little red “x” next to it (not the big one at the top!) and click again.
Time for the last sketch: The cylinder at the top.
But we want the circle to be perfectly aligned. For that, we need construction lines.
The final result should look like this:
Finally, extrude the circle by 2.5 cm:
This doesn’t look right. In the “Extrude” form, “Surface” is selected but we need “Solid.”
What the …? Where is my cylinder??
Turns out that it makes a difference what you select before you extrude. If you select the circle outline, you get only a tube. But if you click inside of the circle, the whole area is extruded. So to fix the problem, just click inside of the circle (instead of the circle itself) to get:
Make sure “Add” is selected and “Part 2”.
Not bad for just a few minutes of work. Next part: Chair Base with 5 spokes.