Posts

Showing posts from January, 2012

Atari Breakout Google Game Code Example

Example 1: atari breakout Go to https://elgoog.im/breakout/ to play atari breakout :) Example 2: atari breakout It doesn't work anymore

20 Minutes Timer Code Example

Example 1: 20 minute timer for good eyesight every 20 minutes look out the window at something 20 feet away for 20 seconds Example 2: 20 minute timer For the 20/20/20 rule you can also close your eyes for 20 seconds and get the same results because it relaxes the mucles in your eyes.

Circle Avatar And Circle Border Flutter Code Example

Example: border at circleAvatar flutter CircleAvatar( radius: 30, backgroundColor: Colors.teal, child: CircleAvatar( backgroundImage: AssetImage('assets/appdev.png'), radius: 28, ), ),

Chown Illegal Group Name (mac Os X)

Answer : Try using just the owner if no group. sudo chown -R user: /usr/local/var/log/couchdb illegal group name actually means that the group you're specifying (the couchdb after the colon -- the first couchdb is the user) doesn't exist. You need to either create the group, stop specifying a group, or specify a group that exists.

Boto S3 List Files In Folder Code Example

Example: list file in s3 boto import boto3 s3 = boto3.resource('s3') my_bucket = s3.Bucket('my_bucket_name') for object_summary in my_bucket.objects.filter(Prefix="dir_name/"): print(object_summary.key)

Bootstrap 4 Navbar-toggler-icon Does Not Appear

Answer : Update: navbar-inverse is no longer available in B4 version, you can use navbar-dark instead. Use navbar-inverse bg-inverse instead of .navbar-default <section role="navigation"> <nav class="navbar navbar-inverse bg-inverse navbar-toggleable-sm fixed-top"><!-- navbar-inverse --> <div class="container"> <button class="navbar-toggler navbar-toggler-right" type="button" data-toggle="collapse" data-target="#myNavigation" aria-controls="myNavigation" aria-expanded="false" aria-label="Toggle navigation"> <span class="navbar-toggler-icon"></span> </button> <a href="#" class="navbar-brand">KP</a> <div class="collapse navbar-collapse" id="myNavigation"> <div class="navbar-nav"> <

365 Factorial Code Example

Example: calculate factorial int factorial ( int n ) { int res = 1 , i ; for ( i = 2 ; i <= n ; i ++ ) res *= i ; return res ; }

Byte Array In Arduino Code Example

Example 1: array arduino int myArray[6]; int myArray[] = {2, 4, 8, 3, 6}; int myArray[6] = {2, 4, -8, 3, 2}; Example 2: variable array arduino var myArray[] = {d1,d2,d3,d4,d4}; var myArray[3]:

Binary Tree Geeksforgeeks Code Example

Example 1: binary tree search /* This is just the seaching function you need to write the required code. Thank you. */ void searchNode(Node *root, int data) { if(root == NULL) { cout << "Tree is empty\n"; return; } queue q; q.push(root); while(!q.empty()) { Node *temp = q.front(); q.pop(); if(temp->data == data) { cout << "Node found\n"; return; } if(temp->left != NULL) q.push(temp->left); if(temp->right != NULL) q.push(temp->right); } cout << "Node not found\n"; } Example 2: binary search tree # Driver Code arr = [ 2, 3, 4, 10, 40 ] x = 10 # Function call result = binarySearch(arr, 0, len(arr)-1, x) if result != -1: print ("Element is present at index % d" % result) else: print ("Element is not present in array")

Acid Full Form In Dbms Code Example

Example 1: acid properties in dbms Atomicity The entire transaction take place at once or doesn't happen at all. Consistency Database must be consistent before and after the transaction. Isolation Multiple transactions occur independently without interference. Durability The changes of the successful transaction occurs even if the system failure occur. Example 2: acid properties Atomicity Consistency Isolation Durability

3TB NTFS Volume Allocation Unit Size

Answer : @acejavelin! It really depends on the files you plan to store on that 3 TB HDD. However, it's highly recommended to use the default 4K for any NTFS hard drive that is smaller than 16 TB. Just like @whs mentioned, smaller allocation unit size would make sense only if you're keeping small doc files (for example) This way a very small portion of the HDD space will be wasted. If you plan to back up massive data like HD videos, photos, movies, etc., then even bigger than the 4K default AUS would be better. I'd suggest you to read through this article about the Allocation Unit Size Differences Good luck. Hope this helps. :)

Bash Scripting Cheat Sheet Code Example

Example 1: bash cheat sheet Try https://devhints.io/bash (DevHints.io - useful resource) Example 2: bash script cheat sheet cat file.txt | while read line; do echo $line done

Chrome Extensions On Ipad Pro Code Example

Example: chrome extension on ipad No, Chrome extensions do not work on iPad or iPhone. There is no web browser for the iPad that allows a desktop-level extension. It is not Apple’s policy to allow developers to include downloadable module engines in their apps, for multiple reasons which also include Apple’s security restrictions.

Are There Bookmarks In Visual Studio Code?

Image
Answer : Yes, via extensions. Try Bookmarks extension on marketplace.visualstudio.com Hit Ctrl + Shift + P and type the install extensions and press enter, then type Bookmark and press enter. Next you may wish to customize what keys are used to make a bookmark and move to it. For that see this question. You need to do this via an extension as of the version 1.8.1. Go to View → Extensions . This will open Extensions Panel. Type bookmark to list all related extensions. Install I personally like "Numbered Bookmarks" - it is pretty simple and powerful. Go to the line you need to create a bookmark. Click Ctrl + Shift + [some number] Ex: Ctrl + Shift + 2 Now you can jump to this line from anywhere by pressing Ctrl + number Ex: Ctrl + 2 Visual Studio Code currently does not support bookmarks natively. Please add this as feature request to our Git Hub issue list (https://github.com/Microsoft/vscode). In the meantime there are some ways to navi

Bootbox Confirm Dialog Problems

Answer : You may want to check the source on the "Confirm" link under "Basic Usage" on this page: http://bootboxjs.com/ Here's a snippet: $("a.confirm").click(function(e) { e.preventDefault(); bootbox.confirm("Are you sure?", function(confirmed) { console.log("Confirmed: "+confirmed); }); }); Assuming jQuery is available in the UI you're working on, I'd avoid using an onClick attribute in your anchor tags. Just my two cents. I needed that too, but I changed a little few things... Take a look... Add this function into your global "jQuery Ready" function like that: $(document).on("click", "[data-toggle=\"confirm\"]", function (e) { e.preventDefault(); var lHref = $(this).attr('href'); var lText = this.attributes.getNamedItem("data-title") ? this.attributes.getNamedItem("data-title").value : "Are you sure?&quo

Add My App To AutoStart Apps List In Android Programmatically

Answer : Some of the applications such as Whatsapp and Facebook might have been whiltlisted thats why they have automatic Autostart option enabled. But i have tried the following code for Xiaomi Devices hope this might help!! String manufacturer = "xiaomi"; if(manufacturer.equalsIgnoreCase(android.os.Build.MANUFACTURER)) { //this will open auto start screen where user can enable permission for your app Intent intent = new Intent(); intent.setComponent(new ComponentName("com.miui.securitycenter", "com.miui.permcenter.autostart.AutoStartManagementActivity")); startActivity(intent); } This screen/behaviour is not native to Android, meaning the screen you show comes from a custom rom, probably from a particular manufacturer. Like you said the answers in the other question do not work but they are the only native way to start an application on boot/start. Check if the app/custom rom has an API (a particul

Amc Cinema Stock Code Example

Example 1: amc stock AMC TO THE MOOOOOOOOOOOOOOOOOOOOOOOOOOOOOON Example 2: amc price print('TO the MOOOOON and BEYOND')

Changing The Width Of Twitter Bootstrap Popover

Answer : You can change the popover's dimensions with CSS: .popover{ width:200px; height:250px; } But that CSS will change ALL popovers. What you need to do is put the button in a container element and use CSS like this: #containerElem .popover { width:200px; height:250px; max-width:none; // Required for popovers wider than 276px (Bootstrap's max-width for popovers) } You also need to change data-container="#containerElem" to match your container. NOTE: If your popover is going to have a width greater than 276px, you need to override the max-width property as well. So add max-width: none to the .popover {} class. Here's a jsFiddle: http://jsfiddle.net/4FMmA/ If you want to controle the width in javascript: HTML (example from Bootstrap) <button id="exampleButton" type="button" class="btn btn-default" data-container="body" data-toggle="popover" data-placement="top&quo

Mp4 Splitter Code Example

Example: mpi split communicator int MPI_Comm_split ( MPI_Comm comm , int color , // int representing the group, one different for each group int key , // int representing the rank of the current proc in the new group MPI_Comm * newcomm // output param ) ;

Add Image In Header Using Html-pdf Node Module

Image
Answer : It is possible to add the image in options header. 1.Load the image in html body with "display:none" style. 2.Then add the image in the options header By doing this the image is cached and can attach the image in header. var options = { "format": 'Letter', "orientation": "portrait", "header": { "contents": "<img src='image path' />", "height": "30mm" }, "footer": { "contents": footer } } pdf.create("<div style='display:none'><img src='image path' /></div>", options).toFile("sample.pdf", function(err, res) { if (err) { console.error(err); callback(); } }); Refering to this issue on the github, you can't put your image directly in options.header , you have to put it in the body inside a <div id=&qu

Can You Resolve An Angularjs Promise Before You Return It?

Answer : Short answer: Yes, you can resolve an AngularJS promise before you return it, and it will behave as you'd expect. From JB Nizet's Plunkr but refactored to work within the context of what was originally asked (i.e. a function call to service) and actually on site. Inside the service... function getSomething(id) { // There will always be a promise so always declare it. var deferred = $q.defer(); if (Cache[id]) { // Resolve the deferred $q object before returning the promise deferred.resolve(Cache[id]); return deferred.promise; } // else- not in cache $http.get('/someUrl', {id:id}).success(function(data){ // Store your data or what ever.... // Then resolve deferred.resolve(data); }).error(function(data, status, headers, config) { deferred.reject("Error: request returned status " + status); }); return deferred.promise; } Inside the

A4 Paper Pixel Size Code Example

Example: Paper size a4 2480 x 3508 pixels at 300 PPI 595 x 842 pixels at 72 PPI