Thursday, March 3, 2011

CrazyEngineers Forum - Computer Science & IT Engineering

CrazyEngineers Forum - Computer Science & IT Engineering


Switch To iPad Interface In Chrome & Firefox By Changing User Agent String

Posted: 03 Mar 2011 12:55 AM PST

Introduction

You've heard about the iPad, haven't you. And chances are you want to get one soon. Well, why not check out how your favorite sites would look on an iPad before you get to lay your hands on the actual device. It could be done by changing the user agent string of your browser to that of iPad.

You can change user agent string of your browser and enjoy the iPad interface right inside it. Changing user agent string in Firefox and Safari is easy. But Chrome doesn't offer a direct method to do it.

Guide for Google Chrome Browser

Here's a step by step guide to change user string in Chrome and get the iPad interface.

1. Right click on the chrome shortcut and select Properties.



2. Now go to "Shortcut" tab.



3. In Target field, you will find this text written (where "username" is your windows username):

Code:

C:\Users\username\AppData\Local\Google\Chrome\Application\chrome.exe
Replace the text with the text shown below by copying the text and pasting it inside target field (make sure you have your actual windows username after C:\Users\.. ).

Code:

C:\Users\username\AppData\Local\Google\Chrome\Application\chrome.exe -user-agent="Mozilla/5.0(iPad; U; CPU iPhone OS 3_2 like Mac OS X; en-us) AppleWebKit/531.21.10 (KHTML, like Gecko) Version/4.0.4 Mobile/7B314 Safari/531.21.10"
4. Press OK.

Now open your Chrome browser. Open sites like Gmail, Twitter, YouTube that have released their iPad versions. Here's a screenshot of Gmail in Chrome, which now is exactly like you'll find it in an iPad.



Here's YouTube's iPad interface in Chrome.



Enjoy all the websites designed for iPad. You could also check how your own website looks on iPad (if you have one that is).

If you want to revert back to the original browser then you need to replace the user agent string with target location. Go to Chrome properties panel as mentioned in Step 1 and 2 and replace the user agent string with this text.

Code:

C:\Users\username\AppData\Local\Google\Chrome\Application\chrome.exe
If you are still getting the same iPad interface, clear the cache of your browser and it should be ok.

So, have you got the iPad yet? How's the experience of using it?


Guide for Mozilla Firefox Browser

For the Firefox users, follow this simple instruction.

Go to about:config and it says "This might void your warranty!". Click on "I'll be careful, I promise!" and you will find a list of options.

On the list, right click on any item. Click on New » String.

On the "Enter the preference name" textbox, type general.useragent.override and on the general.useragent.override, type Mozilla/5.0(iPad; U; CPU iPhone OS 3_2 like Mac OS X; en-us) AppleWebKit/531.21.10 (KHTML, like Gecko) Version/4.0.4 Mobile/7B314 Safari/531.21.10.

Once done, close all the instances of Firefox (all open windows) and start Firefox and enjoy the new iPad interface.

PS: If you want to reset, go to about:config and in the Filter, type general.useragent.override, right click on it and click on Reset. Close all the instances of Firefox and open again to restore the previous view.

Source: PraveenTech Research Labs » Switch To iPad Interface In Chrome By Changing User Agent String

Please share your experiences in the replies!!! :)

AJAX - Yellow Fade Technique

Posted: 03 Mar 2011 12:25 AM PST

My first technical post: AJAX - Yellow Fade Technique...

Dear Friends,

We might have seen in many pages about the Yellow Fade Technique. It's mainly used in AJAX. Well, I will explain it now.

Explanation

"There is something happening here, but you don't know what it is. Do you Mr. Jones?" - Bob Dylan

A lot of web sites & applications make you feel a bit like Mr. Jones.



That's why we've pioneered the Yellow Fade Technique (YFT). It's a nifty way to subtly spotlight a recently changed area on a page.

Why does this matter? When you edit or move something on a web page it usually forces a reload of that page. The problem is once the page reloads it's often difficult to spot and confirm the change (especially if the change occurred somewhere in the middle of the page). The YFT uses JavaScript to create a yellow highlight that briefly spotlights the change when the page reloads. Then, in a second or two, the highlight fades and the page reverts to its normal state. The YFT makes it super easy to spot edits/changes yet its unobtrusive nature lets people quickly get back to work once a modification is confirmed.

Let's take a look at an example.

Let's say I want to change the name of the second post on this Basecamp page from "CEO Photo" to "Jim Messier Photo."



First off, I'll go to the "Edit Post" page and change the post's title.



