Raba - Defend your code RSS 2.0
# Saturday, March 04, 2006

A dear friend of mine, Pasha Bitz, is suffering from a strange behavior of unwanted comments,
I couldn't find yet the source for this strange-meaningless-comments but what I did found out is that Pasha doesn't use the captcha component for preventing malicious robots hurting your site.

Here is an example for this robot's work.

I hope I'll find this robot and hack it down.

Saturday, March 04, 2006 11:11:39 AM (GMT Standard Time, UTC+00:00)  #    Comments [1] - Trackback
Life | My Site

# Friday, March 03, 2006

Finally I've got importance ranking by Google (2/10).
You can see this in your Google Toolbar.

I've tried almost everything, but my main advice to you is to be patient.

Thanks Google.

Friday, March 03, 2006 3:10:42 PM (GMT Standard Time, UTC+00:00)  #    Comments [0] - Trackback
My Site

# Tuesday, February 28, 2006

While reviewing Yossi (new teammate) code I've seen something strange, it looks almost like this:

 

  string formatStr;
  formatStr
= String.Format("Hello {0}",name);

 

I ask him for explanation and he gave a wonderful story which almost convinces me that this one isn't so bad, it sounds like this:

·         This is better than concatenate two immutable strings

·         This is more readable.

So I thought for a second and changed the code to look like this:

 

   string concatStr = "Hello " name;

 

But he insists that this one is bad, concatenate immutable strings.

So here is my simple explanation:

1.       With human-readability I won't argue, it is (sometimes) very individual.

2.       My code isn't about concatenating it is about init strings and for that main reason the compiler would change this code to one large string (known at compile time). (You can see the Ildasm).

String.Format implementation remark:

·         Be careful, while calling string.Format it creates StringBuilder and do its stuff - do you really want it?

I know that most of you screaming out loud (waaaa.... or just saying: OK and what with 10 or even more concatenation)
you probably wrote script generation which look like this:

 

public string WriteHtmlMessage()
{
   
return "<div>" +
           
"I would like to add <b>" + name + "</b>" +
           
"<br/>" +
           
"to my team as a <b>" + job + "</b>" +
         
"</div>";
}

 

And yes this is an init statement so it is better (performance reasons) writing it like this then using String.Format or even StringBuilder.
Even if the compiler will use the Concat method it will be used with the array parameter which is still better than creating String.Builder.
Why is it better?
Because the size of the array is known at compile time.

Conclusion,

·         The compiler will translate the init concatenation to a long string (like my first example) when all the strings are known at compile time (the parameter was const).

·         The compiler will use concat method (with arraylist, not the poor pairs concat) when the number of strings are known at compile time (last example).

In both examples this concat is actually faster than StringBuilder or String.Format.

So, next time when you concatenate specific (known) strings do it in the same init instruction.

Tuesday, February 28, 2006 11:09:10 AM (GMT Standard Time, UTC+00:00)  #    Comments [2] - Trackback
.Net

# Monday, February 13, 2006

There is a time in every persons life when he needs to read a file which has the *.ps extension.
Most of the people I know download the useless programs: AFPL GhostScript and the GSView just to read or edit the cursed *.ps file.

I hate downloading programs which I am gonna use once in a life time (even 10 times drives me crazy).

From now on convert your files online through this website.
All you need to do:

  1. Upload the ps file
  2. press convert
  3. download the new pdf file.

enjoy reading.

Monday, February 13, 2006 12:02:29 AM (GMT Standard Time, UTC+00:00)  #    Comments [0] - Trackback
Life

# Thursday, February 09, 2006

