This is a test post
This is a test post
I have been always fascinated about the design of UNIX. I am still curious and enjoy the philosophy and the idea of ‘Write programs that do one thing and do it well’. Aim of this blog post is to walk through some interesting aspects on implementation of file descriptors and to illustrate how gracefully that design helps to build interesting unix shell methodologies. For any process, there are three default file descriptors. Stdin – with descriptor number 0, Stdout – with descriptor number 1 and Stderr with descriptor number 2.
Let us go through some basic system calls. All the system calls explained below are not exact syntax. Please refer man for correct function prototype.
The fork system call creates another copy of current process and mark the new process as child of parent process which called fork. This system call returns zero in the child process and return child’s pid in the parent process. It copies everything including file descriptors, and virtual memory. If a process tries to write any virtual memory page, it will do a copy on write to create copy of that particular page for that process space.
The exec system call overwrites the current process with executable image from a file. Eg. if you run exec(“/bin/ls”). It will overwrite the memory code image with binary from /bin/ls and execute. The file descriptor table remains the same as that of original process.
3. open(file, mode)
Opens a file and creates a file descriptor associated with the file.
IMPORTANT: By design, when the kernel allocates a file descriptor, it will create the fd with next smallest available file descriptor number.
Closes the open file descriptor
The dup system call creates a file descriptor that is duplicate of given fd passed as argument.
6. pipe(int arr)
Creates a pipe, and stores the read descriptor in array location zero and write descriptor in array location one.
7. read(fd, buff, len)
Reads len bytes to buff from file descriptor fd.
8. write(fd, buff, len)
Writes len bytes from buff to file descriptor fd.
Let us go through some interesting shell features that we use frequently and look at their implementations.
$ cmd1 > stdout.txt
The above command redirects stdout to file stdout.txt
For implementing the above operation, we should be able to link stdout of cmd1 with file descriptor of stdout.txt opened with write mode.
Let us look at the code.
$ cmd1 2> stdout.txt
The above command redirects stderr to file stdout.txt
$ cmd2 > stdout_stderr.txt 2>&1
The above command redirects both stdout and stderr to file stdout_stderr.txt
$ cmd3 < input.txt
The above command redirects data from input.txt to stdin for cmd3.
$ cmd1 | cmd2
This command says that cmd2 will receive stdin from stdout of cmd1.
Aren’t you feeling awesome?
With simple design, without making any code change to individual programs, it is possible to connect input and output streams to individual programs. Hats off to designers of UNIX.
Many thanks to Yasin Aydın for translating this blog entry to English.
For me, everything started with a chain of coincidences..
First Meeting and Internship Application (January 2007 – April 2007)
At first I decided to go abroad for Erasmus Exchange Programme. After that, I forced my school to make an agreement with the school I want to go. In January 2007, I went to Grenoble city of France. I started my lessons and saw that everyone is using Linux, even in the classes and the laboratories. I got back home, installed Pardus 2007 to my laptop. For 6 months, I used Pardus 2007 for all everything except the times I needed Skype.
One night, when I was thinking in bed before the sleep, I thought “I wish I had a chance to have an internship in Pardus Project”. In a few days after that night, I learned that Pardus was looking for interns for the first time ever. I was excited, indeed. One one hand I wanted it so much, but on the other hand I was thinking that I won’t have a chance to be accepted because I didn’t have enough Linux experience at the moment. So far, my only experience was about reporting a few bugs, that’s all.
In the end, without losing any more time, I applied for the position with my CV and a cover letter (March 29, 2007):
Dear Pardus Team,
First, let me tell you about myself. I am a 3rd grade student in Galatasaray University, studying Computer Engineering. As a result of my Erasmus Exchange application I did last year, I am studying in Grenoble, France since January 2007. I will come back to Istanbul in June 2007, after this exchange program ends and I will have my internship period for 2 months.
Since I was born, I was always in a relationship with computers and I am happy with that and I still have the excitement I had first day. With this agitation, I decided to have my undergraduate degree on computers. I am interested in every subject about computers and electronics. But I have more interest in electronical design of the computer, processor organization, operating system design and signal processing areas. I agree that I cannot say I have incredible knowledge on these subjects but these are the topics I am having an extreme joy.
I have been using Linux since 2004. In the first year in the university, I started following the lectures given by GSULinux and by the end of the year I was accepted to the Staff group. This is the way I got into the UNIX world I was wondering about since my high-school years, in a laid-back but curious manner. I can say that I have gained a lot of hands-on experience with my attempts to install Gentoo operating system. Other than that, I am somewhat using C programming language since 2003 and I am proud of this.
Long story short, I want to pass my internship period in Pardus team, because for I would be so happy if I can be of any help for the operating system which is on my laptop for 2 months. I feel that this operating system which I am proud even when I am using will be a pride of my country in the future. I had my last year internship in the optoelectronics lab in TUBITAK/UEKAE, so I am familiar with around. Unfortunately, I don’t have any experience with Python at all. I only had a quick look last year but because I didn’t practice it since then, I don’t remember anything at all. I never developed a GUI using QT. I don’t think learning this will take a lot of time, and I am thinking about working and testing it if I can find some time. Below I am writing the projects I choosed amongst internship projects. Amongst all of them, without the concern of their difficulties and required knowledge levels, the ones which interest me are:
- Migration tool
- Proxy settings interface
- Package building tool
- Support for adding other Linux distros to the GRUB menu
- Graphical configuration interface
My CV is attached. The official length of my internship is 2 months (40 work days) and I can do it in any timeline between July and September 2007. Yours sincerely. Have a nice day.
A personal reply (Turkish screenshot) from Koray Löker arrived on 24 April 2007:
(The detailed Turkish blog entry by A.Murat Eren is also worth reading.)
Intership (July 2007 – August 2007)
After I started my internship the thing I realized is the presence of interns who know about Pardus and Linux more than me and who already met with the Pardus Team. I worked on developing a XMLRPC-based communication layer to the buildfarm. Most of the time we were working with Ekin Meroğlu and S.Çağlar Onur, I was going to their desks, asking some questions, taking notes for the answers, getting back to the internship office and trying to do some work.
The internship period was fast, I learned many things, I have visited the tomb of Anibal, met many precious people, had fun.. And, on September 11 2007, Çağlar asked me “Do you want to work with us part-time?”. It was also interesting that this offer was on my birthday. I accepted it.
Part-time Contribution (October 2007 – August 2008)
Between October 2007 and June 2008 I supported the project part-time. I was working in automatic printer discovery infrastructure in my spare times. We first added this feature in Pardus 2008 which helped users a lot. With me, Gökçen Eraslan started working full-time, while Fatih Aşıcı started part-time.
When my part-time work was overlapping with my last year in my university, I couldn’t have enough time for Pardus. When I came back to the office after completing my thesis and graduating in June 2008, I had a conversation with Erkan Tekman, about “I want to do something academic, I’m planning to study in a graduate programme, and because I was spending most of my time about my thesis, the relation between Pardus and me grown apart.”, but he convinced me to stay in the project and also told me that I can have my graduate studies within my 1-day academic permission. So in August 2008, I started working in the project full-time.
Full Time Contribution (August 2008 – January 2012)
I have become a full-time developer in August 2008. At the same time, I started my graduate studies in Boğaziçi University Biomedical Engineering. But because of some personal and timetable issues, I realized that studies and work won’t go together at the same time, I left the university.
Gürer Özen, İsmail Dönmez and S.Çağlar Onur, the people that I couldn’t find enough time to develop together when I was working as an intern and a part-timer, left the project. After Çağlar’s departure, I found myself maintaining the kernel package. When I took the responsibility of the kernel package and kernel drivers, Pardus 2008 was being actively developed and we were using 2.6.25 series kernel.
In November 2008, I upgraded the kernel to 188.8.131.52 and with the patches I borrowed from SUSE, I added UDF support to the kernel. That was my first update to the kernel package.
Afterwards, we published Pardus 2009 with 2.6.31 series. With the Pardus Corporate 2, we first used 2.6.32 series, then we upgraded to 2.6.35 series. In Pardus 2011, we used kernels 2.6.36 and 2.6.37.
Besides the kernel and driver maintenance, I started moving the packages that were waiting in the devel repository to the 2008-stable repository. I learned what a patch really is, I fixed build errors, I upgraded packages, etc. This period educated me so well about package maintenance.
After a while, I’ve taken the printer packages from Onur Küçük. Other than that, I’ve also taken the responsibility for some basic libraries, scanner support, sound stack, Bluetooth stack, HAL, udev, wired/wireless network framework, etc.. Now it seems that I am the maintainer of 425 different packages in 2011 stable repository.
Meanwhile, I also am looking to our bug tracking system and see that I had 586 tickets assigned to me which are closed as FIXED. Of course it is an estimated value, there may also be the ones which are labeled as FIXED by mistake, and are assigned to me but resolved by someone else. However this number gives an estimate about how much I participated in this project.
Pardus Corporate 2
On the 10th of december 2009, as announced in developers mailing list by Project Manager Erkan Tekman, I became temporary release manager for Pardus Corporate 2. This release which was actually started with the managership of Ekin, was temporarily transferred to me because of Ekin’s short-term departure from the project for his military service. When Ekin came back from his military service and assigned as contractual projects manager, the release was given over me for real.
We have worked a lot for the Pardus Corporate 2 which was using KDE desktop environment’s not-taken-cared-anymore but stable and fast 3.5 series. I cannot say that there were no delays on the release schedule but all these delays were because to improve the final product in a better way. We tried to reflect the factors that should exist in a corporate edition as our power and skills were enough. And in the end, we published Pardus Corporate 2 in February 2011.
The interest for the product inside TUBITAK was also a lot. To improve AKIS, which was a smart-card operating system developed by TUBITAK, we worked together with the AKIS team and provided a very comprehensive AKIS support in Pardus Corporate 2 and we have presented it.
Again we tried to complete the requests from projects like EPDK and SKAAS. We worked together with these teams and we supported each other.
So, what happened then?
As specified in the issue (Turkish) on 28th of August 2011 in the local newspaper Milliyet, a new nomination operation occured with a decree law (which regulates reconstruction in the community institutions) and TUBITAK president Nükhet Yetiş is removed from the position. A few days later, Önder Yetiş, the president of BİLGEM quit.
Of course, I will not talk about politics in this last article of mine. The readers of this article will interpret this reconstruction process which started on August 2011, with their own perceptions and interpretations.
This period of reconstruction which has been continuing for the past 5 months was a giant avalanche, destroying TUBITAK. There are many researchers, managers, projects and units which are affected by this avalanche, and there are also ones which are not affected at all.
Pardus Project was never honored as expected, in FATİH Project (It is a huge educational project funded by the government which consists of putting interactive whiteboards in the classes, giving special educational tablets to the students, etc.) The cabinet ministers of the government used funny and ignorant sentences like “There is an operating system called Pardus which TUBITAK developed.”
When there was no hope at all for the inclusion of Pardus in FATİH Project, in October 2011 Pardus Project was migrated from UEKAE to BTE and renamed as “Pardus for Fatih”. And we said: perhaps?
After a few days, a highly ranked manager had an unprofessional speech as “Microsoft decreased the license prices by 5TL/computer and the minister of transportation already told me that the project will be given to Microsoft”, in front of the institute employees.
Another day, we also heard that people were very thankful to Pardus because it was fighting hard against Microsoft, in Fatih Project!
Consequently, I realized that renaming Pardus into “Pardus for Fatih” is nothing but a distraction.
We also have witnessed that researchers who we know, respect, doing their job good were being demoted and assigned to lower-level tasks. Media and outer world was and could be never aware of what’s going on inside.
In this reconstruction process, my faith for this period will work out good for Pardus was so low, and that little remaining faith was completely destroyed by some meetings I have attended and some new people I have met. So I decided to go on as much as I can and in the meantime, to take care of the remaining issues as I can. I published a stable update for Pardus Corporate 2, upgraded the kernel to 3.2 in my playground, fixed some of the reported bugs. Just in case for a new version plan, I prepared packages for new Linux technologies like systemd, dracut, kmod in my playground. At the same time I continued to take care of the projects and exams about my graduate education.
On 29th of December 2011, I learned that I was reassigned to Ankara for a month.
I was hired for Pardus Project in October 2007 and I was not a subcontracted worker who will work between institutions and projects. And also to think that the upper mananagement was aware of my finals and academic schedule, the goodwill of this reassignment was very questionable.
I said, this is it, and I resigned from this destroyed institution.
And now what?
Now 14 people are working in the project which 11 of them are developers. TUBITAK soon will organize a workshop about the future of Pardus Project. I, who never thought I would be even invited to this workshop, think that this workshop will be destructive more than constructive. I hope I will be wrong.
Is there another distribution project?
I am still using Pardus 2011 at home and believe that Pardus has many advantages against other distributions, is more user-friendly and PiSi package management is successful enough and practical. For this reason, I want to continue Pardus by myself or with other people’s helps, under a new name. I even have a copy of the some part of the Pardus 2011 source repository in a GIT repository I created on GitHub. I sometimes commit my changes I do but there is only a little bit of progression for now, not even close to be a product itself.
But wanting is not the only key to it. Even though I say I want it so much, my graduate study and a possible new work-life will considerably decrease my possible contribution to this new project. For this reason, I want to think more about this and talk about it afterwards.
First, I would like to thank my awesome manager Erkan Tekman for everything he made an effort, defended and targeted,
And to my friends I could remember, who worked for Pardus Project under TUBITAK, in chronological order:
Gürer Özen, Barış Metin, A. Murat Eren, Barış Metin, Faik Uygur, Onur Küçük, Ekin Meroğlu, S. Çağlar Onur, İsmail Dönmez, Görkem Çetin, Umut Pulat, Koray Löker, Bahadır Kandemir, Gökmen Göksel, Gökçen Eraslan, Fatih Aşıcı, Pınar Yanardağ, Taner Taş, Serbülent Ünsal, Ali Ulvi Tunç, Işıl Poyraz, Semen Cirit, Renan Çakırerk, Serdar Dalgıç, İbrahim Güngör, Eren Türkay, Erdem Bayer, Akın Ömeroğlu, Mete Alpaslan, Fatih Arslan, Meltem Parmaksız, Metin Akdere, Mete Bilgin, Mehmet Emre Atasever, Yasemin Yiğit Kuru, Hakan Şimşek, Uğur Eke, Gökhan Özbulak, Nihan Katipoğlu, Beyza Ermiş, Çağlar Kilimci, Mehmet Özdemir, Bertan Gündoğdu, Kaan Özdinçer, Pamir Talazan,
and also, to the people who worked or are still working in TUBITAK for different projects; Seda Polat, Fehime Bıyıklıoğlu and Özmen Emre Demirkol,
to ÇOMÜ and Necdet Yücel for the 64-bit support,
to the people from Artistanbul team; Ali Işıngör, Seda Akay, Gizem Belen, İrem Çobanoğlu, Uğur Çetin and everyone else that I didn’t have the occasion the meet personally,
to the creators and managers of Özgürlükİçin,
to the all Pardus users and communities which always supported and helped us,
and finally, to Önder Yetiş and our old management, which now I could understand better that they always helped us to go further and supported us as they can.
It has been a long time since i wrote a blog entry. Here is some interesting piece for final year computer science students.
Getting a job is one of the happiest things in the life of a final year guy. I also had such wonderful moments during my final year. I would like to share some bytes of info that can help you out.
University/College studies and your first job
In the long four years of engineering course, you study a lot of things. Lot of junk and little good. In reality very few subjects really help and are useful for a computer science job. For getting a job, you will need even fewer set of subjects among them. Hence, finding a job is easy. But you have to master the subjects that you love. I will list out the few subjects that will help you find a job.
Data structures, Algorithms and Analysis, Operating Systems, Computer Networks, C Programming, Object Oriented Programming, Database Management systems, Compilers (Optional), Distributed Computing (Optional), Microprocessors (Optional)
The perspective of current education system and the industry goals diverge very much. In colleges, we study for obtaining some marks. The teachers also have the goal to help their students to obtain marks rather than learning something that may help gain the ability to solve computer science programs using their skillsets. In industry, the ultimate goal is to produce good quality software within short span of time. That means, the skill requirements are good coding skills, ability to understand and solve problems algorithmically with analysis to validate and come up with optimal and practical solution. To grow up as a software engineer that meets the industry requirements, the education system at college fails.
You have to put good self effort to gain the skillsets and the passion for learning. You should have good coding skills with proficiency in one or more programming languages, understanding of standard algorithm techniques at basic level. Let us have a run through objectives during preparation for a job.
Preparing your CV
Curriculum Vitae is important while applying for a job. Your CV is a blueprint of your personality. It is the first phase during a recruitment that gives the recruiters an overall view of your skillset and your background. Hence, it is worth to spend few days in preparing your CV. Note the following things while preparing your CV.
Use a different layout from other candidates who are applying for job along with you. Make yourself different from others. Write a career objective that states your interest. If you are applying for a specific role, Write a highlights section as the first section in your CV. Highlights should list out important achievements and your skillsets in bullets. This section is indented for HR who screens your resume. The next section can be ‘Skills’, which lists out your skill sets and programming languages. Write in an order separated by commas such that less proficient technologies should come last. You should also mention the operating systems you are familiar with. The next section can be Achievements. But you can move this section to the end of the resume if you think that you do not have considerable good technical achievements for highlighting. The next section should be Projects. This is the most important section in your resume. You should spend some time in writing this section. You should specify the title of the project, duration (optional), the technologies used, a summary of the project describing the project in few words, and project highlights section. The project highlight section should list key features about your project listed as bullets. Write them in an impressive manner stating the facts properly.
1. Implemented a H.263 video streaming library for android 2.3
2. Implemented video frames collector and device mapper that converts video stream to v4l linux device
3. Tested on Android 2.3 and found that 25 % performance improvement than the bundled video library
If you have lot of numbers to showcase the benchmarking or awesomeness of your project. that is great. If your project bagged some awards or deployed for some good numbers of users, mention that figures and achievements in the highlights.
I would prefer to order the project in the order of significance rather than chronological order. After the project section, have an achievements section which lists all technical and non-technical achievements. You can split your achievements section into subsections like publications, events, etc. Write the educational background section as the last section of your resume. Because it is the most insignificant portion of a resume if you are looking for a good computer science job. It states few figures that indicate your marks which is not an indicator of your knowledge.
Tips for interview preparation
You should acquire sound knowledge about few of the subjects listed in the earlier section of this article. Usually recruitment process consists of a written test paper followed by a couple of interviews. Focus of your preparation should be based on the job position you are applying for. If you are preparing for a developer interview, you should be sound with Data Structures and Algorithms. You might be bored with the subject since you attended some boring series of lectures from colleges to grab marks. Try again approaching the subject in a different manner. You will definitely enjoy it. Start reading the book ‘Programming Pearls’ before you start preparing. It will give you a wonderful insight you never had before. I will focus on developer interviews.
Companies usually ask some technical aptitude questions, puzzles and questions from the subjects along with the test paper. Most of the questions will be repeated. Search for programmer interview aptitude questions and brain teasers for programmers on Google. You will find a good list. Try to solve them. Learning algorithms are not hard. But understanding the use cases and ability to apply them to solve problems require some effort and practice. Whenever you learn an algorithm, try to implement it using a programming language. For practicing algorithms to coding, you should use some highly object oriented and simple languages. The best language you can learn is python. You can practice coding algorithms with Python without any implementation complexity and it will look like a pseudo code. Learn python today. Seriously it won’t take more than a day to learn things that you will require to implement algorithms. C is a great language. Implementing certain Data structures or algorithms in C gives you a good experience to code well in C. I will write some notes on few algorithms that you should try implement in C. Algorithm analysis for important algorithms should be understood. You should know the worst case complexity (Find out the worst cases in the case of a particular algorithm), Best Case complexity (Also the best case) and the average case complexity (Also the average case example). Space complexity of the algorithm should be known in order to select the best algorithm according to problem environment.
Data Structures and Algorithms
This is a very important algorithm you can apply at many different problem environments you never expect.
Understand the runtime complexity for the Binary Search and understand how to derive the complexity from algorithm. Note that it can be applied for only sorted lists. Learn how to apply Binary Search in a Rotated Sorted List by using recursion and how the algorithm complexity varies. Implement Binary Search using C for a list of strings. You should familiarize the terms in place sorting, stable sorting and also should understand which sorts come into these categories.
Understand the algorithm and derivation of algorithm analysis. Compare it with Card game in which we move the cards to the suitable position. Keep the example in mind and apply to similar problems. In Insertion sort, we sort the element set by consequently moving the current element to the appropriate position in an already sorted set.
QuickSort is a very important sorting technique. It uses divide and conquer technique. Divide the given set of elements into smaller sets recursively and apply comparison and swap. When comparison and swap is performed to formulated smaller sets, it results in the larger sorted set. Learn algorithm analysis. Learn how to find kth smallest element by modifying the Quicksort algorithm in O(nk) complexity. Find out mean of a set of elements in O(n) by modifying the above problem.
Mergesort is also a divide and conquer sorting technique. The concept is to merge two sorted list to obtain larger sorted set. By dividing the given array into smaller subset by recursion, smaller subsets are formed. Merging the subsets from lower level to higher level, we obtain sorted array. Learn algorithm analysis. Note that merge sort takes an extra array. Hence this is not an in place sorting. It has O(n) space complexity. You should practice problems related to merge sort. Eg. You are given two sorted arrays with size n and 2n. The second array contain n elements in the positions 0 to n-1. Now without using extra space, formulate the elements in 1st and 2nd array into 2nd array and return a sorted array of size 2n.
Heapsort is an interesting sorting technique. Heap is a tree in which parent node is always >= child nodes (called as max-heap) or parent node is always <= child nodes (called as min-heap). This is the basic property for a heap. Let us have an overview of how to create a heap and manage it. When we need to add an element into an existing heap, we add the element as root or to the rightmost bottom element in the heap. Then apply heapify operation. Heapify operation can be of two types: shiftup and shift down. When we add a new element to an existing heap as root element, we perform shift down operation. Shift down operation performs a traversal from root level to bottom level, at each level of traversal, it compares whether heap property is violated, if so it will perform swap between parent node and child node to obey the heap property. Hence the element we added as root will move to the accurate position when the traversal reaches the bottom level. If we add a new element to the bottom right element, we need to perform a shift up to position the element to the right position. We traverse from parent in the bottom level to the root, by checking the heap property at each level and swapping elements to meet the heap property, we get a balanced heap when traversal reaches the top element.
Heapsort makes use of these operations to obtain a sorted set. Let us assume we have a heap (1,n). the root element will be the highest value (max-heap). Hence it will be the last element in the sorted list. We swap the root and the last element. Now the heap property is lost. But the nth position of array has the correct element in the sorted list. So we exclude nth element and heapify the heap(1,n-1) by using shift down operation. Because the root element is the one breaking the heap balance. After doing heapify 2nd time, we get 2nd highest element as root element. Now swap root element with n-1 element. Hence n-1, nth elements are 2nd largest and largest elements. Now exclude the n-1 and nth element, heapify heap(1,n-2). Follow the procedure until the newly formed heap size become one. You will get a sorted list. Read the chapter Heaps from Programming Pearls (It will give you a wonderful insight). Practice the problems: Find kth largest element from a given unsorted array. Implement priority queues.
External sorting is an important sorting technique used when the amount of data we need to process is greater than the available memory. For eg, we have 1GB of integers and 256MB of RAM. Hence it is clear that we cannot load entire list of numbers into ram and perform in memory sorting. External sorting techniques are to be used to solve this problem. K-Way merging is one of the simplest methods to solve the problem of RAM < data size. We can split the data into K parts. The part split is performed such that each split is less than the size of RAM. Then we can sort each part individually using any sorting algorithm. Then we can perform a special type of merging to obtain sorted output. Let us see how to perform the merge.
For eg, we split the data into 4 parts and we individually sorted them. Then take the first element from each 4 sorted lists and sort them and find out the lowest element. It will be the first element in the sorted output. Add it to the new list called full sorted array.
Now, from the array from which we obtained the lowest element, take the next element, sort the list again and find out the second lowest element. From the array we obtained 2nd lowest element pop out the next element and sort again to find out the third lowest element. Proceed the process until all arrays becomes empty or one array remains few elements. If an array remains unempty add those elements in the order to the full sorted array. Have a look at implementation code (http://code.google.com/p/kway/)
Bit array technique for solving RAM < Data problem for sorting counting numbers
In a 32 bit system an integer takes 32bits to store an integer and a 64 bit system takes 64bits to store a number. But for storing counting numbers, we can use bit vectors which are formulated by using 64 or 32 bits in an integer. If we set 0th bit in 32 bit we can represent it as 1. If we set 2nd position, we can represent it as 2. If we define an integer array of size N, we can actually represent 32*N numbers using that integer array. In order to sort large number of unique counting numbers we can use, bitsorting by setting and clearing bit positions. If we need to represent 1 to 68 numbers we need only 68 bits. We can represent it using an integer array of size 3. Ie, 32*3 = 96 bits. To set 68th bit, we know that 68th bit is situated in the array offset 2. To obtain the array offset, divide the number by 32. (68/32 = 2). Now we need to know which bit position needs to be set in the 32 bits available in array. For that, findout modulus by 32. 68%32 = 4. Hence set the 4th bit in the array. This can be performed without division and modulus operators by using bit shift operators.
Here we find out i/32 using right shift operator (Each right shift causes division by two. Five times rightshift = division by 2^5 (32) ). By using AND operation with 0x1F, we get 5 Least significant bits, the value of 5 LSB returns in the position in 32 bits. Hence we shift 1 towards that much positions to left and is ORed to do the bit set operation.
Have a look at the implementation code. http://cm.bell-labs.com/cm/cs/pearls/bitsort.c
Bit manipulation problems
By using bit manupulation, we can do lot of tricks over numbers. See http://graphics.stanford.edu/~seander/bithacks.html for lot of interesting bit twiddling hacks.
One of the very common problems, is counting the number of set bits in a number.
n&(n-1) will return a number obtained by setting rightmost set bit in number n to zero.
Another problem is to check whether a number is power of 2. For a number which is power of 2, there will be only one set bit in the number. Hence if we do n=n&(n-1), we will obtain zero. Using a single line operation we can identify power of 2 or not.
Hash is an important data structure that can be used to solve different problems. When you are asked to find the number of occurrence of numbers in a given list of numbers, you can simply use hash for solving the problem. Iterate through the list of numbers, like:
We can solve many problems in O(n) using hash.
Implementing a hashtable in C is not easy at a first attempt. Try to code yourself a hashtable in C using pointer to pointer.
Binary Tree and Traversals
Binary trees are common interview questions. There are lot of BT based questions. Have understanding of common questions like the following.
* Difference between full binary tree and complete binary tree
* Find out Maximum/Minimum height of a tree (Recursive and Non-Recursive)
* What is the maximum number of elements in a tree with height H.
* Nth smallest/largest element in a binary tree
* Algorithm to find out Least Common Ancestor (LCA)
For your information, Least Common Ancestor is the common node in a binary tree which is obtained by traversing from two selected leaf nodes to the root element.
Linked list problems
- Reversing linked list
Linked lists are also very common interviewer question. First practice to be done for linked list problem is to write a linked list structure in C yourself and implement linked list traversal. Then add functions to reverse the linked list in place as well as by creating new linked list. If you do not want a new linked list, but you only need to print the elements of linked list in reverse order, use a recursive function that can do recursive calls till the end of linked list and print the elements.
- Cycle in a linked list
Test for cycle/loop in a linked list is a commonly asked problem. You can initialize two variables as start node for linked list and traverse in a while loop such that while loop ends when one of them becomes null or both variables becomes equal. In the while loop, we traverse two variables with different speed.
Have a look at well explained tutorial, ?http://ostermiller.org/find_loop_singly_linked_list.html
It is very important to understand all the tree traversals and implementation.
1. Preorder traversal
2. Post order traversal
3. Inorder traversal
Traversals can be easily implemented using recursion. But interviewers might ask about non-recursive algorithm. In that case, use stack based algorithm to explain inorder traversal. You can easily implement inorder traversal using stack.
Graph traversals are commonly asked in interviews. Have the understanding of Shortest path algorithms.
Depth First Search
In depth first search initially traversal goes deep into deepest node and traversal proceeds. You can use a stack to implement depth first search or else ?you can use recursion to implement this.
Breadth First Search
In breadthwise traversal, you can use it to print the tree in the sorted order. You can use the same algorithm used for depth first search by changing stack into queue to obtain the algorithm for BFS.
Dynamic programming is an important algorithm technique to solve a large problem by splitting into smaller overlapping problems. When overlapping small problems are solved, the larger problem solution is obtained. Problems like finding shortest path can be solved using dynamic programming. It usually involves using a storage of subsolutions so that they are used in solving bigger problems which overaps the subsolutions. The dynamic programming is difficult to identify as well as apply to solve problem scenarios. It requires considerable spending of time to learn and master it. When you look into some problems and look at its solutions, you may feel it is not that hard. But when you are given a different problem you may not be even able to identify it can be solved using dynamic programming. Even if you identify, you will find hard to code the problem solution. Hence, give considerable time to work on this one.
Try to learn the problem to find subsets of a set using dynamic programming
Trie data structure
Trie is an interesting data structure that can be used to implement autocomplete feature. You can read more about trie from my older blog post. (Implementing autocomplete with trie data structure)
Lot of conceptual questions are being asked during interviews. It will test your basic knowledge and understanding. Find some of the commonly asked topics
* CPU Scheduling algorithms
* Layers of TCP and OSI network stack
* Understand how Virtual Memory/Paging works
* Understand what happens when you enter a URL on web browser and how website is loaded
* Understand how a computer boots and explain the story
* What is the difference between 32 bit and 64 bit machine and OS
* Understanding TCP/UDP protocol
* Understanding ARP/RARP
* Understand DHCP
* Understand DNS (Recursive, Iterative resolution)
* Understand how email works (POP, SMTP)
* Understand Web 2.0, REST, Thrift, RPC
* Understand IPV4 vs IPV6
1. Programming Pearls
Programming pearls is a great book you should read as a computer enthusiast. You will be inspired to learn about data structures and algorithms.
2. Cracking the Code interview
It is a nice book consisting of lots of interesting questions
Glassdoor is a great website consisting of lots of questions being asked for different companies. As a first programming exercise, write a perl/python/bash script to parse questions into a text file. I had a python script that I had written long time ago. (Lost that somewhere)
Choosing your first job
Every job interview is a great experience. In my life, i had attended three job inteviews and ended up in receiving 3 offers. Each of the interviews were different experiences. Once you face interviews build positive approach in finding feedback yourself. When you receive multiple offers, put enough effort to understand about what you are going to do with each of the job offers your receive. Choose the job you love to do, so that you never have to work a day in life. Thanks and all the wishes.
You can find few posts about interviews from this blog here, http://www.sarathlakshman.com/category/interview/
I dedicate this blog post to all my juniors in Computer Science Dept, Model Engineering College, Cochin
Image credit: http://www.flickr.com/photos/stevefrog8/
The biggest technology fair in Turkeyhas just been over. More than 100.000 visitors and about 1000 companies met for four days.
Pardus was one of the biggest pavilion as for the last years. We ran out of DVD’s before the fair is over, altough we prepared 10.000 of them with the latest release of Pardus, which is 2011.2 Cervus elaphus. :)
Their project Natural Interface, converts human interaction (gestures captured through Kinect) to X events. Thus, you can control desktop applications by simple hand gestures.
We also provided a home entertainment unit with a comfortable couch and a big LCD TV. In the previous events, we were tired and bored from the questions and prejudices about games on Linux. This time we showed everyone, how you rock with Linux! Hundreds of people enjoyed playing World of Goo, Frets on Fire, Crayon Physics, Open Arena, Torcs etc.and watching HD movies (free movies of course like Sintel, Elephants Dream and Big Buck Bunny ;) )…
But most of the people was interested in the interactive digital board which was powered by Pardus.
I should tell about this a little bit more. There is a project called Fatih, aims to improve technological infrastructure of Turkish educational system. It is planned to install digital interactive boards in all classrooms and Pardus has been chosen as the operating system. This means more than 600.000 interactive boards will be powered by free software and KDE! :) Another chapter of the project is providing tablet PC’s to all school kids where it is still controversial if the OS will be Pardus or another system (Android?). That is a though decision as it means 15.000.000 tablets will be operated which will be 15% of the whole market of tablets. (Yep, that’s right! :) )
Finally I want to thank all volunteers for their great work ! We couldn’t do this without their faith.
Hi, I’ve started working on Pardus linux distribution as an intern last week. This post is the summary of the first week at the office…
I’ve been supporting Pardus for almost 6 years and being volunteer at the events occasionally. I’ve met most of the developers during these events. However, I had a great opportunity to met the ones who I haven’t met before and the other interns at the meeting in first day.
Other four days of the week, Pardus developers organized some workshops which are useful for interns in these subjects: Python, vi, ÇOMAR, PiSi, Qt, Linux kernel, testing and debugging… We had enough time to practice too.
I have an active developer application request, and I have plans for Package Manager. Since I’m in the same office with its developer, we had chance to brainstorm. Gökmen has also requested me to make some improvements in package details window. That window contains a web page and making improvements is a piece of cake!
While other interns practice what we’ve learned from workshops, I worked on improvements for the details web page. For development, I preferred nginx web server which I use a lot recently. However, I had to make some changes in php package to be able to use it with nginx. I needed to enable FastCGI support, and I had to update libc-client package to do that. After these changes, I’ve managed to build a new php package with php-fpm patch!
Recently, I changed static rating stars with jQuery and Raty plug-in. I’ve also created a new php class to help me with working SQLite database that holds the rating data. It’s almost finished, I just need to implement a log in system for package ratings.
This week on Monday, it became official that my internship project is “improvements on package manager”. Sexy screenshots are coming soon!
The key idea in "Free Software" is sharing, so to speak. I want to share my whole experience about training for anybody who has an interest in free software. The best way to accomplish this job is having a blog. I've started to write my Pardus adventure with this very first entry.
In Linux World, formatting a Usb Flash Disk is not an easy operation for end-user; in Pardus we always use one sentence: “Make it easy !“. So, we have to find an easy way to formatting a removable disk !
Yet another creative developer from Pardus, Renan Çakırerk has created Quickformat. And I wanted to let you know !
It is also integrated to Dolphin !
You can find a lot of information about Quickformat from Renan’s Blog. Have fun !
It was a very warm summer day in the year 1990, I was 5 years old. We went shopping with my mum and sister and after the shopping spree we had a lot of heavy shopping bags to carry back home. The problem was we had a very long way to walk back home and my mum and sis started complaining that the bags were hurting their hands. So I started thinking. I found a strong stick on the road and told my mum to hang all the bags on it so she and my sister could equally share the weight of the bags without hurting their hands by holding both ends of the stick… I remember how my mum was amazed by the idea of a 5 year old and I remember how much I enjoyed creating solutions to everyday problems. Well to be honest, I still do.
We all have removable devices such as USB Hard disks on our desks, USB Flash Disks in our pockets, SD Memory Cards from our cameras… etc that we frequently format “through the command line or some complicated partition managers”.
Thus I’ve created Quickformat, which is a solution to one of your daily problems; Formatting a removable disk “easily”. It is incredibly intuitive, easy to use and integrated to KDE’s file manager Dolphin. Quickformat can be tested with Pardus 2011.1 Beta.
Ok, now it’s time to explain how to use it.
And thats how easy it is.
You can also run Quickformat outside Dolphin.
Lots of us suffer from the unbelievably “inhuman” user interface of KDE. There are thousands of rubbish floating everywhere on the desktop just because an ordinary programmer /engineer only asks the question “can we do it?” rather than “should we do it?” when starting a project or adding a feature. Of course in a perfect world UI / graphic designers and artists should be involved in such activities not everyone who knows programming.
At Pardus, we do our best to give users an extraordinary experience of beauty, simplicity and usability like they have never experienced in any Linux distribution before. This is why we need artists, not only programmers. Feel free to contribute if you think you are an artist.
Quickformat is written with Python 2.7. The user interface is Qt. Disk information is brought to you by KDE solid. Some disk operations such as removing the partition flags and setting the filesystem is done with PyParted. The overlay is a derivation of the gorgeous work of Gokmen Goksel‘s PDS. The source of PDS is here.
Facebook is a great social networking platform in which each of users have got a profile and wall. Over the recent month, facebook has been flooded with lot of malware applications and spammers. In such a risky environment on Facebook, it is very important to understand how to protect ourself from being the target.
Spam and Malware
To keep away from spammers and malware, the best mode of protection is to keep away from clicking untrusted and doubtful links and posts. Do not click ‘Allow’ blindly when some of application asks for permissions to access. Always read the type of permissions that an application uses, when it pops up ‘Allow’ – ‘Deny’ window. Give Allow permissions only to the trusted users. If you are not aware of how a facebook application works, here is short description. Facebook is a platform which provides several interfaces to the application developer to access the data related to users, pages, friends, events, photos, etc (The SocialGraph API). The application developer uses the API and writes the program that can manipulate the data provides through Facebook. They applications are hosted on the developer’s own servers. The facebook team doesn’t look at the application code to see what are these applications doing internally. Using the data access limits specified by the Application permissions, the developer can do any manipulations using the data.
Facebook Mobile – Vulnerabilities
Facebook mobile is an additional interface that Facebook facilities to use you mobile device to update wall, add friends, reply to friends, comment, upload, etc. There are good number of activities that facebook mobile can perform. See the facebook mobile page http://www.facebook.com/mobile/
There are a few open vulnerabilities in Facebook. Two of them are Facebook Upload via Email and Facebook via Text Message.
Facebook via Text Message – The real villian ( Post on Anyone’s wall vulnerability)
I became a victim of Facebook via Text Message last day. Frankly, I never used Facebook via Text Message before and I didn’t sign up for the feature until today. Yesterday, It happened to see a new post on my facebook wall. It was just a ‘.’ in the post and seen that Posted using Text Message. I recently had installed Facebook app for android on my Nexus S. I thought that it is some bug in the Facebook App on mobile made the wall post. I tried to regenerate the same post on the wall using mobile. Later I understood that the badguy used the feature called Facebook via Text Message which I never used. I signed up for the service and tried out how it works.
I found that, once we link a mobile number to a facebook profile, if we send SMSmessages to 92FACEBOOK (9232232665) from our linked mobile number, the message will be posted on the wall. I was shocked to see such an insecure procedure. Even if you are not signed up with Facebook mobile – Text Message feature, your profile is exposed for vulnerability. If you had added a contact mobile number and verified it through facebook mobile verification process, that means you have subscribed vulnerability from facebook
The Facebook via Text Message system uses the sender’s mobile number to identify to which profile’s wall the text message is to be posted. Not only we can manipulate wall but also we can perform several activities through Facebook via Text Message. That means the vulnerability facilities the attacker to have complete control over your facebook activities.
SMS spoofing is one of the vulnerabilities in the SMS design. It is easy to send SMS messages to a person by changing the identity of the sender. In India, though all the SMS gateways do not allow spoofing of SMS message senders ID, there are still many paid and free SMS spoofing services from outside India. You can easily send SMS by tampering the Identity to anyone else.
If you have access to such an SMS spoofing service, you can set the mobile number (sender) corresponding to the facebook user whose wall is to be updated. By sending a spoofed SMS, we can easily update another one’s wall.
Facebook should really introduce some additional authentication token along with the SMS (Eg. a temporary authentication passcode along with SMS). From a user end, the best mode of protection is to remove the mobile number linked to the profile.
If you want to show your contact number along with the profile, add the contact number. But do not confirm the verification of the contact number asked by Facebook verification system. Thus your profile will be able to display your mobile number, at the same time you are protected from the attack.
Facebook Upload via Email
Facebook upload via E-mail is comparitively secure feature. If you navigate to the facebook mobile website, you can see a email address similar to firstname.lastname@example.org. This is a secret email address. By sending email to the specific email address attached with the facebook profile, the email messages will be posted to the wall. It is important to keep this e-mail address as secret and should not be exposed to your friends and strangers. Incase, you feel that it got exposes to someone you can reset the special email address linked with the account. Click find out more -> Refresh your upload email.
I request everyone to be aware of this serious vulnerabilities on Facebook and take preventive measures to protect your profile and your identity over internet.
Article: Tutorial on SED scripting
First published in Linux For You magazine [Opengurus] April 2011
Pardus has a lot to recommend it and definitely rates a try for anyone who wants an excellent KDE 4 implementation. Pardus isn’t perfect, but its flaws and shortcomings are relatively minor compared to many if not most other distributions I’ve tried, including recent releases of some of the big names in Linux. It’s easy [...]
As a Python fan and the main developer/maintainer of PyKDE, it certainly gives me that warm fuzzy feeling inside to see Python, PyQt and PyKDE put to such great use. It is also very impressive to see how such a small team of developers can put together such an impressive distribution. It is a great [...]
My experience with Pardus was quite positive. The attention to detail, right down to skinning Amarok with the Pardus colors, is matched by the elegance of the installer and the efficacy of Kaptan and PiSi. Booting and running Pardus is quite speedy on my old AMD Sempron 2800+ with 512MB RAM; other distributions with similar [...]
There are sporadic examples of Turkish open source projects. In August 2007 Turkey’s Military Recruitment Division, which is part of the Ministry of Defense, announced that it was switching to Pardus Linux on all of its 4,500 desktops and more than five hundred servers. Pardus is also being used by Turkish Radio and Television Supreme [...]
The #1 Pardus supporter outside Turkey Mr. Willem Gielen and his beloved fiance Ms. Mahican Emeni are married as of today. The wedding ceremony took place in Rotterdam Museum of Natural History, if I’m not mistaken, and under a bright sunny sky, what looks like. Willem is the founder of the Dutch Pardus Users’ Group, [...]
From our beloved Çağlar’s blog: The Pardus Project is pleased to announce that Google has agreed to sponsor five student slots. Congratulations, and welcome to the Pardus community! We are looking forward to the successful completion of the following interesting projects: A System Restore Project for Pardusby Mehmet Ozan Kabak, mentored by Gökmen GÖKSEL Pardus [...]
Today we have received great news via dear Faik: Congratulations! Your organization “Pardus project” has been accepted in to the Google Summer of Code(tm) 2008. You have been assigned as primary point of contact and as an administrator for your organization. Please make sure you review the information we have on your organization and about [...]
As I mentioned at the start, Pardus is not based on Slackware, Debian, Red Hat, or anything else and in this day and age that’s a real rarity. It’s nice to see someone trying to do something different and not imitate. I think this distro is really one to watch in the future; it’s come [...]
I have participated to the 2nd International Free/Open Source Software Technologies Workshop in Riyadh, Saudi Arabia few weeks ago. The Workshop was organized by and took place in the King Abdulaziz City of Science and Technology (KACST), an impressive campus for advanced technology research and development. Before the Workshop, my expectation was that I was [...]
Overall, Pardus lives up to the goals and statements made by its developers. It is indeed easy to install and even easier to use. Pardus is an accommodating and customizable desktop system suitable for new and experienced users alike. yazının tümü burada // the article is here
Most of us know the Tic-Tac-Toe game. If not, you might know this game in another name. I belonged to the second category. I had played this game many times in my childhood but with another localised name. This game said to be a simplest example of programming with a game tree. Tic-Tac-Toe also seems to be a common interview coding question for Software Engineer – Developer positions.
Let me give a brief idea of what is this game about. It consits of a board containing 9 cells with 3×3 (rowxcolumn). It is a two player game with each player assigned with a marker symbol (X or O). During the first turn the player mark the symbol X (Marker symbol corresponding to the player) to a cell among the available cells, and the second player will mark O (Second player’s symbol) to a cell among the available cells. The game continues until it reaches either one of the conditions:
When one column, row or diagonal has X, The player assigned with X wins else if this state arrived for O, the player O wins. If the board contains no free cell left and none of the above conditions arrived, the Game ends with Draw.
Now, Our goal is to write a program to play this Tic-Tac-Toe. First we will write a program conists of Human-Human player game such that it can played between two friends. After writing Human-Human game, we can improve it by replacing one Human player with Artificial Intelligent Player. Writing an Artificial Intelligent Player is the most interesting part of the code.
Artifical Intelligence was one of my subjects in the Semester-8. Since I did not study MiniMax theorem in AI for examination because of the fact that the last minute study didn’t work. While writing the AI player program, I went through the MiniMax theorem and found it very interesting unlike classroom. I will describe more in the later part of this post. The AI player is a simplest application of MiniMax theorem. If teachers could show Tic-Tac-Toe program in the AI classroom, it would have simplified the task of teaching without leaving any complexity.
The complete code for the Tic-Tac-Toe in python is given below. Explanation for the components in the program are described as below.
It consists of a class GAME. It is the major class which contains the states and methods required for the game. Initially it sets all the cells in the board (self.board) with ‘-’ (blank). An empty list, lastmoves is initialized. self.lastmoves is a stack which consists of recently marked positions. It consists of print_board() function which is used to print the cells in the current board. get_free_positions() return a list of unmarked positions on the board. mark() function marks a position with a marker symbol. When it marks a position, it pushes that position to the lastmoves stack.
The revert_last_move() function reset the recent move (Recent marking). It makes use of lastmoves stack for resetting the last move by unmarking it.
The is_gameover() function returns True or False based on whether game is completed or not. A game completes when either of the players win or when the game reaches Draw. win_pos list consists of eight different three-cell combinations that corresponds to winning state. ie (first row, second row, third row, first col, second col, third col and two diagonals). This method sets the self.winner when game is over.
The play() method executes the game play. It takes two player objects as arguments. Each player has a method move() which performs that player’s move. Since there are nine cells in the game board, it executes the loop for a maximum of nine times. It calls the move() method for each of the players alternatively. On each move, it checks whether the game is completed or not.
We have two player classes Human and AI used in this program. Actually we can create a Base class Player and inherit child player classes, AI and Human and implement move() method individually. (Good OOP design). But I haven’t used any base class and inheritance to leave the code simple.
Human class is a player attribute used in the play() function of GAME class. It has a constructor (__init__() ) and a method move(). When the object is initialized, it sets the marker for the player as self.marker = “X” and sets type of player (Human(H) or Computer(C)). Human class is meant for Human player. The move() function takes an instance of GAME class (current game). The method reads the next move position from the user and marks the position with player marker (X or O) if it is available.
See the lines which is at the end of the lines in the program:
player1 = Human(“X”)
player2 = AI(“O”)
Now replace player2 as Human (player2 = Human(“O”)) and execute the script. Now you have a two player Human-Human game. Try a game with your friend.
Next target is to code an Artificial Intelligent Player.
We use our brain logic to play Tic Tac Toe game. Everybody plays to win the game. How do we code up an intelligent Player which plays to win. Winning can be achieved by foreseeing the moves of the opponent. If we can foresee all the possible moves of opponent until the end of the game, we can always choose the best move. That should be the basic idea of the intelligent program. Foresee or emulate the next states of game. The technique used for foreseeing and choosing the best move is called MiniMax theorem.
The AI class is similar to Human class. It consists of similar initialization part. But AI class has an additional attribute called opponentmarker which stores the marker for the opponent, which will be used for emulate marking of opponent. The AI class consists of the following methods:
move() – Chooses the next move
maximized_move() – returns the next best move (To reach winning game end)
minimized_move() – returns the next best move for opponent (Means worst move for current player)
get_score() – returns the status of game on end. Win, lose or draw.
The move() method calls maximized_move() which returns the best move position and marks that cell as next move.
The get_score() function checks whether game has ended. If ended, it returns 1 if the AI player won, -1 if other player won or 0 if draw. These values are scores.
The major players of minimax theorem are Max functioning and Min functioning. Max function maximizes the possibility of win and Min function minimizes. Let us see what is written in the maximized_move().
It gets a list of all available moves and apply the moves one by one. Check if game has ended, if it is ended collect the score and check whether it is better than all moves applied, if it is the best one use that as bestmove. If game has not ended, call minimized_move() so that next opponent’s move is emulated.
The minimize_move() method does exactly same as maximized_move(), except it selects the worst score as best move. (That means, -1 score means opponent win, which is the best case for opponent. In minimize, we are emulating the best move of opponent). The minimized_move() calls maximized_move() for emulating the next state (The AI player’s state).
Hence once maximized is called, it will execute a stack of Max-Min-Max-Min-Max.. until the game over. In such way it find outs the best next move for the intelligent player. Hence we cannot beat the intelligent player. We can only defend until we reach a draw. At each state, it applies all the available moves and emulate the game with all possibilities to which it wins, and selects the best move. When the Max-Min-Max.. recursive call returns at each level, revert_last_move() method is used to reset the last move (Since it is an emulation and has to return to previous state after emulation outcome is obtained).
Now, try running the original program and play the game with Computer. After that change both players to AI and see what happens.
The given program applies Max-Min sequence until end of game for every move. It is very CPU expensive. If we need to reduce the intelligence to make it less CPU expensive, restrict the sequence of Max-Min calls to a restricted number of levels.
Hope you enjoy this post. Comment here
Thanks to the Tic-Tac-Toe image which is licensed under CC (source: http://www.flickr.com/photos/public-domain-photo/4250653771/sizes/l/in/photostream/).
Zynga is well known for the social gaming platform which has emerged through Facebook. Zynga has played a great role in bringing about a good number of user base through the gaming platform. Last year, Zynga started their first international office outside US in India. Recently, I appeared for Zynga interview and landed with a job offer.
It happened all of a sudden. My book (Linux Shell Scripting Cookbook) news spread through different mailing lists. One of the XMECian who works as Engineering Manager at Zynga, India refered me hearing this
news. He came online and asked for my Resume. Within a minute after I send my resume, I got a phone call from Zynga HR. He told me that they want to consider me for Studio Engineering team (The team which is responsible for development and maintenance of Zynga games) and asked whether I am available for the following week. We decided to conduct the interview on March 10th. He told that he will book the flight tickets and get back through mail. The call was less than 1 minute. I was stuck. Hooh. I asked the man who referred me what was happening in a minute. He answered simply with a smilie, “Zynga Speed!”.
Two days before the interview date, HR contacted me and confirmed the date again. He sent me round trip flight tickets (Cochin – Bangalore). I had no clue what kind of interview will it be and what kind of role they are looking for. I did not prepare anything since they are conducting me direct interview without conducting the test process.
I was eagerly waiting for February 10th. Finally the day came. The flight was scheduled for 7.45 AM. I was so excited. My first flight journey. I reached the airport in time. Thanks to my friend Harish for dropping me at the airport ruining his sleep. It was Kingfisher red small flight. I got the seat 1F, which was the first row window seat. It was a great experience – flight taking off and landing. The flight reached bangalore on time. There were buses to the city in front of the airport. I took some BIAS – 6 bus and told bus conductor to remind me when reach M.G road. I stepped down near M.G road. When I asked some one standing near the bus stop he directed me to a road. I walked for sometime and I understood that I am not going to reach anywhere. So I hired an autorikshaw reached the Zynga Game Network which is in the 5th floor of Esquire building.
The HR welcomed me and I followed him to a conference cabin. In 10 minutes, an interviewer came. He introduced himself that he is working as Principal Engineer in the studio and has been working in Microsoft-US for many years and after that Google-In for last two years. He asked about myself and scanned through my resume. He asked what I would like to do and what I have been doing. I gave a brief intro about myself and gave an overview of work I have done in the past. He was very curious to know about my projects and asked many interesting questions. I could use the whiteboard to illustrate my explanations. When I told that my interests are with Operating Systems, he asked few questions to check my understanding about Scheduling, Paging, Virtual memory, etc. He asked me three coding questions and 1 puzzle (for designing an approach to solve a game). While going through my projects, he was very much curious about my Pardusman project. We had a very friendly conversation. At the end of my interview, he asked about my interest on which stream I would like to choose. Studio Engineering, Network operations and something else. He explained me about what studio engineering team does. Basically studio team takes
The HR came to me in a hurry and told that Cab is ready and I can move to the airport. He brought me immediately to the Cafeteria and got some cold drinks. HR was really nice, he was taking care of everything. I was accompanied by another person who introduced himself as CEO of some dot com company. I reached airport in time. I came to Cochin on Jetairways Boeing flight. Thanks to my roommate Navin for picking me from airport to hostel. The next day I had a phone HR interview for zynga. It was usual HR questions like expected pay, why zynga, kind of work I look for, etc. I requested her about my interest in Systems Engineering Group. But she told that they don’t recruit freshers in SEG and told they will get back to me in a week.
After a week I got a call from the Zynga HR, whom I had correspondence from the beginning. He told that they need me to be interviewed once more. I agreed and I received the flight tickets again by mail. On Febraury 23rd again I flew to Bangalore. At Zynga, the interviewer came little late due to some meeting. He introduced himself that he is an architect at SEG. I got the clue that they are considering me for SEG. He asked about my interests. Then we had a long interview comprehensively on Operating System internals, application debugging, etc. Finally he asked me about preferred programming language and whether am I comfortable with C. Then we had lunch together at the Cafeteria. After lunch, he wanted me to write a program in python. Once I completed, he told me to write the same in C. Once the interview is over, I had another interview with an engineering manager. He introduced himself by saying that previously he worked as engineering manager at Google and currently work in SEG. Asked about my book and interests. He spoke about the work they do in SRE, etc. Next he wanted me to solve a puzzle on white board. I came up with a correct solution. Then he was open for answering my questions. The HR came and asked to leave as soon as possible not to miss the flight. I returned second time in Jet Airways Boeing. Due to Airshow at Bangalore, the flight was little delayed. It was raining also. I could see the clouds through the windows of flight. Awesome. Thanks to Adarsh for picking me from airport to hostel.
In Zynga, you will find a lot of self driven engineers and is a great place to learn and grow.
On 9th of March, I received a call from HR saying ‘Welcome to the Zynga family’. You are hired as Associate Software Engineer in Systems Engineering Group
It has been a while since I thought of writing my previous job interview experiences with different companies.
Taggle.com came to our campus in month of July 2010. It was CTO, Tej Arora who came to the campus for the recruitment. First of all there was a Presentation about Taggle Internet ventures and how it works.
Taggle.com is a group buying website where you get goods for reduced prices, with greater than 50 % off when there are a group of people to buy it. We had a objective multiple choice test of around 40 questions. It consisted of few aptitude questions, data structure questions, etc. It was a good question paper. By evening 5 pm, the result of the technical test came out. There were around eleven guys shortlisted for the next programming test. The eleven selected candidates were send for the programming round. We were allowed to write code on our own laptop and use any programming language we liked. He gave us two set of questions. Set 1 consisted of 1 difficult question and other set consisted of 2 easy questions. We were able to choose one set for coding. I chose the question to implement text auto completion functionality (set 1) and wrote the code in Python. He verified my program and told me to wait and come back once the programming round is completed by others. My friend Fayaz also had written autocomplete functionality. There were other two girls Nishita Suresh and Legena P.K who had worked on the other set of problems. Four of us had personal interviews. He didn’t ask me any technical interview questions but we had a very friendly conversation about the work and benefits at Taggle Internet ventures.
Once interviews were completed, the results were announced. Fayaz and Me got placed in Taggle.com.
Yahoo! came to our campus on October 30th, 2010. It was a day before seventh semester university exams started. Yahoo was considered as the superstar company that comes to MEC campus with highest pay and perks. The day when placement cell announced ‘Yahoo’ is visiting campus, everyone looked with wow. Placement cell members gave us the info that Yahoo! is going to recruit for Service Engineering team where they look for guys who live and feed in UNIX environment. In the following days placement cell posted specifications and info on what they are looking for and their requirements. There were a lot of XMECians working in Yahoo and they send us some materials they studied during their time. Everyone started seriously preparing for Yahoo with lot of effort. I also wanted to get into Yahoo. It was the time I was working on my book and I had hectic schedules. Some of my seniors who got into Yahoo were famous for Shell Scripting and sed. So I had thought of seriously looking into SED. I spend few days on SED and AWK. It was really nice writing sed scripts, which looks very awkward but performs incredible text processing operations in single line of code. To brush up my shell scripting skills, I went through the first draft of my incomplete book. But, that helped me a lot to fix bugs in my book. I also brushed up few conceptual things like How E-mail works, Networking basics, etc. The day of Yahoo interview came. The cut-off percentage was 70%. There was a presentation on Yahoo! and what they are looking for? Benefits and perks at yahoo. Then we attended the screening test. The test consisted of few aptitude questions, lot of Perl questions, networking questions, questions from OS scheduling, SQL and few other things. But it was not that difficult. After the test, in about an hour the results were out. 15 guys were in. The next was programming round.
They gave two questions, To write an intruder detection system script by parsing the auth.log log file and program for generating random sequence of n numbers from single random seed. I wrote the script for intrusion detection and basic implementation of random sequence generator (I had uncertainty about the question and what I had done was slightly different from what they had meant). After the programming round, they shortlisted four candidates. Joju John Joseph, Subeen N, Neha Mahadevan and me. They announced that there will be three rounds of interviews (two technical and 1 HR round).
My turn for the interview came. They scanned through my Resume and were impressed with my work and Book. Interviewers asked about my interests. I told them that I live in GNU/Linux. One of the interviewer asked me to narrate the story of a computer from the time we press power button until it boots up. I had a long narration of the story of computer boot ups including in-depth explanation of Ramdisk and all (Actually Linux boot was one of my favorite things which I had worked on). Then he asked few questions like What happens when a user browse a Web page, DNS query, DNS records, and few other questions. The interview went through topics like GDB, Core file, Debugging, Killing processes, Init, Signals, Orphaned processes, SSH, SSH Auto-login, and many other questions. I don’t recall most of them. At the end of the interview, they told that they were pretty impressed and satisfied. The next round of interview was HR interview. It was very friendly in nature asking me usual HR questions. He was busy noting down my details on a form during the interview. After the HR interview I went for the second technical interview. They told that there is nothing to ask and we were having friendly conversation about college and environment. The interviewer told me about his college, Yahoo recruitment experience and few things about work environment. When my interviews were over, I had to wait outside with Placement cell volunteers until the three rounds of interview gets finished for other three guys. It took lot of hours. Finally they announced the result. Joju John Joseph and I got the placement offers for Service Engineering team. Neha and Subeen got internship offers.
I will write about my Zynga interview experience soon. Stay tuned!
Google Summer of Code organizations list has been published. Soon, within april 8th you will be able to submit your applications. Google summer of code is a premier Open Source programs managed by Google. The certificate of Google Summer of code adds higher market value to your resume. You will be receiving certificate stating 3 months Student Developer for Google and also you will be receiving a good paycheck of $5000.
I participated thrice (2008,2009,2010) with different organizations. I would like to give you few advices regarding how to apply and participate.
There are 171 open source organizations got accepted by Google for GSOC 2011. You can see the list from:
Each of the organizations will accept few projects (No of projects as per decided by google). No of projects for each organization varies according to the market value of organizations. You can submit one or more (I prefer 3 applications) to same or different organizations.
Each of the organizations will have there project ideas page. You can select an idea that interests you or propose a new idea to them. (But already listed idea has more changes to get accepted – I feel so).
Each student who get accepted will be assigned with a mentor from the corresponding organization. Mentor will be a very experienced guy who is already contributing to the projects. In my case during my first summer of code, surprisingly my mentor John Palmeri is the author DBus-IPC, Gnome Executive and Author of GNOME network manager. You can get such kind of exposure during the project.
Go through the accepted organization list, Click on the organization, Go to the ideas page. You can find many ideas listed with details (Prerequisite, Difficulty level, Expected mentor, Contact person, Related information URL, URL of mailing list, etc). If you find some idea interesting, invest some time researching about the background, and related technologies related to the idea. Once you gain basic information about what you exactly need to do with project and what technologies you should use, contact the mentor or person listed.
To collect necessary details about the project and get the background of technology, look into mailing list associated with the project/organization. You can also subscribe to the mailing list.
Write properly what idea you want to work on, your background and how you wanted to work on the project. Include as much as details on how you will implement the project and ask necessary questions.
If you are not familiar with IRC, IRC is a type of group chat system widely used in Open Source development environment. Each organization will have a channel (Eg. #pardus-devel – pardus linux developers channel), where you can login and chat with a registered nickname. For open source project, the chat server will be irc.freenode.net.
To use IRC, you can install XChat client using: sudo apt-get install xchat
or use the webchat interface http://webchat.freenode.net/
For basics of IRC chat, read http://www.irchelp.org/irchelp/irctutorial.html
You can use the assigned contact person’s nickname to contact him over IRC.
IRC is a public chat where many are interacting each other. Please do not spam or ask stupid questions like (I am newbie. I want to participate in GSOC. Plzzz help.)
Write proper words rather than using chat language like ( u thr. plz. i gt ths idea frm). Do not flood the channel. Be very decent and formal over the chat channel.
Before you ask questions, I strictly recommend read this article to following the hacking culture:
From my experience, there will be a group of people from the GSOC organization who review the project proposals. They will have an internal voting system. They vote induvidually and rank the list of proposals. According to the number of project slots assigned for the organization, they select the higher ranked proposals. The most higher preference is always to get successful completion of projects. So they look heavily at the strength of your project proposal. The project proposals that consist of as much strong details to support the fact that you are going to complete the project get accepted.
Usually you will find a specified format for the project proposal for each of the organization. Once the application period opens, you will come to know about the format.
To have strong proposal I recommend to include the following things:
For example, if you are contributing to Webcam app – Cheese, you should check out code of cheese using Git version control and build the application from source code and try out things.
All the best with your project proposals.
Following my previous post on autocomplete, here comes a spell checker program. First of all I would like to warn you that this is the worst and inefficient spell checker you have ever seen. The most slowest and CPU expensive . I wrote this program long ago for fun. I thought of sharing the code I wrote.
The purpose of this post is to show how to write a spell checker in few lines by using the Levenshtein distance algorithm. This is not a context sensitive spell checker. The following spell checker program checks each word, and if it has spell errors it will list out some word suggestions.
Levenshtein algorithm is used to calculate distance between two words Levenshtein distance. It is defined as minimum number of edits needed to transform one string into the other, with the allowable edit operations being insertion, deletion, or substitution of a single character. See wikipedia for more details on the algorithm.
This spell checker program uses a dictionary file. Every Unix like OS comes with a default dictionary file (in the directory /usr/share/dict/). Make use of that. To spell check a word, following program calculate Levenshtein distance by comparing all words in the dictionary. If the Levenshtein distance equal to one, those words will be listed as word suggestions. If the distance is zero, that means the word is a valid dictionary word. Checking across all the words in the dictionary is very expensive. Hence in order to reduce the number of comparisons needed, we use a subset of words in the dictionary having word length equal to, plus one and minus one with respect to the word we are checking for spell error. For implementing that, we have built a hash called wordsmap (python dictionary). The key used for the hash is the word length and the value assigned is a list of words of words having the word length as the key.
Let us do a test run with the program:
We have seen autocomplete functionality in many applications and devices. Have you ever thought of implementing it with an efficient data structure? If not let us learn the data structure trie and implement a basic auto complete using python.
According to wikipedia:
In computer science, a trie, or prefix tree, is an ordered tree data structure that is used to store an associative array where the keys are usually strings. Unlike a binary search tree, no node in the tree stores the key associated with that node; instead, its position in the tree shows what key it is associated with. All the descendants of a node have a common prefix of the string associated with that node, and the root is associated with the empty string. Values are normally not associated with every node, only with leaves and some inner nodes that correspond to keys of interest.
Let us go through requirements for an autocompletion functionality:
* Search should be fast
* Memory should be efficiently used
* Easy to build the data structure
We use a dictionary as data store for storing the words. When we type few letters of a word, we can do a regular expression match each time through the dictionary text file and print the words that starting the letters. Using the command grep we can print the words starting with letters as follows.
But it is a quick and dirty hack. But it is very inefficient if we need to use it in a large scale because, it needs to read the entire words in the dictionary and compare character by character each time. It is costly operation.
Trie data structure is a tree with each node consisting of one letter as data and pointer to the next node. It uses Finite Deterministic automation. That means, it uses state to state transition.
This is a trie for keys “A”, “to”, “tea”, “ted”, “ten”, “i”, “in”, and “inn”. When we need to do auto complete for the starting characters, “te”, we need to get output tea, ted and ten. Instead of checking regular expression match for all the words in the database, it will make use of transitions. First character is t. Then in the root element, it will make transition for ‘t’ so that it will reach the node with data ‘t’, then at node ‘t’, it will make transition for next node ‘e’. At that point, we need to follow all paths from node ‘e’ to leaf nodes so that we can get the paths t->e->a, t->e->d and t->e->n. This is the basic algorithm behind implementing an efficient auto complete.
Implementation of auto complete was a question asked for programming round of Taggle.com recruitment process held at our campus. I implemented it in python with Trie and I got placed .
Here is the python program I wrote:
You can run it as:
You can download the source files from here: autocomplete.tar.gz
Note: The image of trie used in this post is taken from wikipedia.We have seen autocomplete functionality in many applications and devices. Have you ever thought of implementing it with an efficient data structure? If not let us learn the data structure trie and implement a basic auto complete using python. According to wikipedia: In computer science, a trie, or prefix tree, is an ordered tree data [...]
Here is an opportunity to win a copy of my book, Linux Shell Scripting Cookbook published by Packt Publishing. Three winners will be selected to win a copy of e-book. Read on for more details on how to receive a copy.
I hope you had read about my book from book release post. In case you missed the announcement, Linux Shell Scripting Cookbook is a book consisting a collection of 119 shell scripting recipes along with descriptions organized into nine different chapters according to the usage and subject. If you are a beginner or an intermediate user who wants to master the skill of quickly writing scripts to perform various tasks without reading the entire man pages, this book is for you. You can start writing scripts and one-liners by simply looking at the similar recipe and its descriptions without any working knowledge of shell scripting or Linux. Intermediate/advanced users as well as system adminstrators/ developers and programmers can use this book as a reference when they face problems while coding.
This book is written in cookbook style and it offers learning through recipes with examples and illustrations. Each recipe contains step-by-step instructions about everything necessary to execute a particular task. The book is designed so that you can read it from start to end for beginner?s or just open up any chapter and start following the recipes as a reference for advanced users.
All you have to do is comment on why you would like to have a copy of the book in the comments. For a comment in the comment box of this page, you will be given with a single token. You can also tweet about the book by clicking the tweet button in top of this post. If you tweet about the book, you will be given three tokens and you have more chances to win a copy of the book. Once you tweet, leave a comment with URL of your tweet status.
The duration of this giveaway is for 7 days. The giveaway ends on February 21, 2011 after which the commenting on this post will be disabled. Three winners will be randomly selected from the ones who have commented by considering the number of tokens for each candidate. Ensure that you use a valid email in the comments form so that Packt publishing can contact you if you win. Winners will be announced on Tuesday, February 22, 2011 and also contacted via email about their prize. Good luck!
Congratulations to the winners.
Abhishek Patil, Praveen Kumar and Subeen N will receive e-books
KDE-India is organising conf.kde.in, an event for Qt and KDE contributors and enthusiasts to meet up, share their knowledge, contribute, learn, play, have fun and create limitless possibilities using Qt and KDE technologies.
KDE-India is a group of volunteers who are a part of the worldwide KDE community, and have been meeting up at various FOSS events in India. We have given Qt and KDE talks at various colleges and universities in India.
The main objective is to organize an all-inclusive conference on Qt and KDE in India that would cater to beginners as well as experienced folks.
This is not a high end geek conference but a beginner level conference where you can attend and learn a lot.
One of the primary goals of this conference is to make students aware of latest Qt and KDE technologies and trends. They will get a chance to listen and interact with Indian and international KDE contributors, industry professionals and Qt/KDE experts. We highly recommend students to take part in the event and learn how to create amazing Qt and KDE applications for desktop and mobile platforms and be part of the community. To find out more, do read our selection of talks and workshops on the conference website.
Block the dates 9 – 11 of March 2011 on your calendar to attend confKDEIn.
See you at confKDEIn.
To read more or register for the event, please check out http://conf.kde.in
This release is the 5th major installation release that has shipped since the project had begun in 2003 by TÜBİTAK BİLGEM (Center of Research For Advanced Technologies Of Informatics And Information Security) and offers many new features among a more stable experience.
Some of new features that we made in Pardus 2011;
This is the time to unveil the news. Probably, many of my friends know that I was writing the book for last 6 months. Now, it is the proper time to let all of you know that I authored a book on Linux Shell Scripting, The Linux Shell Scripting Cookbook by Packt Publishers, UK.
Language : English
Paperback : 360 pages [ 235mm x 191mm ]
Release Date : January 2011
ISBN : 1849513767
ISBN 13 : 978-1-84951-376-0
Author(s) : Sarath Lakshman
The book is written in cookbook style and consists of 118 recipes which showcases many real world scripting problems and solutions. The book is divided into 9 chapters based on subjects Basic commands, File related operation, Text processing, Networking, Backup and Archiving, Internet and web, System administration, etc.
I have been using purely GNU/Linux platform for more than 5 years now. UNIX-like operating systems had always amazed me with the command-line experience. The life would have been much difficult without the terminal and command-line. It takes some patient and experience with different problem environments to master the art of command-line and scripting. In many circumstances, problems such as text processing can be performed in one-liner scripts (Crafted line of command by joining pipes and filters). But the same problem can be solved in a very complex way using large number of lines of code. I have compiled many recipes from my experience to teach how to solve problems in simplest and beautiful manner with minimal lines of code.
It was in last April (2010), I happened to see mail from Packt publishers in search of author for Python Cookbook. That is how I thought of writing a book. I felt that experience I gained from shell scripting contests as well as daily usage experience would be enough for me to write a book. The process of authoring book was a good experience apart from my previous experiences on authoring articles for Linux For You. It takes more effort than an initial version of written material to make it to a productive and useful stuff during the editing process. Also I could learn more. The book is available in paperback as well as PDF e-book format.
Anyway, it is something really glad to have a book in hand that I wrote. I have a dedicated page about my book on this website. Please have a look to Book page. You can also go through publisher website packtpub.com for buying this book. You can download a sample chapter of the book from Book page in this website.
I am currently waiting for the paperback author’s copy to reach me by post.
As book release special, I have moved the website from my previous domain www.sarathlakshman.info to www.sarathlakshman.com. Please update your feed readers and bookmarks to point to this new website.
Synced Ghostscript and Cups package patches from Fedora for Pardus 2011 and Corporate 2
Renamed module-kvm package to module-compat-kvm in Pardus 2011
Bumped iproute2 to 2.6.37 in Pardus 2011
Bumped media-player-info to 12 in Pardus 2011 and Corporate 2
Bumped iso-codes to 3.24 in Pardus 2011 and Corporate 2
Added Suse patches to nbd-utils and also a default configuration file
Moved setuptools into system.devel in Pardus Corporate 2
python-cryptsetup is reviewed and got 2 ACK. It’s now in 2011 and Corporate 2 repositories!
Dropped power.d hooks from pm-utils package in Pardus 2011 and Corporate 2 as they are fragile and causing serious problems
Updated Release Notes for Pardus Corporate 2
Prepared Live installation image project files for Pardus Corporate 2
Sent a bunch of debug capture to Matthew Garrett for the autosuspend bug
Enabled mono bindings for Avahi in Pardus 2011
Bumped upower to 0.9.8 in Pardus 2011 and Corporate 2
Bumped Cups to 1.4.6 in Pardus 2011 and Corporate 2
Added two bugfix patches to Ghostscript in Pardus 2011 and Corporate 2
Moved iniparser under review for Pardus 2011 (#16153)
Moved nbd-utils under review for Pardus 2011 and Corporate 2 (#16151)
Moved dash under review for Pardus 2011 and Corporate 2 (#16152)
Figured out that the “Plugged USB devices not recognized until lsusb is called” problem (#15445) in Pardus 2011 arises on systems where USB autosuspend is not working correctly. Reverting 3 autosuspend patches taken from Fedora fixed the issue for all reporters. Upstream bug opened, relevant acpidump and lspci outputs from reporters are sent.
“Wireless is not enabled on Lenovo 3000 v200″ problem (#15967) in Pardus 2011 is caused by the acer-wmi module which gets loaded on some Lenovo notebooks causing interference within the rfkill interface. Patch was available for Lenovo Ideapad S2. Relevant information for Lenovo 3000 v200 is attached to the already available upstream bug.
It seems that some of the recently reported fatal exception in kernel oopses (#16076, #15141) in Pardus 2011 kernel is caused by the udev 165 update which triggers a kernel bug in libata. I’ve reverted the relevant ata_id changes in udev package and prepared a test build for sending to complaining users to see whether it helps or not.
Fixed a l10n bug in Thunderbird package (#15928) causing localized reply headers not to show correctly. It was actually caused by our default prefs.js which was overriding those headers with the Turkish ones (sigh) and setting the reply_header type field to a wrong value. Dropped all those things from prefs.js to let Thunderbird handle localized reply headers.
I was busy with lots of interesting things and some upcoming projects. I have been hectic due to authoring of a book. I will lift the veil and post with more details in few weeks .
Recently I had opportunity to look at the facebook Socialgraph API. Found it really cool. I never expected this much from the API. We can access every element that we access through facebook.com with the API. The SDK comes with so many languages like JS, PHP and more. It was interesting to go through the documentation page: http://developers.facebook.com/docs/.
Facebook API presents an interesting Facebook Query Language (FQL) which has similar syntax of SQL. Using FQL we can access entire data available on Facebook to be manipulated in the form of tables. As a simple example, there is a table ‘friends’ having two columns friend1 and friend2. We can get the list of friends for a user by using their user ID. Each user is provided with a user ID. My Facebook UID can be found out here : http://graph.facebook.com/sarath.lakshman.
Hence using the query “SELECT friend2 from friends where friend1=UID” we can fetch the list of friends user IDs. Using this IDs, by querying in the table ‘user’, we can get the names of the friends.
When I had to download photos from some of my facebook friends photo albums and tagged photos. I found it hard to manually filter out URLs and download the photos. But, after went through the facebook API, I had a thought ‘what if I could write a simple application to fetch all the photo URLs for a friend’s albums. In a couple of minutes, I wrote an FQL query to list all the photo URLs and downloaded the photos using wget. I forwarded by thought, I felt it would be great if there is some utility to build a zip of all photos from albums of a friend we search for. Also if we could get the photos by user tag that would be great. In the next day I started working on it. I remember it was a night. It wrote code in the entire night and I forgot to sleep. Before the sun rises, the the facebook application was completed with basic stuff. I showed the application to few of my friends and received the feedback that it would be great if we could download selected photos as zip. I thought of making the application public after designing a cool UI and feature enhancement. But I delayed in lack of time to work on it. I wasn’t getting enough time to hack on it. Last day I decided to make whatever I had written public with a feature addition to download selected photos. The facebook application pics-packet is public now. I have submitted the app for approval in facebook app directory.
I’m sorry guys. It has a poor UI and less-efficient code. It needs tuning. Unfortunately, I don’t have enough time to hack on it now. Maybe, will work on it later.
Here is the app:
and on facebook canvas: http://apps.facebook.com/picspacket/.
NOTE: Before you try the app, please go through the help. Else UI might seem confusing for you.
As you may know, service-manager of Pardus uses COMAR backend to handle service status.. And we have a simple interface for this. I have made some change to service-manager ui for user requests from our Turkish Community OzgurlukIcin.com (ozgurluk icin means “for freedom” in Turkish)..
Users wanted to see service descriptions in service-manager and I tried to find a proper solution, here is the result;
While using the Package Manager of Pardus, I have always been annoyed with the animation of package list.
In Package Manager, when user clicked on a package -to get its details-, details comes with sliding-down animation. And then if user clicks the same package, details goes away with sliding up animation.
But, when user clicks a different package while one of them opened before, it closes the first one directly (no animation) and then shows the new one with a sliding down animation. A small touch;
--- trunk/kde/package-manager/manager/src/rowanimator.py 2010/10/20 13:51:19 32615 +++ trunk/kde/package-manager/manager/src/rowanimator.py 2010/11/07 20:29:59 32912 @@ -45,16 +45,27 @@ self.direction = DOWN self.row = None self.lastrow = None - self.timeLine = QTimeLine(300) self.t_view = updater + self.initTimeLine() + self.hoverLinkFilter = HoverLinkFilter(self) + self.t_view.installEventFilter(self.hoverLinkFilter) + def initTimeLine(self): + self.timeLine = QTimeLine(300) QObject.connect(self.timeLine, SIGNAL("frameChanged(int)"), self.updateSize) QObject.connect(self.timeLine, SIGNAL("finished()"), self.finished) + self.timeLine.setDirection(QTimeLine.Backward) - self.hoverLinkFilter = HoverLinkFilter(self) - self.t_view.installEventFilter(self.hoverLinkFilter) + def animate(self, row, reverseOld = False): + if self.row >= 0: + if not self.row == row: + self.timeLine.setFrameRange(DEFAULT_HEIGHT, self.max_height) + self.timeLine.start() + QObject.connect(self.timeLine, SIGNAL("finished()"), lambda: self.animate(row, True)) + if not reverseOld: + return - def animate(self, row): + self.initTimeLine() self.setRow(row) self.timeLine.setFrameRange(DEFAULT_HEIGHT, self.max_height) self.timeLine.start()
Fixed it :) Here are the results;
The old one;
The new one;