1. Most of the time, using inheritance is a bad object oriented design in the long run. It reduces reusability and testability of code. Consider using interfaces instead. See No, inheritance is not the way to achieve code reuse!. Related;
  2. Avoid introducing an interface until you are comfortable in your domain. "Premature interfacing" can also lead to design issues down the road.
  3. Deep nested code (both intra-function and inter-function) is 1) harder to maintain and 2) more prone to bugs.
  4. Estimating time is hard. One reason why Scrum and sprints are used in many places.
  5. Proper encryption is hard. Don't invent it yourself unless you have a good reason to.
  6. Side-effect free logic is nice. It makes it easier to reason about state (see below) and generally simplifies automated testing.
  7. Learn to reason around state and lifecycles. See Jens Rantil's Hideout.
  8. Concurrency can be hard without the right primitives. Threadpools, Queues, Observables, and actors can sometimes help a lot.
  9. Premature optimization is the root of all evil. A good general development process is: 1) Get it to work. 2) Make the code beautiful. 3) Optimize.
  10. Know your basic data structures and understand time complexity. It's an effective way of making your code much faster without adding complexity.
  11. Practice back-of-the-envelope calculations. How many items will a piece of code generally hold in memory?
  12. Write code as you want to read it. Add comments where you think you will not understand your code in a year's time. You will need the comment in a month. Somewhat related;
  13. Setup you build tooling around a project so that it's easy to get started. Document the (few) commands needed to build, run, test and package in a README file.
  14. Making sure your projects can build from command line makes things so much easier down the road.
  15. Handling 3rd party dependencies in many languages can be a real mess (looking at you Java and Python). Specifically when two different libraries depend on different versions. Some key things to take away from this: 1) Constantly question your dependencies. 2) Automated tests can help against this. 3) Always fixate which version of a 3rd party dependency you should use.
  16. Popular Open Source projects are a great way to learn about good maintainable code and software development process.
  17. Every single line you add to an application adds complexity and makes it more likely to have bugs. Removing code is a great way to remove bugs.
  18. Code paths that handles failures are rarely tested/executed (for a reason). This makes them a good candidate for bugs.
  19. Input validation is not just useful for security reasons. It helps you catch bugs early.
  20. Somewhat related to above: State validation and output validation can be equally useful as input validation, both in terms of discovering inherent bugs, but also for security sensitive code.
  21. Code reviews are a great way to improve as a programmer. You will get critique on your code, and you will learn to describe in words why someone else's code is good or bad. It also trains you to discover common mistakes.
  22. Learning a new programming language is a great way to learn about new paradigms and question old habits.
  23. Always specify encoding when converting text to and from bytes; be it when reading/writing to network, file or for encryption purposes. If you rely on your locale's character set you are bound to run into data corruption eventually. Use a UTF character set if you can get to choose yourself.
  24. Know your tools; That includes your editor, the terminal, version control system (such as git) and build tooling.
  25. Learn to use your tools without a mouse. Learn as many keyboard shortcuts as possible. It will make you more efficient and is generally more ergonomic.
  26. Reusing code is not an end goal and will not make your code more maintainable per se. Reuse complicated code and be aware that reusing code between two different domains might make them depend on each other more than necessary.
  27. Sitting for long time by the computer can break your body. 1) Listen to what your body has to say. Think extra about your back, neck and wrists. Take breaks if your body starts to hurt. Creating a pause habit (making tea, grabing coffee) can surprisingly be good for your body and mind. 2) Rest your eyes from time to time by looking away from your screen. 3) Get a good keyboard without awkward wrist movements.
  28. Automated testing, and in particular unit tests, are not just testing that your code does was it should. They also 1) document how the code is supposed to be used and 2) also helps you put yourself in the shoes of someone who will be using the code. The latter is why some claim test-first approach to development can yield cleaner APIs.
  29. Test what needs to be tested. Undertesting can slow you down because of bug hunting. Overtesting can slow you down because every change requires updating too many tests.
  30. Dynamic languages generally need more testing to assert they work properly than compiled languages. (Offline code analysis tools can also help.)
  31. Race conditions are surprisingly more common than one generally thinks. This is because a computer generally has more TPS than we are used to.
  32. Understanding the relationship between throughput and latency can be very useful when your systems are being optimized. Related;
  33. Many times high throughput can be achieved by introducing smart batching.
  34. Commit your code in small, working, chunks.
  35. Keep your version control system's branches short-lived. My experience is that risk of failures increases exponentially the longer a branch lives. Avoid working on a branch for more than two weeks. For large features, break them into multiple refactoring branches to make the feature easier to implement in a few commits.
  36. Know your production environment and think about deployment strategies for your change as early as possible.
  37. Surprisingly, shipping code more frequently tends to reduce risk, not increase it.
  38. Learning an object oriented language is easy. Mastering good object oriented design is hard. Knowing about SOLID and object-oriented Design Patterns will improve your understanding of OO design.
  39. It's possible to write crappy code in a well architected system. However, in a well architected system you know that the crap is isolated and easily replaceable. Focusing on a sane decoupled architecture first. The rest can be cleaned up later if on a tight schedule.

