Tuesday, June 20, 2017
Copy File from Network folder using JCIFS is an Open Source client library
Copy File from Network folder using JCIFS is an Open Source client library
Here is the code snippet which is used for copying the files from Network folder with user name and password authentication to local drives. This is done with the help of JCIFS
Maven Dependencies
<dependency>
<groupId>org.samba.jcifs</groupId>
<artifactId>jcifs</artifactId>
<version>1.3.14-kohsuke-1</version>
</dependency>
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.util.ArrayList;
import java.util.List;
import jcifs.smb.NtlmPasswordAuthentication;
import jcifs.smb.SmbFile;
import net.sf.jasperreports.engine.JRException;
public void copyFileFromNetwork() {
String userPassword = "userName" + ":" + "password";
String netWorkFolder = "smb://xxx.xxx.x.xx/files/pdfresults/";
NtlmPasswordAuthentication auth = new NtlmPasswordAuthentication(
userPassword);
SmbFile smbFile;
FileOutputStream fileOutputStream;
InputStream fileInputStream;
byte[] buf;
int len;
try {
File temp = File.createTempFile("prefix", ".pdf");
smbFile = new SmbFile(netWorkFolder, auth);
// Look for File mydocument*.*
SmbFile[] files = smbFile.listFiles("mydocument" + "*");
if (files.length > 0) {
fileOutputStream = new FileOutputStream(temp);
fileInputStream = files[0].getInputStream();
buf = new byte[16 * 1024 * 1024];
while ((len = fileInputStream.read(buf)) > 0) {
fileOutputStream.write(buf, 0, len);
}
fileInputStream.close();
fileOutputStream.close();
} else
System.out.println(" File Not Found");
} catch (Exception e) {
System.out.println(" Error " + e);
}
}
Available link for download
Friday, June 2, 2017
CruiseControl the open source that changed the way we develop software
CruiseControl the open source that changed the way we develop software
I finally uploaded the presentation for the session Luiza Pagliari and I (Paulo Caroli) gave at the FISL 2010 conference. Enjoy it!
Available link for download
Tuesday, May 16, 2017
Create New File in Network folder using JCIFS is an Open Source client library
Create New File in Network folder using JCIFS is an Open Source client library
Here is the code snippet which is used to create file in Network folder with user name and password authentication to local drives. This is done with the help of JCIFS
Maven Dependencies
<dependency>
<groupId>org.samba.jcifs</groupId>
<artifactId>jcifs</artifactId>
<version>1.3.14-kohsuke-1</version>
</dependency>
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.util.ArrayList;
import java.util.List;
import jcifs.smb.NtlmPasswordAuthentication;
import jcifs.smb.SmbFile;
import net.sf.jasperreports.engine.JRException;
public boolean createFileInNetworkFolder() {
boolean successful = false;
try {
String userPassword = "UserName" + ":" + "pasword";
NtlmPasswordAuthentication auth = new NtlmPasswordAuthentication(
userPassword);
String newFileName = "sample.txt";
String fileContent = "Just a Test File";
String path = "smb://xxx.xxx.x.xx/files/" + newFileName;
SmbFile sFile = new SmbFile(path, auth);
SmbFileOutputStream sfos = new SmbFileOutputStream(sFile);
sfos.write(fileContent.getBytes());
successful = true;
sfos.close();
} catch (Exception e) {
successful = false;
System.out.println("Problem in Creating New File :" + e);
}
return successful;
}
Available link for download
Friday, February 10, 2017
CReATE Researchers Issue Open Letter on School Closures
CReATE Researchers Issue Open Letter on School Closures
Chicagoland Researchers and Advocates for Transformative Education (CReATE), a network of over 100 professors from numerous Chicago-area universities who specialize in educational research, has reviewed the literature on school closures and conducted an analysis of newly released data to critically assess Chicago Public Schools arguments to justify school closures and to gain a better understanding of what Chicago residents can expect from massive school closures. The history of previous school closures and school actions reveal that closures negatively impact academic performance and create more hardship for communities already suffering from social abandonment. Our findings do not support CPS arguments for closing schools and we conclude that school closures will contribute to a separate and unequal educational system in Chicago.
Primary Contact: Prof. Stephanie Farmer, Roosevelt University, sfarmer@roosevelt.edu, 312-341-3746. Complete list of 107 Chicago-area Education Researchers who signed this letter available at http://tinyurl.com/bn34ncb
UPDATE April 3, 2013 - Education Researchers Nationwide endorse CReATE Open Letter.
A complete list of the 100 education researchers from across the country who have added their signatures to the CReATE Open Letter is available at http://tinyurl.com/buasg2m.
Available link for download