Friday, March 11, 2011

DataGridViewRadioButton Column


Hi,
One of the major requirements of my project is to have an column inside the datagridview which will allow the user to select the primary account holder in a team of employees listed.
I have searched through for several different possibilities of having a radio button inside a column cell. I wonder why Microsoft has never designed such a column which can show a radio button.

So, I decided to search on google and found few techies have suggesting to use checkbox control instead of a radio button.
I have even found a datagridradiobuttoncolumn on a microsoft site but i don't see it worth because it had shown me a way where each column can have more than one radio button but does not support grouping of the whole datagridview.

So after trying out for quiet sometime i came up with my own solution for this problem. I hope this will workout for better.

There are no big logics and no big references of dlls. Just a plain code and few images in the resources. Does my job.

Check my code and i hope its helpful to you people and let me know if you find any bugs. You can email me at reubenraj@gmail.com

Here is the link for the project. Its developed on .net framework 3.5 VS2008.

Regards,
Reuben.
Developer

Friday, November 23, 2007

Efficient Google search Techniques

Have you ever wondered using few simple Google commands would enhance your search accuracy?? Try out these few sample commands to get even more accurate results.

Basic Boolean
Whenever you search for more than one keyword at a time, Google will search for all of them. If you search for
XML Java “web Services”Google will search for all the words. If you want to specify that either word is acceptable, you put an OR between each item
XML OR Java OR “Web Services”If you want to have definitely one term and one of two or more other terms, you group them with parentheses, like this
XML (Java OR “Web Services”)This query searches for the word “Java” or phrase “Web Services” along with the word “XML.” A stand-in for OR borrowed from the computer programming realm is the (pipe) character, as in
XML (Java “Web Services”)If you want to specify that a query item must not appear in your results, use a -.(minus sign or dash).
XML Java -”Web Services”This will search for pages that contain both the words “XML” and “Java” but not the phrase “Web Services.”

Operators
In addition to the basic AND, OR, and quoted strings, Google offers some rather extensive special syntaxes for honing your searches. Google being a full-text search engine, it indexes entire web pages instead of just titles and descriptions. Additional commands, called special syntaxes, let Google users search specific parts of web pages or specific types of information. Specifying that your query words must appear only in the title or URL of a returned web page is a great way to have your results get very specific without making your keywords themselves too specific.
Here are some of the common keywords that you can add to your query in Google
intitle, allintitle
Restricts your search to the titles of web pages. The variation, allintitle: finds pages wherein all the words specified make up the title of the web page. It’s probably best to avoid the allintitle: variation, because it doesn’t mix well with some of the other syntaxes.
Eg: intitle:”george bush”allintitle:”money supply” economics
inurl, allinurl
Restricts your search to the URLs of web pages. This syntax tends to work well for finding search and help pages, because they tend to be rather regular in composition. An allinurl: variation finds all the words listed in a URL but doesn’t mix well with some other special syntaxes.
Eg: inurl:helpallinurl:search help
intext, allintext
Searches only body text (i.e., ignores link text, URLs, and titles). There’s an allintext: variation, but again, this doesn’t play well with others. While its uses are limited, it’s perfect for finding query words that might be too common in URLs or link titles.
Eg: intext:”yahoo.com”allintext:html
inanchor
Searches for text in a page’s link anchors. A link anchor is the descriptive text of a link. For example, the link anchor in the HTML code O’Reilly and Associates is “O’Reilly and Associates.”
Eg: inanchor:”tom peters”
site
Allows you to narrow your search by either a site or a top-level domain. AltaVista, for example, has two syntaxes for this function (host: and domain:), but Google has only the one.
Eg: site:loc.govsite:thomas.loc.govsite:edusite:nc.usYou can also use site: operator to exclude certain domains from a search
Eg: google -site:google.comThis is particularly useful for ego searches. You can find out all those sites which mention your name expect your site.
Eg: bill gates -site:microsoft.com -site:wikipedia.org
link
Returns a list of pages linking to the specified URL. Enter link:www.google.com and you’ll be returned a list of pages that link to Google. Don’t worry about including the http:// bit; you don’t need it, and, indeed, Google appears to ignore it even if you do put it in. link: works just as well with “deep” URLs-http://www.raelity.org/apps/blosxom/ for instance-as with top-level URLs such as raelity.org.
Eg: link:www.google.com
cache
Finds a copy of the page that Google indexed even if that page is no longer available at its original URL or has since changed its content completely. This is particularly useful for pages that change often. If Google returns a result that appears to have little to do with your query, you’re almost sure to find what you’re looking for in the latest cached version of the page at Google.
Eg: cache:www.yahoo.com
filetype
Searches the suffixes or filename extensions. These are usually, but not necessarily, different file types. I like to make this distinction, because searching for filetype:htm and filetype:html will give you different result counts, even though they’re the same file type. You can even search for different page generators, such as ASP, PHP, CGI, and so forth-presuming the site isn’t hiding them behind redirection and proxying. Google indexes several different Microsoft formats, including: PowerPoint (PPT), Excel (XLS), and Word (DOC).
Eg: homeschooling filetype:pdf“leading economic indicators” filetype:ppt
related
Finds pages that are related to the specified page. Not all pages are related to other pages. This is a good way to find categories of pages; a search for related:google.com would return a variety of search engines, including HotBot, Yahoo!, and Northern Light.
Eg: related:www.yahoo.comrelated:www.cnn.com
info
Provides a page of links to more information about a specified URL. Information includes a link to the URL’s cache, a list of pages that link to that URL, pages that are related to that URL, and pages that contain that URL. Note that this information is dependent on whether Google has indexed that URL or not. If Google hasn’t indexed that URL, information will obviously be more limited.
Eg: info:www.oreilly.cominfo:www.nytimes.com/technology
define
Will get the definition of the term that you have entered. This syntax can be used to get the definitions of words, phrases, and acronyms
Eg: define:dreamingThis query will get you the definition of the word dreaming
numrange
If you want to search for a range of numbers then you can use two dots (without spaces) to represent a range of numbers
Eg: inventions 1850..1899This query will get you all the inventions between 1850 and 1899
safesearch
If you include safesearch: in your query, Google will exclude adult-content.
Eg: safesearch:breastsThis will search for information on breasts without returning adult or pornographic sites.
stocks
If you start your query with stocks:, Google will interpret the rest of the query terms as NYSE, NASDAQ, AMEX, or mutual fund stock ticker symbols, and will open a page showing stock information for the symbols you specify.
Eg: stocks:googThis will show information about Google’s stock. Specify ticker symbols not company names. If you enter an invalid ticker symbol, you’ll be told so and given a link to a page where you can look up a valid ticker symbol.

Do suggest more commands if you know.. bye
mail me at reubenraj@gmail.com

Saturday, November 17, 2007

Saawariya-Jab se tere naina .....

lage re lage re lage re naianwa
lage re lage re..2
Jab se tere naina mere naino se lage re
Jab se tere naina mere naino se lage re
Tab se Deewana Hua aahhaaa
Sab se begaana hua
Rab bhi deewana lage re
ho hohhohho
Jab se tere naina mere naino se lage re
Tab se Deewana Hua aah haaa
Tab se Deewana Hua aaahhaaa
Sab se begaana hua
Rab bhi deewana lage re oye oye
Rab bhi deewana lage re ho hohhohho
Jab se tere naina mere naino se lage re
[Dhin tak Dhin tak dhin tak dhin awesome]
Deewana yeh to deewana lage re
Hooo jab se mila tera ishaara
Tab se jagi hai bechainiya
Jab se hui sargoshiyan
Tab se badhi hai madhossiyan
Jab se jude yaara
Tere mere maan ke dhaage
Tab se deewana hua aahhaaa
Tab se deewana hua aaahhaa
Sab se begaana hua
Rab bhi deewana lage re
Ho jab re hui hai tujhse shararat
Tab se gaya karar ho hoo
jab se tera achal dhala Tab se koi jaadoo chala
Jab se tujhe paaya
Yeh Jiya dhak dhak bhaage re
Tab se deewana Hua aahhaaa
Tab se deewana Hua aahhaaa
Sab se begaana hua
Rab bhi deewana lage re oye oye
Rab bhi deewana lage re ho
hohhohho


do post your corrections if any thanks.. bye for now..
-reuben.

Saturday, November 10, 2007

Widget Bucks

Widget Bucks is paying people $25.00 just for registering with their network and a very good CPC. They also have a referral system where you get paid 10% of the earnings of the people you have referred to them through your referral link.

But remember, if you are not in the above mentioned niche, you may not get that very high click thru rate.

Widget Bucks pays through check or papyal after 45 days of the month end (NET45). So the first earning from them will be payed in the month of December 2007.

Now lets see how much I earn with them directly and how much my affiliates bring my in revenue, which I will know in the first week of November (They update the referral into your account in the first week of next month).

Monday, September 24, 2007

Using COM from Java

Overview:
This article practically describes how COM objects could be utilized in Java. The user should understand and have general programming skills in Java. This article also gives a small introduction of what COM is all about.
What is COM?
COM is a popular object model for creating software applications from independent components. The binary interfaces exposed by COM objects are platform-independent. Therefore, various facets of applications can be written in any COM-compliant language. COM objects also promote encapsulation and object reuse. For example, earlier functionality can be contained in COM wrappers and reused in Microsoft® Windows® Distributed internet Applications Architecture (Windows DNA) and other Web environments.
In simple words:
All the DLL files that are found in System32 folder of in your C:\windows directory resemble COM object model. Example: c:\windows\system32\shdocvw.dll. The “shdocvw.dll” file contains the type library for the Microsoft® Internet Explorer 4.0 COM object model.
This article does not provide information about COM in detail. If you are interested in knowing more about COM the best place is to search Google.
Required Software:

  • Microsoft virtual machine (Microsoft VM)
  • Microsoft SDK for Java 4.0 (Click here To Download)
