Raba - Defend your code RSS 2.0
# Thursday, May 25, 2006

I had a strange problem trying to use the SQL Server 2005 Express, (this is the built in DB that come with the VS2005 installation).

The Problem & MS solution:
I need to install on my laptop a local DB, but I don't want to install the full version of SQL Server 2005. Microsoft gave us a great tool which you already installed in your VS2005 installation the: SQL Server 2005 Express.

There are still things to fix:
There is only one problem with this cool tool, you cannot connect to this DB, create new one or even do something useful with this tool.

So you are trying the first idea on your mind, in VS server explorer -> add new DB, choosing you compute name as the Server Name(in combo box, it is already there so it must work, isn't it?).

FirstImage.JPG
Only one server-name for you man!

Giving meaningful, descriptive name to your DB (e.g. DB1).

SecondImage.JPG
New DB name is now available

But you can't, it won't recognize the SQL Server 2005 Express.

My Solution:
In the Server name you will have to write: .\SQLExpress.
Everything else that I've tried failed, such as: MyCompuerName, SQLExpress, local.

Try it yourself.

Thursday, May 25, 2006 11:51:31 PM (GMT Daylight Time, UTC+01:00)  #    Comments [0] - Trackback
SQL Server 2005 | DataBase

# Tuesday, May 23, 2006

Last Wednesday I had the pleasure to be in the C#/C++ user group at Microsoft.

Oren Ellenbogen, for the first time as a presenter, gave us some tips/samples, new tools and a great show about generics&delegates.

Why the lecture was so good?
1. The simplicity of the PPT:
It has the exact amount of data for keep yourself concentrate at the main issue: the samples.
Some great pictures to wake the sleepy programmers.

2. Oren did a great job with the examples:
Three different ideas that consistently repeated in different ways, help you concentrate and see the cost vs. benefit of the main pattern.

3. Live refactoring for proving your benefits and giving a short summarize about what we've learned.

4. As a dessert, two awesome libraries extending the concept of generics&delegates.

There are still some things to be fixed (or, Tips for your next lecture):
1) People like to ask questions, sometimes because they don't listen, sometimes because they want to prove that they are wiser than the pope and sometimes because they curious and hungry for new information.
As a lecturer you should know when to answer and when to cut it off, of course do it, always, with your charmy smile.

2) When he showed his first samples (which was on purpose long&clumsy) the crowd start staring and asking questions. When you are showing a process (walking step by step) of something you should say it, because people can't read your mind and they start thinking: oh, this code is even worse and they continue with: why do I came to this lecture, where is my wife right now and why the code I wrote today didn't compile.

Oren: I am waiting to hear you next time, it was really great, informative and productive.
To all my readers: pay attention to this guy because he has extremely precious ideas, and he knows a lot of tricks that you can't even dream about them.

Oren already put the presentation & code samples in his weblog, take a look...
He also promised to put the movie, so you could enjoy it too.

Updated:
Here are two other posts talking about the lecture: Roy Osherove & Ken Egozi
BTW, I saw that Roy put link to my blog in his Israeli .Net bloggers section, it is a great honor to be on this list. Thanks. 

Tuesday, May 23, 2006 11:24:23 PM (GMT Daylight Time, UTC+01:00)  #    Comments [2] - Trackback
.Net 2.0

# Sunday, May 14, 2006

History
In our application we created a special (user friendly) window for showing messages to the user. The window will get its data, text, buttons through the args parameter.

We will open this window using the messageBox function (this method lies in one of our JS files).

Challenge
Everyone knows the annoying default alert of ValidationSummary in ASP.NET.
Our messageBox still couldn't rid from the alert that the WebUIValidation.js is popping up on validation error.
Why? Because in this JS, Microsoft simply write alert(msg).

Solution
Today we wrote those simple lines:

window.alert = function specailAlert(msg) {
   messageBox("title", msg, button_ok, info_icon);
}

This will cause the JS parser to call our function any time the origin window.alert is running. So from now on, when the ValidationSummary will write alert("some useful message"), our method will replace the ugly gray box with our user friendly window.

 

Sunday, May 14, 2006 8:54:57 PM (GMT Daylight Time, UTC+01:00)  #    Comments [1] - Trackback
.Net | Scripting Technology

# Saturday, May 13, 2006
Other Pictures and some useful links...
Saturday, May 13, 2006 12:13:18 PM (GMT Daylight Time, UTC+01:00)  #    Comments [0] - Trackback
Life | Microsoft Products | My Site

Here are some pictures from the Tech-Ed party...
Saturday, May 13, 2006 11:05:34 AM (GMT Daylight Time, UTC+01:00)  #    Comments [0] - Trackback
Life

# Friday, May 12, 2006

What a programmer need more than sun, pretty women, good food and great lecturer talking about the great new features in vista, IE7, .net 2005, C# 3.0 and Orcas.

The Cocktail party at the first night was a great beginning for the real thing THE (Microsoft)party, I slept only 3 hours at every night.

Right now I need a drink or two, so I am going out for a party, when I'll come back I'll post here some pictures and impressions from the new Microsoft tools.

BTW,
I would like to thank to my team leader, Avi, which gave me the opportunity to be there, thanks again.

