Search Results

Search found 2255 results on 91 pages for 'formatting'.

Page 26/91 | < Previous Page | 22 23 24 25 26 27 28 29 30 31 32 33  | Next Page >

  • Java Date exception handling try catch

    - by user69514
    Is there some sort of exception in Java to catch an invalid Date object? I'm trying to use it in the following method, but I don't know what type of exception to look for. Is it a ParseException. public boolean setDate(Date date) { this.date = date; return true; }

    Read the article

  • Java printf using variable field size?

    - by paxdiablo
    I'm just trying to convert some C code over to Java and I'm having a little trouble with String.printf. In C, to get a specific width based on a variable, I can use: printf("Current index = %*d\n", sz, index); and it will format the integer to be a specific size based on sz. Trying: System.out.println(String.format("Current index = %*d\n", sz, index)); results in an error since it doesn't like the *. I currently have the following kludge: System.out.println(String.format("Current index = %" + sz + "d\n", index)); but I'm hoping there's a slightly better way, yes?

    Read the article

  • String.Format an integer to use 1000's separator without leading 0 for small integers

    - by Kragen
    Silly question, I want to format an integer so that it appears with the 1000's separator (,), but also without decimal places and without a leading 0. My attempts so far have been: String.Format("{0} {1}", 5, 5000); // 5 5000 String.Format("{0:n} {1:n}", 5, 5000); // 5.00 5,000.00 String.Format("{0:0,0} {1:0,0}", 5, 5000); // 05 5,000 The output I'm after is: 5 5,000 Is there something obvious that I'm missing?

    Read the article

  • Java add leading zeros to a number....

    - by user69514
    I need to return a string in the form xxx-xxxx where xxx is a number and xxxx is another number, however when i have leading zeros they disappear. I'm trying number formatter, but it's not working. public String toString(){ NumberFormat nf3 = new DecimalFormat("#000"); NumberFormat nf4 = new DecimalFormat("#0000"); if( areaCode != 0) return nf3.format(areaCode) + "-" + nf3.format(exchangeCode) + "-" + nf4.format(number); else return exchangeCode + "-" + number; } } I figured it out: public String toString(){ NumberFormat nf3 = new DecimalFormat("000"); NumberFormat nf4 = new DecimalFormat("0000"); if( areaCode != 0) //myFormat.format(new Integer(someValue)); return nf3.format(new Integer(areaCode)) + "-" + nf3.format(new Integer(exchangeCode)) + "-" + nf4.format(new Integer(number)); else return nf3.format(new Integer(exchangeCode)) + "-" + nf4.format(new Integer(number)); }

    Read the article

  • how to display formatted text but have the actual text

    - by Behrooz
    hello I have my own textbox witch inherits System.Windows.Forms.TextBox I am trying to display texts like 5000000 formatted == 5,000,000 but the problem is that Control.Text should return 5000000 but it should display 5,000,000. I know it is WTF, but i really need it and i couldn't Google a lot because my native language is not English(and anyone can get it from my grammar and Im sorry for that).

    Read the article

  • How to output formatted HTML from PHP?

    - by Tim
    I like to format all my HTML with tabs for neatness and readability. Recently I started using PHP and now I have a lot of HTML output that comes from in between PHP tags. Those output lines all line up one the left side of the screen. I have to use /n to make a line go to the next. Is there anything like that for forcing tabs, or any way to have neat HTML output coming from PHP?

    Read the article

  • scanf("%d", char*) - char-as-int format string?

    - by SF.
    What is the format string modifier for char-as-number? I want to read in a number never exceeding 255 (actually much less) into an unsigned char type variable using sscanf. Using the typical char source[] = "x32"; char separator; unsigned char dest; int len; len = sscanf(source,"%c%d",&separator,&dest); // validate and proceed... I'm getting the expected warning: argument 4 of sscanf is type char*, int* expected. As I understand the specs, there is no modifier for char (like %sd for short, or %lld for 64-bit long) is it dangerous? (will overflow just overflow (roll-over) the variable or will it write outside the allocated space?) is there a prettier way to achieve that than allocating a temporary int variable? ...or would you suggest an entirely different approach altogether?

    Read the article

  • Using a FormattedText object, how do I find out how much of my text was actually displayed?

    - by Robert
    If I have code like this: FormattedText text = new FormattedText(sTheBook, System.Globalization.CultureInfo.CurrentUICulture, System.Windows.FlowDirection.LeftToRight, new Typeface("Times New Roman"), 13, Brushes.Black); text.MaxTextWidth = 300; text.MaxTextHeight = 600; text.TextAlignment = TextAlignment.Justify; dc.DrawText(text, new Point(10, 0)); ...then, if it is long, only some of the text that I passed in (via sTheBook) will be displayed on the screen. I need to know how much was displayed so I can display the rest later! I can easily measure an amount of text, but it seems silly to do a search by rendering and re-rendering my text over and over until I find the piece that fits exactly. Thanks!

    Read the article

  • An autoformat tool to automatically insert braces around single-line clauses?

    - by Brian Deacon
    So assuming that in our work environment we've decided that the One True Faith forbids this: if (something) doSomething(); And instead we want: if (something) { doSomething(); } Is there a tool that will do that automagically? Awesomest would be to have eclipse just do it, but since we're really just recovering from one ex-employee that thought he was too pretty for coding conventions, a less-friendly tool that would do it right just once would suffice.

    Read the article

  • Remove unwanted lines,dead code from source code?

    - by Passionate programmer
    How to make source code free of the following Remove dead codes that are more than few lines between /* c++ codes */ Change more than one line breaks to one Remove modified user name and date /*-------- MODIFICATION DONE by xyz on ------------*/ I have used a code formatter tool to get a nice formatted code but stuck with code with above items.Is there any way to make sure codes like above doesn't get in to svn and automatically formatted code gets into the source.

    Read the article

  • Image File In Text Editor - What Are The Characters? What's the Process?

    - by TheDarkIn1978
    i'm currently in the process of conceptualizing an art piece for a gallery show next year, so this bizarre question of mine is more than just simple curiosity. if i open up an image file (a .PNG) with Text Edit or Note Pad, the file is presented in textual characters. something like this except: æº"í=™?0Ù:Ã,ÏI8^?K¯pmDHƒÃ?;wÔlD DDF›ä™èÜE[E˜ƒê?¯ƒºäeèçã?'ów+æ1ï‡ê0òHõñ?ò$úîù¥{WÎn}2*Ÿ!y(Ö!%2e9U2µ i4Õ(?=ù(›7}:É?##„G¶VfcVñ[÷D6gvrˆvéZN›=Ù=ó{púp…p?Ók‹oÃvŒÛ»{ùœóüôøW†W–VH\P?P$VTPt^lQ‹_B_S=Q™\Z[Ü)s/{]Œ_û]~¯¿¯Awu˜ùä’JÖ Í*tï[’ÎáÔ=<Æ6?~ZCWSÛpVµ?±ØŒ?nÆ^¨æ??™¡?a¥ë£1µÒÁ#?Gè)G<^mRl™m?jˆj~€"“R–Úª’?u?çO-•m˜â?ìéväˆàˆOä5ùXùûù”]¬]?]›V›œ{X{Óˆ|Ô’Èm{J?4‰Èáæõ}??~Á?óºYáœåüuRFÆ>W|^3Ñ5‰94=,<ú?|1b=2< >ö:?sÃ`¨{úf<f|ÛÖ?ãÊ íâ–âè/_÷O¬}Â?Í›§Ãd’kÃkØ?sSíS? ??øy;-6]ˆ?÷ÌÌÙåËLÈ,l÷uvzNtÆt6Ô6?O ?P?_t_|°N¸]Ÿ{ƒ{è˜3KK> ?x~ò[ñ\ÆXA?x?Ãî?X? ?…°”¸™‘jÂzÕkm~]jObµ·p1°Y‚s?&b”}s?ãËóí-»ñ”÷‰?‡v?ˆ˜WõØ£??æe~;¸n?Ooáa'aÁÎÌ-ª$ª!ª~ ?¨‹CÏpÏO/Á›œ/?80<Ë<§8 can anyone explain what is happening here? are the characters some form translation of pixel data by the text editor? maybe it is completely meaningless / an error? if not, is there a name for this type of data conversion or process?

    Read the article

  • Access Expression problem: it's too complex, so how do I turn it in to a function?

    - by Mike
    Access 2007 is telling me that my new expression is to complex. It used to work when we had 10 service levels, but now we have 19! Great! I've asked this question in SuperUser and someone suggested I try it over here. Suggestions are I turn it in to a function - but I'm not sure where to begin and what the function would look like. My expression is checking the COST of our services in the [PriceCharged] field and then assigning the appropriate HOURS [Servicelevel] when I perform a calculation to work out how much REVENUE each colleague has made when working for a client. The [EstimatedTime] field stores the actual hours each colleague has worked. [EstimatedTime]/[ServiceLevel]*[PriceCharged] Below is the breakdown of my COST to HOURS expression. I've put them on different lines to make it easier to read - please do not be put off by the length of this post, it's all the same info in the end. Many thanks,Mike ServiceLevel: IIf([pricecharged]=100(COST),6(HOURS), IIf([pricecharged]=200 Or [pricecharged]=210,12.5, IIf([pricecharged]=300,19, IIf([pricecharged]=400 Or [pricecharged]=410,25, IIf([pricecharged]=500,31, IIf([pricecharged]=600,37.5, IIf([pricecharged]=700,43, IIf([pricecharged]=800 Or [pricecharged]=810,50, IIf([pricecharged]=900,56, IIf([pricecharged]=1000,62.5, IIf([pricecharged]=1100,69, IIf([pricecharged]=1200 Or [pricecharged]=1210,75, IIf([pricecharged]=1300 Or [pricecharged]=1310,100, IIf([pricecharged]=1400,125, IIf([pricecharged]=1500,150, IIf([pricecharged]=1600,175, IIf([pricecharged]=1700,200, IIf([pricecharged]=1800,225, IIf([pricecharged]=1900,250,0)))))))))))))))))))

    Read the article

  • Why use semicolon?

    - by Art
    Are there any reasons, apart from subjective visual perception and cases where you have multiple statements on the same line, to use semicolon at the end of statements in Javascript?

    Read the article

  • MVC DateTime binding with incorrect date format

    - by Sam Wessel
    Asp.net-MVC now allows for implicit binding of DateTime objects. I have an action along the lines of public ActionResult DoSomething(DateTime startDate) { ... } This successfully converts a string from an ajax call into a DateTime. However, we use the date format dd/MM/yyyy; MVC is converting to MM/dd/yyyy. For example, submitting a call to the action with a string '09/02/2009' results in a DateTime of '02/09/2009 00:00:00', or September 2nd in our local settings. I don't want to roll my own model binder for the sake of a date format. But it seems needless to have to change the action to accept a string and then use DateTime.Parse if MVC is capable of doing this for me. Is there any way to alter the date format used in the default model binder for DateTime? Shouldn't the default model binder use your localisation settings anyway?

    Read the article

  • How do I format an email for Gmail?

    - by Ethan
    Hey, I'm sending out an email using codeigniter's built in library. All I'm trying to do is send a bolded string, but instead of rendering the tags, it is printing them. What I have: <html> <head> </head> <body> <b>Donkey</b> </body> </html> That is, character for character, the email I'm getting. Why aren't the tags rendering? Thanks for your help!

    Read the article

  • LaTeX - Making a lighter version of text, like anti-bold?

    - by Rory
    I'm making a LaTeX document for someone. A certain piece of text looks "bold" for them, even though I'm not using the \textbf command. It's just a normal default LaTeX font. Is there any command to make a 'lighter version', i.e. make the text lighter, thinner? Something that looks to normal text, what normal text looks to bold?

    Read the article

  • RegEx to ignore / skip everything in html tags

    - by Scott Sumpter
    Looking for a way to combine two Regular Expressions. One to catch the urls and the other to ensure is skips text within html tags. See sample text below functions. Need to pass a block of news text and format text by wrapping urls and email addresses in html tags so users don't have to. The below code works great until there are already html tags within the text. In that case it doubles the html tags. There are plenty of examples to strip html, but I want to just ignore it since the url is already linkified. Also - if there is an easier was to accomplish this, with or without Regex, please let me know. none of my attempts to combine Regexs have worked. coding in ASP.NET VB but will take any workable example/direction. Thanks! ===== Functions ============= Public Shared Function InsertHyperlinks(ByVal inText As String) As String Dim strBuf As String Dim objMatches As Object Dim iStart, iEnd As Integer strBuf = "" iStart = 1 iEnd = 1 Dim strRegUrlEmail As String = "\b(www|http|\S+@)\S+\b" 'RegEx to find urls and email addresses Dim objRegExp As New Regex(strRegUrlEmail, RegexOptions.IgnoreCase) 'Match URLs and emails Dim MatchList As MatchCollection = objRegExp.Matches(inText) If MatchList.Count <> 0 Then objMatches = objRegExp.Matches(inText) For Each Match In MatchList iEnd = Match.Index strBuf = strBuf & Mid(inText, iStart, iEnd - iStart + 1) If InStr(1, Match.Value, "@") Then strBuf = strBuf & HrefGet(Match.Value, "EMAIL", "_BLANK") Else strBuf = strBuf & HrefGet(Match.Value, "WEB", "_BLANK") End If iStart = iEnd + Match.Length + 1 Next strBuf = strBuf & Mid(inText, iStart) InsertHyperlinks = strBuf Else 'No hyperlinks to replace InsertHyperlinks = inText End If End Function Shared Function HrefGet(ByVal url As String, ByVal urlType As String, ByVal Target As String) As String Dim strBuf As String strBuf = "<a href=""" If UCase(urlType) = "WEB" Then If LCase(Left(url, 3)) = "www" Then strBuf = "<a href=""http://" & url & """ Target=""" & _ Target & """>" & url & "</a>" Else strBuf = "<a href=""" & url & """ Target=""" & _ Target & """>" & url & "</a>" End If ElseIf UCase(urlType) = "EMAIL" Then strBuf = "<a href=""mailto:" & url & """ Target=""" & _ Target & """>" & url & "</a>" End If HrefGet = strBuf End Function ===== Sample Text ============= This would be the inText parameter. Midway through the ride, we see a Skip this too. But sometimes we go here [insert normal www dot link dot com]. If you'd like to join us contact Bill Smith at [email protected]. Thanks! sorry stack overflow won't allow multiple hyperlinks to be added. ===== End Sample Text =============

    Read the article

  • How to format a string to camel case in XSLT?

    - by DBA_Alex
    I'm trying to format strings in XSLT that needs to be in camel case to be used appropriately for the application I'm working with. For example: this_text would become ThisText this_long_text would become ThisLongText Is it possible to also set this up where I can send an input to the format so I do not have to recreate the format multiple times?

    Read the article

< Previous Page | 22 23 24 25 26 27 28 29 30 31 32 33  | Next Page >