Posts

Showing posts from August, 2002

Border Length Percentage Css Code Example

Example 1: css border length . page - title : after { content : "" ; /* This is necessary for the pseudo element to work. */ display : block ; /* This will put the pseudo element on its own line. */ margin : 0 auto ; /* This will center the border. */ width : 50 % ; /* Change this to whatever width you want. */ padding - top : 20 px ; /* This creates some space between the element and the border. */ border - bottom : 1 px solid black ; /* This creates the border. Replace black with whatever color you want. */ } Example 2: how to set border length in css without div div { width : 200 px ; height : 50 px ; position : relative ; z - index : 1 ; background : #eee ; } div : before { content : "" ; position : absolute ; left : 0 ; bottom : 0 ; height : 1 px ; width : 50 % ; /* or 100px */ border - bottom : 1 px solid magenta ; }

Change Color Of Volume Columns (High/Low) In HighCharts

Answer : At first, you need to set series.turboThreshold to 0 if you have a big amount of points. This will disable the input data format check. Then, to apply column colors depending on candles, I suggest you this piece of code: Highcharts.seriesTypes.column.prototype.pointAttribs = (function(func) { return function(point, state) { var attribs = func.apply(this, arguments); var candleSeries = this.chart.series[0]; // Probably you'll need to change the index var candlePoint = candleSeries.points.filter(function(p) { return p.index == point.index; })[0]; var color = (candlePoint.open < candlePoint.close) ? '#FF0000' : '#000000'; // Replace with your colors attribs.fill = state == 'hover' ? Highcharts.Color(color).brighten(0.3).get() : color; return attribs; }; }(Highcharts.seriesTypes.column.prototype.pointAttribs)); Be careful as this code will affect ALL of your charts that currentl

Bypassing Bell Canada's Router Provided With Their FIBE Service

Answer : Not sure if the question is still relevant, but still wanted to share the result of my investigation.. I just switched from a Cable ISP to Bell Fibe, for both TV and Internet. Bell still don't have Fibre to home in my area, so is is still somewhat a DSL type connection. Bell provided a HUB2000 integrated modem/router. the device is very user friendly, but all advanced network features are blocked.... as expected. I had my entire network already set up as with my previous internet provider (Videotron only provided a cable modem) and i wanted to maintain the same configuration (firewall, IPs, etc).. So this is what I have done: TV receiver is connected via a network cable to the HUB2000 LAN port (as per the original Bell set up) HUB 2000 is connected to the phone line to act as a DSL modem (as per the original set up) WAN port of my MikroTik router is connected to one of the LAN ports of the HUB 2000. Now here is the trick, in my Mikrotik WAN configuration, in

Can't Boot Into Ubuntu In Windows 10 / Ubuntu Dual Boot

Image
Answer : Disable the hibernation mode and Fast Boot in Windows. Open command prompt as administrator and execute : powercfg /h off Open the legacy version of the Windows Control Panel (not the modern version). Select Energy Settings , enable show hidden settings and uncheck Fast Boot. After having done this - shutdown the computer completely - do NOT reboot. Boot into the BIOS and select Ubuntu as the default operating system to boot. Update : In case there is no Ubuntu entry to be found in the BIOS / UEFI settings, re-install the GRUB boot loader to your Ubuntu installation in EFI mode. Boot from the Ubuntu installation media - open a terminal and execute: sudo mount /dev/sdXXX /mnt sudo mount /dev/sdXX /mnt/boot/efi for i in /dev /dev/pts /proc /sys /run; do sudo mount -B $i /mnt$i; done sudo chroot /mnt grub-install /dev/sdX update-grub Note: sdX = disk | sdXX = efi partition | sdXXX = system partition To identify the partition numbers use G

Box Shadow Tailwind Css Code Example

Example 1: tailwind box shadow < div class = " shadow-sm ... " > </ div > < div class = " shadow ... " > </ div > < div class = " shadow-md ... " > </ div > < div class = " shadow-lg ... " > </ div > < div class = " shadow-xl ... " > </ div > < div class = " shadow-2xl ... " > </ div > Example 2: tailwind bottom shadow <! DOCTYPE html > < html > < head > < title > Box Shadow </ title > < style type = " text/css " > .box { height : 150 px ; width : 300 px ; margin : 20 px ; border : 1 px solid #ccc ; } .top { box-shadow : 0 -5 px 5 px -5 px #333 ; } .right { box-shadow : -5 px 0 5 px -5 px #333 ; } .bottom { box-shadow : 0 5 px 5 px -5 px #333 ; } .left

Apple - Can I Manually Limit The %CPU Used By A Process?

Answer : cputhrottle is the tool you need. You can install it with Homebrew. You can monitor a series of processes by name by running the Bash script below. I'm not quite sure how to turn this into a login item since cputhrottle requires superuser permissions. Run it as a script, in an Automator workflow, whatever: # Get the Process/App names from Activity Monitor and put them here apps=("AppOne" "AppTwo" "AppThree") # Set the respective limits here limits={30 40 50) while true; do for app in ${apps}; do for limit in ${limits}; do for pid in $(pgrep ${app}); do sudo /path/to/cputhrottle ${pid} ${limit} done done done done [Edited] I've added a different version for this script (a bash script), which might be useful for people looking for limiting the CPU for multiple applications. This new script also allows you to specify a list containing the application name and the CPU limit for it. The main di

Can I Search In The Terminal Backlog In Terminator

Answer : Terminator has a built-in search (ctrl-shift-f is the default keybinding), but it doesn't highlight the found text, which makes it fairly useless. There's a bug open against terminator to fix this, but right now it's still unresolved: https://bugs.launchpad.net/ubuntu/+source/terminator/+bug/271487 This actually has been resolved for terminator 2.1 , yes good things do happen in 2020. However it's not on the repo yet, but you can clone the github terminator repo And follow the steps form install guide Basically it will take you to git clone git@github.com:gnome-terminator/terminator.git sudo apt-get install python3-gi python3-gi-cairo python3-psutil python3-configobj \ gir1.2-keybinder-3.0 gir1.2-vte-2.91 gettext intltool dbus-x11 # In the folder where you've cloned the repo python3 setup.py build python3 setup.py install --single-version-externally-managed --record=install-files.txt you should be able to spawn a terminal from

Best Way To Document Array Options In PHPDoc?

Image
Answer : A bit too late to the party but this is how I do it instead: /** * Class constructor. * * @param array $params Array containing the necessary params. * $params = [ * 'hostname' => (string) DB hostname. Required. * 'databaseName' => (string) DB name. Required. * 'username' => (string) DB username. Required. * 'password' => (string) DB password. Required. * 'port' => (int) DB port. Default: 1433. * 'sublevel' => [ * 'key' => (\stdClass) Value description. * ] * ] */ public function __construct(array $params){} Think it's quite clean and easy to understand what $params should be. I wrote a plugin for phpstorm that allows specifying keys like this: (basically just a slightly stricter version of @siannone's format) /** * @param array $arr = [ * 'fields' => [ // Defines the feilds t

Android > Chrome Chromecast Icon Over Html5 Video Position

Answer : There is another options to disable casting button, this option actually disables the button instead of hiding it. <video disableRemotePlayback src="..."> https://developer.mozilla.org/en-US/docs/Web/API/HTMLMediaElement/disableRemotePlayback https://developers.google.com/web/updates/2015/11/presentation-api After searching the Chromium source code, I figured out how to do it: video::-internal-media-controls-overlay-cast-button { display: none; } Example: http://jsfiddle.net/f1quhd2L/8/

Avoid Division By Zero In PostgreSQL

Answer : You can use NULLIF function e.g. something/NULLIF(column_name,0) If the value of column_name is 0 - result of entire expression will be NULL Since count() never returns NULL (unlike other aggregate functions), you only have to catch the 0 case (which is the only problematic case anyway): CASE count(column_name) WHEN 0 THEN 1 ELSE count(column_name) END Quoting the manual about aggregate functions: It should be noted that except for count , these functions return a null value when no rows are selected. I realize this is an old question, but another solution would be to make use of the greatest function: greatest( count(column_name), 1 ) -- NULL and 0 are valid argument values Note: My preference would be to either return a NULL, as in Erwin and Yuriy's answer, or to solve this logically by detecting the value is 0 before the division operation, and returning 0 . Otherwise, the data may be misrepresented by using 1 .

Color Gradients Generator Code Example

Example: css gradient generator /*CSS Gradient Generator*/ https : //cssgradient.io/ /*Example*/ .My-Class { background : linear-gradient ( to right , blue /*Color1*/ , dodgerblue /*Color1*/ ) ; }

Aws Cloudtrail Vs Cloudwatch Code Example

Example: cloudwatch vs cloudtrail CloudWatch focuses on the activity of AWS services and resources, reporting on their health and performance. On the other hand, CloudTrail is a log of all actions that have taken place inside your AWS environment.

Square In C Programming Code Example

Example 1: square in c # include <stdio.h> int main ( ) { float number ; printf ( "Enter a number: " ) ; scanf ( "%f" , & number ) ; square = number * number ; printf ( "square of the given number %f is %f" , number , square ) ; return 0 ; } Example 2: square in c # include <math.h> int main ( ) { float number ; square = pow ( number , 2 ) ; //This returns number raised to the power 2 printf ( "The square of %f is %f" , number , square ) ; return 0 ; }

Bootstrap: How Do I Identify The Bootstrap Version?

Answer : In the top of the bootstrap.css you should have comments like the below: /*! * Bootstrap v2.3.1 * * Copyright 2012 Twitter, Inc * Licensed under the Apache License v2.0 * http://www.apache.org/licenses/LICENSE-2.0 * * Designed and built with all the love in the world @twitter by @mdo and @fat. */ If they are not there, then they have probably been deleted. VERSIONS: You can review version history here. Backward compatibility shouldn't be broken if the source is v2.0.0 (Jan 2012) and above. If it is prior to v2.0.0 there are details on upgrading here. You can also check the bootstrap version via the javascript console in the browser: $.fn.tooltip.Constructor.VERSION // => "3.3.7" Credit: https://stackoverflow.com/a/43233731/1608226 Posting this here because I always come across this question when I forget to include JavaScript in the search and wind up on this question instead of the one above. If this helps you, be sure to upvote that a

Selection Sort In C With User Input Code Example

Example: Selection sort in c with console input with assending order # include <stdio.h> int main ( ) { /* Here i & j for loop counters, temp for swapping, * count for total number of elements, number[] to * store the input numbers in array. You can increase * or decrease the size of number array as per requirement */ int i , j , count , temp , number [ 25 ] ; printf ( "How many numbers u are going to enter?: " ) ; scanf ( "%d" , & count ) ; printf ( "Enter %d elements: " , count ) ; // Loop to get the elements stored in array for ( i = 0 ; i < count ; i ++ ) scanf ( "%d" , & number [ i ] ) ; // Logic of selection sort algorithm for ( i = 0 ; i < count ; i ++ ) { for ( j = i + 1 ; j < count ; j ++ ) { if ( number [ i ] > number [ j ] ) { temp = number [ i ] ; number [ i ] = number [ j ] ;

Center Image React Native Loading Screen

Answer : You need to set the style of <View> for justifyContent and alignItems for centering the `. Should be like this : const LoadingScreen = () => ( <View style={styles.container}> <Image style={styles.logo} source={logo} /> </View> ); const styles = StyleSheet.create({ container: { justifyContent: 'center', alignItems: 'center', }, logo: { width: 300, height: 400, }, }); Or you can use alignSelf on the <Image> to make it center, but it will still need to add justifyContent on <View> to make it center vertically. The View container should have styling as flexDirection: 'column' justifyContent: 'center' alignItems: 'center' height: '100%' The height makes sure it spans throughout the page, thus making the image become both vertically and horizontally aligned. For the image size, I think using percentage will do the trick instead

Can't Zoom Out In Visual Studio Code

Answer : On-Screen keyboard did not work for me. But managed to click the reset zoom setting under View>Appearance>Reset Zoom. Zoom Out option was not working. However, Zoom was reset after clicking Reset Zoom option. Found the solution by opening the on-screen keyboard, activating the numeric pad, and using its - . The - is not working on my laptop. On my installation the keyboard shortcuts are working as stated in documentation ( CTRL + - ). For a workaround you can perhaps use the menu items under View > Zoom Out as also written in documentation in Chapter Zoom.