Tuesday, August 30, 2011

Remote Debugging Eclipse Indigo & JBOSS 5.4

I am tired of putting logs and trying to identify the errors or track various stuff. So I decided to configure remote debugging for my project which is running in JBOSS server.

The steps to configure is given below.
  1. Make a backup copy of your current JBoss run.bat
  2. Open run.bat and find the lines that look like this:
    1rem JPDA options. Uncomment and modify as appropriate to enable remote debugging.
    2rem set JAVA_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,address=8787,server=y,suspend=y %JAVA_OPTS%
  3. Uncomment the second line by deleting "rem", and save.
  4. Start Jboss. (It won’t do much until you connect a debugger to it.)
  5. In Eclipse, open your project, and on the toolbar click on the debugger bug arrow, then Open Debug Dialog. If you couldn't find it quickly, Go to Run, Debug Configurations , Select Java Remote Debugger and Click on New.
  6. Choose Remote Java Application, right-click, New… and update the port to the address in the line you uncommented (possibly 8787).
  7. Click Debug
  8. Set a breakpoint somewhere in your code or a library that has source attached
  9. Exercise your project (via a web service, for instance) and when it hits one of your breakpoints, it will break in Eclipse.

Saturday, August 27, 2011

How to check file size of directories in UNIX

#check partition sizes df -h  #check directory size du -s -h /var/log/  #check every directory and file sizes under a dir. du -s -h /var/log/*  #check individual size size du -s -h /var/log/lastlog 

Sunday, February 13, 2011

wget - GNU Wget Manual

GNU Wget is a free utility for non-interactive download of files from the Web. It supports HTTP, HTTPS, and FTP protocols, as well as retrieval through HTTP proxies.

Wget is non-interactive, meaning that it can work in the background, while the user is not logged on. This allows you to start a retrieval and disconnect from the system, letting Wget finish the work. By contrast, most of the Web browsers require constant user's presence, which can be a great hindrance when transferring a lot of data.

Wget can follow links in HTML pages and create local versions of remote web sites, fully recreating the directory structure of the original site. This is sometimes referred to as ``recursive downloading.'' While doing that, Wget respects the Robot Exclusion Standard (/robots.txt). Wget can be instructed to convert the links in downloaded HTML files to the local files for offline viewing.

Wget has been designed for robustness over slow or unstable network connections; if a download fails due to a network problem, it will keep retrying until the whole file has been retrieved. If the server supports regetting, it will instruct the server to continue the download from where it left off.

Tuesday, January 4, 2011

"connect by prior" in Oracle

For eg.

SELECT employee_id, last_name, manager_id
FROM employees
CONNECT BY PRIOR employee_id = manager_id;

A condition that identifies the relationship between parent rows and child rows of the hierarchy.

Tuesday, November 9, 2010

Telnet in Windows 7

Today I got an error while trying to use telnet in my windows 7 machine.

Refer this link and resolve this issue.

http://www.question-defense.com/2010/07/23/windows-7-telnet-is-not-recognized-as-an-internal-or-external-command

Tuesday, August 17, 2010

32 bit or 64 bit for web server

We had a confusion on how to go about the webserver, which 30 concurrent users are assumed to be using at a time. The application we are developing has a desktop component and webcomponent. So we decided to go with 32 bit OS for development and 64 bit OS for webserver. Webserver requires more RAM and also better configuration. I shall update this session on what all problems we will face during the course of project in this thread !!

Thursday, July 29, 2010

Data Transfer Object From Client to Server

I am designing a distributed application, and to satisfy a single client request, I found myself making multiple calls to a remote interface, which increases the response time beyond acceptable levels. I found out a solution by using DTO (Data Transfer Object).

When designing a data transfer object, you have two primary choices: use a generic collection or create a custom object with explicit getter and setter methods.

A generic collection has the advantage that you only need a single class to fit any data transfer purpose throughout the whole application. The main drawback of using collection objects for DTOs is that the client has to access fields inside the collection either by position index (in the case of a simple array) or by element name (in the case of a keyed collection). Also, collections store items of the same type (usually the most generic Object type), which can lead to subtle but fatal coding errors that cannot be detected at compile time.

Better option would be going with a DTO class object. In Dotnet, it already provides you with a DTO object called Dataset. You can add DataTables, their relationships and transfer across various modules.

Sunday, June 20, 2010

Perl | Could not dupe : Bad file number

