29
06
2009
Recently my staff member asked me, “How can I write a Error Free Code?”. hmm.. interesting question.
I always ask them to write a error free code and I found that I don’t have any answer that fit in all situation and in cases. Even the biggest of programmer has done error in their code. So shall we understand a Code cannot be written Error free? Techincally I would say, we can write a Error free code.
But to answer above question, I first like to define an Error.
- If your script runs, and procduce a “SCRIPT SYNTAX” error, that is what I call error.
- If your script runs and halt on some situation that is not properly handle is what I call an error
- If your script runs for one condition but fails for second is what I call an error
But I don’t see an error, if script doesn’t fulfill a business logic, if it was not mentioned at time of writing script. It is not an error, if your script get hacked but to some newly discovered Method of hacking. It is not an error, if your script fail to run on Upgraded server.
Error, in general can be define as anything that goes wrong from ones prespective. But it can have specific definiation as well. You can write an Error free code only, if you apply your knowledge. If anything that is beyond your imagination cause the error is not an error. However you have to decide what is your level? If you have 3 yrs of experince and your script produce an error in say simple Select Query, then ofcourse your level is not yet reached. So, I would say next time one ask that question, should first answer, What is your Level? Are you coding that level of programming. If yes, then you already are writing an ERROR FREE CODE.
Techincally programming is different from commerical Programming, I will try to define that in future. But you have to decide if programming is your passion or profession.
17
06
2009
In recent past, we got few problem when we need to do Pagination with SQL Server. I specially got frustrated when I saw that MySQL server has “limit” word that does pagination work in MySQL in best known manner for me, BUT microsoft didn’t consider that option yet. But today I found a method for SQL server that does the pagination in similar way as MySQL limit works. I am not very sure if it runs on SQL Server 2000 or earlier but it runs on SQL Server 2005. The magic word here is “ROW_NUMBER()” function that provides a Serial No. kind of Numbering to each record. So to do paging all you need to do is, make Query calling ROW_NUMBER() and you are done.
Here is sample of such query
SELECT * FROM
(SELECT ROW_NUMBER()
OVER (ORDER BY EmployeeName) AS Row,
EmployeeId, EmployeeName, Salary
FROM Employees) AS EMP
WHERE Row BETWEEN 2 AND 4
I took this sample and knowledge from a great resources for .NET developer. Website URL is http://www.openwinforms.com/row_number_to_sql_select.html
Hope you like the solution. Any alternative is welcome.
8
06
2009
Every word has it’s meaning. For me Coder and Programmer are two different word for some it maybe same. I always try to get a programmer but the truth is you get most candidates as Coder only. Now what does that mean? In simple word a Programmer can act as coder, but a coder can never be a programmer.
Coder refers to a post where a candidate is good enough in writing your business logic in given only one programming language. For example, a C# coder can write a beautiful C# code, but he cannot code in VB.NET or Javascript or HTML, also this guy cannot visualize complete application. He simple convert your Flow chart in C# code. This is what I called a “CODER”.
Whereas programmer is a intelligent bread. They can think of a Software programmer as a whole, they understand the logic and can write logics by themselves. They don’t need Flow Chart, but they develop one by themselves.
There are very little who become programmer at early start of their career, however I see no techincal reason why there are only few. Our Education system include enough course ware and time for a coder to become programmer at college/university itself. But maybe like other developed Country, India too is getting more dump human that it used to produce. I love technology that is why I am here to build one, but I hate technology as it make Human bread a little more dump then past. Human brain is not evolving with technology, atleast for 90% of world it is true, these 90% people are called as Common man.
19
05
2009
After waiting for 3 yrs with godaddy, finally I get my blog to work as OUT-OF-BOX product. Actually Godaddy now offers PHP on Windows as normal hosting feature. Maybe they learn that PHP was safe on previous version of Windows too. And once they did that I upgrade my hosting to use IIS 7.0 on godaddy and now my blog is working fine.
Why I am so happy? well to run my blog before, I need to modify some of Wordpress code as I posted in one of my blog post. Which limit me to upgrade to Latest wordpress release as I am too lazy to transfer those changes to new version of wordpress. But now since I can use out of box product I can use latest version of wordpress with ease. Thanks Godaddy, though I love if you take that step before, but never mind ;).
5
05
2009
Today while surfing internet I found a Mathematical Prove of 4 = 5. Here is the solution I found for it.
let
- 20 = - 20
which can be written as
=> 16-36 = 25-45
by adding (81/4) on both sides we get
=> 16-36+(81/4) = 25-45+(81/4)
by writing the above eqn like this
=> ((4)2 -(2*4*(9/2)) +(9/2)2) = ((5)2 -(2*5*(9/2)) +(9/2)2)
which is of the form
=> (a-b)2 = a2 + b2 -2ab
here
=> a = 4 a = 5
b = 9/2 b = 9/2
from this we can write the above equation as
=> (4-(9/2)) 2 = (5-(9/2))2
by taking square root on both sides we get
=> +- (4-(9/2)) = +- (5-(9/2))
according to axioms when both sides are equal and having the same signs on both sides then both sides are positively equated to each other
=> 4 - (9/2) = 5 - (9/2)
by shifting -(9/2) from left side to right side we get
=> 4 = 5 - (9/2) +(9/2)
then as 9/2 gets cancelled we get
=> 4 = 5
 To my knowledge of math this formula is incorrect. Wonder why?
