Here's a quick tip for PHP error reporting and display in development.
When a project is in the early stages of development you want to see all the error information you can. You probably want E_STRICT on especially when you're starting from scratch, to help avoid relying on deprecated behaviour. The E_STRICT flag is only available as of PHP 5 and is not included in E_ALL until PHP 5.2 (there's a little disagreement on php.net between the definition of E_ALL in this table and the earlier note about error_reporting on the same page).
In an early development project you also don't want to have to keep tailing log files to see the error messages. That's a pretty sure way to miss errors. So you want to set the display_errors flag on. You also want to control this on a per-project basis, since some projects will have legacy bugs that you're not fixing right now and those can be left spouting errors to logs until someday in the future when you decide to fix them.
I want to build an application targeting the Android platform. I'm a little rusty with Java but I really like developing with Eclipse (I've been using it for some other stuff like PHP development). The ADT plugin got me started with the sample applications pretty quickly but now that it's time to deviate and build something of my own I have to set a nice low goal that I can knock out with a high chance of success. Then I can iterate and go a little deeper on the next pass. To start with I think I'll play with drawing primitive graphics. There's an API example called DrawPoints with some code that just spouts out random points on the screen. I took a fair chunk of that and stuffed it in to the "Hello, Android" application I built earlier.
All in all the activity's pretty straightforward and Eclipse makes it even easier. I'd post the code for drawing but it's almost identical to DrawPoints at this stage. The next step is to get some new code in there. I decided to go for my old standby, the Hilbert curve. I modified the code to suit the drawing environment but didn't get results right away. I learned a few things about debugging with the Android emulator and ADT in the process.
I glossed over the fact that my program crashed at the end of the script in my post on hooking up Lua to a C++ application. I new at the time I posted that there was a memory problem in calling the SimpleGraphics destructor but what I didn't realize was that the problem was actually caused by the difference in the declaration of the SimpleGraphics class between the header file that the C++ program sees and the declaration that the SWIG-generated file sees. Here's the one that gets compiled in to the C++ application:
I closed off my last post about adding Lua to an SDL application saying I’d look at a tool to do the bindings for me. I actually already had something in mind for the job. I looked at a couple but SWIG seems to be the most versatile. It’s not tied just to Lua so the work I put in to learning how to use SWIG will also apply partly to any other scripting languages I want to support. Any within the realm that SWIG supports, of course. Notably missing from the list so far is Javascript. Scheme is represented in the form of Guile (which is a specific Scheme interpreter as far as I understand).
The documentation for SWIG is pretty sizable but of course with all the combinations of host & script language out there they aren’t all explained clearly enough for a beginner like me. So I started to experiment. SWIG focuses on wrappers for C, C++ support seems more complex. So to understand things I had to scale back even from my simple SDL C++ test program then scaled back up once I got some communication between code written in both languages.
I’ve been poking around with a couple C++ programs recently and I started thinking again about how cool it is that you can hook in a scripting language. I’ve wanted to try setting up scripting for a few programs in the past but it always seems too far removed from any one project. This sounds kind of abstract, more concretely I’ve been thinking about scripting behaviours in a game or exposing a script interface from some simple graphics program.
Lua’s a popular scripting language for games. It’s used for add-ons in World of Warcraft and I’ve heard it brought up over and over again at the Game Developer’s Conference. I tried a short example of Lua a while back but I never went back to write any real code with Lua. Since the license is so liberal and writing a little Lua would help me out writing WoW macros and add-ons, I decided Lua would be a good place to start - have a look at yesterday's post about setting up an SDL project in Visual Studio.
Next for the test harness. I took some code to draw a Hilbert curve from Wikipedia about a week ago and converted it into something roughly equivalent in C++ using SDL. The code compiles and runs under Linux (I used KDevelop) or Visual Studio 2003. In the code I implemented a SimpleGraphics class which takes an SDL surface and gives some methods to draw lines on that surface. The HilbertCurve class uses a SimpleGraphics object to do the drawing. I decided this little program would be a great candidate to get scripted.
At the risk of turning this into an Apache fan blog, I have to mention the handy directive I found today. Many webmasters run in to mod_rewrite at one time or another and every one of them will have at least a little trouble with it. I just came across the RewriteLog Directive and corresponding RewriteLogLevel Directive. You're not going to be able to turn these on with shared hosting, they can't be used in .htaccess. To set up a debugging log for mod_rewrite, you need to add them to your httpd.conf somewhere. In my case I'm working on a server at home so I added
I've had my Asterisk PBX offline for a while now for no good reason, so I decided I'd upgrade and put the latest Asterisk on my new machine. I wrote about the last time I installed, that was on an older AMD Athlon 1200MHz Thunderbird. It worked fine but I got a Linksys PAP2T-NA ATA and became very lazy. The ATA just registers with Les.net and I plug a phone in to it, so there's no need for Asterisk for just basic VOIP phone service.
I decided that I'd just use the ATA for a while then I got into some sound quality problems. I switched out many parts of the system trying to determine where the problem was but the best lead that I have so far is that my modem has issues. I'm not sure that the entire problem is with the modem but I do know that my Internet connection overall gets faster if I reboot it and that shouldn't be necessary.
Anyhow, voice quality issues apparently are common with VOIP and more people are using it anyway - the balance of features and cost is still in favour of VOIP. So I figure that if I get used to my system I can work the kinks out of it later. As time goes on and there are more users it should be easier to find help on my specifics too.
Today I want to revisit some of the work I did getting Asterisk 1.2 working and see what I have to do to get Asterisk 1.4 running. It's apparently not that different.
This has bugged me for a long time but it just took a little searching to fix. I enter the URL http://copper/ and Firefox can't connect so it decides that I really meant http://www.copper.com/. This is never what I meant. I don't know who runs copper.com, but they can rest assured that they'll stop getting requests from me for the internal web services that I run at home. The same thing happens even if you use the name localhost. I fully expect that most visitors at http://www.localhost.com/ are Firefox users who are trying to access a web server on their own computer.
I'm trying to move forward with the plan I outlined the other day. In short I want to use LDAP to simplify my home network of five computers and six users. I haven't got as far as setting up a login yet but I have got the LDAP server running on one of the computers (named copper) that's running OpenSuse 10.2.
Today I just want to talk about the steps I've taken to experiment at getting something going. I'm learning this as I go and these are just notes to help remember how I got to where I am. If they help you too then that's great.
I have a GNet BB0060A DSL modem. It works pretty well but when I first got it years ago I screwed something up and couldn't get in to the web-based user interface any more. It also doesn't have a reset button on the back (though the manual claims it does). It does have an RJ-45 console connector on the back. RJ-45 connectors are the kind you find on normal ethernet cables - like a phone connector but wider. This isn't a network connector though. To connect to it you need an RS-232 null modem cable. RS-232 cables normally have a DB-9 connector on both ends (but are sometimes DB-25). I don't remember what I did to connect to it back then, but Steve at Teksavvy was helpful enough to tell me the connection settings I'd need with the null-modem and the command to recover my modem.
Fast forward to today and Candace has a GNet BB0060B that she got from a friend. They were both on Teksavvy as well and so Candace could use the modem with the same settings. Trouble is, the way the modem was configured was such that the username and password for PPPoE were stored right there in the modem settings. And the web interface username & password don't match what the manual says they are. According to the manual you should be able to go to 192.168.7.1 in a web browser and log in with the username 'DSL' and password 'DSL' (case sensitive). Failing that, the username 'root' and password 'root' should work. You can also try the same username and password over telnet. None of these options worked for me.
So my problem now was to figure out how to get in to the modem settings without a valid username or password and with no reset button available.