I'm loading a form using Nivo Lightbox AJAX.  form#users-add   Now I use another AJAX function to submit the form:  var users_add = $('#users-add'); users_add.submit(function (e) {     e.preventDefault();     $.ajax({         type: users_add.attr('method'),         url: users_add.attr('action'),         data: users_add.serialize(),         success: function (data) {             if (data == 'users-add-success') {                 $('#users-add-cbk').html('
Utilisateur ajouté!
');                 users_add[0].reset();             } else {                 $('#users-add-cbk').html('
Une erreur c\'est produite.
');             }         },         error: function (data) {             $('#users-add-cbk').html('
Une erreur c\'est produite.
');         },     }); });   The problem here is that I have to re-map the DOM as form#users-add wasn't there when the the document has been fully loaded.  How to properly make the form#users-add seen by the script?

I have a bit of code where I am looping through all the select boxes on a page and binding a .hover event to them to do a bit of twiddling with their width on mouse on/off.  This happens on page ready and works just fine.  The problem I have is that any select boxes I add via Ajax or DOM after the initial loop won't have the event bound.  I have found this plugin (), but before I add another 5k to my pages with a plugin, I want to see if anyone knows a way to do this, either with jQuery directly or by another option.


So, I'm not too physics savvy but I am curious to ask. Is there a finite amount of mass in the universe? or is there more and more being created from somewhere or something? If the universe is infinite, and there's a finite amount of mass, that just seems kinda weird I guess.   Hopefully this isn't too dumb a question...

This question is about cosmology and general relativity. I understand the difference between the universe and the observable universe. What I am not really clear about is what is meant when I read that the universe is infinite.   Does it have infinite mass or is it dishomogeneous?  How can the universe transition from being finite near the big bang and infinite 14 billion years later? Or would an infinite universe not necessarily have a big bang at all?


Let $f:[0,\infty [\to \mathbb R$ a continuous function such that $\int_1^\infty \frac{f(x)}{x}dx$ converge. Prove that $$\int_0^\infty \frac{f(ax)-f(bx)}{x}dx$$ converge and compute this integral.  Attempts  For the convergence : Since for all $t>0$, $$\int_t^\infty \frac{f(ax)}{x}dx\quad \text{and}\quad \int_t^\infty \frac{f(bx)}{x}dx$$  converge, we have that $\int_0^\infty \frac{f(ax)}{x}dx$ and $\int_0^\infty \frac{f(bx)}{x}dx$ that converge, and thus $$\int_0^\infty \frac{f(ax)-f(bx)}{x}dx.$$  But how I can compute this integral ?

How can I prove the Theorem of Frullani? I did not even know all the hypothesis that $f$ must satisfy, but I think that this are  Let $\,f:\left[ {0,\infty } \right) \to \mathbb R$ be a a continuously differentiable function such that $$ \mathop {\lim }\limits_{x \to \infty } f\left( x \right) = 0, $$ and let $ a,b \in \left( {0,\infty } \right)$. Prove that $$ \int\limits_0^{\infty}  {\frac{{f\left( {ax} \right) - f\left( {bx} \right)}} {x}}dx  = f\left( 0 \right)\left[ {\ln \frac{b} {a}} \right] $$  If you know a more general version please give it to me )= I can´t prove it.


I am making tools with js API named vLine, but it is basic quesion of javascript so I post here.  I want to attache chat system on sample code. What I have adde tis between ///chat function  but   this.prototype.onMessage_    shows error like  Uncaught TypeError: Cannot set property 'onMessage_' of undefined    I have made a few javascript programings though,I am not good at this. So I think I didnt understand ,something very basic javascript object oriented.  please help me.  <script> var vlineClient = (function(){   if('{{vlineData.serviceId}}' == 'YOUR_SERVICE_ID' || '{{vlineData.serviceId}}' == 'YOUR_SERVICE_ID'){     alert('Please make sure you have created a vLine service and that you have properly set the $serviceID and $apiSecret variables in classes/Vline.php file.');           }       var client, vlinesession,           authToken = '{{ vlineData.authToken }}',           serviceId = '{{ vlineData.serviceId }}',           profile = {"displayName": '{{ vlineData.displayName }}', "id": '{{ vlineData.id }}'};      // Create vLine client       window.vlineClient = this.client_ = vline.Client.create({"serviceId": serviceId, "ui": true});     // Add login event handler   this.client_.on('login', onLogin);     this.client_.login(serviceId, profile, authToken).done(this.init_,this);     // Do login     **/////chat function**      this.prototype.onMessage_ = function(event) {         var msg = event.message,         sender = msg.getSender();          console.log('get message');         this.showAlert(sender.getDisplayName(),                      sender.getThumbnailUrl(),                      msg.getBody());     };        this.client_.on('recv:im', this.onMessage_, this);    **/////chat function**              function onLogin(event) {     vlinesession = event.target;     // Find and init call buttons and init them     $(".callbutton").each(function(index, element) {        initCallButton($(this));      });   }    // add event handlers for call button   function initCallButton(button) {     var userId = button.attr('data-userid');      // fetch person object associated with username     vlinesession.getPerson(userId).done(function(person) {       // update button state with presence       function onPresenceChange() {         if(person.getPresenceState() == 'online'){             button.removeClass().addClass('active');         }else{             button.removeClass().addClass('disabled');         }         button.attr('data-presence', person.getPresenceState());       }        // set current presence       onPresenceChange();        // handle presence changes       person.on('change:presenceState', onPresenceChange);          // start a call when button is clicked       button.click(function() {               if (person.getId() == vlinesession.getLocalPersonId()) {             alert('You cannot call yourself. Login as another user in an incognito window');             return;               }           if(button.hasClass('active'))                             **/////chat function**                             person.postMessage("Hello there");                             console.log("send message");                              **////chat function**             person.startMedia();       });     });    }    return client; })();      $(window).unload(function() {   vlineClient.logout(); });

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


A few years ago I was annoyed that such a great question/discussion had to be closed as off topic. It was  and I was annoyed that such a useful topic (to me) would have stale data because new answers can never be added to make it better when new keyboards hit the market.   After a time I realized why this is a bad idea as it breaks the Q/A theme and leads to not that focused threads. (When you want to look up how to do xyzzy you want terse focused answers to maximize productivity.)   However I thought it would make sense for a fork of all the Stack Exchanges to be made to have sort of a sub section that is for discussions. I thought of this thread today . There are some great minds on Stack Exchange that could contribute to future ideas and possibly discuss best practices or ways to do things in the future that may benefit from a discussion. In other words, maybe the IP address scheme to handle IoT would arise here if there was a discussion, etc.   In short, would a discussion sub section to each Stack Exchange site complement or deter from the existing format? (I know this is opinion based but this seemed like a good place to ask.)   -----Edit----  For example HoloLens Just game out and not the world of virtual reality and Augmented Reality are become more possible. Wouldn't it be great to be able to discuss the possible things you could do with this in a forum with upvotes that people could reference for years to come? Apparently not we would prefer it stay buried in a chat log that is very rough to reference or link someone to an old post.   Or even better, what do hiring managers look for when hiring Cobol programmers or UX designers.  What better place to ask that and get some great advice. However we would preferred it to be scattered all over the place in chat logs. Chat logs arnt refactored and theres no hey this is a duplicate post or nearly the same editing as with our Q/A format.

Has the Stack Overflow crew considered partnering with other existing, more traditional forums to support open ended discussion?  I understand Stack Overflow is strictly a Q&A site. We all know the drill. We also all know that when a more 'discussion-y' question is asked it's either coerced into Community Wiki mode or out right closed by the moderators. And that's fair enough I suppose but sometimes a question is open ended or spawns many, many comments. With Stack Overflow's lack of threads it can be difficult to follow anything of length. So, on to the my feature request!  Partner with other forums such as Reddit (stackoverflow.reddit.com?) so if open discussion is wanted it can happen easily. And by easily I mean provide a link on each question page saying something like "Open an official discussion at $forum_name", or if the discussion was already opened then "Join the official discussion at $forum_name". And of course on the forum posts provide a link back to the SO question for reference. When clicking the outgoing link a bunch of heavy lifting is automatically taken care of such as signing into the forum (As who? Obviously that will have to be figured out) and filling in the various post fields with data from the question and submitting it.  As to which forums would be official partners I only came up with Slashdot and Reddit as possible candidates but I imagine that there should be a number to choose from depending on the topic of the question. Select the best forum for the topic.  The key part is to still let SO be really good at Q&A and still let the various forums be really good at being forums while providing a little bit of official integration between the two. Additionally if the discussion devolves into nothing worth while then it's only related to SO and not actually a part of it. No harm, no foul.  So at the risk of making this sound too 'discussion-y', what do you people think? ;)  PS, And on second thought maybe this would be better implemented as a browser plugin or Greasemonkey script. :P  PPS, Or perhaps the focus should be a little narrower. One of the options for closing a question could be to migrate it to a forum area. That way the Q&A isn't polluted with discussion questions and the actually discussion could be isolated to a discussion area.


