Disclaimer: I want solution verification unless a technique very similar to mine has been posted elsewhere, please do NOT mark this as a duplicate. This problem has been solved before on this website, however, I felt the need to craft my own solution, but have encountered a little roadblock. The Problem What is the expected amount of numbers -- such that each number is randomly selected from a uniform distribution over $(0, 1)$ -- to first exceed a sum of 1 when added together? My approach Let $X$ be a random variable that counts the number of numbers until we achieve a sum $\geq 1$. We know that $$ P(X = x) =\ P(sum\ of\ first\ x - 1\ items< 1)\cdot P(x^{th}\ number\ pushes\ the\ sum\ to\ \geq 1) \\$$ $$\ P(sum\ of\ first\ x - 1\ items< 1) = 1 - P(sum\ of\ first\ x - 1\ items\geq 1) \\$$ $$P(sum\ of\ first\ x - 1\ items\geq 1) = 1-\biggl (1-\frac{1}{x-1} \biggr)^{x-1} $$ Note that $P(sum\ of\ first\ x - 1\ items\geq 1) \neq P(X = x- 1)$ because the sum may exceed 1 because of any number in the set $\{n_1, n_2, ..., n_{x-1}\}$. Also, $\biggl (1-\frac{1}{x-1} \biggr)$ represents the chance that the $i^{th}$ item is larger than or equal to the average of the sum $[letting\ \overline n = average\ of\ any\ x-1\ numbers\ that\ sum\ upto\ exactly\ 1]$: $$\\ (n_1\ +\ n_2\ +\ ...\ +\ n_{x-1} < 1)\ \leftrightarrow\ \lnot(n_1\geq\overline n\ \land\ ...\ \land\ n_{x-1} \geq\overline n) \\ $$ $$P(n_i \geq\overline n) = \ 1-\overline n ,\ as\ n_i\ comes\ from\ U(0, 1)\ ;1\leq i \leq x-1 \\$$ $$\overline n,\ by\ our\ definition,\ = \frac{1}{total\ number\ of\ numbers} = \frac{1}{x-1} \\$$ Repeatedly iterating this probability for all $i$ (for all items in the set that we have been counting, except the last one), we get $\biggl (1-\frac{1}{x-1} \biggr)^{x-1}$. Taking then complement gives us the expression for $P(sum\ of\ first\ x - 1\ items< 1)$. $$ \\ $$ A similar method follows for $P(x^{th}\ number\ pushes\ the\ sum\ to\ \geq 1)$, as the $x^{th}$ item or $n_x$ must be greater than $\overline n$ to exceed a sum of 1 (as we previously derived), yields: $$ P(x^{th}\ number\ pushes\ the\ sum\ to\ \geq 1) = 1 - \frac{1}{x-1} \\$$ Overall, we get: $$\\ P(X = x) = \Biggl( 1-\biggl (1-\frac{1}{x-1} \biggr)^{x-1} \Biggr) \cdot \biggl( 1 - \frac{1}{x-1} \biggr) \\ $$ $$E[X] = \sum_{x} xP(X=x)\ \ \ for\ \ \ x>1\\$$ The issue Upon computing $E[X]$ using a calculator, $E[X]$ diverges. This does not make sense as there is a trivially small chance of getting a huge sequence of small numbers in the range $(0, 1)$ and NOT getting a single number high enough to exceed a sum of 1. Not sure where I am wrong; would appreciate any help.

Choose a random number between $0$ and $1$ and record its value. Do this again and add the second number to the first number. Keep doing this until the sum of the numbers exceeds $1$. What's the expected value of the number of random numbers needed to accomplish this?


Check the following sentence  I hope this email finds you well  Isn't it expressing a desire and therefore find should be in the subjunctive mood and therefore drop the third person "s"? I translated it  from Spanish, my native language, where the verb find is in the subjunctive mood.

I desire he visit us more often.     This is correct, right?     I hope he visit us more often.     Why is this incorrect? Why should I use “visits” instead?


I have below 2 systems with different IPs on the same network  A: 192.168.0.20 B: 192.168.0.21   From A system I need to copy files from a directory/folder to B system  Also I need to schedule it using crontab so that either all files should be copied or only latest files should be copied.

How to transfer a file from one system to another system easily?In my company employees will always ask us to transfer files from one system A to  system B and so on. What we do is first we access system A through samba and copy the required files and then we access the system B through samba and paste the files there.Is there any easy and quick way of transferring of files from one system to another system?Any GUI will be preferable, thanks in advance :)


I have 4 kids, (12,7,5) are boys and an almost 3yr old girl. The oldest two were completely potty trained around 3yrs old. My biggest problem right now is my almost 5yr old son who still to this day won't poop in the toilet. I have tried candy, stickers, everything. I have tried underwear, and there's always poop in it. He is still wearing pull ups. He will 'hide' in his room, then come out smelling really bad. I would love to put him in kindergarten in the fall...I just can't do it with him pooping in his pants. Half the time when I ask him 'do you have poop in your pull up' he says 'no' and I check him and he's dirty. Please any suggestions would be greatly appreciated.

My four year old is completely pee trained, no issues when dealing with that. But when it comes to using the toilet for poop, he refuses. I'm constantly catching him going in his pants, leaving streaks in his underwear three or four times a day until he finally gets it all out.  Driving me mad. I've tried to reward him with candy, but that didn't help. I tried to eat his candy when he went in his pants, that didn't help. I always give him massive praise when he goes in the toilet.  I've resorted to just putting him back in pull-ups and forgetting about it for a month or two. What worked for you and what do you suggest that I try?


Is this  $x^6 + x^5 + x^4 + x^3 + x^2 + x + 1$ irreducible in $\mathbb Q[x]$? Can you help please?

Can someone give me a hint how to the irreducibility of $X^{p-1} + \cdots + X+1$, where $p$ is a prime, in $\mathbb{Z}[X]$ ?    Our professor gave us already one, namely to substitute $X$ with $X+1$, but I couldn't make much of that.


What are "lenses?" I keep seeing the term in comments by people who have been around Linux forever, but it does not appear in any of the legends on the Ubuntu desktop.  And now you people are driving me up the wall - why are you confusing me with kubuntu, xubuntu, edubuntu, lubuntu ... and "Unity" ????????????????  How does KDE relate to Ubuntu?  I am trying to get a handle on Ubuntu, and now people are talking about Unity - which it appears is for nerds. There is no hope for refugees from Windows, looks like I will have to keep plugging along with Win 7.

