#development
1 messages · Page 70 of 1
it's solved!https://paste.mod.gg/jahesuvivo.cs
finally! there might be some unused code there but honestly I don't care! If it works,it works!
It turned out that you have to use a Validating event even on the button to be able to set the DialogResult to false,otherwise even if you set it it doesn't care,it acts as if it's not.WTF? But it actually works now @warm sleet
Does java have an equivalent to python's "x = y or z" where if x=y iff y isn't null, otherwise x=z
@peak acorn Ternary operator
@peak acorn condition ? true : false
int wat = (foo != null) ? foo.intValue() : 0
@tired juniper I still struggle with building coherent applications in .NET forms
deperating view logic from functionality is annoying
I usually try to associate event handlers with this, and then making references on those
like, getting a thing to work in .NET forms is easy enough
but building larger applications without it turning into a total mess, is a bit more difficult
yup,true
@tired juniper generally, you should define your own events
things like validation, would be its own event
yeah
@tired juniper do you know how to use events in C#?
language has some constructs built in
to make this easy
yeah I think,you mean thouse evnets with the lightning icon in the designer. For example mouse click event(you type a custom name for the method) and then it creates the event
not really
the idea, is that you decouple functionality from your logic
so your logic listens for an event
like, ValidationEvent
public class SampleEventArgs : EventArgs
{
public SampleEventArgs(string text) { Text = text; }
public string Text { get; } // readonly
}
you create a class that holds the properties of that event
like ValidationEventArgs
and then to create an event, you need an event handler
Im assembling some bits of code
hold on
ok
right, so in my case, I have a special interface for the handler
public interface ISimpleEventHandler{
void OnSimpleEvent(SimpleEventArgs e);
}
this is used a reference for the delegate itself
now there's two bits missing
the handler itself, and the code that you write to invoke an event
yeah,that is not as difficult as I thought. You make your own class and then handler but how do you exactly invoke it?The event
right, for that. the language has a special keyword
hold on
so in your class that raises an event
// Declare the event.
public event SampleEventHandler SampleEvent;
you just declare this field
wait scratch what i posted before
I found a simpler example
class Counter
{
public event EventHandler ThresholdReached;
protected virtual void OnThresholdReached(EventArgs e)
{
EventHandler handler = ThresholdReached;
handler?.Invoke(this, e);
}
// provide remaining implementation for the class
}
so this declares an event, and a method that you can invoke to call this event
to add a handler
what you do
you 'add' your delegate to the event handler
this.ThreshHoldReached += <delegate>
class Program
{
static void Main()
{
var c = new Counter();
c.ThresholdReached += c_ThresholdReached;
// provide remaining implementation for the class
}
static void c_ThresholdReached(object sender, EventArgs e)
{
Console.WriteLine("The threshold was reached.");
}
}
^ this is the kind of method that the editor generates when you add an event handler for a button click
the event itself is declared in the class that represents the button
and you just attach a handler to it
so imagine you had a counter that used the system clock with a specific timeout
ok I see so when you make it yourself you just have to write your own class. And then attach the handler and trigger the vent and then you can use the method just like in the automatic ones
once that timeout has been reached, the Counter would raise OnThreashholdReached
yes
and the event handler, then executes every single delegate added to that event
since you are not limited to 1 event handler
though if you wish to do multiple event handlers, you do need to modify the construct slightly
// Define the delegate collection.
protected EventHandlerList listEventDelegates = new EventHandlerList();
// Define the MouseDown event property.
public event MouseEventHandler MouseDown
{
// Add the input delegate to the collection.
add
{
listEventDelegates.AddHandler(mouseDownEventKey, value);
}
// Remove the input delegate from the collection.
remove
{
listEventDelegates.RemoveHandler(mouseDownEventKey, value);
}
}
yeah so you make like a list with eventhandlers
yeah
the concept that really, powers this
is 'delegate'
think of a delegate, as a function pointer
instead of holding a reference to a value or object, it holds a reference to a method
C#'s guide defines them as:
A delegate is a type that represents references to methods with a particular parameter list and return type.
you can even define a delegate
public delegate int PerformCalculation(int x, int y);
and then implement it as: (x, y) => x + y
anonymous functions
so it defines what your method will accept and return
exactly
for the event
a delegate describes the signature of the method
in this case, we use it to define the signature of the event handler
because remember, each event has a different class for the EventArgs
so by using a delegate, the compiler is type safe when making these references
so you choose what EventArgs will be for your event
There's some type variance as well in delegates
class Mammals {}
class Dogs : Mammals {}
class Program
{
// Define the delegate.
public delegate Mammals HandlerMethod();
public static Mammals MammalsHandler()
{
return null;
}
public static Dogs DogsHandler()
{
return null;
}
static void Test()
{
HandlerMethod handlerMammals = MammalsHandler;
// Covariance enables this assignment.
HandlerMethod handlerDogs = DogsHandler;
}
}
so you can use it with OO inheritance
but this is advanced C#
to use delegates, you only need the basics
to write them, is a bit more involved
and my C# knowledge is rusty ;)
I wrote in it many years ago
I now mostly do Java, and recently I picked up TypeScript
typescript is sexy https://www.typescriptlang.org/
TypeScript extends JavaScript by adding types to the language. TypeScript speeds up your development experience by catching errors and providing fixes before you even run your code.
yeah,but that's not as complicated as I thought. thanks! I mean the inheritance is a bit more complicated but without it it'snot as hard,I might try to define my own handlers if I need specific things that don't exactly exist already
Inheritance isnt that complicated. its just knowing how and when to apply it correctly, is difficult
ah it's good. You know more than me anyway I recently started learning
many people tend to overcomplicate their structures
yeah
@tired juniper I draw from general OO concepts
these ideas work in many languages
its just the semantics that are different
In programming languages and type theory, polymorphism is the provision of a single interface to entities of different types or the use of a single symbol to represent multiple different types.The most commonly recognized major classes of polymorphism are:
Ad hoc polymorphism: defines a common interface for an arbitrary set of individually spe...
this is incredibly powerful
subtyping is a form of polymorphism
abstract class Animal {
abstract String talk();
}
class Cat extends Animal {
String talk() {
return "Meow!";
}
}
class Dog extends Animal {
String talk() {
return "Woof!";
}
}
static void letsHear(final Animal a) {
println(a.talk());
}
static void main(String[] args) {
letsHear(new Cat());
letsHear(new Dog());
}
C# would look incredibly similar
(this is Java)
where java uses the word extends C# just uses the : operator
class MyForm : Form {
}
this makes MyForm inherit from Form, it is a subtype
I think C# also uses the keyword abstract
aha so the first one is the inherited one,and it inherits all the properties
yeah, abstract types cannot be instantiated
they are like interfaces
but they can contain properties
so you can't do new Animal()
but you can declare Animal[] animals; arrays and such
and this animal array can then contain both dogs and cats
yeah
but you can only use the functions and properties they both share from their parent type
you can for example do animals[0].GetType()
and if you compare this with == typeof(Dog)
it would be true, if that Animal is of type Dog
^ this was C#, but in java this would once again be very similair
animals[0].getClass() == Dog.class
^ java
objects are instances of classes
and you can always get the type of an object
if you now, wish to call a method on that Animal, that you checked and found that is a dog
you could cast this
Dog myDog = (Dog) animals[0]
however, if the animal in questioin is not of type dog, this would raise an exception
^ this is bad practice though if you have to do this in your code a lot
its usually the result of bad OO design
Polymorphism allows for generalization like: Animal foo = new Dog()
and casting allows you to do the inverse
@tired juniper a good tip I can give you
in your visual studio solution
create a 2nd project
Right click the solution in the explorer
and click 'add new project'
and select Class Library
in your class library, you can create all the program's internal functions and logic
and your winform application, then uses this class library to provide a visual input/output layer for the logic
so your entire validation logic, the datastructures it uses, all of that, you store in your class library
oh so you can modify the logic and add custom stuff
yeah, so the calculations and such that you do
are not dependent on a form
the form merely uses that code
so you could turn it into a console application as well as a graphical application
or whatever
slap a webserver in
and make it into a webapp
xD
wow
nice
so technically you can make your own app which looks the way you want without the constraints the form puts on you
well, there's a concept of layering in software design
data layer, presentation layer
Like for example, consider this project I made in java, a project that consists of multiple libraries and programs
this is for a minecraft server of mine
This is the service-api-server its a project that provides a webservice
it depends on data models and classes described in the stubs
each of these blocks are class libraries, and the arrows point to the other libraries that they use
this plugin runs on the actual minecraft servers (there's total of 4)
and the panel is another project, that uses a client to connect to the server
https://i.imgur.com/oo9WP6q.png
plugin, a webservice, and a webapplication
the stubs describe the data structures, and the client connects them all up
maybe this example is a bit over the top
But what you should take away from this is that by turning your software into small blocks or units of code, that each have their own function
you can keep your code easy to read and understand, even if it is part of a larger project
in fact, you need this kind of structure, for larger programs
because at some point the complexity just becomes overwhelming, and this slows down development
That screenshot, let me show you how simple the code is behind that
So the webapplication, has to fill that table with data, which it gets from the client
this is the presentation layer, and it doesnt need to know anything about the data layer
since it is abstracted away.
this is the power of object oriented programming
yeah,OOP is powerful. But your project is definitely well organized having everything in separate blocks like this and separate parts makes it much easier to understand
and definitely it can get messy with bigger projects
@tired juniper btw https://i.imgur.com/y0WA17v.png
:D
This is what that client exchanges with the server
just xml documents going back and forth
also you have your own Minecraft server nice
well, someone else technically owns it
😄
but i have access to all the admin stuff on all our machines
oh and! it can do json
if you just send an HTTP header
it will also provide data in json format
building webservices with .NET is also not that hard
you can use ASP.NET WebAPI
nice,I also like your name Hogwarts,I am a big HP fan
@tired juniper haha, I am not at all lol
I joined them, because they needed a skilled programmer, and I was looking for a hobby project to hone my skills
yeah I have seen that in visual studio
oh so they came up with the name
I talked to their owner on IRC back in 2014
who had just split away from some other community, and were using this crappy minecraft hoster
I was like 18 at that time, and I had already got some linux experience
so I set them up with a dedicated server, and in 2015, I made efforts to build a cross-server synchronization system
we have like 5 worlds, and we synchronize inventories and such
nice
yeah sounds like it but you found a nice job
and our players each have a roleplay name
I don't get paid lol
this is all a hobby
we make a net loss on the server
oh ok:D
well I mean it's a cool hobby then
damn
😮
more per core perf
yeah,well it's a beefy machine but I get it there is probably lots of people on the server
not as many as we used to
now we have like 20-30 people on in the weekend
during 2016-2018, like 100+
but everything we have
is all custom
potions, quidditch, wands and spells
roleplay classes and such
If you add those up ^
wow,yeah that's what I have expected,sad that not many people go now
man that's so cool
we have like 50k users or something like that
nice
I might consider playing in your server sometimes I love the role playing stuff
just like Hogwarts
xD
I'm 25 lol
owner is now 29
but yeah, thousands of lines of code
and many years of effort from about 3-4 people, and 50+ some who had minor contributions
this core project I wrote, for just the database synchronization and web api and panel
is just under 30k lines of code
I also wrote the potions engine
though that is getting a rewrite by someone else soon
damn,but yeah it's a server so I would have expected that
nice! So you contributed to the HP factor 😄
we scraped the harry potter fandom wiki
to get a list of every single potion ingredient known about
yeah there should be everything you need there
and then I had an army of minions give catchy descriptions to each item
and come up with textures
an army of minions🤣
well yeah everyone's got their own thing to contribute with
we do that a lot lol
we use json for a lot of this stuff
its simple enough to understand for someone writing things like translations
most of our plugins that do a lot of text output to the user
are in multiple languages
ye
wow you guys really put a lot of effort into that well done! Also I really want to try your server now I like HP stuff,does it have a code or something(i don't know how minecraft sever joining works)
I can join and try it out when I finish with my school projects
well, you need to have a minecraft account, and have purchased the game ofc
nah, its just join by IP
I think its either hp.knockturnmc.com or play.knockturnmc.com I think either work
but yeah its at least worth checking out the scenery
there's a bit of scripted roleplay when you first join
oh yeah that would be awesome
buying your first wand and traveling to king's cross station
wow it's like an actual Harry Potter game in mineccraft I love it!
Quests are also a thing now.. I believe
I haven't really kept up with the developments in the last 2 years
I mostly maintain servers and our network
I haven't played minecraft a lot but I might now xD
I play modded mc
I have a private server up for that >_>
whitelisted to anyone cool enough to join
well that's essential
you have an important role in it
I was one of the original founders yeah
though I don't really play at all
I am in schoolyear 3 by just afking
with 0% class attendence
there's a very slow passive xp trickle you get from being online
oh no the teachers will be angry 😄
😆
hehe you have access to cheats by being an admin xD
I should know, since I wrote it
also it's really nice that you even get any XP by not playing just being online
This is what happens when a java developer tries to go full-stack: https://i.imgur.com/Xg5r5ar.png
Found this theme online
thought it was neat, and wanted to see how hard it was to make something with it
yeah looks neat
only thing that is not real in that view, is that network graph
I was trying to get a visual representation of what servers are bound together
ok
I just wrote some random graph in there to test
DOT is a graph description language. DOT graphs are typically files with the filename extension gv or dot. The extension gv is preferred, to avoid confusion with the extension dot used by versions of Microsoft Word before 2007.Various programs can process DOT files. Some, such as dot, neato, twopi, circo, fdp, and sfdp, can read a DOT file and ...
DOT lang
graph graphname {
a -- b -- c;
b -- d;
}
oh ok didn't know there was a language for graphs that's really neat
graph graphname {
// This attribute applies to the graph itself
size="1,1";
// The label attribute can be used to change the label of a node
a [label="Foo"];
// Here, the node shape is changed.
b [shape=box];
// These edges both have different line properties
a -- b -- c [color=blue];
b -- d [style=dotted];
// [style=invis] hides a node.
}
there are libraries such as https://graphviz.org/
javascript library that can consume DOT, and display it on screen
nice
that's good
knockturn has some things completely overengineered
also I will have to buy Minecraft when I play on the server because I admit I tried it on a pirated version because I didn't know if I would be playing it a lot so
pirated version can only do singleplayer or multiplayer on servers with authentication disabled
didn't want to pay money and I played just a few hours and got bored from the survival mode so don't regret not buying it
but for your server it would be worth it
yeah don't have enough patience mining
oooh so much nicer
you saw that minecraft turtle vid?
minecraft virus
and then a turtle ingame, would connect to his webserver
and he could then control the turtle
from outside the game
cool
he wanted to get onto this one minecraft server, that was whitelisted
so he got someone, to sneak his program onto the server, and run it on a turtle
xD
minecraft mods have unbalanced power creep
the name turtle is a reference to the turtle library right?
true
computer craft is only forge?
because forge is kinda annoying
works
fabric server is kinda beter
you just need a modpack descriptor
and it downloads it all from curse
manually modding minecraft is annoying
because you need many compat libraries
real homies remember deleting META-INF
and overwriting jar files
that's so cool having that turtle just mine for you I just saw the vids
yes
programming a turtle is annoying though
if you just want fast mining
you use a quarry
and also he created some nice looking computers for minecraft
well yeah you have to spend time programming it
automated farm in the middle
big tank full of oil in the back, next to the power plant building
my machine room is a bit of a mess rn https://i.imgur.com/zn35aam.png
nice,that looks advanced
I need to rebuild it, somewhere with more space
yeah it could use more space there is a lot of stuff
my original workshop is a total mess. https://i.imgur.com/SCMrcFN.png
most of that was still manually operated
and ofcourse, the best mod in the game: AE2
https://i.imgur.com/kz8Is3L.png
thanks for telling all about that classes and inheritance stuff by the way I saved the code so I can learn some stuff,you explained it really well and easy to understand
Digital item storage. with searchable inventory :)
your workshop looks awesome
@tired juniper if you want to learn some tricks with code
that is a lifesaver
using a console application is easier
because its just raw input output,a nd you can use it to easily test things
well yeah because you don't deal with other stuff just code
most of the programs I write are console applications anyways
those webservices
are in essence just console apps
well yeah you don't need graphical stuff for them because users can't see them anyway right
nice
yeah well my school did start on this but it's better like that because you understand the code better because otherwise just jumping into the forms from the beginning would be a bit overwhelming
my school actually introduced procedural programming first
using Processing2
after which they went onto Object oriented
processing is a dialect of java, more simplified
also searchable storage in minecraft is a blessing xD I have seen big youtubers struggle with their storage so I imagine how cool it would be having searchable one
but I already wrote java when they tried teaching me processing
so I got an F in the first assignment, because I was using classes
oh no
you can use those in processing.. xD
xD
you can also just import java types
if you put import at the top
they didnt like that
@midnight wind if you want to do computers in minecraft, OpenComputers is still superior
it has the ability to do remote terminal
and set up networks, as well as read and write data from tile entities from various mods
so chest contents, tank contents, or even control machines
anything fabric based?
?
Hehe yeah they didn't like that you used another language although that's kind dumb from them
it's new right? or are there other reasons?
sodium goodly tho
@midnight wind fabric lacks a coremod
common interface to provide integration with multiple mods
such as a fluid API
its "light" as in, it provides a thin integration layer between vanilla minecraft and custom code
servers such as spigot probably would use this
but a server with client side mods, forge is still superior since it provides many APIs so that mods themselves don't have to modify the game's code
forge is more than just forge
it provides a modloader, core mod, toolchain and are also the guys who maintain the obfuscation list, the same one used by fabric
i think as of recently mojang has started releasing official deobfuscation lists, but yeah forge did it first
@spring pond you know how they populated their db?
do it
they had an IRC bot in one of their channels
and you just sent it a command to give methods a name or add descriptions, to parameters and such
once an hour, it will export these definitions
and put them on their archive
are you saying that they crowdsourced their signatures? thats pretty cool if they did
they did
MCPBot
operated by briefcase speakers
or bspkrs for short xD
oh actually Mobius was the one who wrote original version
Mobius has close ties with Mojang
Does anyone who writes code use gdb to debug there programs?
Hey guys, does anyone have experience with using microsoft playfab with unity for Android?
I myself don't, although I know someone who does
i do
i only use it for C, but i do use it
ok what's wrong here? WPF StreamWriter streamWriter = File.CreateText(studentid+" "+label_facno.Content+".txt");
you havent given any information
you need to give at least a snippet of the variable object types
oh now it's just I used my label which had an unsupported character
A songification of that most holiest of Python Enhancement Proposals, the PEP 8.
Based on an idea by Daniel "Mr. Hemlock" Brown.
Written and performed by Leon Sandøy, A.K.A. lemonsaurus.
Music and melody from Mad World by Roland Orzabal. This version was inspired by the version released by Gary Jules.
🌎 Website: https://pythondiscord.com/
💬 ...
@tired juniper StreamWriter is an unmanaged resource
So you have to declare it with using
using (StreamWriter writer = new StreamWriter(@"C:\wat.txt")) {
sw.WriteLine("Hello World")
}
There's a couple parameters you can set, such as encoding and flushing behavior
Once the code steps out of the using { } block, any resources it declared will be disposed of
I want to hack Alexa with a pi
So I can add more stuff it can do
Extended smart home capabilities
But I’m working on a way to connect it
just set up your pi as a receiving server and aws will send commands once you integrate into the api
Hey everyone, check out this free dev-friendly data privacy training at https://lnkd.in/g_dHkZ3 - every coder needs to know this stuff these days! It’s new and of good quality.
what if i write the code that violates your privacy 
You sound like an ad and im not giving my email to this random website without any understanding of what it is
I'm ISO 27001 certified :P
dont need some free training to know about confidentiality
Well, programmers should learn, but also data science want to be people that are causing a bunch of the data leaks. They ask for a bunch of data and do not realize that it include SSN, credit card numbers, or other confidential information the decides that it is too hard to type a password so they make the data not password protected. They then forget about the database and the company realize that database exists, so they think there security is good.

lol
Heyo
I've been thinking about pros and cons of using C# vs Node.JS for a backend + REST API + DB
I'm familiar with both and I keep finding pros and cons for both
Sooo, anyone that could give more reasons or point toward a specific direction?
@vale pine are you only interested in backend technologies?
benefit of Node is being cross-platform
Unless you use .NET Core
REST APIs you can do in either .NET WebAPI with ASP.NET
Or just a mundane expressjs API
Mainly yes
Because for now the frontend would be mobile apps but would then probably expand to websites and stuff
The target was making it scalable and stable basically
scalability has more to do with the middleware layout you use
the way you track session information
as long as you keep your application stateless, you can scale it
@vale pine I'd say the choice between those two technologies makes little sense, unless you can provide some more context
Like, experience in the team that will be using it, as well as library support and target platform
if you aim to build lightweight cross platform applications, I'd say node is superior
Though, even then, I would stay away from pure javascript
in favor of https://www.typescriptlang.org/
TypeScript extends JavaScript by adding types to the language. TypeScript speeds up your development experience by catching errors and providing fixes before you even run your code.
i am not responsible for any brain damage caused by this picture, this is just a segment of almost 256bits of memory that is writable, readable, stackable and fast.. the problem is that it takes up way too much space o-o
(minecraft btw)
i need to make this shiz more compact or imma have a seizure
@nocturne galleon ever used Project Red ?
more advanced variant of redstone
doesnt require repeaters, allows for the stacking of 16 signals onto a bus cable
and even has integrated circuit support
so you can have 16-bit busses
and easily build 8-segment display decoders using those ICs^
but that loses the novelty of doing it completely vanilla
vanilla redstone is ass
that's the fun part
ill try it out... im learning computer science for the most part, so this will save me time instead of tinkering with redstone in mc
@nocturne galleon only time I ever do redstone stuff its with computercraft
they have a lua api for redstone, as well as those project red busses
computercraft?
okay
@nocturne galleon its pretty cool. You can attach peripherals such as a display or network
and communicate with other computers xD
@nocturne galleon though if you plan on trying this out, perhaps look at OpenComputers https://www.curseforge.com/minecraft/mc-mods/opencomputers
It is slightly more realistic, and integrates with other mods much better than computercraft
Like, I've used these things to make all kinds of crazy contraptions
from automated doors that only open to specific users
to nuclear reactor control
and its pretty funny :D
cus its a unix-like system
xD
One of the reasons that i like project red in this context, is because computercraft has an API for those 'bundled' redstone cables
okay that is cool, is there any other mods for fabric that you recommend when it comes to redstone? i run fabric and fabric_api btw
ah
forge is where its at
well, there's some mods that allow for wireless redstone
though I find this a bit cheat-y
well, i use fabric because there is sodium, phosphur, and lithium, which makes loading and generating 50x faster (not even exaggerating), and the game runs at a smooth
300-800fps+
300 during my 1000tnt explosion test
huh. I've been using forge for the longest time now
FML provides a layer between minecraft and mods, so that mods don't conflict with eachother
fabric lacks this 'core' mod
yeah, but it isn't that hard to figure out what works with what on your own
generally, very custom minecraft scenarios like heavy modding like you stated is better for forge, but, for performance and general game improvements using fabric is a go to in my opinion
if your environment isnt going to change, fabric is easier
yee
server mods such as spigot use fabric
okay, this conversation is no longer worth having in here, this is a development channel, not 'mc-mods'
we weren't talking about coding just there were we? just saying
Some people take it too far: https://www.computercraft.info/forums2/index.php?/topic/29848-tar-archiveunarchive-libraryprogram-for-craftos/
^ 
oh
yes okay, i can find the rest myself, or ask you if i need help in the future, but im not really intrested in api rn, im more interested in the actual assembly of a cpu. thank you though
^^ project red should be enough then
major benefit when using them for redstone is just the signal length
minecraft has a 15 block limit, redpower is like 255 I htink
okay
is red power a mod for minecraft, or is it that program you showed me earlier?
well, redpower was the original mod, its now called Project Red
Its a mod for the game
oh okay
@nocturne galleon goes up to 1.12
Project Red is a mod by Mr_TJP and ChickenBones. This mod is an unofficial continuation of the RedPower 2 mod, using all original code. This mod is focused on redstone circuitry, logistics, automation, decoration, and constructing large mechanisms. Furthermore it includes its own energy system, called Electrotine Power, to operate different mach...
their logic gates are awesome
AND gates and such, in a single block
configurable clock source, and such
@nocturne galleon oh one thing the wiki mentions, the mod is broken up into multiple smaller mods
the logic gates are a seperate package from project red
okay, im going to go now, im in the middle of class, no more pinging pls
ok
thanks
hey any of you interested in purchasing from me a 1 dollar Amazon Gift Card xD? I am short of a less than a dollar for a purchase and I have to go to the bank physically tomorrow for a few cents because those greedy fucks taxed me as soon as I got money in the card like instantly
through PayPal
i have a couple $ in my account
that i cant spend cuz theres notbjng to buy that ships free
ill dm u the code
u good w/ that??
wait is it like in Amazon
can you send me as cash? Because I need it for paypal
ok
yeah sorry I just posted here should have been general or somehting
var topic = Console.ReadLine(Crystal);
if (topic != developement) {
MentionGeneral(topic); }
fixed it
ah shoot sorry, didnt even see that it was under development
Topic currentTopic = Console.ReadLine(Crystal);
if (currentTopic != Topic.DEVELOPMENT) {
Channel.getByName("general").mention(currentTopic);
}
Java, mm.. nicer.
yo that's pretty lit
every time load up visual studio installer it just crashes
nice
Yeah visual studio is great once its downloaded, but i always found it annoying downloading it and also any add ons like monogame. And uninstalling it is even worse
how in the world do you check if a number == 0 with only bitwise operators
in C particularly but any language is basically the same for bitwise operators
@peak acorn explain the problem more
Create a function that takes in a char (1 byte type) and returns 1 if the input is zero, otherwise 0
Only using a single statement for return and only using ~ & ^ | >> and << operators
One way is just to do 7 bit shifts and & everything together but sheesh that's ugly
@peak acorn mask and compare
if you want to check if the 3th bit in an integer is high, you can mask it
int i = 5; // 0101
when you do:
i & 4 it would return 4
so by doing: (i & 4) == 4 you can check
this might work, got it from SO
return ~(((n | (~n + 1)) >> 31) & 1) & 1;
hey so how do you create an event for a submenu in WPF? Like I have a menu with 2 submenu items and I don't want them to use the same code when you click on them,so I can't create an event for the menu item,I have to create separate events for the subemnu items but how?
there's a command property on each of them but that doesn't accept string so what the heck do I type there?
can someone recommend me a course on javascript?
@craggy acorn
This one is helpfully for basics https://www.w3schools.com/js/DEFAULT.asp
This one is helpfully for just about anything web related. Even wired functions.
https://developer.mozilla.org/en-US/docs/Web/JavaScript
JavaScript (JS) is a lightweight, interpreted, or just-in-time compiled programming language with first-class functions. While it is most well-known as the scripting language for Web pages, many non-browser environments also use it, such as Node.js, Apache CouchDB and Adobe Acrobat. JavaScript is a prototype-based, multi-paradigm, single-threade...
thanks
do projects, best way for me to learn
Well, that's the best way to learn, but the real more entery leaves stuff would be better learned through tutorial like if else, functions, array, bars and types. Maybe classes.
who can do js backend development?
hey so I open a file in WPF(a text file using StreamReader and then edit the contents) but then how when I click save do I overwrite the file I just opened?
oh yeah but can I do it so as soon as I press save in my gui it overwrites the file I just opened without me typing the filename
?
Nodejs is a backend js run-time
im tired lol i mean who can do js in general
Me, why?
coz i have a project im trying to do need someone to do the script behind it while i do the frontend like desing etc etc
hop in dms for more info..
Yeah no thank you
okk 😄
hey is there a method of the streamwriter in c# that can save changes to a file you just opened(the contents of the file)?Like I open a file edit the contents in a textbox and then I want to save them to the same file without having to use the filename again
nvm I found a way
@warm sleet why is C# so popular here lol
yeah I used the write one for myself
by the way you told me about some class library in which I could modify logic or something for my app
where can I find it? I forgot can you tell me again
@tired juniper if you look in the solution explorer
there's a solution, and within that solution is your project
you can have multiple projects within a solution
so if you right click the solution, and click add project
@tired juniper https://i.imgur.com/NCqfivJ.png
@dim lava idunno?
I dislike C#, but I can still program in it
I prefer using Java
a good developer picks the best tool for the job
Indeed
and best can depend on a lot of factors
I've only used C# at a surface level, never went deep into the STL or its features
although for what I'm doing right now, it even requires assembly
Like, C can't do a few of the tasks in here
Like DLL injection/hotloading?
Interesting, what's the purpose?
xD minecraft
let me pull it up
@dim lava I used it to modularize a plugin platform
this thing can just load .jar files
all the magic is abstracted away ofc
in our case we use it to keep track of lore information in our roleplay server
Only thing I've done similar was a completely abstracted away compile-time inheritance system for a Unity-like 2D game engine
static game objects and settings
nice
and we also use it as an API platform
so our other plugins can integrate with one other, using an API provided by a module
so we don't run into stupid circular dependency issues
its powered by redis yeah
its running on multiple minecraft servers
provides an abstraction layer for player profiles across servers
as well as chat and synchronization
quite a lot of stuff in here
why r we still talking about minecraft haha
Also, I see what you mean now by bytecode manip
its been days
errr
well, persistence is done by the sql database
there's some logic in the proxy server
that makes sure one server saves a profile, before it is loaded on another server
chat and other realtime information, is synchronized through redis
we also use roleplay names, so that roleplay profile also has to be cached
so other servers where chat is received without a loaded profile, have to hit the cache for this
redis takes care of all of this
specifically
the hash sets
and pub/sub
Oh so this is even multi server too?
I like
and then there's pubsub
you basically have channels
on which you can subscribe
and other clients can push messages
so for example, if someone talks in global, you push a UUID + message on the redis channel chat.global
other side, receives this message, decodes the UUID and fetches profile from the cache (redis)
and then formats the message :)
this is how we got discord chat integration working as well
woaaaaaah
there's just a discord.js bot that communicates with redis
Yeah real time web technologies have always eluded me lol
and a special channel and class handler
Its so generic
the same code that works for discord also works for IRC
in fact, that's what it was designed for xD
@dim lava event driven programming, have you heard of this before?
Yup, absolutely, and I wish JS, being an event-driven language, actually took it to heart
Instead of needing huge libraries to properly do event-driven programming
well
its more from an architectural standpoint
between multiple applications, there may be an overarching process
Things like GUIs and web are absolutely the best targets for event-driven programming models
involving multiple messages between different systems
yeah that sounds like a pain. Do you have mock testing to help you develop that?
Mocking is the worst in C++ I'll tell ya
@dim lava lol how to check if someone is banned:
https://i.imgur.com/c4xUN8S.png
C++ was not designed for it at all
Now, I said i hate databases, but I've actually done a fair amount of SQL and PL/SQL 😅
Well, I'm not a big fan of server code to begin with so 🤷♀️
You should try out cassandra. I’m sure you’d have a lot of fun there
relational model just doesnt mesh well with the object oriented model
very boring and repetitive
and there are other database types that might be more suited for the job
def, although I never really worked with stuff that was best used for object models
ORM?
What's that?
but in practice, they bring up all kinds of edge cases and strange behavior
Object Relational Mapping
so instead of querying the Person table
lul ip ban
The Apache Cassandra database is the right choice when you need scalability and high availability without compromising performance. Linear scalability and proven fault-tolerance on commodity hardware or cloud infrastructure make it the perfect platform for mission-critical data. Cassandra's support for replicating across multiple datacenters is ...
It’s an Apache product so you know it’s good 
Of course, apache2 never fails 
Apache2 never decides to fault when loading a page and then decide to spawn 700 connections extra crashing your database
Nah couldn’t be it
@dim lava examples of ORMs are: Hibernate for java, Doctrine for PHP or Entity Framework for .NET
out of all of those
EntityFramework is the least shit one
Yeah I've never used em
because they encourage code first database design, and actually does a decent job
Although most of the query programming I did was without any sort of library
I did 4 years of raw PHP and MySQL in HS
ouch
kill me
Ouch... are you like... okay?
I recently discovered Typescript
actually makes javascript bearable
and has some powerful language features
It's had such a lasting impact that I completely reverted courses and now do embedded/hardware development
As someone who starred by learning js, js is terrible, and ts only marginally helps.
I don't want to touch web ever again
Web is a scary place.. compaction hides
It's also nice because there's no such thing as users being shit in embedded 😂
@cinder willow I did my graduation project in Typescript, with 0 experience in practical nodejs
Wrote a software generator and backend framework for writing SPAs with a headless CMS
Last semester I had to take a software engineering class, and use Node.js, React, and Mongo
Not only does our own internal engineers service the product, but the clients use it as well. So we have two different levels of stupid useless
React was actually nice to work with
Users*
I wish JS had the same event constructs that React did
Node was frustrating as hell because of the damn package management
^
Mongo I had no comment on
Nothing beats Maven. NOTHING
Just, the way maven sets up their project architecture and dependency tree
I also did 95% of the programming out of the 5 person team, because I was the only person that had done both front end development and back end development
Hahahhha npm i <package> —save
NPM has no support for reactor projects.
> Would you like to install and save this package?
you can't do multimodule projects in npm
You should see scientists/mathematicians trying to use software
Ew. Our software we tried to make it as simple as possible. If you want to send a notification you hit the notification button. NOT THE CASE BUTTON AND EXPECT THAT TO SEND A NOTIFICATION
mvn package
They’re different windowsssss
done.
Oh got the amount of times I had to reinstall npm was insane
with maven if you fucked up your local repo somehow
It gets stuck on old versions occasionally and there’s no good way to update it
Oh that would be nice
Only 200mb 
You know what's hilarious?
@cinder willow for an empty project, typescript, mithril and expressjs
Downloading from node whatever.com doesn't give you the proper configuration to start running
It gives you an older version with things like import not working
Yeah, I spent a whole day realizing that my node was just out of date
because I had a multimodule system in npm xD
even though I just downloaded it from the website
Yeah the out of date npm is very annoying
its all very confusing
@cinder willow mhmm welcome to the club
lol. I remember using jdeb
to build debian packages with maven
that was actually not that bad
you know what sucks?
come to C++ land and cry about our total lack of an ecosystem
systemd integration.
I have never used boost
never will
C++ STL now has basically all you'll need from it now, except for a few small things here and there
like flat_map
I've only written a tiny amount of native code before, besides microcontrollers
or ASIO, which we should be getting std::networking in C++23
Sadly yes
@cinder willow haha, I had to do that to work with OpenCV.
Yup
@cinder willow I ended up running into issues, during development
how does that handle objects
so we wrote a seperate program, and just hooked it up to java with a shell call
xD
exchanging json over the shell.
That reminds me of my freshman year of high school programming
We were learning python and I didn’t know python
and he couldnt get his toolchain to work..
And instead of googling “how to add a wait in python” I called a js file where I knew how to do it lmao
Ah yes
it plugs into anything
Our company had to spend 3 weeks of dev time cause one engineer refused to use windows
Sorry
fuck windows xD
I personally duelboot windows/arch
My poor laptop... it’s been through so much water
When powered on
And it’s still working just fine
Sounds like my work laptop
its really slow
That is the only thing we can actually do work on
kernel preemption makes an underpowered machine useable
it reduces throughput of the system, but at least the desktop is responsive even at 100% CPU
so under heavy load, it just tasks switches more often, so the system doesn't lock up
thats how I am able to run a windows vm in the background without grinding to a halt
I’ve missed so many deadlines because I have to wait 18 years to compile anything
maven compilation isnt that slow?
and I compile the kernel for my laptop with distcc
It is for compiling our projects lol
you can just have a server somewhere, as a compiler host
and you can cluster your build
For final tests we aren’t allowed to partially compile
Not allowed
Work rules
I wish I could
laptop needs like 2 hours to compile lol
but thats the entire ubuntu distro kernel
desktop needs like 15 mins
Have you ever used opal?
nop
Don’t
Yup. My company decided to create part of our software in a custom Opal
cypher: https://i.imgur.com/cxEdGsM.png
I’m so happy I’m not in that project
Sounds legit
Query language for graph databases
Isn’t that just graphql 
neo4j currently
Graph databases have some benefits over other nosql variants
they allow for atomic updates and transactions
so they are ACID, yet distributed
currently writing a report on the differences between RDMBS and graph databases
a graph of graphs
Graphs on graphs on graphs
You know what I think? We should just all return to writing machine code
xD
but interesting cases such as the privacy that comes with DNA tests like 23&me
such databases
allow you to store information seperate
yet still have relationships
but only from certain perspectives, depending on the level of access
I spent 5 hours yesterday fixing a bug in my ARM RTOS due to me having a tiny misunderstanding in the 1000 fucking page manual
I THOUGHT I was using SVCall, but I was actually using PendSV. This caused me to not configure PendSV, giving it a default priority of maximum (when it needed to be minimum for the correct behavior).
So it made me convinced that the problem was either in how i constructed the stack here
Or that I was choosing the wrong value from this table
Turns out, it was technically the second, but not because I was wrong, but because my misconfiguration made the PendSV exception interrupt the SysTick exception, causing there to be 2 active exceptions, meaning I couldn't return in Thread mode, I had to return in Handler mode. But that's not what I wanted. So after 5 hours of debugging, I fixed the priority of PendSV and it's all working now 🥺
hey by the way mouse enter in wpf is mouse hover right?
@cinder willow Build a lost opportunity cost graphic to show to management alongside a request for a server/host to run the big compiles
Yeah just haven’t had time to do that really
bring up saving money and pretty pictures to management is always a good attempt
especially the pretty pictures

I'm trying to make a basic caculator that tries to detect what you choose by geting the first letter or number in the string you submit and use a if statement to figure out which operation to do to the 2 numbers. Python
`print("What is your first number")
v1 = int(input())
print("What is your second number")
v2 = int(input())
print("Add")
print("Subtract")
print("Multiply")
print("Divide")
print("What would you like to do to these numbers?")
type = input()
type0 = (type[0])
print(type0)
if type0 == '1' or 'A' or 'a' or '+':
result = v1 + v2
print(result)
elif type0 == '2' or 'S' or 's' or '-':
result = v1 - v2
print(result)
elif type0 == '3' or 'M' or 'm' or 'x' or 'X' or '*':
result = v1 * v2
print(result)
elif type0 == '4' or 'D' or 'd' or '/':
result = v1 / v2
print(result)
else:
print("Not a valid value")`
