How can I soundproof my room to reduce street noise?

Question: My bedroom is facing a busy street, with many bars/restaurants. People are shouting and cabs are honking.
The 2 windows are double-pane, and the wall is the exterior wall, so solid brick. There are no gaps in the windows, as far as I can see. I have curtains.
I read that foams are echo-absorbing and will not help in this case, while MLV (mass loaded vinyl) might not be enough.
Is there a relatively easy way to solve this? I'd like to avoid extreme measures such as building a room within a room.
Comment: Do you currently have anything other than curtains hung in the room? Even if you are preventing a lot of noise from entering, much of sound 'proofing' should actually be called 'sound mitigation'; in short, what does it get to bounce off of once it's inside.
Comment: There's a bed, a desk, one office-chair, one wooden chain, walk-in closet and a laundry-bag. The curtains are blackout. Do you think the echo is significant?
Comment: Put your ear up against the wall, and then up against a window. I bet the wall blocks much more sound. At that point, your objective changes to prevent sound transmission through the window, which is an easier task. (Remember to keep the window usable as an emergency exit.)
Answer: I am by no means a professional 'sound guy' but I do enjoy playing my music and movies  without any outside noises. It sounds like you are suffering from a similar situation I deal with. Often it's not about preventing 100% sound from coming in, but preventing it from reflecting and propagating.
Some common anti-echo techniques I employ are:

hang framed Canvases (cheap oil paintings or blank canvases from a craft store)
Rugs/Carpets (thicker the better)
Foam Panels hung on doors

I always imagine if every hard surface is mirror plated and you shined a light from where the noise comes from. It can be reflected off just about anything. The softer and less dense, the less reflective.
If it comes right down to it, and the window truly is the source of problems, an inexpensive project can be making a frame for a single piece of poly-carbonate to mount/hang over your window. It essentially would make a crude "triple pane" window.
I've never had to go this far for noise, but I have for apartments with drafty windows and it was noticeably quieter.
Good luck and let us know what works for you.


How can I open the chest in 1-8 of Chrome version?

Question: I have tried other instructions I found, like clicking and typing "OPEN", but nothing seems to work.
How can I unlock the chest?
Comment: If all else fails, try bashing your forehead repeatedly into your keyboard.  This solves most of my problems in a variety of cases.
Comment: I'm not sure if this should be tagged "angry-birds-chrome" or "angry-birds" and chrome. In the meantime, I've done the latter.
Comment: Related meta: http://meta.gaming.stackexchange.com/questions/2262/what-to-retag-chrome-to
Answer: You can't open the chest at all in the chrome version: you have to use your birds to hit randomly placed chrome balls, in some levels. The first one is in level 1-16, and you need to zoom out all the way to see it, on this little floating island. Also in level 1-18, zoom out to find that at the top of the mound there is a chrome ball.
Answer: You can't open the chest. Unlike in the Touch version it doesn't give anything but 500 points when you destroy it.
Answer: Edit: Just tried, doesn't work.  I am thinking the Chrome version doesn't actually have the Golden Eggs, instead it has the Chrome Dimension levels.

Try clicking repeatedly on/around it.  I couldn't get the chest to open right away in the Android version either, I had to mess around for a bit.  Maybe try throwing a bird first too.


USB cordless mouse stopped working on Ubuntu 22.04

Question: Two days ago my cordless USB mouse stopped working.
It works fine with other computers. The battery is ok and well connected.
I only noticed it stopped working yesterday, and don't know why it's happened. I can only imagine it was because of some updates running the day before.
Comment: Is it Bluetooth or one of those mini dongles? If the latter, try putting it in a different USB port?
Comment: It's onde of those mini dongles, tryied another usb port and still not working.
I also have a wireless keyboard and it works fine on every usb port, so no usb issues.
Comment: Thank you, I ended up formating my pc back to ubuntu 20.04 and it works fine, didn't understand what happened though
Answer: I had this issue and I resolved this by uninstalling usbguard package. Might help. Make sure you reboot after removing usbguard package.
Comment: Your answer could be improved with additional supporting information. Please [edit] to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers [in the help center](/help/how-to-answer).
Comment: There is no documentation for what I suggested, I figured it out via hit & trial & it worked.


Wordpress site doesn't work on Internet Explorer

Question: I'm building a theme for Wordpress, but it seens to not work on Internet Explorer, especialy above IE 9.
Here is the site: http://icomeg.com.br/
It looks like the background image doens't resize automaticaly or something (I'm using CSS3 Media Queries), my site froze completly, I did a research and tried to put this filter:
<code>.centered_header{ /*criação das caixas do header */
position: relative;

height: 130px;
margin: 0 auto;

background-image: url(../ico-theme/images/header-ok21.jpg);
background-size: 100% 100%;
background-repeat: no-repeat;

filter: progid:DXImageTransform.Microsoft.AlphaImageLoader( src='../ico-theme/images/header-ok21.jpg', sizingMethod='scale');
    -ms-filter: "progid:DXImageTransform.Microsoft.AlphaImageLoader( src='../ico-theme/images/header-ok21.jpg', sizingMethod='scale')";}
</code>
On Chrome and Firefox works well but in IE it's a completly mess, is someone can help me?
Comment: could you possibly add a link / jsfiddle?
Comment: Here: http://icomeg.com.br/
Answer: Try this, it works fine for me.
<code>.centered_header{
    width: 100%;
    height: 100%;
    position: fixed;
    background: url(../ico-theme/images/header-ok21.jpg);
    top: 0;
    left: 0;
    margin-top: 0;
    margin-left: 0;
    background-size: 100%;
    background-repeat: no-repeat;
}
</code>


Correct image size for iPhone developing

Question: I am working on an iPhone game in spritekit, for the past while I have been using random graphics but as my game play is beginning to shape up. I think it's time I look into my own graphics development.
My level is designed in Tiled, So I would like to know if it is ok to make each tile 16 * 16 and the hd version ( for the iPhone retina) 32 * 32.
and, what is the difference in drawing images for iPhone and iPhone retina.
Thank you
Answer: That's correct. Retina graphics twice the resolution of non-retina. The easiest way to support both retina and non-retina displays is to make two copies of each graphic you use. Use the format imagename.png for the non-retina and email@example.com for the retina image. When you want to load the image you can use this line:
<code>UIImage* image = [UIImage imageNamed:@"imagename"];
</code>
iOS will automatically select the correct image.
Comment: thanks for the answers So, I will make 16*16 tiles for normal iphones and 32*32 tiles for hd iphones


How to maximize q and pi?

