I'm trying to make a double linked list of objects in c++. So far I have a Node and DLinkedList class and they worked with integers, but when I tried to convert the type from int to object using the template I'm getting errors. I tried researching but I can't find a good example that uses a header and implementation file with the object template. Can someone help me out?  Here's my header file Node.h:  template <typename Object>  class Node {  public:     Node(const Object &data, Node next, Node prev);      Node(const Object &data);              const Object& getData();      Node* getNext();      Node* getPrev();       void setData(const Object &data);      void setNext(Node *next);      void setPrev(Node *prev);  private:      Object data;         Node *next;          Node *prev;   }; #endif   And this is my Node.cpp file:  template <typename Object> Node<Object>::Node(const Object &data, Node next, Node prev){     this->data = data;     this->next = &next;     this->prev = &prev; }  Node<Object>::Node(const Object &data){     this->data = data;     this->prev = nullptr;     this->next = nullptr; }  const Object& Node<Object>::getData(){     return this->data; }  Node* Node<Object>::getNext(){     return this->next; }  Node* Node<Object>::getPrev(){     return this->prev; }  void Node<Object>::setData(const Object &data){     this->data = data; }  void Node<Object>::setNext(Node *next){     this->next = next; }  void Node<Object>::setPrev(Node *prev){     this->prev = prev; }   These are the first few errors I'm getting:  Node.cpp:24:6: error: use of undeclared identifier 'Object' Node<Object>::Node(const Object &data){      ^ Node.cpp:24:26: error: unknown type name 'Object' Node<Object>::Node(const Object &data){                          ^ Node.cpp:24:15: error: extra qualification on member 'Node' Node<Object>::Node(const Object &data){             ~~^ Node.cpp:25:2: error: invalid use of 'this' outside of a non-static member   function     this->data = data;     ^   The rest of the errors are similar for the rest of the code. I don't understand why it's not recognizing Object when I defined it in the template. Any advice on how to fix this mess is appreciated!

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


Is there a way to include (or "inline") raw image data or pdf data inside the tex document itself, such that it becomes stand-alone? Something like this:  \inlinedata[base64]{theimage}{AJDeafg82asd34z8BNFKW(...more base64...)SKJWKUFr=} ... \includegraphics[width=0.5\linewidth]{theimage}   That would sure come very handy for some super-portable documents, where two or three small external images would too easily get lost. (Please try to keep the lectures why external resources are always so much better as brief as possible ;)

Friends, sometimes I had to create a self-contained PHP script. That means the PHP script could have any files within it due to some encoding/decoding algorithm, like Base64. For example,  is a Base64 encoding of this tiny image:   Of course, in this particular case, PHP can handle that huge encoded string because it has a bundled  function.  I was wondering if this idea is possible to achieve somehow in TeX/LaTeX. I need to point out that I'm just curious on this subject, not that I want to embed whatever in code. Besides, as you noted, the encoded string is huge, so that'd surely make people cry blood.  One possible solution I see is if somebody implement an encoding/decoding algorithm in TeX/LaTeX, like \base64_decode, so it would be possible to use something like this: \includegraphics{\base64_decode{\myhugeunreadablestring}}. Sorry for the acid trip ticket, but I'm really curious on how this insane code would work. =)


For  badge, users need     Edited 100 posts that were inactive for 6 months.   I can see my all  but, Is there any way to see how many edits of mine fits for Archaeologist badge?

I am trying to obtain more badges on Stack Overflow. For example, to gain Archaeologist I need to edit 100 inactive posts but I am not keeping track of the number of posts I've edited. For Deputy I need to raise 80 helpful flags, etc. How can I view all my statistics about the badges, such as how many more edits I need to do, etc. I'm not doing it for badges, but I can spend a bit more effort if I'm close to getting a badge.


What items can you retrieve intact if a creeper explodes in certain biomes? I usually get sand and grass. Can you also get sandstone and stone as well?

break: To turn the block into the little floating thing that you can pick up.  destroy: To completely obliterate a block, not even leaving a little floating thing.    Given those definitions, the question is very simple.  I had read about TNT mining , but when I tried it, it exposed a solitary diamond.  I thought this was odd because I'd never seen one block of diamond ore by itself before, which prompted this question:  Do explosions destroy stuff?


I am a novice, using Ubuntu 14,04.  I have tried to install Skype, and it does not work.  I need it installed, but I read all the suggestions, and they all refer to using some sudo commands in  what I believe is a DOS-like command prompt menu - and I cannot find anywhere to access that?  I am sure this is a trivial question thousands have asked before, so a simple direction to where this is explained would suffice for me as help.  I also realize that I need to know  what "distribution" my Ubuntu is, and if is 32 or 64 bit - where do I find that information?  Thank you in advance.

What is a terminal? How do I open a terminal window? How do I use the terminal?


Consider these sentences, please:  Try to complete the examination  He tried to climb a cliff.   Are the to-infinitives the objects of the verb try Or are they infinitives of purpose?

In written and standard semi-formal (and above) spoken English, one would use "try to":  Try to be a better person. Try to get the fishhook out of my thumb, please. Try to find a pharmacy when you need one.  But in spoken English, we (Americans, at least) usually substitute "try and" for all those cases. "Try to" makes sense because the "to" begins the construction of an infinitive: "try to be", "try to do", "try to act" and so on. "Try and" on the other hand doesn't seem to make any sense. I'm curious how the "try and" crept in, and when. It's really tough to Google small words like these, so I'm not finding anything on the Web. Is it a contraction of something like "Try hard, and ..."? Note: I've seen  and it is somewhat related but doesn't tell me what I want to know. Edit Observe how, even on this site,  construction. Turning it on its head Note that you can't make a negative construction with "try and":  It's raining. Try not to get wet. It's raining. Try not and get wet. [?]  Even adding do doesn't help. The following means something different from "try not to get wet."  It's raining. Don't try and get wet.  Even use of to instead of and there means something else:  It's raining. Don't try to get wet.  "Try not to get wet" means try to stay dry. "Don't try to get wet" means avoid actively seeking out a soaking, and implies that a soaking might in fact be what you are looking for. MORE I just happened to notice a video from an editor for Merriam-Webster on this very topic, so I include the link here: .


I'm probably overlooking something simple.  Given an instance of a class, I'd like to get just the class name.  For example:  class Foooo: pass instance = Foooo()  print("instance.__class__ = "+str(instance.__class__)) print("Just the class name: "+str(instance.__class__).split(".")[-1][:-2])   This gives the following output:  instance.__class__ = <class '__main__.Foooo'> Just the class name: Foooo   Is there something simpler than  str(instance.__class__).split(".")[-1][:-2]?   I'm in Python 3.2 if that helps...

How do I find out a name of class that created an instance of an object in Python if the function I am doing this from is the base class of which the class of the instance has been derived?  Was thinking maybe  might have helped me out here, but it doesn't seem to give me what I want. And short of parsing the __class__ member, I'm not sure how to get at this information.


The  shows a nice example of prepending a command prompt on every line of a shell input (page 317), but it apparently only works for the listings library. Is there a similar option for the minted library? I searched through the manual for minted, but the only option I found that might offer this option was the formatcom option… but I don't think that is going to work.   For the record, I would be fine with the output in , but I    can't figure out how to format this inside the definition for a \newtcblisting (color, font weight, etc.), and  don't want to have to include my prompt info on every line throughout my file.    My current MWE is as follows:   \documentclass{article} \usepackage{tcolorbox}   \tcbuselibrary{minted}  \newtcblisting{bashinput}[1][]{   listing engine=minted,   minted language=bash,   minted options={     fontsize=\small,     breaklines,     autogobble,     numbersep=2mm},   listing only,   ,#1}  \begin{document}  \begin{bashinput} user ~$ vi /etc/sysconfig/network user ~$ grep Dipole file-name -A1 | tail -n1 | awk '\{print \$8\}' \end{bashinput}  \end{document}   Ideally, I could just add a line after listing only, containing something like every listing line={\textcolor{red}{\small\ttfamily\bfseries  ~$}}

I'm writing a lecture with many source codes for example. The codes are stored in severus different files. I use listing and minted packages for formatting the sources.  I would like add character at the begin of every line of some codes like:   Bash shell ($ or #) Python shell (>>>) Matlab (>>) Other shells (>)   I tried some solutions which have given on:       But both solutions have the same problem when I try:  \begin{foo_environment}      \input{bar.txt}  \end{foo_environment}   In both solutions the linebreaking are ingnored  I have tried executing a bash command:  sed 's/^/$ /' bar.sh > bar.txt   This works locally but I can't do the same in  and   This is a sample code bar.sh:  cd .. mount /dev/sda3 /mnt/ cd ~/.ssh/ ll cd ~ ls -al   The result must be:  $ cd .. $ mount /dev/sda3 /mnt/ $ cd ~/.ssh/ $ ll $ cd ~ $ ls -al


Was running Windows 7 (64-bit). Downloaded Ubuntu, and booted it from USB Started installing Ubuntu OS. I chose the last option, do not replace Windows, do something else.  However, when I had to choose a partition, I ticked and formatted the one in which my Windows 7 was on.  After formatting, I cancelled installation.  So, I now have neither have windows nor Ubuntu.  When I switch it on, I just get the System Recovery options.   I cannot do that as I still have important files: pictures and videos (I am a photographer.)  Please tell me there is a way to get them back!

I have a Toshiba satellite A-200 laptop with a Vista OS on it with 4 NTFS partitions  (C:) Vista  (D:) Entertainment  (E:) Work  (F:) Sources   and I wanted to start using Ubuntu instead. So I tried it first from the live CD and everything was OK and all the partitions were shown and working and so I decided to install Ubuntu to replace Vista on the (C:) drive. After I did that I can no longer find my folders and files on the (D:), (E:), (F:) partitions and the only file system that is shown is one 198 GB although my HDD is 320 GB.  I can't access the lost data on the remaining 120 GB which I hope is still there and not totally lost  I am now working from the live CD but I am unable to install testdisk. Can I recover the Vista partitions by the product recovery CD to get my laptop back to the factory settings? Can I recover the NTFS partitions using a recovery program for Windows or will that make the problem worse?   I need these data badly as I don't have a backup for them.


So some stuff happened and my hard drive was completely wiped out, I previously had a dual boot system between windows 10 and Ubuntu, I would like to do the same now. What I would like to know is which would be easier? Installing Ubuntu first and then Windows or vice versa? Also is it better to make partitions and install or install both of them together?

