Showing posts with label tutorial. Show all posts
Showing posts with label tutorial. Show all posts

Wednesday, February 20, 2008

Adobe AIR: Web to Desktop

Past few days, I have came across Adobe AIR through digg, techmeme, delicious and so today i thought i should try this. Adobe AIR lets us their existing web development skills in HTML, AJAX, Flash and Flex to build and deploy rich Internet applications to the desktop. For Application development you will need two things:


Having Adobe AIR extension for Dreamweaver CS3 can be very helpful as it facilitates to package and preview .air application files directly within Adobe Dreamweaver CS3.

As my first AIR application, I ported my rubiks cube timer as a desktop application (RubikTimer.air). Its very easy using dreamweaver extension, have a look here : Create your first HTML-based AIR application with the AIR SDK (great tutorial for beginners).

One problem I faced: Usually setInterval("display()",500) works with Firefox/IE but it was not starting with no error message to look into but then i found out about using Adobe CommandLine tool. (via Three ways to debug Adobe javascript Application). It´s called ADL and resides in the /bin folder of the SDK. ADL showed the Error: "Unsafe javascript". Then after some random changes when i change it to "setInterval(display,500)", It started working. Another problem I faced was related to keypress events in javascript, were not working with AIR (still have to resolve this issue)

Download RubikTimer.air here
Web Based Rubik Cube Timer

Related Post:

Sample Adobe AIR Applications
Trying hands on Google gadgets

Sunday, February 11, 2007

Play with html using javascript

Javascipt can be very fruitful and flexible when it comes to modifying webapges dynamically (though client side). Javascript can be helpful in creating response to browser events like mouseup, mouseover etc, veryfying of form values prior to submitting them, changing style and value of html elements dynamically.
Examples i disscuss here are being user by me in developing Paint Chat !! So here I go..
You can write javascript functions and code in section as:

<script type="text/javascript">function test(){
alert("test javascript");}</script>

Action on events:

Example of events can be mouseclick, keystroke, submitting form etc.
With onload()
 <body onload="init()">
Now init() function will be called when this html page is being loaded.
For links, javascript function can be evoked when clicking, mouseover over links like
 <a href="javascript:replay()">Refresh ! </a>
Now function replay() will be called when Refresh! is clicked. For input text box
<input type="text" size="30" id="search" onchange="suggest()">; 
Now whenever content of textbox changes the function suggest() will be called. It can be useful when feature like google suggest has to be implemented or so.

On submitting forms:
<form method="post" action="some.php" onsubmit="return checkForm()">
So whenever this form is being submitted checkForm() function will be called and can be helpful in verifying values of form elements.

onMouseOver and onMouseOut:
<a href="http://www.buard.blogspot.com" onmouseover="fade()">
<img src="image.gif"> </a>
Now when mouse is over image fade() function will be called and can be used for animate and styling purposes.

Registering of events

A simple way can be:
Conside the html code : <div id="sample"> ..... some... html..text.. </div>
Now using javascript you can register event for this div by:
 var div_sample = document.getElementById('sample');
div_sample.onmousedown=sampleMouseDown ;
Now whenever mouseover ocours over this div html element sampleMouseDown() function will be called. Events can also be registered using addEventListener() . Find more information baout it here:Advanced event registration models

Modify Style and values for html elements

Within some javascript function, you can first get the element object by getElementByID() getElementsByName() for example conside the javascript code:
document.getElementById("colorcode").innerHTML = "#000000";
document.getElementById("bgtest").style.backgroundColor= "green";
The first line find the html element with id colorcode and then set its value to "#000000" using innerHTML. In second line, it sets the background of html element with id "bgtest" to green.

Some other tweaks which were useful :
  • Calling some function repeatedly with some time interval, consider javascript code:
var intervalID = setInterval(drawCurve, 100);
So the drawCurve() function will be called repeatedly after 100ms. You can cancel this process( removing repeatedly calling) by clearInterval(intervalID);

  • You can use setTimeout(drawCurve,100) function to delay drawCurve() execution for a specified time period(100ms).
  • Calling a php function inside javascript:
var testImg = new Image();
testImg.src = "form.php?name=form_value";
Now here in form.php you can fetch value of variable name using $_GET and can perform appropriate action.

Some links:Related Posts:

Monday, October 16, 2006

How to hide files in JPEG's

Create the rar file:
rar a secret.rar <your secret file>
cat img.jpg secret.rar > newimg.jpg

Now this newimage looks identical to img.jpg, but it has secret.rar contained in it :)
Pull the file back out with this command: unrar x newimg.jpg

In windows :How to hide files in JPEG's

Related Post :

Saturday, October 14, 2006

Making LaTeX Beamer Presentations

I came across this nicely compiled page on :
how to make Latex Beamer Presentations

If you want to create overhead presentations (รก la Powerpoint) with LaTeX, you can do so by using Beamer class, which creates surprisingly professional and sophisticated documents that you can then display using any pdf viewer (e.g., such as Adobe Acrobat). The advantage of using LaTeX over a program like Powerpoint is that it doesn't require expensive software for either creating or displaying your presentation; it thus makes the presentation truly "portable".

