Planet LILUG

August 26, 2010

dotCOMmie

Cross Compile with make-kpkg

I got myself one of the fancy shmancy netbooks. Due to a habit and some hardware issues I needed to compile a kernel. The problem here though is that it takes for ever to build a kernel on one of these things. No sweat I'll just build it on my desktop, it'll only take 5-10 minutes. But of course there is a catch. My desktop is 64bit and this new machine is an Atom CPU which only does 32bit.

The process for compiling a 32bit kernel on a 64bit machine is probably a lot easier if you don't compile it the Debian way. But this is not something I want to do, I like installing the kernels through the package manager and doing this type of cross compile using make-kpkg is not trivial. There are plenty of forum and email threads about people recommending to use chroot or virtual machines for this task, but that is such a chore to set up. So here is my recipe for cross compiling 32bit kernel on 64bit host without chroot / vm, the-debian-way.

  1. Install 32bit tools (ia32-libs, lib32gcc1, lib32ncurses5, libc6-i386, util-linux, maybe some other ones)
  2. Download & unpack your kernel sources
  3. run "linux32 make menuconfig" and configure your kernel for your new machine
  4. clean your build dirs "make-kpkg clean --cross-compile - --arch=i386" (only needed on consecutive compiles)
  5. compile your kernel "nice -n 100 fakeroot linux32 make-kpkg --cross-compile - --arch=i386 --revision=05test kernel_image" for faster compilation on multi-CPU machines run "export CONCURRENCY_LEVEL=$((`cat /proc/cpuinfo |grep "^processor"|wc -l`*2))" first
  6. At this point you have a 32bit kernel inside a package labeled for 64bit arch. We need to fix this, run "fakeroot deb-reversion -k bash ../linux-image-2.6.35.3_05test_amd64.deb". Open the file DEBIAN/control with vim/emacs and change "Architecture: amd64" to "Architecture: i386" exit the bash process with ctrl+d
  7. That's it, now just transfer the re-generated deb to destination machine and install it.

Many if not all ideas for this process come from reading email threads the comments made by Goswin Von Brederlow were particularly helpful, thanks.

by dotCOMmie at August 26, 2010 02:09 AM

August 14, 2010

Justin Lintz

Configuring Varnish

