Skip to main content

Posts

Showing posts from July, 2011

AS3: Transmute namespace instead of removing it in XML

There are lot many articles and solutions available on web related to the xml namespace . Few guide us over how to handle namespace in xml via as3 while rest have provided solution by removing xmlns tag from the xml. But I think, there is better way than removing or filtering the namespace. The solution that I use is very clever one. You might have noticed that to put namespace in xml colon character is used. So keeping this property in mind, I have developed a function to replace all the colons from namespaces only with the underscore character. The code uses regular expression to search the colon character in only namespace. And then replace it with the underscore character. This way all the namespaces are still available and accessible but in the form of attributes. And this is the advantage of converting it into a attributes. /** * @method transmuter * @author Abhishek Kumar */ private function transmuter(data:String):String { var modified:String = d

Batch File - Bulk Renamer ... Advanced

This post is the continuation of my last post, i.e., Batch File - Bulk Renamer ; related to systematically renaming all the files in a folder. The problem I noticed with my previous code is that, either it works with the particular type of file (aka same extension) or in absence of file-extensions it renames this batch file also. So I thought to introduce a condition in this so as to skip this batch file while renaming other files. Here is the code for that, .:C.O.D.E:. @echo off&set /a cnt=1 for %%a in (*) do call :PROCESS "%%a" goto :EOF :PROCESS IF not %1=="bulk_renamer.bat" (rename %1 "IMG_%cnt%.jpg") set /a cnt+=1 Note : This code would rename all the files present in the folder except bulk_renamer.bat Help : Refer to my previous post for the steps to create or modify the script. Link : http://akzcool.blogspot.com/2010/11/batch-file-bulk-renamer.html

AS3: To determine the angle between two given coordinates

Here is a sample code to determine the angle between two given coordinates. In other words, to calculate the angle of an object with respect to the origin. This could be used to determine current angle of mouse-pointer with some pre-defined origin. In which case the movieclip attached to the mouse-pointer can always point towards it's origin. Many examples of this logic can be seen on web. One of the popular example is; a female face with moving eyes that follows the user's mouse-pointer movement, so that the eyes always look towards the mouse-pointer. Sample Code: package { import flash.geom.Point; /** * @file Connecteur.as * @author Abhishek Kumar */ public class Connecteur { private var originCoordinate:Point; private var currentCoordinate:Point; private function setOriginCoordinate():void { originCoordinate = new Point(Source.x, Source.y); } private function setCurrentCoordinate():void {

TTFEdit - TrueTypes font editor

TTFEdit is a GPL editor for TrueType fonts. TrueType is a standard used by modern operating systems like Mac OS X, Windows XP and Linux. There are two different TrueType specifications: from Apple (original author of this technology) and from Microsoft. Mac OS X and Windows XP use own font rendering engines, there is also FreeType library used by Linux. On these three systems the same font will generally look different. TTFEdit tries to produce TTF files compatible with all mentioned systems. Download link: http://sourceforge.net/projects/ttfedit/files/ttfedit-1.0a/1.0/ttfedit-1.0a-bin.zip/download Hosted at SourceForge: http://sourceforge.net/projects/ttfedit/