置頂

微博 vs 部落格

私人資訊

Posted in Uncategorized, 象哥與你資訊交流 FYI | Leave a comment

100DaysOfCode–Final

Today, I will say I conclude the full process.

Did I finish the full 100 projects? No. Did I spend more than 100 days though. Yes. The last few projects, are either not interesting, or difficult. The problem is not the difficulty that stopped me, but the lack of instruction. The lack of the instruction would be a big thing, it I don’t have motivation. Then, let’s go back to the part where I said “it’s not interesting….”

Anyways, For the past 100 days, I learned a lot. I finished 96 projects. And I am proud to say that I finished (more than) what I expected when I started.

Posted in 象哥的學習筆記 Study Notes | Tagged | Leave a comment

100DaysOfCode: Day 097

First of all, I skipped day 096, and thinking coming back (or not) since the topic, E-Commerce website is not what I am really interested in.

Day 97’s topic is “automation”, since this is a super big topic, I am finding the most appropriate thing that will suit me, and easy enough for me. My “Download” directory is 8GB full of crap, and I am thinking, if I can make it clean / categorize itself, then it might work well for my needs, so my program does this: walk thru the dirs, and categorize all the “images” together, all the “sound” files together, all the “video” files together etc. The program is not super hard to write, and the result is better than I liked, so I am very pleased with what I have today

Posted in 象哥的學習筆記 Study Notes | Tagged | Leave a comment

100DaysOfCode: Day 95 part 3

Part 3 of the project, I had problems doing multiple forms, but eventually there was an easier way, the WTForms, which we did in day 35. It was almost like what I wanted to do here, but with less function. Now I have a better base, I think that’ might be easier from here. I didn’t move as much as I wanted, but I am glad I found a better base.

Actually, it does some of what I wanted to do, I am gonna stop here so I can move on to the next day.

Posted in 象哥的學習筆記 Study Notes | Tagged | Leave a comment

100DaysOfCode: Day 95 part 2

So yesterday and today, I did put in the index.html, the home method in the main.py, I also added the “search” field in a “search” page, and submit.

Today, I include the google book api call in the search page, and it shows the correct output (the first 10 books from the list). But then I have to think how I can “select” the correct book from there.

That’s for next day(s).

Posted in 象哥的學習筆記 Study Notes | Tagged | Leave a comment

100DaysOfCode: Day 95 part 1

Day 95’s project description is very vague: “Using what you have learnt about HTTP request and REST APIs, in today’s project you will build a website that uses data from a public API.”

This is a super big topic, and the examples are not interested to me, so I decided to make this project more relevant to me, and the goal is to create a “personal library system”. The idea is to search from google books API where I can search for books I have read, or I wish to read. The idea is going to be including Flask + RestAPI queries + DBs.

Currently, I just put in the very basic frame work so it can run, but it might not be the best result, so I gotta think about it a bit.

Posted in 象哥的學習筆記 Study Notes | Tagged | Leave a comment

100DaysOfCode: Day 94 Improved

So I was rushing into it earlier, just so I could finish it.

But after some thoughts, I could make it better, I mean, a lot better. The idea is just like day 23, the turtle crossing game, except for just a bit complex. So, I spent some time on finding the good background, the good images to use, the good sound effect etc. But once that’s done, I can almost copy what I did in day 23. So I have a play.py to control the logic, a Ship class to control the ship and its movement, a BulletManager class to control the bullets, an InvaderManager class to control the invaders and the movements, and a scoreboard class to keep the score. All that’s left is the images and sound effect. Now I learned the images can be done by “turtle.register” first, then it can be done like a “shape”, and then the winsound can be used for sound effect.

After all, this is not as hard as I thought it would be, and the finish work is better than I like. The next improvement can be a “random shown invader”, but that’s for next time.

Posted in 象哥的學習筆記 Study Notes | Tagged | Leave a comment

100DaysOfCode: Day 94

Day 94, project is “Space Invader”.

I user the very simple way to do it for now, it’s just one space invader, one ship, and one bullet. It will have the correct shape and sound, but there are a few things to be improved on.

To do:

  1. Add more bullets
  2. Add more space invaders
  3. move space invaders down every time it hits the wall.
  4. etc
Posted in 象哥的學習筆記 Study Notes | Tagged | Leave a comment

100DaysOfCode: Day 93

Day 93’s project is chrome dinosaur game auto bot. The idea is to check the specific “area” to see if a tree exists (or any hurdle to that matter), and see if we can automate that.

Angela already gave us ideas to use pillow and pyautogui, with a bit of googling ,this is not all that hard. The idea is:

  • dinosaur coordinate does not change (much)
  • We use the pillow package to grab the front of dinosaur, change it to grayscale, then check the color. If there’s no tree, the color stays the same. If there’s a tree, then what we should do is press space
  • Pressing space is basically utilizing pyautogui functions.

The difficulties I encountered are:

  • How to get the coordinate of the dinosaur and the trees correctly (I eventually just take a screenshot and use paint), and fine tune the distance of the checking area
  • How to press space bar longer (instead of press, I use keyDown and sleep then keyUp)
  • How to handle multiple small trees (still not 100% over come this yet)

Overall, not super hard, and a fun game.

Posted in 象哥的學習筆記 Study Notes | Tagged | Leave a comment

100DaysOfCode: Day 92

Day 92 is doing scraping. The idea is simple, and we have done amazon ones before, and that’s still my goal, so I am still working on it. During my down time before, I have done a similar thing, so I am using that as my base. Eventually, my code will use selenium instead of scraping only, I will read a google sheet to see what I should check, then check the amazon site to compare to my price range.

The project is overall one of the smallest one / easiest one. The harder part is actually coming up with ideas to see what I can scrap, and try to follow the robots.txt for each site to make sure I am not violating some site’s regulation.

Posted in 象哥的學習筆記 Study Notes | Tagged | Leave a comment

100DaysOfCode: Day 91 part 2

It’s been a … in theory not too hard project to do, but it turned out used up a few days.

As previous described, I could load the image, now I am working on the analysis part. Day 76 taught to use numpy to analyze image, but I couldn’t make it work, so eventually I used to stupid for loop method, not perfect (and it’s slow as hell), but it works.

I googled a few ideas, like module colorthief, or colormap (from here), but none of those work to my satisfaction, so I end up with what I have.

A few things to note: the same image after routed twice, does not display correctly. And the analysis method in first route doesn’t work. This is odd, but I might have to check more.

Posted in 象哥的學習筆記 Study Notes | Tagged | Leave a comment