Programming

Trifecta: Filter, Map, Reduce

I love using Goodreads. There is a great community there; contributing to the site with their comments, reading lists and such. When I discover a new list such as the Riftwar Cycle, I want to copy the book names to a Google Sheet. When I visit a bookstore, I then pull up the file to see if I have already purchased it or not. So, my Google Sheet is ever changing but one thing stays constant. My rate of buying books is exponentially growing over the rate of reading what I already own.

Some lists are mixed, meaning they are part of a universe and there are many authors contributing to it. In that case, I would like to write down the author’s name next to the book’s title. You might wonder if it would be a better idea to group the items by author name first then the book title. I thought about doing it that way too first but then the books that I’m usually interested in are grouped by type so they are all clustered in one bookshelf rather than distributed all over the store by the author’s name.

So, our goal is to parse a list out of page content in the following format: Book Title, Author Name.

Continue reading

Programming

Using Reduce to Remove Duplicates

Most examples I see for reduce talk about summing up numbers. Can we use reduce to do more than punching numbers? Doesn’t it sound ironic that these accumulator or sum calculator examples look more like they are increasing some values rather than reducing? I know I’m pushing the envelope here. I think removing duplicates from an array would be a more suitable example of reducing the array we are working with. Because, after all, we would be reducing it to a minimal state.

How ever you define what reduce does, here is my take on using reduce to remove duplicates from an array. It only works for simple data types of course but you can enhance it the way you see it fit. For simplicity sake, I’ll attach my solution to Array.prototype. Again, this is optional.

Continue reading

Programming

A Better Safari Books Online Experience

Now, my experience with Safari Books Online has been great so far, mainly due to the free access I get thanks to Toronto Public Library. As far as I can see from the feature set, you can create playlists and the dashboard is tailored towards your use of content. This is, of course, a completely different mileage I get from the free service. There is none of that custom profile you can keep and sometimes if there are too many people logged in using the Library account, then you are locked out.

However, none of this is what I’d like to talk about in this post. I want to talk about a different kind of user experience and maybe offer a solution. At least, it’s what I’ve needed all this time without realizing I’ve had the power to do something about it. So, shall we?

Continue reading

Programming

For The Love of Eve!

Roughly two months ago, I rekindled my love for Eve. It had been the most exciting thing when I started to play in 2005. I renewed my membership and kept playing when I moved to Toronto in 2008 from Istanbul. After another 3 years, I stopped my Capsuleer experience in 2011 November. So, my character has been in a Cryo pod for almost 4 years. I think I have a better control of my life now so I can afford some free time without feeling guilty but this is not the essence of this article.

4 years is a long time and a lot has changed in Eve. I always liked Manufacturing and other side businesses in this game and I’m now investigating newer ways of making money with more advanced blueprints. One thing I did not have back when I left is that I now know Python so I can utilize it to do the heavy lifting in certain areas. Like finding all the blueprints that use the same raw materials! If I have excess quantity of a certain commodity what other blueprints can be used to spend what I have?

Could this question also be formulated as : If a company has commodity A,B and C; find all the people who have purchased these items and the quantity they did so we can figure out clients’ spending behavior, frequency or whatever. I know people are not blueprints but putting the problem in a familiar context sometimes helps. However, we are going to shop not even online today but offworld. Up we go!

Continue reading

Programming, Stuff

Measure Twice, Cut Twice

According to general wisdom one should measure twice and cut once. This makes sense in most professions and even generally in life; when you should think twice and open your mouth once. However, again, generally in programming, we have this ++ approach. There was C then C++ came out. Looking at the list of programming languages on Wiki, I can see 8 records with ++ in their names. Not every ++ is related to the programming language it’s named after. For example R++ has nothing to do with R which is a statistical programming language whereas R++ itself is C++ related.

That being said, I’m going to take a naive approach and apply ++ logic to measure twice and cut once and make it measure twice and cut twice.  First and foremost, this is going to be an empirical approach and my basis for this theory is the experience I have gained in 15 years of building static and dynamic websites, web and desktop applications. However, I hope that it’ll make sense to most of you, especially to those who obsess about details and perfectionism.

Continue reading

Portfolio, Programming

Pythonicus Addendum

Posts in this series
  1. Pythonicus
  2. Pythonicus Addendum
  3. Pythonicus Finitum

In my previous Pythonicus article I briefly talked about my need to parse a list of NoSQL Databases at http://nosql-database.org. My solution back then was as it was presented in that article, using regular expressions to find child and sibling nodes. It was a bit crude but it got the job done.

I’m constantly fighting against the “get’er done” mentality on a daily basis so I’ll try to get the job done right this time by using BeautifulSoup. That’s actually where I left the article off so let’s see how tasty the soup is!

Continue reading