Category > Life

Professional Career

» 22 April 2013 » In Life, Programming, Web Development » No Comments

Few days from now, I will be starting my professional career. To be honest, I’m pretty much excited. I will be working for a big telecommunications company in my country, and I’ll probably do some web development related work during my stay. This is very new to me, and the work would probably require team-oriented skills, which I currently lack.

Expectations

There will be some training involved, so apparently, a bond of one or two years will be included in the contract which I will be signing soon. It’s pretty rough, but will surely be worth the experience I will be receiving.

About the salary, I’m really happy about it. It’s not far from my dream salary, but who cares, I’m still a fresh graduate. I ended up offered 200% more of what I expected. It’s pretty satisfying considering the amount of work I can offer back to the company. The taxes hurt though.

Professionalism

Being a freelancer since 2007, I’ve learned to interact with different kind of people. I can speak publicly well too, and I consider myself a capable leader. Interacting with my colleagues will surely be the hardest part. I’ve been on the solo-fly all my coding life, and I barely worked with people in the same level. To be honest, I’d rather write the codes myself. I know this is bad, so I gotta patch up somehow. Careers are meant to progress, it doesn’t stay at one point for a very long period of time.

Challenges

Attendance, is probably my greatest challenge. I’m known for my laziness, and tardiness. I set times and dates on my appointments and I still find my self late for at least an hour. Now, I think I need to wake up early enough that I will have extra time for coffee in the office. That’s pretty ideal, and I hope to execute it well.

Thinking outside the box will surely be a drag. Though I am capable of doing (well some may say ‘amazing’) things that will qualify, but I need to surpass the my limits everyday.

Next

It’s almost near. I’m expected to start on the first business day of May. As I’ve said, it’s pretty exciting. Cheers!

Continue reading...

Tags: , , , , ,

Mind and Motivation

» 02 April 2013 » In Life, News » No Comments

It’s rather easy to follow a patter of procrastination excuses than finish your simple task. That’s what I have realized just about the past moments of my life, all of it. It doesn’t quite satisfy me in the long run, but hey, i’ll be work free today.

This behavior is very unacceptable, especially in my age. I would rather have the work done on the spot, because if I decided to do it later, I’ll be forced to do it later than later and so on. It hurts my mind to think how many possible refreshing successes I could’ve gone through if it weren’t for this excuse.

This blog is fairly an example. Really, the last post before this one is dated July 2012. Because on that date, I told myself to have something posted day after day, and it seems my bad habit caught me up well.

Things that happened to me in the recent past got me thinking. I was down for three days because of fever, and tonsillitis. It seems ordinary, but after that, I have a feeling that I was refreshed. It took me a while to regain my strength. Thing is, whenever something has happened to me mentally and physiologically, I tend to change something for the better. It doesn’t quite happen every time. The very last time I had a strong fever was December 2010. Which in turn, changed me for the new year (2011).

I was reflecting the other day, and I need and will sort things out. Maybe remove some distractions, and get a good life going.

Continue reading...

Tags: , , , , ,

Extending SMS Capabilities

» 16 July 2012 » In C#, Life, Open-Source, Programming » 3 Comments

I live in a place where wireless access points are few, mobile internet is expensive, but SMS is unlimited. Of course, I use SMS for communicating with my friends, family, girlfriend, colleagues, and for business. Then, one day it came to my mind, why not communicate with my personal computer?

My father brought home a USB dongle (Huawei E220), I unlocked it, and tried a sim card, and it worked! Now this, is what my computer will be using as a receiver. At first, it’s very frustrating to install the drivers for this dongle. Modern ones are just smooth on PnP (Plug ‘n Play) features. It took me a while to find out that I need to reconfigure the driver Windows installed by default.

Setting Up

Now it’s connected. But I need a way to make it receive SMS, and save it somehow. Then I stumbled upon Gammu luckily, it supports E220(see all supported devices). The configuration file is given, and pretty elementary.

[gammu]
port = COM6
connection = at19200
model = at

You just need to replace COM6 with the COM port you have in your device manager.

Device Manager

COM Port used by the USB Dongle

And then, I intend to install gammu as a service. Luckily an SMS daemon is included, and using the previous gammu configuration:

[smsd]
logfile=C:\smsd\smsd.log
service=files
inboxpath=C:\SMSData\data\


[gammu]
port = COM6
connection = at19200
model = at

