Posts

Showing posts from April, 2003

Can I Change My Ubuntu Desktop Into A Different Flavour (like Kubuntu)?

Answer : The main difference between main Ubuntu, Xubuntu, Kubuntu, and Lubuntu is the Desktop Environment. You can install one of these DEs onto your system with the following commands: Ubuntu: sudo apt-get install ubuntu-desktop Kubuntu: sudo apt-get install kubuntu-desktop Xubuntu: sudo apt-get install xubuntu-desktop Lubuntu: sudo apt-get install lubuntu-desktop Ubuntu GNOME: sudo apt-get install ubuntu-gnome-desktop From Ubuntu 17.10 GNOME became the default desktop environment/shell/manager. So if you're running Ubuntu 17.10 forwards (including current 18.04), you can install the default desktop: $ sudo apt install ubuntu-desktop To remove any of these, run the command that you used to install but instead of install say purge (i.e., sudo apt-get purge kubuntu-desktop ). Then you also need to run this command to complete the remove: sudo apt-get autoremove --purge The autoremove command removes all the packages that were installed. The way t

Border Collie Colors Code Example

Example: border color css border : 1 px solid #000000 ;

Check A Variable Against Union Type At Runtime In Python 3.6

Answer : You could use the __args__ attribute of Union which holds a tuple of the "possible contents: >>> from typing import Union >>> x = Union[int, str] >>> x.__args__ (int, str) >>> isinstance(3, x.__args__) True >>> isinstance('a', x.__args__) True The __args__ argument is not documented so it could be considered "messing with implementation details" but it seems like a better way than parsing the repr . The existing accepted answer by MSeifert (https://stackoverflow.com/a/45959000/7433423) does not distinguish Union s from other generic types, and it is difficult to determine at runtime whether a type annotation is a Union or some other generic type like Mapping due to the behavior of isinstance() and issubclass() on parameterized Union types. It appears that generic types will have an undocumented __origin__ attribute which will contain a reference to the original generic type used to create

Mongodb Docker Hub Code Example

Example: mongodb docker docker run - d - p 27017 - 27019 : 27017 - 27019 -- name mongodb mongo : 4.0 .4

Bootstrap 5 Datetime Picker Code Example

Example 1: bootstrap 5 datepicker example < div class = " input-append date " id = " dp3 " data-date = " 12-02-2012 " data-date-format = " dd-mm-yyyy " > < input class = " span2 " size = " 16 " type = " text " value = " 12-02-2012 " > < span class = " add-on " > < i class = " icon-th " > </ i > </ span > </ div > Example 2: bootstrap datetime picker < div class = " container " > < div class = " row " > < div class = ' col-sm-6 ' > < div class = " form-group " > < div class = ' input-group date ' id = ' datetimepicker2 ' > < input type = ' text ' class = " form-control " /> < span class = " input-group-addon " >

Js Get Max Value From Array Code Example

Example 1: max value in array javascript // For large data, it's better to use reduce. Supose arr has a large data in this case: const arr = [ 1 , 5 , 3 , 5 , 2 ] ; const max = arr . reduce ( ( a , b ) = > { return Math . max ( a , b ) } ) ; // For arrays with relatively few elements you can use apply: const max = Math . max . apply ( null , arr ) ; // or spread operator: const max = Math . max ( . . . arr ) ; Example 2: get highest value from array javascript //For Values var arr = [ 1 , 10 , 3 ] var min = Math . min . apply ( null , arr ) , max = Math . max . apply ( null , arr ) ; //For Objects var arr = [ { a : 1 } , { a : 10 } , { a : 3 } ] var values = arr . map ( val = > val . a ) ; var max = Math . max . apply ( null , values ) ; console . log ( max ) Example 3: Find the maximum number of an array js var arr = [ 1 , 2 , 3 ] ; var max = arr . reduce ( function ( a , b ) { return Math . max ( a , b

Angular Material Dropdown Code Example

Example 1: angular material dropdown menu < mat-menu #animals = " matMenu " > < button mat-menu-item [matMenuTriggerFor] = " vertebrates " > Vertebrates </ button > < button mat-menu-item [matMenuTriggerFor] = " invertebrates " > Invertebrates </ button > </ mat-menu > < mat-menu #vertebrates = " matMenu " > < button mat-menu-item [matMenuTriggerFor] = " fish " > Fishes </ button > < button mat-menu-item [matMenuTriggerFor] = " amphibians " > Amphibians </ button > < button mat-menu-item [matMenuTriggerFor] = " reptiles " > Reptiles </ button > < button mat-menu-item > Birds </ button > < button mat-menu-item > Mammals </ button > </ mat-menu > Example 2: how to add dropdown with filter in angular material < mat-autocomplete #auto = " matAutocomplete "

Background Gif Html Css Code Example

Example 1: background image css .selector { background-image: url(image.png); } Example 2: css background image body { background-image: url("paper.gif"); }

Combining Multiple Spreadsheets In One Using IMPORTRANGE

