Posts

Showing posts from June, 2017

Bootstrap Online Link Code Example

Example: bootstrap link < link rel = " stylesheet " href = " https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/css/bootstrap.min.css " integrity = " sha384-Vkoo8x4CGsO3+Hhxv8T/Q5PaXtkKtu6ug5TOeNV6gBiFeWPGFN9MuhOf23Q9Ifjh " crossorigin = " anonymous " >

Changing Host Permissions For MySQL Users

Answer : Solution 1: If you've got access to the mysql database, you can change the grant tables directly: UPDATE mysql.user SET Host='%' WHERE Host='localhost' AND User='username'; ...and an analogous UPDATE -statement to change it back. Also you might need to make changes to the mysql.db table as well: UPDATE mysql.db SET Host='%' WHERE Host='localhost' AND User='username'; and then flush to apply the privileges: FLUSH PRIVILEGES; Solution 2: Best answer on Stackoverflow suggesting to use RENAME USER which copy the user privileges. Using Data Control Language (statements as GRANT, REVOKE, RENAME and so on) does not require FLUSH PRIVILEGES; and is required in architecture like Galera or Group Replication in MySQL versions having MyISAM tables in mysql database because MyISAM tables are not replicated. Solution 3: I stumbled across this one, too, and the proposed solution didn't work, since the datab

Can I Use .NET Reflector To Modify & Recompile The Code Quickly?

Answer : You can probably use the Reflexil add-in for Reflector to do that: Reflexil is an assembly editor and runs as a plug-in for Reflector. Using Mono.Cecil, Reflexil is able to manipulate IL code and save the modified assemblies to disk. Reflexil also supports 'on the fly' C# and VB.NET code injection. It's possible with .Net reflector along with reflexil. First download reflexiil and then open .net relector and load the reflexil into it using View->addins->select the reflexil file(all dlls) and then load. After that open the required dll file and go to tools->select reflectil, open the code and identify the required item, then edit..give to the assemblyy and select save as to save it to new file .NET Reflector cannot do this, but other tools can decompile .NET assemblies, for example FileDisassembler (an add-in for .NET Reflector).

Arduino Read Digital Input Code Example

Example: arduino digital read int ledPin = 13 ; // LED connected to digital pin 13 int inPin = 7 ; // pushbutton connected to digital pin 7 int val = 0 ; // variable to store the read value void setup ( ) { pinMode ( ledPin , OUTPUT ) ; // sets the digital pin 13 as output pinMode ( inPin , INPUT ) ; // sets the digital pin 7 as input } void loop ( ) { val = digitalRead ( inPin ) ; // read the input pin digitalWrite ( ledPin , val ) ; // sets the LED to the button's value }

Background Colour Opacity Css Code Example

Example 1: css opacity background color background: rgba(255, 255, 255, 0.25); Example 2: background color with opacity h1 {background-color:rgba(255,0,0,0.3);} Example 3: background opacity css hex background-color: #ff000088; <--- the 88 is the alpha background-color: #ff0000 50%; Example 4: background color opacity rgba(51, 170, 51, .1) /* 10% opaque green */ rgba(51, 170, 51, .4) /* 40% opaque green */ rgba(51, 170, 51, .7) /* 70% opaque green */ rgba(51, 170, 51, 1) /* full opaque green */

Changing Theme In Apache Netbeans 9.0

Image
Answer : Updated 4/11/19: Based on a comment from @superbiji below, Darcula + Norway Today works fine with NetBeans 11.0 . Updated 2/7/19: Note that the answer below applies only to NetBeans 9.0 . The situation is a little different on NetBeans 10.0 where the Dark Look and Feel plugin (themes "Dark Metal" and "Dark Nimbus") also worked fine. See Projects, Files, Services, Navigator color background. I tried to download then manually install those two plugins on NetBeans 9.0, but it didn't work for me: Download the plugins as zip files, and unzip them. Tools > Plugins > click the Downloaded tab > click Add Plugins... The Add Plugins dialog opens, but it requires you to select a jar or nbm file, and no files of those types exist in the downloaded zip files. However, there is an alternative approach that works for Darcula (but not for Dark Look And Feel Themes ). It is a simple two step process: Make the Darcula plugin av

Can (domain Name) Subdomains Have An Underscore "_" In It?

