Tuesday, July 30, 2013

Bon Appetit!

If there's one thing aside from laughing at ourselves (and our troubles) that would be our trademark as being Filipino, it would be eating. We celebrate each happy occasion with food, just as we also punctuate sad moments with eating. There's a sense of camaraderie and oneness with everyone present whenever you share a meal. So, whenever friends and family come together, no doubt, the Pinoy table would be groaning heavy with all our favorite dishes!

images from "It's More Fun in the Philippines" Tourism Video Ad


Well, the Ingen-eers, as Filipino as one can be, also love their noms. Birthdays, parties, outings, and even random get togethers, the team always celebrates with food.



These two pictures were taken last week.

It was a 2-day fest of lunch- and dinner-outs because we were celebrating various small victories. Lunch on Wednesday was at Primo Grill & Cafe, a restaurant that serves grilled meats and other American-ish dishes. Then on Friday of the same week, dinner was at Italianni's AND TGIFriday's.

The guys had a wonderful time stuffing their faces and sharing fun highlights of their week.
Look at everybody ignoring the camera while they chow away.



It's always good to spend time with teammates outside of the four walls of the office to let out a little steam and to forge deeper friendships among each other. And doing all of that with food only makes it a happier occasion.

Noshing seriously makes us so happy that we've decided to do it as often as we could like every month we'd dine out as a team and stuff. This is because we believe in the great saying that goes, “There is no love sincerer than the love of food.” ―ain't nobody gonna argue with that, George Bernard Shaw. :)

Click here and here for more pix of us stuffing our faces. :D

Monday, July 22, 2013

Pisay Fun Run 2013

Last July 7, the Ingenuity Team took part in the Pisay Run 2013. Takbo, Isko, Takbo is a fun run organized by Pisay alumni in line with the celebration of the 25th Foundation Anniversary of the Philippine Science High School Southern Mindanao Campus which was founded in 1988.

**For those who don't know, Philippine Science High School (PhilSci = Pisay) caters to scientifically- and mathematically-gifted highschoolers all over the Philippines. The institution has insane admission exams that weeds out the wannabees from the real deal.

An alumnus of the school, our CEO John was also a sponsor of the event.

The more sporty members of the team came out in full force to join the early morning run. Here they are fresh-faced and rearing to go!



The Ingenuity "First Family" was also in attendance, with Kyle (John's eldest) who is now in his first year studying at Pisay. Mommy Jaja is also a Pisay alumna; so you can say it really is in the genes. :)



Everybody gamely joins in the early morning, pre-run calesthenics/warm-up. Check out Pat's spirit fingers! And JC discreetly checking out the competition.



And goofing off before the gun start. Sonito's pits are the shizz! And JC still sizing up the other runners.



And there they go...





Needless to say, everyone had a grand time. Even this guy, even if he was wearing neon orange tights and a crazy wig in summer-like temperatures!

Congratulations to Pisay and Happy Anniversary! :)
And to everyone, see you all at the next race!

Click here for more pix!

OpenERP XMLRPC Essentials

OVERVIEW



Technology Used:
- OpenERP
- Django Framework 1.5
- xmlrpclib

PROBLEM



Task:
- Create an attendance user interface.

Problem:
- Difficulty in getting desired layout of the kiosk using.

SOLUTION



What:
- Create a Django instance for the kiosk and use XMLRPC as a Protocol for data synchronization between the Django instance and the OpenERP instance.

Why:
- To easily implement the layout desired for the kiosk, since Django's templating engine is far easier to manipulate.

How:
- Using the builtin python module to fetch the data, process it within the django kiosk.
- Also, since the OpenERP xmlrpc module also have a submit method flow, the django kiosk can still use the python module xmlrpclib to send data to the OpenERP server.
xmlrpclib

To start off, here are the necessary variables to establish an XMLRPC connection:
server_url = "http://your.open-instance.com"
dbname = "YOUR_OpenERP_DATABASE"
username = "admin" #Must be admin user
password = "Y3AH!"

