Friday, November 30, 2012

sync contacts for free from gmail / anyother account to iPhone 4s.

Simple tip to sync contacts for free from gmail / anyother account to iPhone 4s.

  • Save you contacts i.e. export in to .vcf format. Gmail/Outlook allows it to export contacts in vcf format-
  • Now send a mail to self gmail account with this file as attachment.  
  • Access iPhone 4s, go to Mail & contacts, add your gmail account using add account option.
  • Now fetch your gmails on your iphone.  Once you see the attachment with mail open it.
  • Try to open attachment it will ask to import / merge with existing or add new contacts….. 



  • and you are done…! A minimum of 3$ saved.


Enjoy …

Thursday, June 7, 2012

CODICE SCONTI

i got some coupons to share

Kamiceria   Valid till 14/02/2013   20% OFF  with code KNW20
Spartoo.it  valid till 14/02/2013   15% OFF with code MDWIT12
efiori.com  valid till 14/02/2013   10€ OFF wit hcode NDW2012
chegioci.it valid till 14/02/2013   10€ OFF with code CHEGIOMDW10
pixmania    valid till 14/02/2013   10€ OFF with code pixofferta10
kiabi.it    valid till 14/02/2013   10€ OFF with code NDW13

Tuesday, June 5, 2012

Alter Table Column Varchar to date

Altering a table column from varchar to datetime is pretty straight-forward in the SQL Server Management Studio (SSMS), until you look at the tsql generated.  For many operations SSMS will generate a tsql script that will:
  • create a temporary table
  • drop all the foreign keys
  • copy the data to the temporary table
  • create the new table with the correct data type
  • copy the data to the new table
  • drop the temporary table
  • add the foreign keys back
That is a lot of operations and on a really large table of millions of rows may take a very long time to complete.
SQLCricket comments that it is possible to change the options in SSMS to warn on table operations, i think this is only in sql 2K8.
SQLPuma comments that it is possible to change a varchar() to a datetime via tsql with an alter table alter column command.
In this particular case we were modifying a varchar(10) to a datetime.  All the data was in a valid format.  The easiest method is to alter the column, another method to complete this is to:
  • rename the existing column (tmp_varchar etc)
  • add a new column with the correct name
  • update the new column (in batches if necessary)
  • drop the original column (now with a tmp_name)
This is very quick, much safer operation and is much "nicer" to the database log file.  Example of tsql is below:
CREATE TABLE dbo.testing
(test_id bigint NOT NULL IDENTITY (1, 1) primary key,
some_dt varchar(10)
)
GO

insert into testing (some_dt) values ('2009-01-01')
insert into testing (some_dt) values ('2009-01-02')
insert into testing (some_dt) values ('2009-01-03')
insert into testing (some_dt) values ('2009-01-04')
go

EXECUTE sp_rename 'dbo.testing.some_dt', 
    'Tmp_some_dt', 'COLUMN' 
GO

Alter Table testing
Add some_dt DateTime Default('1900-01-01') NOT NULL
GO

Update testing
    Set some_dt = Convert(DateTime,Tmp_some_dt)
GO

Alter Table testing
    DROP Column Tmp_some_dt
GO

select * from testing
go

--drop table testing

Friday, May 25, 2012

Windows TASK creation automatically

SCHTASKS

Create, delete, edit, list, start or stop a scheduled task.
Works on local or remote computers.
Syntax:

   SCHTASKS /Create [Connect_Options] Create_Options /TN taskname

   SCHTASKS /Delete [Connect_Options] /TN taskname [/F]

   SCHTASKS /Query  [Connect_Options] [/FO format] [/NH] [/V]

   SCHTASKS /Run [Connect_Options] /TN taskname

   SCHTASKS /End [Connect_Options] /TN taskname

   SCHTASKS /Change [Connect_Options] {[/RU username] [/RP password] [/TR taskrun]} /TN taskname

 Connect_Options:
     /S system                      # Remote system (default is local)
    [/U username [/P password]]     # Submit job under this name

 Create_Options:
    /TR taskrun                     # Pathname of the executable to run
    /ST starttime                   # HH:MM:SS (24 hour)
    [/RU username [/RP password]]   # Run job as this user
    /SC schedule [/MO modifier]     # When to run, see below
    [/D day]                        # Day = MON,TUE,WED,THU,FRI,SAT,SUN
    [/M months]                     # Month=JAN,FEB,MAR,APR,MAY,JUN,JUL,AUG,SEP,OCT,NOV,DEC.
    [/I idletime]                   # 1 - 999 minutes (ONIDLE task only)
    [/SD startdate] [/ED enddate]   # Start and end date "dd/mm/yyyy"

 options:
    /TN   A name for the task
    /F    Force delete, ignore warnings even if the task is currently runnning.
    /FO   Output format: TABLE, LIST, CSV
    /NH   No header
    /V    Verbose output
Notes:
For MONTHLY schedules give the DAY as a number 1 - 31 (default=1)

To prompt for the password, specify /RP * or /RP none
The User Account under which the Schedule service runs may require specific file access permissions, user permissions and drive mappings.
If the /RU username and /RP Password parameters match the currently logged-in user, the task will run interactively (visible in the foreground).

