Noooooo…..kinda
My beloved last.fm has been sold to CBS. Not cool, treatment but at least it will still be run by the same people.
My beloved last.fm has been sold to CBS. Not cool, treatment but at least it will still be run by the same people.
#include
#include
#include
void theShieldIsUp (int param) {
raise(SIGABRT);
}
void ackbar (int param) {
std::cout << "It's A Trap!" << std::endl;
exit(1);
}
int main () {
signal(SIGTERM, theShieldIsUp);
signal(SIGABRT, ackbar);
while(true)
sleep(1);
return 0;
}
This was really funny to me earlier when I jotted it down. It's a signal trap that calls a function that raises a process abort signal. Get it? Yeah, not as good as it was when I was working on it...
So my little freak-out post about my hard drive just proved itself true. WDE, my 320GB drive full of movies, music, books, and (ironically) backups just gave up the ghost. It actually froze up my machine in it’s dying gasps.
I know it wasn’t full of content, but that’s a big hit. It’s also the newest drive in my machine, lasting one day under 8 months. Thats silly. Plus I voided the warranty on it, so no replacement for me. Oh, bonus note, I bought 100 DVD blanks yesterday to start backing things up on from it.
This little fiasco is going to implement some new procedures. I’m making weekly tree listing of my media folders so I can know what I lose from here on out, and I’m going to back important stuff up to disc. This really sucks.
#!/bin/bash
DATE=`eval date +%F`
tree /media/hdb1/Music > MUSIC.$DATE
MUSIC=`eval diff MUSIC.$DATE MUSIC.CURRENT`
if [ "$MUSIC" = "" ]; then
echo "No Change" > MUSIC.$DATE
else
cp MUSIC.$DATE MUSIC.CURRENT
fi
tree /media/hdb1/Torrents > TORRENTS.$DATE
TORRENTS=`eval diff TORRENTS.$DATE TORRENTS.CURRENT`
if [ "$TORRENTS" = "" ]; then
echo "No Change" > TORRENTS.$DATE
else
cp TORRENTS.$DATE TORRENTS.CURRENT
fi
As much as all of this sucks, I really enjoyed learning that much bash scripting.
One of my hard drives is making a nasty noise at regular intervals. I’m not sure which one it is either, I can’t work that out. Anyway, I’m backing up everything important right now, I just hope it survives that long…
So I’m a little disappointed in PHP5’s SimpleXML object. Don’t get me wrong, it works great for accessing XML, but it’s terrible for deep manipulation. The biggest problem is that you can’t append SimpleXMLElement objects to each other.
For instance, I was working on a little project tracker that would use all XML for storage. Here is the var_dump of my XML file.
object(SimpleXMLElement)#1 (1) {
["project"]=>
array(3) {
[0]=>
object(SimpleXMLElement)#4 (5) {
["idstring"]=>
string(10) "1180050874"
["name"]=>
string(22) "Example Project Bottom"
["created"]=>
string(19) "2007-05-24 17:57:29"
["modified"]=>
string(19) "2007-05-24 17:59:44"
["contact"]=>
array(2) {
[0]=>
object(SimpleXMLElement)#5 (3) {
["name"]=>
string(10) "John Hobbs"
["title"]=>
string(12) "Project Lead"
["email"]=>
string(20) "[email protected]"
}
[1]=>
object(SimpleXMLElement)#6 (3) {
["name"]=>
string(9) "Mom Hobbs"
["title"]=>
string(3) "Mom"
["email"]=>
string(19) "[email protected]"
}
}
}
[1]=>
object(SimpleXMLElement)#3 (5) {
["idstring"]=>
string(10) "1180050874"
["name"]=>
string(19) "Example Project Top"
["created"]=>
string(19) "2007-05-24 17:57:29"
["modified"]=>
string(19) "2007-05-24 18:57:44"
["contact"]=>
array(2) {
[0]=>
object(SimpleXMLElement)#7 (3) {
["name"]=>
string(10) "John Hobbs"
["title"]=>
string(12) "Project Lead"
["email"]=>
string(20) "[email protected]"
}
[1]=>
object(SimpleXMLElement)#8 (3) {
["name"]=>
string(9) "Mom Hobbs"
["title"]=>
string(3) "Mom"
["email"]=>
string(19) "[email protected]"
}
}
}
[2]=>
object(SimpleXMLElement)#2 (5) {
["idstring"]=>
string(10) "1180050892"
["name"]=>
string(22) "Example Project Middle"
["created"]=>
string(19) "2007-05-24 18:45:06"
["modified"]=>
string(19) "2007-05-24 18:45:06"
["contact"]=>
object(SimpleXMLElement)#9 (3) {
["name"]=>
string(10) "John Hobbs"
["title"]=>
string(12) "Project Lead"
["email"]=>
string(20) "[email protected]"
}
}
}
}
Long, I know. The point is that even though the structure looks pretty normal, you can’t do this, in this case in a sort function:
$temp = $projects->project[0];
$projects->project[0] = $projects->project[2];
$projects->project[2] = $temp;
You get the error message:
Warning: sortProjects() [function.sortProjects]: It is not yet possible to assign complex types to properties in /var/www/timetracker/index.php on line 63 Warning: sortProjects() [function.sortProjects]: It is not possible to assign complex types to nodes in /var/www/timetracker/index.php on line 63
That, my friends, is a bummer. You can’t assign sub-elements into the tree. Bummer. Now I have to switch back to my normal MySQL.