Search Results

Search found 1066 results on 43 pages for 'silly dg'.

Page 28/43 | < Previous Page | 24 25 26 27 28 29 30 31 32 33 34 35  | Next Page >

  • reorder list elements - jQuery?

    - by Alex
    Hello, I am experimenting with jQuery lately, and I was wondering if it's possible with js or pure jquery to reorder <li> elements. So if I have a silly list like the following: <ul> <li>Foo</li> <li>Bar</li> <li>Cheese</li> </ul> How would I move the list elements around? Like put the list element with Cheese before the list element with Foo or move Foo to after Bar. So is it possible? If so, how? Thanks!!

    Read the article

  • Partially flattening a list

    - by alj
    This is probably a really silly question but, given the example code at the bottom, how would I get a single list that retain the tuples? (I've looked at the itertools but it flattens everything) What I currently get is: ('id', 20, 'integer') ('companyname', 50, 'text') [('focus', 30, 'text'), ('fiesta', 30, 'text'), ('mondeo', 30, 'text'), ('puma', 30, 'text')] ('contact', 50, 'text') ('email', 50, 'text') what I would like is a single level list like: ('id', 20, 'integer') ('companyname', 50, 'text') ('focus', 30, 'text') ('fiesta', 30, 'text') ('mondeo', 30, 'text') ('puma', 30, 'text') ('contact', 50, 'text') ('email', 50, 'text') def getproducts(): temp_list=[] product_list=['focus','fiesta','mondeo','puma'] #usually this would come from a db for p in product_list: temp_list.append((p,30,'text')) return temp_list def createlist(): column_title_list = ( ("id",20,"integer"), ("companyname",50,"text"), getproducts(), ("contact",50,"text"), ("email",50,"text"), ) return column_title_list for item in createlist(): print item Thanks ALJ

    Read the article

  • Will lock() statement block all threads in the proccess/appdomain?

    - by MikeJ
    Maybe the question sounds silly, but I don't understand 'something about threads and locking and I would like to get a confirmation (here's why I ask). So, if I have 10 servers and 10 request in the same time come to each server, that's 100 request across the farm. Without locking, thats 100 request to the database. If I do something like this: private static readonly object myLockHolder = new object(); if (Cache[key] == null) { lock(myLockHolder) { if (Cache[key] == null) { Cache[key] = LengthyDatabaseCall(); } } } How many database requests will I do? 10? 100? Or as much as I have threads?

    Read the article

  • Best and shortest books on C++/STL/C#/J2SE to prepare for job inteview/tests

    - by Nerd
    I am a software developer with 10+ years commercial experience, I am comfortable with nearly all of imperative languages. But I realized that most of employers prefer not candidates who is able to deliver good software but those who is trained to answer questions like "what are ten differences between pointers and references in C++" or "what this messy code fragment will print". Last time I have read a book on C++ 15 years ago in secondary school and yes, that was Bjarne Stroustrup. But today I need something quick, without long philosophical explanations about polymorphism etc but with focus to silly interview tests. So, can you recommend any short and effective books to refresh my theoretical knowledge? Thank you.

    Read the article

  • Are spinlocks a good choice for a memory allocator?

    - by dsimcha
    I've suggested to the maintainers of the D programming language runtime a few times that the memory allocator/garbage collector should use spinlocks instead of regular OS critical sections. This hasn't really caught on. Here are the reasons I think spinlocks would be better: At least in synthetic benchmarks that I did, it's several times faster than OS critical sections when there's contention for the memory allocator/GC lock. Edit: Empirically, using spinlocks didn't even have measurable overhead in a single-core environment, probably because locks need to be held for such a short period of time in a memory allocator. Memory allocations and similar operations usually take a small fraction of a timeslice, and even a small fraction of the time a context switch takes, making it silly to context switch in the case of contention. A garbage collection in the implementation in question stops the world anyhow. There won't be any spinning during a collection. Are there any good reasons not to use spinlocks in a memory allocator/garbage collector implementation?

    Read the article

  • The standard map/associative-array structure to use in flash actionscript 3?

    - by tstyle
    I'm relatively new to flash, and is confused about what I should use to store and retrieve key value pairs. After some googling I've found various map-like things to choose from: 1) Use a Object: var map:Object = new Object(); map["key"] = "value"; The problem is that it seems to lack some very basic features. For example to even get the size of map I'd have to write a util method. 2) Use a Dictionary What does this standard library class provide over the simple object? It seems silly for it to exist if it's functionally identical to Object. 3) Go download some custom HashMap/HashTable implementation from the web. I've used a lot of modern languages, and this is the first time I haven't been able to find a library implementation of an associative array within 5 minutes. So I'd like to get some best-practice advice from an experienced flash developer. Thanks!

    Read the article

  • JSON Response {"d":"128.00"} but displaying "128"

    - by TGuimond
    Hi all, I have been working on a shopping cart that the user can add/remove order items as they please and am returning an updated sub-total via a webservice using jQuery $.ajax Here is how I am calling the webservice and setting the sub-total with the response. //perform the ajax call $.ajax({ url: p, data: '{' + s + '}', success: function(sTotal) { //order was updated: set span to new sub-total $("#cartRow" + orderID).find(".subTotal").text(sTotal); }, failure: function() { //if the orer was not saved //console.log('Error: Order not deleted'); } }); The response I am getting seems perfectly fine: {"d":"128.00"} When I display the total on the page it displays as 128 rather than 128.00 I am fully sure it is something very simple and silly but I am so deep into it now I need someone with a fresh brain to help me out!! Cheers :)

    Read the article

  • Load two instances of the same DLL in Delphi

    - by Tom
    Here's my problem: I would like to create two separate instances of the same DLL. The following doesn't work because Handle1 and Handle2 will get the same address Handle1 := LoadLibrary('mydll.dll'); Handle2 := LoadLibrary('mydll.dll'); The following works, but I have to make a copy of the DLL and rename it to something else (which seems a bit silly) Handle1 := LoadLibrary('mydll.dll'); Handle2 := LoadLibrary('mydll2.dll'); Is there a way to have only one DLL file, but load several instances of it?

    Read the article

  • Is a live internet connection required for push notification?

    - by Heshan Perera
    This maybe a silly question, but I need confirmation and I have no one else to ask. I am trying to understand the implications of implementing my own push notification for android mobile devices. This requires a continuous TCP connection to a server, though most of the time it will be idle. My assumption is that, even when idle, for the server to be able to push data to the client through the TCP connection, an active internet connection will always be required, and if the connection is disrupted (i.e. the user switches the connection off) this push will no longer be possible. Is this assumption correct ?

    Read the article

  • how to call a php class function directly using ajax?

    - by payling
    Is it possible to call a php class function DIRECTLY using ajax? Something like below... except ajax... myclass::myfunction(); I've been using the jquery library to work with AJAX. $.get('control.php', {func: funcName, arg1: arg1}); The above is similar to what I'm trying to achieve MINUS the control.php; I'm not sure if this is even possible, but I just thought it would be nice to skip the landing page (control.php) that recieves the funcName. I have a bunch of conditional statements that sort out what class function to run based on the funcName recieved. It seems kind of silly to do this, to have a separate page just to handle function calls. Is there a better way?

    Read the article

  • Patterns for avoiding jQuery silent fails

    - by Matias
    Is there any good practice to avoid your jQuery code silently fail? For example: $('.this #is:my(complexSelector)').doSomething(); I know that every time this line get executed, the selector is intended to match at least one element, or certain amount of elements. Is there any standard or good way to validate that? I thought about something like this: var $matchedElements = $('.this #is:my(complexSelector)'); if ($matchedElements.length < 0) throw 'No matched elements'; $matchedElements.doSomething(); Also I think unit testing would be a valid option instead of messing the code. My question may be silly, but I wonder whether there is a better option than the things that I'm currently doing or not. Also, maybe I'm in the wrong way checking if any element match my selector. However, as the page continues growing, the selectors could stop matching some elements and pieces of functionality could stop working inadvertently.

    Read the article

  • How to stop Excel from firing Worksheet_Change before Workbook_BeforeSave?

    - by Camil Bancioiu
    Update: Issue Resolved A colleague of mine was changing a cell during Workbook_BeforeSave() without disabling events, therefore triggering Worksheet_Change(). Yes, silly, but at least it's our fault, not Excel's I've noticed that whenever I hit Ctrl+S in Excel, the Worksheet_Change() is fired before Workbook_BeforeSave(). Is it possible to supress this behaviour using VBA code, but without supressing all events (i.e. without Application.EnableEvents = false)? This happens regardless of what I'm doing. I've read about someone having a similar issue with ComboBoxes, but I'm not editing ComboBoxes, yet Worksheet_Change() fires always before saving. Any ideas? I'm only trying to figure out how to bypass some code inside Worksheet_Change() when the document is saved, because that code is only supposed to be executed when the user actually changes something, not when the workbook is saved. Saving is by no means changing...

    Read the article

  • I'd want a method to be called only by objects of a specific class

    - by mp
    Suppose you have this class: public class A { private int number; public setNumber(int n){ number = n; } } I'd like the method setNumber could be called only by objects of a specific class. Does it make sense? I know it is not possible, is it? Which are the design alternatives? Some well known design pattern? Sorry for the silly question, but I'm a bit rusty in OO design.

    Read the article

  • Controlling rsync with Python?

    - by Cheesemold
    I've been wanting to write a python script that would run several instances of rsync in sequence for backing up data to a different computer. At the moment I just have this text file with the commands I use and I've just been copy-pasting them into the terminal, and it seems kinda silly. I want to be able to use python to do this for me. I know very vaguely how to use subprocess.popen, but I have no clue how to get python to interact with rsync directly, like for entering my password for me. Can python do that? Something like: if theProccess.proccessResponse == "Password:" : theProccess.respond(string) Or is the best that I can do is just have it, or even a bash script, just run the rsyncs in sequence and have to type my password in over and over again? Thanks in advance.

    Read the article

  • C program giving incorrect output for simple math!

    - by DuffDuff
    (all are declared as ints, none are initialized to anything beforehand. I have included math.h and am compiling with -lm) cachesize = atoi(argv[1]); blocksize = atoi(argv[3]); setnumber = (cachesize/blocksize); printf("setnumber: %d\n", setnumber); setbits = (log(setnumber))/(log(2)); printf("sbits: %d\n", setbits); when given cachesize as 1024 and blocksize as 16 the output is as follows: setnumber: 64 sbits: 5 but log(64)/log(2) = 6 ! It works correctly when given cachesize 512 and blocksize 32. I can't seem to win. I'm really hoping that it's a stupid mistake on my part, and I'd be grateful if anyone could point out what it is! Thank you! PS: I posted this in Yahoo Answers first but that was probably silly. Won't be doing that again.

    Read the article

  • JQuery: After adding some AJAX, some of the jquery code no longer works

    - by fwaokda
    Here's a pastebin link to my entire jQuery code. [ http://pastebin.com/w57ma5Gx ] The "Thumbnails" section was working fine before I added the ajax sections. Anyone can help me with why it quit working? And if I need to I can post another question but figured I'd try it here first. Whats a better way of writing the ajax code where it executes once upon loading the page and then every time I click the $("a#next") link afterwards? Right now I just repasted the code outside of the next link and that works, but seems silly to have the same code in two different places like that. Thanks!

    Read the article

  • Is there a way to include commas in CSV columns without breaking the formatting?

    - by editor
    I've got a two column CSV with a name and a number. Some people's name use commas, for example "Joe Blow, CFA." This comma breaks the CSV format, since it's interpreted as a new column. I've read up and the most common prescription seems to be replacing that character, or replacing the delimiter, with a new value (e.g. "this|that|the, other"). I'd really like to keep the comma separator (I know excel supports other delimiters but other interpreters may not). I'd also like to keep the comma in the name, as "Joe Blow| CFA" looks pretty silly. Is there a way to include commas in CSV columns without breaking the formatting, for example by escaping them?

    Read the article

  • This should be real easy. How to find a button through its Value (Jquery Selector)

    - by Raja
    I have this HTML: <div id='grid'> <input type="button" value="edit"/> <input type='button' value='update'/> </div> How to I attach a click event only to Update button. I know I could add a class to it or specity an id but both are not possible since it is in gridview. I tried this: $("input:button[@value='update']").click(function(){alert('test');}); but it displays an alert for both buttons. I know I must be doing something silly. Any help is much appreciated. Thanks Kobi for helping me out. Given below is the right answer. $("input[value='update']").click(function(){alert('test');});

    Read the article

  • Query Mongo Db and filter by associative array key

    - by Failpunk
    How can I search for results in Mongo DB documents using an associative array key. Something like: SELECT * FROM table WHERE keyword like '%searchterm%'; Here is the basic document structure [id] => 31605 [keywords] => Array ( [keyword1] => Array ( [name] => KeyWord1 ) [keyword2] => Array ( [name] => KeyWord2 ) ... ) I would like to do a search within the keywords array on the associative array key [keyword1, keyword2]. The issue is that the name key holds the case-sensitive version of the keyword and the array key is the lower-case keyword name. I could store the lowercase keyword twice, but that seems silly.

    Read the article

  • LINQ Query based on user preferences

    - by Chris Phelps
    How can I do this better (so it actually works : ) I have a LINQ Query that includes an order by that is based on a user preference. The user can decide if they would like the results ordered asc or desc. If fuserclass.SortOrder = "Ascending" Then Dim mydat = (From c In dc.ITRS Order By c.Date Ascending Select c) Else Dim mydat = (From c In dc.ITRS Order By c.Date Descending Select c) End If For each mydata in mydat ***<<<error "mydat is not declared"*** I know I could put my For Each loop inside the If and Else, but that seems silly to have the same code twice. I know you know of a better way : )

    Read the article

  • Should properties in C# perform a lot of work?

    - by Hamish Grubijan
    When a property is read from or is assigned to, one would not expect it to perform a lot of work. When setSomeValue(...) and getSomeValue(...) methods are used instead, one should not be that surprised that something non-trivial might be going on under the hood. However, now that C# gave the world Properties, it seems silly to use getter and setter methods instead. What is your take on this? Should I mark this Q as a community wiki? Thanks.

    Read the article

  • How to place a Rounded Rect UIBUTTON on UITableViewCell programmatically

    - by Tobias
    I was trying to place two uibuttons on uitableviewcell programmatically.. but unable to achieve that. somehow i managed to get the buttons through some sample project in which u can draw a nib for cell.. but i was unable to set a selector function for buttons.. in other example i can place a uiinfodark type button but when i change the type to rounded rect the button gets disappeared and i am unable to figure out why? I might be doing some silly mistake but I am really kinda stuck with it right now so I'll be very much thankful to all of you for helping in this regard.

    Read the article

  • Why is the destructor of the class called twice ?

    - by dicaprio
    Apologies if the question sounds silly, I was following experts in SO and trying some examples myself, and this is one of them. I did try the search option but didn't find an answer for this kind. class A { public: A(){cout<<"A Contruction"<<endl;} ~A(){cout<<"A destruction"<<endl;} }; int main() { vector<A> t; t.push_back(A()); // After this line, when the scope of the object is lost. } Why is the destructor of the class called twice ?

    Read the article

  • how to sort an existing table in greasemonkey ?

    - by user570512
    i'm writing a greasemonkey user.js for a page with a table in it. (table is 100 rows by 18 columns.) now what i want to do is to make it sortable on column. and also have it run in both chrome and firefox. all searches for answers sofar resulted in suggestions to use jquery/dojo or something alike. can i be done without any external code? after all it's just a matter of replacing the row's in a different order, right? or is that a silly thing to say? the thing is that i'm already using dojo for some query needs but since i want it to run in both firefox and chrome, i just copy paste the whole dojo thing in my script.. also, most of the solutions i found sofar seem to be more for use when building a table. not for altering an existing one. any help is appreciated.

    Read the article

  • Android:simulating 1-bit display

    - by user1681805
    I'm new to Android,trying to build a simple game which use 1-bit black and white display.the screen dimension is 160 * 80,that is 12800 pixels.I created a byte array for the "VRAM",so each time it draws,it first checks the array. The thing is that I am not drawing a point or rectangle for each pixel,I'm using 2 bitmaps(ARGB_4444,I have to use alpha channel,because of shadow effect),1 for positive and 1 for negative.So I called 12800 times drawBitmap() in the surfaceView's Draw method.I know that's silly...But even for openGL,12800 quards won't be that fast right? Sorry..I cannot post imgs.the link of screenshot:http://i1014.photobucket.com/albums/af267/baininja/Screenshot_2013-10-22-01-05-36_zps91dbcdef.png should i totally give up this and draw points on a 160*80 bitmap then scale it to intented size?But that loses the visual effects.

    Read the article

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