Rotten apples

So i was bored a night during the end of 2011 and i wrote this. Its a short story that came to me, and I felt like writing it down. Please read and give feedback!

I knew things would get weird as my parents got a divorce. One week with my father and one with my mother. Weeks came and went, i moved here and there, and as soon as i got settled it was time to move again.
Well friends, I will see you in school next week, but I can’t play after class as I have to go take the bus outside of town to my father. It’s too long of a distance to stay later in the afternoon. See you monday, play with you in a week.
But the weeks at my fathers were not boring, no rather quite the opposite. The house was an old house made by clay, painted dark brown which gave it a cottage-like look that could be from something out of a fairytale. The grass was always cut short, my father tended to the garden with all his heart and pride. Now as autumn sneaked upon us the trees were all full of fruit and i loved running around there, in between the trees, climbing the branches to get to the fruit in the top of the tree. No matter how many times my father told me that the fruit on the ground actually was the one most ripe i wanted to climb.

 

I remember one time from last autumn as my father was gathering all rotten apples in a pile to remove from the garden while i as usual was climbing above him, singing and rhyming while doing so. I don’t remember if i stopped singing before or after the foot slipped, sometimes one can just feel things are about to go wrong, but I do know that as i fell i screamed. Like a baby. My voice carried over the garden as I smacked into the ground with my father running towards me. It did not hurt, not a bit. When touching my back with my fingers I first thought i felt a bloody moist, but quickly realised it was cold and that I’d managed to fall into the pile of rotten apples. It took the whole afternoon for my father to get the sweet and rotten smell out of my hair. Well this autumn I did not fall. Not in the way people most often fall, from an object into something else, most often the ground. No, this autumn I more, drifted into something, something .. unlikely?

It all started with Ian.
-”Why you taking that bus every week? Don’t you go to school like normal people?”
The voice came from behind me as i waited for the bus. Turning around i saw a boy about my age, freckles covering his face. Sitting on a grand-mother-like bike with a smile on his face.
-”I see you here quite often, you live by the cottage house don’t you?”
-”Yeah, I do. Mother lives downtown and I go to school there. Living here every other week. “
He smiled again, showing even more teeth.
-”You got any friends around here then? I could show you a thing or two. “ On the back of his head he had two dreadlocks pointing out from a otherwise short-trimmed head.
-”No. Or i mean, yes i guess you could”.
-”Cool. I will meet you at the cottage tonight. See ya.”
As he pedaled away the bus turned into the bus stop and as I sat on my usual spot I felt quite excited for the coming afternoon.

A couple of hours later the bus stopped at the very same bus stop again. When it made that typical buss – farting – on leaving sound and turned out on the road again i turned around and he was already waiting.
-”Lets go!? Jump up on the back and lets get out of here!” He pointed towards the luggage rack and I slipped up behind him and we started moving. -”So how was city school today? Stock lectures?” He grinned.

