Search Results

Search found 637 results on 26 pages for 'stephen tierney'.

Page 19/26 | < Previous Page | 15 16 17 18 19 20 21 22 23 24 25 26  | Next Page >

  • extract/slice/reorder lists in (emacs) lisp?

    - by Stephen
    In python, you might do something like i = (0, 3, 2) x = [x+1 for x in range(0,5)] operator.itemgetter(*i)(x) to get (1, 4, 3). In (emacs) lisp, I wrote this function called extract which does something similar, (defun extract (elems seq) (mapcar (lambda (x) (nth x seq)) elems)) (extract '(0 3 2) (number-sequence 1 5)) but I feel like there should be something built in? All I know is first, last, rest, nth, car, cdr... What's the way to go? ~ Thanks in advance ~

    Read the article

  • Switching Views

    - by Stephen
    I have two XIb files and I need to switch between them with the swipe of a finger, like the native iphone weather app. does anyone know how to do this. please give some sample code if possible. thank you. P.S I am programming in Objective-C.

    Read the article

  • Why do I get HTTP Code 414 on one network but not another?

    - by Stephen Darlington
    I have an otherwise working iPhone program. A recent change means that it generates some very long URLs (over 4000 characters sometimes) which I know isn't a great idea and I know how to fix -- that's not what I'm asking here. The curious thing is that when I make the connection using a 3G network (Vodafone UK) I get this HTTP "414 Request-URI Too Long" error but when I connect using my local WiFi connection it works just fine. Why would I get different results using different types of network? Could they be routing requests to different servers depending on where the connection originates? Or is there something else at stake here? The corollary questions relate to how common this is. Is it likely to happen whenever I use a cell network or just some networks?

    Read the article

  • emacs list-buffers behavior

    - by Stephen
    In GNU emacs, every time I hit Ctrl-x Ctrl-b to see all of my buffers, the window is split to show the buffer list, or if I have my window already split in 2 (for instance, I will have a shell running in the lower window), the buffer list appears in the other window. My desired behavior is for the buffer list to appear in my active window so that I can select the buffer I want and continue to working in the same window, rather than having to Ctrl-x Ctrl-o to the other buffer, selecting the buffer (with enter) and editing that buffer in the other window... I've googled for it but it doesn't seem to be a common desire? I wonder if anyone has an elispy (or other) solution?

    Read the article

  • How can I calculate a trend line in PHP?

    - by Stephen
    So I've read the two related questions for calculating a trend line for a graph, but I'm still lost. I have an array of xy coordinates, and I want to come up with another array of xy coordinates (can be fewer coordinates) that represent a logarithmic trend line using PHP. I'm passing these arrays to javascript to plot graphs on the client side.

    Read the article

  • JMS - How do message selectors work with multiple queue and topic consumers?

    - by Stephen Harmon
    Say you have a JMS queue, and multiple consumers are watching the queue for messages. You want one of the consumers to get all of a particular type of message, so you decide to employ message selectors. For example, you define a property to go in your JMS message header named, "targetConsumer." Your message selector, which you apply to the consumer known as, "A," is something like "WHERE targetConsumer = "CONSUMER_A." It's clear that consumer A will now just grab messages with the property set like it is in in the example. Will the other consumers have awareness of that, though? IOW, will another consumer, unconstrained by a message selector, grab the "CONSUMER_A" messages, if it looks at the queue before Consumer A? Do I need to apply message selectors like, "WHERE targetConsumer < "CONSUMER_A" to the others? I am RTFMing and gathering empirical data now, but was hoping someone might know off the top of their head.

    Read the article

  • Which use cases make temporary JMS queues a better choice than persistent queues?

    - by Stephen Harmon
    When you are designing a JMS application, which use cases make you pick temporary queues over persistent queues? We use temporary queues for response messages. We're having some issues maintaining connections to the temp queues, though, so I am testing persistent response queues, instead. One clear disadvantage of persistent queues is that your application has to "know" about them beforehand. If that's not a big deal, though, are there use cases where temp queues are the obvious choice?

    Read the article

  • I want just the insert query for a temp table.

    - by John Stephen
    Hi..I am using C#.Net and Sql Server ( Windows Application ). I had created a temporary table. When a button is clicked, temporary table (#tmp_emp_details) is created. I am having another button called "insert Values" and also 5 textboxes. The values that are entered in the textbox are used and whenever com.ExecuteNonQuery(); line comes, it throws an error message Invalid object name '#tbl_emp_answer'.. Below is the set of code.. Please give me a solution. Code for insert (in insert value button): private void btninsertvalues_Click(object sender, EventArgs e) { username = txtusername.Text; examloginid = txtexamloginid.Text; question = txtquestion.Text; answer = txtanswer.Text; useranswer = txtanswer.Text; SqlConnection con = new SqlConnection("Data Source=.;Initial Catalog=tempdb;Integrated Security=True;"); SqlCommand com = new SqlCommand("Insert into #tbl_emp_answer values('"+username+"','"+examloginid+"','"+question+"','"+answer+"','"+useranswer+"')", con); con.Open(); com.ExecuteNonQuery(); con.Close(); }

    Read the article

  • I want a insert query for a temp table

    - by John Stephen
    Hi..I am using C#.Net and Sql Server ( Windows Application ). I had created a temporary table. When a button is clicked, temporary table (#tmp_emp_answer) is created. I am having another button called "insert Values" and also 5 textboxes. The values that are entered in the textbox are used and whenever com.ExecuteNonQuery(); line comes, it throws an error message Invalid object name '#tbl_emp_answer'.. Below is the set of code.. Please give me a solution. Code for insert (in insert value button): private void btninsertvalues_Click(object sender, EventArgs e) { username = txtusername.Text; examloginid = txtexamloginid.Text; question = txtquestion.Text; answer = txtanswer.Text; useranswer = txtanswer.Text; SqlConnection con = new SqlConnection("Data Source=.;Initial Catalog=tempdb;Integrated Security=True;"); SqlCommand com = new SqlCommand("Insert into #tbl_emp_answer values('"+username+"','"+examloginid+"','"+question+"','"+answer+"','"+useranswer+"')", con); con.Open(); com.ExecuteNonQuery(); con.Close(); }

    Read the article

  • Resolving the WMI DNS Host Name

    - by Stephen Murby
    I am trying to make a comparison between a machine name i have retrieved from AD, and the DNS Host Name i want to get using WMI from the machine. I currently have: foreach (SearchResult oneMachine in allMachinesCollected) { pcName = oneMachine.Properties["name"][0].ToString(); ConnectionOptions setupConnection = new ConnectionOptions(); setupConnection.Username = USERNAME; setupConnection.Password = PASSWORD; setupConnection.Authority = "ntlmdomain:DOMAIN"; ManagementScope setupScope = new ManagementScope("\\\\" + pcName + "\\root\\cimv2", setupConnection); setupScope.Connect(); ObjectQuery dnsNameQuery = new ObjectQuery("SELECT * FROM Win32_ComputerSystem"); ManagementObjectSearcher dnsNameSearch = new ManagementObjectSearcher(setupScope, dnsNameQuery); ManagementObjectCollection allDNSNames = dnsNameSearch.Get(); string dnsHostName; foreach (ManagementObject oneName in allDNSNames) { dnsHostName = oneName.Properties["DNSHostName"].ToString(); if (dnsHostName == pcName) { shutdownMethods.ShutdownMachine(pcName, USERNAME, PASSWORD); MessageBox.Show(pcName + " has been sent the reboot command"); } } } } But i get a ManagementException dnsHostName = oneName.Properties["DNSHostName"].ToString(); << here saying not found. Any ideas?

    Read the article

  • Cocoa Scripting Bridge and <contents> element

    - by Stephen
    So, the application I'm trying to script has a scripting definition file that includes a <contents> element, which is an "implicitly specified container." The question, how do I get at what's inside this element using Scripting Bridge? Or alternatively, how do I send the Apple Event necessary to retrieve it and then transform what I get back into an SBObject? I already tried: [document nameOfKey] document.nameofKey [document contents] document.contents

    Read the article

  • In Mercurial, can I apply changes from one file to another file in the same branch?

    - by Stephen
    In the good old days of Subversion, I would sometimes derive a new file from an existing one using svn copy. Then if something changed in sections they had in common, I could still use svn merge to update the derived version. To use the example from hginit.com, say the "guac" recipe already exists, and I want to create a "superguac" that includes instructions on how to serve guacamole to 1000 raving soccer fans. Using the process I just described, I could: svn cp guac superguac svn ci -m "Created superguac by copying guac" (edit superguac) svn ci -m "Added instructions for serving 1000 raving soccer fans to superguac" (edit guac) svn ci -m "Fixed a typo in guac" svn merge -r3:4 guac superguac and thus the typo fix would be applied to superguac. Mercurial provides an hg copy command that marks a file as a copy of the original, but I'm not sure the repository structure supports a similar workflow. Here's the same example, and I carefully only edit a single file in the commit I want to use in the merge: hg cp guac superguac hg ci -m "Created superguac by copying guac" (edit superguac) hg ci -m "Added instructions for serving 1000 raving soccer fans to superguac" (edit guac) hg ci -m "Fixed a typo in guac" I now want to apply the change in guac to superguac. Is that possible? If so, what's the right command? Is there a different workflow in Mercurial that achieves the same results (limited to a single branch)?

    Read the article

  • Managing conflicting ivy repositories (in eclipse)

    - by Stephen
    I've got eclipse workspaces for my full time job and my home test work that are both set up with ivy (and using ivyDE). However, I'm finding that I'm getting strange behaviour and conflicts between the different workspaces - issues like not being able to find certain dependencies, or not compiling etc. Is there a way in ivy or ivyDE to set the home .ivy2 directory so that I can split my workspaces? At the moment, I'm alternating different directories for my .ivy2 cache.

    Read the article

  • F# replace ref variable with something fun

    - by Stephen Swensen
    I have the following F# functions which makes use of a ref variable to seed and keep track of a running total, something tells me this isn't in the spirit of fp or even particular clear on its own. I'd like some direction on the clearest (possible fp, but if an imperative approach is clearer I'd be open to that) way to express this in F#. Note that selectItem implements a random weighted selection algorithm. type WeightedItem(id: int, weight: int) = member self.id = id member self.weight = weight let selectItem (items: WeightedItem list) (rand:System.Random) = let totalWeight = List.sumBy (fun (item: WeightedItem) -> item.weight) items let selection = rand.Next(totalWeight) + 1 let runningWeight = ref 0 List.find (fun (item: WeightedItem) -> runningWeight := !runningWeight + item.weight !runningWeight >= selection) items let items = [new WeightedItem(1,100); new WeightedItem(2,50); new WeightedItem(3,25)] let selection = selectItem items (new System.Random())

    Read the article

  • controlling the class names generated by JAXB for xsd:attributeGroup?

    - by Stephen Winnall
    I am using JAXB to bind XML to Java for an application that I am writing. I have an element called measure which contains two amount elements called amount and maxAmount, with which I want to model a lower and an upper limiting value. amount and maxAmount are otherwise identical and I would like them to be implemented with the same class when unmarshalled into Java. The following is an extract from the XML schema which I feed to JAXB: <xsd:attributeGroup name="AmountAttributes"> <xsd:attribute name="quantity" type="xsd:decimal"/> <xsd:attribute name="numerator" type="xsd:nonNegativeInteger"/> <xsd:attribute name="denominator" type="xsd:positiveInteger"/> </xsd:attributeGroup> <xsd:element name="measure"> <xsd:complexType> <xsd:sequence> <xsd:element minOccurs="0" name="amount"> <xsd:complexType> <xsd:attributeGroup ref="mpr:AmountAttributes"/> </xsd:complexType> </xsd:element> <xsd:element minOccurs="0" name="maxAmount"> <xsd:complexType> <xsd:attributeGroup ref="mpr:AmountAttributes"/> </xsd:complexType> </xsd:element> </xsd:sequence> </xsd:complexType> </xsd:element> JAXB creates from this a more elaborate version of the following: public class Measure { protected Measure.Amount amount; protected Measure.MaxAmount maxAmount; public static class Measure.Amount {} public static class Measure.MaxAmount {} } Measure.Amount and Measure.MaxAmount are identical except for their names, but - of course - as far as Java is concerned they have little to do with each other. Is there a way of making JAXB use the same class for both amount and maxAmount? Just to come completely clean ;-) I should mention that I generate the XML schema from RNC using Trang. If the answer to the question is "change the XML schema", I have the supplementary question "how do I change the RNC to produce that XML schema?". My RNC looks like this: AmountAttributes = QuantityAttribute? & attribute numerator { xsd:nonNegativeInteger }? & attribute denominator { xsd:positiveInteger }? QuantityAttribute = attribute quantity { xsd:decimal } Measure = element measure { element amount { AmountAttributes }?, element maxAmount { AmountAttributes }? }+ I use RNC because I find it simpler to understand, but if the solution to my problem means just using XML Schema, so be it. Steve

    Read the article

  • jquery ui is not scaling text properly!

    - by Stephen Belanger
    I'm trying use jquery ui to scale a div that I'm dragging around to make it easier to see what's behind it, but any text inside it is scaling strangely. The text itself becomes smaller, but it seems to have a bunch of padding around it and is floating now. The text extends past the bottom of the div even though it should be contained properly by the div. I put a red border around the lines of text and the borders are the same size as the original text. I'm not really sure what to do to get this to work... HTML: <div class="item draggable" id="item-1'"> <div class="image-block"> <a class="delete-button" title="delete me!" href="/remove/1" onclick="return $(this).confirm(\'Really remove this image?\');">X</a> <a class="image" href="/edit/1"><img src="/someimage.jpg" /></a> <div class="clear-block"></div> </div> <h3>Some title</h3> </div> CSS: div.image-list div.item { float:left; background:#fff; width:150px; padding:5px; margin:4px; border:1px solid #d3d5d6; } div.image-list div.item h3 { margin:0; padding:0; border:solid 1px #F00; } div.image-list div.item div.image-block a.delete-button { float:right; position:relative; background:#fff; display:none; top:0.8em; margin-bottom:-20.0em; width:3em; height:1.8em; padding:0.2em 1em; } div.image-list div.item div.image-block a.image { float:left; display:block; } .clear-block { clear:both; } jquery: $(".draggable").draggable({ helper: 'clone', start: function(ev, ui) { $(ui.helper).effect( "scale", { percent: 50 }, 200 ); } });

    Read the article

  • What's the right way to handle "One, Both, or None" logic?

    - by Stephen
    I have a logic situation that is best described as two "Teams" trying to win a task. The outcome of this task could be a single winner, a tie (draw), or no winner (stalemate). Currently, I'm using a nested if/else statement like so: // using PHP, but the concept seems language agnostic. if ($team_a->win()) { if ($team_b->win()) { // this is a draw } else { // team_a is the winner } } else { if ($team_b->win()) { // team_b is the winner } else { // This is a stalemate, no winner. } } This seems rather spaghetti-like and repetitive. Is there a more logical, DRY pattern I could use?

    Read the article

  • Are Thread.stop and friends ever safe in Java?

    - by Stephen C
    The stop(), suspend(), and resume() in java.lang.Thread are deprecated because they are unsafe. The Sun recommended work around is to use Thread.interrupt(), but that approach doesn't work in all cases. For example, if you are call a library method that doesn't explicitly or implicitly check the interrupted flag, you have no choice but to wait for the call to finish. So, I'm wondering if it is possible to characterize situations where it is (provably) safe to call stop() on a Thread. For example, would it be safe to stop() a thread that did nothing but call find(...) or match(...) on a java.util.regex.Matcher? (If there are any Sun engineers reading this ... a definitive answer would be really appreciated.) EDIT: Answers that simply restate the mantra that you should not call stop() because it is deprecated, unsafe, whatever are missing the point of this question. I know that that it is genuinely unsafe in the majority of cases, and that if there is a viable alternative you should always use that instead. This question is about the subset cases where it is safe. Specifically, what is that subset?

    Read the article

  • Looking for Go equivalent of scanf.

    - by Stephen Hsu
    I'm looking for the Go equivalent of scanf(). I tried with following code: 1 package main 2 3 import ( 4 "scanner" 5 "os" 6 "fmt" 7 ) 8 9 func main() { 10 var s scanner.Scanner 11 s.Init(os.Stdin) 12 s.Mode = scanner.ScanInts 13 tok := s.Scan() 14 for tok != scanner.EOF { 15 fmt.Printf("%d ", tok) 16 tok = s.Scan() 17 } 18 fmt.Println() 19 } I run it with input from a text with a line of integers. But it always output -3 -3 ... And how to scan a line composed of a string and some integers? Changing the mode whenever encounter a new data type? The Package documentation: Package scanner A general-purpose scanner for UTF-8 encoded text. But it seems that the scanner is not for general use. Updated code: func main() { n := scanf() fmt.Println(n) fmt.Println(len(n)) } func scanf() []int { nums := new(vector.IntVector) reader := bufio.NewReader(os.Stdin) str, err := reader.ReadString('\n') for err != os.EOF { fields := strings.Fields(str) for _, f := range fields { i, _ := strconv.Atoi(f) nums.Push(i) } str, err = reader.ReadString('\n') } r := make([]int, nums.Len()) for i := 0; i < nums.Len(); i++ { r[i] = nums.At(i) } return r }

    Read the article

  • python destructuring-bind dictionary contents

    - by Stephen
    Hi, I am trying to 'destructure' a dictionary and associate values with variables names after its keys. Something like params = {'a':1,'b':2} a,b = params.values() but since dictionaries are not ordered, there is no guarantee that params.values() will return values in the order of (a,b). Is there a nice way to do this? Thanks

    Read the article

  • How does hibernate use an empty string for an equality restriction?

    - by Stephen
    I have a column that potentially has some bad data and I can't clean it up, so I need to check for either null or empty string. I'm doing a Hibernate Criteria query so I've got the following that returns incorrectly right now: Session session = getSessionFactory().openSession(); Transaction tx = session.beginTransaction(); Criteria myCriteria = session.createCriteria(Object); ... myCriteria.add(Restrictions.or(Restrictions.isNull("stringColumn"), Restrictions.eq("stringColumn", ""))); List<Objects> list = myCriteria.list(); I can't get it to properly return the results I'd expect. So as an experiment I changed the second restriction to read: Restrictions.eq("stringColumn", "''") And it started returning the expected results, so is hibernate incorrectly translating my empty string (e.g. "") into a SQL empty string (e.g. ''), or am I just doing this wrong?

    Read the article

  • Cygwin GCC + WinXP cmd.exe does nothing

    - by Stephen Friederichs
    My basic problem is that if I run GCC from the windows command line (cmd.exe in Windows XP) and it does nothing: no .o files are created, no error messages, nothing. It will only throw an error message if I use DOS-style paths, but nothing else. When I run from the Cygwin shell then it will throws error messages as appropriate for the errors in the source and produces the .o files as it needs. Using 'make' from the DOS command line doesn't work either. Has anyone encountered this behavior before?

    Read the article

< Previous Page | 15 16 17 18 19 20 21 22 23 24 25 26  | Next Page >