Posts

Showing posts from March, 2016

Change Firefox New Tab Background

Answer : I think this may interest others as well. ANSWER UPDATE (as of 2020) By now there's a lot of cool and interesting addons that do the job in great way, let me mention some of my favorite in a brief list: Firefox Color This imho is really THE DEFINITIVE ONE and A MUST HAVE! Not only it lets you deeply customize almost everything of Firefox GUI the way you like it (including new tabs background of course), it also lets you share the theme you made if you want. If this isn't enough, let me add this addon is develope by Mozilla itself. Tabliss This is a really nice one (I personally use and love it). It lets you customize the new tabs background not only choosing for a color but also beautiful background images and add widgets (like showing the time for instance). (As a last note here let me say Tabliss is like joining the features of New Tab Override, New Tab Wallpaper, Beauty Tab, New Tab Splash and Clock New Tab addons all togheter.) There are also some addons

Angular Material 5 - Show Full Text In Mat Lists ( Word Wrap )

Answer : Use the following css: ::ng-deep .mat-list .mat-list-item .mat-line{ word-wrap: break-word; white-space: pre-wrap; } or ::ng-deep .mat-line{ word-wrap: break-word !important; white-space: pre-wrap !important; } Height of mat-list-item is limited to 48px so we need to override in case of large text ::ng-deep .mat-list .mat-list-item{ height:initial!important; } Demo:https://plnkr.co/edit/tTlhYgTkSz1QcgqjCfqh?p=preview Link to know more about the word-wrap and white-spac Simply wrap your whole paragraph inside of <mat-list-item> with <p> tags and that will force correct styles. Makes sense... No need for styles in this case. <mat-list-item> <p> My super long text.......... </p> </mat-list-item> I created this css/scss class. /* CSS */ .mat-list-item.mat-list-item-word-wrap { height: initial !important; } .mat-list-item-word-wrap .mat-line { word-wrap: break-word !imp

Can I Rotate A WorldEdit Selection Horizontally?

Answer : Yes this is possible: //deform rotate(axis1, axis2, degrees) So in your case, I think you want //deform rotate(x,x,90) I haven't got it installed at the moment, so unable to quickly check. Another suggestion is //deform swap(x,y) At the moment, Rotate command only rotates around Y axis(Or as you said, Z, depending where you draw them). However, in here: http://redmine.sk89q.com/issues/633 It is suggested to use either //deform rotate(axis1, axis2, degrees) or Select a cube containing your blocks. (height, width, depth on //size should be the same) //deform swap(x,y) Sources: http://wiki.sk89q.com/wiki/WorldEdit/Clipboard#Rotating http://redmine.sk89q.com/issues/633 The bukkit command is "//rotate (y axis)" by default, but you can go further by "//rotate [(x axis) (z axis)]" so I rotated mine exactly like in your picture by typing in "//rotate 0 90 0" although you could spin it any way you want with that.

Clear Console Java Code Example

Example 1: java clear console Runtime . getRuntime ( ) . exec ( "cls" ) ; Example 2: java clear console public static void clearScreen ( ) { System . out . print ( "\033[H\033[2J" ) ; System . out . flush ( ) ; }

Android - Adb Push ... Permission Denied

Answer : Edit: I found a work-around: AirDroid allows me to upload the file, but the permissions on the file are set to this: -rw------- Performing the following commands solves this problem (from Windows 7 command prompt). >adb shell # su # chmod 777 /data/data/com.me.app/databases/data.db The usual approach, which doesn't require any additional apps: Push to /data/tmp/ ; Copy on the device using adb shell , using cp if it's available on your device or cat if it isn't. > adb push data.db /data/tmp/data.db > adb shell # su # or run-as com.me.app # cp /data/tmp/data.db /data/data/com.me.app/databases/data.db Remembering to change com.me.app to the correct package name for your app.

Angular Cli Exclude Files/directory For `ng Test --code-coverage`

