Posts

Showing posts from September, 2001

Math.floor Java Code Example

Example 1: floor in java Math . floor ( value ) ; Example 2: math.floor console . log ( Math . floor ( 5.95 ) ) ; // expected output: 5 console . log ( Math . floor ( 5.05 ) ) ; // expected output: 5 Example 3: math.floor console . log ( Math . floor ( 5.05 ) ) ; // expected output: 5 Example 4: java math.floor The floor of a floating point number is the largest integer that is <= to the number . Example 5: java "->" interface LambdaFunction { void call ( ) ; } class FirstLambda { public static void main ( String [ ] args ) { LambdaFunction lambdaFunction = ( ) -> System . out . println ( "Hello world" ) ; lambdaFunction . call ( ) ; } } Example 6: java "->" Runnable r = ( ) -> System . out . print ( "Run method" ) ; // is equivalent to Runnable r = new Runnable ( ) { @Override public void run ( ) { System . out .

Alter Table Add Column After Another Column Mysql Code Example

Example 1: add column in mysq ALTER TABLE Table_name ADD name_column INT ( 255 ) ; Example 2: mysql alter table add column ALTER TABLE table ADD [ COLUMN ] column_name column_definition [ FIRST | AFTER existing_column ] ;

Accentuate Sentence Code Example

Example: define accentuate // Don't bother

Git Revert All Changes Code Example

Example 1: git discard local changes # Discarding local changes ( permanently ) to a file : git checkout -- < file > # Discard all local changes to all files permanently : git reset -- hard Example 2: git undo all changes git reset -- hard Example 3: how to remove file changes in git git clean - df git checkout -- . Example 4: undo unstaged changes git git checkout -- . Example 5: git reset one file git checkout HEAD -- my - file . txt Example 6: git discard staged changes git reset HEAD git checkout .

Cannot Drop Column : Needed In A Foreign Key Constraint

Answer : Having a look at MySql docs I've found a warning about foreign_key_keys : Warning With foreign_key_checks=0, dropping an index required by a foreign key constraint places the table in an inconsistent state and causes the foreign key check that occurs at table load to fail. To avoid this problem, remove the foreign key constraint before dropping the index (Bug #70260). IMHO you should drop FOREIGN KEY before DROP the COLUMN. ALTER TABLE `user` DROP FOREIGN KEY `FK_G38T6P7EKUXYWH1`; ALTER TABLE `user` DROP COLUMN `region_id`; I've set up a rextester example, check it here.

Bundle Not Working With Rbenv

