I try to use libgit2sharp.Patch to find how much line added or deleted, but i got an error while i try to run it. When i run my asp.net mvc project in debug mode, it doesn't have any problem, until i run it without debug mode, i got my web load too long and didn't show the page. When i run in debug mode again, finally an error appear from libgit2sharp.Patch variable with error message system.outofmemory. This is how i implement libgit2sharp.Patch
Patch treePatchInfo = repo.Diff.Compare<Patch>(firstTree, compareTree, null, compareOptions: compareOptions);
commitChangeValue = from s in treeChangeInfo
let patch = treePatchInfo[s.Path]
select new CommitChangeModel
{
ChangeKind = s.Status,
LinesAdded = patch.LinesAdded,
LinesDeleted = patch.LinesDeleted,
OldPath = s.Path,
Patch = patch.Patch,
Path = s.Path
};
If you're only interested in number of additions/removal per file, I'd suggest you to rather rely on the following construct would be more efficient.
var stats = repo.Diff.Compare<PatchStats>(...);
You can take a peek at PR #660 where it's been introduced to get a first grasp of its usage.
Note: Regarding the OOM Exception, we'd very interested in getting more information about it. Would you be so kind as to open an issue in the bug tracker so that we can get a deeper look at it?
Related
I am following this example, but my test fails, since workInfo.state is RUNNING instead of ENQUEUED. Does anyone know what might be the issue? Please let me know if I should provide more code/context.
I have no idea why, but adding constraints to the request resolved the issue. It did not matter what constraints I set, it succeeded anyhow. That is, the test passed both with NetworkType.METERED and NetworkType.UNMETERED
val constraints = Constraints.Builder().setRequiredNetworkType(NetworkType.METERED).build()
val request = PeriodicWorkRequestBuilder<EchoWorker>(15, MINUTES)
.setInputData(input)
.setConstraints(constraints) // added this line
.build()
I have used the code below:
Iterable<Module> modules = ImmutableSet.<Module> of(
new SshjSshClientModule());
ContextBuilder builder = ContextBuilder.newBuilder(provider).endpoint(endpoint)
.credentials(identity, credential)
.modules(modules);
System.out.printf(">> initializing %s%n", builder.getApiMetadata());
ComputeService compute = builder.buildView(ComputeServiceContext.class).getComputeService();
System.out.println(compute1.listImages());
but I am getting the following error message.........
com.google.gson.JsonSyntaxException: java.lang.IllegalStateException: Expected a string but was BEGIN_ARRAY at line 1 column 787
at org.jclouds.json.internal.DeserializationConstructorAndReflectiveTypeAdapterFactory$DeserializeIntoParameterizedConstructor.read(DeserializationConstructorAndReflectiveTypeAdapterFactory.java:181)
at org.jclouds.json.internal.NullFilteringTypeAdapterFactories$IterableTypeAdapter.readAndBuild(NullFilteringTypeAdapterFactories.java:92)
The code was working... before...
You've definitely hit a bug somewhere between the version of jclouds you're using and whatever version of whatever cloud you're using. We'll need more information to fix this. Please go through the instruction on how to Report a Bug to Apache jclouds.
I am connecting remotely to MQ on the server and i installed MQ client v6.0 on my machine.
I am able to put the message into the queue but i am unable to get the message from the same queue the output is "RC2033: MQRC_NO_MSG_AVAILABLE"
Can anyone please help me to find the issue?
Will this be due to properties of the queue?
The following is the code which i am using to pop the message :
Pop Message:
queue = mqQMgr.AccessQueue("queue_name", MQC.MQOO_FAIL_IF_QUIESCING + MQC.MQOO_INPUT_SHARED);
MQMessage queueMessage = new MQMessage();
queueMessage.Format = MQC.MQFMT_STRING;
MQGetMessageOptions queueGetMessageOptions = new MQGetMessageOptions();
queueGetMessageOptions.Options = MQC.MQGMO_WAIT;
queueGetMessageOptions.MatchOptions = MQC.MQMO_NONE;
queueGetMessageOptions.WaitInterval = 1000;
queue.Get(queueMessage, queueGetMessageOptions);
tbPoptxt.Text = "Message No" + count + ":" + queueMessage.ReadString(queueMessage.MessageLength);
PUSH CODE
int optons = MQC.MQOO_OUTPUT + MQC.MQOO_FAIL_IF_QUIESCING;//Queue which opens with options output
queue = mqQMgr.AccessQueue("queue_name", optons);
MQMessage queueMessage = new MQMessage();
queueMessage.WriteString(tbPushtxt.Text.ToString());
queueMessage.Format = MQC.MQFMT_STRING;
MQPutMessageOptions queuePutMessageOptions = new MQPutMessageOptions();
queuePutMessageOptions.Options = MQC.MQGMO_SYNCPOINT | MQC.MQGMO_FAIL_IF_QUIESCING;
queue.Put(queueMessage, queuePutMessageOptions);
mqQMgr.Commit();
I am using same queue for putting a message and poping a message
Look in the samples directory for the nmqsput and nmqsget c# examples - these do exactly what you are after and are good working examples.
Looking at the code above, I do not think there is a problem getting the message, followed up by your comment that amqsputc failed to find a message as well. I think the problem is on the putting side.
This may sound a silly question, but how do you know the message is there. What is the curdepth after the put? Look at the queue status - are there any uncommitted messages? (One thing I've seen before is putting under a unit of work (syncpoint) and then not committing and then another application trying to get it.
So, I'm using the HTTPConnection Class, like so:
HttpConnection c =
(HttpConnection)Connector.open("http://147.117.66.165:8000/eggs.3gp");
Following what LOOKS like the right way to do things in the Blackberry JDE API.
However, my code crashes if I try to do just about anything with the variable 'c'.
.getType()
.getInputStream()
.getStatus()
all cause it to crash.
I can, however get the URL from it, and I can look at the variable 'c' itself to know that it did, in fact, get created.
Did I manage to create a broken Connection? Do I need to do something else to actually do things with the connection? Under what circumanstances will this happen (I know the link is good, I can use the blackberry's browser to visit it).
Am I just using HttpConnection wrong? How would I do things correctly?
What error is it throwing when it crashes? You may want to try adding the "Connector.READ_WRITE" as a second argument to your open call - even if it's just a "read only" connection like a GET, some OSes such as 4.6 will throw an exception unless you open it in read/write mode.
I figured out what was wrong by finding some sample code that was using HttpConnection, (at least, I think I did, at least, I can access all those variables, now). Before, I wasn't ever casting it as a "Stream Connection" (the examples I saw had it cast from Connector to HTTPConnection).
StreamConnection s = null;
s = (StreamConnection)Connector.open("http://10.252.9.15/eggs.3gp");
HttpConnection c = (HttpConnection)s;
InputStream i = c.openInputStream();
System.out.println("~~~~~I have a connection?~~~~~~" + c);
System.out.println("~~~~~I have a URL?~~~~" + c.getURL());
System.out.println("~~~~~I have a type?~~~~" + c.getType());
System.out.println("~~~~~I have a status?~~~~~~" + c.getResponseCode());
System.out.println("~~~~~I have a stream?~~~~~~" + i);
player = Manager.createPlayer(i, c.getType());
Even though the stream is now successfully being created, I'm still having problems USING it, but that might be because my connection is so slow.
The API documentation for HttpConnection suggests the first call should be to c.getResponseCode(), try that.
You should find everything you need in my blog post "An HttpRequest and HttpResponse library for BB OS5+"
And for invoking media within your application you can do either a browser invokation or directly from app. You would probably be best to use the browser like so:
BrowserSession invokeHighQuality = Browser.getDefaultSession();
invokeHighQuality.displayPage("URL goes here");
OR you can try this:
// CHAPI invocation
Invocation invoke = new Invocation(_data.getUrl(), null, BlackBerryContentHandler.ID_MEDIA_CONTENT_HANDLER, false,
null);
try {
Registry.getRegistry(YourAppClass.class.getName()).invoke(invoke);
} catch (Throwable t) {
}
I have an ASP.NET site (VB.NET) that I'm trying to clean up. When it was originally created it was written with no error handling, and I'm trying to add it in to improve the User Experience.
Try
If Not String.IsNullOrEmpty(strMfgName) And Not String.IsNullOrEmpty(strSortType) Then
If Integer.TryParse(Request.QueryString("CategoryID"), i) And String.IsNullOrEmpty(Request.QueryString("CategoryID"))
MyDataGrid.DataSource = ProductCategoryDB.GetMfgItems(strMfgName, strSortType, i)
Else
MyDataGrid.DataSource = ProductCategoryDB.GetMfgItems(strMfgName, strSortType)
End If
MyDataGrid.DataBind()
If CType(MyDataGrid.DataSource, DataSet).Tables("Data").Rows.Count > 0 Then
lblCatName.Text = CType(MyDataGrid.DataSource, DataSet).Tables("Data").Rows(0).Item("mfgName")
End If
If MyDataGrid.Items.Count < 2 Then
cboSortTypes.Visible = False
table_search.Visible = False
End If
If MyDataGrid.PageCount < 2 Then
MyDataGrid.PagerStyle.Visible = False
End If
Else
lblCatName.Text &= "<br /><span style=""fontf-size: 12px;"">There are no items for this manufacturer</span>"
MyDataGrid.Visible = False
table_search.Visible = False
End If
Catch
lblCatName.Text &= "<br /><span style=""font-size: 12px;"">There are no items for this manufacturer</span>"
MyDataGrid.Visible = False
table_search.Visible = False
End Try
Now, this is trying to avoid generating a 500 error by catching exceptions. There can be three items on the query string, but only two matter here. In my test environment and in Visual Studio when I run this site, it doesn't matter if that item is on the query string. In production, it does matter. If that third item isn't present (SubCategoryID) on the query string, then the "There are no items for this manufacturer" displays instead of the data from the database.
In the two different environments I am seeing two different code execution paths, despite the same URLs and the same code base.
The site is running on Server 2003 with IIS 6.
Thoughts?
EDIT:
In response to the answer below, I doubt it's a connection error (though I see what you're getting to), as when I add the SubCategoryID to the query string, the site works correctly (displaying data from the database).
Also, if please let me know if you have any suggestions for how to test this scenario, without deploying the code back to production (it's been rolled back).
I think you should try to print out the exception details in your catch block to see what the problem is. It could anything for example a connection error to your database.
The error could be anything, and you should definitely consider printing this out or logging it somewhere, rather than making the assumption that there's no data. You're also outputting the same error message to the UI for two different code paths, which makes things harder to debug, especially without knowing if an exception occurred, and if so, what it was.
Generally, it's also better not to have a catch for all exceptions in cases like this, especially without logging the error. Instead, you should catch specific exceptions and handle these appropriately, and any real exceptions can get passed up the stack, ideally to a global error handler which can log it and/or send out some kind of error notification.
I discovered the reason yesterday. In short it was because when I copied my files from my computer into my dev-test environment, I missed a file, which ironically caused it to work, rather than not. So in the end it would have functioned the same in both environments.