Thursday, June 28, 2012

How to Minimize Skype to Windows 7 System Tray (Notification Area)


Issue
Due to the new design behavior guideline forWindows Taskbar on Windows 7, more and more software application has now making its icon to locate and stick at Windows 7 Taskbar when minimized, instead of minimizing to system tray(notification area). The most common example in Windows Live Messenger, and now Skype 4.2 (download Skype 4.2 Beta) follows the footstep.

In Skype 4.2 or any newer versions, Skype will be minimized to Taskbar, as an icon or button, when the Skype main window is closed. In previous versions, such as Skype 4.1, 4.0 and 3.0, Skype is typically minimized to system tray, which now known as notification area, right beside the clock on Windows Taskbar when the main window is closed.
Leaving the Skype program running on Windows Taskbar is not very useful to many users, especially notifications alert will pop up informing user when there is new incoming call, instant message (IM), files, contacts, events and etc. The Taskbar icon or button is prone to mistakenly or accidentally click and activate, and the Skype window is also subjected to rotation when user jumping around tasks with Alt+Tab or Win+Tab keyboard shortcuts.
In order to make Skype minimize and hide its icon into notification area or system tray when minimized, users can use the same trick to minimize Windows Live Messenger MSN Messenger to system tray in Windows 7. Here’s how to minimize Skype to notification tray on Windows 7.

Solutions:
Updated Skype Built-In Method
  1. In Skype, go to Tools -> Options.
  2. Then, click on Advanced tab to go to Advanced settings.
  3. Uncheck and untick the Keep Skype in the taskbar while I’m signed in option.
  4. Click Save button, and the Skype button or icon will be removed from Taskbar on minimize.
Note: You won’t see the option if the Skype is in compatibility mode.

Compatibility Mode Method
  1. Exit or quit from Skype program.
  2. Right click on Skype icon on Desktop or Skype shortcut in Start Menu, and select Properties.
  3. Go to Compatibility tab.
  4. Under “Compatibility Mode’ section, check and tick the checkbox for Run this program in compatibility mode for: option.
  5. In the below drop-down box, select Windows Vista (Service Pack 2).
  6. Click OK.
  7. Start the Skype program, and now it should minimize to system tray.


5 Attractive Content Sliders with Featured list Layout


  • jQuery Feature List Plugin | Demo
    jQuery Feature List Plugin
    I love the simplicity of using (and more important re-using) jQuery plugins. So I decided to release a plugin that came from my personal need - Feature List. This jQuery plugin enables simple and easy creation of an interactive "Featured Items" widget.
  • jQuery Youtube Playlist Plugin | Demo
    Youtube Playlist
    For a recent client project, we wanted to be able to turn a list of YouTube links into a playlist. This would allow the client to manage their videos on YouTube and simply insert links to the videos on their site. With javascript enabled a nice playlist is created, whilst without javasript the user gets a regular list of links to youtube pages.
  • Featured Content Slider using jQuery UI | Demo
    Featured Content Slider using jQuery UI
    Showing off the best content of your website or blog in a nice intuitive way will surely catch more eyeballs. Using an auto-playing content slider is the one of techniques to show your featured content. It saves you space and makes for a better user experience, and if you add a pinch of eye candy to it, then there�s no looking back.
  • Image Rotator with Description | Demo
    Image Rotator with Description
    An image rotator is one great way to display portfolio pieces, eCommerce product images, or even as an image gallery. Although there are many great plugins already, this tutorial will help you understand how the image rotator works and helps you create your own from scratch.
  • JC Play List - Flash Solution | Demo
    JC Play List
    JC Play List is an easy to use ActionScript 3.0 list component created especially for easy visual representation of multimedia lists (.xml and RSS 2.0 feeds from Picasa and Flickr)

Wednesday, June 27, 2012

Replace vs Stuff in sql server 2005

The Replace function looks like this:
select replace('welcome in C# Corner','el','c')


Result: wccome in C# Corner 
No locations to find, just replace the string.  However, what if we had a string with two occurrences of the string, like:

select replace('Hello world','l','d')


Result: Heddo wordd 
If we only wanted to replace the first one, Replace wouldn't work, since it always replaces ALL occurrences of the string. But Stuff would, since it only replaces the string it finds at the starting location we tell it for the number of chars we want it to replace. 

select stuff('Hello world',7, 5,'Manish')
 
Result: Hello Manish

404.2 The page you are requesting cannot be served because of the ISAPI and CGI Restriction list settings on the Web server


By default IIS 7 does not allow ISAPI and CGI through .Net 1.1. So if you are working with older code on IIS 7 you will need to follow these steps to resolve the issue:

