New Phone, in a year or so

I bought the Sony Xperia S when released on a contract that cost a grand total 7 590 SEK over 2 years (est. € 865).
Since the phone was released only last year, there is atleast one more year before I start looking for a new phone, but concidering the phone I will eventually get will have a potential to be atleast twice as good, I started thinking about what a phone should support. What I really want.

There are probably a thousand functions I just take for granted that are not mentioned here at all.

I am aware that some of these functions are software based, and should be implemented by the operating system and some are hardware and needs to be created in the development process.

  • Battery life 5 days, and I’m not talking standby mode.
  • Built in battery saving functions, to minimize battery usage when it should be inactive.
  • AMOLED display simply because they are thin awesome and use less power.
  • Pressure sensitive display, so that I can have more intuitive control.
  • Lots and lots of sensors to allow for creative application usages.
  • a ‘Real’ camer, to end the reign of the compact camer once and for all.
  • Optical zoom worth mentioning.
  • NFC simulator so I can store my NFC tags in the phone and use it instead.
  • Contact lists seamless transition between different contact lists such as facbook, gmail, phone.
  • Remote lockdown rendering the unit completely worthless if stolen.
  • Water/Dust resistant dropping it in a pool of water no problem.
  • 5 years warranty Just to make me trust it more.
  • Cloud storage stores all pictures, applications and such on the cloud, by default.
  • 32GB storage With cloud storage, I really dont need that much on the unit.
  • Upgradeable storage Just in case 😉
  • Micro-USB/HDMI This is pretty much standard these days.
  • Wireless charging I know there are already phones out that support this.
  • Play-to function I just love showing off pictures or video on the TV, its just better.
  • 4G or whatever they call it next year…
  • Limited amount of physical buttons like Power and Camera, they are always good.
  • Drop safe casing dropping a phone should hurt you no more then to actually bend down and retreive it

That was just about what I could think of right now, prices are hard because any estimation would be unrealistic. But for a phone, really keeping the price in the lower end of 10,000 – 5,000 SEK is what people are willing to pay, still its a big span.
Looking with interest on the Samsung Galaxy S4, however since I am not due for a new phone untill next year the S4 will be old when its time.

I wonder what Samsung, HTC, Sony, Nokia and Apple are cooking.

Posted in random | Tagged , , , , , | Leave a comment

Coding, snippets, pretty and commented. (JavaScript)

Beroende på vilken situation man befinner sig i så behöver man leverera olika saker.

Samma sak gäller programmering, jag är inte sen att erkänna mig skyldig till att älska funktioner som löser svåra uppgifter på ett fåtal rader.

"use strict";
function adjust(x, size, turn) {
    var noOfBlanks = size - (x = x.toString()).length, blanks = "";
    while (blanks.length < noOfBlanks) { blanks += " "; }
    return [x, x + blanks, blanks + x][(turn === 1 || turn === 2) ? +turn : 0];
}

Det kan vara bra att ha snygg kod om många ska arbeta med den eller om man helt enkelt lättare ska kunna följa vad som händer

"use strict";
function adjust(x, size, turn) {
    var noOfBlanks, blanks, position, out = [];
    x = x.toString();
    noOfBlanks = size - x.length;
    blanks = "";
    while (blanks.length < noOfBlanks) {
        blanks += " ";
    }
    out.push(x);
    out.push(x + blanks);
    out.push(blanks + x);
    if (turn === 1) {
        position = 1;
    } else if (turn === 2) {
        position = 2;
    } else {
        position = 0;
    }
    return out[position];
}

Fast ska man nu verkligen komma ihåg vad det var som hände, även om funktionen är relativt enkelt strukturerad så bör man ha med kommentarer.

