Posts

Showing posts from November, 2009

Rotate Animation Css Transition Code Example

Example: css rotate animation <img class="image" src="http://i .stack .imgur .com /pC1Tv .jpg " alt="" width="120" height="120" > .image { position : absolute ; top : 50 % ; left : 50 % ; width : 120 px ; height : 120 px ; margin : -60 px 0 0 -60 px ; -webkit-animation : spin 4 s linear infinite ; -moz-animation : spin 4 s linear infinite ; animation : spin 4 s linear infinite ; } @-moz-keyframes spin { 100% { -moz-transform : rotate ( 360 deg ) ; } } @-webkit-keyframes spin { 100% { -webkit-transform : rotate ( 360 deg ) ; } } @keyframes spin { 100% { -webkit-transform : rotate ( 360 deg ) ; transform : rotate ( 360 deg ) ; } }

Convert InputStream To Byte Array In Java

Answer : You can use Apache Commons IO to handle this and similar tasks. The IOUtils type has a static method to read an InputStream and return a byte[] . InputStream is; byte[] bytes = IOUtils.toByteArray(is); Internally this creates a ByteArrayOutputStream and copies the bytes to the output, then calls toByteArray() . It handles large files by copying the bytes in blocks of 4KiB. You need to read each byte from your InputStream and write it to a ByteArrayOutputStream . You can then retrieve the underlying byte array by calling toByteArray() : InputStream is = ... ByteArrayOutputStream buffer = new ByteArrayOutputStream(); int nRead; byte[] data = new byte[16384]; while ((nRead = is.read(data, 0, data.length)) != -1) { buffer.write(data, 0, nRead); } return buffer.toByteArray(); Finally, after twenty years, there’s a simple solution without the need for a 3rd party library, thanks to Java 9: InputStream is; … byte[] array = is.readAllBytes(); Note also the convenience methods

Css Margin-block-start Example

The margin-block-start CSS property defines the logical block start margin of an element, which maps to a physical margin depending on the element's writing mode, directionality, and text orientation. Syntax /* <length> values */ margin-block-start : 10px ; /* An absolute length */ margin-block-start : 1em ; /* relative to the text size */ margin-block-start : 5% ; /* relative to the nearest block container's width */ /* Keyword values */ margin-block-start : auto ; /* Global values */ margin-block-start : inherit ; margin-block-start : initial ; margin-block-start : unset ; It corresponds to the margin-top , margin-right , margin-bottom , or margin-left property depending on the values defined for writing-mode , direction , and text-orientation . It relates to margin-block-end , margin-inline-start , and margin-inline-end , which define the other margins of the element. Values The margin-block-start property takes the same values as the margin-l

Android EditText Change Hint Color Code Example

Example: edittext hint color < android . support . design . widget . TextInputLayout android : layout_width = "match_parent" android : layout_height = "wrap_content" android : layout_marginTop = "@dimen/dp_10" android : textColorHint = "@color/color_black" - this line - app : hintTextAppearance = "@style/TextLabel" > < EditText android : id = "@+id/et_state" style = "@style/profile_editTextStyle" android : layout_width = "match_parent" android : layout_height = "wrap_content" android : hint = "@string/billingState" android : text = "@string/billingState" / > < / android . support . design . widget

Rick Astley Never Gonna Give You Up Lyrics Code Example

