Flux RSS des billets

DotMG's joblog

Work hard at whatever you do! (Ecc. 9. 10a)
L'archive pour le mois de Octobre 2012 a 6 Billets
Publié le 21 Oct 2012, 1:04 pm dans iseries
When compiling a RPGIV program, I found a lot of errors, caused by one fact: RNF2120 on one file XXXX
fXXXXXXXX  if   e           k disk
When I check the file XXXXXXXX, it exists and in one of my library list. And it is not in QTEMP. So, why does the compiler issuing a RNF2120. After many tries and retries, I've issued a DSPFFD on the file to see if there was anything abnormal with the file creation. And Bingo! DSPFFD failed. It was because I created the file in SQLRPG PGM which was NOT compiled with COMMIT = *NONE, so the file exists but in a zombie state, waiting for a COMMIT or a ROLLBACK. So, I signed off, modified my SQLRPG program which creates the file by adding
recompiled and re-created the file and problem solved.
Publié le 9 Oct 2012, 2:40 am dans jQuery

I'm rather bad at jQuery. I had a philosophy of avoiding technologies and funny stuffs that could alter accessibility. No java applets, no flash, and very few javascript codes. But with jQuery, portability of javascript codes is getting better, and nowadays, few people have javascript disabled on desktop ... On a mobile device, it's another story.

So, it took me more than 30 minutes to find out how to retrieve the innerText of a clicked element inside a .click(). Sometimes, the problem with javascript debugging is that almost everything is an object, and when you alert($k); to see what it is, you'll only know that it's an object. My fault is that I didn't read the documentation enough to know how to access the clicked object.

$('.myquery a').click(eventObj) {
 var clicked_object = $(this);
Publié le 5 Oct 2012, 6:52 am dans iseries

We needed to cleanup the iSeries, by removing all the unnecessary files. It seems to be always a good game to go haunting for large files. For me, going the IFS way was a discovery. The simple command below did all the job.

qsh cmd('find / -size +200000 -ls >/home/bigfiles.txt;')

Those familiar with Linux recognize here the find command. A subtle difference is in the number +200000, for the find command on QShell, you multiply this number by 512 to get the number of maximum bytes. Here, I'm looking for files having a size bigger than 200.000 * 512 ~ about 100MB. And it lists every file on IFS that has a size bigger than 100MB, but also every member of any physical file having a size greater than 100MB.

This takes an eternity to complete. PGM-FIND eats up to 20% UC, most of the time about 7% and for my case, this was not a real issue.

Publié le 4 Oct 2012, 8:15 am dans apache, php

This is the second part of the story about this site in all plain html that needed some revamp. Yesterday, I talked about installing PunBB as a forum, and today, I'll talk about a quick templating.

I think the webmaster used tools like Dreamweaver to build the site. My friend asked me to move one image in the footer of the page. That image was inside a <table>, moving it for one page was not a PITA, but repeating the steps for all .html files would really suck. Other options would be to create a script to do this automatically, or restart from scratch with a templated system. Finally, I found a dirty quirk to do the job, and without changing any file present in the site. It's really simple, I redirect all URL in .html into a script mytemplate.php, passing the filename as a parameter, and do everything in mytemplate.php.

.htaccess to perform the redirection:

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteRule ^([^/]*).html$ mytemplate.php?page=$1 [L]
RewriteRule ^/?$ mytemplate.php?page=index

Second step is to copy index.html into mytemplate.php. I stripped all content, leaving only what would be in a template, ie: <head>, header, footer and sidebar part of <body> tag. mytemplate.php is now my template for all .html file. What I removed was replaced with some simple PHP instructions which load the content of the page :

if (preg_match('![/\\:]!', $_GET['page'])) return;
$k = file_get_contents($_GET['page'].'.html');
$k = preg_replace('/^.*<!-- end of menu -->/sm', '', $k);
$k = preg_replace('!^\s*<!--start of footer -->.*$!sm', '', $k);
echo $k;
The first instruction is a security measure, just in case someone tries to exploit this template with URL like /mytemplate.php?page=/etc/passwd (although the 2nd line allows only .html file to be read). The second line loads the .html file. The 3rd and 4th lines strip headers and footers, because they are now provided by the template mytemplate.php. Looking for the pattern was the hardest thing to do, but if some of the html files missed these pattern, I could add them manually. And that's it. For any change I need to do, I have to play with mytemplate.php only. The other good surprise is that I can mask all the changes I've made just by disabling the rewriting in .htaccess.
Publié le 3 Oct 2012, 2:31 am dans cms, php

One reseller of webhosting at Dot.MG asked me to revamp one of her customer's website. The old webmaster seems to ignore anything about templating and dynamic pages, all files of the website were served statically. That's a good thing for my servers, but a very bad thing when it comes to touch something in his designs. We'll talk later about how I re-templated this installation.

This site had a bulletin board, which was hosted elsewhere, on free forum hosting, and integrated to his site with ugly <iframe>.

I had to install myself a discussion board, and, it's the first time in years that I had to play again with a bulletin board. Last time I've use one, PhpBB was the king of BBs. One of the forum I like is run by Vanilla and I went on their site to download one look for a download link. I was not looking to download the archive, rather looking for a download link, to copy the URL and use wget on the server. Actually, I feel very uncomfortable with downloading something to my PC and then uploading the file to my servers. I'm now used to get the tarball directly from my test server, doing the install there, and repeat the process on the production box when everything is okay.

But, VanillaForums didn't give a simple download link, the download was on a post form, so I was obviously obliged to use a browser and click the download button. I gave a last chance to Vanilla by passing --post-data to wget, but when this was also failing, I gave up and did a quick search for lightweight forum. Then I saw this stackoverflow discussion where I saw PunBB as one of the candidates. And yes, PunBB has usable download links. At my great surprise, PunBB has support for Sqlite, the installation was easy and straighforward.

And there are the reasons why I chose PunBB.

Pages: 1 2