Posts

Showing posts from December, 2000

Consume Rest Api With Basic Authentication Spring Boot Code Example

Example 1: set autorization basic with username and password + resttemplate try { / / request url String url = "https://jsonplaceholder.typicode.com/posts" ; / / create auth credentials String authStr = "username:password" ; String base64Creds = Base64.getEncoder ( ) .encodeToString ( authStr.getBytes ( ) ) ; / / create headers HttpHeaders headers = new HttpHeaders ( ) ; headers.add ( "Authorization" , "Basic " + base64Creds ) ; / / create request HttpEntity request = new HttpEntity ( headers ) ; / / make a request ResponseEntity < String > response = new RestTemplate ( ) .exchange ( url , HttpMethod. GET , request , String .class ) ; / / get JSON response String json = response.getBody ( ) ; } catch ( Exception ex ) { ex.printStackTrace ( ) ; } Example 2: resttemplate authorization basic HttpHeaders createHeaders ( String username ,

Bonitasoft Bpm Vs JBPM Vs Activiti

Answer : I did such a research, too. Here are the key-points which were relevant for our concrete use case: 1. Bonita: Bonita has a zero-coding approach which means that they provide an easy to use IDE to build your processes without the need for coding. To achieve that, Bonita has the concept of connectors . For example, if you want to consume a web service, they provide you with a graphical wizzard. The downside is that you have to write the plain XML SOAP-envelope manually and copy it in a graphical textbox. The problem with this approach is that you only can realize use cases which are intended by Bonita. If you want to integrate a system which Bonita did not developed a connector for, you have to code such a connector on your own which is very painful. For example, Bonita offers a SOAP connector for consuming SOAP web services. This connector only works with SOAP 1.2, but not for SOAP 1.1 (http://community.bonitasoft.com/answers/consume-soap-11-webservices-bonita-secure-web

Bootstrap Util.js Cdn Code Example

Example 1: bootstrap cdn link < ! - - Latest compiled and minified CSS - -> < link rel = "stylesheet" href = "https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity = "sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin = "anonymous" > < ! - - Optional theme - -> < link rel = "stylesheet" href = "https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap-theme.min.css" integrity = "sha384-rHyoN1iRsVXV4nD0JutlnGaslCJuC7uwjduW9SVrLvRYooPp2bWYgmgJQIXwl/Sp" crossorigin = "anonymous" > < ! - - Latest compiled and minified JavaScript - -> < script src = "https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js" integrity = "sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa" crossorigin = "anonymous" > < / script > Example 2: b

Can A Div Have Multiple Classes (Twitter Bootstrap)

Answer : Sure, a div can have as many classes as you want (this is both regarding to bootstrap and HTML in general): <div class="active dropdown-toggle"></div> Just separate the classes by space. Also: Keep in mind some bootstrap classes are supposed to be used for the same stuff but in different cases (for example alignment classes, you might want something aligned left, right or center, but it has to be only one of them) and you shouldn't use them together, or you'd get an unexpected result, basically what will happen is that the class with the highest specificity will be the one applied (or if they have the same then it'll be the one that's defined last on the CSS). So you better avoid doing stuff like this: <p class="text-center text-left">Some text</p> Absolutely, divs can have more than one class and with some Bootstrap components you'll often need to have multiple classes for them to function as you w

Arduino If Else If Code Example

Example 1: arduino what is #if The #if condition is evaluated only at compile time. The "if" is evaluated at run time. Example 2: if arduino if (x > 120) { digitalWrite(LEDpin, HIGH); } if (x > 120) { digitalWrite(LEDpin, HIGH); } if (x > 120) { digitalWrite(LEDpin, HIGH); } if (x > 120) { digitalWrite(LEDpin1, HIGH); digitalWrite(LEDpin2, HIGH); } // Alle Anweisungen sind korrekt Example 3: if arduino if (condition) { //statement(s) } Example 4: arduino if else if (condition1) { // do Thing A } else if (condition2) { // do Thing B } else { // do Thing C } Example 5: if arduino pinMode(LED_BUILTIN, OUTPUT);

An Application To Easily Pick A Color In Mac OS X And Get The Hex Value

Image
Answer : OS X comes with DigitalColor Meter: Applications > Utilities > DigitalColor Meter.app It has many options and preferences. command+shift+c will copy the color under the cursor to the clipboard in many different formats. The Mac OS X color picker is extensible. Use Hex Color Picker to add a tab that provides you the configured color in hexadecimal RGB. Just run e.g. TextEdit and press Cmd-Shift-C to open the color picker, or run your standalone program. An even more versatile color picker is Developer Color Picker with many different output formats, one of which is hexadecimal. This is easily done with AppleScript. A complete working example of code is available here.

Best Way To Parse Float?

Answer : I agree with leppie's reply; to put that in terms of code: string s = "123,456.789"; float f = float.Parse(s, CultureInfo.InvariantCulture); Depends where the input is coming from. If your input comes from the user, you should use the CultureInfo the user/page is using (Thread.CurrentThread.CurrentUICulture). You can get and indication of the culture of the user, by looking at the HttpRequest.UserLanguages property. (Not correct 100%, but I've found it a very good first guess) With that information, you can set the Thread.CurrentThread.CurrentUICulture at the start of the page. If your input comes from an internal source, you can use the InvariantCulture to parse the string. The Parse method is somewhat easier to use, if your input is from a controlled source. That is, you have already validated the string. Parse throws a (slow) exception if its fails. If the input is uncontrolled, (from the user, or other Internet source) the TryParse looks b

Can I Apply A CSS Transition On Hover-out Only?

Answer : Here's one way to achieve this (put a bogus property none for transition property in :hover ): #inner2{ opacity:0; transition:opacity 2000ms; } #outer:hover #inner2{ opacity:1; transition:none; } http://jsfiddle.net/j716sbav/4/ Answer updated to incorporate @BoltClock's suggestion. Putting none instead of a bogus property is definitely more elegant. If you prefer not to specify the transition property more than once, you can apply the transition to :not(:hover) , but the caveat is that you need to swap all of the other declarations as well: #inner2{ opacity:1; } #outer:not(:hover) #inner2{ opacity:0; transition:opacity 2000ms; } Either of these will work, but if you don't want to deal with confusing inversions, stick with overriding via transition: none . Also note that CSS selectors represent states and not events, which means that it utilizes a :hover state rather than mouseover and mouseout events; however, a tra

Bootstrap Modal Not Showing Code Example

Example 1: bootstrap show modal on page load < script type = "text/javascript" > $ ( window ) . on ( 'load' , function ( ) { $ ( '#myModal' ) . modal ( 'show' ) ; } ) ; < / script > Example 2: bootstrap modal not close $ ( '#MymodalPreventScript' ) . modal ( { backdrop : 'static' , keyboard : false } ) ; Example 3: .show() and .hide not working for bootstrap modal < button class = "button primary" id = "buy" style = "text-decoration:none;" type = "button" > Review and confirm < / button > < div class = "modal-bootstrap fade bs-example-modal-sm" id = "myModal" tabindex = "-1" role = "dialog" aria - labelledby = "smallModalLabel" aria - hidden = "true" > < ! -- modal contents -- > < / div > < script type = "text/javascript&q

Sql Oracle Left String Code Example

Example 1: plsql left() function SUBSTR ( "20190601" , 0 , 6 ) Example 2: Subtr Oracle ? /*Using SUBSTR in Oracle (Example from hackerrank.com): */ /*Simple select query...*/ SELECT DISTINCT city FROM station /*Using WHERE and SUBSTR to find (distinct) cities in station table that begin as well as end with a vowel.*/ WHERE SUBSTR ( city , 1 , 1 ) IN ( 'A' , 'E' , 'I' , 'O' , 'U' ) AND substr ( city , - 1 ) IN ( 'a' , 'e' , 'i' , 'o' , 'u' ) ; /*Parameters for SUBSTR (Substring) in order are as follows: String, Start, Length.*/

Whatsapp Floating-button Codepen Code Example

Example 1: how to add floating whatspp icon < link rel = "stylesheet" href = "https://maxcdn.bootstrapcdn.com/font-awesome/4.5.0/css/font-awesome.min.css" > < a href = "https : //api.whatsapp.com/send? phone = 7310747066 & text = Hola % information % . " class = "float" target = "_blank" > < i class = "fa fa-whatsapp my-float" > < / i > < / a > < ! -- CSS -- > < style > . float { position : fixed ; width : 60 px ; height : 60 px ; bottom : 40 px ; right : 40 px ; background - color : # 25 d366 ; color : #FFF ; border - radius : 50 px ; text - align : center ; font - size : 30 px ; box - shadow : 2 px 2 px 3 px # 999 ; z - index : 100 ; } . my - float { margin - top : 16 px ; } < / style > Example 2: floating whatsapp button html < script type = "text/javascript" src = "jquery-3.3.1

Can You Use Canvas.getContext('3d')? If Yes, How?

Answer : There is a 3D context for canvas, but it is not called "3d", but WebGL ("webgl"). WebGL should be available in the most up-to-date versions of all browsers. Use: <!DOCTYPE html> <html> <body> <canvas id='c'></canvas> <script> var c = document.getElementById('c'); var gl = c.getContext('webgl') || c.getContext("experimental-webgl"); gl.clearColor(0,0,0.8,1); gl.clear(gl.COLOR_BUFFER_BIT); </script> </body> </html> how could you use that? I tried 3D before, but didn't really understand if you think "real" languages are difficult, you will have a lot of trouble with WebGL. In some respects it is quite high level, in other respects it is quite low level. You should brush up on your maths(geometry) and prepare for some hard work. three.js is a very appreciated library that allows you to do yet a lot of 3d without dealing wit

Add Blank Line In Latex Code Example

Example: latex add empty line \hfill \break

Can I Change The Height Of An Image In CSS :before/:after Pseudo-elements?

Answer : Adjusting the background-size is permitted. You still need to specify width and height of the block, however. .pdflink:after { background-image: url('/images/pdf.png'); background-size: 10px 20px; display: inline-block; width: 10px; height: 20px; content:""; } See the full Compatibility Table at the MDN. Note that the :after pseudo-element is a box, which in turn contains the generated image. There is no way to style the image, but you can style the box. The following is just an idea, and the solution above is more practical. .pdflink:after { content: url('/images/pdf.png'); transform: scale(.5); } http://jsfiddle.net/Nwupm/ Drawbacks: you need to know the intrinsic dimensions of the image, and it leaves you with some whitespace, which I can't get rid of ATM. Since my other answer was obviously not well understood, here's a second attempt: There's two approaches to answer the question.

Bootstrap Multiselect - De-select / Uncheck All Options In A Single Click

Answer : You can use .multiselect('refresh') method as mentioned in the bootstrap-multiselect documentation here. So, add an HTML button / icon next to the multi-select select list and then use the below code: $("#reset_client").click(function(){ $('option', $('#select_client')).each(function(element) { $(this).removeAttr('selected').prop('selected', false); }); $("#select_client").multiselect('refresh'); }); <select name="clients[]" multiple="multiple" id="select_client" style="display: none;"> <option value="multiselect-all"> Select all</option> <option value="1">Client 1</option> <option value="2">Client 2</option> <option value="3">Client 3</option> <option selected="selected" value="4">Client 4</option> &l