StackID Api issue - asp.net-mvc-3

I downloaded the StackID api from the following link http://code.google.com/p/stackid/source/checkout
I followed the instructions in the readme file but am still encountering an exception.
The site crashes on this line in the Current.cs file
private static string SiteWideSalt { get { return KeyStore.GetKey(KeyStore.LatestKeyVersion).Salt; } }
The error I'm receiving is:
The type initializer for 'OpenIdProvider.Helpers.KeyStore' threw an exception.
{"Error converting value 1 to type 'OpenIdProvider.Helpers.KeyStore+Key'."} <--this is what's in the inner exception, which to me doesn't make sense since the property for value is byte and last I checked this should work with the number 1.
Any help would be appreciated, thanks!

I also had some issues there.
After putting the content of the key-gen file in square brackets "[]" to make it a JSON array I had to restart IIS and it works fine now.

Related

Why do I get error when trying to add file attachments?

I am trying to use the method addFileAttachmentAsync() in office.js library.
This is the signature of the method I am using:
item.addFileAttachmentAsync(uploadLink, fileJson.name, { asyncContext: null }, function (asyncResult) { });
uploadLink is a string and here is an example of a file I'm trying to upload: https://xdr.purequad.com:6443/files/1b783908-a259-4839-93e2-18fe3248b943_moto.pdf.xdr
The file above is about ~3MB, but when I use a file under 1MB everything works perfectly.
Afterwards it throws this Exception :
Line: 9
Error: Unable to get property 'isInstanceOfType' of undefined or null reference
Also I have to mention this behavior happens only in IE11, while Google Chrome does not throw any exception at all and still does not work.
EDIT: The function was being interrupted before it ended properly! Check my comment.
I have solved the issue myself. When using addFileAttachmentAsync() because it's an async call one should never interrupt the task-pane with Office.context.ui.closeContainer() which was my case. Otherwise it will generate unexpected behavior.

Rest camel passing objects between endpoints

