Nullifying pointers in PHP

Using pointers in PHP is quite useful at times; but it can also leave you dumbstruck with serious debugging on your hands. Consider this construct:

[code]for ($i = 0; $i < 10; $i++) { $p1 = null; if ($Buffer [$i]['type'] == 'scanthis']) { $p1 =& $Buffer [$i]['data']; } .. if ($p1 != null) .. }//for[/code]
This will in effect dereference and overwrite a given [‘data’] array member of $Buffer if [‘scanthis’] evaluates to true. But I still want to use “null” as an indicator to whether or not to do something.

So I replace the above with:

[code]for ($i = 0; $i < 10; $i++) { unset ($p1); <-- $p1 = null; if ($Buffer [$i]['type'] == 'scanthis']) { $p1 =& $Buffer [$i]['data']; } .. if ($p1 != null) .. }//for [/code]
This will destroy $p1, but not what it’s pointing to, and then it sets $p1 to null, just like before.

This is obvious when you look at it, and there are a number of other ways to accomplish what I describe above, but it had me stumped for a while 🙂

The best mini-keyboard ever: Logitech Dinovo Mini Bluetooth

Being sick and tired of so-called media keyboard, wireless solutions, and other silly inventions for my media computer, I was reluctant to try another solution. After having spent a few months with the Logitech Dinovo Mini Bluetooth keyboard/mouse combination, I’m glad I did. This has to be the coolest keyboard/mouse solution for a media computer, ever.

It’s about as big as a handheld computer and has basically everything. It measures 152 mm x 90 mm x 27.5 mm (lid closed). With a small USB-dongle connected to the computer, it communicates using bluetooth. It has a smart flip-open cover that protects the keyboard while not in use. When you open the cover, the keyboard is ready to go. It automatically goes to sleep if you don’t use it for a while. At the first keypress, it wakes up again (and it actually transmits that first keypress to the computer as well). It sports a rechargeable battery.

It works with Windows and Linux type operating systems, and there’s a Mac model as well. According to the manufacturer, it’s compatible with the Playstation 3 hardware too. It has a special button for Windows Media Center.

It features a ClickPad, which is basically its way of doing mouse input. You can switch the ClickPad to keyboard-mode, which makes it act as the “arrow” or “cursor” keys on a regular keyboard. Any keyboard and/or mouse combination I have been able to think of, I’ve found a way to input using the Dinovo mini keyboard. Some keys took a bit getting used to (like Fn + Tab to get Esc), but all is forgiven considering the physical dimensions of this gadget.

Cons? Well.. nothing really. Sure, it’s a bit on the expensive side; but considering I can now place the keyboard underneath my flatscreen Samsung TV, and having it “disappear” (because it does blend well), it’s well worth it. If you need a multimedia keyboard/mouse solution for your media computer, get this.

Link: Logitech Dinovo Mini Keyboard
Link: Article in Swedish on 2u2.se

WordPress-mall: Retro

retro-adBland alla de mallar som finns för WordPress hittar man ibland en del udda saker. Retro-mallen från Kerry Webster är en sådan udda sak. Det låter som en jättekul idé, och känns initialt lite roligt. Men handen på hjärtat, hade det inte varit bättre om man inte behövt stirra på en fosfor-grön sida.

För de som inte var med, eller kommer ihåg, så såg skärmarna ut så här för 20+ år sedan. Väldigt retro är det i alla fall.

Roligare profilbilder med Face Your Manga

MangatarFler webbsajter gör det möjligt att man utöver sitt namn, användarnamn eller signatur också identifierar sig med en s k ”avatar” eller ”gravatar”. En del webbapplikationer har haft stöd för detta länge (t ex många forumtjänster). När Facebook och liknande nu blivit omåttligt populärt så kan Face Your Manga kanske vara ett roligt sätt att skapa sin egen profilbild. Fantasin har inga gränser, eller nåt 🙂

Skapa din egen Mangatar på www.faceyourmanga.it

 

Chinese Democracy: A good record by any other band

Now that the major fuss related to the release of Chinese Democracy by Guns N’ Roses has seem to passed, I made some reflections while listening to Madagascar. These are obviously my personal opinions and not some “expert’s”.

Som indisputable facts about the album, GNR and Axl Rose are of course that the record took a zillion years and a trillion dollars to complete, it’s been surrounded by fights, arguments, chaos and mayhem. The band has only one original member left from the glory era of Appetite of Destruction (and to some extent Use Your Illusion), and Axl Rose is considered to be an oddity and prima donna.

The only reason all of this matters to people is because it’s Axl Rose and GNR we’re talking about (and because so many people seem to be missing a daytime hobby). Many successful bands have gone through the same bickering, fighting, and mayhem.

One of my all time favorite bands, Pink Floyd, split and left Roger Waters behind, something many “die-hard fans” have never been able to forgive. I have never been to a Pink Floyd concert that wasn’t fantastic; with or without Roger Waters. Creed dumped their lead singer, Scott Stapp, and turned into Alter Bridge (despite what its members claim); in Myles Kennedy they found a singer with awesome dynamics. The rest of GNR (save Izzy and Adler) got together and formed Velvet Revolver; and after a while, they too were looking for a new lead singer. Aerosmith still hasn’t released an album better than Pump and Pearl Jam still can’t produce anything near Ten or VS.

Shit happens, life goes on.

If any other band than GNR had released Chinese Democracy, it would have gotten much better reviews.

I’m not writing this to defend Axl Rose, GNR, nor to take some sort of “high ground” stand here. I don’t care what Axl Rose does in his spare time, I don’t care if he’s weird, nor if his album costs 15 million dollars. My only issue with Chinese Democracy is that it took too long to materialize.

If you like it, buy it, listen to it, go to their concerts (the last one I was at was excellent). Don’t compare it to Appetite for Destruction. I mean seriously, did you really expect it to be Appetite II? If you don’t like it, don’t buy it and don’t listen to it.

And while I’m at it: Slash/Matt/Duff/Dave: Go talk to Rod Jackson.. you guys need him for your line-up! 🙂

Commodore 64 (VIC-64)

One of the many reasons Commodore 64 (C64/C=64/CBM-64/VIC-64) became the most sold personal computer model of all time was not due to its fantastic programming capabilities, but rather due to its role as a “gaming machine”. Compared to today’s consoles, it doesn’t stand much of a chance of course, but in those days, it was second to none. Glorious colors (well..), fantastic sound, and a price that was much lower than most of its competitors’, you would slide in a tape (!) and load your favorite game. If you had generous parents, you could possibly afford a disk drive (Commodore 1541).

You don’t have to install SonyEricsson’s PC Suite!

Are you the owner of a SonyEricsson phone and tired of the bloated PC Suite set of applications? Don’t want to use Outlook to synchronize with? Want to synchronize your SonyEricsson with Google’s Calendar or Thunderbird? If any of the above is you, you may want to give MyPhoneExplorer from FJ Software Development a go.

Synchronizing, editing, backup and restore, batch modification to entries, and holiday calendar entries are just some of its features.

MyPhoneExplorer is a relatively lightweight Windows application that will knock you off your feet. For Vista users, it includes a Sidebar-Gadget that can handle calls and write SMS. Since version 1.7, it’s also fully compatible with UIQ3-phones (P990i, P1i, M600i, W950i, W960i, G700, G900), apart from other SE phones like the fairly recent C905.

In the FJ Software Support forum, you will also find an FAQ on how to get MyPhoneExplorer to work under Linux using Wine.