Fastest way to shut down Windows OS

September 27, 2008 at 7:28 pm (Windows) (, )

Tired of fucking waiting and waiting…. for Windows to shut down. Yeah, I do!

Here’s a way which will shut down Windows completely in few seconds. 

Press Ctrl-Alt-Del to open Windows Task Manager, click on Shut Down menu option and while pressing the Ctrl key, click on the Turn Off option.

Now as you count 1…2….3….4…..5….System Shut Down

Permalink Leave a Comment

Dynamically add element / attribute to a XML using E4X

September 25, 2008 at 12:01 pm (Flex, XML) (, , )

Written for: Flex, ActionScript 3.0

To dynamically add element / attribute to a XML; assume that it already exists in the XML and using the .(dot) operator, pass a value to it.

Here’s an example. Consider the following XML:

var albumXML:XML =
<tracks>
	    <song tracknumber="1">
	        <title>Orgasm Addict</title>
	        <artist>Buzzcocks</artist>
	    </song>
	    <song tracknumber="2">
	        <title>What Do I Get?</title>
	        <artist>Buzzcocks</artist>
	    </song>
	    <song tracknumber="3">
	        <title>I Dont Mind</title>
	        <artist>Buzzcocks</artist>
	    </song>
	    <song tracknumber="4">
	        <title>Love You More</title>
	        <artist>Buzzcocks</artist>
	    </song>
	</tracks>;

To add an additional element of <genre> to the first <song> node, I’ll use the following line of code.

albumXML.song[0].genre = 'Punk';

Similarly to add an attribute of duration to the first <song> node, I’ll use.

albumXML.song[0].@duration = '2:00';
Now if you trace the XML file, it’ll show as:
trace(albumXML);
/*
<tracks>
  <song tracknumber="1" duration="2:00">
    <title>Orgasm Addict</title>
    <artist>Buzzcocks</artist>
    <genre>Punk</genre>
  </song>
  <song tracknumber="2">
    <title>What Do I Get?</title>
    <artist>Buzzcocks</artist>
  </song>
  <song tracknumber="3">
    <title>I Dont Mind</title>
    <artist>Buzzcocks</artist>
  </song>
  <song tracknumber="4">
    <title>Love You More</title>
    <artist>Buzzcocks</artist>
  </song>
</tracks>
*/

Additionally, you can use the following methods of a XML object.

  • appendChild()
  • prependChild()
  • insertChildAfter()
  • insertChildBefore()

Permalink 3 Comments

Sweet Dreams of Roy Buchanan

September 18, 2008 at 6:40 pm (Music) (, , )

Love ya Roy!

Peace.

Permalink Leave a Comment

Kinda makes you think……doesnt it?

September 17, 2008 at 6:49 pm (Gazy) ()

Permalink Leave a Comment

hmmm…Thats easy!

September 12, 2008 at 5:20 pm (Royal Enfield) (, , , )

Found this video on YouTube under the title – “The Art of Starting a Royal Enfield (1)”. Being a hardcore Enfield rider myself, I was expecting a kick start with a lot of back kicks thrown in for that extra punch. What I found in the end was really funny. Check it out.

By the way, only Enfield riders would understand this. Others can just ponder over our amusement!

Permalink Leave a Comment

LHC – Ohh Yeah!

September 12, 2008 at 1:16 am (Science) (, )

I know I’m delayed by a couple of days, but still considering the enormous nature of the project and the scientific significance I would like to say – “Collide those damn particles and lets see what we get!”

Permalink Leave a Comment

Video: Integration of Flex with Flash CS3

September 11, 2008 at 12:43 pm (Flex, Videos) (, , , , )

Found a video by Glenn Ruehle demonstrating integration of Flex with Flash CS3. 

Video Link

Permalink Leave a Comment

Creating a custom chrome for AIR application

September 8, 2008 at 3:42 pm (AIR) (, , , )

Written for: Flex Builder 3 and AIR 1.1

To create a custom chrome, you will have to first remove the System chrome (default, drawn by the Operating System) and then the Flex chrome (which is rendered by Flex when System chrome is toggled off). 