"use strict";
/* function call adjust
    x is a string
    size is total length of the output string
    turn defines right adjust by using input int 2 and left adjust by using input int 1.
    All other values will return the the input string simply converted to a string without adjustment.
    example left adjust
    adjust("Friday", 7, 1);
    returns "Friday "
    example right adjust
    adjust(1, 2, 2);
    returns " 1"
*/
function adjust(x, size, turn) {
    // Defines variables noOfBlanks, blanks, position and out.
    var noOfBlanks, blanks, position, out;
    // Ensures that x is a string value, decimal or float would be bad.
    x = x.toString();
    // calculates the amout of spaces we want.
    noOfBlanks = size - x.length;
    // start out with a empty variable for the spaces
    blanks = "";
    // loops untill we have enough spaces
    while (blanks.length < noOfBlanks) {
        // each iteration adds one space
        blanks += " ";
    }
    // number 1 is a left adjust
    if (turn === 1) {
        // sets output to left adjust
        out = x + blanks;
    // number 2 is a right adjust
    } else if (turn === 2) {
        // sets output to right adjust
        out = blanks + x;
    // if all else fails we return the input as a string.
    } else {
        // return the input but converted to a string.
        out = x;
    }
    // outputs the result
    return out[position];
}

Huvudsaken är egentligen att en funktion utför det man har för avsikt att den ska göra, efter det följer dokumentationen för funktionen och efter det kommer rimligen hur lättläst den är.

Korrekt dokumentation på den första funktionen skulle resultera i att man får lättare att läsa vad den utför.

"use strict";
/* Call adjust with x as string, size as int, turn as int. 
    x is the string that will be right or left adjusted.
    size defines the output length
    turn decides right (2) or left (1) adjust
*/
function adjust(x, size, turn) {
    /* noOfBlank is set to the amount of spaces that we want to add using size - lenght of x as a string.
    Sets blanks as a empty string by default. */
    var noOfBlanks = size - (x = x.toString()).length, blanks = "";
    // fills blanks with the desired amount of spaces 
    while (blanks.length < noOfBlanks) { blanks += " "; }
    /* returns a selected value from an aray with three positions [0, 1, 2] definde by input int turn.
    turn is 1 or 2, otherwise it is set to 0 and the input is returned as a string. */
    return [x, x + blanks, blanks + x][(turn === 1 || turn === 2) ? +turn : 0];
}
Posted in Flipped Classroom, Informationssystem | Tagged | Leave a comment

1 Hour of Fails! Huge Compilation! – YouTube

I’v spent some time watching things like these, and I have a few advices.

1 Hour of Fails! Huge Compilation! – YouTube.

When you decide its a good idea to show off…
by riding a bike over an edge, atleast wear a helmet, you are going to need it.
with a motorcycle, use protective gear, so you get to keep the skin on your body.
with a skateboard or BMX, use a helmet so you gett to keep some of your teeth.
oh and you extreeme sports guys out there, a cup for your package appears to be a good investment.

But what ever you do, do not stop doing it, because this is funny as hell.

Posted in random | Leave a comment

Vad är en startsida?

Hur vet man vad som är startsidan?

Detta är en ganska abstrakt fråga, då den har många svar men vi tar det enklaste för att sedan förklara begreppet djupare.

Som standard är startsidan definierad i en server som den fil i varje mapp med namnet “index.html”.

När man besöker Malmö Högskolans Webshare, där startsidan är definierad till index.html.
http://webshare.mah.se/ab4966/inl3/
http://webshare.mah.se/ab4966/inl3/index.html

Vissa hemsidor har flera olika definierade startsidor (vanligen säger man “index” istället för start). Alltså kan .html, .asp, .cgi, .php med flera vara en startsida, beroende på hur servern är konfigurerad och vilket programspråk som används.

I mitt fall innebär det att min blogg befinner sig på en server där startsidan är definierade till “index.php”.

Alltså är det ingen skillnad på de följande två länkarna. (de leder till samma innehåll)
http://ken.nu
http://ken.nu/index.php

Därför underlättar man ofta för användarna genom att låta dem besöka mappen, istället för att definiera exakt vilken fil de söker (index. med en filändelse), också visar servern den fil som är definierad startsida (index).

Därför kan det vara en god idé att lägga en helt tom index fil (t.ex. index.html men utan något innehåll), i mappar som man helt enkelt inte vill att besökare ska kunna se innehållet i.

Vad har index sidan för syfte, egentligen?

Index sidan leder användarna vidare på hemsidan så att de ska kunna få tillgång till annat material, antingen på samma server eller länkat till sådant som finns på andra platser på Internet.

