Wednesday, July 16, 2008

Download from remote CVS

No comments:
* Client machine (your current Linux user, eg: peter)
* Server machine (user where you want access, eg: mister_big)

* Create a keypair private/public key on client machine to avoid retype the password every time (on peter machine)

Go to .ssh folder and type:

ssh-keygen -t dsa

Select Emtpy pass-phrase.

2 files had been created. id_dsa (private key) and id_dsa.pub (public key)

* You need add the id_dsa.pub content into authorized_key2 file on server machine (server machine is the computer where you want to access, in this case mister_big)
* Copy id_dsa.pub into server machine. Eg: via FTP. Note: You need move id_dsa.pub to root folder to access file via FTP since .ssh folder is not listed on FTP clients.
* On mister_big machine, move id_dsa.pub into .ssh directory (.ssh folder is a directory placed on root)
* Merge the new key (WARNING: I saw a lot comands to make this but for me only works fine this option)

mv authorized_keys2 authorized_keys2.bak // It's a backup
cp id_dsa.pub authorized_keys2 // Overwrite current authorized_keys2
cat authorized_keys2.bak >> authorized_keys2 // Use a backup to merge files
chmod 600 authorized_keys2 // Restore permissions

Go again to client machine (peter machine) and type:

ssh-agent /bin/bash
ssh-add

And next, you can download code without type password anymore:

export CVS_RSH=ssh
cvs -d:ext:mister_big@yourdomain.com/cvs checkout

Tuesday, June 10, 2008

Enums

No comments:
For the Tourline email, I needed to parse an FM CVS Export file. First, I split up the fields with a "split" function...




//First, make sure any old files are cleaned up.
System.IO.File.Delete(m_strOutFile);

//Ask FM to generate the new file
Utils.Tools.RunFMScript("Shipments.fp5", "TourlineExport");
Utils.Tools.WaitForFMGenerateFile(m_strOutFile, 120);
System.IO.TextReader reader = null;
try
{
if (System.IO.File.Exists(m_strOutFile))
{
reader = System.IO.File.OpenText(m_strOutFile);
while (reader.Peek() > -1) {
string strLine = reader.ReadLine();
if (strLine.Length > 0 && '"' == strLine[0])
strLine = strLine.Substring(1);
if (strLine.Length > 0 && '"' == strLine[strLine.Length - 1])
strLine = strLine.Substring(0, strLine.Length - 1);
string[] splitter = { "\",\"" };
string[] shipmentLines = strLine.Split(splitter, StringSplitOptions.None);


To index into shipmentLines, I started doing the following...

const int k_shipmentID = 0;
const int k_invoiceID = 1;
const int k_title = 2;
const int k_firstNames = 3;
const int k_surname = 4;


...but quickly realized that it was hard to maintain (if the needed fields change, or the number of fields change - whatever). Therefore, I started using enums





enum FMFields
{
ShipmentID, InvoiceID, Title, FirstNames, Surname, Street, Street2,
Town, City, County, Country, PostalCode, StrUnfoInfo, InvoiceTotal, ScannedStatus,
DateScanned
};


Much nicer, and easier to maintain - and less typing to boot! Note that I use the .NET convention of capitalizing both the enum name and the names of the members.

Thursday, March 13, 2008

Position Preferences in AdWords

No comments:
While going over the settings from a German campaign, I stumbled upon the "position preferences" option. This allows you to specify to Google in which position or range of positions you want to appear in the paid search results. Great! I thought. Let's set up all the keywords to be in position 1-6, since going any lower is just a waste of time.

However, I found 2x problems. The first was that I found no way, besides going in one keyword at a time, to adjust this. Nothing in the web interface, and nothing in the AdWords Editor. So, before sending an email asking Susana to do this across all our campaigns, I started reading about people using it. Apparently, there are a lot of circumstances where it simply doesn't work at all, and Google even specifically says that this option is only a "suggestion", not a guarantee.

Well, since we always rank well anyway, I decided to skip the work.

Thursday, February 21, 2008

Products Not Showing - MySQL 5

No comments:
If you find a new JShop install where products are not showing, it could be a JShop 1.2/1.3 incompatibility with MySQL5 - products not showing up is the major symptom of using MySQL5. To fix this, read the thread http://forums.jshopecommerce.com/showthread.php?t=2711. A copy of the file that needs to be merged to make it work is kept at \\server2003\Permanent\Projects\Details\Amexoptics\jss versions\MySQL5_Patch