|
Thanks for your support. The result is unfortunately the same (response is always "0"). It doesn't care what I set the filename to or if the file it present. Maybe i'm overlooking something, or that method doesn't really work as the document says.
[DllImport("SH_API.dll", CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Ansi)]
[return: MarshalAs(UnmanagedType.I4)]
public static extern int SHAPI_GetSA124CalData([MarshalAs(UnmanagedType.LPStr)] string FileName, int deviceNum = 0);
string fileName = "D30510098.bin";
Int32 CalDataResult = -1;
CalDataResult = Dll.SHAPI_GetSA124CalData(fileName, 0);
|
|
|
|
|
I guess you need to go back to the provider of the library and ask them.
|
|
|
|
|
and so i did... and they just confirmed that the API is faulty in that sense, and always reports "0". They will make a new version.
|
|
|
|
|
Hi,
I want to generate an .rtf file in which the data will be filled from the database.
I am short of time to develop my application and dont have time to write my own library for rtf generation.
Any free easy to use library or dll will be helpful.
Please suggest.
Thanks,
Mukul Sharma
|
|
|
|
|
|
mukulsharma1146 wrote: Any free easy to use library or dll will be helpful. ..there's a RichTextBox control in the framework. It is well documented and does exactly what you need.
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
Hi Eddy,
Thanks for the reply.
Actually I do not have a rich text control in the html. I have form data in the database from which I need to create an rtf report.
As suggested by some other blogs, I am supposed to read the data from the database (SQL Server) and get it inside an HTML form and finally generate the rtf file from the html form (I don't need to render the html form).
Kindly let me know if I am following the right approach.
Also if there are any other ways of achieving this.
Thanks,
Mukul
|
|
|
|
|
You could use the WPF RichTextBoxControl that supports HTML<=> RTF:
"Converting between RTF and HTML" [^].
« There is only one difference between a madman and me. The madman thinks he is sane. I know I am mad. » Salvador Dali
|
|
|
|
|
I want to ask how to draw small circle in rectangle?
|
|
|
|
|
|
Needs context. What are you drawing on and with what framework?
Depending on the context, there are several possible answers to your question, and they're so wildly different that if you get the wrong one it won't help you in the slightest.
|
|
|
|
|
How to draw small circle in center of rectangle and how to find center of rectangle?
i have project is object detection base on object shape with method edge detection aforge.net which i use net aforge.net 2.2.4
|
|
|
|
|
I dono haw to write a C# code to upload an image on the image box when button is pressed. plz suggest?
|
|
|
|
|
Upload to where? FTP, a webserver, a database?
What did you try? Have you tried copy/pasting one of the examples on the internet?
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
string queryString = "select * from bbb where A1=:A1 and B1=:B1";
public OracleParameter[] GetSqlParameters(string[] fields, object[] obj)
{
try
{
OracleParameter[] parameters = new OracleParameter[obj.Count()];
for (int i = 0; i < obj.Count(); i++)
{
parameters[i] = new OracleParameter(fields[i], obj[i]);
}
return parameters;
}
catch
{
return new OracleParameter[] { };
}
}
how to use this method?give a example!
thinks!
|
|
|
|
|
Ask the person who wrote it?
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
Hi,
The way I understand this is that this function is used to add parameters and their type before making a call to the database.
You may write like that:
string[] fields = new string[3];
fields[0] = "param1";
fields[1] = "param2";
fields[2] = "param3";
object[] obj = new object[3];
obj[0] = OracleDbType.Varchar2;
obj[1] = OracleDbType.Decimal;
obj[2] = OracleDbType.Decimal;
OracleParameter[] GetSqlParameters(fields, obj);
You can optimize the above code to a great extent.
|
|
|
|
|
thanks first,
but
how to input the values :A1?
example select * from bbb where A1=:A1 and B1=:B1
:A1 = 'abc', :B1='123'
modified 16-Oct-14 22:56pm.
|
|
|
|
|
So I've run into a snag that is driving me insane. I've built two async connectors: one is to a SQL Server database and have exposed it through WebApi (for a .NET sanity check) and through a Task<object> interface exposed for node consumers. The second uses a TaskCompletionSource that wraps an arbitrary list with a Task (for a node sanity check).
When I Debug the Web Api project and nav to my route that is attached to the database, everything does fine. The data from my database is returned to the browser.
When I node my server attached to the mocked async route, everything does fine. My mock is returned to my server and I spool the object to the console.
HOWEVER...when I try to wire node in to consume the attached data connector, when I browse to the open node port, my server crashes with an error "Process is terminated due to StackOverflowException."
The frustration comes from the fact that I'm doing nothing fancy and the connector retrieves data just fine from an api route.
My server:
var edge = require('edge');
var http = require('http');
var port = process.env.PORT || 8088;
var userRepository = {
getUsers: edge.func({
assemblyFile:'Edge.Test.dll',
typeName: 'Edge.Test.DataConnector',
methodName: 'Invoke'
})
};
function logError(error, response){
console.log('[Error]:{' + error+'}');
response.writeHead(200, { 'Content-Type': 'text/plain'});
response.write('[Error]:' + error);
response.end("");
}
http.createServer(function(request,response){
console.log('Creating Server...');
response.writeHead(200, {'Content-Type':'text/html'});
var payload = {};
console.log('[Before][userRepository.getUsers]');
userRepository.getUsers(payload, function(error, result){
console.log('[Result][userRepository.getUsers]');
if(error){logError(error, result);return;}
if(result){
response.write("<ul>");
result.forEach(function(user){
console.log("[Response contains User]{"+user.FirstName+"|"+user.LastName+"}");
response.write("<li>" + user.FirstName + " " + user.LastName);
});
response.end("</ul>");
}
else{
response.end("No users found");
}
});
}).listen(port);
console.log("Node server listening on port: " + port);
The async connection point
public async Task<object> Invoke(object input)
{
var payload = (IDictionary<string, object>)input;
return await GetUsers();
}
public async Task<List<Data.User>> GetUsers()
{
TaskCompletionSource<List<Data.User>> source = new TaskCompletionSource<List<Data.User>>();
Task<List<Data.User>> task = source.Task;
var connector = new Data.SqlServer();
Task.Factory.StartNew(() =>
{
source.SetResult(connector.GetUsersSync());
});
return await task;
}
The ADO.NET calls
public async Task<List<User>> GetUsers()
{
List<User> users = new List<User>();
using (var connection = new SqlConnection(ConnectionString))
{
using (Command = connection.CreateCommand())
{
await connection.OpenAsync();
Command.CommandType = System.Data.CommandType.Text;
Command.CommandText = "SELECT UserId, FirstName, LastName FROM [dbo].[User]";
using (Reader = await Command.ExecuteReaderAsync())
{
while (await Reader.ReadAsync())
{
User user = new User();
user.Id = Reader[0] as int? ?? default(int?);
user.FirstName = Reader[1] as string;
user.LastName = Reader[2] as string;
users.Add(user);
}
}
}
}
return users;
}
Again, the TaskCompletionSource returns to node when I put a hard coded List in it. SQL Server returns to the WebApi Controller, but SQL Server will not return to node; I get a Stack Overflow.
"I need build Skynet. Plz send code"
modified 15-Oct-14 23:35pm.
|
|
|
|
|
...any ideas?
I was able to get the data from SQL Server marshaled back to node by using Express, but it would only execute successfully on server start up (I called the repository method directly on server start and then spooled the results to the console)
But if I try to activate the '/users' route, I get the StackOverflow exception...but it is only occurring if the CLRMethod I'm using is attached to the database. If I manually build the Task to return and stuff a list of hard coded objects in it, I have a happy path.
"I need build Skynet. Plz send code"
|
|
|
|
|
Solved. I thought there was something funny about my express route...there was no serialization of the response.
app.get('/users', function(request, response){
users.repository.getUsers({}, function(error, result){
response.json(result);
});
});
Works beautifully now.
"I need build Skynet. Plz send code"
|
|
|
|
|
For completeness' sake, I thought I'd provide some additional clarification.
Notice in the original code that I posted that in the GetUsers() method that calls the data connector, I did not await the Resolution of the promise. In fact, I didn't need to resolve that manually, so I changed the code that read like this...
var connector = new Data.SqlServer();
Task.Factory.StartNew(() =>
{
source.SetResult(connector.GetUsersSync());
});
return await task;
to instead read like:
DataConnector connector = new DataConnector();
return connector.GetUsers();
and then, to keep the async task from "completing before another async task could complete", I had to await the call to the data connector
DataConnector connector = new DataConnector();
return await connector.GetUsers();
It was really easy once I was able to spot it. I just skipped over the StartNew(() call every time I was analyzing; took way too many looks to notice that it was not executing asynchronously.
"I need build Skynet. Plz send code"
|
|
|
|
|
i am trying to deploy my program using Inno Setup 5.4.0(u).
and it don't works with dll of .net when i register Windows XP computers, it's waning error: unable to register the dll/ocx regsvr32 failed with exit code 0x4
[Files]
Source: Library\DevExpress.Data.v8.3.dll; DestDir: {sys}; Flags: ignoreversion regserver uninsneveruninstall
...
in the following files
C:\Windows\system32\DevExpress.Data.v8.3.dll
...
Inno Setup can't really use anything but regsvr32 to install a DLL or OCX, any Windows Installer. Inno Setup 5.4.0(u) not support install file dll of net ?
can you help me ?
|
|
|
|
|
Why aren't you asking this on the InnoSetup forums? This has absolutely nothing to do with C#.
|
|
|
|
|
Ask in the InnoSetup forums.
.NET .DLL's cannot be registered using REGSVR32. That only works with native COM-based .DLL's.
.NET DLL's have to be registered using REGASM, found under Start -> Microsoft Visual Studio xxxx -> Visual Studio Tools -> xxx Command Prompt.
|
|
|
|