Showing posts with label hacking. Show all posts
Showing posts with label hacking. Show all posts

Tuesday, May 7, 2013

openstack

I figure it's time to finally get back to writing posts about nerd stuff, and so I'll start with adventures in openstack.

Saturday, July 14, 2012

ajax with jquery in rails

So I'm going back through the updated rails books in an effort to see what all has changed since I last poked at it (as it turns, quite a lot).  One of the big changes was the removal of RJS (rails javascript) and the move to jQuery.  Unfortunately, the new jQuery interface doesn't seem to be referenced in the doco I've got nor was it easy to get a straight answer from googling, checking the js console, or even good old alert() debugging.

Thursday, June 23, 2011

the lost month

So, not quite a month since my post about weight loss, but figured that I'd go ahead and update anyway.

As we pushed on into June, I had managed to drop to 355 (lost around 30lbs in 2 months) and was feeling kind of cocky. On the 10th, I took a 3 day trip to the beach and induldged in carbs. When I got back home, I found I was at 370 and got pretty disheartened about the whole deal. It wasn't until earlier this week that I started getting back on the low carb regimen, and I'm now down to 362.

Friday, June 3, 2011

laser table mark iii


So, I've mostly completed the frame for the "Mark III" version of the laser table. I decided not to use the previous version because of a change in options to mount the lasers. The drafting table just didn't have enough space for the flush mounts.

The features of the new table are:

* built from 2x4s so it's sturdier (but also heavier)
* the table top is hinged and has legs built in so it can be used flat or lifted to be an angled surface
* used pocket screws to hold stuff together... looks less "engineery" while joins are stronger

What remains to be done:

* figure out some way to mount stops for the tabletop legs to hold it at an angle
* cut some mounting rabbets out of moulding to hold the plexiglass surface just below the center of the laser beam
* cut the plexiglass down to fit in the rabbets :)
* mount the flush mounts at the correct angle to cover the entire surface
* rejigger electrical stuff to run off floppy disk power lead
* see if running lasers in series will work better than in parallel (currently using the parallel setup)
* wax paper on acrylic and see if the projector works

Then I can start on the software phase.

I should probably also think about attaching a trap for the laser light at the edge of the tabletop, but for right now I just want this sucker to work.

Way more info after the jump.

Wednesday, May 25, 2011

a month of data

A month ago, I made some changes to my diet after my doc ominously dropped the D word. Basically, I've started doing an Atkins-like program... still trying to keep carbs to 20g or less per day, but I haven't been following it as strictly as I could have. End results is that I've lost around 18.2 pounds in a month's time.



Wednesday, May 18, 2011

MT table Mark II

Okay. So my last swipe at this wasn't technically a table, but give me a break. I got busy and couldn't find spare time for... 18 months. /o\

Any rate, I've been on a kick lately and I'm moving away from doing stuff on my computers and moving more towards the analog method of designing stuff: grabbing a damned pencil and a sheet of paper and just sketching it out. I don't know why, but when I write/draw something I seem to retain it for a much longer time than if I type it up. Part of this has led to a desire to get a good old drafting table. But why buy a solid pre-built one when you can build a shaky, hideous one from scratch and save $20?

So I set about designing a drafting table, and about halfway through it occurred to me that I could also fashion it so that I could remove the plywood table top and slide in a sheet of plexiglass later on to easily convert it to a multitouch table later on.

Since it's been 18 months... here's a link to previous multitouch posts (read from bottom up for chronological order).

And here is a link to the Mark II.

It's not as perfectly aligned as I would like it, but I don't think it's half bad for my first woodworking project EVAR and it's sturdy enough I can lean on it. More thoughts after the jump.

