We say that a function, $f: X \to Y$ ($X, Y$ are topological spaces) is sequentially continuous if $f(x_n)$ converges to $f(x)$ whenever $x_n$ converges $x$. Give an example of a function that is sequentially continuous but not continuous.  I tried letting $X$ be $\mathbb R$ with cofinite topology and $Y$ be $\mathbb R$ with discrete topology where $f$ is identity map but $f$ is neither sequential continuous or continuous. There are no simple solutions online since most use ordinal sets and we have not yet covered that in our topology class.

Can you give me an example of a function which is sequentially continuous but not continuous? (I know that in first-countable spaces this is equivalent, but what about in spaces without this condition?)  Thank you :)


I'm trying to understand the use of super(). From the looks of it, both child classes can be created, just fine.   I'm curious to know about the actual difference between the following 2 child classes.  class Base(object):     def __init__(self):         print "Base created"  class ChildA(Base):     def __init__(self):         Base.__init__(self)  class ChildB(Base):     def __init__(self):         super(ChildB, self).__init__()  ChildA()  ChildB()

What's the difference between:  class Child(SomeBaseClass):     def __init__(self):         super(Child, self).__init__()   and:  class Child(SomeBaseClass):     def __init__(self):         SomeBaseClass.__init__(self)   I've seen super being used quite a lot in classes with only single inheritance. I can see why you'd use it in multiple inheritance but am unclear as to what the advantages are of using it in this kind of situation.


I have a laptop running OS X 10.9.2 and 10.7.5.  On both I use Terminal extensively.  I have Terminal set up open with Homebrew settings on startup on both 10.7 and 10.9.  The issue occurs when I close all open tabs and Terminal windows with ⌘ + w, so that the app is still running but there are no windows visible.  The behaviour of Terminal on 10.7.5 is as I would expect. When I open a new window with ⌘+n the new terminal window opens with "Homebrew" settings.  The behaviour with 10.9.2 is not what I would expect (maybe I need to have it explained).  Again if all windows are closed but Terminal is left active and I start a new window using ⌘+n the new window has "Basic" settings instead of "Homebrew". I have checked this behaviour and it is consistent on both a MBP and Mini I have running with Maverics.  Is this behaviour normal?  If so, is there a way to modify it, so that Maverics behaves like 10.7?

I want to set the "Homebrew" theme to be the default in Terminal.  I've changed the setting in the preferences: I chose "on startup, open" : "new window with settings" : "Homebrew".  Here is a screenshot:    Terminal uses "Homebrew" only for the first window. Then I do cmd-W to close the window and cmd-N to get a new window. The new window appears with the "Basic" theme! But if I do cmd-Q and restart Terminal then it gives me a "Homebrew" window again. Why don't terminal themes work properly?


I wander why c++ allows to declare this?  void f(int x);  int main() {      int x;      const int y=0;      f(x);      f(y); }  void f(const int x) { }   Why compiler allows you declare function with one signature, but define with another (cv qualifier added)?

How far do you go with const?  Do you just make functions const when necessary or do you go the whole hog and use it everywhere?  For example, imagine a simple mutator that takes a single boolean parameter:  void SetValue(const bool b) { my_val_ = b; }   Is that const actually useful?  Personally I opt to use it extensively, including parameters, but in this case I wonder if it's worthwhile?  I was also surprised to learn that you can omit const from parameters in a function declaration but can include it in the function definition, e.g.:  .h file  void func(int n, long l);   .cpp file  void func(const int n, const long l)   Is there a reason for this? It seems a little unusual to me.


I am currently solving a simple cryptanalysis problem where I need to decrypt a text file using frequency analysis. The text has been encrypted using an affine cipher over a 68 character alphabet which includes lower and upper case English letters, digits from 0 to 1, as well as those characters: ". , ; : _ \n" where _ denotes space. Going over the frequency histogram of the text, the most frequent character is "," followed by "z". According to what I know, the most frequent character for the 68 character alphabet is space followed by "e". Thus I end up with those two equations: $$66a + b = 63 \bmod 68$$ $$4a + b = 25 \bmod 68$$ Which gives me: $$62a = 38 \bmod 68$$ $a = 38 \cdot 62^{-1}  \bmod 68$ However, 62 isn't invertible mod 68. I am quite new to cryptography so I am quite unsure if there is some method to solve this issue.

I am trying to perform Cryptanalysis on Affine cipher . Given Plain Text "GO" and cipher text "TH"  We know , $G =6 , O=14 , T=19 , H= 7$   By brute force method   I'm getting key $(a,b)$ as $(5,15 )$    But by known plain text attack method    $6a + b = 19 \\ 14a +b = 7$  on solving the equations . im getting  $-8 a + 0  =  12  $  taking addictive inverse of $-8 = 18$  We get , $18a +0 =12$ , Now   $a= 12*$ multiplicative inverse of $(18)$   Multiplicative inverse of 18 doesnt exist then how to proceed ? Is my approach correct ?


Can someone help me with counting number of exact letter? int numberOfX = 0;             foreach (char x in textBox1.Text)             {                 numberOfX++;             }             this.Text = ($"Number of X: {numberOfX}");

I am doing something where I realised I wanted to count how many /s I could find in a string, and then it struck me, that there were several ways to do it, but couldn't decide on what the best (or easiest) was.  At the moment I'm going with something like:  string source = "/once/upon/a/time/"; int count = source.Length - source.Replace("/", "").Length;   But I don't like it at all, any takers?  I don't really want to dig out RegEx for this, do I?  I know my string is going to have the term I'm searching for, so you can assume that...  Of course for strings where length > 1,  string haystack = "/once/upon/a/time"; string needle = "/"; int needleCount = ( haystack.Length - haystack.Replace(needle,"").Length ) / needle.Length;


i'm running Windows 10 on a laptop, upgraded from 8 to 8.1 then 10, cpu is core i5 4200u, can it handle Ubuntu?  if i installed 15.10, can i upgrade to 16.04 LTS when it comes out?

