Are you a real programmer? How can you tell that?
This is really amusing for one and all to read.
Machine code is your pseudo code
You trust that by means of a linker or a macro library to make a program is “dirty”, a real programmer does not get baffled when the source code get to 6000 lines in one file
You suppose that PC playoffs are a squander of CPU cycles.
While you are at a monetary firm coding for mainframes in mainframe assembly (the manager inform him to code in Assembly rather than machine code so the other ‘normal’ programmers may possibly be aware of what is going on)
You construct your individual programming languages and provide them crappy names.
You were not being fond of multicore systems. You accept as true that if you cannot formulate a program to run fast enough on a single core, you are not a programmer.
You will never utilize operating system interrupts … you make your own.
If your random number generator creates the random numbers from zero to infinity in 5 seconds, you believe it as very slow.
You consider that remarking the source code is for the amateur.
You don’t make use of computers outside of work. You will not have belief on other programmer’s code.
You judge that technologies like PHP, Python or VBA were not a programming language- it is only scripting language.
You don’t want to use Object Orientation for the reason that it makes your work trouble-free. In any case you wish for a challenge.
C++ and APL programming languages was a toy to you.
Someone point out the languages like VB and JAVA to you, you will give a punch them on the head.
Even if your code has been typed up, it was already optimized.
You get clear of the Back Space key on the Keyboard as you do not make any mistakes.
You don’t like to have any book or notepads; it’s all in your head.
Your programs are not user friendly, even if they are bug free.
You have a nightmare of creating your own CPU for yourself one day and maintain it in your parent’s garage.
You thought that IDE’s, Programmer Tools and Syntax Highlighters are for people who do not be familiar with what they are doing.
You return back the computer mouse to the technician, with a screw driver stabbed through it. Real programmers will make use of command prompt only.
If the client does not be fond of what you perform for them, you think that the client is an idiot and you say “No” to alter anything.
Who wants friends when you can program your own friends.
How to handle errors using Boolean flags
This error handling method may be the most ancient. Boolean flags were used by many programming languages, and PHP will not be an exception. Even though they are very simple to apply, the main negative aspect is that they were not very informative about the mistake that happened and its perspective. Here is an unsophisticated implementation of the FileReader class, which make use of Boolean flags:
[php]
class FileReader{
var $file;
var $fileDir=’fileDir/’;
function FileReader($file){
if(!@file_exists("{$this->fileDir}{$file}.php")){
return false;
}
$this->file=$file;
}
function getContent(){
if(!@$content=file_get_contents("{$this->fileDir}{$this->file}.php")){
return false;
}
return $content;
}
}
[/php]
Bearing in mind about the explanation for the above example, class errors might be handled as follows:
[php]
$fr=new FileReader(‘inexistent_file’);
if(!$fr->getContent()){
die(‘Unable to read file contents’);
}
else{
echo $fr->getContent();
}
[/php]
In the example, @ error suppression operator is intentionally used, so as to stay away from the complaints of the PHP interpreter and return a false value (or 0 or -1) when a failure happens. At first look, you can observe the incompetence of this method, plus its restricted flexibility. On the other hand, this approach has established to be quite victorious in procedural applications, or when client code is able to handle straightforward errors without corrupting the entire application.
Nowadays, we have investigated the pros and cons of common error handling approaches in PHP 4. Certainly, in huge web applications, a set of error controlling classes is preferred, so you are able to handle errors through a centralized point. Conversely, the trigger_error () / set_error_handler () combination may suit the requirements of small projects, so it is worth considering.
Guidelines to handle Db connection
Please confirm that you close the original connection to a database all the time and that you are using connection pooling to get better processing speed of database connection creation etc. Here are some tips for you:
1. Use web.config to store up the connection string:
2. Use this connection string forever and do not make any changes to it. If you were not doing this (for example using different DSNs) you will disable the connection pooling feature:
string dsn = System.Configuration.ConfigurationSettings.AppSettings[“dsn”];
3. Do not perform any tricks to try to deal with connections etc, just proceed and use it (no wrapper classes or so involved):
SqlConnection conn = new SqlConnection(dsn);
4. Formulate the time between conn.Open() and conn.Close() as small as possible. E.g. don’t do this:
SqlConnection conn = new SqlConnection(dsn);
Conn.Open();
SqlCommand cmd = new SqlCommand(query, conn);
cmd.Parameters.Add(…);
//and further cmd parameters actions and so on
SqlDataReader reader = cmd.ExecuteReader();
//use the reader and do a bundle of additional tasks, not relying on the database
conn.Close();
But rather, use:
SqlConnection conn = new SqlConnection(dsn);
SqlCommand cmd = new SqlCommand(query, conn);
cmd.Parameters.Add(…);
//and more cmd parameters actions etc
conn.Open();
SqlDataReader reader = cmd.ExecuteReader();
//use the reader
conn.Close();
//perform a batch of other work, not relying on the database
5. Always close the connection when you are done, even when an exception occurs. To do this, use the try…finally pattern:
SqlConnection conn = new SqlConnection(dsn);
try
{
//some init depending on conn
conn.Open();
//minimum number of lines of code depending on the open connection
}
finally
{
if (conn.ConnectionState == ConnectionState.Open)
conn.Close();
}
or the using pattern in C#:
using (SqlConnection conn = new SqlConnection(dsn))
{
//…
conn.Open();
}
This will close the db connection repeatedly while leave from the using block.
Copy to Clipboard with Javascript on Mozilla or Netscape Browsers
Hope all may know that by using Javascript select() and execCommand(“Copy”)
function we may able to select all the contents and copy those selected contents into our clipboard.
However, this function will work only in Internet Explorer (all version) by default, but not in Mozilla or Netscape browsers. To enable these Javascript Copy to Clipboard function in the Mozilla and Netscape Browsers, please follow the steps to provided below
1) Type about:config in the browser address bar.
2) Now, in the Filter window search for the following:
signed.applets.codebase_principal_support
3) Set the Boolean value to true for Firefox or enter true or 1 for Mozilla browsers.
Keep in mind that Preference names are case-sensitive.
Once you have made this simple settings on your Mozilla or netscape browsers you may use the copy to clipboard function on your browsers.
Cannot able to close Form?
It is a fascinating bug that forces a Windows Form to go into a condition where it cannot be closed. Are you using the initial version of the .NET framework with SP1 installed?
Want to check this?
- Build a new form, F1.
- Set a user control U1 on top of it.
- Locate one more user control, U2, onto the control U1.
- To end with, put a button onto U2.
- Write down an event handle for the button click that causes the user control U2 to be detached from its parent, U1.
- Run the application.
- Click on the button.
- You should wind up with a form.
- Now make an attempt to close the form by clicking on the close button.
- It does not work. Am I right?
Reason:
The form is saying NO to close because its Close method is trying to authenticate the control first. The validation should fail because its unvalidatedControl private member still points to the button which has been detached from the hierarchy.How to overcome:
After get rid of the user control U2, call a.OnControlRemoved (c) that clear the unvalidatedControl variable.
CGI Time Out The specified CGI application exceeded the allowed time for processing. The server has deleted the process.
Whenever we tried to run some large script like data extraction or trying to get thousand number of records from remote database, most of us will face the following CGI Issue
“The specified CGI application exceeded the allowed time for processing. The server has deleted the…”
In order to run your script without any such kind of issue, please follow the steps provided below. Earlier I too faced such a issue but after research in my PC I finally fixed it.
Note: the following steps is only suitable only for the Windows XP and with the IIS version 5.1:
Go to your Internet Information Services (IIS) page (Go Start -> Settings -> Control Panel -> Administrative tools -> Internet Information services)
Unfold Websites->Default Web site
Now right click on your website name (on which you are executing your script)
Select Properties
Select the tab Virtual Directory
In that page, select the option High (Isolated) under Application Protection, this option will remove the default timeout settings.
Now click on the button Configuration
Then select Process Options tab
Change the CGI Script Timeout value max value is 999999.
That’s it. You may now run your script without any issue.
Local Host in Mozilla or Netscape browsers
Most of the users who are using local host in IIS are known to work only in Internet Explorer (IE) browser.
However, you may also browse your Localhost in both the Mozilla and in Netscape Browsers also. To browse your localhost in Mozilla and Netscape browsers just follow the simple steps provided below:
1) Type about:config in your address bar
2) In Mozilla it will prompt an alert message click the button “I’ll be careful, I promise”
3) Now in the filter box search for “network.automatic-ntlm-auth.trusted-uris”
4) Double click on the Preference Name.
5) Enter the value “localhost” and click OK.
6) That’s it.. Your browser is now configured to use localhost.
Hope this is so helpful for many users.
Yahoo! India Local (beta)
Yahoo India has recently launched Yahoo! India Local (beta), a new local information destination. This new launch provides a convincing user experience with appropriate local information that blows the users daily needs. This Yahoo! India Local is presently available only across Delhi, Chennai, Mumbai and Bangalore.
Yahoo! India Local gives you relevant local information like Business listings, Maps, Directions, Local events, and Current movies. Users may also get listings from a wide range of categories such as restaurants, pubs, shopping malls, hospitals, schools, tailors, banks, health and fitness, and 24 hour pharmacies. This Yahoo! India Local is available at local.yahoo.in.
Users can write their own reviews, and also they leave footprints, mark businesses on the map, and add listings or events on Yahoo! India Local. Contributions shared by the community provide users with real insights into their experiences, thereby making them better informed. Local businesses across categories can now get listed for free on Yahoo! India Local. When users search for those categories, the businesses can get discovered.
Gopal Krishna, Head of Audience-Yahoo! India, said that: “Yahoo! India Local (Beta) exemplifies our strategy to be the leading starting point on the web, by providing the most relevant and compelling experience for local needs. He added that, “With this innovative product, we are trying to make the web more useful, engaging, and interesting and localized to our users”.
Fixing bugs in CSS
A high-quality web designer has to undergo every time he or she codes a page using CSS for design. Web Standards is the only way to go and it must be an obvious option when you take your job serious.
Confirm your markup is well structured
Make sure your markup is finely ordered, in other words make use of the suitable markup for the appropriate content. Apply headings for titles, paragraphs for blocks of text, ordered and unordered lists to sum things up in list form or for your navigation, field sets in combination with legend and label elements for forms… Finally, use tables only for what they are used for, tabular data.
Validate your markup
It’s not pretty much the green check mark in the bottom right hand corner of your browser or 0 errors or warning on the W3C Validator that matters. This is only an additional check and a confirmation that your code validates. The W3C markup validator or W3C CSS validator should be your tools to make your page an error free. Tools that facilitate you to create the right coding, but consider that this is just a machine that runs a test for you. Some coding faults, for instance using the incorrect or structure-less code for certain content will not be seen as an error by this machine, so make sure this is in order. Validate the pages is an absolute necessity before you begin to fix any CSS layout problems.
Steps to clear the Dreamweaver’s Start up Error
Most of the Macromedia’s Dreamweaver user may face the “dwscripts is not defined” in the startup. This may cause when the user may not shut it properly when he used Dreamweaver previously. To clear this error from the startup is so easy, simply follow the steps provided below.
1) First make sure you have closed your Dreamweaver application.
2) Now go to the following path in your computer respectively
C:\Documents and Settings\Administrator\Application Data\Macromedia\Dreamweaver 8\Configuration
3) In the ‘Configuration’ folder delete the file WinFileCache*.dat.
4) Now restart your DreamWeaver application
You may now open your Dreamweaver application without any issues.
Please note that the “Application Data” folder is hidden by default, so you have to change your Windows Explorer Folder Options setting to view all hidden folders.