Sunday, January 16, 2011

Configuring your network settings to use Google Public DNS

When you use Google Public DNS, you are changing your DNS "switchboard" operator from your ISP to Google Public DNS.

In most cases, the IP addresses used by your ISP's domain name servers are automatically set by your ISP via the Dynamic Host Configuration Protocol (DHCP). To use Google Public DNS, you need to explicitly change the DNS settings in your operating system or device to use the Google Public DNS IP addresses. The procedure for changing your DNS settings varies according to operating system and version (Windows, Mac or Linux) or the device (computer, phone, or router). We give general procedures here that might not apply for your OS or device; please consult your vendor documentation for authoritative information.

Note: We recommend that only users who are proficient with configuring operating system settings make these changes.

Important: Before you start

Before you change your DNS settings to use Google Public DNS, be sure to write down the current server addresses or settings on a piece of paper. It is very important that you keep these numbers for backup purposes, in case you need to revert to them at any time.

Google Public DNS telephone support

  • 877-590-4367 in the U.S.
  • 770-200-1201 outside the U.S.

Google Public DNS IP addresses

The Google Public DNS IP addresses are as follows:

  • 8.8.8.8
  • 8.8.4.4

You can use either number as your primary or secondary DNS server. You can specify both numbers, but do not specify one number as both primary and secondary.

Changing your DNS servers settings

Because the instructions differ between different versions/releases of each operating system, we only give one version as an example. If you need specific instructions for your operating system/version, please consult your vendor's documentation. You may also find answers on our user group.

Many systems allow you to specify multiple DNS servers, to be contacted in a priority order. In the following instructions, we provide steps to specify only the Google Public DNS servers as the primary and secondary servers, to ensure that your setup will correctly use Google Public DNS in all cases.

Note: Depending on your network setup, you may need administrator/root privileges to change these settings.

Microsoft Windows

DNS settings are specified in the TCP/IP Properties window for the selected network connection. 

Example: Changing DNS server settings on Microsoft Windows 7

  1. Go the Control Panel.
  2. Click Network and Internet, then Network and Sharing Center, and click Change adapter settings.
  3. Select the connection for which you want to configure Google Public DNS. For example:
    • To change the settings for an Ethernet connection, right-click Local Area Connection, and click Properties.
    • To change the settings for a wireless connection, right-click Wireless Network Connection, and click Properties.

If you are prompted for an administrator password or confirmation, type the password or provide confirmation.

  1. Select the Networking tab. Under This connection uses the following items, click Internet Protocol Version 4 (TCP/IPv4), and then click Properties.
  2. Click Advanced and select the DNS tab. If there are any DNS server IP addresses listed there, write them down for future reference, and remove them from this window.
  3. Click OK.
  4. Select Use the following DNS server addresses. If there are any IP addresses listed in the Preferred DNS server or Alternate DNS server, write them down for future reference.
  5. Replace those addresses with the IP addresses of the Google DNS servers: 8.8.8.8 and 8.8.4.4.
  6. Restart the connection you selected in step 3.
  7. Test that your setup is working correctly; see Testing your new settings below.
  8. Repeat the procedure for additional network connections you want to change.

Mac OS X

DNS settings are specified in the Network window. 

Example: Changing DNS server settings on Mac OS 10.5

  1. From the Apple menu, click System Preferences, then click Network
  2. If the lock icon in the lower left-hand corner of the window is locked, click the icon to make changes, and when prompted to authenticate, enter your password.
  3. Select the connection for which you want to configure Google Public DNS. For example:
    • To change the settings for an Ethernet connection, select Built-In Ethernet, and click Advanced.
    • To change the settings for a wireless connection, select Airport, and click Advanced.
  4. Select the DNS tab.
  5. Click + to replace any listed addresses with, or add, the Google IP addresses at the top of the list: 8.8.8.8 and 8.8.4.4.
  6. Click Apply and OK.
  7. Test that your setup is working correctly; see Testing your new settings below.
  8. Repeat the procedure for additional network connections you want to change.

Linux

In most modern Linux distributions, DNS settings are configured through Network Manager.

