Posts

Running a meteor shell on a standalone server

For those that want to connect to meteor's shell running on a standalone/self-maintained server, the standard command you use in the development environment doesn't work. Fortunately you can 'trick' it into allowing the `meteor shell` command. APPDIR=/opt/bitnami/apps/myapp export METEOR_SHELL_DIR="$APPDIR/.meteor/local/shell" # other settings # ... exec node $APPDIR/bundle/main.js cd /opt/bitnami/apps/myapp mkdir -p .meteor/local/shell echo > .meteor/packages echo 'METEOR@1.2.1\n' > .meteor/release meteor shell

Javascript (ECMAScript 5.1) Refresher

I’ve been recently working heavily on JavaScript based applications in both Node.js and a Chrome extension. After working mostly on Java, I thought I’d share the syntax, conventions and the new features of ECMAScript 5.1 and parts of the still pending version, ES6 /ECMAScript 2015, that I’ve come across. Comparisons Operators == equal to === equal value and equal type != not equal !== not equal value or not equal type I saw something else I thought was a fancy notation: if (!!something) //which is not a special operator, it just converts it to boolean, i.e a double not. (!!something) === (!(!something)) //this would only be useful if you want to set a boolean to something truthy, i.e. var a = "somevalue"; var asBoolean = !!"somevalue"; Object Initializer Something I had thought was not a fully adopted syntax, was being able to specify the getter / setter functions in the initializer. (MDN Object initializer ) var o = { func1: function (p1, p2) {}, ge...

Cygwin, access control, default groups and just getting it playing nice

correcting current and default permissions If you've been messing with your permissions on copying data across from another NTFS system, some of the owners/groups may be off and the even after correcting the owners and their permissions, any new files don't have the right defaults. This simple script replaces the ACL records for each file and directory, giving the default permissions specified. find $1 -type f -exec setfacl -f facl {} \; find $1 -type d -exec setfacl -f dacl {} \; dacl - directory permissions user::rwx group::rwx other:r-x default:user::rwx default:group::rwx default:other:r-x facl - File Permissions user::rw- group::rw- other:r-- default:user::rw- default:group::rw- default:other:r-- Specifying the default groups for users The documentation for cygwin is in depth but doesn't simply answer the question: How do I set the default group for a user? (in the out of the box configuration). The starting point is the mkpasswd utility. These are the fo...

Getting PHP FastCgi Process Manager (FPM) and nginx working in cygwin

Despite the popularity of nginx and php, I was surprised that it wasn't easiy to find a working configuration for PHP-FPM (fast cgi) with a nginx server in front, running on cygwin. Once I had the right fragments of settings, it was a case of systematically trying them all out. /etc/php5/php-fpm.conf : [global] pid = /var/run/php-fpm.pid ;note: i create a /var/log/php dir owned by the service user/group ;this allows the permissions to be inherited easily on the filesystem error_log = /var/log/php/fpm-global.log ; cygwin user default is 256 rlimit_files = 1024 ;pool configuration, having a pool config per site means you can easily have a separate log file [www] ;they have to be set but the cygwin version ignores them ;user=service-user ;group-service-group ; The address on which to accept FastCGI requests. listen = 127.0.0.1:8001 ; or ; listen = tmp/php-cgi.socket ; for socket unset these: listen.owner=service-user listen.group=service-group ; this allows the process pool ...

Remote debugging PHP from phpStorm

Despite all the documentation out there, it seemed to take me longer than it should. Although in hindsight, it could have been working originally as phpStorm's indicator that it's debugging is subtle. Debug session within phpStorm Two articles to get you started: phpStorm Help: Configuring Xdebug phpStorm Confluence: Xdebug Installation Guide To setup follow do the following: For chrome (probably the easiest), install this plugin: Chrome Plugin Configure the plugin and select phpStorm as your IDE. Next sign onto your remote server and enable xdebug module for cPanel, click select php version (only 5.4 and 5.5 supported) update version check the xdebug module click update Edit the php.ini, e.g. for cPanel, edit or create:  /home/[username]/public_html/.user.ini ; Settings for xdebug module was already loaded on this machine: ; zend_extension=/opt/alt/php54/usr/lib64/php/modules/xdebug.so xdebug.remote_host=[your modems IP address] xdebug.remote_port=[a po...

Good defaults for Wordpress (on a cPanel server)

After spending some time finding problems in a few Wordpress sites, both local in my dev environment and on a cPanel hosted server, I finally decided to sit down and work out the best base settings for each environment. The settings I've picked are mainly around dev and debugging, however I will try and keep this post updated as I come across new settings. php.ini settings Local Dev These settings can be set in your local dev env php.ini (e.g. in c:\php-installdir\php.ini ) display_errors = On display_startup_errors = On log_errors = On error_log = C:/temp/php-errors.log error_reporting = -1 Production / hosted On cpanel servers, create a file in public_html:  ".user.ini"  ( /home/[user]/public_html/.user.ini ). Its without quotes but starting with a dot. Similar contents but limited by what you can set. display_errors = Off error_log = /home/[user]/logs/php-errors.log error_reporting = -1 Depending on the server you may be able to alternatively use .htacces...

Plex Framework 2.5.0 Plugin Manifest

I’ve found that the documentation on the website doesn’t tie up with the API that is currently included with Plex. So here’s the bits of data I’ve gleaned. The plugins & directory structure of Plex is based around OSX / iOS Bundle Structures . Each plugin has an Info.plist file which is based off Apple’s one (the documentation is here ) with some extra properties. Some of these are documented on Plex's site but some were missing. This is a near complete list of them all and what I could work out their purpose to be. Keys for Info.plist taken from core.py CFBundleIdentifier Plugin name PlexPluginClass Type of plugin, default ‘Content’ (but is ‘Channel’ under bundleservices). Values from constants.py:[‘Content’, ‘Agent’, ‘Channel’, ‘Resource’, ‘System’] PlexPluginTitle The display name PlexPluginIconResourceName Default: 'icon-default.png' PlexPluginArtResourceName Default: 'art-default.jpg' PlexPluginTitleBarResourceName Default: 'title...