This question exists as it fills a specific criterion.  While you are encouraged to help maintain its answers, please understand that "big list" questions are not generally allowed on Ask Ubuntu and will likely be closed per the . More information on the .   What kind of desktop environments or shells are there for Ubuntu users to install?  Please list a desktop environment or shell for each:   a description on why you like or suggest it (features, performance, etc.). a good screenshot, preferably of it running on Ubuntu and showing off some of its features. the minimal requirement for it to be usable, If there's any setting to lower it's requirement (Like kde's low-fat profile); how to enable the said setting some instructions on how to set it up if in the repositories, please provide a software centre link


Especially the chalk-like stroked food icons

For example, in this picture (ignore the logo):    I love how the background is cute and made up of small, simple images. Where can I find resources like this background, or how can I recreate it?


I just installed a danish version of the Lubuntu 14.04 and I have fought with this problem = NumLock is OFF when the logon dialog comes up AND my users have numbers in their passwords !  I have tried, I would say, ALL of the methods I found in this forum and none of them worked.  I shall say that some methods describes dialogs that I don't have or that looks different and DON*T have the fields mentioned in that method.   Other methods describes adding a line to files that are NON-EXISTENT or have no content at all - and if I that add the line described as the only line in that file, the machine wont start.  I'm very frustrated to be the only one in the world where NumLock can't be set ON in the logon dialog.  I'm NOT that skilled in this LINUX world, so bare with me.  Do you have a bullet proof method that can bee used to set the NumLock ON when the logon dialog is shown on the screen after re-boot ?

I am trying to force numlock to be on upon initial boot at the login screen on Ubuntu 12.04. The only solutions I have found so far switch numlock on only after initial login.  I'm looking to force numlock to be on when the login screen is displayed, and before the user has logged in. Can anyone assist?


I spilled coke on my Logitech K270 keyboard and now a couple of keys, once pressed, take minutes to retract.  The keyboard is touted as spill-proof. Can I pour water to clean it?

For the first time in my entire life yesterday, I accidentally spilled some latte in my ergonomic keyboard.  The keys are starting to stick a bit now, and I was just wondering if there was some way to get those keys unstuck short of buying a new keyboard.  Update   Last week I accidentally choked on some ironically named "Berry Blast Naked Juice" and spewed it all over my Microsoft Ergonomic 4000 keyboard at work.  This time I had to clean the entire keyboard.  Ah, after watching  on YouTube on how to clean the keyboard I tried nearly the same thing on my keyboard.   I just took the keys off, and washed them in the sink.     The keyboard still works, but I had to wait an entire week for the thing to dry out enough for use.  Although the keys looked dry to me when I initially reinstalled them in the keyboard, my belief is that there was still some water drops lodged in the dark/hollow cylinders that extend up into the key.  These water droplets are probably what caused all of the extra j's I would get when pressing the backspace key when I first tried it out a week ago.  After a week of letting it dry out, it seems to work again.    A small note about reinstalling the spacebar Also one more tip I would like to add, if you are re-installing the spacebar make sure that the connected side of the wire is attached to the actual spacebar key (it snaps right into place); Also, the disconnected part of the grey wire that lies bellow the space bar should fit between the two planks that jettison away from the back and forward keys/caplocks indicator lights.    Connect this end to the  Spacebar Key   ------------------------------------  |                                    |  <- grey wire from bellow the spacebar.  |                                    |   ---                              ---   | |             |                | | <- planks                  \ /             caplocks lights


I am making a custom iOS keyboard. Here is the current design:    The "delete all text" button (the one with the x that is surrounded by a square) is currently the only key on the keyboard that has an image instead of text. Should I make its function more clear by replacing the image with text?

I have the following Android custom keyboard:    The top 4 buttons are tabs  The middle 9 buttons are various keys that you can press for the keyboard to automatically generate a paragraph of text.  The bottom two buttons are a delete all text button and the "Done" button which goes back to the normal keyboard.  I am wondering, since the only icon I use in the keyboard is on the delete button, should I just replace that icon with the text: "Delete All Text" to keep it more consistent with the rest of the design, or should I keep it as is?


Show that for any measurable function $f$ in a measure space, we have: $$ ||f||_p \leq \max\{||f||_r ,||f||_s \} $$ whenever $0<r<p<s$. Now by splitting the integrals into parts where $f>1$ and $f\leq 1$, we could easily show that $$ ||f||_p \leq ||f||_r+||f||_s \ $$ But I have no idea how to show the stronger inequality as above.

Suppose $f\in L^{p}(\mathbb{R}^{n}) \cap L^{q}(\mathbb{R}^{n})$. How can I prove that for any $p \lt r \lt q$,  $$ \lVert f \rVert_{r} \leq (\lVert f \rVert_{p})^{(1/r-1/q)/(1/p-1/q)} (\lVert f \rVert_{q})^{(1/r-1/q)/(1/p-1/q)}\:? $$ I tried using Hölder to show that $f$ is in $L^{r}$ but I'm completely lost on how to go about it...


Prove or disprove: Let $A,B: {\Bbb R}^n \rightarrow {\Bbb R}^n$ be linear. If $A,B$ are both invertible, then $A\circ B$ is invertible  Can someone explain if this is true or false? I'm trying to come up with examples but I don't know where to start.

A crucial concept in linear algebra is that the composition of two invertible linear transformations is itself invertible. Here is the first proof I learned of this fact:  Proof: Suppose that $T_1: \mathbb{C}^n \to \mathbb{C}^n$ and $T_2: \mathbb{C}^n \to \mathbb{C}^n$ are both invertible with respective matrices $A_1$ and $A_2$. Then the matrix of their composition $T_2 \circ T_1$ is simply $A_2A_1$. Since $T_1$ and $T_2$ are invertible, we know that $\det(A_1) \neq 0$ and $\det(A_2) \neq 0$. Thus, we see that $\det(A_1A_2) = \det(A_1)\det(A_2) \neq 0$. Thus, the composition is also invertible. $\square$  I'm trying to now give a proof of this fact without using determinants. Any idea on where to start?


My iMac (mid-2010 model, Snow Leopard) has a problem with S.M.A.R.T status: Failing and it has become read-only. Because I didn't want to waste money on the repair, I bought an external HD, so the internal HD is now unnecessary. How can I disable mounting the internal Macintosh HD at boot?

I have an 2010 27" iMac with an SSD and a regular hard drive. Now that I've been using the machine for some time and have not come close to filling the SSD, I'd like to disable the spinning hard drive completely. Why? It makes a loud humming sound when it runs, and I don't use it for anything. Anything I can do short of taking apart this monster and ripping it out?  UPDATE: As of 3-Apr-2012 and OS X 10.7.3, the solution below works. Some programs occasionally spin up the drive, but it only hums for about 5 minutes then goes back to sleep.


In Naruto: Shippuden before Madara is able to retrieve one of his Rinnegan after being revived, he fights with the Tailed Beasts by using Susanoo even when he's blind. How is that possible?

Something that I am confused about Madara's powers.  When Madara used the Rinne Tensei to bring himself back to life, he did not have his eyes, but he had the First Hokage's face embedded into himself.  Even though he did not have his Sharingan or Rinnegan, he was able to use Susanoo.  Is there any explanation for these two anomalies?    His both eyes were closed at all times, and he had Rinnegan in both his eyes when he was brought back using Edo Tensei. Since his left eye had been destroyed when he was brought back to life using the Rinne Tensei, it is only natural that his right eye too was destroyed.


I have string "Return now" and I have a integer n that changes every time. Suppose that n = 2 I need to slice my string to sub-strings which has length of n. It should give: "Re" "tu" "rn" " n" "ow"  Suppose that n=3 It should give: "Ret" "urn" "now"  As you can see above if one of the words length doesn't equal to n it should add " "(space) on the left side of word for sub-string. How can I slice my string like that?

I have a list of arbitrary length, and I need to split it up into equal size chunks and operate on it. There are some obvious ways to do this, like keeping a counter and two lists, and when the second list fills up, add it to the first list and empty the second list for the next round of data, but this is potentially extremely expensive.  I was wondering if anyone had a good solution to this for lists of any length, e.g. using generators.  I was looking for something useful in itertools but I couldn't find anything obviously useful. Might've missed it, though.  Related question:


I am traveling for work.  My company sent me my hotel reservation.  It says "one adult" on it.  I am bringing my wife.  Do I need to sneak her into the room, or will I be fine?

We are going to an event and because of this event all hotels are fully booked. Now a friend wants to join us, but can't find accommodation. We are okay with him crashing in our hotel room, either on the couch or on a self-inflatable mattress. We have done this in the past where we secretly sneaked the "guest" in.   It is not that we don't want to pay the tourist tax, it is that when ask and the hotel says no, we can't sneak him in, because we drew attention to ourself. In many hotels you can just order another bed, but there are also a lot that don't have that service.   I don't have any ethical problems with my behavior of secretly hosting a guest. I did pay for the room. I don't like being sneaky about it, since again I do pay for the hotel room. Also if I have to choose between sneaking someone in the room to crash on the couch or let him/her sleep on bench in the park. I opt for the first.   Am I just worrying to much and will being honest about it in the end be acceptable to most if not all hotels?


My outlets are 14-2 NM wire, wired into the attic, is it ok to connect a  12-2 NM wire to the 14-2 wires and connect them to the panel box w a 15amp breaker???

My father-in-law is a builder. He has put in 20 amp and 15 amp breakers, and ran 12-2 as the home runs to the switch's and the first plug to make them hot. He then ran 14-2 to feed the rest of the plugs, lights, and ceiling fans.   Is it okay that he used different gauge wires on the same circuit?


I am trying to have two separate bibliographies that may share common references with the bibunits package. If I use a certain reference in bibunit 1, I want its number to be continued in bibunit 2. Additionally, I want references unique to bibunit 2 to start numbering at the next integer in the reference sequence ending in bibunit 1. The MWE below causes the two bibliographies to be numbered      [1]      [2]      [3]            [1]      [2]   and what I want is      [1]      [2]      [3]            [2]      [4]   Is this possible with Bibtex? I know biblatex can probably do this but I don't have time to migrate at the moment.  Interrupting edit: I made the switch to Biblatex in the end. That package is fantastic. The reason I thought I had a daunting chore in making the switch was Mendeley's .bib file contained a key O'Lastname. Every time I tried to switch, Biblatex would protest and I couldn't figure out why.  This question is now moot, but I'll leave it open in case someone answers it one day and another party finds that answer useful.  Here's the MWE:  \documentclass{article}  \usepackage[numbers]{natbib} \usepackage{bibunits}   \usepackage{filecontents}  \begin{filecontents}{\jobname.bib} @misc{A01,   author = {Author, A.},   year = {2001},   title = {Alpha}, } @misc{B02,   author = {Buthor, B.},   year = {2002},   title = {Bravo}, } @misc{D04,   author = {Duthor, D.},   year = {2004},   title = {Delta}, } @misc{C03,   author = {Cuthor, C.},   year = {2003},   title = {Charlie}, }  \end{filecontents}  \usepackage{lipsum}  \begin{document}  \begin{bibunit}[plainnat]     \nocite{A01,B02,C03}     \putbib[\jobname] \end{bibunit}    \begin{bibunit}[plainnat]     \nocite{B02,D04}     \putbib[\jobname]  \end{bibunit}  \end{document}

I'm using bibunit and Natbib packages with a numerical numbering.   \begin{bibunit}[plainnat]     \nocite{ref1,ref2}     \putbib[mybiblio] \end{bibunit}  \begin{bibunit}[plainnat]     \nocite{ref3,ref4}     \putbib[mybiblio]  \end{bibunit}   How can I set the starting number for ref3 and ref4 to be different from 1 (say 15), without affecting the starting number for ref1 and ref 2? The desired result is the following:   [1] ref 1 [2] ref 2 [15] ref3 [16] ref4


I am trying to reproduce the following equation in LaTeX:     nopt(d, B) = argminn {Pt - LMI (d, n, ω + 0.5B) >= Pth }   and the syntax I have used is the following:  $n_{opt}\left(d, B\right) = argmin_n\lbraceP_t - L_{Mi}\left(d, n, \omega + 0.5B\right) \geq P_{th}\rbrace$   This does not compile and I get the     !Undefined Control Sequence Error.   Any suggestions on what I am missing here?

I am having a tough time reproducing the following equation in LaTeX:     C =  2/(ω^2 N^(2 )µπa)   This is the code I have:  C = \frac{2}{\omega^2N^2\mu\pia}   However, this throws an error. What am I doing wrong?


The kinematic state is defined as the position and orientation in space. The dynamic state is defined as the associated velocities.  What is the correct terminology for the combined kinematic and dynamic state? Can I call it the kinetic state?

I have noticed that authors in the literature sometimes divide characteristics of some phenomenon into "kinematics" and "dynamics".    I first encountered this in Jackson's E&M book, where, in section 7.3 of the third edition, he writes, on the reflection and refraction of waves at a plane interface:        Kinematic properties:   (a) Angle of reflection equals angle of incidence   (b) Snell's law   Dynamic properties   (a) Intensities of reflected and refracted radiation   (b) Phase changes and polarization      But this is by no means the only example.  A quick Google search reveals "dynamic and kinematic viscosity," "kinematic and dynamic performance,"  "fully dynamic and kinematic voronoi diagrams," "kinematic and reduced-dynamic precise orbit determination," and many other occurrences of this distinction.  What is the real distinction between  and ?


I've read how the use of the word I isn't always necessary when writing a resume as the employer already knows that the resume belongs to the job applicant. However some of these sentences sound incomplete without the word I, So i would like to know if its really necessary to include the word I in the beginning of these sentences.   1.I have maintained a clean record, both at school and work, by always acting with honesty.   2.I grew up in a respectable household and was brought up to appreciate and uphold moral values.  3.I strictly  adhere to instructions and devote undivided attention to details.  OR  1.Maintained a clean record, both at school and work, by always acting with honesty.   2.Grew up in a respectable household and was brought up to appreciate and uphold moral values.  3.Strictly adhere to instructions and devote undivided attention to details.  Note: I am not asking anyone to proofread my sentences , I just want to know if i can use the sentences with or without I in the beginning.

Possible Duplicate:          Is it correct to start a sentence with did.     Did my work.   instead of      I did my work.   while answering my emails?


I have had Ubuntu installed on my laptop now for a while, I have also been switching distros. Now that I want to install windows back again I am having a problem:   I have tried making a bootable windows sd card with my windows 8.1 .iso file (which I checked and it works on Virtualbox). I tried the dd method (in the terminal) and disk image writer (both used to work for me fine with other linux iso's).   It seems to have writen the .iso file successfully, however when I boot from the sd card in the BIOS, it doesn't recognise the OS and boots back into Ubuntu. I also tried this with Windows XP and Windows 7.   Is this a partition problem?

I'd like to create a Windows bootable USB stick, but I don't have a Windows machine with me at the moment to do so. How could I achieve the same using Ubuntu?


I'm struggling around with this german umlaut problem:  include.php  function test() {   $Ausgabe = "äöü";   return $Ausgabe; }   echo.php (html meta charset="utf-8")  require_once('include.php'); echo 'Content from function: '.test(); echo '<br>'; echo 'Direct: äöü';   Delivers:  Content from function: ���  Direct: äöü  Why is there a difference?

I'm setting up a new server and want to support UTF-8 fully in my web application. I have tried this in the past on existing servers and always seem to end up having to fall back to ISO-8859-1.  Where exactly do I need to set the encoding/charsets? I'm aware that I need to configure Apache, MySQL, and PHP to do this — is there some standard checklist I can follow, or perhaps troubleshoot where the mismatches occur?  This is for a new Linux server, running MySQL 5, PHP, 5 and Apache 2.


Close voters:   does not address the question "When are negative counts in the achievement dialog supposed to be shown in the top row?  They are shown sometimes, but not always."  Negative counts aren't shown in the achievement dialog's top row:  - Update: sometimes, negative counts are shown in the achievement dialog's top row:  so the behavior seems inconsistent. When are negative counts in the achievement dialog supposed to be shown in the top row?

The "Recent achievements" icon (looks like a bar graph in the top bar for signed in users) doesn't highlight when one only has recent reputation losses.  I'd like it to highlight whenever my reputation changes, positive or negative - in fact I'd suggest it's far more important for me to review posts that get a downvote than those that got an upvote.  Is there a reason negative reputation events don't cause it to highlight?


I have saved a full piggy bank of coins and I never bothered to count them. I understand that there are money counting machines that usually charges about 10% of the value to convert them into paper money, but I do not want to lose 10% of the value in my piggy bank. So what are some recommended ways to spend the coins there? For example, is it proper to use the coins to:   pay tips? make a contribution to a local church on Sundays? pay for small item at convenience stores? give to homeless people who asks for money?   Will a bank (in the US) usually count the coins and add value to my bank account without a fee?  I am confident that most vending machines will take the coins, but I do not buy products from vending machines often as they are usually dearer than the products in supermarkets.

So I have about $50 in pennies, dimes and nickels.  What would you do with it?  I'm asking because I don't think spending hours rolling up the change and taking it to the bank is the best/most creative thing.  More info:  I took the change to the bank (not rolled up).  The banker asked me if I knew the exact amount... when all I had was a huge bag of change weighing like 30-40 pounds :-p  I said I didn't know the exact amount.  So the banker put all the change into a different bag, gave me a little receipt and said look for a deposit to your account in about a week.  Next time I'll just find a coinstar machine. I don't like waiting a week to have my change counted.  Also I'm sure the banker could fish out the quarters and no one would be the wiser :-)


I'm attempting to lower a face with out causing a edge to be pulled down with it how can this be achieved...  I have tried extruding and moving the face downwards, but when I delete the faces that are left I'm still left with the edges present messing up the mesh...      I wish to avoid the second image

Here is the image to explain what i want    left box shows how i have set loopcuts (green is the face that i am extruding and moving). Middle one is what i want to get. The right is the issue with blender. the red faces will remain. (i have removed doubles on those faces) So is it possible to extrude inwards so that you dont have those faces hanging ? I know i could just delete those faces and thats it. but if you have lot of elements with similar idea it will get time consuming.  Thanks


Well, suppose that a cashier owes a customer some change and in that cashier’s drawer are quarters (25¢), dimes (10¢), nickels (5¢), and pennies (1¢). The problem to be solved is to decide which coins and how many of each to hand to the customer  if some customer is owed 41¢, the biggest first  bite that can be taken is 25¢ 41 - 25 = 16  another 25¢ bite would be too big cashier would move on to a bite of size 10¢, leaving him or her with a 6¢ problem  At that point the cashier calls for one 5¢ bite followed by one 1¢ bite   #include <cs50.h> #include <stdio.h>  int main(void) {        float f = get_float("Enter Cash: ");      int q;     int d;     int n;     int p;      float quarter = 0.25;     float dimes = 0.10;     float nickels = 0.05;     float pennies = 0.01;      while ( f != 0)     {          if (f >= quarter){              f = f - quarter;             q = q + 1;         } else if (f >= dimes && f < quarter) {              f = f - dimes;             d = d + 1;         } else if (f >= nickels && f < dimes) {              f = f - nickels;             n = n + 1;                 } else {             f = f - pennies;             p = p + 1;         }         printf ("Quarter: %d \n Dimes %d \n Nickels %d \n Pennies %d \n", q,          d, n, p);     } }    $ ./cash Enter Cash: 6 Quarter: 32768   Dimes -1230737968   Nickels 0   Pennies 4205168  Quarter: 32769   Dimes -1230737968   Nickels 0   Pennies 4205168  Quarter: 32770   Dimes -1230737968   Nickels 0   Pennies 4205168  Quarter: 32771   Dimes -1230737968   Nickels 0   Pennies 4205168  Quarter: 32772

Consider the following code:   0.1 + 0.2 == 0.3  ->  false   0.1 + 0.2         ->  0.30000000000000004   Why do these inaccuracies happen?


I am having no luck with the following:  I would like to set up a driver that looks at the Z position of an object falling per RB physics (not BGE) and controls some constraint settings based on Z position.  To be more specific, I am trying to use a driver to break a constraint or reduce its breakable threshold as the object (constrained with other falling objects) nears the passive ground plane.  Any thoughts would be appreciated.

I'm thinking weight paint but maybe I mean Dynamic Paint or even something else I'm unaware of.  I have cell fractured a long thin cylinder which I am dropping onto a plane using Blender 2.71 Render (not BGE).  It has been rotated a little so that its contact with the plane starts at the lowest shard and works its way to the top.  Of course, the whole thing simply falls apart on first contact.  So, I use rigid body constraints and this works fine keeping it together.  What I want, however, is a progressive shatter as the cylinder shards come into contact.  In other words, I want the shards which have not yet reached the plane to stay intact. Keyframing this one shard at a time is tedious, prone to error, and all but impossible when there are hundreds of shards.  Can I use weight paint or anything else to control the enable function (or any other property or function) associated with the constraints to switch from enabled to not enabled as a function of time (or frame number)(in other words, as a function of color)?


I'm completely new at analyzing survey answers, and it will be great if anybody can help me out here with conversion technique. Survey participants were provided answer choices on a ranking scale of 1-4 and we got the average.  We're trying to change the ranking scale to 1-5. I understand that there are different schools of thoughts that participants would have responded differently if they'd been given a different range of scale, but it needs to be converted.   I keep thinking that there must be a formula that can be applied to this, but I cannot come up with it. For instance, if average score is 3.4, what kind of arithmetic formula should I use to get an average score on the 1-5 scale?   Any insight will be greatly appreciated & thank you so much!

I am new at this and could use some help with a conversion.  Survey participants were given the answer choices on a ranking scale of 1-9 for each question. We then averaged the results for each question to understand what the average answer was for each question. For example, for question B, the average answer was 8.1 out of 9.  How would I convert the average to what the number would be on a 1-5 scale? So using the example above, 8.1, what formula would I have to apply to that number so that the average would be a number on the 1-5 scale? i.e. "the average answer was X.X out of 5.  Thanks for your help. The answer may be very simple, but at this point, I think I have over-thought this problem.


Let $f(x)\in \mathbb{Z}[x]$ and let $\frac{r}{s} \in \mathbb{Q}$ be a root of $f(x)$ with $(r,s) =1$. Show that $r-ms$ is a divisor of $f(m)$ for any integer $m$.  The book’s suggestion is: Write $f(x)$ in the form $\sum a_r(x-m)^r$. Show that every $a_r$ is an integer. Then, evaluate $f(x)$ in $r/s$.  I don’t see how $f(x)$ could be written in that form so without the book’s suggestion I have $$f(x)=(x-r/s)(g(x))$$ for some $g(x)\in\mathbb{Z}$ which implies $g(x)=(-1/s)(h(x))$ if $(r-ms)\mid f(m)$. I also tried by dividing $\frac{f(x)}{(x-r/s)}$ but still get no proof of this assumption. Thanks in advance.  Note: $f(x)=a_nx^n+\cdots a_1x + a_0$, $s\mid a_n$ and $r\mid a_0$

How to prove that $p-mq \mid f(m)$ where $m$ is any integer, $$f(x) = A_0 + A_1 x + A_2 x^2 + ... + A_{n-1} x^{n-1} + A_n x^n$$ $$f(x)∈ ℤ[x]$$ $p/q$ is a zero for $f(x)$ and $p$ and $q$ are coprime $⇒ \, ∃u,w ∈ ℤ \mid 1 = up + wq$.


I have been working on getting the Id of a random non closed question and came up with this:  Select Id from posts where ClosedDate IS NULL ORDER BY RAND()    For some reason I get the same results every time. Is this a bug or am I just doing this wrong?

When answering , I wrote up this , which works fine from my machine. However, on SE data, it always picks the same winner. Is it possible that SE Data fixes rand() to a specific number?  If so, why is that?


Last week my network  which completely saturated our 100 MBps link to the internet and pretty much shut down all the sites and services we host.  I understand (from this experience as well as ) that I cannot handle a DDoS attack such as this on my end, because even if we drop the packets they have still been sent over our link and are saturating our connection.  However when this happened my ISP was (strangely enough) unable to tell me where the attack was coming from. They said if I could determine the source (E.G. via tcpdump) I could give them IP addresses to block. But things were so overloaded that running tcpdump was impossible. I just couldn't view the output.  Nearly all our servers are behind a pfSense router. How can I detect a DDoS attack using pfSense so I can tell my ISP who to block? I don't want to block the attack myself, I just want to get alerts / be able to view a list of IP addresses that are using way more bandwidth than normal.  The pfSense router is running Snort, if that can be used to assist in any way.

This is a  about DoS and DDoS mitigation.   I found a massive traffic spike on a website that I host today; I am getting thousands of connections a second and I see I'm using all 100Mbps of my available bandwidth.  Nobody can access my site because all the requests time out, and I can't even log into the server because SSH times out too!  This has happened a couple times before, and each time it's lasted a couple hours and gone away on its own.  Occasionally, my website has another distinct but related problem: my server's load average (which is usually around .25) rockets up to 20 or more and nobody can access my site just the same as the other case.  It also goes away after a few hours.  Restarting my server doesn't help; what can I do to make my site accessible again, and what is happening?  Relatedly, I found once that for a day or two, every time I started my service, it got a connection from a particular IP address and then crashed.  As soon as I started it up again, this happened again and it crashed again.  How is that similar, and what can I do about it?


Is the following not equivalent to the traditional definition of a complete metric space (i.e. every Cauchy sequence converges)?  $X$ is complete if for every $\{x_n\} \subset X$ such that $x_n \rightarrow x$, then $x \in X$.  If this is not the same, what is a counterexample? If it is the same, why don't we use this definition instead of involving Cauchy sequences?

The intuition of the completeness to me is that the limit of any sequence converges to the point inside the set itself. But why we define a set to be complete as any Cauchy sequence converge into the set itself? It seems a more complex definition than a simple convergent sequence. Why we use Cauchy sequence rather than a simple sequence?  For the simple sequence, can we use $\lim_{n\rightarrow \infty }x_n=x$?


Basically my code supposes to calculator the weight by using the height. The user has to choose between if he/she is male or female. After that, the if-else statement supposes to do the calculation. The problem is when the user types the choice between Male or Female. The code neglects the choice and goes to the else statement right away to tell that your choice is wrong.   import java.util.Scanner;  public class cals {  public static void main(String[] args) {      Scanner Scan = new Scanner(System.in);     System.out.println("\nAre you Male or Female: ");     String Choice = Scan.nextLine();     if (Choice == "Male") {         System.out.println("What is your hight in CMeters: ");         int Height = Scan.nextInt();          if (Height > 160) {             int Your_weight = (Height - 100) * 90 / 100;             System.out.println("Your_weight is: " + Your_weight);         }          else {             int Your_weight = (Height - 100);             System.out.println("Your_weight is: " + Your_weight);         }     }      else if (Choice == "Female") {          System.out.println("What is your hight in CMeters: ");         int Height = Scan.nextInt();          if (Height > 160) {             int Your_weight = (Height - 100) * 90 / 100;             System.out.println("Your_weight is: " + Your_weight);         }          else {             int Your_weight = (Height - 100);             System.out.println("Your_weight is: " + Your_weight);          }      }      else {         System.out.println("you Enter a worng choice");     }  }   }

I've been using the == operator in my program to compare all my strings so far. However, I ran into a bug, changed one of them into .equals() instead, and it fixed the bug.  Is == bad? When should it and should it not be used? What's the difference?


I want to install Ubuntu to the oracle virtual machine. My computer has windows 10 I set up Ubuntu in the virtual machine and ran the ISO and it went to 100% disk checking. I got to the point where it says to try unbuntu or install it. I choose install. the first option is the installation type and it says no detected operating systems and a warning underneath saying this will delete all programs etc. If I choose erase disk and install ubuntu. What happens if I choose this option will it wipe my entire computer? I click on the option - something else - (to see if thats a better option) but when I tried to install from there it says no root file system is defined.

I am installing on VirtualBox on Mac.  During install it asks: Erase disk and install Ubuntu  Question: Is it asking about the virtual disk - hopefully. Is it safe to answer OK?


Let's consider the space $l_2$ (all sequences $x$ with $\sum x_i^2 < +\infty$) and its subset $Z = \{x|\sum x_i = 0\}$. I want to prove that the closure of $Z$ is $l_2$, but I can't. I tried to build some constructions to get $Z$ elements $\epsilon$-close to an arbitrary $l_2$ element, but nothing comes out. I ask for some help. Is there any theorem or a method which might help me?

Let H be the Hilbert space of square-summable sequences of reals.  A few years ago I thought I had proved that the subspace Z of real sequences with only finitely many nonzero terms, such that they sum to zero, is dense in H.   (Since then I've seen this confirmed in Rudin's text, Functional Analysis, 2nd ed., but only as a teensy subquestion in a terminally hairy exercise.)  Now I can't quite reproduce my proof, so it may have been wrong. Can someone please tell me how to prove that.    (What I tried was taking an arbitrary point c = (c1,...,ck,...) of H, and defining the point d(N) in H as follows for N $\ge$ 1:  First set AN = (c1+...+cN) / N. Then set d(N)k =  ck - AN for k $\le$ N, and set d(N)k = 0 for k > N.  Clearly, the element d(N) of H lies in the subspace Z defined above. The squared Hilbert norm of its difference with c is of form N(AN)2 + T(N), where T(N) is just the squared norm of the tail of c, and so goes to 0 as N$\to\infty$.  I'm left with the expression N(AN)2, which so far I haven't been able to prove $\to$ 0 as N$\to\infty$.  I suspect this is true, and it works on all the examples I've tried so far.)  NOTE: I'm only interested in a down-and-dirty proof that doesn't invoke anything but simple inequalities.  Thanks for any help you can offer.


