How to Add a Facebook Apllication to your profile page?

•February 12, 2010 • Leave a Comment

Step 1: Login to facebook.com

Step 2: Get the the application you want to use. Our example here is http://apps.facebook.com/impetusapp/

Step 3: Click on view my profile from your facebook home page. Snapshot below shows where you can find it.

Step 4: Click on the “+” symbol on the tabs.

Step 5: Enter the name of the application you want to add.

Step 6: And voila. We are done :)

Connect BSNL EVDO card on linux

•May 22, 2009 • 22 Comments

This procedure can be applied for different datacards such as those of reliance and tata indicom if they are devices of zte type. And guess what you don’t have to worry about getting an zte device driver for linux…

Step 1: Login to linux as superuser(root)
Step 2: Connect your device to the USB port
Step 3: open terminal
Step 4: enter the command ‘lsusb’.It should give a listing of all USB devices connected. Something similar to this…
Bus 005 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 004 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 003 Device 003: ID 08ff:2580 AuthenTec, Inc. AES2501 Fingerprint Sensor
Bus 003 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 002 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 001 Device 014: ID 19d2:fffe ONDA Communication S.p.A.
Bus 001 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub

Your device should be listed. Something similar to ONDA Communication or Qualcomm depending on your device.

Step 5: Goto /etc and open wvdial.conf in a text editor.
Step 6: After keeping backup of the file modify it as follows. Please enter your correct user name and password instead of 1111111111

[Dialer Defaults]
Init1 = ATZ
Init2 = ATQ0 V1 E1 S0=0 &C1 &D2 +FCLASS=0
Modem Type = Analog Modem
ISDN = 0
Phone = #777
Modem = /dev/ttyUSB0
Username = 1111111111
Password = 1111111111
Baud = 460800
Stupid Mode = 1

Step 6: whenever you need to connect to the internet just open the terminal and run the command ‘wvdial’

linux-y5au:/home/kiran/lin evdo driver/linux # wvdial
–> WvDial: Internet dialer version 1.60
–> Cannot get information for serial port.
–> Initializing modem.
–> Sending: ATZ
ATZ
OK
–> Sending: ATQ0 V1 E1 S0=0 &C1 &D2 +FCLASS=0
ATQ0 V1 E1 S0=0 &C1 &D2 +FCLASS=0
OK
–> Modem initialized.
–> Sending: ATDT#777
–> Waiting for carrier.
ATDT#777
CONNECT
–> Carrier detected. Starting PPP immediately.
–> Starting pppd at Fri May 22 12:05:59 2009
–> Pid of pppd: 5873
–> Using interface ppp0
–> pppd: ��[06][08][08]�[06][08]
–> pppd: ��[06][08][08]�[06][08]
–> pppd: �[06][08][08]�[06][08]
–> pppd: ��[06][08][08]�[06][08]
–> local IP address 10.4.61.177
–> pppd: ��[06][08][08]�[06][08]
–> remote IP address 192.168.52.12
–> pppd: ��[06][08][08]�[06][08]
–> primary DNS address 208.67.220.220
–> pppd: ��[06][08][08]�[06][08]
–> secondary DNS address 208.67.222.222
–> pppd: ��[06][08][08]�[06][08]
–> Script /etc/ppp/ip-up run successful
–> Default route Ok.
–> Nameserver (DNS) Ok.
–> Connected… Press Ctrl-C to disconnect
–> pppd: ��[06][08][08]�[06][08]

and voila online on linux and lovin it ;)

WordPress Idea – GSOC 2009

•April 3, 2009 • 2 Comments

Being a regular user of wordpress has inspired me to pick up the Blog Import/Export project idea for my Google Summer of Code project proposal. The idea listed at http://codex.wordpress.org/GSoC2009 is as follows

Blog Import/Export

Mentors: Alex Shiels, Beau Lebens, Nick Momrik, Thorsten Ott

Importing and exporting blog content is an important function within WordPress. Create a WordPress import/export process that doesn’t need a file, but connects directly to the blog for the content transfer instead.

