1. The $16 IKEA standing desk hack (2 monitors)

    I finally wanted to test out the standing desk model, but wanted to avoid the expense of a full automated table. So I went with a DIY hack built from cheap IKEA parts.

    Note this is definitely cheap, it’s not even inexpensive :)

    Parts used:

    • LACK side tables (found on sale for $5 each)
    • EKBY Laiva shelves, which are clearly on clearance at $2 each.
    • EKBY STÖDIS brackets @ $0.50 each. These are the cheap plastic ones. Of course, they are only holding up a keyboard and mouse.

    Photos From the Assembly

    Assemble the side tables on top of the main desk as higher monitor stands. Step 1

    Here are the monitors on the tables. Step 2

    Next I measured out and drilled + screwed in all of the brackets. These legs have very little wood. For durability it would have been much better to use bolts and drill right through. However, this would likely require different brackets.

    Step 3Step 4

    Once the brackets were in place, I simple rested the shelves on the brackets. The brackets have holes that would allow me to drill them in, but it really seems unnecessary. If slippage is a real worry, some people have used shelving liner.

    Here is the finished product with keyboard and mouse. The little orange ball in the middle is my blink(1) mk2, it’s a USB light I use for alerts.

    Step 5: Finished product

    2 weeks ago  /  1 note

  2. Node.js vs Go - a simple web server

    As I learn Go, the thing I find the most interesting is the similarities between Go and Node.js in terms of first-classing Events and Streams along with the first-classing of functions.

    The easiest way to see the similarities is the example of a simple Web Server.


    var http = require('http');
    var handler = function (req, res) {
      res.writeHead(200, {'Content-Type': 'text/plain'});
      res.end('Hello World\n');
    var webServer = http.createServer(handler)
    webServer.listen(8080, '');


    package main
    import (
    func handler(w http.ResponseWriter, r *http.Request) {
        fmt.Fprintf(w, "Hello World")
    func main() {
        http.HandleFunc("/", handler)
        http.ListenAndServe(":8080", nil)

    These are both quite similar Import vs Require, Request and Response objects coming into the main handler.

    There are also some clear differences, Go really expects you to be comfortable with writing to the ResponseStream and Node.js wraps a lot of this for you.

    1 month ago  /  0 notes

  3. The Key ORM problem

    After working with and writing various forms of ORM for years, I think I have finally pinned down my core issue with them. Inspired by Rich Hickey’s talk from StrangeLoop 2011: http://bit.ly/1eGEUkk.

    ORMs do not focus on Outgoing data transformations.

    It’s not that ORMs aren’t useful for reading data. It’s simply that they suck for modifying data.

    ORMs bill themselves as tools for providing mappings between “Objects” and “Data”. When it comes to reading data, thinks like Entity Framework (EF) are useful for combining data and returning it a structured fashion. It can easily map “Data” into “Objects”.

    However, where tools like EF fall down are when it comes to modifying data. The standard method of changing data involves: - Loading the data into an object - Making some changes to the in-memory representation - Calling Save()

    But this process never actually works that way. - It doesn’t handle concurrent changes or over-writing each other’s data. - It never maps to “atomic” changes like "increment this number" or "add this to a sub-array in the data".

    When you get started it’s “easy”, but it inevitably tumbles into the underlying complexity that it’s trying to hide from you. You inevitably start writing stored procedures or hand-coding SQL or other DB transformations.

    I think the core reason for this is the ORM view of the world. ORM literally "maps data into objects" and that’s great for reading. And it’s OK for creating data. But when I want to update data I really want to do is map a transformation onto data.

    ORMs don’t do this. They track changes on an object (at best) and then attempt to map the object changes to data changes and then map those into DB calls.

    But that’s never what I want to do. I want to allow specific transformations and map those transformations directly onto the data in a way that’s rational for that data. I don’t want people messing with the individual columns of my data. That’s a recipe for disaster.

    So that’s my key ORM problem, it sucks for modifying data.

    8 months ago  /  0 notes

  4. Counting Outgoing TCP connections by Port

    Here’s the PowerShell script. Great for identifying the types of connections being held.

    [Net.NetworkInformation.IPGlobalProperties]::GetIPGlobalProperties().GetActiveTcpConnections() |
        where { $_.State -eq "Established" } |
        foreach { $_.RemoteEndPoint } | 
        group -Property Port | 
        sort -Descending -Property Count

    1 year ago  /  0 notes

  5. SQL Server, add a random time to a DATETIME column

    Seems simple, the but NEWID() is a great trick.

    dateadd(millisecond, ABS(CHECKSUM(NEWID()))%86400000, dateToIncrement)

    The third part is your column name that you want to increment.

    Pulled and modified from here.

    1 year ago  /  0 notes

  6. Group By Week

    When ranging over data, it’s nice to group out data by week of the year. But you also want to display the first day of that week.

    Here it is for SQL Server.

    The key parts are

    GROUP BY DATEPART(YEAR,trans_date),DATEPART(wk,trans_date)


    MIN(DATEADD(wk, DATEDIFF(wk,0,trans_date), 0)) AS 'Week date',

    1 year ago  /  0 notes

  7. world-shaker:

This is amazing.


    This is amazing.

    (via world-shaker-deactivated2013092)

    1 year ago  /  1,326 notes

  8. SQL Server finding slow queries

    Lifted from here:

    SELECT TOP 20 SUBSTRING(qt.text, (qs.statement_start_offset/2)+1, 
        ((CASE qs.statement_end_offset
          WHEN -1 THEN DATALENGTH(qt.text)
         ELSE qs.statement_end_offset
         END - qs.statement_start_offset)/2)+1), 
    qs.total_logical_reads, qs.last_logical_reads,
    qs.min_logical_reads, qs.max_logical_reads,
    qs.total_elapsed_time, qs.last_elapsed_time,
    qs.min_elapsed_time, qs.max_elapsed_time,
    FROM sys.dm_exec_query_stats qs
    CROSS APPLY sys.dm_exec_sql_text(qs.sql_handle) qt
    CROSS APPLY sys.dm_exec_query_plan(qs.plan_handle) qp
    WHERE qt.encrypted=0
    ORDER BY qs.total_logical_reads DESC

    Note that this can be tweaked by sorting on different things such as total_logical_reads / execution_count.

    2 years ago  /  0 notes