While installing above said software accept the default settings such as location

Steps for calling COM object in Java:

Step 1:

Setting the “PATH” variable- I assume that you have installed your Microsoft SDK for Java 4.0 at “C:\Program Files\Microsoft SDK for Java4.0”. Right click “My Computer” select Propertiesà Advancedà Click on “Environment Variables”. Another window pops up. Click “New” button if Path is not seen or “Edit” button if Path variable is already available. Type variable name as PATH and variable value as:

“; C:\Program Files\Microsoft SDK for Java 4.0\Bin;” Now click Ok.

Path could also be set using the following command at the command prompt.

C :\> set path=C: \Program Files\Microsoft SDK for Java 4.0\Bin;

Setting “CLASSPATH” variable- The way “PATH” variable is set it’s the same for “CLASSPATH” also. The Variable value would be as:

“.;C:\windows\java\trustlib;”

To set the “CLASSPATH” at the command prompt:

C:\>set classpath=.;c:\windows\java\trustlib;

The above said process (not using Command Prompt) is used to reduce the overhead of specifying the path and classpath every time you compile and run a java program.

Step 2:

Generating Java-Callable Wrappers (JCW) - Java-Callable Wrappers are simple Java objects with additional class file attributes. The Microsoft VM uses Microsoft-defined attributes in Java classes to expose COM objects to Java applications. These attributes are typically generated by the Microsoft Java compiler, jvc, from @com directives in Java source files. The Java representation of COM co-classes and interfaces looks exactly like other Java classes and interfaces, except for the addition of @com directive comments above the class, interface, and method prototypes.

At the command prompt execute the following line:

C :\> jactivex c:\windows\system32\shdocvw.dll

If you encounter any error it’s because “PATH” variable is not properly set. Repeat step1 again if the error says jactivex is not a built in command or something like that.

JACTIVEX command exposes the COM component and generates JCW. A Java-Callable Wrapper just looks like any other java program written into a java file. To view a generated Java-Callable Wrapper check C:\windows\java\trustlib directory. Under shdocvw folder .java files are stored. This folder includes all the interfaces and classes a COM component has exposed.

We need to compile this folder with the generated .java files. To compile the folder containing .java files, Visual Java Compiler (jvc) is used.
Step 3:

Generating Class files of JCWs- The generated JCWs or simply .java files contain @com directives. Do not manipulate or delete them as they are commented. Class IDs are the ones with which the actual COM component is tracked. While generating class files of all these JCWs, care should be taken that these @com directives are also processed. We make use of Visual Java Compiler or jvc command to compile these JCWs. We make use of “/x-” switch to processes @Com directives while compiling these java files using jvc compiler.

At the command prompt execute the following line:

C:\>jvc /x- c:\windows\java\trustlib\shdocvw\*.java

Upon navigating to c:\windows\java\trustlib\shdocvw folder you will find that all the .java files are successfully compiled and .class files are generated.

Repeat step1 and append c:\windows\java\trustlib\shodocvw; to CLASSPATH variable.

Step 4:

Program to access COM object in java- This is a sample program that makes use of generated JCWs to print the URLs of the currently opened Internet Explorer.

/**

*Program can be modified according to your need.

*Author: Reuben

*Dated: Monday, September 24, 2007.

*/

import shdocvw.*;

import com.ms.com.Variant;

public class TryCom {

public TryCom() {

}

public static void main(String args[]){

IShellWindows sh= (IShellWindows) new ShellWindows ();

// Counts number of Windows currently opened.

System.out.println("Windows Currently Opened:"+sh.getCount());

Object tWin=null; //Temporary Window Object

for(int i=0;i

tWin=sh.Item(new Variant(i));

if(tWin instanceof IWebBrowserApp){

//Converting the obtained object into a browser.

IWebBrowser2 IE= (IWebBrowser2)tWin;

System.out.println("Window URL: "+IE.getLocationURL());

}

}

}

}

Save the file in the directory where ever you like to save. Let us Assume to have saved the sample program as TryCom.java at C:\COM directory.
Step 5:

Compiling Sample Program- To compile the sample program we make use of Visual Java Compiler or JVC. Execute the following statement at C:\COM>

C:\COM>jvc /x- /nomessage TryCom.java

Successful compilation would display some version details etc.

Step 6:

Executing Sample Program-JACTIVEX, JVC are the tools provided by Microsoft SDK for Java 4.0. JACTIVEX is used to generate JCWs. JVC is used to compile the generated JCWs or .java files.

To execute the class file of the sample program we make use of another tool provided by Microsoft SDK for Java 4.0. It is JVIEW. This is used in much the same way as java command used to execute normal java programs.

Execute the following statement at C:\COM>

C:\COM>jview TryCom

Windows Currently Opened:2

Window URL: file:///D:/JavaNotes/java_com2.htm

Window URL: file:///C:/WINDOWS/java/trustlib/shdocvw

This would eventually display sample output as shown above
Do write to me more of your ideas, suggestions and feedback.
Email: reubenraj@gmail.com