CSS inliners

August 13th, 2019

At the moment, I’m working with a company where I’m handling their email templates. One tool I found to be very useful are CSS inliners. I won’t be discussing Inky templates in this post.

I’ve been using https://www.campaignmonitor.com/resources/tools/css-inliner/ and for the most part, it works perfect. The only down side is that I have to visit the url, paste into the text area, click a button, wait for the page to reload, copy, and the paste the inlined html. It was okay at first, but by the 100th paste, it gets stale quick. That’s when I started looking into CLI options.

The tech explosion has been great, providing a lot of inlining CLI tools I wouldn’t have had otherwise. Everyone wants to make a name for themselves on the interwebs, and I can relate.

That being said, I’ve went through pretty much all the NodeJS one, and the only one I found comparable to campaign monitor’s is “inline-email” located here: https://github.com/freethinkingit/inline-email

Example command:

inline-email index.html –noInlineImages | pbcopy

The other solution I found acceptable is the python based premailer. It’s pretty much just like inline-email, except it gives you the option to not strip the style tags. I did find that useful in some occasions in which the element you wanted to affect didn’t exists until rendering (sometimes clients inject things on their own). Premailer can be found here: https://pypi.org/project/premailer/

Example command:

python -m premailer -f index.html | pbcopy

If anyone is having issues getting their emails to look correct across email clients either phone, web, software based, you should give the aforementioned tools a try, definitely made my life a lot easier.

Skills, degrees, or product?

April 29th, 2019

In the recent explosion of technology and all the varying degrees of “skills” that result from it. I feel a little overwhelmed. I am from a time where tech was essentially Apache, HTML, Javascript, CSS, and some sort of language that supports dynamic generation of HTML aka, DHTML. Then with every language there’s it’s evolving syntax, AND the various frameworks and their ever evolving practices.

Now? For javascript, you have your Grunt, Gulp, NodeJS, jQuery, VueHS, ExtJS, Angular, React, and the list goes on. For your CSS, you have your SASS / LESS, and browsers and varying versions of browsers to support. For your hosting, you have Kubernetes, AmazonMesos, DockerSwarm, Docker, VMs, Baremetal hostings, various hosting providers, and so and so on.

The following article really conveys the explosion of tech really well:


//hackernoon.com/how-it-feels-to-learn-javascript-in-2016-d3a717dd577f

In addition to everything, you have the Machine Learning field introducing it’s own thing or two as well, where hiring anyone with less than a Ph.D doesn’t seem too credible or meaningful.

I feel paralyzed by the sheer degree of stuff I “have” to learn. I see myself looking at wide lecture hall’s triple-column double-row chalkboard of tech thinking that these are the skills I have to know to be an effective programmer now and days, but is it?

I don’t think so. It seems that in the torrent of tech terms being thrown at me, and the various fear of being labeled as dinosaur, or a person who’s opposed to change, a fear of obsolescence, the fear of being all those “has beens” I’ve seen. Being caught up in this tech wave, I forgot something VERY important to me, which was WHY I do the things I do in the first place.

Did I sign up to learn and master EVERY tech out there? No. Did I sign up to be a programmer as a profession? No. What did I sign up for? To do what I love, and if I happen to be paid for it, great! Do I need EVERY tech out there to do it? No! No I don’t. Are some of the new tech out there applicable? Yes, I think so, but not all.

I think it’s important to be opened to the idea of new ways of doing things, so if there is a new tech / method that allows YOU to do things better and more efficient, you can. At the same time, realize that even if your methods aren’t the “latest and greatest” they are STILL capable of doing things. My focus is shifting away from the latest and greatest, and back to my original way of doing things, which is to use the proper tool for the proper task, and adopt tech only as necessary, and just have fun. Adopt tools that help with my goal of creating that cool thing I wanted to create, but stay away from that next shiny thing that everyone is raging about. Make it work first, optimize it later.

Do I need to use a machine learning model to write a web portal automatically? Probably not. Do I need to add webpack to my static HTML one pager? Probably not.

A long time ago, I talked about various methods introducing their own overhead, and how I coded faster as a new programmer than a senior programmer thanks to adherence to all the “latest and greatest”. I’ve forgotten about that, and I think, it’s time for me to get back to that, at least for my hobby projects.

Perfection Paralysis

February 5th, 2019

I’ve spent more than a decade in professional software development. I’ve seen and fought this demon time and time again. The demon’s name is Perfection Paralysis.

