Monday 31 January 2011

Websiting

Today I was still working on my currency conversion plugin for wordpress.

I had an sql query that wasn't executing properly when initiating the plugin. So I tried to debug it by var_dumping the sql and exiting, which causes the plugin's output to display with a fatal error message on the wordpess plugin activation screen.

At least, that's what it does normally. My code looked like this:
echo 'gh1';
        if($wpdb->get_var("SHOW TABLES LIKE '$tblCur'") != $tblCur) {
             echo 'gh1a';
            //create the table
            $sql = 'CREATE TABLE IF NOT EXISTS '.$tblCur.' (
                    code VARCHAR(3) NOT NULL,
                    symbol VARCHAR(5) NOT NULL,
                    name VARCHAR(25) NOT NULL,
                    symbol_entity_num VARCHAR(30) NOT NULL,
                    symbol_entity_hex VARCHAR(30) NOT NULL,
                    rate FLOAT(7) UNSIGNED NOT NULL,
                    PRIMARY KEY (code)
            )';
            echo 'gh2a';
            require_once(ABSPATH . 'wp-admin/includes/upgrade.php');
            echo 'gh3a';
            dbDelta($sql);
            echo 'gh4a';
            $sql= "INSERT INTO $tblCur (code, symbol, name, symbol_entity_num, symbol_entity_hex) VALUES ";
            echo 'gh5a';
            if (($handle = fopen(WP_PLUGIN_DIR.'/wp_dk_currencyConversion/currency_details.csv', 'r')) !== FALSE) {
                $data = fgets($handle);
            echo 'gh6a';
                $sql.= "($data)";
                while (($data = fgets($handle)) !== FALSE) {
                    $sql.= ", ($data)";
                }
                fclose($handle);
            }
            echo 'gh7a';
            $wpdb->query($sql);
            echo 'gh8a';
            var_dump($sql); exit();
        }
        echo 'gh2';
        if($wpdb->get_var("SHOW TABLES LIKE '$tblCou'") != $tblCou) {
            echo 'gh1b';
            //create the table
            $sql = 'CREATE TABLE IF NOT EXISTS '.$tblCou.' (
                    country VARCHAR(2) NOT NULL,
                    currency VARCHAR(3) NOT NULL,
                    PRIMARY KEY (country, currency)
            )';
            echo 'gh2b';
            require_once(ABSPATH . 'wp-admin/includes/upgrade.php');
            echo 'gh3b';
            dbDelta($sql);
            echo 'gh4b';
            $sql= "INSERT INTO $tblCou VALUES ";
            echo 'gh5b';
            if (($handle = fopen(WP_PLUGIN_DIR.'/wp_dk_currencyConversion/country_currency_map.csv', 'r')) !== FALSE) {
                $data = fgets($handle);
            echo 'gh6b';
                $sql.= "($data)";
                while (($data = fgets($handle)) !== FALSE) {
                    $sql.= ", ($data)";
                }
                fclose($handle);
            }
            echo 'gh7b';
            $wpdb->query($sql);
            echo 'gh8b';
            var_dump($sql); exit();
            
        }
        echo 'gh3';
Strangely, the SQL within the first if block would be executed (the table would be created), but none of the echoes, the var_dump within that block would be printed, and the exit in that block would not execute either.

However, all the other echo statements, including the ones in the 2nd if block, would be printed, and the exit in the 2nd if block was honoured.

After fixing the sql error (I had an extra column I was missing), I tried putting
var_dump($sql); exit();
straight after the first if block. Again, the sql in the first if block was executed, but no output from that block was recorded, and the exit statement in the block wasn't honoured.

The script now exited where my exit statement between the two if blocks was, but the $sql variable was NULL, as if the first if block hadn't been executed at all.

The only reasoning I can think of behind this is that if a plugin exits, Wordpress may try activating the plugin again, and only report a fail and the output of the plugin when the second attempt exits.

