Raba - Defend your code RSS 2.0
# Saturday, January 28, 2006

After the last Assembly lesson in "What is the difference between Const and Readonly?" post, many of you praised and asked for more from the ildasm subject, so here it is, a simple question about the assembly behind you code.

What going to happen if you'll try to write this code:

        public string HtmlSnippet
        {
            get
            {
                return m_HtmlSnippet;
            }
            set
            {
                m_HtmlSnippet = value;
            }
        }

        public string get_HtmlSnippet()
        {
            return m_HtmlSnippet;
        }

This one is simple, This is the error message at the compilation:
error CS0111: Class 'Sentence' already defines a member called 'get_HtmlSnippet' with the same parameter types.

Why is it an error?
while converting the C# Code into Assembly the compiler will transfer each property into method!
after all, there are no properties in assemblies.
The format of such transformation will be:
public PropertyType   get_PropertyName(){....}
public void               set_PropertyName(string value){....}

Saturday, January 28, 2006 4:35:52 PM (GMT Standard Time, UTC+00:00)  #    Comments [1] - Trackback
.Net

Lately I found my self playing a lot with the Google search API, I would like to give my criticism about this one:

Cons:

  • Old API as we used to in C (WinAPI) with 8 and even 10 parameters, no overloading.
  • Only 10 results for each query, and they rudely ask for the maximum results wanted?!
    why isn't there any Const with maximum results so people could be aware of this 
    shortcoming.
  • There is no ability to get the page rank.
  • In their snippet result (where you can see intro of the text that found for this page) you
    will find it in HTML format, which I recognize as poor programming, there are thousands of 
    people who would like to see the results in WinForms, save into file or just read the text, why 
    should I make the formatting job (Isn't it all presentation stuff?)
  • Least but not last, documentation for the methods (can be found online only.)

Pros:

  • This is a productive tool for all the programmers out there, which can be easily download, install and use this fairly easy.
  • Written as WebService which help for compatibility.

conclusion:

  • As a programmer who need to search the web, I recommend this tool.
  • As a programmer who wrote this tool I would run fast as I could and fix those Cons, and there is even more from the place they came from.

The Cons talk on their own, Does Google made this API poorly to prevent us from using it, or maybe they not as good as they seem to be.

remarks:
I hope they won't throw me out from their Ranking Servers :).
you can found more data in this article:
http://www.mattcutts.com/blog/feedback-products/

Saturday, January 28, 2006 9:12:03 AM (GMT Standard Time, UTC+00:00)  #    Comments [0] - Trackback
.Net | Software Development

# Tuesday, January 24, 2006

I've found a great peace of code in JavaScript,
the source give us the ability to use String.Format() in our JS code, the same as we do in .Net.
I found this very usefull...

Tuesday, January 24, 2006 8:43:46 PM (GMT Standard Time, UTC+00:00)  #    Comments [0] - Trackback
Scripting Technology

# Saturday, January 21, 2006

There are many people who asking me again and again about this question,
I've finally found some time to write about this and show you simple example for all of you out there so you can't forget this.

As we know (read somewhere but nor really remember) one is runtime and the other compile time...
so here is the code:
public const int IntConstField = 1;
public const string StringConstField = "shani";
public static readonly int IntROField = 1;
public static readonly string StringROField = "shani";

and this the usage:
Console.WriteLine(Class1.IntROField);
Console.WriteLine(Class1.StringROField);
Console.WriteLine(Class1.IntConstField);
Console.WriteLine(Class1.StringConstField);

Isn't It look the same?
so I disassemble this one for you...

IL_000a: ldsfld int32 [TestLib]TestLib.Class1::IntROField
IL_000f: call void [mscorlib]System.Console::WriteLine(int32)
IL_0014: ldsfld string [TestLib]TestLib.Class1::StringROField
IL_0019: call void [mscorlib]System.Console::WriteLine(string)

IL_000a: ldc.i4.1
IL_000b: call void [mscorlib]System.Console::WriteLine(int32)
IL_0010: ldstr "shani"
IL_0015: call void [mscorlib]System.Console::WriteLine(string)

The first four rows show the Readonly, where you can see the ldsfld which is MSIL instruction for pushing the value of a static field into the stack!
The other four rows show the Const, Where you can see ldc,ldstr instead of ldsfld which means that Const doesn't behave like Readonly, Const is very similar to to #define in c, don't have its own location as global, Const is just written as number/string (hard coded) at the compile time.

After we know this simple transformation at the compile time,
we will see an example including two DLLs:

A: hold the const vars.
B: uses A's const vars.
When we made a change at A (changing one of the consts) we can't only compile it and replace the DLL at the bin directory, we should also compile this with the DLL who use it (B in our case).
So it will change also the hard coded numbers!

PI, is a good const, but Unit Number or Dept Number (=180) isn't good enough.

Saturday, January 21, 2006 7:52:17 AM (GMT Standard Time, UTC+00:00)  #    Comments [4] - Trackback
Software Development | .Net

# Monday, January 16, 2006

In my daily work I am writing a GIS (geographic information system) application.
At my place we work for almost three years with ESRI product, which for a long time lead the market by far, although its critical disadvantages such as: performance problems, poor documentation and expensive price.
but, with no real competitors at sight we could do nothing but pay the greens.

I made some background checking about new GIS Tools mainly because of the performance problems but also because of the unsupervised growing prices.

First I found this great Wikipedia link, which show us all the progress in the GIS domain,
and summarize the known GIS tools. 

I would like to point on my favorite tools:
1) GRASS GIS - free tool for develop your own application, open source, run on MS-Windows, Unix and Mac Os, try this at home.

