Podcasting Making Easier

Here is how you can embed a mp3/song on a web page:

<embed type="application/x-shockwave-flash"
src="http://beemp3.com/player/player.swf" style="width: 290px;" id="126954385" name="126954385" bgcolor="#ffffff"
quality="autohigh" wmode="transparent"
flashvars="playerID=1&amp;bg=0xCDDFF3&amp;soundFile=http://www.tdfast.com/mfiles/headroom-Happy_Birthday_.mp3&amp;autostart=yes"
allownetworking="internal" allowscriptaccess="never" width="290" height="24">

You should replace the mp3 file mentioned under soundFile variable. The autostart=yes variable causes the player to play mp3 immediately (it can be removed).

You can follow this to add jingles on your friend’s scrap book. Here is an example of a Birthday jingle :)

For more information about customizing refer http://www.1pixelout.net/code/audio-player-wordpress-plugin/

- ankit

Visual Studio - Database Project Not Loading

Have you ever created a Database project and after some time you are not able to load it in the Visual Studio? Probably you might be getting following error:

An error has occurred while establishing a connection to the server. When connecting to SQL Server 2005, this failure may be caused by the fact that under the default settings SQL Server does not allow remote connections. (provider: SQL Network Interfaces, error: 26 - Error Locating Server/Instance Specified)

The database project requires an active database connection to load at design time. Probably it uses that to compile/verify scripts. The problem here is Visual Studio is not able to connect to any such instance. Following are few solutions (these worked for me)

  1. Make sure the instance to which you want to connect is running and allows remote connections.
  2. After performing step 1, if it is still not loading then you may need to start the SQL Browser Service. Make sure it’s running.
  3. If the problem is still there, it has to be fixed from Visual Studio itself. Actually database project do not store to which instance it can connect. It’s a Visual Studio setting. In VS2008 go to Tool > Options > Database Tools > Design-time Validation Database > Connection Options. Specify your instance name here like “.\SQLEXPRESS”

If the problem is still there post it to MSDN forums :)

Ankit

Sony Ericsson W660i: Features (Review)

Two days back I bought W660i, a Walkman series mobile phone from Sony Ericsson. It features 2 MP Camera, Walkman 2.0, FM Radio, 512 MB card, Bluetooth, Video Call, Email/RSS, USB mass storage, Flight mode, Synchronization services, Stylish, … … all these in less than INR 9K.

Front and Side view of W660i

In addition to those common features, this phone features something new. In this post I’m going to write those specifications which you won’t be able to know unless you buy the phone. Here are a few…

  1. Bright display! I can read text even in sun light. The phone comes with preloaded high contrast images, watching those you can see how much color contrast it delivers !!! - far from any other manufacturer in the same prize range.
  2. 3.5mm jack support. This allows any kind of head phones to be used with the phone.
  3. Text Copy/Paste feature. Handy for coping/writing SMS.
  4. J2ME with support of - Internet access, File system read/write access API, camera API, Messaging APIs, automatic start, local connectivity API, running Java apps in background.
  5. You can have at max 1000 Contacts, 1000 SMS memory and 380 events/tasks. (~26MB internal memory)
  6. 5 alarms, and you can also set FM alarm.
  7. Two kind of keypad lights. White for normal purpose and Orange when Walkman is running. The orange light blinks on the beats of the song.
  8. USB charging: When you connect this phone to PC it start charging from the USB cable.
  9. Flash Menu: The main menu in this phone is built using Flash Lite. You can switch the orientation and look of the menu. Menu items can be tiled, horizontally or vertical aligned, and can have cool animations.
  10. Synchronization is one of the most important service that we should use. In short taking backup of the phone data. I sync my phone regularly with PC. The phone supports synchronization via USB data cable, Blue-tooth, or internet server.
  11. Stereo Bluetooth, Picture Blogging, Voice Dial + Playing Caller’s name, Big Fonts, Video Ringtone, etc;

Go and get the phone… it’s a worth buy cellphone.

Note: The camera is not good as compared to ‘K’ series (remember it’s Walkman phone, and this is acceptable). Still it supports EXIF, Night Mode, Effects, Self Timer, No shutter sound (in silent mode), etc;