Reference: http://www.huffingtonpost.com/quora/39-best-kept-secrets-of-g_b_7812864.html?utm_hp_ref=tw&ir=India&adsSiteOverride=in
Waiting is one of the most irritating things in the world. I think you would agree that there is nothing worse than standing in a line waiting for your turn to buy something, get the information you need or fill in some forms.


The things are pretty much the same with the Internet. It is also quite irritating waiting for the site to download. As a rule, if the loading speed of the site is too low, visitors just leave it and keep on searching for the required information on other resources. This feature is vital for large websites and online stores, as people doesn’t like to wait, especially when they are about to spend their money.


Google pays much attention to this part. It is, actually, a bit obsessed with the loading speed of the page. Check the article here. There is no wonder that it encourages fast sites that have  a clean code. On this basis digital marketers started using the speed boost as a part of their SEO strategy. However, slow loading pages not only reduce traffic flow but also affect indexation rates that is a key to success for large sites and online stores. For this reason, we are going to take a look at how to make website faster with PageSpeed Insight.

pagespeedinsightslogo
It is also critical to optimize the site and content specially for mobile devices. You should pay much attention to this part as more and more people use tablets or smartphones for browsing on the Internet and having a mobile optimized site is a must have feature.

So, why do some pages load slower than the others and how to optimize website speed? Well, there are many factors that influence on the speed of the site and you can’t point out one particular reason that causes troubles. As a rule, low speed is the result of huge lines of code, not optimized images, internal adjustments of the site, etc. It is enough to fix some of these bugs to improve the performance of the site and make it work more effectively.

As you can see, loading speed is the key to success and it is vital to optimize all pages of the site. Unfortunately, it is almost impossible to do that manually, but there is a variety of  tools that will help you get  the job done. PageSpeed Insights is one of the best and the most powerful apps designed to help developers analyze their pages and make them load  faster. The program measures the performance of the site for both desktops and mobile devices, so you don’t need to check the codes separately. Just enter the URL address in the field and hit “Analyze” button.

PageSpeed indicates the performance of the theme with scores. If the score is above 85, it means that the page performs well. If it is below 85, it is recommended to fix the bugs to make it meet the minimum requirements. Besides that, the program will give you recommendations on what changes are required to make your site work to its full potential.

Each suggestion is indicated with a particular sign: green – means that no bugs are detected, yellow – it is better to fix the troubles, red – some serious troubles that affect the performance are detected. In such a way, you get a full picture of how your site looks from the inside.

pagespeed-one

As it was mentioned above, loading speed is vital for eCommerce sites like online stores and shops. If you run such kind of business, you may also find this tool useful. But still there is a problem. If some troubles are detected, do you have enough time to fix them manually. It is OK if there are not many pages, but how to make a web page load faster if the assortment of you store is pretty wide. It will take you a lot of time to optimize the site. In this case, you should consider purchasing one of the given OpenCart templates that were analyzed and showed pretty high results.

Reference: http://blog.templatemonster.com/2015/06/18/how-to-make-website-faster-with-pagespeed-insight/?utm_campaign=TM+Newsletter+maklaud+2015-06-18&utm_medium=email&utm_source=newsletter
You can discover new libraries to use in your software projects as well as be notified of new releases to keep your applications secure and up to date. 

https://libraries.io/
The below topics we need to cover while learning PHP.
  1. PHP Basics
  2. Strings and String Functions
  3. Basic Arithmetic
  4. Conditions and Loops
  5. Arrays and Array Functions
  6. Processing Form Submissions
  7. Beginning Security, Validation, and Escaping
  8. Cookies, Sessions, and Includes
  9. User Defined Functions
  10. Variable Scope
  11. Beginning Object-Oriented Programming (OOP)
  12. Connecting to and Using MySQL Databases
The below three steps we need to follow up for php installation on windoes 8 operating system.
  1. IIS 8 installation.
  2. Microsoft Web Platform Installer instalation.
  3. PHP installation and configuration with Microsoft Web Platform Installer.

A. IIS 8 Installation