I'm thinking about installing Ubuntu Desktop, but I don't know what flavor is the best for my system. What are the minimum and recommended hardware requirements? What kind of CPU? How much memory? Should I have Hardware Acceleration? What flavor should I use?  This is an attempt of a canonical answer. My answers have the "official  requirements", the recommended are a mix of official sources and opinion based (along with the answer it's told the source). You can comment or edit if you feel that the information is obsolete or incomplete. It is a good rule of thumb that any system capable of running Windows Vista, 7, 8, x86 (Intel) OS X will almost always be a lot faster with any Ubuntu flavor even if they are lower-spec than described below.


I am using SQL Server 2008 and I need to implement this :-> I get a result like this :  Table:-sql query ..............   acc_no           name    001-000001       John    001-000001       Bob    001-000001       James    001-000002       Sam    001-000002       Bin     001-000002       Dus   So, the condition is that; multiple persons can have same acc_no. So i want following result:   acc_no           name    001-000001       John,Bob,James    001-000002       Sam,Bin,Dus   There are other conditions for displaying the results but I got stuck in displaying this format.

I've got two tables:  TableA ------ ID, Name  TableB ------ ID, SomeColumn, TableA_ID (FK for TableA)   The relationship is one row of TableA - many of TableB.  Now, I want to see a result like this:  ID     Name      SomeColumn  1.     ABC       X, Y, Z (these are three different rows) 2.     MNO       R, S   This won't work (multiple results in a subquery):  SELECT ID,        Name,         (SELECT SomeColumn FROM TableB WHERE F_ID=TableA.ID) FROM TableA   This is a trivial problem if I do the processing on the client side. But this will mean I will have to run X queries on every page, where X is the number of results of TableA.   Note that I can't simply do a GROUP BY or something similar, as it will return multiple results for rows of TableA.   I'm not sure if a UDF, utilizing COALESCE or something similar might work?


Given $a_1 \in \mathbb{R}$ , consider the  sequence  {$a_n$} defined by   $ a_{n+1}  = \begin{cases} \frac{a_n}{2} &\text{ for  even n} ,\\ \frac{ 1+ a_n}{2} & \text  {for  odd n} \end{cases}$.  find the  the  limit points of this  sequence..      My attempt :  For  n odd  i get $ a_{n+1}= \frac{ 1+ a_n}{2}$ nad putting  $a_{n+1} =  {a_n}  = l$  Now  i get   $l= \frac{ 1+ l}{2}$ as  i get  $l =  1$  for odd..  as I don't  know  how to find the  $a_{n+1}$  when  n   will even  Pliz help me,,,,,

Given $a_1 \in \mathbb R$ . Consider the   sequence  $\{a_n\}$, which is recursively  defined by$$ a_{n+1} =\left\{\begin{array}{ccc}   \dfrac {a_n}{2} &  \text{if $n$ is even,}\\  \dfrac {1 + a_n }{2} &  \text{if $n$ is odd}.\end{array} \right. $$  Find the sub-sequential limit of this sequence.  I think  for  odd  $n$  the  limit  point will be   $l= \frac{1+l}{2}$ now  $2l = 1+l$  , here $ l = 1$  I don't  know the  limit point for0 even  $n$.  Please help me.


Say we have a group containing 4 items $[A, B, C, D]$ and we allow sub-groups of size 2, then 6 sub-groups are needed to ensure every element is grouped with every other element at least once. $[A,B] [A,C] [A,D] [B,C] [B,D] [C,D]$ or 3 if we allow sub-groups size 3 $[A,B,C] [A,B,D] [B,C,D]$ Expanding this to 8 elements and sub-groups size 4, 6 sub-groups are also required. It also appears that if you have $n$ elements and a sub-group size $m$ which require $x$ sub-groups to ensure element grouping, then $kn$ elements with sub-group size $km$ also requires $x$ sub-groups. So possibly only prime numbers for $n$ or $m$ have unique values of $x$. I tried initially looking at binary representations as a way to get all possible arrangements, then counting the instances of Hamming Weight $m$ from $0$ to $2^n$ but the pattern did not hold. I am trying to generalize it so if you have $n$ elements with sub-group size $m$ $\binom{n}{m}$ where $1<m<n$ , $m \in \mathbb{Z}$ , $n \in \mathbb{Z}$ some function $F(n,m) = x$ Is  there a formular to express the minimum number of sub-groups size $m$ so that each element in $n$ is grouped with every other element at least once? I'm having trouble describing elements as having already been grouped mathematically.

Background: I'm working on  for , and I've run into a problem with how I'm creating the individual matchups (groups of 4 entries).  Currently, I'm simply generating all combinations of 4 elements (in the combinatoric sense) of entries, but that gets really big really quickly:  $$x \choose 4$$    (from )  Therefore, my question is: How can I choose subsets (of length $n$) of a set such that each element of that set appears in the same subset as every other element at least once, while maintaining a minimal amount of subsets?  I can figure this out for $n = 2$, since the solution is quite intuitive: simply combine the first element with every other element, combine the second element with every other element that comes after it, etc. For a set of length $L$, this yields:  $$\sum_{x=1}^{L-1}(L - x)$$    (from )  which is much smaller and more manageable.  However, I still have not been able to figure out: How can I generalize this to any $n$?


My question is as follows: $a,b \in L$ where $L$ is a ring. We are given that $ab=1$.  I need to prove or disprove that $a$ is invertible (meaning, there is an element $x \in L : ax=xa=1$).  But how can we say that for sure? just because $ab=1$ doesn't mean that $ba=1$, ba could be something else altogether, we werent given that this is a commutative ring.  Please give advice on how to solve, thank you.  Word by word translation of the question to make it clearer: Prove or disprove that if $a$ and $b$ are elements of $L$ and $ab=1$, then $a$ is invertible.

Can I have a hint on how to construct a ring $A$ such that there are $a, b \in A$ for which $ab = 1$ but $ba \neq 1$, please? It seems that square matrices over a field are out of question because of the determinants, and that implies that no faithful finite-dimensional representation must exist, and my imagination seems to have given up on me :)


After doing research for a while, I figured out a topic (1) that nobody has done it before (2) and I think It's pretty cool and valuable (3) to the community in my field. So, I proposed the idea to my professor with some drafts. But, my professor told me to find out if there is any interest in the topic in the publishing industry (journals) If no one cares about that It's not worth it.  It's like I created a paradox. How can I find out the interests in the topic if nobody has done it before?  If you guys have any ideas or tips that can help me I would be really appreciated!  Thanks  (1) I'm working on Fault Management Framework for Network Function Virtualization.  (2) I cannot find any relevant paper that employs it. They're mostly about Fault Management for SDN or cloud or on a specific problem whereas I want to design a complete solution.  (3) I think it is valuable because It will save time for the deployer/implementor by including all the best practices.  There'are several reasons why this question is different than the one at  because of:   It's not about selecting a journal to publish, It's about whether the journals are interested in my topic. I've already known which ones I want to publish to. It's just that I'm not sure if they're interested in my idea. The question in which mine was marked as duplicated with is much broader than mine I think.

I am a PhD candidate in a small country. I have two Master degrees, one from an American university. I am also an experienced professional and an expert in the subject of my PhD studies (in my country, clearly). I need to publish a paper in an international journal as a condition to obtain my PhD. How do I choose a journal? I cannot afford years of waiting for the paper to be published, submit it and be rejected many times. I am looking through the journals, and there is simply no way to know which one is suitable for me. Any help? I understand about looking for journals which had previously published similar articles, but how to know that it is a journal which is likely to accept my article?  Thank you!


I have been trying to print some characters on my php page and it returns something else, like corrupted characters  like      "joão", ø, ç, etc   echo '
não
'   the return is  nÃ£o   instead:  não   is this a problem with econding utf-8?  i have tried this code  header('Content-Type: text/html, charset=utf-8');   but no result

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.


If G is a group of order d, then does there exist a subgroup of order c for all divisors c of d? I cannot find a proper countetexample. Could anyone provide me with one?

Can a kind algebraist offer an improvement to this sketch of a proof?     Show that $A_4$ has no subgroup of order 6.     Note, $|A_4|= 4!/2 =12$. Suppose $A_4>H, |H|=6$. Then $|A_4/H| = [A_4:H]=2$. So $H \vartriangleleft A_4$ so consider the homomorphism $\pi : A_4 \rightarrow A_4/H$ let $x \in A_4$ with $|x|=3$ (i.e. in a 3-cycle) then 3 divides $|\pi(x)|$ so as $|A_4/H|=2$  we have $|\pi(x)|$ divides 2 so $\pi(x) = e_H$ so $x \in H$ so $H$ contains all 3-cycles but $A_4$ has $8$ $3$-cycles $8>6$, $A_4$ has no subgroup of order 6.


Today I was trying to install Ubuntu and dual boot with my already installed windows 10. I downloaded Ubuntu's latest stable version and burned it to a flash disk. I chose the language then I saw this message      The machine's firmware has started the installer in UEFI mode but it looks like there may be existing operating systems already installed using BIOS compatibility mode.If you continue to install Debian in UEFI mode, it might be difficult to reboot the machine into any BIOS-mode operating systems later.   If you wish to install in UEFI mode and don't care about keeping the ability to boot one of the existing system, you have the option to force that here. If you wish to keep the option to boot an existing operating system you should choose NOT to force UEFI installation here.   Then there were 2 options (go back or continue to UEFI mode). I clicked continue to UEFI.  Then I chose Something else. After that I accidentally clicked on "revert". After I clicked the bar on the top turned green and things look like this.      Now I can't boot to Windows. I also can't see my data from the Ubuntu. I used to see my data when I use the "try Ubuntu" before clicking on revert but now they are gone.  Is there is a way to get my partitions and data back? :'(  I am using a Dell xps 15 laptop. 512 GB ssd. I had 2 partitions + windows (450MB I think system partition).   Before trying to install Ubuntu I disabled fast boot and secure boot. I use UEFI and AHCI mode.  Here is my RESULTS file from the boot info script:

About two weeks ago I had a problem with my PC that my brother wrote a question about at .  I still haven't solved the problem, so my PC is unusable now.  Now I think that it would be simpler to re-install both Win7 & Ubuntu than repair them, but there're some data on their partitions. I want to recover this data.  These partitions are not mountable for some reason. I don't know why.  sudo fdisk -l about the problematic partitions:     Device    Boot      Start         End      Blocks   Id  System /dev/sda1            2048     147912703    73955328   83 Linux /dev/sdb2            206848   174079999    86936576    7  HPFS/NTFS/exFAT   And in GParted:      And the error of the mount command:  Failed to mount '/dev/sdb2': Invalid argument The device '/dev/sdb2' doesn't seem to have a valid NTFS. Maybe the wrong device is used? Or the whole disk instead of a partition (e.g. /dev/sda, not /dev/sda1)? Or the other way around?   And the exact same message for /dev/sda1  How can I recover my data from those HDDs?  EDIT     I have tried to specify the type of the drive:  $ sudo mount -t ext4 /dev/sda1 /olddisk mount: wrong fs type, bad option, bad superblock on /dev/sda1,        missing codepage or helper program, or other error        In some cases useful info is found in syslog - try        dmesg | tail  or so $ sudo mount -t ntfs /dev/sdb2 /olddisk NTFS signature is missing. Failed to mount '/dev/sdb2': Invalid argument The device '/dev/sdb2' doesn't seem to have a valid NTFS. Maybe the wrong device is used? Or the whole disk instead of a partition (e.g. /dev/sda, not /dev/sda1)? Or the other way around?   EDIT     sudo ntfsfix /dev/sdb2 returns:  Mounting volume... NTFS signature is missing. FAILED Attempting to correct errors... NTFS signature is missing. FAILED Failed to startup volume: Invalid argument NTFS signature is missing. Trying the alternate boot sector Unrecoverable error Volume is corrupt. You should run chkdsk.


The beta sites  and  have the same icon.  Icon of Earth Science:    Icon of Spanish:    They both have "ES" in a blue speech balloon.  Can they please have different icons?

The favicon is used in various places around the Stack Exchange (SE) network, to identify the site. Currently, Earth Science has  for main and  for meta. The problem I see is that these are awfully similar (i.e. exactly the same, as demonstrated here) to those for Spanish.SE, which are  for main and  for meta. The larger versions offer slight differences, but it's still hard to tell quickly which is which. Power users on this site, did you guess right, even after some time to think about it? (Answers under spoiler tag).   for main and  for meta.  for main and  for meta.    The first one is Earth Science and the second is Spanish.  Should SE visually distinguish between the two very different sites?


I am using URLDownloadToFile to download the files from URL.  while downloading URLDownloadToFile API creates cache files in INETCache if "Temporary Internet files and website files" is unchecked in Internet Explorer "Delete browser history settings".  can we prevent creating these cached files ?  Your help will be appreciated :)

I am using URLDownloadToFile to retrieve a file from a website. Subsequent calls return the original file rather than an updated version.  I assume it is retrieving a cached version.


I just downvoted this question  (screenshot in case it gets deleted):    However, when I go to the timeline, it shows that my vote happened 14 hours ago. The question was only asked 2 hours ago:    Has SE invented a voting time machine?

The new timeline is pretty snazzy. But there's one thing I've noticed that's a bit jarring; the timestamp for vote summaries is always 0:00:00 on a particular day, and the summary covers the rest of that day. So you end up with a summary that always shows up earlier than the events that presumably triggered the votes that show up in it.  A simple solution is to have it display 23:59:59 instead, and sort accordingly. This way the summary comes in after the events it summarizes.


I downloaded a software package in a .tar.bz file.  I understand that I can install such packages through make install, but then there's no easy way to uninstall. Is there a way that I can add this package to my local repository, so that I can install/uninstall it through apt-get?

I have always had a problem installing and removing compiled software, so I have decided I would like to build software from source into a .deb package for easier installation/removal.  I would like to know of an easy and short way to build source into a .deb package, as an end user.  I have tried:   , which did not work for me This  guide, but I found it too long


In bash, I tried writing a script to run the last N commands. For say, N=5  for i in {1...5} do     !-5 done   The problem is that !-5 gets replaced by the 5th-last command on my shell (say time) and the 'time' command runs 5 times.   Can I make any alteration to my script to make it run the last 5 commands on my shell in series?    NOTE: I posted this question AFTER checking out other similar question which did not answer my requirements. The situation were analogous to this: Qn1 - "How do you print 3 consecutive tildes '~~~' in C++" Ans: cout<<"~~~";  Qn2 - "How do you print N consecutive tildes '~~~' in C++"  Ans: Run a loop and do cout <<"~"; inside the loop  The questions marked duplicate are similar to Qn1 from above and what I wanted was the answer to Qn2 from above. So, I debate the fact that it is a duplicate to the previous question.

Suppose I want to execute a sequence of four commands that I have executed before. If the first one is 432 in the command-history, then I could do:  $ !432; !433; !434; !435   I'm curious, is there a more efficient way to accomplish this?


Imagine a scenario where there are only two players. One of the players has only one card left, which is Draw 2 card.  If he/she puts the card in the field, can the other player counter act with a Draw 2, or is the game over?

When playing with progressive Draw 2 and Draw 4 and (say that there are 2 players playing) and    Player 1 goes out with a Draw 2  Player 2 puts down a Draw 2    Does player 1 have to pick up 4 cards?


I have Ubuntu server and we are using putty to take remote session  from Windows. I want to record the activity which was done by putty session by any user. Is it possible? If yes then how?

Our small company runs an Ubuntu Server 11.10, to which a couple of people have SSH access. The actual terminals are sometimes used, too. How can we locally log all Bash commands run, along with user and time stamp?  We can assume that no-one is nefarious and actively trying to avoid the logging, but we'd still prefer the users not to have direct write-access to their log files. Simultaneous sessions must be handled correctly.


Which of the following cases is better for performance or proper techniques?  CASE #1  function SomeClass () {     this.someVar = null;     this.someFunc = function () {} }   CASE #2  function SomeClass () {} SomeClass.prototype.someVar = null; SomeClass.prototype.someFunc = function () {}

What's the difference between  var A = function () {     this.x = function () {         //do something     }; };   and  var A = function () { }; A.prototype.x = function () {     //do something };


I beat Rogue Legacy twice recently and I'm now at New Game +2, however, I don't like it. It's too difficult for me. Is there a way to go back to New Game+ without re-doing everything? I have located the save files but opening in notepad doesn't really tell me anything. Is there a way to edit the save files, or even an in-game option?

I've defeated the final boss in a very cheesy way (Babarian Tank with a lot of Damage Return).  Now I have a hard time even getting some money in the castle of New Game Plus - is there some way to return to the old "easy" castle ?


I don't have SAS and the dataset with me, so I made up this table (from my memory). Basically this is what I got:    After deciding to leave the variable $age$ and $risk$ in my model, I created this interaction term. According to the yellow table, I suppose I should not drop this term since that would significantly impact my model (if I haven't interpreted it wrong). However, there are several levels within each class. We see that the test statistics of $old*standard$ is insignificant.   Question 1: Does it make sense to drop this particular level of interactions and run regression on the others?  Question 2: If that does make sense (which I doubt), do I create dummy variables on the reference levels as well? How would I interpret the intercept then?

