Administrator

[email protected]

Total likes received: 115 | Pubby Cash: 377


Andy Tang is the creator of Gopubby.com who has a passion for programming and everything related to technology and is skilled in many areas of coding including Python, HTML/CSS, Bootstrap, and SQL. He is experienced with many Python modules including Pygame, Flask, BeautifulSoup, and Kivy. He also has a solid knowledge of Windows, Mac, and Linux/Unix operating systems.

Articles Liked by Me: 82

Hard-to-find Tiny Bugs in Code

Categories: Tech | Pubby Cash Received:  0

Based on my limited coding experience, I've summarized my top three tiny bugs that have wasted many of my valuable hours. I would like to share with you all so that you can avoid them by all means. No. 1. Punctuation and Spelling. A mistake of missing a comma would either cause an immediate trackback or temporarily got accepted but blow off your code in future. I had a field in a database table storing a list that is dynamically being appended, say [1,2,3,4,5,] and has been converted to string. Note that the list is ended with a comma in the square brackets. That comma costs me hours to make things at other places work as planned. Spelling is another thing that can be easily overlooked. When I was coding to communicate with a database via SQLAlchemy, I typed db.session.commmit(). That triple m drove me crazy when I found out with my old eyes. No. 2. Indentation. Tabs and white spaces are treated differently in Python. This is especially true when you are trying to copy a code snippet from elsewhere and paste it into your program. You thought they are identical and should work flawlessly. However, the cruel reality might be that you just cannot make it work. Tabs and white spaces cannot be distinguished by naked eyes. It takes me hours to find out that the Sublime Text editor has a function of converting all tabs to spaces, and that solves my problem. No. 3. Data Types. Operations with values of different data types will throw out an error. Although it is not difficult to realize that datetime and timedelta are incomparable, and strings are incomparable with other data types, the problem is: sometimes, it is visually impossible to tell the difference between a string and another datatype! Let's say x = 2. Now x is an integer. Then let's say y = str(2), and now y =2, too. But this "2" is different from the previous "2", because this "2" is a string. If you run x + y, it will throw off an error! The recommendation is: always check the data types to make sure you are well informed. If you are trapped in debugging processes, you could try to target on the above-mentioned three hard-to-find bugs. Hope this will help you out!...  Read more

Lenovo Multimedia Remote with Keyboard N5901

Categories: Tech | Pubby Cash Received:  0

Do you like mini keyboards that can do everything on a computer? Well, the Lenovo Multimedia Remote with Keyboard N5901 is the right thing for you. This product is comfortable and efficient. This product is comfortable because it fits your hand very firmly. There is also a mini ball at the bottom of it. This ball acts as a trackpad or a mouse on a normal computer. When I was using this it felt very comfortable because the ball felt very smooth. Furthermore, the left and right-click above the ball is easy to use as well. Also, this product is efficient. After all, you can do anything you can do with a keyboard on it. There are even a sound button and a pause and play button at the very top of it. All in all, the Lenovo Multimedia Remote with Keyboard N5901 is very useful and is worth buying. ...  Read more

Be a Trader in Real Stock Market with Your Pubby Cash

Categories: Tech | Pubby Cash Received:  0

Stock trading is about economics. This is also a skill that one definitely needs to master in the modern world. I'm glad to find that the GoPubby stock trading market is online. You have a selection of trading over 20 stocks with your Pubby Cash. The stocks on the market right now are choices of brand company names covering a variety of sections including technology, consumer goods, health, finance, energy, transportation, utilities, and so on. The reason I say this is real stock market is because you will be trading at real-time stock prices. For example, one share of Facebook stock costs 240 right now, you will be able to buy it at 240, and of course, the currency is not in US Dollars, but in Pubby Cash. After refreshing the page, if the stock price changed, your net worth will increase or decrease. You will gain or lose Pubby Cash only at the moment the stocks are sold. The recommendation is if you see the price of the stock you are holding decreases at a moment, keep holding it, unless you urgently need Pubby Cash at that moment. Be confident in the US economy! The overall trend of investment should make you gain money in the long run. A side note: Without Pubby Cash at a whole number multiple of one share price will not forbid you from buying that stock. Feel free to use a fractional number, no matter how small it is. You also don't need to invest all your Pubby Cash into the same company. You can split your Pubby Cash into multiple investments, which simulates S&P500 and can greatly lowers your investment risks. Have fun in the GoPubby Stock Market! ...  Read more

Write and Read a Dictionary into TXT file in Python

Categories: Tech | Pubby Cash Received:  0

I've been exploring an elegant way of exporting/importing a dictionary into/from an external TXT file for recording purposes. Say I have a dictionary with stocks codes and prices, and the dictionary's name is called stocks, and this dictionary is stored in a py file called rank.py. The txt file I've like to export to is 'stocks.txt'. The relative path from the operating py file to the txt file is 'static/stocks.txt'. To export the dictionary from the py file into the txt file, this code will be neat: from rank import stocks with open('static/stocks.txt', 'w') as f: print(stocks, file=f) To read the dictionary from the txt file, use this code: with open('static/stocks.txt', 'r') as f: content = f.read() stocks = eval(content) When it comes to the operation in flask route functions, I found it worked totally different with regard to the file path of the txt file. An error of "no file/file directory" keeps blowing off the code. Eventually I figured out that the file path should be written in a different way with the following code: import os from flask import current_app f_path = os.path.join(current_app.root_path, 'static/stocks.txt') with open(f_path, 'r') as f: content = f.read() stocks = eval(content) What a tricky debugging issue! ...  Read more

The Alexa

Categories: Tech | Pubby Cash Received:  0

Are you a person who forgets things a lot? Well, Alexa can help you. This tool is made by Amazon. It is helpful and safe. First, it is helpful because you can do so many things with it. For example, you don't have your phone with you, so you can tell Alexa to call whoever you want. Also, you can ask Alexa questions, such as what is the weather today, or what is the time. Furthermore, you can tell it to set reminders, like to wake up at seven in the morning. This just proves how helpful it is. Also, it is safe. After all, you can press the mic off button to disconnect the microphones. Not only that, but you can tell it to turn on the porch lights or set the thermostat 72. Overall, Alexa is a great product to buy. ...  Read more

1 ... 11 12 13 ... 17

Daily Deals


MECHANICSBURG WEATHER