[include_numbers]
+000000000000

You can change the paths as you wish, but make sure your number is included in the [include_numbers] section. This is a nice feature that will block unwanted texts from other numbers.

Not that it’s all set, run the daemon and make it install itself as a service, then start the service.

gammu-smsd -i -c C:\smsd\gammu-smsdrc

It will now run automatically with windows. Your USB dongle must be connected all the time to your computer.

Processing Received Messages

Now here’s a tricky but fun part. How will you process the incoming messages? Notice that I used the Files mode instead of using DBMS to receive SMS message. This is because, I need to constantly check if there’s a new message, and checking the database tables every now and then for 24/7 is painful. So in files, we’re gonna use a Timer? No! Of course, we’re not using methods that will cause heavy CPU load.

Using the FileSystemWatcher class, we can check, in real-time, if there’s a new file created in a given directory. This is perfect, because gammu’s SMS daemon creates a new text file, with the message in it, in the specified directory we included in the configuration file.

if (!fpath.Equals(""))
    watcher.Path = fpath + @"\";

watcher.Filter = "*.txt";
watcher.NotifyFilter = NotifyFilters.LastWrite | NotifyFilters.FileName;
watcher.Created += new FileSystemEventHandler(OnChanged);
watcher.EnableRaisingEvents = listenToolStripMenuItem.Checked;

Whenever a file is created inside the specified directory, it will execute the code inside the OnChanged() method. From this, we can process the content of each file and read them.

But not so fast. Sadly(although this seems like a right way), gammu splits the messages by 67 characters. Meaning, if your message exceeds 67 characters, it will be split into several files. For instance:

IN20120716_121927_00_+000000000000_00.txt
IN20120716_121927_00_+000000000000_00.txt
IN20120716_121930_00_+000000000000_01.txt

These are files the dongle received at one point in time. But they really are just 2 separate messages. How? If you look into the last two digits on the filename, it will tell you the sequence of the messages. 00 means the beginning of the message, if followed by another 00, it’s a new message. But if it’s followed by 01, it’s to be appended, and must be read as part two of the first one.

It took me sometime to figure out how to combine them into one. I can only receive one at a time, but the parts came both together with a very tiny interval. By this, I came up with a solution that will use a Timer.

timer.Enabled = false;
timer.Interval = 1000;
timer.Tick += new EventHandler(timer_Tick);

I allotted two seconds to wait for upcoming possible parts, then process them and verify if they really are parts of a long message.

private void OnChanged(object sender, FileSystemEventArgs e)
{
    if (timer.Enabled)
    {
        tmp.Add(e.FullPath);
    }
    else
    {
        tmp = new List<string>();
        this.Invoke(new MethodInvoker(delegate
        {
            timer.Enabled = true;
            timer.Start();
        }));
        tmp.Add(e.FullPath);
    }            
}

private void timer_Tick(object sender, EventArgs e)
{
    secs++;
    if (secs >= 2)
    {
        timer.Enabled = false;
        secs = 0;
        procList(tmp);
    }
}

private void procList(List<string> lst)
{
    List<string> data = new List<string>();
    string xdata = "";
    bool app = true;
    int prev = -1;
    foreach (string fp in lst)
    {
        if (Regex.IsMatch(fp, @"_(d{2})\.txt$"))
        {
            Match m = Regex.Match(fp, @"_(d{2})\.txt$");
            int x = Int32.Parse(m.Groups[1].Value);
            if (x - prev != 1)
            {
                app = false;
                prev = -1;
            }
            else
            {
                prev = x;
            }
        }
        string datum = readContent(fp);
        if (app)
        {
            xdata += datum;
        }
        else
        {
            data.Add(xdata);
            xdata = datum;
        }
    }
    data.Add(xdata);
    foreach (string d in data)
    {
        processData(d);
    }
            
}

It’s a pretty long process, and it took me hours to figure out what to do. But after that, it’s time to add some modules to boost its functionality.

Making Things Functional

As for now, I only have the twitter module working.

private void processData(string data)
{
    Command cmd = parseString(data);

    switch (cmd.id)
    {
        case "tweet":
            tServ.SendTweet(cmd.arg);
            break;
        case "google":
            // Google processing here
            break;
    }
}

private Command parseString(string str)
{
    Command cmd = new Command();
    if (str.Contains(' '))
    {
        cmd.id = str.Split(' ').FirstOrDefault();
        cmd.arg = str.Remove(0, cmd.id.Length + 1);
    }
    return cmd;
}
// ... 
class Command
{
    public string id;
    public string arg;
}

