Thursday, January 3, 2013
Saturday, February 26, 2011
AT Commands: Mobile Messaging
The How??
There is a great guide here which you can use to telnet your mobile device and test sending a SMS manually. To do it via a program: read on.
Quick Start
To incorporate this library into your project all you have to do is to include the "ATCommands.h" file. This exports the following functions:
- initPort(int n): It initializes and sets up the port for communication. The device string should be of the form /dev/ttS<n> where n is the port number (like mostly if you have only one device attached then it will be /dev/ttyS1).
- pokeDevice(): To be used only under debug mode(explained later). It is analogous to a ping.
- getMsgIndex(): It is a helper function for sendSMS and returns the index for the new message to be written.
- sendSMS(char *TargetNo,char *Msg): It is the function you want to call most often and is responsible for actual sending of SMS.
- closePort(): performs cleanup and closes open port.
Under The Hood
The code I have written supports a DEBUG flag. All you've got to do is to include "Debug.h" which defines a macro Debug and enables logging of debug messages to stdout. If you are extending the library then you might want to use the DbgPrint( char *format, ... ) function to maintain uniformity of the debug flag.
Download
The above code was compiled using g++4.3.2/cygwin and tested with mobile handsets of Nokia, Sony Ericsson and Sigmatel. It should also work with most GPRS modems.
Further Improvements
- Support for handling multiple mobile devices at once.
- Error handling can be better.
- Support for Queueing/Scheduling of messages.
Sunday, February 20, 2011
Rootkit.com info leak poses threat to other sites
- Step 1: Download backup, JTR, dictionary (john is in synaptic for
ubuntu users).
- Step 2: Extract the .gz file and open the extracted file as text,
search for your login name and get your password's hash (I used nano to
open the file and searched for my login name. Hash is the field next to
your login name). Note only the first occurence of your username as
rest may be entries for comments and other stuff.
- Step 3: Create a text file test.txt with content "mypassword:<hash>" without the "" and replace <hash> with the hash you found in step 2.
- Step 4: Open terminal and ask jtr to do its magic using the
following command :
Friday, July 16, 2010
Online Shopping Cart: JSP
Overview :
Lets draw an outline of the project. We have 2 use cases to the project viz Administrator and Customer. We take them one by one. ADMIN end:- Ability to add products
- Managing the categories that these products belong to
- Search Transaction
- Search Customer
- Search for product and ability to edit product inf
- View product and its details
- Register
- Login
- Add product to cart and checkout
- Viewing transaction records
Snapshots :
Lets look at the snapshots of the project first and then we will discuss the problems faced and their solutions.Hurdles :
Creating & calling stored procedures on DB2.With RAD thats very easy!! Follow the steps:
- Switch to Data Perspective.
- If haven't already create a new project data development proj say 'ShopDev'. While doing so you will be asked to connect to the DB2 database please make sure you enter the DB2 credentials correctly and dont forget to test the connection.
- Right click on the ShopDev in the project navigator and select new stored procedure.
- Make sure you choose java as the language (unless you want to use sqlj) and create the query, set up I/O parameters and you will have a stored procedure created for you. This might not be exactly you want so you can edit it now. (for eg look in folder /workspace/ShoppingDev/JavaSource/com/db2admin/db2admin/*.java)
- Once done, you can right click on the procedure and select the option generate JavaBean class to get the .java file in your dynamic web project. (these can be found in /workspace/ShoppingCart/src/genbeans/ )
- Now you can use this class to instantiate it in JSP or as Beans..
Image/File Uploads for productsI have seen a lot of posts over the internet for this. But it was difficult to find one good solution. Our objective was to upload the file to database so the approach that we follow is to first upload the file to a temporary folder on the server then onto the database. Uploading To FileSystem On Server: To do so the Apache Commons FileUpload package will do the work for us. Just include the library in your path or add it as a reference. First lets see the jsp page with form that is going to submit both variables and upload data. (important to note enctype)
<form id="addProduct" enctype="multipart/form-data"
action="AddProduct" method="post">
import org.apache.commons.fileupload.FileItem;
import org.apache.commons.fileupload.FileUploadException;
import org.apache.commons.fileupload.disk.DiskFileItemFactory;
import org.apache.commons.fileupload.servlet.ServletFileUpload;
/**
* Servlet implementation class AddProduct
*/
public class AddProduct extends HttpServlet {
private static final long serialVersionUID = 1L;
/**
* @see HttpServlet#HttpServlet()
*/
public AddProduct() {
super();
// TODO Auto-generated constructor stub
}
/**
* @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
*/
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
// Create a factory for disk-based file items
DiskFileItemFactory factory = new DiskFileItemFactory();
String SUBCAT = null,Name = null,BRAND = null,Description = null;
int Price = 0,Qty = 0;
byte[][] Image=new byte[3][5*1024*1024];
// Set factory constraints
factory.setSizeThreshold(5*1024*1024);
factory.setRepository(new File("/tmp"));
// Create a new file upload handler
ServletFileUpload upload = new ServletFileUpload(factory);
int cnt=0;
// Parse the request
List items;
try {
items = upload.parseRequest(request);
Iterator iter = items.iterator();
while (iter.hasNext())
{
FileItem item = (FileItem) iter.next();
// Process a file upload
if (item.isFormField()) {
String name = item.getFieldName();
if(name.equals("SubCat"))
SUBCAT = item.getString();
else if(name.equals("PName"))
Name= item.getString();
else if(name.equals("Brand"))
BRAND = item.getString();
else if(name.equals("Quantity"))
Qty = Integer.parseInt(item.getString());
else if(name.equals("Price"))
Price= Integer.parseInt(item.getString());
else if(name.equals("Description"))
Description = item.getString();
}
if (!item.isFormField())
{
String fieldName = item.getFieldName();
String fileName = item.getName();
String contentType = item.getContentType();
boolean isInMemory = item.isInMemory();
long sizeInBytes = item.getSize();
if (sizeInBytes<=10)
continue;
File uploadedFile = new File("/tmp/up" + ++cnt +".jpg");
try {
item.write(uploadedFile);
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
return;
}
}
}
} catch (FileUploadException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
return;
}
AddProductBean apb=new AddProductBean();
System.out.println("CNT= " + cnt);
FileInputStream[] fis=new FileInputStream[3];
for(int i=1;i<=cnt;i++)
{
File f=new File("/tmp/up" + i +".jpg");
fis[i-1]=new FileInputStream("/tmp/up" + i +".jpg");
Image[i-1]=new byte[(int) f.length()];
System.out.println(fis[i-1].read(Image[i-1], 0, (int)f.length()));
}
String str="khali";
byte[] n=str.getBytes();
System.out.println("Len= " + Image[0].length + " "+ Image[1].length + " "+ Image[2].length + " ");
try {
if(cnt==3)
apb.execute(SUBCAT, Name, BRAND, Price, Qty, Description, Image[0], Image[1], Image[2]);
else if(cnt==2)
apb.execute(SUBCAT, Name, BRAND, Price, Qty, Description, Image[0], Image[1], n);
else if(cnt==1)
apb.execute(SUBCAT, Name, BRAND, Price, Qty, Description, Image[0], n, n);
else
apb.execute(SUBCAT, Name, BRAND, Price, Qty, Description, n, n, n);
for(int i=0;i<3;i++)
{
if(fis[i]!=null)
fis[i].close();
}
if(apb.getRes()>=0)
{
response.sendRedirect("AddedProduct.jsp");
}
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
A very common question was getting servlets to work. The error is that httpservlet is not found.To correct that you need to add reference to j2ee.jar that can be found here
Extensions :
- Add provision for product offers or discount offers.
- Support for preview of multimedia products and downloadable products like games/softwares.
- Recommended products can be evaluated via Apriori algorithm.
Download :
Thursday, February 4, 2010
Digital Image Processing
I undertook a project on digital image processing (DIP) during May-June 2009 at Indian Space And Research Organization (ISRO). We learned a lot about the working of the great organization and also understood the concepts behind remote sensing and Geographical Information Systems (GIS). We also learnt the implementation of image processing algorithms and were planning to tweak them a little to align them with our project.
The Project:
I was to lead a team of 6 responsible for creating a project on the various techniques of image processing viz Classification, Enhancement & Filtering. We used Visual Studio 2008 as the IDE and created a MFC based project that provided a wide variety of DIP functions. We used the IGIS SDK to achieve our goal.
The next question that arises is :
Q) What is the IGIS SDK ?
A)
Well it is a under construction project that is a join venture of ISRO and a
company named Scanpoint Geomatics. So we were provided a dll that was exporting functions to do the processing in the background. Our task was massively reduced due to the high level of abstraction provided by the dll. But then again, since all this was under development (hence poorly documented) we had to write our own interface and handle
events and a GUI (Graphical User Interface) which could make the image
processing tasks easy.
Q) Is this IGIS SDK available as a free download and can anyone use it?
A)
Well it is a proprietary software and has to be bought (obviously we were
provided with keys for the development of project).
There are a lot of dimensions to the project.... its better that we read the complete documentation of the project. Well I was asked to present my project at both ISRO and my college. So here is the ppt I used.
As always, here are the sources to the project. But then again, you would require IGIS to be preinstalled for this to run.
On the whole, I can say that it was a great learning experience at ISRO. I am grateful to our project guide Mr. Vinod Bothale and would like to thank him for being there whenever needed.
Here for a quick preview of the project
Monday, July 13, 2009
Improve Performance Of Your Windows XP
Have you always wanted to get more out of your machine. Wanna see how to boost system speed and in turn speed up your activity over your computer?? Look No further. This is no publicity for a spyware mounted software that i will ask you to install and pay me for it. Instead i will tell you some tweaks that you can try yourself and feel the difference.
-
Disable Extra Startup Programs
There are certain programs that Windows will start every time you boot up your system, and during the startup phase, they're all competing for a slice of your CPU speed. Extra or unwanted items in the startup list will definitely increase your startup time, perhaps by several minutes. Some common examples are things related to AOL, RealPlayer, Napster, instant messengers, and video managers If you're not sure about an item, no big deal. You can turn it off, restart your PC, and see if everything seems to work. If not, you can always go back and re-enable an item in the Startup list. Here are is what you have to do:- Go to Start button Run
- Type "msconfig", without quotations
- Hit enter key or click the OK button
- A System Configuration Utility window will show up
- Click the Startup tab
- In the Startup tab you will see several boxes and some of them will selected (checked). All you have to do is to uncheck extra items that are of no use. If you run an antivirus program it is not recommended to uncheck it.
- After making you choices press the OK button, you will be prompted to restart computer to apply changes.
- After restarting your computer a dialogue will be displayed. You can check the option for not showing this dialogue every time your PC reboots.
Optimize Display Settings
Windows XP can look sexy but displaying all the visual items can waste system resources. To optimize:- Click the Start button
- Select Control Panel
- Double-click the System icon
- Click the Advanced tab
- In the Performance box click Settings
- Leave only the following ticked:
- Show shadows under menus
- Show shadows under mouse pointer
- Show translucent selection rectangle
- Use drop shadows for icons labels on the desktop
- Use visual styles on windows and buttons
- Finally, click Apply and OK
Optimize Folder Switching And File Browsing
You may have noticed that every time you open “My Computer” to browse folders that there is a slight delay. This is because Windows XP automatically searches for network files and printers every time you open Windows Explorer. To fix this and to increase browsing speed significantly:- Double-click on My Computer
- Click the Tools menu
- Select Folder Options
- Click on the View tab.
- Uncheck the Automatically search for network folders and printers check box
- Click Apply
- Click OK
- Reboot your computer
Disable File Indexing
Indexing Services is a small little program that uses large amounts of memory and can often make a computer endlessly loud and noisy. This system process indexes and updates lists of all the files that are on your computer. It does this so that when you do a searc for something on your computer, it will search faster by scanning th index lists. If you don’t search your computer often, this system service is completely unnecessary. To disable do the following:- Click Start button
- Select the Control Panel
- Double-click Add/Remove Programs
- Click the Add/Remove Window Components icon on the left side of the window
- This may take a few seconds to load. Be patient.
- Look for the “Indexing Services” component in the list
- Uncheck the Indexing Services
- Click Next
- Click Finish