To remove the system chrome, browse through the application’s descriptor file (ApplicationName-app.xml) for <systemChrome> tag. Add the value of “none” so that it reads like this: 

<systemChrome>none</systemChrome>

If you run the application now, you will see a chrome which is rendered by Flex itself. 

To remove the Flex chrome, goto your application’s root tag. This could  be <mx:Window> or <mx:WindowedApplication> and then set the showFlexChrome property to false.

By doing this, you would have removed chrome all together from your application. It would now look this.

 

The next step is to add your own controls for minimizing, maximizing, restoring, closing and dragging the window. This is can be done by using the framework’s NativeWindow class. The NativeWindow class is used for creating and controlling desktop windows for AIR apps. It contains methods for all the functionality we need for our custom chrome.

To make the window draggable, add a container to your application (In this example, I’m using a red colored canvas). Next, add an eventHandler for handling the mouseDown event of the container. The eventhandler will call the NativeWindow class’s startMove method. By doing this, the user can now move the application on the screen by dragging the red colored canvas.

	<mx:Script>
		<![CDATA[
			private function moveWindow(event:MouseEvent):void {
				this.stage.nativeWindow.startMove();
			}
		]]>
	</mx:Script>

	<mx:Canvas width="200" height="100"
		backgroundColor="#EB4545"
		mouseDown="moveWindow(event)"/>

The window can be minimized, maximized, restored and closed by calling the NativeWindow’s respective function for each task.


	<mx:Script>
		<![CDATA[
			private function minimizeWindow():void {
				this.stage.nativeWindow.minimize();
			}

			private function maximizeWindow():void {
				this.stage.nativeWindow.maximize();
			}

			private function restoreWindow():void {
				this.stage.nativeWindow.restore();
			}

			private function closeWindow():void {
				this.stage.nativeWindow.close();
			}
		]]>
	</mx:Script>
	<mx:Button label="Minimize"
		click="minimizeWindow()"/>
	<mx:Button label="Maximize"
		click="maximizeWindow()"/>
	<mx:Button label="Restore"
		click="restoreWindow()"/>
	<mx:Button label="Close"
		click="closeWindow()"/>

The final code will look like this:

In application descriptor file.

<systemChrome>none</systemChrome>

In MXML.

<?xml version="1.0" encoding="utf-8"?>
<mx:WindowedApplication xmlns:mx="http://www.adobe.com/2006/mxml"
	layout="vertical"
	showFlexChrome="false">

	<mx:Script>
		<![CDATA[
			private function moveWindow(event:MouseEvent):void {
				this.stage.nativeWindow.startMove();
			}

			private function minimizeWindow():void {
				this.stage.nativeWindow.minimize();
			}

			private function maximizeWindow():void {
				this.stage.nativeWindow.maximize();
			}

			private function restoreWindow():void {
				this.stage.nativeWindow.restore();
			}

			private function closeWindow():void {
				this.stage.nativeWindow.close();
			}
		]]>
	</mx:Script>
	<mx:Canvas width="200" height="100"
		backgroundColor="#EB4545"
		mouseDown="moveWindow(event)"/>
	<mx:Button label="Minimize"
		click="minimizeWindow()"/>
	<mx:Button label="Maximize"
		click="maximizeWindow()"/>
	<mx:Button label="Restore"
		click="restoreWindow()"/>
	<mx:Button label="Close"
		click="closeWindow()"/>

</mx:WindowedApplication>

Permalink 6 Comments

System Notifications for AIR application

September 2, 2008 at 6:31 pm (AIR, ActionScript) (, , , , )

Finally, found a way to display system notifications for AIR applications! I’m using as3notificationlib for doing it. From the library’s Google Code page:

This project makes it easy to add cross-platform notifications to your AIR application. It handles “native system notifications” like the dock icon bouncing and the taskbar icon flashing, and it allows you to easily create alert “pop-ups”.

In addition to displaying text in the alert “pop-ups”, one can also add an icon, a video and a sound alert (to indicate display of the “pop-up”).

Permalink Leave a Comment

Hug A Developer Today – SO FUCKEN TRUE!

September 1, 2008 at 2:24 pm (Videos) (, )

Permalink Leave a Comment

Next page »