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
BULK INSERT TB_TEMP --tabela com as mesmas colunas do arquivo CSV | |
FROM 'C:\Temp\File.csv'-- caminho do arquivo e formato | |
WITH ( | |
CODEPAGE = 'ACP', -- para arquivos com acento | |
FIELDTERMINATOR= ';', -- caractere que separa os campos no arquivo | |
ROWTERMINATOR= '\n') -- referencia para fim da linha | |
GO |
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
USE [BANK] | |
CREATE PROCEDURE [dbo].[spTbTempAndCursor] | |
AS | |
BEGIN | |
SET NOCOUNT ON; | |
CREATE TABLE #TB_TEMP ( | |
[ID] [varchar](10) NOT NULL, | |
[NAME] [varchar](10) NOT NULL |
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
package com.xpto.domain.model.validator; | |
import javax.validation.Constraint; | |
import javax.validation.Payload; | |
import java.lang.annotation.*; | |
@Target(ElementType.FIELD) | |
@Retention(RetentionPolicy.RUNTIME) | |
@Constraint(validatedBy = PhotoExtensionValidator.class) | |
@Documented |
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
@Embeddable | |
public class Phone { | |
private String number; | |
private String extensionNumber; | |
//ctors | |
//getters/setters | |
} |
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
//Controller | |
@Get | |
public final Download authenticate() { | |
AuthenticationProto.Authentication proto = AuthenticationProto.Authentication.newBuilder() | |
.setToken("token") //sample code | |
.build(); | |
return new ProtoDownload(proto); | |
} |
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
NSURL* url = [NSURL URLWithString:photoURL]; | |
NSURLRequest* request = [[NSURLRequest alloc] initWithURL: url]; | |
NSHTTPURLResponse *response = nil; | |
NSError *error = nil; | |
NSData *responseData = [NSURLConnection sendSynchronousRequest:request returningResponse:&response error:&error]; | |
UIImage* photo = [[UIImage alloc] initWithData:responseData]; | |
[self.btn setImage:photo forState:UIControlStateNormal]; |
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
//inspiration: http://stackoverflow.com/questions/5269236/http-post-of-uiimage-and-parameters-to-webserver | |
@implementation HTTPUtils | |
+(NSData*)post:(NSString*)_urlAddress | |
params: (NSDictionary*) _params | |
headers: (NSDictionary*) _headers | |
images: (NSDictionary*) _images { | |
// create the connection |
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
//CustomUIControl.h | |
@interface CustomUIControl : UIControl | |
@property (nonatomic, getter=isSelected) BOOL selected; | |
@end | |
//CustomUIControl.m | |
@implementation CustomUIControl | |
@synthesize selected; | |
@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
byte[] buffer; | |
using (var memoryStream = new System.IO.MemoryStream()) | |
{ | |
buffer = Encoding.Default.GetBytes("Sample text); | |
memoryStream.Write(buffer, 0, buffer.Length); | |
Response.Clear(); | |
Response.AddHeader("Content-Disposition", "attachment; filename=filename.txt"); | |
Response.AddHeader("Content-Length", memoryStream.Length.ToString()); | |
Response.ContentType = "text/plain"; //This is MIME type | |
memoryStream.WriteTo(Response.OutputStream); |
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
typedef void (^Completion)(void);//block definition | |
@interface MyUITableViewController : UITableViewController | |
@property (nonatomic, copy) NSString* myTitle; | |
@property (readwrite, copy) Completion completion; | |
-(MyUITableViewController *)initWithTitle: (NSString *) _myTitle | |
completion: (Completion) _completion; | |
-(void)back; |
OlderNewer