2) Map Cruzin - enter this site and see what you can do with this one,  couldn't find the API link but friend of mine tell me great stories about writing simple code and this is running extremely fast.

3) GeoTools - this one is my favorite, it has all the features you can only dream about.

I'll keep testing those three deeply throw this year, hope to find the best replacement for ESRI.
I would like to hear another point of view from you, thanks.

Monday, January 16, 2006 10:33:11 PM (GMT Standard Time, UTC+00:00)  #    Comments [1] - Trackback
GIS

# Saturday, December 10, 2005

Every one who write queries in Oracle knows that for inserting comma (') into a varchar field you need to double it, which will look like this:

insert into shops(shop_name, description)
values ('Adam''s shop', 'selling bugs for free');

But I've found out this one too (and also found out that there are many of you that don't know this trick)
try to write the query with this special character - &  (And)
Oracle will think that this one is a parameter asking you to insert value.
so I said why not double it too.

update shops
set      shop_name='Lorel&&Hardy'
where  code = 69;

Do not try those tricks at home.

Saturday, December 10, 2005 8:20:08 PM (GMT Standard Time, UTC+00:00)  #    Comments [0] - Trackback
DataBase

I came home last Thursday hopefully finish my little WebService project,
while i opened my project there it was - an error, something about cannot open web pages.
I've tried to open my Consumer Web Application project - same error occurred.
The really strange behavior was while trying to open my COM+  clicking on "my computer" tree node that cause in strange closing window?! no error written.

While surfing the net - i found explanation about how to fix the problem- which include full exhausting description about how to re-install your component services.
so continue goolge up some of my event log errors, and finally I found something that would be good try before starting the component services re-installation.

run those command lines:
regsvr32 oleaut.dll
regsvr32 ole32.dll
afterward, I've tried to enter the COM+ again and it works just fine.
And even my projects are running great (even my undocumented bugs disappear).

I hope it will be helpful for you too, it is worthwhile to attempt this before re-installing the COM+.

A little bit about ICQ - I always have strange problems when my bro install/upgrade versions,
I tell you don't mess with those people.

Saturday, December 10, 2005 8:00:51 PM (GMT Standard Time, UTC+00:00)  #    Comments [0] - Trackback
Life

# Friday, November 18, 2005

Try this CIA place,
There are many rumors about the sources for this site data, probably not really CIA data, but this is a great place to learn a little bit more about places in the world.

The Great think I found out that you can compare between countries/locations attributes/data.

I also appreciate this site as a developer for its simplicity, while you can find a lot of data in many variation.

keep it simple!

Friday, November 18, 2005 11:30:47 PM (GMT Standard Time, UTC+00:00)  #    Comments [3] - Trackback
Life | Software Development

Damn they good.

Google invite you to upgrade your movies search (for free of-course)
using their new Google Video (still in beta) site.

Try searching for "beitar" and find out who is the best team in israel.

Friday, November 18, 2005 10:56:09 PM (GMT Standard Time, UTC+00:00)  #    Comments [0] - Trackback
Life

# Wednesday, November 16, 2005

Last week I was hit by the customer-programmer strange relationship.

