Welcome back, stranger

I took my own site down yesterday for the anti-SOPA/-PIPA protest. It was pretty fun actually. I spent 15 minutes reconfiguring nginx, setting up a nodejs-based easter egg that no one found, and writing some crappy HTML by hand. I did it in an SEO-unfriendly manner (just blanked everything and returned 200s with only lulzy data for incorrect requests). I genuinely hope that the Internet can resist nations seeking full political control over it and continue to be the haven for cats and trolls that we know and love. The SOPA blackout also reminded me that most of the websites I use are run by awesome people. Yes, you lot are awesome. Love your work. Corporations and governments will always seek control and the money that you gain from having control over people. What our task must be is to keep the bastards honest.

What you should do to keep the Intertubes free:

  • Start your own website if you haven’t already.
  • Try to get it on a system that you have absolute power over.
  • Learn about TOR, onion routing, VPNs, SSH and proxies. These are critical technical skills in some places (like China). Teach your friends and family.
  • Keep being awesome.

Help keep communications free and unencumbered because one day we will really need those lines of communication.

As someone once hypocritically said, “The future belongs to the free.”

Posted in censorship, political, rants | Leave a comment

💢 Rage 💢

Sometimes I am angrier than I can type. I’m pretty irritable at the moment. Anger is the emotion you should feel between your expected outcome and your reality. If you are angry you should fix reality or change your expectations. I prefer the fixing reality mindset. Being angry is a good way to ensure I stay focused and determined towards goals.

The scope of things which are causing me annoyance is very broad right now so I won’t go into details.

 

Some other things:

 

Rage out, y’all.

Posted in Uncategorized | Leave a comment

Goodbye, 2011. Hello, 2012.

It’s that time of year. The brief gap between Christmas spam, post-Christmas sales spam and before Valentines day and Easter spam. Where gym memberships soar and commitments are made that will be broken within mere weeks of their inception.

Well, not really for me. Christmas in Korea is largely a commercial holiday aimed at couples and New Years doesn’t have the same significance as the lunar new year is seem as the more important event. Saturation advertising is much more tolerable when you can block it out by simply not paying any attention to it. I need to actively read and listen to understand Korean so it is easy to not be drawn in by advertising (plus, I don’t watch TV).

I have felt compelled to blog though. It has been too long since I posted anything and from what my logs are telling me there are a lot of hijacking attempts and unique, regular visitors. I like amusing both people and robots so I better keep regularly writing.

So what have I been up to over these weeks of absence, you may ask. Well, it has been a cold and isolating winter. My significant other has been on holiday for the last few weeks in warmer climes. This has strangely caused me to get less done with my free time. I’ve been snowboarding a few times, I’m entirely self-taught with youtube and observation so I am surprised that I’m now a semi-passable snowboarder (considering I am from the tropics and I’ve only seen three winters with snow in my life).

