Archive

Archive for September, 2009

PHP Array To XML Class – Multidimensional PHP to XML Tutorial

September 18th, 2009 bbhsoft No comments

Here is a great class i found on the internet for making XML from PHP multi dimensional arrays, it is tested and works like a charm on my server with PHP5. I do not remember the site i found it on.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
class ArrayToXML
{
	/**
	 * The main function for converting to an XML document.
	 * Pass in a multi dimensional array and this recrusively loops through and builds up an XML document.
	 *
	 * @param array $data
	 * @param string $rootNodeName - what you want the root node to be - defaultsto data.
	 * @param SimpleXMLElement $xml - should only be used recursively
	 * @return string XML
	 */
	public static function toXml($data, $rootNodeName = 'data', $xml=null)
	{
		// turn off compatibility mode as simple xml throws a wobbly if you don't.
		if (ini_get('zend.ze1_compatibility_mode') == 1)
		{
			ini_set ('zend.ze1_compatibility_mode', 0);
		}
 
		if ($xml == null)
		{
			$xml = simplexml_load_string("<?xml version='1.0' encoding='utf-8'?><$rootNodeName />");
		}
 
		// loop through the data passed in.
		foreach($data as $key => $value)
		{
			// no numeric keys in our xml please!
			if (is_numeric($key))
			{
				// make string key...
				$key = "unknownNode_". (string) $key;
			}
 
			// replace anything not alpha numeric
			$key = preg_replace('/[^a-z]/i', '', $key);
 
			// if there is another array found recrusively call this function
			if (is_array($value))
			{
				$node = $xml->addChild($key);
				// recrusive call.
				ArrayToXML::toXml($value, $rootNodeName, $node);
			}
			else 
			{
				// add single node.
                                $value = htmlentities($value);
				$xml->addChild($key,$value);
			}
 
		}
		// pass back as string. or simple xml object if you want!
		return $xml->asXML();
	}
}
Categories: Uncategorized Tags:

jQuery UI and how to show a DIV with Blind effect onClick

September 15th, 2009 bbhsoft No comments

This is an example function, how to show a div using the blind effect with jQuery UI. Read more…

Categories: Programming Tags:

Katy Perry is actually HOT!

September 15th, 2009 bbhsoft No comments

So, last days headlines were all about Kanye West, Taylor Swift and Lady Gaga. Here’s one real winner from the VMA’s. This is Katy Perry and sheeeeeee’s a hottie. I think there’s big improvement since last year on the YouTube Live! where she did not looked that good. Well done Katy! What’s up with the new songs? Read more…

Categories: Music Tags:

How NOT to do work

September 14th, 2009 bbhsoft No comments

Last dAys I’ve been depressed a lot and it really affected my work. As I am a full time coder I do not have a free day. Not that there was a problem to take a day off but I do not do It ever. I work fill I get totally exhausted and then just disappear for a day or two. This is really not the way of doing things. People should take some time for themselves instead of doing like me. So trust me, you shouldn’t work all the time. Rest at least one day in a week.

Categories: Uncategorized Tags:

Apple and their weird methods.

September 10th, 2009 bbhsoft No comments

Hello. Here is my problem, after I spent thousands of dollars for apple hardware this month I just realized I can not download music files to my iPhone without the use of iTunes or froM a web browser. This is totally ridiculous because they are limiting the functionality of the device you buy for really a lot of money. This way they force you to pay for music instead to be able to download if from the internet. I’m not saying I’m a pirat, but there are some free sets from independent artist I like to listen to in my car. I dont like the limitations apple is putting in it’s hardware. How can I make the freaking browser download a file without jailbreaking my iPhone? I even bought a freaking expensive mac with plans to start developing iPhone applications but seems Like apple is killing my enthusiasm. This post is written with my iPhone with the wordress application. Seems like the only good thing in the apple iPhone is the writing and auto correction, as long you use it with the wordpress application.

What do you guys think?

Categories: Uncategorized Tags:

No more drinking

September 7th, 2009 bbhsoft No comments

I am not drinking from now on. Alcoholism isn’t my sport. Yesterday I had a few whiskeys in a bar to relax a little and now whole day I feel like throwing up. This is because of the low quality bullshit they sell for A ton of cash. Later today I’ll post something interesting in the coding section.

Thanks!

Categories: Uncategorized Tags:

Jack Daniels

September 6th, 2009 bbhsoft No comments

Categories: Uncategorized Tags:

Why new blog?

September 6th, 2009 bbhsoft No comments

Because a few years ago, there was a user that was abusing and making spam sites on the same server where my site was hosted, then Google removed all indexed pages from the search engine, including my legit domain. Since i’m on my own server hosted by HostICan i can now be sure, stuff like that won’t happen. All the cool stuff will be posted here now. I hope you guys will enjoy this blog. Have a great day!

Categories: Uncategorized Tags: , , , ,