I'd like to install both Ubuntu 12.04 and Windows XP on a Dell laptop, and I was thinking about using a dual boot structure, and using the bulk of my hard drive as empty hard drive space to share files between the two operating systems (so choice of file system type is very important in this set-up).     The kind of partitioning structure I would like to use is  Partition 1 - Ubuntu 12.04 (root) (20GB)  Partition 2 - Ubuntu /home        (20GB)  Partition 3 : Free Space          (560GB)  Partition 4 : Windows XP          (35GB)  Partition 5 : SWAP                (3GB)  (Total Hardrive Capacity is ~640GB)    My question is; what is the best way to go about setting up this kind this system?   Should I install Windows XP first and setup the partitions, and then install Ubuntu which I believe will install the GRUB bootloader for OS booting choice   or   Do I install Ubuntu first, setting up the available partitions and then perform a WIndows install?  Please let me know if there is anything in this setup that I have left out and should know about, including things related to setting particular partitions as logical or primary, and whether the boot partition and the filesystem partition should actually be two separate partitions.


The most frequent off-topic site that I choose is DBA, but probably second most common is programmers. For me, the distinction between SO and programmers is clear, but I can understand why so many SO questions are off-topic and belong on programmers - which is all the more reason to add it to the quick-pick list of "other" sites.  Adding programmers to the "other sites" list would:   advertise its existence (lack of awareness that programmers exists is probably why questions hit SO) make its purpose better understood (the short description would be read more often) get selected enough times (for the right reasons) to warrant its inclusion  save me having to go via "flag", then "other" and type in "please migrate to programmers"   And why are there only 5 sites? If superuser is a choice, surely programmers should be too - they're about equidistant from SO IMHO  And why is TeX there? I rarely see questions about LaTex etc.

I think there should be more Stack Exchange networks available when flagging a question to be migrated. For example I'd think that the following question:    ...would be a better fit on unix.stackexchange.com instead of Stack Overflow. But without the option to mark it so, I feel hesitant to mark it.


I got pretty bad Gre sub score,which is 51%. I am applying a couple of graduate programs in math, but most of them are masters. So should I send my Gre sub score to those who strongly recommend it ?(but not required) My other information:I come from a pretty good public schools, but not famous for math, GPA is 3.67, two REUs, and I guess my three letters are good.   Thanks !

I recently received my Mathematics GRE subject test score of 650 ( 48%). I know this score is miserable but in my country, I have the option to retake the GRE next year October only.  Assuming otherwise I have a strong profile (with achievements in other examinations in my country and some research experience ) Should I be reporting this score to universities where it is not mandatory (but highly encouraged) to submit Math subject GRE scores? I mean will this score weaken my application?  Before this score, I was thinking of applying to universities like Upenn, Penn State etc but feel really nervous about my admission prospects now..


I been getting this problem in terminal now for a day. I have tried fixing read many guides and nothing. I am new to ubuntu any help will be appreciated. "14.04 lts"  E: Could not get lock /var/cache/apt/archives/lock - open (11: Resource temporarily unavailable) E: Unable to lock directory /var/cache/apt/archives/   also have this data.  /var/lock /var/cache/apt-xapian-index/index.1/flintlock /var/cache/software-center/xapian/flintlock /var/lib/alsa/asound.state.lock /var/lib/apt-xapian-index/update-lock /var/lib/dpkg/lock /var/lib/dpkg/info/libfile-fcntllock-perl.list /var/lib/dpkg/info/libfile-fcntllock-perl.md5sums /var/lib/dpkg/info/liblockfile-bin.list /var/lib/dpkg/info/liblockfile-bin.md5sums /var/lib/dpkg/info/liblockfile1:i386.list /var/lib/dpkg/info/liblockfile1:i386.md5sums /var/lib/dpkg/info/liblockfile1:i386.postinst /var/lib/dpkg/info/liblockfile1:i386.postrm /var/lib/dpkg/info/liblockfile1:i386.shlibs /var/lib/dpkg/info/lockfile-progs.list /var/lib/dpkg/info/lockfile-progs.md5sums /var/lib/dpkg/info/python-lockfile.list /var/lib/dpkg/info/python-lockfile.md5sums /var/lib/dpkg/info/python-lockfile.postinst /var/lib/dpkg/info/python-lockfile.prerm

I get this error when trying to use apt-get:  E: Could not get lock /var/lib/dpkg/lock - open (11 Resource temporarily unavailable) E: Unable to lock the administration directory (/var/lib/dpkg/) is another process using it?     How can I fix this?


I have problem with picture. Look position of picture in code and where overleaf put picture \documentclass[a4 paper, 12pt]{article} \usepackage{pgfplots} \setlength{\baselineskip}{17pt} \usepackage{geometry} \usepackage[croatian]{babel} \usepackage[utf8]{inputenc} \usepackage[unicode]{hyperref} \usepackage{floatrow} \usepackage[final]{pdfpages} \geometry{a4paper, left=25mm,right=20mm,top=25mm,bottom=25mm} \usepackage{multirow} \usepackage{tabularx,ragged2e,booktabs,caption} \usepackage{amsmath} \usepackage{amsthm} \usepackage{amssymb} \usepackage{amsfonts} \usepackage{pgfplots} \usepackage{graphicx} \usepackage{siunitx} \usepackage{mathtools} \usepackage{chngcntr} \usepackage{tikz} \usetikzlibrary{datavisualization} \usetikzlibrary{datavisualization.formats.functions} \counterwithin{figure}{section} \counterwithin{table}{section} \usepackage{enumitem} \usepackage{subfig} \usepackage{array} \usepackage{lipsum} \graphicspath{{images/}} \theoremstyle{plain} \newtheorem{defn}{Definicija}[section] \newtheorem{nap}{Napomena}[section] \newtheorem{thm}{Teorem}[section] \newtheorem{prop}{Propozicija}[section] \newtheorem{krl}{Korolar}[section] \newtheorem{lema}{Lema}[section] \theoremstyle{definition} \newtheorem{pr}{Primjer}[section] \numberwithin{equation}{section} \begin{document}  \noindent gdje je $\phi$ funkcija gustoće standardne normalne slučajne varijable:  $$\phi(x) = \frac{1}{\sqrt{2\pi}}exp\left(-\frac{1}{2}x^2\right).$$  Vidimo da su formule za Gammu jednake za call i put opciju. U sljedećem primjeru prikazati ćemo rezultate za $\Gamma$ i $\Gamma_{P\&G}$ za pojedine promjene cijena dionice. \begin{pr} Neka su dani sljedeći parametri $S_0 = 1000$, $K = 1000$ kuna te neka su $r=2\%$, $\sigma=0.2$ i $\tau=1$ godina. Promotrimo rezultate za te parametre ukoliko su se dogodile sljedeće promjene cijena dionice:   \begin{center} \begin{tabular}{  c | c | c | c | c | c | c }    S & 850 & 900 & 950 & 1000 & 1050 & 1100 \\ \hline   \Gamma & 0.0019452 & 0.0021011 & 0.0020964 & 0.0019552 & 0.0017214 & 0.0014424 \\ \hline   \Gamma_{P\&G} & 43.77 & 21.01 & 5.24 & 0 & 4.30 & 14.42 \\ \end{tabular} \captionof{table}{Vrijednosti $\Gamma$ i $\Gamma_{P\&G}$ za različite početne vrijednosti dionice} \label{tab:gamma} \end{center} \end{pr}  \begin{figure}[]     \centering     \includegraphics[width=10cm]{s2.png}     \caption{An image of a galaxy}     \label{fig:galaxy} \end{figure}  Prethodno smo zaključili da je Gamma jednaka za call i put opciju. Iz tablice za vrijednosti $\Gamma$ vidimo da njegov graf ima zvonoliki oblik. Najveća vrijednost za Gammu je u slučaju kada je cijena dionice manja od cijene izvršenja $K$. Također možemo primjetiti kako velikom promjenom cijena od početne cijene dionice stvaramo sve veće profite.         \end{document}

How to influence the position of float environments like figure and table in LaTeX?   This is a general question and should collect useful answers for all users. I hope we can use this as a reference


Why is a return flight from JFK to Brussels a 1000 euros and a return flight from Brussels to JFK 500 euros?   My girlfriend is American and I'm Belgian so we fly over a lot. Every time she wants to come see me she ends up paying roughly double of what I'm paying. And this is for every single time of the year, why is this?

I had planned for my wife, daughters and I to take a holiday from our home in China to the UK for a few weeks in July. Usually, when people visit us in China from the UK, the cost is around £450 to £500 for a return flight. Looking online, I can see that such tickets are available. However, when I looked at the flights from China to the UK the costs for return tickets were in the £850 to £1,000 range.  This seems unfair. Buying the same ticket on the same airplane results in vastly different prices depending on your origin. What justification is there for airlines to charge double the price for return flights from China to the UK and back as for the return flights from UK to China and back?  As it stands this will end our vacation plans as the cost has gone from an expensive £2000 trip for the family to an astronomical £4000 trip, equal to my entire years salary.


What is a term which refers to the areas in the back or rear, with the same scope as the word "frontal"?  The satirical/humorous term backal exists, but is not really a word (or appropriate to use in writing).

When we lie down, the "back part of the body" is in contact with the bed. It includes the heels, the calves, the backside, the back, and the back of the neck, and the back of the head etc.  How do we refer to the entire "back part" of the body?


This is a question about blender’s interface and the way it looks, with no functional difference. I have windows 10, and when switching from blender 2.79 to 2.80 regardless of the machine, the curvy node connector lines for the shader and compositor became straight and boring. However, I keep seeing screenshots on Stack Exchange of users that obviously have 2.80+, but they have the nice curvy connector lines. How is this done?

Unitl now I haven't found the option to enable the curved representation of connectors between nodes. The  doesn't mention such an  option. Is there a keyboard shortcut?


What is the maximum disk space required for the complete installation of Ubuntu 14.04 ?  And what are the minimum system requirements for butter smooth working of the OS ?

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’ve always been asked by my Filipino friends how I should say the Filipino question “Pang-ilan ka sa magkakapatid?” in English.  You ask that question when you want to know whether someone is the eldest, second, third...or youngest child in the family. What’s the shortest way to ask such question without necessarily mentioning choices (eldest, second, etc.) as the Filipino question also does not mention the choices?

