How to save the context of a system into file for later usage? - drake

I want to save the context of a system into a file so that I can later read from the file and use this context (e.g., do some useful calculations or repeatable simulations). However, I havent' found appropriate methods to save the context into file or read the context from file. Are there any methods for this usage? Thank you for your help.

I'm afraid we don't gave that general feature yet; although it's been on the list for a long time: https://github.com/RobotLocomotion/drake/issues/5856 . As that issue says, we have an amazing new YAML serialization workflow, so it's definitely worth revisiting the idea.

Related

Azure Data Lake Store concurrency

I've been toying with Azure Data Lake Store and in the documentation Microsoft claims that the system is optimized for low-latency small writes to files. Testing it out I tried to perform a big amount of writes on parallel tasks to a single file, but this method fails in most cases returning a Bad Request. This link https://issues.apache.org/jira/secure/attachment/12445209/appendDesign3.pdf shows that HDFS isn't made to handle concurrent appends on a single file, so I tried a second time using the ConcurrentAppendAsync method found in the API, but although the method doesn't crash, my file's never modified on the store.
What you have found out is correct about how parallel writes will work. I am assuming you have already read the documentation of ConcurrentAppendAsync.
So, in your case, did you use the same file for the Webhdfs write test and the ConcurrentAppendAsync? If that's the case, then ConcurrentAppendAsync will not work, as mentioned in the documentation. But you should have got an error in that case.
In any case, let us know what happened and we can investigate further.
Thanks,
Sachin Sheth
Program Manager - Azure Data Lake

GoLang - Is there a way to profile memory usage of code that uses reflect?

I am using gocraft/web in a project and am trying to debug some high memory usage. gocraft/web uses reflection to call handlers. I've set up the net/http/pprof profiler which works very well, but the largest block of memory, and the one that I am iterested in, only shows reflect.Value.call as the function. That's not very helpful.
How can I get around the fact that gocraft/web is using reflection and dig deeper into the memory profile?
Here's an example of the profile output I am seeing:
Thanks to #thwd for filing http://golang.org/issue/11786 about this. This is a display issue in pprof. All the data is there, just being hidden. You can get the data you need by invoking pprof with the -runtime flag. It will also show data you don't need, but it should serve as a decent workaround until Go 1.6 is out.
The short answer is that you can't directly. reflect.Value.call calls reflect.call which forwards to runtime.reflectcall which is an assembly routine implemented in the runtime, for example for amd64, here. This circumvents what the profiler can see.
Your best bet is to invoke your handlers without reflection and test them like that individually.
Also, enabling the profiler to follow reflective calls would arguably be an acceptable change to propose for the next Go iteration. You should follow the change proposal process for this.
Edit: issue created.

Syncing terms with changed context via POEditor API deletes and creates the term

In the project that i'm working in we use https://poeditor.com for translating strings.
When we synchronize terms via their API (sync_terms) it seems as terms that has a new context gets deleted and then recreated with the new context. This results in deleted translations!
We use a selfbuilt tool that scans our Visual Studio solution (44 projects in total) for translation terms. As context we set the sourcecode filename, for example SettingsView.xaml, which makes the translation a bit easier. But sometimes the sourcecode files are renamed and sometimes the translation is moved to another place which causes the context to change. And this in turn deletes the translation from POEditor.
Has anyone here stumbled across this behaviour? Their API documentation says nothing about this behaviour.
The answer was quite simple. The translationkey + context is the actual key. When the context changes it also becomes a new translation. I'll now use the referencefield instead of context.

Specflow Feature File Best Practice

Thanks in advance for the help.
My question pertains to best practices inside a SpecFlow feature file?
Question:
Is using a wait command inside of the feature file considered bad practice.
Example:
And i click on the username
And wait 5 seconds
And i input new value into last name
The wait command forces a 5 second wait. I am doing this to make sure the page is loaded to prevent "element not found" errors or other errors. Basically to make sure I have a clean page to manipulate.
Would a better practice be to use a wait inside of the Step file itself?
//using Fluent Automation
I.WaitUntil(() => ());
//or
I.Wait(); //timespan
My reasoning for not using the Fluent Automation wait is:
By utilizing the Fluent Automation method you are dependent on the default timeout in the Settings object. The default timeout in some cases may not be long enough or may be to long. Seems very verbose to me to continually change/reset the Settings object with the only benefit being to remove wait commands from the feature file.
So what is really the best practice?
Thanks,
-n
I think the best practice is to keep the feature file for your scenarios, and free of the implementation details.
Since we are following a BDD process (http://dannorth.net/introducing-bdd) then the feature file is the output of that conversation between you and the process expert, and the scenario represents the steps that you are going to take to prove that your functionality works for that example. You could hope that those steps define the business process and could be performed by any system, not just the one we might be developing now. Ideally this logic captures our intent and can be reused on any future systems that might replace the current one.
So I just don't see you saying that you need to wait
....
Although you might want to say
When the page has loaded
and that maps quite nicely onto the fluent automation.

XNA Content Loading

Anybody know how i can stream load Model data in XNA 4 Content Loader ?
And not have to specify a farken filename ...
Was hoping somehow get a stream running as the model data resides on a db.
And no, im not interested in temp files :p
Regards
If you really want to use the Content Pipeline for this, you can subclass ContentManager and override OpenStream. This would assume that the built XNB files reside in the database and you can provide the stream to them when requested :)
Content.Load<Model>() requires a string parameter, so I don't think that you'll be able to stream a Model in. I should mention that the string parameter that is required is a filePath, so you wouldn't be able to convert a stream to a string and pass that in.
I believe that this should help. If I remember correctly, I can't check because I'm at work, it lets you run the content importer on a stream dynamically. So you should be able to dump your file in a MemeoryStream and load it so long as its any of the file types XNA supports.
Be warned though this is pretty slow because you have to compile every file when you load it.
Curious of why you need to load from a database. I assume its from a remote server? In which case the download time + compile time might be a bit much. since it sounds like you would have to do it every time the game is loaded.
http://create.msdn.com/en-US/education/catalog/sample/winforms_series_2

Resources