I needed to recover my password on my mac book.
I have found the article here.
1.Reboot
2. Hold Command key & S (After you hear the chime)
3. Login into your account, and you will receive power shell
4. After enter following commands. Each as separate line and they are case sensitive.
mount -w /
rm /var/db/.AppleSetupDone
shutdown -h now
****make sure to use spaces and capital letters EXACTLY as shown in the terminal commands above****
IT will not WORK if you don't type it EXACTLY like this.
Source for this article
Monday, 10 June 2013
Tuesday, 21 May 2013
SalesForce - Tips
Sales force
Errors I have encountered while trying to connect without much reading
LOGIN_MUST_USE_SECURITY_TOKEN: Invalid username, password, security token; or user locked out. Are you at a new location? When accessing Salesforce--either via a desktop client or the API--from outside of your company’s trusted networks, you must add a security token to your password to log in.To receive a new security token, log in to salesforce.com at http://login.salesforce.com and click Setup | My Personal Information | Reset Security Token.
Resolution
Update password field of your log in with merged password and security token
var response = sforce.login(LoginUserName, LoginUserPassword + LoginSecurityToken);
Creating custom fields
I have used designer to generate custom fields in my object and generated WSDL but my custom field is not present in generated XML.Solution:
Go to: Account => Setup =>App Setup=>Objects
Open object you want to edit. Click on field you want to make visible.
Click on highlighted "Set Field-Level Security"
Set appropriate visibility read only levels.
Used references:
reference book
Creating custom fields
Detect access rights to directory
Just have been playing on my lunch and wondered how can
I detect from my C# code whether I have access right for reading/writing to
specific folder.
I come up after bit of trial and error to code as follows:
string path = @"c:\temp";
string NtAccountName = @"group\userName";
var di = new DirectoryInfo(path);
var acl = di.GetAccessControl(AccessControlSections.Access);
var rules = acl.GetAccessRules(true, true, typeof(NTAccount));
//Go through the rules returned from the DirectorySecurity
foreach (AuthorizationRule rule in rules)
{
//If we find one that matches the identity we are looking for
if (rule.IdentityReference.Value.Equals(NtAccountName, StringComparison.CurrentCultureIgnoreCase))
{
//Cast to a FileSystemAccessRule to check for access rights
if ((((FileSystemAccessRule)rule).FileSystemRights & FileSystemRights.WriteData) > 0)
{
Console.WriteLine(string.Format("{0} has write access to {1}", NtAccountName, path));
}
else
{
Console.WriteLine(string.Format("{0} does not have write access to {1}", NtAccountName, path));
}
if ((((FileSystemAccessRule)rule).FileSystemRights & FileSystemRights.Read) > 0)
{
Console.WriteLine(string.Format("{0} does not have read access to {1}", NtAccountName, path));
}
else
{
Console.WriteLine(string.Format("{0} does not have read access to {1}", NtAccountName, path));
}
}
}
original code that i used is of course from StackOverflow
Thursday, 16 May 2013
Continuous Integration - TFS Build web deploy
I have been working on web development for a while no wand using TFS 2010 and 2012.
For a while I am using "web deployment" functionality.
In this article I make the assumption that:
To create next step in CI is to have build server deploy your latest version of code to the website.
I am using default build template for this deployment.
Make sure that Web deploy is installed on the server (TFS and deployment)
Note: I am using version Web Deploy 3.0
From the picture you can see default build configuration.
I am using MSBuild arguments in order to realize my deployment.
Now the arguments you need to provide to be able to create deployment.
/p:DeployOnBuild=True /p:DeployTarget=MsDeployPublish /p:MSDeployPublishMethod=InProc /p:CreatePackageOnPublish=True /p:MSDeployServiceUrl=localhost /p:DeployIisAppPath="Your Project App Name" /p:UserName=domain\user /p:Password=userPassword
I have had few attempts to do this right, but the most important issue I have had is:
For a while I am using "web deployment" functionality.
In this article I make the assumption that:
- You know how to setup TFS build.
- You have setup MS Deploy on your IIS application.
- Your are using IIS 7 or higher
To create next step in CI is to have build server deploy your latest version of code to the website.
I am using default build template for this deployment.
Make sure that Web deploy is installed on the server (TFS and deployment)
Note: I am using version Web Deploy 3.0
From the picture you can see default build configuration.
I am using MSBuild arguments in order to realize my deployment.
Now the arguments you need to provide to be able to create deployment.
/p:DeployOnBuild=True /p:DeployTarget=MsDeployPublish /p:MSDeployPublishMethod=InProc /p:CreatePackageOnPublish=True /p:MSDeployServiceUrl=localhost /p:DeployIisAppPath="Your Project App Name" /p:UserName=domain\user /p:Password=userPassword
I have had few attempts to do this right, but the most important issue I have had is:
- Too long output drop folder in build configuration ( file path exceeded 248 characters)
- Insufficient write permissions. This was due to account that is running build did not had write access to folder. Do not let it fool you, account that does the publishing has to have access rights to write into the folder. Alternative is web deploy service has to run under account that has write privilege to write into target folder.
Wednesday, 15 May 2013
CodeSnippet - Copy stream
/// <summary>
/// Copies the contents of input to output. Doesn't close either stream.
/// </summary>
public static void CopyStream(Stream input, Stream output)
{
byte[] buffer = new byte[8 * 1024];
int len;
while ( (len = input.Read(buffer, 0, buffer.Length)) > 0)
{
output.Write(buffer, 0, len);
}
}
http://stackoverflow.com/questions/411592/how-do-i-save-a-stream-to-a-file
public void DoFileDeletingLogic(){
string file = _dataPath + "\\file.txt";
string fileTemp = _dataPath + "\\fileTemp.txt";
if (!File.Exists(file))
{
throw new Exception("File does not exists");
}
FileStream fileStream = File.OpenRead(file);
// copy file into new file
using (Stream newfile = File.OpenWrite(fileTemp))
{
CopyStream(fileStream, newfile);
}
// and dispose of the stream, as now its locked for access.
fileStream.Dispose();
// do your logic here that deletes file
if (File.Exists(file))
{
throw new Exception("File should be deleted");
}
else
{
// replace existing file
File.Move(fileTemp, file);
}
}
/// <summary>
/// Copies the contents of input to output. Doesn't close either stream.
/// </summary>
public static void CopyStream(Stream input, Stream output)
{
byte[] buffer = new byte[8 * 1024];
int len;
while ((len = input.Read(buffer, 0, buffer.Length)) > 0)
{
output.Write(buffer, 0, len);
}
}
Subscribe to:
Posts (Atom)