At $WORK I’m currently working on deploying a pool of Varnish servers to sit in front of some Apache servers running Pressflow. On our current infrastructure we’ve been running Squid for the past few years with very good success , minus a hiccup or two along the way, one involving memory fragmentation (thank you tcmalloc). Varnish has a few nice features that Squid lacks.

  • The ability to PURGE objects using wildcards
  • Better support for multiple processors (Squid can benefit from multi procs when using AUFS)
  • Grace period that can be configured to serve objects from the cache after they’ve expired while fetching the new content from the backend. You can also use this to serve up stale content if your backend is down
  • Ships with a nice set of command line tools (varnishtop,varnishlog,varnishstat,varnishhist,etc…)
  • A very flexible scripting/configuration language (you can even do inline C if you’re feeling saucy) that allows you to manipulate the objects at any point in the request or response (See flow chart)
  • There are many others but these are just a few off the top of my head and I’m still discovering what other capabilities Varnish has. The site has not gone live yet so I’m still testing on a dev version of the site and have not had an opportunity to perform any load testing yet. So far with my current working configuration I’ve made the following tweaks

  • Stripped cookies off static objects
  • Stripped Google analytics cookies
  • Removed empty cookies
  • Configured a graceful period to serve up stale objects from cache
  • Added a debugging header to show weather the object was a cache HIT or MISS
  • The use of mod_expires on the Apache backend controls cache times for static assets (css,js,images,etc..). In my googling around when reading about Varnish I see a lot of people are setting cache times in their VCLs. IMO you should be letting the backend or application itself control the TTLs on objects. Within your application you can set more defined TTLs for certain sections of your site or even certain types of dynamic content without having to rely on complex VCL rules or deal with the deployment of the rules into Varnish. While Varnish does support a “graceful” style restart, its not quite as eloquant as doing service apache graceful. Kristian Lyngstol (one of the Varnish devs) has a good post on his blog on dealing with this. Also with the use of mod_expires you can set TTLs based on MIME-type within Apache.

    One other thing I see a lot of people blindly recommending in configurations to deal with Varnish’s behavior of not caching cookies is to take the cookie value and add it into Varnish’s hash of the object. e.g.

    sub vcl_hash {
    set req.hash += req.http.cookie;
    }

    If a light bulb just went off in your head as to why this is a bad idea, kudos to you. What you’re basically doing is creating a cache per-user on your Varnish server. Your hit ratio will plummet from this config. There are scenarios where this can be used in a good way. In talking with some folks in #varnish on irc.linpro.no, a scenario where you’d want this is if say you had a cookie that was a display filter on your site or some sort of site customization that didn’t have a large number of combinations.

    One thing that bothers me about Varnish currently is that it’s admin interface is completely unsecured. By default it listens on localhost but without any authentication, anyone with a shell on your Varnish box can bring down your Varnish instance or modify the config in anyway they feel fit. For those that allow dev’s on production servers to debug logs, this is a bit of a security concern. I’m not really sure of a workaround for this, so if anyone has any ideas, leave it in the comments below.

    If you use Cacti for trending, there are some great templates available over at the cacti forums. They utilize a python script that needs access to the admin interface.

    I’ll probably post some more in the future on Varnish as I do further reading and testing with it.

    by justin at August 14, 2010 03:22 AM

    August 12, 2010

    Justin Dearing

    Impressions of PowerShell: Taking Buck Woody’s EventLog example further.

    This is not quite a PowerShell first impressions article. I’ve toyed with PowerShell a few times before previously. Most notably, I toyed with the PowerShell TFS cmdlets that come with Team Foundation Server Power Toys a little under a year ago. However, I never stuck with it long enough to retain any of the syntax. Recently, I discovered a one liner by chance in Buck Woody’s blog. This lead me to do some serious PowerShell tinkering today. I’m not quite a seasoned PowerShell novice, but I believe I am now on my way there.

    So here is the script in question:

    Get-EventLog System | Where-Object { $_.EntryType -eq “Error” }

    It is a simple one liner to get all the errors in your event log. The main work horse is the Get-EventLog cmdlet. I spent a good chunk of time playing with it.  I came up with a few iterations:

    • Get-EventLog -Log System -EntryType ‘Error’ # Skip the step of piping through the event logs
    • Get-EventLog -Log System -EntryType ‘Error’ -After (Get-Date).Date.AddDays(-5) # Errors From the past 5 days
    • Get-EventLog -Log System | Where-Object { $_.EntryType -eq ‘Error’ -and $_.TimeGenerated -gt (Get-Date).Date.AddDays(-5) } # Alternate one liner to get errors from the past 5 days with Where-Object

    I tried several other permutations, most of which did nothing. I will make note of one thing here, which I will delve into more in a followup post. That something is the pipe “|” character. It works almost exactly as any windows or unix command line guru would expect. Namely, it “pipes” the output from the program on the left into the input of the program on the right. However, PowerShell is object based, unlike unix, dos and windows shells, which are based on streams of text. Therefore, you can pipe objects as well as strings with PowerShell. When piping to and from cmdlets, you are piping objects. The examples above that use the Where-Object cmdlet makes the implications of this clear.

    One thing to note here is speed of return. One would think that the event log is indexed by date, and that I could reduce my query time by only returning recent entries. Searching the whole event log should be expected when using the Where-Object cmdlet,  since all log entries are being queried and piped to another program. However, one would think that the Event Log would be indexed and the Get-EventLog command written in such a way that only a subset of the log entries would have to be traversed when you specified the -After parameter. However, when you run both examples, the command “hangs” for a bit between the last row output and the command prompt being displayed.

    In my next article we will throw grep and less into the mix, and see what happens when we mix object piping with text piping.

    Further Reading

    Links that will be useful to play around with this stuff.

    by Justin at August 12, 2010 04:06 AM

    August 09, 2010

    Justin Dearing

    Charitable development for Unemployed/Under Employed OSS developer.

    Microsoft MVP Arnie Rowland was given some MSDN licenses to distribute as he saw fit. He decided to use them to encourage people to give back by doing development projects for non-profit organizations. He also got others to step up to the plate to provide additional prizes. Books, exam vouchers, training, and third party software licenses will be awarded to some of the participants in addition to the MSDN licenses.

    Overall, this is a very positive thing. I’m especially excited by the fact that the project criteria states “additional consideration given projects that will be posted on Codeplex with a GPL license.” Its good to know some of this code will have secondary uses.

    What bothers me about this program is the primary incentives are software licenses. Don’t get me wrong, I’m not against closed source software. I program on windows professionally, and most of my open source contributions are windows related. I’m aware an open/closed source hybrid ecosystem can be healthy, although I think the industry will tend to go more open source rather than less.  The thing that really bothers me is that you have an entire closed source incentive package that would have no open source equivilant. Here is why:

    • Open source software is free. Even with a model like RedHat, there is little difference between CentOS and RHEL for development. If you gave me a RHEL update subscription for free I’d say, “gee thanks. . .”
    • The books are nice. However books are cheap. No one is going to do a decent sized project for a few books. Books also take up space (unless they are electronic) and time to read. Therefore the answer is not “more books”
    • The only way third party software licenses mean anything is if the software is closed source. There are some closed source software packages for open source operating systems. However, you’re back to closed source providing the incentives.
    • Training and cert vouchers have some potential, but there are also problems I will discuss below.

    I see three problem with offering training and certification vouchers for OSS software. First of all, there is not as much advanced formal training in the open source world as in the closed source world. Secondly, the certification costs are cheaper. Beyond the RHCE and BSD certifications, there are no advanced Open Source certifications. Thirdly, the Open Source world doesn’t tend to have as many consultants that offer advanced training. Paul Randal, the author of much of the code in the SQL Server administrative command DBCC, travels around the globe offering advanced training. Linus, Monty, Larry, Guido, etc are not know for offering the opportunity for classroom intensives on the usages of their products. I’d go as far as stating the Paul spends more time leading classrooms then all of them combined.

    So offering training might work for the open source community. However, unless you are offering basic certification, you’d be making a custom certification package that you could not objectively put a retail price on, since its not normally available.

    Self Motivated Charitable Development

    You certainly do not need some kind of software and training stipend to do charitable development if you are unemployed. If you are properly motivated you could find a charity that needs the help, and might even be able to get incidentals like travel and meals reimbursed, and a desk in their office space. That could be important to someone that is unemployed than software licenses.

    However, some people, like me, are not the entrepreneurial types. We don’t know how to take our skillsets and frame a pitch of how we can solve a problem to a non technical person. Some people are hard working, but want to be told, “Show up here at 9am. Do this. We get paid Friday’s.” I’m one of those people and the only consulting I do is when it lands on my lap.

    Now allow me a moment to present a counter intuitive idea. If these hard working unemployed people are like me, their real motivation is self-education and something to put on the resume. Long term they’d rather support charities by paying $200 for a rubber chicken dinner.  So they want to do work that others will perceive as important, notable and impressive. They will pick a pro bono program which will require them to use expensive professional grade tools, and give them advanced training, as opposed to “done on a shoestring budget using OSS.” They will do this because they want to say, “Look I did this big project that used these expensive tools that were donated because it was such an important cause!”

    So closed source wins over open source for charitable development in these cases because of “human nature.”

    by Justin at August 09, 2010 02:58 AM

    August 08, 2010

    Justin Dearing

    An evening with a Solaris 10 Appliance on Virtual Box

    I have a tolerate/hate relationship with Solaris. I’ve played with it occasionally, and I always seem to spend too much time administering Solaris, giving me less time to solve the problem I intended to use Solaris for.

    Recently, I was called in to troubleshoot some mod_perl scripts for a client. The troubleshooting was done over email and I never actually had access to the machine the code ran on. I was asked to do some follow-up, and I wanted to more accurately reproduce the client’s environment. So I asked for the specific OS and perl version. As you might have guessed by the title, the perl code was running on Solaris 10.

    So I fired up my trusty Dell Studio XPS, googled around, and found that Sun^H^H^HOracle makes a Solaris VirtualBox Appliance. I already use Virtual Box on my laptop so this saved me some time. Installation was simple, but a few things annoyed me about the process.

    Virtual Box Guest Additions

    I had to manually install the Virtual Box Guest Additions. The main advantage of this package is to allow your guest OS to run in full screen mode, or be resized to an arbitrary resolution. Oracle owns all the code for the Virtual Box and the Guest OS. There is no reason, legal or otherwise, for them to not distribute their Solaris VM appliance with the Guest Additions already installed.

    Security Defaults

    My biggest beef here is that the Solaris installer asks you for a root password, and does not allow you to make a non-privileged local user. I prefer the “no direct root login” model of OSX and Ubuntu where all administration is done through sudo. However, Solaris does not ship with sudo installed. Instead, Solaris has something called RBAC that is superior to sudo. I look forward to learning more about this if I am forced to deal with Solaris again.

    Lack of /root

    In Solaris, roots home directory is / as opposed to /root. This means there is a /Desktop. and other folders in the root of the file system. In retrospect I could have avoided their creation by doing a console login as root after installing the appliance, and making a non-privileged user to log into X with. However, those steps could be avoided with one more install screen for adding users to the system.

    Desktop Experience

    There was some desktop software preinstalled. Most notably Star Office 8, Mozilla 1.7 and Firefox 2.0.0.19. Star Office 8 is the previous version of what is now Oracle Open Office, the “value added” closed sorce version of Open Office. I can understand being a version behind with Star Office, since it was probably the latest version when Solaris 10 was released. Firefox 2 was probably new when Solaris first came out as well, but I don’t see the need for the old Mozilla suite. There was some good news though. Flash was preinstalled.

    I went to youtube to test flash. I discovered that audio did not work. The internet told me there was no Virtual Box sound driver for Solaris and I should install Open Sound System. The audio isn’t perfect, but it works. While most people are not running Solaris as a Desktop, it seems odd to distribute a VM appliance with a browser and flash, and not include sound support. Hopefully Oracle will develop their own sound driver or distribute the Open Sound System one in the future.

    Package Management

    Solaris comes with a package management system. There is a decent amount of software installed by default. However, certain things linux users would expect like vim are not included. As a FreeBSD person I’ve come to expect my OS to come with a vi that is not vim. Luckily, there is a comprehensive third party repository for Solaris at blastwave.org. I followed the directions to install pkgutil, and soon I was using vim.

    Service Management

    Historically, Solaris has had an rc.d system thats is, in my humble opinion, weirder than the linux and BSD ones. In its defense, it better captures the UNIX “worse is better” Zen simplicity than the linux and BSD init scripts do. However, apparently all good things must be deprecated in the name of progress. While some services still exist in /etc/rc[0-5].d/, many were moved the the Solaris Service Management Facility in Solaris 10. These services are administrered by svcadm and svcs. While I was tweaking the apache config, I became intimately familiar with these commands. Overall I’m quite happy with this innovation. However, I need to develop more competency with it.

    Conclusion

    Solaris has improved from years past in terms of administrative experience. However it is still as weird as ever. However, its something that has grown on me in years. I acknowledge my conclusion that Solaris is weird is based on the bias that FreeBSD is “normal.”

    by Justin at August 08, 2010 02:00 PM

    August 06, 2010

    Justin Dearing

    Analyzing Google Analytics

    I though it would be interesting to disclose and discuss some web stats from google analytics. They are taken from 2010-07-04 to 2010-08-04. The numbers themselves are low, but enough to indicate that there seems to be some value in a few of the posts I write. So without further ado:

    Page Pageviews
    / 60
    /2010/01/28/using-the-registry-to-resolve-visual-studio-reference-paths/ 46
    /2010/03/31/jquery-collapsiblepanel-a-collapsable-panel-plugin-for-jquery/ 41
    /2010/01/16/sprintf-for-jquery/ 23
    /2010/06/21/my-new-favorite-tool-the-far-file-manager/ 21
    /2010/07/03/storing-files-in-sql-server-2008-with-filestream/ 15
    /outgoing/wiki.github.com/zippy1981/collapsiblePanel/ 10
    /2010/04/05/cassini-is-now-on-github/ 8
    /2010/06/29/appcmd-exe-and-his-amazing-superfriends-in-systemrootsystem32inetsrv/ 8
    /outgoing/http://plugins.jquery.com/project/sprintf 7

    If you look at my stats from past time periods, the same trends exist.

    So the first thing of not is my home page is the most popular page.  The second thing to note is that the next three “just the facts” posts deal with what I consider to be somewhat obscure topics. The third is no one seems to care about the posts where I pontificate. The fourth is that the two outgoing links that show up on the radar both deal with jquery plugins.

    I’ve drawn the following conclusions. First, is that jquery plugins are a popular topic. The second is my “just the facts” posts tend to be the most popular. Of course this means I am currently writing an article that few people will read. Third I need to blog more.

    by Justin at August 06, 2010 03:14 AM

    Bad Twitter Parodies Imitate the Art the Original Parodied

    You have not experienced Shakespeare until you have read him in the original Klingon — Star Trek VI: The Undiscovered Country

    I made parodied reference to the above quote in a twitter post I didn’t bother to proofread. Since I have more than 140 characters here I can explain the obtuse reference. I was attempting to 1-up Michael Graziano‘s talk of the bad days of ssh clients on windows before putty. I happened to have filed a bug today with bitvise about WinSSHD‘s sftp behavior when you connect to it with farmanager‘s winscp plugin. Farmanager happens to be developed by Russians, and many of its users are Russian. So the obtuse reference seemed appropriate .

    Since I happened to be working on this blog, it seemed like a good idea to expand this into a blog post.  I wanted to verify the original reference and discovered that the Star Trek Quote was a reference to a literary work called Prin. This is in and of itself not remarkable, other than being another example of the literary references in the Star Trek movies. What ties it back to my corny tweet is that the original quote is that Shakespeare must be appreciated in the original Russian. I cannot find the quote, but I want to read the book now. Sometimes I amuse myself by coincidences.

    by Justin at August 06, 2010 02:54 AM

    July 21, 2010

    dorgan

    Brighthouse, yeah no....

    Well after my last blog post you'll notice that I had a comment from someone at BrightHouse asking for information to see if they could be of help.  I sent them my information and within a couple of days received a phone call form a customer service supervisor.  She followed up with me a couple times to let me know what was going on but I only spoke with her once on the phone,  and the other times she left a voicemail.

    Now the last voicemail I received from her said that they they found the issue and were replacing a hub in the area to fix said issue.  She stated that the replacement would be done by the end of the week and that I would receive a phone call form the area supervisor Bill Harris by sunday when the hub was supposed to be replaced.  I was also told that I would receive a phone call from Bill Harris early on last week but never received a phone call from him.  I was also told that the woman who I was speaking with was going on vacation until this past Sunday and would follow up with me on Sunday.  It is no 6:15 Eastern Time and I have yet top receive a phone call from anyone, and guess what my internet speeds are still not what they should be.

    Being that I was told things would be fixed by the end of the week and come saturday they weren't I called BrightHouse and was told there was work done in the area so they cannot confirm that this is an ongoing issue, so they would have to send a service tech out yet AGAIN to check the signal levels.  While on the phone I mentioned I was supposed to get a phone call from Bill Harris to let me know where things were at..they looked at the account and told me that Bill Harris had called me on tuesday and told me he would follow up with me on Sunday......The only person from brighthouse I received a phone call from on tuesday was the customer service supervisor.  So I asked the support person on the phone are they sure it says Bill Harris & they confirmed thats what it said. So not sure whats going on there.

    So the service tech comes out  Saturday afternoon and checks the levels and of course they are fine.  While he is here I was commenting how this was an on going issue now for almost 4 months and that every time I call they want to classify it as a separate and new problem, the service tech states "Yeah we;ve been getting alot of calls for this area, and some of them we just ignore".  WOW!  I didnt say anything to him about that because I wasnt about to start any other trouble than I already have.

    So once the signal level check was complete and no problems were found the service tech went out to the tab and checked the connections there, which were fine.  Well since he couldnt find any issues and had his next service call one block over in my subdivision he calls someone and they told him it was an ongoing issue in the neighborhood.  So the service tech gets told after and unnecessary documented issue in the area that he really shouldnt have been dispatched out here......WOW 

    I AM STILL NOT GETTING WHAT I PAYED FOR AND BRIGHTHOUSE IS NOTHING BUT A HOUSE WITH ITS LIGHTS OUT AT THIS POINT EVERYONE IS WALKING AROUND IN THE DARK AND HAS NO CLUE WHAT ANYONE ELSE IS DOING.  SO NOW I AM GOING TO TRY AND GO UP THE CORPORATE LADDER.

    If anyone reading this has a phone number or an email address of someone other than a customer service supervisor or call center please send it my way.  Myself as well as the other in my subdivision would really appreciate it.

    by Donald J Organ IV (noreply@blogger.com) at July 21, 2010 03:52 PM

    Jonathan Dahan

    arduino buyers guide

    Some recommendations since they avr scene has exploded, and arduino-compatable boards rock. I recommend buying from the manufacturer to support them, if they are available in your country. Shield compatability is great, especially if you are starting out. Basic is recommended for your first arduino, advanced is not necessarily more advanced, but an alternative if you have specific requirements.

    $40 Basic: The Freetronics TwentyTen http://www.littlebirdelectronics.com/products/Freetronics-TwentyTen.html Duemilanove + mini usb connector + built in proto board

    Advanced: Illuminato Genesis http://www.liquidware.com/shop/show/ILL/Illuminato::Genesis 42 I/O pins, sweet black pcb with 10 bright white leds, 64K of code space

    $30 Basic: Deumilanove The official board is more flexible, since you can change the atmel chip.

    Advanced: Seeeduino The seeeduino is based off the decimilia, not the deumilanove, and improves on the form factor

    $20 Basic: Arduino Pro http://www.sparkfun.com/commerce/product_info.php?products_id=9219 Smaller and cheaper, but missing usb, you will need an serial to usb cable, which is ~$15

    Advanced: BBB http://www.moderndevice.com/products/bbb-kit $4 cheaper than the pro, but you have to build it yourself.

    July 21, 2010 07:00 AM

    July 18, 2010

    Mark Drago

    Mark & Jen – The Human Makers

    Jen and I are expecting our first child.  Well, saying that we’re ‘expecting’ is kind of weird because it’s already here, it’s just still living inside of Jen.  I have to continually remind myself of that.  I’m not even going to try and describe the feeling of seeing my child on a sonogram monitor.  The most interesting images always seem to sneak up on me too.  It’s very similar to seeing an image in an Autostereogram.  An autosterogram is one of those images that are all jumbled up but when you cross your eyes just the right way a 3D image appears.  The sonogram technician was moving the wand around, the baby was moving, my eyes were trying to pick out any shape, and then all of a sudden there was a face.  It wasn’t a profile either, it was head-on.  It was an amazing moment.

    by Mark at July 18, 2010 02:33 AM

    July 11, 2010

    dorgan

    Bright House FAIL!!

    So I am going into month 4 of slow internet speeds.  He is my most recent test.  Granted its not a bright house speed test but they dont allow for a direct image output of the results....I wonder why.  But the speedtest on http://speedtest.cfl.rr.com   show pretty much the same thing.


    So yeah month 4 of my neighborhood having slow speeds, numerous tech's  have been made, and they come to the houses in the neighborhood and say none of the tests they run show any issues, so they put in what they are referring to as a "maintenance call"  basically this is a way for them to leave without fixing the problem.  Supposedly a part has been on order now for over 3 weeks.  Yet most of the tech guys that have come out say any part that needs to be replaced should  already be in stock.  so who knows what is going on.

    by Donald J Organ IV (noreply@blogger.com) at July 11, 2010 03:04 PM

    July 05, 2010

    Jonathan Dahan

    systems

    Reduce friction for contribution and consumption * see open source development Offer alternatives to asymmetric balance of information * insurance vs. savings communes Keep in mind the elasticity and limit the numbers * private trackers, constitution

    July 05, 2010 07:00 AM

    July 04, 2010

    Josef "Jeff" Sipek

    Jackson, MI

    Today is 4th of July...which means fireworks everywhere. Yesterday evening, Jackson, MI had a rather nice display. Here are some of the photos I took:

    Fireworks!
    Fireworks!
    Fireworks!
    Fireworks!
    Fireworks!
    Fireworks!
    Fireworks!
    Fireworks!
    Fireworks!
    Fireworks!
    Fireworks!
    Fireworks!
    Fireworks!
    Fireworks!
    Fireworks!
    Fireworks!
    Fireworks!
    Fireworks!
    Fireworks!
    Fireworks!
    Fireworks!
    Fireworks!
    Fireworks!
    Fireworks!
    Fireworks!
    Fireworks!
    Fireworks!
    Fireworks!
    Fireworks!
    Fireworks!
    Fireworks!
    Fireworks!
    Fireworks!
    Fireworks!
    Fireworks!
    Fireworks!
    Fireworks!
    Fireworks!
    Fireworks!
    Fireworks!

    by JeffPC at July 04, 2010 10:57 PM

    July 03, 2010

    Justin Dearing

    Dealing with rejection in git, resetting your master to theirs and starting over

    You haven’t really started using git until you’ve gotten your first patch rejected. Due to the nature of git, merging is easier, but rejection is harder. Well if I was using branches it wouldn’t be that big of a deal, but thats besides the point.

    You see I developed a love/hate relationship with a wonderful NoSQL database called MongoDB, that led me to contribute patches to it. I loved it because its awesome for a few specific tasks I need to do, but found its windows support a little lacking. It ran and performed great in windows, and even ran as a proper NT Service. However, it needed a little spit and polish. It was also a great excuse to do some hardcore windows system programming, and logging calls. Ask any sysadmin that ever had to support a program I wrote, I love verbose debug logs.

    So every once in a while one of my pull requests got rejected. The first few times it took me a while to deal with it. I don’t mean it took me a while emotionally to deal with the fact that my code is anything but perfect. I mean that it took me a while to reset my git repo with the main 10gen repo. Sure I could have deleted it and started over, but I wanted to learn how to use git properly.

    So in the end I asked on the Long Island Linux User Group’s mailing list and got a helpful reply from Mark Drago. I actually linked to my reply to his reply, since I make a correction. So without further ado, here what I did.

    Ok a little more ado. My repo is refereed to as origin in the config and 10gen’s is referred to as 10gen. I wanted to save my master branch’s current state to a newly named branch delete my master and pull from 10gen’s master. In the end my problem was I never did a git fetch.  The final sequence of commands I did type was:</ado>

    • git checkout master
    • git checkout -b oldmaster
    • git branch -d master
    • git fetch 10gen  #Needed to get the list of branches in master.
    • git checkout remotes/10gen/master
    • git checkout -b master
    • git push -f origin master

    And that was it. I was free to continue to write code.

    by Justin at July 03, 2010 05:15 PM

    A really simple guide to creating SQL Server Table with a FILESTREAM backed column

    I recently helped to develop a small website to share images. I decided to use the new FILESTREAM feature of SQL Server 2008 to store the images. Along the way I encountered some gotchas, so I wrote this article to document them here.

    Usually, I am the last person to want to store files in a relational database. Windows comes with a datastore highly optimized for storage of arbitrary blobs of binary data called the NTFS filesystem. However, SQL Server 2008 has a really nice feature where you can store the content of varbinary fields directly on the filesystem. This is a best of both worlds approach. Each blob in the varbinary column of your table is stored in a separate file on your filesystem. However, you can access the contents of this file through a SQL query.

    Example downloads

    The complete example can be found here.  The zip archive contains both the SQL script to create an example database, and a sql backup file you can restore on your system.

    Enabling FILESTREAM on your SQL Server instance.

    There are two steps to do this. The first is enabling it either at install time via the installer, or via a vbscript after the fact. The second is turning it on via a system stored procedure.

    Enabling After the Fact

    You probably did not enable filestream support when you installed SQL Server 2008, unless you went out of your way to enable every feature. If you did already enable it, running this script won’t hurt anything.

    The vbscript is available via the Microsoft SQL Server Engine Code Sample Project on Codeplex. That page does a good job of documenting all the command line arguments. The main concern most developers using this will have is the named instance of the SQL server you wish to enable filestream support on. Most developers trying this out are doing it from their machine. They are probably using the express edition of SQL Server 2008 which has a default instance name of SQLEXPRESS. The script defaults to attempting to enable filestream support on the named instance MSSQLSERVER. Therefore you will most likely have to specify the option “/Instance:SQLEXPRESS”.

    So once you verify the named instance you want to enable filestream support on, you run the following command:

    cscript filestream_enable.vbs [/Instance:InstanceName]

    That was simple. Now we move on to turning on filestream support.

    Turning on FILESTREAM support

    Ok now fire up sql management studio or sqlcmd and execute the following:

    EXEC sp_configure filestream_access_level, 2
    RECONFIGURE
    GO

    Once again, you can run this as many times as you want without negative side effects.

    Enabling FILESTREAM on Your Database

    Now filestream is completely enabled on your sql server instance. However, you have to enable it on your database. We do this by adding a filestream FileGroup. In a SQL Server database, all the data and log files, .mdf and .ldf files respectively are part of one or more filegroups. With filestreams, you have a special filegroup that is a collection of directories that contain the filestream files.

    Many application developers are ignorant of the specifics of sql server files and filegroups. We take these for granted because we can just type “CREATE DATABASE foo” and we get a data file and log file with sane enough defaults created automatically. We then let the DBA figure out how to setup the filegroups on staging, UAT, and production. However, we need to get down and dirty when we want to use a filestream. Luckily, with a little dynamic SQL, we can create a filestream filegroup and file without thinking too much.

    When making a data file in sql server, even if that file is really a directory containing filestream data, you have to specify an absolute path. I prefer the convention of storing my filestreams alongside my mdf and ldf files. On the SQL Server 2008 R2 Express instance on my laptop, that is “C:\Program Files\Microsoft SQL Server\MSSQL10_50.SQLEXPRESS2K8R2\MSSQL\DATA.” However, the exact data folder is different per each instance of SQL server. After some research, I took Walden’s slightly hackish suggestion of using the sysfiles table. This suggestion assumes you did not customize your files and filegroups in your CREATE DATABASE statement.

    DECLARE @FileStreamPath VARCHAR(MAX)
    SELECT
    @FileStreamPath=REPLACE(fileName, DB_NAME() + '.mdf', 'FileStreamPhotos')
    FROM sysfiles
    WHERE fileid=1

    DECLARE @sqlString varchar(max)
    SET @sqlString =
    'ALTER DATABASE [dbWithFileStream] ADD FILE
    (
    NAME = PhotoStore,
    FILENAME = ''' + @FileStreamPath + '''
    ) TO FILEGROUP FileStreamGroup_Photos'

    EXEC sp_sqlexec @sqlString
    GO

    Its dirty but it works.

    Creating Your FILESTREAM stored VARBINARY column

    There’s no point to a filestream if your not going to store VARBINARY columns in it. To store a varbinary column in a filestream, All we have to do is add the keyword FILESTREAM to our column definition, as illustrated below.
    CREATE TABLE photos (
    id UNIQUEIDENTIFIER ROWGUIDCOL NOT NULL
    CONSTRAINT PK_photos PRIMARY KEY NONCLUSTERED
    CONSTRAINT DF_photos_id DEFAULT NEWID(),
    photo VARBINARY(MAX) FILESTREAM NOT NULL
    GO

    Getting data into and out of this column is another topic for another article. For now know that all methods for getting data in and out of normal VARBINARY columns works, plus new better ones.

    Conclusions

    FILESTREAM is certainly “ready for prime time,” in that it is safe and performs well. However, the feature feels very 1.0-ish. My adventures in getting it enabled were mostly due to not knowing there were two distinct steps to enabling it. If I needed to store a large amount of binary data for a project in the future, I’d certainly consider using SQL server filestreams again. However, I’d probably lean towards writing the files to the filesystem myself, and store the path to the file in a varchar column.

    by Justin at July 03, 2010 03:07 PM

    July 02, 2010

    Jonathan Dahan

    notes

    Going through the speaker list at (thenexthope)(http://hope.net), and seeing how many notes I have written in (tasque)(http://) I realize that I consume more than I can follow up on. Prioritization aside, just getting this down for posterity is important, and what better way than to public random notes on the internet? (Seriously, I need a better scheme than this, preferrable one that following the (antihacking)(http://jedahan.github.com/2010/04/10/antihacking.html) idea I posted earlier. This post will probably be split into a few ones later, but its better to push early and often, before this stuff slips away.

    FossCon

    Great convention, organized by JonathanD * Lots of talks involved open education, not just in using FOSS technologies for IT infrastructure, but to take advantage of real world excercises, contributing to code/documentation/art/testing in projects that people actually use. * hkcmp * freebay / nomoola * collectivefoundation * aaaarg.org * publiccollectors * collectivefoundation * thepublicschool.org * learningsite.info

    * From the talk on community management given by kloeri * define what you want from the community early on * changing direction is ok as long as everyone is moving in the same direction * leave trivial bugs as low hanging fruit * be open about exploitation of users to turn them into contributors * take “bad” patches to illustrate ease of contribution * attribute contributions even if the contributor did not do any of the real work * upstream gets contributors <> contributors get credit and learning * users can socially engineer the developers to do work for them! (just pose the question as an interesting problem) * for a good example, see BFS from Con Kovilas

    * POSSE * productively lost is a good thing, stumbling around means you have a greater learning potential * RiT has a good FOSS movement going on, check out the foss@rit projects page! * Professor Stephen rocks, and so does the OLPC

    * Openhatch - job site++ for FOSSheads * Would be cool to add mission badges, integration with statusnet

    * Civx.net - git history of laws! * Both built on pygears < turbogears2 < moksha

    Music

    Music to check out - stuff that sounds good at first glance but I should consider putting into my regular rotation / radio show.

    * fabriclive 50 * faded paper figures * clermont * frog eyes * slothbeat kids * icarus himself * hyperbubble * the humms might have a song that flaming lips took the chord progression for ‘I dont know where the sunbeams end and the starlight begins…’

    Projects

    Its important to document work, really, really important. Here is a crappy start.

    * Get pics from Prof. Jose * Fix arduinome * Build Problem Light (have a good chassis…)

    July 02, 2010 07:00 AM

    June 29, 2010

    Justin Dearing

    Appcmd.exe and his amazing superfriends in %systemroot%\system32\inetsrv

    Preface: Regardless of the size of your organization and segregation of job roles, every programmer must sometimes assume sys-admin related duties. Sometimes the programmer is also the sys-admin in a one man shop, and even in a large shop with many programmers and many system administrators, a programmer must develop the administrative procedures for the software he develops, and usually administers the working of his own box. Therefore, even though this is a programming blog, system administration tasks will be mentioned here.

    Every once in a while I ask a question knowing I will be embarrassed to learn the answer. However, if google cannot lead me to the answer, there has to be someone exactly as stupid as me with he same problem. I write these words for thats persons enlightenment, and to allow everyone else to mock me.

    So I was looking for methods for generating reports about IIS virtual hosts, when google pointed me to appcmd.exe. This is a swiss army knife executable for command line administration of several aspects of windows. Much of its IIS related functionality previously existed in vbsripts. The only problem was I could not find it. It was not available on my path and explorer search did not find it. I tried to find an appcmd feature or role to windows and did not find one. Finally, I violated the unwritten code of men and asked for directions. I opened a ticket with out co-location provider.

    The response I got was short and professional. The executables full path is “c:\windows\system32\inetsrv\appcmd.exe”. I realized the following steps were necessary at this point:

    1. Add “c:\windows\system32\inetsrv\” to the system path.
    2. Write this article
    3. Figure out why my usage of explorer search did not turn up this executable.
    4. Write a follow-up article on how to modify ones path and other envirormental variables in Windows Server 2008.
    5. Write a followup article on how to search for files in explorer in Windows 2008

    So stay tuned for more ar

    by Justin at June 29, 2010 09:40 PM

    June 21, 2010

    Justin Dearing

    My new favorite tool, the Far File manager

    Strange things excite me, things even other programmers would consider strange to be excited about. Every once in a while, something comes along that excites me in multiple ways. One of those things is the orthodox file manager, Far.

    The far manager was developed by Eugene Roshal, who created WinRar. It was originally shareware, but has recently been made open source.

    I’ve known about Far for a while. I first discovered it looking for a file manager that could handle a directory with thousands of files at a job where I was doing ETL operations. It was installed on my machine by a developer of ReSharper who was troubleshooting a very strange bug on my system remotely. Also I worked in a company where several Russian’s used it daily.

    However, while I toyed with it several times, I never took the time to really get to know it until a few weeks ago. By really getting to know it I meant installing several plugins, and experiencing the “theres a plugin for that” joy several times over.

    Overview

    Far is a command line based file manager with two columns and a command prompt. The command prompt behaves similar to cmd.exe, but not exactly. For example, in a standard command prompt typing “cd e:\foo” whike you are on the c:\ drive will change the current directory on the E: drive but you still have to type e: to get to that folder. In Far typing cd e:\foo does both. One other difference, that bothered my unix sensibilities, is “cd ~” changes to the folder that far is installed to. In unix this changes to the users home directory so I was expecting similar behavior. There are probably many other useful command line enhancements that I’ve yet to discover yet as well.

    Far Screenshot

    Far File Manager

    Installing Far and plugins.

    Far is available on http://farmanager.com. There is a 1.7 and 2.0 version. The 2.0 version supports unicode asnd the 1.7 version us the legacy ascii version. You can get 64 bit binaries for both versions. You can install far via an MSI, or a 7-zip archive.

    After you install Far, you will want to install several plugins. I will highlight my favorite ones here. ote that while binaries compiled against the far 1.7 SDK will work with Far 2.0, 32 bit plugins will not work with 64 bit far. For this reason you probably want to install the 32 bit version of Far, unless you are like me and like pain.

    Except where mentioned, these plugins can either be found at the plugring site, or for 64 bit binaries, the evil programmers google code project. I will go through some of the plugins I like below.

    7-Zip

    As far as I know, there is no 64 bit version of this available yet. However, I probably just haven’t found it yet. If you install far without this plugin, you can browse the contents of most archives in Far. However, you will not be able to copy files out of them. I’ve yet to try getting the built-in archive support full working. However, with all the archives supported by 7-zip, I’m in no hurry to.

    Event Viewer

    This works like a text mode only version of eventvwr.exe. I’ve yet to find a truly compelling case to use it over the standar gui version. However, its nice to have an alternative tool for any job.

    Service Manager

    This is really convenient. It lists drivers and services temperately. It also allows you to edit things you can’t in the mmc snap-in, such as the path to the binary the service executes. Finally, it lets you create a new service. You rarely need to do this, but when you do its hard to find a good tool for the job.

    User Manager

    This one is really useful, especially on XP Home edition. Functionality is similar to the “Local Users and Groups” section of the Computer Management MMC snap-in on XP Pro. The thing I really love about it is you can set the “User must change password at next logon” flag on a user in XP Home Edition. I spent the good part of a train ride from Penn Station to Islip on Friday failing to achieve this in other ways. I’m not saying its the only way this task can be done. I’m just saying that this plugin will let me accomplish this task easily.

    User Must Change Password At Next Logon

    WinSCP

    The arbitrariness of alphabetical order has put what is perhaps the most useful plugin last. There is a GUI scp/sftp client for windows called WinSCP. The author also made a Far plug-in based on the same code.

    This plug-in, along with the 7-zip one, also take advantage of one of the most powerful intrinsic features of Far. With Far, you can copy any file from one panel to another, regardless of whether the panels contain a local folder, a unc path, the inside of an archive, or a sftp folder. Because of this, Far is a great tool for moving files to and from remote servers.

    Conclusion

    Far is a great file manager, and I will spend more time getting to know it. I think all programmers and sys-admins that work with Windows should get familiar with it as well.

    by Justin at June 21, 2010 05:29 AM

    June 05, 2010

    Justin Lintz

    Thinkpad Trackpoint sensitivity on Ubuntu

    A while back I found some notes on configuring the sensitivity of my trackpoint on my Thinkpad T43 and took the time to tweak the values to get it just right. The commands were

    /bin/echo -n 171 > /sys/devices/platform/i8042/serio1/serio2/sensitivity
    /bin/echo -n 119 > /sys/devices/platform/i8042/serio1/serio2/speed

    In order to keep those values the same on reboot, I placed those commands in /etc/rc.local. I rebooted and… values got reset. After struggling a bit and just giving up on the issue, I ended up just making a shell script that I would execute on boot each time (crappy solution). Finally I got annoyed with the issue enough and researched it again some more and stumbled uponthis post on Ubuntu Forums. A couple of things I learned from that…

    1. The proper ways to set the values in the sysfs is to use udev rules, Writing udev rules
    2. Even if I used a udev rule, there appears to be an issue where the device does not exist yet at the time the rule is processed to set the value for the device

    Solution (per forum post) create a file /etc/udev/rules.d/trackpoint.rules and place the following in

    SUBSYSTEM=="serio", DRIVERS=="psmouse", ATTR{description}=="Synaptics pass-through", WAIT_FOR="/sys/devices/platform/i8042/serio1/serio2/sensitivity" ATTR{sensitivity}="171", ATTR{speed}="119"

    by justin at June 05, 2010 12:27 AM

    May 30, 2010

    Free Software Round Table

    Episode 046: May 29, 2010

    This episode is hosted by: Bill Burns, Ilya (dotCOMmie) Sukhanov, Jonathan Dahan and engineered by Bobanero.

    The following topics were discussed:

    • Net neutrality developments [ 1 ]
    • Bittorrent uTP [ 1 ]
    • XKCD 743 [ 1 ]
    • Codec wars
      • VP8 "Open Sourced" [ 1 ]
      • Is VP8 technologically superior? [ 1 ] [ 2 ]
      • Google questions OSI modus operandi [ 1 ]
    • Bug reporting through drama [ 1 ] [ 2 ] [ 3 ]
    • 2.6.34 released [ 1 ]
    • + 3 topics in 3 minutes
    Download {enclose fsrt.20100529.mp3}

    by fsrt@dotcommie.net (dotCOMmie) at May 30, 2010 04:07 PM

    May 26, 2010

    Justin Lintz

    Check for missing reverse DNS entries on network

    A quick way to check your network for IPs missing reverse DNS entries….

    nmap -PE -sP 10.0.0.0/24 | awk '{if ($2 ~ /^[[:digit:]]/ ) print $2}'

    by justin at May 26, 2010 06:15 PM

    Free Software Round Table

    Episode 045: May 15, 2010

    This episode is hosted by: Bill Burns, Brian Fix, Ilya (dotCOMmie) Sukhanov, Jonathan Dahan, Kupo and engineered by Bobanero.

    The following topics were discussed:

    • Federal Supreme Court Justice John Paul Stevens Retiers [ 1 ]
    • Humble Indie bundle [ 1 ]
    • Steam
    • Nvidia Drops Open Source Driver [ 1 ]
    • Nvidia sends Fermi Cards to Nouveau developers [ 1 ]
    • Diaspora, The Facebook Killer? [ 1 ]
    • Open Source and Open communities [ 1 ]
    • International TLD [ 1 ]
    • Is physical media dead?
    Download {enclose fsrt.20100515.mp3}

    by fsrt@dotcommie.net (dotCOMmie) at May 26, 2010 02:26 AM

    May 14, 2010

    dotCOMmie

    Versionless Distro

    Every six months the internet lights up with stories that Canonical & Co has done the unthinkable they have increased the number following the word Ubuntu. In other words they have release a new version. This is a well understood concept to differentiate releases of software. As the version increases it is expected that new features are introduced and old bugs are removed (hopefully more are removed than added).

    Versioning distributions and releasing the versions separately is a common practice, employed by most if not all distributions out there. Ubuntu has adopted the policy of releasing regularly and quite often. But there is a different approach it revolves around a concept I call "Versionless" where you do not have a hard release but instead let the changes trickle down. In the application world these releases are often called nightly builds. With distributions it is a little bit different.

    First of all its worth noting that distributions are not like applications. Distributions are collection made up by applications and a kernel, the applications that are included are usually stable releases and so the biggest unpredictability comes from the combination and configuration there of. As a result one of the important roles for distro developers is to ensure that the combination of the many applications does not lead to adverse side effects. This is done in several ways, the general method is to mix all the applications in a pot, the so called pre-release and then test the combination. The testing is done by whole community, as users often install these pre-releases to see if they see any quirks through their regular use. When the pre-release becomes stable enough it is pushed out the door as a public release.

    In an ideal world after this whole process all the major bugs and issues would have been resolved and users go on to re-install/update their distribution installations to the new release -- without any issues. The problem is that even if the tests passed with flying colors does not mean that on the user will not experience problems. The more complicated a configuration that a user has the more chances they will notice bugs as part of upgrade. This is particularly evident where there are multiple interacting systems. Doing a full upgrade of a distribution it is not always obvious what change in the update has caused this problem.

    Versionless distributions are nothing new, they has been a staple of Debian for a while. In fact it is the process for testing package compatibility between release, but it is also a lot more. There are two Debian releases that follow this paradigm, Debian Testing and Debian Unstable. As applications are packaged they are added to Debian Unstable and after they fulfill certain criteria, IE they have spent some time in Unstable and have not had any critical bugs filed against them, they are then passed along to Debian Testing. Users are able to balance their needs between new features and stability by selecting the corresponding repository. As soon as the packages are added to the repositories the become immediately available to user for install/upgrade.

    What it really comes down to is testing outside your environment is useful but it cannot be relied solely upon. And when upgrades are performed it is important to know what has changed and how to undo it. Keeping track of changes for 1000's of updates is nearly impossible. So update small and update often, use Debian. Good packages managers are your best friend, but only second to great package developers!

    by dotCOMmie at May 14, 2010 11:03 PM

    May 01, 2010

    Josef "Jeff" Sipek

    Steadicam

    I've resumed watching Stargate Universe. I'm more or less convinced that it's crap. The plot is painful (well, the tiny bits of plot that are there), the characters are annoying, and there are a few "issues" I have with the production. This is going to be my short rant about one aspect of the production.

    At some point, someone thought of making a device so that you can hand-hold a camera but still have it stable & steady. This invention is commonly called a Steadicam. Anyhow, I would like to know when it became artsy and cool to not use steadicams, and instead have this unsteady shot. I find this motion distracting and even un-natural. SGU isn't the first show to do this. I vaguely remember BSG doing the same. Why are you doing this?

    Of course, not doing silly things with the camera will not fix the other issues with the show - like annoying characters and lacking story lines.

    So, if you are responsible for the production of SGU, use those steadicams! They'll improve your show!

    by JeffPC at May 01, 2010 06:12 PM

    Cake

    I've had the following draft for a very long time. It's time to publish it already, isn't it?

    Yesterday, I came across a site dedicated to Cake Wrecks - in other words, cake decoration attempts gone wrong.

    The best ones I've found on this site include:
    Dr Who
    Dr Who
    Dr Who
    Dr Who
    Dr Who

    by JeffPC at May 01, 2010 05:43 PM

    April 22, 2010

    Will

    Announcing The “Stupid” Javascript Framework

    This came about after attempting to write the longest and most inefficient getElementById function I could.

    http://github.com/psychcf/stupid

    Feel free to fork it, add more functions, and make it better (or worse, depending on how you look at it).

    by Will Riley at April 22, 2010 02:55 AM

    April 20, 2010

    Josef "Jeff" Sipek

    Dear Facebook

    Dear Facebook,

    I tried to use your @ name completion feature in Opera, and it didn't work...at all!

    Love, Jeff.

    by JeffPC at April 20, 2010 03:23 AM

    April 18, 2010

    Free Software Round Table

    Episode 044: April 17, 2010

    This episode is hosted by: Bill Burns, Brian Fix, Ilya (dotCOMmie) Sukhanov, Jonathan Dahan and engineered by Bobanero.

    The following topics were discussed:

    • Google site ranking [ 1 ]
    • Theora optimization [ 1 ]
    • Google VP8 [ 1 ]
    • 4th amendment & email [ 1 ] [ 2 ] [ 3 ]
    • IBM & TurboHercules [ 1 ] [ 2 ]
    • PatentAbsurdity.com [ 1 ]
    Download {enclose fsrt.20100417.mp3}

    by fsrt@dotcommie.net (dotCOMmie) at April 18, 2010 05:14 PM

    April 13, 2010

    Josef "Jeff" Sipek

    mail_conf_suck

    I was just looking at the source for Postfix, when I came across this function:

    /* mail_conf_read - read global configuration file */
    
    void    mail_conf_read(void)
    {
        mail_conf_suck();
        mail_params_init();
    }
    

    It turns out that mail_conf_suck reads in the config file, and then mail_params_init does all the dirty work of initializing the internal data structures based on the config.

    Anyway, that's the random thought of the day. I found it marginally amusing.

    Edit: the code in question is in src/global/mail_conf.c.

    by JeffPC at April 13, 2010 06:52 PM

    April 11, 2010

    Justin Dearing

    CoApp: Open Source Package Manager for Windows

    As I mentioned before, I am a big fan of msi installers on windows. So I was really excited to see Garrett Serack announce an OSS package management system called CoApp that he has been authorized to work full time on.

    In my point of view, Garrett really gets it. I’m hoping as a side effect of this project, WiX will get all sorts of dependency handling improvements.

    I’ll be watching how this develops very closely.

    by Justin at April 11, 2010 12:28 PM

    April 10, 2010

    dotCOMmie

    Monitor hot plugging. Linux &amp; KDE

    Apparently Linux does not have any monitor hotplugging support which is quite a pain. Every time you want to attach a monitor to laptop you have to reconfigure the display layout. This is a tad frustrating if you have to do this several times a day. And it doesn't help that KDE subsystems are a bit flaky when it comes to changing display configuration. I've had plasma crash a on me 1/3 times while performing this operation.

    Long story short I got fed up with all of this and wrote the following 3 line script to automate the process and partially alleviate this head ache

    #!/bin/bash
    xrandr --output LVDS1 --auto --output VGA1 --auto
    sleep 1
    kquitapp plasma-desktop &> /dev/null
    sleep 1
    kwin --replace & &> /dev/null
    sleep 1
    kstart plasma-desktop &> /dev/null
    

    You probably need to adjust the xrandr line to make it behave like you want but auto everything works quite well for me. Check man page for xrandr for details.

    For further reading on monitor hot plugging I encourage you read launchpad bug #306735. Fortunately there are solutions for this problem, however they are on the other side of the pond.

    Update: Added the kwin replace line to fix sporadic malfunction of kwin (disappearance of window decorations) during this whole operation.

    by dotCOMmie at April 10, 2010 08:58 PM

    Jonathan Dahan

    anti-lifehacking

    This is the anti-lifehack.

    By eschewing organization schemes this design pattern forces immediate action.

    No tags, folders or priorities allowed - either deal with item X now, or place it on the bottom of the queue.

    If it seems overwhelming, try determining how much time you would like to work on anything, and find an item that can have measurable progress in that period. I have applied this to my email inbox, rss feeds, and todo lists.

    When applied to my email, I realized I had too many messages incoming. It forced me to unsubscribe from at least a dozen mailing lists, and over 99% of my emails are archived (which means they are dealt with). Zero inbox is attainable but not necessary - set small goals, like reducing the net amount by 5 every day.

    When applied to my rss reader, I realized I had too many feeds, and would really only read a few anyway. I bookmarked the sites that I loved but rarely read, and decided to return to them later. Also, I hid item counts.

    When applied to my todo list, I realized I had more stuff than time to do it in, which forced me to get very good at prioritizing, and picking what needed to be done immediately. This required a bit more dilligence about actually adding stuff to the todo list, though its great to cross off items.

    April 10, 2010 07:00 AM

    April 09, 2010

    Josef "Jeff" Sipek

    Eternity's Missing Children

    Some time ago, I stumbled across a Wikipedia article about a book: Eternity's Missing Children.

    Apparently, it's some obscure book that no one really cares about - at least that's what the "this article may not meet the general notability guideline" box implies.

    Anyhow, here's the entire description from the wiki page (copied because I wouldn't be surprised if it got deleted on Wikipedia).

    The Devil and Jesus sit down for a cocktail in New Orleans, with a myriad of shared worries and personal relationships to resolve. These two historic gentlemen find themselves in the One Wheel Louisiana, a New Orleans bar on the outskirts of town, where an aging black bluesman finds his soul and Jesus is reminded of a former romance. As the night roles on, with libation and song consumed, these half-brothers of biblical proportions find a world in peril with genuine faith shaken and manipulated by our earthly guardians of organized religion; but they both agree with belief in their hearts and their futures in question that New Orleans never looked so good.

    by JeffPC at April 09, 2010 03:59 AM

    April 08, 2010

    dotCOMmie

    Flash -- still crawling,

    Flash is an absolute resource drain you've probably noticed how it completely hogs resources when you watch a video. Ever wonder how much more power is consumed watching flash over a regular video file? Is it a significant number? For those too lazy to read the rest, the simple answer is yes. And now to the details.

    Recently I was watching a hulu video on a 1080P monitor and I noticed it was a little choppy. I decided to conduct an experiment and actually measure the difference in resource, power utilization between flash and h.264 (in mplayer). Not having the desire to make a video and encode it for flash and h.264 I randomly chose a trailer which was sufficiently long and was widely available in multiple formats. Tron Legacy, conveniently available through youtube and The Pirate Bay in 1080P, excellent.

    In a more or less idle state my laptop draws around 1500mA of current (according to ACPI), CPU utilization is around 3% and clock averaged both cores is somewhere around 1.5Ghz (1Ghz min 2Ghz max .25Ghz step size utilizing the on-demand CPU frequency governor). Firing up the video through youtube in windowed mode (which scales the video to around 800pixels) The CPU utilization jumps up to around 85% and current draw to around 44000mA clock is continually kept at 2Ghz on both cores. Setting the movie to full screen (1080 pixels wide) decreases CPU usage to 70% and current draw to 3500mA, this might sound counter intuitive but it makes perfect sense as at 1920 wide the video is in native resolution and does not need to be scaled (This actually demonstrates that Flash does not make good use of the hardware scaling AKA Xv). Viewing the same 1080p trailer in mplayer, does reduce CPU load and current draw. Size of the video window does not matter much scaling it to about 800pixels or viewing in native 1920 pixels wide results in same numbers, thanks to mplayers Xv support. CPU utilization is around 40% and CPU does quite frequently clock down to reduce power consumption, current draw is around 3000mA.

    So what does all of this mean. Assuming the voltage at the built in ACPI ammeter is equal to battery voltage (11.1V) that means the difference in power consumption between playing a video in flash vs Mplayer h.264 is about equivalent to medium strength CFL light bulb (1.5A*11.1V=15watts). Now this experiment is completely unscientific and has many flaws, primarily perhaps that I use Linux 64 bit flash player (10,0,42,34) the vast majority of flash users are obviously on windows and its possible that it runs better on windows platforms but I wouldn't bet money on that.

    It makes me wonder if google is supposedly so concerned about being green maybe they should think about switching the default video format for youtube. We can do some interesting estimations. Lets assume that the average user of youtube watches 10 minutes worth of content in the default flash format, that means they consume about ( 10hours * 15watts / 60 minutes in an hour * 52 weeks in a year / 1000 watt hours in megawatt hours) .13 kilowatt hours per year more than using other formats. This does not sound like all that much but, assuming that 5% of the world population fits into this category it equals to about 40 000 000 kilowatts of power that could be saved. What does this number really mean? I invite you to go to the EPA Greenhouse calculator and plug it in. You'll see its equivalent to annual emission of 5500 cars. Again the numbers are completely unscientific but even if they are off by a factor of 3, it is still a significant number. It would be nice for someone to conduct a more thorough investigation.

    While conducting this experiment I noticed something interesting. Playing the 1080p video in youtube would work fine for the first 1.5 min but then it would get choppy. The full trailer was fully downloaded so it didn't make much sense. Firing up KDE System monitor I was able to quite quickly to figure out the problem. As the video got choppy the CPU clock would drop while usage remained high, clearly the problem must be with cooling. System monitor was reporting CPU temperature of about 100C and power consumption of almost 6000mA. It had been a while since I cleaned the inside of my laptop, so I stripped it apart and took out a nice chunk of dust that was between the radiator and the fan. After this CPU temperature never went above 85C and current draw was at a much more reasonable 4400 while playing the flash video. Hopefully this will resolve my choppy hulu problem.

    The graphs of this experiment are available. The flash graph, at first the scale trailer was played following by full screen. For the mplayer graph the inverse was done, first full screen then scaled .. but it doesn't matter much for mplayer.

    by dotCOMmie at April 08, 2010 02:42 AM

    April 07, 2010

    Justin Dearing

    My strange ternary operator indenting

    I’ve always indented ternary operator (?:) statements like so in languages that support them:

    int fooCount = (isSeven)
        ? 7
        : int.MaxValue;

    I’ve never seen anyone else do it this way , but no one has complained about my style to my knowledge. If anyone has a strong opinion on the matter, for or against it, I’d like to know.

    by Justin at April 07, 2010 12:11 PM

    Josef "Jeff" Sipek

    IBM RAMAC

    At some point, I came across this wonderful bit of history - the IBM RAMAC. Even though I'm a System/360 fan, I think this is too cool not to share.

    First, the memory:
    IBM RAMAC

    Second, the whole "CPU":
    IBM RAMAC

    And third, a video about it:

    by JeffPC at April 07, 2010 12:14 AM

    April 05, 2010

    Justin Dearing

    Cassini is now on github.

    This weekend I created a github repository for Cassini, the small, single executable, Ms-PL web server which Microsoft released for developers. This was motivated by my SVG experiments, because Cassini does not serve svg files with the proper content type.

    I coded a simple workaround to set the mime type and wanted to give it back to the community. While there are two codeplex projects with Cassini enhancements, Cassini++ and CassiniDev, I felt github was the place to host Cassini changes. There are a multitude of small enhancements that have been made to Cassini, and Cassini is not the sort of project that works well with strong central leadership.

    Currently the version of Cassini available in my github repo sports the following features:

    I’m hoping that hosting my changes on github will foster the sharing of Cassini enhancements. I will reach out to both Cassini projects on codeplex and let them know of my changes so that can incorporate them into their projects.

    by Justin at April 05, 2010 12:48 PM

    April 04, 2010

    Justin Dearing

    Adventures with SVG (a lessons learned post)

    Go into the open dessert. Draw a circle around you. All that is inside the circle represents your knowledge. All that is outside the circle represents that which you do not know. The line represents that which you know you do not know. What happens as you make the circle bigger?
    – Unknown

    I don’t remember where I first read a version of the above story. However, it rings true for my recent experiences. You see I wrote a simple jQuery plugin, and decided to use inkscape to generate the graphics used by it. I then discovered it was possible to animate the SVG files with javascript. Before I knew it I found myself wandering through a dessert awaiting the promised land of SVG. I’ve yet to reach the promised land, but I’ve learned a lot in the experience.

    Lesson Zero: SVG is poorly documented on the web.

    I need to qualify the section header a bit. The actual standard is pretty well defined. There are examples on the web, and w3schools has a section on SVG. However, SVG is not popular enough for you to be able to steal all your code from google. You will have to experiment to do a lot of simple tasks.

    Lesson One: SVG has very html like DOM.

    This one was a pleasant surprise actually. SVG elements have event attributes like onload and onclick. Animating is as simple as recursively calling a function via window.setTimeout(). You could call console.log() to trace your javascript’s execution via firebug or the chrome developer console. In general I was able to leverage a lot of the javascript experience I’ve had with html.

    Lesson Two: I should be animating with SMIL instead of javascript.

    I’ll call this a lesson I’ve not really learned. If I truely learned my lesson I would have learned SMIL and done my animations with it instead of javascript. However, I was more concerned in exploring what could be done by combining javascript and SVG than animating SVGs.

    Lesson Three: SVG is inconsistently implemented in practice.

    I’m not just talking about amongsT the browsers, but that too is a problem.

    First of all, you need to use one of several plugins to render SVGs in Internet Explorer. IE9 will finally rectify that. The no longer maintained Adobe SVG plugin was the most popular IE plugin. However, the still alpha flash and javascript based svgweb by google is gaining popularity. That one has the advantage of not requiring any special software besides flash, which is probably already installed. However, it seems it does not support javascript embedded in the svg file.

    Second, SVG support is inconsistent amongst opera, firefox, and chrome. Chrome has a nasty habit of not rendering svg embedded in html via an <object/> tag if the mime type is not properly set. I discovered this while serving html and svg through Cassini.

    (As an aside, I have made available a modified version of Cassini on github so no one will have to suffer as I have.)

    Third, inkscape, the editor I use to draw my SVGs, is not a complete SVG editor, and it implents several extensions to the SVG standard. The extended elements have not prevented SVGs I drew in Inkscape from being rendered in browsers since they have different XML namespaces. While I’ve discovered how to reference external javascript files in a svg through inkscape, I have to use a separate text editor on the SVG files to embed javascript in the document.

    Conclusions

    My first conclusion is SVG is not quite ready for prime time as a deploy directly to the web technology. However, there is enough buzz happening that early adopting might be prudent for some scenarios. Browser support is improving, and the tools are improving.

    My second conclusion is that SVG is ready as a “mastering format,” like PSD, XCF (gimp native) or Illustrator. If you want to draw with a rector tool, and then render to a bitmap, SVG is a solid format. Inkscape is a good editor.

    My third and final conclusion, is that the desert of SVG is very big, and my circle in the sand is quite small.

    by Justin at April 04, 2010 05:29 AM

    April 01, 2010

    Justin Dearing

    jquery.collapsiblePanel: A collapsable panel plugin for jQuery

    I’m pleased to announce my first open source jquery plugin, collapsiblePanel.

    Basically, this plugin surrounds a given html element with a box and places a title bar on top. Clicking on the title bar will toggle between expanding and collapsing the element.

    My main motivation for creating this plugin is to for the tangential lessons I will learn. Some of the tangential lessons I am learning as a result of this:

    1. How do you use the google closure compiler?
    2. How do you use git, and github specifically.
    3. How do you automate the release build process for a static html website. This means automatically renaming the javascript file with the version number, compressing it, and creating a git branch.
    4. Whats is a good javascript editor? Right now I’m liking komodo edit.
    5. Can I use javascript and svg to create animated graphics?

    The plan is to blog as I learn, sharing my experiences with you all.

    by Justin at April 01, 2010 03:55 AM

    March 22, 2010

    Free Software Round Table

    Episode 043: March 20, 2010

    This episode is hosted by: Bill Burns, Ilya (dotCOMmie) Sukhanov, Jonathan Dahan, Kupo and engineered by Bobanero.

    The following topics were discussed:

    • WUSB Fundraiser. Please donate. [ 1 ]
    • Island Labs Balloon launch [ 1 ][ 2 ]
    • Linux 2.6.33 is out. Nuveo [ 1 ]
    • Billion Dollar Kernel [ 1 ]
    • Distro cadance [ 1 ]
    • EFF on the Iphone developer contract [ 1 ]
    • Eben Moglen on social networking [ 1 ]

    Download {enclose fsrt.20100320.mp3}

    by fsrt@dotcommie.net (dotCOMmie) at March 22, 2010 09:01 PM

    March 10, 2010

    Free Software Round Table

    Episode 042: Feb 20, 2010

    This episode is hosted by: Bill Burns, Brian Fix, Chris Knadle (in person), Ilya (dotCOMmie) Sukhanov and engineered by Bobanero.

    The following topics were discussed:

    • JMRI case settled GPL +1 [ 1 ]
    • Maemo and Moblin merge into MeGoo [ 1 ]
    • Android & the linux community [ 1 ]
    • Symbian goes open source [ 1 ] [ 2 ]
    • Science, release the damn code! [ 1 ] [ 2 ]

    Download {enclose fsrt.20100220.mp3}

    by fsrt@dotcommie.net (dotCOMmie) at March 10, 2010 10:50 PM

    Episode 041: Jan 30, 2010

    This episode is hosted by: Bill Burns, Brian Fix, Ilya (dotCOMmie) Sukhanov, Jonathan Dahan, and engineered by Bobanero.

    The following topics were discussed:

    • Freenode switched to ircd7 hyperion [ 1 ]
    • Apple Ipad [ 1 ] [ 2 ]
    • MSI tablet [ 1 ]
    • Find bugs in chromium and get paid [ 1 ]
    • Panopticlick -- how unique is your browser? [ 1 ]
    • OpenPC [ 1 ]
    • Benchmarking Debian's GNU/kFreeBSD [ 1 ]
    • Nexenta [ 1 ]
    • RedHat in the recession [ 1 ]

    Download {enclose fsrt.20100130.mp3}

    by fsrt@dotcommie.net (dotCOMmie) at March 10, 2010 10:35 PM

    February 17, 2010

    dorgan

    Been doing some heavy ExtJS development

    So for the past couple of months I have been doing some heavy ExtJS work. Nothing too fancy, no extension development....but some real heavy use of Ext and some 3rd party extensions.

    The backend of the application I am working on is PHP, and I have come up with a psuedo framework for the application itself. By using the __autoload() functions in PHP and passing a couple of standardized arguments for every ajax call whether it be a submitting of a form or loading a data store for a grid/combo Ext component. Through Ext lovely use of the xtype property I am able to create arrays in my PHP Objects json_encode() them and pass them back to the front end where they become full fledged objects....this is not a standard practice for the interface but it is used in a specific element of the application that is very dynamic and very custom. Now I am sure if I found some Ext developers in my area and could sit down with them and show them the application they could do away with PHP generating the code and come up with a couple of extensions to do exactly what I want, but for now PHP is filling in the gaps and doing exactly what I want.

    I originally started looking at ExtJS when version 1 was released, then version 2 came out and I started on a project at my former location, but never really was given the time to actually fully develop an application using Ext...then a couple of months ago I started on the current project I am working on and presented the idea of using Ext to my boss, he said I could proceed and I think overall everyone has been very happy with it.

    Somethings I have seen improve for each release of Ext. I am going to start with the items that I have seen the biggest change in and work down to those that have changed but maybe not that much. Of course these are just my opinions

    * Documentation
    * Speed
    * Overall Community Support
    * UI Reliability


    Documentation- The documentation has GREATLY improved and since the release of 3.0 I have started to see more and more examples of code in documentation itself. One thing that is still lacking just a little is an overall explanation of the properties/config options/methods/etc... for an object....some of these have a great amount of explanation and others not so much. Of course you can likely find someone to give a little bit more information on #extjs on irc.freenode.net but I think such details should be in the documentation. One thing I would love to see in the documentation along with the curret code example, is an actual working element produced from the code example, I know there are examples, but having everything in one place is a great thing to have and not all classes that have code in the documentation have samples...although most of them do.

    Speed- The speed of Ext overall has increased SIGNIFICANTLY and I dont think there is anyone out there that is using Ext that could ask for more speed improvements although I am sure the team is working on them.

    Overall Community Support- I have see the community grow in leaps and bounds for Ext, this past year was the first Ext Conference, and although I moved to Florida just in time for it, unfortunately I was getting married later that month and with starting the new job and having to take time off for the wedding/honeymoon I as unable to attend. I believe this years conference, if there is going to be one, will be in California as that is where the new Ext office is located (figures I come to town and everyone leaves!) Going with community tow books have come out recently The "Ext JS 3.0 Cookbook" and a not yet released in paper back form but available but available through Manning Publishing's MEAP program "Ext JS in Action" these has both bean great reads so far and I would highly suggest for anyone involved in Ext development to purchase them.

    UI Reliability-  This one really isnt an improvement but something negative that I am starting to see I have noticed a couple of UI bugs creaping in and out of the 3.x releases such as, tabs not having the site images, a form having trouble placing buttons correctly and having them cut off on the left hand side.  Now  the tabs issue was corrected with the release of 3.2 but the 3.2 release introduced the buttons issue, which I believe is my fault in that I have not set the proper config options for my objects but it was working correctly in 3.1 and now is showing up in 3.2


    But overall Ext is great and the changes they have been/are making to the release cycle are going to help the overall package shine like no other.

    by Donald J Organ IV (noreply@blogger.com) at February 17, 2010 09:07 PM

    February 15, 2010

    Justin Lintz

    Support for authorized-keys.d/

    Why is there no subdir inside .ssh called authorized-keys.d where I can just throw my ssh keys and easily manage them by file name instead of having to edit the authorized-keys(2) file?

    I need to do some googling on this , a quick search yields this debian bug report on wishing for support for one.

    by justin at February 15, 2010 05:02 AM

    February 13, 2010

    Mark Drago

    Change

    Today is my last day working at Bascom.  I’ve been working there full-time for nearly six years and a year before that as an intern.  I’m very grateful for the past seven years.  It’s impossible to list all of the wonderful experiences and opportunities I had while at Bascom.  I can say that I worked on fulfilling and challenging problems as part of a great team with the support of inspiring management.  I’ll always remember the friends I made and the fun we had at Bascom.  I had a number of pranks pulled on me when I was out of the office (bathroom cubicle, solo cup cubicle).   I also participated in my share of pranks (1, 2).  Office bocce was also created and perfected at Bascom.  It’s a period of my life that I’ll remember fondly for the relationships, the awesome work we did, and all of the things that we accomplished as a team.

    Time moves on and things change.

    My first day at Yodle is just a few days away.

    by Mark at February 13, 2010 01:10 PM

    February 11, 2010

    Will

    My Sumobot From Last Year

    I haven’t really shown off any of my robots, so I figured I’d just show one of them quickly.I built this for an event that’s a part of a school-wide  Science Olympiads competition. Multiple schools participate. Since I’m the only real hardcore technology person in my school (there are computer enthusiasts, but none that I know of can program very well, and none of them have built something like this), obviously I get all the complicated work, and nobody else helps, heh. Such is life I suppose, although I’m hoping in college I meet some more people who share an interest.

    Here’s the one from last year, “The Nex”. I named it after the weapon from the game Nexuiz, and borrowed the Nexuiz logo for it, since I literally finished this hours before the competition, and couldn’t come up with an original name.

    You can see the internals better here:

    Just a 7.2 volt battery, two speed controllers, two rather large motors, and a futaba radio system (missing from the picture because I’m reusing it in this year’s robot). I used worm gears to build this, but the problem was that the gears kept slipping, despite my efforts to prevent this from happening. Despite the fact that it barely worked, and that it was just a box that was made from glued together Plexiglas, it did surprisingly well, ranking 8th out of 52 teams at the Science Olympiads event.

    I’ll write another post on this year’s robot after the competition. It’s definitely an improvement over last year’s model, and almost completely rebuilt too.

    by Will Riley at February 11, 2010 12:25 AM

    January 28, 2010

    Justin Dearing

    Using the registry to resolve Visual Studio reference paths.

    Note: To skip the long journey of what lead me to figuring this out, click here to go to the howto.

    Recently I was asked to look at a fiddler plugin Stan, the founder of this blog, was developing. He gave me a SVN path and asked me to build it and test it.

    So I checked out the source code and hit F5. I got a bunch of compiler errors relating to the fact that I didn’t have fiddler installed. I rectified that matter and still got errors. The problem was that the hintpath of fiddler.exe was wrong. On my machine, Fiddler is installed in ‘C:\Program Files\Fiddler2\’, while on Stan’s machine it is installed to ‘C:\Program Files (x86)\Fiddler2′. I consulted the mighty google, which led me to a stackoverflow question. The question pointed out that you can have multiple hintpaths to an assembly. However, I wanted a better solution. What if someone installed Fiddler to a custom location?

    I got the idea of using the registry. Fiddler has an installer. Surely the installer records its install location to the registry. It does in ‘HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Fiddler2′ (Apparently fiddler is written by a Microsoft Employee). So the question is how to get MSBuild, the tool that visual studio uses to parse project files, to read a value from the registry.

    The answer was found in a post on the MSBuild team blog.

    How To

    Unfortunately, Visual Studio does not allow you to edit hintpaths to referenced assemblies. So you’re going to have to edit your vcproj or vbproj file in notepad or some other text editor.  Here are the steps:

    1. Open the project file in your text editor.
    2. Look for the <Reference/> element for fiddler.exe. It should look similar to this:

      <Reference Include=”Fiddler, Version=2.2.7.5, Culture=neutral, processorArchitecture=MSIL”>

      <SpecificVersion>False</SpecificVersion>

      <HintPath>C:\Program Files\Fiddler.exe</HintPath>

      <Private>False</Private>

      </Reference>

    3. Change the hintpath as follows:

      <Reference Include=”Fiddler, Version=2.2.7.5, Culture=neutral, processorArchitecture=MSIL”>
      <SpecificVersion>False</SpecificVersion>
      <HintPath>$(Registry:HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Fiddler2@InstallPath)\Fiddler.exe</HintPath>
      <Private>False</Private>
      </Reference>

    4. Save the file
    5. Visual studio will detect the file change and ask you to reload the file. If you are using SharpDevelop as you’re IDE, you will have to close and reopen the solution.

    Thats all there is to it. Happy coding!

    by Justin at January 28, 2010 02:01 PM

    January 24, 2010

    Free Software Round Table

    Episode 040: Jan 16, 2010

    This episode is hosted by: Bill Burns, Ilya (dotCOMmie) Sukhanov, Jesse Farinacci, Jonathan Dahan, and engineered by Bobanero.

    The following topics were discussed:

    • Google going from ext2 to ext4 [ 1 ] [ 2 ]
    • Android and other Linux based phones [ 1 ]
    • Linux jobs growing [ 1 ]
    • Make Open Source Hardware Guide [ 1 ]
    • HTML5 making headway [ 1 ] [ 2 ]
    • Rant: Flash Video sucks [ 1 ]
    • Hulu no longer works with 64bit flash on Linux [ 1 ]

    Download {enclose fsrt.20100116.mp3}

    by fsrt@dotcommie.net (dotCOMmie) at January 24, 2010 04:13 PM

    Justin Lintz

    Python Quote module

    Over the past couple of years I’ve been wanting to learn Python more seriously but really haven’t sat down and just done it.   I’ve written a couple of various scripts for personal and work use but always felt they weren’t coded in a “pythonic” way.  I’m now reading Learning Python (4th edition) from the beginning and making sure I learn things properly from the ground up.  When I was writing my code in the past I wasn’t aware of what objects were immutable vs mutable or how generators worked.  I basically knew what I wanted to accomplish before writing my code and would reference the online documentation and just go at it.  Overtime I picked up on some “pythonic” methods from looking at code examples, for example, using optparse for handling arguments passed into your program.

    My first project I decided to tackle as I go through my book is writing a module that will fetch stock quotes from Yahoo’s Finance page and store them in memcached.  I just pushed it out to github available @ http://github.com/jlintz/python_quote.  I’m hoping to get some feedback from some people on where I can improve in my code and hopefully it will be useful to someone else out there.  As I go through the book I plan on going back and looking at the code and see what I can refactor and I’m sure along the way I’ll probably re-architect things.

    One thing I know I need to do is write some unit tests for the module.   When I was in my Computer Science program in college, we really never had any exposure to unit tests.  The unit tests consisted of assert statements and really never had any real lessons on them.  I need to do more reading on unittest.  I know many developers write their unit tests first before writing a single line of code in a test driven development approach.  It’s something I want to look at more and see if I should consider picking that up.

    Also as part of this coding project, it was a good excuse to get some exercise with Git.  It’s pretty easy to work with and I haven’t even scratched the surface of its potential.  I just need to begin looking at some of its more advanced features and incorporating them into my work flow.

    Vim is another program I’m getting some finger exercise in.  When I started my job 3 years ago I had never really opened Vim/Vi but one day forced myself to learn it because as a sysadmin, Vi will always be there for you, like your friend Stewie.  In my day to day uses of Vi, I just used the basics, hjkl and :wq.  Slowly I picked up some commands from co-workers and got used to using them daily.  When writing code in Vim , there are a lot of tricks and commands to aide you in writing code , I’ve read about many but now it’s a matter of incorporating them so I don’t have to think much and breaking my old habits to use the new commands I’ve read about.

    by justin at January 24, 2010 05:38 AM

    January 22, 2010

    Justin Dearing

    What three things got me here.

    Paul Randal wrote a What three events brought you here article on his blog and asked some others in the SQL server community to do the same. I of course was not on that list. However, no one ever invited me to blog about anything before so why should I be shy now.

    I have decided to not tell this story in terms of professional accomplishments. For me, my hobbies have always led my career.

    Event 1: A trip to Borders

    The year was 1999. At 18 years old I spent my last summer before college doing contract work at 590 Madison Avenue, a.k.a. The IBM building. Of course Lou Gerstner had already sold the IBM building. I had heard of this linux thing. Deciding that I needed something better than Windows 95 (read: wanting to be more 1337), I bought myself a linux book and Mandrake Linux. I only had a 14.4k modem at home, and had no way of downloading an ISO easily.

    Try as I might I could not get linux working on that computer. That September I brought the machine to college and bough a NIC that proudly claimed to be linux compatible. Of course it required a special patched version of the tulip driver that I could not get compiled against the kernel. Someone told me about the even more awesome FreeBSD which actually worked with my NIC. Eventually, a version of the 2.4 kernel was released that supported my NIC out of the box.

    Event 1 Epilogue

    In college I learned a lot more about linux than I did in the month previous. All I really managed to learn in the few weeks on my own in my parents basement was how to use vi, and what sort of hardware tended to not be compatible with linux (modems, printers and damn near everything). However, had I not struggled those weeks on my own, I would have never sought acceptance with the other unix fans. That trip to borders changed the course of my time in college.

    Event 2: Learning SQL from Stan in a bowling alley.

    I would like to note that I never finished college. This part of the story takes place in the time period after I stopped going to school full time but while I was taking classes at what one would call a “junior college.”

    So I am sitting one Saturday at my local bowling alley with and old Toshiba laptop. I believe it was a 133mhz pentium. This was probably 2002 so it was old at the time. At the time I knew half the employees and my brother was on a league there. So I spent Saturdays at the bowling alley, mostly because I could get free food.

    I would hack at perl on the machine. It was running Wndows 95 with an ActiveState Perl install. I don’t think any of my perl programs ever did anything useful, b I had fun writing them. For whatever reason, the founder of this blog Stan, who worked the cash register at the time, decided to teach me SQL. It was relevant to whatever project I was working on at the time. I had recently finished a course in VB6 at this point in which a lesson at the end involved talking to an Access Database but no SQL was involved.

    I ended up not using this knowledge until I began taking a SQL class that was taught with Microsoft Access. Because I had a basic understanding of SQL from Stan, and also had a clerical job at the time, I took to Access like a semi employed semi college dropout to free chicken fingers.

    Event 2 Epilogue

    Once again this was a catalyst event. Had I not learned SQL from Stan I might not have taken that MS Access course, and I might not have turned a clerical job into a development job.

    Event 3: My first LIPHP meeting

    March 2006 and I am back in a semi-employed state. This time by choice. I walked away from a unix administration position to take a programming contract and try to start a website. I didn’t take much of a paycut, and the next full time job I got was a big raise. However, this is not about my professional accomplishments.

    So there I was programming on the side for money and the rest of the time for room, board, and potential millions. Unfortunately I was the only programmer in this boiler room startup. I had no one to talk about computers with. I was programming PHP at the time and became aware of a PHP user group in Suffolk county. So I traveled one Monday night from my bedroom/office in Manhattan to an office in Suffolk county less than a mile from the job I walked away from.

    I don’t remember the topic, but it was a good time with good people. It was a great first experience at LIPHP a group that I eventually became the organizer of. I had been to one user group before, a LILUG meeting in 2001. However, it was not something I saw any value in at the time. I will note that I am an occasional LILUG attendee these days and the meetings in recent years have been very good.

    Event 3 Epilogue

    Its not easy to qualify the impact of LIPHP. It never got me a job. However, it has lead me to more user groups, more mailing lists, and some networking. I learned many things from the group. I learned about giving presentations, and running a user group.

    by Justin at January 22, 2010 03:08 AM

    January 17, 2010

    Justin Dearing

    Trouble building PHP on Windows

    Update: It seems that the facts presented to me in the initial bug report are not correct. I will be revising this article after the facts are settled. For now read the comments.

    It all started with a simple bug encountered while trying to get PHP and WCF to play nice. Before you know it I was attempting to compile PHP on windows myself. That’s when I realized how deep the rabbit hole really goes.

    These days I program in PHP and .NET for a living. In a past life I was a unix admin for small ISP where most of the internal unix infrastructure was FreeBSD while the managed customers tended to run Redhat.  Due to the unique path of my IT career, I usually don’t have a problem compiling open source software primarily targeted for unix on windows. PHP has proven to be a bit of an exception. However, with a little struggle, I got it to compile.

    In this case the crux of the struggle was not a lack of documentation, but documentation outdated to the point of being wrong. This is perhaps the one exception to the rule postulated by Dick Brandon, “Documentation is like sex . . . when it is good, it is very, very good; and when it is bad, it is better than nothing.” Thankfully, Pierre of libgd fame pointed me in the right direction on the mailing list. So being a good netizen, I submitted a bug report so that someone with commit access to the php source repo could straighten the mess out. This was the response I received:

    We don’t understand the build requirements or system.

    You have to ask the Microsoft guys to update that file.
    http://no.php.net/manual/en/install.windows.building.php was one of our
    best Windows know-how (not-microsoft-employee) guy shot at documenting
    the process, but the feedback he got from Microsoft employees was “this
    is crap. its all wrong”.

    Sorry, we simply do not know how to do this.

    That was a little disheartening. I asked them to mark the readme file as outdated, and I asked them how to contact Microsoft. This was the response I received:

    Updated the file to say its outdated.

    As for contacting the Microsoft guys, try surfing around on
    http://windows.php.net

    We have tried multiple times to get these docs updated, with no luck so
    far, and like I said; our last attempt was shot down and they wanted
    those docs to be reverted.

    I’m sorry, you are simply on your own here.

    So it seems my only resort is to blog about it and hope someone from Microsoft is in earshot. If you care about PHP on windows, spread the word. Spread this article with twitter, digg, reddit, or just plain old email. If you have the ear of anyone in Microsoft give it a bend. I’ve never attempted blogger activism like this, but I don’t know what else to do. I much prefer to fix problems myself than delegating or inspiring. However, this is one case where I need to “have a little help from my friends.” I don’t even know what Microsoft finds wrong with the proposed updates to the documentation, so submitting updated documentation seems pointless.

    by Justin at January 17, 2010 08:14 PM

    January 16, 2010

    Free Software Round Table

    Episode 039: Dec 19, 2009

    This extended, extreme FSRT episode is hosted by: Bill Burns, Brian Fix, Ilya (dotCOMmie) Sukhanov, Justin Seyster, and engineered by Bobanero. When the show began there was almost no snow on the roads, by the time we left there was well over a foot of snow. As a result most of the participants had to spend the nigh in unfamiliar places around stony brook. All the things we do for Free Software.

    The following topics were discussed:

    • Public domain, government collected information
    • Linux 2.6.32 released [ 1 ]
    • DRBD is mainlined, to be included in 2.6.33 [ 1 ]
    • IBM to run linux on mainframes [1]
    • SFLC Busybox lawsuit [1] [2]
    • Oracle addresses mysql concerns [1]
    • Bug Offsets

    Download {enclose fsrt.20091219.mp3}

    by fsrt@dotcommie.net (dotCOMmie) at January 16, 2010 09:18 PM

    January 12, 2010

    Justin Lintz

    Windows 7 64bit + iPhone sync

    I somehow attract issues whenever I build a new computer or do a fresh installation on my desktop.  I currently dual boot between Windows XP 64bit and  Ubuntu 9.10 (Karmic) which has served me well the last 3 years.  My current setup is running atop a fakeraid mirror which at the time, was a PITA to get configured as it involved using a live cd and following a really long howto while crossing my fingers it would work.  Today the installer supports fakeraid out of the box so no poor soul would have to go through those installation steps.

    I got a new 1TB hard drive for the holidays and I had been meaning to redo my setup for some time and finally took the plunge this weekend.  I also decided I was going to give Windows 7 a go.  With my current(now old) setup, I couldn’t install iTunes in Windows XP 64bit so I had to do all my iPhone syncing using a 32bit Windows XP install inside a Virtualbox VM inside of Ubuntu.  I would run into issues anytime I would have to do a firmware upgrade on my iPhone since the iPhone would disconnect from the VM during the firmware upgrade process and the USB filters I had in place to pass through the iPhone to the VM would run into a race condition with the OS while it tried to mount the iPhone as a photo device.  This would end up leaving my iPhone as a brick (but upgraded) and I’d have to restore from backup and re-sync all my music, a process that would take up to 4 hours.  The last time I did an iPhone upgrade, I learned my lesson and did the upgrade from a Mac, no restores needed and I didn’t need to do any syncing after.

    With my new setup I was planning on doing all of my syncing in Windows 7, without having to worry about any issues with USB pass through or performance issues of doing the sync through a VM.  Once I got my Windows 7 install up and running, I installed iTunes and added my music to the library.  I went to go ahead and perform my first sync and noticed it began syncing then about 5 seconds later it would just finish.  I tried this a couple more times and noticed it was still not behaving right.  I figured I’d try to atleast backup my iPhone incase anything went wrong.  I began the backup process and went to go play some CoD MW2.  I came back an hour later and noticed no real progress on the backup of the iPhone.  I cancelled the backup process and then tried restarting the backup.  I let it sit for a couple of hours and it never completed.  Normally a backup will take maybe 10-15 minutes so I knew something was wrong.

    I began Googling and right away I came upon this thread on the Apple forums.  The thread described a varying amount of issues with Windows 7 64bit and iTunes syncing.  Issues with people having their iPhone not recognized to certain chipsets causing sync issues.  I tried jumping around the thread a bit looking for some simple answers related to my issues, but most of the solutions were geared towards BIOS updates.  After some more Googling I found a thread on one of the MS support forums (sorry I lost the link) where a representative from MS was actually contributing to the thread and seemed to be working with developers on a hot fix for the issues.  The thread talked about users with issues with USB hard drives and iPhone issues as well. Later in the thread MS eventually came up with a hot fix for the issue so I figured I’d give it a go.  The hotfix can be found here http://support.microsoft.com/kb/976972 .  I installed it and low and behold, it actually fixed my issue.  This is the first time I can remember downloading a hotfix for an issue I’ve had with Windows and it actually fixing the problem.  I’m now finishing syncing up my music to my iPhone which is syncing A LOT faster than going through a VM layer.  Hopefully someone will stumble across this blog post facing similar issues and it will solve their iTune woes.

    by justin at January 12, 2010 01:24 AM

    January 08, 2010

    Justin Lintz

    Yahoo Finance message boards

    … has to be the biggest waste of space on the interwebs. Clearly Yahoo doesn’t give a shit about them since they are not policed in the slightest and riddled with spam, trolls, and crazies. There are absolutely no insightful conversations going on for any stock. I wonder why they even bother keeping them around.

    by justin at January 08, 2010 02:32 AM

    January 06, 2010

    Nate Berry

    Linux on Airbus


    A friend coming back to the US from Europe this weekend snapped this photo for me on an Airbus 330 FinAir flight from Helsinki to JFK which shows the seat back monitors obviously booting Linux. It looks a lot like the RED Entertainment system which is a custom program running on top of Linux that Virgin America came out with sometime in 2007 and is discussed a bit on engadget. He’s pretty sure he saw the text “RED boot” flash by at some point. According to my friend, its a touch screen with an optional seat control module which is used to display “Movies, Documentaries, or (pre-recorded) TV programs, Games, or Audio programs on demand, serve as a Flight map and flight parameters monitor, provide Front and down cameras view, Shopping on board, and Telephone and text messaging services (with use of Credit Card terminal)”. One internet source I found suggested that “most inflight entertainment systems run Linux and have been doing so for the last 7 or so years”. Some makers include Panasonic Avionics and Thales Avionics.

    Booting Linux on Airbus 330

    by Nate at January 06, 2010 04:55 PM

    January 04, 2010

    Josef "Jeff" Sipek

    Change Ringing - The Mechanics

    A while back, I described the Trinity bell tower, and as I promised here is the follow up post that talks about change ringing itself. This post is going to describe the process of ringing a single bell.

    Let's start from the beginning. In a tower, there are several bells (12 at Trinity) of various pitches (tuned to make them sound pleasant).

    Trinity's Tenor

    Each bell has a head stock (red in the above photo), and a wheel for the rope. A person uses the rope to make the wheel turn, which in turn makes the bell itself move.

    The headstock and the bearings are designed in such a way that the bell can freely turn 360 degrees. This might sound unsafe, and it can be. So do not just assume that you can handle it without proper supervision. There is something called a stay, which prevents the bell from going more than ~380 degrees, but it is just a piece of wood - wood can (and does) break.

    The bells start off in the most unlikely position - up side down! That is, they open upward. When a tiny bit of energy is applied on the rope (by pulling), the bell goes off balance and thanks to physics, swings all the way around stopping more or less right at the top again. At some point during the swing, the clapper strikes the bell, and everyone in the neighborhood knows that someone is ringing.

    Here is a great animation that I found on the internet that shows exactly what happens:
    Change Ringing

    Now comes the hard part :) Since you have multiple bells, you can ring them in various orders. Suppose you label the treble as bell number 1, the tenor as 12, and all the other bells in the obvious way. You could ring them one at a time, one right after another (you want to have 12 people, one per bell). Easy enough, right? Well... go ahead an look at this video of some ringing at Trinity:

    What do you think? Pretty cool, eh? There isn't much time between each bell strike, and you want to make sure that you make your bell sound at the right time.

    You might have noticed that right before the end of the video, the pattern changed. More on this in the next post.

    What does it look like when the bells are moving? Well, there's is another video. This one is about how the bells were made, and all the other good stuff. It opens with a shot of the bells swinging around:

    Anyway, that's it for the mechanics of ringing a bell, you will have to wait for the next post to find out about the patterns. I will try to write it before the 2010 is over ;)

    by JeffPC at January 04, 2010 12:59 AM

    January 03, 2010

    Nate Berry

    Army Builder on a Mac and mobile output


    Army Builder is a windows program that helps you build an army for use in playing Warhammer Fantasy Battle that conforms to the rules of the game. This simple program took all the pain out of building my little Dwarf army and got me playing much faster – I highly recommend it. As there is only a Windows version of the program, I have to run it in a virtual machine (VM), but that has turned out to be a good decision anyway as we’ll see later.

    I only noticed today that the new Army Builder (3.2) has a mobile option which outputs an HTML page of your army list which can be easily read on mobile devices. You can click on the various topic headers to view the info that would normally be on the printed sheet at that point dynamically. Very cool – now only if I actually *had* a mobile device or cell phone that could display it! My current (Dwarf) army is only 1000 points, but I’ve been gathering some more figures lately in the hopes of getting it up to 2000 someday. You can see the current lineup (from a Christmas game with Ned) here.
    karakshall

    Army builder is a windows program. The folks that wrote the program are a very small company and there’s no hope for a Mac or Linux version (the two operating systems I use), so I decided to install it on a virtual machine instead. You can run out and buy software to run a virtual machine, but Sun makes one that you can use for FREE! Sun’s Virtualbox is easy to install (on any OS), easy to set up, and seems faster than some of the other VMs I’ve used. You do have to own a copy of Windows outright if you want to run a VM of Windows of course. The nicest thing about this choice for me was that if I decide to just run Linux on my next laptop (and not buy another Mac) I can easily install Virtualbox and load up my Windows VM with Army Builder already installed and as far as Army Builder cares it’s still on the same machine (although I don’t pretend to know the dirty details, Army Builder’s license seems to be tied to the machine it’s installed on through a hash of some kind made with information from the machine itself and the OS on it). Since the VM file (these can get large, mine’s currently 4.2GB) *is* the machine and the OS in one, Army Builder is none the wiser if I decide to run it on my Linux box instead.
    armybuilder-on-osx

    by Nate at January 03, 2010 03:17 PM

    December 29, 2009

    Josef "Jeff" Sipek

    Odin

    I finally decided that enough was enough, and I ordered the parts for my new server. This means that in the next week or two, I will be replacing the good ol' dual Athlon (see below for specs), with a shiny new quad-core Xeon.

    Current setup - baal:

    2x AMD Athlon MP 1800+ (1.533 GHz, 256 KB cache)
    2x 40GB IDE disk
    4x 512 MB
    1x e1000 Intel NIC

    New setup - odin:

    1x Intel Xeon W3520 Bloomfield 2.66GHz 4 x 256KB L2 Cache 8MB L3 Cache LGA 1366 130W Quad-Core Server Processor
    6x Kingston 2GB 240-Pin DDR3 SDRAM ECC Unbuffered DDR3 1333 Server Memory Model KVR1333D3E9S/2G
    6x Seagate Barracuda 7200.11 ST31500341AS 1.5TB 7200 RPM 32MB Cache SATA 3.0Gb/s 3.5" Internal Hard Drive
    1x SUPERMICRO CSE-743T-645B Black 4U Pedestal Chassis w/ 645W Power Supply 2 External 5.25" Drive Bays
    1x SUPERMICRO MBD-X8STE-O LGA 1366 Intel X58 ATX Intel Core i7 Intel Motherboard

    I've "stolen" some images of the case from NewEgg:
    Odin's SuperMicro case
    Odin's SuperMicro case

    Baal gives me about 40 GB of disk space (I use RAID 1 across the two drives). Odin will give me about 6TB (RAID 6). This will finally allow me to do a few things I wanted to do for a while; one such thing is to provide a Hercules image with Linux set up to do HVF development.

    by JeffPC at December 29, 2009 09:01 PM

    December 21, 2009

    Tom "supertom" Melendez

    My Todo List Search

    Having gone through some GTD training recently, I set out on my hunt for the best todo list system for me. First off, let me say that I’m not a GTD purist by any means and in fact have been doing something that somewhat resembles GTD for a few years now, but I certainly [...]

    by SuperTom at December 21, 2009 05:53 AM

    December 12, 2009

    Josef "Jeff" Sipek

    Spiral

    From 3 days ago:

    This morning in arctic Norway, onlookers were stunned when a gigantic luminous spiral formed in the northern sky. Veteran observers accustomed to the appearance of Northern Lights say they have never seen anything like it. It was neither a meteor nor any known form of atmospheric optics. Rumors that the spiral was caused by the botched launch of a Russian rocket have not yet been confirmed.

    Spiral
    (original)

    by JeffPC at December 12, 2009 08:33 PM