Planet CDOT

November 22, 2009


Nadim Michaty

Trudging on through 0.2


Check it out world — an on time release (although this blog post isn’t)!

There isn’t much new, but I plan to make up for it with some pretty cool stuff for 0.3.
So after the first release, the feedback I got suggested less UI, so that was what I tried to work towards in terms of achievement.

This release seems very scrawny in comparison to the amazing progress being accomplished by other students of my class, mainly the Processing.js crew. But check it out–here are some of the goals I have set up for my 0.3 milestone:

  1. Code a function to disable next/prev button if current message is last/first
  2. Code a function to allow seeing a short
  3. Code a function to allow skipping spam using navigation
  4. Test extension’s display flow on a netbook
  5. Navigation buttons that look nice
  6. Consult other netbook users and seek review on basic UI left available

This release point is the result of one four-hour and one three-hour sessions in my office, where all I need to test front end code between edits is a lightning quick firing up of Thunderbird. These two days of work resulted in a total of +7 -2 lines of code, but I find victory in the fact that that is 7 hours of material I don’t have to learn again. I moved forward from understanding how to add elements to nodes (in layman’s terms: to insert a new control with its own attributes and programmability into item groups used in the base code of Thunderbird) and got comfortable with a new set of different controls and attributes.
My first aim was to get rid of the top toolbar to free up a good chunk of vertical space for the message content portion, so my plan of attack was to ask if element removal is possible in the #extdev channel. I was hooked up with two attributes to choose from, removeelement and hidden.
Removeelement sounded like a bucket of fun, so I gave that a try on the whole mail-toolbox toolbox. That actually ended up being kinda volatile, as the fs window would no longer recognize any selected message, and simply show a blank white inner space. So I dug one level deeper into the node and removed the two toolbar elements individually, one at a time, and found that it was the top [File, Edit, View, etc...] that shouldn’t be removed. Ever.
But even with one toolbar taken down, it still doesn’t look seamless. So the out-in-the-open answer became hidden. mail-toolbox hidden=”true”, that is. Great success!

Next thing to do was add a Prev & Next button for navigating through emails with the mouse. It took me about almost two hours and several different placements to get the feng shui just right and make sure that they wouldn’t warp or displace themselves like this:
s1
s2

w1
w2

but the two young buttons seem satisfied in their new home behind a spacer. Their auto-fitting with the vertical space was fixed by simply removing the align=”end” attribute I put in. Now they just need funky arrow icons to express their adolescent creativity, and stuff.

Oh yeah and I fixed the minimum version of Thunderbird problem. I set it to 2.9.*, since it seems the safest bet any 3.0pre build.

Also along this road I tried some other attributes that ended up not being necessary, but still cool tools to understand. The first is observes, which I noticed was on a most of the toolbox items, and insertbefore/insertafter. observes is like a radio to a broadcast tower, a broadcaster, sending the signal to adhere to any changed default attributes in the broadcaster. There’s a better explanation here. And have a XUL element reference also for good measure.

And along this road a few more cool feature ideas popped into my head;
People might like to be able to see or know if the next or previous message is junk and would prefer to skip it.
Perhaps add an easy way to zoom the size of text, both in and out to accommodate many different display settings.
A drop down list of message folders (inbox, sent, deleted, etc), with folder change going to the latest non-junk message, but I’m not dead set on keeping this idea if testers don’t feel it necessary.

Will keep you updated.

by buddhatron at November 22, 2009 07:01 AM

November 21, 2009


Xiaozhe Shi

study notes for fstream

print a file backward


int main(){
Student S;
fin.seekg(0); //back to the first
int i=1;
while(!fin.fail()){
fin.seekg(sizeof(Student*(-1)), ios::end);
if(!fin.fail()){
fin.read((char*)&S, sizeof(Student));
cout << s << endl;
i++;
}
}
}

by Xiaoshi (noreply@blogger.com) at November 21, 2009 09:12 PM


Chi-Lea Tran

OOP Practice: Basic copy command

Well, I just finished writing the header file for IO_TextEdit. But most of my time was spent trying to make a cp command that imitates the same command from linux.

So here's what I have as a foundation:

int main(int argc, char* argv[]) {
  FILE* fpSrc;
  FILE* fpDest;

  if (argc == 1) {
    printf("%s: missing file operand\n", argv[0]);
  }
  else if (argc == 2) {
    printf("%s: missing destination file operand after `%s\'\n", argv[0], argv[1]);
  }
  else {
    fpSrc = fopen(argv[1]), "r");
    fpDest = fopen(argv[2]), "w");

    if (fpSrc == NULL) {
      printf("%s: cannot stat `%s\': No such file or directory\n", argv[0], argv[1]);
    }
    else {
      while (!feof(fpSrc)) {
        fputc(fgetc(fpSrc), fpDest);
      }

    fclose(fpSrc);
    fclose(fpDest);
  }

  return 0;
}

Of course, this could be cleaner, and there's some other things missing.

But in order for this function to be exactly like the regular "cp" command, it has to be able to handle more than one file. Example:

> cp [source1] [source2] [etc] [destination directory]

I have no idea how to handle directories, and even more so if the directory doesn't exist. I think I'll need to do a bit more research on it.

by djchillz86 (noreply@blogger.com) at November 21, 2009 05:10 PM


Matthew Daniels

Assignment 2 Progress / Problems


I’m still working to finish up IO_Form,  just checking to make sure that everything is coded before I move on. I had a few problems trying to figure out how to call the functions correctly but I’ve gotten past that part right now.

I’m going to move over to the VEdit function as soon as I’ve finished.

by cdnpadawan at November 21, 2009 03:43 PM


Alex Londono

0.2 Release

Unlike my 0.1 which was very late, I’m going to go against my way of being, which is submitting things only when I think they are 100% working or good enough to show. I found out today that Edward Sin submitted a function called HashMap (I didn’t even know he was in the class still.).

That so happens to be the same function I posted about on Nov. 12, 2009 on my blog. It’s great that he’s done, I was just ticked off I wasted time on it (I’ll get over it). On a go forward basis, we should check peoples blogs to see what functions they are going to work on for their next release or come up with another structure to avoid this if blogging/lighthouse isn’t enough.

The functions I will take credit for on my 0.2 release are:

0.2 Deliverables

reverse()

saveStrings()

loadStrings()  -Still need to get it working with URL and local storage address, Null is what 
                      it keeps finding. (should find hack by sunday.)

deleteStrings() – Can’t be 100% sure it works until loadStrings works 100% to confirm the deleted address.

Functions I could not get done because they are 3D related              (pushed to 0.3), or I needed more time are:

saveBytes() –Setting Sunday as goal

loadBytes() –Setting Sunday as goal

deleteBytes() –Setting Sunday as goal

For 0.3

modelX()

screen()

screenX()

mouseX() / mouseY()

Other:

By Sunday I also plan to have all the corrections F1lt3r gave me on reviewing my functions for 0.1

They will also be pushed on git back for final review to officially put into processing.js.

by Tyrant911 (noreply@blogger.com) at November 21, 2009 09:54 AM


Anton Chan

btp 300

BTP 300 - Ljubo mentinoed that it was the degree course similar to oop344. I've been working on the workshops and will post the solutions to all of them soon.

I find that oop344 is lacking some of these properties, but then again, I think it's supposed to be more about self-study

Anton

by acfunktron (noreply@blogger.com) at November 21, 2009 08:18 AM


Edward Sin

My 0.2 Release

0.2 released.

In this release, I have implemented the HashMap function.

HashMap function contains the following member functions:

put(key,value)
get(key)
remove(key)
isEmpty()
size()
clear()

containsKey(key)
containsValue(value)

by MinyXO (noreply@blogger.com) at November 21, 2009 05:45 AM

0.1 Release

For my 0.1 Release for a project on Processing.js, I have coded the following functions for Processing.js:

split(str, delim), trim(str), arrayCopy(arg1, arg2, arg3, arg4, arg5), match(str, regexp), append(array, element), splitToken(str, tokens) and online().

I have tested all of the functions and made sure they work. But there's 1 issue on arrayCopy(): it does shallow copy only. In the original Processing code, it does shallow copy, too. But it seems like deep copy is more useful. This should be addressed on my 0.2 Release.

by MinyXO (noreply@blogger.com) at November 21, 2009 05:31 AM


Andor Salga (andor)

Release 0.2


My release 0.2 is complete! I have been working hard on adding and changing code in the Processing.js library for my open source class. Here are some scripts I wrote which demonstrate that the functions I have written work:


PJS Crayon Physics 0.1

qw(3D)

0.2 Deliverables

sort()

I found that Processing 1.0.8 sorts strings using a case insensitive search while 1.0.9 uses a case sensitive search. I have made this function mimic 1.0.9. I ended up having to throw away a bunch of code which compensated for this. If however I turn out to be wrong (1.0.9 has a bug?) I have the code ready to re-integrate.

binary()

The only limitation of this function is the user needs to specify how many bits they want back when passing in a byte primitive. This is because JavaScript does not differentiate between bytes and ints, JavaScript simply has a number type. Because I’m finding this problem in multiple places, I believe the best place to solve this would be in the JavaScript parser itself. However when passing in a char, int or color, there doesn’t seem to be a problem.

size()

I simply modified this function to include an extra static variable parameter, OPENGL. If this is passed in as the third argument, a 3D context will be acquired instead of 2D. I also had to modify bits and pieces of the library to make this work such as changing redraw(), init(), etc. I ran some 2D demos which are present in the Processing.js git repository and I don’t believe I broke anything.

background()

I have two concerns with this function. The first is related to the same problem experienced with binary(). If a hex value is passed into this function background(0×0000FF);, it will create problems. In this case the user wants to set the background color to blue, however by the time the script is parsed, the value has turned to 255 which will be misinterpreted as white. Again to fix this problem, the parser may need to be changed.

frameRate

Ah yes. I had fun making this variable available since Processing defines a frameRate() function. This obviously creates variable naming issues. I threw in a regular expression to change anything which does not resemble a call to frameRate, such as an assignment to FRAME_RATE. I tested my regular expression well, however there may be a case where it could fail. If this happens, I will update for the next release

For 0.3

I plan to implement the following features:

  • lights()
  • noLights()
  • pointLight()
  • ambientLight()
  • directionalLight()

by asalga at November 21, 2009 04:29 AM


Matthew Lam

Processing.js – Something Lost/Gained in the Translation

The nice thing about porting is the end result is already known. Comparing the effects of the original with the effects of the transcription is a good indicator of how close you are and whether or not you're on the right track.

Simple, yes?

Sure, at least in a perfect world where I could have my kitchen faucet yield hot chocolate and have my computer magically upgrade itself to the latest hardware and software. Alas, a perfect, honest-to-the-source, zero deviation transcription may not always be possible; such is what I have discovered while tinkering with pushStyle() popStyle() and boolean().

Below you will find I have not embedded the Pjs examples, instead I shall provide a link to another web page with the example on it. This is because embedding requires minification, and I'd rather not go through the frustration of minifying some of the larger examples. I'll provide screenshots of how the examples look using the Processing Development Environment (PDE) for comparison.

Differences in pushStyle() and popStyle()
The basic Processing reference example looks like this

and can now be reproduced in Pjs (Pjs demo here.)

But take a Pjs demo like this one. See the extra pops at the bottom? You can't do that in Processing. The PDE won't allow the Pjs example code to run; it'll see the extra pops, throw an exception, and refuse to run properly until the extra pops are removed. The closest approximation to the Pjs example Processing will allow looks something like this:

Pjs doesn't really concern itself with catching logical errors in the code. At best it just concerns itself with syntactic errors, and if there are any it simply doesn't paint anything onto the canvas. Saying that, the Pjs version of popStyle() has to be a bit more lax than its Processing counterpart and work with, rather than crash on, extra pop calls.

In this matter the solution is simple. Upon figuring out the pop call is extraneous, Pjs effectively ignores it and carries on. It must be one of the few times burying one's head in the sand actually makes the problem go away!
Differences in boolean()
Moving onto boolean(). Let's start out with showing a basic example based on the one found on the Processing website. It looks like this:


