Wednesday, May 16, 2012

PHP Xdebug installation - Simplest method




When we try to install X-Debug manytimes its troublesome. Here is the simple solution

Win7 - Installation 
Assuming you have PHP installed and updated. If possible update it, or just check your version using your command prompt

CMD>YOURPARH TO PHP>php -version

This will show you which version of PHP you have installed with other details.

Now create a php info file in Webroot (Localhost / provider webroot)  as follows [saving it wtih filename check.php]
<?php
phpinfo();
?>

Run this file from your web server - YOURHOST[:PORT]/check.php?
COPY the output of this page [Simple CTRL+C]

go to http://xdebug.org/wizard.php? 
and paste in the box. Click on Analyse my phpinfo() output. This page will give you the instructions to follow for the xdebug installation.[for simplicity name the php_xdebug-VCX-xxx.dll to php_xdebug.dll]

NOTE - in PHP.ini please comment
extension=php_xdebug.dll
and put
zend_extension=php_xdebug.dll

if you RUN again php-version from command prompt it will show php details with Xdebug version too.







Thursday, April 26, 2012

Hex to RGB calculator



Many times we need to find Hex -RGB . Here is the simple method.


     Red: Green: Blue:

Saturday, January 14, 2012

Rooting your Xperia X8

Many of us using X8 and wish to have latest custom ROMs on X8. Here is my compilation of the tasks I did to get CM7 , then GingerDx running on my X8. PLEASE NOTE :- All the informations given below are my tricks and tries I did, if you are unable to finish it correctly or you BRICK your phone, I am no where responsible for this. Installing custom ROM is not officially recommended by manufacturers as this is violation of WARRANTY.

Now first things first –

a) Charge your phone battery to minimum 80%.

b) PC companion is must (must be installed on your WIN PC and phone must be updated).

c) Read carefully this guide and instructions.

d) Have patience, and read and try again if things don’t workout.

e) Have patience

What does it mean by “installing custom ROM”? Custom ROM is simply an android version developed by some developer or Group not being part of any company. For example LG group modifies android core and their custom ROM will be installed on their LG devices, same for SE, SAMSUNG….

What you need to install a custom ROM? [for Xperia X8]

PC related requirement - A windows PC, your X8, custom compatible ROM, PC Companion installed on PC, WinRar installed on PC

X8 related requirement – Root access, File System explorer, tools which we will use later.

OK, lets get hands dirty and fly with new version on X8.

Root Access on your XPERIA X8–

STEP 1. Download Superoneclick http://forum.xda-developers.com/attachment.php?s=70d117d4a07b1d4b2734bdbb88bcab9a&attachmentid=485566&d=1294652020 and extract it on your pc.

STEP 2. On Xperia X8 go to Settings -> applications -> enable USB Debugging. Set SCREEN TIMEOUT to 30 minutes under display settings.

STEP 3.Connect phone to PC and select “Charge Phone”.

STEP 4. Open superoneclick exe from STEP 1, and select Root.

STEP 5. Wait. Until its written OK at the end. Remember if it asks any specific message just allow.

STEP 6. When done REBOOT the phone.

STEP 7. In applications list on your X8 you will see an app called SUPERUSER, select it and on popup “ALLOW”.

STEP 8. Reboot the Phone.

That’s it, you are ROOT on your X8.

Install apps requiring root permission. Download from market –

Root Explorer

Xrecovery

CWMRecovery

Now you are ready with upgrade to custom ROM. In next series I will explain how to install custom ROM.

Wednesday, January 4, 2012

How to create a list of dates in a table - SQL SERVER

Many time we need a table with all the dates listed in it to confront with some other table which has missing dates. here is the simple method - SQL SERVER
DECLARE @myTable TABLE ( TheDate datetime )

declare @StartDate datetime

declare @Days int

declare @CurrentDay int

set @StartDate = '1/1/2006'

set @Days = 10

set @CurrentDay = 0

while @CurrentDay < @Days

begin

insert @myTable (TheDate) values (dateadd(dd, @CurrentDay, @StartDate))

set @CurrentDay = @CurrentDay + 1

end

select * from @myTable

Wednesday, November 30, 2011

To check if any process is running on the local or a remote computer.

Many times with automation we need to find if a particular process is running on the pc. Then we need to kill it, for example a scheduling script..

here is a sample code to see if the process is running and then kill it-
option explicit
Dim strComputer,strProcess, colProcess, runningProcess
Dim objWMIService, strWMIQuery

strComputer = "."
strProcessName = "calc.exe"


strWMIQuery = "Select * from Win32_Process where name like '" & strProcessName & "'"

Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" _
& strComputer & "\root\cimv2")

Set colProcess = objWMIService.ExecQuery (strWMIQuery)

' Suppose i want to terminate all these process
For Each runningProcess in colProcess
runningProcess.Terminate()
Next

Thursday, October 27, 2011

PHP to CSV simplest way

Many times we need to download a CSV file from database using PHP. Here is a simple method..

Step 1: Prepare Query.

$query="SELECT * FROM TABLEA";

Step 2 : Fetch data from database using above query.
$result= $Dbase->execute($query);

Remember in above i using my own function coded by me. but you can use mysql_fetch_assoc or mysql_fetch_array for the data fetch.

Now prepare the header to put a CSV for download -

header("Content-type: text/csv");
header("Content-Disposition: attachment; filename=myfile.csv");
header("Pragma: no-cache");
header("Expires: 0");


myfile is semicolon (; seperated values with a new line for end of file) csv file. I am preparing it as follows

Now Write in this file using simple ECHO - (Header Column)
echo "COLUMN-A; COLUMN-B; COLUMN-C; \n";

Now the values (Data values)
for( $i=0; $i<=Count($result)-1; $i++ ) { echo $result[$i][0].";".$result[$i][1].";".$result[$i][2]."; \n"; }

at the end you have a CSV ready (simple and clear).

Tuesday, October 25, 2011

Sending mail with CDO Message

If you need to send an email from EXCEL or VBscript here is the simple method

' To Send mail
Dim objmessage
Set objmessage = CreateObject("CDO.Message")
objmessage.Subject = "NOTIFICATION EMAIL ----"
objmessage.From = "FROM MAIL FIELD"
objmessage.To = "EMAIL TO WHICH YOU NEED TO SEND"
objmessage.TextBody = "ATTENTION YOU HAVE GOTTA MAIL " & vbCrLf &SOMESTRING
objmessage.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
objmessage.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "YOURSMTPSERVER"
objmessage.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25
objmessage.Configuration.Fields.Update
objmessage.Send

with above you can send mail easily and decide also what to send in "TextBody" field. In the configuration field "sendusing" has 3 Enum values
1 - Send using Pickup Folder
2 - Send using Port (default is 25)
3 - Send using Exchange

If your smtp server requires authentication you need to add "authentication" in configuration fields with username and password, also you can use SSL. Here is a simple example how (remember all must be written before Fields.Update..

http://msdn.microsoft.com/en-us/library/ms873029%28v=EXCHG.65%29.aspx