SVN Tree Conflict - just want to get the files?

Question: old SourceSafe user here, having to switch to SVN.  So, one of the projects in the trunk always says "Tree Conflict".  I haven't done any work in it (or at least nothing I need to keep).  I just want to "Get" exactly what's in the Repository for it.  Deleting the folder and updating doesn't seem to do the trick.  This should be simple; I don't care about what I have in the folder, I just want what's in the Repository.  How do I "Get" (in VSS terms) a project from SVN?
Answer: svn checkout
I recommend using a client like TortoiseSVN as well.
Tree conflicts usually occur when a file has been moved/deleted without using the SVN command to do so. However, there should never be a conflict when doing a fresh checkout into a new folder. Make sure the folder doesn't have any svn information attached to it by displaying "hidden" files and folders in your file explorer. You can try deleting the .svn folders if they exist or make a new checkout location in a directory that has no .svn files.
Comment: Sorry - yes, I'm using TortoiseSVN.  "Checkout" from the Repo Browser still gives me "Tree Conflict".
Comment: Have you tried checking out into a new directory? One with no .svn files? Also, try using the cleanup command. And if that still doesn't work. Right click, and select "Mark resolved." They recommit if needed.
Comment: Great, I added some more detail about what cause tree conflicts in my answer in case it happens again. Would also appreciate an accepted answer. =) Good luck.


Question about drywall screws

Question: I am building a workbench where I'm using 2x4s for the frame. I need to join 2x4 in a T configuration. The instructions say to use 3'' drywall screws. I went to Home Depot, and got the Grip Rite #9 x 3'' screws that look like this: https://pasteboard.co/GziIbad.jpg
How do you drive these in? I tried:

Drilling a 1/8'' hole but the drill bit is only about 2'' long
Used an impact driver.

In both cases, only the threaded (about 2'') part of the screw went into the wood. The non-thread part is protruding. Is the rest supposed to be hammered or what? Or maybe I got the wrong screws. Are there 3'' drywall screws that are totally threaded? For example, the 1 5/8'' ones are. Any suggestions are appreciated.
Comment: An impact driver, if strong enough, and you are using the proper bit for the screw so it does not "cam out" will drive those screws. What impact driver are you using? Having threads all the way up will not matter.
Comment: Thanks. I'm using the Dewalt 20V impact driver: lowes.com/pd/…. I'll try changing the bit screw. I believe it was 'camming' out.
Answer: You need to drill three operations.

The 2x4 piece being fastened. It needs a clearance hole drilled all the way through that allows that #9 sized screw to drop in. So the hole diameter needs to be just large enough as the greatest outside diameter of the screw. That may be the threaded part or the non-threaded part could be larger in diameter.
The clearance holes may want to be counter sunk slightly to allow the heads to come flush with the surface of the piece being fastened. You do this with a counter sink bit in your drill. With 3" screws you will need to be careful to not counter sink too far because your total thickness of two 2x4's is 3" and too deep of countersink will allow the screw to come through on the opposite side.
Piece being fastened to. This part will need to have pilot holes drilled. The pilot hole diameter needs to be less than the outer thread diameter on the screw but the same size or a tiny bit larger than the inner diameter of the screw thread. This is important because with fat screws like #9's it would be possible to split the lumber.

Additional hints:
a) Rub the threads of the screw on a bar of soft soap and it will make driving them in much easier.
b) Consider using 2.5" screws instead so you have less chance of them going all the way through.
c) Consider using deck screws instead that have an alternate drive slot instead of the Philips. A square drive has much less chance of stripping out when driving large screws.
d) Drill your clearance holes in the piece to be fastened first. Then clamp that piece to the part that it fastens to. This will allow you to use the clearance holes as a guide as to where the pilot holes have to go in the fastened to piece. Make sure the pilot holes are at least as deep as the  screw will penetrate. For an inexpensive type 2x4 type frame there really is no problem with drilling the pilot holes all the way through. If the pilot drill bit is not long enough you may have to unclamp the pieces to complete drilling the pilot holes.
Comment: Drywall screws are designed for holding drywall, not fastening lumber to lumber. Deck screws are what you need; they are both stronger and easier to drive. There is a brand of deck screw which accepts either Phillips or square drive, and a special driver (pale blue color) is included in each box which is a combination of Phillips *and* square drive. These really drive the deck screws.
Comment: Thank you for the very useful tips. I will try some of these techniques. For now, I did two things. 1) I drilled a bigger pilot hole (11/64'' instead of 1/8'') and 2) switched the drive bit so there is no slippage. I was testing on a small block and I'm able to drive the screw with significant ease.
Comment: Any good deck screw will be adequate. I avoid the gold screws sold at HD like the plague. Their generic coated deck screws are fine. Spax and GRK are high-end. Drywall screws are brittle and prone to breaking in applications like this.

Question about drywall screws


Python 2.7: Listen to requested connections + listen to already established connections at the same time

Question: I am currently trying to make a chatroom server. I'm trying to make it so I can listen for new requested connections and listen for messages sent from already established connections at the same time.
I can use this to listen for requested connections:
def reqlisten():
    global hostlist
    while True:
        conn, address = (sock.accept)
        hostlist.append(conn)
        print 'Recieved connection form', address

And I can use this to listen messages sent from already established connections:
def meslisten():
    global hostlist
    while True:
        ready_socks,_,_ = select.select(hostlist, [], [])
        for sock in ready_socks:
            data, addr = sock.recvfrom(255)
            print 'Received message:', data
            broadcast(message)
            print 'Broadcasting message.'

But how do I do both of these at the same time?
Answer: There are multiple ways to do this.

One easy way is to accept one connection at a time and receive on a accepted socket for a fixed amount by setting the sockets to be non-blocking asynchronously.

Below is an example code to do that.
hostlist = []
def Accept(sock):
    ##Accept one connection at a time
    conn,address = sock.accept()
    print "accept",address
    conn.setblocking(0)
    hostlist.append(conn)

def Recv(sock):

    data,addr = sock.recvfrom(255)
    print "recv",data

if __name__ == "__main__":
    listen_socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
    listen_socket.bind((socket.gethostname(),4041))
    listen_socket.setblocking(0)
    listen_socket.listen(5)
    hostlist.append(listen_socket)
    while True:
        ready_socks,_,_ = select.select(hostlist, [], [])
        for sock in ready_socks:
            if sock == listen_socket:
                Accept(sock)
            else:
                Recv(sock)

Comment: You might need to add some exception handling EWOULDBLOCK ERROR condition gor non blocking sockets


wiki.js sutaible for public wiki

Question: Is wiki.js suitable for developing public wiki (would be a specific topic) available online? It is considered a small project, however, search function should be a must also.
I will be the only developer, I am more .NET/C# developer, but I have no problems with js also (so node.js could be ok). However, I do not have any experience with markdowns and MongoDB. Also, I do not know is it easy to find hosting for node.js + git (as it is necessary, right)?
Answer:
Is wiki.js suitable for developing public wiki (would be a specific
  topic) available online?

Yes, wiki.js is perfectly suitable for hosting a basic wiki online. Wiki.js is currently in its 1.0 build which is relatively limited in its functionality however. The 2.0 beta is looking much more promising for large scale deployments. If you want to make a wiki for hundreds of people, you should use something like MediaWiki.

search function should be a must also

Both the 1.0 and the 2.0 builds have a search function out of the box.

I do not have any experience with markdowns and MongoDB

The 1.0 build only requires you to install the latest version of MongoDB, the configuration is handled by the application. You merely need to follow the instructions for installation at https://docs.requarks.io/wiki/install/installation
If you consider yourself a developer, you should learn markdown, it's very simple and widely used.

Also, I do not know is it easy to find hosting for node.js + git (as
  it is necessary, right)?

Yes, node.js is absolutely necessary. In the 1.0 build, a git repo is how you backup and sync all your pages for the wiki. Technically you don't need it, but it's great for backing up files if you ever need to move the wiki to new hosting for example.
For hosting, any vm will work. I would recommend using a cloud provider like Google Cloud Platform or Amazon Web Services. It's easy to learn and quick to set up. Start a GCP trial for 300 days, start an SSH session, install all the dependencies, set up a repo, and follow the installation instructions on the docs website for wiki.js. It should be a simple process if you follow the instructions. Cheers.

wiki.js sutaible for public wiki


cassandra data migration from regular drive to SSD on production server

Question: we want migrate our data from regular drives on production server to new SSD drives. how we can do that without taking down the node no longer than 4 hours(hinted hand-off is 4 hours) our data is in few hundreds of GigaBytes.
what i was thinking is stoping cassandra on one node at a time flushing data to disks and then transfering data from old drives to new drives and de-mounting old disk and bringing back node online. Is this a right approach ?? If so
what is my major concern is,the data migration to new disk takes more than 4 hours in the mean while i will lose hints.
Is there any better approach for migration of data to new disks??
Answer: Add the disk.
Use rsync -avz --delete /old/data/dir /new/data/dir to copy the sstables from one (spinning) drive to the other (ssd) drive. You can run this while cassandra is running - no risk other than increased latency due to IO contention. You can control the increase in latency using nice and ionice.
Once you've run rsync, you'll have an idea of the upper bound of the migration process. You'll also have an initial snapshot. Run it again, and time it a second time - it's likely going to be significantly faster - it'll leave files that haven't changed, delete files that have been deleted, and copy any new files. If this is faster than 4 hours (and it probably will be), then you can proceed to run nodetool flush and nodetool drain, stop cassandra, and run rsync a third time. Once rsync completes, change the path to the data file directory in the yaml, and start cassandra - hints will be delivered and you're good to go.
Alternatively, you can do the exact same thing, and if it takes longer than the 4 hour hint window, follow it with a nodetool repair to pick up any writes you missed when hints expired.


How to Use Way of White Circlet