Ankit

Eating Exceptions… eeehhhh!

Following are few points you need to take care when you decide to eat an exception. These are very much specific to C# language.

a. Limit the code block. Attempt to wrap one or two statements within try.

b. If an exception is eaten, log details to some logging mechanism. In short never write empty catch catch(Exception) {}.

c. Never eat exception that indicates some bad behavior of code execution like - ArgumentNullException,

NullReferenceException,

ArgumentNullException,

InvalidCastException,

InvalidOperationException,

AccessViolationException, etc;

d. There is a big difference between throw and throw exeception statements. This is in terms of resetting stack trace which the later does. If you are writing a framework or want to hide your internal implementation use throw exception, otherwise use throw only.

- Ankit

Let’s Digg into Google Maps

The Web would not be so simpler and interactive without Ajax. This technology makes Web applications pleasant, interactive, quick responsive and light weight. Take any of the online map applications, no matter whether it is Yahoo Maps, Google Maps or Windows Live Local, and you will find awesome precession, cutting edge technology (beyond DHTML, XML and JavaScript) well managed data. Being software developer, these always attract me and I want to understand the scene behind those best software architectures/implementations. Over the last few days I was studying (hacking) Google maps and wanted to see how it works? Here are my investigations.

Tiles: The very first observation is – not whole map is fetched at once. Instead the entire map is divided into tiles and a series of Ajax requests are fired to retrieve some part of the actually map. As soon as a tile is fetched it is displayed at its position. Their position is well calculated no matter user drags the maps while requests are on the way. The benefit here is, the user interface remains responsive and it makes user eager to analyze an area of map as soon as it’s available.

Pune-Google-Map.jpg
(more…)

My Online Presence

Hi,

I’m {PREF=”ID=cfd6bd57439bc4a9:TM=1205732323:LM=1205732323:S=tT1f1NaLxjumQJbv”}. I’m a regular Internet surfer. On an average I’m online for more than 8 hours a day and that makes me to think of a new phrase - ‘my online presence’, and somewhere it may hurt my privacy.

In Web 2.0 big companies are competing to gain as much as information about Internet users that they can show targeted contents especially ads.

The game players have already begun their game. They know about what web pages I visit, they know my friends, they know what I prefer to buy online, then know which newspaper I read frequently, which mail account I use frequently, what do I search every day, what videos I watch online, where do I live, how much time I spend on Internet, what types of ads made me to click. They have my all photographs, my daily calendar/schedule, my mails (may be your credit card statements in form of emails), and all my chat conversations. They even know what music I listen, my attitude, my behavior, and even what I’m doing currently.

They say it’s all automatic, machines (computers) read and process information giving you personalized service and there is no human interference. But reality may be different. Is all that these sufficient to protect your privacy?

Here is a bigger fear, giving all of your information in the hands on one single body! A single mistake in handling such massive information can lead to world’s biggest controversy in user’s privacy.

In short, I don’t want anybody to know the fact that the wristwatch I have given to my girl-friend for her last birthday was of just 100 bucks!

- ankit

A Long Absence…

A lot of topics were roaming in my mind, but not able to decide what to write and which one to take first. And it has been 6 months - I haven’t written a single blog post! All this is because of my studies, hectic schedule, didn’t get enough time and few other factors.

But, now Ankit is back with cool and new articles to write. And one promise to the readers of my blog - such absence will not occur again. At least I’ll try to write something about my experiences, my passions, techie stuff.

- ankit

Checklist: Cannot import webpart

While importing (drag/drop) your webpart to any SharePoint page, if you receive an error stating ‘Cannot import webpart’ or ‘unable to add selected web part(s)’… here is the check list you should look for:

  1. Make sure the webpart class is inherited either from Microsoft.SharePoint.WebPartPages.WebPart or System.Web.UI.WebControls.WebParts.WebPart
  2. The webpart class needs to be declared public.
  3. Safe controls entry in web.config file.
  4. If you are referring a webpart from GAC (i.e. assembly containing webpart class is placed in GAC) make sure the GAC version is the latest build and IIS is re-started.

