Archive for January, 2009
Need a Zen-Cart Customization, PHP, or Flex Programmer?
by Tony on Jan.19, 2009, under Uncategorized
Update 20090225: I am no longer offering these services.
Yeah!
Debian Etch on ThinkPad T20 T21 T22 with cs46xx sound card and custom kernel
by Tony on Jan.18, 2009, under Uncategorized
So I’ve been trying to put Debian Etch on my Thinkpad T20 that I have. It doesn’t have an LCD screen, so I am going to use it as an mp3 “server” type of computer - possibly for my car. It’s been quite a process. My first problem was that my particular Thinkpad didn’t have on board lan, so the net install cd that I was using couldn’t get an Internet connection. I thought this was going to be a problem, but after some experimentation it turned out to be a good thing (Debian has some issues with PCMCIA wireless card drivers getting an IP address correctly from a DHCP server I guess).
I had some network card issues with a PCMCIA wireless network card that I have, but I figure those issues aren’t related to the ThinkPad, so I’ll leave them off of this post.
Instead, I’ll talk about the sound card that the T20 has. (This also applies to the T21 and T22 I believe.) The Thinkpad T20 has a Cirrus Logic sound card that uses the cs46xx module. This module is built into all new linux kernels - except one tiny catch: Debian’s kernels don’t have it enabled (I believe for license reasons). This also means that even if you try to compile an ALSA module for it, it wont work - it will say that your kernel has ALSA support built in already. So - you have to recompile the kernel and enable this specific module to get it working. That really sucks - I know. But, I’ve already done the work for you - and here are the debian packages:
Linux Kernel Image File - 2.6.24.1-etchnhalfwithcs46xx (deb)
Linux Kernel Header File - 2.6.24.1-etchnhalfwithcs46xx (deb)
To install these files, simply copy them to your /usr/src/linux directory and then run the following commands as root:
dpkg -i (image file name)
dpkg -i (header file name)
Then simply reboot and your new kernel will be installed and selected as default in Grub - and you’ll have sound (you’ll also need ALSA installed of course).
Please don’t post linux questions in the comments, as I am fairly new to linux my self and I wont be able to help you. But this is my solution for getting sound to work on a ThinkPad T20 with Debian Etch - results that took me many hours of work to figure out. I hope it helps someone out - even though the T20 is SUPER old!
Flex Browser Manager, URLUtils, and modules.
by Tony on Jan.09, 2009, under Flex
My recent experience with the Flex Browser Manager and the URLUtils class and modules has been a long and anoying one… but I think I almost have it!
I know now that part of my troubles is the way my application is written - not poorly, but it makes passing url variables to modules complex as they load at different times.
Here is what happens:
The main application loads and parses the url from the browser. It then deals with any passed variables. At the same time, it gets a list of modules to load from the back end, and then loads them. Unfortunately, this process takes about 500ms to 1000ms longer - so I have all of this data, and no modules loaded to pass it to.
That in it self, is not a problem. I can just cache the data. But my data cache waits for the modules to load, then then sends the data. Well - after the modules load, then they load their own data from each other. So, by the time they are actually ready for the url variables, it’s already been sent and failed because they were not ready when it was sent.
I don’t have an easy solution for this - I could rewrite lots of code to make it work differently, but I think that this is a poor reason to rewrite the code. I can’t think of many other reasons to rewrite the code this way, so I think that it might be easier to find a hack for the url variables instead of rewritting hundreds of lines of code to work with them.
So, my solution has been to not parse the url when the main application starts. Instead, I wait for the modules to load, and then I parse the url. This way, I only have to cache the data for a few seconds at most, and all is well.
Also, since I have many modules that might or might not be loaded, each with their own information that needs to be in the url, I needed a uniform way to put these variables in the url. So I came up with the following standard:
http://www.site.com/application.html#ModuleName1=(data.data.data);ModuleName2=(data.data.data);
I use the ModuleName=(); part to seperate out each modules data. The URLUtils class has a String to Object function (strToObject I think) that can easily parse a string into an object. It uses the ; character by default, so that seemed good enough to me to use. So it would parse the url above into the following object:
{”ModuleName1″:”(data.data.data)”, “ModuleName2″:”(data.data.data)”}
So, then I wrote a simple function to parse that object into an array that I pass to each module. It parses the string “(data.data.data)” and puts each data chunk into an array element. So this array is what gets passed to each module:
["data", "data", "data"]
The functions in my main application take it no further then thata. Each data chunk can be ANY url encoded characters. (Although I haven’t written the code to url encode and decode them yet, I still have to do that.) So it is up to the modules to specify a data format that they can handle for their data chunks. Since I am the only developer, I decided to make all of my modules parse the following data chunk standard:
[adata, adata, bdata, bdata, bdata, cdata]
What that means is each data chunk starts with a single letter. This is to so that I can simply write a switch block to look for the first letter and deal with the data that way. As I said above, this isn’t needed, and each module can do whatever it wants - but this is the way I do it just to make it easier for my self.
So, here is an real example of a url that my application uses:
http://www.site.com/mainapplication.html#SearchTools=(a16.a17.o17);MediaPlayer=(s16.t3);
Here is what that url means:
The SearchTools module gets three data chunks - a16, a17, and 017. This tells it to set three search categories - two add categories and one only category. I’ll explain that is a later post.
The MediaPlayer module gets two data chunks - s16 and t3. This tells it to load song 16 and track 3.
I could also pass the MainApplication data in this same format.
So there you have it - a somewhat simple url format that an application can use to send data to it’s modules.