Sunday, December 27, 2009

DOJO Charting and php mysql connection thingy

yesterday i was trying to get my ajax-php-mysql code working..
Following are the problems that i faced...
1. I wanted to avoid call to mysql_connect method multiple times because in my perception, this would lead to multiple handles to database and hence wastage of resource and time... I was trying to save the handle of database in $_session variable but it was fruitless because i was getting server side error that database not connected ... then i checked documentation of mysql_connect and it says that if same arguments are passed then no new connection handle is created.... This can be great abstraction as PHP does the job for you.. but some inflexibility as well that it does not allowing me to have multiple connection to back end.... but i guess my knowledge is incomplete so will update this space regarding flexibility issue...

2. JSON object parsing...
we can use many inbuilt functions... My understanding of this is still vague... I was sending text/plain data from server and calling JSON.parse($data) thingy to convert it to JSON object but in some cases i saw that data was received in JSON format.. means it was converted into JSON on server side itself...
basically read the data from server and store it in {"" : [{"":"","":""},{"":"","":""}] } form....

3. Third problem was related to DOJo charts...
there is no way in dojo charts to create custom labels.. which is bad... because my RA guys would be mad about it...

4. Ajax.. PHP... MYSQL.. JSON...AJAX handling... this is the sequence of getting this done...

For dojo charting quickcet source is ...
http://www.sitepen.com/blog/2008/06/16/a-beginners-guide-to-dojo-charting-part-2-of-2/
first and second blog here... best

SJ

Saturday, December 12, 2009

C pointers notes

http://www.ibiblio.org/pub/languages/fortran/append-c.html

This is also good... read it whenever u are confused

Thursday, December 10, 2009

Post about unix file system working

http://people.csail.mit.edu/rinard/osnotes/h13.html

Read this some time in detail...

Monday, December 7, 2009

i18n support for images and variable size text

http://www.alistapart.com/articles/slidingdoors/

I am struggling with i18n support thingy... so here it goes....

This page explains different ways of sending data between forms or pages...
1. URL
2. Form submit
3. Cookie transfer
http://www.plus2net.com/php_tutorial/variables2.php
SJ

Sunday, December 6, 2009

transfering data from host to guest machine on virtual box

I am stuck with this problem. I have Windows7 as host and Ubuntu as guest operating system. My wireless does not work on virtual box, neither the USB is detected. I tried to use the shared folder approach but that also throws error so i am basically handicapped due to this problem.
I tried to follows instruction given on this site but encountered error that "nautilus can not handle this kind of location". Totally stuck with no clue what to do...
Will update on how to fix this issue....

http://www.mydigitallife.info/2009/07/29/workaround-to-access-shared-folders-on-sun-xvm-virtualbox-from-windows-7-guest/

Friday, December 4, 2009

Comparison of RIP vs OSPF

I thought of reading the in depth comparison of RIP and OSPF protocol.
RIP : Count to infinity problem, slow convergence, O(M*N) complexity where M is edges and N is number of nodes
To solve count to infinity approaches are hold down, split horizon but still there are other issues like no sub net masking support. All nodes in the network should use the same sub net mask, some frame related issues... Network size should be small .. Hope count is just 15 ... moreover packets between neighbors are exchanged every 30 seconds...

OSPF: Intelligent routing with improved alternative to RIP. Link state, Main problem is flooding in the network for sending updates but by using proper sub net masking support and carefully fine tuning the parameter, this can be bettered.

Full comparison is present on this site so please look here....
http://www.networkcomputing.com/unixworld/feature/002.html?cid=ref-true

SJ

Monday, November 30, 2009

Few things in Dojo

I learned few things in DOJO:
1. Dojo.addonload(funcname)
this is similar to window.onload thingy... if we are using addonload thing then we should not use window.onload

2. dojo.query() I am yet to understand the basic flexibility that this provide...
However, it seemed useful while accessing dom element and defining events on them..
something like dojo.query("#idname").connect("onclick", function(){ });

3. Dojo.require is used to load the libraries

4. dojo.byId is similar to document.getHtmlById() or may be similar to document.getNodebyId() of javascript or DHTML

5. Dojo.connet is used for binding event with libraries...

Here is found a really well documented tutorial. I like well documented tutorial because they give a good head start...

http://www.dynamicajax.com/fr/AJAX_Chat_Usability_Additions-271_290_291_297.html
Chatting application in ajax... I should try this some time...

SJ

Saturday, November 28, 2009

Css Style and my lessons

I was playing around with layout, divs and css style properties.
Now it's always difficult to summarize all the experience but i'll try my best
This is what i learned...
1. Css wrapper div should be used to center the whole web site.
Now we should specify some width units and we browser size reduce beyond that value , then horizontal scroll bar will appear.
Also margin for this wrapper should be set to auto so that it'll be centered...
This code piece is used to center the website....

html,body {
height:100%;
margin:0;
padding:0;
text-align: center;
background-color: #999999;
}

#CenterLayout {
width: 1000px; /* set to desired width in px or percent */
height: 100%; /* This made me go nuts because i did not specify this height , Absolute value required here if vertical scrollbar is required below certain value*/
text-align: left; /* optionally you could use "justified" */
border: 0px; /* Changing this value will add lines around the centered area */
padding: 0;
margin: 0 auto;
}

2. Margin auto sets are outer padding values... In case of auto, it tries to place div at equal distance from left and right side div...

3. Float: left to make things left justified... i know this is not perfect... but i'll updated it as i learn more...

4. To put an image in the div and over lap text on it... i wrote this style

#CenterLayout #TitleSection {
position: relative;
top:0%;
left:30px;
width:50%;
height:25%;
// border:5px double #999;
margin:0 auto;
}

#CenterLayout #TitleSection #Title-background {
width:100%;
height:100%;
}

#CenterLayout #TitleSection #TitleContent{
position: absolute;
//margin: 15px 15px 15px 15px; /* No Idea about significance of this */
// border:3px double #777;
padding-bottom: 5px;
bottom: 0px;
left: 0.5em;
width: 90%;
height: 50%;
font-weight: bold;
color: #777;
//font-size: X-large;
font-size: 150%;
overflow: hidden;
text-align: center;
letter-spacing: 8px;
}

Now important point here is positioning attribute.
Position: absolute, place the div at absolute position relative to parent container.. so for this, we need to make sure parent container's width and height property. Also when we specify, absolute position then top, right, left, bottom... some of these properties should be specified properly.

If position is relative then top and left values are relative to self absolute position.


One very important thing to learn about vertical image resizing is:
1. in case of horizontal, screen appear in center and margins are left on both side, this looks ok because things are symmetric and space is filled. Note: here we set height as 100%

2. Now if we re-size the browser vertically then things can go messy, for example: text overflow can occur. To avoid this, we should specify the height dimension also to some value..
suppose u have an image and u position some text on top of it...
by horizontal width property of parent div, scroll-bar will appear and things will not go wrong.
This boils down to two things:
1. If we specify height dimension to some value then on very large browser window, we might see some blank space below the website ...
2. If we do not specify height dimension to 100% value, we need to find some way so that when image is resized while browser resizing then font that is overlapped on the image should also be resized...

Will write later...
SJ

Css layout and positioning

I was again struggling with the css layout of my project page...
Finally by hook and crook , i got something running and this link helped me a lot in the process...

http://www.barelyfitz.com/screencast/html-training/css/positioning/

CSS styling thingy, importance of fixed, relative and absolute positioning..

SJ

Friday, November 27, 2009

Internationalization and charting

I was searching for some java script toolkit which support Internationalization as well as charting support. I searched on internet and found this page...

http://kauriproject.org/wiki/g1/g4/g2/69-kauri.html
This page gives a brief overview of major JavaScript tool-kits in the market.
It covered negatives well but it did not distinguish deeper into their positives.

Finally i decided to go for DOJO toolkit as it is the one which charts as well as i18n support.

SJ

Thursday, November 26, 2009

Java, C++, C and web programming

Nowdays i am coding in so many things that i just mix up things badly.
to overcome this situation, i should take test from time to time..
so here i go for Java:

http://cyber.gwc.cccd.edu/faculty/hcohen/Java5Ch11MCAnswers.txt

SJ

Common mistake while allocating pointers and good programming practice

http://www.eskimo.com/~scs/cclass/int/sx7.html

Malloc may fail so it is always good to check the return value of malloc and then proceed..
One can also write a wrapper function to malloc which return space allocated to void pointer. We just need to type case this to desired data type..

SJ

Wednesday, November 25, 2009

stack vs heap allocation

A very frequent and obvious question to mind...
what are different segments and from where storage is taken to assign space to variables...

Code segment --- compiled code, static link files etc..
Data segment -- stack and heap
stack --> function calls and variables with in function... main is also a function
heap --> static and global variables

Now big question is:
How does memory leak happens...
Suppose i define some variables in a function,
variables allocated memory in stack,
and when function call returns then all that memory is de-allocated..
By de-allocation means top pointer of stack returns to point to callee function.

Now if i do not free that variable space and set the content of memory location to null then that might be disaster because it'll result into memory leak but i dont understand why did memory leak happens... Which variable is holding that memory.. Where the pointer variable allocated memory from

Will freshen up my concept and then updated this stuff...
till then u read this...
http://ee.hawaii.edu/~tep/EE160/Book/chap14/subsection2.1.1.8.html

Recently added features in java

These are some recently added feature in java's new version

Strings in switch is the interesting one....
http://code.joejag.com/2009/new-language-features-in-java-7/

Tuesday, November 24, 2009

css sytle, three column layout and float property

http://webdesign.about.com/od/csstutorials/ss/css_layout_sbs_9.htm

This link is really useful in understanding three column layout but bad thing is that it hard code the div size instead of using %..

Some good tips for newbies...
http://webdesign.about.com/od/layout/a/aa062104.htm


Fixed vs liquid layouts..
http://webdesign.about.com/od/layout/i/aa060506_2.htm

Excellent tutorial on centering a web page layout...
http://blogs.techrepublic.com.com/howdoi/?p=186
http://www.wikihow.com/Center-Web-Page-Content-Using-CSS

One doubt still remains and that is how to get away with fixed width parameter and use percentage in whole of the page...

SJ

Sunday, November 22, 2009

Globbing a directory in perl

To glob a directory is very simple in Perl.
We just have to use these three lines of code...

#!/usr/bin/perl -w

@files =
# FILEPATH can be like *
# for all html files it can be /var/doc/*.html

foreach $filename (@files){
open FILE, "<$filename" or die $!;
# do my 50 things
close FILE
}

Wednesday, November 18, 2009

Bug algorithm on robot... Difficulties on running on actual robot..

