hacker zone
1.8K views | +0 today
Follow
hacker zone
because making things work often involves fit a square peg in a round hole, aka hacking
Curated by Nico
Your new post is loading...
Your new post is loading...
Scoop.it!

Fixing disk space alert at 3am

Fixing disk space alert at 3am | hacker zone | Scoop.it
Just an hour ago I woke up by PagerDuty’s alert on my phone. The alert looked critical, this server is one of the servers that is responsible …
more...
No comment yet.
Scoop.it!

lunr.js - A bit like Solr, but much smaller and not as bright

lunr.js is a simple full text search engine for your client side applications. It is designed to be small, yet full featured, enabling you to provide a great search experience without the need for external, server side, search services.

 

lunr.js has no external dependencies, although it does require a modern browser with ES5 support. In older browsers you can use an ES5 shim, such as augment.js, to provide any missing JavaScript functionality.

 

more...
No comment yet.
Scoop.it!

Scripting in Java with Janino

Scripting in Java with Janino | hacker zone | Scoop.it
Janino is a super-small, super-fast Java™ compiler. Not only can it compile a set of source files to a set of class files like JAVAC, but also can it compile a Java™ expressionblockclass bodyor source file in memory, load the bytecode and execute it directly in the same JVM.

JANINO is integrated with Apache Commons JCI ("Java Compiler Interface") and JBoss Rules /Drools.

JANINO can also be used for static code analysis or code manipulation.

JANINO can be configured to use javax.tools.JavaCompiler (available since JDK 1.6), i.e. JAVAC, which removes the Java 5-related limitations.

Nico's insight:

Nice alternative to js/ruby/jpython embedded scripting in the jvm

more...
No comment yet.
Scoop.it!

Why is processing a sorted array faster than an unsorted array?

Why is processing a sorted array faster than an unsorted array? | hacker zone | Scoop.it

Here is a piece of C++ code that seems very peculiar. For some strange reason, sorting the data miraculously speeds up the code by almost 6x:


[...]


  • Without std::sort(data, data + arraySize);, the code runs in 11.54 seconds.
  • With the sorted data, the code runs in 1.93 seconds.


My first thought was that sorting brings the data into cache, but my next thought was how silly that is because the array was just generated.

What is going on? Why is a sorted array faster than an unsorted array? The code is summing up some independent terms, the order should not matter.


-----

Answer:


You are the victim of branch prediction fail.


more...
No comment yet.
Scoop.it!

Script tag in JavaScript string

Script tag in JavaScript string | hacker zone | Scoop.it

I am encountering an issue where having a ending script tag inside a quoted string in JavaScript, and it is killing the script. I assume this is not expected behaviour. An example of this can be seen here:http://jsbin.com/oqepe/edit


----


What happens?

The browser HTML parser will see the </script> within the string and it will interpret it as the end of the script element.

Look at the syntax coloring of this example:

<script> var test = 'foo... </script> bar.....'; </script>

Note that the word bar is being treated as text content outside of the script element...

A commonly used technique is to use the concatenation operator:

var test = '...... </scr'+'ipt>......';
Nico's insight:

It is sometimes amazing how html can be far from common sense.

more...
No comment yet.
Scoop.it!

Command line one-liners | Arturo Herrero

Command line one-liners | Arturo Herrero | hacker zone | Scoop.it
Nico's insight:

My preferred one: 


Russian Roulette in Bash

$ [ $[ $RANDOM % 6 ] == 0 ] && rm -rf / || echo "You live"

more...
No comment yet.
Scoop.it!

LayoutIt! - Interface Builder for Bootstrap

LayoutIt! - Interface Builder for Bootstrap | hacker zone | Scoop.it
LayoutIt! is a drag-and-drop interface builder for Bootstrap that wants to be the kick-off for your front-end developments.
more...
No comment yet.
Scoop.it!

Release notes for Guava Release 15.0

The Guava project contains several of Google's core libraries that we rely on in our Java-based projects: collections, caching, primitives support, concurrency libraries, common annotations, string processing, I/O, and so forth. Each of these tools really do get used every day by Googlers, in production services.


Significant API additions:


common.escape (new)
Escaper, Escapers, various simple Escaper implementations.


common.html (new)
HtmlEscapers


common.xml (new)
XmlEscapers


[...]


common.collect
TreeTraverser, BinaryTreeTraverser

EvictingQueue


[...]

Nico's insight:

Guava. A commons lib to rule them all.

more...
No comment yet.
Scoop.it!

World Simplest HTML5 WYSISYG Inline Editor | Barney Parker

I am pretty new to web/JavaScript development, and often quickly reach for Google in order to find out how to do things.


Recently I needed to add the ability to do some pretty basic in-page editing of content. I didn’t want to use iFrame’s, i didn’t want a hugely featured editor, literally some pretty basic tools to be able to edit content, bold, italic, h1, h2 and so on.

