Tip jar

If you like CaB and wish to support it, you can use PayPal or KoFi. Thank you, and I hope you continue to enjoy the site - Neil.

Buy Me a Coffee at ko-fi.com

Support CaB

Recent

Welcome to Cook'd and Bomb'd. Please login or sign up.

March 28, 2024, 06:15:26 PM

Login with username, password and session length

Tech stuff you've been learning recently

Started by Z, April 02, 2018, 03:39:04 PM

Previous topic - Next topic

Z

The idea here is that you can kind of talk a bit about it and maybe someone else here will be able to offer some recommendations or just details of how their experiences were.


So lately I've been learning

jQuery: Not by choice but I've never really had to work with it before. Hate using it but it's handy enough for knocking together something small quickly that works, isn't it? Would it be good as a prototyping tool to ensure you go back and do things with a framework afterwards?

Unity: My computer mightn't be powerful enough for this but so far it seems to be handling it okay. I think the textures seemed to have a big impact on performance when I added a few. Going through some 3D tutorials at the moment, the whole cursor manipulating a 3D environment is extremely confusing, is this something you adjust to? Using a Magic Trackpad at the moment, maybe a mouse would be better?

D3: Doing pretty good but tbh I need some ideas as to good uses for it, kinda hard to be motivated to make fun graphs when you've no data you're interested in to work with.
If someone knows of a way I can set something up to schedule API requests at midnight every day and store the results somewhere either for free or very very cheaply without much effort, I've a few ideas for historical trending graphs I could make once they've gathered a few weeks of results.

Zetetic

QuoteI can set something up to schedule API requests at midnight every day and store the results somewhere either for free or very very cheaply without much effort, I've a few ideas for historical trending graphs I could make once they've gathered a few weeks of results.
A stupid question perhaps - do you have a machine running all the time yourself anywhere?




I've finally begun to feel like I understand electricity, in the context of electronics, a bit and got I2C working with these. (Belatedly unfortunately, as I've destroyed my HVPS as part of the learning process.)

Sebastian Cobb

If you're writing jquery/js already then if you signed up to AWS you could write a lamda (in node, or a variety of other languages) and schedule it.

AWS could also provide you with a small DB instance for storage, or you could dump it out to (json, csv, xml etc) files and pop them into an S3 bucket (cloud storage).

It would cost you something, but not much; less than having a virtual machine running somewhere.

Dunno what API you're calling that always uses current time, most are designed to take a time parameter so you might be better off pulling back a series of data as and when you need it.

Zero Gravitas

Quote from: Z on April 02, 2018, 03:39:04 PM
If someone knows of a way I can set something up to schedule API requests at midnight every day and store the results somewhere either for free or very very cheaply without much effort, I've a few ideas for historical trending graphs I could make once they've gathered a few weeks of results.

"Python anywhere" has web-gui setup of schedulled daily jobs for free, finer grained control is $5 a month, same with Linode and their £5 a month scheme as long as you can work out cron expressions.

Z

Quote from: Zetetic on April 02, 2018, 03:56:07 PM
A stupid question perhaps - do you have a machine running all the time yourself anywhere?




I've finally begun to feel like I understand electricity, in the context of electronics, a bit and got I2C working with these. (Belatedly unfortunately, as I've destroyed my HVPS as part of the learning process.)
Nope, I'm pretty anal about not leaving my laptop on. I'm probably gonna either just cave and give amazon some money or see if I can do something with a raspberry pi zero w.

Quote from: Sebastian Cobb on April 02, 2018, 04:01:35 PM
If you're writing jquery/js already then if you signed up to AWS you could write a lamda (in node, or a variety of other languages) and schedule it.

AWS could also provide you with a small DB instance for storage, or you could dump it out to (json, csv, xml etc) files and pop them into an S3 bucket (cloud storage).

It would cost you something, but not much; less than having a virtual machine running somewhere.

Dunno what API you're calling that always uses current time, most are designed to take a time parameter so you might be better off pulling back a series of data as and when you need it.
Yep, seems the best option.
RE: time, it's more that a lot things don't have public endpoints to show changes in certain values (e.g. number of likes) over a time span but you can deduce that quite easily by recording the values yourself on a day by day basis.

Uncle TechTip

Please indulge me for a bit. The clock on my central heating went haywire, but rather than laying out 80 quid on a replacement, I got thinking, why can't you get a Raspberry Pi to control it, there's just a couple of relays that need to be opened and then you could control it on your phone for next to nothing. I know zero about electronics so I talked to a friend who I hoped would help me build it and he went one better, why don't you use an Arduino chip, which can just turn pins on and off but uses a powerful C-like language, and it's got wifi and you can run a tiny web server on it.