If anyone is interested in plans (although it's not that complicated) or has questions about the construction.. hollah.

Sunday, July 4, 2010

uml deadend or why your proprietary file format is a really, fantasically bad idea

So, I'm working on a project. Pretty big SQL setup, lots and lots of complexities. Good news is that the whole thing is described well with a "UML" document. There is also a tool in place to generate SQL-like stuff for MS SQLServer, but it takes advantage of some of MS SQL's quirks in the code it generates.

What I'd like to do is take the UML document as input, and have it spit out a bunch of ORM files for me in another language and just let the ORM's framework worry about the messy SQL details for whichever database ends up being used. Not only would this be (slightly) less tedious than manually building up the objects by hand, it would have the benefit of making the UML document a single point where the database could be managed in the abstract and I could get on with doing the stuff that's more computer sciencey and less data enterishy.

But. I can't. Because the UML file was created with a very feature rich UML editor that lets you draw really nice and really well annotated diagrams, but locks it all up inside of a very non-UMLish file format. And for the icing on the cake, the company that made the editor closed up shop in May and has decided to not only stop taking orders for their software but providing the free evaluation download as well.

From my point of view, this makes the file just as programmatically useful as a jpeg picture of a diagram of the database layout. The tedious grunt work of examining the diagram and manually hacking it all together is unavoidable, which means that now we've introduced the chance of documentation skewing away from the implementation. Inadvertent forks from last minute bugfixes or poorly communicated design changes are now on the table.

All because a software developer thought his method for storing UML data was better than just using simple UML, and that his clever method would assure him of job security.

Wrong on both counts, mang.

And now we're both hosed.

Just stick with the standards, people. Please?

Monday, April 12, 2010

tunnel vision

The other day I was browsing around on a professional networking site and came across a post in one of the forums from a guy asking for help on solving a monitoring problem. The problem was that when the servers got under a heavy enough load they would become unresponsive to his monitoring systems and the page would light up like a Christmas tree. He was looking for suggestions to relax the monitoring thresholds so the alerts wouldn't bug him.

/o\

The problem is not that the monitoring system is doing its job. The problem is that the servers are under such high enough load that they can't respond to simple "Are you still alive?" queries from a monitoring system. The correct solution is to either add hardware to the cluster and distribute the load or find some way to refactor the code so that it's more efficient.

More alarming was the fact that a bunch of people weighed in before I got there with various suggestions on how to increase timeouts, drop SNMP monitoring, etc. In a week, none of them said, "Hey, maybe the server being in distress is like, bad."

In the tech world, we fall prey to tunnel vision a lot. We become willing to push an incorrect solution to a problem so far that we will layer bad idea after bad idea on to a system, which in turn just keeps bringing in more and more points of failure. Pretty soon, you end up with a shaky, complex Akira style thing that is impossible for anyone else to understand or modify that does nothing but create unnecessary work for you.

The more I look around at my colleagues and talk with them about the battles they're fighting daily, the more I start to wonder if anyone else understands why the bearded Unixy elders held elegance in such high regard.

Wednesday, January 13, 2010

win32 c++

So I was presented with a situation where I needed a binary to simply run some predetermined commands on Windows. I said, "Why, this is a simple fork/exec under Linux. How hard could it be in Windows?"

Turns out, a lot fscking harder than it needs to be.

The primary problem stems from the way Windows "attempts" to support multibyte characters. Or rather, the wayS it supports multibyte characters... you have a choice of the ANSIish widechar that can do UTF-8, or the one that MS Visual Studio defaults to LPWSTR for UTF-16. The Windows libraries helpfully provide replacement functions for stuff like sprintf() and such, but the common and well known string functions are cut off from you. Worse, some wrappers to system calls like GetCurrentDirectory() will only return LPWSTR and only take LPWSTR args, and because these are differently sized types you can't just cast your out of the problem.

Oh, and stuff like malloc()/calloc() doesn't appear to work with the macros, either. Or at least I didn't have the time to unravel what the correct way to use them were in the time I had alotted.

In the end, I used something like:

wchar_t* thing[SIZE];

and just used a typecast whenever I needed to move into or out of the variable: (LPRWSTR) thing, like when using _stprintf() to build up these strings.

So, basically, I ended up being corralled into doing freshman level C just to get stuff working.

What I've taken away from this experience is that I absolutely, positively, 100% don not ever want to do any serious Win32 C/C++ development. Ever. EVER. And if I do have to go down that road, then I'm going to try and stick with ANSI... maybe even to the point of using cygwin exclusively to avoid getting sucked into this nightmare again.

Monday, October 26, 2009

plexiglass sucks

Spent the weekend cutting up a sheet of plexiglass for the table top. I hate cutting the stuff, but it seems to have worked out ok (aside from my complete inability to cut a straight line).

Ended up snagging a sheet of 36"x30" sheet of 0.203" acrylic from Home Depot for about $43 (total cost of project so far is around $120). Since 0.203" is about 5mm and the diameter of the laz0rs is 12mm, I decided to just cut 4 grooves at 45 degrees in each of the corners, then glue on a 1"x1" base plate on the bottom to support the lasers. I then cut about 8 3/4"x1/2" blocks to glue on the top side of the plexiglass on each side of the groove in order to something close to the top of the laser that I can bolt a cap on to.

The extra bits (baseplates and blocks) came from the scrap I had after cutting 3" off the sides and 5" off the top so that I ended up with a 33"x25" piece (32"x24" for projection area, 1" margin for mounting lasers and the frame later on). I also use a piece of scrap to do some test cuts and to check out the laser to make sure it was sitting about right down in the groove.

My previous experience was with much thinner plexiglass, and the only viable way to cut that was with a scoring tool. With this thicker stuff, so I was able to put masking tape on both sides of the sheet, draw the cut line, and move a jigsaw through it at about 1/2 speed without any melting or the sheet cracking. I did a test cut on some of the scrap I had left over without the tape and the blade made it about 2" into the cut before the melted plastic jammed the jigsaw blade.

And speaking of the blade... I went with a carbon blade designed for cutting metal.

For the 45 degree grooves, I cut in with the jigsaw, tried to round out a corner cut, and then just cleaned out any left over with a dremel.


Testing out with the laser showed revealed something I hadn't accounted for in my earlier designs -- the fact that lasers are very precise little bitches, and that while the grooves I made for them gets them pointing in generally the right direction there still needs to be some way to do fine grained calibration. Namely, elevate the rear end of the lasers and make sure that they're throwing the beam parallel to the glass.

Next tasks: rigging up power for all 4 lasers, doing tests to find out how far away to mount the camera, and figuring out how to mount the lasers so that they can be adjusted.

For the support frame, I'm kicking around just getting an old vanity cabinet or something to hold everything. Still ignoring the project problem for the time being.

Wednesday, October 21, 2009

math fail

So it turns out that if you want to like, play with electricity, you have to do some of that math crap. It also turns out that when you see numbers like "3.2V 25m" the "m" doesn't stand for milliamps, it means milliwatts... and using that math stuff, that works out like 7.8 mA.

P = V * C (power [watts] = voltage * current [amps])
V = I * R (voltage = current [amps] * resistance [ohms])

I was testing the lasers out by simply hooking the power leads up to my cell phone 5.5V cell phone battery, but later we rigged up something a little more stable with a 9V battery, and some alligator clips on a 270 ohm resistor. Turns out that's pushing 33 mA on 300 m.

Whups. It still worked, but apparently overclocking the lasers means you lose some of their life.

In other news, I snagged a Logitech Quickcam for Notebooks (yes, that whole thing is the product name... no version numbers or anything.. "for Notebooks) for around $40. The cam is way easy to disassemble as everything is screwed together, and driver support for Linux is in most current distros. IR filter popped out easily enough. For the regular light filter, I tried cutting out a square from an old floppy disk, but it severely dims the IR light at a distance of about 3 feet. Going to try an exposed negative next.

Still trying to figure out what I'm going to do about mounting the lasers on the acrylic. The diameter of the laser (including the casing) is about 1/2 an inch which is about 13mm, so just sitting the laser on top of the acrylic is going to be about 6mm above the surface (and it needs to be at one). Thinking about just getting the acrylic so that there's an extra inch on each side and cutting 4 1/4 inch wide slides at 45 degree angles in each corner. That should let me sit the laser so the beam is just right above the surface, make it easy to secure with some tape, and allow me to easily remove them from the board to make adjustments.

Now I just have to find a way to deal with the nightmare of cutting acrylic... :(

Tuesday, October 20, 2009

IR lasers finally arrive

So it only took 11 days, but the lasers are finally here. Was talking with TheDude about how I'm going to power them, and he suggested a USB hack and pointed me towards this maximumpc article that covers the basics. Have already checked them out to make sure that the light is visible on the webcam I'm thinking about snagging by simply hooking them up to the cellphone battery for a test run.

The numbers: I got 4 lasers, 3.2V each, 25 mA, currently unknown resistance. The plan is to appropriate the USB cable from a dead MS Intelliexplorer mouse and use that for USB power source. The USB port runs 5 volts at 100 mA in lower power mode, so I shouldn't need to worry about asking it for more power or anything.

The shopping info: I ordered 740 nm lasers with 89 degree line splitters from aizix.com for $11 each ($8 for laser, $3 for splitter attachements). Not entirely sure I would recommend them, but as of right now I don't know of anyone else who isn't selling just the diodes or the laser already as part of some other device.

ToDo list:

1) obtain the acrylic sheet and figure out how I'm going to mount these suckers (estimating $20 for the sheet)
2) acquire a camera (thinking about a $20 gigaware cam from The Shack) and modify it to remove the IR filter and possibly in a regular light filter by butchering a floppy disk
3) splice work for the lasers and make sure that the camera can see the touches
4) clean install of linux on an old PC and see if I can't get the nuigroup software up and running

