Posts

Showing posts from October, 2008

Css Zoom Out Image Without Hover Code Example

Example 1: zoom image css /*Zoom on hover*/ <style > .zoom { padding : 50 px ; background-color : green ; transition : transform .2 s ; /* Animation */ width : 200 px ; height : 200 px ; margin : 0 auto ; } .zoom :hover { transform : scale ( 1.5 ) ; /* (150% zoom)*/ } </style> <div class= "zoom" ></div> /*credits: w3schools.com */ Example 2: how to use image zoom effect in css .parent { width : 400 px ; height : 300 px ; } .child { width : 100 % ; height : 100 % ; background-color : black ; /* fallback color */ background-image : url ( "images/city.jpg" ) ; background-position : center ; background-size : cover ; }

Android Get Integer Resource Code Example

Example: android integer resource in res/values/dimens.xml: < integer name = " grid_columns " > 1 </ integer > in res/values-w600dp/dimens.xml: < integer name = " grid_columns " > 2 </ integer > in java: int gridColumns = getResources().getInteger(R.integer.grid_columns);

Angular 6 - Getting Download URL For Firebase Storage File After Uploading

Answer : You should add a finalize() to the pipe, something like: this.task.snapshotChanges().pipe( finalize(() => { this.downloadURL = this.ref.getDownloadURL(); // <-- Here the downloadURL is available. }) ).subscribe(); In the finalize() step, the downloadURL is available, so u can grab him from the ref asynchronously. --UPDATE You said you are using Angular 6, so I assume you are using the last version of firebase. They change getDownloadURL() to Observable from Task, So to get the actual URL you just have to subscribe. this.task.snapshotChanges().pipe( finalize(() => { this.ref.getDownloadURL().subscribe(url => { console.log(url); // <-- do what ever you want with the url.. }); }) ).subscribe();

Android PreferenceActivity Dialog With Number Picker

Answer : Subclass DialogPreference to build your own NumberPickerPreference . I have implemented one below for you. It works perfectly fine, but is not feature complete. For example the minimum and maximum values are hard-coded constants. These should really be attributes on the preference xml declaration. To get that to work you would need to add an attrs.xml file specifying your custom attributes. For the full implementation of the NumberPicker preference widget that supports custom xml attributes in a library project and a demo app showing how to use it, see GitHub: https://github.com/Alobar/AndroidPreferenceTest You would use the widget as any other preference widget, except you have to fully qualify the name: preferences.xml <PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"> <com.example.preference.NumberPickerPreference android:key="key_number" android:title="Give me a number"

Ng Class With Multiple Conditions Angular 4 Code Example

Example: ngclass multiple conditions <a [ngClass]= " { 'class1' : array.status === 'active' , 'class2' : array.status === 'idle' , 'class3' : array.status === 'inactive' , } ">

BrowserSync Cannot GET /

Answer : Using BrowserSync as a server only works if you're running a static site, so PHP won't work here. Looks like you're using XAMPP to serve your site, you can use BrowserSync to proxy your localhost. Example: browser-sync start --proxy localhost/yoursite References: http://www.browsersync.io/docs/command-line/#proxy-example https://github.com/BrowserSync/browser-sync/issues/5 Because it works only with index.html by default, for example: linux@linux-desktop:~/Templates/browsersync-project$ ls brow.html css linux@linux-desktop:~/Templates/browsersync-project$ browser-sync start --server --files '.' Expected result: Cannot GET/ In order to see your static web-page in the web-browser instead of that annoying message you have to rename a file brow.html to index.html . This will solve Cannot GET/ problem. P.S. Where you are installing a browser-sync doesn’t matter. Just type npm install -g browser-sync whatever directory you are in

Add SATA Port To Motherboard?

Answer : You can download the free hwinfo32 app and run it. Look under motherboard, and the SATA ports that are live and supported will be listed. If there is a label next to the solder ports (like "SATA 1, SATA 2, etc.), then you can see if that port is active. If it is, you are good to go (as long as you are as good at soldering as you think you are). I disagree with the naysayers above. While SATA connectors themselves are extremely cheap, many laptop manufacturers contract out the assembly of their motherboards, and they are charged by the component or by the solder joint. In those terms the cost of the connector is less trivial, and it makes a bit more sense to not include it. Motherboard layout is expensive enough that computer companies will use the same layout for multiple versions of a board, just without adding all the components to all of them, so those motherboard traces almost certainly lead to the SATA chip. There's no reason in principle this wouldn

Android Studio SDK Location

Answer : For Mac/OSX the default location is /Users/<username>/Library/Android/sdk . Android Studio on Windows 8: C:\Users\username\AppData\Local\Android\sdk\extras\intel\Hardware_Accelerated_Execution_Manager\intelhaxm-android.exe (in username : please enter valid username) Install it and restart your Android Studio. The above steps are similar for win 7 and also same for eclipse. Update: Windows 10 (similar steps) - pointed out by RBT This is the sdk path Android Studio installed for me: "C:\Users\<username>\appdata\local\android\sdk" I'm running windows 8.1. You can find the path going into Android Studio -> Configure -> SDK Manager -> On the top left it should say SDK Path. I don't think it's necessary to install the sdk separately, as the default option for Android Studio is to install the latest sdk too.

How To Delete On Github Code Example

Example: how to delete repository in github #step by step Process >> Login github >> Profile # right side of the page profile icon >> Your repositories >> Select repositories >> Goto Settings # repository level settings >> Delete this repository >> Please type <repository name> to confirm.

Alternatives To System.exit(1)

Answer : The use of System.exit is frowned upon when the 'application' is really a sub-application (e.g. servlet, applet) of a larger Java application (server): in this case the System.exit could stop the JVM and hence also all other sub-applications. In this situation, throwing an appropriate exception, which could be caught and handled by the application framework/server is the best option. If the java application is really meant to be run as a standalone application, there is nothing wrong with using System.exit . in this case, setting an exit value is probably the easiest (and also most used) way of communicating failure or success to the parent process. I agree with the " throw an Exception " crowd. One reason is that calling System.exit makes your code difficult to use if you want other code to be able to use it. For example, if you find out that your class would be useful from a web app, or some kind of message consuming app, it would be nice to allow t

On Hover Fade In Css Code Example

Example 1: animation fade in css #test p { margin-top : 25 px ; font-size : 21 px ; text-align : center ; -webkit-animation : fadein 2 s ; /* Safari, Chrome and Opera > 12.1 */ -moz-animation : fadein 2 s ; /* Firefox < 16 */ -ms-animation : fadein 2 s ; /* Internet Explorer */ -o-animation : fadein 2 s ; /* Opera < 12.1 */ animation : fadein 2 s ; } @keyframes fadein { from { opacity : 0 ; } to { opacity : 1 ; } } /* Firefox < 16 */ @-moz-keyframes fadein { from { opacity : 0 ; } to { opacity : 1 ; } } /* Safari, Chrome and Opera > 12.1 */ @-webkit-keyframes fadein { from { opacity : 0 ; } to { opacity : 1 ; } } /* Internet Explorer */ @-ms-keyframes fadein { from { opacity : 0 ; } to { opacity : 1 ; } } /* Opera < 12.1 */ @-o-keyframes fadein { from { opacity : 0 ; } to { opacity : 1 ; } } Example 2:

Angular Ng Update

Updates your application and its dependencies. See https://update.angular.io/ ng update [options] Description Perform a basic update to the current stable release of the core framework and CLI by running the following command. ng update @angular/cli @angular/core To update to the next beta or pre-release version, use the --next option. To update from one major version to another, use the format ng update @angular/cli@^<major_version> @angular/core@^<major_version> We recommend that you always update to the latest patch version, as it contains fixes we released since the initial major release. For example, use the following command to take the latest 10.x.x version and use that to update. ng update @angular/cli@^10 @angular/core@^10 For detailed information and guidance on updating your application, see the interactive Angular Update Guide. Options Option Description Value Type Default Value --all Deprecated Whether to update all packa

Angular 1.6.0: "Possibly Unhandled Rejection" Error

Answer : Try adding this code to your config. I had a similar issue once, and this workaround did the trick. app.config(['$qProvider', function ($qProvider) { $qProvider.errorOnUnhandledRejections(false); }]); The code you show will handle a rejection that occurs before the call to .then . In such situation, the 2nd callback you pass to .then will be called, and the rejection will be handled. However , when the promise on which you call .then is successful, it calls the 1st callback. If this callback throws an exception or returns a rejected promise, this resulting rejection will not be handled , because the 2nd callback does not handle rejections in cause by the 1st. This is just how promise implementations compliant with the Promises/A+ specification work, and Angular promises are compliant. You can illustrate this with the following code: function handle(p) { p.then( () => { // This is never caught. throw new Error(&q

Amsterdam Timezone Code Example

Example: timezone amsterdam utc UTC + 1 #Oct 21 till Mar 21 UTC + 2 #Mar 21 till Oct 21

27 Inches To Cm Code Example

Example: inch to cm 1 inch = 2.54 cm