I need to create a title page of the given format                              **(Title of the Thesis)**                                    Thesis              Submited in partial fulfilment of the requirements of                             BITS C421T/42T Thesis                                      By                                    (Author)                                    ID No. ( )                           Under the supervision of                            ----------------------                      (Name and Designation of Supervisor)                                Instiute emblem          BIRLA INSTITUTE OF TECHNOLOGY AND SCIENCE, PILANI (RAJASTHAN)                                    (Date)   I am new to latex, and am miserably failing to do so. I tried the center the lines by using the command \center, but even that is not working. How should I go about creating said titlepage? Also, how do I embed an image in the title page?

The standard titlepage is quite simple. I am looking for a very  and need help customizing my title page.  It should match the  classicthesis doctoral thesis template  Below a minimal working example:   \documentclass[12pt,a4paper,footinclude=true,twoside,headinclude=true]{scrbook} \XeTeXinputencoding iso-8859-1 \usepackage[marginparsep=8pt,left=3.5cm,right=3.5cm,top=3cm,bottom=3cm]{geometry}  \usepackage[parts,pdfspacing,dottedtoc]{classicthesis}    \frontmatter  \begin{document}     \pagestyle{scrheadings}        %this is the place to set up my cover sheet.       %*******************************************************      % Abstract     %*******************************************************    %\renewcommand{\abstractname}{Abstract}    \pdfbookmark[1]{Résumé}{Résumé}   \begingroup    \let\clearpage\relax    \let\cleardoublepage\relax    \let\cleardoublepage\relax       \chapter{Résumé}     Résumé de la thèse en français\dots      \vfill      \chapter*{Summary}   Résumé de la thèse en anglais\dots    \endgroup             \vfill     \end{document}


How do you open a file from a java application when you do not know which application the file is associated with. Also, because I'm using Java, I'd prefer a platform independent solution.

How do I open a file with the default associated program in Java? (for example a movie file)


What can I possible do, when travelling using airports and carrying films in my hand baggage. I am going to Berlin and I want to carry 2 films one Portra 160ASA and one Kodak TMAX 400ASA. What could I possible do during checking my hand baggage? Does x-ray harm films under 800ASA? Is there a difference between coloful and black and white film? Is there any difference between exposed and unexposed film? I am going to travel from Brussels to Berlin and vice versa.

I had a business trip with some free time in the evening, so I took my photo gear with me, but on the last moment, decided to leave my film camera at home because I did not want to ruin the film with X-ray scans in airports. I wasn't going to stay long enough to buy, shoot and develop a film during my stay, which seems to be the best way of avoiding X-ray scans.  I want to be better prepared next time, so what would the best practice to travel with undeveloped film?


I want to implement a code in Python but I need to implement a switch case. I saw this online (a standard example):  def switch_demo(argument):     switcher = {         1: "January",         2: "February",         3: "March",         4: "April",         5: "May",         6: "June",         7: "July",         8: "August",         9: "September",         10: "October",         11: "November",         12: "December"     }     print switcher.get(argument, "Invalid month")   But I need something different. I don't want to display some strings but to execute some commands, like:  switch(button) { // this is a code for C structure case 1: do some things ( not just display text) case 2: do some things ( not just display text)   And so on. Can you please give me an example of how this structure is supposed to look?

I want to write a function in Python that returns different fixed values based on the value of an input index.    In other languages I would use a switch or case statement, but Python does not appear to have a switch statement.  What are the recommended Python solutions in this scenario?


var a = 8.4286; var b = 2; console.log(a-b)  Actual Output:  6.428599999999999 Expected Output: 6.4286 What is the reason behind this and how to get around it?

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


Let's say I want to delete a property in a JS object    const source = {   nestA: {     nestB: {       nestC: 'deleteMe'     }   } } const clone = {} clone.nestA = {...source}.nestA delete clone.nestA.nestB console.log(source)     execute above script expect: source remain untouched actual: source will become {}  However, if I just do delete clone.nestA, source will remain untouched as expected  Question: How come delete clone.nestA.nestB affect source. But delete clone.nestA doesn't?

What is the difference between a deep copy and a shallow copy?


Here My Question is about direct object or indirect object of a verb when using passive form not abut "happened". Can't we use the passive form if we don't have direct or indirect object.  This was happened to me. This was happened 7 years back. I was kissed by her.(correct)  Adding: I'm trying to tell one incident:  This has happened to me when I was about 18 years old.  or  This happened to me when I was about 18 years old.

It is common to say "What happened to him (or somebody)?" to inquire about somebodies' whereabouts. But is it right?   In my opinion, it should be "What was happened to him?" or "What did happen to him?", even it can be "What had happen to him (before today)?" Am I wrong in this understanding?


There may be a question out there for this somewhere. But I wasn't able to find it easily.   Basically I want to write a bash script on a new box. A script that I've previously used.   Example:  #!/bin/bash -ex hi='hello world!' echo $hi   I've always used (for multiline output)  cat > script.sh <<EOF #!/bin/bash -ex hi='hello world!' echo $hi EOF   But as you may have noticed this has issues with $hi, and other symbols. Is there a good way to do this? Tips Tricks?

If you copy the contents of   httpd.conf   and then paste it into a cat command.. such as this one..  #!/bin/bash cat > /test << EOF pasted here.. EOF   you run into this error:  -bash: command substitution: line 1: unexpected EOF while looking for matching `'' -bash: command substitution: line 4: syntax error: unexpected end of file   perhaps the solution is to escape the dollar signs and maybe even quotes and so on..  but given that this is such a large file.. can dollar signs be automatically be escaped ?  is my only option to escape them via another program and then give it to the cat command ?