That, and gaming has eaten my time. Mainly Battlefield 3 and Skyrim. I am very pleased with FXAA (fast approximate anti-aliasing, http://www.codinghorror.com/blog/2011/12/fast-approximate-anti-aliasing-fxaa.html). FXAA is probably one of the greatest settings ever, huge jump in performance and noticeable quality. If you aren’t using it, tick that damn box or force it to use that from the graphics card and disable other anti-aliasing.

I’m also getting my nerd on. I’ve been getting back into Warhammer because the gaming group here is friendly. Orctown (http://www.orctown.com) is a good hobby store and there is no sales tax here so prices usually end up lower than mail-order too.

I’m presently improving an arduino powered weather monitor I made last month. I’ll be writing it up with pictures and code for everyone out there. It’s a simple project but I had a need (to know what temperature it is) and some tools (an arduino) to figure it out on my own. I like making things and I find it very satisfying when I had a particularly difficult or unproductive afternoon to get something done at night. To achieve something. Success on a regular basis is important for maintaining your sanity and happiness. Building things and feeling your physical connection to the world around you will definitely improve your life.

Be seeing you.

Posted in Uncategorized | Leave a comment

How I automated a repetitive task, or Git hooks and why you should use them

Say you have a repetitive task and you use git. You want to make a minor change every time before you commit.

My specific problem is that I have a Windows development machine and a Linux cluster. Foolishly, some Ruby Gems have different package names for Windows and Linux, which is just annoying and breaks Capistrano’s nice deploy command. The solution is to remove the alternate version tag “-x86-mingw32″ in my case and replace it with nothing. sed is formatted as “s/<the string or regex you are looking for/<string or regex with which to replace it>”.

Here’s my script that I added to my ./git/hooks/pre-commit file. I am changing the permissions and suppressing an error because Windows sed does something stupid and locks the file.

#!/bin/sh
# it just overrides the Gemfile.lock variable.
echo "Changing Gemfile.lock for production compatibility"
sed -i 's/-x86-mingw32//g' Gemfile.lock &>/dev/null
chmod 744 Gemfile.lock
echo 0

Now, every time I use git commit that little script will run and attempt to change the Gemfile.lock file.

This probably isn’t the best way to do it, it’s probably not even correct but it works and it saves me time.

Posted in Hacks, Linux, Rails | Tagged , , , , , | Leave a comment

An update on Nano (or how I learnt to love to bomb out)

I have pretty much given up on Nanowrimo for this year. I am just too far behind now for the amount of time I have left. I’ll probably try to fill it out into a short story and upload the 2 other chapters that aren’t here yet. I will probably also convert it into a nice .epub book with some editing, eventually because Creative Commons books definitely have some fans out there. Some of the reasons I’m giving up:

I don’t have enough time.

I thought it I just cut back on everything else I usually do in my evenings (gaming, classes, messing about on the net, TV, programming) I would have enough time. Turns out I was wrong there. I work at least 50 hours a week at time moment. Part of it is the Confucian doctrine of working long hours (because working long hours shows loyalty and is the path to perfection, if you actually believe it), part of it is my own interest in my work project, part of it is just plain peer-pressure. Whatever the case, I usually don’t get home until after 8pm and I am not functional in the mornings until after a coffee. Other tasks (keeping my apartment in order, food preparation, general hygiene, eating, and sleeping) resulted in me getting about 3 to 4 hours of writing time per day. That was enough to get about 2,000 words done but I am past that point now. Couple that with a few weekend of not writing and you see why I am so far behind.

I’m not excited enough by my story

That is such a Gen Y complaint but it is unfortunately true. I like my idea, and I mostly liked my implementation but just liking it isn’t getting me so excited I can’t sleep. I’ve written over 60,000 words before during the course of a long weekend when I was really, really excited by an idea. I can’t summon that sort of manic stamina on command. Not excited enough to sacrifice sleep for.

I’m too rational (and irrational)

I can’t beat the idea that I have already failed by this point out of my head. I would need to average almost 2,000 words a day to get over the line at the moment and I don’t have the time to write that many words in a day. I can’t fool myself into doing something. I know what is possible for myself but I also know of unknown unknowns and I am a good judge of my own performance now. I know I could not slog through the writing while working at the moment with the time and word count remaining. ‘Believe in yourself’ is crap. I know what I can do to a fairly low margin of error. That isn’t to say I couldn’t surprise myself, I probably could but the chance is too low (I’d give it 15% success). I am a risk seeking person but I do not rely on risks for success. Controlled risk. It is the difference between betting everything you have on Black and betting a months wages on Black. Both take a risk, but one is a very stupid move while the other is a 49.5% at becoming poorer or richer.

Lack of peer-pressure

I think success in Nano weighs very heavily on having peers to keep you motivated. This year I haven’t been to any write-ins because the times and places have been inopportune. Social networks don’t have the power mocking nag or gloating remark in plain text. Maybe someone should make a “dramatic reader” plug-in that converts posts to the appropriate emotion you need to hear those words read in. It is much harder without a support group.

Writing on public transport is hard here

Last year I wasn’t working so that doesn’t count but previously I wrote quite a lot while travelling. I really haven’t been doing that here in Korea. Often the buses/subways I take to and from work are full and I’m standing the entire journey. When it isn’t full I usually end up seated next to someone who takes up too much room in the tiny seats making it impossible to touchtype.

 

There are a lot of complaints there. I’m admitting that I really can’t write a novel in my spare time, in a single month, at the moment. Under different circumstances or stronger discipline in those first two weeks I possibly could have but now I am over the point of no return. I will finish it though as I am keen to get it out there and I still like it enough to want other to read it. Most importantly, I am going to donate $50. Mostly as a guilty submission to defeat but also to give to a good cause. You should donate too.

 

My next post will probably be what I learnt from Hacker News giving me an old-fashioned slashdotting earlier this month. It was a coming-of-age event for me as a network administrator (that was the first time it has ever happened to my server). I’ve had ~30,000 unique visitors this month and at it’s peak I was getting 22,000 hits per hour.

 

Until next time, be seeing you.

 

 

Posted in Nanowrimo 2011 | Leave a comment

Port 25 will be blocked for South Korea from December

So it turns out that what I thought was just a scam message is actually true:
The South Korean government is attempting to fight spam by issuing a national decree to block port 25 and use 587 instead. Here is the decree that I got sent in an email:
“방송통신위원회(http://www.kcc.go.kr/)와 한국인터넷진흥원(http://www.kisa.or.kr/)이 공동으로 진행하는 정부시책 스팸 줄이기의 일환으로 ‘블럭25 프로젝트’ 가 12월부터 본격적으로 시행됩니다.”
Rough translation:
The Korean Communications Commission (kcc.go.kr, the telco regulator) and the Korean Information Security Agency (kisa.go.kr, the censors and net cops) have a joint policy to reduce spam. A national block of port 25 will be instituted in December.
기존 발송포트인 25번을 정부에서 일괄적으로 막기 때문에 아웃룩을 사용하시는 분들은 메일 발송이 되지 않습니다.

Rough translation:
Something about MS Outlook users failing so email will be batched.

I’m trying to find the actual legislation so I can comply with it but no one seems to know where it is is. KISA has a little website that talks about Outlook but doesn’t say anything of value for legitimate developers. You can find their “helpful” website here:
http://www.block25.or.kr

What should I do?

If you have a server in South Korea you probably should change your app to use port 587 for outbound traffic and port 465 for SMTP over SSL. If you are outside South Korea be aware that all traffic sent over port 25 will probably be intercepted from December onwards.

 

Side discussion:
Do these government agencies actually think blocking port 25 will reduce spam? Most of the issues stem from open relays (yes, I’ve noticed several on my IP block) or insecure servers. Botnets are a problem but using another port doesn’t fix that. From what I can tell they are also recommending people break port 587 by accepting both SMTPS and SMTP connections. Further they recommend 465 for SMTPS just to break the spec more.

The Korean government has long had a system of deep packet inspection so the technical implementation of a nationwide firewall over a port isn’t new or unprecedented. The steps may prevent some spam but really, I doubt it will amount to anything substantial. They can’t block all email and the system would probably fall over with IP forging techniques.
Update: I’ve asked a few people and it seems to be a joint initiative by the two departments and not actually a law. Although it does have penalties and apparently you get emailed warnings the first few times.

 

Links and further reading:

Here is a post that is the closest you can get to an official requirements list:
http://www.block25.or.kr/ask/faq_read.jsp?idx=65&lmenu=13

Almost all the news seems to be copied and blogspammed comes from these pages [in Korean]:

http://www.block25.or.kr/email/spam.jsp?lmenu=01

http://www.block25.or.kr/email/purpose.jsp?lmenu=02

http://www.block25.or.kr/email/effect.jsp?lmenu=03

Posted in Uncategorized | 4 Comments

Chapter 2

An old trade route stretched out through patchwork woodlands. Leaves coated the ground in a thick soft layer of decaying foliage. The disused track was barely wide enough for two people to walk side by side. The track was probably formed by nomadic herders by the uniformity of the path. Thousands of herbivores were replaced by thousands of humans on this day. An army was on the move.
A woman who was once known as Kkum found herself in a thick chain. They had been marching all night, with only the occasional stop were the man in front of her encouraged her to sleep if she would wake him up at the next stop. He said it had been three days for him since he was taken from his cottage in the far hills. They had kept a steady pace, not fast or slow but still back-breakingly difficult. The sack of looted grain was still above her tired shoulders, rubbing on her collar as she walked. Her feet ached. Her arm ached from the still slowly bleeding cut that selected her as a slave. Most of all, her head was seared from the hangover she was experiencing. The morning was torturous on her. The sun made her eyes weep. Her tears did not make it down her face, instead they stuck to her filthy cheeks.
“You see that guard?” the man in front of her hissed, “He’s not as hard-arsed crazy as the other ones. I remember him from yesterday. He let me talk to the previous guy behind me.
“We can talk if you want. Gods above, I want to talk. The prick in front of me is deaf or mute or foreign. Either way he don’t say too much.” His voice trailed off in thought or confusion before starting back up again, “My name is Thaddeus Longpines the Third but you can call me Thaddy. You do understand me, don’t you?”
“Yes, I understand you, Thaddy.”
“Well, that will teach me. I thought you were a man with the way you don’t pull me back with these accused chains. What do they call you then, girly?” Thaddy said with a slight spring in his step as if his body was experiencing a birthday party his voice wasn’t aware of. His red hair was long, tangled and matted to his back by sweat and slop from the slowly leaking small barrel over his shoulder.
“I.. I… I… I don’t know anymore…”
“It was horrible on all of us,” Thaddy paused again in quiet contemplation. A few brave birds could be heard in the distance unperturbed by the horde shuffling past them. “You need a name. Everyone has a name. I need something to call you. It just isn’t fair on me otherwise. How about Yan? I knew a pleasant girl by that name once, lived a league away. Daughter of a butter churner. Surely you have your reasons for not telling me your name. At least I hope you do. There is no reason for us not to be friends and we may be stuck together for quite a while.”
Kkum wasn’t sure if Yan was really her name or if Kkum had ever been her name at all. Thinking about Kkum’s life brought back a sorrow into her heart and made her want to give up. She just had to signal a guard to end it all. But she remembered what she saw before dawn of an older man who asked for compassion, the brutality. Her head complained but appreciated the small kindness the strange burly man in front of her was giving her. The slaves beside them marched along glumly. They had wild eyes and unfamiliar features. Kkum/Yan had never seen anyone like that before and when she looked closely they would quickly look away from her. She didn’t know who was behind her, they had changed her to this chain soon after they joined the main road last night. Probably to split them up to stop plots, she thought. Or maybe she had just been allocated into someone else’s spoils.
“Umm, no, we can be friends. I think. My head is just feeling the wrath of the drink today. Yan is a lovely name, you may call me Yan.”
“Good. Good. Very good. I’ve been waiting for some company. The guy who was, ugh, behind me before you didn’t make it. He jumped from a bridged and almost dragged us all in after him.”
“That’s awful,” Yan, she had decided would be her new name and her gateway to put her old life behind her. To forget and move on from the horrors of last night. Not that carrying a sack for an immeasurable distance seemed any better. It was unpleasant but it wasn’t agony, yet.
“Yan, me dear, what shall we do? It’s a beautiful day isn’t it?”
He was a very strange man, Yan though, but it broke the tedium. “My head is on fire.”
“Oh, you poor thing. I forgot. Maybe it won’t be too much further. They have slept in the day since they caught me. At least there is no––” Thaddy was cut short by the crack of a whip. Some way in front of them a girl was struck across the face by the twisted leather. Skin was viciously torn from her flesh by the blow and her wail sent ripples of fear through the ranks of slaves. Silence enveloped the chained slaves unsure what her infraction was and terrified it could be them next. The girl picked up her burden and continued onwards attempting to suppress the pain from her flayed cheek. The guard grunted and the caravan resumed its pace. Thaddy was silent now and Yan was not keen to risk a matching wound. One foot before the other, she counted her steps to one thousand and then started again.

Shadows were small beneath Yan now. She thought of herself by her new name, repeating it in her head as she walked. Even imagining conversations with Thaddy or the savages beside her where they called her Yan and she would reply. Her throat seized up sometimes when her lie fell through and she remembered what love felt like. Lost love ripped at her soul so hard the conversations she imagined were screaming at each other. She willed inane pleasantries to fill her mind. She even focused on her cuts and scrapes, attempting to amplify the pain in her mind to block out her recurring memories. She was Yan. Yan was her. Yan’s foot hurt from a shape rock she stood on 965 steps ago. She knew she could make it real because she was real. She had always been.
A horn blared. The sound echoed through the valley. Softer horns answered the single long note followed by barked shouts in the guards tongue. People were stopping while others were being issued new orders. Confusion reigned. The guard near Yan grunted unknown orders at them but his thrusting hands, especially the one carrying that whip, made his intentions clear. Yan pulled on the chain with her neck, the unknown stranger behind her was uncertain.
“We must move forward and to the left,” Yan hissed. No response. The chain slackened and they were moving onto the grass. They seemed to be following someone over the uneven ground. On her left her another chain of slaves was moving. On her right, from between the strange savages, she spotted the hammering brute, still coated in dried blood. She gasped. The Brute was leading three rows of slaves beside them. Yan now realised they had entered a clearing. The autumn sun bore down on them but the air was still cool. The Brute moved faster now, his followers were uncertain so they tried to match his pace. Some further from the front fell as their collars pulled tight. The ground was slightly damp and rocks shone through the tufts of wild grasses. The brute raised his arm. Other rows of slaves had flanked the Brutes followers. There must be thousands here, Yan thought. There were other guards and warriors too. Hundreds moving along the flanks now. Many with their armour removed and being carried by slaves without collars, some without clothing at all, who raced behind them. More warriors clustered around them now that they had halted. Yan could see at least twenty rows of slaves on her right. There was perhaps twenty slaves joined by single chains and several chains were following into the same formation under the watchful eyes of their controllers. Perhaps five thousand slaves were now gathered on the tussocks of grass between the sparse woodland leading up into the surrounding hills. Ahead she saw far more warriors, hundreds, possibly a thousand or more. She heard numerous slaves continuing to pour in from behind.
The horn sounded again. Some slaves began to drop to the ground. Guard signalled downwards with their hands and whips. Yan sat and looked behind her. In the distant rear she could see thousands of slaves followed by at least one hundred horsemen and some strange beasts. She had seen pictures of some of them, those were called mammoths. Others she could not name. They seemed to be some sort of giant lizard topped with a howdah carrying a dozen warriors. Her heart sank lower. Escape was worse than futile, it was impossible. Their might was unmatched. She began to sob.
“Yan, me dear. Do you remember? It is my turn to sleep first. Please remember. The guards will beat us both if we don’t get up fast when they want to leave,” and as quickly as he started speaking Thaddy was asleep. Yan stared back at the lumbering beasts behind her and waited in the afternoon sun.

Posted in Nanowrimo 2011 | Leave a comment

And we are back

My server has been down for most of the day and night after a failed update. Ubuntu decided that MySQL didn’t really warrant much testing and the update that was pushed caused multiple failures and resulted in some serious debugging. Given how tiny this server is (it fits in a small box under my switch and router) apt took most of the morning to reconfigure the failed transactions but it is back now. Enjoy the goodies that this site provides and laugh at my slip to less than 95% uptime.

Posted in Linux, rants | Leave a comment

Chapter 1

The golden fields of ripe grains stretch out over the plain and into the horizon of colossal storm clouds menacingly looming in from the west. The verdant plains rewarded their residents with the best harvest many of them had ever seen. Rains had come at the right times and not come at the wrong times, disease and pests had been held at bay by the sacrificed offerings and workers had toiled hard and long. The result was the fat, plentiful grains which almost threatened to collapse under their own weight. Thunder boomed in the distance and the valley filled with an orange half-light. Dogs barked as chasing children squealed with joy. From trees lining the road birds squawked and cawed sensing the ominous turbulence approaching from the west. Many birds retreated to the air and fled the progressing storm front. Other life in the valley continued its celebrations. Today is a joyous day because today is the first day of harvest.

Under an old willow along the tree-lined canal, lay two young lovers in romantic embrace. Entwined together they lay in the long grassy shade of the orange twilight. The smell of Autumn leaves mingles with musky sweat to fill the slight breeze brushing over the lovers’ bodies with pleasing aromas of passion and lust. Contented they lie. The afternoon exertions have capped off their long day in the fields. The toil over the summer has left their bodies toned and calloused. From their bed of foliage they smile contentedly into each others eyes in a way that tells the other that worry is an eternity away. Peasant’s pants and shirts lay scattered around the willow; the brown, dirtied clothes barely contrasting against the autumn leaves. One of the lovers rises from the ground and the naked body dives into the cool stagnant waters of the irrigation canal. The other lover jerks upright, laughs at the sight and flops back into the leaves.Staring at the sky the lover sees lightning cleave the sky in two and illuminate the valley below.

The village in the centre of the valley is little more than a collection of hovels conjoined by a circular wall. It is one of several similar villages in the broad valley. Apparently all the villages in this valley are under the jurisdiction of a single lord, though none of the peasants have seen this lord or his men in over two harvests. The villagers do not see this as a bad thing, no lord means no taxes and tributes. The villagers are doubly gleeful at this years bumper crops and several of the other villages have speculated about purchasing weapons from a rogue smith. Weapons would grant them all independence and unite the valley under their own control instead of that of a ruthless outsider. Their absentee landlord would pay for his indifference, the village elders said. The elders saw themselves ruling by some sort of council, the heresy of it, some of the peasants said. These issues were of little concern to the lovers though. One surfaced and spat water on the others naked frame. The lover flinched and cried out at the sudden cold water amplified by the steadily increasing breeze. Others had begun to retreat from the intensifying weather. Three children sprinted past giggling which sent one lover reaching for her clothes to protect her modesty.

“I don’t know what you’re hiding. They’ve probably seen it all before by now any, I’m sure”, mocked the wading lover before pushing back from the edge.

“Oh, you hideous wretch! How dare you,” the lover replied in a coarsely whispered blush, “I’ll have your hide to hide my beauty if you keep that up.”

“You couldn’t catch a fever let alone me, Kippum,” the lover said before swimming in to the near wall. No sooner did the lover reach the wall before a glistening and slightly algae encrusted body lept out of the wide ditch and swished through the leaves.

“I’ll have you, you wicked beast, Kkum,” said Kippum as Kkum rushed past her sending leaves flying. Snatched pants pulled on too quickly sent the lover rolling out onto the dirt path. Shoes and shirt in hand, Kkum was off, bare-chested down the track towards the village. There were few other stragglers heading back now, most of the children had long departed to the safety of the village wary of old gods in the sky. A drunk lumbered into the field  across the canal before tripping on a furrow. Obviously the drunk, a young man known to the lovers, fell uncontrollably back into the field. There he lay in his stupor. Kippum worried for a second that she had been seen before laughing at the fool and his inebriation. She hastely pulled on her pants and worn old leather shoes before giving chase to her lover whom had collapsed in fits of amusement at the drunkard or her, Kippum was too focused on catching her lover to spare it a thought. Kkum rolled out of hysterics and into a shirt in a feat of dexterity or luck, probably the latter. The lovers giggled and ran back to the village determined not to be the slower party. Overtaking children and older, slower groups the two almost reached the village perimeter before the sky opened up and unleashed its pent up payload. Rain streaked down their faces and drenched their clothes. Lightning cracked across the valley in a vicious spectacle of destruction. The storm bore down on the village with the full force of the elements as two lovers entered the main gate under cries imploring them to hurry.

A tall fire burned the centre of the great hall. The entire village had gathered in the hall to continue the celebrations, albeit somewhat muted by the raging tempest outside. Giving thanks for a harvest was almost as important as collecting the grain itself. If you were not thankful for such a bounty the gods may show their displeasure. So a great feast of porridge, fowl and even a boar was washed down with torrents of beer as village elders and the granary master brought forth barrels of their lager. Chorus were slurred between deep swigs and hearty gulps of stews and meats. The lovers had regained their composure from their earlier adventures.  Dressed in their finest clothes and seated with their extended families throwing occasional sly glances at each other. Kippum was sounding increasingly drunk and she had fallen from her stool twice now. Each fall was followed by guffaws and roars of applause from the others. Kippum was not special, she was one of many collapsing under the weight of the day and imbibed beer. One of the elders began to vomit. The crowd burst into laughter. The respected man’s compromised state had brought half the hall to its knees. Some even rolled on the floor, clutching their sides.

“Come now, great father, the party must go on,” said one of the farmers who helped the frazzled old man to his feet. The party burst into fits again and the chanting redoubled. Rain dripped from the thatched roof as thunder provided an eerie backing to the songs of great harvests and overcoming harsh winters and the joys of bedding ones lovers. Voices would echo in the hall if you were alone but tonight the hall was packed with revellers. Children darted between adults, conscious and not so conscious. Dogs barked from the corners of the room at the commotion. The feeling felt like it could continue forever and everyone could live in uninhibited joy and merriment. Two lovers stared at each other unnoticed by the crowd until Kippum fell once more from her stool. This time she did no rise, she had fallen asleep on the dusty floor.

A thunderclap rang out through the hall, shaking the walls, roof and bones of the remaining revellers. Kkum was still drinking with a local boy of a few years older whom Kkum had never really become acquainted with. The boy was your local run-of-the-mill dullard. He was interested in girls and beer but his interested ceased to overlap any further with Kkum’s own. Kkum was interested in everything and anything: small things, large things, people, places beyond the valley, how to get things done and whether the rest of the world was like this valley. Once, during the recent summer Kkum and Kippum had skulked off together to the very top of one of the mountains that had been the end of their world since they were children. They were disappointed to see only more of the forest that covered the mountain also covered the next valley over. Kkum had been to the far village at the end of the summer before but it had been as unsatisfying as finding the forest. The village was almost identical to the one he grew up in and departed two days before. The other boy, Ren was his name, shared no interest in these tales when they did not contain beer or women. His eyes glazed over and he just stared at Chem, a mother of young twins who’s husband died years ago, who now had her ample breasts out for the village to drool over. Another loud bang rattled the walls. Most of the village was sprawled out asleep on the dirty floor and each other now. Kkum did not want to sleep. Dreams of Kippum were the only thing waiting there and dreams would go unfulfilled in sleep as their love must remain secret. Small communities talk too much.

Only a few die hards, Kkum included, were left now to work steadily through the last of the beer in the barrel. The walls pounded once more and the door burst open. Under the arch stood a great hulk of a man dressed in peculiar black armour. Straps wrapped his otherwise bare chest holding his shoulders and chain-mail sleeves to his body. Long hair and a longer beard gave his head a savage and fierce appearance. Six other similarly strange warriors approached from behind the gaunt giant in the door. Kkum noticed the blood dripping from the warrior under the door. Behind the strange warriors, Kkum noticed several dead dogs strewn around the central courtyard. Panic began to set into the conscious crowd. Silence descended onto hall leaving only the sounds of heavy breathing and quiet fear. Someone snored. The beast in the lead let out deep grunts in an unknown tongue and lifted his hammer over his spaulders. Rain started pouring once more outside. A smaller, slighter man in a full suit of black plated armour stepped in from the rain and seemed to answer the giant in his language of grunts then something more recognisable but strangely accented.

“You don’t all have to die tonight but fail to co-operate and we will see this room filled with your blood,” the plated figure removed his helmet to reveal a bald, scarred ugly head beneath it. “That got your attention didn’t it. I’ll be frank, we want all the provisions you have and as many of you as we please for slaves. Only the young and fit, so most of you geezers have nothing to worry about. However, I won’t ask twice and he doesn’t ask at all.” Signalling the brute behind him now as he paced into the centre of the hall kicking a sleeping head as he walked.

“Right! On your fucking inbred feet, you lazy degenerates. Got your fucking attention now? Slowly move outside in a fucking orderly manner. Do you fucking understand me?” The child beneath the plated figure’s twisted mouth screamed in terror. All but the completely intoxicated were slowly rising in shock and bewilderment. A piercing scream let out from the side of the room where another of the warriors had plunged a small dagger into the side of a drunken farmhand who burned out earlier in the night. He now lay quivering, clutching his side as his blood oozed out between his fingers. Another scream as the plated warrior pulled a young girl up by her hair tearing great clumps from her head in the process. Her screams sent chills through the disorientated villagers as celebratory ecstasy turned to pain and terror. The girl’s father reached for a meat cleaver and lunged for the plated warrior. His defence was cut short by the hammer of the giant as it crushed his skull. The girl’s father twitched and jerked uncontrollably on the floor causing his daughter’s screams to fall silent despite the blood which now trickled from her torn scalp. Kkum was heading towards the door and towards Kippum who had barely propped herself into a kneel. Fear overtook Kkum to reunite into Kippum’s hand and hopefully lead her from this tragic night.

The villagers were almost in a rout now, trampling the few corpses of those who had at first attempted to mount a defence. Dejectedly they marched out into the courtyard where they were met by a macabre spectacle of the slaughtered dogs and a few stray villagers who left the celebrations earlier. The sight sent Kippum into nausea. Some villagers tried to retreat back into the hall as they noticed dozens of warriors were now looting their homes and the grain stores. Sacks of grain were being piled outside the granary after being filled by some of those unfortunate enough to have got out of the crowded hall earlier. Kippum’s hand tightly gripped Kkum’s as the lovers stood close in the courtyard’s swarm of activity and humanity. Some cried, but only softly because their captors had reacted savagely to those who made too much noise or attempted to communicate too openly. The boy who was so saddened by his dog’s miserable body is still up on the roof with his head concave after the enforcer’s hammer. His parents could barely hide their grief no matter how hard they tried as they shook next to the lovers. The rain turned the ground a muddy brown as still more bags were hauled from the cool walls of the granary and out into the rain.

Ahead of the lovers the man in black paint was cutting the arm of a boy who was almost a man. “The sadistic bastard never lets up,” someone whispered nearby. The boy whimpered but restrained tears. His wound seemed to be superficial. Another boy was similarly marked by the Bastard. He could not contain himself and soiled his pants in fear at the twisted figure that still gripped him. the Bastard stabbed upward under the boy’s chin and the child fell limp onto the muddy ground.

“I swear you are even bigger soft cocks that that other mob down the road,” the Bastard stated, apparently to himself but loud enough for those around him to hear and understand the utter futility of the situation. Their lives lay in the hands of psychopathic murderers. Help was not coming from outside and the elders were heaped inside the hall now after they tried to concoct some kind of plan. Their long, happy lives shattered and now their ruined bodies were stacked up in their former seat of power. Blood was everywhere. Blood, rain and mud.

the Bastard approached an older girl. She was not yet wed, mostly because of her plain and unappealing features that the children would mock her about. Once a boy who was mocking her was caught by the girl, who gets called Lau. Lau beat him blue and her tormentor’s eye didn’t open for a week under that bruising. Lau now stood taller than the Bastard who stood before her. the Bastard looked at her and suddenly plunged a filthy finger into her mouth and began feeling around. Lau’s eyes looked around unwilling to accept that the situation was as dire as it appeared, or maybe to appeal for help from the defeated villagers who stood round her silently. the Bastard’s finger withdrew before gripping her arm. A cut was made on her right arm before the Bastard’s focus shifted once more in search of new prey.

Kippum was suddenly in the Bastard’s grip. His eyes narrowed as he squinted at Kippum. He licked his lips and tightened his before releasing his right hand to draw his knife. Kippum’s eyes clenched tightly closed and her lip quivered in anticipation. Her warm blood ran down her arm and over the Bastards putrid left hand before releasing his grip. Kippum held her tongue in spite of the pain caused by the slice in her upper arm. Her lip quivered but didn’t part to release a sound. Kkum stood in admiration or pride next to her before the Bastard’s gaze shifted to Kkum.

the Bastard gripped Kkum’s chin and stared into an open mouth before releasing Kkum with a quick and unexpected slice. Kkum almost cried but held fast and held Kippum’s hand tighter. the Bastard lurched onwards for fresh blood, or whatever he was after leaving the lovers a second to look into each others eyes to find only fearful expectation and suffering. The granary was almost emptied now. Almost fifty sacks were stacked in a drier part of the muddy courtyard by the main gate.

One of the warriors belched something at the Bastard. The Bastard responded in that hideous tongue before translating the order, “you lot, yes you miserable sacks of shit! Take off your pants, tie the feet and pass them over to him. Now! Are you fucking deaf? I said now!” The Bastard paced over to the girl who was struggling to reluctantly remove her pants. The Bastard drew his knife but the Giant grabbed his arm and with one swift motion pushed the girl backward into the mud in front of the warriors milling around the granary door. He grunted something and returned to his patrolling to bully others. Everyone looked away as they knew what was about to transpire. The Brute picked out three more young girls, ripping the clothes from one who tried to crawl back before hurling her into a wall were she collapsed before the inevitable. The screams and cries tortured the defeated villagers so much that two young men and one of the girl’s mothers rose to their defence only to face off against the Brute himself who ended their lives almost as quickly as they could rise to their feet. The screams continued for what seemed like forever as the rain beat down on the surviving villagers in the centre of the courtyard.

“Right, it’s time to fucking move out. We have all had a lovely time but it is late and we have a long way to go,” gloated the Bastard in his snide accent. He paused causing the Brute to cast a stern gaze at the Bastard from under his heavy brow and blood-matted hair. The Bastard was staring at a girl who had had the briefest glimmer of hope in her eyes. You could tell that he was savouring the moment biding his time for the instant where destroying her hope would grant him the most satisfaction. The Bastard smiled.

“If I cut your right arm step forward. If I didn’t cut your arm move back,” he said as tears streaked down the girls expression as if they contained the last of her hopes and dreams in the salty fluid. She stepped forward and the Bastard’s gnarled grimance grew larger. “And don’t any of you lot think you can fucking hide them cuts. Step forward or die where you stand.”

Kkum stepped forward. Kkum’s arm was being pulled back by the other lover. Kkum implored Kippum with a stricken glance before understanding the situation and taking it in with wide-eyed horror. Kippum’s mother had gripped her daughter’s waist and tried to drag her backwards. Confusion sprang across her face and her eyes widened. Kkum cried out in agony as the hammer came down onto her lovers head. The blow crushed her skull from behind, her beautiful face blotched as blood vessels collapsed from the force and her eyes emptily watched her lover fall back into the other slaves. Her energy slipped from her body as her lover slipped in the bloody mud. Tears streamed down Kkum’s face but her true grieving would wait as her adrenaline kicked in to keep her body in motionless shock. Kippum’s mother’s body fell over her lover after the hammer fell again. Kkum’s future and past evaporated in the cold autumn rain. In a moment, her entire existence ended in every way except true and final death. While her body stood in the soaking rain she felt her soul and reason to live destroyed by the mighty blows of the great hammer.

Eternity passed and another order was barked from behind by the Bastard. The woman who had been known as Kkum awakened to a world of shit and blood to pick up a heavy sack of grain. This woman acknowledged the rusty chain being bolted around her neck when she departed the compound where she once lived. A order to walk was issued forth from someone somewhere close. One foot followed the other to the rhythm of the clinking chain links as the sky closed and the rains departed. A large group was marched along a muddy road in the early hours of a morning out of an unnamed valley.

Posted in Nanowrimo 2011 | Leave a comment

Embedding objects with Fabrication in Rails 3.1

This post is about Ruby on Rails 3.1 testing with RSpec. It’s a bit of a departure from my usual content but it is my $dayjob and this will be helpful to folk out there struggling along on the intertubes. This post also assume you know a lot of background information about Ruby, Rails, testing and Fabrication.

Fabrication  is a great gem. I use it with RSpec and Cucumber because it works with Mongoid and seems less buggy than some of the other object generation frameworks. One issue I’ve had with it is how to create embedded objects which you should be using if you have nested forms. Nested object should definitely be tested, doubly so if you have any special validations running. So here is how to write a Fabricator that actually embeds objects.

These are some example objects for a user who speaks languages.
The user.rb model

class User  
   include Mongoid::Document
   field :languages
   embeds_many :languages
   validates_presence_of :languages
   attr_accessible :languages_attributes
   accepts_nested_attributes_for :languages,
       :reject_if => lambda { |a| a[:language].blank? },
       :allow_destroy => true
end

The language.rb model

class Language
   include Mongoid::Document
   field :known_language
   field :proficiency
   key :language
   embedded_in :user
   attr_accessible :language, :proficiency
end

The Fabricators. Remember that Fabricators have a special directory layout. Mine are in spec/fabricators/ then a folder with the same name as the model for each Fabricator.

The language fabricator (spec/fabricator/language/fabricator.rb)

Fabricator(:language) do
  known_language "en-US"
  proficiency "1"
end

The user fabricator (spec/fabricator/user/fabricator.rb)

Fabricator(:user) do
  languages { [ Fabricate.build(:language,
                                :known_language => "en-US",
                                :proficiency => "1"),
               Fabricate.build(:language,
                               :known_language => "ko-KR",
                               :proficiency => "1") ] }
end

A dodgy test user_spec.rb file

require 'spec_helper'

describe User do
  describe "a user with two langauges" do
    it "should be allowed to enter the world" do
      two_language_knowing_user = Fabricate.build(:user)
      two_language_knowing_user.should be_valid
    end
    it "should know two langauges" do
      two_language_knowing_user = Fabricate.build(:user)
      two_language_knowing_user.languages.count.should == 2
    end
  end
end

Works like a boss. Jawsome.

Posted in Rails, Testing | Tagged , , , , , , , , | Leave a comment