Example: Changing DNS server settings on Ubuntu

  1. In the System menu, click Preferences, then click Network Connections.
  2. Select the connection for which you want to configure Google Public DNS. For example:
    • To change the settings for an Ethernet connection, select the Wired tab, then select your network interface in the list. It is usually called eth0.
    • To change the settings for a wireless connection, select the Wireless tab, then select the appropriate wireless network.
  3. Click Edit, and in the window that appears, select the IPv4 Settings tab.
  4. If the selected method is Automatic (DHCP), open the dropdown and select Automatic (DHCP) addresses only instead. If the method is set to something else, do not change it.
  5. In the DNS servers field, enter the Google Public DNS IP addresses, separated by a space: 8.8.8.8  8.8.4.4
  6. Click Apply to save the change. If you are prompted for a password or confirmation, type the password or provide confirmation.
  7. Test that your setup is working correctly; see Testing your new settings below.
  8. Repeat the procedure for additional network connections you want to change.

If your distribution doesn't use Network Manager, your DNS settings are specified in /etc/resolv.conf.

Example: Changing DNS server settings on a Debian server

  1. Edit /etc/resolv.conf:
sudo vi /etc/resolv.conf
  1. If any nameserver lines appear, write down the IP addresses for future reference.
  2. Replace the nameserver lines with, or add, the following lines:
nameserver 8.8.8.8
nameserver 8.8.4.4
  1. Save and exit.
  2. Restart any Internet clients you are using.
  3. Test that your setup is working correctly; see Testing your new settings below.

Additionally, if you are using DHCP client software that overwrites the settings in /etc/resolv.conf, you will need to set up the client accordingly by editing the client's configuration file.

Example: Configuring DHCP client sofware on a Debian server

  1. Back up /etc/resolv.conf:
sudo cp /etc/resolv.conf /etc/resolv.conf.auto
  1. Edit /etc/dhcp3/dhclient.conf:
sudo vi /etc/dhcp3/dhclient.conf
  1. If there is a line containing domain-name-servers, write down the IP addresses for future reference.
  2. Replace that line with, or add, the following line:
prepend domain-name-servers 8.8.8.8, 8.8.4.4;
  1. Save and exit.
  2. Restart any Internet clients you are using.
  3. Test that your setup is working correctly; see Testing your new settings below.

Routers

Every router uses a different user interface for configuring DNS server settings; we provide only a generic procedure below. For more information, please consult your router documentation.

Note: Some ISPs hard-code their DNS servers into the equipment they provide; if you are using such a device, you will not be able to configure it to use Google Public DNS. Instead, you can configure each of the computers connected to the router, as described above.

To change your settings on a router:

  1. In your browser, enter the IP address to access the router's administration console. 
  2. When prompted, enter the password to access network settings.
  3. Find the screen in which DNS server settings are specified. 
  4. If there are IP addresses specified in the fields for the primary and seconday DNS servers, write them down for future reference.
  5. Replace those addresses with Google IP addresses: 8.8.8.8 and 8.8.4.4.
  6. Save and exit.
  7. Restart your browser.
  8. Test that your setup is working correctly; see Testing your new settings below.

Mobile or other devices

DNS servers are typically specified under advanced wi-fi settings. However, as every mobile device uses a different user interface for configuring DNS server settings, we provide only a generic procedure below. For more information, please consult your mobile provider's documentation.

To change your settings on a mobile device:

  1. Go to the screen in which wi-fi settings are specified.
  2. Find the screen in which DNS server settings are specified.
  3. If there are IP addresses specified in the fields for the primary and seconday DNS servers, write them down for future reference.
  4. Replace those addresses with Google IP addresses: 8.8.8.8 and 8.8.4.4.
  5. Save and exit.
  6. Test that your setup is working correctly; see Testing your new settings below.

Testing your new settings

