Posts

Showing posts from February, 2009

Chrome Extension Manifest 'Matches'

Answer : You need to surround the value of the content_scripts field in square brackets: "content_scripts": [ { "matches": ["http://*"], "js": ["scripts.js"] } ] (see the Chrome Docs for more info) Incidentally, using http://*/* would be a better match for all urls (see the docs), adding https://*/* if you also need to match those as well. Edit: Following your edit, the error you are getting is because of the match pattern being incorrect. If you want to match every URL, then Google has a special pattern just for this purpose: <all_urls> Sample usage: "matches": ["<all_urls>"], See this page for more info: https://developer.chrome.com/extensions/match_patterns Any match pattern should be of the following structure [scheme] :// [host][path] scheme is '*' | 'http' | 'https' | 'file' | 'ftp' host is ' ' | ' .' (any char

Circle Avatar Flutter Example Image Network With Loading

Example: how to make an image contained in circle avatar in flutter CircleAvatar ( radius : 30.0 , backgroundImage : NetworkImage ( "${snapshot.data.hitsList[index].previewUrl}" ) , backgroundColor : Colors . transparent , )

Bootstrap 3 File Upload Design Code Example

Example: bootstrap file upload < form > < div class = " form-group " > < label for = " exampleFormControlFile1 " > Example file input </ label > < input type = " file " class = " form-control-file " id = " exampleFormControlFile1 " > </ div > </ form >

Background Color Gradient Css 2 Colors Code Example

