React Native: Application is not registered

- This is either due to a require() error during initialisation or failure to call AppRegistry.registerComponent.

I had been struggling with this for some time and the answer was right there… I had to make sure I called AppRegistry.registerComponent with the right params/appname – I had renamed my app and forgot to update the class name and also the name passed to registerComponent.

And, one way to rename a project is by renaming in package.json and then running react-native upgrade.

HTTPS and GA referral exclusion

After converting a site to be served over TLS, we noticed the drop off rates increasing on some pages. This was because: user was being redirected to a payment page on another domain that was also served over TLS. As, now both sites were served over TLS, Google Analytics was picking up the referrer (HTTPS -> HTTP would pass no referrer, HTTPS -> HTTPS does) and was counting the payment page/domain as a new source. Thus, counting the redirect as an exit. Fix was simple, I excluded the payment domain in the referral list.

Google Analytics referral exclusion

missing scheme in email body url

Some mail service providers (Yahoo Mail exhibits this at the moment), do not like links that do not have a scheme(http/https for instance) and will make the link non-clickable by removing the href. The fix is simple:

<!-- link is not clickable -->
<a href="www.google.com">Google</a>
 
<!-- link is clickable -->
<a href="https://www.google.com">Google</a>

how to not run a cron job between certain datetimes

Say, I have a cron job entry and do want the job to run between 2013-02-01 9PM (Feb 1st 2013) and 2013-02-02 11AM (Feb 2nd 2013), this is one possible solution (in crontab).

* * * * * [ $(/bin/date "+\%Y\%m\%d\%H") -lt 2013020109 -o $(/bin/date "+\%Y\%m\%d\%H") -gt 2013020211 ] && /PATHTOMYSCRIPT/myscript

rsync only certain files

Create a file on on the origin server and use the –files-from option

cd /
rsync -anvi --files-from=/tmp/only_these_files . to-server:/
 
cat /tmp/only_these_files
/srv/www/mysite/uploaded_files/9a3d3d9046aaad4bbe3074d794a6adaf.jpg
/srv/www/mysite/uploaded_files/5ca1c97efd730427f846e457bd0a0667.png
/srv/www/mysite/uploaded_files/5b0923025b4a1fde3a34119bfcd56567.jpg
/srv/www/mysite/uploaded_files/870ed45d9ad704deace8fb541242425a.jpg

WordPress + Nginx + Permalinks Rewrite rules

The following works for me:

  location /blog/ {
          index  index.php;
          # WordPress pretty URLs: (as per dominiek.com)
          if (-f $request_filename) {
                  break;
          }
          if (-d $request_filename) {
                  break;
          }
          rewrite ^/blog/(.+)$ /blog/index.php?q=$1 last;
 
          # Enable nice permalinks for WordPress: (as per Yawn.it)
          error_page  404  = /blog/index.php?q=$uri;
  }

I have my blog here: http://www.trk7.com/blog/
and my permalink structure is: /%postname%/

myisamcheck running out of tmp space

Recently I was running myisamcheck on an entire database housed inside a vserver. And, by default vserver mounts a 16MB ramfs on /tmp. This obviously is not an ideal solution when you are running a DB server that has a few tables that are around 20GB. So I had to specify a different directory for storing temporary files – that was on a partition with enough space – while running myisamcheck. To do that I had to make use of the –tmpdir parameter defined here.

Also, the way to increase the /tmp size inside a vserver seems to be this. I have not tested that solution yet.

Getting rid of MySQL Warning: Truncated incorrect DOUBLE value

If you come across a cryptic warning like this:

| Warning | 1292 | Truncated incorrect DOUBLE VALUE: 'xxxxxxx'

on running a MySQL query, it could be caused by using a numeric value against a CHAR/VARCHAR column.

---assuming `name` is a CHAR/VARCHAR column
---the following query might cause warnings
SELECT * FROM `t1` WHERE `name` IN (1, 2, 3);
---replace the above with this
SELECT * FROM `t1` WHERE `name` IN ('1', '2', '3');
--and the warnings are quite likely to go away

Pentaho Spoon error

If you get an error like this:

Error connecting to database: (using class org.gjt.mm.mysql.Driver)
Unknown initial character set index ‘192’ received from server. Initial client character set can be forced via the ‘characterEncoding’ property.

Then in the database connection settings, do as highlighted in the screenshot below.

kettle_db_character_encoding