Sunday, January 13, 2013

String to MySQL date format in PHP

String to Date in PHP

Sometimes when I export some MS Excel/ MS Access data to MySQL , It is required to convert some date in string to MySQL compatible date format. You can use DateTime class to convert the string to date in any format you want. The code is below.
function _mk_date($str)
{
 $temp = new DateTime($datestr);
 return date_format($temp, 'Y-m-d');
}

Tuesday, January 08, 2013

Configuring BSNL MTNL Internet on D-Link Wireless N 300 ADSL2+ (DSL-2750U) Router

New year wishes to all.
In this new year, the first thing i bought from Flipkart is a Dlink router/modem. They provided some CD along with the product. When i started to run the application in it , It got stuck at some stage. So i tried the usual way i configure a router . So i thought of sharing this so that it may help someone.


Configuring The modem

Physical set up

  1. Unpack your router. Connect the power adapter and switch on. Now the power led will be lit
  2. Connect a LAN cable from your computer to one of the four yellow LAN ports. And see whether the corresponding LED start blinking
  3. Now wait sometime so that the router will assign an IP to your computer.

Wednesday, November 14, 2012

How to make your Google+ status Bold, Italic or Strike through

Google+ Tips and Tricks

Styling Status Message

Unlike facebook or twitter, Google+ allows you to style your status messages .

  • To make Bold : Use star(*) infront and back of the sentence . For example, to make my status as "Watched Skyfall" , you should type "Watched *Skyfall* "
  • To Italicize : Use underscore(_) . For example, to make my status as "Watched Skyfall" , You should type "Watched _Skyfall_ "
  • To Strikethrough : Use Hyphon(-). To get your status as "I Quit" , You should type "-I Quit-"
  • You can also try the combinations also like for both Bold and Italics, *_Hello World_*


Monday, November 12, 2012

Author information in Google Search result

How to get your profile picture in google search result ?

Google Plus profile - Author information - In googel search results
This can be done in three steps :

Delete lines inside a file matching a pattern

You can use pattern matching of sed to do so !

sed -i '/pattern/d' filename
Example: To remove the lines containing "server" from foo.txt ,do this
sed -i '/server/d' foo.txt

I felt this usefull often . For more SED tutorials , visit http://www.grymoire.com/Unix/Sed.html

Sunday, November 11, 2012

Accessing Ubuntu server using XDMCP Clients

Disadvantage of VNC Server

VNC Server will just replicate the session which is already active on the server to be accessed remotely. But if say , you've logged out of the server , then you cannot use VNC server to start a new session. For that you can use any XDMCP clients like XManager or XMing. I will demonstrate here how to use XMing in Windows Vista to start a new remote sessions with Ubuntu Server.

Settings to be done in Ubuntu Server:

You must enable XDMCP server on Ubuntu. For that go to /etc/gdm folder and edit custom.conf file present there. If not present, Create a new custom.conf file. In this add as follows:
[daemon]
RemoteGreeter=/usr/lib/gdm/gdmlogin

[xdmcp]
Enable=true
DisplaysPerHost=2

Now restart your GDM using sudo service gdm restart or get a full restart of the server.