- Profilo Linkedin: https://it.linkedin.com/in/marcovelluto
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 byte[] getByteFromFile(File file) throws IOException, FileTooBigException { | |
| if (file.length() > MAX_FILE_SIZE) { | |
| throw new FileTooBigException(file); | |
| } | |
| ByteArrayOutputStream ous = null; | |
| InputStream ios = null; | |
| try { | |
| byte[] buffer = new byte[4096]; | |
| ous = new ByteArrayOutputStream(); | |
| ios = new FileInputStream(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
| private ArrayList<File> importFileFromPath(String forderPath) | |
| { | |
| ArrayList<File> files = new ArrayList<>(); | |
| File folder = new File(forderPath); | |
| File[] listOfFile = folder.listFiles(); | |
| for (int i = 0; i < listOfFile.length; i++) | |
| { | |
| if (listOfFile[i].isFile()) | |
| { |
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
| #Databse: Microsoft SQL Server. | |
| USE <database_name> | |
| GO | |
| SELECT table_name 'table_name', | |
| column_name 'Column Name', | |
| data_type 'Data Type', | |
| CHARacter_maximum_length 'Maximum Length' | |
| FROM information_schema.columns | |
| WHERE data_type = <Type to field> |
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
| /** | |
| * Copyright (c) 2015 Marco Velluto | |
| * Warning! It only works with doc files, but NOT working with .docx | |
| */ | |
| import java.io.ByteArrayOutputStream; | |
| import java.io.IOException; | |
| import java.io.InputStream; | |
| import org.apache.poi.hwpf.HWPFDocumentCore; |
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
| INSERT INTO xtb_comune(`CODICE_CATASTALE`, `CAP`, `CAPOLUOGO`, `CODICE_ISTAT`, `COMUNE`, `ENABLED`, `POSITION`, `REGIONE`, `SIGLA_PROVINCIA`) VALUES | |
| ('A089','92100','Agrigento','84001','Agrigento',true,'74','Sicilia','AG'), | |
| ('A181','92010','Agrigento','84002','Alessandria della Rocca',true,'146','Sicilia','AG'), | |
| ('A351','92021','Agrigento','84003','Aragona',true,'294','Sicilia','AG'), | |
| ('A896','92010','Agrigento','84004','Bivona',true,'731','Sicilia','AG'), | |
| ('B275','92010','Agrigento','84005','Burgio',true,'1012','Sicilia','AG'), | |
| ('B377','92010','Agrigento','84006','Calamonaci',true,'1078','Sicilia','AG'), | |
| ('B427','92010','Agrigento','84007','Caltabellotta',true,'1120','Sicilia','AG'), | |
| ('B460','92020','Agrigento','84008','Camastra',true,'1147','Sicilia','AG'), | |
| ('B486','92022','Agrigento','84009','CamMarcheata',true,'1169','Sicilia','AG'), |
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
| /* | |
| * ---------------------------------------------------------------------------- | |
| * "THE BEER-WARE LICENSE" (Revision 42): | |
| * <dweymouth@gmail.com> wrote this file. As long as you retain this notice you | |
| * can do whatever you want with this stuff. If we meet some day, and you think | |
| * this stuff is worth it, you can buy me a beer in return. D. Weymouth 4/2014 | |
| * ---------------------------------------------------------------------------- | |
| */ | |
| import java.io.*; |
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
| /** | |
| * Copyright (c) 2016 Marco Velluto | |
| * @since Java 1.8 | |
| * @dependency: <groupId>joda-time</groupId> | |
| */ | |
| import java.util.ArrayList; | |
| import java.util.HashSet; | |
| import java.util.List; | |
| import java.util.Set; |
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
| /** | |
| * Copyright (c) 2016 Marco Velluto | |
| * @since Java 1.8 | |
| * @dependency: <groupId>joda-time</groupId> | |
| */ | |
| import java.text.ParseException; | |
| import java.text.SimpleDateFormat; | |
| import java.util.ArrayList; | |
| import java.util.Date; |
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 it.reexon.reexon.lib.crypt; | |
| import java.io.File; | |
| import java.io.FileInputStream; | |
| import java.io.FileNotFoundException; | |
| import java.io.FileOutputStream; | |
| import java.io.IOException; | |
| import java.io.ObjectInputStream; | |
| import java.io.ObjectOutputStream; | |
| import java.security.KeyPair; |
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
| extension String { | |
| func md5() -> String! { | |
| let str = self.cStringUsingEncoding(NSUTF8StringEncoding) | |
| let strLen = CUnsignedInt(self.lengthOfBytesUsingEncoding(NSUTF8StringEncoding)) | |
| let digestLen = Int(CC_MD5_DIGEST_LENGTH) | |
| let result = UnsafeMutablePointer<CUnsignedChar>.alloc(digestLen) | |
| CC_MD5(str!, strLen, result) | |
| var hash = NSMutableString() |