Skip to content

Instantly share code, notes, and snippets.

View SaschaMoellering's full-sized avatar

Sascha Möllering SaschaMoellering

  • http://autoscaling.io
  • Berlin
View GitHub Profile
@SaschaMoellering
SaschaMoellering / XMLjson
Created November 20, 2012 16:30
XMl -> JSON
XML -> NSDictionary
NSError *error = nil;
NSString *contents = [NSString stringWithContentsOfURL:[NSURL URLWithString:searchIncentivesURL]
encoding:NSUTF8StringEncoding
error:&error];
NSData* xmlData = [contents dataUsingEncoding:NSUTF8StringEncoding];
NSDictionary *xmlDictionary = [XMLReader dictionaryForXMLData:xmlData error:error];
@SaschaMoellering
SaschaMoellering / logfile
Created November 23, 2013 22:43
The problem is: the vertx-zip file is not correctly installed. vagrant@debian-squeeze:~$ ls -la /usr/local/vertx-2.0.2 total 8 drwxr-sr-x 2 root staff 4096 Nov 23 22:38 . drwxrwsr-x 11 root staff 4096 Nov 23 22:38 .. vagrant@debian-squeeze:~$
default[:vertx][:version] = '2.0.2'
default[:vertx][:home] = '/srv/vertx'
default[:vertx][:url] = 'http://dl.bintray.com/vertx/downloads/'
public class SharedData
extends java.lang.Object
Sometimes it is desirable to share immutable data between different event loops, for example to implement a cache of data.
This class allows instances of shared data structures to be looked up and used from different event loops.
The data structures themselves will only allow certain data types to be stored into them. This shields you from worrying about any thread safety issues might occur if mutable objects were shared between event loops.
The following types can be stored in a shareddata data structure:
String
@SaschaMoellering
SaschaMoellering / verx.erb
Created December 9, 2013 10:21
Chef-template for Vert.x-Jmxtrans configuration
{
"servers" : [ {
"alias" : "<%= @node[:hostname] %>",
"host" : "<%= @node[:hostname] %>",
"port" : "<%= @jmx_port %>",
"username" : "<%= @jmx_user %>",
"password" : "<%= @jmx_password %>",
"queries" : [
{
"obj" : "java.lang:type=Memory",
include_recipe "graphite"
begin
r = resources(:template => "#{node['graphite']['base_dir']}/conf/storage-schemas.conf")
r.cookbook "my-cookbook"
rescue Chef::Exceptions::ResourceNotFound
Chef::Log.warn "could not find template to override!"
end
require 'net/http'
link = URI.parse('http://169.254.169.254/latest/meta-data/instance-id')
request = Net::HTTP::Get.new(link.path)
begin
response = Net::HTTP.start(link.host, link.port) { |http|
http.read_timeout = 5 #Default is 60 seconds
http.request(request)
}
require 'net/http'
link = URI.parse('http://169.254.169.254/latest/meta-data/instance-id')
request = Net::HTTP::Get.new(link.path)
begin
response = Net::HTTP.start(link.host, link.port) { |http|
http.read_timeout = 5 #Default is 60 seconds
http.request(request)
}
0 require 'net/http'¬
1 ·¬
2 uri = URI.parse('http://169.254.169.254/latest/meta-data/instance-id')¬
3 ·¬
4 begin¬
5 Net::HTTP.start(uri.host, uri.port) do |http|¬
6 request = Net::HTTP::Get.new uri.request_uri¬
7 http.open_timeout = 5¬
8 respone = http.request request·¬
9 end¬
require 'net/http'
uri = URI.parse('http://169.254.169.254/latest/meta-data/instance-id')
begin
Net::HTTP.start(uri.host, uri.port) do |http|
request = Net::HTTP::Get.new uri.request_uri
http.open_timeout = 5
respone = http.request request
end
IT'S SHOWTIME
HEY CHRISTMAS TREE bottles
YOU SET US UP 99
HEY CHRISTMAS TREE loop
YOU SET US UP @NO PROBLEMO
HEY CHRISTMAS TREE result
YOU SET US UP @I LIED