Posts

Showing posts from 2013

[AS3] Crossdomain.xml file syntax

A SWF file on server1.com can load files from server2.com only if there is a crossdomain.xml file on server2.com that lists all the servers that may load files from it, and the list contains server1.com. Synatx  for crossdomain.xml file is as follows: <?xml version="1.0"?>    <!DOCTYPE cross-domain-policy SYSTEM "http://www.macromedia.com/xml/dtds/cross-domain-policy.dtd"> <cross-domain-policy>     <site-control permitted-cross-domain-policies="all"/>     <allow-access-from domain="*" to-ports="*" secure="false" />     <allow-http-request-headers-from domain="*" headers="*" secure="false" /> </cross-domain-policy> Place this file in the root folder to access content from 2 different domains.

[FLEX] What is dynamic keyword used for? or What is the difference between sealed class and dynamic classes?

Dynamic Keyword is used to make a class dynamic. A dynamic class defines an object that can be altered at run time by adding or changing properties and methods. We create dynamic classes by using the dynamic attribute when we declare a class. For example, the following code creates a dynamic class named Protean: dynamic class Protean { private var privateGreeting:String = "hi"; public var publicGreeting:String = "hello"; function Protean () { trace("Protean instance created"); } } If we subsequently instantiate an instance of the Protean class, we can add properties or methods to it outside the class definition. For example, the following code creates an instance of the Protean class and adds a property named aString and a property named aNumber to the instance: var myProtean:Protean = new Protean(); myProtean.aString = "testing"; myProtean.aNumber = 3; trace (myProtean.aString, myProtean.aNumber); // output: testing 3 Prop

[HTML5] HTML5 Quick Start Guide

Image
Introduction HTML5 is the fifth revision and the newest version of the HTML standards. Previous version (HTML 4.01) was released in 1999. In 2006, WHATWG (Web Hypertext Application Technology Working Group) & W3C (World Wide Web Consortium) came together to define the new version of HTML. Earlier, WHATWG was working with web forms and applications, and W3C was working with XHTML 2.0. They discussed and layed out HTML Design Principles . They were addressed towards better experience for user and easy adoption for developer which would be independant of device and plugins with a graceful fallback mechanism. HTML5 specifications were finalized on 17th December 2012 last year. Tools HTML5 is still a work in progress. Browsers are implementing HTML5 specifications as per their individual plans, thus we have various level of support on different browsers. In order to know what features are supported by a particular browser, few websit

[Windows] Script to remove spaces from filenames

This is the code for removing spaces from filenames. @echo off setlocal disableDelayedExpansion if /i "%~1"=="/R" (   set "forOption=%~1 %2"   set "inPath=" ) else (   set "forOption="   if "%~1" neq "" (set "inPath=%~1\") else set "inPath=" ) for %forOption% %%F in ("%inPath%* *") do (   if /i "%~f0" neq "%%~fF" (     set "folder=%%~dpF"     set "file=%%~nxF"     setlocal enableDelayedExpansion     echo ren "!folder!!file!" "!file: =!"     ren "!folder!!file!" "!file: =!"     endlocal   ) ) Copy the above code into a notepad file and save it as .bat extension in the same directory where you want to run the command.

[Windows] Script to rename files from Uppercase to Lowercase

If you need to change the filenames in windows explorer from uppercase to lowercase, do the following: Go to the directory and run the following command: for /f "Tokens=*" %f in ('dir /l/b/a-d') do (rename "%f" "%f")   and your job will be done, njoy!

[SVN] Peer Code Review

I remember sitting in on code reviews early in my career. You took your code, put it up on a projector, and the architects—shadowy figures in the back of the room—ripped it to shreds. These marathon sessions would take all day and were completely exhausting. They certainly improved the code, but they wreaked havoc with both release schedules and people’s psyches! Nowadays, I do code reviews a little differently. Instead of submitting our code to the senior architects, we do peer code reviews. Here’s how it works: I go away and write some code, including tests for that code. I run all the tests and tweak until I’m happy with the work. It functions, it’s structured properly, it conforms to all of our style requirements, and it’s got a really clever solution to that sorting problem. I commit the code to my feature or developer branch. It’s not in mainline code yet, and won’t ship (this is important!). I ask for review. If we’re working in Git, then I do it by creating

[SVN] Simple way to do code review

Image
Simple way to do code review Table of Contents A code review (also known as code inspection or walkthrough ) is often considered to be a complex, time consuming and highly regulated process. In reality it’s just another form of communication between team members and a great way to ensure code quality and stay up to date with changes. In this guide we will show a simple and effortless way to do it on a daily basis. Use version control We hope you are already doing this! Version control systems make any work inside your team much easier, and this includes code reviews. Check out our guide “Introduction to version control” if you are still managing code the old-fashion way, or are interested in learning some best practices. Stay up to date Email and RSS are common ways to be notified about new things and code changes are not exceptions. Depending on the project scope and team size you can choose between checking every commit or just doing review o

[Java] Multi-Dimension Arrays

Image
The arrays you have been using so far have only held one column of data. But you can set up an array to hold more than one column. These are called multi-dimensional arrays. As an example, think of a spreadsheet with rows and columns. If you have 6 rows and 5 columns then your spreadsheet can hold 30 numbers. It might look like this: A multi dimensional array is one that can hold all the values above. You set them up like this: int[ ][ ] aryNumbers = new int[ 6 ][ 5 ]; They are set up in the same way as a normal array, except you have two sets of square brackets. The first set of square brackets is for the rows and the second set of square brackets is for the columns. In the above line of code, we're telling Java to set up an array with 6 rows and 5 columns. To hold values in a multi-dimensional array you have to take care to track the rows and columns. Here's some code to fill the first rows of numbers from our spreadsheet image: aryNu