Search Results

Search found 28877 results on 1156 pages for 'do good'.

Page 119/1156 | < Previous Page | 115 116 117 118 119 120 121 122 123 124 125 126  | Next Page >

  • what are good ways to implement search and search results using ajax?

    - by Amr ElGarhy
    i have some text box in a page and in the same page there will be a table 'grid' like for holding the search result. When the user start editing and of the textbox above, the search must start by sending all textboxs values to the server 'ajax', and get back with the results to fill the below grid. Notes: This grid should support paging, sorting by clicking on headers and it will contains some controls beside the results such as checkboxs for boolean values and links for opening details in another page. I know many ways to do this some of them are: 1- updatepanel around all of these controls and thats it "fast dirty solution" 2- send the search criteria using ajax request using JQuery post function for example and get back the JSON result, and using a template will draw the grid "clean but will take time to finish and will be harder to edit later". 3- .... My question is: What do you think will be the best choice to implement this scenario? because i face this scenario too much, and want to know which implementation will be better regarding performance, optimization, and time to finish. I just want to know your thoughts about this issue.

    Read the article

  • What is a good way to simulate O_NOFOLLOW on systems without this flag?

    - by Daniel Trebbien
    I would like to safely be able to simulate open with O_CREAT | O_WRONLY | O_TRUNC | O_NOFOLLOW and O_CREAT | O_WRONLY | O_APPEND | O_NOFOLLOW on systems that do not support O_NOFOLLOW. I can somewhat achieve what I am asking for with: struct stat lst; if (lstat(filename, &lst) != -1 && S_ISLNK(lst.st_mode)) { errno = ELOOP; return -1; } mode_t mode = S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH | S_IWOTH; int fd = open(filename, O_CREAT | O_WRONLY | O_TRUNC | O_NOFOLLOW, mode); but then I introduce a race condition and possibly a security problem. I thought about maybe creating a dummy file with only the user being able to write, kind of like touching filename, doing the lstat check, and then using chmod after I finish writing (to correct the file mode bits), but I could be overlooking something major (e.g. if the file at filename exists, is not a regular file, or is already a symbolic link). What do you think?

    Read the article

  • what's a good technique for building and running many similar unit tests?

    - by jcollum
    I have a test setup where I have many very similar unit tests that I need to run. For example, there are about 40 stored procedures that need to be checked for existence in the target environment. However I'd like all the tests to be grouped by their business unit. So there'd be 40 instances of a very similar TestMethod in 40 separate classes. Kinda lame. One other thing: each group of tests need to be in their own solution. So Business Unit A will have a solution called Tests.BusinessUnitA. I'm thinking that I can set this all up by passing a configuration object (with the name of the stored proc to check, among other things) to a TestRunner class. The problem is that I'm losing the atomicity of my unit tests. I wouldn't be able to run just one of the tests, I'd have to run all the tests in the TestRunner class. This is what the code looks like at this time. Sure, it's nice and compact, but if Test 8 fails, I have no way of running just Test 8. TestRunner runner = new TestRunner(config, this.TestContext); var runnerType = typeof(TestRunner); var methods = runnerType.GetMethods() .Where(x => x.GetCustomAttributes(typeof(TestMethodAttribute), false) .Count() > 0).ToArray(); foreach (var method in methods) { method.Invoke(runner, null); } So I'm looking for suggestions for making a group of unit tests that take in a configuration object but won't require me to generate many many TestMethods. This looks like it might require code-generation, but I'd like to solve it without that.

    Read the article

  • A good extension to JSF that adheres to JSF2.0?

    - by Riz
    Hi, I have been looking for a JSF extension (Richfaces, IceFaces, and more) but all seem to be according to JSF1.x and ones for JSF2.0 are still alpha or in development and most of the documentation assumes you're using JSF1.2. Is there any production well known extension available?

    Read the article

  • If cookie found, get data, else create cookie, is this good logic?

    - by Ryan
    I have an Action that basically adds an item to a cart, the only way the cart is known is by checking the cookie, here is the flow of logic, please let me know if you see any issue... /order/add/[id] is called via GET action checks for cookie, if no cookie found, it makes a new cart, writes the identifier to the cookie, and adds the item to the database with a relation to the cart created if cookie is found, it gets the cart identifier from the cookie, gets the cart object, adds the item to the database with a relation to the cart found so it's basically like... action add(int id){ if(cookie is there) cart = getcart(cookievalue) else cart = makecart() createcookie(cart.id) additemtocart(cart.id, id) return "success"; } Seem right? I can't really thing of another way that would make sense.

    Read the article

  • What good programming practices will change with C++0x?

    - by Jon
    For example, "Don't return objects by value if they are expensive to copy" (RVO can't always be used). This advice might change because of rvalue references. The same might be said about storing collections of pointers to objects, because copying them by value into the collection was too expensive; this reason might no longer be valid. Or the use of enums might be discouraged in favour of "enum class". What other practices or tips will change?

    Read the article

  • debate: Is adding third party libraries to a war a good idea?

    - by Master Chief
    We have a debate going on . a. The "standard" way of assembling a web app. Create a WAR with all our app artifacts and all other components like hibernate and memcached etc are deployed in the tomcat/shared/lib area. b. Create a humongous war with everything included and nothing in tomcat/shared/lib. Pros for a - It keeps things modular and the war is small. Cons for a - dependency on shared/lib has to be managed especially by the deployment process. Pros for b - All dependencies are controlled by the build process removing any room for error. Cons for b - War is really, really big. If you are deploying over a network to a huge farm, then it might have an impact. want to see what thoughts others might have about this.

    Read the article

  • What is a good solution to log the deletion of a row in MySQL?

    - by hobodave
    Background I am currently logging deletion of rows from my tickets table at the application level. When a user deletes a ticket the following SQL is executed: INSERT INTO alert_log (user_id, priority, priorityName, timestamp, message) VALUES (9, 4, 'WARN', NOW(), "TICKET: David A. deleted ticket #6 from Foo"); Please do not offer schema suggestions for the alert_log table. Fields: user_id - User id of the logged in user performing the deletion priority - Always 4 priorityName - Always 'WARN' timestamp - Always NOW() message - Format: "[NAMESPACE]: [FullName] deleted ticket #[TicketId] from [CompanyName]" NAMESPACE - Always TICKET FullName - Full name of user identified by user_id above TicketId - Primary key ID of the ticket being deleted CompanyName - Ticket has a Company via tickets.company_id Situation/Questions Obviously this solution does not work if a ticket is deleted manually from the mysql command line client. However, now I need to. The issues I'm having are as follows: Should I use a PROCEDURE, FUNCTION, or TRIGGER? -- Analysis: TRIGGER - I don't think this will work because I can't pass parameters to it, and it would trigger when my application deleted the row too. PROCEDURE or FUNCTION - Not sure. Should I return the number of deleted rows? If so, that would require a FUNCTION right? How should I account for the absence of a logged in user? -- Possibilities: Using either a PROC or FUNC, require the invoker to pass in a valid user_id Require the user to pass in a string with the name Use the CURRENT_USER - meh Hard code the FullName to just be "Database Administrator" Could the name be an optional parameter? I'm rather green when it comes to sprocs. Assuming I went with the PROC/FUNC approach, is it possible to outright restrict regular DELETE calls to this table, yet still allow users to call this PROC/FUNC to do the deletion for them? Ideally the solution is usable by my application as well, so that my code is DRY.

    Read the article

  • c++: what is a good idea for a list of strings?

    - by John
    I simply want to build an RPG and make it as neat as possible, I wish to define a pile of strings which I may want to edit later, so I tried something like this: enum {MSG_INIT = "Welcome to ...", MSG_FOO = "bar"}; But I just get errors, such as that MSG_INIT is not an integer! Why must it not be a string, are that what enums are only for? What do you think is the best way to define a pile of strings? In a struct called msg or something? I'm kinda new to all this so I'd really appreciate small examples.

    Read the article

  • Any good idioms for error handling in straight C programs?

    - by Will Hartung
    Getting back in to some C work. Many of my functions look like this: int err = do_something(arg1, arg2, arg3, &result); With the intent the result gets populated by the function, and the return value is the status of the call. The darkside is you get something naive like this: int err = func1(...); if (!err) { err = func2(...); if (!err) { err = func3(...); } } return err; I could macro it I suppose: #define ERR(x) if (!err) { err = (x) } int err = 0; ERR(func1(...)); ERR(func2(...)); ERR(func3(...)); return err; But that only works if I'm chaining function calls, vs doing other work. Obviously Java, C#, C++ have exceptions that work very well for these kinds of things. I'm just curious what other folks do and how other folks do error handling in their C programs nowadays.

    Read the article

  • Is method reference caching a good idea in Java 8?

    - by gexicide
    Consider I have code like the following: class Foo { Y func(X x) {...} void doSomethingWithAFunc(Function<X,Y> f){...} void hotFunction(){ doSomethingWithAFunc(this::func); } } Consider that hotFunction is called very often. Would it then be advisable to cache this::func, maybe like this: class Foo { Function<X,Y> f = this::func; ... void hotFunction(){ doSomethingWithAFunc(f); } } As far as my understanding of java method references goes, the Virtual Machine creates an object of an anonymous class when a method reference is used. Thus, caching the reference would create that object only once while the first approach creates it on each function call. Is this correct? Should method references that appear at hot positions in the code be cached or is the VM able to optimize this and make the caching superfluous? Is there a general best practice about this or is this highly VM-implemenation specific whether such caching is of any use?

    Read the article

  • Assembla is no longer free, is there a good alternative?!

    - by pabloide86
    http://blog.assembla.com/assemblablog/tabid/12618/bid/6986/Release-2-0-restricting-free-plans-giving-back-with-features-and-pric I'm very disappointed about this... I use Assembla for my personal projects(commercial) and now I have to move everything to another place! There are some questions about different free hosting... I extracted some of the sites that offers free hosting for projects: http://www.svnhostingcomparison.com/ http://www.codespaces.com/ If you know about others like assembla please post it! Cheers from Argentina!

    Read the article

  • Is this a good approach to dealing with tagging?

    - by Mel
    Can this code be optimized or re-factored? Is this an optimal approach to tagging? The following code is a callback in my posts model. It creates a record that associates a tag with a post in a QuestionsTags joiner table. When necessary, if a given tag does not already exist in the tags table, the function creates it, then uses its id to create the new record in the QuestionsTags table. The difficulty with this approach is the QuestionsTags table depends on data in the tags table which may or may not exist. The function assumes the following tables: tags(id, tagName), posts(tags) // Comma delimited list questionsTags(postId, tagId) The idea is to loop over a delimited list of tags submitted with a post and check to see if each tag already exists in the tags table If tag exists: Check to see if there's already a QuestionTag record for this post and this tag in the QuestionTags table. If yes, do nothing (the association already exists) If no, create a new QuestionTag record using the id of the existing tag and the postId If tag does not already exist: Create the new tag in the tags table Use its id to create a new QuestionsTags record Code /** * @hint Sets tags for a given question. **/ private function setTags() { // Loop over the comma and space delmited list of tags for (local.i = 1; local.i LTE ListLen(this.tags, ", "); local.i = (local.i + 1)) { // Check if the tag already exists in the database local.tag = model("tag").findOneByTagName(local.i); // If the tag exists, look for an existing association between the tag and the question in the QuestionTag table if (IsObject(local.tag)) { local.questionTag = model("questionTag").findOneByPostIdAndTagId(values="#this.postId#,#local.tag.id#"); // If no assciatione exists, create a new QuestionTag record using the tagId and the postId if (! IsObject(local.questionTag)) { local.newQuestionTag = model("questionTag").new(postId = this.id, tagId = local.tag.id); // Abort if the saving the new QuestionTag is unsuccesful if (! local.newQuestionTag.save()) { return false; } } } // If the tag does not exist create it else { local.newTag = model("tag").new(tagName = local.i, userId = this.ownerUserId); // Abort if the the new tag is not saved successfully if (! local.newTag.save()) { return false; } // Otherwise create a new association in the QuestionTags table using the id of the newly created tag and the postId local.newQuestionTag = model("questionTag").new(postId = this.id, tagId = local.newTag.id); // Abort if the new QuestionTag does not save correctly if (! local.newQuestionTag.save()) { return false; } } } } FYI: I'm using CFWheels in my application, which explains the ORM functions used.

    Read the article

  • Implementing comparision operators via 'tuple' and 'tie', a good idea?

    - by Xeo
    (Note: tuple and tie can be taken from Boost or C++11.) When writing small structs with only two elements, I sometimes tend to choose a std::pair, as all important stuff is already done for that datatype, like operator< for strict-weak-ordering. The downsides though are the pretty much useless variable names. Even if I myself created that typedef, I won't remember 2 days later what first and what second exactly was, especially if they are both of the same type. This gets even worse for more than two members, as nesting pairs pretty much sucks. The other option for that is a tuple, either from Boost or C++11, but that doesn't really look any nicer and clearer. So I go back to writing the structs myself, including any needed comparision operators. Since especially the operator< can be quite cumbersome, I thought of circumventing this whole mess by just relying on the operations defined for tuple: Example of operator<, e.g. for strict-weak-ordering: bool operator<(MyStruct const& lhs, MyStruct const& rhs){ return std::tie(lhs.one_member, lhs.another, lhs.yet_more) < std::tie(rhs.one_member, rhs.another, rhs.yet_more); } (tie makes a tuple of T& references from the passed arguments.) Edit: The suggestion from @DeadMG to privately inherit from tuple isn't a bad one, but it got quite some drawbacks: If the operators are free-standing (possibly friends), I need to inherit publicly With casting, my functions / operators (operator= specifically) can be easily bypassed With the tie solution, I can leave out certain members if they don't matter for the ordering Are there any drawbacks in this implementation that I need to consider?

    Read the article

  • Please suggest good book/website to for Threads and Concurrency?

    - by learner
    I have gone through Head First Java and some other sites but I couldn't find complete stuff related to Threads and additional concurrency packages at one place. Please suggest a book/website which covers complete Threads with more details like Synchronize and locking of objects More detailed about volatile Visibility issues in Threads java.util.concurrent package java.util.concurrent.atomic package

    Read the article

< Previous Page | 115 116 117 118 119 120 121 122 123 124 125 126  | Next Page >