Monday, August 1, 2011

QuickBox–A quick point-in-triangle test, and an example of how algorithm descriptions matter!

In this blog post I'm going to post something which is rather unrelated to my usual topics. I'm going to talk about how can minor changes in concept when coding, can have dramatic impact on your code performance. I also introduce a technique that I “developed myself” while coding the problem. When I say “developed myself”, I mean that I actually took time to code all the ways people describe the problem’s solution – although all seem very similar, the performance difference is huge.

While working on my GSoC project, I needed a fast predicate to check if a point is inside a polygon (specifically, a triangle). The test doesn't have to be accurate, but it must be sound in the sense that when it states a point is outside, then it must be outside. To do so, I decided to use bounding box testing - see if the point is in the bounding box of the polygon. Computing the bounding box of a group of points should be easy - just keep track of minimal and maximal X and Y and you should be done. So, how much can you screw it up?

Well, apparently, you can screw pretty damn hard. By coding without thinking, you can make this twice as inefficient without even noticing! Thinking before you code, to try and merge cases, can apparently be very productive. My solution will be referred to through this post as the QuickBox solution.

Explanation

The QuickBox test uses an improved version of a common idea. The usual checks see if in a point, one of it's components is larger/smaller than the matching component in all of the triangle's points. The implementation here takes this one step further, under the assumption we are willing to say that a triangle made of 3 collinear points contains no point at all (not even it's own points). This is fair for most triangulation libraries, that simply don't accept such triangles.

The idea is like this: If all the points of the triangle have the same boolean result for testing order (using <=) against a component of the point (for all i, Pt[i].x <= P.x is the same) then the following cases are possible:

  • All have the same value of the component. But then all the points of the triangle are collinear so it's practically empty!
  • All triangles points have the component larger than the tested point. So the point is outside!
  • All triangles points have the component smaller than the tested point. So the point is outside!

Note that principle explained above is also applicable for polygons with more than 3 vertices.

Implementation Analysis

Let the points of the triangle be A, B and C. Let P be the point we are testing.

Naïve implementation

This is what people would usually do if they translate directly the description “See if all polygon points are on one side of the input point (check that for each side)”

Compute:

((Ax <= Px) && (Bx <= Px) && (Cx <= Px)) ||
((Ax >= Px) && (Bx >= Px) && (Cx >= Px)) ||
((Ay <= Py) && (By <= Py) && (Cy <= Py)) ||
((Ay >= Py) && (By >= Py) && (Cy >= Py))

Total Cost: 12 double boolean operations, 11 binary boolean operations


Border implementation

This is what people would usually do if they translate directly the description “Find the the border on each side of the box, see if the point is beyond it”

           ABx           ACx                       BCx
xMin := (Ax <= Bx) ? ((Ax <= Cx) ? Ax : Cx)) : ((Bx <= Cx) ? Bx : Cx))
yMin := (Ay <= By) ? ((Ay <= Cy) ? Ay : Cy)) : ((By <= Cy) ? By : Cy))
ABy ACy BCy

// OPTION 1 - Requires computing all of ABx, ACx, BCx, ABy, ACy, BCy
xMax := (! ABx) ? ((! ACx) ? Ax : Cx)) : ((! BCx) ? Bx : Cx))
yMax := (! ABy) ? ((! ACy) ? Ay : Cy)) : ((! BCy) ? By : Cy))

// OPTION 2
xMax := (Ax >= Bx) ? ((Ax >= Cx) ? Ax : Cx)) : ((Bx >= Cx) ? Bx : Cx))
yMax := (Ay >= By) ? ((Ay >= Cy) ? Ay : Cy)) : ((By >= Cy) ? By : Cy))

Compute: Px <= xMin || Px >= xMax || Py <= yMin || Py >= yMax

I'll assume that a trenary op is just one boolean operation and I will also ignore the need to save the values computed in the process such as ABx, etc. And even with that is still costs a lot!


Total Cost:



  • Option 1: 6+4 double boolean operations, 15 binary boolean operations. Actually, this method is rather inefficient, unless binary boolean operations are much much cheaper than double ones.
  • Option 2: 8+4 double boolean operations, 11 binary boolean operations. Exactly the same as the naïve method!

