Use SQL varchar(max) or text?

Question: I'm using SQL Server 2005 and I have a column where I need to store large amounts of text (sometimes over 8000 characters, the varchar limit).  Is there a disadvantage to using the "text" data type?  I also read about using varchar(MAX) -- would that be better if most of my data stored in there was less than 8000 characters, but I needed to be able to support more?
Answer: You should always go for the new LOB types in 2005 instead of the legacy types (text, ntext, image) as long as you have the potential for data over 8000 bytes.
The new types work with the majority of the intrinsic string-manipulation functions, whereas the legacy types do not. They are stored in the database in the same exact way, but there are some small tweaks to read algorithms for the new types too.
There are some things to be aware of though:

legacy types are stored off-row by default, which means there's a random-IO to get to the data regardless of data size. You can of course change this with the 'text in-row' option
new types are stored ON row by default, up to an 8000-byte limit and as long as there's space in the record. This reduces the chance of taking that random-IO to get to the value BUT makes your data records much longer leading to other problems. You can change whether data is stored in-row or out-of-row by changed the large-values-types-off-row option
any time you have either a new or legacy LOB type in your table definition means that the table's clustered index cannot make use of online index operations in Enterprise edition.

I posted a blog post that discusses this in more detail at http://www.sqlskills.com/BLOGS/PAUL/post/Importance-of-choosing-the-right-LOB-storage-technique.aspx.
Hope this helps
Answer: Use varchar(max), it's the recommended approach going forward, so it will save you upgrading problems, it's also much easier to work with then the text data type.
Answer: Use varchar(MAX). The limit for varchar(MAX) is 2GB.
If the content is less than 8,000 bytes it will be stored inline. However, if the content is greater than 8,000 bytes, it gets stored in the LOB just like a text field.
Also, TEXT, NTEXT, and IMAGE data types are going to be deprecated at some point in the future.
Reference
Answer: A few good blog postings from MVP Simon Sabin on these at his blog. Search for Simon Sabin varchar(max)
I'd agree with Paul, use varchar(max) whenever possible.
Answer: varchar(max)

2GB limit, or 2^31characters
if  < 8000 bytes, it will be stored inline
if > 8000 stored using LOB

Text

2,147,483,647 characters
This is being deprecated in favor of varchar(max)
Table stores the text value in a LOB structure and the table will only hold a pointer

Use SQL varchar(max) or text?


Can I replace WPF by Silverlight

Question: Could Silverlight and WPF be interchangeable?
I mean, using Silverlight for Windows applications and WPF for web applications.
Answer: Silverlight and WPF are similar, but not interchangeable.
Silverlight and WPF are two different technologies intended to solve different problems.  Silverlight has out-of-browser functionality, but must be delivered over the web in a browser first.  WPF has XBAP, but it's still a WPF application.  They are both XAML-based, so there is some limited ability to share resources.
If you are designing an application, select the technology that is most appropriate to the problem and the target audience.  Keep in mind that while Silverlight runtime installs are growing fast, they still lag far behind others.  Some people flatly refuse to install it.  WPF apps can be distributed like desktop applications with an executable.
Update: In my experience, WPF XBAP applications don't behave well in browsers that aren't IE.
Answer: SL 4 can work in an out of browser mode. WPF has the XBAP (XAML browser application). So in a way they are but consider the limitations you may encounter in your projects.
Regards...
Answer: Some user controls can be reused between the two platforms.  But because of the very different ways Silverlight and WPF interact with their environments (WPF on local system, Silverlight in browser plug-in sandbox) not all of the code is fully interchangable.
It's theoretically possible, but would require extra effort to port.  And each is best suited to its environment.  Here's an interesting discussion from an MS forum:
http://forums.silverlight.net/forums/p/1178/4244.aspx
Answer: For the most part, WPF is designed to run on the desktop and Silverlight and designed to run as part of a web page.
You can deploy a silverlight application to a desktop and run it from there, but there is no way to run a WPF UI "on the web".
Comment: You can run a xpf xbap application inside an iframe, or even full page: http://msdn.microsoft.com/en-us/library/aa970060.aspx
Answer: With Silverlight 4 you can create a full trust application that is installed in the same was as a WPF application.
This article has a walkthrough.
So in this sense you can replace WPF with Silverlight.
You can link to WPF XAML pages on the web. This page has such a link, but you need a plugin to view it. I wouldn't want to deploy a full application this way though & I think it's only individual pages.
Comment: ok, and viceversa? for Firefox is it possible to build a WPF good-working application?

Can I replace WPF by Silverlight


Stdin Input Behavior Between "cat" and "less"

