Friday, May 23, 2008

Code review

I just had to code review a project i have never seen before.
The result has to be a Word document, it's nice if it is not only one page :)

I copy - pasted a checklist from an other document, with questions like:
"Is the code easy to read easy to understand?"
"Is the code properly commented?"
etc.
etc.

Then I tried to find stuff that I didn't consider ok to be there.
I found a few stuff ... code (variables, functions) that was declared over and over again, instead of using one public instance.
Yeah. I know. And it is boring too.

Have you ever done anything like this before?
Do you have any ideas how to make something like this?

Basically the main idea is this:
The client would like to have an "outsider"-s review of the code (because of course the ones that are building the project - they think it's perfect).
The client will probably not understand a thing of it, but it will probably have a clue about what's what.

Tell me if you have something like a checklist, or a list with common mistakes.
I'd like to see new things sometimes.

Monday, April 21, 2008

SQL server 2005 - generate scripts. Can i do this faster?

i am preparing scripts from DEV server, to an other environment.
step 1. script all the objects (drop script)
- 1.1. right click on tasks > select "Generate script"
- 1.2. select database click next
- 1.3. script behaviour: "Generate DROP statements only." also select
false for all the table/view options from bottom side, click Next
- 1.4. select stored procedures, user defined functions, views (this
way i won't forget any of them ... might have been modified by other
developer). click next
- 1.5. click "Select All", then Next (sps)
- 1.6. click "Select All", then Next (func)
- 1.7. click "Select All", then Next (views)
- 1.8. select script to file (any other option would be ok), change
file name to "drop scripts.sql" ? (doesn't matter) and click next
- 1.9. click finish
- 1.10 WAIT a LOT :)
then comes step 2 (2.1 - 2.10) with the only difference that at step
2.3. i'll select "Generate CREATE statements only."

i'll have 2 scripts.
in sql 2000 it was easier.

and now, the question:
can i make this somehow faster?
is there a script I could run and have the same result ...
or is there at least a way to have drop AND create-s generate all in
the same time?

I'll post an answer when i find a good one.

If you can help, just comment here pls.

Thanks

Wednesday, April 16, 2008

GridView Id column

If I make a "BoundColumn" for the Id, with visible - false, I can't get the Id ...

This one works:
(rowdatabound)




e.Row.Cells["mycolumn"].Style.Add("display", "none");




this way the Id is still there, you just cannot see it...

Gridview rowcount from Js

I needed to get some rowcont in a Js variable, to have a google-like "select all" (all from all pages) button, that i didn't want to show up if there is only one page in my gridview.

Radu helped me out with this idea:
(I am using this on rowDataBound, because I didn't want to use an other event, I already had this one ...)




ScriptManager.RegisterClientScriptBlock(grvAgentCommissionFeePercentage, this.GetType(), "ScriptIDAndTicksForRefreshnumber" + DateTime.Now.Ticks.ToString(), "multiplePages = " + grvAgentCommissionFeePercentage.PageCount.ToString() + ";", true);




if you need the whole nine yards, just comment ... i'll get back to you

Thursday, April 10, 2008

Programming Languages and their Celebrity Equivalents

I found this "article" and i think it is very funny
:)

click here

Friday, April 4, 2008

Could not load file or assembly AjaxControlToolkit

I had this error today, after I installed my app on a server (wix installer btw)

what did i do?
googled :)
and then ...

delete all the data from
C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\"my prj"\

and reinstalled the app

it worked

Thursday, April 3, 2008

Javascript - properties for any HTML object

Sometimes you need to see what properties can you use for any given object.
Just copy-paste this:



var stuff = '';
for (p in document.Form1.elements)
stuff = stuff + ' ' + p;
alert(stuff);



( ... and replace the document.form1.elements with anything you'd like. For example document.body, or document.getElementById("someTDfromYourTable"), etc. ...)