Posts

Showing posts from February, 2013

Angular Material And Changing Fonts

Answer : You can use the CSS universal selector ( * ) in your CSS or SCSS : * { font-family: Raleway /* Replace with your custom font */, sans-serif !important; /* Add !important to overwrite all elements */ } Starting from Angular Material v2.0.0-beta.7 , you can customise the typography by creating a typography configuration with the mat-typography-config function and including this config in the angular-material-typography mixin: @import '~@angular/material/theming'; $custom-typography: mat-typography-config( $font-family: 'Raleway' ); @include angular-material-typography($custom-typography); Alternatively ( v2.0.0-beta.10 and up): // NOTE: From `2.0.0-beta.10`, you can now pass the typography via the mat-core() mixin: @import '~@angular/material/theming'; $custom-typography: mat-typography-config( $font-family: 'Raleway' ); @include mat-core($custom-typography); Refer to Angular Material's typography documentation for more

Error: Expected Declaration Or Statement At End Of Input } In C Code Example

Example: error: expected declaration or statement at end of input /*Normally that error occurs when a } was missed somewhere in the code*/

Bring Home The Beacon Minecraft Code Example

Example 1: blocks for beacon to make a full powered beacon you need 164 blocks of any type of goodie Example 2: full beacon size who ever typed the answer in grepper answer is a legend

Apt Get Php Code Example

Example: apt install php # Update packages lists sudo apt update # Install Apache2 (on Ubuntu, mostly it's already installed) sudo apt install apache2 # Install the latest version of PHP and Apache wrapper sudo apt install php libapache2 - mod - php # Install some important PHP extensions, you might need to install more later sudo apt install php - { bcmath , bz2 , curl , gd , json , mbstring , mysql , xml , zip } # Install MySQL server, and remember to run mysql_secure_installation script after that sudo apt install mysql - server # Start MySQL service sudo systemctl start mysql # Restart Apache service to reload all changes sudo systemctl restart apache2

Bootstrap Align Text Center Code Example

Example 1: centre text bootstrap < div class = " text-center " > < p > hello world </ p > </ div > Example 2: font weight bootstrap class < p class = " font-weight-bold " > Bold text. </ p > < p class = " font-weight-normal " > Normal weight text. </ p > < p class = " font-weight-light " > Light weight text. </ p > < p class = " font-italic " > Italic text. </ p > Example 3: text align center bootstrap < p class = " text-left " > Left aligned text on all viewport sizes. </ p > < p class = " text-center " > Center aligned text on all viewport sizes. </ p > < p class = " text-right " > Right aligned text on all viewport sizes. </ p > < p class = " text-sm-left " > Left aligned text on viewports sized SM (small) or wider. </ p > < p class = &qu

Android - Can I Enable USB Debugging Using Adb?

Answer : I got it to work :) NOTE : This requires unlocked bootloader. Connect the device to Mac or PC in recovery mode . (I had to map the process in my mind as the screen was broken). Now open terminal/CMD in computer and go to platform-tools/ . type and enter ./adb devices to check if the device is connected in recovery mode. Now type ./adb shell mount data and ./adb shell mount system to mount the respective directories. Get the persist.sys.usb.config file in your system using ./adb pull /data/property/persist.sys.usb.config /Your directory Now open that file in a texteditor and edit it to mtp,adb and save. Now push the file back in the device; ./adb push /your-directory/persist.sys.usb.config /data/property Get the build.prop file; ./adb pull /system/build.prop /your-directory Add these lines: persist.service.adb.enable=1 persist.service.debuggable=1 persist.sys.usb.config=mtp,adb Push build.prop back into

How To Update Node On Ubuntu Code Example

