Welcome to my blog! Feel free to post comments.
- Andrew


Visit Coldfusion Community


<< May, 2008 >>
SMTWTFS
123
45678910
11121314151617
18192021222324
25262728293031
Search Blog

Categories
Archives
RSS


Powered by
BlogCFM v1.14

Dealing with Russian Spam in Google Mail aka Gmail
16 May 2008
In a day where spam is an increasingly huge issue, I have been using Google's email which does great at spam filtering.  There is of course once major exception, and that is Russian or Cyrillic spam emails.  Google's filters don't seem to be able to block those emails, and if you have had an account as long as I have, the volume of spam is bad.  I was getting 50-100 Russian spam emails every day.

I have experimented and come up with a solution using Google's filter feature.  It has taken several tries to get the right settings to actually be effective.  Here is how to rid yourself of the bad Russian spam!

  1. Log into your account in Gmail
  2. In the upper right part of your screen, click on "Settings"
  3. On the settings page, click on the "Filters" heading
  4. Click the "Create a new filter" link
  5. In the "Has the words" box, copy and past in the contents from this Microsoft Word document (I tried to paste the actual characters here, but they got all screwy)
  6. Click the "Next Step" button
  7. Choose how you want to handle them (I have it skip the inbox, and apply a custom label, this way I can go back and actually flag those messages as spam later)
  8. Click on the "Create Filter" button to save the changes!
This has really worked well for us, eliminating about 90-95% of the Russian spam.  If you find any "tweaks" to this are effective, let me know.
Posted by aschwabe at 8:34 AM | Link | 0 comments


Dispatching custom events from a Flex Module
29 April 2008

I have been working to make my Flex applications more and more modular.  Flex now supports modular development with the ModuleManager so you can dynamically load and unload modules at runtime.

There is reasonably good documentation online for how to load and unload basic modules, and even how to set public vars and call public methods defined in modules after they are loaded.  There were not, however, any examples (that i could find anyway...) for having a module dispatch a custom event class, so that your application can catch and respond to the event. 

Here is a basic outline of an app, a custom event class that stores some bits of information, and a module that demonstrates dispatching the custom event class:

The main Flex app "SimpleModuleEvents.mxml" :

<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
 creationComplete="initApp()"
 layout="absolute">

 <mx:Script>
  <![CDATA[
   
   import mx.controls.Alert;
   import net.schwabe.demos.CustomEvent;
   import mx.modules.*;
   import mx.events.ModuleEvent;
   
   public var myModuleInfo:IModuleInfo;

   private function initApp():void
   {
    // load our module (but don't display yet)
    myModuleInfo = ModuleManager.getModule("modules/Dispatcher.swf");
    myModuleInfo.addEventListener(ModuleEvent.READY, displayModuleHandler);
    myModuleInfo.load();

    // start listening for our custom event.
    addEventListener("customEvent", handleCustomEvent);
   }

   /* Runs when the module is finished loading and is ready to display */
   private function displayModuleHandler(event:ModuleEvent):void
   {
    myPanel.addChild(myModuleInfo.factory.create() as DisplayObject);
   }

   /* runs when the custom event is caught */
   private function handleCustomEvent(event:CustomEvent):void
   {
    Alert.show("received event with data: " + event.myNumber + "=" + event.myString);
   }

  ]]>
 </mx:Script>
 
 <mx:Panel id="myPanel" width="300" height="300">
 </mx:Panel>

</mx:Application>

The module "Dispatcher.mxml" :

<?xml version="1.0" encoding="utf-8"?>
<mx:Module xmlns:mx="http://www.adobe.com/2006/mxml" layout="vertical">
 <mx:Script>
  <![CDATA[
   
   import net.schwabe.demos.CustomEvent;
   
   private function doEvent():void
   {
    var myEvent:CustomEvent = new CustomEvent('customEvent',42,'The answer to all life and everything');
    parentDocument.dispatchEvent(myEvent);
   }
   
  ]]>
 </mx:Script>
 <mx:HBox width="100%" height="100%" horizontalAlign="center" verticalAlign="middle"> 
  <mx:Button label="Dispatch CustomEvent!" click="doEvent()"/>
 </mx:HBox>
</mx:Module>

The custom event class:

package net.schwabe.demos
{
 import flash.events.Event;
 
 public class CustomEvent extends Event
 {
 
  public var myNumber:Number;
  public var myString:String;
 
  // constructor
  public function CustomEvent(type:String, myNumber:Number, myString:String)
  {
   super(type);
   this.myNumber = myNumber;
   this.myString = myString;
  } // end constructor
 
  public override function clone():Event
  {
   return new CustomEvent(type, myNumber, myString);
  }
 
 }
}

Hope this is helpful, as it is a very bare bones explanation of how to modularize your code and use custom event classes to pass around useful data. 

Ciao

Posted by aschwabe at 1:04 PM | Link | 0 comments

DRM: Spiral Frog + AnalogWhole + Itunes = free music for ipod and iphone
20 April 2008
There have been some nice new "advertiser sponsored" free music sites to pop up over the last few years.  One of the most promising is Spiral Frog (http://www.spiralfrog.com).  The downside to pretty much all of them has been that songs downloaded from these sites are digital rights managed (DRM) which is used to ensure that only licensed users can listed to the files.  Basically once you download one of these songs, you can't email it to your friend and let them listen -- they will get a license error.

This technology for digital rights management is essential so that the already struggling music industry doesn't lose what little money it is making.  It used to make a killing on CD sales, but not anymore thanks to illegal music distribution online.

So, the upside to DRM is that you can't give illegal copies to your friends.  The downside is that if you use a service like Spiral Frog (which uses Microsoft Windows Media Player for DRM and playback), then you cannot put those files on your iPod or iPhone.  Hey, the technology isn't perfect... YET.

There is a solution! (you knew i was going there, right ?)  This requires you to be a morally responsible person however, and any "gray" areas on this are up to you to decide on.  I am not, in any way, endorsing this information, I am only providing it as a public service.

There is a nifty open source product called AnalogWhole (http://analogwhole.com) which removes DRM from your windows media audio files (it doesn't support video at this time).  Once you configure AmalogWhole, it will watch your incoming folder for new music files, and automatically convert them to plain MP3 files _AND_ add them to your iTunes music library (f you want).

AmalogWhole isn't a perfect program yet -- it actually plays back the original, and does a digital recording to a new audio file, so the speed is 1-to-1, your computer has to play back each file.  It is a little quirky in that your volume level of your speakers (from within windows) affects the recording level, so it takes a little experimentationi.  After all the effort however, what you end up with is a clean MP3, automatically added to your iTunes library, ready to sync to your iPod and it sounds pretty good.

Once you have a process down like this, it allows you to take advantage of advertiser-sponsored free music sites like SpiralFrog, and then also add that music to your portable audio player, just as we _should_ be able to.  All it requires is discipline to not distribute those unprotected audio files, and thus making the music industry we all love collapse on itself.  You can do that right ?

Ciao, and stay LEGAL !
Posted by aschwabe at 12:00 AM | Link | 0 comments

CFUnited Europe 08 in London!
26 March 2008

I am finally back in the office after CFUN Europe (and some travelling afterwards).

My apologize to all those who have been asking about my presentation files.  They are posted below.

cfun_europe_08_recursion.zip

cfun_europe_08_xml.zip

Overall I thought CFUN Europe was very successful.  There were a lot of presentations on CF+AJAX, and a lot of focus on integration between CF and Flex -- very valuable stuff for any CF coder.

If you missed it, you should plan to come to CFUN in Washington DC on June 18-21. See www.cfunited.com for more info.

Posted by aschwabe at 12:00 AM | Link | 0 comments

Flex Multiline Text / Code Editor with Line Numbers
18 February 2008

I found myself needing a text editor that displayed line numbers for a Flex project, and despite searching online, couldn't find a Flex 2 component that did what I wanted.  So like a good programmer, I whipped one up. 

Here it is, in all its buggy glory.  I would love some feedback, and perhaps some of you Flex gurus would like to contribute.  If so, e-mail me.

 

Posted by aschwabe at 5:21 PM | Link | 0 comments

<cfpresentation> error on multiserver coldfusion install
Reports missing viewer.swf
17 February 2008
On a clean multiserver install of ColdFusion 8, I was surprised that <cfapplication> was throwing an error.

The error I was getting was:

An error occurred in creating the presentation. java.io.FileNotFoundException: C:\JRun4\servers\SERVER_NAME\cfusion.ear\cfusion.war\WEB-INF\cfusion\lib\preso\viewer.swf

Upon investigating, it seems that the primary JRun server for ColdFusion (usually called "cfusion"  had the proper files in the expected places, however each of the additional servers that were created had several directories missing from the last "/lib" folder, including the "preso" folder mentioned above, which caused the issue.

The missing directories were:
  • preso
  • thirdpartytools
Directory stats also show that the cfusion server has 187 objects, while the new instances had only 179 objects.  Take the above two directories out, and you are left with 6 other files that are apparently missing.  I haven't spent the time to figure out which ones, because everything else seems to be working right now.  I just find it curious...

Anyway, copying the "preso" folder from the cfusion server to your manually created server fixed the problem.  If you run a clustered server, don't forget to copy to each server in your cluster.
Posted by aschwabe at 12:00 AM | Link | 0 comments

CF United Europe - $100 off before Jan 10
02 January 2008
CF United Europe is coming up people!  It looks to be a good show.  I will be there and speaking on XML and Recursive programming.

Register for CFUnited Europe by Jan 10th 2008 and save $100 off the base registration rate. Also as a group discount, register 3 for the price of 2, for more details contact info@cfunited.com
Posted by aschwabe at 3:19 PM | Link | 0 comments

GoogleMaps + Craigslist
Find properties for sale and rent visually
12 December 2007

Most impressive combination of technologies here.  This is a great example of pooling information together. 

http://www.housingmaps.com/

Posted by aschwabe at 12:00 AM | Link | 0 comments

Google Chart API
07 December 2007
From the incredible minds at Google :)

http://code.google.com/apis/chart/

This impressive little library lets you generate PNG chart files from a single URL request string.  Since people typically need to pass lots and lots of data for charting, they came up with a really creative way to compress the values, and provide a javascript snippet for automating the process.

So the nifty chart you see to the right is a "hello world" app using their API.  It ultimately comes down to a simple URL request of:

http://chart.apis.google.com/chart?cht=p3&chd=s:hW&chs=250x100&chl=Hello|World

Quite impressive and easy to use!

While this doesn't provide the stellar interactivity and depth of integration that Flex charts do, it certainly provides a way to do nice looking charts with a quick turn-around. 

According to their docs, you can freely use this so long as you don't regularly exceed the 50,000 hits per day limit at which point they may block you.  I think most of us will not be hitting it quite this much.

Some samples:

Posted by aschwabe at 12:00 AM | Link | 0 comments

Rar7z - Notes after it has been put to use
21 November 2007

Not too long ago I posted a coldfusion component to handle compression for rar and 7z.  Here is a report from the first time using it.

For reference, here is the important info:

Download version 1.0 -- lib_rar7z_cfc_v100.zip

This is of course released as-is no warranty, no support, blah blah, and eventually if people like this, I will officially make it open source.  Its a small piece of code, so who knows how useful it will be.

There are a few sample pieces of code to help figure out how to use is.  It is relatively easy:

Compress a file:

<cfinvoke component="lib.rar7z" method="compressFile" returnvariable="compressFile">
    <cfinvokeargument name="SrcPathAndFile" value="#ExpandPath(".")#\myfile.dat">
    <cfinvokeargument name="ArchivePathAndFile" value="#ExpandPath(".")#\myfile.rar">
    <cfinvokeargument name="VolumeSize" value="3500">
    <cfinvokeargument name="Timeout" value="90">
    <cfinvokeargument name="Engine" value="rar">
</cfinvoke>

List an archive's contents:

<cfinvoke component="lib.rar7z" method="listContents" returnvariable="listContents">
    <cfinvokeargument name="ArchivePathAndFile" value="#ExpandPath(".")#\myfile.rar">
    <cfinvokeargument name="Timeout" value="90">
    <cfinvokeargument name="Engine" value="rar">
</cfinvoke>

Extract files from an archive:

<cfinvoke component="lib.rar7z" method="extractArchive" returnvariable="extractArchive">
    <cfinvokeargument name="ArchivePathAndFile" value="#ExpandPath(".")#\myfile.rar">
    <cfinvokeargument name="OutputDir" value="#ExpandPath("./extract")#">
    <cfinvokeargument name="Timeout" value="90">
    <cfinvokeargument name="Engine" value="rar">
</cfinvoke>

I initially tried using the component with the "rar" engine, which maps to a 16-bit dos program called "rar.exe."  This didn't work out for me since it apparently only supports 8.3 filenames, and I needed support for long filenames. 

Second, I used the 7-zip executable "7za.exe" which is the command-line version of the 7z tools.  This supported long file names without any problem, and is behaving the way I expected.

The part I didn't expect was just how long it takes to compress a file.  I compressed an 80M database dump file using 7z, and it took 5-10 minutes...  this is running on a machine with 4 P4 hyyperthreaded processors and 4G ram...  thats a LONG time.

So, moving forward, I would NOT recommend use of the "rar" engine, but rather stick to "7z" if you need support for long file names.  Also, if you are compressing large files, be sure to assign a long enough timeout to make sure that CF doesn't prematurely terminate the process.  Other than this, it worked great!  It did exactly what I expected the first time I put it in use.

Posted by aschwabe at 12:00 AM | Link | 0 comments

Sporterizing Yugo 59/66 SKS Rifle
922r compliance
20 November 2007
I have recently purchased a Yugo 59/66 SKS rifle.  I have decided that I would like to refit this rifle with some modern parts, which are readily available at shows and online.  The problem with this is that ATF regulations state that you cannot disassemble and re-assemble this rifle legally unless you re-assemble it with less than 10 imported parts (it has 14 or 17, this is debatable).  That means you need to buy US made parts so that the total number of imported parts is 10 or less when you re-assemble it.

There are a lot of pages out there that help explain this to some degree, but nearly all of them have to do with the Norinco (Chinese) variant of the rifle.  The Yugo version, which I have, is much more 'interesting' in that it has night sights and a grenade launcher.

It has become a ridiculous process to figure out what the exact part list is for a Yugo 59/66 SKS.

The most definitive information I have found is below.  I am quoting this source.

Just how many of these parts are in an SKS Carbine?

Here are the relevant parts in an SKS Carbine:

1. Receiver
2. Barrel
3. Bolt
4. Bolt carrier
5. Gas piston
6. Trigger housing
7. Trigger
8. Hammer
9. Sear
10. Disconnector (see below)
11. Stock
12. Handguard
13. Magazine body
14. Follower

Note: This list has been confirmed by ATF.



How many imported parts can be replaced in an SKS Carbine?

Using commercially available parts, you can replace the following parts:

1)   Replace the stock with aftermarket US-made version.

2)   Replace the handguard with aftermarket US-made version.

