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 : connection timed out: / (state=,code=0)

java.sql.SQLException: Failure in connecting to Drill: org.apache.drill.exec.rpc.RpcException: CONNECTION : connection timed out: /

at org.apache.drill.jdbc.impl.DrillConnectionImpl.<init>(

at org.apache.drill.jdbc.impl.DrillJdbc41Factory.newDrillConnection(

at org.apache.drill.jdbc.impl.DrillFactory.newConnection(

at net.hydromatic.avatica.UnregisteredDriver.connect(

at org.apache.drill.jdbc.Driver.connect(

at sqlline.DatabaseConnection.connect(

at sqlline.DatabaseConnection.getConnection(

at sqlline.Commands.connect(

at sqlline.Commands.connect(

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

at sun.reflect.NativeMethodAccessorImpl.invoke(

at sun.reflect.DelegatingMethodAccessorImpl.invoke(

at java.lang.reflect.Method.invoke(

at sqlline.ReflectiveCommandHandler.execute(

at sqlline.SqlLine.dispatch(

at sqlline.SqlLine.initArgs(

at sqlline.SqlLine.begin(

at sqlline.SqlLine.start(

at sqlline.SqlLine.main(

Caused by: org.apache.drill.exec.rpc.RpcException: CONNECTION : connection timed out: /

at org.apache.drill.exec.client.DrillClient$FutureHandler.connectionFailed(

at org.apache.drill.exec.rpc.BasicClient$ConnectionMultiListener$ConnectionHandler.operationComplete(

at org.apache.drill.exec.rpc.BasicClient$ConnectionMultiListener$ConnectionHandler.operationComplete(

at io.netty.util.concurrent.DefaultPromise.notifyListener0(

at io.netty.util.concurrent.DefaultPromise.notifyListeners0(

at io.netty.util.concurrent.DefaultPromise.notifyListeners(

at io.netty.util.concurrent.DefaultPromise.tryFailure(


at io.netty.util.concurrent.PromiseTask$


at io.netty.util.concurrent.SingleThreadEventExecutor.runAllTasks(


at io.netty.util.concurrent.SingleThreadEventExecutor$


Caused by: java.util.concurrent.ExecutionException: connection timed out: /

at io.netty.util.concurrent.AbstractFuture.get(

at org.apache.drill.exec.rpc.BasicClient$ConnectionMultiListener$ConnectionHandler.operationComplete(

... 12 more

Caused by: connection timed out: /


... 6 more
Database Linux Mac PHP Programming

PHP: Connect to SQL Server Database on Linux (and Mac OS X)

Microsoft SQL Server
Microsoft SQL Server

I have used PHP to connect to SQL Server plenty of time, and every time I would use the SQLSRV extension. The problem with that is, PHP’s SQLSRV extension is only available for Windows servers. Which wasn’t a problem for me because I would normally develop PHP on Windows machines. It wasn’t until recently I needed SQL Server access on a Linux machine.

It wasn’t as straightforward as I had hoped, and it certainly did not help to learn that the MSSQL PHP extension was removed in version 7.0, which took me a few hours to discover. I am writing this post in hopes that I save some people a few hours of pain, including my future self.


Installing Microsoft SQL Server Data Tools – Business Intelligence for Visual Studio 2013: Rule “Same architecture installation” failed??

So I had to install Microsoft SQL Server Data Tools – Business Intelligence for Visual Studio 2013 today, and was greeted with the above error. Based on the error, I assumed I had SQL Server 2014 x64 installed and I somehow needed SSDT for x64 and not x86. Funnily enough, the installation page suggests both x64 and x86 architectures are supported. I was frantically searching for a x64 installation.

Thanks to a StackOverflow post:

As the others have said, there is only a 32 bit version.

The important thing is, if you’re running an x64-based SQL instance (64-bit), make sure to select “New Instance” on the Installation Type page, and NOT “Add features to an existing instance”. Not doing so will cause it to error out.

I was selecting “Add features to an existing instance” thinking “New Instance” meant installing a new SQL Server fresh again, like most people would.


SQL Server: Taking Advantage of Transactions

I won’t go in depth about SQL Server transactions, but rather what you can do to apply destructive changes safely, like deleting records or updating them. It’s highly advised that direct queries don’t get run on production databases but there are situations where that is required.


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.

Samsung Technology

PS3 Blu-ray Disc Remote Control: How to Make It Work With Your Samsung TV

PS3 Blu-ray Disc Remote Control

I can finally rejoice! I was happy with my new PS3 Blu-ray Disc Remote Control since I watch most of my media on my PS3. The only downside was I couldn’t get it to work with my Samsung TV (model LN52B610 52″ 1080P LCD HDTV), but after having read the manual I realized I can make it work… but I needed the programming code.

The manual lists the possible codes for Samsung TVs: 459, 460, 461, 462, 463, 464, 465, 466, 467, 468. I tried them all and gathered that both 464 and 465 worked. I was happy for a bit but realized that the remote didn’t work quite anything like the original Samsung remote: the directional buttons were used as volume/channel control, and some other buttons like Return didn’t do anything. I figured the features were just limited for universal remote controls.

After a few hours, I couldn’t stand the fact that I had limited control over my TV, so I started investigating. Considering both codes 464 and 465 work, there have got to be others, and maybe one of them will allow my remote control to give me full control.

I finally hit the jackpot when I ran into an Amazon review. The author suggested using code 304, and lo and behold, it worked!

PHP Programming

PHP: How to array_merge Without Losing Numeric Keys

PHP function array_merge is nice in that you can easily merge one (or more) arrays into a single array with a single call of the function. The keys are retained, but only if they’re not numeric keys(!).


$array2 = array(3 => "data");
$result = array_merge($array1, $array2);

    [0] => hi
    [1] => data

Perhaps this is the behavior you want. But what if you want to retain the original numeric keys?

Apple Computers Mac Technology

Help: My MacBook (Air/Pro) Won’t Charge!

I had a panic attack today. I had left my MacBook Air inside its sleeves and on my bookshelf for a week since I didn’t have an immediate need for it and I didn’t want someone stealing it. I took it out today to prepare it for a trip overseas, only to find that my MacBook Air wasn’t charging and the charger LED wasn’t turning on. I opted not to buy the extended AppleCare, and mine expired a few months ago. I looked up the cost for a new charger to find out it’ll cost me $79. $79!!! I knew of Apple and their premium prices, but I still found it shocking.



2012 NBA Player Rankings

I have listed NBA’s top ranking players. You can find the original list here. I have only listed these rankings since the source didn’t have a page that listed all 500. Enjoy.

Database PHP Programming

PHP: sqlsrv problems with UTF-8 values? Set your CharacterSet option!

Are you banging your head trying to figure out how to convert a seemingly invalid UTF-8 value into a valid one? You might be surprised to know that the problem isn’t how PHP interprets the characters, but rather a database connection issue. If the UTF-8 value in question looks valid in the database but does not look right when displayed on a web page, that could mean your database connection settings are not set correctly.