To test that the Google DNS resolver is working:

  1. From your browser, type in a hostname, such as http://www.google.com. If it resolves correctly, bookmark the page, and try accessing the page from the bookmark. If both of these tests work, everything is working correctly. If not, go to step 2.
  2. From your browser, type in a fixed IP address. You can use http://18.62.0.96/ (which points to the website http://www.eecs.mit.edu/) as the URL*. If this works correctly, bookmark the page, and try accessing the page from the bookmark. If these tests work (but step 1 fails), then there is a problem with your DNS configuration; check the steps above to make sure you have configured everything correctly. If these tests do not work, go to step 3.
  3. Roll back the DNS changes you made and run the tests again. If the tests still do not work, then there is a problem with your network settings; contact your ISP or network administrator for assistance.

* Google thanks MIT for granting permission to use this URL for the purposes of testing web connectivity.

Diagnosing resolution problems

If you are encountering problems when resolving particular names, and want to verify whether the problem is with Google Public DNS, please try running the following diagnostic procedures. If you want to report a problem to the Google Public DNS user group, please copy and paste the results of the commands in your email. This information is vital to help us to identify the cause of the problem.

Step 1: Verify that your client can communicate with the Google Public DNS servers

Open a command prompt, and run the following command:

On Windows:

tracert -d 8.8.8.8

On Mac OS X:

  /usr/sbin/traceroute -n -w 2 -q 2 -m 30 8.8.8.8

On Linux:

sudo traceroute -n -w 2 -q 2 -m 30 8.8.8.8

If the last line of the output does not list 8.8.8.8 as the final hop, or if there are significant timeouts, there may be a network problem preventing you from contacting our servers. Please include the output of the command in any communication with the Google Public DNS team.

If the last line of the output does list 8.8.8.8 as the final hop, continue to step 2.

Step 2: Verify that Google Public DNS can resolve the selected hostname

At the command prompt, run the following command, where hostname is the name that you were having difficulty resolving:

On Windows:

nslookup -debug hostname 8.8.8.8

On Mac and Linux:

dig @8.8.8.8 hostname

If the the output shows an answer section with an A record for the hostname, then Google Public DNS is able to resolve the name. Check your settings to make sure your system is correctly configured to use Google Public DNS. If you are still unable to solve the problem, please include the output of the command in any communication with the Google Public DNS team.

If the output does not show an answer for the hostname, continue to step 3.

Step 3: Verify that another open resolver can resolve the selected hostname

At the command prompt, run any one of the following commands, where hostname is the name that you were having difficulty resolving:

nslookup hostname 4.2.2.1
nslookup hostname 4.2.2.2
nslookup hostname 208.67.222.222
nslookup hostname 208.67.220.220

(The first two commands test Level 3's DNS servers. The last two commands test OpenDNS' DNS servers.)

If you are not able to get a successful result, this means that there is most likely a problem with the server you are trying to contact. Wait some time and try running the tests again. This may be a temporary problem on the server's side that will likely resolve itself eventually. If it does not, you should contact the owner of the server.

If you do get a successful result, there may be a problem with Google Public DNS. Please include the output of this command and the one from step 2 in any communication with the Google Public DNS team.

Switching back to your old DNS settings

If you had not previously configured any customized DNS servers, to switch back to your old settings, in the window in which you specified the Google IP addresses, select the option to enable obtaining DNS server addresses automatically, and/or delete the Google IP addresses. This will revert your settings to using your ISP's default servers.

If you need to manually specify any addresses, use the procedures above to specify the old IP addresses.

If necessary, restart your system.

 


Wednesday, December 22, 2010

Timeless

A young man learns what's most important in life from the guy next door. It had been some time since Jack had seen the old man. College, girls, career, life itself got in the way. In fact, Jack moved clear across the country in pursuit of his dreams. There, in the rush of his busy life, Jack had little time to think about the past and often no time to spend with his wife and son. He was working on his future, and nothing could stop him.

 

Over the phone, his mother told him, "Mr. Belser died last night. The funeral is Wednesday."

Memories flashed through his mind like an old newsreel as he sat quietly remembering his childhood days. "Jack, did you hear me?"

"Oh, sorry, Mom. Yes, I heard you. It's been so long since I thought of him. I'm sorry, but I honestly thought he died years ago," Jack said.

 

