« first day (1423 days earlier)      last day (1413 days later) » 

6:49 AM
Anybody worked on rabbit mq ? is there any performance downgrade on running in virtual host in rabbit mq ?
 
 
7 hours later…
2:05 PM
Is it not possible to provide user input through keyboard while debugging in eclipse for C?
 
nwp
Eclipse should have opened a console for you to type in input. Probably the same as where you see the output.
 
@nwp Yes, but it skips the input statements.
It doesnt take input.
 
nwp
Are you sure it's not an issue with garbage in the input buffer?
Apparently it's a known issue. Though I would have thought they fixed it by now.
 
@nwp Tried this, still skips a line.
maybe scanf is taking the \n as input
 
nwp
scanf returns how many variables it managed to read.
 
2:17 PM
so I should put a print statement there and print that value, right?
 
nwp
Or just use an assert. Just don't put the scanf into the assert.
 
@nwp it reads 1 character
I dont get how.
This is the code:
printf("\t\tEnter your choice:\n");
	char ch;
	int d = scanf("%c", &ch);
	printf("%d\n", d);
 
nwp
If that prints 1 then it successfully read a char.
It might make sense to also print ch or static_cast<int>(ch).
Oh wait, you're using C. (int)ch then.
 
I added a space before %c, it works now.
Damn it worked only 1 time!
Now I am facing the same problem again
 
if you're just reading one char why not use getchar?
And if this is an eclipse issue then why not just start a proper terminal when executing?
 
2:34 PM
@PeterT Because the program has many files...So I guess debugging will be a mess
 
how is the number of files related to which terminal you use?
 
 
3 hours later…
5:53 PM
How can we initialise a char* present in a typedefined struct?
> strcpy(book.name, input_name);
This^ doesn't work for me^
 
Hmm... what is name?
as in is it a string or a char*?
 
@d4rk4ng31 char* variable
 
and what is book?
 
Please put the definition
 
@PeterT A struct
 
5:54 PM
struct I guess
 
are you looking for strdup?
 
@Archer What have you currently done?
 
@d4rk4ng31 copied input_name to book's name?
 
does anyone know how I can delete the last two characters from a file on Windows? It cannot only be read-delete-rewrite, right? that would be too stupid..
 
@Dexter Truncate the file
 
5:57 PM
I would suggest you initialise it dynamically
@Archer
 
Okay, let me try strdup
 
something like char* name = new char[10];
@Archer Yeah even this will work
 
@d4rk4ng31 I am using C
 
then use malloc
char* name = malloc(sizeof(name)*10);
 
@d4rk4ng31 Why not strdup?
 
