Haxe/OpenFL: Class name must start with uppercase error

A few of my old projects stopped working with the latest version of Haxe 3 and OpenFL 2. This was the error message that I got:

Error: Could not process argument format
Class name must start with uppercase character
Build halted with errors (haxelib.exe).
Done(1)

Of course that error message is not really giving any informations on what’s going wrong. My first idea was that haxelib is being called with invalid parameters making haxelib interprete the parameter as the class name. But a quick check made sure that this wasn’t the cause of the uppercase error message.

I had some other ideas on what could be causing the uppercase error, but none of the things that I tried or looked at changed anything about the error message. Finally I had the idea to compare the applications xml files of projects that still work and those that didn’t.

That led me onto the right path, all the broken projects had this line:

<library path="assets/swf/library.swf"></library>

I outcommented it and the error message was gone.

Fixing 404 errors on all subpages of F3 (Fat Free Framework)

I had some fun figuring out why the Fat Free Framework gave 404 errors on every single page except for the start page when testing the micro frame work on a local windows xampp installation. I expected the problem to related to the .htaccess configuration because logs showed that the file index.php wasn’t called on anything but the web root (/).

The Fat Free Framework .htaccess file

# Enable rewrite engine and route requests to framework
RewriteEngine On
 
# Some servers require you to specify the `RewriteBase` directive
# In such cases, it should be the path (relative to the document root)
# containing this .htaccess file
#
#RewriteBase /
 
RewriteRule ^(lib|tmp)\/|\.(ini|php)$ - [R=404]
 
RewriteCond %{REQUEST_FILENAME} !-l
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule .* index.php [L,QSA]
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization},L]

This looks correct, time for some extended debugging.

Debugging Apache’s mod_rewrite using LogLevel

I added this debugging code to the apache virtual host entry:

LogLevel warn mod_rewrite.c:trace6

And took a look at the log again:

