Our minds cannot repel logic of that magnitude!
Computing
Flex 3: Forcing Numeric Sort of XML Data in a Data Grid
Nov 20th
Recently I’ve ran into some problems with AdvancedDataGrids in Flex with data loaded from a hierarchical data provider built from an XML object. When you try to sort on a column with numeric values, the data grid does not sort the values numerically. Instead it sorts them lexicographically. This is because Flex 3 treats all the attributes of an XML node as strings. So if you have an/some attribute(s) that is numeric amongst all of your nodes, Flex treats these as strings when sorting. It is apparently not smart enough to realize that the values are numeric and should be sorted as such.
Unfortunately, Flex doesn’t appear to provide an easy way to say that a certain column contains numeric values. A simple attribute of the AdvancedDataGridColumn element called valueType or something along those lines that you could simply say valueType=”Number” would be incredible, but that functionality does not exist. So what you have to do is write a sortCompareFunction for each of these columns. Well, if you have a bunch of different columns you would usually have to write one sortCompareFunction for each column.
That could get tedious and time consuming. Instead, declare the following function:
private function xmlDataGridNumericSorter(field:String):Function { return function (xml1:Object, xml2:Object):int { var diff:Number = ((Number)(xml1.attribute(field)) - (Number)(xml2.attribute(field))); return (diff > 0) ? 1 : ((diff < 0) ? -1 : 0); } }
What this function does is return a compare function that would compare the values of two XML node’s attribute (field:String). So what you do from there forth is loop over your columns that are numeric and do the following to each column, referenced in the example as col:
col.sortCompareFunction = xmlDataGridNumericSorter(col.dataField);
After that each of the columns you modified in this way will have a sortCompareFunction built to compare two XML nodes’ respective attributes numerically. Keep in mind with the above code that if your column’s dataField is prefixed with an at sign (@), which it very well should since you’re probably referencing an XML attribute, you will need to remove it when you are passing the dataField into the xmlDataGridNumericSorter function by adding .replace(“@”,”") after col.dataField.
I hope this helps people as much as it has helped me in the past few weeks!
A Simple Flex IRC Client
Nov 18th
For those of you who use Adobe Flex and IRC, the simple IRC client written in Flex that I use on The Brew Place is now available on Google Code and is released under the MIT License! Check it out here:
http://code.google.com/p/simpleflexirc/
More Adobe Flex and other projects are expected to make the migration to Google Code within the next few weeks, so keep yourselves posted!
Colloquy Mobile and ZNC – pushing even when I’m connected?
Aug 26th
Okay, so I recently picked up Colloquy Mobile for my iPhone so that I could stay connected to my IRC channels while I’m on the go. Now, since I do not own a mac (unfortunate, I know) I cannot run Colloquy itself, so using my desktop to send push notifications to my iPhone was not going to happen. As a result, I decided to set up a ZNC Bouncer and use the push module for ZNC that Colloquy provides. Everything went well, but I found one problem – even if I had my desktop machine connected to ZNC the module pushed notifications to my iPhone. That wasn’t cool. If I have some desktop IRC app connected to ZNC, I don’t want push notifications to my iPhone. So what did I do? I was a good programmer geek, and decided to make some mods to the module in order to get it working the way I wanted it to. Here’s what I came up with:
In colloquy.cpp (available here without my modification) around line 506, find the Push function:
bool Push(const CString& sNick, const CString& sMessage, const CString& sChannel, bool bHilite) { bool bRet = true; vector<CClient*>& vpClients = m_pUser->GetClients(); // Cycle through all of the cached devices for (map<CString, CDevice*>::iterator it = m_mspDevices.begin(); it != m_mspDevices.end(); it++) { CDevice* pDevice = it->second;
After the vector vpClients line, at about 510, add the following:
if (m_pUser->IsUserAttached()) { return false; }
The result should be the following:
bool Push(const CString& sNick, const CString& sMessage, const CString& sChannel, bool bHilite) { bool bRet = true; vector<CClient*>& vpClients = m_pUser->GetClients(); if (m_pUser->IsUserAttached()) { return false; } // Cycle through all of the cached devices for (map<CString, CDevice*>::iterator it = m_mspDevices.begin(); it != m_mspDevices.end(); it++) { CDevice* pDevice = it->second;
After making those mods, simply build the module, load it, and you will no longer receive push notifications when a client is attached to your ZNC bouncer! If you do not wish to modify the file yourself, it can also be downloaded from here: www.jonnyfunfun.com/pub/code/colloquy.cpp
FilePirate Alpha Test at GPA’s Gameday
Jun 17th
For those of you who have been following the development of FilePirate – Advanced LAN File Sharing, you will be happy to know that we will be engaging in an alpha test of the application at GPA’s Saturday Gameday this month. The LAN is on Saturday, June 27th at noon, located at the GPA clubhouse in Silver Creek. Those who wish to attend their event should sign-up on their webpage at www.gameplayersanonymous.com‘. If you are going to be attending and wish to help assist in the testing of FilePirate, please let me know ahead of time so that I may get an accurate count and some expectations on testing.
Windows 7 Woes
Feb 16th
After a successful install of the Windows 7 Beta (32-bit) on my wife’s Toshiba Satellite notebook, I decided to undertake the install of the 64-bit version of Windows 7 Beta on my desktop – which is a home-built machine with an AMD Athlon 64 X2 5000+, a Sapphire ATI Radeon HD3850 graphics card, 4gb of memory, and over 2TB of storage. The install went fine, and was very simple after I got over trying to back up 126gb worth of documents and music. Apparently I need to add another hard drive to my 1.5TB RAID-5 array, as there is only 12.1gb free. As a result, I got smart and moved my documents to their own separate 200gb partition on my 750gb system drive. Luckily, from here on out, I won’t have to worry about backing them up when I wipe the windows partition.
Anyways, so it goes through installing, works just great, comes up with the “preparing to start Windows for the first time” screen, and then it hits me. BSOD in t3h face. Apparently, I suffer from a common problem with certain ATI Radeon HD cards and the drivers that the Windows 7 Beta ships with. The BSOD came up with a fault regarding resetting the display driver and its inability to respond in a certain amount of time (stop 0×116 from the file atikmdag.sys). Supposedly, the work-around includes doing a very basic install of Vista, installing the latest Catalyst beta drivers, and then performing an upgrade to Windows 7. That’s fine and dandy, but I don’t have a Vista x64 disc and nor do I have the urge to download it simply to install a beta operating system that is going to cease to function on August 1st anyways.
Great job, though, Micro$oft in your inability to create a beta for the “latest and greatest” of your operating systems that works fine for the 50% or so of the population that uses ATI cards. For those of you who have ATI cards, specifically any of the Radeon HD series, don’t try performing a straight-up install of Windows 7. Instead, save yourself the trouble, and upgrade an already working Vista/XP install with the Catalyst beta drivers.

















