Overview.
My camel setup calls two service methods. the response of the first one is passed into the second one and then output the final response as json webpage. Fairly simple nothing too complicated.
Further breakdown to give some more context.
Method_1. Takes in scanId. This works ok. It produces an object called ScheduledScan .class
Method_2. Takes in object previous instance of ScheduledScan .class and returns a list of ConvertedScans scans. Then would like to display said list
Description of the code
#Override
public void configure() throws Exception {
restConfiguration().bindingMode(RestBindingMode.json);
rest("/publish")
.get("/scheduled-scan/{scanId}")
.to("bean:SentinelImportService?method=getScheduledScan").outType(ScheduledScan .class)
.to("bean:SentinelImportService?method=convertScheduledScan");
}
The methods that are called look like the following
ScheduledScan getScheduledScan(#Header("scanId") long scanId);
List<ConvertedScans > convertScheduledScan(#Body ScheduledScan scheduledScans);
It is returning the the following error
No body available of type: path. .ScheduledScan but has value:
of type: java.lang.String on: HttpMessage#0x63c2fd04. Caused by: No type converter available
The following runs without the error, i.e. without method 2. So I think im almost there.
rest("/publish")
.get("/scheduled-scan/{scanId}")
.to("bean:SentinelImportService?method=getScheduledScan");
Now from reading the error it looks like im passing in a HttpMessage not the java object? I'm a bit confused about what to do next? Any advice much appreciated.
I have found some similar questions to this message. However I am looking to pass the java object directly into the service method.
camel-rest-bean-chaining
how-to-share-an-object-between-methods-on-different-camel-routes
You should setup the outType as the last output, eg what the REST response is, that is a List/Array and not a single pojo. So use .outTypeList(ConvertedScans.class) instead.

Why is the (PyQt5) QWidget not being added to the QBoxLayout

Right so essentially I am creating a user interface and have attempted to add a QtWidgets.QLineEdit to a QVBoxLayout as well as a QtWidgets.QLabel to a different QVBoxLayout. Unfortunately it is not working and throwing up an error:
in build_gui_adddata_device
self.labellayout.addWidget(self.labelsupplierid)
TypeError: QBoxLayout.addwidget(QWidget; int stretch=0, Qt.Alignment alignment=0): first argument of unbound = method must have type QBoxLayout
I have defined labellayout as thus:
print("e")
self.labellayout = QtWidgets.QVBoxLayout
"e" was printed, which is how I know that there is no issue with the definition of the layout itself.
Just for reference this is the QtWidget I was trying to add:
print("f")
self.labelsupplierid = QtWidgets.QLabel("Supplier ID: ")
Again "f" was printed
This is the line that is causing the problem:
print("i")
self.labellayout.addWidget(self.labelsupplierid)
I don't understand why my code isn't working, I am honestly perplexed. My syntax seems to be correct and I have made other build_gui functions that have executed exactly the same type of code (with different widgets, might I add) that have been successful.
Please can someone enlighten me. Many Thanks.

Splunk-client (with Nokogiri) giving Undefined Namespace Prefix

I'm using splunk-client to extract results from splunk. Here's the code:
query = "sourcetype=collection #{order_id}"
search = #splunk_client.search(query)
search.wait
The search is happening fine, and it seems like I'm doing everything according to the example (https://github.com/cbrito/splunk-client), but I get this error on the 'search.wait' line:
Undefined namespace prefix: //s:key[#name='isDone']
Any ideas what could be going wrong? Running these commands in irb works fine. Is there some sort of blocking issue?
There is currently very little error checking which occurs within the gem itself. The reason for the error is that wait looks for the status of the isDone key to change to true.
Since your credentials were not properly setup in the first place, the gem creates a search object with an invalid session. The search does not initially fail, because enough response came back from Splunk that Nokogiri processes it into an object without a Splunk search sid.
In the future I should likely raise an exception if a proper sid is not returned to avoid confusion.
Source: I wrote the gem.
I found out the issue -- the splunk client wasn't authenticating properly, and so search was actually a broken SplunkJob object (with a nil username and authentication key). It's strange that there was no error raised until the wait command, but upon inspecting the search object, one of the fields stated that the object was malformed.

A null reference or invalid value was found [GDI+ status: InvalidParameter]

I am running an MVC3 app on Mono/linux and everything is working fine with the exception of an image upload utility. Whenever an image upload is attempted i get the Invalid Parameter error from within the method below:
System.Drawing.GDIPlus.CheckStatus(status As Status) (unknown file): N 00339
System.Drawing.Bitmap.SetResolution(xDpi As Single, yDpi As Single)
I've googled this error extensively and have found that the Invalid parameter error can often be misleading, and could fire if for example there was an error with the upload itself, or if the image was not fully read. This runs fine on IIS/Windows, but I've not been able to get it to work in Mono.
Apache2
Mono 2.10.8.1
Am i missing something simple or do i need to find a different way to handle image manipulation for mono?
After doing quite a bit of testing, I was able to determine the root of my error. I was attempting to use the Image.HorizontalResolution and Image.VerticalResolution properties for Bitmap.Resolution . While these properties were set on the initial upload (where the file is read into a stream from the tmp directory), when i posted back with the base64 encoded string of the image itself, it appears these values were lost somehow. Because of this the SetResolution method failed.
For whatever reason i do not have this issue on IIS/Windows, the properties exist in both circumstances.
I encountered a similar issue. A Bitmap loaded from disk, reported bmp.HorizontalResolution==0 and bmp.VerticalResolution==0 when they were both==300. This behaviour does not occur on Windows.
A bit more digging, I found that the following test fails:
[Test]
public void GDI_SetResoltion()
{
var b1 = new Bitmap (100, 100);
Assert.That (b1.HorizontalResolution, Is.Not.EqualTo (0));
Assert.That (b1.VerticalResolution, Is.Not.EqualTo (0));
}
I believe Windows will default resolution to 96 dpi.

Resources