3)   Replace the gas piston with a US-made version from Tapco (#SKS6602), SKSMan or SKSParts (#SKS-034).

4)   Replace the magazine with a 100% US-made magazine, including the magazine body, follower and floorplate. (Replaces two imported parts.)

5)   On Yugoslavian Type 59/66 Carbines: Remove the grenade launcher and replace it with a US-made muzzle break (foreign muzzle attachments are counted). See the FAQ’s on removing the Yugoslavian Type M59/66 grenade launcher for more info.

On a typical SKS Carbine, you will need to replace four parts. On Yugoslavian Type 59/66 Rifle, you will need to replace five parts.

These US-made parts are sometimes known as “compliance parts”, since they are used to ensure that the resulting rifle is “compliant” with Title 18 USC § 922(r).


So, if any of you out there have REAL PROVEN RELIABLE information to add to this, please let me know.  If it is just opinion, and you don't have any credible proven source to back it up, I probably won't back up your info.  I'm only doing this for sanity sake so that there can be at least one useful page that has all the facts about this rifle.
Posted by aschwabe at 12:00 AM | Link | 0 comments

Ghost for Linux ?
19 November 2007
I have long been a supporter of using Ghost for imaging disks.  See a previous post on how to use Ghost 2003 with Windows Vista.

I have never, however, been able to find a replacement for Linux... until now.

