body1
stringlengths 20
4.1k
| body2
stringlengths 23
4.09k
|
---|---|
I have been having this issue a bunch when referencing my Firebase database. I think there is an issue with the data not actually being able to receive data from the database, or when it executes the first bit of code there, it doesn't actually have a user before it gets a UID. but I'm not entirely sure. java.lang.NullPointerException: Attempt to invoke virtual method 'com.google.firebase.database.DatabaseReference com.apex.quotable.managers.DatabaseHelper.getDatabaseReference()' on a null object reference at com.apex.quotable.managers.ProfileManager.isProfileExist(ProfileManager.java:61) at com.apex.quotable.activities.LoginActivity.checkIsProfileExist(LoginActivity.java:117) at com.apex.quotable.activities.LoginActivity.access$500(LoginActivity.java:30) at com.apex.quotable.activities.LoginActivity$4.onAuthStateChanged(LoginActivity.java:84) at com.google.firebase.auth.zzl.run(Unknown Source:24) at android.os.Handler.handleCallback(Handler.java:790) at android.os.Handler.dispatchMessage(Handler.java:99) at android.os.Looper.loop(Looper.java:164) at android.app.ActivityThread.main(ActivityThread.java:6494) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:438) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:807) Then, it is saying the error comes from here: checkIsProfileExist(user.getUid()); Then, private void checkIsProfileExist(final String userId) { ProfileManager.getInstance(this).isProfileExist(userId, new OnObjectExistListener<Profile>() { @Override public void onDataChanged(boolean exist) { if (!exist) { startCreateProfileActivity(); } else { PreferencesUtil.setProfileCreated(LoginActivity.this, true); DatabaseHelper.getInstance(LoginActivity.this.getApplicationContext()) .addRegistrationToken(FirebaseInstanceId.getInstance().getToken(), userId); } hideProgress(); finish(); } }); } then public void isProfileExist(String id, final OnObjectExistListener<Profile> onObjectExistListener) { DatabaseReference databaseReference = databaseHelper.getDatabaseReference().child("profiles").child(id); databaseReference.addListenerForSingleValueEvent(new ValueEventListener() { @Override public void onDataChange(DataSnapshot dataSnapshot) { onObjectExistListener.onDataChanged(dataSnapshot.exists()); } @Override public void onCancelled(DatabaseError databaseError) { } }); }
|
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?
|
Using pgfplots, I often want to label the horizontal axis major ticks in units of pi or pi/2, or pi/3. Is it possible to have such "trigonometric major ticks" use minor tick num = <value> to specify the number of minor ticks? Currently my approach for "trigonometric major ticks" is to make a style wholes that specifies the xtick=<integer multiples of pi> and xticklabels=<labels>. I specify the ticks for a range -4*pi to +4*pi, and crop the graph as needed. I similarly have a style called halves for half-integer multiples of pi: \documentclass{standalone} \usepackage{pgfplots} %This package also loads tikz \pgfplotsset{ % Global Styles axis lines = middle, xlabel = $x$, ylabel = $y$, no markers, samples=50, grid = both, trig format plots=rad, enlargelimits = false, axis line style = {line width=0.5pt}, every axis plot/.append style={ line width = 1.25pt, smooth, }, % Label every pi halves/.style={ xtick = {-12.5664, -10.9956, -9.42478, -7.85398, -6.28319, -4.71239, -3.14159, -1.5708, 0, 1.5708, 3.14159, 4.71239, 6.28319, 7.85398, 9.42478, 10.9956, 12.5664, 14.1372, 15.708, 17.2788, 18.8496, 20.4204, 21.9911, 23.5619, 25.1327}, xticklabels = {$-4\pi$,$-\frac{7\pi}{2}$,$-3\pi$,$-\frac{5\pi}{2}$,$-2\pi$,$-\frac{3\pi}{2}$,$-\pi$,$-\frac{\pi}{2}$,$0$,$\frac{\pi}{2}$,$\pi$,$\frac{3\pi}{2}$,$2\pi$,$\frac{5\pi}{2}$,$3\pi$,$\frac{7\pi}{2}$,$4\pi$,$\frac{9\pi}{2}$,$5\pi$,$\frac{11\pi}{2}$,$6\pi$,$\frac{13\pi}{2}$,$7\pi$,$\frac{15\pi}{2}$,$8\pi$} }, % Label every pi wholes/.style={ xtick = {-12.5664, -9.42478, -6.28319, -3.14159, 0., 3.14159, 6.28319, 9.42478, 12.5664, 15.708, 18.8496, 21.9911, 25.1327}, xticklabels = {$-4\pi$,$-3\pi$,$-2\pi$,$-\pi$,$0$,$\pi$,$2\pi$,$3\pi$,$4\pi$,$5\pi$,$6\pi$,$7\pi$,$8\pi$} } } \begin{document} \begin{tikzpicture} \begin{axis}[wholes,domain=-pi:3*pi,ymin=-2,ymax=+4,minor tick num = 1] \addplot {1-2*cos(2*x)}; \legend{$1-2\cos(2x)$} \end{axis} \end{tikzpicture} \begin{tikzpicture} \begin{axis}[halves,domain=-pi:pi,ymin=-2,ymax=+4,minor tick num = 1] \addplot[red] {2+0.5*sin(4*x)}; \legend{$2+0.5\sin(4x)$} \end{axis} \end{tikzpicture} \end{document} with output Problem: I'm fairly happy with this solution, except minor tick num=1 is not working on the x-axis. I think this is due to rounding errors. Certainly I could specify the minor ticks manually. I really don't want to do this---I need to create many graphs like this, some times I want minor tick num = 1, sometimes I want minor tick num = 3. Is there a better approach?
|
How do I make the axis labels use multiples of \pi in PGFPlots?
|
Ars Technica posted an article describing the getaddrinfo() bug and how it is widespread in the Linux world. The vulnerability was introduced in 2008 in GNU C Library, a collection of open source code that powers thousands of standalone applications and most distributions of Linux, including those distributed with routers and other types of hardware. Source: Question: In which general distribution versions of Ubuntu has this bug been fully addressed/corrected?
|
Today a couple of buffer overflows in NTP were announced , . It looks like updating my system to fix these issues is in order. How can I find out if they have been fixed in the Ubuntu repositories, such that if I were to run: sudo apt-get update sudo apt-get upgrade then the fix would get installed and the vulnerability closed? Edit: The selected answer specifically addresses the question of how to identify if a given CVE has been fixed or not, "Does Ubuntu generally post timely security updates?" is certainly related but not identical
|
class MyPanel extends JPanel implements Observer, MouseMotionListener, MouseListener { private MyModel model; private View view; private String mode; private Rectangle rectangle; private Square square; public MyPanel(MyModel model, View view) { this.setBackground(Color.black); this.setPreferredSize(new Dimension(300, 300)); this.addMouseListener(this); this.addMouseMotionListener(this); this.model = model; this.model.addObserver(this); } public void paintComponent(Graphics g) { super.paintComponent(g); Graphics2D g2d = (Graphics2D) g; ArrayList<Rectangle> rectangles = this.model.getRectangles(); for (Rectangle r : getRectangles()) { int width = Math.abs(r.getStartPoint().getX() - r.getEndPoint().getX()); int height = Math.abs(r.getStartPoint().getY() - r.getEndPoint().getY()); } ArrayList<Square> squares = this.model.getSquares(); for (Square sqr : getSquares()) { int xPosition = Math.min(sqr.getStartPoint().getX(), sqr.getEndPoint().getX()); int yPosition = Math.min(sqr.getStartPoint().getY(), sqr.getEndPoint().getY()); int width = Math.abs(sqr.getStartPoint().getX() - sqr.getEndPoint().getX()); int height = Math.abs(sqr.getStartPoint().getY() - sqr.getEndPoint().getY()); } g2d.dispose(); } public void update(Observable o, Object arg) { this.repaint(); } @Override public void mouseDragged(MouseEvent e) { if (this.mode.equals("Rectangle")) { this.rectangle.setEndPoint(e.getX(), e.getY()); this.model.addRectangle(this.rectangle); } else if (this.mode.equals("Square")) { // What code should I add here? this.model.addSquare(this.square); } } // MouseListener below @Override public void mouseClicked(MouseEvent e) {} @Override public void mousePressed(MouseEvent e) { if (this.mode.equals("Rectangle")) { this.rectangle = new Rectangle(e.getX(), e.getY()); } else if (this.mode.equals("Square")) { this.square = new Square(e.getX(), e.getY()); } } @Override public void mouseReleased(MouseEvent e) { if (this.mode.equals("Rectangle")) { this.rectangle.setEndPoint(e.getX(), e.getY()); this.model.addRectangle(this.rectangle); this.rectangle = null; } else if (this.mode.equals("Square")) { this.model.addSquare(this.square); this.square = null; } } @Override public void mouseEntered(MouseEvent e) {} @Override public void mouseExited(MouseEvent e) {} } The user chooses a mode, rectangle or square. Then they can draw a square or a rectangle with their mouse (live feedback is shown). Here is my drawing panel class. I was successfully able to implement the rectangle mode. The user can draw a rectangle and as they move their mouse, the rectangle is shown in mid construction. I want to do the same for the square mode. For some reason, I'm having a hard time doing this. How would I show a perfect square in mid construction when the user is moving their mouse and how would I draw it once released? What code should I add to my paintComponent method, mouseDragged, mousePressed and mouseReleased method to do this? It was easy for a rectangle because there was no constraint but I'm not sure how to do it for a square with my current implementation.
|
I've been using the == operator in my program to compare all my strings so far. However, I ran into a bug, changed one of them into .equals() instead, and it fixed the bug. Is == bad? When should it and should it not be used? What's the difference?
|
In the past, I could add any email address that I own via Settings → Accounts → Add another email address you own. . On that wzard, there were 2 options: But now it only lets you specify the SMTP server directly and it doesn't accept the standard settings of smtp.gmail.com Did they change policies? Or am I missing something here? I tried this on two different accounts.
|
I used to be able to go to Accounts and Import → Add another email address you own and add an email account that's only a forwarding address. That is, it's not a mailbox and I don't have SMTP access to it. Gmail would send me a confirmation email to that address, I'd confirm it's mine, and done. Now it only gives me the option to add SMTP credentials. Did they stop supporting the previous method? Is there any other way I can get that option back?
|
We all know the generic arrow mouse pointer points to the left, however in visual studio if you hover over the line number column in your editor it switches and points to the right. Does anybody know the reasoning behind this? I can't grab a screenshot unfortunately as it won't capture the cursor!
|
When you mouse over line numbers in IDEs, such as Visual Studio or Notepad++, the mouse cursor is flipped horizontally. I can't think of a reason this would be a ubiquitous user interface decision. Line numbers are already set apart from the code by colors or lines, and the cursor flip doesn't prevent the obstruction of the numbers, or make setting breakpoints easier. Does anyone know why this is a common decision?
|
Imagine you have two homogeneous spheres with the same diameter of $d=0.1 m$. They have the same mass $m = 1 kg$. The distance between the centers of mass is $r= 1 m$. Their electrical charge shall be disregarded. At $t=0$ the spheres do not have any relative motion to each other. Due to gravitation they will accelerate and start moving towards each other. After some time they will touch each other. How to calculate analytically the time it takes the two spheres to meet each other. I'm not interested in a numerical solution. I have already tried several ways but I don't get to a solution. Imagine that the 2 spheres have different masses and diameters. $m_{1}=2 kg$, $m_{2}=5 kg$, $d_{1}=0.03 m$, and $d_{2}=0.3m$. How to calculate analytically when and where the 2 spheres are going to meet? How do you calculate the second problem taking the theory of relativity into account? I know that it will not change the result that much but I am interested in the mathematical solution.
|
The common understanding is that, setting air resistance aside, all objects dropped to Earth fall at the same rate. This is often demonstrated through the thought experiment of cutting a large object in half. The halves clearly can't then fall more slowly just by being sliced in two. However, I believe the answer is that when two objects fall together, attached or not, they do "fall" faster than an object of less mass alone does. This is because not only does the Earth accelerate the objects toward itself but the objects also accelerate the Earth toward themselves. Considering the formula: $$ F_{\text{g}} = \frac{G m_1 m_2}{d^2} $$ Given $F = ma$ thus $a = F/m$, we note that the mass of the small object doesn't seem to matter as when calculating acceleration the force is divided by the $m$ term, its mass. However, this overlooks that the force is actually applied to both objects, not just to the smaller one. The acceleration on the second, larger object is found by dividing $F$, in turn, by the larger object's mass. The two objects' acceleration vectors are exactly opposite, so closing acceleration is the sum of the two: $$ a_{\text{closing}} = \frac{F}{m_1} + \frac{F}{m_2} $$ Since the Earth is extremely massive compared to everyday objects, the acceleration imparted on the object by the Earth will radically dominate the equation. As the Earth is $\sim 5.972 \times {10}^{24} \, \mathrm{kg} ,$ a falling object of $5.972 \, \mathrm{kg}$ (just over 13 pounds) would accelerate the Earth about $\frac{1}{{10}^{24}}$ as much, which is one part in a trillion trillion. Of course in everyday situations, we can for all practical purposes treat objects as falling at the same rate because of this negligible difference—which our instruments probably couldn't even detect. But I'm hoping not for a discussion of practicality or what's measurable or observable, but what we think is actually happening. Am I right or wrong? What really clinched this for me was considering dropping a small Moon-massed object close to the Earth and a small Earth-massed object close to the Moon. This made me realize that falling isn't one object moving toward some fixed frame of reference, but that the Earth is just another object, and thus "falling" consists of multiple objects mutually attracting in space.
|
I did a fresh Windows 7 install and I installed XAMPP. After that, I realized I needed to install C++ 2015. But I couldn't install until I installed SP1. After I installed SP1, I've had some issues. When I go to search for more updates, it keeps searching for updates for hours. And when I go to install C++ 2015 it gets hung at windows7_msu_x64. My Windows update: And when Windows is searching for updates, I can't install C++ because it says another install is happening. I honestly have no clue what is happening.
|
I installed Windows 7 fresh and installed SP1. Now, when I try to check manually for Windows Updates it just hangs on the Checking for updates screen. I tried running the tools in , but this did not fix the issue either: No matter what I do it just hangs on the "Checking for updates..." screen and goes no further.
|
In our country we don't have present perfect form, so it is difficult for us to understand 'present perfect' exactly. ex) It has rained for two hours. In this sentence Is it raining now? or It stopped raining now?
|
The sentences are: Mary has worked as a teacher for over 25 years. It has rained heavily for 2 hours. Does it mean "Mary" is still working as a teacher or she is no longer working now? Does it mean it is still raining or it stopped? Since it cannot mean both, so how to suggest either one of the meanings?
|
I am in Brisbane and have two $100 US dollar bills from the 1985 series. I went to money exchanges and banks, but no one is accepting it. Any idea where I can change them in Australia and, in particular, the Queensland area?
|
I received from my Dad 150 American Dollars about 12 years ago. I never have thought to change this money but a few days I tried change it in a currency exchange in Sydney and the guy didn't change it because the series are old. What do I have to do to change this money?
|
I am trying to center the boxes horizontally. Currently they are aligned to the left and when you resize the window they move responsively. I would still like to keep that functionality. I just want to center the boxes even when I resize the window. I tried float:center but there is no such thing...Thank you. .mybtn { font:bold 20px"Arial Black", Gadget, sans-serif; font-style:normal; color:#ffd324; background-color: rgba(255,0,0,.90); border:2px solid #000; text-shadow:0px -1px 1px #222222; box-shadow:0px 0px 12px #2e2300; -moz-box-shadow:0px 0px 12px #2e2300; -webkit-box-shadow:0px 0px 12px #2e2300; border-radius:15px 15px 15px 15px; -moz-border-radius:15px 15px 15px 15px; -webkit-border-radius:15px 15px 15px 15px; width:100px; height:100px; margin:5px; float:left; position:relative; } And the HTML <div class="mybtn"> </div> <div class="mybtn"> </div> <div class="mybtn"> </div> <div class="mybtn"> </div> <div class="mybtn"> </div>
|
How can I horizontally center a <div> within another <div> using CSS? <div id="outer"> <div id="inner">Foo foo</div> </div>
|
I have looked at several threads and sites for a solution to this and have not found anything that works. First I run: sudo apt update Which gives: Hit:1 http://us.archive.ubuntu.com/ubuntu bionic InRelease Get:2 http://us.archive.ubuntu.com/ubuntu bionic-updates InRelease [88.7 kB] Get:4 http://security.ubuntu.com/ubuntu bionic-security InRelease [88.7 kB] Get:3 http://us.archive.ubuntu.com/ubuntu bionic-backports InRelease [74.6 kB] Reading package lists... Done E: Release file for http://us.archive.ubuntu.com/ubuntu/dists/bionic-updates/InRelease is not valid yet (invalid for another 18d 11h 52min 21s). Updates for this repository will not be applied. E: Release file for http://us.archive.ubuntu.com/ubuntu/dists/bionic-backports/InRelease is not valid yet (invalid for another 18d 11h 53min 0s). Updates for this repository will not be applied. E: Release file for http://security.ubuntu.com/ubuntu/dists/bionic-security/InRelease is not valid yet (invalid for another 18d 11h 52min 2s). Updates for this repository will not be applied. I don't have enough experience to tell if these are issues that should be fixed or can be fixed. Next I try to run: sudo apt-get install g++ Which gives: Reading package lists... Done Building dependency tree Reading state information... Done 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: g++ : Depends: gcc (>= 4:7.3.0-3ubuntu2) but it is not going to be installed Depends: g++-7 (>= 7.3.0-12~) but it is not going to be installed Depends: gcc-7 (>= 7.3.0-12~) but it is not going to be installed E: Unable to correct problems, you have held broken packages. I did try following directions in other threads that I'm quite sure broke this issue a bit more than it had been before, but I don't know where to start. EDIT: In accordance with steeldriver's comment on my VM's date and time settings, it was wrong and I set date & time to automatic and ran timedatectl status which gave: Local time: Sat 2019-03-23 13:07:38 EDT Universal time: Sat 2019-03-23 17:07:38 UTC RTC time: Sat 2019-03-23 17:07:39 Time zone: America/New_York (EDT, -0400) System clock synchronized: yes systemd-timesyncd.service active: yes RTC in local TZ: no So: sudo apt update Now gives: Reading package lists... Done Building dependency tree Reading state information... Done All packages are up to date. But sudo apt-get install g++ gives an extremely long list of items that it says are "already up to date" but g++ is still not recognized as installed when using it.
|
I am using Ansible to install the Nginx packages on my Slave1 server from Master server (Note- both Master & Slave server's are having Ubuntu 18.04 and i am running these inside Docker containers), but everytime i am running the Ansible command to do this, getting below error. I am stuck here, what is the solution for this. Please heklp me in debugging this issue. root@afb19093484e:/# ansible Slave1 -m apt -a "name=nginx state=present" 172.17.0.3 | FAILED! => { "changed": false, "cmd": "apt-get update", "msg": "E: Release file for http://security.ubuntu.com/ubuntu/dists/bionic-security/InRelease is not valid yet (invalid for another 3d 21h 33min 13s). Updates for this repository will not be applied.\nE: Release file for http://archive.ubuntu.com/ubuntu/dists/bionic-updates/InRelease is not valid yet (invalid for another 3d 23h 23min 36s). Updates for this repository will not be applied.", "rc": 100, "stderr": "E: Release file for http://security.ubuntu.com/ubuntu/dists/bionic-security/InRelease is not valid yet (invalid for another 3d 21h 33min 13s). Updates for this repository will not be applied.\nE: Release file for http://archive.ubuntu.com/ubuntu/dists/bionic-updates/InRelease is not valid yet (invalid for another 3d 23h 23min 36s). Updates for this repository will not be applied.\n", "stderr_lines": [ "E: Release file for http://security.ubuntu.com/ubuntu/dists/bionic-security/InRelease is not valid yet (invalid for another 3d 21h 33min 13s). Updates for this repository will not be applied.", ],
|
My computer is Dell L521X with WIN 8.1. I want to install ubuntu alongside with win 8.1. Before installation, I've disabled Intel® Rapid Start Technology and change the boot option to legacy. But, at the step of installation types, there is no option. On the Gparted, I could see the normal partition. What's wrong with it?
|
I'm absolutely new to Linux. I would like to know how to install Ubuntu alongside the pre-installed Windows 8+ OS. Should I do it with Wubi, or through the Live USB/DVD? What steps do I need to take to correctly install Ubuntu?
|
Let $gcd(a, b) = d$ Let $a = rd$ and $b = sd$, where $gcd(r, s) = 1$. $\therefore gcd(r^n, s^n) = 1$ Now, how do I show that $r = 1$?
|
I would like to show that $a^n \mid b^n$ implies $a \mid b$ I thought I could convert it to congruences and work backwards, but as far as I remember, $a \equiv b \pmod{m}$ implies $a^n \equiv b^n \pmod{m}$, not the opposite, unless $m$ is prime. Is that right? So I am not sure how to approach this one. Any ideas? Thanks!
|
It’s a science fiction story at least 10 years old where people on spaceship crash into medieval type civilization. I only remember bits and pieces as I read it as a kid and mom made me return it. They used the ship’s laser to sharpen their swords and have the best medieval weaponry. Started trading with some people but of course ended up in war. I still remember the ending after all this time: The commander of the medieval army is attacking and the ship people somehow make their laser expand and take out the whole force, and as the commander is hit the author writes "he watched the ?picture of his family melt, and he along with it." I’ve searched for this book for 5-10 years now and no luck - one of my biggest regtets is returning it.
|
From what I remember of the book: A spaceship goes through a wormhole (I think) and crash lands on a planet They salvage what they can from the ship and build a castle on a mountain, cutting the stone with the lasers from the crashed ship The crew develop some sort of powers, the captain (She) seems to develop some sort of Precognition The planet's inhabitants where men rule and women are second class citizens Some women escape to the crew's castle so they can be equal citizens After they build the castle the crew fight the inhabitants the that came to attack them What is the name of this book?
|
I was testing the performance of two different approaches to handling streams of integers (primitives). To my surprise, the first test case is always slower, no matter the order. public void intStreamTest() { final int[] ints = new int[1000]; for (int x = 0; x < 1000; x++) { ints[x] = new Random().nextInt(1000); } // T1 long start = System.currentTimeMillis(); for (int x = 0; x <= 10000; x++) { List<Integer> result = IntStream.of(ints).boxed().collect(Collectors.toList()); } System.out.println("T1 " + (System.currentTimeMillis() - start)); // T2 long start2 = System.currentTimeMillis(); for (int x = 0; x <= 10000; x++) { List<Integer> result = IntStream.of(ints).mapToObj(Integer::valueOf).collect(Collectors.toList()); } System.out.println("T2 " + (System.currentTimeMillis() - start2)); } Here is an example of the output: T1 150 T2 95 When I change the order of test cases (swap sections T2 and T1) I get: T2 153 T1 92 Did I make a mistake? How is it possible that a second test case is always faster (approx by 60%)?
|
How do you write (and run) a correct micro-benchmark in Java? I'm looking for some code samples and comments illustrating various things to think about. Example: Should the benchmark measure time/iteration or iterations/time, and why? Related:
|
Currently I have an ability to add only 2 additional time zones How to add more?
|
Is there a way to get more than 3 international clocks in Windows Vista (or later)? This describes how to add two extra international clocks but I'd like more.
|
Like, a physical key to swap the Windows Start key with the Ubuntu Super key? Is there anywhere I can buy such a thing, or have I gone to the wrong place and asked? :P
|
Anyone knows where I can get a keyboard to buy with the Ubuntu logo on the super key? If not where can I get some durable small plastic Ubuntu logos about 8 to 9 mm in diameter that I can use to glue on my keyboard?
|
I am reading a constant stream of data coming from a device via Bluetooth. I'm wondering how I can convert this data to a string and print it out? The buffer will contain an ASCII string but when I run it it prints out integers, i would like to be able to see the string. while (true) { try { //read the data from socket stream if(mmInStream != null) { int input = mmInStream.read(buffer); System.out.println(input); } // Send the obtained bytes to the UI Activity } catch (IOException e) { //an exception here marks connection loss //send message to UI Activity break; } }
|
If you have a java.io.InputStream object, how should you process that object and produce a String? Suppose I have an InputStream that contains text data, and I want to convert it to a String, so for example I can write that to a log file. What is the easiest way to take the InputStream and convert it to a String? public String convertStreamToString(InputStream is) { // ??? }
|
I am particularly confused at the the difference(s) when translating conditional statements into english. For instance the statements below from a question I found online. I will go to the movie if I complete my assignment. I will go to the movie only if I complete my assignment. I will not go to the movie if I do not complete my assignment. I understand the differences between the first two in simple english, but how can I express this in propositional logic using the conditional (or bi-conditional) arrows?
|
For some reason, be it some bad habit or something else, I can not understand why the statement "p only if q" would translate into p implies q. For instance, I have the statement "Samir will attend the party only if Kanti will be there." The way I interpret this is, "It is true that Samir will attend the party only if it is true that Kanti will be at the party;" which, in my mind, becomes "If Kanti will be at the party, then Samir will be there." Can someone convince me of the right way? EDIT: I have read them carefully, and probably have done so for over a year. I understand what sufficient conditions and necessary conditions are. I understand the conditional relationship in almost all of its forms, except the form "q only if p." What I do not understand is, why is p the necessary condition and q the sufficient condition. I am not asking, what are the sufficient and necessary conditions, rather, I am asking why.
|
I have the problem that when I want to run the PHP script it does not run File Structure /home/myapp/landing * contact.php * index.html NGINX Conf location / { alias /home/myapp/main; } location /landing-page { alias /home/myapp/landing/; location ~ \.php$ { try_files $uri =404; fastcgi_split_path_info ^(.+\.php)(/.+)$; fastcgi_pass unix:/path/to/php.sock; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; #also tried this #fastcgi_param SCRIPT_FILENAME /home/myapp/landing$fastcgi_script_name; include fastcgi_params; } }
|
I have an app behind nginx. But i need a specific path in this app redirect to a Wordpress Blog Example : example.com/ -------> Redirect to my app example.com/whatever/ -------> Redirect to my app too example.com/blog/ ------->Redirect to my Wordpress Blog So, I add a location matching this sub-path server { listen 80 default_server; index index.php; server_name _; location ^~ /blog { root /path/to/my/blog; index index.php index.html; location ^~ /blog/(.*\.php)$ { fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME /path/to/my/blog/$fastcgi_script_name; include fastcgi_params; } } location ~* /(.*) { #here the conf for the rest of the website } } And when i try to get the page, i have a 404 with this eror in the logs : 2016/05/22 15:27:24 [error] 21759#0: *1 open() "/path/to/my/blog/blog/index.php" failed (2: No such file or directory), client: XX.XX.XX.XX, server: _, request: "GET /blog/index.php HTTP/1.1", host: "example.com" With /blog is duplicate. How i can fix this ? EDIT : Now i have this (Thanks to Richard Smith) : location ^~ /blog { root /path/to/my/; index index.php; try_files $uri $uri/ /blog/index.php; location ~ \.php$ { try_files $uri =404; include fastcgi_params; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; fastcgi_pass 127.0.0.1:9000; } } But now, i got index.php event if i try to ge another file (toto.html for example) If i replace try_files $uri $uri/ /blog/index.php; with try_files $uri $uri/; I got a 404 with 2016/05/22 20:57:21 [error] 22621#0: *1 "/path/to/my/blog/toto.html/index.php" is not found (20: Not a directory), client: 84.98.248.33, server: _, request: "GET /blog/toto.html/ HTTP/1.1", host: "example.com" in the logs EDIT 2 : The file exist and currently, and i give it 777 rights (i will remove them later before go to production): drwxrwxrwx 2 user group 4096 May 22 20:36 . drwxr-xr-x 11 user group 4096 May 23 06:20 .. -rwxrwxrwx 1 user group 126 May 22 13:30 index.php -rwxrwxrwx 1 user group 102 May 22 10:25 old.index.html -rwxrwxrwx 1 user group 12 May 22 12:24 toto.html Thank you fo your patience !
|
I was wondering if there is anyway to set a variable from a function. Let me explain with the following code: number = 0 print number def number_parse(): number = number + 1 return number print number number_parse() print number number = number_parse() print number I get the following output: 0 0 0 1 So what I am really trying to ask is, is there a way to set a variable from a function without having to call it from the line: number = number_parse() Can I not define a variable's value just by calling the function? What if I would like to set multiple variables (e.g. number, number_2, number_3 etc) I am new to python and can't seem to figure this one out
|
How can I create or use a global variable in a function? If I create a global variable in one function, how can I use that global variable in another function? Do I need to store the global variable in a local variable of the function which needs its access?
|
was retitled: What is this function called? Originally my title was: How is this function called? I still think that my version was correct; I always state such questions this way. Which one is really correct?
|
Is it really wrong to say "How do we call something in English?" instead of "What do we call something in English?"? The former's not unusual in Philippine English at all (probably it's because of the influence of Spanish, which was the national language for almost 400 years). Indeed, it's quite interesting that in many European languages, they tend to say "how". Anyone who can explain this? Thanks a lot.
|
I bought a domain name and for the moment the page only says something like 'this domain is registered' but does it have a negative impact on SEO if I keep this page for some months, before I'm ready to launch the website? Will Google blacklist the website because it considers that it has no content?
|
I am setting up my personal website, and I have designed a simple "Coming Soon / Under Construction" page which basically has nothing but a small notice for the users. What kind of SEO can I make on this page such that it won't harm the full website's ranking later on?
|
I am not very experienced at Linux but I recently installed Ubuntu 19.10 and I am trying to use Python 3 and the default is Python 2. I spent a lot of time reading how to configure Ubuntu to run Python 3 but I felt to do it. Can anyone please help me? I used these commands but nothing works... sudo update-alternatives --list python sudo update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.7
|
According to official documentation of Python, Python2.7 support will end near in future. DEPRECATION: Python 2.7 will reach the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 won't be maintained after that date. A future version of pip will drop support for Python 2.7. More details about Python 2 support in pip, can be found at Why is Ubuntu not using Python3 as default in their upcoming version? $ cat /etc/os-release NAME="Ubuntu" VERSION="19.04 (Disco Dingo)" ID=ubuntu ID_LIKE=debian PRETTY_NAME="Ubuntu 19.04" VERSION_ID="19.04" HOME_URL="https://www.ubuntu.com/" SUPPORT_URL="https://help.ubuntu.com/" BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/" PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy" VERSION_CODENAME=disco UBUNTU_CODENAME=disco $ python Python 2.7.16 (default, Apr 6 2019, 01:42:57) [GCC 8.3.0] on linux2 Type "help", "copyright", "credits" or "license" for more information.
|
I am a Dominican Republic citizen, travelling from the Dominican Republic to Cairo via Paris. My connection time is 8 hours, do I need a transit visa?
|
I found many related questions on this site but I am still not sure about the rules. How can I decide if I need a visa to transit? Schengen members as of May 2021 are as follows: Austria Belgium Czech Republic Denmark (excluding Greenland and the Faroe Islands - but an open border with the Schengen Area is maintained) Estonia Finland France (excluding overseas departments and collectivities) Germany Greece Hungary Iceland Italy Latvia Liechtenstein Lithuania Luxembourg Malta Netherlands (excluding Aruba, Curaçao, Sint Maarten and the Caribbean Netherlands) Norway (excluding Svalbard) Poland Portugal Slovakia Slovenia Spain (except Ceuta and Melilla) Sweden Switzerland
|
I'm sure this is an FAQ, but the first 12 items Google returned do not have this question in it. I have a SortedDictionary(of String, String) where the first item is an apartment number and the second a tenant name. I populare, then loop over the results and print, and I get something like... A-10 Bob Smith A-12 John Taylor A-1 Alice Monroe A-2 Janice O'Dell I am at a complete loss as to what this sorting is trying to do, but in any event, I need this list to be A-1, A-2, A-10, A-12 (etc.) We are forbidden from using LINQ (above my pay grade), so is there some easy way to change the sorting to be as expected?
|
Anyone have a good resource or provide a sample of a natural order sort in C# for an FileInfo array? I am implementing the IComparer interface in my sorts.
|
I recently downloaded the 2018 MacTex suite, and the following MWE fails to compile, \documentclass{beamer} \usepackage{subfig} \begin{document} \begin{frame} Testing MWE \end{frame} \end{document} with error code ./Untitled.tex:3: Undefined control sequence. <argument> \@@magyar@captionfix So, what is the "correct" way of adding side-by-side subfigures with captions now?
|
\documentclass{beamer} \usepackage{subfig} \begin{document} test \end{document} returns undefined control sequence \@@magyar@captionfix (It was not so in January; I am on fully updated pretest)
|
In the new trailer we see Logan at the very end holding hands with a girl (sorry I don't know who she is), also throughout the clip we see his beard and there are quite a lot grey hairs in it: Has Logan aged considerably?
|
In the trailer for the upcoming movie Logan (2016), we can see that Wolverine's back is covered in scars: However, in the rest of Fox's X-Men/Wolverine movies, he always heals without leaving scars. Why or what would cause him to have scars that his healing can't fix?
|
I have this search controller and I want to set it up to check every letter in search input but I don't know how to do it with regex. module.exports.search = (req, res, next) => { Character.find({ $or: [ { firstName: req.query.search }, { lastName: req.query.search } ] }) .then(characters => { res.status(200).send(characters); }) .catch(next); } Also, I have tried with { firstName: /req.query.search/ } , but it doesn't work. Any help would be great.
|
I would like to create a String.replaceAll() method in JavaScript and I'm thinking that using a regex would be most terse way to do it. However, I can't figure out how to pass a variable in to a regex. I can do this already which will replace all the instances of "B" with "A". "ABABAB".replace(/B/g, "A"); But I want to do something like this: String.prototype.replaceAll = function(replaceThis, withThis) { this.replace(/replaceThis/g, withThis); }; But obviously this will only replace the text "replaceThis"...so how do I pass this variable in to my regex string?
|
I'd never seen this kind problem before, and don't know where to start. Any help is appreciated. Thank you very much! A palindrome is a number that is the same forwards and backwards. For example, $212$ and $21466412$ are palindromes. Consider an arbitrary palindrome with n digits where n is even. Find a formula, in terms of $n$, of how many $n$-digit palindromes exist. All equivalent answers will be accepted.
|
A palindrome is a set of characters which equal the same thing forwards and backwards, for example; abccba. For a set of a given amount of characters (we can use 9 as an example) how would you calculate the amount of palindromes of characters mathematically? This doesn't mean the words that can be formed but rather characters which are the same at start characters and end characters. What formula can be used to calculate this for simple lengths like 9 with lowercase letters?
|
I have an LNK2019 error that has something to do with how I am setting up a function that takes a list& parameter with template. Is there a proper way to set up a list as a parameter like this? I thought this would be a neat way to reduce lines of code for multiple classes using the same functionality. I'm sure this is a duplicate question so I apologize, I have not yet found an answer. Helpers.h: #pragma once #ifndef HELPERS_H #define HELPERS_H #include <list> #include <string> void stringRemoveCommas(string& str); void stringToUpperAll(string& str); template<class T> bool doesItemExist(string& str, list<T>& lst); // POI #endif // !HELPERS_H Helpers.cpp template<class T> bool doesItemExist(string& str, list<T>& lst) { for (auto it = lst.begin(); it != lst.end(); ++it) { if (it->getName() == str) return true; } return false; } ObjectList.cpp: #include "ObjectList.h" // includes "Helpers.h" bool addObject(string& str, list<Object>& lst) { stringRemoveCommas(str); // works fine stringToUpperAll(str); // works fine if (!doesItemExist(str, lst)) // unresolved external symbol { Object obj(str); lst.push_back(obj); return true; } return false; } result: error LNK2019: unresolved external symbol "bool __cdecl doesItemExist(class std::basic_string<char,struct std::char_traits,class std::allocator > &,class std::list<class Object,class std::allocator > &)" (??$doesItemExist@VObject@@@@YA_NAAV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@AAV?$list@VObject@@V?$allocator@VObject@@@std@@@1@@Z) referenced in function "bool __cdecl addObject(class std::basic_string<char,struct std::char_traits,class std::allocator > &,class std::list<class Object,class std::allocator > &)" (?addObject@@YA_NAAV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@AAV?$list@VObject@@V?$allocator@VObject@@@std@@@2@@Z) 1>D:\VS_Projects\Object Manager\Debug\Object Manager.exe : fatal error LNK1120: 1 unresolved externals
|
Quote from : The only portable way of using templates at the moment is to implement them in header files by using inline functions. Why is this? (Clarification: header files are not the only portable solution. But they are the most convenient portable solution.)
|
I am currently using XUbuntu 20.04, and I extracted my themes using tar -xvf filename.tar.xz my themes are now in the downloads folder but won't popup in my apperances.. I would like to add that I am a newbie to Linux. Thank you in advance for any help.
|
I want to install this but i have no idea how to do it. Can anyone give me a sep-by-step please?
|
When I insert a USB stick or camera flash card I get the following error: unknown filesystem type 'exfat' Is there a simple way to add exFAT support to Ubuntu without kernel patching?
|
In Ubuntu 13.04 there was an option to use the PPA by Relan in order to get ExFat functionality. Seeing that in Ubuntu this functionality is now available from the repositories without the PPA I tried this but failed to make it work. So my question is how do I enable exfat support?
|
I'm trying to make a spatial verification. I have a geodataframe with 245 points, and I'm having a bad time trying to check if they're inside a polygon or not. I've been attempting this code, but I just won't work. As far as I understood, geodataframes are slightly different from dataframes when in a for loop. for x in event_log_c.geometry: i = event_log_c.iloc[x].within(hexa) print(i) After running this, it brings me this error: TypeError: Cannot index by location index with a non-integer key hexa is the polygon geodataframe, and event_log_c is the 245 points geodataframe. How can I make a spatial verification iterating a geodataframe? Are there any way of doing this?
|
I'm attempting to do a spatial join much like the example here: . However, that approach seems really inefficient / slow. Even running this with a modest 250 points takes almost 2 minutes and it fails entirely on shapefiles with > 1,000 points. Is there a better approach? I'd like to do this entirely in Python without using ArcGIS, QGIS, etc. I'd also be interested to know if it's possible to SUM attributes (i.e. population) of all the points that fall within a polygon and join that quantity to the polygon shapefile. Here is the code I'm trying to convert. I get an error on line 9: poly['properties']['score'] += point['properties']['score'] which says: TypeError: unsupported operand type(s) for +=: 'NoneType' and 'float'. If I replace the "+=" with "=" it runs fine but that doesn't sum the fields. I've also tried making these as integers but that fails as well. with fiona.open(poly_shp, 'r') as n: with fiona.open(point_shp,'r') as s: outSchema = {'geometry': 'Polygon','properties':{'region':'str','score':'float'}} with fiona.open (out_shp, 'w', 'ESRI Shapefile', outSchema, crs) as output: for point in s: for poly in n: if shape(point['geometry']).within(shape(poly['geometry'])): poly['properties']['score']) += point['properties']['score']) output.write({ 'properties':{ 'region':poly['properties']['NAME'], 'score':poly['properties']['score']}, 'geometry':poly['geometry']})
|
Recently Update Manager ceased working. Ubuntu Software Centre, when I enter it instead, offers to repair, then fails and offers to repair again, and so on. This is the key sentence I keep getting and am sick of seeing: linux-generic depends on linux-image-generic (= 3.2.0.58.69); however: Version of linux-image-generic on system is 3.2.0.59.70. It makes no sense to me. Why would linux need an earlier version than the one installed to update itself? I am not certain, but it may be that this problem started after attempting to install Google Chrome. When I checked with Synaptic PM, having tried some of the suggested apt commands at the unmet dependencies thread to no avail, it identified linux-generic as broken, tried to update to 3.2.0.60.71, but then failed again, saying it needed the earlier version (which synaptic says is installed).But that 3.2.0.60.71 is installed instead! So, it says it needs to upgrade, but then acts like it already has. I have not seen anyone else with precisely (no pun intended) this problem on these forums, though someone else unknown has saved virtually the same system response on pastebin .
|
Today I went over to my grandma because she had some problems with her computer, running Xubuntu 12.04LTS. After fixing 'the problem' (Firefox was set fullscreen..) I ran the usual apt-get update && apt-get dist-upgrade to immediately update everything. Instead I was greeted by an error that some packages where not correctly installed. So I ran dpkg --configure -a. My guess is that, because Firefox was fullscreen, she couldn't figure out how to turn of her computer and had simply turned it of, probably at the exact moment when it was installing automatic security updates. Running dpkg --configure -a however only left me with an error message about unmet dependencies for linux-generic. When running apt-get dist-upgrade again, it told me the same and I should try the -f option. However, even while trying to force the upgrade it still wont install them. This is the output from the commands (added LANG=C because default language is Dutch). jeroen@Bomma:/home/bomma$ LANG=C sudo apt-get dist-upgrade Reading package lists... Done Building dependency tree Reading state information... Done You might want to run 'apt-get -f install' to correct these. The following packages have unmet dependencies: linux-generic : Depends: linux-image-generic (= 3.2.0.37.45) but 3.2.0.38.46 is installed Depends: linux-headers-generic (= 3.2.0.37.45) but 3.2.0.38.46 is installed E: Unmet dependencies. Try using -f. Running it with -f: jeroen@Bomma:/home/bomma$ LANG=C sudo apt-get -f dist-upgrade Reading package lists... Done Building dependency tree Reading state information... Done Correcting dependencies... Done Calculating upgrade... Done The following packages will be upgraded: linux-generic 1 upgraded, 0 newly installed, 0 to remove and 0 not upgraded. 1 not fully installed or removed. Need to get 0 B/1.722 B of archives. After this operation, 0 B of additional disk space will be used. Do you want to continue [Y/n]? dpkg: dependency problems prevent configuration of linux-generic: linux-generic depends on linux-image-generic (= 3.2.0.37.45); however: Version of linux-image-generic on system is 3.2.0.38.46. linux-generic depends on linux-headers-generic (= 3.2.0.37.45); however: Version of linux-headers-generic on system is 3.2.0.38.46. dpkg: error processing linux-generic (--configure): dependency problems - leaving unconfigured No apport report written because MaxReports is reached already Errors were encountered while processing: linux-generic E: Sub-process /usr/bin/dpkg returned an error code (1) I'm out of ideas on how to solve this (other than quickly reinstalling her pretty default xubuntu)? Trying to remove and reinstall the linux-generic package seems rather risky, but maybe that would solve it?
|
I say that "whoever" is the correct grammatical choice in the following sentence: Give the raise to the hardest-working employee, whoever/whomever that may be. I say "whoever" is correct. The reason is that, when we isolate the "whoever/whomever" clause ("whomever that may be"), the phrase converts to "It may be he". "It may be he who is the hardest-working employee", not "It may be him who is the hardest-working employee". Thus, I believe "whoever" is the correct choice here. Am I right? And is my explanation in determining "whoever" on point? This question is different because the "whoever" clause is at the end of the sentence.
|
I can never figure out whether I should use who and whom. Most people use who for both colloquially, but some people say this is not correct. What’s the rule for using who and whom correctly?
|
I have recently purchases new speakers and I have noticed a slight hum coming from the transformer, therefore I am considering replacing it. The transformer, used to power an internal amplifier, specifications are as follows: 230V~50Hz - 13.5V~3.5A. However I'am having trouble finding a replacement with exact same specifications. The wattage of the current transformer is 13.5V * 3.5A = 47.25W, could I use another 50W transformer with different voltage specifications without risking to blow up my speakers? Let me know if you need any additional information.
|
Power supplies are available in a wide range of voltage and current ratings. If I have a device that has specific voltage and current ratings, how do those relate to the power ratings I need to specify? What if I don't know the device's specs, but am replacing a previous power supply with particular ratings? Is it OK to go lower voltage, or should it always be higher? What about current? I don't want a 10 A supply to damage my 1 A device.
|
Show that there is a $6$ x $4$ board whose squares are all black or white, where no rectangle has the four vertex squares of the same color. Also show that on each $7$ x $4$ board whose squares are all black or white, there is always a rectangle whose four vertex squares are the same color. Point: On the board, adjacent houses do not necessarily have different colors. I suspect it involves Pigeonhole principle or something discrete-mathematics, but I don't know how to solve it
|
Suppose that each square of a $4 \times 7$ chessboard is colored either black or white. Prove that with any such coloring, the board must contain a rectangle (formed by the horizontal and vertical lines of the board) whose four distinct unit corner squares are all of the same color? Any hints on this problem, I guess it could be solved with a clever application of the pigeonhole principle, but I have some difficulty seeing what the objects and what the bags are in which to put the objects to apply the pigeonhole principle, and then argue that such an coloring must exist. It is taken from a textbook on discrete mathematics, and in the text a version of the is proven (using the pigeonhole principle). Hence, I guess it is somehow related to this.
|
The complete definition of inverse of a matrix is- if $AB=BA=I$, then $B$ is inverse of $A$. But l want to know that from $AB=I$, can we comment $B$ is inverse of $A$? Is it possible that $AB=I$ but $BA$ is not equal to $I$? [ I personally think it is impossible since the inverse of a matrix is unique. Please clarify if I am wrong.]
|
If $A$ and $B$ are square matrices such that $AB = I$, where $I$ is the identity matrix, show that $BA = I$. I do not understand anything more than the following. Elementary row operations. Linear dependence. Row reduced forms and their relations with the original matrix. If the entries of the matrix are not from a mathematical structure which supports commutativity, what can we say about this problem? P.S.: Please avoid using the transpose and/or inverse of a matrix.
|
I'm designing a labeled circle and so far it's been a struggle of finding the perfect vertical position for a one letter label. Currently I have two options. Which one seems better centered?
|
I'm currently working on a logo for a client. Here is the work in progress. It seems obvious to me that the S should align with the line above. I feel that the best way of aligning it however is to align the bottom part of the S rather than the top curve, even thought the top curve does protrude more. See the following example Also at the other end of the logo, the A I feel can do something similar, minimising the white space triangle at the end of the logo The end result I think is more pleasing in its alignment I feel that this is correct, but my client is questioning it. This alignment is a habit I have picked up during my career, so I haven't been formally taught this, in fact I can't remember where I picked this up. Tell me, have I picked up a bad habit here? Is my client correct? If this is correct does this type of alignment have a name? Or is there an article somewhere I can refer my client to?
|
I just bought the game yesterday and started playing for the first time. I have all the expansions up to Mists of Pandaria included by default. What I can't understand is whether things are different for me right from the get-go because of events in the expansion packs. For example, a certain town called Auberdine was supposed to be a questing location for my night elf druid character, but for me that town is destroyed as a result of events from Cataclysm and I instead quest at a nearby town on the coast named Lor'danel. I am playing basically the same quests, regardless of the superficial changes, right? Given that I have not "experienced" the plot of the expansions yet, it is confusing that I can see their effects already on the world, because I'm not there yet in the story. Also, this also means that, in this case, there is literally no way now for me to ever experience the original Auberdine, the way it was before the expansions, right? I, and every other new person will always be sent to that other town instead. How this works out in World of Warcraft is confusing to me and I was hoping someone can offer some perspective.
|
I'm just starting WoW for the first time... My question: Is the storyline and quests that I'm doing the same as what players did when the game started (in 2002 or whatever)? Or have events happened in the game that have progressed the entire timeline/story of the game for new players?
|
I was trying to generate a new form group by clicking the button. But after that all I can't remove selected group, because click event doesn't work. here is fiddle example: (function($) { 'use strict'; $(document).ready(function() { $('.add').on('click', function(e) { e.preventDefault(); $('.groups').append('\ <div class="form-group">\ <input type="text">\ <a href="#" id="remove-input">Remove</a>\ </div>\ '); }); $('#remove-input').on('click', '.form-group', function(e) { e.preventDefault(); $(this).parent('.form-group').remove(); }); }); }(jQuery));
|
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.
|
Can we create particle or ? I want to know if we able to generate graviton particle out of some energy. Is it theoretically possible? And could we generate gravitational waves, attract some rock by gravity force? If it possible, suggest we want to lift some 10 kg rock up from ground, how many watt of energy needed for this graviton generator?
|
Why don't they make a ball with irregularities, say the size of a tennis ball, then spin it very rapidly, so it would produce gravitational waves like a spinning star with irregularities on it? Is that not possible with our current technology? Also since gravitational waves can cause time dilation, wouldn't we be able to make some sort of a time machine with that concept?
|
I'm currently working in the following Wilson's theorem excercise: Being $p$ an odd prime. Let $x=((p-1)/2)!$ Using the fact that $(p − 1)! = (1(p − 1)) (2(p − 2)) · · · (((p − 1)/2)((p + 1)/2))$ show that: $$-1 \equiv (-1)^{(p-1)/2}x^2 \pmod p$$ I'm starting from: $$(1(p − 1)) (2(p − 2)) · · · (((p − 1)/2)((p + 1)/2))\equiv -1 \pmod p$$ My plan is to simplify terms on the left side to reach that $(p-1)/2$ which is the power of that $-1$, but I really don't know how can it be raised to that power, any hint or help will be really appreciated.
|
Suppose that $p$ is a prime. Suppose further that $h$ and $k$ are non-negative integers such that $h + k = p − 1$. I want to prove that $h!k! + (−1)^h \equiv 0 \pmod{p}$ My first thought is that by Wilson's theorem, $(p-1)! \equiv -1 \pmod{p}$, and $h!k!$ divides $(p-1)!$ (definition of a binomial). Where would I go from here?
|
I want to list tags of my current post I am using below code <?php $tax_tags = get_terms(array('post_tag')); foreach($tax_tags as $tag){ ?> <p> <?php echo ucfirst($tag->taxonomy).' : ' ?> <a href="<?php echo get_term_link($tag); ?>"><?php echo $tag->name ?></a> </p> <?php } ?> The output is Post_tag : 1024x768 Post_tag : pics Post_tag : india Post_tag : 1366x768 Post_tag : 1920x1080 Post_tag : 1920x1200 Post_tag : 2015 Post_tag : 3d But it shows list of all tags and i want to list tags which is related with Post ID = 17
|
get_terms allows me to get all taxonomy values, but how do I limit this to a certain post? I don't see anyway to feed a specific post ID to get_terms: Perhaps there is another way to achieve this?
|
Following , I found out that currently you cannot view the content of the question you just reviewed in the Low quality post review queue. Instead, you just the set of actions other reviewers (and you) have done. See for example on : See the difference with a review to an answer, for example on , where the content of the post appears normally:
|
On Ask Ubuntu, when I try to view my Low Quality Posts review history and click on the action taken on questions, I can only see the actions taken and no preview of the question. : The question still exists on the site: It seems question review history page is missing this HTML class: <div class="reviewable-post reviewable-post-post_id"> On the other hand, everything is working fine for answers.
|
I'm trying to add a basic contact form I got from bootstrapious to my site but when you click send there is some sort of error happening because it never sends. Here is some backstory: I used to use godaddy's plesk hosting but switched to dreamhost about a year ago, I contacted dreamhost support and they said these are some of the errors they are getting [Thu Aug 02 10:05:00 2018] [warn] [client 71.236.128.206] mod_fcgid: stderr: PHP Warning: Unknown: open_basedir restriction in effect. File(/home/dh_v3jvi3/urbanpioneersmusic.com/handler.php) is not within the allowed path(s): (G:\PleskVhosts\urbanpioneersmusic.com\httpdocs) in Unknown on line 0, referer: [Thu Aug 02 10:05:00 2018] [warn] [client 71.236.128.206] mod_fcgid: stderr: PHP Warning: Unknown: failed to open stream: Operation not permitted in Unknown on line 0, referer: [Thu Aug 02 10:08:50 2018] [warn] [client 71.236.128.206] mod_fcgid: stderr: PHP Warning: Unknown: open_basedir restriction in effect. File(/home/dh_v3jvi3/urbanpioneersmusic.com/contact.php) is not within the allowed path(s): (G:\PleskVhosts\urbanpioneersmusic.com\httpdocs) in Unknown on line 0 Basically my form is trying to find G:\PleskVhosts\urbanpioneersmusic.com\httpdocs which isn't there. They said to find that in my code and update it. I cannot find pleckvhosts or httpdocs in any of my code. Besides that, I downloaded this form directly from bootstrapious and uploaded it without making any changes except for the sendto email address. I have also built a few brand new sites from scratch that never had anything to do with plesk and they are doing the same thing. Has anyone ever come across something like this? Any advice is greatly appreciated, this is so frustrating.
|
limits the files that can be opened by PHP within a directory-tree. I am storing several class libraries and configuration files outside of my web root directory. This way the web server does not make them publicly accessible. However when I try to include them from my application I get an open_basedir restriction error like this: Warning: realpath() [function.realpath]: open_basedir restriction in effect. File(/var/www/vhosts/domain.tld/zend/application) is not within the allowed path(s): (/var/www/vhosts/domain.tld/httpdocs:/tmp) in /var/www/vhosts/domain.tld/httpdocs/index.php on line 5 My web root is here: /var/www/vhosts/domain.tld/httpdocs My libraries and configuration directory are here: /var/www/vhosts/domain.tld/zend What would be the best workaround to relax the open_basedir restriction so that the the directory tree under the domain folder becomes available to my application? I have a number of domains that I want to do this with, and I'm also obviously wary of creating security vulnerabilities. Note: I am using CentOS, Apache, Plesk, and I have root ssh access to the server. And though this doesn't apply to Zend Framework directly, I am using it in this instance. So here is the inclusion from Zend's bootstrap: define('APPLICATION_PATH', realpath(dirname(__FILE__) . '/../zend/application/')); set_include_path(APPLICATION_PATH . '/../zend/library' . PATH_SEPARATOR . get_include_path());
|
I found the following unknown icon on the menu bar of my Mac. Has anyone an idea what it means and how it got there ? Nothing happens if I click on it, and I can't move or remove it.
|
At far left of my top bar you can see a globe-like network sort of icon with what I interpret as a blue download arrow. This icon appeared recently for the first time for unknown reasons. Clicking it, right-clicking it, double-clicking it, etc all produce no effect. It's not interactable. What is this and how can I learn more about it and/or remove it if appropriate?
|
Why some examples are using "endl" instead of "\n"? I heard that processing time of "endl" is longer than "\n" because "endl" has some flushing process. But, there are so many examples using "endl" on the internet. I wanna know why they're using "endl" which thought to be inefficient. Sorry for the awkward English...... Thanks
|
Many C++ books contain example code like this... std::cout << "Test line" << std::endl; ...so I've always done that too. But I've seen a lot of code from working developers like this instead: std::cout << "Test line\n"; Is there a technical reason to prefer one over the other, or is it just a matter of coding style?
|
Some say Sometimes, speakers use the Present Continuous to indicate that something will or will not happen in the near future. Examples: I am meeting some friends after work. I am not going to the party tonight. Is he visiting his parents next weekend? Isn't he coming with us tonight? say: The present continuous is used to talk about arrangements for events at a time later than now. There is a suggestion that more than one person is aware of the event, and that some preparation has already happened. e.g. I'm meeting Jim at the airport = Jim and I have discussed this. I am leaving tomorrow. = I've already bought my train ticket. We're having a staff meeting next Monday = all members of staff have been told about it. I think the second one makes more senses. But my question is that: Is present continuous tense only used for future arrangements? & If there is no future arrangement then we can not use present continuous tense right? See this example, "I am seeing my mom this afternoon" could mean "My mom & I have agreed to meet each other before" "I am going to see my mom this afternoon" could mean "I've got a plan to see my mom, but my mom may not know it she & I have not arranged a meeting yet" "I will see my mom this afternoon": "Will" in this case expresses a Voluntary Action. I'm willing to see my mom. "I am going to the beach this afternoon" could mean I agreed with myself that I am going to go to the beach this afternoon & I prepared stuffs (swimming suits, sun scream, etc) for that.
|
I am reading about present continuous. As the writer states USE 3 Near Future Sometimes, speakers use the Present Continuous to indicate that something will or will not happen in the near future. Examples: I am meeting some friends after work. I am not going to the party tonight. Is he visiting his parents next weekend? Isn't he coming with us tonight? " The lesson says: Sometimes, speakers use the Present Continuous... My question is when are these "sometimes"?
|
More specifically, are there official ways my PCs can “upgrade” their character by spending their gold once they’ve purchased all the basics? I’m composing a campaign in which I want to provide my players with a lot of opportunities to buy goods to further personalize their characters. However, I’ve noticed that most of the items in the PHB are probably items that they can afford very early on, and may even be items they started with. Many of the more expensive items may not even be worth buying once they could be afforded (e.g. spyglass) or are entirely trivial to certain campaigns (e.g. certain vehicles). In a 3.5e campaign I recently played, I could save up my gold and buy magic armor and weapons and wondrous items for my PC and his mount. My DM also let me purchase special armor for my animal companion. This let me further personalize my character in a creative and enjoyable way. In 5e, I’m getting the impression that DMs are discouraged from making magic items buyable. So what can they spend their money on? After leveling up a bit and taking on dungeons of higher difficulties, a PC can buy any armor, weapons, adventuring gear, and mounts he desires and still have enough money that living costs and lodging don’t make much more than a dent in his coin purse, so to speak. If there’s nothing left to buy, then what’s the point of getting all that gold?
|
PHB page 144, Equipment, Wealth, Selling Treasure Magic Items. Selling magic items is problematic. Finding someone to buy a potion or a scroll isn’t too hard, but other items are out of the realm of most but the wealthiest nobles. Likewise, aside from a few common magic items, you won’t normally come across magic items or spells to purchase. The value of magic is far beyond simple gold and should always be treated as such. The above excerpt from the 5E rules seems to explicitly state that there isn't a magic item economy, so unlike previous editions you can't just waltz into a large city and score yourself a +2 flaming sword. Also, selling magic items requires finding a buyer, probably only getting a fraction of the item's worth, etc. I like this from a fluff point of view, as I always felt that magic items never felt special enough, and adding scarcity does that. But: without magic items for sale, in a kick-in-the-door campaign, what do players spend their hard stolen loot on? Once you've got the top level mundane gear and a stockpile of potions (which won't take long), doesn't gold become sort of worthless? My group doesn't play D&D as a heavy simulation game, so while we could technically use gold to buy castles, fleets of ships and keep a family of twelve in an aristocratic lifestyle, or even just stockpile gold as an arbitrary score of success, none of that has an in game, crunch effect. Am I missing something obvious? For clarification, this question isn't necessarily about wanting to obtain magic weapons, more what you spend all that cash on if magic weapons are out of the question. As noted in one of the answers, this is the same as 1st and 2nd ed, but as noted in the comments, it wasn't necessarily a good thing and articles were written on what to do with all your riches...
|
I'm a windows 10 user ..and I like to use Ubuntu in windows..so I choose wsl 2 and I don't know nothing about wsl 1 & 2 ..can anyone please help me on this wsl2 and configuration . And also how to run Linux GUI apps on windows using WSL2
|
I searched around, and currently there are two methods suggested; installing an enhancement for Windows Subsystem for Linux and installing an XServer. I want to know which method is the most hassle-free (easy to install AND to use), and which one is less memory-heavy. I just want Synaptic and CMake. Why couldn't that be a builtin feature?
|
I am trying to benchmark two different implementations of a Java function that checks whether a number contains at least one even digit. The first implementation uses hand written loop, while the second uses a stream. public class StreamTest { public boolean containsEvenDigit(int n) { char [] digits = String.valueOf(n).toCharArray(); for(char d : digits) { if(d % 2 == 0) { return true; } } return false; } public boolean containsEvenDigitStreams(int n) { return String.valueOf(n).chars().anyMatch(i -> i % 2 == 0); } public static void main(String[] args) { System.out.println("============WITHOUT STREAM============"); long start1 = System.nanoTime(); for(int i = 0 ; i < 1_000_000; i++) { (new StreamTest()).containsEvenDigit(11215 + i); } long duration1 = (long)(System.nanoTime() - start1)/1_000_000; System.out.println("Duration : " + duration1 + " milliseconds."); System.out.println(); System.out.println("============USING STREAM============"); long start2 = System.nanoTime(); for(int i = 0 ; i < 1_000_000; i++) { (new StreamTest()).containsEvenDigitStreams(11215 + i); } long duration2 = (long)(System.nanoTime() - start2)/1_000_000; System.out.println("Duration : " + duration2 + " milliseconds."); System.out.println(); } } In the main function, I am not outputting the return values of the functions being tested to eliminate I/O overhead. The outcome shows that the implementation using streams performs much slower than the ones using loop. ============WITHOUT STREAM============ Duration : 119 milliseconds. ============USING STREAM============ Duration : 771 milliseconds. Does this mean that Java 8 streams are slower than hand written loops? Update: I am now using JMH to benchmark the two functions. public class MyBenchmark { private boolean containsEvenDigit(int n) { char [] digits = String.valueOf(n).toCharArray(); for(char d : digits) { if(d % 2 == 0) { return true; } } return false; } private boolean containsEvenDigitStream(int n) { return String.valueOf(n).chars().anyMatch(i -> i % 2 == 0); } @State(Scope.Thread) public static class MyState{ public int x = 1_357_997_531; } @Benchmark public void testLoop(MyState state, Blackhole blackhole) { boolean retVal = containsEvenDigit(state.x); blackhole.consume(retVal); } @Benchmark public void testStream(MyState state, Blackhole blackhole) { boolean retVal = containsEvenDigitStream(state.x); blackhole.consume(retVal); } public static void main(String[] args) throws RunnerException { Options opt = new OptionsBuilder() .include(MyBenchmark.class.getSimpleName()) .forks(1) .build(); new Runner(opt).run(); } } This time too the hand written loop beats the stream by an order of about 8. Here is the result summary. Benchmark Mode Cnt Score Error Units MyBenchmark.testLoop thrpt 200 3578620.170 ± 207106.919 ops/s MyBenchmark.testStream thrpt 200 433884.589 ± 23993.270 ops/s
|
How do you write (and run) a correct micro-benchmark in Java? I'm looking for some code samples and comments illustrating various things to think about. Example: Should the benchmark measure time/iteration or iterations/time, and why? Related:
|
For a positive integer $n$, let $p(n)$ the largest prime divisor of $n$. Show that there exist infinitely many positive integers m such that $p(m − 1) < p(m) < p(m + 1)$. Let $q$ be odd prime and $a<b$. $q^{2^b} - 1 =(q-1)(q+1)(q^2+1)...(q^{2^{b-1}}+1)$ $q^{2^{a}}+1 $ is a divisor of $ q^{2^{b}}-1 $ I don't know how to get the required inequality.
|
Let $p(n)$ denote the largest prime factor of $n$. Prove that there are infinitely many $n$ such that $$p(n)<p(n+1)<p(n+2).$$ Edit: My solution: Choose $n=\prod_{i=1}^{k}p_i$, product of the first $k$ primes. This means that $n+1=\prod_{i=1}^{k}p_i+1$ is either a larger prime or has a prime factor larger than that of all factors of $n$. Still not sure about $n+2$.
|
This file runs fine if I comment out the usepackage brazil line. \documentclass{amsart} \usepackage[brazil]{babel} \usepackage{xy} \input xy \begin{document} \[\xy ,(0,0)="A" \endxy \] \end{document} But if I do not comment it out I get an error message and no pdf: ! Paragraph ended before saveid@COORDi was complete <to be read again> Can someone tell me why it is happening? I need to have the babel brazil, and I hope I can use my actual (much longer, of course) xypic with no major changes.
|
I'm writing an elaborate in Italian, and I'm using to draw some diagrams. Unfortunately it seems that babel is interacting with XY-pic, making it impossible to group elements. Here is a MWE: \documentclass[a4paper,10pt]{article} \usepackage[italian]{babel} \usepackage[all]{xy} \usepackage{amssymb} \begin{document} \xymatrix @R=1pt{ a & \mathbb{N} & \Rightarrow & \mathbb{N} & e & f & g \\ 1 & 2 & 3 & 4 & 5 & 6 & 7 \save "1,2"."2,4"*[F.]\frm{} \restore } \end{document} Which outputs: While this is the expected output: Which is the output I get removing the \usepackage[italian]{babel} line. Is there anyway to use both babel and xy-pic and avoiding this interaction between the two?
|
I want to install luke-dash-jr's BIP148 bitcoin PPA which can be found . I've already added the unofficial Bitcoin PPA to my sources.list; that PPA can be found . Both PPAs define a bitcoin package. How do I install just Luke's for the time being? I realize I can just remove the unofficial Bitcoin PPA from sources.list but was wondering if there's a different solution.
|
Let us say I have added a PPA that has X package that I want but it also has Y package that I do not want to use or receive updates from. How can I, from the same PPA, receive updates for a specific package but deny updates from the same PPA for other packages. A step by step example would be good since this has happened to me in several PPAs that have a particular package I want but also add a whole bunch of others that I do not yet want to update.
|
For example, let $f= \sum_{i=0}^n a_ix^i$. If every $a_i\not\in U(A)$, then $\exists b_i\in A$ with $b_i \neq 0$ for every $i$ such that $a_ib_i=0$, so I can take $a = \prod b_i$ reaches what I need. I tried using $f|0$ saying that exists a $g$ such that $fg\equiv0$, but the only thing I've reached with this is this is that the independant term of $fg$ is $0$. Another thing I noticed is that $Im(f) \in A-U(A)$
|
Let $R$ be commutative ring with no (nonzero) nilpotents. If $f(x) = a_0+a_1x+\cdots+a_nx^n$ is a zero divisor in $R[x]$, how do I show there's an element $b \ne 0$ in $R$ such that $ba_0=ba_1=\cdots=ba_n=0$?
|
In the example below, how do I find the address of the member function f template<typename HANDLER> void serialize(HANDLER &h) { // Compiler error (gcc 4.8.1) // test.cxx: In function ‘void serialize(HANDLER&)’: // test.cxx:9:26: error: expected primary-expression before ‘int’ // auto x = &HANDLER::f<int>; // ^ // test.cxx:9:26: error: expected ‘,’ or ‘;’ before ‘int’ auto x = &HANDLER::f<int>; } struct HandlerA { template<typename T> void f() { } }; struct HandlerB { template<typename T> void f() { } }; struct HandlerC { template<typename T> void f() { } }; int main() { HandlerA a; HandlerB b; HandlerC c; a.f<int>(); b.f<int>(); c.f<int>(); serialize(a); serialize(b); serialize(c); }
|
In templates, where and why do I have to put typename and template on dependent names? What exactly are dependent names anyway? I have the following code: template <typename T, typename Tail> // Tail will be a UnionNode too. struct UnionNode : public Tail { // ... template<typename U> struct inUnion { // Q: where to add typename/template here? typedef Tail::inUnion<U> dummy; }; template< > struct inUnion<T> { }; }; template <typename T> // For the last node Tn. struct UnionNode<T, void> { // ... template<typename U> struct inUnion { char fail[ -2 + (sizeof(U)%2) ]; // Cannot be instantiated for any U }; template< > struct inUnion<T> { }; }; The problem I have is in the typedef Tail::inUnion<U> dummy line. I'm fairly certain that inUnion is a dependent name, and VC++ is quite right in choking on it. I also know that I should be able to add template somewhere to tell the compiler that inUnion is a template-id. But where exactly? And should it then assume that inUnion is a class template, i.e. inUnion<U> names a type and not a function?
|
So I have a textfile of which I want to remove everything to the first colon (including the colon). So for example if this is the input 0000007ba9ec6950086ce79a8f3a389db4235830:9515rfsvk 000000da2a12da3fbe01a95bddb8ee183c62b94d:letmein2x 000000edf3179a1cf4c354471a897ab7f420bd52:heychudi:rbhai 000000f636f0d7cbc963a62f3a1bc87c9c985a04:cornetti 0000010a15f5b9315ef8e113f139fa413d1f2eb2:3648067PY128 Then this should be the output 9515rfsvk letmein2x heychudi:rbhai cornetti 3648067PY128 Note that the second colon in line 3 remain, only from the start of each line to (including) the first column should be removed. Is there a quick way to do this with grep or awk?
|
I am trying to delete certain text that appears before / on every line. I have something like: testing.db.com/7fad416d-f2b3-4259-b98d-2449957a3123 testing.db.com/8a8589bf-49e3-4cd7-af15-6753067355c6 and I just want to end up with: 7fad416d-f2b3-4259-b98d-2449957a3123 8a8589bf-49e3-4cd7-af15-6753067355c6 Can anyone help me with a regular expression? Everything I have found is deleting after /, not before.
|
I have a valid Canadian Study Permit - Visa and will be travelling to Toronto Canada this summer via British Airways and I've booked and paid for my flight ticket, which has 2 connections from Muritala Muhammad Airport in Lagos to Heathrow Airport London and to Newark Liberty International (EWR) to LaGuardia Airport (LGA) in order to board my final flight to Toronto. My question goes thus: do I need a Transit Visa to board the US bound plane from Heathrow to Newark International and transiting from Newark Liberty International to LaGuardia Airport to board my last flights to Toronto?
|
In Europe usually you don't need to go through immigration to change planes (unless you are entering/exiting Schengen). Is it the case in the US as well? May I catch a connecting flight on one of the US airports if I don't have US visa?
|
I read the related post, but my situation is a bit different. Additional background - I installed new 105 shifters and derailleurs two years ago (~5000 miles) along with chain and cassette. I also had a 53T chain ring put on in 2013. All was good. Had slight hang-up with slack shifting (to higher gears) on rear cogs this spring, so I replaced the cable and sheaths to the rear derailleur. All was good again. The bearings in my freewheel started making noise last week. Which brings me to the present. I just replaced the rear wheel, cassette and chain on my 30-speed road bike. The derailleurs shift perfectly and the chain travel when pedalling is smooth and quiet. However when I stand up or dig in on a hill the chain will skip on the cassette. It happens on all THREE chain rings in the front and the spectrum of cogs on the cassette. I thought sure it was a stiff link in the chain, but could not find an issue with it when manually flexing each link. I tweaked the rear derailleur to the point of shifting cogs in both directions and still have the issue. Any suggestions?
|
I have a mountain bike where the chain intermittently skips when put under load on the middle (and very rarely on the smallest) chain ring. It is not related to shifting. I've taken several steps to correct it including: calibrated front and back gear shifters replaced the chain replaced the rear gears replaced the middle gear at the pedals (which was the most affected) To my great frustration the problem is still there! Could this be because of the derailer? The chain seems tight enough. Help from any gurus out there would be greatly appreciated. Update: I've tried fiddling with the back screw on the back-derrailer (not the L/H-screws) in the hope that it was a chain tension issue but it did not help. I've also checked the chain for stiff links but could not find any. I am not able to reproduce it when not riding the bike so I am not certain where and how the chain skips. I am at my wits end and planning to bring it to a different repair shop with a sensai mechanic so hopefully he will be able to sort it out. Update 2: Solved. See below.
|
Suppose there are two users : user1 & user2. Now we know that if I give top -u user1, I can see only the process respective to user1. But if I do top -u user2, I can see all the process running under user2. Similar is the case with ps -f -U user1. Is there a way to make ps & top restrict to only see the processes running under their Id & not others ?
|
Is it possible to configure process hiding for certain user groups under a linux system? For example: Users from group X should not see processes owned by users from group Y in ps/top or under /proc. Is it possible to configure such a setup with SELinux? (I vaguely remember a similar feature in the funny grsecurity patch set - but IIRC, it was more generic - and besides, I want to configure a stock linux distro without having to maintain a custom kernel.) Edit: For better illustration, . The example is not that generic, but one can configure that a user or some users can only see information of their own processes in ps etc.
|
I just installed (dual boot) Ubuntu 16.04 (amd64) on my HP Pavilion (i3-7100, 1TB) laptop but it is not showing any available wifi device. When I look at network in settings only network proxy is displayed and also I don't have Ethernet cable slot in my laptop. How can I fix this problem? rfkill list all displays the following result: 0: acer-wireless: Wireless LAN Soft blocked: yes Hard blocked: no output of the command : lspci -nnk | grep -A2 Network 01:00.0 Network controller [0280]: Intel Corporation Device [8086:24fb] (rev 10) DeviceName: Intel Dual Band Wireless-AC 3168 802.11 ac 1x1 WiFi + BT 4.2 Combo Adapter Subsystem: Intel Corporation Device [8086:2110]
|
I searched many solutions on this site but most of them were referring to Broadcom Wifi drivers while mine has Intel one. Output of lspci -knn | grep Net -A2 arijit@HP-AU134TX:~$ lspci -knn | grep Net -A2 05:00.0 Network controller [0280]: Intel Corporation Device [8086:24fb] (rev 10) DeviceName: Intel Dual BandWireless-AC 3168 802.11 ac 1x1 WiFi + BT 4.0 Combo Adapter Subsystem: Intel Corporation Device [8086:2110] Output of rfkill list arijit@HP-AU134TX:~$ rfkill list arijit@HP-AU134TX:~$ i.e No Output Output of uname -a; dmesg | grep iwl arijit@HP-AU134TX:~$ uname -a; dmesg | grep iwl Linux HP-AU134TX 4.4.0-31-generic #50-Ubuntu SMP Wed Jul 13 00:07:12 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux
|
I manually compiled mono from the /tmp directory (4.9.1) and found that it was too unstable for me, so wanted to revert back to the install from the repos. I foolishly did a reboot before doing this, so the compiled code in /tmp had gone. So, I thought I'd remove the directory of where mono is installed and mark the package mono-complete as being automatically installed again. (Un)Surprisingly, this did not work. Now, if I do a which mono it reports that it isn't installed. If I mono I get the same message. However, when I do an apt install mono-complete or mono-devel it reports mono-complete is already the newest version. I have checked in the env and there is no reference to mono. How can I sort this mess out and get back to being able to install mono from packages.
|
I usually prefer to fix a Linux system than to reinstall from scratch. My computers have seen many distribution upgrades and a list of PPAs or third-party repositories. APT usually makes sure that everything works in the end. However, the fact that the package manager thinks that all required packages are 'installed' does not guarantee that all the files are present on the file system. Such a such situation may occur if you have to work-around dependency problems with dpkg --force-*. One could also reproduce such a situation by deleting a file from /usr as root. Is there a simple way to verify whether all files belonging to an installed package are present? If a such a problem package is found, aptitude reinstall fixes the problem.
|
First of all, it is important to note that I'm not very savvy in neither general relativity nor any other area of expertise that answering this question may require. Therefore, I mean for the question to be answered in layman's terms. Okay, now to the question itself: as far as I understand, for a given energy total in a system, its contents can theoretically be put into any other configuration of energies with the same total sum (if that makes sense). Therefore, if that sum is zero, the contents can be configured into, basically, 'nothing', which also has an energy total of zero. However, with the universe, the only sources of negative energy are the fundamental forces. I think it may be reasonable to put all forces other than gravity aside, as only gravity is generated (sorry for funky wording) by something which itself is another source of energy (mass), and all the other forces eventually cancel out. If we also ignore the dark energy, we are left with a collection of masses that will eventually crunch together. Here is the problem I have with this: where will the mass go? Even if the potential energy of every point in the universe is zero (i.e. all the mass in the universe has now been smushed into a point), there is still mass to deal with, right? I know I am probably wrong in many, many places in this question, but can you explain the general, underlying flaw behind my reasoning?
|
Does the concept of energy always exist for any physical system? If yes is there a proof? If no, any counterexamples?
|
Since we spent so many hours reading text and code in this site, could we somehow customize the colors of the site? Maybe give the possibility to anyone make their own themes. It's undeniable that in a few weeks there will be some very good themes available, and some dark themes with low contrast will make reading easier.
|
It would be nice if users could add their own styles to the CSS-Rules on SO. This is nothing more than a textarea in the user preferences that takes precedence over the default styles. Users could create themes that are easier for them to use, and share with others. Sure, I could use my own local browser to override the styles, but that won't benefit me working on the other two machines that I visit regularly from.
|
I still remember the feeling, when I learned that a number is divisible by $3$, if the digit sum is divisible by $3$. The general way to get these rules for the regular decimal system is asked/answered here: . Now I wonder, what divisibility rules an alien with $12$ (or $42$) fingers would come up with? So let $n=\sum_k c_k b^k$ be the representation with base $b$. Looking at some examples shows indicate that $n$ is divisible by $b-1$, if $\sum_k c_k$ is. This seems to be a poor man's extension to the decimal divisibility by $9$ rule. The answer to the above mentioned question, says that "One needn't memorize motley exotic divisibility tests. ". Motley exotic divisibility tests are very welcome here!
|
How could we make the same division rules for other number systems, like in our decimal system: a number is divisible with 2 if it's last digit is 0,2,4,6,8, by 3 if the sum of digits is divisible with 3, and so on. Can we do the same rules for g-based number systems too, where g is not 10, and greater than 1?
|
Why are FETs preffered over BJTs nowadays? Does this have to do with higher switching speed. Also, if someone says that they are preferred due to low cost, please tell the industrial rate comparison of both.
|
In my experimentation, I've used only BJTs as switches (for turning on and off things like LEDs and such) for my MCU outputs. I've been repeatedly told, however, that N-channel enhancement-mode MOSFETs are a better choice for switches (see and , for examples), but I'm not sure I understand why. I do know that a MOSFET wastes no current on the gate, where a BJT's base does, but this is not an issue for me, as I'm not running on batteries. A MOSFET also requires no resistor in series with the gate, but generally DOES require a pull-down resistor so the gate doesn't float when the MCU is rebooted (right?). No reduction in parts count, then. There doesn't seem to be a great surplus of logic-level MOSFETs that can switch the current that cheap BJTs can (~600-800mA for a 2N2222, for example), and the ones that do exist (TN0702, for example) are hard to find and significantly more expensive. When is a MOSFET more appropriate than a BJT? Why am I continually being told that I should be using MOSFETs?
|
Can you guys show me some different ways of using integration by parts to evaluate $\int \cos(\sqrt{x})\,dx$? I was trying with $u=\cos(\sqrt{x})$ and $dv=dx$, and it may have worked out eventually but things were getting messy. Maybe there's a substitution to be made before we assign $u,v$ to simple things. Thanks!
|
My textbook says I should solve the following integral by first making a substitution, and then using integration by parts: $$\int cos\sqrt x \ dx$$ The problem is, after staring at it for a while I'm still not sure what substitution I should make, and hence I'm stuck at the first step. I thought about doing something with the $\sqrt x$, but that doesn't seem to lead anywhere as far as I can tell. Same with the $cos$. Any hints?
|
I didn't think I had to add an extra z when making it plural, but I did. Why is that? Just some weird anomaly like so many things in English spelling? Or is there a history behind it?
|
The plural of "quiz" is spelled with double "z" while the plural of "box" (and sometimes "bus") is spelled with a single last consonant. Why is it so? Is this the general rule to double the last consonant to keep the syllable closed?
|
As a reviewer : User is editing too much post today. Obviously not interested in content but in reputation Not exactly a valid rejection reason in general, but , and while a few were ok, many merely placed keywords in backticks (which btw should not be done for non-code, e.g. for the reasons listed ) and should have been rejected (a shockingly large amount of these were however approved). This suggestion behaviour is most certainly not what the system is intended for, so I wonder if there is a limit on suggestions in place? Note I'm not referring to the but to a general limit of, say, 20 suggestions per day. As many of you have noted, reviewers actually accepting such crappy suggestions are a problem. But they are not the problem, but rather a consequence. Limiting the amount of edit suggestions1 limits the source of all evil bad edits, while the serious reviewers are rather the victims who loose the battle against are slower than robo-reviewers and thus more likely to reject a suggestion when it has already been approved. We should educate the editors to "make it count", which to my knowledge is already the desired behaviour, but not in a vague "minimum character count" - one missing backtick edited in may severely improve a post, while a second one to emphasize a non-code keyword is bad. 1 And as discussed in comments, 20/day is not necessarily a good measure, something like max. 5 unapproved edits in the last 24 hours where approval a) make another edit available and b) increases that limit with time might be better - the suggestion here is about the consideration of such a limit, not about its implementation details
|
We need a hard rate limit on suggested edits, to limit the damage someone can do with blasting the review queue with minor edit suggestions. Case in point: peppered the site with a whopping 133 tag-only edit suggestions in 2 hours and 15 minutes. That's one edit every minute on average, but towards the end he was entering a new suggestion every 20 seconds. He only stopped because a drew enough rejections to have him banned from entering more. If there was a limit to the number of suggested edits you can enter in a time period we could have stopped this guy earlier. No <2k user needs to edit hundreds of tags across that many questions in 2 hours time. Considerations There are cases where a retag drive or tag burninate justifies editing a larger number of posts, but I'd be fine if such tasks were limited to people with 2k+ reputation. A retag or burninate job requires a minimal engagement with the community to know when they are justified anyway. The suggested edit review process, by itself, was clearly not enough to stop this barrage. It cannot be seen as a rate limiting measure, at least not as a sufficiently efficient one. The vast majority of the edits made in the above example were too minor, leaving spelling, grammar and formatting mistakes in the post untouched. The user was going too fast to pay attention to such details anyway. Yet this user has 98 approved edit suggestions, but all but 6 or 7 I'd have rejected as too minor, so the review process itself is broken. What should be limited The number of review votes reviewers have is already limited; I burned through 20 reviews in short order just reviewing the suggestions from just this one user. Certainly the number of unreviewed suggestions should be limited to let reviewers catch up with a user like this. I'd say having 20 outstanding suggested edits pending review is plenty. Suggested edits should be made with some consideration; we don't want minor edits, so if you are suggesting more than 20 in an hour (that's 1 every 3 minutes) you are not improving posts anymore, you are gaming the system to gain reputation.
|
I'm working on an API endpoint that takes a POST request of form x-www-form-urlencoded. This mostly takes your typical set of string values, but in some cases, the values can be an array, which come in as duplicate keys, like so: name1=foo&name2=bar&arr=value1&arr=value2&arr=value3 I want to end up with the following: [ 'name1' => 'foo', 'name2' => 'bar', 'arr' => [value1, value2, value3] ] I've tried the following: filter_input_array(INPUT_POST, [ 'name1' => FILTER_SANITIZE_STRING, 'name2' => FILTER_SANITIZE_STRING, 'arr' => [ 'filter' => FILTER_DEFAULT, 'flags' => FILTER_FORCE_ARRAY ] ]); which gives me ( [name1] => foo [name2] => bar [arr] => Array ( [0] => value3 ) ) and parse_str(file_get_contents("php://input"), $params); which gives me: ( [name1] => foo [name2] => bar [arr] => value3 ) In both cases, the duplicate keys are overwritten, and I only get the last value. The top comment of the function mentions that it does not parse duplicate keys in the CGI standard way, and presents a hefty function to manually parse out the fields. I'm wondering if there is a simpler way to do this, I simply want to get a sanitized array of all the input from the x-www-form-urlencoded POST call. Ideally just something like return filter_input_array(INPUT_POST, FILTER_SANITIZE_STRING); // also FILTER_SANITIZE_ARRAY for duplicate keys Is there any function that can accomplish this basic task, or do I really need to roll my own? If so, what's the best way to blanket sanitize an arbitrary user-input array coming in via this POST method, since I would wind up just using a function similar to that in the linked comment above?
|
I have a PHP application that will on occasion have to handle URLs where more than one parameter in the URL will have the same name. Is there an easy way to retrieve all the values for a given key? PHP $_GET returns only the last value. To make this concrete, my application is an OpenURL resolver, and may get URL parameters like this: ctx_ver=Z39.88-2004 &rft_id=info:oclcnum/1903126 &rft_id=http://www.biodiversitylibrary.org/bibliography/4323 &rft_val_fmt=info:ofi/fmt:kev:mtx:book &rft.genre=book &rft.btitle=At last: a Christmas in the West Indies. &rft.place=London, &rft.pub=Macmillan and co., &rft.aufirst=Charles &rft.aulast=Kingsley &rft.au=Kingsley, Charles, &rft.pages=1-352 &rft.tpages=352 &rft.date=1871 (Yes, I know it's ugly, welcome to my world). Note that the key "rft_id" appears twice: rft_id=info:oclcnum/1903126 rft_id=http://www.biodiversitylibrary.org/bibliography/4323 $_GET will return just http://www.biodiversitylibrary.org/bibliography/4323, the earlier value (info:oclcnum/1903126) having been overwritten. I'd like to get access to both values. Is this possible in PHP? If not, any thoughts on how to handle this problem?
|
Well, I can't find the example on how to solve this. If I multiply $$ \dfrac{2}{\sqrt[3]{9}+\sqrt[3]{15}+\sqrt[3]{25}} $$ with $$ \dfrac{\sqrt[3]{9}-\sqrt[3]{15}+\sqrt[3]{25}}{\sqrt[3]{9}-\sqrt[3]{15}+\sqrt[3]{25}} $$ or similar, it just gets even more complicated, and I get 4 terms instead of 3 in the denominator, and more can't be better... Can someone tell me some principle by which all kinds of expressions with 3 or more terms and with different roots could be rationalised? On a test, I haven't got much time to use appropriate formula, as I can for square difference and so on, I need a principle.
|
Rationalize $\dfrac{1}{\sqrt[3]{p^2}+\sqrt[3]{pq}+\sqrt[3]{q^2}}.$ How would I go about doing this without wading through lots of algebra? Is there a trick similar to how you can multiply by $\dfrac{\sqrt a-\sqrt b}{\sqrt a-\sqrt b}$ with square roots? Thanks in advance!
|
I'm new to ubuntu, so I'm learning. I have hp 655 with amd processor. I had win 7, and i bought tp link wn722n for better wifi signal. Now I can't use it, because I use Ubuntu and don't know how to install drivers. I tried this steps but that didn't help. Can anybody help me? The results are: Bus 002 Device 003: ID 0cf3:9271 Atheros Communications, Inc. AR9271 802.11n
|
Hi I am new to Ubuntu and Linux. As I am developing a WiFi product, I want to capture the WiFi traffic wirelessly with Wireshark. Having some searching in the web, I know that I can do that with a USB WiFi adapter and Ubuntu. Then I can run the Wireshark in real monitor/promiscuous mode. Ok so I bought a TP-Link TP-WN722NC (I want to buy the TP-WN722N at first, but the store only has this model). Also I found a laptop and installed the Ubuntu 14.04.1. Then I noticed that I need a driver for this adaptor. So I try to follow the blog post to install the driver ath9k_htc but seems it was not successful. Then I downloaded the backports 3.16-1 by running these two commands: wget https://www.kernel.org/pub/linux/kernel/projects/backports/stable/v3.16/backports-3.16-1.tar.gz tar xvf compat-wireless-2.6.38.2-2.tar.bz2 However, after that point do not know what should I do. Could you help guide me to install the correct driver?
|
It might be nitpicking but the action bar text is covering the button shadow which is quite annoying to see.
|
When selecting a button on the Android app, it highlights in a clearer shade of blue. On Lollipop (not tested other versions), however, the small frame around the the screen title remains solid-blue, as shown in the two following images: Of course this is a super-minor bug, but it costs nothing to report it! (This is my first Meta contribution, I hope it fits into the good usages!)
|
I am on Ubuntu 14.04, with Google Chrome I have problem with these journal and Facebook notifications that pop up all the time. I have set up content settings, do not allow any site to show notifications. What should I try next?
|
After upgrading recently, I noticed that when running Chromium, there is a new bell icon in the system indicators area in the upper right. The menu gives the options as such: Chromium - notifications Do not disturb Do not disturb for one hour Do not disturb for one day Are these options only available via the system indicators menu, or can I remove this icon from my view, and access the same options somewhere else? How would I go about removing this?
|
I'm totally confused by this question. I appreciate any help or answer. thanks in advance why is the nontrivial left ideal of M_2(D) minimal? that D is a division ring
|
please first read these then answer my question Let $D$ be a division ring and r, n be two positive integer numbers such that $0 ≤ r ≤ n$. Then $H_r(D)$ denotes the left ideal of $M_n(D)$ containing all matrices whose $j$th column is zero, for every $r < j ≤ n$. Theorem A: Let $D$ be a division ring and $n$ be a positive integer number. Then for every left ideal $I$ of $M_n(D)$, there exist an invertible matrix $P$ and integer $r$, $0 ≤ r ≤ n$, such that $I = PH_r(D)P^{−1}$. Now from theorem A how I can conclude that each left ideal of $M_2(D)$ is minimal? I'm totally confused with this
|
I’m writing a tweet that starts with: Put on a tie today. “Work,” you ask? But I’m not sure where the punctuation should be. Is the above correct? Or, is it something like: Put on a tie today. “Work?” you ask. Or something else?
|
If a sentence contains a complete question, but ends with a statement, should it be punctuated with a question mark? Example: Could she go to the store, he wondered
|
Attempting to clone part of an image causes the OutOfMemoryException to be thrown. The line that causes the error is: TileImage = TileFileImage.Clone(CloneRect, TileFileImage.PixelFormat); TileFileImage is 271x271px in size. CloneRect's upper left corner is at (186, 16) and its lower right corner is at (202, 32) before the exception is thrown. Both TileImage and TileFileImage are Bitmaps. CloneRect can never be larger than 271x271px. Logic in the method the above statement is in prevents the rectangle from exceeding the bounds of the image. How do I fix this? UPDATE: I checked over my logic and found the problem. Some indices could end up outside the source Bitmap.
|
Why am I getting an out of memory exception? So this dies in C# on the first time through: splitBitmaps.Add(neededImage.Clone(rectDimensions, neededImage.PixelFormat)); Where splitBitmaps is a List<BitMap> BUT this works in VB for at least 4 iterations: arlSplitBitmaps.Add(Image.Clone(rectDimensions, Image.PixelFormat)) Where arlSplitBitmaps is a simple array list. (And yes I've tried arraylist in c#) This is the fullsection: for (Int32 splitIndex = 0; splitIndex <= numberOfResultingImages - 1; splitIndex++) { Rectangle rectDimensions; if (splitIndex < numberOfResultingImages - 1) { rectDimensions = new Rectangle(splitImageWidth * splitIndex, 0, splitImageWidth, splitImageHeight); } else { rectDimensions = new Rectangle(splitImageWidth * splitIndex, 0, sourceImageWidth - (splitImageWidth * splitIndex), splitImageHeight); } splitBitmaps.Add(neededImage.Clone(rectDimensions, neededImage.PixelFormat)); } neededImage is a Bitmap by the way. I can't find any useful answers on the intarweb, especially not why it works just fine in VB. Update: I actually found a reason (sort of) for this working but forgot to post it. It has to do with converting the image to a bitmap instead of just trying to clone the raw image if I remember.
|
I have installed VMware on Ubuntu 13.10 but when i launch it then a message said that i have to specify the path for the linux-headers-3.11.0-19-generic. Now i'm not expert on linux, i give the command "uname -a" here the result: Linux MarioP 3.11.0-19-generic #33-Ubuntu My knowledge of linux kernel stops here. Can you help me?
|
I installed the VMware bundle on my Ubuntu 11.04 successfully but when I open it it gives me this window and I don't know the path to this C headers.
|
I have String in below form : {1:F01ANZBSGSXAXXX166753}{2:O1030921091130DEUTSGSGXXXX28705821270911234}{3:{103:MEP}{113:NORQ}{108:10ROTRM911250002}} I have to create a regular expression in order to get following substring from the above string : {1:F01ANZBSGSXAXXX166753} {2:O1030921091130DEUTSGSGXXXX28705821270911234} {3:{103:MEP}{113:NORQ}{108:10ROTRM911250002}} {103:MEP} {113:NORQ} {108:10ROTRM911250002} The pattern it follows is : Pattern = {key:value} where value can contain nested Pattern I tried to form one : ({\d*:[\s\S][^}]*}) But this one fails in case of substring 3 i.e. in case of nested expression.
|
Is it possible to write a regular expression that matches a nested pattern that occurs an unknown number of times? For example, can a regular expression match an opening and closing brace when there are an unknown number of open/close braces nested within the outer braces? For example: public MyMethod() { if (test) { // More { } } // More { } } // End Should match: { if (test) { // More { } } // More { } }
|
Everyone familiar with Harry Potter is likely familiar with the Hogwarts Express, the direct line from Kings Cross station in London to Hogsmeade. But being a direct line, this would seem to require everyone who wanted to use it to first travel to London. Assuming Hogwarts is the only school for students aged 11+ local to England (i.e. Hogwarts isn't just for London locals), are there alternative conventional (Muggle) means of getting students from other parts of the country to Hogwarts or Hogsmeade?
|
We know that most students get to Hogwarts by train, and that Harry Potter and Ron Weasly arrived by flying car, but are there other ways to get to the school?
|
Can I connect two external monitors to my 12" Retina MacBook (early-2015) How do I do it and can it be VGA or only HDMI
|
I am trying to switch from using my desktop to my macbook pro as my primary machine. I have 2 monitors (each 1600x1200 resolution) I'd like to use as external monitors for my macbook pro (from 2013). Both monitors support VGA and DVI input (along with s-video and composite, although I've never used those before). Looking at the laptop, it has 1 hdmi port, and 2 thunderbolt ports. The 'about this mac' reports I'm using osX 10.10.4, with a early 2013 15-inch Retina display. Graphics card is nVidia GeForce GT 650M 1024 MB. How do I find out if this is possible? If it is possible, how do I do it?
|
In QM particle on a ring, the Schrodinger in cylindrical coordinates is given by $$\frac{d^2\psi}{d\phi^2}=\frac{-2IE}{\hbar^2}\psi$$ where $I$ is the moment of inertia. Setting $ k^2=2IE/\hbar^2$, the solution is supposed to be $\psi_k(\phi)=e^{ik\phi}/\sqrt{2\pi}, \space k\subseteq\Bbb{Z}\tag{1}$ But the general solution is:$$\psi(\phi)=c_1e^{ik\phi}+c_2e^{-ik\phi}\tag{2}$$ I am unable to derive eq(1) from eq(2) using: Normalization: $\int_0^{2\pi}|\psi|^2d\phi=1$ $\space$and Cyclic boundary condition :$\psi(\phi)=\psi(\phi+2\pi)$. Can anyone guide me with the math? Edit: I think that in , OP asks why is $c_-$ is taken as zero. As far as I know we can't take any constant to be zero. I am looking to derive eq(1) systematically, only from the two conditions stated. I think that by solving the integrals, we will eventually get $c_1=\frac{1}{\sqrt{2\pi}}$ and $c_2=0$.
|
In , the general solution for the wavefunction, with $k = R \sqrt{2 m E / \hbar^2}$, $R$ being the ring radius, $c_{+, -}$ being constants, $E$ the energy, and $m$ the particle mass, is $$\psi(\theta) = c_{+} e^{i k \theta} + c_{-} e^{-i k \theta}$$ Periodic boundary conditions give the eigenvalues $k = n$, with $n=0, \pm 1, \pm 2, \ldots$. At first glance the problem looks "underdetermined" - it seems that there are two unknowns ($c_{+}$ and $c_{-}$) but only one condition to find them, normalization of the wavefunction $\langle \psi \lvert \psi\rangle = 1$. But in my naive understanding, the problem is actually not underdetermined because one may set $c_{-} = 0$, as is seemingly done on in order to normalize the wavefunction. Why may one set $c_{-} = 0$? Or, why do and textbooks (below) seemingly set $c_{-} = 0$? And how can we treat the general case with $c_{-} \ne 0$? Even if we do not trust , most textbooks on introductory quantum look at the ring problem and do the same thing. For example: "Introduction to Quantum Mechanics: in Chemistry, Materials Science, and Biology" By Sy M. Blinder "Atkins' Physical Chemistry" By Peter Atkins, Julio de Paula "Quantum Mechanics for Chemists" David O. Hayward "Case studies in atomic physics 4" edited by E. McDaniel "Quantum Chemistry" By John P. Lowe
|
when I open up the terminal and write the command cd Desktop also I have tried cd /Desktop a message appears that no file or directory was found what I suppose to do? I have logged in as a root but still have the same problem any help?
|
How do I change directories to downloads, from the home folder, in the latest version Ubuntu 12.10? I tried cd /downloads, but it gave an error saying that there is no such directory.
|
I have 2 objects, and I need to add one object to the other object. var loc = { leftArray: [], topArray: [], bottomArray: [], rightArray: [] } var obj = { id: "ce", icon: "logo/image.png", name: "CE", type: "type2", version: 3.4 } var obj = { id: "ce", icon: "logo/image.png", name: "CE", type: "type2", version: 3.4, leftArray: [], topArray: [], bottomArray: [], rightArray: [] } Is there any simple way to do this?
|
I need to be able to merge two (very simple) JavaScript objects at runtime. For example I'd like to: var obj1 = { food: 'pizza', car: 'ford' } var obj2 = { animal: 'dog' } obj1.merge(obj2); //obj1 now has three properties: food, car, and animal Does anyone have a script for this or know of a built in way to do this? I do not need recursion, and I do not need to merge functions, just methods on flat objects.
|
Find all real functions $f\colon \mathbb{R}\rightarrow \mathbb{R}$ so that $(x+y)(f(x)-f(y))=f(x^2)-f(y^2)$. Can someone at least find the value of $f(1)$ if it is possible, it would help me.
|
Find all functions $f$ that assign a real number $f(x)$ to every real number $x$ such that $$(x+y)f(x)+f(y^2)=(x+y)f(y)+f(x^2)$$ I've tried subbing in heaps of values but I keep getting things like $f(0)=f(0)$ and other such useless results. Any help would be hugely appreciated.
|
We need to calculate this: $$\lim_{n \to \infty} { \sum_{k=1}^{n} { (\frac{nk-1}{n^3})\sin(\frac{k}{n}) } }$$ So I know this is Riemann sum. This is what I started doing: $$\sum_{k=1}^{n} { (\frac{nk-1}{n^3})\sin(\frac{k}{n})} = \sum_{k=1}^{n} { (\frac{k}{n^2 } - \frac{1}{n^3})\sin(\frac{k}{n})}$$ But then I noticed that we can not get $\frac{1}{n}$ outside. How do we exactly know what is the partition?
|
Calculate the limit $$\lim_{n\to \infty} {\sum_{k=1}^{n} {\left(\frac{nk-1}{n^3}\right) \sin\frac{k}{n}}}$$ How exactly do we calculate this limit of the Riemann sum? I am never able to find what is the partition. I know that our $f(x)$ is $\sin(x)$.
|
What I'm trying to do is very simple, I scan a list of strings, then, I pass each string to a new thread for printing. using System; using System.Collections.Generic; using System.Threading; namespace MultithreadingSynchronization { class Program { static void Main(string[] args) { List<string> stringList = new List<string> { "server1", "server2", "server3", "server4", "server5", "server6", "server7", "server8", "server9"}; foreach (string server in stringList) { ThreadStart work = delegate { Threadjob(server); }; new Thread(work).Start(); //Thread.Sleep(10); // 10 ms delay of main thread } } public static void Threadjob(object server) { Console.WriteLine(server); } } } From some reason, there are threads that received wrong value, therefore, the output presents some duplicated strings, and also miss some strings. I'm expecting for this output (the order isn't important): server1 server2 server3 server4 server5 server6 server7 server8 server9 But, sometimes I get this: server3 server2 server5 server5 server7 server4 server8 server9 server9 and sometimes I get this: server2 server2 server4 server3 server6 server7 server7 server8 server9 etc. indeed, if I put a delay after each thread creating, I get what I expect to get. Any idea?
|
I met an interesting issue about C#. I have code like below. List<Func<int>> actions = new List<Func<int>>(); int variable = 0; while (variable < 5) { actions.Add(() => variable * 2); ++ variable; } foreach (var act in actions) { Console.WriteLine(act.Invoke()); } I expect it to output 0, 2, 4, 6, 8. However, it actually outputs five 10s. It seems that it is due to all actions referring to one captured variable. As a result, when they get invoked, they all have same output. Is there a way to work round this limit to have each action instance have its own captured variable?
|
I am using an ST STM8AF5288 microcontroller powered by 5V in one of my projects (, ). Is it possible to directly sense a +12V signal input by port pins? I am using a current limit resistor in the input. All the port pins in the ST STM8AF5288 microcontroller have clamping diodes. Will I able to sense a +12V signal input? Below is the circuit used in my project:
|
I have 12V, Use these 12V to power a device (that has a 12V output signal) and to power a 7805. After the 7805 there is a pic microcontroller where I would have to connect the output from my device. I was thinking of having 2 resistors in a 3/1 ratio in order to have about 4V at the pin of the pic. Can this be done, given that the ground is common, or will it give some sort of problem with the lm7805?
|
Suppose that $R$ is a commutative ring and $I$ is a finitely generated ideal of $R$ such that $I^2=I$. Show that $I=Re$ for some idempotent element $e$. I think I should use induction on the number of generators of $I$. I have proved that it's true for $n=1$: Suppose $I=\langle a\rangle$ for some $a \in I$. Since $I^2=I$ we have $\langle a^2\rangle = \langle a\rangle$ and therefore $\exists r \in R: a=ra^2$. Multiplying both sides by $r$ and setting $e=ra$ we see that $e^2=e$ and $I=\langle e\rangle=\langle ra\rangle\subseteq \langle a\rangle =I$. Therefore, $I=Re$. Now for $n=2$, things look difficult. Suppose $I=\langle a_1,a_2\rangle$. Again, we have $\langle a_1^2,a_1a_2,a_2^2\rangle=\langle a_1,a_2\rangle$ therefore there exists some coefficients in $R$ such that we have: $$a_1 = r_{11}a_1^2 + r_{12}a_1a_2 + r_{22}a_2^2$$ $$a_2 = s_{11}a_1^2 + s_{12}a_1a_2 + s_{22}a_2^2$$ After factorization: $$a_1 = a_1(r_{11}a_1 + r_{12}a_2) + r_{22}a_2^2$$ $$a_2 = s_{11}a_1^2 + (s_{12}a_1 + s_{22}a_2)a_2$$ It isn't easy to see an idempotent element in these relations, let alone finding one that generates $I$.
|
I am trying to understand Nakayama's lemma. It looks like some "fixed point theorem". Using Nakayama's lemma , I can easily solve the following question. I want another proof. Thanks. Let $A$ be a commutative ring with identity, $I$ be a finitely generated ideal of $A$, such that $I^2=I$. Show that there exists an element $e\in I$ with $e^2=e$ and $eA=I$. You can use anything (geometric interpretation are welcomed) except Nakayama's Lemma.
|
I'm using a Lyx 2.0 for my thesis and I have a problem. The bibliography order is the bibliography order of figures index, and not the order of citations in text. Can I solve this? I use an external file (by JabRef). An example:
|
I am having an issue with LaTex/Bibtex presenting my citations in order of appearance. I know there a plenty of questions on this and I have read some of them, but the solutions posted don't seem to do me any good. I am using MacTeX and TeXmaker. I am writing a large document, like a Thesis. Chapters are split between individual Tex files and included using the \include command. I have a large .bib file that is maintained by Mendeley (program I use for storing my references and producing a BibTex file). I am using the package, cite (mainly for doing references like [1-3,6,9]) I have a pretty standard looking document. \documentclass[11pt,a4paper]{report} \setcounter{secnumdepth}{3} \setcounter{tocdepth}{3} \newcommand{\doubleSignature}[3][Alex Mason]{% \parbox{\textwidth}{ \centering #3 \today\\ \vspace{2cm} \parbox{7cm}{ \centering \rule{6cm}{1pt}\\ #1 } \hfill \parbox{7cm}{ \centering \rule{6cm}{1pt}\\ #2 } } } \usepackage[utf8]{inputenc} \usepackage{amsmath} \usepackage{amsfonts} \usepackage{amssymb} %\usepackage[sorting=none]{biblatex} %\bibliography{Alex} % Where journals.bib and phd-references.bi \usepackage[pdftex]{graphicx} \usepackage{enumerate} \usepackage{nomencl} \usepackage{wasysym} \usepackage{booktabs} \usepackage{cite} \usepackage[left=1in,right=1in,top=1in,bottom=1in]{geometry} \graphicspath{{./Diagrams/}} \usepackage[labelfont={sf,bf}, margin=1cm]{caption} \usepackage{subcaption} \renewcommand{\figurename}{Fig.} \renewcommand{\tablename}{Tab.} \renewcommand{\bibname}{References} \author{NAME (MEng)} \title{TITLE} \date{\today} \makenomenclature %------------------------------------------------ \begin{document} \maketitle \pagenumbering{roman} %-----------------------------------------------certificate of originality---------------- -------------------------------------------- \input{CertofOrigin} \begin{abstract} ABSTRACT \end{abstract} %-----------------------------------------------contents------------------------------------------------------------ \tableofcontents \listoffigures \addcontentsline{toc}{chapter}{List of Figures} \listoftables \addcontentsline{toc}{chapter}{List of Tables} \chapter*{Acknowledgements} \addcontentsline{toc}{chapter}{Acknowledgements} ACKNOWLEDGEMENTS \printnomenclature[1.5in] \addcontentsline{toc}{chapter}{Nomenclature} \pagebreak \pagenumbering{arabic} \include{2ndYearReport_CHAP1} \include{2ndYearReport_CHAP2} \include{2ndYearReport_CHAP3} \bibliographystyle{unsrt} \bibliography{Alex} %\printbibliography \end{document} The goofy looking part at the top (\newcommand{doubleSig.....) is just for when i input a special page I made containing a certificate of originality spiel with two boxes for signatures and my university logo. As you can see I am using the standard bibtex way of doing bibliographies by stating the style then the stating the bib file to use right at the end of the document. I have tried biblatex but can't get it to work. It says it hasn't produced the bib file but doesn't really state why. As far as I am aware everything was working A-OK until I started on the second chapter and began adding citations in there. Now my citations are all messed up and won't correct. My first citation starts with [9]!!! [1] appears in a figure caption later down the page, after 10, 11 and 12 have been called! I have tried deleting all the working files (bbl, aux, log etc) but nothing happens. I get the same result. IIRC I used to have this problem with MS Word and is part of the reason why I switched to LaTex...yet it seems to have followed me! bibtex does through a few warnings when it runs stating that some references are missing journal names or volume numbers. Would that be a reason? What have I done wrong with my code?
|
I am programing to have a file deleted in X- amount of days: for (int i = 0; i < 5; i++) { System.IO.DirectoryInfo fi = new DirectoryInfo(m_strfilename[i].Text); if (fi.LastAccessTime < DateTime.Now.AddDays(-Convert.ToInt32(m_dropdown[i].Value))) fi.Delete(); I am not quite sure what the issue is with this.
|
I'm using .NET 3.5, trying to recursively delete a directory using: Directory.Delete(myPath, true); My understanding is that this should throw if files are in use or there is a permissions problem, but otherwise it should delete the directory and all of its contents. However, I occasionally get this: System.IO.IOException: The directory is not empty. at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath) at System.IO.Directory.DeleteHelper(String fullPath, String userPath, Boolean recursive) at System.IO.Directory.Delete(String fullPath, String userPath, Boolean recursive) ... I'm not surprised that the method sometimes throws, but I'm surprised to get this particular message when recursive is true. (I know the directory is not empty.) Is there a reason I'd see this instead of AccessViolationException?
|
First of all: Now the question substance: Is there an accepted channel for an unprivileged user to request the addition of a tag? If so, what is it? If not, is there a reason for its non-existence, and if so what is that reason?
|
I'd like to post a question on StackOverflow, but I think I should be able to tag it with . Poor me, there is no tag; There is and , I'm certainly not sure this is the right thing to do, so figure I'll start here. Edit Question located here:
|
Would you choose the more appropriate sentence? We are open to cooperation with new companies as well as the ones with good reputation Or: We are open to cooperation with new companies as well as those with good reputation
|
I recently corrected "ghettos, such as the ones found..." to "ghettos, such as those found..." Was I correct, or are both versions right?
|
I have a pregnant dweller that still hasn't given birth after 3 days. Is this a glitch? Or is there something that I can do to speed along her delivery? I have made sure that I have enough living space for new dwellers, and other women have gotten pregnant and given birth since she was initially impregnated.
|
I am playing Fallout Shelter on my IPad. There were some women who have already gave birth, but two female dwellers are carrying their babies for about 18(!) hours. I know that this process takes three hours, so this is not normal. What do I do?
|
I am a new graphics designer I want to use skull head, spoon icon, fork, etc in my logo from free stock but I don't know how to avoid copyright issue
|
My wife recently got a logo designed for her new business, by a professional branding company. It went through several stages of approval, getting the logo just right, however, when she went on to the next stage of the process (creating the social media pages) she was asked to find some stock images to use for the banners. While doing so, she found her "logo" was taken exactly from an existing stock image. The only modification done was to add a little bit of color and her business name. I don't know the proper etiquette for this situation is. Is it bad that her logo is a stock image and if so, is it too late in the process to request a change (note they claim to allow unlimited revisions but I'm not sure if that applies once we "accept" the design). Stock Image: Logo:
|
I upgraded from 13.10 to 14.04 and now the nm-applet no longer shows in the system tray. I already tried purging and reinstalling the network-manager-gnome package but that didn't help. When I run nm-applet manually in the terminal I get the following output: ** (nm-applet:7419): WARNING **: Couldn't connect to accessibility bus: Failed to connect to socket /tmp/dbus-gBrnqcTAVj: Connection refused I tried multiple system trays: i3bar (my default), trayer and the xfce4-panel. Other tray apps work in all three of them (like dropbox). The network manager itself works, as it connects to known networks and outputs notifications. Does someone know how to fix this?
|
I have a Lubuntu (now 14.04) installation. Recently, I logged in to find that the Wi-Fi icon had disappeared, and there was some sort of a keyboard icon in it's place. I have restarted multiple times, but it doesn't fix it. I can't find the same applet in the panel settings, and resetting the panel didn't help. When I try to manually start nm-applet, it starts, but prints a bunch of warnings to the console: nm-applet-Message: using fallback from indicator to GtkStatusIcon It then starts, using ugly icons for the Wi-Fi connectivity symbol. What do I need to do to make it start correctly? Once it starts, why isn't it using the right icons?
|
Is "Feel free to reach out to myself, Howard, or Jane." correct? Or, should it read "Feel free to reach out to me, Howard, or Jane.".
|
Which one is correct: Someone like me... or Someone like myself... Is "like myself" ever correct?
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.