Logicationz Tech

More Intelligent Solutionz…!

Facts of Google’s Go Programming Language

Its Google time!! Google has introduced a new open source programming language named as Go. The initial design of Go was started in September 2007 by Robert Griesemer, Rob Pike and Ken Thompson and was officially announced in November 2009 which is compatible in Linux and Mac Operating system. Go is a expressive, concurrent, garbage-collected systems programming language. Google’s Words : Go is experimental to combines the performance , security benefits associated with C or C++ programming language and the speed of a dynamic language like python that means its Python Meets C++. Compilation of the code runs closer to C , even large binaries compile in just a few seconds.

Features not included in Go: 1. Exception handling 2. Type inheritance 3. Generic programming 4. Assertions 5. Method Overloading.

Learning of every language starts with a Program “Hello World“:

package main import fmt “fmt” // Package implementing formatted I/O. func main() { fmt.Printf(“Hello worldn”); }

The syntax of Go is very similar to C Programming language except the declarations type, other syntactical differences are , Go are missing parentheses around if and for expressions. Go is concurrent programming language but unlike to occam or Limbo (concurrent programming languages) , Go does not provide any in-built notion of safe or verifiable concurrency. Go has some feature of Pi calculus like channel passing.

In Summary , Go Programming Language is a..

  • simple
  • fast
  • safe
  • concurrent
  • fun
  • open source

Final words of Google : We are hoping Go turns out to be a great language for systems programming with support for multi-processing and a fresh and lightweight take on object-oriented design, with some cool features like true closures and reflection.

 

To know more about programming , php info , php editor , programming php ,Open-source , php help and php script , subscribe to our feed by entering email address below. You will get updates via email about every tutorial posted on this site . It will not take more than a sec.

Advertisements

January 3, 2010 Posted by | Google | , | 2 Comments

The Ternary Operator – Working same as If-Else

We know, in programming there are three operators named Unary Operator , Binary Operator and Ternary Operator.

Operator’s name itself says that if it is a Unary Operator(e.g. Increment – Decrement operators) than it will take only one operand, If it is Binary operator(e.g. Relational operators) than it will take two operands and if it is Ternary operator than it will take three operands.

As discussed above, Ternary operator takes three operands – a condition, a result for true, and a result for false. It works similar to IF statement. Ternary operator will compact the 4-5 lines of code(IF statement) in to single line. This makes a difference when you will work with big application and writing thousand lines of code.

Look at below links for solutions.

Look at the below example of IF condition code in PHP.

if($a>$b)
{

echo “$a is greater than $b”;
}
else
{
echo “$b is greater than $a”;
}

Now same thing can also be done by Ternary operator.

echo $a>$b ? “$a is greater than $b” : “$b is greater than $a” ;

To know more about programming,MYSQL database,php info,php editor,programming php,Open-source,php help and php script , subscribe to our feed by entering email address below. You will get updates via email about every tutorial posted on this site . It will not take more than a sec.

January 3, 2010 Posted by | Helpful Tips and Tricks | , | Leave a comment

Merging Arrays with Reindex and without Reindexing

Hello Friends,

All we know about array_merge(param1,param2) array function in PHP. It may be possible that some begineers didn’t come across this function. For those people, array_merge(param1,param2) will merge two arrays and reindex all elements in array.

<?php

   $merged_array = array_merge($firstarray,$secondarray);

?>

Above code will merge both array ($firstarray and $secondarray) in $merged_array and reindex all element starting from zero index.

But there are some cases in which you need to keep the same indexes(preserve numeric keys) of this arrays in newly created merged array. For this situation you can’t go for array_merge function. You can simply use ‘+’ operator and it will append both arrays without reindexing elements.

<?php

   $merged_array = $firstarray + $secondarray;

?>

This are the two ways in which you can merge two arrays with reindexing and without reindexing.Look at below links for solutions.

To know more about programming,MYSQL database,php info,php editor,programming php,Open-source,php help and php script , subscribe to our feed by entering email address below. You will get updates via email about every tutorial posted on this site . It will not take more than a sec.

January 3, 2010 Posted by | Helpful Tips and Tricks | , | Leave a comment