Answer : Your installation is caught in a loop. Change to a directory that is not your app, and that doesn't have a Gemfile. Then do the usual gem install bundle (and use sudo if you need it) Then change to your app directory, and do the usual bundle install . Does that solve your issue? If you need more help, can run these commands then paste the results in your question? $ command -v ruby $ command -v bundle $ ruby -v $ bundle -v Look for any mismatch between the results and what you expect. This will help you track down what's happening. You may need to update your Gemfile Ruby version. (Also, you may want to consider changing from rbenv to chruby because it's better IMHO with these kinds of path issues) I got: rbenv: bundle: command not found The `bundle' command exists in these Ruby versions: 2.3.0 after upgrade to Ruby 2.3.1 and it's solved by: gem install rails from working folder gem install bundler You need to rein

Python Ascii Colors Code Example

Example 1: ansi colors Black \e [ 0 ; 30 m Blue \e [ 0 ; 34 m Green \e [ 0 ; 32 m Cyan \e [ 0 ; 36 m Red \e [ 0 ; 31 m Purple \e [ 0 ; 35 m Brown \e [ 0 ; 33 m Gray \e [ 0 ; 37 m Dark Gray \e [ 1 ; 30 m Light Blue \e [ 1 ; 34 m Light Green \e [ 1 ; 32 m Light Cyan \e [ 1 ; 36 m Light Red \e [ 1 ; 31 m Light Purple \e [ 1 ; 35 m Yellow \e [ 1 ; 33 m White \e [ 1 ; 37 m Example 2: python ansi escape sequences color collection class colors : reset = "\033[0m" # Black fgBlack = "\033[30m" fgBrightBlack = "\033[30;1m" bgBlack = "\033[40m" bgBrightBlack = "\033[40;1m" # Red fgRed = "\033[31m" fgBrightRed = "\033[31;1m" bgRed = "\033[41m" bgBrightRed = "\033[41;1m" # Green fgGree

Access Denied For User 'root'@'localhost' (using Password: YES) - No Privileges?

Answer : If you have that same problem in MySql 5.7.+ : Access denied for user 'root'@'localhost' it's because MySql 5.7 by default allow to connect with socket, which means you just connect with sudo mysql . If you run sql : SELECT user,authentication_string,plugin,host FROM mysql.user; then you will see it : +------------------+-------------------------------------------+-----------------------+-----------+ | user | authentication_string | plugin | host | +------------------+-------------------------------------------+-----------------------+-----------+ | root | | auth_socket | localhost | | mysql.session | *THISISNOTAVALIDPASSWORDTHATCANBEUSEDHERE | mysql_native_password | localhost | | mysql.sys | *THISISNOTAVALIDPASSWORDTHATCANBEUSEDHERE | mysql_native_password | localhost | | debian-sys-maint | *497C3D7B50479A812B89CD12EC3

Creating An Android Smart App Banner

Answer : Since Chrome 44 Beta you can push your app in Chrome for Android with a native app install banner on your website. Please see the answer below. Old answer I needed that myself, so I created a jquery plugin to mimic a smart banner for Android and older iOS versions. http://jasny.github.com/jquery.smartbanner/#android Since Chrome 44 Beta you can push your app in Chrome for Android with a native app install banner on your website. There are a couple of criteria that need to be met in order to enable it: You will need a web app manifest file You will have to serve your web using https The user has visited your site twice over two separate days during the course of two weeks. Read more about it in the official docs from Google. You add the Google Sign-In button to your page with a special parameter and then users can sign in and specify which device to install your app to directly from your website. This is the most "officially supported" implementation I know of:

Building With Lombok's @Slf4j And Eclipse: Cannot Find Symbol Log

Answer : You also have to install Lombok into Eclipse. See also this answer on how to do that or check if Lombok is installed correctly. Full Disclosure: I am one of the Project Lombok developers. I got the same error even after Lombok was installed. For me the solution was to add another lombok annotation (i used @Data) to my class after which the eclipse errors went away. Perhaps this force refreshed some cache. Of course, I simply deleted the @Data annotation afterwards. I also faced the similar issue on log and @Slf4j on my STS environment. To resolve this, here is what I did on spring tool suite (sts-4.4.0.RELEASE) and lombok-1.18.10.jar (current latest version available in mavenrepository). If having maven project, ensure lombok dependency added to it. Else you need manually add the jar to your project classpath. <!-- https://mvnrepository.com/artifact/org.projectlombok/lombok --> <dependency> <groupId>org.projectlombok</groupId> <artifa

304 Status Code Http Code Example

Example 1: 304 http status code 304 Not Modified The HTTP 304 Not Modified client redirection response code indicates that there is no need to retransmit the requested resources . It is an implicit redirection to a cached resource . This happens when the request method is safe , like a GET or a HEAD request , or when the request is conditional and uses a If - None - Match or a If - Modified - Since header . The equivalent 200 OK response would have included the headers Cache - Control , Content - Location , Date , ETag , Expires , and Vary . Example 2: 304 error code 304 Not Modified is an HTTP status code that is returned to the client when the cached copy of a particular file is up to date with the server . When a client such as a browser stores something in cache , it also keeps the Last - Modified header sent from the server .

5x5 Rubik's Cube World Record Code Example

Example: 1x1 rubik's cube world record 8 minuites and 59 seconds

Disable Onclick Event Css Code Example

Example 1: disable click css .avoid-clicks { pointer-events : none ; } Example 2: css disable button click button .disabled { pointer-events : none ; }

Can Yarn Be Considered A Viable Option As A Replacement For Bower And Npm?

Answer : It depends on your exact use case, but... probably . Currently, the major trend seems to be towards module bundlers such as Webpack and Browserify (and hence either npm or Yarn) and away from Bower. You can read an excellent overview of the situation at NPM vs. Bower vs. Browserify vs. Gulp vs. Grunt vs. Webpack, along with some reasons why you might want Webpack instead of Bower. At the minute, you're probably using HTTP, where it works out faster to have one JavaScript bundle file rather than lots of source files (as would occur with Bower). That's why Webpack and Browserify are so popular (among other reasons) — they should increase performance and simplify development a lot. Side note: HTTP/2 will diminish the value of module bundling, because multiple requests will become far less costly. See What is the value of using Webpack with HTTP/2 for a more detailed description of the issues involving HTTP/2. If you use npm or Yarn, it shouldn't really m

Css Float Property Code Example

Example 1: float none css .titanic { float : none ; } Example 2: css floaat .myelement { float : left ; }

Css Disabled Cursor Code Example

Example 1: disable cursor css /* This will make all the links invalid */ pointer - events : none ; Example 2: hand property css li { cursor : pointer ; } Example 3: cursor not pointer # Element { cursor : pointer ; /*When you point on this element, cursor will be a pointer.*/ } # Element { cursor : default ; /*Will make the cursor not point.*/ } Example 4: css cursor pointer body { /*(Cursor image must be 32*32 pixles)*/ cursor : url ( CURSOR_URL ) , auto ; } Example 5: pointer help ptr ++ ; // Pointer moves to the next int position (as if it was an array) ++ ptr ; // Pointer moves to the next int position (as if it was an array) ++ * ptr ; // The value of ptr is incremented ++ ( * ptr ) ; // The value of ptr is incremented ++ * ( ptr ) ; // The value of ptr is incremented * ptr ++ ; // Pointer moves to the next int position (as if it was an array). But returns the old content ( * ptr ) ++ ; // The value of ptr is incremented * ( ptr ) ++ ; //

Could Not Load File Or Assembly 'System.Buffers, Version=4.0.2.0...'

Answer : Could not load file or assembly 'System.Buffers, Version=4.0.2.0…' Solution 1) use CMD(run as Administrator ) and type cd xxxx(xxxx\packages\System.Buffers.4.5.1\lib\netstandard2.0)) run gacutil /i System.Buffers.dll Then , when you finish it, please run update-package -reinstall under package manager console to reinstall the package. 2) you can try to change Version=4.0.2.0 to Version=4.0.3.0 in csproj file. Besides , there is a similar issue you can refer to.