5:58 PM
You can. I haven't personally used it ever
But if you want, it is really good
You just have to do `book.name = strdup(<string to duplicate here>);
 
Okay this works!!
Why doesn't strcpy work though?
 
Yeah I know
strdup() essentially uses malloc
 
@Archer Because you haven't allocated the place you want to copy to
 
If you want to use strcpy(), you will need to use malloc()
Take a look
 
strcpy doesn't allocate new memory, it only writes to already allocated memory
 
6:02 PM
@PeterT oh right!
nullpointerexception
 
@PeterT ok. THX! I guess then I will use the windows SetFilePointer to first set pointer to the last second char and then the SetEndOfFile to set the end of file to that pointer. xD
 
@Dexter Stupid is essentially a thing in the KISS principles
@PeterT, have you ever used sdkman?
 
nah, not familiar
 
Oh!!
Have any of you guys?
 
@Archer you have my condolences
 
6:07 PM
XD
@Mgetz, What I still don't get is why is dear old Linus so obsessed with C
 
honestly it's not the worst language to use for the use-case
 
But it still isn't the best
 
@d4rk4ng31 probably explictness. Which is a good and bad thing. The issue I have is that while explictness is good, it's bad when that explictness gets hidden in constructs that then hide it like massive macros.
 
Isn't C the programming language taught to freshmen at various unis?
 
unfortunately
 
6:12 PM
At least in India, this is the case.
 
or worse... C with classes
 
@Archer Worse, our professors taught us TurboC
 
so many questions on SO where the honest answer should be "Stop using Borland"
 
@Mgetz AFAIK, C is the most implicit language
In what way are you suggesting explicit?
 
the fact that C++ compiles without exceptions and rtti isn't really part of the spec, so relying on disabling large parts of mandatory parts of the language spec just to make the language usable for your use-case isn't the best
 
6:13 PM
@Mgetz +100
@PeterT I did say nicely written.
 
@d4rk4ng31 so in the way that you have to explicitly tell it what to do. Always. There are no destructors you know exactly when a line of code should run (undefined behavior not withstanding).
 
C does maybe some conversions implicitly, but it doesn't run functions implicitly which is more of a concern
 
that said I'd take destructors over deadlock any day
 
@PeterT Hmm... true
 
@PeterT unless undefined behavior... but that's still UB
 
6:16 PM
Well, I still think its more of a personal opinion. I was perfectly comfortable with C till I came to know the std library and its features. If someone wants to use C++ and code in C, they are better off using C
 
Not disagreeing per se
I just don't think you can actually write secure code in C, the lack of compiler safeguards in the core language prohibits it
 
I don't think there is any C code which does not compile on C++ (explicit C code, i.e., not using defaults)
@Mgetz Hmm.... very true
 
@d4rk4ng31 quite a lot doesn't, lack of casts from malloc being one of the common items.
 
That's what I wanted to say by explicit C code, i.e., not using defaults
 
@d4rk4ng31 out of order designated initializer are commonly used in C and not supported in C++
and of course implicit void* conversions
 
6:19 PM
out of order designated initializer I will have to look up what those are
@PeterT Well, I did say explicitly written code without using defaults :P
 
I just mean "struct mystruct m = {.a=2, .c=3, .b=4}" where c is a member after b
 
geeksforgeeks.org/designated-initializers-c Wow!! Never knew one could do that.
@PeterT Do we have a room for this question?
 
for java tooling? I guess ask the java folks
 
Nope it isn't java tool
Take a look if you're interested
 
> Install Software Development Kits for the JVM such as Java, Groovy, Scala, Kotlin and Ceylon. Ant, Gradle, Grails, Maven, SBT, Spark, Spring Boot, Vert.x and many others also supported.
sounds like java to me
 
6:24 PM
SDKMAN! is a tool for managing parallel versions of multiple Software Development Kits on most Unix based systems. It provides a convenient Command Line Interface (CLI) and API for installing, switching, removing and listing Candidates. Formerly known as GVM the Groovy enVironment Manager, it was inspired by the very useful RVM and rbenv tools, used at large by the Ruby community.
You can install mostly all languages with it
 
all jvm languages ....
 
Python is a jvm language?
That's new
 
with jython it is :P
 
XD
Well, no, you can do sdk install python3
And it installs pure python3
 
the page says jvm, the examples are all jvm, so if you're looking for people using it, it's probably best to ask jvm folk
 
6:27 PM
The problem is actually not with jvm or sdk per se, sdk is not running even after being installed in my docker
That's what the issue is
When is the last time you used dockers?
 
technically today, but just used not changed a Dockerfile
 
Oh! So do you have a good experience with dockers?
 
nooooo
 
I'm still a noob
 
Just bad ones
 
6:29 PM
That's bad
Permian has used dockers it seems, but he didn't have time the other day :(
@PeterT Anyway, will heed to this :P
 
7:07 PM
Why is this unable to delete the file:
I also added the 2 fclose(fptr)s but that didn't work.
using perror() I get : Permission denied
 
windows?
 
yes
 
What antivirus?
 
@Mgetz Windows defender
 
hmm that shouldn't do it
it's pretty good about using a filter driver
 
7:22 PM
you haven't closed the file
or does it only prevent it if another process has it open?
 
@PeterT as long as the handle is open on windows
but even closing a handle is async on windows
 
time for yet another call to waitforobject :P
 
@PeterT I closed it. It didn't work.
 
@Archer check the windows event log
the security log should tell you why
or use process monitor
but likely you have it open in something
@PeterT the kernel queues up the delete IIRC and sends them off in batch to NTFS. But it's been awhile since I've had to deal with that
 
7:53 PM
is it possible to run two instances of the same program in Eclipse?
Because multiple people can use my program and it has some associated files so I want to check if those files work as expected when there are 2 users at the same time.
 

« first day (1423 days earlier)      last day (1413 days later) »