Image
Answer : You should be able to use a vertical array in the Spreadsheet 3 : ={IMPORTRANGE("Sheet1Key","SheetName!A2:A500");IMPORTRANGE("Sheet2Key","SheetName!A2:A500")} Of course, it is also possible to combine several IMPORTRANGE() functions with the QUERY() function , which gives us a greater control over the results we import . For example, we can use such a construction : =QUERY( { IMPORTRANGE("key-or-url-of-spreadsheet-1", "'sheet-name-1'!A2:Z100"); IMPORTRANGE("key-or-url-of-spreadsheet-2", "'sheet-name-2'!A2:Z100"); IMPORTRANGE("key-or-url-of-spreadsheet-3", "'sheet-name-3'!A2:Z100"); IMPORTRANGE("key-or-url-of-spreadsheet-4", "'sheet-name-4'!A2:Z100") }, "SELECT * WHERE Col1 IS NOT NULL ORDER BY Col3 ASC" ) Explanation: The above query removes blank lines from imported ranges : SE

Add A Cron Job Ubuntu Code Example

Example: set cron job in ubuntu Setting Up a Website Backup through Cron :- == == == == == == == == == == == == == == == == == == == == == = Step 1 : Update your server. As a best practice, we will update and upgrade our server with the following command. apt-get update && apt-get upgrade Step 2 : Verify if the cron package is installed. dpkg -l cron a ) Our example output let’s us know that the cron package is installed, along with its version: || / Name Version Architecture Description +++- == == == == == == == == == == == == = - == == == == == == == == = - == == == == == == == == = - == == == == == == == == == == == == == == == == == == == == == == == == == == == == ii cron 3 .0pl1-128ubuntu2 amd64 process scheduling daemon b ) Install cron package if necessary. sudo apt-get install cron c ) Ensure that the cron service is running with the following command: systemctl status cron Example Output: ---------------- * cron.servi

Bold To Normal Text Css Code Example

Example 1: how to bold text css inline < p style = " font-weight : bold " > Hey there </ p > Example 2: css bold text we can set text bold using css property named 'font-weight' Syntax: selector{ font-weight: bold; }

Alter Table Delete Column Sql Code Example

Example 1: alter table delete column ALTER TABLE "table_name" DROP "column_name" ; Example 2: sql delete column Deletes a column from a table . Example: Removes the first_name column from the users table . ALTER TABLE users DROP COLUMN first_name

Changing The Coordinate System In LibGDX (Java)

Answer : If you use a Camera (which you should) changing the coordinate system is pretty simple: camera= new OrthographicCamera(Gdx.graphics.getWidth(), Gdx.graphics.getHeight()); camera.setToOrtho(true, Gdx.graphics.getWidth(), Gdx.graphics.getHeight()); If you use TextureRegions and/or a TextureAtlas, all you need to do in addition to that is call region.flip(false, true). The reasons we use y-up by default (which you can easily change as illustrated above) are as follows: your simulation code will most likely use a standard euclidian coordinate system with y-up if you go 3D you have y-up The default coordinate system is a right handed one in OpenGL, with y-up. You can of course easily change that with some matrix magic. The only two places in libgdx where we use y-down are: Pixmap coordinates (top upper left origin, y-down) Touch event coordinates which are given in window coordinates (top upper left origin, y-down) Again, you can easily change the used coord

Convert Int To Str Java Code Example

Example: int to string java int x = 3 ; Integer . toString ( int )

Change Checkbox Checked Color Android Code Example

Example 1: android change checkbox color < android . support . v7 . widget . AppCompatCheckBox android : layout_width = "wrap_content" android : layout_height = "wrap_content" app : buttonTint = "@color/COLOR_HERE" / > Example 2: how to change checkbox color in android < ? xml version = "1.0" encoding = "utf-8" ? > < selector xmlns : android = "http://schemas.android.com/apk/res/android" > < item android : color = "@color/light_gray_checkbox" android : state_checked = "false" / > < item android : color = "@color/common_red" android : state_checked = "true" / > < / selector >

18 Inch In Cm Code Example

Example: inch to cm 1 inch = 2.54 cm

Combining Dig +short Command

Answer : What do you mean by 'ouput in one display'? I can almost not imagine this being the actual answer due to the simplicity, but based on what I assume is your answer now, this should do the trick: dig @ns1.myname.com myname.com +short MX; dig @ns1.myname.com myname.com +short A You can simply queue several commands in one line by separating them with a semicolon. dig +noall +answer @ns1.myname.com myname.com ANY You can grep out the types you need if you don't want all of them, or query for each one you want in turn. You can combine them into one command with no semicolon, but as noted in another question, it will still send 2 queries to the server (not a problem here): dig @ns1.myname.com myname.com +short MX @ns1.myname.com myname.com +short A You can "reuse" the dig command and keep sending new query parameters in quartets (URL, server to query, query type, query option) as long as you are giving it enough information to run a query on ea

Adding Custom Functions Into Array.prototype

Answer : Modifying the built-in object prototypes is a bad idea in general, because it always has the potential to clash with code from other vendors or libraries that loads on the same page. In the case of the Array object prototype, it is an especially bad idea, because it has the potential to interfere with any piece of code that iterates over the members of any array, for instance with for .. in . To illustrate using an example (borrowed from here): Array.prototype.foo = 1; // somewhere deep in other javascript code... var a = [1,2,3,4,5]; for (x in a){ // Now foo is a part of EVERY array and // will show up here as a value of 'x' } Unfortunately, the existence of questionable code that does this has made it necessary to also avoid using plain for..in for array iteration, at least if you want maximum portability, just to guard against cases where some other nuisance code has modified the Array prototype. So you really need to do both: you should avoid