Cdsrc will summarize the popularity in programming languages in the early 2008. This list is based on TIOBEs programming community index.
To summarize it first: Java is leading. If you take both C and C++, they would have the lead, so our conclusion is that C/C++ is slightly more popular then Java. This list is basicly based on how much resources there are available for each language which means that languages such as PHP get lots of attention. Even though PHP is a very popular language, it has it’s drawbacks when it comes to perfomance issues which means that it can never be used in a high-performing software.
The language “Lua”, which most people never heard of became known when they included it in WoW (World of warcraft). You can script some simple scripts to increase your abilities (your own, not your characters) in WoW.
Visual Basic has also made an increase through the last months, possibly because of Windows Vista. Another interesting jump was made by Python. Python has passed both Perl and C# and the curve is showing even further increases.
The language with the most interesting future could be Ruby, which has backed down a little bit, but has a lot of interesting techniques that got to get rewards at some time.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | Java 20.849% C 13.916% (Visual) Basic 10.963% PHP 9.195% C++ 8.730% Python 5.538% Perl 5.247% C# 4.856% Delphi 3.335% JavaScript 3.203% Ruby 2.345% PL/SQL 1.230% SAS 1.204% D 1.172% COBOL 0.932% Lua 0.579% FoxPro/xBase 0.506% Pascal 0.456% Lisp/Scheme 0.413% Logo 0.386% |
This was the list of the top 1-20, now to be followed by the 21-50:
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 | ColdFusion 0.353% ActionScript 0.342% Ada 0.337% Fortran 0.305% RPG 0.251% MATLAB 0.241% Awk 0.213% Prolog 0.212% ABAP 0.195% LabView 0.169% Groovy 0.168% Transact-SQL 0.155% Smalltalk 0.133% Bash 0.133% Tcl/Tk 0.130% Haskell 0.119% Forth 0.116% CL (OS/400) 0.114% Natural 0.105% ML 0.092% Focus 0.091% Ch 0.088% PL/I 0.088% Lingo 0.087% Factor 0.084% REXX 0.075% Objective-C 0.071% 0.059% Erlang 0.057% VBScript 0.056% |
The TIOBE company has an own list of programming language popularity where you can check programming language popularity.
This list is not even near 100% accurate but gives you a very good hint of which language to use and more likely which language to NOT use when developing an advanced software. The index itself is built upon a not so sophisticated method, which is basically to search the major search engines with this term:
+”<language> programming”
and count the number of hits received.
That’s why the list is not that accurate but it still gives you a rough estimate of which languages that are growing and which are not.
The top 20 popular programming languages in September 2007 is (the % is of total market share):
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | Java 21.701% C 14.908% Visual Basic 10.748% PHP 10.204% C++ 9.938% Perl 5.416% C# 3.583% Python 3.025% Javascript 2.722% Ruby 2.065% PL/SQL 1.860% SAS 1.395% D 1.370% Delphi 1.224% ABAP 0.706% Lisp/Scheme 0.633% COBOL 0.630% Lua 0.572% Ada 0.566% Fortran 0.478% |
To notice from the source both c++ and c is falling in line, although it’s not much. You can also note that PHP is actually more popular then C++. This could be because of PHP’s simplicity compared to C++ which generate more “newbie-questions” about PHP rather then C++.
The top climber, Lua, is not a very known programming language. Lua is most known for homebrewed software for Playstation Portable and Nintendo DS. On a later matter, the language has been used to create scripts in World of Warcraft, which most likely is the reason for the huge climbing (thanks Sickwookie comment #1). The language itself is claimed to be a mix of Python, Icon, Scheme and Lips.
The list from 21-50 can is here (the % is of total market share):
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 | Transact-SQL 0.452% Pascal 0.429% ActionScript 0.407% FoxPro/xBase 0.387% Awk 0.383% MATLAB 0.364% IDL 0.326% Prolog 0.313% ColdFusion 0.297% Logo 0.249% Bash 0.221% RPG 0.198% Tcl/Tk 0.187% LabView 0.178% Haskell 0.147% Smalltalk 0.145% CL (OS/400) 0.133% Forth 0.119% Natural 0.116% Erlang 0.109% VBScript 0.102% APL 0.101% REXX 0.088% Objective-C 0.084% OCaml 0.082% Icon 0.079% Postscript 0.076% Lingo 0.075% ML 0.074% R 0.072% |
SimpleXML intro:
PHP4 had one pretty big drawback when you had to use external libraries to parse XML files. PHP5 had a number of XML libraries that solve this problem and one of the easiest is SimpleXML.
To test and use the function, a XML document is needed.
In this post we will use our own sitemap, located here: http://cdsrc.com/sitemap.xml.
As we write this (the document will change in future since it’s a sitemap), the document looks like this:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 | <?xml version="1.0" encoding="UTF-8"?> <?xml-stylesheet type="text/xsl" href="http://cdsrc.com/wp-content/plugins/google-sitemap-generator/sitemap.xsl"?> <urlset xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.sitemaps.org/schemas/sitemap/0.9 http://www.sitemaps.org/schemas/sitemap/09/sitemap.xsd" xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"> <url> <loc>http://cdsrc.com/</loc> <lastmod>2007-09-10T11:31:33+00:00</lastmod> <changefreq>daily</changefreq> <priority>1.0</priority> </url> <url> <loc>http://cdsrc.com/programming/php-random-password-generator-function.html</loc> <lastmod>2007-09-10T11:31:33+00:00</lastmod> <changefreq>monthly</changefreq> <priority>0.3</priority> </url> <url> <loc>http://cdsrc.com/programming/php-and-database-space-saving-tips.html</loc> <lastmod>2007-09-09T13:06:17+00:00</lastmod> <changefreq>monthly</changefreq> <priority>0.2</priority> </url> <url> <loc>http://cdsrc.com/linux/linuxbiggerthanwindows.html</loc> <lastmod>2007-09-09T12:45:00+00:00</lastmod> <changefreq>monthly</changefreq> <priority>0.3</priority> </url> </urlset> |
The documents structure is pretty easy to understand. All URL’s has a
There are a couple of methods you can use to load the XML file, one of them are to use file_get_contents() and another one, which we will use, will be shown here:
1 2 3 4 5 6 7 8 | <?php $url_location = 'http://cdsrc.com/sitemap.xml'; $sitemap = new SimpleXMLElement($url_location,null,true); foreach($sitemap as $url) { echo "Url: {$url->loc}<br />Lastmod: {$url->lastmod}<br />Changefreq: {$url->changefreq}</br>Priority: {$url->priority}<br /><br />"; } ?> |
There are no necessary comments to this as the code is pretty simple to understand. You access the “subfields” using $url->”subfield” and the counter goes through all the posts in the whole sitemap.
If we now would execute that script, we will get this output:
Url: http://cdsrc.com/ Lastmod: 2007-09-10T11:31:33+00:00 Changefreq: daily Priority: 1.0 Url: http://cdsrc.com/programming/php-random-password-generator-function.html Lastmod: 2007-09-10T11:31:33+00:00 Changefreq: monthly Priority: 0.3 Url: http://cdsrc.com/programming/php-and-database-space-saving-tips.html Lastmod: 2007-09-09T13:06:17+00:00 Changefreq: monthly Priority: 0.2 Url: http://cdsrc.com/linux/linuxbiggerthanwindows.html Lastmod: 2007-09-09T12:45:00+00:00 Changefreq: monthly Priority: 0.3
Thats a very great and easy way of using the “new” SimpleXML PHP 5.0 function!
Here’s a random password and string generator function for PHP.
It is totally free of use.
randpass(); Will give you a 8 characters long randomized string with numbers and letters.
The function also takes these arguments:
$numchars <-- The length in characters for the returned string.
$digits <------ Should the generated password contain figures? 1/0
$letters <----- Should it contain letters? 1/0
$sensitive <--- Both upper and lower letters? 1/0
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 | function randpass($numchars=8,$digits=1,$letters=1,$sensitive=0) { $dig = "12345678901234567890"; $abc = "abcdefghijklmnopqrstuvwxyz"; if($letters == 1) { $str .= $abc; } if($sensitive == 1) { $str .= strtoupper($abc); } if($digits == 1) { $str .= $dig; } for($i=0; $i < $numchars; $i++) { $randomized .= $str{rand() % strlen($str)}; } return $randomized; } |
To give an example of the code:
24 25 | echo "Generated password: \n"; echo randpass(12,1,1,1); |
The code above will result in:
Generated password: 4C8cly61h907
There are plenty of database space-saving functions out there and PHP has included some of them already. These two functions (or four actually) are already in the standard library which means that you got no reason to ignore them.
* Use ip2long() and long2ip() to store the IP adresses as Integers instead of storing them as strings, which will reduce the space from 15 bytes to 4 bytes. This will also increase search speed and make it easy to see if a ip falls within a specified range.
* Use gzcompress() and gzuncompress() to reduce the strings before you store them in a database. The gzcompress can compress plain-text up to 90%. The only reason why you shouldn’t use it is when you need full-text indexing capabilities.