Tag: technology

Copying Text To The Clipboard In Pure Javascript

So sometimes you want to be able to just copy text to the clipboard in a web page. This can be more difficult that you first assume. There are going to be two main steps for this process. First, selecting the text that you want to copy to the user’s clipboard. There is no way around this due to the way that the second step works. The second step is copying the selected text to the user’s clipboard.

Alright so with a little bit of googling we can find that there is the Javascript function.


This line of code very quickly copies any selected text to the clipboard but first, we have to select the text to copy it. This is where most of the work comes in. The basic select and copy code will look something like this. Well, that’s it. You can change and edit the little bit to fit your needs but that is really the core of it. Select the text then copy it.


Restoring Backups. (For Bitcoin and Ethereum)


Holy shit. I’ve just had the biggest headache of my life. Well probably not but still it helps get my point across. So like the dumb little shit I am I let my main Windows hard drive on my desktop get full. Now this absolutely killed my OS it was not able to boot even a little bit. BSOD every time. Now normally this wouldn’t be a huge issue but as you can tell I had my Bitcoin and Ethereum wallets on my desktop. Luckily I had kept backups for both of them. Unluckily the backups were not as straight forward to recover as most people on the inter webs like to get across. So to hopefully save someone going through the same thing that I am avoid the pain the in ass the I did I’m going to make this guide on how to guarantee restore your Bitcoin and Ethereum wallets when your shit hits the fan. Just a note before we get started this is for Bitcoin core and Mist wallets, no idea if this guide will carry other to other wallets but fuck it. If either of these guides help you get your wallet back I think I deserve a finders fee ;3

BTC: 19MonvyYaD4D2xcXAVJrcyyhshPYaVrWM6

ETH: 0x79367533f3fE51D94d0C08a203D77c44aaC40159


Alright lets get started with the bigger one Bitcoin. Now for the most part this one is the easier one (for me it was). When you backup your wallet you should have a file .dat just for now I would reccomend renaming it to wallet.dat as that’s what Bitcoin expects it to be called. Oh and just a note that we can get cleared from the get go, the Bitcoin data directory is where all the info for Bitcoin core is stored namely the block chain. Core should have asked you where to put this when you first installed it. If you have it grab the file called wallet.dat from that directory. Not everyone is going to have the folder that I’m showing down there but if you do it will be the most up to date backup you have.


So now that we are past all the it’s time to get your wallet back up and running. So first things first. Get bitcoin core installed and all set up, not sure if you have to download the block chain before going on but I did. So once you have all that done and good it’s time to restore you wallet. First we are going to want to find where your data directory is for the current installation. Go into Bitcoin GUI and go help > debug window, once you are there you should see the image below.


Then just go to the directory that you have in the spot that I circled, shutdown bitcoin core and then replace the wallet.dat file with the one that you have from your backup. Start bitcoin back upand it’s all done. If your wallet.dat file was out of date you may be missing some stuff. But if you don’t have a more up to date wallet file there I can’t help you with that (sorry).


Now this one, oh boy. Much harder at least for me WAY harder (This was because I messed with a program called AlethZero and it messed up how Mist worked). So if your situation was anything like mine your backup for your Ethereum wallet looked something like this.


Now for anyone that doesn’t see this and just has the files from keystore you should be able to back those up just by dragging them back into the folder called keystore in your new install or something like that, I honestly have no clue but it should be easier than what I had to go through. If you shit is anything like mine (god bless your soul) what you have to do is a little different. If you already have Mist installed, get rid make sure any of the stuff you don’t want to lose from that install is save and just uninstall it. Once you have done that press the windows key and type %Appdata% and hit enter. This will open explorer if you see a folder called Ethereum go into it, if you don’t make the folder and then go into it. Delete everything inside that folder and put all the files that I showed you from above. Once you have that done reinstall Mist, it should scan these files and get your accounts from it. OK once you start Mist back up if you have your money back YAY. But if you were like me you were confused to see why your wallet contract wasn’t there. To get this back you need to have the account that first made the wallet contract.

First we need to get the adress to your wallet. The way that I did this was by using this website. It allows you to see what type of transactions are going on in the block chain. For us it’s going to let us find the address of our wallet that we lost. First copy the address of the account that made the wallet and put it into the search bar in the website. Once you do that you should see the transaction history for that account. For me it looked like this.


If you were wondering the reason I blacked it out is because I’m poor and I don’t want you too see that ;(. So the address that I circled was my wallets address. Once you have this go into Mist and click on the account that made your wallet. The click on the link shown below.


Once you click that you should see the interface to make a new wallet. Name this one whatever you want it doesn’t matter. The main thing you want to do is click the little radio button where it says Import Wallet. The just enter the address in the text box and click Create. Now for me this didn’t work at first, when I clicked the button it did nothing, I still have no idea why but after a while it did. And BOOM you have your wallet back, with all the Ether in it too.

Well that’s it for me at this point I was on cloud 9 oh man it was such a relief. If this helped your get your money back then your welcome, just make sure to make more backups next time. Me and you both could follow that rule a little better ;P