So, (and not for the first time)
I reached a lull in posting, not that I was doing nothing, but I had nothing to write about.
I've been doing a few projects, but have yet to write them up.
I'm going to start writing again, but perhaps at a slower frequency.
I've tried posting once every few days, (years ago) and found that far too hard to keep up with.
I wish I'd done once a week, then I'd still have a ton of posts cued for release.
I tried once a week, but without some hardcore time spent writing and having a stack ready and scheduled for release I couldn't keep on top of writing here, making else where and a job and a family!
So now I think I'll just post as and when I need to. when I'm inspired to write a lesson, rather than looking for stuff to pad a blog, and posting when I have completed a project rather than trying to do smaller projects so that I can update more frequently.
Monday, October 14, 2013
Thursday, October 10, 2013
First accidental explosion
http://makezine.com/magazine/what-was-your-first-accidental-explosion/
So Make asks what was your first accidental explosion...
For me it's something that I won't forget. not because it was especially dangerous. but because I was so young and so paniced.
To start with it might be a good idea to set the scene.
1, I have always been interested in hacking electronics, this started from the day I took an old record player out of a skip and salvaged the components out of it using a soldering iron borrowed from my grandad.
I'd borrow books from the library to learn how to put circuits together and how to build different things.
2, As a young boy I was always interested in pirates, as in the swashbuckling kind, I used to have a book about pirates, and frequently would play "make believe pirates" I suspect (thinking about the house I was living in at the time) that I was about 7.
Hence we come to my first accidental explosion...
So one day I'm playing pirates, and I'm make believing that I'm exploring some kind of cave searching for buried treasure, in order to explore said cave I need a candle.
So I go to my "parts box" and select a light bulb, some wire and a 9v box battery. I wrap some wire around the bulb and around the "turret" terminal of the box battery, then press the other terminal of the light bulb directly onto the battery, "et voila" I have a candle, and go back to exploring my imaginary cave.
My candle however is not very reliable, I try securing parts with tape etc, but for some reason the bulb keeps going out.
Then bang, the battery explodes.
(the battery has shorted on my cello taped bits of wire (that bridge the battery connections), the current flowing has heated the insides of the battery, caused the electrolyte to expand and eventually the seal has blown.)
This is where the panic set in, the battery has exploded in my hands, (exploded is not the right term, all that's really happened is the bottom of the battery has blown out) my left hand is now covered in electrolyte, except I'm seven and have no idea what electrolyte is, I've no idea how battery's work -just that they make my toys go, in fact the only thing that I know about battery is the words battery acid. So as far as seven year old me is concerned the electrolyte from the alkaline box battery is acid, and my hand will melt any time soon.
After I realised that my hand wasn't melting I did find that the acid was just a weird murky jelly, and the inside of batteries apparently contained black sticks (carbon rods)...
So that's my first accidental explosion.
So Make asks what was your first accidental explosion...
For me it's something that I won't forget. not because it was especially dangerous. but because I was so young and so paniced.
To start with it might be a good idea to set the scene.
1, I have always been interested in hacking electronics, this started from the day I took an old record player out of a skip and salvaged the components out of it using a soldering iron borrowed from my grandad.
I'd borrow books from the library to learn how to put circuits together and how to build different things.
2, As a young boy I was always interested in pirates, as in the swashbuckling kind, I used to have a book about pirates, and frequently would play "make believe pirates" I suspect (thinking about the house I was living in at the time) that I was about 7.
Hence we come to my first accidental explosion...
So one day I'm playing pirates, and I'm make believing that I'm exploring some kind of cave searching for buried treasure, in order to explore said cave I need a candle.
So I go to my "parts box" and select a light bulb, some wire and a 9v box battery. I wrap some wire around the bulb and around the "turret" terminal of the box battery, then press the other terminal of the light bulb directly onto the battery, "et voila" I have a candle, and go back to exploring my imaginary cave.
My candle however is not very reliable, I try securing parts with tape etc, but for some reason the bulb keeps going out.
Then bang, the battery explodes.
(the battery has shorted on my cello taped bits of wire (that bridge the battery connections), the current flowing has heated the insides of the battery, caused the electrolyte to expand and eventually the seal has blown.)
This is where the panic set in, the battery has exploded in my hands, (exploded is not the right term, all that's really happened is the bottom of the battery has blown out) my left hand is now covered in electrolyte, except I'm seven and have no idea what electrolyte is, I've no idea how battery's work -just that they make my toys go, in fact the only thing that I know about battery is the words battery acid. So as far as seven year old me is concerned the electrolyte from the alkaline box battery is acid, and my hand will melt any time soon.
After I realised that my hand wasn't melting I did find that the acid was just a weird murky jelly, and the inside of batteries apparently contained black sticks (carbon rods)...
So that's my first accidental explosion.
Monday, June 24, 2013
MySQL Data types and sizes
If you remember all the way back to how the coding lessons in C started, they started by looking at different datatypes, like ints long int etc, each requiring different memory spaces or being able to store different sized numbers.
The same thing is true in MySQL.
MySQL is a database server, often whenever you're making a website you have a few diffeerent things to think about.
Lets imagine you;re making an on line magazine, or a piece of forum software, you;re going to have authors, (that's a relatively short bit of text, -who's name is over 20 letters?)
but then you also have article text, or posts etc that's going to be a fairly hefty chunk of text.
So lets look at the kind of thing you'll use to have article titles, or by lines, that's likely to be a varchar type.
Varchar is like a string, you specify how much text you want to be able to store in the field. so for a name you may decide that 20 characters is enough, and you;d specify varchar(20).
for storing text there are a few different types of data field.
Notably these don't hold a number of characters, they actually hold an amount of data which is measured in bytes.
(this is important as you might be using a double byte character set -then you can only store half as much text by character count.
So, the data types are
Tinytext which can store 256 bytes,
Text which can store 65,535 bytes (64Kb)
Mediumtext -which can store 16,777,215 bytes (16MB)
Longtext 4,294,967,295 bytes that's a huge 4GB!!!
so how does this work? a 4GB chunk of text is huge to just be a row on a table.
well, the MyISAM tables actually have a maximum size of 65,535 bytes (that means a row can only be that size.) -but surely if a text field can be that by itself.
What happens is that a pointer is stored with the row data that points to the large text chunk, that file pointer is anywhere between 1 - 4 bytes. That way large data is store outside of the normal row.
The same thing is true in MySQL.
MySQL is a database server, often whenever you're making a website you have a few diffeerent things to think about.
Lets imagine you;re making an on line magazine, or a piece of forum software, you;re going to have authors, (that's a relatively short bit of text, -who's name is over 20 letters?)
but then you also have article text, or posts etc that's going to be a fairly hefty chunk of text.
So lets look at the kind of thing you'll use to have article titles, or by lines, that's likely to be a varchar type.
Varchar is like a string, you specify how much text you want to be able to store in the field. so for a name you may decide that 20 characters is enough, and you;d specify varchar(20).
for storing text there are a few different types of data field.
Notably these don't hold a number of characters, they actually hold an amount of data which is measured in bytes.
(this is important as you might be using a double byte character set -then you can only store half as much text by character count.
So, the data types are
Tinytext which can store 256 bytes,
Text which can store 65,535 bytes (64Kb)
Mediumtext -which can store 16,777,215 bytes (16MB)
Longtext 4,294,967,295 bytes that's a huge 4GB!!!
so how does this work? a 4GB chunk of text is huge to just be a row on a table.
well, the MyISAM tables actually have a maximum size of 65,535 bytes (that means a row can only be that size.) -but surely if a text field can be that by itself.
What happens is that a pointer is stored with the row data that points to the large text chunk, that file pointer is anywhere between 1 - 4 bytes. That way large data is store outside of the normal row.
Monday, June 17, 2013
A Simple Guide To Complying With The EU Cookie and Privacy Law
I started my blog as a guide for putting things together, over time that's slipped through hardware, software, coding, computer aided design, building speakers etc, and has now slipped into web development a little bit.
I can't imaging that this web design kick will last a terribly long time. but whilst it's in my mind and giving me inspirstion to write posts then I'll run with it!!
In the UK (and the EU) we now have a cookie law.
this is a bit weird, and smacks of politicuians thinking that we're eating too many cookies, and that makes you fat, and there is an obecity epidenic, also, when you eat lots you crap lots too, and the sewers can only take so much before the pipes come clogged and then there is too much for the interpipes, and it's falling appart, and it's all the fault of the cookie, or something like that.
In principal I agree that there are some good, bad and ugly uses of cookies.
But like all half baked laws (I promise I'll stop with the cookies are like actual biscuit jokes soon) this one is pretty easy to make a mockery of.
But I've decided that on the site that I've made I'll play within the spirit of the law, as well as the letter of the law, and here's how I've done it.
First, I took a look round, it seems that just letting people know that you use cookies is enough.
So the easiest way to be compliant with the law is to just put a small banner on your site that simply says, "this site uses Cookies" some people go further by saying by continuing to use this site you agree that we can store cookies on your computer, but really you don't need to do that.
The message I put up also links to privacy policy where you get the additional information that the cookies are only used because of the shopping basket feature, that the cookie is cleared if the basket is emptied etc...
Basically, the key to keeping in line with this law is let your users know you keep cookies, and go the extra little way to explain to your users why it is that you need to store anything on their machine.
I can't imaging that this web design kick will last a terribly long time. but whilst it's in my mind and giving me inspirstion to write posts then I'll run with it!!
In the UK (and the EU) we now have a cookie law.
this is a bit weird, and smacks of politicuians thinking that we're eating too many cookies, and that makes you fat, and there is an obecity epidenic, also, when you eat lots you crap lots too, and the sewers can only take so much before the pipes come clogged and then there is too much for the interpipes, and it's falling appart, and it's all the fault of the cookie, or something like that.
In principal I agree that there are some good, bad and ugly uses of cookies.
But like all half baked laws (I promise I'll stop with the cookies are like actual biscuit jokes soon) this one is pretty easy to make a mockery of.
But I've decided that on the site that I've made I'll play within the spirit of the law, as well as the letter of the law, and here's how I've done it.
First, I took a look round, it seems that just letting people know that you use cookies is enough.
So the easiest way to be compliant with the law is to just put a small banner on your site that simply says, "this site uses Cookies" some people go further by saying by continuing to use this site you agree that we can store cookies on your computer, but really you don't need to do that.
The message I put up also links to privacy policy where you get the additional information that the cookies are only used because of the shopping basket feature, that the cookie is cleared if the basket is emptied etc...
Basically, the key to keeping in line with this law is let your users know you keep cookies, and go the extra little way to explain to your users why it is that you need to store anything on their machine.
Subscribe to:
Comments (Atom)