Elder Moderator

[email protected]

Total likes received: 94 | Pubby Cash: 873


Evan is a person who does coding. He codes with Python and watches videos of bootstrap. That's it.

Articles Liked by Me: 53

Is It ’S-Q-L’ or ‘Sequel’?

Categories: General, Tech | Pubby Cash Received:  0

Many coders use this extremely useful tool in their projects. It’s called Structured Query Language, or SQL for short. However, many people still struggle with just how to pronounce the term SQL. Is it “S-Q-L” or is it “sequel”? Now you might not think that this is a big deal (and it isn’t), but to sound more professional and knowledgeable during interviews and other “showing off” moments, you need to know the best pronunciation. The standard says that ‘S-Q-L’ is the appropriate way of speaking SQL. However, many English-speaking database professionals still use the nonstandard pronunciation “sequel.” So which one tops the other? Unfortunately, that’s hard to say, but I will tell you my opinion. So first, we will talk about how to sound intelligent. Let’s say you’re at a conference and a person insults you. Would you just insult them back just by calling them “stupid”, or is there a more sophisticated way of doing this? Of course, there is. When you are certain you have some spectators, you can tell them that they “have no intelligence” or “lack an effective brain” or some other response that sounds longer and uses higher vocabulary. All of these options will surely be more superior to just calling them “stupid”. The better approach of insulting someone back is to lengthen your response so you sound wiser. And the same goes for expressing your understanding of a topic. When someone asks you which coding languages you know, it will sound better by saying that you “have a deep understanding of Hypertext Markup Language, Cascading Style Sheets, JavaScript, and S-Q-L”. This would also be the right time to pronounce SQL as “S-Q-L” because it’s longer to pronounce so you will sound more intelligent. Use “sequel” whenever you’re speaking quickly or just discussing code with your friends. Since there’s no one to impress, “sequel” would be the better option in this case. Personally, though, I prefer to use “sequel” just because it’s easier to say, but that’s just my opinion. ...  Read more

Jupyter Notebook - A Must-Have Editor for Those Who are Both Programmers and Educators

Categories: Tech | Pubby Cash Received:  10

In this article titled "Sublime Text vs. Pycharm, Which One is Better?", I mentioned Jupyter Notebook as one of well-known Python IDEs. I do see a number of YouTubers use it for demonstration and education purposes, and thought it is cool and practical to use during learning and teaching. However, I think it cannot replace Sublime Text for development of a series of complicated and connected coding files. The reason Jupyter Notebook is superior for education is that it is featured with multiple interactive code blocks that can be easily added or deleted. You can run one single code block or multiple code blocks to see the results instantaneously without executing the whole py file. The shortcuts are just like other editors: ctrl z for undo, ctrl / for comment, and the like, and you can edit those if you want. Of course, Jupyter Notebook also has downsides. I summarized two, and now only have one left. The No. 1 downside I had before was the default white background appearance, as I prefer a dark theme. It is now no longer a downside, as I've figured out how to change to a dark theme manually. The other downside is it runs on a terminal window just like a web application built on flask, and actually uses two of your computer resources simultaneously: a browser window + a terminal window. For some old computers, it will not be running as fast as Sublime Text, because Sublime Text is an editor stands on its own. It does not need you to run in command line unless you want to test the code you've written. However, as an educator and researcher, I would use Jupyter Notebook as well to produce some reproducible code snippets and save as .ipynb files for future references. With that said, here are some instructions for you to install Jupyter Notebook and apply a dark theme as I did. Open a terminal window, enter: pip install notebook pip install jupyterthemes jupyter notebook In a Jupyter Notebook code block, enter !jt -t monokai Note: "monokai" is the name of a dark theme I'm using. Restart Jupyter Notebook in the command line, and the dark theme is ready to go. ...  Read more

Problem and Solution

Categories: General, Tech | Pubby Cash Received:  0

I came across this problem while I was coding, and it bugged me for a very long time. After the launch of stocks on our website, it is possible to find a loophole when one is purchasing shares of stock. You see, when you purchase a share, the input fields with the stock information are disabled so you can’t modify the price. However, while I was testing the URL for the site, I noticed that a user could just simply change the price of the stock in the URL and instantly get rich if they make each stock one dollar. So this was a serious problem and I got to work right away. Beforehand, I passed the stock price through the URL and used that price in the form. I tried to fix it by hiding the numbers in the URL. That didn’t work. After many attempts, I thought of another method. Why couldn’t I just use the price from the previous page, the page that listed all of the stocks? I queried the dictionary and found the real price and used that in the form. Now even if a sneaky user tried to bypass the price of the stock by changing the URL, once they hit submit, it will show an error because the price in the URL didn’t match the price I had in the dictionary. The important lesson I learned from this experience was to consistently attack a bug in all sorts of perspectives until one worked out. When one try didn’t work, I didn’t give up and thought of a new plan....  Read more

You Think Sets Are Hard but They Actually Aren’t

Categories: General, Tech | Pubby Cash Received:  0

Similar to a list, a set is a collection that is unordered and unindexed. In Python, sets are written with curly brackets. The difference from lists is that you cannot access items in a set by referring to an index since sets are unordered the items has no index. However, you can loop through the set items using a for loop, or ask if a specified value is present in a set, by using the 'in' keyword. A Python set also resembles a dictionary because it cannot have duplicate values. This makes it easy when you want to store usernames from your website. When a user wants to create a new username, the program will first check if that username is in the set, and if not, then it will add the username to the set. One thing that surprised me was that sets were unordered. You might expect an item to be at that location when you add it but that’s not always the case. Since sets are unordered, so you cannot be sure in which order the items will appear. Unfortunately, you cannot change a value in a set, only add to it. To add one item to a set, use the ‘add()’ method. Use the ‘update()’ method to add more than one item to a set. Sets are easy to work with once you get the hang of it!...  Read more

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

1 ... 5 6 7 ... 11

Daily Deals


MECHANICSBURG WEATHER