Skip to content

Instantly share code, notes, and snippets.

View aurels's full-sized avatar

Aurélien Malisart aurels

View GitHub Profile
- (NSArray *) getJSONArray:(NSString *)url_suffix {
NSLog(@"Init Connection");
NSString *combo = [NSString stringWithFormat:@"%@:%@", login, password];
NSData *comboData = [NSData dataWithBytes:[combo UTF8String] length:combo.length];
NSString *auth = [NSString stringWithFormat:@"Basic %@", [Base64 Base64Encode:comboData]];
NSString * url_request = [NSString stringWithFormat:@"%@%@", url, url_suffix];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:url_request]];
[request setHTTPMethod:@"GET"];
[request setValue:@"application/json" forHTTPHeaderField:@"Content-Type"];
- (void) connectionWithmethod:(NSString *)method url:(NSString *)url_suffix {
responseData = [[NSMutableData data] retain];
NSString *combo = [NSString stringWithFormat:@"%@:%@", login, password];
NSData *comboData = [NSData dataWithBytes:[combo UTF8String] length:combo.length];
NSString *auth = [NSString stringWithFormat:@"Basic %@", [Base64 Base64Encode:comboData]];
NSString * url_request = [NSString stringWithFormat:@"%@%@", url, url_suffix];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:url_request]];
[request setHTTPMethod:method];
[request setValue:@"application/json" forHTTPHeaderField:@"Content-Type"];
[request setValue:auth forHTTPHeaderField:@"Authorization"];
TabHost.TabSpec spec = tabs.newTabSpec(“tag”);
spec.setContent(R.id.tab1);
spec.setIndicator(“Name of the tab1”);
tabs.addTab(spec);
TabHost tabs = (TabHost) findViewById(R.id.tabhost);
ObjectSet result = db.queryByExample(Task.class);
class Invoice < ActiveRecord::Base
validates :vat_number, :vat => { :country_method => :my_method }
end
class Invoice < ActiveRecord::Base
validates :vat_number, :vat => true
end
# Ubuntu fixed IP
/etc/network/interfaces :
auto eth0
iface eth0 inet static
address 192.168.0.142
netmask 255.255.255.0
network 192.168.0.0
broadcast 192.168.0.255
# Get the disk usage
du -h /var/lib
Listen (on server) :
netcat -l -p 4242
Contact (on client) :
netcat my-server.com 4242