Search Results

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

Page 146/1423 | < Previous Page | 142 143 144 145 146 147 148 149 150 151 152 153  | Next Page >

  • Order a foreach, by the value of a calculation of values in the array

    - by Mark
    I have an array as follows: $players = array( $player = array( 'name' => 'playername', 'speed' => '10', 'agility' => '10', 'influence' => '10' ) etc Then I calculate a $score, based on the sum of speed, agility and influence. $score = $p['speed'] + $p['agility'] + $p['influence']; How can I loop through my array, but order the results from highest to lowest $score? PS- http://pastebin.com/eUEQ5y4u

    Read the article

  • Ruby: merge two hash as one and with value connected

    - by scalalala
    Hi guys: 2 hash: h1 = { "s1" => "2009-7-27", "s2" => "2010-3-6", "s3" => "2009-7-27" } h2 = { "s1" => "12:29:15", "s2" => "10:00:17", "s3" => "12:25:52" } I want to merge the two hash as one like this: h = { "s1" => "2009-7-27 12:29:15", "s2" => "2010-3-6 10:00:17", "s3" => "2009-7-27 2:25:52" } what is the best way to do this? thanks!

    Read the article

  • Alternate value of "FeedUri" for contacts entry .

    - by Preeti
    Hi, I am trying to create a contact on Google Apps. I am using Admin credential to create contact in other users in same domain. Problem i am facing is when i use: Uri feedUri = new Uri(ContactsQuery.CreateContactsUri("default")); ContactEntry createdEntry = (ContactEntry)service.Insert(feedUri, ContactEntry[0]); It is adding contact in Admin account but i a want to put contact in other user's account. How can i do that? I am using Google Apps API version 2 for .NET. Thanx

    Read the article

  • get value from database based on array in codeigniter

    - by Developer
    I have an array $user = array([0]=>1 [1]=>2 [2]=>3) which contains id's of certain users. I need to get the countries of these users from database. foreach($userid as $user){ $this->db->select('country'); $this->db->where('user_id',$user); $this->db->from('company'); $usercountry = $this->db->get(); $count = $usercountry->row(); $country = $count->country; } Suppose user1 has country ES, user2 has IN, user3 has US, user4 has UK. then if array contains 1,2,3. Then i need to get the countries ES,IN,US.

    Read the article

  • least value in count

    - by Nyfer
    i have a table employee(id,dept_id,salary,hire_date,job_id) . the following query i have to execute. Show all the employee who were hired on the day of the week on which least no of employee were hired. i have done the query, but am not able to get the least. please check if am correct. select id, WEEKDAY(hire_date)+1 as days,count(WEEKDAY(hire_date)+1) as count from test.employee group by days

    Read the article

  • How to search mulitple value seperated by commas in mysql

    - by Fero
    Hi all, How to search multiple values separated by commas. ex: table name : searchTest id name keyword 1 trophy1 test1,test2,test3 2 trophy2 test2,test5 Points: If i search for test2 both results trophy1 and trophy2 should be display. If i search for trophy1 then trophy1 should be as result. How to solve this issue. thanks in advance

    Read the article

  • Returning a Value from a jQuery Dialog Button Instead of Running a Function

    - by kamera
    I'm working on an admin UI and I can't wrap my head around how to get a specific kind of modal behaviour. I'm using jQuery. I already have a system for modal dialogs in place, where an openModal(settings) function opens a modal. Based on the settings, it will show/hide or sometimes inject various dialogs. I also have a generic confirmation dialog and this is the one I'm not sure how to make work. The layout is simple: <div id="confirmation-dialog"> <h2>Are you sure?</h2> <button class="button.yes">Yes</button> <button class="button.no">No</button> </div> I could just hard-code each button to do what I need it to do but I would like this to be more generic. Ideally, I would like it to function like this: (I know this doesn't work) function deleteImportantThing() { if (confirmThis() == true) { // Delete the thing } else { // Do nothing, close dialog } } function confirmThis() { openModal({kind: "confirm"}); // Check which button is clicked, then return true or false } I guess I just don't know enough JavaScript to get this to work, or to even figure out where to look. Any advice? I know there are modal dialog plug-ins out there but I'd have to change how the rest of my modals work to integrate them, and I'd like to do this myself if at all possible.

    Read the article

  • String.valueOf(int value) gives error [closed]

    - by Davidrd91
    I am trying to convert an int into a String so that I can put the String values into an SQLite Cursor. I've tried multiple syntax and methods but none seem to work for me. The Error occurs in MangaItemDB() while trying to convert any Int types aswell as the boolean. I've looked through several articles like this one but none works for me. Here's my code: public class MangaItem { private int _id; private String mangaName; private String mangaLink; private static String mangaAlpha; private static int mangaCount; private static int alphaCount; private boolean mangaComplete = false; public MangaItem MangaItemDB(int id, String mangaName, String mangaLink, String mangaAlpha, String mangaCount, String alphaCount, String mangaComplete) { MangaItem MangaItemDB = new MangaItem(); MangaItemDB._id = id; MangaItemDB.mangaName = mangaName; MangaItemDB.mangaLink = mangaLink; MangaItemDB.mangaAlpha = mangaAlpha; MangaItemDB.mangaCount = String.valueOf(int mangaCount); MangaItemDB.alphaCount = Integer.toString(getAlphaCount()); MangaItemDB.mangaComplete = String.valueOf(getMangaComplete()); return MangaItemDB; } public void incrementMangaCount() { mangaCount++; } public int getMangaCount() { return mangaCount; } public void incrementAlphaCount() { alphaCount++; } public int getAlphaCount() { return alphaCount; } public boolean setMangaComplete(boolean mangaComplete) { return true; } public boolean getMangaComplete() { return mangaComplete; } /** * @return the mangaName */ public String getMangaName() { return mangaName; } /** * @param mangaName the mangaName to set */ public void setMangaName(String mangaName) { this.mangaName = mangaName; } /** * @return the mangaLink */ public String getMangaLink() { return mangaLink; } /** * @param mangaLink the mangaLink to set */ public void setMangaLink(String mangaLink) { this.mangaLink = mangaLink; } /** * @return the mangaAlpha */ public String getMangaAlpha() { return mangaAlpha; } /** * @param mangaAlpha the mangaAlpha to set */ public void setMangaAlpha(String mangaAlpha) { this.mangaAlpha = mangaAlpha; } /** * @return the _id */ public int get_id() { return _id; } /** * @param _id the _id to set */ public void set_id(int _id) { this._id = _id; } } The lines : MangaItemDB.mangaCount = String.valueOf(mangaCount); MangaItemDB.alphaCount = Integer.toString(getAlphaCount()); MangaItemDB.mangaComplete = String.valueOf(getMangaComplete()); all give "Type mismatch: cannot convert from String to Int"

    Read the article

  • Obtaining Index value of dictionary

    - by Maudise
    I have a piece of code which looks at the following public Test As Dictionary(Of String, String()) Which is brought in tester = New Dictionary(Of String, String()) tester.add("Key_EN", {"Option 1_EN", "Option 2_EN", "Option 3_EN"}) tester.add("Key_FR", {"Option 1_FR", "Option 2_FR", "Option 3_FR"}) tester.add("Key_DE", {"Option 1_DE", "Option 2_DE", "Option 3_DE"}) There's then a combo box which looks at the following dim Language as string Language = "_EN" ' note this is done by a drop down combo box to select _EN or _FR etc. cboTestBox.items.AddRange(tester("Key" & Language)) What I need to be able to do is to see what index position the answer is in and convert it back to the Key_EN. So, for example _DE is selected, then the options of "Option 1_DE", "Option 2_DE", "Option 3_DE" would be displayed. If they chose Option 3_DE then I need to be able to convert this to Option 3_EN. Many thanks Maudise

    Read the article

  • getting double value from group concact

    - by Sackling
    I am having a problem where I am getting duplicated values from what I think I should be getting. here is my sql: SELECT DISTINCT p.products_image, pd.products_name, p.products_id, p.products_model, p.manufacturers_id, m.manufacturers_name, p.products_price, p.products_sort_order, p.products_tax_class_id, pd.products_viewed, group_concat(p2i.icons_id separator ",") AS icon_ids, group_concat(pi.icon_class separator ",") AS icon_class, IF(s.status, s.specials_new_products_price, NULL) AS specials_new_products_price, IF(s.status, s.specials_new_products_price, p.products_price) AS final_price FROM products p LEFT JOIN specials s ON p.products_id = s.products_id LEFT JOIN manufacturers m ON p.manufacturers_id = m.manufacturers_id JOIN products_description pd ON p.products_id = pd.products_id JOIN products_to_categories p2c ON p.products_id = p2c.products_id INNER JOIN products_specifications ps7 ON p.products_id = ps7.products_id LEFT JOIN products_to_icon p2i ON p.products_id = p2i.products_id LEFT JOIN products_icons pi ON p2i.icons_id = pi.icons_id WHERE p.products_status = '1' AND pd.language_id = '1' AND ps7.specification IN ('Polycotton' , 'Reflective') AND ps7.specifications_id = '7' AND ps7.language_id = '1' AND p2c.categories_id = '21' GROUP BY p.products_id ORDER BY p.products_sort_order The column that is getting double values is icon_ids from the group concact. This seams to happen only if ploycotton, and reflective are both IN ps7.specification. If it is only one or the other then it works fine. The products_to_icon table contains 2 columns, products_id and icons_id. If a product has 2 icons, there are 2 rows so I'm pretty sure it is this fact that is causing the duplicate icons ids. When I run this, the icon_ids column for a product with 2 icons is "4,4,6,6" for example, when what I need is "4,6"

    Read the article

  • Check if previous clicked value is inside an array

    - by Lelly
    I have a list with different categories. All the list item are clickable. I want the user to pick between 1 and 3 items. They can toggle their choice, but maximum is alway 3. So far, so good. Where it get tricky for me, is that I have some special categories that can't be combined with any others. When a user click on one of these, all the other categories deselect and they can't add any other, (these item have only 1 category selection possible) Exemple: Let's say "Car" is a special category. If they click on Car, everything else deselect, Car is selected, and they can't select anything else. BUT they can click again on Car to deselect it, and from there the logic start over. What's missing in my code is the part in bold just above this. My code: $j('.chooseCat li').on('click',function(){ var $this = $j(this); //list item clicked var catId = $this.children("a").attr("rel"); // list item id var specialCat = ['6','36','63']; if ($this.hasClass("selected")) { $this.removeClass("selected"); $j("#categorySuggestions p.error").hide("fast") } else { if( $j.inArray(catId, specialCat) !== -1 ) { $j('.chooseCat li').removeClass("selected"); $this.addClass("selected"); } else { if ($j('.chooseCat li.selected').length <= 2){ $this.addClass("selected"); } else { $j("#categorySuggestions p.error").show("fast").html("You cannot select any more categories"); } } } }); A working jsFiddle of where Iam at: http://jsfiddle.net/nfQum/9/

    Read the article

  • jQuery syntax for changing the value of a table cell

    - by cf_PhillipSenn
    I have a table where every row has a unique id. The last table cell has class="status" where I want to show the user the result of their action. In my $.ajax call, I have: ,success: function(result){ $('tr#'+result).td('.status').text('Updated'); }; result is the id of the row that was updated. It's just throwing an error message that says $( and that's all.

    Read the article

  • Python: Sort a dictionary by value

    - by the empirical programmer
    I have a dictionary of values read from 2 fields in a database: a string field and a numeric field. The string field is unique so that is the key of the dictionary. I can sort on the keys, but how can I sort based on the values? Note: I have read this post 72899 and probably could change my code to have a list of dictionaries but since I do not really need a list of dictionaries I wanted to know if there a simpler solution.

    Read the article

  • correct method "get next value"

    - by kapec
    Hello!! i need your help! this is my code, it not so good as i wander - it is not working. i have not idea anymore. </code>// need to get next parameter static double getParametr(){ Scanner scanner = new Scanner(System.in); param = scanner.nextDouble(); return param; } .......... ................ if (i==1){ System.out.println("vvedite storoni pryamougolnika: "); Shape parA = new Rectangle(); parA.a = Shape.getParametr(); --- this is ok double aa = parA.a; Shape parB = new Rectangle(); parB.b = Shape.getParametr(); ------ this is no work!!! double bb = parB.b; Rectangle rec = new Rectangle(aa, bb); arrayFigur[i] = rec.area(); } how fix mistake?

    Read the article

  • Change a link's href value based on time

    - by justSteve
    I'm coding a 'Connect to Meeting' page where i would like the link that allows attendees to join our GoToMeeting event to 'become active' 15 minutes prior to the start time. So the page users visit to see the connection info (meetingID, password) includes the start time of the meeting. I need a button ('Connect To Meeting') to change from inactive to Active when [Now() < (StartTime()-15minutes)].

    Read the article

  • How can I get returned value from JavaScript function that contain jQuery.get() ?

    - by Space Cracker
    I have a JavaScript method that call JQuery.get() and i want to return value from itto callee function .. the following is the code : function CheckExistance(userName) { $.get( "JQueryPage.aspx", { name: userName }, function(result) { if (result == "1") { value = true; } else if (result == "0") { value = false; } else if (result == "error") { value = false; } } ); return value; } i want return value; return the value setted in get() function ... i know that get() is asynchronous operation anf i want a solution to do that ?

    Read the article

  • Is there anyway that we can get a label value to a Sql

    - by Pradeep
    SELECT COUNT(*) AS Expr1 FROM Book INNER JOIN Temp_Order ON Book.Book_ID = Temp_Order.Book_ID WHERE (Temp_Order.User_ID = 25) AND (CONVERT (nvarchar, Temp_Order.OrderDate, 111) = CONVERT (nvarchar, GETDATE(), 111)) In here i want to change my User_ID to get from a label.Text this Sql Statement is in a DataView. so in the Wizard it not accepting a text box values or anything. can someone please help me to solve this

    Read the article

  • IE8 doesn't set value of an input

    - by Omu
    I some divs with forms inside of them and i do have inputs with same ids but in different divs and forms so do like this: $("divEdit form #ParentId").val(12); it works on chrome/mozilla but not on IE8 anybody knows why ?

    Read the article

< Previous Page | 142 143 144 145 146 147 148 149 150 151 152 153  | Next Page >