Friday, May 12, 2006 8:28:17 PM (GMT Daylight Time, UTC+01:00)  #    Comments [0] - Trackback
Life | Microsoft Products

In one of my code reviews I saw this piece of code (those two methods are in the same class), IMO, and I believe that most of you will agree with me, this usage of exception is unnecessary.

private void CheckPrivileges()
{
   // check user privileges
   // for authorized user won't do anything.

   // if not authorized:
   throw new UserNotPrivException("user name", "action not allowed");
}

public void DoSomething()
{
   try
   {
      CheckPrivileges();
      // Continue your logic for authorized users.

   }
   catch (UserNotPrivException)
   {
      // showing message box which
      // says that user has no permissions
      ShowMessageBox ("User X has no privileges for this place.");
   }
}

Why ? 

  1. The Exception mechanism is slow
  2. A lot try&catch makes the code harder to read
  3. Why throw exception if you won't use it? and also throwing it between two methods in the same class?

I would have done it like this:

private bool IsUserPrivileged()
{
   // check user privileges
   // for authorized user - return true
   // if not authorized - return false
}

public void DoSomething()
{
   if (!IsUserPrivileged())
   {
      // showing message box which
      // says that user has no permissions
      ShowMessageBox("User X has no privileges for this place.");
      return;
   }

   // Continue your logic for authorized users
}

If you want to check between those two (privileged or not) you can use the bool.
Moreover, when you are not really need the exception data.

Honestly,
I wrote this post before Tech-Ed, but didn't have enough time to publish it, in Tech-Ed, I talked with some other programmers that agreed with my opinion, but I still would like to hear your opinion,
what do you think about it?

Friday, May 12, 2006 11:10:06 AM (GMT Daylight Time, UTC+01:00)  #    Comments [5] - Trackback
.Net | Software Development

# Saturday, April 29, 2006

A few days ago I start thinking about a new way to control our web site window size.
In our site there is a main window which hold the most important data. For editing the data or view more data: you can choose your subject in the menu and it will open a new page with the full details.

The common sense says that the window should set its own width/height for best fit, with minimum scrolling, but the reality isn't that simple because this page can open either as a regular window or as a modal window and the parameters are different. There is another problem, changing the window size in run-time (in the body) is very ugly (you can see the window re-sizing itself).

The other way is working with JavaScript file which holds the windows parameters and the opener will use this parameters for opening the wanted page. The good thing in this idea is that the menu will know all the sizes and open the windows in the wanted size (the one defined at the JS file). But here we have another problem that Server files (.cs) that writing JavaScript (from server) should know this JS file and the names of the parameters, can cause broken links. also, links to my site that sent via email won't open in the wanted size.

another idea is to use XML for server and at the first time (application) create dynamically the JS file with the parameters, still can cause broken links from (html or other JS) and this can cause a strange problem because we are connecting our files to JS file that is not created yet, I know it will work because it is happening on run-time, but it is still strange. In here we still have the problem for links to my site that sent via mail.

For the mail issue, lets say that every link should go first to my main page, and only their the main window will open the wanted page for you, so we can set the window size via the main window.

I am searching for other implementations to the JavaScript file that holds the sizes for all windows.
Is there a better way for doing this?

Saturday, April 29, 2006 2:50:31 PM (GMT Daylight Time, UTC+01:00)  #    Comments [0] - Trackback
.Net | Scripting Technology | Software Development

I've wrote a huge article about my last two months at work, this article should be the GIS bible for beginners, but when I submit the article, it redirected me to an access denied page, cannot track my post and cannot go back to find my article.

don't worry I'll write this again, but probably in small chunks.

Saturday, April 29, 2006 12:26:58 PM (GMT Daylight Time, UTC+01:00)  #    Comments [4] - Trackback
GIS | My Site

Have you ever found your self looking at a site and trying to learn from their JavaScript or HTML?
most of the time is written without indentation at all, there are some sites that also rendering their JavaScript/HTML in one line.

So I found this great site for indenting to your standards:
http://www.prettyprinter.de/index.php

Saturday, April 29, 2006 12:16:28 PM (GMT Daylight Time, UTC+01:00)  #    Comments [0] - Trackback
Scripting Technology

That was the most tedious 2 months I've ever had and damn I love my life.
First of all, I would like to thank to all of you that look for me and send me those lovely emails.
Second, I should explain those two months, I've finished my first semester of first year (MSc. in Computer Science), I had my exams (the grades are pretty well, thanks for asking), I've also worked on a big project about searching the web using Text Mining, that was very interesting.
While I was writing my project (.Net of course) I've started my second semester and I was flooded by new homeworks in Algorithms and Computer networks, and it never stops, so I am a bit busy this year.
Lastly, At Job, we've start checking out the coolest thing ever, GIS Server (comprehensive platform for delivering enterprise geographical information systems), I would write on it further more at my next posts. The great thing is that we are pioneers of this tool in Israel, and even around the world there is a very little knowledge.

So, I am back,  stay tuned.

Saturday, April 29, 2006 8:13:25 AM (GMT Daylight Time, UTC+01:00)  #    Comments [3] - Trackback
Life | My Site

# 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

Archive
<May 2006>
SunMonTueWedThuFriSat
30123456
78910111213
14151617181920
21222324252627
28293031123
45678910
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)