How to remove index.php from url using .htaccess (mod_rewrite)

For better SEO optimization and make urls more search engine friendly , remove index.php from URL and make it easier to read.

This can be done by writing only two lines in your .htaccess(mod_rewrite in apache) file. Before writing this rule in .htaccess , make sure that your mod_rewrite is enabled(On) in your apache server. Most probably mod_rewrite is enabled in Linux server but for windows server , you need to contact hosting people to make mod_rewrite enabled. You can check this by looking in phpinfo().

Below is the Rules which will remove index.php from URL using .htaccess. Look at below links for .htaccess rules.

 

RewriteCond %{THE_REQUEST} ^[A-Z]{3,9} /index.php HTTP/

RewriteRule ^index.php$ http://www.%{HTTP_HOST}/ [R=301,NS,L]

Redirect 301 means Moved Permanently so most search engines will remove index.php from URL.

To know more about programming,MYSQL database,php info,php editor,programming php,Open-source,php help and php script , subscribe to our feed by entering email address below. You will get updates via email about every tutorial posted on this site . It will not take more than a sec.

January 3, 2010 Posted by | Helpful Tips and Tricks, htaccess | , , | 1 Comment

For vs Foreach – Difference between For and Foreach

You must familiar with all loops if you are a programmer/developer. There are so many loops available and you can select appropriate one when you develop an application. I found For and Foreach loops almost same. I googled for finding the difference between For and Foreach(For Vs Foreach) but didn’t get any clear idea. Here i am sharing my knowledge about some of difference between For and Foreach loop.

For can be used to run statements for a fixed number of times, foreach can be used to run statements for dynamically generated arrays(may be result of database query).We can also used for loop for dynamically generated array(may be result of database query) but foreach is the ideal way to iterate dynamic array. The reason behind this, we don’t know the index of array as it may be associate result from database query. So if we use foreach than it will iterate the result one by one.

Look at below links for more results.

Foreach will works only and only with arrays.For will works for any logical operation and i will continue until given condition fails.There is not much execution time difference. They works almost same way and same speed as foreach loop will takes time for getting next element while iterating array while for loop will takes time to re-initialize the variable.

In Summary, For loop can be more optimized if we know the count of array and index of array while foreach is better when we have dynamic array without knowing index of array and size of an array.

To know more about programming,JavaScript issues,jQuery,Expression Engine,MYSQL database,php info,php editor,programming php,Open-source,php help and php script , subscribe to our feed by entering email address below. You will get updates via email about every tutorial posted on this site . It will not take more than a sec.

January 3, 2010 Posted by | Helpful Tips and Tricks | | Leave a comment

How to redirect www to non-www and non-www to www URL using .htaccess (mod_rewrite)

Websites can be access with www and without www also. Since Search engines consider http://www.logicationz.com and http://logicationz.com different websites, it might be a case of duplicate content. So you must stick your domain name accessible either with www or without www.

This can be done by writing only two simple lines in your .htaccess file(mod_rewrite in apache). Before writing this rules in .htaccess , make sure that your mod_rewrite is enabled(On). Most probably mod_rewrite is enabled in Linux server but for windows server you need to contact hosting people to make mod_rewrite enabled. You can check this by looking in phpinfo().

Below is the Rules which will redirect all www requests to non-www URL.

RewriteCond %{HTTP_HOST} ^www.logicationz.com$ [NC]
RewriteRule ^(.*)$ http://logicationz.com/$1 [R=301,L]

Redirect 301 means Moved Permanently so most search engines will send visitors directly to the www version of your URL.

Below is the Rules which will redirect all non-www requests to www URL.

RewriteCond %{HTTP_HOST} ^logicationz.com [nc]
RewriteRule (.*) http://www.logicationz.com/$1 [R=301,L]

Redirect 301 means Moved Permanently so most search engines will send visitors directly to the non-www version of your URL.

What you need to do is just replace logicationz with your domain name. Look at below links for more .htaccess rules.

google_protectAndRun(“ads_core.google_render_ad”, google_handleError, google_render_ad);

January 3, 2010 Posted by | htaccess | Leave a comment