Projector and the frame to hold all this remains question marks for the time being.

Friday, October 9, 2009

leaning towards laz0rs

After doing some more reading and watching the arbitraious's laser table demo, I'm pretty much sold on trying that out first. Aside from the fact that mounting 4 lasers sounds like a much easier task than 40 LEDs, it also sounds like the laser approach offers up better responsiveness. The lasers are slightly more expensive (around $8 per, whereas the LEDs are about $2.63 for 10 for the high end ones), but that's not really the major cost center of this project.

Plus, I'm sure that by simply ordering lasers online, your name automatically goes on some FBI watch list, so... +notoriety, amirite?

For the video camera, I'm planning on grabbing a $20 Gigaware 1.3MP cam from The Shack (looks like a flat disk... avoid the one that looks like a mini-quickcam-eyeball-with-a-bump-on-it) simply because it's so low profile.

The sticking point is what to use to actually project the image. I don't want to waste money on another projector, but TheDude pointed out that some of the pico pocket projectors are around $200 and designed explicitly for short throw distances. The other approach might be to just tear apart an LCD and get a fresnel lens. Still mulling that part over. It'll affect the height of the enclosure.

I'm also mulling over the construction of the frame to hold the acrylic sheet. Trying to decide if there's a way to have it hold the lasers in place without having to muck with the sheet itself, and looking for some IR absorbing material to line the insides with (for that token nod towards "safety"). Will probably start ordering parts tomorrow and see how it goes.

