Tuesday, November 20, 2012

Robocopy MSBuild Task

#region

Copyright © 2007 Paul Welter. All rights reserved.

/*

Copyright © 2007 Paul Welter. All rights reserved.



Redistribution and use in source and binary forms, with or without

modification, are permitted provided that the following conditions

are met:



1. Redistributions of source code must retain the above copyright

notice, this list of conditions and the following disclaimer.

2. Redistributions in binary form must reproduce the above copyright

notice, this list of conditions and the following disclaimer in the

documentation and/or other materials provided with the distribution.

3. The name of the author may not be used to endorse or promote products

derived from this software without specific prior written permission.



THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR

IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES

OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.

IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,

INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT

NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,

DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY

THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT

(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF

THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

*/



#endregion



using

System;

using

System.Collections.Generic;

using

System.Text;

using

Microsoft.Build.Utilities;

using

Microsoft.Build.Framework;

using

System.IO;

 

 


namespace

MSBuild.Community.Tasks

{


///


/// Task wrapping the Window Resource Kit Robocopy.exe command.


///


/// Deploy website to web server.


/// <![CDATA[


///


/// SourceFolder="$(MSBuildProjectDirectory)"


/// DestinationFolder="\\server\webroot\"


/// Mirror="true"


/// ExcludeFolders=".svn;obj;Test"


/// ExcludeFiles="*.cs;*.resx;*.csproj;*.webinfo;*.log"


/// NoJobHeader="true"


/// />


/// ]]>


///


public class RoboCopy : ToolTask

{


#region

Properties


private string _sourceFolder;


///


/// Source directory


///


///


/// You can use drive:\path or \\server\share\path


///

[
Required]


public string SourceFolder

{


get { return _sourceFolder; }


set { _sourceFolder = value; }

}


private string[] _sourceFiles;


///


/// Names of files to act upon.


///


///


/// You can use wildcard characters (? and *). If no


/// files are listed, Robocopy defaults to all files (*.*).


///


public string[] SourceFiles

{


get { return _sourceFiles; }


set { _sourceFiles = value; }

}


private string _destinationFolder;


///


/// Destination directory.


///


///


/// You can use drive:\path or \\server\share\path


///

[
Required]


public string DestinationFolder

{


get { return _destinationFolder; }


set { _destinationFolder = value; }

}


private bool _subdirectories;


///


/// /S Copies subdirectories (excluding empty ones).


///


public bool Subdirectories

{


get { return _subdirectories; }


set { _subdirectories = value; }

}


private bool _allSubdirectories;


///


/// /E Copies all subdirectories (including empty ones).


///


public bool AllSubdirectories

{


get { return _allSubdirectories; }


set { _allSubdirectories = value; }

}


private bool _restartableMode;


///


/// /Z Copies files in restartable mode (that is, restarts the copy process from the point of failure).


///


public bool RestartableMode

{


get { return _restartableMode; }


set { _restartableMode = value; }

}


private bool _backupMode;


///


/// /B Copies files in Backup mode (Backup copies are not restartable, but can copy some files that restartable mode cannot).


///


public bool BackupMode

{


get { return _backupMode; }


set { _backupMode = value; }

}


private string _copyFlags;


///


/// /COPY:copyflags Copies the file information specified by copyflags.


///


///


/// D – file Data, S – file Security (NTFS ACLs), A – file Attributes,


/// O – file Ownership information, T – file Timestamps, U – file Auditing infomation.


///


public string CopyFlags

{


get { return _copyFlags; }


set { _copyFlags = value; }

}


private bool _copyAll;


///


/// /COPYALL Copies Everything. Equivalent to /COPY:DATSOU.


///


public bool CopyAll

{


get { return _copyAll; }


set { _copyAll = value; }

}


private bool _noCopy;


///


/// /NOCOPY Copies Nothing. Can be useful with /PURGE.


///


public bool NoCopy

{


get { return _noCopy; }


set { _noCopy = value; }

}


private bool _security;


///


/// /SEC Copies NTFS security information. (Source and destination volumes must both be NTFS). Equivalent to /COPY:DATS.


///


public bool Security

{


get { return _security; }


set { _security = value; }

}


private bool _moveFiles;


///


/// /MOV Moves files (that is, deletes source files after copying).


///


public bool MoveFiles

{


get { return _moveFiles; }


set { _moveFiles = value; }

}


private bool _move;


///


/// /MOVE Moves files and directories (that is, deletes source files and directories after copying).


///


public bool Move

{


get { return _move; }


set { _move = value; }

}


private bool _purge;


///


/// /PURGE Deletes destination files and directories that no longer exist in the source.


///


public bool Purge

{


get { return _purge; }


set { _purge = value; }

}


private bool _mirror;


///


/// /MIR Mirrors a directory tree (equivalent to running both /E and /PURGE).


///


public bool Mirror

{


get { return _mirror; }


set { _mirror = value; }

}


private bool _create;


///


/// /CREATE Creates a directory tree structure containing zero-length files only (that is, no file data is copied).


///


public bool Create

{


get { return _create; }


set { _create = value; }

}


private bool _fatFileNames;


///


/// /FAT Creates destination files using only 8.3 FAT file names.


///


public bool FatFileNames

{


get { return _fatFileNames; }


set { _fatFileNames = value; }

}


private bool _fatFileTimes;


///


/// /FFT Assume FAT File Times (2-second granularity).


///


public bool FatFileTimes

{


get { return _fatFileTimes; }


set { _fatFileTimes = value; }

}


private string _includeAttributes;


///


/// /IA:{R|A|S|H|C|N|E|T|O} Includes files with the specified attributes.


///


///


/// The following file attributes can be acted upon:


/// R – Read only, A – Archive, S – System, H – Hidden,


/// C – Compressed, N – Not content indexed, E – Encrypted,


/// T – Temporary, O - Offline


///


public string IncludeAttributes

{


get { return _includeAttributes; }


set { _includeAttributes = value; }

}


private string _excluedAttributes;


///


/// /XA:{R|A|S|H|C|N|E|T|O} Excludes files with the specified attributes.


///


///


/// The following file attributes can be acted upon:


/// R – Read only, A – Archive, S – System, H – Hidden,


/// C – Compressed, N – Not content indexed, E – Encrypted,


/// T – Temporary, O - Offline


///


public string ExcluedAttributes

{


get { return _excluedAttributes; }


set { _excluedAttributes = value; }

}


private bool _includeArchive;


///


/// /A Copies only files with the archive attribute set.


///


public bool IncludeArchive

{


get { return _includeArchive; }


set { _includeArchive = value; }

}


private bool _includeArchiveClear;


///


/// /M Copies only files with the archive attribute set and then resets (turns off) the archive attribute in the source files.


///


public bool IncludeArchiveClear

{


get { return _includeArchiveClear; }


set { _includeArchiveClear = value; }

}


private bool _excludeJunctions;


///


/// /XJ Excludes Junction points.


///


public bool ExcludeJunctions

{


get { return _excludeJunctions; }


set { _excludeJunctions = value; }

}


private string[] _excludeFiles;


///


/// /XF file [file] Excludes files with the specified names, paths, or wildcard characters.


///


public string[] ExcludeFiles

{


get { return _excludeFiles; }


set { _excludeFiles = value; }

}


private string[] _excludeFolders;


///


/// /XD dir [dir] Excludes directories with the specified names, paths, or wildcard characters.


///


public string[] ExcludeFolders

{


get { return _excludeFolders; }


set { _excludeFolders = value; }

}


private bool _verbose;


///


/// /V Produces verbose output (including skipped files).


///


public bool Verbose

{


get { return _verbose; }


set { _verbose = value; }

}


private bool _noFileLogging;


///


/// /NFL Turns off logging of file names. File names are still shown, however, if file copy errors occur.


///


public bool NoFileLogging

{


get { return _noFileLogging; }


set { _noFileLogging = value; }

}


private bool _noFolderLogging;


///


/// /NDL Turns off logging of directory names. Full file pathnames (as opposed to simple file names) will be shown if /NDL is used.


///


public bool NoFolderLogging

{


get { return _noFolderLogging; }


set { _noFolderLogging = value; }

}


private bool _noJobHeader;


///


/// /NJH Turns of logging of the job header.


///


public bool NoJobHeader

{


get { return _noJobHeader; }


set { _noJobHeader = value; }

}


private bool _noJobSummary;


///


/// /NJS Turns off logging of the job summary.


///


public bool NoJobSummary

{


get { return _noJobSummary; }


set { _noJobSummary = value; }

}


private bool _noProgress = true;


///


/// /NP Turns off copy progress indicator (% copied).


///


public bool NoProgress

{


get { return _noProgress; }


set { _noProgress = value; }

}


private string _logFile;


///


/// /LOG:file Redirects output to the specified file, overwriting the file if it already exists.


///


public string LogFile

{


get { return _logFile; }


set { _logFile = value; }

}


private string _appendLogFile;


///


/// /LOG+:file Redirects output to the specified file, appending it to the file if it already exists.


///


public string AppendLogFile

{


get { return _appendLogFile; }


set { _appendLogFile = value; }

}


private string[] _options;


///


/// Manually entered options.


///


public string[] Options

{


get { return _options; }


set { _options = value; }

}


#endregion




///


/// Handles execution errors raised by the executable file.


///


///


/// true if the method runs successfully; otherwise, false.


///


protected override bool HandleTaskExecutionErrors()

{


//The return code from Robocopy is a bit map, defined as follows:


//16 Serious error. Robocopy did not copy any files.


//8 Some files or directories could not be copied.


//4 Some Mismatched files or directories were detected.


//2 Some Extra files or directories were detected.


//1 One or more files were copied successfully (that is, new files have arrived).


//0 No errors occurred, and no copying was done.


return !(((ExitCode & 16) == 16) || ((ExitCode & 8) == 8));

}


///


/// Returns a string value containing the command line arguments to pass directly to the executable file.


///


///


/// A string value containing the command line arguments to pass directly to the executable file.


///


protected override string GenerateCommandLineCommands()

{


CommandLineBuilder builder = new CommandLineBuilder();

builder.AppendFileNameIfNotNull(_sourceFolder);

builder.AppendFileNameIfNotNull(_destinationFolder);

builder.AppendFileNamesIfNotNull(_sourceFiles,

" ");


if (_subdirectories)

builder.AppendSwitch(
"/S");


if (_allSubdirectories)

builder.AppendSwitch(
"/E");


if (_restartableMode)

builder.AppendSwitch(
"/Z");


if (_backupMode)

builder.AppendSwitch(
"/B");

builder.AppendSwitchIfNotNull(
"/COPY:", _copyFlags);


if (_copyAll)

builder.AppendSwitch(
"/COPYALL");


if (_noCopy)

builder.AppendSwitch(
"/NOCOPY");


if (_security)

builder.AppendSwitch(
"/SEC");


if (_moveFiles)

builder.AppendSwitch(
"/MOV");


if (_move)

builder.AppendSwitch(
"/move");


if (_purge)

builder.AppendSwitch(
"/PURGE");


if (_mirror)

builder.AppendSwitch(
"/MIR");


if (_noCopy)

builder.AppendSwitch(
"/NOCOPY");


if (_create)

builder.AppendSwitch(
"/CREATE");


if (_fatFileNames)

builder.AppendSwitch(
"/FAT");


if (_fatFileTimes)

builder.AppendSwitch(
"/FFT");

builder.AppendSwitchIfNotNull(
"/IA:", _includeAttributes);

builder.AppendSwitchIfNotNull(
"/XA:", _excluedAttributes);


if (_includeArchive)

builder.AppendSwitch(
"/A");


if (_includeArchiveClear)

builder.AppendSwitch(
"/M");


if (_excludeJunctions)

builder.AppendSwitch(
"/XJ");

builder.AppendSwitchIfNotNull(
"/XF ", _excludeFiles, " ");

builder.AppendSwitchIfNotNull(
"/XD ", _excludeFolders, " ");


if (_verbose)

builder.AppendSwitch(
"/V");


if (_noFileLogging)

builder.AppendSwitch(
"/NFL");


if (_noFolderLogging)

builder.AppendSwitch(
"/NDL");


if (_noJobHeader)

builder.AppendSwitch(
"/NJH");


if (_noJobSummary)

builder.AppendSwitch(
"/NJS");


if (_noProgress)

builder.AppendSwitch(
"/NP");

builder.AppendSwitchIfNotNull(
"/LOG:", _logFile);

builder.AppendSwitchIfNotNull(
"/LOG+:", _appendLogFile);

builder.AppendSwitchIfNotNull(
"", _options, " ");


return builder.ToString();

}


///


/// Returns the fully qualified path to the executable file.


///


///


/// The fully qualified path to the executable file.


///


protected override string GenerateFullPathToTool()

{


return string.IsNullOrEmpty(ToolPath) ? ToolName : Path.Combine(ToolPath, ToolName);

}


///


/// Logs the starting point of the run to all registered loggers.


///


/// A descriptive message to provide loggers, usually the command line and switches.


protected override void LogToolCommand(string message)

{

Log.LogCommandLine(

MessageImportance.Low, message);

}


///


/// Gets the name of the executable file to run.


///


///


/// The name of the executable file to run.


protected override string ToolName

{


get { return "robocopy.exe"; }

}


///


/// Gets the with which to log errors.


///


///


/// The with which to log errors.


protected override MessageImportance StandardOutputLoggingImportance

{


get

{


return MessageImportance.Normal;

}

}

}

}