It’s quite the beast. When you have so many eyes reviewing and critiquing your code, you want to be the best you can possibly be. You want your code to be representative of all that you’re capable of, because that’s what you’re judged by.

I think this is why I find writing my own hobby code so relaxing. No code reviews, no tech designs, no architecture reviews, and planning meetings and etc. I simply let the thoughts flow from my mind to my fingers; code happens, the world is changed.

I warn of the dangers of perfection paralysis because there is no single solution to solving a problem, there’s in fact, probably an infinite ways to solve it. No matter which way you go, there is always room for criticism and improvement. You can make it faster, you can make it neater, you can make it more extensible, you can make it more testable, and the list goes on.

I think one factor that a lot of developers don’t take into account, is how much more work they’re subjecting themselves and possibly their organization to.

Your code looks great, but did you do Doc Block commenting? Your code works, but is it type strict? Your tests passes, but does it handle mutation testing well? You have test coverage, but is it 100% test coverage, or partial coverage? Your test passes 100%, but does it pass for all device, or just a single device? Your application works now, but will it work once the load increases by a hundred folds? So on… and so on…

I find myself in this situation ALL the time, both in the professional environment and the non-professional environment. Great, this JS code works, but should I have done it in React? Great, it works in React, but should I have incorporated Flux/Redux? I finished it in native PHP, but should I have used the Laravel Framework? I did it in Laravel, but maybe I should have done this in GoLang? Great, I’ve coded it in GoLang, but maybe I should have coded it with Gorilla? The data persistent layer is in MySQL, but maybe I should have used DynamoDB? The list goes on and on and on, it will NEVER stop, because there’s simply no stop case, this is simply the nature of our work, there will never be a best, because the best is yet to come.

I think remembering the BIG picture helps me maintain my sanity. Reminding myself of the objective allows me to focus on running past the finish line instead of being crippled by anxiety at the starting line. In the end, code is code. It’s simply a series of instructions to a computer, a persistent mechanism, and presentation mechanism. No matter how we’ve changed things, those things stay the same. In the end, no matter how you code it, if it fulfills the objective, it’s working code.

I think a concept that a lot of developers forget in the software development life cycle, is that code becomes obsolete. In this RAPIDLY changing world, should be optimize for 10 years? 5 years? 3? 2? 1? 6 months? That’s a tough question, but let me answer it with another one. If you wrote optimal code using ES 5, is it still optimal under ES 6? If it was optimal ES 6 code, is it still optimal ES 7 code? If you coded it using React, could material UI have done a better job? If you used jQuery, and now you have all these built-in selectors to javascript, is it still the optimal approach?

I urge myself, and other developers to optimize for the situation as it stands, in their own life, in their environment, and future proof it to a reasonable extent. Architect it for the current and PLANNED next steps, but I wouldn’t optimize it any further than that.

Advance the code and project in an interactive, self-rewarding manner, rather than a giant hunk perfection that is either ALL or NOTHING, a long ways into the future from now. When you have 1 or 0, the expected value is 0.5, but if you allow yourself to build everything in an incremental manner, it’ll be much less stressful, and you’ll have more fun.

So for myself, or anyone else reading this… “It’s okay, it’ll be fine, even if there might be a better way, just do it the best way for the current circumstances, when the circumstances change, much like the Monty Hall paradox, we can pivot then”.

CBOE and bitcoins

May 13th, 2018

Well, at the time when I wrote the CBOE article, soon after the CME announced they’d open their exchange BEFORE the CBOE. The most interesting of things happened as a result. I bought bitcoins at 11k, it moved to 12k, 13k, 15k, 17k, 20k, in a matter of days, followed by a fall to 15k, rise to 17k, dip to 14k, and so on… Anyone who followed bitcoin price movement prior to the CME opening would’ve seen this. They would’ve also witnessed the hyper volatility that happened a bit prior to the CME opening, and a bit after.

While I profited from my original theory of the impacts of the first cryptocurrency exchange opening, the effects of the exchange is arguably short-lived. While it’s true that at the beginning, it’s easier to gain from a buy and hold position than a hold and sell, in the long-run things can change dramatically.

The reason being is that now, it’s possible to SHORT bitcoin, and that creates incentive for current holders of bitcoins to sell. Due to the lack of regulation of bitcoin, it’s even possible for a major holder of bitcoin to enter into a short position, and then LIQUIDATE their inventory, causing a dramatic drop in bitcoin prices, then closing their short, and then buying their bitcoins back, milking the good-will that’s in the market.