Last week Avi (my team leader) and I were in a meeting with Systematics the representatives of ESRI in Israel.
We ought to ask some questions about the GIS Server, and I will bring here some of the answers we've got:

  1. The GIS Server 9.1 won't work with the SDE 8.3
  2. The ADF(Application Development Framework) for .Net will help us to develop GIS applications more productively (using my favorite drag&drop action).
  3. While the ADF is very useful it is also very simple, most of the wanted features you would have to program by yourself, such as saving the maps history, calculate the distance between two (or more) points which are not in the same extent. (those two examples were implemented in our systems today and won't be provided in the ADF Controls functionality)
  4. The ADF.Net won't work with the .NET2.0, we should wait for the next release.
  5. The GIS Server based on the ArcObject model, which give you more functionality (the same as we have in the client) such as editing.
    No more activeXConnector problems.
  6. The performance in the GIS Server is not better than the ArcIms, which are both very slow (you can see it in the examples below)

Here are some demonstrations of the products:

  • An example of caching your maps,
    I loved the idea of using the cached maps (My Maps) on the right.
  • Simple example of tool tips on map (this one is damn slow, while we have only 4 layers).

   Those two still suffer from the known issues of bad performance, 
   even when they are only small projects.

Thursday, February 09, 2006 4:47:04 PM (GMT Standard Time, UTC+00:00)  #    Comments [2] - Trackback
.Net | GIS

# Thursday, February 02, 2006

I've added my Human-Debugger icon to my main page
so from now on - you can see the HD Icon on the left hand of your address bar and in your favorites.

All you need to do to enjoy my icon:

  1. Add my main page: the www.human-debugger.net to your favorites.
  2. I recommend to close the browser and re-open it (some of the browsers need this one for
    showing the icon).
  3. Browse to your favorites and view the link to my page. (it is already showing the new icon)
  4. Browse to the link and that's all - you can see the icon in your browser address bar.

Enjoy my new icon.

Thursday, February 02, 2006 9:03:04 PM (GMT Standard Time, UTC+00:00)  #    Comments [0] - Trackback
My Site

# Sunday, January 29, 2006
Today, while I was sitting with Matan, a new programmer at our team, for a code review - I saw one of the worst practices that each new programmer and even experienced programmers are dealing with during their coding/reading in .Net, the Exception rethrow mechanism. I would like to show here two code examples for best and worst practices:
Sunday, January 29, 2006 11:44:02 PM (GMT Standard Time, UTC+00:00)  #    Comments [0] - Trackback
.Net

At my Team we work on different applications simultaneously, each application live in a separate solution.
The common denominator between those different solutions is one solution which hold some WebControls, scripts (for the web controls) and some other methods which serve the BL and Dal.

I am gonna talk about the WebControls and their scripts.
As you can understand, each application (solution) holds a reference to the WebControls DLL, but What are we going to do with the scripts? 
I prefer to write a pre-build event script which will deploy (simple XCopy) the scripts to the Inetpub and than each application could use those controls without copy the scripts to their private directory hierarchy.

Yesterday we start using another Solution, IEWebControls (which most of you probably know their controls such as tabstrip, treeview etc.), while installing the IEWebControls it will create a directory on your computer and after running their build script it will copy the scripts into the Inetpub.

We made a discussion about how we should use the the DLL and the scripts so all the programmers could make a simple get from the VSS, and every one could use those WebControls, there are two different opinions:
1) each programmer should make his get (only for the scripts) from the source-safe into the Inetpub directory (the references to the DLL is already exist in the relevant solutions).
2) each programmer should get the full solution and make a build, the build will cause the XCopy for the relevant scripts to the exact directory.

I prefer the second, because it will be exactly like our WebControls solution which I describe earlier,
also it will be similar to regular deploy to our the servers, finally I think that this is the right logic for all changes (if exist - DLL/scripts) to take place at one click (build).

I would like to hear your suggestions, What do you think about my preferred way.

Sunday, January 29, 2006 9:59:17 PM (GMT Standard Time, UTC+00:00)  #    Comments [0] - Trackback
VSS

# 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

Archive
<March 2006>
SunMonTueWedThuFriSat
2627281234
567891011
12131415161718
19202122232425
2627282930311
2345678
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)