ronin

The VACTROL, a true analog variable resistance



So, I learned something today. If you need a finely variable resistor with extremely low analog distortion (for say, your high-grade electronic music synthesizer) they make opto-couplers based on a light-dependent resistor (LDR). Current through an LED shines light onto the LDR, which results in a true analog variable resistor. But the cool thing is that the resistance can be easily controlled by other electronics, instead of by some knob the user has to twiddle. Useful, and a bit tricky to do well any other way. Particularly if very analog-y things like THD actually matter. A very handy building block for making true-analog (stepless) AGCs.

http://en.wikipedia.org/wiki/Resistive_opto-isolator
  • Current Music
    Dethklok - Awaken (www.youtube.com/watch?v=BubiZAIWHgU)
ronin

ch00f goes to Shenzen

Collapse )

I was also surprised to see a number of PC modders walking around toting their cases. There were a number of legitimate PC parts for sale. The customers would bring their PCs and install the new parts in the shop to make sure that they worked correctly. It's not like there would be any return policy or warranty once they left.

I really don't think my photos are even coming close to capturing the absurdity and enormity of this place. Ten stories of tons of little kiosks selling all kinds of junk.

[...]

I still can't believe how incredibly cheap everything was. I would pay anything to have a market like this near my home just so I could get some parts same-day, and yet here are all the parts I could ever need for prices that I can hardly believe. We purchased four micro-switches along with two rocker and two momentary push-button switches, and the bill ran us about $2 USD. Just one of the micro-switches on Digikey would have run us almost half that. I guess a lot of the value in the parts we buy in the States must be added by shipping costs.


http://ch00ftech.com/2012/09/10/china-is-awesome/

You remember when Steve Jobs said: "Those jobs aren't coming back"? This is why.
ronin

Boston Dynamics cheetah-bot now sprints faster than humans.



"Boston Dynamics' Cheetah robot has just set a new record for legged robots by sprinting at 28.3 mph. This, incidentally, is also faster than Olympic (human) champion Usain Bolt, who set the world record for the 100 meter dash with a speed of 27.8 mph back in 2009. Yes, this means that now there is officially no escape from a robot cheetah on a treadmill. You've been warned."

http://spectrum.ieee.org/automaton/robotics/military-robots/boston-dynamics-cheetah-robot-now-faster-than-fastest-human?utm_source=feedburner&utm_medium=feed&utm_campaign=Feed%3A+IeeeSpectrumFullText+%28IEEE+Spectrum+Full+Text%29
  • Current Music
    Hawkwind - Fahrenheit 451
ronin

Rollins Pass / Heart Lake hike

Moffat Tunnel to Heart Lake is one of my favorite hikes in Colorado. It's fairly long at 8.4 miles (and 2100 ft of vertical), but I find the scenery well worth it. I didn't get pictures the first time I did this hike, about three years back. But this time...



The drive up is on (well maintained) dirt road for the last several miles, and there are multiple railroad crossings.

Collapse )
ronin

Nice try, Chief Niwot.

You can dredge up my favorite roommate from college and throw him at me, but it's still not gonna prevent me from moving out of the People's Republic of Boulder.

You want to keep me here, this is what you're going to have to swing:

A decent apartment (need not be big, but not a rathole), within easy drive of Foothills (mostly rights, no difficult or long-wait lefts), south of Arapahoe (I am NOT wading across that crap every morning), less than $650/mo.

Get on it - you only have a couple of weeks.
  • Current Music
    Aerosmith - Dream On
ronin

A decades late rant on XML.

The fact that I've been able to avoid XML until now is - I think - generally a positive reflection on my software engineering instincts. When XML was a big new thing, I took one look at it and said to myself: "Uh, yeah... no. I'll just be over here with my C and my micro-controllers and stuff. Y'all have fun with that." As it turns out I called that correctly. It's nice to get one right.

But I'm also lucky that today, in the here-and-now, we actually know that XML isn't the best way to do a lot of the things that its advocates claim(ed) it should be used for. Today we can point at JSON or CSV or whatever and say: "That works (much) better." If you were a programmer in 2003 and thought XML sucked, you didn't have anything well-known to counter it with. And so quite possibly got forced to use it.

So forgive the "old news" flavor of this rant. Everyone who was forced to use XML (which is probably nearly everybody by now) has already learned these lessons. I've just been lucky enough to not have to use XML in any serious capacity... until recently.





XML comments are weapons-grade fail.

