Posts

Showing posts from September, 2008

Bcryptjs Npm Code Example

Example 1: npm bcrypt npm install bcrypt Example 2: npm bcrypt const bcrypt = require('bcrypt'); const saltRounds = 10; bcrypt.hash(myPlaintextPassword, saltRounds, function(err, hash) { // Store hash in your password DB. }); // Load hash from your password DB. bcrypt.compare(myPlaintextPassword, hash, function(err, result) { // result == true });

B&d Media Code Example

Example: who is b&d B&D stands for Bhadwa and Dalal. it is a acronym for amish devgan

Bootstrap Registration Form W3schools Code Example

Example 1: bootstrap form < form > < div class = " form-group " > < label for = " exampleInputEmail1 " > Email address </ label > < input type = " email " class = " form-control " id = " exampleInputEmail1 " aria-describedby = " emailHelp " placeholder = " Enter email " > < small id = " emailHelp " class = " form-text text-muted " > We'll never share your email with anyone else. </ small > </ div > < div class = " form-group " > < label for = " exampleInputPassword1 " > Password </ label > < input type = " password " class = " form-control " id = " exampleInputPassword1 " placeholder = " Password " > </ div > < div class = " form-group form-check " > < input type = " ch

Chrome Plugin To Get Smartphone Window Size

Image
Answer : Edit: Device Mode in Chrome 38+ Chrome v38+ has window resizing and mobile emulation in a mode called Device Mode. You can activate it either with the icon in the Developer Tools window or with Ctrl + Shift + M ( Cmd + Shift + M on Mac). Windows As Pedro mentioned in his answer, Window Resizer will work for Chrome on Windows. https://chrome.google.com/webstore/detail/kkelicaakdanhinjdeammmilcgefonfh Mac OSX On Mac OSX, Chrome limits the width at a minimum of 320px. This is the lower end of the spectrum for smartphone window sizes, so this may be enough. If you still want to get around this limitation, open a popup window with the Open-as-Popup extension. This will allow you to resize down to 100px x 100px: https://chrome.google.com/webstore/detail/ncppfjladdkdaemaghochfikpmghbcpc Window Resizer will do the trick. You can even manually define a screen size. https://chrome.google.com/webstore/detail/kkelicaakdanhinjdeammmilcgefonfh

Calculate Sum Of List Python Code Example

Example 1: how to sum all the numbers in a list in python # to sum all the numbers we use python's sum ( ) function a = [ 4 , 5 , 89 , 5 , 33 , 2244 , 56 ] a_total = sum ( a ) Example 2: how to calculate the sum of a list in python # Python code to demonstrate the working of # sum ( ) numbers = [ 1 , 2 , 3 , 4 , 5 , 1 , 4 , 5 ] # start parameter is not provided Sum = sum ( numbers ) print ( Sum ) # result is 25 # start = 10 Sum = sum ( numbers , 10 ) print ( Sum ) # result is 10 + 25 = 35 Example 3: python sum of list >>> list = [ 1 , 2 , 3 ] >>> sum ( list ) 6

Assigning A Virtual Desktop To A Monitor In Windows 10

Answer : I may be late to the party, but there is a workaround that can get near what you want to do: Type Win + Tab to show up the Multiple Desktops panel also showing windows of the current desktop. Right click on one of them and you can choose either "Show this window on all desktops" or "Show windows from this app on all desktops". You can now switch desktop and they'll stick to the screen. Afaik, if you choose the 2nd option, it will remember your choice even if you close all windows from the app at one point. hope it helps Unfortunately not with the windows 10 feature. Each virtual desktop contains all of your monitors. So when you switch to another virtual desktop you are switching to a new virtual desktop that spans all of your monitors. Maybe one of the third party solutions can do this and run on Windows 10.

Best Beacon Haste Minecraft Code Example

Example: how many iron blocks for a full beacon You need 81 iron blocks for a full beacon

BASKETBALL FRVR?

Answer : JavaScript (ES6), 73 72 bytes Prints all unique, lexically sorted combinations. f=(n,p=0,s='')=>n?n>1&&f(n-2,0,s+'S')&f(n-(p-9?p+=3:9),p,s+'V'):alert(s) Test cases In this snippet, alert() has been replaced by console.log() for user-friendliness. f=(n,p=0,s='')=>n?n>1&&f(n-2,0,s+'S')&f(n-(p-9?p+=3:9),p,s+'V'):console.log(s) ;[2, 3, 4, 12, 16] .forEach(n => { console.log('[' + n + ']'); f(n); }) Jelly, 30 bytes o2,5ṁo8‘ Hṗ@€⁾VSẎðOḂŒgÇ€FS=ðÐf A monadic link returning a list of the strings (lists of characters). Try it online! - The footer calls the link and separates the entries by newlines since a full program's implicit output would smash them together. How? o2,5ṁo8‘ - Link 1, helper to form shot scores: list of shots grouped by type (S=1 and V=0) - e.g. [[1,1],[0,0,0,0,0],[1,1],[0],[1,1]] 2,5

Can You Set A Border Opacity In CSS?

Image
Answer : Unfortunately the opacity element makes the whole element (including any text) semi-transparent. The best way to make the border semi-transparent is with the rgba color format. For example, this would give a red border with 50% opacity: div { border: 1px solid rgba(255, 0, 0, .5); -webkit-background-clip: padding-box; /* for Safari */ background-clip: padding-box; /* for IE9+, Firefox 4+, Opera, Chrome */ } The problem with this approach is that some browsers do not understand the rgba format and will not display any border at all if this is the entire declaration. The solution is to provide two border declarations. The first with a fake opacity, and the second with the actual. If a browser is capable, it will use the second, if not, it will use the first. div { border: 1px solid rgb(127, 0, 0); border: 1px solid rgba(255, 0, 0, .5); -webkit-background-clip: padding-box; /* for Safari */ background-clip: padding-box; /* for IE9+, Firefox

Access Java / Servlet / JSP / JSTL / EL Variables In JavaScript

Answer : You need to realize that Java/JSP is merely a HTML/CSS/JS code producer. So all you need to do is to just let JSP print the Java variable as if it is a JavaScript variable and that the generated HTML/JS code output is syntactically valid. Provided that the Java variable is available in the EL scope by ${foo} , here are several examples how to print it: <script>var foo = '${foo}';</script> <script>someFunction('${foo}');</script> <div onclick="someFunction('${foo}')">...</div> Imagine that the Java variable has the value "bar" , then JSP will ultimately generate this HTML which you can verify by rightclick, View Source in the webbrowser: <script>var foo = 'bar';</script> <script>someFunction('bar');</script> <div onclick="someFunction('bar')">...</div> Do note that those singlequotes are thus mandatory in ord

Appendix New Page Latex Code Example

Example: move appendix to next page overleaf \documentclass{article} \usepackage{appendix} \usepackage{etoolbox} % Inserts \clearpage before \begin{appendices} \BeforeBeginEnvironment{appendices}{\clearpage} % Inserts \clearpage after \end{appendices} %\AfterEndEnvironment{appendices}{\clearpage} % Inserts \clearpage before every \section within appendices environment %\AtBeginEnvironment{appendices}{\pretocmd{\section}{\clearpage}{}{}}{} \begin{document} \section{Pre1} \section{Pre2} \begin{appendices} \section{App1} \section{App2} \end{appendices} \section{Post1} \section{Post2} \end{document}

Boxes Placement In Tcolorbox

Image
Answer : Obviously, you would use the \tcbox macro version for your boxes, rather than the environment form. Calculation of the stackgap is shown automated in this MWE. (Note: this example works starting with V2.30 of tcolorbox). \documentclass{article} \usepackage{stackengine} \usepackage{tcolorbox} \begin{document} \def\boxone{\tcbox[nobeforeafter]{This is a test}} \def\boxtwo{\tcbox[nobeforeafter]{Another test}} \def\boxthree{\tcbox[nobeforeafter,minipage,width=0.7in]{this is a very long box}} \stackon[\heightof{\boxthree}-\heightof{\boxone}-\heightof{\boxtwo}]% {\boxtwo}{\boxone}~\boxthree \end{document} Taking a similar tack to Steven Segletes's answer but using the xcoffins package, which allows us to pick points on the various boxes to line up: \documentclass{article} \usepackage{tcolorbox} \usepackage{xcoffins} \NewCoffin{\CoffinA} \NewCoffin{\CoffinB} \NewCoffin{\CoffinC} \begin{document} % Set up content in three coffins \SetHorizontalCoffin{\CoffinA}

Access Control Request Headers, Is Added To Header In AJAX Request With JQuery

Answer : Here is an example how to set a request header in a jQuery Ajax call: $.ajax({ type: "POST", beforeSend: function(request) { request.setRequestHeader("Authority", authorizationToken); }, url: "entities", data: "json=" + escape(JSON.stringify(createRequestObject)), processData: false, success: function(msg) { $("#results").append("The result =" + StringifyPretty(msg)); } }); This code below works for me. I always use only single quotes, and it works fine. I suggest you should use only single quotes or only double quotes, but not mixed up. $.ajax({ url: 'YourRestEndPoint', headers: { 'Authorization':'Basic xxxxxxxxxxxxx', 'X-CSRF-TOKEN':'xxxxxxxxxxxxxxxxxxxx', 'Content-Type':'application/json' }, method: 'POST', dataType: 'json', data: YourData, success: function(da

Adding Links In Gopdf Code Example

Example: adding links in gopdf package main import ( "log" "github.com/signintech/gopdf" ) func main() { pdf := gopdf.GoPdf{} pdf.Start(gopdf.Config{ PageSize: *gopdf.PageSizeA4 }) //595.28, 841.89 = A4 pdf.AddPage() err := pdf.AddTTFFont("times", "./test/res/times.ttf") if err != nil { log.Print(err.Error()) return } err = pdf.SetFont("times", "", 14) if err != nil { log.Print(err.Error()) return } pdf.SetX(30) pdf.SetY(40) pdf.Text("Link to example.com") pdf.AddExternalLink("http://example.com/", 27.5, 28, 125, 15) pdf.SetX(30) pdf.SetY(70) pdf.Text("Link to second page") pdf.AddInternalLink("anchor", 27.5, 58, 120, 15) pdf.AddPage() pdf.SetX(30) pdf.SetY(100) pdf.SetAnchor("anchor") pdf.Text("Anchor position") pdf.WritePdf("hello.tmp.pdf") }

Alter Table & Drop Primary Key Constraint Oracle Code Example

Example: drop primary key oracle -- Dropping Using alter ALTER TABLE table_name DROP CONSTRAINT constraint_name ;

Change Canvas FillText Color Code Example

Example: js canvas fill color // canvas context.fillStyle = "Color" ctx . fillStyle = "#FF0000" ;

Bootstrap Dropdown Menu With Ul Li Code Example

Example 1: bootstrap dropdown <!-- Bootstrap 5 Dropdown --> < div class = " dropdown " > < button class = " btn btn-secondary dropdown-toggle " type = " button " id = " dropdownMenuButton1 " data-bs-toggle = " dropdown " aria-expanded = " false " > Dropdown button </ button > < ul class = " dropdown-menu " aria-labelledby = " dropdownMenuButton1 " > < li > < a class = " dropdown-item " href = " # " > Action </ a > </ li > < li > < a class = " dropdown-item " href = " # " > Another action </ a > </ li > < li > < a class = " dropdown-item " href = " # " > Something else here </ a > </ li > </ ul > </ div > Example 2: bootstrap dropdown .drop

CodeIgniter - Best Place To Declare Global Variable

Answer : There is a file in /application/config called constants.php I normally put all mine in there with a comment to easily see where they are: /** * Custom defines */ define('blah', 'hello mum!'); $myglobalvar = 'hey there'; After your index.php is loaded, it loads the /core/CodeIgniter.php file, which then in turn loads the common functions file /core/Common.php and then /application/constants.php so in the chain of things it's the forth file to be loaded. I use a "Globals" class in a helper file with static methods to manage all the global variables for my app. Here is what I have: globals_helper.php (in the helpers directory) <?php if ( ! defined('BASEPATH')) exit('No direct script access allowed'); // Application specific global variables class Globals { private static $authenticatedMemberId = null; private static $initialized = false; private static function initialize() {

Adb Logcat Specific App Code Example

Example: android logs for app on terminal adb logcat | grep -F "`adb shell ps | grep com.asanayoga.asanarebel | tr -s [:space:] ' ' | cut -d' ' -f2`"

Bootstrap 4 Table Row Height Small Code Example

Example: bootstrap table col fixed width < table class = " table " > < thead > < tr > < th style = " width : 30 % " > Col 1 </ th > < th style = " width : 20 % " > Col 2 </ th > < th style = " width : 10 % " > Col 3 </ th > < th style = " width : 30 % " > Col 4 </ th > < th style = " width : 10 % " > Col 5 </ th > </ tr > </ thead > < tbody > < tr > < td > Val 1 </ td > < td > Val 2 </ td > < td > Val 3 </ td > < td > Val 4 </ td > < td > Val 5 </ td > </ tr > </ tbody > </ table >