Posts

Showing posts from August, 2001

A Call To SSPI Failed, See Inner Exception - The Local Security Authority Cannot Be Contacted

Answer : This means the other side is using another version of TLS and you are using an older version. Set up security attribute to TLS12 before making the connection. This is a widely known problem, as many providers start using TLS12 (e.g. paypal,amazon and so on). ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12; Here is the solution, set in the registry: [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\KeyExchangeAlgorithms\Diffie-Hellman] "ClientMinKeyBitLength"=dword:00000200 as noted here If you are using SslStream, then you need to explicitly set the TLS version in the AuthenticateAsClient call, for example: ssl.AuthenticateAsClient(url, null, SslProtocols.Tls12, false);

Border-width In Em - But Set A Minimum Border-width

Answer : In CSS3, you can try to (ab)use the max css function, if your browser supports it. border-width: max(1px, 0.1em); border-style: solid; border-color: black; Unfortunately this awesome CSS3 feature isn't supported by any browsers yet, but I hope this will change soon! But in CSS2 – no, you can't. However, you can use JavaScript/jQuery to loop through all elements and increase the border size to 1px. But this will eat so much performance your browser is gonna crash if you have too many elements on your page (e.g. a table with more than 50-100 rows). So in other words, no it's not possible. $("[id$='ReportViewerControl']").find('*') .each(function () { if($(this).is('#ParametersRowReportViewerControl *')) return; //console.log("Processing an element"); //var cls = $(this).attr("class"); // Don't add a border to sort-arrow if ($(this).is

A = Np.zeros(shape(2,3)) Code Example

Example 1: declare numpy zeros matrix python import numpy as np dimensions = ( 3 , 3 ) np . zeros ( dimensions ) # 3x3 zeros matrix Example 2: np.zeros([8,8,3]) >> > np . zeros ( [ 8 , 8 , 3 ] ) array ( [ [ 0 . ] , [ 0 . ] ] )

Angular Http - ToPromise Or Subscribe

Answer : If you like the reactive programming style and want to be consistent within your application to always use observables even for single events (instead of streams of events) then use observables. If that doesn't matter to you, then use toPromise() . One advantage of observables is, that you can cancel the request. See also Angular - Promise vs Observable I think as long as the response is not a data stream that you're going to use, then you'd better use the .toPromise() approach, because it's meaningless to keep listening to a response that you don't need and it's not even going to change.

Ansible: How To Recursively Set Directory And File Permissions

Answer : file: dest=/foo/bar/somedir owner=root group=apache mode=u=rwX,g=rX,o=rX recurse=yes will set directories to 755, and files to 644. The Ansible file/copy modules don't give you the granularity of specifying permissions based on file type so you'd most likely need to do this manually by doing something along these lines: - name: Ensure directories are 0755 command: find {{ path }} -type d -exec chmod 0755 {} \; - name: Ensure files are 0644 command: find {{ path }} -type f -exec chmod 0644 {} \; These would have the effect of recursing through {{ path }} and changing the permissions of every file or directory to the specified permissions. Source: https://stackoverflow.com/a/28782805/1306186 If you want to use the module file in ansible, you can: file: dest=/foo/bar/somedir owner=root group=apache mode=0644 recurse=yes file: dest=/foo/bar/somedir owner=root group=apache mode=0775 With this method you first set all the file

Benchmarking Spring Boot Application With JMH

Answer : The solution was quite than easy than I thought. The important part is to start the spring-boot application when the benchmark is getting initialized. Define a class level variable for configuration context and give a reference to it during setup of the benchmark. Make a call to the bean method inside the benchmark. import java.io.File; import java.net.URL; import java.net.URLClassLoader; import java.util.concurrent.TimeUnit; import org.openjdk.jmh.annotations.Benchmark; import org.openjdk.jmh.annotations.BenchmarkMode; import org.openjdk.jmh.annotations.Level; import org.openjdk.jmh.annotations.Mode; import org.openjdk.jmh.annotations.OutputTimeUnit; import org.openjdk.jmh.annotations.Scope; import org.openjdk.jmh.annotations.Setup; import org.openjdk.jmh.annotations.State; import org.openjdk.jmh.infra.Blackhole; import org.openjdk.jmh.runner.Runner; import org.openjdk.jmh.runner.options.Options; import org.openjdk.jmh.runner.options.OptionsBuilder; import org.springfram

