Posts

Showing posts from April, 2012

Angular Material Grid Layout

Image
Answer : I'll give you the basics. In Angular Material (for Angular 2/4) the most commonly used attributes are: fxLayout="row | column" fxLayoutAlign="start | center | end | stretch | space-around | space-between | none" (can accept 2 properties at the same time) fxFlex="number" (can accept numbers from 1 to 100) You can also use postfix as fxLayout.xs and so on to apply rules only for specific resolution. For more info you can look through the docs: https://github.com/angular/flex-layout/wiki/API-Documentation To play around with alignment, you can use the demonstration from Angularjs Material resource (it's totally the same as for Angular Material for Angular 2/4): https://material.angularjs.org/latest/layout/alignment And another one useful link: https://tburleson-layouts-demos.firebaseapp.com/#/docs

Android Studio Layout Table Code Example

Example: table layout android studio < TableLayout android: id = " @+id/table " android: layout_width = " match_parent " android: layout_height = " wrap_content " android: layout_marginVertical = " 30dp " android: layout_marginHorizontal = " 10dp " android: background = " #f1f1f1 " android: collapseColumns = " 1,2 " > < TableRow > < TextView android: layout_width = " wrap_content " android: layout_height = " wrap_content " android: text = " Name " android: textStyle = " bold " android: layout_weight = " 1 " android: gravity = " center " /> < TextView android: layout_width = " wrap_content " a

MATLAB Custom Legend Code Example

Example 1: add manual legend matlab h1 = plot ( [ 1 : 10 ] , 'Color' , 'r' , 'DisplayName' , 'This one' ) ; hold on ; h2 = plot ( [ 1 : 2 : 10 ] , 'Color' , 'b' , 'DisplayName' , 'This two' ) ; h3 = plot ( [ 1 : 3 : 10 ] , 'Color' , 'k' , 'DisplayName' , 'This three' ) ; legend ( [ h1 h3 ] , { 'Legend 1' , 'Legend 3' } ) Example 2: automatic legend matlab str = { strcat ( 'z = ' , num2str ( z ) ) } % at the end of first loop , z being loop output str = [ str , strcat ( 'z = ' , num2str ( z ) ) ] % after 2 nd loop % plot your data legend ( str { : } )

CSS How To Make An Element Fade In And Then Fade Out?

Answer : Use css @keyframes .elementToFadeInAndOut { opacity: 1; animation: fade 2s linear; } @keyframes fade { 0%,100% { opacity: 0 } 50% { opacity: 1 } } here is a DEMO .elementToFadeInAndOut { width:200px; height: 200px; background: red; -webkit-animation: fadeinout 4s linear forwards; animation: fadeinout 4s linear forwards; } @-webkit-keyframes fadeinout { 0%,100% { opacity: 0; } 50% { opacity: 1; } } @keyframes fadeinout { 0%,100% { opacity: 0; } 50% { opacity: 1; } } <div class=elementToFadeInAndOut></div> Reading: Using CSS animations You can clean the code by doing this: .elementToFadeInAndOut { width:200px; height: 200px; background: red; -webkit-animation: fadeinout 4s linear forwards; animation: fadeinout 4s linear forwards; opacity: 0; } @-webkit-keyframes fadeinout { 50% { opacity: 1; } } @keyframes fadeinout { 50% { opacity: 1; } } <div class=elementToFadeInAndOut></div> If you

Shake Css Animation Code Example

Example: error shake animation css .face :hover { animation : shake 0.82 s cubic-bezier ( .36 , .07 , .19 , .97 ) both ; transform : translate3d ( 0 , 0 , 0 ) ; backface-visibility : hidden ; perspective : 1000 px ; } @keyframes shake { 10% , 90% { transform : translate3d ( -1 px , 0 , 0 ) ; } 20% , 80% { transform : translate3d ( 2 px , 0 , 0 ) ; } 30% , 50% , 70% { transform : translate3d ( -4 px , 0 , 0 ) ; } 40% , 60% { transform : translate3d ( 4 px , 0 , 0 ) ; } }

Android: Adb: Permission Denied

Answer : According to adb help : adb root - restarts the adbd daemon with root permissions Which indeed resolved the issue for me. Without rooting : If you can't root your phone, use the run-as <package> command to be able to access data of your application. Example: $ adb exec-out run-as com.yourcompany.app ls -R /data/data/com.yourcompany.app/ exec-out executes the command without starting a shell and mangling the output. The reason for "permission denied" is because your Android machine has not been correctly rooted. Did you see $ after you started adb shell ? If you correctly rooted your machine, you would have seen # instead. If you see the $ , try entering Super User mode by typing su . If Root is enabled, you will see the # - without asking for password.

Html Blank Space Add Code Example

Example: leading spaces html <!-- Add leading white space in front of text --> &nbsp ; Hello World <!-- Output : ' Hello World' -->

Media Query W3school Max And Min Width Code Example