Remove Un-Used Programs & Files
You may have a bunch of software packages on your hard drive that are no longer needed, or they were gratuitously installed when you downloaded some other package. Toolbars, file-sharing programs, free email enhancers, online shopping "companions" and download managers are notorious for this practice. These uninvited guests can put a big drag on your startup time, cause web pages to load slowly, and generally bog down your computer. Well we all know how do that... so i'll pass on that..
I hope that with these tweaks done you'll certainly feel your computer to be lighter and more responsive as ever. You will soon realize that its better to have more speed than the eye candy of the OS. HAPPY WORKING
Sunday, June 28, 2009
Cant Wait To Get My Hands On This Book

: The Rootkit Arsenal: Escape and Evasion in the Dark Corners of the System
- Pages: 908 pages
- Publisher: Jones & Bartlett Publishers (May 4, 2009)
- Language: English
- Fanatics Like Me : Click Here
Wednesday, June 3, 2009
Are you Smarter Than 5th grader
Java & Mysql Based Conference Client
Sunday, May 24, 2009
Java MS Access Primary and Foriegn Key
ArrayList<string> getAllTableNames()
2. // return the primary key of a given table
// as an ArrayList<string> with the primary key columns in proper // order
ArrayList<string> getPrimaryKey(String tableName) OR PREFERABLY:
write a method to return all the primary keys of all the tables at once.
3. // for a given table, return a list of 4-tuples which are // the relational constraints from foreign tables into this // table's primary keys. Each 4-tuple looks like this: // [PKTABLE_NAME, PKCOLUMN_NAME, FKTABLE_NAME, FKCOLUMN_NAME]
public ArrayList<arraylist<string>> getTableConstraints(String tableName)
OR PREFERABLY:
write a method to return all the relational constraints of all the tables at once.
4.// return a list of all the columns in the database as // a list of triples. Each triple looks like this: // [TABLE_NAME, COLUMN_NAME, DATA_TYPE]
ArrayList<arraylist<string>> reallyGetColumns()
My PROPOSED SOLUTION:
For getting the foreign key relationships you'll have to enable the read permission to system table via access (refer to screenshots).
Next :