I have prepared strawberry sauce by cooking strawberry with sugar, squeezing juice of a lime. The mixture was cooked for 10 minutes and mashed. Chia seeds were added in the end and cooled. Strawberry season is ending soon and I would like to make more of this if it can last for few months. Since I have not cooked it long enough to turn into a jam am unsure of its shelf life. How long can I store it in regular refrigerator and how long would I be able to store it in a chest freezer. I plan to deep freeze it in a chest freezer and thaw/reheat it when required.

How do I know if a given food or ingredient I have is still good, or if I should discard it?  How can I best preserve a food or ingredient?     This broad question is intended as a "general reference" question to quickly answer many how long will food keep for? questions. Please feel free to edit this question to expand and clarify as needed.


Traditional programming with while-loop is done with a single parameter ex:   while(1) (or) while(a==b) (or) while(a&&b) (or) while(!a) etc The code below takes two parameters in the while loop  ssize_t r_read(int fd, void *buf, size_t size)  {     ssize_t retval;     while (retval = read(fd, buf, size), retval == -1 && errno == EINTR);     return retval; }    Is there any limit to the parameters inside the while loop? Is there any possible explanation for this or does this methodology have a name?

How does the comma operator work in C++?  For instance, if I do:  a = b, c;     Does a end up equaling b or c?   (Yes, I know this is easy to test - just documenting on here for someone to find the answer quickly.)  Update:  This question has exposed a nuance when using the comma operator.  Just to document this:  a = b, c;    // a is set to the value of b!  a = (b, c);  // a is set to the value of c!   This question was actually inspired by a typo in code.  What was intended to be  a = b; c = d;   Turned into  a = b,    //  <-  Note comma typo! c = d;