and it too may be reproduced in Pjs (Pjs demo here.) However, boolean() is afar more complicated beast than the basic example would imply. In this case it's a matter of how Java/Processing is very strict on the number and nature of arguments passed to a method, while JavaScript/Pjs is not.

Take for example the following this Pjs demo. Note how we're passing in doubles, booleans, ints, nulls, undefines, etc., and arrays with mysteriously empty elements. If you were to try the code in Processing it wouldn't work. For one, Processing's boolean() refuses to handle boolean variables, or double variables, or nulls, and other fancy things like that. In fact, the closest Processing example to the Pjs demo is rather more sparse and looks like this:


(Un)fortunately, Pjs' boolean() can't take the easy way out and throw away arguments it doesn't like, coughing up an exception, and making the whole show grind to a halt. Being JavaScript it's syntactically correct to pass a cornucopia of dynamically typed arguments into a function. Pjs' boolean() has to handle whatever comes its way gracefully.

As you can tell from the Pjs boolean() demo, I thought this was best done by having the function return "meaningful" results from arguments not normally handled by Processing's boolean(). Numeric arguments are handled like integers: zero values return false, non-zero values return true. Boolean arguments are just returned as themselves. Nulls and undefines return false.

Heresy!
I like to think I've cobbled together an acceptable compromise between how Pjs and Processing behave. I guess I'll find out soon whether this is acceptable or not when I try to push the code into the library.

by Matthew Lam (noreply@blogger.com) at November 21, 2009 02:10 AM

November 20, 2009


Sasha Atijas

Assignment 2 SVN problems?


I’m having some problems with the SVN, all of a sudden, a file is missing!

It’s IO_Field.cpp I believe. It used to be there, and now it’s gone…

 

Edit : Problem solved, it was there after all…

by satijas at November 20, 2009 11:13 PM


Roger Dicke

0.2 Release


Did I meet the requirements set in the project outline?

Yes, and no. Here is my target as stated in the project outline:

Data collected and entered using static analysis tool (related interfaces etc.)

After a few bugs (see below) I produced the static-analysis docs and test copied one to my user profile. However a problem with function pointers leaves some errors in the pages. (See the last bug) Until this last bug is resolved I will hold off on uploading the docs.

What was not accomplished?

Besides not having all the documentation for the static-analysis uploaded I had originally planed to write a little about using some of the functions in the external string classes. I will probably update my project outline 0.3 to have examples of the functions being used to have examples in the documentation. To me examples are the best things to have in documentation. I hope to accomplish this via an extension.

Bugs:

  1. xpcom analysis Makefile produces error about “.deps”
  2. xpcom analysis type-printer.js qualified member problem
  3. xpcom analysis Makefile for external linkage
  4. type-printer.js error with function pointer parameter

What does this release comprise of:

  1. Even though it is quite broken I do have an example of the static-analysis docs
  2. Bugs, some small some big.

by enderstruth at November 20, 2009 09:51 PM


Chi-Lea Tran

Relating IO_TextEdit to Game Programming

For those who know me well know that I'm aiming to do game programming. And strangely enough, the class I'm working on---IO_TextEdit---contains much of what I focused on when I started game programming---Tile Engines.

Tile engines basically work like this:
Tiles Class
This class loads an image and breaks up the image into smaller tiles (standard size is a 16x16 pixel tile). Best to describe what I mean by image:


Now if this image was loaded in the tile class, then each block you see above will be broken apart into a tile and given a number (first tile will be 0, next will be 1, so on and so forth)

Map Class
This class takes the tiles created in the tile class and makes a map with them. Because the tiles were given numbers, it's easy to create a map with a 2-dimensional array like so:

int myMap[5][5] = //myMap[X-COORD][Y-COORD]
 {
  { 0, 0, 0, 0, 0, },
  { 0, 1, 1, 1, 0, },
  { 0, 1, 2, 1, 0, },
  { 0, 1, 1, 1, 0, },
  { 0, 0, 0, 0, 0, },
 };

Of course, in an actual game, the map would be much bigger than 5x5. But, regardless, this is pretty much almost exactly how IO_TextEdit behaves in terms of storing text. Main difference is, rather than saving a 2D array of characters, it would probably be easier to save one string per class, and store the other lines via a link list/stack.

Another similarity that this would share is how IO_TextEdit is responsible for showing only a portion of the text at a time, given that the entire range of text is bigger than the window size. Games also do this when the screen scrolls over to show more of the map that is stored.

Big difference is that with IO_TextEdit, I wont have to worry about pixel scrolling, ha!

Luckily, I have done a tile engine before (albeit with Java), and the functions share a lot of similarities. So, hopefully, I can successfully work this and get it done right.

by djchillz86 (noreply@blogger.com) at November 20, 2009 09:32 PM


Armen Zambrano G. (armenzg)

hy-AM (Armenian) moving forward

Robert Sargsyan has been localizing Firefox into Armenian for a really long time through Narro.
He recently has contacted me to get things rolling since he has translated 98-99% (94% according to compare-locales) of the strings.

It is now my turn to get into the technical details and move it to mercurial. These are the steps that we have taken:
  • Robert ported the strings from 3.5 to 3.6 (Narro allows you to do this)
  • Through Narro's interface I exported the project and downloaded the zip file that it generates
  • I checked out my clone of the Armenian 1.9.2 tree
  • I overwrote my tree with the contents of the zip file
  • I run compare-locales like this:
    compare-locales /Users/armenzg/moz/repos/mozilla-1.9.2/browser/locales/l10n.ini .. hy-AM-1.9.2
  • I removed the files that were indicated to be removed
  • I pushed my changes to my repository
What comes next (if I am not mistaken)?
  • generate a langpack
  • submit it to AMO (submit page)
  • promote the add-on
  • get people's review
  • convince drivers to give us commit access
  • push the changes to the official Mozilla hy-AM repositories
We won't make it for 3.6 and I can't wait to see what the future holds for this language.

Big thanks to Serge!



Creative Commons License
This work by Zambrano Gasparnian, Armen is licensed under a Creative Commons Attribution-Noncommercial-Share Alike 3.0 Unported License.

by Armen Zambrano (noreply@blogger.com) at November 20, 2009 08:36 PM

libconic package needed for Maemo builds has been deployed

Thanks to puppet we were once again able to fix this easily.

All that puppet told the slaves to do is to run this command:
 su - cltbld -c '/scratchbox/moz_scratchbox -p apt-get --yes --force-yes install libconic0-dev'
 

What I did to fix this was:
  1. Check that a staging slave does not have that package "pkg-config conic --libs"
  2. Check that the file "targets/CHINOOK-ARMEL-2007/usr/include/conic/conic.h" does not exist
  3. Install it using a similar command that was used in a previous bug
  4. Check that "pkg-config conic --libs" returns what is expected "-lconic -ldbus-1 -lgobject-2.0 -lglib-2.0"
  5. Check that the conic.h exists where expected
  6. At this point we have a clear command to run by puppet and a "creates" argument.
  7. Deploy the patch in the staging-puppet server
  8. Login to another staging slave as root and run "puppetd --test --server staging-puppet.build.mozilla.org"
  9. Do checks 4 and 5 to see that the puppet changes took place
  10. Ask for review
  11. Commit and deploy to production-puppet
  12. Check a production like in step 8 and 9
  13. Check an hour later if a random slave has the change as well
Thanks to mfinkle for having written such a good description of the bug.

If you want to read more details check out "Bug 529462 - Add libconic package to Maemo build slaves"



Creative Commons License
This work by Zambrano Gasparnian, Armen is licensed under a Creative Commons Attribution-Noncommercial-Share Alike 3.0 Unported License.

by Armen Zambrano (noreply@blogger.com) at November 20, 2009 07:48 PM


Chi-Lea Tran

Assignment 2 Notes

So, Assignment 2 has been posted quite some time ago. And we've been working on it since the study break. But some new information has been provided throughout the days that helps us finish it off. These are just some notes.

First: some code has been posted for the following:

Please look in the repository for these codes if these are your classes

Second: there are certain classes that are dependent upon another:



This diagram is just based on my understanding of the classes. I did not include IO_TextEdit because it wasn't posted yet.

Anyways, I just hope the rest is posted soon...

by djchillz86 (noreply@blogger.com) at November 20, 2009 06:13 PM

Assignment 2 - ASOS regrouping

So, inevitably, after the course drop-out date thingum, there have been people who have dropped out of the course, which affects my group as well. As per Fardad, I needed to email our group and determine who's still in and who's out.

Our result, is in the form of this email I've sent out to our remaining group members:

I gave people more than enough time to reply to my message, and it would seem we are now short a few people. So, our members are as follows:

Chi-Lea Tran (me) ctran13
Victor Tran vvtran
Yong Hong yhong17
Yong Xue yxue11
Cong Wang cwang84

I have updated the Wiki to reflect this, and we now need to reorganize what people are doing.

Me: I'll still be doing IO_textEdit
Victor: You will be assisting me in addition to maintaining io_checklist
Yong Hong: You will still be doing the same things
Yong Xue: You will be doing the same things
Cong Wang: Since io_menu has mostly been done, you will finish it and finish io_label

Please let me know if you have problems with this.

Despite the shrinkage of our group, I still have faith, and know that we'll do a good job.

While I was at it, I also uploaded the Chat Logs of our group to the wiki. I thought I saved others... (but if you're in my group and reading this and have more logs---send them to me~~~!!!!)

So for sake of ease for people who care:


Uhmm... well, that would seem to be all I got in terms of notes for our group formation... I just gotta get going on this project and get things moving.

by djchillz86 (noreply@blogger.com) at November 20, 2009 06:12 PM


Yip Lim, Seow

IO_Form private > add()

i just want to see if i'm on the right track... well our group.. so can someone take a look?

int IO_Form::add(IO_Field* f, bool dynamic, bool submitter){

IO_Node *Temp = new IO_Node(f, dynamic, submitter);
if(Tail){
Tail->_next = Temp;
Temp->_prev = Tail;
Temp->_next = NULL;
Tail = Temp;
Current = Tail;
}
else{
Current = Head = Tail = Temp;
}
f->set(this);

return length();
}

by Yip Lim (noreply@blogger.com) at November 20, 2009 04:31 PM


Anna Sobiepanek

PImage


As I stated in my revised .02 schedule, I am working on PImage. I have been playing around with it but unfortunately I haven’t been able to get the image on the screen. Here is a run down of PImage:

It is a JavaScript class that holds attributes of an image: it’s width, height, format, and an array of each pixel it is made up of. It also has methods like: get(), set(), loadPixels(), updatePixels(), save(), blend(), copy(), mask(), filter(), resize(). You can check out the Java reference to read more on PImage.

My firs task if the constructor. The constructor either excepts: 0 parameters, the height and width, the height and width and format, or an image.   I decided to tackle the constructor that accepts and image.  This seemed simple enough as the image being passed in already has the width, height, format, and pixel array. Now here is the hard part, how do you get the pixel array? From all of the references I have read I get the impression that before you can load any pixels, you first have to use the loadPixels() which actually takes the pixels on the screen and stores them in an array. From this perspective though, the image should already be displayed on the screen. So i am following these steps;

  • load image using loadImage(“name.ext”) this returns a var img
  • create PImage by passing it the var img created above
  • display the image on the screen image(img,0,0)
  • calling the PImage loadPixels()
  • display the PImage on the screen

Unfortunately, I get nothing. I will let everyone know once its finally working though.

by annasob at November 20, 2009 03:52 PM


Andrew Grimo

Thunderbird Multi-touch 0.2 Release


Well after much fussing about with porting a bug fix that was intended for Firefox in dealing with multi-touch scrolling issues into  Thunderbird, I resolved the process and now have 3 finger swipe scrolling.  In the end, the final fix was removing a shortcut of “Ci” that was used in Firefox code to represent “Components.interfaces”.

My patch is posted here, and a sample package of Thunderbird for Mac with my patch in place is here.

After an excellent introduction to components and their idl interfaces in class today, this fix was almost simple.  In turn, this got the function that a firefox developer came up with which was to scroll a window by synthesizing a mouse scroll event.

Previously I had found a way to isolate out the 3 different panes in the Thunderbird main window…. being:  Folder pane, Message thread pane, and the Message pane.  In the end this wasn’t necessary, but it may come in handy for other custom actions.

Currently, preferences for these events aren’t propagating through Thunderbird properly and I have to learn the preferences system in Thunderbird to get it in use.  I imagine this will help to slim out the code and ensure better integration for extension/add-on capabilities for customizing the multi-touch behaviors.

There also seems to be a change in the behaviour of the synthensized mouse event that I am calling.  Since updating my revisions, the forced scroll behaviour now only seems to do a pageUp/pageDown event instead of a full scroll Top/Bottom.  I will need to investigate and maybe explicitly synthesize pageTop/pageBottom key strokes.

Posted in mozilla-bug-dev, open source

by Andrew Grimo at November 20, 2009 02:12 PM


Alex Londono

Back to processing ^^

I spoke with Andor and he showed me why it's in my best interest to save doing 3d functions for 0.3.
After going over the Mozilla Wiki Tasklist, I started freaking out

"OMG all the easy functions to work on are gone... Noooo!!" *mashing face on keyboard*

Then I got a bit positive and seen functions like:
saveBytes()
saveStrings()
loadBytes()
loadStrings()

None of the above functions were implemented into processing except loadStrings().
I looked in processing.js and found that loadStrings() was somewhat started because it accepted a URL, but it didn't have the JUICY part which is loading strings from a file.
       As most of you processing peeps know, you can't read/write to a file with JavaScript alone. So me being the brilliant computer science student I am, I started scheming,  trying to find a diabolically clever way to get around this (I don't know why my brain has to go against the grain. It screws me over in a lot of things.)

