Android null pointer fragment components
NullPointerException accessing views in onCreate()
How much time have the Straw Hats spent with each other? Prevent external devices being locked to launcher If I connect an external device (such as a USB stick or android smartphone) it will automatically open in nautilus and get a corresponding icon locked to unity launcher. Is there any way to prevent this?  I'm using Ubuntu 14.04 ShareLaTeX compilation flags Is it possible and if so how can you pass flags to the ShareLaTeX compiler which one would have passed as parameters to the LaTeX compiler?  I am using the minted package and need to pass the -shell-escape flag. How to determine if Javascript object is an event? An elementary question regarding a multiplicative character over finite fields Get total amount of time between records when changed state I have a table, showing the status (healthy, broken) for each device at a given timestamp. I need to get the total amount of time of a whole breakdown.  So the data is stored like this:  device_owner   device_id    timestamp          status owner1         device_1     2001-01-01 09:00   0 owner1         device_2     2001-01-01 09:15   0 owner1         device_1     2001-01-01 09:30   1 owner1         device_2     2001-01-01 09:45   1   and so on.  The example above shows    device_1 was down from 09:00 to 09:30 (total 30 mins),   device_2 was down from 09:15 to 09:45 (total 30 mins)   What I need  Need to calculate the total amount of time for the whole breakdown for owner_1 will be 45 mins (from 09:00 to 09:45) instead of 60 mins (30 + 30).  device_owner   total_breakdown_min owner_1        45   What I've done  Currently I can define a breakdown time for each device separately (device_1 = 30mins, device_2 = 30mins). For this I transformed the table using LEAD over partition by device_owner, device_id and date part from timestamp:  device_owner  device_id     timestamp        status lead_timestamp   lead_status owner1        device_1     2001-01-01 09:00   0     2001-01-01 09:30     1 owner1        device_1     2001-01-01 09:30   1     NULL                 NULL owner1        device_2     2001-01-01 09:15   0     2001-01-01 09:45     1 owner1        device_2     2001-01-01 09:45   1     NULL                 NULL   So the datetime difference between timestamp and lead_timestamp in sum gives me the total breakdown time for a device.  ;WITH LeadStatus AS (     SELECT         D.*,         lead_status = LEAD(D.status) OVER (PARTITION BY D.device_owner, D.device_id, D.date ORDER BY D.datetime ASC),         lead_timestamp = LEAD(D.datetime) OVER (PARTITION BY D.device_owner, D.device_id, D.date ORDER BY D.datetime ASC)     FROM         #DeviceStatus AS D ) SELECT * FROM LeadStatus   It is the same device list for any owner. The data snapshot is to be taken between 2 dates (StartDate, EndDate). The records are written to a DB each n seconds and also when the device status changes. Problems installing xpatch I need to install the xpatch package to make changes to my biblatex setup. The readme file in the install package simply says to run “latex xpatch.ins.” I've moved the xpatch folder (including xpatch.ins and xpatch.dtx files) to the /usr/local/texlive/2011/../texmf-local/ folder. When I run the command above, I get the output Generating file(s) ./xpatch.sty  ! Cannot find file xpatch.dtx. \readsource ...ot find file \uptospace #1 \qStop }                                                   \else \processedLines \z@ ... l.34 ...xpatch.sty} {\from{xpatch.dtx} {package}}}   I've checked, and the .dtx file is in the folder. Any ideas what the problem is? How do I convert a light circuit with a single pole switch to use two 3-way switches? I have a box in the hall which includes a 3-way switch (with another switch at the other end of the hall), a single pole switch to the garage lights and a single pole switch to the exterior lights on the garage.  The single pole switch to the garage is wired with a 3 wire plus ground. The white and black wires feed the garage lights from the switch and the red wire feeds the garage ceiling outlets and is hot all the time.  In the garage I would like to add a 3-way switch for the garage lights and another 3-way switch for the exterior garage lights.  In other words I would like to be able to turn on both of those light locations from both the inside hall and the garage as well. I know that I will of course have to replace the existing single pole switches in the hall with 3-way switches and add a junction box in the garage with 2 3-way switches in it.  The thing that I don't know is what wiring connections I need to make.  Can you help? Calculating Latitude/Longitude X miles from point? I am wanting to find a latitude and longitude point given a bearing, a distance, and a starting latitude and longitude.  This appears to be the opposite of this question ().  I have already looked into the haversine formula and think it's approximation of the world is probably close enough.  I am assuming that I need to solve the haversine formula for my unknown lat/long, is this correct? Are there any good websites that talk about this sort of thing? It seems like it would be common, but my googling has only turned up questions similar to the one above.  What I am really looking for is just a formula for this. I'd like to give it a starting lat/lng, a bearing, and a distance (miles or kilometers) and I would like to get out of it a lat/lng pair that represent where one would have ended up had they traveled along that route. How to find out what init mode system is using? I was looking at this and I'm not sure how to find out which startup service is used on my machine (Ubuntu 14.04 on Digital Ocean). Can it use all of them? (upstart, system v, systemd) How to create a meta-package that automatically installs other packages? I'd like to be able to create a package that doesnt contain any code or programs itself, but instead installs other packages that exist in the repositories onto a computer, sort of how the ubuntu-restricted-extras package does? Proof that the One-Dimensional Simple Harmonic Oscillator is Non-Degenerate? Do you "gain" your 1st level? Regular Expressions: Is there an AND operator? Crash or "segmentation fault" when data is copied/scanned/read to an uninitialized pointer This was working perfectly on 17.10 but after upgrading to 18.04 yesterday, when the lid is closed the screen turns off but doesn't suspend properly.  I travel around a lot and immediately noticed the heat (and battery draining) when taking it out of the travel case.  I've tried uncommenting these lines in /etc/systemd/logind.conf  HandleLidSwitch=suspend HandleLidSwitchDocked=suspend   and restarted but didn't make any difference. Replace $ with £ using cat Command I have file test_output_archive.svd with some Dollar signs ($). I have generated a shell script Replace_dollar_pound.sh with cat command to replace dollar symbol with Pound (£) script is working on Solaris 10, Dollar getting replaced as expected. In Solaris 11, but the dollar is not getting replaced, not throwing any errors  Content of test_output_archive.svd : Line Rental $9  OOB Only for $10  Replace Dollar symbol with Pound at step1, Remove junk charactes at step 2, Remove temp file at step3, Rename at step4**  Content of Replace_dollar_pound.sh : cat test_output_archive.svd | tr "\044" "\243" > temp_archive.svd cat temp_archive.svd | tr -d "\302" > test_output_archive2.svd rm temp_archive.svd mv test_output_archive2.svd test_output_archive.svd  Any Modifications to be done as OS is updated to Solaris 11 ?? As I'm learning about iptables I've made a couple of mistakes and locked myself out.  What method(s) do you use to test rules without locking yourself out?  I'm using ubuntu server 12.04 LTS    All the answers below were helpful.  In the end I used a combination of options.  It also helps to have IPMI access to your remote server just in case!  But ideally test the rules locally on a replicated environment and test that first.  Vagrant helps in this regard to get test setups working quickly. What is the closed form for $\sum_{n=1}^\infty \frac1n - \frac1{n+1/p}$? A while ago, I started to look at expressions of the following form: $$ S_p:=\sum_{n=1}^\infty \frac1n - \frac1{n+1/p}, $$  where $p$ is prime, because otherwise things get too complicated for me at the moment.  What I found so far is the following: $$ S_p= p -\log(2p) - \frac12 \pi \cot\left(\frac\pi p\right) + T_p, $$ where $T_p$ contains $\frac{p-1}2$ terms $t_{p,k}$ of the form:  \begin{cases} \pm 2 \sin\left(\frac{k\pi}{2p}\right) \log\left(\sin\left(\frac{k\pi}{2p}\right)\right) \\ \pm 2 \cos\left(\frac{k\pi}{2p}\right) \log\left(\sin\left(\frac{k\pi}{2p}\right)\right)\\ \pm 2 \sin\left(\frac{k\pi}{2p}\right) \log\left(\cos\left(\frac{k\pi}{2p}\right)\right)  \\ \pm 2 \cos\left(\frac{k\pi}{2p}\right) \log\left(\cos\left(\frac{k\pi}{2p}\right)\right)  \end{cases}   An example can be found .     How does the closed form for $\sum_{n=1}^\infty \frac1n - \frac1{a+n}$ look like? (EDIT: where $a=1/p$) get the value from force:RecordData on Init handler Is there a way we can get the value from force:RecordData on init ? I am getting the onclick event of a button.  &lt;aura:handler name="init" value="{!this}" action="{!c.doInit}"/&gt;     &lt;aura:attribute name="recordId" type="String"/&gt;      &lt;aura:attribute name="showButton" type="Boolean" default="false"/&gt;     &lt;aura:attribute name="Opportunity" type="Object"/&gt;        &lt;aura:attribute name="parentOpp" type="Object"/&gt;     &lt;aura:attribute name="oppLoadError" type="String"/&gt;     &lt;force:recordData aura:id="oppRecordLoader"                       recordId="{!v.recordId}"                       fields="Id,                               Name,                               AccountId,                               Cohort_Sem__r.End_date__c,                               LeadSource,                               Staff_Referral_Detail__c,                               lead_source_detail__c"                       targetRecord="{!v.Opportunity}"                       targetFields="{!v.parentOpp}"                       targetError="{!v.oppLoadError}"                       /&gt;   JS:  doInit: function(component, event, helper) {                     var opp = component.get("v.parentOpp");                   console.log('Name Value: '+ opp.Name);     }   Error:     Action failed: c:createIWSRecord$controller$doInit [Cannot read   property 'Name' of null] quickActionHandlerHelper.js failed to create   component - forceChatter:lightningComponent