Thursday, December 25, 2014

Skiing and Ukrainian

Ukrainian 100/100 and skiing achievement unlocked. What a day!

Monday, December 22, 2014

Motivation and bullshit

How do you feel when someone calls your code a piece of bullshit?
For me, as I am very not self-confident, this was very discouraging. But it was motivating as well, such an oxymoron. I remember, when some senior student told me, that his teacher would rather kill him than allowed him to write code the way I did. I was so much upset, but then, year after I became one of the best students in my group and also had good -- or even very good, as I always lower my self-esteem -- knowledge of C and Linux. Well, at least I got excellent marks at my operating systems course and course project. And my colleagues rate me as a really good and, wie es man sagt, zukunftweisend at programming. Some of them even call me "warior" =)
So, if you ever will face any kind of critics -- don't just go away or stop doing, what are you  currently doing. Even with my lowered self-esteem I can say for sure, that I am now way better dev, than the guy, who criticized me a year ago. And even if my python script is a bullshit, I will become a way better python dev, when I finish my server-side xcb task. Take that, unknown python wanna-be pro!

And, what can ever be more motivating, than a call from Google? I got one today :D
Just for the history: Google recruiter called me today to talk about internships opportunities. I am more than sure, that I won't fit, because, oh my god, who am I to work at Google, am I asleep? Even more, with OP I got no time to work on other projects. But maybe in not so distant future...


Saturday, December 20, 2014

code_to_text

Well, I'm currently building the X.org.

I'm using qemu and though it's really gorgeous, it's sooooo slow. Or it seems to be.
I've been installing X.org for 4 hours (with all the required libs and additional packages). I got bored and made up my mind to practice python (as python it's is one of required skills for my server-side xcb task).

I needed an app to convert my numerous source code files from the OS course project to the single pdf to present and see the professor's comments. Yes, it's pretty useless app, nobody needs to print the source code as pdf nowadays, except me. Anyway, it took not so much time, I practiced python instead of just starring at the black installation screen and I won't have to copy and paste all the source files and then convert to pdf.

#!/bin/python

import os
import re

from reportlab.platypus import SimpleDocTemplate, Paragraph, Spacer
from reportlab.lib.styles import getSampleStyleSheet, ParagraphStyle
from reportlab.lib.enums import TA_JUSTIFY
from reportlab.lib.pagesizes import letter

def code_to_text(regpattern = 'py$',
 spath = os.getcwd(), 
 dpath = os.path.join(os.getcwd(),"code.pdf"),
 fontsize = 10, 
 fontface = "Ubuntu Mono",
 left = 5,
 right = 5,
 top = 5,
 bottom = 5, 
 cmnt = '#'):
 """Converts numerous source files into one pdf file to print and present
 """
 
 story = []
 styles = getSampleStyleSheet()
 
 for path, dirs, files in os.walk(spath):
     for f in files:
  print(f)
             if re.search(regpattern, f) != None:
   fd = open(f)
   head = cmnt + ' ' + f + ' ' + cmnt
   story.append(Paragraph(head, styles["Normal"]))
   story.append(Paragraph(fd.read(), styles["Normal"]))
   fd.close()
      story.append(Spacer(1, 12))
  
 doc = SimpleDocTemplate(dpath, 
    leftMargin=left, 
    rightMargin=right, 
    topMargin=top, 
    bottomMargin=bottom)
 
 doc.build(story)

I used the reportlab.pdfgen lib to generate pdf and os.walk to walk through the files. 
User can filter the files to process with regexp, e. g. per default it's 'py$' -- python source files, 'cpp$' -- c++ and so on, I used re to make this happen
I'm about to implement font face and size specification.

Specify the margins with left-, right-, top- and bottomMargins. (As for me, I specify 5 for each one, so I will pay less money when printing the pdf)

About the comment signs. I planned to calculate the target comment sign right from the specified file extensions, e. g. '#' for 'py$' files or ';' for masm32 files, but then I realized it's too dummy a decision -- there are so many programming languages, I won't be able to build a db with all the extensions corresponding to comment signs. So I let user just specify it as a regular symbol. Not a reliable decision. But better then building a db for every single programming language. It's just a 4-hours script, I will not spend an hour working on it after the implementation of font face and size specs. Thinking about spending some more time useless drove me crazy, so I just let it be a sign.