Question: I am desperate about some functions I would like to understand. I hope someone can help me to understand.
Lets suppose we have a demand-function like:
$$ D_i=\ \ 1/3+\ \ (2q_i-\ \sum_{j\neq i}\ q_j)/(2t) $$
And the corresponding profit function looks like:
$$
\pi_i=(p-c\ast q_i\ )\ast D_i.
$$
In order to calculate quality and profit level in the Nash equilibrium, it is stated that the qualities are derived by the first order condition. The results are:
$$
q_i^*\ \ =\ \ p/c\ \ -\ \ t/3
$$
$$
\pi_i^*=ct/9
$$
I tried to derive the profit function by p and q, but I couldn't  make it to the stated results.
May the solution be quite straightforward, I can't think about it and would appreciate any kind of help!
Thanks in advance
KR
EDIT: For my understanding, the first order condition is the first derivative of the profit function that needs to set zero, what means the slope is zero. For identification, if its a minimum or maximum one need to evaluate the second derivative. I failed at the first derivative due to the summation sign. I know how to interpret it, but I don't know how to derive it. Following this, all I got is:
$$(d\pi)/dq = -c*(dD_i/dq)$$
EDIT: My recent solutions:
$$((d\pi)/(dq)) = (p-c*q)*(1/t)+(1/3+((2q-j)/(2t))*(-c)$$
$$ 0 \overset{!}{=} (p-c*q)*(1/t)+(1/3+((2q-j)/(2t))*(-c) $$
$$ q = (-3ct^2 + 6c-2t)/(6p-6ct^2) $$
Comment: Can you show what you tried to get an answer, and what result you got?
Comment: Sure! In fact that the first order condition is represented by the first derivative, I tried to derive the profit function by q. The problem is, that I don't know what to do with the summation sign. I know that its per definition just the sum of q_j + ... + q_J, excluding q_i. But what I don't know is, how this looks and how it gets derived. So my understanding ended with $$(d\pi/dq)=-c*D
Answer: Two things:
First, you should be differentiating $\pi_i$ with respect to $q_i$, i.e. find $\frac{\partial \pi_i}{\partial q_i}$, which means that all of the $q_j$ where $j \neq i$ will be treated as constant.
Second, your derivative is not quite right - remember that $(uv)' = uv' + u'v$, so in this case $\frac{\partial \pi_i}{\partial q_i} = (p - c q_i)\frac{\partial D_i}{\partial q_i} + D_i \frac{\partial}{\partial q_i}(p - c q_i)$.
Comment: Thank you so much! I added the derivative to the question (it doesn't get well formatted in the comment section). To get to the equilibrium, I tried to solve this equilibrium for q (added also to the question). But this solution is far away from the correct solution, so I still don't know were I made a mistake. Is it still the wrong derivative or is the whole approach wrong? In my understanding, the q* comes from solving the first derivative of the profit function by q. Then insert q* in the original profit function which yields to p*. I would very happy if you could comment again.

How to maximize q and pi?


Rotate $n$ points on circle with Lebesgue Measure

Question: Here is the statement I want to prove.

Suppose that $\mathbb{S}^1$ with the circular Lebesgue measure of $A$ satisfies $\mu(A)>1-n^{-1}$ and that $B$ contains at most $n$ points. Show that some rotation carries $B$ into $A$.

I believe this question should be done by induction. The case for 1 and 2 points are easy. For two points, suppose that $x_2$ cannot be in $A$ for any rotation. We can let $x_1$ traverse through $A$, then we create a disjoint measurable sets with the same measure as $A$, which contradicts $\mu(\mathbb{S}^1)=1$.
However, I find it pretty hard to generalize this idea to $n$ points. Since it really depends on which $n-1$ points should be assumed in $A$. Does anyone have any idea for this?
Thanks in advance!
Answer: Your solution for $n=2$ is already a good idea, but if you think about these things a little bit different, then it will be easier to generalize to higher $n$.
Hint:
The set of rotations on $\mathbb S^1$ is basically $\mathbb S^1$ itself.
We can also have the circular Lebesgue measure on the set of rotations.
What is the measure (probability) of the set of rotations such that $x_1\in A$
holds?
What is the measure of the set of rotations such that $x_1\not\in A$
holds?
If you solved these, then consider:
What can we say about the measure of the set of rotations such that
$x_i\not\in A$ for some $i$?
It should turn out that the measure for the opposite event (that all $x_i$ are in $A$) is nonzero, and thus the set of possible rotations is nonempty.
Comment: That's excellent! Thanks!


ZvP: Gateway aggro -> Phoenix -> Robo deathball: What went wrong?

Question: I'm a platinum zerg having trouble dealing with protoss lategame. Previously I always did
Stephano's 12:00 roach max, which worked most of the time, but now I want to learn to play standard. So now I'm at an impasse here with the protoss deathball. I just can't beat it. I think my scouting may be an issue here - I sometimes overreact or underreact.
Replay 1: click here
I sent a 10 drone scout, which saw a gateway expand, so I went 3 hatch before pool, with a 5:40 roach warren to defend timings.
When I saw multiple gateways in my opponents wall, I produced roach/ling to defend, but I think I overproduced and came out behind. How do I know how much defense is necessary to defend early-midgame gateway pressure? And if they don't attack, and just sit with there units, how do I know when I can start droning again? Or maybe in this scenario I should just keep producing units and trickle in the drones instead.
Anyways, I ended up defending my opponents gateway aggression with too many units left over, which soon became useless. I droned up my third once I dealt with the zealots. Since I saw robo units when I counterattacked, I went for an infestation pit and produced mass static defense for a transition to swarm hosts.
I've seen Catz defuse the deathball this way on his stream using swarmhost/spine/spore/viper/infestor/hydra, so I tried it too. I felt my lack of APM was a large factor in my loss. If I played faster I could have a lot more static defense ready, dealt with their harass and micro'd better against feedbacks, but this is platinum and nobody knows what they're doing.
I'm sure my opponent made a lot of strategic errors that I could have exploited, but I don't know where they are. APM will be developed the more I play, nothing I can do about that. In lieu of more APM, what strategic errors did my opponent make, and how do I recognize and exploit them?
Replay 2: click here
This game was against the same player, who went for the same opening again.
Gateway expand -> zealot pressure -> phoenix -> Robo deathball.
Here I tried roach/hydra into vipers, which failed miserably. Colossus just melted everything. What could I have done better?
Please don't tell me I need to brush up on my mechanics, that's pretty obvious. We had similar APM and I'm sure my opponent made a lot of strategic errors too, I just need to know where they are. Thanks for your replies.
Comment: if you made defending units and there is nothing to defend against then go attack, i.e. make that investment count by providing pressure so they can't use the downtime to drone up and beat you by economy
Comment: @ratchetfreak I did, but when I got to their base they had sentries and immortals to defend. I think my opponent probably would have gotten those sentries/immortals even if I hadn't counterattacked. I feel I damaged my economy doing this because their build stayed the same, while I made overmade units that did no damage - but I can't tell how many defending units (or accurately predict what composition) I need to make to defend early gateway pressure.
Comment: A friend of mine, good Zerg player, told me, in Zerg, allways try to delay your unit production. This is based on good creep and scout. With larva, you are able to produce like 30 or 40 unit in a row. This is the theory but, we can't deny that this is one of the zergs strength, be able to produce verry late according to opponent units.
Answer: How do I know how much defense is necessary to defend early-midgame gateway pressure?
Typically you don't make units until you see him move out.  An overlord sac will get you an idea for what he's doing (all-in vs pressure).  Making sure there are no hidden pylons on your side of the map is very important, because you need the time between his base and yours to make units.  Without this buffer, you're either making units blind or taking a risk, because you can't scout exactly how many units he has, and often it's difficult to scout exactly how many gateways he has.
Generally speaking you drone to about 55 on 3 bases.  If he doesn't take a third you should be extremely careful droning.  Most likely you can stop at 60 drones and make units until he has a third started.
Your ideal composition for dealing with the deathball is swarmhost(or roach)/hydra/viper.
You can use ling runby's and extra expansions to use up excess minerals.  2-4 overlord zergling drops in the main are extremely annoying and often very effective.
You should have a sizable supply advantage and maxed before 16 minutes, so that you can apply pressure and hopefully grab a few expensive units from him before he pushes out with 200/200.  Also, denying the 4th base is paramount
Hydralisk timings ~ 11:00 when he goes phoenix are very effective


Installing ubuntu from customized live CD

Question: So basically I modified an installation iso file. To be specific I added a kickstart file to it to automate the installation of ubuntu 14.04.1 i386, I modified the isolinux/txt.cfg file to make it use the kickstart file.
Now, to test the installation-script I started a virtual machine and booted the disc image. A lot of text popped up, checking the state of the machine. I quess the installation begins with casper, since that is the first thing that is clearly readable. Unfortunately it seems to check its file system on the floppy drive and gets stuck there, it repeatedly prints:
/init: line 7: can't open /dev/sr1: No medium found

Eventually it stops and I find myself in the BusyBox.
On launchpad.net people seemed to fix this problem by disabling the floppy drive.
Occasionally it didn't work for me, or I did it wrong.
My question is now: Is this a bug in casper or did I just fail to configure kickseed properly?
-- I should note, that I'm new to ubuntu and have basically no idea regarding partitioning in kickstart, might there be the problem?
ks.cfg located in /
#
#Generic Kickstart template for Ubuntu
#Platform: x86 and x86-64
#

#System language
lang en_US

#Language modules to install
langsupport en_US

#System keyboard
keyboard us

#System mouse
mouse

#System timezone
timezone Europe/Vienna

#Root password
rootpw --disabled

#Initial user (user with sudo capabilities)
user ubuntu --fullname "abc" --password abc

#Reboot after installation
reboot

#Use text mode install
text

#Install OS instead of upgrade
install

#Installation media
cdrom
#nfs --server=server.com --dir=/path/to/ubuntu/

#System bootloader configuration
bootloader --location=mbr

#Clear the Master Boot Record
zerombr yes

#Partition clearing information
clearpart --all --initlabel

#Basic disk partition
part / --fstype ext4 --size 1 --grow --asprimary
part swap --size 1024
part /boot --fstype ext4 --size 256 --asprimary

#System authorization infomation
auth  --useshadow  --enablemd5

#Network information
network --bootproto=dhcp --device=eth0

#Firewall configuration
firewall --disabled --trust=eth0 --ssh

#Do not configure the X Window System
skipx

txt.cfg located in /isolinux
default autoinstall
label autoinstall
  menu label ^Automatically Install Ubuntu
  kernel /casper/vmlinuz
  append  file=/cdrom/preseed/ubuntu.seed boot=casper initrd=/casper/initrd.lz ks=cdrom/ks.cfg –

Answer: I once had this problem when trying to boot Kubuntu from USB. I used the following workaround:

Create Lubuntu disk and boot it (which surprisingly worked)
Install Lubuntu and reboot
Go to TTY1 (Ctrl+Alt+F1) and login
Stop LightDM (sudo service lightdm stop) - just to be sure
Remove LXDE desktop: sudo apt-get purge lubuntu-desktop
Install KDE desktop: sudo apt-get install kubuntu-desktop
Remove packages remaining from LXDE: sudo apt-get autoremove
Reboot if there aren't any errors

I then had a stable, working Kubuntu on a system which was unable to boot from the kubuntu-13.10-i386 ISO.
You could give it a try, and use ubuntu-desktop instead of kubuntu-desktop, or whatever flavor you prefer. You could even try to automate this process in your script.


How can I clean a gas oven's cabinet of rodent debris?

Question: We found mouse droppings in the house and got a pest control company to use poison baits to get rid of it. We have cleared the house of the droppings. However, we found droppings in the gas oven bottom rack.
The access is very limited and we need some guidance on how to get it cleaned out well.
Comment: A vacuum with a small hose attached to the big hose should work.  Duct tape to the rescue.
Comment: If the openings the mice got into the house through were not fixed, you ***will*** have more mice. Poisioning and calling it solved is essentially setting you up to need pest control over and over on a repeating basis, forever.
Comment: Also, after physical cleaning, I'd recommend swabbing the area with diluted bleach (e.g., with a non-woven wipe stapled to a stick), then drying *thoroughly*. You might also sprinkle sodium bicarbonate (baking soda) on the bottom. It's non-poisonous, but irritating to little critters.
Comment: @DrMoishePippik Or just heat it up well before use. Inside an oven can get hot enough to sterilise surface contamination, no need for bleach in a place where you can't reach to rinse it off
Comment: I would not put sodium bicarbonate on metal parts because over time I think it would cause corrosion. I have heard that mice and rats cannot stand the odor of peppermint. You could put some peppermint extract on pieces of paper towel and lay in on the floor under the stove.  You could put snap traps under the stove before you try the peppermint.
Comment: Depends on if it was your outdoor cat's fault. And then it went and died in there. That's new stove time. You're lucky if it's just some droppings and they haven't been *living* in it. There's only one solution to *ungodly smell comes when I turn the oven on.* Because you can't break the unit down far enough to get to the inside of the inside.
Answer: Most oven doors can be removed through their hinges. See if yours can via looking up the instruction manual - I'm sure it can. Once removed you should have more room to navigate and clean after removing the grills.
A bottle brush, shoe brush and an old tooth brush are handy cleaning tools to have for such situations. I bought this combo below from Amazon which attaches to a vacuum. The brush is great too.
Once the debris is removed you can use a disinfectant spray
Comment: @crip659 Hantavirus I think
Comment: Depending on the location, western and/or south western US(?), the dust raised by brushing is not good for you, without a good mask.  Hava(something virus)/mouse virus.
Answer: Mouse droppings can spread disease, and you should be careful handling/cleaning them. Gloves are a must and many professionals would recommend using an N95 respirator when during cleaning to avoid inhaling particulate from the droppings.
It's unlikely that the poison will eliminate your problem. You may need to set traps and seal holes to ensure mice do not return.
However, as far as cleaning goes, the CDC has a decent guide: https://www.cdc.gov/healthypets/pets/wildlife/clean-up.html
Bleach is a good disinfectant in a 1:5 or 1:10 ratio. Follow the instructions on the product for disinfection, and make sure to use water to rinse bleach off any metal surfaces after the disinfection period to prevent damage.
As far as accessing the droppings, consider sliding your oven away from the wall. I'm not sure if you'll be able to slide the oven fully out, but it may allow for easier access to the space where the droppings are found, and you should inspect behind all your kitchen appliances and cabinets for holes that may need to be filled to prevent your intruders.


Calling MATLAB from a DLL

Question: I have a DLL written in C++ that is used to modify parameters in VISSIM (traffic simulator). Within this DLL, I would like to call MATLAB to send data, perform MATLAB functions, and return data to the DLL. This all occurs outside of an IDE as VISSIM calls the DLL as necessary.
I have (1.) a working DLL that properly modifies VISSIM parameters and (2.) a working .cpp program that opens the MATLAB Engine (these two programs are currently separate - independent of each other).
How can I combine these two programs so that I can call the MATLAB engine from my existing DLL? A simple copy-paste of the .cpp MATLAB engine program into the DLL did not work (I also modified the DLL project properties to include the necessary MATLAB libraries/directories/paths as is done in the .cpp MATLAB engine program properties).
Note: The .cpp MATLAB engine program builds successfully with 'stdafx.h', but when copied to the DLL and then built, I receive fatal error C1083: Cannot open include file: 'stdafx.h' Perhaps this is an issue?
Answer: This is an interesting dilemma as you would typically run MATLAB, or some other COM interface language, to control VISSIM which would load your custom DLL once a simulation begins.  In your case you want the DLL to run MATLAB after VISSIM has started with a simulation.
I think your best approach is to use the first approach, the standard way of communication, but have a decentralized data exchange.  One solution might be to have MATLAB start up VISSIM which will load the DLL when the simulation begins.  The DLL could send data to a database, XML file, text file or other data container.  MATLAB would need to monitor the data container for updates and send to VISSIM.  This would be a bit slow but should work.
I have another idea but it requires a little research.  Contact me if you would like to discuss.  I have have been actively developing solutions for VISSIM for the last seven months using MATLAB, R, C++, and C#.
Comment: Thanks for sharing your ideas. Since I am a beginner programmer, I am having difficulty with figuring out the interface architecture. A more detailed talk would be very helpful. Please see my profile for my email as I could not locate yours.

Calling MATLAB from a DLL


Rails connect to an 'external' sqlite database

Question: I am trying to connect to a database from my rails app. This database is being updated all the time for storing the results of ongoing tests. My rails app is basically a front-end to display the test results.
What is the best way to access the sqlite database without interfering with the test framework? At the moment when I start the rails server it locks the database and no read/write is allowed to it while the server is running.
What is the best way to display results from a continuously growing database, where new records are not being added by the rails app itself? Thanks for your help!
Answer: You should consider using another database engine, such as MySQL or Postgres. SQLite is a good RDBMS but does not fit well for high-concurrency scenarios. It has been designed mainly for desktop or device-embedded applications.
From http://www.sqlite.org/whentouse.html

SQLite uses reader/writer locks on the entire database file. That
  means if any process is reading from any part of the database, all
  other processes are prevented from writing any other part of the
  database. Similarly, if any one process is writing to the database,
  all other processes are prevented from reading any other part of the
  database.
Comment: I finally migrated to Postgres and it solved my problems, thanks for your reply Jef.


Excel VBA for opening a file with a date in the filename that changes

Question: I have an Excel file that is created every day, named "three day outlook 7-7-2014. The date changes every day, but the files are stored by day in a folder, so I have multiple files named "three day outlook" but with different dates.
I am trying to use VBA code to open certain files by date that are selected by a date selection on another Excel sheet. I have tried the following:
Workbooks.Open Filename:=("C:\Users\sdfe\Documents\three day outlook" & Cells(D3).xlsx)

Answer: Try the following:
Workbooks.Open Filename:="C:\Users\sdfe\Documents\three day outlook " & Range("D3") & ".xlsx"

According to your question, there's a space character between the word "outlook" and the date. I assume the date is formatted on the sheet with the correct format. In fact, it might be better to show a message box with the path to the file you're trying to open. Something like:
MsgBox """C:\Users\sdfe\Documents\three day outlook " & Range("D3") & ".xlsx"""

and make sure this string is properly constructed before you use it.
Update (following your comment below):
Since your date is formatted as "7/7/2014" and not as "7-7-2014", there's a couple of things you can do:

Format the cell where the date is (D3) as Text, so that it gets entered as you like and doesn't change by the date formatting.
Format the cell where the date is (D3) with a Custom format of d-m-yyyy and then above, instead of Range("D3") use Range("D3").Text.
Keep the cell formatting as Date (as I assume it is), and then above, instead of Range("D3") use Format(Range("D3"), "d-m-yyyy").
Comment: Thank you both for the quick response.
Comment: Dijikay you are correct the path name is using a date range of 7/7/2014 instead of 7-7-2014. I have changed the format in excel and no luck. Do i need to change something in vba?
Comment: @user3146807: Now that you are happy with the result, please consider checking the tick mark on the left to accept the answer and let others know this was a useful and helpful answer.
Answer: Use the format function so that you always know what the date will appear like.  Everyone will have a different date format set on their computer.  And you never know if the computer just sends the date as just a number instead of a date.


Git log exclude cherry pick messages for trailers

Question: Say you have this commit log:
commit fj9823jf982j3f9j8ydf89j
Author: Bob <firstname.lastname@example.com>
Date: Today

    subject

    message

    Signed-off-by: Bob <firstname.lastname@example.com>
    Acked-by: Alice <email@example.com>

commit 978uwf98jwef89jewf98jf98
Author: Alice <firstname.lastname@example.com>
Date: Today

    subject

    message

    Signed-off-by: Alice <firstname.lastname@example.com>
    Acked-by: Bob <firstname.lastname@example.com>

    (cherry picked from commit 7823487234u82398rua)

If I'd like to show only the trailers, I'd normally use something akin to git log --format="%(trailers)", which in this case would give me:
Signed-off-by: Bob <email@example.com>
Acked-by: Alice <email@example.com>

(cherry picked from commit 7823487234u82398rua)

Thereby only reading the trailers from the first commit, but not from the second, apaprently due to the cherry pick message.
Effectively this means that, if a cherry pick message is present in a commit message, the other trailers can not be read.
Is there a way to have git ignore the cherry pick messages when parsing the trailers?
Comment: The trailers are the stuff before the last blank line, and the `cherry-picked from` is the only thing there, so that's the only part that could *be* a trailer (and then it has the wrong format). I don't think there's currently a way to get Git to "scroll back past" the added cherry-pick line. There probably should be; consider making a request on the Git mailing list.
Comment: Thanks, there really does not seem to be any way for this. Seems like quite an inconsistency for me if a native git-tool can't parse something made natively in Git.
Answer: It's correct that if you have this commit message:
commit fj9823jf982j3f9j8ydf89j
Author: Bob <firstname.lastname@example.com>
Date: Today

    subject

    message

    Signed-off-by: Bob <email@example.com>
    Acked-by: Alice <firstname.lastname@example.com>

    (cherry picked from commit 7823487234u82398rua)

Then this will give no output:
cat b.txt | git interpret-trailers --only-trailers

And nor will (assuming that HEAD is on this commit):
git log -1 --format='%s%n%n%b' | git interpret-trailers --only-trailers

So that's the end of the story for all commits which have that
cherry-picked-from line after the trailer section.
But note that revision 967dfd4d568c (sequencer: use trailer's trailer
layout, 2016-11-02)[1] taught git cherry-pick -x to respect the
trailer section, if it exists:

Make sequencer use trailer.c's trailer layout definition, as opposed to
parsing the footer by itself. This makes "commit -s", "cherry-pick -x",
and "format-patch --signoff" consistent with trailer, allowing
non-trailer lines and multiple-line trailers in trailer blocks under
certain conditions, and therefore suppressing the extra newline in those
cases.

This means that now (I'm on git version 2.39.2) if you have this commit:
commit fj9823jf982j3f9j8ydf89j
Author: Bob <firstname.lastname@example.com>
Date: Today

    subject

    message

    Signed-off-by: Bob <email@example.com>
    Acked-by: Alice <firstname.lastname@example.com>

Then a git cherry-pick -x will give you a commit which looks like:
commit fj9823jf982j3f9j8ydf89j
Author: Bob <email@example.com>
Date: Today

subject

message

Signed-off-by: Bob <firstname.lastname@example.com>
Acked-by: Alice <email@example.com>
(cherry picked from commit 78ddce1507732a604913542989c856f15a8d6d88)

And with git interpret-trailers:
$ git log -1 --format='%s%n%n%b' | git interpret-trailers --only-trailers
Signed-off-by: Bob <email@example.com>
Acked-by: Alice <email@example.com>

(Omits the cherry-picked-from line)
With --format=[…]:
$ git show --format='%(trailers)' @
Signed-off-by: Bob <email@example.com>
Acked-by: Alice <email@example.com>
(cherry picked from commit 78ddce1507732a604913542989c856f15a8d6d88)

Behavior according to the test suite[2]

git-cherry-pick -x will add a blank line before the -x line if
there is no trailer section ("cherry-pick -x inserts blank line when conforming footer not found")
git cherry-pick -x -s will add the cherry-pick line and the
signed-off-by line in that order inside the existing trailer section
("cherry-pick -x -s adds sob when last sob doesnt match
committer")
"cherry-pick -x treats "(cherry picked from..." line as part of footer"

Notes

Merged in: 8b0db484e11a (Merge branch
'jt/use-trailer-api-in-commands', 2016-12-19)
All on tag v2.40.0


Can I have hooks in a Joomla component? How?

Question: I need to add a hook in onUserAfterDelete to when the admin deletes an user his customer info (managed by my component) goes away too.
How can I do that? Where I put the function?
Thanks a lot!
Answer: Basically you need to create a plugin, which will be independent of the component itself.
You need:

manifest file
plugin itself as a .php file - here you will implement the method onUserAfterDelete.

Some code to start with is already in another related answer.
Comment: There's no way to make this inside the component, I'm right?
Comment: It needs to be a plugin. But you can ship everything together in a package.
Comment: There are post save hooks. I don't know if there are post delete hooks everywhere but they are some places. So you can use those too. But plugins are great also.
Comment: Hello, i try with the code in the answer but only works if is in front end.. is there an aditional setting o code to get it working on backend'?
Comment: Please ask on Joomla.stackexchange.com


How to open Minecraft_Server.jar?

Question: When I downloaded minecraft_server1.8.8.jar I couldn't open it by double clicking on it, nothing would happen.
I tried opening the eula.txt file and changed eula=false to eula=true so I'm still confused as to why it doesn't work.
What do I need to do to open the minecraft_server.jar file?
Comment: Possible duplicate of [How do I open minecraft.jar?](https://gaming.stackexchange.com/questions/146268/how-do-i-open-minecraft-jar)
Comment: "How to open a jar file" is not specific to Minecraft in any way, making this question off-topic.
Comment: I'm voting to close this question as off-topic because the problem is not specific to gaming.
Comment: You can't open/run jar files like that (unless its part of your path variable). To open it, you need a program like 7zip or winrar. You can looked at the pacakged contents (although they are just compiled code so its all nonsense).  To actually use it, there is a special command, @Aequitas has that in his answer. In general, to run jar files though you can simply go to your cmd and type cd locationOfFile, then java -jar filename.jar
Answer: jar files need to be open with Java;

Windows
Go to the folder that the .jar file is located. Then push alt+D type in cmd and hit Enter. This will open cmd.exe with the location set to the correct spot, otherwise you could change directory with the cd (directory) command.
Now just type in java -jar minecraft_server1.8.8.jar and hit Enter to open the file.

Linux
Open the Terminal: Applcations > Accessories > Terminal. and then change directories to where the Minecraft server jar is located with the cd command. Then type in java -jar minecraft_server.jar

Additional arguments:

You can add no gui to the end of the command to open the server without the GUI
You can specify the initial and maximum memory allocation pool for the Java Virtual Machine by adding -Xms500M and -Xmx1G between java and -jar. You can change the size (the 500M and 1G parts) to whatever you like. The default value for xmx is 256MB, if you encounter a java.lang.OutOfMemoryError you may need to increase xmx when you start it with this command line.
Comment: You know, "no gui" is not correct. `nogui` it has to be.
Comment: @Minecraft sorry I had a typo, it should be an `_` not a `.` I've edited my answer
Comment: mine opens as a text file any help?
I tried everything

How to open Minecraft_Server.jar?


How can i do this better using Ninject IOC

Question: the concept is quite popular but I have not found the answer yet.
I have the following class structure
public interface IMessage
{
}

public class MessageA : IMessage
{
}

public class MessageB : IMessage
{
}

public interface IMessageHandler<T>  where T : IMessage
{
    void Handle(TMessage message);
}

public interface MessageAHandler : IMessageHandler<MessageA>
{
}

public interface MessageBHandler : IMessageHandler<MessageB>
{
}

public class MessageProcessor
{
    public void Process(IMessage)
    {
        if (IMessage is MessageA)
        {
            // handler for messageA has to be invoked
        }
        else if (IMessage is MessageB)
        {
            // handler for messageB has to be invoked
        }
    }
}

Now I am using Ninject and dooing my bindings like
Bind<IMessageHandler<MessageA>>.To<MessageAHandler>();
Bind<IMessageHandler<MessageB>>.To<MessageBHandler>();

I want to do all the binding magic somehow in the binding module for choosing the handler. MessageProcessor class should just be passed something which it calls to handle the message.
What this something is and how it can be done in the binding module is what i cannot figure out. Can someone please help!
Thanks
Comment: how are you injecting types on the `MessageProcessor` class?
Comment: constructor injection using ninject. code has been omitted due to NDA constraints
Answer: Use the ninject conventions extension https://github.com/ninject/ninject.extensions.conventions, select all types inheriting from typeof(IMessageHandler<>) and then use a custom IBindingGenerator implementation. For example:
        this.Kernel.Bind(x => x
            .FromThisAssembly()
            .IncludingNonePublicTypes()
            .SelectAllClasses()
            .InheritedFrom(typeof(IMessageHandler<>))
            .BindWith<MessageHandlerBindingGenerator>());

And at the Binding Builder use reflection to create the specific interface type IMessageHandler<XYZ> and use it like this.Kernel.Bind(interfaceType).To(type).
I can provide a complete implementation if you wish.
Okay i tried to keep it as simple as possible, if there is anything more complicated that you really need, then please tell me:
public interface IMessage { }
public class MessageA : IMessage { }
public class MessageB : IMessage { }

public interface IMessageHandler<T>
    where T : IMessage
{
    void Handle(T message);
}

public class MessageHandlerA : IMessageHandler<MessageA>
{
    public void Handle(MessageA message)
    {
        Console.WriteLine("Message A handled");
    }
}

public class MessageHandlerB : IMessageHandler<MessageB>
{
    public void Handle(MessageB message)
    {
        Console.WriteLine("Message B handled");
    }
}

public class MessageProcessor
{
    private static readonly MethodInfo GenericProcessMethod = typeof(MessageProcessor).GetMethod("ProcessGeneric");

    private readonly IResolutionRoot resolutionRoot;

    public MessageProcessor(IResolutionRoot resolutionRoot)
    {
        this.resolutionRoot = resolutionRoot;
    }

    public void Process(IMessage message)
    {
        GenericProcessMethod.MakeGenericMethod(message.GetType())
            .Invoke(this, new object[] { message });
    }

    public void ProcessGeneric<TMessage>(TMessage message)
        where TMessage : IMessage
    {
        var handler = this.resolutionRoot.Get<IMessageHandler<TMessage>>();
        handler.Handle(message);
    }
}

public class Test
{
    private readonly IKernel kernel;

    public Test()
    {
        this.kernel = new StandardKernel();

        this.kernel.Bind(x => x
            .FromThisAssembly()
            .IncludingNonePublicTypes()
            .SelectAllClasses()
            .InheritedFrom(typeof(IMessageHandler<>))
            .BindSingleInterface());
    }

    [Fact]
    public void IntegrationTest()
    {
        var messageProcessor = this.kernel.Get<MessageProcessor>();

        messageProcessor.Process(new MessageA());
        messageProcessor.Process(new MessageB());
    }
}

(the [Fact]  attribute comes from xUnit which i use to run the test.)
I left out the interface IMessageAHandler : IMessageHandler<MessageA> etc. interfaces, do you really need them? They make things more complicated. Either for the binding generator or the it gets more complicated to determine the type the message processor needs to use.
Comment: that would be awesome please


XMLHttpRequest returns zero in popup extension

Question: Trying to download a page in a popup code but it returns status of zero.
console.log("Req");
var req = new XMLHttpRequest();
req.open(
    "GET",
    "http://www.google.com",
    true);
req.onload = function() {
  console.log("DONE!!!");
  console.log(req.responseText);
}
req.send(null);

I did set this in my manifest:
"permissions": [
   "http://www.google.com"
]

Whats wrong? Why the response is zero?
Answer: Google.com is not the best page for testing. I bet when you open it in a browser it redirects you to your localized google page (it redirects me to http://www.google.ca for example). So you would need to add that redirected url to the permissions as well.
Another problem is that your permission domain does not end with /:
"permissions": [
   "http://www.google.com/",  "http://www.google.ca/"
]


Clear item player holding with mouse

Question: If you open your inventory and then hold an item, for example a diamond, with your mouse (when you want to move the item in your inventory you can grab it with your mouse to move it)...
If you do /clear @a while a player is holding an item with their mouse, the item the player is holding doesn't get removed. I also tried to do /kill @e[type=minecraft:item] but the item still doesn't get removed.
Is removing the item even possible?
I'm playing in 1.16 (snapshot 20w22a)
Answer: The reason why /clear doesn't work in your tests is because you're in Creative Mode. /clear only affects the grabbed item in GUIs if the user is in Survival or Adventure Mode.
Try switching to Survival mode before attempting /clear using a command block.
If you need to get it done to players in Creative, you're out of luck. Sorry.

Clear item player holding with mouse


How would I delete records after a certain time based on the value of a specific field?

Question: I've got a table called users.  Two of the fields in that table are "activation" and "regdate".  Both are VARCHAR.  The activation field contains the string "active" if the user has activated the account.  If the user has not activated the account, the field contains a string which is a randomized alphanumerical activation key.  The regdate field contains the date and time that the user registered the account, populated by date("m.d.y H:m:s");.
What I need to do is create a PHP script which will delete all records that do NOT equal "active" in the activation field and are older than an amount of time that I specify.  I know how to locate records by matching criteria such as selecting records where activation equals "active", but I would need it to do the opposite.  I would need it to match all records where activation does not equal "active" (because the randomized string would be impossible to match, would it not?).
Of course, I would then have to also compare the selected records to the current time based on those records' "regdate" field.
So, in short, I've got a bunch of records and I want to delete all of the ones that are older than a certain amount of time and have a field that does NOT equal "active".
I apologize if I did not explain this well enough.  I'm really tired, and this is also my first post on stackoverflow.
Comment: Why isn't the regdate field stored as a `datetime` field in your DB? That will make querying it much simpler.
Comment: are you wanting to run this as a cron job?
Comment: Oh yes, I will be running it as a cron job.  I forgot to mention that.  What would be your recommended interval for the job to run?  Do you think hourly would be appropriate?
Answer: If you convert your regdatefield into a DATETIME type, the query can be as simple as:
DELETE FROM users WHERE activation <> 'active' AND regdate < '2011-01-01'
Otherwise, depending on the format of your regdate VARCHAR,you'llhave to CAST or CONVERT it to a DATETIMEbefore comparing it in your WHERE clause.
Is this enough infoforyou togetthisworking?
Comment: That '<>' you showed me in that code snippet was exactly what I needed.  I wasn't sure how to check an inequality in a MySQL query.  I suppose changing the field to a 'DATETIME' type would be the most appropriate.  I hope it will store it as 'mm.dd.yyyy' instead of with year first, though.  Anyway, I will try this.  Thank you.
Comment: @Ronnie: Don't worry how the database itself stores `DATETIME`, it's kind of irrelevant, because as long as it understands it's a date, you can format it any way you want via the `DATE_FORMAT()` function (in MySQL). Most DB engines will default date display and input as `YYYY-MM-DD hh:mm:ss` because it's universally recognised.
Answer: Change your field in the database to "datetime" using mysqladmin should be a breeze ( the data would look something like this "2011-09-13 02:08:20") then you could use standard mysql commands like:
mysql_query("DELETE   FROM `iplog` WHERE  DATE(datefield)  <= DATE_ADD(CURDATE(), INTERVAL -2 DAY) AND activation <> 'active'");

this is deleting anything older than 2 days in my 'iplog' table and not active.


Bosch Dual Fuel Range - blew fuse when moving appliance

Question: We recently purchased and installed a Bosch Dual Fuel Range. We pulled it out from against the wall just enough to get behind it and install a backsplash. When putting back in place there was a blue spark from behind the range then a fuse blew.
We attempted two more times to put it back in place with the same result; blown fuse, circuit reset, blown fuse. Now wondering what our next move should be?
Answer: So you have to now move it out further and find out which connection has come loose.
Based on the comment: turn off the supply before doing any work or moving it again.
Make sure that the wire is put back in the correct position.
Also make sure all the terminals are correctly tightened.
Comment: With huge sparks it's probably wise to turn off the gas source as well, while investigating the electrical problem. There obviously some sort of flexible gas line connection, and every time the stove's moved in and out, you're flexing it, creating an _ever so slight_ chance of a leak. You don't want big boom in the house.
Comment: Turning off the breaker first might help also before moving/checking the connections.


New bathroom fan has a 2 prong plug. Old fan was straight wired. How do I convert?

Question: My new exhaust fan has a 2 prong plug, my old fan was straight wired so I don't have a receiver. How do I convert to straight wire?
Comment: What make/model fan?
Comment: What country are you in?
Comment: Can you post the instructions that came with the fan?
Comment: Nutone model C350BN * C370BN
Comment: The instructions just explain how to install the fan into the ceiling. The only comment about wiring says, "plug in the motor".
Comment: There are 2 separate wires which are wired into the plug. Without cutting the plug off I can't tell if there's any difference between the two.  The coating is gray on both.
Comment: Which side of the plug has a wider prong? That side is supposed to be neutral, while the narrower one is hot.
Answer: I looked up your fan and this is a picture of it...

It sounds like you just have some romex wire hanging from the ceiling and no outlet to plug the fan into. The wire you see is called romex. This is a large white cable with three wires inside it, Black, white and a naked copper ground wire. These wires should already be stripped but you might want to cut off about 6 more inches of the romex casing to give you some extra room for the ground wire. You can clip off and re-strip the black and white wires, as they will be too long. Cut off the existing plug on the new fan. You will need to strip the wires back. Attach the two wires from the fan to the black and the neutral wires of the romex using wire nuts. That is an Supco SM55OP2 motor equivalent, so both blades on the plug will be the same size. Polarity doesn't matter on these. Finally, attach the ground wire to the frame of the fan with a screw in the provided screw hole. You can also use a self-tapping screw if you have one. Here is a diagram to help you...
Comment: Ah, so you're making the NM-to-cordage splice inside the fan housing I take it?
Comment: Yes, I rebuilt 135 of these fan motors this way in our hotel.


How can I configure PHP with my Tomcat

Question: I have installed tomcat succesfully but if I want to use some php code. So where should I put this php code in my tomcat directory and how I can configure php with tomcat. Any suggestions or link will be appreciated..
Answer: Tomcat is a Java Servlet Container first - it wasn't built to run PHP natively. There are however adapters, which allow you to run PHP on Tomcat, e.g.

http://php-java-bridge.sourceforge.net/doc/tomcat6.php

If you only need to run PHP, you might be better off using a LAMP like setup.
Answer: PHP/Java bridge as mentioned in the other answer is one option. The other would be to use the PHP runtime built in Java called Quercus
Comment: The internet never ceases to amaze me.
Comment: Quercus is an amazing tool to integrate PHP and java. And it can run PHP faster than Apache.

How can I configure PHP with my Tomcat


Pandas get all rows by max values for the second index

Question: I'm trying to get the row with highest frequency. I counted the frequency of which department each user go to, but now I need to associate each user to a department they frequent which would be the two index columns department and department_id.

-Edit
Please forgive my stupidity. This drop box is a link to the csv file.
https://www.dropbox.com/s/ttnmraxptpcw61c/user_department_freq.csv?dl=0
Comment: No, no, no, do not post your data as image...
Comment: right, I'm going to post the dataframe as a csv,
Answer: You can do sort_values, the groupby with tail
s=df.sort_values('order_id').groupby(level=0).tail(1)


Touch pad not working Ubuntu 14.04

Question: Touch pad stopped working after installing Ubuntu 14.04 while it was working on Windows 8.
I tried to install by using the following command:
sudo apt-get install synaptics

it displays the message:
xserver-xorg-input-synaptics is already the newest version.

I have a dell inspiron 3451 laptop
Please suggest.
Comment: What is your hardware?
Comment: Related: http://askubuntu.com/questions/592925/dell-inspiron-3551-unresponsive-touchpad/632570?s=1|1.5510#632570
Answer: You could remove the touchpad and then re-install.  Sometimes that fixes issues like that.
See if it's listed on xinput with
xinput list

If it is, check to see if it's enabled or not.
If it's not on the list, then uninstalling and reinstalling the drivers with apt-get seems to be the best option, given I don't know your hardware specs.
What laptop do you have, and what type of touchpad?
Comment: @LorWem That means the device is recognized, but it's not working properly.  Try uninstalling and reinstalling the drivers for it if you're having any issues.  [If you just want to temporarily disable it, you can do xinput disable 14, and then it'll be disabled until you restart your system.]
Comment: Well when  I type :  xinput list  , it shows :
↳ SynPS/2 Synaptics TouchPad               id=14 [slave  pointer  (2)]

Touch pad not working Ubuntu 14.04


Adding a series of numbers through input

Question: I want the numbers to add but only in between the leaders designated. For example if letters B and E are inputed i want 630 to be outputted. I want it to add from B all the way to E, but not including E. So the program would add (140+125+365), it doesn't include the last number. Another example would be if C and G are inouted it would output 125+365+250+160).
System.out.println("enter location 1");
        String location1=in.nextLine();
        System.out.println("enter location 2");
        String location2=in.nextLine();
if (location1.equalsIgnoreCase("a"))

        {
         sum +=450;
        }
        else if (location1.equalsIgnoreCase("b"))
        {
            sum+=140;
        }

        else if (location1.equalsIgnoreCase("c"))
        {
            sum+=125;
        }

        else if (location1.equalsIgnoreCase("d"))
        {
            sum+=125;
        }
        else if (location1.equalsIgnoreCase("e"))
        {
            sum+=365;
        }
        else if (location1.equalsIgnoreCase("f"))
        {
            sum+=160;
        }
        else if (location1.equalsIgnoreCase("g"))
        {
            sum+=380;
        }
        else if (location1.equalsIgnoreCase("h"))
        {
            sum+=235;
        }
        else if (location1.equalsIgnoreCase("j"))
        {
            sum+=320;
        }
        else if (location1.equalsIgnoreCase("k"))
        {
            sum+=0;
        }

    if (location2.equalsIgnoreCase("a"))

        {
         sum2 +=450;
        }
        else if (location2.equalsIgnoreCase("b"))
        {
            sum2+=140;
        }

        else if (location2.equalsIgnoreCase("c"))
        {
            sum2+=125;
        }

        else if (location2.equalsIgnoreCase("d"))
        {
            sum2+=365;
        }
        else if (location2.equalsIgnoreCase("e"))
        {
            sum2+=250;
        }
        else if (location2.equalsIgnoreCase("f"))
        {
            sum2+=160;
        }
        else if (location2.equalsIgnoreCase("g"))
        {
            sum2+=380;
        }
        else if (location2.equalsIgnoreCase("h"))
        {
            sum2+=235;
        }
        else if (location2.equalsIgnoreCase("j"))
        {
            sum2+=320;
        }
        else if (location2.equalsIgnoreCase("k"))
        {
            sum2+=0;
        }

Comment: Stack overflow is NOT a homework writing service! When you're asking professional and enthusiast programmers to solve your problem, you need to state which part of it isn't working as expected and why, and state what you have done to solve the problem already. What is your actual question?
Comment: Holy s*** you are going to love it when you discover maps as a data structure.
Comment: NEVER show any more code than is required to reproduce the problem if you want help.
Comment: I said that whenever i would input C or E it would just be C and E not D as well. I have over 500 lines in this program and this one part isn't working. I can show you the rest if you would like. And it isn't homework either.
Comment: Also, I see "_I want it to add from B all the way to E, but not including E._" which I read as meaning you want to add b + c + d but then you say it should be b + c + e. Which is it?
Comment: This isnt all the code, its just the problematic zone that I'm having trouble with.
Comment: No i gave another example of C+G not C+E so it might be easier to understand. I want it to pull all the numbers between the two but not including the location of the 2nd location.
Answer: An if statement only executes the branch where the condition is true. If you enter 'd', then only the else if (location2.equalsIgnoreCase("d")) is true and only that number is added. If you want all numbers "between" two letters, you could first treat the letters as chars, then have a loop from the lower to the higher one, and add whatever numbers you have for each.
As @Takendarkk said, a map would probably be helpful. Here I'd use a linked map (preserves order).  Here is some untested pseudo code:
import java.util.LinkedHashMap;
import java.util.Map;

// ...

LinkedHashMap<Character, Integer> valuePerCharacter = new LinkedHashMap<>();
valuePerCharacter.put('a', 450);
valuePerCharacter.put('b', 140);
// ... and so on...

int sum = 0;
for (Map.Entry<Character, Integer> e : valuePerCharacter.entrySet()) {
    if (e.getKey() >= location1 && e.getKey() < location2) {
         sum += e.getValue();
    }
}

Comment: for your methods, like getValue and getKey what would go inside those methods? Would I just make a seperate class and just make a getValue and getKey methods getting the number and letter of each input?
Comment: `getKey` and `getValue` are methods of `Map.Entry`. You don't need to write them, just use them. Just import `java.util.Map`.
Comment: It says that e.getKey is undefined for the type integer, but e.valuePerCharacter.values()) only works with integer in front of it, any ideas?
Comment: Well, it was meant as pseudo code... I've updated my answer to real code.


Ubuntu screen error when starting

Question: I got this error each time I start Ubuntu
I use Ubuntu 20.04 and Kernel 5.4.0

This is the output of lspci -k | grep -EA3 'VGA|3D|Display' command
Comment: Please [edit] your question and add output of `lspci -k | grep -EA3 'VGA|3D|Display'` terminal command.
Comment: @Pilot6 I added the output of lspci -k | grep -EA3 'VGA|3D|Display' command in the terminal
Answer: Install Nvidia drivers by
sudo ubuntu-drivers autoinstall

Ubuntu screen error when starting


annotation Nullable in context class

Question: It's been a few days at Android Studio 3.5.3 make a problem , the source code of Activity class and ParentClasses of this class (ContextThemeWrapper ,ContextWrapper and Context class) is been red
the messages error of this problem are like:
<code>Cannot resolve symbol android.annotation.nullable is not public in Android.annotation ...
</code>

Please help me
ever resolve of this problem that was said in sites , I tried it
but cannot resolve this problem.
Comment: try   Invalidate Caches/Restart.. maybe it will solve your issue..
Comment: I had done this before, but the problem didn't work out
I even did the project Clean project / Rebuild project  several times but it didn't work out
Comment: Can you add the full logs from the build, after Invalidate Cache / Restart?
Comment: after Invalidate Cache / Restart , the side of all log of build is a green tick but in side of this log that write blow is Prohibited sign
:app:preDebugAndroidTestBuild
:app:compileDebugAndroidTestAidl                                                                                :app:compileDebugAidl
:app:compileDebugRenderscript                                                                                :app:compileDebugAndroidTestRenderscript
Answer: On Android Studio, go to File > Invalidate Cache / Restart.
That should fix your issue.
Comment: I had done this before, but the problem didn't work out

annotation Nullable in context class


How to prove that a monic integer polynomial with a prime constant term $p$ is irreducible over $\mathbb{Q}$ when $p>1+|a_1|+...+|a_{n-1}|$

Question: Let $p$ be a prime, let $n\in \mathbb{N}$, and let $a_1,...,a_{n-1}\in \mathbb{Z}$ such that $p>1+|a_1|+...+|a_{n-1}|$.
Show that the polynomial $f(x)=x^n+a_{n-1}x^{n-1}+...+a_1x+p$ is irreducible over $\mathbb{Q}$.
Any ideas?
Thanks!
Answer: Assume that $ f $ is reducible, and by Gauss' lemma, wlog assume the factors are monic and in $ \mathbf Z[X] $. Then, since $ p $ is prime, one of the factors would have to have constant term $ \pm 1 $, and thus $ f $ would have to contain a root $ |\alpha| \leq 1 $ in $ \mathbb C $. But then,
$$ f(\alpha) = \alpha^n + a_{n-1} \alpha^{n-1} + \ldots + p = 0 $$
$$ p = |\alpha^n + a_{n-1} \alpha^{n-1} + \ldots + a_1| \leq 1 + |a_1| + \ldots + |a_{n-1}| $$
which is a contradiction.


How do you download a Xbox 360 games to a PC via a usb cable?

Question: I have Fallout: New Vegas for my Xbox 360 and would like to transfer it to my desktop
Comment: Most games have completely different versions for Xbox and for PC.  I'm not certain whether F:NV is one of those games, but I wouldn't hold my breath.
Comment: I highly doubt this is possible in any legal sort of way, but then again hte world has surprised me before.
Comment: While the game will most likely not work on a pc, I suspect there are other reasons as to why you want to do this. I myself have no idea how to do it but I can bet it is definitely possible. Maybe not through a usb but some other device. If you are trying to transfer from a physical disk then it would be even easier to burn it from that to a regular blu-ray or cd disk. Whichever would have more space.
Answer: You can't do this.
The Xbox 360 version of the game is a different piece of software to the PC version so even if you did manage to copy or read the disk on a PC, you'd need to somehow emulate a 360 (not really possible for AAA games yet, at least not without a monstrous PC).
If you want to play Fallout on your PC, you'll have to buy the PC version.


How can I prevent interrupts stepping out from my code while debugging?

Question: I'm currently debugging the linux kernel and it's properly set up with kgdb.
I set a breakpoint to a function I am trying to debug, and the break occurs once I run my program which needs this kernel function to do something, this is wanted. But whenever I try to step through the code with "n" or "si", I always immediately land in arch/x86/include/asm/apic.h, which then runs some interrupt handling code and timers. I'm aware of the kernel being heavily parallelized so it has to move into some other code while being executed, but is it possible to step through the function more comfortably?
What I want to achieve:
before:
-> line A
line B
after:
line A
-> line B
What I have right now:
before:
-> line A
line B
after:
line A
... jumps into way different code here
Comment: Set a breakpoint on line B and *continue*?  Ugly, but at least workable.
Answer: I think it's hard. Let's think if the interrupts are all aborted, then how can you put your order by keybord or mouse?


Is this sufficient to prove the associativity of natural number addition?

Question: This question is regarding the same proposition as is discussed in How should this proof of the associativity of natural number addition be understood?
Here I wish to ask if a much simpler proof than that provided by the book would suffice. We begin with the same starting point as in the other question:
A previously demonstrated result is:
\begin{equation}
\left(a+b\right)+c=a+\left(b+c\right). \tag{1}
\end{equation}
The following is quoted from The Fundamentals of Mathematics, Volume 1:

By (1) we may therefore omit the parentheses in a sum of three terms.
  In order to be able to omit them in sums with more than three terms,
  we first define the expression $\sum_{i=1}^{n}a_{i}$ for a given
  sequence $\left\{ a_{i}\right\} _{i=1,2,\dots}$ of numbers $a_{i}$
  recursively by setting
\begin{equation}
\sum_{i=1}^{1}a_{i}=a_{1},  \sum_{i=1}^{n+1}a_{i}=\sum_{i=1}^{n}a_{i}+a_{n+1};\tag{2}
\end{equation}
[$\dots$] In particular, we have $\sum_{i=1}^{3}a_{i}=\left(a_{1}+a_{2}\right)+a_{3}=a_{1}+a_{2}+a_{3}$ and $\sum_{i=1}^{4}a_{i}=\left(a_{1}+a_{2}+a_{3}\right)+a_{4},$ for which we again naturally write $=a_{1}+a_{2}+a_{3}+a_{4}.$
[$\dots$]

Can we not simply proceed as follows?
Assume
$S_n=\sum_{i=1}^{n}a_{i}=a_{1}+a_{2}+\dots+a_{n} \text{, and }S_n\in{\mathbb{N}}.$
Then argue
$S_{n+1}=\sum_{i=1}^{n+1}a_{i}=S_n+a_{n+1}=a_{1}+a_{2}+\dots+a_{n+1}.$
Or even more simply by omitting the $\sum$ notation entirely, and argue that the result of the $n^{th}$ iteration is a natural number $S_n$ to which we apply the "we again naturally write" transformation in the $n+1^{th}$ step.
Will this not work?  If not, why not?
It may be the case that the author's of the book chose to do things the hard way to illustrate new concepts.

To address the specific question in the comments: what about $\left(a+b\right)+\left(c+d\right)$?
 I came up with this using the notation I invented to work on this problem:
Define the set of function:
$$
\Phi=\left\{ \varphi_{a\in\mathbb{N}}:\mathbb{N}\to\mathbb{N}\backepsilon\varphi_{a}\left[x^{\prime}\right]\equiv\varphi_{a}\left[x\right]^{\prime}\land\varphi_{a}\left[1\right]\equiv a^{\prime}\right\} .
$$
To relate this to conventional notation we also define
$$
\left[\_+\right]:\mathbb{N}\to\Phi
$$
so that
$$
\left[a+\_\right]\equiv\varphi_{a},
$$
to be interpreted as
$$
a+b:\mathbb{N}\times\mathbb{N}\to\mathbb{N}\text{ where }a+b\equiv\varphi_{a}\left[b\right].
$$
$$
\left(a+b\right)+c=\varphi_{a}\left[b\right]+c=\varphi_{a+b}\left[c\right]=a+b+c.
$$
$$
\left(a+b\right)+\left(c+d\right)=\varphi_{a}\left[b\right]+\varphi_{c}\left[d\right]
$$
$$
=\varphi_{a+b}\left[\varphi_{c}\left[d\right]\right]=\varphi_{a+b+c}\left[d\right]=a+b+c+d.
$$
I'm claiming to have justified treating every thing subscripted to $\varphi$ as a single number.
Comment: The authors of the book are at pains to carefully define what $\sum_{i=1}^na_i$ denotes; you are not.
Comment: Does you proof cover something like $$(a+b)+(c+d)=a+(b+c)+d=a+b+c+d$$ ?
Comment: @Peter That's something that has me puzzled.  For natural numbers, their sums will always be natural numbers.  So I'm wondering why I can't just replace $(a+b)$ by a natural number called $a+b$.
Answer: Writing the addition without parentheses is a statement that we have the full power of associativity - that the sum will be the same no matter what we add first. If we don't have that theorem yet, then it's simply a more confusing shorthand for a particular standard order (in your referenced material, from left to right).
Your argument doesn't prove anything. All you have written is a definition. You've addressed how to go from $S_n$ to $S_{n+1}$ by adding one term, but not what happens if we add things in a different order so that it's some previous sum $S_k$ plus a sum of the last $n+1-k$ terms at the outermost layer of parentheses. Of course it will be the same - but we have to actually prove it, and it's not something that will work in one step from the associativity. There's a reason the proof in the book uses strong (modified, in the book's terminology) induction.
Comment: Superb answer !
Comment: I've pretty much figured out what the authors expect.  Now I need to figure out what it really means.


Where are all the pumpkins in The Anthill map?

Question: I'm playing The Anthill.  The main objective is to locate 6 pumpkins throughout the map and bring them to the Queen Ant.  I've found 5 but can't find the sixth.  Where are the pumpkins?
Comment: @shanodin From the tag wiki: "Questions about custom maps...fall under this tag."
Comment: Is the mod tag relevant here? If it's just a custom map, I don't think it is necessary.
Answer: The 5 I've found so far are these:
1: An item entity dropped near the Queen Ant.  Not entirely sure if it was supposed to be like that or if that was a bug.
2: Inside the tree.  Climb the jumping puzzle to the top and hit the button.
3: Inside the bed, in the house. Near the left leg at the foot of the bed is a set of stairs you can use to climb into the bed, which harbors "bedbug" spawners and cobwebs galore.  Fortunately it gives you a sword at the entrance to this area.
4: Inside the bookcase, in the house.  The forward-facing wall of the bookcase has a hole in it.  Enter the hole, and complete the maze.  Take the ladders up every time you find one.
5: Inside the pond.  In the edge of the pond away from the house, underwater, there is a hole.  Once you go through, the floor goes away, so hold space to keep your head pressed against the ceiling so you don't fall into the void.  It looks like a dead end at first, but at the end go up, and you'll soon find yourself in a vast watery maze.  There should be a quick path to the top where you will find a chest with a respiration III diamond helmet.  Once you've grabbed that, make your way back down to the very bottom of the maze.  On the floor is an area of glowstone.  Break it and go down.  In the chest is the pumpkin, and the button takes you back.
6:???
Comment: You might want to just edit these into your question and delete the answer.
Comment: Why @Mkalafut? This is still helpful for those that might have had the same question and were looking for more than 1 pumpkin ,so I don't see how this is a problem at all.
Comment: @Mkalafut [What I did was perfectly acceptable in the eyes of the site's founder](http://blog.stackoverflow.com/2011/07/its-ok-to-ask-and-answer-your-own-questions/), so if you could provide a reason, that would be nice...  Besides, if I did as you suggest, there would be an answer in the question...


Would surface-bonding cement be appropriate for this?

Question: I would like to refinish an old wall of previously finished CMU blocks and bricks.  See these pictures:

(full-size images also available at https://www.dropbox.com/sh/ryr4m5adx6cd22c/AADFZKSiNORkaFE8bO6gDscoa?dl=0)
The wall is original (from 1939) it doesn't appear to be sagging and the cracks are probably just on the surface.  The finish layer has cracked, among other things, possibly due to water leaking from within the wall.
As you see in the picture, there are a few other things going on:

a layer or two of bricks at the top
a section of concrete that was done more recently (strong, reinforced with rebars)
an area of concrete to fill a whole underneath the above concrete, also done more recently
1/2 inch holes at the very bottom of this wall to release the water that may be within the wall, also done recently

In general, I have no concerns with this wall other than the aesthetics.
I recently learned about the properties of surface bonding cement.  For example: https://www.homedepot.com/p/SAKRETE-50-lb-Surface-Bonding-Cement-in-Gray-65300845/100321221
It has fibers in it and allows you to build walls out of CMU blocks without using mortar.
I am thinking of applying a layer of surface bonding cement on top of all of what I have at the moment (including the bricks, the concrete, the cracked layer) without removing any of it.  Is it a good idea?  I don't see much discussion about surface bonding cement on the internet.
What I see regarding bonding, however, is advice like this:
https://www.swimmingpoolsteve.com/pages/bond-concrete.html
which, in a nutshell, is:

Remove grease and oils
Acid wash
Rinse and neutralize the concrete
Apply a bonding slurry
Apply the new concrete layer

Seems like solid advice.  Is this advise compatible with surface bonding cement?  That is, does it make sense to do 1 through 4 above before applying surface bonding cement?  Or is that not needed when using surface bonding cement (as opposed to concrete which is what the advice is about).
Or what is the best advice in general for my situation?
Comment: Please [edit] your post to upload the images directly to this site. Not everybody can access Dropbox in all locations, whereas Imgur (this site's hosting partner) seems to be available to almost everybody. You may have to resize images to smaller than 2MB, but that's not difficult.
Comment: Will do when I get to a computer. I tried actually but they got rejected - too large. I can resize though.  However, note that the link should not require Dropbox client, it's just a web link.
Comment: @FreeMan Done.  Thanks for the note.
Comment: Thanks! Some places block _file_ sharing services but not _photo_ sharing services - web-based or installed client-based alike.
Comment: Also (sorry for not noticing this the first time), please include some quotes of the relevant items from your last link. Web sites die all the time and if that one goes down, nobody knows what advice it is that you're referring to.
Comment: Thanks @FreeMan. No worries, I agree that's a good practice and I updated the description again.

Do my updates bump my question somehow so people notice it or how does stack exchange work exactly?  Ultimately, I hope someone comments on the topic :-)
Comment: Yes, each time the post is edited, it gets bumped back to the top of the list _for those who sort by recent activity_. That's not guaranteed to be everybody. I'd think that now that you've got a pretty good question here that _someone_ who knows more than I do about this will be by to offer advice.
Comment: OK, I appreciate the explanation.  I _thought_ it would be that way but good to get a confirmation!
Answer: I have used surface bonding cement. I like it because it looks good and helps hold everything together, but it is not a miracle worker. Surface bonding fibered cement doesn't last forever and needs maintenance now and again. Your wall appears to have been previously surfaced. The water that pushed through the wall is going to give the coating a hard time, but go for it anyway.
Your wall is in much better structural condition than mine. Your wall could also be cleaned really well. Go for it. You'll be happy that you did because it will help the wall last longer and it will look good. Just don't expect it to last forever. There really isn't anything else you can do.
More Details as per comment:

Nothing sticks to dust, dirt, or flakes. A solid clean surface is necessary.
Nothing sticks to smooth, so a rough surface is necessary. A chisel or whatever can be used to scratch a smooth surface.
The water in the cement will evaporate causing shrinkage as it dries. The big deep holes will have to be filled in stages. Filling a big hole all at once means that the top will shrink (dry) first which causes the rear to pull away and release from the wall behind as it shrinks.
Water must be stopped at the point of entry, not at the point of exit. Water seeps through the wall with a pressure required to push it down and through the weep holes at the bottom. Most of it evaporates off of the top and you don't even know it is happening. But, the water pressure against the back of the cement will pop the surface bonding cement off.
The wall will have to be redone every 3 to 10 years or more or as often as it needs redone. It will depend upon the measure of water pressure from the rear, general movement, and how bad it can get before you want to repair it.
The fiber in the cement will not cause the cement to stick better, but will will cause the cement to remain on the wall until a big section fully releases.
Comment: Thank you @Paul this is helpful!
Does it make sense to chisel out the previous surface before application?
Does it make sense to use the 1 through 4 in that bonding advise I pointed to?
Finally, how often do you think maintenance will have to be done?  And what?  Apply another layer?
Comment: I appreciate the clarifications.  I'll go ahead and accept this answer although there are a few things that are still unclear to me:
Would acid wash be necessary? Maybe I'll skip that part?
I was thinking of chiseling the previous layer not to roughen the newer concrete - but that's a good point.


Wiring a compressor to an external building

Question: I have run 2,2,2,4 in conduit underground to a 100amp box. In the house the ground an neutral are bonded together but in the shed they are separated(isolated). I'm connecting a compressor through a disconnect box which only has L1, L2 and ground do I need a different box? Can the ground and neutrals be connected together like in the house? BTW the compressor is a 60 gallon 5HP 240V unit. I wanted a disconnect box so I can use a waterproof wip to the compressor.
Comment: Electrical requirements vary by location.  Where in the world are you?
Comment: Why would you want to connect ground and neutral together?
Comment: Does the compressor need 120V, or just 240V?
Answer: You can install an isolated neutral buss in the box connect the neutrals to this buss and the grounding conductors to the one that connects to the box case and you will be good to go. Most home stores and electrical supply stores have these isolated busses usually less than 10$ for a small one like you need, make sure if your box has 20 breaker openings to get a buss with close to that many holes, your 240v compressor may not require a neutral and most pumps, or other 240v only devices don't need a neutral.


How to activate group chat in Skype 4.3 in Ubuntu 14.04?

Question: I have installed skype 4.3 in Ubuntu 14.04.
Everything seems normal but group chat not working.
How to enable group chat skype 4.3?
Thanks in advance
Answer: If you actually mean group chat and not video calls, write
<code>/msnp24
</code>
in any Skype chat window, and restart Skype. And all of your group chats from any other machines and chat history will become available.
INFO: here
Comment: Working, It comes in the Recent
Comment: Perfect, Thanks! Note : However, in my case I needed to logout from Skype and login again. Just restarting Skype didn't work.
Answer: According to the official sources here, the cloud based group chat is not yet available on Skype for Linux. However you can still do a conference call by clicking on Options and selecting Start Conference Call.
Comment: is there any way to achieve it
Comment: No. Ubuntu cannot do anything about it. Alternatively, you can install Wine emulator and install Skype for Windows. If you don't know, wine is a Windows application emulator for Linux. You can install it by entering `sudo apt-get install wine` in Terminal.
Comment: screw Microsoft.
Comment: @OccamRazor's solution worked for me on Ubuntu 16. Not sure about 14


Will I be able to install Ubuntu Tablet on my Hipstreet Titan tablet?

Question: I have a Hipstreet Titan Tablet (HS-7dtb4-16G), will I be able to install Ubuntu Tablet on my Hipstreet Titan tablet?
Answer: At this time, only two tablets are officially supported and they are Nexus 7 and Nexus 10. However, community members have made Ubuntu run on other devices. Since Ubuntu Touch shares drivers with Android, it should be possible, but it probably won't be easy. And Ubuntu Tablet is nowhere near ready for end-user use. It's not supposed to be.
The short answer to your question is that at this point, you probably won't be able to install Ubuntu on your device. It is theoretically possible, but it would require a lot of work and it will be anything but simple. In the long term, I think there's a good chance someone will enable you to install Ubuntu on it, but only time can tell.


How does Google identify devices?

Question: I am using my google account to log in to the same computer on 2 different browsers, and when checking the Security => Your device => Device management => Details, google tells me I'm Use 1 device to login to Google account. How does Google determine I'm using 1 device?
Comment: Hey! Do you mean, how does google know, both browsers are on the same device? Well for example by the IP-address. But also through properties of your operating system. They track everythin they can. But anyway I would say your tags (javascript, asp.net-core) are totally wrong here. Maybe you change the tags to proper target the experts
Answer: https://coveryourtracks.eff.org/
Take a look at the browser fingerprint that can be generated using for example:

HASH OF CANVAS FINGERPRINT https://developer.mozilla.org/en-US/docs/Web/API/Canvas_API
AUDIOCONTEXT FINGERPRINT https://audiofingerprint.openwpm.com/
HASH OF WEBGL FINGERPRINT
WEBGL VENDOR & RENDERER

All these traces identify the hardware rather than the browser
Comment: I am shocked. Does it mean they can detect my device in a browser context? I do not mean the usual information like the OS send as an useragent. I just logged in a private tab and they told me when I logged in that I am using a DELL laptop. How?
Answer: Whenever a request is made from a device,
Device automatically sends user-agent in header
This user-agent tells you which device you are using
For eg: https://www.deviceinfo.me
Visit this from different browser ,it will detect both OS and browser(even browser version)
Visit the same link from mobile phone
or you on go in inspect(Ctrl+shift+i) tool of browser

Look for 'responsive' on top middle,

change it to iphone or ipad

visit the link again

How does Google identify devices?


Installing java 8 on ubuntu

Question: I am trying to install Java 8 on Ubuntu. Due to restrictions on download at my work place, I cannot install using apt-get. Hence, I downloaded the archive from Oracle's website, named jdk-8u25-linux-x64.gz. However, when I extracted it, there was only a file inside it, named jdk-8u25-linux-x64. How to install using that file?
Comment: I've edited the question to include file names.
Comment: I wish. But it's not. It's just a file whose size is 312 MBs
Comment: @karel : no it's not.
Answer: These are the installation instructions for Java SE Development Kit 8u25 (jdk-8u25-linux-x64.tar.gz) which I copied from the Oracle website. This isn't really an answer, it's a long comment to demonstrate that the question is indeed a duplicate of How can I install Sun/Oracle's proprietary Java JDK 6/7/8 or JRE?.

Installation of the 64-bit JDK on Linux Platforms
This procedure installs the Java Development Kit (JDK) for 64-bit Linux, using an archive binary file (.tar.gz).
These instructions use the following file:
jdk-8u25-linux-x64.tar.gz

Download the file.
Before the file can be downloaded, you must accept the license agreement. The archive binary can be installed by anyone (not only root users), in any location that you can write to. However, only the root user can install the JDK into the system location.
Change directory to the location where you would like the JDK to be installed, then move the .tar.gz archive binary to the current directory.
Unpack the tarball and install the JDK.
 tar zxvf jdk-8u25-linux-x64.tar.gz

The Java Development Kit files are installed in a directory called jdk1.8.0_version in the current directory.
Delete the .tar.gz file if you want to save disk space.

The only change that I made from the source is to change the name of the file to the name of the file that was downloaded in the question. Is it OK to do this? Yes indeed. See the Oracle documentation: Installation Instructions Notation and Files.
Answer: As it turns out, you shouldn't rely on ubuntu's archive manager. Extracting using command line works just fine.
Comment: Ubuntu's Archive Manager works OK too, if you put a check mark in the checkbox under the **Actions** heading in the Archive Manager **Extract** window to the left of where it says: *Keep directory structure*.

Installing java 8 on ubuntu


Shift Elements of 2D VBA Array

Question: All -
I'm wondering if there's an efficient way to "shift" elements of a 2-dimensional array.  Effectively, what I have is triangular data, saved in a VBA array (n x m, where n <= m):
      0 1 2 3 4 5
  ----------------
  0 | A B C D E F
  1 | G H I J
  2 | K L

I'd like to "restructure" this array to:
      0 1 2 3 4 5
  ----------------
  0 | A B C D E F
  1 |     G H I J
  2 |         K L

The blank values in the array are actually empty strings ("").  I'd imagine there's some looping that I could do to perform this with some compute cost, but I'm wondering if there's an efficient approach for subset "shifting" within VBA...
Comment: There's no one-liner for this - you will need to use a loop approach.
Comment: Allow me a question: could you test my answer to the shift array elements question? I posted an approach reducing loops to a minimum; if helpful feel free to upvorte and/or accept by ticking the green checkmark :-) @Mykenk
Answer: As @TimWilliams commented correctly, you won't do it without any loops. - A possible approach, however reducing loops would be to

write the initial array (named e.g. v) row wise to an empty target range (applying individual offsets you can calculate before) and eventually
assign them back as so called data field array.

The following example code should give you an idea. - Little draw back: in any case you get the array back as 1-based array.
        '~~> assign initial (variant) array v as in OP
        '...
        '~~> calculate column offsets per array row, e.g. {0,2,4}
        '...

        '~~> shift array rows and write them to any empty target area
        Dim startCell As Range: Set startCell = Sheet1.Range("X1")
        Dim i As Long, j As Long, tmp As Variant
        For i = 1 To UBound(v)
            '~~> get individual column offset per row, e.g. {0,2,4}
            j = Array(0, 2, 4)(i - 1)
            '~~> write next row to target range
            startCell.Offset(i, j).Resize(1, UBound(v, 2)) = Application.Index(v, i, 0)
        Next i
        '~~> get rearranged 1-based 2-dim datafield array
        v = startCell.Offset(1).Resize(UBound(v), UBound(v, 2))

If you shift elements within a greater array, you could write the entire array to the target and overwrite only rows you need rearranged (considering to clear these single row ranges before:-)

Shift Elements of 2D VBA Array


How to rename a partition

Question: I have partitions that I would like to rename.  What are the terminal commands to do this?
Answer: You can re-label file systems with Gnome Disks:

If you really want to use the command line, the command depends on the affected file system type. For ext2/3/4 it's
sudo e2label <DEVICE> <NEW_LABEL>

In a similar fashion there are fatlabel, exfatlabel, ntfslabel, btrfs filesystem label, swaplabel for other file system types with the same command syntax.
Answer: From the command line install the labeling program depending on the filesystem type. Here are all the different installation commands for each filesystem type:
sudo apt-get install mtools             # MS-DOS
sudo apt-get install ntfsprogs          # NTFS
sudo apt-get install e2fsprogs          # Ext2
sudo apt-get install jfsutils           # JFS
sudo apt-get install reiserfsprogs      # ReiserFS
sudo apt-get install xfsprogs           # XFS

Identify your partition using:
sudo fdisk -l

Then, for an example partition sdX:

for FAT32:
sudo mlabel -i /dev/sdX ::"new_label"

for NTFS:
sudo ntfslabel /dev/sdX new_label

for exFAT:
sudo exfatlabel /dev/sdX new_label

for ext2/3/4:
sudo e2label /dev/sdX new_label

How to rename a partition


Uploading images to a site

Question: I'm working on allowing userse to upload thumbnails of themselves to my site. The code I have is
$allowedExts = array("jpg", "jpeg", "gif", "png");
        $explode = explode(".", $_FILES["file"]["name"]);
        $extension = end($explode);
        if ((($_FILES["file"]["type"] == "image/gif") || ($_FILES["file"]["type"] == "image/jpeg") || ($_FILES["file"]["type"] == "image/png") || ($_FILES["file"]["type"] == "image/pjpeg") ||   ($_FILES["file"]["type"] == "images/jpg")) && ($_FILES["file"]["size"] < 50000) && in_array($extension, $allowedExts))
        {
            $sDate = date("m-d-Y");
            $sRandString = randomString(50);
            $sFileName = rename($_FILES["file"]["tmp_name"], $sDate . $sUsername . $sRandString);   //The name of the file
            $sTargetLink = $_PARAM["ThumbnailDir"] . $sFileName;

            if ($_FILES["file"]["error"] > 0)
                echo "There has been an unexpected error, we're working on fixing it as soon as possible. Please try again later.";
            else
            {
                if (file_exists($_PARAM["ThumbnailDir"] . $sFileName))
                {
                    unlink($_PARAM["ThumbnailDir"] . $sFileName);
                    $sFileLocation = $_PARAM["WebsiteAddress"]."images/thumbnails/".$sFileName; //The location of the file
                    move_uploaded_file($_FILES["file"]["tmp_name"],$_PARAM["ThumbnailDir"] . $sFileName);
                    echo "The thumbnail has been successfully uploaded.";
                    unlink($_FILES["file"]["tmp_name"]);
                }
                else
                {
                    $sFileLocation = $_PARAM["WebsiteAddress"] . "images/thumbnails/" . $sFileName; //The location of the file
                    $move = move_uploaded_file($_FILES["file"]["tmp_name"], $sTargetLink);
                    if ($move) echo "The thumbnail has been successfully uploaded.";
                    unlink($_FILES["file"]["tmp_name"]);
                }
            }
        }

and then the link location would be saved in the database, allowing a retrievable link to the image. However, whenever submitted, the page returns this:

Warning: move_uploaded_file(C:\xampp\xxxxx\php3D71.tmp): failed to open stream: No such file or directory in C:\xampp\xxxxxxx\xxxxx\xxxx.php on line 117
Warning: move_uploaded_file(): Unable to move 'C:\xampp\xxxxx\php3D71.tmp' to 'C:\xampp\xxx\xxx\thumbnails1' in C:\xampp\xxxxxxxxx\xxx\xx\x.php on line 117

I can't figure out what is wrong. The form is enctype="multipart/form-data" Any suggestions? Thank you.
Comment: It's probably the destination path. Make sure the destination directory is already created.
Comment: What do you get when you echo `$_PARAM["ThumbnailDir"] . $sFileName`? Is it a valid destination, and do you have the correct permissions for the `ThumbnailDir`?
Comment: it echos tumbnails1, that's something I forgot to mention. I want it to save it in thumbnails, but it always moves it to thumbnails1, can't figure that out either. $_PARAM["ThumbnailDir"] is  "C:\\xampp\\xxx\\xxx\\thumbnails"; .
Answer: Issue 1 -
Try changing to-
$sFileName = $sDate . $sUsername . $sRandString;
rename($_FILES["file"]["tmp_name"], $sFileName);   //The name of the file
$sTargetLink = $_PARAM["ThumbnailDir"] . $sFileName;

since rename() is returning true, this line -
$sTargetLink = $_PARAM["ThumbnailDir"] . $sFileName;

is becoming
$sTargetLink = 'thumbnails' . 1; //  => thumbnails1

Issue 2 -
Your move_uploaded_file() warnings/errors are because it can not find your thumbnails folder. Double check your destination path/directory. Make sure that it is absolutely correct.
Another possible issue is that I don't see a / between $_PARAM["ThumbnailDir"] & $sFileName to denote the folder thumbnails ~ ($_PARAM["ThumbnailDir"]). It could be as simple as changing to -
$sTargetLink = $_PARAM["ThumbnailDir"] .'/'.$sFileName;

Comment: Thank you! that worked for changing the directory, but the move_upload_file function still won't work. I hate to ask for answers, but any idea why?
Comment: I have edited my answer with why `move_upload_file()` is erring out. It could be because you are missing `/` between `thumbnails` and the filename.

Uploading images to a site


iphone viewForZoomingInScrollView not called

Question: Edit: I have controller containing uiscrollview. That scrollview contains custom uiview having its separate class inherited from uiview. That uiview has uiimageview as subview. No i am taking "(UIView*)viewForZoomingInScrollView:(UIScrollView *)scrollView" in main controller. But that method didn't get fire when i zoom scrollview. What should i do so that this method may get called.
UIView *DrawingPlusImageView = [[UIView alloc]initWithFrame:CGRectMake((i*IMAGEVIEW_IPAD_LAND_X+112), 0, 800, 600)];

    IDDrawingView *drawView = [[IDDrawingView alloc]initWithFrame:CGRectMake(0, 0, 800, 600)];

    UIImageView* imgViewLand = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, 800, 600)];
    [imgViewLand setImage:[UIImage imageNamed:@"noFileSelected.png"]];
    [drawView setImageToDraw:imgViewLand.image];
    //        drawView.delegate = self;
    [drawView setCurrentSlidId:hmslide.strSlideID];
    [DrawingPlusImageView addSubview:imgViewLand];
    [DrawingPlusImageView addSubview:drawView];

    [scrollViewPresentation addSubview:DrawingPlusImageView];
    drawView.userInteractionEnabled = YES;

- (UIView*)viewForZoomingInScrollView:(UIScrollView *)scrollView {
// Return the view that we want to zoom

return  [self.scrollViewPresentation.subviews objectAtIndex:1];// there are slides, im zooming the second
}

Answer: I was having the same problem. and setting the minimum and maximum zoom levels for ScrollView solved my problem..try
self. scrollViewPresentation.minimumZoomScale = 1.0;
self. scrollViewPresentation.maximumZoomScale = 10.0;

Answer: It's only called once you begin to zoom.  The view should be a subview of the scrollview, keep a reference to it as a property and return that in the delegate method:
- (void)viewDidLoad
{
    [super viewDidLoad];

    [self.view addSubview:self.scrollView];
    [self.scrollView addSubview:self.container];
    [self.container addSubview:self.imageView];
}

- (UIView *)viewForZoomingInScrollView:(UIScrollView *)scrollView
{
    return self.imageView;
}


Facebook app notification request is blocked

Question: I am working on a Facebook application and I am having trouble sending notifications to users of my app. I reviewed the answers to similar questions on this site and I consulted the Facebook SDK page and tried to apply the following strategy:
<?php

$app_id = YOUR_APP_ID;
$app_secret = YOUR_APP_SECRET;

$token_url = "https://graph.facebook.com/oauth/access_token?" .
"client_id=" . $app_id .
"&client_secret=" . $app_secret .
"&grant_type=client_credentials";

$app_access_token = file_get_contents($token_url);

$user_id = THE_CURRENT_USER_ID;

$apprequest_url ="https://graph.facebook.com/" .
$user_id .
"/apprequests?message='INSERT_UT8_STRING_MSG'" .
"&data='INSERT_STRING_DATA'&"  .
$app_access_token . "&method=post";

$result = file_get_contents($apprequest_url);
echo $result;

?>

All I get is an error on my second call to file_get_contents. The error states:
failed to open stream: HTTP request failed! HTTP/1.0 403 Forbidden\r\n

Can anyone give me an idea of what's going on? My first request to graph.facebook.com worked just fine.
Answer:
Check Facebook is doing OK: Does Facebook Platform Live Status have any relevant information?
Check you have no connection issues with facebook.com in HTTPS: Can you open the URL of the social graph for Facebook Platform's page in your browser?
Check again if the actual URL you're trying to access works and the URL is correct.
Come back here and update the question with the problematic URL and the exact method you're trying to access, or contact Facebook Platform support.

stolen from Facebook graph api doesnt response
Comment: Yes. I chose not to display them here.
Comment: Yep, wise choice. Just making sure :) Can you use `GET` rather than `POST`?
Comment: I am not sure, but since this was the example given by Facebook, I would assume that it only answers to POST.
Comment: Could you try `&method=get`? I'm new in these waters, but I don't see why you'd have that in the request if there was only one way to do it.
Comment: well i'm not getting the error anymore, but nothing is happening.


What do these computers' dots and lines mean?

Question: In the main hub, there are multiple flashing computers that display a series of dots and lines if you hit them twice. I've included 3 examples below, but there are quite a few of them (around 20?).
What are these computers saying?
Answer: If you interpret the vertical lines as dashes, each sequence is valid Morse code, with each subsequence separated by spaces representing a single character, for a total of 4 characters each. Under that interpretation, the images say the following (guessing a little where some of the spaces are):

2RET
5SES
8MHE
Comment: I wonder if the number is meant to show the order of the three characters in a longer sequence. \_\_\_ret\_\_\_\_\_\_ses\_\_\_\_\_\_mhe(\_\_\_)? With spaces somewhere
Comment: @Wrigglenite You seem to have been correct there.  [This reddit post](https://www.reddit.com/r/WhatTheGolf/comments/foq2zc/the_what_the_golf_morse_code_easter_egg/) has several other decoded ones, but a different solution for 8.


multiple user on sql server

Question: It might be very basic question for you friends, but how to allow multiple users on SQL Server installed on remote windows server 2012 machine.?
right now only two user can work at the same time if third one comes one of two who are active has to allow and get out himself.
we are building new server which will allow multiple user to work on the same time.
My question is once we install SQL server on windows server machine what configuration needs to be done to achieve our goal(Multiple user can work on same time) on server machine as well as what configuration needs to be done on computers of people who will be logging into it.
do we need same number of instance similar to how many people will be working on it? if yes it means that many number of same database on the server and more space will be occupied right?
Thanks.
Answer: <code>EXEC sp_configure 'show advanced options', 1;
GO
RECONFIGURE;
GO
EXEC sp_configure 'user connections', 777;
GO
RECONFIGURE;
GO
</code>
Replace 777 with your limit of connections.
Comment: Thanks you so much for your quick reply, but can you please explain security concern with this, it has to be secure since we will be dealing with financial information. I believe 777 will aloow anybody with sql server login and password, m i right?
Comment: It's better to use windows authentication if possible. But sql server authentication with strong passwords is also ok. Anyway I suggest you to restrict your users in rights. Best practice is giving access only to specific stored procedures.
Comment: well, it would be something like one person will be accessing same database for MS DYnamics CRM , i will be using it for SSRS and other person will be using it for migration. and I am not experts on administation side of sql server so kind of fully confuse right now. we really don't want someone to work from local machine on server via logging into it. we want everyone to login to server via remote desktop connection and then work. I also belive we have to crete that many instances right?

multiple user on sql server