coding

Do you feel that writing on paper helps you develop better?

I personally write out any program that is not a throwaway script on plain paper. Mostly, this is so that I have something to do during the more boring classes, but I actually feel that it has done a lot for the quality of my programs. Generally, when I jump right in and code, a lot of hacks come into the code and it is generally of lowe...

Convention result and code error C++ int foo (...)

In Linux for example when i use batch if error code is 0 thats good, but what is the convention in C++ ? when int (or bool) is equal to one we say that's true, but what must be the return of such function in C++ ? ...

Resharper Power toy Zen Coding

I have tried Resharper Power toy Zen Coding and found it can only generate code in one line, can it generate formatted code. for example i type in ul>li*3 it generate: <ul><li></li><li></li><li></li></ul> i want it format to: <ul> <li></li> <li></li> <li></li> </ul> ...

How to save data entered in textfields onto a database?

For example: Name: 'textfield1' Surname: 'textfield2' Age: 'textfield3' Save those three textfields and make a file where it would print it like this: textfield1, textfield2, textfield3 ...

What is a good free platform that allows code highliting/good code visualizations?

I want something similar to a Wordpress.com blog. What site has a free solution like this? I want to start a little WPF blog to help newbies with the same problems I've had in my learning of WPF. Edit: I need it to have a [code] tag or something similar. ...

I want a function in VB SCRIPT to calculate numerology

I want a function to calculate numerology.For example if i enter "XYZ" then my output should be 3 . Here is how it became 3: X = 24 Y = 25 Z = 26 on adding it becomes 75 which again adds up to 12 (7+5) which again adds up to 3(1+2) . Similarly whatever names i should pass,my output should be a single digit score. ...

Merging two XML source documents with XSLT

XML file one could have 1000 - 6000 forms; XML file two could have one to 100 or more. I want to replace any identical form in file one with file two. If it exists in file 2 but not in file one I want to add it to file 1. After the files are merged I want to run it against my XSLT. I am using a 2.0 stylesheet and a Saxon parser. Fil...

Which Storage media is used in The coding of "Trace" operation provided in c and c++ Editors?

Which Storage media is used in The coding of "Trace" operation provided in c and c++ Editors? ...

java api design - NULL or Exception

Is it better to return a null value or throw an exception from an API method? Returning a null requires ugly null checks all over, and cause a major quality problem if the return is not checked. Throwing an exception forces the user to code for the faulty condition, but since Java exceptions bubble up and force the caller code to handl...

PHP vertify against multiple criteria (more like I don't think this very long if statement is good.. code effiecentcy help!!)

So in PHP, I am checking a file extension against multiple types to get the general type of file so here is what I have for images alone: if ( $ext == "bmp" || $ext == "jpg" || $ext == "png" || $ext == "psd" || $ext =="psp" || $ext == "thm" || $ext == "tif" || $ext == "ai" || $ext == "drw" || $ext == "eps" || $ext == "ps" || $ext == "s...

How to extract the number of control points from Hugin.

Hi, Is there any way to extract the controlpoints calculated using Panomatic or any other Control Point detector? All I need is to compare two images based on the number of control points and tell which two images are similar. I need to do this in Command Line. ...

Date and time in PHP pagination script - slight problems

I have an events calendar written in PHP, with the following pagination script that I obtained from a free PHP site. This is the basic script (entitled PmcPagination.php): http://pastebin.com/f7c5a4a90 (linked here for convenience, too lengthy to post in full!) It works to the extent that it shows all events - but the dates do not tall...

I want a generic function in VB Script which should help everyone where someone want use date in specific format.

My application server is in London so date format is freeze to format DD-MMM-YYYY (e.g. today’s date 16-Feb-2010) we have written VBScript code to enter the date in same format. But code fails in LN machine due to LN PC date format is dd/MM/yyyy whether NY and India PC format is MM/dd/yyyy where code works fine. Here I want one generic ...

How to handle unresponsive Co-workers?

Currently in a situation where a co-worker refuses to do any work, and seems to want to make me do all the work, and then take the credit for it. Unfortunately for me, he tells the boss that we are sharing the work, but he is doing more work than I am. Said co-worker has been with the company longer than I have so the boss believes him m...

[Firefox Development] Creating an addon to override cookies

I'm working on writing a plugin to change the value of a cookie to prevent log out. I was planning to have it so that on every page load the value of that cookies is changed to my value. Is this the best way to go at it? Is it safe? I'm mostly needing to know how other developers would go at it and what are the pit falls of my current id...

What is the best coding practice for if conditions?

Many years of coding have brought me to believe and try to reach this kind of if conditional coding: (demonstrated in C, but it's relevant almost to any language) if(a <= 0) return false; if(strlen(str) <= a) return false; if(str[a] == NULL) return false; return true; Which i think is much more readable than the ...

An rss parser tutorial

Know any updated ones that are good? ...

PHP if statement - select two different get variables?

Below is my example script: <li><a <?php if ($_GET['page']=='photos' && $_GET['view']!=="projects"||!=="forsale") { echo ("href=\"#\" class=\"active\""); } else { echo ("href=\"/?page=photos\""); } ?>>Photos</a></li> <li><a <?php if ($_GET['view']=='projects') { echo ("href=\"#\" class=\"active\""); } else { echo ("href=\"/?page=photos...

Learning libraries without books or tutorials

While many ask questions about where to find good books or tutorials, I'd like to take the opposite tack. I consider myself to be an entry-level programmer ready to move up to mid-level. I have written code in c, c++, c#, perl, python, clojure, vb, and java, so I'm not completely clueless. Where I see a problem in moving to the next le...

What are the characteristics of spaghetti code?

Somebody said that when your PHP Code and application use global variable then it must be a spaghetti code (i assume this). I use wordpress a lot. As far as i know, it's the best thing near a great php software. And it use many global variables to interact between its components. but forget about that, cause frankly, that's the only th...