Search Results

Search found 1864 results on 75 pages for 'optional'.

Page 42/75 | < Previous Page | 38 39 40 41 42 43 44 45 46 47 48 49  | Next Page >

  • Default Arguments in Matlab

    - by Scott
    Hello. Is it possible to have default arguments in Matlab? For instance, here: function wave(a,b,n,k,T,f,flag,fTrue=inline('0')) I would like to have the true solution be an optional argument to the wave function. If it is possible, can anyone demonstrate the proper way to do this? Currently, I am trying what I posted above and I get: ??? Error: File: wave.m Line: 1 Column: 37 The expression to the left of the equals sign is not a valid target for an assignment. Thanks!

    Read the article

  • Auto injecting logger with guice

    - by koss
    With reference to Guice's custom injections article, its TypeListener performs a check for InjectLogger.class annotation - which can be optional. Removing that check will inject to all Logger.class types. class Log4JTypeListener implements TypeListener { public <T> void hear(TypeLiteral<T> typeLiteral, TypeEncounter<T> typeEncounter) { for (Field field : typeLiteral.getRawType().getDeclaredFields()) { if (field.getType() == Logger.class && field.isAnnotationPresent(InjectLogger.class)) { typeEncounter.register(new Log4JMembersInjector<T>(field)); } } } } I'm tempted to remove "&& field.isAnnotationPresent(InjectLogger.class)" from the listener. If we're using Guice to inject all instances of our Logger, is there any reason not to do it automatically (without need to annotate)?

    Read the article

  • Database Design for One to One relationships

    - by Greelmo
    I'm trying to finalize my design of the data model for my project, and am having difficulty figuring out which way to go with it. I have a table of users, and an undetermined number of attributes that apply to that user. The attributes are in almost every case optional, so null values are allowed. Each of these attributes are one to one for the user. Should I put them on the same table, and keep adding columns when attributes are added (making the user table quite wide), or should I put each attribute on a separate table with a foreign key to the user table. I have decided against using the EAV model. Thanks!

    Read the article

  • Phone Number validation using Regular Expression validation in c# 2008?

    - by prateeksaluja20
    Hello Experts , I Want to validate the phone number in this format i.e +919981424199,+91231456789,.... I am using Asp.net +c#2008 for developing web site.for this i have used the Regular Expression validation control-property-Validation Expression="[0-9]+(,[0-9]+)*". But this accept the number as 919981424199,..... User may be enter in this way +919981424199,919300951916,so on so i need the validation expression for this type format.The "+" symbol is optional it can be use & it can't.I tried to solve but still i am searching.please help me to sort out this problem. thanks in advance.

    Read the article

  • Regarding Shell variable

    - by arav
    I need to call another shell script testarg.sh within my main script. This script testarg.sh has arguments ARG1 ,ARG2, ARG3. I need to call up the below way ./testarg.sh -ARG1 -ARG2 -ARG3 ARG1 and ARG3 argument Variables are mandatory ones. If its not passed to the main script then i quit. ARG2 is an optional one. If the ARG2 variable is not set with value or it's not defined then i need not pass it from main script.So i need to call up the below way ./testarg.sh -ARG1 -ARG3 If the value exist for the ARG2 Varibale then i need to call the below way ./testarg.sh -ARG1 -ARG2 -ARG3 Do i need to have a if else statement for checking the ARG2 variable is empty or null. Is there any other way to do it.

    Read the article

  • Livevalidation: only validate when default value is changed

    - by usr122212
    Hello there! I am validating my html form with livevalidation and everything works great except for one feature. I have a input field with a default value age, I only want the livevalidation to validate when it says something other than "age". so maybe the user will type in 20 then the validation will fire checking its things but if left as "age" it won't check it all. But as of now, it just checks everything with a validation script and this is a problem for me as I have lots of fields in my form and some of them are optional so when I hit submit, the livevalidation checks the age field as well even if the user didnt touch it to begin with. Would this be possible with livevalidation ? Thanks for the help.

    Read the article

  • CouchDB read authorization

    - by mdikici
    In couchdb website - technical overview - security and validation - http://couchdb.apache.org/docs/overview.html - it writes that (on reader access part) "To protect document contents, CouchDB documents can have a reader list. This is an optional list of reader-names allowed to read the document. When a reader list is used, protected documents are only viewable by listed users." I searched about how to use it but i found nothing. So is it actually used and if it is how? Thanks. -- Mustafa

    Read the article

  • Database indexes - what should they be

    - by WebweaverD
    Most of my database tables have a clear unique index through which lookups are done 90% of the time but I am a bit unsure on this one - I have a table which keeps track of user rating totals for items in my database, I now want to add another table, to track individual ratings with an ip address column to make sure no one can rate something twice. Since I can see this becoming a big, high use table it is important to optimize it correctly. (MYSQL table) This table will have the following fields: rating_id(always - unique), item_id (always - not unique), user_id (optional - not unique), ip_address (always - not unique), rating_value(always - not unique), has_review(bool) Now I envisions 90% the queries going something like this: When a user rates something - select where item_id = x and ip_address = y, (if rows = 0) insert rating When in user account pages - select where ip_address = x or username = y Now none of the fields searched on are unique, can I still use them as indexes (for example item _id and ip_address), can I have two indexes and will this still improve performance over a non indexed table?

    Read the article

  • Is there any way to use GUIDs in django?

    - by Jason Baker
    I have a couple of tables that are joined by GUIDs in SQL Server. Now, I've found a few custom fields to add support for GUIDs in django, but I tend to shy away from using code in blog posts if at all possible. I'm not going to do anything with the GUID other than join on it and maybe assign a GUID on new entries (although this is optional). Is there any way to allow this using django's built-in types? Like can I use some kind of char field or binary field and "trick" django into joining using it? If it's any help, I'm using django-pyodbc.

    Read the article

  • Is there an additional runtime cost for using named parameters?

    - by Jurily
    Consider the following struct: public struct vip { string email; string name; int category; public vip(string email, int category, string name = "") { this.email = email; this.name = name; this.category = category; } } Is there a performance difference between the following two calls? var e = new vip(email: "foo", name: "bar", category: 32); var e = new vip("foo", 32, "bar"); Is there a difference if there are no optional parameters defined?

    Read the article

  • How to deal with name/value pairs of function arguments in MATLAB

    - by Richie Cotton
    I have a function that takes optional arguments as name/value pairs. function example(varargin) % Lots of set up stuff vargs = varargin; nargs = length(vargs); names = vargs(1:2:nargs); values = vargs(2:2:nargs); validnames = {'foo', 'bar', 'baz'}; for name = names validatestring(name{:}, validnames); end % Do something ... foo = strmatch('foo', names); disp(values(foo)) end example('foo', 1:10, 'bar', 'qwerty') It seems that there is a lot of effort involved in extracting the appropriate values (and it still isn't particularly robust again badly specified inputs). Is there a better way of handling these name/value pairs? Are there any helper functions that come with MATLAB to assist?

    Read the article

  • UDP + total order, non-reliable

    - by disown
    I'm trying to find a version of UDP which just alleviates the restriction of a maximum size of the message sent. I don't care about reliability or partial retransmission, if all chunks arrive I want the message to be assembled from the chunks in sending order and delivered to the listening app. If one or more chunks are missing I would just like to discard the message. The goal is to have a low-latency notification mechanism about real time data, but with the added support for bigger messages than what would fit in an IP datagram. I would like the protocol to be one way only, and not have long connection setup times. An optional feature to be able to respond to a received message wouldn't hurt (a concept of an unreliable connection), but is not necessary.

    Read the article

  • Newbie question about file formatting in Python

    - by user568041
    I'm writing a simple program in Python 2.7 using pycURL library to submit file contents to pastebin. Here's the code of the program: #!/usr/bin/env python2 import pycurl, os def send(file): print "Sending file to pastebin...." curl = pycurl.Curl() curl.setopt(pycurl.URL, "http://pastebin.com/api_public.php") curl.setopt(pycurl.POST, True) curl.setopt(pycurl.POSTFIELDS, "paste_code=%s" % file) curl.setopt(pycurl.NOPROGRESS, True) curl.perform() def main(): content = raw_input("Provide the FULL path to the file: ") open = file(content, 'r') send(open.readlines()) return 0 main() The output pastebin looks like standard Python list: ['string\n', 'line of text\n', ...] etc. Is there any way I could format it so it looks better and it's actually human-readable? Also, I would be very happy if someone could tell me how to use multiple data inputs in POSTFIELDS. Pastebin API uses paste_code as its main data input, but it can use optional things like paste_name that sets the name of the upload or paste_private that sets it private.

    Read the article

  • Gson serialization depending on field value

    - by Serj Lotutovici
    I have a POJO that is similar to: public class MyGsonPojo { @Expose @SerializedName("value1") private String valueOne; @Expose @SerializedName("value2") private boolean valueTwo; @Expose @SerializedName("value3") private int valueThree; // Getters and other stuff here } The issue is that this object has to be serialized into a json body for a call to the server. Some fields are optional for the request and if I even send it with default and null values, the API responds differently (Unfortunately changing the api is not an option). So basically I need to exclude fields from serialization if any of them is set to a default value. For example if the field valueOne is null the resulting json should be: { "value2" : true, "value3" : 2 } Any idea how to make this a painless effort? I wouldn't want to build the json body manually. Any help would be great. Thank you in advice.

    Read the article

  • I can't get areas working in VS2010

    - by devlife
    I just upgraded from VS2010 RC to RTM. Now my areas aren't working. I have a Profile area with a Home controller and an Action method Index(). If I try: http://localhost:4951/profile I get a 404 error saying that the resource can't be found. If I try http://localhost:4951/profile/home I get the same error. However, if I try http://localhost:4951/profile/home/index then the view is returned. Here is my ProfileAreaRegistration: public class ProfileAreaRegistration : AreaRegistration { public override string AreaName { get { return "Profile"; } } public override void RegisterArea(AreaRegistrationContext context) { context.MapRoute( "Profile_Unlock", "Profile/Unlock/{userID}/{unlockID}", new { controller = "Unlock", action = "Index" }, new { userID = new GuidRouteConstraint(), unlockID = new GuidRouteConstraint() } ); context.MapRoute( "Profile_default", "Profile/{controller}/{action}/{id}", new { action = "Home", id = UrlParameter.Optional } ); } Does anyone know what is going wrong?

    Read the article

  • pagecontrol indicator custom image instead of Default

    - by iphonecool
    How i change the color of pagination dots of UIPageControl? In this link the sample code is given.But it shows 3 errors for me... 1'st ERROR: Line:CGRect currentBounds = self.bounds; Error:requst for member 'bounds' in something not a structure or union Method:-(void)drawRect: 2nd Err: same error with same line in touchesBegan method. 3rd Err:@protocol PageControlDelegate @optional (void)pageControlPageDidChange:(PageControl *)pageControl; @end Error:Expected ')' before 'PageControl' .These are the three errors occurs for me...Please help me out to solve this.. I want to change the pagecontrol indicator(dot) color... Thanks & Regards, Renuga

    Read the article

  • Permutation on Rails Routes

    - by Kevin Sylvestre
    I currently have an application that for a set of parameters (location, category, budget, ...) a user can enter a "pretty" URL like: /location/canada/ontario /category/primary /budget/small Resulting in the respective parameters: params[:country] == 'canada' and params[:region] == 'ontario' params[:category] == 'primary' params[:budget] == 'small' I want to allow users to perform searches on multiple parameters at once (with each parameter optional). For example: /location/canada/ontario/category/primary/budget/small I understand that this can be achieved using URL parameters, but for SEO reasons I prefer to add the "pretty" parameters. Is this at all possible without listing all possible combination of routes (I have a large number of search-able fields)? I understand that route "globbing" maybe play a roll, but I am not sure how. Thanks.

    Read the article

  • argparse coding issue

    - by Carl Skonieczny
    write a script that takes two optional boolean arguments,"--verbose‚" and ‚"--live", and two required string arguments, "base"and "pattern". Please set up the command line processing using argparse. This is the code I have so far for the question, I know I am getting close but something is not quite right. Any help is much appreciated.Thanks for all the quick useful feedback. def main(): import argparse parser = argparse.ArgumentParser(description='') parser.add_argument('base', type=str) parser.add_arguemnt('--verbose', action='store_true') parser.add_argument('pattern', type=str) parser.add_arguemnt('--live', action='store_true') args = parser.parse_args() print(args.base(args.pattern))

    Read the article

  • typeof === "undefined" vs. != null

    - by Thor Thurn
    I often see JavaScript code which checks for undefined parameters etc. this way: if (typeof input !== "undefined") { // do stuff } This seems kind of wasteful, since it involves both a type lookup and a string comparison, not to mention its verbosity. It's needed because 'undefined' could be renamed, though. My question is: How is that code any better than this approach: if (input != null) { // do stuff } As far as I know, you can't redefine null, so it's not going to break unexpectedly. And, because of the type-coercion of the != operator, this checks for both undefined and null... which is often exactly what you want (e.g. for optional function parameters). Yet this form does not seem widespread, and it even causes JSLint to yell at you for using the evil != operator. Why is this considered bad style?

    Read the article

  • Filling a LOV in Oracle Apex based on data in another text box

    - by Martin Pugh
    I am fairly new to Oracle Apex, and have a problem. Our application currently has a method of entering data, with several text boxes and Optional List of Values. I would like to have an LOV based on information in another text box like so: select APPOINTMENT_ID PATIENT_ID from APPOINTMENT where PATIENT_ID = :P9_PAT_NUM where P9_PAT_NUM is a patient number in a text box. However, this would apparently only work if the text box has already been submitted, else it assumes the text box is null. Is there any way to get this working with an LOV, or perhaps some other method?

    Read the article

  • "No row with the given identifier exists" although it DOES exist!

    - by roesslerj
    Hello all! I am using Hibernate and getting Exception in thread "main" org.hibernate.ObjectNotFoundException: No row with the given identifier exists: [<MyDbObject>#271] What is pretty weird about this error is, that the object with the given id exists in the database. I inserted the problematic record in another run of the application. If I access it in the same run (i.e. same hibernate session) there seem to be no problems retrieving the data. Just because it could be a fault of the mapping: public class ProblemClass { @ManyToOne(optional = false) private MyDbObject myDbObject; } public class MyDbObject { @OneToMany(mappedBy = "myDbObject") private List<ProblemClass> problemClasses; } I have absolutely no clue even where to look at. Any hints highly appreciated!

    Read the article

  • PHP: How to Pass child class __construct() arguments to parent::__construct() ?

    - by none
    I have a class in PHP like so: class ParentClass { function __construct($arg) { // Initialize a/some variable(s) based on $arg } } It has a child class, as such: class ChildClass extends ParentClass { function __construct($arg) { // Let the parent handle construction. parent::__construct($arg); } } What if, for some reason, the ParentClass needs to change to take more than one optional argument, which I would like my Child class to provide "just in case"? Unless I re-code the ChildClass, it will only ever take the one argument to the constructor, and will only ever pass that one argument. Is this so rare or such a bad practice that the usual case is that a ChildClass wouldn't need to be inheriting from a ParentClass that takes different arguments? Essentially, I've seen in Python where you can pass a potentially unknown number of arguments to a function via somefunction(*args) where 'args' is an array/iterable of some kind. Does something like this exist in PHP? Or should I refactor these classes before proceeding?

    Read the article

  • Importing a spreadsheet, but having trouble.

    - by Chris Phelps
    I have a form that allows a user to import a spreadsheet. This spreadsheet is generally static when it comes to column headers, but now the users want to be able to include an optional column (called Notes). My code crashes when I try to read the column from the spreadsheet if it doesn't exist. Dim objCommand As New OleDbCommand() objCommand = ExcelConnection() 'function that opens spreadsheet and returns objCommand Dim reader As OleDbDataReader reader = objCommand.ExecuteReader() While reader.Read() Dim Employee As String = Convert.ToString(reader("User")) Dim SerialNUM As String = Convert.ToString(reader("serialno")) **Dim Notes As String = Convert.ToString(reader("notes"))** If the spreadsheet contains a Notes column, all goes well. If not, crash. How can I check to see if the Notes column exists in the spreadsheet to avoid the crash?

    Read the article

  • Archiving Database Tables using Java

    - by HonorGod
    My application demands archiving database tables between sybase and db2 and vice-a-versa and within(db2 to db2 and sybase to sybase) using java. I am trying to understand the best strategies around in terms performance, implementation, ease of use and scalability. Here is my current process - source and destination tables with the acceptable parameters (from java) are defined within xml. the application reads the source and destination configurations and execute them sequentially. destination is sometime optional when source is just deleting data from a specific table or when the source is just calling a stored procedure. dataset between source and destination is extremely large (in millions) From top of my head, it looks like I can define dependencies between multiple source and destination combination and have them execute in parallel in multiple treads. But will this improve any performance(i hope it will)? Are there any open-source frameworks for data archiving using java? Any other thoughts on the implements side will be really helpful. Thanks

    Read the article

  • Best way to model Customer <--> Address

    - by Jen
    Every Customer has a physical address and an optional mailing address. What is your preferred way to model this? Option 1. Customer has foreign key to Address Customer (id, phys_address_id, mail_address_id) Address (id, street, city, etc.) Option 2. Customer has one-to-many relationship to Address, which contains a field to describe the address type Customer (id) Address (id, customer_id, address_type, street, city, etc.) Option 3. Address information is de-normalized and stored in Customer Customer (id, phys_street, phys_city, etc. mail_street, mail_city, etc.) One of my overriding goals is to simplify the object-relational mappings, so I'm leaning towards the first approach. What are your thoughts?

    Read the article

< Previous Page | 38 39 40 41 42 43 44 45 46 47 48 49  | Next Page >