Answer : Most answers given here are false . It is perfectly legal to have an underscore in a domain name. Let me quote the standard, RFC 2181, section 11, "Name syntax": The DNS itself places only one restriction on the particular labels that can be used to identify resource records. That one restriction relates to the length of the label and the full name. [...] Implementations of the DNS protocols must not place any restrictions on the labels that can be used. In particular, DNS servers must not refuse to serve a zone because it contains labels that might not be acceptable to some DNS client programs. See also the original DNS specification, RFC 1034, section 3.5 "Preferred name syntax" but read it carefully. Domains with underscores are very common in the wild. Check _jabber._tcp.gmail.com or _sip._udp.apnic.net . Other RFC mentioned here deal with different things. The original question was for domain names . If the question is for

Are "elseif" And "else If" Completely Synonymous?

Answer : From the PHP manual: In PHP, you can also write 'else if' (in two words) and the behavior would be identical to the one of 'elseif' (in a single word). The syntactic meaning is slightly different (if you're familiar with C, this is the same behavior) but the bottom line is that both would result in exactly the same behavior. Essentially, they will behave the same, but else if is technically equivalent to a nested structure like so: if (first_condition) { } else { if (second_condition) { } } The manual also notes: Note that elseif and else if will only be considered exactly the same when using curly brackets as in the above example. When using a colon to define your if/elseif conditions, you must not separate else if into two words, or PHP will fail with a parse error. Which means that in the normal control structure form (ie. using braces): if (first_condition) { } elseif (second_condition) { } either elseif or else

Circular Import Dependency In Python

Answer : You may defer the import, for example in a/__init__.py : def my_function(): from a.b.c import Blah return Blah() that is, defer the import until it is really needed. However, I would also have a close look at my package definitions/uses, as a cyclic dependency like the one pointed out might indicate a design problem. If a depends on c and c depends on a, aren't they actually the same unit then? You should really examine why you have split a and c into two packages, because either you have some code you should split off into another package (to make them both depend on that new package, but not each other), or you should merge them into one package. I've wondered this a couple times (usually while dealing with models that need to know about each other). The simple solution is just to import the whole module, then reference the thing that you need. So instead of doing from models import Student in one, and from models import Classroom in the

Auto Indent Shortcut Visual Studio Code Code Example

Example: visual studio code auto indent On Windows Shift + Alt + F On Mac Shift + Option + F On Ubuntu Ctrl + Shift + I

Anchor Jumping By Using Javascript

Answer : You can get the coordinate of the target element and set the scroll position to it. But this is so complicated. Here is a lazier way to do that: function jump(h){ var url = location.href; //Save down the URL without hash. location.href = "#"+h; //Go to the target element. history.replaceState(null,null,url); //Don't like hashes. Changing it back. } This uses replaceState to manipulate the url. If you also want support for IE, then you will have to do it the complicated way: function jump(h){ var top = document.getElementById(h).offsetTop; //Getting Y of target element window.scrollTo(0, top); //Go there directly or some transition }​ Demo: http://jsfiddle.net/DerekL/rEpPA/ Another one w/ transition: http://jsfiddle.net/DerekL/x3edvp4t/ You can also use .scrollIntoView : document.getElementById(h).scrollIntoView(); //Even IE6 supports this (Well I lied. It's not

Check Open Port Ubuntu Code Example

Example 1: linux how to see ports in use # Any of the following sudo lsof - i - P - n | grep LISTEN sudo netstat - tulpn | grep LISTEN sudo lsof - i : 22 # see a specific port such as 22 sudo nmap - sTU - O IP - address - Here Example 2: ubuntu check process on port sudo lsof - i : 22 Example 3: ubuntu open port sudo ufw allow 1191 / tcp Example 4: how to check list of open ports in linux sudo lsof - i - P - n | grep LISTEN sudo netstat - tulpn | grep LISTEN sudo lsof - i : 22 # see a specific port such as 22 sudo nmap - sTU - O IP - address - Here Example 5: see what is using a port ubuntu $ sudo lsof - i : 22 Example 6: check what ports are open linux ## if you use linux sudo ss - tulw

Among Us Minecraft Mod Code Example

Example: among us mods Please dm Fighter x Yt#6699 on discord for popular and awesome mods we have mods like mind ocntrol, thanos etc dm me now!

320 Youtube To Mp3 Converter Code Example

Example: youtube mp3 converter You can use WebTools , it's an addon that gather the most useful and basic tools such as a synonym dictionary , a dictionary , a translator , a youtube convertor , a speedtest and many others ( there are ten of them ) . You can access them in two clics , without having to open a new tab and without having to search for them ! - Chrome Link : https : //chrome.google.com/webstore/detail/webtools/ejnboneedfadhjddmbckhflmpnlcomge/ Firefox link : https : //addons.mozilla.org/fr/firefox/addon/webtools/

"-bash: Gcc: Command Not Found" Using Cygwin When Compiling C?

Image
Answer : You can install gcc by running setup-x86.exe or setup-x86_64.exe again. The gcc package is in the Devel category: Then you must go to System properties, System variables, and append the path to "C:\cygwin64\bin" in PATH If you have already added the gcc package you want you may also need to setup a symbolic link to a different gcc.exe binary. For example: $cd /usr/bin/ $ln -s i686-pc-cygwin-gcc.exe gcc $which gcc $/usr/bin/gcc You can add the gcc package through the 'Add Package' batch file.

Codecogs Latex Code Example

Example 1: latex code \ documentclass { article } \ usepackage [ utf8 ] { inputenc } \ usepackage { listings } \ usepackage { xcolor } \ definecolor { codegreen } { rgb } { 0,0 .6,0 } \ definecolor { codegray } { rgb } { 0.5 ,0.5,0.5 } \ definecolor { codepurple } { rgb } { 0.58 ,0,0.82 } \ definecolor { backcolour } { rgb } { 0.95 ,0.95,0.92 } \ lstdefinestyle { mystyle } { backgroundcolor = \ color { backcolour } , commentstyle = \ color { codegreen } , keywordstyle = \ color { magenta } , numberstyle = \ tiny \ color { codegray } , stringstyle = \ color { codepurple } , basicstyle = \ ttfamily \ footnotesize, breakatwhitespace = false, breaklines = true, captionpos = b, keepspaces = true, numbers = left, numbersep = 5pt, showspaces = false, showstringspaces = false, showtabs = false,

Bundle Install Returns "Could Not Locate Gemfile"

Answer : You just need to change directories to your app, THEN run bundle install :) You may also indicate the path to the gemfile in the same command e.g. BUNDLE_GEMFILE="MyProject/Gemfile.ios" bundle install I had this problem as well on an OSX machine. I discovered that rails was not installed... which surprised me as I thought OSX always came with Rails. To install rails sudo gem install rails to install jekyll I also needed sudo sudo gem install jekyll bundler cd ~/Sites jekyll new <foldername> cd <foldername> OR cd !$ (that is magic ;) bundle install bundle exec jekyll serve Then in your browser just go to http://127.0.0.1:4000/ and it really should be running

Add Data To The End Of A Behavior Object Array Angular 5

Answer : You can add a new method to your service like addData in which you can combine your previous data with new data like. import {Injectable} from '@angular/core'; import {BehaviorSubject} from 'rxjs/BehaviorSubject'; @Injectable() export class UserService { userDataSource: BehaviorSubject<Array<any>> = new BehaviorSubject([]); userData = this.userDataSource.asObservable(); updateUserData(data) { this.userDataSource.next(data); } addData(dataObj) { const currentValue = this.userDataSource.value; const updatedValue = [...currentValue, dataObj]; this.userDataSource.next(updatedValue); } } For someone that may come accross this issue with a BehaviorSubject<YourObject[]> . I found in this article a way to properly add the new array of YourObject import { Observable, BehaviorSubject } from 'rxjs'; import { YourObject} from './location'; import { Injectable } from &#

Check Php Version Mac Os Code Example

Example: check php version mac In terminal write: > php -v

Alphabetical Sorting Of A Sequence Of Names

Image
Answer : Bubble sorter, which I adapt from my modification to David's answer to my question at Trying to eliminate stack overflow during recursion. The \sortlist macro is the bubble sorter (from the referenced answer, but with and rather than , as the list seperator). However, it leaves the result in the form of Last Name, First and ... . I had to add the \rework macro to make it First Last Name and employ \whichsep to choose whether a , or and should be inserted between names, depending on their placement in the list. No packages required! \documentclass[10pt]{article} \newcommand\alphabubblesort[1]{\def\sortedlist{}% \expandafter\sortlist#1 and \cr and \relax \expandafter\rework\sortedlist and \relax} \def\sortlist#1and #2and #3\relax{% \let\next\relax \ifx\cr#2\relax% \edef\sortedlist{\sortedlist#1}% \else \picknext#1!and #2!\relax% \if F\flipflop% \edef\sortedlist{\sortedlist#1and }% \def\next{\sortlist#2and #3\relax}% \else