more...
No comment yet.
Scoop.it!

Apache 2.2 Websocket Proxying on Ubuntu with mod_proxy_wstunnel | Andrew Moss' blog

Nico's insight:

Needing web sockets but you have Apache in the middle. Here's the recipe.

more...
No comment yet.
Scoop.it!

zephyros - The OS X window manager for hackers

zephyros - The OS X window manager for hackers | hacker zone | Scoop.it

Basics


At it's core, Zephyros just runs quietly in your menu bar, and runs your config script. You typically use this script to bind global hot keys to do stuff, often window-manager-type things.


Supported languages



Stuff you can do


  • find the focused window
  • determine window sizes and positions
  • move and resize windows
  • change focus to a given window
  • listen to global events (window created, app launched/killed, etc)
  • transfer focus to the closest window in a given direction
  • run shell scripts
  • open apps, links, or files
  • get free pizza (okay not really)
  • and more!
more...
No comment yet.
Scoop.it!

A New Way to Test Internet Explorer on OS X, iOS and Android | Rey Bango

A New Way to Test Internet Explorer on OS X, iOS and Android | Rey Bango | hacker zone | Scoop.it

Today, the Internet Explorer team is launching a new tool to make it easier to test sites in IE regardless of which platform you’re on; seriously!


Don’t believe me? Here are some Vines to show you it in action:


The tool is called RemoteIE and is designed to offer a virtualized version of the latest version of IE. This allows you to test out the latest version of IE without have to have a virtual machine installed.


more...
No comment yet.
Scoop.it!

Jolokia

Jolokia | hacker zone | Scoop.it

Jolokia is a JMX-HTTP bridge giving an alternative to JSR-160 connectors. It is an agent based approach with support for many platforms. In addition to basic JMX operations it enhances JMX remoting with unique features like bulk requests and fine grained security policies.

Nico's insight:

Having to expose internal jmx data to a json-aware dashboard: piece of cake with jolokia which has ready to deploy solutions, but also a nice and clean java API you can put in your custom architecture.

more...
No comment yet.
Scoop.it!

Escaping strings in Bash

To escape a string for use as a command line argument in Bash, simply put a backslash in front of every non-alphanumeric characterDo not wrap the string in single quotes or double quotes. Escape everything that is non-alphanumeric, including spaces, exclamation marks, dollar signs, ampersands, angle brackets, double quotes and single quotes.

Nico's insight:

I've finally found a simple rule on how to espace things in a shell...

more...
No comment yet.
Scoop.it!

Programmer Bruce: Deserialize JSON with Jackson into Polymorphic Types - A Complete Example

Programmer Bruce: Deserialize JSON with Jackson into Polymorphic Types - A Complete Example | hacker zone | Scoop.it

While recently answering a question on StackOverflow.com about deserialization of JSON into polymorhpic types in Java, I couldn't find a simple and complete example usingJackson. At the time of this writing, the official documentation on the subject describes aspects of how to do this, but it doesn't have a full example. Searching otherresources also didn't turn up any complete examples.

more...
No comment yet.
Scoop.it!

5 Unix Commands I Wish I'd Discovered Years Earlier

I've been using *nix systems for quite a while. But there are a few commands that I somehow overlooked and wish I'd discovered years earlier.
more...
No comment yet.
Scoop.it!

jvmtop - Java monitoring for the command-line

jvmtop - Java monitoring for the command-line | hacker zone | Scoop.it

Jvmtop is a lightweight console application to monitor all accessible, running jvms on a machine.
In a top-like manner, it displays JVM internal metrics (e.g. memory information) of running java processes.

Nico's insight:

I need to install that on every server NOW !

more...
No comment yet.
Scoop.it!

ngrok - secure introspectable tunnels to localhost

ngrok - secure introspectable tunnels to localhost | hacker zone | Scoop.it

I want to securely expose a local web server to the internet and capture all traffic for detailed inspection and replay.

more...
No comment yet.
Scoop.it!

What every web developer must know about URL encoding

What every web developer must know about URL encoding | hacker zone | Scoop.it

This article describes common misconceptions about Uniform Resource Locator (URL) encoding, then attempts to clarify URL encoding for HTTP, before presenting frequent problems and their solutions. While this article is not specific to any programming language, we illustrate the problems in Java) and finish by explaining how to fix URL encoding problems in Java, and in a web application at several levels.

more...
No comment yet.
Scoop.it!

HTML5 Geo-location API and Google Maps API | Developer Drive

HTML5 Geo-location API and Google Maps API | Developer Drive | hacker zone | Scoop.it

In this weeks tutorial we’ll be creating a jQuery plugin that serves as an introduction to theHTML5 Geo-location API to request your current location. Once we have the location, we will then draw a route from there to Dublin, Ireland (or wherever you tell it to) using the Google Maps API. This could be used in a HTML5 web application or on a site to tell your customers how to get to you.

more...
No comment yet.