For Farmers Only

Took a trip to Boulder last summer and had the TV on in the hotel one night and saw a commercial advertising a dating site for farmers. It seems like such a specific niche that I wanted to make jokes about it, but the more I've thought about it the more sense it makes, and it blows me away every time I think about it that such specific niche sites exist and can be viable as a business model. It's amusing to me that the thing I was initially going to make fun of I now find incredibly motivating. Se la vie.

Published on 03 January 2018 at 17h37 by Dave, tags , ,

Does your private messaging have to do so much that you need a separate mobile app?

The Verge ran an article today highlighting that Instagram is separating out their private messaging functionality from their app into a standalone app. This is the same move that facebook made a few years ago (which made me uninstall the facebook app instead of installing their messaging app alongside). It's notable that facebook owns instagram, so the people responsible for facebook's app decision may have an influence on instagram's current app decision. But regardless, why is private messaging so heavy that they feel the need for a separate app?

As a user it's frustrating to me that they would need to install 2 apps on my phone. Facebook is one thing. All the facets of facebook should be wrapped up into one thing on my phone so I can compartmentalize all the things that go along with facebook. Instagram is one thing. I think you see where I'm going here.

This kind of highlights the re-emerging need to have a singular app merge and coalesce all the ways of contacting me into one singular feed and being smart enough to respond to you in the same way you contacted me. This was starting to gain traction in the early naughts but died out by the mid naughts. Digsby was the one that I used but I didn't really like the UI on it. I think we could reapproach this problem using modern programming and modern UI and come up with a more effortless system. Hmm, maybe that's the next thing I should build.

Published on 07 December 2017 at 23h39 by Dave, tags , , ,

Starting to get comfortable with linux

Ran a rake routes | grep 'brand' command at work today. Didn't bother to look it up, just typed it out and it worked. Boom! Finally, one piece of basic linux competency learned, and it only took me 14 years! Woo!

Published on 21 October 2017 at 00h23 by Dave, tags , ,

Loop holes

Received this feedback today: "Refactored your refactor cause there were some loop holes"(sic)

Ok, buddy. I haven't been told there were holes in my logic since my first semester programming class in college, but let's take a look at what you found. Looked it up and there weren't any holes in the logic, he just wanted the logic moved from the subclass into the base class. Got it, not sure why he didn't just say it that way. It's a reasonable refactor, but my logic was flawless the way it was.

Addendum: Was working on some code at work that's been in production for 3 years (I've been there less than 5 months) that was dropping records from a parsed file. No one noticed, no client complained, I just had to deal with it for an upgrade. Had to trace the logic out and found out that the logic was bad. You want to complain about my logic? Noted.

Published on 09 October 2017 at 20h20 by Dave, tags ,

Wrote my first Slack Slash Command!

I'm surprised at how easy it was to do. I went into the slack web interface and created an app through there and enabled the slash commands, then added a new slash command that posts to an API end-point. I wrote an API end-point in my application at work to return a JSON with the different AB tests we have on production for each of our web sites recently so I wanted to point to that. I used {"code":"200", "message":"24,145,146"} as the return but Slack uses "text" instead of "message" so I added a new endpoint that called the same function but with a 'slack' flag and if the flag is true it writes the output to "text" instead of "message" and then slack dumps that into the channel when it receives the slash command. I went back into the web interface and installed the app to the team. Super easy to do and now my front-end team that doesn't have access to the application but constantly needs to know which tests are on production have a simple way to get it without asking me! Empowering users, and saving my time. I like it!

Published on 05 May 2017 at 16h53 by Dave, tags , ,

Let's code!