It was way more difficult and frustrating then we (Me and Konrad) initially thought.
The major problems and issues that we faced are summarized below:

1. Specifying laser driver in .cfg file

2. Timeout problem .. Laser takes time in starting
red and green light issue

3. Serial port issues...
Identifying which port on serial device.. laser is sending the output

4. Inserting the USB in correct side.. because one USB port is for serial tty/USB0 - tty/USB3 and other is for 4 to 7

5. Robot battery low so some time output is not returned well.. Make sure above 10V

6. Software related measurement issues:
a. Rotating more than desired angle
so for this we had to decrease the turnrate as it was reaching near to desired rotation value... also after it stops rotating we were checking if we need to rotate in opposite direction to get exact rotation...

b. Laser not returning data and some time data is not that accurate...

c. On stage things are simple but pioneer was behaving in lot more erratic way due to extra rotation and movement related problem... we had an accuracy of 66% in our case. when robot follows the wall accurately.

d. Path on stage was way different from actual pioneer because actual pioneer had lot of extra rotation and extra steps kind of problem... on stage it was more smooth path than on actual pioneer... We calibrated lot of variables in movement related to exact positioning and used those error correction parameters in the code...

so for example... while checking slope or distance from a point... we had to use some error value and anything lying between expected output - error value was taken as right value or condition fulfillment


After all this.. our robot does not work correctly in all the scenarios but it executes the wall following well in most of the cases...

Problem was also that there was never enough space to carry out this experiment. even if we take obstacle or wall detection distance to 1.0 meter then robot starting sensing other things because in the path their was alwyas things falling within that space...

If we give less than that then robot some time gets too close to the wall and while rotating and moving further, it collides with the wall..

Will post more difficulties later...

Tuesday, November 17, 2009

Embedding anything into the web site

This seems to be really nice page...
Informative too... read in detail some time...

http://www.labnol.org/internet/how-to-embed-in-html-webpages/6365/

SJ

PHP based login form code and style sheet issues

1. I was trying to setup login mechanism in my PHP based mechanism.
for this, i thought of using direct code from internet.
i found this code snippet to be really straightforward.

http://www.phpeasystep.com/phptu/6.html

2. This took my lot of time. I wanted to stretch my image in such a way that it fits to the window and on resizing, it should not create any issues.

Idea was to create two div and use image tag in one of the div. set the z-index to -1
Do the regular stuff in other div and set z-index as +1. there are few other things like padding and position that we need to take care so for that i copied the code from this site....
http://www.quackit.com/html/codes/html_stretch_background_image.cfm

SJ

Monday, November 16, 2009

php select problem...

First thing...
if sql code is not working then wants to see the output then first go to php directory and from command line say some thing like this:

php.exe

this will through the error and u can fix it accordingly...
if we call from browser then there is no way to find the error message..

second is:
Use "" quotes while forming html string and '' while forming sql string.
i am not sure if this is the rule that should be followed to fix my problem but this is the way it works...

SJ

WAMP setup

For a while i was struggling with wamp setup.
The problem was that PHP-mysql connection was not working properly.

I followed instruction on this page to set things up for me.
http://www.devarticles.com/c/a/Apache/Installing-PHP-under-Windows/5/
http://httpd.apache.org/docs/1.3/windows.html#down
http://forums.mysql.com/read.php?52,69846,69846#msg-69846

The problem was that i had not un-commented php-mysql connection lines in the php.ini file located in apache2.2 folder in program files..

SJ

Sunday, November 15, 2009

CEGUI skinning

I had this problem of not able to align text properly on top of button in vanilla skin of cegui. I decided to switch to taharezlook as it provides more options for windowing as well as text alignment property.

This was seriously tricky. I was in no mood to read that tutorial so just jumped into data files to see what can be done.
CEGUI follows a layering based approach for any widget.
General CEGUI widget looknfeel looks likes this:







.
.


use the properties value


.
more layers
.
.




CEGUI also provides controlProperties which helps in hiding some of imagery section and make other accessible...

By this way, i separated the logic of default image and custom image of button in taharez look and without using imagebutton thingy, i achieved "text on top of image acting as a button" functionality.

Now i am starting with WAMP model.. my first major foray in PHP.. till now i used to work on j2ee....
--Saurabh

Wednesday, November 11, 2009

Internal working of a router

This page explains the internal working of a router...
I remember reading once but was not able to find the page... so here it is..
http://www.erg.abdn.ac.uk/users/gorry/eg3567/inet-pages/router-opn.html

Thoroughly explains the internals...

Sunday, November 8, 2009

Interfaces vs abstarct classes

This page gives a very nice and detailed discussion on interfaces and abstract classes...

http://mindprod.com/jgloss/interfacevsabstract.html

SJ

Friday, November 6, 2009

Color recognition using openCV

Nowdays, i am working on sonar sensors and color detection problem using openCV...
For sonar sensors...
-> In built support for pioneer robots..
-> Problem at corners
-> Range generally 15-20 m
-> Use sound waves

For OpenCV based image capturing and recognition ...
I am still wondering on how to proceed on this... My sub task is to mount camera on robot, take pictures of object, trigger the color detection code and take appropriate action.

Will post more on this as i learn more details...

SJ

Friday, October 30, 2009

cegui ogre and theora plugin work

For past few days, i was struggling with cegui theora and ogre plugin work. Today i got it working with help from Vamsi...

This documentation is for windows operating system. I specifically tried on window XP but i am not sure if this work on other versions or not. However if we have operating system compatible libraries for each required component of setup then we can hope that it'll work.

First we should get OGRE installed on the machine. Set the (OGRE_HOME) variable.
Get the CEGUI setup working on machine. So make sure that CEGUI and OGRE based dll and lib files are present on the system. If possible, try one CEGUI-OGRE based hello world kind of program.... This is an appropriate application to start and test OGRE and CEGUI...

http://www.ogre3d.org/wiki/index.php/Basic_Tutorial_7


Once we have CEGUI and OGRE working then open this page and try to compile the theora-videoplugin...

The bad part about this video plug-in is that there is very less to no documentation available on internet...

For compiling.. Following points need to be kept in mind...
1. Create a folder TheoraPluginThingy
2. cd into the folder

[...All steps in this "TheoraPluginThingy" directory...]
1. Get libogg
2. Get libtheora
3. Get libvorbis
4. Get ptypes
5. Install tortoiseSVN [if you don't have] and get the Theora-Videoplugin code

Start with libogg...
Search for dynamic solution file and compile it...
Check for the size of .dll created in output directory... This directory is set in properties... so check there...

Now cd to libvorbis directory
Search for dynamic solution file and compile it...
There is a readme file so dont forget to read that..
Also you may need to correctly specify the version of "libogg" that you use in file "libogg.vsprops".

Now one problem here is with file vorbis.def...
In this file you may need to modify one line...
_analysis_always_output One may need to put a semicolon before this line...


Now cd to libtheora directory
Search for dynamic solution file and compile it...
Don't forget to read the readme file and set the versions of both libogg and libvorbis in the corresponding .vsprops files...

Also one file lib/theora.def might be missing so get it from this location http://svn.xiph.org/trunk/theora/lib/theora.def

Now enter the ptypes folder and create a static multi-threaded library...
for this.. there are multiple solution files so pick ptypes_lib and compile and build it... Check for generated static lib in output folder...

In project settings.. make sure that in configuration properties... it is set to static lib
and C++/code generation is set to "multithreaded dll"

Now follow the instruction on the "theoraplugin" compilation web page and copy all the includes, dll and lib files to appropriate locations...
also copy ogremain.lib and ceguibase.lib files to appropriate folder in TheoraVideoPLugin folders lib directory...

Now change the project setting and include the Ogre_home/include location as well...
Mine looks like this... for all for solution files ....
..\..\TheoraVideoPlugin\include;..\include;"$(OGRE_HOME)\include";"$(OGRE_HOME)\samples\include"

Now theoraplugin dll will be ready after compiling....

Now to run the demos in demos/player folder...
Check the properties...
Change the resources.cfg file.... put it at appropriate location..
points to media folder at appropriate place...
Change the plugins.cfg file and get TheoraVideoPlugin and other dlls like libogg, libhteora and libvorbis..
Run the application... Debug a little and read the log files generated ...

Hopefully this will make your things work....

Will refine this draft later... SJ

Wednesday, October 28, 2009

password problem for ubuntu

I remember once i forgot my ubuntu password and because i was not aware of hacking fixes so i had to reinstall my OS. I was thinking about that and found this useful forum page which explains in detail that how vulnerable are Unix and Windows machine to hackers.... and how important it is to set a grub password...

http://ubuntuforums.org/archive/index.php/t-3609.html

Tuesday, October 27, 2009

cl : Command line error D8003 : missing source filename

This error was coming because i misplaced a quote around library inclusion in the properties window of the project.
Wasted my 35 precious mins...

SJ

Sunday, October 25, 2009

CEGUI OGRE THEORA

This link will help in cracking some of the issues that i am facing.
http://www.wreckedgames.com/forum/index.php/topic,894.0.html

This will also help in basic setup...
http://www.cegui.org.uk/phpBB2/viewtopic.php?f=4&t=154&start=15

Next thing is to download ogg, vorbis, theora, ptypes and theora video plugin...

Do a static build for each of them in the order... and get basic theora set up ready..
If this much work is done then i can focus on rest...

SJ

Stuck with OGRE-CEGUI-Theora plugin...

Nowdays i am stuck with OGRE-CEGUI and theora plugin....
There is no explicit documentation available....

Seems to render the video, i need to extract the video texture and audio texture of the file... Once i have that then i need to load the material to render that texture...

Once i render it, it should run... Will try once more and then will write the tutorial...

till than njoy.... deadline... tomorrow... wuhuhuhuhu

Thursday, October 22, 2009

Some java concepts:

Purpose of defining the constructor private:

1. To make the class singleton
2. Making constructor private will not allow any other class to make object of this class or in other words, this class can not be sub classed...

Tuesday, October 20, 2009

Virtual memory

I found this link to be very concise and beutiful.
http://williamstallings.com/Extras/OS-Notes/h9.html

Read in detail sometime..

Thanks

Monday, October 12, 2009

Problem fixes...

Nowdays i am not frequently logging all my problems...
so lets do it now...

1. .player file generated in player-client assignment of robotics class...
I worked with Makefile. Problem was that initially i was using eclipse C++ plugin to program all the stuff.. i had to put libraries for compilation and linking so i was not adding linker library or may be the path was wrong.. I tried many things and one of them worked.. Basically point was to look into all the properties of building and change some things in compile and linker... in compile i was supposed to add the path and same with linker .. somewhere i was also supposed to specify .so file name....

Apart from this... i was supposed to find that where those files exists in the system so for that use of pkg-lib command was handy...

Second .. once i removed ported my project to department machine then i was supposed to change entries in makefiles....
so for that i used pkg-lib command to bring all the libraries...
then i used -I flag in makefile compile thing....

once i'll see it again.. i will recall exact syntax...

Now i am stuck with CEGUI and OGRE work of my RA....

Thanks
SJ

Saturday, October 10, 2009

Significance of virtual destructors...

Earlier i thought that virtual destructor are used to make sure that all the data pointers, memory blocks are freed when object gos out of scope...

But the actual significance of virtual keyword is that it allows the derived classes to override the base class destructors... this way when we delete the object of derived class at the end of all our work then derived class destructor is also called...


This link explains this better...
http://www.codersource.net/cpp_virtual_destructors.html

Saturday, October 3, 2009

Player - Stage work

I am totally stuck with this player/stage thingy...
Trying to work on my assignment of robotics where i need to move a robot on a plane while avoiding all the obstacles...
Just wondering how would i get the world information...

1. May be some way to read from world file... but not able to find any API to read from world file or finding the obstacle information...

2. Passing separate file which specify the environment... Logically this idea is offensive... so not possible...

3. Using sensor... Dont know how would this work.. This seems to be the ideal solution to my problem...
Let me try this...

Friday, October 2, 2009

C++ vs Java

Java-- garbage collection..
C++ no collection...

Java-- No virtual keyword.. Java has equivalent final keyword but notion is opposite...
i mean in java we have to explicitly say final but in C++ we explicitly say virtual....
[credit.. Will]
C++ Virtual keyword

Java-- Package
C++ Namespace

Java-- No operator based polymorphism
C++ Polymorphism

Many other.... will write later... Tried a bit now...

Saturday, September 26, 2009

Priority Queue discussion...

Priority queues are really important data structure in operating systems and network.
In operating systems it is used in scheduler for scheduling process according to their priorities... while in networks in it used to schedule packets of different protocols for scheduling the packets...

Priority Scheduling packet... http://en.wikipedia.org/wiki/Priority_queue

Saurabh

Comprehensive list of Algos questions..

Apart from reading the list and question that you have already..
Just look at these questions.. Some of them are good...

http://inder-gnu.blogspot.com/2007/03/detecting-and-fixing-linked-lists-loops.html

Get started with basic Latex

Recently i had to write a report in latex.
Started as following:

1. Installed latex on ubuntu...
sudo apt-get install latex

2. Installed a pdf reader on Ubuntu..
i chose to install xpdf for this purpose.

After this to test the latex thing..
vi firstExercise.latex

Opened up a file:
\documentclass[11pt]{article}
\begin{document}
This is the tex file...
\end{document}

!wq

To convert this latex to .pdf extension...
>>latex firstExercise.latex
This creates a .dvi file...

>>dvips -Ppdf -G0 -f -o firstExercise.ps firstExercise.dvi
This creates a .ps file...

>>ps2pdf firstExercise.ps firstExercise.pdf
This creates a .pdf file...

Read this file using xpdf...
We can view this file and feel happy and excited about putting our first step in Latex world...

Saurabh

Monday, September 14, 2009

Visual C++ application

'MessageBoxW' : cannot convert parameter 2 from 'const char *' to 'LPCWSTR'

Solution to this is to change the character set to multi-byte character in project properties.

I encountered this while trying to run some basic application on OGRE....

Sunday, September 13, 2009

Arithmetic Operation allowed on pointer

Only arithmetic operation allowed on Pointers us:
1. Addition of integers to array address
2. Subtraction from another pointer

No other operation is allowed. For instance division, Multiplication and addition is not allowed.

Friday, September 11, 2009

Installtion of OGRE and Visual studio setup

1. Visual studio setup-08

Go to dreamspark.com
Create account
Get the key
Install download manager
Download the Visual studio professional edition
Run the "autorun.exe" utility

I wasted my lot of time due to not using download manager.

2. Download the prebuilt SDK of OGRE from their site. Run it and install at some file path which does not include spaces.

3. Download OGRE wizard. This helps in some situations like having an OGRE SDK option on your "new project" link.
Try running this. This might be useful.

4. Setup a new project and run it. Be careful about the properties setting.

Will post later...

Will also try to install CEGUI thing tonight... so tonight is going to be the installation night... or may be tomorrow morning.
Let's see what productive thing i can do today.

OGRE, Visual studio and CEGUI

Today i spent whole day on setting up OGRE and Visual studio on my account.
This was highly frustrating experience. I am a Java developer and usually prefer Eclipse as my IDE. Eclipse is really simple and intutive in its setting. I found Visual studio to be highly complex and ridiculous at some points.

Just to mention, whenever i create a new project my old projects are automatically closed. If i want to keep both of them open then i need to put them in same solution scope which is poor. Moreover all the files are dumped in the same folder and i need to create folder in the actual disc location to put some structure to the application.
I don't see the use of filters as they just get flat when i open the actual project location.

Will keep you posted on this.

Cabinate files .. Invoking local files from Html page

I was stuck at work as i had to find some way so that i can execute local file system files from the application running in web browser.
started googling and my collugue stumbled across the concept of .cab file and Object tag in html page. As brwoser just understands few mime-type so i was not sure if it can execute some exeutable present on file system. I thought it might have security concerns and brwoser might not support that MIME type but we found that browser has this octet-stream mime type which can be used to execute the .cab file.

MSDN provide some platform SDK which can generate .cab file for set of executable. That can be used to generate .cab file. In order to run that file from browser, we need to change the browser's security settings. Browser's security settings can be changed or .cab file can be signed by using certificate generater program. One such program was also provided by microsoft MSDN library.

Finally we were able to generate cab file and execute a local file system application from a button click on HTML page.

Tuesday, September 8, 2009

This explains the JSP and form processing well

http://www.j2ee.me/products/jsp/html/jspbasics.fm2.html

Rest later

Saturday, September 5, 2009

Strut Spring Hibernate and delegation pattern

I am reading about delegation pattern today...
Delegation pattern is used when a class A expresses some behavior or exposes some functionality using some API's but actual implementation is delegated to classes behind this class A. This enables putting one more layer between the classes.

Class A also provides API's so the client code which uses instantiate class A can also choose which supporting class functionality it should choose.

Wiki page has nice description on this with example:
http://en.wikipedia.org/wiki/Delegation_pattern



Second pattern that i was reading today was DAO pattern.
This pattern allows independence of data access resource mechanism and client side code. In raw terms, if back end resource changes then client side code should not be modified.

This page describes it best. http://java.sun.com/blueprints/patterns/DAO.html

Rest later

Thursday, September 3, 2009

Internationalization in a web application

Two methods:
First to have each page in all supported languages.
Useful when whole web application needs to be internationalized.
A Servlet controller will pick the right page after extracting the browser/request locale settings.

Second is to use resource bundles where single page is maintained but part of page which needs to be internationalized is maintained as resource bundles..

Monday, August 31, 2009

Reading about XFS file system + AVL tree algo

XFS file system uses Journal file systems approach. Journal approach allows XFS to keep file consistent even in the event of crash...
The main approach is to write all file update related operation in a circular buffer (Journal)... This journal will never be read during normal file read operations. If system crashes then we can use that jorunal memory to keep file system consistent.

Second, AVL tree came into existance because in case of sorted data insertion in Binary search tree, it takes O(N) time... so balanced search tree approach was used so that O(logn) time insertion can be done...

SJ

Friday, August 28, 2009

List of some paper that i read recently.....

Related prof. jon weissman research:

Resource Bundles: Using aggregation for statistical wide-area resource discovery and allocation

SIP-based Voip traffic behavious profiling and its applications

Practical techniques for eliminating storage of Deleted Data

Exploiting Heterogenity for collecive data downloading in volunteer based networks

Adaptive reputation-based scheduling on unreliable distributed infrastructure

Ridge: Combining reliability and performance in open grid platforms

Exploiting the throughput-fairness tradeoff of dealine scheduling oin heterogenous computing envieonments

Co-designing the failure analysis and monitoring of large scale systems

Thursday, August 27, 2009

Times now...

Presently i am facing the most exciting , challenging and uncertain phase of my career...
In order to follow the heart, i am killing my opportunities, ignoring avenues...
Lost in thoughts and time, i am


Will complete it later...

Sunday, August 23, 2009

KMP, Boyce moor and brute force

I was revising my concept on these algorithm....
Once i was master of algo but after staying out of touch lately, i feel my algorithm skills have gone blunt....
here i jump back...
KMP:
Practical Use: In reading data from network streams and large files...
More fruitful when alphabates are small...
It is claimed to be faster if mismatch occurs later in the series...
Prefix-suffix approach. Each alphabate of pattern to be searched is just traversed once.

Boyce moor:
Practical Use: Faster when alphabates are large and slow when alphabates are small...
Back-traversal based appraoch.

Brute force:
Practical Use: Poor for binary usage...
just O(n*m) solution...

Rabin carp:
Practical Use: Hashing function based approach...
Efficiency depends on hash functions quality...

Tuesday, August 18, 2009

This is my favorite read...

http://intellibriefs.blogspot.com/2007/06/indian-intelligence-another-sneak-peek.html

Indian Intelligence...

Wednesday, August 12, 2009

Java vs C++ .. for programmers

http://www.javacoffeebreak.com/articles/thinkinginjava/comparingc++andjava.html

This site lists detailed differences between java and c++

Footbal game design in Java

Classes:

public class Player{

/**
Personal Information
*/
protected String _name;
protected String _address;
protected String _bloodGroup;
protected String _age;
protected String _sex;

/**
Game related Information
*/
protected Team _team;
protected Position _position;
protected Vector neighborList;


}


public class ball{
protected Position _position;
protected Player _possesion;

public void kickBall(force x, angle y){

}

public void changePosition(position x, position y){
// move from position x to position y
}

public void drawTrajectory(){

}

public boolean isGoal(){

}

public boolean isValidGoal(){

}

public void pass(Player x, Player Y){

}

}

Think more on the API's of this game.

When to use b tree and when b+ tree

B trees are specifically used when we need to seek the data... In case of b trees, frequently seeked data can be moved up in the tree so that next time less number of access or look ups would be required.

B+ trees are used when we need to do full scan. Some other advantage of B+ trees is that high fanout, less seeks required as more pointers are available for data lookup which is in contrast to B tree where intermediate nodes stores data values which waste the look up pointer space.

In B+ tree, leaf nodes are connected as linked list which makes it easier to traverse.
Also in B+ tree, depth of the tree is small and a uniform implementation can be achieved as non-leaf nodes acts as indexes and leaf nodes acts as data holder...

Practically... indexes can be placed in the cache while actual data can be placed in the hard disk.

For detailed analysis:
http://stackoverflow.com/questions/870218/b-trees-b-trees-difference

Also look into wikipedia articles on addition, deletion of nodes...

Static binding vs Dynamic biding..

http://geekexplains.blogspot.com/2008/06/dynamic-binding-vs-static-binding-in.html

This page explains the difference of static binding and dynamic binding in java...
To summarize:
All the instance method calls are resolved at runtime so that is dynamic binding.
All the static method calls are resolved at compile time so it is static binding.

As the static methods are resolved at the compile time so it is not possible to override them.
As java does not allow polymorphism so all the member functions are resolved at compile time only.

Similarly private methods are resolved at compile time only as they are never inherited..

Friday, August 7, 2009

JSP notes

Just now i cam across few of good JSP tags:

1.
2.
3. <%@ errorpage=pagename />
4. <%@ iserrorpage>

This page explains the basics of main jsp tags:
http://www.geocities.com/srcsinc/java/java_tutorials/jsp_tutorials/jsp_tutorial_6.html

Using log4J class in your code...

This page describe th importance and usage of log4J library.
It's a strong library with wonderful utility like logging levels and logging inside threads...

http://www.avajava.com/tutorials/lessons/what-is-log4j-and-how-do-i-use-it.html?page=2

Read this page for more details..

Tuesday, August 4, 2009

Make your code rebust and professional

I learned about how to divide code into components and how thinking little before coding helps in good design and fast work.

Using logger module and using separate error module in the system helps in making code good.
Use a file like errorConstants and define all the error messages in a hashmap.

Define this hashmap as a static object. Declare a custom exception and define some constructor

To be completed later....

Friday, July 31, 2009

Factory Pattern, Visitor pattern, Aspect oriented programming and spring framework

Today i read wikipedia articles about visitor pattern and factory pattern...

Factory pattern is useful when u don't know the type of object that you are invoking..
You separate the logic of identifying the object type and invoking the desired method on that object type in factory class.

Basically term factory method means any method that creates objects. Whenever u wish to invoke the object, u create the factory class object and pass the information to this class which figures out and invoke appropriate object.

Visitor pattern:
Suppose there are four components in the system and all of them have common method like print or run or act... so instead of doing a implementation of common method in each of the subclass, a new interface is defined which declare common method for each component. A new class which extend to this interface implements the component specific functionality in class code. This way we separate the code of common method from sub classes.

Aspect oriented programming:
The piece of code on wiki gives a wonderful insight into this. Suppose u have bank transaction code. Here a method transfer money from one account to another. For sake of security and system services like logging and database transaction, a lot of checks will be introduced in the code. This is bad because in future if logging functionality changes or security changes then transaction code will have to be changed. This leads to cross cutting concerns. cross cutting means the logging module is cutting across other module so it creates problems. To avoid this aspectJ should be used. In this all the cross cutting code is specified in a separate file as aspect. This file defined the join point and point cuts which helps in separating code.

Spring framework:
Powerful framework with lot of features. Yet to understand it's role in j2ee applications fully.

SJ

Reading and writing files in java

I always forget the exact syntax of lines in java for reading and writing files...

Reading files:
Convert the file to inputstream or outstream and then read or write to the file using streamReader or streamWriter...

Create the fileReader from the file and read that fileReader using bufferedReader

Use scanner to read file by line by line...

Thursday, July 30, 2009

Communication between JSP and Servlets

getServletConfig().getServletContext().getRequestDispatcher(”jspfilepathtoforward”).forward(request, response)

Deep copy vs Shallow copy

If the object is having any pointer then deep copy is preferred because in case of shallow copy, if pointer is changed or object is destroyed then dangling pointer problem may arise.

Wonderful post on pass by reference and pass by value confusion of Java
http://www.javaworld.com/javaworld/javaqa/2000-05/03-qa-0526-pass.html

Values of reference is passed by address and reference itself is passed by value.

Abstraction vs Interfaces

Abstraction: Default implementation of set of methods.
Compulsive use of extends variable and overriding of default functionality
Better to be used in application framework where a default implementation is required in case component does not implement their own. Like event handling service, Messaging service etc..
If variables changes often then use abstraction

Interfaces: Abstract methods and final variable
Provide conceptual structure to whole application.
Allow Multiple inheritance
If methods are changed frequently then use interfaces.

For example: Interfaces/ Need for multiple inheritance

Two kind of people: actor / director ..
for each of them we define one interface but now what if there is third kind for people who are both actors and directors....

In such scenario we need multiple inheritance...

Need fr abstraction:

Abstraction in big application framework to define default handling.


Inheritance vs. Abstraction
When functionality is to be imposed on unrelated classes then use interfaces...
When functionality is to be used on related classes then use abstraction..

Related classes: GenericList singlelinklist doublelinklist... all have the similar properties and methods...

Unrelated Classes: some function in interface which should be implemented by many component in the system.

Sunday, July 19, 2009

Tricky to see which process is using which port

http://www.mydigitallife.info/2008/12/03/how-to-check-and-identify-which-application-is-listening-or-opening-port-80-and-443-on-windows/

First run netstat -o -n -a
then find the process id and use this process id to find out process name and details...

Friday, July 17, 2009

To setup netbeans on Ubuntu

http://www.javadesign.info/SystemsHardware/OS/Ubuntu/install-netbeans-on-ubuntu

This page describes things wonderfully...
Hope this helps...

issues with my Eclipse and Jaxb setup

I was struggling a lot with my eclipse and jaxb setup.
Ultimately it turned out to be eclipse java settings on Ubuntu.

I was supposed to use sun java-6.0 but for some reason my eclipse configuration was picking up gcj-java.

In the process, i used following tricks...

Change eclipse java preferences in
/etc/eclipse/java_home

Change the by default installed JRE setting in eclipse>window>preferences...

Checked the installed vm of eclipse by looking into eclipse>help>about eclipse platform>configuration details

Changed the default JRE that needs to be included in the project while creating the project...

sudo update-alternatives --config java

and somehow it worked for me...

Saurabh

Monday, July 13, 2009

JSP notes

http://www.jsptut.com/Declarations.jsp

Understand the importance of
<%= %>
To embed single line expression in the code

<% %>
To write a code block

<%! %>
Declaration to enclose your declarations

<%@ %>----> Importing some java library
for example: <%@ page language="java" import="java.sql.*" %>

Variables should not be declared as global otherwise there would be synchronization issues and performance will be hurt. Ideally all the variables should go into request or session object.

Thursday, July 9, 2009

Jetty deployment

For deploying on Jetty there are several ways...
1. Download the binary zipped file from source forge...
2. Extract the file and start it using general instruction of
java -jar start.jar etc/jetty.xml &
3. Create the war file.
inside war file..
4. Add a context file in contexts folder for hot deployment
For static deployment--> check the jetty.xml page

This link should help...
http://docs.codehaus.org/display/JETTY/ContextDeployer

This is the directory structure while deploying servlet on any servlet container

base directory/ (this is the name of your war file)
JSP files
image files
HTML files
CSS files
any subdirectories containing additional JSP, HTML, images, and CSS
WEB-INF/
struts-config.xml
web.xml
TLD files for various tag libraries
lib/ (various .jar files for libraries you used)
classes/ (compiled .class files for your actions and action forms)
META-INF/ (this is part of the .war file)
MANIFEST.MF (the manifest file from the .war file)

Underneath the classes directory you would have compiled code for forms and actions. For example:

com/
johnmunsch/
strutstest/
actions/
LoginAction.class
SearchAction.class
forms/
LoginForm.class
SearchForm.class

This is a wonderful page which tells about the services described Tomcat file structure and installation stuff

http://linux-sxs.org/internet_serving/c292.html

Wonderful.. Wonderful

Jetty server installation and running details...

This is the Jetty server page...
Just download the jetty source from Jetty download page...
Read the instructions in README.txt for details...

Jetty is faster than tomcat or resin and easy to configure as well...

This page describe the things better...
http://helpme.morphexchange.com/jetty6/help/items/chapter_3_navigating_through_jetty6

Saurabh

Wednesday, July 8, 2009

Application server vs web app server

http://www.javaworld.com/javaqa/2002-08/01-qa-0823-appvswebserver.html?page=2

This page describes the best scenarios in which application server and web app server are most suitable.

Thanks
Saurabh

Tomcat and Jetty

Now days i am trying to get jetty-spring-hibernate framework running...
Here are the things that i find interesting....

Apache:
How to run apache on a different port?

1. By default Apache runs on port 80.
2. To change the port or add additional listening ports...

nano /etc/apache2/ports.conf

-- change
listen 80
-- to
listen 80
listen 8080

sudo /etc/init.d/apache2 restart
This will make apache listen on 80 and 8080. You can make it listen any other port that you want.

Tomcat:
How to change the port number on which tomcat runs?

Tomcat is a HTTP server and generally HTTP servers are related to port 80 so ideally tomcat should run on port 80 but default port for tomcat is 8080.
The reason for this is that Tomcat is good for handling Java and Jsp / Servlets code but it is not efficient for static page serving and other server side languages.

In some cases overhead of running tomcat on top of apache is poor so we can change default port of tomcat to 80.

To change the port.. We need to server.xml file
Also other way of port handling is to use kernel iptables to forward any request coming on port 80 to forward to port 8080.

Tuesday, June 30, 2009

Very Important page for linux and bsd related articles

http://www.scottro.net/

It explains lot of things... Proper way of troubleshooting and setting up stuff on linux.

Saurabh

Hosting files on apache..

Use this link... explains well
http://www.debuntu.org/2006/02/22/7-virtual-hosting-using-apache-2

1. Put files in var/www/ folder
2. Create a file in sites-available folder
3. Create a soft link in sites-enable folder
4. Change the /etc/hosts file
like 127.0.1.1

restart apache
sudo /etc/init.d/apache2 restart

What is factory pattern

The Factory Pattern promotes loose coupling by eliminating the need to bind application-specific classes into the code.
The Factory method lets a class defer instantiation to subclasses" Thus, as defined by Gamma et al, "The Factory Method lets a class defer instantiation to subclasses.

Will write about it later.

Wednesday, June 24, 2009

leanring spring and hibernate

Today i'll start learning about spring and hibernate ...
To become a full fledged expert in this field. i need to learn few prerequisite to these technologies... I'll try to implement small applications using all these technology and i hope it would extend my knowledge base.....

Hibernate: Relational data modeling, transaction processing, relational database design
Spring: Design patterns, dependency injection, application design, MVC, class and package dependency, application tiers, security and web standards

Before doing all this...
I am going to pursue this course and crack J2EE
http://www.javapassion.com/j2ee/#Introduction_of_this_course

Wonderful course...

Thursday, June 18, 2009

Link for UML understanding of developers

http://edn.embarcadero.com/article/31863

This link explains best the use of UML for developers perspective..

Saurabh

Thursday, June 4, 2009

JavaScripting Namespacing

Best way of extending a namespace in javascript
http://www.dustindiaz.com/namespace-your-javascript/

var DED = function() {
var private_var;
function private_method() {
// do stuff here
}
return {
method_1 : function() {
// do stuff here
},
method_2 : function() {
// do stuff here
}
};
}();

Saturday, May 30, 2009

Finding out version of ubuntu

Following commands helps in this:
lsb_release -a

cat /etc/issue

This will tell which version of ubuntu are you using.

Friday, May 29, 2009

Creating objects in javascript

http://javascriptkit.com/javatutors/object.shtml

This will help in understanding the main concept of prototype chaining in Java-Script.
This also explains the need to maintaining the correct order while writing the code.

Prototype chaining helps in implementing concept of inheritance in javascript code.
This web site explains this with the help of circle and sphere example. It explains that how circle class method and properties can be used in sphere class.

function mySphere(x,y,z,r){
// DO SOME THING
}

mySphere.prototype = new circle();

Creating a custom object in JavaScript

http://javascriptkit.com/javatutors/object.shtml

This include three steps:
1. creating custom object function
2. adding properties
3. adding methods



Go through the tutorial and you will understand the crux.

Ajax with jQuery

http://www.dreamdealer.nl/?action=viewTutorial&id=67

Using ajax with jQuery is simple.
I see multiple methods on web. some call like
$.ajax({
type: "POST|GET",
dataType: "json|xml|....",
url: "index.php||.....",
data: param{i guess name value pairs but i am not sure},
success: function(data){
if(data.status==0){
// take action... In general programming practice,
// trueSuccess will be a function which will be called with data as argument.
// In this case, trueSuccess is an event which will be triggered ....
// This event is having some data as argument...
$("#"+listener).trigger('trueSuccess',[data]);
}else{
$("#"+listener).trigger('trueError',[data]);
}
},
error: function(){
data='An Unexpected error has occured. Please try again later.';
$("#"+listener).trigger('unexpectedError',[data]);
}
})


Ajax another way:

$.get("giveMeSomething.php", { number1: number1, number2: number2 },
function(data){
alert("Data Loaded: " + data);
});

Thursday, May 28, 2009

Jquery: Random notes....

$ itself is an alias for the jQuery "class", therefore $() constructs a new jQuery object.

find() function allows you to research the descendants of already selected elements.
each iterates over all the elements applied to selected class or ID and do the further processing.

$() aka jQuery(), is basically an implementation of the Factory
Pattern, in which one object is responsible for the creation of other
objects. Of course, it also follows the Prototype pattern; given that
JS is a prototypal language and that the $()/jQuery() function extends
itself into the new object that is created.

More generally, the term factory method is often used to refer to any method whose main purpose is creation of objects. Factory methods are common in toolkits and frameworks where library code needs to create objects of types which may be subclassed by applications using the framework.

$('#faq').find('dd').hide().end().find('dt').click(function()
Here end will cancel the first find and second find will start from scratch.

jQuery.fn is a shortcut for jQuery.prototype
function($) {

} .. here $ refers to jQuery object...

http://simonwillison.net/2007/Aug/15/jquery/

Difference between
$().bind('click',fn) and $().click(fn)
Two difference:
bind can attach multiple function event to function name in a single statement.
something like this: $("(DIV ID)").bind("mouseout focus", function(){

});

Bind can also attach the custom events with any UI element.

Friday, May 22, 2009

http://www.24hourapps.com/2009/03/object-oriented-event-handling-in.html

Something relevant to my work.....

CSS selector tutorial

This tutorial will help in designing my web page in a better way...
http://css.maxdesign.com.au/selectutorial/tutorial_step22.htm

Use these styling rules....

Wednesday, May 20, 2009

Mac OS: working with textedit

I was stuck for a minute with text/edit.
Got confused that how can i save a file in html extension and get it properly displayed on browser:

For this i did this:
http://www.askdavetaylor.com/how_do_i_save_html_files_from_textedit.html

I changed the format from rich text format to plain text format and it worked for me.

Internship Day 1: JQUERY resources

Event Driven Programming:

http://www.mostlygeek.com/tech/event-driven-programming-with-jquery/

Basic Jquery tutorial:

http://ldeveloper.blogspot.com/2008/10/intro-to-jquery-basic-tutorial.html

Excellent JQuery Examples:

http://www.noupe.com/tutorial/51-best-of-jquery-tutorials-and-examples.html

Something for designers:

http://www.webdesignerwall.com/tutorials/jquery-tutorials-for-designers/

15 minutes Jquery expert:

http://www.webdevelopment2.com/give-15-minutes-jquery-expert/

How JQUERY works:

http://docs.jquery.com/How_jQuery_Works

Few links for tomorrow reading:

Advertiser Portal Documents ( check attached documents & ppt ) 
http://tortoise.hq.reloadnyc.com/groups/piggypost/wiki/6d2ca/2.1.9_Detail_Design_of_Advertiser_User_Interface.html
For the mockup -> refer to the link (Reddhima's wiki ( UI Mockup ))
P3 Portal ( Admin portal ) 
http://tortoise.hq.reloadnyc.com/groups/piggypost/wiki/0ce13/Admin_Portal.html
Look for p3 portal link
UI Common
http://tortoise.hq.reloadnyc.com/groups/piggypost/wiki/253aa/User_Interface_Common.html

Wednesday, May 13, 2009

Common XML errors are explained below..
http://validator.w3.org/docs/errors.html
impotent, innane, and ineffective.
the Indian system really needs to pull up their socks.\
hope sanity prevails.

Sunday, May 10, 2009

Executing system command from a perl program and capturing the output

http://www.perlhowto.com/executing_external_commands

method use if ...
system() you want to execute a command and don't want to capture its output
exec you don't want to return to the calling perl script
backticks you want to capture the output of the command
open you want to pipe the command (as input or output) to your script

shell programming tutorial

http://user.it.uu.se/~matkin/documents/shell/

Do this...

Saturday, May 9, 2009

error message i am getting right now:
ld returned 1 exit status

Means that some library is missing in the path..
try doing some ld stuff to link dll or library to this program...

Monday, May 4, 2009

Architecture of flash....

aRCHITECTURE DIGRAM OF DIFFERENT COMPONENTS
http://www.podtech.net/home/2827/the-architecture-of-flash

DIFFERENCE BETWEEN FLEX AND FLASH PLAYERS
http://theresidentalien.typepad.com/ginormous/2009/02/the-difference-between-flex-and-flash.html

Topic:
1. Overview
2. Flash /Flex/ AIR
3. Architectural framework of Flex
4. Flex and MVCS
5. History and evolution of Flex
6. Sample applications (Cool applications)
7. Resources

Read some time about following:
1. Spring
2. Hibernate
3. Ruby on rails
4. Python
5. Zend
6. PHP
7. JSON/REST
8. J2EE

Saturday, May 2, 2009

Setting up system variables:

For bash shell:
export CLASSPATH=$CLASSPATH:/java/classes:/home/tchin/myclasses

For tcsh or csh:
set CLASSPATH = ($CLASSPATH /java/classes /home/tchin/myclasses)

I always get confused about these two shells
echo $SHELL will tell the shell on which we are working

Also concept is this:
These are 2 forms of setting up the enviornment variable settings.

sh and ksh:
--------
TERM=sun
export TERM
these 2 command set any environment variable here.

csh:
----
in c shell setenv accomplish the task of those 2 commands alone.
so it depends on your shell, which shell u are using u have to use one of these commands.

Wednesday, April 29, 2009

interaction between user control and main pagein silverlight

http://dotnet.org.za/thea/archive/2004/07/15/2834.aspx

This is silverlight thing

Saturday, April 25, 2009

WCF + LINQ +

http://blogs.msdn.com/swiss_dpe_team/archive/2008/03/17/silverlight-2-beta1-wcf-linq-to-sql-a-powerfull-combination.aspx

Read this

Friday, April 24, 2009

rempte desktop command

rdesktop -g 1600*800 -a 16

Thursday, April 23, 2009

I would extend my previous post.
Usually people use php script or other programming language to load an API key into the swf application This makes it safe. They protect the script by returning API key only if a POST variable from swf application matches to a random variable in server side. {I am not clear on the script protection though}

Swf code is shipped to client side and if API key on

Wednesday, April 22, 2009

Gift of XML...

* XHTML: the latest version of HTML
* WSDL: for describing available web services
* WAP and WML: as markup languages for handheld devices
* RSS: languages for news feeds
* RDF and OWL: for describing resources and ontology
* SMIL: for describing multimedia for the web

MXML: used in actionscript
XAML: Silverlight and WPF. Used in ASP.NET. Rip off of MXML.

Sunday, April 19, 2009

Try this out sometime..
Write a script that generate this war file automatically ...


* WebContent.
Regular Web files (HTML, JavaScript, CSS, JSP, images, etc.)
* WebContent/some-subdirectory
Web files in subdirectory.
* WebContent/WEB-INF
web.xml (used for servlet mappings)
* WebContent/WEB-INF/lib
JAR files specific to application.
* Java Resources: src
Unpackaged Java code.
* Java Resources: src/somePackage
Java code in somePackage package.
* Note:
You can cut/paste or drag/drop existing files into appropriate locations, but it is hard to drag files into default package until you create at least one class first.

Saturday, April 18, 2009

How computer works,....

When you turn on the power to a computer, the first program that runs is usually a set of instructions kept in the computer's read-only memory (ROM). This code examines the system hardware to make sure everything is functioning properly. This power-on self test (POST) checks the CPU, memory, and basic input-output systems (BIOS) for errors and stores the result in a special memory location. Once the POST has successfully completed, the software loaded in ROM (sometimes called the BIOS or firmware) will begin to activate the computer's disk drives. In most modern computers, when the computer activates the hard disk drive, it finds the first piece of the operating system: the bootstrap loader.

The bootstrap loader is a small program that has a single function: It loads the operating system into memory and allows it to begin operation. In the most basic form, the bootstrap loader sets up the small driver programs that interface with and control the various hardware subsystems of the computer. It sets up the divisions of memory that hold the operating system, user information and applications. It establishes the data structures that will hold the myriad signals, flags and semaphores that are used to communicate within and between the subsystems and applications of the computer. Then it turns control of the computer over to the operating system.

The operating system's tasks, in the most general sense, fall into six categories:

* Processor management
* Memory management
* Device management
* Storage management
* Application interface
* User interface

And this is how Computer works :)

Thursday, April 16, 2009

Different ways to set the classpath...

For bash shell:
export CLASSPATH=$CLASSPATH:/java/classes:/home/tchin/myclasses

For tcsh or csh:
set CLASSPATH = ($CLASSPATH /java/classes /home/tchin/myclasses)

Advantage of servlets over CGI

1. Threads instead of OS processes

How to setup apache-tomcat on department machine:

Download Apache-tomcat and open in one folder...
10 0:30 set CATALINA_HOME=/project/dcs/saurabh/tomcat/apache-tomcat-6.0.18
11 0:30 set CLASSPATH = ( $CLASSPATH $CATALINA_HOME )
12 0:31 set PATH = ( $PATH $CATALINA_HOME )
13 0:31 module load java/jdk-1.6.0_06
14 0:31 cd bin/
15 0:31 ./startup.sh
16 0:31 module load mozilla/firefox/3.0.1
17 0:31 firefox

Wednesday, April 15, 2009

http://www.apl.jhu.edu/~hall/java/Servlet-Tutorial/

Work on this... finish this tutorial

Power of Comma (,)

I leave my money to Jamie, Heidi and Mark.
I leave my money to Jamie, Heidi, and Mark.

Though assigned least preference in C language operator list, ',' is one of the most crucial marker in English language.
See the power by yourself by reading those two lines.

First one means:
Jamie gets 50%
Heidi and Mark gets 25% each.

Second one means:
Each gets 33%.

Thursday, April 9, 2009

Recently i have been working on JAVA OSPF vs VIRO comparison for load in the network. I would put updates and interesting results in few days... wait till then

Tuesday, March 31, 2009

Cookie issue

The problem i am running into now is absolute timing of cookie...
How to renew cookie each time the user refresh the page or submit the request.

Microsoft SilverLight tools....

Right now i am working on microsoft silverlight toolkit examples...

Sunday, March 29, 2009

@INC in perl

@INC is location of all library modules....
Perl's use and require statements reads this array variable to find the location of all the library modules...

Traceroute

The good sight to obtain traceroute on the network...
http://tracert.com/trace_exe.html

Traceroute gateway is some piece of software which one can install in order to access the traceroute stats of that machine from a remote location.
POP vs IMAP vs SMTP

POP is protocol for downloading the files from ISP or email provider
SMTP is way of sending/uploading mail to email provider....
IMAP is also for downloading the files but it leaves a copy of message on the server so mail can be accessed from multiple machines.

All of them application layer protocol...

ISP POP is point of presence... Internet big picture is explained on this page... wonderful... http://navigators.com/internet_architecture.html

Saturday, March 28, 2009

http://www.inetdaemon.com/tutorials/internet/ip/routing/interior_vs_exterior.shtml

Interior routing protocol:
OSPF or RIP...
Generally OSPF as it multicast only the change in routing table unlike RIP where whole table is sent periodically in the network.

OSPF also allows to add extra cost parameters to routing table entries or paths.
we can use link state or distance vector approach for generating routing table.

Thursday, March 26, 2009

preventing memory leak in c++

http://www.ehow.com/how_2190610_prevent-memory-leaks-c.html

THis should help a lot./..

Tuesday, March 24, 2009

Recently while drawing graphs for my research results, i came across problem of drawing confidence interval graphs and excel sheet references from other documents.

For confidence interval graphs --> i watched two you tube videos whose link i have posted earlier.

For fetching data from different excel workbook sheet to current one, i used referencing approach...

=[pathto workbook]sheetno!cellnumber

Thursday, March 19, 2009

perl CGI coookies

http://www.devdaily.com/perl/edu/articles/pl010012/

This is the link which helped me in reading cookies using perl CGI

Wednesday, March 18, 2009

General C++ errors

1. Request member non-class type… C++

use -> instead of .
It also occurs when u call a non-const method using a const object.

2. error: expected primary-expression before '.' token

You have not created the object of class and you must be trying to access some member of class.

3. Use smart pointers from STL if you wanna avoid the headache of deallocating the pointer.

4. Use clear() to call deconstructor of all the object of a vector class.

Will post other later/....

Tuesday, March 17, 2009

Book and examples for better understanding of CGI.PM module

http://www.wiley.com/legacy/compbooks/stein/source.html

Try to run and read all the source code given on this page.
This will give a better view of CGI.PM

Monday, March 16, 2009

Confidence interva graph

http://www.mste.uiuc.edu/courses/ci407su02/students/mckechni/TermProject/ConfidenceInt/Teacher.html

Look here to draw a confidence interval graph

Saturday, March 14, 2009

C++ exercises and book concept

http://gd.tuwien.ac.at/languages/c/c++oop-pmueller/

Read it sometime.

Thursday, March 12, 2009

Client side validation

A good tutorial and way of doing client side validation
http://www.xs4all.nl/~sbpoley/webmatters/formval.html

Tuesday, March 10, 2009

Quote .. a Wonderful quote

"Individual who does not know how to die, does not know how to live"
--Emerson {quoted in Discovery of India}

"We are what we repeatedly do. Excellence then, is not an act, but a habit"
--Aristotle the great


"A pessimist sees the difficulty in every opportunity; an optimist sees the opportunity in every difficulty."


"The acquisition of knowledge, or any achievement,
requires restraint, self-suffering, self-sacrifice."
--Hindu UPNISHADS


"If you're walking down the right path and you're willing to keep walking, eventually you'll make progress."
States President Obama


"Those who aim high, have to learn to walk alone too"
Dr. A.P.J. Abdul Kalam {India 2020}

"Life is action
and passion."

Oliver Wendell Holmes Jr. (1841–1935)
U.S. Supreme Court judge


It's kind of fun to
do the impossible."

Walt Disney (1901–1966)
Entrepreneur, movie producer and showman

"The key to success is for you to make a habit throughout your life of doing the things you fear.“

Vincent Van Gogh (1853-1890)
Dutch painter
first career: art salesman

"If we wait until we've satisfied all the uncertainties, it may be too late."

Lee Iacocca (1924 – )
Businessman and industrialist

"An investment in knowledge pays the best interest."

Benjamin Franklin (1706-1790)
American statesman, writer & scientist

"I not only use all the brains I have but all that I can borrow."

Woodrow Wilson (1856-1924)
28th U.S. President from 1913-1921

"You don't need to push, they will recognize talent."

"There is no rocket science."

"Think twice before you speak."


"You can tell a man is clever by his answers. You can tell a man is wise by his questions."

Naguib Mahfouz (1911-2006)
Egyptian novelist, Nobel Prize Laureate

"You cannot create experience. You must undergo it.“

Albert Camus (1913-1960)
French writer

"You can't build a reputation on what you are going to do.“

Henry Ford (1863-1947)
American industrialist, inventor

“"Everything that irritates us about others can lead us to an understanding of ourselves."

Carl Jung (1875 - 1961)
Swiss psychiatrist

A business is in business to… “Maximize shareholder wealth"

Milton Friedman (1912 – 2006 )
Nobel Prize winner for Economics

"Don't let what you cannot do interfere with what you can do."
John Wooden (1910 – )
Hall of Fame basketball coach

"We are all faced with a series of great opportunities brilliantly disguised as insoluble problems."
John W. Gardner (1912–2002)
Government official and activist

"The man who removes a mountain begins by carrying away small stones."
Chinese proverb

"Great spirits have always encountered violent opposition from mediocre minds."
Albert Einstein (1879-1955)
German physicist, Nobel Prize winner

"Only a mediocre person is always at his best."
W. Somerset Maugham (1874-1965)
British writer - highest paid author in the world during the 1930s

"Few things are impossible to diligence and skill. Great works are performed not by strength, but perseverance."

---Anonymous

Last impression is first reaction.
--Saurabh Jain

Smile :) and the world will smile back at you !
--Anonymous

Padinga likhiga baninga hoshiyaar.. kheligaa kudingaa baningaa gawar..
--Nanaji

Padoge to aapku, naa mai ku naa baap ku..
--Nanaji

"The excess of virtue is a vice." ~
--Aristotle

"A ship is safest at the shore but that is not what it is built for"
--taken from profile of someone

"To exist is to change, to change is to mature, to mature is to go on creating oneself endlessly."
-- Henri Bergson
French philosophers of the late 19th century-early 20th century

"BE KIND, FOR EVERYONE YOU MEET IS FIGHTING A HARD BATTLE"
--Plato

"Remember a correct decision need not be the best decision."

"If you are not ambitious, I will not be inspired by you."
--'Cho' Ramaswamy

"A good looks and sense of living gives an additional confidence to overall personality."
--'Neeraj Jain'

"The greatest mistake you can make in life is to be continually fearing you will make one."
--'Anonymous'

"Confidence is the key. One must be very confident about what one is doing."
--'Yusuf Pathan'

"If A equals success, then the formula is _ A = _ X + _ Y + _ Z. _ X is work. _ Y is play. _ Z is keep your mouth shut."
--'Albert Einstein'

"Dreams are not those which comes while you sleep...Dreams are those which dont let you sleep."
--'Kabir's Orkut profile'

"A promise is a debt unpaid"
--'Orkut'

"If you have never failed, you have never lived"
--'Vishesh's status'

"Success is not final, failure is not fatal: it is the courage to continue that counts"
--'Orkut profile'

"Every society is judged by how it treats it's least fortunate amongst them."
--'Email thread Ashish'

"The important thing is not winning, but taking part; the important thing in life is not conquering, but fighting."
--'Lawyer Nariman'

"Great man never look at person's exterior, they think of his heart"
--'Narayan Hemchandra'

Monday, March 9, 2009

Real Technology Day

This was the easiest class for me. Almost all the topic which were discussed are listed somewhere in my profile.
Autonomic Computing: My intern in IBM Extreme Blue program. This was exhilarating experience and here i realized how big organization works and what it takes to lead these Organization. I am lucky that i started my Career with something like Extreme Blue IBM.

Grid Computing: My immediate next work after internship. My undergraduate senior year thesis was on this topic. Though in lack of guidance i could not learn much but i still managed to understand the basic theory and concepts of Grid Computing.

Virtualization: My first experience after coming here. I started my class project on this theme. Though technological aspects changed later but theoretically i worked on the same.

Cloud Computing: Read a number of papers on this last semester. My present work largely targets cloud services in the network.

I loved the "did you know?" Video. It was excellent class. I hope this class extends to whole semester because it was always relieving for me after those technology and Computer science boring classes to attend this one.

Saurabh

Excellent quoes

All the great things are simple, and many can be expressed in a single word: freedom, justice, honor, duty, mercy, hope.
__Winston Churchill


Attitude is a little thing that makes a big difference.
__Winston Churchill

Continuous effort - not strength or intelligence - is the key to unlocking our potential
__Winston Churchill


If you are going through hell, keep going.
__Winston Churchill


In war, you can only be killed once, but in politics, many times.
__Winston Churchill

Best link i found:
http://www.brainyquote.com/quotes/authors/w/winston_churchill.html

OMNET++

Problem in tutorial is that deprecated function are used. Correct function are getName and getIndex which do not conflict with C++ string header file. Try with this and see it'll work.
Also simulation terminated 139 error suddenly disappeared. I have no idea how it happened but overall it might be due to cleaning project again and again and running project after doing some changes.

Virtual methods in C++ cause more RAM consumption WHY??

http://www.alexandersandler.net/how-inheritance-encapsulation-and-polymorphism-work-in-cpp

The reason is when you use virtual method in class then compiler puts a "virtualmethodtable" at the beginning of each instance of class. This leads to increase in size for each instance by 4-8 bytes and hence overall size increases largely.

Sunday, March 8, 2009

Trying hand on OMNET++

Problem: C++ files were not recognized.
Solution: Created a project OMNET++ with C++ support.
Corrected the name of network in .ned file and it worked successfully.

Saturday, March 7, 2009

Model view Controller architecture

model view controller architecture
In the model view controller architecture:

Controller: java servlets
Model; businessLogic + database
view: JSP

Java servlets can also be used as a view component but their are inherent complexities in writing web based code in java servlets.

Wednesday, March 4, 2009

Lock Down

Class was wonderful. Presentation by Oscar helped in understanding SOA's practical aspects which i hope would help me in visualizing things in my SOA assignment for one other class.
I liked the exercise using threads which shows how complex things get when there is no order or standards defined but i felt like its all matter of visibility. SOA is no magic stick which rooted out all complex interfaces or business intricacies. It just helped managerial people to focus on what they are supposed to do... Manage...
All the complexity and problem is passed to the Technology guys who will have to think harder on defining appropriate interfaces between different modules to create a generic String/ Bus/ stabdard/ application/service using which a other business component can process data.
SOA just provide a unified view of whole organisation.
As usual .. i liked the discussion section and i agree with the supreme court that closing down the website because it should not be allowed to interfere other businesses.
I liked message lab article and i have a detailed stats on it. I'll post it from later. Right now i have bus in 7 min. and i have to pack my laptop, all stuff and run to bus stop. Note it .. this is the last bus and if i miss this then i wont be able to reach home tonight...\
c ya later

Monday, March 2, 2009

Second Life vs. Play Station virtual world
After watching a fair number of video and reading online reviews of both the product, i prepared a list of similarities, differences and business opportunity in both the media applications.

Second life:
1. User driven community, more freedom to users.
2. Larger audience as it is intended to all ages and not limited to gaming and social networking.
3. Sex and violence sales.
4. Attractive to real-world companies. Some holds their meetings and bought lands as well.
5. Robust economy model. Users can earn money as well.
6. Better replica of real world then virtual world. Almost every activity can be monetized. Example: advertising, gaming, clubbing, real-estate.
7. 15 million accounts but large scale user registration decline seen in recent quarters.
8. Bit tedious and crowded.

Virtual World
1. Less freedom to user.
2. Originally intended for play stations user community but may adapt second life model in future.
3. No sex, no violence. Mainly for Sony and it's trade partners.
4. Main economy model revolves around gaming and advertising.
5. User looking for psychological relief of being oppressed or pursuing something which they can not pursue in real world would not prefer virtual world.
7. Already having a established user base of PS3.
8. More attractive and easy to use.

Business Model:
SL:
1. Better economy model as countless number of ways to make money. Better replica of real world and more freedom to user enables a better economy model.
2. Larger audience. Nudity, sex makes it attractive to many.
VW:
1. Limited view of real world. More inclined to Sony music and advertising business. Sometimes viewed as a side product to support PS3 community.
2. Limited audience.No nudity, no Violence. Less options for customizing.
3. Potential to leverage established user base of 102 million PS3 users.

Friday, February 27, 2009

Tutorial about GWT-EXT and Cypal working with eclipse

Tutorial about GWT-EXT and Cypal working with eclipse
http://www.gwt-ext.com/wiki/index.php?title=Tutorial:Introduction_to_GWT-Ext_2.0
http://www.ibm.com/developerworks/opensource/library/os-eclipse-ajaxcypal/

I followed this two tutorial to setup things for my project.

Sunday, February 22, 2009

quote of the day

A good listener is not only popular everywhere, but after a while he knows something
"The Secret of getting things done is to act"

Friday, February 20, 2009

He who has overcome his fears will truly be free.

Dignity does not consist in possessing honors, but in deserving them.

Try this shell script example to improve shell script concepts

http://www.freeos.com/guides/lsst/

Try out all these examples...

Thursday, February 19, 2009

RMI and auto Login

File down loader service using RMI is explained here...
this link helped me a lot....
http://java.sun.com/developer/technicalArticles/RMI/rmi_corba/

steps to configure autoLogin

eval ssh-agent
ssh-add identity
enter the passphrase:

Thanks

Monday, February 16, 2009

Prototype language

God java script article to differentiate from prototype language from class based language.
https://developer.mozilla.org/en/Core_JavaScript_1.5_Guide/Class-Based_vs._Prototype-Based_Languages
http://www.phpied.com/3-ways-to-define-a-javascript-class/

Saturday, February 14, 2009

Quote collection----> Eye opener article

http://litemind.com/five-reasons-to-collect-favorite-quotes/
With this i'll start writing my best read quotes...

Great minds discuss ideas, Avg minds discuss events, narrow minds discuss individual.

Thursday, February 12, 2009

My schedule for next one month

feb 12:
11 - 5:30 class
5:30 - 9:30 DCS group work
11:30 - 2:30 VIRO work

feb 13:
10:30 - 1:00 VIRO work
1:00 - 3:00 Group meeting
3:00 - 6: 00 International group meet
7:00 - 1:30 VIRO work

feb 14
9:30 -9:30 VIRO work

feb 15
9:30 - 4:30 PROXY work

10:30 - 8:00 Adv Internet Programming

Wednesday, February 11, 2009

IT deliver case model

The cost of infusing technology into business deeds needs to evaluated from various perspective like return cost, business needs, duration of use, operational feasibility, required expertise, core competency model etc. As one size never fits all hence one needs to decide on "ownership and operational responsibility of technology development and maintenance" issues in Business.
Case Study: Keo Partners
Requirements and current analysis:
1. Improving knowledge collaboration and team performance. Help in on boarding/off boarding process. Software will be used for internal uses by HR department.
2. Number of employees are going to increase manifold as the contracts are expected to be double in near future. So need is urgent.
3. To be used by HR department which has limited skills for software or hardware management.
4. Long term use of this IT model is desired.
5. Need to be tailored to requirement of HR department.
6. I assume that financial constraints are there as this is not a core competency of business model.
7. As of now company size is small. Looks like a startup company.

On basis of these observations and facts i feel "site-hosting management service provider" model should fit best to the requirement of KEO Partners.

reasons:
1. As software is required soon hence this is suitable. Keo's customers are going to double in coming future hence need of such a software to be quickly available is strongly desired as it'll help in reducing the orientation time of new employees and may result in better productivity.

2. Keo has long term requirement and they wish to tailor the software according to their own requirements. This needs a control over software and upgrade release without incurring heavy cost. Hence "site-hosting management service provider" model is encouraging.

3. This is not a core competency area for Keo so the threat of unreliability of technology provider will not effect the productivity of business to larger scale.

Why not others:
Perpetual licensing:
As company size is small and company looks like a startup company hence licensing may lead to costly solution. Also large scale dependency over technology provider is not desirable in case of limited trust.
Software rental:
As software is required for long run hence this is not desirable.Also Keo would like to tailor software according to its requirement over time. Hence this make a negative choice for all this.
Software on demand:
Software customization is not possible here. Use of such service is limited by genericness of software. Uncertainity about features of product/service fitting into Keo's software needs.

Monday, February 9, 2009

Synthetic feasibility in Chemical informatics

Speaker domain: Dr. Watson started with chemistry, moved to pharmaceutical and photographic system. Presently working in machine learning.

Background:
Recent pharmaceutical industry has been investing $43 billion per year and huge wave of patent expiration is looming in the near future. Also pharmaceutic industry lacks the advanced IT infrastructure for simulations and experiments. One such example is “Chemical information processing”. Speaker's work involve study of quantitative structure activity relationship which uses various machine learning and virtual screening approaches. Evolution of new feasible structure needs some sampling. It uses parallel sphere exclusion for oversampling of molecule.

Synthetic feasibility assessment:
What: It is an a-priori estimate of the difficulty involved with making one or a set of small organic molecules. This estimation/prediction approach can use either knowledge based approach or computation based approach. But each have its own share of problem.
Knowledge base system might not be a feasible way because of:
1.It can not be annotated.
2.Knowledge base might be incomplete
3.Everything in chemistry and reaction is having exception.
So obvious choice is to use computation model for making prediction but there are few other problems associated with Computation model.
1.hard to make
2.not feasible some time.

To overcome this a new knowledge based approach is used which bases abound the theory that existing body of molecule implicitly reflects the difficulty of making those molecules. Model extrapolate to molecule substructure and then decompose molecular sub structure and look at small sub problem in the data base. Database uses concept of concentric fingerprinting to store the information in the database because concentric fingerprinting are easy to canonicalize. Concentric fingerprinting is done on basis of radius of various sub structure.
A missing molecule key shows that molecule is never made while a small radius miss is more important then large molecule miss.
Summary:
Body of already-made molecules inherently embodies all concepts of difficulty, cost, toxicity and other attributes.
Difficult parts of molecule provide example of precedent molecules.

Future work:
Personalized medicine on basis of gene analysis.
Biggest challenge is evaluation and rules for side effects which increase risk component.
How work in gene informatics can be used in chem informatics.

Wednesday, February 4, 2009

I need to read some article and deeply understand this part. I found many good question on this concept but i am not sure the situation of when to use them?

Second point to read in C in greater detail is concept of sequence point and rvalue and lvalue.

One finer study tells that following statement is absolutely valid.
*((mycondition) ? &var1 : &var2) = myexpression;

Read about function pointer and pragma.... conditional operator...

Also goto can not be used to jump across different function.

Monday, February 2, 2009

for multiple images
content:disposition is used in HTTP protocol...
This will give you file name which can be used to store the file.
Always remember...

The postfix "++" operator has higher precedence than prefix "*" operator. Thus, *p++ is same as *(p++); it increments the pointer p, and returns the value which p pointed to before p was incremented. If you want to increment the value pointed to by p, try (*p)++.

pointers ... save me .. save me

Why do i always get confuse while dealing with pointer...
Study this program immediately.

#include

void hello(char *s){

while( *(s+0) != '\0'){
printf("%c\n", *(s+0));
*(s+0) = 'a'; //comment and try then as well.
s++;
}
}

int main (int argc, char *argv[]){

char a[] = "my name is saurabh jain\0";
hello(a);
printf("hello %s", a);

return 0;
}

Here incrementing s in function will not make difference to "a" as both are different pointers and pointing to same array.
But if using "s" we change the value of string then that would be reflected in main.

__Saurabh

Error in compilation of cpp file

Error:
/tmp/ccA3vJnB.o:(.eh_frame+0x11): undefined reference to `__gxx_personality_v0'
collect2: ld returned 1 exit status

Reason:
Platform specific error.
Try using g++ instead of gcc.

Sunday, February 1, 2009

I see many of services mentioning about REST or RESTful Services so i decided to dig further on this standard.
Here is compilation of what i have learned.
REST stands for representational state transfer. With a large number of IT giants adapting this REST, it is being projected as an alternative to SOAP toolkit methods. REST consider each URL on internet as a resource or object. One can use HTTP GET to fetch contents of objects and use POST, PUT, or DELETE to modify/delete the object.
We will see further in the document what does that mean?

Some of the companies like Yahoo, Amazon, Flickr, twitter etc have provided their API conforming with SOAP as well as RESTful format. However SOAP is still widely used format with grace of Google. Here i list some of the advantages and disadvantages for SOAP and RESTful resources.

REST:
Easy to build as no toolkits are required.
Human readable results.
Light weight as less XML stuff here.
Server side efforts required. One need to handle serialization of XML data.

SOAP
Development tools available.
Rigid, type checking
Easy to work with sometimes.
Client side efforts required as server side efforts, serialization de-serialization issues are handled by SOAP libraries only. Regualar HTTP based API exporting requires a hell lot of efforts. HTTP based API requires additional work of mapping URI paths to specific handler.

All information you gain should be intended to solve some problem. So without wasting time, i'll first explain the practical way of using REST as opposed to RPC.

Reference:
http://www.petefreitag.com/item/431.cfm
http://en.wikipedia.org/wiki/Representational_State_Transfer
http://effbot.org/zone/rest-vs-rpc.htm
http://bhavin.directi.com/http-vs-rest-vs-soap/

Saturday, January 31, 2009

This will be useful code......

/*
* How to search for images and restrict them by size.
* This demo will also show how to use Raw Searchers, aka a searcher that is
* not attached to a SearchControl. Thus, we will handle and draw the results
* manually.
*/

google.load('search', '1');

function searchComplete(searcher) {
// Check that we got results
if (searcher.results && searcher.results.length > 0) {
// Grab our content div, clear it.
var contentDiv = document.getElementById('content');
contentDiv.innerHTML = '';

// Loop through our results, printing them to the page.
var results = searcher.results;
for (var i = 0; i < results.length; i++) {
// For each result write it's title and image to the screen
var result = results[i];
var imgContainer = document.createElement('div');

var title = document.createElement('h1');
// We use titleNoFormatting so that no HTML tags are left in the title
title.innerHTML = result.titleNoFormatting;

var newImg = document.createElement('img');
// There is also a result.url property which has the escaped version
newImg.src = result.unescapedUrl;
newImg.href = result.unescapedUrl;

imgContainer.appendChild(title);
imgContainer.appendChild(newImg);

// Put our title + image in the content
contentDiv.appendChild(imgContainer);
}
}
}

function OnLoad() {
// Our ImageSearch instance.
var imageSearch = new google.search.ImageSearch();

// Restrict to extra large images only
imageSearch.setRestriction(google.search.ImageSearch.RESTRICT_IMAGESIZE,
google.search.ImageSearch.IMAGESIZE_MEDIUM);

// Here we set a callback so that anytime a search is executed, it will call
// the searchComplete function and pass it our ImageSearch searcher.
// When a search completes, our ImageSearch object is automatically
// populated with the results.
imageSearch.setSearchCompleteCallback(this, searchComplete, [imageSearch]);

// Find me a beautiful car.
imageSearch.execute("Subaru STI");
}
google.setOnLoadCallback(OnLoad, true);
http://upcoming.yahoo.com/services/api/ for finding events...

Flicker API for images http://www.flickr.com/services/api/

Yahoo maps API http://gallery.yahoo.com/maps

Use this: http://developer.yahoo.com/maps/ajax/
Wonderful use: http://www.dataffect.com/usgs/#



Order matters: As is the case generally with JavaScript and CSS, order matters; javascript and css files should be included in the order specified above. If you include files in the wrong order, errors may result.

api.php?action=query&meta=siteinfo&siprop=namespaces&format=xml
api.php?action=query&generator=search&gsrsearch=meaning&prop=info
api.php?action=query&generator=search&gsrsearch=meaning&prop=info&meta=siteinfo&siprop=namespaces&format=xml


get all the pages which uses given image title
api.php?action=query&generator=imageusage&giutitle=Image:Albert%20Einstein%20Head.jpg&prop=info

return all the images given in a page
api.php?action=query&generator=images&titles=Main%20Page&prop=info

this is themoviedb.org API's

good for movie name caste actors and youtube links
http://api.themoviedb.org/2.0/docs/details/movie.search.html
Also helpful in getting information
Need to call first search method and extract movie id
use that movie id for fetching information.

TheMovieDB will be very useful in searching for movie information and related information.

Friday, January 30, 2009

Data API's

http://upcoming.yahoo.com/services/api/ for finding events...

Flicker API for images http://www.flickr.com/services/api/

Yahoo maps API http://gallery.yahoo.com/maps

Use this: http://developer.yahoo.com/maps/ajax/
Wonderful use: http://www.dataffect.com/usgs/#



Order matters: As is the case generally with JavaScript and CSS, order matters; javascript and css files should be included in the order specified above. If you include files in the wrong order, errors may result.

Wednesday, January 28, 2009

Space trimming

import java.util.regex.*;

public class BlankRemover
{

/* remove leading whitespace */
public static String ltrim(String source) {
return source.replaceAll("^\\s+", "");
}

/* remove trailing whitespace */
public static String rtrim(String source) {
return source.replaceAll("\\s+$", "");
}

/* replace multiple whitespaces between words with single blank */
public static String itrim(String source) {
return source.replaceAll("\\b\\s{2,}\\b", " ");
}

/* remove all superfluous whitespaces in source string */
public static String trim(String source) {
return itrim(ltrim(rtrim(source)));
}

public static String lrtrim(String source){
return ltrim(rtrim(source));
}

public static void main(String[] args){
String oldStr =
"> <1-2-1-2-1-2-1-2-1-2-1-----2-1-2-1-2-1-2-1-2-1-2-1-2> <";
String newStr = oldStr.replaceAll("-", " ");
System.out.println(newStr);
System.out.println(ltrim(newStr));
System.out.println(rtrim(newStr));
System.out.println(itrim(newStr));
System.out.println(lrtrim(newStr));
}
}

This program is helpful in using regular expression to beautify your string.

Eclipse crash issue

I faced an unusual eclipse crash today.
Error message said:

An error has occurred. See the log file
/home/hendrik/workspace/.metadata/.log.

I browsed through some forums and found this solution:

http://tapestryjava.blogspot.com/2004/10/worst-eclipse-crash-ever.html,

http://dev.eclipse.org/newslists/news.eclipse.newcomer/msg12793.html

The solution was that we needed to remove two file
\.metadata\.plugins\org.eclipse.core.resources\.snap
and
\.metadata\.plugins\org.eclipse.core.resources\.root\.markers.snap

And it worked for me.
cheers
Saurabh

Monday, January 26, 2009

Sensitive Information in a network world

Topic: Sensitive Information in a network world
Speaker: game therory application to internet and privacy and security issue.

Introduction:
Speaker talked about her recent 5-year work assignment of "Privacy obligations and rights in technologies of information assessment".
Project revovled about dealing with senstive information. Reason for choosing sensitive information is because Information has to be handled correctly but one need to understand that every information is not private. For instance, copyrighted information is published but it can be used only under certain norms.
The Project PORTIA invovled prople from various domain. The major research theme addressed fllowing issue:
Massive data set algorithm: Sensitive Data mining and information retrieval is also a concern.
Client side defense
Sensitive data in distributed systems
Policy enforecement tool for Database system
Contextual integrity
Talk invovled detailed discussion on Client side defenses and Sensitive data in DS.

Techincal understanding:
Basic research problem revolved about question that "what information does search engine can collect?"
Usual search engine can access following information about netork and clients.
1. TCP/IP: It can find out OS and server side platform details
2. HTTP headers: Information on the client side like cookies etc.
3. HTML: Server side content
4. Query terms
Speaker talked about software requirement and design used for solving this issue.This software is PWS (Privacy application for web search).
This may not be acceptable to all the users hecnce many approaches were adopted to avoid this data mining by search engines. The problems mainly involved anonymity and avoiding search engine based data mining.

Appraoches and solution:
Some different appraoch:
TrackMeNot This plugin will generate fake traffic(Cover traffic) and confuses search engine by hiding the actual search query.
Tor + Privoxy: TCP/IP layer anonimizer about source of search query: TOR anonimizer while Privoxy: browser level plugin. It targets any kind of web based system but vulnerable to active components and it is difficult to use.

Speaker's team effort:
Make users indistinguishable and handle active component problem. Speculation is that this might reduce the efficiency of google seach engine.

Design overview of software:
It is a 3-tierd architecture. This software can be used as a firefox plugin:
HTTP proxy
HTTP filter(strip out unnecessary information) + HTML filter(remove active compoenent)
Tor Client

Tor network sends the anonymized packet in anonymous way to server and hence hides the client information.
There is broad scope of future work in this domain. Few points are listed here:
Reduce impact of Tor path selection on performance.
develop a formal model t measure privacy.
Semantic anonimozation
Also this might reduce the efficiency of future search results.

PORTIA antiphishing tools includes spoofguard, pwdHash, safeCache, safeHistory and spyBlock. This is present on internet.
Later half of presentation was based aroud distributed computing data mining.
Secure multiparty function evaluation.
Problem statement:
In a distributed environment, how to do a collective computation such that no one get to know about others data and final result is obtained.
Speaker's team adopted survey based approach and applied it to CRA taulbee survey.The intention was to convey salary distribution statistics per tier and rank to the CS community without revealing department specific information.