Wednesday, November 28, 2012

Raspberry Pi Webserver w/ Wordpress Slow

I installed the LAMP stack on a Raspberry Pi, then moved a small Wordpress site to it. It then got plugged into a fast connection at a data center.

Before the move (shared hosting webserver at Siteground):

  • 1 second load times on the main page
After the move (Raspberry Pi):
  • 8-9 second load times on the main page
  • 5 second load times on single pages
The Pi does a good job at displaying static pages, but it does not run more intensive things like a CMS quickly enough.

Tuesday, November 27, 2012

LAMP Stack Ubuntu

It's crazy easy to install the LAMP stack on ubuntu with this command:

sudo apt-get install lamp-server^

Monday, November 26, 2012

SPJS Charts - Dynamically Select Filter Item

I've been using SPJS charts to make google charts with data from sharepoint lists. If you use a custom drop-down filter, you may want to dynamically select items in the drop-down like I did.

An example: You're using a drop-filter which filters the results by week, but you always want it to select last week.


function manualLoad(){
loadManually = false;

Date.prototype.getWeek = function() {
     var onejan = new Date(this.getFullYear(),0,1);
     var today = new Date(this.getFullYear(),this.getMonth(),this.getDate());
 var dayOfYear = ((today - onejan + 1)/86400000);
 return Math.ceil(dayOfYear/7)

$("#MyChart1_CustomFilterSelect_Week").val(new Date().getWeek()-1).change();

Tuesday, November 13, 2012

2nd Place - Ericsson & North Texas Food Bank Hackathon

The "Hackathon" was a programming competition sponsored by Ericsson to solve some of the North Texas Food Bank's problems.

Here's a link to our project:

It's a scheduling system that allows people to see which days need more volunteers, then sign up to volunteer. The coolest part is that it will call people with a prerecorded message reminding them of their appointment.

Calculate Weeks In Sharepoint


This is a modified version of this formula which didn't give me the correct week number (maybe due to regional settings?): 

It matches the number of weeks calculated in excel and all the calculators I could find on the internet.

Update: I also needed to add a 0 before the "Week" if the number is less than 10, because it will cause an error in sorting otherwise.

Here's the formula to add a 0 if the number is less than 10:
=IF((INT((Date-DATE(YEAR(Date),1,6)+(TEXT(WEEKDAY(DATE(YEAR(Date),0,1)),"d")))/7)+1)<10,"0"&(INT((Date-DATE(YEAR(Date),1,6)+(TEXT(WEEKDAY(DATE(YEAR(Date),0,1)),"d")))/7)+1),(INT((Date-DATE(YEAR(Date),1,6)+(TEXT(WEEKDAY(DATE(YEAR(Date),0,1)),"d")))/7)+1))&" "

(Note: the &" " part forces it to be a string rather than a floating point value)

Thursday, November 1, 2012

Impressive Javascript

"D3.js is a JavaScript library for manipulating documents based on data. D3 helps you bring data to life using HTML, SVG and CSS. D3’s emphasis on web standards gives you the full capabilities of modern browsers without tying yourself to a proprietary framework, combining powerful visualization components and a data-driven approach to DOM manipulation."