These are steps to activate IIS 8 in Windows 8 :
  1. Run Turn Windows features on or off with choose Settings form charms bar, then choose Control Panel.
  2. In Control Panel window, choose Programs.
  3. In Programs and Features, choose Turn Windows features on or off.

    2831030

  4. Check Internet Information Service and click OK button.

    2819101
After the installation process is complete, we can check whether IIS 8 is installed correctly by running Internet Explorer. In the address bar, type http://localhost. If successful, we see web page like this picture below.

2819102


B. Microsoft Web Platform Installer Installation
Microsoft Web Platform Installer is a simple, free tool that automates the installation of Microsoft's entire Web Platform including PHP. We can download it form this url http://www.microsoft.com/web/downloads/platform.aspx. The name of installer is wpilauncher.exe.

Run wpilauncher.exe and we will see installation status like this picture below.

2819103


After installation is completed, we can see Web Platform Installer 4.0 window like this picture below.

2819104


C. PHP Installation and Configuration

These are step to install and configure PHP with Web Platform Installer :
  1. In Web Platform Installer window, choose Products tab and search PHP version that we will install.
  2. Click Add button as we can see in picture below.

    2819105

  3. After click Add button, we can see there are 2 items that will be installed. By click Items to be installed link, we can see list of those items.

    2819106

  4. Click Install button.

    2819107

  5. Click I Accept button and it will be downloaded item and install them.

    2819108

  6. After the installation process is complete, click Finish button.

 To check whether the installation and configuration are success, we can test it by follow these steps :
  1. Create info.php file and type this code below as content.
    2819109
  2. Copy info.php file to IIS’s root folder in C:\inetpub\wwwroot.
  3. Run Internet Explorer, and type http://localhost/infor.php in address bar.
  4. We will see web page like picture below if all installation and configuration are successed.

    2819110
Internet Information Services (IIS) for Windows® Server is a flexible, secure and manageable Web server for hosting anything on the Web. From media streaming to web applications, IIS's scalable and open architecture is ready to handle the most demanding tasks.
I am doing website design using bootstrap and a need to use mega menu instead of using list menu items in the navigation bar.

For this purpose I found Yamm mega menu will be useful for my site and followed the below steps for the integration.

1. Download Yamm from http://geedmo.github.io/yamm/

After you download extract the zip file (yamm3-master). The following directories will be exists in the extracted yamm3-master directory.
















2. Copy yamm folder and paste it in your website css folder.

3. Include yamm.css in header.html/php file like below

    <link href="css/yamm/yamm.css" rel="stylesheet" type="text/css">

4. Go to yamm directory which you downloaded and open the demo.css from demo directory.

5. Find & copy the below css class and paste it in your website css (yoursite.css) file which is used for your UI Design.

/* menu styes */
.list-unstyled,
.list-unstyled ul { min-width: 120px }

@media ( min-width: 767px ) {
  .panel-group { width: 400px; }
  .thumbnail { margin: 0; }

}

6. Find the navbar css style in header.html/php file and include the yamm class in div tag.

    <!-- Navigation -->
    <nav class="navbar yamm navbar-inverse navbar-fixed-top" role="navigation">

7. Then finally add the mega menu content in menu items like below.

<li class="dropdown"><a href="#" class="dropdown-toggle" data-toggle="dropdown">Services <b class="caret"></b></a>
       
           <ul class="dropdown-menu">
       <li>
    <div class="yamm-content">
                    <div class="row">
                      <ul class="col-sm-4 list-unstyled">
                        <li>
                          <p><strong>Web Designing</strong></p>
                        </li>
                        <li>List Item</li>
                        <li>List Item</li>
                        <li>List Item</li>
                        <li>List Item</li>
                        <li>List Item</li>
                        <li>List Item</li>
                      </ul>
                      <ul class="col-sm-4 list-unstyled">
                        <li>
                          <p><strong>Web Development</strong></p>
                        </li>
                        <li><a href="#"> Link Item </a></li>
                        <li><a href="#"> Link Item </a></li>
                        <li><a href="#"> Link Item </a></li>
                        <li><a href="#"> Link Item </a></li>
                        <li><a href="#"> Link Item </a></li>
                        <li><a href="#"> Link Item </a></li>
                      </ul>
                      <ul class="col-sm-4 list-unstyled">
                        <li>
                          <p><strong>Ecommerce & CMS Solutions</strong></p>
                        </li>
                        <li>List Item</li>
                        <li>List Item</li>
                        <li>List Item</li>
                        <li>List Item</li>
                        <li>List Item</li>
                        <li>List Item</li>
                      </ul>
                </div></div>
</li>
        </ul>
    </li><!-- Services li element-->
                    

I hope this will be helpful for you also to integrate with your website designing.

