[CodeEval][GO] CodeEval Error: Process was aborted due to timeout - go

I was trying to submit my solution of https://www.codeeval.com/open_challenges/158/ it's a bubble sort. I code in GO lang and on my PC it runs fine and fast! I tried utilize code example of go's input and I tried my own piece of code too.
Anyone can help me ? I tried change the code in somehow, but nothing worked.
Thanks in advance.

There's a certain edge case you are probably missing in your code. See https://getsatisfaction.com/codeeval/topics/bubble-sort-iterations-are-too-high-causing-solution-to-be-aborted-in-java

Related

Is it possible that Revise outputs something when compilation is over and coding NFS?

I am using Revise with NFS on my lab servers.
Currently, to know if my code has been compiled, I have a test function t()=2 and when I have finished to code, I change to some other insignificant value t()=3.
I then type:
julia> t()
3
If the value is 3 then my code has finished to compile, otherwise, it is 2 and Revise hasn't finished to compile.
You see this is quite inconvenient and I would like to know whether there is a way for Revise to tell me when it is done? Maybe printing something in the Julia console?
In C/C++, you know exactly when the code has finished to produce, for instance an executable a.out.
Revise should block until it is done recompiling. So if you have a new prompt, it should be ready.
Even if it is not really a solution and rather a workaround. I just found a way to avoid coding on NFS as I finally find Revise very suitable for coding locally and also not convenient at all for coding NFS.

How to implement time in Pari/GP

I have Pari/GP 32-bit and would like to implement any type of code which runs for a limited amount of time, then automatically stops if nothing is produced by that time. Here is a pseudocode example:
command
...
run command
if run time over 3 minutes
automatically interrupt the program and stop running
I know there is a basic way to do this, I just never found it in the PARI/GP guide. Any help? Thanks.
alarm(5);for(i=1,10^10,continue)

Visual-Studio, Database save error "There was an error parsing the query. [ Token line number = 1,Token line offset = 13,Token in error = , ]"

OK so I recently started getting into programming simple programs and I have taught myself everything using guides on the internet thus far and I have been doing really well and things have been working great, until now. So i feel that I have done a lot, A LOT of searching on this question and I cant seem to find an answer or even anyone else out there that is having the same problem as me. Im going to try to make this as simple as possible so here it goes.
I have made a program in visual studio that is simply supposed to allow me to make entries in fields such as first name, last name, and so on. It works like a charm and saves data like normal, I can close out and re open it and the data is there. BUT
While messing with the program and trying to test it I found that if I DELETED a row of data that i had previously inserted then added ANY new data then clicked the SAVE button it would crash every single time.
First it would say there is no proper delete command. So i gave it one, and it stopped giving me that error message. Then it said it was the update command. So i gave it one then that stopped showing up. But now it gives me the error message. "There was an error parsing the query. [ Token line number = 1,Token line offset = 13,Token in error = , ]. And it gives me this error every time i try to save after following the above steps. And I honestly dont know what to make of it.
I know im going to need to post a sample of my code that I have but I dont know what part of it to post so I figured I would wait and see so I dont post 1,500+ lines on here.
This is the only thing preventing my program from working correctly and if I wouldnt ask if I wasnt completely stumped. And im roughly 300% stumped. So any help would be greatly appreciated.

MOSEK C api time limit

I'm trying to find a way to limit the time of execution of MSK_optimize routine. However, browsing through MOSEK docs gives me nothing. I have tried with:
MSK_putnaintparam( task, "MSK_DPAR_OPTIMIZER_MAX_TIME", 1 );
and playing with the value on the right, but this does not seem to solve the problem and looks like it does not even affect MOSEK. Setting MSK_DPAR_MIO_MAX_TIME manually is not possible. Other than that, I have found nothing that can influence maximum time MOSEK will run. Any help appreciated.
The function MSK_putnaintparam( task, "MSK_DPAR_OPTIMIZER_MAX_TIME", 1 ); would have returned a proper error code. So if you did not ignore those you would have discovered your mistake.
For anyone that could find this helpful:
The problem is that MSK_DPAR_OPTIMIZER_MAX_TIME is a double and not an integer parameter. After losing a whole day on this, I finally found that putting:
MSK_putnadouparam( task, "MSK_DPAR_OPTIMIZER_MAX_TIME", 1 );
does the trick.

The bizarre case of the file that both is and isn’t there

In .Net 3.5, I have the following code.
If File.Exists(sFilePath & IndexFileName & ".NX") Then
Kill(sFilePath & IndexFileName & ".NX")
End If
At runtime, on one client's machine, I get the following exception, over and over, when this code executes
Source: Microsoft.VisualBasic
TargetSite: Microsoft.VisualBasic.FileSystem.Kill
Message: No files found matching 'I:\RPG\HGIAPVXD.NX'.
StackTrace:
at Microsoft.VisualBasic.FileSystem.Kill(String PathName)
(More trace that identifies the exact line of code.)
There are two people on different machines running this code, but only one of them is getting the exception. The exception does not happen every time, but it is happening regularly. (Multiple times every hour.) The code is not in a loop, nor does it run continuously, more like once every couple of minutes or so.
On the surface, this looks like a race condition, but given how infrequently this code is run and how often the error is happening I think there must be something else going on.
I would appreciate any suggestions on how I can track down what is really going on here. A solution to keep the error from happening would be even better.
I guess the first question to ask is "IS the file really there or not?" and if so, does it have any specical attributes (Is it Read-only or Hidden, or System --- or a Directory)?
Note the Microsoft.VisualBasic.FileSystem.Kill specifically looks for, and silently skips, any file marked "System" or "Hidden". For pretty much any other problem you would have gotten a different exception.
as James pointed out the Kill functions checks if the file in case is a system or hidden, you better use System.IO.File.Delete() instead
Try
System.IO.File.Delete(sFilePath & IndexFileName & ".NX")
Catch ex As System.Exception
...
End Try
using File.Exits is not neccasary because File.Delete() checks this by itself.
Is there any chance that the I: drive is a network drive? it could be some network issue... or then maybe a race condition

Resources