|
Try something and if you face issues with your code, kindly post your code here.
No one is going to write a program for you.
|
|
|
|
|
oh I am sorry! I only speak English..
You can try http://translate.google.com[^] if you didn't understand my post
My post was how to do it NOT PLEASE WRITE A CODE FOR ME!!
Hope it's clear now...
|
|
|
|
|
This really should have been posted in the database forum because it's really about the retrieval of the data. If I were you (and this is a big hint on how to get the data into one row), I would read the links on this[^] page, paying particular attention to the Pivot section. Just saying, that's all.
|
|
|
|
|
I understand that it is possible for a link in MS Excel to open another MS Excel using OpenXML SDK. Need to create Hyperlinks object and append it to Worksheet object. Now would like to know how we can manage authentication of the new document that is opened.
For Example: In web application, say one doc is already downloaded from server to browser, and user clicks on a link in that document which connects to another doc in the server.
How this clicking on link request will be authenticated? Will that be taken care by browser or should we create a new session cookie for that and authenticate? In OpenXML is there anyway if this can be managed easily without the end user knowing how this takes place.
Please share your thoughts on the request. Thanks alot for your help!
Regards, Rijesh
|
|
|
|
|
|
thanks, I have moved the post to the .Net discussion board..
|
|
|
|
|
I am in the the process of building an iphone app that would access MSSQL database through a RESTful WCF. At the heart of my iphone app, customer will plug their info, take a pic, maybe audio file and small txt file along with some other simple info to update database. I was thinking, I would bundle all that up in some object and post it via HTTP into WCF, which then updates the db.
I have some doubts about this as WCF expects One Stream parameter, and nothing else along in same method, So Stream parameter can't be part of the object.
I would like to deal with JSON. Does anyone have an idea of what's the best way to do this? Note, I am able to post txt file, Stream Image file as seperate methods at the moment. I am hoping to bundle that up and make one post request to get that done.
Thanks
|
|
|
|
|
This does not appear to be anything to do with C#; perhaps you would be better posting in the WCF, Mobile or Collaboration forums.
|
|
|
|
|
I posted this on WCF. How do I remove this out of here?
|
|
|
|
|
You cannot remove it, but you can edit the original (and add the word "Solved" to the title) and mention that it has been moved.
|
|
|
|
|
Hello,
I'm having a problem where an exception is thrown while trying to download files, using the Tamir.SharpSSH library, if the files don't exist. It's expected behavior, however, after the exception is thrown I'm unable to close the connection because I lose scope. I'm sure there is a simple solution. I would appreciate any help. The code is currently...
try
{
Sftp sftp = new Sftp(sftpServer, sftpUserName);
sftp.Password = sftpPassword;
sftp.OnTransferProgress += new FileTransferEvent(sftp_OnTransferProgress);
sftp.OnTransferStart += new FileTransferEvent(sftp_OnTransferStart);
sftp.Connect(22);
if (sftp.Connected)
{
DateTime now = DateTime.Now;
string year = now.Year.ToString();
string month = now.Month.ToString();
if (month.Length < 2) { month = "0" + month; }
Log("Attempting to download all files from todalton directory for the current month");
sftp.Get("balance//todalton//daltonAutoload" + year + month + "*", @"C:\higherone\");
Log("Transfer Complete");
}
}
catch (Tamir.SharpSsh.jsch.SftpException)
{
Log("No files of the given criteria exist on the server.\r\n\t\tDownload aborted."
+ "\r\n\t :NOTE: If this is the first run of the month, this is the expected behavior.");
}
catch (Exception ex)
{
Log(ex.Message + " :NOTE: sftp connection failed during download");
}
finally
{
sftp.Close();
}
I can't reach the Close method from within finally or either catch. Originally the close was where it is commented. Obviously the exception causes that line to be missed though.
Thanks
|
|
|
|
|
I can't see how your code even compiles. You declare sftp inside your try block, which is means that it shouldn't be available in your finally block. This leads me to think that you have declared a member called sftp as well.
|
|
|
|
|
The obvious solution is to give sftp a wider scope, maybe like so:
Sftp sftp;
try {
sftp=new Sftp(...);
...
} catch (...) {
...
} finally {
if (sftp!=null) sftp.Close();
}
The better approach, if the class implements IDisposable() and relying on the assumption that a call to Dispose() also closes the connection, would be based on the using statement:
try {
using(Sftp sftp=new Sftp(...)) {
...
}
} catch(...) {
...
}
Now in whatever way you leave the using block (short of killing the process!) sftp.Dispose() will be called automatically, even when an exception gets thrown.
|
|
|
|
|
Don't think you have added compiled code, declare sftp outside, you get correct output
|
|
|
|
|
Thank you all. That was the problem. I created it outside of my try and it's good. DOH, right?
|
|
|
|
|
|
[7 years later]
The shame
|
|
|
|
|
Hello,
does anyone know where I can find the function which maps the pixel coordinates from the source to the destination?
I draw a (stretched) bitmap using
InterpolationMode.NearestNeighbor
and
PixelOffsetMode.Half
onto a canvas and now want to know which pixel was mapped to a certain position - so that if I click with the mouse on that stretched pixel, I get the original coordinates.
Thank you in advance!
Alex
modified 27-Jun-12 9:12am.
|
|
|
|
|
(this gibberish sentence has been necessary to get the message accepted by CP as it "appears to have already been posted")
No I've never seen that function being available. However there are two simple solutions for what you seem to want:
1.
the interpolation is quite simple, it basically is a linear re-scaling, something like:
xNew = x * scaleNew / scaleOld
and then the options determine the petty details.
For one you need a floating point operation, and the result needs turned into an int again; that is where NearestNeighbor comes in (it basically means regular rounding: less than 0.5 becomes 0; 0.5 or more becomes 1). And PixelOffsetMode.Half means 0.5 is added anyways, so I would give this a try:
xNew = floor (*(x+0.5) * floatScaleNew / floatScaleOld)+0.5)
Caveat: one has to be careful with negative values, so when you run some tests, include both positive and negative values (unless negatives are irrelevant to your app).
2.
As a big alternative you could simply use the function they use without having direct access to it; this is how it works:
make a synthetic image, width=your original width, height=1; fill it with a wedge, i.e. the values 0, 1, 2, 3... etc. if it is a gray image; or perhalps (0,0,0), (1,1,1), (2,2,2), (3,3,3) if you prefer a regular RGB image (you may need a modulo-256 then).
now let the system apply your scaling to it (in x direction), yielding a larger image with the same width as your actual scaled image. When you click the actual scaled image, use the mouse position and look into the scaled synthetic image; it will return a pixel value which equals the original x coordinate (or at least the lowest 8-bits of it if your synthetic is RGB).
You can use the same trick in the other direction of course (i.e. there is no need to have a 2-D synthetic image).
modified 27-Jun-12 15:58pm.
|
|
|
|
|
Thank you for your answer.
At the moment, I use a formula similar to your first aproach where I get an error of up to +/- 1 pixel - it may be enough for the moment...
Your second aproach is clever. Perhaps I will try it later (using an invisible bitmap filled with the index as rgba value ...).
Alex
|
|
|
|
|
I am trying to add local group to adam group and it throws an exception Quote: "Only domain Principal objects can be inserted into groups in this store."
This is the code, groups are GroupPrincipal instances from System.DirectoryServices.AccountManagement
adamGroup.Members.Add(machineGroup);
adamGroup.Save();
It works when trying to add domain group in adam group and adam group to adam group
Only local groups have this problem
|
|
|
|
|
Don't post in Quick Answers[^] _and_ here. Pick one and stick to it.
Ciao,
luker
|
|
|
|
|
I have a problem, i have text stored in xml file formatting like this:
<sentence>
<token tag='man'>
John
</token>
<token>
is
</token>
<token>
a doctor
</token>
</sentence>
<sentence>
<token tag='man'>
He
</token>
<token>
has
</token>
<token>
a wife
</token>
</sentence>
....
I want to show this text for User(on a TextBox, a Panel,...) ,and tokens which have tag='man'(in this case:John,He ) have different color from the rest ,plus, they can be Clicked (to show extra information,etc) .It appears that in ToolBox there is not such a tool could do this .So I don't know how to solve it, does anybody have any suggestions ??Thanks for reading this!
|
|
|
|
|
Either use a RichTextBox and have some complicated code to catch it when the user clicks an embedded hyperlink, or add a label for each word to a panel and hook up their click-events.
Bastard Programmer from Hell
|
|
|
|
|
Thanks for advice, Eddy, I'm not a programmer yet, just a student getting stuck with this problem
|
|
|
|