Categories
Random

Should I become a software engineer?

This post was composed on March 20, 2018, and I never published it. I thought it was interesting looking back.

March 20, 2018

That is where all the money is at, right? Strive for what you want to be for your career, if all fails, use software development as a fallback career? Work for Google? Maybe Apple? How about Amazon? Or Facebook?

lol

Categories
Computers Linux Mac Programming Random

git: Please properly rename / move files and directories

I get frustrated when I browse a file from a git repository only to realize its history was lost due to improper renaming/moving of the file. It seems common for developers to manually rename/move a file in a git repository by using regular file system commands rather than git commands.

For example, let’s look at the following:

$ mkdir test
$ cd test
$ git init
$ echo "hi" > test.txt
$ git add test.txt
$ git commit -m"add test.txt"
$ mv test.txt test2.txt
$ git status

So what have we here? We start off by creating a new directory called test. We then go into the directory and start a new local git repository using git init. Next we create a new file called test.txt that contains simple text “hi”. test.txt is then added and committed to the repository. Finally, we use the mv command to rename the file to test2.txt.

git status shows us the result:

Git status after 'mv'
Result of git status

This is not what we were expecting. This shows that the original file test.txt was deleted and now there is an untracked new file called test2.txt, when it really should say that test.txt was renamed to test2.txt.

Btw, this goes for moving files as well. For example, rather than renaming the file, if it was moved to, say, a different folder, e.g. newFolder/test.txt, the result would be the same.

So how can this be solved? It’s actually not far off from the steps above. Let’s start with backtracking by reverting the rename:

$ git checkout test.txt
$ rm test2.txt
$ git mv test.txt test2.txt
$ git status

Running the above commands produces the following result:

Use 'git mv'
Use ‘git mv’ to rename/move files

Much better, isn’t it? Renaming/moving files from git repositories the proper way will allow retention of their history, which is what we want.

Categories
Mac PHP Random

Homebrew PHP Upgrade: “configure: error: Cannot find libz”

I was routinely upgrading my packages on Homebrew when I ran into the following error:

$ brew upgrade
==> Upgrading 1 outdated package, with result:
homebrew/php/php70 7.0.4
==> Upgrading homebrew/php/php70
==> Downloading https://php.net/get/php-7.0.4.tar.bz2/from/this/mirror
Already downloaded: /Library/Caches/Homebrew/php70-7.0.4
==> ./configure --prefix=/usr/local/Cellar/php70/7.0.4 --localstatedir=/usr/local/var --sysconfdir=/usr/local/etc/php/7.0 --with-config-file-path=/usr/local/etc/php/7.0 --wi
Last 15 lines from /Users/johnro/Library/Logs/Homebrew/php70/01.configure:
checking for OpenSSL support... yes
checking for Kerberos support... /usr
checking whether to use system default cipher list instead of hardcoded value... no
checking for krb5-config... /usr/bin/krb5-config
checking for RAND_egd... no
checking for pkg-config... no
checking for OpenSSL version... >= 0.9.8
checking for CRYPTO_free in -lcrypto... yes
checking for SSL_CTX_set_ssl_version in -lssl... yes
checking for PCRE library to use... bundled
checking whether to enable the SQLite3 extension... yes
checking bundled sqlite3 library... yes
checking for ZLIB support... yes
checking if the location of ZLIB install directory is defined... no
configure: error: Cannot find libz

Of course, I did the first thing I always do when running into an error, Google it! And I found this link that suggested running the following:

$ xcode-select --install

After that,

$ brew upgrade

ran fine.

Categories
Programming Random

Apache Drill: Error Starting Drill in Embedded Mode

I’ve been checking out Apache Drill and everything was fine, until today. I tried running Drill in embedded mode, per usual, when I ran into the following exception:

Error: Failure in connecting to Drill: org.apache.drill.exec.rpc.RpcException: CONNECTION : io.netty.channel.ConnectTimeoutException: connection timed out: /192.168.21.62:31010 (state=,code=0)

java.sql.SQLException: Failure in connecting to Drill: org.apache.drill.exec.rpc.RpcException: CONNECTION : io.netty.channel.ConnectTimeoutException: connection timed out: /192.168.21.62:31010

at org.apache.drill.jdbc.impl.DrillConnectionImpl.<init>(DrillConnectionImpl.java:159)

at org.apache.drill.jdbc.impl.DrillJdbc41Factory.newDrillConnection(DrillJdbc41Factory.java:64)

at org.apache.drill.jdbc.impl.DrillFactory.newConnection(DrillFactory.java:69)

at net.hydromatic.avatica.UnregisteredDriver.connect(UnregisteredDriver.java:126)

at org.apache.drill.jdbc.Driver.connect(Driver.java:72)