Rajiv Gandhi was the sixth prime minister of India. How can I ask the following question correctly?  How many th prime minister Rajiv Gandhi?  Is it correct ?

Possible Duplicates:             Given that I want to know Barack Obama is the 44th President of U.S.A, how can I frame a question like:     The how manyeth president is Barack Obama?


Let us suppose I have an laser.I'm swinging my hand so that the spot of light moves in screen. Screen is at arbitrary distance so when I swing  my hands the spot go up and down on screen, Now It is clear that speed of spot will be greater than that of my hands. Now I'm swinging my hands with speed of light (almost) then spot must go with speed greater than speed of light. which is a contradiction?  Please Correct me.

Minutephysics has a popular  called "How to break the speed of light". In the video it states that if you flick your wrist while pointing a laser that reaches the moon, that the spot of light on the moon will travel 20 times the speed of light. Now don't get me wrong, I do like their videos, just this one seemed a bit fishy to me. At first I thought it all practically made sense, then I realised something...  In my mind, I would think that light particles (photons) travel from the laser to the moon and bounces off the moon and back to your eye (it doesn't just stay there, in place, so you can't move it around). Now, what he is stating is that if you flick your wrist these photons that have travelled to the moon will move along with your wrist. Wouldn't these photons be bouncing off of other objects or still travelling to the moon by the time you flick your wrist? i.e. dissipating, therefore new photons will be travelling to the moon (from the laser directly).  For example: let's say you point the laser at the moon, and once it reaches the moon, you wait a couple of seconds and then flick your wrist. The laser that you have flicked will emit photons in every direction that your wrist was in, correct? i.e. The photons would shoot out in a straight line (unless disrupted) continuously, with your wrist taking no affect on the speed of the photons.  So back to the question, is this video wrong?


I'm trying to learn RegEx and tried to solve the below scenario:  Assume the the below string is a cell in a data input with thousands of rows:  "He who sleeps on the floor will not fall off the bed.Robert Gronock16-APR-2005This is a valid record."   I wrote the Regex ".+\s*(\d+-.+-\d+|[[:alpha:]]{3}\s*\d+,*\s\d+)" to extract the date only from the string but what I get is 6-APR-2005 missing the 1 at the beginning.  I don't want to use {2} as some rows has single digit like 8-Apr-2005 and it would return Null.  What I am doing wrong in the RegEx?

I have this gigantic ugly string: J0000000: Transaction A0001401 started on 8/22/2008 9:49:29 AM J0000010: Project name: E:\foo.pf J0000011: Job name: MBiek Direct Mail Test J0000020: Document 1 - Completed successfully  I'm trying to extract pieces from it using regex. In this case, I want to grab everything after Project Name up to the part where it says J0000011: (the 11 is going to be a different number every time). Here's the regex I've been playing with: Project name:\s+(.*)\s+J[0-9]{7}:  The problem is that it doesn't stop until it hits the J0000020: at the end. How do I make the regex stop at the first occurrence of J[0-9]{7}?


Can you guys instruct me how to migrate a HDD to a SSD?  Also I was thinking about having ubuntu and win8 in the same SSD, 250GB each and then have the HDD for files only. I bought an MSI GT70 20C, do you guys recommend this idea of having both operative systems?

Is there a free way to clone a full Windows 7 installation from HDD to SSD? (The free part is important, I know I can pay for Acronis True Image.)      SSDs are usually much smaller than HDDs which complicates matters. For instance, I have about 50GB data, my new SSD is 80GB but I still can't use Windows clone/restore system if my HDD is something like 300GB.  Therefore, I'm looking for a third party tool that will be able to:   Create a clone of my C: partition Store it onto an external USB drive Boot from some rescue / restore CD Load the image onto the new SSD   Acronis True Image seems like a tool that should support this but it's a paid-for software and the trial version cannot create clones. Acronis Migrate Easy is a fully functional tria for 15 days but need both the HDD and SSD connected at the same time which is a bit of a problem for me as a laptop user.  P.S. I almost got there combining Windows image backup combined with Acronis True Image restore CD (which can load .vhd's) but was not able to boot as some boot information were probably lost and could not be repaired using the Win7 installation DVD.


I'm working on an iOS Game and I found a piece of code on this site that I really want to use, and don't want to waste time studying and writing my own similar one that follows the same basic idea. Am I allowed to directly copy the code for my game?  Thanks in advance.

I was wondering what kind of restrictions there are, if any, for code posted on StackOverflow?  In other words, I'm hoping StackOverflow has a clause that makes any posted code completely free of restrictions for reuse? (Both questions and answers).


My course teacher for Pattern Recognition course made this statement that orthonormal basis is better as compared to orthogonal or linearly independent basis when it comes to pattern recognition, or linear algebra in general, but she didn't tell us why!  I know that orthonormal basis consists of unit vectors which are orthogonal to each other. But what makes them 'better'? Or in which scenario do the above mentioned other two basis fail and orthonormal basis survive?  Do orthonormal basis make analyzing things easier? How? Any help is appreciable. Thanks in advance.

Why is it important that a basis be orthonormal? The requirement for Orthonormal basis is so often repeated in linear algebra that it seems linear algebra depends on it as requirement. What is gained (or lost) if the basis are not orthonormal? Is it just for convention and convenience or is it just to restrict to the type of problems that assumption of orthonormality is beneficial?


I know it is true if H is finite,but how about H is infinite?Any ideas are welcome .Thanks.

Let $G$ be a group, $H<G$ a subgroup and $g$ an element of $G$. Let $\lambda_g$ denote the inner automorphism which maps $x$ to $gxg^{-1}$. I wonder if $H$ can be mapped to a proper subgroup of itself, i.e.  $\lambda_g(H)\subset H$.  I tried to approach this problem topologically. Since every group is the fundamental group of a connected CW-complex of dimension 2, let $(X,x_0)$ be such a space for $G$. Since $X$ is (locally) path-connected and semi-locally simply-connected, there exists a (locally) path-connected covering space $(\widetilde X,\widetilde x_0)$, such that $p_*(\pi_1(\widetilde X,\widetilde x_0))=H$. The element $g$ corresponds to $[\gamma]\in\pi_1(X,x_0))$, and its lift at $\widetilde x_0$ is a path ending at $\widetilde x_1$. By hypothesis, $H\subseteq g^{-1}Hg$, which leads to the existence of a unique lift $f:\pi_1(\widetilde X,\widetilde x_0)\to\pi_1(\widetilde X,\widetilde x_1)$ such that $p=p\circ f$. This lift turns out to be a surjective covering map itself, and it is a homeomorphism iff $H=g^{-1}Hg$.  I was unsuccessful in showing the injectivity. If $x_1$ and $x_2$ have the same image under $f$, then $x_1$, $x_2$, and $f(x_1)=f(x_2)$ are all in the same fiber. I took $\lambda$ to be a path from $x_1$ to $x_2$. I have been playing around with $\lambda$, $p\lambda$, and $f\lambda$, but got nowhere.  Of course, there could also be a direct algebraic proof. On the other hand, if the statement is not true then someone maybe knows of a counterexample.