1. Open IIS and click the server name

2. Double click “ISAPI and CGI Restrictions”

3. Right click ASP.NET v1.1 and select “allow”

Monday, June 25, 2012

How to get querystring value using jQuery

In this post, I will show you how to get the QueryString variable value using jQuery. I have created a function which returns value of any querystring variable.



//Code Starts
function GetQueryStringParams(sParam)
{
    var sPageURL = window.location.search.substring(1);
    var sURLVariables = sPageURL.split('&');
    for (var i = 0; i < sURLVariables.length; i++) 
    {
        var sParameterName = sURLVariables[i].split('=');
        if (sParameterName[0] == sParam) 
        {
            return sParameterName[1];
        }
    }
}​
//Code Ends

And this is how you can use this function assuming the URL is,
 "http://dummy.com/?technology=jquery&blog=jquerybyexample". 

//
var tech = GetQueryStringParams('technology');
var blog = GetQueryStringParams('blog');
//

Basic Difference between ArrayList and List


Lets find out some important differences for two collection types – ArrayList & List<T> , both are designed / exist in framework for grouping the objects together and perform various operations on them as per our requirments.

ArrayList -

1) Namespace System.Collections contain ArrayList ( This namespace is added by default when we we creat any aspx page in C#)
2) Create ArrayList :
ArrayList stringArrayList = new ArrayList();
Here we dont need to specify object type arraylist going to contain,store different type of objects/items/
3) In ArrayList each item is stored as an Object so while reteriving we can get object only.
4) It is like Array of Objects.

List<T> -

1) Namespace System.Collections.Generic List<T> ( we need to add namespace if we want to use Generic Types)
2) Create List<T>:
List<string> stringList = new List<string>();
i.e.
List<type> nameOfList = new List<type>(); & type means object type which List<T> going to hold.
3) In List<T> , it can hold/contain only type of object which is mentioned while initialising the List<T>
Just like in above example stringList will only contain object of type string, the type supplied as generic parameter.
4) It is newly added in .Net 2.0 & onwards, fast processing no need of casting explicitly.
Lets see one example.
string first = “First String”;
string second = “Second String”;
int firstInt = 1;
int secondInt = 2;
ArrayList stringArrayList = new ArrayList(); // No need to specify the object type,can store anything.
stringArrayList.Add(first); // string type
stringArrayList.Add(second); // string type
stringArrayList.Add(firstInt); // Can contain any type so no problem in storing int

List<string> stringList = new List<string>(); // Need to specify the object type, will contain only string types.
stringList.Add(first);
stringList.Add(second);
1) Lets consider Case :
stringList.Add(firstInt); // adding int in string type List.
we will get the exceptions below as List need to contain only string types. others are not allowed.
1) ‘The best overloaded method match for ‘System.Collections.Generic.List<string>.Add(string)’ has some invalid arguments’
2) ‘Argument ’1′: cannot convert from ‘int’ to ‘string’
2) Lets consider another case :
string abcd = stringArrayList[1];
Suppose if we try to get an ArrayList item without using the casting then we can get following exception, as arraylist contain Objects only we need to cast as pre our requirments.
We will get Exception –
‘Cannot implicitly convert type ‘object’ to ‘string’. An explicit conversion exists (are you missing a cast?)’
We can avoid it as
string abcd = stringArrayList[1].ToString(); // Needs casting ,memory overhead.

using c# and vb in the same web project


every once in a while i get asked if you can have both c# and visual basic in the same web site project.  my gut response is always to ask "why would you want to" as i always assume it is a new project, etc.  to me, it simply wouldn't make sense from a new project standpoint, code reviews, coding standards, continuity, project maintenance, etc.
however, people still ask.  to-date i never really tried (and that's been my answer).  i was presented with a usable scenario of why you may need (not want, need) to do this, so i finally tried it.  the answer: yes...kinda...sometimes.
let's assume we have a web site structure like this:
sshot-9
we have the App_Code folder and a .cs and a .vb file in the same projects (separated into sub-folders).  note that the project sees them as folders (yellow folder icon) in the special folder.  each class within there basically has a "hello world" function only, like this in the c# file:
   1:  public string SayHelloCS()
   2:  {
   3:      return "Hello from CS";
   4:  }

and the visual basic file has a similar function emitting "Hello from VB."
now, if you run default.aspx in this structure, this is what you will see:
The files '/WebSite5/App_Code/VBCode/Class2.vb' and '/WebSite5/App_Code/CSCode/Class1.cs' use a different language, which is not allowed since they need to be compiled together.
interesting?  probably not, but it makes sense...so how do we overcome.  we use a configuration option called .  here's what we need to add to our <compilation> node in our web.config:
   1:        <compilation debug="false">
   2:          <codeSubDirectories>
   3:            <add directoryName="VBCode"/>
   4:            <add directoryName="CSCode"/>
   5:          </codeSubDirectories>        
   6:        </compilation>

once we add those codeSubDirectory nodes, let's "look" at what the project structure looks like now:
sshot-10
as you can see the code folders are now "special" in the eyes of visual studio.  now if we browse default.aspx we will see:
Hello world from CS. Hello world from VB
and we're done.  so if you have some legacy code (let's say a provider) that is in visual basic and your new project is c# (and you've already had the long heated debates with your team on why you are choosing a language over the other), you can implement this option of using .
now, you can also have multiple pages that have different code-beside languages and that works in this model.  however, if you are using the web application project model, this will not work.  the multiple code files only works inherently (along with codeSubDirectories) with the web site model