Thursday, October 8, 2009

NEETS

Ok. Admission time. I don't know a damned thing about electronics, aside from the fact that capacitors are round and the big ones can probably kill you so just stay the hell away from them.

But it's become clear that some electrical work is going to need to get done in order to pull of the MT screen. The usual strategy of wait helplessly until New Egg sells isn't going to work this time.

So my new strategy was turning to Mr. I Grew Up MacGuyvering Radios Together with Bobby Pins and a Potato and Have an EE from the Air Force Academy -- aka, "Dad" for advice. But that went something like:

"Well, you'll need to get a couple of 82 ohm resistors."
"Wait. How'd you figure that out?"
*incredulous look* "You just take the voltage, add up the fronkus coefficient, and then subtract that from the average magnetosphere reading for the location where you'll be using the device."
"That doesn't sound right."
"And be sure you pick up a Henway with the breadboard at Radio Shack. You need a Henway, or this is going to blow up."
"What's a Henway?"
"Ohhhhh, about the same as rooster! HAHAHAHAH!"
".... You are so screwed when we start talking about whether or not to put you into a nursing home."
"Go do your own homework."
"Seriously. I'm going to watch 60 Minutes to make up the list."
"And get a haircut."

So I googled "electronic training that will really piss of my dad", and up came a link to:

NEETS

Google for the acronym if that link is dead... there are lots of places that carry mirrors of it.

Navy Electrical and Electronics Training Series. It's basically about 20 "modules" that take you through simple DC stuff, converting mechanical energy to electrical, radio waves, logic gates, and wraps up with radar. It's targeted towards enlisted personnel, so it's written for someone with a high school level education and slants more toward the trade side of things than dipping too far down into the theory.

In short, if you've ever been curious about electronics but cringed in horror at the thought of going through a college level EE textbook, this is TFM you should R.

Wednesday, April 1, 2009

vmware setup

Probably worth talking about the vmware setup here, too.

