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
<html> | |
<body> | |
<h1>File Upload with Jersey</h1> | |
<form action="rest/update/profilePicture" method="post" enctype="multipart/form-data"> | |
<p> | |
Select a file : <input type="file" name="profilePic" size="45" /> | |
<input type="text" name="testingName"/> | |
</p> | |
<input type="submit" value="Upload It" /> |
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
public class Snippet { | |
@POST | |
@Path("/profilePicture") | |
@Consumes(MediaType.MULTIPART_FORM_DATA) | |
public Response profilePictureUpload(@FormDataParam("testingName") String fileName, @FormDataParam("profilePic") File inputfile) | |
{ | |
//create upload folder path with user specified image name | |
String uploadFileName=profilePictureFolder+fileName; | |
//code to write file |
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
protected String doInBackground(String... params){ | |
String attachmentName = "profilePic"; | |
String crlf = "\r\n"; | |
String twoHyphens = "--"; | |
String boundary = "*****"; | |
String testName="sandeep.jpg"; | |
try{ | |
HttpURLConnection httpUrlConnection = null; | |
URL url = new URL("http://your_url_here.com/rest/update/profilePicture"); | |
httpUrlConnection = (HttpURLConnection) url.openConnection(); |
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
+ (id)sharedManager { | |
static SBNotificationViewController *sharedMyManager = nil; | |
static dispatch_once_t onceToken; | |
dispatch_once(&onceToken, ^{ | |
sharedMyManager = [[self alloc] init]; | |
}); | |
return sharedMyManager; | |
} |
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
-(id)init{ | |
self=[super init]; | |
NSArray *subviewArray = [[NSBundle mainBundle] loadNibNamed:@"SBNotificationBarView" owner:self options:nil]; | |
UIView *mainView = [subviewArray objectAtIndex:0]; | |
self.view = mainView; | |
keyWindow= [[SBCustomWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]]; | |
keyWindow.windowLevel = UIWindowLevelAlert; | |
keyWindow.rootViewController = self; |
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
-(BOOL)pointInside:(CGPoint)point withEvent:(UIEvent *)event{ | |
if(CGRectContainsPoint(self.rootViewController.view.frame, point)){ | |
[(SBNotificationViewController *)self.rootViewController checkIfNotificationBarTappedWithPoint:point andEvent:event]; | |
return true; | |
} | |
else{ | |
return false; | |
} | |
} |
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
let appDelegate = UIApplication.sharedApplication().delegate as? AppDelegate | |
appDelegate?.managedObjectContext.performBlock({ | |
let person = NSEntityDescription.insertNewObjectForEntityForName("Person", inManagedObjectContext: (appDelegate?.managedObjectContext)!) as! Person | |
person.name = "Sandeep" | |
person.age = NSNumber(integer: Int(26)) | |
person.nickname = "Sandeep" | |
person.phone = "1234567890" | |
try! appDelegate?.managedObjectContext.save() | |
self.dismissViewControllerAnimated(true, completion: nil) | |
}) |
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
target 'EncryptedCoredata' do | |
# Comment this line if you're not using Swift and don't want to use dynamic frameworks | |
use_frameworks! | |
# Pods for EncryptedCoredata | |
pod 'RNCryptor', '~> 4.0.0-beta' | |
target 'EncryptedCoredataTests' do | |
inherit! :search_paths | |
# Pods for testing |
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
import UIKit | |
import RNCryptor | |
class EncryptedStringTransformer : NSValueTransformer { | |
let password = "S@ndeepHere123" | |
override func transformedValue(value: AnyObject?) -> AnyObject? { | |
guard let passedValue = value else { | |
return nil | |
} |
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
do { | |
try coordinator.addPersistentStoreWithType(NSSQLiteStoreType, configuration: nil, URL: url, options: nil) | |
} catch { | |
// Report any error we got. | |
var dict = [String: AnyObject]() | |
dict[NSLocalizedDescriptionKey] = "Failed to initialize the application's saved data" | |
dict[NSLocalizedFailureReasonErrorKey] = failureReason | |
dict[NSUnderlyingErrorKey] = error as NSError | |
let wrappedError = NSError(domain: "YOUR_ERROR_DOMAIN", code: 9999, userInfo: dict) |
OlderNewer