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
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.

Categories
Database

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

SSDTFailed
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.

Categories
Database

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.

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
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!

Categories
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(!).

E.g.

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

Result:
Array
(
    [0] => hi
    [1] => data
)

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

Categories
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.

IMG_3255

Categories
NBA

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.

Categories
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.