#development
1 messages · Page 90 of 1
I feel like this is a million dollar SaaS business
Don't just stop at paying people to create regex for you.
there are people called developers, pay them to create the whole system for you
Ok but what happens when developers are too busy to fiddle with regex (devs like me
)
I work at a F500 and there's only one dev on our team who's genuinely comfortable with regex
I bet GPT-3 could tell you the correct regex given this
^net\.minecraft.*|^com\.mojang(?!\.authlib.*).*
the problem with that, is that regex is so rarely needed that it ain't worth
i've done probably 4-5 regex expressions in the last year, and that's like... a lot
still noly took a couple hours on the site linked above
Heyy Tech Folk
Hope you you're doing great
I need help to understand the terminal integration in my react app
so basically im the most developed single braincell in existence and cloned an empty repository into my project and basically deleted everything. any ideas yall?
im acting like this is chill but im having a mild to severe stroke rn
A git clone would 't delete anything - only add stuff. So you deleted files manually? 🤔
Before doing anything. If you aren’t sure what you are doing always compress the work that you have’s directory before doing anything.
hehe i recently made a Facebook phishing site 🙂 wich might sound evil , but it was to explain what phishing sites are and wat they do and how to avoid being tricked to my class of "elderly" people i teach (volunteer work) , since they were like , *yeah i think i have seen such a site , it asked me for my facebook login to continue but i tried ceveral times but it didnt work as i always got a white page with 404. * yes that means you prolly should change your fb password now... oh no as i said the site didnt work, it always showed the 404 .. ah ... speds the next 20 minutes making a facbook login page that logs the login fields to a txt and redirects to a 404:) my collegue was like , WTF Did you just , ... freak
But yeah git clone wouldn’t destroy anything but rather add a subdir. If you have the terminal commands handy that you are willing to share that may be helpful.
use regex nearly every day and most days multiple times
I hate regex too. I also hate how regularly I use it
^Developers (?:lov|hat)e Regex!$
thanks, I hate it.
Honestly tho, while I understand that Regex can be quite difficult to read/understand, it can also be super handy to quickly write some string validation stuff. For example, a (not so thorough) E-Mail Regex would be this: ^.+@.+\.[a-z]{2,}$
Difficult to read? Yes. Short and does the job? Also, yes.
I do get why so many people hate Regex tho. Me too buddies, me too...
I don't mind simple regexes, but I've had to do some absolutely painful ones for data extraction
also, there is an ip address regex paragraph that works for ipv4 and ipv6
'/^(?>(?>([a-f0-9]{1,4})(?>:(?1)){7}|(?!(?:.*[a-f0-9](?>:|$)){8,})((?1)(?>:(?1)){0,6})?::(?2)?)|(?>(?>(?1)(?>:(?1)){5}:|(?!(?:.*[a-f0-9]:){6,})(?3)?::(?>((?1)(?>:(?1)){0,4}):)?)?(25[0-5]|2[0-4][0-9]|1[0-9]{2}|[1-9]?[0-9])(?>\.(?4)){3}))$/iD'
Honestly, why not just use two Regrets Regex's at that point?
Sometimes it's nice just to use a single compiled regex, rather than double the matching operations
True
For big datasets, that doubling of searching can add a lot of time
(In general though, yeah, I agree, split em. OR just don't use ipv6 :D)
Pah! Who needs IPv6 anyways? There's plenty of IPv4 Addresses out there! /s
i cannot express my gratidutde for what you just said. at the time that this happened it was 5 am and i was very scatterbrain. i was looking in the folder i cloned into not the folder my project was in. this just show my level of intelligence
Nah, NAT everything
why not best of both worlds https://ftp.unpad.ac.id/orari/library/library-sw-hw/linux-howto/ipv6/v4_v6_translation.pdf
I remember google used to do something similar with their cloud offering, internal to google cloud was all ipv6 but nat'ed out to ipv4 outside of google
Best of both is dual stack
Not translation
If you don't use it regularly, would you still call it regex /s
yes 
alpha chassis
No, that’s why I call it rarex.
Take that as a lesson and regularly back up your work. At the very least compress your working directory into an archive periodically until you get comfortable with git.
The plural of Regex is Regrets 
always a fun one to have some people who are just starting out break their heads over : (you may verrify its not photoshopped ,...) 🙂 :p
ipv6 is neat and all, i already have an ip though so 😏 tough shit
everyone just purchase some static IPs they'll be very valuable someday
Everybody gangsta till Apple has the "courage" to stop support for IPv4 in macOS and iOS
honestly thatd be what brings ipv6 into relevancy
Also a huge difference in adoption rate in each country: https://www.google.com/intl/en/ipv6/statistics.html#tab=per-country-ipv6-adoption
ugh python updates broke my old code x.x
well you better go catch it
since ipv6 doesnt actually need a dhcp , since the adress space is so large you should be able to randomly pick one and it should be fine. (as in its prolly a unique one ) so i think ip addresses wont be worth anything soon, that is besides the ones that are the easiest to remember (and prolly the only ones that you can remember) as they will be worth allot
They still will be worth something. Like a /64 may eventually be worth
Wait, across which versions?
probably python 2 😆
So, idk if this is the right forum, but could someone clear up some conceptual confusion I have about Microsoft's Dynamics Ax?
not sure, but the program was from 2020 and I tried running it yesterday
and it worked in 2020
I got swd debugging working on a raspberry pi pico. As it turns out do not try to get a dedicated hardware swd device and just use a raspberry pi.
Does anyone know of a good GDB client that can connect to a TCP GDB server and is graphical?
I mean
VSCode, but it's kinda weird to use
There's an extension to make custom debug profiles but I last used it, like, a year and a half ago and it was a remote GDB target
Sorry to ask stupid question, but how could I solve this?
D:\IssueTracker\src>npm install --save @react-native-clipboard/clipboard
npm ERR! code ERESOLVE
npm ERR! ERESOLVE could not resolve
npm ERR!
npm ERR! While resolving: issuetracker-ui@0.0.0
npm ERR! Found: react@18.1.0
npm ERR! node_modules/react
npm ERR! peer react@">=16.3.1" from react-async@10.0.1
npm ERR! node_modules/react-async
npm ERR! react-async@"^10.0.1" from the root project
npm ERR! peer react@"^18.1.0" from react-dom@18.1.0
npm ERR! node_modules/react-dom
npm ERR! peer react-dom@">=16.8" from react-router-dom@6.3.0
npm ERR! node_modules/react-router-dom
npm ERR! react-router-dom@"^6.3.0" from the root project
npm ERR! react-dom@"^18.0.0" from the root project
npm ERR! 4 more (react-firebase-hooks, react-router, react-router-dom, the root project)
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! @react-native-clipboard/clipboard@"*" from the root project
npm ERR!
npm ERR! Conflicting peer dependency: react@18.0.0
npm ERR! node_modules/react
npm ERR! peer react@"18.0.0" from react-native@0.69.1
npm ERR! node_modules/react-native
npm ERR! peer react-native@">=0.57.0" from @react-native-clipboard/clipboard@1.10.0
npm ERR! node_modules/@react-native-clipboard/clipboard
npm ERR! @react-native-clipboard/clipboard@"*" from the root project
npm ERR!
npm ERR! Fix the upstream dependency conflict, or retry
npm ERR! this command with --force, or --legacy-peer-deps
npm ERR! to accept an incorrect (and potentially broken) dependency resolution.
npm ERR!
npm ERR! See C:\Users\Marcell\AppData\Local\npm-cache\eresolve-report.txt for a full report.
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\Marcell\AppData\Local\npm-cache\_logs\2022-07-10T15_57_35_990Z-debug-0.log
Does anyone know of a great resource to learn USB protocol?
looks like an issue with react version? maybe you need to downgrade or upgrade all the other packages for them to work with react 18
ben eater has some vids on it
at a very low level
The USB 2.0 spec: https://eater.net/downloads/usb_20.pdf
Support these videos on Patreon: https://www.patreon.com/beneater or https://eater.net/support for other ways to support.
0:00 Intro
0:50 USB electrical interface
4:43 How USB encodes bits and packets
23:41 USB packet contents
29:26 USB vs. PS/2
Social media:
Webs...
can i embed a .zip file into my winform C# program
how do i access this file in vs studio winform c# application?
im tryna copy this zip file to somewhere the user selects
@hollow basalt @nocturne galleon I fucking called it
https://twitter.com/gd3kr/status/1545370626273120256
built a quick app that uses gpt-3 to convert from English to RegEx so you don't have to waste time on stackoverflow: https://t.co/SQaHqsTeDB
32700
4961
That's fun
@fickle vergePretty classic way is to append it to the end of the executable with a header so you can locate it
that version of react-native (abnd thus that clipboard you're trying to use) only wants react@18.0.0, you're using react 18.1.0
downgrade react (npm uninstall react, npm install react@18.0.0) and see if that fixes it
quick google search says the same way you'd do it in any other c# app -
follow this guide til you get to the part where you're putting in code in the Form.cs file and trigger it with a button
https://docs.microsoft.com/en-us/visualstudio/ide/create-csharp-winform-visual-studio?view=vs-2022
then follow this example in the c# api reference to use c# to move a file
https://docs.microsoft.com/en-us/dotnet/api/system.io.file.move?view=net-6.0
you'd probably need to use relative pathing tho, so from the location the file is being run,
"String path = "..\FolderIcon\Folder.ico"" means into the FolderIcon folder, then select the Folder.ico file.
according to mozilla msdn there is a native way in JS to accept the clipboard anyway, I will probably strict to that
Yeah navigator.clipboard
exactly
I avoid using libraries unless I need to
Avoid dependency hell
True
since some ISP's are distributing /56 and /48 adresses to customers i assume there are plenty of /64 adressess to go around (a single /48 = 65,536 /64 adresses and a single /64 contains 2^64 addresses (wich is :
f'{2**64:_}'
18_446_744_073_709_551_616
quite allot of adresses acording tro phyton
the number witout the _ is hard to gage how much it actually is) so for a /48 this is:
f'{(2**64)*65536:_}'
'1_208_925_819_614_629_174_706_176'
adresses they are giving to you for use.
but your not entirely wrong as the /64 is a single LAN so i think its more like some /64 adresses will become worth quite a while , but since cloudflare who famously own the 1.1.1.1 and 1.0.0.1 ipv4 adresses have the equivalent ipv6 adresses of : 2606:4700:4700::1111 and 2606:4700:4700::1001 wich makes me assume getting a simple prefix for ipv6 (the first 64 bits) int that easy , or id think they would go for a 2001::1111 and 2001::1001 (i know 2001 is for doc/bench but i would assume theyd get a prefix that had allot of 0000 blocks in it to make it easier to remember) ps the total number of ipv6 adresses for those who wonder:
f'{2**128:_}'
'340_282_366_920_938_463_463_374_607_431_768_211_456'
in comparrison the age of the earth in seconds:```py
f'{436117077000000000:_}'
'436_117_077_000_000_000'
well yeah, it will take a WHILE
for us to runout
unless we start assigning blocks to instances of ai programs and one of them starts to clone itself :p
Is it possible in react to filter in multiple ways? Example
thoughs on tech bootcamp?
I'm curious about people's thoughts as well, I've been looking at codesmith myself
I have hired many bootcamp grads - find a way to talk to people who have used that bootcamp - 99% of the quality is in the instructors - because if they dont care/understand the industry - your just wasting $$$ - but if you can find a good instructor and a bootcamp teaching relevant skills - great way to learn development in a classroom setting.
additional 2cents would be - if possible - do an in-person bootcamp so you can build a community of people to talk to afterwards that are local to you
So what kind of development does people do here? Any others that do hyper-performance stuff, native system level code?
Hi there, I'm working with react-native for the first time. And I'm trying to convert an application I built previously to react. In the old application I used Leaflet, but I found this library called react-native-maps. However, I can't find a way to disable the default map provider (like Apple Maps or Google Maps). Is it possible to do so? Because I'd like to use OpenStreetMap instead.
Sidenote: I already have OpenStreetMap working but when I zoom out it takes a while to load, so the apple maps layer is shown underneath.
I do not do pure native level stuff - but I work on video streaming systems and some of the work is at the CUDA level
Ah okay, I'm currently working on a C++ game engine from scratch (hobby project). I've got a high focus on performance and it's really interesting stuff.
I'll do near-native work with network stuff on occasion, but only when absolutely necessary, cuz screw that.
Hey! I have a coding problem i am unable to solve and i'd pay 15€ for someone to fix it.
I don't think it's that big of a deal for someone experienced. I implemented TicTacToe with AlphaBeta pruning in python but i can't get it to work.
PN me if interested.
MinMax itself seems to be working, it's just the alpha beta part
I figured it out. I used <= instead of <.
Thx anyway
Hey! I have a weird question
Say I had a Flask (Python library) app which was a single HTML form connected to a route.
Now I wanted to make this into a standalone windows app from a web one, and didn't have time to remake ui, wanting to keep HTML, CSS and JS template I made. Would it be hard to move this code into Electron/React native? I have close to 0 JavaScript knowledge but can spend a full 5 hour work day on it.
All the app needs to do is serve the HTML form, and when submitted save result to a csv file
Literally all I need the app to do is:
- (Optional) server button that says "Go to registration"
- Server my form, get info
- On submit run a function that saves to file and then show "Complete" message
Lol, I actually prefer native stuff. I also do Vulkan graphics programming
anything is possible, but that would be more difficult than remaking the html.
the css/js can stay nearly the same, probably... but the html will likely need redone
Thanks for the input! Would you still recommend an in-person bootcamp if I was looking for a remote job?
do you have a degree at all?
if not- taking a bootcamp of any kind can be useful to pad the resume
but other than that, bootcamps havent meant crap to me when im in the hiring panel... if you think it'll actually help your skills then do it for sure.
I've been given offers over people with degrees just based on the strength of my github alone
One key factor is still having exposure/work experience
The only thing needed is the first paying project/job
Demonstration of skill always trumps theoretical skill
I've heard that a strong portfolio can weigh up work experience
I've been working on this in my spare time while I'm in uni, hoping it's gonna land me jobs eventually
I think so - because while your job may be remote - having people who you know locally can't hurt - as much as remote life is the new norm, some sort of tech social interactions are still important - especially if you are new to the field and building your network
stuff like pair programming irl is great when you are still learning, I love using that to help mentor people
Can't argue with that. I'm afraid my rural location will make it a bit difficult without moving, but I'll see what I can find
if you can't do in person - maybe find one that has a way to build community for remote people - for example I know of a local training school that has a discord for their students - its not programming, its a CNC machining program, but their students get access to that community forever - which could be valuable
trying to think of a dev project to do on my week off
Good points, I'll keep them in mind. This is my last week at my current job so I've put myself into a bit of a sink or swim situation, hopefully I learn to swim, heh😬
what did you used to do? programming isn't hard IF you have a procedural mind - programming is mostly about wanting to build a process that a computer can do over and over - people who struggle with it are often people who struggle with process in general
You know those little sheds that people buy to put their junk in? Yeah, I build those. I've always been kinda technically inclined and I've quite enjoyed the little bit of html/css that I've been doing so far.
My rough idea of what I'll probably do is finish freeCodeCamp's responsive web design, cs50, and go through the Odin Projects full stack JavaScript, then decide if I want to do a bootcamp. I'll be doing these full time so I expect to be able to do those in a few months.
How do I escape a / in batch scripting?
I'm trying to use a Powershell command in a batch file but / never goes through
Powershell.exe net user /domain xxxx
iirc it is \
It prints out NET USER and just dies 
I'd say you are mostly right. But some stuff is just straight up hard. Multi-threading, graphics programming, OS development...
I'm writing my own GUI toolkit from scratch and I'd say even that is surprisingly hard
no so `/domain
idk then ` is the escape character for powershell ^ is the one for cmd
but / shouldn't need escaping for either
the according to that it should be net user username /domain
where I presume username is the username of the user
I mean it should be something like net user administrator /domain
for all intents and purposes, user is not supposed to be found (picture is correct)
yolo i guess
the name for the user needs to be before the /domain basically but after the net user
it's calling from the system. per the instructions cutout i received that includes an example, the example does not include user at all
basically, not important
it's just the batch script that's troublesome
given you are calling into powershell why not write it as a powershell script instead
oh true
less prone to weirdness maybe
LOL. i didn't think of that. thank you
windows has always been jank af for me passing stuff between things on the command line, at least compared to anything linux/unix based
i gotcha i gotcha
Anyone could help with jinja2 & JS?
I need dt_options inside show_result function to be the variable. Basically I need either an fstring or an expression inside an expression
{{ form.division_type_name(class="form-control", id="result-3", onkeyup="show_result(reference={{ dt_options }})", onInput="show_result(reference={dt_options})") }}
actually nevermind I think I managed to get a braindead solution working
So, I am working on discord bot that will read a JSON file from my website and print out what game is being played. I've tried simply reading gamename but, everything I have tried comes out as "undefined"
Basically, the user enters the command and its simply grabs the JSON file and reads from it, then printing to the channel respectively. However, I was reading the JSON file incorrectly and it'd simply always print out undefined. The way I got somewhat around it was the most spaghetti code ever.
Not sure what request lib this is or if it’s the native nodejs one. If you share what module you are rising that’ll help us with helping you. 🙂
You can save yourself a lot of effort if you use something like axios.
Oh wait I see it’s the request package.
Yup
Your out variable is the parsed json, but then you were console logging the body and the message you were trying to access it off the body.
You should parse to a variable and then you access the data in that variable which is now a normal JS object.
const data = JSON.parse(body)
console.log(data)
Looks like request is deprecated, I’d prob switch to undici or if you aren’t worried about perf and just want simplicity I’d go for axios since it has super simple interface and even auto parses the json for you.
why not read from json
why are you searching within a string
Cuz, ooga booga spagetti way LOL
It was originally cuz I was being a dummy and couldn't figure out why it kept reading as undefined. So, I simply just converted to a string.
gamename = data.mariokartwii[0].gamename
It's 0 not 1 isn't it
Well... That would work. But, only for Mario Kart Wii. Let's say if the user hops onto a game like Pokemon Colloseum. The server wouldn't report it back as mariokartwii. It'd simply make another entry (ie: pokemonbattlewii).
both work, it seems each is a game
The JSON isn't in a great structure tbh
yeah no
Yeah, don't you love old 2014 python 2.7 code!
You could use object.entries then loop over that
Looks like your key is the game name, if that’s 100% always the case you can Object.keys() to get an array of games. Deff an ugly / bad json schema.
You can always transform it into the schema you'd rather have lol
But that's why there's stuff like graphql now, just ask for the schema you want from the server
Does this affect target SDK or minimum SDK? https://android-developers.googleblog.com/2022/04/expanding-plays-target-level-api-requirements-to-strengthen-user-security.html?m=1
I apologize if thats stupid question but I havent been able to find it anywhere
It says it right in the title: Target SDK level
I see. Thank you.
sure - it might be how my brain works - I am able to break most concepts down to their basic concepts pretty well and everyone I know who can has a better time learning programming - not sayings its easy - but it is easier if your mind works more "procedurally" - its why I struggle with creative tasks - I need process
I have I question for the developer section is there any good Ps3 emulator for iOS
I had attempted a graphics rendering system. I never knew how hard it was to optimize a triangle drawing routine until I attempted it. I think I should have started with drawing lines first. Oh well I can re try again. https://retro64.altervista.org/blog/line-drawing-routines-programming-different-approach-6502-assembly-implementation/
I don't do software rendering. I do GPU accelerated rendering. But good on you for trying
With OpenGL or something else?
Vulkan. I used to do OpenGL, I didn't like it.
What are good resources to learn Vulkan?
can someone help me get my VisualBasic6 running on modern hardware/os? or point me to the last OS it ran on? I think it ran on Win7?
Does Microsoft have a translation guide?
anyone willing to help with beta testing of Kamachya 7 a old made off windows 7 but modern and forgets all the bull$h!t of windows
hey anyone have some good recourses on making custom linux iso ? i kinda wanna take ubuntu server but have certin apps and ssh keys pre installed or just remove ssh all together in the iso so i can flash it to things and allso just upload it to my hosting providers
just looking for some links on were to start
maybe pretty uuseless comment , depending on ... actually VS2005 ~2012 and VCE (VC) from the same timeperiod run flawless under linux with wine ,(cant say for >2012 since i never tried those), so i assume VB6 wont be a problem whatso ever either
take a look at https://wiki.archlinux.org/title/archiso or https://www.linux-live.org/ or MX Snapshot or https://en.wikipedia.org/wiki/Remastersys
Linux Live Kit the ultimate way to bring your linux to life. Create your own live distribution
remastersys is a free and open-source program for Debian, Ubuntu-based, Linux Mint or derivative software systems that can:
Create a customized Live CD/Live USB (a remaster) of Debian and its derivatives.
Back up an entire system, including user data, to an installable Live CD/DVD.As of April 28, 2013, the originator's direct development has ce...
Thnx will give them a little look
another option is to create not a live iso nor an installer but a full image , with some dirs separeded (anything that needs write access) and the rest of the system readonly with the writable dirs mounted from a seperate writable partition or or as tmpfs. and
With Ubuntu/Debian, that process is called "preseeding", see https://www.debian.org/releases/stable/amd64/apb.en.html
damn has been since Qt4 was the new thing that i did some gui programming (is not tui/ansi or cli or web(php/css/html) wich i did in that time) but its slowly coming back 🙂
That looks like the Eric Python IDE: https://eric-ide.python-projects.org.
Google never forces you to specific minimum SDK, you can pick whatever version can support the feature set you want to have in your app. It's always the target SDK which they force you to update, as it means that if the app runs on that specific SDK version, it will use all the modern/safety features available. And then it will gracefully degrade functionality based on runtime. So if your app can still run on Android 4.4, you won't get separate permission prompts for example, while on Android 12 you will get them.
you can always go to VSCode or Vim to not have so many buttons 😄
yeah I use vscode for most stuff xD
though I stan golang rather than python anyway these days xD
will it try to use SDKs that are in between target and minimal or go straight to min if it cant find target?
you publish your application with minSdk and targetSdk. Features, which can be "polyfilled" into older Android versions are polyfilled, the rest gracefully degrade.
and if you want to add some special features for Android versions above some specific version, you can just put that code in an if block https://developer.android.com/training/basics/supporting-devices/platforms#version-codes
so you can have some generic code for most versions, but then have special code for let's say "Android 4, cause it has a different API for something which was not standardized until later"
example being biometric login, which was standardized in 5.0 or 5.1, and then old API completely replaced in i think Android 9 or 10
but this is a good example - you can still use the new API (BiometricPrompt i think) but on older Androids it gracefully degrades to Fingerprint API
just it doesn't support Face and other methods on older versions, obviously
Hey.
Could someone help explaining what am I missing? As I read arrow way should do it, but it does not.
Uncaught (in promise) TypeError: Cannot read properties of undefined (reading 'setState') at setJoke
const setJoke = () => {
this.setState({
items: joke
});
}
Solved 🙂
Yeah, was just writing an explenation and a possible solution, but you got it on your own ^^
Had run into similar issues with Angular and Vue myself before. Really annyoing when your function get's executed in a different context and thus this doesn't refer to your Class/Component...
My solution was
const [joke, setJoke] = useState();
it does if you use class components but yeah it's better to use the function components
Neverthless, now I just get an endless loop of Api requests 😦
const [joke, setJoke] = useState();
const _key = 'joke';
const getKey = localStorage.getItem(_key);
const storedJoke = getKey && JSON.parse(getKey);
const currentDate = new Date().toDateString();
function jokeMe() {
useEffect(() => {
if ( storedJoke && currentDate === storedJoke.date) {
setJoke(joke);
};
});
fetch('https://api.api-ninjas.com/v1/jokes?limit=1', {
method: 'GET',
headers: {
'X-Api-Key': "XXXXX"
}
})
.then((res) => res.json())
.then((res) => {
setJoke(res[0]['joke']);
localStorage.setItem(
_key,
JSON.stringify({
date: currentDate,
value: res[0]['joke']
}),
);
});
}
jokeMe()```
yeah you can't invoke jokeMe() there
why are you invoking jokeMe() at the end of the file?
well, wouldn't be the way to run the function and "get" the joke?
jokeMe() is a component it gets called by react every loop to get the jokeMe component and show it on the page
so every time the react event loop runs it makes another request since fetch is just in there
Aaaah
so I would need to make it a compontent instead, then import it once somewhere.
well actually whats your jsx for the page look like?
but it should be like <Joke/> and then in the joke function you have a useEffect that calls jokeMe()
then when the Joke component is mounted, it runs the useEffect which makes the request
Well the whole page is a bit of a mess to paste here
that's okay you just need another component that actually calls jokeMe in a useEffect
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
oh you do have a joke component, yeah just call jokeMe in its useEffect, and remove that call immediately after you defined jokeMe
and jokeMe shouldn't have its own useEffect that should be part of the Joke component itself
I just moved it to a new compontent now, so it's no longer used with jokeMe(), however its still and endless loop. I am not sure how to remove the call to stop the redirects. Generally, this should do it, but it doesn't.
useEffect(() => {
if ( storedJoke && currentDate === storedJoke.date) {
setJoke(joke);
return;
}
});
can you pastebin your whole joke component?
remember anything in the joke component body gets called every render loop, only things in hooks like useEffect() are called only on certain events
I have a feeling it might be different, because other data I am fetching also loaded twice (not loop though)
import { useEffect, useState } from 'react';
export default function Joke() {
const [joke, setJoke] = useState();
const _key = 'joke';
const getKey = localStorage.getItem(_key);
const storedJoke = getKey && JSON.parse(getKey);
const currentDate = new Date().toDateString();
if ( storedJoke && currentDate === storedJoke.date) {
setJoke(joke);
return;
}
fetch('https://api.api-ninjas.com/v1/jokes?limit=1', {
method: 'GET',
headers: {
'X-Api-Key': "XXX"
}
})
.then((res) => res.json())
.then((res) => {
setJoke(res[0]['joke']);
localStorage.setItem(
_key,
JSON.stringify({
date: currentDate,
value: res[0]['joke']
}),
);
});
}
return
yeah so that fetch needs to be in a useEffect
Ah ok
it's a different way you have to think about it because it's a functional interface not procedural
Than you so much
I have a similar problem, but I will try to figure out it myself
that's requested twice, not as a loop, although the problem is the same, gives more API requests.
yeah useEffect also gets called when the component updates
if you want to run only once on mount you can pass an empty dependencies array [] as the second argument to useEffect()
that tells it it doesn't depend on any props or state and only needs to run with the initial values
its actually passed with , [refresh])
yeah that means it will call the effect again whenever refresh changes
Hmm, as far as I can see the issue is even on the first load, I get two data
even with empty array?
if it happens with an empty array that would mean your component is getting mounted twice for some reason
I will show you the code in a momento
is this your first time with react or you just aren't used to the new functional interface yet?
first time 🙂
the hooks reference on their docs is good it explains most of it. you might look for an example app that also fetches from an api using function components though
Both of them are editors by default and only get to be IDEs by extensions. (That being said, I would also not use the Eric Python IDE stuff...)
it's probably useful to have the gui specific tools but i would guess PyCharm has it too?
I wouldn't know; I used QtCreator (or Emacs) for Qt5/C++.
Resist ide, embrace vim
go generics in 1.18 :o cool
@spring cradle https://github.com/samber/lo
This guy wrapped up all the generics, its super sweet
can you switch files without pressing 10 different keys in vim? that's the main thing that keeps me from using it seriously
Why not just write your own vim? /s
@spring cradle What are you working on in go?
I'll have to take a look a gruid. And you might be able to embed as wasm, if you're trying to play in a browser
gruid has a term.js driver available
im also planning on taking a page out brow.sh's book and splitting each character into two pixels to do some pixel art
with vt100 screen size, that's like, 80x48 pixels for art
Oh, I can actually help you there
ooh
I play video's in terminal with this, specifically here
https://github.com/habitualdev/why/blob/master/main.go#L84
maybe i could try tcell
You might also want to look at sixels
https://github.com/mattn/go-sixel
I'd stick with gruid, especially if you're already working with it. tcell/tview is a pita, and very verbose to set up
Easily
Ever heard of buffers?
yeah tcell looked like a low level thing, though im not very deep into gruid yet
also what's up with the number 6? is it bc it's punnable with pixel?
totally was gonna make a dice oriented mechanic, so i was just gonna call it six lmao
I'm looking at gruid right now, and looks like it does a lot of the heavy lifting in terms of setting stuff up. Sixels are actually a bitmap graphic format that is supported in terminals. originates way back in the dot matrix days
both, should work with everything modern, although I never did any extensive testing
oh wow that's a really high definition image
the sixels?
relative to using characters, yea
Oh yeah. If I had started why after seeing that library, i'd 100% would have used sixels
oh that's you
Yup, lol. A stupid project that I put WAAAAAAY too much time into
i think i wanna use gruid still just for those retro graphics
ill definitely have to think of a project for sixels though
Yup, lol. A stupid project that I put *WHYYYYYY too much time into
FTFY 😄
lol, hey I have realtime playback at 120p, put some respec' on it, 🤣
F
Think it uses characters not sixels but still an interesting upgrade over lynx
Yeah, it does, just checked. Apparently sixel support is prett patchy
ye that's where i got the idea to split the characters into pixels
all hail the unicode half-block character
o7
did you know a good no-code website maker?
Idk Squarespace is the popular one now
I loved Wix way back in the day, idk if they're still relevant
Webflow is apparently pretty good
If you want something that requires some code you could use Hugo and just write posts/articles in markdown. If you are non technical wix or the like. NOT WordPress. There are enough vulnerable instances online.
oh, and keep a copy of every post you make on your own computer and 3-2-1 backed up
For using Hugo it is as simple as git with a private repo on GitHub, a local clone and a remote clone on your server. That is kinda what I do. You could even make it so that when you make a git commit you it posts it to the server. Google servers will likely throw your data on a ok SSD, so local SSD and HDD. That makes it two local with two mediums, and one remote location, with a total of three copies (min).
Long time lurker here, first time posting in a while. HUGE LTT
Been heads down building. Going to do a test event for our open source social WebXR tools https://www.etherealengine.org.
Really want to make a Linus web world!
We are an open code collective and are excited to show off a year of work. https://etherealengine.eventbrite.com
I get this error when deployed the code:
TS7006: Parameter 'params' implicitly has an 'any' type.
however, in my project, there's no src/components/MaterialUI directory at all
turn off ts/eslint 'no implicit any' rule
dunno why its spawning from a non-existing directory but maybe something to do with compiling? is this react?
fzf
:FZF, type in part of filename, win
time to sleep
i used to use ctrlp now i use telescope for that
fuzzy find op
Anyone know if opencv can offload processing to remote server? I would lile to handle processing on the server side but don't want to have to send the entire thing via the network
I didn't even knew this was something supported by Discord...
Like have the server take inputs from the device, and then serve results as a webpage that can be grabbed
I like secret stuff like this, it powers my curiosity. what else could discord secretly have built in 
how
(using React)
When the user presses back on the browser, the page still goes back. Is there a way to prevent that? Here is my code
const handleBack = (e: any) => {
console.log("handler called");
// e.stopPropagation();
// e.stopImmediatePropagation();
e.preventDefault();
console.log('event', e);
};
useEffect(() => {
window.onpopstate = handleBack;
},[]);
Idk much about opencv but u could prob set that up if it's just running a program for processing
What do you not want to send over the network, whatever does the compute gonna need the data yaknow
Might try checking stackoverflow, though altering the expected behavior of a web browser's core functionality (BACK, FORWARD, RELOAD, etc.) creates a bad usability situation for the end user. Totally understand that many modern web apps do this in their own way; just have to ensure that pressing BACK or FORWARD still cause the app's UI modals / user interface to appear to work as the end user expects.
https://stackoverflow.com/questions/60838781/controlling-browser-back-button-in-react
I have two electives to choose from in the next semester for my CS degree
- Design Patterns
- Data Warehousing and Mining
Can you please tell some pros and cons of each so that i can choose better.
What does option 1 mean? I think I have an idea.
Yo what's the difference between firemonkey and wpf
firemonkey is multi-platform whereas wpf is for windows apps
also firemonkey can be used to make mobile apps for iOS and Android but WPF is for Windows desktop apps
Design Patterns helps you think about all code you will write in the future. Data warehousing is boring corpo shit imo
Thanks for the input
In terms of classes it could be more fun though, hmm. You should try to dig up a syllabus for each and see what you might be doing specifically in each class
Thank you :D
np
Oh thanks for the effort, but please don't do it, I already have the syllabus.
But as I don't understand anything in the syllabus, I needed the assistance.
I meant "I would" as in "If I were you I would"
Oooo
I did that and searched on different websites.
I came to the conclusion that Data Warehousing would work for me
Design patterns likely will be more focused on code, while the other is focused on data. I think you can pick based on which interests you more. Personally I’d go design patterns, since data mining was never that interesting to me. But it all comes down to what you like / want todo.
Yes thank you, I have chosen Data Warehousing
Nice, even if you do it and come out saying “I hated that” it’s still valuable to know the basics of it, since many dev jobs will interact with or at least facilitate in the data collection process.
Also you never know you might come out of it loving it and decide to pursue a career more focused on data. Imo college is the perfect time to try a little of everything. 🙂
Thank you for the kind words, let's see what happens
the only design patterns they will teach you in school will probably set you back a couple years as opposte to starting as a total novice with some good collegues at your first job... the closest most teachers have come to operatrional code is prolly there excel paychecksheet , other than that they are just propagating all the wrong stuff they had to learn from their teacher who had a book that was popular at the time or so
My new coworkers are sus, they got defensive about my first PR because I made another source file instead of adding it to the already 1000 line main file lmao
that depends , in a verry large code base its sometimes easier to find stuf and follow a thread /procedure in 20 insanely large files , then it is to find your way in 800 files 100 subdirectories , of wich half are prolly files with a single funciton or class with 2 methods of wich one is init so
on the other hand large files with code that has no logical coherense , and of wich more than half are commentblocks of wich half are not actually up to date anymore and lines clearly written by someone with a 3x ultrawide widescreen 4k monitor setup that needed to use all width is also 🙂
(on the other hand i get often the remark that i should use the vowels on my keyboard sometime to keep the wear evenly spread )
(and particulary for python: that the convention for star-arguments and starstar-keywordarguments is : py def function(*args,**kwargs): value=kwargs.get('key') return args,kwargs,value and not:```py
def fn(*a,**k):
v=k['k']
return a,k,v
(we had no choice in what courses we had to take , you chose a field (ICT, electronics, socialstuff, architecture, civil engeneer (= the crazy smart people also known as Master of Science in Engineering), civilian engeneer (=the not so smart ones that got to reap the benefits of the name) , or whatever , but courses within that were set ), so i had to take , JAVA, Visual Basic, Web(javascript),Excel,, msql , access they were all of real use later on lol)
About 50 of those lines actually need to be in main the rest is like UI event dispatching and initialization routines. Only 15 files it's not a huge code base