I just came across this -- and pardon me if this is old news -- which seems very promising!

http://www.feyrer.de/g4u/

This is an open-source project based on NetBSD that allows you to boot from a CD, connect to an FTP site, and backup-to-image, or restore-from-image to the local drive, using the FTP site as the image storage location.  This sure sounds like what Ghost should have been!

I intend to try it out very soon.
Posted by aschwabe at 4:05 PM | Link | 0 comments

Why ColdFusion isn't free
18 November 2007

No, this isn't an "original" rant...  just spreading the word on an already available, and excellent eye-opening writeup of why CF doesn't fit the "mold" of other "programming languages" and why it isn't a simple process to say "this is free, why isn't CF free?"

Anyway, stop reading my blog, and read this instead:

http://www.cfinsider.com/index.cfm/2007/11/10/Things-ColdFusion-is-not-and-Why-ColdFusion-isnt-free

Thanks to CF Insider!

Posted by aschwabe at 1:22 PM | Link | 0 comments

Speeding up Windows Vista
13 November 2007

I have finally put a copy of vista on my machine, and I have a few observations:

  • It is pretty
  • It is different enough from Windows XP that some things are hard to find
  • The continual nagging and "are you sure" questions drives me crazy
  • It is slow

I wouldn't call it more efficient, but it is the newest windows, so we all better get confortable with it.

