Showing posts with label My Tutorials | Programming. Show all posts
Showing posts with label My Tutorials | Programming. Show all posts

How to Easily highlight source codes in content?

So if you are a blogger who writes on computer programming and publish source codes in your blog post or if you just want to publish some source codes in your website, then what you can do to stand-out the code from other text is

  • Use <code /> tags
  • Use <pre /> tags
Cool. It will look like codes but not look like as it looks like in your favorite code editor, with different colors for constants, variables, functions, strings etc. along with line numbers.

So, what you want to do is to highlight source codes and make them appearing like in a code editor, which is just not for colors, but for more readability too.

How to Optimize syntax highlighter loading speed?

If you are using SyntaxHighlighter in your blog or website, then you might have noticed that you have to load the brushes you used in a post or page. The way you load them is generally by 

  1. Linking specific brush scripts used on a given page or post, 
  2. Or you load them statically by including all the brushes being used though-out the blog or website.
The first option for loading is disgusting as you have to write the code for each post or pages, however it is better as in this way you load only those brushes you used in an specific post or page.

The second option is better as you don't have to write code for each post or page, but will put impact on website loading speed as you will be loading brush scripts unnecessarily in every post or page despite their usage.

Sort dependency list or Topological Sorting in PHP

Topological Sorting - Wkipedia


In the field of computer science, a topological sort (sometimes abbreviated toposort) or topological ordering of a directed graph is a linear ordering of its vertices such that for every directed edge uv from vertex u to vertex v, u comes before v in the ordering. For instance, the vertices of the graph may represent tasks to be performed, and the edges may represent constraints that one task must be performed before another; in this application, a topological ordering is just a valid sequence for the tasks. A topological ordering is possible if and only if the graph has no directed cycles, that is, if it is a directed a cyclic graph (DAG). Any DAG has at least one topological ordering, and algorithms are known for constructing a topological ordering of any DAG in linear time.

Sometimes, we fall into situations where we have a list of tasks to be done, but with a condition that each of the tasks may need one or more tasks from the list to be done before them. Let’s, consider that we have to do tasks a,b,c,d and the condition is b & d has to be done before the task a, then the sorting will become b,d,a,c.



Why I would choose PhpStorm over Adobe Dreamweaver?

Okay, first of all guys, I have been using PHPStorm for the last project I am working on and its really awesome, but the following list awesomeness is obviously incomplete.



How to write good codes or What are the good programming practices to follow !!



The following post highlights some good programming practices what beginner programmer can follow. Applying these increases the readability of codes, will make make codes more easier to update. 

Well, individual programmers should have their own programming styles to maintain, but still there are some practices that the beginners can follow. With times every programmers find out their own styles. Following is a list of things that beginners can do while coding or solving a problem.

Garbage Collection

Garbage collection. What you get from the title of the topic? Well, while we are coding we use variable or memory location. We may need an array initially for storing some initial elements, then we take more arrays while we are manipulating. At some part of the manipulation, it may that we dont need the initial array anymore. I mean it may that we have already took all the elements of the initial array and processed and stored them in another array for furthur processing and dont need the initial array anymore. However, that initial array still remains eating up some memory locations.