Example: never gonna give you up lyrics /* We're no strangers to love You know the rules and so do I A full commitment's what I'm thinking of You wouldn't get this from any other guy I just wanna tell you how I'm feeling Gotta make you understand Never gonna give you up Never gonna let you down Never gonna run around and desert you Never gonna make you cry Never gonna say goodbye Never gonna tell a lie and hurt you We've known each other for so long Your heart's been aching but you're too shy to say it Inside we both know what's been going on We know the game and we're gonna play it And if you ask me how I'm feeling Don't tell me you're too blind to see Never gonna give you up Never gonna let you down Never gonna run around and desert you Never gonna make you cry Never gonna say goodbye Never gonna tell a lie and hurt you Never gonna give you up Never gonna let you down Never gonna run around and

Android Button TextAppearance

Answer : The values of attributes defined using textAppearance are applied before the values of attributes in a style. A Button is a TextView with a style applied, and the default style of a Button will override your textAppearance (Android 2.3 for example will set it to ?android:attr/textAppearanceSmallInverse) and textColor. textAppearance excepts styles as values, android:textAppearance="@style/login_button_text_appearance" is the normally correct way to set a textAppearance, but not for a Button : If you're changing the text colour of a Button , you should also enforce a custom background image because if you don't, one device will use a dark background image (motorola defy) and another will use a light image (htc desire) which may make the text difficult to read. I think you should use : style = "@style/login_button_text_appearance" instead of: android:textAppearance="@style/login_button_text_appearance" The android:textAppe

Leave Horizontal Space Latex Code Example

Example: give space in latex Horizontal \hspace { 1 cm } spaces can be inserted manually . Useful to control the fine - tuning in the layout of pictures . Left Side \hfill Right Side

Show Scrollbar Only When Scrolling Code Example

Example: html always show scrollbar jQuery shouldn 't be required. You could try adding the CSS: body { overflow-y : scroll ; } This works across the latest browsers , even IE6.

How To Outline Font In Css Code Example

Example 1: css text outline /* You have 2 options The first is experimental */ /* text-stroke */ #example { font-size : 1 em ; -webkit-text-stroke : 1 px #000000 ; } /* Use 4 shadows Probably best to use this until the above is standardised */ #example { font-size : 1 em ; text-shadow : -1 px -1 px 0 #000 , 1 px -1 px 0 #000 , -1 px 1 px 0 #000 , 1 px 1 px 0 #000 ; } Example 2: css text black outline /* Written for h4 tag, modify as required */ .black-outline { -webkit-text-stroke : 1.11 px black ; /* stroke width and color */ color : rgb ( 255 , 255 , 255 ) ; -webkit-font-smoothing : antialiased ; font-weight : bold ; }

Faire Un Commentaire En Css Code Example

Example: commentaire multilignes css /* Commentaire sur une ligne */ /* Commentaire sur plusieurs lignes */ /* Le commentaire qui suit permet de désactiver une règle */ /* span { color: blue; font-size: 1.5em; } */

Android - GetIntent() From A Fragment

Answer : You can use a getIntent() with Fragments but you need to call getActivity() first. Something like getActivity().getIntent().getExtras().getString("image") could work. It's not that you can't pass data, it's that you don't want to. From the Fragment documentation: Often you will want one Fragment to communicate with another, for example to change the content based on a user event. All Fragment-to-Fragment communication is done through the associated Activity. Two Fragments should never communicate directly. If you take a look at the Fragment documentation, it should walk you through how to do this. If you want get intent data, you have to call Fragment's method getArguments() , which returns Bundle with extras.

Create Folder Shortcut Windows 10 Code Example

Example 1: new folder shortcut windows 10 Ctrl+Shift , then press -> N Hold down the Ctrl, Shift, and N keys at the same time Example 2: windows 10 hotkey new folder Ctrl + Shift + N Example 3: shortcut to create a new folder in windows 10 Ctrl+Shift and N

Create User With Role Postgres Code Example

Example 1: create db user postgres sudo - u postgres psql postgres = # create database mydb ; postgres = # create user myuser with encrypted password 'mypass' ; postgres = # grant all privileges on database mydb to myuser ; Example 2: postgresql create user roles CREATE ROLE admin WITH CREATEDB CREATEROLE ; Example 3: postgresql create user roles CREATE ROLE name [ WITH ADMIN role_name ]

Convert Base64 To Binary Python Code Example

