Tuesday, October 19, 2021

download db from heroku

 If you are using heroku with postgres, here is how to download dthe dump

user@pc MINGW64 ~/tmp/jdl2 (main)
$ heroku pg:backups:capture
Starting backup of postgresql-reticulated-07948... done

Use Ctrl-C at any time to stop monitoring progress; the backup will continue running.
Use heroku pg:backups:info to check progress.
Stop a running backup with heroku pg:backups:cancel.

Backing up DATABASE to b001... done
user@pc MINGW64 ~/tmp/jdl2 (main)
$ heroku pg:backups:download
Getting backup from hamta... fetching url of #1
Getting backup from hamta... done, #1
user@pc MINGW64 ~/tmp/jdl2 (main)
$ ls -ltrh
total 1.2M
-rwxr-xr-x 1 ozkan 197609 9.9K Oct 12 10:21 mvnw*
-rwxr-xr-x 1 ozkan 197609  509 Oct 12 10:21 npmw*
-rw-r--r-- 1 ozkan 197609 1.9K Oct 15 17:34 test.jdl

-rw-r--r-- 1 ozkan 197609  62K Oct 16 15:12 pom.xml
-rw-r--r-- 1 ozkan 197609   24 Oct 19 21:33 system.properties
drwxr-xr-x 1 ozkan 197609    0 Oct 19 21:36 node_modules/
-rw-r--r-- 1 ozkan 197609 1.5M Oct 19 21:36 package-lock.json
drwxr-xr-x 1 ozkan 197609    0 Oct 19 21:37 target/
-rw-r--r-- 1 ozkan 197609  31K Oct 19 21:43 latest.dump

how to restore

pg_restore --verbose --clean --no-acl --no-owner -h localhost -U myuser -d mydb latest.dump

jhipster create a user

If you are also using jhipster here is how you can create/register user

curl "http://xxx.herokuapp.com/api/register" -X POST -H "Accept: application/json" -H "Content-Type: application/json" -d '{"login":"test6","email":"fakofo1207@otozuz.com","password":"123456","langKey":"en"}'

this is the minimum parameters and after curl you dont get much in bash, after that I can see that user created in management panel. 

now I need to figure out how activation mails work in herokuapp or in jhipster, I gave gmail parameters but did not work

Monday, October 18, 2021

jhipster login and how to call a rest api under

 In order to use jhipster user system I needed to find out how to call jhipster, I am planning to do this with curl because it is easiest way to test and see the results.

  curl -v https://xxx.herokuapp.com/api/authenticate -X POST -d '{"password":"xxxxx","username":"admin"}' -H 'Content-Type: application/json' 

 and result is {"id_token":"eyJhbGciOiJIUzUxMiJ9.eyJzdWIiOiJhZG1pbiIsImF1dGgiOiJST0xFX0FETUlOLFJPTEVfVVNFUiIsImV4cCI6MTYzNDY2MDAwM30.1g_8nXgZfTITCfQgewLm8V6PnGKy5kx41dm9gbpJMltVARK8DJZBbbnI-VzQFFO1kkP-8wzVcsB-bvAaHGMPkA"}  

 now I will use this token to call another rest api 
curl "https://xxx.herokuapp.com/api/categories?page=0&size=20&sort=id,asc" -H 'Accept: application/json' -H 'Authorization: Bearer eyJhbGciOiJIUzUxMiJ9.eyJzdWIiOiJhZG1pbiIsImF1dGgiOiJST0xFX0FETUlOLFJPTEVfVVNFUiIsImV4cCI6MTYzNDY2MDAwM30.1g_8nXgZfTITCfQgewLm8V6PnGKy5kx41dm9gbpJMltVARK8DJZBbbnI-VzQFFO1kkP-8wzVcsB-bvAaHGMPkA'

 and result is [{"id":1051,"description":"Emlak","sortOrder":null,"dateAdded":null,"dateModified":null,"status":"AVAILABLE","picture":null,"propertyGroup":null,"parent":null,"advert":null},{"id":1052,"description":"Kiralik Evler","sortOrder":null,"dateAdded":null,"dateModified":null,"status":"AVAILABLE","picture":null,"propertyGroup":null,"parent":{"id":1051,"description":"Emlak","sortOrder":null,"dateAdded":null,"dateModified":null,"status":"AVAILABLE"},"advert":null},{"id":1053,"description":"Satilik Evler","sortOrder":null,"dateAdded":null,"dateModified":null,"status":"AVAILABLE","picture":null,"propertyGroup":null,"parent":{"id":1051,"description":"Emlak","sortOrder":null,"dateAdded":null,"dateModified":null,"status":"AVAILABLE"},"advert":null}]

Friday, October 01, 2021

Glasgow IKEA delivery times

I moved to a new place around 1.5 months ago(23.08.2021) and needed to buy all the furniture. Even for renting, finding all furnished flat chances in Scotland is close to zero. Anyways I started searching. First I thought I should buy all second hand went to Gumtree which is a huge website full of second-hand advertisements, I found one bed and mattress ad, Contacted with the owner he said he will deliver and that day I slept on air bed ­čśÇ

Then I contacted another ad for bed and mattress, they said they will deliver that Sunday, still sleeping on an air bed, I decided to buy a new bed and mattress, I mean from a real furniture shop a "NEW" one, first hand.

I decided to buy from local in Glasgow, I found some local bed and mattress shops but they were expensive than IKEA, so I decided to go to IKEA and check out the quality, the numbers were around 600 in local and in IKEA was 400 pounds, after I have seen their showroom and quality I decided to go with IKEA, it is cheap and quality is good.

I went online and start adding things to my basket, the first surprise was when I decided to check out some items that were missing from local IKEA so they can not deliver they have to be removed from the list. Then I learn that I can set my postcode on the website and it can show if they are available in my area. Took around 2-3 days for me to decide and finish all, then I come to checkout, it took around 1200 pounds, I have a couch and some tables(TV/coffee) and other things other than the bed.

When I check out at 04.09.2021, IKEA cut my order delivery into two, one delivery at 06.09.2021 and the next one at 02.10.2021 there is almost a month difference. So thanks to Tesco I have an air bed and until Oct 2 I will sleep on it, and last Tuesday airbed started to lose air ­čśŐI think the universe is trying to tell me something.