- Ankit

SharePoint: ServerContext not set to an instance

I was playing through SharePoint object model and somewhere (don’t remember right now!) got an exception stating “ServerContext not set to an instance”.

My solution for this: Installed SSP (Shared Services Provider) and this problem is solved!
[ Edited:2008-03-24
I got this error while playing with stsadm.exe command
]

Windows CardSpace: FAQ for ASP.NET Developers

Few frequently asked question for ASP.NET developers:

  1. The Identity Selector dialog box is displayed only for SSL protected pages. Therefore you are required to deploy your application on a Web server and install a SSL Certificate.
  2. Windows CardSpace does not work with Self Signed Certificates and will die horribly. These certificates do not have CRL field. It contains a URL that CardSpace will check for the revocation list.
  3. For ASP.NET developers there is Toolbox control written by Christian Arnold. Add this to your Toolbox and you won’t need to write a single line of code. Watch demo.
  4. When you use CardSpaceLogin controls you must run application over SSL. The application pool also need to be run under Local System’s identify; otherwise w3wp.exe process will not be able to retrieve server’s private key. In such case you may end up with error stating “Keyset does not exist”. Note: This is not advisory if the application pool is shared with other Web applications. [ Edited: Refer Barry Dorrans comment for more details.]
  5. When using Information cards there is nothing like passwords.
  6. CardSpaceLogin controls are integrated with your identify providers such as Forms Authentication. For example: If you use Information Card to register a user, his details are reflected in the identify source.

TFS – Free Text search in History Objects

It’s a best practice to add comment when you do check-in to the source control. A text comment is associated with the change you made to the item. Some of the times you need to find a particular comment, but the View History tool available with Visual Studio/TFS is limited that you can’t make a search in the history results. Say you want to find all check-ins by a particular user :(

History Tool in Visual Studio 2005

Here comes the purpose of this small add-in. It provides search within history comments and find a particular change-set instead of traversing the whole list. The plug-in goes one step forward and facilitates free text search in change-set fields. For example you can use change-set id, username or even date-time as search keywords!!!

The major steps involved in developing this add-in are:

  1. Writing an add-in for Visual Studio 2005,
  2. Getting file history from Team Foundation Server (TFS),
  3. Look for the selected item in the Visual Studio IDE,
  4. Free text search along with the tools to compare two files.

(more…)

Useful add-ons (plugins) for Visual Studio 2005

Extensibility of Visual Studio 2005 made developers to write custom tools, aka plugins, making your everyday tasks simpler. Here are few must have tools:

  1. Visual Studio Add-Ins Every Developer Should Download Now, SmartPaster is very handful
  2. Create a Debugger Visualizer in 10 Lines of Code: Explains writing debug visualizer. If you cannot read article, downloading binaries and installing the image visualizer would be surely helpful.
  3. Line Counter
  4. Opening solution folder, See class definition on MSDN2, Search in Google – All of these available at single right click,
  5. Visual Studio IDE enhancements: Switch between C/CPP and H files, find document in the Solution Explorer, Cut and copy (plain text only)
  6. Free SlickEdit® Gadgets: Auto-copy selection, Line ruler, Indentation guide
  7. ZipStudio: Create Zip of you solution with single right click
  8. Visual Studio 2005 add-in for sorting imports/using blocks
  9. Resource Refactoring Tool: provides developers an easy way to extract hard coded strings from the code to resource files (donkey work ;) )
  10. Refactor! for ASP.NET 2.0 : 25 advanced refactoring tools in one package.

- Ankit

Foxit - PDF Reader

Q: How many times in a day you wait for Adobe Acrobat Reader to load?

A: Almost 2-5 items a day, as I’m an avid Internet user. Let me list down where Acrobat Reader sucks:

  1. The Adobe Reader 8 installer a massive 20.8MB setup to download and time consuming setup.
  2. Version 5 was roughly fast whereas new versions are becoming more memory hungry and CPU intensive and version 7 is damn hungry. It takes almost 10-15 seconds to load!
  3. Frankly speaking, I hate their patents listed in splash screen.
  4. If a PDF file has high graphics it sucks further and application hangs for few seconds.
  5. Seriously I’m looking for a replacement!