Example 1: base64 decode python >> > import base64 >> > encoded = base64 . b64encode ( b'data to be encoded' ) >> > encoded b'ZGF0YSB0byBiZSBlbmNvZGVk' >> > data = base64 . b64decode ( encoded ) >> > data b'data to be encoded' Example 2: convert binary string to base 10 value in python def getBaseTen ( binaryVal ) : count = 0 #reverse the string binaryVal = binaryVal [ : : - 1 ] #go through the list and get the value of all 1's for i in range ( 0 , len ( binaryVal ) ) : if ( binaryVal [ i ] == "1" ) : count += 2 ** i return count

Add User To Docker Group Permanently Code Example

Example 1: docker post installation steps linux # Creates docker group sudo groupadd docker # Add your user to the docker group sudo usermod -aG docker $USER # Log out and log back in so that your group membership is re-evaluated # GNOME example gnome-session-quit Example 2: docker sudo how to add user FROM alpine:latest RUN apk --no-cache update \ && apk --no-cache add sudo copy run.sh /usr/local/ RUN addgroup -S cassandra && adduser -S cassandra -G cassandra RUN chown -R cassandra:cassandra /home/cassandra/ RUN echo 'cassandra ALL=(ALL) /bin/su' >> /etc/sudoers USER cassandra ENTRYPOINT [ "sh" , "/usr/local/run.sh" ]

Convert Array To String In Php Code Example

Example 1: Array to String Conversion in PHP $gadget = array ( 'computer' , 'mobile' , 'tablet' ) ; echo implode ( $arr ) ; Example 2: php Array to string conversion Using implode() function in Php ----------------------- Syntax implode(separator,array); Example <?php //assigning value to the array $dummyArr = array ( "Hello" , "Greppers," , "Ankur" , "here !" ) ; echo implode ( " " , $dummyArr ) ; // Use of implode function ?> Output: Hello Greppers, Ankur here ! Example 3: php implode $arr = array ( 'Hello' , 'World!' , 'Beautiful' , 'Day!' ) ; echo implode ( " " , $arr ) ; // Outputs: 'Hello World! Beautiful Day!' Example 4: array to string conversion in php $person = [ 'name' => 'Jon' , 'age' => 26 , 'status' => null , 'friends' => [ 'Matt'

Margin Auto Not Working Code Example