Answer : With the latest CLI, inside angular.json "test": { "builder": "@angular-devkit/build-angular:karma", "options": { "main": "src/test.ts", "polyfills": "src/polyfills.ts", "tsConfig": "src/tsconfig.spec.json", "karmaConfig": "./karma.conf.js", "codeCoverageExclude": ["src/testing/**/*"], Updated September 2019 With Angular CLI 6, angular-cli.json has been renamed to angular.json which contains the configuration. In angular.json , codeCoverage expects a boolean value, which sets whether code-coverage should be done with every test run or not. To exclude files from code coverage, there is a property codeCoverageExclude which accepts an array of files to be excluded from code coverage. angular.json "test": { "codeCoverageExclude":

Can Someone Explain Where Applicative Instances Arise In This Code?

Answer : This is the Applicative instance for ((->) r) , functions from a common type. It combines functions with the same first argument type into a single function by duplicating a single argument to use for all of them. (<$>) is function composition, pure is const , and here's what (<*>) translates to: s :: (r -> a -> b) -> (r -> a) -> r -> b s f g x = f x (g x) This function is perhaps better known as the S combinator. The ((->) r) functor is also the Reader monad, where the shared argument is the "environment" value, e.g.: newtype Reader r a = Reader (r -> a) I wouldn't say it's common to do this for the sake of making functions point-free, but in some cases it can actually improve clarity once you're used to the idiom. The example you gave, for instance, I can read very easily as meaning "is a character a letter or number". You get instances of what are called static arrows (see "A

Angular - Wait Until I Receive Data Before Loading Template

Answer : After studying the different approaches that people gave me, I found the solution on the async pipe. But, it took me a while to understand how to implement it. Solution: // Declaring the Promise, yes! Promise! filtersLoaded: Promise<boolean>; // Later in the Component, where I gather the data, I set the resolve() of the Promise this.getFiltersSubscription = this.getFilters().subscribe( (filters) => { this.filters = filters; log.info('API CALL. getting filters'); this.filtersLoaded = Promise.resolve(true); // Setting the Promise as resolved after I have the needed data } ); // In this listener triggered by the dynamic components when instanced, // I pass the data, knowing that is defined because of the template change // Listens to field's init and creates the fieldset triggering a service call // that will be listened by the field component this.iboService.initIBOsFilters$.subscribe( (fieldName) => {

Cmd Copy Folder From One Folder To Another Code Example

Example: xcopy folder to another folder Xcopy C: \ test D: \ test /E /H /C /I

Background Opacity Css Code Example

Example 1: set background image opacity #bg { background-image : url ( 'images/wood1.jpg' ) ; opacity : 0.2 ; width : 300 px ; height : 300 px ; } Example 2: css opacity background color background : rgba ( 255 , 255 , 255 , 0.25 ) ; Example 3: css opacity example .opacity30 { opacity : 0.3 ; filter : alpha ( opacity= 30 ) ; /* For IE8 and earlier */ } Example 4: change transparancy img css img { opacity : 0.5 ; } Example 5: css opacity .div { opacity : 0.8 ; /* 1 means fully visible, 0 means invisible */ } Example 6: background color with opacity h1 { background-color : rgba ( 255 , 0 , 0 , 0.3 ) ; }

Access To XMLHttpRequest At 'http://localhost:8081/api/v1/plans' From Origin 'http://localhost:4200' Has Been Blocked By CORS Policy: Request Header Field Content-type Is Not Allowed By Access-Control-Allow-Headers In Preflight Response. Code Example

Example: Access to XMLHttpRequest at 'http://localhost/MySQL_pracs/InsertUser.php' from origin 'http://localhost:4200' has been blocked by CORS policy: Request header field content-type is not allowed by Access-Control-Allow-Headers in preflight response. //Access to XMLHttpRequest at 'http://localhost/[api path].php' from origin 'http://localhost:4200' has been blocked by CORS policy: Request header field content-type is not allowed by Access-Control-Allow-Headers in preflight response. //The error is simply saying that "Content-Type" is missing from "Access-Control-Allow-Headers". //Therefore we need to add "Content-Type" to "Access-Control-Allow-Headers". < ? php header ( 'Access-Control-Allow-Headers: Content-Type' ) ; -- -- - ? >

Bra Ket Latex Code Example

Example: dirac notation latex $\langle \phi | x | \psi \rangle$

Adding Custom Fonts To IOS App Finding Their Real Names

Image
Answer : Use +[UIFont familyNames] to list all of the font family names known to the system. For each family name, you can then use +[UIFont fontNamesForFamilyName:] to list all of the font names known to the system. Try printing those out to see what name the system expects. Example code: static void dumpAllFonts() { for (NSString *familyName in [UIFont familyNames]) { for (NSString *fontName in [UIFont fontNamesForFamilyName:familyName]) { NSLog(@"%@", fontName); } } } Put that in your app, call it, and see what you get. If you see a name in the output that looks appropriate for your font, use it. Otherwise, perhaps you haven't properly added the font to your app. In swift 4.2+ use code given below: func dumpAllFonts() { for familyName in UIFont.familyNames { for fontName in UIFont.fontNames(forFamilyName: familyName) { print("\(fontName)") } } }

Absolute Value Javascript Code Example

Example 1: javascript absolute value Math . abs ( - 2 ) // 2 Math . abs ( 2 ) // 2 Example 2: how to get an absolute in js var value = Math . abs ( - 10 ) ; // value returns 10 Example 3: js absolute value Math . abs ( - 4 ) //returns 4 Math . abs ( 4 ) //returns 4 Example 4: javascript abs //Return the absolute value of number Math . abs ( number ) ; Example 5: javascript math absolute Math . abs ( - 7.25 ) ; // returns 7.25

C: Linux Command Executed By Popen() Function Not Showing Results

Answer : Since the output is going to stderr you need to redirect stderr like so: FILE* file = popen("ntpdate 2>&1", "r"); this will redirect stderr to stdout and so you will see output from both. Second issue fscanf will stop at the first space so you can replace with fgets : fgets(buffer, 100, file); As Shafik Yaghmour correctly diagnosed, the output you see from ntpdate is written (correctly) to its standard error, which is the same as your programs standard error. To get the error messages sent down the pipe, use: FILE *file = popen("ntpdate 2>&1", "r"); That sends the standard error output from ntpdate to the standard output of the command, which is the pipe you're reading from. Of course, it looks like using ntpdate isn't going to work well until you've configured something.

Unsigned Char Size In Bits Code Example

Example: c variable types char 1 byte - 128 to 127 or 0 to 255 unsigned char 1 byte 0 to 255 signed char 1 byte - 128 to 127 int 2 or 4 bytes - 32 , 768 to 32 , 767 or - 2 , 147 , 483 , 648 to 2 , 147 , 483 , 647 unsigned int 2 or 4 bytes 0 to 65 , 535 or 0 to 4 , 294 , 967 , 295 short 2 bytes - 32 , 768 to 32 , 767 unsigned short 2 bytes 0 to 65 , 535 long 8 bytes or ( 4 bytes for 32 bit OS ) - 9223372036854775808 to 9223372036854775807 unsigned long 8 bytes 0 to 18446744073709551615

Add To End Of Vector C++ Code Example

Example 1: how to append one vector to another c++ vector < int > a ; vector < int > b ; // Appending the integers of b to the end of a a.insert ( a.end ( ) , b.begin ( ) , b.end ( )) ; Example 2: insert vector to end of vector c++ vector < int > a ; vector < int > b ; a.insert ( a.end ( ) , b.begin ( ) , b.end ( )) ; // or a.insert ( std::end ( a ) , std::begin ( b ) , std::end ( b )) ; Example 3: adding element in vector c++ vector_name.push_back ( element_to_be_added ) ; Example 4: add to vector c++ // vector::push_back #include <iostream> #include <vector> int main ( ) { std::vector < int > myvector ; int myint ; std::cout << "Please enter some integers (enter 0 to end): \n " ; do { std::cin >> myint ; myvector.push_back ( myint ) ; } while ( myint ) ; std::cout << "myvector stores " << int ( myvector.size ( )) << " num

Can Overridden Method Have Different Return Type Code Example

Example: Return type of override method should be same or not return type MUST be same in method overriding