Monday, November 5, 2012

Code blocks

 Code::Blocks is an open source, cross platform, free C++ IDE.
Application screenshotbuilt to meet the most demanding needs of its users. It is designed to be very extensible and fully configurable.
The IDE  has a consistent look, feel and operation across platforms.
Built around a plugin framework, Code::Blocks can be extended with plugins. Any kind of functionality can be added by installing/coding a plugin. For instance, compiling and debugging functionality is already provided by plugins!

Visit : http://www.codeblocks.org/home

Tuesday, October 30, 2012

How to share your wired internet connection with others wirelessly

Dish: Routerless Connection Sharing ( computer-to-computer/.smarphone/tablet (ad hoc)

Ingredients:

One computer/laptop with a wired internet and a wireless adapter
,other wireless devices like smartphones,tablets etc as necessary

Steps:
  1. Open Connect to a Network by clicking the Start button Picture of the Start button, and then clicking Connect to.
  2. Click Set up a connection or network.
  3. Click Set up an ad hoc (computer-to-computer) network, click Next, and then follow the steps in the wizard.
Or simply right click your LAN adapter,select properties, select sharing, and click the share intenet with other computers in the network.

Better served (chilled) with broadband network.

Notes:
An ad hoc network is a temporary connection between computers and devices used for a specific purpose, such as sharing documents during a meeting or playing multiple-player computer games. You can also temporarily share an Internet connection with other people on your ad hoc network, so those people don’t have to set up their own Internet connections. Ad hoc networks can only be wireless, so you must have a wireless network adapter installed in your computer to set up or join an ad hoc network.

Monday, October 29, 2012

Hello mblog

And some text



• When is your shadow the longest? Early in the morning and late in the afternoon. Also your shadow is longer as you come nearer the north and south poles.
• When is it the shortest? Becomes shorter as it gets closer to noon. It also becomes shorter as you get nearer the equator.
• Is there a time of day that you have no shadow? When the sun is directly overhead at noon you don’t have a shadow.

Monday, May 31, 2010

Vertical Palace

Haive a look at the home of Indias richest man Mukesh Ambani.

http://images.businessweek.com/ss/07/06/0627_nouveau/source/2.htm

Sunday, May 2, 2010

Translation for Dil To bacha hai ji song

Aisi ulji nazar unse hatt ti nahi
it's difficult to separate locked eyes
Daant se reshmi dor katt ti nahi
it's difficult to cut through this silk thread
Umar kab ki baras ke safaid ho gayi
life has gone long past
Kaari badari jawani ki chatt ti nahi
dark clouds of youth don't disappear
Walla ye dhadkan bhadne lagi hai
oh my, heartbeats are rising
Chehre ki rangat udne lagi hai
colour of face is fading away
Darr lagta hai tanha sone mein ji
I am afraid to sleep alone
Dil to bachcha hai ji
heart is still a child
Dil to bachcha hai ji
Thoda kaccha hai ji
Haan dil to baccha hai ji
Aisi ulji nazar unse hatt ti nahi
Daant se reshmi dor katt ti nahi
Umar kab ki baras ke safaid ho gayi
Kaari badari jawani ki chatt ti nahi
Ra ra ra ..

Kisko ptaa tha pehlu mein rakha
who knew that within me
Dil aisa baaji bhi hoga
this heart would be naughty
Hum to hamesha samajhte the koi
I always thought
Hum jaisa haaji hi hoga
it will be a nice like me
Hai zor karein, kitna shor karein
it torments, it makes noise
Bewaja baatein pe ainwe gaur karein
it keeps thinking of things for no reason
Dilsa koi kameena nahi
there is no scoundrel like heart
Koi to rokey, koi to tokey
someone please stop
Iss umar mein ab khaogey dhokhe
is this my age to be fooled in love, now
Darr lagta hai ishq karne mein ji
I feel afraid to fall in love
Dil to bachcha hai ji
Dil to bachcha hai ji
Thoda kaccha hai ji
Haan dil to baccha hai ji

Aisi udhaasi baithi hai dil pe
such sadness engulfs my heart
Hassne se ghabra rahe hain
I am afraid to laugh
Saari jawani katra ke kaati
I've avoided this love thing whole youth
Piri mein takra gaye hain
now I am faced with it now
Dil dhadakta hai to aise lagta hai woh
beating heart makes me feel like
Aa raha hai yahin dekhta hi na woh
she is coming here, looking at me
Prem ki maarein kataar re
piercing me through love
Taubah ye lamhe katt te nahi kyun
why can't I seem to pass time
Aankhein se meri hatt te nahi kyun
why not those moments go away from eyes
Darr lagta hai mujhse kehne mein ji
am afraid to admit it
Dil toh bachcha hai ji
Dil toh bachcha hai ji
Thoda kaccha hai ji
Haan dil toh baccha hai ji
(http://www.bollywhat-forum.com/index.php?action=printpage;topic=27432.0)

Lyrics of Dil To Bachcha Hai Song

Lyrics of Dil To Bachcha Hai Song

Aisi ulji nazar unse hatt ti nahi
Daant se reshmi dor katt ti nahi
Umar kab ki baras ke safaid ho gayi
Kaari badari jawani ki chatt ti nahi
Walla ye dhadkan bhadne lagi hai
Chehre ki rangat udne lagi hai
Darr lagta hai tanha sone mein ji
Dil to bachcha hai ji
Dil to bachcha hai ji
Thoda kaccha hai ji
Haan dil to baccha hai ji
Aisi ulji nazar unse hatt ti nahi
Daant se reshmi dor katt ti nahi
Umar kab ki baras ke safaid ho gayi
Kaari badari jawani ki chatt ti nahi
Ra ra ra ..

Kisko ptaa tha pehlu mein rakha
Dil aisa paaji bhi hoga
Hum to hamesha samajhte the koi
Hum jaisa haaji hi hoga
Hai zor karein, kitna shor karein
Bewaja baatein pe ainwe gaur karein
Dilsa koi kameena nahi
Koi to rokey, koi to tokey
Iss umar mein ab khaogey dhokhe
Darr lagta hai ishq karne mein ji
Dil to bachcha hai ji
Dil to bachcha hai ji
Thoda kaccha hai ji
Haan dil to baccha hai ji
http://www.top10bollywood.com/

Aisi udhaasi baithi hai dil pe
Hassne se ghabra rahe hain
Saari jawani katra ke kaati
Piri mein takra gaye hain
Dil dhadakta hai to aise lagta hai woh
Aa raha hai yahin dekhta hi na woh
Prem ki maarein kataar re
Taubah ye lamhe katt te nahi kyun
Aankhein se meri hatt te nahi kyun
Darr lagta hai mujhse kehne mein ji
Dil toh bachcha hai ji
Dil toh bachcha hai ji
Thoda kaccha hai ji
Haan dil toh baccha hai ji

Saturday, February 6, 2010

SMS codes of bulk SMS (AX-Citibank,VM-HSBC etc)

In order to protect interests of consumers receiving unsolicited commercial SMSes, Telecom Regulatory Authority of India (TRAI) has mandated all mobile operators in India to prefix an identification tag before all application-to-peer (A2P) commercial bulk SMSes which would reveal the name of the service provider and location where the SMS originated along with the name of the company sending the SMS.

The alphanumeric identifier should be of the form XY-Name of the company where X stands for code allocated for the service provider while Y stands for the service area where the SMS is originating from.

For example, AT Citibank would mean that the SMS is sent through Airtel mobile network from Tamil Nadu by Citibank company.
Similarly VX stands for Vodafone -Karnataka, TA for Tata Teleservices-Andhra Pradesh, TM for Tata Teleservices-Mumbai, AM for Airtel-Mumbai, AX for Airtel-Karnataka, DT for Dishnet Wireless-Tamilnadu etc.

To answer the second part of your question, it is not possible to comprehend how did TRAI derive this as there can be no logical explaination.
For example in the first prefix, C stands for Datacom Solutions, D for Aircel, E for Reliance Telecom, P for Spice Telecom etc.
That's precisely why BPL Mobile Communications Ltd. decide to adopt a new name Loop Telecom Pvt. Ltd. as the symbol allocated to it by TRAI was L instead of B.

Similarly in the second prefix, Z stands for Maharashtra, X for Karnataka, Y for Madhya Pradesh, V for West Bengal, L for Kerala, I for Himachal Pradesh, S for Assam etc.