Posts

Showing posts from June, 2007

Css Translate Transform Code Example

Example 1: css transform transform : matrix ( 1 , 2 , 3 , 4 , 5 , 6 ) ; transform : matrix3d ( 1 , 0 , 0 , 0 , 0 , 1 , 0 , 0 , 0 , 0 , 1 , 0 , 0 , 0 , 0 , 1 ) ; transform : translate ( 120 px , 50 % ) ; transform : scale ( 2 , 0.5 ) ; transform : rotate ( 0.5 turn ) ; transform : skew ( 30 deg , 20 deg ) ; transform : scale ( 0.5 ) translate ( - 100 % , - 100 % ) ; transform : perspective ( 17 px ) ; Example 2: transform:translateX() /* <length-percentage> values */ transform : translateX ( 200 px ) ; transform : translateX ( 50 % ) ; Example 3: css scale transform : scale ( sx , sy ) ; Example 4: css transform size . selector { transform : scale ( 1.2 ) ; // Will upscale to 1.2 }

Row Padding Flutter Code Example

Example 1: flutter how to space buttons evenly in a row //Use mainAxisAligment: MainAxisAlignment.spaceEvenly, //After initializing the row new Container ( alignment : FractionalOffset . center , child : new Row ( mainAxisAlignment : MainAxisAlignment . spaceEvenly , children : < Widget > [ new FlatButton ( child : new Text ( 'Don\'t have an account?' , style : new TextStyle ( color : Color ( 0xFF2E3233 ) ) ) , ) , new FlatButton ( child : new Text ( 'Register.' , style : new TextStyle ( color : Color ( 0xFF84A2AF ) , fontWeight : FontWeight . bold ) , ) , onPressed : moveToRegister , ) ] , ) , ) , Example 2: column each child padding Wrap ( spacing : 20 , // to apply margin in the main axis of the wrap runSpacing : 20 , // to app

Cookie Clicker Codes Code Example

Example 1: cookie clicker #Hacks: # Type these in your console which you can open by # pressing STRG + SHIFT + J (Chrome) or STRG + SHIFT + K (Firefox) # changes the amount of cookies Game.cookies = amount in int # unlimted cookies Game.cookies = Infinity # If you want to get out of Infinity cookies Game.cookiesd = 0 # set up the CookiesPerSecond Rate by the number you want Game.cookiesPS= amount in int # clicks on cookie forever without moving your mouse in the highest speed var autoclicker = setInterval(function() { Game.ClickCookie(); }, 10); # stoping autoclicker clearInterval(autoClicker) # clicks on golden cookie without moving your mouse setInterval(Game.goldenCookie.click, 500) # Get the achievement you want by changing it to the achievement name you want # Game.Win(‚ACHIEVEMENT‘) Example 2: cookie click Poggers ░░░░░░░░░░░░▄▄▄▄▄▄▄▄▄▄▄▄▄░░░░░░░░░░░░ ░░░░░░▄▄████▀▀▀▀▀░░░░░░▀▀█▄▄░░░░░░░░░ ░░░▄██▀▀░░░░░

Android: MediaPlayer SetVolume Function

Answer : This function is actualy wonderful. Thanks to it you can create a volume scale with any number of steps! Let's assume you want 50 steps: int maxVolume = 50; Then to set setVolume to any value in this range (0-49) you do this: float log1=(float)(Math.log(maxVolume-currVolume)/Math.log(maxVolume)); yourMediaPlayer.setVolume(log1,log1); //set volume takes two paramater Nice and easy! And DON'T use AudioManager to set volume! It will cause many side effects such as disabling silent mode, which will make your users mad! Following user100858 solution I just post my exact code that works: private final static int MAX_VOLUME = 100; ... ... final float volume = (float) (1 - (Math.log(MAX_VOLUME - soundVolume) / Math.log(MAX_VOLUME))); mediaPlayer.setVolume(volume, volume); soundVolume is the volume you would like to set, between 0 and MAX_VOLUME. So between 0 and 100 in this example. For Android MediaPlayer.setVolume , searching the web seems to show 0.0f

Conda Command Not Found

Answer : If you're using zsh and it has not been set up to read .bashrc, you need to add the Miniconda directory to the zsh shell PATH environment variable. Add this to your .zshrc : export PATH="/home/username/miniconda/bin:$PATH" Make sure to replace /home/username/miniconda with your actual path . Save, exit the terminal and then reopen the terminal. conda command should work. If you have the PATH in your .bashrc file and are still getting conda: command not found Your terminal might not be looking for the bash file. Type bash in the terminal to insure you are in bash and then try: conda --version For those experiencing issues after upgrading to MacOS Catalina. Short version: # 1a) Use tool: conda-prefix-replacement - # Restores: Desktop -> Relocated Items -> Security -> anaconda3 curl -L https://repo.anaconda.com/pkgs/misc/cpr-exec/cpr-0.1.1-osx-64.exe -o cpr && chmod +x cpr ./cpr rehome ~/anaconda3 # or if fails #./cpr rehome ~/anaconda3 --old

Button Html Href Code Example

Example 1: button verlinken html <a href= "#" > <button>Mein Button</button></a> Example 2: href on a button <button onclick= "window.location.href='/page2'" >Continue</button> Example 3: html button link <button><a href= 'https://google.com' alt= 'Broken Link' >This is a button</a></button> Example 4: buton html href <!-- if you are on Window : --> <button onclick= "window.location.href='page2.html'" > Button </button> <!-- if you are on linux or macOS : --> <button onclick= "location.href='page2.html'" > Button </button> Example 5: html button with link <a href= "https://www.google.com" > <button>Go to Google</button> </a> Example 6: href in button <input type= "button" onclick= "location.href='https://google.com';" va

Convert A String To Int Javascript Code Example

Example 1: how to convert string to int js let string = "1" ; let num = parseInt ( string ) ; //num will equal 1 as a int Example 2: Javascript string to int var myInt = parseInt ( "10.256" ) ; //10 var myFloat = parseFloat ( "10.256" ) ; //10.256 Example 3: how to change a string to number in javascript let theInt = parseInt ( "5.90123" ) ; //5 let theFloat = parseFloat ( "5.90123" ) ; //5.90123 Example 4: string to int javascript var text = '42px' ; var integer = parseInt ( text , 10 ) ; // returns 42 let myNumber = Number ( "5.25" ) ; //5.25 Example 5: javascript string to integer < script language = "JavaScript" type = "text/javascript" > var a = "3.3445" ; var c = parseInt ( a ) ; alert ( c ) ; < / script > Example 6: string to int javascript var text = '3.14someRandomStuff' ; var pointNum = parseFloat ( text ) ; // returns 3.14

Android Studio Device Not Showing Code Example

Example: mobile device not showing in android studio Enable Developer option from device settings Worked for me

Convert From Jpg To Mp4 By Ffmpeg

Answer : Depending on your file names you'll want: ffmpeg -f image2 -i Path/To/File/filename%3d.jpg test.avi The filename%3d would be for files named: filename000.jpg , filename001.jpg , filename002.jpg , etc. See FFmpeg image2 demuxer examples You have other option like : framerate = Set the frame rate for the video stream. It defaults to 25 -r = set frame rate ffmpeg -framerate 10 -i Path/To/File/filename%3d.jpg -r 5 -y Path/To/File/test.mp4 I can show you an example here, ffmpeg -f image2 -r 60 -i path/filename%03d.jpg -vcodec libx264 -crf 18 -pix_fmt yuv420p test.mp4 f : force format r : frame rate i : input files assuming your files are filename001.jpg , filename002.jpg , ... vcodec : video codec crf : constant rate factor (0-51). 17-18 is (nearly) visually lossless. See Encode/H.264 pix_fmt : pixel format

Adding A Gradient Background To Appbar On Flutter

Image
Answer : I don't believe you can pass a gradient to an AppBar as it expects a Color rather than a gradient. You can, however, create your own widget that mimics an AppBar except by using a gradient. Take a look at this example that I've pieced together from the Planets-Flutter tutorial along with the code below it. import "package:flutter/material.dart"; class Page extends StatelessWidget { @override Widget build(BuildContext context) { return Column(children : <Widget>[GradientAppBar("Custom Gradient App Bar"), Container()],); } } class GradientAppBar extends StatelessWidget { final String title; final double barHeight = 50.0; GradientAppBar(this.title); @override Widget build(BuildContext context) { final double statusbarHeight = MediaQuery .of(context) .padding .top; return new Container( padding: EdgeInsets.only(top: statusbarHeight), height: statusbarHeight + barHeigh

Css Grid Cheat Sheet Pdf Code Example

Example 1: css grid cheat sheet grid-template-columns : 1 fr 1 fr 2 fr Example 2: css grid cheat sheet grid-template-rows : 50 px 100 px

Access Byref Argument Type Mismatch Code Example

Example: ByRef argument type mismatch ' If you don't specify a type for a variable, the variable receives the default ' type, Variant. This isn't always obvious. For example, the following code ' declares two variables, the first, "MyVar", is a Variant; the second, ' "AnotherVar", is an Integer. Sub main() Dim MyVar, AnotherVar As Integer ' MyVar->Variant, AnotherVar->Integer 'Dim MyVar As Integer, AnotherVar As Integer ' Both are declared integers MyVar = 3.1415 Call SomeSub((MyVar)) End Sub Sub SomeSub (MyNum As Integer) MyNum = MyNum + MyNum End Sub

Leap Year Program In C Using Logical Operators Code Example

Example: leap year c program # include <stdio.h> int main ( ) { int year ; printf ( "Enter a year: " ) ; scanf ( "%d" , & year ) ; // leap year if perfectly visible by 400 if ( year % 400 == 0 ) { printf ( "%d is a leap year." , year ) ; } // not a leap year if visible by 100 // but not divisible by 400 else if ( year % 100 == 0 ) { printf ( "%d is not a leap year." , year ) ; } // leap year if not divisible by 100 // but divisible by 4 else if ( year % 4 == 0 ) { printf ( "%d is a leap year." , year ) ; } // all other years are not leap year else { printf ( "%d is not a leap year." , year ) ; } return 0 ; }

Conditional Sorting In ElasticSearch

Answer : Yes this is possible in ElasticSearch using a script, either for sorting or for scoring. My preference would be for a scoring script because 'script based score' is going to be quicker (according to the documentation). Using a scoring script, you could use the Unix timestamp for the date field of type int/long and an mvel sorting script in the custom_score query. You might need to re-index your documents. You would also need to be able to convert the searched for time into a Unix timestamp to pump it at ElasticSearch. The sorting script would then deduct the requested timestamp from each document's timestamp and make an absolute value. Then the results are sorted in ascending order - the lowest 'distance' is the best. So when looking for documents dated about a year ago, it would look something like: "query": { "custom_score" : { "query" : { .... }, "params" : {

Can You Use Es6 Import Alias Syntax For React Components?

Answer : Your syntax is valid. JSX is syntax sugar for React.createElement(type) so as long as type is a valid React type, it can be used in JSX "tags". If Button is null, your import is not correct. Maybe Button is a default export from component-library. Try: import {default as StyledButton} from "component-library"; The other possibility is your library is using commonjs exports i.e. module.exports = foo . In this case you can import like this: import * as componentLibrary from "component-library"; Update Since this is a popular answer, here a few more tidbits: export default Button -> import Button from './button' const Button = require('./button').default export const Button -> import { Button } from './button' const { Button } = require('./button') export { Button }