So right now we have the prototype, which is the two-relay circuit on a breadboard with the ESP8266 chip, LEDs and a 240-5v power supply, wired to the boiler in exactly the same way as the existing one (they handily provided full diagrams in the manual). I wrote the program which serves up a web page and responds to some basic API-style commands, and I very quickly picked up jquery to control the logic in the page, hiding & showing elements and posting a "switch" command - basic aim is to provide a massive toggle switch as the interface. The Arduino stuff is also being learned at great speed, but that is much more copy&paste examples - so far I have it picking up the time with NTP, although the schedule is currently controlled by cron on another machine. The page is served up as a massive string with CSS in-line, although since jquery is pulled in it's kind of dependent on the internet being up. That needs to be fixed in version 2 - I am hoping we will stretch to a small OLED screen for the clock, a properly-etched board and 3D-printed box, and a hardware button on the front. On the software side I need build it so it's not dependent on the net or local machines - it's harder to put a file system on these tiny chips and serve up more one resource easily. And I need to somehow build in an editable schedule. I did come up with a nice feature that turns it on for an hour.

Total cost no more than 30-40 quid for all the bits. It was as much about saving money as the boiler is part a decrepit cylinder system and I was loathe to pay that much. Definitely loving the extra level of convenience though.

In terms of jquery I thought it was ubiquitous, so whilst it's absolutely fine for prototyping - I was up and running in an evening with this - it's also fine for the real thing, so get stuck in. The framework would clearly be the ultimate aim but there's a lot of magic to learn.

Zetetic

Quotewhy don't you use an Arduino chip, which can just turn pins on and of
Pi's have got GPIO pins as well.

I've wondered which makes more sense for a central heating controller as well.

Uncle TechTip

Yes that was the germ of the first idea, but a Pi can do so much more that it didn't really need to do here.

bgmnts

I dont understand tech stuff at all. Even things like microsoft software i sometimes struggle with. Which considering the times we live in is not good.

Sebastian Cobb

Quote from: Zetetic on April 02, 2018, 11:46:58 PM
Pi's have got GPIO pins as well.

I've wondered which makes more sense for a central heating controller as well.

I've considered this and figured it would be easier to integrate things like temperature sensors with pi's and have greater freedom of what language I could write stuff in, plus greater connectivity.

If I were to do it, I'd probably also add bells and whistles like (at the weekend) checking the wifi for my phone to see if I'm in, before deciding to switch the heating on, etc.

Old Thrashbarg

I did look into putting together my own central heating controller a year or so ago. I decided with the complexity it required to build what I wanted it was cheaper, quicker and easier to just get a Nest (which isn't really the point), but also safer and a much more polished product.

I also wanted to say I hate jQuery with a passion. But that's mainly because of its ubiquity and the resulting JavaScript is jQuery mentality that seems to exist in a lot of places.

That's a pretty rubbish contribution to this thread.

On a marginally more positive note, the most recent thing I've been learning is Solr index building and querying in order to create a more powerful, flexible and performant search mechanism and listings backend for an IMAP client. Solr is both incredibly good at what it does and incredibly shit to work with (in my fairly limited experience), but now that I'm getting to grips with some of the strateger syntax it's easier to see why things are the way they are with it.

Sebastian Cobb

Are thermostats even the in thing these days? My heating engineer mates all shun them for no stat and TRV's in the rooms.

When I was on prepay gas (with the above setup) it did seem most of the cost went into getting everything up to temperature and the cost difference between keeping it on for 30 minutes or several hours was about 20p.

Z

Quote from: Uncle TechTip on April 02, 2018, 11:31:59 PM
In terms of jquery I thought it was ubiquitous, so whilst it's absolutely fine for prototyping - I was up and running in an evening with this - it's also fine for the real thing, so get stuck in. The framework would clearly be the ultimate aim but there's a lot of magic to learn.
I dunno, compared to anything I've done with react/vue, it looks like it'd be a fucking nightmare to maintain. The second I can get away from jQuery, I'm jumping at it.
Even on the thing I'm at, I'm kind of regretting not seeing if I could approach it with Knockout instead.


RE: electronical shit, much higher level but I took two of my brother's old broken androids that still powered on. Both had busted screens, have replaced the digitizers on both without causing any further damage to the screens, one is actually pretty usuable and the other has hdmi out.
Anyone got any good old-Android suggestions?

Also, hold on, there are low cost arduino devices with wifi? Are we talking much lower than a Pi Zero W?

Sebastian Cobb

There are wifi modules you can connect via spi like this https://create.arduino.cc/projecthub/jeffpar0721/add-wifi-to-arduino-uno-663b9e

I think there are also friendlier ones that send the i/o through the cloud automatically as well.

I get the impression unless you want to do some quite basic triggering you'd be better off with a pi zero w. Probably cheaper (and more reliable as it's handled by a tried and tested os) too.

Arduino's have inbuilt adc's though so can read analogue sensors.

MojoJojo

Not technically an arduino, but they support the arduino software libraries, the esp8266 and bigger brother esp32 are tiny little modules with WiFi. They are cheap and really good.

Jittlebags

Quote from: MojoJojo on April 04, 2018, 12:01:22 PM
Not technically an arduino, but they support the arduino software libraries, the esp8266 and bigger brother esp32 are tiny little modules with WiFi. They are cheap and really good.

Good shout. My son had mentioned the ESP01 (now superseded by these) in passing as the thing for IOT projects, so your post acted as a reminder, so I've bought two of each from Amazon for about £7 each. I presume that with these you are programming "against the metal" (at least against C++ libraries) rather than programming through an OS. Will have to investigate how to install the Arduno Core.