After seeking clarification about linear model coefficients  I have a follow up question concerning non-signficant (high p value) for coefficients of factor levels.  Example: If my linear model includes a factor with 10 levels, and only 3 of those levels have significant p values associated with them, when using the model to predict Y can I choose to not include the coefficient term if the subject falls in one of the non-signficant level?  More drastically, would it be wrong to lump the 7 non-significant levels into one level and re-analyze?


The dihedral group consists of rotations and symmetries. But the symmetry group is a group only if n is even, thus the group of rotations is a normal subgroup of the dihedral group.   So how to describe this normal subgroup(rotations) and are there any other normal subgroups of the dihedral group?

In relation to , I am curious about what exactly are the normal subgroups of a dihedral group $D_n$ of order $2n$.  It is easy to see that cyclic subgroups of $D_n$ is normal. But I suspect that case analysis is needed to decide whether dihedral subgroups of $D_n$ is normal.  A little bit of Internet search suggests the use of semidirect product $(\mathbb Z/n\mathbb Z) \rtimes (\mathbb Z/2\mathbb Z) \cong D_n$, but I do not know the condition for subgroups of a semidirect product to be normal.  I would be grateful if you could suggest a way to enumerate the normal subgroups of $D_n$ that does not resort to too much of case analysis.


I need to add leading zeros to integer to make a string with defined quantity of digits ($cnt). What the best way to translate this simple function from PHP to Python:  function add_nulls($int, $cnt=2) {     $int = intval($int);     for($i=0; $i<($cnt-strlen($int)); $i++)         $nulls .= '0';     return $nulls.$int; }   Is there a function that can do this?

Given: a = 1 b = 10 c = 100  How do I display a leading zero for all numbers with less than two digits? This is the output I'm expecting: 01 10 100


If I have priority and cast an  on a just summoned 2/3 creature, then, passing priority, my opponent casts a  on that creature, does my creature survive? The first spell that resolves is obviously the bolt, that deals 3 point of damage to the creature; but immediately after, will the  Unholy Strength resolve (giving +2/+1), allowing the creature to survive?

If I have got a creature with "inflatable abilities" - just like , or  - I want to know what happens when activating it. Since inflatable abilities are activated abilities, if I activate three times Granite Gargoyle's ability ({R}: +0/+1 until end of turn) in response to each other, they go on the stack one after the other, and my opponent may respond to this with a Shock targeting the Gargoyle. So, in such a situation, the Gargoyle dies, and goes to the graveyard  before his ability comes to rescue. Is this correct?


How to block all the network traffic from one user? But other users are alive to the network that the blocked user is able to connect to other users who have the permission to the internet.

Let's say there are two users on the LAN, A and B. How do I restrict user A from internet access using iptables rules and saving the rules so that after reboot, they are still effective. Suppose also that I want to grant that user access at some point; how do I enable it again? I am using Ubuntu Linux 10.04. It would be nice if anybody show me how to do it from the command line, as I often login to the machine using a local ssh login.


I can't seem to find any way to get to the chest.

I understand that the trick would be to pass over the eggs and use anti-grav potions but i have no idea how to jump.


Stars create heavy elements up to iron during their lifetimes, and heavier elements beyond iron during supernova events.   Are there any processes which create new hydrogen? If not, will all (or most) of the hydrogen in the universe eventually be turned into heavier forms by stars?

I recently became really interested in learning about physics and cosmology, but I still know very little. Hopefully someone with more knowledge will be able to shed some light on my questions.  Here are my presumptions (please correct me if I'm mistaken):   $t_{0}$: Big Bang. The Universe expands (and thus cools) sufficiently to allow the formation of atoms. The early Universe mostly consists of Hydrogen and is not uniform in its geometry. Gravity pushes lumps of matter together until their density (temperature) is so high that nuclear fusion kicks off. The first giant stars are born. Some heavy elements are created in these stars and when they explode, sufficient temperatures are reached to form heavier elements still. All of the successive stars and planets are the product of these original stars.   My questions:   If the amount of Hydrogen is finite in the Universe and each successive generation of stars use up most of their Hydrogen, what is the theoretical maximum number of generations of stars that our Universe can support? A ballpark figure in terms of years is fine too. ;) Are there some special physical processes that occur in the Universe on a large enough scale that are able to break up heavy elements (i.e., Helium) into lighter elements (i.e., Hydrogen)? Kind of like a cosmic recycling operation. If we discount the possibility of a Big Crunch, is the Universe pretty much headed into a time when there will be no more stars and only a bunch of black holes, planets, and other debris?


I am curious about the ability for a lens to start a fire without using sunlight. Is it possible for alternative light sources (LED, incandescent, etc.) in combination with a very large Fresnel to start a fire? Or more appropriately how much energy could a very large Fresnel lens concentrate into one point using everyday light sources?  In considering different types of light sources, which would be best for generating the most heat? Luminous efficacy and the size of the light source seem the most obvious but how would the color of the light affect the lens' ability to generate heat?  Will a high focal length and large aperture lens (such as a giant spot Fresnel) even be able to focus the amount of light sources necessary into a small enough point to generate enough heat?

I have a cylindrical lens & a surface that can be burned.( for example wood , sheet ,...) In a sunny day , I wanna burn the surface but I don't know the "Energy for burning surfaces" If the $Power$ of sun is $1400 W/m^2$ , could you tell me how can I burn them?


How can the orbit of Jupiter's moons be used to calculate the speed of light? It seems this was one of the first methods and goes back to 1656.

I am interested in the practical method and I like to discover if it is cheap enough to be done as an experiment in a high school.


Simple, possibly stupid question, but here it is.   So I know $$\nabla \cdot\vec E = \frac{\rho}{\epsilon_0},$$ but how do I use a given charge density to calculate an electric field?   I guess the root of my question is about the mathematical procedure of "undoing" the div operator.

This question is a sequel of sorts to my  about .  In the paper, the authors performed molecular dynamics (MD) simulations of parallel-plate supercapacitors, in which liquid resides between the parallel-plate electrodes.  The system has a "slab" geometry, so the authors are only interested in variations of the liquid structure along the $z$ direction.  In my previous question, I asked about how particle number density is computed.  In this question, I would like to ask about how the electric potential is computed, given the charge density distribution.  Recall that in CGS (Gaussian) units, the Poisson equation is   $$\nabla^2 \Phi = -4\pi \rho$$  where $\Phi$ is the electric potential and $\rho$ is the charge density.  So the charge density $\rho$ is proportional to the Laplacian of the potential.  Now suppose I want to find the potential $\Phi(z)$ along $z$, by integrating the Poisson equation.  How can I do this?  In the paper, on page 254, the authors write down the average charge density $\bar{\rho}_{\alpha}(z)$ at $z$:  $$\bar{\rho}_{\alpha}(z) = A_0^{-1} \int_{-x_0}^{x_0} \int_{-y_0}^{y_0} dx^{\prime} \; dy^{\prime} \; \rho_{\alpha}(x^{\prime}, y^{\prime}, z)$$  where $\rho_{\alpha}(x, y, z)$ is the local charge density arising from the atomic charge distribution of ionic species $\alpha$, $\bar{\rho}_{\alpha}(z)$ is the average charge density at $z$ obtained by averaging $\rho_{\alpha}(x, y, z)$ over $x$ and $y$, and $\sum_{\alpha}$ denotes sum over ionic species.  The authors then integrate the Poisson equation to obtain $\Phi(z)$:  $$\Phi(z) = -4\pi \sum_{\alpha} \int_{-z_0}^z (z - z^{\prime}) \bar{\rho}_{\alpha}(z^{\prime}) \; dz^{\prime} \; \; \; \; \textbf{(eq. 2)}$$  My question is, how do I "integrate the Poisson equation" to obtain equation (2)?  How do I go from  $\nabla^2 \Phi = -4\pi \rho$ to equation (2)?  In paricular, where does the $(z - z^{\prime})$ factor come from?   Thanks for your time.


import numpy as np  class MyClass:          a = int()         b = float()         c = np.array([0 for i in range 10])          def Memberfunction():              print("Hii")

I've read that it is possible to add a method to an existing object (i.e., not in the class definition) in Python.   I understand that it's not always good to do so. But how might one do this?


I have been trying to render a thumbnail for a Roblox game. I have everything ready I just need to render it. When I try to render the final product It only shows the terrain and not the actual people. I think something is wrong with the camera. Not sure though.

This is meant to solve this problem once and for all. What is every reason an object isn't showing up in a render or viewport in when using the cycles render engine?


why doesn't the text get centered? it becomes on the right edge what should i change?      .text4 {       width: 762px;       height: 714px;       font-size: 24px;       line-height: 40px;       color: #273d46;       font-family: "Times New Roman";       text-align: center;   } <div class="text4">       Donec aredsed odio dui. Morbi leo risus, porta ac consectetur ac, vestibulum       at eros. Morbi leo risus, porta ac consectetur ac, vestibulum at eros. Donec       ullamcorper nulla non metus auctor fringilla.       Aenean eu leo quam. Pellentesque ornare sem lacinia quam venenatis vestibulum. Aenean eu leo        quam. Pellentesque ornare sem lacinia quam venenatis vestibulum. </div>

How can I horizontally center a
 within another
 using CSS?

Foo foo


How to find the formula for the sum of fractions like this? $$\frac{1}{1\times 2}+\frac{1}{2\times 3}+\ldots+\frac{1}{n\times (n+1)}=$$

How can I find the formula for the following equation?  $$\frac{1}{1\cdot 2}+\frac{1}{2\cdot 3}+\frac{1}{3\cdot 4}+\cdots +\frac{1}{n(n+1)}$$  More importantly, how would you approach finding the formula? I have found that every time, the denominator number seems to go up by $n+2$, but that's about as far as I have been able to get:  $\frac12 + \frac16 + \frac1{12} + \frac1{20} + \frac1{30}...$ the denominator increases by $4,6,8,10,12,\ldots$ etc.  So how should I approach finding the formula? Thanks!


I've just installed Xubuntu for the first time and am trying to set up a wireless connection, configuring the connection in Terminal, as I can't see the network icon in the desktop.    I want to configure a wlan0 connection but unsure how to do this.   When I run a ifconfig, I get this:   06:05.0 Network controller [0280]: Broadcom Limited BCM4318 [AirForce One 54g] 802.11g Wireless LAN Controller [14e4:4318] (rev 02) Subsystem: AMBIT Microsystem Corp. TravelMate 2410 [1468:0312] Kernel driver in use: b43-pci-bridge Kernel modules: ssb   lan@alan-TravelMate-2420:~$ lspci -knn | grep Net -A3; rfkill list 06:05.0 Network controller [0280]: Broadcom Limited BCM4318 [AirForce One 54g] 802.11g Wireless LAN Controller [14e4:4318] (rev 02)     Subsystem: AMBIT Microsystem Corp. TravelMate 2410 [1468:0312]     Kernel modules: ssb, wl 06:07.0 Ethernet controller [0200]: Realtek Semiconductor Co., Ltd. RTL-8100/8101L/8139 PCI Fast Ethernet Adapter [10ec:8139] (rev 10) 0: acer-wireless: Wireless LAN     Soft blocked: no     Hard blocked: no   I managed to sort the wlan0 out but now i get the error ""Set Encode" (8B2A)". After research online, I dont think you can connect to a WPA/WPA2 network by using the iwconfig.   alan@alan-TravelMate-2420:~$ iwconfig lo        no wireless extensions.  wlan0     IEEE 802.11  ESSID:"VM1579855"             Mode:Managed  Access Point: Not-Associated   Tx-Power=20 dBm              Retry short limit:7   RTS thr:off   Fragment thr:off           Power Management:off            enp6s7    no wireless extensions.  alan@alan-TravelMate-2420:~$ sudo iwconfig wlan0 key s:password [sudo] password for alan:  Error for wireless request "Set Encode" (8B2A) :     SET failed on device wlan0 ; Invalid argument.   Thanks all in advance :)

