Posts

Showing posts from December, 2013

Online C++ Ide Gfg Code Example

Example: cpp online compiler Best Site With auto compile : https : //godbolt.org/z/nEo4j7

Android Studio: Server's Certificate Is Not Trusted

Answer : Android Studio has a configuration for Server Certificates (This works for other IntelliJ platforms like PyCharm as well) Go to File->Settings . In the IDE Settings section select Server Certificates Myself I just selected the Accept Automatically check box, hit Apply and never had to deal with it. If you are worried about security, there is also the option to add them 1 at a time as they come up. In my case I did this because I already had a *.google.com certificate configured as accepted, but I still got the popup. I suspect that the fingerprint changed and if I would have deleted and then accepted the error would have gone away, but I decided to just make it go away by selecting the check box. It is not safe to ignore that warning. Someone could be attempting a man-in-the-middle attack with a fake certificate in order to install malicious software on your computer through the update process. This probably isn't happening but it's always better to do

Center Plot Title In Ggplot2

Image
Answer : From the release news of ggplot 2.2.0 : "The main plot title is now left-aligned to better work better with a subtitle". See also the plot.title argument in ?theme : "left-aligned by default". As pointed out by @J_F, you may add theme(plot.title = element_text(hjust = 0.5)) to center the title. ggplot() + ggtitle("Default in 2.2.0 is left-aligned") ggplot() + ggtitle("Use theme(plot.title = element_text(hjust = 0.5)) to center") + theme(plot.title = element_text(hjust = 0.5)) As stated in the answer by Henrik, titles are left-aligned by default starting with ggplot 2.2.0. Titles can be centered by adding this to the plot: theme(plot.title = element_text(hjust = 0.5)) However, if you create many plots, it may be tedious to add this line everywhere. One could then also change the default behaviour of ggplot with theme_update(plot.title = element_text(hjust = 0.5)) Once you have run this line, all plots created

Code Camp Free Code Example

Example 1: free code camp they are awesome if you are new to development ! Example 2: free code camp freeCodeCamp is a non-profit organization that consists of an interactive learning web platform, an online community forum, chat rooms, online publications and local organizations that intend to make learning web development accessible to anyone. Example 3: free code camp printt("python") Example 4: code camp // Main function fn main(){ let arr:[i32;4] = [1,2,3,4]; println!("array size is {}",arr.len()); }

C Format Specifiers List Code Example

Example 1: format specifier fro float in printf printf ( "%0k.yf" float_variable_name ) Here k is the total number of characters you want to get printed. k = x + 1 + y ( + 1 for the dot ) and float_variable_name is the float variable that you want to get printed. Suppose you want to print x digits before the decimal point and y digits after it. Now, if the number of digits before float_variable_name is less than x, then it will automatically prepend that many zeroes before it. Example 2: what are format specifiers it is used during taking input and out put Int ( "%d" ) : Long ( "%ld" ) : Char ( "%c" ) : Float ( "%f" ) : Double ( "%lf" ) example: char ch = 'd' ; double d = 234.432 ; printf ( "%c %lf" , ch, d ) ; char ch ; double d ; scanf ( "%c %lf" , & ch, & d ) ; Example 3: double data type format in c %lf you can try Example 4: printf format specifiers c

-bash: Sequelize: Command Not Found

Answer : The reason is: sequelize is not installed globally on your cli. To get sequelize access to all your cli just do. npm install -g sequelize-cli The '-g' means global this will allow you to access sequelize command anywhere in your app directory. After that you can do eg: sequelize model:generate --name User --attributes firstName:string,lastName:string,email:string,password:string Had the same issue, then noted that sequelize-cli is the way to go ahead. npm install -g sequelize-cli I would like to answer my own question. The global npm install path was wrong for my computer. npm config get prefix Then I ran to put the path where it should be. This problem gave me a lot of head aches. Hope it helps someone. npm config set prefix /usr/local

Code Coverage Istanbul Js Code Example

Example: istanbul coverage Istanbul is a JavaScript test coverage tool. It can track how well your unit-tests exercise your codebase.

LINUX LIST PROCESSES Code Example

Example 1: show all processes linux ps - aux | less Example 2: check running process in linux ps - aux # ( print all processes owned by a user named "x" ) Example 3: how to list running processes in linux ps - ef OR ps - ef | grep < process - to - filter > e . g ps - ef | grep node Example 4: command running processes linux ps - u [ username ]

AWS CloudFront Access Denied To S3 Bucket

Answer : To assist with your question, I recreated the situation via: Created an Amazon S3 bucket with no Bucket Policy Uploaded public.jpg and make it public via "Make Public" Uploaded private.jpg and kept it private Created an Amazon CloudFront web distribution : Origin Domain Name: Selected my S3 bucket from the list Restrict Bucket Access: Yes Origin Access Identity: Create a New Identity Grant Read Permissions on Bucket: Yes, Update Bucket Policy I checked the bucket, and CloudFront had added a Bucket Policy similar to yours. The distribution was marked as In Progress for a while. Once it said Enabled , I accessed the files via the xxx.cloudfront.net URL: xxx.cloudfront.net/public.jpg redirected me to the S3 URL http://bucketname.s3.amazonaws.com/public.jpg . Yes, I could see the file, but it should not use a redirect. xxx.cloudfront.net/private.jpg redirected me also, but I then received Access Denied because it is a private file in

Best Random Boolean Generator Java Code Example

Example 1: java random boolean import java . util . Random ; public class Example { public static void main ( String [ ] args ) { Random rd = new Random ( ) ; // creating Random object System . out . println ( rd . nextBoolean ( ) ) ; // displaying a random boolean } } Example 2: random boolean java return Math . random ( ) < 0.5 ;

Conio.h Stands For Code Example

Example: what is conio.h conio . h Is a C header file used mostly by MS - DOS compilers to provide console input / output . It is not part of the C standard library or ISO C , nor it is defined by POSIX . This header declares several useful library functions for performing "console input and output" from a program .

Best Roblox Arsenal Script Code Example

Example: Best Roblox Arsenal Player TanqR (Maybe)

50 Inch To Cm Code Example

Example 1: inch to cm 1 inch = 2.54 cm Example 2: cm to inch 1 cm = 0.3937 inch

Ceramic Capacitors: How To Read 2-digit Markings?

Image
Answer : The brown capacitors have values in picoFarads eg 47 = 47 picoFarad = 47 pF = 0.000 000 000 047 Farad ! 10 = 10 pF For the yellow and green capacitors with markings of the form anb Here n = nanoFarad = nF. 1n0 = 1.0 nF 2n2 = 2.2 nF 6n8 = 6.8 nF Note that the use of xNx here is (probably) unqiue to capacitors in the nF range - I do not recall seeing eg xPx or xUx markings ever. However page 70 of this superbVishay ceramic single layer capacitors document suggests you might expect to meet any of eg p68 = 0.68 pF n15 = 0.15nF = 150 pF 5p0 = 5 pF etc The green dot is quite likely to be a voltage rating, but alas I don't know what system it uses. There are several different colour/voltage systems. Typically this sort of capacitor is 50 Volt rated but this is not certain. More usual nnX 3 digit markings Most capacitor numerical markings are 3 digit and express the value in pF (pico Farad = 10^-12 Farad) with the last digit being a

Bootstrap 4 Display Inline Block Code Example

Example 1: bootstrap display inline block <div class= "d-inline-block" ></div> Example 2: bootstrap display block <div class= "d-block" ></div> d-block = for displaying d-none = to hide Example 3: bootstrap display none <!-- Bootstrap 4 --> <div class= "d-none" ></div> <!-- Bootstrap 3 --> <!-- <div class= "hidden- { screen size } "></div> --> <div class= "hidden-md" ></div> Example 4: is display-block a class <span class= "d-block p-2 bg-primary text-white" >d-block</span> <span class= "d-block p-2 bg-dark text-white" >d-block</span>

Buildozer Failed To Execute The Last Command

Answer : First raise the log level = 2 in buildozer.spec ,then it will show all logs and error clearly. Here in .buildozer/android/platform/python-for-android/dist/myapp/python 2.7 build.py was missing. To fix this issue run this command buildozer android clean and then rebuild it using buildozer android debug or automatically run using buildozer android debug deploy run . Probably you are running an updated version of cython, all major release start form 0.21 and up, you have to downgrade cython to 0.20 ( sudo pip install cython==0.20 ) then removing .buildozer folder ( rm -Rf .buildozer ) and then rebuilding with 'buildozer android debug'

Ceil Php Code Example

Example 1: round up built in function php echo ceil ( 0.5 ) ; //Prints 1 Example 2: php round up //round up to nearest integer echo ( ceil ( 0.60 ) . "<br>" ) ; //result 1 Example 3: floor ceil php echo ( floor ( 0.60 ) . "<br>" ) ; // 0 echo ( floor ( 0.40 ) . "<br>" ) ; // 0 echo ( floor ( 5 ) . "<br>" ) ; // 5 echo ( floor ( 5.1 ) . "<br>" ) ; //5 echo ( floor ( - 5.1 ) . "<br>" ) ; // -6 echo ( floor ( - 5.9 ) ) ; // -6 echo ( ceil ( 0.60 ) . "<br>" ) ; // 1 echo ( ceil ( 0.40 ) . "<br>" ) ; // 1 echo ( ceil ( 5 ) . "<br>" ) ; // 5 echo ( ceil ( 5.1 ) . "<br>" ) ; // 6 echo ( ceil ( - 5.1 ) . "<br>" ) ; // -5 echo ( ceil ( - 5.9 ) ) ; // -5 Example 4: php round up <?php echo 'Rounding modes with 9.5' . PHP_EOL ; var_dump ( round ( 9.5

-bash: Export: `=': Not A Valid Identifier

Answer : You cannot put spaces around the = sign when you do: export foo=bar Remove the spaces you have and you should be good to go. If you type: export foo = bar the shell will interpret that as a request to export three names: foo , = and bar . = isn't a valid variable name, so the command fails. The variable name, equals sign and it's value must not be separated by spaces for them to be processed as a simultaneous assignment and export. I faced the same error and did some research to only see that there could be different scenarios to this error. Let me share my findings. Scenario 1: There cannot be spaces beside the = (equals) sign $ export TEMP_ENV = example-value -bash: export: `=': not a valid identifier // this is the answer to the question $ export TEMP_ENV =example-value -bash: export: `=example-value': not a valid identifier $ export TEMP_ENV= example-value -bash: export: `example-value': not a valid identifier Scenario 2: Objec

"Cannot Create Cache Directory /home//.composer/cache/repo/https---packagist.org/, Or Directory Is Not Writable. Proceeding Without Cache"

Answer : if anyone pass through here, this is shorter solution: sudo chown -R $USER $HOME/.composer it seems to me the group information is missing in your command sudo chown -R <user> /home/<user>/.composer/cache/repo/https---packagist.org Shoud be sudo chown -R <user>:<group> /home/<user>/.composer/cache/repo/https---packagist.org But to avoid other permission issues, I would rather advise: sudo chown -R <user>:<group> /home/<user>/.composer/cache (you'll need access to other folders in there) and sudo chown <user>:<group> /home/<user>/.composer To make sure your user has permissions enough on the global composer folder. Mind the missing recursion so the user don't own keys created by root. If you need to find out the group: groups <user>

Accessing Inventory Host Variable In Ansible Playbook

Answer : You are on the right track about hostvars . This magic variable is used to access information about other hosts. hostvars is a hash with inventory hostnames as keys. To access fields of each host, use hostvars['test-1'] , hostvars['test2-1'] , etc. ansible_ssh_host is deprecated in favor of ansible_host since 2.0. So you should first remove "_ssh" from inventory hosts arguments (i.e. to become "ansible_user", "ansible_host", and "ansible_port"), then in your role call it with: {{ hostvars['your_host_group'].ansible_host }} [host_group] host-1 ansible_ssh_host=192.168.0.21 node_name=foo host-2 ansible_ssh_host=192.168.0.22 node_name=bar [host_group:vars] custom_var=asdasdasd You can access host group vars using: {{ hostvars['host_group'].custom_var }} If you need a specific value from specific host, you can use: {{ hostvars[groups['host_group'][0]].node_name }} You should be a

Apple - Can I Lower The Minimum Display Brightness? How?

Image
Answer : My recommendation is a hitherto-little known gem, called ScreenShade. There are several decent Mac software screen dimmers out there, of which I've found the ones whose dimming method is to apply an increasingly opaque black 'overlay' over the screen to be the most superior in appearance (providing much higher quality 'low blacks' than Shades which does its dimming via color profile/gamma level tweaking) and in doing so, also playing nice with famous color temperature regulating app, f.lux. The best examples in this group, are Shady (whose development has been abandoned by its dev and has a no better rogue clone in the Mac App Store), ScreenDimmer, Screen Shade, and Work at Night. (N.b. these last two, confusingly appear to be clones, by the same dev on the Mac App Store.) But if you're looking to more fully emulate the Mac's in-built hardware dimming in software, you're looking for an app that can have the dimming triggered via hotkey