windows 7 quotes problem
If you have a problem with quotes in Windows 7, try to switch the keyboard layout from "United States - International" to "US"
After installing Windows 7, I discovered the following behavior in the code editor: Pressing the quote (') or double-quote (") key once would have no effect. Pressing any key after that would produce both the double quote character and the next character.
The problem is caused but by regional settings - I solved it by switching from "United States - International" to "US" keyboard layout.
Go to Control Panel->Region and Language->Keyboards and Languages tab->click Change keyboards... where you add English (United States) - Us to the list and then select it as default from the top drop down list.
Flex vs Silverlight vs AJAX
Our Transylvania Flex Group 3th event will be held this Saturday (November 21, 2009) in Cluj-Napoca.
This one will be a showdown between RIA technologies, with advocates from our Betfair Office. Iosif George for Flex, Vlad Nemes for AJAX and Silviu Niculita from RIASolutionsGroup for Silvelight.
Registration is free and you can signup for the event here. See you there !
ExtendedImage Component
I just finished writing a Flex3 library that will allow you to read a great number of image formats using flex and actionscript 3. The component uses a codec like rendering system, so each time you provide it with a source, the codecs attempt one by one to read the file signature and decide which one is fit to decode the image.
So doing this, it won't matter the file extension or the way you provide the image asset (archived, link, base64 encoded, plain text, byteArray or embedded at compile time)
It's a work in progress but curently I've made codecs for the following formats:
- PointLineCAD 3D objects (*.p3d)
- Photoshop images (*.psd, *.pdd)
- ZSoft images (*.pcx)
- Truevision TGA (*.tga, *. icb, *.vda, *.vst, *.win)
- Windows icon files (*.ico)
- GIF images (*.gif – static and animated gifs)
- JPEG images (*.jpg. *.jpeg, *.gfif)
- PNG (Portable network graphic) images (*.png)
- Windows Bitmap images ( *.bmp, *.rle, *.dib)
- Adobe Shockwave Flash (*.swf)
As I said before, the way you provide the source doesn't really matter. You can zip up all your images in an archive and as source you can just point to the file inside the zip.
1 | <adm :ExtendedImage id="img" source="archive.zip://image.png" /> |
This way, you greatly reduce the number of requests to the server. But this is not all. Source can be also provided as a base64 encoded string, or as plain text (only p3d can take advantage of this since the p3d file is plain text as well).
For a bit more details, a demo and API description, visit this page
The simplest way to parse XML in Java
You can do a lot with XML, but often all you want to do is to read a simple file with some basic data in it. The options for doing this, SAX, DOM and JAXB are all relatively verbose and often off-putting. So here is a class that will make all this much much more simple.
Parsing a file such as:
1 2 3 4 5 6 7 8 9 10 11 12 | <config> <title>test</title> <version major="1" minor="2"/> <roles> <role name="admin"/> <role name="user"/> </roles> <users> <user name="joe" password="pass" role="admin"/> <user name="harry" password="secret" role="user"/> </users> </config> |
Can be achieved with the following code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | Xml config = new Xml("config.xml","config"); System.out.println("title: "+config.child("title").content()); Xml version = config.child("version"); System.out.println("version: "+version.integer("major")+"."+version.integer("minor")); for(Xml role:config.child("roles").children("role")) System.out.println("role: name: "+role.string("name")); for(Xml user:config.child("users").children("user")) { System.out.println( "user: name: "+user.string("name")+ ", password: "+user.string("password")+ ", role: "+user.string("role")); } |
As you can see, it's nice and simple and allows you to get to the information quickly and without any hassle. The API uses the DOM parser underneath, but attempts to make the data more easily available. All you need is the following [Click to download] class, which you can of course customise however you like.
Update:
I've just added another nice method to this class. Is called e4xEval, that is actualy a xpath eval but i made it use the flex e4x syntax. So, if you want to get all the role name you can do:
1 2 3 | Xml config = new Xml("config.xml","config"); String[] list = config.e4xEval("config.roles.role.@name"); // @ is attribute |

