Showing posts from January 2, 2011

SEO One On One - Web of Links

Creating Links, Connecting other sites to yours. The term Web of Links refers to creating multiple sites, each connected to the other one, in order to promote a specific website. This is exactly what a website owner would like, an hour work (and about 50$  investment) which will generate his website 25 links. Web of Links is mainly for indexing purposes and less for getting a higher page rank (PR) in search engines (Google). I'll start by explaining the benefits of the Web of Links method: Let's say you just created a website. You've made all the right things... Listed your site in all the indexes websites, registered to Google Analytics and Google Web Master Tool and even wrote some content pages in order to attract visitors. This is good, the only problem is that Google may have not indexed all you pages yet.  If you're a small new website, this process can take awhile. The Web of Links idea simply makes the linking process smoother. Enter a domain s

Linked Files in Visual Studio 2010

File Linking, File Sharing and Shared Projects. You know how it feels to have shared files on VSS? Gooood . Actually it felt so good that my beloved CTO (who said something about promotion?) switched to TFS just 4-5 months ago.  And ever since - I cry myself to sleep every night. Instead of one file, shared between 5,6,7 or 10 projects, we now have a copied file for each project.  This is due to Microsoft "Best Practice" which says - No Shared Files . Meaning...? If I have a JavaScript file called Arrays.js.  It's all purpose is to handle arrays in JavaScript.  This file exists in 6 different projects, which mean, that if I have another addition to this small JavaScript library, I have to copy it to 6 different files in 6 different projects... JUST SHOOT ME!!! Finally, I have the fix we've all been waiting for, courtesy of VS 2010: "Add File As Link" How to Link Files to Different Projects: Let’s say we have 2 completely dif

First Steps In F Sharp

F# - also known as F Sharp . As you know, there are some OOP languages out there. You probably know VB.Net, C# and Java but I'm about to talk about relatively new one. I would like to talk a little about F Sharp . Similar to C Sharp and VB.Net, F# is also targeting the .Net Framework and is also Object Oriented. The main difference in F# is not it's unique syntax but rather the new point of view and better state of mind it brings to the Object Oriented Programming. F Sharp uses "type inference" - meaning, the programmer doesn't need to keep his mind in the needed data type parameter and can just use the word "let" (similar to "var"). The data type will be deduce by the compiler itself during compilation (F# also allows explicit data types declaration). After this short introduction to F# (very short) I would like to start the practical section.  and this post will be all about Lists in F Sharp. Let’s make a small expe

String Manipulation - IsNullOrEmpty Method

I guess we all need to check strings all around the code. And for that, we have about gazillion ways, and here are some -BAD- examples: if (ourString == null) if (ourString == "") if (ourString.trim() == "") if (ourString == string.empty) Luckily, Microsoft have came up with this great method "IsNullOrEmpty" which has something like this: return val == null || val == String.Empty; This is a great function thought it doesn't cover 100% of the cases.  Lets say, for example, that I have this string: "    ". Now, according to Microsoft the IsNullOrEmpty method will return false. Unfortunately, this is not a good result for us. In order to fix this in our projects, we added this small method: public static bool IsNullOrEmpty(this String val) {     return val == null || val.trim() == String.Empty; } This will resolve our problem. So now we can use: bool b = String.IsNullOrEmpty("  "); And we will get true.

Get Query String

There are enormous number of ways to get a specific key value that lays in the query string. JavaScript: function getQueryString(key, default_) {     if (default_ == null) default_ = "";     key = key.replace(/[\[]/, "\\\[").replace(/[\]]/, "\\\]");     var regex = new RegExp("[\\?&]" + key + "=([^&#]*)");     var qs = regex.exec(window.location.href);     if (qs == null)         return default_;     else         return qs[1]; } This means the default value of this key (in case it does not exist) will be "en". var language = getQueryString("lng", "en"); ASP.Net: string language = Page.Request.QueryString["lng"]; PHP:   $var = "lng"; $language = isset($_GET[$var]) ? $_GET[$var] : "en"; Hope this was helpful and / or saved you some time, Elad Shalom, CTO at

JSON Object Code Example

The first example is to demonstrate the power and the accessibility JSON offers to developers. This is a JavaScript code designed to make things easier for the -new to JSON- developer:     function User(fName, lName, age, friends)     {         var UserObject = {             FirstName: fName,             LastName: lName,             Age: age,             Friends: [],             IsUnderAge: function()             {                 return this.Age > 21 ? true : false;             }         };                 var FriendsCounter = 0;         for (var frnd in friends)         {             UserObject.Friends[FriendsCounter] = friends[frnd];             FriendsCounter++;         }                 return UserObject;     } This is the constructor.  Same as in every OOP language, each object needs to have constructors. Now, lets say I let a user named Igor fill an information form containing the following fields: First Name Last Name Age Friends - each frie

Quick JSON Tutorial

JSON . In my first 2-3 year as developer I defined myself as a "Control Developer". The definition for Control Developer is a very simple one.  A developer who believes that anything and everything can be created using Ctrl + C and Ctrl + v (meaning copy and paste). This approach was working great as long as I didn't need to create brand new solutions for brand new features with brand new problems. As I was saying, About 15 months ago when I was working in my old company ( FixYa ) I was asked by my team leader to pass a JSON object to the server and to expect to get a different JSON object back. As a young proud developer the first thing I said was - “sure.  No problem".  And then the problem started. I couldn't find any good quick tutorial for JSON. What I needed was how to write a JSON object easily, not a full explanation of the JSON parser. Now, 15 months later I'm proud to present what I was looking for then - a very quick and usable tutorial for J

IE CSS Hacks

Internet Explorer . It doesn't matter if it's IE 6, IE 7 or IE 8, they all suck. Even though IE 8 has made some progress concerning CSS issue, IE 7 and obviously IE 6 are the worst browsers. With CSS compatibility issues from here to Bill's office it takes too much work to make one CSS file fit all. That's why I thought of a small hack that I make in every HTML / XSLT / ASPX document I'm working with. at the body tag of each page I insert a small html if: <!--[if IE 6]> <body class="ie6"> <![endif]--> <!--[if IE 7]> <body class="ie7"> <![endif]--> <!--[if IE 8]> <body class="ie8"> <![endif]--> After placing that, you can easily create inside your general CSS file an inherited styling such as: body     { margin: 0 0 0 0; } body.ie6     { margin: 0 5px 0 0; } body.ie7     { margin: 0 0 5px 0; } body.ie8     { margin: 0 0 0 5px; }

IE Blocking IFrame Cookies

Microsoft . A company wishes to set development standards. A company you must know how to work with. A company we all hate to love. A little story, if I may. I work in a company that supply sports betting solutions for online gaming web sites.  About 2 months ago we got a new client with a slightly weird request - The solution should be placed in an existing site's IFrame. The minute I heard that request I thought to myself that the amount of problems we'll encounter will give us tremendous amount of work.  But as always - The client's always right. Three weeks ago we were almost ready for beta when our QA discovered some small issues regarding user preferences: Odds, Time Zone and Languages are not displayed correctly only on IE 7 and IE 8. After wishing some bad things to happen to Bill, my next action was to open the HttpWatch tool IE has and locating where the cookies are being set.  I saw that whenever the cookies are set as Session Cookie i al