Index sidan bör alltså innehålla någon form av meny, samt länkar till information om vad det är för form av sidan, kontakt uppgifter, med mera.

Hur länkar man till andra sidor som man har gjort?

När man nu har sin fina hemsida och vill ha en sida till, hur skapar man en länk mellan dessa två filer, så att användaren kan komma fram och tillbaka?

För att länka från en sida till en annan används HTML koden <a></a>

<a href="index.html">Startsidan</a>
<a href="kontakt.html">Kontakta oss</a>

Med denna “meny” i båda filer kan användaren lätt ta sig från sidan index.html till sidan kontakt.html, och sedan tillbaka igen. fler sidor lägger grunden för en mer omfattande meny. Det är en tidsfråga innan man inser att alla sidor inte kan länka till varandra, man får bygga upp ett system. Då blir kartor aktuellt, vilket är vanligt på många hemsidor på Internet “Site Map”

Ett bra exempel är om man besöker Helsingborgs Dagblad, där kan man i vänster del av menyn klicka på “Hela HD.se”. Där de försöker strukturerar upp sina hemsidor i någon form av logisk ordning.

Här på Ken.nu så har man istället de olika kategorierna som hjälper en att hitta ett inlägg inom ett specifikt område.

Posted in Flipped Classroom | Tagged | Leave a comment

Basic Information Technologies.

Basic Technologies.

Everyone knows the content of a new file, but what is the basic content of a empty HTML5 file?

Base content of a HTML 5 should be something like this.

<!DOCTYPE html>
<html>
  <head>
    <title>This is the title</title>
  </head>
  <body>
    Place your content here.
  </body>
</html>

Content that you want people to read on the page is added between the <body> and the </body> tags.

There are tags which define what part of the site the information belongs to, such as (opening and closing tags in order).

        <header></header>
        <nav></nav>
        <section></section>
        <footer></footer>

As Before the content is placed between the opening and the closing tags.
So the site can appear something like this.

<!DOCTYPE html>
<html>
  <head>
    <title>This is the title</title>
  </head>
  <body>
    <header>This is the header section of the site</header>
    <nav>Here a menu or navigational links are suitable</nav>
    <section>This is a good Place to have the content</section>
    <footer>This is the appendix, maybe with a copyright notification and Contact dertails.</footer>
  </body>
</html>

Now if you try this at home, this will not be a pretty site.
Thats where CSS come into the Picture, but to use that we have a few options, we can add styling to each tag in the html file, we can add a css style tag and write it all there, or we can link to an external (seperate file) that is named something that ends with .css
I prefer to link to a seperate document, simply to keep the basic html file at a minimum.
To link to a external .css file we need to add a line in our section, and that is the tag. There is no closing for <link>, it is enclosed in a single tag which could look something like this.

<link rel="stylesheet" href="mystyles.css" type="text/css" media="all">

When entered into the document we should get this appearance of the basic html file, with the content removed showing only html.

<!DOCTYPE html>
<html>
    <head>
        <title>This is the title</title>
        <link rel="stylesheet" href="mystyles.css" type="text/css" media="all">
    </head>
    <body>
        <header></header>
        <nav></nav>
        <section></section>
        <footer></footer>
    </body>
</html>

But now we have a problem, we linked a stylesheet and yet the page does not look better.
Given we never actually created a file called “mystyle.css” and your now asking yourself “Whats that supposed to look like then?”
Well, the basic content of a .css file is as follows.

    

Correct, its an empty file. It will do nothing, but you also need nothing to start with.

Once linked you can add formating in the .css file and it will apply to your html document.

Example to format the <section> tag, you simply write this in your .css file.

section {
  /* this is a comment */
  width: 600px; /* this fix the <section> tag content into a 600 pixels wide column. */
  height: 400px; /* with defined height, the <section> tag content now fits into a box-shaped area */
  background: green; /* its good to see your object, and without a color its by default transparent so make it green, blue, red, black, what ever you need to see it. */
}

That should get your going for now.
remember google is your friend.

Posted in Flipped Classroom | Tagged , , , | Leave a comment