Daily Archives

Articles indexed Wednesday March 31 2010

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

  • JSINQ (Linq for JavaScript library) sub-queries (how-to)

    - by Tom Tresansky
    I'm using this library: jsinq. I want to create a new object using subqueries. For example, in .NET LINQ, I could do something like this: from a in Attendances where a.SomeProperty = SomeValue select new { .Property1 = a.Property1, .Property2 = a.Property2, .Property3 = (from p in People where p.SomeProperty = a.Property3 select p) } such that I get a list of ALL people where Property3 value matches the attendance's Property3 value in EACH object returned in the list. I didn't see any sample of this in the docs or on the playground. Made a couple tries of it and didn't have any luck. Anybody know if this is possible and how to?

    Read the article

  • Setting a theme in WPF

    - by muckdog12
    I have a relativly simple question that I can't seem to figure out. I have downloaded some theme files in an XAML format off the internet and I would like to use them as my themes in my WPF application. How do you do this? All help is appreciated!

    Read the article

  • jQuery - Reload page after following jump link

    - by criley
    I'm creating a slideshow effect using hidden div's. Once a thumbnail is clicked, the corresponding div appears in a window and the other divs are hidden. However, I also need the page to reload. I attempted to use something like this: $("a").click(function() { location.reload(); }); However, this will reload the page without following the link (something like a href="#div02"). How do I get it to both follow the link and reload the page?

    Read the article

  • JMS createQueue Trouble

    - by OneTimeResponse
    Hi I am having trouble using the createQueue in JMS. I can create a queue successfully but right after I try to do the following and it fails. Any ideas? Thanks. QueueSender mySender = mySession.createSender(myQueue); With the error: javax.jms.InvalidDestinationException: CWSIA0062E: Failed to create a MessageProducer for queue://Q2?busName=myBus2 at com.ibm.ws.sib.api.jms.impl.JmsMsgProducerImpl.<init>(JmsMsgProducerImpl.java:396) at com.ibm.ws.sib.api.jms.impl.JmsQueueSenderImpl.<init>(JmsQueueSenderImpl.java:60) at com.ibm.ws.sib.api.jms.impl.JmsQueueSessionImpl.instantiateProducer(JmsQueueSessionImpl.java:224) at com.ibm.ws.sib.api.jms.impl.JmsSessionImpl.createProducer(JmsSessionImpl.java:865) at com.ibm.ws.sib.api.jms.impl.JmsQueueSessionImpl.createSender(JmsQueueSessionImpl.java:147)

    Read the article

  • Array Problem, need to sort via Keys

    - by sologhost
    Ok, not really sure how to do this. I have values that are being outputted from a SQL query like so: $row[0] = array('lid' => 1, 'llayout' => 1, 'lposition' => 1, 'mid' => 1, 'mlayout' => 1, 'mposition' => 0); $row[1] = array('lid' => 2, 'llayout' => 1, 'lposition' => 0, 'mid' => 2, 'mlayout' => 1, 'mposition' => 0); $row[2] = array('lid' => 2, 'llayout' => 1, 'lposition' => 0, 'mid' => 3, 'mlayout' => 1, 'mposition' => 1); $row[3] = array('lid' => 3, 'llayout' => 1, 'lposition' => 1, 'mid' => 4, 'mlayout' => 1, 'mposition' => 1); $row[4] = array('lid' => 4, 'llayout' => 1, 'lposition' => 2, 'mid' => 5, 'mlayout' => 1, 'mposition' => 0); etc. etc. Ok, so the best thing I can think of for this is to give lid and mid array keys and have it equal the mposition into an array within the while loop of query like so... $old[$row['lid']][$row['mid']] = $mposition; Now if I do this, I need to compare this array's keys with another array that I'll need to build based on a $_POST array[]. $new = array(); foreach($_POST as $id => $data) { // $id = column, but we still need to get each rows position... $id = str_replace('col_', '', $id); // now get the inner array... foreach($data as $pos => $idpos) $new[$id][$idpos] = $pos; } Ok, so now I have 2 arrays of info, 1 from the database, and another from the $_POST positions, I hope I got the array keys correct. Now I need to figure out which one's changed, comparing from the old to the new. And also, need to update the database with all of the new positions where new lid = the old lid, and the new mid = the old mid from each array. I'm sure I'll have to use array_key or array_key_intersect somehow, but not sure exactly how...??? Also, I don't think an UPDATE would be useful in a foreach loop, perhaps there's a way to do a CASE statement in the UPDATE query? Also, Am I going about this the right way? OR should I do it another way instead of using a muli-dimensional array for this.

    Read the article

  • Converting a Doc object into a string in python

    - by Sam
    I'm using minidom to parse through an xml document. I took the data with yum tags and stored them in a list and calculated the frequency of the words. However, its not storing or reading them as strings in the list. Is there another way to do it? Right now this is what I have: yumNodes = [node for node in doc.getElementsByTagName("yum")] for node in yumNodes: yumlist.append(t.data for t in node.childNodes if t.nodeType == t.TEXT_NODE) for ob in yumlist: for o in ob: if word not in freqDict: freqDict[word] = 1 else: freqDict[word] += 1

    Read the article

  • python socket.recv/sendall call blocking

    - by fsm
    Hi everyone. This post is incorrectly tagged 'send' since I cannot create new tags. I have a very basic question about this simple echo server. Here are some code snippets. client while True: data = raw_input("Enter data: ") mySock.sendall(data) echoedData = mySock.recv(1024) if not echoedData: break print echoedData server while True: print "Waiting for connection" (clientSock, address) = serverSock.accept() print "Entering read loop" while True: print "Waiting for data" data = clientSock.recv(1024) if not data: break clientSock.send(data) clientSock.close() Now this works alright, except when the client sends an empty string (by hitting the return key in response to "enter data: "), in which case I see some deadlock-ish behavior. Now, what exactly happens when the user presses return on the client side? I can only imagine that the sendall call blocks waiting for some data to be added to the send buffer, causing the recv call to block in turn. What's going on here? Thanks for reading!

    Read the article

  • Reading status from Zebra Printer

    - by pmoreira
    Hi, I'm working on a project where we need to use a Zebra Printer for barcode labels. We're using C#, and we're doing OK on the printing side of things, sending raw ZPL strings to the printer (using winspool.drv). However, we also need to read from the printer, and no luck there. We need to get the status from the printer, which is the output to the ZPL command "~HS", so we can tell how many labels are in memory waiting to be printed. The EnumJobs() from winspool.drv only has jobs on the windows spool, and once they're sent to the printer, they're gone from that list. But that doesn't mean the label has been printed, since the printer has a peel sensor and only prints one label at a time, and we're obviously interested in sending batches of labels to the printer. I've tried something like (using the winspool.drv calls): OpenPrinter(szPrinterName, out hPrinter, IntPtr.Zero); WritePrinter(hPrinter, pBytes, dwCount, out dwWritten); // send the string "~HS" ReadPrinter(hPrinter, data, buff, out pcRead); But I get nothing on the ReadPrinter call. I don't even know if this is the right way of going at it. Anyone out there tackled this before? Thanks.

    Read the article

  • Appropriate wx.Sizer(s) for the job?

    - by MetaHyperBolic
    I have a space in which I would like certain elements (represented here by A, B, D, and G) to each be in its own "corner" of the design. The corners ought to line up as if each of the four elements was repelling the other; a rectangle. This is to be contained within an unresizable panel. I will have several similar panels and want to keep the location of the elements as identical as possible. (I needed something a little more complex than a wx.Wizard, but with the same general idea.) AAAAAAAAAA BB CCCCCCCCCCCCCCCCCC CCCCCCCCCCCCCCCCCC CCCCCCCCCCCCCCCC CCCCCCCCCCCCCC CCCCCCCCCCCCCCCCCC CCCCCCCCCCCCCCCC CCCCCCCCCCCCCCCCCC DDD EEE FFF GGG A represents a text in a large font. B represents a numeric progress meter (e.g. "1 of 7") in a small font. C represents a large block of text. D, E, F, and G are buttons. The G button is separated from others for functionality. I have attempted nested wx.BoxSizers (horizontal boxes inside of one vertical box) without luck. My first problem with wx.BoxSizer is that the .SetMinSize on my last row has not been honored. The second problem is that I have no idea how to make the G button "take up space" without growing comically large, or how I can jam it up against the right edge and bottom edge. I have tried to use a wx.GridBagSizer, but ran into entirely different issues. After plowing through the various online tutorials and wxPython in Action, I'm a little frustrated. The relevant forums appear to see activity once every two weeks. "Playing around with it" has gotten me nowhere; I feel as if I am trying to smooth out a hump in ill-laid carpet.

    Read the article

  • Forcing a page to load itself in another page's iframe

    - by bufferz
    I'm a fairly inexperienced web designer learning css/html on the fly for a company's web site. I want to keep menus, banners, etc in one document so I don't have to repeat updates across many documents. My solution was to make an index.aspx file with the menus and headers, then have a simple iframe for content. This works quite well and updates easily. the format is: www.site.com/index.aspx?page=page1.htm www.site.com/index.aspx?page=page2.htm The problem -- Google is indexing my iframe'd pages and linking to them directly: www.site.com/page1.htm www.site.com/page2.htm How can I set up redirects to page1.htm forwards to index.aspx?page=page1.htm without creating a "hall of mirrors" effect inside the original iframe?

    Read the article

  • newbie: how to upload images from a form with PHP and mySQL

    - by paracaudex
    I'm creating a web app (locally, so security doesn't matter) in PHP where the user uploads a set of information and a small .jpeg, which is then inserted into a mySQL table. I can do this no problem with all the text data, but I'm not sure how to cause the image to upload alongside it. I assume I will have to use the blob data type and input type="file", but I fooled around with that a little bit and the solution doesn't seem to be an intuitive extension of how input type="text" works. Do I need to do a lot more PHP scripting to get this to work? Is it possible to upload an image with a form, or is there a necessary intermediate step?

    Read the article

  • Lucene.NET search index approach

    - by Tim Peel
    Hi, I am trying to put together a test case for using Lucene.NET on one of our websites. I'd like to do the following: Index in a single unique id. Index across a comma delimitered string of terms or tags. For example. Item 1: Id = 1 Tags = Something,Separated-Term I will then be structuring the search so I can look for documents against tag i.e. tags:something OR tags:separate-term I need to maintain the exact term value in order to search against it. I have something running, and the search query is being parsed as expected, but I am not seeing any results. Here's some code. My parser (_luceneAnalyzer is passed into my indexing service): var parser = new QueryParser(Lucene.Net.Util.Version.LUCENE_CURRENT, "Tags", _luceneAnalyzer); parser.SetDefaultOperator(QueryParser.Operator.AND); return parser; My Lucene.NET document creation: var doc = new Document(); var id = new Field( "Id", NumericUtils.IntToPrefixCoded(indexObject.id), Field.Store.YES, Field.Index.NOT_ANALYZED, Field.TermVector.NO); var tags = new Field( "Tags", string.Join(",", indexObject.Tags.ToArray()), Field.Store.NO, Field.Index.ANALYZED, Field.TermVector.YES); doc.Add(id); doc.Add(tags); return doc; My search: var parser = BuildQueryParser(); var query = parser.Parse(searchQuery); var searcher = Searcher; TopDocs hits = searcher.Search(query, null, max); IList<SearchResult> result = new List<SearchResult>(); float scoreNorm = 1.0f / hits.GetMaxScore(); for (int i = 0; i < hits.scoreDocs.Length; i++) { float score = hits.scoreDocs[i].score * scoreNorm; result.Add(CreateSearchResult(searcher.Doc(hits.scoreDocs[i].doc), score)); } return result; I have two documents in my index, one with the tag "Something" and one with the tags "Something" and "Separated-Term". It's important for the - to remain in the terms as I want an exact match on the full value. When I search with "tags:Something" I do not get any results. Question What Analyzer should I be using to achieve the search index I am after? Are there any pointers for putting together a search such as this? Why is my current search not returning any results? Many thanks

    Read the article

  • Plesk Folder Structure Doesn't Allow Creating Folders

    - by user39110
    Hi, i use kohana framework which have 3 folders applications, system and public. I uploaded public folder to httpdocs but applications and system folders should be away from httpdocs. I should upload upper level of httpdocs but plesk structure doesn't allow that. What should i do ? (i am owner of vps)

    Read the article

  • Help with Rewrite rules.

    - by Kyle
    I was wondering what a rewrite statement that looks for this situation. I want to have multiple users on my server. Each user can have 'VirtualDocumentRoot' like sites in his directory. For example, they just make a directory like 'example.com' in their home directory, and it's hosted. The problem is I don't know if VirtualDocumentRoot can do this, or if it would take a rewrite rule that looks in all the users folders for a domain. Can anybody help me?

    Read the article

  • Is there any way to get an ExtJS GridPanel to automatically resize its width, but still be contained

    - by Micah
    I want to include an ExtJS GridPanel inside a larger layout, which in turn must be rendered inside a particular div in some pre-existing HTML that I don't control. From my experiments, it appears that the GridPanel only resizes itself correctly if it's within a Viewport. For instance, with this code the GridPanel automatically resizes: new Ext.Viewport( { layout: 'anchor', items: [ { xtype: 'panel', title: 'foo', layout: 'fit', items: [ { xtype: 'grid', // define the grid here... but if I replace the first three lines with the lines below, it doesn't: new Ext.Panel( { layout: 'anchor', renderTo: 'RenderUntoThisDiv', The trouble is, Viewport always renders directly to the body of the HTML document, and I need to render within a particular div. If there is a way to get the GridPanel to resize itself correctly, despite not being contained in a ViewPort, that would be ideal. If not, if I could get the Viewport to render the elements within the div, I'd be fine with that. All of my ExtJS objects can be contained within the same div. Does anybody know of a way to get a GridPanel to resize itself correctly, but still be contained inside some non-ExtJS-generated HTML?

    Read the article

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