Search Results

Search found 2964 results on 119 pages for 'lucky cool'.

Page 75/119 | < Previous Page | 71 72 73 74 75 76 77 78 79 80 81 82  | Next Page >

  • javascript disabling a div or a link? (for a 5-star rating system)

    - by Cyprus106
    Basically, I've created a 5-star rating system. Pretty typical. It shows how many stars other people have given the item, and then when a user hovers over the stars, it lights up x number of stars based on how many they're over. It's all run by AJAX. They click 5 stars it automatically adds their 5-star rating to the group. The problem is that after they rate it I want to turn the system off, but I can't seem to be able to do that. I've tried everything I can think of. I've tried using element.disable for the a hrefs and for the div, but it still lets them vote away, over and over again, at least in firefox.... Can anyone help me out with a method to simply "freeze" the stars on what the user voted?? If I need to add code that's cool! I figured it probably wasn't necessary in this situation!

    Read the article

  • How would you start automating my job?

    - by Jurily
    At my new job, we sell imported stuff. In order to be able to sell said stuff, currently the following things need to happen for every incoming shipment: Invoice arrives, in the form of an email attachment, Excel spreadsheet Monkey opens invoice, copy-pastes the relevant part of three columns into the relevant parts of a spreadsheet template, where extremely complex calculations happen, like =B2*550 Monkey sends this new spreadsheet to boss (email if lucky, printer otherwise), who sets the retail price Monkey opens the reply, then proceeds to input the data into the production database using a client program that is unusable on so many levels it's not even worth detailing Monkey fires up HyperTerminal, types in "AT", disconnect Monkey sends text messages and emails to customers using another part of the horrible client program, one at a time I want to change Monkey from myself to software wherever possible. I've never written anything that interfaces with email, Excel, databases or SMS before, but I'd be more than happy to learn if it saves me from this. Here's my uneducated wishlist: Monkey asks Thunderbird (mail server perhaps?) for the attachment Monkey tells Excel to dump the spreadsheet into a more Jurily-friendly format, like CSV or something Monkey parses the output, does the complex calculations // TODO: find a way to get the boss-generated prices with minimal manual labor involved Monkey connects to the database, inserts data Monkey spams costumers Is all this feasible? If yes, where do I start reading? How would you improve it? What language/framework do you think would be ideal for this? What would you do about the boss?

    Read the article

  • Omit return type in C++0x

    - by Clinton
    I've recently found myself using the following macro with gcc 4.5 in C++0x mode: #define RETURN(x) -> decltype(x) { return x; } And writing functions like this: template <class T> auto f(T&& x) RETURN (( g(h(std::forward<T>(x))) )) I've been doing this to avoid the inconvenience having to effectively write the function body twice, and having keep changes in the body and the return type in sync (which in my opinion is a disaster waiting to happen). The problem is that this technique only works on one line functions. So when I have something like this (convoluted example): template <class T> auto f(T&& x) -> ... { auto y1 = f(x); auto y2 = h(y1, g1(x)); auto y3 = h(y1, g2(x)); if (y1) { ++y3; } return h2(y2, y3); } Then I have to put something horrible in the return type. Furthermore, whenever I update the function, I'll need to change the return type, and if I don't change it correctly, I'll get a compile error if I'm lucky, or a runtime bug in the worse case. Having to copy and paste changes to two locations and keep them in sync I feel is not good practice. And I can't think of a situation where I'd want an implicit cast on return instead of an explicit cast. Surely there is a way to ask the compiler to deduce this information. What is the point of the compiler keeping it a secret? I thought C++0x was designed so such duplication would not be required.

    Read the article

  • Generate random number from an arbitrary weighted list

    - by Fernando
    Here's what I need to do, I'll be doing this both in PHP and JavaScript. I have a list of numbers that will range from 1 to 300-500 (I haven't set the limit yet). I will be running a drawing were 10 numbers will be picked at random from the given range. Here's the tricky part: I want some numbers to be less likely to be drawn up. A small set of those 300-500 will be flagged as "lucky numbers". For example, out of 100 drawings, most numbers have equal chances of being drawn, except for a few, that will only be picked once every 30-50 drawings. Basically I need to artificially set the probability of certain numbers to be picked while maintaining an even distribution with the rest of the numbers. The only similar thing I've found so far is this question: Generate A Weighted Random Number, the problem being that my spec has considerably more numbers (up to 500) so the weights would get very small and supposedly this could be a problem with that solution (Rejection Sampling). I'm still trying it, though, but I wonder if there other solutions. Math is not my thing so I appreciate any input. Thanks.

    Read the article

  • Making a relevant search of text in database using regex

    - by madphp
    Can anyone tell me how I could count the possible instances of a keyword in a block of text? I've split a search term up into separate tokens, so just need to run through and do a count for every instance and removing punctuation or other special characters when making the count. Secondly, if someone has inserted search terms surrounded by double quotes, i want to be able to skip explode, but just count instances of that exact phrase. It doesn't have to be case sensitive and I would like to remove punctuation from the phrase when doing the count. Thirdly, in both cases i want to be able to ignore wordpress and html tags. Lastly, if anyone know any good tutorials for relevant searches that answer the questions above, that would cool too. I've got this far. $results = $wpdb->get_results($sql); $tokens = explode('search_terms'); // Re-arrange Relevant Results foreach ($results As $forum_topic){ foreach($tokens As $token){ // count tokens in topic_title if ($token ){ } } }

    Read the article

  • Which is more efficient/faster when calling a cached image?

    - by andufo
    Hi, i made an image resizer in php. When an image is resized, it caches a new jpg file with the new dimensions. Next time you call the exact img.php?file=hello.jpg&size=400 it checks if the new jpg has already been created. If it has NOT been created yet, it creates the file and then prints the output (cool). If it ALREADY exists, no new file needs to be generated and instead, it just calls the already cached file. My question is regarding the second scenario. Which of these is faster? redirecting: header('Location: cache/hello_400.jpg');die(); grabbing data and printing the cached file: $data = file_get_contents('cache/hello_400.jpg'); header('Content-type: '.$mime); header('Content-Length: '.strlen($data)); echo $data; Any other ways to improve this?

    Read the article

  • Fastest PHP Routine To Match Words

    - by Volomike
    What is the fastest way in PHP to take a keyword list and match it to a search result (like an array of titles) for all words? For instance, if my keyword phrase is "great leather shoes", then the following titles would be a match... Get Some Really Great Leather Shoes Leather Shoes Are Great Great Day! Those Are Some Cool Leather Shoes! Shoes, Made of Leather, Can Be Great ...while these would not be a match: Leather Shoes on Sale Today! You'll Love These Leather Shoes Greatly Great Shoes Don't Come Cheap I imagine there's some trick with array functions or a RegEx (Regular Expression) to achieve this rapidly.

    Read the article

  • [Ruby] How can I randomly iterate through a large Range?

    - by void
    I would like to randomly iterate through a range. Each value will be visited only once and all values will eventually be visited. For example: (0..9).sort_by{rand}.map{|x| f(x)} where f(x) is some function that operates on each value. A Fisher-Yates shuffle could be used to increase efficiency, but this code is sufficient for many purposes. My problem is that sort_by will transform the range into an array, which is not cool because I am working with astronomically large numbers. Ruby will quickly consume a large amount of RAM trying to create a monstrous array. This is also why the following code will not work: tried = {} # store previous attempts bigint = 99**99 bigint.times { x = rand(bigint) redo if tried[x] tried[x] = true f(x) # some function } This code is very naive and quickly runs out of memory as tried obtains more entries. What sort of algorithm can accomplish what I am trying to do?

    Read the article

  • How can a web developer learn to develop for the iPhone?

    - by Jared Christensen
    I'm a web developer and I'm getting envious of all the cool iPhone apps. I know nothing about C or what ever language they use to make iPhone apps. I really have no idea where to start. What do I need to do? Should I take a class, buy a book? I have a pretty good grasp on programing, I do tons of HTML, CSS and Javascript development and some PHP and Action Scripting. I'm not very good with Object Oriented Programing but I think I could pick it up if I used it more. I love video tutorials like lynda.com or net.tutsplus.com. I learn best buy jumping in and getting my hands dirty.

    Read the article

  • JavaScript change to DropDownList.SelectedIndex not submitted

    - by Bellfalasch
    Hi So, I have a form to submit fighters. You write his/her name, country, and then the team they fight for + the team's country. When you start typing the name I have constructed my own Ajax AutoCompleter. It will find existing fighters that might match. When you click on one of the suggestions it will populate up to four fields depending on existing data in the database. If you're lucky the fighter already exists with information on country, team, and the team's country. The problems starts when submitting. The JavaScript follows and just get's the id of the country to select (also the value of the select-option), and the select-element itself. function dropdownSelect(value, element) { var dropdown = document.getElementById(element); for (var i = 0; i < dropdown.options.length; i++) { if (dropdown.options[i].value == value) { dropdown.options[i].selected = true; return true; } } } When submitting the ASP.NET-code halt's and says that my country-field is null. So my JavaScript-change of selected field couldn't be read by ASP.NET. Is this a limitation of how ASP.NET works? Or a limitation of my skills? ;P

    Read the article

  • Javascript one-liners

    - by peoro
    Often I find some really cool javascript one liners that you can copy and paste into your browser address bar in order to get some fancy effects or even useful ones. This, for example, will let you edit anything on the page. javascript:document.body.contentEditable='true'; document.designMode='on'; void 0 What is your favorite? EDIT: I know that technically all these snippets are just javascript scripts that gets evaluated by the browser as if they were defined in the page. I also know that many browsers have got extensions to let you run javascript code (also letting you store scripts somewhere, providing a good editor etc etc). However that's not so practical; I'm not a javascript developer, haven't got firebug installed, and I can't install it anywhere I go. My idea idea is that of collecting the best "mini-scripts" that whoever can just copy and paste in his browser without the need of installing extensions and stuff.

    Read the article

  • Python __setattr__ and __getattr__ for global scope?

    - by KT
    Suppose I need to create my own small DSL that would use Python to describe a certain data structure. E.g. I'd like to be able to write something like f(x) = some_stuff(a,b,c) and have Python, instead of complaining about undeclared identifiers or attempting to invoke the function some_stuff, convert it to a literal expression for my further convenience. It is possible to get a reasonable approximation to this by creating a class with properly redefined __getattr__ and __setattr__ methods and use it as follows: e = Expression() e.f[e.x] = e.some_stuff(e.a, e.b, e.c) It would be cool though, if it were possible to get rid of the annoying "e." prefixes and maybe even avoid the use of []. So I was wondering, is it possible to somehow temporarily "redefine" global name lookups and assignments? On a related note, maybe there are good packages for easily achieving such "quoting" functionality for Python expressions?

    Read the article

  • Accessing Password Protected Network Drives in Windows in C#?

    - by tkeE2036
    Hi Everyone, So in C# I am trying to access a file on a network, for example at "//applications/myapp/test.txt", as follows: const string fileLocation = @"//applications/myapp/test.txt"; using (StreamReader fin = new StreamReader(FileLocation)) { while(!fin.EndOfStream()){ //Do some cool stuff with file } } However I get the following error: System.IO.IOException : Logon failure: unknown user name or bad password. I figure its because I need to supply some network credentials but I'm not sure how to get those to work in this situation. Does anyone know the best way (or any way) to gain access to these files that are on a a password protected location? Thanks in advance!!

    Read the article

  • How to get original url after HttpContext.RewritePath() has been called.

    - by jessegavin
    I am working on a web app which makes use of a 3rd party HttpModule that performs url rewriting. I want to know if there's any way to determine the original url later on in Application_BeginRequest event. For example... Original url: http://domain.com/products/cool-hat.aspx Re-written url (from 3rd party httpmodule): http://domain.com/products.aspx?productId=123 In the past I have written HttpModules that store the original url in HttpContext.Items but, this is a 3rd party app and I have no way of doing that. Any ideas would be appreciated.

    Read the article

  • Reusability, testability, code complexity reduction and showing-off-ability programming importance

    - by Andrew Florko
    There are lots of programming and architecture patterns. Patterns allow to make code cleaner, reusable, more testable & at last (but not at least) to feel the follower a real cool developer. How do you rank these considerations for you? What does affect you most when you decide to apply pattern? I wonder how many times code reusability (especially for MVP, MVC patterns) was important? For example DAL library often shared between projects (it's reusable) but how often controllers/views (abstracted via interfaces) are reused?

    Read the article

  • Method of getting text on a windows form ( unmanaged C++ project )

    - by Donovan
    I'm in the process of learning C++. I've created a boilerplate Win32 app within VC++ 2008. I've studied through the code and am ready do do a bit of experimenting. I thought it would be cool to print all the windows messages received in the message loop to the form created via the boilerplate code. I for the life of me, can't figure out the method of getting text onto that form. I can't seem to identify and named object that I can use to reference that damn form. The best I can figure is I need to use the handle to reference the form somehow. Still, even if I did know how to reference the form, I'm not sure I know how I would create a label to display the text. Anyway, if someone could just point out what methodology I need to learn to make this happen it would be much appreciated. Thanks, Donovan

    Read the article

  • Why are developers proud to say our application is XXX lines of code? [closed]

    - by mbcrump
    I admit, I used to do it. I was proud to tell a fellow developer my application is 10K+ lines of code. I thought it was a "Look at me, I'm smart" statement. Time passed and I realized that a experienced developer would be constantly refactoring all of his code. Not only for the sake of remembering what it was doing, but because he realizes he is smarter today than he was yesterday. No longer was it cool to have multiple nested if statements or completely ignoring generics/lambdas. So, whats your take on this? Do you do it and why?

    Read the article

  • Algorithm for calculating indefinite integrals

    - by mbac32768
    Suppose I have an integral that's bounded on one (or both) ends by (-)infinity. AFAICT, I can't analytically solve this problem, it takes brute force (e.g. using a Left Riemann Sum). I'm having trouble generalizing the algorithm so that it sets the proper subdivisions; I'll either do far too much work to calculate something trivial, or not do nearly enough and have huge aliasing errors. Answering in any language is cool, but maybe someone with better google-fu can end this quickly. :) Is what I'm looking for as impossible as trying to measure the British coastline?

    Read the article

  • With Rails 3 routes, how do you only allow a requests from 127.0.0.1?

    - by micah
    I'm writing an app where several of the routes should only be accessible from localhost. It looks like this is possible with the new routing system. http://www.railsdispatch.com/posts/rails-3-makes-life-better This has examples of restricting routes based on IP address, and setting up an IP address blacklist for your routes, but I'm interested in a whitelist with just one IP address. It would be cool if something like this worked: get "/posts" => "posts#show", :constraints => {:ip => '127.0.0.1'} But it didn't. Am I just missing the right syntax?

    Read the article

  • Fulltext for innoDB? or a good solution for php app

    - by Joshua
    I have a table I want to run a fulltext search on, but it is currently innoDB and is using a lot of foreign keys for other kinds of queries. Should I make like a 1:1 "meta-data" table that is myisam for fulltext? Also I am reading some things that say that fulltext corrupts MySQL tables pretty randomly? I dunno, the articles are a couple years old, maybe they've fixed that in 5+? If not what's a good solution for searching? Zend_Lucene seems cool but slow, even with caching, for the client's large tables and autocomplete functionality et al.

    Read the article

  • Next/Last word with Netbeans in Mac OSX

    - by Phuong Nguy?n
    I've just switched to Mac OSX from Ubuntu. The development on Mac OSX using Netbeans is really a joy (of hell, though) I don't know how to go to next word, last word using keyboard. In windows or ubuntu, this should be Ctrl+Left/Right, but definely not in Mac. In Mac, such key combinations result in go to begin/end of line. Futhermore, the use of Home and End is for something else, not go to begin/end of line (What a cool hell). Is there another key combination? I prefer default key settings, please. I'm sick of going around with custom script.

    Read the article

  • What should I tell kids about how great it is to be a programmer?

    - by Sara Chipps
    I am putting a presentation together. I thought about illustrating with websites like Facebook, and MySpace. Does anyone have children around that age that could tell me what they are into? How to hold their attention? Ways to illustrate what we do? Get them interested? Your ideas are greatly appreciated, I really want to be able to convey how fun this is :). I don't have access to a digital projector... which really stinks. I do have access to an old transparency overhead, though. http://stackoverflow.com/questions/207278/career-day-how-do-i-make-computer-programmer-sound-cool-to-8-year-olds

    Read the article

  • Greasemonkey failing to GM_setValue()

    - by HonoredMule
    I have a Greasemonkey script that uses a Javascript object to maintain some stored objects. It covers quite a large volume of information, but substantially less than it successfully stored and retrieved prior to encountering my problem. One value refuses to save, and I can not for the life of me determine why. The following problem code: Works for other larger objects being maintained. Is presently handling a smaller total amount of data than previously worked. Is not colliding with any function or other object definitions. Can (optionally) successfully save the problem storage key as "{}" during code startup. this.save = function(table) { var tables = this.tables; if(table) tables = [table]; for(i in tables) { logger.log(this[tables[i]]); logger.log(JSON.stringify(this[tables[i]])); GM_setValue(tables[i] + "_" + this.user, JSON.stringify(this[tables[i]])); logger.log(tables[i] + "_" + this.user + " updated"); logger.log(GM_getValue(tables[i] + "_" + this.user)); } } The problem is consistently reproducible and the logging statments produce the following output in Firebug: Object { 54,10 = Object } // Expansion shows complete contents as expected, but there is one oddity--Firebug highlights the array keys in purple instead of the usual black for anonymous objects. {"54,10":{"x":54,"y":10,"name":"Lucky Pheasant"}} // The correctly parsed string. bookmarks_HonoredMule saved undefined I have tried altering the format of the object keys, to no effect. Further narrowing down the issue is that this particular value is successfully saved as an empty object ("{}") during code initialization, but skipping that also does not help. Reloading the page confirms that saving of the nonempty object truly failed. Any idea what could cause this behavior? I've thoroughly explored the possibility of hitting size constraints, but it doesn't appear that can be the problem--as previously mentioned, I've already reduced storage usage. Other larger objects save still, and the total number of objects, which was not high already, has further been reduced by an amount greater than the quantity of data I'm attempting to store here.

    Read the article

  • Where can I find a control similar to the Firefox Rich List Box for use in my application?

    - by bsruth
    I'm trying to implement a control similar to Firefox's Rich List Box: However, I can only find the XUL implementation of this control, and I don't want to have to include a XUL processing engine in my application just to get a cool looking listbox. I've been trying to implement one on my own by customizing MFC's CListBox control, but am starting to realize it may take more time than I had intended. Before continuing to implement this control from scratch, I was wondering if anyone knew of a similar control that already exists, either commercial or open source. The main functionality I would like to have is: Small display for non selected items that expands when selected. Ability to add arbitrary controls to the expanded view. Preferably native code, but can probably use managed controls via native/managed interop with out too much extra work. Any help would be appreciated, I don't want to have to reinvent the wheel if I don't have to.

    Read the article

  • How to transfer large files from desktop to server ( .NET)

    - by rahulchandran
    I am writing a .NET 2.0 based desktop client that will send large files ( well largish under 2GB) to a server. Need to develop the server as well. Server can be on any technology It should be secure so an underlying SSL stream is needed What are my options. Any obvious caveats etc I should be aware of To my mind the simplest solution is to open a tcp\ip connection over SSL to the server and send n packets each of size M bytes and then have the server append the chunks to the file and finally send an EOF packet as well IS this horrible. Will the perf suck on the server with all these disk writes What are any other clever options. I am limited to .NET 2.0 on the client if I did move to a WCF client will it buy be something magical and cool for this scenario Thanks

    Read the article

< Previous Page | 71 72 73 74 75 76 77 78 79 80 81 82  | Next Page >