I have 4 wireless USB adapters, all of which are poorly supported by Linux. The connection is unstable, the USB dongles overheat at regular intervals, and the Wi-Fi adapters themselves often become chokepoints, even with our 6 Mbit DSL. (Before you ask: yes, I've updated the drivers, and, yes, they all work like a charm on Windows.)  What I have to do currently is just use one until it smells funny and can't connect, then unplug it, blow on it, put it in the fridge, and replace it with the next. This can become quite a tedious process during heavy browsing - my computer is on the other side of the house.  What I'm wondering is if there's a way to distribute the load across all 4 adapters - so each one never has to process more than ~1.5 Mbps.

Direct Question:  My evga classified motherboard has two ethernet ports.  I want to use them simultaneously to improve the speed of a remote connection.  (Yay for programming remotely).  How do I do this?  At present /etc/network/interfaces:  auto lo eth0 eth1  iface lo inet loopback  iface eth0 inet static address 192.168.1.202 netmask 255.255.255.0 gateway 192.168.1.2  ifrace eth1 inet static address 192.168.1.201 netmask 255.255.255.0   What should I change? Is there a package I need to install to bond the two channels.  Background: I do a lot of remote computing both from home to office and office to home.  But (to take my ISP out of the equation), let's frame the question as if I'm really just interested in maximizing the file transfer rate between two computers on the same (local) network.  Both boxes have dual ethernet motherboards.  Using a simple Linksys WRT54GS as a 5 port switch (ignore wireless and isp) -- how do I maximize the transfer rates between the computers?  Please Note: I'm not interested in load balancing -- Correct me if I'm wrong, but I want to bond the two channels together so that the box appears as if it has one connection that's twice as fast.


I have a bit of a convoluted question.  My child has a Canadian and US Passport but travels with her Canadian passport since  it has a valid Chinese visa in it (we currently reside in China). We are traveling to Spain this month but her Canadian passport has less than 3 months validity in it (Spain requires at least a 3 month validity in order to enter the country). She has a US passport with a longer validity period.   Would it be possible to EXIT China using her valid (but almost) expired Canadian passport with a valid China visa in it but then ENTER Spain with her American passport? Then EXIT Spain with the American Passport and RE-ENTER China with her Canadian passport and valid China visa?  In Essence: Enter and Exit China with her almost expired Canadian Passport with Chinese visa Enter and Exit Spain on her US passport with extended validity

I am a citizen of two different countries, and have two passports.  How should I use my passports when traveling?


I recently built a computer and installed ubuntu on it. The wireless i put into it was taken out of a HP Pavilion Slimline s5-1024 Desktop. I checked on the internet and the wireless card is  Ralink corp RT5390 wireless 802.11n 1T/1R PCIe.  Every time i get on my computer, it acts as if everything is ok, but i cant find my home internet and most of the options are dark so i cant click on them. I am very new to all of this and i would just like my wifi to work. would installing a driver for it help? Do i have to get a different adapter?

I would like to know if my  is in anyway compatible with Ubuntu.  Dual booting Ubuntu 15.04 with windows 8.1 on an HP Pavilion G6 1d98dx.  I've tried so many different distros but the problem is the same on all of them "wireless disabled by hardware switch" I've tried rfkill unblock all but that did not fix the problem.  Bus 002 Device 002: ID 04f2:b293 Chicony Electronics Co., Ltd  Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub Bus 004 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub Bus 001 Device 002: ID 05dc:a20b Lexar Media, Inc.  Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub Bus 003 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub 00:00.0 Host bridge: Advanced Micro Devices, Inc. [AMD] Family 12h Processor Root Complex 00:01.0 VGA compatible controller: Advanced Micro Devices, Inc. [AMD/ATI] BeaverCreek [Radeon HD 6520G] 00:01.1 Audio device: Advanced Micro Devices, Inc. [AMD/ATI] BeaverCreek HDMI Audio [Radeon HD 6500D and 6400G-6600G series] 00:04.0 PCI bridge: Advanced Micro Devices, Inc. [AMD] Family 12h Processor Root Port 00:11.0 SATA controller: Advanced Micro Devices, Inc. [AMD] FCH SATA Controller [IDE mode] 00:12.0 USB controller: Advanced Micro Devices, Inc. [AMD] FCH USB OHCI Controller (rev 11) 00:12.2 USB controller: Advanced Micro Devices, Inc. [AMD] FCH USB EHCI Controller (rev 11) 00:13.0 USB controller: Advanced Micro Devices, Inc. [AMD] FCH USB OHCI Controller (rev 11) 00:13.2 USB controller: Advanced Micro Devices, Inc. [AMD] FCH USB EHCI Controller (rev 11) 00:14.0 SMBus: Advanced Micro Devices, Inc. [AMD] FCH SMBus Controller (rev 13) 00:14.2 Audio device: Advanced Micro Devices, Inc. [AMD] FCH Azalia Controller (rev 01) 00:14.3 ISA bridge: Advanced Micro Devices, Inc. [AMD] FCH LPC Bridge (rev 11) 00:14.4 PCI bridge: Advanced Micro Devices, Inc. [AMD] FCH PCI Bridge (rev 40) 00:15.0 PCI bridge: Advanced Micro Devices, Inc. [AMD] Hudson PCI to PCI bridge (PCIE port 0) 00:15.1 PCI bridge: Advanced Micro Devices, Inc. [AMD] Hudson PCI to PCI bridge (PCIE port 1) 00:15.2 PCI bridge: Advanced Micro Devices, Inc. [AMD] Hudson PCI to PCI bridge (PCIE port 2) 00:18.0 Host bridge: Advanced Micro Devices, Inc. [AMD] Family 12h/14h Processor Function 0 (rev 43) 00:18.1 Host bridge: Advanced Micro Devices, Inc. [AMD] Family 12h/14h Processor Function 1 00:18.2 Host bridge: Advanced Micro Devices, Inc. [AMD] Family 12h/14h Processor Function 2 00:18.3 Host bridge: Advanced Micro Devices, Inc. [AMD] Family 12h/14h Processor Function 3 00:18.4 Host bridge: Advanced Micro Devices, Inc. [AMD] Family 12h/14h Processor Function 4 00:18.5 Host bridge: Advanced Micro Devices, Inc. [AMD] Family 12h/14h Processor Function 6 00:18.6 Host bridge: Advanced Micro Devices, Inc. [AMD] Family 12h/14h Processor Function 5 00:18.7 Host bridge: Advanced Micro Devices, Inc. [AMD] Family 12h/14h Processor Function 7 01:00.0 Ethernet controller: Realtek Semiconductor Co., Ltd. RTL8101E/RTL8102E PCI Express Fast Ethernet controller (rev 05) 07:00.0 Network controller: Ralink corp. RT5390 Wireless 802.11n 1T/1R PCIe 08:00.0 Unassigned class [ff00]: Realtek Semiconductor Co., Ltd. RTS5209 PCI Express Card Reader (rev 01)


In Python 3, when I multiply an integer with a float, using a function or directly, I get a wrong answer.  def mult(a,b):     c= a*b     return c mult(10,3.14)   The answer I obtain is 31.400000000000002.  When I tried typecasting the integer value as float as in direct multiplication  a=float(10)  b=3.14 c=a*b c   I still get the same answer.  Meanwhile, mult(7,3.2) provides an answer of 22.400000000000002.    How do I fix this?  Edit: I agree that a similar question was asked earlier. But, before asking this question, I didn't find that similar question when searched in Google or in stack overflow. Different people use different search queries to search for the same query. So, in my opinion, this question should not be deleted and should stay.


Let $s_{0}$ and $s_{1}$ be arbitrary and $s_{n+1}$=($s_{n} $+ $s_{n-1}$ ) /2 n>=1 show Cauchy  show {$s_{n}$} is a Cauchy sequence. Conclude that {$s_{n}$} is convergent.

Show that the sequence $a_1=1$, $a_2=2$, $a_{n+2} = (a_{n+1}+a_n)/2$ converges by showing it is Cauchy.   My work : Need to show that for every $\epsilon \gt 0$ there exist $N$ such that $n,m\ge N \implies  | a_n - a_m|  \lt\epsilon$. $$|a_n-a_m| = \dfrac{1}{2}|(a_{n-1} + a_{n-2}) - ( a_{m-1} + a_{m-2})|$$ I feel triangle inequality might be helpful here, but really not sure how to link it to the $\epsilon$. Appreciate any help...


My laptop is connected to internet via wireless connection (which requires to setup a static IP). However my windows phone does not have this option, and hence I need to share the wireless connection from my PC (Ubuntu 15.04). Is there any way to do this?

I am connecting to a WiFi network through my laptop in Ubuntu. Now I need to share my Internet connection with my wife's netbook because her netbook is not able to connect to that WiFi network directly, because of its weak signal.  How can I do that in Ubuntu?


Is every abelian group the additive group of some ring?  I would very much appreciate if someone could show me if this is false or true, something I'm thinking about and finding hard to prove so im starting to think its false. Thanks

Given some Abelian group $(G, +)$, does there always exist a binary operation $*$ such that $(G, +, *)$ is a ring? That is, $*$ is associative and distributive:  \begin{align*} &a * (b * c) = (a*b) * c \\ &a * (b + c) = a * b + a * c \\ &(a + b) * c = a * c + b * c \\ \end{align*}  We also might have multiplicative identity $1 \in G$, with $a * 1 = 1 * a = a$ for any $a \in G$. Multiplication may or may not be commutative.  Depending on the definition, the answer could be no in the case of the group with one element: then $1 = 0$. But the trivial ring is not a very interesting case. For cyclic groups the statement is certainly true, since $(\mathbb{Z}_n, +, \cdot)$ and $(\mathbb{Z}, +, \cdot)$ are both rings. What about in general? Is there some procedure to give arbitrary abelian groups ring structure?


Here we have two classes, TestA and TestB.  TestB is a subclass of TestA.  The output of this program is 8, but I don't understand how it reaches this output because from my understanding it makes more sense for it to be 6.  I ran the program and found that whenever TestB is invoked, it visits the constructor of TestA before it executes its own constructor. This doesn't make sense since subclass should not inherit the superclass' constructor.  Can someone explain why this is happening? Thanks!  public class TestA{     static int x;     static TestA a;     static TestB b;      TestA(){         x++;     }      static void runTest(){         a = new TestA();         b = new TestB();     }      public static void main(String[] args){         runTest();         runTest();         System.out.println(a.x + b.x);     } }  class TestB extends TestA {     static int x;      TestB(){         x += 2;     } }

I have a question about inheritance in Java.  I have two classes A and B , and class B, inherits from A:  public class A {      public A() {          System.out.println("Hi!");      } }   public class B extends A {      public B() {          System.out.println("Bye!");      }       public static void main(String[] args) {          B b = new B();      } }   When I run program B, the output is:  Hi! Bye!      Question : why the constructor of class A is invoked, when I create and object of class B ?    I know that B inherits everything from A - all instance or class variables, and all methods, and in this sense an object of B has all characteristics of A plus some other characteristics defined in B. However, I didn't know and didn't imagine that when I create an object of type B, the constructor of A is also invoked. So, writing this:  B b = new B();   creates Two objects - one of type B, and one of type A.  This is getting interesting,   can somebody explain why exactly this happens?


It says I have to have at least 42 GB or more but as you can see I have 55 GB available. Tried looking online for solutions but all they say is time machine but I have never used this and the "Backup Automatically" is not selected.

I have a problem on boot camp where when I try to click continue but I get this message. Can anyone help?     The startup disk does not have enough space to be partitioned.   You must have at least 40GB of free space available.       Possible Fixes   It could maybe be time machine since I have it enabled. But as you know High Sierra does not give you the time machine off switch in system preferences  It could also be a disk utility partition error but you can clearly see on the image below I only have 1 partition which is my main OS hard drive


I have a problem with if statement. Two values - strings, one declared in class by arrow and another declared by radiobutton.gettext(). In debuging i can read values of both var. and they are same, but if statement says they are different.  Do you have any idea why is this happening?  Debuger:   Getting rbAnswer :   private String mChoices [][] = {     /* #8 */        {"razgovor između pomoraca u karanteni i njihovih obitelji", "za osobno razmatranje i razgovor s duhovnikom"," "," "},   }  ...  public String getChoice1(int a) {     String choice0 = mChoices[a][0];     return choice0; }   public String getChoice2(int a) {     String choice1 = mChoices[a][1];     return choice1; }   ...  rbGroup.setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener() {         String rbAnswer;          public void onCheckedChanged(RadioGroup group, int checkedId) {             if (checkedId == R.id.radiobtn1)                 rbAnswer = "" + rb1.getText();             else if (checkedId == R.id.radiobtn2)                 rbAnswer =  "" +  rb2.getText();             else if (checkedId == R.id.radiobtn3)                 rbAnswer = "" + rb3.getText();             else if (checkedId == R.id.radiobtn4)                 rbAnswer = "" + rb4.getText();              tTEST.setText(rbAnswer);             if (rbAnswer == mAnswer) {                 varScoreTrue = varScoreTrue + 1;                 updateScore(varScoreTrue);                 obavijestTocno();                 updateQuestion();              } else {                 varScoreFlase = varScoreFlase + 1;                 updateScore(varScoreFlase);                 obavijestKrivo();                 updateQuestion();             }            }      });   Declaring mAnswer:  private String mCorrectAnswers[] = {              ...          /* #8 */        "za osobno razmatranje i razgovor s duhovnikom",               ... }   ...  public String getCorrectAnswer(int a) {     String answer = mCorrectAnswers[a];     return answer; }   ...  mAnswer = mQuestionLibrary.getCorrectAnswer(mQuestionNumber);

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


How to find infinite sum How to find infinite sum $$1+\dfrac13+\dfrac{1\cdot3}{3\cdot6}+\dfrac{1\cdot3\cdot5}{3\cdot6\cdot9}+\dfrac{1\cdot3\cdot5\cdot7}{3\cdot6\cdot9\cdot12}+\dots? $$   I can see that 3 cancels out after 1/3, but what next? I can't go further.


When a user raises a recommend closure flag on a question or a "not an answer" flag on an answer, the flagged posts get sent to the close votes and low quality posts review queues.  However, if the community does not agree, they vote to leave open on questions and "looks OK" on answers. But the thing is, that when the community does not agree in the review queues, the recommended closure flag is marked as declined, while the "not an answer" flag is marked as disputed.  Question:  Answer:   So, when the community does not agree, why are they marked as declined on questions, but disputed on answers?

This post exists purely to house answers formerly attached to . You can safely ignore it.


i have a php script that has to compare some words in a csv file to a mysql table element. The problem is that apparently the csv file is'nt created in the correct codification.  The first error is this: SQLSTATE[HY000]: General error: 1267 Illegal mix of collations (latin1_general_ci,IMPLICIT) and (utf8_general_ci,COERCIBLE) for operation 'like'  Now when i use utf_encode on the variable, the error goes away but it didnt find my variable int the mysql database.  To be clear, i have several accented words in my csv file, and i can´t change thhis.  i'm using latin1 charset and latin1_general_ci collation in my DB.  Another observation is that i'm using thw following code to get information in the file:  if (($handle = @fopen("../arquivos/atualização/$name", "r")) !== FALSE) { while (($data = fgetcsv($handle, 1000, ";")) !== FALSE) {   Can i somehow convert my csv file in php without losing the accents? or convert my db tables?   Note: in notepad++ my CSV file is in ANSI codification, and when i convert it to utf the accents turn into strange characters.

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


Here is what I have: Suppose the contrary. Thus, (2k+1)(2k+1) + (2j+1)(2j+1) = (2p)(2p) Take mod 2 of both sides [1][1]+[1][1]=[0] [2]=[0] [0]=[0] No contradiction ... am I approaching this correctly? I want to figure this out myself but would like a small hint

Question:  If $ a^{2} + b^{2} = c^{2}$ and $c$ is even, prove that $a$ and $b$ are both even.  I am not quite sure how to prove this. My guess is proof by contradiction. Assume the contrary, that is, $a^{2} + b^{2} = c^{2}$ for $c$ even and at least one of $a,b$ odd.


part (mass noun) is close to "some", it means some but not all thing.  a part (countable) is a separate piece of something that you can combine with other pieces.  It has been always a problem for me to choose the right one.  For example:     I think there's always a part of you that doubts what you're doing.   But I can say "some part of you always doubts," so then it is not a separate thing and then why "a part" was used in the sentence?

When should I use "as part of", and when "as a part of"?


I've found a method for integration of  $\frac{1}{e^x +1}dx$. However none of the information I found explains the intuition. It might be clear for most people, but I was hoping that somebody could expand on it.  The problem of trying to u-substitute  $\frac{1}{e^x +1}dx$ becomes evident.  Since  $\frac{1}{e^x +1}dx$, where I substitute $e^x$ for u, gives me:  $$\int\frac{1}{u}\frac{du}{e^x}$$  Which still leaves me with $e^x $.  The method that solves it is by expanding the numerator with $e^x - e^x$ which gives us the integral:  $$\int \frac{e^x + 1 - e^x}{e^x +1}dx$$  I have seen that it works. But what compels somebody to expand the numerator with $e^x - e^x$? What benefit does a mathematician intuitively see with this? How could I be sure that it just doesn't give me back the initial integral:  $$\int\frac{1}{u}\frac{du}{e^x}$$  ?

How do I solve evaluate $$\int \frac{\mathrm{d}x}{e^x + 1}\ ?$$  I know that I have to use $u$ substitution but I can't seem to find something to substitute with.


I have a script which imports modules on-the-fly. Because modules name are changed as soon as a new version appears, it is difficult to check if the specific module name is also changed in the script. Because of this, I keep the modules name in the top of the script, in variables, like in this example:  var1 = 'moduleName1_v04' var2 = 'moduleName2_v08' ................... import var1 ................... import var2 ...................   But if I am writing like this, I will get an error.  The question is: how to import a module using a variable like in the example? Is it possible?

I'm writing a Python application that takes as a command as an argument, for example:  $ python myapp.py command1   I want the application to be extensible, that is, to be able to add new modules that implement new commands without having to change the main application source. The tree looks something like:  myapp/     __init__.py     commands/         __init__.py         command1.py         command2.py     foo.py     bar.py   So I want the application to find the available command modules at runtime and execute the appropriate one.  Python defines an __import__ function, which takes a string for a module name:     __import__(name, globals=None, locals=None, fromlist=(), level=0)      The function imports the module name, potentially using the given globals and locals to determine how to interpret the name in a package context. The fromlist gives the names of objects or submodules that should be imported from the module given by name.       Source:    So currently I have something like:  command = sys.argv[1] try:     command_module = __import__("myapp.commands.%s" % command, fromlist=["myapp.commands"]) except ImportError:     # Display error message  command_module.run()   This works just fine, I'm just wondering if there is possibly a more idiomatic way to accomplish what we are doing with this code.  Note that I specifically don't want to get in to using eggs or extension points. This is not an open-source project and I don't expect there to be "plugins". The point is to simplify the main application code and remove the need to modify it each time a new command module is added.


I found some old answers, but I think it is justified to ask this for 18.04. I had Windows 10 + 18.04 as dual boot. I tried to change an empty NTFS drive to ext4 and everything collapsed. I don't know whether it was me or gparted a bit too difficult to use. Everything died and the laptop was useless.   I installed Windows 10 in an empty partition and somehow the process brought back most of the drives. I still have an NTFS and ext4 drive to recover. I tried partition recovery wizards on Windows 10. Most of them are pricey.   Is there any tool we can use from an Ubuntu live USB which bring back these 2 or at least the NTFS partition back ? Thanks.  PS : The lost partitions remain untouched under a 176 GB unallocated space.    Update 1 :  This is where I am now, how to proceed ?

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 use Shift Switcher to surf through the open windows and select the desired one. I've configured the combinations so that they don't conflict with others. Mainly I use the next window, Super + Q and previous window,Super + Shift + Q switches. But release the keys (or the Super key) does not make the selected window active; I have to hit the modifier keys like Return, Shift, Alt, etc. or click with the mouse pointer for both switcher modes (Cover/Flip). But I'd like the selected window getting activated right when I release the button, similar to what we have with the Alt + Tab switching.   (flip mode shift switch)   (cover mode shift switch)  Here's a snapshot of my key combinations for the Window Management option in CompizConfig Settings Manager:

I configured the ring switcher with the CCSM.  I press Super + Tab and I start to cycle between all windows, but when I release the keys on the desired one, I have to either click on it or press enter.  How can I make it automatically select the window when I release the key?  It was working, but suddenly it stopped doing it.  I have the same trouble with Shift-Switcher compiz plugin.


I'm using a huge shapefile containing the coastlines of the world:    And want to cut out polygons from the shapefile to fit to my geotif like so (the blue polygons represents the cut out ones):     I want to do this in order to mask the land afterwards (and maybe extent the covered area if it doesn't properly cover land).  How does one do this in Python using GDAL/OGR libraries (performance do matter)?   The shapefile consists of many polygons and I'm not sure whether merging all of this to one feature will speed up performance?  One could get the bounding box of the raster, but how to go from there I'm not sure of:  # Raster image to clip InputImage = 'Geotif.tif'  # Polygon shapefile used to clip Shapefile = 'worldcoastlines.shp'  rasterFormat = 'GTiff' vectorFormat = 'ESRI Shapefile'  # Open datasets raster = gdal.Open(InputImage, gdal.GA_ReadOnly) wktproj = raster.GetProjectionRef() sref = osr.SpatialReference() sref.ImportFromWkt(wktproj)  ulx, xres, xskew, uly, yskew, yres  = raster.GetGeoTransform() lrx = ulx + (raster.RasterXSize * xres) lry = uly + (raster.RasterYSize * yres)

I need to clip a vector layer to the extent of a raster. It has to be very precise that's why I would not want to draw a polygon myself (and clip the two polygons). There seem to be some ways to clip a raster to a polygon but I have difficulties to find a solution to clip a polygon to a raster. I already tried to create a polygon out of my raster several times in ArcGIS and R, so I could clip the result. But every time it crashes because the raster is to big. There must be a simple way to solve this, and somehow I can just not see it at the moment.  How can I do this using GDAL?


How can I convert the following query with db_select   SELECT * FROM 'my_table' WHERE (condition1 < "value1" AND ((conidition2 > "value2") OR (condition3 < "value3")))   OR (condition4 < "value5" AND ((condition6 < "value6") OR (condition7 < "value7")))   I am trying with  $query = db_select('mytable');  $query->condition(           db_and()->condition("condition1","value1")                  ->condition(                              db_or()->condition("condition2","value2")->condition("condition3","value3")                              )); $query->condition(           db_and()->condition("condition4","value4")                  ->condition(                              db_or()->condition("condition5","value5")->condition("condition6","value6")                              ));    $query_debugg = $query->__toString(); dpm($query_debugg);   issue is with the "AND" in between where is should be "OR", it is expected I know.how can I change it  Output String  SELECT  FROM  {mytable} mytable WHERE ( (condition1 = :db_condition_placeholder_0) AND( (condition2 = :db_condition_placeholder_1) OR (condition3 = :db_condition_placeholder_2) ))AND( (condition4 = :db_condition_placeholder_3) AND( (condition5 = :db_condition_placeholder_4) OR (condition6 = :db_condition_placeholder_5) ))

I've been reading the documentatoin on  and also studied the api description for  and  but I fail to create a $query with 3 ->conditions:   select all between 0 and 100 but exclude 23, 48 and 97 select also 107, 123, 126 and 128   That's what I have tried so far:  $query->db_or()   ->condition('my_field', array(107, 123, 126, 128), 'IN')   ->condition(db_and()->condition('my_field', array(0, 100), 'BETWEEN')                       ->condition('my_field', array(23, 48, 97), 'NOT IN'));   But I get the following error:  PHP Fatal error:  Call to undefined method SelectQuery::db_or() in [... first line]   I've tried to play around with the syntax like that:  $query->condition(->db_or()   ->condition('my_field', array(107, 123, 126, 128), 'IN')   ->condition(db_and()->condition('my_field', array(0, 100), 'BETWEEN')                       ->condition('my_field', array(23, 48, 97), 'NOT IN')));   But again getting errors like that:  PHP Parse error:  syntax error, unexpected T_OBJECT_OPERATOR, expecting ')' in [... first line]   I also tried working with variables:  $cond01 = array('my_field', array(107, 123, 126, 128), 'IN'); $cond02 = array('my_field', array(0, 100), 'BETWEEN'); $cond03 = array('my_field', array(23, 48, 97), 'NOT IN'); $db_and = db_and(); $db_and->condition($cond02); $db_and->condition($cond03); $db_or = db_or(); $db_or->condition($cond01); $db_or->condition($db_and); $query->condition($db_or);   But this again yields drupal errors like that:  SQLSTATE[42S22]: Column not found: 1054 Unknown column 'Array' in 'where clause'   How to create a complex conditional database query with both AND and OR statements?


What are some cool applications of abstract algebra for computer science/software engineering?  A friend of mine has been invited to my university (most of the students are soon to be software engineers/CS) to give a short seminar on abstract algebra and he wanted to know how he could motivate students to learn and get interested in the subject.

I would like to know whether there are examples where finite group theory can be directly applied to solve real world problems outside of mathematics.  (Sufficiently applied mathematics such as cryptography, coding theory, or statistics still count.)  Let me clarify: I am not interested in applications of elementary group theory which happen to involve finite groups (e.g. cyclic/dihedral/easy groups as molecular symmetries).  I am interested in applications of topics specifically coming from finite group theory as a discipline, like one might see in , , or .  "The Schur multiplier has order 2640, so we should point the laser that way."   "Is this computer system secure?"  "No - Frobenius kernels are nilpotent."  I'm aware of , but many of the applications listed there are inside mathematics or fall in the "applications of easy groups" category.  It is entirely possible that what I'm looking for doesn't exist, and that finite group theory is still an untouchable, pure subject, like number theory in the days of G. H. Hardy.  But perhaps not.  Does anyone know of any applications of the higher level stuff?


I have a class DynamicDataDemo, which has a null pointer catch. However I don't understand why jPanel is being passed as null. It is initialized by netbeans as a border layout and size is also declared.     public DynamicDataDemo(final String title){ this(title,null); }      public DynamicDataDemo(final String title, JPanel panel){ super(title); setContentPane(initContents(panel)); }  public JPanel initContents(JPanel contentPanel){     if (contentPanel == null){         System.out.print("You are Here");         contentPanel = new JPanel(new BorderLayout());     }       this.series = new TimeSeries("Data", Millisecond.class);     final TimeSeriesCollection dataset = new TimeSeriesCollection(this.series);     final JFreeChart chart = createChart(dataset);      final ChartPanel chartPanel = new ChartPanel(chart);     contentPanel.setLayout(new BorderLayout());     contentPanel.removeAll();     contentPanel.add(chartPanel, BorderLayout.CENTER);     contentPanel.validate();     return contentPanel;                }   In my main class I call  Final DynamicDataDemo dynamicPlot = new DynamicDataDemo("nameOfPlot", jPanel1);   Any suggestions or solutions greatly appreciated!  Following code was generated by netBeans:  private void initComponents() {      jPanel1 = new javax.swing.JPanel();     jPanel2 = new javax.swing.JPanel();      jPanel1.setBackground(new java.awt.Color(0, 0, 0));     jPanel1.setLayout(new java.awt.BorderLayout());      jPanel2.setBackground(new java.awt.Color(0, 0, 0));     jPanel2.setLayout(new java.awt.BorderLayout()); }  private javax.swing.JPanel jPanel1; private javax.swing.JPanel jPanel2; // End of variables declaration                      Code I wrote:   final DynamicDataDemo dynamicEyePlot = new DynamicDataDemo("Eye Height", jPanel1); final DynamicDataDemo dynamicGainPlot = new DynamicDataDemo("Gain",jPanel2);

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 am writing an algorithm in LATEX un=sing sharelatex.com. I have written a long comment and it is cut from a point. I have written this:     %This is a LaTeX template for homework assignments \documentclass{article} \usepackage[utf8]{inputenc} \usepackage{amsmath} \usepackage{listings}  \begin{document}  \begin{lstlisting}  Function(A[1...n],x){   ...............    count=0;    H(A[1...n],n);    if (a==0){        while (j<=n and A[j]<=0){               ................        }         /* If there is at least one element that is equal to zero and at least one non-zero element then there are two elements with the desired property. In any other case the variable found is not changed.  */        if (count!=0 and count!=n) found=1;    }    ............. \end{lstlisting}  \end{document}  and it looks like that:  What could I do?

I have done everything correctly but my \begin{lstlisting} is overflowing and I did not find any method to stop it. Plz help  \begin{enumerate}[(b)]  \item To generate a 128bit WEP key. We have added a -w flag in the switch-case statement and also added a new option in the array pwgenoptions. After that, we have set the \emph{pw\_length} as 128 for 128bit WEP key. Finally, we have run the make operation again and compiled it successfully. Following the result of our modification:  \begin{lstlisting} bril@MT2012018:~/Desktop/pwgen-2.06$ ./pwgen -w 5 uGh1r eSh9A ohGh4 seeS5 AhJ2E eiQu6 iY8oe hooP7 AN7ia Ek3ak ohY7n hi5Up Yahc4 ue9Sh du4Nu ohr9I ag7oD Iyou9 Rei2m Aev4v ga8Hu Ait3e Ahph7 Om1ee Phob8 Eo2Oh io9Ai too2H joh0A ui8Iu foh0R Ze0ai Iw6wu VaJ2x ieM3I ve9aM ohd7A mee4H LueX7 OhV8u Seeh4 ohg1I Mejo1 Ook3V Eel3h ec2Co huiN2 Pie6X Raet6 Akua3 Voh8d aiG4S ivu5U teeV9 Oop9r Pai9G ox3Ei eiT8x Fei7u Phoi1 Eot6F aer2U Ga1og nai8E wee7U Eor9A oph1X Ti9ye uoF7w Joo2w cho2I Ool8Z aik8K OoV7V Eet5n AhL7U ooc3U AiSh1 Pie1x wei7X eeSh1 Ai4ae voR1a Yook8 Be9Ie Ahl9N eP1Za Zu5th Id7ai io7Oo She7m cai1W ivoY8 Quou3 taiT4 Ak2uk poh6Y Eyo2g Eis7d gol0E hu6Qu Xai9u eeZ5E Ugie6 zeo5I al7Ti ia4Ph Quiy2 Orai8 zeiY2 Ie0go Phoo6 oTh9u eWoo7 Eiph3 eed9D Caiv4 eeZ6i Shou0 gae7A uap6R ahM1a oox0E Aen2E lat9H Uj7ei Aik8w Ik1no ohP0f Oosh0 ooP1p Hau3p ooM0p oeK4o Tii1w aoC3d Ogh5E eo3EF vie1Z Hohl5 Cooy2 oD6ju Ahph2 cee8E Kex2a iCh0T Peej2 iiSh6 ith3U bohV8 So9ei Iu1ye aef8E Jue9s uGh9A kui7B au7Ae Aep8H Ie5ro jai2O ohH0o Ohco6 Quai6 lei1Y oaQu7 ooD8u Do7ie Oos8y Eexe1 Giz4J Eeh4y Aix4x pei1H ESh0i Iel2I aeN5o tahY1 ga8Ae moaC9 ieT6s ooVu4 Vohc2 ahc7H uQu9d Eigh4 xi5Ah Oof4i Yoo7e sohW0 vei8H Ouch2 UCh0v ood9V aV3to ood4S yu4Oo Eich3 eiG6u oox2A Ohy2j xea6A Ga6Oh zaTh2 aej6I voh5V Ooz8z Zahy1 een1R eeJ5j uRee8 yia2N Iyub9 xah3P oh4Ai AhT6u OB3fa Ie1ui OoGh2 if7Io eeGo4 Woo4l sa2Ta looR8 bei1E Vac2v Ooji9 Cah4l UC9ui ieZ1e Eivu5 Naeb6 ooQu9 ohFu1 OoX8i queB1 jooM5 uF2oo Ra5al coN2a uV3ee if9Ai Wee1W Iek2j tahY9 Miu4i ZuN2i Caez4 Jae2i XieY3 ohj1I IeG2b eeNg5 ish4G Eid4o eoGh2 ui8Ah Ahzi7 Chuc1 Oox4k Nah2u \end{lstlisting}    \end{enumerate}


On Wikipedia it is said that HMAC is basically (without taking into account padding):  $H(key\ \Vert\ H(key\ \Vert\ message))$  where $\Vert$ denotes concatenation.  I understand the need to hash twice, but why concatenate the key a second time in the outter hashing?  Why not simply hash twice, but without reusing the key, like this:  $H( H(key\ \Vert\ message))$  A bit like Bitcoin's double-SHA, rumored to be done to prevent length-extension attacks.

From what I know, the HMAC constructions has two strength:   It's resistant to length extensions Since the key is consumed before the message, the attacker does not know the initial state, preventing simple collision attacks.   But the simple construction $ \mathrm{Hash}(\mathrm{Hash}(\mathrm{key} ∥ \mathrm{message})) $ would offer those properties too.  HMAC on the other hand uses the more complicated construction $ \mathrm{Hash}((\mathrm{key} ⊕ \mathrm{opad}) ∥ \mathrm{Hash}((\mathrm{key} ⊕ \mathrm{ipad}) ∥ \mathrm{message})) $. I assume the more complicated construction of HMAC is required for some security proof, but I don't immediately see why.  For SHA-3 candidates, Hash(key||message) is claimed to be secure, since they're resistant to length extensions, without consuming the key twice. I believe Skein even has some security proof for a very similar mode.  So why does HMAC need to inject the key twice?


Why do count data need to be modeled differently from the standard linear  regression model ? Any simple example will suffice.

I understand that for certain datasets such as voting it performs better. Why is Poisson regression used over ordinary linear regression or logistic regression? What is the mathematical motivation for it?


A bounty of 250 rep was not awarded.  I answered  the question and the answer was accepted as the correct answer several days before the bounty expired, the answer had 3 up-votes and was the only answer.   I went through three iterations as the question changed and I spent a reasonable amount of time on the answer, it was complete code with log output and well commented.  The SO .  What am I missing?  Here is the text from the help system: "If the bounty was started by the question owner, and the question owner accepts an answer posted during the bounty period, and the bounty expires without an explicit award then we assume the bounty owner liked the answer they accepted and award it the full bounty amount at the time of bounty expiration."    That paragraph has no mention about when the answer was started.

I think   and  may reveal a bug in the bounty system.  The timeline summary as I see it is:   Question asked Mar 17 Answer added Mar 18 Question edited (extended) and bounty added Mar 20  Answer edited and accepted Mar 21 Bounty ends "with no winning answer" Mar 28   This was the only answer to the question.  From      If the bounty starter accepted an answer during the bounty period, that answer is awarded the bounty.   This appears to be the case here, so I'd expect the bounty to be awarded.  Is this a bug in the bounty system?  I'm not too fussed about the actual bounty here (I'd answered the question before the bounty was offered anyway), it's just that it'd be good to either fix the bug or improve the documentation I guess.


After I update the ubuntu version from 14.04 to 16.04 system not booting. screen sowing   grub>   Then I tried to update the grub as follows, 1/ boot the system using USB boot. 2. open the terminal and type   sudo update-grub   it throws the below error message.  /usr/sbin/grub-probe:error:failed to get canonical path of '/cow'.   Googled and tried many forum answers. But could not solved.  Greatly appreciated your help.

I am trying to install Ubuntu 12.10 for quite some time, and passing hurdles one by one. Now I am in a situation as follows.  I have got a PC and 10 GB HDD which will be totally dedicated to Ubuntu so no option of Wubi and dual boot.  I was trying to install from DVD, but it is getting stuck at "Out of frequency" error. So I had to adapt for USB boot option. But my PC is USB non bootable, so workaround is "Plop Boot Manager". So I am doing the installation procedure as follows:   starting  from a CD drive which is having plop installed. opting for for USB boot in plop options. booting begins from USB. monitor eventually gives "out of frequency" error press Shift+Alt+F1 to get the terminal. open the grub with sudo nano /etc/default/grub. do necessary changes. sudo update-grub.   Now here I am getting error as follows:   /usr/sbin/grub-probe:error:failed to get canonical path of /cow.     My system is   P4 3.06 GHz, 1 GB ram , 10 GB HDD without an OS, monitor CRT lg StudioWorks (7 years old). Mobo Mercury P4 266a NDMx (865 equivalent). The whole system is perfectly in working condition under XP, but it is USB non bootable, and all other devices working perfectly.  What should I do next?


I read that it's possible to install Ubuntu on a Samsung Chromebook, but I have a Samsung Chromebook 3 model code xe303c12-a01uk.  Could you please tell me where I can get the Ubuntu installation details for this model?  If I install Ubuntu is this going to make my life easier?

I have installed Ubuntu 13.04 on my desktop (runs like a charm). Then I used Crouton to install Ubuntu 12. 04 on my chromebook samsung (ARM). It also works quite well.  Here comes my question. Can we have a true Ubuntu (preferably 13.04) on my ARM chromebook?  It seems that the Crouton/Ubuntu is not 100% the real thing.  The best option would be to have the full Ubuntu 13.04 and remove the Chrome OS.


I don't usually have food delivered. However due to circumstances my eggs were delivered to my home and I have no idea how long they were sitting in the car as the driver had multiple stops I assume.  It was somewhere between one and three hours I assume. The FDA says 2 hours out of the fridge tops. If it turns out it was three hours then as long as they are thoroughly cooked are they safe to eat?

A friend of mine accidentally left a carton of eggs on her counter, unrefrigerated, for three days. The eggs had been previously refrigerated both at the store and at home. Now she's planning to do some more cooking which requires eggs, and is wondering if it's still safe to use them for baking. I believe she is planning on baking cookies with them, so they would be baked at fairly high temperatures for probably at least 10 minutes. Would this be safe, or are eggs left unrefrigerated for that long not safe for consumption?


I have to either find a nonabelian group of order $95$, or show none exists. $95 = 19 \times 5$. I am trying to use the class equation to show that $\vert G\vert = \vert Z(G)\vert$, but I am not sure how to show that there is no subgroup which is not in the center. Can someone gear me in the right direction?

I just constructed the semidirect product in Lang, and I'm trying to tie some facts together. From Ash's Algebra, I know that if $p\lt q$ are distinct primes, if $q\not\equiv 1\pmod{p}$, then any group $G$ of order $pq$ is abelian.  Is the converse true, that for any primes $p\lt q$, if $q\equiv 1\pmod{p}$ then there exists a nonabelian group of order $pq$?  One example I found online is that $\mathbb{Z}_3\ltimes \mathbb{Z}_7$ is nonabelian, and here $7\equiv 1\pmod{3}$. I was considering then semidirect products $\mathbb{Z}_p\ltimes\mathbb{Z}_q$ where $q\equiv 1\pmod{p}$ and some homomorphism $\phi\colon \mathbb{Z}_p\to\operatorname{Aut}(\mathbb{Z}_q)$ I calculate that  $$ (1,0)(0,1)=(1+0,\phi_0(0)+1)=(1,1) $$ and $$ (0,1)(1,0)=(0+1,\phi_{-1}(1)+0)=(1,\phi_{p-1}(1)). $$ Is it true somehow that $\phi_{p-1}(1)\neq 1$ in each case to show the group is nonabelian? I guess if it did this would imply $\phi_{p-1}$ is the trivial automorphism, so maybe there's something there? If not, is there a way to show $\mathbb{Z}_p\ltimes\mathbb{Z}_q$ is nonabelian in these cases in general? Thanks.


I was searching about 'why do not moon crash to earth due to its gravity?'Then by reading physics stake exchange existing questions I came to know that its the sideways motion of the moon that keeps moon in its orbit.   So my question is:- Moon is in circular or ellipthitical orbit and during its orbit moon is always pulled towards the centre of the earth but moon is changing its direction at every point because it is in circular or ellipthitical orbit, so the direction of force pulling moon towards the centre of the earth will also change at every point on the other hand the sideways motion of moon is always in a particular direction then there must be a point in the moon's orbit when sideways motion and gravity will act in same direction and moon should crash to earth.Then why it does not crash?

Why doesn't the Moon fall onto the Earth? For that matter, why doesn't anything rotating a larger body ever fall onto the larger body?


I am a Korean with my first (given) name comes last and my last (family) name comes first, just like many other east asians. So, I write my name as "Aaa Bbb Ccc", where "Aaa" is my family name and "Bbb Ccc" is my given name. There are literally several millions of other Koreans who also have "Aaa" as their family name, and many of them spell it in English in the same way. Imagine citing a paper written by a Korean with family name Aaa. How can people possibly distinguish hundreds of Korean researchers with the same name working in same field? For this reason, I want to use my given name (which is still quite common, but far less common than my family name) instead of my family name. For example, I want to be cited as [Bbb Ccc, 2020] instead of [Aaa, 2020]. Is this possible to do? I don't mind to be called as "Dr Bbb Ccc", and actually I prefer that way; imagine being called as "Dr Aaa", where there are 8 other "Dr Aaa"s in the same department! Of course I have to deal with other problems, like being called as "Bbb" or "Ccc" which is just like "von" and "Neumann" instead of "von Neumann"; but I think that is less annoying than being one of those "Aaa"s. Is it possible?

Is it possible to publish under a nom de plume (pen name, pseudonym)? ... and still take credit for the work?   I may have a chance to publish with the professor I am working with soon and if I am on the list of authors I would like to use a nom de plume, but I would also like to use the publication to apply to graduate schools next time. Is it possible to have my cake and eat it in the case?  EDIT: Sorry for missing this out; The reason for wanting to publish under a nom de plume is that I would merely want my career to be tracked under a different name. Not to hide identity; I am perfectly fine with what EnergyNumbers was suggesting.


For $n \geq  6$, where $n$ is a natural number, prove that $(\frac{n}{2})^n \ge n! \geq (\frac{n}{3})^n$.  I tried using induction but could not do it.

I met an inequality, I ask, do not mathematical induction to prove that:     Prove \[ \left(\frac n2\right)^n > n! > \left(\frac n3\right)^n \] without using induction


I've been trying to prove this for awhile, but I couldn't. I tried some approaches, for exemple find the remainder of $2^n-1$ modulo $2^m+1$ and vice versa. I also tried to write $2^n-1$ as $(2-1)(2^{n-1}-2^{n-2}+...+1)-2$ (since $n$ is odd). But none of my attempts worked.

A student of mine has been self-studying some elementary number theory. She came by my office today and asked if I had any hints on how to prove the statement      If $m$ is odd then $\gcd(2^m-1,2^n+1)=1$.    It's been a while since I took number theory and I'm not sure what to do. She said she is learning about congruences, primitive roots, and power residues.  She has not taken any group theory.


Attempting to add a large (15MB) image to a post fails with no error message.  When I try to drag and drop the image into the "Add a picture" dialog, it just stays uploading forever. In Chrome's network tools, I see that the post to  has been redirected to .  When I try the standard browse to add, the entire window is redirected to .  Shouldn't I see an error message letting me know the image is too big?  For reference, here's . (No idea why it was 15MB. I guess the Awesome Screenshot Chrome extension isn't so awesome.)

Ok first, there's that lugubrious use of the semicolon; not necessary.  Second, I didn't open a frame!  You did!  Alls I tried to do is upload a 5MB animated .gif file via Imgur.    Looking further into this, Imgur actually posts an error when you upload an animated .gif larger than 2MB.    Go figure!


I want to call a method in java with a given string like this for example:  String string = "HelloWorld"; main.string();   I want something like this to call the method defined in the string, would that be possible? If not (which I am kind of expecting), are there alternatives?

If I have two variables:  Object obj; String methodName = "getName";   Without knowing the class of obj, how can I call the method identified by methodName on it?  The method being called has no parameters, and a String return value. It's a getter for a Java bean.


I was trying to reconnect to my account RLF after being absent for a year or so.  But what I actually did is create another *RLF account.  (Sigh)  I would like to be reconnected to my previous 4 years, 3 months account.  I would like to reconnect to my former account which is user:26626.

I accidentally posted a question without being logged in. Is there a way to associate that question with my account?   For more information, visit "" in the .   a.k.a. How can you link a registered account to a cookie-based account? a.k.a. How do I merge an unregistered account with a registered account a.k.a. Merging users a.k.a. How do I associate anonymous questions I’ve asked with my registered account? a.k.a. Is there a way to claim an unregistered user? (in case anyone searches with those terms)


I am trying to draw a triangle with arrows instead of line. This is what I have tried...  \documentclass{article} \usepackage{tikz} \usepackage{siunitx} \usepackage{float}  \title{} \author{} \date{}  \begin{document}  \begin{tikzpicture}[scale=1.25][H]   \coordinate [label=left:$C$] (A) at (-1.5cm,-1cm);   \coordinate [label=right:$A$] (C) at (1.5cm,-1cm);   \coordinate [label=above:$B$] (B) at (1.5cm,1cm);    \draw (A) -- node[left] {$S = 77819.41 VA$}    (B) -- node[right] {$Q = 37953.10 VAR$}    (C) -- node[below] {$P = 67936 \si{\watt}$} (A); \end{tikzpicture}  \end{document}   The problems:   Line needs to be arrows  from C to B & A to B & C to A "A" label shouldn't be there in the line General code and design formatting Need to add an angle where C is Remove all A, B, C labels   Something like this...   (Angle symbol is phi)

I have drawn 4 nodes with  \documentclass[tikz,border=5pt]{standalone}  \usetikzlibrary{positioning}  \begin{document}  \begin{tikzpicture}[node distance=2cm]  % nodes \node [draw] (A) {A}; \node [draw, right=of A] (B) {B}; \node [draw, right=of B] (C) {C}; \node [draw, right=of C] (D) {D};  % arrows \draw [->] (A) -- (B) -- (C) -- (D);  \end{tikzpicture}  \end{document}   I am trying to draw an arrow between each node.  If I use  \draw [->] (A) -- (B) -- (C) -- (D);   I get lines between each node but only an arrow from C to D.  Can I, in one line, draw arrows between all of the nodes?


I installed Java 7 and 8 using ppa:webupd8 and my terminal says it is installed, but when trying to run minecraft it says   This application requires a Java Runtime Environment 1.7.0   I'm not the best with Ubuntu and I really can't figure out what the problem is. Any help is appreciated.

I have tried many tutorials but none of them are clear enough. I have also tried installing it using Wine but it won't update and Wine goes gray and stops working.  Does anybody know an easy way to install Minecraft though the Java file without using Wine?


All of a sudden a couple days ago, my Chrome browser (v. 37, on Win7 desktop) stopped working. It just displays the "Google Dinosaur" with the message "Unable to connect to the Internet" (Error code: DNS_PROBE_FINISHED_NO_INTERNET). However, IE and Firefox have no problems. Also, another computer on my home network has no problems with Chrome, which rules out any router issues. I have tried:   rebooting the computer  (deleting all Content &  Cookies; restoring all default browser settings) launching Chrome , as well as in incognito mode  uninstalling and re-installing Chrome temporarily disabling my virus protector (Microsoft Security Essentials) typing in IP addresses directly Command Prompt (Run as Admin):  netsh winsock reset (+ Restart)  (in chrome://net-internals/#dns) growling fiercely at the computer   Nothing helped. (Except the last one, which made me feel slightly better, but didn't resolve the issue). Any other suggestions?  UPDATE: I just realized that I can't even access my router using Chrome (typing the direct IP address), although, again, IE and FF have no problems there either.  UPDATE #2: After following the suggestion to , the cache list began populating with several entries (all **.google.com sites) with this note in the Address field: error: -137 (ERR_NAME_RESOLUTION_FAILED) (a problem which was discussed, though not solved, ). I assume it is all part of the same underlying problem.     UPDATE #3: As @FredsBend's link pointed out, this is a known (and apparently widespread) issue that is being tracked and investigated by the fine folks at Chromium. Star the bug at  to get notified of a fix.

I'm getting the error code: DNS_PROBE_FINISHED_NO_INTERNET in Google Chrome. The thing is, I have a working internet connection. I am posting this using that connection, using Internet Explorer. It's only Chrome doing this.  What happened was my laptop was refusing to go to sleep mode, so it ended up running out of battery power. I charged it, and when I subsequently booted the computer, Chrome stopped working. I don't see the connection...  I added Firewall rules (inbound/outbound) to allow Chrome to connect...so unless I'm missing something.  UPDATE: Chrome portable is working for me...just not the regular chrome.  UPDATE 2 Now I realize it had to do with Covenant Eyes which I have installed. See the accepted answer


I am trying to get Django/Python to run on my computer, but it's confusing that python runs Python v2 while there is also a Python v3 installed which needs to be run as python3 (both come preinstalled?!) and either way, the Django installer complains.   Anyway, I was trying to remove Django and the Python PIP installation utility, so I ran the command: sudo apt-get autoremove python-pip* and the terminal output frankly scares me:   It looks like it removed all kinds of things I didn't expect, including obviously vital and non-Python things like ubuntu-desktop and unity8-common and even software-center!   I'm afraid that if I log out of my session or reboot, then I'll never get this computer started again.   What damage did I just do, and how can I recover? Why where all of these removed in the first place? How did "autoremove" trigger these to be included? (Luckily, my actual data is safely backed up.)  Update 1: The answer linked in the comment below looks relevant but not complete.  Following the linked answer, my system did reinstall many packages as expected -- but others were not, so they are still missing from my system. Still worried whether my machine is broken. Among the removed-and-not-reinstalled packages are:   account-plugin-tools accountsservice-ubuntu-schemas address-book-service dbus-property-service dcraw exiftran ffmpegthumbnailer libhardware2 libhybris libmedia1 libmirplatform6 libmirserver30 libpay2 system-image-common system-image-dbus unity-plugin-scopes unity-scope-scopes unity8-common urfkill xcftools ... and many others   Can I just reinstall these with apt-get as well?   Update 2: As suggested in comments, I will now do sudo apt-get install --install-suggests {my list of removed packages}. Curiously, even core things like software-center were removed and are not even suggested. So I must include those explicitly in my command.  And I'm still afraid to reboot my computer. I hate it when I make nasty mistakes like this one, because I'm not guru enough to feel safe that I reliably fixed it again.

I just typed   sudo apt-get remove python2.6   I didn't realized that this command will uninstall the whole packages from my computer. Is it possible to uninstall the ubuntu without CD. Or how can I fix this big mistake?


I'm modelling a courtroom for an assignment, and I'm happy with it so far, although I feel like adding textures to finish it off. The problem is - I have no idea how to texture the thing. I have alot of things, tables, chairs, walls, etc.  The issue is that when I apply the material to something (like a table), it ends up appearing all over the room, on everything. How can I give a table a wood texture, chairs a different one, walls a different one, one for carpet, etc?

Given a 3D model, I want to define different regions and fill each region with solid color (to distinguish)  Is there an easy way to do it?   My current solution is to first select faces under edit mode, then switch to vertex paint mode and paint use a brush. I changed some properties of the brush(large radius, reduce edge softness) but I can't make regions in solid color as I expected..  Please Help.


Would I write this statement this way?   Would it be toward or towards?  "The puzzle piece shows how we fit together, working toward(s) a common goal."

In  we learn that toward and towards are interchangeable, but that the former is somewhat more typical of U.S. English and the latter of British English, although there is some indication that this does not always hold true.  But how about actual use? Being a non-native speaker, I cannot completely trust my intuition about what "sounds right". Is it true that toward sounds more formal than towards to a native English speaker? Does it vary between different variants of English? Should I use one in academic text and the other in casual communication? What are the nuances? In summary, how should I choose which one to use if I want to be consistent in my writing style? I'm looking for intuition for different kinds of situations.


I was reading a comment that I assumed to be from the person who I intended to give the bounty to and accidentally clicked +50 for the wrong answer. Sorry I was in the middle of doing something else and not really paying attention.   I would like to undo this, who can I contact to make the request? The question is .

I offered a bounty to a question and there is a good answer. If I give the bounty to that answer, could I change the bounty to another better answer within the seven days that the bounty is offered?


From a layman point of view, one would say, "Oh, I'm unrooted so I am blocked and access is not allowed." I want the programmatic point of view; telling me how an unrooted device doesn't have access to the whole filesystem, etc., and how a rooted device has that access.  Examples:  1.Is the filesystem set by default to disallow reads/writes to /system, /sys, /data, etc.?   2.Is there something stored in /system or /data (such as a program, block device/file, etc.) that the unrooted OS runs that limits system-wide access on several tasks that rooted users have?  3.Does the default "unrooted" OS actually have system-wide prevention of unrooted access?  Because look at it this way: to "root" your device something must be changed, right? So the "rooting program" or process must entail how this restriction is circumvented. Does anyone here/can anyone link to anything (or explain it) that explains this process of how the rooting progress allows users access they weren't normally given by default (programmatically; not details on steps to follow in a rooting process and not info on how to root on your phone from a user's point of view; from a developer's point of view).   Best example: Say I'm an Android developer and I wish to learn how to create a rooting program. What would I, for example, need to know to do this?

Or, how do I root my device without a rooter?  Rooting instructions for Android devices that I have seen are typically of the following form:   Download Gingerbreak.apk Run Gingerbreak, click “root device” Observe that Superuser.apk has been magically installed, possibly along with busybox and other things, and enjoy your rooty goodness.   What I am wanting to know is this: how does the rooting actually happen? What does Gingerbreak do?  I understand the end result of rooting:   su is present and working Superuser.apk is installed and controls access to su Various utilities are present, provided by BusyBox (optional?)   I also think I understand the basic idea of how Gingerbreak gets started — it exploits some local privilege escalation vulnerability and uses its new-found powers to deploy Superuser and whatever else is necessary.  So, unless I am wrong in some of the understanding I laid out above, the core of thing I want to know is what the root installer does to deploy and activate Superuser. It seems that just putting Superuser.apk in the right place wouldn't be enough — how does it get allowed root access? How does it get hooked up to moderate that access for other applications?  What does Gingerbreak do post-exploit to enable and secure root access?


I would like to setup a Stack Overflow(ish) private instance for student projects at our university. Instead of letting students send their questions only to the supervisors of the projects, I would like them to share the questions with their fellow students also. The projects usually involve developing software using a variety of technologies. Running a private instance of Stack Overflow would seem ideal to me, since I can monitor what is going between students. Since this is not free and I have no budget for this... any other solutions are also welcome! Has there been any thought on using Stack Overflow in education and making this free?

The gamification feature of Stack Overflow is going to be most appealing to young people, since they are the biggest gamers in society.  However, it is difficult for young people to fully engage in a forum like this because answering questions requires wisdom.  If a teacher could start a forum based on Stack Overflow open only to only her class, I imagine that students would benefit.  Is this possible? How?


I already run the following and I get "vulnerable" Mac cysunza$ env x='() { :;}; echo vulnerable' bash -c 'echo hello' vulnerable hello  I read the post about it but appears to me that his is just for newer systems that mine, so my questions are: I should be worried about it? (my guess is yes) Is there a way to solve this problem, without a new system? if there are such a patch, where I can get it?   I upgrade my Mac to the last OS in another hard disk but I felt so slow, that's the reason I prefer work in the system 10.6.8 Thanks

Given that Bash 3.2 (the version shipped by OS X) is vulnerable to the  known as "Shell Shock" ( and ) how do I rebuild Bash and secure my system ahead of an official Apple patch?  UPDATE: Note that Apple has now released the official patch.  for details.


I need an acoustic sensor I can bury to monitor the immediate area acoustically for footsteps. Is it possible to simply bury a microphone and call it a day, or would a more specialized underground acoustic sensor be necessary?

Actual seismograph electronics are very expensive. I'm just wondering if a seismograph can be made with a adequately semsitive accelerometer. To be exact I want to bury the accelerometer based seismograph and have it sense footsteps.  So is this possible and what method would you reccommend for my needs and why?


I am looking for something that looks like:    Does anyone have an idea as to how to implement this?

I would like to write a matrix equation, where the matrix contains equally sized coloured blocks on the diagonal. Something like:   Does anyone have any idea how to go about this?


I've always considered C++ to be one of the most strongly typed languages out there. So I was quite shocked to see  state that C++ is weakly typed. Apparently,  C and C++ are considered weakly typed since, due to type-casting, one can interpret a field of a structure that was an integer as a pointer.  Is the existence of type casting all that matters? Does the explicit-ness of such casts not matter? More generally, is it really generally accepted that C++ is weakly typed? Why?

To quote :     Two commonly used languages that   support many kinds of implicit   conversion are C and C++, and it is   sometimes claimed that these are   weakly typed languages. However,   others argue that these languages   place enough restrictions on how   operands of different types can be   mixed, that the two should be regarded   as strongly typed languages.   Is there a more definitive answer?


I have a Console application Hosted in Task Scheduler. while my job is running, in some scenarios i will store some data in static lists and DataTables. and later i will log those data in single shot.  There is a scenario where technical team will stop the service manually before completion, in this case am missing to log the data that has captured in static list.  Is there any way we can log while the user stops the Console application manually.

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


While solving a system of linear equations, we add/subtract two equations to get a simpler equation which we can solve for a variable. I see why we can do so intuitively, because when we add one equation to the other, we are just adding equal quantities on both sides of the first equation, thus unchanging the equation and since we are finding solution which satisfies both the equations, this solution satisfies the new equation also. Graphically, adding subtracting equations will create new lines (or 2-d planes and higher dimensional planes), but these will intersect at the same point(s) as the original system. But I am not able to show a formal proof for why subtracting two equations while solving a system of equations doesn't change the original system of equations. Could I please get some help with this?

Consider solving the following system of equations:   \begin{cases} 2x−4y&=0, \\ 4x+4y&=−4. \end{cases}  We can use the substitution method or the elimination method, of which the latter has always been unclear to me: why does it work? I know that by eliminating one of the two variables you can solve for the variable you're left with, and consequently solve for the other one, but why do you get the point $(x,y)$ at which both lines intersect? Can anyone show me this graphically?


package grid;   import java.awt.*; import java.awt.event.*;  import javax.swing.*;  public class Calc extends JFrame implements ActionListener {  /**  *   */ private JTextField txtF1, txtF2, txtF3; private JButton btn1, btn2, btn3, btn4, btn5, btn6;    public Calc() {     // TODO Auto-generated constructor stub     super("Grid Layout Calculator");     Container c = getContentPane();     c.setLayout(new GridLayout(3, 3));     setContentPane(c);     c.setLayout(null);      JPanel panel1 = new JPanel(), panel2 = new JPanel(), panel3 = new JPanel(), panel4 = new JPanel(), panel5 = new JPanel(), panel6 = new JPanel(), panel7 = new JPanel(), panel8 = new JPanel(), panel9 = new JPanel();       btn1 = new JButton("Add");     btn1.addActionListener(this);     btn2 = new JButton("Subtract");     btn2.addActionListener(this);     btn3 = new JButton("Multiply");     btn3.addActionListener(this);     btn4 = new JButton("Divide");     btn4.addActionListener(this);     btn5 = new JButton("Modulus");     btn5.addActionListener(this);     btn6 = new JButton("=");     btn6.addActionListener(this);      panel1.setLayout(new GridLayout(1, 1));     panel1.add(txtF1);     panel2.setLayout(new GridLayout(1, 2));     panel2.add(txtF2);     panel3.setLayout(new GridLayout(1, 3));     panel3.add(txtF3);     panel4.setLayout(new GridLayout(2, 1));     panel4.add(btn1);     panel5.setLayout(new GridLayout(2, 2));     panel5.add(btn2);     panel6.setLayout(new GridLayout(2, 3));     panel6.add(btn3);     panel7.setLayout(new GridLayout(3, 1));     panel7.add(btn4);     panel8.setLayout(new GridLayout(3, 2));     panel8.add(btn5);     panel9.setLayout(new GridLayout(3, 3));     panel9.add(btn6);      c.add(panel1);     c.add(panel2);     c.add(panel3);     c.add(panel4);     c.add(panel5);     c.add(panel6);     c.add(panel7);     c.add(panel8);     c.add(panel9);      setSize(500,250);     show();     }      public void actionPerformed(ActionEvent e) {     if (e.getSource() == btn1){         int x = Integer.parseInt(txtF1.getText());         int y = Integer.parseInt(txtF2.getText());          int sum = x + y;         txtF3.setText(String.valueOf(sum));     }     else if (e.getSource() == btn2){         int x = Integer.parseInt(txtF1.getText());         int y = Integer.parseInt(txtF2.getText());          int difference = x - y;         txtF3.setText(String.valueOf(difference));     }     else if (e.getSource() == btn3){         int x = Integer.parseInt(txtF1.getText());         int y = Integer.parseInt(txtF2.getText());          int product = x * y;         txtF3.setText(String.valueOf(product));     }     else if (e.getSource() == btn4){         int x = Integer.parseInt(txtF1.getText());         int y = Integer.parseInt(txtF2.getText());          int quotient = x / y;         txtF3.setText(String.valueOf(quotient));     }     else if (e.getSource() == btn5){         int x = Integer.parseInt(txtF1.getText());         int y = Integer.parseInt(txtF2.getText());          int mod = x % y;         txtF3.setText(String.valueOf(mod));     }      }      public static void main(String[] args) {     Calc app = new Calc();     app.addWindowListener(             new WindowAdapter() {                 public void windowClosing(WindowEvent e)                 {                     System.exit(0);                 }             });        }         }   I get these errors   Exception in thread "main" java.lang.NullPointerException     at java.awt.Container.addImpl(Unknown Source)     at java.awt.Container.add(Unknown Source)     at grid.Calc.<init>(Calc.java:49)     at grid.Calc.main(Calc.java:121)

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 have this part of a function which is running perfectly: if(/https?:\/\/[a-z]{2}w?\.mywebsite\./.test(href)){   if(!firstSerp){     firstSerp = this;     add_prerender(this, href);   } }  As you can see mywebsite is hard-coded. What I want is to put a variable there instead. So it would look like this: var mylink = 'mywebsite';  if(/https?:\/\/[a-z]{2}w?\.+= mylink\./.test(href)){}  One of the users suggested I look at  var replace = "regex"; var re = new RegExp(replace,"g");  But I have difficulties understanding how that would apply to my example. Could you please help me solve this?

I would like to create a String.replaceAll() method in JavaScript and I'm thinking that using a regex would be most terse way to do it.  However, I can't figure out how to pass a variable in to a regex.  I can do this already which will replace all the instances of "B" with "A".  "ABABAB".replace(/B/g, "A");   But I want to do something like this:  String.prototype.replaceAll = function(replaceThis, withThis) {     this.replace(/replaceThis/g, withThis); };   But obviously this will only replace the text "replaceThis"...so how do I pass this variable in to my regex string?


I have number like 24 and I need to return like result 24.0. How can I do this think.  I try with this code but is return 24. If is 24.5 is working correct but for 24 is return like integer.  double sliderValue = Math.round(number*10)/10;   Anybody know how can return 24.0

What I would like is a method to convert a double to a string which rounds using the half-up method - i.e. if the decimal to be rounded is 5, it always rounds up to the next number. This is the standard method of rounding most people expect in most situations.  I also would like only significant digits to be displayed - i.e. there should not be any trailing zeroes.  I know one method of doing this is to use the String.format method:  String.format("%.5g%n", 0.912385);   returns:  0.91239   which is great, however it always displays numbers with 5 decimal places even if they are not significant:   String.format("%.5g%n", 0.912300);   returns:  0.91230   Another method is to use the DecimalFormatter:  DecimalFormat df = new DecimalFormat("#.#####"); df.format(0.912385);   returns:  0.91238   However as you can see this uses half-even rounding. That is it will round down if the previous digit is even. What I'd like is this:  0.912385 -> 0.91239 0.912300 -> 0.9123   What is the best way to achieve this in Java?


So I'm video editting and I keyframe a translation of an image. The property value turns yellow, showing that that frame is the keyframe for that certain value. However, when I go to any other frame and try to keyframe to a different value, the property value is green and I am not able to change the value at all. Whenever I attempt to change it, the value reverts back to the keyframed value. I don't know what to do or how to revert this issue. This happened randomly. Deleted and re adding the image doesn't help and this is happening to anything that I try to keyframe.  I've tried to insert new keyframes and clear the keyframes, but those aren't working... the problem keeps on happening as soon as I add the keyframe...  The issue is similar to the one posted here, except there is no solution to the issue that has worked:

In the VSE, I have a scene strip, but I cannot change the opacity.  It just snaps back to the last value it was keyframed at as soon as I alter it.  (Blender 2.69)


I have a JSON string in the format '{"key1":{"Field1__c":"false", "Field2__c":"false","Id":"XXXXXXXXXX909"}}' I need to update the record corresponding to "key1". To achieve that I tried the below code: public void updateRecords(String jsonString){    Map<String,Object> deserializedJSON = (Map<String,Object>)JSON.deserializeUnTyped(jsonString);   SObject sObj = (sObject)deserializedJSON.get('key1');  update sObj;   }  But doing this I am getting the below error: System.TypeException: Invalid conversion from runtime type Map<String,ANY> to SObject Then I changed my code to: public void updateRecords(String jsonString){    Map<String,Object> deserializedJSON = (Map<String,Object>)JSON.deserializeUnTyped(jsonString);   Map<String,SObject> sObj = (Map<String,sObject>)deserializedJSON.get('key1');  update sObj;   }    After doing this I am getting the error:System.TypeException: Invalid conversion from runtime type Map<String,ANY> to Map<String,SObject> Any suggestions how can I update any sObject record provided in JSON string?

This is a canonical question and answer developed by the community to help address common questions. If you've been directed here, or your question has been closed as a duplicate, please look through the resources here and use them to shape more specific questions. To browse all canonical questions and answers, navigate to the  tag.  This question and answer is owned by the community! If you can improve it and make it more useful, you're welcome to edit it.  I have a specific JSON structure in mind. I need to either deserialize this structure that's coming in from a web service, or I need to serialize data into this structure to transmit it to another system. How should I get started on this project in Apex?


I am trying to send data from an Android Mobile App to Retrofit Rest API.  I took reference from this:   The Android APP    Retrofit Rest API (server, handles the data sent from the android app)    the server then forwards the data to Cassandra.   i did some modification in the android app to send my custom data (battery info) instead of the accelerometer data as in the project i took as template.   Here is my SendAccelerationAsyncTask  Class   private class SendAccelerationAsyncTask extends AsyncTask<Collection, Void, Void> {          protected void onPreExecute() {          }          @Override         protected Void doInBackground(Collection... params) {             try {                 SampleData training = new SampleData();                 training.setCollection(params[0]);                 cassandraRestApi.sendTrainingAccelerationValues(training);             } catch (Exception e) {                  e.printStackTrace();             }             return null; }   My problem is that when i try to send to data, the AsyncTask crashes with error:   04-13 08:55:43.120 4750-4818/com.miralak.basicaccelerometer W/System.err: java.lang.NullPointerException 04-13 08:55:43.121 4750-4818/com.miralak.basicaccelerometer W/System.err:     at com.miralak.basicaccelerometer.activity.CollectDataActivity$SendAccelerationAsyncTask.doInBackground(CollectDataActivity.java:459) 04-13 08:55:43.122 4750-4818/com.miralak.basicaccelerometer W/System.err:     at com.miralak.basicaccelerometer.activity.CollectDataActivity$SendAccelerationAsyncTask.doInBackground(CollectDataActivity.java:422) 04-13 08:55:43.122 4750-4818/com.miralak.basicaccelerometer W/System.err:     at android.os.AsyncTask$2.call(AsyncTask.java:287) 04-13 08:55:43.123 4750-4818/com.miralak.basicaccelerometer W/System.err:     at java.util.concurrent.FutureTask.run(FutureTask.java:234) 04-13 08:55:43.123 4750-4818/com.miralak.basicaccelerometer W/System.err:     at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:230) 04-13 08:55:43.123 4750-4818/com.miralak.basicaccelerometer W/System.err:     at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1080) 04-13 08:55:43.123 4750-4818/com.miralak.basicaccelerometer W/System.err:     at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:573) 04-13 08:55:43.123 4750-4818/com.miralak.basicaccelerometer W/System.err:     at java.lang.Thread.run(Thread.java:838)   I checked and confirmed that the variable being send is not null  but I am getting null pointer exception?  Thanks  update  NOTE:  line 459 is  cassandraRestApi.sendTrainingAccelerationValues(training);  i checked the values in training by:  Log.v("test", "" + training.getCollection().getStatus()); Log.v("test", "" + training.getCollection().getTechnology()); Log.v("test", "" + training.getCollection().getTemperature());   and so on..   here is the sendTrainingAccelerationValues method:  public interface CassandraRestApi {     @POST("/test")     Response sendTrainingAccelerationValues(@Body SampleData testing); }


I am taking part in a campaign supposed to be a normal hero adventure. One of our players, who is a first timer to DnD and never really claimed an alignment at the start of the campaign, has pretty much become a Chaotic evil character: stealing from absolutely anyone, attacking people unprovoked, refusing to help at all even when the story revolves around us helping others out.  When we started our campaign this character didn't have any alignment listed at all.  The chaotic evil actions surprised every single one of us including the DM, whom did say that we were supposed to be the heroes of this campaign. He's even been trying to show her that her constant theft isn't profitable giving her a few measly copper but her behavior hasn't changed at all.  A lot of us have been trying to talk her out of her actions but she continues to persist.     Since I am not the DM I'm not really able to take matters into my own hands but I am worried that this character will have a devastating effect on the campaign, especially when I see the other players' frustrated reactions to her actions such as stealing in plain sight from NPCs we're currently talking to.    We've even had our giant fighter try and grapple her just so she wouldn't murder the guy we were currently talking to for no reason. Besides telling the DM about my frustrations is there anything I could do in game, in character to try and deal with this potentially destructive player and show her that her chaotic evil personality is becoming frustrating to the rest of the group?

I've been reading forum posts and blogs who mention "my guy" syndrome as a specific type of difficult player, but I can't seem to find a solid definition for the term. Can someone explain this particular kind of problem player to me? How do you deal with this kind of problem?


I need to subset data from a NetCDF using a specific shapefile.  The data are sea surface temperature and ocean color at 1/4 degree resolution.  I have 4 polygons describing the US. Northeast continental shelf large marine ecosystem and it's sub-components that I need to use to extract the data.  I am working with monthly composite files from 1982-2014, so this data extraction routine needs to be automated.  The files are already subsetted to the approximate working area grid of [35, 45, -80, -60].    Previously, we were converting HDF5 data files to rasters in R and processing them this way, but this method is really inefficient and I am sure there is a better solution in Python using the current NetCDF files.  Thus far I have been using GDAL and Fiona to read in the shapefiles and NetCDF4 to load the data files. I am not sure how to go about subsetting the data.  I found this:     But I don't have the foggiest idea about how to subset a NetCDF file using anything other than a simple bounding box, which these polygons most certainly are not.  Point in polygon routines would probably take an eternity to work, but maybe I could subset the data using a smaller bounding box that is rotated to fit these shapes like this as an initial starting point and then do a point-in-poly search:    Any ideas?  EDIT 1:  I just came across the OpenClimateGIS package which seems that it may fit the bill perfectly...  I will have a go with this to see if I can get it to work:

I have a 3-D time-series precipitation data (187 x 1800 x 3600), stored in a NetCDF file. I need to obtain the precipitation data for a shapefile. import matplotlib.pyplot as plt from netCDF4 import Dataset, num2date,  from matplotlib.pyplot import figure from datetime import datetime, date, timedelta import numpy as np import xarray as xr import pandas as pd import geopandas as gpd       MSWEP_monthly = 'D:\G3P\DATA\Models\MSWEP\MSWEP_monthly.nc4'  MSWEP_monthly = Dataset(MSWEP_monthly, 'r') Pre_MSWEP = MSWEP_monthly.variables['precipitation'][:]   MSWEP_monthly2 = xr.open_dataarray('D:\G3P\DATA\Models\MSWEP\MSWEP_monthly.nc4')  Lon_MSWEP = MSWEP_monthly2.lon Lat_MSWEP = MSWEP_monthly2.lat  Africa_Shape = gpd.read_file('D:\G3P\DATA\Shapefile\Africa_SHP\Africa.shp')    from osgeo import gdal,osr,ogr  def makeMask(lon,lat,res):     source_ds = ogr.Open(shapefile)     source_layer = source_ds.GetLayer()       # Create high res raster in memory     mem_ds = gdal.GetDriverByName('MEM').Create('', lon.size, lat.size, gdal.GDT_Byte)     mem_ds.SetGeoTransform((lon.min(), res, 0, lat.max(), 0, -res))     band = mem_ds.GetRasterBand(1)       # Rasterize shapefile to grid     gdal.RasterizeLayer(mem_ds, [1], source_layer, burn_values=[1])       # Get rasterized shapefile as numpy array     array = band.ReadAsArray()        mem_ds = None     band = None     return array  shapefile = 'D:\G3P\DATA\Shapefile\Africa_SHP\Africa.shp' source_ds = ogr.Open(shapefile)  # calculate the cellsize cellsize = Lon_MSWEP[:][1] - Lon_MSWEP[:][0]   # create the mask mask = makeMask(Lon_MSWEP,Lat_MSWEP,cellsize)  Now if I implement the following code, the precipitation data for the first day (from the time-series) can be obtained with shape of 1800x3600: precip = np.ma.masked_where(mask==0,Pre_MSWEP[0,:,:])  I tried to use a for loop to mask the precipitation data for the entire time series (time, lon, lat) over the area of interest. however, the below code gives me a 2-D data, probably for the last day. Why is that? for i in range(len(Pre_MSWEP)):     precip = np.ma.masked_where(mask==0,Pre_MSWEP[i,:,:])


Is there a way to capture heat from the air (present in our surroundings)? Also, can we store it? If yes, how?  And if no, why?

There is a lot of energy in air's temperature? Why don't you harvest it? There is always difference that creates flow which can be piped into something converting it to mechanical energy...


So I wanted to show two pictures side by side, put captions below them and then replace some text inside.  This is what I have done:  \documentclass[a4paper,12pt]{article}   \usepackage{fullpage} \usepackage[utf8]{inputenc} \usepackage{amssymb, amsmath, amsthm} \usepackage{psfrag, graphicx}  \begin{document} \begin{figure} \centering \begin{minipage}[c]{.5\textwidth}   \includegraphics[width=1\linewidth]{convplot1}   \caption{first figure}   \label{fig:1} \end{minipage}% \begin{minipage}[c]{.5\textwidth}   \includegraphics[width=1\linewidth]{convplot2}   \caption{second figure}   \label{fig:2} \end{minipage} \end{figure}   \end{document}   I would like to have the captions show up right below, while using the minipage environment, but what it actually gives me is this:   I am not quite sure how to fix it, so any help is greatly appreciated!

I am preparing image files to be included in a latex document. The image file is generated by printing a Matlab plot.   If I print the plot in eps format, the content of the eps file is fully occupied with the plot;   if I print the plot in pdf format, then there are big margins above and below the plot in the pdf file;   if I use ps2pdf to convert the eps file into a pdf file, the big margins will be added above the plot.   I would like to use pdflatex, so I prefer pdf format of image files. I was wondering how I can save the plot in pdf format without the big margin above and below the plot?


I use this link to encrypt words  but i get ����>���||�  how can i fix it like 'aabbsdsafdadfdd'      $logic = new Xxtea();     $str = $logic::encrypt('aaaaa','00852953005432100085295300543210');   i tryed to   $a = $logic::encrypt('aaaaa','00852953005432100085295300543210'); echo $logic::decrypt($a,'00852953005432100085295300543210'); // aaaaa   but $a is   ����>���||�  - -!

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


After installing Debian Jessie on a System76 Gazelle laptop I was presented with the classic "black screen with blinking cursor". I figured this was some problem with X so I tried startx - it gave me this error:   (EE) Fatal server error:(EE) no screens found(EE)   I ran Xorg -configure as root and then X -config /root/xorg/conf.new, only to get the same error. The new conf file has the following section for Screen:  Section "Screen"         Identifier "Screen0"         Device     "Card0"         Monitor    "Monitor0"         SubSection "Display"                 Viewport   0 0                 Depth     1         EndSubSection         SubSection "Display"                 Viewport   0 0                 Depth     4         EndSubSection         SubSection "Display"                 Viewport   0 0                 Depth     8         EndSubSection         SubSection "Display"                 Viewport   0 0                 Depth     15         EndSubSection         SubSection "Display"                 Viewport   0 0                 Depth     16         EndSubSection         SubSection "Display"                 Viewport   0 0                 Depth     24         EndSubSection EndSection   So it appears that X cannot understand the laptop's screen - it has only the default screen, I am not sure what resolution. I have access to a full backup of this laptop before the fresh install and there is no 10-monitor.conf in /usr/share/X11/xorg.conf.d, so I do not know if it previously needed to be worked around.  How can I fix X to properly recognize this laptop monitor?

I am trying to setup a dual screen configuration on debian 8 jessie with Gnome.  My computer has 3 graphical outputs : 2 displayport and 1 HDMI. I can't manage to have two of this 3 outputs to work simultaneously.  output of xrandr is (with the other display on displayport):  xrandr: Failed to get size of gamma for output default Screen 0: minimum 1680 x 1050, current 1680 x 1050, maximum 1680 x 1050 default connected primary 1680x1050+0+0 0mm x 0mm 1680x1050      0.00* `   output of xrandr is (with hdmi working):  xrandr: Failed to get size of gamma for output default Screen 0: minimum 1920 x 1080, current 1920 x 1080, maximum 1920 x 1080 default connected primary 1920x1080+0+0 0mm x 0mm 1920x1080      0.00*   I also tried to use both displayport but it does not work either.  output of lshw -c videò:  *-display UNCLAIMED         description: VGA compatible controller    product: Intel Corporation    vendor: Intel Corporation    physical id: 2    bus info: pci@0000:00:02.0    version: 06    width: 64 bits    clock: 33MHz    capabilities: pciexpress msi pm vga_controller bus_master cap_list    configuration: latency=0    resources: memory:f6000000-f6ffffff memory:e0000000-efffffff  ioport:f000(size=64)   (with both screens connected via displayport)  output of lspci -v -s0:0:2.0  00:02.0 VGA compatible controller: Intel Corporation Device 1912 (rev 06) (prog-if 00 [VGA controller]) Subsystem: Dell Device 06b9 Flags: bus master, fast devsel, latency 0, IRQ 255 Memory at f6000000 (64-bit, non-prefetchable) [size=16M] Memory at e0000000 (64-bit, prefetchable) [size=256M] I/O ports at f000 [size=64] Expansion ROM at <unassigned> [disabled] Capabilities: <access denied>