30inch To Cm Code Example

Example: inch to cm 1 inch = 2.54 cm

Bcs Meaning Code Example

Example: what is bc before Christ

Background Image Opacity Html Code Example

Example 1: set background image opacity #bg{ background-image: url('images/wood1.jpg'); opacity:0.2; width:300px; height:300px; } Example 2: css opacity example .opacity30 { opacity: 0.3; filter: alpha(opacity=30); /* For IE8 and earlier */ } Example 3: background image opacity css body::before{ content: ""; position: absolute; top: 0; right: 0; bottom: 0; left: 0; z-index: -1; background-image: url(image.jpg); /*Put your image url*/ background-size: cover; background-position: center; opacity: 0.25; /*Value from 0.0 to 1.0*/ } Example 4: background image opacity css /* Two ways to make images opaque */ div { background-color : rgba(120, 120, 120, 0.5) /* the 0.5 is the value of opacity on a scale of 0-1 */ } /* OR */ div { background-color : blue opacity : 50% } Example 5: css background image opacity /* You have to fake it, as there is no such property */ div { width: 200px; /* Image Wid

Can I Use Font-awesome Icons On Emails

Answer : You can't use webfonts reliably in html emails. Some clients might respect and render them, but the majority don't. You can use this website to convert the icons into images, and then simply download the images and upload them to Imgur. From there you can use <img> tags to link to the Imgur images. Edit: A better solution would be to host the images on your own server with the same domain as your email's domain . This will increase the chance of images automatically being displayed on your emails, as they are normally hidden until the user decides to view them. For example, if I used myname@mydomain.com to send emails, I'd host the images on mydomain.com You can embed them as images in your email. You can use fa2png.io which converts the font awesome icons to png of required size as well as color.

Bootstrap Danger Color Hex Code Code Example

Example: bootstrap primary color hex Vuetify Default Theme: primary: '#1976D2', secondary: '#424242', accent: '#82B1FF', error: '#FF5252', info: '#2196F3', success: '#4CAF50', warning: '#FFC107',

Angular 2 Load Child Component On Click

Answer : You can use *ngIf directive for the initing component from parent, so your code will be like this <button (click)="loadMyChildComponent();">Load</button> <my-child-component *ngIf="loadComponent"></my-child-component> loadMyChildComponent() { loadComponent = true; ... } Make use of flag to control the load of child component. <button (click)="loadMyChildComponent();">Load</button> <div *ngIf= 'loadComponent'> <my-child-component></my-child-component> </div> In your parent component .ts private loadComponent = false; loadMyChildComponent(){ this.loadComponent = true; } You can use perhaps the most fundamental directive ngIf <button (click)="loadMyChildComponent();">Load</button> <my-child-component *ngIf="loaded"></my-child-component> In your component loadMyChildComponent(){ loaded=true; }

Balanced Parentheses Hackerrank Solution Java Code Example

Example: balanced brackets hackerrank solution in cpp # include <iostream> # include <algorithm> # include <unordered_map> # include <stack> using namespace std ; string isBalanced ( string s ) { stack < char > st ; for ( auto c : s ) { switch ( c ) { case '(' : case '{' : case '[' : st . push ( c ) ; break ; case '}' : if ( st . empty ( ) || st . top ( ) != '{' ) return "NO" ; st . pop ( ) ; break ; case ']' : if ( st . empty ( ) || st . top ( ) != '[' ) return "NO" ; st . pop ( ) ; break ; case ')' : if ( st . empty ( ) || st . top ( ) != '(