thefourtheye's weblog

opinions are my own; try code/suggestions at your own risk

Compiling .NET Code in Console Mode and Form Mode With Mono C# Compiler

| Comments

Compiling .NET code with Mono compiler is almost similar to compile with g++/gcc. The basic steps are as follows.

1) Download and install the Mono for your platform from http://www.go-mono.com/mono-downloads/download.html
2) Then write the code (we are going to see how to use c# compiler) with your favorite editor or IDE.
3) Now to compile the code, we simply need to execute a file called mcs under the <installed location of mono>/bin, like this

mcs <filename>.cs -out:<filename>.exe

4) This will compile .cs file specified and produces the executable <filename>.exe

But this compilation would produce only console application. That is whenever you execute the application, a terminal or a command window will be opened automatically. We may need to specify one or two options to ask the compiler to compile in forms mode.

mcs <filename>.cs -out:<filename>.exe -target:winexe -r:System.Windows.Forms.dll -r:System.Drawing.dll

The additional options used in this case are, -target and -r. -target specifies compiler that it has to generate a winexe type of application rather than console. -r option refers to the references. System.Windows.Forms.dll and System.Drawing.dll are the most common references needed when we start building applications with GUI support.

NOTE: We can even build GUI applications in console mode, but the console/terminal window will show up and will not be closed until the application is running.

Google Chrome - Bug in Search Display Box

| Comments

Lately I have been working with Google Chrome, browsing random stuff. All of a sudden found something weird in the browser. I was searching for a word in the page displayed on screen. It searches properly but the index with which it reports the matches has got negative values. (See the attached screenprint) I was keep on trying to reproduce the same, after reopening the browser, but unfortunately I am not successful yet. I think this happens when I am searching in multiple pages at the same time. Browser decrements the value instead of resetting it when the current index is 1, when user clicks on upward arrowed button.

Google Chrome – Search Term Repeats Automatically

| Comments

All of a sudden, my Google Chrome (version 22.0.1229.79 mstarted appending the same search term twice whenever I type in the address bar. I was looking for a way to fix it for long time and got it today.  I believe it is because of the search engine settings (honestly, I don’t know what went wrong). To fix it

  1. Right click anywhere on the address bar in Google Chrome
  2. Select “Edit search engines…”
  3. That might show something similar to this
    image
  4. If Google is the default search engine, move the cursor over any other search engine and click on “Make Default”
  5. Move the cursor over the Google’s entry and you will find a cross mark at the right end. A click on it would remove the entry. Just click on it.
  6. Now in the Other search engines section, type Google in the first two boxes and then type http://www.google.com/search?hl=en&q=%s in the third box and press Enter.
  7. The Google entry would have got added to the default search settings. Make it as the default search engine.

Enjoy Google’s search service :)