Posts

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...

Cannot Access Repo.spring.io For Spring-boot Exercises

Answer : repo.spring.io lazily caches the contents of Maven Central. You don't say which dependency it is that's causing a problem, but I believe the problem that you're seeing is that you're attempting to access an artifact that has yet to be cached. This will result in a 401 response. Trying adding mavenCentral() to the configured repositories in build.gradle . For example: repositories { mavenCentral() maven { url "https://repo.spring.io/milestone" } } repo.spring.io is no longer serving through plain http. Check your gradle (pom.xml, etc) file for http://repo.spring.io and change it to https://repo.spring.io The relevant maven error message is similar to this: [ERROR] Failed to execute goal org.apache.maven.plugins:maven-site-plugin:3.8.2:site (default-site) on project tidy-up: SiteToolException: The site descriptor cannot be resolved from the repository: ArtifactResolutionException: Unable to locate site descriptor: Could not transfer a...

Memcpy Arduino Code Example

Example: c memcpy int dst [ ARRAY_LENGTH ] ; memcpy ( dst , src , sizeof ( dst ) ) ; // Good, sizeof(dst) returns sizeof(int) * ARRAY_LENGTH

Change Value In Ini File Using ConfigParser Python

Answer : As from the examples of the documentation: https://docs.python.org/2/library/configparser.html parser.set('SETTINGS', 'value', '15') # Writing our configuration file to 'example.ini' with open('example.ini', 'wb') as configfile: parser.write(configfile)

Fontawesome.com Cdn Code Example

Example 1: fontawesome cdn < link href = "https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.13.0/css/all.min.css" rel = "stylesheet" > Example 2: font awesome cdn < link rel = "stylesheet" href = "https://pro.fontawesome.com/releases/v5.10.0/css/all.css" integrity = "sha384-AYmEC3Yw5cVb3ZcuHtOA93w35dYTsvhLPVnYs9eStHfGJvOvKxVfELGroGkvsg+p" crossorigin = "anonymous" / > Example 3: font awesome 4.7 cdn < link rel = "stylesheet" href = "https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css" integrity = "sha256-eZrrJcwDc/3uDhsdt61sL2oOBY362qM3lon1gyExkL0=" crossorigin = "anonymous" / > Example 4: font awesome icons cdn To load all styles : < link rel = "stylesheet" href = "https://pro.fontawesome.com/releases/v5.10.0/css/all.css" integrity = "sha384-AYmEC3Yw5cVb3ZcuHtOA93w35dYTsvhLPVnYs9eStHfG...

Author Uthm Code Example

Example: author of namesake Console.Writeline("Hello world.");

Append An Array Java Code Example