Note: separating the computation to one coordinate a time, can cut memory consumption by half.


QuickBox implementation, This is my method!

This is what people would usually do if they translate directly the description - “See if the point is on the same side of all the polygon-points”

xPBorder := Bx <= Px 
yPBorder := By <= Py


Compute: (((Ax <= Px) == xPBorder) && ((C->x <= Px) == xPBorder)) ||
(((Ay <= Py) == yPBorder) && ((C->y <= Py) == yPBorder))

Total Cost: 6 double boolean operations (7 if we can’t save values (not 8! see below)), 7 binary boolean operations.


Note that you can expand this to polygons of much more vertices, using the trick above to avoid repeating computations, while keeping with only 1 variables which is neat :) Work on one coordinate (component each time) and keep an accumulating variable that after it’s initialized with the first comparison, you just compare to it! When done with that coordinate, if indeed you found no proof that it’s outside, pass on to the next coordinate and repeat.


Conclusions


It’s pretty easy to see that the QuickBox method beats the hell out of the competition! Less memory, less computations, and all because we checked “all points are on the same side” and not “all points are on one side” (and checked that for each side). So, when someone tells you how to implement an algorithm, try to rephrase his sentence. It can be critical!


Just some context about this post - I’m implementing a geometric algorithm that was given in 55 lines of pseudo code with ambiguous meanings. After passing 2500 lines of implementation (real C code), and after having to actually add many cases which were dealt with because the algorithm was phrased ambiguously enough with no hint to these cases, I started being very picky about how people describe their algorithms :P I spent 1.5 months of my GSoC on this, which is way more than I expected.


So do us all a favor – if you know how something works, describe it exactly and clearly, so other people can implement it correctly and efficiently. It’s preferable to have 100 lines of code that are readable in 15 minutes, instead of 15 lines of pseudo code which are quickly read but take a 100 minutes to understand! (But don’t over-do it! Bombarding with details will make people like me fall asleep when they read your article…)


[Final note: I don’t have any criticism at the original article author – he did explain it so that people from the field would understand (and eventually, even I understood so it shows he did his job very well). I just came from a different field since this is a side dependency of my project, and not it’s main part… This simply made me aware of how much phrasing of an algorithm can change it’s implementation for people who don’t think exactly like you]

Tuesday, June 7, 2011

Rescuing data from my dead laptop

Unfortunatly, my laptop's sort of "died" yesterday. The usual procedure in such cases is to rescue your data, and then send the laptop to a service laboratory. However, rescuing the data was a bit harder than I expected it be... I'm using a dell laptop with windows 7 x64, and here are the steps I took:
  1. Create a Windows 7 system repair disc (using my brother's laptop)
  2. Boot the laptop from the repair disc
  3. Run Startup Repair - didn't help
  4. Run Windows Memory Diagnostic - which produced the lovely warning:
    Hardware problems were detected. To identify and repair these problems, you will need to contact the computer manufacturer.
  5. Complain about my crappy luck
  6. Re-boot the laptop, and in the boot options menu choose the Diagnostics tool
  7. After running the diagnostics, I got a more detailed error:
    Error Code 0123
    Msg: Error Code 2000-0123
    Msg: Memory - integrity test failed
  8. Googling that error shows that it will require reinstalling/replacing of my (RAM?) memory
So, that wasn't so bad. The problem is now, how to get the data out? Here is where things became tricky:
  1. Boot the laptop from the repair disc
  2. Connect a USB disk on key (8GB, FAT32 file-system)
  3. Open the command prompt supplied in the repair disc and start copying files
  4. After filling the Disc-On-Key each time, I emptied it on my brother's computer
And here it all goes wrong:
  1. Got an error of a file which is too large for the given file system. I had a 4.35 Gb file of a virtual machine hard disk (VDI file). The maximal file size for FAT32 file system is 4Gb-1b :P
  2. Format the Disc-On-Key, and choose an NTFS file system
  3. Copy the big file and continue happily :)
  4. Got another error - file is too big. Got this for a 9Gb file which represents the hard disk of another virtual-machine.
Now, we have a problem. The largest USB storage device I had is 8Gb, and in this minimal windows recovery environment I don't have any tool to split files!