Next, here is a basic example of fetching data from an OpenERP server instance:
sock = xmlrpclib.ServerProxy(server_url + 'xmlrpc/common')
uid = sock.login(dbname, username, password)
sock = xmlrpclib.ServerProxy(server_url + 'xmlrpc/object')

sock.execute(dbname,uid,password,model,'search',criteria)

The xmlrpc ServerProxy execute() method returns a list of dictionaries (yes it's automatically converted from xml format). Now you can easily iterate over the result object and handle it the way you want it.

Now, here's how you send data.
model = 'some_model'
data = { 'key': value, 'another_key': another_value }
id = sock._sock.execute(dbname,uid,password,model,'create',data )
return id #openerp model instance id


And that's it! That's essentially how OpenERP's xmlrpc transactions are done.

For a deper look into the methods and example usage in other programming languages, checkout their documentation at https://doc.openerp.com/6.0/developer/6_22_XML-RPC_web_services/.
And for advanced usage of the python xmlrpclib, handling Fault objects and multi calls, checkout their documentation at http://docs.python.org/2/library/xmlrpclib.html

Wednesday, July 17, 2013

Django Models: Using Different Fields as a Single Field for Sorting


   Given a django model such that:

    a.) any instance could only have a single 'value'
    b.) this 'value' could be any model field (or type, say IntegerField, CharField, DateField)
    b.) and these 'values' will be used as basis for sorting.

How to:

I would assume someone who reads this know the basics of Django ORM. So..

    1.) First create a model and add the fields (where the 'value' will be saved), and don't forget to add 'null=True' and 'blank=True' appropriately (i.e. 'null=True' for IntegerField, 'null=True, blank=True' for CharField). An instance could have all these fields blank, or save a 'value' in only one of them since an instance COULD and SHOULD only have a single 'value';

    2.) Then, create methods that subscribe to the given conditions, such as a save method that can process input to select and save the 'value' in the appropriate field, and another method to fetch 'values' no matter which field they are stored. This would ensure that 'values' are stored and retrieved correctly.

    3.) Lastly, there's this question.. How do we create and order a query set with the restriction of using 'values', given that it is NOT a single database field?