Once I save the change, the original page then reloads with the YFT (the yellow highlights the post I just changed). In the subsequent images, you can see how the yellow slowly fades out so it doesn't dominate the layout forever.








Voila, the page is back to normal within seconds.

Implementation

To see it in action, here's an example, how to do it. This is the most simplest implementation I can ever give you.

HTML Code:

<script type="text/javascript">
function yellowFade(el)
{
  var b = 100;
  function f()
  {
    el.style.background = 'rgb(255,255,'+ (b+=4) +')';
    if (b < 255)
    {
      setTimeout(f, 20);
    }
  };
  f();
}
</script>

This is the script of the core function to be used. Rather than using some libraries like Scriptaculous, we can use this small snippet. Now you can trigger the fade with the help of any button or element.

I have done a coding with a small div tag and a button. Also there's another div tag with an onmouseover event.

Complete Code:
HTML Code:

<html>
<head>
<title>Yellow Fade Technique</title>
<script language="JavaScript">
function yellowFade(el)
{
  var b = 100;
  function f()
  {
    el.style.background = 'rgb(255,255,'+ (b+=4) +')';
    if (b < 255)
    {
      setTimeout(f, 20);
    }
  };
  f();
}
</script>

</head>

<body>
  <div style="width:100px; height:100px" id="theDiv"></div><br>
  <input type="button" value="Do Fading!"
    onClick="yellowFade(document.getElementById('theDiv'));">
<br>
  &nbsp;
  <div style="width:100px; height:100px; text-align:center;
    padding-top: 40px; font-family: calibri, tahoma; font-size: small"

    onmouseover="yellowFade(this);">
MouseOver</div>
</body>
</html>

For execution, copy this Complete Code and paste it in notepad and save it as any HTML document (eg. fade.htm) and open it with any browser (Internet Explorer or Mozilla Firefox).

Comments are welcome!

The full article's source link: PraveenTech Research Labs » AJAX – Yellow Fade Technique Enjoy! :D :happy:

A few tips and tricks you can do in Windows XP!

Posted: 02 Mar 2011 10:59 AM PST

Quote:

Disclaimer: Before performing any of these, please note, all these are possible and worked under testing conditions. Neither me, nor CE is responsible for the damage caused to your system or files, by the following procedures. Use these at your own risk. I say this because, it uses the system's advanced processes. Just be careful.
Changing a user's password without knowing the old password
Press 'Start'.
Press 'Run'.
Type 'cmd'.
Then type 'net user'.
A list of users in your computer appears.

Type 'net user accountname *'.
(accountname is the name of the user account, one of those displayed in the above steps)

Then type the new password and press Enter.
You will be asked to retype the password for confirmation.
Type the same password and press Enter.

The password will be changed. You need not know the old password!
I am not sure whether this would work with the guest accounts, as all the corporate systems' users are guest users or limited users!

Screenshot:


Disable XP Boot Logo
It is possible to disable the XP splash screen, which will slightly speed up the overall boot process. Be aware that removing the splash screen will also cause you not to see any boot-up messages that might come up (chkdsk, convert ... ), but if your system runs without any problems then it should not matter.
1. Edit boot.ini.
2. Add " /noguiboot" right after "/fastdetect".
Upon restarting, the splash screen will be gone. It can be re-enabled by removing the new switch.

Turn Off Indexing to Speed Up XP
Windows XP keeps a record of all files on the hard disk so when you do a search on the hard drive it is faster. There is a downside to this and because the computer has to index all files, it will slow down normal file commands like open, close, etc. If you do not do a whole lot of searches on your hard drive then you may want to turn this feature off:
- Open My Computer.
- Right-click your hard drive icon and select Properties.
- At the bottom of the window you'll see "Allow indexing service to index this disk for faster searches," uncheck this and click ok.
- A new window will pop up and select Apply to all folders and subfolders.
It will take a minute or two for the changes to take affect but then you should enjoy slightly faster performance.

Clean Your Prefetch to Improve Performance
This is a unique technique for WinXP. We know that it is necessary to scrub registry and TEMP files for Win9X/ME/2000 periodically. Prefetch is a new and very useful technique in Windows XP. However, after using XP some time, the prefetch directory can get full of junk and obsolete links in the Prefetch catalog, which can slow down your computer noticeably.
- Open C(system drive):/windows/prefetch, delete those junk and obsolete files, reboot. It is recommended that you do this every month.

Auto Login
- Go to Start/Run, and type 'control userpasswords2'.
- From Users Tab, Uncheck "Users must enter ...."
- A dialog will allow setting a user and password to be used automatically.

