Just wanted to share a little proof of concept of Sinatra + Websockets + Applescript for browser based UI to anything on your Mac.
You need to
sudo gem install thin em-websocket sinatra rb-appscript
So, I was reviewing one of my happiest perl-hacks, the Roskilde band finder, and due to a combination of perl line noise and my own inadequate design I simply failed at extending the hack like I wanted to. That's not what your goto quickfixer tool is supposed to offer you, and so I was disappointed and it felt like I lost some ability right there, as perl refused to be friendly to the task at hand.
I was a bit dismayed, because I have after all done a lot of nice little things with perl, and more so, because of the convenience of habit I have after a decade of perl scripts. I've moved a lot of my scripting to ruby, but ruby fails at delivering the level of brevity I have in perl. Or, ruby used to at least. Lately I've been rethinking that point of view. For sure, I'd rather write Eventmachine servers than POE servers. ActiveRecord outside of Rails isn't so bad. And I just discovered mashup-artist HTTParty. Decide on a "one file only" web framework* and I'm pretty much there.
I still need a couple of niceties** - but I think some DSLy goodness fixes most of what I'm missing. But I'm going to start migrating the Roskilde tool and I'll let you know what it ends up looking like.
* I think just Sinatra with erb will do fine.
** Something that does AWK inside ruby, basically - perl is what does AWK inside perl all on its own.
Man kommer let til at sidde fast på mobiludgaven af avisernes nyhedssites, hvis folk har sendt links til dem fra iphones eller androids, og det er pisseirriterende.
Greasemonkey to the rescue: Rigtige Nyheder kan du installere i din browser (i chrome uden videre - eller i firefox, hvis du har installeret greasemonkey) og så kommer du automatisk over til den "rigtige" udgave af historien.
The first thing I thought when I saw Double Rainbow Guy in action was that I really needed this for my alarm clock. Scouring the Internet, I found instructions on how to add new alarm sounds to an android phone: Simply create the directory
/system/media/audio/alarms
You can get the audio here.
Whether or not its RESTian kosher I don't know, but the live Apollo 11 transcript is built natively around a JSON API. If you don't like mine - feel free to make your own.
Details: The API is at
http://www.classy.dk/cgi-bin/apollo_transcript.pl?q=transcript&jsonp=somejsonp_prefix
http://www.classy.dk/cgi-bin/apollo_transcript.pl?q=transcript
If something is unclear just view source on http://classy.dk/moon - which explains in source how to use it with JQuery, and gives tables describing the IDs of speakers.
This way of building websites: Presentation with HTML+CSS+JQuery and a pure API backend really appeals to me. Clearly there are fallback concerns for non-modern browsers etc. etc. but the separation of concerns is appealing - as is the instant availability of an API for other's to use.
It worked wonders for the ARToolkit to be connected to the Flash developer community. Maybe it will work for Arduino and hardware hacking as well - using the Netlab toolkit.
It must be a money making scheme - but iMovie won't eat Quicktime video for editing. Annoying way to make money is all I'm saying - fortunately there's an easy workaround: iSquint will compress and convert to MPEG4 - which iMovie will gladly handle. Obvious caveats on quality and compression rates apply.
Har du lavet noget der (næsten) virker, så kom og vis det - eller kom og se på de andres ting.
(English? Summary at end of post.)
(location: Egmont HQ, Vognmagergade 11, Kbh K. Be there sharp at 8PM - we need to traverse access control. )
Sign up here (or by leaving a comment on the post)
Jeg ved ikke af at der findes en begivenhed med følgende plan i København: Man møder op med sin dims. Noget man har lavet. Noget der virker*. Man har 15 minutter til at vise det frem og så er der fem minutter til snak. Så er det næste projekt. 5-6 projekter per aften og så en ølpause Demoer er 7 minutter lange, med mulighed for dommerens overtid. Diskussion i pausen og bagefter. Tænk pecha kucha, bare uden slideshows.
Vil du være med til at lave en? Jeg kan ikke se nogen grund til begrænsninger af hvad projektet kan være - web, visuelt, auditivt, mekanisk, elektronisk, til køkkenet, søfarten eller soveværelset - udover nogle grundregler:
Datoen er ikke skrevet i sten. Jeg foreslår tirsdag som en god ugedag - fordi torsdage og fredage for ofte er optaget.
Læg en kommentar hvis du er interesseret. Skriv om du gerne vil se på, eller om du har noget i skufferne du gerne vil vise frem.
English Summary Want to participate in a (software or hardware) demo day in Copenhagen? June 9th. Only running code. Demos are 7 minutes (with negotiable slack) Other than that hardware or software, woodware or anyware, web or desktop, mobile or stationary - anything goes. Leave a comment if you're interested. Include whether you've got stuff to show or want to look.
* Om det er lavet af træ, chips, papir eller bits er op til dig. Det skal være lavet. (næsten) af dig. Man skal kunne demoe det. DET VIRKER er de magiske ord, der åbner døren op. Tvivlstilfælde afgøres af Deres ærbødige overdommer.
Tetherbot is handy for quick and dirty internet access through your Android phone. It's not full on tethering - since you don't get a network interface - but having a Socks proxy works out fine in a pinch.
The only thing about it that isn't absolutely obvious is that proxying does no good if you don't have DNS. Firefox does not, by default, proxy DNS requests over SOCKS even if you set it up to use a SOCKS proxy (would be intelligent to do so, when the regular network interface is down, but there you are).
To make this work you need to open a tab to about:config and find the network.proxy.socks_remote_dns setting and set it to true. You should set your socks proxy to be a SOCKS5 proxy btw.
That's all - now Firefox is proxied, and that's good enough for me. Almost everything I need can in turn be reached via the browser.
(exception is SSH, but that's easy to fix. Follow the "port bouncer" instructions for Tetherbot).
Short Version: If your Windows printer is not a postscript printer, use this trick to make a virtual postscript printer from your Windows printer. Then make sure your VM'ed Windows has printer sharing allowed on the firewall, and set up the printer as a network printer on Mac. You might need this guide to do that.
VMWare Fusion just saved me the money to buy a new printer. I was already very happy with VMWare Fusion, since my switch from XP to Mac. Using Fusion I was able to convert my XP machine to a virtual machine on the Mac, so I have lost no functionality at all - now I just have all the convenience of both operating systems. And I get to keep my C# and Visual Studio skills alive even though I'm on a Mac.
One problem, though, was printing.
A while back I bought an HP Laserjet 1018 from Morten, he couldn't use it because it's a Windows printer and he had switched to Mac. I had forgotten all about that, when I switched, so now his problem was mine.
There are some tricks around the net requiring firmware uploads to the printer - and if you turn it off you need to do it again (I think, the instructions were too complicated for my liking). Simply sharing it from my VM seemed better. The only problem, of course, was that it still had no Mac-happy drivers.
Ghostscript thankfully comes with a complete recipe for using any system printer as a Postscript printer (see above). Using this, and circumventing some broken printer discovery in Leopards Windows printer setup (also above) I now have a Postscript printer on Mac OS X which is really a Windows only HP.
The amount of indirection involved here is quite staggering: The physical printer, connects physically by USB to my Mac. The USB interface is virtualized inside my VM, inside which the printer is virtualized once more as a postscript printer. This virtual, virtual printer I can then connect to from the Mac and the deed is done.
Don't have a Windows license? I think this trick could be made to work with Linux as well - there are Linux drivers for this printer, and the rest of the toolchain also runs on Linux. VMWare Player + some hackery could be a Windowless way out (for this particular printer).
A quick rundown of the various physical interfaces I have for sensing information from the real world
In short: Lots. I am going to build a compendium of how to talk to these things from environments I care about, which are mainly Processing, Puredata and then some previously nonexistent time series glue that I might have to write on my own.
To convert the Spotify DJ from a little fun personal hack to something real it was clear that I needed some "consumer grade" way to install the DJing client on the machines of would be DJs.
"Some way" turned out to be Adobe AIR. Adobe AIR can be used with Flash, Flex or just plain old web skills - html and Javascript.
No matter which route you go you end up compiling a one file deliverable that installs as a real desktop application on the system.
I have had no exposure to Adobe AIR prior to today - but armed with online tutorials I started out at around 6 PM and at around 11 PM I was done - with time for UI tweaking and a little webserver work required to make the app work.
Adobe AIR quite simply brings web speed to the desktop. And its a pleasure to work with too. The runtime is a browser, so everything just works. I like JQuery - and of course I can just plug that in.
I haven't done things "properly" - haven't signed properly, haven't used the upgrading framework and so on, but the fact that I can make a useful UI that interacts with the file system and a web server in 4-5 hours is astounding. And it deploys as a 65k file.
[UPDATE: Morten tells me the config is the same on a mac, so I rewrote the script so it should also run on a Mac with perl installed]
[UPDATE II: The player is here! I can now remote DJ with Spotify!]
Inspired by Morten's suggestion for a DJing feature in Spotify and by the source code for Scrobblify, the Last.fm hack for Spotify, I decided to have a go at making just the feature Morten requested as a hack.
I started looking at the config-files for Spotify, found a file that is continuously updated with the track currently playing. It took a little figuring out to convert the internal hexadecimal ID to the Base62 encoded IDs used in the URLs but I figured it out and here it is - the very first rudimentary Spotify Auto-DJ for Windows.
I am running a version of this perl script which subscribes to file change notifications for the config file with the "now playing" track ID and then submits the latest track to this web server.
You can always find the current track I'm playing here or listen right away here. The web player automatically loads new tracks when I start listening to them.
I recently bought a couple of Wiimotes for physical interface experiments at the lab. To make the most of it you need some IR light source for the camera to look at. The simplest thing one can do is light some candles - they show up fine. However, they flickr and are annoying to move around, and you can't turn them upside down. I found some Infrared LEDs that run fine on just a 1.5V button cell battery, and since I have no soldering skills I made a silly looking, but fully functional sensor bar replacement with some tinfoil and clothepins.
Just had a brilliant idea for a browser plugin: Interfaceblocker. It should work just like Adblock - but for the parts of a too busy web interface you just never use.
Does it already exist? What says the lazyweb?
I was wondering how quickly this would happen.
Smart "conditional compilation" commenting tip for C++ style languages:
foo();
/*
bar();
baz.foo = 200;
return{
dolly:clone()
}
// */
foo();
//*
bar();
baz.foo = 200;
return{
dolly:clone()
}
// */
Very clever: Using colorchanges generated by the CSS :visited pseudo-class lets you test the client for previous visits to specific URLs.
Neat trick: SVG image that scales along with the font as you change the size.
We need more hacks like this!
We need more cheap peripherals that enables stuff like this. Just plain sensors with good SDKs and sample apps.
There are tons of backup utilities. I was recently looking for something very, very simple however, with great potential, so I'm now backing up my laptop with VMWare. I use VMWare Converter to generate an image of my laptop on an external USB disk and access the backup image using VMWare Disk Mount Utility. Both of these tools are free to use without purchase.
There's the added potential with Converter of going virtual for good. I didn't just ghost the disk, I created a virtual machine image of my physical machine. I'm running Windows XP on my Thinkpad and was seriously considering going Linux and running XP virtualized for eternity. The virtual Windows machine needs to reregister my Windows license - and I haven't tried that yet, so can't tell you if that is going to cause me administrative problems or not - but the backup solution is nice enough and really, really simple - essentially one-click.
I'm sure there are tons of ghosting tools out there, but the potential to just run the VMWare image directly is so appealing.
I needed a simplifed way to do the kind of rapid imagesharing Mac-fans are doing with Skitch, but I don't have a Mac. What I do have is Windows, perl and imagemagick - so I wrote grab, a really simple script. It takes a bitmap image from the clipboard, converts it to a PNG, and copies the filename of the PNG to the clipboard, so it's easy to upload to your blog/image sharing service.
For cropping I just "Windows-key+R mspaint" and use the cropping tool and Ctrl-C - but I used to have this really nice tray app that could crop and clip in one go. I forgot the name, maybe Morten remembers.
Dan Kaminsky's black hat presentation this year is downright scary, using well known 10 year old design oversights in browser security models he is able to get complete access through a firewall with a garden variety browser. No immediate cure in sight that doesn't break a lot of good stuff.
Somebody already figured out how to run an SSH server on the iPhone - and how to compile std unix tools for the phone as well. App=Website no more.
One has to guess extra antennas were involved - and no forests or other natural antennae in the way - but the lowly and standard Linksys WRT54 router was recently used in an experiment able to transmit WiFi over a 382 km distance.
It took me > 2 hours to remember this from machine A to new machine B just recently so here goes:
Ruby on Windows ships (many versions, any way) with a broken readline used in irb and rails console sessions. The upshot of the broken readline is that the characters { [ ] } and | are not available - which makes it kind of hard to use blocks...
The trick is this:
In your .irbrc file in c:\Documents and Settings\Your Name (make one if it isnt there) put the single line
IRB.conf[:USE_READLINE] = false
and your console sessions should become more satisfying
[
UPDATE: Hmm - through the unbelivable idiocy of the ruby distro on windows, ruby actually does NOT read this .irbrc on its own, and I haven't found a solid default interpretation of ~ or HOME or HOMEPATH elsewhere on win32 ruby either
You have to
set IRBRC=c:\Documents and Settings\Your Name\.irbrc
No, placing it with the ruby interpreter itself doesn't help either
]
Running Mongrel as a service has to be the simplest route to very capable local webservices I have seen so far. (For simplest "But I don't even have development tools" route, try InstantRails and SciTE for editing).
The Mongrel Win32 FAQ is incorrect on the start and stop steps though - the plugin does not expose start stop methods, instead just
net start servicename
net stop servicename
This is essential on a small format Thinkpad. Use SharpKeys for convenience.
Funny stuff: If you switch on voice control in Windows Vista and leave your speakers on, it's possible for websites you visit to control you PC by simply talking to the Vista voice control over the speakers. It's obvious - but the problem is already fixed in the pre-vista OS, Mac OS X which requires a special keyword before commands, because this exploit is so obvious (a passable sound for words that will shut down Vista will be common on websites shortly, I assume).
Thank god, there's a way to disable the Snap previews people have started to use. I imagine some people actually like that they can no longer scan over text with the mouse without obscuring it with pop-ups, but I personally don't. To the credit of Snap they provide an easy opt-out. Visit this link and mouse freely again.
Microsoft has added forward link search to Live Search. Unfortunately it is pretty useless, because you can only search for links from a domain, not a particular URL, and in fact by domain I mean second level domain, e.g. classy.dk but not www.classy.dk. So if your site is in the UK (where domains for sale are all subdomains of co.uk) you're just out of luck. I have a hard time coming up with a good reason for this restriction. It pretty much kills the usefulness of the feature, which would otherwise have given me the tag hack for free.
I'm totally digging Sam Ruby's personal recommendation engine. It shows off trends I believe will only increase in proportion - specifically that data density and remix density is important and that the future of clock cycles is to run pattern recognition algorithms.
That the purpose of the hack is to bring the world closer to one of my own personal goals is just an added bonus.
Det tidligere Digitarian, nu Lovefilm, er supersmart - undtagen søgeinterfacet. Det er langsomt og besværligt og kedeligt og de anbefalinger der kommer frem for film er bare ikke fede. Godt man har Greasemonkey!. Ved at bearbejde Jon Udells biblioteksscript har jeg modificeret Amazon så man på hvert enkelt filmopslag kan se om filmen kan lejes på Lovefilm. Hent Greasemonkey. Hent scriptet. Installér. Se effekten her.
(tech note til greasemonkey hackere: Manage userscripts|Edit er din ven når du debugger)
I just got my Mindstorms robot and obviously had to start working on controlling the robot remotely. This is just some notes and a "hole in the wall" test.
Setting up bluetooth devices sucks - "setting up" anything does - but here's the mnemonic route for a sequence of actions that work.
I used the perl scripts here (These ruby scripts might work for you).
Use the configuration program to update the serial port configuration for your system. COM7, the default setting, should work unless you have a ton of devices. Look for the "outgoing" Com port for the NXT.
wrt to the perl scripts above, add the line
$data = "\x00\x09\x00\x02a\x00";
to send a single letter 'a' to the NXT mailbox no 1 (zero based here, third byte is mailbox). Reading messages from a mailbox is how the visual programming environment can interact with the mindstorms robot.
I had limited success with the preset commands included in the perl script. Of all the commands in the Bluetooth SDK I only got the "PLAYTONE" direct command to work and then the more important one, which is the messagewrite above.
Note: Speed is not a feature of this communication channel.
I wrote a simple program to test: It checks the BT mailbox for a string 'a' - if it finds one it takes a quick roll back and forth. It's worth mentioning that you can't send messages to a mailbox unless a program is running - it's not enough that the NXT is turned on.
I then added a CGI wrapper around the perl script, exposed it temporarily on this webserver and had a world controllable robot. Next project: Sensor output back on the web.
Visual programming environment alert: The Labview derived visual programming environment seems buggy to me. I had to do 2 tries in generating a test program, because the first program just wasn't picking up the scanner input. I tested with the ultrasonic sensor that it wasn't buggy Bluetooth. I then reassembled the exact same program - and that worked. I got a clue when I shut down the editor and got an error message that my program had an "insane object " something or other. Very kid-friendly, that.
My test robot is here (286kb). (dig that filezise btw, that's completely insane for what the program does).
The classy.dk kitchen server sits behind an ADSL router provided by my ISP. That router is sensibly almost closed with only FTP, HTTP, SMTP and DNS ports open by defaut and none of these mapped to NATted addreses that are assigned by default through DHCP on the router. I'm fine with that even if it is stupid ISP control of my actions - less security threats to worry about, and I can actually turn on windows on new machines without being owned by virus after 5 seconds.
The only server I have setup to listen to inbound traffic is the old warhorse classy.dk web server (and yes it is in fact located in my kitchen like it says on the blog.
Occasionally I'd like to access resources on other machines on the net though and that just blows. The problem is that the other machines sometimes run windows and most certainly shouldn't be listening to network traffic. I could use SSH tunneling via the webserver and then a terminal emulator to look at the hidden machines, but that's just annoying. I want full access with file browsing. The works.
A real VPN is needed but which one, how to set it up and how to pass it through an interface on the webserver?
Here's a way: OpenVPN with SSH tunneling.
Since I'm not talking more than one machine at a time I can just use the simple point to point setup with a static key. I want to modify the howto to work through an SSH tunnel.
proto tcp-server
remote localhost
and adding the line proto tcp-client
ssh -L1194:vpnserver:1194 user@webserver