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

SEARCH KEYWORD -- pseudo-element



  Functional Programming For Object Oriented Programmers

After recently remarking about how I finally "got" functional programming I was asked by one of my millions of twitter followers... ¬_¬ to write up an explanation of a small F# program spoken in terms that fellow O-O programmers would understand. Before I become too entrenched into the functional programming way of thinking, that is, and can't explain it anymore. As a former tutor this is one of the major problems with being able to teach something once you understand it. You've ...

   Functional programming,OOP,F#,Pattern     2011-11-25 13:49:16

  How the Go language improves expressiveness without sacrificing runtime performance

This week there was a discussion on the golang-nuts mailing list about an idiomatic way to update a slice of structs. For example, consider this struct representing a set of counters. type E struct { A, B, C, D int } var e = make([]E, 1000) Updating these counters may take the form for i := range e { e[i].A += 1 e[i].B += 2 e[i].C += 3 e[i].D += 4 } Which is good idiomatic Go code. It's pretty fast too BenchmarkManual 500000 ...

   Go,Expressiveness,Performace,Sacrifice     2012-02-12 04:53:55

  File upload in PHP

File is a special kind of form data, when being uploaded to the server through HTTP POST request, PHP will create a $_FILES global array, the relevant file information will be stored in this global array. We will illustrate file upload with some code snippets using PHP and look into the internal work mechanism. Lastly will talk about file upload security. File upload In order for users to upload files in client side, we have to provide a form on the user interface. Since the uploaded file is a s...

   File upload,PHP     2012-11-30 22:01:28

  Sort an array with only one local variable

Array sorting algorithm question is frequently asked during technical interviews. There are lots of sort algorithms including bubble sort, selection sort, insertion sort, quick sort, merge sort etc. Usually interviewees will be asked to implement sort algorithms. But have you ever been asked to sort an array which you are allowed to define ONLY ONE local variable in your algorithm?  Bubble sort can be used to do this actually. Normally a bubble sort algorithm may need three local ...

   JAVASCRIPT,ALGORITHM,SORTING,BUBBLE SORT     2016-10-07 09:46:49

  + operation on JavaScript objects

In JavaScript, there are two types of values: primitive and object. Primitives consist undefined, null, boolean, number and string. Other values such as array and function are objects. When applying + operation on different type of values, there would be three kinds of type conversion. Primitive conversion Number conversion String conversion There three type conversions have corresponding abstract operations in JavaScript: ToPrimitive(), ToNumber(), ToString(). For number additi...

   JAVASCRIPT,PROGRAMMING     2018-10-12 22:19:12

  Writing great JavaScript

I probably could have named this post something like “Writing clean, validating and portable JavaScript”, but that would be no where near as catchy. The problem with “great” is it means different things to different people. I am going to show you my idea of great which may differ from many developers views, but I hope it helps someone improve their code. So what’s the point in this, why can’t you just carry on writing JavaScript as you have been for a...

   JavaScript,Great,Clean,Tips     2012-03-24 05:18:12

  What's Wrong with the For Loop

Closures in Java are a hot topic of late. A few really smart people are drafting a proposal to add closures to a future version of the language. However, the proposed syntax and the linguistic addition are getting a lot of push back from many Java programmers. Today, Elliotte Rusty Harold posted his doubts about the merits of closures in Java. Specifically, he asks "Why Hate the for Loop?": I don’t know what it is some people have against for loops that they’re so eager to...

   For loop,Basic,Problem,Efficiency,Java     2012-02-24 05:06:15

  First steps with Scala, say goodbye to bash scripts…

Those who know me are aware that I’ve been following play framework, and actively taking part of it’s community, for a couple of years. Playframework 2.0 is right around the corner, and it’s core is programmed in Scala, so it’s a wonderful opportunity to give this object-oriented / functional hybrid beast a try… Like many others, I will pick a very simple script to give my first steps… Finding an excuse to give Scala a try With a couple of friends we are ...

   Scala,Functional programming,Bash script,Replacement     2012-01-12 06:45:16

  Useful Bash Scripts

Many people hack together shell scripts quickly to do simple tasks, but these soon take on a life of their own. Unfortunately shell scripts are full of subtle effects which result in scripts failing in unusual ways. It's possible to write scripts which minimise these problems. In this article, I explain several techniques for writing robust bash scripts. Use set -u ...

   Linux,Shell,Bash,Command,Robust     2012-01-15 10:28:00

  Writing robust shellling scripts

Many people hack together shell scripts quickly to do simple tasks, but these soon take on a life of their own. Unfortunately shell scripts are full of subtle effects which result in scripts failing in unusual ways. It's possible to write scripts which minimise these problems. In this article, I explain several techniques for writing robust bash scripts. Use set -u ...

   Robust,Shell script,Set,Commands     2012-03-19 13:25:26