Author Archives: Ferhat

Parsing XML in PHP

PHP offers several methods for parsing XML files. This example uses the built-in DOM functionality for PHP5.

Posted in PHP | Leave a comment

For loops in Bash

For loops in Bash can come le prix du cialis en pharmacie. in handy when for example, you want to perform bulk operations. Think of renaming all files in a directory or executing a collection of scripts. The following snippet simply iterates through a set of prime numbers and prints them to the console.

Posted in Bash | Leave a comment

Parsing XML in Java

There are several methods available for parsing an XML file. Some parsers transform the XML file into a traversable DOM tree. The tree consists of a root node and one or more child nodes belonging to the root node. These child nodes are able have child nodes of their own and so forth. Nodes without children [...]

Posted in Java | Leave a comment

Generating a random color in C#

Always wanted to have your own random color generator in C#? This snippet shows you how to do it.

Posted in C# | 1 Comment

Inheritance in PHP

Classes can contain subclasses and subclasses can in turn contain superclasses. For example, the class Person could be the superclass of the class PizzaDeliveryGuy.

Posted in PHP | Leave a comment

Instantiation in Objective-C

Instantiation in Objective-C consists of allocating memory for the instance and calling init. NSString* foo = [[NSString alloc] init];

Posted in Objective-C | Leave a comment

Framerate GameComponent to calculate the frame rate (XNA Framework)

Microsoft XNA can be used to develop computer games. This code snippet contains a so called GameComponent written in C#. The GameComponent is called Framerate and it simply calculates the frame rate of the game at each Update cycle.

Posted in C# | Leave a comment

Properties in C#

Properties in C# can be used to set or get the value of an attribute. Suppose you have a class called Person which has the attributes name and age. class Person { String name; int age; public Person(String name, int age){ this.name = name; this.age = age; } } The attributes of the Person class [...]

Posted in C# | Leave a comment

Constructors and destructors in PHP

You might want to execute code when an instance of an object gets constructed or destructed. PHP offers constructors and destructors for this purpose. A constructor can be created by declaring a function called __construct within a class and a destructor can in turn be created by declaring a function called __destruct . <?php class [...]

Posted in PHP | Leave a comment

Hiding and showing elements with jQuery

If you don’t know what jQuery is, I’d recommend you to visit jquery.com for clarification. Suppose you have an HTML div element which you want to hide  and show. <div id='foo'>bar</div> The next step is to use a so called selector to select the element and call the hide() function to hide the element. $('#foo').hide(); The [...]

Posted in JavaScript | Leave a comment
  • Advertisement

  • Categories