Bashing Deficiencies Away

Spending some quality time with the command line

Confession

It is embarrassing to admit, but I am one of those Computer Science majors not well versed in shell commands. Navigating directories, creating files, and compiling/debugging basic C programs is basically the beginning and end of my knowledge. This is what prompted to take the evening to explore a little more.

Practice, Practice

Thus, I set out to write a few simple scripts. I thought it would be neat to add a couple custom commands to my terminal. The first one prints the definition of a word to console. I accomplished this using by writing a function that accepted the word in question as an argument. The definition was requested from dict.org then that function is aliased using another function so that the argument can be passed to the function.

The second command prints out my IP address to the console. My computer is a laptop, so this is not completely frivolous. The current network configurations are found through ifconfig. The results are piped to grep which searches for lines containing “broadcast”. Then, this line is piped to awk to select the IP address portion and display it.

I noticed that by aliasing those commands that they did not persist into a new terminal window as I intended. My default shell is Z shell, so I appended the commands to the .zshrc file in the root directory. This resource script is run every time a shell is started (or restarted) so persistence was achieved. While that all sounds very basic, it was not without complications. I spent a considerable amount of time trying to figure out how to pass the argument for the dictionary word once it was aliased. I was messing around with string expansion pointlessly until I figured out the function was necessary. To my understanding, the alias arguments were being passed after the curl command which is why it only initially returned with a default.

Aspirations

This little exercise was exciting and a couple hours melted away pleasantly. It reminded me of the fun I had in Introduction to Operating Systems. Feeling reintegrated, I’ll have to think of a passion OS project for myself after this quarter. The courses from the program here at Oregon State University have offered a lot of breadth and shown me that I have only seen the tip of the CS iceberg. I enjoy that one project just becomes a stepping stone to the next project.

Beyond APIs: Web Scraping

A small exploration to break up the semester’s work

When I first discovered API’s on the web, my world felt expanded. As my need for different kind of data increased, however, I started to feel limited by the available API’s I could find. That is how my interest was peaked by web scraping. I was familiar with the concept, but my assumption was that it would be difficult to learn and I put it off for later. I was wrong, it was much more accessible than I imagined using pre-existing Python frameworks and unlocked buckets of possibilities for acquiring new information all across the web.

Options

Before even diving into web scraping with Python. There was the question of which framework to start with. Beautiful Soup was the biggest name out of Selenium and Scrapy. Selenium has the reputation of having more set up/ learning curve, while Scrapy has more built in features such as being able to make requests and parsing html more specifically than Beautiful Soup. Ultimately, I opted to start with Scrapy, but I am interested in trying all these options at some point!

Experiment

The YouTube tutorial based project I coded up scraped images of otters from the reddit otter subreddit. Then, the pixels are mapped to ASCII characters and printed to the console. Scrapy was ridiculously easy to use. After initializing the project from the command line the set up was simply importing Scrapy into the file and specifying a start URL. The request and filtering to get the source tags with specific alt text happened all in one single command. That was all there was to it.

Overall, I was pleased with the experience, but the results need tweaking. I got some repeat images which wasn’t desirable. The ASCII art little unclear, but I have some direction for what I can change to improve.

Can you see the otter?

Side Project Importance

I convinced myself that I did not have time for even a small side project. I was right, but I think I made the right call by spending time working on this. Even though web scraping is not related to current school projects, it was refreshing to try something new. I already have ideas for how I can use this technique in future projects that I have planned out and I can’t wait to see what other creative things others are doing with web scraping now that that fire is lit.

First Impressions: Flutter

Is it worth learning Flutter/Dart for mobile application development?

The world of development is vast and rapidly changing, particularly for mobile development. This is not hugely surprising seeing as the new iPhone models are being released so often, not even most iOS users know what the latest one is. The point being, developers are faced with a recurring question: Is it worth it to learn the trendiest tech stack or will it disappear from headlines as fast as it appeared?

Image credit: https://cdn.mos.cms.futurecdn.net/RVZJvQGzb3dSvmT667k4HQ-1280-80.jpg.webp

What Makes Flutter So Special?

Flutter has garnered a lot of attention recently for it’s cross platform capabilities. Before diving into specific perks, a brief overview may be helpful. Flutter is a Google project for an open source Software Development Kit made available in 2015. According to statista.com, it is the most popular mobile app development environment for iOS and Android. Flutter uses the Dart programming language that appeared first in 2011. Dart is probably most syntactically similar to Java. It is compiled into native languages x86 and ARM ahead of time for Android and iOS, respectively.

My Angle

I am completely new to mobile development. In the concept stage of mobile app creation, React Native was my first choice. I have had some experience with React web development, so I assumed it could be an easy transition. Luckily, I had a team mate interested in Flutter after being bombarding with hype, I could not pass up the opportunity to try something completely different. It was daunting jumping into the deep end without the familiarity of Javascript. However, the risk was well worth the reward.

Widget Library

Flutter offers a comprehensive widget library. Out of the box, it contains all the most common customizable widgets from NavBars to Forms. With a simple include statement, all of the widgets are immediately recognizable and ready to go with a plug and play vibe. The nice thing about the styling of the apps is that they change to match the default styling of the device (i.e. Cupertino look for iOS).

Backend Connectivity

I connected my Flutter project with Firebase for server-less support and the use of the Cloud Firestore non-relational database. The integration between these two systems has a small learning curve to understand the many ways to query the database. The predefined calls for performing CRUD operations are convenient on one hand… On the other, this require more experimentation to figure out exactly what is being returned from them in varying situations (versus creating one’s one calls and knowing what to expect from them). It was fairly easy to set up the initial connect using the Flutter browser interface and changing a few preferences in the build and package lock files within the project.

Documentation

My favorite aspect of Flutter is the decent documentation. It is all to common to find terrible documentation that is lacking in depth or that is too difficult to understand. The Flutter documentation is easy to navigate and discover information on. They provide code snippet examples that correspond to a sandbox to see the feature working live. The only downfall is that there is less information on third party website (i.e. StackOverflow) versus more established languages.

The Verdict

Is it worth learning Flutter ? YES. I would like to keep programming with Flutter/Dart and I have more ideas already for mobile applications that I can make in the future. Returning to the more general question of whether or not it is worth it to learn any trendy new stack or library… The answer is more complicated and really depends on specific motivations. Probably not so much if you are already deeply invested in another SDK and do not have an interest in learning something else. Otherwise, if time allow, I am always in favor of experimenting with innovation that comes highly recommended.