• Breaking News

    Friday, January 8, 2021

    How to rewind the caret to the beginning of a line in a file? Ask Programming

    How to rewind the caret to the beginning of a line in a file? Ask Programming


    How to rewind the caret to the beginning of a line in a file?

    Posted: 08 Jan 2021 09:13 PM PST

    fseek()

    how to know how much offset from SEEK_CUR ?

    keep fscanf til met '\n', how?

    data.txt for example:

    123 245(if caret is here)56 90909090 1 

    and I wanna delete the line but I don't wanna fgets all line and re fprintf except the deleted one.

    submitted by /u/JacksonSteel
    [link] [comments]

    Why programmers love ultra-wide monitors instead of 16:9?

    Posted: 08 Jan 2021 08:16 AM PST

    The context:

    Im looking for solution to see more text on the screen. I already use 27" FHD horizontally and 24" FHD vertically and i really like that i can see "the big picture" of the code or can copy/paste massive texts from docker logs. But vertical FHD is too narrow for things like diff'ing stuff or even file browser panel on the left side. So i want to buy 4k 32" monitor (instead of horizontal 27" FHD) which would allow me to see large portions of code.

    During my researchs i found that many programmers recommend and swear by ultra-wide screens. And because most of those screeens are 1440 high i have hard time to understand why they prefer to have like 2x2k monitors in one instead go with 4k and see more things with it.

    Am i overlooking something?

    submitted by /u/domanpanda
    [link] [comments]

    What app you need in your daily life but it doesn’t exist or poorly made?

    Posted: 08 Jan 2021 03:29 PM PST

    What language should i learn for creating desktop application?

    Posted: 08 Jan 2021 04:45 AM PST

    I want to create desktop app that have function for pressing specific keyboard key, for specific application that running in the background, and specific delay time. Example chrome, notepad, and many other apps is running, and i want to automatic pressing CTRL+[some key] just for Chrome in every 1 seconds. I already have 1-2 year coding experience building dynamic website, and now i want to know how to build desktop app what i want. What language should i learn? Is there any similar app like what i said before?

    Thanks and sorry for my bad english.

    submitted by /u/mrzram
    [link] [comments]

    How do you handle re-starting your project from scratch when dealing with Github?

    Posted: 08 Jan 2021 04:27 PM PST

    Project ABC built in VS code, build a poc that's kept in Github. Installed extra dependencies learning/testing ect. Too much work to clean.

    Time to start building the ABC project clean starting from scratch, copying most of the code over.

    Fmu, I can see:

    • Making a completely new project ABC1 but that's not optimal name/history wise.
    • A fork means I can't keep both codebases available at once.
    • Rename the old one, main folder and all and create a new project with the same name.

    None seem optimal. Learning a few new techs, built my poc, did my first re-write, needs to be done again as my poc wasn't done in depth enough.

    submitted by /u/VirtualLife76
    [link] [comments]

    How to rewind the caret to the beginning of a line in a file?

    Posted: 08 Jan 2021 09:48 PM PST

    fseek()

    how to know how much offset from SEEK_CUR ?

    keep fscanf til met '\n', how?

    data.txt for example:

    123 245(if caret is here)56 90909090 1 

    and I wanna delete the line but I don't wanna fgets all line and re fprintf except the deleted one.

    submitted by /u/JacksonSteel
    [link] [comments]

    Need to know if it's possible to have a tablet turn on and run a program automatically.

    Posted: 08 Jan 2021 03:44 PM PST

    First off I know nothing about programming really. I have an 8" Toshiba Windows tablet that I'll be using to talk to an external device. I'd like the tablet to turn on when it see power at the charging port, open a program, and have the program execute a few commands. I'm wanting the tablet to talk to my car's engine ECU to look at live data.

    submitted by /u/juwyro
    [link] [comments]

    Looking for a code inside a .bat file to restart ethminer.exe after so long

    Posted: 08 Jan 2021 09:34 PM PST

    hey all, I am looking for a code to restart the miner regularly, every 15 minutes or so, I have it overclocked some but unfortunately some of our cards have hynix memory, so the stability doesn't last long, and the miner errors and goes to 0/ mh/s on all 8 cards, I want to just run the mining code/ethminer.exe for 15 minutes, close then restart it.

    Here is the code I am currently using for any disconnects/kicks off of their servers, was having connection issues with their servers and this fixed it to reboot if kicked off

    :start C:\Users\miner\Desktop\ethminer\ethminer.exe -U -P stratum://my.ethwalletaddress.rigname@us1.ethermine.org:4444

    REM Sleep for 15 seconds

    ping 127.0.0.1 -n 5 > nul

    REM Return to start

    goto start

    submitted by /u/Stickel
    [link] [comments]

    need help understanding what I should do to be able to get data associated with a unique ID to be exported to pdf in a windows form application

    Posted: 08 Jan 2021 09:33 PM PST

    This is my windows form UI and this is the exported pdf file screenshot.

    the process flow of me generating the pdf starts at where I input a studentID and I assign courses with their unique ID. all the info in textboxes i put it into paragraph tags with the itextsharp library to generate the pdf file.

    however I would like to export the course title instead of the course ID. That is to search the Courses table in the database for the title of each course ID entered in the 4 textboxes. This is the sql code I have been able to come up and not sure how to work it out for all 4 course id text fields.

    SqlConnection con = new SqlConnection("Data Source=.; Initial catalog=SMS; Integrated security=true; Connect Timeout=10;");
    string sqlst = "select Title from Course where CrsID='" + txtcid1.Text + "' "; SqlCommand cmd = new SqlCommand(sqlst, con);
    con.Open();
    SqlDataReader dr = cmd.ExecuteReader();
    if (dr.Read())
    {
    string a = dr["CourseID1"].ToString();
    }

    else { }
    con.Close();

    and in the coding for the pdf export

    Paragraph p3 = new Paragraph("Course No 1:" + a);

    while this allows to retrieve 1 one of the titles i need to able to retrieve all 4 course titles. I want to know if I should look into loops to achieve this or some SQL query?

    submitted by /u/SnapeSFW
    [link] [comments]

    Need help with an algorithm

    Posted: 08 Jan 2021 05:39 PM PST

    Hi guys! I am a total beginner at programming and want to learn c#. I want to write an algorithm that will place 4 different variables into a 2x2 square. Each time it places one of four variables out to a grid, I want it to come up with a unique identifier for that variable in that position. In a way I want this algorithm to come up with a database of all possible combinations. Could anyone here point me in a direction of where you think I should look.

    Here is an idea on paper. 52 possible outcomes without mixing variables between themselves. https://i.imgur.com/qJ6K9ez.jpg

    submitted by /u/Sinsinger
    [link] [comments]

    How do I uninstall a program I install using "curl" ?

    Posted: 08 Jan 2021 05:27 PM PST

    This is probably a newbie question but basically I installed lektor, a Python static site generator using the following curl command:

    curl -sf https://www.getlektor.com/installer.py | sudo python3 

    I saw this during the installation:

    Welcome to Lektor This script will install Lektor on your computer. Installing at: bin: /usr/local/bin app: /usr/local/lib/lektor 

    Let's say if I now want to uninstall this from my computer, what do I do? I googled and there seems to be no documentation about uninstallation.

    TIA!

    submitted by /u/idkwhatname23
    [link] [comments]

    Why is my JSON file so ugly?

    Posted: 08 Jan 2021 10:23 AM PST

    When I print my JSON text it looks clean ie :

    { "items": [ { "external_urls": { "spotify": "https://open.spotify.com/artist/1URnnhqYAYcrqrcwql10ft" }, 

    But when I write it to a JSON file using this line of code :

    filePathNameWExt = 'output.json' data = json.dumps(data, indent=4) with open(filePathNameWExt, 'w') as fp: json.dump(data, fp) 

    It looks like this :

    "{\n \"items\": [\n {\n \"external_urls\": {\n \"spotify\": \"https://open. 

    Important information :This is in Pycharm with python

    I have only just started learning about how JSON works

    I am trying to using the Spotipy API with this small project

    I am trying to write some text I get as a result of a call to Spotify API into a JSON file because, idk I feel like thats what I should do. Going to learn later how to parse through JSON files.
    Let me know if I need to provide info. I'd post screenshots of my code but not allowed in this sub. So I Just included the relevant code.

    submitted by /u/tobysnake
    [link] [comments]

    Why is the lite version of Twitter only 410 kb as opposed to the main app on the app store which is 18 mb?

    Posted: 07 Jan 2021 11:51 PM PST

    See screenshots:

    I've seen this with other apps as well, where you can add a shortcut that ends up working just as well as the actual app, and they are usually less than a megabyte as opposed to the actual app which is at least 20 or 30 megabytes.

    So what is all that extra code in the main app actually doing?

    submitted by /u/justjust000
    [link] [comments]

    Is anyone using CockroachDB in production?

    Posted: 08 Jan 2021 02:54 AM PST

    How do you find it? Would it be suitable to use one cluster to service multiple microservices?

    submitted by /u/Zyzz123
    [link] [comments]

    Apache Config for PHP Website - Stuck

    Posted: 08 Jan 2021 12:53 PM PST

    PHP application on AWS Linux 2 AMI not working with POST requests or getting code from JQuery CDN.

    I can't seem to figure out how to get it to access the internet and share information between files.

    Other things are working as expected.

    submitted by /u/AnnualPanda
    [link] [comments]

    Working Process Experience Going From Junior To Senior Developer

    Posted: 08 Jan 2021 11:30 AM PST

    I'm just wondering about how a programmer's job evolves through years and experience, like what does a junior programmer work on? what does he work on when he becomes a senior? how does it change by time? does it get easier or hard? does it get boring? gets more interesting? i guess you got the question. So yes, i'm interested in reading seniors experience, so that i know what to expect and what i'm getting into.

    submitted by /u/OsamaNA_dev
    [link] [comments]

    WIN32API Detect Another Process Current Window

    Posted: 07 Jan 2021 11:21 PM PST

    Hello! I am trying to detect another process (Origin) detect current form with WIN32APIs. I tried to find "Sign it with EA Account" QLabel on Spy++ but Origin uses Qt there is no child windows, there is only main window. So FindWindow method doesn't works. Images: https://imgur.com/a/sBMrnzC

    submitted by /u/Emrecpp
    [link] [comments]

    Connections between people, finding second connections

    Posted: 08 Jan 2021 10:35 AM PST

    I am developing a web application (MySQL, PHP, Python, jQuery, HTML , CSS) and I want to have some sort of connections between users. The way I am thinking too go about it is to have a MySQL table just storing the connections UserID to UserID.

    I was thinking being able to recommend users, for example second connections. Can this be done more efficiently ? Because in my way I would need to go through every connection and then get all the connections for that user? Any SQL query suggestions to make it easier or just a different way to go about connections

    submitted by /u/Hammad1814453
    [link] [comments]

    Want to get into programming. What should I know before starting. Tips on how/where to start

    Posted: 08 Jan 2021 10:32 AM PST

    Like I said in the title I want to get into programming. I know absolutely nothing. I was wondering where do I start and what is somethings that I should know before starting? I would like to make this my career. Thanks in advance.

    submitted by /u/Uzixxa
    [link] [comments]

    Hello, please help me figure out this program.

    Posted: 08 Jan 2021 09:06 AM PST

    Below given program is a random email address generator with some pre given rules. I have put it in for loop to get multiple random emails, the problem is, on first and second iteration it works fine, but after that it just keep on repeating the results of the second iteration.

    #include <iostream>

    #include <string>

    #include <cstdlib>

    #include <ctime>

    using namespace std;

    static const char alphanum[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZ" "abcdefghijklmnopqrstuvwxyz";

    static const char gennum1[] = "0123456789";

    int len = sizeof(alphanum) - 1;

    int len1 = sizeof(gennum1) - 1;

    char genRandom(int a) {

    for(int z = 1; z < a; z++) { cout << alphanum\[rand() % len\]; } 

    }

    char gennum(){

    cout << gennum1\[rand() % len1\]; 

    }

    char genRandom2(int a) {

    for(int z = 0; z < a; z++) { cout << alphanum\[rand() % len\]; } 

    }

    char genurl(){

    srand(time(0)); string urls\[\] = {"com", "net", "org"}; string random = ""; for(int i = 0; i < 3; i++) 

    {

    random = urls[rand() % 3];

    }

    cout << random; 

    }

    int main() {

    srand(time(0));

    int n, q = 5, i = 0;

    cout << "Enter string length: ";

    cin >> n;

    while(i < 10){

    i++;

    genRandom(n);

    gennum();

    cout << ".";

    genRandom(n);

    gennum();

    cout << "@";

    genRandom2(q);

     cout << "."; genurl(); cout << endl; } 

    }

    submitted by /u/mohsin308
    [link] [comments]

    In Java what does it mean if scope is not explicitly defined for class attributes?

    Posted: 08 Jan 2021 07:54 AM PST

    public class Document { String name; String description; Long createdAt; ... } There are no getter and setter methods at the time being
    Do you assume the class attribute scope for name etc is private?

    submitted by /u/Bulbasaur2015
    [link] [comments]

    I think I have found THE language to replace C. It's V-lang

    Posted: 08 Jan 2021 09:06 AM PST

    I almost went with Nim, but then I saw that it statically compiled into two files, and the basic dynamic binary is about 7 times as big as C (although, C is about twice as big when made static)

    But V-lang compiles directly into a static binary, and is smaller then both. And people say it's as fast as C, if not faster.

    So, like, do I have your blessing to go through with this? I mean, you can compile cross-platform on your own platform as long as you have the compiler, you get static binaries like a normal portable person, once you get over the goofy wonky functional things like := the syntax is pretty neat (a crossover between python and C. Go basically). It has nice libraries like time which has sleep, so you don't have to import the whole fricking unistd.h to use sleep.

    To me it looks like it has no flaws. I mean, it might have if you are a sooper dooper haxxor and want to make FIFA in pure C++ while making it under 2 MBs while being cross-platform and working on a browser while hosting a server and supporting 10 different languages as backend. But for me, making basically vaguely formatted terminal programs with some ASCII animations with sleep, I think it might do.

    What do you guys think?

    Also, what's with the emergence of lots and lots of new languages where every bozo makes a language. I think there is a problem in having too much choice. Same as Linux. The endavour gets watered down because every person wants their own distro which is just slightly different, and only a few make it and get accepted as go-to distros which then become widely supported and referenced in stackoverflow.

    Tnx!

    submitted by /u/rfgzuu
    [link] [comments]

    No comments:

    Post a Comment