Question: At the beginning of the game, starting as a Knight, I have a usable item called "Way of White Circlet". Despite the name, you can't equip it as a headgear item, and it is unusable by default, regardless of whether I possess an Ember or not, though it can be equipped like a usable item.
Does anyone know what exactly this item does, and how to activate it? The exact item text implies it's a multi-use Ember:

Online play item. Restore the connection to other worlds.
Those who engage in unjust deeds when in contact with other worlds
  will lose their connection to them.
Way of White Circlets assume such sin as their own, but are found few
  and far between. Acting without honor will never be without risk.
Comment: That text, as I read it (specifically the second paragraph) indicates that you can do things that cause you to lose the ability to play online even when you are kindled, and that this item can reverse that.
Comment: @murgatroid99 hm, good point, I didn't really read it that way. That's probably it.
Answer: If you repeatedly disconnect or otherwise go offline while being invaded, summon signs will no longer appear for you. However, you will still be available for invasions only now you can't summon phantoms to help you either with invasions or with bosses.
Much like the Bone of Order in Dark Souls 2, the Way of White Circlet is a way for you to restore that link, allowing you to see summon signs again.
Answer: It's an item used if you get banned. You can use that item to get back into normal play, one of the item will spawn every 10 to 15 hours of gameplay at your coffin.

How to Use Way of White Circlet


AutoCAD show whole command run through dialog box

Question: In Autocad, some commands (like HATCH) will call a dialog box to pass parameter value to command, I just want to know how to get rid of prompt dialog box and execute the command only in command line? In other words: How do I know the template to complete a command?
Answer: Run command starting with <code>-</code>. Like this:
<code>(commnad "-_HATCH" ......... )
</code>


Cannot upgrade from disco 19.04 to focal 20.04 after end of life using do-release-upgrade method

