Posts Tagged ‘code’

Go – a programming language from Google

Go is a brand new programming language coming from Google Inc.  Go is a compiled language designed to handle the issues that come with massive concurrent applications and to use effectively multi-processor systems. Go is an open source project.

The design of Go started in September 2007 and in November 2009 implementations of Go were released for Linux and Mac OS X. In 2010, Rob Pike, one of the designers of Go, stated that “at Google, Go is used for real stuff”.

At first, Go looks a lot like C++. Sure, it borrows a few features, like garbage collection, from Python. “Python meets C++” as TechCrunch’s article on Go is entitled.

According to Google, Go is extremely fast and is comparable to C and C++ code. In a video, it is demonstrated how the entire language compiles in 10 seconds (that is 120 000+ lines of code).

Google Inc. also states Go is type safe and memory safe. For example random array access can be done with slices which know where their limits are. Like many languages, Go offers run-time reflection.

Google also states that Go has the smoothness of a dynamic language with the speed of a static language.

Google have explained their motivation for creating Go. According to them, the computing scenarios have greatly changed for the last few years, yet no major systems language has emerged.

It is true that most of the languages don’t support garbage collection and/or parallel computations (at least not in their standards).

If Go sound interesting to you, currently there are two compilers for it – Gccgo [], a frontend to GCC, and a suite of compilers [] for AMD64, x86 and ARM.

If you have any experience or thoughts about Go, please share them in the comments!

VN:F [1.9.18_1163]
Rating: 0.0/10 (0 votes cast)

How to choose a text editor for programming

How to choose a text editor for programming

Nowadays there are tons of IDEs (integrated development environments) and text editors designed specifically for programmers. Of course, a simple editor (e.g. Notepad) will always work fine, but if you are looking for a more sophisticated approach to programming and most of all – if you are going to spend a lot of time using a given programming language, it is best you choose an IDE/editor.

When choosing the proper tool one should consider the two options – IDE or editor. IDEs provide a lot more language specific functionality like autocomplete, code refactoring, compiler/interpreter, etc. while on the other hand editors provide (at best) syntax highlighting, indentation, autocomplete of keywords and some other basic features. However, editors are easier to get used to, easier to master and are the best choice for inexperienced users (and for a great part of the interpreted languages). In this article we will present you with what we think is the best approach to choosing an editor. If you have experience and prefer using an IDE, have a look at this article.

While we are still at the beginning, we should note that we expect from the reader to have already chosen the language(s) he will use and is quite aware to what extent he will use the language, that is to say he should know will he write “Hello World!”s or will he “go deeper”.