Tomorrow I'll try to build xserver again, hope this time I'll do it and go further with my task.

Learn python!

P. S. Yes, it manages new lines horribly, to be frank it doesn't manage them at all! But I'll fix this.
P. P. S. How much coding is easier then deploying, dear god

Part II

I improved the script to the normal state, features featuring:
  • It will walk ok using dfs and won't get into .git subfolders
  • User will be able to specify the font and the font size
  • It manages indents ok (kludge detected!)
You also can enjoy my solution's sweet N^3 complexity. Argh, I just don't know how to make it faster, so I'll just let it be so.
I also shared it on bitbucket. Feel free to clone: https://bitbucket.org/AsalleKim/ctt.git
And after spending an hour designing the regex to find all the \.c$ | \.h$ files in the breezy dir I came up with thought that using regexes was not such a good idea...
Don't write kludges!

Wednesday, December 10, 2014

breezy

So, today I got 100/100 for my operations systems course project "Breezy".
I'm so proud of myself.

Monday, December 8, 2014

Pivot tables

omg, who could ever invent this

http://buysql.com/mysql/14-how-to-automate-pivot-tables.html


Outreach Program starts tomorrow

Ok, I am a participant of GNOME OPW now.

If I could send myself back in time and tell 12 years old Asah that she will participate GNOME sponsored X.org project to write a generator with Python, she would never-ever believe it. Myself, being 19 years old, can't believe it till now.

This is a milestone.

If you discovered this program, don't hesitate to submit a small contribution and try to participate. To clarify some things: to participate GNOME Outreach Program for Women you need to:

  • Be, as official GNOME website says "women (cis and trans), trans men, [or] genderqueer"
  • Pick a project and find out, what kind of initial small contribution can you deliver. 
  • Find a mentor, fixed to this project
  • Complete the initial contribution (The hardest part)
  • Commit what you have done, alternatively, send it to mailing list, another words, publish your achievements (mentor will tell you how to do it)
  • Wait
If heads of the project you selected find you good enough, you will get an unique (once in a lifetime!) opportunity to participate OPW.

X.org considered me good enough, that was such a big surprise.

To be honest, at first I wanted to participate GSoC and I haven't even knew about OPW. As this two programs are often compared, surfing the web about GSoC I found this poster:



As it was too early yet for GSoC I tried to participate OPW. There were 2 days left before the end of registration. I didn't know a bit about X11, except that it is related to window drawing in Linux. 
Great.
I thought I had no chances. But with support of honorable Christian Linhart, my mentor, I completed the task: to write a test case for fresh patch to XCB.

It was hard and it will be only harder, but if I complete this, I will be proud of myself as never before.
Join.

Sunday, December 7, 2014

Don't you ever maintain several projects at the same time

I'm currently a member of this projects:

  • IT company and Uni cooperation as a QA engineer of distributed server-client java game and this is hell. I'm not close with Java at all and also I had to learn SO MANY FRAMEWORKS, like osgi implementation called Apache Karaf, JUnit, Apache JMeter, Jenkins CI server, Mockito mocking framework and so on. RAPID LEARNING as it is. And so agile.
  • Another IT company and Uni cooperation program called Lab as a member of clipboard sharing crossplatform app. This required learning of network communication and TCP/IP stack and Qt.
  • Chair ordered me a huge and scary server-client web project to compute uni rating. Spring, DAO, Liquibase, MyBatis, REST, Javascript, tomcat and so on.
  • My operation systems course project. I cannot even describe, how complicated it is. bash generator, pure C89 code, graph search, fcntl. I wanted to make shared memory here, but I just have no time.
  • Social networks online correlations python script (I left it).
Too much. 
And Outreach Program start is soon. I'm so exited, but I'm too tired to write sth now. Wait for a post later, but before 9th December.

Don't you ever maintain several projects at the same time.
Never ever again.

P. S.
I just had my laboratory work done, overloading operators for huge class system. Why have I done this? This wasn't in the requirements. Because I JUST CAN'T KEEP IT SIMPLE. But you should.
P. P. S. And if someday you would find the idea of splitting to several task attrative, just remeber that
I ended up coding 24/7, sleeping less then 6 hours per day, losing advanced stipend at Uni, could not take a breath, most of time depressed or crying, procrastinating and having my head aching.