He took me to an old barn. Red, and huge and in the middle of nowhere. Left of the door the roof had caved in, and it looked like it happened lots of years ago.
-”What is this place?” I realised my yaw must be somewhere between my knees and quickly closed my mouth. “Anyone using this place?”
-”Well i am. Come, what i want to show you is on the backside of the barn, but we have to go through it to get there. “
If it looked big from the outside it felt even bigger when coming inside. The caved in roof gave the left side a look of ‘you can only se half of the barn, but it goes on forever behind the caved in roof’. The right side on the other side ended a couple of meters in, but still big enough for a couple of tractors or so. But no sign of tractors here, instead all kinds of old junk where lying around. A old rocking chair lying next to half of a spinning wheel. In a crate old half rotten wool was lying around giving the whole place a smell of wet rotten sheep. In front of us was an even bigger door then the one we came through which squeaked open as Ian gave it a push.
-”We came in the from the back door, and what we want is on the inside. Come on.”
As we stepped out on the yard – and truly a yard it was – the surroundings gave me a feeling of traveling 100 years back in time. There was another house that could not be seen from where we came, it was an old mansion with most of the roofs and walls caved in. Some benches made of a big tree still stood upright surrounding a old stone table that looked like it easily could stand there for a thousand years more without breaking. From the forest came a road leading up to the barn, surrounding a well and a flagpole. The road made of gravel was now covered with dandelions.
-”This place is amazing. How come no one has renovated it? How do you know of it?”
He smiled.
-”I don’t know. My father showed it to me. Apparently my fathers grand grandfather lived here, as a cattle herder. But something happened to the family owning the place and they moved. Maybe to the city, I don’t know. My ancestor moved as well and since then the place has been empty except for some rats and bats.
-”Rats and bats ey. I could tell. “ The wind blew up some dust and a cold chill went down my spine.
-”Come on. I want to show you the well. Its older then the mansion and rumour is its a true wishing well. Throw something precious inside, make a wish and it will come true.”
-”There is no such thing as a real wishing well. You talk of fairy tales!” Even though i put a mocking smile to my lips when i said it was intrigued.
-”And how do you know that you are currently not living in a fairytale? Do you think Rapunzel knew she was? Its the tales making its way from mouth to mouth that gives it life. When your children will talk about this to their grandchildren about how you made a wish that came through it will be a tale. “ No grin this time. His face had a thoughtful look as he said it.
-”In a fairytale no one ever goes to school learning all the boring things we do every day.” I countered. “Hence this can’t be a fairytale”. Even though i wanted to behave mature, and logical, this whole situation just made me feel more childish than ever. Ian looked quite the opposite of childish.
-”But why do you go to school then? Why don’t you live everyday as if it was a fairytale? Stop arguing now, what do you have to lose anyway? Give a gift to the well, whisper your wish to it and come back to me. I will be waiting by the barn. “
And he walked away leaving me with the well, my thoughts and my childish pride. It could not be for real. If it was real, people would be lining up to get their wishes granted. Anyway I stood waiting, thinking of my whish.
-”Remember you have to give the well a gift of meaning. Something precious to you. Otherwise it will not work.” Ian’s voice came from behind me and I nodded to him without turning around.
It occured to me at once. I’d give it my shoes. I slipped out of them, now two years old that had kept amazingly well together and put them to my breast. I spin in them and let them fall over the edge of the fern covered well and as in slow motion they disappeared in the depth of the well some second before there came a splash. Suddenly a bit stressed about what to wish for i gathered my thoughts. First there was nothing. And then it came to me, the one thing i whispered out in the dark every now and then before falling asleep. Now i whispered it down the well, with the my voice bouncing between the walls like the sound of a snake.
Let my mother and father find back to each other again. Not for my sake, but for their. Let them love each other again, like they did when they first met each other and let the love stay with them until the end.
I kissed the ferny rocks and turned around giving the deep well a last look and for a second it almost looked like something was glimmering in the water. Wish accepted it said. But when looking more thoroughly i saw nothing but darkness.
-”Your shoes huh? Good thinking there, although I would not want to walk through the barn barefoot with all the junk lying there. “
-”It will be allright, i am used to walking barefoot. What did you give it?” I looked him in the eyes, i felt no more like a child, but more like i had done something good.
-”I gave it my gameboy. It was maybe two weeks after my father showed me this place, and i realised i did not want to spend my days gaming. So i threw it in and havent played an hour tv or computer games since.” He looked me in the eyes, cleared his throat and continued. “There are some more rules you should know about. You are only allowed to show this place to one person. Not two, not three. Only one. If you break the rule your wish will not be granted, and if it’s already been it will be taken from you.”
-”By who? Who can take a granted wish from me?” This confused me quite a bit. No more logical thoughts in my head, now believing that my wish truly could be granted.
-” I don’t know” he answered. “But my guess is that it’s the same being that grants the wish. I have not met him, her, it and I don’t plan to either. I am happy knowing that my wish is granted, it was fulfilled and I don’t want that taken from me. “
-” ah. okay. “ i did not know what to say. this was strange.
-”Lets get you home before you freeze your toes off. Come on!” And we walked back through the barn.