I think the hype behind cryptocurrency has largely died down, and everyone has gotten their taste of it. In order for the price of the cryptocurrency to rise, outside money must flood in, I just don’t see a strong compelling reason for that at the moment, except in the case of Japan, where they’re experiencing negative interest rates.

CBOE will drive the prices of Bitcoins up as opposed to down here’s why

December 10th, 2017
Bitcoin CBOE exchange plus or minus for bitcoin? I say plus; Just because you’re betting on the future price of the bitcoin move.
 
Lets examine a short. You’re betting the price will go down, this means that some large quantity of bitcoins have to be liquidated and slide down for less and less, in some sort of panic sale. Unless you hold a ton of bitcoins, you can’t really trigger this. If you DO hold a ton of bitcoins, do you really want your bitcoins be to be devalued for a gain in the market? Right now, they’re “millionaires”, but they can be “BILLIONAIRES”.
 
Much like my mistake for not selling at 20k/btc, I was blinded by possibly being a millionaire. I think we all have that blindfold, blinded by potential profits.
 
Now lets examine a futures long position. You’re betting the price will go up. How do you influence that? You buy up the bitcoins on the bitcoin exchanges. If you have a ton of cash, and you have enough capital in the exchanges primed and ready to go, you can drive it up just buy buying it up from the existing holders. I plan to sell all my coins at 107k, so if I do, the price of bitcoin goes up to 107k, the future long will be fulfilled the minute my price goes up, and you can sell it for a profit.
 
I do think, the exchanges will ultimately drive the bitcoin prices up because it’s easier to long than to short bitcoins at the moment. Good luck convincing the existing die-hards who held it at 1,000, 10,000, 20,000 that the bitcoin price won’t keep climbing up and they should sell…
 
This is my stance on it, it doesn’t mean I’m right or not open to debate on this, but the rules seem pretty rigged for bulls. Yes… The existing holders might convert bitcoin into cash, but probably to extract some mansion buying money, but not liquidate the entire net worth, that’s suicide.

Everything competes with everything…

May 2nd, 2017

I think it’s easy to think narrowly. It’s easy to think that if you’re in the restaurant business, you’re not competing against the car business. But, if you think about the fact that people have finite disposable income, then money spent on food, is money not spent on cars.

I think, with the advent of the internet the world has gotten smaller, and the advent of high-speed internet, the world has gotten EVEN smaller.

Now, in addition to competing for our disposable income, they’re also competing for our attention. People are no longer constrained to watch media on the air frequencies they can receive. No, not even bound to the programming their cable providers can provide. People now have unfettered access to media from the ENTIRE world. As great as this is towards furthering mankind’s understanding of one another, and appreciation of other people’s cultures. This introduces some very interesting problems.

Content producers, while partly, want to share their media with the world, also are businesses, and businesses exist to make profit, otherwise, they’d be called a charity. This is problematic because before, they only had to worry about competition from other air frequencies, possibly other cable channels… but now, they have to face the ENTIRE world.

I think, this is great for society as a whole, but I can see how this is bad for businesses, losing their grip on that geological monopoly.

The world is getting smaller, and sure, the landscape is getting tougher, but at the same time, before, you were the king of a small hill called your country, now, you can be the king of the world. If properly managed, your domain will reign much further than before, and perhaps, you can even profit greater than before; IF managed properly.

Enable Infinite Homepage Scrolling on Note 4 (rooted Android 6.0)

May 1st, 2017

So! My loyalty to the Note 4 at this point is borderline fanatical. Samsung has YET to make a better phone, in fact, neither has Apple. I’ve recently bought a Verizon Note 4 to replace my T-mobile Note 4, since Verizon allows me to use both T-mobile and Verizon, but the T-mobile version wouldn’t work on the Verizon network. If I’m going to replace that phone that’s been acting up, I might as well replace it with a better one.

After a ton of pain, I’ve managed to figure out exactly which ROM, I should install, what’s working in what version of the ROM and so on… Eventually, I just went with a nearly stock ROM that’s simply rooted.

Everything looked normal an kosher, until I’ve noticed that the homepage doesn’t do infinite scrolls. I’ve found a lot of instructions online, but it no longer really covers the file structure of Android 6.0.

I’ve decided to write a post, and if it happens to help someone out there, then awesome.