This would explain it as the table wouldn't exist on the first try, and so it would exit after creating the table. Wordpress would then try again, and the table would now exit, so none of the first if block would be executed on this second attempt, which would then exit and only print data from the second attempt.

As an aside, unfortunately it seems that neither setting $wpdb->show_errors() and using $wpdb->print_error() actually do anything when a mysql query fails. This is why I use var_dumps of the sql instead - I can then copy the sql and try it in phpMyAdmin, which will then give me the error why it failed.

In the afternoon I also topped up the pond a bit.

In the evening I also watched an episode of Magi Rangers and Let's Learn Japanese Basic 1 with Mauser and Bo.

Sunday 30 January 2011

Poggin'

Today I was cutting out pogs in photoshop and then uploading them to my pog website nearly all day.

I also did a binary compare between one of my drives and a backup, and there quite a few corrupted files on the backup. Doing some googling, it seems that you need to do a chkdsk to find and mark the bad sectors on the disk, and this can take a long time. So I haven't attempted to do a chkdsk on it yet.

In the evening I watched an episode of Magi Rangers with L, and in the afternoon I watched the 2nd half of Notts County v. Man City as well.

Saturday 29 January 2011

Various

Today I did more work on my currency plugin for wordpress, helped Mauser with his shelf making, and went on Mario Bros 3 for a bit.

Friday 28 January 2011

Websiting

This morning I restored a backup to overwrite a large number of files that Windows had decided to modify when I moved a folder. While I was waiting, and also after the restore was finished, I read some of the new articles on the Luminous Landscape.

Most of the rest of the day I was working on a currency conversion plugin for wordpress, which I need to use with my ebay plugin.

In the evening I watched yet another really bad episode of Star Trek TNG with Mauser and Bo, and another good episode of Magi Rangers with L.

Thursday 27 January 2011

Websiting

This morning I was doing more work on my ebay wordpress plugin.

If anyone is interested, below is a list of url parameters that you can use in an ebay search query url. This blog post: eBay Search URL Structure Explained explains another format of search url that you can use on ebay, and also includes a list of all the country numerical ids that you can use in your ebay search url parameters.

This list below is not an exhaustive list, there are quite a few other parameters you could use as well. In my wordpress plugin I only intend on including a few of these parameters, to match the parameters supported by the EPN link generator.

http://shop.ebay.domain/i.html?

_nkw= //keywords
&_in_kw= //search type 1=All words, any order, 2=Any words, any order, 3=Exact words, exact order, 4=Exact words, any order
&_ex_kw= //exclude keywords - don't use as can exclude keywords in normal way e.g. 'Watch -battery' to search for watch and exclude battery
&_okw= //unknown, possibly something to do with original keyword when you mis-spell a search and ebay corrects it, but there are also many other parameters used when this happens

&_adv=1 //unknown
&_sacat= //category
&sop= //sort order
&LH_TitleDesc=1 //Search description as well

&_fspt=1 //enable search for nearby items
&_sadis=150 //num miles from postcode
&_fpos= //postcode or zip code to search for items near

&_ipg=50 //results per page
&LH_PayPal=1 //Show accepting paypal only
&LH_Lots=1 //items listed as lots

&LH_Auction=1 //Show only auction items (can be used with below)
&LH_BIN=1 //Show only Buy It Now items (can be used with above)
&LH_CAds=1 //Show only classified ads

&_LH_Time=1 //enable search by time
&_ftrt=901 //items ending within
&_ftrt=902 //items ending in more than
&_ftrt=903 //items started within
&_ftrv=2 //number of hours

&_LH_NOB=1 //enable search by no. bidders
&_sabdlo=4 //min bidders
&_sabdhi=5 //max bidders

&_LH_MIL=1 //enable search by no. multiple listings
&_samilow=2 //min multiple listings
&_samihi=4 //max multiple listings

&LH_SubLocation=1 //enable searching by location
&_fsradio2= //Type of search, args below but url encode
 &LH_PrefLoc=1 => preferred location
 &LH_LocatedIn=1 => located in
 &LH_AvailTo=1 => available to