I want to make a question having an answer as follows:     5 is the third prime number.   The bold part is the answer. How to phrase the question?


I am really struggling with the concept and handling of the Green's function. I have to solve the given differential equation using Green's function method $$\frac{d^{2}y}{dx^{2}}+k^{2}y=\delta (x-x');\qquad y(0)=y(L)=0$$

I am really struggling with the concept and handling of the green's function. I have to solve the given differential equation using Green's function method $\frac{d^{2}y}{dx^{2}}+k^{2}y=\delta (x-x');y(0)=y(L)=0$


My minor daughter is traveling by herself internationally, leaving from Boston's Logan airport.  It's the first time she's traveled via air on her own, and I'd like to go with her to her gate (past security) to make sure she doesn't have any hassles.  I've seen some indications that it's possible to do this, but I've not had any luck figuring out how to do it.  Is this possible?  If so, how? Do I need the airline to OK it? TSA? Someone at Massport?  --  Closed, and the dupe helped me.  The airline is United, and they explicitly say on their website (I was missing the key phrase "gate pass" in my searches):

As of quite awhile back you're not able to meet people at the gate of the arriving flight. However, I've come across certain sites like , which offers a concierge service that supposedly allows an agent of the company to meet the client at the gate or even on the tarmac and help them through the Immigration and Customs this one specifically in JFK but they offer similar service in other major New York Area airports.  VIP TARMAC Additionally, we have tarmac service available that would allow a passenger to de-board the plane directly onto the tarmac where their luggage will be loaded into a private car, taken to a private immigration area, and then dropped with a Churchill Executive Cars driver outside the terminal to take them to their final destination. VIP ARRIVALS On arrivals, we will have a Churchill Executive Cars Agent meet the passengers at the gate when they de-board the airplane. The agent will have a sign with the passenger's name and Churchill logo and have a baggage porter ready to carry their carry-on bags. The agent will then whisk them through fast-track immigration and customs, and pass the passengers along to the Churchill Executive Cars driver to be taken to their final destination.  Now if this is true there is a way for someone to have clearance to go airside to meet a person but I was unable to find any references on how such a clearance can be attained. So is this real?  And can this be done by an Average Joe?


If $f$ is a continuous function that satisfies $$f(\frac{x+y}{2})\leq \frac{f(x)+f(y)}{2},$$ then $f$ is a convex function.  I tried to prove it by contradiction but I didn't get the desired result. Any help is welcome

Given that $$f\left(\frac{x+y}{2}\right)\leqslant \frac{f(x)+f(y)}{2}~,$$ how can I show that $f$ is convex. Thanks.      Edit: I'm sorry for all the confusion. $f$ is assumed to be continuous on an interval $(a,b)$.


I have a small problem at work. Our DBA went on a journey of self-discovery ... I am very happy for him and I hope he finds what he is looking for. But he left us without any information about how the database he created works, the triggers he has, the connections between tables and, frankly, no documentation.  My question is whether it is possible to export all the information from the database (connections between tables, schema, triggers, fields with data type, etc .. :) in a file from TOAD or another application to mount it in some application that would reverse engineer the database to indicate that same information that we need.  I thank you very much for the help you can give me!

I find that most of my clients are not documenting their databases at all and I find that pretty scary. To introduce some better practice, I would like to know what tools/process people are using.   How do you document your database? (SQL-Server)  What tool do you use?  Documentation Storage Format for database schema/meta-data?   Word documents Excel spreadsheet Plain Text  Documentation process or policies?   I am not talking about reverse engineering / document a existing database, but mainly on the documentation best practices while you develop your system/database.


I was defrosting fish and forgot about it.  It has been left out for a long time.  How long can fish actually be left out before it goes bad?

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


I keep getting a nullpointerexception when I try to sort users where a certain user has a null value in his profile. I was under the impression Google Collection would handle these null values, but it doesnt seem to work.  This is the code I use:  Comparator<UserModel> firstName_comparator = new Comparator<UserModel>() {     @Override     public int compare(UserModel c1, UserModel c2) {         return c1.getProfile().getFirstName().toLowerCase()                 .compareTo(c2.getProfile().getFirstName().toLowerCase());         }  };  Collections.sort(users, Ordering.from(firstName_comparator).nullsLast());     This specific line throws the nullpointerexception:  .compareTo(c2.getProfile().getFirstName().toLowerCase());   Its because getProfile() is null. How can I fix this? I want to be able to sort my users with null values.

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'm very new to Java. Trying to access a field in the HashMap observationMap, and am told there is a NullPointerException when I check if the HashMap contains the key. In particular, in the getEventSpeed() method.  .containsKey() should return NULL, so not clear how this line causes issue for the if statement?   Thank you for your help  public class IsDrivingObservation {    private Map<String,String> observationMap;    public String getEventSpeed() {     if (observationMap.containsKey("eventSpeed")) {       return observationMap.get("eventSpeed");     }     return "foo";   }    public void setEventSpeed(String speed) {     observationMap.put("eventSpeed", speed);   }  }


The question as stated above, is "Will any massless particle/object in the vacuum of space always travel at the speed of light?"

I suppose there was a discussion already on .  But I silly wonder whether all the massless mediators of four fundamental forces, i.e.  Graviton: $g_{\mu\nu}$ (gravity)  Photon $\gamma$: $A_\mu$ (electromagnetism)  Gluons: $A_\mu^a$ (strong interactions)  Necessarily travel at the same speed? Is there a no-go theorem or theoretical proof to say that it is impossible to have these three mediators have different speeds?   Or does QCD confinement makes the story of gluons any different from gravitons and photons?  [ps. excluded massive $Z^{0}$ and $W^{\pm}$ bosons (weak interactions)]  Another way to say this: Speed of photon, graviton, gluon all equal to $c$? or  Whether all massless particles necessarily have the same speed?  Note add: Notice however, in condensed matter systems, there can be emergent gauge fields and emergent massless particles (Dirac or Weyl cones), but their speeds need not be the same, unless there is some emergent symmetry...


Currently I like to start a terminal without mouse moves by   Alt-F2 type in gnome-term press TAB to get gnome-terminal auto-completion Enter to start a terminal   However, this approach always provides a terminal that is not in fullscreen mode and has a menubar. Is it possible to change this behavior while keeping the simple steps described above?  Update:  There are two related questions  and , but they are not as simple as I want: NO MOUSE MOVE and TAB completion. (I'm not sure if Compiz will do these, but I personally think installing Compiz doesn't seem to be a clean and simple solution)

I want to tell compiz, metacity, the gnome-terminal or whoever is in charge to open the terminal window maximized by default.  How can I do that?  EDIT for the future: most of the answers were upvoted in older ubuntu versions, since 17.10 and on the most upvoted solutions do not work.


How do I make it so all traffic is directed for the entire site and all subdirectories from non-www to www.  Here is my .htaccess contents:  RewriteEngine on  <IfModule mod_suphp.c> suPHP_ConfigPath /home/vivalast <Files php.ini> order allow,deny deny from all </Files> </IfModule>  RewriteCond %{HTTP_HOST} ^example.com$ RewriteRule ^(.*)$ "http\:\/\/www\.example\.com\/$1" [R=301,L]

This question is here so we can offer users who are looking for information on how to make one or more common or basic redirects in Apache using the htaccess file. All future questions pertaining to finding information that is that is covered by the question should be closed as a duplication of this question. .  Whats the point in this question? The idea while not perfect is catch the most commonly asked questions regarding redirects using the  htaccess on the Apache platform either on  some type of lamp or a live server. The type of answers should be generally those that you could imagine are used by 100,000’s of sites world-wide and are constantly asked here at Pro Webmasters repeatedly over and over in various forms.  A few examples of the type of answers we are looking for:   How can I redirect non-www to www? How can I redirect a sub domain to the main domain? How can I redirect a sub folder from domain to a root or a subdomain?  How can I redirect an old URL to a new URL?   A few examples of the types of answers that we are not looking for:   Answers that do not involve a redirect. Any answers relating to NGinx, IIS or any other non-Apache platform. Answers that involve custom and complex string or query removals.   Resources for Advanced to Complex Mod_Rewrite Rules:      Please note: that this question is still in construction and may need some refining either by myself or a real moderator of Pro Webmasters, if you have any concerns or questions .


Does $\lim_{n \to \infty}  a_n = \alpha$   imply $\lim_{n \to \infty} \left(1+ \frac {a_n}{n} \right)^n =e^\alpha$? I'm only considering real value and also, does the value of $\alpha$ makes a difference?\ I tried considering $$\left|\left(1+ \frac {a_n}{n} \right)^n-e^\alpha\right|\leq\left|\left(1+ \frac {a_n}{n} \right)^n-\left(1+ \frac {\alpha}{n} \right)^n\right|+\left|\left(1+ \frac {\alpha}{n} \right)^n-e^\alpha\right|$$ I know that for any fixed $\alpha$, $\left|\left(1+ \frac {\alpha}{n} \right)^n-e^\alpha\right|$ tends to zero. But I don't know how to deal with $$\left|\left(1+ \frac {a_n}{n} \right)^n-\left(1+ \frac {\alpha}{n} \right)^n\right|$$, I tried binomial expansion but didn't get anywhere. Is this where the value of $\alpha$ come to matter？ Thanks

I have seen a proof that shows $$\lim_{n\to\infty} \left(1+\frac{x}{n}\right)^n = e^x$$ by looking at the Taylor series expansion of $\ln(1+x)$ at $x=0$. To prove a theorem, my textbook uses the fact $$\lim_{n \to \infty} \left(1+\frac{a_n}{n}\right)^n = e^a$$ when $a_n \to a$. How can I prove this?


I want to restrict myself to polynomials with real-valued coefficients and consider only real-valued roots (so, in this context, for instance, a 2nd degree polynomials sometimes cannot be factorized).  In this context, can a 4th degree polynomial always be factorized in two 2nd-degree polynomials ?  Or is it possible to come up with a 4th degree polynomials which could not be factorized into any real-coefficients polynomials ?  (and - this maybe should be the object of a further question - but could we extend this property to all even degree polynomials ?)

So I understand how to do integration on rational functions with a linear and a quadratic denominator, and I understand how to do a partial fraction decomposition, but I was wondering what happens if the polynomial is higher degree and can't be factored. Later in the page, it says this:     However, it can be shown that any polynomial with real coefficients is a product of linear and/or irreducible quadratic factors with real coefficients.   And I was wondering, how do we know this and is this definitely true?


My app is getting crashed due this error        Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.String android.os.Bundle.getString(java.lang.String)' on a null object reference   Now I know this is caused by some null reference but I'm Not able to figure it out, here's where exactly the problem happen, after pressing the alert key   beforeGenerate.setPositiveButton("Confirm", new DialogInterface.OnClickListener() {         @Override         public void onClick(DialogInterface dialog, int which) {  //------------------- This code is for generating the qr image----------------------              String studentId = String.valueOf(takeText.getText());             int dimension = 200;             QRCodeEncoder qrCodeEncoder = new QRCodeEncoder(studentId, null, Contents.Type.TEXT,                     BarcodeFormat.QR_CODE.toString(), dimension);     String fileName = "studentID";             try {                 Bitmap bitmap = qrCodeEncoder.encodeAsBitmap();                 ByteArrayOutputStream bytes = new ByteArrayOutputStream();                 bitmap.compress(Bitmap.CompressFormat.JPEG, 100, bytes);                 FileOutputStream fo = openFileOutput(fileName, Context.MODE_PRIVATE);                 fo.write(bytes.toByteArray());                 fo.close(); // going for next activity and show QR             Intent i = new Intent(idEnterActivity.this, showQR.class);             startActivity(i);             } catch (Exception e) {         }         }     });   I'm trying to go to this activity   public class showQR extends ActionBarActivity {  public void onCreate(Bundle savedInstantState){     super.onCreate(savedInstantState);     setContentView(R.layout.activity_show_qr);     Context context = this;     Intent i = getIntent();     String fileName = i.getExtras().getString("fileName");     try {         Bitmap bitmap = BitmapFactory.decodeStream(context                 .openFileInput(fileName));         ImageView gg = (ImageView)findViewById(R.id.qrCode);         gg.setImageBitmap(bitmap);     }     catch(Exception e){      } }   }  this is my manifests file   <?xml version="1.0" encoding="utf-8"?>     <application     android:allowBackup="true"     android:icon="@drawable/ic_launcher"     android:label="@string/app_name"     android:theme="@style/AppTheme" >     <activity         android:name=".splach"         android:label="@string/app_name" >         <intent-filter>             <action android:name="android.intent.action.MAIN" />              <category android:name="android.intent.category.LAUNCHER" />         </intent-filter>     </activity>     <activity         android:name=".Main"         android:label="@string/app_name" >     </activity>     <activity         android:name=".idEnterActivity"         android:label="@string/title_activity_id_entet" >     </activity>      <activity         android:name=".showQR"         android:label="@string/abc_action_bar_home_description">     </activity>  </application>     I'm newbie in programming, so please tell me what I'm messing :)  EDIT  That's the rest of logcat from   Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.String android.os.Bundle.getString(java.lang.String)' on a null object reference         at impresesnt.abedbayoun.impresent.showQR.onCreate(showQR.java:22)         at android.app.Activity.performCreate(Activity.java:5933)         at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1105)         at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2251)         at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2360)