*I'm guessing this is about the point visitors lose interest  //posting picture*

*so are you refocused ;)  *

I started looking into PHP. I figured I can make javascript redirect to a .php page using the post method. Then in that post request I can stuff in a whole whack of data that I can then make .php store to a file.
To get the info back, I would repeat the process having the .php file send me the strings back using post.

I was so happy, I thought I had all the angles covered so I went to go speak to Dave  <- click it once

(thats when Chris Tyler helped me connect to the Mac. Thanks so much.)

I told em my idea all excited, thinking he would be like *wow... ya thats amazing, can't wait to see it.*
2.7 seconds later, Dave says "No no no, forget the php."






(he's not actually that mean)
Instead look into something called localStorage that is new in html5. Dave also directed me to another link and with that, I was off like a kid with A.D.D. in a Toy's-R-Us.
After randomly skimming pages with superfluous explanations, or so many dead ends, I stumbled on this amazing page.

*keep you engaged  Picture 2*















Now I started working on the saveStrings() and loadStrings() and I know I'm going to have to add a deleteString()
// to remove all/any of the items  accumulated into localStorage.removeItem('what ever');


I hope F1Lt3r doesn't hate the idea of using localStorage :(

by Tyrant911 (noreply@blogger.com) at November 20, 2009 10:47 AM

ZOMG finally connected to a Mac from Windows 7 using VNC.


I know this is out of left field for everyone except me, but I like doing little side endeavors to spice things up. For a lot of people this probably seems like a no brainer, and if it is, then you can stop reading because this is just me patting myself on the back.


To the rest of you who think it would be pretty cool to connect to a Mac computer using windows, the following is a small guide for other Seneca students who have access to this same hardware as I do. (Although the concept is what matters.)

You will need the following:

-Putty (ssh clicent)

-VNC viewer   (<- I used realVNC on a windows 32bit system)  other OS’s use their download page.

-a Mac computer you have access to with a vnc server installed.

Steps:

-Open putty.

-Under Session(on left) find HostName and enter the server you want. In my case it was the canada server. 142.204.133.7




-Under +SSH (in left panel) open the menu and click tunnels

-In destination enter 127.0.0.1:5900

-In Source port enter 5900

-click Add





-Click Open             *you will have a black login screen.*





-If you logged in successfully   then that means you have started your tunneling into the remote computer over port 5900.   *pretty cool eh?*

-Just leave this window open until you are done with the remote computer.

Now to connect so you can see the desktop:


-Open realVNC      




-Under VNC Server enter the following: localhost:5900

-Click Connect

-enter your account password for the account you have on the remote machine.

-BAM!!! you should see a new window open :)  VUALA!  *Halo3 music starts playing*


-Note When you log into the mac from the screen above, you may be disconnected because while logging in, the monitors resolution changed. To fix this, just reconnect and you will be on the Macs desktop.

by Tyrant911 (noreply@blogger.com) at November 20, 2009 09:32 AM


Niki Simmalavong

TortoiseSVN

While working on IO_Frame, I did not encounter any problems.

But commiting it to svn was a different issue. According to the Tortoise in 5, when I right click a file, it should have the option to commit (among other options), and the files should have icons with green or red on them.. No where to be found. I even reinstalled the program and same thing. Then, I saw there was a Tortoise Merge in the programs folder under TortoiseSVN. When I browsed for files in there, I finally saw the green and red icons, plus.. when I right-clicked a file, I saw the commit option! Awesome! Not really. From what it sounded like on the Tortoise in 5 page, everything I can't do, I should be able to. Is anyone else experiencing the same ordeal

For all I know, I missed a step. Even though I read the page about ten times... !