&_sargn= //Preferred location, arg url encode
 -1&saslc=0 => website domain e.g. UK for ebay UK, default
 -1&saslc=3 => Europe (on UK site)
 -1&saslc=2 => Worldwide
&_salic=3 //Located in (country numbers)
&_saact=3 //Available to (country numbers)

//Seller
&_fss=1 //Only show items from certain sellers or types of seller
&_fsradio=%26LH_SpecificSeller%3D1' //Specific Seller
&_saslop=1 //1=Include listed sellers 2=Exclude listed sellers
&_sasl= //ID / name of seller

//Min and Max price
&_mPrRngCbx=1 //enable filtering by price
&_udlo= //min price
&_udhi= //max price

In the evening I watched a bad (though not terrible, mainly just boring) episode of Star Trek TNG with Mauser and Bo. I also watched an episode of Magi Rangers with L and another episode of Lets Learn Japanese Basic 1 with Mauser and Bo.

Wednesday 26 January 2011

Writing blog posts

This morning I installed the latest update to Microsoft Security System Essentials, but when I restarted the computer as the final step of the install, the computer started doing a chkdsk and reckoned it was restoring several thousand orphan files. Not sure if the Security System Essentials update and chkdsk were related, but very annoying either way.

After that I did a backup, which took wuite a long time

While the backup was going on, and also for most of the rest of the day, I 'wrote' some more posts for my photography tips website, and also a couple of Korea photo posts for my main photography website blog.

In the evening I watched a Japanese lesson video (yes, the ones I started downloading yesterday, all downloaded already) with Mauser and Bo. I watched the download speed for a bit while it was still downloading, and it actually went over 1MB/s. So it seems like we have a very fast internet connection (at least for the UK).

Maybe youtube / Google should look into implementing bit torrent support for Chrome / Youtube as youtube videos always download so slowly that they need buffering for ages before you can watch them.

Anyway, the Japanese lesson was good and funny. It was made in '84, but seems more 70s.

According to Wikipedia, in Let's Learn Japanese Basic Series 2:
Yan's heart is torn asunder by the young lady he had a crush on in series one, and he goes to Niigata to drown his sorrows in the wild winter Sea of Japan.

While that sounds quite Japanese, I think it's more likely that someone has added that text to Wikipedia as a joke.

Also in the evening I watched Magi Rangers with L.

Tuesday 25 January 2011

Websiting

Today I was still mainly working on my ebay wordpress plugin.

In the evening I watched an episode of Magi Rangers with L, then did a Japanese lesson with Mauser. After that I looked to see if there are any TV programs you can watch to help learn Japanese. I saw someone suggested the videos posted by gbfcaefj01, saying they were good for beginners. But after watching episode 5961, I only understood a couple of words out of the whole episode.

I found a learn Japanese TV series from the 80s (and you could tell it was very 80s / late 70s style), so I added that to download on Mauser's comp.

Monday 24 January 2011

Websiting

This morning I was working on my ebay carousel. I started off with the basic non-javascript version, trying to get the style of the text and buttons look the same as the amazon carousel.

I started coding the buttons using CSS3 for rounded borders and gradients. But then I realized that actually, since the buttons are fixed size, it would be easier to use just use images than mess about trying to use images in some browsers and CSS in others.

In the late afternoon and most of the evening I was watching Batman Forever with L. I also had a haircut in the evening.

Sunday 23 January 2011

Moving files

This morning I went to Church.

In the afternoon I watched an episode of Magi Rangers with L and updated my pog website.

In the evening I watched an episode of Star Trek TNG that was amazingly boring.

Also in the evening I watched 'The Prestige' with Mauser and Bo.

In the morning I started moving (copying) some files from one of my hard drives that was full to another one that wasn't full. Then throughout the rest of the day I was doing a binary compare between the copy and the original files, and then the two backups as well. All came out the same, so I deleted the original files.

Saturday 22 January 2011

Various

This morning I uploaded a couple of the panos I took yesterday to my pano and photo websites, and also uploaded one to various photo sharing websites.

