Posts

Showing posts from May, 2002

Apple - Check Battery Health On IPad Like On IPhone

Answer : Battery Health is currently not available for the iPad. According to Apple Support, For iPhone 6 and later, iOS 11.3 and later add new features to show battery health and recommend if a battery needs to be replaced. Nowhere on the page does it mention iPad or iPadOS, so unfortunately, at this time, it's limited to iPhones running iOS 11.3 and later. You may want to submit a feature request with Apple at https://www.apple.com/feedback/ipad.html If you have a Mac computer you can download and install Coconut Battery on your Mac. Then connect your iPad to your Mac with a USB-lightning cable and run Coconut Battery. Click on "ios device" on the top of the Coconut battery display on your mac and this will tell you much about the battery in your ios device. If you don't have a Mac go to the App Store and search on battery. There are many apps that claim to give you info about your battery. These provide different levels of information so you'll have

-bash: Flutter: Command Not Found

Answer : So you are in the Mac OS right? Try inserting single quotes OR double quotes around the file path like below. It's better to work like this with file paths in source files. :) export PATH="/Users/carsoncarbery/development/tools/flutter/bin":$PATH or export PATH='/Users/carsoncarbery/development/tools/flutter/bin':$PATH

Approx Symbol Latex Code Example

Example: latex x element of symbol \documentclass{article} \usepackage{graphicx} \usepackage{amsmath} \newcommand\Inn{% \mathrel{\ooalign{$\subset$\cr\hfil\scalebox{0.8}[1]{$=$}\hfil\cr}}% } \begin{document} \[ A\in B % one stroke in middle \] \[ A\Inn B % two strokes in middle \] \end{document}

Bad Lion Client Code Example

Example: badlion client good choice my dude

Align Two Divs Horizontally (one On Extreme Left And The Other On Extreme Right Of Container)

Answer : display:inline-block will not create a float issue so there is no need to add clearfix you can also use overflow:hidden instead of display:inline-block .header { display: inline-block; width: 100%; border: 1px solid red; } .playerOne { float: right; } .playerTwo { float: left; } <div class="header"> <div class="playerOne"> Oli </div> <div class="playerTwo"> Matt </div> </div> make it simple with flex .wrapper{ display: flex; justify-content: space-between } <div class="wrapper"><span>1</span><span>2</span></div> The problem is that you are not targeting the proper inline-block element. :) .header > div{ display: inline-block; } .playerOne{ float:right; }

Cloud Functions For Firebase Killed Due To Memory Limit Exceeded

