Monthly Archives: July 2013

Embedding JWPlayer

The best way to embedd JWPlayer is declare a div and leave it empty, like this

<div id=”video_player”>

</div>

Include your javascript at the end of the page inside. The javascript should use this ID in JWPlayer code.

If you put JavasScript directly in the div, it might not work.

Workspaces in TFS, Best practices

How to create new workspace in TFS, how to use them and how to check out projects from TFS?

If you have TFS (Team Foundation Server) installed, Open Visual Studio 2012 and go to

  1. File > Source Control>Advance>Workspaces. A dialog popups. Click add workspace, type in name of the new space
  2. Select the workspace and click edit button. Set the local path as well are remote path.Best practice is, Remote path should be the root folder where all projects are sitting. Local path should be empty folder preferably sitting in the root folder such as c:\Projects\
  3. The local folder has been mapped. Now TFS will ask you to check out the project (a dialog box will popup). Select no at this point. Selecting yes will force to check out everything in the root folder which you may not want.
  4. In Visual Studio 2012, go to Team Foundation Server, click on home button then “Explore Source Code”. Now select the folder you want to check out and select get latest. You can select a folder embedded in the root folder. That will check out the folder you selected as well as its complete path. This way your local copy of the repository has the same exact path as on the Server.

Workspaces is a wonder way to fix issues in builds. For example you have a workspace which you are working in. Suppose someone checked in the code that broke the build. Now you can create a second workspace as guided above and check out the same project. Open the new project in a new Visual Studio. You will spot the bug right away without breaking your existing code (which might work fine).

Reflections C# – A run time thing

Reflection is a basically the mechanism by which code can get on itself, such as meta data as well as on other code as well. Reflection is more of type C++ RTTI (Runtime Type Interpretation). Reflection allows us to find if a given method in class exists, if it exists then use it if not, then invoke another method.

The real use of Reflection is in test framework where the framework goes though all the methods and see if the method is marked as a test method using attribute.

Reflection is also used to create classes on the fly on run time and call methods on that class or object. However this can be done with out reflection in modern languages.

A good tuturial about getting started with reflection is this

peak time travel to pakistan

When is peak time travel to pakistan?

I have went to Pakistan in different season. I have paid as less ast $800 return ticket with flight almost empty, about 7 years ago and recently the tickets are in the round $2000+ range, that seems a lot. I usually pay around $1400 or less for Pakistan ticket. What the good time to travel to Pakistan when tickets are relatively cheap? I will give some summary

The following fairs were calculated using cheapoair.com from New York, JFK to Islamabad airport.

month fair range
January 1200-1800
Febraury
March
April
May
June
July
August 1600-2200
September 1100-1500
October 1200-1700
November 1200-1800
December 1200-1700

Get clean list from html select element

How to get a list from html select element

select F12, select the select tag, right click then copy inner html.

Start note++, copy the text there. Put the following in search box. This is regular expression term that searches for < anything in between >. It will find all such instances of <p> or <p style=”color:blue”>

<.*?>

Not that this is greedy algorithm. It returns as soon as it find it first match. Make sure you select “Regular Expression” radio button when you do this search.

The use of + operator in Google Search – Example

It is hard to find a use for + operator in search engine. Here is an example that shows how exactly it works.

Search for a string

open apng file

You will notice that it does not pull relevent result. All it shows in PNG file result. Now change it to

open +apng file

Now you see fewer results but all has apng in it.

BTW APNG files are animated PNG files which ares not supported universally.


APNG

Animate PNG files