Posts

Showing posts from January, 2009

Bootstrap Signup Form With Registration Options Code Example

Example: booostrap signup from < form > < div class = " form-row " > < div class = " form-group col-md-6 " > < label for = " inputEmail4 " > Email </ label > < input type = " email " class = " form-control " id = " inputEmail4 " placeholder = " Email " > </ div > < div class = " form-group col-md-6 " > < label for = " inputPassword4 " > Password </ label > < input type = " password " class = " form-control " id = " inputPassword4 " placeholder = " Password " > </ div > </ div > < div class = " form-group " > < label for = " inputAddress " > Address </ label > < input type = " text " class = " form-control " id = " inputAddress &q

Are Static Class Variables Possible In Python?

Image
Answer : Variables declared inside the class definition, but not inside a method are class or static variables: >>> class MyClass: ... i = 3 ... >>> MyClass.i 3 As @millerdev points out, this creates a class-level i variable, but this is distinct from any instance-level i variable, so you could have >>> m = MyClass() >>> m.i = 4 >>> MyClass.i, m.i >>> (3, 4) This is different from C++ and Java, but not so different from C#, where a static member can't be accessed using a reference to an instance. See what the Python tutorial has to say on the subject of classes and class objects. @Steve Johnson has already answered regarding static methods, also documented under "Built-in Functions" in the Python Library Reference. class C: @staticmethod def f(arg1, arg2, ...): ... @beidy recommends classmethods over staticmethod, as the method then receives the class type as the first argument, but I&

Android:defaultValue="@string Android Navigation Code Example

Example: android safe args dependency //In top level gradle buildscript { repositories { google() } dependencies { def nav_version = "2.3.1" classpath "androidx.navigation:navigation-safe-args-gradle-plugin:$nav_version" } } //In app level gradle apply plugin: "androidx.navigation.safeargs.kotlin"

Automatically Convert Date Text To Correct Date Format Using Google Sheets

Image
Answer : The , at portion of the string is keeping Google Sheets from recognizing it as a datevalue. Just remove it with the substitute function and wrap in datevalue function like so: =DATEVALUE(SUBSTITUTE(A1,", at","")) To format as DD/MM/YYYY just go to custom formatting and set it to look like the following: =DATEVALUE(JOIN("/", LEFT(D5,2), {MID(D5,4,2), RIGHT(D5,4)})) where D5 contains for example: 25.06.2019 which script converts to datevalue: 43641 Dateformat is as dd.MM.YYYY converted to dd/MM/YYYY and then converted to datevalue. Google sheet's documentation helps: DATEVALUE , JOIN , LEFT , MID , RIGHT Datevalue is useful for organizing rows of data by date correctly. Another solution is to create custom function. Open tools → script editor in menu to open script editor in new tab Click Untitled project in top left corner and rename Open Resources → Libraries in top menu Paste library key MHMchiX6c1bwSqGM1PZiW_Pxh

Can We Change Package Name In Android From Command Line Code Example

Example: android studio change package name In Android Studio, you can do this: For example, if you want to change com.example.app to my.awesome.game, then: In your Project pane, click on the little gear icon ( Gears icon ) Uncheck the Compact Empty Middle Packages option Compact Empty Middle Packages Your package directory will now be broken up into individual directories Individually select each directory you want to rename, and: Right-click it Select Refactor Click on Rename In the pop-up dialog, click on Rename Package instead of Rename Directory Enter the new name and hit Refactor Click Do Refactor in the bottom Allow a minute to let Android Studio update all changes Note: When renaming com in Android Studio, it might give a warning. In such case, select Rename All Enter image description here Now open your Gradle Build File (build.gradle - Usually app or mobile). Update the applicationId in the defaultConfig to your new Package Name and Sync Gradle, if it hasn&

Ant Design Icon Code Example

Example: antd icons npm install --save @ant-design/icons

Cannot Start Service W3SVC On Computer '.'

Answer : Go to Task Manager --> Processes and manually stop the W3SVC process. After doing this the process should start normally when restarting IIS I found the solution: Run -> appwiz.cpl -> Turn windows features on or off -> Uncheck "Internet Information Services" and "Windows Process Activation Service" Restart your machine. Run -> appwiz.cpl -> install both "Internet Information Services" and "Windows Process Activation Service" Reference I came across the same problem. It got solved with following steps: Go to admin DOS command prompt -- ( Ctrl + X ) will give the option to go to admin DOS prompt use command " iisreset " This will solve the problem.

Bundle Install Is Not Working

