tips-and-tricks

How to make favicon.ico Small and Cacheable?

I have a favicon.ico in my asp.net web application. It is small but how to make it cacheable? Any suggestion. ...

Steps to prevent spam on system like Digg

Heya guys, im currently working on a system that's based around the concept of Digg where as you have a button on an external site and a user who clicks that button gets to post / digg it. Anyways, Im looking for some information on the types of spam that I will expect as time grows on. So far I have thought about a fair few factors, s...

Save/Read user data across different browsers

I have been trying to figure this out for a couple of days now. My machine is a mac with snow leopard installed. I listen to music on http://listen.grooveshark.com/ using firefox, and I do not have a user account with them. When I leave the site and come back using firefox, I get an option to restore the songs that I had added to my pl...

How to get better at CSS, laying out designs and UI Programming?

Hi all, I am pretty familiar with CSS and have used quite a bit of javascript and jquery also little experience of layout designing and working closely with Photoshop. But, somehow I don't feel as confident as when programming with database or C# side and face lot of problems when I am working with designing UI and laying out elements t...

What is the recommended strategy for input box hint text (such as "Search" overlayed on a search box)?

Many pages have a search box to them which will typically have the overlayed text "Search" which disappears when one focuses the element and reappears when focus is lost. I'm curious to know what people recommend as the best strategy for this. The strategy I've employed is to use the focus/blur events of the input element and test the c...

Special methods and tricks in ASP.NET MVC?

Please tell me your favorite trick and tips to me. I want to collect so much knowledge as I can. And I think it's the best way to hear it from experts and amateur developers. *1. HTML FORM Tag + Attribute "multipart/form-data" and HttpPostedFileBase * I cloud tell you something about html form tag. If you use form tag in MasterPage of...

Starting projects and language selection

I know everyone usually chooses languages they are familiar with. I would honestly like to know when starting an open source project; which language would you select to begin development and why? What do you use as "measurement" tools to see which language would be best suited? How do you eliminate particular languages on what criterio...

Leaving Windows Console windows open after process termination

Is there an OS or user-account level modification for windows 7 that I can use to leave the console window of terminated processes open? Background: I like to use console programs for simple tests. These things tend to need debugging and analysis, and the easiest way to do that is to use printf or equivalent - that's available in prett...

What is the most useful Python Trick/Shortcut?

Possible Duplicate: Hidden features of Python What trick or shortcut is the most useful when you code in Python and why? Please post one item per post so that the readers can rate. ...

Learning Java from Python

I currently am pretty sufficient in python, but I need to learn Java. Are there any books that would be specifically tailored to someone like me? Also, do you have any tips, or just any great Java books in general? ...

Is there some ninja trick to make a variable constant after its declaration?

I know the answer is 99.99% no, but I figured it was worth a try, you never know. void SomeFunction(int a) { // Here some processing happens on a, for example: a *= 50; a %= 10; if(example()) a = 0; // From this point on I want to make "a" const; I don't want to allow // any code past this comment to modif...

How to write data in database efficiently using c#?

Hi, my windows app is reading text file and inserting it into the database. The problem is text file is extremely big (at least for our low-end machines). It has 100 thousands rows and it takes time to write it into the database. Can you guys suggest how should i read and write the data efficiently so that it does not hog machine memory...

Encapsulate several field at once in Visual Studio 2010

In visual studio you can set accessors by using the encapsulate field refactoring operation on a declaration (Ctrl + E,R shortcut). Is it possible to generate (using the default settings) the accessors of several field at once ? Having : private int one; private int two; //etc and generating : public int One { get { return one;...

What are some rarely used but cool CSS properties?

I have been using border-radius and box-shadow effects of moz and webkit. //For rounded corners -moz-border-radius:4px; -webkit-border-radius:4px; //For shadow effect -moz-box-shadow:2px 2px 5px #000; -webkit-box-shadow:2px 2px 5px #000; Anyother unknown css effects of moz and webkit. EDIT: I have got some more css properti...

General tips for semantically cleaning up HTML, CSS & JS?

As I've gotten deeper into using jQuery with various sites I've worked on, I've found that I can get lost on whether a class attribute value is appended to an element in the DOM in order to attach an actual CSS style, or to bind an event to it. As such, I've started leaning towards using the rel attribute on anchor tags to denote if som...

How can I guarantee type safety in a function that accepts an unlimited amount of arguments?

The FastFormat library works like this: string example; fastformat::fmt(example, "I am asking {0} question on {1}", 1, "stackoverflow"); It also claims "100% type-safety". I can understand how other libraries such as boost::format achieve that by overloading operator%, something I do fairly often with my code too. But if I was able t...

2D Game Design and Optimization tips and tricks

I can see how this might not be a good enough question but I have just embarked on a journey to build the first decent Game Engine for HTML5 canvas that is cross browser and most of all fast. The only problem is I am very new to game design and don't know many tricks of the trade that will help me. The game I am currently implementing f...

Does this trick always work?

Possible Duplicate: Potential Problem in Swapping values of two variables without using a third variable I recently read in a community that we can easily swap two numbers without using third using a XOR trick. m^=n^=m^=n; trick was mentioned. What do you guys think? Is this trick always useful? ...

Practical bit operations that save hours of work

Hi I am wondering what other bitwise and logical operations you've used that saved your day. For example, my last great time (and resources') saver has been if(!((A^B) & B)) reads: if A has at least B's access rights, where rights were saved in the bit fields A and B. Please use the classical operators: binary & (and) | (or), ^ (xo...

Any cool XOR tricks?

Looking forward to see some cool XOR tricks. May be using other bit-wise operators also. ...