at sqlline.DatabaseConnection.connect(DatabaseConnection.java:167)

at sqlline.DatabaseConnection.getConnection(DatabaseConnection.java:213)

at sqlline.Commands.connect(Commands.java:1083)

at sqlline.Commands.connect(Commands.java:1015)

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)

at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)

at java.lang.reflect.Method.invoke(Method.java:606)

at sqlline.ReflectiveCommandHandler.execute(ReflectiveCommandHandler.java:36)

at sqlline.SqlLine.dispatch(SqlLine.java:742)

at sqlline.SqlLine.initArgs(SqlLine.java:528)

at sqlline.SqlLine.begin(SqlLine.java:596)

at sqlline.SqlLine.start(SqlLine.java:375)

at sqlline.SqlLine.main(SqlLine.java:268)

Caused by: org.apache.drill.exec.rpc.RpcException: CONNECTION : io.netty.channel.ConnectTimeoutException: connection timed out: /192.168.21.62:31010

at org.apache.drill.exec.client.DrillClient$FutureHandler.connectionFailed(DrillClient.java:448)

at org.apache.drill.exec.rpc.BasicClient$ConnectionMultiListener$ConnectionHandler.operationComplete(BasicClient.java:237)

at org.apache.drill.exec.rpc.BasicClient$ConnectionMultiListener$ConnectionHandler.operationComplete(BasicClient.java:200)

at io.netty.util.concurrent.DefaultPromise.notifyListener0(DefaultPromise.java:680)

at io.netty.util.concurrent.DefaultPromise.notifyListeners0(DefaultPromise.java:603)

at io.netty.util.concurrent.DefaultPromise.notifyListeners(DefaultPromise.java:563)

at io.netty.util.concurrent.DefaultPromise.tryFailure(DefaultPromise.java:424)

at io.netty.channel.nio.AbstractNioChannel$AbstractNioUnsafe$1.run(AbstractNioChannel.java:214)

at io.netty.util.concurrent.PromiseTask$RunnableAdapter.call(PromiseTask.java:38)

at io.netty.util.concurrent.ScheduledFutureTask.run(ScheduledFutureTask.java:120)

at io.netty.util.concurrent.SingleThreadEventExecutor.runAllTasks(SingleThreadEventExecutor.java:357)

at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:357)

at io.netty.util.concurrent.SingleThreadEventExecutor$2.run(SingleThreadEventExecutor.java:111)

at java.lang.Thread.run(Thread.java:745)

Caused by: java.util.concurrent.ExecutionException: io.netty.channel.ConnectTimeoutException: connection timed out: /192.168.21.62:31010

at io.netty.util.concurrent.AbstractFuture.get(AbstractFuture.java:47)

at org.apache.drill.exec.rpc.BasicClient$ConnectionMultiListener$ConnectionHandler.operationComplete(BasicClient.java:213)

... 12 more

Caused by: io.netty.channel.ConnectTimeoutException: connection timed out: /192.168.21.62:31010

at io.netty.channel.nio.AbstractNioChannel$AbstractNioUnsafe$1.run(AbstractNioChannel.java:212)

... 6 more
Categories
Random

CSS Tip: Save different states of the same icon in the same file

Pro tip: when using CSS to change the state of an icon, whether a hover state or a disabled state, make sure to put all different states of the icon in the same file, then use CSS to determine what position of the file to use to display the background of the icon.

jQuery UI icons

The above doesn’t really cover what I mean, but it proves my point. The benefit of loading icons from the same file: no hiccup for when icons are loaded for different states of the icons.

Categories
Apple Random Technology

Number One Reason to Go With a Mac

Mac OS X vs Windows. This subject is talked to death on a daily basis, but what really sets them apart? Given that the only way to buy a Mac is to pay a premium to Apple as opposed to Windows being offered by multiple providers, one can see why Windows has the majority of the market. Even so, if you follow the trend these days, you will notice the Mac OS is eating away little chunks of the market month by month, with 10% being within sight. But why should you buy an expensive Mac over a Windows PC? Aside from the usual list of pros and cons, one major factor is overlooked by many: its resell value.

Categories
Random

NBA Lockout for Dummies: the Owners Can’t Lose

Fans can cry, the players can argue, but in the end, the owners will be the victors. The NBPA and NBA can negotiate all they want, but the owners will eventually get what they want. Why? Because the NBA franchise is not their daytime job, but rather an investment. For the players, playing in the NBA is what brings in the dough. They can threaten to play overseas, start their own league, or do whatever they can to try and make the owners feel uncomfortable, but in reality they need the NBA more than the NBA needs them.

Categories
Random

Assembla: Project Managing

I signed up for a free account at Assembla today for version controlling my codebase from hostmonster. Limited 2GB free svn repositories. Not bad