I'm having serious problems installing the Broadcom drivers for Ubuntu. It worked perfectly on my previous version, but now, it is impossible.   What are the steps to install Broadcom wireless drivers for a BCM43xx card?  I'm a user with no advance knowledge in Linux, so I would need clear explanations on how to make, compile, etc.    lspci -vnn | grep Network showed:   Broadcom Corporation BCM4322 802.11a/b/g/n Wireless LAN Controller [14e4:432b]      iwconfig showed:  lo        no wireless extensions. eth0      no wireless extensions.   NOTE: Answer below is updated every time new information is added and confirmed working.


Suppose we have a material point. If it is moving from position $X_0$ with initial velocity $V_0$ and constant acceleration $A$, then from elementary physics course I remember that its movement is described by the equation  $$X(t) = X_0 + V_0t + At^2/2.$$  Now, my question is, what is the equation of the movement of the material point if its acceleration is an arbitrary function of $t$: $A(t)$. Is it simply:  $$X(t) = X_0 + V_0t + A(t)t^2/2,$$  or is it more complicated than that? From the looks of $At^2/2$ I have a suspicion that integrals may be involved.

I have a background in calculus but don't really know anything about physics.  Forgive me if this is a really basic question.  The equation for distance of an accelerating object with constant acceleration is:  $$d=ut        +\frac{1}{2}at^2$$  which can also be expressed  $$d=\frac{\mathrm{d}x}{\mathrm{d}t}t+\frac{\mathrm{d^2}x}{\mathrm{d}t^2}\frac{t^2}{2}$$  (where x(t) is the position of the object at time t)  That's fine for a canonball or something like that, but what about a car accelerating from 0 to cruising speed?  The acceleration is obviously not constant, but what about the change in acceleration?  Is it constant?  I suspect not.  And then what about the change in the change of acceleration, etc. etc.?  In other words, how does one know how many additional terms to add in the series?  $$d=\frac{\mathrm{d}x}{\mathrm{d}t}t+\frac{\mathrm{d^2}x}{\mathrm{d}t^2}\frac{t^2}{2}+\frac{\mathrm{d^3}x}{\mathrm{d}t^3}\frac{t^3}{3}+\frac{\mathrm{d^4}x}{\mathrm{d}t^4}\frac{t^4}{4}\cdot etc. \cdot ?$$


Assume a simple class:  class MyClass(object):     pass  . . . m = MyClass print type(m) # gets: <type 'classobj'> # if m is classobj, how can i check a variable is class object?   My question is: how can i check a variable is a class object?  a simple solution:  if str(type(m)) == "<type 'classobj'>":     # do something   But i think there is at least one classic way to check that.

I was wondering how to check whether a variable is a class (not an instance!) or not.  I've tried to use the function isinstance(object, class_or_type_or_tuple) to do this, but I don't know what type would a class will have.  For example, in the following code  class Foo: pass   isinstance(Foo, **???**) # i want to make this return True.   I tried to substitute  "class" with ???, but I realized that class is a keyword in python.


For external packages CTAN provides the needed documentation, however, for built-in Latex commands I am not aware of any proper documentation except for  which doesn't really list all the options  I would like to know how I could check all the available environments, commands and relative optional fields of all the built-in commands of Latex more or less like I would use the man command under linux.  I'm looking for something exhaustive like the  documentation that breaks down every single piece available.

I can't find official documentation for the \@startsection command. I already looked in:   LaTeX Wikibook LaTeX: Structured document for TEX, 2008 beginLatex — a book that comes with ProTeX in the files that comes with MikTeX in the folder doc   and Google. I found a lot of sites that show examples and discussions about it but I'd like to find the official help or document.


I cannot boot into fedora. Boot is stucked on:  A start job is running for File System Check on /dev/disk/by-uuid/...  I let it be for about 4 hours but nothing happened. But with flag fastboot it boots normally.  The uuid of disk is correct in fstab file.  Any ideas ?  SOLVED there

I have problem with my Fedora disto. Boot is stucked on system check on disk by UUID... I discovered that it is EFI partition and I tried to reconfigure grub2 but there are inffinite Input Outpur errors(see ) in Microsoft folder (yes, I have dual boot but each system on different disk). During my investigation I completely broke Windows so I want to delete Microsoft folder - fix Fedora and reinstall Windows. BUT when I try to delete the folder (sudo rm -rf... - also from Live CD with partition booted with RW permissions) it says that it is Read Only file system. What am I doing wrong ?


I set up my  und my webserver but I'm facing the problem that the website cannot be opened from the internet. I'm using Ubuntu server 12.04 with Apache 2.2 (I believe). This is what I checked so far:   http://localhost/ responds with my website  Firewall: port 80 open for incoming and outgoing traffic ports.conf -> listen 80 Virtual host in httpd.conf is configured Port forwarding is enabled in the router configurations When the firewall is disabled and I ping the domain, I get my external IP  doesn't see open port 80 ISP doesn't seem to block incoming traffic on port 80 Domain name is linked to my IP   Still, no connection to the server can be established. What did I forget?

I am new to apache2. I have an ubuntu 12.04.4 LTS machine in my home, and just installed apache2 on it. I wanted to set up a webserver running on a port other than port 80 (my router uses port 80). Here's what I did:   Changed some lines at the beginning of /etc/apache2/ports.conf from  NameVirtualHost *:80 Listen 80   to  NameVirtualHost *:8041 Listen 8041  Changed the first line of /etc/apache2/sites-available/default from  <VirtualHost *:80>   to  <VirtualHost *:8041>  Restarted apache2   My ubuntu machine has local IP address 192.168.1.133, and from any computer on my home intranet if I point a web browser to http://192.168.1.133:8041 then I get the standard apache2 "It works!" web page. I also set up my router to port forward any incoming TCP  packets on port 8041 to the ubuntu machine (still on port 8041).   Let's say my ISP has given me the IP address 123.456.78.90. If I am outside my intranet and I point a web browser to http://123.456.78.90:8041 then again it works.  However, within my intranet (on the ubuntu machine itself or on other machines on the intranet), when I point a web browser to http://123.456.78.90:8041 I get an "unable to connect" error.   Where do I go from here? I am now unclear about whether this is an issue with my apache set-up or my router. I have now unfortunately realised though that it is probably not a question about Ubuntu :-/


When discussing with my children Newton's laws (high school level), I told them (long story short) that one can imagine that since a body on which all forces balance move straight and at constant speed, one can imagine that not moving at constant speed implies (or is linked to) the fact that there is a net force.  And that this relationship is linear, and that the coefficient is the mass. And that this is magical.  I then started to wonder why   the relationship is linear the coefficient is the mass of the object   Are there fundamental reasons for the relationship to be exactly $F = m \times \dot v$, with $m$ being simply the mass?  What I am trying to say that this could have been $F = m^{1.346} \times \dot v^{0.6547} + 10^{-11}$ (obviously made up example for a non proportional relation, with a tiny loose end, and a less nice coefficient)

If you consider  as laws, then there must be independent definitions of  and  but I don't think there's such definitions.  If you consider them as definitions, then why are they still called laws?


Is there some way I can use MS Word with the TeX formulas? On  I've learned the syntax $\frac{\partial u}{\partial x}$ etc.. But I do not know how to create a LaTeX document. Is there some way I can use this syntax in MS Word?