I am doing web designing using bootstrap. But Internet Explorer 8-10+ refuses to load the CSS files due to "CSS was ignored due to mime type mismatch"

  1. On your computer search for "regedit.exe" (go to the start menu and click on the search button on the top-right corner of the screen).
  2. Once regedit opens up, on the left column click on "HKEY_CLASSES_ROOT" and then on ".css"
  3. On the right column double-click on "Content Type". This will open up a dialog box with value as application/x-css.
  4. Change this "value data" to "text/css".
  5. Click "Ok" and that's it.
1. The array() function is used to create an array
2. The array_change_key_case() function changes all keys in an array to lowercase or uppercase.
3. The array_chunk() function splits an array into chunks of new arrays.
4. The array_combine() function creates an array by using the elements from one “keys” array and one “values” array.
5. The array_count_values() function counts all the values of an array.
6. The array_diff() function compares the values of two (or more) arrays, and returns the differences.
7. The array_fill() function fills an array with values.
8. The array_merge() function merges one or more arrays into one array.
9. The array_shift() function removes the first element from an array, and returns the value of the removed element.
10. The array_pop() function deletes the last element of an array.

<?php

$cars = array("Volvo", "BMW", "Toyota");
echo "<br>:: array() function ::<br>";
echo "I like " . $cars[0] . ", " . $cars[1] . " and " . $cars[2] . ".";

echo "<br>-----------------------------------------";

$cars = array("Volvo", "BMW", "Toyota", "Honda", "Mercedes", "Opel");

echo "<br><br>:: array_chunk() function :: </br>";

print_r(array_chunk($cars, 2));

echo "<br>-----------------------------------------";


$fname = array("Peter", "Ben", "Joe");

$age = array("35", "37", "43");

echo "<br><br>:: array_combine() function :: </br>";

$c = array_combine($fname, $age);

print_r($c);

echo "<br>-----------------------------------------";

$a = array("A", "Cat", "Dog", "A", "Dog");
echo "<br><br>:: array_count_values() function :: </br>";
print_r(array_count_values($a));

echo "<br>-----------------------------------------";

$a1 = array("a"=>"red", "b"=>"green", "c"=>"blue", "d"=>"yellow");

$a2 = array("e"=>"red", "f"=>"green", "g"=>"blue");

$result = array_diff($a1, $a2);
echo "<br><br>:: array_diff() function :: </br>";
print_r($result);

echo "<br>-----------------------------------------";

$a1 = array_fill(3, 4, "blue");

$b1 = array_fill(0, 1, "red");
echo "<br><br>:: array_fill() function :: </br>";

print_r($a1);
echo "<br>";
print_r($b1);

echo "<br>-----------------------------------------";


$a1 = array("red", "green");

$a2 = array("blue", "yellow");

echo "<br><br>:: array_merge() function :: </br>";

print_r(array_merge($a1, $a2));

echo "<br>-----------------------------------------";


$a = array("a"=>"red", "b"=>"green", "c"=>"blue");

echo "<br><br>:: array_shift() function :: </br>";

echo array_shift($a);
echo "<br>";

print_r ($a);

echo "<br>-----------------------------------------";

$a = array("red", "green", "blue");

array_pop($a);

echo "<br><br>:: array_pop() function :: </br>";

print_r($a);

echo "<br>-----------------------------------------";

?>

OUTPUT:

:: array() function ::
I like Volvo, BMW and Toyota.
-----------------------------------------

:: array_chunk() function ::
Array ( [0] => Array ( [0] => Volvo [1] => BMW ) [1] => Array ( [0] => Toyota [1] => Honda ) [2] => Array ( [0] => Mercedes [1] => Opel ) )
-----------------------------------------

:: array_combine() function ::
Array ( [Peter] => 35 [Ben] => 37 [Joe] => 43 )
-----------------------------------------

:: array_count_values() function ::
Array ( [A] => 2 [Cat] => 1 [Dog] => 2 )
-----------------------------------------

:: array_diff() function ::
Array ( [d] => yellow )
-----------------------------------------

:: array_fill() function ::
Array ( [3] => blue [4] => blue [5] => blue [6] => blue )
Array ( [0] => red )
-----------------------------------------

:: array_merge() function ::
Array ( [0] => red [1] => green [2] => blue [3] => yellow )
-----------------------------------------

:: array_shift() function ::
red
Array ( [b] => green [c] => blue )
-----------------------------------------

:: array_pop() function ::
Array ( [0] => red [1] => green )
-----------------------------------------
  • Object cloning
  • Inheritance
  • Interfaces
  • Abstract classes
  • Namespaces

Blog Archive

Total Pageviews

Popular Posts