Search Results

Search found 7294 results on 292 pages for 'parameters'.

Page 14/292 | < Previous Page | 10 11 12 13 14 15 16 17 18 19 20 21  | Next Page >

  • Inheritance of TCollectionItem

    - by JamesB
    I'm planning to have collection of items stored in a TCollection. Each item will derive from TBaseItem which in turn derives from TCollectionItem, With this in mind the Collection will return TBaseItem when an item is requested. Now each TBaseItem will have a Calculate function, in the the TBaseItem this will just return an internal variable, but in each of the derivations of TBaseItem the Calculate function requires a different set of parameters. The Collection will have a Calculate All function which iterates through the collection items and calls each Calculate function, obviously it would need to pass the correct parameters to each function I can think of three ways of doing this: Create a virtual/abstract method for each calculate function in the base class and override it in the derrived class, This would mean no type casting was required when using the object but it would also mean I have to create lots of virtual methods and have a large if...else statement detecting the type and calling the correct "calculate" method, it also means that calling the calculate method is prone to error as you would have to know when writing the code which one to call for which type with the correct parameters to avoid an Error/EAbstractError. Create a record structure with all the possible parameters in and use this as the parameter for the "calculate" function. This has the added benefit of passing this to the "calculate all" function as it can contain all the parameters required and avoid a potentially very long parameter list. Just type casting the TBaseItem to access the correct calculate method. This would tidy up the TBaseItem quite alot compared to the first method. What would be the best way to handle this collection?

    Read the article

  • how to send multiple commands to a file in cron??

    - by developer
    I have a file that is having some multiple dynamic parameters.I want to send these parameters at the time of writing a file in main cron file. Something like this - */15 * * * * /usr/bin/php /a/b/c.php parameter1 parameter2 parameter3 parameter4 Now i tried working this up but my file is not executing. What im concerned about is that how will my php file will fetch these parameters ?? And how will i write this command when there is only 2 parameters to be passes parameter1 and parameter4??? and how will my cron and php will recognoze that which parameter is for which data and all?? please advice!!

    Read the article

  • Asp.net Report Viewer - Custom filter parameters

    - by Chris
    Hi all, for a data warehouse project I need to know about some best practices regarding custom report viewer filters/parameters. Usually I use the standard parameter feature for reports, like multiple select boxes, check boxes, text boxes etc.. But for the current project some reports require more complex report parameters. E.g. a user wants to analyze some measures. For that the user needs to set a filter on a specific address. There are over 100.000 address to choose from, so he has to have the ability to search for an address (full text). Since such features cannot be done with the standard parameters, I will have to create custom params within a ASPX page which are then passed to the report viewer control. So my question is: Are there any best practices on how to create custom parameters? Did anyone had similar problems, if so, how did you solve it?

    Read the article

  • how to get the individual parameters from the list of dynamic parameters in a webmethod,sent using

    - by kranthi
    hi, I am using jquery ajax method on my aspx page,which will invoke the webmethod in the code behind.Currently the webmethod takes a couple of parameters like firstname,lastname,address etc which I am passing from jquery ajax method using data:JSON.stringify({fname:firstname,lname:lastname,city:city}) now my requirement has been changed such that,the number and type of parameters that are going to be passed is not fixed for ex.parameter combination can be something like fname,city or fname,city or city,lname or fname,lname,city or something else.So the webmethod should be such that it should accept any number parameters.I thought of using arrays to do so, as described here. But I do not understand how can I identify which and how many parameters have been passed to the webmethod to insert/update the data to the DB.Please could someone help me with this? thanks

    Read the article

  • Forced naming of parameters in python

    - by Mark Mayo
    In python you may have a function definition: def info(object, spacing=10, collapse=1) which could be called in any of the following ways: info(odbchelper) info(odbchelper, 12) info(odbchelper, collapse=0) info(spacing=15, object=odbchelper) thanks to python's allowing of any-order arguments, so long as they're named. The problem we're having is as some of our larger functions grow, people might be adding parameters between spacing and collapse, meaning that the wrong values may be going to parameters that aren't named. In addition sometimes it's not always clear as to what needs to go in. We're after a way to force people to name certain parameters - not just a coding standard, but ideally a flag or pydev plugin? so that in the above 4 examples, only the last would pass the check as all the parameters are named. Odds are we'll only turn it on for certain functions, but any suggestions as to how to implement this - or if it's even possible would be appreciated.

    Read the article

  • Reordering Variadic Parameters

    - by void-pointer
    I have come across the need to reorder a variadic list of parameters that is supplied to the constructor of a struct. After being reordered based on their types, the parameters will be stored as a tuple. My question is how this can be done so that a modern C++ compiler (e.g. g++-4.7) will not generate unnecessary load or store instructions. That is, when the constructor is invoked with a list of parameters of variable size, it efficiently pushes each parameter into place based on an ordering over the parameters' types. Here is a concrete example. Assume that the base type of every parameter (without references, rvalue references, pointers, or qualifiers) is either char, int, or float. How can I make it so that all the parameters of base type char appear first, followed by all of those of base type int (which leaves the parameters of base type float last). The relative order in which the parameters were given should not be violated within sublists of homogeneous base type. Example: foo::foo() is called with arguments float a, char&& b, const float& c, int&& d, char e. The tuple tupe is std::tuple<char, char, int, float, float>, and it is constructed like so: tuple_type{std::move(b), e, std::move(d), a, c}. Consider the struct defined below, and assume that the metafunction deduce_reordered_tuple_type is already implemented. How would you write the constructor so that it works as intended? If you think that the code for deduce_reodered_tuple_type, would be useful to you, I can provide it; it's a little long. template <class... Args> struct foo { // Assume that the metafunction deduce_reordered_tuple_type is defined. typedef typename deduce_reordered_tuple_type<Args...>::type tuple_type; tuple_type t_; foo(Args&&... args) : t_{reorder_and_forward_parameters<Args>(args)...} {} }; Edit 1 The technique I describe above does have applications in mathematical frameworks that make heavy use of expression templates, variadic templates, and metaprogramming in order to perform aggressive inlining. Suppose that you wish to define an operator that takes the product of several expressions, each of which may be passed by reference, reference to const, or rvalue reference. (In my case, the expressions are conditional probability tables and the operation is the factor product, but something like matrix multiplication works suitably as well.) You need access to the data provided by each expression in order to evaluate the product. Consequently, you must move the expressions passed as rvalue references, copy the expressions passed by reference to const, and take the addresses of expressions passed by reference. Using the technique I describe above now poses several benefits. Other expressions can use uniform syntax to access data elements from this expression, since all of the heavy-lifting metaprogramming work is done beforehand, within the class. We can save stack space by grouping the pointers together and storing the larger expressions towards the end of the tuple. Implementing certain types of queries becomes much easier (e.g. check whether any of the pointers stored in the tuple aliases a given pointer). Thank you very much for your help!

    Read the article

  • Some $_SERVER parameters missing when accessing PHP script via Cron

    - by Jakobud
    I have a script that I need to run with PHP via cron. The original author of the script made a lot of user of certain $_SERVER parameters (like REQUEST_URI). But it appears that certain variables don't exist when running PHP via command line or via CRON. For example, there is no request uri, so it makes sense that the REQUEST_URI parameter wouldn't be available. Is there any way around this other than to completely rewrite the script in order to avoid using special $_SERVER parameters that aren't universally available?

    Read the article

  • Handle complex options with Boost's program_options

    - by R S
    I have a program that generates graphs using different multi-level models. Each multi-level model consists of a generation of a smaller seed graph (say, 50 nodes) which can be created from several models (for example - for each possible edge, choose to include it with probability p). After the seed graph generation, the graph is expanded into a larger one (say 1000 nodes), using one of another set of models. In each of the two stages, each model require a different number of parameters. I would like to be have program_options parse the different possible parameters, according to the names of the models. For example, say I have two seed graphs models: SA, which has 1 parameters, and SB, which has two. Also for the expansion part, I have two models: A and B, again with 1 and 2 parameters, respectively. I would like to be able do something like: ./graph_generator --seed=SA 0.1 --expansion=A 0.2 ./graph_generator --seed=SB 0.1 3 --expansion=A 0.2 ./graph_generator --seed=SA 0.1 --expansion=B 10 20 ./graph_generator --seed=SB 0.1 3 --expansion=B 10 20 and have the parameters parsed correctly. Is that even possible?

    Read the article

  • How to handle multiple effect files in XNA

    - by Adam 'Pi' Burch
    So I'm using ModelMesh and it's built in Effects parameter to draw a mesh with some shaders I'm playing with. I have a simple GUI that lets me change these parameters to my heart's desire. My question is, how do I handle shaders that have unique parameters? For example, I want a 'shiny' parameter that affects shaders with Phong-type specular components, but for an environment mapping shader such a parameter doesn't make a lot of sense. How I have it right now is that every time I call the ModelMesh's Draw() function, I set all the Effect parameters as so foreach (ModelMesh m in model.Meshes) { if (isDrawBunny == true)//Slightly change the way the world matrix is calculated if using the bunny object, since it is not quite centered in object space { world = boneTransforms[m.ParentBone.Index] * Matrix.CreateScale(scale) * rotation * Matrix.CreateTranslation(position + bunnyPositionTransform); } else //If not rendering the bunny, draw normally { world = boneTransforms[m.ParentBone.Index] * Matrix.CreateScale(scale) * rotation * Matrix.CreateTranslation(position); } foreach (Effect e in m.Effects) { Matrix ViewProjection = camera.ViewMatrix * camera.ProjectionMatrix; e.Parameters["ViewProjection"].SetValue(ViewProjection); e.Parameters["World"].SetValue(world); e.Parameters["diffuseLightPosition"].SetValue(lightPositionW); e.Parameters["CameraPosition"].SetValue(camera.Position); e.Parameters["LightColor"].SetValue(lightColor); e.Parameters["MaterialColor"].SetValue(materialColor); e.Parameters["shininess"].SetValue(shininess); //e.Parameters //e.Parameters["normal"] } m.Draw(); Note the prescience of the example! The solutions I've thought of involve preloading all the shaders, and updating the unique parameters as needed. So my question is, is there a best practice I'm missing here? Is there a way to pull the parameters a given Effect needs from that Effect? Thank you all for your time!

    Read the article

  • Favorite tricks with linux kernel boot parameters?

    - by ~drpaulbrewer
    Most linux bootloaders let you edit the kernel boot command line before booting. There are often lots of parameters available -- Knoppix, for instance, has a list on their Knoppix Cheat Codes page -- but most are applicable only to compatibility and special situations. A few are hidden gems. Common usages of these codes are to boot to single-user mode, alter screen mode or drivers, or to specify an alternative root directory. Other more exotic uses are possible. Some linux distributions let you copy the boot cd into ram. Others (e.g., Ubuntu) let you use preseed files to clone installs when setting up multiple systems -- useful when installing a lab full of computers without having to baby sit each install. What other tricks have you found useful in system installs, repairs, backups, restores, establishing temporary servers, or other tasks? To add your favorite trick to the list: As much of the code for these options goes on either in initrd, or in a service handler that detects the kernel parameters, please list *(1) the kernel boot line parameter, (2) what it does, (3) the linux distribution and any required packages to activate the feature*. Thanks.

    Read the article

  • Could not find codec parameters in ffmpeg in Windows

    - by Grienders
    While trying to convert wmv to animated gif using ffmpeg in Windows 7, I ran into an issue. Microsoft Windows [Version 6.1.7600] Copyright (c) 2009 Microsoft Corporation. All rights reserved. C:\>ffmpeg -i test.wmv test.gif ffmpeg version N-39877-g4fa706a Copyright (c) 2000-2012 the FFmpeg developers built on Apr 16 2012 14:57:12 with gcc 4.6.3 configuration: --enable-gpl --enable-version3 --disable-w32threads --enable-ru ntime-cpudetect --enable-avisynth --enable-bzlib --enable-frei0r --enable-libass --enable-libcelt --enable-libopencore-amrnb --enable-libopencore-amrwb --enable -libfreetype --enable-libgsm --enable-libmp3lame --enable-libnut --enable-libope njpeg --enable-librtmp --enable-libschroedinger --enable-libspeex --enable-libth eora --enable-libutvideo --enable-libvo-aacenc --enable-libvo-amrwbenc --enable- libvorbis --enable-libvpx --enable-libx264 --enable-libxavs --enable-libxvid --e nable-zlib libavutil 51. 46.100 / 51. 46.100 libavcodec 54. 14.101 / 54. 14.101 libavformat 54. 3.100 / 54. 3.100 libavdevice 53. 4.100 / 53. 4.100 libavfilter 2. 70.100 / 2. 70.100 libswscale 2. 1.100 / 2. 1.100 libswresample 0. 11.100 / 0. 11.100 libpostproc 52. 0.100 / 52. 0.100 [asf @ 0000000001f3ead0] Could not find codec parameters (Video: none (MTS2 / 0x 3253544D), 800x400, 30000 kb/s) test.wmv: could not find codec parameters What does this mean and how can I solve it?

    Read the article

  • Is there simple way how to join two RouteValueDictionary values to pass parameters to Html.ActionLin

    - by atagaew
    Hi. Look on my code that i created in a partial View: <% foreach (Customer customerInfo in Model.DataRows) {%> <tr> <td> <%=Html.ActionLink( customerInfo.FullName , ((string)ViewData["ActionNameForSelectedCustomer"]) , JoinParameters(customerInfo.id, (RouteValueDictionary) ViewData["AdditionalSelectionParameters"]) , null)%> </td> <td> <%=customerInfo.LegalGuardianName %> </td> <td> <%=customerInfo.HomePhone %> </td> <td> <%=customerInfo.CellPhone %> </td> </tr> <%}%> Here I'm building simple table that showing customer's details. As you may see, in each row, I'm trying to build a link that will redirect to another action. That action requires customerId and some additional parameters. Additional parameters are different for each page where this partial View is using. So, i decided to make Action methods to pass that additional parameters in the ViewData as RouteValueDictionary instance. Now, on the view i have a problem, i need to pass customerId and that RouteValueDictionary together into Html.ActionLink method. That makes me to figure out some way of how to combine all that params into one object (either object or new RouteValueDictionary instance) Because of the way the MVC does, i can't create create a method in the codebehind class (there is no codebihind in MVC) that will join that parameters. So, i used ugly way - inserted inline code: ...script runat="server"... private RouteValueDictionary JoinParameters(int customerId, RouteValueDictionary defaultValues) { RouteValueDictionary routeValueDictionary = new RouteValueDictionary(defaultValues); routeValueDictionary.Add("customerId", customerId); return routeValueDictionary; } ...script... This way is very ugly for me, because i hate to use inline code in the View part. My question is - is there any better way of how i can mix parameters passed from the action (in ViewData, TempData, other...) and the parameter from the view when building action links. May be i can build this link in other way ? Thanks!

    Read the article

  • cgconfig.conf : setting root control group parameters

    - by delerious010
    I've got cpu, cpuacct and memory cgroups configured via /etc/cgconfig.conf ( cgconfig-bin on Lucid ). I can add new control groups, and assign processes to them however there does not seem to be a facility for changing the paramters of the root level memory cgroup ( the actual mount point ). How would one best set such parameters in a clean manner withoput c For example, I've the memory cgroup mounted to /var/run/cgroup/memory. I'd like to have /var/run/cgroup/memory/memory.use_hierarchy set to 1 on boot.

    Read the article

  • Sendmail ignoring parameters

    - by André
    We're sending ~60k emails to non-local addresses with sendmail and I manually set the -f flag to [email protected]. This all works fine and dandy when I limit my PHP script to 5000 addresses. If I remove the limitation, sendmail ingnores the parameters and sends all emails with a reply-to and return-path of [email protected]. I'm sleeping in between each email for 500ms, that should not be the problem.

    Read the article

  • Passing parameters to a shell script running as a cronjob

    - by Takashi
    I am new to bash scripting (not programming in general). I am writing a bash script that will run a Python script I have written. I want to be able to do the following: Pass parameters to the bash script via the cronjob (so I can have two cron jobs) one to be run with parameter 'foobar', and the other 'foo' switch based on the parameter passed to the bash script (by switching, I mean an if/else based on the paramter passed to the bash script).

    Read the article

  • nginx rewrite rule to convert URL segments to query string parameters

    - by Nick
    I'm setting up an nginx server for the first time, and having some trouble getting the rewrite rules right for nginx. The Apache rules we used were: See if it's a real file or directory, if so, serve it, then send all requests for / to Director.php DirectoryIndex Director.php If the URL has one segment, pass it as rt RewriteRule ^/([a-zA-Z0-9\-\_]+)/$ /Director.php?rt=$1 [L,QSA] If the URL has two segments, pass it as rt and action RewriteRule ^/([a-zA-Z0-9\-\_]+)/([a-zA-Z0-9\-\_]+)/$ /Director.php?rt=$1&action=$2 [L,QSA] My nginx config file looks like: server { ... location / { try_files $uri $uri/ /index.php; } location ~ \.php$ { fastcgi_pass unix:/var/run/php5-fpm.sock; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; include fastcgi_params; } } How do I get the URL segments into Query String Parameters like in the Apache rules above? UPDATE 1 Trying Pothi's approach: # serve static files directly location ~* ^.+\.(jpg|jpeg|gif|css|png|js|ico|html)$ { access_log off; expires 30d; } location / { try_files $uri $uri/ /Director.php; rewrite "^/([a-zA-Z0-9\-\_]+)/$" "/Director.php?rt=$1" last; rewrite "^/([a-zA-Z0-9\-\_]+)/([a-zA-Z0-9\-\_]+)/$" "/Director.php?rt=$1&action=$2" last; } location ~ \.php$ { fastcgi_pass unix:/var/run/php5-fpm.sock; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; include fastcgi_params; } This produces the output No input file specified. on every request. I'm not clear on if the .php location gets triggered (and subsequently passed to php) when a rewrite in any block indicates a .php file or not. UPDATE 2 I'm still confused on how to setup these location blocks and pass the parameters. location /([a-zA-Z0-9\-\_]+)/ { fastcgi_pass unix:/var/run/php5-fpm.sock; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME ${document_root}Director.php?rt=$1{$args}; include fastcgi_params; } UPDATE 3 It looks like the root directive was missing, which caused the No input file specified. message. Now that this is fixed, I get the index file as if the URL were / on every request regardless of the number of URL segments. It appears that my location regular expression is being ignored. My current config is: # This location is ignored: location /([a-zA-Z0-9\-\_]+)/ { fastcgi_pass unix:/var/run/php5-fpm.sock; fastcgi_index Director.php; set $args $query_string&rt=$1; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; include fastcgi_params; } location / { try_files $uri $uri/ /Director.php; } location ~ \.php$ { fastcgi_pass unix:/var/run/php5-fpm.sock; fastcgi_index Director.php; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; include fastcgi_params; }

    Read the article

  • How to call SQL Function with multiple parameters from C# web page

    - by Marshall
    I have an MS SQL function that is called with the following syntax: SELECT Field1, COUNT(*) AS RecordCount FROM GetDecileTable('WHERE ClientID = 7 AND LocationName = ''Default'' ', 10) The first parameter passes a specific WHERE clause that is used by the function for one of the internal queries. When I call this function in the front-end C# page, I need to send parameter values for the individual fields inside of the WHERE clause (in this example, both the ClientID & LocationName fields) The current C# code looks like this: String SQLText = "SELECT Field1, COUNT(*) AS RecordCount FROM GetDecileTable('WHERE ClientID = @ClientID AND LocationName = @LocationName ',10)"; SqlCommand Cmd = new SqlCommand(SQLText, SqlConnection); Cmd.Parameters.Add("@ClientID", SqlDbType.Int).Value = 7; // Insert real ClientID Cmd.Parameters.Add("@LocationName", SqlDbType.NVarChar(20)).Value = "Default"; // Real code uses Location Name from user input SqlDataReader reader = Cmd.ExecuteReader(); When I do this, I get the following code from SQL profiler: exec sp_executesql N'SELECT Field1, COUNT(*) as RecordCount FROM GetDecileTable (''WHERE ClientID = @ClientID AND LocationName = @LocationName '',10)', N'@ClientID int,@LocationID nvarchar(20)', @ClientID=7,@LocationName=N'Default' When this executes, SQL throws an error that it cannot parse past the first mention of @ClientID stating that the Scalar Variable @ClientID must be defined. If I modify the code to declare the variables first (see below), then I receive an error at the second mention of @ClientID that the variable already exists. exec sp_executesql N'DECLARE @ClientID int; DECLARE @LocationName nvarchar(20); SELECT Field1, COUNT(*) as RecordCount FROM GetDecileTable (''WHERE ClientID = @ClientID AND LocationName = @LocationName '',10)', N'@ClientID int,@LocationName nvarchar(20)', @ClientID=7,@LocationName=N'Default' I know that this method of adding parameters and calling SQL code from C# works well when I am selecting data from tables, but I am not sure how to embed parameters inside of the ' quote marks for the embedded WHERE clause being passed to the function. Any ideas?

    Read the article

  • error in the syntax of cmd parameters

    - by KATy
    hi guyz in this method i m just adding the values to the db. temp is a object. the field value and variables in the object re havin the same name.. dono y this error s comin plz help me out... public virtual void Save_input_parameter_details(Test_Unit_BLL temp ) { SqlConnection con; con = new SqlConnection("Data Source=VV;Initial Catalog=testingtool;User ID=sa;Password=sa;"); con.Open(); SqlCommand cmd, cmd2, cmd3; //try //{ for (int i = 0; i < temp.No_Input_parameters; i++) { cmd2 = new SqlCommand("insert into Input_parameter_details values(@Input_Parameter_name,@Input_Parameter_datatype,@noparams,@class_code", con); cmd2.Parameters.AddWithValue("@Input_Parameter_datatype", temp.Input_Parameter_datatype[i]); cmd2.Parameters.AddWithValue("@Input_Parameter_name", temp.Input_Parameter_name[i]); cmd2.Parameters.AddWithValue("@noparams", temp.No_Input_parameters); cmd2.Parameters.AddWithValue("@class_code",temp.class_code); cmd2.ExecuteNonQuery(); } //} //catch (Exception ex) // { // MessageBox.Show("error"+ex); // } }

    Read the article

  • Retaining parameters in ASP.NET MVC

    - by MapDot
    Many MVC frameworks (e.g. PHP's Zend Framework) have a way of providing basic state management through URLs. The basic principle is this: Any parameters that were not explicitly modified or un-set get copied into every URL For instance, consider a listing with pagination. You'll have the order, direction and page number passed as URL parameters. You may also have a couple of filters. Changing the value of a filter should not alter the sort order. ASP.net MVC seems to remember your controller and action by default: <%: Html.RouteLink("Next", "MyRoute", new {id = next.ItemId}) %> This will not re-set your action or controller. However, it does seem to forget all other parameters. The same is true of ActionLink. Parameters that get set earlier on in your URL seem to get retained as well. Is there a way to make it retain more than that? For instance, this does not seem to affect any of the links being generated: RouteValues.RouteData.Values["showDeleted"] = true;

    Read the article

< Previous Page | 10 11 12 13 14 15 16 17 18 19 20 21  | Next Page >