"Well, he didn't forget you. Every time I saw him he'd ask how you were doing. He'd reminisce (recall) about the many days you spent over 'his side of the fence' as he put it," Mom told him.

"I loved that old house he lived in," Jack said.

"You know, Jack, after your father died, Mr. Belser stepped in to make sure you had a man's influence in your life," she said.

"He's the one who taught me carpentry," Jack said.

"I wouldn't be in this business if it weren't for him. He spent a lot of time teaching me things he thought were important...Mom, I'll be there for the funeral," Jack said.

 

As busy as he was, he kept his word. Jack caught the next flight to his hometown.

Mr. Belser's funeral was small and uneventful. He had no children of his own, and most of his relatives had passed away.

The night before he had to return home, Jack and his Mom stopped by to see the old house next door one more time.

Standing in the doorway, Jack paused for a moment. It was like crossing over into another dimension, a leap through space and time.

The house was exactly as he remembered. Every step held memories. Every picture, every piece of furniture....Jack stopped suddenly.

 

"What's wrong, Jack?" his Mom asked.

"The box is gone," he said. "What box? " Mom asked.

"There was a small gold box that he kept locked on top of his desk. I must have asked him a thousand times what was inside. All he'd ever tell me was 'the thing I value most,'" Jack said.

It was gone. Everything about the house was exactly how Jack remembered it, except for the box. He figured someone from the Belser family had taken it. "Now I'll never know what was so valuable to him," Jack said.

"I better get some sleep. I have an early flight home, Mom."

It had been about two weeks since Mr. Belser died. Returning home from work one day Jack discovered a note in his mailbox.

"Signature required on a package. No one at home. Please stop by the main post office within the next three days," the note read.

Early the next day Jack retrieved the package. The small box was old and looked like it had been mailed a hundred years ago.

 

The handwriting was difficult to read, but the return address caught his attention."Mr. Harold Belser" it read.

Jack took the box out to his car and ripped open the package.

There inside was the gold box and an envelope. Jack's hands shook as he read the note inside.

"Upon my death, please forward this box and its contents to Jack Bennett. It's the thing I valued most in my life."

 

A small key was taped to the letter. His heart racing, as tears filling his eyes, Jack carefully unlocked the box.

There inside he found a beautiful gold pocket watch.

Running his fingers slowly over the finely etched casing, he unlatched the cover. Inside he found these words engraved:

"Jack, Thanks for your time! Harold Belser."

"The thing he valued most...was...my time."

 

Jack held the watch for a few minutes, then called his office and cleared his appointments for the next two days.

"Why?" Janet, his assistant asked.

"I need some time to spend with my son," he said. "Oh, by the way, Janet...thanks for your time!"

"Life is not measured by the number of breaths we take but by the moments that take our breath away,"

 

Think about it this CHRISTmas. The little Infant Jesus would love you to spend some time with Him...

You may not realize it, but it's 100% true.

Saturday, October 23, 2010

Fatalism or Faith?

A flood was threatening a small town and everyone was leaving for safety except one man who said, "God will save me. I have faith." As the water level rose a jeep came to rescue him, the man refused, saying "God will save me. I have faith." As the water level rose further, he went up to the second storey, and a boat came to help him. Again he refused to go, Belying, "God will save me. I have faith." The water kept rising and the man climbed on to the roof. A helicopter came to rescue him, but he said, "God will save me. I have faith." Well, finally he drowned. When he reached to GOD, he angrily questioned, "I had complete faith in you. Why did you ignore my prayers and let me drown?"
 
The Lord replied, "Who do you think sent you the jeep, the boat, and the helicopter?"
 
The only way to overcome the fatalistic attitude is to accept responsibility and believe in the law of cause and effect rather than luck (As you Sow you shall reap). It takes action, preparation and planning rather than waiting, wondering or wishing, to accomplish anything in life. You gotta step out in Faith. But if God says Wait! Then you gotto wait.
 
When you place your onus on God and step out in faith as Peter;  who obeyed the command of God and stepped into the Sea and walked as on dry ground; you would also see the works of God in your life clearly manifesting His majesty.
 