Example 1: how to append to an array in java import java.util.Arrays; class ArrayAppend { public static void main( String args[] ) { int[] arr = { 10, 20, 30 }; System.out.println(Arrays.toString(arr)); arr = Arrays.copyOf(arr, arr.length + 1); arr[arr.length - 1] = 40; // Assign 40 to the last element System.out.println(Arrays.toString(arr)); } } Example 2: java array add element // A better solution would be to use an ArrayList which can grow as you need it. // The method ArrayList.toArray( T[] a ) // gives you back your array if you need it in this form. List < String > where = new ArrayList < String > (); where.add(element); where.add(element); // If you need to convert it to a simple array... String[] simpleArray = new String[ where.size() ]; where.toArray( simpleArray ); Example 3: java add element to existing array //original array String[] rgb = new String[] {"red", "green"}; //new array with ...

C Read Binary Stdin

Answer : What you need is freopen() . From the manpage: If filename is a null pointer, the freopen() function shall attempt to change the mode of the stream to that specified by mode, as if the name of the file currently associated with the stream had been used. In this case, the file descriptor associated with the stream need not be closed if the call to freopen() succeeds. It is implementation-defined which changes of mode are permitted (if any), and under what circumstances. Basically, the best you can really do is this: freopen(NULL, "rb", stdin); This will reopen stdin to be the same input stream, but in binary mode. In the normal mode, reading from stdin on Windows will convert \r\n (Windows newline) to the single character ASCII 10. Using the "rb" mode disables this conversion so that you can properly read in binary data. freopen() returns a filehandle, but it's the previous value (before we put it in binary mode), so don't use i...

Angular Material Icons Not Working

Answer : Add CSS stylesheet for Material Icons! Add the following to your index.html: <link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet"> Refer - https://github.com/angular/material2/issues/7948 For Angular 6+: npm install this: npm install material-design-icons add the styles to angular.json: "styles": [ "node_modules/material-design-icons/iconfont/material-icons.css" ] If using SASS you only need to add this line to your main .scss file: @import url("https://fonts.googleapis.com/icon?family=Material+Icons"); If you prefer to avoid fetching icons from google you can also self-host the icons as described in Material Icons Guide: For those looking to self host the web font, some additional setup is necessary. Host the icon font in a location, for example https://example.com/material-icons.woff and add the following CSS rule: @font-face { font-family: '...

Best Way To Make WPF ListView/GridView Sort On Column-header Clicking?

Answer : I wrote a set of attached properties to automatically sort a GridView , you can check it out here. It doesn't handle the up/down arrow, but it could easily be added. <ListView ItemsSource="{Binding Persons}" IsSynchronizedWithCurrentItem="True" util:GridViewSort.AutoSort="True"> <ListView.View> <GridView> <GridView.Columns> <GridViewColumn Header="Name" DisplayMemberBinding="{Binding Name}" util:GridViewSort.PropertyName="Name"/> <GridViewColumn Header="First name" DisplayMemberBinding="{Binding FirstName}" util:GridViewSort.PropertyName="FirstName"/> <GridViewColumn Header="Date of birth" ...

Apply A Greasemonkey/Tampermonkey/userscript To An Iframe?

Answer : In Greasemonkey (And Tampermonkey and most userscript engines) a script will fire on an iframe automatically if it meets the @include, @exclude, and/or @match directives. And, a popular question is how to stop Greasemonkey from firing on iframes. So, if your script had a match like: @match https://fiddle.jshell.net/* It would fire on jsFiddle "output" pages whether or not they appeared in an iframe. If you wanted to fire on a JUST iframed content: Then you would check the window.self property. For example, suppose you had a target page like: <body> <h1>I'm some webpage, either same-domain or not.</h1> <iframe src="//domain_B.com/somePath/somePage.htm"> ... Then you could use a script like: // ==UserScript== // @name _Fires specially on domain_B.com iframes // @match *://domain_B.com/somePath/* // ==/UserScript== if (window.top === window.self) { //--- Script is on domain_B.com when/if it is the M...

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...

Associate A Private Key With The X509Certificate2 Class In .net

Answer : You can save yourself the hassle of copy-pasting all that code and store the private key next to the certificate in a pfx / pkcs#12 file: openssl pkcs12 -export -in my.cer -inkey my.key -out mycert.pfx You'll have to supply a password, which you have to pass to the constructor of X509Certificate2 : X509Certificate2 cert = new X509Certificate2("mycert.pfx","password"); For everyone else with the same problem, I found a neat little piece of code that let's you do exactly that: http://www.codeproject.com/Articles/162194/Certificates-to-DB-and-Back byte[] certBuffer = Helpers.GetBytesFromPEM(publicCert, PemStringType.Certificate); byte[] keyBuffer = Helpers.GetBytesFromPEM(privateKey, PemStringType.RsaPrivateKey); X509Certificate2 certificate = new X509Certificate2(certBuffer, password); RSACryptoServiceProvider prov = Crypto.DecodeRsaPrivateKey(keyBuffer); certificate.PrivateKey = prov; EDIT: The code for the Helper method (which ot...

Switch Case Range Arduino Code Example

Example: arduino switch case switch ( var ) { case label1 : // statements break ; case label2 : // statements break ; default : // statements break ; }

Archive Artifacts In Jenkins

Answer : You cannot remove the 'prefix' of a path using just the archive artifacts setting. (Some of the upload extensions do support this - the Publish over FTP plugin for example) If you really need this a simple solution is to add an extra build step that copies your Debug folder to the root of the project workspace. A cleaner way might be to have a stage dedicated to producing artifacts, set up with the appropriate working directory: stage('Release') { steps { dir('MyApp1/MyApp1/bin/Debug') { archiveArtifacts artifacts: '**', fingerprint: true } } }

Cannot Open Source File "iostream.h"C/C++ Code Example

Example: cannot open source file "iostream" //include paths gcc -v -E -x c++ -