Search Results

Search found 285 results on 12 pages for 'larry kyrala'.

Page 5/12 | < Previous Page | 1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >

  • Return pre-UPDATE column values in PostgreSQL without using triggers, functions or other "magic"

    - by Python Larry
    I have a related question, but this is another part of MY puzzle. I would like to get the OLD VALUE of a Column from a Row that was UPDATEd... WITHOUT using Triggers (nor Stored Procedures, nor any other extra, non-SQL/-query entities). The query I have is like this: UPDATE my_table SET processing_by = our_id_info -- unique to this instance WHERE trans_nbr IN ( SELECT trans_nbr FROM my_table GROUP BY trans_nbr HAVING COUNT(trans_nbr) > 1 LIMIT our_limit_to_have_single_process_grab ) RETURNING row_id If I could do "FOR UPDATE ON my_table" at the end of the subquery, that'd be devine (and fix my other question/problem). But, that won't work: can't have this AND a "GROUP BY" (which is necessary for figuring out the COUNT of trans_nbr's). Then I could just take those trans_nbr's and do a query first to get the (soon-to-be-) former processing_by values. I've tried doing like: UPDATE my_table SET processing_by = our_id_info -- unique to this instance FROM my_table old_my_table JOIN ( SELECT trans_nbr FROM my_table GROUP BY trans_nbr HAVING COUNT(trans_nbr) > 1 LIMIT our_limit_to_have_single_process_grab ) sub_my_table ON old_my_table.trans_nbr = sub_my_table.trans_nbr WHERE my_table.trans_nbr = sub_my_table.trans_nbr AND my_table.processing_by = old_my_table.processing_by RETURNING my_table.row_id, my_table.processing_by, old_my_table.processing_by But that can't work; "old_my_table" is not viewable outside of the join; the RETURNING clause is blind to it. I've long since lost count of all the attempts I've made; I have been researching this for literally hours. If I could just find a bullet-proof way to lock the rows in my subquery - and ONLY those rows, and WHEN the subquery happens - all the concurrency issues I'm trying to avoid disappear... UPDATE: [WIPES EGG OFF FACE] Okay, so I had a typo in the non-generic code of the above that I wrote "doesn't work"; it does... thanks to Erwin Brandstetter, below, who stated it would, I re-did it (after a night's sleep, refreshed eyes, and a banana for bfast). Since it took me so long/hard to find this sort of solution, perhaps my embarrassment is worth it? At least this is on SO for posterity now... : What I now have (that works) is like this: UPDATE my_table SET processing_by = our_id_info -- unique to this instance FROM my_table AS old_my_table WHERE trans_nbr IN ( SELECT trans_nbr FROM my_table GROUP BY trans_nbr HAVING COUNT(*) > 1 LIMIT our_limit_to_have_single_process_grab ) AND my_table.row_id = old_my_table.row_id RETURNING my_table.row_id, my_table.processing_by, old_my_table.processing_by AS old_processing_by The COUNT(*) is per a suggestion from Flimzy in a comment on my other (linked above) question. (I was more specific than necessary. [In this instance.])

    Read the article

  • Best way to show code snippets in word?

    - by Larry
    Does anyone know a good way to display code in Microsoft Word documents? I have tried to include code as regular text which looks awful and gets in the way when editing regular text. I have also tried inserting objects, a WordPad document and Text Box, into the document then putting the code inside those objects. The code looks much better and is easier to avoid while editing the rest of the text. However, these objects can only span one page which makes editing a nightmare when several pages of code need to be added. Lastly, I know that there are much better editors/formats that have no problem handling this but I am stuck working with MS word.

    Read the article

  • UITableView not responding to row selection until a different row is selected

    - by Larry Fransson
    This is driving me nuts. I have searched on everything I can think of to find a solution but haven't found one yet. I've got a UITableView that uses custom cells. The accessory is the detail disclosure button. I would like the cell to respond to either row selection or the disclosure button being tapped. It responds to the disclosure button just as you would expect. But selecting the row is a different story. When I select the row, it highlights, but nothing happens until I tap a different row. Then the previously selected row does what it was supposed to do, which is to create and push a new view controller for that row. If I tap a single row five times and then tap a different row, it then creates and pushes five view controllers for that first row. It does this both in the simulator and on the device. What's really maddening is that I have another tableview in the same application that responds correctly to row selection or tapping the detail disclosure button. I can't find anything I've done differently between the two. Has anyone seen this before?

    Read the article

  • MySQL: order by and limit gives wrong result

    - by Larry K
    MySQL ver 5.1.26 I'm getting the wrong result with a select that has where, order by and limit clauses. It's only a problem when the order by uses the id column. I saw the MySQL manual for LIMIT Optimization My guess from reading the manual is that there is some problem with the index on the primary key, id. But I don't know where I should go from here... Question: what should I do to best solve the problem? Works correctly: mysql> SELECT id, created_at FROM billing_invoices WHERE (billing_invoices.account_id = 5) ORDER BY id DESC ; +------+---------------------+ | id | created_at | +------+---------------------+ | 1336 | 2010-05-14 08:05:25 | | 1334 | 2010-05-06 08:05:25 | | 1331 | 2010-05-05 23:18:11 | +------+---------------------+ 3 rows in set (0.00 sec) WRONG result when limit added! Should be the first row, id - 1336 mysql> SELECT id, created_at FROM billing_invoices WHERE (billing_invoices.account_id = 5) ORDER BY id DESC limit 1; +------+---------------------+ | id | created_at | +------+---------------------+ | 1331 | 2010-05-05 23:18:11 | +------+---------------------+ 1 row in set (0.00 sec) Works correctly: mysql> SELECT id, created_at FROM billing_invoices WHERE (billing_invoices.account_id = 5) ORDER BY created_at DESC ; +------+---------------------+ | id | created_at | +------+---------------------+ | 1336 | 2010-05-14 08:05:25 | | 1334 | 2010-05-06 08:05:25 | | 1331 | 2010-05-05 23:18:11 | +------+---------------------+ 3 rows in set (0.01 sec) Works correctly with limit: mysql> SELECT id, created_at FROM billing_invoices WHERE (billing_invoices.account_id = 5) ORDER BY created_at DESC limit 1; +------+---------------------+ | id | created_at | +------+---------------------+ | 1336 | 2010-05-14 08:05:25 | +------+---------------------+ 1 row in set (0.01 sec) Additional info: explain SELECT id, created_at FROM billing_invoices WHERE (billing_invoices.account_id = 5) ORDER BY id DESC limit 1; +----+-------------+------------------+-------+--------------------------------------+--------------------------------------+---------+------+------+-------------+ | id | select_type | table | type | possible_keys | key | key_len | ref | rows | Extra | +----+-------------+------------------+-------+--------------------------------------+--------------------------------------+---------+------+------+-------------+ | 1 | SIMPLE | billing_invoices | range | index_billing_invoices_on_account_id | index_billing_invoices_on_account_id | 4 | NULL | 3 | Using where | +----+-------------+------------------+-------+--------------------------------------+--------------------------------------+---------+------+------+-------------+

    Read the article

  • Component Creation How-to

    - by Larry Lewis
    I want to create a component that will allow me to install other components, modules, and plugins that i personally use all the time. I will need to be able to change these modules, components, and plugins at anytime but updating the components and etc.. that i use and be able to add more plugins and etc as well. I would like this Component because it takes too much time to install them all individually and on multiple sites as a web designer. I also would need to have some instruction on how to add subtract plugins, modules, components, and etc. I am ok with not a total integration i would like to be able to just host the install file on my server with a link to my server where the file is located. If anyone can help with this please do.

    Read the article

  • XSLT: If Node = A then set B=1 Else B=2

    - by Larry
    I am looping thru looking at the values of a Node. If Node = B, then B has one of two possible meanings. --If Node = A has been previously found in the file, then the value for A should be sent as 1. --If Node = A has NOT been found in the file, the the value for A should be sent as 2. where file is the xml source to be transformed I cannot figure out how to do this. If I was using a programming language that allowed for a variable to have its value reassigned/changed, then it is easy. But, with XSLT variables are set once.

    Read the article

  • service.close() vs. service.abort() - WCF example

    - by Larry Watanabe
    In one of the WCF tutorials, I saw the followign sample code: Dim service as ...(a WCF service ) try .. service.close() catch ex as Exception() ... service.abort() end try Is this the correct way to ensure that resources (i.e. connections) are released even under error conditions? Thanks for the answers guys! I upvoted you all.

    Read the article

  • Apache Rewrite & Alias combined

    - by Larry
    Hello, We have run into an issue where we have an existing Alias, and we would like to add a rewrite rule to catch all variations of case-insensitive spellings, ie: URL: http://www.example.com/example Alias /example "/var/www/html/web/example" We need a rewrite rule to catch: /ExamPle /exampLE /eXAmple etc ... If anyone could help, that would be great! We cannot seem to get the rewrite & Alias to work together. Thanks and God Bless!

    Read the article

  • Avoiding a fork()/SIGCHLD race condition

    - by larry
    Please consider the following fork()/SIGCHLD pseudo-code. // main program excerpt for (;;) { if ( is_time_to_make_babies ) { pid = fork(); if (pid == -1) { /* fail */ } else if (pid == 0) { /* child stuff */ print "child started" exit } else { /* parent stuff */ print "parent forked new child ", pid children.add(pid); } } } // SIGCHLD handler sigchld_handler(signo) { while ( (pid = wait(status, WNOHANG)) > 0 ) { print "parent caught SIGCHLD from ", pid children.remove(pid); } } In the above example there's a race-condition. It's possible for "/* child stuff */" to finish before "/* parent stuff */" starts which can result in a child's pid being added to the list of children after it's exited, and never being removed. When the time comes for the app to close down, the parent will wait endlessly for the already-finished child to finish. One solution I can think of to counter this is to have two lists: started_children and finished_children. I'd add to started_children in the same place I'm adding to children now. But in the signal handler, instead of removing from children I'd add to finished_children. When the app closes down, the parent can simply wait until the difference between started_children and finished_children is zero. Another possible solution I can think of is using shared-memory, e.g. share the parent's list of children and let the children .add and .remove themselves? But I don't know too much about this. EDIT: Another possible solution, which was the first thing that came to mind, is to simply add a sleep(1) at the start of /* child stuff */ but that smells funny to me, which is why I left it out. I'm also not even sure it's a 100% fix. So, how would you correct this race-condition? And if there's a well-established recommended pattern for this, please let me know! Thanks.

    Read the article

  • Is it possible to rebind sql paramters using the result from a cfquery?

    - by Larry
    When I run the following code: <cfquery name="someQuery" result="queryResult" datasource="wetakepictures"> SELECT id FROM events WHERE category_id = <cfqueryparam value="1" cfsqltype="cf_sql_integer"> OR title like <cfqueryparam value="%test%" cfsqltype="cf_sql_varchar"> </cfquery> <cfoutput> #queryResult.sql# <br /> #ArrayToList(queryResult.sqlparameters)# </cfoutput> It outputs: SELECT id FROM events WHERE category_id = ? OR title like ? 1,%test% I need the actual string "SELECT id FROM events WHERE category_id = 1 OR title like '%test%'". Is there a way to rebind the parameters to the sql?

    Read the article

  • Can't get correct package from Nexus? error in "mvn help:effective-settings"

    - by larry cai
    I use nexus opensource version maven 2.2.1 When I type "mvn help:effective-settings", i got the error below [INFO] Scanning for projects... [INFO] Searching repository for plugin with prefix: 'help'. [INFO] ------------------------------------------------------------------------ [ERROR] BUILD ERROR [INFO] ------------------------------------------------------------------------ [INFO] Error building POM (may not be this project's POM). Project ID: org.apache.maven.plugins:maven-help-plugin Reason: Error getting POM for 'org.apache.maven.plugins:maven-help-plugin' from the repository: Failed to resolve artifact, possibly due to a repository list that is not appropriately equipped for this artifact's metadata. org.apache.maven.plugins:maven-help-plugin:pom:2.2-SNAPSHOT from the specified remote repositories: Nexus (http://192.168.56.191:8081/nexus/content/groups/public) for project org.apache.maven.plugins:maven-help-plugin When I check the local repository under ~.m2\repository\org\apache\maven\plugins\maven-help-plugin It has a file maven-metadata-central.xml <?xml version="1.0" encoding="UTF-8"?> <metadata> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-help-plugin</artifactId> <versioning> <latest>2.2-SNAPSHOT</latest> <release>2.1.1</release> <versions> <version>2.0</version> <version>2.0.1</version> <version>2.0.2</version> <version>2.1</version> <version>2.1.1</version> <version>2.2-SNAPSHOT</version> </versions> <lastUpdated>20100519065440</lastUpdated> </versioning> </metadata> And I can't find any jar files under directory, what's wrong with nexus server ? I can't easily find support information from nexus. Any hints

    Read the article

  • Issue with Callback method and maintaining CultureInfo and ASP.Net HttpRuntime

    - by Little Larry Sellers
    Hi All, Here is my issue. I am working on an E-commerce solution that is deployed to multiple European countries. We persist all exceptions within the application to SQL Server and I have found that there are records in the DB that have a DateTime in the future! We define the culture in the web.config, for example pt-PT, and the format expected is DD-MM-YYYY. After debugging I found the issue with these 'future' records in the DB is because of Callback methods we use. For example, in our Caching architecture we use Callbacks, as such - CacheItemRemovedCallback ReloadCallBack = new CacheItemRemovedCallback(OnRefreshRequest); When I check the current threads CultureInfo, on these Callbacks it is en-US instead of pt-PT and also the HttpContext is null. If an exception occurs on the Callback our exception manager reports it as MM-DD-YYYY and thus it is persisted to SQL Server incorrectly. Unfortunately, in the exception manager code, we use DateTime.Now, which is fine if it is not a callback. I can't change this code to be culture specific due to it being shared across other verticals. So, why don't callbacks into ASP.Net maintain context? Is there any way to maintain it on this callback thread? What are the best practices here? Thanks.

    Read the article

  • Rails Metaprogramming: How to add instance methods at runtime?

    - by Larry K
    I'm defining my own AR class in Rails that will include dynamically created instance methods for user fields 0-9. The user fields are not stored in the db directly, they'll be serialized together since they'll be used infrequently. Is the following the best way to do this? Alternatives? Where should the start up code for adding the methods be called from? class Info < ActiveRecord::Base end # called from an init file to add the instance methods parts = [] (0..9).each do |i| parts.push "def user_field_#{i}" # def user_field_0 parts.push "get_user_fields && @user_fields[#{i}]" parts.push "end" end Info.class_eval parts.join

    Read the article

  • Can my app arrange a gdb breakpoint or watch?

    - by Larry Gritz
    Is there a way for my code to be instrumented to insert a break point or watch on a memory location that will be honored by gdb? (And presumably have no effect when gdb is not attached.) I know how to do such things as gdb commands within the gdb session, but for certain types of debugging it would be really handy to do it "programmatically", if you know what I mean -- for example, the bug only happens with a particular circumstance, not any of the first 11,024 times the crashing routine is called, or the first 43,028,503 times that memory location is modified, so setting a simple break point on the routine or watch point on the variable is not helpful -- it's all false positives. I'm concerned mostly about Linux, but curious about if similar solutions exist for OS X (or Windows, though obviously not with gdb).

    Read the article

  • How to use JQuery Validate to create a popup with all form error when the submit button is clicked?

    - by Larry
    I am using the JQuery Validation plugin for client side form validation. In addition to the colorful styling on invalid form fields, my client requires that a popup message be shown. I only want to show this message when the submit button is click because it would drive the user crazy otherwise. I tried the following code, but errorList is always empty. Anyone know the correct way to do something similar. function popupFormErrors(formId) { var validator = $(formId).validate(); var message = ''; for (var i = 0; i < validator.errorList.length - 1; i++) { message += validator.errorList[i].message + '\n'; } if (message.length > 0) { alert(message); } } $('#btn-form-submit').click(function(){ $('#form-register').submit(); popupFormErrors('#btn-form-submit'); return false; }); $('#form-register').validate({ errorPlacement: function(error, element) {/* no room on page */}, highlight: function(element) { $(element).addClass('invalid-input'); }, unhighlight: function(element) { $(element).removeClass('invalid-input'); }, ... }); Update From the info in the accepted answer I came up with this. var submitClicked = false; $('#btn-form-submit').click(function() { submitClicked = true; $('#form-register').submit(); return false; }); $('#form-register').validate({ errorPlacement: function(error, element) {/* no room on page */}, highlight: function(element) { $(element).addClass('invalid-input'); }, unhighlight: function(element) { $(element).removeClass('invalid-input'); }, showErrors: function(errorsObj) { this.defaultShowErrors(); if (submitClicked) { submitClicked = false; ... create popup from errorsObj... } } ... });

    Read the article

  • Receiving the post response using curl

    - by Larry Battle
    Hello, I'm trying to make a script that will download search results from a HTTPS website using POST. So far, I'm able to download the web page before the submission but not the response page containing the search results. The problem seems to be that curl isn't waiting long enough for the response page to appear. The website behaviors likes this. Website appears- input form data - click submit - progressing icon appears - returns new web page with search results( new data but the url doesn't change ) My code: curl -d "postData" -k url

    Read the article

  • How can a C/C++ program put itself into background?

    - by Larry Gritz
    What's the best way for a running C or C++ program that's been launched from the command line to put itself into the background, equivalent to if the user had launched from the unix shell with '&' at the end of the command? (But the user didn't.) It's a GUI app and doesn't need any shell I/O, so there's no reason to tie up the shell after launch. But I want a shell command launch to be auto-backgrounded without the '&' (or on Windows). Ideally, I want a solution that would work on any of Linux, OS X, and Windows. (Or separate solutions that I can select with #ifdef.) It's ok to assume that this should be done right at the beginning of execution, as opposed to somewhere in the middle. One solution is to have the main program be a script that launches the real binary, carefully putting it into the background. But it seems unsatisfying to need these coupled shell/binary pairs. Another solution is to immediately launch another executed version (with 'system' or CreateProcess), with the same command line arguments, but putting the child in the background and then having the parent exit. But this seems clunky compared to the process putting itself into background. Edited after a few answers: Yes, a fork() (or system(), or CreateProcess on Windows) is one way to sort of do this, that I hinted at in my original question. But all of these solutions make a SECOND process that is backgrounded, and then terminate the original process. I was wondering if there was a way to put the EXISTING process into the background. One difference is that if the app was launched from a script that recorded its process id (perhaps for later killing or other purpose), the newly forked or created process will have a different id and so will not be controllable by any launching script, if you see what I'm getting at. Edit #2: fork() isn't a good solution for OS X, where the man page for 'fork' says that it's unsafe if certain frameworks or libraries are being used. I tried it, and my app complains loudly at runtime: "The process has forked and you cannot use this CoreFoundation functionality safely. You MUST exec()." I was intrigued by daemon(), but when I tried it on OS X, it gave the same error message, so I assume that it's just a fancy wrapper for fork() and has the same restrictions. Excuse the OS X centrism, it just happens to be the system in front of me at the moment. But I am indeed looking for a solution to all three platforms.

    Read the article

  • d3 tree - parents having same children

    - by Larry Anderson
    I've been transitioning my code from JIT to D3, and working with the tree layout. I've replicated http://mbostock.github.com/d3/talk/20111018/tree.html with my tree data, but I wanted to do a little more. In my case I will need to create child nodes that merge back to form a parent at a lower level, which I realize is more of a directed graph structure, but would like the tree to accomodate (i.e. notice that common id's between child nodes should merge). So basically a tree that divides like normal on the way from parents to children, but then also has the ability to bring those children nodes together to be parents (sort of an incestual relationship or something :)). Asks something similar - How to layout a non-tree hierarchy with D3 It sounds like I might be able to use hierarchical edge bundling in conjunction with the tree hierarchy layout, but I haven't seen that done. I might be a little off with that though.

    Read the article

  • Why does OSX document atoi/atof as not being threadsafe?

    - by Larry Gritz
    I understand that strtol and strtof are preferred to atoi/atof, since the former detect errors, and also strtol is much more flexible than atoi when it comes to non-base-10. But I'm still curious about something: 'man atoi' (or atof) on OS X (though not on Linux!) mentions that atoi/atof are not threadsafe. I frankly have a hard time imagining a possible implementation of atoi or atof that would not be threadsafe. Does anybody know why the man page says this? Are these functions actually unsafe on OS X or any other platform? And if they are, why on earth wouldn't the library just define atoi in terms of strtol, and therefore be safe?

    Read the article

  • Set plugin’s version on the command line in maven 2

    - by larry cai
    I generate default quickstart maven example, and type mvn checkstyle:checkstyle, it always try to use the lastest SNAPSHOT version, probably it is wrong in my nexus server, but How can I set plugin's version on the command line in maven2, like 2.5 for checkstyle instead of 2.6-SNAPSHOT C:\HelloWorld>mvn checkstyle:checkstyle [INFO] Scanning for projects... [INFO] Searching repository for plugin with prefix: 'checkstyle'. [INFO] ------------------------------------------------------------------------ [ERROR] BUILD ERROR [INFO] ------------------------------------------------------------------------ [INFO] Error building POM (may not be this project's POM). Project ID: org.apache.maven.plugins:maven-checkstyle-plugin Reason: Error getting POM for 'org.apache.maven.plugins:maven-checkstyle-plugin' from the repository: Failed to resolve artifact, possibly due to a repository list that is not appropriately equipped for this artifact's metadata. org.apache.maven.plugins:maven-checkstyle-plugin:pom:2.6-SNAPSHOT from the specified remote repositories: nexus (http://localhost:9081/nexus/content/groups/public) for project org.apache.maven.plugins:maven-checkstyle-plugin I guess it could be "mvn checkstyle:2.5:checkstyle", unfortunately it is not. Surely if I set build dependance in pom.xml, it will work, but I want to see how command line can works

    Read the article

  • Change -- to . for all files in a directory

    - by Larry
    Hello, I need to rename all the files in a directory. Some examples of the source filenames are: alpha--sometext.381928 comp--moretext.7294058 The resultant files would be renamed as: alpha.sometext.381928 comp.moretext.7294058 The number of characters before and after the -- is not consistant. The script needs to work on current installations of Ubuntu and FreeBSD. These are lean LAMP servers so only the necessary packages have been installed. Thanks

    Read the article

  • How do you test your app for Iñtërnâtiônàlizætiøn?

    - by Larry K
    How do you test your app for Iñtërnâtiônàlizætiøn compliance? I tell people to store the Unicode string Iñtërnâtiônàlizætiøn into each field and then see if it is displayed correctly on output. --- including output as a cell's content in Excel reports, in rtf format for docs, xml files, etc. What other tests should be done?

    Read the article

  • Finding the unique paths through a Neo4j graph

    - by Larry
    I have a Neo4j graph with 12 inputs and 4 outputs, and am trying to write a query with the Java Traverser that will return the 14 unique paths from an input to an output node. All the queries I have tried return only a subset of the 14 paths. For example, the code below returns 4 paths, but the other 10 all stop 1 node short of the output. RelationshipType relType = RelationshipTypes.EDGE; TraversalDescription td = new TraversalDescriptionImpl() .depthFirst() .relationships(relType, Direction.OUTGOING); for (Node node : inputs){ Traverser tv = td.traverse(node); Iterator<Path> iter = tv.iterator(); // ... print path } I've tried uniqueness and depth settings as well, with no effect. The query below returns all 14 paths using the web interface, but when I use the ExecutionEngine class, I only get 13 paths back. START s=node(*) MATCH (s)-[p:EDGE*]->(c) WHERE s.type! = "INPUT" AND c.type! = "OUTPUT" RETURN p How do I get all the unique paths using the Java API?

    Read the article

< Previous Page | 1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >