Search Results

Search found 301 results on 13 pages for 'horace ho'.

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

  • python regex of a date in some text

    - by Horace Ho
    How can I find as many date patterns as possible from a text file by python? The date pattern is defined as: dd mmm yyyy ^ ^ | | +---+--- spaces where: dd is a two digit number mmm is three-character English month name (e.g. Jan, Mar, Dec) yyyy is four digit year there are two spaces as separators Thanks!

    Read the article

  • Is it possible to download a .zip file into iPhone when user clicks a link inside UIWebView?

    - by Horace Ho
    In a new app, I plan to let users download their own files and stored them inside iPhone. The process is typically: iPhone present a web page by UIWebView, in which there are several links to .zip files the user browser the page and click on one of the .zip file link iPhone downloads the file into the iPhone document folder, closes WebView, acknowledges the user when download is complete How can that be done? Thanks

    Read the article

  • PDF text search and split library

    - by Horace Ho
    I am look for a server side PDF library (or command line tool) which can: split a multi-page PDF file into individual PDF files, based on a search result of the PDF file content Examples: Search "Page ???" pattern in text and split the big PDF into 001.pdf, 002,pdf, ... ???.pdf A server program will scan the PDF, look for the search pattern, save the page(s) which match the patten, and save the file in the disk. It will be nice with integration with PHP / Ruby. Command line tool is also acceptable. It will be a server side (linux or win32) batch processing tool. GUI/login is not supported. i18n support will be nice but no required. Thanks~

    Read the article

  • Initialize virtual attributes

    - by Horace Loeb
    I have an IncomingEmail model with an attachments virtual attribute: class IncomingEmail < ActiveRecord::Base attr_accessor :attachments end I want the attachments virtual attribute to be initialized to [] rather than nil so that I can do: >> i = IncomingEmail.new => #<IncomingEmail id: nil,...) >> i.attachments << "whatever" Without first setting i.attachments to [] (put another way, I want this virtual attribute to default to an empty array rather than nil)

    Read the article

  • How can I catch a "catchable fatal error" on PHP type hinting?

    - by Ho
    Hello, I am trying to implement Type Hinting of PHP5 on one of my class, class ClassA { public function method_a (ClassB $b) {} } class ClassB {} class ClassWrong{} Correct usage: $a = new ClassA; $a->method_a(new ClassB); producing error: $a = new ClassA; $a->method_a(new ClassWrong); Catchable fatal error: Argument 1 passed to ClassA::method_a() must be an instance of ClassB, instance of ClassWrong given... May I know if it is possible to catch that error(since it says "catchable")? and if yes, how? Thank you.

    Read the article

  • How do I subtract a binding using a Guice module override?

    - by Jimmy Yuen Ho Wong
    So according to my testing, If you have something like: Module modA = new AbstractModule() { public void configure() { bind(A.class).to(AImpl.class); bind(C.class).to(ACImpl.class); bind(E.class).to(EImpl.class); } } Module modB = New AbstractModule() { public void configure() { bind(A.class).to(C.class); bind(D.class).to(DImpl.class); } } Guice.createInjector(Modules.overrides(modA, modB)); // gives me binding for A, C, E AND D with A overridden to A->C. But what if you want to remove the binding for E in modB? I can't seem to find a way to do this without having to break the bind for E into a separate module. Is there a way?

    Read the article

  • Full text search for irregular rapper names with Solr

    - by Horace Loeb
    I'm implementing full text search functionality on my rap website, and I'm running into some issues with rapper and song names. For example, someone might want to search for the rapper "Cam'ron" using the query "camron" (leaving out the mid-word apostrophe). Likewise, someone might search for the song "3 Peat" using the query "3peat". "The Notorious B.I.G." is a bit of a weird case: both "The Notorious BIG" and "The Notorious B.I.G." both work (I guess because the solr.StandardFilterFactory removes dots from acronyms?), but "The Notorious B.I.G" (i.e., minus the trailing dot) doesn't. Ideally all reasonable variations of these names should work. I'm guessing the answer has something to do with the solr.WordDelimiterFilterFactory, but I'm not sure. Also, I'm using Sunspot with Rails if that's relevant.

    Read the article

  • Image Transformation on iPhone, how to?

    - by Horace Ho
    Since I cannot pre-render all the images in PNGs and real-time image transformation functions are required, namely: skew perspective (like the transform action found in Photoshop) Which API (CoreAnimation? OpenGL ES?) should I look into? Even better, is there any sample code around? Thanks!

    Read the article

  • Spoof referrer to Google Analytics?

    - by Horace Loeb
    Whenever a user visits "Page A" on my site, I immediately redirect him to "Page B" by setting window.location with Javascript. "Page A" has no Google Analytics tracking on it -- when someone is redirected from "Page A" to "Page B" I want to track him as if he entered the site via "Page B". Unfortunately, my current setup breaks referrer information since people who are redirected to "Page B" appear to Google Analytics as if they came from "Page A": After users are redirected to "Page B", I want to tell Google Analytics their "real" referrer (i.e., the referrer to "Page A"). How can I do this? (Note: I realize that using a real HTTP redirect instead of a Javascript-based redirect would solve this problem. Unfortunately this isn't an option)

    Read the article

  • Returning HTML in the JS portion of a respond_to block throws errors in IE

    - by Horace Loeb
    Here's a common pattern in my controller actions: respond_to do |format| format.html {} format.js { render :layout => false } end I.e., if the request is non-AJAX, I'll send the HTML content in a layout on a brand new page. If the request is AJAX, I'll send down the same content, but without a layout (so that it can be inserted into the existing page or put into a lightbox or whatever). So I'm always returning HTML in the format.js portion, yet Rails sets the Content-Type response header to text/javascript. This causes IE to throw this fun little error message: Of course I could set the content-type of the response every time I did this (or use an after_filter or whatever), but it seems like I'm trying to do something relatively standard and I don't want to add additional boilerplate code. How do I fix this problem? Alternatively, if the only way to fix the problem is to change the content-type of the response, what's the best way to achieve the behavior I want (i.e., sending down content with layout for non-AJAX and the same content without a layout for AJAX) without having to deal with these errors? Edit: This blog post has some more info

    Read the article

  • Convert Ruby array of tuples into a hash given an array of keys?

    - by Kit Ho
    I have an simple array array = ["apple", "orange", "lemon"] array2 = [["apple", "good taste", "red"], ["orange", "bad taste", "orange"], ["lemon" , "no taste", "yellow"]] how can i convert in to this hash whenever element in array match the first element of each element in array2? hash = {"apple" => ["apple" ,"good taste", "red"], "orange" => ["orange", "bad taste", "orange"], "lemon" => ["lemon" , "no taste", "yellow"] } I am quite new to ruby, and spend a lot to do this manipulation, but no luck, any help ?

    Read the article

  • How to smooth the edge of a zig-zag line?

    - by Horace Ho
    Currently I draw a zig-zap line by CGContextMoveToPoint, CGContextAddLineToPoint, and CGContextStrokePath, following touchesMoved events. How can I smooth the edges of the line? Such that when the user draw a circle-like shape, the circle can be more round'ed. The GLPaint example use OpenGL, is that the only way to do it?

    Read the article

  • Trouble rendering a view inside a generic class

    - by Horace Loeb
    I'm trying to encapsulate the logic for generating my sitemap in a separate class so I can use Delayed::Job to generate it out of band: class ViewCacher include ActionController::UrlWriter def initialize @av = ActionView::Base.new(Rails::Configuration.new.view_path) @av.class_eval do include ApplicationHelper end end def cache_sitemap songs = Song.all sitemap = @av.render 'sitemap/sitemap', :songs => songs Rails.cache.write('sitemap', sitemap) end end But whenever I try ViewCacher.new.cache_sitemap I get this error: ActionView::TemplateError: ActionView::TemplateError (You have a nil object when you didn't expect it! The error occurred while evaluating nil.url_for) on line #5 of app/views/sitemap/_sitemap.builder: I assume this means that ActionController::UrlWriter is not included in the right place, but I really don't know

    Read the article

  • How to check whether a CGPoint is inside a UIImageView?

    - by Horace Ho
    In touchesBegan: CGPoint touch_point = [[touches anyObject] locationInView:self.view]; There are tens of UIImageView around, stored in a NSMutableArray images. I'd like to know is there a built-in function to check if a CGPoint (touch_point) is inside one of the images, e.g.: for (UIImageView *image in images) { // how to test if touch_point is tapped on a image? } Thanks Follow up: For unknown reason, pointInside never returns true. Here is the full code. - (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event { UITouch *touch = [touches anyObject]; touch_point = [touch locationInView:self.view]; for (UIImageView *image in piece_images) { if ([image pointInside:touch_point withEvent:event]) { image.hidden = YES; } else { image.hidden = NO; } NSLog(@"image %.0f %.0f touch %.0f %.0f", image.center.x, image.center.y, touch_point.x, touch_point.y); } } although I can the two points are sometimes identical in the NSLog output ... I also tried: if ([image pointInside:touch_point withEvent:nil]) the result is the same. never returns a true. To eliminate the chance of anything goes with with the images. I tried the following: if (YES or [image pointInside:touch_point withEvent:event]) all images are hidden ater the first click on screen.

    Read the article

  • Which PHP framework for a RoR developer?

    - by Horace Ho
    For one specific client I have to use PHP. This and this question were 2 years old. I'd like to know is there any update of opinion for year 2010? My background on web development is mainly rails. I can code in PHP (for example, write a module for Drupal) but never used any PHP framework for any project. I can see the following potential features to be needed in my project: authlogic-like user access control will_paginate-like paging for long listings paperclip-like simple file upload prawn-like PDF generation restful url and my personal favorite ruby/rails features: activerecord <% @list.each do |item| %> synstax instead of for ($i=1; $i<=$row_num; $i++) ... rake:db migrate script/console Thanks!

    Read the article

  • decoding algorithm wanted

    - by Horace Ho
    I receive encoded PDF files regularly. The encoding works like this: the PDFs can be displayed correctly in Acrobat Reader select all and copy the test via Acrobat Reader and paste in a text editor will show that the content are encoded so, examples are: 13579 -> 3579; hello -> jgnnq it's basically an offset (maybe swap) of ASCII characters. The question is how can I find the offset automatically when I have access to only a few samples. I cannot be sure whether the encoding offset is changed. All I know is some text will usually (if not always) show up, e.g. "Name:", "Summary:", "Total:", inside the PDF. Thank you!

    Read the article

  • iPhone app identifier?

    - by Horace Ho
    What is the unique identifier for an iPhone app? In the info.plist file, there are keys: Bundle display name Executable file Bundle identifier Bundle name If I have already submitted an app on the AppStore before. Then I change some of the keys in the project. Which of the above can be changed freely and AppStore still considers my app is same as the existing one? Thanks!

    Read the article

  • How to search in this activerecord example?

    - by Horace Ho
    Two models: Invoice :invoice_num string :date datetime . . :disclaimer_num integer (foreign key) Disclaimer :disclaimer_num integer :version integer :body text For each disclaimer there are multiple versions and will be kept in database. This is how I write the search (simplified): scope = Invoice.scoped({ :joins => [:disclaimer] }) scope = scope.scoped :conditions => ["Invoice.invoice_num = ?", "#{params[:num]}"] scope = scope.scoped :conditions => ["Disclaimer.body LIKE ?", "%#{params[:text]}%"] However, the above search will search again all versions of the disclaimer. How can I limit the search to only the last disclaimer (i.e. the version integer is the maximum). Please note: Invoice does not keep the version number. New disclaimers will be added to disclaimer table and keep old versions.

    Read the article

  • What are some lesser known usages of #pragma?

    - by Xavier Ho
    I've never understood the need of #pragma once when #ifndef #define #endif always works. I've seen the usage of #pragma comment to link with other files , but setting up the compiler settings was easier with an IDE. What are some other usages of #pragma that is useful, but not widely known?

    Read the article

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