Two days before ending the coding session we eventually find out that one of our modules is far-away from the customer expectations.

 

That's of-course not the first time, but again? I was quite sure that this time we did every thing by the book, probably wrong.

 

After I took a day or two for thinking I want to share my thoughts:

 

1) Customer: completely not what I meant, I said that…, we need…

The worst case, nightmare of every Developer/Manger and even Customer, when the customer for the first time(last session of coding or even at the acceptance tests) understand that what he said and the things that were understood (written by the team and signed by him) are completely different.

 

2) Customer: That's good…, yes…, OK… I just want to change the screen instead of all Textboxes to AutoCompleteBox.

That was not written as one of the requirements – of course, why we didn't think about this…

 

I am not gonna answer those questions (I'll provide my point of view in the future)

Also there are a lot of books and other stuff for this.

We can minimize the appearance of the Second and we can almost prevent the First, but shit happens.

 

I'll tell you what really annoying me:

- Finally, we got to the prioritize stage for those new add-ins, and right now the customer start showing you his skills/knowledge in development, what's the problem? I saw that in Hattrick also at Google map so why you wrote 1-week? And that's go on for each feature.

 

From my point of view I've got some advices:

- Don’t spend your time on argue (who was wrong and why), book another meeting for special investigation/conclusion.

- Extending the first sentence, don't miss your main goal! which is to find out what should be done for the next time!

- Understand the Huge Gap between you and your customer. (different terms, expressions)

This will help you both to prevent such incidents.

- Work together but don’t afraid to say what you think, in those special meetings talk about the problems from your point of view but always think about new solutions(for those Gaps).

 

My last advice:

Enjoy your work, this will help you overcome such b(/s)ad days.

Wednesday, November 16, 2005 8:15:56 AM (GMT Standard Time, UTC+00:00)  #    Comments [0] - Trackback
Software Development

# Sunday, October 30, 2005

Yesterday I was in Microsoft Windows Vista Meeting,
and I'll gonna tell you my overview about the new tools they represent there:

1) Windows Vista Better Deployment:
WIM - new file format for images.
XImage - tool for creating such kind of images.
As they represent it there the replacement to others such as: Ghost, MagicIso, Drive Image, etc.
The Highlight is that windows Vista keep in single (Master.WIM) Image the Installation images.
Even when we will install new program (SP, for example) we will Add new Image to our Master single Image.
This will decrease file size, reduce installation time and IMHO, the most significant, it will decrease the needs of stupid guidelines.
WPE/PE - Windows PreInstallation Environment, great tool to configure and diagnose hardware problems(GUI Based). will be used before launching the setup process.

You Can Enjoy the Windows Automated Installation Kit (WAIK).
Inside you can find the XImage.exe, WindowsPE etc.
(I didn't try this, yet!, but as everyone out there said it is a must, at least the two tools above.)

2) Windows Better Protection:
Microsoft Client Protection - new product which will help you protect you computer, network, servers, etc.
This tool provide single solution against threats, viruses, hijacks, malicious code, and spy-wares.
you can download a version for your XP in here:

3) Other Cool Tools:
Microsoft USB Flash Drive Manager - Client Side Application which help you create friendly names to your different flash drives, auto-run feature and also backup feature for your files.
IMHO, it seems useless right now, but it is still cool tool.
Microsoft Location Finder - Client Side Application which find your location using your access points, ISP DNS, Subnet etc.
The funny thing is that when introducing this tool it showed us that we located in Dublin while we where sitting in Israel (blame the proxy).
Again, IMHO, there some people in Microsoft which are very bored, I won't use this.

T2S&S
(Time to shower and sleep)

Sunday, October 30, 2005 11:02:01 PM (GMT Standard Time, UTC+00:00)  #    Comments [0] - Trackback
Microsoft Products

Archive
<January 2006>
SunMonTueWedThuFriSat
25262728293031
1234567
891011121314
15161718192021
22232425262728
2930311234
Disclaimer

Disclaimer
The opinions expressed herein are my own personal opinions and do not represent my employer's view in any way.

© Copyright 2012
Shani Raba
Sign In
Statistics
Total Posts: 145
This Year: 0
This Month: 0
This Week: 0
Comments: 97
Cool Stuff
Add to Technorati Favorites
Themes
Pick a theme:
All Content © 2012, Shani Raba
DasBlog theme 'Business' created by Christoph De Baene (delarou)