Alexander Graham Bell was desperately trying to invent a hearing aid for his partially deaf wife. He failed at inventing a hearing aid but in the process discovered the principles of the telephone. You wouldn't call someone like that lucky, would you? Good luck is when opportunity meets preparation. Without effort and preparation, lucky coincidences don't happen. GOD helps those who help themselves. Luck is an excuse mortal men make.
 
Moral of the Story:
We have to move out in faith than to remain idle waiting for the storm to pass. Stop excusing yourself by saying that "It all depends on luck" or "the right time is yet to come".  In the book of James we see clearly; that "faith without works is dead."

Friday, October 15, 2010

SGS Codes

FYI These codes have been obtained by decoding various .apk files present in the phone firmware.

*#*#4636#*#*

This code can be used to get some interesting information about your phone and battery. It shows following 4 menus on screen:

  • Phone information
  • Battery information
  • Battery history
  • Usage statistics

*#*#7780#*#*

This code can be used for a factory data reset. It'll remove following things:

  • Google account settings stored in your phone
  • System and application data and settings
  • Downloaded applications

It'll NOT remove:

  • Current system software and bundled applications
  • SD card files e.g. photos, music files, etc.

PS: Once you give this code, you get a prompt screen asking you to click on "Reset phone" button. So you get a chance to cancel your operation.

*2767*3855#

Think before you give this code. This code is used for factory format. It'll remove all files and settings including the internal memory storage. It'll also reinstall the phone firmware.

PS: Once you give this code, there is no way to cancel the operation unless you remove the battery from the phone. So think twice before giving this code.

*#*#34971539#*#*

