Today's Question:  What does your personal desk look like?        GIVE A SHOUT

SEARCH KEYWORD -- Plain text



  How does CSDN dare to use plain text as password?

Recently, the China's largest Chinese IT community website named CSDN leaked its user's account information. Later today CSDN made an announcements to its users on their website. The announcement said that some user account information was leaked and the passwords of the accounts were stored as plain text in their database before 2009, and after 2009, they adopted an encryption algorithm to encrypt user password. They urged all users who registered the account before 2009 to change their passwor...

   Security,Information leak,CSDN,Plain text     2011-12-22 09:10:01

  Error handling style in C

Following are three error handling styles in C.Which one you like the most? Or you don't like any one?1. /* Problem : Not enough. Easy to be wrong */int foo(int bar){        int return_value = 0;        int doing_okay = 1;        doing_okay = do_something( bar );        if (doing_okay)        { ...

   C,Error handling style,Goto,Nested if     2012-04-24 06:51:00

  Magic CSS shape

There is a question on StackOverflow which states that someone finds a CSS sample on http://css-tricks.com/examples/ShapesOfCSS/  , the sample shows a triangle created with pure CSS. The source code is :#triangle-up {width: 0;height: 0;border-left: 50px solid transparent;border-right: 50px solid transparent;border-bottom: 100px solid red;}The question is how these few lines can create a triangle? Next we give the answer and the detail illustration to this question We need to consider the B...

   CSS,Triangle,Box model,Border     2012-04-20 12:56:22

  A boolean value interview question

Someone asked a question on StackOverflow, he was asked an interview question. The question is : Given 3 boolean variables a, b, c, return true if at least 2 out of the 3 are true. He gave the solution as follows :boolean atLeastTwo(boolean a, boolean b, boolean c) {    if ((a && b) || (b && c) || (a && c)) {        return true;    } else {        ret...

   bool,return,expression,conditional     2012-04-30 08:49:32

  How to draw pentagram in HTML5 canvas

I wrote simple function to this magical symbol I like so much: 123456789101112131415161718192021222324252627282930<!doctype html><html><body>    <canvas id="c" width="500" height="500"></canvas>    <script> var ctx = (document.getElementById("c")).getContext("2d"); // draws rotated pentagram with or without cirlefunction pentagram( ctx, x, y, radius, rotate, circle ){    ctx.beginPath();&nbs...

   Html 5,Canvas,pentagram     2012-04-23 12:56:06

  var in JavaScript

Geoff published an article sometime ago--"How one missing var ruined our launch". This article described one case where MelonCard uses Node.js as their backend system, suddenly there was a small registration peak period--50-100 people registered concurrently, then the entire website stopped responding and many other strange problems showed up. When they were investigating the source of the problem, they found one missing var in the following code.app.all(‘/apps/:user_id/status’, fun...

   JavaScript,Scope,variable     2012-05-26 12:35:36

  Interview Programming Problems Done Right

Introduction Why 37signals Doesn't Hire Programmers Based on Brainteasers and my comment on HN generated a lot of responses, so much so that I'm writing this post to properly explain the essence of a good (IMHO) interview programming problem. Pascal's Triangle Pascal's Triangle is a shortcut for getting coefficients most often used binomial probability. The root element is 1. Every other element is the sum of the one or two above it (diagonally left and diagonally right). There are severa...

   Interview,Programming problem,Pascal,Triangle     2012-01-06 09:46:43

  Venn Diagram entirely in CSS

The HTML5 Microzone is presented by DZone and Microsoft to bring you the most interesting and relevant content on emerging web standards.  Experience all that the HTML5 Microzone has to offer on our homepage and check out the cutting edge web development tutorials on Script Junkie, Build My Pinned Site, and the HTML5 DevCenter. A friend of mine alerted me this weekend to just how much I have a weird fascination with Venn diagrams. I decided to roll with it. So yeah...

   CSS,Venn Diagram,Implementation     2012-02-06 08:10:41

  Twitter OAuth the easy way – simple post to twitter script

After Twitter introduced mandatory authentication with OAuth, many of the current scripts for posting content to Twitter don’t work anymore. OAuth can be great for more advanced authentication, but for a simple post to twitter script, it seems like a little overkill. In this post you’ll learn how to create a simple script that uses a quick and dirty version of OAuth for posting new tweets to Twitter. How to create a simple script Simplified, Twitter OAuth involves sending both ap...

   Twitter,OAuth,PHP,Auto tweet     2012-02-25 12:51:07

  The craziest Javascript implementations

Since its birth in 1994, Javascript has come a long way. Today it’s one of the most popular programming languages on the web because of high popularity of AJAX based web-applications. Also the rise of micro-frameworks such as jQuery (also Prototype, Moo Tools etc) which have reduced dramatically the complexity of code developers needed to write, it is well tested, has a ton of plug-ins, has a large development community and reduced development time.And lately even Server-S...

   JavaScript,Crazy implementation,JVM,Turing machine     2012-01-03 12:09:42