Posts

Showing posts from July, 2010

Js A Onclick Code Example

Example 1: javascript onclick document .getElementById ( "myBtn" ) .addEventListener ( "click" , function ( ) { alert ( "Hello World!" ) ; } ) ; Example 2: javascript onclick // The element id ( TheElementID ) and var name ( myElement ) can be named anything. var myElement = document. getElementByID ( 'TheElementID' ) ; myElement .onclick = function ( ) { // Carry out a function here... }

Border In Container Flutter Code Example

Example 1: flutter container border Container ( decoration : BoxDecoration ( border : Border . all ( color : Colors . red , // red as border color ) , ) , child : Text ( "Your text..." ) ) Example 2: container flutter border radius Container ( decoration : BoxDecoration ( color : Colors . blue , borderRadius : BorderRadius . all ( Radius . circular ( 10 ) ) ) ) Example 3: border for container in flutter new Container ( margin : const EdgeInsets . all ( 15.0 ) , padding : const EdgeInsets . all ( 3.0 ) , decoration : BoxDecoration ( border : Border . all ( color : Colors . blueAccent ) ) , child : Text ( "My Awesome Border" ) , ) Example 4: border side in flutter import 'package : flutter / material . dart' ; void main ( ) { runApp ( MyApp ( ) ) ; } class MyApp extends StatelessWidget { @ override Widget build ( BuildContext context ) { return Center (

Conditional Count On A Field

Answer : I think you may be after select jobID, JobName, sum(case when Priority = 1 then 1 else 0 end) as priority1, sum(case when Priority = 2 then 1 else 0 end) as priority2, sum(case when Priority = 3 then 1 else 0 end) as priority3, sum(case when Priority = 4 then 1 else 0 end) as priority4, sum(case when Priority = 5 then 1 else 0 end) as priority5 from Jobs group by jobID, JobName However I am uncertain if you need to the jobID and JobName in your results if so remove them and remove the group by, Using COUNT instead of SUM removes the requirement for an ELSE statement: SELECT jobId, jobName, COUNT(CASE WHEN Priority=1 THEN 1 END) AS Priority1, COUNT(CASE WHEN Priority=2 THEN 1 END) AS Priority2, COUNT(CASE WHEN Priority=3 THEN 1 END) AS Priority3, COUNT(CASE WHEN Priority=4 THEN 1 END) AS Priority4, COUNT(CASE WHEN Priority=5 THEN 1 END) AS Priority5 FROM TableName GROUP BY jobId, jobName IIF is not a standard SQL construct

Brave Browser Wiki Code Example

Example 1: brave browser sudo apt install apt-transport-https curl gnupg curl -s https://brave-browser-apt-release.s3.brave.com/brave-core.asc | sudo apt-key --keyring /etc/apt/trusted.gpg.d/brave-browser-release.gpg add - echo "deb [arch=amd64] https://brave-browser-apt-release.s3.brave.com/ stable main" | sudo tee /etc/apt/sources.list.d/brave-browser-release.list sudo apt update sudo apt install brave-browser Example 2: brave web browser sudo pacman -S brave sudo pacman -S brave-beta

Add Code Block To Google Docs Code Example

Example: how to add code in google docs How to use Code Blocks Using Code Blocks is equally simple. Open Google Docs and create a new document. With the document open, click Add-ons and select Code Blocks from the menu. A new right sidebar will open (Figure A), where you can make use of the tool.

Woocommerce Update Cart Ajax Hook Code Example

Example: woocommerce update mini cart ajax add_filter ( 'woocommerce_add_to_cart_fragments' , function ( $fragments ) { ob_start ( ) ; ? > < div class = "cart-contents" > < ? php echo WC ( ) -> cart -> get_cart_contents_count ( ) ; ? > < / div > < ? php $fragments [ 'div.cart-contents' ] = ob_get_clean ( ) ; return $fragments ; } ) ; add_filter ( 'woocommerce_add_to_cart_fragments' , function ( $fragments ) { ob_start ( ) ; ? > < div class = "header-quickcart" > < ? php woocommerce_mini_cart ( ) ; ? > < / div > < ? php $fragments [ 'div.header-quickcart' ] = ob_get_clean ( ) ; return $fragments ; } ) ;

Could Not Load File Or Assembly 'Microsoft.ReportViewer.Common, Version=11.0.0.0

Answer : Dont know if this is good to anyone, but search all these dlls: Microsoft.ReportViewer.Common.dll Microsoft.ReportViewer.ProcessingObjectModel.dll Microsoft.ReportViewer.WebForms.dll Microsoft.ReportViewer.WinForms.dll Microsoft.ReportViewer.DataVisualization.dll You find them in C:\Windows\assembly\GAC_MSIL\... , and then put them in the references of your project. For each of them say: local copy, and check for 32 or 64 bit solution. You can install the Microsoft Report Viewer 2012 Runtime and change your references so they point to the ones installed by the runtime. http://www.microsoft.com/en-gb/download/details.aspx?id=35747 I have installed the runtime without it asking for SQL Server 2012. Before installing try uninstalling any previous versions of report viewer. As Microsoft.ReportViewer.2012.Runtime has Microsoft.ReportViewer.WebForms , Microsoft.ReportViewer.Common and Microsoft.ReportViewer.ProcessingObjectModel libraries, just run this command on PM Console:

Can I Delete MSOCache?

Answer : Short answer: no . You would most likely no longer be able to perform a repair or install additional components. I have tried it myself on a virtual machine running Windows 7 with Office 2007–I imagine it would have the same effect on Office 2010. A safer option (as suggested here) is to burn the folder itself to DVD or move it to a USB drive, and change all references to it in the Windows registry. From that page: Solution, what I did recently: Burn that whole folder to a CD-R or DVD (the filesize of that folder depends upon your Office version). Delete that folder. Search the registry in RegEdit for C:\MSOCache and change all references to point to your CD/DVD drive, example: E:\MSOCache (will of course require the disc when something Office related needs those cache files.) Way to go would be Junction Point. For example, if you have 120 GB SSD Drive as C: , and 3TB Drive (Magnetic) HDD as D: : on drive D: create sub folder named C cut and paste folder

String Length C++ Stl Code Example

Example 1: length of string c++ // string::length # include <iostream> # include <string> int main ( ) { std :: string str ( "Test string" ) ; std :: cout << "The size of str is " << str . length ( ) << " bytes.\n" ; return 0 ; } Example 2: length of string in c++ str . length ( ) ; Example 3: create a string of length c++ # include <string> # include <iostream> int main ( ) { std :: string s ( 21 , '*' ) ; std :: cout << s << std :: endl ; return 0 ; }

Android Toast Example

Example 1: java android show toast Toast myToast = Toast.makeText(this, "I'm a toast!", Toast.LENGTH_LONG); myToast.show(); Example 2: toast code in android studio Toast toast = Toast.makeText(this, "message", Toast.LENGTH_LONG;); toast.show(); Example 3: android java toast Toast.makeText(context this, text "Example of Text", Toast.LENGTH_LONG).show(); Example 4: Toast messag eandroid Toast.makeText(context, text, duration).show(); Example 5: toast.maketext Context context = getApplicationContext(); CharSequence text = "Hello toast!"; int duration = Toast.LENGTH_SHORT; Toast toast = Toast.makeText(context, text, duration); toast.show(); Example 6: android studio Toast usage Context context = getApplicationContext(); CharSequence text = "Hello toast!"; int duration = Toast.LENGTH_SHORT; Toast toast = Toast.makeText(context, text, duration); toast.show();

Controlling The Amount Of Space In Justify-content: Space-between

Answer : The justify-content property uses the available space on the line to position flex items. With justify-content: space-between , all available space is placed between the first and last items, pushing both items to opposite edges of the container. You wrote: I was wondering how to justify how much space is allowed in justify-content: space-between for flexbox. With space-between in row-direction, you would have to control the width of the flex container. So if you want there to be less space between flex items, then you would need to shorten the width of the container. Or you could use justify-content: space-around . However, these solutions are suboptimal. The right way to go about this would be to use margins. You wrote: Currently, my items are spaced but they have way too much space between them I want just a little space between them so they can settle somewhere in the middle in a row. Use justify-content: center then use margins to space them apart. I find mysel

C++ Difference Between Std::ref(T) And T&?

Answer : Well ref constructs an object of the appropriate reference_wrapper type to hold a reference to an object. Which means when you apply: auto r = ref(x); This returns a reference_wrapper and not a direct reference to x (ie T& ). This reference_wrapper (ie r ) instead holds T& . A reference_wrapper is very useful when you want to emulate a reference of an object which can be copied (it is both copy-constructible and copy-assignable ). In C++, once you create a reference (say y ) to an object (say x ), then y and x share the same base address . Furthermore, y cannot refer to any other object. Also you cannot create an array of references ie code like this will throw an error: #include <iostream> using namespace std; int main() { int x=5, y=7, z=8; int& arr[] {x,y,z}; // error: declaration of 'arr' as array of references return 0; } However this is legal: #include <iostream> #include <functional> //

Getforegroundwindow Code Example

Example 1: c# getforegroundwindow [ DllImport ( "user32.dll" ) ] private static extern IntPtr GetForegroundWindow ( ) ; Example 2: c# get foreground window # region Retrieve list of windows [ DllImport ( "user32" ) ] private static extern int GetWindowLongA ( IntPtr hWnd , int index ) ; [ DllImport ( "USER32.DLL" ) ] private static extern int GetWindowText ( IntPtr hWnd , StringBuilder lpString , int nMaxCount ) ; [ DllImport ( "USER32.DLL" ) ] private static extern bool EnumWindows ( EnumWindowsProc enumFunc , int lParam ) ; [ DllImport ( "user32.dll" ) ] private static extern IntPtr GetForegroundWindow ( ) ; private const int GWL_STYLE = - 16 ; private const ulong WS_VISIBLE = 0x10000000L ; private const ulong WS_BORDER = 0x00800000L ; private const ulong TARGETWINDOW = WS_BORDER | WS_VISIBLE ; internal class Window {

Make Css Element Spin Code Example

Example: css spinning animation /* How to use : <div class="spinning"></div>*/ .spinning { animation-name : spin ; animation-duration : 1500 ms ; /* How long lasts 1 turn */ animation-iteration-count : infinite ; animation-timing-function : linear ; } @keyframes spin { from { transform : rotate ( 0 deg ) ; } to { transform : rotate ( 360 deg ) ; } }

Android - Create New Labels In Gmail App

Answer : As of current writing, it seems that it's (still) impossible to create a new label in Android Gmail app. From Google Gmail official support, Create a label On a computer, open Gmail. You can't create labels from the Gmail app. On the left, click More . Click Create new label . Name your label. Click Create . (Emphasis mine) If Inbox App is installed on the device and has access to Gmail ID, then from Inbox App, it is possible to create a Gmail Label, and the same will be SYNC to Gmail App. There is an option in Inbox App's Navigation drawer (sliding menu) to create new Gmail Labels. Not sure why the same is not made available in the official Gmail App itself, because the app is developed by the Gmail Team only. How I found I could create a new label on Android: Open Android Chrome. Invoke Gmail within Chrome (via that 3x3 grid selector), which opens the Mobile version of Gmail. Open an email & scroll to the bottom and you'll see: &quo

Css Font Color Red Code Example

Example 1: text color css .class { color : white ; } Example 2: text color css body { color : blue ; } h1 { color : green ; } Example 3: css change text color p { color : White ; } Example 4: css font color color : #ffffff ; /*!important; to overwrite inline css*/ Example 5: css font color color : #ffffff ;

Html Favicon W3schools Code Example

Example: add favicon html <link rel= "icon" type= "image/png" href= "/favicon.png" />

Any Other Option Then IEmulator In Unity Code Example

Example: coroutine start unity IEnumerator Start ( ) { Debug . Log ( "Start1" ) ; yield return new WaitForSeconds ( 2.5f ) ; Debug . Log ( "Start2" ) ; }

Android Notification Icon Is A White Circle

Image
Answer : You must use a notification icon with no background. Android will add the circle background. You can set background color with .setColor(context.getResources().getColor(R.color.colorPrimary)) to match your app indentity. Icon inside will remain white and circle will get the color you defined. If your compileSDKversion is above 20 then notification icon should be a white-on-transparent background image. Otherwise the image will be rendered as a white colored image. Please go through the below link too for guidelines to create the icon https://www.google.com/design/spec/patterns/notifications.html and also the notification icon generator. https://romannurik.github.io/AndroidAssetStudio/icons-notification.html#source.space.trim=1&source.space.pad=0&name=ic_stat_example It seems to be a problem of cache during compilation ... The first image I was using was bad (fully colored), so I think my compilator created somekind of cache on the filename. I

Angular2 Material Dialog Css, Dialog Size

Answer : Content in md-dialog-content is automatically scrollable. You can manually set the size in the call to MdDialog.open let dialogRef = dialog.open(MyComponent, { height: '400px', width: '600px', }); Further documentation / examples for scrolling and sizing: https://material.angular.io/components/dialog/overview Some colors should be determined by your theme. See here for theming docs: https://material.angular.io/guide/theming If you want to override colors and such, use Elmer's technique of just adding the appropriate css. Note that you must have the HTML 5 <!DOCTYPE html> on your page for the size of your dialog to fit the contents correctly ( https://github.com/angular/material2/issues/2351 ) There are two ways which we can use to change size of your MatDialog component in angular material 1) From Outside Component Which Call Dialog Component import { MatDialog, MatDialogConfig, MatDialogRef } from '@angular/material'

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&

An Existing Connection Was Forcibly Closed By The Remote Host Minecraft Code Example

Example: Http Client An existing connection was forcibly closed by the remote host System.Net.ServicePointManager.SecurityProtocol |= SecurityProtocolType.Tls11 | SecurityProtocolType.Tls12;

Convert Css To Scss Code Example

Example 1: watch scss to css sass --watch scss:css Example 2: sass to scss # You can do it with SASS itself # Nevermind these malware infested sites below sass-convert style.sass style.scss Example 3: css sass scss /*SMART DIFFERENCE*/ /*CSS*/ body { font: 100% Helvetica, sans-serif; color: #333; } /*SCSS*/ $font-stack: Helvetica, sans-serif; $primary-color: #333; body { font: 100% $font-stack; color: $primary-color; } /*SASS*/ $font-stack: Helvetica, sans-serif $primary-color: #333 body font: 100% $font-stack color: $primary-color Example 4: scss to css /* Answer to: "scss to css" */ /* You can convert SCSS to CSS here: https://jsonformatter.org/scss-to-css Wanna convert it back? Google "css to scss" and see my answer there! */ Example 5: scss to css In Visual Studio Code use this extension: "Live Sass Compiler" Example 6: scss to css Use the "Live Sass Compiler" in Visual Studio Code

Check Palindrom Python Code Example

Example: palindrome words python mes = input ( "Enter the word and see if it is palindrome " ) if mes == mes [ :: - 1 ] : print ( "This word is palindrome" ) else : print ( "This word is not palindrome" )

Create A Global Variable In TypeScript

Answer : Inside a .d.ts definition file type MyGlobalFunctionType = (name: string) => void If you work in the browser, you add members to the browser's window context: interface Window { myGlobalFunction: MyGlobalFunctionType } Same idea for NodeJS: declare module NodeJS { interface Global { myGlobalFunction: MyGlobalFunctionType } } Now you declare the root variable (that will actually live on window or global) declare const myGlobalFunction: MyGlobalFunctionType; Then in a regular .ts file, but imported as side-effect, you actually implement it: global/* or window */.myGlobalFunction = function (name: string) { console.log("Hey !", name); }; And finally use it elsewhere in the codebase, with either: global/* or window */.myGlobalFunction("Kevin"); myGlobalFunction("Kevin"); globalThis is the future. First, TypeScript files have two kinds of scopes global scope If your file hasn't any import or export line , this file would b

6 Ways To Call External Command In Python

Answer : In this tutorial, I will list number of the ways (6 at the moment) to call external programs and the advantages and disadvantages of each: os.system(command) # Execute the command (a string) in a subshell. This is implemented by calling the Standard C function system(), and has the same limitations. Changes to sys.stdin , etc. are not reflected in the environment of the executed command. Advantage: This is nice because you can actually run multiple commands at once in this manner and set up pipes and input/output redirection. os.system("some_command < input_file | another_command > output_file") Disadvantage: You have to manually handle the escaping of shell characters such as spaces This also lets you run commands which are simply shell commands and not actually external programs os.popen(command[, mode[, bufsize]])

How To Outline Text Css Code Example

Example 1: css text stroke .TEXT :hover { -webkit-text-stroke-width : 1 px ; /* 1px Stroke */ -webkit-text-stroke-color : #ffffff ; /* White Color */ transition : 1 s /* Displays in 1 Second */ } Example 2: css text outline /* You have 2 options The first is experimental */ /* text-stroke */ #example { font-size : 1 em ; -webkit-text-stroke : 1 px #000000 ; } /* Use 4 shadows Probably best to use this until the above is standardised */ #example { font-size : 1 em ; text-shadow : -1 px -1 px 0 #000 , 1 px -1 px 0 #000 , -1 px 1 px 0 #000 , 1 px 1 px 0 #000 ; } Example 3: text border css h1 { -webkit-text-stroke : 1 px black ; }

Html A Href Javascript Code Example

Example 1: html a href <a href= "http://example.com" >Link text</a> Example 2: whatis a hrefd The href attribute specifies the URL of the page the link goes to

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.

Css Text-underline Code Example

Example 1: text-decoration css h1 { text-decoration : overline ; } h2 { text-decoration : line-through ; } h3 { text-decoration : underline ; } h4 { text-decoration : underline overline ; } Example 2: underline text using css /* Using 'text-decoration' property with 'underline' value. we can draw underline below the text using css */ <style > p { text-decoration : underline ; } </style> <p>Hello all Welcome here !!!</p> Example 3: how to underline font in css h3 { text-decoration : underline ; }