Let's say I have a (comparatively) lovely-looking document in LaTeX, full of lovingly typeset, (relatively) complex equations. Now, let's say some barbarians come along one day and decide that the document has to be put into Microsoft Word (2007). ...after the usual mourning period associated with such events, let's say I value my job (more specifically, the bread it provides) enough to get all the text and tables formatted and references organised into the Word document. –...related questions  and – Now I'm looking at the equations with fear and dread. One option of course is to just lift screenshots from the original document, but this is painstaking if I need to refer to parts of the equation in the text. Also, I might need to edit equations on the fly. Anyone know of a free application which allows embedding LaTeX math into MS Word? I've looked at  and  which do roughly what I want... they build LaTeX images from source and embed them into the Word document, allowing to edit the source later... but both are commerical. ...any help in these troubling times will be greatly appreciated. EDIT: Just a note that  offers a 30-day free trial and is working out really nicely... but still, it's not free. Might be a good solution for those with short-term needs, or money.


SO's Google code prettify on python wrongly handles // (floor division) as a C-style comment, , even when the question is tagged .   Here is a more recent example from :  a[:len(a)//3*3]

I noticed that sometimes my code gets highlighted in different colors when rendered.   What is syntax highlighting? How does it work? Why isn't my code being highlighted correctly? How do I report a bug or request a new language? How do I use syntax highlighting? What languages are currently available on Stack Exchange?


When introducing the concept of continuous random variables, my textbook states the following:     If $X$ is a continuous random variable, then $P(a \le X \le b) = P(a <  X \le b) = P(a \le X < b) = P(a < X < b)$.   However, it does not give a justification for why this is true.   I would greatly appreciate it if people could please take the time to explain why this is true.