Well the formula derivation reads, -20 = -20 implies 16-36 = 25-45, per mathematics rules, we need to solve problem not “reverse engineer” it. So -20 = -20 never implies 16-36 = 25-45. This “trick” is used quite a lot in application. Logically the derviation seems correct, but not mathematically. But in all it is nice trick. Good work whomsoever have found that.
23
04
2009
Recently I worked on few website, that were solely made up in flash. These sites looks good, a background music playing, pages change with some animation. Obviously HTML page cannot look better then flash. I was very excited to work on this website. But soon my excitement goes away, when I have to fix the programming error done by designer.
It was sometime really hard to explain clients that designer is not a programmer. This is what happen in project I am working right now. Client reach a Flash animator and ask him to make website, and put image gallery, music gallery, event gallery all through XML. Designer has read some XML reading code from Search engine, and copy paste those code without understanding the use or it. And now I have to fix all those issues, you can understand the mess by following example.
In main menu I have a about 7 menu buttons, now client ask me to put Authentication one section, so my obvious choice is to put check on button click so when user click that button we check authentication. and to make that one Button click capture I have to make changes to atleast 10 buttons, as designer use lot of Keyframes, and movieclip per different situtations.
Hope if some client read this article he understand that you should contact a team if you want to flash website, Only a Programmer or Only a Designer cannot make good flash website.
27
03
2009
Just surfing around to see latest web technology. Currently the war on Web Browser is looking good, all new versions and benchmarking and things. Few techincal users give their opinion, few not so techincal read xyz article and gives experts comments. I love to become part of that and want to give my comments too.
Just over 6 months ago we launched our web browser, Google Chrome. Since then, we’ve pushed 29 updates, each working to improve Google Chrome’s speed, stability, and usability.
This line was picked from Hello world Chrome Blog post. Wow, did you see that 29 updates.. 5 update per month, and people at Google says Microsoft makes bad product. I never saw that many updates for IE, remember, IE 6 rules for more than 5-6 yrs along and people are happy using it until Firefox reach version 3.
Frankly speaking, I work on website development and I never feel any browser is bad. I surf all website with similar speed. I am not Computer Processor, that knows the difference between 5 milliseconds, what I see if end pages shows us within 1-2 seconds I click a link or something, and it is pretty much good for me.
I will say a browser is good, if it post my 100 MB file in 2 minutes irrespective of my internet connection speed, if they cannot, it really doesn’t matter much.
Hope you agree with me? So, I would say make a better software but don’t compare with other company product, that make you better.