Tumgik
#like d/j vs e/ve
khuepham · 3 years
Text
Old messages
Dung~ Ai : Theo chu thi TS tour se ntn?t muon chu la nguoi lon nhat ko the vang mat nhe! Thoai mai roi, choi tet di dog chi, t no may may bua com,cho t tra chu 12Au2009-21:53:55 Tra : Cac chi i bao e trog ngo nghinh lam.e ko lam luc 4h i, luc day chi o day thay chi Linh 9Sept2009-18:32:14 Tra : sao lop em co minh e la con trai the.xin chuyen sang lop 3 di 19Sept2009-12:03:05 Tra : Hoc the nao? di xin chuyen lop chua? 21Sept2009-17:51:39 Tra : Lai ko chuyen.thoi, roi se quen vs cac ban.lop e co may ban hoc tieng Nhat rui? 21Sept2009-17:57:09 Duc : C hoc thuoc 46 chu Hiragana chua? Chieu nay t di tap Yosakoi zui dey. Hay fet'. 23Sept2009-00:21:04 Duc : Acc. Ca 1van de day. Hehe. C hoc xong 2 bag chu kaj chua?:D 27Sept2009-10:55:43 Tra : Cam on em.qua to the 28Sept2009-11:27:19 Ha ruoi : T ha ruoj day.hjhj.Day la so moj cua t. 17Oct2009-23:42:39 P.Anh 1NB09 : Thx ban trai duy nhat cua 1nb XD nam moi vui ve XD 13Feb2010-21:51:20 Ngân Lợn: Tks only 1nb's gentleman.co len nha.rat vuj vj lop mjh co c 13Feb2010-22:48:21 --------------------------------------------------------- MaiHa : Hj. T k mag. Mag dj nag lam. C co mag di ah? Hn t met fo fac ra. Den gjo an chua nhj? 7June2010-17:28:11 MaiHa : K. can lapt0p lm j ah? Kaj vjdeo tren youtube la c lm? 7June2010-21:56:04 MaiNguyen : T o cung fong voi 1 ban on thi DH, the nen mn toan phai sang fong ben canh choi cho no hoc. ay. 8June2010-05:45:35 MaiNguyen : Thich o day hon o nha^^ 8June2010-20:41:53 MaiHa : He. Quen dt o fog. Hjt. Uc che mu0n djen len 8June2010-22:14:59 Thuy?1NB09 : Ok desune!:D! Dua Khue ti.u.t cat cho 8June2010-22:17:05 Thuy?1NB09 : Xuong dat ma nam.lay sach ra ma wat.chju kho dj roj maj t dua wat cho 8June2010-22:21:51 Thuy?1NB09 : T wen het tjeng anh roj.o hjeu.thoj.maj noj tjep.den gjo di ngu roj.g9 8June2010-22:29:35 Thuy?1NB09 : O faj.den gjo dj ngu.faj tat djen o bj fat.fong khue o tat djen ah?bj fat day 8June2010-22:36:38 P.Mai k.Duc : Hj2,thank you very much!i am so afraid!what are you doing? 8June2010-22:41:07 MaiNguyen : Dc thuong thuc 1 cuoc song khac thuong thj phai bjet huong thu chu. Dung co noi to dien, ngay mai biet dau cau lai thik qua ko muon ve nua ay. 8June2010-22:57:50 MaiNguyen : Only when you are in horrible life that you think of your own worst enemy !.......Always be my pleasure.how can you find me? Dont lie lie 8June2010-22:58:18 MaiNguyen : ^^.Chac han la mot cau chuyen hap dan. Hahaha. Thinh ma lai. 8June2010-23:02:11 Tra : An chan lam a? 9June2010-21:40:54 LeVa : c oj len phong t an hoa qua nha.nhanh len,hjhj. 10June2010-18:03:59 Rosie : Not when i sleep with 11 other people. r u mad at me or somethjng? 14June2010-08:12:41 LeVa : ohayo!hjhj!arjgato!toj wa laj faj dj gac ha c? 15June2010-05:38:19 LeVa : eo kho nhj?nh chj faj gac co 2 tjeng thoj dung k? 15June2010-06:30:38 MaiNguyen : :).*toe toet* 15JUne2010-06:48:56 Rosie : Dag ngoj dau? 15June2010-07:57:18 LeVa : gac luc y thj ok! can t tjep te nuoc va hoa qua k?hjhj! 15June2010-13:38:30 MaiNguyen : To dang bi stress nang. >< cuu to voi!!! 15June2010-13:40:20 LeVa : uhm! nh neu d/c k can thj thoj!hehe 16June2010-13:41:03 Rosie : To chup dc ank cau day, nhug ank ko thay ro mat 15June2010-15:26:38 Rosie : Nguy =)) 15June2010-15:32:47 Rosie : Ok. co fee ko :)) 15June2010-15:33:34 Rosie : Chup a free ah =)) dua thọ. chup thj may cạ cha dc. khj nao thik thj nhan tjn cho to :) 15June2010-15:36:47 Tra : Thik lam.chi thik nhat mon day 15June2010-16:12:10 Tra : Hom nay lai hoc ban tiep a? 16June2010-09:40:31 Rosie : An xog ruj chu! dao nay tu dug laj co caj tat nhjn xem co thay ban khue ko:D.ca fog dj xem wc, dag ngoj 1 mjnk nen mun nhan tjn cho ban thuj ko can rep dau :D 17June2010-18:33:30 Rosie : Gambatte ne 18June2010-08:28:30 Rosie : Co len nha, co j thog bao kq cho to 18June2010-09:11:43 Rosie : i think tonight is ok if u want to alleviate my ailment. i'll wait for u in c2 after dinner ok? just remember to go alone to avoid misunderstanding 21June2010-14:40:51 Dong : Khue oi.t Dong day.Sr c vi h moi nhan lai dc.sim kia cua t het tien:-( mai t fai di thi rui.de ngay kia dc k c?:-) 25June2010-13:37:48 Rosie : Not at all. i kinda enjoyed it. y do u think i felt bad? 29June2010-08:22:30 Rosie : Yeah i do. i always hide my true feeling 29June2010-08:26:49 Rosie : Not that clear. i still think u're a little weird and mysterious 29June2010-08:33:50 LeVa : uh.chieu nay thjx thj tap trung de dj chup a!chjeu c thj o day day ? 29June2010-08:51:28 Rosie : :)) ban nhung hum nay tron an com trua :D 29June2010-10:56:41 Rosie : Bao gio k ve que? 29June2010-11:29:17 Rosie : Djnk ru k di xem fjm thui :D 29June2010-11:31:44 Rosie : Ua gan nha to ma :D laj re. dj ko? to len ljck 29June2010-11:34:33 Rosie : To se ru them 1 so ban than nua chu to vs k dj vs nhau to so k ngaj, laj speechless thj chan lam :D 29June2010-11:46:45 Rosie : treat like what? i don't think of it as a big deal. but it's ok if u don't want to go with my friends. i'll arrange them some other day : ). they're just a few people who are really close to me 29June2010-11:55:10 Rosie : Ok then i'll catch u later. i'm taking a nap 29June2010-11:59:05 Rosie : I hate rat, mouse or any word to call that horrendous animal. 29June2010-12:15:17 Rosie : That's the cartoon i hate the most. y that little rat always win? that's unfair. this creature should be eliminated 29June2010-12:20:14 Rosie : I'm taking my camera with me. if u still want a photo, this is ur last chance 29June2010-13:45:07 Rosie : i'm asking u. ur answer should be yes or no 29June2010-13:47:35 Rosie : but how and when? 29June2010-13:54:26 Rosie : not good. i'll have changed my clothes already. after taking the test i'll run to get the bathroom. because it's always crowded there so i may have to wait for the bathroom. that's my only free time with this uniform on 29June2010-13:58:55 Rosie : And no shower? i don't think so.>.< 29June2010-14:04:02 Rosie : No i gonna wash my hair today and the bathroom in my room is unuseable 29June2010-14:11:21 LeVa : c thj o dau day?lat ra nha da nang nha ! 29June2010-14:14:27 Rosie : I don't know >.< must be before i take shower or before we gather tonight. i'm not going to dinner today 29June2010-14:21:53 Rosie : I'm havin' shower >.<. i can wear uniform after dinner so finish it fast then call me out. good luck with the test. i think i failed 29June2010-15:17:16 Rosie : It's way to difficult >.< anyway can u consider about going to the movie with my friends ;;) one has just back from the us. i think it's ok to make new friend. they are very nice:D. it's not that i don't want to go with u alone. i do but i kinda overspend this month. don't feel bad of me 29June2010-15:31:58 Rosie : To mak wan fuk nen bj lo la hen k vua bj de ra trag djem day >"< tam mua can than cam day 29June201o-17:39:46 MaiNguyen : Canh thu vi the ma ko goi minh som :D. Ngay cuoi cung can than om ko let dc ve nha day ban a! 29June2010-17:42:14 Rosie : chak la van thay thuj. to bj bat trag djem chu co faj thjk dau >"< 29June2010-17:49:33 Rosie : Chet khok thj co ay cu bj de ra trag djem thj bjt >"< 29June2010-17:51:42 Rosie : To dag o nha an day:D 29June2010-18:02:27 Rosie : Thanks for spending time with me tonight. i had great time. i really enjoyed talking to u 29June2010-20:05:02 Rosie : Let just say u're a good listener. u wasn't against anything i say :) didn't u say words are not important as staying by my side =) 29June2010-20:14:59 Rosie : Not at all i don't think of anyone as boring. i think u're nice. i tried to find out topics to keep out conversation continue. do u think i'm talkative? sometimes i just need someone to listen to me and i know u're perfect guy for that 29June2010-20:27:46 Rosie : I don't think it's a big deal. but if u want to go alone with me can u give me a ride? :D hey i passed the test this afternoon. i'm free tomorrow so awesome 29June2010-21:31:19 Rosie : Let me check the cinema's schedule then give u a call. do u mind driving me? 2june2010-21:36:43 Rosie : Cool :d how was ur test? i have a 5 >"< close to death 29June2010-21:54:51 LeVa : gac x0ng ruj c0n ngoj do lam j the?ve ngu dj c! 30June2010-05:38:40 Rosie : I didn't ecpect them to win anyway, i hope they did their best and that's all i can ask for 30June2010-05:40:07 LeVa : hjxhjx.lam j?tuj no c0n c day!len ph0ng ma xem dang ngu la ljet day nay!hjxhjx 30June2010-05:42:24 Rosie : it turn out i was right. the last meal is the worst one =) 30June2010-18:06:42 Rosie : Take care. maj ve con dj choj vs to :)) 30June2010-21:22:29 ---------------------------------------------------------------- Rosie : Hope u're doing fine with all the work. don't stay up too late. i'm going to bed now. sleep well sweetheart 6July2010-23:46:41
0 notes
nullset2 · 6 years
Text
Toy Project: Fortune Telling from Super Mario Bros. DX
I recently moved out of my country and I've been staying at a hotel and turns out I got bored so I started just trying random stuff to try to have fun while I get my own place.
So I remembered... back in the day, I don't remember how, because I never actually had a gameboy of my own, but I remember I managed to play Super Mario Bros. DX for the Gameboy Color. I remember that port, a pretty good one at that, because of the fact that not only does it recreate Super Mario Bros. on the Gameboy Color really well, no matter the small screen size of the system itself which leaves a lot to desire to the NES's resolution, but because there's a massive amount of extra content added to the original SMB trip.
There's time trials, You vs. Boo mode, multiplayer modes, hidden red coins, hidden yoshi eggs, a new map screen and a lot of other random smaller stuff, such as Gameboy printer stickers (in case you have one of those laying around lmao), a day planner in case you're still rocking your gameboy color as a PDA 20 years later, and even a fortune telling minigame. It's awesome!
 The fortune telling minigame