From  I found the command and it works without any command substitution. But if I try to substitute a variable in the command, I get the following problems.  Note: I am using sed command(BSD OSX) / MacOS  To reproduce just create a file.txt with this:  SOME_TEXT CHANGE_THIS CHANGE_THIS CHANGE_THIS   Add TMP variable in you terminal:  TMP=export PATH=/Users/Name/with pace/and_variables:$PATH   Now with this command:  sed -i '' "1h; 1 $ { x; s/CHANGE_THIS/$TMP/; p; }" file.txt   I get this error:  sed: 1: "1h; 1 $ { x; s/CHANGE_T ...": invalid command code $   In a privious answer I got this("," added to "1,$":  sed -i '' "1h; 1,$ { x; s/CHANGE_THIS/$TMP/; p; }" file.txt      expected output file.txt  SOME_TEXT export PATH=/Users/Name/with pace/and_variables:$PATH CHANGE_THIS CHANGE_THIS   I get this:  SOME_TEXT SOME_TEXT SOME_TEXT SOME_TEXT

I would like to update a large number of C++ source files with an extra include directive before any existing #includes. For this sort of task, I normally use a small bash script with sed to re-write the file.   How do I get sed to replace just the first occurrence of a string in a file rather than replacing every occurrence?  If I use  sed s/#include/#include "newfile.h"\n#include/   it replaces all #includes.   Alternative suggestions to achieve the same thing are also welcome.


I am trying to understand exactly what is userland? everyone that I ask says: "Anything that is not kernel". but it is not tangible for me. When I am reading that kernel can run that driver on the userland or something like that; I can't quite imagine what will happen!. So I will appreciate if someone set me straight in this regard.

Is Kernel space used when Kernel is executing on the behalf of the user program i.e. System Call? Or is it the address space for all the Kernel threads (for example scheduler)?  If it is the first one, than does it mean that normal user program cannot have more than 3GB of memory (if the division is 3GB + 1GB)? Also, in that case how can kernel use High Memory, because to what virtual memory address will the pages from high memory be mapped to, as 1GB of kernel space will be logically mapped?


When on Stack Overflow (a site where I have question-close permission), there appears to be no option to cast a close vote in the Question Options. I can still flag or cast the vote in the browser as workarounds. When I flagged the post, the main site told me that I had cast a close vote instead, a mismatch from the UI.    Android 4.3

Are moderator tools, specifically flagging or voting to close going to be implemented in the Android app? If we have a dispute, we should at least have the flag option.  What about share option? If we would like to share a question, we could long press on the question title, and the question title, excerpt, and short URL copied to clipboard.


I want to generate geometric or Gaussian distributed random numbers without using "geornd" or "randn" functions present in MATLAB library. How can I generate random numbers with those distributions by using only the "rand" function used to generate uniformly distributed random numbers. I want to do this because Uniform distribution is the most basic type distribution and any other distribution can be generated from this distribution. A small code example would be very helpfull..!!

How can I convert a uniform distribution (as most random number generators produce, e.g. between 0.0 and 1.0) into a normal distribution? What if I want a mean and standard deviation of my choosing?


In Minecraft (java) I am making a server with my friend. I'd like to make it so that players can't grief the spawn. Is there any way to make the area indestructible?? I still want people to be able to mine n stuff, but im worried about the spawn getting messed up whether on purpose or not. Please help!!

I am running a Minecraft 1.9 server. I have built a hub and I want to protect it with  but WorldGuard latest version only support Minecraft 1.8.1. I have tried to use the latest version of WorldGuard but it doesn't work.  and EssentialProtect also didn't work for 1.9. So, is there anyway or any plugin can prevent player from greifing certain part of my world?


I have been trying for some time now to get a variable from MySurfaceView to use in my Player class. I cant seem to make it work... I tried getting the touch information from my MainActivity class but it wasn't really where I wanted it and also couldn't seem to make it work. Any help is appreciated!  MySurfaceView.java  package com.Frenchie.SurfaceView;  import ...  public class MySurfaceView extends SurfaceView implements Runnable {      Bitmap bitmap;     SurfaceHolder surfaceHolder;     int LastTouchx;      Player player;      public MySurfaceView(Context context, AttributeSet attributeSet) {         super(context, attributeSet);          player = new Player(context);          surfaceHolder = getHolder();          //Starts the run()         Thread TestThread = new Thread(this);         TestThread.start();     }       @Override     public void run() {         //TODO movement here when display is working         while (true){             Update();             DrawPlayer();         }     }      public void Update(){         player.Update();     }      public void DrawPlayer(){          Canvas canvas = surfaceHolder.lockCanvas();          if (surfaceHolder.getSurface().isValid()) {              canvas.drawColor(Color.BLUE);             canvas.drawBitmap(player.getBitmap(), player.getX(), player.getY(), null);             surfaceHolder.unlockCanvasAndPost(canvas);         }         else{              Log.d("DrawPlayer", "Surface Not Valid");         }     }      @Override     public boolean onTouchEvent(MotionEvent event) {         LastTouchx = (int)event.getX();         //LastTouchy= (int)event.getY();         Log.d("Touch Value ",LastTouchx+"");         return false;     }      public int getLastTouchx() {         return LastTouchx;     }  }   Player.java  package com.Frenchie.SurfaceView;  import ...  public class Player {     //Bitmap to get character from image     private Bitmap bitmap;      //coordinates     private int x;     private int y;      //motion speed of the character     private int speed = 0;      MySurfaceView mySurfaceView;      //constructor     public Player(Context context) {         x = 75;         y = 500;          //Getting bitmap from drawable resource         bitmap = BitmapFactory.decodeResource(context.getResources(), R.drawable.player);     }      //Method to update coordinate of character     public void Update(){          //updating x coordinate          if (x > mySurfaceView.getLastTouchx()){             x++;         }         else if (x < mySurfaceView.getLastTouchx()){             x--;         }         else{              Log.d("Update","Else triggered");         }      }      public Bitmap getBitmap() {         return bitmap;     }      public int getX() {         return x;     }      public int getY() {         return y;     } }   Messages  E/AndroidRuntime: FATAL EXCEPTION: Thread-4     Process: com.Frenchie.SurfaceView, PID: 26348     java.lang.NullPointerException: Attempt to invoke virtual method 'int com.Frenchie.SurfaceView.MySurfaceView.getLastTouchx()' on a null object reference         at com.Frenchie.SurfaceView.Player.Update(Player.java:36)         at com.Frenchie.SurfaceView.MySurfaceView.Update(MySurfaceView.java:68)         at com.Frenchie.SurfaceView.MySurfaceView.run(MySurfaceView.java:62)         at java.lang.Thread.run(Thread.java:762)   This was not a duplicate of the post suggested.

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


I'm writing a very brief description for a job duty. Is it grammatically correct to use two possessive nouns in a sentence (e.g., Administration's and company's)?  Full sentence is... They support, strategize, and promote  the Administration's and company's programs, initiatives, and campaigns.

Which option is grammatical?        There will be readings from Nikki Giovanni’s and Alice Walker’s writings.   There will be readings from Nikki Giovanni and Alice Walker's writings.      Saying it out loud the latter sounds right, but looking at it the former looks better.


Where does Stack Overflow store its data - MySql, CouchDB? And how does the "related questions", shown at every page, work?  Basically I want to know the ontology used here to store the data so that the data is easily accessible, and on what basis it suggests the related questions - using tags?

What tools and technologies are used to build the Stack Exchange Network?  See also:


I run several Ubuntu Servers (virtualized) and have fail2ban installed for DDOS mitigation. For a firewall, each server has iptables.  I'm evaluating my security options and was wondering how well fail2ban protects you from DDOS attacks vs. a dedicated hardware appliance? And, is a hardware firewall going to provide you better/more protection than iptables (or is it just higher up in the stack)?

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


Is there a symbol in LaTeX for ⌘?  More info about it:

Is there a standard way to typeset the special symbols of the Apple Mac keyboard? That is, the curly rectangle ⌘ and the others?  If there is none, what would you suggest as workarounds?


I'm getting a new computer with Ryzen 3900 as processor and Gygabyte X570 UD as the motherboard. I'd like to install Ubuntu. I tried to check for the presence of any compatibility issues and so far I did not find any, but I m still not sure of that. Any advice or recommendation? Thanks for any help!

I have a device on which I would like to install Ubuntu. How do I find out if Ubuntu will work on it?


I have an index function in my views.py (Django project) with a check on a variable from outside the function and I get the following error : "updateValue" is not definedPylance(reportUndefinedVariable)  download_thread = threading.Thread(target=fill_db, name="Database Updater") updateValue = 0  def index(request):     if updateValue == 0:         download_thread.start()     updateValue = 1     context = {}     context['segment'] = 'index'     html_template = loader.get_template( 'index.html' )     return HttpResponse(html_template.render(context, request))   The first updateValue is causing the error. Whe I put the updateValue = 1 as a comment, the first instance in the if works fine. Any idea why this is ?

The following code works as expected in both Python 2.5 and 3.0:  a, b, c = (1, 2, 3)  print(a, b, c)  def test():     print(a)     print(b)     print(c)    # (A)     #c+=1       # (B) test()   However, when I uncomment line (B), I get an UnboundLocalError: 'c' not assigned at line (A). The values of a and b are printed correctly. This has me completely baffled for two reasons:   Why is there a runtime error thrown at line (A) because of a later statement on line (B)? Why are variables a and b printed as expected, while c raises an error?   The only explanation I can come up with is that a local variable c is created by the assignment c+=1, which takes precedent over the "global" variable c even before the local variable is created. Of course, it doesn't make sense for a variable to "steal" scope before it exists.  Could someone please explain this behavior?


I have a google email address that is accepting emails.  But when I try to sign into my Google account and put in my username, it says I have no account.  If I try to create an account with my username, it says there’s already an an account with that username.

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


I have this class which is my thread. By creating instance of the class I create my thread, so by calling its stop method it should be terminated or killed but it wouldn't. I don't know why? I appreciate if someone can help me.   class MyThread(threading.Thread):  # Thread class with a _stop() method.  # The thread itself has to check  # regularly for the stopped() condition.  def __init__(self, last_time=0, start_time=0, label="", root="",  speed_mode=""):      super(MyThread, self).__init__()     self.label = label     self.last_time = last_time     self.start_time = start_time     self.root = root     self.speed_mode = speed_mode     self._stop_event = threading.Event()      # function using _stop function  def start_counter(self):     self.start_time += 1     self.label['text'] = self.start_time     # self.start_time = start_time     if self.start_time < self.last_time:         self.label.after(DIC_TIME[self.speed_mode], self.start_counter)  def stop(self):      self._stop_event.set()  def stopped(self):      return self._stop_event.isSet()  def run(self):     self.start_counter()     while True:         if self.stopped():             return   I expect that by calling stop method of MyThread class my label in tinter canvas restart and stop running(label is a second counter)

Is it possible to terminate a running thread without setting/checking any flags/semaphores/etc.?


I just loaded Ubuntu 19.04 onto my Dell XPS 8500 desktop last week. I am using an AMD Radeon HD 7730 with dual monitors (1 HDMI, 1 DisplayPort). Most of the time when I reboot my system, it will boot to a completely blank login screen. It shows nothing at all, just a blank screen. I have tried the things below and nothing is working. Deleting the raven_dmcu.bin file seemed to work but now I'm having the problem again. If anyone could please tell me how to fix this, I would very much appreciate it. I don't want to have to buy a new video card but I'm going to have to if I can't get this fixed. I have got all other issues on my system worked out except this one. Thanks.  1 - Tried switching monitor 1 and 2 cables and adjusting the display settings to put their left/right orientation back. 2 - I read someones post that said this would work and it did for a while but I'm having the issue again now. Delete the file /lib/firmware/amdgpu/raven_dmcu.bin and then run sudo update-initramfs -u -k all

I am trying to boot Ubuntu on my computer.  When I boot Ubuntu, it boots to a black screen.  How can I fix this? Table of Contents:


I have studying my maths book induction chapter and I found things to solve this but I am failed, somebody help me to solve this problem by simple method of mathematical induction.  $$2^n = {n \choose 0} +{n \choose 1} + \cdots {n \choose n}$$ How to prove it by mathematical induction.

Prove by induction that for all $n \ge 0$:  $${n \choose 0} + {n \choose 1} + ... + {n \choose n} = 2^n.$$  In the inductive step, use Pascal’s identity, which is:  $${n+1 \choose k} = {n \choose k-1} + {n \choose k}.$$  I can only prove it using the binomial theorem, not induction.


If I upgrade Ubuntu from an EOL version to a supported version will my data will lost?

I am planning to upgrade from 8.10 to 10.04. But I am wondering whether there will be data loss during the upgrade.  For example:   Will the applications that I have installed on 8.10 still be there after upgrade? Will the settings of application such as the bookmarks for Firefox and for Google Chrome be preserved? Will all the personal files under my home directory be preserved?   Is there anything else I need to know about upgrading?


I have a handful of Mac's running Mavericks and up. Each Mac is generally used by 1-3 people.  Each person is a member of a specific AD group.   Pre-deployment we added that AD group to the "Allow Administration By" field with "domain\groupname" format. Pre-deployment and shortly after deployment, the end users were able to administer the Macs without issue.  They could escalate processes with their credentials.  Since then, none of the Macs recognize our users as administrators anymore, myself included (I'm in a separate AD group membership that was added at the same time).  We then started going into each user profile and checking the "Allow user to administer this computer" checkbox, which again worked for a time but no longer does.  We have started falling back on the local administrator user account to manually authenticate when needed, but we're not able to share that password with end users.  The following link is what I used for reference:   Is there something we're missing?  Why would the administrative behavior work for a time then just stop?  Edit: This is not a duplicate to . I have tried all of the steps outlined in the link I originally referenced.  The key issue is that I do actually get local administrator privileges for a short period, but then for some unexplained reason, all users but administrator lose their privileges and no longer escalate privileges.

I'm looking for a way to add an Active Directory user to a Mac and let them administrate the machine, without making more than just that user an administrator.  Right now, I'm using Directory Utility to add an AD group, we'll call it Domain Devs, to the Allow Administration By: list. This would allow Bob, Nancy, Paul, and Bill to administer the computer. But this machine is supposed to go to Bob, so I only want him to administrate it. I then have to go to the login options and tell it to only allow Bob to log into the computer.  So while Bob, Nancy, Paul and Bill can administer it, only Bob can log in.  There is a concern that other users will be able to log into or gain access to the machine through another method of login or security breach and have administration rights to the system.  We're looking for a way to do something similar to what happens in Windows when you take a user in AD and add that specific user to the local Administrators group, so Bob could be added to that specific computer and have admin rights and any other domain user can log in and have just limited user rights.  Is there a way to do this, add a specific AD user to the Mac as an administrator without using a group in AD with just that user in it?


This is NOT a duplicate question.  I need some help computing the integral  $\int_{\mid z\mid =r} xdz$  But I really want to use the fact that   $x=\frac{1}{2}(z + \frac {r^{2}}{{z}})$ when the circle is oriented counter-clockwise in the integral.  Should I just plug that into the integral? I have seen the similar question to this and understand how to use parameters to get that the integral equals $r^{2}i\frac{\pi}{2}$.  However, I am interested in using the fact mentioned above, which requires a different method than the solutions already discussed on this site, so it is not a duplicate. How would I go about this?

I some help computing   $$\int_{|z|=r} x \, dz$$  by noting that $x= \frac{1}{2}(z+\bar{z}) = \frac{1}{2}(z+\frac{r^{2}}{z})$ on the circle but I don't understand why this is true. Why does the complex conjugate of $z$ equal this on the circle?


I need help to define the csc function to display as cosec. I've tried \textrm{cosec} \theta, but this does not give the same output as \sin \theta, because the space between the theta and the function is closer for cosec.  Any other better solution?  Thanks in advance.  Regards, James

I'd like to declare some new operators using \DeclareMathOperator and some of the names are already taken by other commands (that I do not want to use). Is there an equivalent to the \renewcommand command for \DeclareMathOperator or a different way to overwrite the commands using \DeclareMathOperator?


I have a bootable CD image that I would like to transfer to a USB stick, so that I can boot from it. The Startup-Disk creator doesn't support it. How can I make a bootable USB disk from it? The ISO is quite old so that might be a problem.

I want to burn a Windows ISO to a USB device in Ubuntu. How do I do this?   I know how to burn a Ubuntu ISO into a USB device, but with a Windows ISO it's not the same.


So, this code works with XeLaTeX  \documentclass[12pt]{book} \pagestyle{plain} \usepackage[margin=1.8cm]{geometry} \geometry{a4paper} \usepackage[parfill]{parskip} \usepackage{amsmath} \usepackage{amssymb} \usepackage{tipa} \usepackage{fontspec} %\newfontfamily{\AR}[Script=Arabic]{Scheherazade}  \AtBeginDocument{   \renewcommand\textipa[2][r]{{\fontfamily{cm#1}\tipaencoding #2}} }  \renewenvironment{IPA}[1][r]  {\fontfamily{cm#1}\tipaencoding}  {}  \begin{document} %\textipa{\slshape pUK.t\~A} \textipa{\slshape f@"nEtIks}  \textipa[tt]{f@"nEtIks}  \begin{IPA}f@"nEtIks\end{IPA}  \begin{IPA}[tt]f@"nEtIks\end{IPA}  \begin{IPA}\slshape f@"nEtIks\end{IPA}  \end{document}   But when I uncomment the line  %\textipa{\slshape pUK.t\~A} just after the \begin{document}, it no longer compiles. How should I correct it?

I'm trying to write a document that will contain characters in many different scripts (for which I am using fontspec and rendering with xelatex) and IPA symbols (for which I am using TIPA). Ordinarily, this works fine, however, I want to use slshape for my IPA symbols. If I take the manual's advice and use  \textipa{\slshape f@"nEtIks}   Or  \textipa{\textsl{f@"nEtIks}}   It fails with fontspec loaded. The document renders properly, but the IPA symbols appear upright. If I remove fontspec, then this works correctly, with the IPA symbols slanted. I tried getting fontspec to use tipasl12, but I could not find a way of allowing fontspec to use the font. However I named it, fontspec could not find the font.  This is the LaTeX I have which produces the correct IPA symbols, but they appear upright:  \documentclass[12pt,openany]{book} \pagestyle{plain} \usepackage[margin=1.8cm]{geometry} \geometry{a4paper} \usepackage[parfill]{parskip} \usepackage{amsmath} \usepackage{amssymb} \usepackage{fontspec,xltxtra,xunicode} \newfontfamily{\AR}[Script=Arabic]{Scheherazade} \usepackage{tipa}  \begin{document}    \textipa{\slshape f@"nEtIks}  \end{document}   The following, however, works perfectly, but - obviously - would not allow me to use Arabic characters:  \documentclass[12pt,openany]{book} \pagestyle{plain} \usepackage[margin=1.8cm]{geometry} \geometry{a4paper} \usepackage[parfill]{parskip} \usepackage{amsmath} \usepackage{amssymb} %\usepackage{fontspec,xltxtra,xunicode} %\newfontfamily{\AR}[Script=Arabic]{Scheherazade} \usepackage{tipa}  \begin{document}    \textipa{\slshape f@"nEtIks}  \end{document}


Something happened, and now the explorer.exe is acting strange. For example, I have a mirc.exe startup when the system boots. Window with this program immediately freezes. Also icons in the tray do not change their state.    P.S. I tried to reboot my PC and shutdown him.  P.S.S. It's interesting that the safest mode looks good.  P.S.S.S. Problem solved. Thank you all for your help.

I installed Windows 7 in a 3-year-old machine. It installed successfully, took all drivers and running great, but every 5-6 minutes it freezes for a few seconds... 30 seconds to 1 minute, and then it comes back alive.  I checked Event Viewer, but nothing matched the frozen timeline.  I would appreciate any help on how to detect what is causing it, service or hardware.  After it comes alive, everything runs normal. I did run Task Manager and checked CPU usage, at the time it freezes just before and after that no task took more CPU or memory. It was like an idle machine.  There aren't any external USB drives or devices. It is an on-board Intel desktop board with SATA HDD, and the SATA HDD is running in absolute good mode.


To be honest, I didn’t have any meaningful ideas on how to approach this problem. I thought that applying L’Hospital’s rule (if we rewrite it just a bit we get 0/0 in limit). However, derivative appeared to be ugly and not helpful. Any insights on how to solve it?

Let $x>0$, find the limit $$\lim_\limits{n\to{\infty}}{n^2\left(\sqrt[n]{x}-\sqrt[{n + 1}]{x}\right)}$$  I use Maclaurin series and find out that the limit is $\ln x$. And this is the answer I get from a math forum:  "Let $x_n=\sqrt[n]{x}-1$, $y_n=\dfrac{1}{n}$, then $(x_n)\to0,(y_n)\to0,(y_n)\downarrow$ when $n\to\infty$.  Use Stolz-Cesaro theorem, we have:  $$\mathop {\lim }\limits_{n \to \infty } \dfrac{{\sqrt[n]{x} - \sqrt[{n + 1}]{x}}}{{\frac{1}{n} - \frac{1}{{n + 1}}}} = \mathop {\lim }\limits_{n \to \infty } \dfrac{{\sqrt[n]{x} - 1}}{{\frac{1}{n}}} = \ln x$$ Then $\mathop {\lim }\limits_{n \to \infty } {n^2}\left( {\sqrt[n]{x} - \sqrt[{n + 1}]{x}} \right) = \mathop {\lim }\limits_{n \to \infty } \dfrac{{{n^2}}}{{n\left( {n + 1} \right)}}\cdot\dfrac{{\sqrt[n]{x} - \sqrt[{n + 1}]{x}}}{{\frac{1}{n} - \frac{1}{{n + 1}}}} = \ln x$.  /END"  I just wonder what form Stolz-Cesaro theorem that he used, because I just learn Stolz-Cesaro theorem when $(y_n)\to\infty$.  Could anyone help me to get this? Thank you in advance.     This is "another form of Stolz theorem" in the forum that I mentioned: Let $(x_n),(y_n)$     be two sequences of real numbers. Assume $\mathop {\lim }\limits_{n \to \infty } {x_n} = \mathop {\lim }\limits_{n \to \infty } {y_n} = 0$; $y_n>0$, $(y_n)$ is strictly decreasing  and the following limit exist $\mathop {\lim }\limits_{n \to \infty } \dfrac{{{x_{n + 1}} - {x_n}}}{{{y_{n + 1}} - {y_n}}} = L$. Then $\mathop {\lim }\limits_{n \to \infty } \dfrac{{{x_n}}}{{{y_n}}} = L$. Is this correct?


If two of the 64 squares are slected at random on a chessboard, the probability that they have a side common is..... .   Attempt  Choosing the corner side and the required square is ${{4_{C_1}}*{2_{C_1}}}$  Choosing 4 corner sides remaing squares and the other required square is ${{24_{C_1}}*3}$  And other remaing squares ${36*4}$  And the total selection is ${64_{C_2}}$  But the probability is $\frac{1}{18}$ and I am getting $\frac{1}{9}$. Why?  I have seen the same question on math stack exchange but was not able to connect to it. Also they don't answer the question that why my method has not been able to given the correct answer.  the answer given there by the user Jack  just states for numerator and says to divide it rather than explaining why to do it.  Thanks for the help.

Two squares are chosen at random on a chessboard. What is the probability that they have a side in common? I have got the total no of events by using 64 C 2. But I am unable to find the numerator(no. of favorable events).


Sometimes, I come across this weird usage of the definite article with the word 'Ukraine'. Keep in mind, it's a peer-reviewed scientific journal. Is it grammatical, and what is the origin of this unusual practice?  As this paper will show, states such as Georgia, the Ukraine and the Baltic States have been punished with supply interruptions and higher prices after their governments turned toward the West.  (from )

Citizens of the Lithuania, sounds wrong. Citizens of the Russia too. However, citizens of the Ukraine, sounds right. Also of the United States (of America) as well as of the United Kingdom.  What is the proper usage of 'the' to name a country?


I am aware that there is number of similar posts. The error, as i understand, means that i should be more specific with types. My code:  import java.util.*; public class Storefront {     private  LinkedList<Item> catalog = new LinkedList<Item>();      public void addItem(String id, String name, String price, String quant) {          Item it = new Item(id, name, price, quant);          catalog.add(it);     }      public Item getItem(int i) {             return (Item)catalog.get(i);     }      public int getSize() {          return catalog.size();     }      //@SuppressWarnings("unchecked")     public void sort() {         Collections.sort(catalog);     } }   However, I do specify that LinkedList consists of objects of type Item. When i compile it with -xlint, i get     warning: unchecked method invocation: method sort in class Collections is applied to given types Collections.sort(catalog);  required: List'<'T'>'  found: LinkedList'<'Item'>'  where T is a type-variable: T extends Comparable'<'? super T'>' declared in method  '<'T'>'sort'<'List'<'T'>'>     As i understand, LinkedList implements List and Item implements Comparable. So, aren't 'required' and 'found' same?  Also I was checking if catalog.get(i); is actually an Item (as, some say it may have caused the problem), but it produced the same error.

For example:  javac Foo.java Note: Foo.java uses unchecked or unsafe operations. Note: Recompile with -Xlint:unchecked for details.


I need to add %200 at the end if "address 1.1.1.1". I am using bash on linux if someone can let me know.   Current  ltm node /test/10.90.0.1 {     address 10.90.0.1 } ltm node /test/10.90.0.12 {     address 10.90.0.12 }  ltm node /test/10.90.0.50 { address 10.90.0.50       }   Desired, with insertion of %200  ltm node /test/10.90.0.1 {     address 10.90.0.1%200 } ltm node /test/10.90.0.12 {     address 10.90.0.12%200    } ltm node /test/10.90.0.50 {     address 10.90.0.50%200 }

I have a code block as follows in a file:  BalancerMember http://snode1:80 min=1 max=1000 loadfactor=1  timeout=30 keepalive=on route=tc_snode1 BalancerMember http://snode2:80 min=1 max=1000 loadfactor=1  timeout=30 keepalive=on route=tc_snode2   I want to search for all lines which had tc_ keyword and add status=D at the end of those lines. So, the above entries will become like this  BalancerMember http://snode1:80 min=1 max=1000 loadfactor=1  timeout=30 keepalive=on route=tc_snode1 status=D BalancerMember http://snode2:80 min=1 max=1000 loadfactor=1  timeout=30 keepalive=on route=tc_snode2 status=D   I am using the following command to achieve this:  sed -i '/tc_/a status=D' app.conf   But I can see status=D is being after a newline. I don't want a newline for this. It should be appended with a '' (space) .


Try it yourself. You can't downvote comments. Why? I'm really frustrated when I see tons of crappy comments. They meet the minimum requirement -- no insult, no cursing, just without quality. Not helpful. Not constructive. A waste of space. I wanted to downvote them, but there's no downvote button. Why?

Answers and questions allow both upvoting and downvoting - comments, however, only allow upvoting.  I think it would be useful to allow downvoting of comments for two reasons:   First, if you accidentally upvoted a comment you didn't intend to Second, if you strongly believe that a comment is , misleading, incorrect or off topic


The resistance is attacks the Starkiller Base with what appears to be pretty small time ammunition even by modern earth missiles, which requires a long running sequence of repeated flybys.  The objective, IIRC was to destroy a critical piece of machinery on the surface which would then destabilize the entire planet/weapon (feel free to correct in edit if I remember incorrectly).  OK cool, but then why the force wouldn't they just drop a nuclear bomb on it?  Have nuclear weapons been used any other time in Star Wars (including EU), or, like smart phones, have they just not been invented in that world?

I am reading the book Darth Plagueis, and when an assassination attempt is made on him by use of a nuclear bomb, the book states that nuclear weapons are scarcely available.   I searched briefly but found nothing on this and wondered if an explanation is available. Why would nuclear weapons be rare in a universe with such advanced technology across the board?


I have Crucial 8GB 2133MHZ DDR4 Desktop Memory inside my computer currently, and want to buy a 16GB kit, should I just add the new memory to the computer? It has 4 DIMM Slots, this is my computer stats:    The RAM I want to buy is the same as the RAM that's already in.  Would it be compatible to just add 2 more sticks?   Just want to know if its fine if I just install the 16GB Kit without changing anything, also is there a specific way it should be installed? Sorry for the stupid question, just always scared of buying expensive products

If I want to add more RAM to my computer, how can I buy something compatible? What kinds are there? How do I determine which kind my computer will accept and how much I can add?


I am not sure that there is an answer to this question, but I try.  I am writing two papers; in the second I often reference to some equations reported in the first: how can I use \eqref and \label so I do not have to track all the changes in the numeration of the equations?  The papers are separated documents, I am not using \input to merge them in one file (like one does with thesis' chapters for example).  EDIT In , the OP sais:     I have a main document (manuscript) and a supplemental   document.   But, as I said, my papers are separated files, there are no main document and supplement document.

I have a main document (manuscript) and a supplemental document.   I wonder if there is a way that I can "link" the two (make them recognize each other) so that section, equation, and figure references across documents are recognized?


I've recently been puzzled by a question that I hope you can help me figure out. I heard about Zeno's Paradoxes a while back, and I recently asked myself something which is similar but not quite the same.   Assume we have a car, or some object starting at rest with respect to some coordinate system. In order for this object to move its position, it has to gain first some velocity; however, this in turn requires some acceleration. Now, I know that force is all that is needed to accelerate some object because $F = ma$, but an applied force doesn't go from $0$ to something nonzero instantly, right? So there must be some other $dF/dt$ that depends on some other variable $G$, and that $G$ would also have some dependency $dG/dt$ on some other variable and so on:  \begin{align} dx/dt &= v \\ dv/dt &= F/m \\ dF/dt &= G \\ dG/dt &= H \\ \end{align}   how can there be motion if this system of ODEs can be made arbitrarily long? Since I am able to move objects, does that mean that the system of ODEs caps at some higher order derivative? If so, which one?

This might be a very vague and unclear question, but let me explain. When an object at rest moves, or moves from point $A$ to point $B$, we know the object must have had some velocity (1st derivative of position) during that trip. It's also true that the object had to have accelerated to gain that velocity (2nd derivative)... if we extend this argument, is it logical to say that the object must have experienced jerk (3rd deriv.) to gain that acceleration? And so on and so forth... 3rd, 4th, 5th position derivatives? Or is my logic flawed somewhere?


When I try to download 'playonlinux' I get:   The following packages have unmet dependencies:  playonlinux : Depends: icoutils but it is not installable                Depends: curl but it is not installable E: Unable to correct problems, you have held broken packages.   And I also can't install literally anything else.

Occasionally, when I'm installing stuff, I get an error like the following:  Some packages could not be installed. This may mean that you have requested an impossible situation or if you are using the unstable distribution that some required packages have not yet been created or been moved out of Incoming. The following information may help to resolve the situation:  The following packages have unmet dependencies:  package1 : Depends: package2 (>= 1.8) but 1.7.5-1ubuntu1 is to be installed E: Unable to correct problems, you have held broken packages.   How can I resolve this?


I have a string which I want to insert an other string into. For this I use the method string.Format() but it doesn't work since my basestring include {-signs. As soon as I remove them from my string the code works fine.   string baseString = "This is my base string and when it includes {-signs it {0}.";  string insertString = "doesn't work";  string completeString = string.Format(baseString, insertString);   Does someone have a glue about why it doesn't work?

How can brackets be escaped in using string.Format? For example: String val = "1,2,3" String.Format(" foo {{0}}", val);  This example doesn't throw an exception, but it outputs the string foo {0}. Is there a way to escape the brackets?


This is my code in java netbeans. I want to display the username get  from another form in label and there is errer ...    String username1;   public agent_menu(String username1)  {    this.username1=username1;    System.out.println("user: "+username1);       jLabel1.setText(username1);    }   the error:  user: 22 java.lang.NullPointerException

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?


From a long time, I have a question that bicycle is not stable at low speed or for that matter it's difficult to balance bicycle on its wheels in static position (with zero speed and no brakes). Can this be explained by physics

Why does a bike/bicycle fall when its speed is very low or close to zero and is balanced when going with a high speed?


I am wondering if there is a method or format string I'm missing in .NET to convert the following:     1 to 1st    2 to 2nd    3 to 3rd    4 to 4th   11 to 11th  101 to 101st  111 to 111th    has a bad example of the basic principle involved in writing your own function, but I am more curious if there is an inbuilt capacity I'm missing.  Solution  Scott Hanselman's answer is the accepted one because it answers the question directly.  For a solution however, see .

Is there an easy way in C# to create  for a number? For example:   1 returns 1st 2 returns 2nd 3 returns 3rd ...etc   Can this be done through String.Format() or are there any functions available to do this?


I am writing a program to convert 24-hour time to 12-hour time. Output for 0:00 & 12:00 is faulty.  Please refer to the code and the sample input and output.    #include <stdio.h>  int main(void)       int hour;      int min;       printf("Enter a 24-hour time: ")      scanf("%d:%d", &hour, &min);       if (hour < 11)           printf("Equivalent 12-hour time: %d:%d AM\n",                      hour == 0 ? 12 : hour, min);       else          printf("Equivalent 12-hour time: %d:%d PM\n",                      hour == 12 ? 12 : hour - 12, min);       return 0; }    When I input 12:00 ; the output is 12:0 PM When I input 0:00  ; the output is 12:0 AM  How can I fix this?

I'm trying to find a good way to print leading 0, such as 01001 for a . While the number would be stored as 1001, what is a good way to do it? I thought of using either case statements or if to figure out how many digits the number is and then convert it to an char array with extra 0's for printing, but I can't help but think there may be a way to do this with the printf format syntax that is eluding me.


I can barely remember the details but here it goes. Aliens were about to destroy earth and kill all humans so a group set out to escape to another planet so human kind could survive. They land on another planet and are left without technology and fight animals that come at night with sticks. They move into a large cave and over many many generations they pass down knowledge and stories to the children and eventually build a ship and go to the alien planet to kill them. The humans were set on revenge. One other detail I remember was there were these small animals that at first the humans did not get along with and over many generations they eventually found the animals to be telepathic and were friendly. This has been eating at me for days, what is this book?

I'm trying to find a short story that I read years ago.  There were a group of humans marooned on a high gravity planet by an alien species.  On the planet they encountered saber-tooth cat-type animals that they eventually became allies with. There were also telepathic squirrel-like creatures that allowed them to communicate over distance.  The aliens that marooned them returned generations later, but the high gravity and hardships of the planet made the offspring of the original humans become superior warriors, which allowed them to destroy the aliens.


Although this code compiles successfully, it throws a class cast exception error at run-time:  class Test {     public static void main(String[] args) {         MyArray<String> x = new MyArray<>();         x.a[0] = "test string";     } }  class MyArray<T> {     T[] a;      MyArray() {         this.a = (T[]) new Object[1];     } }   The error message:  Exception in thread "main" java.lang.ClassCastException: [Ljava.lang.Object; cannot be cast to [Ljava.lang.String;     at Test.main(Test.java:4)   One possible, yet simple, solution I know of is to declare the array as an array of type Object and then just cast an array element back to T when you want to retrieve it from the array, like this:  class Test {     public static void main(String[] args) {         MyArray<String> x = new MyArray<>();         x.a[0] = "test string";         System.out.println(x.get(0));     } }  class MyArray<T> {     Object[] a;      MyArray() {         this.a = new Object[1];     }      T get(int index) {         return (T) a[index];     } }   This works just fine. But the problem with this approach though is that I can now put absolutely anything in the array and yet keep it there safe and sound until such time as I try to pull it out of the array which will give me a big, fat class cast exception error!      MyArray<String> x = new MyArray<>();     x.a[0] = 34;     System.out.println(x.get(0)); // run-time error   This is what we'd get if we ran this piece of code:   Exception in thread "main" java.lang.ClassCastException:   java.lang.Integer cannot be cast to java.lang.String     at Test.main(Test.java:5)   Obviously, it's a lot better when all your array elements are of the same type as opposed to being generic objects of type Object. There's gotta be a way to do that.  By the way, the example code I presented here has been significantly simplified. I know that I can use set and get methods that can do the necessary type casting which, of course, will help make it completely safe to add and get elements in and out of the array. The problem with this is that if I have lots of other methods in the class that also do a lot of casting, the tedium of writing all those cast operators becomes a real pain. I thought it'd be really nice if I could just store all the elements in the array as a certain type from the word go. This would simplify the coding process and make code much cleaner and easier to read. So, any words of wisdom you wanna pass my way are most welcome and going to be much appreciated.

Due to the implementation of Java generics, you can't have code like this:   public class GenSet<E> {     private E a[];      public GenSet() {         a = new E[INITIAL_ARRAY_LENGTH]; // error: generic array creation     } }   How can I implement this while maintaining type safety?  I saw a solution on the Java forums that goes like this:  import java.lang.reflect.Array;  class Stack<T> {     public Stack(Class<T> clazz, int capacity) {         array = (T[])Array.newInstance(clazz, capacity);     }      private final T[] array; }   But I really don't get what's going on.


ArcGIS is one of the most popular software-packages available for GIS.  What are the lesser-known but useful features of the ArcGIS? Which little/hidden tricks do you known that make your experience with this software better?

A couple times a month, I check out the  and always learn something new. I went back and forth as to whether to pin this question to a specific program of a specific, major version of GIS software.  Given the amount of change to the ux, I think ArcGIS Desktop 10 should get its own Tips and Tricks question and will be a great resource for new ArcGIS users and ArcGIS 10 users upgrading from 9.3. Hope to see some good tips that aren't already covered in the . ArcMap  If the File menu is slow to open: open Customize window, navigate to the file menu, and delete the { Sign in } menu item.  Revert to old(classic) snapping environment: see


They look like this:    If I hit them they explode and then reform, and they appear to spit out a bit of blood.

I've noticed that occasionally if I shoot at (or near) the glowing red pillars they will kind of explode a bit for a second and then reform. Does this affect my attacks in any way? What about nearby enemies? Is this purely cosmetic (like pillars in other dungeons crashing down)?


my application is running over jdk 1.8 32 bit, windows 7. Recently we had few windows and mcafee updates. I am using - xmx 1400m and - xms 1400m. Once the updates have been installed, I started to have problems with running the application. Jvm says: VM Could not reserve enough space for {size}KB object heap  Note that every 6 or 7 times it starts the application without error.

I've always been able to allocate 1400 megabytes for Java SE running on 32-bit Windows XP (Java 1.4, 1.5 and 1.6).  java -Xmx1400m ...   Today I tried the same option on a new Windows XP machine using Java 1.5_16 and 1.6.0_07 and got the error:  Error occurred during initialization of VM Could not reserve enough space for object heap Could not create the Java virtual machine.   Through trial and error it seems 1200 megabytes is the most I can allocate on this machine.  Any ideas why one machine would allow 1400 and another only 1200?  Edit: The machine has 4GB of RAM with about 3.5GB that Windows can recognize.


I'm trying to make a website which is similar to this . I would like to know how to get the video in the middle of the page. My code looks like this.  iframe {     width:240px;     height:160px;     align: middle;  }   I've also tried this:  iframe {     width:240px;     height:160px;     margin-left: auto;     margin-right: auto; }   But nothing seems to be working.

How can I horizontally center a
 within another
 using CSS?

Foo foo


When clicking on the "review" tab today, I saw the following message:     You have failed too many recent review audits – looks like you might need a break. Come back in 4 days to continue reviewing.   While I suppose I don't mind taking a break, I don't particularly remember failing any audits recently, so I'm not really sure why I've been banned.  Is there any way to check what behaviors might have gotten me banned so I can (at the very least) avoid doing whatever it is I did in the future?

Since we got  as a mod (yay!), lots of people have been getting review banned (and rightfully so).  Many of these people come to Meta to complain/ask about it. When they do, they seem to be thrown off by the current reason that shows up:     You have failed too many recent review audits, ...   This is misleading at best, and plain wrong at worst - it should say something like:     Your reviews were found to be not satisfactory by a moderator, come back in x days.   And, if possible, allow the moderator to leave a custom message telling the user why they were banned - if I was to be banned, I would really like to know why without coming to Meta.  Thoughts?


I want to validate phone number with javascript, so far i have regex that looks like this:   /^[0-9\+]{8,13}$/   But it is not what i finally wanna get.  I need get phone number format that is default for my country "Poland". For example few phones formats i need check with regex if user correctly passed them: 321123321, 123-321-123, 123 321 123, 123211212, 12-321-12-12, 12 321 12 12.  Sorry if my question is silly but i have no idea how to understand this regex.

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


I have a     var  itemList = new List<Item>()    and a     var  searchSet = new HashSet<TestItem>(new TestItemComparer());   For each element in the itemList I look for its existance in the searchSet via the Number property.  I search like this: ( The item.Numer is an enumerated element of the itemList)  var isFound = searchSet.Contains(new TestItem{ Number = item.Numer });   public class TestItemComparer: IEqualityComparer<TestItem>     {         public bool Equals(TestItem x, TestItem y)         {             return x.Number == y.Number;         }          public int GetHashCode(TestItem obj)         {             return obj.Number.GetHashCode();         }     }   The reason why my searchSet has a comlex type TestItem and not integer is because I still want to combine my search with some other properties on the TestItem class.  How can I still use this amazing fast HashSet.Contains method but combine the Number search with other properties?  Should I change my TestItemComparer for this?

In .NET, the  is used in a lot of places throughout the .NET base class libraries. Implementing it properly is especially important to find items quickly in a collection or when determining equality.  Is there a standard algorithm or best practice on how to implement GetHashCode for my custom classes so I don't degrade performance?


What's the name of the property that $0 \cdot x = x \cdot 0 = 0$ for all $x \in \mathbb{R}$?  I suppose it would be some group theoretic name but I can't recall it and I've searched everywhere, it wouldn't be the identity nor an inverse, so I'm at a loss.

Is there a general name for the following properties, (similar to the properties of existence of an additive identity, existence of multiplicative identity etc):   For any given set, the intersection with the empty set results in the empty set. For any real number, multiplication with zero results in zero.


Let $X$ be an infinite set and $Y$ a finite or countable set. Prove that $|X \cup Y| = |X|$.   The form to prove this is by finding a bijection between both sets $X \cup Y$ and $X$. I got a hint to use the property that every infinite set has a finite or countable subset. My problem is how to define this bijection. Any ideas?

I am trying to prove: If A is an infinite set and B is at most countable set, prove that A and $A \cup B$ have the same cardinality.  Set definitions here are from baby Rudin.   Attempt: There are 4 possible cases:  1.A is countable and B is finite.  2.A is countable and B is countable.  3.A is uncountable and B is finite.  4.A is uncountable and B is countable.  Then for each case I need to show that $A \cup B \sim A$. I can prove 1-3, but I am unsure how to prove case 4. And in general, it seems that my proof strategy is inefficient and there exist much faster proof then proof by cases.


The energy of Hydrogen electron ground state should depend on $n$ and $\ell$, but it only depends on $n$. What is the reason behind this accidental degeneracy; I know that the reason lies in symmetry; but can someone explain me in simple terms. PS: I do not have knowledge of Group Theory!

Is there a good physical picture of why the energy levels in a hydrogen atom are independent of the angular momentum quantum number $\ell$ and $m$?


Hi stumbled upon this interview question: There are 4 green and 50 red apples in a basket. They are removed one-by-one, without replacement, until all 4 green ones are extracted. What is the expected number of apples that will be left in the basket?  At first I thought it was 0, because there is always a chance for a green apple to be left in the basket, however since they are asking for the expected number of apples left, it actually makes sense that the number is positive. I found out that the answers is most likely 10, from various websites, however there is no solution anywhere. I have been trying to approach it with probabilities and with combination, however no luck so far. Some hints or a solution will be much appreciated.

We have 4 green apples and 60 red apples. Each time we pick one out without replacement. Then what is the expected number of red apples left when all 4 green apples are picked?


When I create a website for my clients, I always by default add the following to the footer:
        Website by
    Is what I am doing actually damaging me or my clients by anyway? I have researched and read few articles but they all are full of arguments and I really don't know which answer is right... also is it true - no-follow attribute need to be added?

I read somewhere that web designers' habit of placing a default "follow" link in the footer of their client websites is bad for SEO.  Is this true?  If so, should we use rel="nofollow" instead.  I have seen rel="designer" in some free WordPress themes.


Let's say I spend some time drawing this picture:    And after a few paragraphs I want to draw the same picture plus some "spices".  Of course I could just copy-and-paste the code, then edit the few things I want to change. But this turn the LaTeX code messy, as my figure repeats over and over!  Question  How could I use the previous code of a tikzpicture without copying it over and over?  NOTE: There is no caption!

Suppose I have a complex figure made with TikZ. How do I use it several times without having to repeat all the commands?  \documentclass{article} \usepackage[utf8]{inputenc} \usepackage{tikz}  \begin{document}  Base figure  \begin{tikzpicture}   \draw[blue] circle (2);   \foreach \i in {0,10,...,350}     \draw[blue] (\i:1.9) -- (\i:2.1); \end{tikzpicture}  Using base figure.  \begin{tikzpicture}   \draw[blue] circle (2);   \foreach \i in {0,10,...,350}     \draw[blue] (\i:1.9) -- (\i:2.1);   \foreach \i in {0,10,...,350}     \node at (\i:2.7) {\tiny $\i^\circ$}; \end{tikzpicture}  Using base figure.  \begin{tikzpicture}   \draw[blue] circle (2);   \foreach \i in {0,10,...,350}     \draw[blue] (\i:1.9) -- (\i:2.1);   \foreach \i in {0,10,...,350}     \draw (0,0) -- (\i:2); \end{tikzpicture}  \end{document}


I use nautilus as my default file manager. Is there any way that I can customize it so that right click anywhere in the window gives an option to open the current directory in terminal. I have seen same feature in dolphin, wish I could do the same in nautilus too.

I am working on Ubuntu 12.04 64bit.  I want to add "Open terminal here" to Nautilus context or right-click menu but it tries to download 32bit version from Internet.


I have a "bus error" in the way I program. I am learning how to make a client /server with chained list. The error bus comes only when I return parse_message (...) = NULL..   The listen_client function is in a thread, I do not know if it affects the error. If you want more details / other piece of code ask me.  Thank you and good evening.  static t_message    *parse_message(char *buffer) {     int     id;      id = atoi(buffer);     printf("ID: %d\n", id);     return (NULL); // for sample } static char     *read_message(char *data) {     static char     *buffer = NULL;     char            *message = NULL;     char            *ptr;     size_t          size;      size = strlen(data);     if (buffer)         size += strlen(buffer);     if (!(buffer = realloc(buffer, size)))         return (NULL);     strcat(buffer, data);     if ((ptr = strstr(buffer, "\r\n")))     {         size = (ptr - buffer);         if (!(message = (char*)malloc(sizeof(char) * (size + 1))))             return (NULL);         strncpy(message, buffer, size);         ptr += 2;         if (!(*ptr))             buffer = NULL;         else if (!(buffer = strdup(ptr)))             return (NULL);     }     return (message); }  void            listen_client(t_args *args) {     ssize_t     count;     char        buffer[BUFF_SIZE + 1] = { 0 };     char        *msg_str;     t_message   *msg;      while ((count = recv(args->client->s, buffer, BUFF_SIZE, 0)))     {         printf("===> %s\n", buffer);         if (!(msg_str = read_message(buffer)))         {             continue ;         }         if (!(msg = parse_message(msg_str)))         {                // bus error after continue ;             continue ;         }         handle_message();     }

What does the "bus error" message mean, and how does it differ from a segfault?


When I take a picture through a window, I often see a reflection on the glass. I have noticed that this occurs mostly when it is dark or overcast outside or it is especially bright on my side of the glass. How can I stop this?

I find that I take a lot of pictures through skyscraper and vehicle windows (those that are impractical or impossible to open). There are all kinds of problems with taking photographs through windows: reflections from light inside, dirt on the window, etc. My technique mostly involves placing the lens directly on the window glass and shielding it from lights reflecting from above.   Are there any non-obvious gizmos / techniques for easily shooting through windows? I've heard that a polarizing filter might be used in this situation, but I don't carry one around most of the time. Besides, most of the pictures I am interested in taking are in low light situations (at sunset or in a moving train, etc).


I am travelling from US to Bangalore (INDIA) via Canada, in Canada I have to change the flight from Air Canada to Ethihad airways and have layover time of 3 hours. I'm an Indian citizen. Do I need a Canada transit visa? I don't want to visit Canada.

Passport : Sri Lankan Holding a valid US Visa (F1). Spending only 3.15 hours at Toronto Airport. Flying in through United and leaving to my next layover (London) in Air Canada.


I removed the OS X partition off my HDD and installed Ubuntu. Now I want OS X back but I can't install it considering I have no access to Mac OS X. I need either an OS X Snow Leopard or OS X Lion .iso so I can put it on an installer USB.

Sometimes it's hard to search for older versions of macOS & OS X  on the App Store.  This is an attempt to provide the canonical QA for this issue, as per the Meta QA -  I expect it to be modified over time to hopefully become a complete information resource.  How can I get any older version of a Mac OS to be able to run as a VM, or to reinstall on my Mac?


One thing, I'm not a mathematician so please be patient. I am still in Algebra II Trig. Leading with that, why does  $$ x_0 = \sin 1, \space  x_1 = x_0 + \sin x_0, \space x_2 = x_1 + \sin x_1 ... $$ and after a while, $$ x = \pi $$  I know this to be true because I have evaluated this on my TI-84 and more deeply evaluated it with this program I made:   To $100000$ Iterations (which I believe is enough)   So what's the math behind it? Why does adding $\sin 1$ in this manner produce $\pi$? Why doesn't doing the same thing using $100$ produce $\pi$? For example,  $$\sin(1) = 0.841470...,\space \sin(1) + \sin(0.8414...), \sin(1) + \sin(0.841470...) + \sin(1.587095126...),\space ... $$ $$ = \pi$$  My question is different from the mentioned because my function is not taking the sin of a sin consecutively, but is this following function: $f(x) = x + \sin x$ and is not $f(x) = \sin x$ and therefore can exhibit different properties I need explained.

In Radian mode, continually pressing the $\cos$ function of a number causes the result to converge to $x=0.739085133$, a fixed point of $\cos(x)$. Repeating this behavior with the $\sin$ function causes the result to converge to $x=0$, a fixed point of $\sin(x)$.   What happens if this is done using the tan function? It seems that $x=0$ is a repelling fixed point with no convergence in this case.  What would be the best way to explain these results mathematically?


So I've been having fun so far with my new linux installation.  For some programs I need to run for school I need to install a dualboot for windows, but I don't like the grub loader where you need to choose which installation to run.   I just want it to start my linux installation and if I want to go to windows I want to use a terminal command or something from within the linux installation to go to the windows installation.   so is this possible? and if so how?  --------------SOLUTION----------

I'm looking for a way to reboot into Windows from Ubuntu on a 10.10/Vista dual boot system. The specific use case is that I would like to be able to ssh into my running Ubuntu instance and issue a command that will initiate a reboot directly into Windows.  I found , but the script that it suggests isn't working:  #!/bin/bash  WINDOWS_ENTRY=`grep menuentry /boot/grub/grub.cfg  | grep --line-number Windows` MENU_NUMBER=$(( `echo $WINDOWS_ENTRY | sed -e "s/:.*//"` - 1 )) sudo grub-reboot $MENU_NUMBER sudo reboot   man grub-reboot isn't much help, but it seems to be leading me in the right direction:     set  the default boot entry for GRUB,   for the next boot only   WINDOWS_ENTRY=`grep menuentry /boot/grub/grub.cfg  | grep --line-number Windows` MENU_NUMBER=$(( `echo $WINDOWS_ENTRY | sed -e "s/:.*//"` - 1 )) echo $MENU_NUMBER   This returns the expected value, but on reboot the first menu entry is still highlighted. Any ideas why this isn't working or suggestions for other solutions?


My computer uses at 19.5V 9.23A charger.  I would like to use a 19V 4.74A charger on the same laptop.  The polarities and connectors are the same.   is the most comprehensive explanation I've been able to find online, however it doesn't address my particular issue, where the voltage and the amperage are lower.  The voltage is only slightly lower, so I'm curious as to if the Current too Low section applies to me or if because it's slightly lower does that section not apply to me and so what is the actual possible results of using the charger?  Thanks!

Possible Duplicate:        How can I tell if an AC adapter is compatible with my laptop?  For example, does the voltage output have to bee the same, or just close?  What power measurements matter?


Is it possible to rotate an HDRI background without rotating the lighting it gives off? I know that you can go into shading, world, and then add a mapping node and that rotates it, but that also rotates the light, I wanna keep the light in the same place but rotate the background. Is there any way to do this? Thanks!

I figured out how to use a normal image as the background while using an HDRI for environmental lighting. But I can't figure out how to use a different HDRI as the background.  Please note I already read this answer:  but this appears to be different for Eevee in 2.8.  Thanks!


I have written a function for adding emails to newsletter base. Until I've added checking validity of sent email it was working flawlessly. Now each time I'm getting "Wrong email" in return. Can anybody see any errors here ? The regex used is :  \b[\w\.-]+@[\w\.-]+\.\w{2,4}\b and it is 100% valid (), but I may be using it wrong, or it may be some logic error :  def newsletter_add(request):     if request.method == "POST":            try:             e = NewsletterEmails.objects.get(email = request.POST['email'])             message = _(u"Email is already added.")             type = "error"         except NewsletterEmails.DoesNotExist:             if validateEmail(request.POST['email']):                 try:                     e = NewsletterEmails(email = request.POST['email'])                 except DoesNotExist:                     pass                 message = _(u"Email added.")                 type = "success"                 e.save()             else:                 message = _(u"Wrong email")                 type = "error"  import re  def validateEmail(email):     if len(email) > 6:         if re.match('\b[\w\.-]+@[\w\.-]+\.\w{2,4}\b', email) != None:             return 1     return 0

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


What is the proper way to calculate bootstrap regression coefficients CI after MI? I mean is using a pooled bootstrap SE over imputed data sets with a pooled estimate of bootstrap regression coefficient across MI data sets better or using list of bootstrap SE and regression coefficients estimates for each MI data sets? The former approach gives one CI while later gives a list of CI for each MI data set.

I am concerned with the problem that I would like to bootstrap the p-value for an estimate of $\theta$ from multiply imputed (MI) data, but that it is unclear to me how to combine the p-values across MI sets.  For MI data sets, the standard approach to get to the total variance of estimates uses Rubin's rules. See  for a review of pooling MI data sets. The square root of the total variance serves as a standard error estimate of $\theta$. However, for some estimators the total variance has no known closed form or the sampling distribution is not normal. The statistic ${\theta}/{se(\theta)}$ may then not be t-distributed, not even asymptotically.   Therefore, in the complete data case, one alternative option is to bootstrap the statistic to find variance, a p-value and a confidence interval, even if the samling distribution is not normal and its closed form unknown. In the MI case there are then two options:   Pool the bootstrapped variance across MI data sets Pool the p-value or confidence bounds across MI data sets   The first option would then again use Rubin's rules. However, I believe that this is problematic, if $\theta$ has a non-normal sampling distribution. In this situation (or more generally, in all situations) the bootstrapped p-value can be used directly. However, in the MI case, this would lead to multiple p-values or confidence intervals, which need to be pooled across MI data sets.   So my question is: how should I pool multiple bootstrapped p-values (or confidence intervals) across multiply imputed data sets?  I would welcome any suggestions on how to proceed, thank you.


Show that If $f : \mathbb{R}^2 \to \mathbb{R}$ is continuous, then $f$ is not injective.  My idea is to use the fact that continuous functions send connected in connected and if I take the origin to $ \mathbb{R} ^ 2 $ its connection is maintained while $ \mathbb{R} $ loses its connection

How would you show that there is no continuous injective map  $f:\mathbb{R}^3 \to \mathbb{R}$?  I tried the approach where if $a \in \mathbb{R}$ then $\mathbb{R} \backslash \{a\} $ is not clearly connected so there can't exist a continuous function otherwise $\mathbb{R} \backslash \{a\} $ would be connected?


I have the following sentence:     No suit you buy off-the-rack will perfectly fit you. It has to be   made-to-measure, or you will have to get it adjusted at a credible   tailor. It is better to get it right the first time.   However, I am unsure whether I should use off-the-rack, made-to-measure, or simply off the rack and made to measure.

I have a sentence which has an object that is described with an adjective:     We need to inform our interested patrons of this change.   If I modify "interested" with "more" or "less", do I connect the words with a hyphen or not?  Example sentence:     We need to inform our less-interested patrons of this change.     Also, please let me know if I have not used the correct terms for sentence parts in this question.


Question: In how many ways $5$ boys and $3$ girls can be seated in a row so that all $3$ girls do not sit together?   Attempt 1: Find all the possible ways (which is $8!$), and subtract the total number of ways that the 3 girls can sit together.  G = Girl, B = Boy  Number of ways in GGG  $ =3!$  Consider (GGG) as one unit. Then,  Number of ways in (GGG)BBBBB $= 6!$   Therefore, total number of ways that the 3 girls can sit together $= 3! \times 6! = 4320$   Answer $= 8! - 4320 = 40320 - 4320 = 36000$  Attempt 2: Place boys in by keeping gaps for girls such that a gap is smaller for all 3 girls.  _ _ B _ _ B _ _ B _ _ B _ _ B _ _  Each gap has space for two girls. Therefore, all $3$ girls cannot sit together. And now, we can assign the $3$ girl to $3$ spaces from the above $12$ spaces in the gaps.   Total number of ways that girls can choose spaces $= 12 \times 11 \times 10 = 1320$  Total number of ways that boys can sit $= 5! = 120 $  Answer $= 1320 \times 120 = 158400$      Why we get two different answers to two approaches? I guess that the Attempt 1 is correct; If so why attempt 2 is wrong?   Note: By referring to following question I could get more understanding how to deal with the question: . But I could not get what is wrong with my attempt 2 by referring that. So please answer mainly focusing on how the Attempt 2 become fail?

I've been trying to solve this permutation problem. I know that it's been posted on this site before, but my question is about the specific approach I take to solving it.  Here's what I thought I'd do : I could first figure out the total number of permutation where AT LEAST $2$ girls are together, and then subtract this from the total number of permutations.  Now, the total number of ways in which the students can be seated is obviously $^8\mathbf{P}_8$, or $8!$.  For the total number of permutations where at least $2$ girls are together, I first figured out that if I take $2$ girls as $1$ object, I can seat them in a total of $ 7 $ ways.   To this I multiplied the total number of way in which $2$ out of $3$ girls can be chosen. Thus I had $ 7  \times ^3\mathbf{P}_2 $, or $ 6 \times 7$  Finally, to this I multiplied the total number of permutations for the seating arrangement of the remaining students, to get $7 \times 6 \times ^6\mathbf{P}_6 $, or $ 6 \times 7!$.  Finally, I subtracted the number of permutation where AT LEAST 2 girls are seated together ($6 \times 7!$), from the total number of permutations of possible seating arrangements ($8!$).  Thus, I have $8! - 6 \times 7!$, or $7!(8-6) = 10080$.  BUT, the answer given in my book, and online, is 14400.   I want to know where my problem solving logic is wrong and if my calculation is wrong ?  Thanks.


I have a class and I would like to capture a keystroke. I know there are events in a WinForm application for keypresses. I want my class to be able to capture a keystroke, without using WinForms. I know I can create a keyboard hook, but I would prefer not to use that method, as it involves importing other Windows libraries and I would like this to work under Mono, as well as Windows. All I need is the ASCII code of the key pressed. I don't need to capture modifiers, such as ctrl, alt, shift, etc...  Any suggestions?

I'm using code that I found on the .  The only problem is it uses external DLL calls that don't work in mono.  I was wondering if anyone knew of a way to accomplish the same thing as that code, but will run in both Windows using .net, and Linux using mono?  Edit:  Clarifying what I'm trying to do: I'm making a .  The program sits in the system tray and when the user presses the hot-key, it will pop up all the gadgets.  So the program doesn't have focus, so typically it won't catch any keystrokes, so I'm using the low-level keyboard hook and I hook the two keys that the user defines as the hot-keys.  But I'm using a Windows DLL call for that, which doesn't work in Linux using mono.  So I'm wondering if there's a way to do the same thing, but will run in Linux using mono?


Linker error: tried to make basic cpp program but there is a linker error saying:unresolved symbol "private: static int complex::count".    When i removed the static words, its working fine.  Please find Program sample on this

Very simply put:  I have a class that consists mostly of static public members, so I can group similar functions together that still have to be called from other classes/functions.  Anyway, I have defined two static unsigned char variables in my class public scope, when I try to modify these values in the same class' constructor, I am getting an "unresolved external symbol" error at compilation.  class test  { public:     static unsigned char X;     static unsigned char Y;      ...      test(); };  test::test()  {     X = 1;     Y = 2; }   I'm new to C++ so go easy on me. Why can't I do this?


I have a raster layer that I want to crop to a hemisphere centered on 30°N, 100°W, to use in an orthographic projection map. What is the best way to do this?  There doesn't seem to be an easy way to generate a hemisphere polygon to mask it by (which I'd think would be the obvious solution).  (Note that, unlike the question this is marked a duplicate of, this is asking about raster layers; the solutions presented in that question are for vector layers and do not work here.)

I`m trying to create a sphere-like view using qgis and the "world from space"-projection  (essentialy an ortho-projection). ArcGIS wraps the shapes correctly but QGIS (2.01) produces nasty artifacts.    I have to produce the globes on a regular basis with different angles so does anyone out there have an idea how to fix this problem?


I am working on a football dataset and am dealing with some exotic names. I would like to ask how do I replace special ALPHABETS that are present in my dataset? These are some of examples of these "exotic" names:  'Lionel Andrés Messi Cuccittini', 'Neymar da Silva Santos Junior', 'Luis Alberto Suárez Díaz', 'David De Gea Quintana', 'Zlatan Ibrahimović'  The special alphabets are é, á, ć, etc (alphabets with a "superscript" above). I want to change them to the "base" form - ć becomes c, á becomes a, so on and so forth.  Many thanks in advance!

I have a Unicode string in Python, and I would like to remove all the accents (diacritics). I found on the web an elegant way to do this (in Java):  convert the Unicode string to its long normalized form (with a separate character for letters and diacritics) remove all the characters whose Unicode type is "diacritic".  Do I need to install a library such as pyICU or is this possible with just the Python standard library?  And what about python 3? Important note: I would like to avoid code with an explicit mapping from accented characters to their non-accented counterpart.


I have a package with the following hierarchy  my_package/__init__.py            script_a.py            scripts_dir/__init__.py                        script_b.py            my_package/__init__.py                       module_a.py                       module_b.py   module_a and module_b contain function and class definitions that I am using in script_a and script_b (which are stand alone scripts and contain a main)  When I import something from let's say module_a.py in my script_a.py everything is fine.  My problems are   I cannot figure out how to use relative imports to import something from module_a or module_b to script_b.py I am not sure if I am supposed to use relative imports or if it makes more sense to add my_package to sys.path and then use something like from my_package.module_a import the_funky_func I want to avoid having to call the interpreter with the -m argument   update  From the answers I have found so far in SO I have concluded that I have 3 options    write a setup to include the package to my PYTHONPATH so that all scripts regardless of where they are can call the modules use the -m argument when invoking the interpreter do some sys.path hack   Is there another option that I am not aware of?

Imagine this directory structure:  app/    __init__.py    sub1/       __init__.py       mod1.py    sub2/       __init__.py       mod2.py   I'm coding mod1, and I need to import something from mod2. How should I do it?    I tried from ..sub2 import mod2 but I'm getting an "Attempted relative import in non-package".  I googled around but found only "sys.path manipulation" hacks. Isn't there a clean way?      Edit: all my __init__.py's are currently empty    Edit2: I'm trying to do this because sub2 contains classes that are shared across sub packages (sub1, subX, etc.).  Edit3: The behaviour I'm looking for is the same as described in  (thanks John B)


In the campaign, I'm participating in, my character is a wizard/warlock with Vecna as his Patron, his ultimate goal being to achieve lichdom. In order to obtain more knowledge about magic in general to continue his research, I'm considering taking a dip in arcana cleric of Mystra to get some divine help and those cleric spells. The problem is that Vecna is NE and Mystra is NG, so I really don't know how they would get along. I know that they are from different worlds, but I don't know if their differences in opinions would make it difficult for my character. Would there be any chance that my character could successfully pull off having both Mystra and Vecna in his head without any controversy between the two?

I have a character in the Forgotten Realms, Orryn, who is a gnome whose village was burnt down, who forged a pact with a pit fiend to gain Warlock powers. This was all to avenge his people and he is good, albeit chaotic good.  Now, he's been talking with the party's cleric and while the cleric doesn't know he's a warlock (he tells people that he's a wizard), the cleric DOES know that he struggles with "inner demons". Orryn has been connecting with a god, which would be either Baervan Wildwanderer (because he's a forest gnome) or Chauntea (who is the god the other cleric worships), and wants to take a 1st level in cleric to combat that evil inside of him.   My question: Is this possible? From a purely RAW standpoint, I don't think that warlocks can lose their powers, but would his good deity even bother with someone who sold their soul to a devil? And would that pit fiend continue fueling their powers?   NOTE: I'm not stepping on the cleric's toes, he's actually moving away in a couple weeks so we won't have a cleric anymore (though that's not why I am leveling in cleric).


I have to create an equals method that return true if the Politicians' titles are the same. How do I compare the strings?  This is how I've tried to write it so far:  public class Politician implements Priority{ private String name, title; private int a; public Politician(String n, String t, int p){     name=n;     title=t;     a=p; } public boolean equals(Politician a){     if(title.equals(a.title))         return true;     return false; }   However, it just always return false. Even when I test:  Priority t4= new Politician("Arnie", "Governor", 4);     Politician t5= new Politician("Bill", "Governor", 10);     System.out.println(t5.equals(t4));      System.out.println(t4.equals(t5));   I've written equals() before and I don't know why it's not working anymore

I ran into an interesting (and very frustrating) issue with the equals() method today which caused what I thought to be a well tested class to crash and cause a bug that took me a very long time to track down.   Just for completeness, I wasn't using an IDE or debugger - just good old fashioned text editor and System.out's. Time was very limited and it was a school project.  Anyhow -   I was developing a basic shopping cart which could contain an ArrayList of Book objects. In order to implement the addBook(), removeBook(), and hasBook() methods of the Cart, I wanted to check if the Book already existed in the Cart. So off I go -  public boolean equals(Book b) {     ... // More code here - null checks     if (b.getID() == this.getID()) return true;     else return false; }   All works fine in testing. I create 6 objects and fill them with data. Do many adds, removes, has() operations on the Cart and everything works fine. I read that you can either have equals(TYPE var) or equals(Object o) { (CAST) var } but assumed that since it was working, it didn't matter too much.  Then I ran into a problem - I needed to create a Book object with only the ID in it from within the Book class. No other data would be entered into it. Basically the following:  public boolean hasBook(int i) {     Book b = new Book(i);     return hasBook(b); }  public boolean hasBook(Book b) {     // .. more code here     return this.books.contains(b); }   All of a sudden, the equals(Book b) method no longer works. This took a VERY long time to track down without a good debugger and assuming the Cart class was properly tested and correct. After swaapping the equals() method to the following:  public boolean equals(Object o) {     Book b = (Book) o;     ... // The rest goes here    }   Everything began to work again. Is there a reason the method decided not to take the Book parameter even though it clearly  was  a Book object? The only difference seemed to be it was instantiated from within the same class, and only filled with one data member. I'm very very confused. Please, shed some light?


This is a purely commuting issue.   I have an around 3km route to the office, and a regular backpack (laptop, accessories, notebooks, ...) which is not a problem to carry around during autumn and winter months, but in the summer the back of my shirt quickly becomes sweaty from carrying it, and carrying it only on one shoulder isn't so good stability wise, while on the road.  I'm looking for advice, what would be a good way to mount it to a bike, or securing it in some way so it lasts throughout the trip, so I don't have to carry it on me.  I've tried securing it to my rear rack with "bungee ropes" (those elastic ropes), but it tends to slip to the side during the ride, and I'm afraid it might fall down.  Bike: Author Reflex SX trekking, with rear rack installed.  Edit (Clarification of what I'm looking for): Solutions for carrying regular rucksacks, like baskets that can be secured to rear rack, or side baskets (I've yet to see examples of those), or some solutions that would enable securing a backpack directly to a rear rack, but in a way that enables me to quickly clamp/unclamp it. I'm also not interested in buying specialized bike backpacks/panniers, but wish to carry my current one.

If to commute to school by bike, how is the school rucksack usually transported? I can see the following options:   Keep it on the back. It is quite heavy, gravity center will be high and in case of falling over head it may add to the injury. Put into basket above the rear wheel. The form of the usual rucksack does not fit well to secure it from falling. Use specialized bicycle container for luggage. But the models I have used so far are time consuming to remove and not adapted at all to carry on hand when full.   Are there special equipment for that? Which approaches are usually taken?


class My {    constructor() {     this.myMethod1 = function(){};   }    myMethod2() {    } }   So is there any difference between myMethod1 and myMethod2?

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


I was implementing a code to calculate a modulus of a number.  Ex.   long n = 70464307456L; // input value int res = n % 256;  The result I got here was 0, which is expected.  The next input was 070464307467L (this input had leading 0) I was expecting to get the result as 11 for this input, but the result I got was 55.  But when removed the leading 0 from the input, the result was 11.  I did not understand this behavior when 0 is at the beginning.  Can someone please help me to understand?  Thanks in Advance.

This prints 83  System.out.println(0123)   However this prints 123  System.out.println(123)   Why does it work that way?


I'm planning on switching from OVH to Gandi in the coming weeks/months (domain first, hosting later). However, I'm not sure what the process is exactly, given I'm also using Cloudflare and none of the guides I found seem to address this particular case.  The point I'm unsure about is whether I actually need to do anything regarding Cloudflare. Do I need to pause my website on Cloudflare and change the name servers back to OVH's before the transfer, or can I just leave that as is and then set Cloudflare's nameservers in Gandi's configuration once the transfer is done?   makes me think I can just leave everything as is and do the transfer, but I'm not 100% sure.

Will transferring a domain name to a new host cause downtime at all on the domain?  It's the highest traffic time of the year for us but we really want to keep things moving and need to migrate hosts because our current host charges per subdomain. It's imortant we get this subdomain up and running in the next few weeks, so I'm wondering what kind of down time (if any) we should expect migrating the registrar.  It doesn't seem like it would...