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 - "avoid void"
-
Long story short:
My system need to talk with a 3rd party PoS API. The provided doc is pretty useless and with few errors.. nonetheless I came to finish the 99% of the job.
I was stuckd on the 1%, one frickin function.
Everytime I would call the endpoint I would receive...NOTHING. Just a 200.
I've spent like 5 hours trying everything, even sending wrong params...nothing...
Always 200 and nothing else.
Apparently, for an entire nation and the IT Company behind them, is ok to have A PAYMENT API TO RETURN VOID AND A 200 NO MATTER WHAT.
I got the luck/unluck that the main developer of such piece of art came in the office and I've almost throw him out the window (we are at 26th floor).
FUCK OFF DUDE. YOU AND ALL THE OTHERS THAT DO LIKE YOU DO.
P.S. in this days I'll try to write the full story, but it's hard without giving many details...small anticipation: 1.5 months of work and nothing but red bull and coffee...4 -
Some compilers give an error message on forgotten type casting. From that it shows good typing style casting. So you also avoid clerical errors that can lead to the program crash in the worst case. With some types it is also necessary to perform type casting comma on others Types, however, do this automatically for the compiler.
In short:Type casting is used to prevent mistakes.
An example of such an error would be:
#include <stdio.h>
#include <stdlib.h>
int main ()
{
int * ptr = malloc (10*sizeof (int))+1;
free(ptr-1);
return 0;
}
By default, one tries to access the second element of the requested memory. However, this is not possible, since pointer calculation (+,-) does not work for a void pointer.
The improved example would be:
int * ptr = ((int *) malloc (10*sizeof (int)))+1;
Here, typecasting is done beforehand and this turns the void pointer into its int pointer and pointer calculation can be applied. Note: If instead of error "no output" is displayed on the sololearn C compiler try another compiler.1 -
Top 12 C# Programming Tips & Tricks
Programming can be described as the process which leads a computing problem from its original formulation, to an executable computer program. This process involves activities such as developing understanding, analysis, generating algorithms, verification of essentials of algorithms - including their accuracy and resources utilization - and coding of algorithms in the proposed programming language. The source code can be written in one or more programming languages. The purpose of programming is to find a series of instructions that can automate solving of specific problems, or performing a particular task. Programming needs competence in various subjects including formal logic, understanding the application, and specialized algorithms.
1. Write Unit Test for Non-Public Methods
Many developers do not write unit test methods for non-public assemblies. This is because they are invisible to the test project. C# enables one to enhance visibility between the assembly internals and other assemblies. The trick is to include //Make the internals visible to the test assembly [assembly: InternalsVisibleTo("MyTestAssembly")] in the AssemblyInfo.cs file.
2. Tuples
Many developers build a POCO class in order to return multiple values from a method. Tuples are initiated in .NET Framework 4.0.
3. Do not bother with Temporary Collections, Use Yield instead
A temporary list that holds salvaged and returned items may be created when developers want to pick items from a collection.
In order to prevent the temporary collection from being used, developers can use yield. Yield gives out results according to the result set enumeration.
Developers also have the option of using LINQ.
4. Making a retirement announcement
Developers who own re-distributable components and probably want to detract a method in the near future, can embellish it with the outdated feature to connect it with the clients
[Obsolete("This method will be deprecated soon. You could use XYZ alternatively.")]
Upon compilation, a client gets a warning upon with the message. To fail a client build that is using the detracted method, pass the additional Boolean parameter as True.
[Obsolete("This method is deprecated. You could use XYZ alternatively.", true)]
5. Deferred Execution While Writing LINQ Queries
When a LINQ query is written in .NET, it can only perform the query when the LINQ result is approached. The occurrence of LINQ is known as deferred execution. Developers should understand that in every result set approach, the query gets executed over and over. In order to prevent a repetition of the execution, change the LINQ result to List after execution. Below is an example
public void MyComponentLegacyMethod(List<int> masterCollection)
6. Explicit keyword conversions for business entities
Utilize the explicit keyword to describe the alteration of one business entity to another. The alteration method is conjured once the alteration is applied in code
7. Absorbing the Exact Stack Trace
In the catch block of a C# program, if an exception is thrown as shown below and probably a fault has occurred in the method ConnectDatabase, the thrown exception stack trace only indicates the fault has happened in the method RunDataOperation
8. Enum Flags Attribute
Using flags attribute to decorate the enum in C# enables it as bit fields. This enables developers to collect the enum values. One can use the following C# code.
he output for this code will be “BlackMamba, CottonMouth, Wiper”. When the flags attribute is removed, the output will remain 14.
9. Implementing the Base Type for a Generic Type
When developers want to enforce the generic type provided in a generic class such that it will be able to inherit from a particular interface
10. Using Property as IEnumerable doesn’t make it Read-only
When an IEnumerable property gets exposed in a created class
This code modifies the list and gives it a new name. In order to avoid this, add AsReadOnly as opposed to AsEnumerable.
11. Data Type Conversion
More often than not, developers have to alter data types for different reasons. For example, converting a set value decimal variable to an int or Integer
Source: https://freelancer.com/community/...2 -
Need to work on GitHub CI action that wraps a terraform deploy (previous teams deploy setup that they would run from inside a docker compose setup locally). Working directly on main and get moaned at (definitely consider the moan reasonable) when it was originally being duct taped together. It's scrappy and doesn't have all the repo rules that other repos have set up, but it's stable, and I need to move onto “actual” requirements.
Several months later, I'm still the only “active” maintainer (it's been stable since then and hasn't needed any changes).
Have to do a hotfix experiment after adding support for a new bucket, put the changes in a PR and merge (since it has to be on main, and I'm the only one who maintains it, and if it's truly deploy change related that is the only thing that changed)
Come back to the PRs at the end of the day after discovering it's just a change to django storage, and it turns out a colleague who is tangentially related to the project dropped a comment. He's complaining about the lack of a description, the lack of a ticket and “skipping” the review process.
I, too, would have liked all that, but the damn code needs to be merged so I can check that it was that MFer. Sorry, I expected you to be able to deal with a “vague” 10 contiguous lines of iam config values, ignore the immediately following PR that reverts this revert and the preceding one adds a bucket. Sorry, that the title saying that this is a revert isn't enough of a description for you. Sorry that the other dev that told me about it didn't create a ticket. Sorry that I didn't immediately do overtime to update all the PRs and magically conjure up someone who is available to review them. But hey now that's evening and I have time to get back to going through the PRs again I can see your indignant comment which I wasn't notified about since the PR is fucking closed.
Now that I have had time to go through and see your comment, message you to let you know that commenting on a closed PR is screaming into the void and updated the PRs I can get back to what I was supposed to do today. Which is dealing with streaming data into S3. Hope you had a good day in your Clojure tower with your hired PR person (yes a person to review his PRs).
Not having to deal with your comment would have saved me an hour+.
Getting real tired of the “act like product” when it comes to fixing bugs/any polishing that isn't exploding in prod and even then. Sometimes I really wish I could refuse people from messaging me to fix an issue and can only communicate by tickets 🙄 to avoid these problems. They've been told to create a ticket and assign it to me when there is an issue, and even then, I tend to fix the issue before they get to it. I can't wait until next friday…
Anyway /rant keep up the good work in keeping quality up :D3