The idea on what should be done:

Currently the WordPress to WordPress blog trnsfer is achieved by exporting an xml file from the source blog and importing it in the next blog. This process can be converted to a direct import export as follows:
1. Connect to the source blog from the current blog by asking the user his login credentials.
2. Access the wpdb object of the source blog and call its export function.
3. Use the autogenerated xml file as a temporary source for import or convert the export function to give an xml response instead of creating the file.
4. Call the import functionality of the destination blog with this xml response/temporary file.
5. Terminate connection to source blog and update current blog.

WordPress API’s parts that will be dealt here:

1. The login functionality to for authentic entry of the user to the source blog

2. The wp-db class to access the wpdb of the source blog

3. The Export functionality should be called from the source blog.

4. The import functionality should collect the information exported in the earlier step in the destination blog.

Export/Import as a core feature:

Since the export functionality gives an xml file like $filename = ‘wordpress.’ . date(‘Y-m-d’) . ‘.xml’ this can be easily modified to provide an xml response having the same contents like this file would have. This response hould be fed into the import functionality. This totally removes the need for a file. But I would like to suggest an alternative way without making any core changes as a User might still want to use the xml file for backup purposes. So at this specific condition of Import/Export the following can bed one

Export/Import as a non core feature:

Instead of modifying the creation of xml file at the export functionality use it as a temporary file on the server itself. Feed that xml file to the import functionality and once successfully imported the temporary file can be removed. This will help maintain the provision for users to se a file backup when required but relieve them of the tedipous pain of downloading the file and then connecting to destination site and uploading it again in case of Import/EXport

The dreaded null comes back

•February 10, 2009 • Leave a Comment

The null pointer exceptions are dreadfully insane in Java. Take this one for example, the EntityManagerFactory returned null. You go on to a thousand forums on the net to find a solution to this problem and you find out one this, the JPA is relatively a newbie on the experienced programming world and the closest problem could be that you’ve not the given the correct name for the persistence unit. Well i’ll try to list out a max of probable errors you need to correct to solve this problem…

1. Use the same name while defining the persistence unit in the persistence.xml file and while denoting the @Persistence

2. Add the META-inf folder that contains this xml fle in yor classpath if its not already in the classpath. The persistence.xml must be in the classpath for the entities to be able to recognise your back end database and connect to it.

3. Check the data type of entity parameters. Are they what you really expect? JPA has a weird habit of using non-conventional data types such as short for representing columns with numbers that are of range low enough to be represented by this datatype. But they’ll mess you up when you try to connect to databases like oracle that don’t support this. So you may need to look into the auto generated codes a little bit.

4. You do the above and still no gain? Yo might have foreign keys in your database. Drop those keys, the JPA doesn’t always work well when you don’t have well defined foreign keys around in your tables.

If you are still scratching your heads, then EJB’s are not for you. Definitely you’ll even find some books titled Why not to use EJB’s. But this technology has certainly revolutionized database based applications especially with the way we perceive entities and query them.

AJAX – A misconception?

•December 20, 2008 • 3 Comments

My encounters with HR’s of various companies have left me wondering on how people with very little/narrow technical knowledge end up being major recturing factors of some well known technical companies. Naming the person here and the company would actually soil the reputation of one of a few damn good companies, so i’ll refrain from mentioning that and give more of the background and clear off a few misconceptions about a piece of technical jagron termed AJAX.

Here’s the incident: It was kinda of deep into a tech interview round when i mentioned AJAX as one of the technologies i’ve been working on in the recent times. As expected the HR asked me what was AJAX and i gave the classical definition that even you can look up here. He then went on to ask how to make a score ticker using AJAX. I’ll mention the steps here minus the technical jagron

1. Write javascript with an automated function call that calls itself every min or so as the time difference needed for the score update.

2. Create the xmlhttprequest object connection to the data source (an ASP/JSP page here)

3. Write the DataSource provider script to access the database and return the XML data.