After some thinking, I remembered that 7zip can create a split-zip, i.e. one zip that is split to several small chunks. Even better was the fact that 7zip has a command line portable version! So I quickly downloaded it, and went back to my dead laptop to try it. But, it didn't work... Apparently, in the repair disc, the files required to run 32 bit executables over 64 bit machines are simply not installed, and the command line version came only in 32 bit...

After scratching my head, I went back to browse my homework folder from the operating-systems folder. I remebered that we wrote a splifile utility in C, which uses only windows commands (for example, CreateFile instead of fopen). But, my version of Visual Studio is the Express edition, and it didn't have the 64 bit compiler...

So, I downloaded mingw64-w64 and went to compile my program. After some struggles with problems regarding unicode programs (solved here), and some other problems, I finally managed to get it compile. I went to back to my repair-disc boot, and it worked!

It took me several hours to solve all this, but I finally managed to do this. I don't have many complaints to microsoft or dell - the diagnostic tools were really easy to use and the repair disc booted without any problems. It's just too bad that the people at microsoft didn't think a split file utility is necessary when trying to rescue data... Overall, I began this procedure with great pesimisem, and I finished with a smile and no lost data :)

Regarding my GSoC - this will prevent me from working several days this week, since it's still the last week of the semester, so I still can't sit in front of my desktop computer. I'll make up for the lost time later somehow.

Sunday, June 5, 2011

[GSoC-2011] Bi-Weekly update #1

Hi!

After seeing enough student post of weekly updates, I decided that I should probably also give some progress report. I finished porting the poly2tri library to C! My C port can be found here.

Just compiled it today with gcc and not g++, and it feels great to see it working. And when I say to see, I mean that I created an SVG output tester so that you can see it in any modern browser :D
I still have some optimizations that can be done, including maybe some more documentation of the C api (especially for the constructor-destructor conversion from C++ to C), but it's usable enough for the GSoC as it is. Note that most API changes were simply from p2t::SomeClass::GetFoo to p2t_someclass_get_foo (where the object itself was added as a first parameter of the functions).
It was in "almost C" state on wednesday, but then memory leaks happened (solved with valgrind) and some stupid compilation errors...

At the weekend I went to a short vacation on the dead-sea (pictures soon!) and I had 4 people to discuss Chew's second algorithm (which I should implement next) with during the long ride to the hotel. So hopefully with their help it should be quick(er).

That's all for today :)

Friday, May 27, 2011

The end is near, and so is the beginning

