Search Results

Search found 20401 results on 817 pages for 'null coalescing operator'.

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

  • Operator precedence in scala

    - by Jeriho
    I like scala's propose of operator precedence but in some rare case unmodified rules may be inconvenient because you have restrictions in naming your methods. Is there in scala ways to define another rules for a class/file/etc? If not would it be resolved in future?

    Read the article

  • how to call operator () in c++

    - by anish
    in c++ i have following code class Foobar{ public: Foobar * operator()(){ return new Foobar; } My quesion is how to call the (); if i do Foobar foo() the constructor gets called i am confused about behaviour of () can some explain me

    Read the article

  • Where namespace does operator<< (stream) go to?

    - by aaa
    If I have have some overloaded ostream operators, defined for library local objects, is its okay for them to go to std namespace? If I do not declare them in std namespace, then I must use using ns:: operator <<. As a possible follow-up question, are there any operators which should go to standard or global namespace?

    Read the article

  • typedef and operator overloading in C

    - by jocapco
    Suppose I typedef an integer or integer array or any known type: typedef int int2 Then I overload operator * for int2 pairs, now if I initialize variables a and b as int. Then will my * between a and b be the overloaded * ? How do I achieve overloading an int and yet also use * for int the way they are. Should I create a new type?

    Read the article

  • Are there supposed to be more restrictions on operator->* overloads?

    - by Potatoswatter
    I was perusing section 13.5 after refuting the notion that built-in operators do not participate in overload resolution, and noticed that there is no section on operator->*. It is just a generic binary operator. Its brethren, operator->, operator*, and operator[], are all required to be non-static member functions. This precludes definition of a free function overload to an operator commonly used to obtain a reference from an object. But the uncommon operator->* is left out. In particular, operator[] has many similarities. It is binary (they missed a golden opportunity to make it n-ary), and it accepts some kind of container on the left and some kind of locator on the right. Its special-rules section, 13.5.5, doesn't seem to have any actual effect except to outlaw free functions. (And that restriction even precludes support for commutativity!) So, for example, this is perfectly legal (in C++0x, remove obvious stuff to translate to C++03): #include <utility> #include <iostream> #include <type_traits> using namespace std; template< class F, class S > typename common_type< F,S >::type operator->*( pair<F,S> const &l, bool r ) { return r? l.second : l.first; } template< class T > T & operator->*( pair<T,T> &l, bool r ) { return r? l.second : l.first; } template< class T > T & operator->*( bool l, pair<T,T> &r ) { return l? r.second : r.first; } int main() { auto x = make_pair( 1, 2.3 ); cerr << x->*false << " " << x->*4 << endl; auto y = make_pair( 5, 6 ); y->*(0) = 7; y->*0->*y = 8; // evaluates to 7->*y = y.second cerr << y.first << " " << y.second << endl; } I can certainly imagine myself giving into temp[la]tation. For example, scaled indexes for vector: v->*matrix_width[5] = x; Did the standards committee forget to prevent this, was it considered too ugly to bother, or are there real-world use cases?

    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

  • Union,Except and Intersect operator in Linq

    - by Jalpesh P. Vadgama
    While developing a windows service using Linq-To-SQL i was in need of something that will intersect the two list and return a list with the result. After searching on net i have found three great use full operators in Linq Union,Except and Intersect. Here are explanation of each operator. Union Operator: Union operator will combine elements of both entity and return result as third new entities. Except Operator: Except operator will remove elements of first entities which elements are there in second entities and will return as third new entities. Intersect Operator: As name suggest it will return common elements of both entities and return result as new entities. Let’s take a simple console application as  a example where i have used two string array and applied the three operator one by one and print the result using Console.Writeline. Here is the code for that. C#, using GeSHi 1.0.8.6 using System; using System.Collections.Generic; using System.Linq; using System.Text;     namespace ConsoleApplication1 {     class Program     {         static void Main(string[] args)         {             string[] a = { "a", "b", "c", "d" };             string[] b = { "d","e","f","g"};               var UnResult = a.Union(b);             Console.WriteLine("Union Result");               foreach (string s in UnResult)             {                 Console.WriteLine(s);                          }               var ExResult = a.Except(b);             Console.WriteLine("Except Result");             foreach (string s in ExResult)             {                 Console.WriteLine(s);             }               var InResult = a.Intersect(b);             Console.WriteLine("Intersect Result");             foreach (string s in InResult)             {                 Console.WriteLine(s);             }             Console.ReadLine();                        }          } }   Parsed in 0.022 seconds at 45.54 KB/s Here is the output of console application as Expected. Hope this will help you.. Technorati Tags: Linq,Except,InterSect,Union,C#

    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

  • Using LIKE operator in LINQ to Entity

    - by Draconic
    Hi, everybody! Currently in our project we are using Entity Framework and LINQ. We want to create a search feature where the Client fills different filters but he isn't forced to. To do this "dynamic" query in LINQ, we thought about using the Like operator, searching either for the field, or "%" to get everything if the user didn't fill that field. The joke's on us when we discovered it didn't support Like. After some searching, we read several answers where it's sugested to use StartsWith, but it's useless for us. Is the only solution using something like: ObjectQuery<Contact> contacts = db.Contacts; if (pattern != "") { contacts = contacts.Where(“it.Name LIKE @pattern”); contacts.Parameters.Add(new ObjectParameter(“pattern”, pattern); } However, we'd like to stick with linq only. Happy coding!

    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

  • PHP fopen returning null on files that work fine with include and get_file_contents

    - by brad allred
    Hi, I have XAMPP installed on a windows 2000 server. everything is working great except the PHP fopen function. I can neither create nor open files with it. the strange thing is that i can include/require/file_get_contents/other file related functions; also fopen does not generate any errors or notices it just returns NULL. I have gone as far as to grant full control of the file and all enclosing folders to everybody but i still get NULL instead of a file pointer. I have tried this on php 5.2.9, 5.2.13, and 5.3.1 with the same effect. i have gone through the php.ini file looking for something that is breaking it; i have even tried deleting and using the basic ini file from a linux box where fopen is working and still nothing. I know i have to restart apache after changing my ini and all that and have been (I have even restarted the server) so thats not it. I am at this poing assuming it is an apache configuration issue somehow, tomorrow im going to run a test through php-cli to make sure. I really don't want to bruise my head anymore over this can some apache/php wizard come to my aid? Hi guys, thanks for the responses. you are right is is not any config problem. the problem has to be with one of my dlls or one of my included files. I just tried the same code that isn't working in a new file without any include and i disabled my custom libraries and it worked. for the record here is what I was doing that wasn't working: $test_file = 'c:\\test.csv';//everybody has full control. is very large. if(file_exists($test_file) && is_readable($test_file)){ $fp = fopen($test_file, 'r'); echo var_export($fp, true);//outputs NULL. on my linux box this is a number. if($fp !== false){ //do the work fread($fp, 10);//throws the error that $fp is not a valid file handle } } something that i am including must be breaking fopen somehow. works as expected in new file with no includes.

    Read the article

  • JPA Cascading Delete: Setting child FK to NULL on a NOT NULL column

    - by JBristow
    I have two tables: t_promo_program and t_promo_program_param. They are represented by the following JPA entities: @Entity @Table(name = "t_promo_program") public class PromoProgram { @Id @Column(name = "promo_program_id") private Long id; @OneToMany(cascade = {CascadeType.REMOVE}) @JoinColumn(name = "promo_program_id") private List<PromoProgramParam> params; } @Entity @Table(name = "t_promo_program_param") public class PromoProgramParam { @Id @Column(name = "promo_program_param_id") private Long id; //@NotNull // This is a Hibernate annotation so that my test db gets created with the NOT NULL attribute, I'm not married to this annotation. @ManyToOne @JoinColumn(name = "PROMO_PROGRAM_ID", referencedColumnName = "promo_program_id") private PromoProgram promoProgram; } When I delete a PromoProgram, Hibernate hits my database with: update T_PROMO_PROGRAM_PARAM set promo_program_id=null where promo_program_id=? delete from t_promo_program where promo_program_id=? and last_change=? I'm at a loss for where to start looking for the source of the problem.

    Read the article

  • Zend database query result converts column values to null

    - by David Zapata
    Hi again. I am using the next instructions to get some registers from my Database. Create the needed models (from the params module): $obj_paramtype_model = new Params_Model_DbTable_Paramtype(); $obj_param_model = new Params_Model_DbTable_Param(); Getting the available locales from the database // This returns a Zend_Db_Table_Row_Abstract class object $obj_paramtype = $obj_paramtype_model->getParamtypeByValue('available_locales'); // This is a query used to add conditions to the next sentence. This is executed from the Params_Model_DbTable_Param instance class, that depends from Params_Model_DbTable_Paramtype class (reference map and dependentTables arrays are fine in both classes) $obj_select = $this->select()->where('deleted_at IS NULL')->order('name'); // Execute the next query, applying the select restrictions. This returns a Zend_Db_Table_Rowset_Abstract class object. This means "Find Params by Paramtype" $obj_params_rowset = $obj_paramtype->findDependentRowset('Params_Model_DbTable_Param', 'Paramtype', $obj_paramtype); // Here the firebug log displays the queries.... Zend_Registry::get('log')->debug($obj_params_rowset); I have a profiler for all my DB executions from Zend. At this point the log and profiler objects (that includes Firebug writers), shows the executed SQL Queries, and the last line displays the resulting Zend_Db_Table_Rowset_Abstract class object. If I execute the SQL Queries in some MySQL Client, the results are as expected. But the Zend Firebug log writer displays as NULL the column values with latin characters (ñ). In other words, the external SQL client shows es_CO | Español de Colombia and en_US | English of United States but the Query results from Zend displays (and returns) es_CO | null and en_US | English of United States. I've deleted the ñ character from Español de Colombia and the query results are just fine in my Zend Log Firebug screen, and in the final Zend Form element. The MySQL database, tables and columns are in UTF-8 - utf8_unicode_ci collation. All my zend framework pages are in UTF-8 charset. I'm using XAMPP 1.7.1 (PHP 5.2.9, Apache at port 90 and MySQL 5.1.33-community) running on Windows 7 Ultimate; Zend Framework 1.10.1. I'm sorry if there is so much information, but I don't really know why could that happen, so I tryed to provide as much related information as I could to help to find some answer.

    Read the article

  • SQL count NULL cells

    - by Giuseppe
    Dear All, I have the following problem. I have a table in a db, with many columns. I can do different kind of select queries, to show, for example, for each record that satisfies a condition: all cells from columns with names ending in _t0 all cells from columns with names ending in _t1 ... To get the column lists to form the queries I use the information schema. Now, the problem: each query returns a record with a subset of the columns of the big table. This means that I can get a row of (all!) NULLs. How can I ask my query to reject such rows without having to type in explicitely the column names (i.e. by saying where col_1 is not null, col_2 is not null...)? Is it possible? Thanks in advance!!! Sep

    Read the article

  • Binding UserControl to a NULL DataContext

    - by user634981
    I have a UserControl and am binding its DataContext to an object. I also bind the IsEnabled property of the UserControl to a boolean property of that object eg: <my:MyUserControl DataContext="{Binding Items.SelectedItem}" IsEnabled="{Binding Path=IsEditable}"/> This works fine provided Items.SelectedItem is not null. However, if it is null (which can happen sometimes if the Items collection is empty), the IsEnabled binding does not get evaluated and is set to true, which is not the desired behaviour. I've tried using a MultiBinding but without success because I don't know if it's possible to bind to the DataContext. I've also tried using a DataTrigger, but again without success. Would somebody kindly point me in the right direction as to the correct way I should be doing this. Thanks!

    Read the article

  • Copying non null-terminated unsigned char array to std::string

    - by karlphillip
    If the array was null-terminated this would be pretty straight forward: unsigned char u_array[4] = { 'a', 's', 'd', '\0' }; std::string str = reinterpret_cast<char*>(u_array); std::cout << "-> " << str << std::endl; However, I wonder what is the most appropriate way to copy a non null-terminated unsigned char array, like the following: unsigned char u_array[4] = { 'a', 's', 'd', 'f' }; into a std::string. Is there any way to do it without iterating over the unsigned char array? Thank you all.

    Read the article

  • What division operator symbol would you pick?

    - by Mackenzie
    I am currently designing and implementing a small programming language as an extra-credit project in a class I'm taking. My problem is that the language has three numeric types: Long, Double, and Fraction. Fractions can be written in the language as proper or improper fractions (e.g. "2 1/3" or "1/2"). This fact leads to problems such as "2/3.5" (Long/Double) and "2/3"(Long/Long) not being handled correctly by the lexer.The best solution that I see is to change the division operator. So far, I think "\" is the best solution since "//" starts comments. Would you pick "\", if you were designing the language? Would you pick something else? If so, what? Note: changing the way fractions are written is not possible. Thanks in advance for your help,

    Read the article

  • Javascript / jQuery Exec turns up Null

    - by Matrym
    How do I skip over this next line if it turns out to be null? Currently, it (sometimes) "breaks" and prevents the script from continuing. var title = (/(.*?)<\/title/m).exec(response)[1]; $.get(url, function(response){ var title = (/<title>(.*?)<\/title>/m).exec(response)[1]; if (title == null || title == undefined){ return false; } var words = title.split(' '); $.each(words, function(index, value){ $link.highlight(value + " "); $link.highlight(" " + value); }); });

    Read the article

  • NULL In a Class Destructor

    - by Hyper-DarkStar
    Simple question; Is it pointless to set a pointer( which allocates heap memory ) to NULL in the destructor? class SampleClass { public: SampleClass( int Init = 0 ) { Value = new int( Init ); } ~SampleClass( void ) { delete Value; Value = NULL; // Is this pointless? } int *Value; }; While on the subject of classes, when should I use the explicit keyword? Thanks.

    Read the article

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