Skip to content

Instantly share code, notes, and snippets.

View pruet's full-sized avatar

Pruet Boonma pruet

View GitHub Profile
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<body style="margin:0px;padding:0px;overflow:hidden">
<iframe src="http://a.com" frameborder="0" style="overflow:hidden;height:100%;width:50%" height="100%" width="50%"></iframe>
<iframe src="http://b.com" frameborder="0" style="overflow:hidden;height:100%;width:50%" height="100%" width="50%"></iframe>
</body>
Requirement:
Extend DNWS to make it supports multi-thread. The server should spawn a thread per connection.
Instruction:
1. Using your repo that fork from https://github.com/pruet/261411 in Assignment/HW3
2. Extend the code, implement the thread mechanism in the code base. See this tutorial for example
3. After you finish your job, make a pull request with your student ID as pull request comment, then submit this assignment
Requirement:
Extend DNWS to make it supports multi-thread. The server should spawn a thread per connection.
Instruction:
1. Using your repo that fork from https://github.com/pruet/261433 in HW1
2. Extend the code, implement the thread mechanism in the code base. See this tutorial for example
Requirement:
Extend DNWS to make it supports multi-thread. The server should spawn a thread per connection.
Instruction:
Using your repo that fork from https://github.com/pruet/261433 in HW1
Instruction
1. Implement barrier, as in Slide week 3 page 28, in Go by using channel.
2. Also, write a function to test your work by creating a few coroutine, then let them synchronize using barrier.
3. You can install Go in your computer, or use https://play.golang.org/ for coding and testing
4. Submit your work by post it in pastbin.com or github's gist, then submit the link to your post.
Grading criteria
1. Barrier can synchronize coroutine (3pts)
2. No shared variable used (2pts)
mysql> select text, match text against ('+Jack -ผชาย' in boolean mode) as score from t;;
+--------------------------------------------------+--------------------+
| text | score |
+--------------------------------------------------+--------------------+
| กาบินมา | 0 |
| กาบินไป | 0 |
| กาบินมาบินไป | 0 |
| เด็กเกาแขน | 0 |
| เด็กเกาแขนขาไปมา | 0 |
| John เป็นผู้ชาย | 0 |
@pruet
pruet / gist:36c9ae4911222e0a21acd1b9ecd0ca8b
Created June 3, 2016 15:35
Code to check whether a word/phrase is either Thai or English. In sort, check the first character with isalnum()...
/* convert to tis620, make it compatible with libthai */
my_convert((char *)toStr, length, &my_charset_tis620_thai_ci,
str, length, param->cs,error);
/* Check if this is an english word, if so, add to index directly*/
/* TODO: any better idea than this? */
if(isalnum(toStr[0])) {
ret += add_word(param, str, length);
} else {
/* This is Thai word/pharse */
mysql> drop table if exists articles;
Query OK, 0 rows affected (0.45 sec)
mysql> create table articles (
-> id int unsigned auto_increment not null primary key,
-> title varchar(200),
-> body text,
-> FULLTEXT (title, body) WITH PARSER ngram
-> ) engine=innodb character set utf8;
Query OK, 0 rows affected (1.41 sec)

Keybase proof

I hereby claim:

  • I am pruet on github.
  • I am pruet (https://keybase.io/pruet) on keybase.
  • I have a public key ASCP96GaiGvK1oYDRrpXd7-UFjzqkAS0oMFKmTlsdWuSUQo

To claim this, I am signing this object: