Posts

Showing posts with the label User Interface

Asynchronously Updating A Bootstrap Progress Bar With JQuery's $.ajax

Answer : aren't you dividing by zero here when host = 0 in the for loop? updateProgress(100/host); you can use a variable hosts to keep track of the number of hosts you have.Then the progress will be as below. var hosts = 23;// total number of hosts updateProgress((host/hosts)*100); The other thing is the ajax you're firing is asynchronous, so what's happening is it fires and doesn't wait for the results. You can either "scan" each host serially one at a time updating the progress bar or scan all of them simultaneously having the progress bar update as the asynch results come back. Can you specify which behavior you're trying to achieve? [UPDATE] toggle async flag in the ajax call below for what you want. function updateProgress(percentage){ if(percentage > 100) percentage = 100; $('#progressBar').css('width', percentage+'%'); $('#progressBar').html(percentage+'%'); } var hosts = 23; va...

Change The Font Size Of Visual Studio Solution Explorer

Answer : Go to Tools->Options->Environment->Fonts and Colors In "Show Settings for" chose "Environment Font" In "Font" replace Automatic to for example, Arial and change size. Change the font size of that setting, all Font size in the Explorers (Solution Explorer, Server Explorer and Toolbox) and menus will change. You can set that in Tools, Options.

Chart.js Doughnut With Rounded Edges And Text Centered

Image
Answer : With v2.1.3, you can use the pluginService to do this Preview Script // round corners Chart.pluginService.register({ afterUpdate: function (chart) { if (chart.config.options.elements.arc.roundedCornersFor !== undefined) { var arc = chart.getDatasetMeta(0).data[chart.config.options.elements.arc.roundedCornersFor]; arc.round = { x: (chart.chartArea.left + chart.chartArea.right) / 2, y: (chart.chartArea.top + chart.chartArea.bottom) / 2, radius: (chart.outerRadius + chart.innerRadius) / 2, thickness: (chart.outerRadius - chart.innerRadius) / 2 - 1, backgroundColor: arc._model.backgroundColor } } }, afterDraw: function (chart) { if (chart.config.options.elements.arc.roundedCornersFor !== undefined) { var ctx = chart.chart.ctx; var arc = chart.getDatasetMeta(0).data[chart.config.options.eleme...

Android M Light And Dark Status Bar Programmatically - How To Make It Dark Again?

Answer : The solution posted by @Aracem is valid but, doesn't work if you try change also the background color of the status bar. In my case I do it in the following way. To enable windowLightStatusBar(programatically,inside a Utils class for example): public static void setLightStatusBar(View view,Activity activity){ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) { int flags = view.getSystemUiVisibility(); flags |= View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR; view.setSystemUiVisibility(flags); activity.getWindow().setStatusBarColor(Color.WHITE); } } To restore to StatusBar to the previous state: public static void clearLightStatusBar(Activity activity) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) { Window window = activity.getWindow(); window.setStatusBarColor(ContextCompat .getColor(activity,R.color.colorPrimaryDa...

Change Font Size Without Messing With Tkinter Button Size

Answer : Typically, when you give a button a width, that width is measured in characters (ie: width=1 means the width of one average sized character). However, if the button has an image then the width specifies a size in pixels.   A button can contain both an image and text, so one strategy is to put a 1x1 pixel as an image so that you can specify the button size in pixels. When you do that and you change the font size, the button will not grow since it was given an absolute size. Here is an example that illustrates the technique. Run the code, then click on "bigger" or "smaller" to see that the text changes size but the button does not. import Tkinter as tk import tkFont def bigger(): size = font.cget("size") font.configure(size=size+2) def smaller(): size = font.cget("size") size = max(2, size-2) font.configure(size=size) root = tk.Tk() font = tkFont.Font(family="Helvetica", size=12) toolbar = tk.Fra...