You see, for some strange reason I have this weird kinship for the fortune telling minigame... I always liked the fact that the little messages you get are so satisfying to read, the little jingle that sounds before the message is displayed sounds so exciting, and the fact that you can even get extra lives for the main platforming game if you have good luck and you get a nice fortune :)
So here's the challenge:
I want to recreate, for fun, the fortune telling minigame in a web application.
Right off from the bat, this is what I'm gonna need:
A dump of all the fortune messages that Nintendo put in the game.
A dump of all the graphics and sound used in the fortune telling minigame.
A database schema to store traffic data and fortune content data, so people can login, see and share fortunes, ideally with facebook.
An admin interface to add or edit the fortunes on my database easily (nice to have, and it involves making a User model too. I can do with SQL only though)
A web server that displays the actual frontend for the fortune telling minigame, does the "random shuffling" process, handles user traffic, then shows the users' fortune as an actual document that they can see on a browser (Ideally I'd expose it as a RESTful API too, but I don't want to do that at the moment, and for the sake of having a controllable scope for this project, I'll focus on doing everything as a rails web application)
TL;DR: Here's is the finished product: Have fun
This is gonna be fun :)
Dumping the fortunes
First of all, unfortunately I didn't manage to find a complete text dump of all the available text data in SMBDX online. Bummer! I was sorta anticipating this though. I guess I have to dump the text myself.
How to dump the text off a gameboy color game though? I was puzzled by this... however, I did notice something, the font used in the fortune telling minigame is similar to the font used in other gameboy color games, like the Legend of Zeldas available for it.
For example, compare both uppercase "W"s in the words "Words and "What", respectively. It's the same typography.
So I figured out that there ought to be a parallel there. Maybe if somebody has already dumped the text off of, say, The Legend of Zelda: Link's Awakening DX, and shared their techniques online, I could use something similar to dump the text off of SMBDX into a text file.
Turns out that there's many text dumps of all the zelda games on Gameboy Color, and off of the notes in those, I found out that there's many games that use ASCII encoding for their script. ZeldaDX is one of them. You can theoretically just open a game's files on a text editor with ASCII encoding and copy the script off of that
What does this mean? It means that the ROM image of the game, which is the actual collection of all the data that composes the game and that got shipped in carts in the original release of ZeldaDX (or any game on cart, ever, for that matter), has the actual text content itself encoded with the exact same hexadecimal values that the American Standard Code for Information Interchange uses:
From here onwards things are about to get more and more technical so buckle up and enjoy the ride. If you don't yet understand terms such as "Encoding", "VRAM", why RAM is different than ROM in the GBC or any computer's architecture, or what "Hexadecimal" means, feel free to stop here and just look at the results, or shoot me a line and we can chat about it over beers :)
So let's fire up good old trusty XVI32 and look at the ZeldaDX ROM image in it using ASCII and lo and behold, what happens when we try to search for a string of text which we already know is in the game, for example, "Marin"
There it is :)
You can also use a decent text editor to open the ROM and force "Western" (or Windows-1252) encoding when opening the ROM.
So, I procured a ROM image of SMBDX off from the actual retail copy I have and that I purchased with my own money, like you also should. Then, after dumping the ROM image, from here it should be a cakewalk, right? Open the SMBDX ROM on a hex-editor with ASCII encoding and presto, right?
Well, not quite.
Unfortunately, Mario DX, for some bizarre reason, doesn't use ASCII encoding for its text. Strange.
My hypotesis at this point is that, well the fortunes data must be there in some kind of sequential order still, because the fortune lines are data that must necessarily be persisted in order somewhere in the ROM image to be presented to the users.
Let's pretend that we have a false encoding for a second, where the letters of the alphabet are represented by the following key:
A => A0 B => A1 C => A2 D => A3 E => A4 F => A5 G => A6 H => A7 I => A8 J => A9 K => AA L => AB M => AC N => AD O => AE P => AF Q => B0 R => B1 S => B2 T => B3 U => B4 V => B5 W => B6 X => B7 Y => B8 Z => B9 a => BA b => BB c => BC d => BD e => BE f => BF g => C0 h => C1 i => C2 j => C3 k => C4 l => C5 m => C6 n => C7 o => C8 p => C9 q => CA r => CB s => CC t => CD u => CE v => CF w => D0 x => D1 y => D2 z => D3 ' ' => D4
Based on that assumption, and unless SMBDX is doing some shifty on-the-fly uncompression thing to the ROM image (!!!), based on the fact that we already know that there's a message in the game that reads: "With a Fire Flower", and that the data has to necessarily be in that order somewhere in the rom, we should expect to find a sequence similar to the following data somewhere in the ROM:
B7 C2 CD C1 D4 BA D4 A5 C2 CB BE D4 A5 C5 C8 D0 BE CB W i t h a F i r e F l o w e r
The problem is, though, that we don't know for certain that the game stores its alphabet starting from uppercase A, with value A0... it could be any other value for all we know.
So to try to get a bit more clarity at this point we can use a hearty good old emulation debugger. If we fire up the ROM on a good-ass old emulator (in this case, I'm using nocashgmb), you can see the state of the Gameboy Color's RAM on runtime. Nice. We can trigger a fortune inside the fortune telling game, then inspect the memory to find out what data is actually getting read and from where:
If we take a look at the first uppercase W when we triggered a fortune it shows that the data comes from address 99C1 in the Gameboy Color RAM (look under Map Address)
So let's use a hex-editor to Goto address 99C1 and we find from offset 99C0
8D D6 E2 ED E1 1D DA 1D C5 E2 EB DE 1D C5 E5 E8 F0 DE EB
Look at the following screenshot:
Notice something interesting here? Probably we got the jackpot ;)
What are the giveaways?:
Notice how there's a lot of instances on this string of hex values of the value 1D. Why could that be? Could it be some kind of separator? Or delineator? What about... if it was a representation for typographical space?
Notice how the value C5 appears two times. The character F also appears twice on the phrase, on "Fire" and "Flower". Coincidence? I think not.
It seems to me that the string of hex values we found translates very well to:
8D D6 E2 ED E1 1D DA 1D C5 E2 EB DE 1D C5 E5 E8 F0 DE EB W i t h a F i r e F l o w e r
Some other thing that I noticed is that the lowercase values seem to be incremental and alphabetically ordered (notice at the values representing 'l' and 'o' and how they seem to be in sequence when you interpolate 'm' and 'n' between them, exactly in order going from E5 to E8), yet the uppercase values don't seem to follow the same order. I may be mistaken though.
So perhaps we can build a translation table from Mario-encoding to ASCII by deducing it from the debugger, then input it into a hex editor that can do custom translation tables, and hopefully try to deduct the rest of the code from there. We could throw out some ruby for this:
#!/bin/ruby LOWERCASE = { } ASCII_LETTER_a_OFFSET = 97 offset = 0xDA (0..25).each do |i| LOWERCASE[($ASCII_LETTER_a_OFFSET + i).ord.chr] = offset+i end $LOWERCASE.each do |k, v| puts "#{k} => #{v.to_s(16).upcase}" end
Which produces this table:
a => DA b => DB c => DC d => DD e => DE f => DF g => E0 h => E1 i => E2 j => E3 k => E4 l => E5 m => E6 n => E7 o => E8 p => E9 q => EA r => EB s => EC t => ED u => EE v => EF w => F0 x => F1 y => F2 z => F3
So far so good. Notice how it perfectly syncs with the example fortune.
Let's try to see how this plays out in a hex editor before we move onto the uppercase characters. Let's open the Rom on XVI32.
A quick tangent: of particular interest, notice how there's a string of perfectly good ASCII text at the beginning of the ROM file, showing the game's title and key. Longtime experience with Wii hacking and Nintendo DS and 3DS fidgetry has made me understand that since a forever, Nintendo has always liked to assign a unique alphanumeric code to each and every title that releases on their console. They call that code the TITLEID. I can see that SMBDX is AHYE. A quick look at the game's product ID on a site like GameFAQs seems to confirm that:
So there's a feature on XVI32 called character conversion that one can use to make XVI32 follow a custom encoding instead of ASCII when trying to visualize the data inside a file. This fits perfectly with our use case that we want to see the text in Mario-Encoding, which we have already deduced. Let's try to input our conversion table there:
Turns out XVI32 has a format that it uses to exchange conversion table data called XCT. This is a simple format which can be created from plaintext consisting of n different lines denoting a semicolon-separated pair of translation values, one per each line. We can adapt our ruby code to produce an xct table very easily, associating our values on the reverse order, so to speak.
For example, we have determined that 'a' (ASCII hex 61) corresponds to Mario encoding 'DA', our first translation pair in the xct table would read: DA;61
Let's use the code that we used before and modify it a bit so it dumps an xct table for us:
#!/bin/ruby LOWERCASE = { } ASCII_LETTER_a_OFFSET = 0x61 offset = 0xDA (0..25).each do |i| LOWERCASE[($ASCII_LETTER_a_OFFSET + i).ord] = offset+i end $LOWERCASE.each do |k, v| puts "#{v.to_s(16).upcase};#{k.to_s(16).upcase}" end
The resulting xct table, so you don't have to run this script, is here.
Which we can then load into XVI32 for conversion... and once we do that, lo-and-behold:
And from here it should be pretty easy to decode the uppercase alphabet that Nintendo used for this game:
#!/bin/ruby UPPERCASE = { } ASCII_LETTER_A_OFFSET = 0x41 offset = 0xC0 (0..25).each do |i| UPPERCASE[($ASCII_LETTER_A_OFFSET + i).ord] = offset+i end $UPPERCASE.each do |k, v| puts "#{v.to_s(16).upcase};#{k.to_s(16).upcase}" end
Yes, I know, I didn't bother to modify the original code to integrate both cases and just ran one for uppercase alphabet, and another one for lowercase. I was lazy xD.
The final fortunes content, with a bit of formatting and retouching, is here.
Getting the GFX and the Sound
Fortunately it was really easy to find the graphics for the fortune telling online, since sprite ripping is fairly easy to do and has been commonplace since the dawn of the commercial internet and emulation (credits to spriters-resource.com).
The sounds weren't as easy to find since the Result, option select and option opening sounds weren't as interesting as to warrant somebody posting them online in wav format for other people to download. I didn't manage to find them, but not to worry, this is a simple sound capture job. VBA-m, a popular gameboy emulator, has screen and sound recording features. After sound capture, it´s a simple edition job. Audacity is a great tool for this.
But anyway, I had to rip the sound effects that come after you get your fortune, because those weren't available anywhere. That was a simple audio capture and then editing with audacity. My audio collection is available here.
Developing the app
Now that we have this, we can jump into development of the actual app! Oh joy!
I decided to architecture the application as a standard server request-and-response cycle. I kind of had to take a bit of time to think about this. Do I develop this in the traditional way, using a server and a database with a request-response loop, or do I do it on the clientside? After all, doing everything clientside is pretty hot these days... But the argument that having a relational database available to add extra fortune messages is too compelling to ignore, and backend languages are still in my opinion more amicable to that purpose than just doing everything on frontend. I will eventually make this app more robust clientside in a version 2.0.
These are the design tenets:
A web server displays the fortune selection page, which should have the necessary design to play audio and display animated content (without plugins, mind you! Modern Web is awesome!).
On click, the frontend performs an animation, then the user gets redirected. The user's traffic is intercepted by the server, which makes a dice throw and shows the user's result, with the corresponding audio and graphics according to the result.
The pages in the site should be responsive so it works well on different viewports, even smaller screens. The web server should be able to connect to a relational database to retrieve the fortunes.
The server should be able to retrieve the fortune text off of a relational database.
So I decided to go with a simple Ruby stack for this, with the Sinatra framework for coding the server, PostgreSQL on the database, heroku as the platform (I like PaaS and heroku has amazing, free support for PostgreSQL out of the box).
On the frontend I use some small parts of CSS for webkit animations, transitions to animate all the assets I got off the ROM, and rotations/translations to position the clickable elements of the page in a circle formation, and the Javascript audio API to play sound.
A snag that I ran into quickly is that I need to add another media query to order the elements in another way on very small screens (the responsiveness is achieved purely through media-queries). Plus the animation is fidgety and not compatible in all browsers because I'm tweening the content property of an img element in the page for animation and this doesn't play well with browsers, or rather, doesn't produce smooth-enough animation. I think that I will look into canvas in version 2.0 of the app to handle all the gfx.
And finally, I needed a way to populate my database quickly with all the text I dumped from the ROM. I made a quick sql script for that, which I placed on the project's repository. Vim proved very good for this, parting from the previous txt file with the raw Fortune strings:
CREATE TABLE Fortunes(type_id integer NOT NULL, content varchar(40), created_at timestamp DEFAULT current_timestamp, updated_at timestamp DEFAULT current_timestamp); INSERT INTO Fortunes VALUES (1, 'With a Fire Flower you''ll beat Bowser.'), (1, 'Fortune awaits you in the clouds.'), (1, 'Fortune will lead you to Yoshi.'), (1, 'Look below to find what you seek.'), (1, 'Good friends bear good news.'), (1, 'Southerly winds bring sunny skies.'), (1, 'Kindness given is returned tenfold.'), (1, 'Good news is due from a loved one.'), (1, 'Good things come from hard work.'), (1, 'Soothing music soothes the soul.'), (1, 'Keep a good grasp Fortune will last.'), (1, 'Worries naturally melt away.'), (2, 'Stomp a shell and scores will swell.'), (2, 'Pipe cleaning reaps rewards.'), (2, 'An eye to the sky reveals Red Coins.'), (2, 'Keep your head up Find what you seek.'), (2, 'A party of three brings good luck.'), (2, 'Luck arrives with the easterly wind.'), (2, 'Express yourself with written word.'), (2, 'Seek out the one who thinks of you.'), (2, 'Active bodies breed active minds.'), (2, 'To create music is to create joy.'), (2, 'You shall achieve great victories.'), (3, 'Enemies lurk in watery depths.'), (3, 'Fortune is hidden in bricks unbroken.'), (3, 'Today is your day to win the race.'), (3, 'Boxes may contain clues to the quest.'), (3, 'Victory is yours in the coming race.'), (3, 'Beware of winds from the west.'), (3, 'Feelings shared will be understood.'), (3, 'He who thinks of you is beside you.'), (3, 'Imagination is a wonderful toy.'), (3, 'Old tunes bring new fortune.'), (3, 'Trade high scores to set new goals.'), (4, 'Stomping on spikes leads to sore feet.'), (4, 'Careless footing causes one to fall.'), (4, 'Kicked shells may bounce back.'), (4, 'What you seek is right beside you.'), (4, 'Sincere apologies renew friendships.'), (4, 'Storms ride in on northerly winds.'), (4, 'You will not find true love this day.'), (4, 'A VS Mode victory is not your fate.'), (4, 'Not all pain leads to gain.'), (4, 'Happy songs lift sad moods.'), (4, 'The Warp Zone speeds success.'), (4, 'Only a Challenge clears the mind.'), (5, 'Bowser''s breath engulfs the future.'), (5, 'Flying Koopas cut short success.'), (5, 'Dont count Yoshis before they hatch.'), (5, 'Leave impossible dreams to dreamers.'), (5, 'Seek answers in a friends advice.'), (5, 'Beware of pointed enemies.'), (5, 'Change old habits Yield new success.'), (5, 'Victory in a race may wash pain away.'), (5, 'Excess is a powerful enemy.'), (5, 'Favorite tunes never fade.'), (5, 'Now is the time for patience.'), (5, 'Help all in need, not just a friend.');
If you're using heroku to mount the app, it's very easy to populate heroku's postgres database through the command line by using unix redirection from the file to heroku pg:sql with the following command:
heroku pg:psql --app "the_name_of_your_app_here" < scripts/create_databases.sql
A quick note: a fast look at the main executable for the server, fortune.rb, you can notice how I'm handling connections to the database. It is a good practice to store connection credentials for your database on an Environment Variable in the server, from where I read at the moment of connection in runtime, else I default to development-credentials, which you should replace by your own if you try to run this on your machine.
Final Words
So this is it! Hope you enjoyed the ride and remember that you can check out my project and deploy it for yourself from my github [profile] (https://github.com/nullset2/smbdxfortunes).
Have fun and may you have great luck in your future! :)
0 notes