I have plenty of ideas in mind. I am currently working on a google module, then a file-search module for my computer, and many more. In the mean time, you can watch the development process and add your own modules as well. Fork it in GitHub.

I will update if I have something new. Cheers!

I named this project after Parker, my favorite Leverage character.

Continue reading...

Tags: , , , , , ,

Building a Python Coding Environment in Windows

» 07 February 2011 » In Guides, Life, Programming, Python » 8 Comments

To be honest, my computer files are not organized. Yes, and you know what? Most of my scripts (Perl and Python) sits on one directory: C:\Perl64\scripts. And inside that directory, contains mixed files of Perl scripts, Python Scripts, output folders, text files, dictionaries, CSV files, etc. It’s sad that I can’t find the time motivation to organize my scripts.

Well, I came up with this pretty neat trick. I used it in Java, but for this post, I’ll be applying it in Python. I will place all of my Python scripts in my personal drive R:\ and under the folder R:\Python. Well, that sounds too simple doesn’t it? Let me expand the idea.

I’m on Windows, and yes I have ArchLinux on dual-boot, but I’ll apply this to Windows for now. One great reason why I love coding in Windows, is because I love Notepad++. Sadly, I’m not gifted with the ability to write code on Vim, or E-macs (I haven’t tried). And oh, my current Notepad++ style is Obsidian, and it’s just so comfortable to use.

Anyway, as I’ve mentioned, I’m on Windows. But for example I’m browsing on my favorite browser (Chrome), and I just had an idea for a neat, cool script. So I’ll fire up notepad++, change the language to Python, then fire up cmd, cd to my Python directory, and start to code (and debug). But wait, that sounds too long, well for me. It’s kind of boring that I have to do that repetitive process over and over again, every single day. Plus, the files is pretty much unorganized. What to do now? Well of course, hack it!

Now, let’s get back to the situation. Say I’m browsing the interwebs (with my favorite browser Chrome) and I got an idea for the script. I would normally open notepad++ first, but this time, I think it would be better to access the python directory first with cmd. The quickest way to access cmd, wherever you are, is by the Run Dialog (That’s Win+R for the noobs). Just type in cmd and you’re done. But I have to cd to my python directory, and re-enter the drive if it’s not on C:\, that’s 2 commands already! Now, we can fix this, and we need a script of course. For this one we can use a batch script. Now now, many people say that this is old school, but let’s face it, we’re on Windows.

@echo off
echo.
echo Time for some pure python awesomeness!
echo.
cmd /k "cd R:\Python && R:"

Save it with any filename you wish. For me, I saved it as pyc.bat in the Python bin folder (make the directory is included in your PATH directory), so I can just type pyc on the Run Dialog box.

We’re done on the cmd part, now for notepad++. For this, the script we’ll be using is a python script. And to start, create a new script located on the Python script folder.

#!/usr/bin/python

'''
	This script is used to create new (organized)
	Python scripts
'''

import os
import sys

def main(arg):
	fdir = arg
	arg += '.py'
	
	#Create directory for the script.
	os.mkdir(fdir)
	
	#Create the file inside the directory
	fo = open('%s\\%s' % (fdir, arg), 'w')
	#Change or add your own lines if you want.
	fo.write('#!/usr/bin/python')
	fo.close()
	
	#Open the script in Notepad++
	#If your notepad++ installation directory is different,
	#change it.
	notepad = '"C:\\Program Files (x86)\\Notepad++\\notepad++.exe" '
	os.system('%s%s\\%s' % (notepad, fdir, arg))
	os.system('cmd /k "cd "%s"' % fdir)
	
if __name__ == '__main__':
	main(sys.argv[1])

To use it, simple do something like:

R:\Python>new coolscript

And it will create a directory based on the parameter you passed, and a script inside it. And opens it in Notepad++, also it will make the cmd cd to the newly created directory. The only issue here is new.py is visible to the naked eye in the Python scripts folder. To hide the file, just do:

attrib +S +H +R new.py

And it will remain hidden (unless you chose to show system files in folder options). S means system, H means hidden, and R means read only.

TRIVIA: It’s how most malware hide themselves in Windows.

Now, we have a good, organized python coding environment in Windows. If you have any comments or suggestions, just drop a comment. Cheers!

Continue reading...

Tags: , , , ,

Travel to the Past

» 04 February 2011 » In Life » No Comments

We all love the concept of time travel, and scientifically, I do believe in time travel. But, only to the future. As stated on the Grandfather Paradox, time travel to the past seems impossible. And based on the Twin Paradox, time travel to the future seems possible. Well, last night, I was given a chance to travel to the past.

It was one of the weirdest dreams I had lately. Started when I was walking on my way to school, I closed my eyes. The moment I opened it, I was in the classroom, with my classmates, but all were complete strangers to one another, except me. I realized I somehow traveled to the past, to the date of our first day in college (in LPU). I started talking to my classmates, saying I was from the future, and I don’t have an idea how I got here. I proved it by saying details about each one of them. And I can’t describe their faces.

On that very moment, I woke up. I was shocked because I thought the whole thing was real (happens every time to me). It kept me awake for 30 mins, starting from 4:00AM in the morning. I was literally staring at the ceiling, and it made me think.

What if that really happened?

If that really happened, I think I have the chance to make things right, not only for myself, but for the whole world. It sounds sill isn’t it? But really, there are a lot of things that happened from June 2009 up to this time, and all those things can be changed. But the fear of making things worse entered in my head. There are a lot of people died, in my country for example: the massacre in Maguindanao, hostage crisis, vehicular accidents, huge storms. The IPv4 depletion, Egypt Revolution. I believe I can change all of those. But yeah, when the time I publicly announce those events, it may trigger a change, and two things can happen. Something better, and something worse.

This dream taught me, that everything that happened, good or bad, was part of God’s plan. And it always lead to something better. We may not be satisfied what our eyes tell us right now. And all we need is to trust the Lord, and his word.

Continue reading...

Tags: , , , ,

Victories, and Beyond

» 25 January 2011 » In C/C++, Life, Programming » 1 Comment

This time, I will be less technical. No, actually ignore the first sentence. I’ve been coding since 2007, and C was my first language. I use Turbo C back then, and it was a pretty cool compiler back then. It’s now an antique, and you can download it here.

As I was saying, I can still remember the things I’ve been coding in Turbo C. I had that Pythagorean solver, which I posted in planet-source-code. I was so proud, and I even created a general mathematical solver, for a bigger one. Oh, and do you know that I tYpE LiKe tHiS bEfoRe?. Anyway, why am I saying all this stuff? Actually I was just refreshing my memory of what I am before, and comparing it on what I am now.

For the times that have passed, coding became an art for me. It sounds silly, but true. I can safely say I’ve done more than 100 usable programs and scripts just to fulfill my hobby. I used to code for automation, and exploitation. Nobody in my family knows what I’m doing. All they can see, is me, looking at a computer screen for an average of 16+ hours a day. I never felt boredom in coding, as boredom comes when you’re out of ideas on what to code. My ideas are hard to implement. Sometimes thoughts have been passing though my brain in countless numbers of times.

So what did I do to be, here? Almost 4 years of programming experience, I never kept track of myself. Though I somewhat became a little boastful, it has changed. August, last year, I wiped out my old HDD, desperately (see my other post). Alongside with that, is the memories, and codes of my past. So basically I never got to see those stuff again, ever. On the good side, change.

Change is inevitable, this is what I hear from others. I usually, don’t care, but now it’s the opposite. Simple things change, and these leads to greater changes. And you know what? Learning a new language, changes me. When I’m introduced to C++, I was discouraged by a friend in UK. Thinking the iostream library is a bloat, I embraced the C Standard Library. Until one day, I just realized I need to go for C++.

C++ is the superset of C, and as I became open to the object oriented environment, I became open to a new environment in real life as well. Though, I do not wish to put things in detail, I can simply say that this is one of the most remarkable changes in me. And praise God for that.

Few hours ago (January 25, 2010), I won a regional C++ programming competition. Before the awarding, I was shaking because of the cold air + the excitement I felt. This, is what I can call “Victory”. And even if I lose, it still is a victorious fight. I was very grateful for what God has made me. I started this year with a brand new prayer life. And these victories I’ve been experiencing, is a way of God telling me.. “There’s more..“.

It’s not only victories that I should prepare for, failures and discouragements will arise. But, faith will still remain. And if I fall, I fall forward, plus, God will catch me. God bless.

Continue reading...

Tags: , , , , ,