Found a great article about the coding tools to learn/work with in 2017: http://tutorialzine.com/2016/12/the-languages-frameworks-tools-you-should-learn-in-2017/ I'd like to see if I can add a few of these to the resume this year. I've actually already started playing with some of it, which is great! Progressive Web Apps: Haven't touched yet. The Bot Hype: I've been running a hubot instance which integrates into a personal slack team that I set up with my wife. I've made a few small commits to some hubot plugins, and I used one I installed (http-post-say, where you can POST in data and hubot will speak it into a room) as an integration with another side project. Front-end Frameworks: Interested in testing out ember.js and vue.js, but haven't touched either yet. I'm also super interested in figuring out how service-workers can extend my capabilities. The cloud: I already deal a little bit with AWS at work, and I have a side project that I'm hoping to deploy on AWS or Heroku very soon, just trying to get it into MVP state. Machine learning: Haven't touched, and don't really have any plans to right now. JavaScript: In messing with hubot I've had some exposure to CoffeeScript, which is cool, but I haven't yet touched on ES2017 (or ES2016 even!) or TypeScript, but I'm interested in exploring how these technologies will help me. C#, Python, and Java aren't in my wheelhouse right now. I messed with C++, Python, and Java in college, but it's bene years and I haven't maintained those skills. I'm using Ruby at home, though I'm not sure if I'm on Ruby 2.2 or 2.3. We are currently upgrading to PHP7 at work, though I'm not sure any of my work projects are really set up to take advantage of any of the new features. Swift3 from Apple interests me. I've been wanting to start building mobile applications for years but every time I try I end up getting called off to do something else. I have 2 side projects that will benefit from having mobile applications, so this should be the year that I figure this out. I'm probably inclined to start with Android because it's free, then move to Apple once I'm making some money. For back-end I'm playing with a Node.js blog right now, but I'm not sure that's going to help me really understand Node unless I start hacking on it. I've been interested in Node for awhile now so I might try to use it in a side project or two. For databases, PostgreSQL has been coming up on my radar quite a bit lately so I might try to figure out the advantages of using that versus MySQL, which is my go-to. I've been using sqlite3 in some Rails projects, and it's been fine for my needs too. My hubot experiments introduced me to Redis since hubot uses it as a "brain" and I'm intrigued by what else I can do with it. For IDEs I plan on installing Atom to try it out. I already use git extensively but I'm starting to play around with Node more and more so I'll be checking out yarn to check it's advantages over npm. Docker containers are probably the future, or at least along the lines of what the future will look like, so I would really like to play with that a little bit and see if I can make those work for me. Cool stuff coming this year!

Published on 21 March 2017 at 07h48 by Dave, tags ,

Every time I spin up a new virtual machine I have to go through and do these same things

I have to find the documentation for all of them every time because it's been long enough that I don't remember how to do them each time, so I figured I might as well document more or less what I have to do to set this up. I'm using Bitnami stacks for my virtual machines and these instructions are relevant to Ubuntu 14.04.

Set up a static ip

Edit /etc/network/interfaces like so:
auto eth0
#iface eth0 inet dhcp
iface eth0 inet static
address 192.168.0.151
netmask 255.255.255.0
network 192.168.0.0
gateway 192.168.0.1
dns-nameservers 8.8.8.8 8.8.4.4