Example 1: updating node js ubuntu curl - sL https : //deb.nodesource.com/setup_14.x | sudo -E bash - sudo apt - get install - y nodejs Example 2: update node ubuntu sudo npm cache clean - f sudo npm install - g n sudo n stable Example 3: upgrade node ubuntu sudo npm cache clean - f sudo npm install - g n sudo n stable Example 4: update npm ubuntu update npm ubuntu Example 5: upgrade nodejs ubuntu npm cache clean - f Example 6: ubuntu update nodejs # Using Ubuntu curl - sL https : //deb.nodesource.com/setup_12.x | sudo -E bash - sudo apt - get install - y nodejs # Using Debian , as root curl - sL https : //deb.nodesource.com/setup_12.x | bash - apt - get install - y nodejs

Check If Object Exists In JavaScript

Answer : You can safely use the typeof operator on undefined variables. If it has been assigned any value, including null, typeof will return something other than undefined. typeof always returns a string. Therefore if (typeof maybeObject != "undefined") { alert("GOT THERE"); } There are a lot of half-truths here, so I thought I make some things clearer. Actually you can't accurately tell if a variable exists (unless you want to wrap every second line into a try-catch block). The reason is Javascript has this notorious value of undefined which strikingly doesn't mean that the variable is not defined, or that it doesn't exist undefined !== not defined var a; alert(typeof a); // undefined (declared without a value) alert(typeof b); // undefined (not declared) So both a variable that exists and another one that doesn't can report you the undefined type. As for @Kevin's misconception, null == undefined . It is due to type c

Alpine Linux Install Package Code Example

Example 1: apk add apk-tools 2.8.2, compiled for x86_64. usage: apk COMMAND [-h|--help] [-p|--root DIR] [-X|--repository REPO] [-q|--quiet] [-v|--verbose] [-i|--interactive] [-V|--version] [-f|--force] [--force-binary-stdout] [--force-broken-world] [--force-non-repository] [--force-old-apk] [--force-overwrite] [--force-refresh] [-U|--update-cache] [--progress] [--progress-fd FD] [--no-progress] [--purge] [--allow-untrusted] [--wait TIME] [--keys-dir KEYSDIR] [--repositories-file REPOFILE] [--no-network] [--no-cache] [--cache-dir CACHEDIR] [--arch ARCH] [--print-arch] [ARGS]... The following commands are available: add Add PACKAGEs to 'world' and install (or upgrade) them, while ensuring that all dependencies are met del Remove PACKAGEs from 'world' and uninstall them fix Repair package or upgrade it without modifying main dependencies update Update repository indexes from all remote repositories info

Best Way To Describe Vector Vs Raster

Answer : I always say Raster records the pixels in the picture. Vector records the steps it took to draw the picture. So if you enlarge Raster you get a big picture with big pixels. If you enlarge Vector the computer follows the steps to redraw at higher resolution. If you have a chance to demo it for them, load up Word and put in 1 small (raster) image and 1 clip art. Then drag the corners to show what happens. You could even print out the before/after and hang it on your cube so you have something to point to. In layman's terms. Raster (I usually just say "bitmap" though) images record the colors in order. Blue, blue, blue, light blue, light blue, light blue... (At this point i'm pointing at a nearby object and reading colors on the top, left to right). Vector image is a description about an image. "A light blue circle 12cm across. A solid blue background. Then I explain how Rasters are better for photographs because that's h

Android: How Do I Get String From Resources Using Its Name?

Answer : The link you are referring to seems to work with strings generated at runtime. The strings from strings.xml are not created at runtime. You can get them via String mystring = getResources().getString(R.string.mystring); getResources() is a method of the Context class. If you are inside a Activity or a Service (which extend Context) you can use it like in this snippet. Also note that the whole language dependency can be taken care of by the android framework . Simply create different folders for each language. If english is your default language, just put the english strings into res/values/strings.xml . Then create a new folder values-ru and put the russian strings with identical names into res/values-ru/strings.xml . From this point on android selects the correct one depending on the device locale for you, either when you call getString() or when referencing strings in XML via @string/mystring . The ones from res/values/strings.xml are the fallback ones, if y

Can't Find Or Run Spotify After `snap Install Spotify`