I'm getting linker errors when trying to compile a templated class.  I'm not too hot on C++ templated programming and the workings of the compiler (MSBuild/VS2012) and am having difficulty in determining what I've done wrong.  I'm compiling with /CLR and I get a series of linker errors (LNK2005) when I try to compile my source files, which approximate to:  ISaveStrategy.h:  #pragma once #pragma unmanaged  template<class T> class ISaveStrategy { public:     enum SaveResult {OK, Error};       virtual SaveResult Save(const T&  itemToSave) = 0; };   SaveToXmlStrategy.h:  #pragma once  #include <gcroot.h> #include "ISaveStrategy.h"  #pragma unmanaged  namespace System{namespace Xml{ref class XmlWriter;}}  template<class T> class SaveToXmlStrategy : public ISaveStrategy<T> { public:      SaveToXmlStrategy(gcroot<System::Xml::XmlWriter^> writer)         : m_writer(writer)     {}      virtual SaveResult Save(const T& itemToSave);  private:     gcroot<System::Xml::XmlWriter^> m_writer; };   SaveToXmlStrategy.cpp:  #pragma once  #include "stdafx.h" #include "SaveToXmlStrategy.h" #include "IKeyFrame.h" #include "IKeyFrameTransition.h" #include "ICueProvider.h"  #pragma managed  using namespace System; using namespace System::Text;  template class SaveToXmlStrategy<IKeyFrameTransition>; SaveToXmlStrategy<IKeyFrameTransition>::SaveResult SaveToXmlStrategy<IKeyFrameTransition>::Save(const IKeyFrameTransition& keyFrame) {     return SaveResult::OK; }   template class SaveToXmlStrategy<ICueProvider>; SaveToXmlStrategy<ICueProvider>::SaveResult SaveToXmlStrategy<ICueProvider>::Save(const ICueProvider& keyFrame) {     return SaveResult::OK; }   template class SaveToXmlStrategy<IKeyFrame>; SaveToXmlStrategy<IKeyFrame>::SaveResult SaveToXmlStrategy<IKeyFrame>::Save(const IKeyFrame& keyFrame) {     SaveResult result = SaveResult::OK;     return result; }   Implementation.cpp:  #pragma once #include "SaveToXmlStrategy.cpp"  //inside a function body : ISaveStrategy<IKeyFrame>& keyFrameSaver = SaveToXmlStrategy<IKeyFrame>(xmlWriter.get());

Quote from :     The only portable way of using templates at the moment is to implement them in header files by using inline functions.   Why is this?  (Clarification: header files are not the only portable solution. But they are the most convenient portable solution.)


Problem  I'm trying to make a standard query to get all records from salesforce custom object. I'm using SOAP API.  I have more than 40k records in object.  But salesforce OFFSET limit 2000 record. which is give error.  So, I have try out some workaround solution,     SELECT Id, Name, CreatedDate FROM Account WHERE CreatedDate >   "Last-Returned-Created-Date" ORDER BY CreatedDate LIMIT 2000   But this query not work, if there was more than one object created at that exact date and time.  Question  Is there any way to do this?  Actually i am implementing logic in PHP and calling salesforce get API with above mention SOQL query as query parameter.

I'm trying to retrieve a list of Account objects from Salesforce using SOQL. Originally my query was this:  var result = service.query("SELECT Id, Name, RecordTypeId FROM Account"); return result.records.Select(record => record as Account).ToList();   However this only returns a maximum of 2,000 records and I have over that which I need to be returned by this query. After some digging around I found an example in Java which loops over the SOQL query which will allow a maximum of 10,000 records to be returned. I tried to replicate this in C# but it differs slightly, here is what I have now:  var accounts = new List<Account>(); foreach (Account account in service.query("SELECT Id, Name, Composer_ID__c, RecordTypeId FROM Account").records)     accounts.Add(account);  return accounts;   However this still only returns a maximum of 2,000 records. How can I return more than 2,000 records by querying Account?


Find the value of $$\cos ^2\theta+\cos^2 (\theta+1^{\circ})+\cos^2(\theta+2^{\circ})+......+\cos^2(\theta+179^{\circ})$$  Can anyone teach me where to start with? I've no idea.

Possible Duplicate:          Prove $$\cos(\alpha) + \cos(\alpha + \beta) + \cos(\alpha + 2\beta) + \dots + \cos[\alpha + (n-1)\beta] = \frac{\cos(\alpha + \frac{n-1}{2}\beta) \cdot \sin\frac{n\beta}{2}}{\sin\frac{\beta}{2}} $$


I would like to work with a professor in my field as a postdoc after I complete my PhD in Computer Science later this year, who has a remarkable record of supervising PhD students to become faculty at research universities. If I get hired, is he going to oversee me to pursue my most interested project, which is in a different subfield from what he is working on currently, or to carry out his projects? If the former, Why would he hire me as a postdoc then? Just train me to be an independent research even though it may not advance his projects directly?

Would the latter be an issue with the funding body, when the project proposal and budget only covers the expenses for hiring one postdoc? Note: it is the supervisors who got the grants, not the postdocs themselves.


My flight is from Toronto to Istanbul through Vienna. Now I need to stay in Vienna and decided not the take the connecting flight.  First, do they let me to cancel the connecting flight? Second,if I am not allowed to cancel it, can I just-while checking in- ask the agent at the airport to put Vienna as my final destination so I can collect it at Vienna, and tell them that I am not gonna take the connecting flight?(I am OK with paying any penalty for that... but would they let me do that?)

I want to go from Panamá to Turkey. There're direct flights of Turkish Airlines that are expensive. And there're flights Panamá -> Istambul -> Baku there're cheaper 2 times of the same airline. The transfer in Istambul takes 6 hours.    Will it be a violation if I buy a ticket Panamá -> Istambul -> Baku and leave in Istambul?


My question is; What happened to SMART data selftest option in Disks/gnome-disk-utility   Any help or tips appreciated.(I want to scan/repair my drive for bad sectors preferably GUI)  here is an image of what I am looking for:   I was told this is a duplicate question. However I was totally lost looking for the "gear icon" This is how mine looks in Kubuntu   It might sound silly but I did not make the connection with that "hamburger" being the "gear icon"

How can I check the SMART status of a drive under 14.04 and beyond? I've seen  but it doesn't seem to apply under 14.04 and later.


On a production server, I just did a dist-upgrade from ubuntu 14.04 to 14.04.01. During the upgrade, I encountered a serious problem with configuring grub. I finally traced back the source of the problem and fixed it.  Now, although apparently everything is properly configured, I am a bit anxious to reboot the server (remotely). Before I do so, I'd like to ensure that the reboot will proceed smoothly. I would like to know what I should check.  Here is a summary of the problem I encountered earlier, and the fix applied.    During the dist-upgrade:   rub-pc  Error in function:  A fatal error occurred  Please report this as a bug and include the files  /var/log/dist-upgrade/main.log and /var/log/dist-upgrade/apt.log in  your report. The upgrade has aborted.  Your original sources.list was saved in  /etc/apt/sources.list.distUpgrade.  SystemError: E:Sub-process /usr/bin/dpkg returned an error code (1)  Could not install the upgrades  The upgrade has aborted. Your system could be in an unusable state. A  recovery will run now (dpkg --configure -a).  Please report this bug in a browser at  http://bugs.launchpad.net/ubuntu/+source/ubuntu-release-upgrader/+filebu...  and attach the files in /var/log/dist-upgrade/ to the bug report.  installArchives() failed  Setting up grub-pc (2.02~beta2-9ubuntu1) ...  Replacing config file /etc/default/grub with new version  Installing for i386-pc platform.  Installation finished. No error reported.  Generating grub configuration file ...  /etc/grub.d/06_OVHkernel: line 6: /usr/lib/grub/update-grub_lib: No such file or directory  dpkg: error processing package grub-pc (--configure):  subprocess installed post-installation script returned error exit status 1  Errors were encountered while processing:  grub-pc Upgrade complete  The upgrade has completed but there were errors during the upgrade  process.  To continue please press [ENTER]   I tried configuring manually:   # dpkg --configure -a  Setting up grub-pc (2.02~beta2-9ubuntu1) ...  Replacing config file /etc/default/grub with new version  Installing for i386-pc platform.  Installation finished. No error reported.  Generating grub configuration file ...  /etc/grub.d/06_OVHkernel: line 6: /usr/lib/grub/update-grub_lib: No such file or directory  dpkg: error processing package grub-pc (--configure):  subprocess installed post-installation script returned error exit status 1  Errors were encountered while processing:  grub-pc   I finally found and posted the solution here:         Edit the file /etc/grub.d/06_OVHkernel   and replace update-grub_lib with grub-mkconfig_lib.     then tried reconfiguring again, this time successfully:    # sudo dpkg --configure -a  Setting up grub-pc (2.02~beta2-9ubuntu1) ...  Replacing config file /etc/default/grub with new version  Installing for i386-pc platform.  Installation finished. No error reported.  Generating grub configuration file ...  Found linux image: /boot/bzImage-2.6.38.2-grsec-xxxx-grs-ipv6-64  No volume groups found  done   /etc/default/grub has changed during the upgrade but I dont' know how it affects grub:   -GRUB_CMDLINE_LINUX_DEFAULT=""  +GRUB_CMDLINE_LINUX_DEFAULT="nomdmonddf nomdmonisw"   -GRUB_DISABLE_LINUX_UUID=true +#GRUB_DISABLE_LINUX_UUID=true     I couldn't find the documention for the values in that file.   So, what should I now check to ensure that the system is ready for a successful reboot?

I'm hoping to obtain some guidance to properly update Grub on a GoDaddy dedicated server, as my previous attempt has resulted in re-provisioning the server.  If this were a local server, I think I could start the server from the console and make the necessary configuration changes.  Being hosted, I don't have access to the console - or so I believe, so I'm stuck with a server I can no longer access.  To start, I'm using apt-get upgrade (as I'm ultimately trying to upgrade from Lucid to Precise).  This then identifies the Grub update..  There are two separate prompts which I'm unsure how to properly proceed:  1) Grub configuration The update asks what I want to do with the config file (/etc/default/grub?). Should I   Keep my existing Replace with package Merge existing with package Other   2) Installation location A second prompt is to install the boot loader.  The guide suggests that if I don't know, I should install it to all locations. /boot is located on /dev/sda1 /dev/sda3 contains everything else (eg /)  Is /boot the only place it needs to be located, or do I need to identify something in /boot/grub/grub.cfg to identify where it should be installed?


I'm actually reviving  from 2011 as I'm hoping the Game of Thrones fever has boosted people's interest in drawing fictitious countries in some GIS format (e.g. .shp) from 2011 until now, so that others can improve or modify.  Alternatively, does anyone know of an easy way to transform a bitmap map such as the one below to a vector map?  Source: .

Is there any fictional world (e.g. ,  etc.) which could be used in a GIS context?  For example, an MBTiles archive and a shapefile or any other format usable with OpenLayers / Polymaps / Leaflet?