Here are some _wonderful_ resources I found online that allowed me to get vista running on my pc at about the same speed as winxp, and I am pleased to say that it is a bit more stable than XP as well.  After all, vista is based on the windows 2003 kernel, which has been very powerful and reliable.

Turn off the nagging:

The continual popups are from a new service called "UAC" or User Access Control.  Read this article (and google it for more info) and learn what it is, and deceide if you want to turn it off.  It may make your PC more vulnerable, but I will accept that risk.  What you do is up to you.

http://www.mydigitallife.info/2006/12/19/turn-off-or-disable-user-account-control-uac-in-windows-vista/

Turn off services, change the UI, etc, etc.

Here is a great guide to streamlining Vista, turning off services that Vista assumed you wanted, and some other neat tricks like using a USB memory key to speed up application access.  I was thoroughly impressed with the impact these changes had.

http://www.extremetech.com/article2/0,1697,2110595,00.asp

Overall, I was very hesitant to move forward using Vista.  It seemed too bulky and multimedia heavy to be productive.  Plus windows explorer is different!!  (I don't know why MS did this -- poor decision in my opinion).  These updates will help to have a manageable and usable windows vista machine.

Happy computing

Posted by aschwabe at 12:00 AM | Link | 0 comments

Using Ghost 2003 with Windows Vista
Partition to partition backups
12 November 2007

If you do a few google searches for "ghost" and "vista" you will find a ton of posts.  What I have found frustrating is the lack of clarity on one particular issue:

"If you back up a windows vista partition using ghost 2003 (dos based) to another drive or partition, can you restore it and have a bootable vista OS ?"

Answer: YES it works -- see below for how to do this.

There are many people who say if you clone a disk (i.e. you have two hard drives, clone A to B), that ghost 2003 works fine with vista, but nobody has clearly stated how and if it works on a partition to partition basis.

Here is how we setup all our computers:  The primary drive is split into 2 partitions, C: is for the OS, and D: is for files and backups.  In this scenario, the OS drive can be backed up to the D: drive using ghost.

This works great for any windows until Vista came around.  Now all of a sudden, changes to the boot sector make it more difficult.

So here is how to do it:

  1. Make sure your system is installed so that you have a C: and a D: partition
    • Note, we set this up so that all your "work files" are on D, so that if you restore a different OS, you can still access all your files.  This way you can have multiple configurations for your computer, one for work, one for games, one for fooling around, etc. and never lose any data.
  2. Make a "Bootable ghost CD" (or floppy disk, but our computers don't have disk drives anymore).
    • Here is some info on how to create a bootable ghost cd.
    • FYI you will need the bootable ghost CD because windows vista HATES ghost 2003, so its not easy to install it.  If you have a bootable CD, you have no worries, and just boot from the CD any time you want to backup or restore your system.
    • If you really have a hard time making a bootable ghost cd, email me, and I can help you out (for a small paypal donation).
  3. Backup your OS (all windows):
    • Boot up with your "Bootable Ghost CD"
    • Select "Local Partition to Image"
    • Pick your source drive and partition, destination drive and filename.
    • Get coffee.
  4. Restore your OS:
    • Windows 9x, 2000, ME, XP, 2003, linux, others:
      • Boot up with your "Bootable Ghost CD"
      • Select "Local Partition From Image"
      • Browse to and pick your ghost disk image
      • Pick the destination drive and partition
      • Get more coffee
      • When done, select "Reset computer"
    • Windows Vista
      • Boot up with your "Bootable Ghost CD" 
      • Quit ghost (should leave you at an A: prompt)
      • Type in "ghost -fdsp" (will re-launch ghost with alternate settings)
      • Select "Local Partition From Image"
      • Browse to and pick your vista ghost disk image
      • Pick the destination drive and partition
      • Get more coffee
      • When done, select to "Reset Computer"

And thats it.  I have found that this works very well with all modern windows versions, and with the few small differences, works great with vista too.  Since we can boot into ghost from a CD, we don't have to install it anymore either.  Now we can all have 10 OS's on our laptops and switch at will.

Posted by aschwabe at 8:56 AM | Link | 0 comments