How to reduce the vertical white space between ipython notebook cells? - customization

I teach a class using ipython/jupyter notebook on a pubic computer. When the notebook is projected, the text is too small for the students to read. I can increase the font size by pressing Ctrl+ a few times, but then not enough cells fit on the screen.
Is there any way to decrease the white space between ipython notebook cells. Is there a solution that changes just the one notebook, like this one for widening the cell width:
from IPython.core.display import display, HTML
display(HTML("<style>.container { width:100% !important; }</style>"))
I don't want to change any customization files, since the machine will be wiped when I logged out.

Not exactly what you asked for, but jupyther themes allows easily switching between whole themes, as well as changing font sizes and line heights with a simple switch at the command line, e.g.
jt -t grade3 -T -f roboto -fs 14 -lineh 120
This increases font size to 14 points and reduces line height to 120%, while (I think) keeping vertical separation among cells constant.
Of course, if the machine is wiped at logout you would need to reinstall the package at login :\

Related

Full width bars in Chart.js version 2.7.2

I am using Chart.js version 2.7.2 to create a simple, single series bar chart. I want every bar in the chart to fill all available space such that each bar in the chart "touches" its neighbor(s).
My research has indicated that I should be using the barPercentage and categoryPercentage settings, setting both to 1. I've done this and it makes the bars very wide, but it leaves a single pixel gap between them.
My initial assumption is that this was due to a grid line, but even if I turn off grid lines (gridLines.display: false) it still has the one-pixel gap.
JsFiddle
Here is a screenshot. See the gap between each bar? How do I get rid of that?
You will have to update to 2.8+ version of the library.
There were multiple instances of issues around this on their GitHub (i.e. [BUG] Spacing between vertical bars with percentages set to 1 and [BUG] Small gap between bars even with barPercentage and categoryPercentage set to 1).
There was a PR that made it into their 2.8.0 version that is supposed to fix the issues around this (as noted by #benmccann at the bottom of the PR page).

Amcharts : small (sometimes 0px) chart height on page load (in default tab)

I have an Amcharts in a tab but when it is created on page load, it is compressed with an incorrect (too small and sometimes to 0px) height. When I switch tab and come back to the chart tab, then I can clearly see that it is resized and looks perfectly after some visible height changes.
I have seen a bunch of similar topics, but they all complain about the chart having a small size only when arriving on a tab and not on page load directly.
I have tried to call invalidateSize(), validateNow(), etc. after the chart is built on page load (even with a timeout) but it doesn't do the job.
Is it because of the container that wouldn't give enough info to Amcharts to process the correct size? How come Amcharts is able to recalculate the size of the charts when changing the tab and back to the chart one?
Would you please have any hints for me? Thank you very much
I use Bootstrap tabs system.
I have finally solved it by setting a fixed height
.amcharts-chart-div{
height: 436px !important;
}

is it possible to position letter x in center of console, drop at 100pixels/second, and raise 50pixels on click?

This is essentially the rudimentary version of the motion in jetpack joyride but instead of the joyrider falling at 100pixels per second, it would be the letter "x" falling at 100pixels per second from the exact middle of the console and a click event would cause it to rise at 50 pixels per second. I am really new at this so if this isn't possible in c++ please let me know. Thanks.
EDIT: I am using sublime text to write my code, and the MinGW compiler.
No. Characters on the console can only appear on the character grid; you can't move them around to pixel-exact coordinates.
For what it's worth, this would be trivial to do in a web browser.

What size of ImageList icons do I need to make & load for my app (considering higher DPI)?

I have a CListCtrl control (or a ListView in Win32) that is created with LVS_REPORT style.
I am intending to display icons in its items as such:
But the question is what size of icons do I need to make and load?
Let me explain. From the old Win32 samples, I can see that everyone creates image lists with 15x15 pixel icons. But the issue with those is that it looks horribly pixelated on any modern PC with higher DPI settings. Thus I was looking for a dynamic way to determine the appropriate size of image lists for the CListCtrl.
And also the first part of the question, what icon size should I make originally?
EDIT
PS: Since DPI scaling came up, how do you find it out? I'm currently using the following approach:
//No error handling for brevity
HDC hDC = ::GetDC(hAppsMainWindowHandle);
int nCx = ::GetDeviceCaps(hDC, LOGPIXELSX);
int nCy = ::GetDeviceCaps(hDC, LOGPIXELSY);
::ReleaseDC(hAppsMainWindowHandle, hDC);
//I technically get horizontal & vertical scaling --
//can those be different?
double scalingCx = (double)nCx / 96.0; //1.0 = 100%
double scalingCy = (double)nCy / 96.0;
Is font scaling something different?
A list view uses a "small" or "large" image list depending on its mode. In report mode, it uses the "small" image list. You can use GetSystemMetrics() to get the dimensions of "small" images using the SM_CXSMICON and SM_CYSMICON metrics (use SM_CXICON and SM_CYICON for "large" images).
Note that the returned values will be virtual/scaled if your app is not DPI-aware, so to get accurate values, make sure it is DPI-aware via SetProcessDPIAware(), SetProcessDpiAwareness(), or a DPI manifest.
Update: I just ran across this function, might be useful for you when writing a DPI-aware app:
LoadIconWithScaleDown()
Make larger images and let the API scale them down to smaller sizes.
The report style list view wants small icons, that is icons with SM_CXSMICON by SM_CYSMICON metrics. Assuming your app is high DPI aware, then the actual value of these metrics depends on the user's chosen font scaling or DPI setting. So up front you cannot know what size icons should be used. You have to query the system metrics at runtime, and use appropriately sized icons.
Now, what size icons you include in your executable depend on what DPI settings you wish to support. Back in XP days you could reasonably expect to encounter 100% and 125% font scaling. These days, high density display panels are common and you really need to support larger ratios. At least 150% and 200%, and quite probably 175%.
The closest I can find to guidelines is in this MSDN article: http://msdn.microsoft.com/en-US/library/windows/desktop/dn742485.aspx
This article was written around the Vista time frame and already shows its age. I think you have to use these articles as a guide and adapt to the hardware of the day.
You will also find that people run their machines at font scaling values in between the round numbers listed above, and in the article I link to. One of my colleagues runs at 120%. Interestingly this has highlighted various bugs in our code so it's always useful to have someone dog-fooding your program.
When you build your image lists at runtime, size them according to system metrics. And try to avoid scaling icons. For instance, if system metrics suggest an 18px icons, and you only have 16px and 20px icons, then make a new 18px icons. Fill the image with transparent pixels, and blit the 16px icon into the middle of this 18px image. Make the icon out of that. This approach will avoid aliasing problems.

2 actionbar tabs don't fill a screen width on FULLHD (xxhdpi) Android device

I have required styles (from designer) applied on my TABs used in Actionbar for navigation and I use Actionbar Sherlock. They look perfectly from ldpi to xhdpi devices, but situation changes on xxhdpi devices.
I have only 2tabs and except mentioned styling, I have the same code as Sherlock DEMO app in "Tab Navigation". I found 2 older simmilar questions not answered yet.
Stacked ActionBar tab bar not filling parent
(I've got a simmilar problem, centered tabs. Sorry for inconvenience, I can't attach images because of rep points.)
and
action bar tabs not fill screen in android
Since the time of their posts, this is not only the issue of tablets, but now, there are many FULLHD (flagship) smartphones and this is becomming the big "design" issue.
I want my 2tabs to fill/match the full width of ANY device size, so in my case to fill 50% width each. Default Holo styled tabs doesn't look that bad (as shown in previous link), but my styled tabs on this big screen look much worse.
PS: Situation doesn't change if I make a text in tabs bigger or longer. Tabs don't adujst their width, instead they change their height and text takes 2 lines.
Unfortunatelly, this is a another JB changes:
https://android.googlesource.com/platform/frameworks/base/+/b8139af3dcae80c0030afd0354dc424a7c72c3d9
One of solution: set target SDK 15 or lower.