4. Put the XML data on the page.

And to this he told: Wrong. Where are you using AJAX? You are using just javascript. I tried my best to convince him that AJAX technology is a confluence of javascript and XML. Ironical but his belief was that i had to drag and drop one of the widgets either from dojo/yui or any of the widget libraries that provide AJAX. Uph!! When will people ever learn that code libraries are also collection of javascripts that do the same job as we write; and the technology doesn’t change whether you use an API/library or you yourself write the code within the technology constraints.

LESSON: Never go indepth onto the side of technology your interviewer has little knowledge off. The company doesn’t deserve a bright individual as you.

javax.xml.transform TransformerException: java.lang.NullPointerException : How to Solve?

•October 22, 2008 • 14 Comments

Just after solving my previous problem I stumbled on NullPointerException in Transformer.transform (Source, Result) method, my application was working fine until yesterday, there was no update, no change in configuration of anything…

What I was doing therewas a simple attempt to use the transformer from the xml api to write an xml file:

Source source = new DOMSource (doc);
Result result = new StreamResult (new File (file));
Transformer transformer = TransformerFactory.newInstance ().newTransformer ();
transformer.transform (source, result);

Personally this is the worlds’s most stupid error. Guess what the console gave as the eroor description : ERROR: ” “

Very helpful, isn’t it? What next? Well we’ll proceed to the stack trace next:

Down somewhere in the jungle of exceptions you get Caused by: java.lang.NullPointerException

at com.sun.org.apache.xml.internal.serializer. ToUnknownStream.characters(ToUnknownStream.java:312)

the code there looks like this:

public void characters(String chars) throws SAXException
{
final int length = chars.length();

Now we finally see the part that threw the error. Well the char.kength() was zero because there was a null text node insertion beging tried. So now’s the solution to this problem

1. Go through your source code

2. Find the text node that is null

3. Give it a String value

4. Recompile and run

OWLS ARE NOT ALWAYS WHAT THEY SEEM

Xforms submission giving null parameters to request.getparameter() – Solution

•October 22, 2008 • Leave a Comment

Simplicity side of X-forms and xml apart, when one goes building any major web app from the very little, itsy bitsy knowledge we have, looms large problems that shake the very fundamentals of what you began coding with. If you ever tried the previous Xform in a debug mode on the Websphere server you would have found out now the hard way that the form does pass values, but jsp page cannot recognise in whatsoever.  Its an irksome problem i had last night and spent around 6 hours of my valuble time figuring out, going through over 1000 links on google and reading over 10 pdfs, to know there isn’at a solution posted anywhere. Ok fine leave apart my difficulties, here’s what you came for, the solution to the problem

 

Goto your submission element

<xf:submission action=”process.jsp”
method=”get” id=”sub”/>

add an extra parameter

<xf:submission action=”process.jsp”
method=”get”
seperator=”&amp;” id=”sub”/>

voila, you have your parameters now.

Now, the exact reason why the problem occured:

An html form uses the seperator by default and a jsp seperates out and creates a parameter map from this. Xforms by default, doesn’t specify the standard seperator, so the addition tag required in the submission element in your model.

Writing your First Xform

•September 27, 2008 • 3 Comments

Xforms isn’t as complicated as people claim it to be. It is a simple, and with tons of benefits than traditional forms. Here’s a step by step procedure involved inwriting an Xform that takes a persons name as an input and sends it to an jsp page process.jsp for processing.

1)

Open notepad and put in the following xhtml header

<html
xmlns:xf=”http://www.w3.org/2002/xforms”
xmlns:xsd=”http://www.w3.org/2001/XMLSchema”
xmlns:xsi=”http://www.w3.org/2001/XMLSchema-instance”>

this header tell the browser the type of XHTML page and the different standards used as per W3C. the first line is the xforms standards, the second of schema for display and the third for the instance model. Without these your browser will not be able to intepret the page properly.

2)

Write the head section as you do in HTML, i’ll elaborate the otter fields in comments delimited by //

