[ProgClub programming] numformat.php

Jevan Pipitone discussion-email-lists at jevan.com.au
Sun Jun 2 16:36:36 AEST 2019


You could use printf to right justify a number.

echo printf("%20f",number_format( floatval( $trimmed ), $dec_points ));

I haven't actually tried it, let me know if it works. The idea is that 
each number would be made to take up 20 columns with spaces added to the 
left to fill in where necessary.


(assuming the C printf is similar to the php printf)


On Sun. 02-Jun.-19 12:56 pm, John Elliot V | ProgClub wrote:
> So I was trying to read some ZFS debugging info from:
>   /proc/spl/kstat/zfs/arcstats
> which looked something like this:
>   13 1 0x01 96 4608 22091036583 580294752449707
>   name                            type data
>   hits                            4    2244288547
>   misses                          4    72988333
>   demand_data_hits                4    35769925
>   demand_data_misses              4    3439818
>   demand_metadata_hits            4    2188909634
>   demand_metadata_misses          4    59434568
> and I was having trouble gauging the order of magnitude of the numbers
> so I wrote numformat.php:
>   https://svn.jj5.net/jjrepo/jj5-bin/branches/0.2/bin/numformat.php
> which formats numerical content like this:
>   root at orac:/home/jj5# numformat.php < /proc/spl/kstat/zfs/arcstats
>   13 1 0x01 96 4,608 22,091,036,583 580,436,679,049,214
>   name                            type data
>   hits                            4    2,244,304,800
>   misses                          4    72,989,311
>   demand_data_hits                4    35,770,479
>   demand_data_misses              4    3,439,818
>   demand_metadata_hits            4    2,188,925,033
>   demand_metadata_misses          4    59,434,568
> It would be nice if I could right-align numbers too, but I'm not that
> clever... :)
> May the Force be with you,
> John Elliot V
> _______________________________________________
> ProgClub programming
> programming at progclub.org
> https://www.progclub.org/cgi-bin/mailman/listinfo/programming
> https://www.progclub.org/

Volunteer Work Only (but you can make money)
MIT SE (UC), GradDip IT (UC), BSc (ANU),
GradCert Rsch Methods & Des (UC)

I am here for online friends, hobbies, volunteer work, and working on 
business ideas, and I am on Centrelink Disability Support Pension 
(Schizophrenia & Aspergers). I suspect that what will probably work is 
people who are on a Centrelink payment such as unemployed, disability, 
or retired, since they can benefit from me and since it allows me to 
give back to Centrelink, and also, if female friends then age 49+ and 
less attractive so that they will find me attractive, also probably 
overweight since I am overweight. However I can also work with highly 
skilled people since I can make use of what I get from them that is 
useful for me to be able to work with interesting concepts. Me: 
Computing Researcher, Self Employed, Innovation, Management, Canberra 
Australia. Interests: Especially things involving the use of a computer. 
Creating, Doing, Improvising, Analysing for Improvement: Computer 
Programming Open Source including C#/VB.NET, CSS, HTML, Javascript, MS 
Visual Studio, My/MS Sql, PHP, WinForms, WPF. 3d animation, Acting 
Improvisations, Audio Podcasts, Business & Startups, Chat, Creative 
Writing & Poetry, Creativity, Dancing, Debating, Decisions, Digital Art, 
Discussion of Topics, Electronic Music Composition/Creation (FL Studio), 
Engineering, Friends, Ideas, Information Analysis, Innovation, IT 
Tuition, Jazz Piano, Jazz Singing Male Baritone & Choir & Karaoke, 
Management, PC Support, Photography, Public Speaking, Reading online 
science magazines and emails, Research, Science, Making YouTube Videos. 
Friendship with adults via phone, Email, Online Chat, anything we can 
make and send each other and collaborate on. Note: For our interactions, 
collaborations, hobbies, volunteer work, etc to turn out successful, it 
may be necessary for there to be a financial cost to me in order for you 
or your organization to make it work, so let me know what you suggest.

Web: http://www.jevan.com.au/
Email: email5 at jevan.com.au <mailto:email5 at jevan.com.au>
Tel: (02) 6152 8010 (or +61 2 6152 8010)
LinkedIn: http://www.linkedin.com/in/jevanpipitone
Facebook: http://www.facebook.com/jevanpipitone
GitHub: http://www.github.com/jevanpipitone
Twitter: http://www.twitter.com/jevanpipitone
Canberra, Australia

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.progclub.org/pipermail/programming/attachments/20190602/3f8f7c8b/attachment-0001.html>

More information about the programming mailing list