For this, we can utilize the 'extra' method. For example, in MySQL we could do it as:

            q = MyModel.objects.extra(select={values': 'COALESCE(int_field, char_field, date_field)'})
            q = q.extra(order_by = ['values'])

So there we have it! We have a query set which we can process further using method chaining and slicing. We can even use it in django admin for sorting in the list display. Just customize/override the returned change list object (if  you are familiar with it) before it gets displayed.

More on the 'extra' query here

Monday, July 8, 2013

Python Code Camp: Taming the Snake Part 1

Ingenuity has partnered with Developers Connect Philippines (DevCon) to produce a series of seminars that aim to teach participants the hottest and most sought-after programming language to emerge in recent years: Python.

For those not in the know, DevCon is a non-profit organization that aims to promote Pinoy talent in the IT field by providing unique venues for students, educators, professionals, and enthusiasts to improve, innovate, and update their interests so that they could "sync, support, and succeed."


DevCon Davao Team with Freelance.com's 
Country Manager Jorge Azurin, one of the event's speakers


Taming the Snake (Part 1) is part of a series of trainings, workshops, and seminars that DevCon Davao will produce with the help of industry partner Ingenuity. We provided them with 4 speakers - elite members of our own coding pool - that would teach and mentor the participants.

Ronil Rufo
Learning Python I - Getting Python
Learning Python II - Basic Language constructs


Pat Tan
Learning Python III - Native Data Types


Joseph Lafuente -
Learning Python IV - Files and File Handling
Learning Python V - Defining Functions


Jan Chua -
Learning Python VI - OOP in Python


There were a lot of participants, mostly fresh graduates of Computer Science and Information Technology from various colleges and universities here in Davao City, and who are looking to update their technical skills and know-how. A few were also Davao-based developers, and a handful were eager-to-learn college students.



After the lecture and workshop, there was a mini-hackathon that the mentors prepared to test how much the participants learned from the whole day activity. The winners were given prizes and loot from the sponsors. 

This first leg of the code camp happened last May 18, the next leg would be on July 27, 2013. Check DevCon's and Ingenuity's respective FB pages for updates on this. We hope you all could come join!

See you all there!

For pix: click here and here

Thursday, July 4, 2013

Carve Pro Training Series: #1 - Taking Back Gold

Ingenuity has always believed that non-technical trainings are as important as technical ones because these trainings focus on self-improvement that lead to better working relationships. These trainings also aim to make each and every one of us better workers and ultimately, better people.

In the past, trainings of this nature are done by in-house personnel. This time, we are partnered with Carve Professional Services. They are also a start-up company (like us) that provides marketing, training, and consulting services, and because they are still a small operation, the approach is more intimate and focused.




The first of a series of trainings to be provided by Carve Pro is titled "Taking Back Gold" - a Time Management module consisting of frameworks, activities, and tools that make us understand how we spend time each day and which things should be prioritized more than others.


The Ingenuity team really had fun listening in to Tom, Carve Pro's resident Visionary Captain and Head Trainer. The training is updated, interactive, and fast-paced - characteristics that are badly needed when confronted with a horde of highly-intellectual younglings who spend a good part of each day in front of computers.



Even when it was a serious training, the team still had fun because of the activities prepared by Tom and Joel of Carve Pro. The activities sparked some healthy competition among the guys.



It's so fun, the team is looking forward to more training sessions.

In the meantime, let me leave you with the link so you could check out the rest of the photos!

Wednesday, July 3, 2013

Quarterly Beach Outing - Playa Azalea

 

Last summer's beach outing took us to Playa Azalea, a beach club exclusive for its members and their guests.  The resort is situated in Samal, an island city just 10 minutes across the water from Davao. The team, with the interns in tow, went for a much needed R&R. 

 
That is one of the many perks of living here in Davao City - you are just a stone's throw away from the sparkling azure of a tropical sea, with playful mild breezes that scent the air with salt, a happy, sunny sky, and the lulling music of palm fronds swaying in the wind.




As we all love to eat, a smorgasbord of Pinoy beach fare was prepared by our helpful assistants; led by our very own superman Marlon.

Of course, the ever-present Edgar's lechon is always a crowd favorite.


We all lounged in our cabanas around the pool, playing crazy games, shooting the breeze, drinking ice cold beer to dissipate the summer heat, and swimming to our hearts' content.






All of us are truly blessed to have year-round summers and a tropical vibe. It makes all the stress from working day in and day out disappear.

How about you, can you tell us what you did last summer?

More pix after the jump!


Tuesday, July 2, 2013

OpenERP - Importing logs from API site

Overview:

OpenERP is an open source enterprise resource planning (ERP) software alternative to SAP, Microsoft Dynamics, Netsuite, Adempiere, Compiere, OFBiz, OpenBravo and other resource planning software.

Assembla and Redmine are online project management tools that help projects done faster. It helps you manage schedule, organize plans, collaboration and many more.

TASK: Import logs from Assembla and Redmine using REST API and PyActiveResource.

Installation:
PyActiveResource:
$ pip install pyactiveresource

Assembla:

$ pip install assembla

Basic example: Assembla
from assembla import API
     assembla = API(
                    key='FHKbGNeDo8lpO2qwM1Bs',
                    secret='X8xPwmyfHYVJqD7ZBvUdazT6G1I3LnQSRjlurOoK'
                    )
# You can view your API Key and Secret from https://www.assembla.com/user/edit/manage_clients

spaces = assembla.spaces()
for space in spaces:
     # Integrate ActiveResource
     class TimeEntry(ActiveResource):
          _plural = 'time_entries'                    
          _site = 'https://www.assembla.com/spaces/%s/' % space['name']
          _user = 'my_username'
          _password = 'my_password'
                                                                                              
     time_entries = TimeEntry.find()               
     for log in time_entries:
          daily_log.append(log.to_dict())

return daily_log