Parsing XML in PHP

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

Read More »

→ Continue Reading

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.

Read More »

→ Continue Reading

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 are referred to as leaf nodes. Read More »

→ Continue Reading

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.

Read More »

→ Continue Reading

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.

Read More »

→ Continue Reading

Instantiation in Objective-C

Instantiation in Objective-C consists of allocating memory for the instance and calling init.

NSString* foo = [[NSString alloc] init];
→ Continue Reading

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.

Read More »

→ Continue Reading

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 are private in this case. Read More »

→ Continue Reading

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 Foo {
  function __construct(){
    print "Constructing an instance of Foo";
  }

  function __destruct(){
    print "Destructing an instance of Foo";
  }
}
$fooInstance = new Foo();
?>

→ Continue Reading

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 show() function can in turn be used to show the element.

$('#foo').show();

→ Continue Reading
  • Advertisement

  • Categories