Zero Gravitas

Quote from: Jittlebags on April 04, 2018, 04:10:04 PM
Good shout. My son had mentioned the ESP01 (now superseded by these) in passing as the thing for IOT projects, so your post acted as a reminder, so I've bought two of each from Amazon for about £7 each. I presume that with these you are programming "against the metal" (at least against C++ libraries) rather than programming through an OS. Will have to investigate how to install the Arduno Core.

Yeah it's all C, It's a very friendly set of libraries for kicking off the wifi gubbins and routing urls to your own handlers though.

Zetetic

Quote from: Zero Gravitas on April 04, 2018, 06:42:26 PM
Yeah it's all C
In case anyone reads this and is put off - Arduino stuff supports C++ so, significantly, you get Classes/Objects and a few other things that make it much more tolerable if you're as lazy as me.

(You don't get the C++ standard library though, which doesn't matter much.)

Sebastian Cobb

C has structs. Like Dennis Ritchie god intended.

Zero Gravitas

Quote from: Zetetic on April 04, 2018, 09:50:15 PM
In case anyone reads this and is put off - Arduino stuff supports C++ so, significantly, you get Classes/Objects and a few other things that make it much more tolerable if you're as lazy as me.

(You don't get the C++ standard library though, which doesn't matter much.)

You're quote right, here's an example of how un-scary it is: https://github.com/raimohanska/iot/blob/master/esp8266.md#internet-button

MojoJojo

Quote from: Uncle TechTip on April 02, 2018, 11:31:59 PM
Please indulge me for a bit. The clock on my central heating went haywire, but rather than laying out 80 quid on a replacement, I got thinking, why can't you get a Raspberry Pi to control it, there's just a couple of relays that need to be opened and then you could control it on your phone for next to nothing.

That's a bit more ambitious than I'd be comfortable with- I don't know much about heating systems, but I know for example that after the call for heat is stopped and the boiler stops burning gas it sends a signal back to the controller box for a few minutes (thermostat controlled) to tell it to keep the pump running to stop the heat exchanger over heating. On an old boiler with a heavy heat exchanger this won't be immediately catastrophic, but will probably knacker it over time. So it's a bit more complicated than just "want heat -> close relays".

You don't mention what sort of heating system you have and there are many different types ("gravity fed or fully pumped luv?") and it's entirely possibly you have one where the timer really is just close relays when you want heat and the boiler/pump management stuff is handled elsewhere. Or you might know a lot more about this and have it covered, but just wanted to make sure you really know what you are doing. It's a boiler, and while I don't think you can blow yourself up doing what you doing, and you're probably not daft enough to electrocute yourself, you could easily fuck the boiler up and the gas man will not be impressed with your arduino.

(you could buy a replacement timer for about £40 and it won't be any harder to fit than what you're wiring up).

Zetetic

Quoteit's entirely possibly you have one where the timer really is just close relays when you want heat
Certainly my one has such an arrangement (for room thermostats mainly) where the only exciting thing is that you have to switch 230V.

Sebastian Cobb

I'm not a heating engineer or owt, but if you're doing computer-controlled heating I think you'd be better setting the time circuit to 'always on' and switching on the thermostat circuit.

Uncle TechTip

Quote from: MojoJojo on April 05, 2018, 08:18:03 PM
That's a bit more ambitious than I'd be comfortable with

These are all fair points but we went through the data sheet which provides plenty of wiring diagrams and switching current is all it does in the most basic setup. It is a 15yo conventional boiler, cylinder system. I only went down this road as it's an old system and I expect to replace it in the medium term. Or maybe sooner!

dex

Hi all. I'm learning Python mainly as something to do that's cheap (rather than just internet idling and hanging around HS Art) and hopefully later productive. I'm a complete beginner and have bought a couple of courses on Udemy and got a book from the library.

Have other people got any good resources/projects to suggest? Or any websites etc that helped get them going with Python?

Cheers.

Churston Deckle

Dex - I learned python a few years ago on codeacademy. It didn't cost anything, but that might have changed. I learned html and css too, and have forgotten most of it.

dex

Cheers for the tip. Will check that out.

Z

Depending on what you're doing with Python, I kind of think it'd be okay to figure it out as you go along. You can get it doing quite a lot pretty quickly with the code remaining very readable throughout (to yourself, at least)

As far as starting off with it with plans to get serious... I dunno, it seems to me like it'd be hard to ensure you've gotten various concepts down correctly coming at them from a python perspective.

Sebastian Cobb

As someone who has programmed C, Java and PHP professionally, Python seems like a very quick way to get things done but I think it might be quite easy to make a really poorly structured mess if you're not careful. It's almost like a scripting language where you just write glue that sticks various libraries together. I like it though as it's the opposite of the restrictive Java I was doing where you ended to create a heap of objects to do not much.

hedgehog90

Spent an hour yesterday writing and debugging an Autohotkey script to deliver random insults for Rocket League when I should have been working.
It should have taken me 5 minutes but AHK is terrible wank.