Search Results

Search found 1976 results on 80 pages for 'grab'.

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

  • How should I grab pairs from an array in python?

    - by tomaski
    Say I have an array that looks like this: ['item1', 'item2', 'item3', 'item4', 'item5', 'item6', 'item7', 'item8', 'item9', 'item10'] Using Python, how would I grab pairs from it, where each item is included in a pair with both the item before and after it? ['item1', 'item2'] ['item2', 'item3'] ['item3', 'item4'] ['item4', 'item5'] ['item5', 'item6'] ['item6', 'item7'] ['item7', 'item8'] ['item8', 'item9'] ['item9', 'item10'] Seems like something i could hack together, but I'm wondering if someone has an elegant solution they've used before?

    Read the article

  • How can I grab the iTunes-defined name for my iPhone/iPod device?

    - by Christophe Porteneuve
    Hey there, I'm trying to get the name for an iPhone/iPod device that the user entered in their iTunes. This is not, I repeat, not, necessarily what [[UIDevice currentDevice] name] returns (or any of its other methods). For instance, my iPhone is bound in iTunes to "iPhone 3G de Christophe…", to differentiate it from my wife's and other similar devices. That's the name I'd love to be able to grab. Is it stored anywhere on the device, and if so can I access it somehow? Thanks!

    Read the article

  • PHP: Grab an image from a stream (in an img tag) but if it's not there, i don't want the img tag wri

    - by Gary Willoughby
    I currently have code like this in a web based file called 'view_file.php' to grab an image from an internal network. <img src="put_file.php?type=<?=$TN_TYPE;?>&path=<?=$TN_PATH;?>&filename=<?=$TN_FILENAME;?>" /> The 'put_file.php' script allows access to an internal server that we don't want to expose to the internet. This script checks to see if an image is available and if it is, sends an image header and then uses readfile() to stream the image to the 'view_file.php' page. The problem is if there isn't an image available, instead of streaming a temporary 'spacer.gif' i want to not have the img tag written at all. Any Ideas how to do this? I'm thinking maybe move the img tag into the 'put_file.php' script, but how to mix strings and steams?

    Read the article

  • Can 'screen' grab an existing process and tie itself to it?

    - by warren
    Scenario: Started a process that's going to take "a while" to complete outside of screen. Need to leave the terminal / netowrk hiccups Process lost Would be nice if: Started a process outside of screen Realize error Run screen <magic-goes-here> and it grabs the active process to itself From the man pages and --help info, I don't see a way this can be done. Is this possible directly with screen? If not, is it possible to change the owning shell of a process, so that the bash (or other shell of your choosing) instance inside screen can have a command run which will change the parent shell of the initial process to itself from the originator?

    Read the article

  • LogParser query to grab only external IP addresses from IIS logs?

    - by Josh
    I'm working on a public website that is used by both external visitors and internal employees. I'm after the external visitor hits, but I can't think of a good way to filter out the internal IP ranges. Using LogParser, what is the best way to filter IISW3C logs by IP range? This is all I've come up with so far, which can't possibly be the best or most efficient way. WHERE [c-ip] NOT LIKE (10.10.%, 10.11.%) Any help is appreciated.

    Read the article

  • How to use wget to grab copy of Google Code site documents?

    - by Alex Reynolds
    I have a Google Code project which has a lot of wiki'ed documentation. I would like to create a copy of this documentation for offline browsing. I would like to use wget or a similar utility. I have tried the following: $ wget --no-parent \ --recursive \ --page-requisites \ --html-extension \ --base="http://code.google.com/p/myProject/" \ "http://code.google.com/p/myProject/" The problem is that links from within the mirrored copy have links like: file:///p/myProject/documentName This renaming of links in this way causes 404 (not found) errors, since the links point to nowhere valid on the filesystem. What options should I use instead with wget, so that I can make a local copy of the site's documentation and other pages?

    Read the article

  • is it better to query database or grab from file? php & mysql

    - by pfunc
    I am keeping a large amount of words in a database that I want to match up articles to. I was thinking that it would just be better to keep these words in an array and grab that array whenever needed instead of querying the database every time (since the words won't be changing that much). Is there much performance difference in doing this? And if I were to do this, how to I write a script that writes the array to a a new php file. I tried writing the array like so: while( $row = mysql_fetch_assoc($query)) { $newArray[] = $row; } $fp = fopen('noWordsArr.php', 'w'); fwrite($fp, $newArray); fclose($fp); But all I get in the other file is "Array". So i figured I could write this and then write have a chron hit up the file every few days or so in case things have changed. But I guess if there is no performance advantage then it prob won't be necessary and I can just query the database every time I need to access the words.

    Read the article

  • Is this the best way to grab common elements from a Hash of arrays?

    - by Hulihan Applications
    I'm trying to get a common element from a group of arrays in Ruby. Normally, you can use the & operator to compare two arrays, which returns elements that are present or common in both arrays. This is all good, except when you're trying to get common elements from more than two arrays. However, I want to get common elements from an unknown, dynamic number of arrays, which are stored in a hash. I had to resort to using the eval() method in ruby, which executes a string as actual code. Here's the function I wrote: def get_common_elements_for_hash_of_arrays(hash) # get an array of common elements contained in a hash of arrays, for every array in the hash. # ["1","2","3"] & ["2","4","5"] & ["2","5","6"] # => ["2"] # eval("[\"1\",\"2\",\"3\"] & [\"2\",\"4\",\"5\"] & [\"2\",\"5\",\"6\"]") # => ["2"] eval_string_array = Array.new # an array to store strings of Arrays, ie: "[\"2\",\"5\",\"6\"]", which we will join with & to get all common elements hash.each do |key, array| eval_string_array << array.inspect end eval_string = eval_string_array.join(" & ") # create eval string delimited with a & so we can get common values return eval(eval_string) end example_hash = {:item_0 => ["1","2","3"], :item_1 => ["2","4","5"], :item_2 => ["2","5","6"] } puts get_common_elements_for_hash_of_arrays(example_hash) # => 2 This works and is great, but I'm wondering...eval, really? Is this the best way to do it? Are there even any other ways to accomplish this(besides a recursive function, of course). If anyone has any suggestions, I'm all ears. Otherwise, Feel free to use this code if you need to grab a common item or element from a group or hash of arrays, this code can also easily be adapted to search an array of arrays.

    Read the article

  • Is this the best way to grab Common element from a Hash of arrays?

    - by Hulihan Applications
    I'm trying to get a common element from a group of arrays in Ruby. Normally, you can use the & operator to compare two arrays, which returns elements that are present or common in both arrays. This is all good, except when you're trying to get common elements from more than two arrays. However, I want to get common elements from an unknown, dynamic number of arrays, which are stored in a hash. I had to resort to using the eval() method in ruby, which executes a string as actual code. Here's the function I wrote: def get_common_elements_for_hash_of_arrays(hash) # get an array of common elements contained in a hash of arrays, for every array in the hash. # ["1","2","3"] & ["2","4","5"] & ["2","5","6"] # => ["2"] # eval("[\"1\",\"2\",\"3\"] & [\"2\",\"4\",\"5\"] & [\"2\",\"5\",\"6\"]") # => ["2"] eval_string_array = Array.new # an array to store strings of Arrays, ie: "[\"2\",\"5\",\"6\"]", which we will join with & to get all common elements hash.each do |key, array| eval_string_array << array.inspect end eval_string = eval_string_array.join(" & ") # create eval string delimited with a & so we can get common values return eval(eval_string) end example_hash = {:item_0 => ["1","2","3"], :item_1 => ["2","4","5"], :item_2 => ["2","5","6"] } puts get_common_elements_for_hash_of_arrays(example_hash) # => 2 This works and is great, but I'm wondering...eval, really? Is this the best way to do it? Are there even any other ways to accomplish this(besides a recursive function, of course). If anyone has any suggestions, I'm all ears. Otherwise, Feel free to use this code if you need to grab a common item or element from a group or hash of arrays, this code can also easily be adapted to search an array of arrays.

    Read the article

  • groovy (java) error grabbing files

    - by senzacionale
    i can not grab files. I get: java.lang.RuntimeException: Error grabbing Grapes -- [unresolved dependency: org.apache.ivy#ivy;2.1.0: not found start of script which grab files import groovy.text.SimpleTemplateEngine import java.security.MessageDigest import org.apache.commons.cli.OptionBuilder import org.apache.commons.cli.Options import org.apache.commons.cli.PosixParser import org.apache.commons.io.FileUtils import org.apache.ivy.core.settings.IvySettings import org.apache.ivy.plugins.parser.m2.PomModuleDescriptorParser import org.apache.tools.ant.Project import org.apache.tools.ant.ProjectHelper import org.apache.tools.ant.types.Path import org.apache.commons.cli.HelpFormatter //First grab the grapes we need for the script and create a few beans to hold some values @Grab(group = 'org.apache.ant', module = 'ant', version = '1.7.1') @Grab(group = 'commons-io', module = 'commons-io', version = '1.4') @Grab(group = 'commons-cli', module = 'commons-cli', version = '1.2') @Grab(group = 'org.apache.ivy', module = 'ivy', version = '2.1.0')

    Read the article

  • How do I specify a crossdomain policy file to allow Flash to grab a bitmap from an RTMP (Wowza) vide

    - by Ken Smith
    I'm trying to get a bitmap/snapshot of a Wowza video stream playing on my client, like so: var bitmapData:BitmapData = new BitmapData(view.videoPlayerComponent.width, view.videoPlayerComponent.height); bitmapData.draw(view.videoPlayerComponent); When I do this, I get this error message: SecurityError: Error #2123: Security sandbox violation: BitmapData.draw: http://localhost:51150/Resources/WRemoteWebCam.swf cannot access rtmp://localhost/videochat/smithkl42._default/. No policy files granted access. I presume the error comes from not being able to locate the appropriate crossdomain.xml file. I'm not quite sure where it's looking for it, and a wireshark sniff was inconclusive, so I've tried placing one in each of the following places: http://localhost/crossdomain.xml http://localhost:1935/crossdomain.xml http://localhost:51150/crossdomain.xml I can retrieve the file successfully from each of those three locations. (I'm pretty sure that the last one wouldn't have any effect, since it's just the location of the web site which hosts the page that hosts the .swf file, but on the off chance...) These are the contents of the file that it's grabbing in each instance: <cross-domain-policy> <allow-access-from domain="*" to-ports="*" /> </cross-domain-policy> And it's still throwing that same error message. I've also followed the instructions on the Wowza forums, to turn on StreamVideoSampleAccess in the [install]\conf[appname]\Application.xml, with no joy: <Client> <IdleFrequency>-1</IdleFrequency> <Access> <StreamReadAccess>*</StreamReadAccess> <StreamWriteAccess>*</StreamWriteAccess> <StreamAudioSampleAccess>*</StreamAudioSampleAccess> <StreamVideoSampleAccess>*</StreamVideoSampleAccess> <SharedObjectReadAccess>*</SharedObjectReadAccess> <SharedObjectWriteAccess>*</SharedObjectWriteAccess> </Access> </Client> Any thoughts?

    Read the article

  • iPhone - is it IMPOSSIBLE to grab the contents of a CALayers composition?

    - by Mike
    I have a CALayer transformed in 3D on a offscreen UIView (much larger than 320x480). How do I dump what is seen on this UIView to a UIImage? NOTE: I Have edited the question to include this code... This is how I create the layer... CGRect area = CGRectMake (0,0,400,600]; vista3D = [[UIView alloc] initWithFrame:area ]; [self.view addSubview:vista3D]; [vista3D release]; transformed = [CALayer layer]; transformed.frame = area; [vista3D.layer addSublayer:transformed]; CALayer *imageLayer = [CALayer layer]; imageLayer.doubleSided = YES; imageLayer.frame = area; imageLayer.transform = CATransform3DMakeRotation(40 * M_PI / 180.0f, 1.0f, 0.0f, 0.0f); imageLayer.contents = (id)myRawImage.CGImage; [transformed addSublayer:imageLayer]; // Add a perspective effect CATransform3D initialTransform = transformed.sublayerTransform; initialTransform.m34 = 1.0 / -500; transformed.sublayerTransform = initialTransform; // now the layer is in perspective // my next step is to "flatten" the composition into a UIImage UIImage *thisIsTheResult = some magic command thanks for any help! EDIT 1: I have tried jessecurry solution but it gives me a flat layer without any perspective. EDIT 2: I discovered a partial solution for this that works, but this solution gives me an image the size of the screen and I was looking for obtaining a higher resolution version, rendering off screen.

    Read the article

  • What should I grab as a development platform, an iPod or an iPad?

    - by mmr
    Hey all, I've recently gotten into the world of contract programming, and two of my clients have indicated that they'd like to do something 'trendy', like ipod touch/iphone/ipad development. I have a mac laptop (first gen macbook pro) that I'll have to upgrade to snow leopard to do the development for any of them, from what I've read. So that's already a bit of a commitment, given all the stuff I have on that laptop I'll have to make sure is recoverable from backup. My budget is limited, but I think I need to learn this skill. Which device should I get to learn this kind of development, an iPod touch or an iPad? I don't have the money for an iPhone. I think that the iPhone/iPad SDK has an emulator mode, but I like to have the device I'm going to roll out on available to make sure that everything works as I'd expect, ie, what's easily readable on a laptop screen is still readable on the touch, etc.

    Read the article

  • How to grab data from webpage in Chrome and output into Chrome extension popup?

    - by chimerical
    For a Google Chrome extension, none of the Javascript I write to manipulate the DOM of the extension popup.html seems to have any effect on the popup's DOM. I can manipulate the DOM of the current webpage in the browser just fine by using content_script.js, and I'm interested in grabbing data from the webpage and outputting it into the extension popup, like so (below: popup.html): <div id="extensionpopupcontent">Links</div> <a onclick="click()">Some Link</a> <script type="text/javascript"> function click() { chrome.tabs.executeScript(null, {file: "content_script.js"}); document.getElementById("extensionpopupcontent").innerHTML = variableDefinedInContentScript; window.close(); } </script> I tried using chrome.extension.sendRequest from the documentation at http://code.google.com/chrome/extensions/messaging.html, but I'm not sure how to properly use it in my case, specifically the greeting and the response. contentscript.js ================ chrome.extension.sendRequest({greeting: "hello"}, function(response) { console.log(response.farewell); });

    Read the article

  • Facebook Is it possible to grab a user's data and populate a form in an iframe?

    - by super9
    I am trying to create an iframe tab for a Facebook Page. On this page, I am loading in an iframe which consists of a form from another domain/site. Is it possible to use javascript to query the graph api to load the user's data into this iframe loaded form using javascript such that is appears pre-populated to the user? I am aware that there is a cross domain security issue. In that case, suppose that my iframe tab is now hosted on the same domain as the iframe loaded form, will this be doable now?

    Read the article

  • PHP: how to grab an URL out of a chunk of text?

    - by Eileen
    Let's say I have a big RSS feed full of Twitter posts, and they are all plain text. Lots of the posts contain URLs, and I'd like those URLs to be turned into links. So I've got a variable that is equal to: Visualization of layoffs by industry, number and date. Looking forward to seeing similar for hiring trends. http://bit.ly/XBW4z And I'd like it to turn into: Visualization of layoffs by industry, number and date. Looking forward to seeing similar for hiring trends. http://bit.ly/XBW4z How could I do that? I am useless when it comes to regex and its ilk, so help is much appreciated!

    Read the article

  • Session is Closed! NHibernate shouldn't be trying to grab data

    - by Jeremy Holovacs
    I have a UnitOfWork/Service pattern where I populate my model using NHibernate before sending it to the view. For some reason I still get the YSOD, and I don't understand why the object collection is not already populated. My controller method looks like this: public ActionResult PendingRegistrations() { var model = new PendingRegistrationsModel(); using (var u = GetUnitOfWork()) { model.Registrations = u.UserRegistrations.GetRegistrationsPendingAdminApproval(); } return View(model); } The service/unit of work looks like this: public partial class NHUserRegistrationRepository : IUserRegistrationRepository { public IEnumerable<UserRegistration> GetRegistrationsPendingAdminApproval() { var r = from UserRegistration ur in _Session.Query<UserRegistration>() where ur.Status == AccountRegistrationStatus.PendingAdminReview select ur; NHibernateUtil.Initialize(r); return r; } } What am I doing wrong?

    Read the article

  • How can I use Perl to grab text from a web page that is dynamically generated with JavaScript?

    - by bstullkid
    There is a website I am trying to pull information from in Perl, however the section of the page I need is being generated using javascript so all you see in the source is: <div id="results"></div> I need to somehow pull out the contents of that div and save it to a file using Perl/proxies/whatever. e.g. the information I want to save would be document.getElementById('results').innerHTML; I am not sure if this is possible or if anyone had any ideas or a way to do this. I was using a lynx source dump for other pages but since I cant straight forward screen scrape this page I came here to ask about it! If anyone is interested, the page is http://downloadcenter.trendmicro.com/index.php?clk=left_nav&clkval=pattern_file&regs=NABU and the info I am trying to get is the row about the ConsumerOPR

    Read the article

  • Facebook Open Graph - Grab how many times a page has been liked?

    - by DoMx
    I have a site that allows users to create a saying and then users "like" those sayings on Facebook. http://www.likeylikey.net/ I got a friend to throw up this simple code in less than 2 hours so it's basic. He knows little to nothing regarding the Open Graph API. Basically, I want to know how I can programmatically store how many times a page has been liked so I can list a "Top 10, most liked pages" list. Right now the index shows a list of all created pages and now I just wish to show the 10 most liked but I need a way of pulling that information from Facebook. Is this possible?

    Read the article

  • how do i grab text of multiple tags in an xml feed using one xpath expression?

    - by Incognito
    Im trying to parse an xml feed that looks something like this: <item> <title>item title</title> <link>item link</link> <description>item description</description> </item> I'm trying to find an xpath expression that will retrieve all the details of each item so that each item in the feed is contained within its own array or grouped in some way. I tried using //item/* but the tags are not grouped, although they are correctly ordered. Is there anyway of doing that? edit: [ [title1, link1, desc1], [title2, link2, desc2], [title3, link3, desc3] ]

    Read the article

  • Windows: Does something temporarily grab the com ports on startup?

    - by Tim
    I have a WPF/C# app that is launched as part of the "Startup" group on a Windows Embedded Standard machine. One of the first things the app does (in its static App() method) is create a new SerialPort object for COM1. COM1 is a hardwired serial port, not a USB virtual port or anything like that. My problem is that every so often (maybe 1 out of 12) on startup, I get an exception: System.UnauthorizedAccessException: Access to the port 'COM1' is denied. There are no other applications using this port. Also, when I relaunch the app following this error, it grabs the port just fine. It's as if the com port isn't ready/set up for my app sometimes. I'm clueless on this one! Any insight is appreciated! UPDATE: I added a call to SerialPort.GetPortNames() and printout all available ports before attempting to open the port. In the failure case COM1 is indeed THERE! So, it's not that the port isn't ready. It looks like something in Windows is actually grabbing the port temporarily and blocking me.

    Read the article

  • grab inspect the parameters to "use" and pass on the rest?

    - by JoelFan
    I have a Perl module and I'd like to be able to pick out the parameters that my my module's user passed in the "use" call. Whichever ones I don't recognize I'd like to pass on. I tried to do this by overriding the "import" method but I'm not having much luck. EDIT: To clarify, as it is, I can use my module like this: use MyModule qw/foo bar/; which will import the foo and bar methods of MyModule. But I want to be able to say: use MyModule qw/foo doSpecialStuff bar/; and look for doSpecialStuff to check if I need to do some special stuff at the beginning of the program, then pass qw/foo bar/ to the Exporter's import

    Read the article

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