As we got home Ian left me by the gates. As i approached the house i could see father was playing music, I don’t know how, but even before the sound reached through the thick walls I just knew it. The house was warm and as i stepped inside i could feel my feet starting to itch as they started to warm up. “Dad i am home!”
-”Where have you been love?, You did not come home from school?” He did not sound worried, I was a big girl.
-”Found myself a friend, been out all afternoon. Need to wash myself before dinner!”
-”Okay, it’s finished already, I will put it on the table.” He started moving.
-”And dad, i kinda lost my shoes, so I need some new ones.” And before he could answer i was on my way to the bathroom.

Next day mother drove in through the gates. She never came here. I usually just took the bus.
-”Hello darling, thought i would pick you up today. Haven’t been here for a long time. “ I saw here standing there, smiling. Yet I could not believe this happening. My parents, on the same location, not arguing.
-”Is that your father over there at the apple trees? Did he do something to his hair? He looks different.”
And from that moment i knew the well had accepted my offer.


USB-sticka med flera operativsystem!

Eftersom jag sysadminar då och då så är det smidigt att ha ett usb-minne med sig med en iso som man kan boota om man ska installera ny server, ny desktop eller bara felsöka en dator som inte vill starta. Ett problem kan vara att man ibland behöver en desktop, ibland en server och ibland något annat – och då är det jobbigt att ha flera olika stickor eller att behöva smälla in en ny iso på stickan för varje tillfälle.

Lösningen är enkel och genial, helt enkelt att ha en usb-sticka med MÅNGA isos på, som alla kan boota och installeras.

Verktyget för att göra det heter multisystem och det finns till flera olika linuxdistrubitioner, här kommer instruktioner för hur jag gjorde för att skapa en sticka med Ubuntu 12.04, Fedora, Linux Mint 12, Ubuntu server och ubuntu alternative!

  1. Först och främst, sätt de isos du vill ha på nedladdning, det tar ibland lång tid att få ner och är schysst att ha nere efter att du är klar med de andra.
  2. Installera multisystem. Gör så här:
    #lägg till multisystems repository(paketförråd)
    sudo apt-add-repository 'deb http://liveusb.info/multisystem/depot all main'
    #lägg till nyckeln
    wget -q http://liveusb.info/multisystem/depot/multisystem.asc -O- | sudo apt-key add -
    #när det är gjort, uppdatera och installera
    sudo apt-get update && sudo apt-get install multisystem
  3. När det är gjort så går det att köra igång verktyget. Ha din sticka i usb-porten när du startar det och nu måste du ha dina isos tillgängliga om du vill lägga till dem. Det kommer upp en bild som ser ut ungefär så här: På din så kommer det dock inte finnas några inlagda system. Nu kan du ta dina nedladdade isos och lägga in dem. Endera så drar du in och släpper dem i det vita fälte eller så klickar du på hårddisken och väljer filen. Det öppnar ett fönster som kör ett gäng kommandon och när det är klart så kommer du tillbaka till ovanstående bild och du kan lägga till flera system.
  4. Om allt gick som det skulle så är det bara att tuta och köra. Själv har jag mina system på en Databar 8gb som är smidig och enkelt att ha med sig överallt man ska. Rekommenderas varmt!

 

 


php strtoupper och svenska bokstäver.

Satt med ett skript som skulle generera bilder från text och behövde då göra om strängen till stora bokstäver.

Lätt som en plätt tänkte jag. skickade in bokstäver i strtoupper.

echo strtoupper("Bostäder");
//Resultatet: BOSTäDER

Som ni ser blev resultatet inte det väntade.

Men lösningen var enkel – byt ut strtoupper till mb_strtoupper

echo mb_strtoupper("Bostäder");
//resultat BOSTÄDER

Edit: Kräver att modulen mbstrings är installerad och aktiverad!


Boktips tack!