As like while teaching when such sentences come in front and we teach about using shall with I. Students come up with their books & guides to show as there is 'will' mentioned for answer this question. Please help to teach well. Thank you

Which is the correct use of these two words, and in which context should one be used rather than the other?


How to compute the following integral?   $$\int_{0}^{\infty} \exp(in\omega t-\gamma^2 t^2)dt$$   Please help me.

I am struggling to show that $$\frac{1}{\sqrt{2\pi}} \cdot \left(\int_{- \infty}^{\infty} e^{itx} \cdot e^{-\frac{1}{2}x^2 } dx \right) = e^{-\frac{1}{2}t^2}$$  In the same paper we defined  $$F(t):=\left(\int_0^t e^{-x^2}\right)^2 \quad \text{ and} \quad  G(t):=\left( \int _0^1\frac{e^{-t^2(1+x^2)}}{1+x^2} \right)$$  I showed that both functions are differentiable with  $$F'= 2e^{-t^2} \cdot \int_0^t e^{-x^2}$$ $$G' = -2te^{-t^2} \cdot \int_0^1 e^{-x^2t^2}$$  It follows that $F' + G' = 0$ and $F + G = \frac{\pi}{4}$  With that I showed that $\int_{-\infty}^{\infty} e^{-x^2} = \sqrt{\pi}$.  Any help is appreciated.


I want to calculate the integral over $$A=\{ (x,y): \frac{x^2}{a^2} + \frac{y^2}{b^2} \leq 1 \}$$  When I solve that equation for y, I get:  $$ y\leq b\sqrt{1-\frac{x^2}{a^2}}$$  But how can x be bounded, when I integrate y in this way at first?

Given $$\frac{x^2}{a^2} + \frac{y^2}{b^2}=1$$ where $a>0$, $b>0$ I tried to make $y$ the subject from the equation of the ellipse and integrate from $0$ to $a$. Then multiply by $4$ since there are $4$ quadrants. $$Area=4\int^a_0\left(b^2-x^2\left(\frac{b^2}{a^2}\right)\right)^\frac{1}{2}dx$$ I can't get the answer $\pi ab$


I am receiving a List<Fruit> of unkown size, usually between 4-10 items:  { Apples, Orange, Pear, ?, ?, ... }     How can I weight the List in a way that Apples have the highest % chance of being selected, then Orange, then Pear?   The effect should essentially be the same as picking a random item from a List that looks like this:  { Apples, Apples, Apples, Apples, Orange, Orange, Pear }   If the List was of a fixed size, I would've done    Generate a float between 0.0-1.0; If < 0.4, return Apples. Else if < 0.75 return Orange etc.   Note that this question is not about  but about weighting an existing List of arbitrary length in a way that a random pick will result in an Item's probability of being picked proportional to its position in the List.