After that, and for most of the afternoon, I worked on my ebay wordpress plugin. I watched an episode of Magi Rangers with L in the afternoon as well.

In the evening I watched an episode of Star Trek TNG with Mauser and Bo, and then made cinnamon whirls while Bo made choc chip cookies. Bo helped me with the cinnamon whirls a bit when he had finished making the cookies.

Friday 21 January 2011

Processing panos

Today I was processing the three panos that I took on my walk yesterday.

In the evening I watched an episode of Life on Earth and an episode of Magi Rangers with Mauser and Bo. I did a Japanese lesson with Masuer as well.

I read a blog post by Nick Laight How I banked £1.64 million in 20 days using the free content model – a case study. It isn't really about free content at all, rather that he built a large list using free content and then sells products to that list. The product in question that he says netted £1.64 million in 20 days and has done over £10 in million sales to date, he doesn't actually mention the name of.

However, he says it was a forex product released in 2008 and priced around £2000 (+VAT). Searching for this I find 'Ultimate Forex Predictor', released in 2008 for around £2000, and published by Canonbury Publishing (Nick's company). However, reading the thread on the Trade2Win forums, I couldn't see anyone who made money using the system. To be fair, I only read up to about page 20 of the thread though, so maybe after that there were posts by people who did make money using it.

So While Nick might have made over £10 million in sales of this product, it doesn't seem like the sales were made in an ethical manner, and I wonder if that £10 million figure includes all the packages that were returned for a refund?

Thursday 20 January 2011

More character set encoding problems

Today I was mainly uploading Korea photos to my photo and pano websites. In the afternoon I also went out on a walk, which was extremely muddy.

I had problems with character coding again, in Adobe Bridge all the Hangeul characters in my keywords were now appearing as empty squares □, even though they were displaying fine yesterday.

The problem also occurred on folder names, but in the image preview section, it did display the Hangeul characters correctly!

Then I noticed that the same problem also was happening in Windows Explorer. Doing some googling I couldn't find anyway to change the character set encoding or font in Adobe Bridge, but I did find some info on how to change the font in Windows 7. I first tried the registry trick there, but that didn't seem to do anything. I next tried the first method given there, and changed the 'icon' font to one that includes Hangeul characters.

This worked, and I could now view Hangeul characters in Windows Explorer (the same as I could prior to today), but unfortunately Adobe Bridge still displays the squares □. Very strange and annoying for Windows and Bridge to just randomly break like that.

Wednesday 19 January 2011

Geocoding

Today I started uploading the photos I took on 05/10/2009 to my photo website. Unfortunately when I checked the Korea Folk village photos, quite a few were obviously geocoded wrongly. (Probably most of the photos are geocoded wrongly, but it is quite difficult to get the locations accurate since the satellite imagery on google earth isn't good and most of the village looks very similar).

So the ones that were obviously geocoded wrongly, I tried to geocode them more accurately. This took quite a long time, both researching to try and get the location as accurate as possible, and then waiting for Robogeo to do the geocoding.

When the photos were geocoded with more accurate locations, this brought up a new problem. My RAW files are Nikon NEFs, and Adobe Bridge writes XMP data for the NEFs to a .xmp sidecar file. Now I had already written descriptions, keywords, etc. for all the images, but because Robogeo had updated the NEF files, they now had a later modified date than the NEFs. This meant that all the descriptions etc. I had written weren't appearing for the newly geo-coded NEFs in Bridge.

Bridge must look at the last modified date of the NEF and sidecar, sees that the NEF has been modified more recently than the XMP sidecar, and so doesn't bother reading the XMP sidecar, thinking any info in it must be out of date.

One solution is in the XMP File Info Panel you can import the file's XMP sidecar, thus restoring the 'lost' XMP data. But if you have 100s of files, this can be a pain.

Another alternative is to edit the XMP sidecar and save it, so that now the XMP sidecar file has a last modified date that is newer than the NEF file. This makes Bridge read the XMP sidecar file.

What I did was to put all the modified NEF files and their XMP sidecars in a single folder. I then used exiftool to update all the XMP sidecars in one go
exiftool.pl -XMP-xmp:MetadataDate+=1 -ext .xmp ./


However, this didn't quite work correctly. Strangely, Bridge did not read the Keywords from the XMP sidecar. Why? Who knows. So I still had to manually import the XMP sidecar files through the File Info Panel to get the keyword data back.

And then there is another problem. For some reason, with JPEGS, Bridge / the XMP File Info Panel doesn't treat the XMP data as UTF-8, even though according to the XMP specification (which Adobe created)
XMP must be encoded as UTF-8 when embedded in TIFF, JPEG,
JPEG 2000, PNG, PDF, PSD, and PostScript/EPS files
So I had to put all the newly geo-coded JPEGs into a folder together and used ExifTool to update the IPTC:CodedCharacterSet tag, which is what Bridge / XMP File Info Panel uses to determine the XMP character encoding.
exiftool.pl -IPTC:CodedCharacterSet="UTF8" -ext .jpg ./


Doing this with various photos that I'd taken at the Korea Folk Village and were mis-geocoded took most of the day.

Tuesday 18 January 2011

Metadataring

This morning I was working on adding images and Amazon ads to a couple of posts for my photography tips website.

I had some trouble when previewing the post though, as one of the photos (which had foreign characters in its filename) wasn't showing up. After doing some Googling, it seems that this is some weird problem with HostGator: Host Gator Shared Hosting support - non-english characters in filenames.

In Filezilla I went into the site settings for my HostGator site, and changed the character encoding to 'Force UTF-8'. I re-uploaded the file, and now it worked okay. I don't know if there will be any problems from this though.

All afternoon I was still metadataring my Korea Folk Village photos.

In the evening I watched an episode of Magirangers with L and metadatared some Korean train station photos.

Monday 17 January 2011

Metadataring

Most of this morning I was recording a Kingston Trio record to my PC.

This afternoon and evening I was keywording my Korea Folk Village photos.

Sunday 16 January 2011

Various

Today I updated my pog website and went to Church. I also finished watching 'Inception' with Mauser and Bo, and watched the 2nd episode of 'Life on Earth' with them as well.

In the evening I did a bit more description writing / research for my Korea Folk Village photos.

Saturday 15 January 2011

Various

Today I was still researching descriptions for my Korea Folk Village photos. I also made some Eccles Cakes with L, and watched most of 'Inception' and all of the first episode of David Attenborough's Life on Earth with Mauser and Bo.

Friday 14 January 2011

Metadataring

Today I was mainly researching descriptions for some of my photos from the Korea Folk Village.

In the evening it looked like there was going to be a nice sunset. But I was very glad that I didn't go out to photograph it as some clouds quickly blew in and dumped their contents (heavy rain and hail).

Thursday 13 January 2011

Photo processing

Today I was mainly processing Korea photos.

In the morning I stubbed my toe on the doorpost when going into the bathroom. Then when I came out I noticed some red marks on the floor. Wondering what they were I found that my foot had started bleeding, and I'd tramped blood around the bathroom floor and a small bit of bedroom floor.

So I spent quite a while scrubbing the blood off the carpet.

In the evening I was mainly doing research, trying to find out what a couple of my photos were of.

Wednesday 12 January 2011

Photo processing

Today I was mainly processing panos and a few other Korea photos. I also read some of the info in the Trade2Win Forex Net Trap forum.

Tuesday 11 January 2011

Websiting

Today I was doing some more work on my ebay wordpress plugin. One of the things I was doing was trying to see if you could get a carousel widget like Amazon has.

It doesn't seem like you can get one for ebay, and all the javascript carousel scripts I could find seemed to be simple 2d scroll left and right affairs. I found some flash carousels, but they were free trials with watermarks. Then I found this video on how to create your own carousel in flash.

And just now, by searching for "javascript 3D carousel", it seems you can actually get a javascript script to create an Amazon style carousel: Cloud Carousel - A 3d Carousel in Javascript

Monday 10 January 2011

Websiting

This morning I tidied up some stuff and did some vacuuming. After that I worked on my ebay plugin for wordpress.

After much deliberation and some coding, I decided that actually I would drop the separate module / extension handling for my plugin, and instead make it so that modules / extensions are written and activated as normal wordpress plugins.

This has the benefit that I don't have to code any extra plugin handling ability myself. The downside is that all the extension plugins for my plugin will appear as normal plugins, which could make the plugin list panel in wordpress look a bit cluttered.

I think that also I will change the way that the plugin handles shortcodes. Currently it uses just one shortcode, and within the shortcode you specify a type parameter, e.g.
[wp_dk_ebay type="editorKit_default" items="5" etc="etc"]
The main plugin would handle the the shortcode, then pass this off to the extension plugin that was registered to handle the shortcode with type 'editorKit_default'.

But I think I will change it so that the main plugin doesn't handle any shortcodes, and the shortcodes are specified in the extension plugins instead. So the shortcode would instead be something like
[editorKit_default items="5" etc="etc"]

In the evening I also watched an episode of Kamen Rider Black and VR Troopers with L.

Sunday 9 January 2011

Article submitting

Today I went to Church and updated my pog website. I also added my flower photography report to hubpages, and finished and uploaded the PDF version of it.

Saturday 8 January 2011

Article submitting

Today I was going to add my flower photography article to hubpages, but when I logged in I saw there was a problem in that my previous article had been marked as duplicate. After doing some research, it seems that hubpages want articles to not only be original, but also exclusive to them.

So I modified my previous article on hubpages, changing some of the words around, and swapping some of the sections to be in a different order. It took quite a long time, and I still don't know if it was actually enough for hubpages to count the article as being exclusive.

I also spent quite a long time trying to make a PDF version of the flower photography article. Unfortunately OpenOffice.org Writer seems to behave similarly to how I remember Word '97 (or it might have been 2000) behaving when I tried to use it for DTP, i.e. randomly moves things around and is generally very hard to work with.

Friday 7 January 2011

Article submitting

Today I spent most of the day writing an article about flower photography. Although I was only covering photographing flowers in natural surroundings (as opposed to arranged flowers or studio shots), I still found my article was long enough for 2 separate articles. Actually, I could even have split it into 3 articles.

I split it into two articles for articlesbase and ezine articles, but added it as a single long article to squidoo.

Wednesday 5 January 2011

Various

This morning I spent quite a while replying to a email. After that I was trying to figure out how to make my ebay wordpress plugin extensible. I couldn't work out the best way to do it, so I posted a question on sitepoint to try and get some advice.

Next I simplified down my google map to try and make an easier test case study for a bug with google maps in IE6. I cut the code down gradually, removing bits piece by piece and then testing after each change to make sure the bug still existed (and wasn't caused by part of my code).

Because I was doing this bit by bit with constant testing, it took me most of the morning and the first part of the afternoon.

After that I processed a few Korea photos, then spent the rest of the afternoon and evening testing Topaz Remask 3, Vertus Fluid Mask 3, and onOne Mask Pro, and writing a blog post for my photo website about them. I had to read the documentation / watch the various tutorial videos for each of them to make sure I knew how to use them properly, so that took quite a while.

Monday 3 January 2011

Websiting

This morning I was trying to fix some problems with my hacked together filsofo comments / subscribe2 plugin for wordpress. I had received some bounced emails from the filsofo comments subscribe part of the plugin. The plugin creates a new user for anyone who subscribes to comments and whose comment isn't marked as spam.

The bounced emails appeared to be sent to email addresses entered by spam comments, so I thought it must just be that askimet hadn't marked them as spam until after the email had been sent. When I checked the database, the users didn't exist at all. And even more weirdly, the user IDs were less than the highest user ID in the database.

I checked that the bounced emails weren't originally sent before I had updated the plugin, and they weren't. I did a test comment myself, and my user was added to the database okay, and with the next correct sequential ID. So I have no idea how those emails could have been created or sent.

Next I had a problem with my website sending out a weekly digest email with just the 5 oldest posts from the blog. After some investigating, I found this was due to the way wordpress' get_posts function works. One of the parameters of the function is 'include', which is a list of posts you want to include. So I use this to specify which posts are to be included in the email.

But in the last week, I haven't made any new posts. So the include parameter was passed with either an empty string or null as it's variable. This meant that instead of not including any posts, get_posts included all posts. So to fix my function I just had to make sure that a list of posts to include did exist before calling get_posts.

And the thing about 5 posts is that get_posts only retrieves 5 posts by default. So I changed that to -1, which is unlimited.

The rest of the day I was working on my ebay wordpress plugin. In the evening I also watched an episode of Star Trek TOS with Mauser and Bo, did a Japanese lesson with Mauser, and watched Magi Rangers with Bo and Mauser.

Sunday 2 January 2011

Various

This morning I started work updating my pog website, then went to Church.

After dinner I finished updating my pog website, then did a bit of work on my ebay wordpress plugin.

I played on Wii Golf with Mauser and Bo for a bit, then made some Eccles Cakes.

After tea I watched an episode of Star Trek TOS with Mauser and Bo, then did some more work on my ebay wp plugin.

Saturday 1 January 2011

Trying to compress PNGs with foreign characters in the filenames

This morning I was working on some more articles for my photography tips website. Not actually writing the articles, just finding relevant CC licensed Flickr photos and Amazon products to illustrate and break up the articles. The actual articles are from articlesbase.com.

One of the articles was advertising a product that accepts affiliates. So I signed up to their affiliate program, but then they didn't seem to actually offer promoting that particular product as an affiliate! I spent quite a while trying to see if it was possible, since it seems strange that they would allow you to promote most of their products as an affiliate, but just not that particular one.

In the afternoon I started getting some pog images ready to update my pog website. Some of the images (PNGs) had Japanese or Chinese characters in the filenames, and when it came to optimising them with PNGGauntlet, I found that it skipped all the ones with the foreign characters.

After doing some googling, I couldn't find any other reports of this, or a solution, so I thought I'd try an alternative to PNGGauntlet / PNG-OUT. I found the website smush.it, which allows you to upload you PNG files. It then compresses them, and provides a zip file of the compressed files for you to download.

While smush.it did compress the PNG files, and it displayed the filenames on the website correctly, the filenames in the actual zip file it provided for download were all mangled, like
04-Nobisuke-Nobi-(Úçĵ»ö-Òü«Òü¦Õè®).png

So I looked to see if there was a linux program I could use, since Linux is much better with unicode / utf-8 support than windows. I found there was a linux port of PNG-OUT (seems weird for a command line utility to be ported from windows to linux, usually it is the other way round).

Next I needed to know how to use the command line PNG-OUT as I'm used to the ease of the PNGGauntlet GUI. I found this tutorial, which gives all the command line options for PNGOUT on windows: PNGOUT Tutorial. Now I just needed to know how PNGOUT wanted to command line parameters in Linux.

I tried running pngout --help, the --help wasn't actually recognised, but it output the options / help by default anyway. The answer was just that pngout on linux uses a dash "-" instead of a switch "/" on windows.

But when I tried running pngout on linux to compress a folder of png files, it wouldn't work. After some messing about, I could only think that pngout only supports compressing one file at a time, and doesn't support batch processing.

So I had to write a bash script:
for f in $1/*.png
do
 ./pngout -s0 -kt -y $f
done;
I placed it in the same folder as pngout and made it executable, and it worked quite nicely like
./pngoutbatch.sh ~/folder-with-pngs-in

What a lot of palaver just to compress some PNGs with foreign characters in the filenames!

In the evening I watched an episode of Star Trek TOS with Mauser and Bo. I did a Japanese lesson with Mauser, then went on Animal Crossing.