First, let's face it: XML got comments wrong from the very start. The mere idea of using one string ("!--") to open a comment, and then a different string ("--") to close it, was flat out stupid to begin with. What, exactly, was wrong with <-- comment --> ? Would that have been too easy to read? Too easy to type?

But of course XML couldn't stop failing there...

You can't put the string "--" inside a comment.

<!-- This is the first line of a comment.
  -- This is the second line of a comment.
  -->

If you do something like that, get ready to see:
ERROR caused by: org.yackity.smackity.WhackIty.JackIty.HackIty.OhGodHelpMe.ICanSeeForever.YouAreInAMazeOfTwistyLittleExeption
*** String '--' not allowed in comment at [row,col {unknown-source}]: [37,6]

Stop and think for a minute about how incredibly stupid this is. The string "--" is not "<--", nor is it "-->". Thus, "--" should have no significance what so ever unless it is immediately attached to a "!" or ">" character. There is quite literally no reason at all to disallow "--" inside a comment.

Just to drive the point home, let's show an example of what would happen if we used some other string instead of "--". How about "fish"?
<!fish This is a fish. fish>

That would be invalid XML. Because the same word that came after the exclamation point, was also found again in the comment.

The level of brain death required to accept this state of affairs even temporarily, much less advocate this as a global standard to be used for decades... is just staggering.

But did XML cease its parade of comment failure there? Oh no...

You can't comment out an attribute.

Wanting to commenting out an individual attribute is a perfectly normal and reasonable thing to do. Something you'd clearly anticipate someone wanting to do, among other occasions, during process of debugging. But XML won't let you do it:
<sometag
  firstattrib="a"
<!--  secondattrib="b"  -->
  thirdattrib="c"
  fourthattrib="d">
</tag>

Or, suppose you're trying to explain why an attribute is set the way it is...
<sometag
  firstattrib="a"
  secondattrib="b"      <!-- Reticulates splines optimally. -->
  thirdattrib="c"
  fourthattrib="d">
</tag>

In both cases, your XML parser will shit all over itself at secondattrib. In XML you simply cannot have comments anywhere in a list of attributes. Period. Why? Because XML comments are made of pure fail.

!-- SPECIAL BONUS FAIL --

XML's <xs:sequence> is used all over the place in XML schema definition files. This allows the schema designer to enforce the exact order of sub-tags with a tag. Which in turn allows the XML parser to reject a perfectly valid XML document for no other reason than the order of the sub-elements inside some tag was different than it expected. E.g, this works fine:
<tag>
 <dog>lassie</dog>
 <cat>mittens</cat>
</tag>

But this blows right the hell up:
<tag>
 <cat>mittens</cat>
 <dog>lassie</dog>
</tag>

I honestly don't know why <xs:sequence> was even created. I've been thinking about this for a week and I can neither think of, nor find via googling, any example anywhere that shows a valid need to enforce the order of child tags within a tag. The whole point of having a Data Description Language is that doing so allows the computer to take care of the little bullshit things - like what order some arbitrary list of items is given in. But XML schemas far and wide enforce bullshit ordering with <xs:sequence>. Why? Because screw you, that's why!


Considering that XML requires a sophisticated Turing-complete parser to parse correctly, the fact that it can't make a single one of the above simple and obvious things work is very impressive. XML has accomplished something that's rare even in the bug-ridden and incompatible realm of software: it has managed to create the worst of all possible worlds.

So, why does this incredible heap of crap survive? Are we, the software engineers, REALLY THAT STUPID?

Yes. Yes we are.

In 2.5 years it will be 2015. And in 2015, hundreds of millions upon hundreds of millions of lines of code will still depend on - or even be written specifically to support - XML. Because we as software engineers are too damn stupid, too damn lazy, and too damn cowardly to put a bullet in this disease-ridden corpse that never should have won out over plain old SGML in the first place.

tl;dr - Screw XML. Screw it forever. XML is the herpes of the software universe.




And to my fellow software "engineers": if you advocate the use of XML in a new project that could just as easily use JSON, CSV, Windows .INI file format, or any of dozens of other far saner options... shoot yourself in the head you are a bad person and you should feel bad. (I understand, however, if you got stuck with a codebase that is already deeply XML-dependent. My condolences. Welcome to the club.)
  • Current Music
    MC Plus+ - Dear Engineer
ronin

Who knew source control could be so hot?


Collapse )

Why am I cloning JBoss? Because to understand how to get the config files right, I had to compile a debug version and single-step it.

What's what you say? I might be feeling "not impressed" with JBoss? Perhaps I'm thinking what JWZ said about the time-value of software? Well, I will neither confirm nor deny such outrageous accusations! ;]