by miss. niki ` (noreply@blogger.com) at November 20, 2009 05:16 AM


Daniel Hodgin

A guide to git for the processing.js community (6 easy steps)


I’m going to be honest. I … hate … git.

Figuring out how to use git to push my changes up for 0.2 took longer than it did to write all my 0.2 code and all the tests and demos that went along with each function (over 1000 lines of code for all the tests and demos).

So to make sure I never have to go through this hell on earth again I’m writing a post to remind myself how to do it later and to help out anyone else who has trouble with git.

This is a ‘git for dummies’ tutorial strictly laid out for the people working on processing.js and the commands are all tailored to what we have to do from start to finish.  From cloning the repo locally to making changes, committing, checking status, and then pushing the changes to your fork.

This will include only the bare essentials to just do it and avoid any of the other crap you just don’t need to know and that will confuse you (and me later when I reread this to do my next releases). A more detailed tutorial for the basics is here.

This tutorial assumes you already have git installed and configured to connect properly.  If you do not have that then read an excellent post by Anna from my DPS909 course on how to setup git for the processing project here.

Steps:

  1. Create a fork of the latest code.
  2. Clone the repository to copy the latest code to your computer. OR pull the latest updates if you have already cloned before.
  3. Make the changes to the code with your new content.
  4. Mark your changed files by committing them and add a comment about the changes you made.
  5. Push your new code up to your fork.
  6. Request a pull of your new code from F1LT3R.

That’s it.  Here are the details

1. Create a fork of the latest code. If you already have an old fork and need to delete it just click the edit button and all the way at the bottom you’ll see a delete option.  git wouldn’t let me have 2 forks going at the same time. Or its a bug that when you click fork on the newest code it doesn’t let you and takes you to your old fork I don’t really know why or care anymore at this point.

From the picture below go to this address and select the fork button.  Give it about 20 seconds and refresh the page and it will be your new fork.

fork the master code base

2. Clone the repository to copy the latest code to your computer. OR pull the latest updates if you have already cloned before. I did a fresh clone in a new directory to make it simple.

clone repository

3. Make the changes to the code with your new content. Change whatever you need to in the code.

4. Mark your changed files by committing them and add a comment about the changes you made.  After making changes to your files you have to commit which files you want to prepare to be pushed up to the repository.

This picture explains the process well.

To commit use the command ‘git commit -a’ for all changed files. Or use ‘git commit <filename>’ for one specific file at a time.  Using commit only queues the file up  to be pushed soon it doesn’t send the file to the repository right away.  Add the attribute -m on the end of the command to specify a comment for the commit when it gets pushed to git hub later.

Look at this picture for how I did it

git commit processing.js -m 'comment'

5. Push your new code up to your fork. Now that your code is marked as committed and ready to be pushed you just have to push it.  First you can check the status of what is ready to be pushed with >git status.

git status

It says no changes added to commit but its wrong don’t worry about that the important part is it says ‘your branch is ahead of origin/master by 1 commit’.  Now your ready to push.

Type >git push git@github.com:<username>/processing-js.git

Assuming your fork is called processing-js.git just substitute <username> for your username.  Just check your fork location in the repository for what to put here.  It’s not jeresig/processing-js.git.

git push

6. Request a pull of your new code from F1LT3R. Go to your fork on the website and click the ‘pull request’ button. From the popup select F1LT3R from the list of people and click ‘Send pull request’ at the bottom.

request a pull

You can check if everything worked ok by looking at the network graph.

check if it worked

Hopefully it worked for you.  If it didn’t … then may your god have mercy on your soul.

by dhodgin at November 20, 2009 05:12 AM


Matthew Lam

DPS909 Project – Processing.js – v0.2

Returning to Ground Zero
First, a self-plagiarized recap. This semester at Seneca College I am taking a course revolving around open source development. As part of the course the students (yours truly being no exception) were nudged into getting involved in some Mozilla related projects, produce code for the real world, and see fist hand how the whole open source thing works.

I chose to work on Processing.js (Pjs), a JavaScript port of the Java-based Processing. More specifically, I volunteered to work on porting over the functions pushStyle(), popStyle(), and boolean().

On 19 October 2009, I threw release 0.1 out into the cruel world to fend for itself. Today I present release 0.2 to the world. Applause!

Not new, but shinier!
The watchwords for release 0.2 were: fix it. Release 0.1 included reasonably functional code for pushStyle() and popStyle(), and totally untested and untried code for boolean().

Bringing boolean() up-to-spec was the goal of this release and this was done by throwing together some test cases for boolean(). Bugs were indeed caught, squashed, and flushed down the toilet.

Although boolean() got most of the attention, the elder siblings did not totally escape notice. pushStyle() and popStyle() received their own test cases too. One issue was whether the pop should spit out alert popups if there were not enough pushes. I decided not to use any popups and just have a warning be sent to the console, where most users probably won't notice. pushStyle() and popStyle() were further improved to better handle the library's own variables; before they only managed canvas' variables with any proficiency.

Better to get it when it's pleasantly warm rather than skin-charring hot

What now?
Pursuant to getting my code merged into the Pjs library there are a few instructions I have to follow. So I'll make another post comparing the results of my Pjs code with those of the Java-based Processing code. As I have discovered it is not totally possible to faithfully port Processing to JavaScript. For example, Processing will throw exceptions and refuse to do anything if you try to pass an argument to a function and the function is not designed to accept, say, the variable type of the argument. But in Pjs you have to handle these weird arguments and preferably return some meaningful result. This comes up a few times in boolean(). But more on that soon.

For release 0.3, it looks like I'll have to choose another function to port over, or at least get started on even if I don't finish by the end of the semester. strokeCap() looks appropriately involving.

by Matthew Lam (noreply@blogger.com) at November 20, 2009 05:10 AM


Xiaozhe Shi

a bug in IO_Checklist

There was a bug in IO_Checklist.

To fix it, you need to change "for(int i=0;i<_len-1;i++)" to "for(int i=0;i<_len;i++)".


int IO_CheckList::edit(void){
int key;
bool done = false;
int x = 0;
int stat = 0;
while(!done){
stat = (int)_status[x];
key =io_flag(_format, IO_Field::getRow()+1+x, IO_Field::getCol()+1,&stat,_mode);
_status[x] = !!stat;
switch(key){
case DOWN_KEY:
if(x < _len-1){
x++;
}
else{
done = true;
}
break;
case UP_KEY:
if(x > 0){
x--;
}
else{
done = true;
}
break;
case ' ':

if(_mode == Radio){
for(int i=0;i<_len;i++){
if(i!=x && _status[i]){
_status[i] = false;
io_displayflag(_format, IO_Field::getRow()+1+i,
IO_Field::getCol()+1,0);
}
}
}
break;
default:
done = true;
}
}
return key;
}

by Xiaoshi (noreply@blogger.com) at November 20, 2009 04:21 AM


Daniel Hodgin

Processing.js 0.2 release


My 0.2 release has been pushed to git hub for review by F1LT3R  !

After 2-3 days of trying to figure out git I finally managed to get everything right and push up my changes.  Thanks to Matthew Lam for showing me how to delete my old fork it was giving me issues.  Once I did that I was able to refork the latest code and then clone, commit, and push the new stuff up.

In the process of banging my head against the wall to get git working I stuck all the commands into a word file so I would remember how to do it later for future releases.  I’m going to post a 2nd blog post after this tonight with a step by step guide to go from having nothing on your PC to downloading, updating, and sending changes up for review.

A full guide to the whole process.

Here’s a quick list of what I added in my 0.2 release.  Full details of the patch are here

Added:

  • nfc()
  • log()
  • exp()
  • tan()
  • asin()
  • acos()
  • atan()

I coded the map() function as well and then realized later it was already in the library but it was never erased from the list of remaining functions to be coded.  My code matched up with what was already in the library exactly though so I knew what I did was correct and that what was already there was correct.  I wrote a good test for map() so I’m confident what is already in the library is ok.

Fixed:

  • nf() crashing with infinite loop
  • color() for 1 argument passed in that has a value outside 0-255 it will be interpreted as a color and not a grayscale now

by dhodgin at November 20, 2009 04:19 AM

November 19, 2009


Boris Chao

Packaging Dehydra Part2

From my last post, I packaged up Dehydra for the next Fedora 13 release.

After packaging Dehydra up, I noticed I only packaged it up for the x86_64 architecture because I was building it on HongKong which was running Fedora 11 running on the x86_64 release.

Because of this I asked my professor, if there was an i386 CDOT Development System I can use to create the Dehydra package for the i386 machines. He told me that Germany was running on a i386 build, so he created me an account and off I went to create the package.

I use the same spec file I originally used to build the x86_64 package, and in a matter of minutes three i386 rpm files were successfully created.

The RPM Files Can Be Found Here: Project Repo

by Boris Chao (noreply@blogger.com) at November 19, 2009 11:35 PM


Carl Desautels

Progress on Assign2

I encountered several several problems in Assignment2 so far.

First:
was creating the project skeleton and understanding that pure virtual functions of IO_Field require child classes to create and implement each function. So in a sense you ensure children are using the current most relevant function at the time. These pure virtual functions are identified as:

virtual
randomFunctionName(int randomArgument) = 0;

Second:
I was having trouble deleting IO_Label::_data. _data is a void* within IO_Field which label inherits. So to my understanding a label always contains a field with or without data in it.

I haven't got to the problem yet. So I decided to copy strings passed to new labels into _data. Of course _data had to also be casted as a char* ! So that being said the label constructors would equal _data of its parent with str via:

(char*)this->_data = str; //or something to that effect

with the hopes it would call the overloaded operator= in label, then calling set which would simply strcpy str into a char* casted _data (because its a void pointer). This is where the problem was born.

the label operator= requires a label OBJECT as its left hand argument. So my call did not give any errors but at the same time it negated the overloaded operator=, because it simply assigned _data whatever str was. Which at the time is exactly what you need.

However as the constructor went out of scope str is destroyed and by extension the data that _data pointed to because you assigned to the same thing str. Then delete[] ing _data when label goes out of scope blew up, because you can't delete something that has already been deleted.

So that problem plagued me until I finally debugged and step from the CREATION of label to see the assignment of _data fail rather then step through the DELETION of label where I thought the problem existed.

so the proper call of operator= is and should have been

*this = str;

easy mistake, big headache.

Third:
My current problem is that i'm having a brain fart as to how to get IO_Field getOwnerTop and the rest of the optional functions working. I can't wrap my head around how to access the members of io_form(its parent io_frames top, left etc) from the IO_Form* _owner. member variable in io_field.

by Carl Desautels (noreply@blogger.com) at November 19, 2009 11:21 PM


Andrew Grimo

Detecting a Pane in Thunderbird!


From failure, to opportunity, to failure, to a success that will hopefully lead to another success… but inevitably, the cycle will continue!

What is all this referring to?   My work on implementing multi-touch controls on Thunderbird. It’s a bug in the Mozilla community and its a major project for my Open Source Development course.  You can also follow this on my project wiki page.

The Starting Point of this Phase

My 0.1 release acts as the starting point that I am referencing here.  Back then, I managed to get a 3 finger swipe in all directions to make an action over the 3 pane message window in Thunderbird.  The 3 page message window consists of a pane on the left for showing the folders in your email account, a pane at the top that is the thread of messages for the selected folder, and a pain below that that shows the selected message… no, that’s not a spelling error!

So although there was an action for all 4 swipe direction, it was the same action that impacted the same pane, regardless of which pane your cursor was hovering over.  The community concluded, and I agreed, that a distinct action should occur that impacts the pane that your are over top of.  So… this is where it begins.

A Possible Solution from a Firefox Bug

Along came a spider who sat down beside her and said…”check out this bug, its scrolling the page without requiring a focus event!”.  Ok ok…. it’s a little late at night and I’m writing blogs again… but seriously, out of what seemed like now where, I received an email from someone adding a “polished” whiteboard comment to a bug that I happen to have been following.

I was considering that maybe for my solution in Thunderbird, I need to do something that wouldn’t hold a focus to the content window itself (which contains all of the panes) and instead NOT hold a focus to the window in lieu of retaining it for one of the panes alone.  When I saw the bug linked above, they were trying to remove focus on elements on a webpage and thus allow the parent element to scroll so that the scroll event doesn’t get trapped by the child.

Try this  (… if you can)

You can try this if you have a mac with a multi-touch trackpad… Open up Firefox (I know, you are already using it, so this is for those who don’t KNOW yet…. ;-) …. and:

  1. Go to the Google Homepage (www.google.ca).
  2. Narrow the height of the window so that your vertical scroll bar appears.
  3. Place your cursor inside the textbox where you’d type in your search for Google.
  4. Now try and scroll by sliding up or down with 3 fingers on your trackpad.
  5. Witness the fact that it does not scroll the page at all!
  6. Now remove your cursor from the textbox by touch the Firefox image.
  7. Now scroll again as you did above… it scrolls!
  8. The solution that they created fixes this so that it scrolls for both situations.
    (unfortunately it seems that other code updates have compromised their proposed patch, so I’ve left them a warning comment regarding this).

Their solution calls an interface which has access to a function that synthesizes the affect of a mouse scroll event.  So I attempt to drop the code in place… by skipping some steps and I try to call the mouse scroll function directly… failure!

There is something too different from the way that there code is received in Thunderbird on this 3 pain window!

Seeing the Forest from the Trees

Ok, so I had some of their code in place, and simply be eliminating the window._content.focus from the page didn’t solve the problem as I had hoped.  Despair started to seep in, especially as the latest firefox updates had changed the code base to my gesture support comparison and now I had to monkey around reverting my code base back to its original state with Time Machine on my mac (the backup software on my laptop).  Issue after issue arose just trying to compile and get Firefox up and running so that I could learn from it a little bit better.  I did manage to get it back and ran through a walkthrough (by leaving a trail dump(“output messages”);  as the program ran so that I could track all of the events that occurred for a single swipe!

but thought about this… maybe the interface that is being called for the scroll event has a problem with the window pane that it’s focused on.  Of course, but how to isolate out which pane I was working on…..   of course!

Javascript: The Good Parts to the Rescue!

The first thing I was to do… (in hopes that this is the correct trail that I’m following while lost in the forest) was to get some code in place that would track what the current code is actually looking at.  For those real keeners… here’s a cleaned up PDF of the output so you can follow along.

Essentially, when the scroll event happened over the message pane, it was showing up as a XPCNativeWrapper object as the event’s target object.  For the other two panes, they were coming back as XULElement object items.  hummm…. I need more information so that I can start defining what is happening.

Do to some ungrateful slams against javascript… my teacher conceded to point out the fact that we have no idea how javascipt works and that’s why we think its crap!  So he gave a very quick introduction to its advanced concepts and also pointed out two Javascript books that were the only ones worth getting.  One of which was “Javascript: The Good Parts”.  Yes, the name implies correctly that there are a number of bad parts… the beauty is this book is super concise and distinguishes the good from the bad and points out in a simple approach the more advanced (and good) parts of Javascript.  SO with this book now in hand…. I march on.

Search through the Properties

I remember in a section that I read on properties and objects that you could enumerate through the properties and he even pointed out how to avoid the properties that were functions.  This was my next step:

let doc = aEvent.target;
var docNameX;
for ( docNameX in doc){
  if(typeof doc[docNameX] !== 'function') {
    dump("\n" + docNameX + " : " + doc[docNameX] + "")
  }
}
dump("\n end of property list  \n\n");

This produced some wonderful output.  The XPCNativeWrapper object was rather unreliable in providing output, but the XULElements had all sorts of interesting properties related to them.  The trick now was to find some conditions that would isolate them out.

Isolating the Pains…  I mean Panes!

So I had tested some various conditions and found that even if I tested a property with the javascript object method hasOwnProperty (I also could have been using it in the wrong context) would cause the XPCNativeWrapper to crash out when it checked for a true/false against this object.  I was expecting a false scenario, but instead as mentioned, the function beyond that test just fails.  So I discovered this alternative, which successfully isolated out the pane that I was swiping over top of.

if(doc['namespaceURI'] !== null){
  // it is at least a XULElement (folder pane or message thread page
  if(doc['tooltip'] == "folderpopup"){
    dump("\n  You are over the Folder Pane!");
  } else {
    dump("\n  You are over the Message Thread Pane!");
  }
} else { // its a XPCNativeWrapper (message viewer)
  dump("\n  You are over the Message Pane!");
}
dump("\n  Did you find your correct Pain!  \n");

Success!…

Next Steps….  How to trigger an event for these conditions based on the correct pane now being capable of isolation.

 

 

 

Posted in mozilla-bug-dev, open source

by Andrew Grimo at November 19, 2009 07:43 AM


Iyosias Tessema

Enough progress being made in Assign 2


It has been quite a while since I last blogged. However, since I have to blog about the progress I have been making in the oop322 course, here is a little something I did this week. Well, I am in the team++ group. Our group assignment is 75% done. I uploaded the IO_Vedit class yesterday. To tell you the truth, it is the easiest of all the classes in the assignment. Since all of the classes were taken by group members, I was left to do that. Anyway, it is straight forward. You have everything explicitly written as an instruction. I just followed it and did what was asked and run it.

by istessema at November 19, 2009 03:54 AM


Roger Dicke

Generating Graphs with Dehydra


Yay! Some pictures of my actual work!! Docs can be cool too! Well, if you think graphs are cool… Which for the record, I do.

Even though I am still having another issue, I seem to have Dehydra working well enough to generate some docs. Basically ignoring the previous issue, I came across:

set -e;  \
for class in `cat graphtypes.list`; do \
dot -Tpng -o${class}-graph.png -Tcmapx -o${class}-graph.map ${class}-graph.gv; \
done
/bin/sh: line 2: dot: command not found
make: *** [classapi] Error 127

This happens to be a nice, soothing error at this point. I found the dot command and tried yum search "directed graphs" which pointed me to Graphviz.

A quick yum install graphviz later and no problem! Up above are a couple of the graphs generated for what I will be making for the MDC.

by enderstruth at November 19, 2009 12:49 AM


Eric Austerberry

Assignment 2. A halfway through retrospective

So I've been asked to blog about my feelings regarding assignment two for OOP344.
Which is problematic really since I haven't DONE anything for it beyond a very basic skeleton. The function I'm in charge of requires another function to be complete so that I can inherit from it so until that gets finished there's not much I can do. the group I have seems good. I think all of us made it past the dropoff date and we all seem to know what we're doing so I figure I can get to work on building and debugging the function soon but until then there's nothing I can really say.

Overall I dislike this group based structure. While I see the POINT of it I can't help but think it's going to hamper up in the long run. Since this course has no actual labs in it and the assignment is so broken up by the group we can go the entire semester without any practical experience with entire groups of concepts we're supposed to be learning. I guess we're supposed to be doing things on our own but lets be honest, we have other projects and labs for other courses and as college students, we're lazy. Without any structured requirements to practice the skills most of us won't and when the final exam comes I foresee a lot of people not knowing what their doing.

by Erausterberry (noreply@blogger.com) at November 19, 2009 12:46 AM


Alex Vlahopoulos

Repo Master....ing... Stage 1

After being assigned the role of REPO MASTER for the DXR Project in SBR600, I began to make the repository.


The steps (repo notes from Chris Tyler)

A) Setup (1 time only)
1) gpg --gen-key

2) add to ~/.rpmmacros
%_signature gpg
%_gpg_name

3) gpg --export --armour keyid > i.e. RPM-GPG-KEY-[name]
--keyid =

B) Create Repository

1) create accessible directory
/var/www/html/ i.e. DXR

2) Put packages in that direcectory

3) rpm --addsign *.rpm
rpm -qip checks for signature

4) createrepo .

C) Create .repo file

1) put gpg public key* in /etc/pki/rpm-gpg/
*From Part A step 3

2) create .repo file in /etc/yum.repos.d


As of right now, only 2 out of the 3 packages have been added
to the repository.

by apvlahopoulos (noreply@blogger.com) at November 19, 2009 12:27 AM

November 18, 2009


Ehren Metcalfe

Analysis and type madness


I’ve created a simple Dehydra script to check for alwayszero functions. There are some issues however. Here’s the script:

function process_function(f, body)
{
  if (f.type.type.name == 'void' || !f.isVirtual) {
    return;
  }

  var alwayszero = true;

  function processStatements(stmts) {
    for(var j = 0; j < stmts.statements.length; j++) {
      var s = stmts.statements[j];
      if (s.isReturn && s.value != 0) {
        alwayszero = false;
      }
    }
  }

  for (var i = 0; i < body.length; i++) {
    processStatements(body[i]);
  }

  if (alwayszero) {
    print("alwayszero function: " + f.loc.file + " on line " + f.loc.line +
          ", column " + f.loc.column + " : " + f.type.type.name + " " + f.name);
  }
}

I actually have a more elegant version using a for in loop and iterate_vars but after watching that Douglas Crockford lecture I’m a bit paranoid about such things (both report the same results though).

After doing a bit of post-processing on the output I can report the following:

Functions meeting the above criteria are encountered 5920 times during compilation but most of these are duplicates since there are quite a few method definitions within include files.

Removing all of the duplicates reduces the number to 243 instances encountered (shouldn’t be too difficult to patch manually or with some shell script hackery).

A link to the list of 243 unique instances is here. The full output list can be obtained here (warning: big file).

Unfortunately I have encountered at least one false positive with this script:

gfxFont.cpp on line 960, column 35 : gfxFont::RunMetrics gfxFont::Measure(gfxTextRun*, PRUint32, PRUint32, gfxFont::BoundingBoxType, gfxContext*, gfxFont::Spacing*)

Viewing the definition here, I’m not sure why this function was captured by my analysis but I’ll have to investigate. Ultimately, I think doing this with a Treehydra script might make more sense. There’s already an existing script that does all the heavy lifting, but I haven’t been able to link this into an independent analysis pass on mozilla-central (yet).

Edit: Argh… found another false positive here:
nsSVGContainerFrame.cpp on line 264, column 82 : gfxRect nsSVGDisplayContainerFrame::GetBBoxContribution(const gfxMatrix&)

More Issues:

When I get the plugin ready to go with mozilla, I’ll add a script to xpcom/analysis to ensure that every function which has the user(("alwayszero")) attribute meets the above criteria.

As to excluding non-virtual member functions from the analysis, as far as I can tell GCC should already be able to optimize these away. Perhaps there’s a corner case I haven’t considered though.

Another issue I thought of today is that this script can potentially flag floating point functions as alwayszero which will result in bad things happening if I apply my plugin as originally written to them.

Luckily a fix to the plugin was not that difficult:

static bool
sane_tree_type (tree t)
{
  enum tree_code code = TREE_CODE (TREE_TYPE (t));
  return code == INTEGER_TYPE || code == BOOLEAN_TYPE;
}

 /* other stuff --- see previous posts for context */

static unsigned int
execute_alwayszero_opt (void)
{
  gimple_stmt_iterator gsi;
  basic_block bb;

  FOR_EACH_BB (bb)
    {
      for (gsi = gsi_start_bb (bb); !gsi_end_p (gsi); gsi_next (&gsi))
        {
          gimple stmt = gsi_stmt (gsi);

          tree lhs = gimple_get_lhs (stmt);

          if (is_gimple_call (stmt) && lhs != NULL_TREE &&
              is_alwayszero_function (stmt) && sane_tree_type (lhs))
            {
              tree zero = build_int_cst (TREE_TYPE (lhs), 0);
              gimple assign = gimple_build_assign_stat (lhs, zero);
              tree var = create_tmp_var (TREE_TYPE (lhs), "dummy_var");
              add_referenced_var (var);
              mark_sym_for_renaming (var);
              gimple_call_set_lhs (stmt, var);
              gsi_insert_after (&gsi, assign, GSI_CONTINUE_LINKING);
            }
        }
    }

  return 0;
}

This will exclude pointer types as well which is probably a good thing. If it’s really necessary to optimize away alwayszero REAL_TYPE functions this could be done as well, but they will have to be handled separately. Actually this should be pretty easy but it’s not really a priority at the moment. It probably makes more sense to check the type of the function rather than that of the lhs, but consider the above a proof of concept.

The next step is getting my plugin to work with the GCC 4.3.4 with backported plugin support used to build Dehydra which I now know will not be too difficult. The main issue is that the gimple_stmt_iterator is nowhere to be seen (even though it shows up in the Changelog … wtf) so I’ll have to use the block_stmt_iterator instead which will require a slight bit more ugliness.

The main problem though is getting a plugin to build under the GCC 4.3.4 with backported plugin support used to build Dehydra. 4.5 includes a separate plugin include directory and an easy to use -print-file-name=plugin flag to get at the directory. I’ve tried hacking a build rule into the existing configure script in Dehydra but I’m a complete noob with make and configure stuff so I haven’t had any success yet. Hopefully I can rectify this shortly.

Also, I’ve been attempting to get FF built with 4.5 but have encountered some issues. Once I get a nice sequence of steps that follows the instructions on this page I’ll bring this to the attention of the GCC people.

by ehren at November 18, 2009 09:42 PM


Ljubomir Gorscak

OOP344 Assignment 2 - My Current Status

I started working on Assignment 2 last weekend. My responsibility is io_form and I am going to to use the Linked List method. After spending some time trying to get started, I gave up and just reviewed Linked Lists instead.

On Tuesday November 17th, Neda and I met with Fardad to discuss some basics about Assignment 2. I recorded the meeting. You can download it here.

Tonight I will be meeting with a tutor in the learning center to help me get started with some actual code.

Saturday I am coming to the Seneca library to build a main that can test the io_form and io_field.

by Ljubomir Gorscak (noreply@blogger.com) at November 18, 2009 08:40 PM


Armen Zambrano G. (armenzg)

Check for add-ons compatibility changes

I had my check for add-ons compatibility disabled but it recently stopped working.

To fix this instead of using this:
 extensions.checkCompatibility;false
you can use this:
 extensions.checkCompatibility.3.6b;false

As always, do not use this for stable releases as a workaround because one of your add-ons has not yet been updated after a new release. Doing so might make your new Firefox not to work as expected.




Creative Commons License
This work by Zambrano Gasparnian, Armen is licensed under a Creative Commons Attribution-Noncommercial-Share Alike 3.0 Unported License.

by Armen Zambrano (noreply@blogger.com) at November 18, 2009 08:05 PM


Nadim Michaty

An observation on technowizardry


future

If only our attention spans could stretch longer than our own lives, or our perception of time was in a range where every dawn could be seen as a beat of the Earth’s heart, we could notice something awe-inspiring:

the speed of innovation is increasing.

And not only that, but the speed of complete infrastructure redesign is also increasing.

If we think about the elementary meaning behind the word ‘tool’ and what it symbolizes – a construct, something external, that is designed with a purpose, and quite simply allows us to do what we are not biologically engineered to accomplish au naturel. The knife is a tool. Plausibly the very first tool, which may have been inspired by our teeth. What our primitive brethren couldn’t penetrate with a finger nail, tear with their hands, or sever with their teeth, they employed a blade. This cause-effect relationship based on necessity is the one pattern all technology follows. Keep that in mind.

So, life before the tool was indeed a world we would not recognize, as its advent brought with it a paradigm shift, albeit slow and progressive.

plugit
We could consider harnessing of electricity as another paradigm shift. Ask yourself, did binary matter to the Empire of Rome? Doubtful.
By necessity, the human world evolving into an age of electrical power required a new infrastructure of logic, which was quite simply power-on/power-off. From there, binary developed into boolean algebra, which developed into complex computing commands based on laws and rules, functions and variables. None of this would have had any implementable purpose in the eras that predate the 1800s, there simply was no necessity for these entirely new leagues of information.

Shift happens.

The internet is nothing if not a total paradigm shift. Information has gone from a physical block of stuff on a page to nonlocal storage! Knowledge is no longer something that needs to be touched, held, and transported across space and time to be exchanged. We have tapped into the world of the formless and amorphous, I believe this signifies a step in our progression towards the divine, nonphysical universe. The necessity is there. I don’t know if you’ve noticed, but we’re running out of space; space to park our cars, space to place houses with backyards and driveways, etc… Space is an abstract constant, and it is finite by design.
As the ancient Chinese saying goes: Round Heaven, Square Earth. The brilliance of this understanding strikes me in noticing that the square is the most space-efficient shape we can employ, and illustrated in how right angles dominate the designs of our structures. It just seems very appropriate and captures the essence of this tangible world of ours.
It also makes one look deeper at Da Vinci’s Vitruvian Man.
But I’m getting off topic.

And I cannot exclude the Open Source revolution. It is another delocalization, but this time of the power to forge and manufacture digital tools. In this context, imagine a factory no longer manufacturing/distributing a product, but now offering the knowledge on how to make that product yourself instead. That is how you empower the consumer.

So what comes next, you may ask. What new system will reinvent the court in which we play ball, and will it come in our lifetime?
I can only tell you that you ask silly questions. The future is meant to be unknowable, that’s how it is programmed. If you went back 70 years and told someone that you heat your food in a box that zaps it with invisible, electromagnetic energy without even heating the air around it, they would tell you to lay off the drugs. Even the pioneers of the television thought the appliance would be a passing fad, and never would have believed seeing a TV in every household.
And it is probably less a matter of ‘will‘ shift occur in our lifetime than ‘how many‘ shifts. Let’s never forget, the speed of change increases exponentially.

The stone age – several tens of thousands of years.
The bronze age – a few thousand.
The industrial age – 300 years.
The chemical/plastic age – one hundred.
The information age – 30 years old.
The Biotechnology age ~ 10 years.
And who knows, the nanotechnology age might last a whole 8 minutes.

Over the course of our existence, all these tools go from just things we use to extensions of our very selves. We are the tools we use, we are the machines that compute and manipulate, and we are a different class of creature as a result.

But in the scope of what comes next, there seems to be a new trend in technological advancement (other than ever-more intelligent robots), and that is an evolution from the use of input artifacts like keyboards and mouses to a more intuitive system of manipulation. Through this branch of innovation, we can see that we are really working towards hybridization with our creations, whether consciously or not. How better to illustrate how we are become ever-more united with our machines on a personal/mechanical level than with progress like muscle-based input, Mattel’s Mindflex, the thought-based interface of Audeo, and something truly astounding called SixthSense.
Seriously. It’s like the internet all over again.
Nonlocality of information is going even further in that access will delimit itself from a local computer, and the invisible infinite can be carried with us and plugged into real life objects with real time plugging in to hyperinformation.

[*Note of interest: As if SixthSense's hardware costing no more than $300 was amazing enough already, its software has gone open source.]

The world is just freaking awesome.

by buddhatron at November 18, 2009 07:21 PM


Neda Pezeshki

Assignment 2
I was supposed to write IO_Menu class but fardad almost finished it in class.
I just read step by step what fardad defines menu as a derived class of io_field
and io_frame. IO_Menu is derived from IO_Frame in order to draw frame for vertical
menu and also is derived from io_field to consider row and col field in frame. we can move between menu items by page up,down key for vertical menu and right, left keys for horizontal menu. By space key , menu item would be selected and the previous selected menu item would be deselected.
Now I am going to focus on io_form with lujbo. If we finish io_form , io_field and io_label, then project can pass the first test.

by neda (noreply@blogger.com) at November 18, 2009 05:16 PM


David Humphrey

Morning Coffee, blogs, and XPCOM

The best part about this stage of the term in our Seneca Mozilla and Open Source development courses is that the students are really digging into some interesting work, and it makes my morning coffee and blog-reading an incredibly satisfying experience.  Here’s some of what I woke-up to today, and it’s inspired me (I need a lot of inspiration these days):

The list goes on, but my coffee is almost gone.  These are students who didn’t know what open source was two months ago, and are now pushing themselves beyond what used to be their perceived limits.  It’s exciting to think where we’ll be in another month.

There’s one more student blog I read this morning, and I was in the process of leaving a comment when I realized I should probably blog about it instead.  The question is related to things we’re studying this week and next (i.e., XPCOM), so let me deal with it here.

Michael Dennis is waiting on a review of a Thunderbird bug he fixed for his 0.1 release, and instead of sitting there making excuses and wasting time, he’s decided to jump into a second bug (fantastic!).  His first bug was a UI issue that had him working with JavaScript, CSS, and XUL.  His second bug is down in the bowls of the C++ code.  He writes:

So, here comes my new bug, 286760, which was given to me last week. Basically, this bug is about mail addresses that are saved in the address book ending with a space cause problems later on when they are used. From this, I figured it wouldn’t be so hard to fix the error, because how much implementation code do you need to concatenate a name and an email address into, for example, the following:

ex: Mikey <mikey@something.com>

Well, I definitely got surprised once I saw the code to actually do this. All these OOP344 flashbacks came back to me.. * cries *. From pointers, to memory allocations, just ugh… I am definitely not a fan of C++. Keep in mind, I am still not even sure if this is the right place. Starting from an interface, I searched for the makeFullAddress(…) and chose the only match that had an implementation for it; however, the uncertainty is because the makeFullAddress(…) should only accept two parameters, yet the implementation shows that is accepting three parameters, which makes me ask myself if I am going in the wrong direction.

Anyways, let’s say I am on the right track. Exploring the makeFullAddress(…), I ended up at msg_make_full_address, which contains code that seems helpful. However, there is one problem: new keywords are popping everywhere, for example, PRUint32 and PR_Malloc(…). To overcome this, I assume what it is or what it does, but how far can I go by doing this…

Heh, feel free to offer me suggestions.

I have a few suggestions.  First of all, you’re in the right place.  In Mozilla, all (there are a few exceptions, but…) XPCOM methods return a numeric result code to indicate success or some failure.  You’ll see lots of references to things like NS_OK (it worked!) and NS_ERROR or NS_ERROR_NULL_POINTER or a host of other specific error results to tell you that it failed and why.  These are simply 32-bit integer values that are defined in the code using macros.

The reason for all these result codes is that Mozilla doesn’t use C++ exceptions (again, there are a few ‘exceptions’, but…) for historical/compiler reasons.  This means that every method you write has to return an integer value indicating success/fail, and a lot of the C++ code is devoted to checking those values and responding accordingly, much of it hidden inside convenience macros.

What does this mean for the case where you want to have a method return a value?  If you’re forced to return an integer result code, how do you also return a string or object?  The answer is that you add a third parameter to take the result.  Let’s look at the IDL signature for the method Michael is calling (IDL is the interface language Mozilla uses to declare its XPCOM classes and members):
/**
* Given an e-mail address and a person's name, cons them together into a
* single string, doing all the necessary quoting.
*
* @param aName The name of the sender.
* @param aAddress The address of the sender.
* @return A string of the form name <address>.
*/
AString makeFullAddress(in AString aName, in AString aAddress);

It even has comments!  Notice how you have a method that takes 2 arguments (Mozilla’s abstract string type), and returns a third.  No mention of a result code.  Now, when you build Firefox or Thunderbird, the xpidl compiler will take this IDL declaration and translate it into C++, creating a header file that other parts of the C++ code include.  Here’s what that looks like:

NS_IMETHOD nsMsgHeaderParser::MakeFullAddress(const nsAString &aName,
const nsAString &aAddress, nsAString &aResult)

Here the nsMsgHeaderParser is implementing the nsIMsgHeaderParser interface (notice the ‘I’), which includes the makeFullAddress method.  When it turns into C++ the name changes to MakeFullAddress (in JavaScript it would still be makeFullAddress, see below), and the signature has been rewritten to include a new third argument, aResult.  Also, the return type is changed to nsresult (which is what the NS_IMETHOD macro does, and nsresult is just a typedef of a PRUint32 which is just a cross-platform compliant unsigned 32-bit integer).

Notice how the first two arguments are const, and the third one is not.  That’s because the third argument is going to be modified, and a resulting string is going to get “returned” via this argument.  This makes more sense when you see it being called:

parser->MakeFullAddress(pDisplayName, newRecipient.mEmail, newRecipient.mAddress);
if (newRecipient.mAddress.IsEmpty())

Here you see 2 strings being passed, and a third string being given for the return value.  This example is somewhat opaque in terms of the use of the result code, since the caller is ignoring it, instead choosing to look at the length of the third argument after the call has returned.  It comes to the same thing.  Another common way to write this would have been:


nsresult rv;
rv = parser->MakeFullAddress(pDisplayName, newRecipient.mEmail, newRecipient.mAddress);
if (NS_ERROR(rv))

Just to complicate things, this same call can be made from JavaScript, and looks different again:

var address = gHeaderParser.makeFullAddress(card.displayName, card.primaryEmail);

Here there are only 2 arguments, and notice how the resulting string is once again returned from the method, just as the IDL specified.  That’s right, you have to understand that it works differently in C++ and JavaScript, but is the same method either way.  It’s not as hard as it seems, but it’s hard enough to cause new developers to stumble.  Being able to declare, define, and call code across language boundaries is powerful and complicated.

All of this to say, I can understand why Michael is confused about whether or not he’s looking at the right code.  The answer is ‘yes’ but it takes some understanding of how our code is structured to see why.  If you didn’t get all this, don’t worry.  There will be more XPCOM lore in class this week and next, and lab to help you get more experience with it.

by david.humphrey at November 18, 2009 04:14 PM


Jonathan Piltz

The project

I'm still getting used to working on such a project with a bigger group. I'm used to doing everything on my own or having to do a larger portion of the code, so it's a bit weird for me to have to rely on others to get the work done. Not that I'm complaining, but it makes me feel that I should be contributing more but I don't know how. The problem is that most of the team isn't communicating with the others and so I don't know how to help them out.

As for my last post, the problem was that the program was when the program ended, the top part of the frame would disappear. By putting in a getch, this stop the program from ending prematurely, so I could see that the frame was being constructed properly.

by Jonathan Piltz (jmpiltz@rogers.com) at November 18, 2009 02:53 PM


Andor Salga (andor)

Merging C3DL into PJS


A few days ago I took my first steps in placing 3D functionality in the Processing.js library. It was confusing and awkward and it led to a demo which is anything but pretty. Not only is the output a joke, the code is quite crude. Regardless, I decided to write a blog post about my small success. As my professor Dave stated I “was brave” in posting it. Looking at it now, I’m very surprise I did, but I guess I get points in releasing early and often. As the blog’s title suggests, it was a bit like force-feeding the Processing.js library C3DL. It was terribly messy, albeit I did succeed. Of course my success lured me to my next challenge: The cube couldn’t move and couldn’t be lit.

After spending some quality debugging time, I did manage to fix those bugs. Here, I can prove it with a JPEG! Without getting into boring technicalities, I’ll just say I needed to make sure the cube model was preloaded before it was instantiated. You’ll have to trust me. The JavaScript evolved to something less messy and a bit more pleasant. It was more like Injecting one library into another. I was getting closer to what I wanted.

So I had both libraries playing nice, but my next problem was packaging this properly so it could be useful to others. I needed to create some sort of architecture which would allow anyone else trying to throw 3D into Processing.js a head start. They could focus on higher level problems rather than diving into WebGL intricacies. I cut out some code, added some code, threw in some comments and made a page with minimal (but existent!) instructions. Chris Tyler helped me minimize the C3DL library so running the demo was slightly faster. The code is getting better. Good enough for me to refer to it as merging one library into another. Harmony is yet to be achieved, don’t worry I’m getting there. : )

Anyway, the files are now up. The screenshot I posted in the beginning of this blog was taken from the running demo. Because C3DL uses WebGL, you’ll need to use Minefield to run the demo. Firefox <3.5 won’t cut it. You can also download the zip with everything packaged up.

Why did I decide to release the code now? It was mostly because I didn’t see the code as Web worthy. Frankly, I see it still as barely Web worthy, but it will have to do for now. The demo has some issues listed on the page in which it renders. I suppose you can decide if it is useful to you or not. If anything I’ll blame the mantra Dave an Chris keep trying to instill: “Release early, release often”.

So, the demo hijacks the Processing.js library since it implicitly places a cube in the scene. How can this useful? Well, my fellow students in the open source course at Seneca College (Yeah, this is a credited course!) can play around with it and see how things are implemented in C3DL then adapt those methods for PJS. They can take a peek into the vertex shaders, the matrix stack, cameras and all sorts of other 3D stuff.

I’m going to keep working on this ‘architecture’, but I’ll shift my focus onto my 0.2 release for my course since it’s due in a couple of days. What I’ll need to do is start removing all the C3DL which will leave me with only WebGL calls for size(), background(), frameRate and similar functions. They aren’t really 3D functions, but still this involves quite a bit of work, I may lose some sleep. But that’s okay, I have a nice proverb posted above my monitor: “Sleep when you die”.

I’d like to thank Cathy and Dave for convincing a silly student to get 3D working in Processing.js the easy way rather than starting from scratch, which I was tempted to do. I believe they saved me a lot of time. Don’t forget: “Good programmers know what to write. Great ones know what to rewrite (and reuse).”

by asalga at November 18, 2009 07:14 AM


Verity Li

Assignment 2 progress

Just committed io_field (probably the easiest class for this assignment =P)- it's now done according to spec on wiki. The only kinks I ran into was trying to get the value of

_owner->getTop()
_owner->getLeft()

Since getTop() and getLeft() are functions of io_frame, _owner is an io_form pointer but inherits from io_frame I had to make sure that the inheritance is declared.

My next step is to look through io_checklist because Fardad said that there may be some extra functions that need to be added to io_field.

by Starbuck (noreply@blogger.com) at November 18, 2009 06:05 AM


Anton Chan


Jonathan Deni

Packaging Viewsource

For this project each member of the class was assigned something to do. Boris Chao and Adam Hilts were to package Dehydra and Jshydra, I was to package Viewsource, and Alex was to make the repo. At the moment the other classmates tasks elude me.

I started out wondering where I even get a tar file for viewsource so I was told I had to go to the viewsource directory. Downloading all these files and then putting them into a tarfile would have been a lot of work and time but I decided to do it UNTIL I found that there was a viewsource.tgz in scotland. In the interest of time and work I decided to use this. I made my spec file, with a certain difficulty I might add.

Chris Tyler, my professor, told me through IRC
"So you could tar these up and use that as
Source0, have an empty %build section, and then
custom-install files in the %install section (see
the nled spec file if you need to see how to do
that)."

So I used this tip to help make my spec file. I

My specfile can be found here.

The real issue I had was that my setup section looked like %setup -c -T when it should have looked like what I have there now. After this I had an issue that said certain files were installed but not unpackaged so all I had to do was add those files to the %files section.

After I finished this, I put my RPM into hongkong's /var/www/http directory and can be accessed here for the repo master to get.

Viewsource Rpm

That's all for now, cya later.

by Jonathan Deni (noreply@blogger.com) at November 18, 2009 04:55 AM


Michael Dennis

Week 9 - New Project, New Problems

I am currently working on two unrelated bugs in Bugzilla. My first bug, 515648, which I have mentioned in my earlier posts, regards modifying the search bar in Thunderbird. For my 0.1 Release, I managed to provide a patch that allows the feature needed. Right now, it is waiting to be reviewed, but since this bug is not as pressing compared to many others, it is still on the shelf - waiting. So what I do in the meantime? Based on the last comment on the bug's page, I might have written my code incorrectly: either I added an extra feature that is not needed or I misunderstood something. However, from re-applying my patch, I found an error with one of the DOM methods that I used. Hopefully, it is a minor problem... I really hope.

Anyways, once the problem is corrected, what else can I do? So, here comes my new bug, 286760, which was given to me last week. Basically, this bug is about mail addresses that are saved in the address book ending with a space cause problems later on when they are used. From this, I figured it wouldn't be so hard to fix the error, because how much implementation code do you need to concatenate a name and an email address into, for example, the following:

ex: Mikey <mikey@something.com>

Well, I definitely got surprised once I saw the code to actually do this. All these OOP344 flashbacks came back to me.. * cries *. From pointers, to memory allocations, just ugh... I am definitely not a fan of C++. Keep in mind, I am still not even sure if this is the right place. Starting from an interface, I searched for the makeFullAddress(...) and chose the only match that had an implementation for it; however, the uncertainty is because the makeFullAddress(...) should only accept two parameters, yet the implementation shows that is accepting three parameters, which makes me ask myself if I am going in the wrong direction.

Anyways, let's say I am on the right track. Exploring the makeFullAddress(...), I ended up at msg_make_full_address, which contains code that seems helpful. However, there is one problem: new keywords are popping everywhere, for example, PRUint32 and PR_Malloc(...). To overcome this, I assume what it is or what it does, but how far can I go by doing this...

Heh, feel free to offer me suggestions.

by Mikey (noreply@blogger.com) at November 18, 2009 02:27 AM


Anna Sobiepanek

0.2 Release Revision


I previously published my release schedule (check it out). I finished my 0.1 release despite some bugs that i will need to fix. Check out my blog and help me test my cursor functions. Note: cursor does not yet work on mac. The main problem with my release schedule is that i allocated 3D functions for my 0.2 release. Unfortunately, all of the implementation of 3D has not been completes so I decided to push curve() box() and sphere() to my 0.3 release. For my 0.2 release, i will be implementing PImage, and once I complete it i will fix my cursor functions to use PImage, one of the bugs.

Here is the new schedule

0.2 Release Monday November 20, 2009

  • PImage
  • cursor(image, x,y) edit image parameter to be PImage: any variable of type PImage

0.3 Release Monday December 7, 2009 – this is very optimistic and I doubt I will have all browser capability. I will first need to learn more about 3D and OpenGL

View all of my blogs on Processing.js
View all of my blogs

by annasob at November 18, 2009 01:57 AM


Anton Chan

Can't compile

I tried to work on assignment 2. io_menu has a lot of errors, the person who is assigned to the task committed it with errors! You know who you are and I'm calling you out!

Btw. Just j/k, I'm sure this sort of thing happens all the time. And yes I already messaged mr./ms. io_menu about it not compiling

anton

by acfunktron (noreply@blogger.com) at November 18, 2009 01:47 AM

November 17, 2009


Ehren Metcalfe

i686 vs x86-64 issues


Falling behind with my blog is not a good thing because I have a lot to report. Some/most of it is old news by now but I need to get it up here. Incidentally I’ve completed a rudimentary Dehydra analysis on the mozilla-central repository so that my plugin can eventually be applied, however I will present the results in my next post (here’s the post, btw).

Anyway, last week, upon embarking on the static analysis component of this project, I ran into trouble using my GCC plugin on two of the CDOT’s x86_64 Fedora boxes. The plugin compiled, but using it on any test code invoked an internal compiler error (a segmentation fault). This was quite troubling since the plugin worked fine when compiled for i386 (tested with my personal Debian machine and another Fedora i686 system at Seneca).

Ultimately I solved the problem by finding a slightly different way of coding the optimization, but I’ll document a few of the steps I’ve attempted.

Although I have now updated it with the fix, the plugin code of my previous post contained the following (see that post for the context):

  tree lhs = gimple_get_lhs (stmt);
  tree zero = build_int_cst (TREE_TYPE (lhs), 0);
  gimple assign = gimple_build_assign_stat (lhs, zero);
  tree var = make_rename_temp (TREE_TYPE (lhs), "dummy_var");
  gimple_call_set_lhs (stmt, var);
  gsi_insert_after (&gsi, assign, GSI_CONTINUE_LINKING);

One clue about the issue is that the call on line 4 to make_rename_temp warns “initialization makes pointer from integer without a cast”. At the time my thoughts on the issue were “who cares, it works”. Even getting the ICE (which complained about the call to make_rename_temp), I figured that changing the code wasn’t the thing to do. Instead a convoluted journey of debugging the plugin with gdb, examining the registers, etc, etc, was what I had in mind. Conclusion: the call to make_rename_temp results in a crash.

In any event, I found a solution although it’s been long enough that I can’t quite remember how I arrived at it:

  tree lhs = gimple_get_lhs (stmt);
  tree zero = build_int_cst (TREE_TYPE (lhs), 0);
  gimple assign = gimple_build_assign_stat (lhs, zero);
  tree var = create_tmp_var (TREE_TYPE (lhs), "dummy_var");
  add_referenced_var (var);
  mark_sym_for_renaming (var);
  gimple_call_set_lhs (stmt, var);
  gsi_insert_after (&gsi, assign, GSI_CONTINUE_LINKING);

All of that add_referenced_var/mark_sym_for_renaming business is because the call to create_tmp_var creates a temporary that’s not in SSA form ie you’ll have an initialization like int dummy_var.0; and then when it’s used you’ll get dummy_var.0 = 0; when what you want is dummy_var.0_1 = 0;.

Looking at the code for mark_sym_for_renaming in tree-dfa.c, note that it’s basically identical to the code I used to replace it’s call:

tree
make_rename_temp (tree type, const char *prefix)
{
  tree t = create_tmp_var (type, prefix);

  if (TREE_CODE (TREE_TYPE (t)) == COMPLEX_TYPE
      || TREE_CODE (TREE_TYPE (t)) == VECTOR_TYPE)
    DECL_GIMPLE_REG_P (t) = 1;

  if (gimple_referenced_vars (cfun))
    {
      add_referenced_var (t);
      mark_sym_for_renaming (t);
    }

  return t;
}

So where is the error with my original approach given that it works on i686? I’m thinking that the representation of a tree as a union of tree nodes may be at issue ie I was sticking the return of make_rename_tmp where it should not be stuck.

Although it wasn’t of much use to me, I’ll present a quick example of debugging GCC with gdb for those interested (this applies to GCC plugins as well). I have found this page, on debugging a segmentation fault, particularly useful. For those who just want to step through the compiler for kicks, those instructions will work as well.

Here’s a concrete example:
I’ve installed my GCC at /home/ehren/gcc/dist/bin/gcc and am compiling hello.c which is in my home directory. The compiler was produced with -g3 -O0.

First run the compiler with -v to determine the actual command passed to cc1 or cc1plus (gcc or g++ is just a driver for these programs)
~$ gcc/dist/bin/gcc hello.c -v

The output will contain the following line:
/home/ehren/gcc/dist/libexec/gcc/i686-pc-linux-gnu/4.5.0/cc1 -quiet -v hello.c -quiet -dumpbase hello.c -mtune=generic -auxbase hello -version -o /tmp/cctQO1Kb.s

Now invoke cc1 with gdb:

~$ gdb /home/ehren/gcc/dist/libexec/gcc/i686-pc-linux-gnu/4.5.0/cc1

And then run it using the arguments given in the line above (the -v is now unnecessary but there’s no harm in including it). Set a breakpoint first if you’re not getting an internal compiler error:

(gdb) break main
(gdb) run -quiet -v hello.c -quiet -dumpbase hello.c -mtune=generic -auxbase hello -version -o /tmp/cctQO1Kb.s

And you’re good to go.

by ehren at November 17, 2009 10:10 PM


Andor Salga (andor)

Injecting C3DL into PJS


Just a quick bloglet on my progress on placing C3DL into PJS. I got lights and animation working! I’ll post up my work once I have something less hacky.

by asalga at November 17, 2009 08:38 PM


Boris Chao

Packaging Dehydra

For Our Class Project, my task was to package up Dehydra and have it ready for the next Fedora 13 release.

Since there is no current Dehydra package for Fedora, I had to create a SPEC file from scratch.
From what I had learned before, I ran the follow command: rpmdev-newspec dehydra
and that created me a empty spec template I can work on for dehydra.

Here is a copy of my spec file: SPEC

Since my project is sort of connected to my colleagues work, I had to hard code some tools into my spec file until he has completed his project.

Throughout the process of creating and building the spec file, I would encounter missing files the configuration file Dehydra was looking for from SpiderMonkey. So I asked my Professor Chris about it, he advised me to look for the files and then just create a symbolic link to where the build file is looking for.

Next issue was, for the %install section because I was not installing anything I left that section empty. But Chris advised me, to create a directory to put the dehydra plugin as right now, there is really no specific directory.

He advised me to follow what he has done with nLed in terms of how he setup the %install portion.


After all the work, I finally completed my task at hand, and came out with the RPMS.

Here are my alpha products of Dehydra, next comes the testing phase
Dehydra RPM: FILE
Debug Dehydra RPM: File

by Boris Chao (noreply@blogger.com) at November 17, 2009 07:53 PM


Alex Londono

Starting 0.2 with reverse()

So far this reverse function is as easy as it sounds. Take an array and flip it around so that the first element becomes the last and vice versa. For the most part it’s done, but I get bothered by little things. For example on the processing page, reverse displays the array but with no comma (,) separator EX:

String sa[] = { "OH ", "NY ", "MA ", "CA "};
sa = reverse(sa);
print(sa); // Prints "CA MA NY OH "

In my java script output it looks similar but with “,” that keep being put in  Ex:







The output should be: BMWVolvoSaab   :(

So far I’m trying to use a regExp to search for “,”  and replace with “” but I’m getting an error.

This post is also just to get into the habbit of blogging because I havn’t been doing it enough in this course and I don’t usually think this kind of stuff is a blog worthy post.

by Tyrant911 (noreply@blogger.com) at November 17, 2009 10:00 AM


Andrew Smith

Oh my god, don’t use plural forms

By Andrew Smith

There is a magic thing called gettext. It’s magic because it allows some random Joe on the internet with no experience in programming to translate your application into his language. He does this by editing a .po file, then sends it to you, and you just include that file in your build system.

Ok there is some plumbing you need to enable that, but really it’s worth it.

In one of my applications I followed the advice in the gettext manual and used plural forms for messages. That is rather than saying “%d file(s)” the string had two forms: “%d file” (if %d is 1) and “%d files” (if %d is not one). This is specified in the po file like so:

“Plural-Forms: nplurals=2; plural= n!=1;\n”

msgid “%d file”
msgid_plural “%d files”
msgstr[0] “”
msgstr[1] “”

But of course different languages have different singular/plural rules. For example in Russian 0, 1, 2, and 5 have different plural forms. That means the russian translator has to figure out how this whole system works in order to translate strings with plural forms.

These translators are volunteers. That they do it at all is amazing. Having them read the gettext manual (which doesn’t have a lot of examples like it should) is disrespectful and unproductive. You will get fewer translations of not-as-good quality if you use plural forms.

I know, I learned this the hard way. One of my programs uses plural forms and another doesn’t. I have spent way too much time explaining to people how this works, and I am sure some of them ignored what I said and just gave me whatever compiles.

And believe me figuring this out isn’t easy. I mentioned the russian example – honestly I have no idea what the rules are exactly (who ever thinks of these things?) and I speak russian, and I maintain the application. How can I ask Joe random to understand this?

There you go. Use plural forms at your own peril. The gettext manual lies, plural forms are not a good thing and the problems they cause are bigger than the one problem they solve. I have just got a new translation, and guess what – the two strings with plural forms are untranslated. So I have to get a headache explaining this yet again, while kicking myself in the head for buying into the gettext dogma.

by Andrew Smith at November 17, 2009 07:19 AM


Roger Dicke

classapi: Next up…


In my previous post classapi with a Little Treehydra on the Side I received help to get a little farther when making classapi, or docs from Dehydra.



*If you want these pictures to make any sort of sense you have to keep reading…

This time make did start running some stuff, and created classapi.out, but inside classapi.out:

DUMP-TYPE(nsAString_internal)
/home/rdicke/src/xpcom/analysis/type-printer.js:248: JS Exception: Member name not qualified?
:0:     #0: Error("Member name not qualified?")
/home/rdicke/src/xpcom/analysis/type-printer.js:248:    #1: dumpType([object DehydraType])
/home/rdicke/src/xpcom/analysis/type-printer.js:394:    #2: input_end()
/home/rdicke/src/config/static-checking.js:101: #3: ()

Let it be noted that I am working with external strings while internal strings are what I am generating now. I just want to get what we know works working before I graduate to producing the docs for external strings.

So with this new problem solution in transition, humph told me I had a bug and that I should have a look at it myself. In the beginning I hoped that I could just use Dehydra and only have to play in my beloved C++… *JavaScript! “They found me. I don’t know how but they found me!” (there seems to be some strange connection between BTTF and JavaScript??)

A look at type-printer.js line: 248

Well, it throws the error we see above, here it is with it’s if statement:

if (m.name.indexOf(qname) != 0)
throw Error("Member name not qualified?");

I commented out the throw and added my own line:

print("--- qname: " + qname + "\n--- m.name: " + m.name + "\n--- m.name.indexOf(qname)" + m.name.indexOf(qname));

Now I get all kinds of goodies! And in classapi.out:

DUMP-TYPE(nsAString_internal)
--- qname: nsAString_internal::
--- m.name: EqualsLiteral
--- m.name.indexOf(qname)-1
--- qname: nsAString_internal::
--- m.name: EqualsLiteral
--- m.name.indexOf(qname)-1
--- qname: nsAString_internal::
--- m.name: LowerCaseEqualsLiteral
--- m.name.indexOf(qname)-1
...code>

Well there you have it, the error message makes sense now. m.name would be "nsAString_internal::EqualsLiteral" if it were qualified. And… It isn’t. Noticing that I put the print under the if, meaning that it would only print if the member name was not qualified, I decided to try commenting out the if.

DUMP-TYPE(nsAString_internal)
--- qname: nsAString_internal::
--- m.name: nsAString_internal::~nsAString_internal()
--- m.name.indexOf(qname)0

Looky there! Qualified members. So why are there some in there trying to ruin my fun? And why do we hate non-qualified members anyway? I’m sure to find out.

by enderstruth at November 17, 2009 05:57 AM


Denny Papagiannidis

Reading from a binary file in reverse


Today’s OOP344 topic was binary file acess. Fardad wrote a program that would read a series of doubles from a binary file and print them on the screen using cout.

He then challenged us to modify his code to print the numbers in reverse from the end of the file, and that a similar question may end up on a test.

Well, if that’s the case I probably won’t get a 0 on the next test because I think I have a solution:

#include <iostream>
#include <fstream>
using namespace std;

int main(){
  double d =0;
  fstream fin("nums.bin",ios::in| ios::binary);
  int i;
  fin.seekg(sizeof(double)*980);
  for(i=0;i<1000 && !fin.fail() ;i++){
    fin.read((char*)&d,sizeof(double));
    if(!fin.fail()){
      cout<<i<<": "<<d<<endl;
    }
  }
  fin.clear();
  cout<<"---------------"<<endl;
  for(i=0;i<1000 && !fin.fail() ;i++){
    fin.seekg(sizeof(double)*-(1+i), ios::end);
    fin.read((char*)&d,sizeof(double));
    if(!fin.fail()){
      cout<<i<<": "<<d<<endl;
    }
  }
  fin.clear();
  return 0;
}

works, but there’s probably a better way of doing it XD

by dennyp at November 17, 2009 04:48 AM

Problems with wiki markup


I was trying to make some changes to my team’s website and the table was always showing up at the bottom of the page.

I want the table to be directly under the first header on the page, followed by subsequent headers but as I keep adding content, it always shows up above the table.

Probably a syntax error somewhere but I can’t seem to spot it.

Weird!

by dennyp at November 17, 2009 01:56 AM


Daniel Hodgin

Lighthouse tracking application for Processing.js


Spent most of Saturday helping F1LT3R setup a new bug/feature/issue tracking web application for processing.js.

It’s called Lighthouse and if I was to describe it i’d say its a simplified bugzilla bug tracking system.

But what is a bug ?  A bug is not just a broken feature in a piece of software it’s  anything that has to do with a change that can, will, or might happen to a piece of software.  A bug can be a request for a new feature.  It can be a problem report for a crash issue.  It can also be a request to change the way something works or fix something and make it better.

Improvements, Innovations, Implementation, and Invention.

So what’s the purpose of Lighthouse exactly then?  It’s to allow us to use a centralized location to start tracking processing.js changes, bugs, feature additions, and improvements.  Most importantly though its a way for the community to be able to know what everyone else is working on and to bring the community closer together.  It’s also to help F1LT3R in the review process as well.

I wrote up a short tutorial on how to use lighthouse to place a ‘Ticket’ (tickets are bugs, milestones are due dates for deliverables) for processing.

F1LT3R also wrote an intro on how the project workflow should go and how to go about implementing your own work on processing.

I think in the future we plan to tie Lighthouse into Github as well.

 

by dhodgin at November 17, 2009 12:22 AM


Diana Cucereavii

Todo

The following code prints the contents of the file containing Students' records backwards (today's class todo):

#include
#include
using namespace std;
#include

class Student{
char _name[51];
int _noOfSubjects;
float _gpa;
public:
Student(const char name[]="", int noOfSub=0, float gpa=0.0){
strcpy(_name, name);
_noOfSubjects = noOfSub;
_gpa=gpa;
}
ostream& print(ostream& os)const{
return os<< "name: "<< _name<< ",Subjects: "<< _noOfSubjects<< ",Gpa: "<< _gpa;
}
};

ostream& operator<< (ostream& os,const Student& S){
return S.print(os);
}

int main(){
Student S;
fstream fin("std.bin",ios::in| ios::ate | ios::binary);
int cnt = (fin.tellg()/sizeof(Student));
for(int i=0; i< cnt; i++){
fin.seekg((-sizeof(Student))*(i+1), ios::end);
fin.read((char*)&S, sizeof(Student));
cout<< S << endl;
}
return 0;
}


Input File:
name: John Doe,Subjects: 4,Gpa: 3.5
name: Fred Soley,Subjects: 3,Gpa: 2.5
name: Fardood Solimon,Subjects: 2,Gpa: 3.5
name: Joe Black,Subjects: 5,Gpa: 3

Output:
name: Joe Black,Subjects: 5,Gpa: 3
name: Fardood Solimon,Subjects: 2,Gpa: 3.5
name: Fred Soley,Subjects: 3,Gpa: 2.5
name: John Doe,Subjects: 4,Gpa: 3.5

by Diana (noreply@blogger.com) at November 17, 2009 12:03 AM

November 16, 2009


Boris Chao

Using Modifed G++ and C++ to Build

Two weeks ago, we were given the task to build a package using a modified version of G++ and C++. The purpose of this tasks is to see if there would be a significant time delay or increase building with the modified g++/c++ tools compared to building with the regular g++/c++ tools.

So, in order to build the packages with the modified G++ and C++, we require a script David Humphrey a professor at Seneca created. The script can be found here

The Package that everyone is using is Abiword.

So, first we download the source rpm for abiword by issuing the following command
yumdownload --source abiword

once downloaded, issue the following command rpmdev-steuptree if you do not have the rpmbuild.

Finally run this command to install the Source RPM and extract the spec file.
rpm -i "package name"

For this task, I created two scripts, one script is for building with the Generic C++/C++ and the other one is for the modified G++/C++. These scripts will basically rename the G++/C++ file, create symbolic links, run the rpmbuild command 3 times and finally log the time it takes to run the build.

Here are the two script I used:
Generic G++/C++
Modified G++/C++


When building with the regular G++/C++ it flew by quickly with no errors, but when it came to modified g++ / c++ I like everyone else was coming into issues with it failing at the install section. As one of my fellow colleague Adam Hilts stated to bypass this problem was to add the following string QA_RPATHS=$[ 0x003f ] to your rpmbuild line.
So in the end my line looked like this in my script
time -o modified.log -a QA_RPATHS=$[ 0x003f ] rpmbuild -ba abiword.spec >/dev/null 2>&1
and success everything was rolling smoothly.

The overall outcome was really not that significant, it did shave some time off a little maybe a 5% increase using the modified version of g++ and c++.

Here Are My Out Comes


Non-Modified Modified
Run Time Real-User-System Real-User-System
1 208.23-205.81-127.99 198.28-196.82-126.28
2 207.97-206.03-128.07 200.82.198.89.127.76
3 211.03-205.86-128.37 199.19-197.30-127.98

by Boris Chao (noreply@blogger.com) at November 16, 2009 09:09 PM


Roger Dicke

Classapi with a Little Treehydra on the Side


After building what I thought was (and now am only unsure is) a successful static analysis build of Mozilla I attempted to “generate the docs” by issuing the command:

make -C <objdir>/xpcom/analysis classapi

This command ends up with the error:

make: *** No rule to make target `.deps', needed by `classapi'.  Stop.