Answer : Open the Gemfile and change first line from this source 'https://www.rubygems.org' to this source 'http://www.rubygems.org' remove the ' s ' from ' https '. As @Wasif mentioned, first make sure the Ruby Gems site is up and your network access is ok. If they works fine, try it like this: First, delete your Gemfile.lock file Then run gem update --system Then in your Gemfile try changing the first line source 'https://rubygems.org' to http:// (without an s ) Unless there is a problem with your connectivity this should fix the issue with bundle install .

Clock Image Mui Icons Code Example

Example 1: @material-ui/icons yarn add @material - ui / icons # NPM npm install @material - ui / icons Example 2: react mui icons npm install @material - ui / core npm install @material - ui / icons import RoomIcon from '@material-ui/icons/Room' ; < RoomIcon / >

Accessing Previous Theme Variables In CreateMuiTheme

Answer : You'd need to create an instance of the default theme and use it when defining your own: import { createMuiTheme } from 'material-ui/styles'; const defaultTheme = createMuiTheme(); const theme = createMuiTheme({ typography: { fontSize: defaultTheme.typography.fontSize + 2 } }); export default theme; You can also create your theme and then add on to it after theme is created. import { createMuiTheme } from 'material-ui/styles'; const theme = createMuiTheme(); theme.typography = { ...theme.typography, fontSize: theme.typography.fontSize + 2 } export default theme;

Android Library Project Using Android Studio

Answer : Simplest way to do this : Right click on your opened project in Android Studio and select New > Module In the left Pane choose Android Library and click on next. Enter all details, untick Create Activity, Theme and all if not required. Choose API level same as your project and Next, Next, Next . Now you will see an another directory inside your project, build.gradle for library will be automatically configured for you. If your module/library name is "mylibrary" , include ':mylibrary' will be automatically added in settings.gradle file inside root directory of your project. Now open your main module and insert this line in dependency block : compile project(':mylibrary') If you want to use same library in other projects, you have to copy the library module to that particular project using File Explore and have to configure settings.gradle and main module's build.gradle manually. An old question, but even now there d

Ag-grid Height=100% Collapsed

Answer : This is almost certainly due to you having DOCTYPE html in your html file. If you do, then you need to ensure that the grids container has a non-0 height to fill, otherwise it will appear as a flat line as you've found. This is not an ag-Grid specific issue - it's a side effect of not having quirks mode in use. The easiest thing for you to do is this: <style> html, body { width: 100%; height: 100%; } This StackOverflow Question/Answer explains the underlying issue pretty well You shall try setting the autoHeight of the ag-grid, by setting the DomLayout . See the sample code below for angular. onGridReady(params) { this.gridApi = params.api; this.gridColumnApi = params.columnApi; //The ag-grid is not enlarging based on the page height, //so dynamically adjusting the height of the grid this.gridApi.setDomLayout("autoHeight"); } For reference see this https://plnkr.co/edit/Jb1TD7gbA4w7yclU?prev

Check Mysql Connection In Sequelize

Answer : As of latest version of Sequelize (i.e. 3.3.2 ), authenticate can be used to check the connection: var sequelize = new Sequelize("db", "user", "pass"); sequelize.authenticate().then(function(errors) { console.log(errors) }); authenticate simply runs SELECT 1+1 AS result query to check the db connection. UPDATE : Errors by the newest API need to be handled in catch : sequelize .authenticate() .then(() => { console.log('Connection has been established successfully.'); }) .catch(err => { console.error('Unable to connect to the database:', err); }); UPDATE 2 : I haven't tested this, but its only logical that the same thing can be reached with async/await : try { await sequelize.authenticate() } catch (err) { console.error('Unable to connect to the database:', err) } You won't see errors, like password authentication errors, in .then . From the sequelize documentation here:

Allowed Symbols/characters In Minecraft Chat

Answer : Minecraft officially supports ASCII characters under 0x80. It can render more characters, but they do not render correctly. The supported characters are listed below. !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_'abcdefghijklmnopqrstuvwxyz{|}~⌂ÇüéâäàåçêëèïîìÄÅÉæÆôöòûùÿÖÜø£Ã˜×ƒáíóúñѪº¿®¬½¼¡«» You can find this list together with more info about the possibilities( colors, and style) of the chat at the Chat article on the MinecraftCoalition wiki, if figuring out what these characters are is too much trouble. Minecraft chat now accepts 255 characters (a few still do not render correctly). Navigate to the Font section of the Wiki page and click expand to see the full list. The current answer by Krael is out of date and wrong: even the old version contained several characters outside of ASCII. ASCII does not contain accented characters. Instead, Minecraft used to support windows-1252. There are 256 code points in it, of which

Codeblocks Can't Find My Compiler

Answer : I faced the same problem. I have fixed out by going to Setting -> Compiler -> Global Compiler Settings -> Toolchain Execuatables (tab) . There, click on Program Files and then rename C compiler to gcc.exe and C++ compiler to g++.exe . I know this is an old question but let me see if I can help. First of all, on the download page make sure you downloaded codeblocks-13.12mingw-setup.exe and NOT codeblocks-13.12-setup.exe. Of course the version numbers may change but pay attention to the name. Then after installing codeblocks, go to Settings->Compiler->Toolchain executables. From here, change the C compiler to gcc.exe and C++ compiler to g++.exe. Hope this helps anyone else going through this problem :-)