Read More >>
Related Links :

Wednesday, October 11, 2006

Using Telnet to send mail (By SMTP)

You : telnet 25
Server : Trying ???.???.???.???...
Connected to
Escape character is '^]'.
220 ESMTP Sendmail ?version-number?;
You : Helo
Server : 250 mail.domain.ext
You : mail from
Server : 250 ok
You : rcpt to:
Server : 250 ok

To start composing the message issue the command data
You: data
You : Subject:-type subject here-
then press enter twice
You may now proceed to type the body of your message
To tell the mail server that you have completed the message enter a single "." on a line on it's own.
Server : 250 ok ???????? Message accepted for delivery
You can close the connection by issuing the QUIT command.
You : QUIT

Wednesday, October 04, 2006

Java JRE/JDK installation

To verify that the installation was successful, execute

java -version

The output should look something like this if everything is well

java version "1.5.0_05"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_05-b05)
Java HotSpot(TM) Client VM (build 1.5.0_05-b05, mixed mode)

If the version does not match what you just installed then you might have JRE/JDK installed previously

Multiple JRE/JDK installed

If you have multiple JRE or JDK installed (e.g. 1.5.0 and 1.4.2) and want/need to switch between them, you can use update-alternatives to do so.

Example: Choosing which java executable to use:

update-alternatives --config java

Example: Choosing which javac executable to use:

update-alternatives --config javac

And so on in that fashion for the remaining executables related to Java. You can look in /etc/alternatives to see what one can configure with update-alternatives.
Links : Download

Linux Network Basic

Display all the interfaces you have on your server:
ifconfig

Display all interfaces as well as inactive interfaces you may have:
ifconfig -a

Assign the eth0 interface the IP-address 192.168.1.100 with netmask 255.255.255.0:
ifconfig eth0 192.168.1.100 netmask 255.255.255.0

Assign the default gateway for eth0 to 192.168.1.1 (for example your router):
route add default gw 192.168.1.1 eth0

Verify that you can reach your router (192.168.1.1):
ping 192.168.1.1

Display the routing information with the command route to see if routing entry is correct:
route -n

Check the status of the interfaces quickly:
netstat -i

Show all active connections:
netstat

Show all active TCP connections:
netstat -t

DNS lookups (3 different ways) and displays the answers that are returned from the name server (To troubleshoot DNS problems):
dig ubuntulinux.org
nslookup ubuntulinux.org
host ubuntulinux.org

Determine the network route from your computer to some other computer:
traceroute www.ubuntulinux.org

View your ARP (used by a networked machine to resolve the hardware location/address of another machine on the same local network) Cache:
arp

Remove any entry from the ARP cache for the specified host (for example 192.168.1.103):
arp -d 192.168.1.103

Check traffic in network :
tcpdump -n arp

Send out unsolicited ARP messages so as to update remote arp caches (for example 192.168.1.103):
arping 192.168.1.103

Shutdown a specific interface (for example eth0):
ifconfig eth0 down

Activate a specific interfrace (for example eth0):
ifconfig eth0 up

Stop all network devices manually on your system (Debian specific):
/etc/init.d/networking stop

Start all network devices manually on your system (Debian specific):
/etc/init.d/networking start

Restart all network devices manually on your system (Debian specific):
/etc/init.d/networking restart

Networking configuration is stored in the following file:
/etc/network/interfaces

Resource:
Ubuntu Linux Blog by Ralph
http://www.linuxhelp.net/guides/networkbasics/

Thursday, September 21, 2006

Repair a Corrupt MBR and boot into Linux

There are times when you inadvertently overwrite your Master Boot Record. The end result being that you are unable to boot into Linux. This is especially true when you are dual booting between windows and Linux OSes.
This is what you do to restore the GRUB boot loader when faced with the above problem. First you need aLinux distribution CD. If you are using Fedora (RedHat) then the first CD is sufficient. But you may also use any of the live CDs like Knoppix, Ubuntu Live CD and so on.
Read More >>

Friday, July 28, 2006

Steganography app hides a messages in plain sight

BlackBox is an application that makes use of steganography. You have the ability to hide messages within Bitmap (BMP) files with no changes to the image or even the any of its properties, such as its file size. Useful for people who would like to send anonymous messages.

Related Post : http://burad.blogspot.com/2006/03/steganography.html
Link : http://www.spammimic.com/index.shtml

read more | digg story

Thursday, July 20, 2006

Noob's guide to manual photography

Some might ask why you would want or need to modify camera settings manually when the camera can do it for you รข��just fine.รข�� If you really want to end up with expressive photographs instead of mere snapshots, this beginner's guide is a must-read. I personally didn't really get into photography until I learned the manual controls. Check it out.

read more | digg story

Wednesday, July 19, 2006

An Introduction to AJAX

AJAX (Asynchronous JavaScript and XML) is the latest boom in the Web development world. AJAX helps developers narrow the gap between desktop and web applications — Google Earth, Flicker and MS Outlook Express Web Version are some of the applications powered by AJAX.

Asynchronous means that you can make a request to a server and perform other actions while the server is processing your request -- and on the arrival of the response required actions can be performed -- as opposed to conventional web applications, in which the user has to sit back and stare at the blank screen while the server is processing the request.

AJAX Architecture :
Figure 2

Read More >>
Source : Topcoder

Tuesday, July 11, 2006

How to create a patch

Generating patches, files containing the difference between files, is the domain of diff programs.
Creating Patch :

diff -Naur olddir newdir > new-patch


Note: the symbol > will redirect the output to the file new-patch.

To apply the patch
go to olddir and do :

patch -p1 <new-patch

And if you want some files to be excluded from doing a diff use -x option like

diff -Naur -x *.o olddir newdir > new-patch
this will exclude .o files when doing a diff

Read More here :
http://drupal.org/diffandpatch
http://www.ss64.com/bash/diff.html
http://www.cpqlinux.com/patch.html
http://www.linuxjournal.com/article/1237

Searching with find

The find command is one of the darkest and least understood areas of Linux, but it is also one of the most powerful. The biggest problem with find is that it has more options than most people can remember -- it truly is capable of doing most things you could want.

The most basic usage is this:

find -name "*.txt"

That query searches the current directory and all subdirectories for files that end in .txt.

Source : Linux.com

Read more >>

Monday, June 05, 2006

Creating Firefox Extension

Learn by example

Everyone has a good idea at one time or another to implement a new feature in a web browser. Well, with the goodness that is Mozilla Firefox, now you can do just that. You need to have a vague understanding of XUL and Javascript, but you certainly don't need to be a master of either.
The author explains how the extensions break down in a nutshell, using BugMeNot as an example

read more >>

Related Post : If you want to develop firefox extension

Thursday, June 01, 2006

Vim tips: Using viewports

A really useful feature in Vim is the ability to split the viewable area between one or more files, or just to split the window to view two bits of the same file more easily. The Vim documentation refers to this as a viewport or window, interchangeably.
You may already be familiar with this feature if you've ever used Vim's help feature by using :help topic or pressing the F1 key. When you enter help, Vim splits the viewport and opens the help documentation in the top viewport, leaving your document open in the bottom viewport.
Read More

Article By: Joe 'Zonker' Brockmeier
Also Emacs Tips : Buffer & windows

Sunday, May 28, 2006

vi survival guide

A comprehensive guide to a famous text editor "vi", written in vi itself.

read more | digg story

Wednesday, April 12, 2006

graph plotting with gnuplot

Gnuplot is a free, command-driven, interactive, function and data plotting program.
Here i' m providing a quick reference guide for plotting graphs (as many of us don't bother to go in detailed documentation).
On Unix/Linux systems start Gnuplot by simply typing:
gnuplot

first the formal syntax :

plot {[ranges]}
{[function] | {"[datafile]" {datafile-modifiers}}}
{axes [axes] } { [title-spec] } {with [style] }
{, {definitions,} [function] ...}

To plot functions simply type: plot [function] at the gnuplot> prompt
gnuplot> plot sin(x)
gnuplot> splot sin(x*y/20)
gnuplot> plot sin(x) title 'Sine Function', tan(x) title 'Tangent'


Now for plotting data points firstly data points should be written in text file with axis ranges as columns.Data files should have the data arranged in columns of numbers. Columns should be separated by white space (tabs or spaces) only, (no commas). Lines beginning with a # character are treated as comments and are ignored by Gnuplot. A blank line in the data file results in a break in the line connecting data points. '
Plotting a graph from data file "plot.data" , do
gnuplot>plot "plot.data"

Now customizing the plot :



set xlabel "x-axis data"

# will set a label "x-axis data" in graph
set ylabel "y-axis data"

set title "x vs y"
# will set title for graph
set xrange [0.001:0.005]
# Change the x-axis range:
set yrange [20:500]
# Change the y-axis range:
set logscale
# plot using log scale
set autoscale
#let gnuplot determine ranges
plot "file.data" with lines
#will join data points with lines
plot "file.data" smooth csplines with lines
#will join plot graph using smooth curves
Gnuplot can mathematically modify your data column by column:
to plot sin( col.3 + col.1 ) vs. 3 * col.2 type:

plot 'force.dat' using (3*$2):(sin($3+$1))

To print graph (this will store graph in post script(.ps) file do this before plotting graph:

set output "graphs.ps"
set terminal postscript
plot "file.data" using lines


This will save the graph in graph.ps
For more help type 'help' in gnuplot mode :
gnuplot>help


somelinks
www.duke.edu/~hpgavin/gnuplot.html
A simple guide to GNU plot
Introduction to GNU plot

Friday, April 07, 2006

Useful Windows XP DOS Commands & Tricks

Typing DOS commands on the Windows Command Line prompt is a most efficient and faster way of doing things in Windows XP. Here's a run-down of the most useful DOS commands available in Windows XP. Some of these DOS commands even do not have an visual alternative. Digital Inspiration has a nice roundup of 10 very useful commands and tricks that can help you get things done quickly from the command line.
Useful Windows XP DOS Commands & Tricks [Digital Inspiration]

Related resources on Microsoft Website:
List of DOS Commands with Examples