Website Design and Mobile Application Development in Austin, Texas

Tutorials

Fixing EACCES error when deploying Node 8 apps on Amazon Elastic Beanstalk

Recently, when working on deploying a nodejs app for a customer on Elastic Beanstalk and was encountering an issue during the deployment.  Here’s the error from the eb-activity.log.

gyp verb `which` failed code: 'ENOENT' }
gyp verb check python checking for Python executable "python" in the PATH
gyp verb `which` succeeded python /usr/bin/python
gyp verb check python version `/usr/bin/python -c "import platform; print(platform.python_version());"` returned: "2.7.12\n"
gyp verb get node dir no --target version specified, falling back to host node version: 8.8.1
gyp verb command install [ '8.8.1' ]
gyp verb install input version string "8.8.1"
gyp verb install installing version: 8.8.1
gyp verb install --ensure was passed, so won't reinstall if already installed
gyp verb install version is already installed, 
Read the rest

Export to CSV invalidates session on CodeIgniter

Export to CSV invalidates session on CodeIgniter

I ran into an interesting problem I’d never seen before this evening. I’m not sure if this is a problem isolated to the CodeIgniter framework because I’ve seen a few forum posts on Sencha/ExtJS reporting the same type of issue. But this was definitely happening for me on CodeIgniter.

The situation was that every time a user exported some data from one of my web applications to csv in Internet Explorer 8 and then opened that csv file, it would invalidate their session.  So, for example, they were running a report in the administrative console that provided results in an html table.  On all of the web applications that I write, I always give the user the ability to export … Read the rest


Passing Date Values to Drupal’s REST Service Views

Passing Date Values to Drupal’s REST Service Views

We had a situation recently with a Drupal installation that we have been working on.  We were building a REST service on a Drupal installation using the Drupal Service Views module.  We built a view that allows an AngularJS client to perform listing and searching on a Drupal installation that contains inventory objects.  The client in this case is building a site that will allow their sales people the ability to review inventory that is available for sale

Everything was going great with the filtering until we got to the piece where a sales person can filter all inventory based on a date that the item was made available.  In our service view, we had created a filter on the … Read the rest

Posted on May 6th, by Peter in Tutorials.

Simple PHP Function for Iterating over Microsoft Excel Column Names

I recently had a need to create a function that iterates over a list of strings and writes them out to a column in a Microsoft Excel spreadsheet that I was creating for a client. In Excel, the columns are labeled A-Z, AA-AZ, BA-BZ, etc… and it continues on.  I couldn’t find any existing functions in PHP that did this, so I wrote my own below:

function column_name($index) {
  if($index<27) {
    $letter = “A”;
    for($i=1; $i<$index; $i++) {
      $letter++;
    }
  } else {
    $div = intval($index / 27);
    $mod = $index % 27;
    $letter = column_name($div);
    $letter.= column_name($mod);
  }
  return $letter;
}

Read the rest

Ranking Teams based on Win/Loss/Tie Record using PHP’s usort()

For a current project I’m working on, I’ve had to rank a list of teams based on their win-loss-tie record within their division acheter viagra en ligne. I searched the web but was unable to find anyone who had done this and posted an example so I figured I’d post my process. If you have corrections or improvements for this, please feel free to comment.

The code assumes that you have an array of team objects that each have a win/loss/tie property. As an example, I’ve got an array of five teams such that:

Array
(
  [0] => stdClass Object
  (
    [id] => 1
    [name] => Team 1
    [wins] => 5
    [losses] => 6
    [ties] => 3
  )

  [1]

Read the rest

Dropping Spam with Postfix and SpamAssassin on GoDaddy’s Dedicated Servers

We recently ran into a situation where one of our users was receiving a large amount of spam to their forwarded email account. Our setup is a dedicated server running Simple Control Panel at Godaddy. We handle email for a few clients and this one in particular was receiving 100’s of spam emails every hour.  Pretty much as soon as we set up this client, we started hitting our 1,000 SMTP Relay limit which prevented us from sending any further emails for any other client on the server.

There is a simple fix to this that I had a difficult time finding so I decided to create a post on this for anyone else who might run into this issue.… Read the rest

Display Posts from Two WordPress Blogs on the Same Page

Display Posts from Two WordPress Blogs on the Same Page

I recently got a request from a client of mine to setup two different wordpress blogs for her company and then display the posts from both blogs in a single list on the home page of her web site. I wasn’t able to find much documentation of people doing this type of thing through various searches, so I figured I’d post an entry on it when I finished. As a disclaimer, I’m sure that this can be done more efficiently or in less code. If you have a better way to do it, please leave me a comment. I’m always open to learning new techniques.Read the rest

Posted on October 6th, by Peter in Tutorials.


Simple PHP Function to Remove Invalid Characters from a String

I’ve run into situations where I’ve installed content management systems for customers who like to add their own content and/or copy content from documents they’ve created. Often, this results in them copying non-ASCII characters such as smart quotes, elipsis, or em dashses. I’m not sure why (maybe someone can educate me by posting a comment below) that PHP can’t handle these characters, but I’ve come up with a way to replace these characters with characters or character sequences that PHP understands. The function is below.

function cleanString($string) {
$find[] = ‘“’;  // left side double smart quote
$find[] = ‘”’;  // right side double smart quote
$find[] = “‘”;  // left side single smart quote
$find[] = “’”;  // right

Read the rest

Simple Image Slideshow with jQuery and jQuery Cycle Plugin

Simple Image Slideshow with jQuery and jQuery Cycle Plugin

<a class="demo" title="jQuery Image Slideshow" href="http://www.halfslide viagra generique pharmacie.com/sample/slideshow/” target=”_blank”>See The Demo

I recently completed a website design project for a local austin company that involved creating a simple klart image slideshow on the login page of their application. These types of slideshows have traditionally been done using an animation toolkit or framework such as Adobe’s Flash product. Starting around three years ago, I was introduced to script.aculo.us which provided the ability to use effects with DOM elements to provide cool animations.

Just within the last year, I’ve started working more with jQuery and have been introduced to the slew of extremely cool plugins.  The newest one I’ve come across is jQuery Cycle.  Using this plugin and 9 … Read the rest

Posted on September 16th, by Peter in Tutorials.