I liked Network World’s 12 words you can never say in the office, though I have to admit I have no idea what an RBOC is. I’m glad ASP is put to rest. It used to be so embarrassing when I’d say I was using ASP (predecessor to ASP.Net) and someone would ask ” you mean like application hosting?”.
August 25, 2009
June 2, 2009
How To Write Unmaintainable Code
Obscure film references
Use constant names like LancelotsFavouriteColour instead of blue and assign it hex value of $0204FB. The color looks identical to pure blue on the screen, and a maintenance programmer would have to work out 0204FB (or use some graphic tool) to know what it looks like. Only someone intimately familiar with Monty Python and the Holy Grail would know that Lancelot’s favorite color was blue. If a maintenance programmer can’t quote entire Monty Python movies from memory, he or she has no business being a programmer.
http://freeworld.thc.org/root/phun/unmaintain.html?repost=forPosterity
April 10, 2009
Transportable Regular Expressions
Great entry on Regular expressions at Technical Interview Patterns.
Probably the most popular interview question on regular expressions:
Question #1: Write RegEx which would extract all anchor text from HTML page
Answer:
<a.[^>]*?>(.[^>]*?)</a>
March 31, 2009
ASP.Net Interview Q’s
<!–[if !mso]> <! st1\:*{behavior:url(#ieooui) } –>
Taken from TechSvr Blog
Is it possible to debug JavaScript in .NET IDE? If yes, how?
Ans. Yes, simply write “debugger” statement at the point where the breakpoint needs to be set within the JavaScript code and also enable JavaScript debugging in the browser property settings.
How many ways can we maintain the state of a page?
Ans. 1. Client Side – Query string, hidden variables, ViewState, cookies
2. Server side – application, cache, context, session, database
What is the use of Singleton pattern?
Ans. A Singleton pattern is used to make sure that only one instance of a class exists.
What is an .ashx file?
Ans. It is a web handler file that produces output to be consumed by an xml consumer client (rather than a browser).
What is encapsulation?
Ans. Encapsulation is the process of hiding all of the details of an object that do not contribute to its essential characteristics.
What is a Delegate?
Ans. A delegate is a strongly typed function pointer object that encapsulates a reference to a method, and so the function that needs to be invoked may be called at runtime.
What is the base class of all web forms?
Ans. System.Web.UI.Page
How to add a client side event to a server control?
Ans. BtnSubmit.Attributes.Add(“onclick”,”javascript:fnSomeFunctionInJavascript()”);
How to register a client side script from code-behind?
Ans. Use the Page.RegisterClientScriptBlock method in the server side code to register the script that may be built using a StringBuilder.
Can we put a break statement in a finally block?
Ans. The finally block cannot have the break, continue, return and goto statements.
How to instruct the garbage collector to collect unreferenced data?
Ans. We may call the garbage collector to collect unreferenced data by executing the System.GC.Collect() method.
What are Partial Classes in Asp.Net 2.0?
Ans. In .NET 2.0, a class definition may be split into multiple physical files but partial classes do not make any difference to the compiler as during compile time, the compiler groups all the partial classes and treats them as a single class.
What is Boxing and Unboxing?
Ans. Boxing is the process where any value type can be implicitly converted to a reference type object while Unboxing is the opposite of boxing process where the reference type is converted to a value type.
What does AddressOf in VB.NET operator do?
Ans. The AddressOf operator is used in VB.NET to create a delegate object to a method in order to point to it.
What is XmlHttpRequest in Ajax?
Ans. It is an object in JavaScript that allows the browser to communicate to a web server asynchronously without making a postback.
What does the virtual keyword in C# mean?
Ans. The virtual keyword signifies that the method and property may be overridden.
How to create a new unique ID for a control?
Ans. ControlName.ID = “ControlName” + Guid.NewGuid().ToString(); //Make use of the Guid class
What is the use of the dispose() method in .NET?
Ans. The Dispose method in .NET belongs to IDisposable interface and it is best used to release unmanaged objects like File objects, Windows API objects, Database connection objects, COM objects etc from the memory. Its performance is better than the finalize() method.
What is the difference between a session object and an application object?
Ans. A session object can persist information between HTTP requests for a particular user, whereas an application object can be used globally for all the users.
Controls in order of has performance, DataGrid, Repeater, DataList?
Ans. Repeater, Datalist, DataGrid.
Is it possible to perform forms authentication with cookies disabled on a browser?
Ans. No, it is not possible.
What is difference between dataset and datareader in ADO.NET?
Ans. A DataReader provides a forward-only and read-only access to data, while the DataSet object can carry more than one table and at the same time hold the relationships between the tables. Also note that a DataReader is used in a connected architecture whereas a Dataset is used in a disconnected architecture.
March 12, 2009
Notes – Headhunter Trade Secrets for Finding a New Job During a Recession
From Stephen Viscusi’s blog entry Headhunter Trade Secrets for Finding a New Job During a Recession:
It’s important to humanize who you are…have your boss know you as “a person,” not just an employee.
It is easier to fire an employee who you know nothing about personally, or who you can’t relate to as a person.
“Bulletproofing” yourself requires being a bit Mommy and a bit Machiavelli.
If your boss does approach you about letting you go, and they always use these same line, “It’s not personal, it is a numbers thing,” you should definitely call his/her bluff! Ask your boss, “What’s the numbers thing, boss? What is the number?” Tell your boss that you’re willing to take a pay cut of 20 percent less for a year, or you’ll work three days instead of five…It really works!
Employers hire people who they like personally, and they fire people they don’t know or don’t like, regardless of performance. During a recession, they can get away with this.
January 28, 2009
Building AgiliTrain: Part 1 – Why ASP.NET MVC
Shawn Wildermuth recently wrote about his work with ASP.Net MVC. I’ve heard promising things about it, and listed are some of his points.
- How I would characterize my experience with ASP.Net MVC… two weeks of a steep learning curve then bliss.
- The big [fear] … is loss of ViewState. I was never a fan of ViewState and was always perplexed that most projects used WebControls and not nearly enough HtmlControls. HTTP is stateless so in many many situations remaining stateless makes more sense. Since the HTML controls were lighter weight I tended to use them much more often. That certainly makes my move to MVC easier as I am not bogged down by the loss of ViewState.
- MVC allows you to write code more like the web. This means doing a lot of AJAX and using jQuery (or Dojo, or whatever you want) as your UI layer.
- Since I was presenting information that is changing somewhat rapidly that I could develop it faster with ASP.Net MVC. Not faster in the initial implementation (because I had to learn MVC) but faster to add new functionality as it required it. I am not positive this is true but in the last few days I’ve been able to add new pieces of functionality to the site pretty easily. It feels a lot more modular than my other sites.
- The MVC code was mostly clean HTML (no magic ClientID’s or controls) so that integrating was simple.
November 3, 2008
Failing Project Checklist
This was posted on cio.com as How to Turn a Failing Project Around? A check list. It’s really not a how-to, more of a what-to-determine.
Of course, the real question to ask is do I want to attempt the turn-around, do I want to stay at a company that is experiencing failing projects, and why am I being given this “opportunity”.
How to Turn a Failing Project Around?
Have you ever been asked to takeover a failing project? The reasons for a project going to “code red” are numerous, but can usually be classified into seven areas:
1-Lack of crisp requirements
2-Insufficient resources
3-Unrealistic time-line
4-Lack of a clear business case
5-Poor project planning and/or inexperienced project leadership
6-Technical and/or process issues
7-Lukewarm project sponsorship – insufficient authority for the project leader
When taking over a project at risk, the first thing one can do is ask these questions:
-How compelling is the business case for the project?
-Do you have clear requirements?
-Is there a project plan, and is it up-to-date?
-Is there a change control process in place?
-Is the project’s status reporting reliable and transparent?
-Is the project sponsor supportive and effective?
-What are the top customer’s concerns?
-What is the project’s financial situation?
-Is the project on schedule or not?
Equipped with answers to these questions, the next step is to address these six areas:
1-The Project team:
a.Take inventory of teams’ strengths and weaknesses
b.Address resource sufficiency issues
c.Address morale issues – make resource changes if necessary
d.Create a sense of urgency (how does this project impact the company and the team?)
2-Customer
a.Manage customer expectations, refuse to be treated like a punching bag
b.Insist on dealing with the decision maker(s)
c.Insist on being given the authority to act. and the resources to succeed
d.Present the solution quickly (within 1-2 weeks)
e.Schedule short summary meetings for each day with the customer
f.Communicate success and challenges with high degree of transparency
3-Technology
a.Address any infrastructure problems
b.Address software and tools needs
c.Resolve implementation and logistical issues
4-Project:
a.Re-establish and assert control over the project
b.Tighten up the requirements
c.Update the project plan and act accordingly
d.Implement a change management process
e.Start project reporting immediately
f.Re-work the project plan and WBS into smaller chunks
g.Aim for quick wins to build credibility
5-Financial:
a.If the project is over budget, secure additional funds, or reduce scope, or increase time to completion
6-Operation:
a.Address logistical barriers
September 15, 2008
18 ways to improve your body language
1. Don’t cross your arms or legs
2. Have eye contact, but don’t stare
3. Don’t be afraid to take up some space
4. Relax your shoulders
5. Nod when they are talking
6. Don’t slouch, sit up straight
7. Lean, but not too much
8. Smile and laugh
9. Don’t touch your face
10. Keep you head up
11. Slow down a bit
12. Don’t fidget
13. Use your hands more confidently
14. Lower your drink
15. Realise where your spine ends
16. Don’t stand too close
17. Mirror
18. Keep a good attitude
118 ways to improve your body language
2How to Improve Your Social Skills
August 16, 2008
Model View Controller
Model View Contoller – a … design pattern often used by applications that need the ability to maintain multiple views of the same data.1
Model
- Encapsulates core application data and functionality Domain Logic/Business Logic.
- Since the model must be independent, it cannot refer to either the view or controller portions of the application.
View
- obtains data from the model and presents it to the user.
Controller
- receives and translates input to requests on the model or the view.
Benefits of MVC
- Substitutable user interface
Different views and controllers can be substituted to provide alternate user interfaces for the same model. - User interface components
- Multiple simultaneous views of the same model
- Syncronized views
- Easier user interface changes
- Easier testing
Drawbacks of MVC
- Increased complexity
- Close coupling of views and controllers to model
- Potential for excessive updates
- Close coupling between view and controller
Summary of article by the Web Application Component Toolkit
Source
August 11, 2008
OOP Basics
Polymorphism - appropriate method is called depending on the object type
Inheritance
- represents “Is A” relationship between classes. Class A “is a” class B
- the ability to inherit properties and methods and extend the functionality of an existing class in a new one1
Composition
- represents “Has a” relationship between classes. Class A “has a” class B
Encapsulation - used to hide information
Immutable - the data value cannot be changed
Arrays in .Net - cannot store more than 1 data type
Override - change behavior method for the derived class
Overload - having 2 or more methods with the same name in a class
Boxing - value to reference conversion -> heap
Unboxing - reference to value conversion -> stack