Yesterday I encountered an issue while running the script which does ssh to a remote server using the perl library Net:SSH::Perl. After succesfully perform ssh->login($user) it was stopping the operation while I am trying to do ssh->cmd("/usr/sbin/ping $ipaddress).
After several investigation I found out that after trying to do the ssh->new($host), I am writing close(STDIN). The OS is sun solaris v4. This close of STDIN is creating the problem. I am now using the close STDIN down the line and everything seems to be working perfectly fine now.

Sunday, November 8, 2009

Reflexology

Reflexology is the physical act of applying pressure to the feet and hand with specific thumb, finger and hand techniques without the use of oil or lotion. it is based on a system of zones and reflex areas that reflect an image of the body on the feet and hands with a premise that such work effects a physical change to the body.

Sunday, October 25, 2009

Send email from UNIX | Perl script

This will show you how to send an email from unix server using a perl script.

open (MsgFILE, "> $msgFile");
print MsgFILE "\n I am sending an email to all of you \n";

close(MsgFILE);
print "\n sending mail....\n" if $debug;

open (MAIL,"|(cat $msgFile ; uuencode $file $to_file_name) | mailx -r $from -c $MailCc -s \"$Subject\" $to") or die "Cannot open sendmail: $!";

close MAIL;

To set up SSH Keys - UNIX

The process of creating SSH - Version 2 keys in the destination server is given below.

Login to source server using the your user id
scp id_dsa.pub user@destination_server:./id_dsa.pub


Login to the destination server using the user name and password
cd .ssh
touch authorized_keys2
chmod 600 authorized_keys2
cat ../id_dsa.pub >> authorized_keys2
rm ../id_dsa.pub

Logout from the destination server and try to login from source server again using the following command,

ssh -2 -v user@destination_server
Or
ssh destination_server

vi editor is throwing error '5826'

This happens because of several reasons. If the same file is opened under the same user in a different system, this problem can occur. Never mind, never worry about this problem. You just need to update the env variable of the user.

export EDITOR=vi

Change Password in UNIX

To change password in UNIX ,

1. If you already know the old password,
then run the command 'passwd'.

2. If you dont remember, better you ask sysadm :)

Wednesday, April 1, 2009

Securing Role Authorization in ASP.NET 2.0

To protect the authorization cookie you need to encrypt and integrity check it, use SSL to protect the cookie over the wire, and do not persist the cookie on the client.
When using role caching securing the roles cookie is of prime importance. This is to stop users modifying the list of roles to which they belong, and to stop intruders from gaining information about the roles used by your application.
* Ensure the cookie is encrypted and integrity checked by setting the cookieProtection attribute to All.
* Ensure that the authorization cookie is only transmitted over HTTPS connections by setting cookieRequireSSL to true.
* Ensure that the roles cookie is not persisted on the client computer by setting createPersistentCookie to false.
* If you cannot use SSL, consider reducing the cookie lifetime by reducing the cookieTimeout value to minimize the time window within which an attacker can use a captured roles cookie to access your site with privileged rights.
* If you are in a scenario where you are concerned about cookie hijacking, consider reducing the timeout and setting slidingExpiration="false".

Here is a sample secured configuration


cacheRolesInCookie="true"
cookieName=".ASPROLES"
cookieTimeout="30"
cookiePath="/"
cookieRequireSSL="true"
cookieSlidingExpiration="true"
cookieProtection="All"
createPersistentCookie="false">

Sunday, December 7, 2008

Moving files from Windows to Unix

While moving files from windows to unix, we use several softwares like FTPclient, WinSCP3 etc. We may use binary mode to move the files from windows to unix. When we want to run a sql query file (*.sql) in Unix and the file has been transferred from windows to unix, make sure that you are running the following commands after copying the file.

DosToUnix "myQuery.sql"

This will prevent the junk characters which we can find inside the copied sql file.

Thursday, September 4, 2008

GOOGLE WEBBROWSER - CHROME

Google have launched web browser Chrome. Lets review it !
Google leaked news of the browser yesterday by releasing a comic book (by comics legend Scott McCloud) describing the design decisions that went into the new browser.

For users, Chrome is a brand new web browser with blazing fast load times and a minimalist interface, designed to highlight page content over (ironically) browser chrome. Customary browser features are tucked away behind clever user interface elements, most of which are easily discoverable as you need them.

For developers, Chrome uses the same WebKit rendering engine as Safari, but bundles its own screaming fast JavaScript engine, called V8. The browser's common ancestry with Safari will help to reduce the testing burden on developers of a whole new browser, but when testing is required, Chrome includes a DOM/CSS inspector, an HTTP profiler, and a JavaScript debugger.

Google Chrome is a browser that combines a minimal design with sophisticated technology to make the web faster, safer, and easier.



http://www.google.com/chrome/intl/en/features.html
Google says one tab is indepenedent of the other. Even if one page in one tab hangs , it wont affect the other tab.
It will be downloaded as 475 Kb file and on installing it will be downloading from Internet. It took me around 3-4 minutes to download in 2 MBPS internet.
Youtube loaded fantastically fast. WOW...I loved it.
When I tried www.orkut.com. This is what happening. How will I login to Orkut ?????



Wednesday, September 3, 2008

Split Tunneling