Good places to search for a text editor are Open Source indexing sites and web-based source code repositories (e.g. You would be surprised at the variety of choices. Look for editors that are suitable for you platform. Find editors that are specifically written for the language of your choice or support it. Read user comments regarding those editors that match your criteria.

Try the two classic choices – Vim and Emacs. Using either of them is pretty much like driving a car – you start it, have no idea what are you doing, get used to it and start driving. And similar to driving a car you can drive it at 200 mph or do drifts, etc. Or alternatively, you can drive around peacefully without maxing out your editor’s performance.

If Vim and Emacs are a bit too much for you, you can try simpler editors. Still try not to make compromises with your tool. If other editors don’t provide the minimum features you require, don’t put up with them, prefer the more complex ones – it is better to spend a day learning how to use a new tool than too lose a lot more time making up for the bad tool’s flaws. For example, if you are going to use Python, the least your editor should provide is syntax highlighting and indentation.

If you are a Windows user, take a look at Notepad++. It is a wonderful editor with syntax highlighting for many languages, indentation, it supports multiple files open in tabs or in different instances, split screen and many more. You can even create your own highlighting rules if the language is not supported (although I have used that feature only when I wrote in Scheme). You can customize your highlighting (change colors, etc.) and it is completely free.

Plan ahead. Choose an editor that will suit your needs for as long as possible, because the whole switching tools process is kind of hard. Still try not to plan too much ahead. If you are a beginner, try to choose something that you will become familiar with fast, otherwise your chosen editor may be confusing. Later you can choose a more complex editor.

If you have used a different editor before and want one with more functionality or you have used complex editors for other languages, choose a complex editor, language-specific or not.

Finally if you want more advanced features like code completion, project management or refactoring, maybe an IDE is the better choice for you.
Read the rest of this entry »

VN:F [1.9.18_1163]
Rating: 0.0/10 (0 votes cast)

Introduction to JavaScript Pop Up Boxes

Boxes of joy
As annoying as they may be, JavaScript popup boxes are a good way to alert users to some relevant information, confirm a user’s decision, or collect some text input from a user. JavaScript offers three popup boxes to help us accomplish this. They are the alert box, the confirm box, and the prompt box which prompts the user to input some text. Let’s take a closer look at what these boxes can do for us.

The alert box
If you want to be absolutely sure that some information gets through to a user, you may want to try using an alert box. This is a simple (slightly annoying) but effective way of getting your message across. The syntax for an alert box is alert(“……..”); and is very easy to implement in your code. Have a look at the following code:

<html><head><title> Alert Boxes </title><script type="text/javascript">function showAlertBox(){alert(" Yay! My first alert box ") };</script></head><body><input type="button" onclick="showAlertBox();" value="Show Alert box" /></body></html>

As you can see above, we’ve created a function called ShowAlertBox(). All this function will do is make an alert box popup with the text that we specify in our alert() method. With an alert box, the user will have to click ok to proceed. Save the above code to your desktop as alertboxes.html, load it up into your browser, and click the button. You should see an alert box appear in the center of the screen. Fun, right? Let’s move on to our next oh so amazing box, the confirm box.

The Confirm Box
Similar to the alert box, the confirm box will pop up in the center of the screen once it is called. The main difference is that, unlike the alert box, the confirm box allows a user to select yes or no, and will return a value of true or false based on which option they’ve selected. Combining this with the alert box and an if statement, our next code example will popup a confirm box for the user,and then alert them to which option they’ve chosen. Here’s what the code looks like:

<html><head><title>Confirm Boxes </title><script type="text/javascript">function showConfirmBox(){var c = confirm("Would you like to continue"); if (confirm == true) { alert ("You clicked Ok"); } else { alert("Ahhh, you clicked Cancel"); }};</script></head><body><input type="button" onclick="showConfirmBox()" value="Show Confirm box" /></body></html>
As you can see, this is very similar to the alert() function, except, once again, it gives the user an option to select either OK or Cancel.

The Prompt Box

The prompt box creates a popup box that a user may enter text into. If we set the value of the prompt box to a variable, we can take the text that the user provides and use that to manipulate our program. In this example, we’ll prompt the user to enter their name. Once that’s done, we’ll take the name and write it back out to the screen with a warm and fuzzy greeting using document.write(). Let’s take a look at the code to see how it works:

<html><head><title>Prompt Boxes </title><script type="text/javascript">function getName(){ var name = prompt("What is your name"); var theDiv = document.getElementById(”greeting”); theDiv.innerHTML = "Hello, " + name + " How are you today?";};</script></head><body><div id="greeting"> </div><input type="button" onclick="getName()" value="Enter your name" /></body></html>

Running this script and pressing the “enter your name” button will result in an oh-so-awesome prompt box being presented to you, and if you enter your name, you’ll be cordially greeted by the browser. Two quick things to point out. One is that I’ve used the getElementById() method on the document. This tells JavaScript to scan the entire current document and find any element with the ID that I’ve specified. Get used to this one, you’ll use it a lot. In our case, the method returns the div element with the ID of greeting. Once JavaScript finds the right div, it takes the name from our prompt box and injects it, along with some other friendly text, into the div via the innerHTML attribute.

Final thoughts

We’ve now seen how we can alert a visitor to something important in our program, how to confirm that they’d like to perform an action, and how to accept a text input from them. These tools will come in plenty handy in the future, and are just plain fun to mess around with anyway. Now, I think it’s a good time to learn about unobtrusive javascript. This notion basically states to you should never use JavaScript to be a jerk. Repeated pop ups and alerts will only shy your users away, so be sure to implement these techniques only when needed. Join me in my next tutorial for a more thorough look at JavaScript functions, what they accomplish, and how to write your own. See you then! Read the rest of this entry »

VN:F [1.9.18_1163]
Rating: 0.1/10 (11 votes cast)

How to lock and unlock a folder using simple bat files in Windows

There are many ways to protect your files and folders in Windows. Most of them require additional software, but there are a few that don’t require anything like that. Of course, it should be noted that normally most of those tricks don’t work against someone who knows them.
In this short tutorial we will show you how to create a folder, a key which locks it, a key which unlocks it and a key which does both.
So let’s start.

First we start in the folder C:\\Users\\D\\Desktop\\folder
Read the rest of this entry »

VN:F [1.9.18_1163]
Rating: 8.3/10 (4 votes cast)

Using HTML lists

Every webpage – from the simplest to the most complex one has lists in it. Using HTML you can create both ordered and unordered lists: Read the rest of this entry »

VN:F [1.9.18_1163]
Rating: 0.0/10 (0 votes cast)

How to write upside down text

Perhaps you have noticed a new trend in comments and posts – writing upside down. Have you ever wondered how people do it? Well wonder no more.
Upside down text, actually is not upside down. Actually people use special Unicode symbols which are an upside down version of normal symbols.
And it is actually quite easy.

For example easily turns to:
Read the rest of this entry »

VN:F [1.9.18_1163]
Rating: 0.0/10 (0 votes cast)

HTML Tutorial (Part 1)

HTML is a language for creating Web pages

– HTML stands for Hypertext Markup Language
– HTML is not programming language
– HTML tags used so-called to describe web pages

HTML tags are keywords surrounded by angle brackets.
Tags indicate what action the browser to display.Te are two types:

– opening
– closing

each opening tag has a corresponding closing. Tags must be closed in the order in which they open. Read the rest of this entry »

VN:F [1.9.18_1163]
Rating: 0.0/10 (10 votes cast)

Upload Files with PHP

With PHP, you may already know, it is possible to upload files on the server with PHP. This lesson will show you in detail how this can happen.

Initially you will need an HTML form for selecting a file such as the example: Read the rest of this entry »

VN:F [1.9.18_1163]
Rating: 0.5/10 (10 votes cast)

100% DIV height with CSS

The latter standards do not allow the use of height 100% (height: 100%), leading to major headaches in the realization of many of the designs. Of course designers prefer to use the entire field of view, even if there is not enough content to fill it and this led to major headaches for developers. Options for implementation are two, one is to use javascript, and other using height: 100% although it is not allowed. Of course, both options have several drawbacks. Read the rest of this entry »

VN:F [1.9.18_1163]
Rating: 1.8/10 (12 votes cast)

HTML Photo Gallery Tutorial

How to create a flash photo gallery and output with HTML code for website? This tutorial will not teach you how to program HTML or XML to make html photo gallery but introduce how to make it in a simple way! Read the rest of this entry »

VN:F [1.9.18_1163]
Rating: 0.0/10 (10 votes cast)