Monthly Archives: March 2014

Python – Silicing with two Delimiters

While making a crawler for blogs I faced the following problem:


Info_That_I_Want_Follows: “Important Information”


Problem: How to extract “Important Information”?

The ideal way would probably be parsing the html and seeing which tag contains “Important Information”, but I don’t know how to do that so I wrote the following “hack”:

i1= s1.find(“Want_Follows: \””)
i2= s1[i1+len(“Want_Follows: \””):].find(“\””)
FinalString= s1[i1+len(“Want_Follows: \””):i1+len(“Want_Follows: \””)+i2]

But now that I think about it, a simpler way would be:

s2= s1.split(“Want_Follows: \””,1)[1]
FinalString= s2.split(“\””,1)[0]

A lot easier to read. Yet another cool thing would be to make a function like this:

def Slice2Ways(Delimiter1,Delimiter2,StringToSlice):
String2= StringToSlice.split(Delimiter1,1)[1]
return String2.split(Delimiter2,1)[0]

Because this kind of slicing is done frequently if one is to extract data without building a full blown parser.

Leave a comment

Filed under Uncategorized

At a Snail’s Pace

chris white writes

Arriving to Arratha, City of Science – Michal Matczak

The University had stood for an age, harvesting the finest minds of an entire system, spreading slowly across the skies, a sandstone and ivy cancer, blotting out the sun.

For those of us living in its shadow, it was a reminder of what we could never have, and of the privileges of the ivory tower. Our women stolen, as well as our children – and we were supposed to thank them! I always listened to my mother: Never talk to strangers. We ran, and hid in the mountains.

Yet still they came.

The air-bladders on the ships inflated, at a snail’s pace.

Surely they would discover us. Surely.

They didn’t – and we struck, our flotilla silently approaching, the setting sun at our backs and revenge before us.

Stone doesn’t burn.

But books sure do.

View original post 7 more words

Leave a comment

Filed under Uncategorized

ISS Cupola

ISS Cupola

‘been chilling lately, not much writing, so decided to post this cool pic.

Leave a comment

March 7, 2014 · 8:29 am

Programmer, Coder or Engineer?

What should one who makes software be called?
I prefer Programmer. Coder implies a lack of knowledge regarding algorithms or at the very least being prone to “hack”(do quick fix code that is bound to cause headaches later on)
Engineer would be someone with some sort of bachelor degree, perhaps regulated by a government. Not my case.

Curiously, Mr Gates Wikipedia also seems to like “programmer” better:!1,1164807331

1 Comment

Filed under Uncategorized

Short Story: Fairy Tower

Glaring at my computer screen become increasingly hard as fatigue took over my eyes, I took my glasses off and rubbed my thumb and middle finger on my eyelids. Not withstandanding my tiresomeness I felt hungry.
Maybe I should eat something before going to bed huh? – I murmured to myself.

I went to the kitchen and reached out to the cabinet handle when I heard something moving inside it. Two or three seconds later a faint dark-purple glow started seeping trough the cabinet’s crannies.
I stepped back still gazing at the weird phenomenon, but the noise grew louder and the cabinet collapsed inside what seemed like a portal to another dimension. I realized other objects flying towards said portal. Before I could think about fleeing my foot was already sliding irreversibly in that thing’s direction.
I rememer thinking whether it was a blackhole as my body was flunged inside said portal. The dark-purple light gave way to a pink sky. Nothing below or above me, I was freefalling. Wind rushing against my face. The terrain approached quickly, and I ended up hiting my head against some tree’s branch.

I woke up just to find several small creatures looking intently at me. They walked on two curved short legs and had a toad-like appearance. One of them got near and said something without moving what looked like it’s mouth.
-Greeting stranger, can I have your tribute?
Was that telepathy? And what did it mean by tribute?
It looked at the it’s peers as if it had read my thoughts and tooked them as an answer.
It didn’t looke pleased but it’s not like the thing had changed it’s expression.
-Stop calling me “it” and show me the Giant Tulip seeds.
I don’t know what you’re talking about – I thought, this time knowing there was no privacy within my mind anymore.
My head was still hurting from hitting the tree(and possibly the soil, my consciousness ended right after the branch hit) but I endured and tried not to show any sign of weakness.
The weird band, which amounted to 5 or 6 beings plus some dark silhouette behind them. The bright sky was partially blocked by the pervasiveness of the trees.

They started throwing some red gloo from what seemed like their mouths. It was very sticky and as the quantity being thrown increased my body got binded.

Stop! – I yelled. It probably contained some sleep inducing chemical, my eyes started closing on their own.
Don’t worry, we are not going to kill you, just have you get us the tributes you owe. – I thought hearing before falling unconscious again.

When I woke up three or four creatures were removing the binging gloo by spraying some liquid(also from their mouths) that eroded the gloo.
Climb this giant tulip, get to the flower, get the yellow colored seeds, and climb down to us – One of the creatures told me(using telepathy, as always)