Use the Ultimate Configuration Tool (Professional Edition Only)
One of the most full featured Windows XP configuration tools available is hidden right there in your system, but most people don't even know it exists. It's called the Local Group Policy Editor, or gpedit for short.

To invoke this editor:
- Select Start and then Run, then type the following:
gpedit.msc

After you hit Enter, you'll be greeted by gpedit, which lets you modify virtually every feature in Windows XP without having to resort to regedit.

May I post more? Your comments needed!

PHP database connectivity!!

Posted: 02 Mar 2011 10:26 AM PST

Hi Ceans,

As everyone knows PHP is web scripting language in simple terms its the language used for creating webpage or website. And its really important to know how to use PHP to connect to databases as all the website which are in existence right now use database as back-end to store information in a secure way as well as organized way. So in this tutorial I am gonna show you how to establish connection to a database using PHP. Lets get it started....

First lets see how to establish a connection to a database and then we will see how to execute simple query in order to show the fetched result set to users through webpage.

In order to establish a connection to MYSQL there is a predefined function called mysql_connect which takes three parameters, the first parameter is the host name ( the machine IP address where the mysql is residing ) and the second parameter is the username (mysql username) and the third parameter is the password (mysql password for that user name you have specified as second parameter) each parameter is separated from one another using a , (comma). So the connection string will be as shown below:


mysql_connect("host", "username", "password");


NOTE: If the database your trying to access is available in the same machine you can specify localhost as host name (That's the first parameter)

Ok now lets pass some real parameters to this connection string,

mysql_connect("localhost", "slashfear", "arvind");

Ok your done!! the above connection string will connect to local mysql server with the user name slashfear and password arvind, that's how you can connect to database using PHP simple right!!


For other databases like oracle, postgresql, sybase, db2 the predefined function as well the parameters will change and are listed below for your reference:

Oracle database connection:

oci_connect("username", "password", "host");

Postgresql database connection:

pg_connect("host=hostname port=5432 dbname=demo user=slashfear password=arvind");

Sybase database connection:

sybase_connect('host', 'username', 'passoword');

DB2 database connection:

db2_connect("DATABASE=demo;HOSTNAME=host;", "username", "password");



Now we know how to connect to database, its important to know how to disconnect from it too so in-order to disconnect from a mysql database we have to call the predefined function mysql_close which will take one parameter which is the reference to the connection which your willing to close so lets look at a an example for clear understanding:

$dbcon = mysql_connect("localhost", "slashfear", "arvind");

mysql_close($dbcon);


So in the above snippet the variable $dbcon reference to the connection to mysql which connects to the local mysql server with the user name slashfear and identified by password arvind. So in order to disconnect from the database we call the function called mysql_close and pass the variable name which holds the reference to the connection string.

Following is the list of predefined functions to perform disconnection from other database:

Oracle database disconnection:

$dbcon = oci_connect("username", "password", "host");
oci_close($dbcon);


Postgresql database disconnection:

$dbcon = pg_connect("host=hostname port=5432 dbname=demo user=slashfear password=arvind");
pg_close($dbconn);

Sybase database disconnection:

$dbcon = sybase_connect('host', 'username', 'passoword');
sybase_close($dbconn);

DB2 database disconnection:

$dbcon = db2_connect("DATABASE=demo;HOSTNAME=host;", "username", "password");
db2_close($dbconn);


Stay tuned for continuation of this tutorial which will show you how to execute simple query from php to databases :) ..... ( will continue tomorrow as i have work now :( )

If you have any doubts please feel free to ask!!


-Arvind

Message to All Ceans.. about Beehive Intelligence.

Posted: 02 Mar 2011 07:08 AM PST

Hi, to everybody.I am doing my final Engineering one of my lecturer suggested me to do a seminar on Beehive intelligence.but i don't no the Basics of it ..

It would be very much appreciated if any one could assist me in understanding the basics of Beehive intelligence,as soon as possible.

I thought of Posting this here in the forum as i found it as The best place. As it contains more number of Engineers.

Thanks in advance..::happy:

Java Interview Questions asked by IBM HRs

Posted: 02 Mar 2011 03:58 AM PST

Q:Do you have to use design pattern in J2EE project?
Ans:Yes. If I do it, I will use it. Learning design pattern will boost my coding skill.

Q:What is Struts?
Ans: A Web page development framework. Struts combine Java Servlets, Java Server Pages, custom tags, and message resources into a unified framework. It is a cooperative, synergistic platform, suitable for development teams, independent developers, and everyone between.

Q:What is Model 2?
Ans:Using JSP and Servlet together to develop Web page. Model 2 applications are easier to maintain and extend, because views do not refer to each other directly.
:)

No comments:

Post a Comment