-Open up your file manager, in this case it’s Root Explorer
-Go to /system/csc/others.xml (hold down on others.xml and open in text editor)
-Scroll down to the end (on my phone, the line we are looking for was the third or fourth from the bottom)
-Find the line that looks like this:

<Cscfeature_Launcher_DisabledPageRotation>true</

-Change “true” to “false” (without quotes). It should now read:

<Cscfeature_Launcher_DisabledPageRotation>false</


Citing my sources, but saved it for last, since I didn’t want to force my readers to read through things they didn’t want to:

The solution is actually an interpreted combination of:

How to Enable Hidden CSC Features on Samsung Galaxy Devices with Root Access

and

https://forum.xda-developers.com/showthread.php?t=2311335

 

Useful command to test speed of a container, vm, or system

March 6th, 2017

I’ll be breaking down the following command part by part:

time dd if=/dev/zero of=test.dat bs=1024 count=100000

 

What does time do? It runs a process and then captures how long it took to execute.

What about DD? Well, it’s a command that copies data from a standard input to a standard output.

What about the params if, of, bs, and count?

“if”: It’s decently obvious, but “if” specifies the input, in this case we’re taking input from a special file that provides as many null characters as there are read from it; an infinity file of sorts.

“of”: It’s the output file.

“bs”: Byte size

“count”: the number of blocks

So all together, the command writes 100,000 blocks of 1,024 bytes of binary zeroes into the file of “test.dat”. In other words, generates a 100 MB file. This command allows you to generate a 100 MB file and test the  IO performance of a system. As we move towards a world we’re optimizing the crap out of everything, this is a very useful command to know.

Amazon S3 Outage

February 28th, 2017

Today’s post is regarding https://techcrunch.com/2017/02/28/amazon-aws-s3-outage-is-breaking-things-for-a-lot-of-websites-and-apps/

These type of occurrences are becoming more and more common. Tons of company has placed a ton of faith into the Amazon ecosystem, and time and time again, it looks like Amazon has let them down. When these things broke, it broke at a MASSIVE scale (AWS outage knocks Amazon, Netflix, Tinder and IMDb in MEGA data collapse, https://www.theregister.co.uk/2015/09/20/aws_database_outage/ )

http://research.omicsgroup.org/index.php/Amazon_Web_Services

There were other outages in 2012, 2013, and probably more unlisted. I think it’s an interesting challenge that Amazon is tackling, and I feel like more and more of the web is putting all of their eggs into one giant basket.

I wonder, if we were to build a truly scalable, and unlikely to be impacted system, maybe it might make sense to diversify the system’s infrastructure to utilize multiple services. Maybe some redundancy at the DNS layer, then some more at the LB, some more at how things are replicated, localized and so on… Just something to reflect on due today’s outage, “How can I prevent my organization from being impacted by this?”

How I cleaned more than 8,000 thousand emails from my mail box

January 5th, 2017

Long long time ago, briefly after the birth of gmail, I created an email account, and mail was good. Fast forward to now, holy spams. Years and more than a decade of neglect, I’ve managed to amass more than 11,000 emails, and this is post spam filter. I guess over the years, I must’ve signed up for every single notification and newsletter out there. Each them I delete an email, and unsubscribe from a list, another newsletter shows up, and I’d think that I must’ve unsubscribed already, but I’m not too sure anymore. All I knew was that my inbox was looking like this:

I’d stare at that number every day, thinking “Someday, I’ll clean it, but today is not to the day…”

The idea of going through my mail one by one, and then checking to see if the sender was a bulk sender or not, and then unsubscribing from it, just seems like such a time consuming task. Then I start noticing that in the midst of the spam, here and there, there were some important emails I’m starting to miss. That was the spark that lit my fire to put an end to this spam once and for all.

Using my computer programming powers, I created a program to go through my mail, and build a list of senders I receive emails from, and the amount of emails I have from them:

thousands upon thousands of emails later

I’ve built a list of emails and their frequencies, and life was good, but I knew I can do better.

I took it a step further, and built another list based on the domain of the sender.

Utilizing these two newly crafted weapons in my arsenal, I blew away thousands upon thousands of emails, some of which were spam, some of which were transaction emails that no longer have any importance. Once the non-important emails have been unsubscribed from and removed, it was so much easier to deal and organize my old emails. Once that noise was removed, it was so much easier to deal with my new emails. Now, my emails look like this

And life… was good.