Planet CDOT

March 22, 2010


Armen Zambrano G. (armenzg)

Linux 64 packaged tests now available

Since last Friday we started producing packaged tests for Linux 64.
This is one step close to be running unit tests for this platform (which we currently can but we are going to run in on talos machines rather than build machines - on the bake!) and support it the same way as our other three official desktop platforms.

Previously we had enabled the debug builds and codesighs.

You can now download the builds with the tests and run them if you please.
For more information about it please read bug 551758.




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 March 22, 2010 02:16 PM


Jatinder Singh

jtProgramCurriculum Use Case Diagram

jtProgramCurriculum Use Case Diagram

Visit Spring Framework > Spring Example 1 for more information on this project


by jsinghfoss at March 22, 2010 03:45 AM


Zhibin Huang

Release 0.2

Background

the release includes the work that I have done for pjs tickets #213 and #422. #422 was originally belong to #213, but first, Anna suggested me to seprate them; Second, there are realy too many differences between the 2D text and 3D text.

Things have done

2D part (#213)
3D part (#422)

Challenges

  • Using & Managing git.
  • WebGL is truly tough. I am still confused how to organize the code of the 3D part
  • Javascript. Understaning the sytax, but maybe working more a little bit on that will be much better
  • Merging code.

by Benjamin Huang (noreply@blogger.com) at March 22, 2010 02:44 AM


Paul Whalen

Mock Testing using ARM QEMU emulation

Now to test ‘mock’ on the ARM emulated machines. First I installed mock on the VM (arm-001-007) then ran it on the following packages:

virtuoso-opensource-6.1.0-2.fc12.src.rpm – 67M – 136m52.294s

eclipse-nls-3.5.0.v20090620043401-2.fc12.src.rpm – 78M – 83m28.222s

python-basemap-data-0.99.4-1.fc12.src.rpm – 103M – 20m38.734s

oxygen-icon-theme-4.4.1-1.fc12.src.rpm – 128M – 15m41.389s

vegastrike-music-0.5.0-4.src.rpm – 156M – 23m7.347s

wesnoth-1.7.13-1.fc13.src.rpm – 265M – Did not complete – missing dependencies.

vegastrike-data-0.5.0-5.src.rpm – 309M – Did not complete – missing dependencies.

A complete list of packages assigned to each user, mock test times as well as links to the resulting RPM can be found here: http://zenit.senecac.on.ca/wiki/index.php/Fedora_ARM_Secondary_Architecture/Initial_Mock_Compilation_Tests.


by paulfedora at March 22, 2010 12:56 AM

Creating ARM VMs for use with Fedora 12

We have decided to work on Fedora support for the ARM architecture. As mentioned previously the two primary architectures for Fedora are i386 and x86_64 however there are a number of secondary architectures including ARM. ARM is a widely used processor that many people may be unfamiliar with. ARM processor uses range from cell phones, tablets and netbooks. The plan is to create a Koji build farm for the ARM architecture. Because we currently do not have a ARM box to run initial mock tests on so we can get an idea of how long it will take for each build, we will do the first part of the testing on Virtual Machines through QEMU emulation.
The eight ARM VM’s are to be created on Hong Kong and assigned to individual builders and use mock to build a total of 7 larger packages each. The instructions for setting the VM’s can be found on the Fedora website (http://fedoraproject.org/wiki/Architectures/ARM/HowToQemu) as well as the resources required to get started including the Root file system tar-ball and pre-built kernel images or instructions to create the image from source. The machines were named “arm-001-00x” with the ‘x’ representing the individual machine number. Small edits were required to the XML file’s for each machine including changing the paths, VM name as well as making sure the MAC addresses for each of the machines were unique. Once completed a machine was booted using the commands
virsh define NameOfFile.xml
virsh start arm-001-007

After the machine was booted, I used the “virt-manager” GUI to sign in and “dhclient” to obtain an IP address, then download “system-config-network-tui” and ran “system-config-network” to set up the network. Once completed I assigned the static IP address and made sure the VM was online. The VM was shutdown using the command “virsh shutdown arm-001-007″. I then mounted the file system to copy the network information from the completed machine to each of the other seven VM’s, making small changes to ensure all machines were using different IP’s and MAC addresses.

After this process was complete, the hosts file on Hong Kong was edited to allow users to ssh into the VM with the machine name, rather then the IP. All VM’s were booted and tested for connectivity. The list of VM’s and assigned user can be found here: http://zenit.senecac.on.ca/wiki/index.php/Fedora_ARM_Secondary_Architecture/ARM_VMs.

Next… Mock testing on the VM’s.


by paulfedora at March 22, 2010 12:23 AM

March 21, 2010


Paul Whalen

Testing the Newly Created RPM with Koji

Now that I have successfully created an rpm I need to test that source using Koji. Koji will take the rpm and ensure it builds on the four supported architectures for Fedora – i386, x86_64, ppc, and ppc64. Following the instructions posted on http://fedoraproject.org/wiki/PackageMaintainers/UsingKoji. I installed Koji using the command

yum install fedora-packager

Then ran the set-up by running

/usr/bin/fedora-packager-setup

After this was completed the RPM was submitted using the command

koji build dist-f12 --scratch snort-2.8.5.2-1.fc12.src.rpm

Signing into the web interface for Koji found at http://koji.fedoraproject.org/koji/ you can then view the results and see information if the RPM failed to build. The sign in is done with the certificate created in the Koji guide. After signing in I found my RPM did not successfully build on the x86_64 platform. I will have to revisit this, however we now have a more important task at hand. Which will be covered in the next post.


by paulfedora at March 21, 2010 11:21 PM


Konstantin Novichikhin

Cross Compiling Firefox for mingw32

A couple of days ago I was able to put together a working toolchain to compile windows binaries. Today I’m going to try and compile a firefox build with it.

First of all, I’m going to get a firefox build that passed unit tests. I don’t want it to fail in the middle of compilation. To do that, I need to go to tinderbox and look for “WINNT 5.2 mozilla-central build”. Next step is to find the latest successful source code revision.

Right now (March 21st, 5:35 pm GMT) the latest “green” revision is 1633e6077d77.

Since I already have mozilla-central source on my machine, I’m just going to update to this revision. Under mozilla-central folder:
hg pull
hg update -r 1633e6077d77

After that I need to configure .mozconfig. I’ll take a sample mozconfig from MDC. It looks like this:
#Specify the cross compile
CROSS_COMPILE=1
ac_add_options --enable-application=browser
ac_add_options --host=i686-linux
ac_add_options --target=i686-mingw32
ac_add_options --enable-default-toolkit=cairo-windows
mk_add_options MOZ_OBJDIR=@TOPSRCDIR@/../mozilla-mingw
# Mozilla trunk uses many Vista only features on Windows, so we should disable some components to make it buildable with mingw32.
ac_add_options --enable-debug
ac_add_options --disable-optimize
ac_add_options --disable-tests
ac_add_options --disable-embedding-tests
ac_add_options --disable-installer
ac_add_options --disable-accessibility

ac_add_options --disable-vista-sdk-requirements
ac_add_options --disable-updater

#change this to where your libIDL-config file locate.
#I have libIDL itself, but I don't have libIDL-config-2
#Installing libIDL-devel package seemed to fix it
HOST_LIBIDL_CONFIG=/usr/bin/libIDL-config-2
#Config your moztools position
#No need to change this
GLIB_PREFIX=$HOME/moztools
LIBIDL_PREFIX=$HOME/moztools

#disable xpcom stdcall calling convention because of gcc 4.3.0 bug
CPPFLAGS="-DMOZ_DISABLE_XPCOM_STDCALL"

#Parallel compilation
mk_add_options MOZ_MAKE_FLAGS="-j5"

Now, when I have a good mozconfig file, I need to apply some patches to make mingw happy.

Under mozilla-central:

mkdir ../mingw-patches
wget -O ../mingw-patches/disable-xpcom-stdcall.patch https://bugzilla.mozilla.org/attachment.cgi?id=332690
wget -O ../mingw-patches/gcc_stdcall.patch https://bugzilla.mozilla.org/attachment.cgi?id=332691
wget -O ../mingw-patches/crypto.patch https://bugzilla.mozilla.org/attachment.cgi?id=334847
wget -O ../mingw-patches/trivial.patch https://bugzilla.mozilla.org/attachment.cgi?id=334848
patch -p1 < ../mingw-patches/disable-xpcom-stdcall.patch
patch -p1 < ../mingw-patches/gcc_stdcall.patch
patch -p1 < ../mingw-patches/crypto.patch
patch -p1 < ../mingw-patches/trivial.patch

Some of the patches failed, which doesn’t look too promising. I’m going to try and built it anyways. Let’s see what happens.

make -f client.mk build

Problem #1: *** Couldn't find autoconf 2.13.
Solution: yum install autoconf213

Problem #2:
checking for i686-mingw32-gcc... no
checking for i686-pc-mingw32-gcc... no
checking whether the C compiler (: ) works... no
configure: error: installation or configuration problem: C compiler cannot create executables.

Solution:
export PATH=$INSTALL/bin:$PATH
Where $INSTALL is your mingw32 folder.

Problem #3:
In file included from .../mozilla-central/config/mkdepend/cppsetup.c:29:
In file included from .../mozilla-central/config/mkdepend/include.c:30:
In file included from .../mozilla-central/config/mkdepend/parse.c:29:
In file included from .../mozilla-central/config/mkdepend/pr.c:29:
In file included from .../mozilla-central/config/mkdepend/main.c:29:
In file included from .../mozilla-central/config/mkdepend/def.h:30:21:
In file included from .../mozilla-central/config/mkdepend/def.h:31:28:
error: X11/Xos.h: No such file or directory
error: X11/Xfuncproto.h: No such file or directory

Solution:
I knew it was too easy. I’ll get back to this later.


by Konstantin.Novichikhin at March 21, 2010 08:20 PM

March 20, 2010


Carolyn Woodley

Virtual Muddles My Mind

Alright, so small dilemma... I have to declare an instance of another class (BField) in my class (BForm)'s constructor, this would all be well and fine if it weren't for virtual. In BField's constructor (it has no empty constructor mind you), there is something that references (void* data = (void*) 0) to be passed in. This is reference to a virtual member of BField's class (virtual void* data()). So, when I try to add something in to that position from BForm with my BField member, I get error C2259: 'BField' : cannot instantiate abstract class. Or rather, I assume this is what causes it.
So instead of this:
BField* _fld[MAX_NO_FIELDS];

_fld[_curidx] = new BField(row, col, "problem here-Virtual Element", framed);

I have to figure out how to override the virtual element of the BField constructor. I'll come back to this when I figure it out. Go Team!

by CWoodley1 (noreply@blogger.com) at March 20, 2010 11:35 PM

March 19, 2010


Scott Downe

0.2

Intro


This release has been weird. My main, original tickets 230 and 133 for this release were not as expected.

Problems and Challenges


230 already existed, but just didn't have any life, I just needed to breathe some life into it by writing some code to show it works, it was more of a documentation issue. The ticket is still awaiting review. I felt out of place with this one, and still do. I had a lot of fun writing it, and even more fun creating this example, but the fact that my code isn't really going to be added, just, feels weird. What I think would be best, and I'll push for this when the time comes. In the original processing there is a place on their website for hacks, basically, lists features, and shows examples, of things that can be done with processing through the use of java, that was not intended. What could happen in processing.js is sort of the same thing, a place on the website, that documents all the hacks that can be used, through the use of JavaScript inside the processing.js code, and this would be a big job, but something that should probably be done much later, maybe even after 1.0 of processing.js has been released. Until then, I feel like my 230 creation is a lost soul.

My other main ticket, ticket #133 also had issues. In the past I struggled with getting the private keyword to work on member functions, but the way processing.js created member functions, through using an addMember function, caused me issues. I would have to intercept the the addMember function, and create it my way. Although, Dave, was showing a trick in JavaScript, on how to make classes, with members, and it seemed to make a lot of sense. This is the code.


var counter = (function (){
var c = arguments[0];
var i = arguments[1];

return {
increase: function(){c+=i;},
getValue: function(){return c;}
};
})(1, 2);

counter.increase();
alert(counter.getValue());

counter.increase();
alert(counter.getValue());


Also, I have mentioned before, that Corban Brook is working on ticket #237 and talked about restructuring the way classes are parsed. I've been holding off working on ticket #133 prviate keyword because of possible changes.

Specifications


What I did do for 0.2:
The main one, was the example used for 230, and the ticket itself.

I also did three little ones to to supplement this release.
Tickets:

I've done some review of other tickets, and found a ticket that was fixed from my 0.1 that I didn't see. All easy stuff, but it adds up, and still must be done right.

Conclusion


This release has been very different than my last in terms of the work done, and I spent a lot less time trouble shooting, and more time creating tests and examples. I am still finding my groove. Finally, Corban said I could take a stab at ticket #237, I will probably do that and my private keyword at the same time, for my 0.3, and still try to get my regex parser fit in somehow, it shouldn't be a problem as it's really only two tickets, and all related to parsing, stuff I've been doing since the beginning of my stay here :)

by Scott (noreply@blogger.com) at March 19, 2010 07:06 PM


Daniel Hodgin

The first pieces of PImage

I pushed up the first piece of PImage code last night for review.

It looks like 0.7 will contain the following
PImage constructors including a 1 argument that accepts a HTMLImage object
createImage()
image()
p.get()
p.set()
PImage.get()
PImage.set()
loadImage()

A few example demos are available here and a simple slide show of images is here

more to come on 0.8 later in the weekend


by dhodgin at March 19, 2010 03:02 PM


Arya Farzan

C++ Reference Operator

Reference is a C++ feature, it is not available in the C programming language. A reference is less powerful but safer than the pointer. Reference is having two names for the same variable. Let us start by looking at some examples.

int A = 5;
int& rA = A;

cout << rA << endl;

A = 7;

cout << rA << endl;

Output:

5
7

No matter which variable’s value gets changed both A and rA change.

References can be used to replace pointers in some cases. As you may recall functions in c/c++ can only return one value and programmers use pointers in order to get around that! References can be used instead of pointers and you do not have to use the * operator in your functions.


by aryafarzan at March 19, 2010 06:14 AM


Andor Salga (asalga)

Compensating for WebGL readPixels() Implementation Inconsistencies

I’m working with Dave Humphrey my professor at Seneca College with a reference test tool he began for Processing.js. He started working on this tool because many of our tests require image-image comparisons. That is, our final rendered image should match identically to the same sketch produced by Processing. And doing that manually would be painstakingly slow.

The tool is comprised of a few parts, one of which takes a Processing sketch, renders it, and dumps out the raw pixel values of the canvas into a web page. This data can then be saved to a text file and added to the batch list of tests to run. Since he already had the script dumping out the result from 2D sketches, he asked me to develop the same thing for 3D sketches.

We are using WebGL to do all the 3D rendering for Pjs. We already ported over some 3D functions from Processing such as points, lines, box and sphere. My job was to take the following sketch and get the values from the framebuffer.

size(100,100,P3D);
background(33,66,99);

So given the above code, I needed to produce something such as this as our reference ‘image’:

//[100,100]33,66,99,255,33,66,99,255 .....
size(100,100,P3D);
background(33,66,99);

The first two values in size are the canvas dimensions and are followed by the series of values which would need to be extracted from the framebuffer (which also includes the alpha component). I understood what I needed to do and got to work.

Since we are using WebGL, I knew we had to use readPixels. I went to the WebGL spec which had the declaration of the function.

// spec:
WebGLArray readPixels(GLint x, GLint y,
                      GLsizei width, GLsizei height,
                      GLenum format, GLenum type)
                      raises(DOMException);
// example:
gl.readPixels(0, 0, 100, 100, gl.RGB, gl.UNSIGNED_BYTE);

The fist four arguments are straightforward. The format defines what data you want returned and the order. It can either be RGB, RGBA or ALPHA. The type argument specifies the type of the value returned. You can request things like UNSIGNED_SHORT_5_6_5 which defines per-component bit lengths, but the simplest is just passing in UNSIGNED_BYTE.

After a bit more reading I got down to hacking some code. I began working on this using Webkit, Safari’s nightly rendering engine. I wanted to create a simple test case, but I got stuck trying to do anything with the result of the call. Safari kept throwing an exception.

var buff = gl.readPixels(0, 0, 100, 100,
                         gl.RGB, gl.UNSIGNED_BYTE);
// Something with buff...

// Result of expression 'buff' [undefined] is
// not an object.

I struggled with this for some time. I kept thinking I needed to feed the return value of readPixels into a newly allocated WebGLUnsignedBufferArray. I couldn’t understand why buff was undefined. But eventually I tried requesting RGBA as the type and it actually returned something!

gl.readPixels(0, 0, 100, 100, gl.RGBA, gl.UNSIGNED_BYTE);

So I learned it wasn’t actually my fault, something was wrong with Webkit. Unfortunately, I was still under the impression I had to allocate a special WebGL buffer. The specification states “The specific subclass of WebGLArray returned depends on the passed type.” So if you pass in UNSIGNED_BYTE, you’ll get a WebGLUnsignedByteArray. But eventually I found out I could just use a regular JavaScript variable to hold the return type. No special allocation necessary.

Once I figured those two things out, I was able to make some progress. I assigned the return value from readPixels to a variable and queried the type. It was a [object WebGLUnsignedByteArray] as expected. I assume the subscript operator is defined for this object since I was able to get the pixel values using []. The object does have a this defined (which likely does the exact same thing):

getter GLubyte get(in unsigned long index);

So I was able to iterate over the elements and my code progressed to this:

var buff = gl.readPixels(0, 0, width, height,
                         gl.RGBA, gl.UNSIGNED_BYTE );
var pixels = [];

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

Finished! Or so I thought. When trying to run the same code in Minefield my complete output was:

//[100,100]
size(100,100,P3D);
background(33,66,99);

Where were my pixels? It didn’t take me long to figure my for loop wasn’t running. After playing with it for a while, I just resorted to querying the type and found it to be a [object Object]. Not exactly a WebGLUnsignedByteArray is it? Just a regular JavaScript object. To get the sweet goodies (property names) I wrote a simple for-in loop:

for(var i in buff) {
  alert(i);
}

This gave me the properties width, height and data. So a simple assignment was all I needed to get the data for this case!

pixels = buff['data'];

DONE!
Since I knew Chromium’s XHR bug breaks our Pjs code and Opera doesn’t yet support WebGL, I only had two browsers to consider, hence the extremely basic regex. But if you’re using readPixels, feel free to take whatever you need from my code and adapt it to your needs. Be it support for Chromium, browsers for mobile devices or whatever.

var agent = navigator.userAgent;
var isSafari = agent.match(/safari/i);
var context = canvas.getContext("experimental-webgl");

// Safari returns undefined if format RGB is requested
var buff = gl.readPixels(0, 0, width, height,
                         gl.RGBA, gl.UNSIGNED_BYTE );
var pixels = [];

if(isSafari) {
  for(var i = 0; i < buff.length; i++){
    pixels[i] = buff[i];
  }
}

// Minefield
else if(!isSafari) {
  pixels = buff['data'];
}

I hope the return value of readPixels is standardized before the developers at Mozilla, Apple, Google, Microsoft, etc. release their complete implementations of their WebGL-enabled browsers, but I have a feeling they probably will.


Filed under: Open Source, Processing.js, WebGL

by asalga at March 19, 2010 05:14 AM

March 18, 2010


Roger Dicke

enderstruth

I was working on the Minimal Testcase I mentioned before about the Function Pointer Parameter Problem and a strange thing happened. It seems that Dehydra performs  as expected with function pointers as parameters. However because this is a minimal example it is kind of in an ideal condition; what I will do now is try to find out what real world condition is causing it to act incorrectly with the static-analysis docs. I might already be on the way to fixing this myself!

I think it might be very beneficial to the OSD600 course if it included a formal introduction to minimal testcases. If it does already… It escaped me!


by enderstruth at March 18, 2010 07:06 PM


Dachuan Huang

Mar18 Chanllenge prnBits function

In today’s chanllenge we have to write the prnBits function in one line, here is my code:

#include

void prnBits(unsigned int v){
for(int i=sizeof(int)*8;i>0;printf(“%d”, !!(v & (1<<((i–)-1)))));
}

int main(void){
char A = 0×9c;
char B = 0×5a;
printf("A: ");
prnBits(A);
printf("\nB: ");
prnBits(B);
printf("\n");
return 0;
}


by hdc23 at March 18, 2010 02:12 PM


Shengwei Wang

OOP344 Challenge on March 18th

Challenge: write the pntBits() function in one line.
Here is my solution.

by Shengwei (noreply@blogger.com) at March 18, 2010 01:46 PM


Zhibin Huang

3D text on HTML5 continue

this is the second post of the 3D text on HTML5.

How far have I reached


What is that

As you see, it is a 3D text at the top of a square and a triangle. As the same with the last one, it refers to WebGL Lesson 5 and a textdemo from glge, and plus three lines of code from WebGL Lesson 8. The square and triangle are coming from the Lesson 2 in order to highline the 3D text.

A list of my references for 3D canvas

  • WebGL Lesson series Lesson 5, Lesson 8 and Lesson 2 - actually, all the lessons that inside the WebGL are very using. They are easy understanding, great instruction and open source.
  • GLGE - a javascript library using the WebGL. They have a lot of exciting demos using WebGL. It is a good place to look at.
  • Mathematical Concepts of 3D - an guide of math from seneca game programming course.
  • a tutorial of openGL - a tutorial of openGL. i had only read the one that I linked to, but it already brought me a lot of understanding.

Next Step

The easiest is breaking someone's code. Second is writing my own code. After that, reading others codes. The most difficult is combining other people's codes with my own code and make sure didn't break anything. Now, I am going to the last step. Pushing my code in to code of processing.js. If luckily, I will be able to release the whole text() function before weekend. Otherwise, at least, I put out a 3D text() preview.

by Benjamin Huang (noreply@blogger.com) at March 18, 2010 04:52 AM


Harjinder Virdi

Bespin Word Wrap: Bug #542524

It seems like hours, days, and months…since I last worked on a bug. My last release was for Bug #509492.  A few days ago I acquired myself a new Bug #542524. So What is the problem? Not necessary a problem but a feature.The folks at Bespin want to implement word wrap feature into the Bespin Editor. Now what the heck is word wrap? Word wrap is a feature that allows an editor to automatically shift words to the next line if the words are too large to fit onto the current line.

First step

Thanks to David Humphrey for pointing out how I should get started with this. Initially I began reading about various Algorithms used to perform word wrap and the most important factor is optimization. As much as we love to get a piece of code to do what we want it do, we do have to ask our self is it the most efficient way ? Even after speaking to Kevin Dangoor, his only requirement was to make sure that this feature did not slow down the editor!

Greedy Algorithm

SpaceLeft := LineWidth

for each Word in Text

if Width(Word) > SpaceLeft

insert line break before Word in Text

SpaceLeft := LineWidth - Width(Word)

else

SpaceLeft := SpaceLeft - (Width(Word) + SpaceWidth)

This Algorithm is called the “Greedy Algorithm” and it used by popular word processors like Microsoft Word and Open Office. This pseudo code as described goes through each word and tries to fit as many words it can on a line and continues this routine by going to the next line until there are no words left to insert.

Getting Started…?

So I get the idea of how to do this but I’m unclear as to where the code would go, I’m guessing it should be a function that should called when the editor is redrawn after each character is typed. I will ask the folks on #Bespin IRC channel for help. 

In the mean time I will start playing around with the code but I’m very hungry and I need to have my dinner…So I’ll continue from here, bye:) 

March 18, 2010 03:45 AM


Konstantin Novichikhin

Cross-compiling Firefox for Windows on Linux

Today I’m going to compile Firefox for Windows on a Linux box. And for that I’m not going to reinvent the wheel, but follow an existing guide.

This is what I’m going to need:

  • GNU Binutils – This is linker, assembler, and various other tools.
  • GCC 4.3 – I have GCC 4.4.3. I might have to install GCC 4.3, if GCC 4.4.3 doesn’t play well with Dehydra.
  • mingw-runtim, w32api, and Cygwin winsup – It has something to do with GCC cross compiler.
  • Netscape wintools – This is something that is need for some xpidl. A quick search reveals that it (might) stands for [X]Cross Platform Interface Definition Language.
  • And, off course, configuring Firefox build.

  1. binutils-2.18 surprisingly installed with no problems.
  2. Install mingw-runtime-3.14
  3. Same for w32api-3.11.
  4. Get GCC 4.3 source and winsup-src-20100315.

I had to get mpfr to install GCC, but other than that everything went without a problem.

Time to check the compiler:
[root@xxxxxx ~]# osd/mingw32/bin/i686-mingw32-gcc -v
Using built-in specs.
Target: i686-mingw32
Configured with: ../gcc-4.3.0/configure --prefix=/root/osd/mingw32/ --target=i686-mingw32 --with-gnu-ld --with-gnu-as --enable-__cxa_atexit --enable-languages=c,c++
Thread model: win32
gcc version 4.3.0 (GCC)

[root@xxxxxx ~]# osd/mingw32/bin/i686-mingw32-gcc test.c -o test.exe
[root@xxxxxx ~]# ls test*
test.c test.exe

On Windows:
C:\>test.exe
hello world!

I’m almost ready to build Firefox.


by Konstantin.Novichikhin at March 18, 2010 02:18 AM


Carolyn Woodley

Casting

I bloody hate casting. I have avoided it until this point.

I spent about half an hour knowing what I wanted to "return" from one of my functions, but getting a compilation error C2440, something along the lines of can't change type1 into type2. Took me a while to get why return *this was attempting to return an instance of BForm (the class I had declared and was working in) instead of BField, which was the type I was supposed to return. It was strange also because I had thought I had previously attempted casting for BField, but I suppose I must have forgotten the &. Still.... Damn you casting! I will conquer you and CRUSH you between my toes! Victory!!!

So just to recap:
BField& BForm::operator[](unsigned int index){
return (BField&)*this;
}
does nothing, but still, VICTORY!!! *kicks casting*

by CWoodley1 (noreply@blogger.com) at March 18, 2010 12:10 AM

March 17, 2010


Seneca Canvas3D Team

On the train to Mountainview

This is now my 3rd year attending GDC in San Francisco. As with other years I usually take this opportunity to visit with my professor who resides in Mountainview, California and use the time on the train to write a post about C3DL, a summary of the year and things to come. In the first year, C3DL had just barely begun. All we had were a couple of spinny cubes. Nothing to write home about really but it was a start. With the extraordinary work put into the project by Andor Salga, and many others, the project showed vast improvements by the second year. We were loading Collada models, we had the foundations of a pretty cool project. Khronos had just announced its specification for what would become WebGL which means applications made with our library would eventually become usable by any browser that supported WebGL. When we first started, we had to use the Canvas 3D addon and it was only available for Firefox. Today, with WebGL, applications made with C3DL work in pre-release versions of Chrome, Firefox and Safari.

We continued working on the library and added several more features. We were also very fortunate to begin work on a different project which gave us the opportunity to actually use the technology that we had built. That project resulted in a web application named Motionview.
Motionview allows an artist to remotely preview and select portions of motion capture shots made at a studio. Initially we were involved with the project to work only on a data converter for the web application. The viewer for the web app was originally going to be done using flash. However, we saw how this project was closely tied with C3DL. After all this application allowed the viewing of an actor’s movement in 3D space. We introduced this idea to our partners on the project and they agreed to use it. I would like to thank both Bedlam Games and the Navarra group for applying our library in a real web application. If you are interested in trying out Motionview, please contact me.

In the fall Andor, went back to school full time and did some amazing work for the processing.js project as part of his open source class. He continued to work on C3DL part time during his studies and we made the port over to WebGL. In early February I had been invited to speak as part of a Khronos sponsored session at GDC and thus I am here for my third year.

This coming summer promises to be very interesting. We will be working with some industry partners to develop our library and to add some really interesting WebGL based applications. Like the development of the motion capture application, these applications will help us add new features to C3DL.

by Cathy Leung at March 17, 2010 06:45 PM


Aleh Pliats

Skype, Google talk... and Microphone? Not necessary:-)

In our days programmers often use programs like Skype, Google talk, MSN, etc for conference calls. In order to participate in the call you need:
1. Computer with one of the program installed on it.
2. Internet.
3. Speakers.
4. Microphone.

But what to do if somebody already calling to you but you don't have microphone? How many of you tried to shout to your computer in hope that it has embedded microphone? :-). Solution was very close. In situation like that you just need to plug in another earphones in a plughole for microphone and talk to left earphone. Keep it very close to your mouse and also you may need to put microphone volume on maximum. For urgent call the quality of sound is very very acceptable but if you consider to have a long relationship with somebody on other end of the internet consider to buy a good microphone.

by oleg (noreply@blogger.com) at March 17, 2010 03:41 PM


Dmitriy Rozhkov

Students' home pages are not searchable

I am not sure about other departments, but every single CS student at Seneca College has its own web page http://matrix.senecac.on.ca/~username. None of those sites can be found through the search engines because crawling's blocked by the line 7 "Disallow: /" in robots.txt file. All respectable search engines carefully follow these instructions.

Currently most students have automatically generated page which is not very informative. Some students spent time developing it only to find out that content will never be found. This fact is very disapointing.

I think that Seneca will encourage more students to develop their personal pages if it allows search engines to crawl it.

by Dmitry Rozhkov (noreply@blogger.com) at March 17, 2010 02:59 PM


Derek Ambrose

Week 8

I have been studying this prototype that was given to us last week to try to gain a better understanding of the code behind a web-based IDE such as the one we are going to make. It seems very interesting, as it is in a multitude of files and languages already and it is quite early in the process. Like, the current prototype is as basic and as skeletal as it gets and it is already separated into 5 files including one of just pictures. I think it is more compressed than it could be even, as all the buttons are in one .png file and seem to be cut from the .png file using css. That is some skillful programming. I have thought of an idea of what the file system should look like but have yet to put it on paper/e-paper and share it among the team. That is the next step...

by Derek (noreply@blogger.com) at March 17, 2010 07:08 AM


Scott Downe

Quick little fix

Yesterday, while cruising the processing.js bug tracking website lightouse looking at the open tickets, and seeing what was happening I can across ticket #382.

It was small so I figured I might as well do it. Throw it in with my 0.2.

I've also started thinking about doing what I did here for string parsing to regular expressions. The first thing that comes to mind is the order in which I must do this. I can mask all strings first, then mask all regular expressions, or vice versa. I would have to replace them in the opposite order in which I mask them, that's a given. I also have to now modify my as I now have to check if a string contains OR , as an example. I think it would be easiest to mask regex first, as I already have the code to check that it's not in a string. So, use that code, find all regex's not in a string, mask them, and any string like code inside the regex will already be gone, so I wouldn't have to check for regex when I mask the strings, and replace again, but in reverse.

by Scott (noreply@blogger.com) at March 17, 2010 04:05 AM


Minoo Ziaei

SVN in Visual Studio

I don’t know it’s just me, or anybody else has had this moment too.
It happened a lot to me, that I had revised my code in our repo and then just forgot
to commit it.
So, they day after imagine you want to work on it at the school, and there is no access to revised code!
Once I saw Fardad had this little green circles! beside his .cpp and .h file names in Visual Studio and
I just thought it was really cool to have this option.
So, here is the link I found. You just need to download it, run it and as soon as you open your Visual Studio, it’s there!
How simple is that..


by minooz at March 17, 2010 02:15 AM

March 16, 2010


Anna Sobiepanek

A meeting with Thanh Dao

As I stated in my last post, I have been meeting with new Processing js project members to get them going on submitting tickets. During the last meeting I helped set up Thanh Dao’s repo but it was up to him to get GitBash going. Today, I met with him again to make sure he was on track. Basically, my approach was to submit 2 of his tickets with him and then let him submit the reset by himself. I think practice is the best way to learn. Unfortunately, the String prototype functions he wrote were of no use because they are already in the core of JavaScript; but we didn’t let that stop us. We updated two of the tickets and then later changed them to invalid. The basic steps are as followed: checkout the clean GitHub branch your working with, merge my most recent code (right now 0.7 branch), run all of the parser/unit tests to ensure nothing was already broken, add the new code manually into processing.js and any other unit/parser test that were written, add the files to GitHub and commit (without the Makefile of course), run the parser tests again, if the tests passed push them to GitHub. Once the commit was done, we then updated the lighthouse ticket with a little note as well as a link to the branch or the commit. The rule for this is that if the ticket was done in one commit, putting a link to the commit is sufficient. However, if there were more than one commits made to the branch, then the ticket should contain a link to the entire branch.

Since all of Thanh’s tickets were invalid, he went home with the job of going through the tickets and picking more to work on.

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


by annasob at March 16, 2010 06:40 PM


Jatinder Singh

jtProgramCurriculum Spring Application

I am feeling very excited to finish my first milestone i.e. reading of Expert Spring MVC and Web Flow book. The book reveals nits and grits of Spring MVC and how to use it. During my reading of the book I actually built a Flight Center application that gave me hands on experience with Spring MVC framework. I will be spending rest of the week creating another Spring Application called jtProgramCurriculum. The application will focus on Web forms, Validation and may be Spring Web Flow (haven’t really decided on this yet). For the validation of form data I am planning to use vlang. vlang stands for Validation Language. I will keep this application very simple with very general use cases. I will apply Test Driven Development (TDD) in this project and create unit tests for each and every class. Later on I also plan to use Clover (Code Coverage Analysis Application) to see the amount of code covered by my unit tests.


by jsinghfoss at March 16, 2010 03:22 AM


Jianming Chen

Processing.js Project – Can’t deal with multiple catch blocks bug

I have worked on Can’t deal with multiple catch blocks for several weeks. The idea is easy. Using JavaScript RegExp to translate the aCode. First, I try to remain multiple catch blocks, and just change the exception var name. Building the regexp statement is hard, because there is several var name in the catch block. Fortunately, I can find lots of sample in the file processing.js . This is a interesting thing that you can learn from that you are fixing. However, at last, it doesn’t work because JavaScript just can handle single unconditional catch. With the instruction of  my profession, I turn multiple catch blocks into one and discard the other multiple catch block. I have learned lots of from fixing this bug.


by jmchen11 at March 16, 2010 02:45 AM

March 15, 2010


Andor Salga (asalga)

Release 0.7

I just finished my 0.7 release for my DPS911 class at Seneca College. For this project I continued with my work on Processing.js, using WebGL to add lighting functions. Check out my demos below. You’ll need a WebGL-compatible browser to run them. Get either Minefield, Webkit or Chromium.


Mouse Directional Light

Bouncing Box

Disco

Sol

Processing.JS Web IDE

The demos above use the functions I added to the library which are:

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

Not Quite Deja Vu

It might seem this release is just a repeat of my 0.3 release, but in truth that release just didn’t have the flexibility we have now to be useful. This code doesn’t have literals and hacks holding it together- it’s flexible, and very much programmable. This is possible thanks to a proper camera and 3D matrix object. No crappy hard-coding going on over here.

Lighting 2D and 3D Shapes

So last time I wrote these functions we didn’t have fill() and stroke(), so this time I had to figure out how Processing lit filled shapes and their outline strokes. It turns out the strokes aren’t lit, but the fill colors are. Since the lighting calculations are done in the vertex shader, I had to play around with my old code. While doing so I found out that “2D” shapes such as lines and points aren’t lit either. It was at that point I had to decide if we should continue using one shader for all rendering or if we should have a simpler one for rendering unlit vertices. After thinking about it for a while, I ended up deciding to write a simpler set of shaders for 2D geometry. Will having a simpler shader outweigh the cost of switching program objects and setting uniform variables twice? This is something I’m prepared to profile and fix as necessary.

Creating createProgramObject()

Because there are now two shaders, I had to abstract the process of creating a program object (which is a set of vertex and fragment shaders). I created a createProgram() function for this. This returns a program object and reduces some redundancy in the code. The interface can’t be simpler:
createProgramObject( vertexSource, fragmentSource );

Silly Bugs

While working on this release I found myself making some very silly mistakes. I figure it’s worth mentioning them to remind myself not to do them again.

So because we now have two shaders, it is necessary to call useProgram() every time a uniform or attribute in a specific shader needs to be set. Calling uniformi(), uniformf(), etc. won’t work if the incorrect program object is loaded. This means in my light functions I needed to load the correct program object before accessing the lights since the 2D program has no such variables. This is something I kept forgetting.

Next, what’s wrong with this bit of code?
uniformf( programObject, "lights["+count+"].type", 1.0 );
The problem is the light type in the vertex shader is defined as an int, not a float. The result isn’t a thrown exception or crash. The scene just renders incorrectly. It’s not the first time I made this mistake, but it also has become easier to spot every time. It also doesn’t help that uniformf() and uniformi() look so similar.

Box and Sphere Normals

When I started working on the lights, I assumed the normals of the box shape point ‘diagonally’ out, that is not parallel to the 3D axis. This was simple to implement since the normals matched the vertices one for one. But when I ran my first test, I noticed my result differed from Processing. First I thought it was the winding order of my vertices and I wasn’t in the mood to start hacking at raw vertices. I switched to try to light the sphere, but had problems there too. The normals seemed to be ‘off’ somehow and my sphere didn’t seem smooth. I knew the normals in this case should point in the same ‘out’ direction as their corresponding vertices. So I removed the normals array in the code and just passed in the vertices as my normal attribute to my shader which fixed the problem.

I then went back to my box and realized Processing’s normals for box are probably not what I had thought them to be. I learned that each ‘face’ of the box had its normals pointing parallel to the 3D axis. So I had to go through all the vertices of the cube, find out which face it was (front, back, sides) and create a static array which had corresponding correct normals. I used to have the box vertices in one long line of code, so make things easier in the future, I broke up that line of code into six lines. One line for each face and labeled the order. I also believe in adhering to the 80 character standard which just about matches what I have now.

Saturated Colors

I’ve noticed the final rendered sketch on different browsers (Chrome, Firefox, Safari) don’t appear identical in terms of color. It almost seems as if on Chrome and Safari the colors seem saturated. When comparing my reference images from Processing, the scene looks slightly ‘washed out’ depending on the browser. I suppose I’ll need to file this somewhere.

Wiki Update

I updated my wiki page which includes links to the Lighthouse tickets I completed, my GitHub branch, demos, tests and a diff which shows the work I did.

Web IDE

I also added the four demos I wrote for this release to the dropdown in my Processin.JS Web IDE.


Filed under: Open Source, Processing.js, WebGL

by asalga at March 15, 2010 11:26 PM


Roger Dicke

Minimal Testcase

I’ve just been asked to produce a minimal testcase, specifically for the Function Pointer Parameter Problem. I have a feeling that these pages will be my friends for a while:

Minimal Testcases:

QA/Minimal Test Cases – MozillaWiki

Reducing testcases – MDC

Back to Dehydra basics (review):

Dehydra – MDC

As a matter of fact, I think this one just saved my life:

Using Dehydra – MDC


by enderstruth at March 15, 2010 07:14 PM


Daniel Hodgin

PImage roadmap

With Processing.js’s 0.7 release coming late this week I’m preparing to get as much PImage content packed up, tested, and approved for this release.

Here is a complete list of everything that has to be done to bring the library in line with being able to handle and use a PImage object internally.

PImage upcoming changes to library

PImage constructors
PImage(<img>) accept a reference to a HTML img object and convert it to a PImage
PImage(w, h) create a PImage object with default mode RGB (alpha set to 255)
PImage(w, h, f) create a PImage object with format ARGB
PImage prototypes
.toImageData converts the PImage object to a canvas ImageData object
.fromImageData(ImageData) converts a canvas ImageData object to a PImage object
.get() PImage.get() returns a PImage object of itself
.get(x,y) returns color (int) of PImage coordinate x,y
.get(x,y,w,h) returns PImage object of width and height at coordinate x,y
.set(x,y,color) x,y coordinate, color is a color set the pixel that color
.copy(sx,sy,sw,sh,dx,dy,dw,dh) copy source area to destination area
.copy(srcimg,sx,sy,sw,sh,dx,dy,dw,dh) copy source area of srcimg to destination area
.mask(img) a source image to use as the alpha channel for this image
.mask(alphaArray) an int array to use as the alpha channel for this image
.blend(sx,sy,sw,sh,dx,dy,dw,dh,MODE) blend the source rect to the dest rect of MODE mode
.blend(srcimg,sx,sy,sw,sh,dx,dy,dw,dh,MODE) blend the source rect of srcimg to the dest rect of MODE mode
.filter(MODE) filter an image with mode MODE
.filter(MODE, l) filter an image with mode MODE and level l (int of range 0-1)
.save(filename) save the PImage to a file
.resize(w,h) resize PImage to width and height
.loadPixels() loadPixel data into PImage objects pixels[] array
.updatePixels() update the pixels in the PImage objects pixel array
Processing functions that need updating to handle PImage objects
p.createImage(w,h,f) create a PImage object of width height and format specified
p.loadImage(f) load an image of filename f
p.loadImage(f, e) load an image of filename f with extension e if no extension given in f
p.requestImage(f) asynchronously load an image f in a separate thread while continuing sketch execution
p.requestImage(f,e) asynchronously load an image f with extension e in a seperate thread while continuing sketch execution
p.image(img,x,y) place a PImage img at x,y coordinate
p.image(img,x,y,w,h) place a PImage img at x,y coordinate of width w height h
p.imageMode(MODE) set a flag to tell p.image() how to interpret w,h
p.get() return a PImage of the current canvas
p.get(x,y) return the color at coordinate x,y
p.get(x,y,w,h) return a PImage of width and height at x,y from main canvas
p.set(x,y,c) x,y coordinate, set this pixel color c
p.set(x,y,img) x,y coordinate, img is a PImage, draw the PImage there
p.loadPixels load a pixel array of the main canvas into pixels[]
p.updatePixels update a pixel array of the main canvas into pixels[]
p.blend(sx,sy,sw,sh,dx,dy,dw,dh,MODE) blend the source rect to the dest rect of MODE mode
p.blend(srcimg,sx,sy,sw,sh,dx,dy,dw,dh,MODE) blend the source rect of srcimg to the dest rect of MODE mode
p.copy(sx,sy,sw,sh,dx,dy,dw,dh) copy source area to destination area
p.copy(srcimg,sx,sy,sw,sh,dx,dy,dw,dh) copy source area of srcimg to destination area
p.filter(MODE) filter the canvas with mode MODE
p.filter(MODE, l) filter the canvas with mode MODE and level l (int of range 0-1)
p.pixels[] pixel array of the current canvas
p.background(b) draw the background PImage b to the background
Blend modes

BLEND, ADD, SUBTRACT, LIGHTEST, DARKEST, DIFFERENCE, EXCLUSION, MULTIPLY, SCREEN, OVERLAY, HARD_LIGHT, SOFT_LIGHT, DODGE, BURN

Filter modes

THRESHOLD, GRAY, INVERT, POSTERIZE, BLUR, OPAQUE, ERODE, or DILATE

Some of this is done, some is started, some is not yet started.  I’ll be adding tickets to lighthouse later today to keep track of it all and pushing some code this evening for 0.7 review and approval hopefully in time !


by dhodgin at March 15, 2010 12:28 PM


Donna Oberes

Container Classes

IRC meetings have become so slow that Fardad Soleimanloo has now decided to try using voice conferences through Skype! Though OOP344 is not an open source course (like OSD600), the project for it sure is starting to look and work like one. (Just this morning I had to chuckle at my team--scheduling a meeting that works with everyone's schedules is a nightmare.) I find the course incredible because in all my years of studying, I've never seen a teacher put so much time into a course or students asked to put so much into it either. In university for Economics, I mastered the art of cramming for every midterm and test (those were all you were getting marked on, after all). I studied strategically and aced most of them, but I didn't retain much info in the end. I'm finding that in college, with weekly due dates for each course, you have to keep at it or fall behind if you let things slide even by a week.

Anyway, the real point of this post was to share a couple of nifty little webpages about container classes. In our last IRC meeting, my group had a bouncy, yellow question mark over our collective heads because we just didn't grasp the idea of them soon enough. But the fact is, container classes really are how Fardad described: they are an array (another kind of container) for objects. Here is the webpage, complete with a sample class, from learncpp.com. I haven't read this one from parashift.com yet, but the writing seemed pretty funny, especially after learning the basics of a container class.

I haven't read the textbook section for stacks and queues yet (and yes, that means I haven't coded how a queue works yet, either), but the above webpages really helped me understand the basic idea for them. I hope they help someone else, too.

by Donna_Oberes (noreply@blogger.com) at March 15, 2010 12:21 PM


Roger Dicke

0.7 Release

About

This is release 0.7 of the Mozilla External String Guide. More information is here and this is the project plan blog post.

In This Release

This release saw some page additions and changes which have been waiting to be done for a while now. The additions include:

  • Memory Allocation
  • Literal Strings
  • String Concatenation
  • Local/Member Variables

Changes to the page include moving methods out from under Helper Classes and Functions” to “Using Strings.” A note was also added about MOZILLA_EXTERNAL_API under “Includes.”

Interesting Things This Release

Some of the examples included is code taken from the Mozilla Cross-Reference.

It seems the final word is that the static analysis docs do not have to have information added to them.

Problems This Release

I was supposed to get a new contact for help on the Function Pointer Parameter Problem, but haven’t heard much. However as I have other things to work on I didn’t take a head on approach yet. I really want to get this problem fixes, so the time to push is now.


by enderstruth at March 15, 2010 06:24 AM


Mickael Medel (aSydiK)

0.7 release

I was a little hard-pressed for this week’s release.  Mainly because I thought the release to be next week.  I did have some stuff done before but I wasn’t in much of a rush to finish it, until I found out it was to be out this Monday morning.  I got in gear but still had much trouble with beginCamera() and endCamera().  The functions you see there seem pretty simple but having to use the inverse of camera threw me for a loop.  I had to look for the problem everywhere in the code.  At one point, I rewrote the whole invert function only to find out it was working properly.  Some key objects I was missing were dependent on deprecated functions.  At least, the code within the Processing native said they were to be removed from the future.  In that sense, my colleague decided it wasn’t needed in PJS.  I quite agree with him still.  It’s not completely needed, some of those inverse functions anyway.  I could and will probably recycle some of the regular functions and just apply the inverse.  I did add them all for now though.

That’s not all there is to it either.  As I was submitting an example through git, I found a bug that still currently resides with my checked-in code.  It may seem like it works properly, but insert a camera() function in there and the changes don’t take.  That is definitely a problem because suppose it’s put in a draw{} statement.  It wouldn’t have an anchor that can put it back to place… it’ll just continue to transform.  It’s somewhat of a big bug that I can’t finish tonight.  I’m leaving it up to the reviewers to pass or fail.  I doubt it’s going to pass… I’m not sure I would pass it either.

On a lighter note, I was able to finish the dist-3d days ago.  I was just so wrapped up with beginCamera() and endCamera() that I never wrote the tests for it.  I wrote my first unit tests earlier today and it was a breeze.  I’m definitely glad that was added to the PJS scope.  It definitely makes unit tests much easier.

Anyway, off to bed.  Maybe someone will have read this blog and figured out a way to help me with the camera.  Dave was right.  It was my fault for waiting til the last second to ask for help.  I’ll blog more soon… still have to get PGraphics off the ground.


by aSydiK at March 15, 2010 06:23 AM


Scott Downe

Tabs break nothing!

I mentioned in my last post that I would be taking something on to add to my 0.2, so I did processing.js ticket #351 and wrapped it up the same day. Not bad, but it was easy.

In my last post I talked about how I was able to reproduce the bug, and the next step was to find, where in the code, variables are changed to var. This is what the code in question looked like before I got to it.

// float foo = 5;
aCode = aCode.replace(/(?:static\s+)?(?:final\s+)?(\w+)((?:\[\])+| ) *(\w+)\[?\]?(\s*[=,;])/g, function (all, type, arr, name, sep) {
if (type === "return") {
return all;
} else {
return "var " + name + sep;
}
});

What is happening, is it's matching a regular expression to the code to be parsed, sending the matched groups into a function in the order of (all, type, arr, name, sep) the first parameter is always the whole matching string, and each one that follows is the next match group and so on. The function will do something with the sent values, in this case, swapping the variable type for "var " and removing any array brackets. this new string is then replaced with the original matching string.

The problem was, it was only doing this if there was a space between "int i" this is a closer look at the culprit "(\w+)((?:\[\])+| ) *(\w+)" first it matches a word, something like int, char, anything like that, then it look for any number of [] OR a space, then 0 or more spaces, then another word. I simply changed the spaces to \s, which included all whitespace, including tab, and not just a space, resulting in this.

// float foo = 5;
aCode = aCode.replace(/(?:static\s+)?(?:final\s+)?(\w+)((?:\[\])+|\s)\s*(\w+)\[?\]?(\s*[=,;])/g, function (all, type, arr, name, sep) {
if (type === "return") {
return all;
} else {
return "var " + name + sep;
}
});

Now when a tab is found between int i; it's not ignored, the parsing of int i; is not ignored.

by Scott (noreply@blogger.com) at March 15, 2010 04:01 AM


Dachuan Huang

linker: Stack and Queue

The concept for stack and queue (linker) is actually simple, create a container class that has a pointer or pointers, then create a sub class that has data and pointer to its own class type. Link the container class’s pointer to one of the sub class, then link the sub class object one by another. Actually it is easy then what it sounds, but anyway. Stack or queue depending on how each item is linked: if they are stacked on each other, meaning the top one is the last one, then it is a stack; if they are in order of each other, meaning the first one appears first, then it is in sequence, hence queue.
However, I was actually confused at first. First, because I am new to the object orientated concept, I always tend to confuse class and objects instances, such as one container class contains many sequential classes, this is false. There are only two classes, one container, one sub. One sub class can instantiated many objects that are linked together and owned by container. Second, I thought Node* was a pointer type, like char* or int* or File* or void* (don’t ask me why!), but it is actually just a class name, Therefore Node* is a pointer to that class. To confirm my suspicion, I replaced all the Node to BooBoo, and it still worked like charm:P (I know I am just stupid)
Also, we are asked in class to do a queue linker, I code it this way:

//two pointers: head and tail in container’s class
void Queue::add(int data){
Node* n = 0;
Node* temp = tail;
tail = new Node(data,n);
if(temp)
temp->next = tail;
if (!head)
head = tail;
}

and an []operator and/or visit() function to display data at object index number, I code both the same way:

int Queue::operator[](int index){
Node* temp = head;
for (int i = 0; i next;
}
int r = temp->data;
return r;
}


by hdc23 at March 15, 2010 12:38 AM

March 14, 2010


Zhibin Huang

3D text on HTML5

I have to say this is very difficult, and I am still not very sure how it works.

What I made




What is that

I combine the code from WebGL Lesson 5, the WebGL series Lesson that Soctt mentioned about, with a textdemo from glge. This example will be the prototype of my release 0.2.

The idea

The idea of how to implement 3d text is draw the text as texture, then transparent the background. Therefore, I still have a long way to good.

by Benjamin Huang (noreply@blogger.com) at March 14, 2010 11:43 PM


Sadiki Latty

ARM mock build info for beneath-a-steel-sky-cd

Source RPM: beneath-a-steel-sky-cd-0.0372-4.fc12.src.rpm
Processor: ARM processor (under emulation)
Command used: mock -r fedora-12-arm ~/armPacks/beneath-a-steel-sky-cd-0.0372-4.fc12.src.rpm

Comments: (SUCCESS)

firstbuild:

real 13m43.593s
user 9m27.560s
sys 2m41.840s

secondbuild:

real 13m18.596s
user 9m23.130s
sys 2m15.540s

by Sadiki Latty (noreply@blogger.com) at March 14, 2010 06:52 PM

ARM mock Build info for python-basemap

Source RPM: python-basemap-0.99.2-5.fc12.src.rpm
Processor: ARM processor (under emulation)
Command used: mock -r fedora-12-arm ~/armPacks/python-basemap-0.99.2-5.fc12.src.rpm

Comments:

After approximately 8 minutes the build fails and produces 2 errors saying

1. "Bad build req: No Package Found for geos-devel. Exiting."

2. "Exception(/home/user1/armPacks/python-basemap-0.99.2-5.fc12.src.rpm) Config(fedora-12-arm) 6 minutes 29 seconds"

After investigating the build/error logs located at "/var/lib/mock/fedora-12-arm/" it was realized that geos-devel was an intricate component for python-basemap and could not be excluded.

This issue will be revisited later.

by Sadiki Latty (noreply@blogger.com) at March 14, 2010 06:23 PM


Liang Wang

static

Keyword static is used for declaring static variables in c. This modifier is used with all data types like int, float, double, array, pointer, structure, function etc. Important points about static keyword:


1. It is not default storage class of global variables. For example, analyze the following three programs and its output.


(a)


#include
int a;
int main(){
printf("%d",a);
return 0;
}


Output: 0


(b)


#include
static int a;
int main(){
printf("%d",a);
return 0;
}


Output: 0


(c)


#include
extern int a;
int main(){
printf("%d",a);
return 0;
}
Output: Compilation error


At first glance if you will observe the output of above three codes you can say default storage class of global variable is static. But it is not true. Why? Read extern storage class.


2. Default initial value of static integral type variables are zero otherwise null. For example:


#include
static char c;
static int i;
static float f;
static char *str;
int main(){
printf("%d %d %f %s",c,i,f,str);
return 0;
}




Output: 0 0 0.000000 (null)


3. A same static variable can be declared many times but we can initialize at only one time. For example:


(a)


#include
static int i; //Declaring the variable i.
static int i=25; //Initializing the variable.
static int i; //Again declaring the variable i.
int main(){
static int i; //Again declaring the variable i.
printf("%d",i);
return 0;
}


Output: 25


(b)
#include
static int i; //Declaring the variable
static int i=25; //Initializing the variable
int main(){
printf("%d",i);
return 0;
}
static int i=20; //Again initializing the variable




Output: Compilation error: Multiple initialization variable i.

by liang's oop344 (noreply@blogger.com) at March 14, 2010 03:18 PM

Understanding va_list

Understanding va_list
Writing your own function that uses a va_list is really easy!

But first, let’s identify what a va_list is.

Think about the printf() C function.

printf(“Hello there! I like the numbers %d, %d and %d\n\n\n”, 1, 3, 7);

Obviously the output of that function call would be:

Hello there! I like the numbers 1, 3 and 7

But the key point here is, the printf() function can accept a VARYING NUMBER OF ARGUMENTS. That’s because it uses a va_list.

If you look at the signature for printf(), it looks like this:

int printf( char * format, … );

So the argument list for printf() has 2 main things:

char * format – a regular string
and a second special argument, … (3 dots, just like that)
… is called an “ellipsis”, and it means, in plain English: “any number of optional arguments can go here.”

So somehow, in the innermost bowels of printf(), is some sticky code that somehow retrieves each one of the the list of args you’re passing in, in the place of the “…”.

Cool! So is it possible for us to write our functions that have their own sticky code that can process a set of VARIABLE ARGUMENTS???

YES YOU CAN. And its actually simple!

An example:

#include
#include

int addThemAll( int numargs, ... )
{
// So this function can accept a variable number
// of arguments. No (practically speaking) limits.

// RULES you must know in order to be able to use "..." in one of your
// own functions:
//
// 1) The ... MUST appear exactly as ...
// It cannot be "..." (with the quotes),
// '...', or anything else weird.
//
// 2) The ... __MUST GO LAST__ IN THE ARGUMENT LIST
//
// 3) THERE MUST BE AT LEAST ONE MANDATORY, NON-OPTIONAL ARGUMENT,
// THAT COMES BEFORE THE ...

// We'll be using these macros here:
/*
va_list va_start va_end va_arg
*/

// All of the above va_* things are actually special MACROS,
// exclusively defined for us to use when working with
// _V_ariable _A_rgument lists.

// FIRST, we create a POINTER that will be used
// to point to the first element of the VARIABLE
// ARGUMENT LIST.
va_list listPointer;

// Currently, listPointer is UNINITIALIZED, however,
// SO, now we make listPointer point to
// the first argument in the list
va_start( listPointer, numargs );

// Notice that numargs is the LAST MANDATORY ARGUMENT
// that the addThemAll() function takes.
// By "LAST MANDATORY ARGUMENT", I mean 'numargs'
// is the last argument to the addThemAll() function
// JUST BEFORE the "..."

// NEXT, we're going to start to actually retrieve
// the values from the va_list itself.
// THERE IS A CATCH HERE. YOU MUST KNOW THE
// DATA TYPE OF THE DATA YOU ARE RETRIEVING
// FROM THE va_list. In this example, I'm assuming
// they're all ints, but you could always pass a format
// string that lets you know the types.

int sum = 0;
for( int i = 0 ; i < numargs; i++ )
{
// GET an arg. YOU MUST KNOW
// THE TYPE OF THE ARG TO RETRIEVE
// IT FROM THE va_list.
int arg = va_arg( listPointer, int );

printf( " The %dth arg is %d\n", i, arg );

sum += arg;
}

printf("--");
printf("END OF ARGUMENT LIST\n\n");

// FINALLY, we clean up by saying
// va_end(). Don't forget to do this
// BEFORE the addThemAll() function returns!
va_end( listPointer );

printf("The total sum was %d\n\n", sum);

return sum;
}

int main()
{
// Try it out.

printf("Calling 'addThemAll( 3, 104, 29, 46 );' . . .\n");
addThemAll( 3, 104, 29, 46 );

printf("Calling 'addThemAll( 8, 1, 2, 3, 4, 5, 6, 7, 8 );' . . .\n");
addThemAll( 8, 1, 2, 3, 4, 5, 6, 7, 8 );

return 0;
}

by liang's oop344 (noreply@blogger.com) at March 14, 2010 03:12 PM


Shengwei Wang

A class to perform like Linked list

Linked list is a common data structure type. FIFO (First In First Out) is its principle. Click here to see more about linked list.

Here is my solution:
A class named queue that can perform like a doubly-linked list.

It's really a basic version that only works for int right now, but it can be improved to associate with other data types and derived data types.

by Shengwei (noreply@blogger.com) at March 14, 2010 04:59 AM


Kai Xu

linklist!

LinkedList.h

class LinkedList;

class Node{
int data;
Node* next;
Node(int data , Node* next = (Node*)0);
friend class LinkedList;
};


class LinkedList{
Node* head;
Node* tail;
public:
LinkedList();
void add(int data);
int remove();
bool IsEmpty();
~LinkedList();
};

Linkedlist.cpp

#include "linkedlist.h"


Node::Node(int data, Node* next){
this->data = data;
this->next = next;
}


LinkedList::LinkedList(){
head = tail = (Node*)0;
}

LinkedList::~LinkedList(){
while(!IsEmpty()) remove();
}

LinkedList::add(int data){
Node* temp = new Node(data, tail);
if(tail){
tail->next = temp;
tail = temp;
}
else{
head = tail = temp;
}
}

bool LinkedList::IsEmpty(){
return !tail;
}

int LinkedList::remove(){
int data = 0;
return data;
}

I'm not sure this is correct !

by Kai (noreply@blogger.com) at March 14, 2010 03:25 AM


Andor Salga (asalga)

Light Sphere Deja Vu

I’m working on adding ambient lights and directional lights to Processing.js using WebGL. I had already implemented this before but we (the PJS team) couldn’t add it to the repository because too many pieces were missing, such as the camera and matrix objects. Now that those are in, this release I can finally get this code in. However, since then the library changed quite a bit. We now have stroke and fill colors, point and lines primitives and changes to the WebGL spec. Because of this, I had to go back and revise my implementations of lights as well as my demos. While doing this I ran into some stupid bugs which set me back, but it looks like everything is looking pretty good now (see screenshot yay!). I’m still experiencing some issues with opacity in Minefield, but that’s about the biggest issue right now.


Filed under: Open Source, Processing.js, WebGL

by asalga at March 14, 2010 12:45 AM

March 13, 2010


Scott Downe

Back!

It's been a week since I blogged, but I've been all over the place doing small stuff and getting organized, and there wasn't much to say :P

My 0.2 is due next week and I've got my mouse scroll awaiting review, and here is my post covering that, but I would like to get one more thing pushed out before next week is over.

I have the private keyword that I've been working on in the past, and kinda pushed it to the side in favour of string parsing. I figured I would go back to the private keyword but I noticed Corban Brook was working on this ticket, which may include an overhauling for the way processing.js handles the parsing of classes, which would make the way it handles the private keyword too, hopefully making it easier for me later. This excites me and I'm going to be following it, and pushing the private key word back to 0.3 along with another planned ticket to parse regex content much like I parsed string content.

Anyway, for now, I've decided to take on this one tabs break code. This is a bug that causes the code to crash if a tab is used in a certain place instead of a space. I have reproduced the bug and it seems to only work (the bug works, not the code:P) when there is a tab after a variable type, but before the variable name, like so:

int anInt = 0;

This does not work, but oddly enough, these example DO work:

int anInt = 0;
println (anInt);

The only place this causes the error (that I have found) is after the variable type and before the variable name. I printed off the translated code, after it's been turned into javascript to see what's going on, and this is the result of the above error:

int anInt = 0;

and if I take out the tab, I get:

var anInt = 0;

Which works, so obviously, the tab is stopping the conversion of variable names in java like int, to var in javascript. The solution is probably pretty easy, just need to look through the parser, look for the regex that converts variables to vars, and add in a condition for tabs

by Scott (noreply@blogger.com) at March 13, 2010 08:34 PM


Kai Xu

Queue's Operations from the C++ Standard Template Library

bool empty()
Returns True if the queue is empty, and False otherwise.

T& front()
Returns a reference to the value at the front of a non-empty queue. There is also a constant version of this function, const T& front().

void pop()
Removes the item at the front of a non-empty queue.

void push(const T& foo)
Inserts the argument foo at the back of the queue.

size_type size()
Returns the total number of elements in the queue.

by Kai (noreply@blogger.com) at March 13, 2010 07:28 PM

va_list,va_start, va_arg, and va_end

va_list: Type to hold information about variable arguments

This type is used as a parameter for the macros defined in cstdarg to retrieve the additional arguments of a function.

Each compiler may implement this type in its own way. It is only intended to be used as the type for the object used as first argument for the va_start, va_arg and va_end macros.

va_start is in charge of initializing an object of this type, so that subsequent calls to va_arg with it retrieve the additional arguments passed to the function.

Before a function that has initialized a va_list object with va_start returns, the va_end shall be executed.

va_start
: Initialize a variable argument list

void va_start ( va_list ap, paramN );

Initializes the object of type va_list passed as argument ap to hold the information needed to retrieve the additional arguments after parameter paramN with function va_arg.

A function that executes va_start, shall also execute va_end before it returns.

Parameters

ap
Object of type va_list that will hold the information needed to retrieve the additional arguments with va_arg.
paramN
Parameter name of the last named parameter in the function definition.

va_arg: Retrieve next argument


type va_arg ( va_list ap, type );

This macro expands to an expression that has the type type and the value of the next argument in the variable arguments list.

The next call to this macro will expand to the following argument in the same order as passed to the function.

Notice that va_arg cannot determine the actual type of the argument passed to the function, but uses whatever type is passed as the type macro argument as its type.

Notice also that va_arg does not determine either whether the retrieved argument is the last argument passed to the function (or even if it is an element past the end of that list). The function should be designed in such a way that the amount of parameters can be inferred in some way by the values of either the named parameters or the additional arguments already read.

Parameters

ap
Object of type va_list with information about the additional arguments an their retrieval state. This object shall have been initialized by an initial call to va_start before the first call to va_arg.
type
A type name. This type name is used as the type of the expression this macro expands to (i.e., its return type).
For a type expression to be suitable for its use with va_arg it must be such that when an asterisk (*) would be appended to its right the resulting expression would be a valid pointer type to a type object.

Return Value

Returns the next additional argument as an expression of type type.

va_end: End using variable argument list

void va_end ( va_list ap );

Performs the appropiate actions to facilitate a normal return by a function that has used the va_list object ap to retrieve its additional arguments.

This macro should be executed before the function returns whenever va_start has been previously used in that function.


Parameters

ap
va_list object previously initialized by va_start in the same function.

by Kai (noreply@blogger.com) at March 13, 2010 07:22 PM

Structure VS union

Structure enables us treat a number of different variables stored at different in memory , a union enables us to treat the same space in memory as a number of different variables.

Union allocates the memory equal to the maximum memory required by the member of the union but structure allocates the memory equal to the total memory required by the members.




by Kai (noreply@blogger.com) at March 13, 2010 06:59 PM


Wen Fang Chen

My solution for Queue

Here is my solution for Queue which we are asked to be finished by Fardad in this week class.

//queue.h
class Queue;
class Node{
int data;
Node* next;
Node(int data , Node* next = (Node*)0);
friend class Queue;
};

class Queue{
Node* head;
Node* tail;
public:
Queue(); // empty list
void add(int data); // adds to tail of the list
int remove(); // removes from head
bool IsEmpty();// true if empty
~Queue();
};

//queue.cpp
#include "queue.h"
Node::Node(int data , Node* next){
this->data = data;
this->next = next;
}
Queue::Queue(){
head = (Node*)0;
tail = (Node*)0;
}
void Queue::add(int data){
if (head==tail && !head){
Node* temp = new Node(data, tail);
head = temp;
tail = temp;
}
else{
Node* temp = new Node(data, tail->next);
tail->next = temp;
tail = temp;
}
}
int Queue::remove(){
int data = head->data;
Node* ToDel = head;
head = head->next;
delete ToDel;
return data;
}
bool Queue::IsEmpty(){
return !head;
}
Queue::~Queue(){
while(!IsEmpty()){
remove();
}
}
//queuemain.cpp
#include
using namespace std;
#include "queue.h"

int main(){
Queue Q;
int i;
for(i=10;i<=50;i+=10){
cout<<"Add into a queue "<<
Q.add(i);
}
while(!Q.IsEmpty()){
cout<<
}
return 0;
}
output as:

by Gwen (noreply@blogger.com) at March 13, 2010 05:12 PM

Some concepts in C and C++

Those questions are found when I prepared for my job interview question.They might be simple questions but I've never think of them.Hope that I can understand better, and also for anyone are learning C and C++.

Why the constructor can't be virtual?
A: Constructors cannot be virtual. Declaring a constructor as a virtual function is a syntax error. The reason is a constructor can not be virtual because at the time when the constructor is invoked the virtual table (vtable) would not be available in the memory.
Virtual allows us to call a function knowing only the interfaces and not the exact type of the object. To create an object you need complete information. In particular, you need to know the what you want to create exactly. Hence call to a constructor can't be virtual.

Difference between delete and destructor in c++?
Delete can deallocate the memory of those objects which are created by using the new operator whereas the destructor can delete any object once the life of the object ends.(this is normally when a program ends)

Differences between Structure and Class.
1.Structure cannot be inherited.
2.Structure is a value data type whereas Class is a reference type.
3.All declarations inside a structure are by default public whereas by default all the members inside the class are private.
4.Structure instances cannot be used as operand to arithmetic operators like +-*/ . But object (instances of classes) can be (using operator overloading).
5.A structure can't declare protected members,a class can.
6.We can't inherit a structue from another structure, which we can do in class.

Difference between "overloading" and "overriding"?
Overloading a method (or function) in C++ is the ability for functions of the same name to be defined as long as these methods have different signatures (different set of parameters). Method overriding is the ability of the inherited class rewriting the virtual method of the base class.

There are many valuable comments on it.

by Gwen (noreply@blogger.com) at March 13, 2010 03:55 PM


Shengwei Wang

qsort() practice

The practice is actually a question from my OOP344 TEST1. Requirement is as follows:
$ Q2 hello i am writing a text
a
am
hello
i
text
writing
$_
Write a program to produce the output above, using qsort() fucntion.

The solution is here. It's really a simple function, however I didn't do it completely correct during the exam. I think there are two reasons: first, I am not familiar with the qsort() function, though the spec is given; second, I didn't practice how to pass a function pointer as a parameter to a function.

by Shengwei (noreply@blogger.com) at March 13, 2010 03:26 PM


Daniel Gilloch

Arm Builds

Environment: Q6600, 4 gigs on ram, 7 virtualized arm machines ( on the Q6600 ) on a private NAT network.

Our attempt is to see which pre-existing SRPMS from FedoraCore 12 will be able to build on ARM, and if there are simple fixes in order to make them build, then to utilize them. At first these builds seemed to take a very long time, then we found out that was due to someone utilizing all the computers resources at the same time. After this changed build times went down. However, the virtualized machines do not seem consistent.

Later on I'm going to post all the build success and build failures and hopefully soon the real ARM machines will be in and we can compare how the builds in a virtualized ARM machine compare to the builds in a real arm machine.

by dgilloch (noreply@blogger.com) at March 13, 2010 03:24 PM


Jianming Chen

Processing.js for ticket #236

I change my regexp statement to

aCode = aCode.replace(/catch\s*\(\W*(\w*)\s+(\w*)\W*\)[^\{]*\{([^\}]*)\}/g,function(all,expName,name,blockCode){
blockCode = blockCode.replace(RegExp(“\(\\W\)”+name+”\(\\W\)”,”g”),”$1″+name+expName+”$2″);
return (“catch \( “+name+expName+” \)\{“+blockCode+”\}”);
});

Now, it works perfectly! However, I can’t pass the test. the test example is processing-js\test\parser\Processing-Book-001\Extensions\Network\_03\_03.pde . I believe that changing var name can’t fix this bug. But, I have no any other idea.  Also, my  Automated Test and git still have some problem.  Tomorrow, I will delete all my repository, and refork again. hope it will fix my problem. And, I will work on my other ticket.


by jmchen11 at March 13, 2010 03:44 AM

March 12, 2010


Anna Sobiepanek

A meeting with New Members

As I stated in my 0.7 release plan, I planned to meet with new members of the processing.js project from DPS909. Luckily, one of their classes got cancelled so I took the opportunity to meet with them in their regularly scheduled class. The purpose of the meeting was to get everyone going meaning: ensuring they had a lighthouse account, helping with github, explaining the workflow, and answering any questions they may have had. I believe the meeting went well.

Because managing a growing team is quite difficult, I tell all new members to put their names and info in the processing wiki page under the leader or contributor section. This way, I can contact them quickly it i need to.

Meeting details

I met with Scott Downe, Thanh Dao, Zhibin Huang, and Jianming Chen (Jimmy).  I actually met with Jimmy previously and helped him set up GitHub. I talked to each student individually and tried to figure out what they had problems with in order to get their tickets resolved. Scott had already submitted some tickets for review but he had some issues with the current ticket he was working on mouse scroll. His implementation was working but he needed to place it inside the actual processing.js file. I contacted Corban so that he can help him in figuring out where the best place to put his code is. Thanh had String tickets assigned to him but he had two separate GitHub repos. I fixed his main repo so that it forks from jeresig however, he now needed to set up GitBash. I pointed him to online Git Help and set up another meeting with him. Zhibin had trouble running unit/parser tests so I showed him how to edit the Makefile to point to his js.exe, and together we run the parser tests. He also has problems with this text() ticket, so I showed him how to get the text() function that was already there working on both JS and Java processing. I also showed hit the 3D stuff he needed to know in order to implement 3D text.

Overall, I was happy with the outcome of the meeting. I think the student will now be more comfortable with the code and getting tickets submitted.

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


by annasob at March 12, 2010 06:19 PM


Daniel Hodgin

0.7 release is moving in a forward direction

After 3 weeks of working my way backwards down the rabbit hole I have finally started to make some progress forward with plans for PImage.

Heres a short list of what is going to have to be done and in what order for my 0.7 release

  • write PImage constructors
  • add toImageData and fromImageData prototypes to easily adapt between PImage and canvas ImageData types
  • re-write image()
  • re-write createImage()
  • re-write loadImage()
  • re-write get(x,y,w,h)
  • test copy(), blend(), pimage.get(), pimage.set(), createimage(), loadimage(), image()
  • write prototypes for PImage’s blend, copy, filter, mask, get, set, loadpixels, updatepixels
  • test the prototypes

So yea obviously its not ALL going to get finished by Monday but I think i’ll be able to get a good portion of it done since a first draft of PImage, blend, copy, the blending modes, get, set, toImageData and fromImageData are done now.

Almost ready to get a working test going

More to come over the weekend


by dhodgin at March 12, 2010 05:51 AM


Cong Wang

a question about stack

in class we learned how S.pop() delete data in stack. My question is that whether we should delete data in reverse order?

S.push(Student("Fardad", "oop344", 56));

S.push(Student("John", "int322", 100));
S.push(Student("Jack", "int422", 90));
S.pop();
S.pop();
while(!S.IsEmpty()){
cout<<
}
Student StdStack::pop(){
Student ret = top->data;
Node* ToDel = top;
top = top->next;
delete ToDel;
return ret;
}
the output is Fardad, oop344: 56

i read some material in btp300
Element pop() {
Element data;
if (head) {
Node* p = head;
data = head->data;
head = head->next;
delete p;
}
return data;
}

Stack s;

// Push Data Onto Stack
s.push(3);
s.push(5);
s.push(9);
s.push(8);

// Remove first Node
s.pop();

// Pop Data Off Stack
while (!s.empty())
cout << s.pop().out() << ' ';
cout << endl;

the output is 9 5 3

could any one explain the difference between this two example why the pop() are different?

by wang cong (noreply@blogger.com) at March 12, 2010 02:13 AM


Jianming Chen

Processing.js Project

First of all, I thank Anna who is our processing project leader. She help me to set up my working environment on my computer, and make me understand processing.js and how it works. Also, assign me a new ticket #363.

For my previous ticket Can’t deal with multiple catch blocks, it is harder than I thought before. For my first solution, I believe  there just has one line one each block. I just need to the var name.  However, I found the test example has many lines one the catch blocks :

catch (IOException e) {
println(“Error calling Yahoo! Search Service: ” + e.toString());
e.printStackTrace();
} catch (SearchException e) {
println(“Error calling Yahoo! Search Service: ” + e.toString());
e.printStackTrace();
}

So, my solution does not work.  My task will be continue to study JavaScript RegExp. At the same time, I need to learn the JavaScrpt multi catch.



by jmchen11 at March 12, 2010 02:05 AM

March 11, 2010


Chris Tyler (ctyler)

Customer, not Criminal


I like TigerDirect stores: they're like geek supermarkets. However, they have some really annoying practices, such as entering my card number into their POS system, separately from their POS terminal; the terminal receipt shows only the last 5 digits of the card number, and the cash register receipt shows all but the last 6 digits. Anyone with those two receipts and the Luhn algorithm has the full card number.

But the practice that annoys me the most is having a person at the door "check the receipt" of each person making a purchase. The receipt-checker is standing only a few meters away from the cash register -- what is there to check? Is this an effective loss-prevention practice, or just a way to annoy customers?

Today I bought a micro-SD flash card with adapter for an Open-RD Client system that Seneca just purchased. The sales guy was helpful, and as I took the purchase to the lone cashier on duty, I found her talking to the receipt-checker. She shuffled over to the cash register. I paid and made my way to the door, and the receipt checker smiled at me and popped the top off his blue highlighter. I smiled back.

"May I check your receipt?" he asked.

"No," I answered, continuing to the door. I figured that the purchase has already been made, as far as I know they have no right to search or detain me, the receipt checker saw me pay the cashier, and it's obvious that I have one purchased item and one receipt in my hand.

Thinking he'd heard wrong, he again asked, "May I check it?"

"No," I replied, walking out.

"Thank you," he yelled after me as I left the store.

by Chris Tyler (nospam@example.com) at March 11, 2010 05:22 AM


Derek Ambrose

Thunderbird Build


I did the thunderbird build lab over the reading week. It involved updating a file so that it no longer displayed non-links in the link format.

I was having trouble building thunderbird first of all. I tried a number of times to rebuild but it kept getting this one error that would not allow me to open thunderbird. Whenever I ignored it or aborted it, the command prompt window would stop responding and close, and when I pressed cancel it closed it. A few days later I re-built it, however, and was successful.

I tried to reproduce the error but didn't realize that it would only reproduce once it was saved as a draft. I can attribute Scott's blog for that little tidbit. Since I had already read Scott's blog, I had a good idea of how to solve the issue. I opened up the mozTXTToHTMLConv.cpp file in the mozilla/netwerk/streamconv/converters directory and changed the necessary code, retested it and sure enough, success on all accounts (see picture).

Patch can be found here

by Derek (noreply@blogger.com) at March 11, 2010 02:39 AM