For the system account, /RU username can be written as "", "NT AUTHORITY\SYSTEM" or "SYSTEM", a Password is not required. The system account has full access to the local machine but has no permissions on any other machines (or mapped drives) across the Network.
/SC schedule  The schedule frequency.
Valid schedules: MINUTE,HOURLY,DAILY,WEEKLY,MONTHLY, ONCE,ONSTART,ONLOGON,ONIDLE.

/MO modifiers allow finer control:

    MINUTE:  1 - 1439 minutes.
    HOURLY:  1 - 23 hours.
    DAILY:   1 - 365 days.
    WEEKLY:  1 - 52 weeks.
    ONCE:    No modifiers.
    ONSTART: No modifiers.
    ONLOGON: No modifiers.
    ONIDLE:  No modifiers.
    MONTHLY: 1 - 12, or FIRST, SECOND, THIRD, FOURTH, LAST, LASTDAY.
Power Saving
The property for "Wake up the machine to run this task" cannot be set using schtasks, but this property is essential if you need the task to run on a machine that has PowerSaving enabled.
To work around this, create a task on one computer using the control panel GUI. This will create a .job file in C:\%windir%\Tasks\
To replicate the scheduled task onto other machines copy the .JOB file to C:\%windir%\Tasks on each machine.

This techique will not retain any system account credentials, so if you need to run the tasks under System, run the following after copying the .JOB file:
SCHTASKS /CHANGE /RU "NT Authority\System" /TN "Yourtaskname"
Examples:
Create a task to run at 11 pm every weekday
SCHTASKS /Create /SC weekly /D MON,TUE,WED,THU,FRI /TN MyDailyBackup /ST 23:00:00 /TR c:\backup.cmd /RU MyDomain\MyLogin /RP MyPassword
Now delete the task:
SCHTASKS /Delete /TN "MyDailyBackup" /f
Create a daily task to run a script at 5 pm:
SCHTASKS /create /tn "My Script" /tr "\"c:\my folder\script.cmd\" arguments" /sc daily /sd 12/29/2008 /st 17:00
Task Scheduler options are stored in the registry
HKLM\SOFTWARE\Microsoft\SchedulingAgent\

Wednesday, May 16, 2012

PHP Functional testing selenium

Sample for selenium settings -

down selenium RC channel from the selenium.org. Place it in same PHP folder for better faster/access. Run the command
CMD> java   -jar   YOUR SELENIUM JAR FILE PATH

now you are done server is running. Change the WebTestCase.php or your php file for proper linking. Run the command

cmd> phpunit functional/yourtest.php

if you find some issues with browser linking do the following in the phpunit.xml or your config file

    <selenium>
        <browser name="Internet Explorer" browser="*iexplore" ></browser>
        <browser name="Firefox" browser="*firefox C:\Program Files\Mozilla Firefox 4.0 Beta 10\firefox.exe" />
        <browser name="Google Chrome" browser="*googlechrome C:\Program Files\Google\Chrome\Application\chrome.exe" />
    </selenium>


by above way you can add any browser using * (Asterisk) in the front and then full path.


;) enjoy

YII Unit test troubleshooting FATA ERROR : Class not found Error

Recently i started using YII Framework, its so amazing. While using unit tests i found some issues and wasted a lot of time for tuning it. Here is my observations which worked at the end on WINDOWS machine -


ASSUMPTIONS -
a) you have pear installed
b) PHP xdebug installed [pls follow my other post http://usemytips.blogspot.it/2012/05/php-xdebug-installation-simplest-method.html ]




Lets start the magic -


STEP 1 --------------------------------


UPDATE PEAR - using your command prompt update PEAR 


 cmd> pear channel-update pear.php.net


 cmd> pear list-upgrade




now for all upgrades listed above follow the upgrades by using command 


cmd> pear install -f pear.php.net/XXXX    [where XXXX is upgrade name listed from above command for example if pear upgrade is needed the command will become 


cmd> pear install -f pear.php.net/PEAR




STEP 2 --------------------------------


UPDATE/INSTALL PHPUNIT - using your command prompt update/install phpunit 


[UPGRADE]
 cmd> pear channel-update pear.phpunit.de


 cmd> pear list-upgrade


[INSTALL]
cmd> pear install -f  pear.phpunit.de /PHPUnit    




OK, now you have installed phpunit, updated Pear libs, and hopefully x-debug working well. All are PHP version dependent so make sure that they are compatible.


STEP 3 ------check your PHP.ini for include_path, it must have the pear/phpunit pointers in it. like 


include_path="C:\php;c:\php\pear;C:\php\pear\phpunit"






 STEP 3 ---------------------YII integration-----------


make sure that your /protected/tests/bootstrap.php has all file pointers set to locate yiii.php. from your command prompt locate the tests folder -


cmd > cd C:\YOUR YII ROOT\YOUR WEB APP\protected\tests  [ENTER]


C:\YOUR YII ROOT\YOUR WEB APP\protected\tests> php unit/DbTest.php   [ENTER]




 remember php bold and large is for php command [location of php.exe]. If someone have different directory structure installation it can be 


C:\YOUR YII ROOT\YOUR WEB APP\protected\tests> YOURDRIVE\PHP EXEPATH  unit\DbTest.php  




[NOTE - If you get error that php is not a suffix for php.exe just run a command in php


CMD>pear   config-set    php_suffix   .exe

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