My understanding is that a random variable is actually a function $X: \Omega \to T$, where $\Omega$ is the sample space of some random experiment and $T$ is the set from which the possible values of the random variable are taken.  Regarding the set of values that the random variable can actually take, it is the image of the function $X$. If the image is finite, then $X$ must be a discrete random variable. However, if it is an infinite set, then $X$ may or may not be a continuous random variable. Whether it is depends on whether the image is countable or not. If it is countable, then $X$ is a discrete random variable; whereas if it is not, then $X$ is  continuous.  Assuming that my understanding is correct, why does the fact that the image is uncountable imply that $Pr(X = x) = 0$.  I would have thought that the fact that the image is infinite, regardless of whether it is countable or not, would already imply that $Pr(X = x) = 0$ since if it is infinite, then the domain $\Omega$ must also be infinite, and therefore  $$Pr(X = x) = \frac{\text{# favorable outcomes}}{\text{# possible outcomes}} = \frac{\text{# outcomes of the experiment where X = x}}{|\Omega|} = \frac{\text{# outcomes of the experiment where X = x}}{\infty} = 0$$  What is wrong with my argument?  Why does the probability that a continuous random variable takes on a specific value actually equal zero?


Let $X,Y$ be metric spaces. Suppose that there is a mapping $f:X\to Y$ which is bijective and continuous. Suppose that there is a mapping $g:Y\to X$ which is bijective and continuous. Then, are $X$ and $Y$ homeomorphic?

I happen to found  about finding two metric spaces $X$ and $Y$ such that there exists bijective continuous functions $f:X\to Y$ and $g:Y\to X$, and $X$ and $Y$ are not homeomorphic. I could not produce my own example, and I think the reason is that I am thinking of manifolds only.  Suppose we have two second-countable Hausdorff metrisable manifolds $X$ and $Y$ such that there exists bijective continuous functions $f:X\to Y$ and $g:Y\to X$. Can we show that the two manifolds are homeomorphic? Or is there still a counterexample?  Please note that I have taken only one course on metric space and topology, and I don't have much experience with manifolds. So please explain answers in details or post references to the details.  Edit: In case of any ambiguity, I would like to state that I do not restrict attention to manifolds without boundary, i.e. the manifolds may have boundary, if such a counterexample exists.


I want to set an optimum value for MaxClient in apache for my production server.  What are the parameters that I should consider while calculating this value ?

This is a  about capacity planning for web sites. Related:      What are some recommended tools and methods of capacity planning for web sites and web-applications? Please feel free to describe different tools and techniques for different web-servers, frameworks, etc., as well as best-practices that apply to web servers in general.


I am new to server administering and learning and I have an old dell server with windows server 2008 standard installed.  I almost forgot the password for the admininstrator account so I went in and changed it from the control panel user section.  Now after reboot the administrator button vanished.  It was the only administrator account.  What happened and how do I log in as admin now?  Ive looked and cannot see anybody with this same issue on searching.  I logged on to a normal user account and looked at properties of the user groups and I see the Adminstrator account there and it doesnt say its disabled.  It just doesnt want to show on login screen for some reason.

I accidentally disabled my admin account.  After I login to another account I found I can not get admin rights, because all admin accounts on my computer are disabled.  I clicked on 'run as administrator' but only see a smart card choice (all the admin accounts are disabled so no choice provided)    I don't want to re-install my OS, help!    Details:  I have account A on my computer.    I got a new computer so I want to give the old one to my mother.    Creating a new user account B for her and disable account A.    Logout and restart.    Successfully login B, now I found I could not get admin rights because no account choice is provided.    More informations about my machine:  OS is Windows 10 and my admin account is a Microsoft Account.  I have an arch-linux installed on my computer and dual-boot it using GRUB, so maybe I can not use safe mode.


What is the effect of changing the Aperture on the quality of the image?

How does aperture affect my photographs?  Why should I care about the aperture with which a photo was taken?


Is there any difference when we declare our methods within a class  class Foo {    ...    doSomething(){      ...    } }   or directly to the class prototype?  class Foo {     ... }  Foo.prototype.doSomething = function(){     ... }

I'm not that into dynamic programming languages but I've written my fair share of JavaScript code. I never really got my head around this prototype-based programming, does any one know how this works? var obj = new Object(); obj.prototype.test = function() { alert('Hello?'); }; var obj2 = new obj(); obj2.test();  I remember a lot discussion I had with people a while back (I'm not exactly sure what I'm doing) but as I understand it, there's no concept of a class. It's just an object, and instances of those objects are clones of the original, right? But what is the exact purpose of this ".prototype" property in JavaScript? How does it relate to instantiating objects? Update: correct way var obj = new Object(); // not a functional object obj.prototype.test = function() { alert('Hello?'); }; // this is wrong!  function MyObject() {} // a first class functional object MyObject.prototype.test = function() { alert('OK'); } // OK  Also these  really helped a lot.


I am developing an app that downloads an XML file, parses it and then displays the information on the screen.  I get a NullPointerException Exception error in the following code:  here is the code:  private class DownloadXmlTask extends AsyncTask<String, Void, List<vehicleInfo>> {     @Override     protected List<vehicleInfo> doInBackground(String... url) {         try {             return getvehicles.processBusTime();         } catch (IOException e) {            return null;         } catch (XmlPullParserException e) {             return null;         }     }      @Override     protected void onPostExecute(List<vehicleInfo> result) {               for (int record = 0; record < result.size(); record++) {              double latitude = result.get(record).latitude;             double longitude = result.get(record).longitude;                  mMap.addMarker(new MarkerOptions().position(new LatLng(latitude,     longitude)).title("Marker"));          }      } }   it is returns a NullPointerException at the line:  for (int record = 0; record < result.size(); record++) {  what could be the issue?  thanks.

What are Null Pointer Exceptions (java.lang.NullPointerException) and what causes them?  What methods/tools can be used to determine the cause so that you stop the exception from causing the program to terminate prematurely?


I've been using rsync to backup my "main" hdd quite successfully with the following command  rsync -aivr --delete --progress /src/my-files/ /dest/my-files   But I carry my external drive on the go and I might modify files on it. The above command would wipe out those changes. I can't just swap src and dest either because I may have changes on both drive that I want to preserve.  The behavior I want is something like this...  # rsync walks the src drive # if a file is present in src that is not present in dest, then copy the file to dest # if a file is present both in src and in dest, then compare modification times #     and overwrite using the later one. # if a file is present on dest but is not on src, then copy the file from dest to src.   Could I use rsync to get the above behavior?

I am trying to setup bi-direction or two way sync with rsync. In my case I only need to delete the files when syncing from B to A. So, I was thinking of running rsync twice as follow :  rsync -rtuv ./A/ ./B/ rsync -rtuv --delete ./B/ ./A/   This problem with this solution is that when I run rsync (B->A) which would be right after running the rsync (A-B), Any new file that get created in between the sync will also get removed.  Is there a way I can specify a time stamp as condition that it only delete the file if it created before this date/time.  Updated:  I understand there is a unison solution but the problem with unison is required to install on both ends. I am syncing with a remote server and I can not install unison on the remote end.


Given the right half plane $H = \{z \mid \operatorname{Re} z>0\}$, how can I find all the Möbius transformations that preserves $H$? I can't go very far by my own.

Show Möbius transformation which maps $\Im(z)>0$ to itself iff  $$ f(z)= \frac{az+b}{cz+d}\,,\,\,ad-bc>0$$ and $a,b,c,d$ are real.


From the moment that I used your OS I have become a fan. Fan of it's simplicity and beauty, but I worry about the creators. Creating something that is so simple and easy to use plus a beautiful OS requires a lot of money. Your OS is just like the Mac it is so simple to use, but unlike them you gave it for free.  I would suggest that you sort of copy apple. Make your own app store that way you'll earn money plus developers would be easily be able to make money too. Second you can sell music videos books and magazines so that it could generate income just like Android. As a Windows 8 user I find it easy to navigate to your OS. Make the apps upgradable. And I like how your OS design language fits perfectly on smartphones, tablets and TVs. I can't donate because I don't know how to use Paypal, but I think that this might help you.  Try copying what Apple and Android has done, and combine it in a way that it will attract developers and users but at the same time you could earn money. Thanks and one more thing please while developers are busy creating they're apps please create exclusive apps of your own.

We get various distros like kubuntu/ubuntu/lubuntu/edu/etc... for free. We get critical updates constantly. We can download any programs we want from Ubuntu repos. Gee, I can't even imagine what kind of a CDN network you gotta have to support all this. Also, Ubuntu has a lot of people working for them:   Can someone explain how this is possible financially?


How would you you show that $2^{32}+1$ is divisible by $641$ without making large calculations?

How can I show that  $F_{5}=2^{2^5}+1$ is divisible by $641$.


It seems to me, there are two broad categories of questions: (1) from people who use a programming language at their work place, and (2) from people who just started to learn using it. Almost everyone in the community seems to understand, based on the quality of the question, to answer the latter by initiating some thought and not just giving the solution.  I think, SO can do more to facilitate this. I am thinking about a special tag "beginner". Ideally, the actual accepted answer should not be revealed for questions tagged with such tags until clicked.  Do you think this would make sense? Maybe some other ideas?

See the revision history on , where the  tag was edited in (and subsequently edited out after I started this discussion).  I think, by adding this tag, you're making assumptions about the OP which they could find a little bit offensive.  Particularly with this question, there's no mention of the level of PHP knowledge — it's more a math question than it is a programming question. Someone could be excellent at a particular language whilst not being particularly great at math, so isn't it a bit insulting to make the assumption they're a beginner? It's also interesting to note  tag, which currently stands at 7,784 on SO.  Compare this to , which only has 18 questions, most of them being "discussiony."  Why do users retag questions as "beginner" but not "expert"? UPDATE, , .  Related   (thanks @Ralph)


I would like to bring in terms (just parents) from one taxonomy vocabulary to use as options in a form but I can't seem to pull them in. I thought taxonomy_vocabulary_machine_name_load would work but I can't seem to get the terms to show up.   $topic_options = array();   $name = 'web_topics';   $myvoc = taxonomy_vocabulary_machine_name_load() as $name => $vocabulary;   $tree = taxonomy_get_tree($myvoc->vid);   foreach ($tree as $term) {     $topic_options[$name] = $vocabulary->name;   }

How can I get the terms of a vocabulary using vocabulary machine name.  I have used the following code, although it works for me but I am looking for efficient methods.  $vocabulary = taxonomy_vocabulary_machine_name_load('school_courses'); $terms = taxonomy_get_tree($vocabulary->vid); $courses = array(); foreach($terms as $term) {     $courses[$term->tid] = $term->name; }


I am currently using Apache mod_rewrite to redirect to HTTPS, but I would like to remove the body from the response.  How it is currently:    Example: How I would like it to be    My redirect configuration:  <IfModule mod_rewrite.c>   RewriteEngine on   RewriteCond %{HTTPS} off   RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L] </IfModule>

We have noticed that when using nginx internal 301 and 302 handling, nginx will serve a small document body with the appropriate Location: ... header.  Something along the lines of (in html): 301 redirect - nginx.  As appropriate in the above behaviour, a content-type text/html and content-length header is also sent.  We do a lot of 302 and some 301 redirects, the above behaviour is wasted bandwidth in our opinion.  Any way to disable this behaviour?  One idea that crossed our mind was to set error_page 301 302 to an empty text file. We have not tested this yet, but I am assuming even with the above, the content-type and content-length (0) headers will be sent.  So, is there a clean way to send a "body-less" 301/302 redirect with nginx?


I want to install ubuntu alongside windows 10 but my laptop specifications are: 2G RAM, 300G HHD, 2.16 GHz dual processor. Could that work!? Because my computer is somewhat limited on resources! I winder if that couldn't affect the performance.

I am going to install Ubuntu to dual boot with Windows 8 soon, but one of my friends warned me that partitioning my hard drive will slow my computer down. I run on a 500GB HDD and 8GB of ram if that helps at all. Is that true if I do it?


I'm trying to match only {n} digits not more or less and may be surrounded by characters or special symbols  example: suppose the {n} = {14}   *12345678901234*300 OK  12345678901234x21 OK  *123456789012345*300 NOT OK  12345678901234 OK  123456789012345 NOT OK

I don't really understand regular expressions.  Can you explain them to me in an easy-to-follow manner?  If there are any online tools or books, could you also link to them?


Let me explain.  For example, you have a site, site.com, and on the domain provider service, you decide you want to have your own nameservers, and enter the new addresses.  You decide to let these nameservers have domain names, ns.site.com.  Now what happens if a client wants to resolve my.site.com, as far as i understand it, it (client and/or recursive DNS servers) will ask for authority for the second level domain record of site.com, pick the NS name from it, and resolve that to contact it.  Now we have set the nameserver to ns.site.com, which lays in it's own domain... wait, that's recursive.  This is exactly what I think could be a problem, how is it solved in the real world? Does/did this ever happen?

This is a  about DNS glue records.   What exactly (but briefly) is a DNS glue record?  Why are they needed and how do they work?


What about allowing things like  [Edit this question][edit] [What's on topic?][help/on-topic] [The proposal site][a51]   So they look like                  To reduce answers' and comments' (raw) length.    Oh, there's another thing. Can we have the text auto-generated so that we don't have to write  [Allow custom text for magic links](https://meta.stackexchange.com/questions/296051/allow-custom-text-for-magic-links)   but simply [/q/296051]? That'd be convenient (especially in comments)!

The  are awesome.  How much more awesome would it be to be able to make a comment linking to one of the URLs covered by a magic link, but with custom text?  Since the square-bracket link type isn't included in the mini-markdown used for comments, it could be stolen for this purpose.  Comment text like    Please [add that information][edit] to the body  of your post rather than using comments.   or   Please [include the shortest possible amount of code that demonstrates the problem you see][mcve].   would convert to   Please [add that information](http://{SITE}.stackexchange.com/posts/{ID}/edit)  to the body of your post rather than using comments.   and    Please [include the shortest possible amount of code that demonstrates the problem you see](http://stackoverflow.com/help/mcve).   for example.


I want to block usb mass storage in some of the systems in the LAN. I have written a bash script which will modify the file. I am running the script as default admin in ubuntu. But the script is not able to modify the file. I am getting the following error "bash: /etc/modprobe.d/blacklist.conf: Permission denied"  Below is my bash script  #/bin/bash password='mypassword'                  #admin password of remote system val='blacklist usb-storage'            #text which i want to add in the file for sysName in $(cat systemDetails)    #systemDetails is file which stores do ssh $sysName 'echo '$password' | sudo -S echo '$val ' >> /etc/modprobe.d/blacklist.conf' echo done #script ends   NOTE: I have configured my system such that no ssh password is required.  Any pointers in this regard will be really helpful.

I've been given sudo access on one of our development RedHat linux boxes, and I seem to find myself quite often needing to redirect output to a location I don't normally have write access to.  The trouble is, this contrived example doesn't work:  sudo ls -hal /root/ > /root/test.out   I just receive the response:  -bash: /root/test.out: Permission denied   How can I get this to work?


I know how to split a window (dragging the window splitter widget in the top right or bottom left of a window), but how do I   undo it?

I would like to close some view windows that I opened accidentally.  See the image below:    Edit: another note: I tried searching for the solution, but only found things like "Join Area", which don't seem to work in this situation.


When I download HTML Help Workshop from Microsoft, the first part is a success, but after 2 boxes this appears:     Error creating process      C:\Users\AWAKE_~1\AppData\Local\Temp\IXP000.TIMP\setup.exe      Reason: The requested operation requires elevation.   What do I do to fix this and what caused it?  By the way, I have a 64-bit operating system and a x64-based processor. Thanks!

I need to run a program as a different user + make it run with admin privileges (Run as administrator).  I use the '' for running the program as a different user  How can I run the program as admin with that command? (or a different one so will give me my requirements)  EDIT :  I need 2 things   Run as a different user Run as admin - not just as the admin user but also with full permissions   As this image


A machine receives messages according to a Poisson process of rate $\lambda$ messages per second. If it does not receive a message for $\theta$ seconds, then it is programmed to stop functioning. Evaluate mean value $E(T)$ of the total time $T$ the machine is working.   Attempt. If $N$ is the total amount of messages the machine receives while working, then for $N=n$, the time working is $T=W_1+\ldots+W_n+\theta$, where $W_i$ are the intermediate times between the arrivals of the $n$ messages (each of the exponential distibution, parameter $\lambda$). Somehow we should take into account that the intermediate times above are $<\theta$ and also that $W_{n+1}>\theta$, in order to evaluate $E(T|N=n)$ and then $E(T)=E(E(T|N))$.  Thanks in advance for the help.

A pedestrian wishes to go across a single-lane road where the cars arrive according to a Poisson process with the rate λ. The time needed for him to cross the road safely is denoted as k. He will have to wait until he sees a gap of at least k between the coming cars. If the gap between the car that just arrived and the next one is at least k, he begins to cross the road. Let T denote the random time he needs to wait by the road. What is the expected time the pedestrian needs to cross this particular road?  I've encountered several similar problems on here, but none of them gives a detailed, step-by-step explanation, so I am really confused. I would appreciate any help! Thank you in advance.


I am not sure if this can be done but I am wondering if it is possible to specify the 'T' type of a generic at run time. I have an object that has been serialized and stored in the database. The type of the object has also been stored. So when the object is retrieved I have the serialized object stored in a string variable as it's type also stored in a string variable. What I want to be able to do is something like this:  var serializer = new AbcSerializer(); var typeString = "Abc.Group.Common.Domain.DomainObject, Abc.Group.Common.Domain"; var serializedObject = "some serialized data here..."; var retObj = serializer.Deserialize<Type.GetType(typeString)>(serializedObject);   Does someone know if this is possible?  Other questions that are similar to this one talk about using MakeGenericType like this:  Type constructed = d1.MakeGenericType(typeArgs);   And then doing:  object o = Activator.CreateInstance(constructed);   to create an instance of that object. That is not what I am trying to do. I want to create an instance of my object from data that has been serialized.

The title is kind of obscure. What I want to know is if this is possible:  string typeName = <read type name from somwhere>; Type myType = Type.GetType(typeName);  MyGenericClass<myType> myGenericClass = new MyGenericClass<myType>();   Obviously, MyGenericClass is described as:  public class MyGenericClass<T>   Right now, the compiler complains that 'The type or namespace 'myType' could not be found." There has got to be a way to do this.


Monster’s planet is Earth like planet from Monsters inc. their race is Mons. The monster went to Earth and scare the children. Every monster who growing, growing, and growing as well. In “History of the Monster World.”

In Pixar's Monsters films (Monsters Inc. & Monsters U), the Monsters living on an Earth-like planet that is clearly not Earth.  Via their special doors, they're able to come to Earth.  It's unclear to me though how their planet and Earth are related.  Is the Monsters' planet in a parallel dimension?  Is it elsewhere in the same universe?  Is the Monsters' planet Earth in the far future ala Planet of the Apes?  How are Earth and the Monsters' planet related/connected?


I was wondering if ice is subject to the liquids rule.  It is not a liquid, gel, aerosol, cream or paste.

Once I read a suggestion saying that frozen "liquids" are not subject to the 100 ml restriction of security checks in airports. I've found   of this googling, but they all refer to TSA (I assume only hold in the US).  Is it true then that it's possible to carry frozen fluids in your hand luggage, in larger quantities than 100 ml?


There is a well-known proof of the fact that the prime gaps can be arbitrarily large. Namely, for any natural number $n$, the consecutive integers $(n+1)!+2,...,(n+1)!+(n+1)$ are never prime.   But clearly, this proof does not guarantee that $(n+1)!+1$ and $(n+1)!+(n+2)$ are prime. How can we show that the prime gap can be exactly $n$ for any even $n$?

Is it true that for every even natural number $k$ there exists some $n \in \mathbb{N}$ such that $g_n = p_{n+1} - p_n = k$?  I don't know how to approach the problem at all, and in fact I don't even know enough about prime gaps to even form a conjecture as to the answer. I feel like the answer is "yes", but only because that would be "nicer" than having some even integers never appear in sequence of prime gaps.  I hope it's not an unsolved problem!  Edit: My question is distinct from Polignac's Conjecture, since I ask if there is at least one prime gap, instead of infinitely many prime gaps, for every size.


I'm Indian. Can I enter the Schengen area 5 days before my Czech visa expires? I have applied for extension, but I have not received a decision, so far.

I have a Vietnamese passport. I'm planning to visit Vietnam on July 7th and be back in the Czech Republic (in Schengen area) on August 29th. My visa is a multiple-entry, long-term, D type visa (for study purposes) and the expiration date is September 10th. I am afraid that the boarding officer will not allow me to enter EU since the arrival is so close to the expiration date.   Is it OK for me to enter Schengen on August 29th when I have only 12 days left until visa expiration?


I am setting up a script in bash that return some information about a specific dictionary (french for example). I want that this script supports some parameters (4 currently). The issue is how manage the parameters easily than via many conditions ?   For the time being I am testing all the arguments of the script ($1, $2, ..) to be able to know which argument refers to which parameter  # langstat.sh : give statistics on letter occurrences in a specific language # Usage : langstat.sh <dictionary> # -> Display the number of times each letter is used at least once in a word of <dictionary> # Usage : langstat.sh --percentage <dictionary> # -> Display the percentage of times each letter is used at least once in a word of <dictionary> # Usage : langstat.sh --word <word> <dictionary> # -> Return true if <word> is a word of <dictionary> # Usage : langstat.sh --all <dictionary> # -> Display the number of times each letter is used in <dictionary> # Usage : langstat.sh --alphabet <alphabet> <dictionary> # -> Display the number of times each letter is used at least once in a word of <dictionary> using <alphabet> as alphabet   if [[ $# -lt 1 || $# -gt 5 ]] then     echo "Usage : $0 [--percentage] [--all] [--alphabet <alphabet>] <dictionary>"     echo "Usage : $0 --word <word> <dictionary>"     exit fi   ...... ...... ......  # Tests to understand how parameters are ordered if [ $# -eq 1 ] then  elif [ $# -eq 2 ] then     if [ $1 == "--percentage" ]     then      elif [ $1 == "--all" ]     then      fi elif [ $# -eq 3 ] then     if [[ $1 == '--percentage' && $2 == '--all' || $1 == '--all' && $2 == '--percentage' ]]     then      elif [ $1 == '--alphabet' ]     then      elif [ $1 == '--word' ]     then      fi elif [ $# -eq 4 ] then     if        fi elif [ $# -eq 5 ] then     if [[ $1 == '--percentage' && $2 == '--all' && $3 == '--alphabet' ]]     then      fi fi   So my question is do you have some suggestions, maybe do you know any command, that permit to manage easier the parameters ? There are many conditions to test with 4 parameters then how people do when parameters are 10 or 20 ?

Say, I have a script that gets called with this line: ./myscript -vfd ./foo/bar/someFile -o /fizz/someOtherFile  or this one: ./myscript -v -f -d -o /fizz/someOtherFile ./foo/bar/someFile   What's the accepted way of parsing this such that in each case (or some combination of the two) $v, $f, and  $d will all be set to true and $outFile will be equal to /fizz/someOtherFile?


I'm sick of waiting for The Winds of Winter. Where should I start watching the show where I won't be too lost from the book differences and I won't have to watch a lot of stuff I've already read about?  Or am I screwed and I should just watch them all? I just want to wade through the least amount of stuff I already know about from the books.

I've started reading George R. R. Martin's "A Song of Ice and Fire" book series, and I intend to watch HBO's television series based on it at some point. I wonder about two things:   Should I start watching the series before having finished all the books?  If so, which chapters should I have read? What is a good starting point?   The point is obviously avoiding spoilers.


I recently graduated from a university in Germany, and I would like to apply for a phD in UK. However, my university provides initial funding for me if I choose to do my phD in the university.   I will apply for my dream schools in UK. However, there will be a one year gap and I have no idea how to use it to enhance my chance of getting admitted in this year. I would like to take the initial funding to work as a phD student in my home university, and quit it if I get admitted. If I wasn't admitted, I can stay in the same lab.  Is it ethical to do this if I don't tell the supervisor of my home university before he accept me ? If I should tell him, how can I prevent hurting his feeling, and let him accept my proposal ?  Thanks !

I am an international student who has been admitted at a low ranked institute in the US. I also have an offer from an institute in my own country to do a Masters'. I ultimately want to get admitted at a prestigious program in the US.   I was recently advised to join the low ranked US institute, do my course work well, establish contacts with professors at more prestigious schools, and then switch to a better school for a PhD. It sounds immoral to me. But I was told it is not immoral in practice as the institute receives thousands of offers to fill up the seat you will be vacating.   Is doing the above seriously unethical?


I've looked at a few of these types of posts but can't seem to find a concrete answer. I am investigating the relationship between 'risk aversion' and 'human capital' for a project.  Risk aversion: Acceptable risk is used as a measurement and it takes a value between 10% and 100%, in increments of 10%. (I.E. 10 possible values where 10% = risk taker and 100% = risk averse). [DISCRETE]  Human capital: Represents the present value of all future earnings and depends on a number of factors including age, salary and occupation. [CONTINUOUS]  I performed a Pearson correlation between these two variables without really looking into the specifics too much. It finds a small negative correlation which is as expected.  However, I have since then read that the Pearson correlation is only designed to measure the correlation between two continuous variables and so I don't think I can use this result. Am I correct in saying this and if so how can I test this relationship (including significance).

I'd like to estimate the correlation between:  An ordinal variable: subjects are asked to rate their preference for 6 types of fruit on a 1-5 scale (ranging from very disgusting to very tasty) On average subjects use only 3 points of the scale.  A continuous variable: the same subjects are asked to quickly identify these fruits, which results in an mean accuracy for the 6 fruits.   Is Spearman rho the best method to analyze these data and/or are there other good methods I could consider?


I'm refactoring my ASP.net application from ASP.net 3.5 to 4.0. Also I'm changing the URLs to user friendly URLs /product.aspx?id=100 to /product-name/100.  All my pages are indexed by search engines and the site has already been online for 6 years. I'm planning to do 301 redirect from the old pages to the new one.  I want to make sure I won't lose the rankings and traffic.  Any suggestion how to do it properly?

I recently submitted a sitemap.xml in Google's Webmaster Tools and some of the pages already got indexed. The problem now is, that I cleaned my URLs with MOD_REWRITE in the .htaccess file afterwards and I would like the new ones to be indexed. The old ones should be removed from the Google Index.  Indexed Page:  www.example.com/article.php?=article=this%is%an%example   New URL:  www.example.com/article-this-is-an-example   Do I even have to remove them manually from the index in any way or do they refresh if Google crawls my new sitemap? I really wan't to prevent duplicate content.  Thanks in advance.


I am a US citizen. I just finished a French visa type D VLS-T "long séjour temporaire" student visa on February 27. I returned to the US and got an exit stamp.   I want to return to France (to visit friends) for 70 days starting April 1. I want to confirm that the 90/180 rules did not apply while I had a type D visa, even though it was a VLS-T not a VLS-TS. I think this is in article 6 of the schengen borders code.   I want to confirm this, but the French consulate is being vague and I'd really like a more clear answer as to how/why this is possible. Additionally, I am worried that a VLS-T may not have the same rights as a VLS-TS.   ****if anybody is wondering I got into the country no problem

I have a 1-year residence permit from one Schengen country that is now expiring. Upon its expiration, I would like to get my 90/180 days validity as a tourist to stay, or return here as soon as possible.  I understand that the tourist short-stay scheme is based on the 90/180 days "counter". But what happens if my previous stay was not tourism but residence (as searching year). Wouldn't that mean that I can quickly exit and re-enter the Schengen area to activate my tourist stay?   Also, is there a way to change this purpose of stay without exiting the Schengen area?


I am creating an Addon with Python and BPY, and I would want to have something like this:  How are these things called? Subpanels? I have been looking and couldn't find any info. I would like to know how to create them, I have a panel that needs to be better organized and I want it to have multiple "subpanels" with checkboxes so I can disable them like this one:

I'm trying to find out how to add a checkbox to a panel header so panel can be deacivated (as well as storing that checkbox value in some property). It may be quite obious task, but I didn't find any info about it in the docs so far.  Example of what I'm trying to achive is the "Gravity" panel, that can be turned off with the checkbox.    Any suggestions or leads? I would be grateful for any code examples with it.


A sample /etc/group file contains the following entries:  root:*:0: adm:!:4:logcheck antoine:x:1000:   The man pages I've read (Debian & OSX) says the second field is to store a group password.  As they are rarely used, an asterisk * or a x is usually placed in it rather than leaving it blank.  The shadow man page also says that this second field should store the result of the crypt function.  And if an invalid result is stored (such as * or !) it means the password cannot be used as authentication method.  Does that hold true for the group file as well?  Why do I end up with 3 different characters in my group file all having the same meaning?  Can I safely change all to *?


Let $a,b\in\mathbb{Z} \backslash \{0\}$. Show that  $a\mid b$, $b\mid a$ $\implies a=\pm b$.  I can see why this is true, but not write it down.

If $A|B$ and $B|A$ then prove $A=\pm B$   So far I have $A|B \iff AX=B$ and $B|A \iff BY=A$ with $X,Y \in \mathbb{Z}$  Not sure how to finish, any help.


Im having trouble understanding what << means in C. Im supposed to explain some code as a homework assignment, but it's kinda difficult to find an answer by googling.  It's related to programming a multi function shield connected to arduino (atmega328p chip)  Here's the line:  PORTB = ~(money << 2);

I've been attempting to learn C in my spare time, and other languages (C#, Java, etc.) have the same concept (and often the same operators) ...   What I'm wondering is, at a core level, what does bit-shifting (<<, >>, >>>) do, what problems can it help solve, and what gotchas lurk around the bend? In other words, an absolute beginner's guide to bit shifting in all its goodness.


First, this is a homework, StackOverflow has now different type of questions and I chose "I need help with a homework problem".  The program print all the prime numbers from range(k to n) from this expression:  ((1 + sin(0.1*i))*k) + 1, i = 1, 2, ..., N.   The code only works for the first test case. I get "Terminated due to timeout" on the 2nd and final case. The homework is uploaded to HackerRank, I don't know how to fix this. I did all the things that the task wants.  Constraints:  k <= 10^18  n <= 10^3       Input Format:      No more than 100 examples. Every example has 2 positive integers on the same line.      Output Format:      Print each number on a separate line.      Sample Input:      4 10      500 100      Sample Output:      5      17   #include <iostream> #include <cmath> using namespace std;  int main() {     long long k, n;     int j;     while (cin >> k >> n) {         if (n>1000 && k>1000000000000000000) continue;          int count = 0;         for (int i = 1; i <= n; i++) {             int result = ((1 + sin(0.1*i)) * k) + 1;             for (j = 2; j < res; j++) {                 if (result % j == 0) break;             }             if (j == result) count++;         }         cout << count << endl;      }     system("pause"); }

Which is the fastest algorithm to find out prime numbers using C++? I have used sieve's algorithm but I still want it to be faster!


I am a Dutch citizen and want to visit South Korea.  Do I need a visa?

I'm a national of country XYZ who wants to visit the state ABC for the purpose of tourism. How can I find out if I will need a visa?     NB: this is intended as a canonical/wiki question


I accumulate sequentially named files as the result of an automated process, and I would like to keep only the last 10 around. I tried this, which had the effect of deleting everything:  ls -r | more +11 | xargs rm  Apparently piping more +n causes the entire result to be piped, without regard to the +n argument.  What would be the correct approach?

I`m trying to delete old files from directory and leave only 3 newest files.   cd /home/user1/test  while [ `ls -lAR | grep ^- | wc -l` < 3 ] ; do      rm `ls -t1 /home/user/test | tail -1`     echo " - - - "  done   something is wrong with conditional statement.


I have the following table:     source_id bands duration     24 L BAND 0.215447   24 L BAND 0.00017   24 S BAND 0.00017   88 L BAND 0.215447   88 L BAND 0.00017   72 L BAND 0.00017     For every combination of "source_id" and "bands" values, I would like to output the entry with the longest duration, such that the output would be:     source_id bands duration     24 L BAND 0.215447   24 S BAND 0.00017   88 L BAND 0.215447   72 L BAND 0.00017     What would be the easiest and/or best way to achieve this?

My table is:     id home datetime player resource     1 10 04/03/2009 john 399   2 11 04/03/2009 juliet 244   5 12 04/03/2009 borat 555   3 10 03/03/2009 john 300   4 11 03/03/2009 juliet 200   6 12 03/03/2009 borat 500   7 13 24/12/2008 borat 600   8 13 01/01/2009 borat 700     I need to select each distinct home holding the maximum value of datetime. Result would be:     id home datetime player resource     1 10 04/03/2009 john 399   2 11 04/03/2009 juliet 244   5 12 04/03/2009 borat 555   8 13 01/01/2009 borat 700     I have tried: -- 1 ..by the MySQL manual:   SELECT DISTINCT   home,   id,   datetime AS dt,   player,   resource FROM topten t1 WHERE datetime = (SELECT   MAX(t2.datetime) FROM topten t2 GROUP BY home) GROUP BY datetime ORDER BY datetime DESC  Doesn't work. Result-set has 130 rows although database holds 187. Result includes some duplicates of home. -- 2 ..join  SELECT   s1.id,   s1.home,   s1.datetime,   s1.player,   s1.resource FROM topten s1 JOIN (SELECT   id,   MAX(datetime) AS dt FROM topten GROUP BY id) AS s2   ON s1.id = s2.id ORDER BY datetime   Nope. Gives all the records. -- 3 ..something exotic:   With various results.


#include <iostream> #include <array>   int main() {     std::array myArray { 7, 3, 1, 9, 5 };       // Iterate through the array and print the value of the elements     for (int i{ 0 }; i < myArray.size(); ++i)         std::cout << myArray[i] << ' ';       std::cout << '\n';       return 0; }  It is stated that There is a signed/unsigned mismatch. The size() function and array index parameter to operator[] use a type called size_type.  Our loop counter/index (variable i) is a signed int. Therefore both the comparison i < myArray.size() and the array index myArray[i] have type mismatches. I understand the statement, but what is the consequence of this mismatch? My IDE (VS2019) neither gives a error nor a warning. Are there any performance benefits from using std::size_t in place of int in this code? #include <array> #include <cstddef> // std::size_t #include <iostream>   int main() {     std::array myArray { 7, 3, 1, 9, 5 };       for (std::size_t i{ 0 }; i < myArray.size(); ++i)         std::cout << myArray[i] << ' ';       std::cout << '\n';       return 0; }

In several C++ examples I see a use of the type size_t where I would have used a simple int. What's the difference, and why size_t should be better?


Sorry if this question might seem suspicious - as a frequent traveler to Israel it's simply something I've always wondered about.  El Al has some well-known extra security methods for all flights to Israel, including operating their own additional baggage screening system, air marshals, etc. I believe Arkia and Israir do the same and that the Israeli government supplies the budget.  Are foreign airlines flying to Israel (Lufthansa, BA, etc) forced to also use these methods and screen passengers? Strangely although I've flown with foreign carriers and El Al many times I can't recollect how the experience differed - and would have no way of knowing about additional baggage screening.  If anybody has any information it would be nice to have my curiosity satisfied!

The one thing I hate about flying to Israel are the security checks at the origin airports. I don't mind X-rays and deep luggage searches, but there's also an annoying interview you have to "pass". The security folks can't really turn you down (especially since I'm a citizen), but they always make it a pain in the butt, because for some reason I fit their profile of a suspicious person.  Can I avoid the personal interviews if I book on a non-Israeli airline? Or perhaps a low-cost airline?


I have a list of 2-item tuples and I'd like to convert them to 2 lists where the first contains the first item in each tuple and the second list holds the second item.  For example:  original = [('a', 1), ('b', 2), ('c', 3), ('d', 4)] # and I want to become... result = (['a', 'b', 'c', 'd'], [1, 2, 3, 4])   Is there a builtin function that does that?


Find number of ring homomorphisms from $\mathbb Z_{12} \to \mathbb Z_{28}$.  This question has been asked before but I found the solution confusing.Please check whether my approach is valid.  A ring homomorphism satisfies $f(x+y)=f(x)+f(y);f(xy)=f(x)f(y)$  A ring homomorphism must first be a group homomorphism.  So $f$ will entirely depend upon its image on $[1]$.Now $o(f([1]))$ must divide both $12,28$.Hence $f([1])=0;f([1]=[7],f([1]=[14]$  But if we take $f([1])=[7] $ then it will fail to be ring homomorphism as $f[nm]=[7][nm]\neq [7m][7n]$  if we take $f([1])=[14] $ then it will fail to be ring homomorphism as $f[nm]=[14][nm]\neq [14m][14n]$  Thus only one available is $f([1])=[0]$ .Is it correct ?  Please help.

Question:      Find the number of non trivial ring homomorphisms from $\mathbb Z_{12}$ to $\mathbb Z_{28}$. ($f$ is not necessarily unitary, i.e., $f(1)$ need not be $1$.)    Suppose $f$ is a ring homomorphism from $\mathbb Z_{12}$ to $\mathbb Z_{28}$.  Consider $f$ as a additive group homomorphism.  Let $k= |\ker f|$ and  $ t = |\operatorname{im}(f)|$. Then $k\mid 12$ and $t\mid 24$ and $kt=12$, by first isomorphism  theorem of groups.  There are two possibilities $k=3$, $t=4$   and $k=6$, $t=2$.  For the first case $f$ should map $1$ to an element of the subgroup generated by $7$ as there is a unique subgroup of $\mathbb Z_{28}$ of order $4$ generated by $7$. For the second case $1$ has to map to $14$, for the same reasoning.  So there are at most two ring homomorphisms from $\mathbb Z_{12}$ to $\mathbb Z_{28}$. Question is how to check the possible maps which are ring homomorphisms.  Thanks.


I have a little console C# program like   Class Program  {      static void main(string args[])      {     } }   Now I want to do something after main() exit. I tried to write a deconstructor for Class Program, but it never get hit.  Does anybody know how to do it.  Thanks a lot

I have a console application that contains quite a lot of threads.  There are threads that monitor certain conditions and terminate the program if they are true.  This termination can happen at any time.  I need an event that can be triggered when the program is closing so that I can cleanup all of the other threads and close all file handles and connections properly.  I'm not sure if there is one already built into the .NET framework, so I'm asking before I write my own.  I was wondering if there was an event along the lines of:  MyConsoleProgram.OnExit += CleanupBeforeExit;


Using Python/Django on App Engine, is it possible for the creation of a Datastore record to cause a function to run?  I have more than one function that creates a record.  What I want is for every time any function creates a record of a certain Model, another function is run, without the function needing to be called from the code that originally created the record.

I'm having trouble wrapping my head around this.  Right now I have some models that looks kind of like this:   def Review(models.Model)     ...fields...     overall_score = models.FloatField(blank=True)  def Score(models.Model)     review = models.ForeignKey(Review)     question = models.TextField()     grade = models.IntegerField()   A Review is has several "scores", the overall_score is the average of the scores.  When a review or a score is saved, I need to recalculate the overall_score average.  Right now I'm using a overridden save method.  Would there be any benefits to using Django's signal dispatcher?


I suggested an edit for a question with a bounty on it. I stayed on the page, and saw the "An edit has been made to this page"-message coming in. I clicked on it. Then, the bounty message disappeared! This is front-end, with a refresh, the bounty message was there again.  Sadly, I didn't make a screenshot of it, but you can imagine what it would look like.  The question:

I've come across a small issue which occurs when a question has been closed but the question itself or one of its answers are being edited.  Steps to reproduce:   Visit a closed question. (even closed years ago)   In a different tab or browser, edit the question or one of its answers. "an edit has been made to this post; click to load" message will appear above the edited post in the first tab/browser, click it. The .question-status div becomes hidden, which includes the closed notice below a question and, for a duplicate-closed question, the list of duplicates above the question body. This gives the appearance that the question is no longer closed (until you refresh).   Some screenshots:                I know it isn't common/important but it did confuse me when looking at a particularly bad question - I thought it had been reopened.   Is this an intentional feature? If so, what was the thinking behind it?    Another example  Before    After


Ok, I've looked all over the place and I'm really stuck. I would like to have a panel with some input variables (like height and radius), which can be typed in. Then I would like a button that, when pushed, executes some python code (like creating a cylinder, moving it, put material on some of the vertices etc.) But it seems that variables and buttons need to be hooked up to specific operators, so I lose control over the input variables. Maybe I'm thinking too much like Visual Studios forms. I could really use help.

I was watching this  on making a custom UI tab using Python, and in the line from bpy.types import Menu, Panel, UIList, I see the names of objects that look like they can all be used to make different UI elements. Does bpy.types contain all the objects that people use when they want to make custom UI elements?