This code is used to get information about phone camera. It shows following 4 menus:

  • Update camera firmware in image (Don't try this option)
  • Update camera firmware in SD card
  • Get camera firmware version
  • Get firmware update count

WARNING: Never use the first option otherwise your phone camera will stop working and you'll need to take your phone to service center to reinstall camera firmware.

*#*#7594#*#*

This one is my favorite one. This code can be used to change the "End Call / Power" button action in your phone. Be default, if you long press the button, it shows a screen asking you to select any option from Silent mode, Airplane mode and Power off.

You can change this action using this code. You can enable direct power off on this button so you don't need to waste your time in selecting the option.

*#*#273283*255*663282*#*#*

This code opens a File copy screen where you can backup your media files e.g. Images, Sound, Video and Voice memo.

*#*#197328640#*#*

This code can be used to enter into Service mode. You can run various tests and change settings in the service mode.

WLAN, GPS and Bluetooth Test Codes:

*#*#232339#*#* OR *#*#526#*#* OR *#*#528#*#* - WLAN test (Use "Menu" button to start various tests)

*#*#232338#*#* - Shows WiFi MAC address

*#*#1472365#*#* - GPS test

*#*#1575#*#* - Another GPS test

*#*#232331#*#* - Bluetooth test

*#*#232337#*# - Shows Bluetooth device address

*#*#8255#*#*

This code can be used to launch GTalk Service Monitor.

Codes to get Firmware version information:

*#*#4986*2650468#*#* - PDA, Phone, H/W, RFCallDate

*#*#1234#*#* - PDA and Phone

*#*#1111#*#* - FTA SW Version

*#*#2222#*#* - FTA HW Version

*#*#44336#*#* - PDA, Phone, CSC, Build Time, Changelist number

Codes to launch various Factory Tests:

*#*#0283#*#* - Packet Loopback

*#*#0*#*#* - LCD test

*#*#0673#*#* OR *#*#0289#*#* - Melody test

*#*#0842#*#* - Device test (Vibration test and BackLight test)

*#*#2663#*#* - Touch screen version

*#*#2664#*#* - Touch screen test

*#*#0588#*#* - Proximity sensor test

*#*#3264#*#* - RAM version

NOTE: All above codes have been checked on Google Android phone Samsung Galaxy I7500 only but they should also work in other Google Android phones.

Monday, September 20, 2010

Using Oracle with PHP and CodeIgniter

Configuring PHP
My first mistake when configuring PHP to support Oracle was to assume that it would be as easy as MySQL; that is to say, on Windows, simply enabling the Oracle DLL that ships with PHP. No such luck, and the error message you see — when you finally remember to check your PHP error log — isn't very helpful:

PHP Warning: PHP Startup: Unable to load dynamic library 'C:\Program Files\Zend\Core\lib\phpext\php_oci8.dll' - The specified module could not be found.
in Unknown on line 0

Thanfully, I found a document on the Oracle website that explains how to configure PHP on Linux and Windows for Oracle support. I'd say this was the first straightforwardly helpful piece of Oracle documentation I'd ever used. Frustrations nevertheless ensued. When I downloaded Oracle 10g Express to load on my desktop, the website mentioned that I wouldn't need any additional Oracle client downloads. (It was a gigantic enough download!) So, naturally, I figured that the client libraries needed to for PHP/Oracle support would all be somewhere in my install folder. Incorrect! As the configuration instructions suggested, I also had to download the (39-megabyte) Instant Client Basic for Windows, which contained all three libraries. I plunked them into a new directory, put that directory on my path, and revved up PHP. This time, no errors.

Easy Alternative: Zend Core offers a "for Oracle" version with Oracle support built in, out of the box.

Configuring CodeIgniter
I've started using CodeIgniter heavily in the last few months, and it's a real time-saver once you get the hang of it. While I have a couple hangups about the CI User Guide — mainly that it's slanted too severely toward the "quick example" side without comprehensive reference information to fill in the gaps — the user community tends to be quite helpful. Accordingly, the User Guide only says that CI supports an Oracle database, with no instructions on how to complete the built-in database configuration to use Oracle. So, I browsed the forums and found a few folks who had posted their Oracle configurations, and noted that, in general, one's database config should look like this:

$db['default']['hostname'] = "//localhost/XE";
$db['default']['username'] = "USERNAME";
$db['default']['password'] = "PASSWORD";
$db['default']['database'] = "DATABASE_NAME";
$db['default']['dbdriver'] = "oci8";

That hostname field can optionally contain a port number, if it differs from the standard 1521:

$db['default']['hostname'] = "//localhost:9999/XE";

The "XE" in both examples is the default SID that Oracle 10g Express uses. (Unfortunately, I'm still oblivious as to the utility of an SID.) Also note that username, password, and database fields probably ought to be in uppercase — more case sensitivity implications on their way, stay tuned.

That done, we're ready to query for some data. But wait! I tested my existing application code (previously running on a MySQL database) and got these warnings:

ERROR - 2007-12-02 15:02:05 --> Severity: Warning --> ocifetchinto() expects parameter 1 to be resource, null given C:\codeigniter\system\database\drivers\oci8\oci8_result.php 159
ERROR - 2007-12-02 15:02:05 --> Severity: Warning --> ociexecute() expects parameter 1 to be resource, null given C:\codeigniter\system\database\drivers\oci8\oci8_result.php 46

Yet again, the CodeIgniter forum came to the rescue: there's an Oracle-specific bug in CI's platform-independent database abstraction class. It's fixed with a simple cut-and-paste. Around line 324, the $RES->num_rows line needs to be moved down below the if block, a la:

$driver 		= $this->load_rdriver(); $RES 			= new $driver(); $RES->conn_id	= $this->conn_id; $RES->result_id	= $this->result_id;  if ($this->dbdriver == 'oci8') {   $RES->stmt_id		= $this->stmt_id;   $RES->curs_id		= NULL;   $RES->limit_used	= $this->limit_used; }  $RES->num_rows	= $RES->num_rows();

No more warnings.

Using Active Record
CodeIgniter's Active Record class makes most database queries dead simple and, combined with centralized configuration and automatic connections, cuts down significantly on lines of code. Using Active Record in my model class, I have a login method which checks a users table for the proper username and password:

$query = $this->db->getwhere('users', array('username' => $username, 'password' => md5($password)));

Then, I check the result for an active user by inspecting the flags field for a non-negative value:

if (isset($query->row()->flags) && $query->row()->flags >= 0) { ... }

For some reason, I just couldn't log in, but I wasn't getting any error messages from PHP or CodeIgniter. Then, I recalled my case sensitivity wrangling from earlier, and my cogs started turning. My database had been constructed with all uppercase table names and column names, so perhaps my result's fields would be uppercase, too. A simple var_dump of the result object proved my theory:

object(CI_DB_oci8_result)#17 (9) {   ["stmt_id"]=>   resource(33) of type (oci8 statement)   ["curs_id"]=>   NULL   ["limit_used"]=>   NULL   ["conn_id"]=>   resource(24) of type (oci8 persistent connection)   ["result_id"]=>   bool(true)   ["result_array"]=>   array(1) {     [0]=>     array(3) {       ["USERNAME"]=>       string(8) "username"       ["PASSWORD"]=>       string(32) "..."       ["FLAGS"]=>       string(1) "0"     }   }   ["result_object"]=>   array(0) {   }   ["current_row"]=>   int(0)   ["num_rows"]=>   int(1) }

Now, I reference the uppercase member variables in my code and it all works fine:

if (isset($query->row()->FLAGS) && $query->row()->FLAGS >= 0) { ... }

I'm not sure whom to implicate for the misunderstanding. When I write SQL queries — against MySQL or Oracle — my schema, table, and columns names may be written in any case, and I get a proper result. Shouldn't that case insensitivity carry through into Active Record and/or PHP?

7 comments so far

  1. Jonathan. This is a great rundown. Thanks for sharing with us. I've been wanting to play with Oracle and Postgres more lately, and hopefully this will be helpful.

    Posted December 2, 2007, 5:19 pm
  2. Hi. Intresting article, thanks for sharing your experiense.

    After i found this:
    function escape_str($str)
    {
    return $str;
    }

    in oracle driver in CI, i made a decision to use PDO instead of CI libraries. Using PDO now in a big project and feeling good.

    If you understand russian, you can read more in my blog :)

    Posted December 5, 2007, 1:06 pm
  3. Jonathan Abbett said

    It looks like the adapter should be using real OCI bind arguments, and not using the generic adapter's bind mechanism. When using OCIBindByName(), the arguments are automatically escaped to Oracle's satisfaction.

    Posted December 5, 2007, 2:34 pm
  4. yuanjing said

    Did you try scaffolding, the view data page shows error:

    Message: Undefined property: stdClass::$2
    Filename: views/view.php
    Line Number: 14

    I checked views/view.php
    foreach($query->result() as $row) shows:

    object(CI_DB_oci8_result)#15 (9) {
    ["stmt_id"]=>
    resource(32) of type (oci8 statement)
    ["curs_id"]=>
    NULL
    ["limit_used"]=>
    bool(true)
    ["conn_id"]=>
    resource(27) of type (oci8 persistent connection)
    ["result_id"]=>
    bool(true)
    ["result_array"]=>
    array(1) {
    [0]=>
    array(1) {
    ["NUMROWS"]=>
    string(1) "2″
    }
    }
    ["result_object"]=>
    array(1) {
    [0]=>
    object(stdClass)#14 (1) {
    ["NUMROWS"]=>
    string(1) "2″
    }
    }
    ["current_row"]=>
    int(0)
    ["num_rows"]=>
    int(1)
    }

    Any clue?

    Posted December 18, 2007, 7:43 pm
  5. […] Using Oracle with PHP and CodeIgniter, Oracle and CI teamed together. I use oracle xe […]

    Posted January 8, 2008, 6:34 pm
  6. Hello…

    how to configure if we use PHP ADODB library to connect database with oracle 9.2 + codeigniter?

    Posted January 12, 2008, 9:36 am
  7. […] Using Oracle with PHP and CodeIgniter […]

    Posted January 19, 2008, 5:46 am