Pictures from Yehuda Poliker's Concert on the
Student-Day, and a picture of my GSoC kit. Cellphone
pictures, so low quality :P
There is a feeling of an end in the air. The end of university, another chapter in my life. Yesterday I took part in the Student Day party at our university - there were amazing concerts by fantastic artists, including Yehuda Poliker, Monica Sex, Hadag Nachash and more. The Student Day is a known symbol of the end of the year, which happens 2-3 weeks before the end of the semester. The fact that is practically my last year as a student (I will have one last course left for the next semester, but that doesn't really count) does start to get in, and I am gradually getting used to this.

This week was also the official beginning of the Google Summer of Code coding period! After getting my cool GSoC kit (see the picture) 2 days ago I really felt that I'm a part of this great project - many thanks to google for organizing this! Anyway, I almost finished porting poly2tri to C. Once this is done, I can start coding my project. The milestones for my project are:
  1. Port poly2tri to C (from C++), a library for generating Constrained Delaunay triangulations for given polygons.
  2. Implement Chew's Second Algorithm to create adaptive meshes from CDT's*
  3. Implement code to create polygons from Black/White (1-bit) channels (The edges where the color differs should be described by polygons)*
  4. Combine all these to create an adaptive mesh from a Black/White channel (which symbolizes a selection area)
  5. Create a triangle mesh renderer with color interpolation between vertices (actually, Cairo may be able to do this!)*
  6. Implement the Mean-Value-Coordinate cloning, using these above, as a GEGL operation*
  7. Add some GUI and put it as a GIMP tool
Marked with * are the steps that would require the actual work, most other steps should hopefully be trivial. But again, hopes and reallity don't necessarily agree :) When I applied for this GSoC I knew there was code to do adaptive mesh generation from polygon outlines. It's only too bad that none of the code to do this is small and in a GPL compatiable license :(

I hope to finish everything untill step 4 (and parts of 5 if I'll be able to use Cairo) untill the midterm, but I can't really set the midterm goals yet since I haven't started to seriously code yet because there is still a university semester going on for the next week or two.

To all students out there, good luck in the exam period! And for the GSoC students, good luck with the projects! :D

Tuesday, April 26, 2011

I’m doing a Google Summer of Code!

My application for a Google Summer of Code project for GIMP was accepted! =D
After being around the development team for a year or so (and hanging around the IRC even more), and after I couldn’t apply last year for technical reasons, this year I will get my chance.

Here is the initial description of the project, taken from my project page:

The project I intend to implement is something called Adaptive Cloning (aka Seamless cloning). Basically, the idea is that cloning parts from one image to another usually does not end well. This is because of different exposure/white-balance settings, or simply because of different lighting conditions.

The idea is to implement an algorithm which would allow to copy a part from one image, and paste it seamlessly into the other; the pasted area will be blended to fit the destination image locally. There are several techniques to do that, and the most known one is called poisson image cloning. The problem with most of these algorithms is that they are expensive (computation-wise) and are not suitable for interactive editing and previewing, unless you use hardware acceleration.

The suggested technique for my project is based on an article from Siggraph 2009 (includes demos and videos), which shows realtime performance (both on the GPU and the CPU*). The user would paste a some area from the clipboard and will then be able to "blend it in" according to it's environment.

I'm open for any suggestions regarding usability, ui integration, or anything which relates to the project. Feedback will be more than welcome!

* Note that I'm not sure for which sizes on the CPU it preforms on realtime, but it's still much more cheap computation-wise than most other techniques and a small lag of few seconds is something which should be acceptable for this sort of workflow.

GIMP has 5 projects for this GSoC – if all these projects succeed, GIMP will gain a major boost in it’s capabilities. This year’s projects are:

I would also like to congratulate Blender (formally, The Blender Foundation) for an astonishing amount of 17 GSoC projects! If there is any project who can do anything with 17 students, it’s Blender. Congrats also for Inkscape for 4 GSoC projects.

Good luck to my fellow GSoC students, especially the GIMP (and Blender) students. I hope I will finish my project – I already learned from Bat`O last year that it is feasible to code something like this ;)

The list of all accepted projects for all organizations for this year’s GSoC can be found here.

Small Help Wanted

I searched without success for a small GPL compatible library for generating quality triangular meshes (example) from a given outline (probably a quality constrained Delaunay triangulations / conforming Delaunay triangulation) - I need this for my project. I haven’t found any library that is both small and GPL compatible. If anyone knows any such library, please tell me - it will save me lots of work and guarantee less bugs in the final result.

Edit: It seems as if poly2tri may do the job of creating a CDT (Constrained Delaunay Triangulation), and on that I can apply Chew's second algorithm. This is not optimal, but it is feasible since creating the CDT was probably the hard pard. If anyone finds something better, I will still be glad to knkow!

Sunday, April 17, 2011

Safe programming - Are universities doing it wrong?

In the last 2 week I was unavailable because I had a “monstrous exercise” from university. Everyone indeed complained it was huge, but when other people saw the size of my code (2000 lines) they were shocked – this was because my code was about twice larger than the one of other people. It’s not that I suck at programming, and it’s not that I re-invented the wheel or anything like it. It was simply that my code was safe, where the code of most other people I saw wasn’t because we didn’t have to make it safe.

The assignment was to build servers and clients for a Nim game with several players (instead of just 2 like the original version) along with a build-in chat. What was supposed to be the point of the exercise was to make the server non-blocking, i.e. to use select() with only one thread. For example, this means that if we temporarily can’t read data from one client, we will still check if we can send him data or communicate with other clients. But let’s leave that technical part, since the thing that actually made the code complex was the other “minor” things.

Note: I have no criticism at all at the course staff of this specific course, It was simply an example of a university policy.

In general, when programming academic tasks, and especially when it’s in C, unless it is a course in security or some other special cases, you are allowed to assume the following assumptions:

  • Input from the user is valid (Less often than the rest of the assumptions, but still common)
  • We won’t run out of memory (in C, malloc() won’t fail)
  • Data received over the network is in the format we expected
  • No one will try to brake our system maliciously

Now, let’s analyze in how many places we can attack the server/client from our exercise:

  • Entering a wrong move to win the game
    • Example: Enter “A -5” instead of “A 5” to add 5 cubes to a stack instead of deducing (which is what that should happen)
    • Potential Result: Win the game by cheating
  • Sending large chat messages to attack client/server
    • Example: The protocol requests to send the size of the message to be read over the network. Most people used a short (16 bits) variable for that = meaning 65Kb message sizes are legal!
    • Potential results:
      • Buffer Overflows
        Most people allocated a static buffer of size 1024 bytes (1Kb) for receiving messages since someone asked if 1024 is a valid assumption on input length. Reading 65Kb to a one Kb buffer will crash our program or lead to execution of arbitrary code.
      • Wasting resources
        Allocating 65Kb for each client (to read chat message progressively until receiving them is done) is a lot of memory
  • Abuse the lack of timeouts on clients
    • Example: Connect with many clients, and do nothing after the connection was initialized.
    • Result: Can DDoS the system very easily, after finishing the maximal available number of connections, or waste all the resources if no such limit is set.
  • Send messages over the network in invalid format (can happen if client/server are broken)
    • Example: Send random binary junk
    • Result: see server crash or behave strangely
  • More…

Out of the above problems, I tried to take care off most of these problems, and I believe my partner and I took care of 90% of these cases. This is where we made our life harder – we didn’t have to handle any of these!

Now, obviously there were no requirements to handle these cases. This was done in order to allow students to focus on the subject of the task – non blocking network communication. And that is indeed something which should be done – otherwise you’d spend most of the time of the exercise (like me) on things which are barely relevant to the current subject.

So, after stating that we must take these assumptions, why am I writing this post? Because there is not even a single course in security and/or secure programming which is mandatory! Or at least this is how it is in my university (and I’m in a relatively respectable one). This means that a student can finish his entire degree without taking care of these problems even once! The implications of this can be devastating – if we code like we did in university, in the outside world, our programs will have more security holes in them that Swiss cheese!

Three weeks ago, I had to give a lecture (in a seminar) about common programming mistakes that make software unsecure. At first I thought most of the mistakes I was going to discuss were ridiculous, but then I saw them pile up in more and more “respectable” places – both in commercial companies (Apple, Microsoft, …) and open-source organizations. And like other programmers, I also do these even though I hate to admit it.

So, what can Universities do about it?

  • Changing the requirements of all exercises to be secure
    • Bad solution! The amount of work will make all students crash as if someone was DDoSing them :P
  • Mention the risk of each assumption inside each exercise description
    • Good!
  • Add mandatory courses/lessons in application security and/or safe programming
    • Better!
  • Instead of a one time experience during your studies (one mandatory course/lesson), have one task that should be safe in each course (where applicable)
    • Best!

And what can we do about it?

  • Try to show people we know were their code is dangerous, and increase their awareness.
    • If possible, try to attack their code and show them the actual risks! (because I heard enough people saying “The risk is only theoretical – nothing will happen”)
  • If you are a student, show this to the professors in the department of application security to make them tell the university to change it.
    • Some of them weren’t aware of the fact the state is so bad, and when they heard they started working to integrate the solutions mentioned above
    • But this is less likely to work…
  • Make our own code safe!

That’s all for today. Spread the awareness about security, and if you (as a student/programmer) found this post helpful, please let me know.

One last thing – I applied to GSoC (before the deadline), I’ll post my application later :)

Friday, April 8, 2011

Powerful experience

Today at 6:40 am, near the Jaffa (יפו) clock tower, I began to walk. As I moved towards the Charles Clore park (גן צ’רלס קלור), people started to pour in from the near-by streets and slowly the stream of people grew to hundreds of people. The sky was low in the sky, hidden by large thin clouds, and rays of light blazed the sky through the clouds. When I finally reached the park, there were already thousands of people waiting.

At 7:00 am, I started moving towards the start line, along with many other people. Some ran bit, others stretched, and everyone were preparing. At 7:10 am, we were allowed to enter the gathering area before the start line. Gradually the area was filled, with 5,000 people, and it became pretty crowded. While we were waiting, some electronic music was played in gigantic speakers to get us all pimped up with energy. It drizzled a bit, and after 2 minutes it stopped.

At 7:25, a pistol shot into the air, signaling the beginning of the Tel-Aviv Marathon (מרתון תל-אביב) Urban Run Race - A quarter of a Marathon (10 Kilometers) race for people from all ages. Inside the huge “body” of participants, I started to move slowly towards the start line, and when I crossed it I began to run.

After several hundred meters, when the speakers were far behind us, there was a magical moment. It was silent, and the only noise that broke the silence was the soft pound of thousands of shows on the road. It was surprisingly silent, I thought that it would be much noisier.

After the first few kilometers, in which we went through a sleeping City, we saw people on the sides. Some of them simply stared, some have prepared in advance and stood with cameras and tripods, and some cheered the giant cloud of runners. Many of the cops who blocked the near-by streets were smiling at us, as if signaling us to go on. The city gradually came into life, shaking of the sleepiness that held it previously.

When we reached the middle of the race, we reached the first water stop. Many people holding bottles of waters waited for the runners to take & go, some were from the event staff, but some were certainly volunteers (they didn’t wear uniform). They all cheered and gave us motivation to continue. One thing that really made me smile, was one person who set-up a table on his own and gave water to the runners several hundreds of meters later. Every 2-3 kilometers there was a DJ/band playing music to keep us going.

Finally, when reaching the final 2 kilometers, we ran near the beach where we saw the deep blue ocean. At that spot, many people already gathered to cheer, photograph and play us music. It was a down-hill part, and everybody accelerated (knowingly or not) towards the finish line which was already in the horizon. On the right, we were passed by people participating in the Handcycle race that also took place as part of the event.

Hundred meters before the finish line, we already heard the gigantic speakers from the initial gathering area. Then came the urge to sprint forwards, to finish it as fast as you can, proving yourself you can do it.

It was the first time I participated in a race, and the feeling was fantastic. For me, like most other people, it was not a competition, but simply a chance to prove yourself that you can do it. So I proved myself I can do it, and I broke my own record and set it to 49 minutes and 20 seconds (previously, I did 9 kilometers in 51 minutes). More important than the record, was the participation, and prooving to myself I can do this and in a good time.

I think that one of the things that made this race an important experience for me, was the huge range of participants – ages 16 and up, were many of the people where in their 20’s-40’s (so I was relatively young – only 63 people including me where in the category of 16-19). There were people who ran in pairs or small groups, others ran in teams (including army teams), and some wore shirts in memory of people.

One thing that really touched me, was people who wore shirts in memorial of Shneior Cheshin (שניאור חשין). He was an athlete who trained for the Ironman Triathlon earlier this year, and was ran over by a drunk/drugged driver. That driver left him there to die, and made many excuses for that later when he was caught. It was a very tragic event which symbolized how careless are some people when it comes to driving responsibly and when it comes to ignoring injured people unless you know them.

Another thing which wasn’t possible to ignore, were “very big” people that decided that they need a change. I saw 2 like these, that made every possible effort to run, even if slowly. Even if it’s a bit late, I must admit it was impressive to see people who decided to change their life-style and participated in this race. I don’t know these people, but I wish them lots of luck.

Many thanks to the person who made me start running last august. They always say you need some motivator to start, and once you are in it it’s easier. She made me start (without knowing she did), and I owe her more thanks than I can describe in this post. Last year I was simply not in-shape, and I barely did 2-3 kilometers. In the last few months I took it seriously and improved to 10 kilometers.

Hopefully I’ll see you next year, On March 30 2012. I’ll do the half-marathon track (or if I’ll have enough luck, I’ll do the entire marathon)
Have a happy weekend :)

Friday, March 18, 2011

GIMP was accepted to GSoC 2011

GIMP was accepted to Google Summer of Code 2011!


Congrats also for Inkscape, Blender, Scribus for making it to GSoC 2011! For the full list of projects, see GSoC 2011 participating projects.

Tuesday, March 1, 2011

First GIMP Developer Meeting - A success!

I worked hard to arrange it, but it paid off - We had a serious gimp developer meeting, with most developers attending it :)

Thee meeting page, including the agenda and log can be found at:
http://gimp-wiki.who.ee/index.php/Hacking:Dev_Meeting_28_Feb_2011

Some of the decided actions in the meeting:
  1. schumaml and LightningIsMyName fix wgo?
    wgo is a shortcut for the GIMP main website - we need it to have auto-updates again
  2. Alexia and mitch take care of redirecting wiki.gimp.org
    We need to make the domain point back at a working wiki, the original one died of spam and Alexia Death has a new working one here
  3. Enselic makes a draft of a GIMP roadmap and sends to gimp-developer
    Let's get some priorities!
  4. everybody subscribe to bug mail and TRIAGE BUGS
    We get toooooo many bug reports, we need to start filtering them
  5. mitch, make a development release soon
    Yes - that's right! GIMP 2.7.2! Now we just need to define soon :P
  6. LightningIsMyName takes care of next meeting
    Hehe. I'll do that with pleasure :)
  7. setting pages on the wiki to discuss changes in different topics
    Too many changes are done solo and may not be agreed upon by everyone - this is because of lack of places to show plans
  8. LightningIsMyName gets a list of projects on the wiki by tomorrow, developers review the ideas by email or by commenting on the wiki. Saturday (March 5th, 2011) is hard dead line for finalizing the project list!We want to get to GSoC, so we must have a list of projects ASAP! I'm going to work on this and try to get this done tomorrow night
  9. all devs PM/Email LightningIsMyName username and email
    Yeah, so if you are a GIMP dev and you don't have an account for the wiki yet, tell me!

Next meeting: March 14 2011 10:00 PM CET (GMT+1)

If you want to influence GIMP development, and/or contribute, come and attend the next meeting. Just note that the agenda will be decided by email several days ahead, on the developer mailing list - so submit your ideas there. You can also jump to irc://irc.gimp.org/#gimp and people will help you there if you want to help the GIMP project.

Monday, February 28, 2011

GIMP Developer Meeting

Today (February 28th, 2011), at 10pm CET a meeting of GIMP developers is scheduled on the GIMP developer IRC.

Agenda:
  • GSoC 2011 - ORG Application deadline is in 11 days!
  • Bug fixing priorities
  • Future development?
  • Make an official wiki working again (i.e. make wiki.gimp.org pointing at it)! Can be done either by making http://gimp-wiki.who.ee/ the official wiki, or potentially using some other available servers (will be discussed in depth on the meeting)
  • Make a roadmap on the official wiki
  • Try and decide on clear release policy for beta builds - I personally would like to see more recent beta releases, and the last one was 7 months ago!
  • Anything else? =)
If you want to discuss GIMP's future, GSoC this year, and just listen, please come. We will meet on irc://irc.gimp.org/#gimp (Users without IRC client can connect using this link).

Edit: The wrong time was displayed - it's february 28th, not the 27th

Saturday, February 26, 2011

My name is Antivirus. I hate Robots.

I have a confession to make - I’m using an antivirus on my Windows 7 computer. This word may seem unfamiliar to some Linux users who claim they don’t need it, and to some Windows users who claim that these stuff are viruses themselves. It never did any trouble, and it did save me several times, but today it was just an annoyance.

I was programming a game for the course I took in Computer Graphics. When I ran it, it exited before the first line of code and I got the following series of warnings:

The error messages

My first cynical thought was “Great! I programmed a virus!”. My brother’s reaction was “Wow – your code sucks so much that an antivirus recognized it as dangerous”. So, I rebuilt the executable (after the antivirus kindly removed it for me :P) and then I tried to scan it. The result was “No threats found”. I got the result for all the libraries and files used by my program.

After scanning lead to a dead end, I tried to comment out my code and remain with a simple hello world program (which still loads the same DLL’s) – and I still got the error message.

So then I tried to google for help about this error in my antivirus and I found out that it’s generated by a dynamic protection mechanism, which unlike traditional antiviruses, does not check the signature of my files.

So, what on earth was going on? An “Hello World” program which does nothing was causing a problem because of it’s dynamic behavior, while other programs which used the same libraries were OK? That does not make any sense.

Took me 30 minutes to figure this out:

  • The theme of the game was robots. Since it was the Visual Studio version, the logical name for the executable was VSrobots.exe.
  • The word robot is often used for describing certain types of viruses and malware.
  • The only difference between this program and others which used the library, was it’s name.

So, I renamed the executable “HelloWorld.exe” and a miracle happened – it ran perfectly without any warnings from the antivirus.

Conclusion: Don’t name your executable files after things which may sound like viruses. Otherwise ****** Antivirus will block them :P

Note: I didn’t mention the name of the antivirus, to save some troubles that may raise because of it (mainly flame wars and other similar stuff regarding which antivirus is better – I have seen many wars like this in the web). Therefore, please refrain from posting the name of the antivirus in the comments, even if you recognize these dialog boxes.

Friday, February 4, 2011

It’s Open-Source, Live with it!

Today, I saw something concerning, something which I think that I should share with you. Since GIMP’s call for help and developers, there was a small thread in the Blender Artists Forum that tried to raise support for GIMP, and make people aware of the lack of developers. While some replies were great to hear, and made me feel good as a GIMP developer, some simply pissed me off. Another event which amazed me, was to hear the reactions of some ungrateful people to farsthary’s job offer from 3D Coat (link is broken, he removed the post). I have to say that I’m a great fan of Blender, GIMP and Inkscape, and these are some of the most amazing projects that prove the ability of a community to build something together. But community is a double-edged sword – it can sometimes destroy things that took years to build.

Sunday, January 30, 2011

Compiling (Pre-Packaged) GIMP on Windows!

Finally, after all the promises, I'm proud to announce that I finished the Guide for compililng (a pre-packaged version) GIMP on windows! The technique is using MSYS and MinGW, and without Cygwin - which means it's a native windows build!

What does it mean Pre-Packaged? It means a source package that you download from the website, and not the latest one from the version control system (Git in GIMP's case). Pre-Packeged version are not exactly the same you get from Git, and they passed an additional step that makes the compilation a bit easier. The additional steps for compiling the Git versions will be posted (hopefully) later this week.

On which version was this tested? On GIMP 2.7.1

The guide can be found here.
Update - fixed a small mistake which caused some stuff to be extracted to the wrong place.

Wednesday, January 19, 2011

Lessons learned from Writing a RayTracer

As I promised in my post about finishing my ray-tracer, I'm publishing the math equations I used in order to save some time for other people, when doing the intersection calculations.

You can find the document here: The 3D Equation Sheet

And here is a list of ridiculously annoying bugs, that I encountered during writing the ray-tracer. Although some of these seem really trivial, I'll list them in hope that they will save you some time when you write a ray-tracer. Even though these seem trivial, I know that some of them are bugs that other teams also had.

Common Bugs:
  • When you shoot a ray from the eye and find an intersection, make sure the item is actually in front of the eye and not behind it!
  • When the ray from the eye intersects with a point, and you shoot light at the point, make sure the light is on the same side of the surface as your eye - so that you won't see light on the other side on opaque surfaces!
  • When calculating the intersection with a cylinder, which has a limited length - if the first intersection is "too far" from the origin of the cylinder, the second intersection may actually be in range! So check both...
  • Rays of light should be shot from the eye of the camera, and not from the image plane of the camera! (It matters when checking if an object is behind us or not)
  • When building the plane where x=6, the equation is x-6=0 and not x+6=0. Trivial, but not noticing this missing minus wasted an entire day for me…

Monday, January 17, 2011

[StructureGraphic] Drawing DAG's – Part 2

As I promised yesterday in my first post about drawing DAG's, today I’ll describe a big part of the “nice-looking” graph layout algorithm. It’s very simple and it’s described in the following video:


If you are reading this blog from a feed, click the link to the real post to see the video

Corrections:

  1. at 9:46 I said the result with iterating by the topological sorting would be uglier - I meant prettier...
  2. I somehow switched the image of the best result from the graph… Here is the Correct Image Result