Join devRant
Do all the things like
++ or -- rants, post your own rants, comment on others' rants and build your customized dev avatar
Sign Up
Pipeless API
From the creators of devRant, Pipeless lets you power real-time personalized recommendations and activity feeds using a simple API
Learn More
Search - "args(args& args)"
-
Most hated language features?
PL/SQL:
• it exists
XSLT:
• it also exists
PHP:
• it still exists.
VB:
• Significant parentheses: `subName` calls the subroutine, and `subName()` calls the subroutine and gets a return value. If you use the wrong invocation, it yells at you. Why!?
• For reasons unknown, you can only have `sleep` appear once per codebase. (So put it in a function!)
Ruby:
• It’s bloody easy to write code with absolute shit performance, and it kind of feels encouraged because of just how easy Ruby makes everything. Less critical thinking means worse performance, and Ruby’s blissful elegance encourages mental laziness.
• Minor: You cannot pass a hash as the first method parameter without enclosing it in parentheses, ex:`method({key: value})`. This is due to the ambiguous case between passing a hash argument and a (curly) block/proc (`method {|args| code}`). This could be remedied pretty easily with a little bit of look ahead.
• Minor: There is no `elsif` for `unless` (a negated if). Why? No reason given.
Python:
• no block endings, so nested code can be extremely difficult to follow.
Bash:
• The freaking syntax oh god why.
All languages:
• rand vs rand() vs Rand vs Rand() vs rnd vs RND vs random() vs random vs randInt() vs Math.random() vs Math.randInt() vs ...18 -
I wrote a database migration to add a column to a table and populated that column upon record creation.
But the code is so freaking convoluted that it took me four days of clawing my eyes out to manage this.
BUT IT'S FINALLY DONE.
FREAKING YAY.
Why so long, you ask? Just how convoluted could this possibly be? Follow my lead ~
There's an API to create a gift. (Possibly more; I have no bloody clue.)
I needed the mobile dev contractor to tell me which APIs he uses because there are lots of unused ones, and no reasoning to their naming, nor comments telling me what they do.
This API takes the supplied gift params, cherry-picks a few bits of useful data out (by passing both hashes by reference to several methods), replaces a couple of them with lookups / class instances (more pass-by-reference nonsense). After all of this, it logs the resulting (and very different) mess, and happily declares it the original supplied params. Utterly useless for basically everything, and so very wrong.
It then uses this data to call GiftSale#create, which returns an instance of GiftSale (that's actually a Gift; more on that soon).
GiftSale inherits from Gift, and redefines three of its methods.
GiftSale#create performs a lot of validations / data massaging, some by reference, some not. It uses `super` to call Gift#create which actually maps to the constructor Gift#initialize.
Gift#initialize calls Gift#pre_init (passing the data by reference again), which does nothing and returns null. But remember: GiftSale inherits from Gift, meaning GiftSale#pre_init supersedes Gift#pre_init, so that one is called instead. GiftSale#pre_init returns a Stripe charge object upon success, or a Gift (and a log entry containing '500 Internal') upon failure. But this is irrelevant because the return value is never actually used. Pass by reference, remember? I didn't.
We're now back at Gift#initialize, Rails finally creates a Gift object using the args modified [mostly] in-place by all of the above.
Another step back and we're at GiftSale#create again. This method returns either the shiny new Gift object or an error string (???), and the API logic branches on its type. For further confusion: not all of the method's returns are explicit, and those implicit return values are nested three levels deep. (In Ruby, a method will return the last executed line's return value automatically, allowing e.g. `def add(a,b); a+b; end`)
So, to summarize: GiftSale#create jumps back and forth between Gift five times before finally creating a Gift instance, and each jump further modifies the supplied params in-place.
Also. There are no rescue/catch blocks, meaning any issue with any of the above results in a 500. (A real 500, not a fake 500 like last time. A real 500, with tragic consequences.)
If you're having trouble following the above... yep! That's why it took FOUR FREAKING DAYS! I had no tests, no documentation, no already-built way of testing the API, and no idea what data to send it. especially considering it requires data from Stripe. It also requires an active session token + user data, and I likewise had no login API tests, documentation, logging, no idea how to create a user ... fucking hell, it's a mess.)
Also, and quite confusingly:
There's a class for GiftSale, but there's no table for it.
Gift and GiftSale are completely interchangeable except for their #create methods.
So, why does GiftSale exist?
I have no bloody idea.
All it seems to do is make everything far more complicated than it needs to be.
Anyway. My total commit?
Six lines.
IN FOUR FUCKING DAYS!
AHSKJGHALSKHGLKAHDSGJKASGH.7 -
import java.util.Exception;
try {
public class A {
public static void main(String args[]) {
new Exception();
}
}
}
catch(Exception e) {
System.out.println("Got you BITCH");
}9 -
Normally I just read rants but my new assignments is just to much and I have to vent a bit.
So I was assigned on a new company to help them with their automated tests (I'm normally a developer) which was fine for me. Especially when they said a guy that have 10+ years of experience have worked on the framework for a couple of weeks so it should be fine and ready. So I though it would be a quick deal.
But then I got there and... it's the worst C# code I have ever seen. I can live with the overuse of static, long method and classes and overally messy classes that doesn't really seems to fit (it's bad but not unusual in test code it seems). My biggest problem is overuse of the damn "dynamic" keyword.
Don't get me wrong, dynamic can be good and it have it's uses but here they use "dynamic args" in every single method, every one! They don't care if the method only require one value or ten values, they use dynamic args. Then you follow this "dynamic args" parameter going in to sub method after sub method and you have no idea what they use.
And of course they don't know if anyone use the methods correctly (as you have no damn clue what to use without checking the source code) so in 75% of the methods they convert the dynamic to an object and check if it contains "correct argument".
So what I have here is a code that isn't just hard to use, it's a hell to maintain.
So I talked with this with other testers on the team and they agree, but as most of them lack experience they couldn't talk back to the senior that wrote it. So I hope to sit down with him this week and talk this through because it would be fun to hear the arguments for this mess.
/rant10 -
public class HelloDevRant
{
public static void main(String[] args)
{
//Commenting for reasons! ;)
System.out.print("Hello dear devRant community!\nI am new here!\nNice to meet you.");
}
}5 -
Fucking hell, that's now the fourth time in a row that I see my clients getting ripped a second asshole by previous developers, this one charged 1500$ for a "python script" that only calls ffmpeg with couple args, claiming tons of shit like the video being e.g. better quality after conversion - even though all it does, is a straight convert from one format to another. (no filters, anything, just a convert) I feel always so terribly bad discovering that shit and them proudly telling me about the "solution" they invested in..4
-
Yesterday I had to ask a classmate what the arguments of a method were (no documentation).
He said: "Uhmm it doesn't matter in which order you put the arguments into the method?"
No more to say.5 -
Sometimes I want to slap myself.
I’ve been making progress with my voice activated TV remote project - coz you got to use a Google Home and a Raspberry pi for something right? Right??
Anyway, when the API you have written suddenly stops working and you’ve spent hours trying to solve it, it is really soul crushing when you realise you’re using a class variable incorrectly
I’ll just go cry now, while I control my tv 😥😎
Class TVAPI{
Private $tvIP = “192.xxx”;
Private $args = $this->decodeArgs($_GET);
Function of tvVolume(){
exec(“python tvRemote.py {$tvIP} {$this->args}”);
}
}2 -
Python. Ok, so it's a really cool language, as a scripting language it's awesome, quick to write.
When it's been used to make full fledged oop programs that you suddenly have to maintain things like duck typing become problematic. Looking at an object fuck knows what methods are available. Worse still when some bastard that thinks he's being clever doesn't bother declaring any object attributes and instead overrides the __set_attr method to dynamically add them as they are used there is no hope for the poor sod that has to maintain it later.
I've also now worked out I'm at least the 3rd person having been given the task of maintaining it, i spent a day changing CLI options wondering why they didn't do anything but occasionally crash the app. I've now found a few thousand lines deep that someone had hard-coded these values because they couldn't work out where to get the CLI args from!
I've gained a new appreciation for nominative, strictly typed languages.11 -
Hi every developer! My name is Allen. English is not my native language so forgive me if I say something that does not make any sense. Let me tell you my story how I become a programmer. (I am still learning) My first computer was a DELL OptiPlex GX 720 desktop. My father bought it for our self-employee job. Before he allow me to use the computer, I used to sit next to him and watching what he do, what he click and what he gets. When he allow me to use the computer, I was slow at typing. One or 2 WPM (word per minute) my father taught me how to use the computer. Very slowly, my typing speed improves. I understand how to use the computer. but one day, I do what make me regret. I was playing with some executables, when I double clicking it, it does not work I used to associate files with apps. I associate music files with every player I want. So, I did what I used to, I associate exe files with windows media center! The computer started to open hundreds of windows media center (WMC for short) whenever an app is clicked, it opens windows media center. Today, I realized that windows were trying to open every app and every process that regularly run. However, since I associate it with WMC, instead of the app itself, it opens WMC some days after the mistake, I wonder how apps work and how I can create my own. My father told me before that a program is simply a binary file that the computer can read. However, it was too advanced to me at the time.I begin my search with google. Everytime I search, it says "learn to code" or something like that. I see some C++ code but, it was disgusting. when I read just a few lines of a hello world code in java. it was too complex
What I seen
#$$#% $%&$%&*#!@
~
(&*%&$ (_(*^% #&&* (^^$(&^$%^( %^*$())
~
^$70^(`*#%`*#&%^)*!" Hello world "#@
~
~
The actual code:
class helloworld
{
public static void main(String args[])
{
System.out.println("Hello World!");
}
}
I look for an easy way but my attempts fail. then. I push
I to learn how to code.I try learning java. but it still
Very complex. i tried LibertyBASIC. from LibertyBASIC to
Java. after learning LibertyBASIC, it was easy!
LibertyBASIC -> Java -> Ruby -> NOW, C# and XAML
Today, I am learning C# and XAML.
My first OS : Windows 7
My first Computer : DELL OptiPlex GX 720
My first successful click : The Start menu
My first used App : Microsoft Encarta 2009
My first created App : Hi-Lo(number-guessing game. written in LibertyBASIC)
Thankyou for reading this Long story.
8 -
Syntax for my proposed "unsure" programming language.
Variable declaration:
let's just say that <variable name> = <value>
Function declaration:
hypothetically, we could <function name> (<args>){}
Try/ catch:
it's possible that
{
}
...or not (<ex>)
{
}3 -
class Life extends Death{
public static void main(String...args){
Guy me = new Guy();
me.born();
GirlFriend gf = new GirlFriend();
me.setGirlFriend(gf);
me.getMarried();
me.haveSon();
me.die();
}
}
------- Exception on line 5: NullPointerException, girlfriend cannot be null ---
Daaamnn6 -
public class Main {
public static void main(String[] args) {
System.out.println("Hello, World!");
}
}
sorry for my messy code19 -
🎶"You args the IO Exception,
You args the IO Exception,
You args the IO Exception,
You args the IO Exception"🎶
-The Only exception by Paramore -
Just 2 days spend on debuging a function !
Definition:
int func (int x, int y) {
...
}
Call :
int c = func (y, x);
I checked 1000 line for debuging this :-\
Plz remember that check your function args while debuging1 -
How do you deal with massively poorly-performing and unknowledgeable teams?
For background, I've been in my current position for ~7 months now.
A new manager joined recently and he's just floored at the reality of the team.
I mean, a large portion of my interview (and his) was the existing manager explicitly warning about how much of a dumpster fire everything is.
But still, nothing prepares you for it.
We're talking things like:
- Sequential integer user ids that are passable as query string args to anonymous endpoints, thus enabling you to view the data read by that view *for any* user.
- God-like lookup tables that all manner of pieces of data are shoved into as a catch-all
- A continued focus on unnecessary stored procedures despite us being a Linq shop
- Complete lack of awareness of SOLID principles
- Actual FUD around the simplest of things like interfaces, inversion of control, dependency injection (and the list goes on).
I've been elevated into this sort of quasi-senior position (in all but title - and salary), and I find myself having to navigate a daily struggle of trying to not have an absolute shit fit every time I have to dive into the depths of some of the code.
Compounded onto that is the knowledge that most of the team are on comparable salaries (within a couple thousand) of mine, purely owing to length of service.
We're talking salaries for mid-senior level devs, for people that at market rates would command no more (if even close) than a junior rate.
The problem is that I'm aware of how bad things are, but then somehow I'm constantly surprised and confronted with ever more insane levels of shitfuckery, and... I'm getting tired.
It's been 7 months, I love the job, I'm working in the charity sector and I love the fact that the things I'm working on are directly improving people's lives, rather than lining some fintech fatcat's pockets.
I guess this was more a rant than a question, and also long time no see...
So my question is this:
- How do you deal with this?
- How do you go on without just dying inside every single day?8 -
An interesting python function I just made. Probably not the first to do so.
def printf(fmt, *args):
print(fmt, args, end="")9 -
I got my dirty fingers on this leak of an AMAZING ML model capable of pondering EVERY PARAMETER IN THE UNIVERSE and saying if your business idea needs improvement or is good to go.
BEHOLD THIS 100% PURE PYTHON SOLUTION:
```python
import random
def magic(*args, **kwargs):
if random.random() > 0.5:
return "Good to go!"
else:
return "Requires improvement on value proposition"
```
This LEAK is from a startup that just received 4 BILLION USD IN VENTURE CAPITAL to improve their AI SYSTEMS.
Literally enough money to solve world hunger forever.
Who else is gonna invest in NEW THERANOS ADVANCED A.I. RESEARCH INTERNATIONAL INC?8 -
How to write a proper Hello World program in Java:
public class ProperJavaProgram {
public static void main(String[] args) {
try {
// Write the hello world file
List<String> lines = Arrays.asList(
"#include <stdio.h>",
"int main() {",
"printf(\"Hello World!\\n\");",
"return 0;",
"}"
);
Path file = Paths.get("awesome-program.c");
Files.write(file, lines, Charset.forName("UTF-8"));
// Execute the file
executeCommand("cc awesome-c-program.c -o awesome-executable");
executeCommand("./awesome-executable");
} catch (IOException e) {
System.out.println("You're screwed, just use Java and get over it. " + e);
}
}
public static void executeCommand(String command) {
try {
Process p = Runtime.getRuntime().exec(command); // Run the process
BufferedReader stdInput = new BufferedReader(new InputStreamReader(p.getInputStream())); // Get the output
String s; // Print out the output
while ((s = stdInput.readLine()) != null) {
System.out.println(s);
}
} catch (IOException e) {
System.out.println("You're screwed, just use Java and get over it. " + e); // UR SCREWED
}
}
}2 -
I used to think that I had matured. That I should stop letting my emotions get the better of me. Turns out there's only so much one can bottle up before it snaps.
Allow me to introduce you folks to this wonderful piece of software: PaddleOCR (https://github.com/PaddlePaddle/...). At this time I'll gladly take any free OCR library that isn't Tesseract. I saw the thing, thought: "Heh. 3 lines quick start. Cool.", and the accuracy is decent. I thought it was a treasure trove that I could shill to other people. That was before I found out how shit of a package it is.
First test, I found out that logging is enabled by default. Sure, logging is good. But I was already rocking my own logger, and I wanted it to shut the fuck up about its log because it was noise to the stuffs I actually wanted to log. Could not intercept its logging events, and somehow just importing it set the global logging level from INFO to DEBUG. Maybe it's Python's quirk, who knows. Check the source code, ah, the constructors gaves `show_log` arg to control logging. The fuck? Why? Why not let the user opt into your logs? Why is the logging on by default?
But sure, it's just logging. Surely, no big deal. SURELY, it's got decent documentation that is easily searchable. Oh, oh sweet summer child, there ain't. Docs are just some loosely bundled together Markdowns chucked into /doc. Hey, docs at least. Surely, surely there's something somewhere about all the args to the OCRer constructor somewhere. NOPE! Turns out, all the args, you gotta reference its `--help` switch on the command line. And like all "good" software from academia, unless you're part of academia, it's obtuse as fuck. Fine, fuck it, back to /doc, and it took me 10 minutes of rummaging to find the correct Markdown file that describes the params. And good-fucking-luck to you trying to translate all them command line args into Python constructor params.
"But PTH, you're overreacting!". No, fuck you, I'm not. Guess whose code broke today because of a 4th number version bump. Yes, you are reading correctly: My code broke, because of a 4th number version bump, from 2.6.0.1, to 2.6.0.2, introducing a breaking change. Why? Because apparently, upstream decided to nest the OCR result in another layer. Fuck knows why. They did change the doc. Guess what they didn't do. PROVIDING, A DAMN, RELEASE NOTE. Checked their repo, checked their tags, nothing marking any releases from the 3rd number. All releases goes straight to PyPI, quietly, silently, like a moron. And bless you if you tell me "Well you should have reviewed the docs". If you do that for your project, for all of your dependencies, my condolences.
Could I just fix it? Yes. Without ranting? Yes. But for fuck sake if you're writing software for a wide audience you're kinda expected to be even more sane in your software's structure and release conventions. Not this. And note: The people writing this, aren't random people without coding expertise. But man they feel like they are.5 -
Working on Ruby on Rails for first time..
Blogs mention it's more human readable..
I guess I feel like semicolons, args and braces to be more readable... -
Without using editor...
public class Test {
public static void main(String[ ] args) {
int value = 3, sum = 6 + --value;
int data = --value + ++value / sum++ * value++ + ++sum % value--;
System.out.println(data);
}
}
a) 1 b) 2
c) 0 c) 318 -
Python devs and data analysts....
Do you recommend using pycharm for working with jupyter notebooks? I surely had a bad time with it.
I have been using many jetbrains softwares , and am a fan of their docs search and autocompletion. But I don't think there is a full support for jupyter jn it, because sometimes my graphs made using matploit or seaborn just brakes.
And some libraries have a lot of functions taking parameters as " *args, **kwargs " , I don't know what that means but those function take a lot of "value" parameters i guess?(like this: plt.figure(figsize=[13,6], axis=False) )
Pycharm also don't seem to have access to list of those arguments...
Are you having such problems too? Have you found some better ide with autocompletions and support for jupyter? Do tell.
(Ps: i know jupyter can be run directly on a browser, but as i said "auto completions and documentations" )5 -
Never have I felt more like a pirate than when I wrote a copy constructor for a class called "Args".1
-
Today I learned:
In Java, you're supposed to compile a source file in its package one directory up, outside of its package. You can't compile the source file in its own package directory, for it will state "cannot find symbol" on files in the same package, even though they're in the correct package directory. That can be quite confusing at first.
Given the following directory structure:
|_
|_ \pkg
|_ _ Src1.java
|_ _ Src2.java (interface with static method)
and the following source:
package pkg;
public interface Src2 { static void doStuff() { ... }; } // assuming JDK8+, where static default methods are allowed
package pkg;
public class Src1 { public static void main(String[] args) { Src2.doStuff(); } }
..being inside the pkg/ directory in the console,
this won't work:
javac -cp . Src1.java
"cannot find symbol: Src2"
However, go one directory up and..
javac -cp pkg/*.java pkg/Src1.java
..it works!
Yeah, you truly start learning how the compiler works when you don't use the luxury of a IDE but rather a raw text editor and a console.1 -
Lua users, have you used moonscript?
It's a little language that has it's own interpreter or can be compiled down to Lua and it's absolutely lovely (currently using it with Love2d).
Of course, as with most things, what I love about it also royally pisses me off sometimes.
For starters local has to be declared for variables, unlike lua.
Otherwise the variable goes to _
Also note, that some tutorials literally tell you the opposite.
all variables are local by default
unless you don't declare them
then they go to _ (throwaway)
Some tutorials get this wrong too.
all variables have to be declared local
except tables. failure to declare a table WITHOUT a local will cause things like
table.insert to fail with "nil" values for no god damn reason.
No tutorial I could find mentioned this.
Did you know we call methods with '\'?
By the way, we call methods with '\'.
Why? Who the fuck knows.
Does make writing web routes more natural though.
Variables in the parameters of new are declared and bound for you. Would have loved to know this before hand instead of trying
to bind to them like a fucking idiot.
Fat arrows are used to pass in self for methods.
Unless you're calling a method. Then you use backwards slash. This fact is unhelpful when you're a beginner and dealing with the differences between the *other* arrow, the backslash, the fat arrow, and the fact that functions can be called with or WITHOUT parenthesis.
And on that note..
While learning all this other shit, don't forget parenthesis are optional!
Except when they're not!
..Like when you have a function call among your arguments and have to disambiguate which args belong to the outer call and to the inner call! Why not just be fucking consistent?
But on the plus size, ":" is now used for what it should have been used for in the fucking beginning: binding values to keys.
And on the downside, it's in a language thats built on top of another language that uses it for fucking *method calls*, a completely
different fucking usage.
And better still, to add to that brainfuckery thats lost in the mental translational noise like static on a fucking dialup modem, you define methods with the fat arrow. Wait, was that the single arrow or fat one? Yeah the fat one. Fuck. But not before you do THIS shit..
someShit: =>
yeah, you STILL include the god damn colon just so when you're coming from lua you can do a mental double take. "Why am I passing self twice? Oh right, because fuck me, I decided to use moonscript." It's consistent on that front but it also pisses me off.
A lot of these are actually quality of life improvements disguised as gotchas, but when you're two beers in to a 30 minute headscratcher it sure doesn't fucking feel like it.
Nevertheless, once I moved beyond the gotchas, it was like night and day. Sure moonscripts takes a giant steaming dump all over the lua output, like a schizophrenic alcoholic athena from the head of zeus, but god damn, when it works it just WORKS.
Locals that act like locals? Check.
Sane OOP? Check.
Classes, constructors, easy access to class methods, iterators? Check, check, check, check, check.
I fucking hate ceremony. Configuration over convention is for cunts. And moonscript goes a long ways toward making lua less cunty.
If you've ever felt this way while using lua, please, give moonscript a try.
You'll regret it, but in a good way!6 -
So, this is my first actual rant since I joined devRant and I am not saying I am perfect either. Here goes nothing...
1. I honestly hate it when people use spacebar instead of tabs
2. People who have a bad indentation or no indentation at all (even though almost all IDEs have auto-indentation). The bad thing is when a person asks me to have a look at their code I always end up wasting time fixing the indentation rather the actual problem.
I love a properly indented code and that's one of the major reason I usually recommend Python to most people.
3. Lastly, people who leave lots of unnecessary empty lines. E.g.,
public class HelloWorld{
public static void main(String[]args){
System.out.println("Hello world!");
}
}13 -
When 32 GB RAM is no longer enough...
:~$ ps -eo pid,pcpu,pmem,vsz,rss,args | grep java | sort -nrk3 | head -1
9071 117 74.6 34740516 24338652 java -Xms2g -Xmx24g -Xss40m -DuploadDir=. -jar webapp-runner-8.0.33.4.jar -AconnectionTimeout=3600000 --port 9000 heaphero.war7 -
++ if you've ever had to type something along these lines:
def main(args):
do = some
stuff = here
if __name__ == '__main__':
main()
trying to figure out the best way to write a driver script for a processing pipeline and the choices have boiled down to;
a) define "new" main functions where necessary
b) learn subprocess module
c) write a bash script to do it instead
still not sure what I'm going with... -
Since becoming an "Architect", I've come to learn "Architect" simply means siphoning your will by eliminating all opportunities to actually write code ...
public class Architect {
static final boolean inMeeting = true;
private int will;
public static void main(String args[]){
Architect me = new Architect();
if(me.inMeeting){
while(meeting.active){
me.reactToEvents();
}
}else{
me.writeCode();
}
}
public void reactToEvents(){
if(new Random().nextInt() % 3 == 0)
will -= this.hit(this.face, this.palm, Force.CONSIDERABLE);
else
will -= this.hit(Office.desk, this.head, Force.MODERATE);
}
public int hit(Object object, Object with, Force force){
object.useForce(force);
object.moveTo(with);
return new Random().nextInt();
}
}1 -
var devRant = new DevRant();
devRant.Subscribed += (target, args) =>
{
Console.WriteLine("Welcome, " + args.User.Name + "!");
}
...
var self = devRant.GetCurrentUser();
self.Subscribe();
...
...
> Welcome, olezhka!4 -
class smoking{
public static void main ( String []args){
int a = 2;
String c = "cigarettes";
if (a==2)
System.out.print ("go smoke "+ c);
else if (a <2)
System.out.println ("go buy some");
else
System.out.println ("error");
}
}10 -
I´m learning C # basic concepts and a question has come up after doing this exercise:
using System;
namespace exercise
{
class MainClass
{
public static void Main (string[] args)
{
console.WriteLine("Type your name");
String name = Console.ReadLine ();
console.WriteLine("Type one city");
String city = Console.ReadLine ();
console.WriteLine("Hello"+ name + "wellcome to " + city )
Console.ReadLine ();
}
}
}
Question: its necessary to put the last
Console.ReadLine ();?Why?8 -
public static void turnItUpTo(int val) {
this.setLevel(val);
}
public static void main(String[] args) {
turnItUpTo(11);
System.out.println("Rock out");
} -
Hi people first as you know my English is not very poor im sorry for that.
I try to make an automat a sprinkle water and a auto light on a interior garden in aquarium.
For that in python i use main thread, a class Water.py extends Threading and Light.py extends Threading
In the __init__.py file i put my main function that get argv for execution. One of my arguments is -v (--verbose)
I want to pass that args to my class instances.
-I don't want to make one parameter in my constructors because I think we don't passe verbose mode in parameter of constructor.
-I use global not working through de import.
Do you have some magic for me :/ ?6 -
Anyone here have any experience with PHP? I've never really used it myself and don't really want to, but I do look at things like http://phpsadness.com/ from time to time.
These complaints range from "fairly minor" (some stuff like function names/args and some syntsx complaints) to "how is this language even used" (segfaults in a scripting language, broken things like "create_function", comparisons and ternanry operator).
Of course, i don't program in PHP so i don't know how bad any of this actually is.
Anyone actually use PHP or did use it previously?19 -
Yesterday I asked a question on stack overflow about what algorithm I should use in order to parse command line strings like in gnu getopt for example.. And I've got downvoted for no GOOD FUCKING REASON. On top of that, my question is on hold. WTF?! For some time now stack overflow is becoming more and more a community of fucking cunts, arse-holes and toxic people.
Title:
" What parser algorithm is best suited for command line parsing? [on hold] "
My question:
"I want to write my own command line library from scratch. What algorithm should I use in order to parse gnu style args like in getopt for example ? I mean what's the best way other than tokenizing and parse them in a naive way? Should I try to look at LR, LL algorithms or this is way too overkill?"
Their response:
"Your question sounds like "I want to do X. What's the best way to do it?". Too broad, you need to be more specific about what problem you're having. (And keep your question clean. No meta-stuff in there.)"
I mean, what more context-specific reason should I add you dense motherfucker!? I want an algorithm to parse your momma's cunt so hard 'till it blows the fuck up. This what you want? You fucking senseless piece of garbage. God, give me a car to run over their fucking internet cable and over their head, too.8 -
I'm a Ruby on Rails developer. I love Rails because you can get so much done so quickly. I've built huge websites on Rails at the consultant shop where I work.
A couple of years ago we added a frontend guy to the team. We switched from doing full stack Rails to using Rails for API only with Vue with Typescript as the frontend. Since this transition took place, I am unable to get anything done on frontend. It takes a huge amount of effort to just add a new input box to a page. Our whole team is on the edge of getting laid off because we can't get things done in a timely fashion for clients and our products consistently run over time and over budget.
Here I'm trying to add an "Are you sure you want to delete this?" message to a form, and I'm on third hour trying to make Typescript happy. I want to assign a variable a value and I have to decipher errors like this "Type 'Ref<string>' is missing the following properties from type 'Vue<string, Record<string, any>, never, never, (event: string, ...args: any[]) => Vue<Record<string, any>, Record<string, any>, never, never, ...>>': $data, $props, $parent, $root, and 30 more." WTF?!?!
Am I just not smart enough for this? Why did programming suddenly become so hard for me? If I had to start off this way I wouldn't be a programmer because I wouldn't have been able to figure this out alone and it wouldn't have been any fun. Anyone else have the HATE for Typescript that I do?12 -
Sometimes in our personal projects we write crazy commit messages. I'll post mine because its a weekend and I hope someone has a well deserved start. Feel free to post yours, regex out your username, time and hash and paste chronologically. ISSA THREAD MY DUDES AND DUDETTES
--
Initialization of NDM in Kotlin
Small changes, wiping drive
Small changes, wiping drive
Lottie, Backdrop contrast and logging in implementation
Added Lotties, added Link variable to Database Manifest
Fixed menu engine, added Smart adapter, indexing, Extra menus on home and Calendar
b4 work
Added branch and few changes
really before work
Merge remote-tracking branch 'origin/master'
really before work 4 sho
Refined Search response
Added Swipe to menus and nested tabs
Added custom tab library
tabs and shh
MORE TIME WASTED ON just 3 files
api and rx
New models new handlers, new static leaky objects xd, a few icons
minor changes
minor changesqwqaweqweweqwe
db db dbbb
Added Reading display and delete function
tryin to add web socket...fail
tryin to add web socket...success
New robust content handler, linked to a web socket. :) happy data-ring lol
A lot of changes, no time to explain
minor fixes ehehhe
Added args and content builder to content id
Converted some fragments into NDMListFragments
dsa
MAjor BiG ChANgEs added Listable interface added refresh and online cache added many stuff
MAjor mAjOr BiG ChANgEs added multiClick block added in-fragment Menu (and handling) added in-fragment list irem click handling
Unformatted some code, added midi handler, new menus, added manifest
Update and Insert (upsert) extension to Listable ArrayList
Test for hymnbook offline changing
Changed menuId from int to key string :) added refresh ...global... :(
Added Scale Gesture Listener
Changed Font and size of titlebar, text selection arg. NEW NEW Readings layout.
minor fix on duplicate readings
added isUserDatabase attribute to hymn database file added markwon to stanza views
Home changes :)
Modular hymn Editing
Home changes :) part 2
Home changes :) part 3
Unified Stanza view
Perfected stanza sharing
Added Summernote!!
minor changes
Another change but from source tree :)))
Added Span Saving
Added Working Quick Access
Added a caption system, well text captions only
Added Stanza view modes...quite stable though
From work changes
JUST a [ush
Touch horizontal needs fix
Return api heruko
Added bible index
Added new settings file
Added settings and new icons
Minor changes to settings
Restored ping
Toggles and Pickers in settings
Added Section Title
Added Publishing Access Panel
Added Some new color changes on restart. When am I going to be tired of adding files :)
Before the confession
Theme Adaptation to views
Before Realm DB
Theme Activity :)
Changes to theme Activity
Changes to theme Activity part 2 mini
Some laptop changes, so you wont know what changed :)
Images...
Rush ourd
Added palette from images
Added lastModified filter
Problem with cache response
works work
Some Improvements, changed calendar recycle view
Tonic Sol-fa Screen Added
Merge Pull
Yes colors
Before leasing out to testers
Working but unformated table
Added Seperators but we have a glithchchchc
Tonic sol-fa nice, dots left, and some extras :)))
Just a nice commit on a good friday.
Just a quickie
I dont know what im committing...3 -
YGGG IM SO CLOSE I CAN ALMOST TASTE IT.
Register allocation pretty much done: you can still juggle registers manually if you want, but you don't have to -- declaring a variable and using it as operand instead of a register is implicitly telling the compiler to handle it for you.
Whats more, spilling to stack is done automatically, keeping track of whether a value is or isnt required so its only done when absolutely necessary. And variables are handled differently depending on wheter they are input, output, or both, so we can eliminate making redundant copies in some cases.
Its a thing of beauty, defenestrating the difficult aspects of assembly, while still writting pure assembly... well, for the most part. There's some C-like sugar that's just too convenient for me not to include.
(x,y)=*F arg0,argN. This piece of shit is the distillation of my very profound meditations on fuckerous thoughtlessness, so let me break it down:
- (x,y)=; fuck you in the ass I can return as many values as I want. You dont need the parens if theres only a single return.
- *F args; some may have thought I was dereferencing a pointer but Im calling F and passing it arguments; the asterisk indicates I want to jump to a symbol rather than read its address or the value stored at it.
To the virtual machine, this is three instructions:
- bind x,y; overwrite these values with Fs output.
- pass arg0,argN; setup the damn parameters.
- call F; you know this one, so perform the deed.
Everything else is generated; these are macro-instructions with some logic attached to them, and theres a step in the compilation dedicated to walking the stupid program for the seventh fucking time that handles the expansion and optimization.
So whats left? Ah shit, classes. Disinfect and open wide mother fucker we're doing OOP without a condom.
Now, obviously, we have to sanitize a lot of what OOP stands for. In general, you can consider every textbook shit, so much so that wiping your ass with their pages would defeat the point of wiping your ass.
Lets say, for simplicity, that every program is a data transform (see: computation) broken down into a multitude of classes that represent the layout and quantity of memory required at different steps, plus the operations performed on said memory.
That is most if not all of the paradigm's merit right there. Everything else that I thought to have found use for was in the end nothing but deranged ways of deriving one thing from another. Telling you I want the size of this worth of space is such an act, and is indeed useful; telling you I want to utilize this as base for that when this itself cannot be directly used is theoretically a poorly worded and overly verbose bitch slap.
Plainly, fucktoys and abstract classes are a mistake, autocorrect these fucking misspelled testicle sax.
None of the remaining deeper lore, or rather sleazy fanfiction, that forms the larger cannon of object oriented as taught by my colleagues makes sufficient sense at this level for me to even consider dumping a steaming fat shit down it's execrable throat, and so I will spare you bearing witness to the inevitable forced coprophagia.
This is what we're left with: structures and procedures. Easy as gobblin pie.
Any F taking pointer-to-struc as it's first argument that is declared within the same namespace can be fetched by an instance of the structure in question. The sugar: x ->* F arg0,argN
Where ->* stands for failed abortion. No, the arrow by itself means fetch me a symbol; the asterisk wants to jump there. So fetch and do. We make it work for all symbols just to be dicks about it.
Anyway, invoking anything like this passes the caller to the callee. If you use the name of the struc rather than a pointer, you get it as a string. Because fuck you, I like Perl.
What else is there to discuss? My mind seems blank, but it is truly blank.
Allocating multitudes of structures, with same or different types, should be done in one go whenever possible. I know I want to do this, and I know whichever way we settle for has to be intuitive, else this entire project has failed.
So my version of new always takes an argument, dont you just love slurping diarrhea. If zero it means call malloc for this one, else it's an address where this instance is to be stored.
What's the big idea? Only the topmost instance in any given hierarchy will trigger an allocation. My compiler could easily perform this analysis because I am unemployed.
So where do you want it on the stack on the heap yyou want to reutilize any piece of ass, where buttocks stands for some adequately sized space in memory -- entirely within the realm of possibility. Furthermore, evicting shit you don't need and replacing it with something else.
Let me tell you, I will give your every object an allocator if you give the chance. I will -- nevermind. This is not for your orifices, porridges, oranges, morpheousness.
Walruses.16 -
Refactoring some horrendous old ass (ruby) code and I come across
`schedules.each |do|`
okay. Where does `schedules` get set?
`schedules = [create_schedule(args)]`
Cool. An array that never has more than one object in it. Good code, guy.2 -
attempt neater/cleaner implementation, doesn't work
attempt ugly implementation, it works
maybe one day i'll learn how to write good typescript and react
easier to throw the args around than try to figure out the correct syntax to pass a function to a child component, or not have a react hook closest to where it gets used? -
The rear ducking continues. We've built a reliable translator in the dumbest fucking way possible, it's just lovely. I simply reused the structure for feeding data to the VM assembler, an array of arrays, where there's one array of (ins [args]) per node in the parse tree.
It's nice because nodes can be solved out of order without affecting the actual sequence in which the instructions are output. And if one statement (node) equals multiple instructions, you just push multiple entries to the corresponding array, or push nothing if you need to output nothing. Easy as goblin pie.
This is enough to convert an input language to the assembly-like intermediate representation we use for the virtual machine. So then there's doing it backwards: walk the same array of arrays, and map those virtual instructions to a physical architechture. I guess I could do the encoding to native binary myself, it'd certainly be interesting to try, but I'm burnt-out already so I'll just use fasm for now.
Initial test: wrote a test program in my own stupid language, ran the translator, dump output to file, assemble that with fasm, run with r2 -d.
Crashes? No.
Runs fine? Yes and no.
For fuck's sake, I don't have syscalls. Mainly because the VM doesn't have an operating system, lmao. I was testing virtual programs by just freezing state, terminating, then dumping the fucking registers and stack to the console, we have no I/O to speak of. Not even a real 'exit', VM handles that by reading a return value every step like a mentally damaged son of a bitch.
So anyway, I manually paste the linux mambo, you know:
mov rax,60
mov rdi,0
syscall
And NOW our program can end execution without crashing.
Okay then, so does the test code work correctly?
** DRUM ROLL **
Yes.
Ladies and gentlemen, mother fucking PESO is now a compiled language, and going forward I will be expectantly receiving your marriage proposals for reviewing. Oh, but not so fast, we still need a frontend...
Well, we'll handle that in the next few days. I'm just glad to be *nearly* finished with this fucking compiler, I want nothing to do with anything else ever, but we know that's not going to happen, so Lord please end my pain.
No sponsor as this rant has been paid for by tax evasion. -
(I'm not completely sure of what I'm saying here, so don't take this too seriously)
Settling on a language to write the api for ranterix is hard.
I'm finding a lot of things about elixir to be insanely good for a stable api.
But I'm having a lot of gripes with the most important elixir web framework, phoenix.
Take a look at this piece of code from the phoenix docs:
defmodule Hello.Repo.Migrations.CreateUsers do
use Ecto.Migration
def change do
create table(:users) do
add :name, :string
add :email, :string add :bio, :string
add :number_of_pets, :integer
timestamps()
end
end
end
Jesus christ, I hate this shit.
Wtf are create, add and timestamps. Add is somehow valid inside the create, how the fuck is that considered good code? What happens if you call timestamps twice? It's all obscure "trust me, it works" code.
It appears to be written by a child.
js may have a million problems. But one thing I like about CJS (require) or ESM (import) is that there's nothing unexplained. You know where the fuck most things come from.
You default export an eatShit() function on one file and import it from another, and what do you get?
The goddamn actual eatShit function.
require is a function the same way toString is a function and it returns whatever the fuck you had exported in the target file.
Meanwhile some dynamic langs are like "oh, I'll just export only some lang construct that i expect you to specify and put that shit in fucking global of the importing file".
Js is about the fucking freedom. It won't decide for you what things will files export, you can export whatever the fuck you want, strings, functions, classes, objects or even nothing at all, thanks to module.exports object or export statement.
And in js, you can spy on anything external, for example with (...args) => debugger; fnToSpyOn(...args)
You can spoof console.log this way to see what the fuck is calling it (note: monkey patching for debugging = GOOD, for actual programming = DOGSHIT)
To be fair though, that is possible because of being a dynamic lang and elixir is kind of a hybrid typed lang, fair enough.
But here's where i drop the shit.
Phoenix takes it one step further by following the braindead ruby style of code and pretty DSLs.
I fucking hate DSLs, I fucking hate abstraction addiction.
Get this, we're not writing fucking poetry here. We're writing programs for machines for them to execute.
Machines are not humans with emotions or creativity, nor feel.
We need some level of abstraction to save time understanding source code, sure.
But there has to be a balance. Languages can be ergonomic for humans, but they also need to be ergonomic for algorithms and machines.
Some of the people that write "beautiful" "zen" code are the folks that think that everyone who doesn't push the pretty code agenda is a code elitist that doesn't want "normal" people to get into programming.
Programming is hard, man, there's no fucking way around it.
Sometimes operating system or even hardware details bleed into code.
DSLs are one easy way to make code really really easy to understand, but also make it really fucking hard to debug or to lose "programming meaning".7 -
TIL following two lines are NOT the same in JS with webpack, even though logically they should be - it should be just an application of an eta reduction... First line works, second one crashes, probably because mysteriously executed too soon, before obj is initialized.
export const t = (...args) => obj.t(...args);
export const t = obj.t;
Sometimes I really hate JavaScript magic.2 -
nothing new, just another rant about php...
php, PHP, Php, whatever is written, wherever is piled, I hate this thing, in every stack.
stuff that works only according how php itself is compiled, globals superglobals and turbo-globals everywhere, == is not transitive, comparisons are non-deterministic, ?: is freaking left associative, utility functions that returns sometimes -1, sometimes null, sometimes are void, each with different style of usage and naming, lowercase/under_score/camelCase/PascalCase, numbers are 32bit on 32bit cpus and 64bit on 64bit cpus, a ton of silent failing stuff that doesn't warn you, references are actually aliases, nothing has a determined type except references, abuse of mega-global static vars and funcs, you can cast to int in a language where int doesn't even exists, 25236 ways to import/require/include for every different subcase, @ operator, :: parsed to T_PAAMAYIM_NEKUDOTAYIM for no reason in stack traces, you don't know who can throw stuff, fatal errors are sometimes catchable according to nobody knows, closed-over vars are passed as functions unless you use &, functions calls that don't match args signature don't fail, classes are not object and you can refer them only by string name, builtin underlying types cannot be wrapped, subclasses can't override parents' private methods, no overload for equality or ordering, -1 is a valid index for array and doesn't fail, funcs are not data nor objects when clojures instead are objects, there's no way to distinguish between a random string and a function 'reference', php.ini, documentation with comments and flame wars on the side, becomes case sensitive/insensitive according to the filesystem when line break instead is determined according to php.ini, it's freaking sloooooow...
enough. i'm tired of this crap.
it's almost weekend! 🍻1 -
Unit testing with NSubstitute and Autofac
For the most part, I find it a lot simpler than SimpleInject (hmm) and Moq, which I have used previously.
But there are still some of those 'Oh, for fucks sake!'-gotchas.
I was trying to test a class today where I wanted to substitute all other methods in the class than the one I wanted to test == an actual unit test.
I had previously found out how to do this:
1. Make sure the methods that should be substituted are internal to allow substitution.
2. Substitute class with Substitute.ForPartsOf<T>(args)
3. Set up methods that should not be called with instance.When(a => a.Method()).DoNotCallBase()
This way, you can unit test a class properly and only call the method that you want to test, and also control the return values of the other methods if needed.
So as I said, I have used this before to great effect. But today I just could NOT get it to work! I checked and rechecked everything but the test code kept calling the implementations of the substituted methods!
I even called over another dev for help, but he couldn't see the problem either.
Aargh!
I scoured the internet, but everyone just told me what I already knew: follow the 3 steps, and all is well. Not so!
I ALMOST considered doing the test improperly, as in, increasing the scope beyond that of the method I wanted to test.
But then it hit me... My project was missing this line in AssemblyInfo.cs:
[assembly: InternalsVisibleTo("DynamicProxyGenAssembly2")]
I always add a line to make internals visible to the test project, but I had forgotten that NSubstitute needs this line as well to work properly.
Sometimes when a test fails it will tell you that you are missing this line. And sometimes it just doesn't work.
Maybe I will remember this in the future now. Maybe 😅 -
Writing a x-platform cli tool in Go designed to be an infinite REPL until EOF if no arguments are passed. Code works great on Linux and Mac as-is but not on Windows. On Windows it only works at all if args are passed.
WHY.
And people wonder why I don't like Windows. It's a shame my userbase has so many tech-saavy Windows users. If not for them I'd cut that git branch off the repo in a heartbeat. -
public class MyLife {
public static void main (String [] args) {
System.out.println ("My life sucks!");
}
} -
var self = this;
if (args != null) args = Array.from(args);
return function(){
return self.apply(bind, args || arguments);
};
no wonder nobody likes js. this is not js. this is shit.5 -
So here the function that does same thing as new operator in javascript:
// we define our function Person that assigns properties to THIS that points to some object
const Person = function(name, lastName) {
this.name = name;
this.lastName = lastName;
}
// in Person prototype property we define our functions
Person.prototype.getName = function() {
return this.name;
}
Person.prototype.getLastName = function() {
return this.lastName;
}
// function that simulates new operator
// first argument is a function that would act as constructor
// second argument is an arguments that would be passed to constructor
function New(func, ...args) {
// with Object.create() we create a new object and assign [[__proto__]] from "func" prototype property
let object = Object.create(func.prototype);
// here we're calling "func" with THIS pointing to object
func.apply(object, args);
// then we return it
return object;
}
let person = New(Person, "Name", "LastName");
console.dir(person);
// so this is how prototype OOP works in javascript6 -
Legacy code in java :
boolean recursiveMethod(args){
Int i= 0;
Boolean doublon = false;
For(--whatever the loop--){
If(condition1 && condition2){
If(i++ > 0){
doublon=true;
Return doublon;
}
}
}
[...]
}5 -
so I have been trying to make migrations on centos 7 for a while now on my virtual env i keep getting this error
## Traceback (most recent call last):
File "manage.py", line 10, in <module>
execute_from_command_line(sys.argv)
File "/srv/switch/env/lib/python2.7/site-packages/django/core/management/__init__.py", line 364, in execute_from_command_line
utility.execute()
File "/srv/switch/env/lib/python2.7/site-packages/django/core/management/__init__.py", line 356, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/srv/switch/env/lib/python2.7/site-packages/django/core/management/base.py", line 283, in run_from_argv
self.execute(*args, **cmd_options)
File "/srv/switch/env/lib/python2.7/site-packages/django/core/management/base.py", line 327, in execute
self.check()
File "/srv/switch/env/lib/python2.7/site-packages/django/core/management/base.py", line 359, in check
include_deployment_checks=include_deployment_checks,
File "/srv/switch/env/lib/python2.7/site-packages/django/core/management/base.py", line 346, in _run_checks
return checks.run_checks(**kwargs)
File "/srv/switch/env/lib/python2.7/site-packages/django/core/checks/registry.py", line 81, in run_checks
new_errors = check(app_configs=app_configs)
File "/srv/switch/env/lib/python2.7/site-packages/django/core/checks/urls.py", line 16, in check_url_config
return check_resolver(resolver)
File "/srv/switch/env/lib/python2.7/site-packages/django/core/checks/urls.py", line 26, in check_resolver
return check_method()
File "/srv/switch/env/lib/python2.7/site-packages/django/urls/resolvers.py", line 254, in check
for pattern in self.url_patterns:
File "/srv/switch/env/lib/python2.7/site-packages/django/utils/functional.py", line 35, in __get__
res = instance.__dict__[self.name] = self.func(instance)
File "/srv/switch/env/lib/python2.7/site-packages/django/urls/resolvers.py", line 405, in url_patterns
patterns = getattr(self.urlconf_module, "urlpatterns", self.urlconf_module)
File "/srv/switch/env/lib/python2.7/site-packages/django/utils/functional.py", line 35, in __get__
res = instance.__dict__[self.name] = self.func(instance)
File "/srv/switch/env/lib/python2.7/site-packages/django/urls/resolvers.py", line 398, in urlconf_module
return import_module(self.urlconf_name)
File "/usr/lib64/python2.7/importlib/__init__.py", line 37, in import_module
__import__(name)
File "/srv/switch/app/switch/urls.py", line 10, in <module>
url(r'^administration/', include('primary.core.administration.urls')),
File "/srv/switch/env/lib/python2.7/site-packages/django/conf/urls/__init__.py", line 50, in include
urlconf_module = import_module(urlconf_module)
File "/usr/lib64/python2.7/importlib/__init__.py", line 37, in import_module
__import__(name)
File "/srv/switch/app/primary/core/administration/urls.py", line 2, in <module>
from primary.core.administration.views import *
File "/srv/switch/app/primary/core/administration/views.py", line 5, in <module>
from primary.core.api.views import *
File "/srv/switch/app/primary/core/api/views.py", line 8, in <module>
from primary.core.bridge.views import *
File "/srv/switch/app/primary/core/bridge/views.py", line 11, in <module>
from primary.core.bridge.backend.loggers import Loggers
File "/srv/switch/app/primary/core/bridge/backend/loggers.py", line 2, in <module>
from primary.core.bridge.backend.wrappers import Wrappers
File "/srv/switch/app/primary/core/bridge/backend/wrappers.py", line 6, in <module>
import pytz, time, json, pycurl
ImportError: pycurl: libcurl link-time ssl backend (nss) is different from compile-time ssl backend (openssl)
even after uninstalling pycurl and exporting the pycurl variable to my environment can I get any help4 -
using System;
using System.Text;
using System.Text.Encodings;
//Bitwise XOR operator is represented by ^. It performs bitwise XOR operation on the corresponding bits of two operands. If the corresponding bits are same, the result is 0. If the corresponding bits are different, the result is 1.
//If the operands are of type bool, the bitwise XOR operation is equivalent to logical XOR operation between them.
using System.Text.Unicode;
using System.Windows;
using System.IO;
namespace Encryption2plzWOrk
{
class Program
{
static void Main(string[] args)
{
//random is basically a second sepret key for RSA exhanges I know there probaley is a better way to do this please tell me in github comments.//
Random r = new Random();
int random = r.Next(2000000,500000000);
int privatekey = 0;
int publickey = 0;
string privateKeyString = Console.ReadLine();
byte[] bytes3 = Encoding.ASCII.GetBytes(privateKeyString);
foreach(byte b in bytes3)
{
privatekey = b + privatekey;
}
int permutations = random/ 10000;
if(privatekey < 256)
{
while(permutations > 0)
{
foreach (byte b in bytes3)
{
privatekey = privatekey + (privatekey ^ permutations)*20;
}
}
}
publickey = privatekey*random;
Console.WriteLine("your public key is {0}",publickey);
}
}
}
would this be considerd ok HOBBYIST encryption and if not how would I do a slow improvment I used bitwise to edit bits so thats a check :D12 -
How to write programs on Android 10 that work with files/directories? Have used a number of JVM-based languages like Groovy, Clojure and Kotlin.
My last try was with Groovy. I ran it under Dcoder which has to be cloud-, based as it supports numerous languages. I gave it permission to access storage but got a file not found error from Java. Copied this excerpt for the file path.
import java.io.File
class Example {
static void main(String[] args) {
new File("/storage/emulated/0/read_file.grvy").eachLine {
line -> println "line : $line";
}
}
}
Do I need root? Do I need to change file permissions using Termux? Why can't I find a way to write simple software on a Motorola Super, 3 GB RAM and 8 cores? I hate using a phone for a computer but a seizure has me in a nursing home with only one usable hand.
Any help is greatly appreciated.5 -
My journey along Java continues and so I have discovered something I didn't know before:
If a subclass tries to call a method on its parent which it has not overridden, then it will call the method as if you hadn't used the keyword 'super' (and I think it will try to find it in the classpath and SDK).
Example 1:
public class SuperParent {
public String test(){
return "SuperParent";
}
}
public class Parent extends SuperParent {
}
public class Child extends Parent {
public String testChild(){
return super.test(); // same effect as test();
}
}
public class TestInheritance {
public static void main(String[] args) {
System.out.println(new Child().test()); // returns "SuperParent"
}
}
Example 2: with getClass():
public class Parent {
@Override
public String toString(){
return super.getClass().getSimpleName();
}
}
public class Child extends Parent {
}
public class TestInheritance {
public static void main(String[] args) {
System.out.println(new Child()); // prints "Child"
}
}
This here is of course a special case: .getClass() will always return the class name of its caller, so naturally in this case it returns Child and not Parent.
You would expect it to return "Parent" since you use 'super' in the overridden toString() but it returns the Class name of the Child (then there's something in programming languages such lexical scope and execution scope, which I'm not sure if it applies here).
The solution for this example is of course .getSuperClass().
Inheritance isn't always straight-forward.
References:
https://stackoverflow.com/questions...
https://stackoverflow.com/questions...2 -
Why is it, that #Java Spring AOP are this stupid:
When accessing parameters at a joined method, it is not guaranteed, that they are in the right order.
Some guy thought it would be a good idea to use fcking "System.arrayCopy" because of performance during dependency injection-based aspect-oriented programming.
Roast me but when doing give me a solution to get the right ordered args. -
Writing--
public static void main(String args[ ] ) all the time (in every program)....during competitive programming questions.... :/
I get the meaning but still....just look at c or py...:/ -
programming:
cc hello_world.c -o hello world
object-oriented programming:
cc -c hello_world.c -o hello_world.o
cc hello_world.o -o hello world
some weird shit:
class HelloWorld {
public static void main(String[] args) {
System.out.println("Hello World!");
}
}4 -
It just never works when you try to set up self hostet php apps never theyre all shit they never print any useful errors they just randomly pass wrong args they use fucking ioncube fuck everything6
-
I'm migrating a node app from rh6 to 7, initd to systemd...
Init.d runs start.sh which then spawns calls pm2 with the args. The problem though seems to be (I set the service to be forking otherwise it doesn't let it or kills the child threads?) But then there service then says it fails since I guess the script exited by itself...
And therefore the stop didn't work either?
I just need a service that acts as a link? To the actual start stop scripts and just run them? Without killing the could orocesses7 -
Oh yeah ... Java is cool in an utterly sick way even that i can't seem to find a non-retarded built-in stack data structure
Call me a racist, but java.util.Stack has a removeIf() method in case you want to remove odd numbers:
import java.util.Stack;
public class App {
public static void main(String[] args) {
int arr[] = { 2, 4, 7, 11, 13, 16, 19 };
Stack<Integer> s = new Stack<Integer>();
for (int i = 0; i < arr.length; i++) {
s.push(arr[i]);
}
s.removeIf((n) -> (n % 2 == 1));
System.out.println(s); // [2, 4, 16]
}
}
Stop using java.util.Stack they said, a legacy class they said, instead i should use java.util.ArrayDeque, but frankly i can still keep up being racist (in a reversed manner):
import java.util.ArrayDeque;
import java.util.Deque;
public class App {
public static void main(String[] args) {
int arr[] = { 2, 4, 7, 11, 13, 16, 19 };
Deque<Integer> s = new ArrayDeque<Integer>();
for (int i = 0; i < arr.length; i++) {
s.push(arr[i]);
}
s.removeIf((n) -> (n % 2 == 1));
System.out.println(s); // [16, 4, 2]
}
}
The fact that you can iterate through java.util.Stack is amazing, but the ability to insert element in a specified index:
import java.util.Stack;
public class App {
public static void main(String[] args) {
int arr[] = { 2, 4, 7, 11, 13, 16, 19 };
Stack<Integer> s = new Stack<Integer>();
for (int i = 0; i < arr.length; i++) {
s.push(arr[i]);
}
s.add(2, 218);
System.out.println(s); // [2, 4, 218, 7, 11, 13, 16, 19]
}
}
That's what happens when you inherit java.util.Vector, which is only done a BRAIN OVEN person, a very brain oven even that it will revert to retarded
If you thought about using this type of bullshit in Java get yourself prepared to beat the disk for hours when you accidentally call java.util.Stack<T>.add(int index, T element) instead of java.util.Stack<T>.push(T element), you will probably end up breaking the disk or your hand, but not solving the issue
WHY THE F*** CAN'T WE HAVE A WORKING NORMAL STACK ?5 -
def longVariableNamesEverywhere(*args):
"""
Not a substitute for docstrings and code comments.
"""
#TODO: insert witty and legible code.
#TODO: learn to read code.
return "Rant and self-deprecation complete."4 -
Learned just enough Groovy to call a Python script and pass args to it. I have no problem with that.
-
public class LearningJava{
public static void main(String[] args){
boolean isprogrammingEasy = true;
if(isprogrammingEasy){
System.out.println("your on the right track!");
}else{
System.err.println("Try again!");
}
}
}
i know i know pls dont get triggered cuz dev rant is not a code editor but im starting to understand java and javascript also found this youtuber im learning off of i think you guys helped and yes i have skidded a few times but i know its okay sometimes not cool to steal someone source code Thanks everyone
youtuber im learning from: https://youtube.com/watch/...
i think i can understand dex. jadx and more i wont post anymore cringe posts before some devs mght get tired of me just development :)2