First off, I'm using VMWare Player. I snagged images for Debian 5.0, Ubuntu 9.whateverthehellthey'reonnow, and Fedora 10 from ThoughtPolice. Gave each one of them static private IPs, and setup their net interfaces to use a bridge instead of NAT so I could have full network access to them directly from the Debian "ohmygodit'sstillrunningetchtesting!!!" laptop. I also setup a shared folder on the host XP machine, and have each of the images smbmounting it on boot so I can easily move files around. Currently considering setting up Active Directory on the host and mucking around with pam_ldap auth off of it, but not motivated enough to find the XP64 install cdrom at the moment. Machines are using a MySQL 5.0 server running on the XP host (and, by the way... MySQL admin on windows is an absolute pain in the butt).

The Q7760 proc seems to be handling it all in stride despite being a tad old, and 4GB mem appears to be sufficient for the Rube Goldbergesque virtual network I've created. Disk space usage has gone up, but with 1.5TB drives at $120 now, expanding that shouldn't be a problem.

Yay virtualization. :)

back to rails

So, back to rails. Got yet-another-project that seems like it should be right up rails' alley. Did a little bit of refresher reading tonight, and it seems like if I'd understood helpers, routing, and js templates better I might have avoided painting myself into a couple of corners during the last explorations in RoR-land.

Or maybe it's just because now I have a better understanding of javascript and don't regard partials as dark voodoo anymore.

Any rate, we'll see how this works out.

For the dev environment, I've decided to keep the XP64 desktop, but am currently running a series of VMware instances through Player to find a distro to work on. Will probably stick with Debian. I think I'm going to run with Netbeans as the IDE for now, but we'll see if that starts cramping my style and gets the hose or not.

Tuesday, February 3, 2009

and while we're on the subject of dropping MS stuff..

I also took a peak at Azure. Some interesting extra info about it: they have set it up to allow you to use it as a stand-alone platform. The idea is that the the services Azure provides on MS's server farm are replicated on your desktop, so that you can create a standalone desktop app that could be moved Into The Cloud(tm) later on.

Like, say you were creating an application for your HR person at your 10 person company to manage vacation requests, salary info, emergency contact information, certifications, etc, etc. Then you walk in one day to find that the company's grown to 200 people, and your HR person is crying softly in the corner begging for some help, so you hire a few more HR folks. If the app is Azure based, you can move it off the one desktop that the original HR person was using and onto your own internally hosted stuff (SQL server, SharePoint, and use AD for permissions) or you could push it out onto MS's Azure hosting hardware without having to rewrite the code.

In theory. In reality, I'm guessing that it's a lot more rocky of a transition.

But.

I won't be finding out any time soon. The SDK requires Vista on a 64bit system (not gonna happen), and can't run in 32 bit mode on a 64 bit proc under XP. Ah well. :)

dropping F#

A while back I wrote about my discovery of F# and interest in monkeying around with it.

After spending some time reading up on it, I realized that this was going to be more messy-headachey than chocolatey-awesomey. It just doesn't seem smoothly integrated into .Net... and that some of the syntax is just weird (even for a functional language). The other problem was that I'm already jumping around between 5 different languages in personal and professional projects and have already hit that annoying point where I'm having to check reference books and library APIs to remember the right syntax on how to do something ("Wait, was is it elsif, elif, or else if in javascript? Was it that python didn't have a case/switch, or was it that ruby did case/switch in a weirdway? Is the command to make lightning arc out of the monitor and zap the user for entering a text value when I clearly asked for a string part of the .Net core library, or did I need to import something?")

At the end of the day, it seems like a better strategic decision to just keep functional stuff out of the way altogether and if I need to use it then simply contain it to a seperate service/program.

MS, on the gripping hand, has decided to try and push it into .Net 4.0. /o\

Thursday, November 6, 2008

the zen of programming

Programmers get paid to write lines of source code.

Good programmers get paid to delete them.

Awww... c'mon. That was clever. :(

Any rate, the distinction occurred to me as I was slogging through a project a couple weeks ago as I was revising some work on a project. Code written for a specific application seems to generally sort itself out a few revisions, and you find that as objects and APIs mature, you need less and less code to get the job done.

End result is that I seem to end with less SLOC in my final version than I had in my 2nd revision and everything just feels more snug.

Wednesday, October 29, 2008

MS Azure

Did a little investigation into the announcement of Azure. It basically sounds like MS's response to Google App Engine, except for ASP.net. And apparently giving you access to a bunch of Live services for your web app. And integrated with the Visual Studio EE stuff.

Might be of interest to folks looking to get some experience with MS's enterprise tools without actually having to shell out cash for them.