Friday, July 30, 2010

Ten Principles for Peace of Mind

1. Do Not Interfere In Others' Business Unless Asked.
Most of us create our own problems by interfering too often in others' affairs. We do so because somehow we have convinced ourselves that our way is the best way, our logic is the perfect logic and those who do not conform to our thinking must be criticized and steered to the right  direction, our direction. This thinking denies the existence of individuality and consequently the existence of God.. God has created each one of us in a unique way. No two human beings can think or act in exactly the same way. All men or women act the way they do because God within them prompts them that way. Mind your own business and you will keep your peace.

2. Forgive And Forget. 
This is the most powerful aid to peace of mind. We often develop ill feelings inside our heart for the person who insults us or harms us. We nurture grievances. This in turn results in loss of sleep, development of stomach ulcers, and high blood pressure. This insult or injury was done once, but nourishing of grievance goes on forever by constantly remembering it. Get over this bad habit. Life is too short to waste in such trifles. Forgive, Forget, and march on. Love flourishes in giving and forgiving.

3. Do Not Crave For Recognition.
This world is full of selfish people. They seldom praise anybody without selfish motives. They may praise you today because you are in power, but no sooner than you are powerless, they will forget your achievement and will start finding faults in you. Why do you wish to kill yourself in striving for their recognition? Their recognition is not worth the aggravation. Do your duties ethically and sincerely.

