http://www.newcastlelug.org/

Subscriptions

August 15, 2016

James McDonald

X-Recruiting – Who would have thought

Was just checking a 301 redirect I’ve set up, and while looking at the the server output from the wget -S command I noticed that etsy.com has an X-Recruiting header. Etsy I hope your innovation brings all the coders to the yard.  

by James at August 15, 2016 05:39 AM

July 15, 2016

James McDonald

C Struct Loses it’s Settings

A while ago I blogged about a Control system that commits a C Struct to a file on a disk and then reads the file and enters the C Struct data back into the control system. The operators started noticing inconsistent behaviours. And so I have had to investigate. After much trial and error I […]

by James at July 15, 2016 08:37 AM

July 13, 2016

James McDonald

Struct is 652 Bytes Fwrite writes 656 Bytes

I am not a programmer but I had the need to write a C struct to disk When I then tried to write another of the same files to try and work-a-round a problem with the system they are used on I got a slightly large (by 4 bytes) file I was compiling the C […]

by James at July 13, 2016 01:25 PM

June 25, 2016

James McDonald

array_merge – And the winning key is!

Just a note to self about PHP array_merge The later array passed into array_merge overwrites the former, also if it’s indexed with numerical keys then the values will just be appended. <?php $option_array = [ 'element' => 'ooa1', 'optionb' => 'ob1', 'different' => 'diff', 'notin2' => true ]; $oa2 = [ 'element' => 'ooa2', 'optionb' […]

by James at June 25, 2016 03:24 AM

June 22, 2016

James McDonald

OpenRPT Context Queries, Format Strings and URLs in PDFs

OpenRPT is a Report Write that is Bundled with xTuple in all it’s flavours. It’s simple and takes some getting used to in order to use it’s power When creating a custom report there is a thing called a Context Query.  These are the values that are available page_number report_name report_title report_description page_count This screenshot shows […]

by James at June 22, 2016 12:59 PM

June 19, 2016

James McDonald

Netbeans Removes Indent from // Comments

Been using netbeans for PHP development and discovered that it will remove the leading whitespace from comments and then the comments inside a block of code are hard up against the left margin which looks weird. Not sure if there is a setting to stop this behaviour but if you do the following you will […]

by James at June 19, 2016 11:45 PM

June 18, 2016

LOGIN Wiki Changelog

makerspace:home - [University of Newcastle Makerspace]

Welcome Please sign up the mailing list below if you're interested in becoming a member of a Newcastle hackerspace/makerspace. Note: There are two separate groups. University of Newcastle Makerspace Location: Building: EE Room: EE102 Access is by request to the president of the makerspace, Luke Simmons. Once this is done you will be required to pass the EE general access quiz and the EE unsupervised access quiz, in Blackboard.

June 18, 2016 01:38 PM

James McDonald

Making Weird Grunting Noises with CakePHP 3 & Twitter Bootstrap

This is how I got grunt running with the twbs/bootstrap plugin to automatically copy the CSS, JS and Fonts into my CakePHP 3 development environment. I did this on MacBookPro OSX 10.11.5. But this applies to Linux too. If anyone has better suggestions as to how this could be accomplished easier. I am open to […]

by James at June 18, 2016 02:16 AM

June 13, 2016

James McDonald

TCPDF KeyWords Doubled in Document Properties Description Tab – Acrobat Reader

This causes the keywords to double when viewed in File ==> Properties ==> Description Tab. $pdf->SetKeywords('CLAM, CLM, Schedule, Program, Meeting, Service Meeting'); This shows the keywords once only: $pdf->SetKeywords('CLAM CLM Schedule Program Meeting Service Meeting'); In short drop the comma’s and you will be fine.

by James at June 13, 2016 02:14 PM

June 12, 2016

James McDonald

CakePHP 3 Changes To Date/Time Formatting

The new date objects have different formatting strings http://www.icu-project.org/apiref/icu4c/classSimpleDateFormat.html#details $this->Time->format($assigned_part->start_time, 'h:mm') $this->Time->format($mtg->date, 'eeee MMMM d') The old ones here don’t work http://php.net/manual/en/function.date.php as the datetime helper have been rewritten.    

by James at June 12, 2016 12:43 PM

June 11, 2016

James McDonald

I have no idea what the problem is PHP CLI

Trying to do some PHP tutorials using vim and running php from the command line and I get…. nothing back. If it’s a syntax error (e.g. a missing line ending ; ) then no reply at all. If the syntax is correct and it’s something else then the error isn’t displayed Apparently PHP CLI is […]

by James at June 11, 2016 02:48 AM

June 09, 2016

James McDonald

CakePHP POST Failing

I was just trying to submit about 10 x 15 records… and found that cakephp was failing with a validation error. Found out it was due to the following in the php error log. [09-Jun-2016 19:16:22 Australia/Melbourne] PHP Warning:  Unknown: Input variables exceeded 1000. To increase the limit change max_input_vars in php.ini. in Unknown on […]

by James at June 09, 2016 09:28 AM

June 08, 2016

James McDonald

Adding new fonts to TCPDF

Less agony way of doing it. Download your fonts and then run the following cd  /Users/jmcd/Sites/clam/vendor/tecnickcom/tcpdf tools/tcpdf_addfont.php -i /Users/jmcd/Downloads/liberation-sans/LiberationSans-BoldItalic.ttf cd fonts/   ls | grep libera liberationsans.ctg.z liberationsans.php liberationsans.z liberationsansb.ctg.z liberationsansb.php liberationsansb.z liberationsansbi.ctg.z liberationsansbi.php liberationsansbi.z liberationsansi.ctg.z liberationsansi.php liberationsansi.z

by James at June 08, 2016 11:30 AM

June 06, 2016

James McDonald

CakePHP – Call to a member function format() on array!

// failing validator rule $validator ->date('date') ->add('date', 'unique', [ 'rule' => 'validateUnique', 'provider' => 'table', 'message' => "One of the dates you submitted already exists!" ]); // working buildRules public function buildRules(...){ //... other rules here ... $rules->add($rules->isUnique(['date'])); } Error: Call to a member function format() on array File /Users/user/Sites/clam/vendor/cakephp/cakephp/src/Database/Type/DateTimeType.php Line: 108 https://github.com/cakephp/cakephp/issues/8001

by James at June 06, 2016 03:47 PM

June 02, 2016

James McDonald

CakePHP “public $paginate =” overwritten by action “$this->paginate =” Gotcha

If you have a the following code class PartsController extends AppController { /** * Index method * * @return \Cake\Network\Response|null */ public function index() { $this->paginate = [ 'contain' => ['Sections'] ]; $parts = $this->paginate($this->Parts); $this->set(compact('parts')); $this->set('_serialize', ['parts']); } and then you define a public $paginate value in the class as thus: class PartsController extends […]

by James at June 02, 2016 09:52 PM

May 29, 2016

James McDonald

CakePHP 3 – TCPDF Install and Usage

In your CakePHP top level folder (the one that has composer.json, src/, vendors/, config/, webroot/) run: composer require tecnickcom/tcpdf You should now have vendor/tecnickcom/tcpdf Now in a controller src/Controller/<ControllerName>Controller.php create an action: public function pdfView($schedule_id = null){ $this->viewBuilder()->layout('ajax'); $this->set('title', 'My Great Title'); $this->set('file_name', '2016-06' . '_June_CLM.pdf'); $this->response->type('pdf'); } Then create a view in src/Template/<ControllerName>/pdf_view.ctp class xtcpdf […]

by James at May 29, 2016 09:19 PM

May 28, 2016

James McDonald

CakePHP 3 – Escape to the Global Namespace

This code in CakePHP 3: <?php $date = '31/01/1973'; $ymd = DateTime::createFromFormat('!d/m/Y', $date)->format('Y-m-d'); Causes this error Error: Class ‘App\Controller\DateTime’ not found This code fixes it: <?php $date = '31/01/1973'; $ymd = \DateTime::createFromFormat('!d/m/Y', $date)->format('Y-m-d'); Apparently the \ backslash escapes the namespace and instead of it looking for DateTime in the current namespace it looks for it […]

by James at May 28, 2016 10:59 AM

May 25, 2016

James McDonald

Checking for port errors on Cisco Switches

Recently had a macbook pro which had a network dongle that was very hot and the network connection stopped working. Found that the dongle was sending garbled signal down the wire and the Cisco switch shutdown the port. # all status show interfaces status # port shutdown due to line errors show interfaces status | […]

by James at May 25, 2016 11:58 PM

Symantec Endpoint Protection Cloud – NIS.exe High CPU on Windows XP SP3 VMWare VMs

Just discovered that one of the patches I installed today on my VMWare hosts fixed an issue I had after installing Symantec Endpoint Protection for Small Business Cloud Hosted Edition The old ESXi build was 106549 the new one is 3872664 ( vSphere 5.1 3b ) I don’t know exactly which patch fixed it because […]

by James at May 25, 2016 07:54 AM

Dell iDRAC 6 – SEC_ERROR_REUSED_ISSUER_AND_SERIAL Firefox Error

Secure Connection Failed An error occurred during a connection to 172.16.98.XXX. You have received an invalid certificate. Please contact the server administrator or email correspondent and give them the following information: Your certificate contains the same serial number as another certificate issued by the certificate authority. Please get a new certificate containing a unique serial […]

by James at May 25, 2016 05:19 AM

May 12, 2016

James McDonald

nginx suddenly can’t proxy to non-standard ports – Boolean SeLinux

I did an upgrade recently and suddenly nginx wasn’t forwarding requests to remote hosts on non-standard ports…. this was on a CentOS host which had seLinux enabled. Turn seLinux off temporarily setenforce 0 Does nginx now work proxying to non-standard ports? Turn it back on setenforce 1 Does nginx now fail to proxy to non-standard […]

by James at May 12, 2016 08:54 AM

May 03, 2016

James McDonald

Fixed: Second Windows App Runing under Wine 1.8.1 on OSX 10.11.4 Won’t Accept Keyboard Input

I have two wine apps I typically use. If I launch both of them then I can’t enter anything into the form fields of either. To fix this I have ran winecfg and unchecked the “Allow the window manager to control the windows” option on the Graphics tab of Wine Configuration dialog. Versions: wine-1.8.1 OSX […]

by James at May 03, 2016 01:03 PM

April 27, 2016

James McDonald

IE11 Wonky Bootstrap Rendering

Problem: Internet Explorer 11 on Windows 7 Professional renders a bootstrap website with form controls in the wrong place and the layout is corrupt Cause: Internet Explorer 11 has been configured to display legacy banking website with ancient IE8 settings Resolution: Install a meta tag in the <head></head> section of the web page. <meta http-equiv="X-UA-Compatible" content="IE=edge" /> For […]

by James at April 27, 2016 12:59 PM

April 18, 2016

James McDonald

CakePHP 2 Slightly Better Looking than Default Pagination

Just trying to make my pagination in CakePHP 2 better looking. I added the first and last links but still had a radius on my previous and next links which looked odd and my ‘last >>’ link had a square end too. So a bit ugly really. Following is an example of pagination links after I […]

by James at April 18, 2016 04:41 AM

April 14, 2016

James McDonald

Welcome to the Internet Helpdesk

On one of my client sites they have a Telstra Internet connection. An Exchange server sits on the network and forwards mail out to the Telstra Smarthost smtp.telstrabusiness.com. After an update to a Dansguardian proxy server and the subsequent failure of clamd to launch (due to the update changing the permissions of /var/lib/clamav) Dansguardian went on an […]

by James at April 14, 2016 06:47 AM

April 13, 2016

James McDonald

Gaining Access to A Windows Computer when you don’t know the Password

“The trust relationship with this workstation and the primary domain has failed” This error message isn’t a big problem when you still have the local computers administrative usernames and login passwords. You just change your login details from DOMAINNAME\Administrator to COMPUTERNAME\Administrator enter you password, remove the computer from the domain by adding it to a […]

by James at April 13, 2016 05:52 AM

April 11, 2016

James McDonald

Bootstrap CakePHP 3 Bootstrap-ui

In my learnings for make self glorious user of Twitter Bootstrap I have been looking at https://github.com/FriendsOfCake/bootstrap-ui I’m using https://github.com/jmcd73/cakephp3-ajax-samples as a place to stash my code so I don’t blow my laptop away and then lose it one day and https://jmits.com.au/cake3 as the demo site. Really in the end you need to read the documentation at http://getbootstrap.com/ and then use […]

by James at April 11, 2016 01:12 PM

April 06, 2016

James McDonald

White and Nerdy

Weird Al: Saying it like it is  

by James at April 06, 2016 02:08 AM

Synology Diskstation NAS appearing in Finder as not connected of connection failed

My DS415+ Synology NAS has just been updated to DSM 6.0 In my Mac Book Pro running OS X El Capitan 10.11.4 the NAS was appearing in Finder but when I clicked on it the finder pane showed “Not Connected” or “Connection Failed” and clicking the connect as… button didn’t pop up window. My fix […]

by James at April 06, 2016 01:54 AM

April 01, 2016

James McDonald

CakePHP 3: Ain’t gonna GET if it ain’t gotta GET

Just installed CakePHP3 under nginx and tried to switch between pages of a paginated view and every time it would return the default 1st page. The url for each page was http://example.com/cake3/posts?page=2 Discovered using debug_kit that the GET request QUERY_STRING parameters weren’t being sent to CakePHP. The query string is everything after the question mark in the […]

by James at April 01, 2016 06:38 AM

March 31, 2016

James McDonald

CakePHP 3: _serialize is a View Killer

Note to self: If $this->set(‘_serialize’, [ ‘content’ ]);  then a request for content type of ‘application/json’ or ‘application/xml’ will automagically return the correct data without needing a view file. But if $this->set(‘_serialize’, false); isn’t set then a request for content type of  ‘application/json’ or ‘application/xml’ will expect a view file to format and return the data and you […]

by James at March 31, 2016 06:07 AM

March 29, 2016

James McDonald

DebugKit not Loading Toolbar in CakePHP 3

Problem: debug set to true in config/app.php, vendor/cakephp/debug_kit exists but debug kit toolbar not appearing in browser, debug_kit/js/toolbar.js shows a 404 when viewing page load in Developer Tools in browser. Cause: symlink from vendor/cakephp/debug_kit/webroot to webroot/debug_kit is missing which causes the toolbar.js not to be found and loaded. Resolution:  [root@mypc cake3]# bin/cake plugin assets symlink […]

by James at March 29, 2016 11:24 PM

CakePHP 3 AJAX Modelless & Database backed Forms

Standing on the shoulders of giants. I have converted the code from the below mentioned sites to work with CakePHP 3. Normal database backed Form with AJAX JQuery code Inspired by: http://jamnite.blogspot.com.au/2009/05/cakephp-form-validation-with-ajax-using.html Example here: https://jmits.com.au/cake3/posts Modelless Form with AJAX JQuery code Inspired by: http://miftyisbored.com/a-complete-tutorial-on-cakephp-and-ajax-forms-using-jquery/ Example here: https://jmits.com.au/cake3/ Code here => https://github.com/jmcd73/cakephp3-ajax-samples  

by James at March 29, 2016 12:49 PM

March 28, 2016

James McDonald

CakePHP 3 – Modelless Forms replace $useTable = false

I wanted to learn about using AJAX to submit a form by following http://miftyisbored.com/a-complete-tutorial-on-cakephp-and-ajax-forms-using-jquery/ and I couldn’t get the examples to work because CakePHP 3 has some significant (and better) changes. Below is my attempt at the above linked tutorial for CakePHP. I have made a number of changes from the original: I have moved the timezone […]

by James at March 28, 2016 03:08 AM

March 26, 2016

James McDonald

Globally Change Date Display in CakePHP 3

By default the Locale for CakePHP 3 is en_US so dates display as m/d/y # config/app.php 'App' => [ 'namespace' => 'App', 'encoding' => env('APP_ENCODING', 'UTF-8'), 'defaultLocale' => env('APP_DEFAULT_LOCALE', 'en_US'), 'base' => false, Which makes dates come out like this: But I live in the land down under where women glow and men plunder. So […]

by James at March 26, 2016 11:25 AM

March 02, 2016

James McDonald

How to use log() in Model/Entity/Bookmark.php CakePHP 3

In CakePHP 2.x I could insert $this->log() just about anywhere and it worked. Was just trying to do the same in CakePHP 3 from inside the file src/Model/Entity/Bookmark.php I received an error message “Call to undefined method App\Model\Entity\Bookmark::log()” To fix this you need to add 2 use statements one at the top of the file and one […]

by James at March 02, 2016 06:12 AM

February 29, 2016

James McDonald

Download Pentaho Reports from Pentaho Community Edition

Sometimes you can’t locate the original prpt file that you use to create and upload a report to the Pentaho BI Server. So how do you grab the reports from the BI server and then edit them? Firstly you need to have Pentaho Report Designer Installed. Then you need to start it and then click […]

by James at February 29, 2016 08:12 AM

February 26, 2016

James McDonald

Looking Good in a Suit

So a while ago I posted a link to an infographic about how to choose a suit that fits well. Here is another one http://www.montagio.com.au/cms/how-should-a-mens-suit-fit      

by James at February 26, 2016 10:28 AM

February 20, 2016

James McDonald

Extracting Icons to make Custom Launcher Icon on mac

I use Homebrew to install wine to run Microsoft compatible apps Install Homebrew by following the instructions from http://brew.sh/ brew update brew install wine Install your Microsoft Windows App … mount DVD or ISO image, or copy the contents of the DVD to a USB key if you don’t have a DVD player for your mac, launch a […]

by James at February 20, 2016 11:12 AM

February 16, 2016

James McDonald

For the Seriously Lazy – wakeonlan

Note: The caveat to using Wake-on-LAN to wake your Synology box is that if you switch off the switch that connects your Synology to your network it will loose it’s MAC address table map (the one that tells the switch which Ethernet port the Synology is plugged into). So this will only work when your Synology […]

by James at February 16, 2016 11:29 PM


Powered by Planet!
Last updated: August 25, 2016 03:00 PM

RSS 20 Atom