Getting some extra information from make using:

make -d -C objdir/xpcom/analysis classapi

I get:

...
Considering target file `classapi'.
File `classapi' does not exist.
Considering target file `.deps'.
File `.deps' does not exist.
...
Must remake target `.deps'.
...
make: *** No rule to make target `.deps', needed by `classapi'. Stop.
...

Touching base with Treehydra

The only thing in <objdir>/xpcom/analysis is the Makefile. The previously mentioned Building with static checking instructions specifically uses  gcc_treehydra.so so I though I would build Treehydra if not as a fix, just to have it.
Which brings me to a nice discovery, something I should have been aware of prior perhaps, Benjamin Smedberg’s blog post talking about the steps he had given me before. In that post he mentions the same page on MDC mentioned above.
I had used gcc_dehydra.so.  It seemed to build just fine, but when I ran make check_treehydra however it ended with 100% errors. I noticed that the cc1plus it was using was the systems version, not the plug-in version.

Using:

make CC1PLUS=../../installed/libexec/gcc/x86_64-unknown-linux-gnu/4.3.0/cc1plus check_treehydra

Made the test run much better however there were still 6 failures all mentioning:

../libs/treehydra.js:12: JS Exception: No case_val in this lazy object
:0:     #0: Error("No case_val in this lazy object")
../libs/treehydra.js:12:        #1: unhandledLazyProperty("case_val")
../libs/unstable/esp.js:481:    #2: ()
./esp_lock.js:41:       #3: process_tree([object GCCNode])

As interesting as this all is, I feel that I am getting sidetracked. I should be able to do something with gcc_dehydra.so alone, and at this point I feel that my static analysis build is faulty. On to IRC…

Solution

bsmedberg gives me the solution:

mkdir <objdir>/xpcom/analysis/.deps

Making the empty directory lets me get on with the build. At this point I have made a fresh static analysis build and am not using treehydra, I am sure I will get to play with it later. Visit me next time to see what other fun I am having!

by enderstruth at November 16, 2009 07:56 PM