Answer : Check your $PATH variable by executing in a Terminal: echo $PATH The output should be very similar to this: /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/usr/share/rvm/bin You have to verify if /snap/bin is included in this $PATH , otherwise you have to add it manually, here is how to do it: How do I modify my PATH so that the changes are available in every Terminal session. If this doesn't work, try deleting and installing again the snap, the required commands are: Execute sudo snap list to verify if Spotify is installed. Use sudo snap remove spotify to delete it. Use sudo snap install spotify to re-install it again. After installing it you can run the command which spotify to see if it is recognized now. Hope it helps, good luck! The solution is simple. Log out and log back in again. Same thing happened to me. It was the first time I had installed a snap app, and I expect that the $PATH

Cannot Find Module './in-memory-data-service' In Tour Of Heroes For Angular2

Answer : ng generate service InMemoryData --module=app Will create the src/app/in-memory-data.service.ts file. Then add the code listed in the tutorial and it will work. AFAIK they don't even imply that in the tutorial so don't feel bad. In fact what they say is The forRoot() configuration method takes an InMemoryDataService class that primes the in-memory database. The Tour of Heroes sample creates such a class src/app/in-memory-data.service.ts Which is gibberish and wrong. My projects created using current CLI Tools, and I installed this: npm install angular-in-memory-web-api --save It works for me. Just make sure all your bases are covered In your package.json , should match the one on this page. "angular-in-memory-web-api": "~0.1.1", Also, your systemjs.config file looks good too! In your app.module.ts , make sure that your in-memory-data-service import matches your file because in their example they have in-memory-data.service

Convertir Youtube A Mp3 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/

Alert Box Bootstrap 4 Classes Code Example

Example 1: bootstrap alerts Holy guacamole! You should check in on some of those fields below. × Example 2: bootstrap alert box Alerts in Bootstrap: -------------------------------- Alert classes you can use to check .alert-primary .alert-secondary .alert-success .alert-danger .alert-warning .alert-info .alert-light .alert-dark Simple alert: ------------- This is a primary alert—check it out! Alert with close button and decriptive feature: ------------------------------------------------ Holy guacamole! You should check in on some of those fields below. × Trigger via javascript: $(".alert").alert();

Awk + Print All Line Content Except $1

Answer : If you set $1 to "" you will leave the delimiting space. If you don't want to do that you have to iterate over the fields: awk '{for (f=2; f<=NF; ++f) { if (f!=2) {printf("%s",OFS);} printf("%s",$f)}; printf "\n" }' Edit: fixed per Gilles' comment. Another way to do the same thing: awk '{d = ""; for (f=2; f<=NF; ++f) {printf("%s%s", d, $f); d = OFS}; printf("\n") }' Somehow I think this would be so much easier and more intuitive to do with the cut command: echo /var/sysconfig/network/my_functions alpha beta gama | cut -d' ' -f 2- The only problem is that cut doesn't support multiple different types of whitespace at once for delimiters. So if you have spaces or tabs, it won't work.

Bootstrap Navigation Bar Templates Code Example

Example 1: bootstrap navigation bar < nav class = " navbar navbar-expand-lg navbar-light bg-light " > < a class = " navbar-brand " href = " # " > Navbar </ a > < button class = " navbar-toggler " type = " button " data-toggle = " collapse " data-target = " #navbarSupportedContent " aria-controls = " navbarSupportedContent " aria-expanded = " false " aria-label = " Toggle navigation " > < span class = " navbar-toggler-icon " > </ span > </ button > < div class = " collapse navbar-collapse " id = " navbarSupportedContent " > < ul class = " navbar-nav mr-auto " > < li class = " nav-item active " > < a class = " nav-link " href = " # " > Home < span class = " sr-only " > (current) &

Asp.net Mvc Dropdownlistfor Code Example

Example: razor dropdownlistfor @ using MyMVCApp . Models @model Student @Html . DropDownListFor ( m => m . StudentGender , new SelectList ( Enum . GetValues ( typeof ( Gender ) ) ) , "Select Gender" )

