I tried to install new Domino V10 on my test server and then added POI Plugin. It seems everything works great but when tried to create/export an excel file via POI this line does not work. Does poi work with Domino V10 or not? Any suggestion would be great.
**var wb = WorkbookFactory.create(inp);**
//POI CODE SAMPLE
var resourcePath = "/DemoExcel.xlsx";
var excelName = "DepoExcel_v1.xslx";
var bantfile = java.lang.System.getProperty("java.io.tmpdir");
var excelFilePath = bantfile+"\\"+ excelName;
var inp = facesContext.getExternalContext().getResourceAsStream(resourcePath);
var wb = WorkbookFactory.create(inp);
var sheet = wb.getSheetAt(0);
//Code continuous here...
UPDATE 2:
ERROR LOG DETAILS
CLFAD0141E: Error processing XPage request CLFAD0211E: Exception thrown CLFAD0246E: Exception occurred servicing request for: /ays/poi.nsf/xspViewMainPage.xsp - HTTP Code: 500'
Related
When trying to use the Formality setting (https://aws.amazon.com/about-aws/whats-new/2022/10/amazon-translate-formality-customization-support-dutch-korean-mexican-spanish/ ) in code behind (.Net), I keep getting System.NullReferenceException: 'Object reference not set to an instance of an object.'
Here's the code I'm running - everything works as expected until I add in request.Settings.Formality = "FORMAL";`
using (var client = new AmazonTranslateClient(awsCredentials, selectedRegion))
{
var request = new Amazon.Translate.Model.TranslateTextRequest();
request.Text = toTranslate;
request.SourceLanguageCode = sourceLanguage;
request.TargetLanguageCode = translateLanguage;
request.Settings.Formality = "FORMAL";
`Looking at the limited examples in other languages from the AWS documentation doesn't indicate anything else that's needed. I also tried the Profanity setting and the same results - System.NullReferenceException.
I also tried making the call later via the using statement that looks like this with the same error:`
var response = client.TranslateTextAsync(request).GetAwaiter().GetResult();
response.AppliedSettings.Formality = translationFormality;
`
Updated code with solution that worked for me:
using (var client = new AmazonTranslateClient(awsCredentials, selectedRegion))
{
var request = new Amazon.Translate.Model.TranslateTextRequest();
request.Text = toTranslate;
request.SourceLanguageCode = sourceLanguage; // SourceLanguageItem.LanguageCode;
request.TargetLanguageCode = translateLanguage; // TranslateLanguageItem.LanguageCode;
TranslationSettings settings = new TranslationSettings();
settings.Formality = "FORMAL";
request.Settings = settings;
I am generating Excel files using OpenXML, the file opens without any issues on my desktop with Excel 2016 installed. The file also passes validation using Open XML Productivity Tool 2.5.
The problem is that the file is rejected from the SQL Server Integration Services (SSIS) processing. The error is "External table is not in the expected format"
As far as I know SSIS is using OLEDB to process the files.
I have tried to read the file locally using the following code and was able to reproduce the same error.
The code is as follows:
var fileName = "C:\\Temp\\myExcel.xlsx";
var connectionString = String.Empty;
if (Path.GetExtension(fileName) == ".xlsx")
{
connectionString = string.Format("Provider=Microsoft.ACE.OLEDB.12.0;Data Source={0};Extended Properties=\"Excel 12.0;HDR=YES;\"", fileName);
}
else //.xls
{
connectionString = string.Format("Provider=Microsoft.Jet.OLEDB.4.0;Data Source={0};Extended Properties=\"Excel 8.0;HDR=YES;IMEX=1;\"", fileName);
}
using (OleDbConnection conn = new OleDbConnection(connectionString))
{
conn.Open();
var adapter = new OleDbDataAdapter("select * from [test$]", conn);
var excelDataSet = new DataSet();
adapter.Fill(excelDataSet, "anyNameHere");
var data = excelDataSet.Tables["anyNameHere"];
foreach (DataRow row in data.Rows)
{
Console.Out.WriteLine(row[NAME].ToString());
}
}
All I was able to find in the net that this error is due to wrong connection string (Microsoft.Jet.OLEDB.4.0 and Excel 8.0 instead of Microsoft.ACE.OLEDB.12.0 and Excel 12.0) but I already have this.
This is definitely something wring with the file itself. The problem disappears if I open the file in Excel, and use save as.
I was trying to unpack the original and resaved files and compare the contents but the difference is huge, when saving excel adds lots of styles, themes, and xmls references. I really would not like to follow that path.
Do you know what parts are important for OleDB provider when reading Excel??
Question on Servicestack ServerEvents using Azure Redis cache..
Server Code:
I have these lines under Configure method of Global.asax file
Plugins.Add(new ServerEventsFeature {
OnConnect = (res,httpReq) => res.Publish("cmd.onConnect","Message on connect") ,
OnCreated = (res,httpReq) => res.Publish("cmd.onConnect","Message on create"),
...I have custom message for OnSubscription and OnPublish as well
})
**var redisHost = AppSettings.GetString("RedisHost");
container.Register<IRedisClientsManager>(
new RedisManagerPool(redisHost));
container.Register<IServerEvents>(c =>
new RedisServerEvents(c.Resolve<IRedisClientsManager>()));
container.Resolve<IServerEvents>().Start();**
Following is the value format I have in my web.config, for the redis connection
add key="RedisHost" value="passKey#Hostname:6380?ssl=true"
Client Code:
ServerEventConnect connectMsg = null;
var msgs = new List<ServerEventMessage>();
var commands = new List<ServerEventMessage>();
var errors = new List<Exception>();
var client = new ServerEventsClient(baseUri,"home") {
OnConnect = e => connectMsg = e,
OnCommand = commands.Add,
OnMessage = msgs.Add,
OnException = errors.Add,
}.Start();
var connectMsg = client.Connect();
var joinMsg = client.WaitForNextCommand();
connectMsg.Wait();//It gets connnected
joinMsg.Wait(); //When I debug, it is getting lost on this line. I don't get any error message!
When I remove Redis registration marked above in Global.asax (that is default option MemoryServerEvents) works well. Any suggestion, ideas would be very helpful. Thank you
oh God.. Finally I found what the issue is.. It had nothing to do with server events code or its confguration!!! But I have the following line used in my application for a different purpose and which had impact on server events!
// Set the default reuse scope for the container to per request
container.DefaultReuse = ReuseScope.Request;
I guess onConnect is first request and OnJoin or other events are separate requests. As reuse scope was set in my app, it couldn't proceed?! Please share your thoughts if am wrong. Thank you
I am trying to figure out how to post a file to my webservice using servicestack. I have the following code in my client
Dim client As JsonServiceClient = New JsonServiceClient(api)
Dim rootpath As String = Server.MapPath(("~/" + "temp"))
Dim filename As String = (Guid.NewGuid.ToString.Substring(0, 7) + FileUpload1.FileName)
rootpath = (rootpath + ("/" + filename))
FileUpload1.SaveAs(rootpath)
Dim fileToUpload = New FileInfo(rootpath)
Dim document As AddIDVerification = New AddIDVerification
document.CountryOfIssue = ddlCountry.SelectedValue
document.ExpiryDate = DocumentExipiry.SelectedDate
document.VerificationMethod = ddlVerificationMethod.SelectedValue
Dim responseD As MTM.DTO.AddIDVerificationResponse = client.PostFileWithRequest(Of DTO.AddIDVerificationResponse)("http://localhost:50044/images/", fileToUpload, document)
But no matter what I do I get the error message "Method not allowed". At the moment the server code is written like this
Public Class AddIDVerificationService
Implements IService(Of DTO.AddIDVerification)
Public Function Execute(orequest As DTO.AddIDVerification) As Object Implements ServiceStack.ServiceHost.IService(Of DTO.AddIDVerification).Execute
Return New DTO.AddIDVerificationResponse With {.Result = "success"}
End Function
End Class
As you can see I have not tried to process the file on the server yet. I just want to test the client to make sure it can actually send the file to the server. Any ideas what I am doing wrong?
Firstly you're using ServiceStack's Old and now deprecated API, consider moving to ServiceStack's New API for creating future services.
You can look at ServiceStack's RestFiles example project for an example of handling file uploads:
foreach (var uploadedFile in base.RequestContext.Files)
{
var newFilePath = Path.Combine(targetDir.FullName, uploadedFile.FileName);
uploadedFile.SaveTo(newFilePath);
}
Which is able to access the collection of uploaded files by inspecting the injected RequestContext.
An example of uploading a file is contained in the RestFiles integration tests:
var client = new JsonServiceClient(api);
var fileToUpload = new FileInfo(FilesRootDir + "TESTUPLOAD.txt");
var response = restClient.PostFile<FilesResponse>(
"files/Uploads/",fileToUpload,MimeTypes.GetMimeType(fileToUpload.Name));
I have some problem in my project. I want to delete my file from the ftp using proxy.
My code is:
FtpWebRequest request = (FtpWebRequest)WebRequest.Create("ftp://" + FtpServerName + FtpFilePath);
request.Method = WebRequestMethods.Ftp.DeleteFile;
request.Proxy = new WebProxy(ProxyAddress);
request.Proxy.Credentials = new NetworkCredential(ProxyUserName, ProxyPassword);
request.Credentials = new NetworkCredential(FTPUserName, FTPPassword);
FtpWebResponse response = (FtpWebResponse)request.GetResponse();
In this i'm getting error like:
The requested FTP Command is not supported when using http proxy
can any one please help me
Thanks in advance
from http://blogs.msdn.com/b/adarshk/archive/2004/09/13/229069.aspx:
Note on using Http Proxy on FTPWebRequest: Http proxy is only supported for limited number of ftp methods (mainly to download file only), so if you have IE settings for proxy on your machine you need to explicitly set FtpWebRequest to not use proxy like below
request.Proxy = GlobalProxySelection.GetEmptyWebProxy();
If you want to perform other FTP actions through a proxy, you'll have to find another FTP component that supports it.
Instead of request.Proxy = GlobalProxySelection.GetEmptyWebProxy();
try request.Proxy = WebRequest.DefaultWebProxy;
Follows a demo code that worked well for me:
var request = (FtpWebRequest)WebRequest.Create(new Uri("ftp://99.999.99.99/TextFile1.txt"));
request.Method = WebRequestMethods.Ftp.UploadFile;
request.Credentials = new NetworkCredential("ftp_user", "ftp_pass"); // it's FTP credentials, not proxy
request.Proxy = WebRequest.DefaultWebProxy;
var sourceStream = new StreamReader("TextFile1.txt");
byte[] fileContents = Encoding.UTF8.GetBytes(sourceStream.ReadToEnd());
sourceStream.Close();
request.ContentLength = fileContents.Length;
Stream requestStream = request.GetRequestStream();
requestStream.Write(fileContents, 0, fileContents.Length);
requestStream.Close();
var response = (FtpWebResponse)request.GetResponse();
Console.WriteLine("Upload File Complete, status {0}", response.StatusDescription);
response.Close();