Akom's Tech Ruminations

Various tech outbursts - code and solutions to practical problems

Code and Hacks Upgrading Belkin F5D7231-4 v2000 router to dd-wrt firmware

Posted by Admin • Monday, November 23. 2009 • Category: Code and Hacks

As the dd-wrt hardware database claims that this router is supported, I was happy to attempt this installation. Only the micro edition will fit on its tiny 2MB of flash. The dd-wrt page suggests that only tftp flash procedure will work, and so I grabbed their tftp.exe - to no avail. This router seems to have a lot of upgrading threads dedicated to it, but most of the How-To's I was able to find did not work for me. Some said that in order to get the firmware to load on this device you need to catch the perfect second during its reset cycle where the ping TTL's (you have to ping it) are 100, and launch the tftp upload at that exact time. I was never able to achieve any part of this.

Fortunately after nearly giving up I found this thread which offers alternate (windows only) utility called "Sercomm" to load an alternate (I'm honestly not sure where it came from) .bin image onto the router - I can only assume that it's the dd-wrt image converted to sercomm format. The image you get from dd-wrt will not work with this loader. I loaded this yesterday (2009/11/22) and got the latest (dd-wrt v24 SP2) on my router, and it even works great (so far).


That said, there is one caveat to the instructions provided in the Readme.txt file: I first loaded the dd-wrt image (two are provided: dd-wrt and original Belkin), and the router failed to reboot or respond. I then loaded the Belkin image, it worked correctly as per instructions. Then I was able to load the dd-wrt image successfully. Naturally the IP address changed to 192.168.1.1 instead of 192.168.2.1

Linux Disabling X server autostart (gdm) on Ubuntu Karmic (9.10)

Posted by Admin • Monday, November 16. 2009 • Category: Linux

There are many reasons one may wish to do this - running their desktop installation as a sever (temporarily perhaps), solving some video issues... or just doing it to get that facet of control back. I, for instance, prefer to run X with "startx" when I'm ready to do so. I do not enjoy a black screen when the latest intel video driver doesn't work - I'd rather Ctrl-Alt-Backspace and fix it.



Anyway, so Karmic (and apparently certain installs before Karmic, as well) uses an init system called "Upstart". If you've tried messing with update-rc and noticed that disabling /etc/init.d/gdm doesn't work, this is why. Oh sure, you can run /etc/init.d/gdm stop, but it's only temporary, assuming that works for you at all - for me it does not - my console does not recover and I get a black screen.



To get it to stop permanently the proper way is apparently to work with upstart. You'll notice some definitions in /etc/init (no, not /etc/init.d). These work somewhat like the Gentoo init.d scripts - you can define dependencies, events, phases, etc. So looking at /etc/init/gdm.conf I see:

Continue reading "Disabling X server autostart (gdm) on Ubuntu Karmic (9.10)"

Linux Upgrading to Ubuntu 9.10 Karmic Koala breaks X (xorg) on intel driver on 945G chipset

Posted by Admin • Monday, November 2. 2009 • Category: Linux

After upgrading my IBM desktop with "82945G/GZ Integrated Graphics Controller" X stopped working entirely, regardless of any changes to xorg.conf. Running startx manually revealed an error like this:



(EE) Failed to load module "i810" (module does not exist, 0)
(EE) open /dev/fb0: No such file or directory
(EE) intel(0): [drm] Failed to open DRM device for : No such file or directory
(EE) intel(0): Failed to become DRM master.



Took me a little while to figure out how to get me my machine back:

Continue reading "Upgrading to Ubuntu 9.10 Karmic Koala breaks X (xorg) on intel driver on 945G chipset"

Linux Backing Up Google Docs automatically from Linux

Posted by Admin • Monday, October 26. 2009 • Category: Linux

I'm not quite sure why a working example of doing this is so hard to find!

As far as I can tell, at the time of this writing there are two choices of ready-made (and free) apps that do this: GDocBackup and php-google-backup, a tiny php script (on google code) that uses Zend libraries. The former is a windows binary and is said to run in Mono. The latter is a php script which currently partially works (can't handle spreadsheets or PDF's). Not wanting to run Mono (an emulator - I might as well write this in Java), and not satisfied with only backing up .doc's and presentations... I hacked up my own.

Here is how I did it

Continue reading "Backing Up Google Docs automatically from Linux"

Linux Getting Pidgin to sign off when you lock your screen

Posted by Admin • Wednesday, October 14. 2009 • Category: Linux
I am signed in to google talk from many places - blackberry, laptops, desktops, etc - and every once in a while, IM's don't go to the right one. Since I lock my workstation at the office whenever I get up, I figured it'd be nice to have Pidgin log off at the same time.

I am not sure how you would do this in Windows, but in Linux (Ubuntu in my case), I did it like this:

Changed my screen lock hotkey (Ctrl-Alt-l for me) to run the following:
xlock -startCmd "purple-remote setstatus?status=offline" -endCmd "purple-remote setstatus?status=available"
That's it. If you want specific screensaver modes you can stick them in them too:
xlock -mode blank -startCmd "purple-remote setstatus?status=offline" -endCmd "purple-remote setstatus?status=available"

Update: July 2012


Ubuntu has a broken version of xlock (1:5.31-1) which gets the BadMatch (invalid parameter attributes) error. I switched to using slock from "suckless-tools" package, like so:
bash -c "purple-remote setstatus?status=offline ; slock ; purple-remote setstatus?status=available"

Interestingly, after running slock, xlock works too.. it's actually related to dpms: If you run xset +dpms, xlock will work (once).
You can adjust the xlock version for this bug as follows:
xlock -mode blank -startCmd "xset +dpms ; purple-remote setstatus?status=offline" -endCmd "purple-remote setstatus?status=available"


PS: Doing this in openbox:


<keybind key="C-A-l">
        <action name="Execute">
                <startupnotify><enabled>true</enabled><name>Run</name></startupnotify>
                <command>xlock -startCmd "purple-remote setstatus?status=offline" -endCmd "purple-remote setstatus?status=available"</command>
        </action>
</keybind>
 

Linux Fixing freezing and no sound youtube and flash on ubuntu

Posted by Admin • Monday, September 28. 2009 • Category: Linux

Problem:


I've had this issue for many months but obviously I don't use flash enough to really figure it out. The first few youtube videos would play, but with no sound. If you seek back and forth, or play sound from another player (eg audacious), you may get skipping sound for a little while. Eventually the whole player stops advancing, though you can still seek.

Solution:


<

ul>

  • You may have installed a dozen version of flash by now. As long as they are all ubuntu packages, you can leave them all installed (or you can remove them all)
  • Install the official release from adobe: Adobe Flash, current version is 10. Pick .deb format for the download.
  • Now run sudo update-alternatives --all
    ... This will ask you for all alternatives there are for your system, but among them there will be 5-10 flash-related questions for each browser (including text browsers, apparently). Pick the newly installed adobe-flashplugin like so:

      There are 2 alternatives which provide `mozilla-flashplugin'.
    
      Selection    Alternative
    -----------------------------------------------
    *+        1    /usr/lib/flashplugin-installer/libflashplayer.so
              2    /usr/lib/adobe-flashplugin/libflashplayer.so
    Press enter to keep the default[*], or type selection number: 2
    

  • Bounce Firefox and you should be all set
  • <

    ul>


    Software Mixing

    Once I got this fixed up, I now had reliable flash playback with one little problem... There was still no sound half the time - if another audio application grabbed my sound card before firefox (eg rhythmbox). Took me a while to figure out what to search for (usually the biggest issue, right?). Apparently the issue is twofold:

    1. My onboard sound card either doesn't do hardware mixing, or the drivers don't support that
    2. Alsa should have figured that out, and turned on Software Mixing, but for some reason it doesn't do that in Ubuntu

    Once I understood this, I used This page to help me out. Grabbed their ~/.asoundrc, restarted all the audio apps, and all seem to be sharing the sound card peacefully now.

    Code and Hacks Locked myself out of pfSense

    Posted by Admin • Saturday, September 26. 2009 • Category: Code and Hacks

    I was experimenting a bit with pfSense 1.2.3rc1 as a replacement for a WRT54G router today.


    So I set did the following, among many things:

    1. Switched web configurator to SSL (443)
    2. Turned on reflection (applies NAT port forwarding rules to local LAN)
    3. Set up NAT port forwarding, which includes port 443 to one of my servers (which isn't up at the moment)



    Guess what? Can't access webconfigurator.... an hour of being very confused later... I get it. All my SSL requests for webconfigurator are now being sent to the nonexistent internal NAT-ed server! I can't get back in, and reboots don't help!

    Fixing this is not too hard. Log in (SSH or console) and edit /conf/config.xml

    <webgui>
        <protocol>https</protocol>
    


    Now just change to http. (If you're not running off hard drive, you may need to save directly to your floppy.) Obviously changing this will prevent you from using reflection from a NAT-ed server on port 80 now :-)



    NOTE: you may need to "rm /tmp/config.cache" to clear out config cache, and restart web configurator from the menu.

    RV Getting RV Solar and Shore power to coexist nicely

    Posted by Admin • Tuesday, August 4. 2009 • Category: RV
    I have an RV (20' Sunline T1950 travel trailer) Yay! Like most, it came with a tiny battery (23Ah @2.5hour rate??) and a Power Converter (Centurion 3000) which doubles as a battery charger, but it's hardly a good one - it's not even a 1-stage (that would be just bulk charge) - instead it is a float-only 13.1V power supply. Charging a sizeable battery using a float charger would take a very, very long time (and is hardly good for the battery). According to documentation it's supposed to output 13.4V but I guess it's +/- 0.5V :-)

    My primary interest is in boondocking (dry camping) so for me battery performance is of utmost importance. This means good battery utilization, and good battery charging when charging can occur. Stock, the RV does neither.

    First thing I managed to do was to secure a small solar system including a Solar Charge Controller (got an awesome deal on Craigslist). It's 100 watts and the CC is a 2 stage (absorption and pulse-float), 15 Amp unit (Mark PV 15). My first question was of course... how do I hook it up to the existing electrical system without causing problems?

    Continue reading "Getting RV Solar and Shore power to coexist nicely"

    Low Tech Hacks Installing two cameras in one vehicle (rear view) with one display

    Posted by Admin • Monday, July 27. 2009 • Category: Low Tech Hacks

    Now that I acquired a travel trailer, it was a matter of utmost importance to install a rear view camera on it to ease the process of backing it up. I already have a rear view camera on my van, hooked up to my head unit which happens to have a rear camera input. So the next question is - how do I hook up two camera?



    I don't want to give up the one I use all the time in favor of the occasionally used trailer cam. What am I to do? So I had to figure it out.

    Continue reading "Installing two cameras in one vehicle (rear view) with one display"

    Low Tech Hacks Changing Manual Transmission Fluid in a Scion tC

    Posted by Admin • Saturday, April 11. 2009 • Category: Low Tech Hacks

    The goal is to replace the stock (assumed: mineral oil) transmission fluid with Amsoil synthetic. Amsoil is my personal preference, while synthetic is my maintenance goal. I set out to do this as our vehicle was approaching 60K miles... OK so I meant to do this about 60K miles ago, but better late than never. The car is now 3 years old (exactly).



    There isn't anything too difficult about this job, but when I got under the car I discovered a filler bolt labelled "Consult Owners Manual Before Refilling"... now I've done a fair share of work, but this looked suspicious. So I set out to investigate.

    Continue reading "Changing Manual Transmission Fluid in a Scion tC"

    Code and Hacks Creating A Basic Date Dimension Table in MySQL

    Posted by Admin • Monday, March 23. 2009 • Category: Code and Hacks
    After some searching I determined that nobody wants to share ...

    So I had to sort it out myself - the result is a pretty basic stored procedure you can call whenever you like.

    Continue reading "Creating A Basic Date Dimension Table in MySQL"

    Code and Hacks Turning the Iphone 3G into an almost useful always-on IM device

    Posted by Admin • Saturday, March 14. 2009 • Category: Code and Hacks

    I've had a Blackberry for quite some time now, and came to take for granted the basic ability to be always available via Google Talk, Latitude, email, etc - not to mention have fine-grained control of when I get notified about each one. Running multiple apps (gtalk, maps, ssh, browsers, etc) - was never a problem, and there is even an Alt-Tab equivalent for toggling between running apps. Blackberry even has an integrated push-IM system for Blackberry to Blackberry communication.



    All that changed with the IPhone (if it was not paid for, I would never have gotten one, but now I'm trying to make the most of it while saving the money I used to spend on the Blackberry). The IPhone (3G, 2.2.1) proved to be unable to do any of the above well. No mail alerting rules, no running multiple applications !!?? Basically this is an always-on device that cannot provide most always-on services. So this is my quest to make the device useful.



    Yes naturally I realize that there are downsides to both devices, and I gladly give credit to the IPhone UI, but personally I'd rather deal with a command-line UI if I had to choose between functionality and having a fancy but incapable toy.

    Continue reading "Turning the Iphone 3G into an almost useful always-on IM device"

    Asterisk My Not So Great Experience with Grandstream HT-502 ATA

    Posted by Admin • Friday, March 13. 2009 • Category: Asterisk

    I got 3 of these Grandstream HT-502's for a client's Asterisk setup, and I picked Grandstream basically because they were cheap (client on a budget) and I found no bad reviews. They were ordered February 2009.



    First impressions: They are tiny, like two EZ-Passes stacked on top of each other. They are cute, and have all the features you'd expect or even desire in such a device: Dual WAN (routed or bridged, with port forwarding), two FXS ports, some status LEDs, remote configuration and pull provisioning, syslog support, etc.



    Well that was the good news...

    Continue reading "My Not So Great Experience with Grandstream HT-502 ATA"

    Code and Hacks MySQL Master-Master Replication over a Secure Stunnel Connection (SSL)

    Posted by Admin • Saturday, February 7. 2009 • Category: Code and Hacks
    I threw this together because I had to figure it out myself. I found info on how to setup master-master, and I found info on how to set up MySQL replication over stunnel. But master-master over stunnel turned out to be a little different. Not much, but here it is.

    First of all - I won't go into the steps for setting up Master-Master itself - that's very well documented. Let's assume that you can convince one of your mysql's to slave off the other, and vice versa. (I used this page as a guide).

    With that accomplished, let's assume that the boxes are not sitting next to each other but are in separate colo's or offices, and have some insecure internet to go between them (or maybe you don't even trust the local LAN). Yes, MySQL does have built-in SSL stuff, but so far the consensus is that it's rather difficult to work with. Moreover, I am more willing to trust stunnel (just my feeling on it).

    Why not use ssh? Using something like ssh -n with a for loop that restarts it just doesn't sound enterprise-grade. I want something that actively reconnects when needed, based on active usage, and is actually intended for this. I still use SSH for port tunnelling all the time, but those are short-lived tunnels for my own personal use or debugging.

    So our goals are: Secure transport and identity validation. Here we go.

    Continue reading "MySQL Master-Master Replication over a Secure Stunnel Connection (SSL)"

    Asterisk Data Warehousing and Metrics with Asterisk PBX

    Posted by Admin • Sunday, February 1. 2009 • Category: Asterisk

    An Asterisk installation I am doing for a client has the promise of two interesting developments in the near future:



    1. Writing a CDR/Voicemail status-tracking application that makes sure that all client voicemails are handled within one hour and keeps track of what was done
    2. A future custom metrics/data warehouse implementation that will use both the CDR and VoiceMail data


    With that in mind (and the fact that I'm using Mysql master-master replication across offices) I looked into storing the voicemails in the database as well. This is fairly well-documented. I had this up and running in no time, and now for each voicemail I have a neat row in my MySQL table.



    The problem is - how do I connect the row in CDR table to the matching voicemail row? There are no columns that have data to allow you to do match one to the other. Even timestamps, if you were so desperate, are not exactly the same! So this is how I did it.

    Continue reading "Data Warehousing and Metrics with Asterisk PBX"