Wednesday, July 14, 2010
12 Common Programming mistakes to Avoid
Jan
Programming is an art and science and like all art and science the only way to learn is from mistakes. I have made many… and I would like to share with you the mistakes that I have made over my journey with development.
These are some of the most common programming mistakes made by developers(including me) and how to avoid them (not listed in any specific order)
1. Improper or No comments
Can you imagine a program without comments. Just imagine how difficult it would be to read someone else’s code without comments. The reason why we as developersmiss out on comments is because when we write code, we are so engrossed in developing logic that we forget this essential step. I recommend that let you develop with the flow of logic that you have and plug in comments after you finish coding. Write comments for any and all complicated logic and SQL queries. Comments will help you a long way in reviewing your code.
2. Not reviewing your code
Once you get that big ‘AAha’ feeling looking at your code after you have completed it, it’s best to review your code immediately and try finding issues if any. You should not onlyreview your logic but also your SQL queries. Look for instances where you have executed SELECT/UPDATE/DELETE without a WHERE clause (not a joke… this happens). For logic that is complicated you should dry run that piece of code to test if it works well.
3. Assuming Business Logic
What do we all do when we have no one from the business side to help us with Business Logic… we assume. Being proactive is good, but it could cost the client his business if you assume business logic. In situation like these its best to escalate your issues and concerns along with your assumptions to the business side and seek clarifications.
4. Not refactoring code
A silly question to ask, but here it is. How many times have our clients asked to take our sweet time to deliver a code? Well, never for me. So what do we do as developers? Develop code at the speed of thought, which results in the code being completely messed up and duplication of functions being created. I recommend that once you are done with your project and before the phase of QA begins, spend some time to refactor your code and optimize it as much as possible. This will ensure that your code is stable, reliable and reusable.
5. Not unit testing your code
Completing your code and getting ready for integration is the good part, but not unit testing your code bounces back on you when you start getting a series of integration errors. Its always better to unit test your code before you move ahead with SIT (System Integration Testing). Test functions and code separately to check if it works as desired with a range of parameters and try to automate it. Automating your unit tests will help you to execute tests whenever you make changes to your code.
6. Not maintaining list of changes
Not every developer is blessed with a code repository, though it is best to have it. Indevelopment environments where code repositories don’t exist it’s important to maintain a list of changes done on the project. Changes to files, configurations, databases, images, environment settings, etc are all important pieces of informaiton that will be required at the time of deploying to staging or production environments and its a must to record these changes in a text file. Without such a text file you can imagine the outcome of deploying to production environments and missing some changes.
7. Not indenting your code
Indenting your code is very important, its ultimately you who will maintain it later. Indenting code not only helps you to structure your code better but also helps you to read and debug your code better. You should try and get a code beautifier that will help you indent all your code as per the rules defined, thus saving you time on bigger projects.
8. Not modularizing code
Not breaking the functionality into multiple modules/functions is a big crime. Break your code into as little form as possible to complete one logical set of functionality. Your function should do what it is intended to do, nothing more - nothing less. As a rule of thumb your code per function should not exceed one page of your screen. Exceptions to this rule do exist, but keeping this rule in mind from the very beginning of developmentwill ensure that your code as modularized to a great extent.
9. Hard coding messages and configurations
Its bad to hard code messages and configuration parameters. This effects the flexibility to change the behaviour of the application at runtime. With scripting languages like PHP it is easy to make such runtime changes. But for applications developed in Java or .NET that are compiled and deployed, it is a daunting task that can take as much as 30 - 40 minutes for deployment.
10. Not optimizing queries
I have been guilty of this too. We as developers think that writing the best code and using the most optimum function provided by the API is the only thing to do. But, we don’t realize that the time taken to execute the script is entirely dependant on how sooner your database can serve results. Therefore, I recommend that you check all your queries with the query optimizer tool that comes along with most of the database engines.
11. Not comparing files
You should always compare the modified files with the original source base. This gives you an addition opportunity to review the code and changes done and if it confirms to business logic. Configuration and function files should always be compared to see and validate the changes that have been made.
12. Not having a backup of files before upload
Without a source control software it becomes important to that you backup important files before you upload changes. Such files should include but not limited to - configuration, database and important function files.
Please feel free to share your programming experiences and write comments if you would like to share other mistakes not listed above so that developers like you and I can learn from it.
Friday, June 18, 2010
Best of CSS Design 2008
Jan
Now, it is time for — Best of CSS Design 2009 (a new list of 50 websites hand-picked from Best Web Gallery). This year, more designers are using the large background technique and utilizing Javascript frameworks (such as jQuery and MooTools) to enchance the user experience. I also came across a few designs that mixed Flash with CSS; perhaps a new trend we should look for in 2010?Let It Bleed
Big bold visual images make this website stand out from the crowd.Vermont Coffee Works
Good use of Flash mixed with CSS.Digital Mash
Good
Good visual and content-focused design.Wilson Miner
DrupalCon, DC
Future of Web Apps - Miami 2009
An excellent mixture of big font and grungy effects.Housing Works
Nice use of large background on the homepage. Large background web design is very hot lately.Future of Web Design - NYC 2008
Another nice example of large background design.Tennessee - Fall
I have to admit, Tennessee’s sites are one of the best series — Fall, Spring, Summer, and Winter.Tennessee - Spring
Tennessee - Summer
Tennessee - Winter
Five Runs
Branded07
Cappuccino
A very origanized site with great usability.LightCMS
LightCMS incorporated some pencil/sketchy effects, yet maintained its corporate feel.The First Twenty
Nicely designed one-page site.YouLove.Us
Great implementation of CSS and Javascript (jQuery).Luke Larsen
The aquarium themed portfolio of Luke Larsen demonstrates great use of jQuery’sScrollto plugin.Design Disease
Wavy and rounded shapes make this site look fun and interesting.Adaptd
Although the design style reminds me of ISO50 (Scott Hansen), but it is worth to mention.Jason Santa Maria
Electricurrent
Notice how Electricurrent used the background image technique to display the portfolio images?Training by Collective Idea
MacAllan Ridge
Good visual design, easy navigation — two thumbs up.Pikaboo
A cool design that combined CSS, Javascript, and Flash technology.Mochi Ads
Fling Media
eWedding
Viget
Viget did a great job on branding their image by maintaining the consistency throughout their series of blogs — Inspire, Advance, Engage, and Extend.Viget - Inspire
Viget - Advance
Viget - Engage
Viget - Extend
August
An awesome design that used Flash scalable image as the background (resize your browser to see the scalable background).Car Freaks
This blog frequently change their homepage background photo to provide refreshing feel.Go To China
Here is a perfect example that uses high resolution photos for website’s background. Notice the background image is scalable based on your browser size (done byJavascript CSS).Jesus Christ
Billy Hughes
Free People
FreePeople is my all time favorite design (love the collage style).Mouse to Minx
Retro and sexy.Dara’s Garden
Design Sponge
The scrapbook design style is a perfect match for the site’s content.Ma.tt
The Lippincott
Hot Meteor
Love the hot retro font!Fortyseven Media
The Old State
It is rare to find such a beautiful black and white theme.
Wednesday, June 16, 2010
How to Build a CMS with CakePHP 1.2
Jan
This course is a fun and interesting look at the CakePHP 1.2 Framework. By the end you’ll have created a simple CMS that you will be able to extend and improve. We build Controllers, Models, Views, Helpers, Components and Behaviors all on camera. In the first 4 lessons we study CakePHP by following Study Guides. These are not your typical Study Guides… you will see Austin Powers, Boobies, Skeletor and other funny things. We use analogies and story telling to help build a database of information in your mind quickly and easily. The last 4 lessons are very practical and high intensity. This is where we code the CMS and follow a treasure map to find Curley’s Golden Chickens. If you are stuggling with CakePHP and things are just not sinking in then this is the course for you. It’s fun and highly detailed. Topics Installing CakePHP, MVC , Bake Tool, Migrations, Schema Tool, Associations, Layouts, View Templates, Elements, CRUD, Helpers, Interactive Tool, Validation, Behaviours, CakePHP OOP, Components, Routing, Dry Controller, Create RedirectComponent, Create RecordingComponent, Create CookieHelper, Creating RecordingHelper, Create TaggableBehavior, Create TaggableHelper, Create Fulltext and Multiple Tag Search, Create TypeableBehavior, Creating AttachableBehavior and much more! DOWNLOAD LINKS: http://www.filefactory.com/file/b100706/n/Building_a_CMS_with_CakePHP_1.2.part5.rar http://hotfile.com/dl/36980419/39c8c37/Building_a_CMS_with_CakePHP_1.2.part1.rar.html http://rapidshare.com/files/373905283/Building_a_CMS_with_CakePHP_1.2.part1.rar.html
http://www.filefactory.com/file/b100704/n/Building_a_CMS_with_CakePHP_1.2.part4.rar
http://www.filefactory.com/file/b100703/n/Building_a_CMS_with_CakePHP_1.2.part2.rar
http://www.filefactory.com/file/b100701/n/Building_a_CMS_with_CakePHP_1.2.part1.rar
http://www.filefactory.com/file/b100702/n/Building_a_CMS_with_CakePHP_1.2.part3.rar
http://hotfile.com/dl/36980530/8265ec8/Building_a_CMS_with_CakePHP_1.2.part2.rar.html
http://hotfile.com/dl/36980612/c8c5ef8/Building_a_CMS_with_CakePHP_1.2.part3.rar.html
http://hotfile.com/dl/36980694/fc93aed/Building_a_CMS_with_CakePHP_1.2.part4.rar.html
http://hotfile.com/dl/36980781/95a9c6d/Building_a_CMS_with_CakePHP_1.2.part5.rar.html
http://rapidshare.com/files/373905626/Building_a_CMS_with_CakePHP_1.2.part2.rar.html
http://rapidshare.com/files/373905613/Building_a_CMS_with_CakePHP_1.2.part3.rar.html
http://rapidshare.com/files/373905441/Building_a_CMS_with_CakePHP_1.2.part4.rar.html
http://rapidshare.com/files/373905451/Building_a_CMS_with_CakePHP_1.2.part5.rar.html
Tuesday, June 15, 2010
How to access MSSQL Database stored on local/Server or other computers, SQL Server 2005 Help for Remote Access of MSSQL Database
Jan
If you are looking for solution to connect MSSQL database stored on other local computer connected in LAN then you are at the right place. Read the below post to know the solution and let me know if the problem resolved as the solution below worked very well on my system. Other Solution DetailsDetails Product: SQL Server ID: 233 Source: MSSQLServer Version: 9.0 Component: SQLEngine Message: A connection was successfully established with the server, but then an error occurred during the login process. (provider: Shared Memory Provider, error: 0 - No process is on the other end of the pipe.) (Microsoft SQL Server, Error: 233) Explanation The SQL Server client cannot connect to the server. This error could occur because the server is not configured to accept remote connections. User Action Use the SQL Server Surface Area Configuration tool to allow SQL Server to acceptremote connections. For more information about the SQL Server Surface Area Configuration Tool, see Surface Area Configuration for Services and Connections. Product: SQL Server ID: -1 Source: MSSQLServer Version: 10.0 Component: SQLEngine Message: An error has occurred while establishing a connection to the server. When connecting to SQL Server, this failure may be caused by the fact that under the default settings SQL Server does not allow remote connections. (provider: SQL Network Interfaces, error: 28 - Server doesn't support requested protocol) (Microsoft SQL Server, Error: -1) Explanation The SQL Server client cannot connect to the server. This error could be caused by one of the following reasons: User Action To resolve this error, try one of the following actions: Version: 9.0 Component: SQLEngine Message: An error has occurred while establishing a connection to the server. When connecting to SQL Server 2005, this failure may be caused by the fact that under the default settings SQL Server does not allow remote connections. (provider: SQL Network Interfaces, error: 28 - Server doesn't support requested protocol) (Microsoft SQL Server, Error: -1) Explanation The SQL Server client cannot connect to the server. This error could be caused by one of the following reasons:
The firewall on the server has refused the connection.
A specified SQL Server instance name is not valid.
The SQL Server Browser service (sqlbrowser) is not started. User Action To resolve this error, try one of the following actions:
Make sure that you have configured the firewall on the server instance of SQL Server to open the SQL Server Browser port.
Make sure that the SQL Server Browser service is started on the server.
Check the spelling of the SQL Server instance name that is specified in the connection string.
Use the SQL Server Surface Area Configuration tool to enable SQL Server to acceptremote connections. For more information about the SQL Server Surface Area Configuration Tool, see Surface Area Configuration for Services and Connections.