Question: At this time, I am unable to update from Disco 19.04 to Focal 20.04.  I have read several current questions that have been closed, referring to some really old questions. I have already read all the 8 year old threads and followed those instructions.  They were helpful but they don't solve my problem.  I have read all the questions suggested to me while typing this.  Please don't close my thread and refer to the old ones as they do not resolve this issue, which is NEW (as in, it has been 8 years already since those questions were answered and they don't address my problem).
After trouble shooting and replacing "archive" with "old-releases" and eliminating all the third party packages from the source list, I am able to "apt update" and "apt upgrade" and the system is up to date.
I have tried "full-upgrade", "dist-upgrade" and everything else I can think of.  All now say:
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.

I already fixed all the error messages I was getting using all the suggestions in all the other threads I have already read.
When I run "do-release-upgrade", I get the following output:
Checking for a new Ubuntu release
Your Ubuntu release is not supported anymore.
For upgrade information, please visit: http://www.ubuntu.com/releaseendoflife

Get:1 Upgrade tool signature [1,554 B]
Get:2 Upgrade tool [1,337 kB]
Fetched 1,338 kB in 0s (0 B/s)
authenticate 'focal.tar.gz' against 'focal.tar.gz.gpg'
extracting 'focal.tar.gz'
Reading cache
Checking package manager
Can not upgrade
An upgrade from 'disco' to 'focal' is not supported with this tool.

When I user the Software Upgrade graphical tool, I get the following:
Can not upgrade: An upgrade from 'disco' to 'focal' is not supported with this tool.

This computer has many users and much software loaded and I cannot do a fresh install.  First, I don't know how to do so while saving all the users, files and programs and second, I foresee a nightmare scenario of a blown up computer with everything gone.
If I can upgrade from 19.04 to 19.10, I have been unable to figure it out.  I am pretty sure it can't be done since 19.04 is no longer supported.
In case it matters, my disk is encrypted.
Please, please, please someone tell me there is a way to get from 19.04 to 20.04 without a fresh install, saving all my users, data and programs!  I would be absolutely shocked if there is no way to upgrade simply because I missed the update deadline.  If not, I will be forced to buy a new computer!
Comment: Those 8-9 year old posts don't answer my question.  I know you can't or are not supposed to skip releases but I cannot upgrade to 19.10 either.  I was looking for suggestions for alternatives.  I didn't realize when I installed 19.04 and missed the deadline for auto upgrades that it made it impossible to upgrade at all.  Otherwise, I certainly wouldn't have missed the deadline.  I wish it were more clear that missing a deadline with a developmental release would cause this problem.  It's not friendly to new users.  I guess I will have to learn how to backup and restore and do a fresh install.
Comment: I was able to modify the instructions found at this link to successfully upgrade from 19.04 to 19.10: https://tips.graphica.com.au/upgrading-from-retired-ubuntu-releases/
Comment: @JonathanBerger We already have [a similar Q&A](https://askubuntu.com/q/1208109/816190). It is considered as a highly active Q&A and the highest voted answer helped at least 200 people (considering visible and invisible votes) and I awarded bounty for that excellent answer. It was unfotunate that this question wasn't closed as dupe of that one. Would you like to suggest an edit on the above said question so that, as you say, googlers would get benefit? By the way, thanks for your concern. Appreciated!!!
Comment: Personally I'd opt for a re-install, non-destructive (ie. using same partitions with no format of partitions) where it'll note your software packages, erase system directories, install, add back your additional software packages & ask to reboot. That works brilliantly & is many times faster than a *release-upgrade* for desktops, however it can have draw backs for servers (that can stored config files in system directories that get wiped; desktop apps store files in $HOME so aren't touched). Backup of course first, and use a LTS if you don't like upgrading every 6-9 months as @user535733 said
Comment: The answer by Stalinko seems to be the best one - directly download and call the dist-upgrade tool
Comment: update to `eoan` first by adding following lines to sources.list
ubuntu will then choose mirror which is closest to you -> faster download
deb mirror://mirrors.ubuntu.com/mirrors.txt eoan main restricted universe multiverse
deb mirror://mirrors.ubuntu.com/mirrors.txt eoan-updates main restricted universe multiverse
deb mirror://mirrors.ubuntu.com/mirrors.txt eoan-backports main restricted universe multiverse
deb mirror://mirrors.ubuntu.com/mirrors.txt eoan-security main restricted universe multiverse

`sudo apt update`
`sudo apt dist-upgrade`
Now it should be a easy to update to focal
Comment: @JonathanBerger Could you be kind enough to expand your comment and add it as an answer to this question? Thanks.
Comment: @jokerdino Sorry, the steps I've taken have since faded from memory and I'd hate to add inaccurate information. It's also frustrating to me it took so long for this post to be unlocked.
Comment: Does this answer your question? [How to upgrade from 18.10 to 19.10, using the command line?](https://askubuntu.com/questions/1208109/how-to-upgrade-from-18-10-to-19-10-using-the-command-line)
Answer: This is the only instruction which helped me: Upgrading End of Life (EOL) Ubuntu Version Ubuntu 19.04
Quoting from the above link:

~# nano /etc/apt/sources.list

I got stuck trying to update php 7.2 to 7.4 because my Digital Ocean
server was on an older version of Ubuntu.
If I tried to update my release I'd get the following
# do-release-upgrade
Checking for a new Ubuntu release
Your Ubuntu release is not supported anymore.
For upgrade information, please visit:
http://www.ubuntu.com/releaseendoflife

Please install all available updates for your release before upgrading.

When attempting to update my packages with apt-get update I would
get these types of errors.
Err:5 http://mirrors.digitalocean.com/ubuntu disco Release
  404  Not Found [IP: 126.96.36.199 80

E: The repository 'http://mirrors.digitalocean.com/ubuntu disco Release' no longer has a Release file.
N: Updating from such a repository can't be done securely, and is therefore disabled by default.

These occur because my Ubuntu version is not only out of date but at
its end of life so updating Ubuntu to a newer version.will require me
to update my repositories.
Digital Ocean uses its own mirrors for repositories so there is a
little more work there in figuring out which ones to use.
What version of Ubuntu am I on?
# lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 19.04
Release:        19.04
Codename:       disco

What repositories are being used?
~# nano /etc/apt/sources.list

Example repoistory on Digital Ocean Ubuntu 19.04
deb http://mirrors.digitalocean.com/ubuntu/ disco main restricted

Let's first get our current Ubuntu version up to date
To make the server update the files, we had to edit the
/etc/apt/sources.list with working repository locations.
To goal here, on this Digital Ocean server is to update the urls they
use for the repositories with ones you that will have the files you
need for your update
We want to replace this urls
mirrors.digitalocean.com

with
old-releases.ubuntu.com

This command will work
sudo sed -i -e 's/mirrors.digitalocean.com/old-releases.ubuntu.com/g'

/etc/apt/sources.list
Now
sudo apt-get update

will work!
Let's keep going
sudo apt-get upgrade -y
sudo apt-get dist-upgrade

Try to upgrade Ubuntu on the command line.
We are still unable to upgrade via do-release-upgrade
# do-release-upgrade

Checking package manager

Can not upgrade

An upgrade from 'disco' to 'focal' is not supported with this tool.

Frack!
So now I have my current outdated version of Ubuntu up to date, but I
can't upgrade to the next version using do-release-upgrade
You can try to upgrade manually.
First go to https://changelogs.ubuntu.com/meta-release and scroll down
to the release you want to upgrade to.
For example if you want to upgrade to Ubuntu 19.10 Eoan scroll to you
find the url to the UpgradeTool
UpgradeTool: http://old-releases.ubuntu.com/ubuntu/dists/eoan-updates/main/dist-upgrader-all/current/eoan.tar.gz

Now pull this over to a directory on your server
wget http://old-releases.ubuntu.com/ubuntu/dists/eoan-updates/main/dist-upgrader-all/current/eoan.tar.gz
mkdir eoan_upgrade
tar -xvzf  eoan.tar.gz -C eoan_upgrade

cd eoan_upgrade

Run the upgrade script
sudo ./eoan
sudo apt update
sudo apt upgrade
sudo apt dist-upgrade

Comment: the above upgrade script doesn't work for me. I tried the wget with the tar command and neither worked so is there a solution?
Comment: nevermind i see the last command, you are going to 19.10 because its supported then doing a dist upgrade to 20
Comment: last line should be do-release-upgrade instead of sudo apt dist-upgrade though
Comment: Then sudo do-release-upgrade to upgrade to ubuntu 20.x.x
Comment: What's the exact issue with wget and tar? Does it throw any errors?
Comment: is there a reason your post talks about going to 20 but in the example you are upgrading to 19.10? Do you have to go to 19.10 before going to 20.04?
Comment: @Stalinko i assume your problem is your didnt change it to "old-releases" in the archive and you copied and pasted the one from the meta-release website he linked to
Answer: Faced the same problem after end of life. The process to upgrade to 20.04 was first to upgrade to 19.10. Following is how I upgraded 19.04 to 19.10

Open /etc/apt/sources.list
Delete everything and replace it with the following: (you might want to keep a backup just in case)

deb http://old-releases.ubuntu.com/ubuntu eoan main
deb http://old-releases.ubuntu.com/ubuntu eoan-updates main
deb http://old-releases.ubuntu.com/ubuntu eoan-security main

Finally, just run these commands one by one:

sudo apt update
sudo apt upgrade
sudo apt dist-upgrade

That's basically it. Ubuntu should now be upgraded to 19.10 (Eoan)
Now it is an easy task to upgrade from Eoan to Focal (20.04)
As suggested by @xiaojueguan, run the following command to upgrade from Eoan to Focal:
do-release-upgrade

Note: After you update to Eoan, you may want to update your sources.list file. You can find it here:
Eoan (Ubuntu 19.10): https://gist.github.com/malikalichsan/860b8134a74c65a394efe09711d0b95f
Focal (Ubuntu 20.04):
https://gist.github.com/ishad0w/788555191c7037e249a439542c53e170
Comment: when you've upgrade to 19.10(eoan), type `do-release-upgrade` and follow the tutorial and you will be there
Comment: This is not the "official" way to upgrade, but it might work.
Comment: Yes, it's not official at all. However, as far as I understand, after EOL there isn't any official way. I found this to be the easiest way to go though :)
Comment: Part of your solution worked for me.
Important highlight. Do an intermediary update `disco=>eoan=>focal`
Comment: Yeah, if you read the first line, it says first upgrade from 19.04 (disco) to 19.10 (eoan)
Answer: Summary:
Do an intermediary upgrade disco=>eoan=>focal

Alternate upgrade

I tried part of @misteeque solution and changed all the /etc/apt/sources.list to old-release. So, can't tell if this had an impact on the steps below. I also did the http://security... ones.   Comment if 0. is not needed.
sudo wget http://old-releases.ubuntu.com/ubuntu/dists/eoan-updates/main/dist-upgrader-all/current/eoan.tar.gz
sudo mkdir eoan_upgrade && sudo mkdir eoan_upgrade
cd eoan_upgrade
sudo ./eoan
sudo do-release-upgrade
and do 5. again to get to focal

lsb_release -a is helpful to check pre and post upgrades.
Comment: For posterity, I was able to do `disco -> eoan -> focal -> jimmy` with this method. It took a fair amount of time, but it was successful.


Best Place to Shoot Technicals to Disable Them

Question: When trying to disable a vehicle, is there a particularly good place to hit them to cause extra damage (such as the engine block or cab)? Or do hits in all locations cause the same damage?
Comment: What do you mean by "technical?" I'm not familiar with this term as it applies to MW3.
Comment: Military speak for a smallish, lightly armored vehicle with crew-served weapons is a "technical" - jeep, dune buggy, Humvee. Not stuff like an MRAP
Comment: Do you mean MW3? Because the only 'vehicles' are scenic cars and trucks that can blow up and air support. Do you mean Battlefield 3 by any chance?
Comment: This is what I was getting at.  I answered it for the case that this person is referring to pointstreak rewards in MW3, but I'm not convinced this is the case.
Comment: Well, if they say that is what they're talking about, I'll upvote your answer. Good detail
Answer: There is no location-specific damage to any pointstreak vehicle that I am aware of.  Fire on it however you please, they have a fixed amount of health and each of your bullets depletes some quantity of that, depending on the weapon and how far you are away (in some cases)
In general, the only pointstreaks that are feasible to shoot down (without a vehicle lock-on launcher) are:

Recon drone
UAV
Counter UAV
AH-6 Overwatch (possibly)

(it's not impossible to shoot down other killstreaks, but in terms of the flow of the game and the amount of fire needed, you won't be in situations often where it makes sense)
Each of those tends to require a good number of bullets from an AR or a LMG in order to kill.  The AH-6 tends to take 2-3 clips from an AR in the general case.  The UAV and recon drone have far less health but can be tricky to hit.
The problem with this is that in most situations you are going to be sticking out like a sore thumb on everyone's radars while you're firing into the sky.  Additionally, you're vulnerable, since you're not watching what's going on around you.
I strongly advise taking a launcher secondary with Blind Eye on one of your classes, so that if you find yourself in a situation where the enemy is calling in multiple air support vehicles, you can defeat it more easily.  Remember that in MW3, shooting down air support vehicles counts towards your pointstreaks, so it is as valuable as a single kill plus it benefits your team by negating a killstreak reward.
The AC-130 is one of the more tricky vehicles to shoot down regardless of your loadout, since it tends to require more launcher rounds to kill than you tend to spawn with.  (It and a few of the other high order air point streaks have "flares" that negate missiles shot at it when it first spawns, and after a cooldown) Coordination between a couple of people is generally key.
Also note that the EMP will destroy almost all killstreak rewards, so having it as your top tier in the support package will make your life in the late game quite a bit easier.
Most "ground" devices (sentry gun, remote sentry, for example)  can be temporarily disabled with stun or flash grenades, or permanently disabled with EMP grenades.  The disable duration is generally enough that you can get around the gun in most situations, and take it out with your knife.
The assault drone is a weird one.  Upon further review, I'm not sure that EMP grenades disable it (or if they do, the radius of effect is small and hard to aim since it moves).  A knife hit or single semtext won't take it out, and it requires multiple clips from most ARs and SMGs to disable.  Luckily, it has a decent reload delay and is aimed manually, so you can use those attributes to your advantage.
Comment: With an LMG, you can take down an Attack Helicopter or Pave Low - It just takes about 1 1/2 clips (~130 bullets)
Comment: If the enemy team gets a killstreak up that high, they should be good enough to find you in the amount of time it takes to empty the clip and reload an LMG :)  I'm not saying it's not possible, it's just not the best strategy.
Comment: True, and LMGs slow down your movement. I don't use them - I'm just presenting it as an alternate tactic, albeit a somewhat poor one


download report as pdf using servlet

Question: I have the pdf file location and pdf file in my POJO class. I want to download thee pdf using servlet. Please tell me some ways to get it done.
 File Location=/tmp/SWBC_444Thu May 03 20:01:07 IST 20124366242221752147545.pdf
Using this file location i want to prompt user to download the file as pdf.
Here is my code.
<code>File file = new File(filePath);
  OutputStream responseOutputStream = response.getOutputStream();
  response.setContentLength((int)filePath.length());
  FileInputStream fileInputStream = new FileInputStream(file);
  int size = fileInputStream.available();
  byte[] content = new byte[size];
  int bytesRead;
  while ((bytesRead = fileInputStream.read(content)) != -1)
  {
   responseOutputStream.write(content, 0, bytesRead);
  }
  responseOutputStream.flush();
  fileInputStream.close();
  responseOutputStream.close();
</code>
. I read and generate the file but when open the file its empty.
Thanking you..!
Comment: You can view this posts: [JasperReports: Calling report from servlet](http://stackoverflow.com/questions/2399507/jasperreports-calling-report-from-servlet) & [Report download not prompting user to save](http://stackoverflow.com/questions/6085049/report-download-not-prompting-user-to-save). The search on SO works great ;)
Comment: File file = new File(filePath);

      ServletOutputStream servletOutputStream = response.getOutputStream();
      ;
      BufferedInputStream bufferIput = null;
      FileInputStream fileInputStream= new FileInputStream(file);
      bufferIput = new BufferedInputStream(fileInputStream);
      byte[] bBuffer = new byte[fileInputStream.available()];
      int nBytes = -1;
      while ((nBytes = bufferIput.read(bBuffer, 0, bBuffer.length))
        != -1)
      {
        servletOutputStream.write(bBuffer, 0, nBytes);
      }   Problem solved. You can use this code to read an pdf file and download
Comment: You can post the solution as the answer to help others
Answer: httpservletresponse.setHeader("Content-disposition", "attachment; filename=\"" + title + ".pdf\""); should do
Comment: i did that..I mean its a basic thing for pdf. Anyway,Now i read the pdf file from specified file location and the pdf file is generated but when i open the file ,it doesnt display anything,File

download report as pdf using servlet


while read bash array (not into)

Question: I'm trying to use an array with while read, but the entire array is output at once.
#!/bin/bash

declare -a arr=('1:one' '2:two' '3:three');

while read -e it ; do
    echo $it
done <<< ${arr[@]}

It should output each value separately (but doesn't), so maybe while read isn't the hot ticket here?
Comment: `cat <<< ${arr[@]}` puts all elements on the same line.
Comment: @couling: I tried `<` and `<<` also, but didn't really get it.
Answer: For this case, it is easier to use a for loop:
$ declare -a arr=('1:one' '2:two' '3:three')
$ for it in "${arr[@]}"; do echo $it; done
1:one
2:two
3:three

The while read approach is very useful (a) When you want to read data from a file, and (b) when you want to read in a nul or newline separated string.  In your case, however, you already have the data in a bash variable and the for loop is simpler.
Comment: That's what I figured, but wanted to ask about it anyway (in the event there is that rare situation). Thank all of you (@John1024, @Soren, @couling)!
Comment: Is it not possible for a while loop to read arrays, or can I add a newline string to the array so it takes the behavior of reading a file? just curious about that really... thanks!
Comment: @CocoaPuffs -- you would probably need a second while loop to echo (write) out the data so you can read it -- so not a good solution to try to use a while loop
Comment: @CocoaPuffs The array is _already_ a bash variable.  Using `while read` would mean taking it out of the bash variable as a string which `read` would then reprocess into new bash variables.  I'm sure that there are cases where that is useful but they would be quite rare.
Comment: @CocoaPuffs if you REALLY want to do that you can use the `-d` flag with read to set the delimeter.  But this is NOT recomended. http://ss64.com/bash/read.html
Answer: possible by while loop
#!/bin/bash

declare -a arr=('1:one' '2:two' '3:three');
len=${#arr[@]}
i=0
while [ $i -lt $len ]; do
    echo "${arr[$i]}"
    let i++
done

Answer: With the Bash script below you should achieve what you want.
#!/bin/bash

# Ensure fail-fast script execution.
shopt -os nounset pipefail errexit errtrace

declare -a arr=('1:one' '2:two' '3:three');

while read -r it; do
    echo "${it}"
done < <(printf '%s\n' "${arr[@]}")

A couple of things to note here:

In general you should be making all your scripts fail-fast by setting the appropriate shell options with shopt -os.
Readline is not needed to read each line (array element) into the variable it because you're not interacting with the terminal while the script is running.
Instead it is usually good to prevent the interpretation of any backslash-escaped characters by passing read its -r option.
You should always surround variable references by double-quotes and place the variable names inside a pair of curly braces. Quoting prevents all kinds of errors if a variable is expanded and its value contains whitespace. Curly braces on the other hand foster readability by setting the variable name apart from the dollar sign (and surrounding text when expanded into an interpolated string).
The printf '%s\n' statement prints each array element on a new line. The output printf produces is then directly fed via the standard input stream into the while loop.

while read bash array (not into)


Is it possible to mouse walk in Guild Wars 2?

Question: I'd like to walk using only my mouse, as I can do in other games like Diablo 3. I searched and didn't find an option for this in Guild Wars 2. Is there no option to do this? Is there a workaround? A left hand handicap makes "W_S_A_D" or arrow keys difficult for directing my avatar.
Comment: Are all your questions going to be essentially "can I click-to-move in [Insert Game Name Here]"?  While I understand it can be useful, especially for those with disabilities, a *lot* of games just aren't designed in such a way that it's practical (if at all possible) to play like that.  I don't know much about Guild Wars, but Skyrim (from your other question) is a prime example of this.
Comment: Two questions is hardly enough to complain about a pattern, Iszi.
Comment: try [tag:runes-of-magic] you can use the mouse for casual gaming, in the same was as Diablo 3.
Answer: Yes, you can.
If you keep holding the left button of your mouse, you can hold your right button to make your character walk. Changing the view angle will make your character move to the pointed way.
Tip: You can click R to enable auto-run.
Comment: Also, doing the inverse (holding right butto and then hold left button also works.
Answer: You can't move in exactly the same way, by clicking on the ground, but you can move using the mouse. You can hold right-click and move the mouse to look around, and if you hold right and left click at the same time, you will walk forwards.
This will allow you to move using the mouse, but you will be unable to strafe.
Comment: This is pretty standard in similar games these days, too.  (I really like the way TSW does this where middle-click is mapped to autorun, too)
Answer: Holding both right-click and left-click at the same time will cause you to walk forward. This isn't the same thing as click-to-move movement, but it does allow movement to be controlled solely by the mouse.
Answer: There are freeware programs which can take a joystick input and translate it to keystrokes. AFAIK one is actually called Joy2Key, but there are others.
One can get a 10$ gamepad with an analog stick and then set up joy2key to translate the stick movement to WASD.
I don't use these programs, but I do use a joy2Midi program to translate joystick buttons to midi inputs for use in a guitar stomp box connected to a virtual amplifier. Similar principle.
Answer: With no mouse button pressed or left mouse button pressed:
W and S walk forward and backward,
A and D rotate left and right,
moving mouse only rotates the visual
With right mouse button pressed:
W and S walk the way pointed by mouse,
A and D strafe left and right,
mpving mouse rotates visual and character direction
With left and right mouse buttons pressed:
The character walks forward,
moving mouse rotates visual and character direction
(BTW quite useful when typing while running!)
Answer: If you have a mouse with programmable buttons, you can map the walk function to one of these buttons. This should work pretty well.


Install Lubuntu 12.04 from Windows XP

Question: I want to install Lubuntu 12.04 (my PC don't support more) from Windows XP without reboot system. How I can do this? I heard something about wubi, but I am not sure from whre to download it.
Thanks!
Answer: I don't think you can do it without rebooting, as you have to boot into the live CD / USB, and then into the OS when complete.
Also, you probably want 14.04, it is the latest version (and in my opinion, it runs much faster).
First download the lubuntu iso and also unetbootin, then use unetbootin to install it on a disk / USB / SD card.
Once complete, restart the computer with the USB in, and from the BIOS (F2 / Del / F12) choose removable media or similar.
As it is booting, choose install or try (double click on the desktop icon to install from the live version) and follow the simple instructions.
Comment: Lubuntu 12.04 has reached its End Of Life and is no longer supported.  Ubuntu 12.04 is still supported or you could install Lubuntu 14.04 which is the latest version.
Comment: You can use forcepae in 14.04.  When the menu comes up, choose F6 Other Options.
Comment: i don't have usb or cd yet, this is why i want to install without reboot. do you know anything about wubi?
Comment: You could partition your harddrive, (so you have about 8GB on one partition), then use unetbootin to install it on there, and finally boot from there, via the BIOS, instead of the removeable media. Then use the install wizard to install it on the big partition. look at https://wiki.ubuntu.com/WubiGuide#Installation for info on wubi.
Comment: @Rex added to post, I hadn't read that part of question, thanks for pointing out!
Comment: Also, I believe that Wubi install has been discontinued so that option is not open to you.
Comment: Wubi has some [limitations](https://en.wikipedia.org/wiki/Wubi_%28Ubuntu_installer%29#Limitations)...
Comment: @Rex I don't think it has been discontinued, but it still doesn't support W8 so it isn't especially up to date! I hadn't heard of it before, but at first glance, it seems quite a long way of doing the same thing...
Comment: @Rex my computer doesn't support Lubuntu 14.04, I tried to test it in ViruaLBox
Comment: @User3144605 how much ram do you have? And what is the intel?
Comment: i have 1 GB ram and AMD Sempron 2400+
Comment: Who told you it was unsupported? My computer has 1GB and an Intel celeron, and it works! It may be unsupported, but I think it will still work for you.
Comment: i get an error: I don't have PAE support ,  or something like this.
Comment: @user3144605 Ahh OK. Does 12.04 work without that though?
Comment: I know 12.04 don't need PAE. I have 1 GB RAM ,CPU AMD Sempron 2400+ , GPU RADEON 9250 and 80 GB HDD. Do you think Lubuntu 12.04 will work good?

Install Lubuntu 12.04 from Windows XP


requests.get and parse response to json

Question: As the title, I want "requests.get and parse response to json". Here are the ways I have tried to do this

Using request().json()

requests.get(url = "https://ac.dict.naver.com/linedictweb/ac?q=%E6%B5%B7&st=010&r_lt=000&q_enc=UTF-8&r_format=json&r_enc=UTF-8&_t=1599558293560&_callback=jQuery111104358648061767311_1599558261058&_=1599558261060",verify = True).json()
 =>Result: json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

2.Another Way
r = requests.get(url = "https://ac.dict.naver.com/linedictweb/ac?q=%E6%B5%B7&st=010&r_lt=000&q_enc=UTF-8&r_format=json&r_enc=UTF-8&_t=1599558293560&_callback=jQuery111104358648061767311_1599558261058&_=1599558261060",verify = True)
json.loads(r.content.decode('utf-8'))
=> RESULT: json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

Data Json here:
Help me to solve this problem. Thanks
Comment: The response isn't valid JSON; it's JSON wrapped in something else.
Answer: The jquery callback is wrapping the output. Get rid of the callback parameter in the url and you will get valid json:
r = requests.get(url = "https://ac.dict.naver.com/linedictweb/ac?q=%E6%B5%B7&st=010&r_lt=000&q_enc=UTF-8&r_format=json&r_enc=UTF-8&_t=1599558293560",verify = True)

r.json()
{
  "query": [
    "\u6d77"
  ],
  "items": [
    [],
    [
      [
        [
          "zh"
        ],
        [
          "597527adbb7248c3ae80d60b9acd7160"
        ],
        [
          "\u6d77"
        ],
        [
          " ocean; extra large"
        ],
    ...
}

Comment: The error above was obvious but I didn't realize it. I just removed "_callback = jQueryxxx" from the url. Maybe I was too nervous. Thank you so much.

requests.get and parse response to json


DWA 171 not working

Question: I have been using a DWA 171 dongle for quite some time and didn't have any issues with it.
I upgraded from Ubuntu 21.04 (Hirsute Hippo) to 22.04 (Jammy Jellyfish) today. Before I updated it, the dongle worked perfectly fine. But after the update was finished and restarted, it took some time to implement some stuff like dock appearance change, colour theme shift, etc, and after that, it restarted again automatically. This time, my DWA dongle was not working, the green light didn't glow.
I tested it on Windows, Mac and Kali, but it still didn't work. I tried using the df command to check the disks available, but the DWA dongle wasn't specified there. I surfed through a bunch of websites and tried using the lsusb command to see if it is being detected by the OS, and yes it did. Here is the output of lsusb:
$ lsusb
Bus 002 Device 003: ID 05c8:0223 Cheng Uei Precision Industry Co., Ltd (Foxlink) HP Webcam-50
Bus 002 Device 002: ID 8087:0024 Intel Corp. Integrated Rate Matching Hub
Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 001 Device 003: ID 148f:2000 Ralink Technology, Corp. CSR BS8510
Bus 001 Device 002: ID 8087:0024 Intel Corp. Integrated Rate Matching Hub
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 004 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 003 Device 013: ID 2001:331d D-Link Corp. DWA-171
Bus 003 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

Here you can find the D-Link Corp. DWA-171 device being shown. So please help me fix this issue.
Sorry for typing something this long, and thanks in advance!
Edit 1: Here's the output of dkms status:
$ dkms status
rtl8821CU/5.4.1, 5.13.0-40-generic, x86_64: installed

Edit 2: I fixed the issue, all I did was update the drivers by following the instructions here: https://github.com/morrownr/8821cu-20210118
Comment: "I tested it on Windows, Mac and Kali, but it still didn't work." It's no longer functional. I suggest that you check here for many working out of the box USB wireless devices: https://github.com/morrownr/USB-WiFi
Comment: Thanks everyone, I fixed the issue!
Comment: (1) D-Link Corp. DWA-171 is a common WiFi USB dongle, not an "extender". (2) If the same symptom - not working - happens with other OSes then it has nothinbg to do with one OS in particular. It's either the device itself or the USB that's defective (assuming the other OSes you mention run in the same computer; if another then definitely it's the dongle). Either way, this has nothing to do with Ubuntu.
Comment: Does the device work in a live session?
Comment: Edit your question and show me `dkms status`. You need a dkms driver to run the DWA.
Comment: @heynnema Here is the output of `dkms status`:                                                `rtl8821CU/5.4.1, 5.13.0-40-generic, x86_64: installed`
Comment: @ChanganAuto Thanks, I updated the question, I specified it as "dongle" at first but then I just thought that was akward.
Comment: @chili555 thanks!
Comment: @anonymous: you can put an answer by yourself, explaining the steps you performed
Comment: @LorenzKeel Thanks but I already know, I had NoScript turned on so I couldn't add an answer lol
Answer: I fixed the issue, all I did was update the drivers by following the instructions here: https://github.com/morrownr/8821cu-20210118
Comment: The link is dead

DWA 171 not working


How to configuring NTL library in Visual Studio 2010

Question: I am trying to configure NTL library in my first Visual Studio 2010 project. I am following the instructions from: http://www.shoup.net/ntl/doc/tour-win.html
I created a new Win32 project, named ntl.
Then, from Project -> Add Existing Items and selected all the files in the src file NTL library folder.
Then, I clicked in Project -> Properties -> Configuration Properties -> C/C++ -> Additional Include Directories and I selected the include directory in the NTL library folder.
Finally, I tried to Build-> Build ntl but I am getting error says (for every file in the src):
c:\program files\winntl-5_5_2\src\ctools.cpp(2): fatal error C1083: Cannot open include file: 'NTL/ctools.h': No such file or directory
1>  Generating Code...

Answer: Simple, follow this help step by step Compiling NTL.
You must be doing something wrong, follow the instructions step by step it will work.
Save NTL in a path like it : C:\Library\WinNTL-5_5_2, and follow instructions of site.
Answer: you probably don't need the answer for this question, but maybe for others who want to do it.
In Visual Studio (2010):

'File' -> 'New' -> 'Project...' (or Ctrl + Shift + N)
Choose 'Win32 Project' (located under 'Installed Templates' -> 'Visual C++'), I named it NTLlib, click 'Ok'
Click 'Next >', Application type: 'Static library', in Additional options: uncheck 'Precompiled header', click 'Finish'
Right-click on created project in Solution Explorer 'Add' -> 'New Item...', (or Ctrl + Shift + A) choose C++ File (.cpp) name it and click 'Add' (it is necessary to set the C/C++ settings)
Download the latest NTL library, extract it in your project
Right-click on your project go to Properties (or Alt + Enter) in 'Configuration Properties' -> 'C/C++', click on 'Additional Include Directories' from Dropdown menu choose edit -> 'New Line' (yellow Folder) -> set path to the downloaded NTL library include folder (no folder in include folder), click 'OK'
Right-click on your project in Solution Explorer 'Add' -> 'Existing item...' (or Shift + Alt + a), and select all files from downloaded NTL library in src directory click 'Add'
After loading all files at bottom left print VS ready, now click 'Build' -> 'Build NTLlib' and wait for 'Build: 1 succeeded'. Static library is created in Debug/Release folder.

For using the created library in another project just follow step 6., and set path to the created library folder: Right-Click on project -> 'Properties' -> 'Configuration Properties' -> 'VC++ Directories' -> 'Library Directories'/


MVC4 WebApi Controller Post Action with Dispose Pattern causes Multiple Actions Found Exception

Question: I think I've spotted a problem with the MVC4 WebApi Controller in conjunction with the Dispose Pattern. The problem is with the Post Action Method, the response is a description of the Exception:
Multiple actions were found that match the request:
Void Post(System.String) on type MVC4Api.Controllers.ValuesController
Void Dispose() on type MVC4Api.Controllers.ValuesController

The dispose pattern is sourced from this article. I've reduced the problem to just the boiler plate code below. Its worth pointing out that this problem does not occur with the Get method, I have confirmed it only with the Post method. Please try it out by Posting to the path /api/values.
public class ValuesController : ApiController
{
    public void Post([FromBody]string value)
    {
    }

    private bool _disposed;

    protected override void Dispose(bool disposing)
    {
        if (_disposed)
        {
            return;
        }

        _disposed = true;

        base.Dispose(disposing);

        if (disposing)
        {
            // dispose of dependencies
        }
    }

    public new void Dispose()
    {
        Dispose(true);
        GC.SuppressFinalize(this);
    }
}

My question is how can I call the Post Method? And what is causing this problem?
EDIT:
As the error is about routing I have added below the WebApiConfig which controls the routing. This is loaded as normal at start up in the Global.asax and has not changed since starting a new WebApi project.
public static class WebApiConfig
{
    public static void Register(HttpConfiguration config)
    {
        config.Routes.MapHttpRoute(
            name: "DefaultApi",
            routeTemplate: "api/{controller}/{id}",
            defaults: new { id = RouteParameter.Optional }
        );
    }
}

Comment: Is there a question you need answered?
Comment: Yes, how can I call the Post Method? And why does this happen?
Comment: The error is saying you have multiple post actions with that signature. Is what you posted the entire class?
Comment: Its the entire class. The route config involved is just the out-of-the-box created when opening a new MVC4 WebApi project. I'll post it for completeness.
Answer: Its much easier to understand the solution when you correctly interpret the error message: When making the choice to the request, the WebApi Action Selector cannot decide between the Dispose() and Post() methods. (Which seems pretty daft in itself). So the error is effectively asking us to help make this decision for it.
My preferred option is to use the NonActionAttribute class on the Dispose() Action method. This is a clear and transparent instruction to the Action Selector to not consider the Dispose method in deciding where to route the request.
[NonAction]
public new void Dispose()
{
    Dispose(true);
    GC.SuppressFinalize(this);
}

The other option is to change the accessor of the Dipose() method to protected, but that's just not as obvious.


Is my plan for mounting a child safety gate feasible?

Question: As seen in picture below, this sliding kitchen door is not long enough in width. Red arrows indicate how much it falls short.

I am thinking of drilling four holes and mounting with screws instead. Red circles indicate where screws are to be drilled in.

Then I will raise it up to ensure it is not touching the floor therefore have enough space to allow sliding. Red arrows indicate where I will hold it up.

Is my approach feasible?
Comment: That type of gate functions by swinging on the hinges, not sliding. The slide feature is just so that you can fit your opening. You'll soon get tired of sliding it to get in and out.
Answer: The metal brackets near the points of your red arrows are intended to be mounted to the wall and act as hinges for the entire gate. I would turn them 90° to the gate and mount them to the green cabinet where you had planned on using the screws. This will allow the gate to swing in one direction at least. You may not be able to swing it into the kitchen as it will bind. At least the gate will function as it was designed.


Use Hampton Bay in wall ceiling fan remote with Harbor Breeze fan?

Question: Edit
I have a Harbor Breeze fan that I lost the remote to. I bought a universal remote that Hampton Bay makes (advertised to work with any fan according to an employee) that can be mounted in a wall plate yet doesn't require wires to the fan and runs off of batteries. The issue is that the Hampton Bay remote uses dip switches and the Harbor Breeze fan uses "smart pairing" by hitting a learn button on a remote.  I looked through both of the manuals and I couldn't find anything helpful in either one.  Is there anyway to get this remote to work with my fan or do I have to find another one?
Fan: https://www.lowes.com/pd/Harbor-Breeze-Merrimack-52-in-Antique-Bronze-Indoor-Outdoor-Downrod-Mount-Ceiling-Fan-with-Light-Kit-and-Remote/4165863
Remote: http://www.homedepot.com/p/Hampton-Bay-Ceiling-Fan-Wall-Control-9050H/202801200?cm_mmc=Shopping%7CTHD%7CG%7C0%7CG-BASE-PLA-D27L-CeilingFans%7C&gclid=EAIaIQobChMI2p_43OGR1gIVAotpCh06OQMQEAQYASABEgIcqfD_BwE&gclsrc=aw.ds&dclid=CIuSn-DhkdYCFUa1swodBC4Ipg
Answer: The switch comes with the fan control you need. You have to replace the fancontrol from the fan with it. I'll include a pic highlighting the part I talking about.


Can't find/delete installed application

Question: I am going mad as I can't find a WhatsApp package that I want to uninstall. It apparently is not installed with snap, can't be located using grep, dpkg, which, and the path identified in the process menu doesn't exist.
Here is a screenshot of the process overview. Only the WhatsApp version I'd like to uninstall is running.

Other than that the app works fine, I just want to use another one that loads faster. The logo is the normal WhatsApp one.
I have some similar problems with different ubuntu-versions of the same applications which I would like to uninstall. Where are they saved?
Comment: What version of Ubuntu are you using?
Comment: The path `/app/bin/` in your image suggests Flatpak.
Answer: If you did not install the package using a package manager - by default either traditional APT and snap on Ubuntu, then you are the only person on earth that can tell us how you installed it. How you can remove a manually installed app depends on how it has been installed. Since you tell you are planning to install "a version that loads faster", you seem to know what you are doing. We cannot.
The path listed in the command line that runs the application indeed suggests this is an application that does not follow the distribution's standard. It shows that the command to run the package is the shell, "sh", followed by a file name /bin/sh /app/bin/whatsapp-desktop-linux, which, in order to be run with sh, must be a shell script. /app is not at all a conventional directory to store manually installed applications. Typically, such applications are installed under /opt.
With respect to "similar versions", that only can happen indeed when manually installing applications, or when installing an application both using APT and snap.

Can't find/delete installed application


Trouble getting ElectronPlayer to work on Lubuntu

Question: I been trying to get ElectronPlayer(for Netflix) to work on Lubuntu, it does seem to install successfully but I cannot find where it installed to open it, and when trying to open it via the terminal, it doesn't open.
I was able to get ElectronPlayer to work on Ubuntu with no problems, but I really prefer to use Lubuntu.
Any help would be greatly appreciated.
Edit:
I am using Lubuntu version 19.04 and tried the Discover Software Center to install ElectronPlayer.
I also do not have much experience with Linux.
Thanks,
David
Comment: Telling us your release of Lubuntu maybe useful; Lubuntu 18.04 LTS uses LXDE, where as Lubuntu 18.10 upwards use LXQt.  How did you install ElectronPlayer also?  Snap (https://snapcraft.io/electronplayer) or other?
Comment: if you install chrome downloaded from google netfilx will just work
Comment: you could try a couple things to find it... try something like `ls /usr/bin |grep -i electron` or if you install locate then you can easily search your drive for the application... if you want to get really old school you could use "find" (`man find`) but I find it very slow
Answer: Relative to what ships with 19.04, you need to upgrade to snapd 2.39.2+19.04 for Electron Player to show up in the "Other" category of the menu. Additionally, this upgrade will need to be in place in order for a functional version of Electron Player (2.0.7 rev 9) to be installed correctly.
Oddly, upgrading snapd in Discover does not seem to provide the fix, so to upgrade snapd:

Open System Tools → Qterminal
Enter sudo apt update && sudo apt -y install snapd and press Enter
When asked for your password, enter it and press Enter

While you're there you can easily install Electron Player from the terminal:

Enter sudo snap install electronplayer and press Enter
Enter your password if asked and press Enter
When completed, run it by entering electronplayer and pressing Enter

Since you already have Electron Player installed, you could upgrade snapd as above, but you would still face problems if you try to run Electron Player:
(electronplayer:2917): Gtk-WARNING **: 00:15:17.454: cannot open display: :0

To ensure that everything is working correctly, remove then install Electron Player: sudo snap remove electronplayer && sudo snap install electronplayer.


form-inline form-group doesn't work

Question: In the html below I can't get inputs in one row, despite using "form-inline" and label class="sr-only". I tried many different things, no sucess
  <form class="form-inline">

            Firewall hostname
            <input type="text" ng-model="hostname" class="form-control input-lg" id="hostname"
                   placeholder="Firewall">

            Firewall subnet
            <input type="text" ng-model="subnet" class="form-control input-lg" id="subnet">

  </form>

Comment: hm..I think I had bootstrap.min.js instead of css in my html..You helped me to fix it, I can accept you answer if you want
Comment: If I really helped You it would be nice.
Comment: lol my style.css is empty right now. I use bootstrap
Answer: So Your HTML code contains only empty classes.
write in Your css file:
.form-inline{
    display:inline-block;
}

and should be good :)
classes (and id's) do something ONLY if You previously declared their behaviour.

form-inline form-group doesn't work


Stirling numbers of the second kind $S (r,k)$ - does one ever sum over $r$?

Question: A Stirling number of the second kind, $S (r,k)$, is defined to be the number of ways one can partition an $r$-element set into $k$ subsets.
Consider the following problem:
You have $r$ distinguishable balls and $n$ undistinguishable boxes. If you are allowed to place balls into these boxes with no restrictions, how many different ways of doing so are there?
The anwser is $\sum_{k=1}^{n} S (r,k)$.
You can nicely use this model for many combinatorial problems.
I would like to ask if anyone has seen, or knows of a problem where one would sum over $r$ instead, i.e. where something like $\sum_{k=i}^{j} S (k,n)$ would appear.
This just a general interest question; it came up in a combinatorial methods class. Many thanks for any anwsers/comments.
Comment: Sure: it's the number of ways to place an unspecified number of distinguishable balls from i to j into n _non-empty_ indistinguishable boxes.  (You need this constraint in your definition.)
Comment: not a combinatorical relation; but since the Stirlingnumbers can be described by a finite composition of powers (or binomials?) one can define divergent sums and assign (hopefully) meaningfully values. (But don't know whether this matters here at your question, so I keep this just a short comment so far).
Comment: Any idea on what is the sum of k*S(n,k) over k from k=0 to k=n?
it is the convolution of the stirling numbers of the second kind with the integers.
thank you!
Comment: @par: you are better off posing this as a new question than as a comment on an existing one.
Answer: There are actually lots of interesting uses of the column sums of the Stirling numbers of the second kind $\left\{ n \atop k\right\}$.  The ordinary and exponential generating functions both have nice forms (nicer than those for the row sums):
$$\sum_{n=k}^{\infty} \left\{ n \atop k\right\} x^n = x^k \prod_{j=1}^k \frac{1}{1-jx},$$
$$\sum_{n=k}^{\infty} \left\{ n \atop k\right\} \frac{x^n}{n!} = \frac{(e^x-1)^k}{k!}.$$
These can be used to prove various identities involving $\left\{ n \atop k\right\}$.
Multiplying $\left\{ n \atop k\right\}$ by certain other interesting numbers before summing also yields some nice identities, such as these:
$$\sum_{r=k}^n \binom{n}{r} \left\{ r \atop k\right\} = \left\{ n+1 \atop k+1\right\},$$
$$\sum_{r=k}^n k^{n-r} \left\{ r-1 \atop k-1\right\} = \left\{ n \atop k\right\},$$
$$\sum_{r=k}^n \left[ n \atop r\right] \left\{ r \atop k\right\} = \binom{n}{k} \frac{(n-1)!}{(k-1)!} = L(n,k),$$
where $L(n,k)$ is a Lah number.  (Lah numbers also show up in the answer to this recent question: $n$th derivative of $e^{1/x}$).
Column $k$ is also used to convert reciprocal falling factorial powers $x^{\underline{-k}}$ to ordinary reciprocal powers $x^{-n}$ via
$$x^{\underline{-k}} = \sum_{n=k}^{\infty} (-1)^{n-k} \left\{ n \atop k\right\} \frac{1}{x^n},$$
in a sort of inverse to the fact that row $k$ is used to convert ordinary powers $x^n$ to falling powers $x^{\underline{k}}$.
A good reference is Chapter 8 of Charalambides' Enumerative Combinatorics.
Comment: Thanks you for the very nice anwser! I'll be sure to check out that book.


Can't redirect to another page after form submit

Question: I have created a form and when the form is submitted it get the value of selected radio button and store in db, then I tried to redirect to another page but the result is that the current page is refreshed without update radio button value even if the value in the db is change, if I go to another page and return in the radio buttons page, the value are updates. How I can redirect to another page?
This is my code:
<?php foreach( $users as $user ): ?>

                    <?php echo $user["username"]; ?>
                    <?php echo $user["role"]; ?>
                    <a href="delete_permission.php?idTratta=<?php echo $idTratta; ?>&user=<?php echo $user["username"]; ?>">Elimina permessi utente
                    <form action="" method="post">
    <input type="radio" name="<?php echo $user["username"]; ?>"  value="1" <?php if ($user["role"] == 'configuratore') echo 'checked="checked"'; ?>" />C

    <input type="radio" name="<?php echo $user["username"]; ?>"  value="2"<?php if ($user["role"] == 'visualizzatore avanzato') echo 'checked="checked"'; ?>" />VA

    <input type="radio" name="<?php echo $user["username"]; ?>"   value="3"<?php if ($user["role"] == 'visualizzatore') echo 'checked="checked"'; ?>" />V <input type= "submit" name="sub_<?php echo $user["username"]; ?>"value="Cambia"/></form>
                <?php
                   $sub='sub_';

                   if($_POST[$sub.''.$user["username"]]){
                   $permission=$_POST[$user["username"]];
                   $SimpleUsers->updateUserPermission($user["username"],$idTratta,$permission);
                   header('location: tratte.php' );
                   exit();
                  }
                 ?>

                <?php endforeach; ?>

Comment: @KaushaMehta I can see it... on line 6...
Comment: Add you full code here, i can't see the  tag in your code.
Comment: @stwalkerster Omg sorry!
Comment: You didn't write the filename in form action that means on submit it redirects to current page. If you want to redirect it to another page then you have to write the name of file in action.
Comment: @KaushaMehta The asker is doing a header() call, so I suspect the intention is to use a Post-Redirect-Get pattern, which is nicer from a UX point of view anyway.
Answer: PHP's header("Location:FILE_NAME.PHP") won't work if there is any output written from the script, even a single space.
In your case, you are printing HTML (output), so, redirection is not working.
Solutions:
1) Add ob_start() at the very start of the page. This will store your output to buffer and redirection will occur.
2) Use Javascript redirection. Javascript redirection will occur irrespective of whether you are outputting something on browser or not.
Code:
$SimpleUsers->updateUserPermission($user["username"],$idTratta,$permission);
echo "";
//header('location: tratte.php' );
exit();

Answer: In form you write like <input type="radio" name="<?php echo $user["username"]; ?>" and in PHP write like if($_POST[$sub.''.$user["username"]]){ the both name are different.
Replace <input type="radio" name="<?php echo $user["username"]; ?>" with <input type="radio" name="sub_<?php echo $user["username"]; ?>"
Thanks!


Where should I inject bleach into a well with a pressure tank?

Question: Our pump works fine, but I do want to shock it after detecting some coliform. Thing is, I have no idea where to pour the bleach, there doesn't seem to be a simple well cap. I had my septic tank guy take a look as a favor, and he couldn't spot it either. Is it possible to DIY a well shock with a unit this old, or do I need to hire a professional to do this?
Comment: By the way, when you *do* get to replacing it, consider a submersible pump. Jet pumps are a hold-over from an era when electric motors were much less reliable, and are significantly less efficient at turning electricity into water pumped. But as long as it works, might as well use it.
Comment: Picture of the other side of the pump? It's clearly a deep-well jet (two pipes down the well) so it must have a priming port on the pump - into which you can pour your bleach solution. But I can't see that port in the one picture provided. You should take a few minutes to clean up and/or dispose of some of the scary and code violating wire issues visible in this picture, as well.
Comment: Thank you for the advice! The wires are pretty creepy, as I'm mostly not sure what is vestigial and what is in service. I'll see about getting another picture up this afternoon.
Comment: Okay! Two more pics added. I'm not sure I see anything useful, but I'll leave it to you. Could that coupling at the top be it?
Comment: Not the angle I'd like for seeing the other side of the pump, but the top down view appears to show a square plug that might be in the right general area. On the other hand, why do I see two pressure switches and the cover of a third one lying on the ground? That is some weird wiring indeed. And the plumbing to the pressure switch that's on the motor is coming from whatever the heck that is poking out the top of the pump - looks like a half disassembled regulator. Which MAY be in the hole you need. Or it may have the hole you need in it, plugged...
Comment: Please clear up where the wires that go to and from the pressure switch near the blue tank go, and if the wires to the pressure switch on the pump visible in front of it are the same ones we can see disconnected. Can't trace the cables in that mess in these pictures.
Answer: Appears to be a Myers HC/HCM deep well jet pump.
The operating manual appears to be this one, but it shows that regulator on top as a functional thing with a pipe coming out of it, so your plumbing is truly weird at this point.
It mentions priming through a 1/2" plug on the regulator body - which might be the one on top of that.
It's also noted that the pipes to the well are attached by a flange, so the flange and be unbolted to access the pipes without having to unscrew the pipes. That would be another possible way to get chlorine solution into the well.
But the 2 pressure switches and parts of a third are confusing, and where, exactly, water is coming out of the pump into your pressure tank is not clear, since the pump manual shows it as coming out that regulator on top of the pump, and the pipe to the tank  just vanishes into the ground with no apparent connection to the pump. So I begin to wonder if this pump is even the pump (and well) you are actually using at this point? There's a mess of wires, some disconnected, making it unclear if it's even connected to power...
My best guess is that the well and pump we can see here may be decommissioned, and a deep well submersible pump is down some other well that the pipe and the wire from the pressure switch that's near the blue pressure tank are connected to.
Comment: The rusty old "Myers" pump is clearly not in service. The output is connected to nothing!


How to get data from ListView. (My List View has 3 items)

Question: I want retrieve the data from the Listview, where my list is having 4 items like, name, date, sem, category.
i want to read the text present in the list view and pass it to another activity.
Comment: What you tried?post it
Comment: Is your data in ListView are JsonData or Static data? Show your code.
Comment: ListView gets its data from an adapter.  To get to the data, its helpful to know what type of adapter you used.  As well as the code for the getView method of the adapter, to know what type of Views the ListView is displaying.  Finally, please clarify if you want "all data" passed to the new activity, or just the data you clicked on.
Comment: my ListView is having 4 textview elements, onItemClickListener() must have to give the data in each textview
Comment: @Piyush it's an Json data read from the webpage.
Comment: @PunithK i can only help once you post your adapter type, o/w i'm making significant assumptions.  I'm pretty sure that's true for any answer you receive.
Answer: If you are retrieving your data from server then you need to get item on item click of ListView. Like
  listview.setOnItemClickListener(new OnItemClickListener() {
            public void onItemClick(AdapterView<?> parent, View view,
                int position, long id) {

              String name =urarraylist.get(position).get("name");// here you have to pas keyname which is put inyour Hashmap arraylist
              String category =urarraylist.get(position).get("category");
              String date=urarraylist.get(position).get("date");
              String sem=urarraylist.get(position).get("sem");
              Intent i = new Intent(getBaseContext(),anotheractivity.class);
              i.putExtra("name", name);
              i.putExtra("category ", category );
              i.putExtra("date", date);
              i.putExtra("sem", sem);
              startActivity(i);
            }
        });

Now retrieve this data in your next Activity on onCreate() method. Like
       Intent n = getIntent();
       String name = n.getStringExtra("name");
       String category = n.getStringExtra("category ");
       String date= n.getStringExtra("date");
       String sem= n.getStringExtra("sem");

Comment: Thanks a lot dude.. I tried the one u have given. Just i tried it. it's working. Love your support..
Answer: As it's name suggest, a ListView doesn't contains data, it only contains Views. These views are often created from an array or a List via an Adapter. So you have to ask your adapter to retrieve the data.
Unfortunately there is no default method for that, so you'll have to create your own getter, or you can also loop on the getItem() method associated with the getCount() one on your ListView's adapter.
Comment: He can retrieve the ID and query the DB or faster would be to iterate the adapter.
Answer: listview.setOnItemClickListener(new OnItemClickListener() {
                public void onItemClick(AdapterView<?> parent, View view,
                    int position, long id) {

                 String name=(String)parent.getItemAtPosition(position);
                  Intent i = new Intent(getBaseContext(),anotheractivity.class);
                  i.putExtra("USERNAME", name);
                  startActivity(i);
                }
            });

if you click the listview row the value from corresponding position will be fetched and passed to intent and further to  next activity.
The magic lies here:
 String name=(String)parent.getItemAtPosition(position);

Comment: if you click the listview get the value from corresponding position and intent the value into nextactivity
Comment: down voters please leave the comment,what mistake i did here?
Comment: list.setOnItemClickListener(new AdapterView.OnItemClickListener() {

public void onItemClick(AdapterView parent, View view, int position, long id) {
Intent i = new Intent(DeptEvents.this, ShowDeptEvent.class);
i.putExtra("sem", sem.toString());
i.putExtra("date",date.toString());
i.putExtra("desc", desc.toString());
i.putExtra("name", name.toString());
i.putExtra("dept", dept.toString());
startActivity(i);
} });
Comment: In the above code i want to pass the each position textview to next activity.
Comment: Removed the Downvote after editing the question and explaining what your code does.
Comment: @PunithK its not possible to move full listview into the another activity at a single click
Comment: @Boopathi on clicking listview, can i get at least, the each textview present in the listview.
Comment: The default implementation on a baseAdapter is to return NULL on getItem.  Idk if this will work on an ArrayAdapter, but OP never stated his adapter type.


emacs - show help and message buffer in current window or in separate frame?

Question: I have been working with emacs in a semi-full-screen configuration where my frame is 160 chars wide and as tall as the screen. In this layout I have my windows split in a certain way that I like. I wonder if there is a way to make help files and messages (e.g., the output when I run an asynchronous shell) pop up either in the same window where my (point) is located when I invoke help or the shell command, or in a separate frame so as not to disturb my window layout and the buffers contained in them? I have tried elscreen and winner-mode; the latter does restore my window layout but requires me to cycle through windows to close the help or message buffer (rather than C-x k on the spot, it if was in the same buffer)...
Thanks, Stephen
Answer: You'll have to roll your own (sounds like you have some pretty specific ideas on what you want).  All the information you need to get started can be found on the "Choosing Windows" section of the elisp manual.  It sounds like same-window-buffer-names and/or same-window-regexps and same-window-p will give you what you want, though these others might fit the bill: special-display-buffer-names, speical-display-regexps, special-display-function, display-buffer-function.
Comment: Yes! same-window-buffer-names and same-window-regexps are the functions I wanted. Thanks!!
Comment: and '(pop-up-windows nil) also - all there on that delightful page.
Answer: See One-On-One Emacs for code that implements a special-display *Help* buffer -- IOW, *Help* pops up in its own frame.
The code is here:
http://www.emacswiki.org/emacs/download/oneonone.el
See this part:
  ;; *Help* frame
  (if 1on1-*Help*-frame-flag
      (add-to-list
       'special-display-buffer-names
       (list "*Help*" '1on1-display-*Help*-frame
             (list (cons 'background-color 1on1-help-frame-background)
                   (cons 'mouse-color 1on1-help-frame-mouse+cursor-color)
                   (cons 'cursor-color 1on1-help-frame-mouse+cursor-color)
                   '(height . 40))))
    (setq special-display-buffer-names
          (remove-if (lambda (elt) (equal "*Help*" (car elt)))
                     special-display-buffer-names)))


"The following classes could not be found" with custom Kotlin view in layout

Question: I'm running into a problem including a custom Kotlin view in an XML layout file. Here's the code:
class CustomView: RelativeLayout {

    /**
     * Programmatic constructor
     */
    constructor(aVariable: Boolean, context: Context): super(context) { ... }

    /**
     * XML constructor
     */
    @JvmOverloads
    constructor(context: Context, attributeSet: AttributeSet? = null, defStyle: Int = 0): super(context, attributeSet, defStyle) { ... }

}

and the XML:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    tools:context=".MainActivity">

    <android.support.v7.widget.RecyclerView
        android:id="@+id/recyclerView"
        android:layout_width="match_parent"
        android:layout_height="match_parent" />

    <com.turingtechnologies.materialscrollbar.CustomView
        android:layout_width="wrap_content"
        android:layout_height="match_parent"
        android:layout_alignParentTop="true"
        android:layout_alignParentRight="true"
        android:layout_alignParentEnd="true" />

</RelativeLayout>

Then the layout previewer complains:
"Missing classes-
The following classes could not be found:
com.turingtechnologies.materialscrollbar.CustomView (Fix Build Path, Edit XML, Create Class)"
Note: This is AS 3.0 beta 3
Comment: What's the behavior on a stable AS release?
Comment: @MaximOstrovidov I will look and let you know
Comment: Code seems fine. It might just be some lags by AS. Try "clean -> rebuild" or invalidate caches.
Comment: @GeorgySavatkov I've done both
Answer: Confirmed bug https://issuetracker.google.com/issues/62255811. Fix should appear in the next release of Android Studio.


Is there a way to alter Powershell's environment path based on the current working directory?

Question: So I have a code repository with some utility scripts under a Scripts folder. Whenever I want to run the utility script, I have to type:
./scripts/someScript.ps1 someParam

Is there a way for me to set the env:path so I only need to type:
someScript someParam

But only when the working directory is part of my local repository? So for example it would work when I'm in:
c:\code\project1
c:\code\project1\source

but not in
c:\code
c:\code\project2

Thanks!
Comment: To do this I'm pretty sure you need to extend(proxy function) `Set-Location` with custom code that checks the current path `$pwd` and modifies the sessions enviroment variable if you're inside the specific folder.
Answer: As @graimer mentions you can create a proxy function to override the default Set-Location (and cd) behavior.   However an easier approach might be to just create some aliases.  I do this to make sure I get a specific version of msbuild e.g.
New-Alias msbuild4 c:\windows\microsoft.net\framework\v4.0....\msbuild.exe

Comment: Thanks! A proxy function seems really neat but an alias only takes 2 seconds to write, so I'll go with that for now.


How do I Handle multiple XSLT copy statements on same match?

Question: Are there any XSLT statements that will execute in consideration of other XSLT statements within the same stylesheet?
For example, if I have two copy statements matched to the same node (but only desire one copied node that contains the modifications declared in BOTH copy statements) is there a statement that will do this?
Assume that I cannot put all the transformations in one copy node, but instead have to use two or more.
---Clearer example---
//XML
<toy></toy>

//XSLT
<xsl:template  match="toy">
<xsl:copy>
    <xsl:attribute name="label">SOME TOY</xsl:attribute>
</xsl:copy>
</xsl:template>

<xsl:template  match="toy">
<xsl:copy>
    <xsl:apply-templates select="@*" />
      <xsl:element name="range">
        <xsl:element name="min">200001</xsl:element>
        <xsl:element name="max">999999</xsl:element>
      </xsl:element>
</xsl:copy>
</xsl:template>

My desired result would be a new toy node that is copied to a new file that has both things applied to it, so something like:
<toy label='SOME TOY'>
  <range>
    <min>200001</min>
    <max>999999</max>
  </range>
</toy>

Not two different copies
Is this possible?  Is there some way I can redo the first template so that will make this one outcome?
Comment: What statements are you talking about? Could you update your question with XSLT version you use, add XSL code and example of expected result?
Answer: There is rule in XSLT specification, which forbid this - Conflict Resolution for Template Rules.
If node fits several templates - only one template will be executed - in relation to the template import precedence, priority or document order, etc.
But you can separate it with named templates:
<xsl:template match="toy">
  <xsl:call-template name="toyAttribute" />
  <xsl:call-template name="toyElements" />
</xsl:template>

<xsl:template name="toyAttribute">
  <xsl:copy>
    <xsl:attribute name="label">SOME TOY</xsl:attribute>
  </xsl:copy>
</xsl:template>

<xsl:template name="toyElements">
  <xsl:copy>
    <xsl:apply-templates select="@*" />
    <xsl:element name="range">
      <xsl:element name="min">200001</xsl:element>
      <xsl:element name="max">999999</xsl:element>
    </xsl:element>
 </xsl:copy>
</xsl:template>

Update:
If you asking about only updating <toy> node with attribute and elements you don't need separate templates:

<xsl:template match="/toys/toy">

    <xsl:copy>

        <xsl:apply-templates select="@*" />

        <xsl:attribute name="label">SOME TOY</xsl:attribute>

        <xsl:apply-templates select="node()" />

        <xsl:element name="range">
            <xsl:element name="min">200001</xsl:element>
            <xsl:element name="max">999999</xsl:element>
        </xsl:element>
    </xsl:copy>
</xsl:template>

<xsl:template match="@*|node()">
    <xsl:copy>
        <xsl:apply-templates select="@*|node()"/>
    </xsl:copy>
</xsl:template>

which for XML:
<?xml version="1.0" encoding="UTF-8"?>
<toys>
    <toy name="a">
        <toy-part/>
    </toy>
    <toy name="b">
        <toy-part/>
    </toy>
</toys>

will give following result:
<?xml version="1.0" encoding="utf-8"?><toys>
    <toy name="a" label="SOME TOY">
        <toy-part/>
        <range>
           <min>200001</min>
           <max>999999</max>
        </range>
    </toy>
    <toy name="b" label="SOME TOY">
        <toy-part/>
        <range>
           <min>200001</min>
           <max>999999</max>
        </range>
    </toy>
</toys>

Comment: So even though there are two COPY statements, it won't try to copy the stuff previously in the Toy node twice?  For example,  may already have several children with data in it.  That must be copied first, AND then the new templates must be applied (adding attributes and some other data)
Comment: Perhaps you wouldn't have both copy statements then?  Only one would be needed, and then the toyAttribute template could just have the xsl:attribute statement in it?
Comment: @PetrakovichJ - I've updated code block. Probably I misunderstood question, what you going to achieve - add to every  node new attribute and elements?
Comment: What I mean is that I MUST have two separate templates because they get generated at different times, but they only affect one toy node, so I needed a statement that allows me to dynamically add more templates to be applied to the one toy node.  Call-templates seems to do that for me.


How to ask "sbt-idea" plugin not download the sources of plugins when running `gen-idea sbt-classifiers`?

Question: With the help of sbt-idea, I can generate files for Intellij-idea.
And using this commands, I can download the source-jar and doc-jar for all the dependencies:
<code>gen-idea sbt-classifiers
</code>
But it will try to download the source-jar for the plugins also. Sometimes when I use a global snapshot sbt plugin, like:
<code>"com.github.mpeltonen" % "sbt-idea" % "1.7.0-SNAPSHOT"
</code>
Sbt will try to download the source of it even I don't need it in current project. The problem is it very slow to download it, often spend more than 30 seconds in my country, so I want it not to be downloaded.
Is there any way to let sbt not download the source-jar files of sbt plugins, or the one I specify here?
Answer: run this in sbt:
gen-idea no-classifiers


Auto_html says block not supplied

Question: I have a website that allows users to post links. I am trying to get the soundcloud links to embed the mediafile thus I am attempting to use AutoHtml Gem. I did gem install Autohtml, put it in my gemfile and in config/application.rb and ran bundle install. Why isn't Auto_html() working.
GEMFILE

source 'https://rubygems.org'

gem 'rails', '3.2.8'
gem 'bootstrap-sass', '2.0.4'
gem 'bcrypt-ruby', '3.0.1'
gem 'faker', '1.0.1'
gem 'will_paginate', '3.0.3'
gem 'bootstrap-will_paginate', '0.0.6'
gem 'jquery-rails', '2.0.2'
gem 'pg', '0.12.2'
gem 'rails_autolink', '~> 1.0.9'
gem 'rinku', '~> 1.5.0', :require => 'rails_rinku'
gem 'auto_html', '1.6.0'

CONFIG/APPLICATION.RB

require File.expand_path('../boot', __FILE__)

require "active_record/railtie"
require "action_controller/railtie"
require "action_mailer/railtie"
require "active_resource/railtie"
require "sprockets/railtie"
require "rails_autolink"
require "rails_rinku"
require "auto_html"

VIEW/MICROPOSTS/_MICROPOST.HTML.ERB

<% if micropost.url.include? 'soundcloud' %>
  <%= auto_html(micropost.url)  %>
<% end %>

Sorry for the ignorance I'm new to Ror I appreciate the help. I only want to Auto_html here for soundcloud in particular. What am I forgetting to do?
Answer: It is helper method, so you'll need the following lines:
# app/helpers/application_helper.rb

module ApplicationHelper
  include AutoHtml
end

# app/controllers/application_controller.rb

class ApplicationController < ActionController::Base # or something like that
  helper ApplicationHelper
end

Edit if you read the page, there's an example block given: https://github.com/dejan/auto_html
auto_html(str) { simple_format; link(:target => 'blank')
For soundcloud use
auto_html(str) { soundcloud }
Comment: I needed to put auto_html(micropost.url) {soundcloud}
Comment: +1 Thanks for this! Is there a way to add multiple filters including Soundcloud? The solution only allows for one filter. For some reason simply adding soundcloud to the model doesn't work. Soundcloud only works with your solution but then it can't be combined with other filters. I created another question for this: http://stackoverflow.com/questions/13831490/auto-html-says-block-not-supplied

Auto_html says block not supplied


create hasMany or one to many relationship from a pivot table - Laravel

Question: I have 3 Tables:
Companies
Products
Images
Now, Companies and Products are Many to Many relationship.
Meaning, 1 company can have many products and a product can belong to multiple companies. So, I have a pivot table called companies_products with pivot or additional columns such as: price, discount, status, etc...
Note: Products table represents only common-data, that is, it does not have price, status, etc... product is only complete with pivot cols because that is how it makes a product unique to each company.
Everything is fine until here. Now because pivot table represents a unique product cols for each company. I also want to attach product-images table to this pivot table. Which means, my structure would be each pivot row hasMany product_images.
But in Laravel I guess pivot tables does not have a model, it is not encouraged to do so. Then how to achieve has-Many with pivot table?
Or any better solution to structure my tables or data?
In summary,
I have 1 companies table and 1 products table (unique).
companies create final product by adding extra data and images(array). I can handle extra data which goes as a pivot cols but not images (which in this case is array of images. I cant have 1 to many directly at products table level because each company adds a product with extra data to it.
Answer: You can define a model for a pivot table. It's covered in the Defining Custom Intermediate Table Models of the docs. To do this, the class of your model should extend:
Illuminate\Database\Eloquent\Relations\Pivot
instead of
Illuminate\Database\Eloquent\Model.