Example 1: how to split a background into two color in css .logindiv { height : 200 px ; width : 200 px ; background : linear-gradient ( to bottom , #1F4E79 0 % , #1F4E79 50 % , #ddd 50 % , #ddd 100 % ) ; } Example 2: double color background css background : linear-gradient ( <angle> , color1 color1-stop-at , color2 color2-start-at ) ;

Check If Var Exist Before Unsetting In PHP?

Answer : Just unset it, if it doesn't exist, nothing will be done. From the PHP Manual: In regard to some confusion earlier in these notes about what causes unset() to trigger notices when unsetting variables that don't exist.... Unsetting variables that don't exist, as in <?php unset($undefinedVariable); ?> does not trigger an "Undefined variable" notice. But <?php unset($undefinedArray[$undefinedKey]); ?> triggers two notices, because this code is for unsetting an element of an array; neither u n d e f i n e d A r r a y n o r undefinedArray nor u n d e f in e d A rr a y n or undefinedKey are themselves being unset, they're merely being used to locate what should be unset. After all, if they did exist, you'd still expect them to both be around afterwards. You would NOT want your entire array to disappear just because you unset() one of its elements! Using unset on an undefined var

Bootstrap Responsive Button Code Example

Example 1: bootstrap a link disabled <a class= "btn disabled" href= "#" >Disabled link</a> Example 2: bootstrap buttons Sizes Fancy larger or smaller buttons? Add .btn-lg or .btn-sm for additional sizes. <button type= "button" class= "btn btn-primary btn-lg" >Large button</button> <button type= "button" class= "btn btn-secondary btn-lg" >Large button</button> <button type= "button" class= "btn btn-primary btn-sm" >Small button</button> <button type= "button" class= "btn btn-secondary btn-sm" >Small button</button> <button type= "button" class= "btn btn-primary btn-lg btn-block" >Block level button</button> <button type= "button" class= "btn btn-secondary btn-lg btn-block" >Block level button</button> <a href= "#" class= "btn btn-pr

Color Code Dark Blue Code Example

Example 1: dark blue hex code /* Hex Code For Dark Blue */ #00008b Example 2: dark blue rgb I like (0,0,205) but it isn't super dark

Bootstrap Popper Js Cdn Code Example

Example 1: bootstrap 4.1.3 cdn with popper < script src = " https://code.jquery.com/jquery-3.3.1.slim.min.js " integrity = " sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo " crossorigin = " anonymous " > </ script > < script src = " https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.3/umd/popper.min.js " integrity = " sha384-ZMP7rVo3mIykV+2+9J3UJ46jBk0WLaUAdn689aCwoqbBJiSnjAK/l8WvCWPIPm49 " crossorigin = " anonymous " > </ script > < script src = " https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/js/bootstrap.min.js " integrity = " sha384-ChfqqxuZUCnJSK3+MXmPNIyE6ZbWh2IMqE241rYiqJxyMiZ6OW/JmZQ5stwEULTy " crossorigin = " anonymous " > </ script > Example 2: bootstrap latest version cdn <! doctype html > < html lang = " en " > < head > <!-- Required meta tags --> <

Change Table Font Size Latex Code Example

Example 1: change table size latex \usepackage{graphics} % ... \begin{table} \centering \resizebox{\columnwidth}{!}{% \begin{tabular}{r|lll} \multicolumn{1}{r}{} & \multicolumn{1}{l}{Heading 1} & \multicolumn{1}{l}{Heading 2} & \multicolumn{1}{l}{Heading 3} \\ \cline{2-4} Row 1 & Cell 1,1 & Cell 1,2 & Cell 1,3 \\ Row 2 & Cell 2,1 & Cell 2,2 & Cell 2,3 \end{tabular}% } \end{table} Example 2: font size table latex \documentclass{article} \usepackage{graphicx} \begin{document} \begin{table} \resizebox{\textwidth}{!}{% \begin{tabular}{cc} Knuth & Lamport \end{tabular}} \end{table} \end{document}

1x1 World Record Rubik's Cube Code Example

Example: 1x1 rubik's cube world record 8 minuites and 59 seconds

Bootstrap 4 Responsive Utilities Visible / Hidden Xs Sm Lg Not Working

Answer : With Bootstrap 4 .hidden-* classes were completely removed (yes, they were replaced by hidden-*-* but those classes are also gone from v4 alphas). Starting with v4-beta, you can combine .d-*-none and .d-*-block classes to achieve the same result. visible-* was removed as well; instead of using explicit .visible-* classes, make the element visible by not hiding it (again, use combinations of .d-none .d-md-block). Here is the working example: <div class="col d-none d-sm-block"> <span class="vcard"> … </span> </div> <div class="col d-none d-xl-block"> <div class="d-none d-md-block"> … </div> <div class="d-none d-sm-block"> … </div> </div> class="hidden-xs" becomes class="d-none d-sm-block" (or d-none d-sm-inline-block ) ... <span class="d-none d-sm-inline"

Bluebird Npm Package Code Example

Example: bluebird npm npm install bluebird

Combining C++ And C - How Does #ifdef __cplusplus Work?

Answer : extern "C" doesn't really change the way that the compiler reads the code. If your code is in a .c file, it will be compiled as C, if it is in a .cpp file, it will be compiled as C++ (unless you do something strange to your configuration). What extern "C" does is affect linkage. C++ functions, when compiled, have their names mangled -- this is what makes overloading possible. The function name gets modified based on the types and number of parameters, so that two functions with the same name will have different symbol names. Code inside an extern "C" is still C++ code. There are limitations on what you can do in an extern "C" block, but they're all about linkage. You can't define any new symbols that can't be built with C linkage. That means no classes or templates, for example. extern "C" blocks nest nicely. There's also extern "C++" if you find yourself hopelessly trapped ins

Can I Get The Exception From The Finally Block In Python?

Answer : No, at finally time sys.exc_info is all-None, whether there has been an exception or not. Use: try: whatever except: here sys.exc_info is valid to re-raise the exception, use a bare `raise` else: here you know there was no exception finally: and here you can do exception-independent finalization The finally block will be executed regardless of whether an exception was thrown or not, so as Josh points out, you very likely don't want to be handling it there. If you really do need the value of an exception that was raised, then you should catch the exception in an except block, and either handle it appropriately or re-raise it, and then use that value in the finally block -- with the expectation that it may never have been set, if there was no exception raised during execution. import sys exception_name = exception_value = None try: # do stuff except Exception, e: exception_name, exception_value = sys.exc_info()[:2] raise # or don'