Search Results

Search found 17734 results on 710 pages for 'values'.

Page 46/710 | < Previous Page | 42 43 44 45 46 47 48 49 50 51 52 53  | Next Page >

  • parsing command option with default values and range constrains in C

    - by agramfort
    Hi, I need to parse command line arguments in C. My arguments are basically int or float with default values and range constrains. I've started to implement something that look like this: option_float(float* out, int argc, char* argv, char* name, description, float default_val, int is_optional, float min_value, float max_value) which I call for example with: float* pct; option_float(pct, argc, argv, "pct", "My super percentage option", 50, 1, FALSE, 0, 100) however I don't want to reinvent the wheel ! My objective is to have error checking of range constrains, throw an error when the option is not optional and is not set. And generate the help message usually given by usage() function. The usage text would look like this: --pct My super percentage option (default : 50). Should be in [0, 100] I've started with getopt but it is too limited for what I want to do and I feel it still requires me to write too much code for a simple usecase like this. thanks

    Read the article

  • SQL use comma-separated values with IN clause

    - by user342944
    I am developing an ASP.NET application and passing a string value like "1,2,3,4" into a procedure to select those values which are IN (1,2,3,4) but its saying "Conversion failed when converting the varchar value '1,2,3,4' to data type int." Here is the aspx code: private void fillRoles() { /*Read in User Profile Data from database */ Database db = DatabaseFactory.CreateDatabase(); DbCommand cmd = db.GetStoredProcCommand("sp_getUserRoles"); db.AddInParameter(cmd, "@pGroupIDs", System.Data.DbType.String); db.SetParameterValue(cmd, "@pGroupIDs", "1,2,3,4"); IDataReader reader = db.ExecuteReader(cmd); DropDownListRole.DataTextField = "Group"; DropDownListRole.DataValueField = "ID"; while (reader.Read()) { DropDownListRole.Items.Add((new ListItem(reader[1].ToString(), reader[0].ToString()))); } reader.Close(); } Here is my procedure: CREATE Procedure [dbo].[sp_getUserRoles](@pGroupIDs varchar(50)) AS BEGIN SELECT * FROM CheckList_Groups Where id in (@pGroupIDs) END

    Read the article

  • getting values by time difference in SQL

    - by Maestro1024
    I want to get the difference of two values within a time frame. so I have a table like this Data Table TimeStamp DataValue 2010-06-01 21 2010-06-03 33 2010-06-05 44 So I want to first get all data over the last month which I can do with something like. ([TimeStamp] < GETDATE()-0 and ([TimeStamp] > GETDATE()-31) But I want to see how much value added on over the course of the month. So it started at 21 and went to 44. So I would expect this example to to return 23 (as in 44-21). How would I build a query like this?

    Read the article

  • how to set and access variable values from another classess

    - by BittenApple
    I am modifying QuartzDemo example app and want to do set and read values of integer type variables in other classes which are already included. For example, in MainViewController.m I want to set a numeric value (simple numbers from 1-100) to a variable which is then going to be called (read) in file QuartzImages.m. Question is how to define variable properly, set and access (read) the value. I am a beginner with Obj C and iPhone SDK in general and have some experience with Delphi and VB but this doesn't help at all :) Thank you, whoever and wherever you are, person who will take me out of this endless googling loop.

    Read the article

  • add two float values in java

    - by user1845286
    acually i try to add two float values in java like this import java.text.DecimalFormat; class ExactDecimalValue { final strictfp static public void main(String... arg) { float f1=123.00000f; float f2=124.00000f; float f3=f1+f2; System.out.println(f1+f2); System.out.println("sum of two floats:"+f3); /*my expected output is:247.00000 but comming output is:247.0 and 247*/ } } Now what i can do to get the value in this format:247.00000. please any one help me. Thanks & Regards venkatesh

    Read the article

  • Counting Values in R Vector

    - by GTyler
    I have a large vector of percentages (0-100) and I am trying to count how many of them are in specific 20% buckets (<20, 20-40, 40-60,60-80,80-100). The vector has length 129605 and there are no NA values. Here's my code: x<-c(0,0,0,0,0) for(i in 1: length(mail_return)) { if (mail_return[i]<=20) { x[1] = x[1] + 1 } if (mail_return[i]>20 && mail_return[i]<=40) { x[2] = x[2] + 1 } if (mail_return[i]>40 && mail_return[i]<=60) { x[3] = x[3] + 1 } if (mail_return[i]>60 && mail_return[i]<=80) { x[4] = x[4] + 1 } else { x[5] = x[5] + 1 } } But sum(x) is giving me length 133171. Shouldn't it be the length of the vector, 129605? What's wrong?

    Read the article

  • Hashing and salting values

    - by Avanst
    I am developing a small web app that internally authenticates users. Once the user is authenticated my web app then passes some information such as userID and Person's name to a third party web application. The third party developer is suggesting that we hash and salt the values. Forgive my ignorance, but what exactly does that mean? I am writing the app in Java. So what I am planning on doing is hashing the userID, Person's name, and some Math.random() value as the salt with Apache Commons Digest Utils SHA512 and passing that hashed string along with the userID and person's name. Is that the standard practice? I should be passing the third party the salt as well correct?

    Read the article

  • For each level of factor aggregate values over all levels except the current one (in R)

    - by Andrey Chetverikov
    For each level of factor I need to extract values aggregated over all subsets of data.frame except the current one. For example, there is a several subjects doing a reaction time task during several days, and I need to compute mean reaction time for all subjects and all days, but not including the subject for whom the mean is computed. Currently, I do it like this: library(lme4) ddply(sleepstudy, .(Subject, Days), summarise , avg_rt=mean(sleepstudy[sleepstudy$Subject!=Subject&sleepstudy$Days==Days,"Reaction"]), .progress="text") It works fine for small data sets, but for large ones it can be very slow. Is there a way to do it faster?

    Read the article

  • looping thru a list of checkboxes and saving the values, now working properly

    - by Erez
    Hello all, I'm having a bit of a problem with this code. The program gives me a list of checkboxes but a user ID. then u user can change his selection and push the save button (id="btnSaveUserIntersts") and i am trying to save in the hidden textbox all the values of the checkboxes that was choosen. The problem is that i am getting all the time the same selections that came form the database and not getting the new selection that the user made. Can any one tell me what am i doing wrong here? $(document).ready( function() { $('#btnSaveUserIntersts').bind( 'click', function() { var strCheckBoxChecked = new String(); $('input[type=checkbox][checked]').each( function() { strCheckBoxChecked += $(this).val(); strCheckBoxChecked += ','; } ); $('#hidUserInterests').val(strCheckBoxChecked); } ); } ); 10x

    Read the article

  • Replacing emty csv column values with a zero

    - by homerjay
    Hey, So I'm dealing with a csv file that has missing values. What I want my script to is: #!/usr/bin/python import csv import sys #1. Place each record of a file in a list. #2. Iterate thru each element of the list and get its length. #3. If the length is less than one replace with value x. reader = csv.reader(open(sys.argv[1], "rb")) for row in reader: for x in row[:]: if len(x)< 1: x = 0 print x print row Here is an example of data, I trying it on, ideally it should work on any column lenghth Before: actnum,col2,col4 xxxxx , , xxxxx , 845 , xxxxx , ,545 After actnum,col2,col4 xxxxx , 0 , 0 xxxxx , 845, 0 xxxxx , 0 ,545 Any guidance would be appreciated

    Read the article

  • Mdx produces repeated values for a measure and across measures

    - by Joe
    The MDX query below is giving me repeated measure values as shown in the result below the query. Sometimes it give me save valuea across different measures. SELECT NON EMPTY { [Measures].[Amount], } ON COLUMNS, NON EMPTY { ( [Date_Time].[Date].[Date].ALLMEMBERS * [Date_Time].[Working Day].[Working Day].ALLMEMBERS ) } DIMENSION PROPERTIES MEMBER_CAPTION, MEMBER_UNIQUE_NAME ON ROWS FROM [DDS] where {[Date_Time].[Year].&[2010-01-01T00:00:00] } Date working day Amount 2010-01-01 00:00:00.000 1 19582 2010-01-02 00:00:00.000 0 19582 2010-01-03 00:00:00.000 0 19582 2010-01-04 00:00:00.000 1 19582 2010-01-05 00:00:00.000 1 19582 2010-01-06 00:00:00.000 1 19582 2010-01-07 00:00:00.000 1 19582 How can I rectify these issues?

    Read the article

  • Passing NULL values into mysql Stored procedure

    - by McNabbToSkins
    I am trying to pass a few NULL values to a stroed procedure but PHP always retains the varaibles to be empty strings '' and not NULL. My DB insert function looks like this. (I am using a Framework and ADODB so if it looks weird thats why). function insert_emp($f_name, $last_name, $dob) { if(!isset($dob)){ $dob = NULL; } $this->DB->setConnection("CALL insert_emp('$f_name', '$l_name', '$dob')"); } I have ensured that $dob is being passed an empty string ''. But for some reason when it calls the stored proc it is not changed to NULL. dob is a datetime field and mysql complains that you can not enter an empty string as a DATETIME. If I hard code the insert such as this $this->DB->setConnection("CALL insert_emp('Test1', 'Test2', 'NULL')"); it will work. Thanks for the help.

    Read the article

  • doctrine default values and relations

    - by Skirmantas
    Concept: Lets say we have table Properties with columns id and name (lets say with some predefined values: "Good" "Better" "Best"). Another table Users has column property_id with many to one relation on Properties (property_id = id). Users has default value on property_id, lets say 1 which means "Good". We might have another table analogue to Users however with default property, lets say "Better". What I need is ability to change default value for Users or other tables in administrator's panel. In mysql I can set default value for column like this: ALTER TABLE <Table> CHANGE <Column> DEFAULT <NEW_DEFAULT_VALUE> I can retrieve default value: SELECT DEFAULT(<Column>) FROM <Table> LIMIT 1 Is it possible to achieve this concept with Doctrine? What I actually need is such method in my table class: class UserTable extend Doctrine_Table { /* ... */ getDefaultProperty() { } setDefaultProperty($value) { /* $value can be either integer or Doctrine_Record */ } }

    Read the article

  • PHP to make vars and values part of array

    - by Chris
    I currently have this function to search and replace in a text file. // Input $ect = array('Visssa', 'Lisssa', 'her'); // Placeholders in the file $put = array('lname', 'fname', 'hisher'); // Replace the placeholders $oput = str_replace($put, $ct, 'tmpfile.txt'); This is not the full program but the idea is replace the values found in tmpfile.txt with the ones found in the $etc array. And it works flawlessly. But, what I need to do is get all passed vars (get/post) and then make the arrays so that the var is the value to replace and the value is the value to replace it with. So, if I sent the url http://xyz.com/?lname=tom&ogre=yes All instances of lname in the file would be replaces with tom and all instances of ogre would be replaced with yes. So somehow it just gets any/all variables passed in get/post and then the arrays showed above would cause the var to be replaced by the value in the file.

    Read the article

  • Accessing Controls Values Before Finishing Page_Load

    - by userk
    Hi. I'm with a problem and want to know if someone can help me. I'm creating a table with some controls and I want to save all control values in every postback. As the controls are just defined after the page_load, I can't solve my problem this way: object o; protected void Page_Load(object sender, EventArgs e) { o = createObject(); Create_Table(); if (Page.IsPostBack) Save_Data(); } I thought I could execute Save_Data() at the begining of every postback event, but I think that should exist a better way to solve my problem. Thanks.

    Read the article

  • looping thru a list of checkboxes and saving the values, not working properly

    - by Erez
    Hello all, I'm having a bit of a problem with this code. The program gives me a list of checkboxes but a user ID. then u user can change his selection and push the save button (id="btnSaveUserIntersts") and i am trying to save in the hidden textbox all the values of the checkboxes that was choosen. The problem is that i am getting all the time the same selections that came form the database and not getting the new selection that the user made. Can any one tell me what am i doing wrong here? $(document).ready( function() { $('#btnSaveUserIntersts').bind( 'click', function() { var strCheckBoxChecked = new String(); $('input[type=checkbox][checked]').each( function() { strCheckBoxChecked += $(this).val(); strCheckBoxChecked += ','; } ); $('#hidUserInterests').val(strCheckBoxChecked); } ); } ); 10x

    Read the article

  • Convert sets to frozensets as values of a dictionary

    - by Space_C0wb0y
    I have dictionary that is built as part of the initialization of my object. I know that it will not change during the lifetime of the object. The dictionary maps keys to sets. I want to convert all the values from sets to frozensets, to make sure they do not get changed. Currently I do that like this: for key in self.my_dict.iterkeys(): self.my_dict[key] = frozenset(self.my_dict[key]) Is there a simpler way to achieve this? I cannot build frozenset right away, because I do not how much items will be in each set until i have built the complete dictionary.

    Read the article

  • ASP.NET MVC 2 Form Not Passing Values

    - by Wayne
    Hi, I have a strange problem happening today. I am running the latest version of the MVC V2 framework and have been having no trouble at all - I came in this morning and for some reason values aren't being passed in to actions. To clarify lets say I have something like this: <% using (Html.BeginForm("Register", "Registration", FormMethod.Post)) { %> .... <input type="submit" name="register" id="register" value="Register" /> <% } %> And in my controller I have the following: [HttpPost] public ActionResult Register(RegistrationModel model, string register) { // At this point the register string is null } This has been working fine for a while now and I have not changed anything that I can think of that would cause this to happen. Does that make sense and as anyone any idea what is going on or what I have messed up? Thanks.

    Read the article

  • retrive values of two dropdown boxes without submitting the form

    - by Kaustav Dey
    I have two dropdown boxes in a single form. How can I alert the values of both the dropdown boxes with onchange function on the second dropdown box without submitting the form. <select name="abc1" id="abc1"> <option value="a">A</option> <option value="B">B</option> <option value="c">C</option> </select> <select name="abc2" id="abc2" onchange="getvalue()"> <option value="a">d</option> <option value="e">E</option> <option value="f">F</option> </select>

    Read the article

  • Problem in removing hardcoded values using temp table...

    - by Shahsra
    Hi All, First of all Wish u all Happy New Year. I have a problem in writing query. While executing my query I am getting an error. Query: select case when S.R1 = '6' then 5 when S.R1 = '7' then 6 when S.R1 = '8' then 7 when S.R1 = '9' then 8 when S.R1 ='10' then 9 else S.R1 end as Q FROM [HelpService].[dbo].[help] s ----------------------------------------------- SELECT [Source], [Score] INTO #Temp_Q FROM [HelpDesk].[dbo].[Survey] WHERE [data_Source Name] = 'Text Data' ----------------------------------------------- select CONVERT(REAL, a.[Dell Score]) as Q FROM [HelpService].[dbo].[help] s LEFT OUTER JOIN #CE_Temp_Q a on s.[R1] = a.[Source] ERROR Msg 8114, Level 16, State 5, Line 1 Error converting data type varchar to real. What I am asked to do is I need to remove the hard coded values and need to write queries with a temp table. Thanks in Advance, Shashra

    Read the article

  • C# Object Array CopyTo links both arrays' values?

    - by Dutchie432
    Okay, I have what I think is a simple question.. or just a case of me being a C# beginner. I have an array of custom objects (clsScriptItem) that I am populating from a database. Once the items are loaded, I want to back them up to "backup" array so I can revert the information back after changing the main array. However, when I use CopyTo to copy the array and then alter the original array, the backup array is also being altered... I though CopyTo merely copied values + structure from one array to another. private void backupItems() { lastSavedItems = new clsScriptItem[items.Length]; items.CopyTo(lastSavedItems, 0); //items[0].nexts[0] is 2 //lastSavedItems[0].nexts[0] is 2 items[0].nexts[0] = "-1"; //items[0].nexts[0] is -1 //lastSavedItems[0].nexts[0] is also -1 } How do I backup this data without having the two arrays be 'linked'??

    Read the article

  • post selextbox values to php page in jquery

    - by JPro
    I am using jquery button click to post all the values in a selectbox to a PHP page, but this code does not seem to work. Can anyone please help? <script type="text/javascript"> $(function() { $("#btn1").click(function () { var arr= new Array; $("#target_select option").each (function () { // You can push the array on an array arr.push( $(this).val() ); //alert( $(this).val() ); not getting the alert to display too }); $.post("test.php", { name: arr } ); }); }); </script> Generate

    Read the article

  • Generating incremental numeric column values during INSERT SELECT statement

    - by Charles
    I need to copy some data from one table to another in Oracle, while generating incremental values for a numeric column in the new table. This is a once-only exercise with a trivial number of rows (100). I have an adequate solution to this problem but I'm curious to know if there is a more elegant way. I'm doing it with a temporary sequence, like so: CREATE SEQUENCE temp_seq START WITH 1; INSERT INTO new_table (new_col, copied_col1, copied_col2) SELECT temp_seq.NEXTVAL, o.* FROM (SELECT old_col1, old_col2 FROM old_table) o; DROP SEQUENCE temp_seq; Is there way to do with without creating the sequence or any other temporary object? Specifically, can this be done with a self-contained INSERT SELECT statement? There are similar questions, but I believe the specifics of my question are original to SO.

    Read the article

  • Run a proc on several different values of one parameter

    - by WEFX
    I have the following query that gets run within a proc. The function MyFunction returns a table, and this query joins on that table. This proc works great when a @MyArg value is supplied. However, I’m wondering if there’s a way to run this on all @MyArg values in the database. I’m sure there’s a way to do it within a loop, but I know that loops are generally to be avoided at the db layer. I really just need to perform this for the sake of checking (and possibly cleansing) some bad data. SELECT ColumnA, ColumnB, ColumnC FROM ( SELECT a.ColumnA, a.ColumnB, a.ColumnC, ROW_NUMBER() over(partition by a.ColumnD order by f.ColumnX) as RowNum FROM dbo.MyTableA AS a INNER JOIN dbo.MyFunction(@MyArg) f ON f.myID = a.myID WHERE (a.myBit = 1 OR a.myID = @MyArg) ) AS x WHERE x.rownum = 1;

    Read the article

  • fetching savedInstanceState values, nullpointerexception

    - by Johan
    @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main2); savedInstanceState.putString("foo", "bar"); } @Override public void onRestoreInstanceState(Bundle savedInstanceState) { super.onRestoreInstanceState(savedInstanceState); String myString = savedInstanceState.getString("foo"); Log.i("debug", "saved data: " + myString); } Im trying to preserve some values in an activity, but i recieve the following error: 06-23 23:09:44.038: E/AndroidRuntime(17584): java.lang.RuntimeException: Unable to start activity ComponentInfo{se.johanberntsson.activitytest/se.johanberntsson.activitytest.TestActivity}: java.lang.NullPointerException What did I miss here? Thanks

    Read the article

< Previous Page | 42 43 44 45 46 47 48 49 50 51 52 53  | Next Page >