Consider the class below that represents a Broker:  public class Broker {     public string Name = string.Empty;     public int Weight = 0;      public Broker(string n, int w)     {         this.Name = n;         this.Weight = w;     } }   I'd like to randomly select a Broker from an array, taking into account their weights.  What do you think of the code below?  class Program     {         private static Random _rnd = new Random();          public static Broker GetBroker(List<Broker> brokers, int totalWeight)         {             // totalWeight is the sum of all brokers' weight              int randomNumber = _rnd.Next(0, totalWeight);              Broker selectedBroker = null;             foreach (Broker broker in brokers)             {                 if (randomNumber <= broker.Weight)                 {                     selectedBroker = broker;                     break;                 }                  randomNumber = randomNumber - broker.Weight;             }              return selectedBroker;         }           static void Main(string[] args)         {             List<Broker> brokers = new List<Broker>();             brokers.Add(new Broker("A", 10));             brokers.Add(new Broker("B", 20));             brokers.Add(new Broker("C", 20));             brokers.Add(new Broker("D", 10));              // total the weigth             int totalWeight = 0;             foreach (Broker broker in brokers)             {                 totalWeight += broker.Weight;             }              while (true)             {                 Dictionary<string, int> result = new Dictionary<string, int>();                  Broker selectedBroker = null;                  for (int i = 0; i < 1000; i++)                 {                     selectedBroker = GetBroker(brokers, totalWeight);                     if (selectedBroker != null)                     {                         if (result.ContainsKey(selectedBroker.Name))                         {                             result[selectedBroker.Name] = result[selectedBroker.Name] + 1;                         }                         else                         {                             result.Add(selectedBroker.Name, 1);                         }                     }                 }                   Console.WriteLine("A\t\t" + result["A"]);                 Console.WriteLine("B\t\t" + result["B"]);                 Console.WriteLine("C\t\t" + result["C"]);                 Console.WriteLine("D\t\t" + result["D"]);                  result.Clear();                 Console.WriteLine();                 Console.ReadLine();             }         }     }   I'm not so confident. When I run this, Broker A always gets more hits than Broker D, and they have the same weight.  Is there a more accurate algorithm?  Thanks!


I have noticed that ~/.zprofile and ~/.zlogin are only loaded (in my computer) when I use a login shell, but when I login with gdm, they are not run; ~/.profile is ran instead. Is this normal?

I recently switched from terminal prompt login (getty?) to GNOME Display Manager. It  that GDM always reads .profile, regardless of user's setting of login shell (Zsh in my case). Why is that? I assume it's hardcoded in , but I can't find. Why did they do that? Does the software depends on some functionality of Bourne shell?  This is not very good if I want to use both GDM and getty (as fallback), because I then need to keep my .profile and .zprofile in sync. I'm not so confident about sourcing .profile in .zprofile (I met some compatibility issues before, when I tried to source .bashrc in .zshrc). I think Bash called as /bin/sh behaves in POSIX mode, but I'm not sure whether it avoids all the pitfalls.  In case it matters, I'm on latest Arch Linux, running GNOME with Wayland (so there should not be any Xsession script involved).


I need to be able to access the working area of the primary monitor using C# in WPF. I am looking for a solution that does not utilize the System.Windows.Forms namespace. I assume that this would require some sort of wrapper around a Win32 call.  Edit: Forgot to mention that I also need to get left/top of the primary monitor.

What I am looking for is the equivalent of System.Windows.SystemParameters.WorkArea for the monitor that the window is currently on.  Clarification:  The window in question is WPF, not WinForm.


This short story (possibly published in Asimovs or Fantasy and Science Fiction, but not certain) involves explorers encountering a tribe that worships the local jungle as a god. They do so by taking a drug that slows them down so much they move and perceive at the same subjective rate as the growing plant life. This creates a situation where the jungle can attack them by growing vines towards them. So the jungle is not moving faster, the people are moving far slower than normal.   Publication time frame is before 1990, but it could easily be from much earlier.   Language: English

I'm looking for the title of a short story by Ursula Le Guin about a scientist (?) who is given a drug that slows the timescale of his perception enormously, so that he can perceive that an alien (?) forest is actually behaving as a sentient being, reacting to current events, but at an enormously slow (from a normal human point of view) timescale. It might be in , but I don't remember the title (and it doesn't jump out at me from the list of titles) and don't have access to that collection right now. It is not "The Word for World is Forest", nor "Direction of the Road" (from ), nor "Vaster than Empires and More Slow", the latter two of which look at similar plant perception/time-scale issues. Update: it turns out that the description was right, but I had most of the details wrong: not Le Guin, not alien, not a scientist ...


When I set up a site on my server I set permissions to /var/www/ like so:  chown -R $USER:$USER var/www/   However, when I try and write to my image directory I get a permission denied error. The only way I have found is setting the permissions like this:  chown -Rf www-data.www-data /var/www/   So this fixes that problem, but creates another one. Now I cannot save any files to my server via ftp on my ide.   I'm a bit new to this and don't fully understand the difference between the two ways of setting permissions. Any help would be appreciated.   EDIT Not a dupe. I've done my research. This is not an issue about using sudo in /var/www. I'm getting permission denied errors when generating and trying to save images to a specific directory using GD Lib.

I want to stop having to use sudo everytime I work in /var/www. How can I do that? I simply want to put all of my sites into this directory and work with them without too much pain.


Is it correct to use a double “that” in a sentence? For example, I saw the following sentence in a book, and wondered whether it is correct:     If I do nothing else in Wallace, I want to teach my girls that that they can accomplish anything boys can do if they work hard and dedicate themselves to achieving goals.

Have you ever had a case where you felt compelled to include strange things like a double that in a sentence? If so, then what did you do to resolve this?  For me, I never knew whether it was acceptable grammar. However, what I did learn was that it was a logic distractor, could lead to confusion, and therefore should be reworded to avoid this.


I plan to travel to Jamaica after my contract I work on the ship. Can I use my C1/D to transit through the USA in New York to go to Jamaica?

I'm not a resident of USA. But I work on a cruise ship which required me to have C-1/D visa. I am leaving USA and traveling to Mexico but I will have a connecting flight somewhere in another US airport with 1-2 hours waiting for connecting flight to Mexico.   Do I need B1/B2 visa for that? Or my transit visa C-1/D will be enough as long as I am leaving USA?


I am a Android greenhorn, and seems like there are a lot of jargon that float around. Example:  Android OS Android Kernel Rooting Recovery Partition ROM Boot locked BIOS SIM Locked stock android   etc.  Could any one point me to resource(s) that would clarify these core concepts to me? I am not looking for easy answers; but rather I need right approach to read and understand these concepts.

What is the difference between:   Unlocking the bootloader (prerequisite for doing many, though not all, other things below) Rooting Jailbreaking ROM NAND and Nandroid Operating System Mod (e.g. CyanogenMod) Recovery (ClockworkMod, Amon Ra) Custom Kernel (e.g. LeshaK's kernel) Firmware Driver Over The Air (OTA) update Fastboot SIM unlocking Flashing SPL (Second Program Loader)   (any other often-confused terms that I've missed?)


The symbol for the first person pronoun used to have a different and peculiar shape before the onset of computers. Now we simply use "I". How may I access this symbol?

I know what my symbol or character looks like, but I don't know what the command is or which math alphabet it came from. How do I go about finding this out?


I understand that when slicing strings, the first index number refers to the start (inclusive), second number refers to end (exclusive) and the third refers to step size. So, wouldn't the first example throw an index error since length 6 is outside of the string? In the second example I would've expected "nohty" and "ohty" for the third example but this is clearly not the case.  temp = 'Python' stringLen = len(temp) slicedStr = temp[stringLen::-1] print(slicedStr) >>> nohtyP  stringLen = len(temp) - 1 slicedStr = temp[stringLen::-1] print(slicedStr) >>> nohtyP  stringLen = len(temp) - 2 slicedStr = temp[stringLen::-1] print(slicedStr) >>> ohtyP

I need a good explanation (references are a plus) on Python's slice notation.   To me, this notation needs a bit of picking up.   It looks extremely powerful, but I haven't quite got my head around it.


Is there any way to prevent current from passing through a certain wire without actually cutting off the power from that line.  To be clear, I'm using 2 power source and because of "even with 0.0001v difference, they are going to fry each other when you connected them in parallel" rule, I used Schottky diode but the voltage drop is too much. My power source is 3.3v but with the voltage drop it went to 2.9v. Is there any work around.  Also, will this be a good way for my application   Based from the circuit alone, I can say that it will cut the power from the source as soon as it sense a reverse current.  I don't wanna protect my device, I just want to combine the 2 power source without frying them. (Wait that's protection) So that's it.

I have got two power supply options on my board:   USB 5.0V DC Power Jack of 5.0V   My intention is to design a or-ing power supply option, as either of them will be used at a time. Possible solutions are shown below:    Using oring diodes   or using two p-mos    Possible issues observed with the above options:   Using diode is cheap and good option but an ordinary diode gives a drop of 0.7V and a schottky diode will give a drop of 0.16 to 0.20 volts, which is also not acceptable because my processor  recommended operating power supply is 5.0V and minimum supply voltage is 4.75. With a 0.2V with schottky diode the 5.0V comes down to 4.80V and the space between recommended and supply fed is very less. Then I thought to use p-mosfets which serves the purpose of oring along with reverse polarity protection, but assume a case when both the supplies are fed together by mistake and there is minor difference between USB supply and DC jack say 4.9V for USB and 5.10V for DC Jack. Then, the DC jack supply may pump the current in USB Jack, which may damage USB.   Is there any other better and cheap option I should use for or-ing supply, or is there something wrong with my analysis?


I have a 200+ rep account in a site (Stack overflow), I created accounts in Stack Exchange and Cooking, the rep. goes to 101 correctly but I don't get the privilleges (I can't answer a protected question). I think that is that particullary privillage, I could have answered some good question, but instead I had to add comments couse of this privillage problem.

Questions can be protected (i.e. marked "highly active").   What does it mean for a question to be protected? Why are some questions protected? Who can protect and unprotect questions? Who can answer a protected question? How are protected questions displayed? When should I protect or unprotect a question? When does the Community user protect a question?


In my code I had this line:  f(t->a, t->b, destroy(t));   Where f is a function, t is a pointer to a struct and destroy is a function which frees the pointer t and returns NULL. The code compiled and run successfully on some compilers (cc, gcc, clang on OS X and clang on Linux) as I expected - t->a and t->b were evaluated before freeing t. However, when compiling with cc/gcc on Linux I got a segmentation fault, as if I was trying to dereference null pointer. What causes that?  Thanks!

Can it be assumed a evaluation order of the function parameters when calling it in C ? According to the following program, it seems that there is not a particular order when I executed it.   #include <stdio.h>  int main() {    int a[] = {1, 2, 3};    int * pa;      pa = &a[0];    printf("a[0] = %d\ta[1] = %d\ta[2] = %d\n",*(pa), *(pa++),*(++pa));    /* Result: a[0] = 3  a[1] = 2    a[2] = 2 */     pa = &a[0];    printf("a[0] = %d\ta[1] = %d\ta[2] = %d\n",*(pa++),*(pa),*(++pa));    /* Result: a[0] = 2  a[1] = 2     a[2] = 2 */     pa = &a[0];    printf("a[0] = %d\ta[1] = %d\ta[2] = %d\n",*(pa++),*(++pa), *(pa));    /* a[0] = 2  a[1] = 2 a[2] = 1 */  }


I run a small news site with tens of thousands of entries.  I'm currently importing all of these into wordpress by rebuilding our old CMS into wordpress.  So far, everything is coming over smoothly.  My problem comes down to this:  We run several different news sections.  Sports, News, Arts, Oped, &c.  The way our current permalink structure is set up, a post looks like this:  http://newssite.com/sports/2010/04/05/post-title.  However, the post is also tagged with a subcategory like "football" or "basketball".  When I get everything into wordpress, permalinks want to show up as:  http://newssite.com/sports/football/2010/04/05/post-title.  Is there a way to remove subcategories from showing up in permalinks?  I would rather not hack core files, but am willing to if it fixes our problems.  Thanks in advanced.

We have a site with categories and subcategories.  If anybody navigates to a content belongs to a subcategory the url will have the following form: domain/main-category/sub-category/mycontent/ But we need another form: domain/main-category/mycontent where mycontent belongs a subcategory inside main-category, but we don't want the subcategory to be displayed in the URL.  Is there any possible solution for this?


I am getting this specific error during the runtime of my android app:   java.lang.NullPointerException: Attempt to invoke virtual method`'void android.support.v7.widget.RecyclerView.setHasFixedSize(boolean)' on a null object reference                                                                                at com.monkeyengineer.project.MyFragment.onCreateView(MyFragment.java:36)   I have checked the android recycler view and adapter documentation but it is not helping me with why this is crashing.  Here is my code in my Fragment where I am calling the findViewById method on the container view (import statements are omitted for brevity):  public class MyFragment extends Fragment {      private List<Project> data;     private RecyclerView recyclerView;     private TextView textView;      private boolean mIsRecyclerViewVisible = true;      public MyFragment() {         // Required empty public constructor     }       @Override     public View onCreateView(LayoutInflater inflater, ViewGroup container,                              Bundle savedInstanceState) {          View mView = inflater.inflate(R.layout.my_fragment, container, false);         textView = (TextView) container.findViewById(R.id.text_view);         recyclerView = (RecyclerView) container.findViewById(R.id.recycler_view);         recyclerView.setHasFixedSize(true);          LinearLayoutManager mLayoutManager = new LinearLayoutManager(getContext());         mLayoutManager.setOrientation(LinearLayoutManager.VERTICAL);         recyclerView.setLayoutManager(mLayoutManager);          Adapter adapter = new ProjectsAdapter(data);         recyclerView.setAdapter(adapter);          if (data != null) {             textView.setVisibility(View.INVISIBLE);             mIsRecyclerViewVisible = true;         } else {             recyclerView.setVisibility(View.INVISIBLE);             mIsRecyclerViewVisible = false;         }         return mView;     }      @Override     public void onStart() {         super.onStart();         if (mIsRecyclerViewVisible) {             recyclerView.setVisibility(View.VISIBLE);             textView.setVisibility(View.INVISIBLE);         } else {             recyclerView.setVisibility(View.INVISIBLE);             textView.setVisibility(View.VISIBLE);         }     }      @Override     public void onStop() {         super.onStop();         mIsRecyclerViewVisible = data != null;     } }   Here is my fragment layout:  <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"     xmlns:tools="http://schemas.android.com/tools"     tools:context="com.monkeyengineer.project.MyFragment"     android:layout_width="match_parent"     android:layout_height="match_parent" >      <android.support.v7.widget.RecyclerView         android:id="@+id/recycler_view"         android:layout_width="match_parent"         android:layout_height="wrap_content"         android:scrollbars="vertical" />      <TextView         android:id="@+id/text_view"         android:layout_width="wrap_content"         android:layout_height="wrap_content"         android:height="45dp"         android:drawableLeft="@android:drawable/ic_input_add"         android:drawableStart="@android:drawable/ic_input_add"         android:drawablePadding="8dp"         android:gravity="start|center"         android:padding="8dp"         android:text="Add stuff."         android:textStyle="bold"         android:layout_gravity="center_horizontal"         android:layout_centerVertical="true"         android:layout_centerHorizontal="true" />  </RelativeLayout>   So why is it giving a null pointer exception, it must be because the recycler view object is being assigned to a null value but I can not think why.  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?


This is what I could do: $$ n² + (n+1)² = a²$$    $$2n²+2n+1=a²$$ $$4n²+4n+2=2a²$$ $$(2n+1)²-2a²=-1$$ This is a negative Pell's equation. One of its solution is $2n+1=7,  a=5$. How can I get to other solutions?

How to find all solutions for Pell's equation $x^2 - Dy^2 = -1$ after the first $x_0$ and $y_0$?   for example if we have $x^2 - 2 y^2 = -1$ then the smallest integer solution for $(x,y) = (1,1)$  How to build on this to get the rest of the solutions ?


The text for  states the following for the purposes of targeting:  You touch a corpse or other remains.  Last I checked, zombies were shambling corpses, so can gentle repose work on zombies to keep them from rotting more? I'm looking for an answer to this from a player's perspective.

The Circle of Spores Druid feature Fungal Infestation states:  If a beast or humanoid that is Small or Medium dies within 10 feet of you, you can use your reaction to animate it, causing it to stand up immediately with 1 hit point. The creature uses the zombie statistics. It remains animate for 1 hour, after which time it collapses and dies.  Circle of Spore druids also gain access to the  spell, which states:  You touch a corpse or other remains. For the duration, the target is protected from decay and can’t become undead. The spell also effectively extends the time limit on raising the target from the dead, since days spent under the influence of this spell don’t count against the time limit of spells such as raise dead.  There seem to be some good arguments that they cannot work together:  First, Gentle Repose states the target cannot become undead, which would seem to preclude Gentle Repose working on a fungally infested creature that appears to be in some sense raised from the dead. Second, gentle repose states you touch a corpse or other remains - one could argue that using the zombie statistics, the fungally infested entity is neither a corpse or remains, but an undead zombie.  However, there are also some reasonable arguments that they could work together:  First, the Fungal Infestation does not say that the creature is undead or a zombie, but that it uses the statistics of a zombie, which might leave room for a RAW interpretation that the features could work together (for example, it could be considered a fungally infested corpse or fungally raised remains). Second, Gentle Repose says that it extends the time limit of raising the target from the dead and makes reference to spells like Raise Dead, which in flavour are similar to what happens with Fungal Infestation.  RAW, can a player cast gentle repose on a zombie created by Fungal Infestation?


If I try to run Blender from remote desktop, it says  looks somehow expected, but it is not. If I open Blender being on physical console, it works. If I then open this desktop remotely, it still works, allowing me to manipulate 3D objects, run animation etc, i.e. perform namely that operations, which one would expect don't work remotely. Simultaneoulsly, some innocuous operations with menu may cause this dialog again in the middle of operation and crash. Looks like OpenGL is used in some embelishements, not in main operations. The, can it be turned off?

I want to render my blender project in rdp. But some error has appeared. What is the best solution for this problem? I've spent many hours trying to troubleshoot this problem.


This has been addressed before (), but I wanted to bring the question up again,   to see if anybody has come up with a better method in the last 5 years, and to specify that I am looking for a solution that does not require utilizing a specific shell, which the OSGEO4W installation seems to require.   Can anybody recommend a certain installation or procedure for installing GDAL Python bindings on Windows 7 or above?

Can anyone explain how to install GDAL/OGR with Python on Windows?  I have Windows Vista and I have tried following the information on the website and it does not seem to bind the exe files for me.  Can someone describe the process, including links to the files/folders I will need?  I have now tried to run the gdal setup with minGW, but this has also failed:


I have a table in SQL Server 2012 Enterprise Edition that has ~100GB of data. Most of this data is attributed to a single NVARCHAR(MAX) column which has an average length of 4500 characters. It stores data compressed by an application that has no need for Unicode characters.    Since  takes two bytes per character and  takes one, I surmised I could cut down on some storage by switching the table over. However, once I altered the column to be VARCHAR(MAX), the table ballooned to 155GB.   I am aware SQL may use  but the documentation states this does not apply to NVARCHAR(MAX) so it couldn't have been in use.   So why has my table grown so much in size?  Table:  CREATE TABLE [dbo].[Table](     [RecordLocator] [char](6) NOT NULL,     [CreateDate] [date] NOT NULL,     [SystemId] [varchar](40) NOT NULL,     [EventXML] [nvarchar](max) NULL, --Not XML, compressed XML as characters     [UpdateUTCTimeStamp] [datetime2](7) NOT NULL,     [DeleteDate] [date] NULL,  CONSTRAINT [PK_Table] PRIMARY KEY CLUSTERED  (     [RecordLocator] ASC,     [CreateDate] ASC,     [SystemId] ASC,     [DeleteDate] ASC )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, FILLFACTOR = 75) ON [PRIMARY] ) ON [PRIMARY] GO   Additional notes:   Table design is not ideal, I am also working on getting that changed with the third party developers.  Table is partitioned on DeleteDate - also not ideal but required as of now to efficiently swap out old data Table does not have row or page compression enabled Table row growth before and after table alter is negligible D'oh, I did run sp_spaceused and failed to add the output:   name   rows        reserved        data            index_size  unused  Table  11407899    160531008 KB    159465328 KB    525200 KB   540480 KB

I am running sql 2008 r2 and the db was working fine and fast for last 3 years untill about 3 months ago we added ntext field on very active and used table.  Now we are starting to get out of server space because of the huge expanding size of this table.  I read that shrinking ,we do not want to loose the indexing of db because it was working fast for years and we do not want to get fragmentation expending.  We decided to delete that field and all its values: Is there a way to delete the ntext field and all its values and release space without removing indexing ,without shrinking, without loosing db performance?  I am attaching the db size query output to show you size expanding of last 5 months.


1) Australia has won the World Cup Cricket.      2) Australia have won the World Cup Cricket.   Which sentence is correct? Also, I would like to know more contexts where 'country has' and 'country have' are used.

English is not my first language. Sometimes I read some mistakes in newspapers and get confused. Please check below sentences and let me know your valuable feedback.    As per newspapers:     India have won the match.   As per me, it should be:     India has won the match.   My point is that with India (a country) we should use has, right?


Hi am a beginner in Electronics and I have been working with a LED project. I have a requirement where i need to connect 6 LED's in a way shown in the below diagram. Forward voltage of these LED's are 3v and current consumption around 20mA.         – Schematic created using   But I felt the above schematic is so bulk due to the presence of resistors, So I am thinking to replace the above one with something like this below.         Am i doing it right in simplifying the circuit? Kindly advice.

Why can't you use a single resistor for a number of LEDs in parallel instead of one each?


Here's my code:  $words = array(); $word = "this"; $words[] = $word; $word = "that"; $words[] = $word; print_r($words);  class word{     private $text;     public function __construct($word){         $this->text=$word;     }      public function setWord($word){         $this->text=$word;     } }  $class_words = array(); $word = new word("this"); $class_words[] = $word; $word->setWord("that"); $class_words[] = $word; print_r($class_words); exit;    Here's the output:  Array (     [0] => this     [1] => that ) Array (     [0] => word Object         (             [text:word:private] => that         )      [1] => word Object         (             [text:word:private] => that         )  )   I expected the second output to match the first in that the array should store 'this' and 'that'.  It seems array_name[] = <item> makes a copy to the item when it's an array of values but not so when it's an array of objects.  How do I make it copy the object to the array instead copying a reference to the object?  Do I need to create a new object each time I need to add an object to the array?

It appears that in PHP objects are passed by reference. Even assignment operators do not appear to be creating a copy of the Object.  Here's a simple, contrived proof:  <?php  class A {     public $b; }   function set_b($obj) { $obj->b = "after"; }  $a = new A(); $a->b = "before"; $c = $a; //i would especially expect this to create a copy.  set_b($a);  print $a->b; //i would expect this to show 'before' print $c->b; //i would ESPECIALLY expect this to show 'before'  ?>   In both print cases I am getting 'after'  So, how do I pass $a to set_b() by value, not by reference?


I recently installed Ubuntu alongside windows 7 on my laptop (500 Gb hdd). In the partition step there were 3 partitions (recovery partition, hp tools, and the one I have Windows on). I selected new partition table, and as a result I got one partition of (500 Gb free space). Then I created a new partition (of 25000 GB, type: logical, ext4journaling file system). The installation went perfectly and Ubuntu is running fine.   However when rebooting it goes to Ubuntu, and I can't find my Windows 7 option in the GRUB menu. Also, I can't find my recovery and Windows partitions.   I don't have my Windows installation on a DVD, it is on the recovery partition. I am afraid that my data on Windows are gone.  Is there a way to boot to Windows without losing my data?

I have a Toshiba satellite A-200 laptop with a Vista OS on it with 4 NTFS partitions  (C:) Vista  (D:) Entertainment  (E:) Work  (F:) Sources   and I wanted to start using Ubuntu instead. So I tried it first from the live CD and everything was OK and all the partitions were shown and working and so I decided to install Ubuntu to replace Vista on the (C:) drive. After I did that I can no longer find my folders and files on the (D:), (E:), (F:) partitions and the only file system that is shown is one 198 GB although my HDD is 320 GB.  I can't access the lost data on the remaining 120 GB which I hope is still there and not totally lost  I am now working from the live CD but I am unable to install testdisk. Can I recover the Vista partitions by the product recovery CD to get my laptop back to the factory settings? Can I recover the NTFS partitions using a recovery program for Windows or will that make the problem worse?   I need these data badly as I don't have a backup for them.


I have virtualbox 5.1 installed on Ubuntu 16.04 OS. I am using it to set up a Ubuntu 16.04 Virtual Machine.  I have set up the VM using a .iso file of Ubuntu 16.04. I installed the guest editions from the 'Device' drop down menu and have enabled 'Bidirectional' option in the settings for both Shared Clipboard and Drop'n'Drop options.   With these settings, I am unable to copy/paste or drop files from host to guest or vice-versa. How do I resolve this as I need this functionality to transfer important files.

I followed the steps but still can't drag and drop files to Virtualbox guest OS.  I went to Settings, General, Advanced, clicked Bidirectional on both Shared Clipboard and Drag N Drop and i still can't drag or copy anything to the guest OS(Win7). Am i missing something?


I have a BASH utility that outputs measurements to screen live as it runs and writes the result to file at the same time. I am having to repeat the same code twice (see below).  Once to write to screen, and  Once to write to file.  This seems like a lot of redundancy to me.  Can I put one text block into something like a function then call it to be written to screen and file at the same time?  This would cut down on a lot of re-keying.   Example below   ###### write out to file : push end time at end ################ echo >> $file_name echo "End time: "$end_time >> $file_name echo >> $file_name echo >> $file_name echo >> $file_name  ######  print to screen : push end time at end  #################  echo  echo "End time: "$end_time  echo echo echo   So I'd be looking for someting like this  funtion text_block{ ######  print to screen : push end time at end  ################# echo  echo "End time: "$end_time  echo echo echo }   Then a command that does something like this  "command print text_block to screen, print text_block to file"

Currently I have a shell script which logs messages to a log file like this:  log_file="/some/dir/log_file.log" echo "some text" >> $log_file do_some_command echo "more text" >> $log_file do_other_command   When executing this script, there is no output to screen, and, since I'm connecting to the server via putty, I have to open another connection and do "tail -f log_file_path.log", because I can't terminate the running script and I want to see the output in real time.  Obviously, what I want is that the text messages are printed on screen and into file, but I'd like to do it in one line, not two lines, one of which has no redirection to file.  How to achieve this?


I have a Toshiba satellite pro Intel Core 2 Duo. Which ubuntu should I install?

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 running Ubuntu 13.04 right now and i would like to go back to windows.  I have a windows 7 iso and tried booting it from the usb but it brought up a command screen and i had no idea what to do there. What I am trying to do is basically uninstall Ubuntu and install windows back on my laptop

I have absolutely no experience with Linux, and I desperately need to get my computer back up and running again with Windows.  How do I remove Ubuntu and reinstall Windows?    Editor's note: many of the answers are about removing Ubuntu from dual-boot but keeping Windows (which is a bit complicated), while other answers are about removing Ubuntu from single-boot (which is easy: basically just format the disk while installing Windows). The question as written is ambiguous between dual-boot or single-boot.


Using  but varying them just a little i created a CA using -newca, i copied cacert.pem to my comp and imported as trusted issuer in IE. I then did -newreq and -sign (note: i do /full/path/CA.sh -cmd and not sh CA.sh -cmd) and moved the cert and key to apache.  I visited the site in IE and using .NET code and it appears trusted, great (unless i write www. in front which is expected). But every time i restart apache i need to type in my password for the site(s?).  How can i make it so i DO NOT need to type in the password?

I setup wildcard SSL certificate from Godaddy on Apache2. Whenever the server restarts it asks for the passphrase for the SSL certificate's private key.    What's the best way to remove this obstacle to restarts, because when logfile rotation restart occurs in the middle of the night, the server doesn't come back up, and I get an unhappy client call in the morning, as it is a shared server.


Let a long command in a default ubuntu terminal (gnome-terminal?). I need to edit this command in some editor (vim?) and run. So, I can copy the current line to the clipboard, start vim, insert the command to it, edit the command, copy it to the clipboard and paste it to the terminal prompt and run. Is there a simpler way to edit the current command with some editor?

I have a complex command in my terminal window which I would like to edit further e. g.  echo "This is a complex command I want to edit in an editor"   How can I pipe this line of code - not the output but the actual code - to e.g. Gedit for further editing? Something along the lines of this solution, just for a GUI based editor:   Please note that I'm specifically looking for a way to edit in an external editor.


I'm disassembling a non-functioning toy keytar. This is the chip behind a couple buttons, including an on/off button. What could the black, glassy bulge component be?

In low-cost mass-produced items I often run into black blobs of what looks like resin applied directly on top of something on the PCB. What are these things exactly? I suspect this is some kind of custom IC that is layed out directly on the PCB to save on the plastic  housing/connector pins. Is this correct? If so, what is this technique called?    This is a photograph of the inside of a cheap digital multimeter. The black blob is the only non-basic piece of circuitry present, along with an op-amp (top) and a single bipolar junction transistor.


I'm running Windows XP (still!) with 2 hard drives, 2nd drive stopped working a couple of nights ago. PC crashed, restarted - heard a couple of beeps - not the usual start up sound. On starting pc up without 2nd drive Windows boots + runs fine, but with secondary drive in it's too slow to use. Drive appears in My Computer but cannot access - takes forever to even load My Computer with the drive running.  I've tried running testdisk from DOS and can see the drive, followed steps to recover boot sector and can list some files - but only 1/4 at most are showing.   Have tried the deeper search in testdisk and there's a read error at 12% - left it for 2 hours and it still hasn't got any further. Took about 30mins max to reach 12%.  I've been looking up bad sectors and haven't found a decent way to proceed to try to recover as much data as possible.  Can anyone suggest what might be best to do next?  Other than time travelling back in time and backing up..  have done in the past but of course those drives broke too!  Thanks for any help :)

A friend of mine recently gave me a laptop that wasn't booting past the Windows screen. I replaced the hard drive with a new one and put the old hard drive in my comp. to try and recover the data.  Windows 7 didn't recognise the main OS partition indicating some filesystem corruption (disk manager showed it as a RAW drive instead of NTFS). Incidentally, the hard drive has two other partitions: the small 100 MB one was fine in Windows and the 10 GB Recovery partition was fine after Windows ran a disk check).  Then I booted up with a Linux live CD (Slax) and the filesystem was recognised fine. However, when trying to copy files, many files would cause errors each one holding up the copy process by about a minute. I'm copying about 120 GB of data with thousands of bad files so this means it takes forever to copy.  There are big files (videos and photos) and small files (documents).  What I need is a way to copy files from a dying HD so:   if a file is bad, it fails silently (not interactively) it fails quickly (< 1 seconds ideally) it optionally deletes the bad file from the destination (not necessary)   so that the process can be done overnight.  Do you know a live CD where copy behaves like that or parameters to cp I can use or the settings for ddrescue I need to use or some other method to do this (I'm a linux noob)?  Alternatively, do you know a way to mount a broken filesystem in Windows (it looks like there are errors in important locations so Windows doesn't recognise it as NTFS). Then I can try xcopy.


Is the following phrase grammatically correct:  Suffering from anxiety and depression, life has been a tremendous challenge for him ever since he was a young boy.

My case here is that I was writing something for school, and my teacher explained an error which I really can't see. She referred to articles about "dangling participles", which was previously unknown to me. I find it hard to relate the examples I've found about it to my situation. So this is a text I've written and the bold part is where the problem arises: (You could read only the bold part if you please)  Wandering, and lost in his thoughts, there is a deep despair occupying the mind of this man. He is barely aware of his surroundings, except for those few moments when the loud blissful voices break through the protective barriers, developed by his immense sadness and grave frustration, into his mind. ”How can they all possibly be so happy?” he thinks to himself. Staring blindly, with his head low, as he walks in a slow pace, whispering ”Mary, Mary, my Mary,” over and over again. Yesterday was her funeral. She had passed away from a severe type of cancer, at a relatively young age. It was his wife. They had been together since high school and were greatly attached to each other. Having spent nearly half his life by her side, we cannot but imagine his grief. Indeed, he could hardly picture a life without her. So, alone he roams in the midst of all the seemingly incessant cheering and noises, drowned by his sorrow.  Her comments on that part was:  we is slightly out of place here – see my comment below These few sentences are about him and his emotions, so ‘we’ seems out of place. If the sentence starts: ‘Having spent nearly half his life by her side’, the reader expects it to continue: ‘he’. After all we have not spent half our lives by her side.  Is she right? If so, could anyone try to explain why?


I'm currently in the process of learning Java. I have just run the following line in Eclipse in Win7 using jre1.8.0_25:  System.out.println(4.5 * 7.9);   The console output is: 35.550000000000004  I'm just wondering why the output is wrong.

public class doublePrecision {     public static void main(String[] args) {          double total = 0;         total += 5.6;         total += 5.8;         System.out.println(total);     } }   The above code prints:  11.399999999999   How would I get this to just print (or be able to use it as) 11.4?


I need to prove that the sequence $\{\gamma_n\}$ where $\gamma_n$ is the fractional part of $\big(\frac{1+ \sqrt{5}}{2}\big)^n$ is NOT equidistributed in $[0,1]$.  Now, I am not sure if I am correct but if not then please correct me. A sequence in some interval is equidistributed if it is dense in that interval. Right?? So, I was thinking of proving that $\gamma_n$ is dense in $[0,1]$ but I do not have any clue how to start. I am looking for a hint/answer that is from Fourier analytic point of view rather than number theory.

Let $$a_n=\left(\frac{1+\sqrt{5}}{2}\right)^n.$$ For a real number $r$, denote by $\langle r\rangle$ the fractional part of $r$.   Why is the sequence $$\langle a_n\rangle$$ not equidistributed in $[0,1]$?


While validating email textbox using regex and jquery in shtml page, error pops showing issue with regex as it contains "@" in the regex.  $(document).ready(function() {  $('#btn-submit').click(function() {       $(".error").hide();     var hasError = false;     var emailReg = /^([\w-\.]+@([\w-]+\.)+[\w-]{2,4})?$/;   //"@" in regex is the issue      var emailaddressVal = $("#UserEmail").val();     if(emailaddressVal == '') {         $("#UserEmail").after('Enter email address.');         hasError = true;     }      else if(!emailReg.test(emailaddressVal)) {         $("#UserEmail").after('Enter a valid email address.');         hasError = true;     }      if(hasError == true) { return false; }     }); });

Over the years I have slowly developed a  that validates MOST email addresses correctly, assuming they don't use an IP address as the server part.  I use it in several PHP programs, and it works most of the time.  However, from time to time I get contacted by someone that is having trouble with a site that uses it, and I end up having to make some adjustment (most recently I realized that I wasn't allowing 4-character TLDs).  What is the best regular expression you have or have seen for validating emails?  I've seen several solutions that use functions that use several shorter expressions, but I'd rather have one long complex expression in a simple function instead of several short expression in a more complex function.


So when listing out two things, it is appropriate to use "both".  What about for lists of more than two? Does "all" work?  Ex. He ordered both a steak and a side.  vs. He ordered ___ a steak, a side, and some wine. (or further items, as required)

What would be the correct word to use when referring to three or more items, in the same manner as the word both?  For example, using two words, with the word both:     "There are several recommendations I   have to further improve the sites —   both to improve their profit, and   decrease their cost."   Using three words, with a blank space in place of the correct word:     "There are several recommendations I   have to further improve the sites —   _ to improve their profit, decrease their cost and improve their   usability."   So, what would be the correct word to use in place of the __?


def isCyclicUtil(graph,v,visit,parent):      visit[v]= True     for i in graph[v]:          if  visit[i]==False :               if(isCyclicUtil(graph,i,visit,v)):                   return True             elif  parent!=i:                   return True      return False   def isCyclic(graph,n):      visited =[False]*(n)      for i in range(n):         print(visited,i)         if visited[i] == False:             if(isCyclicUtil(graph,i,visited,-1)) == True:                  return True       return False    print(isCyclic({0: [1], 1: [0], 2: [3, 4], 3: [2, 4], 4: [3, 2]},5))   At each iteration visited array is updated  OUTPUT: index : 0    visited array :  [False, False, False, False, False] index : 1    visited array :  [True, True, False, False, False] index : 2    visited array :  [True, True, False, False, False]   In the above code, values of visited array are being changed without any explicit modification to the visited array. what is the reason behind this?

When you pass a collection like list, array to another function in python, does it make a copy of it, or is it just a pointer?


I have done dual boot on my laptop. And I have these partitions as shown in the figure.  In this 25 GB partition, I have ubuntu 20.04.1 LTS installed, and the 22 GB is Linux swap type and is empty, I want to add this 22 GB in my 25 GB partition because whenever I use ubuntu it shows a message of low storage. Tell me is there any way to perform this task? This is my output of swapon --show:

I'm having Swap partition of 8 GB , how can i create a swap file from it ? Currently having three partitions root , home , swap . So if i create a swap file how do i create it and where do it get saved ? My RAM is about 4 GB.


I logged into my SQL server today using PhpMyAdmin, and it seems to be acting weird throwing random [Token Mismatch] errors, only while trying to create a new user account. I tried multiple times, with multiple users, and still got the same thing. I then tried to update my own password, which succeed, however, does not allow me to log into the server.  Trying to login with myusername, and the newly set password returns the following error in PhpMyAdmin.  #1130 Cannot log in to the MySQL server   I have command line access to the server, and tried logging into my 'root' user, which I am getting this:  ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)   I know, with 100% certainty, that I am entering in both my user account password, and root password correctly, but am not able to log into the server.  This is a production server, and has multiple hosted websites running from it.  I have tried running  mysqladmin -u root password my-new-pass   But, not knowing the root password that already exists, this fails.  I am completely locked out of my own database on all administrative accounts, how would one go about regaining access to the database, while retaining all of the data in the database?  If any additional information, or diagnostic steps are require, please do not hesitate to ask. Any and all help is greatly appreciated.

I don't know if I'll make the issue clear, but I've installed MySQL on CentOS 6.3 using root account on a specific domain (f.ex. root@mydomain), but when I try to log on to it I'm being asked for password to root@localhost account, which I do not have access to. How can I log on to MySQL installed on 'mydomain' and not to 'localhost'?   I've tried editing my.cnf using bind-address='domain_ip', but it didn't help, it still wanted localhost password.


This question may be redundant but I really don't understand why the following code throws: Exception in thread "main" java.lang.NullPointerException  public class NewClass {     static StringBuilder SB;     public static void main(String[] args) {         SB.append("Tesing");         System.out.println(SB);     }  }

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?


In a script I have inherited the output of one of our programs is put in to a file with:   program &>> result.txt   I have been reading in my book "Learning the bash shell" at home over the weekend, but cannot find what this means ( I know what >and >> mean ).  I am missing something obvious?

I often see tutorials online that connect various commands with different symbols. For example:  command1 |  command2 command1 &  command2 command1 || command2     command1 && command2   Others seem to be connecting commands to files:  command1  > file1 command1  >> file1   What are these things? What are they called? What do they do? Are there more of them?    .


Examiner: Describe a place you have visited in the past. Candidate: [...] When I was a student, I would go there all the time and hang out with my friends.  I don't understand what "would" means in this case. Please help me; thanks in advance.

One can use the habitual past 'would' to describe past events. For example one could say,      Jim would spend weekends at the farm. He would cut weed and water the plants.   One can also use the simple past.       Jim spent weekends at the farm. He cut weed and watered the plants.   Would the use of habitual past be considered "weak" writing or prose, as opposed to the simple past?  How does the simple past in the following sentence "He would cut weed and water the plants." without any preceding time expression e.g. "spend weekends"  make a distinction between a repeated action/habit and a one-time action of cutting weeds and watering plants?


There's a class below  class A {     public:         string& getStr()         {           // Do a lot of work to get str           return str         }         const string& getStr() const; };   Can I call the first function within the second function? I want to do this, because the second function have a lot of code in common with the first one. It cannot be like this:  const string& A::getStr() const {     // Wrong     A temp;     return temp.getStr(); }   because there is added a new temp and the inner status between *this and temp is different (*this != temp).  Can it be called like I described?

Let's say I have the following class X where I want to return access to an internal member:  class Z {     // details };  class X {     std::vector<Z> vecZ;  public:     Z& Z(size_t index)     {         // massive amounts of code for validating index          Z& ret = vecZ[index];          // even more code for determining that the Z instance         // at index is *exactly* the right sort of Z (a process         // which involves calculating leap years in which         // religious holidays fall on Tuesdays for         // the next thousand years or so)          return ret;     }     const Z& Z(size_t index) const     {         // identical to non-const X::Z(), except printed in         // a lighter shade of gray since         // we're running low on toner by this point     } };   The two member functions X::Z() and X::Z() const have identical code inside the braces.  This is duplicate code and can cause maintenance problems for long functions with complex logic.    Is there a way to avoid this code duplication?


From what I can tell it is an inherited skill from wizard to wizard. According to this question:  Herpo the Foul seems to be the first or one of the first who were able to speak Parseltongue.  And from what I have researched, he was an Ancient Greek wizard and there is nothing of significance if he was related to Salazar Slytherin.  So my question is, how does Salazar Slytherin speak parseltongue? (which could possibly be answered by if he was actually related to Herpo the Foul)

Was Salazar Slytherin the first Parselmouth, or did somebody else use it before him?  I’ve read the books, but I can’t find any examples.


I'm testing subprocess option in Python. I wrote simple code in C and I want run it by subprocess in Python. This is how it looks :  C code example.c (first I execute code and then in subprocess I'm using executable file) :   #include <stdio.h>  int main(int argc, char *argv[]) {     int number= 2110;      while (1==1)     {         printf("%d",number);         printf(" return number: ")         return number;      }     return 0; }   Python Code :  def subTest():     while True:         numberS = subprocess.call('./example')         print (numberS)   Output which I should have after run python code :   2110 return number: 2110   Output which I get :  2110 return number: 62   I test it on some 'numbers' and proper values I get up to 255 then 256 -> 0 etc why's that ? Why it gives 8bit values and how to do it to return proper values  ?

If yes, on which operating system, shell or whatever?  Consider the following java program (I'm using java just as an example, any language would be good for this question, which is more about operation systems):  public class ExitCode {     public static void main(String args[]) {         System.exit(Integer.parseInt(args[0]));     } }   Running it on Linux and bash, it returns always values less equal 255, e.g. (echo $? prints the exit code of the previous executed command)  > java ExitCode 2; echo $? 2  > java ExitCode 128; echo $? 128  > java ExitCode 255; echo $? 255  > java ExitCode 256; echo $? 0  > java ExitCode 65536; echo $? 0     EDITED: the (only, so far) answer below fully  explain what happens on UNIXes. I'm still wondering about other OSes.


Every time I login, it is through my Yahoo account. Is there a way to convert it into an OpenID type account?

I no longer use the service that I originally used to register, and would like to change the service I use to log in, or at least add a second account.  Is this possible? How do I change my login provider or associate a backup method to log in?     For more information, see "" in the .


I started out out as an Arcane Trickster rogue 7, so I could only pull from Wizard spells and cantrips, but now I have multiclassed into Warlock.  Am I able to change some of my AT cantrips to Warlock cantrips?

Many classes: bard, ranger, sorcerer, and warlock have this type of text in their Spellcasting or Pact Magic feature under Spells Known of 1st Level or Higher:     Additionally, when you gain a level in this class, you can choose one of the spells you know and replace it with another spell from the spell list, which also must be of a level for which you have spell slots.   Can I choose to replace cantrips or only spells of 1st level or higher?


Let $X$ be a complex Banach space. $A$ and $B$ are linear bounded operators on $X$, $\rho$ is the spectral radius. If $AB = BA$, show that $\rho(A+B) \leq \rho(A)+\rho(B)$. Firstly I tried to use the formula $\rho(T) = \lim\limits_{n \to \infty} \|T^n\|^{\frac{1}{n}}$ if $T$ is a linear bounded operator. And if $AB = BA$,we have $(A+B)^n = \sum_{k=0}^n C_n^k A^k B^{n-k}$. So $$\|(A+B)^n\|^{\frac{1}{n}} \leq \sum_{k=0}^n C_n^k \|A^k\| \|B^{n-k}\|$$ Then I tried to prove $\lim\limits_{n \to \infty} (\sum_{k=0}^n C_n^k \|A^k\| \|B^{n-k}\|)^{\frac{1}{n}} \leq \rho(A) + \rho(B)$, but failed. Any kind of help is appreciated and thank you very much in advance!

I am reading the book "characterizations of c*-algebras" by Doran and Belfi. On the page 299, the book reads "It can also be shown that if $xy=yx$, then $\nu(x+y)\le\nu(x)+\nu(y)$." The definition of $\nu$ is as follows: in normed algebra,  $$\nu(x)=\limsup_{n\to\infty}\|x^n\|^{\frac1n}$$  Note that the algebra is not assumed to be complete and is also not assumed to be complex scalar(we can have real scalars)  This is my trial: I just tried to mimic the proof of the Minkowski inequality, but failed.  Thank you