28 octombrie 2013

IR: simulare term-document incidence matrix, inverted index

Enunt:
(a). Write a program to create the term-document incidence matrix for a document collection. The output of this part will be binary term x document matrix file with headings associated with rows (index terms) and columns (DocIDs).

(b). Program to generate the inverted index(consisting of a dictionary and postings) for the input documents collection. There are four main steps to create inverted index:
 1) Collect the documents to be indexed.
 2) Tokenize the text, turning each document into a list of tokens.
 3) Do linguistic preprocessing, tokens normalization and stemming.
 4) Create an inverted index, consisting of a dictionary and postings.
You need not perform normalization and stemming in step 3. But you should remove stop words from the tokens list. The dictionary and postings will be the final output that can be in any mode (such as binary file, text file, screen display and so on).

Rezolvari:
java
* php

19 octombrie 2013

Exemple Otter: truth tellers, liars & normal people

O serie de probleme rezolvate în Otter. Primele 7 implică o lume locuită doar de truth tellers și mincinoși, pe când în ultimele 3 sunt introduși și oamenii „normali” (care spun adevărul sau mint, la întâmplare). Enunț - să se afle A, B (și C) dacă:
1) A says: at least one of us (A. B) is a liar

2) A says: either I am a liar or B is a truth teller.

3) A says: all of us are liars (A, B, C)
B says: exactly one of us (from A, B, C) is a truth teller

4) A says: all of us are liars (A, B, C)
B says: exactly one of us is a liar

5) A says: B is a liar
B says: A, C are of the same type (both liars or both truth tellers)

6) A says: if I am a truth teller, then so is B

7) A says: if B is a truth teller, then I am a liar

8) A, B, C each of the following: liar, truth teller, normal
A: I am normal
B: that is true
C: I am not normal

9) A truth teller can marry a liar and vice versa. Normal person can marry only normal person. A couple says:
Mr. A: My wife is not normal
Mrs A: My husband is not normal

10) The same couple. They say:
Mr A: My wife is normal
Mrs A: My husband is normal

Soluțiile aici.

15 octombrie 2013

Resurse pentru GRE, Toefl și pregătirea aplicației pentru SUA

GRE:
Barron's GRE - full preparation book (explicații & teste)
Princeton's GRE - full prep book (explicații & teste)

  • must work, cel puțin una din cărți (mai sunt și altele, de exemplu Kaplan GRE) . Dacă stați în București, cel mai convenabil mi se pare studiul la sediul Fulbright, e liniște, atmosferă ideală pentru studiu și aveți acces la o pleiadă de cărți pe care le puteți consulta gratuit

Mondays with Jen - tutoriale video pentru toate tipurile de exerciții la GRE

  • fff bun, ai impresia că iei meditații. Există episoade speciale care tratează doar exercițiile mai tricky de la GRE, dar și o colecție destul de bună de exerciții de vocabular, cum să abordezi textele pentru citit, etc

http://www.majortests.com/gre/ - liste de cuvinte, exerciții pentru verbal & quant

TOEFL:
Kaplan's Toefl ibt - tips pentru reading, writing & speaking
Youtube Toefl listening - cu răspunsuri

  • din nou, pentru mai multe materiale mergeți la Fulbright


Cea mai bună resursă online cu întrebări și răspunsuri:

  • Happy Schools Blog --- un blog despre orice aspect legat de aplicație și SUA, aproape exhaustiv. Perspectiva este indiană în principal, dar merge.

23 iulie 2013

Udacity HTML5 course (1)

* creating a XMLHttpRequest object
var request = new XMLHttpRequest();
request.open ('GET', myUrl, true); // true = async
request.onload = function () {
  // define your function
}
request.send();

* classes which extend other classes
Weapon = Class.extend({
    init: function() {  this._super(); }
});

MachineGun = Weapon.extend({
    init: function() { this._super(); }
});

* append a new image to a canvas
var img = new Image();
img.src = 'mySrc';
img.onload = function () {
  var canvas = document.createElement("canvas");
  var ctx = canvas.getContext('2d');
  var obj = ctx.drawImage(img, 192,192);
  // the origin of the canvas xOy system is on the top left corner
}

* Jpeg - good size/compression; bad Alpha
Png - bad size/compression; good Alpha
Webp - good; good

* create an animated canvas
// assets = array of paths to images; frames = new array of images
for (var i=0; i<assets.length; i++) {
        var img = new Image();
        img.src = assets[i];
        img.onload = onImageLoad;
        frames.push(img);
    }
var frameRate = 1000/30; // 30 fps
setInterval(animate, frameRate);

var animate = function() {
   // ctx = canvas.getContext('2d');
   ctx.clearRect(0,0,canvas.width, canvas.height);
   ctx.drawImage(frames[frame], 0, 0); // changes the current image to the next one
   frame++;
   if (frame == frames.length) {
        frame = 0;
   }
};

14 iunie 2013

Story of the Horse

I will tell the story of the Horse.


I was fixing a bug with logo & slogan upload for a company, which I heard it didn't work to change the logo. I had millions of tabs open and I couldn't distinguish between online & local anymore. I took a random GOLD company from online and checked it locally - but when I changed the logo (with a horse pic) I noticed I was online.. ooops. Let's change it. I tried to put the original logo back, but it wasn't taking effect...

Why a horse? It the beginning I wanted to put something nasty. Because I was annoyed that again I have this re-occurring bug and it's not pleasant. But with the horse on my mind all tempered.

Spent hours trying & trying to modify the company's logo and get rid of the horse. Locally it was working perfectly, but online not. At the end of the yesterday, I ended up deleting the logo, but planned to fix it asap on today.

The logo was delivered differently by the CDN in regard to whether you are logged in in FDQ or not. This was my impression. In Chrome I was logged in and seeing normally after changing the logo with the real one, in Mozilla I was seeing the horse, being unlogged. The same picture url. This is freakish... Had to tell to the boss.

I took the link of the pic separately and showed it to him. Of course I didn't show the company's profile ...



... but only the link of the picture alone :D So that he doesn't see my mistake. But boss saw the normal logo in both cases! again weird... but I was a little relieved. Maybe the bug fixed itself as weirdly as it appeared.

At a moment, boss wanted to send stg to the Senior guy Cristi and sent by mistake the link of this logo - horse. And Cristi opened the link and said:
- Hahahaha... what's up with this horse??

All laughed. 2 of the colleagues knew about this strange bug before and how much I was testing how they see in their computers. Cause I couldn't explain myself. A same picture url to be seen differently in different browsers:))))))

Then Cristi saw by the link it's the logo of an important FDQ gold member. This thing is sensitive because actually those Gold members pay thousands of euro to stay the first on the list and they got annoyed with anything disturbing  - example - if others have logo and their company logo is not there, they freak.

Cristi opened the directory and saw the famous company GUILMIN SARL with a horse picture attached:)))))))))))) all laughed:)))))))) I laughed:)))))))))) boss laughed:)))))))))) boss said: If Guilmin Sarl see this he  will kill us all... :)))))))))))))

The boss said: So this is how you are testing??? To this guy you put a horse, to next company you put a monkey , and so on........ Oh my god GG :)))))))))))))))

I explained it was a mistake:)))))))))))))))

In the end: nothing is deterministic!!!!! The rule of cause and effect doesn't always work.

Concluding the story with some Horse certificates: