parameters

fit using lsqcurvefit

孤者浪人 提交于 2019-12-21 20:45:17
问题 I want to fit some data to a lorentz function but I figure problems with fitting when I use parameters which are of different orders of magnitude. This my lorentz function: function [ value ] = lorentz( x,x0,gamma,amp ) value = amp * gamma^2 ./ ((x-x0).^2 + gamma^2); end Now the script to generate sample data: x = linspace(2e14,6e14,200); x0 = 4.525e14; gamma = 0.5e14; amp = 2e-14; y = lorentz(x,x0,gamma,amp); And the script for fitting lorentz to the sample data: params = [4.475e14;0.4e14;1

Android: SQLite Query not binding integer parameters?

跟風遠走 提交于 2019-12-21 19:49:31
问题 I have problems when making queries with parameters to DB on Android platform (2.2). I have created table like this: db.execSQL("CREATE VIRTUAL TABLE " + Msg._TABLE_NAME + " USING FTS3 (" + Msg._ID + " INTEGER, " (...) + Msg.READ + " SHORT DEFAULT 0," + Msg.URGENT + " SHORT DEFAULT 0" + ");"); Then I am trying to query this using parametrized query: String[] columns = new String[] {Msg.ROWID, Msg.TITLE, Msg.READ, Msg.URGENT}; (...) getContentResolver().query(Msg.CONTENT_URI, columns, Msg

Routing Zend Framework 2 Language in url

纵饮孤独 提交于 2019-12-21 17:23:42
问题 For my application translation I would like to use a language structure e.g.: site.com (english) site.com/de/ (german) site.com/fr/ (france) site.com/nl/ (dutch) etc.. I can do this easily with the router option in Literal as '[a-z]{2}' but I want to exclude languages I do not support, e.g. site.com/it/ if it is not supported I want a 404. I tried to fix this with regex (adding supported languages) but something (I do not know) went wrong. Thanks in advance! 'router' => array( 'routes' =>

Pass parameter to GWT bootstrap .nocache.js script

允我心安 提交于 2019-12-21 16:59:18
问题 Is there any way to pass parameters to the .nocache.js script file generated by GWT and evaluate them in the onModuleLoad function? Like so: <script type="text/javascript" src="application/Application.nocache.js?appId=461333815262909"></script> The host page URL should be completely separated from the GWT stuff working inside, so passing the appId parameter as a query parameter for the host page and accessing it with Window.Location.getParameter is not an option. I know that I could hide such

NSURL's parameterString confusion with use of ';' vs '&'

守給你的承諾、 提交于 2019-12-21 12:58:55
问题 I'd like to use -[NSURL parameterString] to parse out the parameters of a URL I've been passed. It says URL must conform to RFC 1808 but now wondering if ours do?!? We use something like: http://server/path/query?property1=value1&property2=value2 but RFC 1808 never mentions the ampersand ( & ) as a valid parameter separator (at least the way I read it). It suggests the semicolon ( ; ). Perhaps because it was drafted in 1995? Has the & replaced the ; ? If so anyone verify if NSURL's

Proper way to include data with an HTTP PATCH request

早过忘川 提交于 2019-12-21 11:33:13
问题 When I'm putting together an HTTP PATCH request, what are my options to include data outside of URL parameters? Will any of the following work, and what's the most common choice? multipart/form-data application/x-www-form-urlencoded Raw JSON ...any others? 回答1: There are no restrictions on the entity bodies of HTTP PATCH requests as defined in RFC 5789. So in theory, your options in this area are unlimited. In my opinion the only sensible choice is to use the same Content-Type used to

How to implement property() with dynamic name (in python)

懵懂的女人 提交于 2019-12-21 09:16:23
问题 I am programming a simulations for single neurons. Therefore I have to handle a lot of Parameters. Now the Idea is that I have two classes, one for a SingleParameter and a Collection of parameters. I use property() to access the parameter value easy and to make the code more readable. This works perfect for a sinlge parameter but I don't know how to implement it for the collection as I want to name the property in Collection after the SingleParameter. Here an example: class SingleParameter

What is the best way to check the parameters of the method?

☆樱花仙子☆ 提交于 2019-12-21 09:15:46
问题 I know two ways to check parameters of the method and throw exceptions when it is needed. 1) Check one each parameter and throw an exception when it is wrong: public void Method(object parameter1, object parameter2) { if (parameter1 == null) { throw new ArgumentNullException("parameter1"); } if (parameter2 == null) { throw new ArgumentNullException("parameter2"); } ... } 2) Check all parameters at once and throw same exception for all: public void Method(object parameter1, object parameter2)

C++14 using auto keyword in a method's definition

安稳与你 提交于 2019-12-21 07:29:26
问题 I have several std::unordered_maps . They all have an std::string as their key and their data differs. I want to make a csv string from a given map's keys because that data needs to be sent over the wire to a connected client. At the moment I have a method for each individual map. I wanted to make this generic and I came up with the following : std::string myClass::getCollection(auto& myMap) { std::vector <std::string> tmpVec; for ( auto& elem : myMap) { tmpVec.push_back(elem.first); } std:

Limit number of parameters per method?

萝らか妹 提交于 2019-12-21 07:23:20
问题 Assuming the parameters are all the same type, is there a rule of thumb in regards to the number of parameters for a method? Im just wondering where I should draw the line and what my alternatives are (ie interface, array, etc). 回答1: I would say it really depends on your case. Are you doing something to the entire set? Validating all the items or aggregating data, for example? In that case, I would pass in an IEnumerable as a single parameter. Passing in a lot of parameters can be a good sign