Wednesday, June 20, 2012

Embedded C programming - for beginners

Embedded programming is always hardware related. You may at least need to buy a develop kit or emulator. The price is not that cheap. Can we save those bucks and still learn the fundamentals of embedded C programming? 

Thanks to Keil - An ARM company. If you never heared about Keil, congratulation again! you are the beginner and this article is right for you! Keil provides a great Evaluation Software supporting different paltforms but with very few limitations. It includes the assembler, compiler, linker, debugger, and IDE. Everything you need for embedded C learning is here. How to get it? Go to this webpage of Keil (http://www.keil.com/demo/) and you can get it free (you just need to fill out a simple form)!

How to restore/reset lost Visual Studio 2005 menu items

For some strange reason, installation of various add-ins and add-ons for Visual Studio 2005 causes it to reset its menus - and possibly other settings. 
But they don't get reset to installation defaults: rather, Visual Studio goes into some kind of minimalistic state where you don't get a "Macros" item in the "Tools" menu anymore, the "Attach To Process" and "Exceptions" commands get lost etc. 
At first I resorted to going into the Customize dialog and bringing back the items each time (although I never was quite able to figure out how to correctly get back the "Build [project name]" item: occasionally it either appears twice or disappears).
 I did so much installing/reinstalling of various CTP's that eventually I gave up on customization and started using keyboard shortcuts instead of menus. Now, finally, 


I found out that there actually is a simple way to reset settings to "normal" instead of "obscure" (seems I hit the right magic word with Google: my searches for "reset Visual Studio 2005 menu" and such led nowhere, but once I asked it how to restore the Macros menu, I struck gold :)). 




The solution is as follows: go to Tools -> Import and Export Settings and choose Reset all settings

Tuesday, June 12, 2012

SQL: How to create view from a recursive query?


How can I create a view which does this:

;WITH Tree (ID, [NAME], PARENT_ID, Depth, Sort) AS
(
    SELECT ID, [NAME], PARENT_ID, 0 AS Depth, CONVERT(varchar(255), [Name]) AS Sort FROM Category
    WHERE PARENT_ID = 0
    UNION ALL
    SELECT CT.ID, CT.[NAME], CT.PARENT_ID, Parent.Depth + 1 AS Depth, 
    CONVERT(varchar(255), Parent.Sort + ' | ' + CT.[NAME]) AS Sort
    FROM Category CT
    INNER JOIN Tree as Parent ON Parent.ID = CT.PARENT_ID)
-- HERE IS YOUR TREE, Depths gives you the level starting with 0 and Sort is the Name based path
SELECT ID, [NAME], PARENT_ID, Depth, Sort FROM TreeORDER BY Sort


It should be as simple as:
CREATE VIEW YourViewNameAS
    WITH Tree (ID, [NAME], PARENT_ID, Depth, Sort) AS
    (
        SELECT ID, [NAME], PARENT_ID, 0 AS Depth, CONVERT(varchar(255), [Name]) AS Sort         
        FROM Category
        WHERE PARENT_ID = 0
        UNION ALL
        SELECT CT.ID, CT.[NAME], CT.PARENT_ID, Parent.Depth + 1 AS Depth, 
        CONVERT(varchar(255), Parent.Sort + ' | ' + CT.[NAME]) AS Sort
        FROM Category CT
        INNER JOIN Tree as Parent ON Parent.ID = CT.PARENT_ID
    )

    -- HERE IS YOUR TREE, Depths gives you the level starting with 0 and Sort is the Name based path
    SELECT ID, [NAME], PARENT_ID, Depth, Sort FROM Tree
GO