January 27, 2012
Posted by: gdelmatto : Category:
PHP,
Programming
Think about retrieving a data set from MySQL, where you need to add distinct, auto-incremented ID to each row retrieved. Sounds easy?
Well, the ID has to be generated on-the-fly and out of nowhere. Still easy?
One might think about using MySQL user variables to accomplish this, sure. But what if your framework does not allow injecting chained queries because of SQL injection countermeasures?
Read more…
January 18, 2012
Posted by: gdelmatto : Category:
PHP,
Programming
While working on my newest project, a PHP- and AJAX-based network management application, I came along the need to run multiple commands on the server and track their return states (basically if they were run successful or not).
While sticking together my framework, I found that forking a process into background from PHP requires some additional steps if you don’t want to break AJAX functionality.
Read more…
January 09, 2012
Posted by: gdelmatto : Category:
Perl,
Programming
For a project of mine, I wanted to convert a Perl data structure, a so called Hash of Hashes, into an XML.
The simple solution to this is to use the XML::Dumper module.
Read more…
December 29, 2011
Years ago I wrote a small script to restore local default route after connecting the RAS VPN on Windows.
Now, I made up a similar script to do the same on OS X.
Read more…
December 15, 2011
It’s only days since I wrote about a custom script action upon inserting a DVD in OS X, allowing me have either run the DVD Player or MakeMKV to rip the DVDs.
Now I was digging around if I could do some automation on the GUI part, which indeed turned out to work … at least to a certain degree.
Read more…
December 13, 2011
Posted by: gdelmatto : Category:
HowTo's,
Networking,
Programming
Als Follow-Up zu meinem letzten Post über den Swisscom CentroGrande Router, widme ich mich nun erneut diesem Gerät. Heute geht es darum, Interface-Statistiken in Cacti zu erzeugen — und das obwohl der CentroGrande den hierfür nötigen SNMP-Support schmerzlich vermissen lässt.
Read more…
December 11, 2011
I’m currently ripping my complete DVD collection off to MKV (Matroska) format, so I can stream them across my home network.
So I sought a way to have my OS X give me the choice to either start DVD Player or MakeMKV upon inserting a DVD.
Read more…
December 02, 2011
Posted by: gdelmatto : Category:
OS X,
Scripting
Why for God’s sake would anyone even think about shutting speakers while the screen saver runs?
Don’t these thingies provide an internal mute switch to stay quiet?
Well, yes, most of the time, they do. Though in my case, I run that nice and decent System47 LCARS-style screen saver. And while it provides indeed a mute switch, it yet refuses to honor that flag and will always revert to non-muted operations. This drives me crazy, at least during the night time.
So here’s my solution to shut it quiet — really handy when I’m not along and forgot to turn volume down …
Read more…
November 09, 2011
Posted by: gdelmatto : Category:
Cisco,
TCL
Being used to other languages sometime leads to false assumptions, like having the same commands every now and then.
While doing some TCL scripting on a Cisco I just had the need for a ‘sleep’ command or equivalent.
Since no ‘sleep’ exists, the ‘after’ command will do. Just supply it with the timeout in milliseconds, like this for a 10-second timeout:
after 10000
Or, with a bit more overhead, but some may think it’s more readable:
after [expr {int(10 * 1000)}]
November 02, 2011
Posted by: gdelmatto : Category:
Cisco,
Networking,
Perl,
Programming
Here’s a short script which I use to extract Cisco device-types from SNMP.
Bad enough, most of these devices return their device type ID differently, e.g. sometimes prefixed with an uppercase ‘C’, sometimes without any prefix, then again sometimes we find a suffix.
So here’s a snippet, that makes them look neat, so I can work with simple and unified looking device IDs.
Read more…