Answer : You can set this from within your Cloud Function file on Firebase. const runtimeOpts = { timeoutSeconds: 300, memory: '1GB' } exports.myStorageFunction = functions .runWith(runtimeOpts) .storage .object() .onFinalize((object) = > { // do some complicated things that take a lot of memory and time }); Take from the docs here: https://firebase.google.com/docs/functions/manage-functions#set_timeout_and_memory_allocation Don't forget to then run firebase deploy from your terminal. I was lost in the UI, couldn't find any option to change the memory, but finally found it: Go to the Google Cloud Platform Console (not the Firebase console) Select Cloud Functions in the menu Now you see your firebase function in here if it's correct. Otherwise check if you selected the right project. Ignore all checkboxes, buttons and menu items, just click on the name of the function . Click on edit (top menu) and only change the allocated me

Python Ascii Colors Code Example

Example 1: ansi colors Black \e [ 0 ; 30 m Blue \e [ 0 ; 34 m Green \e [ 0 ; 32 m Cyan \e [ 0 ; 36 m Red \e [ 0 ; 31 m Purple \e [ 0 ; 35 m Brown \e [ 0 ; 33 m Gray \e [ 0 ; 37 m Dark Gray \e [ 1 ; 30 m Light Blue \e [ 1 ; 34 m Light Green \e [ 1 ; 32 m Light Cyan \e [ 1 ; 36 m Light Red \e [ 1 ; 31 m Light Purple \e [ 1 ; 35 m Yellow \e [ 1 ; 33 m White \e [ 1 ; 37 m Example 2: python ansi escape sequences color collection class colors : reset = "\033[0m" # Black fgBlack = "\033[30m" fgBrightBlack = "\033[30;1m" bgBlack = "\033[40m" bgBrightBlack = "\033[40;1m" # Red fgRed = "\033[31m" fgBrightRed = "\033[31;1m" bgRed = "\033[41m" bgBrightRed = "\033[41;1m" # Green fgGree

Angular CLI Ng Command Not Found On Mac Os

Image
Answer : After days of googling and getting no help neither on here nor from @Angular github which is pretty much useless, was finally able to resolve the issue and get my angular ng command not found issue resolved following these steps: 1. Instal nvm Issue these 3 commands to install nvm. (Angular documented steps https://angular.io/guide/setup-local to setup your environment did not work for me). So I installed nvm like so: curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.0/install.sh | bash export NVM_DIR="/Users/your-user-name/.nvm" [ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" After this, make sure you restart terminal and you should be able to issue nvm --version to see version of installed nvm. 2. Install node using nvm nvm install stable nvm install node 3. Finally, install angular npm install -g @angular/cli 4. Restart terminal Restart terminal and you should be able to use ng version to s

Sprintf Arduino Float Code Example

Example: arduino sprintf float // On arduino, sprintf does not support formatting floats, but it can be done // with some simple integer formatting: float f = 3.14 ; sprintf ( str , "Float value: %d.%02d" , ( int ) f , ( int ) ( fabsf ( f ) * 100 ) % 100 ) ; // str will now be: "Float value: 3.14"

Boot Windows From GRUB Rescue

Answer : When GRUB is gone, so is the ability to boot into Windows. You would now need to boot from the Windows CD to restore the Master Boot Record (MBR). You can also use other boot CDs such as the Ultimate Boot CD for Windows, Bart PE or Hiren's Boot CD in case you don't have Windows installation media handy. Here are the steps: Boot from the Windows CD and choose "Repair". Alternatively, boot from one of the other aforementioned boot CDs and run a command prompt. For Windows 8 computers: 1. Insert disc 2. set boot order to disc at first priority 3. reboot, wait for installer to load 4. select language and keyboard type and click continue 5. DO NOT CLICK INSTALL, instead click repair my computer in the bottom left corner 6. click troubleshoot 7. click advanced 8. click command prompt and enter the commands below. Add more tutorials for Operating Systems please. Run the the following two commands in a command prompt: bootrec /fixmbr bootrec /fixboot

AspNetCore.Mvc.Core Version Mismatch

Answer : <PackageReference Include="Microsoft.AspNetCore.App" /> I had the same issue, after add this line to unit test project, it start pick right version of Microsoft.AspNetCore.App. Update The issue noted below has been fixed & you should be able to benefit from implicit package versioning and reference like below without providing the version number of the package. <PackageReference Include="Microsoft.AspNetCore.App" /> Original Answer This issue is because of the Implicit Versioning that was introduced for Microsoft.AspNetCore.App metapackage. With implicit versioning the sdk decides the version & it resolved it as 2.1.1 However, it was resolving to version 2.1 for the nunit test project. Specifying the version number for the nunit project like <PackageReference Include="Microsoft.AspNetCore.App" Version="2.1.1"/> and performing dotnet restore helped resolve this issue. There is a ticket for thi

Can Scrapy Be Used To Scrape Dynamic Content From Websites That Are Using AJAX?

Image
Answer : Here is a simple example of scrapy with an AJAX request. Let see the site rubin-kazan.ru. All messages are loaded with an AJAX request. My goal is to fetch these messages with all their attributes (author, date, ...): When I analyze the source code of the page I can't see all these messages because the web page uses AJAX technology. But I can with Firebug from Mozilla Firefox (or an equivalent tool in other browsers) to analyze the HTTP request that generate the messages on the web page: It doesn't reload the whole page but only the parts of the page that contain messages. For this purpose I click an arbitrary number of page on the bottom: And I observe the HTTP request that is responsible for message body: After finish, I analyze the headers of the request (I must quote that this URL I'll extract from source page from var section, see the code below): And the form data content of the request (the HTTP method is "Post"): And

Active Admin Action Item/member Action

Answer : This can be done with the following: ActiveAdmin.register Post do index do column :name actions defaults: true do |post| link_to 'Archive', archive_admin_post_path(post) end end end Note that using defaults: true will append your custom actions to active admin default actions. For the friend who landed the page, In order to append more than 1 link Do Something Like: actions default: true do |model| [ link_to('Option 1', "#"), ' ', link_to('Option 2', "#") ].reduce(:+).html_safe end Found an answer here. You can do it using the below code with the code from the question (removing the action item block) index do ... actions do |subscription| link_to('Approve', approve_admin_subscription_path(subscription)) end ... end But I think there is a way to do it by appending an action to the default actions (so if you kn

C++ Compiler Online Gdb Code Example

Example 1: c++ online compiler This two are good C ++ compilers : https : //www.onlinegdb.com/online_c++_compiler https : //www.programiz.com/cpp-programming/online-compiler/ Example 2: cpp online compiler Best Site With auto compile : https : //godbolt.org/z/nEo4j7

Android Studio SDK Location

Answer : For Mac/OSX the default location is /Users/<username>/Library/Android/sdk . Android Studio on Windows 8: C:\Users\username\AppData\Local\Android\sdk\extras\intel\Hardware_Accelerated_Execution_Manager\intelhaxm-android.exe (in username : please enter valid username) Install it and restart your Android Studio. The above steps are similar for win 7 and also same for eclipse. Update: Windows 10 (similar steps) - pointed out by RBT This is the sdk path Android Studio installed for me: "C:\Users\<username>\appdata\local\android\sdk" I'm running windows 8.1. You can find the path going into Android Studio -> Configure -> SDK Manager -> On the top left it should say SDK Path. I don't think it's necessary to install the sdk separately, as the default option for Android Studio is to install the latest sdk too.

Ant Design Icons Not Working Code Example

Example: ant design not working in react js Add @ import '~antd/dist/antd.css' ; To the top of either / both of App . css and Index . css .

C++ Int To Cstring Code Example

Example 1: c++ convert int to cstring # include <isotream> # include <string> using namespace std ; string str = to_string ( int ) ; char cstr [ size ] = "" ; strcat_s ( cstr , str . c_str ( ) ) ; Example 2: c++ convert int to cstring # include <isotream> # include <string> string str = to_string ( int ) ; char cstr [ size ] = "" ; strcat_s ( cstr , str . c_str ( ) ) ;

Int/int = Float In C Code Example

Example 1: int to float c float percentage ; percentage = ( float ) number / total * 100 ; Example 2: what is float in c float variable ; Example 3: what is float in c A float is a number with a decimal point .

Bootstrap Button With Image Icon Code Example

Example 1: add image to boot strap button < button class = " btn btn-default " > < img src = " http://i.stack.imgur.com/e2S63.png " width = " 20 " /> Sign In with Facebook </ button > Example 2: how to icon button in html <! DOCTYPE html > < html > < head > < meta name = " viewport " content = " width=device-width, initial-scale=1 " > <!-- Add icon library --> < link rel = " stylesheet " href = " https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css " > < style > .btn { background-color : DodgerBlue ; border : none ; color : white ; padding : 12 px 16 px ; font-size : 16 px ; cursor : pointer ; } /* Darker background on mouse-over */ .btn :hover { background-color : RoyalBlue ; } </ style > </ head > < body > < h2 > Icon Buttons </ h2

Calculating Angles Between Line Segments (Python) With Math.atan2

Image
Answer : The easiest and most logically way to get at this problem is using the dot-product. Try this code (I've commented practically everything): import math def dot(vA, vB): return vA[0]*vB[0]+vA[1]*vB[1] def ang(lineA, lineB): # Get nicer vector form vA = [(lineA[0][0]-lineA[1][0]), (lineA[0][1]-lineA[1][1])] vB = [(lineB[0][0]-lineB[1][0]), (lineB[0][1]-lineB[1][1])] # Get dot prod dot_prod = dot(vA, vB) # Get magnitudes magA = dot(vA, vA)**0.5 magB = dot(vB, vB)**0.5 # Get cosine value cos_ = dot_prod/magA/magB # Get angle in radians and then convert to degrees angle = math.acos(dot_prod/magB/magA) # Basically doing angle <- angle mod 360 ang_deg = math.degrees(angle)%360 if ang_deg-180>=0: # As in if statement return 360 - ang_deg else: return ang_deg Now try your variations of lineA and lineB and all should give the same answer. An alternative solution using the fo

Bootstrap 4 Admin Lte Github Code Example

Example: adminlte npm install admin-lte@^3.0 --save

Change Placeholder Value Jquery Code Example

Example: change input placeholder text jquery $ ( "input[type=password]" ) . attr ( "placeholder" , "Type your answer here" ) ;

Adding A User To An Additional Group Using Ansible

Answer : Solution 1: If {{ user }} already exists in the system, you should use the following to just add it to a group: - name: adding existing user '{{ user }}' to group sudo user: name: '{{ user }}' groups: sudo append: yes To add it to a set of groups, you can use a comma separated list, for example groups: admin,sudo . Just beware that if you omit append: yes , your user will be removed from all other groups, according to the usermod man page. That would useful if you want to use a specific list of groups a user should belong to. Solution 2: According to the User module you can use this: - name: Adding user {{ user }} user: name={{ user }} group={{ user }} shell=/bin/bash password=${password} groups=sudo append=yes You can just add the groups=groupname and append=yes to add them to an existing user when you're creating them Solution 3: Please note that {{ user }} was changed to {{

Append In Array Python Code Example

Example 1: append element to an array python x = ['Red', 'Blue'] x.append('Yellow') Example 2: append python List = ["One", "value"] List.append("to add") # "to add" can also be an int, a foat or whatever" #List is now ["One", "value","to add"] #Or List2 = ["One", "value"] # "to add" can be any type but IT MUST be in a list List2 += ["to add"] # can be seen as List2 = List2 + ["to add"] #List2 is now ["One", "value", "to add"] Example 3: python add element to array my_list = [] my_list.append(12) Example 4: append object python >>> L = [1, 2, 3, 4] >>> L.append(5) >>> L [1, 2, 3, 4, 5] Example 5: add to python list array.append(element) Example 6: append a list to another list as element a = ['Jon', 'janni', 'Jannardhan'] b = ['28',