Question: When I issue cat, the terminal hangs waiting for stdin input. However, when less is issued, I get Missing filename ("less --help" for help). It is known that both less and cat accepts stdin input. What is the difference? How is this reflected in the man pages?
Comment: Indeed the [less(1) manpage](http://linux.die.net/man/1/less) says `[filename]` which would imply that it was an optional argument.
Comment: Where did you get your `less` implementation? Which distribution are you using and which version of the package?
Comment: @PavelŠimerda It came with CentOS. `less --v` gives `less 436`. Would you know why 436 doesn't exist here: http://ftp.gnu.org/gnu/less/?C=M;O=D ?
Comment: Interesting, I found http://www.greenwoodsoftware.com/less/ which is used by Linux From Scratch and is also linked by Wikipedia as the official home page.
Answer: less runs the following code when it's not given any filename arguments:
if (isatty(fd0))
{
    error("Missing filename (\"less --help\" for help)", NULL_PARG);
    quit(QUIT_OK);
}
return (edit("-"));

It's complaining when standard input is a terminal. If standard input is an ordinary file or pipe, it's OK with that.
It presumably does this because it needs to read responses from the terminal at the end of each page, and there'd be no way to distinguish the data that is being paged and the responses.
This isn't mentioned in the man page. Maybe it should be.
cat doesn't page its output, and doesn't read responses from the terminal. It doesn't have any restrictions as far as stdin being a terminal.
Comment: Couldn't you open /dev/tty for responses and still use stdin for data?  A simple way of making input out of band
Comment: @RichHomolka `less` actually does open `/dev/tty`, but opening that device just gives the process another descriptor to the actual tty device, and with two descriptors to the same device, the `read`s would compete over the same queue of input characters.
Answer: My guess is that less calls isatty(3) on file descriptor 0. Another alternative would be to call fstat(2) on file descriptor 0 and interpret the values of the st_ino and st_rdev fields. Either way, the point is a program can tell something about a file descriptor, and stdin is just file descriptor 0.
As far as why less exits and cat does not, you need to look at the purpose of the two different programs. less is the GNU pager, a reaction to the BSD pager more (note the punny name). It doesn't exactly make sense to paginate input from a terminal, but it just might make sense to paginate input from a pipe. Either could be stdin. Coding a special case in less makes sense. Coding a special case in cat does not make sense, and reduces its usefulness. Even in the late 1980s, people had windowing systems and would type in cat > somefile then paste a large chunk of text into "somefile".
Comment: @boxofchalk1 - for `cat`, the special case would be checking if file descriptor 0 represents a TTY device, and exiting if it is. If the `cat` program doesn't find any file names in argv[], it just reads file descriptor 0 until end-of-file.
Comment: Thanks @Bruce Ediger for the answer. I did not follow some of the points made in the 2nd paragraph. You said "Coding a special case in cat does not make sense..." Is the special case the tty input?
Comment: I agree with this answer. You can do whatever you want tech wise, but paging stdin doesn't make design sense so you detect it and call it an error. Cat is used in a variety of places where cat stdin makes sense. '(echo header; cat -;echo footer) > /tmp/somefile.txt'. I've also used cat > /proc/whatever


Why my background appears a blue, when I set it transparent?

Question: I am trying to render this image with transparent background, but instead it renders as blue. I have checked the world settings, HDRI. The problem only happens in render and not view port. Problem persist in both eevee and cycles. Any help is appreciated.
Answer: You're compositing the blue background in. Enter the compositor and either mute the Mix node or remove it.
Comment: Why does using the Alpha create that thin, blue line? I imagined to be proper about things, the Alpha socket could be filled but its result isn't as clean as omitting the Mix Node. Shouldn't it be pixel perfect?
Comment: @HelloHiHola What thin blue line are you talking about?
Comment: Can't add pictures here but if you drag the Render Layers Alpha into the Composite Alpha socket (looking in Compositor), the results aren't as clean as I would expect. I was curious if you knew why since that seems a formal option of eliminating the blue.
Comment: What you're seeing is the background peeking through the non-100% black of the alpha channel due to antialiasing. Create a Viewer node in the compositor and plug the Alpha into the image input and zoom in to the image - you'll see grey pixels between the white and black. Wherever it's grey, that's where you see some blue peek through. To remove this completely you can put a Luminance Key node with high and low set to 1 between the alpha out of the image and the alpha in of the viewer/composite node.


FreeRTOS xPortStartScheduler does not clear BASEPRI

Question: Trying to run FreeRTOS on ESP32 ARM Cortex M4F, but it fails inside xPortStartScheduler.
static void prvPortStartFirstTask( void )
{
/* Start the first task.  This also clears the bit that indicates the FPU is
 * in use in case the FPU was used before the scheduler was started - which
 * would otherwise result in the unnecessary leaving of space in the SVC stack
 * for lazy saving of FPU registers. */
__asm volatile (
    " ldr r0, =0xE000ED08   \n"/* Use the NVIC offset register to locate the stack. */
    " ldr r0, [r0]          \n"
    " ldr r0, [r0]          \n"
    " msr msp, r0           \n"/* Set the msp back to the start of the stack. */
    " mov r0, #0            \n"
    " msr control, r0       \n"
    " cpsie i               \n"/* Globally enable interrupts. */
    " cpsie f               \n"
    " dsb                   \n"
    " isb                   \n"
    " svc 0                 \n"/* System call to start first task. */
    " nop                   \n"
    " .ltorg                \n"
    );
    }

The call to "svc 0" will fail because the BASEPRI is not zero.
When calling xTaskCreate() BASEPRI is set to configMAX_SYSCALL_INTERRUPT_PRIORITY and this is done before starting the scheduler. Should be ok.
I tried manually setting BASEPRI to 0 and this seems to fix the issue, but I have been using FreeRTOS in the past, and never had to do this "fix".
So to sum up:
Init_stuff..
xTaskCreate(..);  // Sets BASEPRI = 0xA0 (configMAX_SYSCALL_INTERRUPT_PRIORITY)
vTaskStartScheduler();
-> xPortStartScheduler(...)
   -> prvPortStartFirstTask() // svc 0 fails because BASEPRI=0xA0

I'm guessing there is something important that I'm missing, where is BASEPRI suppose to be restored to zero ?
Answer: This was caused by the SVC prio not being zero.


Who built/runs Mi Yodeya?

Question: Who runs this site? Hillel is building a similar site for internal staff collaboration, and I would love to talk to someone about Mi Yodeya, and your user experience.
Thanks!
Comment: Is this the national Hillel or expected to be used by all the various Hillel's in every college? You would be welcome to join here as well in order to ask your questions. See the other stackexchange groups as well to get a feel for how it is set up.
Comment: Welcome to Mi Yodeya. You should browse around a bit to get a feel for this site. As for this question (something for moderators, perhaps?) I think this should be moved to the meta area, so I vote to close for that reason.
Comment: Mind if I ask which college Hillel this is?
Answer: Welcome to Mi Yodeya!
As indicated in comments1 on this post, Mi Yodeya is a member of the Stack Exchange network of Q&A sites. It's provided and maintained by Stack Overflow, Inc.2
The community generally regulates itself, using tools built into the platform. To handle special cases and expedite janitorial work, there is a small group of elected moderators. You can see the list of moderators here.
I'm one of the moderators, and I also founded the online community that evolved into the community here at Mi Yodeya. I love to talk about Mi Yodeya, and would be happy to talk to you. As it happens, I work very close to Hillel headquarters in DC, and I regularly visit that building for Mincha, so if you work there, it should be easy to arrange a meeting. You can contact me at lo_yodeya (or to be perfectly honest, any address) at isaacemoses.info.

1. Thanks mbloch and ezra.
2. For what it's worth, Stack Overflow is currently working on building a new feature called Channels that will allow private companies and teams to do technical Q&A using the Stack Exchange model, privately. I don't expect that this will be available and useful for non-technical teams for a long time.

Who built/runs Mi Yodeya?


python - RGB matrix of an image

Question: Taking an image as input, how can I get the rgb matrix corresponding to it?
I checked out the numpy.asarray function. Does that give me the rgb matrix or some other matrix?
Answer: Note that this answer is outdated as of 2018; scipy has deprecated imread, and you should switch to imageio.imread. See this transition doc about differences between the two. The code below should work with no changes if you just import the new library in place of the old, but I haven't tested it.

The simplest answer is to use the NumPy and SciPy wrappers around PIL. There's a great tutorial, but the basic idea is:
from scipy import misc
arr = misc.imread('lena.png') # 640x480x3 array
arr[20, 30] # 3-vector for a pixel
arr[20, 30, 1] # green value for a pixel

For a 640x480 RGB image, this will give you a 640x480x3 array of uint8.
Or you can just open the file with PIL (or, rather, Pillow; if you're still using PIL, this may not work, or may be very slow) and pass it straight to NumPy:
import numpy as np
from PIL import Image
img = Image.open('lena.png')
arr = np.array(img) # 640x480x4 array
arr[20, 30] # 4-vector, just like above

This will give you a 640x480x4 array of type uint8 (the 4th is alpha; PIL always loads PNG files as RGBA, even if they have no transparency; see img.getbands() if you're every unsure).
If you don't want to use NumPy at all, PIL's own PixelArray type is a more limited array:
arr = img.load()
arr[20, 30] # tuple of 4 ints

This gives you a 640x480 PixelAccess array of RGBA 4-tuples.
Or you can just call getpixel on the image:
img.getpixel(20, 30) # tuple of 4 ints

Comment: An update: `imread` is deprecated in SciPy 1.0.0, and will be removed in 1.2.0. Use `imageio.imread` instead. [source](https://docs.scipy.org/doc/scipy/reference/generated/scipy.misc.imread.html)
Comment: @HarshitKumar Thanks for the update; I'll edit it into the answer. Since this is half a decade old, anything else that should be updated?
Answer: I have a feeling I'm not doing exactly what you wanted here, so please specify if this is totally off. You could open the image like this and get an array of pixels:
import Image
im = Image.open('Lenna.png')
pixels = list(im.getdata())

This will get you a flat list of RGB data that looks like
[(226, 137, 125), (226, 137, 125), (223, 137, 133), (223, 136, 128),
 (226, 138, 120), (226, 129, 116), (228, 138, 123), (227, 134, 124),
 (227, 140, 127), (225, 136, 119), (228, 135, 126), (225, 134, 121),...

Now this will be all pixels in a flat array, if you want a two dimensional array then some additional code would be needed for that. Not sure if there is a direct function for it in PIL.
Comment: @Ojas: As the docs for [`Image.getdata`](http://pillow.readthedocs.org/en/latest/reference/Image.html#PIL.Image.Image.getdata) say, "values for line one follow directly after the values of line zero, and so on." However, this is not the best way to do this.
Comment: Yes this is indeed what I want! Just one question, in this list are the pixels in the order of horizontal traversal or vertical traversal of the image? Or is there no order in this data?
Comment: @Bemmu I'm sorry for replying to your old post. However, I think you might be able to help :) How can I get a numpy array of an RGB image  with `(m, n)` dimensions? For example, two 64X64 pixel RGB images should produce a `(2, 12288)` array. Thank you in advance!
Answer: I tried imageio.imread and it worked great, but a minute later stumbled upon a function in matplotlib which worked exactly the same, getting a numpy n by m by 3 array:
from matplotlib import pyplot as plt
image = plt.imread(path)

Answer: You can do that with Pillow, the getdata method gives you a flat array of the pixels, you can then build a matrix from that using the size of the image.
from PIL import Image

def getPixels(filename):
    img = Image.open(filename, 'r')
    w, h = img.size
    pix = list(img.getdata())
    return [pix[n:n+w] for n in range(0, w*h, w)]

Comment: I had to remove the 'r' argument to open to get this to work.
Comment: apparently its the default value for the mode argument anyway, so who knows ^^
Answer: Also to add, if you or anyone else is using opencv.
 imgc=cv2.imread(file)

or to read in as grayscale
 imgc=cv2.imread(file,0)

If you will be doing some comparison between the images you may want to think about turning the array of pixels into histograms to normalise the data.
   hist = np.histogram(img.flatten(),256,[0,256])[0]

The above line firstly flattens your img array so you do lose the dimensionality of your image. It then produces bins from 0 to 256 (for the grayscale image) and adds the counts from the img to these bins and returns them as hist which can then be plotted. For example, if the 100 bin has a value of 20 it means that 20 pixels in your image had a value of 100.
Hope this adds another possiblity to think about or to anyone looking to get started in opencv.

python - RGB matrix of an image


How do I get an output of 24V from a K30319 adapter?

Question: The K30319 adapter is a 24V adapter made by Canon in Vietnam. I pulled it out of a Canon printer someone chucked in the garbage. The adapter works as far as I can tell. I'd like to use this adapter to build a 24V DC power supply if it's possible. There are three output pins. According to a vendor, and from left to right, pin 1 is +24V, pin 2 is GND, and pin 3 is Cont (control pin?). When measuring the adapter's output voltage with my multimeter I get a reading between 8 and 8.5V, and nowhere near the 24V printed on the adapter casing. I tried several connection combinations with my probes, but nothing I do gives me the stated 24V output voltage. Someone suggested I short the Cont pin to the +24V pin with series resistors. A 1k resistor apparently brings the voltage up to +24V. I've yet to try this, but I'm hesitant, because I may not find another free one so easily.
Comment: What's a K30319 adaptor? Please [edit] to include a link to the datasheet your working from and, even better, include a screengrab of the relevant part in your question. You can also hyperlink to the other question if it will help. (Just paste the URL. SE will tidy it up.) Welcome to EE.SE.
Answer: Here are two threads that discuss this type of power adapter,
AC-DC Adapter - Output lower than rating and what's this 'cont' output for?
https://www.eevblog.com/forum/beginners/canon-acdc-transformer-with-24v-cont-gnd-cont/
They both come to the same conclusion, that the Cont pin should be pulled up to the 24V pin and the voltage will then increase to that level.
You would need to open this adapter up or have a proper manual/schematic to know if this was actually the correct thing to do. So no guarentees here, do at your own risk.
Comment: Thanks jmb2341. I've already taken it apart. I will proceed with caution when I attempt to do this. First, I will read the discussions you've given me.


What is the exact difference between user and eng binaries?

Question: What is the exact difference between user and eng binaries for a phone (mobile device)? These are two of the build variants. I want to know the exact difference between them.
Comment: What is this user and eng binaries you are talking about? Do you have a link to the site where we could download them?
Comment: I would like to know the difference between the two build_flavor's,i.e. eng and user build in android.
Answer: "Eng" is short for engineering AKA developer build. Those builds have various logging facilities enabled which you do not see on regular "production" builds. Normally you do not want to flash such builds on to your phone.
Comment: the exact configuration of the "eng" build depends on the manufacturer/model. this is just a build used internally by manufacturer while developing a product. it even can change for the same product.
Comment: Thanks but want to know the things in detail,what all logging facilities are enabled which you are talking about engineering AKA developer build.Can you please enlighten me.
Comment: Eng builds usually contain device manufacturer specific hacks and testing apps. In particular network related items. Often `eng` build allows access to hidden service menus  and parts of the OS that is not otherwise present, including unlocked bootloaders. Again, it all depend on the hardware and manufacturer.
Comment: How could you determine or strongly infer if you have an eng or user build on a particular device? Do developers typically adopt conventions like putting suffixes in the OS version in the `About phone` section?


How do I make a bootable USB drive for Winodws 7 on Ubuntu 14.04 LTS?

Question: Almost all questions I've found here are outdated. I've already tried using UNetbootin and WINusb and neither have worked. When I used UNetbootin, once I booted the computer from the USB, it was stuck in a continuous loop of counting down from ten until boot, but would never actually boot. When I tried using WINusb I receive an error message when I try to install the ISO onto the USB saying: Installation failed! Exit code: 256 Log: Formating device... Error:Error opening /dev/sdb: No medium found. I'm new to the command line so please give all answers with easy directions. Thanks in advance.
Answer: in case YUMI doesn't work - try universal usb installer
it worked for me always from Windows. Please double check your .iso file whether it has been downloaded properly or not?


Could gravity hold electron charge together?

Question: Could the gravitational force be what holds the charge of the electron together? It seems to be the only obvious possibility; what other ideas have been proposed besides side-stepping the issue and assuming a "point charge"? How would this affect the electron "self-energy" problem? The question is related to the idea of geons.
Answer: This was an idea Einstein had soon after developing GR, and it is developed in the classical unified field literature, with the starting point being Einstein's "Do Gravitational Fields Play a Role in the Constitution of the Elementary Particles?" This is one of the defining program papers of the unified field framework.
This idea is also discussed off and on within heuristic models of charges throughout the 1950s-80s. The essential points are that as you make the electron smaller, at some point, gravity will become dominant. The problem with such ideas is that they generally do not have a good idea of quantum gravity to make the microscopic model precise.
All these classically inspired ideas are obsoleted by string theory and subsumed into it. Within string theory, the fundamental objects are dual to black holes, so that their classical limit is identifiable as a recognizable extremally charged black hole of the classical limit supergravity theory. Aside from identifiable black holes, there is no other matter (arguably--- there is the question of whether orbifolds count as "matter"). So for example, for the M-theory, the objects are the extremally charged M2-branes which are the extremally charged black holes you can make using the 3 form gauge field, and their 5-brane magnetic duals (the magnetically extremally charged black holes). That's it for M theory. The brane-spectrum of a theory is the answer to classical question "what extremal black hole can I form?"
The identification of black holes with matter is important, because the internal construction of strings is fully specified by the theory. So that the electron, if it is a string theory excitation, is an object whose internal structure is completely known, because you know the scattering off the electron at arbitrarily high energies. Further, in the strong scattering case, we can continuously link the electron to both netural and extremally charged black holes, so that the theory is a full realization of Einstein's program.
Since I believe string theory is the correct theory of everything, I don't think there is much point in investigating these types of ideas in a different direction. But some people who like loops disagree.
Comment: I think the idea of electrons as black holes or Spiraling vortexes of some sort works much better than strings. This would explain the negative charge. Black holes reject material when too much comes in at once. So multiple black holes together could form a hydrostatic equilibrium where the excess material radiates away keeping the black holes away from each other. These equilibrium's could be protons or neutrons. Electrons as Spiraling Black hole Would hover around the nucleus also in a hydrostatic equilibrium. That's one way gravity could play a part
Answer: Yes, it can. Here is a toy model using Newtonian gravity.
V/c^2 = e^2/mc^2r - /\r^2
e^2/mc^2 = rc (classical electron radius)
with SSS metric
g00 = 1 + 2V/c^2 = - 1/grr
g/c^2 = -dV/dr = + rs/r + 2/\r
We can get g = 0 with /\ < 0 i.e. AdS metric
In a vacuum where the w = -1 virtual electron positron pairs surrounding the bare charge have higher density than the w = -1 virtual photons, we can have /\ < 0.
The equilibrium will also be stable looking at d^2V/dr^2.
This neglects spin, but we can model that with the centrifugal potential
http://en.wikipedia.org/wiki/Effective_potential
Answer: The short answer... we do not know. (Were 'we' is humanity or physicists - take your pick.)
A more interesting answer is...
The electron size is known to be 10^-18 meters or smaller. If gravity was holding it together then it might be at the Schwarzschild radius.
Rs = 2GM/c^2
so with values substituted it would be
2 x 6.67300x10^-11 x 9.10938291x10^−31 / (3x10^8)^2 = 1.35x10^-57 meters
However, this is less than the Plank length (10^-33 m). Therefore, if it is held by gravity then it would likely have a radius near the plank length. Supersymmetry (SUSY), for example, has gravity increasing to have all forces equal at the plank length.
If you check out Lenard Susskind's lectures on ER=EPR and GR you will find that he thinks that physics is leading us towards the idea that elementary particles and black holes might be related. Black holes have only three properties angular momentum (spin) mass, and charge. Sounds like an elementary particle.
This is a hint not a theory. It is very early to say.
EDIT:
It would have been nice to know why this was downgraded with the addition of a comment. There is nothing wrong with the physics. If it was downgraded because it does not answer the question then that does not make sense because there is no known answer to the question.
Black holes look like macroscopic elementary particles but elementary particles do not look like black holes.


Yelp API access not available

Question: I need Yelp API for using in my Android app. The form on the website
https://www.yelp.com/developers/get_access
It requires a website URL. Am I accessing the right form? I don't have a website and I don't need it for a website. From what I understand you need a Key for using it on Android. How can I get that key?
Thanks in advance.
Answer: I got it, the API requires the website. If you don't have your own website, then you must provide a URL where they can see the description about your application.

Yelp API access not available


CentOS filesystem size expansion?

Question: When I tried to download packages from Windows to my CentOS VM it said I have insufficient space on my filesystem. When I checked it it had only 5.4mb left while I've set the VM space limit to 30GB. I'm new to Linux and don't know what to do. How do I expand the size of my filesystem?
Answer: Short story (you do want to read up every step in detail):

Enlarge Partition / Raid / LVM (in order of "loading")
Enlarge Filesystem with resize2fs (depending on filesystem)

Resizing in wrong order might corrupt your filesystem or file contents!
Answer: Perhaps you have already used up all your space.  Do a df -h and see how big your filesystem is.
Answer: df -h

will provide you your disk space usage.  If you see that /home is full and you have space in /, then try putting some files you don't regurarly use.  Note: you will have to cp using sudo because you cannot copy to / with normal permissions OR   as root do the following:
cd /; sudo mkdir extra_space ; cd  extra_space ; sudo mv /home/yourUSERNAME/music/*.mp3 .

Explanation: Change directory to /, then with super user credentials, create a new directory called "extra_space".  Next go into "extra_space" and move as many as possible. mp3 files to this location from your home directory.
Comment: What if he doesn't store `mp3`s, or is really seeking to expand the size of his filesystem ? Also you're assuming `/` and `/home` are not using the same space, which is somehow a big assumption under a VM…

CentOS filesystem size expansion?


Can something worse than a temporary ban happen when I get too many rejected edits?

Question: If I try to edit multiple questions, and they all get rejected, could I potentially get a worse punishment than a temporary ban?
Comment: @πάνταῥεῖ C++ gets a script variant. That kind of worse ...
Comment: @rene It already got one: emscripten
Comment: Define _something worse_ please.
Comment: @πάνταῥεῖ where does this end ... horror ...
Comment: This question is a duplicate of the linked question because the answer there contains "account suspensions [...] are applied in severe cases of not improving after receiving automatic bans.", which is approximately what is said here.
Comment: @SergeyA: You would then appreciate `#!/usr/bin/tcc -run`
Comment: @rene emscripten allowed us to get Blazor though, so it's not *all* bad.
Comment: Well ... i heard about few cases where it was requested from a user to do some coding for free ... using delphi ...in order to help out SO grow
Comment: @rene I do not see C++ scripts as horrors. They are, in fact, cool.
Comment: @SergeyA call me old fashioned and narrow minded
Answer: In theory something worse can happen.
If you continue to get yourself into an automatic ban, the users and or moderators might start to notice.
When there is evidence that you don't improve or ignore advice presented to you by the system, you could risk a suspension handed out by a mod. Those start with days but can increase in length up to a year and if you persist on doing this network-wide be extended by community managers to 99999 days.
It would be a novum if you get a ~ 273 year suspension from just lousy edits.
Comment: @Joshua "return from a 99999 day ban" Meanwhile in 2219: Sonny, I have something special for you today, I saved this for years, on this piece of paper I have something passed down from my dad, it's our family's original Stack Overflow username and password. You see your grandfather was trying to learn an ancient language called Python, but then he got tricked by a sales agency into promoting their products and they banned him. I'm passing this on to you because there's still hope, in 73 years you can fix this and bring pride back to the user2353482 family name!
Comment: Elected moderators only can ban up to a year. Longer bans are always network wide and can only be applied by the Community Managers. I have yet to see an upper limit to network bans; I've seen a 99999 day ban (~273 years and change) but the limit is more likely to be a database integer type limit. Network bans > 1 year are reserved for accounts that have shown to be completely unredeemable.
Comment: @Rene At least there's no threat of getting bludgeoned by a giant S...
Comment: The United States hasn't even existed for 273 years
Comment: It would be more spectacular for someone to return from a 99999 day ban.
Comment: 273 years makes me wonder if the site would last that much to insure this ban, I hope this comment sticks until 2292, so my grand grand grand child would answer this
Comment: And then the son says he prefers JavaScript.
Comment: "Sorry, Dad, but ECMAScript 2219 is all I know."
Comment: "Remember me??"
Comment: Being banned from here will only give you more time to do something else so ^_^
Comment: @Leaf ECMAScript 2019: `var site = document.generateEntireWebsiteAutomatically();`
Comment: @MartijnPieters I  described what I thought was already the worst that could happen ... you topped it. ;)
Comment: @NasreddineGalfout Technically, SO doesn't need to exist _for_ 273 years. Just _in_ 273 years' time.
Comment: For a sec there I thought I wasn't on SO.
Comment: @holydragon welcome to Meta!


MonoGame 3.6 install script not detecting MonoDevelop 6 / Can't create MonoGame app within MonoDevelop

Question: Dual-pronged problem that might be caused by the same thing!
So, I'm trying to install monogame/monodevelop.
Installed MonoDevelop with sudo apt-get install mono-devel. That opens appropriately and seems to work fine otherwise. Got a basic C# Console 'Hello, world!' to run correctly.
I went here and downloaded the version for Linux. I gave it executable permission with chmod +x monogame-sdk.run and ran it. It produced the following:
$ sudo ./monogame-sdk.run
Verifying archive integrity... All good.
Uncompressing Monogame Pipeline
Installer..........................................................
..........................
Dependencies:
- mono-runtime...................................[Found]
- gtk-sharp3.....................................[Found]

Optional Dependencies:
- MonoDevelop 6..................................[Not Found]
- Rider..........................................[Not Found]
- referenceassemblies-pcl / mono-pcl.............[Found]
- ttf-mscorefonts-installer / mscore-fonts.......[Found]

Continue (Y, n): y
Previous version detected, trying to uninstall...
Installing MonoGame SDK...
Installing MonoDevelop Addin...
bash: ?????: command not found
Creating launcher items...
./postinstall.sh: line 142: gtk-update-icon-cache: command not found
Adding mimetype...
To uninstall MonoGame SDK you can run "monogame-uninstall" from terminal.

Pretty much looks like the installation did not finish correctly, but I'm not sure what's wrong with the script to make it do that. As a probable result of this, MonoDevelop doesn't allow me to create a MonoGame app of any kind. (this doesn't appear when I try to create a new solution)
If there's any other information you might need, please let me know!
Answer: I had the same issue. Which version of MonoDevelop do you have installed? I was on version 5.10 and upgraded to version 6.x which solved my problem.


How to protect folders in public_html from visitors

Question: I need to keep all my files and folders of my website in public_html folder. There are some folders for javascript codes like 'Javascript' and css codes like 'CSS', 'Images' for images, etc. It is easy for any visitor to type just the folder address like 'http://www.website.com/Javascript' and he will have permission to see all my javascript codes. I want to restrict these folders from visitors and use only for my scripts which are uploaded in public_html folder. How can this be done? Please give solution for my scripts in public_html also, which will need to access those folders.
Comment: "I just do not want them to enter my folder." - add empty index.php to each folder.
Comment: you can minify & uglify the js code
Comment: _"How can this be done?"_ It can't be. JS and CSS files are rendered client side. You can not prevent people from being able to access them and still expect your site to work.
Comment: I just do not want them to enter my folder. It will not be a problem if they can see javascript files of the page they are browsing. But I want to limit access of viewers to the entire folder where I keep all my codes. @Alex
Comment: If you just want to disable directory listings, then you want `Options -Indexes`. But note this will *not* disable the ability to download the files if you know the name, and will not prevent people from being able to see the source code of your site.
Comment: Then what is the proper solution? How can I prevent these files from being downloaded? Please write in brief.@AlexHowansky
Comment: I'll say it again -- you can not. Any JS and CSS files that your web site uses will be publicly available, that's how the Internet works.
Answer: For your security purpose you can set access permission for the public access for particular files, folder etc with the apache .htaccess file.
In your case create .htaccess file in the folder name public_html and put the bellow htaccess configuration:
Completely restricted from web server.
Deny from all

Restrict folder, sever can access files.
Options -Indexes

This works for me.
Comment: Erm... this will shut down your whole site.
Comment: Actually it worked when I put the .htaccess file in the folder which I wanted to protect and put the code 'Deny from all' in it.
I'm not sure, but I think this will work.
Comment: Sure, but now those files can not be loaded from web pages that reference them.
Comment: Yeah @john, this will protect particular folder only. if you want to configure for entire site you have to configure in the root folder.
Comment: Alex, do you know any other way to protect my folders? If yes, please share.
Comment: This system 'Deny from all' also denies access request of the server. It is a problem.


Is it possible for the public key of the issuer to be stored in a subject's certificate?

Question: For example, assume stackoverflow.com used a certificate issued by Google who is trusted. In the stackoverflow.com certificate, its own public key would be stored. However, is it also possible for Google's public key to be stored in the same certificate belonging to stackoverflow.com?
Comment: Although not the same as storing the CA's public key in the leaf certificate - many web servers do send the entire certificate chain (not just the leaf certificate).  See https://stackoverflow.com/questions/30344893/how-to-force-apache-2-2-to-send-the-full-certificate-chain
Comment: "Possible" is rarely the right choice for a question. There are all sorts of fields in an X.509 certificate where you can put anything you want and no software will complain. Stick it in the organizational unit (OU) field of the CN, put it in a custom extension, whatever. But what would be the point?
Answer: Well, not exactly, but issuer's public key reference is included in the leaf certificate, in Authority Key Identifier (RFC 5280 §5.2.1) certificate extension. It contains the SHA1 hash of issuer's public key.
When certificate chaining engine (CCE) will build the chain and get multiple cached issuer certificates with different public keys, CCE will get the proper certificate by comparing AKI extension value with Subject Key Identifier (SKI) of issuer (they must match).
If SKI is absent in issuer certificate, a hash over issuer candidate's public key will be calculated on a fly.


When can be the acute accent be written over the letter 'i'?

Question: As a native Spanish speaker, I'm having trouble with the use of the acute accent. As far as I'm concerned, the acute accent ´ can only be used over the letter e in a few cases (perché, ventitré...), but while reading the book 'La bella estate' written by Cesare Pavese I have seen it being used over the letter i (cosí, finí, salí...). Why is this? Could the reason for this orthographic rule be due to differences in regional pronunciations, or is there some other reason?
Comment: The current answers are correct in general terms, but the actual answer is that you are reading a book published by Einaudi, and Einaudi has the quirk of using acute accents on _u_ and _i_.
Comment: Welcome to Italian.SE! Related question: https://italian.stackexchange.com/q/2343/ (duplicate?).
Answer: The diagram for Italian vowels is the following:

Formally, the "i" and "u" vowels are closed, so their correct accent should be acute (í, ú).
Accents of oxytone words were traditionally written with a grave accent in ancient italian, but there is some extent of inconsistency in literature about grammar (including dictionaries).
What also matters is that, while there are very few cases of confusion between same words with different accents ("bòtte" as plural of "botta", a hit, while "bótte" means barrel, "pèsca" as in peach, "pésca" as in fishing) and meaning is usually clear from the context[1], Italian grammar still requests to differentiate between words ending with è ("caffè") and é ("perché"), so it's usually requested that oxytones only differentiate the "e" in those cases, while all other vowels use the grave accent.
The current, accepted and common practice also uses grave accents mostly due to the standard Italian keyboard layout, which doesn't provide easy access to acute accents for A, I, O and U[2], and was probably introduced in typewriters using the tradition described above, even if it doesn't properly match the phonetic of those vowels. As you can see, this old Olivetti model uses the grave accent for those letters and only provide difference for the E:

So, while the common grave accent is the accepted standard, using the acute one is not only also acceptable, but formally more correct.
References:

Accento acuto at Wikipedia;
"Accento grafico su i e u: grave o acuto? PDF at achyra.org;

[1] Since "bótte" is singular and "bòtte" plural, the article and verb usually clarifies the meaning, while both "pésca" and "pèsca" are singular, so a better writing would use the accent.
[2] Each OS provides different methods of typing extended characters. Linux is probably the first that introduced them in localized layouts using keyboard composition; the acute accent can be achieved with AltGr+,, followed by the letter.
Comment: macOS (Macintosh System) predates Linux and dead keys have been present since System 1. But the method didn't originate with the Macintosh: German typewriters had dead keys for the umlaut, for instance.
Comment: @egreg You're right, I was going to write that it was (probably) the first to easily allow that in the *italian* localized layout, but I was in a hurry and forgot to rephrase that. It's also likely that it was there since Unix based systems. Btw, are you sure that it was already there for System 1? AFAIK that system didn't even have a localization (or a keyboard layout configuration).
Comment: Perhaps not System 1, but I started using a Macintosh in 1985 and it already featured dead keys for accented letters. Maybe System 3 for the Macintosh Plus, but…
Answer: Only the vowels e and o can be pronounced in two ways, that is "aperta" (grave accent, è, ò) and "chiusa" (acute accent, é, ó).
For the other vowels a, i, and u, there is not such a distinction.
EDITED: In this context, they are neither "aperte" nor "chiuse". The use of the grave accent is not a rule, it's just conventional.
That's why in a few grammar books or books like the one you are reading you'll find acute accent on i or u. It seems that the autors feel important to distinguish how those two vowels are articulated compared to the other vowels. Other people, since there is no other way to pronounce a, i and u, do not see the need to mix the rules of Italian language accent with concepts related to universal phonetics. Besides, the acute accent is not even universally related to close or high vowels. END OF EDIT.
For details, please see on this same site the answers to this question.
About a and/or i and/or u closed or open
From La grammatica italiana (emphasis added):

Nel caso in cui la vocale finale sia a, i, u, l'accento è per convenzione sempre grave, anche se la pronuncia non è né aperta, né chiusa

From Enciclopedia dell'Italiano (emphasis added):

Secondo la norma più diffusa nelle grammatiche, in italiano l'accento grave si pone sulle vocali la cui pronuncia non si distingue in aperta o chiusa (a, i, u) e sulle varianti aperte della e /ɛ/ e della o /ɔ/, mentre l'accento acuto (′) si pone sulle varianti chiuse delle vocali toniche e /e/ e o /o/.
Comment: Giuseppe, evidentemente non sono stato chiaro. Ti stavo solo spiegando che non è corretto dire *in assoluto* che non sono né aperte né chiuse. Ogni suono vocalico ha un suo posto ben preciso nel trapezio delle vocali. Poi, visto che in italiano si usano solo i suoni chiusi, non li si considera tali, e va benissimo, ma non possiamo ignorare la fonetica, che è una disciplina quantitativa, basata sulle frequenze delle formanti dei suoni, non su considerazioni generali.
Comment: Right, but Italian *u* and *i* are indeed closed, even if, since no open counterpart is present in Standard Italian, it's hard to see. In some dialects such counterparts are present: for instance in Sicilian *I*. *Italia* pronounced by a Sicilian has open *i*s, such that to a Centre-Northern Italian, it almost sound as *Etàlea*.
Comment: @DaG Please see the quotations just added.
Comment: Yes, of course in Italian there is a single pronunciation for _i_ and a single one for _u_, but this pronunciations have a precise location on the vowel diagram (see the other answer), and it corresponds to closed sounds (the uppermost part of the trapezoid). You may check where /i/ and /u/ are in the diagram [here](https://en.wikipedia.org/wiki/Vowel_diagram).
Comment: @DaG Good, so you see why Treccani say "la pronuncia non è né aperta, né chiusa" and I say 'They are neither "aperte" nor "chiuse"'. A, i, and u, in Italian, are just a, i, and u, whatever accent you put on them.


Redshirt process for college soccer D1 school

Question: What, if anything does a NCAA college coach have to do to redshirt an athlete?  Is there an official document or paperwork required to be sent in to the NCAA? What does that process look like?
Answer: Athletic Director's office registers all athletes at school for all sanctioned sports (NCAA doesn't care/govern club sports) - this may slightly vary by school but how it worked at the school I was affiliated with.  Each athlete is registered with a code.  For incoming freshman they must be declared a redshirt before a specific date in accordance with that specific sport.
Coaches are more likely than not to register a freshman as a redshirt because it doesn't hurt.  Athletes can be unredshirted instantly.  The school would only get sanctioned if they tried to cover up an athletes activity to keep them redshirted.  The reason why all freshman aren't redshirted is that a coach may know they want to play someone, the coach may fear that the athlete would be unhappy and leave, or the coach just wants a certain amount of turnover.
Now when a freshman athlete comes to a campus they have one of 3 statuses (forgive me if I mishandle the exact names).

Eligible - fully eligible for practices and game activity.  This athlete you would have to notify the NCAA of their redshirt request.
Academic redshirt - based on their test scores (ACT) and high school GPA and a lot of hocus pocus the NCAA has a "grey area" where an athlete can retain a scholarship and practice but is not allowed to play in a game.  This person could not be instantly redshirted for football (or any 1st semester sport) but in basketball this might happen if the student fixes things in the first semester.
Ineligible - student can't practice or play or receive scholarship money.

The other (that is 3 now) redshirt is a medical redshirt.  If hurt before the first game the NCAA pretty much grants any freshman a medical redshirt.  If it is after the first game the student must apply and more NCAA hocus pocus happens.  And then there are students who have had two medical redshirts happen.  So a redshirt freshman then sophomore.


Experimental Values for Amplitude $\delta^*$ of Particle Displacement in Acoustic Fields?

Question: I've been searching but have been unable to find any experimental values for the amplitude $\delta^*$ of the particle displacement from equilibrium that particles in a medium such as air will undergo when a sound wave propagates through that medium. This parameter $\delta^*$ shows up a lot in theoretical treatments of sound, such as here, and sure we can relate it to a bunch of other parameters like amplitude $v^*$ of particle velocity and the temporal angular frequency $\omega$ of the sound wave, but ultimately I would be interested to know if there are any experimentally tabulated values for $\delta^*$ in various different circumstances.
Comment: Duplicate [What is the relationship between pressure and displacement of a sound wave in a tube?](https://physics.stackexchange.com/questions/585422/what-is-the-relationship-between-pressure-and-displacement-of-a-sound-wave-in-a)
Answer: You probably won't find it tabulated anywhere
because particle displacement ($\delta^*$) and likewise
particle velocity ($v^*$) and sound pressure ($p^*$)
all depend on the loudness of the sound.
Loudness is often measured in a logarithmic dB (dezibel) scale.
The sound pressure level $L_p$ is defined as
$$L_p=20 \log_{10}\left(\frac{p^*}{p^*_\text{ref}}\right) \text{dB}$$
or equivalently
$$p^*=p^*_\text{ref} 10^{L_p/20\text{ dB}}$$
where is $p^*$ is the sound pressure and $p^*_\text{ref}$
is a reference sound pressure (for air it is
$p^*_\text{ref}=2\cdot 10^{-5}$ Pa). For example:

$L_p=0$ dB (corresponding to $p^*=2\cdot 10^{-5}$ Pa) is so quiet
that it is hardly perceivable.
$L_p=130$ dB (corresponding to $p^*=63$ Pa) is so loud that it damages the ear.

With the relations $v^*=\omega\delta^*$ and
$p^*=\rho c\omega\delta^*$
you can then calculate particle displacement $\delta^*$
and particle velocity $v^*$ from the sound pressure $p^*$.
Comment: Good answer with concentrated information. I just wanna make a minor correction here. The term "loudness" is used for the subjective feeling of how "strong" a sound is, which has a weaker connection to pressure (and displacement) amplitude than the sound pressure level (it is also frequency dependent). Additionally, level refers to the logarithmic (in dB) counterpart of a quantity in acoustics. For example Sound Pressure Level is actually pressure converted to a logarithmic (dB) scale, with some reference value always in effect. +1 from me.


Generating emails with inline images

Question: I need to figure out how to get a diverse sample of emails with inline images in them.  Our web application has to be able to identify inline images in email and then display the email and image in a discussion format.  I am looking for any suggestions on how and where to get as many unique examples of this as possible.
Comment: I can appreciate that this is an actual problem you face, but this doesn't seem to be an answerable question. It also lacks a key element of a great question: prior effort. The question doesn't currently demonstrate what you've done to try to solve the problem already.
Answer: Host an Open Beta, soliciting such emails.
Answer: You need to clarify your question. What do you mean by diverse sample of emails. Are you talking about different encodings, emails from different providers, different fonts, etc., or are you just talking about emails with embedded images? Also, is there a size limitation on the inline images?
A simple approach may be to generate random strings of words then randomly insert images at 1 or more points within the message body. Parameterized test data generation is a very potent way to increase data coverage and increase test variability.
As for where to get the images...the Internet has an amazing amount and variety of images that are publicly available.

Generating emails with inline images


Flight directional headings

Question: I listen to aircraft land and take off weekly.  I noticed in taking off they usually only use about 3 to 5 different directions.  I don't understand what they mean when for example they said to the pilot, "American 1450, ok for take off 27 left, head 265"  The only part I am concerned with, the part I don't understand is the heading part.  What does the 265 represent?  The next plane was told to line up and wait.  Shortly it was told that it was ok for take off, but to head 235.  Please explain.
Answer: What you are hearing is a departure clearance. ATC is giving instructions to pilots on the ground before they take off on what runway to use and what to do next.
27 Left is the runway, which points close to 270 degrees. We shorten it to 27 because although it may not be exactly 270 degrees that is close enough. 27 Left means there are more than one runway in parallel, if there's a 27 left then there's a 27 right.
The second part of the clearance is the departure heading. 265 is very close to the runway heading, so ATC is telling the pilot to maintain runway heading. The second flight ATC is telling to make a left turn to 235 after departure, this is either to get the flight closer to its destination heading, or more likely for spacing to keep the flights separated. There was probably an altitude instruction in there somewhere, like 'climb to 2000ft, then turn left to 235.'
Comment: Depending on the airport, 265º may in fact be runway heading for runway 27L.
Answer: Depending on what direction (destination) the airplane will be going to, initial headings may be assigned to put the airplane in the appropriate traffic flow to best serve Air Traffic Control routing needs.
"Head 265" (probably actually phrased "fly heading 265") means that "after takeoff" Air Traffic Control is instructing the airplane to fly a heading of 265 degrees. Further routing instructions will be given to that airplane later.
It's a bit more complicated and involved than my basic explanation above but I assume you are quite unfamiliar with how Air Traffic Control routing works so I  am trying to keep my answer very basic.
Hope this helps.

Flight directional headings


How to I install the default Grub theme for ubuntu?

Question: I installed Ubuntu Mate on my Ubuntu 15.04 install just to try it out. It's pretty nifty, but it's replaced my minimal grub theme (with a purple background) with a gray-green menu I don't like in the least. I tried using Grub Customizer to change the look of Grub but I'm not having much success: the only theme that's available in Grub Customizer is the Ubuntu Mate one, and my efforts at a custom theme aren't working very well (for some reason my 1920x1080 wallpapers are not being properly rendered). Any thoughts on how I can get the minimalistic grub menu that comes with ubuntu unity back?
Answer: The default theme is provided by plymouth-theme-ubuntu-logo. Install it:
sudo apt-get install plymouth-theme-ubuntu-logo

To set it as the default, run:
sudo update-alternatives --config default.plymouth

And select /lib/plymouth/themes/ubuntu-logo/ubuntu-logo.plymouth in the menu.


option for inheritance

Question: Whats the other option we can use for multiple inheritance other than implementing interface
Comment: Do you have a specific need for multiple inheritance?
Comment: I second the question from Milhous.  Some more details about what you're trying to accomplish would allow people to give you more thorough answers.
Answer: A direct answer is to use inner classes. That gives you two (or more) objects that are intimately linked but cover independent base classes.
In general, prefer composition over inheritance. It's a common mistake to use inheritance everywhere. However, that leaves inflexible solutions that are difficult to follow.
Answer: At first, it's better to avoid multiple inheritance and use interfaces. And Java actually does not support multiple inheritance.
But you can use mixins to fake the multiple inheritance. There are some manuals about this:
Multiple Inheritance in Java
The Java Mixin Pattern, or Faking Multiple Inheritance
And if you want to make something composite, I advise to take a look at the Qi4j framework:
Composite Oriented Programming with Qi4j
Answer: Java does not have multiple inheritance.
From the Interfaces page of The Java Tutorials:

The Java programming language does not
  permit multiple inheritance
  ... , but interfaces provide
  an alternative.

Since multiple interfaces can be implemented by a class, that can be used as a substitution or alternative to having actual multiple inheritance in Java.
Answer: You'll probably have to use composition - i.e., having an instance of your "parent" class as a member of your "child" class.  ("Parent" and "child" here indicate the relationship the two classes would have if you were using inheritance.)  The containing ("child") class must then wrap the interface of the contained ("parent") class to expose any functionality of the contained class
One way to smooth the wrapping process is to have both the contained and containing class implement the same interface - the implementations of the methods of this interface in the containing class can then be straight calls to the same methods on the contained class.

option for inheritance


This is the task manager screenshot for my server. Will increasing RAM make a difference?

Question: The server runs XAMPP (Apache and MySQL mainly). Lately the concurrent user count has increased, and the server crawls and sputters during peak load. It only has 4GB RAM though. So, my question is will increasing RAM make a difference?
Comment: This machine is showing three fourths of its RAM "available". That is not a machine that is experiencing memory pressure. To confirm this, you could look at the page fault rates - especially the hard fault rate. If these are low, adding RAM will not help. CPU usage does not appear to be a problem either.
Answer: Increasing MySQL max connection has  a direct effect on RAM, as it  increases the number of file descriptors that mysqld requires
max_connections = (Available RAM - Global Buffers) / Thread Buffers

To get the global and thread buffers
SHOW VARIABLES LIKE '%buffer%';

Just have a look in the number of opened tables
mysqladmin status
SHOW GLOBAL STATUS LIKE 'Opened_tables';

Note: It is always better to have separate servers for Apache and MySQL. Increasing RAM will definitely help


Can't Reset Password - Ubuntu 10.04 on Hyper-V

Question: I have a virtual Ubuntu 10.04 machine running under Hyper-V which I have lost the password to. With a physical Ubuntu box it's rather easy to press ESC at the grub prompt and proceed to reset your password. Unfortunately I can't see a grub menu and pressing ESC does nothing. Can anyone offer some advice for how to reset the password on this virtual machine?
Comment: The fact that it's a virtual machine makes no difference. ESC works just the same when you have the console window up; perhaps pushing it rapidly would work, I don't think the Hyper-V BIOS passes any key presses during BIOS initialization.
Comment: While I agree that it makes no difference that it's a VM, Hyper-V not passing keypresses during bios init. is definitely a huge problem and it appears that this is the case.
Answer: Use a boot cd!
- mount your root partition to /mnt/root/
- change /etc/shadow to root::[and so on]
- OR type: "chroot /mnt/root passwd"
- reboot, login with empty password or the new one you specified
Comment: Typo! Try
chroot /mnt/root passwd
Comment: Could you explain those steps a little more? How do I mount my root partition to /mnt/root/? By boot cd I assume you mean an Ubuntu 10.04 cd?
Comment: Use a grml or gentoo boot (aka "Live)-CD. I don't know your partition layout, so try:
mount /dev/sda /mnt/root
Comment: Ok, I've booted my GRML live cd. I create a directory 'root' in /mnt/. I successfully 'mount /dev/sda1 /mnt/root'. After this I: 'nano /etc/shadow' and can see my account name and the hashed password within it. I remove everything between the ::'s. When I reboot as soon as I press enter on my username it says 'Authentication Failure', it does not even ask for a password. I restored my vhd and tried again, this time placing an '!' in /etc/shadow for my user account which should be interpreted as NULL or blank...
Comment: ...This time when I rebooted it allowed me to enter a password but it gave me an Authentication Failure when I tried a blank pass.

Also, 'chroot /mnt/root pass' gave me an error because pass is not a command. I used passwd and it gives me, "Authentication token manipulation error. Password unchanged." Any suggestions?
Answer: While Craig's answer will definitely work, I discovered the following also works:

Hit the reset button and immediately click into the Virtual Machine Connection window so that it grabs the keystrokes.
Frantically hammer both shift keys and the ESC key while until you get a GRUB menu.

Apparently holding down the shift key or pressing it in a less manic fashion is not enough, as the window of opportunity is very small...
Comment: Love this highly scientific answer :). One problem I found is that Windows wants to turn on Sticky Keys if you press Shift five times in a row. I disabled that under Ease of Access. Alas, no amount of frantic hammering would make it stop at the grub loader. I guess it's on to try a live CD. (BTW this was with Ubuntu 18.04 and Hyper-V on Server 2016.)


Why phase margin and gain margin should be positive?

Question: In many textbooks it's given that gain margin (in db) and phase margin of the system needs to be positive for the system to be stable. I could not find the reason behind this. Could someone explain this?
Comment: What is your background, for example have you ever heard of the [Nyquist stability criterion](https://en.wikipedia.org/wiki/Nyquist_stability_criterion)?
Comment: **many textbooks**.  Reference the textbook.
Answer: The gain and phase margins of a system are characteristics that can be obtained by studying one of the following well-known plots: Nyquist Plot, Bode Plot, Nichols Chart, Disk Margin which gives details in a different way (may be others that I'm not aware of). I will address the issue of your question by using the bode plot tool. When looking into a bode plot, one has to recognize two very crucial points. The first point is the frequency where the magnitude plot (Gain) crosses the $0dB$ line, also know as the gain crossover frequency. The second point is where the phase plot crosses the $-180^{o}$ line also known as phase crossover frequency. These points may be more than one for each case as complexity of the systems increase.
The Gain Margin of the system is the value of the magnitude plot at the phase crossover frequency and Phase Margin is the value of the phase plot at the gain crossover frequency.  Gain Margin is the amount gain variation your system can tolerate before going unstable. For example consider a system with $10dB$ gain margin at the frequency $15rad/sec$, which means that at $15rad/sec$ the phase plot crosses the $-180^{o}$ line. Now, if in reality there is some gain (decreasing) variation of $-10.5dB$ at $15rad/sec$, then due to the fact that this frequency is a phase crossover frequency your system would go unstable. The same goes for phase margin as well.
A classical feedback system has a transfer function oof the form:
$$ T(s) = \frac{L(s)}{1+L(s)} \rightarrow Negative \ Unity \ Feedback  $$
$$ T(s) = \frac{L(s)}{1-L(s)} \rightarrow Positive \ Unity \ Feedback  $$
The sign of the unity feedback changes and becomes positive when the phase of the system crosses the $-180^{o}$ line and becomes:
$$ Phase < -180^{o} $$
and goes back to negative sign when the phase of the system is again $\ Phase > -180^{o} $. The critical fact regarding the sign of the feedback is at the region close to and around the gain crossover frequency (or the regions around the gain crossover frequencies if there are more than $1$ points where the magnitude plot crosses the $0db$ line). In order for your system to be stable you basically need it to be at negative unity feedback state, which means the system's phase should be $\ Phase > -180^{o}$. So, when talikng about the necessity of positive phase margin, we are talking about the regions close to a gain crossover frequency where the system should be in the negative unity feedback state $\ \Rightarrow \ Phase > -180^{o} $.
The phase margin of the system can be negative and the stability of the system is preserved as long as this happens at frequencies which are nowhere near any gain crossover frequency. I will borrow a very good image from an anwer at Quora which illustrates this very beautifully:

At the first region which is highlighted in red around $1kHz$ the system has negative phase margin and negative gain margin but it remains stable since we are not close to a gain crossover frequency. At the second region highlighted in red around $100kHz$ the system goes again at positive unity feedback state with negative phase margin and positive gain margin yet it is still stable since again we are not close at a gain crossover frequency. Note that at the gain crossover frequency the phase margin is indeed positive in order for the stability of the system to be preserved.
In conclusion, regardless of the sign of the margins you have to check the region where these changes occur and whether or not the magnitude plot is close to $0dB$. I chose the bode plot tool since it is somehow less complicated and more popular than the others I mentioned but I strongly encourage you (without underestimating bode plot at all) to check out both Nyquist Plot and Nichols Chart (which I very much like) since they provide information in a very elegant and representative way. You should also search for the disk margin since it copes with the problem of variations which can cause both phase and gain variation simultaneously and it shows you how robust is your system ar such variations.
Answer: After further research, I retract my previous opionion.
here is another article on the topic:
https://www.ridleyengineering.com/hardware/ap310-analyzer/ap300-application/loop-stability-requirements.html


What's the difference between "he's going to start walking" and "he's going to walk"?

Question: What's the difference between "he's going to start walking" and "he's going to walk"? Are there any shades of meaning here?
Comment: Insufficient context. Are we talking about a baby, a man recovering from a severe diving accident, or a man who walks his dogs every night?  Who is talking: parent, doctor, neighbor, spouse, baseball manager?
Comment: Yes, I agree with J.R.. Insufficient information!
Comment: @J.R. - I don't really have any context here. My question is simply about these two phrases. I heard both of them used in many different contexts and have always wondered if there is any difference between them.
Comment: So, really, any verb will do? (For example, _"He's going to start swearing,"_ vs. _"He's going to swear,"_ or, _"He's going to start driving,"_ vs. _"He's going to drive,"_  or, _"She's going to start swimming,"_ vs. _"She's going to swim."_) If that's what you're asking, fine by me, but I still think you could improve the question to make that more clear. Or maybe there's something about _walking_ in particular that throws you off your step?
Comment: @J.R. - There isn't anything particular that throws me off here about the verb "walking", however, I didn't mean any other verb in my question, otherwise I would've phrased it as something like "What's the difference between such constructs as 'He's going to V-base' and 'He's going to start V-ing'"
Comment: He's going to start walking may suggest some level of immanence, as in, "He'll be walking soon."  Once again, though, there many contexts where I can imagine this sentence being used, so it's hard to declare anything dogmatically.
Answer: "He's going to start walking" sounds to me as a prediction based on present evidence. You see someone about to start walking and you use this construct.
"He's going to walk" could be interpreted again as a prediction based on present evidence, but it can have a different meaning, too. It can be the announcement of a decision he has taken which the speaker knows about.
Answer: Both sentences mean either (A) a decided action or (B) a future happening based on the current situation.
(Of course if you're talking about a toddler, it's not A)
"He's going to start walking" also puts emphasis and focus on the commencement of the act.
Ex. He's tired and he's sitting on the park bench. But he's going to START WALKING soon.
On the other hand, "He's going to walk" doesn't have the same particular meaning and just refers to the act of walking as a whole.
Ex. He missed the last bus. He's going to WALK.
Similarly, if a toddler has never taken a step previously:
He's going to START WALKING.
And if I notice a more advanced (toddling-wise) kid is about to take a step:
He's going to WALK.


Can i use a water heater as my source for the in floor Pex tubing system?

Question: I installed Pex tubing in concrete in 2 areas, both garage floors. I have been told 2 things.... one is that it will require a boiler, two, that a hot water tank will do the job. Cost is a huge factor here when compared. I am willing to try the hot water tank as it is a fraction of the cost and can use it on another property if not successful. Any thoughts on this would be appreciated.
Comment: I have seen waterheaters with an expansion tank and pump heat systems like this. I do not know if they were up to code but one was in a house another was in a Shop/Garage.
Comment: I would imagine that a tank style heater would be far less efficient, but I don't have any numbers to back that up.
Comment: Just to clarify, you installed the pex prior to figure out how to feed it with heated water? If so, did you ensure that you used oxygen barrier pex?
Answer: It's all about heat load.
A very well insulated building may have a heat load so low that most boilers would be operating very inefficently to meet the load - sitting idle most of the time, even on "design days" when the heat load is at the greatest due to the outside temperature being the lowest temperature designed for (thus, "design day.")
As a practical example, I have a radiant floor system installed in a building with a design-day load of 30-36,000 BTU/hr. A typical "small" boiler is 100,000 BTU/hr, so it would be in standby 2/3 of the time even on that coldest day (which is typically for no more than a week, and not every year.) A water heater can be more closely matched to the load, simply because they are available in smaller sizes.
As for tank .vs. no tank, it's largely irrelevant - there are inefficient and efficient versions of both (and much of the hype for tankless heaters being "more efficient" due to no standby losses falls down in houses where hot water is actually used, at modern insulation levels which lower standby losses; especially considering greater complexity and maintenance expense that is often associated with tankless.) A common example (and commonly used for radiant heat) of an efficient tank type is the polaris, at something like 95% efficient and a condensing design.
If you have a larger heat load, an efficient condensing boiler might be a better choice - that has to to with the whole building construction, not the heat delivery method.
Answer: You could use either an on-demand water heater or a standard one if you want to keep 20-40 gallons of water hot on hand. The big thing is they will not run as hot as a boiler. However, running pex tubing in concrete doesn't require the water to be as hot as perimeter or radiator hot water heat as long as you leave it on long enough to heat the concrete up to operating temperature which will take longer.
You will also need a circulating pump, air separator, and an expansion tank. There are several companies that make a quick install board with all of these items, guages and valving included but they are not cheap.
Did you insulate under the garage floor? If not you will be losing a lot of heat into the ground for quite a while until you warm the soil up and it will be more inefficient in the long run.
If you want to DIY this project get yourself a book called "Modern Hydronic Heating". It is the textbook to have on this subject.
Good luck with your project!
Comment: First a thank you to all who responded! we did use insulation under the tubing...so no problem there and the tubing and the tubing has oxygen barrier... so good there too. I will research the recommended reading and will try to determine if I may use an "on demand" or tankless system. if anyone has thoughts on this... please feel free to advise.
Comment: an on-demand water heater on a closed loop would essentially be the same as a boiler. Might cost the same too.


Can I use ZODB with Hibernate/JPA?

Question: I'm writing an application that uses JPA for persistence. Currently I'm testing with Hibernate and a MySQL database. The server it's going to be deployed on already has ZODB running though. To avoid having to install MySQL especially for this app, it would be nice to use ZODB as the backend for JPA. Is this possible, with or without Hibernate?
Answer: Do you mean ZODB as in Zope Object Database? If so the answer is no. JPA is all about ORM (Object Relational Mapping), meaning your are working with relational databases. ZODB is a object database which is completely different thing. Why would you use JPA if you are going to use a object database?
Comment: "Why would you use JPA if you are going to use a object database?" - For the abstraction of the database type
Answer: No, the ZODB is a python-specific object database. It uses Python-specific tricks to load and store object state, something the JPA cannot provide (it is designed to map objects to relational databases).
Answer: No current implementation for persisting to ZOPE DB but you could add support for persisting it using JPA via DataNucleus by adding support for that DB. Sounds complicated but the basics is using doable in a couple of days ... as per
http://www.datanucleus.org/servlet/wiki/display/ENG/HOWTO+Support+a+new+datastore
DataNucleus already supports other object datastores via JPA (db4o, NeoDatis) hence why it ought to be doable

Can I use ZODB with Hibernate/JPA?


JDK Installed but browser (FF, IE) can't run Java apps

Question: I have installed latest JDK (x64) on Windows 7 but browsers still can't run the java apps. I understand that JDK includes JRE. JDK is installed correctly and from command line (Java -version) shows installed version as well. Any suggestion please? Thank you
Answer: You also need a browser plugin: http://java.sun.com/products/plugin/. This plugin is installed when you use the java installer. If you just copy the directories over and set up you PATH environment variable, the command line will work but not the browser.
Answer: I've recently seen this problem related to the use of a 32-bit rather than a 64-bit web browser.
The default version of most web-browsers is currently 32-bit, regardless of the 64-bit operating system.
In this case, also installing the 32-bit java runtime environment(JRE) is recommended, as described here for windows (https://www.java.com/en/download/faq/java_win64bit.xml).
After installation, type java -version in the console, which should confirm that the Windows 7 PATH variables still refer to 64-bit version of Java from the JDK.
Another promising option is to switch to a 64-bit browser (e.g. Chrome-64bit, Waterfox).


What happens when a file download is cancelled?

Question: I have often wondered this. If I attempt to download a large file, but get bored half way (let's say 50% downloaded) through and cancel the download, what happens to the 50% of the data that was "downloaded"?
Comment: Well it really depends on what are you downloading with. Wget? Browser? Torrent client?
Answer: I'm assuming you're talking about downloading a file from a website with a web browser here. Mainstream browsers like Firefox, IE, etc. store these files in a cache which will be cleared eventually. So, there is a chance parts of the canceled download remain on your computer in the browser cache, but they will be deleted eventually. If you wish you can force the browser to clear out the cache so nothing remains.
Comment: and . . . many of the downloader programs or plug-ins will be creating a "part" file, or will have created a whole empty file for writing to.. this file will be removed when the download is canceled.  There are certannly some programs for downloading that do not properly cleanup, with those you should see where the downloads are/were going, and determine if they do a proper cleanup.
Comment: @Ismail.  Very unlikely.  Even a "simple" download requires low level handshaking to coordinate - prevent overruns, etc.. And the client isn't there to do that.  Also, servers are always managing bandwidth which they have to pay for, so they're not going to waste an expensive resource.
Comment: @iSid - When you stop the download, the connection to the server will be closed, so unless the server is *really* stupid, the download will stop on the server side too. The high level version is that the client will [tell the server](http://en.wikipedia.org/wiki/Transmission_Control_Protocol#Connection_termination) before it disconnects, so the server will know to stop sending data.
Comment: But is it that the server still delivers the remaining part of the file and no program is at the client to grab that?
Comment: On top of that, most of these files could be hidden, so (on windows) go into your folder settings and toggle 'show hidden files'
Answer: It depends on what you're using to download the file. A lot of software will leave the half-downloaded part sitting on your machine and may offer a feature where you can resume the download from the point you stopped it. The place where this file-part resides also varies depending on which software you're using. It could be in the place you chose to save the file, or it could be in a "temp" directory/folder. Sometimes the file-stub will be named a bit differently than the real file name ("myArchive.crdownload" instead of "myArchive.zip" for example) Other software deletes the file stub when you cancel.


Can `Phone Calls` application permission allow developer to read my contact book?

Question: I wonder if other people can read my contact list when the app permission(s) has Phone Calls permision like below snapshot.
Answer: Not quite: this permission allows the app to read the IMEI of your phone, your phone number, your network operator, and to know whether you are making a call. It does also let the holder of the permission know the number at the other end of the call, but not any of the contact data associated with that number. These uses are described in the developer documentation for TelephonyManager.
A good use for this might be to disable some ongoing process while you're in a call, or show an indicator, or to help you report your device as stolen. A bad use for this would be for invasive ads to track your identity across different apps, in order to push targeted advertising at you; or to record your phone number and those you call, to make nuisance calls to you afterwards, maybe claiming to be from your network operator.
Reading your contacts is controlled by the permission called read your contacts.
Comment: Don't forget: Your phone number can also be accessed with this permission. With an ongoing call, also the number you called (or have been called from). Additionally, it reveals your network provider.
Comment: @Izzy That's right, I should have included that. I added a (related) potential misuse to the answer as well.
Comment: Thanks! Already upvoted :) and just updated the linked duplicate answer with details on this permission (including good/bad/neutral use cases, and the fact that this permission is implicitly granted to apps targeting Donut and older).
Comment: Adding URL to official site stating your answer would be great! Please add.


Android tablet not recognizing external keyboard?

Question: I have a Tablet running Android 4.0.3. Its DOMO x3g, works fine except that when I connect an external usb keyboard to it,it doesn't show up any recognition or anything.While USB pen drives, hard drives easily work on the tab... Any solutions?
Comment: Is it a standard 'HID' keyboard-device, or a more complex USB keyboard? *Check this on a PC (Windows or Linux).*
Comment: Hello, sorry to burry out this thread, but I had the same issue and I found out my issue on my Android TV (V8) that did not reconize my keyboard. That was due to the Android developper enabled. Go to `Settings` > `Developer options` menu and uncheck `USB debugging`. Voila !
Answer: Yes, I had the same issue, it never worked for any PC USB Keyboards, except the one which we bought from DOMO, that nCase K6. That K6 worked perfectly (even to my PC). But a PC USB mouse worked on my DOMO Slate X3G. Buy a nCase K6 or, preferably you could install USB Host Controller from Play Store, as said by the first answer.. That should fix your issues.
Answer: Install USB Host Controller from Google Play, and run it.
Comment: Any explanations to the background, why this app should help -- or at least what it does?
Comment: If possible, please provide a link to the app. :)


Transfer Google Webmaster Tools data to another account

Question: How can I transfer my Google Webmaster Tools data to another account?
Answer: I had to do this today. It's an easy process. These are the steps I took:

Log into your new account on GWT.
Add your sites via the Add a site... button.

As you create each site entry, you will need to update your verification method. I used the HTML file upload method. This will tie that site into your new GWT account. The data is automatically visible in the NEW account.

When your sites are created, click the Add or remove owners link beside each site (when on your dashboard) and then click the Unverify link, for the OLD account, under the Verified owners heading.
Answer: The key point here is that there is no "transfer ownership" option.
The answer is that a site can have multiple owners in Google Webmaster Tools.
Therefore the most common "transfer" situation is simply to add another user at the higher permission level BUT if you want that user to be OWNER you cannot add them as owner - they have to add the site SEPARATELY by themselves and they should not already be added as a user for that site.
In other words if the user you want to transfer ownership to is already added as a user, then you must remove them. Then they must go add the site and follow the standard (multiple alternatives) verification, then if successful you will each be able to see each other as (co-)owners.
Answer:
Add the property to the new Google account & verify it in google search console.
Delete the meta tag / html file / DNS record from the former account for the website.
Click on site url in google search console and then the toothed wheel > user and property owners
Click on the former owner email address and click on remove.


How to stop Firefox from updating?

Question: Anyway here is my problem. I'm currently on beta channel (Firefox 6) which was recently upgraded and broke some extensions. Now I gather those extensions will be upgraded in the future and they'll restore to working order. Is there a way for me to disable further beta updates and keep my Firefox on a stable channel without losing my settings and extensions? Is there a way to backup Firefox 6 or disable updating to a beta version (but keep the updating to a stable versions)?
Comment: All of the answers such as this web page are outdated. Firefox 3.6.25 no longer responds to unticking of the update box. It continues to ask if you want to update despite the fact that important add-ons such SEO Quake will not operate in the latest version of Firfox.
Answer: Type about:config in the awesome bar and search for the key app.update.channel.  Change the value to release to get the stable releases only.
Mozilla KB Article
Answer: Uncheck whatever is unnecessary:
Comment: Already did. Unfortunately that didn't stop Firefox to update on one occasion (there was a bar notifying me of Firefox being uploaded once I started the program).

How to stop Firefox from updating?


Why does a personal identification number (PIN) code only contain 4 digits?

Question: I'm in the process of designing an app that allows users to sign in via a personal identification number (PIN) code. I'm curious to know why a typical pin code usually contains four numbers, and why this is common practice?
Comment: I see you have an answer, but I suspect you weren't asking about Postal Index Numbers. Am I correct in reading your question as referring to a Personal Identification Number on used on mobile phones? Either way, please clarify your question.
Comment: Yes, I was referring to a Personal Identification Number. The type you might find on a mobile app for a financial institution, or what you would enter into an ATM before withdrawing cash.
Answer: Quite an user experience question, where technology development had to adapt to real life experience, in this case the inventor's wife experience

The standard, ISO 9564-1, allows for PINs from four up to twelve
  digits. The inventor of the ATM, John Shepherd-Barron, had at first
  envisioned a six-digit numeric code, but his wife could only remember
  four digits, and that has became the most commonly used length in many
  places, although banks in Switzerland and many other countries
  require a six-digit PIN .

From Wikipedia:Personal Identification Number
Answer: While the UX aspect of the question is important, there is a security question hidden within: how can a 4 digit PIN be secure enough to protect my money?
The answer is that a PIN must be tested while it's connected to a secure system, and the secure system needs to limit how many times it can be tested and then disable it.
If the PIN is not being checked by a secure system, there is no security.  You could simply type every number from 0000-9999 in just a few hours (or a computer can try them all in a few microseconds.)  Eventually, you'll gain access.
If the PIN is being checked by a secure system, the secure system can give the user three tries and then lock the account from PIN access.  This means the chances of guessing the right PIN are fairly low, which is the risk the system owners take (assuming the user doesn't choose '1234', or their birthday, of course.)
There are many variations on this theme, of course, and many vulnerabilities and weaknesses associated with various implementations of it.  But the primary security feature is that a limited number of guesses are allowed and then access is denied.
Answer: If you think wider around the world - the digits vary. In India we have 6 digit pincode, in US some states have 5 digits and other may have different.

ZIP codes were only first introduced in the 1960s with the
  introduction of new automated address reading machines. With rapid
  post-war growth across the country and the increasing volume of mail
  (which doubled between 1942 and 1962 from 33 billion to 66 billion
  pieces annually
https://www.policymap.com/blog/2013/04/tips-on-zips-part-ii-a-brief-history-us-postal-codes/

Read more here: https://en.wikipedia.org/wiki/Postal_code

The PIN Code system was introduced on 15 August 1972 by Mr.Shriram
  Bhikaji Velankar.[2][3] The system was introduced to simplify the
  manual sorting and delivery of mail by eliminating confusion over
  incorrect addresses, similar place names and different languages used
  by the public
https://en.wikipedia.org/wiki/Postal_Index_Number
Comment: I think you confused PIN with something else. I believe the OP referred to PINs used for credit cards and security
Answer: Credit card PIN is an example of two factor security. "Something you have and something you know". A PIN is useless without the card. With the card but no PIN you cannot brute-force it. Three wrong guesses then use of the card is blocked.
A PIN is not a secure password. But in the hands of Joe Public no password will be anything like secure 90+% of the time. 2-factor is better.