Hmmm… a serious problem that affects my efficiency directly. Let’s search for a better solution. Wow I got it as first result!

Foxit v2.0 is the answer to all my worries. It’s a free light-weight (only 1.5 MB) and amazingly fast PDF viewer and printer. A 19 MB PDF file when opened, virtual memory required by Foxit was just 10 MB against massive 23 MB for Acrobat Reader.

Even the installer is just an extractor and does not require specific permissions to install. Quite handy in cybercafé. Its user interface is same as Acrobat reader and you won’t feel using a different viewer.

- Ankit

Think & Implement at Light Speed!

If you got an ‘idea’ that can drive business, implement it right away before someone snatches it from you and publishes the implementation, especially over the Internet.

That’s what happened with me. I had a thought of building ‘code-history’, history of each line of source code file. Typically when you look at the source control, you see file history. Actually it’s not directly associated with source code file; it’s first coupled to the change (change-set) you made and then linked to the file. So, the idea was to build Code History by combining two typical file operations: 1) File History and 2) File Diff technology. And drill down till you get the version where selected code was first introduced.

Orcas, next version of Visual Studio, features the same named – Annotate:

“Annotate is an Orcas feature that allows developers to inspect a source code file and see at line-by-line level of detail who last changed each section of code. It brings together changeset data with difference technology to enable developers to quickly learn change history inside a source file. You can answer the questions “which version of the file introduced this section of code?” or “who left this buffer overrun in the code?!” Subversion users may recognize this as the ‘Blame’ command.”

- Explained by Orcas Team

In simple words, I lost it :(

This is not a single instance, earlier the concept of Flickr Maps stroke to my mind and while I was planning (for few weeks) the scope of the concept, they launched :( .
No doubt, they are ahead, but not much. I’m just around the corner!

Lessons I learnt:

  • Internet is Big Boss that knows every thing. If you have an idea, first search for the same thoroughly.
  • If your thought is unique, carry out Proof of Concept right away. I mean “right away“.
  • In case you don’t want to implement, write a ‘Blog post’ to claim (or go for patent). Or give it to me I’ll write.
  • Think much faster (much much faster at what pace I do currently).

The exponential growth of Internet has made world’s thinking/inventions much faster then what happened in previous centuries. Inventions are much closer to each other with a thin line of separation. The half-life of our knowledge is decreasing and Humans have to survive!

Thanks!

- Ankit

[Inputs from ‘Chiku’ - aka Chirag Maharaj:

The records breakers are just a second ahead then the runners up then also the money difference in them is more than 10 times and even the glory they receive is 100 times more than runner up; though the diff was just one second!!!

So you to be the winner, you have to be just one step ahead. A little hard work could make u at top!
]

Preview: LINQ

Hmmm… a new tool in my hands
… and following equation makes me crazy about it…

C# 2.0 + ADO.NET = LINQ = C# 3.0

In simple words Language Integrated Query (LINQ) exposes the power of SQL queries within C# syntax. This technology along with its tools allows you to connect to SQL database, extract metadata, build typed datasets/classes (using C# Generics) and make you use them along with C# syntax using just two lines of code. And not necessarily SQL databases, it can execute on any collection type.

int[] numbers = { 5, 4, 1, 3, 9, 8, 6, 7, 2, 0 };
var lowNums =
     from n in numbers
     where n < 5
     select n; Console.WriteLine("Numbers < 5:");
foreach (var x in
lowNums)
{
    Console.WriteLine(x);
}

Have a look at Linq Project @ MSDN and 101 Samples all to sense this. Here in this short -n-simple post I’m just showing how to do things for databases stored as *.mdf files and generate wrapper classes.The LINQ preview includes SqlMetal.exe, a utility to auto-generate a strongly-typed C# DataContext class file from an SQL Server 2000 or 2005 database’s metadata with this execution syntax:

$>sqlmetal.exe /namespace:NWind /language:csharp /code:Northwind.cs “c:\ Northwind.mdf”

- Ankit