Make sure you choose an address outside the address space of the dhcp server then restart networking with sudo service networking restart, except the networking restart like this isn't working on Ubuntu so I'm restarting the machine (the good ol' Windows reboot on a Linux box, smh.)
Source: Ask Ubuntu

Enable the SSH server

sudo mv /etc/init/ssh.conf.back /etc/init/ssh.conf
sudo start ssh

Source: Bitnami docs

Support key-based authentication

ssh-keygen
Generating public/private rsa key pair.
Enter file in which to save the key (/home/bitnami/.ssh/id_rsa):
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /home/bitnami/.ssh/id_rsa.
Your public key has been saved in /home/bitnami/.ssh/id_rsa.pub.
The key fingerprint is:
XX:XX:XX:XX:XX:XX:XX:XX:XX:XX:XX:XX:XX:XX:XX:XX bitnami@linux

This command should create two files named id_rsa and id_rsa.pub in the /home/bitnami/.ssh directory. Copy the private key file named id_rsa to a secure location. Do not share this private key file. Transfer the contents of the public key file to the /home/bitnami/.ssh/authorized_keys file:
cd /home/bitnami/.ssh
cat id_rsa.pub >> /home/bitnami/.ssh/authorized_keys

Edit the /etc/ssh/sshd_config and uncomment (or add if not already present) the following lines: RSAAuthentication yes
PubkeyAuthentication yes

In the same file, disable basic password authentication:
ChallengeResponseAuthentication no
PasswordAuthentication no
UsePAM no

Restart the SSH server for the new configuration to take effect: sudo /etc/init.d/ssh force-reload
Source: Bitnami docs

Reset the MySQL root password

/opt/bitnami/mysql/bin/mysqladmin -p -u root password NEW_PASSWORD
Source: Bitnami docs

Block spammers

At the end of the configuration file for Apache, /opt/bitnami/apache2/conf/httpd.conf, add the following lines to deny spammers:
#Spammer Blacklist
<Location />
<Limit GET POST PUT>
order allow,deny
allow from all
deny from xxx.xxx.xxx
</Limit>
</Location>

Put the subnets you want to block in place of the xxx.xxx.xxx and you can repeat that line for as many subnets as you want. I manually add spammers to this list when I find them attacking my server, and the subnets that have been added are all in China and Russia. I don't get many visitors as it is, and Chinese and Russians really don't have a reason to have interest in my blog, so I don't feel bad about blocking entire subnets in those countries. I might think hard about it if the subnet was in a country where I might have readers.
Source: lost to the wind, but I copied the section off the bottom of my httpd.conf of my last server I spun up (which I've been using about 2 years now).

Using Bitnami

So, confession time: I've never really done too well at setting up a server. I'm sure this one is no exception. I have a tough time figuring out where to put things on servers, where and how to serve up additional sites. That said, I've learned a bit about multi-site configuration on a single server over the past year from work. I now have multiple vhosts setup so that I can hit the same server with multiple domains and get different websites, except I'm not pointing any other domains at my server yet. What I did do though was use subdomains so that I can have multiple rails projects running on the same server, permanently set up with Apache and Passenger. I'm still testing this out, so I'm not sure that it will work the way I want it to, but here's what I'm thinking.

I'm creating a /home/bitnami/projects folder where I can stash all my projects. The bitnami stack that I chose is the Ruby stack, which gives me Apache setup already with Passenger integration, which allows me to server either Rails apps or PHP sites. I can create new projects in my projects folder, and then give each project it's own vhost entry so that I can hit each of them individually. I'm going to use the ServerAlias directive to give them each a subdomain, then add CNAME records to my DNS for each subdomain which point back to my server, that way Apache will decode the url and point to the right vhost.

I added a line to the end of the /opt/bitnami/apache/conf/bitnami/bitnami-apps-vhosts.conf file:
Include "/home/bitnami/httpd-vhosts.conf"
I created the vhost file there so I don't have to deal with permissions issues (i.e. sudo/running as root) when I'm adding new vhosts.

I'm thinking about creating a project that's served by default (i.e. if someone hits the server with the IP or if they hit with the root domain, because apparently those can be different), and that project will essentially be a page of links to all the projects (subdomains) on the server. I can set up a php script to either read through the vhosts file in my home directory or go through the directory of projects and create a list of links and then write them out to a php file. I can use cron to run that php script every <interval of time> so that when I create new projects they'll show up automagically on my jump page (working title). I need to figure out what a sensible interval of time to run the script is. Often enough where I don't feel the need to run it manually every time I create a project, but not too often where it's needlessly chewing up CPU cycles.

Hope this helped you, but, more importantly, I hope it's still available next time I need to setup a new server!

Published on 26 January 2017 at 04h52 by Dave, tags

Offended an employee today by asking him where he found his code

"Where did you find the code you used for that task?"

"Where did I find the code?"

"I can see you wrote most of it yourself but there's pieces that I'm guessing you found on a forum somewhere, maybe stackoverflow?"

"I don’t remember but the piece that I found is the piece for remove the duplicates. line 176 to 180 maybe stackoverflow.
the other is from and old project that I did in my last job."

"Cool. It's an interesting approach. There's a couple spots I think we can tighten it up but good job."

"Hey, sincerely take care how you ask some questions. Sometimes I feel that you treat us as if we know nothing of what we do."

Dude, seriously? I was just being polite. Your code looks like you bought some commercial engraved wooden boxes and then tried to build a dresser to contain them out of loose sticks from the forest and duct tape. It's diamonds covered in dog shit and you're trying to pass it off as high-end jewelry. You didn't write most of that code, and I know that because I have to redo the entire task now because it's so far off from what should have been written that it's futile for me to try to describe what it should look like and give you a second chance.

You only found the piece for removing duplicates online? Oh, cool, so you wrote that regex piece yourself? I didn't realize you were a regex master. I still have to look that shit up every time I use it so I'll just come to you with my regex questions in the future. Shut up clown. I treat you like you know nothing because you know nothing. I wasn't mad that you looked up code online, I do that too, I just wanted to know if you have a resource that I don't know about so I can use it too. Now I know who I'm dealing with and, news flash: You're no rock star.

Published on 19 July 2016 at 17h48 by Dave, tags , ,

Powered by Publify | Photo Startup stock photos