Ajax CSV upload to a Table with jQuery and PHP

So I had to write a new user importer for School Email and I was looking for a simple plugin in solution but didn’t find one so here is a simple way of uploading a csv file that is uploaded to a file and rendered to a table..

Projects used: CsvToTable & jQuery File Upload & Editable Grid *optional for live edits.

Grab those two projects, grab the below files and put them in a /js folder then put the .js files into your head..

Put the jQuery-File-Upload folder in your root, we will be uploading files to here.. You may want to add a layer of security in front of the upload function.

<head>
<script src="/js/csvToTable.js"></script>
<script src="/js/jquery.iframe-transport.js"></script>
<script src="/js/jquery.fileupload.js"></script>
</head>

At the bottom of your body add..

<div id="csvToTable"></div>
<div id="fileupload"></div>
<script>
var loggedIn = 1; // you will want to modify this if you require auth
$(function () {
  if(loggedIn == "1"){
    $('#fileupload').fileupload({
      dataType: 'json',
      acceptFileTypes: '/(csv)$/i',
      url: '/jQuery-File-Upload/php/index.php',
      done: function (e, data, Users) {
        $.each(data.result, function(index, file){
          $('#csvToTable').html("");
          $('#csvToTable').CSVToTable(file.url).bind("loadComplete",function() {
            console.log("Loaded data into table");
            /*

            Call functions to manipulate data here

            */
          });;
        });
      }
    });
  }
});
</script>

Want to make your table editor like the rest of the cool kids? Check out this jQuery plugin

The wedding ring shop review

I went to McSorley’s wedding ring shop in Leeds to get some custom / bespoke ring designs done for a band I was working with and he constantly promised things he never delivered.

Most of the emails he sent were incoherent..

Most of the time he doesn’t answer the phone as he isn’t even in the store..

It also took 4+ months to get a refund. Even that came in two parts with him thinking it was okay to refund me less than I paid..

Avoid this shop, it will burn you.

Memoirs of an ex-pirate turned CEO

Over the years I have filled many roles online, some have some questionable legal issues tied to them.  Nowadays I run an organization and write open source software and some propriety software and I’m paid to do this and I’m 99.9% sure everything I do is completely legal.  Throughout my years online I have watched the piracy battle. I remember in the early years when site admins would disappear and be locked up for years and I have watched how an international war against piracy has been won by the pirates with the popularization of the torrents & file sharing websites. Warez is what Warez was, it’s organized, way more organized than the FBI/CIA or any government funded organization..

So today has been a huge day in the Pirates Vs Legislation..  Correction.. People Vs Government..  It’s pretty clear that Government is representing the minority of the population.  It’s clear that Joe Blogs (in his current form) is being threatened..  It’s also pretty clear that Joe Blogs enjoys the fruits of Piracy and with the media companies still turning huge profits it’s pretty clear that greed is the underlying factor here.

So what just happened?

It turns out a major record producer is a CEO of a megaupload (file sharing website).  Now I have only ever downloaded legal content from megaupload or maybe the odd download that has questionable legality.  It’s clear the FBI don’t get the hint about the whole stop SOPA thing and just do what they want..  Consider the FBI like the bully who hits a kid, gets told off by their teacher then completely ignores what the teacher says and goes and hits the kid again.  Ignorant American government organizations?  Really?  Say it aint so!

What is questionable legality?

Say I own a copy of Civilization 2(Game) and I want to mod it, well I can only mod it if I replace the civ2.exe binary with a modified binary..  This is potentially illegal and in the eyes of the law is illegal..

Today megaupload was hit hard, shut down in fact..  Millions of legal files have been removed from the internet..  The reason it was shut down is because megaupload was storing illegal files..  Ironic though that a record producer who has made millions from selling beats may now find himself sued by the same mechanism put in place to protect him.

Why does this matter to you?

Well Google, Dropbox, Spideroak, Microsoft etc. all store illegal files..  In fact so does the organizations that are fighting online piracy.. The FBI hit megaupload this time, a site that is legitimate. Absolutely nothing is stopping them from hitting Dropbox or Spideroak, in fact a lot of people think Dropbox is the next target..

Why the government will never win this fight

Just like the war on Terror or Drugs their is a reason the opposition is so successful. It’s simple. Passion. Passionate people work all hours of the day to solve a problem. The more the government push the more they are creating hatrid, just like Iraq..  Many software developers will free up a few hours to help debug a problem on a website that opposes this fight.  They won’t contribute to piracy directly but may provide a free module or piece of code to the site administrator.  In Iran a man was recently sentenced to death for the same type of thing.  The people of the Internet are fighting oppression.

What is the light at the end of the tunnel?

Pirates are now CEO’s. Yep, and the CEO’s are out to destroy UMG, sony etc. Young CEOs are being passionate about providing a DRM free experience and removing customer lock in because they believe in the future of the Internet as a medium for open conversation. If you are a CEO that doesn’t get why an open Internet is important then please, I beg you, step down or your company will be lose and your employees will find themselves out of a job.

What can you do to speed things up

It’s pretty evident that the FBI are working the likes of UMG and other old, complacent media organizations. If you work at one of these organizations or you have a contract with them please organize a meeting to specifically discuss the organizations stance on the war against piracy. You may un-earth some uncomfortable truths. Do remember if you license music or you buy an internet connection that comes with a free audio clip service (Many schools have this bundled with their net connectivity) you are fueling this fire. You are fueling a fire that is ripping the Internet apart. Act now.

What a difference a door makes…

Yet another burglary last night in a Bradford Primary School. Yet again the thiefs target is the technology. PrimaryT is the maintainer and provider of this technology so it is somewhat concerning that the schools ICT budget will be spending more of their budget on insurance premiums next year instead of new kid for the kids to use.. But wait.. Not at this school because a recently installed security door thwarted the thieves..

In my opinion you can’t get much lower than stealing from resources primary school kids use to learn with.   I realize that anyone reading this is  already in that school of thought.  I guess I’m completely biased though and blind to the other social subtleties at play in the surrounding area.

The school is going to need to replace some parts of that door though if not the whole thing.. It’s not all bad news at least as the kids can still continue to learn with technology 🙂