302 error in CakePHP with SWFUpload
Jul/090
I encountered this issue in one of my recent projects.
Basically I use SWFUpload to post files to a CakePHP controller. It was working beautifully, until I inadvertently removed 1 (yes, just one) line of code in beforeFilter():
$this->Auth->allow("swfupload");
I was using the Auth component, and without the line above to allow “not logged in” access to the controller action, then we have a problem.
Hope this helps somebody.
Comparing MEPIS 8 and Ubuntu 9.04
Jun/0910
This post has been updated due to new information regarding Ubuntu 9.04.
I first tweeted about Ubutu 9.04 a week ago. Now I know I’m not exactly comparing apples with apples, since MEPIS 8 is based on Debian 5.0 and uses KDE 3.5, whilst Ubuntu 9.04 uses GNOME 2. I might be better off evaluating Kubuntu, the 9.04 release uses KDE 4, which I’d used previously, and disliked due to its (apparent) gradual reduction in speed.
But back to Ubuntu versus MEPIS. Since 10th June, I’ve been using it as a web developer machine on a Compaq nc8230. This machine is better-speced that the IBM R52 I use for MEPIS, so I’m giving Ubuntu the benefit of faster machine here. We’ll see if that pans out in Ubuntu’s favour later on.
Package Management
I develop in PHP, so I use Apache, MySQL and Oracle (remote server) on a daily basis. From my point of view as a developer, all of the .deb packages I use have the same name as in MEPIS. Synaptic, used in both MEPIS and Ubuntu, handles packages very well, so it is a tie here.
MEPIS 1, Ubuntu 1.
Applications
For applications however, I still felt that, overall KDE’s were more suitable for me, even though I was able to find GNOME-based replacements for the applications I used in MEPIS:
- Kate to Gedit. Kate can syntax highlight my .ctp files, while Gedit has no such configuration option. Kate has sessions so I can quickly switch between projects, Gedit does not.
- Konsole to Terminal. Konsole remembers my tabs, Terminal does not.
- Katapult to Do. I prefer the default Alt+Space shortcut for Katapult, Do does it like Win+Space, because Alt+Space is used by GNOME. I also prefer if a calculator is built into Do, so I press Win+Space+32*5 and I get the result (160) onscreen.
- Kdesvn,Kdiff3 Kompare to Meld. Meld is MUCH better than either of the 3 applications, as I can do 3-way file/directory comparison easily. It can even open a Subversion-ed directory and handle it correctly)
- No Dropbox client in MEPIS, versus official Dropbox client in Ubuntu. Dropbox works very well, as it is the official release from the Dropbox guys. I’m still waiting (hoping) for a KDE-based one, but maybe they are reluctant to write one in KDE 3.5, then later rewrite for KDE4?
MEPIS 1, Ubuntu 0.5 (due to Meld, Dropbox).
Speed/Stability
I feel that Ubuntu 9.04 has some way to go, as I’d to POWER OFF the laptop as Ubuntu does the dreaded “window goes dark” thing, and I see/hear alot of hard drive activity, and then I have to (painfully) switch to Terminal, and then type killall <process>. Usually, the culprit is Firefox 3.0.11.
Previously I’d written about how unstable 9.04 was. After some reading on the forums, I figured it might be a graphics issue. Setting System -> Preferences -> Appearance -> Visual Effects to “None”, seem to have resolved my stability problems. How strange, yet comforting. Ubuntu is now as stable as MEPIS (or probably most Linux distros, anyways) is.
MEPIS 8, on the IBM R52, meanwhile is fast and stable, albeit with less special effects. I must admit, I was wowed by the special effects, but not at the expense of speed, and particularly stability.
MEPIS 1, Ubuntu 0. MEPIS 1, Ubuntu 1.
Conclusion
I’ve no issues with Synaptic, as it is used to manage packages in both MEPIS and Ubuntu.
I loved to use Dropbox and Meld in Ubuntu, so much that I was probably willing to accept the differences between kate/gedit, konsole/terminal, katapult/do. What was frustrating to me was to develop halfway, and then have to wait for the system to return control of the UI to me, and if not reboot.
The overall score is MEPIS 3, Ubuntu 1.5. This scoreline is obviously subjective, but you’ve heard all the good things about Ubuntu, have a slow(er) laptop, please do consider MEPIS. The overall score is MEPIS 3, Ubuntu 2.5. I still prefer KDE 3’s apps, but it wouldn’t be a huge leap to jump to Ubuntu’s GNOME Desktop, or for users that still prefer KDE, Kubuntu 8.04 (KDE 3.x) or Kubuntu 9.04 (KDE 4.x).
Both MEPIS and Ubuntu support audio/wireless networking flawlessly, unlike (cough, cough) Debian. At this point, I really don’t see the benefits of using Ubuntu (mostly due to its speed/stability issues) over MEPIS, so yeah, I’m a fan.
References
TrueHoop’s Stat Geek Smackdown 2009
Apr/090
With reference to this event, I’ve decided to take my own shot at predicting the outcome of the 2009 NBA Playoffs. 5 points are awarded for correctly picking the winner, with an additional 2 for correctly picking the number of games played.
First Round (27 out of 56 points)
LAL-UTA (LAL in 5) (7 points, LAL won 4-1)
DEN-NOH (NOH in 7) (0 points, DEN won 4-1)
DAL-SAS (DAL in 6) (5 points, DAL won 4-1)
HOU-POR (POR in 6) (0 points, HOU won 4-2)
CLE-DET (CLE in 5) (5 points, CLE won 4-0)
BOS-CHI (BOS in 6) (5 points, BOS won 4-3)
ORL-PHI (ORL in 5) (5 points, ORL won 4-2)
ATL-MIA (MIA in 6) (0 points, ATL won 4-3)
I picked Miami (Dwayne Wade), New Orleans (Chris Paul), Portland (Brandon Roy) over the Hawks, Nuggets and Rockets respectively. Emotional picks, of course. That won’t happen for the next round. The next four picks (LAL, CLE, BOS, DEN) are statistically superior, and have home court advantage.
Eastern/Western Conference Semi-Finals (19 out of 28 points)
HOU-LAL (LAL in 7) (7 points, LAL won 4-3)
DAL-DEN (DEN in 6) (5 points, DEN won 4-1)
ATL-CLE (CLE in 4) (7 points, CLE won 4-0)
ORL-BOS (BOS in 7) (0 points, ORL won 4-3)
I was spot on in picking Cleveland and Los Angeles. Los Angeles was a lucky one, as they played badly (but still won). I fully expected Nowitzki and the rest of the Mavericks to put up 6-game series, but instead it was over in just 5. I picked Boston over Orlando as the last game was to be played in Boston, to no avail. The conference Finals will be fairly easy to predict, albeit Lakers inconsistency notwithstanding. With Yao injured in Game 4, they should have wrapped the series in 5 or 6 games, but it took a Game 7 to decide the winner. The Nuggets won’t give them an easy time, but the combined output of Bryant, Gasol, Odom and (hopefully) Bynum should triumph over Billups and company. Despite their current popularity, Denver is still over-rated. For the Magic-Cleveland series, Howard and company should be easily dispatched by LeBron’s Cleveland in just 5 games. And if King James exacts his will, maybe it will be a sweep (again) So it (should be) the NBA’s dream match up Kobe’s Lakers versus LeBron’s Cavaliers after all. Cleveland are too strong, however, and LAL will be sent packing (just like last year) in 5, maybe 6 games, injuries/suspensions notwithstanding.
Eastern/Western Conference Finals (7 out of 14 points)
DEN-LAL (LAL in 6) (7 points, LAL won 4-2)
ORL-CLE (CLE in 5) (0 points, ORL won 4-2)
I picked the Lakers-Nuggets series correctly. Despite Cleveland’s statistical superiority, Orlando won that matchup, unfortunately. I’d even predicted Cleveland to win the NBA Finals in 6, but unfortunately that was not to be, so we have a new pick to make. Los Angeles is finally playing well, and this time round, they will prevail.
NBA Finals (5 out of 7 points)
LAL-ORL (LAL in 6) (5 points, LAL won 4-1)
Total (58 out of 105 points)
Of a maximum score of 105, I scored 58, 17 points off the pace off David Berri, the Stat Geek Smackdown 2009 winner. I picked New Orleans over Denver (Berri +5), Miami over Atlanta (Berri +7), and Boston over Orlando (Berri +7). Had I participated in the official contest, I would’ve placed 6th out of the 9 contestants.
So it was the Lakers whom triumphed in the end. My congratulations to Kobe, Gasol, Ariza, Odom and Fisher, the 5 players that had the most impact on the series. My condolences to the Magic, but Howard is young, and with the return of Nelson and the rise of Lee, he still has many opportunities to win. I do hope that Magic will offload Lewis (somehow) in the offseason, and resign Turkoglu and Gortat, for they are the players that (truly) contribute to the team.
Lewis, at $110,000,000 over 6 seasons, is a ridiculously overpaid scorer who shoots too much, and plays badly at his position of choice (power forward). I would sooner play Gortat/Howard together, for a truly “shock and awe” combination.
Alston, who was signed in light of Nelson’s injury, should also be traded/benched, along with Reddick, players whom simply do not play well enough at the guard position to warrant anything more than garbage minutes.
As I look towards the rest of the star players who’ve had disappointing postseasons, we’ve certainly not seen the last of LeBron James, Dwayne Wade and Chris Paul.
NBA game recaps, not game info!
Apr/090
With reference to this post, I decided to write my first Greasemonkey script.
I don’t subscribe to cable TV, so I get my sports news fix mostly by reading. Now that the NBA playoffs are in progress, I use NBA.com on a daily basis to read recaps like this one. I’m upset enough that the Lakers — one of the eight teams I’m rooting for — lost, without having to right-click “Game Scoreboard”, copy the link, and replace “gameinfo.html” with “recap.html” — which is what I’m most interested in, since I didn’t watch the match.
This is a pain, and since I can’t control NBA.com, I’ve written nba_recap_not_gameinfo, a Greasemonkey userscript to do it automatically for me.
This uses the excellent jQuery, of course, and since this blog does programming-related posts, we’ll take at the important (super-simple) part consists of just 3 lines of Javascript.
So we’ll look for a descendants of span with class “gamelinks”, and then we regex-replace “gameinfo” with “recap”.
jQuery("span.gamelinks a").each(function() { var $this = $(this); $this.attr("href", $this.attr("href").replace(/gameinfo/, "recap")); });
Java plugin (Firefox) on MEPIS
Mar/090
I found this link useful. It helped me to get Java running in Firefox. The instructions are a bit outdated, so I thought to repost.
First we need Java installed:
apt-get install sun-java6-plugin
We go to the Firefox “plugins” folder, and rename for the existing (not working!) plugin with a .bak extension, and then create a symlink to the (hopefully working!) plugin:
cd /usr/lib/firefox/plugins mv libjavaplugin.so libjavaplugin.so.bak ln -s /usr/lib/jvm/java-6-sun-1.6.0.12/jre/plugin/i386/ns7/libjavaplugin_oji.so libjavaplugin.so
You’ll need to restart Firefox for the changes to take effect. Hope this helps!
OCI_COMMIT_ON_SUCCESS
Mar/090
I received the following error in my CodeIgniter web application today:
Notice: Use of undefined constant OCI_COMMIT_ON_SUCCESS – assumed ‘OCI_COMMIT_ON_SUCCESS’ in …
today. It turns out that, in MEPIS at least, you need the packages bc, libaio, even if you’ve compiled support for oci8. I re-added the packages, restarted Apache and it worked, once again.
MEPIS 8 and Fujitsu Lifebook S7110
Mar/092
I previously wrote that MEPIS worked (sound, wired networking, wireless networking) out of the box for my IBM R52. FYI, the wireless card is the Intel PRO/Wireless 2200BG. I’d also previously detailed instructions on Debian “Etch”. What I didn’t state was that I would encounter issues where wlassistant would report that it was unable to get an IP address (via DHCP) whilst attempting to connect to a standard WEP router. However if I left wlassistant switched on for awhile, it would (mysteriously) work later on. I got fedup, and mostly used a wired connection thereafter.
I’m pleased to note that there are no such issues for my Fujitsu Lifebook S7110, which uses the Intel PRO/Wireless 3945ABG:
lspci -nn | grep 3945 05:00.0 Network controller [0280]: Intel Corporation PRO/Wireless 3945ABG [Golan] Network Connection [8086:4222] (rev 02)
When I booted up via the LiveCD, I feared the worst, as it was unable to connect to the (same) router. But go ahead and install nonetheless. On the first boot after install, I configured the network, to no avail. I rebooted however, and it worked fine. I’m still not sure what’s going on here, but it’s certainly a pleasant surprise.
For a time I feared that my laptop would reach it’s end of useful life before I found a distro as excellent as MEPIS, but that’s all in the past now.
Oracle and PHP5 in MEPIS
Mar/092
This post helped me install Oracle XE/Oracle instantclient successfully!
It worked for my Debian Lenny system previously, and now it’s tested to work with MEPIS 8.0 as well.
Some people such as myself might not want Oracle XE as they work off a remote (Oracle) server. So we can concentrate on getting Oracle/PHP to play nice.
I misspoke about not requiring Oracle XE. If you do not install it, PHP after you reboot Apache2, an error appears in the error_log like:
PHP Warning: PHP Startup: Unable to load dynamic library '/usr/lib/php5/20060613+lfs/oci8.so' - libaio.so.1: cannot open shared object file: No such file or directory in Unknown on line 0
So add this line to your /etc/apt/sources.lst:
deb http://oss.oracle.com/debian unstable main non-free
need to run the following commands:
wget http://oss.oracle.com/el4/RPM-GPG-KEY-oracle -O- | apt-key add - apt-get update apt-get install oracle-xe
oracle-xe has at least two other required packages: bc, libaio, which probably fixes the error in the log.
You do not need oracle-xe. The only packages required are bc, libaio1 (see below).
With oracle-xe successfully installed, we’ll focus on getting Oracle and PHP to place nice. You’ll want to download these files specifically:
instantclient-basic-linux32-11.1.0.7.zip (593 KB)
instantclient-sdk-linux32-11.1.0.7.zip (42.4 MB)
from here. Direct links won’t work, because you need to accept a license, and log in to your oracle.com account. I downloaded the .zip files to my desktop.
Switch to the “root” user:
suUnzip the “basic” file, and move the contents of instantclient_11_1 to the correct directory.
cd /home/kzhiwei/Desktop/ mkdir -p /usr/lib/oracle/xe/app/oracle/product/11.1.0/ unzip instantclient-basic-linux32-11.1.0.7.zip mv instantclient_11_1/ /usr/lib/oracle/xe/app/oracle/product/11.1.0/instantclient cd /usr/lib/oracle/xe/app/oracle/product/11.1.0/instantclient/ ln -s libclntsh.so.11.1 libclntsh.so ln -s libocci.so.11.1 libocci.so
Now unzip the “sdk” file, and move the contents of instantclient_11_1/sdk to “sdk”, under “instantclient”.
cd /home/kzhiwei/Desktop/ unzip instantclient-sdk-linux32-11.1.0.7.zip mv instantclient_11_1/sdk/ /usr/lib/oracle/xe/app/oracle/product/11.1.0/instantclient/sdk
Get required packages:
apt-get install bc libaio1 php-pear php5-dev
Download and compile the PECL oci8 package.
pecl install oci8Input “1″ and hit Enter, then type (or paste) the following text.
instantclient,/usr/lib/oracle/xe/app/oracle/product/11.1.0/instantclient/
When you’re done, hit Enter twice to begin compilation. It takes awhile.
Lastly, you need to add one line to the end of your php.ini file:
pico /etc/php5/apache2/php.ini
Page Down to the bottom, then add “extension=oci8.so”, and then Ctrl + X, Y to save.
Lastly, restart Apache:
/etc/init.d/apache2 restart
Embedding Flash in HTML, versus iframe
Mar/090
I recently received a request to develop a CakePHP website. The interface consists of a container 800 by 250 pixels width, with practically no chrome (company name, copyright info) whatsoever. It’s shows calendar entries for a given period, and users can click to view entry details (in a Thickbox). I thought the design was rather simplistic, and gave it no further thought. The project was completed in about 2 days, and I spent an additional 1.5 days making some minor changes.
Today I realized that simple design was because it was intended to replace a Flash-based calendar on the client’s homepage. I did a test with iframe, but it doesn’t work well, because the Thickbox (with entry details) is contained within the iframe.
Note to self: Clarify intended deployment method before giving price information. No hard feelings of course, since they might not understand that embedding Flash is not the same as iframe. Now it’s likely I’ll need to spend more time doing it right; i.e. template-ize their HTML, and then put in the (micro) website that I completed earlier.
SimplyMEPIS 8.0
Mar/093
My slow laptop is now running on SimplyMEPIS 8.0. Surprisingly, it doesn’t feel that slow anymore. Maybe it was an OS issue, but I digress.
The install process was a breeze. I used mepis-network to setup wireless access, gparted to partition the hard disk into two partitions of 8GB (root) and 2GB (swap) each, and then it installed by itself. Later, it setup grub for me so that if I wanted to boot into Windows, it would comply. But I won’t of course. When I boot into MEPIS for the first time, I wanted to setup wireless again, since the install was a Live CD. But I didn’t even need to perform that step! The network settings that I added during the Live CD boot had been saved! Voila!
IMO networking, particularly wireless networking has to improve significantly, even Lenny. I wish it would just work, rather than having to jump through hoops, and even then, not work particularly well.
Up till now, I cannot connect to my home wireless router. Before Lenny was released, there was a tool called “wlassistant” that worked occasionally. But now it’s gone, and all of the other tools (kwifi-radar, wireless-tools) do not work. And it’s not a router issue, because my other Windows laptops connect easily.
I’ll try to set this up as a development machine; if things go well I just might switch my (primary) laptop to MEPIS.