Formatting Text in Columns and in Tabs

7 posts, 0 answers
  1. Henning
    Henning avatar
    4 posts
    Member since:
    Sep 2014

    Posted 26 Sep 2014 Link to this post

    After successfully having written some script-code for custom columns and a custom tab, I have two questions:
    1. Is there a way to format colums right-aligned, or, even better: comma-aligned?
    Example code:

    public static BindUIColumn("ServerThinkTime", true)
    function ServerThinkTime(oS: Session)
    {
        var sResult = String.Empty;
        if (oS.Timers.ServerBeginResponse >= oS.Timers.ServerGotRequest)
        {
            // Without the time Fiddler needs
            sResult = (oS.Timers.ServerBeginResponse - oS.Timers.ServerGotRequest).TotalMilliseconds.ToString("N2");
        }
        return sResult;
    }

    2. How can I get the monospaced font in my custom tab (and get it back in the "Statistics" tab)?
    After opening Fiddler the font in my custom tab is a proportional font. When I save my CustomRules.js the font changes to a monospaced font. As long as I don't know better I need the monospaced font for formatting the text I want to show in the tab. Maybe it has to do with my "Statistics" tab, where I have no monospaced font anymore (and therefore no properly aligned colums in the text). It would be nice to have the monospaced font immediately after the program start.

    Feedback/wishlist:
    - Timestamp columns and "Overall_Elapsed" don't use my local decimal separator (comma in Germany). The same in the "Statistics" tab. (In the "Statistics" tab under "Estimated Worldwide Performance" the values are shown with commas.) Copying columns and inserting in Excel requires properly formatted text.
    - "Body" column ist formatted right-aligned (nice) and with (my local) group separator (nice), but the "Request" column ist left-aligned with no group separator
    - During writing a function I usually write something, press ctrl-s and have a look at the result, change the function, press ctrl-s and so on. It would be nice, if the tab in front (my custom tab I write the function for) could stay in front to see the result immediately without the need for another mouse click.

  2. Eric Lawrence
    Admin
    Eric Lawrence avatar
    833 posts

    Posted 26 Sep 2014 Link to this post

    Hello, Henning--

    Great feedback, thanks!

    1. I'm not entirely sure what "comma aligned" means, but if you mean to say all numbers have a comma and you'd like those commas to be in a vertical line, there's no way to do that in Windows' ListView control. Windows can right-align text in the columns, but Fiddler doesn't directly expose a way to do that. You can do the following inside the FiddlerScript's OnBoot function:

       FiddlerObject.UI.lvSessions.Columns[2].TextAlign = HorizontalAlignment.Right;

    Where "2" is the index of your custom column.

    In the next build, custom numeric columns will automatically be right-aligned.

    2. Can you tell me more about what specifically you're seeing, or perhaps include a screenshot? Have you changed your Font options inside Tools > Fiddler Options > Appearance? Does your system have the font
    "Lucida Console" installed?

    3. Thanks for pointing this out. Interestingly, the .NET Framework does not define a grammar for separators in timespans, only in specific time values. I expect there's some mechanism that can be used in Excel to enable a non-locale separator, or you could use a simple search & replace operation.

    4. Can you explain what "Request" column you are referring to? If this is one of the RequestSize or RequestBodySize columns, I've added digit grouping for the next update.

    5. When you save your JavaScript, all existing tabs are destroyed and recreated, which is why the Active tab did not persist. This has been fixed for the next build, thanks.



    Regards,
    Eric Lawrence
    Telerik
     

    Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

     
  3. Henning
    Henning avatar
    4 posts
    Member since:
    Sep 2014

    Posted 26 Sep 2014 in reply to Eric Lawrence Link to this post

    1. What I meant with comma aligned is, what you understood. I realize that is impossible in Window's ListView control. But right-aligned would be sufficient. Unfortunately your suggestion didn't work. I tried several values for the Columns[x] from your line, but it didn't help. Even 12 lines with values from 1 to 12 didn't change anything, not in the custom colums nor in the others. Maybe I have to wait for the next version, hoping it's not to long to wait.

    2. I suppose I habe changed my Font options before but I think it should influence the left part (the sessions) only. When I change the size only I see a change only in the left part, when I change the font then all text changes it's font except the menu bar's. And: yes, Lucida Console is installed.
     
    4. It is RequestBodySize

    5. Fine, thanks!
    (have to go and will be absent next 6 hours)

  4. Eric Lawrence
    Admin
    Eric Lawrence avatar
    833 posts

    Posted 26 Sep 2014 Link to this post

    1. Please understand that the OnBoot function only runs once, when Fiddler actually boots. Changing the file without restarting Fiddler won't change anything.

    2.  Unfortunately, there's no explanation for why the correct font isn't in use. It's possible that this is a bug in Windows XP (which I haven't used much in years). The font size you choose is applied in many places, not just the Web Sessions list. Even if you change the font, it shouldn't cause this problem, but once you've eliminated the impossible...

    For what it's worth, you may be able to avoid this problem entirely by setting the custom tab to render as HTML instead of plaintext...

    public BindUITab("ReadTiming", true)
    static function ProductsReport(arrSess: Session[]):String {
    var oSB: System.Text.StringBuilder = new System.Text.StringBuilder();
    oSB.Append("<html><head></head><body>");
    for (var i:int = 0; i<arrSess.Length; i++)
    {
    oSB.AppendFormat("<h1>SESSION #{0}</h1><pre>{1}</pre><br /><br /><h2>Client Writes to Fiddler</h2><pre>{2}</pre><br /><h2>Fiddler Reads from Server</h2><pre>{3}</pre>",
    arrSess[i].id, Utilities.HtmlEncode(arrSess[i].fullUrl),
    arrSess[i].Timers.ClientReads.ToString(),
    arrSess[i].Timers.ServerReads.ToString());
     }
    oSB.Append("</body></html>");
    return oSB.ToString();
    }

    You can try the latest v2 build here: http://bayden.com/dl/fiddler2alphasetup.exe

    Regards,

    Eric Lawrence
    Telerik
     

    Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

     
  5. Henning
    Henning avatar
    4 posts
    Member since:
    Sep 2014

    Posted 26 Sep 2014 in reply to Eric Lawrence Link to this post

    Hello, Eric,
    1. I restarted Fiddler after every try.

    2. I use Windows 7 64 Bit. Maybe the screenshot gave the wrong impression as I prefer the Windows classical design. If nothing else helps I'll give HTML a try. I just noticed at another PC that changing the font under Tools > Fiddler Options > Appearance causes the change in, e.g, the "Statistics" tab. Perhaps I could reset my Fiddler-Settings. Where are they stored?

    3. The timestamp format – I tried this:
    sResult = (oS.Timers.ServerDoneResponse - oS.Timers.ServerGotRequest).ToString("hh\:mm\:ss\\" + System.Globalization.CultureInfo.CurrentCulture.NumberFormat.NumberDecimalSeparator + "fff" );
    It compiled, but the column remains empty now.
    In Powershell this worked:
    $timediff.ToString("hh\:mm\:ss\"+ [System.Globalization.CultureInfo]::CurrentCulture.numberformat.NumberDecimalSeparator + "fff")
    It gave 00:31:02,359

    Thank you very much for the prompt answers and help as well as for the great program!

    Regards, Henning
  6. Henning
    Henning avatar
    4 posts
    Member since:
    Sep 2014

    Posted 28 Sep 2014 in reply to Henning Link to this post

    1. I tried the version you mentioned  (v2.4.9.5 beta) and the alignment of the columns is excactly what I was looking for.
    2. The monospaced font on the "Statistics" tab: I kind of solved it for me by deleting the entriy under HKEY_CURRENT_USER\Software\Microsoft\Fiddler2\Prefs\.default for font.face. Font.size makes no problem. And I could find the very moment when the font in the "Statisics" (and raw and auth inspectors and in my custom tab) changes: It happens when I change the font in the options.
    3. Format of TimeSpan and DateTime values: I think TimeSpan values that web developers are interested in are in the range from zero to several seconds - maybe some 100 seconds. Those values could be shown as milliseconds and a disputable Number of decimal places (2 or 3, I think). With NumberDecimalSeparators milliseconds should be easy to read (formatstring "N2" or "N3").
    If one prefers a format like 00:00:33.5462749 one would need the System.Globalization.CultureInfo.CurrentCulture.NumberFormat.NumberDecimalSeparator to reach perfection, I'm afraid.
    4. The column RequestBodySize: Is right-aligned like all numeric colums. Solved like 1.
    5. Solved with v2.4.9.5 beta

    As I saw, v2.4.9.5 beta was built on Sept. 18th. So you must have known what I want before I knew it by myself! That is faster than fast.

    A last question: Is it on purpose that the HexView inspector uses another monospaced font (Courier, I think) than the "Statistics" and other tabs? In fact this question is another wish: I would prefer the same font here or even have the monospaced font customizable (is that an english word?). Perhaps that would mean more than one font selector in the Fiddler Options>Appearance ...   It's just to give you an idea if you don't know what to do for the next version(s) ;).

    That it for the moment. Thank you again for your work – and we get it for free!

    Regards, Henning
  7. Eric Lawrence
    Admin
    Eric Lawrence avatar
    833 posts

    Posted 30 Sep 2014 Link to this post

    Hello, Henning--

    There's no real reason that the HexView uses Courier rather than Lucida Console (I think the HexView was built before Lucida Console was popular/available).

    In the next build, you can set fiddler.ui.fixedfont.face to the name of the desired font.

    Regards,
    Eric Lawrence
    Telerik
     

    Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

     
Back to Top