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

SEARCH KEYWORD -- Post



  Why cannot compare double values directly for equality?

A question in PHP: Get some value from the database and use floatval() to convert it to floatint point value, then compare it with another value which is also converted to floating point value with floatval(). These two values are the same when using var_dump() to output, the two outputs are float(8.87), they are the same. But when comparing them for equality, the result is weird., they are not equal. Why?To analyze this question, we need to start with PHP data types. PHP uses weak types. In PHP...

   PHP,floating, precision,compare,equality     2012-06-27 09:01:36

  Coding skill and the decline of stagnation

I am a decent programmer. I know a decent amount of computer science theory, I can type correct code fairly easy. I don’t let my classes expand too much. But I still struggle some with math, and I have a tendency to have too many cross-dependencies in my code. I used to think I was an awesome programmer. One of the best. After I made a game in the first programming lesson in school, I got told to don’t bother showing up for the rest. I was the one who taught all my friends wh...

   Coding style,SOPA,Stagnation,Decline     2012-01-14 12:05:10

  The Singular Secret of the Rockstar Programmer

Before all the laws of software, before the purpose of software, before the science of software design itself, there is a singular fact that determines the success or failure of a software developer. This fact makes the difference between the senior engineer who can seem to pick up new languages in a day and the junior developer who struggles for ten years just to get a paycheck, programming other people’s designs and never improving enough to get a promotion. It differentiates the poor...

   Programming,Tip,Great developer,Rockstar     2011-08-07 23:42:09

  An Object is not a Hash

Following my article A String is not an Error, I want to bring attention to an issue that similarly applies to JavaScript in general, but has special relevance in the Node.JS environment. The problem boils down to the usage of {} as a data-structure where the keys are supplied by untrusted user input, and the mechanisms that are normally used to assert whether a key exists. Consider the example of a simple blog created with Express. We decide to store blog posts in memory in a {}, indexed ...

   Object,Hash,Node.js,JavaScript     2012-01-19 10:16:10

  Weibo is testing an Instagram like app called Lvzhou

Weibo, the Chinese version of Twitter, is testing an Instagram like app called Lvzhou(Oasis in English). Now only invited people can access the app. You can download the app on App Store if you are an iPhone user or you can download online if you are an Android user. The vision of this app is to allow users to discover beautiful world, users can post photos or short videos and share with the rest of the world. Before you can access the app, you have to obtain an invitation code shared by y...

   INSTAGRAM,WEIBO,LVZHOU,OASIS     2019-09-07 09:59:54

  Backend-as-a-service?

As the list of *-as-a-service’s continues to grow, I thought I’d throw one into the mix. What about the idea of a backend-as-a-service (BaaS)? The recent surge of client side Javascript frameworks along with the attractiveness of simple RESTful APIs has created an environment where server-side interaction can be reduced to simply database interaction (including validation and some computation). But why stop there? What if the server-side of the equation was simply a RESTful, ...

   Web design,Backend,Service,BaaS,Client JavaScript     2011-12-29 09:07:38

  How to send asynchronous requests in PHP

It’s easy to make asynchronous calls in PHP with just a little bit of HTTP header knowledge and some library code around PHP sockets. This technique is useful when posting requests to your own server for bits of logic you’d like to run in the background.  If you don’t control the endpoint, you might not be comfortable with some of the limitations, such as the inability to read anything from the response.  So, you couldn’t post data to a we...

   PHP,Asynchronous request,socket     2012-04-28 06:45:51

  Introduction to OAuth (in Plain English)

Last week we talked about giving away your passwords and how you should never do it.  When a website wants to use the services of another—such as Bitly posting to your Twitter stream—instead of asking you to share your password, they should use OAuth instead. OAuth is an authentication protocol that allows you to approve one application interacting with another on your behalf without giving away your password. This is a quick guide to illustrate, as simply as possibl...

   Security,OAuth,Permission,Partial access     2012-04-05 11:39:54

  Multithreading interview questions in Java

Multithreading as a widespread programming and execution model allows multiple threads to exist within the context of a single process. These threads share the process' resources but are able to execute independently. The threaded programming model provides developers with a useful abstraction of concurrent execution. However, perhaps the most interesting application of the technology is when it is applied to a single process to enable parallel execution on a multiprocessor system.Many programme...

   Multithreading,Java,Interview     2012-05-28 06:33:25

  The Greatest Regex Trick Ever (Simplified)

There is a post which is really hot recently which showcased a best ever regular expression trick. In this post, it provides a trick which can be adapted to situations where one wants to match some patterns desired and exclude the patterns undesired. In simple, the trick is : Pattern not desired | (Pattern desired) Then taking the group 1 match of the capturing group of matched. This group will contain the strings matching the desired patterns. Have to say this trick is really neat and brilliant...

   REGULAR EXPRESSION,PROGRAMMING,JAVA     2015-10-01 21:59:05