I have a multiple-entry Schengen visa for 90 days and a validity of 3 years. It was issued by Germany. I have traveled to Germany 3 times prior to this and on this visa I have traveled once to Germany for business. Now I want to do a Europe trip in December from India.   Do I need to apply for a visa again? In case the Schengen visa is issued by Germany, do I have to do enter in Germany first and then travel to other countries? Can I enter other countries and then travel to Germany?

I have six-month multiple-entry business Schengen visa, issued by the French Embassy.  I am planing to go to France for business (or work) in June and then come back home, a non-European country.  In July, I want to go to Spain and Italy for holidays.   Can I use this visa for a holiday only (no business during the trip)?   Do I need to enter Europe first through France?


I come from a C++ background and have trouble understanding the point of IDisposable objects (and the point of many other things in .NET). Why is a Dispose function necessary in the first place? Whatever it does, why not do that in the destructor of the class? I understand it cleans up managed resources, but isn't that what a destructor is supposed to do? I understand that   Using ( var obj = new SomeIDisposableObject )  {     // ... }    is the equivalent of  var obj = new SomeIDisposableObject; // ... obj.Dispose();   but how does that save any typing? And if C# has a garbage collector, which it does, then why are we ever worried about disposing resources?   Is IDisposable/Using/etc. a Skeet-approved concept? What does he think of it?

If .NET has garbage collection then why do you have to explicitly call IDisposable?


I've been looking around StackOverflow and it seems that SSH connections will disconnect when it doesn't see any packets for a while (2 hours?).  Also, I looked in my /etc/ssh/ssh_config file and there doesn't seem to be anything there that would persist my current connection.  My question is: Even after 48 hours, why would an SSH connection persist? (my computer is turned off, but the server that I SSH to is presumably still online)

I am trying to code a shell-script that uses a ssh-connection for doing "heartbeats". I want to terminate the client- and server-side of that connection after a certain timeout (after the connection drops).  What I found so far:   TCPKeepAlive yes/no for ssh and sshd ClientAliveCountMax for sshd ClientAliveInterval for sshd ServerAliveCountMax for ssh ServerAliveInterval for ssh   To change "ClientAliveCountMax" I would have to modify the sshd_config on each target machine (this option is disabled by default).  So my question is - can I use "TCPKeepAlive" for my purposes, too (without changing anything else on the source/target machines)?  Target operating system is SLES11 SP2 - but I do not think that is relevant here.


I want that line from the file which have highest length among all the lines using awk command.

I'm looking for the simplest method to print the longest line in a file. I did some googling and surprisingly couldn't seem to find an answer. I frequently print the length of the longest line in a file, but I don't know how to actually print the longest line. Can anyone provide a solution to print the longest line in a file? Thanks in advance.


I founded a religion in my capital (Buddhism).  After another civilization converted my city to their religion, I used an , thinking it would remove the other civilization's religion.  However, I was wrong.... very wrong.  Now, when I refer to my Religion Overview, it turns out no other cities/city-states follow Buddhism, so clearly my religion did not stand the test of time.    Question:  Is it possible to resurrect a religion?   Any help would be greatly appreciated!

