Search Results

Search found 8839 results on 354 pages for 'optional parameters'.

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

  • How do i resize image file to optional sizes

    - by shuxer
    Hi I have image upload form, user attaches aimage file, and selects image size to resize the uploaded image file(200kb, 500kb, 1mb, 5mb, Original). Then my script needs to resize image file size based on user's optional size, but im not sure how to implement this feature, For example, user uploads image with one 1mb size, and if user selects 200KB to resize, then my script should save it with 200kb size. Does anyone know or have an experience on similar task ? Thanks for you reply in advance.

    Read the article

  • How can you use optional parameters in C#?

    - by kurious
    We're building a web API that's programmatically generated from a C# class (the class has method "GetFooBar(int a, int b)" and the API has a method GetFooBar taking query params like &a=foo&b=bar. The classes needs to support optional parameters, which isn't supported in C# the language. What's the best approach?

    Read the article

  • why is optional chaining required in an if let statement

    - by b-ryan ca
    Why would the Swift compiler expect me to write if let addressNumber = paul.residence?.address?.buildingNumber?.toInt() { } instead of just writing: if let addressNumber = paul.residence.address.buildingNumber.toInt() { } The compiler clearly has the static type information to handle the conditional statement for the first dereference of the optional value and each following value. Why would it not continue to do so for the following statements?

    Read the article

  • ANTLR C grammar, optional init_declarator_list?

    - by eisbaw
    Hello, In the ANSI C grammar for ANTLR v3 ( http://antlr.org/grammar/1153358328744/C.g ), how can init_declarator_list be optional in rule declaration ? Instead of: | declaration_specifiers init_declarator_list? ';' -I would say: | declaration_specifiers init_declarator_list ';' What part of the C standard allows statements like: int; EDIT: I just tried, it is allowed! Okay then, why is it allowed?

    Read the article

  • Specifying Entire Path As Optional Rails 3.0.0

    - by Kevin Sylvestre
    I want to create a Rails 3 route with entirely optional parameters. The example route is: match '(/name/:name)(/height/:height)(/weight/:weight)' => 'people#index' The route works if I specify it as: match '/people(/name/:name)(/height/:height)(/weight/:weight)' => 'people#index' But I want to have this as the root URL. Thanks.

    Read the article

  • ObjC: required to optional

    - by Joschy
    Hello Guys! Situation: A protocol A implements a protocol B. B has some @optional and some (@)required methods. Question: Is it possible in protocol A to set a method from B to the opposite (opt. to reeq. and vv.)? Cheers!

    Read the article

  • Box2D Joints in entity components system

    - by Johnmph
    I search a way to have Box2D joints in an entity component system, here is what i found : 1) Having the joints in Box2D/Body component as parameters, we have a joint array with an ID by joint and having in the other body component the same joint ID, like in this example : Entity1 - Box2D/Body component { Body => (body parameters), Joints => { Joint1 => (joint parameters), others joints... } } // Joint ID = Joint1 Entity2 - Box2D/Body component { Body => (body parameters), Joints => { Joint1 => (joint parameters), others joints... } } // Same joint ID than in Entity1 There are 3 problems with this solution : The first problem is the implementation of this solution, we must manage the joints ID to create joints and to know between which bodies they are connected. The second problem is the parameters of joint, where are they got ? on the Entity1 or Entity2 ? If they are the same parameters for the joint, there is no problem but if they are differents ? The third problem is that we can't limit number of bodies to 2 by joint (which is mandatory), a joint can only link 2 bodies, in this solution, nothing prevents to create more than 2 entities with for each a body component with the same joint ID, in this case, how we know the 2 bodies to joint and what to do with others bodies ? 2) Same solution than the first solution but by having entities ID instead of Joint ID, like in this example : Entity1 - Box2D/Body component { Body => (body parameters), Joints => { Entity2 => (joint parameters), others joints... } } Entity2 - Box2D/Body component { Body => (body parameters), Joints => { Entity1 => (joint parameters), others joints... } } With this solution, we fix the first problem of the first solution but we have always the two others problems. 3) Having a Box2D/Joint component which is inserted in the entities which contains the bodies to joint (we share the same joint component between entities with bodies to joint), like in this example : Entity1 - Box2D/Body component { Body => (body parameters) } - Box2D/Joint component { Joint => (Joint parameters) } // Shared, same as in Entity2 Entity2 - Box2D/Body component { Body => (body parameters) } - Box2D/Joint component { Joint => (joint parameters) } // Shared, same as in Entity1 There are 2 problems with this solution : The first problem is the same problem than in solution 1 and 2 : We can't limit number of bodies to 2 by joint (which is mandatory), a joint can only link 2 bodies, in this solution, nothing prevents to create more than 2 entities with for each a body component and the shared joint component, in this case, how we know the 2 bodies to joint and what to do with others bodies ? The second problem is that we can have only one joint by body because entity components system allows to have only one component of same type in an entity. So we can't put two Joint components in the same entity. 4) Having a Box2D/Joint component which is inserted in the entity which contains the first body component to joint and which has an entity ID parameter (this entity contains the second body to joint), like in this example : Entity1 - Box2D/Body component { Body => (body parameters) } - Box2D/Joint component { Entity2 => (Joint parameters) } // Entity2 is the entity ID which contains the other body to joint, the first body being in this entity Entity2 - Box2D/Body component { Body => (body parameters) } There are exactly the same problems that in the third solution, the only difference is that we can have two differents joints by entity instead of one (by putting one joint component in an entity and another joint component in another entity, each joint referencing to the other entity). 5) Having a Box2D/Joint component which take in parameter the two entities ID which contains the bodies to joint, this component can be inserted in any entity, like in this example : Entity1 - Box2D/Body component { Body => (body parameters) } Entity2 - Box2D/Body component { Body => (body parameters) } Entity3 - Box2D/Joint component { Joint => (Body1 => Entity1, Body2 => Entity2, others parameters of joint) } // Entity1 is the ID of the entity which have the first body to joint and Entity2 is the ID of the entity which have the second body to joint (This component can be in any entity, that doesn't matter) With this solution, we fix the problem of the body limitation by joint, we can only have two bodies per joint, which is correct. And we are not limited by number of joints per body, because we can create an another Box2D/Joint component, referencing to Entity1 and Entity2 and put this component in a new entity. The problem of this solution is : What happens if we change the Body1 or Body2 parameter of Joint component at runtime ? We need to add code to sync the Body1/Body2 parameters changes with the real joint object. 6) Same as solution 3 but in a better way : Having a Box2D/Joint component Box2D/Joint which is inserted in the entities which contains the bodies to joint, we share the same joint component between these entities BUT the difference is that we create a new entity to link the body component with the joint component, like in this example : Entity1 - Box2D/Body component { Body => (body parameters) } // Shared, same as in Entity3 Entity2 - Box2D/Body component { Body => (body parameters) } // Shared, same as in Entity4 Entity3 - Box2D/Body component { Body => (body parameters) } // Shared, same as in Entity1 - Box2D/Joint component { Joint => (joint parameters) } // Shared, same as in Entity4 Entity4 - Box2D/Body component { Body => (body parameters) } // Shared, same as in Entity2 - Box2D/Joint component { Joint => (joint parameters) } // Shared, same as in Entity3 With this solution, we fix the second problem of the solution 3, because we can create an Entity5 which will have the shared body component of Entity1 and an another joint component so we are no longer limited in the joint number per body. But the first problem of solution 3 remains, because we can't limit the number of entities which have the shared joint component. To resolve this problem, we can add a way to limit the number of share of a component, so for the Joint component, we limit the number of share to 2, because we can only joint 2 bodies per joint. This solution would be perfect because there is no need to add code to sync changes like in the solution 5 because we are notified by the entity components system when components / entities are added to/removed from the system. But there is a conception problem : How to know easily and quickly between which bodies the joint operates ? Because, there is no way to find easily an entity with a component instance. My question is : Which solution is the best ? Is there any other better solutions ? Sorry for the long text and my bad english.

    Read the article

  • Problem with oracle stored procedure - parameters

    - by Nicole
    I have this stored procedure: CREATE OR REPLACE PROCEDURE "LIQUIDACION_OBTENER" ( p_Cuenta IN NUMBER, p_Fecha IN DATE, p_Detalle OUT LIQUIDACION.FILADETALLE%TYPE ) IS BEGIN SELECT FILADETALLE INTO p_Detalle FROM Liquidacion WHERE (FILACUENTA = p_Cuenta) AND (FILAFECHA = p_Fecha); END; / ...and my c# code: string liquidacion = string.Empty; OracleCommand command = new OracleCommand("Liquidacion_Obtener"); command.BindByName = true; command.Parameters.Add(new OracleParameter("p_Cuenta", OracleDbType.Int64)); command.Parameters["p_Cuenta"].Value = cuenta; command.Parameters.Add(new OracleParameter("p_Fecha", OracleDbType.Date)); command.Parameters["p_Fecha"].Value = fecha; command.Parameters.Add("p_Detalle", OracleDbType.Varchar2, ParameterDirection.Output); OracleConnectionHolder connection = null; connection = this.GetConnection(); command.Connection = connection.Connection; command.CommandTimeout = 30; command.CommandType = CommandType.StoredProcedure; OracleDataReader lector = command.ExecuteReader(); while (lector.Read()) { liquidacion += ((OracleString)command.Parameters["p_Detalle"].Value).Value; } the thing is that when I try to put a value into the parameter "Fecha" (that is a date) the code gives me this error (when the line command.ExecuteReader(); is executed) Oracle.DataAccess.Client.OracleException : ORA-06502: PL/SQL: numeric or value error ORA-06512: at "SYSTEM.LIQUIDACION_OBTENER", line 9 ORA-06512: at line 1 I tried with the datetime and was not the problem, I eve tried with no input parameters and just the output and still got the same error. Aparently the problem is with the output parameter. I already tried putting p_Detalle OUT VARCHAR2 instead of p_Detalle OUT LIQUIDACION.FILADETALLE%TYPE but it didn't work either I hope my post is understandable.. thanks!!!!!!!!!!

    Read the article

  • Complicated .NET factory design

    - by Tom W
    Hello SO; I'm planning to ask a fairly elaborate question that is also something of a musing here, so bear with me... I'm trying to design a factory implementation for a simulation application. The simulation will consist of different sorts of entities i.e. it is not a homogenous simulation in any respect. As a result, there will be numerous very different concrete implementations and only the very general properties will be abstracted at the top level. What I'd like to be able to do is create new simulation entities by calling a method on the model with a series of named arguments representing the parameters of the entity, and have the model infer what type of object is being described by the inbound parameters (from the names of the parameters and potentially the sequence they occur in) and call a factory method on the appropriate derived class. For example, if I pass the model a pair of parameters (Param1=5000, Param2="Bacon") I would like it to infer that the names Param1 and Param2 'belong' to the class "Blob1" and call a shared function "getBlob1" with named parameters Param1:=5000, Param2:="Bacon" whereas if I pass the model (Param1=5000, Param3=50) it would call a similar factory method for Blob2; because Param1 and Param3 in that order 'belong' to Blob2. I foresee several issues to resolve: Whether or not I can reflect on the available types with string parameter names and how to do this if it's possible Whether or not there's a neat way of doing the appropriate constructor inference from the combinatoric properties of the argument list or whether I'm going to have to bodge something to do it 'by hand'. If possible I'd like the model class to be able to accept parameters as parameters rather than as some collection of keys and values, which would require the model to expose a large number of parametrised methods at runtime without me having to code them explicitly - presumably one for every factory method available in the relevant namespace. What I'm really asking is how you'd go about implementing such a system, rather than whether or not it's fundamentally possible. I don't have the foresight or experience with .NET reflection to be able to figure out a way by myself. Hopefully this will prove an informative discussion.

    Read the article

  • T4MVC Optional Parameter Inferred From Current Context

    - by Itakou
    I have read the other post about this at T4MVC OptionalParameter values implied from current context and I am using the latest T4MVC (2.11.1) which is suppose to have the fix in. I even checked checked to make sure that it's there -- and it is. I am still getting the optional parameters filled in based on the current context. For example: Let's say I have a list that is by default ordered by a person's last name. I have the option to order by first name instead with the URL http://localhost/list/stuff?orderby=firstname When I am in that page, I want to go back to order by first name with the code: @Html.ActionLink("order by last name", MVC.List.Stuff(null)) the link I wanted was simply http://localhost/list/stuff without any parameters to keep the URL simple and short - invoking default behaviors within the action. But instead the orderby is kept and the url is still http://localhost/list/stuff?orderby=firstname Any help would be great. I know that in the most general cases, this does remove the query parameter - maybe I do have a specific case where it was not removed. I find that it only happens when I have the URL inside a page that I included with RenderPartial. My actual code is <li>@Html.ActionLink("Recently Updated", MVC.Network.Ticket.List(Model.UI.AccountId, "LastModifiedDate", null, null, null, null, null))</li> <li>@Html.ActionLink("Recently Created", MVC.Network.Ticket.List(Model.UI.AccountId, "CreatedDate", null, null, null, null, null))</li> <li>@Html.ActionLink("Most Severe", MVC.Network.Ticket.List(Model.UI.AccountId, "MostSevere", null, null, null, null, null))</li> <li>@Html.ActionLink("Previously Closed", MVC.Network.Ticket.List(Model.UI.AccountId, "LastModifiedDate", null, "Closed", null, null, null))</li> the problem happens when someone clicks Previously Closed and and go to ?status=closed. When they click Recently Updated, which I want to the ?status so that it shows the active ones, the ?status=closed stays. Any insight would be greatly appreciated.

    Read the article

  • What happens to C# 4 optional parameters when compiling against 3.5?

    - by Bertrand Le Roy
    Here’s a method declaration that uses optional parameters: public Path Copy( Path destination, bool overwrite = false, bool recursive = false) Something you may not know is that Visual Studio 2010 will let you compile this against .NET 3.5, with no error or warning. You may be wondering (as I was) how it does that. Well, it takes the easy and rather obvious way of not trying to be too smart and just ignores the optional parameters. So if you’re compiling against 3.5 from Visual Studio 2010, the above code is equivalent to: public Path Copy( Path destination, bool overwrite, bool recursive) The parameters are not optional (no such thing in C# 3), and no overload gets magically created for you. If you’re building a library that is going to have both 3.5 and 4.0 versions, and you want 3.5 users to have reasonable overloads of your methods, you’ll have to provide those yourself, which means that providing a version with optional parameters for the benefit of 4.0 users is not going to provide that much value, except for the ability to provide named parameters out of order. I guess that’s not so bad… Providing all of the following overloads will compile against both 3.5 and 4.0: public Path Copy(Path destination)public Path Copy(Path destination, bool overwrite)public Path Copy( Path destination, bool overwrite = false, bool recursive = false)

    Read the article

  • C# regex. Optional match after string

    - by Oskar Kjellin
    I have an input like this test1.test2.part01 which I want to strip away to test1.test2. The only thing i know is that it will end with partxx and probably a dot before the partxx. However, it will not always be a apart. Another example of input might be testas1.tlp2.asd3.part10 which ofcourse should be stripped to testas1.tlp2.asd3. I've made all that, no problem. The problem is the dot at the end before partxx. My regex at the moment is: (.*).?part\d{1,2} But it will include the dot in the group. I do not want the dot to be in the group. The below works as I want it, given that the dot exists, but it will not always be there. (.*).part\d{1,2} How can I exclude the optional dot from the group?

    Read the article

  • Bison: Optional tokens in a single rule.

    - by Simone Margaritelli
    Hi there .. i'm using GNU Bison 2.4.2 to write a grammar for a new language i'm working on and i have a question. When i specify a rule, let's say : statement : T_CLASS T_IDENT '{' T_CLASS_MEMBERS '}' { // create a node for the statement ... } If i have a variation on the rule, for instance statement : T_CLASS T_IDENT T_EXTENDS T_IDENT_LIST '{' T_CLASS_MEMBERS '}' { // create a node for the statement ... } Where (from flex scanner rules) : "class" return T_CLASS; "extends" return T_EXTENDS; [a-zA-Z\_][a-zA-Z0-9\_]* return T_IDENT; (and T_IDENT_LIST is a rule for comma separated identifiers). Is there any way to specify all of this only in one rule, setting somehow the "T_EXTENDS T_IDENT_LIST" as optional? I've already tried with T_CLASS T_IDENT (T_EXTENDS T_IDENT_LIST)? '{' T_CLASS_MEMBERS '}' { // create a node for the statement ... } But Bison gave me an error. Thanks

    Read the article

  • Manage Foreign key and Drop downlist for optional field in .NET

    - by Brij
    What is the best way to handle following situation? A dropdown(for master table) is optional in a particular form. But, In database table the field is constrained with foreign key. If user don't select from dropdown then It creates problem because of foreign key. One solution is to create default option in master table and use it in case of blank selection. but in dropdown, we need to handle this to show on top. Is it perfect solution? Is there any other optimized solution for this? Thanks

    Read the article

  • Custom UITableviewcell shows "fatal error: Can't unwrap Optional.None" issue in swift

    - by user1656286
    I need to load a custom cell in a UITableView. I created a custom subclass of UITableViewCell named "CustomTableViewCell". I have added a UITabelViewCell to the tableview (using drag and drop) as shown in figure. Then in file inspector I set the class of that UITabelViewCell to be "CustomTableViewCell". Here is my code: class ViewController: UIViewController,UITableViewDelegate,UITableViewDataSource { @IBOutlet var tableView : UITableView var items = String[]() override func viewDidLoad() { super.viewDidLoad() items = ["Hi","Hello","How"] self.tableView.registerClass(CustomTableViewCell.self, forCellReuseIdentifier: "CusTomCell") // Do any additional setup after loading the view, typically from a nib. } func tableView(tableView: UITableView!, numberOfRowsInSection section: Int) -> Int{ return items.count } func tableView(tableView: UITableView!, cellForRowAtIndexPath indexPath: NSIndexPath!) -> UITableViewCell!{ var cell:CustomTableViewCell = self.tableView.dequeueReusableCellWithIdentifier("CusTomCell") as CustomTableViewCell cell.labelTitle.text = items[indexPath.row] return cell; } override func didReceiveMemoryWarning() { super.didReceiveMemoryWarning() // Dispose of any resources that can be recreated. } } When I run my code, I get the following error: "fatal error: Can't unwrap Optional.None" as seen in the image.

    Read the article

  • jQuery plugin options: required, optional, inaccessible

    - by Trevor Hartman
    I'm curious how to specify options to a jQuery plugin in a way that some are required, some are optionally overridden, and some can't be touched. I started off with the usual: jQuery.fn.plugin = function (options){ var defaults = { username: "", posts:10, api: "http://myapi.com" } var settings = jQuery.extend({}, defaults, options); } Let's say I want username to be required, posts is optional (defaults to 10) and you (you being the user of the plugin) can't change api, even if they try. Ideally, they'd all still be in the same data structure instead of being split into separate objects. Ideas?

    Read the article

  • ANTLR, optional ';' in JavaScript

    - by vava
    I'm just playing with ANTLR and decided to try parsing JavaScript with it. But I hit the wall in dealing with optional ';' in it, where statement end is marked by newline instead. Can it be done in some straightforward way? Just a simple grammar example that doesn't work grammar optional_newline; def : statements ; statements : statement (statement)* ; statement : expression (';' | '\n') ; expression : ID | INT | 'var' ID '=' INT ; ID : ('a'..'z'|'A'..'Z'|'_') ('a'..'z'|'A'..'Z'|'0'..'9'|'_')* ; INT : '0'..'9'+ ; WS : ( ' ' | '\t' | '\r' | '\n') {$channel=HIDDEN;} ; and I want to be able to parse this (which can be parsed by JavaScript parsers) var i = 10 10; PS: I don't want to put WS in parser rules, I would be much happier if lexer just get rid of those.

    Read the article

  • How to assign optional attribute of NSManagedObject in a NSManagedObjectModel having Three NSManaged

    - by Kundan
    I am using coredata framework. In my NSManagedObjectModel i am using three entities that are Class, Student and Score where class and student have one-to-many & inverse relationship and Student and Score have also inverse but one-one relationship. Score entity has all optional attributes and having default '0' decimalVaue, which is not assigned at the time new Student is added. But later i want to assign them score individually and also to particular attribute not all of score attributes in a go. I am able to create and add Students to particular Class but dont have any idea how to call particular student and assign them score. For example I want to assign Score'attribute "dribbling" [there are many attributes like "tackling"] a decimal value to Student "David" of Class "Soccer" ,how i can do that? Thanks in advance for any suggestion.

    Read the article

  • Cannot figure out how to take in generic parameters for an Enterprise Framework library sql statemen

    - by KallDrexx
    I have written a specialized class to wrap up the enterprise library database functionality for easier usage. The reasoning for using the Enterprise Library is because my applications commonly connect to both oracle and sql server database systems. My wrapper handles both creating connection strings on the fly, connecting, and executing queries allowing my main code to only have to write a few lines of code to do database stuff and deal with error handling. As an example my ExecuteNonQuery method has the following declaration: /// <summary> /// Executes a query that returns no results (e.g. insert or update statements) /// </summary> /// <param name="sqlQuery"></param> /// <param name="parameters">Hashtable containing all the parameters for the query</param> /// <returns>The total number of records modified, -1 if an error occurred </returns> public int ExecuteNonQuery(string sqlQuery, Hashtable parameters) { // Make sure we are connected to the database if (!IsConnected) { ErrorHandler("Attempted to run a query without being connected to a database.", ErrorSeverity.Critical); return -1; } // Form the command DbCommand dbCommand = _database.GetSqlStringCommand(sqlQuery); // Add all the paramters foreach (string key in parameters.Keys) { if (parameters[key] == null) _database.AddInParameter(dbCommand, key, DbType.Object, null); else _database.AddInParameter(dbCommand, key, DbType.Object, parameters[key].ToString()); } return _database.ExecuteNonQuery(dbCommand); } _database is defined as private Database _database;. Hashtable parameters are created via code similar to p.Add("@param", value);. the issue I am having is that it seems that with enterprise library database framework you must declare the dbType of each parameter. This isn't an issue when you are calling the database code directly when forming the paramters but doesn't work for creating a generic abstraction class such as I have. In order to try and get around that I thought I could just use DbType.Object and figure the DB will figure it out based on the columns the sql is working with. Unfortunately, this is not the case as I get the following error: Implicit conversion from data type sql_variant to varchar is not allowed. Use the CONVERT function to run this query Is there any way to use generic parameters in a wrapper class or am I just going to have to move all my DB code into my main classes?

    Read the article

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