Split tunneling is a computer networking concept which allows a VPN user to access a public network (e.g., the Internet) and a local LAN or WAN at the same time, using the same physical network connection. This connection service is usually facilitated through a program such as a VPN client software application.

Tuesday, September 2, 2008

Binding Handler is Invalid ASP.NET

This issue happened when I tried to run the ASP.NET website which I created. This happens with the Visual Studio 2005 debugger.To solve the issue , it's very simple

-> Start> run > services.msc
-> Start the terminal service.


I have seen many of my colleagues say something like "I don't want to enable the Terminal Services service because it’s a security risk".Enabling the Terminal Services service does NOT automatically enable Remote Desktop. If you want Remote Desktop disabled, then uncheck the remote desktop checkbox on the Remote tab of the properties dialog for My Computer. By default, Remote Desktop is disabled on Window XP, so unless you have gone and enabled it, it should already be disabled on your computer.The Terminal Services service is enabled by default because in addition to the Remote Desktop functionality, it also provides for Remote Assistance, Fast User Switching, process listing, DCOM support.

So why does the debugger rely on the Terminal Services service? The answer: Process listing. It turns out that the TS team provides the best task list API in Windows. Both tasklist.exe and taskmgr.exe use the TS service for this, and so it was natural for the debugger to follow their lead. Previous versions of Visual Studio got their task list through other task list APIs, but it turns out that this only works well if you run your code as LocalSystem. This was fine at the time because we had a service. However, for improved security and stability, the debugger got rid of their service for the 2005 release, so we needed to switch to the TS process listing API.

Hibernating Issue in Windows xp

Computers running Windows XP with more than 1 GB of RAM may fail to hibernate. The best way to describe the problem is by the steps taken and the response from the system.
  1. The user requests the system to hibernate.
  2. The system appears to think about it for a couple of seconds.
  3. As the system tries to switch video modes, just before displaying the “Hibernating…” progress bar, the Windows Exclamation sound plays.
  4. The video mode switches back, and a dialog box opens with the message:
    Insufficient System Resources Exist to Complete the API.
fter the problem occcurs, the hibernation option is no longer available to the user. In fact, the hibernation tab normally found in the Power Options is hidden until the next system reboot.

I have read the same solution over and over: Apply this hotfix or update your system to Service Pack 2. Unfortunately, I am beginning to wonder how many of these recommendations are coming from users with less than 1 GB of RAM. I personally use a desktop and laptop computer, with 1.25 GB and 1.5 GB of RAM respectively, and both exhibit the problem regardless of the applied hotfix or SP2 (which includes the hotfix). If you count two of my friends who also have this problem, I know of four (4) computers that are adversely affected. In other words, with the only fix currently available, 100% of the computers I have access to are still broken!

2006.09.08
Update: Microsoft has released the hotfix to the public. If you have been needing the hotfix for a language other than English, you may now download it directly from Microsoft’s website.


Wednesday, October 3, 2007

F1 - wow , and again wow !

One of my friend asked why F1 cars are soo special ...It is really special......When an F1 driver hits the brakes on his car he experiences retardation or deceleration comparable to a regular car driving through a BRICK wall at 300kmph!!! ...F1 car can go from 0 to 160 kph and back to 0 in FOUR seconds!!!!!!!F1 car engines last only for about 2 hours of racing mostly before blowing up on the other hand we expect our engines to last us for a decent 20yrs on an average and they quite faithfully DO....that's the extent to which the engines are pushed to perform... An average F1 driver looses about 4kgs of weight after just one race due to the prolonged exposure to high Gravitational forces and temperatures for little over an hour.To give you an idea of just how important aerodynamic design and added down force can be, small planes can take off at slower speeds than F1 cars travel on the track.
Without aerodynamic down force, high-performance racing cars have sufficient power to produce wheel spin and loss of control at 160 kph. They usually race at over 300 kph. In a street course race like the Monaco grand prix, the down force provides enough suction to lift manhole covers. Before the race all of the manhole covers on the streets have to be welded down to prevent this from happening!The refuelers used in F1 can supply 12 liters of fuel per second. This means it would take just 4 seconds to fill the tank of an average 50 liter family car. They use the same refueling rigs used on US military helicopters today.The refuelers used in F1 can supply 12 liters of fuel per second. This means it would take just 4 seconds to fill the tank of an average 50 liter family car. They use the same refueling rigs used on US military helicopters today.TOP F1 pit crews can refuel and change tyres in around amazing 3 seconds. During the race the tyres lose weight! Each tyre loses about 0.5 kg in weight due to wear.Normal tyres last 60 000 - 100 000 km. Racing tyres are designed to last 90 - 120 km.A dry-weather F1 tyre reaches peak operating performance (best grip) when tread temperature is between 900C and 1200C.(Water boils at 100C remember) At top speed, F1 tyres rotate 50 times a second.

After coming to know about these point , I just can say "WOW !!!!"