Posts

Showing posts from November, 2012

Runtime vs. memory usage

Oftentimes, better runtime can result in higher memory usage. Here is an example to create some strings to test bulk inserts on Redis: $cmd = ""; $start = microtime(true); for ($i=0; $i<1000000; $i+=2) $cmd .= "SET entity:".$i.":key value_".($i+1)."\r\n"; echo number_format(microtime(true)-$start, 1)."s\n"; // 0.7s echo number_format(memory_get_usage(true)/1048576, 1)." MB\n"; // 17.5 MB echo number_format(memory_get_peak_usage(true)/1048576, 1)." MB\n"; // 17.5 MB $cmd = ""; $start = microtime(true); $cmd = vsprintf(str_repeat("SET entity:%d:key value_%d\r\n", 500000), range(0,1000000)); echo number_format(microtime(true)-$start, 1)."s\n"; // 0.4s echo number_format(memory_get_usage(true)/1048576, 1)." MB\n"; // 30.8 MB echo number_format(memory_get_peak_usage(true)/1048576, 1)." MB\n"; // 128.5 MB (PHP 5.4.5, 2.5 GHz, win64) We see that the same result can be c...

Developers's time of permanency is 15 years?

Image
This article is not about performance of PHP, but more about performance of developers in general. A nice article from golem.de claims that the developers's time of permanency is - exactly - 15 years. The main facts of the article: developers have abrasion like professional athletes No: Developers don't require fast running, much muscle power or intensive training. Of course, getting older does not mean getting healthier, but health care improves every year and people are getting older and older. The key success factors are more talent and motivation than age. Also, older athletes produce more money with marketing than younger ones. developers at the age of 20 bring more money than older developers Yes, if the business is selling developers by hour/day and quality (number of bugs, wrong architecture decisions, usability, performance) does not matter. Young developers without a final degree and without working experience normally have lower salaries. No in all other case...

A three-line guestbook in PHP

Below you can see a short script that causes to write somthing you enter a form to a file. Each entry is appended in new line. <form method=post><input name=a><input type=submit></form> <?php if($_POST['a'])file_put_contents('z.txt',$_POST['a']."\n",FILE_APPEND);

Error while enabling windows feature NetFx3

Image
Recently, I tried to install SQL 2012 express edition on a Windows 8 OS running inside VMware. Installation wizard is very much the same as SQL 2008, so I thought it's going to be pretty smooth. With several Next  clicks, my installation process started. BUT :( it got aborted with following error: The following error has occurred: Error while enabling windows feature : NetFx3, Error Code : -2146498298. Reason: ========================================================= Installation process requires .NET framework 3.5, which is generally not installed along with windows. However, it is available in Turn Windows Features On/Off option. Most likely this will be unchecked if you are getting NetFx3 installation error. You'd be tempted to quickly check and try install this component. It shows 2 options - Install from a disc or install from internet. If you try later option, it will fail (I don't know reason but you'd see a generic error message). Check following resolution for ...

Free php pdf tutorial

Image
People are searching for free php pdf tutorials because they want to learn php from home without having internet connection. This way is very efficient to develop one's skill in php. So that people's are looking for free php pdf tutorials in the internet but they don't able to find php pdf tutorials because most of the php pdf tutorials are not free. To give you some help in our php tutorial blog we provide you all php tutorials and resources without any costs. You can download our php pdf tutorials free from our website. We try to provide you php tutorials in pdf format and also in step by step manner. We divided our whole tutorials into three parts such as php pdf tutorials for beginners, advanced php pdf tutorials and object-oriented php pdf tutorials. Here we give you some brief about our all php pdf tutorials.  PHP PDF TUTORIALS FOR BEGINNERS In this section you can easily download our php beginning pdf tutorials . So let me show you the contents of our beginning...

PHP beginners pdf tutorials free download

In this PHP tutorial section we are trying to provide you All pdf php tutorial for that you can learn PHP from home. This php pdf tutorials are free for all. Just download our PHP tutorial from media-fire link. Sometimes you feel bored or you are not get in touch with internet at this time you can open our pdf php tutorials and easily learn php without having internet.  Free PHP pdf tutorial:  We devided our whole pdf tutorial into three parts. In this part we will provide you beginners php PDF tutorials with media-fire link. So lets start and download our PHP pdf beginners tutorial. Here is the list of our beginners php tutorials.  Starting with PHP web development.pdf PHP intallation.pdf ZAMPP installation.pdf Vertrigo server installation.pdf What is PHP.pdf Writing your first php script.pdf PHP variable.pdf PHP comments.pdf PHP operators index.pdf PHP arithmetic operator.pdf PHP assignment operator.pdf PHP comparison operator.pdf PHP increment and decrement operator...

PHP increment and decrement operators

