Search Results

Search found 18854 results on 755 pages for 'mr null'.

Page 6/755 | < Previous Page | 2 3 4 5 6 7 8 9 10 11 12 13  | Next Page >

  • Accommodating null values in a list?

    - by h259bws
    Hi, I'm new to Java and Groovy and am running into trouble with the following Groovy script. I created this whittled down version of a larger script to facilitate debugging. The script is iterating through a list trying to calc a running total of the values of all objects in the list. Some or all of these objects' values may be null. Script import org.apache.commons.lang.math.NumberUtils class Field { def name def value } def fields = [ new Field(name:'Annuities %', value:75), new Field(name:'Other %', value:null), ] //def totalFunding = fields.inject(0) {int total, Field myField - // total + NumberUtils.toInt(myField.value,0) as Integer def totalFunding = fields.inject(0) {int total, Field myField - total + myField?.value as Integer } It gets this error: Exception thrown: java.lang.NullPointerException java.lang.NullPointerException at Script3$_run_closure1.doCall(Script3:15) at Script3.run(Script3:14) What is the correct way to accomodate null values? Thanks, Betsy

    Read the article

  • Calculating the null space of a matrix

    - by Ainsworth
    I'm attempting to solve a set of equations of the form Ax = 0. A is known 6x6 matrix and I've written the below code using SVD to get the vector x which works to a certain extent. The answer is approximately correct but not good enough to be useful to me, how can I improve the precision of the calculation? Lowering eps below 1.e-4 causes the function to fail. from numpy.linalg import * from numpy import * A = matrix([[0.624010149127497 ,0.020915658603923 ,0.838082638087629 ,62.0778180312547 ,-0.336 ,0], [0.669649399820597 ,0.344105317421833 ,0.0543868015800246 ,49.0194290212841 ,-0.267 ,0], [0.473153758252885 ,0.366893577716959 ,0.924972565581684 ,186.071352614705 ,-1 ,0], [0.0759305208803158 ,0.356365401030535 ,0.126682113674883 ,175.292109352674 ,0 ,-5.201], [0.91160934274653 ,0.32447818779582 ,0.741382053883291 ,0.11536775372698 ,0 ,-0.034], [0.480860406786873 ,0.903499596111067 ,0.542581424762866 ,32.782593418975 ,0 ,-1]]) def null(A, eps=1e-3): u,s,vh = svd(A,full_matrices=1,compute_uv=1) null_space = compress(s <= eps, vh, axis=0) return null_space.T NS = null(A) print "Null space equals ",NS,"\n" print dot(A,NS)

    Read the article

  • using dummy row with NOT NULL to solve DEFAUT NULL

    - by Tony38
    I know having DEFAULT NULLS is not a good practice but I have many optional lookup values which are FK in the system so to solve this issue here is what i am doing: I use NOT NULL for every FK / lookup valve field. I have the first row in every table which is PK id = 1 as a dummy row with just "none" in all the columns. this way I can use NOT NULL in my schema and if needed reference to the none row values which should be null. Is this a good design or any other work arounds?

    Read the article

  • rails belongs_to sql statement using NULL id

    - by Team Pannous
    When paginating through our Phrase table it takes very long to return the results. In the sql logs we see many sql requests which don't make sense to us: Phrase Load (7.4ms) SELECT "phrases".* FROM "phrases" WHERE "phrases"."id" IS NULL LIMIT 1 User Load (0.4ms) SELECT "users".* FROM "users" WHERE "users"."id" IS NULL LIMIT 1 These add up significantly. Is there a way to prevent querying against null ids? This is the underlying model: class Phrase < ActiveRecord::Base belongs_to :user belongs_to :response, :class_name => "Phrase", :foreign_key => "next_id" end

    Read the article

  • Is there an "opposite" to the null coalescing operator? (…in any language?)

    - by Jay
    null coalescing translates roughly to return x, unless it is null, in which case return y I often need return null if x is null, otherwise return x.y I can use return x == null ? null : x.y; Not bad, but that null in the middle always bothers me -- it seems superfluous. I'd prefer something like return x :: x.y;, where what follows the :: is evaluated only if what precedes it is not null. I see this as almost an opposite to null coalescence, kind of mixed in with a terse, inline null-check, but I'm [almost] certain that there is no such operator in C#. Are there other languages that have such an operator? If so, what is it called? (I know that I can write a method for it in C#; I use return NullOrValue.of(x, () => x.y);, but if you have anything better, I'd like to see that too.)

    Read the article

  • A null value should be considered as 0 when addition of it is done with decimal value.

    - by Harikrishna
    There are three column in the datatable A,B and C. Now each column is type of decimal. Now I am doing like dt.Columns["A"].Expression="B+C"; to make addition of Column B's record and column C's record. Now if there is any value of B or C is null then addition of B and C will be null like B's value is 3 and C's value is null for first row then B+C(3+null) will be null which is not appropriate, the result of addition should be 3.If I replace 0 instead of null then it will be ok.But whereever there is null value in the records it should be remain it is and it should not be replaced by 0.That is null value should not be replaced by 0 and when addition of null value is done with any decimal value null value should be considered as 0. Is it possible,how can we do this ?

    Read the article

  • Can PCRE regex match a null character?

    - by Keng
    I have a text source with nulls in it and I need to pull them out along with my regex pattern. Can regex even match a null character? I only realized I had them when my pattern refused to match and when I pasted it into Notepad++ it showed all the null characters.

    Read the article

  • Mysql Left Join Null Result

    - by Ozzy
    I have this query SELECT articles.*, users.username AS `user` FROM `articles` LEFT JOIN `users` ON articles.user_id = users.id ORDER BY articles.timestamp Basically it returns the list of articles and the username that the article is associated to. Now if there is no entry in the users table for a particular user id, the users var is NULL. Is there anyway to make it that if its null it returns something like "User Not Found"? or would i have to do this using php?

    Read the article

  • Can a constructor return a NULL value?

    - by Sanctus2099
    I know constructors don't "return" anything but for instance if I call CMyClass *object = new CMyClass() is there any way to make object to be NULL if the constructor fails? In my case I have some images that have to be loaded and if the file reading fails I'd like it to return null. Is there any way to do that? Thanks in advance.

    Read the article

  • Checking for a null int value from a Java ResultSet

    - by ian_scho_es
    In Java I'm trying to test for a null value, from a ResultSet, where the column is being cast to a primitive int type. int iVal; ResultSet rs = magicallyAppearingStmt.executeQuery(query); if (rs.next()) { if (rs.getObject("ID_PARENT") != null && !rs.wasNull()) { iVal = rs.getInt("ID_PARENT"); } } From the code fragment above, is there a better way to do this, and I assume that the second wasNull() test is redundant? Educate us, and Thanks

    Read the article

  • Is null a class in java?

    - by Somerandomeguy
    According to, http://www.freshvanilla.org:8080/display/www/Java+Interview+Questions Under, Which class is the superclass of every class? null seems to be the answer. I found that new Object().getClass().getSuperClass() verifies the answer as correct. But can null be considered a class? I see all primitive data types are represented as Class objects from java[dot]sun.com/j2se/1.4.2/docs/api/java/lang/Class.html

    Read the article

  • Android ListView: getTag() returns null

    - by TianDong
    Hallo all, I have a ListView which contains a Button in each line. The following code is part of the getView() Method public View getView(final int position, View convertView, ViewGroup parent) { View row = convertView; TextView tv; Button saveA_button; EditText edittext; FITB_ViewWrapper wrapper; if (row == null) { LayoutInflater li = (LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE); if (ChooseMode_Act.modeInfo.equalsIgnoreCase("Training")) { row = li.inflate(R.layout.exercise_for_training_fitb,parent, false); }else { row = li.inflate(R.layout.exercise_for_exam_fitb,parent, false); } wrapper=new FITB_ViewWrapper(row); row.setTag(wrapper); if (ChooseMode_Act.modeInfo.equalsIgnoreCase("Exam")) { saveA_button=wrapper.getSaveAnswer_Button(); OnClickListener l=new OnClickListener() { @Override public void onClick(View v) { Integer mp=(Integer)v.getTag(); Log.i("mp","my Position is: "+mp); } }; saveA_button.setOnClickListener(l); } }else { wrapper=(FITB_ViewWrapper) row.getTag(); } For my App i need to known to which item the Button belongs to, so i try to detect it. The code Log.i("mp","my Position is: "+mp); puts out a message: mp myPosition is: null I can't understand, why do i get a "null" but not an Integer? How can i find out the Position of an Item in a ListView? Thanks a lot.

    Read the article

  • Erlang ODBC parameter query with null parameters

    - by Schlomer
    Is it possible to pass null values to parameter queries? For example Sql = "insert into TableX values (?,?)". Params = [{sql_integer, [Val1]}, {sql_float, [Val2]}]. % Val2 may be a float, or it may be the atom, undefined odbc:param_query(OdbcRef, Sql, Params). Now, of course odbc:param_query/3 is going to complain if Val2 is undefined when trying to match to a sql_float, but my question is... Is it possible to use a parameterized query, such as: Sql = "insert into TableY values (?,?,?,?,?,?,?,?,?)". with any null parameters? I have a use case where I am dumping a large number of real-time data into a database by either inserting or updating. Some of the tables I am updating have a dozen or so nullable fields, and I do not have a guarantee that all of the data will be there. Concatenating a SQL together for each query, checking for null values seems complex, and the wrong way to do it. Having a parameterized query for each permutation is simply not an option. Any thoughts or ideas would be fantastic! Thank you!

    Read the article

  • wave.getState() returns null

    - by RMorrisey
    When trying to call wave.getState() in my Google Wave gadget, I get back null (no state object). How can I initialize the Wave state object? I am working in the Wave Sandbox. My ModulePrefs contains the following: <Require feature="wave" /> <Require feature="rpc"/> I got the "rpc" feature from some google groups post when searching for a fix, but it doesn't seem to be any help. The gadget contains a jQuery plugin, which defines the classes I use (not shown), attaches an event handler to the link that shows up in edit mode, and sets up the callback methods with the google wave gadget initializer: $.fn.extend({ $.gork.InitPass.newButtonClick = function newButtonClick() { var jer = new $.gork.InitPass.Player('Jeremias', 12, 2); var delta = {}; delta[jer.name] = jer.serialize(); wave.getState().submitDelta(delta); }; $.gork.InitPass.modeCallback = function modeCallback() { var state = wave.getState(); var mode = wave.getMode(); $.gork.InitPass.getContainer().ipCombatState(state, (mode == wave.Mode.EDIT)); }; $.gork.InitPass.stateCallback = function stateCallback() { $.gork.InitPass.getContainer().ipCombatState( wave.getState(), (wave.getMode() == wave.Mode.EDIT)); alert('state'); }; $.gork.InitPass.init = function init() { if (wave && wave.isInWaveContainer()) { var mode = wave.getMode(); $('.gork-ip-container').ipCombatState(null, (mode == wave.Mode.EDIT)); wave.setModeCallback($.gork.InitPass.modeCallback); wave.setStateCallback($.gork.InitPass.stateCallback); } }; })(jQuery); gadgets.util.registerOnLoadHandler($.gork.InitPass.init); $(function ready() { $.gork.InitPass.getContainer().find('.gork-ip-edit .addSection a.newButton').click( $.gork.InitPass.newButtonClick); }); So there are two main pieces of functionality here: When the mode changes, ipCombatState(...) is called. This changes the visual appearance of the gadget when the user puts the gadget in Edit mode (CTRL+E), by hiding the view DIV and displaying the edit DIV. The newButtonClick callback (which is attached to the link "a.newButton" in the edit container) is supposed to add Jeremias (Nate's Shadowrun character) to the gadget state, so that he'll be appear as a table row in edit mode. I have verified that the initializer method is called, and the view/edit mode switch works just fine (except the state is null). When I click on the new button link (the link at the bottom in edit mode), and trigger the newButtonClick handler, I get an error because wave.getState() also returns null. How can I initialize the wave state so that I can work with it? The purpose of my gadget will be to keep track of combat initiative order in a Shadowrun tabletop game (4th Ed). You can test it out in Wave and see what I have so far: http://gorkwobble.herobo.com/wave/init-pass.xml The actual javascript code is externalized to: http://gorkwobble.herobo.com/wave/init-pass.js P.S. If any Shadowrun players read this, and want to hear about it when I get the gadget working, leave a comment and I'll wave you.

    Read the article

  • Silverlight 4 HttpWebRequest user agent string is null

    - by Dan B
    The problem I have a page with a silverlight object. It attempts to retrieve XML from the page. But I am struggling with a security exception. I have this code working brilliantly in WPF. When using a website hosting a silverlight application with the same code, the user agent string of the HttpRequest object is null (and seemingly cannot be set). In fact there is no header information at all - this causes a security exception when attempting to make my asynchronous call. The question Why is the user-agent string (and header information) null in my silverlight 4 application when making an asynchronous call using HttpWebRequest? Thanks in advance!

    Read the article

  • MVC null model problem

    - by femi
    hello, i have created two create actions..one to call the create view and the other to process the create view using httppost. when i call the create view, it gets published correctly , dropdowns and all. the problem is that when i fill out the create form and click on the submit button, i get an error; Object reference not set to an instance of an object. My first thoughts are that i am passing a null model to the httppost create action.. How can i check to see if i am passing in a null model to the httppost create action? thanks

    Read the article

  • NULL value when using NSDateFormatter

    - by David A Gibson
    Hello, I am using the following code to try and display in a time in a table cell. TimeSlot *timeSlot = [timeSlots objectAtIndex:indexPath.row]; NSDateFormatter *timeFormat = [[NSDateFormatter alloc] init]; [timeFormat setDateFormat:@"%1m/%1d/%Y"]; NSLog(@"Time: %@", timeSlot.time); NSDate *mydate = timeSlot.time; NSLog(@"Time: %@", mydate); NSString *theTime = [timeFormat stringFromDate:mydate]; NSLog(@"Time: %@", theTime); The log output is this: 2010-04-14 10:23:54.626 MyApp[1080:207] Time: 2010-04-14T10:23:54 2010-04-14 10:23:54.627 MyApp[1080:207] Time: 2010-04-14T10:23:54 2010-04-14 10:23:54.627 MyApp[1080:207] Time: (null) I am new to developing for the iPhone and as it all compiles with no errors or warnings I am at a loss as to why I am getting NULL in the log. Is there anything wrong with this code? Thanks

    Read the article

  • Order by null/not null with ICriteria

    - by Kristoffer
    I'd like to sort my result like this: First I want all rows/objects where a column/property is not null, then all where the colmn/property is null. Then I want to sort by another column/property. How can I do this with ICriteria? Do I have to create my own Order class, or can it be done with existing code? ICriteria criteria = Session.CreateCriteria<MyClass>() .AddOrder(Order.Desc("NullableProperty")) // What do I do here? IProjection? Custom Order class? .AddOrder(Order.Asc("OtherProperty"));

    Read the article

< Previous Page | 2 3 4 5 6 7 8 9 10 11 12 13  | Next Page >