For getting the foreign key relationships you'll have to enable the read permission to system table vi access (refer to screenshots).
Here are the Function Prototypes that are called :
1. private ArrayList<string> gettablenames(Connection con) throws SQLException
2. private ArrayList<string> getprimarykey(Connection con,String tablename) throws SQLException
3. ArrayList<arraylist><string>> getforeignKeys(Connection con,String tablename) throws SQLException
4. ArrayList<arraylist><string>> reallyGetColumns(Connection con) throws SQLException
Test The application by double clicking the jar. I am also attaching the database that i used to test it.
Here is the Executable To Test. Get it Now (sample Db included).
Here is the Source Code And Executable
: NetBeans Project
Websphere Application Server CE Support For RAD
1. Visit the welcome page from the Eclipse Update Site for IBM WebSphere Application Server Community Edition (http:// download.boulder.ibm.com/ibmdl/pub/software/websphere/wasce/updates/). 2. Find the deployable.zip package and click the linkage to download it. 3. Make sure Eclipse is not running. 4. Extract this package to your Eclipse directory. 5. Use the Eclipse -clean option after installing the WTP server adapter.
copy as root to the /opt/IBM/SDP directory using type : cd plugins type : cp -r * /opt/IBM/SDP/plugins/ type : cd .. type : cd features type : cp -r * /opt/IBM/SDP/features/
NOTE : There should be no ommission of file error.
then use ./eclipse -clean to rerun RADControl Internet Connection Opensuse
Install RAD
NOTE : choose jdk update 13. use ./ to run the jdk setup.
to install rad extract all zips files. now open konsole.
navigate to RAD_SETUP folder. Type : cd .. Type : chmod -R u+x RAD_SETUP Type : cd RAD_SETUP Type : ./launchpad.sh
Thats it you have launched the gui for RAD setup . install with default.
Note : Disconnect internet before starting launchpad.sh
Peice Of Cake!! right
OpenSUSE : For MP3 fans like me
go here install the codecs. just click on link and you will be fine.
DB2 Install on OpenSUSE
Put the opensuse dvd in drive and then search for libstdc++ . check libstdc++33 and click accept. it will install from cd in a sec.
then open Konsole (start -> applications) type in : su it will ask for password give it (123 if you created gennext as i told you) now keep the konsole running . Copy the db2 for linux tar file to your home directory (start -> computer -> home) now click on it to open with ark. extract its contents in home.
Now come back to the terminal .
Type : cd expc Type : ./db2setup and then the setup installer GUI will appear. and db2 will install fine.
Configuration Options for db2 :
DAS user : db2admin password : password do not change group or anything else. DB2 Instance Owner : User: work passowrd: 123 Default setting for fenced user. just type in password as 123.
FINISH log into work and then Now on konsole type db2start to start db2 and then db2cc to have the GUI front end like mysql query browserMULTIBOOTING OPENSUSE 11.1 VISTA
OPENSUSE install
Prerequisite Create a 15 - 20 GB unallocated partition through windows disk management or any partition manager of your choice,
Install:
Installation is pretty straight forward. I prefer to use KDE 4.1 desktop environment. HARDDISK CONFIG : I went for expert config and suggest that you should. You will not see the unallocated space you created there. but dont worry it is usable. click add and create a 600 MB ext 3 partition with mount point /boot. Next Create a 2 GB swap partition and the remaining an ext3 with mount point "/". If you want to access the windows files via opensuse select each of your windows partition and select edit. Next confirm that it says "DO NOT FORMAT" and set its mount point to / mnt/drive_C. the mount point will change as the number of drives are increased. BOOTLOADER CONFIG : when you finish giving all your inputs it displays an anallysis of taks. Select bootloader. switch to bootloader config there. select only 2 options. 1. install bootloader to boot partition 2. install bootloader to MBR
You are done......Sunday, January 11, 2009
System Process, Thread And Module Information Extractor
Ok .. So we have Our Driver Up And Running....
To Interface With the driver we also have a Usermode Program (Enlist.exe Bundled In Zip) in Microsoft Visual C++.
Run it to get the results from our driver. We get the following message on running it.
Now the output on the console will not be desirable so enlist.exe outputs the results to a LISTING.txt File created in the working directory.
Lets See What have we got in our LISTING.txt
As You can see that this also gives you the base address of the module loaded so if you are viewing memory its easy for you to locate them...
HOPE THIS HELPS....