Example: @media screen and (min-width @media ( min-width : 1250 px ) { ... }

Crystal Time::EpochConverter

Overview Converter to be used with JSON::Serializable and YAML::Serializable to serialize a Time instance as the number of seconds since the unix epoch. See Time#to_unix . require "json" class Person include JSON : : Serializable @[ JSON : : Field ( converter : Time : : EpochConverter ) ] property birth_date : Time end person = Person . from_json ( %({"birth_date": 1459859781}) ) person . birth_date # => 2016-04-05 12:36:21 UTC person . to_json # => %({"birth_date":1459859781}) Defined in: json/from_json.cr json/to_json.cr yaml/from_yaml.cr yaml/to_yaml.cr Class Method Summary .from_json (value : JSON::PullParser) : Time .from_yaml (ctx : YAML::ParseContext, node : YAML::Nodes::Node) : Time .to_json (value : Time, json : JSON::Builder) .to_yaml (value : Time, yaml : YAML::Nodes::Builder) Class Method Detail def self. from_json (value : JSON::PullParser) : Time Source def self. from_yaml (c

Couldn't Translate Date To Spanish With Locale("es_ES")

Answer : "es_ES" is a language + country. You must specify each part separately. The constructors for Locale are: Locale(String language) Construct a locale from a language code. Locale(String language, String country) Construct a locale from language, country. Locale(String language, String country, String variant) Construct a locale from language, country, variant. You want new Locale("es", "ES"); to get the Locale that goes with es_ES. However, it would be better to use Locale.forLanguageTag("es-ES") , using the well-formed IETF BCP 47 language tag es-ES (with - instead of _ ), since that method can return a cached Locale , instead of always creating a new one. tl;dr String output = ZonedDateTime.now ( ZoneId.of ( "Europe/Madrid" ) ) .format ( DateTimeFormatter.ofLocalizedDate ( FormatStyle.FULL ) .withLocale ( new Locale ( "es" , "ES" ) ) ) ; martes 12 de jul

Latex Fontsize Code Example

Example 1: latex text size \Huge \huge \LARGE \Large \large \normalsize \small \footnotesize \scriptsize \tiny Example 2: latex font sizes \Huge \huge \LARGE \Large \large \ normalsize ( default ) \small \footnotesize \scriptsize \tiny Example 3: latex font sizes Change global font size : \documentclass [ 12 pt ] { report } Example 4: latex change size of text % Article \documentclass [ 9 pt ] { extarticle } % Report \documentclass [ 14 pt ] { extreport }

Add Custom Name, Caption, Image, Description To New Facebook Share Dialog Or Custom Stories Not Taking Them From Og Meta

Answer : Update on 2019. This method is not working any more. New solution has not been find yet. :( Update on 27.06.2018. Old version of the code stopped working properly. The shared image was displayed as small image on the left, instead of as large full column image. The fix is to replace action_type: 'og.shares' with action_type: 'og.likes' . Use this code: FB.ui({ method: 'share_open_graph', action_type: 'og.likes', action_properties: JSON.stringify({ object: { 'og:url': url, 'og:title': title, 'og:description': des, 'og:image': img } }) }, function (response) { // Action after response }); This works with API version 2.9+ . Please note that using og.shares action_type , is not advised any more since it is not mentioned in the FB documentation and it doesn't properly display the large image. I now use og.likes . The

How Do I Move A Button Position In Css Code Example

Example 1: positioning button inside div .button-div { position : relative ; } .button { position : absolute ; top : ; <!-- declare your own positioning --> left : ; } Example 2: Move button in CSS <html> <head> </head> <body> <div style = "position:relative; left:80px; top:2px; background-color:yellow;" > This div has relative positioning. </div> </body> </html>

Convert Timestamp Datatype Into Unix Timestamp Oracle

Answer : This question is pretty much the inverse of Convert Unixtime to Datetime SQL (Oracle) As Justin Cave says: There are no built-in functions. But it's relatively easy to write one. Since a Unix timestamp is the number of seconds since January 1, 1970 As subtracting one date from another date results in the number of days between them you can do something like: create or replace function date_to_unix_ts( PDate in date ) return number is l_unix_ts number; begin l_unix_ts := ( PDate - date '1970-01-01' ) * 60 * 60 * 24; return l_unix_ts; end; As its in seconds since 1970 the number of fractional seconds is immaterial. You can still call it with a timestamp data-type though... SQL> select date_to_unix_ts(systimestamp) from dual; DATE_TO_UNIX_TS(SYSTIMESTAMP) ----------------------------- 1345801660 In response to your comment, I'm sorry but I don't see that behaviour: SQL> with the_dates as ( 2 select to_date('

Angular-UI Tabs: Add Class To A Specific Tab

Answer : I'm not sure that you can apply ng-class to tabs like that. After trying and failing I decided to look at the bootstrap-ui source for tabs and made an interesting discovery related to the tab heading attribute. Apparently you can put html in the heading section if you place the tab-heading as a child to a tab element. Check out the tabheading directive in here. This is the example they show: <tabset> <tab> <tab-heading><b>HTML</b> in my titles?!</tab-heading> And some content, too! </tab> <tab> <tab-heading><i class="icon-heart"></i> Icon heading?!?</tab-heading> That's right. </tab> </tabset> In your case I think you might be able to do something like this to get the same effect: <tab ng-repeat="tab in tabs" active="tab.active"> <tab-heading>{{tab.title}} <span ng-show="tab.new">new<

404 Not Found Spring Mvc Controller Code Example

Example 1: create spring 404 error controller server.error.whitelabel.enabled=false Example 2: spring mvc 404 page not found < web-app ... > < servlet > < servlet-name > mvc-dispatcher </ servlet-name > < servlet-class > org.springframework.web.servlet.DispatcherServlet </ servlet-class > < load-on-startup > 1 </ load-on-startup > </ servlet > < servlet-mapping > < servlet-name > mvc-dispatcher </ servlet-name > < url-pattern > *.htm </ url-pattern > </ servlet-mapping > //... < error-page > < error-code > 404 </ error-code > < location > /WEB-INF/pages/404.htm </ location > </ error-page > </ web-app >

How To Install Boost C++ Libraries Code Example

Example: how to install boost c++ on windows goto " https://www.boost.org/users/download/ " goto "Prebuilt windows binaries" click on the version you want dowload the last . exe version install and it ' s all good