488 questions
0
votes
0
answers
37
views
ClassCastException is not coming in JDK21 in Eclipse
ClassCastException is not coming in JDK21 in Eclipse
I check whether I get a ClassCastException in the console by using the TreeSet<StringBuffer>. However, the values are sorted and the output ...
0
votes
1
answer
62
views
Flutter , stream letters to a single sentence
I'm getting a stream of words from server. The objective is to combine the words into a single sentence dynamically. Now what happens is as follows, the values are appended, but the entire string is ...
0
votes
0
answers
98
views
C++ multiple producer multiple consumer lock-free queue - where is my error?
I implemented the following multiple producer multiple consumer lock-free queue, however it crashes when I run it, inside dequeue function with "std::bad_alloc" exception. I don't understand ...
0
votes
3
answers
122
views
Replacing "is" with "is not" in Java
I'm in college and our professor gave us this exercise where the user should input a sentence such as "Life is great" (positiveInput in this case) and we should replace the word "is&...
0
votes
2
answers
125
views
Create a Java StringBuffer from a Map and Java Object
I am trying to create a csv file with the headers coming from a map and the values coming from an object. I have a Java object which stores different attribute data.
public class MyObject {
...
0
votes
0
answers
28
views
is there a way to std::basic_istream::get with a basic_streambuf to also read the delimeter char?
Given
#include<string>
#include<stringstream>
#include <fstream>
int main(int argc, char* args[])
{
std::fstream file("MyFile.txt", std::fstream::in);
std::stringbuf ...
0
votes
3
answers
36
views
shorter version of buffer write method (DRY)
I have this method and I want to know is there a practical and clean way to write this code shorter:
This excersice was from a Dart Apprentice: Beyond the Basics book.
void main() {
final lyric = '[...
0
votes
1
answer
53
views
Why does my rptr signal in vhdl move forward even tho it shouldn't?
Hi i have this block of code for a ring buffer
library ieee;
use ieee.std_logic_1164.all;
entity ring_buffer is
generic (
RAM_WIDTH : natural;
RAM_DEPTH : natural
);
port (
clk : ...
1
vote
1
answer
69
views
Not seeing full data in the string buffer in mutli thread logging
I am using ThreadLocal StringBuffer for storing entire log to move it to kibana at the end of each test case execution. But when I am running cases in parallel, the log is loosing some entries.
I am ...
-2
votes
1
answer
135
views
Write and Read file with RandomAccessFile in Java
Hello I am writing a program that write and read file XML in Java.
Here is the Writing file
public static void main(String[] args) throws IOException {
File file = new File("C:\\Test\\...
-2
votes
4
answers
138
views
Remove the last letter of every String in Array [JAVA] [closed]
As the title says.
In want to remove the last letter of every word in an array and put it to the beginning of every word.
Here's an example (Input):
Hello I am a player
And here's the output:
oHell I ...
-2
votes
3
answers
289
views
Reverse String inside a While Loop
I just started learning Java and I'm doing a little program to convert a decimal number into binary numbers using only while loops.
The results were reversed, therefore I'm using a method to reverse ...
0
votes
0
answers
382
views
Can we use String Buffer to store passwords in place of using char[] array?
It is preferred to use char[] to store passwords rather than a String in Java. But can we use StringBuffer instead of char[] to store passwords?
0
votes
1
answer
210
views
Java StringBuilder remove XML Tags
I'm trying to pass a XML object through a StringBuilder to compare to Objects, fitting to my needs.
I was wondering if there is a nice way to remove specific tags from the whole String. Underneath I ...
0
votes
1
answer
55
views
Why program did not show answer in out.txt?
The code should do a reverse and output the result to out.txt, but this does not happen, can you explain my mistake in the code. Thanks in advance
import java.io.BufferedReader;
import java.io....