Jag är helt fast på fantasy nu.  Efter att ha läst Name of the wind och Wise mans fear av Pathrick Rothfuss så vaknade mitt gamla fantasyintresse till liv, borta var de smått barnsliga böckerna som jag läste under finniga tonnår. Inte bara jag hade mognat, utan så även fantasygenren. Hurra tänkte jag och slukade Left hand of god samt last four things och hela game of thrones serien. Bra böcker, precis det jag är på jakt efter. Nu senast så har jag streckläst de här böckerna av Brent Weeks så har jag helt plötsligt fått slut på ideer över vad jag ska läsa. Några tips har jag fått här men är på ständig jakt efter fler tips! Så snälla, har du ett tips på bra fantasy som jag bör läsa – hojta till på en gång!

 


PHP och late static bindings

I PHP 5.3.0 introducerades en fin liten grej som inte fått så jättemycket uppmärksamhet. Late static bindings. 

När du jobbar med klasser för att skapa objekt så får du ofta en situation som ser ut som följande:

<?php
class person{
    static $name = 'Unidentified person';
 
    public static function getName(){
        return self::$name;
    }
 
}
 
class teacher extends person{
    static $name ="Teacher"; 
 
}
 
echo teacher::getName();?>

Vilket kommer att ge

Unidentified person

När man egentligen vill ha variabeln från childklassen och inte parentklassen. Det är här late static bindings kommer in i bilden.

Om man då byter ut raden return self::$name till return static::$name så gör man alltså en late static binding och php förstår att det är variabeln från childklassen du vill returnera och inte den från parentklassen(där funktionen getName ligger). Koden blir alltså så här:

<?php
class person{
    static $name = 'Unidentified person';
 
    public static function getName(){
        return static::$name;
    }
 
}
 
class teacher extends person{
    static $name ="Teacher"; 
 
}
 
echo teacher::getName();?>

Vilket kommer att ge

Teacher

Och helt plötsligt blev även statiska funktioner och variabler så mycket enklare att jobba med genom klasser och arv. Kör hårt!


Ett farväl av en gammal vän

Max bodde inte här där jag bodde när jag växte upp. Max hamburgare alltså.  Då fanns bara Mc Donalds att välja på om man ville ha snabbmat. Vi klagade inte, det var ju där man skulle hänga i tonåren. När jag åkte till platser där Max fanns så stannade vi till, de hade goda hamburgare och det gick ganska snabbt att få maten. Det var en fin relation vi hade jag och Max. Om jag kände för att tvinga i mig lite hamburgare så var det vad som gällde.

När jag blev äldre valde jag att bara äta vegetarisk mat. Inga döda djur. Max vegetariska burgare sparkar de andra kedjornas burgare hästlängder och när Max dessutom införskaffade Dill i Dill dippen så var kärleken förseglad. Vi hade det bra jag och Max.

Idag äter jag mycket nyttigare, sällan hamburgare och mycket oftare hemma. Men det händer ibland att familjen åker till Max ändå. För att ibland vill man bara ha mat lite fort när man är på väg från en aktivitet till en annan.
Och så var fallet igår. Efter yoga, på väg ut på sjön för att åka skidor så sa vi att”vi tar bara en lite snabbis på Max så vi fort kommer igång”. Och då mindes jag varför jag sällan gick till Max längre. Först och främst – vi har vuxit i från varandra. Friterad potatis i pinnform smakar inte lika gott som det gjorde för några år sedan. Men det kan man leva med.

Att få vänta i över 20 minuter på att få beställa, trots ingen före i kassan är därimot mindre acceptabelt. Att det sen tar 20 minuter till efter att beställningen är tagen till att någon pratar med mig igen är obeskrivligt. Expresskassan och Drive Through kunderna fick sin mat och kunde äta och lämna stället innan jag eller mina hungriga barn ens fått maten. Och då tänker jag att expresskassan finns väl till för att avlasta kassapersonalen? I går så var det snarare så att kassapersonalen prioriterade dem före oss som stått i kö för att få maten. Men så mindes jag, att gången innan beställde jag på expressautomaten, fick ett kvitto och blev bortglömd, så hugget som stucket. Efter 40 minuter längst fram i kassan där jag EN endaste gång blivit tilltalad förutom i samband med beställning så fick vi maten – då fattades halva vår beställning och jag fick säga till ännu en gång.