In PHP the ++ and the -- sign are increment and decrement operators. Increment means increase and decrement means decrease that means increment operator increase the variable value and decrement operator decrease the variable value. The PHP increment operator increases it's variable value by one and the PHP decrement operator decreases it's variable value by one . Suppose that we have a variable $x. We want to increase it's value one. Consider the statement below  $x=10 but we want to increase it's value one so that the new form is  $x=$x+1 We can rewrite this by using PHP increment operator :  $x++; Similarly in PHP decrement operator we can write $x--;  Each PHP increment and decrement operators has two types:  (++$x) Pre-increment : It first increment $x value one and then return the value of $X. ($x++) Post-increment : It first return $x value and then increment the value of $x. (--$x) Pre-decrement : It first decrement $x value one and then return the val...

PHP comparison operators

PHP comparison operator means using PHP operators compare two things or two variable . Suppose that we have two variable $a=10 and $b=20. We have to know which variable is small or big. In that case we use comparison operators. Different types of PHP comparison operators are given below ( == ) Equal : It returns true if $a and $b is same.  ( != ) Not Equal : It returns true if $a and $b is not same.  ( === ) Identical : It returns true when $a and $b is same and same type.  ( !== ) Not Identical : It returns true when $a and $b is not same and same type. ( < ) Less than : Returns true if ($a<$b) $a is less than $b.  ( > ) Greater than : Returns true if ($a<$b) $a is greater than $b.   PHP comparison operators first check the condition then return true or false. If true then execute the program otherwise not execute the program. Now take a look at the example below <pre class=”brush: php;”> <? php $a = 10 ; $b = 20 ; $c = 10 ; echo ( $a ==...

Applying Scrum to legacy code and maintenance tasks

There are some problems with Scrum that mainly occur when dealing with third party components or legacy systems: wrong estimations (time, impact, risk, complexity) bad requirements (inconsistent, incomplete, testable, conflicting, faulty) development involved in operations (bug analysis, data correction, deployment, hot-fixes) delays in development (bugs in legacy system, missing documentation) testing (quality/quantity of test cases, un-mockable interfaces, long running offline processes, performance issues, live and test system differ) General problems with Scrum: development (gold plating, rework, misunderstandings and bugs from collective code ownership) estimations (missing experience, excessive estimations for unpleasant stories) technical debt vs. velocity (architecture violations save deadlines) performance (stories are functional requirements, performance is normally no acceptance criteria, often only specified as "system should be fast and responsive") testing (t...

PHP assignment operators

PHP assignment operators are used to assign value in a variable such that we can assign value 10 in a variable $a like that $a=10. Now the value of $a is 10 because we assign 10 in variable a. equal (=) sign is used to represent PHP assignment operator but in array we use => sign to assign value. Now take a look at an example of PHP assignment operators. <?php $a = 20; echo $a; ?> Save and run the above code. We can use PHP arithmetic operator in PHP assignment operator. Here is an example: <?php $a=10; $a+=10; echo $a; ?>

PHP arithmetic operators

When you were start your first math learning, I am sure you have used + sign, - sign, * and / sign. These sign are used in PHP as a arithmetic operator. Different kinds of PHP arithmetic operators are + operator, - operator, * multiply operator, / division operator, % modulus operator. Here we describe its clearly. (+) Addition Operator: Using this operator we can add two value such that $a + $b or 12+15=27. (-) Subtraction Operator: Using this operator we can subtract two value such that $a - $b. (*) Multiply Operator: We call * sign is multiply operator in PHP. Multiply operator is used for multiplication such that 12*2=24. (/) Division Operator: To find quotient we use PHP division operator. For an example, 12/2=6. (%) Modulus Operator: We find remainder from two variable we use PHP modulus operator. For an example, 12%2=0. PHP Arithmetic Operator Example:   Let's try an example where we have used all PHP arithmetic operators. <?php echo (2+8); // Addition echo "...

PHP Operators Index

PHP operators are used to compare two values. It is an expression that takes one or more values and produce another value such that $a+$b where + sign is an operator and a, b are two variable. PHP operators are two types:  Unary Operator and Binary Operator Unary Operator: Unary means one. PHP unary operator can take only one value, for an example ++,-- operator. We use ++ operator to increment value and -- operator to decrement value.  Binary Operator: Binary operator can take two value such that + operator, - operator etc. For an example, $a+$b. Some PHP operators are plus + operator, minus - operator, * multiply operator, / divide operator and so on. We can divide all PHP operators into different types. Before entering the dept of our PHP tutorial we need to understand each operator clearly. Here is the lists of all PHP operator. PHP Operators Index: Arithmetic Operators Assignment Operators Comparison Operators Bitwise Operators Incrementing Operators Decrementing Oper...