Search Results

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

Page 30/710 | < Previous Page | 26 27 28 29 30 31 32 33 34 35 36 37  | Next Page >

  • Replace some column values depending on a condition, MATLAB

    - by darkcminor
    I have a matrix like A= 4.0000 120.0000 92.0000 0 0 37.6000 0.1910 30.0000 10.0000 168.0000 74.0000 0 0 38.0000 0.5370 34.0000 10.0000 139.0000 80.0000 0 0 27.1000 1.4410 57.0000 1.0000 139.0000 60.0000 23.0000 846.0000 30.1000 0.3980 59.0000 5.0000 136.0000 72.0000 19.0000 175.0000 25.8000 0.5870 51.0000 7.0000 121.0000 0 0 0 30.0000 0.4840 32.0000 I want to replace the values of the first column that are greater than '5' to 0, also in the second column if the values are in range 121-130 replace them by 0, if they are in range 131-140 replece by 1, 141-150 by 2, 151-160 by 3... so the result matrix would be A= 4.0000 0.0000 92.0000 0 0 37.6000 0.1910 30.0000 0.0000 4.0000 74.0000 0 0 38.0000 0.5370 34.0000 0.0000 1.0000 80.0000 0 0 27.1000 1.4410 57.0000 1.0000 1.0000 60.0000 23.0000 846.0000 30.1000 0.3980 59.0000 5.0000 1.0000 72.0000 19.0000 175.0000 25.8000 0.5870 51.0000 0.0000 0.0000 0 0 0 30.0000 0.4840 32.0000 How to acomplish this? I was trying something like counter=1; for i = 1: rows if A(i,1) > 5 A(i ,1) = 0; end if A(i,2) > 120 && A(i,2) < 130 A(i ,2) = 0; end counter = counter+1; end Using a case could do the trick?

    Read the article

  • Retrieve values from multimdimensional array

    - by vincentlerry
    I have a great difficulty. I need to retrieve [title], [url] and [abstract] values ??from this multidimensional array. Also, I have to store those values in mysql database. thanks in advance!!! Array ( [bossresponse] = Array ( [responsecode] = 200 [limitedweb] = Array ( [start] = 0 [count] = 20 [totalresults] = 972000 [results] = Array ( [0] = Array ( [date] = [clickurl] = http://www.torchlake.com/ [url] = http://www.torchlake.com/ [dispurl] = www.torchlake.com [title] = Torch Lake, COLI Inc, Highspeed, Dial-up, Wireless ... [abstract] = Welcome to COLI Inc. Chain O' Lake Internet. Local Northern Michigan ISP, offering Dialup Internet access, Wireless access, Web design, and T1 services in Northern ... ) [1] = Array ( [date] = [clickurl] = http://en.wikipedia.org/wiki/Torch_Lake_(Antrim_County,_Michigan) [url] = http://en.wikipedia.org/wiki/Torch_Lake_(Antrim_County,_Michigan) [dispurl] = en.wikipedia.org/wiki/Torch_Lake_(Antrim_County,_Michigan) [title] = Torch Lake (Antrim County, Michigan) - Wikipedia, the free ... [abstract] = Torch Lake at 19 miles (31 km) long is Michigan's longest lake and at approximately 18,770 acres (76 km²) is Michigan's second largest lake. Within it are several ... ) this is the entire code that generates this array: require("OAuth.php"); $cc_key = ""; $cc_secret = ""; $url = "http://yboss.yahooapis.com/ysearch/limitedweb"; $args = array(); $args["q"] = "car"; $args["format"] = "json"; $args["count"] = 20; $consumer = new OAuthConsumer($cc_key, $cc_secret); $request = OAuthRequest::from_consumer_and_token($consumer, NULL,"GET", $url, $args); $request-sign_request(new OAuthSignatureMethod_HMAC_SHA1(), $consumer, NULL); $url = sprintf("%s?%s", $url, OAuthUtil::build_http_query($args)); $ch = curl_init(); $headers = array($request-to_header()); curl_setopt($ch, CURLOPT_HTTPHEADER, $headers); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE); $rsp = curl_exec($ch); $results = json_decode($rsp, true);

    Read the article

  • How to prevent ADO.NET from altering double values when it reads from Excel files

    - by Khnle
    I have the following rows in my Excel input file: Column1 Column2 0-5 3.040 6 2.957 7 2.876 and the following code which uses ADO.NET to read it: string fileName = "input.xls"; var connectionString = string.Format("Provider=Microsoft.Jet.OLEDB.4.0; data source={0}; Extended Properties=Excel 8.0;", fileName); var dbConnection = new OleDbConnection(connectionString); dbConnection.Open(); try { var dbCommand = new OleDbCommand("SELECT * FROM [Sheet1$]", dbConnection); var dbReader = dbCommand.ExecuteReader (); while (dbReader.Read()) { string col1 = dbReader.GetValue(0).ToString(); string col2 = dbReader.GetValue(1).ToString(); } } finally { dbConnection.Close(); } The results are very disturbing. Here's why: The values of each column in the first time through the loop: col1 is empty (blank) col2 is 3.04016411633586 Second time: col1 is 6 col2 is 2.95722928448829 Third time: col1 is 7 col2 is 2.8763272933077 The first problem happens with col1 in the first iteration. I expect 0-5. The second problem happens at every iteration with col2 where ADO.NET obviously alters the values as it reads them. How to stop this mal-behavior?

    Read the article

  • Weak hashmap with weak references to the values?

    - by Razor Storm
    I am building an android app where each entity has a bitmap that represents its sprite. However, each entity can be be duplicated (there might be 3 copies of entity asdf for example). One approach is to load all the sprites upfront, and then put the correct sprite in the constructors of the entities. However, I want to decode the bitmaps lazily, so that the constructors of the entities will decode the bitmaps. The only problem with this is that duplicated entities will load the same bitmap twice, using 2x the memory (Or n times if the entity is created n times). To fix this, I built a SingularBitmapFactory that will store a decoded Bitmap into a hash, and if the same bitmap is asked for again, will simply return the previously hashed one instead of building a new one. Problem with this, though, is that the factory holds a copy of all bitmaps, and so won't ever get garbage collected. What's the best way to switch the hashmap to one with weakly referenced values? In otherwords, I want a structure where the values won't be GC'd if any other object holds a reference to it, but as long as no other objects refers it, then it can be GC'd.

    Read the article

  • Problem updating values in combobox in vb.net

    - by user225269
    I have this code, but I have a problem. When I update but do not really made any changes to the value and press the update button, the data becomes null. And it will seem that I deleted the value. I've taught of a solution, that is to add both combobox1.selectedtext and combobox1.selecteditem to the function. But it doesn't work. combobox1.selecteditem is working when you try to alter the values when you update. But will save a null value when you don't alter the values using the combobox combobox1.selectedtext will save the data into the database even without altering. But will not save the data if you try to alter it. -And I incorporated both of them, but still only one is performing, and I think it is the one that I added first: Dim shikai As New Updater Try shikai.id = TextBox1.Text shikai.fname = TextBox2.Text shikai.mi = TextBox3.Text shikai.lname = TextBox4.Text shikai.ad = TextBox5.Text shikai.contact = TextBox9.Text shikai.year = ComboBox1.SelectedText shikai.section = ComboBox2.SelectedText shikai.gender = ComboBox3.SelectedText shikai.religion = ComboBox4.SelectedText shikai.year = ComboBox1.SelectedItem shikai.section = ComboBox2.SelectedItem shikai.gender = ComboBox3.SelectedItem shikai.religion = ComboBox4.SelectedItem shikai.bday = TextBox6.Text shikai.updates() MsgBox("Successfully updated!") Please help, what would be a simple workaround to solve this problem?

    Read the article

  • Modifying CSS class property values on the fly with JavaScript / jQuery

    - by JPN
    all. I've run into a unique situation that I have so far been unable to find a solution for: dynamically assigning a value to a CSS style. I know how to use jQuery to assign width, height, etc. to an element, but what I'm trying to do is actually change the value defined in the stylesheet so that the dynamically-created value can be assigned to multiple elements. What I'm building is a slideshow of images that occupy the full viewport, recalculating the image's width, height, and left properties on resize so that the image is always centered, favors width over height, except when the viewport is taller than it is wide (resizing does not reload the page, just fires a function to resize the image). I have successfully been able to get it to work on one image, and now I'm trying to determine the best way to assign those property values to all images in the slideshow without having to specify those three things individually for every image. Can the values of properties in a class be modified on the fly? I'm sure the answer is out there, I'm probably just not using the correct terminology in my searches. Hope I did a good job of describing the problem. TIA.

    Read the article

  • How to pass dynamic values using MVC AJax.BeginForm

    - by Arthur
    I'm using MVC and AJax.BeginForm to do some ajax updating of my page. The BeginForm code looks something like: using (Ajax.BeginForm("HandleCrop", "Card", new { accept = true, id = Model.ImageUpload.ID, file = Model.ImageUpload.File, imageCropX = Model.CropInfo.X, imageCropY = Model.CropInfo.Y, imageCropWidth = Model.CropInfo.Width, imageCropHeight = Model.CropInfo.Height }, new AjaxOptions { HttpMethod = "POST", OnComplete = "ConfirmCompleted", OnSuccess = "ReloadUpload", OnFailure = "Failure" }, null)) The Model.CropInfo is being put in as hidden fields like so: <%=Html.HiddenFor(m => m.CropInfo.X) %> <%=Html.HiddenFor(m => m.CropInfo.Y) %> <%=Html.HiddenFor(m => m.CropInfo.Width) %> <%=Html.HiddenFor(m => m.CropInfo.Height) %> However, these values are being dynamically modified by some client side javascript, and these values need to be posted through the Ajax call back to the server. The above code will obviously not work as the imageCrop.. parameters in the Ajax form are being filled when the page is rendered (therefore being all 0). My question is: what is the correct way to approach this situation?

    Read the article

  • values not equal in sqlite and json array in android

    - by Venkat
    I am trying to compare the value in sqlite table and id of the webservice what i have done so far is if(data_exist!=bookProduct.length()){ Log.i("in update","m here"); Cursor cursors = getRawEvents("select id from bcuk_book"); try{ for (int i = 0; i < bookProduct.length(); i++) { JSONObject c = bookProduct.getJSONObject(i); String Bid = c.getString(TAG_ID); ArrayList<String> mapId = new ArrayList<String>(); while(cursors.moveToNext()) { Log.e("cursors",cursors.getString(0)); Log.i(Bid,Bid); if(cursors.getString(0)!=c.getString(TAG_ID)){ Log.e("fas",Bid); } } mapId.add(TAG_ID); Log.e(Bid,Bid); } } My issue is i am getting same values in logs.. if(cursors.getString(0)!=c.getString(TAG_ID)){ this condition says if they are not equal then print the log..But the issue is i am entering into that block even i am getting same values from sqlite and TAG_ID i.e from json webservice..How to solve this.Where i done wrong?

    Read the article

  • Schema for storing "binary" values, such as Male/Female, in a database

    - by latentflip
    Intro I am trying to decide how best to set up my database schema for a (Rails) model. I have a model related to money which indicates whether the value is an income (positive cash value) or an expense (negative cash value). I would like separate column(s) to indicate whether it is an income or an expense, rather than relying on whether the value stored is positive or negative. Question: How would you store these values, and why? Have a single column, say Income, and store 1 if it's an income, 0 if it's an expense, null if not known. Have two columns, Income and Expense, setting their values to 1 or 0 as appropriate. Something else? I figure the question is similar to storing a person's gender in a database (ignoring aliens/transgender/etc) hence my title. My thoughts so far Lookup might be easier with a single column, but there is a risk of mistaking 0 (false, expense) for null (unknown). Having seperate columns might be more difficult to maintain (what happens if we end up with a 1 in both columns? Maybe it's not that big a deal which way I go, but it would be great to have any concerns/thoughts raised before I get too far down the line and have to change my code-base because I missed something that should have been obvious! Thanks, Philip

    Read the article

  • How to handle duplicate values in d3.js

    - by Mario
    First I'm a d3.js noob :) How you can see from the title I've got a problem with duplicated data and aggregate the values is no option, because the name represent different bus stops. In this example maybe the stops are on the fron side and the back side of a building. And of course I like to show the names on the x-axis. If i created an example and the result is a bloody mess, see jsFiddel. x = index name = bus stop name n = value I've got a json e.g.: [{ "x": 0, "name": "Corniche St / Abu Dhabi Police GHQ", "n": 113 }, { "x": 1, "name": "Corniche St / Nation Towers", "n": 116 }, { "x": 2, "name": "Zayed 1st St / Al Khalidiya Public Garden", "n": 146 }, ... { "x": 49, "name": "Hamdan St / Tariq Bin Zeyad Mosque", "n": 55 }] The problem: It is possible that the name could appear more then once e.g. { "x": 1, "name": "Corniche St / Nation Towers", "n": 116 } and { "x": 4, "name": "Corniche St / Nation Towers", "n": 105 } I like to know is there a way to tell d3.js not to use distinct names and instead just show all names in sequence with their values. Any ideas or suggestions are very welcome :) If you need more information let me know. Thanks in advanced Mario

    Read the article

  • how to display values of an arraylist defined in servlet using ajax call

    - by veena123
    can anyone please help me with below code servlet: below servlet is for statically defining an array. import java.io.; import javax.servlet.; import javax.servlet.http.; import java.util.; public class SampleAjax extends HttpServlet{ public void doGet(HttpServletRequest request, HttpServletResponse response)throws ServletException,IOException { response.setContentType("text/html"); string plociyno = "abd1234"; PrintWriter pw = response.getWriter(); if (policyno.equals("abc1234")) { List dataList= new ArrayList(); dataList.add("automated refund possible"); request.setAttribute("data",dataList); RequestDispatcher dispatcher = request.getRequestDispatcher("refund.jsp"); if (dispatcher != null){ dispatcher.forward(request, response); } } } and my jsp: jsp for displayng the values of the arraylist in a table.... i want to do the same thing but using ajax.... please help <html <body><table id= "table" border="0" width="303"> <tr> <td width="250"><b>Your Policy Refund Details is:</b></td> </tr> <%Iterator itr; %> <% ArrayList refund= (ArrayList)request.getAttribute("data"); if(refund != null){ for(itr=refund.iterator(); itr.hasNext();){ %> <tr> <td><%=itr.next()%></td> </tr> <%}}%> </table> </body> </html> how can i display this arraylist values using ajax??? please help

    Read the article

  • add uchar values in ushort array with sse2 or sse3

    - by pompolus
    i have an unsigned short dst[16][16] matrix and a larger unsigned char src[m][n] matrix. Now i have to access in the src matrix and add a 16x16 submatrix to dst, using sse2 or ss3. In a my older implementation, I was sure that my summed values ??were never greater than 256, so i could do this: for (int row = 0; row < 16; ++row) { __m128i subMat = _mm_lddqu_si128(reinterpret_cast<const __m128i*>(src)); dst[row] = _mm_add_epi8(dst[row], subMat); src += W; // Step to next row i need to add } where W is an offset to reach the desired rows. This code works, but now my values in src are larger and summed could be greater than 256, so i need to store them as ushort. i've tried this: for (int row = 0; row < 16; ++row) { __m128i subMat = _mm_lddqu_si128(reinterpret_cast<const __m128i*>(src)); dst[row] = _mm_add_epi16(dst[row], subMat); src += W; // Step to next row i need to add } but it doesn't work. I'm not so good with sse, so any help will be appreciated.

    Read the article

  • Compact data structure for storing a large set of integral values

    - by Odrade
    I'm working on an application that needs to pass around large sets of Int32 values. The sets are expected to contain ~1,000,000-50,000,000 items, where each item is a database key in the range 0-50,000,000. I expect distribution of ids in any given set to be effectively random over this range. The operations I need on the set are dirt simple: Add a new value Iterate over all of the values. There is a serious concern about the memory usage of these sets, so I'm looking for a data structure that can store the ids more efficiently than a simple List<int>or HashSet<int>. I've looked at BitArray, but that can be wasteful depending on how sparse the ids are. I've also considered a bitwise trie, but I'm unsure how to calculate the space efficiency of that solution for the expected data. A Bloom Filter would be great, if only I could tolerate the false negatives. I would appreciate any suggestions of data structures suitable for this purpose. I'm interested in both out-of-the-box and custom solutions. EDIT: To answer your questions: No, the items don't need to be sorted By "pass around" I mean both pass between methods and serialize and send over the wire. I clearly should have mentioned this. There could be a decent number of these sets in memory at once (~100).

    Read the article

  • Dimension Reduction in Categorical Data with missing values

    - by user227290
    I have a regression model in which the dependent variable is continuous but ninety percent of the independent variables are categorical(both ordered and unordered) and around thirty percent of the records have missing values(to make matters worse they are missing randomly without any pattern, that is, more that forty five percent of the data hava at least one missing value). There is no a priori theory to choose the specification of the model so one of the key tasks is dimension reduction before running the regression. While I am aware of several methods for dimension reduction for continuous variables I am not aware of a similar statical literature for categorical data (except, perhaps, as a part of correspondence analysis which is basically a variation of principal component analysis on frequency table). Let me also add that the dataset is of moderate size 500000 observations with 200 variables. I have two questions. Is there a good statistical reference out there for dimension reduction for categorical data along with robust imputation (I think the first issue is imputation and then dimension reduction)? This is linked to implementation of above problem. I have used R extensively earlier and tend to use transcan and impute function heavily for continuous variables and use a variation of tree method to impute categorical values. I have a working knowledge of Python so if something is nice out there for this purpose then I will use it. Any implementation pointers in python or R will be of great help. Thank you.

    Read the article

  • Map Literals to Object Properties/Values

    - by vijay
    For eg, my input XML is look like this. <root> <myelemt> <input type="variable"> <variable>STARTDATE</variable> <variable>CUSTOMERNAME</variable> </input> </myelemt> </root> it is deserialized and loaded into the object MyXmlElemtObj in my code i have written like this, if(MyXmlElemtObj.input.variable.ToUpper() == "STARTDATE") ProcessObjectB(ObjectA.OrderDate); if(MyXmlElemtObj.input.variable.ToUpper() == "CUSTOMERNAME") ProcessObjectB(ObjectC.UserName); Here I am mapping those input literals to some objects value. The one thing that scares me is seeing some ** hard-coded literals** all over my code. Instead i would like to write something like ProcessObjectB(Common.GetMappedvalue(MyXmlElemtObj.input.variable)); Is there a way to isolate this mapping thing to common class, where i will predefine which literal is mapped to which values. The problem is the values are of objects created at the run time. If my question is making sense then So how do i achieve this? I think i have given all the necessary details. if anything is missing please metnion. Thx Much.

    Read the article

  • How to specify multiple values in where with AR query interface in rails3

    - by wkhatch
    Per section 2.2 of rails guide on Active Record query interface here: which seems to indicate that I can pass a string specifying the condition(s), then an array of values that should be substituted at some point while the arel is being built. So I've got a statement that generates my conditions string, which can be a varying number of attributes chained together with either AND or OR between them, and I pass in an array as the second arg to the where method, and I get: ActiveRecord::PreparedStatementInvalid: wrong number of bind variables (1 for 5) which leads me to believe I'm doing this incorrectly. However, I'm not finding anything on how to do it correctly. To restate the problem another way, I need to pass in a string to the where method such as "table.attribute = ? AND table.attribute1 = ? OR table.attribute1 = ?" with an unknown number of these conditions anded or ored together, and then pass something, what I thought would be an array as the second argument that would be used to substitute the values in the first argument conditions string. Is this the correct approach, or, I'm just missing some other huge concept somewhere and I'm coming at this all wrong? I'd think that somehow, this has to be possible, short of just generating a raw sql string.

    Read the article

  • Returning two or more values from a function

    - by cf_PhillipSenn
    I need to return multiple values from a ColdFusion function in an ajax callback function. Here's what I've got: $('input[name="StateName"]').live('change', function() { var StateID = $(this).parents('tr').attr('id'); var StateName = $(this).val(); $.ajax({ url: 'Remote/State.cfc' ,type: "POST" ,data: { 'method': 'UpdateStateName' ,'StateID': StateID ,'StateName': StateName } ,success: function(result){ if (isNaN(result)) { $('#msg').text(result).addClass('err'); } else { $('#' + result + ' input[name="StateName"]').addClass('changed'); }; } ,error: function(msg){ $('#msg').text('Connection error').addClass('err'); } }); }); If I trap a database error, then the success callback is fired, and the result is Not a Number (It is in fact, the text of the error message). I need the function to also pass back other values. One might be the primary key of the row that caused the error. Another might be the old StateName, so that I can refresh the old value on the screen so that the client will know absolutely for sure that their change did not take effect. I guess I'm breaking the rule of atomicity here and need to fix that, because I'm using result as both the primary key of the row that was updated, or it's the error message if the update fails. I need to return both the primary key and the error message.

    Read the article

  • Computing, storing, and retrieving values to and from an N-Dimensional matrix

    - by Adam S
    This question is probably quite different from what you are used to reading here - I hope it can provide a fun challenge. Essentially I have an algorithm that uses 5(or more) variables to compute a single value, called outcome. Now I have to implement this algorithm on an embedded device which has no memory limitations, but has very harsh processing constraints. Because of this, I would like to run a calculation engine which computes outcome for, say, 20 different values of each variable and stores this information in a file. You may think of this as a 5(or more)-dimensional matrix or 5(or more)-dimensional array, each dimension being 20 entries long. In any modern language, filling this array is as simple as having 5(or more) nested for loops. The tricky part is that I need to dump these values into a file that can then be placed onto the embedded device so that the device can use it as a lookup table. The questions now, are: What format(s) might be acceptable for storing the data? What programs (MATLAB, C#, etc) might be best suited to compute the data? C# must be used to import the data on the device - is this possible given your answer to #1?

    Read the article

  • Editable, growable DataGrid that retains values on postback and updates underlying DataTable

    - by jlstrecker
    I'm trying to create an ASP.NET/C# page that allows the user to edit a table of data, add rows to it, and save the data back to the database. For the table of data, I'm using a DataGrid whose cells contain TextBoxes or CheckBoxes. I have a button for adding rows (which works) and a button for saving the data. However, I'm quite stuck on two things: The TextBoxes and CheckBoxes should retain their values on postback. So if the user edits a TextBox and clicks the button to add more rows, the edits should be retained when the page reloads. However, the edits should not be saved to the database at this point. When the user clicks the save button, or anytime before, the DataTable underlying the DataGrid needs to be updated with the values of the TextBoxes and CheckBoxes so that the DataTable can be sent to the database. I have a method that does this, but I can't figure out when to call it. Any help getting this to work, or suggestions of alternative user interfaces that would behave similarly, would be appreciated.

    Read the article

  • Filtering null values with pig

    - by arianp
    It looks like a silly problem, but I can´t find a way to filter null values from my rows. This is the result when I dump the object geoinfo: DUMP geoinfo; ([longitude#70.95853,latitude#30.9773]) ([longitude#-9.37944507,latitude#38.91780853]) (null) (null) (null) ([longitude#-92.64416,latitude#16.73326]) (null) (null) ([longitude#-9.15199849,latitude#38.71179122]) ([longitude#-9.15210796,latitude#38.71195131]) here is the description DESCRIBE geoinfo; geoinfo: {geoLocation: bytearray} What I'm trying to do is to filter null values like this: geoinfo_no_nulls = FILTER geoinfo BY geoLocation is not null; but the result remains the same. nothing is filtered. I also tried something like this geoinfo_no_nulls = FILTER geoinfo BY geoLocation != 'null'; and I got an error org.apache.pig.backend.executionengine.ExecException: ERROR 1071: Cannot convert a map to a String What am I doing wrong? details, running on ubuntu, hadoop-1.0.3 with pig 0.9.3 pig -version Apache Pig version 0.9.3-SNAPSHOT (rexported) compiled Oct 24 2012, 19:04:03 java version "1.6.0_24" OpenJDK Runtime Environment (IcedTea6 1.11.4) (6b24-1.11.4-1ubuntu0.12.04.1) OpenJDK 64-Bit Server VM (build 20.0-b12, mixed mode)

    Read the article

  • Simulate stochastic bipartite network based on trait values of species - in R

    - by Scott Chamberlain
    I would like to create bipartite networks in R. For example, if you have a data.frame of two types of species (that can only interact across species, not within species), and each species has a trait value (e.g., size of mouth in the predator allows who gets to eat which prey species), how do we simulate a network based on the traits of the species (that is, two species can only interact if their traits overlap in values for instance)? UPDATE: Here is a minimal example of what I am trying to do. 1) create phylogenetic tree; 2) simulate traits on the phylogeny; 3) create networks based on species trait values. # packages install.packages(c("ape","phytools")) library(ape); library(phytools) # Make phylogenetic trees tree_predator <- rcoal(10) tree_prey <- rcoal(10) # Simulate traits on each tree trait_predator <- fastBM(tree_predator) trait_prey <- fastBM(tree_prey) # Create network of predator and prey ## This is the part I can't do yet. I want to create bipartite networks, where ## predator and prey interact based on certain crriteria. For example, predator ## species A and prey species B only interact if their body size ratio is ## greater than X.

    Read the article

  • Symfony form values missing

    - by Cav
    Hi, I was writing a simple login form, everything works fine (validation etc.) but I can't get the values, there's my code: public function executeIndex(sfWebRequest $request) { $this->getUser()->clearCredentials(); $this->getUser()->setAuthenticated(false); $this->form = new LoginForm(); if ($request->isMethod('post') && $request->hasParameter('login')) { $this->form->bind($request->getParameter('login')); if ($this->form->isValid()) { $this->getUser()->setAuthenticated(true); $this->getUser()->addCredential('user'); $this->login = $this->form->getValue('login'); } } } $this-login is NULL. Now I checked almost everything, the form is valid, isBound() is true, count() returns 3, I can see the values in my request: parameterHolder: action: index login: { login: foo, password: foo, _csrf_token: 53ebddee1883d7e3d6575d6fb1707a15 } module: login BUT getValues() returns NULL, getValue('login') etc. returns NULL as well. How can it be? And no, I don't want to use sfGuard-Plugins ;)

    Read the article

  • cannot see values from list in c#

    - by PriceCheaperton
    I have the following code: But i cannot response write the values in the list for debugging purposes... public void LottoWinners(object sender, EventArgs e) { Dictionary<int, int> number = new Dictionary<int, int>(); Random generator = new Random(); while (number.Count < 6) { number[generator.Next(1, 49)] = 1; } int[] lotto = number.Keys.OrderBy(n => n).ToArray(); List<int> lst = lotto.OfType<int>().ToList(); StringBuilder builder = new StringBuilder(); for (int i = 0; i < lst.Count; i++) // Loop through List with for { builder.Append(lst).Append("|"); // Append string to StringBuilder } string result = builder.ToString(); // Get string from StringBuilder Response.Write(result); } But all i see is as my result. I should be seeing the values of my list! System.Collections.Generic.List`1

    Read the article

  • Dynamically set the option values

    - by user281180
    I have 2 different lists: EmployeeNames and Names I read the values in Names and that of EmployeeNames. If EmployeeNames exists in Names, I must not add that value to "ToSelectBox" but to "FromSelectBox". If EmployeeNames doesn`t exist in Names, I must add that value to "ToSelectBox" but not to "FromSelectBox". How can I do that dynamically? I have 2 option values as follows: <select id="fromSelectBox" multiple="multiple" > <% foreach (var item in Model.EmployeeNames) { %> <option value="<%=Html.Encode(Item.Text)%>"><%=Html.Encode(item.Text)%></option> <%} %> </select> select id="ToSelectBox" multiple="multiple" > <% foreach (var item in Model.Names) { %> <option value="<%=Html.Encode(Item.Text)%>"><%=Html.Encode(item.Text)%></option> <%} %> </select>

    Read the article

  • Finding comma separated values with a colon delimiter

    - by iconMatrix
    I am setting values in my database for tourneyID,Selected,Paid,Entered,date then separating each selection with a colon So I have a string that may look like this 187,S,,,09-21-2013:141,S,,,06-21-2013:144,S,,,05-24-2013 but it also could look like this 145,S,,,07-12-2013:142,S,,,05-24-2013:187,S,,,09-21-2013 and some times is looks like this 87,S,,,07-11-2013:125,S,,,06-14-2013 I am trying to find this sequence: 187,S,,,09-21-2013 I have data stored like that because I paid a programmer to code it for me. Now, as I learn, I see it was not the best solution, but it is what I have till I learn more and it is working. My problem is when using LIKE it returns both the 187 and 87 values $getTeams = mysql_query("SELECT * FROM teams WHERE (team_tourney_vector LIKE '%$tid,S,P,,$tourney_start_date%' OR team_tourney_vector LIKE '%$tid,S,,,$tourney_start_date%') AND division='$division'"); I tried this using FIND_IN_SET() but it would only return the the team id for this string 187,S,,,09-21-2013:141,S,,,06-21-2013:144,S,,,05-24-2013 and does not find the team id for this string 145,S,,,07-12-2013:142,S,,,05-24-2013:187,S,,,09-21-2013 SELECT * FROM teams WHERE FIND_IN_SET('187',team_tourney_vector) AND (team_tourney_vector LIKE '%S,,,09-21-2013%') Any thoughts on how to achieve this?

    Read the article

< Previous Page | 26 27 28 29 30 31 32 33 34 35 36 37  | Next Page >