Allt det här hade jag kunnat leva med. Men det värsta sveket återstår. De har tagit bort Dill i Dilldippen ur sortimentet. 

Så när snabbmat gick från att vara snabbmat till väntmat och gick från att vara gott till fettigt så skriver jag nu till dig Max – tack för en fin relation – men den är över nu. Det är inte bara du, men inte heller bara jag. Adjö.


Owncloud och smidig kod!

I nördkretsar började det idag pratas mycket om owncloud, en sorts molntjänst där du kan lagra data i molnet för att komma åt från vart du än är. Dropbox tänker du, rätt men fel säger jag. För owncloud är något så smart som en dropboxliknande tjänst – fast där du kan sätta upp owncloud på egen server. (Vilket vi gjorde hos daladevelop såklart gjorde för att prova).

Det är ju en ganska färsk programvara och den har några babysjukdomar – men intresset är enormt. Demot som finns på ownclouds hemsida drog under två dygn 250gb data, vilket är schysst för ett open source projekt som precis sett dagens ljus. Prova gärna! Och om du är en daladevelopare så ska du kunna logga in på vårat eget owncloud med dina serverinloggningsuppgifter.

Och appropå det, så fick jag det inte att fungera när jag först provade. Det gick inte. Jag kollade på deras forum och såg att fler haft samma problem och satte mig sen ner för att försöka lösa problemet. Tack vare att projektet är just öppen källkod så kunde jag gå in i koden och se vad som skulle kunna vara fel. Och snabbt förstod jag att det faktiskt var en bugg i koden. Jag skrev ihop en fix och mailade den till författaren av orginalkoden och sa att han gärna fick använda den.

Och det är själva kärnan av open source, att vi tillsammans kan göra programvara bättre genom att tillsammans hitta felen, testa dem och fixa dem.

 


Stäng av gästinloggning i Ubuntu 11.10

Gör så här för att stänga av gästinloggning i Ubuntu 11.10:

sudo gedit /etc/lightdm/lightdm.conf

och lägg till följande rad:

allow-guest=false

Roota Samsung Galaxy Tab 10.1 samt ta bort förinstallerade program

Jag är väldigt nöjd med min Samsung Galaxy tab 10.1 som jag köpte för några månader sedan. Den gör sitt jobb och jag är glad och lycklig. Tyvärr(iaf för mig) så kommer den med ett helt gäng förinstallerade appar, appar som man får gratis men som kostar pengar att använda. T.ex DN, DI+, Sköna Hem och lite andra tidningsappar. Allt som allt – appar som jag aldrig kommer använda, och om jag vill det – kunna välja själv om jag vill använda eller inte. Dessutom så kommer den med Pulse som är en nyhetsaggregator. Den irriterade mig också då jag inte ville köra den och, den låg och körde hela tiden samt uppdaterade med nya nyheter.

Eftersom det inte gick att ta bort apparna så bestämde jag mig för att roota min platta.

För att roota plattan så följde jag den här guiden: http://forum.xda-developers.com/showthread.php?t=1171089, bläddra ner till RETAIL 3G
[GTP7500] rubriken och följ stegen. Det är väldigt väldigt enkelt men kräver att du har adb från SDKets platform-tools.

När det väl var klart så går det att få root på telefonen och man kan då ta bort appar.

user@linuxbox> adb shell
user@phone>; su
root@phone#  mount -o rw,remount -t yaffs2 /dev/block/mtdblock3 /system

Där ska /dev/block/mtdblock3 bytas ut mot vad /proc/mounts säger är mountat på /system

root@phone cat /proc/mounts

För att sen ta bort en app navigera till /system/app/ och ta bort de valda apparna med kommandot rm


Mycket i pipelinen

Just nu är det väldigt mycket jobb. Därför hinns det inte med att blogga något särskilt. Det är inte så mycket annat som hinns med heller, och då kommer ju tyvärr bloggen efter både familj och sambo.

Samtidigt så är det ju när man jobbar mycket som man också får många ideer till inlägg, när man kommer på bra lösningar och hittar roliga tekniker man vill använda.
Nu en strategisk affärslunch med min sambo. Får passa på.