4. Do Not Be Jealous.
We all have experienced how jealousy can disturb our peace of mind. You know that you work harder than your colleagues in the office, but sometimes they get promotions; you do not. You started a business several years ago, but you are not as successful as your neighbor whose business is only one year old. There are several examples like these in everyday life. Should you be jealous? No. Remember everybody's life is shaped by his/her destiny, which has now become his/her reality. If you are destined to be rich, nothing in the world can stop you. If you are not so destined, no one can help you either. Nothing will be gained by blaming others for your misfortune. Jealousy will not get you anywhere; it will only take away your peace of mind.

5. Change Yourself According To The Environment.
If you try to change the environment single-handedly, the chances are you will fail. Instead, change yourself to suit your environment. As you do this, even the environment, which has been unfriendly to you, will mysteriously change and seem congenial and harmonious.

6. Endure What Cannot Be Cured.
This is the best way to turn a disadvantage into an advantage. Every day we face numerous inconveniences, ailments, irritations, and accidents that are beyond our control. If we cannot control them or change them, we must learn to put up with these things. We must learn to endure them cheerfully. Believe in yourself and you will gain in terms of patience, inner strength and will power.

7. Do Not Bite Off More Than You Can Chew.
This maxim needs to be remembered constantly. We often tend to take more responsibilities than we are capable of carrying out. This is done to satisfy our ego. Know your limitations.. Why take on additional loads that may create more worries? You cannot gain peace of mind by expanding your external activities. Reduce your material engagements and spend time in prayer, introspection and meditation. This will reduce those thoughts in your mind that make you restless. Uncluttered mind will produce greater peace of mind. 

8. Meditate Regularly.
Meditation calms the mind and gets rid of disturbing thoughts. The best way to do it is by reading the scriptures and meditating over it, pondering endlessly to what its got to say to you. Your mind will not be easily disturbed as it was before. You would benefit by gradually increasing the period of daily meditation. You may think that this will interfere with your daily work. On the contrary, this will increase your efficiency and you will be able to produce better results in less time.

9. Never Leave The Mind Vacant.
An empty mind is the devil's workshop. All evil actions start in the vacant mind. Keep your mind occupied in something positive, something worthwhile. Actively follow a hobby. Do something that holds your interest. You must decide what you value more: money or peace of mind. Your hobby, like social work or religious work, may not always earn you more money, but you will have a sense of fulfillment and achievement. Even when you are resting physically, occupy yourself in healthy reading or mental chanting of God's name.

10. Do Not Procrastinate And Never Regret.
Do not waste time in protracted wondering " Should I or shouldn't I?" Days, weeks, months, and years may be wasted in that futile mental debating. You can never plan enough because you can never anticipate all future happenings. Value your time and do the things that need to be done. It does not matter if you fail the first time. You can learn from your mistakes and succeed the next time. Sitting back and worrying will lead to nothing. Learn from your mistakes, but do not brood over the past. DO NOT REGRET. Whatever happened was destined to happen only that way. Why cry over spilt milk?