[Sun Nov 09 17:45:56.592151 2014] [rewrite:trace4] [pid 10812:tid 1728] mod_rewrite.c(475): [client 127.0.0.1:64913] 127.0.0.1 - - [test.auctions.notboring.org/sid#273fc90][rid#9a1a0e0/initial] [perdir D:/work/projects/auctions/httpdocs/] RewriteCond: input='D:/work/projects/auctions/httpdocs/userref' pattern='!-l' => matched, referer: http://test.auctions.notboring.org/
[Sun Nov 09 17:45:56.592151 2014] [rewrite:trace4] [pid 10812:tid 1728] mod_rewrite.c(475): [client 127.0.0.1:64913] 127.0.0.1 - - [test.auctions.notboring.org/sid#273fc90][rid#9a1a0e0/initial] [perdir D:/work/projects/auctions/httpdocs/] RewriteCond: input='D:/work/projects/auctions/httpdocs/userref' pattern='!-f' => matched, referer: http://test.auctions.notboring.org/
[Sun Nov 09 17:45:56.593151 2014] [rewrite:trace4] [pid 10812:tid 1728] mod_rewrite.c(475): [client 127.0.0.1:64913] 127.0.0.1 - - [test.auctions.notboring.org/sid#273fc90][rid#9a1a0e0/initial] [perdir D:/work/projects/auctions/httpdocs/] RewriteCond: input='D:/work/projects/auctions/httpdocs/userref' pattern='!-d' => matched, referer: http://test.auctions.notboring.org/
[Sun Nov 09 17:45:56.593151 2014] [rewrite:trace2] [pid 10812:tid 1728] mod_rewrite.c(475): [client 127.0.0.1:64913] 127.0.0.1 - - [test.auctions.notboring.org/sid#273fc90][rid#9a1a0e0/initial] [perdir D:/work/projects/auctions/httpdocs/] rewrite 'userref' -> 'index.php', referer: http://test.auctions.notboring.org/
[Sun Nov 09 17:45:56.593151 2014] [rewrite:trace3] [pid 10812:tid 1728] mod_rewrite.c(475): [client 127.0.0.1:64913] 127.0.0.1 - - [test.auctions.notboring.org/sid#273fc90][rid#9a1a0e0/initial] [perdir D:/work/projects/auctions/httpdocs/] add per-dir prefix: index.php -> D:/work/projects/auctions/httpdocs/index.php, referer: http://test.auctions.notboring.org/
[Sun Nov 09 17:45:56.593151 2014] [rewrite:trace2] [pid 10812:tid 1728] mod_rewrite.c(475): [client 127.0.0.1:64913] 127.0.0.1 - - [test.auctions.notboring.org/sid#273fc90][rid#9a1a0e0/initial] [perdir D:/work/projects/auctions/httpdocs/] strip document_root prefix: D:/work/projects/auctions/httpdocs/index.php -> /index.php, referer: http://test.auctions.notboring.org/
[Sun Nov 09 17:45:56.593151 2014] [rewrite:trace1] [pid 10812:tid 1728] mod_rewrite.c(475): [client 127.0.0.1:64913] 127.0.0.1 - - [test.auctions.notboring.org/sid#273fc90][rid#9a1a0e0/initial] [perdir D:/work/projects/auctions/httpdocs/] internal redirect with /index.php [INTERNAL REDIRECT], referer: http://test.auctions.notboring.org/
[Sun Nov 09 17:45:56.593151 2014] [rewrite:trace3] [pid 10812:tid 1728] mod_rewrite.c(475): [client 127.0.0.1:64913] 127.0.0.1 - - [test.auctions.notboring.org/sid#273fc90][rid#3754918/initial/redir#1] [perdir D:/work/projects/auctions/httpdocs/] strip per-dir prefix: D:/work/projects/auctions/httpdocs/index.php -> index.php, referer: http://test.auctions.notboring.org/
[Sun Nov 09 17:45:56.593151 2014] [rewrite:trace3] [pid 10812:tid 1728] mod_rewrite.c(475): [client 127.0.0.1:64913] 127.0.0.1 - - [test.auctions.notboring.org/sid#273fc90][rid#3754918/initial/redir#1] [perdir D:/work/projects/auctions/httpdocs/] applying pattern '^(lib|tmp)\\/|\\.(ini|php)$' to uri 'index.php', referer: http://test.auctions.notboring.org/
[Sun Nov 09 17:45:56.593151 2014] [rewrite:trace2] [pid 10812:tid 1728] mod_rewrite.c(475): [client 127.0.0.1:64913] 127.0.0.1 - - [test.auctions.notboring.org/sid#273fc90][rid#3754918/initial/redir#1] [perdir D:/work/projects/auctions/httpdocs/] forcing responsecode 404 for D:/work/projects/auctions/httpdocs/index.php, referer: http://test.auctions.notboring.org/

The mod_rewrite debug log shows that the rewrite rules are being applied. The first step seems to work: It makes sure the URL doesn’t map to a file, folder or link. Then rewrites it to index.php. All good and nice. But what’s that? The system is applying the first rule again, suddenly the forwarding to the index.php file causes an 404 error.

Seems like mod_rewrite handles the [L] flag that is supposed to stop all further checks not in the way I assumed it would. Time to read the docs again and yes, [L] does not work as expect and (suprise, surprise!) I am not the first to have run into this issue:

http://stackoverflow.com/questions/6797998/rewriterule-last-l-flag-not-working

Fixing Fat Free Frameworks 404 error using the REDIRECT_STATUS environment variable

It’s easy to tell mod_rewrite to not apply an rule on internally rewritten URLs. This is how a working .htaccess file could look like:

# Enable rewrite engine and route requests to framework
RewriteEngine On
 
# Some servers require you to specify the `RewriteBase` directive
# In such cases, it should be the path (relative to the document root)
# containing this .htaccess file
#
#RewriteBase /

RewriteCond %{ENV:REDIRECT_STATUS} ^$
RewriteRule ^(lib|tmp)\/|\.(ini|php)$ - [R=404]
 
RewriteCond %{REQUEST_FILENAME} !-l
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule .* index.php [L,QSA]
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization},L]

Fixing Fat Free Frameworks 404 errors using [END]

You could use the [END] flag:

# Enable rewrite engine and route requests to framework
RewriteEngine On
 
# Some servers require you to specify the `RewriteBase` directive
# In such cases, it should be the path (relative to the document root)
# containing this .htaccess file
#
#RewriteBase /
 
RewriteRule ^(lib|tmp)\/|\.(ini|php)$ - [R=404]
 
RewriteCond %{REQUEST_FILENAME} !-l
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule .* index.php [END,QSA]
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization},L]

And everything is working as expected.

NOTE: the [END] flag only works on Apache 2.4 and newer!

Update:

As pointed out by xfra365, the developers of F3 fixed the issue by removing the check for “php”. Since that’s the official fix, i’d go with it.

Getting the Yoast WordPress SEO Plugin to work with the Gonzo theme

I changed a site running on the Gonzo wordpress theme to run the Yoast SEO plugin instead of AIO SEO since my comparisson test of these two plugins got me better results for yoast. But after switching the plugin the webpage was missing a proper meta description part. I took a look at the Gonzos theme template files, concretely the header.php file.

It looks like this:

	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
 
	<title>< ?php wp_title();?></title>
 
	< ?php if ($omc_favicon !== NULL) { ?><link href="<?php echo $omc_favicon; ?/>" rel="shortcut icon"/>< ?php } ?>
 
	<meta name="description" content="<?php bloginfo('description');?/>">
 
	<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1"/> 
 
	< ?php wp_head(); ?>

As you just saw it has wp_title() for the page title and a hardwired meta description built in. While wp_title() is fine with the Yoast SEO add, the hardwired description tag blocks Yoast from writing the tag. ALl I needed to do to fix that, was removing the line:

	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
 
	<title>< ?php wp_title();?></title>
 
	< ?php if ($omc_favicon !== NULL) { ?><link href="<?php echo $omc_favicon; ?/>" rel="shortcut icon"/>< ?php } ?>
 
	<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1"/> 
 
	< ?php wp_head(); ?>

Now the Yoast SEO addon can add the description meta tag and everything should work fine.

What does the > (bigger than) sign mean when it comes to CSS selectors?

If you use a < (bigger than) sign when chaining IDs in the CSS selector it means you only want to select the direct child, but not children below the direct child as you would if you only use a space character instead of >.

An example:

<div class="test">
  <div> <!-- direct child -->
    <div></div> <!-- child of direct child -->
  </div>
</div>

As you can see we got an outer div with a class named “test” that is wrapping two nested div tags.

An css selector example for accessing the direct child

If you use

.test > div

you will only select the direct child, but not the children nested below it.

An css selector example for accessing all children

If you use

.test div

you will access the direct child and all children below it.

An css selector example for accessing the child node of the child

If you want to only access the child of the direct child, you can chain the greater then signs:

.test > div > div

Read the stackoverflow posting on the topic for some extrainfos:

http://stackoverflow.com/questions/4459821/css-selector-what-is-it

Translating The WordPress Auction Nudge Addon To German

I needed to integrate eBay auctions into a wordpress based website and chose the Auction Nudge Plugin for it, since it seems to be the most realiable addon for this task.

Auction Nudge hints on how to translate the language, but doesn’t explain how to do it in detail. Read the official docs here:

http://www.auctionnudge.com/demos/demo-translate.html

The article suggest you should include the example code into the page that the eBay listing is being shown on. I wanted to use it on every page, so decided to move another way, I am going to include the script into the footer of every page. For that I could hack some hook into the child theme, but I chose not to, since there’s a nice comfortable plugin that allows me to get to the goal without editing code directly:

https://wordpress.org/plugins/add-to-footer/

I installed it and went to the Settings (Plugin List -> Settings button below Plugin description). There I enabled the plugin and copied my code:

<script type="text/javascript">
			function auction_nudge_loaded() {
				jQuery('div.auction-nudge li, div.auction-nudge td, div.auction-nudge th, div.auction-nudge strong').each(function() {
					//Get HTML
					var an_html = jQuery(this).html();
 
					//=== START edit for your language ===
 
					//Used in multiple themes
					an_html = an_html.replace(/Buy It Now/gi, 'Jetzt Kaufen');
					an_html = an_html.replace(/Ends/gi, 'Ablaufdatum');				
					an_html = an_html.replace(/View Item/gi, 'Anzeigen');
 
					//Only used in column theme (you don't need to edit if you are using another theme)
					an_html = an_html.replace(/Picture/gi, 'Foto');
					an_html = an_html.replace(/Item/gi, 'Objekt');
					an_html = an_html.replace(/Product/gi, 'Produkt');
					an_html = an_html.replace(/Bids/gi, 'Gebote');
					an_html = an_html.replace(/Price/gi, 'Preis');
					an_html = an_html.replace(/Time Left/gi, 'Ablaufsdatum');
 
					//=== END edit for your language ===
 
					//Update HTML			
					jQuery(this).html(an_html);					
				});
		</script>

Note: I used jQuery() where the example used $(). $() is a short cut for jQuery() and wasn’t available in the themes context.

I saved the code and reloaded the page. And my eBay listings became german. Except for the time display.

The eBay seller widget can’t be translated. A simple way to still it anyway, is by putting it into a hidden container and then copying the values using javascript to a self made widget.

Hide.ME’s Sock 5 proxy

I was testing the hide.me socks 5 (socks5) service since they were selling it as part of their premium account and it was largely disappointing. I planned to use it to offer an fixed IP anonymous service on the internet as well as use it to have a bigger pool of IP adresses to spider a few 100 amazon/yelp products without getting IP banned. Sadly enough the hide.me socks5 offer is still not really usable for tasks like that.

Server locations for hide.me

hide.me vpn/socks5 servers in America / USA

  • Montreal, Canada
  • San Jose, California, USA
  • Washington, D.C., USA
  • Miami, Florida, USA
  • Salt Lake City, Utah, USA
  • Seattle, Washington, USA

hide.me vpn/socks5 servers in Europe

  • Paris, France
  • Frankfurt, Germany
  • Reykjavik, Iceland
  • Milan, Italy
  • Siauliai, Lithuania
  • Steinsel, Luxembourg
  • Haarlem, Netherlands
  • Roosendaal, Netherlands
  • Bucharest, Romania
  • Stockholm, Sweden
  • Zurich, Switzerland
  • London, United Kingdom

hide.me vpn/socks5 servers in the rest of the world

  • Hong Kong, Hong Kong
  • Marrakech, Morocco
  • Singapore, Singapore
  • Istanbul, Turkey

Sadly, hide.me isn’t a service provider for that the kind of tasks described above. Why? Hide.me has a clear focus on VPN services. The socks5 service features look like the service has just been created to accelerate and secure torrent up- and downloads. Looking at how hide.me ist a so called “non logging” service, that makes the most sense.

So, the socks5 service is only working when connecting to it over the related VPN, crippling the usage a lot. Up- and Downstream were great, set up was easy, just the VPN requirement makes the usage of the socks5 proxy complicated, sometimes impossible, since you have no local IP on applications that need it. A real pity.

If those restrictions are not an issue for you, the Socks5/VPN-service Hide.Me still will make you happy. Lots of servers in many countries, a good uplink and uncomplicated usage do speak for hide.me

Fixing quasselcore losing PostgreSQL support on debian installations

After updating an debian installation the postgreSQL using quasselcore service suddenly lost all its settings, logs, channels. I tried to manually start the server forcing the progreSQL usage to get an idea on what’s happening:

rom040:~# quasselcore --configdir=/var/cache/quassel --select-backend=PostgreSQL
2014-09-03 22:51:26 Warning: SslServer: Certificate file /var/cache/quassel/quasselCert.pem does not exist
2014-09-03 22:51:26 Warning: SslServer: Unable to set certificate file
           Quassel Core will still work, but cannot provide SSL for client connections.
           Please see http://quassel-irc.org/faq/cert to learn how to enable SSL support.
2014-09-03 22:51:26 Warning: SslServer: Certificate file /var/cache/quassel/quasselCert.pem does not exist
("QSQLITE", "QMYSQL3", "QMYSQL")
("QSQLITE", "QMYSQL3", "QMYSQL")
Core::selectBackend(): unsupported backend: PostgreSQL
    supported backends are: SQLite

Seems that quasselcore doesn’t support PostgreSQL at all anymore? What is going on?

How fix quasselcore losing postgresql support

Oh, asking google on the debian dependencies show that the package libqt4-sql-psql is gone missing. Let’s install it manually:

rom040:~# apt-get install libqt4-sql-psql
Paketlisten werden gelesen... Fertig
Abhängigkeitsbaum wird aufgebaut.
Statusinformationen werden eingelesen.... Fertig
Vorgeschlagene Pakete:
  libqt4-dev
Die folgenden NEUEN Pakete werden installiert:
  libqt4-sql-psql
0 aktualisiert, 1 neu installiert, 0 zu entfernen und 0 nicht aktualisiert.
Es müssen noch 0 B von 73,5 kB an Archiven heruntergeladen werden.
Nach dieser Operation werden 219 kB Plattenplatz zusätzlich benutzt.
Vormals nicht ausgewähltes Paket libqt4-sql-psql:amd64 wird gewählt.
(Lese Datenbank ... 116163 Dateien und Verzeichnisse sind derzeit installiert.)
Entpacken von libqt4-sql-psql:amd64 (aus .../libqt4-sql-psql_4%3a4.8.2+dfsg-11_amd64.deb) ...
libqt4-sql-psql:amd64 (4:4.8.2+dfsg-11) wird eingerichtet ...

And it’s back to working.

rom040:~# /etc/init.d/quasselcore start
[ ok ] Starting distributed IRC core: quasselcore.
m4s0n501

qTranslate stopped getting updates – What can you use as replacement/alternative for it?

qTranslate seem to be discontinued, at least it didn’t get updated for a while. Since the latest version has its issues with current word press versions I needed to find a replacement.

Of course I wanted to be able to convert my current qTranslate based wordpress multilanguage installations so put a focus on the import on qTranslate language files and articles.

A good solution was found fast:

https://wordpress.org/plugins/mqtranslate/

Somebody created a fork of qTranslate and keeps it updated.

Thanks!

Encoding MP3s for use in Haxe Flash exports

I needed to encode some audio samples to be used in an Haxe Flash export and remembered the troubles I first had when figuring out how to create valid MP3 files for use with Haxe. Here a quick hint to everybody that has the same issues (Haxe complains about getting Layer 1 files instead of Layer 3) with embedding. Haxe denies the import when you encode the mp3s using Adobe Media Encoder and various other tools that I tested.

Lame-Drop – a MP3 Encoder that works for Haxe/OpenFL

A tool that actually works for encoding the MP3 files for Haxe/OpenFL is Lame-Drop, which uses the Lame MP3 encoder. You can download it here:

http://www.rarewares.org/mp3-lamedrop.php

Using Adobe Scout to profile a Haxe/OpenFL flash export

I needed to do some profiling on an flash export of a mobile Haxe/OpenFL/HaxeFlixel based project. Since I own a license of adobes creative suite I decided to test Adobe Scout.

But it didn’t work, there was no sign of Scout noticing the swf file running. After a bit of research I found out that you need to enable advanced telemetry in the SWF file to be able to use scout. Since Haxe didn’t seem to have a function for this I looked for an tool to do this. And yes, there was something like it.

SWF Scout Enabler – A way to enable Adobe scout profiling for Haxe flash/swf exports

This is it’s home:

https://github.com/renaun/ActionScriptExamples/tree/master/SWFScoutEnabler

The link points to the git repository of the full source of the Adobe Air application. Compile it and use it.

SWF Scout Enable – Compiled EXE version for people that don’t want to compile themselves

Or if you are “too lazy” for compiling, you can also download a .air file that was created by the author of SWFScoutEnabler:

http://renaun.com/air/SWFScoutEnabler.air

The link is mentioned in the read me of the Source Repository in case you wonder if you should trust the binary.