Daily Archives

Articles indexed Saturday June 12 2010

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

  • measure rendered html in javascript without affecting the measurement

    - by drawnonward
    I am doing pagination in javascript. This is typographic pagination, not chopping up database results. For the most part it works, but I have run into a heisenberg issue where I cannot quite measure text without affecting it. I am not trying to measure text before it is rendered. I want the actual position it shows up at on screen, so I can paginate to where it is naturally wrapped. I am measuring the vertical position of characters, not the horizontal width of strings. The way I do this is similar to this answer in that I am applying a style to a block of text, then measuring the position of the newly created span. If the span does not reach the end of the page, I clear it and make a new span in a linear search. The problem is that the anti-aliased sub-pixel text layout is different when the span is applied. In rare cases, this causes the text to wrap differently when I measure it. I have only seen this when wrapping at a hyphen, and I assume it would not happen when wrapping at white space. As a concrete example, "prepared-he" is the string I am having trouble with. When I measure up to "prepare" it appears, as expected, to be within the current page. When I measure "prepared" the whole phrase wraps down to the next line, moving it to the next page, so it looks like the "d" is the character to break at. I break the text between "prepare" and "d-he" and that is wrong. Trying to evaluate individual characters opens a whole can of worms I would rather avoid. The wrapping changes because, with the new span, the line is 1 pixel wider. A solution to my problem could either be a better way to measure text using javascript, or a way to wrap text in a new element without affecting layout. I have tried setting margin-right:-1px for the class of the span being created to wrap the text. This had no noticeable effect. I am doing this in a UIWebView on the iPhone. There are some measurement related calls that are available in normal WebKit that are not available here. For example, Range does not have getBoundingClientRect or support setting an offset other than 0 in setStart or setEnd. Thank you

    Read the article

  • In Rails, how do you functional test a Javascript response format?

    - by Teflon Ted
    If your controller action looks like this: respond_to do |format| format.html { raise 'Unsupported' } format.js # index.js.erb end and your functional test looks like this: test "javascript response..." do get :index end it will execute the HTML branch of the respond_to block. If you try this: test "javascript response..." do get 'index.js' end it executes the view (index.js.erb) withOUT running the controller action!

    Read the article

  • I want to trace logs using a Macro multi parameter always null. problem c++ windows

    - by sxingfeng
    I am using the following way to cout a function's time: #define TIME_COST(message, ...)\ char szMessageBuffer[2048] = {0};\ va_list ArgList;\ va_start(ArgList, message);\ vsprintf_s(szMessageBuffer, 2048, message, ArgList);\ va_end(ArgList); \ string strMessage(szMessageBuffer);\ CQLogTimer t(strMessage); // CQLogTimer is a self destructor,which will cout life time of its own and print szMessageBuffer. However when I use the macro this : void fun { TIME_COST("hello->%s", filePath); XXXXXX } The message generated always is hello-(null) Can Any one help? Many thanks!

    Read the article

  • PHP regular expression for positive number with 0 or 2 decimal places

    - by Peter
    Hi I am trying to use the following regular expression to check whether a string is a positive number with either zero decimal places, or 2: ^\d+(\.(\d{2}))?$ When I try to match this using preg_match, I get the error: Warning: preg_match(): No ending delimiter '^' found in /Library/WebServer/Documents/lib/forms.php on line 862 What am I doing wrong?

    Read the article

  • Reason for getting error in Reverse Geocoder Delegate method in the morning times.

    - by Srilakshmi
    - (void)reverseGeocoder:(MKReverseGeocoder *)geocoder didFailWithError:(NSError *)error { NSLog(@"reverseGeocoder:%@ didFailWithError:%@", geocoder, error); } This method is getting called in morning times and it is not showing the placemark while running the application in simulator. From Afternoon it is showing the placemark as "Cupertino". Will you give me the reason for not getting the placeMark at morning times?

    Read the article

  • (Newbie) Amazon Web Services Apache Server

    - by Samnsparky
    Hello! I am trying to get a feel for the costs imposed by running apache on AWS continually. Assuming that the service is scarcely used, does anyone know how many cpu hours that would eat up in a month just by sitting there and running? I understand that this is slightly impractical but I am trying to figure out what the cost of entry is to deploy an application on this platform (as compared to GAE). I suspect it to be small but I would like to know. Thank you for your help, Sam

    Read the article

  • Is there a way to send a blog post to wordpress via an api?

    - by Yuval Cohen
    In more details: I want to build a web service to which users register and by browsing my site, users can send blog posts to their own blogs. Initially wordpress.org is discussed. However, I'll be happy to hear solutions for typepad or wordpress.com as well. The ideal solution would be a way for my server to simply "tell" their blog what to post (as a draft of course for them to confirm). A good solution would be for my users to install a plugin in their blog that will allow my server the above functionality. Lacking any other solution, I would give my users text to copy-paste into their blog editor. Help me find a solution and feel free to be creative!

    Read the article

  • how to add Done Button to dismiss the Number Pad

    - by mac
    I followed the tutorial http://www.neoos.ch/news/46-development/54-uikeyboardtypenumberpad-and-the-missing-return-key to dismiss the number pad, this tutorial add the button as sub view to the number pad, my problem is, in the same view i am using the text field to enter text also,so, how to differentiate the number field, and text field. so that i can hide the button view accordingly. thanks in advance.

    Read the article

  • View outlet not set with UINavigationController

    - by Sheehan Alam
    I have a NIB that contains a UINavigationController which has a UIViewController. The UIViewController is being loaded externally from another nib. I am unable to set the view property thus I get the error: *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: '-[UIViewController _loadViewFromNibNamed:bundle:] loaded the "LBRootViewController" nib but the view outlet was not set.' How can I set my view property correctly?

    Read the article

  • SMTP to HTTP Post service

    - by Chris Wallace
    I am looking for a SMTP to HTTP Post service. I have tried smtp2web.com but although I can register and set up forwarding, emails bounce. Any ideas suggestions for an alternative service or current experience of using this one?

    Read the article

  • Why doesn't a 32bit .deb package install on 64bit Ubuntu?

    - by codebox_rob
    My .deb package, built on 32-bit Ubuntu and containing executables compiled with gcc, won't install on the 64-bit version of the OS (the error message says 'Wrong architecture i386'). This is confusing to me because I thought that in general 32-bit software worked on 64-bit hardware, but not vice-versa. Will it be possible for me to produce a .deb file that I can install on a 64-bit OS, using my 32-bit machine? Is it just a matter of using the appropriate compiler flags to produce the executables (and if so what are they), or is the .deb file itself somehow specific to one processor architecture?

    Read the article

  • Send SMS through Asp.net via gsm modem

    - by MuraliVijay CSK
    Is it possible to detect GSM mobile (any kind) which connected through serial port to computer and then be able to send SMS through this mobile phone to other mobile phones from asp.net website running under iis(only 1 system), could anyone help me and guide me, I wrote a program which could open COM port but still couldn't detect mobile phone and send SMS through it.

    Read the article

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