Search Results

Search found 1903 results on 77 pages for 'james mccvoy'.

Page 38/77 | < Previous Page | 34 35 36 37 38 39 40 41 42 43 44 45  | Next Page >

  • Python-Requests close http connection

    - by James Eggers
    I was wondering, how do you close a connection with Requests (python-requests.org)? With httplib it's HTTPConnection.close(), but how do I do the same with Requests? Code is below: r = requests.post("https://stream.twitter.com/1/statuses/filter.json", data={'track':toTrack}, auth=('username', 'passwd')) for line in r.iter_lines(): if line: self.mongo['db'].tweets.insert(json.loads(line)) Thanks in advance.

    Read the article

  • How to sort a list so that managers are always ahead of their subordinates

    - by James Black
    I am working on a project using Groovy, and I would like to take an array of employees, so that no manager follows their subordinates in the array. The reason being that I need to add people to a database and I would prefer not to do it in two passes. So, I basically have: <employees> <employee> <employeeid>12</employeeid> <manager>3</manager> </employee> <employee> <employeeid>1</employeeid> <manager></manager> </employee> <employee> <employeeid>3</employeeid> <manager>1</manager> </employee> </employees> So, it should be sorted as such: employeeid = 1 employeeid = 3 employeeid = 12 The first person should have a null for managers. I am thinking about a binary tree representation, but I expect it will be very unbalanced, and I am not certain the best way to do this using Groovy properly. Is there a way to do this that isn't going to involve using nested loops?

    Read the article

  • Regular expressions and the question mark

    - by James P.
    I'm having trouble finding a regular expression that matches the following String. Korben;http://feeds.feedburner.com/KorbensBlog-UpgradeYourMind?format=xml;1 One problem is escaping the question mark. Java's pattern matcher doesn't seem to accept \? as a valid escape sequence but it also fails to work with the tester at myregexp.com. Here's what I have so far: ([a-zA-Z0-9])+;http://([a-zA-Z0-9./-]+);[0-9]+ Any suggestions?

    Read the article

  • Svn import with auto-props & pre-commit hook

    - by James Tisato
    My company's svn repo has a lot of MS Word docs in it. We've implemented a policy that all .doc files must have the svn:needs-lock property set to prevent parallel access on files that are hard to merge (we've also done this for xls, ppt, pdf etc.). We've implemented the policy by distributing a svn config with auto-props set appropriately for all relevant document types. We've also set up a pre-commit hook that checks that all added files of these types have the needs-lock property set (i.e. if they forget/are too lazy to update their svn config file, they won't be able to add any docs to the repo). The problem I'm having, however, is that the pre-commit hook fails when users try to import files into the repo, e.g. some users like to add files directly thru TortoiseSVN's Repo Browser, which effectively is an svn import. Through testing on other file types, I have seen that doing an import does in fact apply the auto-props listed in my config, but they don't seem to be applied at the point that the pre-commit hook runs. When importing .doc files, the hook fails, saying that the needs-lock property is missing. Is there really much difference between adding a single file to a working copy and committing it vs importing a file directly? Do we need to tailor our precommit hook in some way to cater for this scenario?

    Read the article

  • How to populate List<string> with Datarow values from single columns...

    - by James
    Hi, I'm still learning (baby steps). Messing about with a function and hoping to find a tidier way to deal with my datatables. For the more commonly used tables throughout the life of the program, I'll dump them to datatables and query those instead. What I'm hoping to do is query the datatables for say column x = "this", and convert the values of column "y" directly to a List to return to the caller: private List<string> LookupColumnY(string hex) { List<string> stringlist = new List<string>(); DataRow[] rows = tblDataTable.Select("Columnx = '" + hex + "'", "Columny ASC"); foreach (DataRow row in rows) { stringlist.Add(row["Columny"].ToString()); } return stringlist; } Anyone know a slightly simpler method? I guess this is easy enough, but I'm wondering if I do enough of these if iterating via foreach loop won't be a performance hit. TIA!

    Read the article

  • Work Experience - Internship Years

    - by James Jones
    I interned at my current place of employment for 2.5 years while I was an undergrad. During that time, I worked 40 hours per week during the summer and averaged 20 hours per week during the school year. I have since been hired full-time and I have been with the company a little over 3 years now. How many years of work experience do I have? Background info: There is a significant income disparity between someone with 1 year of experience vs 3 years (as per salary.com). I have job responsibilities equivalent to that of someone who has been at my company for about 5 years. I am trying to determine what I should expect in terms of income, raises, etc.

    Read the article

  • jqModal dialog - only displaying once

    - by James Inman
    I've got a jqModal dialog with the following code: $(document).ready( function() { $('td.item.active').click( function(e) { $(this).append( '<div class="new">&nbsp;</div>' ); $("#jqModal").jqm({ modal:true, onHide: function(e) { e.w.hide(); // Hide window e.o.remove(); // Remove overlay } }); $('#jqModal').jqmShow(); $('input#add_session').click( function(e) { e.preventDefault(); $('#jqModal').hide(); $('.jqmOverlay').remove(); }); }); }); The HTML used is as follows: <div id="jqModal" class="jqmWindow"> <form action="" method="post"> <ul> <li> <input id="add_session" name="commit" type="submit" value="Add Session" /> <input type="button" name="close" value="Close" id="close" class="jqmClose" /> </li> </ul> </form> </div> When I first click a <td>, the dialog launches without a problem. On the second click (or subsequent), the new class is added to the <div>, but the dialog doesn't launch.

    Read the article

  • Confused over behavior of List.mapi in F#

    - by James Black
    I am building some equations in F#, and when working on my polynomial class I found some odd behavior using List.mapi Basically, each polynomial has an array, so 3*x^2 + 5*x + 6 would be [|6, 5, 3|] in the array, so, when adding polynomials, if one array is longer than the other, then I just need to append the extra elements to the result, and that is where I ran into a problem. Later I want to generalize it to not always use a float, but that will be after I get more working. So, the problem is that I expected List.mapi to return a List not individual elements, but, in order to put the lists together I had to put [] around my use of mapi, and I am curious why that is the case. This is more complicated than I expected, I thought I should be able to just tell it to make a new List starting at a certain index, but I can't find any function for that. type Polynomial() = let mutable coefficients:float [] = Array.empty member self.Coefficients with get() = coefficients static member (+) (v1:Polynomial, v2:Polynomial) = let ret = List.map2(fun c p -> c + p) (List.ofArray v1.Coefficients) (List.ofArray v2.Coefficients) let a = List.mapi(fun i x -> x) match v1.Coefficients.Length - v2.Coefficients.Length with | x when x < 0 -> ret :: [((List.ofArray v1.Coefficients) |> a)] | x when x > 0 -> ret :: [((List.ofArray v2.Coefficients) |> a)] | _ -> [ret]

    Read the article

  • Why does BeginReceiveFrom never time out?

    - by James Hugard
    I am writing an asynchronous Ping using Raw Sockets in F#, to enable parallel requests using as few threads as possible ("System.Net.NetworkInformation.Ping" appears to use one thread per request, but have not tested this... also am interested in using F# async workflows). The synchronous version below correctly times out when the target host does not exist/respond, but the asynchronous version hangs. Both work when the host does respond... Any ideas? (note: the process must run as Admin for this code to work) This throws a timeout: let result = Ping.Ping ( IPAddress.Parse( "192.168.33.22" ), 1000 ) However, this hangs: let result = Ping.PingAsync ( IPAddress.Parse( "192.168.33.22" ), 1000 ) |> Async.RunSynchronously Here's the code... module Ping open System open System.Net open System.Net.Sockets open System.Threading //---- ICMP Packet Classes type IcmpMessage (t : byte) = let mutable m_type = t let mutable m_code = 0uy let mutable m_checksum = 0us member this.Type with get() = m_type member this.Code with get() = m_code member this.Checksum = m_checksum abstract Bytes : byte array default this.Bytes with get() = [| m_type m_code byte(m_checksum) byte(m_checksum >>> 8) |] member this.GetChecksum() = let mutable sum = 0ul let bytes = this.Bytes let mutable i = 0 // Sum up uint16s while i < bytes.Length - 1 do sum <- sum + uint32(BitConverter.ToUInt16( bytes, i )) i <- i + 2 // Add in last byte, if an odd size buffer if i <> bytes.Length then sum <- sum + uint32(bytes.[i]) // Shuffle the bits sum <- (sum >>> 16) + (sum &&& 0xFFFFul) sum <- sum + (sum >>> 16) sum <- ~~~sum uint16(sum) member this.UpdateChecksum() = m_checksum <- this.GetChecksum() type InformationMessage (t : byte) = inherit IcmpMessage(t) let mutable m_identifier = 0us let mutable m_sequenceNumber = 0us member this.Identifier = m_identifier member this.SequenceNumber = m_sequenceNumber override this.Bytes with get() = Array.append (base.Bytes) [| byte(m_identifier) byte(m_identifier >>> 8) byte(m_sequenceNumber) byte(m_sequenceNumber >>> 8) |] type EchoMessage() = inherit InformationMessage( 8uy ) let mutable m_data = Array.create 32 32uy do base.UpdateChecksum() member this.Data with get() = m_data and set(d) = m_data <- d this.UpdateChecksum() override this.Bytes with get() = Array.append (base.Bytes) (this.Data) //---- Synchronous Ping let Ping (host : IPAddress, timeout : int ) = let mutable ep = new IPEndPoint( host, 0 ) let socket = new Socket( AddressFamily.InterNetwork, SocketType.Raw, ProtocolType.Icmp ) socket.SetSocketOption( SocketOptionLevel.Socket, SocketOptionName.SendTimeout, timeout ) socket.SetSocketOption( SocketOptionLevel.Socket, SocketOptionName.ReceiveTimeout, timeout ) let packet = EchoMessage() let mutable buffer = packet.Bytes try if socket.SendTo( buffer, ep ) <= 0 then raise (SocketException()) buffer <- Array.create (buffer.Length + 20) 0uy let mutable epr = ep :> EndPoint if socket.ReceiveFrom( buffer, &epr ) <= 0 then raise (SocketException()) finally socket.Close() buffer //---- Entensions to the F# Async class to allow up to 5 paramters (not just 3) type Async with static member FromBeginEnd(arg1,arg2,arg3,arg4,beginAction,endAction,?cancelAction): Async<'T> = Async.FromBeginEnd((fun (iar,state) -> beginAction(arg1,arg2,arg3,arg4,iar,state)), endAction, ?cancelAction=cancelAction) static member FromBeginEnd(arg1,arg2,arg3,arg4,arg5,beginAction,endAction,?cancelAction): Async<'T> = Async.FromBeginEnd((fun (iar,state) -> beginAction(arg1,arg2,arg3,arg4,arg5,iar,state)), endAction, ?cancelAction=cancelAction) //---- Extensions to the Socket class to provide async SendTo and ReceiveFrom type System.Net.Sockets.Socket with member this.AsyncSendTo( buffer, offset, size, socketFlags, remoteEP ) = Async.FromBeginEnd( buffer, offset, size, socketFlags, remoteEP, this.BeginSendTo, this.EndSendTo ) member this.AsyncReceiveFrom( buffer, offset, size, socketFlags, remoteEP ) = Async.FromBeginEnd( buffer, offset, size, socketFlags, remoteEP, this.BeginReceiveFrom, (fun asyncResult -> this.EndReceiveFrom(asyncResult, remoteEP) ) ) //---- Asynchronous Ping let PingAsync (host : IPAddress, timeout : int ) = async { let ep = IPEndPoint( host, 0 ) use socket = new Socket( AddressFamily.InterNetwork, SocketType.Raw, ProtocolType.Icmp ) socket.SetSocketOption( SocketOptionLevel.Socket, SocketOptionName.SendTimeout, timeout ) socket.SetSocketOption( SocketOptionLevel.Socket, SocketOptionName.ReceiveTimeout, timeout ) let packet = EchoMessage() let outbuffer = packet.Bytes try let! result = socket.AsyncSendTo( outbuffer, 0, outbuffer.Length, SocketFlags.None, ep ) if result <= 0 then raise (SocketException()) let epr = ref (ep :> EndPoint) let inbuffer = Array.create (outbuffer.Length + 256) 0uy let! result = socket.AsyncReceiveFrom( inbuffer, 0, inbuffer.Length, SocketFlags.None, epr ) if result <= 0 then raise (SocketException()) return inbuffer finally socket.Close() }

    Read the article

  • Generate webservice soap client from wsdl when server using Windows Integrated Authentication

    - by James Black
    There is an SAP server that has some webservices I need to use, so I am trying to use wsimport to generate the client stubs. I don't want to find all the wsdls and schemas that are referenced and modify them to do it locally, as that isn't sustainable, if they service should change. So, how can I use wsimport to fetch a wsdl and generate the client stubs when the server is using Windows Integrated Authentication, where even the wsdl requires credentials.

    Read the article

  • FileFinder using SQL

    - by James Morgan
    I was thinking of working on a project while I have some free time and this one looks pretty nice: http://mindprod.com/project/filefinder.html One thing I'm wondering about is that will it really be much faster compared to the regular windows search if I use SQL? I'm planning to use MySQL since it's open source. Also, do I need to be good at databases for this? I have basic knowledge about relational databases and can definitely make some SQL statements. Thanks.

    Read the article

  • Class generation on the fly

    - by James P.
    Is it possible to generate subclasses at runtime or while an application is running? If so, how is this achieved and what precautions should be taken to prevent a rogue object wreaking havoc inside an application?

    Read the article

  • App session cookie not being created in Rails, sporadically

    - by James
    Hi everyone, This is an issue sporadically for very few users, however we haven't been able to replicate it. However I have now got a Chrome instance (Mac) which is reproducing the error (for some unknown reason), and I hope to not restart it until I have this nailed! Rails application, using memcached for session store. While the bug manifests in the _app_session_id cookie not being created, our javascript-generated cookie test and app-generated language cookies are being created successfully. This means that InvalidAuthenticityToken errors are thrown for every form that is submitted by those afflicted - people can't log into the app. The error occurs across all browsers - had reports for IE7 and Firefox (which most users use). Switching to another browser often fixes the issue (though not always), and standard cache-cookie-clear tactics do not. So now that I have got Chrome open which is having the same issue - in development, staging and live environments (meaning http and https). All other browsers are fine. I've restarted the servers and restarted memcached. I don't really want to restart Chrome - in the risk that the issue does go away with that (having said that, it hasn't worked for users). I've been tcpdumping the requests - and although I'll keep digging, I'd love it if anyone had any suggestions, places to start looking, anything. This is really painful ;) Thanks!

    Read the article

  • Bitrate Switching in xml playlist not loading video

    - by James Williams
    Using JW Player ver 5.4 and JW Embedder. Plugins are grid by Dabbler and fbit (Facebook). The Bitrate switching is not working. Does work fine for one video with HTML5 Video tag. When more than one video, it only shows the first video pic. Works fine with no bitrate switching. Code - HTML5 <script type="text/javascript" src="jwplayer/jwplayer.js"></script> <video id="container"></div> <script type="text/javascript"> jwplayer("container").setup({ flashplayer: "jwplayer/player.swf", streamer: "rtmp://server/location/", playlistfile: "playlists/playlist.xml", plugins: { grid: { rows: 4, distance: 60, horizontalmargin: 75, verticalmargin: 75 }, fbit: { link: "http://www.domain.com" } }, height: 375, width: 850, dock: true }); </script> XML - ATOM/MEDIA xmlns:jwplayer='http://developer.longtailvideo.com/trac/wiki/FlashFormats' Demostration Playlist Video 1 rtmp rtmp://server/location/ Video 2 rtmp rtmp://server/location/ have tried it with both video and div tags for the container. Div tag just shows a blank video area and a Null exception on Line 1 char 1863, this is probably the jwplayer.js file. XML is larger than this, this is to give you a brief syntax of my code and xml. I have searched for over 6 hrs on both longtail and search engine searches. Thank you in advance.

    Read the article

  • Trying to use contains selector within nested divs

    - by James
    <div> <div>test</div> </div> $("div:contains('test')").css('display','none'); I know I am going to kick myself on this. The problem is that when this runs all divs are hidden due to nesting. How do I make it so that the parent div does not get hidden? I am limited to using 1.2.6

    Read the article

  • struct method linking

    - by James
    I'm updating some old code that has several POD structs that were getting zero'd out by memset (don't blame me...I didn't write this part). Part of the update changed some of them to classes that use private internal pointers that are now getting wiped out by the memset. So I added a [non-virtual] reset() method to the various structs and refactored the code to call that instead. One particular struct developed an "undefined reference to `blah::reset()'" error. Changing it from a struct to a class fixed the error. Calling nm on the .o file h, the mangled function names for that method look the same (whether it's a class or a struct). I'm using g++ 4.4.1, on Ubuntu. I hate the thought that this might be a compiler/linker bug, but I'm not sure what else it could be. Am I missing some fundamental difference between structs and classes? I thought the only meaningful ones were the public/private defaults and the way everyone thinks about them.

    Read the article

  • C# to Javascript: Custom Event Delegation?

    - by James Simpson
    I'm working on a project in Unity3D with Javascript, and I'm trying to implement the SmartFoxServer API (http://smartfoxserver.com) in Javascript instead of their example C# code. I've gotten most of it converted correctly, but I am still getting an error at runtime with the following line involving delegation to a C# file that is in the API (SFSEvent.cs). C# original: SFSEvent.onConnection += HandleConnection; Javascript (or whatever I've turned it into): SFSEvent.onConnection = Delegate.Combine(HandleConnection); Error: InvalidCastException: Cannot cast from source type to destination type.

    Read the article

  • Stop a stopwatch

    - by James Morgan
    I have the following code in a JPanel class which is added to a another class (JFrame). What I'm trying to implement is some sort of a stopwatch program. startBtn.addActionListener(new startListener()); class startListener implements ActionListener { public void actionPerformed(ActionEvent e) { Timer time = new Timer(); time.scheduleAtFixedRate(new Stopwatch(), 1000, 1000); } } This is another class which basically the task. public class Stopwatch extends TimerTask { private final double start = System.currentTimeMillis(); public void run() { double curr = System.currentTimeMillis(); System.out.println((curr - start) / 1000); } } The timer works fine and this is definitely far from complete but I'm not sure how to code the stop button which should stop the timer. Any advice on this? BTW I'm using java.util.timer

    Read the article

  • Hibernate MySQL transaction configuration issue

    - by James
    I'm having trouble starting a transaction with Hibernate and MySQL while running in JUnit. I'm getting a HibernateException which states: "No TransactionManagerLookup specified". I believe this error is because I don't have a proper configuration setting for hibernate.transaction.manager_lookup_class. I see that under the namespace of org.hibernate.transaction there are quite a few different lookup classes that I could use. All of the documentation that I could find on these was very vague. My question is what is the appropriate one for MySQL?

    Read the article

  • Regex to match 0 - 999 but not blank

    - by James Cadd
    I'm working on a regex to match valid integer numbers such as the following: 0 1 99 999 However it should not allow matching an empty string. The closest I can get is: (0)|\\d{1,3} Which to me says a matching string will have either a zero or a series of digits between 1 and 3 characters long. However, empty strings still appear to match this pattern. What's the proper way to exclude empty strings from this regex?

    Read the article

  • SQL Injection with Plain-Vanilla NHibernate

    - by James D
    Hello, Plain-vanilla NHibernate setup, eg, no fluent NHibernate, no HQL, nothing except domain objects and NHibernate mapping files. I load objects via: _lightSabers = session.CreateCriteria(typeof(LightSaber)).List<LightSaber>(); I apply raw user input directly to one property on the "LightSaber" class: myLightSaber.NameTag = "Raw malicious text from user"; I then save the LightSaber: session.SaveOrUpdate(myLightSaber); Everything I've seen says that yes, under this situation you are immune to SQL injection, because of the way NHibernate parameterizes and escapes the queries under the hood. However, I'm also a relative NHibernate beginner so I wanted to double-check. *waves hand* these aren't the droids you're looking for. Thanks!

    Read the article

< Previous Page | 34 35 36 37 38 39 40 41 42 43 44 45  | Next Page >