<head>
<title>Xforms Example</title>

//The model specifies the Xforms data model. Instance contains all the fields you’ll have in the model. Here we have only one field in the instance namely name.

<xf:model>
<xf:instance>
<name/>
</xf:instance>

//in submission action link to your serverside code
<xf:submission action=”process.jsp”
method=”get” id=”sub”/>
</xf:model>
</head>

3) Now to the body part of the page.

<body>
<xf:input ref=”name”>

// the ref field is used to referance particular elements from the instance model. The label is what the label you want to show on the page

<xf:label>Name:</xf:label>
</xf:input>
<br />

//br is normal HTML break. The submission=”sub” specifies the id as given in the instance model in head.

<xf:submit submission=”sub”><xf:label>Submit</xf:label></xf:submit>
</body>
</html>

4) There you have your first Xforms ready. Save the file with a .xhtml extension and view in any Xforms compitable browser(click here to know more about xforms viewers) and there you go.

Xforms – An insight

•September 21, 2008 • 2 Comments

Xpath, Xquery, Xlink, XSLT, Xforms uph… the never ending list of techologies that begin with an X and literaly give people headaches being one of the most complicated yet powerful SGML. This is a honest effort to render off itsy bitsy details about one such XML based technology – Xforms.

Well Xforms to begin with is a W3C recommendation that is a replacement for standard HTML forms. XForms provides a richer, more secure, and device independent way of handling web input. Pretty easy to learn actuall if u go through some tutorials like http://www.w3schools.com/xforms/xforms_intro.asp but they don’t spell out the looming truth. You can very well write an xform page but to get it to display in your ordinary browser… well its close to defining hell. So here’s what you got to do.

XForms browser Plugins

For Mozilla: Well for all those who switched to mozilla 3.0 there’s no plugin available for Xforms, there goes W3c statements of supporting Xforms in all future browsers. The new kid on the block Chrome also doesn’t support it natively nor has it plugins. For those still on Mozilla 2.0 check http://www.mozilla.org/projects/xforms/download.html

For IE: for once IE is good. Well atleast there are plugin developers who have developed plugins for Xforms for non native support. These include formsplayer and Novell

XForms standalone browsers

The most popular standalone XForms browser is surely X-Smiles, developed by the the University of Helsinky. X-Smiles is a Java-based browser, with full support for XForms and for Smil. X-Smiles works as well on PCs, as on PDAs as on (modern) mobile phones

XForms application servers

This is the third category which is quite useful if you don’t want your clients to install software at their end to run your web application. That doesn’t make it the recommended option though as its damn slow as the server process your xml based form and renders an equivalent html+js. However you can try it out in case you can sacrifice the speed for delivering your end users a hassle free usage of your application. The most popular of these application servers is probably Chiba 2.0, from ChibaCon. It is open source, very stable, and very easy to install on the server: just deploy the .war file on your favorite application server (Tomcat, JBoss, Orion, Resin, Oracle, WebLogic, WebSphere …), and you are ready.

Don’t move a database that has it’s tables linked in db2

•September 9, 2008 • 2 Comments

Hey guys, don’t make the mistake I did by trying to move a database that has its tables linked. You’ll get an sql error numbered 3304.

LOAD is a very fast and direct way to get data from a file residing in the file system into a table in your database. LOAD does not use SQL INSERT statements, as does IMPORT. Instead, it writes the data directly to the data pages in the tablespace. Additionally, less logging occurs to further improve performance of the load process.

So, we need to keep the behavior of LOAD itself in mind. If there are any dependent tables (tables that have a foreign key referencing the table into which data is to be loaded, for example), they might be placed in the CHECK PENDING state. Additionally, further constraints could also result in the table not being available right after the LOAD operation, requiring you to run the SET INTEGRITY SQL statement first.

So, you could either set INTEGRITY SQL or you could do the mapping in your buisness logic using entity beans.

 
Follow

Get every new post delivered to your Inbox.