See also http://hwellmann.blogspot.com/2011/06/java-ee-6-server-comparison-jboss.html?showComment=1310532902809#c669989613092099368 , particularly Craig Ringer's comment at the bottom.
ronin

Indian teenager finds closed-form equations for projectile motion *with* air resistance.


300 years ago, Newton posed the problem of finding a closed form equation to model the motion of a projectile acting under the influence of both gravity and air friction. He couldn't solve it, and until recently nobody knew if there was an equation that did describe it.

Turns out some Indian kid who recently moved to Germany found said closed-form equation.

The problem he solved is as follows:

Let (x(t),y(t)) be the position of a particle at time t. Let g be the acceleration due to gravity and c the constant of friction. Solve the differential equation:

(x''(t)2 + (y''(t)+g)2 )1/2 = c*(x'(t)2 + y'(t)2 )

subject to the constraint that (x''(t),y''(t)+g) is always opposite in direction to (x'(t),y'(t)).

Finding the general solution to this differential equation will find the general solution for the path of a particle which has drag proportional to the square of the velocity (and opposite in direction).


http://www.reddit.com/r/worldnews/comments/u7551/teen_solves_newtons_300yearold_riddle_an/c4sxd91

Basically, given the coefficient of air friction and the force of gravity, and a particle's initial velocity vector, this allows you to calculate its velocity vector at any later time.

This should be a good thing for video games. Making objects move through the air realistically just got a whole lot easier. The immediately obvious applications are sports games - tennis, golf, baseball - which use relatively small round objects with easily defined coefficients of friction. In the long run, all game physics should get more accurate and faster as a result of this.
  • Current Music
    Type O Negative - Gravitational Constant: G = 6.67300 × 10-11 m3 kg-1 s-2
ronin

Java debugging old-school with JDB.

I've been spending a lot of time at work lately debugging Java. The details are not particularly important, other than to note that the popular description of JavaEE as "the new COBOL" is deadly accurate.

Most of you whipper-snappers probably use Eclipse to do your debugging these days. And that works quite well as long as you happened to compile the code you're debugging. But what happens when you didn't compile the code you're debugging? With Eclipse, you're pretty much screwed. Even if you create a fake project and link in the source, it still never really works quite right. Breakpoints often don't break. Eclipse often can't figure out which line you're actually executing. Etc.

So let's talk about going old-school - enter jdb. Never really intended to be more that a proof of concept for the JPDA, it actually turns out to be surprisingly useful when you need to debug something you don't have source code for and/or didn't compile yourself.

One nice thing about jdb is that if you have a JDK, then you have a copy of it. It's been a standard tool since Java 1.2. If you're on Windows, Unix, a Mac and have installed a JDK, then jdb(.exe) will be waiting in $JDK_HOME/bin/.

Another thing you may be surprised to hear about jdb is that it can do remote socket debug just like Eclipse can. This isn't well documented, so I'll give you the magic invocation here:

First you start the remote program you want to debug on myserver.com with something like:

java -agentlib:jdwp=transport=dt_socket,server=y,address=8787 myClass

Then on your local machine, run:

jdb -connect com.sun.jdi.SocketAttach:hostname=myserver.com,port=8787


Here's a quick cheat-sheet to get you started with the obvious stuff:

stop in com.mydomain.mypackage.myclass.mymethod         # Set breakpoint on method entry
clear   # List (no args) or clear (with args) breakpoints
use /home/mydir/sourcecodedir/     # Set source code path
list    # List source code lines
next    # steps OVER method calls
step    # steps INTO method calls
step up # run until current method returns
cont    # continue exection after breakpoint
print (somevar)   # Show current value of somevar

All pretty standard, I know. But it should be noted that all of the above work whether you have source code or not, which beats the hell out of Eclipse. Now, how about some stuff that's a little more fun?
classpath     # Print JVM's classpath
disablegc (expr)   # prevent garbage collection of an object
classes                   # list all currently loaded classes
class org.package.class   # show details of named class
methods com.this.class    # list a class's methods
fields com.that.class     # list a class's fields
eval (java expression)  # Run arbitrary java code, alter program state at will
redefine com.some.class newcode.class  # Load new .class file to redefine an existing class

Some interesting possibilities there, eh? eval is particularly fun. Need to delete an item out of a HashMap? Just eval myHashMap.remove("thiskey") and you're done. (And yes, Eclipse's debug perspective can do this too if you know how... but how many people do?)

The possibilities for redefine are especially amusing to contemplate...
  • Current Music
    Pearl Jam - Bugs