Posts

Showing posts from July, 2014

Add Attributes To A Simpletype Or Restriction To A Complextype In Xml Schema

Answer : To add attributes you have to derive by extension, to add facets you have to derive by restriction. Therefore this has to be done in two steps for the element's child content. The attribute can be defined inline: <xsd:simpleType name="timeValueType"> <xsd:restriction base="xsd:token"> <xsd:pattern value="\d{2}:\d{2}"/> </xsd:restriction> </xsd:simpleType> <xsd:complexType name="timeType"> <xsd:simpleContent> <xsd:extension base="timeValueType"> <xsd:attribute name="format"> <xsd:simpleType> <xsd:restriction base="xsd:token"> <xsd:enumeration value="seconds"/> <xsd:enumeration value="minutes"/> <xsd:enumeration value="hours"/> </xsd:restriction> </xsd:simpleType> </xsd:attribu

Radial Gradient Mdn Css Code Example

Example 1: radial gradient css background : radial-gradient ( #e66465 , #9198e5 ) ; Example 2: radial gradient css .gradient { background-image : radial-gradient ( circle , yellow , #f06d06 ) ; }

Call An Overridden Method From Super Class In Typescript

Answer : The key is calling the parent's method using super.methodName(); class A { // A protected method protected doStuff() { alert("Called from A"); } // Expose the protected method as a public function public callDoStuff() { this.doStuff(); } } class B extends A { // Override the protected method protected doStuff() { // If we want we can still explicitly call the initial method super.doStuff(); alert("Called from B"); } } var a = new A(); a.callDoStuff(); // Will only alert "Called from A" var b = new B() b.callDoStuff(); // Will alert "Called from A" then "Called from B" Try it here The order of execution is: A 's constructor B 's constructor The assignment occurs in B 's constructor after A 's constructor— _super —has been called: function B() { _super.apply(this, arguments); // MyvirtualMethod c

Android Studio Suddenly Cannot Resolve Symbol R

Answer : Most of the time it is due to a bad XML file. XML files can be layout files, value files, or the Manifest file. Please check your xml files and try to rebuild the project. Sometimes cleaning the project and rebuilding it also works. In addition, make sure you do not have a drawable with an invalid name. I had a drawable with a numeric filename and that didn't sit well with Android so it failed to compile R.java. Downgrade Your Gradle Plugin Version No amount of cleaning, rebuilding and restarting would do the trick for me. The only thing that did the trick was downgrade our Gradle version from 3.4.0-alpha02 to 3.2.1 . So, instead of: dependencies { classpath 'com.android.tools.build:gradle:3.4.0-alpha02' } We used: dependencies { classpath 'com.android.tools.build:gradle:3.2.1' } After making that change and then doing a Gradle sync, everything worked. Not sure if it's related to the alpha release or to that version or if

Convert A String To Array In Javascript Code Example

Example 1: convert string to array js // our string let string = 'ABCDEFG' ; // splits every letter in string into an item in our array let newArray = string . split ( '' ) ; console . log ( newArray ) ; // OUTPUTS: [ "A", "B", "C", "D", "E", "F", "G" ] Example 2: javascript explode //split into array of strings. var str = "Well, how, are , we , doing, today" ; var res = str . split ( "," ) ; Example 3: string split javascript var myString = "An,array,in,a,string,separated,by,a,comma" ; var myArray = myString . split ( "," ) ; /* * * myArray : * ['An', 'array', 'in', 'a', 'string', 'separated', 'by', 'a', 'comma'] * */ Example 4: string to array javascript const str = 'Hello!' ; console . log ( Array . from ( str ) ) ; // ["H", "e", "l&q

Rick Roll Lyrics Code Example

Example: never gonna give you up lyrics /* We're no strangers to love You know the rules and so do I A full commitment's what I'm thinking of You wouldn't get this from any other guy I just wanna tell you how I'm feeling Gotta make you understand Never gonna give you up Never gonna let you down Never gonna run around and desert you Never gonna make you cry Never gonna say goodbye Never gonna tell a lie and hurt you We've known each other for so long Your heart's been aching but you're too shy to say it Inside we both know what's been going on We know the game and we're gonna play it And if you ask me how I'm feeling Don't tell me you're too blind to see Never gonna give you up Never gonna let you down Never gonna run around and desert you Never gonna make you cry Never gonna say goodbye Never gonna tell a lie and hurt you Never gonna give you up Never gonna let you down Never gonna run around and

Youtube To Mp33 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: yt to mp3 Youtube - DL works great . Download from https : //youtube-dl.org/. To use, type youtube-dl <url> --audio-format mp3 Example 3: youtube to mp3 online This man is doing gods work

Abstract Class Python Code Example

Example 1: abstract method python from abc import ABC , abstractmethod class AbstractClassExample ( ABC ) : def __init__ ( self , value ) : self . value = value super ( ) . __init__ ( ) @abstractmethod def do_something ( self ) : pass Example 2: class python class MyClass ( object ) : def __init__ ( self , x ) : self . x = x Example 3: abstract class in java Sometimes we may come across a situation where we cannot provide implementation to all the methods in a class . We want to leave the implementation to a class that extends it . In such case we declare a class as abstract . To make a class abstract we use key word abstract . Any class that contains one or more abstract methods is declared as abstract . If we don’t declare class as abstract which contains abstract methods we get compile time error . 1 ) Abstract classes cannot be instantiated 2 ) An abstarct classes contai

Error: 'nullptr' Was Not Declared In This Scope Code Example

Example: declare nullptr c++ int * ptr = NULL ;

Add Same Function To Multiple Selectors Jquery Code Example

Example 1: jquery or selector $( "div, span, p.myClass" ).css( "border", "3px solid red" ); Example 2: jquery multiple selectors /* If we want to apply same functionality and features to more than one selectors then we use multiple selector option. I think we can say this feature is used like reusability. write a jquery function and just add multiple selectors in which we want same features. Kindly take a look in below example: */ Html: < div > div </ div > < p class = " myClass " > p class="myClass" </ p > < p class = " notMyClass " > p class="notMyClass" </ p > < span > span </ span > Js: < script > $ ( "div, span, p.myClass" ) . css ( "border" , "3px solid red" ) ; </ script > /* I Hope it will help you. Namaste */

Bootstrap Logo Code Example

Example 1: bootstrap navbar Navbar Home (current) Features Pricing Disabled Example 2: bootstrap4 navbar Navbar Home (current) Features Pricing Disabled Example 3: navbar bootstrap 4 with dropdown Navbar Home (current) Link Dropdown Action Another action Something else here Disabled Search Example 4: bootstrap 4 navbar with logo and nav on right Navbar Home (current) Features Pricing Disabled Example 5: navbar in bootstrap4 Collapsed content Toggleab

"Cannot Drop Database Because It Is Currently In Use". How To Fix?

Answer : The problem is that your application probably still holds some connection to the database (or another application holds connection as well). Database cannot be deleted where there is any other opened connection. The first problem can be probably solved by turning connection pooling off (add Pooling=false to your connection string) or clear the pool before you delete the database (by calling SqlConnection.ClearAllPools() ). Both problems can be solved by forcing database to delete but for that you need custom database initializer where you switch the database to single user mode and after that delete it. Here is some example how to achieve that. I was going crazy with this! I have an open database connection inside SQL Server Management Studio (SSMS) and a table query open to see the result of some unit tests. When re-running the tests inside Visual Studio I want it to drop the database always EVEN IF the connection is open in SSMS. Here's the definitive way to

Boto3 Nodejs Aws Code Example

Example: AWS JavaScript SDK node // install aws js sdk npm install aws - sdk

Compiler Error: "class, Interface, Or Enum Expected"

Answer : You miss the class declaration. public class DerivativeQuiz{ public static void derivativeQuiz(String args[]){ ... } } Every method should be within a class. Your method derivativeQuiz is outside a class. public class ClassName { ///your methods } You forgot your class declaration: public class MyClass { ...

Cookieclicker Wiki Code Example

Example 1: cookie clicker #Hacks: # Type these in your console which you can open by # pressing STRG + SHIFT + J (Chrome) or STRG + SHIFT + K (Firefox) # changes the amount of cookies Game.cookies = amount in int # unlimted cookies Game.cookies = Infinity # If you want to get out of Infinity cookies Game.cookiesd = 0 # set up the CookiesPerSecond Rate by the number you want Game.cookiesPS= amount in int # clicks on cookie forever without moving your mouse in the highest speed var autoclicker = setInterval(function() { Game.ClickCookie(); }, 10); # stoping autoclicker clearInterval(autoClicker) # clicks on golden cookie without moving your mouse setInterval(Game.goldenCookie.click, 500) # Get the achievement you want by changing it to the achievement name you want # Game.Win(‚ACHIEVEMENT‘) Example 2: cookie clicker Game.cookies=Int

Js Add Style Display None To Element Code Example

Example: javascript display block document. getElementById ( "someElementId" ) .style.display = "block" ;

14 Cm To Inches Code Example

Example: cm to inch 1 cm = 0.3937 inch

Difference Between Margin And Padding Code Example

Example 1: margin vs padding Margin is on the outside of block elements , padding is on the inside. Use margin to separate the block from things outside it Use padding to move the contents away from the edges of the block. Main differences : - Vertical margins of adjacent items will overlap , padding will not - Padding is included in the click region and background color/image , but not the margin Example 2: react native margin vs padding padding is the space between the content and the border , whereas margin is the space outside the border. Example 3: css padding vs margin /* Answer to: "css padding vs margin" */ /* Margin is outer space of an element, while padding is inner space of an element. Margin is the space outside the border of an element, while padding is the space inside the border of it. Margin accepts the value of auto: margin: auto , but you can't set padding to auto. For more information, head over to: https://stackoverflow.com/questi

Can't Add Perf Probe For C++ Methods

Answer : As a workaround you can get the method address with objdump and perf probe will accept it. $ perf probe -x /path/file '0x643f30' Added new event: probe_libfile:abs_643f30 (on 0x643f30 in /path/file) You can now use it in all perf tools, such as: perf record -e probe_libfile:abs_643f30 -aR sleep 1 Do note that perf probe expects an offset from the file, and objdump and readelf return the address after adjusting for the loading address. For -pie executable, where the loading address is 0, the addresses will be the same. For non -pie executables you can get the loading address by looking at the output of readelf -l /path/file and searching for the offset 0x000000 and looking at what VirtAddr it points to, then subtract that number from the symbol address that you get from objdump --syms or readelf --syms . It will usually be 0x400000

Html Align Image Center Of Div Code Example

Example 1: centre align image in div body { margin : 0 ; } #over img { margin-left : auto ; margin-right : auto ; display : block ; } Example 2: image center in div img { display : block ; margin-left : auto ; margin-right : auto ; width : 40 % ; }

20cm In Inches Code Example

Example: cm to inches const cm = 1 ; console . log ( ` cm: ${ cm } = in: ${ cmToIn ( cm ) } ` ) ; function cmToIn ( cm ) { var in = cm / 2.54 ; return in ; }

Admin Commands In Minecraft Realms Code Example

Example: other mc realms options With prices starting at €0.60/gb, Jeekie.Host is one of the cheapest hosting companies in the industry. https://jeekie.host/

Javascript Display None Code Example

Example 1: javascript hide div // javascript <script> document. getElementById ( "id" ) .style.display = "none" ; //hide document. getElementById ( "id" ) .style.display = "block" ; //show document. getElementById ( "id" ) .style.display = "" ; //show </script> // html <html> <div id= "id" style= "display:none" > <div id= "id" style= "display:block" > </html> // jquery <script> $ ( "#id" ) . hide ( ) ; $ ( "#id" ) . show ( ) ; </script> Example 2: display none js document. getElementById ( "myDIV" ) .style.display = "none" ; Example 3: javascript display block document. getElementById ( "someElementId" ) .style.display = "block" ; Example 4: how to show hide div in html javascript <!DOCTYPE html > <html > <head > <meta name="vi

Alternative To Execfile In Python 3?

Answer : The 2to3 script replaces execfile(filename, globals, locals) by exec(compile(open(filename, "rb").read(), filename, 'exec'), globals, locals) This seems to be the official recommendation. You may want to use a with block to ensure that the file is promptly closed again: with open(filename, "rb") as source_file: code = compile(source_file.read(), filename, "exec") exec(code, globals, locals) You can omit the globals and locals arguments to execute the file in the current scope, or use exec(code, {}) to use a new temporary dictionary as both the globals and locals dictionary, effectively executing the file in a new temporary scope. execfile(filename) can be replaced with exec(open(filename).read()) which works in all versions of Python Newer versions of Python will warn you that you didn't close that file, so then you can do this is you want to get rid of that warning: with open(filename) as infile: