#development
1 messages · Page 66 of 1
I mean, can't you just get openjdk-9-jre with apt?
so i made a thing with TensorFlow Lite on my pi
how would I do a command like
if Human = in_frame:
#unlocks the rest of my code
else:
print("Please put face in frame")```
im no ml expert but i think you need to train a model
you can find them around the internet
just search something like "tensorflow face detection model"
Also one equal is assignment two is comparison in python
i have that i just need to make the unlocking system
you need to ask someone with more experience
i have 0 with ml
but if you need to do your own face then thats a lot more complicated
you need a completely new model
with your face in it
@umbral saffron what you would want to do is use callbacks
So when tensor flow detects face it will trigger a callback you specified
python
Idk, but do research on callbacks
Basically you give a function to a function and that function will call that function depending on when you want it to
what library are you using for video input
i usually use something like opencv for camera stuff
@umbral saffron have you looked at documentation and examples
that's the best way
it's usually more complicated then you think
if you have a separate computer you can run pycharm on it, I don't really recommend using pycharm directly on the rpi unless you have the newer model with at least 2gb ram (since it uses quite a lot of ram in my experience)
@umbral saffron you can just mount the program directory on your rpi to your local development environment, with sshfs
sshfs user@host:/path/to/dir /mnt/rpi
this would mount your raspberry pi to /mnt/rpi
if you then also spawn a regular shell, you can remotely debug too
Ah ty
@umbral saffron just connect as root and mount sshfs root@ip:/ /mnt/rpi
make sure the directory /mnt/rpi exists on your system, and is empty.
you can unmount with
umount /mnt/rpi
now you can view the entire device
all its files
and everything
so settings would be in
/mnt/rpi/etc
@umbral saffron this is one of the big things that i like, and windows has a lack of. Sure, you can do network sharing
but its all so overcomplicated and nonreliable to immediately work
@umbral saffron https://github.com/billziss-gh/sshfs-win
There's also this
allows you to map a windows network drive, to sshfs
instead of \\192.168.88.10\bla
can I use an rsa/dsa key? :?
idk
yeah, it's a bit hidden, you have to use
\sshfs.kr[LOCUSER=]REMUSER@HOST[!PORT][\PATH]
and that forces you to use %LOCALUSER%/.ssh/id_rsa
oh on linux it's just normal
LaTeX is baad
Its stupid weird
@errant tapir like random values?
floating pins you should tie to ground through a resistor
@rancid nimbus that's the same in essence, scp is just a subset of ssh
@errant tapir for buttons and such on an arduino, you'll always want to tie those pins to ground
only when you press the button, the resistance changes, and can you register a button press
If you don't reference those pins to ground, you'll have floating values randomly going up and down
how are wiring it?
you know, arduino is just an easy to use microcontroller, you kind need to wire it correctly for it to work
LaTaX is great!
idk what my problem is
i wire the ground to the other side of the pin and it doesnt work but same side it does
thats what i was going on
but
doesnt work
resistor has to be on other side with the pin
make it an input_pullup?
Yes. When it's like you're picture, the pin is connected to nothing (is "floating") still. You need the pin to be "pulled" gently to ground at all times, and then when the button is pushed, 5V goes through but has no resistance so the pin sees basically the full 5V.
The onboard/software pull-up is good too, but if you're just learning this, then there's value in doing it with the hardware instead of just the software so you can see what's going on and make sense of it.
Hey there! So I don't talk about it much, but I co-founded a non-profit 2 years ago to work on bigger open source projects, it's called AUPYA. We just released a video to present our main project for the moment, it's a firefox add-on called minimal, go check it out https://www.youtube.com/watch?v=Gtf9DYDtsHw
Minimal is a browser extension to experience a minimal, less attention grabbing internet experience. Internet should be a tool, not a trap.
🦊 Get Minimal: https://addons.mozilla.org/firefox/addon/minimal-internet-experience/
ℹ️ More information: https://minimal.aupya.org/
🟪 Contribute or report issues: https://gitlab.com/aupya/minimal
can anyone help me out. I'm trying to use python to grab json from a url. Every time i get an "SSLError" specifically "(Caused by SSLError("Can't connect to HTTPS URL because the SSL module is not available."))"
you need the ssl module?
what library are you using
I am using anaconda it has "openssl","requests" installed
requests.get(url)
have you tried using pip
it says already installed
can you give a screenshot of the output of pip install requests
It’s an arduino it would be pip3 right
you cant program an arduino with python much less use requests
this is a different issue
(trading) C:\Users\James>pip install requests
Requirement already satisfied: requests in c:\users\james.conda\envs\trading\lib\site-packages (2.25.1)
Requirement already satisfied: chardet<5,>=3.0.2 in c:\users\james.conda\envs\trading\lib\site-packages (from requests) (4.0.0)
Requirement already satisfied: urllib3<1.27,>=1.21.1 in c:\users\james.conda\envs\trading\lib\site-packages (from requests) (1.26.3)
Requirement already satisfied: certifi>=2017.4.17 in c:\users\james.conda\envs\trading\lib\site-packages (from requests) (2020.12.5)
Requirement already satisfied: idna<3,>=2.5 in c:\users\james.conda\envs\trading\lib\site-packages (from requests) (2.10)
nope
arduino is C or Cpp
pip is python
All i have in the file is
import json
import requests
json = requests.get("https://jsonplaceholder.typicode.com/todos/1")
i forgot the "
but its in the code
f
i am day 1 into this course and discrete structures or logic or whatever is kicking my ass lmfao
But the 4 pins are only actually 2 on the switch
So it shouldnt matter what side its on aslong as its on the same pin right?
Well obviously it does matter
If you're absolutely certain the top right and bottom right corners are electrically connected. I have some that aren't like that.
Idk might test it and see if its open or closed
Yes i am
i metered it
Positive its connected
Do you know it's all properly connected once in the breadboard? I cannot tell you how many deceiving flaky breadboards I came across as a lab monitor
https://www.reddit.com/r/Stadia/comments/lb6vdq/since_googlestadia_doesnt_want_to_enable/
I made a thing to make the stadia controller "bluetooth". It's okay. The lag only kicks in if you use analog input (so most of the controller I admit lmao) but this is probably just because the rpi0 is weak sauce
Tested the board all checks out
ok so i bought some raspberry pi picos to use as HID devices. i need to make a 2-key and a 4-key keypad.
Since i got 2 125mhz cores, will it be faster (or even a good choice) to handle USB in core 0 and input in core 1?
I think that's a good case to just chose the simplest option, since your max poll rate will likely be overkill even on just one core
hmm yeah 100hz is way less than 125mhz and theres no calculations on the device so it'll be fine
hmm
should they
i wouldnt trust it
guys does anyone have dev environment set up i cant install gdb latest cuz 404 error
for pi pico
what do you guys recommend for a newbie to game development , godot or unity?
unity
why?
thats what i went for. i already knew C# so it was fairly easy
i'm on arch so sudo pacman -S gdb. yeah but i get 404 not found
yeah already done with sudo pacman -Syu
tried upgrading everything
kernel 5.9.1 experimental
I also realize that is not the best solution
ofc u shouldnt trust that wtf
ok now it works
kinda of
everything is installed but i cant build
you know what
VM time
new environment in a VM and screw that
That obfuscated code
Yeah that has to be against tos
well idk about that
Shouldn't set the standard that something like that is okay. That one might be a meme or something but the next one might not be
what what are you talking about
What do you think I'm talking about? I have no idea what that script does do you? Why would mods allow something like that it's begging for some one to post malware that wipes your harddrive
No thats why I said I wouldnt trust obfuscated code, lmao
Yeah and it should be removed
eh ig
@rancid nimbus lol. I'm not saying you're posting malware I just saying starting the precedent of posting obfuscated code is begging for someone to post malware
On a lighter topic;
The USB HID spec includes a description of a magic carpet simulation device
It's a easter egg lol
Like the magic carpet from aladdin?
Is that boomer knowledge now
I have not! I do remember there was a time I would check out all of the 404 pages on the websites I went to because they sometimes had easter eggs/funny text lol
do u know that russian construction site lol
idk if the site still exists
just a funny 404 page
how
The Graieste Moldoveneste band (translated into English as "Speak Moldavian") has been born in the South-Eastern Europe, in the Chisinau, Republic of Moldova, in 2000 . The initial line-up included Calin Soroncean, Anatol Cebotari and Bogdan Dascal.
Moldova is a part of former USSR and the second poorest country in Europe, providing the large su...
this was the song the website played
banger
its just a funny 404 page loll
wanna know what is not not not fun
propositional logic
Hi, I'm having trouble cutting down on latency with ffmpeg, this is basically something that streams the screen into the stdout which gets piped into a web server to be streamed to the client, I've been playing with some options to try to cut down on lag, and have managed to get it to about 5 seconds of delay, can someone help me cut it to at least one second of lag if possible because I will be adding a feature to give mouse control. Part of the slowness might be because I'm running this in a linux vm since i'm going to be deploying to a linux machine. I based this off a npm package called stream-screen.
Note: although haste says so the language is javascript, I'm not planing to add types any time soon
http://haste.aboutdavid.me/mabuvaketu.typescript
not exactly sure if VM is a bottleneck I've run a windows vm with remote desktop smoothly before
Hey
I need to determine the biggest maths exposant using a maximum value and a "base" so by example, if someone inputs 2 for the base, and 100 for the maximum value, the closest value would be 64 and it'd be 2 exposant 6
how can I do that
@wind oracle exposant?
you ment exponent?
highest value in base2 you can calculate as such: 2^n - 1
for base10, it'd be: 10^n - 1
@wind oracle if you want it the other way around
you're looking for logarithms
@wind oracle https://i.imgur.com/JViVvLR.png
10-log of your highest value, divided by the n-log of your base (binary is 2, decimal 10)
ofc, fractions would be rounded up
hey guys whats the best laptop for programing, ill be doing CS at uni soon. My budget is 1300
usd
programming isn't that demanding
especially for smaller projects
I myself when I need to buy a laptop will probobly get a pinebook or somthing similar
i will be using it for 4 years, i expect it to be thin,good performance since im spending 1.3k

why is it a joke?
for school notes and just a normal laptop for myself it would be perfectly fine for me
but as a main
idk
it will be my main laptop for 4-5 years
i dont want to end up getting a mid laptop, as i will be spending hella time with
True
kinda eh lasptop, it has some QC issues. wt about getting a macbook/t14s
yeah I get you
I bought an intel Mac book pro 2020 and I’m very nice with it
CS and a bit of AI
maybe he's studying
anything is fine actually in this case
for school, idk. Most of my college programming classes are a joke tbh
lol, what do you do to learn then
you won't run a cluster of nodes
hmmm
I'm in HS, but in College as well. The worst was python, what a joke class
macbook is tempting, lot of my frineds got them and seniors recommend it too
ahahah yeah Python is kinda very basic in HS
in india esp
but i havent ventured too far from normal school stuff
I don't like apple, so I guess I have a bit of bias. Linux would be the best for me tbh
i want to get deeper into programming in uni
I like grapes tbh
nice me too
baaka
but yea linux
get an used thinkpad and save the money, by the time you finish the university you can get one
also you will have a better idea of your needs
im not that broke lol,
so ill just buy a new one lol
imean it is not broke lol
i ll just go with a new one
2nd hand is kinda a bad market here
also kinda hard to locate one
ebay?
get a mac if you like those devices, it's ok if you want the touchbar and the os
i may be getting into the convo a bit late, but i didnt like macs before i started using them but their unix compatibility is amazing
for a CS a mac is wasted money, you can have a better deal
its expensive but imo its worth it
especially if you can get the apple silicon version
which is in your budget
when I was a student there was no benefit to use a mac
well the battery life is insane
i do python and swift development on a mac and its a very nice experience
if you do get a mac id personally wait if you can until the next M revision because they're supposed to be really good
i have a M1 MBP
well battery life on ARM is nice
okay yeah ill wait
what are other better deals
any thinkpad, even used ones, xps, hp zbook
okay thats cool, i was looking at the t14s
what specs you got
i have 16 GB ram 8 core graphics and 1 TB drive (though i may have overspecced on the drive)
it was about $2500, i have a pro
i could have made an air work tho
they're very similar
yeah that would be nice, but the gpu is pretty good
in the current model?
yes, im planning on doing some ml projects on it eventually
if you dont need ml you really only need 6 cores
a friend of mine has a intel mac, he bought 4 yrs ago and uses a egpu to render his unity games on it
im going to use ml
then go 8 core
and AI related software
the M1 is extremely AI accelerated
it has dedicated ML cores + the GPU
the gpu isnt that great yeah
its like average gpu
it can run all normallstuf
but cant run games right
i mena it can run games but not too well right
well it can but it got really hot
the frame rate was decent on Beyond A Steel Sky
but it got too hot for my liking so
use an external kb while gaming
but it doesnt even get warm when compiling
unlike my old intel mac that burned my hands
you can? damn thats good to hear
yeah, just get a cheap usb c to usb a hub
yeah i def need that if im getting a amac
also how is the windows boot up thing
people said the intel ones load up windows much easier
there is no boot camp support on M1 until MS releases Windows for Arm
compared to the m1
people have gotten it working (and it works well) but you need to put in a lot of work
its expected to release by the end of this year or what
ok
ahh
once MS releases it it will be a lot better
i personally have a USB-C to HDMI/USB-A adapter with the USB going to a KVM switch so i can use my kb/mouse on my pc and my mac
mba also has the same compatibility
yeah true, but if im buying a mb ill buy a pro
beware M1 only has support for one external display at this time
yeah i know that, but it doenst matter
ok
how many dispalys will i use lol
i personally have 2 external displays and it took me a while to figure out why one wasnt working
we are talkign abt the m1, the m next gen gonna be better
yeah 100%
ahhh alright
early adopter stuff and all that
i think ill wait for mbp next gen
good idea
but when do you think it will comeout
it should be coming out around end of Q1/start of Q2 looking at Apple's previous releases
but that is ofc an estimation
not too far from now
2022 yeah?
idek
lol
cz 2021 q1 end is too mear
hopefully 2021
i expct it to be out by nov
just liek this year
but intel was refreshed during q1 yeah
yeah, there will definitely be a next gen this year but its hard to know when
np
im just super confused if i should get the mbp or t14s, i think mbp is a good choice
I'd expect they'll release a new AS computer Q1/Q2 this year
as?
Apple Silicon
Apple Silcon
from what ive seen its most likely gonna be something like a 0.5 rev like M1X not M2
but we'll see
I mean, they may call it an M1X LOL
yeah
but it wont be the same underlaying chip with modifications
oh thats fine
Again, just me guessing though
MBPs are great for uni if you're doing CS from my experience
anyways my uni is starting septemebrish, i thought if i had it a bit earlier i could do some stuff with it to get familiarized
okay cooll thanks for your advice
squid helped me a lot
Most CS unis are Unix-centric, so you'll have an easier time doing stuff
thanks my g
yeah yeah true
Windows is hell trying to do anything on
i have a burning hatred for cmd
WSL 2.0 is shit
ahh ool thansk a lot
im out
i spent over 6 hours trying to figure out if a mb is worth it for cs
i went to sal
ltt
Your millage may vary
I got tons of friends (myself included) who loved ours
most of my friends who had XPSs upgraded to a mac during our degree
👍
lets go mbp ftw
Whatever you do dont get a gaming laptop
worst mistake of my life to get one
2 days ago i decided to not get a gaming laptop
like 4 years ago
cz the tuf f 15 had low power suply for the gpu
what is the issue with gaming laptops?
the battery is too short?
is it too bulky?
only those 2 major issues yeah
- heat, loud fans
ah right'
you'll. h8 urself
i wish
really really wish
next gen m chips
shoudl support egpu
ill save up soem money and get a egpu within 1 yr of buying the laptop
@nocturne galleon check if your mac will support opencl and other low level api
do someone know why dose it saying that?
It can't find .net core sdk
how i can fix it?
The M1 supports OpenCL, though not a modern version iirc
Apple is pushing for people to use Metal, which makes sense because they’re using custom hardware now
yeah the entire Metal library is just a replacement for Open[Insert letter here]L
@nocturne galleon .NET framework and .NET Core are two different runtimes
.NET Core is entirely opensource
you need a different SDK for that platform
witch one?
You have the one for .NET Framework
lemme find you a link
Free downloads for building and running .NET apps on Linux, macOS, and Windows. Runtimes, SDKs, and developer packs for .NET Framework, .NET Core, and ASP.NET.
get the one on the right
.NET Core is for stuff that runs on linux and OSX too
this the one that all ready install
no it isnt
look at that version
5
thats the one on the left
oh, wait
in your case its the middle one
cough this is why I develop on linux :3 apt install dotnet-core
but it is holder
if you need debugging
Then you need the .NET Core SDK
that's what it is saying.

you know, if you have a question, just ask it right away dont wait for someone to acknowledge ur need to ask first

sorry lol I got busy
alright so I need to print out something like this
using a for loop
the maximum dividend (Which is 5 in this current situation) is set by an input form the console
you could use a nested loop and multiply the two indicies (plus one on each)
so this is your homework
not really
for (int i = 1; i <= valMax; i++) {
System.out.println(valMax + "x" + i + " = " + (valMax * i));
}
}```
it's a small part of it
Has anyone ever worked on Unity’s A* or navmesh by any chance?
So a N by N multiplication table?
The string formatting is for the gaps between numbers
For c in each col
for r in each row
printf("%5d", r*c)
format as you need
and for java that'd be System.out.printf("%5d", r*c);
I come across a problem
how do you do like "%5d" but with a variable instead of 5
2 string formats?
personally i'd use interpolation but that would also probably be possibly as well
yeah it doesnt exist in java
the highest upvoted answer is a string.format() call for interpolation lol
*on SO
yea so like
System.out.print(" X | ");
for(int i = 0; i < rows; i++)
{
String s = String.format("%%%dd",maxLength);
System.out.printf(s, i);
}
System.out.println();
%%%dd lmao
man writing stupid formatting things like that dudes assignment up above is such a pain
well there we go anyways
i suppose int would be a row
there we go, your homework is done
im not giving u the code
he can copy paste thiss
thats just for trying to set the padding on a string.format dynamically
which isnt required for the assignment
reverses blur algorithim
Create a program to un-blur in order to complete homework
Have you looked at tabs
They auto aline stuff
unnecessary
also would that even work
cus ur tryna right-align everything
\raggedright one might say
:)
I don't understand
what in particular
well most of it
like I usually need stuff to be explained part by part idk
what im guessing is ill need 2 for loops
Yes you certainly need 2 loops
One hint
Start by writing the output row by row
Get the basic part of the table built
Then, figure out how to write the first row of calculated numbers
wdym writing the output row by row
-
- | - - etc
It’s from the input right 😉
yessssss
If there’s 5 numbers, you need the 5 rows for the numbers + the rows you statically (always) have (like the X | row and the - - - row)
that's like the only thing im missing to turn my homework in
Look into how printf strings work
yes
hint: dont println
Found a program for that pdf editing. Xournalpp
works good
I would always use %d for numbers
im not sure what the difference is tho
screenshot?
%n makes it so on you either get /n or /r/n
Well, since on the example code you print you all the numbers once
that should be its own loop
how the fuck
I always seem to have this problem
idk how you can explain how to code something without just saying how you code it
It usually works much better in person unfortunately
yeah
well ill try
if you can accurately generate the top line of the sample then ur in a good spot
like the first loop x5 ?
that first gap might be too big but im not entirely sure
doesnt matter, thats an each change
I would just continue
I am lost
Do you know how string format for numbers works?
i think what you need to do
is use "%4d" or something, what that does is adds blank spaces before your number
so that the total length of the value is 4 characters
the *?
yeah so instead of printing i
you have to print i * n whatever n might be i dunno yet
n would be my dividend ?
what do u mean by dividend
oh
u might have the wrong word
idk if language barrier or anything but
divisor and divident are for division
oh
Divisor / Dividend
im a french canadian
For multiplication it would be, idk multiplicand?
oh yeah
but now you know what i meant
so for row 1, you multiply by 1, row 2 u do i*2, etc
simple
Put another loop around your loop for printing the multiplication
maybe at first but its not so bad
You can already print 1, 2, 3, 4, 5
so now we have to print it multiple times
You can re-use your code for your first line and modify it
so copy it and make a new one of it
and put a second loop around your printing code
oh
wtf
change the outer variable to J
little j
or thats fine
variable names are irrelavent
yup
so
you need a new line
after the end of the loops
simply system.out.println()
I add that to my loop that's in my loop ?
!
but the multiplications tho
yeah thats what I was looking at
what do u think u gotta do
huhhhhh the ----- must not be complicated I think
that sounds simple to me
alright buttt it has to have it's own loop nah ?
huuuuuuuuhhhhh
within your loop try to get anything that resembles 1 | 1 2 3 4 going
whats the issue
yeah not that
what you want is for each row, to only print " 1 | " once
so it doesnt need to be in the inner loop
since the outer loop is for each row, and putting it in another loop would be too much
sure
look at my first row tho wtf
put it after your single loop up top
usually thats how u wanna structure it
you print out your line, and then move the cursor to the next line
so you print out X | 123125151 , and then put a newline
I don't understand the print newline
by newline i just mean
system.out.println()
there is a character ("%n", "\r" or "\n" depending) that moves the printing to the next line
so if you print something, then print a newline character, then more stuff, it will be on 2 lines
System.out.println() just prints a newline character
Hang on, didn't the assignment or whatever say you need to use String.format?
oh sheesh
I mean that's not a painful conversion but just asking
well he asked us to align our stuff correctly
printf probably literally calls string.format anyways
because you havent told the formatter to add padding
padding is how you can add spaces to make every print the same size
so instead of printing
1 1
100 100
it would print
1 1
100 100
discord isnt monospace so idk if that looks right on ur end
huhh yeah it does
how do I do that
im still wondering about the ---+-------------------
and the -----------------------
I have this code to help you, though it does have a slight disadvatange
you can do monospace.
Do
Multiline
@wind oracle do you want this to solve yourself or do you want to ssee my code
you just need to tweak mine to cater to your needs
well im close to done
I mean i have all the src code to generate it of X by Y size i was just widthholding it
I just need to figure out my padding now
in favor of education
me too
I don't want to exposse
though I do think that my code won't help him that much
big help
I ssee you added the censor
Can't verify that for sure without using at least 4 as the input
oh that was the wrong file anywyas
Whats the current issue?
yes yours is ugly
ok, padding
its basically printf("%4d", <number>);
but test for the numbers
thats just how you do it, idk how you could explain it to someone else
like a bash script?
fuck that
eeewww
@peak acorn
public class Main
{
public static void main(String[] args) {
int row = 4;
if( row == 1){
System.out.println("x | 1");
System.out.println("1 | 1");
}else if( row == 2){
System.out.println("x | 1 2");
System.out.println("1 | 1 2");
System.out.println("2 | 2 4");
}else if( row == 3){
System.out.println("x | 1 2 3");
System.out.println("1 | 1 2 3");
System.out.println("2 | 2 4 6");
System.out.println("3 | 3 6 9");
}else if( row == 4){
System.out.println("x | 1 2 3 4");
System.out.println("1 | 1 2 3 4");
System.out.println("2 | 2 4 6 8");
System.out.println("3 | 3 6 9 12");
System.out.println("4 | 4 8 12 16");
}
}
}
thanks
my code has some slight disadvantage when the input isn't 1-4
I thought this would make me mad. And it did. But not in the way I thought it would. Well done
Look at my O(1) fizzbuzz code @hollow basalt ```java
public class Main
{
public static void main(String[] args) {
System.out.println("1");
System.out.println("2");
System.out.println("Fizz");
System.out.println("4");
System.out.println("Buzz");
System.out.println("Fizz");
System.out.println("7");
System.out.println("8");
System.out.println("Fizz");
System.out.println("Buzz");
}
first 10 lines fast as fuck
So now all you need is the ---+---
@peak acorn am I insane when I created a program that generates a source code like that
why does your code have curly on a newline once and inline the other time
just to troll fizzbuzz
yes
yes isn't a valid answer for why
So you could just print a ton of "-" in a loop
hmmmm
no thats cool
how
how not
How to what part
the ---+----------
Have you seen the enterprise fizzbuzz?
First try creating a for loop just to do "------" to the right length
doesn't look like using apache libraries
import com.seriouscompany.business.java.fizzbuzz.packagenamingpackage.impl.Constants;
lmfao
what if the caller only wants one instance
singleton = single insstance of class
my ss iss broken
damn it
is that not just new Foo();
but you need to make ssure there is no other Foo running at the same time
MMMMMHMMMMM ??????
well, your code iss much better than mine
I was thinking of just like i would make a static bool lol
So now you need the + and maybe formatting on the top line
I'll leak my src after hes done
maybe i should fix up some of the bugs it has
or the uglyness
the + hmmm
My method for that is kinda bad
but
You could say if you're on the right spot to add the +, add the plus, otherwise, add -
its bad cos it adds a conditional that is pretty much not necessary but
you can just play with the numbers until it works now
u got it yet?
Your system rn looks fine so you're close
also one thing, up top where you print(" X ") you should remove the first space, so that it lines up with the other numbers
So you could make it loop 1 less time, and manually insert a +
HMMM how
oh fuck i forgot the bottom orw
LOL mine is better than you now
class Main
{
public static void main(String[] args)
{
int rows = 35;
int cols = 35;
Integer maxValue = new Integer(rows*cols);
int maxLength = maxValue.toString().length() + 1;
int maxLengthForColHeader = new Integer(rows).toString().length();
String beginningMessage = String.format(" %%%ds | ", maxLengthForColHeader);
System.out.printf(beginningMessage, "X");
for(int i = 1; i <= cols; i++)
{
String s = String.format("%%%dd",maxLength);
System.out.printf(s, i);
}
System.out.println();
for(int i = 0; i < beginningMessage.length() - 1 + cols*maxLength; i++)
{
if(i == maxLengthForColHeader+2)
{
System.out.print("+");
}
else
{
System.out.print("-");
}
}
System.out.println();
for(int row = 1; row <= rows; row++)
{
System.out.printf(beginningMessage, row);
for(int col = 1; col <= cols; col++)
{
String s = String.format("%%%dd",maxLength);
System.out.printf(s, row*col);
}
System.out.println();
}
for(int i = 0; i < beginningMessage.length() - 1 + cols*maxLength; i++)
{
System.out.print("-");
}
System.out.println();
}
}
the way that the numbers shade the screen kinda look like log functions
ew what the fuck
screencap the result?
nvm i forgot i have linux
cool lol
why does my code look simpler tho
becos urs is simpler
int valMax = 9;
System.out.printf("%s", "X |");
for (int i = 1; i <= valMax; i++) {
System.out.printf("%4d", i);
}
System.out.printf("%n");
System.out.printf("%s", "--+-");
for (int j = 1; j <= valMax; j++) {
System.out.printf("%s", "----");
}
System.out.printf("%n");
for (int i = 1; i <= valMax; i++) {
System.out.printf("%1d %s", i, "|");
for (int n = 1; n <= valMax; n++) {
System.out.printf("%4d", i * n);
}
System.out.println();
}
for (int j = 0; j <= valMax; j++) {
System.out.printf("%s", "----");
}
}```
Do u see this uglyness
lol
int maxLengthForColHeader = new Integer(rows).toString().length();
String beginningMessage = String.format(" %%%ds | ", maxLengthForColHeader);
System.out.printf(beginningMessage, row);
thank you tho
yup :)
you were of a great help
Now i got a challenge for u ppl
Are there any elements in the periodic table, where their symbols encoded in any base (using the normal 0-9;A-Z system) are equal value to its atomic number
so dos mine
oh formatted urs looks much nicer
still guy but
i have no clue what i just typed
why the fuck won't my shit quit
it has shit tier highligting in dcord
i mean tbf its about the same highlighting as vscode gives me
ouf my shit is too big
and the answer to thatelement thing is no
however if u start the encoding for bases as A=0 and Z=numberOfLettersInAlphaBetCantRemember
then theres like 4
:)
thats some big code
his homework
its definitely extra
the multiplication was only maybe 30 lines or something
exit
bash yucky
the fact u have a bash shell discord
OH
im
deaf
blind
idk
dyslexic
helen kellerd
hes disappearing
🧠
@peak acorn this is pure magic: https://i.imgur.com/jcJsBrj.png
you can just calculate how many digit spaces you need for a base-10 number :3
to string and then length compare seems so.. easy and dirty lol
@rancid nimbus yeah but this is java specifically
and int to string and then range count is rather expensive
10log(value) + 1
should give you max column size
2log() for binary and 16log for hexadecimal
logarithms are just lookup tables, you're not creating a string instance
so its generally easier on the system
1000 = 10^3
- 1 = 4
2log of value = 10log(value) / 10log(2)
or other way around, I forget lol
10 log is the default in this case
though I think Math.* in java has log and log10
or 2 log, I forget lmao
even java had changes with this, java8 does not declare a log10()
@rancid nimbus the reason its efficient to use logarithms is because in java, these are native functions
/**
* Returns the natural logarithm (base <i>e</i>) of a {@code double}
* value. Special cases:
* <ul><li>If the argument is NaN or less than zero, then the result
* is NaN.
* <li>If the argument is positive infinity, then the result is
* positive infinity.
* <li>If the argument is positive zero or negative zero, then the
* result is negative infinity.</ul>
*
* @param a a value
* @return the value ln {@code a}, the natural logarithm of
* {@code a}.
*/
public static native double log(double a);
and the native implementation, within the runtime is probably a lookup table
as they do with pocket calculators and such
before calculators, there were literal log tables
would be a decently sized book
with a lot of pages full of numbers
strings are objects
int maxlength = (int) Math.log(rows) + 1
string is an array of char
you just count the length of the array
Look, in C this would be fine
since you can directly check memory space
null-terminated string would be harder
since you have to iterate
Intel even has library extensions for their processors
to do logarithm calculations in the hardware

