Browsing projects by Tag(s)

Select a tag to browse associated projects and drill deeper into the tag cloud.

Showing page 1 of 1

Adjust the line width with usefull tool for coding style. The following text: » select¶ » » COLUMN1, » » COLUMN2·+·COLUMN3,¶ » from¶ » » TABLE1¶becomes: ····select···············¶ ········COLUMN1,·········¶ ... [More] ········COLUMN2·+·COLUMN3¶ ····from·················¶ ········TABLE1···········¶and there is a per-line prefix and sufix option that allow you to do the following code: mySQL += "····select···············¶"; mySQL += "········COLUMN1,·········¶"; mySQL += "········COLUMN2·+·COLUMN3¶"; mySQL += "····from·················¶"; mySQL += "········TABLE1···········¶"; [Less]

0
 
  0 reviews  |  0 users  |  0 current contributors  |  Analyzed 8 days ago
 
 

1. Introduction An intelligence background-correction algorithm for highly fluorescent sample in Raman spectroscopy has been developed with peak detection and width estimation by CWT wavelet and background fitting by penalized least squares. The programming language is ... [More] R(http://www.r-project.org/). 2. Installation Firstly, you must download and install R 2.8.1 from the urls as follows: for linux: http://cran.r-project.org/src/base/R-2/R-2.8.1.tar.gz for windows: http://cran.r-project.org/bin/windows/base/old/2.8.1/R-2.8.1-win32.exe Then, download the baselineWavelet package from this project download pages. for linux: http://baselinewavelet.googlecode.com/files/baselineWavelet_3.0.0.tar.gz for windows: http://baselinewavelet.googlecode.com/files/baselineWavelet_3.0.0.zip Finally,install the downloaded packages from local zip or tar.gz file. To start running this algorithm, load the baselineWavelet package through "library(baselineWavelet)" in the R commandline windows, try "?baselineWavelet" in the R commandline windows to open the documents. 3. What's new What's new in newer version: 1. From version 2.0 to 3.0: Rewirte the WhittakerSmooth function, don't use the cholskey decomposition any more. 2. From version 1.0 - 2.0: Two functions, say baselineCorrectionCWT() and WhittakerSmoother(), in the baselineWavelet package were modified (add a parameter) so that one could easily perform first, second or even higher differences penalties by adjusting the parameter for the purpose. 4. Correction example This is a correction example: [Less]

0
 
  0 reviews  |  0 users  |  0 current contributors  |  Analyzed 4 days ago
 
 

Recently I had the need to truncate a section of styled HTML text so it would fit inside a container with a specific pixel width. You might have thought this would be something pretty easy to make happen with a little JQuery and some .css() and .width() commands. You would have been mistaken. I ... [More] know I was. Among the tricky aspects was my desire that the text retain its styling, regardless of the width of the container. I also wanted it to truncate at the appropriate complete letter, rather than chop a word off in the middle of a letter. I wanted to be able to specify a string to use to indicate truncation (eg: “…”). I wanted the complete text to be preserved, and added to the element as a title tag so that it would be available to readers who hovered over the truncated text. And of course, I wanted it to work seamlessly across browsers. What I decided I needed was a temporary DOM object where I could copy the styled text. I needed something that would report its width based on the width of the text it contained. That ruled out both block elements such as divs (which take their width from their container) and inline elements such as spans (which report zero when queried about their width, regardless of their actual contents). What to do? Then I realized that tables adjust their width to the width of their contents, AND are able to report that width when queried. Eureka! I just needed to add a temporary table to the DOM somewhere that it would be untouched by other styling, and make sure all the elements that made up the table had no padding, margin, or border settings. I didn’t need to worry about the semantics of using a table this way since I was going to remove it from the DOM as soon as I was done with it. You won’t hear me saying things like that very often, but in this case even I was satisfied. To copy the styled text, I had to take a two-step approach. After creating a temporary table, I copied the contents of the original element I wanted to measure, and then copied each of the original element’s font-relates styles and applied them to the inner td of the table. Firefox immediately rewarded me with an accurate measurement, which I could use in a recursive loop to chop away one letter at a time until I had the width I desired. It looked like I was going to be done with this one quickly. I replaced the contents of the original element with the truncated text easily. I tossed in a call to cache the full text and apply it as a title attribute if the text needed truncating. I even made a quick swap of the truncation indicator text (”…”) into the styled table cell from the start, so I could account for the pixels that added to the width. It was looking pretty sweet. Until I tested it in Internet Explorer. Now the creepy thing was that it even worked in Internet Explorer with the font size set to the default value. But as soon as I tried font sizes that were larger or smaller, I started seeing the width vary in odd ways. Larger fonts would result in a reported width that was wider by an ever-increasing factor, resulting in truncated strings that were too short for the space. Smaller fonts did the opposite, reporting a narrower width than they actually required, resulting in truncated strings too long to fit the desired width. It wasn’t a straight line rate of change; I could see there was some mysterious equation at work here. I will admit it took me a few hours of fiddling, and I had to dust off that part of my brain that was paying attention during high school algebra. What I discovered (and this is the golden nugget in this chicken soup of a blog posting) was that Microsoft calculates the pixel size of rendered text based on the square root of the desired font size divided by a base font size of 16. The calculations gave me a result I could work with. You can see them in action in my final set of JQuery plugins: textTruncate() and textWidth(). [Less]

0
 
  0 reviews  |  0 users  |  119 lines of code  |  0 current contributors  |  Analyzed 5 days ago
 
 
 
 

Creative Commons License Copyright © 2013 Black Duck Software, Inc. and its contributors, Some Rights Reserved. Unless otherwise marked, this work is licensed under a Creative Commons Attribution 3.0 Unported License . Ohloh ® and the Ohloh logo are trademarks of Black Duck Software, Inc. in the United States and/or other jurisdictions. All other trademarks are the property of their respective holders.