This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| - (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"]; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| - (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"]; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| TabHost.TabSpec spec = tabs.newTabSpec(“tag”); | |
| spec.setContent(R.id.tab1); | |
| spec.setIndicator(“Name of the tab1”); | |
| tabs.addTab(spec); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| TabHost tabs = (TabHost) findViewById(R.id.tabhost); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ObjectSet result = db.queryByExample(Task.class); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class Invoice < ActiveRecord::Base | |
| validates :vat_number, :vat => { :country_method => :my_method } | |
| end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class Invoice < ActiveRecord::Base | |
| validates :vat_number, :vat => true | |
| end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # 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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Get the disk usage | |
| du -h /var/lib |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Listen (on server) : | |
| netcat -l -p 4242 | |
| Contact (on client) : | |
| netcat my-server.com 4242 |