RIA328_Charting_with_CF_and_Flex.zip (5.5M)
RIA328_Charting_with_CF_and_Flex.zip (5.5M)
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!
- Log into your account in Gmail
- In the upper right part of your screen, click on "Settings"
- On the settings page, click on the "Filters" heading
- Click the "Create a new filter" link
- 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)
- Click the "Next Step" button
- 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)
- Click on the "Create Filter" button to save the changes!
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" :
<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:
{
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
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 !
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.
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.
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.
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
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.
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
Most impressive combination of technologies here. This is a great example of pooling information together.
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:
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.
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.
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.
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.
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.
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!
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.
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.
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