Search Results

Search found 35561 results on 1423 pages for 'value'.

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

  • C++/CLI value class constraint won't compile. Why?

    - by Simon
    Hello, a few weeks ago a co-worker of mine spent about two hours finding out why this piece of C++/CLI code won't compile with Visual Studio 2008 (I just tested it with Visual Studio 2010... same story). public ref class Test { generic<class T> where T : value class void MyMethod(Nullable<T> nullable) { } }; The compiler says: Error 1 error C3214: 'T' : invalid type argument for generic parameter 'T' of generic 'System::Nullable', does not meet constraint 'System::ValueType ^' C:\Users\Simon\Desktop\Projektdokumentation\GridLayoutPanel\Generics\Generics.cpp 11 1 Generics Adding ValueType will make the code compile. public ref class Test { generic<class T> where T : value class, ValueType void MyMethod(Nullable<T> nullable) { } }; My question is now. Why? What is the difference between value class and ValueType?

    Read the article

  • How to make dropdownlist show a selected value in asp.net mvc?

    - by Pandiya Chendur
    I have an edit page with a Html.DropDownList in it....I cant show the dropdownlist value it always shows up with Select instead i want to make the dropdown show an item as selected based on a model value say Model.Mes_Id... Any suggestion how it can be done... <p> <label for="MeasurementTypeId">MeasurementType:</label> <%= Html.DropDownList("MeasurementType", // what should i give here?)%> <%= Html.ValidationMessage("MeasurementTypeId", "*") %> </p> EDIT: It has the list items but i want to show a value selected in the edit view... public ActionResult Edit(int id) { var mesurementTypes = consRepository.FindAllMeasurements(); ViewData["MeasurementType"] = mesurementTypes; var material = consRepository.GetMaterial(id); return View("Edit", material); }

    Read the article

  • New article available in "SOA Suite Essentials for WLI Users" series: Dynamic Data Lookup in a Busin

    - by simone.geib
    It is my pleasure to announce the publishing of another article in our "SOA Suite Essentials for WLI Users" series: "Dynamic Data Lookup in a Business Process: Meta Data Cache Control in Oracle WebLogic Integration and Domain Value Maps in SOA Suite". This article explains how dynamic data can be retrieved in a business process using Domain Value Maps in SOA Suite and shows the similarities to the WLI XML MetaData Cache Control. Lots of customers have asked about this comparison and I hope they will find it useful. The article follows "Setting Web Service and JCA Adapter Endpoints Dynamically in Oracle SOA Suite" which describes how web services and JCA adapter endpoints in SOA Suite can be changed at run-time, and so completes the use case where a BPEL process writes to a file (via file adapter) and the output directory and the file name are set dynamically. Please let me know what you think about the series and this specific article.

    Read the article

  • Passing a value from one function to another in jquery...

    - by Pandiya Chendur
    Consider these jquery statements... $(document).ready(function() { getRecordspage(0, itemsPerPage); $(".pager").pagination(maxNumberOfElementsHere, { //my def }); }); I get the value for maxNumberOfElementsHere from getRecordspage function... How to pass that value from getRecordspage function to the next one $(".pager").pagination(maxNumberOfElementsHere.... Any suggestion...

    Read the article

  • How does the CLR (.NET) internally allocate and pass around custom value types (structs)?

    - by stakx
    Question: Do all CLR value types, including user-defined structs, live on the evaluation stack exclusively, meaning that they will never need to be reclaimed by the garbage-collector, or are there cases where they are garbage-collected? Background: I have previously asked a question on SO about the impact that a fluent interface has on the runtime performance of a .NET application. I was particuarly worried that creating a large number of very short-lived temporary objects would negatively affect runtime performance through more frequent garbage-collection. Now it has occured to me that if I declared those temporary objects' types as struct (ie. as user-defined value types) instead of class, the garbage collector might not be involved at all if it turns out that all value types live exclusively on the evaluation stack. What I've found out so far: I did a brief experiment to see what the differences are in the CIL generated for user-defined value types and reference types. This is my C# code: struct SomeValueType { public int X; } class SomeReferenceType { public int X; } . . static void TryValueType(SomeValueType vt) { ... } static void TryReferenceType(SomeReferenceType rt) { ... } . . var vt = new SomeValueType { X = 1 }; var rt = new SomeReferenceType { X = 2 }; TryValueType(vt); TryReferenceType(rt); And this is the CIL generated for the last four lines of code: .locals init ( [0] valuetype SomeValueType vt, [1] class SomeReferenceType rt, [2] valuetype SomeValueType <>g__initLocal0, // [3] class SomeReferenceType <>g__initLocal1, // why are these generated? [4] valuetype SomeValueType CS$0$0000 // ) L_0000: ldloca.s CS$0$0000 L_0002: initobj SomeValueType // no newobj required, instance already allocated L_0008: ldloc.s CS$0$0000 L_000a: stloc.2 L_000b: ldloca.s <>g__initLocal0 L_000d: ldc.i4.1 L_000e: stfld int32 SomeValueType::X L_0013: ldloc.2 L_0014: stloc.0 L_0015: newobj instance void SomeReferenceType::.ctor() L_001a: stloc.3 L_001b: ldloc.3 L_001c: ldc.i4.2 L_001d: stfld int32 SomeReferenceType::X L_0022: ldloc.3 L_0023: stloc.1 L_0024: ldloc.0 L_0025: call void Program::TryValueType(valuetype SomeValueType) L_002a: ldloc.1 L_002b: call void Program::TryReferenceType(class SomeReferenceType) What I cannot figure out from this code is this: Where are all those local variables mentioned in the .locals block allocated? How are they allocated? How are they freed? Why are so many anonymous local variables needed and copied to-and-fro only to initialize my two local variables rt and vt?

    Read the article

  • Custom SNMP Cacti Data Source fails to update

    - by Andrew Wilkinson
    I'm trying to create a custom SNMP datasource for Cacti but despite everything I can check being correct, it is not creating the rrd file, or updating it even when I create it. Other, standard SNMP sources are working correctly so it's not SNMP or permissions that are the problem. I've created a new Data Query, which when I click on "Verbose Query" on the device screen returns the following: + Running data query [10]. + Found type = '3' [SNMP Query]. + Found data query XML file at '/volume1/web/cacti/resource/snmp_queries/syno_volume_stats.xml' + XML file parsed ok. + missing in XML file, 'Index Count Changed' emulated by counting oid_index entries + Executing SNMP walk for list of indexes @ '.1.3.6.1.2.1.25.2.3.1.3' Index Count: 8 + Index found at OID: '.1.3.6.1.2.1.25.2.3.1.3.1' value: 'Physical memory' + Index found at OID: '.1.3.6.1.2.1.25.2.3.1.3.3' value: 'Virtual memory' + Index found at OID: '.1.3.6.1.2.1.25.2.3.1.3.6' value: 'Memory buffers' + Index found at OID: '.1.3.6.1.2.1.25.2.3.1.3.7' value: 'Cached memory' + Index found at OID: '.1.3.6.1.2.1.25.2.3.1.3.10' value: 'Swap space' + Index found at OID: '.1.3.6.1.2.1.25.2.3.1.3.31' value: '/' + Index found at OID: '.1.3.6.1.2.1.25.2.3.1.3.32' value: '/volume1' + Index found at OID: '.1.3.6.1.2.1.25.2.3.1.3.33' value: '/opt' + index_parse at OID: '.1.3.6.1.2.1.25.2.3.1.3.1' results: '1' + index_parse at OID: '.1.3.6.1.2.1.25.2.3.1.3.3' results: '3' + index_parse at OID: '.1.3.6.1.2.1.25.2.3.1.3.6' results: '6' + index_parse at OID: '.1.3.6.1.2.1.25.2.3.1.3.7' results: '7' + index_parse at OID: '.1.3.6.1.2.1.25.2.3.1.3.10' results: '10' + index_parse at OID: '.1.3.6.1.2.1.25.2.3.1.3.31' results: '31' + index_parse at OID: '.1.3.6.1.2.1.25.2.3.1.3.32' results: '32' + index_parse at OID: '.1.3.6.1.2.1.25.2.3.1.3.33' results: '33' + Located input field 'index' [walk] + Executing SNMP walk for data @ '.1.3.6.1.2.1.25.2.3.1.3' + Found item [index='Physical memory'] index: 1 [from value] + Found item [index='Virtual memory'] index: 3 [from value] + Found item [index='Memory buffers'] index: 6 [from value] + Found item [index='Cached memory'] index: 7 [from value] + Found item [index='Swap space'] index: 10 [from value] + Found item [index='/'] index: 31 [from value] + Found item [index='/volume1'] index: 32 [from value] + Found item [index='/opt'] index: 33 [from value] + Located input field 'volsizeunit' [walk] + Executing SNMP walk for data @ '.1.3.6.1.2.1.25.2.3.1.4' + Found item [volsizeunit='1024 Bytes'] index: 1 [from value] + Found item [volsizeunit='1024 Bytes'] index: 3 [from value] + Found item [volsizeunit='1024 Bytes'] index: 6 [from value] + Found item [volsizeunit='1024 Bytes'] index: 7 [from value] + Found item [volsizeunit='1024 Bytes'] index: 10 [from value] + Found item [volsizeunit='4096 Bytes'] index: 31 [from value] + Found item [volsizeunit='4096 Bytes'] index: 32 [from value] + Found item [volsizeunit='4096 Bytes'] index: 33 [from value] + Located input field 'volsize' [walk] + Executing SNMP walk for data @ '.1.3.6.1.2.1.25.2.3.1.5' + Found item [volsize='1034712'] index: 1 [from value] + Found item [volsize='3131792'] index: 3 [from value] + Found item [volsize='1034712'] index: 6 [from value] + Found item [volsize='775904'] index: 7 [from value] + Found item [volsize='2097080'] index: 10 [from value] + Found item [volsize='612766'] index: 31 [from value] + Found item [volsize='1439812394'] index: 32 [from value] + Found item [volsize='1439812394'] index: 33 [from value] + Located input field 'volused' [walk] + Executing SNMP walk for data @ '.1.3.6.1.2.1.25.2.3.1.6' + Found item [volused='1022520'] index: 1 [from value] + Found item [volused='1024096'] index: 3 [from value] + Found item [volused='32408'] index: 6 [from value] + Found item [volused='775904'] index: 7 [from value] + Found item [volused='1576'] index: 10 [from value] + Found item [volused='148070'] index: 31 [from value] + Found item [volused='682377865'] index: 32 [from value] + Found item [volused='682377865'] index: 33 [from value] AS you can see it appears to be returning the correct data. I've also set up data templates and graph templates to display the data. The create graphs for a device screen shows the correct data, and when selecting one row can clicking create a new data source and graph are created. Unfortunately the data source is never updated. Increasing the poller log level shows that it appears to not even be querying the data source, despite it being used? What should my next steps to debug this issue be?

    Read the article

  • Disable error_log. Error_log flooding

    - by user36646
    Hello, i got an webserver running and old version of gambio (xt:commerce fork). The error_log in the dir over the public_html is flooding with errors. About 30mb in 15min. How can I disable this log? I can't fix all the errors. Here are a few examples of the errors: [warn] mod_fcgid: stderr: PHP Notice: Undefined variable: key in /usr/www/users/foo//includes/classes/class.inputfilter.php on line 98 [warn] mod_fcgid: stderr: PHP Notice: Undefined index: in /usr/www/users/foo/templ [warn] mod_fcgid: stderr: in /usr/www/users/foo/templates/gambio/source/inc/xtc_show_category_sectionc.inc.php on line 47 They are all errors of: "mod_fcgid: stderr". I tried to grep "error_log" and "error_report" in the public html dir, but i did not find anything. Here is a part from the phpinfo(): PHP Version 4.4.9 System Linux foobar.com 2.6.26-2-686-bigmem #1 SMP Sat Dec 26 09:26:36 UTC 2009 i686 Build Date Feb 11 2010 13:00:33 Configure Command './configure' '--prefix=/usr/local/php4' '--with-config-file-path=/etc/php4/cgi' '--with-gd' '--with-jpeg-dir' '--with-png-dir' '--with-tiff-dir' '--with-ttf' '--enable-force-cgi-redirect' '--enable-safe-mode' '--with-zlib' '--enable-ftp' '--enable-url-includes' '--enable-gd-native-ttf' '--enable-trans-sid' '--enable-dbase' '--with-db4' '--with-ldap' '--enable-bcmath' '--enable-calendar' '--enable-memory-limit' '--with-mcal=/usr' '--with-bz2' '--with-mod-dav' '--enable-sockets' '--with-kerberos' '--with-imap-ssl' '--enable-gd-imgstrttf' '--with-freetype-dir' '--with-curl' '--with-mysql' '--with-mhash' '--with-gdbm' '--with-pgsql' '--with-gettext' '--with-xml' '--with-mcrypt' '--with-openssl' '--with-dom' '--without-pear' '--enable-exif' '--with-zip' '--enable-wddx' '--disable-cli' '--enable-fastcgi' '--with-imap' '--enable-xslt' '--with-xslt-sablot=/usr/local/lib' '--enable-mbstring' '--with-dom-xslt' '--with-dom-exslt' Server API CGI/FastCGI Virtual Directory Support disabled Configuration File (php.ini) Path /home/httpd/php-ini/foo/php.ini PHP API 20020918 PHP Extension 20020429 Zend Extension 20050606 Debug Build no Zend Memory Manager enabled Thread Safety disabled Registered PHP Streams php, http, ftp, https, ftps, compress.bzip2, compress.zlib **Configuration PHP Core** Directive Local Value Master Value allow_call_time_pass_reference On On allow_url_fopen Off Off always_populate_raw_post_data Off Off arg_separator.input & & arg_separator.output & & asp_tags Off Off auto_append_file no value no value auto_prepend_file no value no value browscap no value no value default_charset no value no value default_mimetype text/html text/html define_syslog_variables Off Off disable_classes no value no value disable_functions no value no value display_errors On On display_startup_errors Off Off doc_root no value no value docref_ext no value no value docref_root no value no value enable_dl On On error_append_string no value no value error_log no value no value error_prepend_string no value no value error_reporting 2039 2039 expose_php On On extension_dir /usr/local/php4/lib/php/extensions/no-debug-non-zts-20020429 /usr/local/php4/lib/php/extensions/no-debug-non-zts-20020429 file_uploads On On gpc_order GPC GPC highlight.bg #FFFFFF #FFFFFF highlight.comment #FF8000 #FF8000 highlight.default #0000BB #0000BB highlight.html #000000 #000000 highlight.keyword #007700 #007700 highlight.string #DD0000 #DD0000 html_errors On On ignore_repeated_errors Off Off ignore_repeated_source Off Off ignore_user_abort Off Off implicit_flush Off Off include_path .:/usr/local/lib/php/ .:/usr/local/lib/php/ log_errors Off Off log_errors_max_len 1024 1024 magic_quotes_gpc On On magic_quotes_runtime Off Off magic_quotes_sybase Off Off max_execution_time 120 120 max_input_nesting_level 500 500 max_input_time -1 -1 memory_limit 128000000 128000000 open_basedir /usr/www/users/foo:/usr/home/foo:/tmp:/usr/local/lib/php:/usr/local/rmagic:/usr/www/users/he/_system_ /usr/www/users/foo:/usr/home/foo:/tmp:/usr/local/lib/php:/usr/local/rmagic:/usr/www/users/he/_system_ output_buffering no value no value output_handler no value no value post_max_size 128000000 128000000 precision 14 14 register_argc_argv On On register_globals Off Off report_memleaks On On safe_mode Off Off safe_mode_exec_dir no value no value safe_mode_gid Off Off safe_mode_include_dir no value no value sendmail_from no value no value sendmail_path /usr/sbin/sendmail -t /usr/sbin/sendmail -t serialize_precision 100 100 short_open_tag On On SMTP localhost localhost smtp_port 25 25 sql.safe_mode Off Off track_errors Off Off unserialize_callback_func no value no value upload_max_filesize 128000000 128000000 upload_tmp_dir /usr/foo/foo/.tmp /usr/foo/.tmp user_dir no value no value variables_order EGPCS EGPCS xmlrpc_error_number 0 0 xmlrpc_errors Off Off y2k_compliance Off Off

    Read the article

  • opening a fancybox from a drop down box and passing the selected value to it directly

    - by andy
    <select name="mySelectboxsituation_found" id="mySelectboxsituation_found"> <option value="100">Firecall</option> <option value="200">FireAlarm</option> <option value="300">FireAlarm2</option> <option value="400">FireAlarm4</option> </select> < a href="#" class="incidenttype" name="all" onClick="JavaScript:var dropdown=document.getElementById('mySelectboxsituation_found');this.href='main_situation_found.php?incident_maincateid='+dropdown.options[dropdown.selectedIndex].value;return true;"/>CLICK HERE < / a> function cleanUp(){ var subsituation_found1 = $("#fancybox- frame").contents().find('input:radio[name=incident_subcate]:checked').val(); } $(".incidenttype").fancybox({ 'width' : 900, 'height' : 600, 'autoScale': false, 'transitionIn': 'none', 'transitionOut': 'none', 'type': 'iframe', 'onCleanup': cleanUp ); }); clicking on "CLICK HERE" opens the fancybox and transfers the value selected in the drop down box. What I would like to do is open the fancy box when i change the value in the dropdown box...without having to click on the click here link.....i know it is posisble using something like _this....but i am not sure and am looking for some direction... ideally some thing like this ... <select name="mySelectboxsituation_found" id="mySelectboxsituation_found" onChange="JavaScript:var dropdown=document.getElementById('mySelectboxsituation_found');this.href='main_situation_found.php?incident_maincateid='+dropdown.options[dropdown.selectedIndex].value;return true;"> <option value="100">Firecall</option> <option value="200">FireAlarm</option> <option value="300">FireAlarm2</option> <option value="400">FireAlarm4</option> </select> does any have an idea how to do it.... I have also tried... function test_fan() { alert(document.getElementById('mySelectboxsituation_found').options[document.getElementById('mySelectboxsituation_found').selectedIndex].value); var dropval =document.getElementById('mySelectboxsituation_found').options[document.getElementById('mySelectboxsituation_found').selectedIndex].value; return dropval; } $(document).ready(function(){ $("#autostart").fancybox({ 'onStart':test_fan, 'width': 800, 'height': 700, 'type': 'iframe', href:'main_situation_found.php?incident_maincateid='+document.getElementById('mySelectboxsituation_found').options[document.getElementById('mySelectboxsituation_found').selectedIndex].value }); <a href="#" id="autostart" style="display:none"></a> <form><select id="mySelectboxsituation_found" onchange="$('#autostart').trigger('click');"> <option value="">select</option> <option value="100">option 1</option> <option value="200">trigger</option> <option value="300">option 3</option> <option value="400">option 4</option> </select> </form> the really funny that happens there is that .... on the alert id do get the value i selected so if i selected alert fancybox window 100 100 nothing shows up empty 200 200 100 300 300 200 400 400 300 the fancybox seems to me the the previously selected values and i am not sure why that is happening... thanks andy

    Read the article

  • jQuery: How to check if a value exists in an array?

    - by Jannis
    Hello, I am trying to write a simple input field validation plugin at the moment (more of a learning exercise really) and thought this would not be too hard, seeing as all I should have to do is: Get input fields Store them in array with each one's value On submit of form check if array contains any empty strings But I seem to fail at writing something that checks for an empty string (read: input with no text inside) inside my array. Here is the code I have so far: var form = $(this), // passed in form element inputs = form.find('input'), // all of this forms input fields isValid = false; // initially set the form to not be valid function validate() { var fields = inputs.serializeArray(); // make an array out of input fields // start -- this does not work for (var n in fields) { if (fields[n].value == "") { isValid = false; console.log('failed'); } else { isValid = true; console.log('passed'); }; } // end -- this does not work }; // close validate() // TRIGGERS inputs.live('keyup blur', function(event) { validate(); }); Any help with how I can check if one of the fields is blank and if so return a isValid = false would be much appreciated. I also played around with the $.inArray("", fields) but this would never return 0 or 1 even when the console.log showed that the fields had no value. Thanks for reading.

    Read the article

  • Set value of hidden field in a form using jQuery's ".val()" doesn't work !

    - by texens
    I've been trying to set the value of a hidden field in a form using jQuery, but without success. Here is a sample code that explains the problem. If I keep the input type to "text", it works without any trouble. But, changing the input type to "hidden", doesn't work ! <html> <head> <script type="text/javascript" src="jquery.js"></script> <script type="text/javascript"> $(document).ready(function(){ $("button").click(function(){ $("input:text#texens").val("tinkumaster"); }); }); </script> </head> <body> <p>Name: <input type="hidden" id="texens" name="user" value="texens" /></p> <button>Change value for the text field</button> </body> </html> I also tried the following workaround, by setting the input type to "text" and then using a "display:none" style for the input box. But, this also fails ! It seems jQuery has some trouble setting hidden or invisible input fields. Any ideas? Is there a workaround for this that actually works? Thanking in anticipation

    Read the article

  • How to get the value of a field in PHP?

    - by user272899
    I need to get the value of a field; I think I am along the right lines but not quite sure this is the proper code. The "Delete Movie" button is where I am trying to get the value of that row like so: value="'.$row['id'].'" Can you help? <?php //connect to database mysql_connect($mysql_hostname,$mysql_user,$mysql_password); @mysql_select_db($mysql_database) or die("<b>Unable to connect to specified database</b>"); //query databae $query = "select * from movielist"; $result=mysql_query($query) or die('Error, insert query failed'); $row=0; $numrows=mysql_num_rows($result); echo "<table border=1>"; echo "<tr> <td>ID</td> <td>Type</td> <td>Title</td> <td>Description</td> <td>Imdb URL</td> <td>Year</td> <td>Genre</td> <td>Actions</td> </tr>"; while($row<$numrows) { $id=mysql_result($result,$row,"id"); $type=mysql_result($result,$row,"type"); $title=mysql_result($result,$row,"title"); $description=mysql_result($result,$row,"description"); $imdburl=mysql_result($result,$row,"imdburl"); $year=mysql_result($result,$row,"year"); $genre=mysql_result($result,$row,"genre"); ?> <tr> <td><?php echo $id; ?></td> <td><?php echo $type; ?></td> <td><?php echo $title; ?></td> <td><?php echo $description; ?></td> <td><?php echo $imdburl; ?></td> <td><?php echo $year; ?></td> <td><?php echo $genre; ?></td> <td> <!-- Delete Movie Button --> <form style="display: inline;" action="delete/" method="post" onsubmit="return movie_delete()"> <input type="hidden" name="moviedeleteid" value="'.$row['id'].'"> <button type="submit" class="tooltip table-button ui-state-default ui-corner-all" title="Delete trunk"><span class="ui-icon ui-icon-trash"></span></button> </form> </td> </tr> <?php $row++; } echo "</table>"; ?>

    Read the article

  • Big Oh notation does not mention constant value

    - by user883561
    I am a programmer and have just started reading Algorithms. I am not completely convinced with the notations namely Bog Oh, Big Omega and Big Theta. The reason is by definition of Big Oh, it states that there should be a function g(x) such that it is always greater than or equal to f(x). Or f(x) <= c.n for all values of n n0. My doubt is the why dont we mention the constant value in the definition? For example. lets say a function 6n+4, we denote it as O(n). but its not true that the definition holds good for all constant value. this holds good only when c = 10 and n = 1. For lesser values of c than 6, the value of n0 increases. So why we do not mention the constant value as a part of the definition.

    Read the article

  • Validate if aTextBox Value Start with a Specific Letter

    - by Vincent Maverick Durano
    In case you will be working on a page that needs to validate the first character of the TextBox entered by a user then here are two options that you can use: Option 1: Using an array   1: <asp:Content ID="Content1" ContentPlaceHolderID="HeadContent" runat="server"> 2: <script type="text/javascript"> 3: function CheckFirstChar(o) { 4: var arr = ['A', 'B', 'C', 'D']; 5: if (o.value.length > 0) { 6: for (var i = 0; i < arr.length; i++) { 7: if (o.value.charAt(0) == arr[i]) { 8: alert('Valid'); 9: return true; 10: } 11: else { 12: alert('InValid'); 13: return false; 14: } 15: } 16: } 17: } 18: </script> 19: </asp:Content> 20: <asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server"> 21: <asp:TextBox ID="TextBox1" runat="server" onblur="return CheckFirstChar(this);"></asp:TextBox> 22: </asp:Content>   The example above uses an array of string for storing the list of  characters that a TextBox value should start with. We then iterate to the array and compare the first character of TextBox value to see if it matches any characters from the array. Option 2: Using Regular Expression (Preferred way)   1: <asp:Content ID="Content1" ContentPlaceHolderID="HeadContent" runat="server"> 2: <script type="text/javascript"> 3: function CheckFirstChar(o) { 4: pattern = /^(A|B|C|D)/; 5: if (!pattern.test(o.value)) { 6: alert('InValid'); 7: return false; 8: } else { 9: alert('Valid'); 10: return true; 11: } 12: } 13: </script> 14: </asp:Content> 15: <asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server"> 16: <asp:TextBox ID="TextBox1" runat="server" onblur="return CheckFirstChar(this);"></asp:TextBox> 17: </asp:Content>   The example above uses regular expression with the pattern  /^(A|B|C|D)/. This will check if the TextBox value starts with A,B,C or D. Please note that it's case sensitive. If you want to allow lower case then you can alter the patter to this /^(A|B|C|D)/i. The i in the last part will cause a case-insensitive search.   That's it! I hope someone find this post useful!

    Read the article

  • Enum types, FlagsAttribute & Zero value – Part 2

    - by nmgomes
    In my previous post I wrote about why you should pay attention when using enum value Zero. After reading that post you are probably thinking like Benjamin Roux: Why don’t you start the enum values at 0x1? Well I could, but doing that I lose the ability to have Sync and Async mutually exclusive by design. Take a look at the following enum types: [Flags] public enum OperationMode1 { Async = 0x1, Sync = 0x2, Parent = 0x4 } [Flags] public enum OperationMode2 { Async = 0x0, Sync = 0x1, Parent = 0x2 } To achieve mutually exclusion between Sync and Async values using OperationMode1 you would have to operate both values: protected void CheckMainOperarionMode(OperationMode1 mode) { switch (mode) { case (OperationMode1.Async | OperationMode1.Sync | OperationMode1.Parent): case (OperationMode1.Async | OperationMode1.Sync): throw new InvalidOperationException("Cannot be Sync and Async simultaneous"); break; case (OperationMode1.Async | OperationMode1.Parent): case (OperationMode1.Async): break; case (OperationMode1.Sync | OperationMode1.Parent): case (OperationMode1.Sync): break; default: throw new InvalidOperationException("No default mode specified"); } } but this is a by design constraint in OperationMode2. Why? Simply because 0x0 is the neutral element for the bitwise OR operation. Knowing this singularity, replacing and simplifying the previous method, you get: protected void CheckMainOperarionMode(OperationMode2 mode) { switch (mode) { case (OperationMode2.Sync | OperationMode2.Parent): case (OperationMode2.Sync): break; case (OperationMode2.Parent): default: break; } This means that: if both Sync and Async values are specified Sync value always win (Zero is the neutral element for bitwise OR operation) if no Sync value specified, the Async method is used. Here is the final method implementation: protected void CheckMainOperarionMode(OperationMode2 mode) { if (mode & OperationMode2.Sync == OperationMode2.Sync) { } else { } } All content above prove that Async value (0x0) is useless from the arithmetic perspective, but, without it we lose readability. The following IF statements are logically equals but the first is definitely more readable: if (OperationMode2.Async | OperationMode2.Parent) { } if (OperationMode2.Parent) { } Here’s another example where you can see the benefits of 0x0 value, the default value can be used explicitly. <my:Control runat="server" Mode="Async,Parent"> <my:Control runat="server" Mode="Parent">

    Read the article

  • Compare a variable that can have numeric or string as value

    - by Tarun
    I have a variable named Seconds_Behind_Master from one of my scripts. The problem is that this variable can either have a numeric value or can also take a string NULL as its value. Now, when I try to execute this script in shell it gets executed but gives a warning like this: [: Illegal number: NULL I believe it is due to the fact that in this case the value is NULL but when it compares it with numeral value 60 it gives this warning. How can I rectify it? Here is the piece of code: Seconds_Behind_Master=$Show_Slave_Status | grep "Seconds_Behind_Master" | awk -F": " {' print $2 '} if [ "$Seconds_Behind_Master" -ge "60" ]; then echo "replication delayed greater than or equal to 60." else if [ "$Seconds_Behind_Master" = "NULL" ]; then echo "Delay is Null." fi fi

    Read the article

  • Startup value for Win7

    - by Mike
    Problem at a glance: For Win 7, Ubuntu One changes the startup value to enabled whenever I run it More Details: If I change the startup value in: Control Panel System and Security Administrative Tools System Configuration Startup to disabled for Ubuntu One (since I don't want it to start when I log on), it succesfully stops Ubuntu One from starting at logon However, if I start the Ubuntu One manually, it changes the above startup value to enabled. Is there a way to prevent Ubuntu One from changing its startup value? I want it to stay disabled. I haven't found anything relevant in Ubuntu One's settings dialog.

    Read the article

  • Two Values Enter, One Value Leaves

    - by Bunch
    This is a fairly easy way to compare values for two different controls. In this example a user needs to enter in a street address and zip code OR pick a county. After that the application will display location(s) based on the value. The application only wants a specific street/zip combination or a county, not both. This code shows how to check for that on an ASP.Net page using some JavaScript. The control code: <table>     <tr>         <td>             <label style="color: Red;">Required Fields</label>         </td>         <td style="width: 300px;">             <label style="color: Red; font-weight: bold;" id="reqAlert" ></label>         </td>     </tr>     <tr>         <td>             <asp:Label ID="Label3" runat="server" Text="Street Address"></asp:Label>         </td>         <td style="width: 200px;">             <input id="Street" type="text" style="width: 200px;" />         </td>     </tr>      <tr>         <td>             <asp:Label ID="Label5" runat="server" Text="Zip Code"></asp:Label>             &nbsp;         </td>         <td style="width: 200px;">             <input id="Zip" type="text" style="width: 200px;"/>         </td>     </tr>     <tr>         <td>             <label style="color: Red; font-size: large;">-- OR --</label>         </td>     </tr>     <tr>         <td>             <asp:Label ID="Label2" runat="server" Text="County"></asp:Label>         </td>         <td style="width: 200px;">             <asp:DropDownList ID="ddlCounty" runat="server">                 <asp:ListItem Value="0" Text="" />                 <asp:ListItem Value="1" Text="County A" />                 <asp:ListItem Value="2" Text="County B" />                 <asp:ListItem Value="3" Text="County C" />                                </asp:DropDownList>         </td>     </tr> </table> <input id="btnMapSearch" type="button" value="Search" onclick="requiredVal()" class="actionButton" /> The onclick for the button runs the requiredVal javascript function. That is where the checks take place. If only one item (street/zip or county) has been entered the application will carry on with it’s locateAddr function; otherwise it will show an error message in the label reqAlert. The javascript: function requiredVal() {     var street = document.getElementById("Street").value;     var zip = document.getElementById("Zip").value;     var countyDdl = document.getElementById("ctl00_Content_ddlCounty");     var county = countyDdl.options[countyDdl.selectedIndex].text;     var reqAlert = document.getElementById("reqAlert");     reqAlert.innerHTML = '';   //clears out any previous messages     if (street != '' || zip != '') {         if (county != '') {             reqAlert.innerHTML = 'Please select only one required option';  //values for both were entered         }         else {             locateAddr();         }     }     else if (street == '' && zip == '' && county == '') {         reqAlert.innerHTML = 'Please select a required option';  //no values entered     }     else {         locateAddr();     } } Technorati Tags: ASP.Net,JavaScript

    Read the article

  • Print all values in a value object

    - by SKDev
    I have to debug an issue which requires me to print all the values of a Value Object that is returned by a web service call. The Value object is a complex object in the sense, it has another object as its member which in turn has another object. Printing all the values by using get methods is cumbersome. So was wondering if there is a way to break down the value object by any way to get to a primitive level like String or int or Date and print them all using one API? I had a look at the below question but my prob is that i don't have access to the source code of the value object. The sources are in obfuscated jar. http://stackoverflow.com/questions/2413001/how-to-print-values-of-an-object-in-java

    Read the article

  • How to convert many-to-one XML data to DataSet?

    - by TruMan1
    I have an XML document that has a collection of objects. Each object has a key/value pair of label and value. I am trying to convert this into a DataSet, but when I do ds.ReadXml(xmlFile), then it creates two columns: label and value. What I would like is to have a column for each "label" and the value to be part of the row. here is my sample of the XML: <responses> <response> <properties id="1" Form="Account Request" Date="Tuesday, March 16, 2010 5:04:26 PM" Confirmation="True" /> <fields> <field> <label>Name</label> <value>John</value> </field> <field> <label>Email</label> <value>[email protected]</value> </field> <field> <label>Website</label> <value>http://domain1.com</value> </field> <field> <label>Phone</label> <value>999-999-9999</value> </field> <field> <label>Place of Birth</label> <value>Earth</value> </field> <field> <label>Misc</label> <value>Misc</value> </field> <field> <label>Comments</label> <value /> </field> <field> <label>Agree to Terms?</label> <value>True</value> </field> </fields> </response> <response> <properties id="2" Form="Account Request" Date="Tuesday, March 17, 2010 5:04:26 PM" Confirmation="True" /> <fields> <field> <label>Name</label> <value>John2</value> </field> <field> <label>Email</label> <value>[email protected]</value> </field> <field> <label>Website</label> <value>http://domain2.com</value> </field> <field> <label>Phone</label> <value>999-999-9999</value> </field> <field> <label>Place of Birth</label> <value>Earth</value> </field> <field> <label>Misc</label> <value>Misc</value> </field> <field> <label>Comments</label> <value /> </field> <field> <label>Agree to Terms?</label> <value>True</value> </field> </fields> </response> <response> <properties id="3" Form="Account Request" Date="Tuesday, March 18, 2010 5:04:26 PM" Confirmation="True" /> <fields> <field> <label>Name</label> <value>John3</value> </field> <field> <label>Email</label> <value>[email protected]</value> </field> <field> <label>Website</label> <value>http://domain3.com</value> </field> <field> <label>Phone</label> <value>999-999-9999</value> </field> <field> <label>Place of Birth</label> <value>Earth</value> </field> <field> <label>Misc</label> <value>Misc</value> </field> <field> <label>Comments</label> <value /> </field> <field> <label>Agree to Terms?</label> <value>True</value> </field> </fields> </response> <response> <properties id="4" Form="Account Request" Date="Tuesday, March 19, 2010 5:04:26 PM" Confirmation="True" /> <fields> <field> <label>Name</label> <value>John</value> </field> <field> <label>Email</label> <value>[email protected]</value> </field> <field> <label>Website</label> <value>http://domain4.com</value> </field> <field> <label>Phone</label> <value>999-999-9999</value> </field> <field> <label>Place of Birth</label> <value>Earth</value> </field> <field> <label>Misc</label> <value>Misc</value> </field> <field> <label>Comments</label> <value /> </field> <field> <label>Agree to Terms?</label> <value>True</value> </field> </fields> </response> </responses> How would I convert this to a DataSet so that I can load it into a gridview with the columns: Name, Email, Website, Phone, Place of Birth, Misc, Comments, and Agree to Terms? Then row 1 would be: John, [email protected], http://domain1.com, 999-999-9999, Earth, Misc, , True How can I do this with the XML provided?

    Read the article

  • How does one avoid "Value restriction" errors with F#'s Seq.cast?

    - by gatoatigrado
    I see that Seq has a cast function from IEnumerable to Seq, but how do I get it to work? open System.Text.RegularExpressions;; let v = Regex.Match("abcd", "(ab)");; Seq.cast (v.Captures);; This produces, error FS0030: Value restriction. The value 'it' has been inferred to have generic type val it : seq<'_a Either define 'it' as a simple data term, make it a function with explicit arguments or, if you do not intend for it to be generic, add a type annotation.

    Read the article

  • I have a KVP Key value pair Table, Need sql to make it relational structure...!

    - by Muthuveerappan
    I have a KVP Table and the structure is ID, Key, Value and below are the sample values.... Table with values ID , Key, Value 1 , STATUS, TRUE 1, AGE GROUP, 10 1, TRAVEL, Y 2 , STATUS, FALSE 2, AGE GROUP, 20 2, TRAVEL, N I want these date to transform as below (Output) ID , STATUS, AGE GROUP, TRAVEL 1, TRUE , 10, Y 2, FALSE, 20, N I have read about crosstab/pivot - but not able to make a query which can give me the above output. The table structure cant be changed...! My bad. Is there any way in sql, to make my output look like above ?

    Read the article

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