Blur Part Of Image In Imagemagick

Image
Answer : In ImageMagick, you can use any mask to limit the blur. Create a black and white mask image: black inside your quadrilateral and white elsewhere of the size of your image. Then use that as a mask for doing blurring. See http://www.imagemagick.org/Usage/masking/#read_mask. Input: (Unix syntax) convert \ logo.jpg \ \( -clone 0 -fill white -colorize 100 -fill black \ -draw "polygon 332,180 427,105 481,238 399,279" \ -alpha off -write mpr:mask +delete \) \ -mask mpr:mask -blur 0x5 +mask logo_blur.jpg Blurred Result Use -region http://www.imagemagick.org/Usage/masking/#region_warping convert a.png -region 150x150+599+261 -implode 1.5 +region b.png

Block Specific URL On Web Browsers

Answer : The answer will only SLIGHTLY differ by the operating system you are using. I'm running Ubuntu on a powerpc :p but in general the same rules apply on windows and mac as well. If these instructions do not work for you then I will adapt this answer for your OS. For now here is the Linux method. The only way I have found after hours of searching, to do this, is to install privoxy . Once you install privoxy you need to edit the /etc/privoxy/config file in the following manner: 1) Find where it says #listen-address localhost:8118 and uncomment this line so that it says listen-address localhost:8118 2) Add the following lines to the bottom of this config file: actionsfile blacklist.action actionsfile whitelist.action 3) Now you need to create these action files in a text editor as root: a) gksu gedit /etc/privoxy/blacklist.action and add the following { +block } www.apple.com/itunes twil.tv/category/video www.url.com/page anything you add under

Add Photo To Flutter App Code Example

Example: flutter asset image not showing flutter: uses-material-design: true assets: - assets/ class _UserLoginState extends State { @override Widget build(BuildContext context) { return Scaffold( body: Stack( children: [ Image(image: AssetImage("assets/christmas.jpeg"), fit: BoxFit.cover, ], ) ); } }

ASCII Vs Unicode + UTF-8

Answer : In modern times, ASCII is now a subset of UTF-8, not its own scheme. UTF-8 is backwards compatible with ASCII. Yes, except that UTF-8 is an encoding scheme. Other encoding schemes include UTF-16 (with two different byte orders) and UTF-32. (For some confusion, a UTF-16 scheme is called “Unicode” in Microsoft software.) And, to be exact, the American National Standard that defines ASCII specifies a collection of characters and their coding as 7-bit quantities, without specifying a particular transfer encoding in terms of bytes. In the past, it was used in different ways, e.g. so that five ASCII characters were packed into one 36-bit storage unit or so that 8-bit bytes used the extra bytes for checking purposes (parity bit) or for transfer control. But nowadays ASCII is used so that one ASCII character is encoded as one 8-bit byte with the first bit set to zero. This is the de facto standard encoding scheme and implied in a large number of specifications, but strictly s

Bootstrap Background Image Code Example

Example 1: full page background image html { background: url(images/bg.jpg) no-repeat center center fixed; -webkit-background-size: cover; -moz-background-size: cover; -o-background-size: cover; background-size: cover; } Example 2: html background image <!-- Code by Scratchy --> <!-- Twitter: @S_cratchy--> < head > < style > body { background-image : url ( https://wallup.net/wp-content/uploads/2019/09/110394-cats-grey-kittens-fluffy-fat-grass-animals-cat-kitten-baby-cute-748x468.jpg ) } </ style > < body > You have set the background image! </ body > Example 3: add background image in bootstrap 5 < div class = " has-bg-img bg-purple bg-blend-screen " > < h4 > Background blend mode: Multiply </ h4 > < img class = " bg-img " src = " ... " > </ div > Example 4: bootstrap create full screen background i

Yt To Mp3 Downloader Code Example

Example 1: 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/ Example 2: youtube download mp3 I use https : //github.com/ytdl-org/youtube-dl/ as a Python CLI tool to download videos