I couldn’t tell if the toadish thing was the same creature that greeted me before, they all look very similar to me.
I thought about fleeing but I felt a hunch that it would be a fruitless endeavor.
Yes, it would be uselees, don’t bother – Damn, I had forgotten they can read my mind.

I climbed the tulip whose height was twice that of the neighbouring trees but whose width wasn’t so bulky.
The flower itself was the size of a telephone cabin. I slid inside and took one of the yellow spheres, it was soft but seemingly resistant. It didn’t feel like I could break it by squeezing it. Perhaps I should just let it fall to the green toads?
Don’t do that! – I heard one of them saying, a different voice.
Hmm, so I guess the one that instructed me to climb was the one who greeted after the fall.
You can call me Yoonar – the first voice told me
Now, climb down the tulip while holding the seed. – Yoonar
I did as told and gave them the yellow sphere.
They started drooling as they ripped it’s shell.
Inside lied what looked like a butterfly, but it wasn’t moving.
It’s dead! Go get another one. – Some other toad said.
And so I did, this time they were happier when looking at the interior.
A live butterfly, Yoonar took it by the wings and swallowed it.
He trembled for a while and started smirking. The first time I saw him(or any other toad-like creature for that matter) changing his facial expression.
Great! – He screamed inside my mind – Hahahaha, now go get two more!
As I climbed yet again they started running away.
I decided to stop and check things out.

Two human-like entities come into view. They resembled girls, about 5 feet 5 inches tall, wearing what looked like a summer dress, they had two somewhat transparent insect wings. they run towards the spot the toads were standing before, and then suddenly stopped.

One of them looked up at me.

Hey you! What are you doing? – she yelled, I was about 24 feet high clinging to the giant tulip.
Well, they told me to get some yellow spheres and… – I was interrupted
What!? You helped them kill our children!? – said the other winged cat-girl
Come down here! – she continued.
No, they made me get those things… – I started explaining as I climbed down.
She then pushed me to the ground with an unexpected strength. And chained my wrists.
You are under arrest! – she yelled.
Can you people stop binding me!? – I asked exasperated.

The two took me through the florest until we reached a huge lake. In the center of the lake lied an island and on top of that Island a huge but slender white tower that dwarfed the whole forest(including the giant tulips).
The cat-girl that wasn’t behing me made some gestures and summoned a bridge that seemed made of transparent plastic with a very faint blue color.
Let’s go – she said while pushing me forward.
I walked following the other cat-girl who had just summoned the bridge and was now walking towards the tower.
Hey cat-girls, can you please tell me when I’ll be able to explain myself? – I asked
We are fairies, not cat-girls. And the answer is never! – The one behind me said
The cat-gi… er… fairy leading the way chuckled and said – Well, we need to get to the fairy tower before you can be judged.
The fairy behind me tsked.

Leave a comment

Filed under Uncategorized

Distributed Analytics Project – Progress Report

So, I made the hub, got the client to download the analytics-urls list, got the client to connect to one of those urls… but them… I figured that I would need to either: upload the whole file to get analyzed OR write a multiple-state script that is really going to complicate my life.

Today I thought about using python script and then evaluating at the client side but there is no safe way of doing that.

Uploading the file isn’t really practical because I plan to analyze huge files in the future.

So in all, there are three options:
Client sends file to Analytics-Page, receive report and then forwards to HubClient sends url and size of file to Analytics-Page, executes custom script received, sends result to Hub
Client analyzes file, report to Hub

The first isn’t scalable, the second is too complex(custom script) or prone to attacks(python’s eval()).
That leaves removing the analytics page and doing everything at the Client level.
My code would be revealed and someone could simply edit out the part that sends me the analysis result. I believe they won’t  because:- I will ask them politely not to
– I will format their results and make it easy to check them on the Hub side, plus they get to share/advertise the file/url analyzed

Lots of stuff to think about and code.

Leave a comment

Filed under Uncategorized

Lumberfield Lager

down the dusty road

Lloyd was a dwarf. Like most dwarves, aside from gold and jewels and mining, Lloyd loved a good lager after work. Nothing smoothed the dust coated throat like a rich, golden lager.

Usually dwarves all ascended from the mines and drank in groups, but Lloyd was a bit of a loner. He didn’t have many friends and his mine didn’t produce much beyond the odd bit of pyrite which he sold to the odd dumb human as real gold.

So Lloyd found himself alone at the Ugly Elvish Maiden, drinking his after work lager and fidgeting on his stool.

That was when she breezed in. She was tall, but not graceful and billowy like an elf. Neither was she bearded, like a dwarf, but there was a hint of something more than slightly hairy about her. Lloyd couldn’t put his finger on it exactly.

She sat down a few stools…

View original post 602 more words

Leave a comment

Filed under Uncategorized