An Array Of Elements Can Be Sorted Using The Heap Sort Algorithm. The First Step Of The Heap Sort Algorithm Is To Convert The Array Into A Maximum Heap. If The Following Array Is To Be Sorted: Code Example

Example 1: heap sort // @see https://www.youtube.com/watch?v=H5kAcmGOn4Q function heapify(list, size, index) { let largest = index; let left = index * 2 + 1; let right = left + 1; if (left < size && list[left] > list[largest]) { largest = left; } if (right < size && list[right] > list[largest]) { largest = right; } if (largest !== index) { [list[index], list[largest]] = [list[largest], list[index]]; heapify(list, size, largest); } return list; } function heapsort(list) { const size = list.length; let index = ~~(size / 2 - 1); let last = size - 1; while (index >= 0) { heapify(list, size, --index); } while (last >= 0) { [list[0], list[last]] = [list[last], list[0]]; heapify(list, --last, 0); } return list; } heapsort([4, 7, 2, 6, 4, 1, 8, 3]); Example 2: heap sort name meaning A sorting algorithm that works by first org

Youtube Mp3 Convertidor 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

Celsius Degree Latex Code Example

Example 1: latex degree symbol % In preamble: \usepackage{gensymb} ... Draw a 45 $\degree$ angle. Example 2: degree symbol latex $90^{\circ}$

Array Map With Index Js Code Example

Example 1: es6 map usin index const array = [ 1 , 2 , 3 , 4 ] ; const map = array . map ( ( x , index ) => { console . log ( index ) ; return x + index ; } ) ; console . log ( map ) ; Example 2: map javascript index // Arrow function map ( ( element ) => { ... } ) map ( ( element , index ) => { ... } ) map ( ( element , index , array ) => { ... } ) // Callback function map ( callbackFn ) map ( callbackFn , thisArg ) // Inline callback function map ( function callbackFn ( element ) { ... } ) map ( function callbackFn ( element , index ) { ... } ) map ( function callbackFn ( element , index , array ) { ... } ) map ( function callbackFn ( element , index , array ) { ... } , thisArg ) Example 3: map index array . map ( ( currentelement , index ) => { } ) ;

Youtube Convert Mp3 To Mp4 Code Example

Example: youtube to mp4 ytmp3 . cc is the best by far

Apj Moodle Login Code Example

Example: ecourse apeejay ecourse.asu.apeejay.edu

Button Disabled'', False In JQuery Code Example

Example 1: jquery add disabled to button $ ( "#button" ) . attr ( "disabled" , true ) ; Example 2: jquery disable button function disable ( i ) { $ ( "#rbutton_" + i ) . prop ( "disabled" , true ) ; }

Postgresql Create Role With Login Code Example

Example 1: how to add user to role postgresql CREATE ROLE joe LOGIN INHERIT ; CREATE ROLE admin NOINHERIT ; CREATE ROLE wheel NOINHERIT ; GRANT admin TO joe ; GRANT wheel TO admin ; Example 2: postgresql create user roles CREATE ROLE name [ WITH ADMIN role_name ]

Can I Emulate A Callback Function From Jquery RemoveClass?

Answer : It seems that you're using CSS3 transition for doing this. The easiest way to do this is to set delay manually: $("#card1").removeClass('flip'); setTimeout(function(){ //wait for card1 flip to finish and then flip 2 $("#card2").removeClass('flip'); }, 500); setTimeout(function(){ //wait for card2 flip to finish and then flip 3 $("#card3").removeClass('flip'); }, 1000); There's no built in jQuery method to check that css transition is complete.

Angular Ng Generate Component In Folder Code Example

Example: ng g component ng g class < name > [ options ]

Bootstrap-sweetalert Cdn Code Example

Example 1: sweet alert cdn < script src = " https://unpkg.com/sweetalert/dist/sweetalert.min.js " > </ script > Example 2: sweet alert cdn swal("Good job!", "You clicked the button!", "success");