I eliminated a computer player that had a strong religion (Buddhism). My religion was weak, whereas this other one was taking over the continent quickly. Now that I have him overrun, I want, well wanted, to work on converting cities to mine, but I see now that all of the cities period have his religion! I tried making an Inquisitor just to test, but he is ineffectual at removing Buddhism, being that I can only buy him in Buddhist cities. (Because all of my cities are Buddhist and my religion, Shinto, has been wiped out.   Is there no way to recover your religion in such a situation?


Are there any common ways to define a distance between two probablity distribution functions (i.e. how similar two distributions are)?  I am interested in the specific case where the random variable is discrete and can only take a finite number of values.

There are many ways to measure how similar two probability distributions are.  Among methods which are popular (in different circles) are:   the Kolmogorov distance: the sup-distance between the distribution functions; the Kantorovich-Rubinstein distance: the maximum difference between the expectations w.r.t. the two distributions of functions with Lipschitz constant $1$, which also turns out to be the $L^1$ distance between the distribution functions; the bounded-Lipschitz distance: like the K-R distance but the functions are also required to have absolute value at most $1$.   These have different advantages and disadvantages.  Only convergence in the sense of 3. actually corresponds precisely to convergence in distribution; convergence in the sense of 1. or 2. is slightly stronger in general.  (In particular, if $X_n=\frac{1}{n}$ with probability $1$, then $X_n$ converges to $0$ in distribution, but not in the Kolmogorov distance. However, if the limit distribution is continuous then this pathology doesn't occur.)   From the perspective of elementary probability or measure theory, 1. is very natural because it compares the probabilities of being in some set. A more sophisticated probabilistic perspective, on the other hand, tends to focus more on expectations than probabilities. Also, from the perspective of functional analysis, distances like 2. or 3. based on duality with some function space are very appealing, because there is a large set of mathematical tools for working with such things.  However, my impression (correct me if I'm wrong!) is that in statistics, the Kolmogorov distance is the usually preferred way of measuring similarity of distributions.  I can guess one reason: if one of the distributions is discrete with finite support -- in particular, if it is the distribution of some real-world data -- then the Kolmogorov distance to a model distribution is easy to compute.  (The K-R distance would be slightly harder to compute, and the B-L distance would probably be impossible in practical terms.)  So my question (finally) is, are there other reasons, either practical or theoretical, to favor the Kolmogorov distance (or some other distance) for statistical purposes?


I have an operation using cut that I would like to assign result to a variable  var4=echo ztemp.xml |cut -f1 -d '.'   I get the error:     ztemp.xml is not a command   The value of var4 never gets assigned; I'm trying to assign it the output of:  echo ztemp.xml | cut -f1 -d '.'   How can I do that?

I want to assign the result of an expression (i.e., the output from a command) to a variable and then manipulate it – for example, concatenate it with a string, then echo it.  Here's what I've got: #!/bin/bash cd ~/Desktop; thefile= ls -t -U | grep -m 1 "Screen Shot"; echo "Most recent screenshot is: "$thefile;  But that outputs: Screen Shot 2011-07-03 at 1.55.43 PM.png Most recent screenshot is:   So, it looks like that isn't getting assigned to $thefile, and is being printed as it's executed. What am I missing?


We have a situation in our bathroom where we can’t turn the lights off fully. If the switch is on, bulbs 1&2 are on. If switched off, bulb 3 is on. We’ve taken bulb 3 out for now but would like to correct the problem. Any suggestions? Diagrams very helpful.

I have two LED lamps in my corridor, and when I switch them off, they keep emitting light (not very strong, but it's annoying at night).  What can it be? How can I fix it?


right now I am returning a list in my model to the view. The list contains 300k items.  I am doing something like this

                 First Name	                 Last Name	                 E-mail	                 Role

             @foreach (var user in Model) {
                     @user.FirstName	                     @user.LastName	                     @user.Email	                     @user.UserRole.UserRoleName
             }

   So ye problem is that it takes forever to load the page to display the 300k items, plus all the scrolling is a problem. Is there a nicer solution in MVC to handle this and add automatic pagination etc ?

What is the most preferred and easiest way to do pagination in ASP.NET MVC?  I.e. what is the easiest way to break up a list into several browsable pages.  As an example lets say I get a list of elements from a database/gateway/repository like this:  public ActionResult ListMyItems() {     List<Item> list = ItemDB.GetListOfItems();     ViewData["ItemList"] = list;      return View(); }   For simplicity's sake I'd like to specify just a page number for my action as parameter. Like this:  public ActionResult ListMyItems(int page) {    //... }


/(
||\[code])(.*)(
||\[/code])/gi  This works if I have something such as:  foobar  But if I were to have a line-break like this:       Awesome    It will not match it, what am I doing wrong?

For example, this regex  (.*)<FooBar>   will match:  abcde<FooBar>   But how do I get it to match across multiple lines?  abcde fghij<FooBar>


Let $p > 2$ be prime. Show that there exist integers $a,b \geq 0 $   satisfying the congruence $a^2 + b^2 \equiv -1 $(mod $p$).    A few things that can be seen instantly: $ p \equiv 1$ mod $4$, and I am contemplating using Wilsons theorem: $(p-1)! \equiv -1$ mod $p$.  Alternatively there is the consideration of sets $\{1+a^2 : 0 \leq a \leq \frac{p-1}{2} \}$ and $\{-b^2 : 0 \leq b \leq \frac{p-1}{2} \}$,  Is it true that $1+ a^2 = -b^2$ and hence $a^2 + b^2 \equiv -1$ mod $p$ ? I'm sure this isn't completely correct, nor is it rigorous enough - can anyone tell me the answer?

So we obviously we want $ x^{2} + y^{2} + 1 \equiv 0 ~ (\text{mod} ~ p) $.  I haven’t learned much about quadratic congruences, so I don’t really know how to go forward. I suppose you can write it as $ x^{2} \equiv -1 - y^{2} ~ (\text{mod} ~ p) $, but again, I’m not sure where to go. I know about the Legendre symbol and quadratic residues, which I know are involved in this question, but I don’t know how to apply what I know. :(


I would like to create a variable called acc and to select a full account that is inside my accounts:  Something like :  Account acc = [select account from account where name='p2'];   That would save the full account where the name is equal to p2 inside the variable acc

I have created sObject and I need all the fields and I have many. Is there a way I can directly get all of them rather then typing each one of them.


Jon Skeet's chat reputation suffers from integer overflow!    His rep should roughly be 861.6k (SO) +73.6k (Meta) +4.3k (SU) +3.1k (Programmers) +3k (SF) +1.5k (other) =947.1k.   So there is 71k missing, which is roughly his Meta rep.   However, Meta rep does count for Marc Gravell. He has 599.1k (SO) +80.4k (Meta) +5.7k (Christianity) +2.1k (Programmers) +1.1k (SU) +1k (Islam) +2k (others) =691.4k.  It seems that it doesn't count for users who haven't been in chat for a long time (>5 years). It doesn't count for BalusC, Hans Passant or VonC either, whom also haven't posted in a few thousand days. However, it does count for Martijn Pieters and Oded, who have been active recently.

The reputation on  is supposed to be . Now why is it that 's  does not include his MSO reputation, but otherwise includes all 200+ rep accounts' reputation (including SO, of course)?  does include all my 200+ rep accounts including MSO.


I have some bash scripts that I use with the user 'root' to manage iptable rules.  The problem is that I want these things at the same time:   The script must be owned by root Permissions must be 700 I want to have an executable binary that certain user can execute. This executable will run the mentioned script as root.   This used to work, and is still what I use in older distributions:  #include <stdio.h> #include <stdlib.h> #include <sys/types.h> #include <unistd.h>  int main() {    setuid(0);    system("/root/iptables/my-iptables-script.sh");     return 0; }   So I compile this and then use sudo chown root and sudo chmod 4777. This way the user can now execute the binary and run the script owned by root.  But now I installed Ubuntu 13.10 and when I run that binary I get "permission denied" for the script.  Is it possible that something changed in this respect since 12.04?  What can I do?

The setuid permission bit tells Linux to run a program with the effective user id of the owner instead of the executor:  > cat setuid-test.c  #include <stdio.h> #include <unistd.h>  int main(int argc, char** argv) {     printf("%d", geteuid());     return 0; }  > gcc -o setuid-test setuid-test.c > ./setuid-test  1000  > sudo chown nobody ./setuid-test; sudo chmod +s ./setuid-test > ./setuid-test  65534   However, this only applies to executables; shell scripts ignore the setuid bit:  > cat setuid-test2  #!/bin/bash id -u  > ./setuid-test2  1000  > sudo chown nobody ./setuid-test2; sudo chmod +s ./setuid-test2 > ./setuid-test2  1000     Wikipedia :     Due to the increased likelihood of security flaws, many operating systems ignore the setuid attribute when applied to executable shell scripts.   Assuming I'm willing to accept those risks, is there any way to tell Linux to treat the setuid bit the same on shell scripts as it does on executables?  If not, is there a common workaround for this problem? My current solution is to add a sudoers entry to allow ALL to run a given script as the user I want it run as, with NOPASSWD to avoid the password prompt. The main downsides to that is the need for a sudoers entry every time I want to do this, and the need for the caller to sudo some-script instead of just some-script


Find the values of $a$ and $b$ if $$ \lim_{x\to0} \dfrac{x(1+a \cos(x))-b \sin(x)}{x^3} = 1 $$ I think i should use L'Hôpital's rule but it did not work.

Let $f$ denote any function such that $\lim\limits_{x\to 0}\frac{f(x)}{x}=1$. Find the value of $a$ and $b$, assuming that $\lim\limits_{x\to 0}\frac{x(1+a\cos x)-b\sin x}{(f(x))^3}=1$.   My  attempt: $\lim_{x\to 0}\frac{x(1+a\cos x)-b\sin x}{(f(x))^3}=1$ $\lim_{x\to 0}\frac{x(1+a\cos x)-b\sin x}{x^3\frac{(f(x))^3}{x^3}}=1$ $\lim_{x\to 0}\frac{x(1+a\cos x)-b\sin x}{x^3}=1$ $\lim_{x\to 0}\frac{1+a\cos x-b\frac{\sin x}{x}}{x^2}=1$ $\lim_{x\to 0}\frac{1+a\cos x-b}{x^2}=1$ As denominator is tending to zero,so numerato will also tend to zero. $1+a-b=0............................(1)$ Applying L Hospital rule, $\lim_{x\to 0}\frac{-a\sin x}{2x}=1$ So $a=-2$ and $b=-1$ But the answer given in my book is $a=\frac{-5}{2}$ and $b=-\frac{3}{2}$. I do not understand where have i gone wrong?


I need to show two fields of an attribute table. I can currently display the "POINT" field. I also want to show the "ID" field. In the following way, if ID = 2 and POINT = 341. It should show like this 2 (341). As shown in the picture.  # Adding Labels to Nodes       for layer in QgsProject.instance().mapLayers().values():         layer_settings  = QgsPalLayerSettings()         text_format = QgsTextFormat()  text_format.setFont(QFont("Arial", 8)) text_format.setSize(8) text_format.setColor(QColor('Black'))   buffer_settings = QgsTextBufferSettings() buffer_settings.setEnabled(True) buffer_settings.setSize(0.10) buffer_settings.setColor(QColor('black'))  text_format.setBuffer(buffer_settings) layer_settings.setFormat(text_format)  fieldName1="PUNTO" fieldName2="ID" layer_settings.fieldName = "PUNTO" *********************************** layer_settings.placement = 4  layer_settings.enabled = True  layer_settings = QgsVectorLayerSimpleLabeling(layer_settings) layer5.setLabelsEnabled(True) layer5.setLabeling(layer_settings) layer5.triggerRepaint()[![enter image description here][1]][1]

How do you apply a QgsExpression to a Label ?   I can do it in QGIS with this simple expression  concat('N:' ,round(Value,0),'\n','Yield:' ,round(Value 2,0))  N: 65   Yield: 40  How do I do it in PyQGIS ? I see a getLabelExpression but no setLabelExpression  This works but I want but only for the field name    crap = QgsVectorLayer("D:/data.shp", "data", "ogr")  QgsMapLayerRegistry.instance().addMapLayer(crap)  palyr = QgsPalLayerSettings()  palyr.readFromLayer(crap)  palyr.enabled = True  palyr.fieldName = 'Name'  palyr.placement= QgsPalLayerSettings.OverPoint  palyr.setDataDefinedProperty(QgsPalLayerSettings.Size,True,True,'8','')  palyr.writeToLayer(crap)


I tried writing a .img file to an existing partition (the partition that my computer boots  into). When I rebooted my computer it booted to "GRUB Rescue" and said "Unknown filesystem". I tried changing the BIOS and plugging in a USB but it didn't work. This is my main computer and I really need help. I screwed up big time.

I have a multiboot system set up. The system has three drives. Multiboot is configured with Windows XP, Windows 7, and Ubuntu - all on the first drive. I had a lot of unpartitioned space left on the drive and was reserving it for adding other OSes and for storing files there in the future.  One day I went ahead and downloaded Partition Wizard and created a logical NTFS partition from within Windows 7, still some unpartitioned space left over. Everything worked fine, until I rebooted the computer a few days later.  Now I'm getting:    error: unknown filesystem.   grub rescue>   First of all I was surprised not to find any kind of help command, by trying:    help, ?, man, --help, -h, bash, cmd, etc.  Now I'm stuck with non-bootable system. I have started researching the issue and finding that people usually recommend to boot to a Live CD and fix the issue from there. Is there a way to fix this issue from within grub rescue without the need for Live CD?  UPDATE  By following the steps from , I was able to boot to initramfs prompt. But not anywhere further than that.  So far from reading the manual on , I was able to see my drives and partitions using ls command. For the first hard drive I see the following: (hd0) (hd0,msdos6) (hd0,msdos5) (hd0,msdos2) (hd0,msdos1)  I now know that (hd0,msdos6) contains Linux on it, since ls (hd0,msdos6)/ lists directories. Others will give "error: unknown filesystem."  UPDATE 2  After the following commands I am now getting to the boot menu and can boot into Windows 7 and Ubuntu, but upon reboot I have to repeat these steps.    ls ls (hd0,msdos6)/ set root=(hd0,msdos6) ls / set prefix=(hd0,msdos6)/boot/grub insmod /boot/grub/linux.mod normal   UPDATE 3  Thanks Shashank Singh, with your instructions I have simplified my steps to the following. I have learned from you that I can replace msdos6 with just a 6 and that I can just do insmod normal instead of insmod /boot/grub/linux.mod. Now I just need to figure out how to save this settings from within grub itself, without booting into any OS.  set root=(hd0,6) set prefix=(hd0,6)/boot/grub insmod normal normal   UPDATE 4  Well, it seems like it is a requirement to boot into Linux. After booting into Ubuntu I have performed the following steps described in the :  sudo update-grub sudo grub-install /dev/sda   This did not resolve the issue. I still get the grub rescue prompt. What do I need to do to permanently fix it?  I have also learned that drive numbers as in hd0 need to be translated to drive letters as in /dev/sda for some commands. hd1 would be sdb, hd2 would be sdc, and so on. Partitions listed in grub as (hd0,msdos6) would be translated to /dev/sda6.  UPDATE 5  I could not figure out why the following did not fix grub:  sudo update-grub sudo grub-install /dev/sda   So I downloaded  based on an answer from  post. That seemed to do the trick after I picked the "Recommended Repair (repairs most frequent problems)" option.


I am trying to get direct link to salesforce1 in the Email Tempalte but I am not abloe to do. I have tried with differnt ways.   I have tried with below URL: com.salesforce.salesforce1://entity/view?entityId=(your ID here) However this is also not working. Please let me suggest where I am wrong.  Thanks, Manoj

With the new salesforce1 app which looks cool, i am currently not able to click a record link and open the record in salesforce1. I am using Ipad and set all the salesforce1 setting from the salesforce1 documentation:  "For the mobile browser app, from Setup, click Mobile Administration > Salesforce1. Select Enable the Salesforce mobile browser app to turn on automatic redirection to the mobile browser app whenever a user logs into Salesforce using a supported mobile browser."  But when i click a link its still going into the safari browser and not the Salesforce1 app. Is there something missing? thanks a lot.


<?php $insert =  "I want to store Å Ä Ö in my database";  mysql_query(" INSERT INTO test (text) VALUE ('$insert')") or die(mysql_error()); ?>   Just by using this piece of code, the database stopped storing data as fast as a special symbol (Å Ä Ö) was encountered so in this case I would only find the string "I want to store " in my database table. However I tried to put:  <?php mysql_query("SET NAMES 'utf8'") or die(mysql_error());  mysql_query("SET CHARACTER SET 'utf8'") or die(mysql_error());  ?>   before the INSERT script, it worked somewhat better but now the issue is that all the special symbols are replaced with question marks ( ? ) in the database tables. My table collation is utf8_swedish_ci. The meta, charset is UTF-8.

I'm setting up a new server and want to support UTF-8 fully in my web application. I have tried this in the past on existing servers and always seem to end up having to fall back to ISO-8859-1.  Where exactly do I need to set the encoding/charsets? I'm aware that I need to configure Apache, MySQL, and PHP to do this — is there some standard checklist I can follow, or perhaps troubleshoot where the mismatches occur?  This is for a new Linux server, running MySQL 5, PHP, 5 and Apache 2.


So, I want to restore my phone to factory settings, which means whatsapp will be deleted. I use my old number on whatsapp, and I don't have the SIM Card. My question is if I downloaded WhatsApp again and tried to sign in with my old number, can I do that ??  ((e.g.)) old no. 0598514173 - whatsapp new no. 055112233 - NO whatsapp can I use the old one once again ??

I have a phone now that have WhatsApp installed on for over 2 years now, and the phone number registered for the account is now history (it's been long gone and there is no chance I will get that SIM back, because it is from another country).  I got a new phone today with a new SIM, when I start WhatsApp , I put my old number but it needs to send a Message to the number and that is not possible.   Is there any work around for this, I don't want to lose all my WhatsApp contact. Please help.


Let's say I have a file, such as a HTML file or a Node project in a ZIP file. Where is the best place to upload this file when adding it to a question on Stack Overflow or another SE site?

I have a big HTML file that causes no errors in most of the browsers. However, when I open it with, let's say, Google Chrome, the program shuts down and I cannot trace why this is happening.   This HTML file is quite big and cannot be posted to a question in SO, but it should be ran as a whole as I cannot trace where the problem is. What is/are the most appropriate file upload website/s to upload and paste the link into the question?


I would like to validate mobile number field. I have tried many regular expression based on my requirement  Matching cases   (923)(423)(34455) 945 443 4442  919774744323 +92 332 45 666 9144565 91-877-3655   I need a regular expression based on my matching cases.

I'm trying to put together a comprehensive regex to validate phone numbers. Ideally it would handle international formats, but it must handle US formats, including the following:   1-234-567-8901 1-234-567-8901 x1234 1-234-567-8901 ext1234 1 (234) 567-8901 1.234.567.8901 1/234/567/8901 12345678901   I'll answer with my current attempt, but I'm hoping somebody has something better and/or more elegant.


I have a jList and buttons in my project. My purpose is when I click on the item on the jList, the background color of the buttons needs to be changed. In my case, the value that I am returning when I click on the item is either "OK" or "NO". So when the item clicked in the jList, I am returning corresponded "OK" or "NO" without any problem. However, the background color doesn't change. Here is the code that I use:  private void listBoxProjectsValueChanged(javax.swing.event.ListSelectionEvent evt) {                                                   String value = (String)listBoxProjects.getSelectedValue();     String sql = "SELECT * FROM PBL_Projects where ProjectName=?";      try {           Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver");           String url = "jdbc:sqlserver://webserver:1111; databaseName=sinfo;integratedSecurity=true;";           Connection conn = DriverManager.getConnection(url);          PreparedStatement pst = conn.prepareStatement(sql);          pst.setString(1, value);          ResultSet rs = pst.executeQuery();          if(rs.next()){               String studentName = rs.getString("StudentName");              String projectName = rs.getString("ProjectName");              String projectDetails = rs.getString("ProjectDetails");              String t1s1 = rs.getString("T1S1");               txtDisplayProjectName.setText(projectName);              txtDisplayStudentName.setText(studentName);              txtAreaDisplayProjectDetails.setText(projectDetails);              lblResult.setText(t1s1);               if(t1s1=="NO"){                  btnT1S1.setBackground(Color.RED);              }else if(t1s1 == "OK"){                  btnT1S1.setBackground(Color.GREEN);              }else{                  btnT1S1.setBackground(Color.BLUE);              }           }       } catch (Exception e) {         JOptionPane.showMessageDialog(null, e);     }  }     In here, I can see the other properties like ProjectName, StudentName, and others. I use very simple if statement to change the background color of the buttons. But it won't let me.

I've been using the == operator in my program to compare all my strings so far. However, I ran into a bug, changed one of them into .equals() instead, and it fixed the bug.  Is == bad? When should it and should it not be used? What's the difference?


I need to make Google Sheets evoke the row number for a cell reference by pointing to another cell. I have a form with different cells that point to another sheet (Sheet1!). All the cells always point to a cell of a similar row number; only the column changes.  For example: the Name field points to Sheet1!C2, Address points to Sheet1!D2, Phone Number points to Sheet1!E2.  I want to have a single cell where I can type the row number, so that if I were to type in 5 in such cell, it will automatically make the previous fields point to C5, D5, E5.  Is there a way of doing this?  I am trying to avoid having to go into each cell and manually change the 2 to a 5 or any other number.

The usual way to reference a sheet is  but how do you reference a sheet when the sheet's name is a value in a cell?  For example,   A1 = "Sheet number two" B1 = A1&"!B4"   Here I want B1 to display the value in 'Sheet number two'!B4 but it's not working for me.  Any ideas?


Two-step verification is turned on and I can't get in to my Google account.  How can I recover my account?

I have forgotten the password or username for my Google account, or I'm unable to access my account for other reasons.  How can I recover my account?  (This Q&A is meant as a general description for all Google and Gmail username/password questions. See: )


I recently installed Ubuntu (32-bit) on my older computer and tried to play some games on it with steam. Once the launcher has been installed, it wouldn't launch, but I fixed it with the help of . Once it launched, it started updating. Once that was done, it closed, and would never open again. When I type steam in the terminal I get this:

After a botched upgrade from Ubuntu 14.04 to Ubuntu 16.04 I had to wipe my system and start all over. This time I decided to go with a much less CPU intensive desktop environment and installed Lubuntu 16.04-1.  My problem: when I run Steam from the menu shortcut it acts like it is doing nothing. However it does show up in the task manager. If I just type steam in the terminal I get the following.  michael@michael-HP-Pavilion-dm1-Notebook-PC:~$ steam Running Steam on ubuntu 16.04 64-bit STEAM_RUNTIME is enabled automatically grep: symbol lookup error: grep: undefined symbol: pcre_jit_stack_alloc grep: symbol lookup error: grep: undefined symbol: pcre_jit_stack_alloc /bin/bash: /home/michael/.local/share/Steam/ubuntu12_32/steam-runtime/amd64/lib/x86_64-linux-gnu/libtinfo.so.5: no version information available (required by /bin/bash) grep: symbol lookup error: grep: undefined symbol: pcre_jit_stack_alloc awk: /home/michael/.local/share/Steam/ubuntu12_32/steam-runtime/amd64/lib/x86_64-linux-gnu/libtinfo.so.5: no version information available (required by /lib/x86_64-linux-gnu/libreadline.so.6) Installing breakpad exception handler for appid(steam)/version(1468023329) libGL error: unable to load driver: r600_dri.so libGL error: driver pointer missing libGL error: failed to load driver: r600 libGL error: unable to load driver: swrast_dri.so libGL error: failed to load driver: swrast   Then nothing happens including steam doesn't show up in the task manager. Now I did find the command.  LD_PRELOAD='/usr/$LIB/libstdc++.so.6' DISPLAY=:0 steam   This does run Steam but it is not a real solution in my eyes. How can I fix it?


I have this model structure and want to know the formula for calculating the parameters count in the GRU layer. I did not find that in the docs.   model = Sequential() model.add(layers.GRU(32, input_shape=(None, float_data_1.shape[-1])))  model.add(layers.Dense(1)) model.compile(optimzer=RMSprop(), loss='mae') history = model.fit(train_gen_1,                 steps_per_epoch=per_epoch,                 epochs=20,                 validation_data=val_gen_1,                 validation_steps=val_steps) # model summary  Model: "sequential" _________________________________________________________________ Layer (type)                 Output Shape              Param #    ================================================================= gru (GRU)                    (None, 32)                6336       _________________________________________________________________ dense (Dense)                (None, 1)                 33         ================================================================= Total params: 6,369 Trainable params: 6,369 Non-trainable params: 0 _________________________________________________________________   I found the equation in this  but is does not produce the right results. I would be interested also in the information source as I would need to cite it in an academic report.   the input data shape is (85880, 32)

The title says it all -- how many trainable parameters are there in a GRU layer? This kind of question comes up a lot when attempting to compare models of different RNN layer types, such as long short-term memory (LSTM) units vs GRU, in terms of the per-parameter performance. Since a larger number of trainable parameters will generally increase the capacity of the network to learn, comparing alternative models on a per-parameter basis is an apples-to-apples comparison of the relative effectiveness of GRUs and LSTMs.


How do i evaluate $$\int \frac{1-7\cos^2x}{\sin^7x\cos^2x}dx$$. I tried using integration by parts and here is my approach   $\int \frac{ sinx}{(1-cos^2x)^4\cos^2x} dx$ and then put $cos x=t$ and then tried to use partial fractions.I applied similar logic for the other part.But that made it lengthy to solve as decomposition into partial fractions is very time consuming.This question came in an objective examination in which time was limited.Can anyone help me with a shorter way to solve this problem.Thanks.

The question :  $$ \int \frac {1-7\cos^2x} {\sin^7x \cos^2x} dx $$  I tried dividing by $\cos^2 x$ and splitting the fraction.  That turned out to be complicated(Atleast for me!)  How do I proceed now?


I have the .iso image of Ubuntu 15.10 that a friend gave to me. I have a pre-installed Windows 10. When I mount the image and run wubi.exe, it gives the following error:     Wubi does not currently support EFI.   Please tell me how to install (dual-boot) Ubuntu (with Windows). My FastBoot service is off and Windows is installed in UEFI mode.

I'm absolutely new to Linux. I would like to know how to install Ubuntu alongside the pre-installed Windows 8+ OS.  Should I do it with Wubi, or through the Live USB/DVD?  What steps do I need to take to correctly install Ubuntu?


how to run the pi.sh for certain number of times using for loop?  to test this write a script that runs pi.sh seven times with values of N ranging from 1 through 7.

How do I iterate over a range of numbers in Bash when the range is given by a variable?  I know I can do this (called "sequence expression" in the Bash ):   for i in {1..5}; do echo $i; done   Which gives:     1    2    3    4    5   Yet, how can I replace either of the range endpoints with a variable? This doesn't work:  END=5 for i in {1..$END}; do echo $i; done   Which prints:     {1..5}


How is it possible to save the vim file without to close it? I do a change, save it immediately and continue to work with the file without to reopen it again... I have found of course the question , anyway the proposed solutions close the file after the job execution.

I can't save changes after editing   sudo vi /etc/network/interfaces   Text before editing:    auto lo iface lo inet ...   Edited to:  auto eth0 iface eth0 inet dhcp   What key combination or sequence must I press to save this?


I'm working with two List and trying to use the contains().  I don't break the convention but still am getting false with my class usage for contains.  Items.class   class Items implements Comparable<Items> {      private String name;      private Date date;      private Lib.CLASSENUM type;      public getDate();     public setDate();      ....     public compareTo(Items o) {      ...     }   }   Test.class  List<Items> actualList; List<Items> expectedList;  public setup() {      actualList = new ArrayList<>();      expectedList = new ArrayList<>(); }  class Tests { @Test public void statusCheckValidatingRedLinePromotionItemsTest() {     //this just sets the two ArrayList to clear     clearProductMaps();     Items goodsItem = new Items();      goodsItem.setName("Product_A");     goodsItem.setPrice(4.10);     goodsItem.setStatus(Lib.CLASSENUM.ORIGINAL);     goodsItem.setDate(date);      actualList.add(goodsItem);     goodsItem = new Items();     goodsItem.settName("Product_A");     goodsItem.setPrice(3.70);     goodsItem.setStatus(Lib.CLASSENUM.PROMO);     date = calendar.getTime();     goodsItem.setDate(date);      actualList.add(goodsItem);     goodsItem = new Items();     goodsItem.setName("Product_A");     goodsItem.setPrice(3.70);     goodsItem.setDate(date);     goodsItem.setStatus(Lib.CLASSENUM.PROMO);     expectedList.add(goodsItem);      assertTrue(expectedGoods.get(0).contains(actualList.get(0)); }   The contains should be true, no? (o==null ? e==null : o.equals(e))

I want to be able to have LinkedList.contains() return true for a custom comparator.  Suppose that I have 1 LinkedList and 2 objects  LinkedList<MyObject> myList = new LinkedList<MyObject>();  MyObject a = new MyObject("HELLO"); MyObject b = new MyObject("HELLO");   Technicaly, both objects are identical in terms of comparison (MyObject implements Comparable)   ( a == b ) == true  however, when I do the following, myList does not return true for myList.contains(b)  myList.add(a) myList.contains(b) // == false   I think its because contains will check object reference and see that a and b are 2 distinct objects. Is there any way I can make it so I don't have to extend LinkedList to compare those objects?


I have Ubuntu 12 in my PC. During installation of useful software, I was looking for browser except Firefox(which is by default browser). Through Ubuntu Software manager, I got Chromium and installed it. Its looks like Google Chrome. Is it the same as Google Chrome?  Thanks...

I used Google Chrome in Windows, and am now using Chromium in Ubuntu.  Is there any difference to the two programs?  What are the advantages and disadvantages to each program?  Which one seems better?


I left a pork roast in my crock pot for a little less than 2 hours, but forgot to turn crock pot on.  It still felt cool to the touch.  Is it safe to eat?

If I left food out of the refrigerator for some period of time, is it still safe? If I left it out too long, can I salvage it by cooking it more?