Example 1: margin-top not working .form_head { margin-top : 20 px ; color : #58585a ; font-size : 22 px ; display : block ; /* Add this */ } Example 2: margin bottom not working // Your problem is that link ( "a" ) is an INLINE element and you cannot set margin to inlines elements. In order to make it work , you have to declare it as BLOCK element , by adding: a { display : block ; }

Debian Server Iso Download Code Example

Example 1: download debian 505 a1522daa30d77f4fa5acd4fa3d8c5e1a1cbb4 debian - 10.7 .0 - amd64 - netinst . iso 75088471 b359cd21635afe427a1598ce111dfc41 debian - 10.7 .0 - amd64 - xfce - CD - 1. iso 66 bf9321fcda7cc32040bf644a8a714d9b62adbe debian - edu - 10.7 .0 - amd64 - netinst . iso 5 b326dc3fd2e6c1b686dfa16b0b6d83e81bc5455 debian - mac - 10.7 .0 - amd64 - netinst . iso Example 2: download debian -- -- - BEGIN PGP SIGNATURE -- -- - iQIzBAABCAAdFiEE35ucSeqpKYQyWJ122ofoDWKUvpsFAl / MN + AACgkQ2ofoDWKU vpuPRg / + P / Lc7hlQGGt9a9aCxxikMmLqnsaEi7w0LkvOxzb9SSvRkc55xv / uSwJ / u + G6gezVGctMPTHEXgt19b4jOpw + xxyqkLIQ0MZzzGNOkXbP5chaie + IFxWXBXiI ybP1sixHnpTW1LfyUK6sA / + ayZMNoYb3VIlfVyYXgRzoG7qCFDkhu + WnsALESCG + 1 ffZBgEqA24XkKjp1cDUzmxy9ZvtRIlSiV3rWq0opCyzhYFI44GNZXatDd4jyjOH bgT / LhUPj / dFISFOBYEGL5jWwl + nZP3k6k3JUU30YXlisAu4JLA08UXdzIpgHjCf VRn6oWlx8Gs0Zi19mZ6giaG / zDy4EuHZP0MvQeD53ixXJb3MlLc0zAhYGKnpBzuV R90W3WcbNfu0DTCVQvgtaOQG + XUMlsXB8zGl9cjpUYsKYlceWc5xsVY

Convert Cstring To Char Array Code Example

Example 1: converting char array to string // Convert char array to String in Java class Util { public static void main(String[] args) { char[] chars = {'T', 'e', 'c', 'h', 'i', 'e', ' ', 'D', 'e', 'l', 'i', 'g', 'h', 't'}; String string = new String(chars); System.out.println(string); } } Example 2: how to covert array into a char String s="Welcome to Java Programming"; char arr[]=s.toCharArray(); for(int i=0;i Tags: Misc Example

Number Of Repitations In The Vector In Descending Order Code Example

Example: sort vector descending int main ( ) { // Get the vector vector < int > a = { 1 , 45 , 54 , 71 , 76 , 12 } ; // Print the vector cout << "Vector: " ; for ( int i = 0 ; i < a . size ( ) ; i ++ ) cout << a [ i ] << " " ; cout << endl ; // Sort the vector in descending order sort ( a . begin ( ) , a . end ( ) , greater < int > ( ) ) ; // Print the reversed vector cout << "Sorted Vector in descendiing order:n" ; for ( int i = 0 ; i < a . size ( ) ; i ++ ) cout << a [ i ] << " " ; cout << endl ; return 0 ; }

Litespeed Cache Clear Cache Laravel Code Example

Example 1: laravel clear cache php artisan cache : clear php artisan route : clear php artisan config : clear php artisan view : clear Example 2: laravel controller cache clear php artisan cache : clear

Map Function Arduino Code Example

Example 1: map arduino Syntax map ( value , fromLow , fromHigh , toLow , toHigh ) Parameters value : the number to map . fromLow : the lower bound of the value’s current range . fromHigh : the upper bound of the value’s current range . toLow : the lower bound of the value’s target range . toHigh : the upper bound of the value’s target range . Example : map ( val , 0 , 255 , 0 , 1023 ) ; Example 2: arduino map function long map ( long x , long in_min , long in_max , long out_min , long out_max ) { return ( x - in_min ) * ( out_max - out_min ) / ( in_max - in_min ) + out_min ; }

Create A Link That Will Open Viber And WhatsApp And Will Send A Message To Me

Answer : What you need is called deep-linking , some examples for viber and whatsapp are: Viber : <a href="viber://pa?chatURI=[public account URI]&text=[message text]"> some text </a> WhatsApp : <a href="whatsapp://send?abid=[users name]&text=[message text]"> some text </a> While not a deep link, you can also use the following url (don't use + on phone) for WhatsApp : <a href="https://api.whatsapp.com/send?phone=0000000">Contact Me</a> Sources: http://origamiengine.com/deep-linking https://support.viber.com/customer/en/portal/articles/2872423-deep-links Viber link to user should be like this: viber://contact?number=%2B0000000000000 Use international telephone number format without + but with %2B . Since you don't want to create a public account (aka viber links including /pa? ) then simple add the link: <a href="viber://chat?number=012345678901"">chat with me</a> The firs

Canvas Border Color Tkinter Code Example

Example 1: tkinter text in canvas self . canvas = Canvas ( root , width = 800 , height = 650 , bg = '#afeeee' ) self . canvas . create_text ( 100 , 10 , fill = "darkblue" , font = "Times 20 italic bold" , text = "Click the bubbles that are multiples of two." ) Example 2: canvas.create_oval parameters id = C . create_oval ( x0 , y0 , x1 , y1 , option , . . . )