• Breaking News

    Monday, December 2, 2019

    Dropbox takes up 146 threads but its cpu usage is 0.5%. What does this mean? Ask Programming

    Dropbox takes up 146 threads but its cpu usage is 0.5%. What does this mean? Ask Programming


    Dropbox takes up 146 threads but its cpu usage is 0.5%. What does this mean?

    Posted: 02 Dec 2019 07:53 PM PST

    When commands from the terminal access a website (git push origin master) what is the underlying mechanism that allows this to occur?

    Posted: 02 Dec 2019 03:32 PM PST

    It seems like magic whenever I use it, and I'm curious as to what might be going on behind the scenes.

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

    I would like to build an app like a story decision based game, would a Binary Tree be appropriate?

    Posted: 02 Dec 2019 09:37 PM PST

    If every decision leads to a new choice, would it be better to use a balanced binary tree for every decision, instead of a long list of if statements?

    Thank you.

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

    Worried that i won't be a good programmer after college

    Posted: 02 Dec 2019 05:17 AM PST

    I'm majoring in Computer engineering. However, i kinda want to focus more on the programming side of it. I've had experience programming in high school, because i was on my schools robotics team. So, i thought that it would be a good fit since technology is huge in my life. Fast forward now and i'm a sophomore finishing the first semester and i'm taking computer science. First i'll say our teacher is trash. He was a sub in for the actual teacher who ended up retiring. Our school is understaffed it seems so they let someone like him teach computer science 1. We used python primarily. Anyways, sorry for the long post it wasn't intended to be this way originally. My thing is i'm worried that when i do get out in the field that i might be an incompetent programmer. Like, i can understand code easily that's not an issue. I feel like that's with everybody though. My problem is the problem solving aspect of it that is my biggest challenge. So far i'm somehow barely passing CS1. The labs have been tough and with the other 3 math heavy courses that i take along with it i feel like i haven't had time to devote to CS1 and i feel like that's bad since ya know that's what i thought i saw myself doing. Am i right to feel this way? life is scary :'(

    Edit: thanks everyone seriously the responses really helped. It gave me a little motivation. I'll stick with it and keep trying to get better however I can

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

    The opera browser allows you to save the current page as PDF. What is the technology that it uses to do this?

    Posted: 02 Dec 2019 08:13 PM PST

    Code visualization

    Posted: 02 Dec 2019 01:21 PM PST

    Are there any tools you guys use to see your code better?

    When I'm trying to understand a class or function, I often have to draw a flow chart through the chain of functions I'm trying to understand.

    Are you aware of any tools that do this for you?

    I work mostly in c++, but have projects in PHP/js as well

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

    [Python 3] Any performance difference between two nested loops vs. one loop with the exact same number of items?

    Posted: 02 Dec 2019 06:30 PM PST

    Hi, just a question I'm asking because I'm having serious problems with my image handling program. It's running way too slow.

    Thought I'd eliminate this as a problem.

    The size of the loops will either be:

    Height for one loop and width for another. Heightxwidth for one loop. The same operations are performed on both. At best I will be trying to grab items to the left and right and top and bottom of a loop (so height +1, height-1, with+1,width-1 for two loops or width-1, width+1 and so on for one loop.) if that makes a difference


    I'll show the code for first the nested loop then the unfurled loop.

    def updateWithVibe (img, sampleArray, radius, sampleCount): #create an appropriately size object to hold foreground mask. segmentationMap =np.zeros ((image.shape[0], image.shape[1])) #iterate over image for i in range (0,(img.shape[0]-1)): for j in range (0,(img.shape[1]-1)): count=0 index=0 distance=0 #count number of pixels that fall within a certain Euclidean distance of the sample value. If too many do it is background. If not, foreground. while ( ( count < minMatches ) and ( index < sampleCount ) ): distance=0 distance = abs ((img[i][j] - sampleArray[i][j][index])) if (distance < radius ): count+=1 index+=1 if count < minMatches: #make foreground pixel a white so it's highly visible segmentationMap [i][j]= 255 else: randNum= fastrand.pcg32bounded(subSamplingFactor) if randNum==0: randNum=fastrand.pcg32bounded(sampleCount) sampleArray[i][j][randNum]=img[i][j] randNum= fastrand.pcg32bounded(subSamplingFactor) if randNum==0: randNum=random.choice ([-1,1]) # go to a pixel in the neighborhood. sampleArray[(i+randNum)][(j+randNum)][randNum]=img[i][j] end= time.time () 

    segmentationMap =np.zeros (((img.shape[0]* img.shape[1]))) imgNew=img.flatten () for i in range (0,(imgNew.shape[0])): start = time.time() count=0 index=0 distance=0 while ( ( count < minMatches ) and ( index < sampleCount ) ): distance=0 pixelVal= int (img[i%img.shape[1]][i%img.shape[0]]) if pixelVal != imgNew[i]: print ("Match") quit () sys.exit () pixelVal2=int (sampleArray[i][index]) distance = abs (pixelVal-pixelVal2) print (distance) if (distance < radius ): count+=1 index+=1 if count < minMatches: segmentationMap [i]= 255 else: randNum= fastrand.pcg32bounded(subSamplingFactor) if randNum==0: randNum=fastrand.pcg32bounded(sampleCount) sampleArray[i][randNum]=imgNew[i] randNum= fastrand.pcg32bounded(subSamplingFactor) if randNum==0: randNum=random.choice ([(img.shape[1]+1),(img.shape[1]-1), (-img.shape[1]-1), (-img.shape[1]+1),1,-1]) while ((i+randNum)<0) or ((i+randNum)>imgNew.shape[0]): randNum=random.choice([(img.shape[1]+1),(img.shape[1]-1), (-img.shape[1]-1), (-img.shape[1]+1),1,-1]) randNum2=random.choice (choices) sampleArray[(i+randNum)][fastrand.pcg32bounded(sampleCount)]=imgNew[i] imgNew2=np.reshape (segmentationMap,(img.shape[0],img.shape[1])) return imgNew2, sampleArray 
    submitted by /u/Arjenics
    [link] [comments]

    Completely lost.

    Posted: 02 Dec 2019 09:58 PM PST

    Hi all. I'm doing a project with some group mates where we're creating a code that manages a movie theater system. I'm in charge of generating a daily report that covers the number of tickets sold, customers, etc. I have no idea where to start and I feel like this would be a good place to ask. Thanks!

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

    Determining how a file is packages/encoded..

    Posted: 02 Dec 2019 09:41 PM PST

    Not sure if this is the right place to ask..

    I have a game that displays small animations in between rounds. I want to change them to other sounds/animations. The problem is they're a .vid file that's in a proprietary format. I know inside it references a sound file and takes .tga image files to make the animation.

    I spoke with someone who originally designed the game. He no longer has the software to make .vid files, but he had this to say:

    "I poked around for a minute and can't find the tool which packed the .vid files. I suspect the format is pretty trivial, with a header and then frame data which is maybe compressed in some simple way like run-length and maybe differenced. If you compare a hex dump of a few of them side by side you can probably figure it out."

    I have a hex editor, but so far I'm unable to try and figure this out. Is there a way to figure out if something is RLE encoded or how I might accomplish this whole mission of mine? ...

    ... or this pretty much something I will never be able to accomplish?

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

    Isn't all the buzz about the cloud,SaaS, microservices etc.. really just a mainframe style centralized architecture for modern computing

    Posted: 02 Dec 2019 03:35 PM PST

    So it seems to me the more we move.forward the more we do things like in the past , today's trends to move all processing and storage to the cloud or taking it a step further streaming cloud computing results (aka Google Stadia) is no different conceptually to old school dumb terminals connected to mainframes...

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

    First time asking

    Posted: 02 Dec 2019 08:50 PM PST

    Hey guys, I'm in a bit of a pickle. I'm currently finishing my school project, I'm trying to build a basic calculator using Methods, arrays and GUIs in Python. My problem is that when I press the equal button, instead of storing the answer once, it goes on and on then stops because of RecursionError. I need someone to explain to me what's wrong. Can't post photos videos directly at this post. So I'm going to provide the video in the comment.

    Edit: Just tried, I can't. This is also my first reddit post, pls no bully.

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

    CS Student, how to become a better programmer?

    Posted: 02 Dec 2019 08:32 PM PST

    Hey guys. I'm a CS major currently taking my first CS course. I currently know Python from university and I'm learning java & SQL in my free time. What do you guys recommend to do to improve at programming? I'm good with tracing code questions and theory stuff, but when I have to solve university assignments it takes me a loooooong time to get things & figure out how to code the assignment. I've needed a lot of help to get my assignments done. I'm worried that my speed at writing my source code and debugging it will affect me as a developer in the future and in my interviews for internships.I heard a lot of people go through this but I feel like I'm worse at it than most. Is this a normal learning curve or should I be worried? Any advice to become better at problem solving and algorithm writing? What are the best coding challenge websites?

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

    Is it ok to issue Password or Email is Incorrect error message?

    Posted: 02 Dec 2019 04:37 PM PST

    Do I also need to account for a case when the user doesn't exist? Or saying Password or Email is Incorrect - is sufficient? Email is used as a login field

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

    Need help on a java programme

    Posted: 02 Dec 2019 05:05 PM PST

    I'm trying to create a chessboard using 2 methods, this is for my university work, but I don't know if I can't figure it out because I'm not too good with methods/ don't understand them well enough or if I am doing something wrong with my 2D arrays.

    Please help me, dm me so I can message you the code.

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

    What would, in your opinion, be the best language for fullscreen application reading ?!

    Posted: 02 Dec 2019 03:21 PM PST

    Example :

    > Playing Age of Empire.

    > I get 1000 wood.

    > Soundfile plays "woah you got 1000wood !"

    Now this is just numbers on a still background.

    What if I'm playing a fast paced Shooter, and the "Triple kill" message pop-ups on a moving, particles loaded, background.

    > Soundfile plays "woah you got a triple kill !

    Opinions ? :D

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

    How does a JIT compiler switch between compiling and running?

    Posted: 02 Dec 2019 05:19 AM PST

    Suppose the JIT compiler compiles up to a jump instruction, but not past.

    mov %rdi, %rbx mov %rsi, %r12 call length_string 

    Then, we switch to executing. The thing is, though, we cannot actually execute the instruction

    call length_string 

    , we need to do some more JIT before that. So, is there some kind of trap set at call length_string, right before it runs? If so, how is this done? If not, what is done?

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

    Project: AVR Assembly Debugger

    Posted: 02 Dec 2019 11:07 AM PST

    Hey Guys,

    I am currently working on an Assembly Debugger/Simulator for Atmel's 8-bit AVRs.

    I would be happy about some feedback and opinions. Maybe there is something that I can improve.

    It is a CLI Tool for Linux, written in C++. Pictures of the Project are in the Readme.

    So if you are interested in giving me some feedback, you can visit my Repo. And if not, it's ok, too :D

    https://www.github.com/Milo-D/MDX-Assembly-Debugger/

    Thanks.

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

    Assuming you have as much free time as you need, how long into learning how to program could you start making money from doing freelance jobs?

    Posted: 02 Dec 2019 10:36 AM PST

    Obviously this will vary greatly depending on how much time, specifically, you can spend on learning, and how well you pick up what you are learning, but I'm really just hoping for an idea or rough estimation. An answer might even be less about length of time involved and more about which specific concepts and skills would stand you in good stead.

    I ask because I'm unable to work due to health issues. I do some freelance writing from home, but have started CS50x and an Open University software development degree as a way to make a career that I can hopefully establish from home.

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

    Splitting a word according to the letters it contains in Python

    Posted: 02 Dec 2019 05:57 AM PST

    Hi,

    I'm fairly new to python and am wondering if there is any way to split a word into its constituents based on a letter it contains.

    For example, the letter E in HELLO to give HE + LLO.

    For example, the letter R in WORLD to give WOR + LD.

    Thank you in advance.

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

    Add comments to shell command split across multiple lines

    Posted: 02 Dec 2019 05:41 AM PST

    (Crosspost from StackOverflow)

    I have a bash command split across multiple lines (toy example):

    echo "I like monkeys" > monkeys awk '{print $3}' monkeys \ | wc \ | sort \ | uniq -c 

    Is it possible to comment under each line while still allowing the command to run? E.g. the below fails, terminating the command after the awk command.

    echo "I like monkeys" > monkeys awk '{print $3}' monkeys \ # This line prints the word monkeys | wc \ # This line counts lines, words, and characters | sort \ # This line essentially does nothing | uniq -c # This line adds a 1 to the front of the previous lines 
    submitted by /u/JoniTheGoat
    [link] [comments]

    Which do you prefer : GitLabs CI/CD or Azure DevOps?

    Posted: 02 Dec 2019 01:04 PM PST

    I use Azure devops at my job but I see value in gitlabs for individual use.

    submitted by /u/42069_42069_42069
    [link] [comments]

    Understanding the parsing of complex classes, in a distributed system [Question]

    Posted: 02 Dec 2019 06:35 AM PST

    My project group and I are working on our semester project at the university and the main theme is distributed systems. We are developing an event coordination system in Java and we misunderstood how to make it distributed. The deadline is in two weeks and we are trying to transition the system to distributed using the framework "Javalin". We chose to do it this way, because it was recommended to us.

    The problem is that we do not understand how to parse complex classes from the domain and database layers (on the server) to the presentation layer (on the client). How would the presentation layer know what an "Event" class is, without importing it? How would we send a List of Events to the GUI?

    Here is a link to a gist of our work in progress on the API related classes. We have a superclass called "Event", which the two classes "CorporateEvent" and "Meetup" inherits from. We are now trying to create these objects through the client to the server. It is not a problem to create the Meetup object, because it's all strings. We cannot create a CorporateEvent object because it takes a list of "Task" objects, which is also a custom class we created.

    Our current solution was to cut the list up in toStrings, placing "-" between them and then recreate them in the domain layer but this seems like a dumb and uneffective way to go about it.

    The Javalin implementation is made up of the classes "API" and "APIHandler" in the domain layer and the "APICaller" class in the presentation layer.

    I hope anyone can shed some light on this issue and make us understand this distributed aspect some more, so we atleast can try to defend the project at the exams. Thanks in advance!

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

    What are blank websites usually for? (see: google.com/search?q="Otiose+and+useful"&start=10)

    Posted: 02 Dec 2019 11:36 AM PST

    that link again:

    https://www.google.com/search?q="Otiose+and+useful"&start=10

    Was looking into uses of the word Otiose and came across a toad's eggs strand of IPs all with the same landing page.

    Is it just a banner ad CTR bleeder or something more?

    • Also (if it won't take up too much of your time to explain) how does it have text with no html?

    Just curious. Thx you.

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

    I'm want to parallelize this code with pthreads, but I don't really now how

    Posted: 02 Dec 2019 03:32 AM PST

    #include <stdio.h> #include <stdlib.h> #include <string.h> int main() { FILE *fIn = fopen("file.bmp", "rb"); FILE *fOut = fopen("file_g.bmp", "wb"); if (!fIn || !fOut) { printf("File error.\n"); return 0; } unsigned char header[54]; fread(header, sizeof(unsigned char), 54, fIn); fwrite(header, sizeof(unsigned char), 54, fOut); int width = *(int*)&header[18]; int height = abs(*(int*)&header[22]); int stride = (width * 3 + 3) & ~3; int padding = stride - width * 3; //printf("width: %d (%d)\n", width, width * 3); //printf("height: %d\n", height); //printf("stride: %d\n", stride); //printf("padding: %d\n", padding); unsigned char pixel[3]; for (int y = 0; y < height; ++y) { for (int x = 0; x < width; ++x) { fread(pixel, 3, 1, fIn); unsigned char gray = pixel[0] * 0.3 + pixel[1] * 0.58 + pixel[2] * 0.11; memset(pixel, gray, sizeof(pixel)); fwrite(&pixel, 3, 1, fOut); } fread(pixel, padding, 1, fIn); fwrite(pixel, padding, 1, fOut); } fclose(fOut); fclose(fIn); return 0; } 
    submitted by /u/StephanoDoto
    [link] [comments]

    No comments:

    Post a Comment