• Breaking News

    Monday, June 10, 2019

    What’s the best way to handle scheduled events? Ask Programming

    What’s the best way to handle scheduled events? Ask Programming


    What’s the best way to handle scheduled events?

    Posted: 10 Jun 2019 06:27 PM PDT

    Say I want to write a script that sends an API request every day at a certain time. What's the best way to run this? Cron job? Timer that counts down till fire? I haven't looked into it much but is AWS lambda for this kind of thing?

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

    Noob question: How is this website made and how should I request help from a developer?

    Posted: 10 Jun 2019 10:43 AM PDT

    Hello guys, sorry if this is not the right place for this, but with E3 going on and me following through E3 Recap (link), I was wondering how it was developed and how could I do a similar website, but as a free car buying guide (think of it as a list of current "good" cars on sale today). How could I explain this to a developer? Is this Javascript? Can you guys looking at the front-end tell how is this website managed (the back-end, I guess it's what is called)? I like the idea of having cards with the flipping animation and maybe a link for a brief review on the car, and the option to filter them by sedan, SUV, truck, etc. Also, would you say this is a complex project? Thanks in advance!

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

    Which real-time collaboration text editor like cryptpad or collabedit would you recommend?

    Posted: 10 Jun 2019 05:33 PM PDT

    Is for programming in C. I have been using sublime text 3 if you need to know.

    I'm thinking in using cryptpad but I'm looking for a second opinion.

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

    Is it possible to redirect upon POST in Django?

    Posted: 10 Jun 2019 09:09 PM PDT

    Python: What am I doing wrong here? (it's a program in Spanish) Instructions translated. Syntax errors?

    Posted: 10 Jun 2019 05:44 PM PDT

    Practical work 02: Information Management tollbooths

    Important Note 1: The development of this practical work should be based solely on the tools and issues that look to the tab 10inclusive. Among others, the topics covered by these chips include repetitive instructions, data validation, using functions to measure time - controlled menu options, subproblems, programmer - defined functions, parameters, return values and program modules.

    Important Clarification 2: PLEASE READ ALL CONTENT OF THESE NOTES BEFORE STARTING WORK. No claims will be accepted for any errors that could commit because of the trouble to read the slogans that was set have not taken.

    to. Phrasing and Slogans. [1]

    The general context in which this statement is part, has been proposed jointly by the Departments of Algorithms and Data Structures (AED) and Systems and Organizations (SOR), to serve as an experience of integrating work concepts and practices They are treated in both subjects. It seeks to ensure that students understand that each subject of the race is closely linked to the others, and the topics covered in each are not isolated or distant to you play on the other. As professionals systems, students can (and must) begin to manage terminologies and practices arising from all the classes they take, and therefore they should also understand that no matter must be taken in isolation or separated from other : all related and all contribute to the final formation of the future Information Systems Engineer.

    In that sense, then, the context or framework in which this practical work arises is that of a concessionaire of provincial roads and especially the functions performed for the collection of tolls.

    With specific regard to the development of practical work 2 AED, we consider the operation of toll boxes on a route of our city, and to simplify take the vehicle passes in a single box.

    Assume that the Manager of the concessionaire of the toll that route has requested the implementation of an information system that collects information from the vehicle passes that occurred in that single cell and generate the information necessary results for permanent optimization operative that box. To this end, it is requested to schedule a system that complies with the following features:

    Assuming that the tollbooth has 4 - hour shifts, are asked to create a simulation of the vehicle passes by it, taking hours and minutes. That is the program run for 4 minutes (considering that 1 minute is the first time, 2 the second and so on). To control time can refer to time.time () function (provided by Python) and can simulate pauses using sleep () (also provided by Python). On the use of these native features examples from exercises will guide.

    Before you start uploading data (and before starting the run simulation time advance) call if you want to generate the data automatically or make manual loading. Then they are loaded or generate the automatically (depending on what the user chose) vehicle passes, knowing that a pass contains the following information:

    • Vehicle type: Possible values are 1: Motorcycle, 2: Auto and 3: Truck. The pass price depends on the type of vehicle ($ 20 Moto, $ 40 Auto, $ 80 Truck).
    • Way to pay:
      • 1: Cash.
      • 2: Telepeaje.
    • If toll should also apply for the patent of the vehicle, considering that only correct patents accepted either the LLLNNN or LLNNNLL form (being a letter L and N number).

    Four minutes past the program must show the following results:

    1. Number of passes by vehicle type during the shift.
    2. Collection by type of payment: cash and electronic toll during the shift, taking into account the prices of the passes depending on the type of vehicle.
    3. Total collection of turn.
    4. Total number of passes that were performed during the shift.
    5. Type of payment had increased use (as many passes): cash or electronic toll.
    6. Average number of passes per hour during the shift.
    7. The new patent and what time passed (how many minutes after the start of the turn).
    8. Report rush hour shift, to this point should show what was the most amount of time passes (minute simulation).

    Remember that if the data were generated randomly to be shown as they are generated. If the load is manual must validate every possible situation. The program must be controlled by a menu of options that allow:

    1. Define load form
    2. Process the past
    3. See results
    4. Go out

    import random
    import time

    #CANTIDAD DE PASES POR TIPO DE VEHICULO DURANTE EL TURNO
    def datito():
    datos = int(input("Ingrese 1- Carga Manual , 2- Carga Automatica:"))
    while datos <= 0 or datos >= 3:
    print("Error, ingrese de nuevo la carga")
    datos = int(input("Ingrese 1- Carga Manual , 2- Carga Automatica:" ))
    break
    def datitos2(datos):

    inicio = time.time()
    final = inicio +240
    cont_auto, cont_moto, cont_camion = 0,0,0
    sum_moto,sum_auto,sum_camion = 0,0,0
    total_pasaron = 0
    ahora = inicio

    #Inicio de tiempo
    #\*********************************************************
    while (inicio < final):

    #Manual
    #Efectivo
    if datos == 1:
    if pagos == 1:
    movil = vehiculo()
    if movil == 1:
    cont_moto +=1
    sum_moto += 20
    if movil == 2:
    cont_auto +=1
    sum_auto +=40
    if movil == 3:
    cont_camion +=1
    sum_auto +=80
    #Telepeaje
    elif pagos==2:
    patene = patente_Manual()
    movil = vehiculo()
    if movil == 1:
    cont_moto +=1
    sum_moto += 20
    if movil == 2:
    cont_auto +=1
    sum_auto +=40
    if movil == 3:
    cont_camion +=1
    sum_auto +=80
    #Automatico
    #Efectivo
    if datos == 2:
    pagos=random.randint(1,2)
    if pagos == 1:
    movil = vehiculo()
    if movil == 1:
    cont_moto +=1
    sum_moto += 20
    if movil == 2:
    cont_auto +=1
    sum_auto +=40
    if movil == 3:
    cont_camion +=1
    sum_auto +=80
    #Telepeaje
    elif pagos == 2:
    patene = patente_Manual()
    movil = vehiculo()
    if movil == 1:
    cont_moto +=1
    sum_moto += 20
    if movil == 2:
    cont_auto +=1
    sum_auto +=40
    if movil == 3:
    cont_camion +=1
    sum_auto +=80
    #Final del tiemppo
    #\************************************************************
    return
    def pago():
    pago = int(input("Ingresar forma de pago: 1 en efectivo y 2 telepeaje: "))
    #validacion
    while pago <=0 or pago >= 3:
    print("ERROR,Ingrese nuevamente la validacion")
    pago=int(input("ingresar forma de pago de nuevo: "))
    return pago

    def vehiculo():
    v = int(input("Ingrese tipo de vehiculo 1- Moto, 2- Auto, 3- Camion: "))
    while v <= 0 or v >= 4:
    print("Error, ingrese nuevamente")
    v = int(input("Ingrese tipo de vehiculo 1- Moto, 2- Auto, 3- Camion: "))
    return v

    def patente_Manual():
    val = False
    print("Siendo L igual a letras y N igual a numeros")
    p = input("Ingrese la patente con los siguientes formatos (LLLNNN o LLNNNLL):")
    letras = ['A', 'B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z']
    numeros = ['0','1','2','3','4','5','6','7','8','9']
    pat = len(p)
    while val == False:
    if pat == 6:
    if pat in letras and (pat!= 3 or pat !=4 or pat !=5):
    val=True
    if pat in numeros and (pat!=0 or pat!=0 or pat!=0):
    val=True
    while len(p) == 7:
    val= False
    if pat==7:
    if pat in letras and (pat !=3 or pat !=4 or pat !=5):
    val=True
    if pat in numeros and (pat !=0 or pat!=0 or pat !=0):
    val=True
    else:
    print('Error')
    p = input("Ingrese la patente con los siguientes formatos (LLLNNN o LLNNNLL):")
    val = False
    return p , val
    def patente_Automatica():

    letras = ['A', 'B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z']
    let1 = random.choice(letras)
    let2 = random.choice(letras)
    let3 = random.choice(letras)
    let4 = random.choice(letras)
    numeros = ['0','1','2','3','4','5','6','7','8','9']
    num1= random.choice(numeros)
    num2 = random.choice(numeros)
    num3 = random.choice(numeros)
    #FORMATO DE PATENTE VIEJA Y PATENTE NUEVA
    patentevieja = let1 + let2 + let3 + num1 + num2 + num3
    patentenueva = let1 + let2 + num1 + num2 + num3 + let3 + let4
    print("Patente nueva",patentenueva)
    print("patente vieja",patentevieja)

    def principal():
    print("Bienvendo a Rutaatlantica")
    print("1- Carga datos")
    print("2-PROCESAR PASADAS ")
    print("3-Ver resultados")
    print("4-Salir")
    menu = 0
    while menu != 4:
    menu = int(input("Ingrese una opcion: "))

    if menu == 1:
    cargadatos= datito()
    if menu == 2:
    inicio = datitos2(datito)

    if menu == 3:
    pass
    if menu == 4:
    break
    else:
    while menu <= 0 or menu >= 5:
    print("Esta mal viejo")
    menu = int(input("Ingrese una opcion,dale infrandotado: "))
    principal()

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

    What's the correct c++ way to put a uint32_t into a std::vector of uint8_t's?

    Posted: 10 Jun 2019 04:02 PM PDT

    Google leads me to believe I should be able to use reinterpret cast, but I cannot for the life of me get the syntax right.

    At this point, I don't care about endian-ness as I'll fix that when I understand the concept. FWIW, I will eventually want big endian as this is going over a socket.

    I can post some examples of what I've been trying, but I'm grasping at straws.

    If there are books I should read based on my question please share.

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

    HTML/PHP Trying to create a real-time bar graph to display Pi CPU temperature on a webpage

    Posted: 10 Jun 2019 09:40 AM PDT

    Hey everyone! Hope you're having a good day. I'm a beginner programmer and I'm trying to learn how to program in HTML and PHP. I've been creating random projects for myself to learn new things. The project I'm trying to do now is working with the raspberry pi to display its CPU temp data on a web server. I have all the data automatically being updated on the MySQL server. I've already created an HTML page that displays the MySQL data and updates the data on the page every 100ms with ajax and made a few start and stop buttons to send the CPU temp data to the MySQL server.

    <!DOCTYPE html> <html> <body> <button type="button" id="clickMe">CLICK ME TO RUN PHP</button> <button type="button" id="stopMe">CLICK ME TO STOP SCRIPT</button> <div class="result"></div> <script type="text/javascript" src="http://code.jquery.com/jquery-latest.min.js"></script> <script> function refresh_div() { jQuery.ajax({ url:'/test/grabData.php', type:'POST', success:function(results) { jQuery(".result").html(results); } }); } t = setInterval(refresh_div,100) $('#clickMe').click(function(){ $.ajax({ method: 'POST', url: '/test/startCPU.php', data: { 'ajax': true }, success: function(data) { $('#data').text(data); } }); }); $('#stopMe').click(function(){ $.ajax({ method: 'POST', url: '/test/stopCPU.php', data: { 'ajax': true }, success: function(data) { $('#data').text(data); } }); }); </script> </form> <div class="svg"></div> <svg width="70" height="200"> <rect width="70" height="100" style="fill:rgb(0,0,255);stroke-width:3;stroke:rgb(0,0,0)" /> </svg> </body> </html> 

    So what I'm trying to accomplish is to create a real-time vertical bar graph that displays a single bar showing the temperature of the CPU and I want it to update along with the data every 100ms or every second. I want it to look like an actual thermometer going up and down based on the raspberry pi's CPU temp without having to refresh the page manually.

    What I thought could work is to use an SVG rectangle and correlate the height of the rectangle to the CPU temp data. But I'm unable to figure out how to extract the CPU temp data from the grabData.php script that grabs the data from MySQL.

    I was also thinking I could put the SVG code in the grabData.php and have the CPU temp data equal to the height of the rectangle and then it would automatically update with the already existing ajax script. But when I put the SVG code in the PHP file the rectangle would not be displayed. I was only able to get SVG objects to appear while in a .html file.

    Those are the 2 solutions I can think of so far but have no idea how to implement them. Any help would be greatly appreciated. I would also love to hear some other solutions that I may not have thought of as well. Thank you!

    Here is the grabData.php file

    TValue is the temperature data

    <html> <body> <?php $username = "admin"; $password = "password"; $database = "DB_CPU"; $mysqli = new mysqli("localhost", $username, $password, $database); $query = "SELECT * FROM TAB_CPU ORDER BY ID DESC LIMIT 1"; if ($result = $mysqli->query($query)) { while ($row = $result->fetch_assoc()) { $field1name = $row["ID"]; $field2name = $row["TValue"]; $field3name = $row["Date"]; $field4name = $row["Time"]; } $result->free(); } echo "$field1name $field2name $field3name $field4name"; ?> </body> </html> 
    submitted by /u/seboss123
    [link] [comments]

    reversing a stack help in C

    Posted: 10 Jun 2019 03:34 PM PDT

    if (head->prev = NULL) { head=head->prev; reverse(head); } printf("%s", head->content); 

    Above's my code, but it doesn't seem to work, it keeps showing up the latest value that went in the stack. What am I doing wrong?

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

    How to make a FileSystem Web Interface

    Posted: 10 Jun 2019 08:39 AM PDT

    I have a local server that I can store files on. How would I make a website that accesses the files on that local server and allows users to upload, delete, search, and download files from that server. Any suggestions would be helpful along with links to a tutorial or something. Based on my current research, I was leaning towards using Node.js, but I'm open to anything.

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

    Are .tar.gz, .tar.bz2 files actually tar files + gz/bzip compression? I.e is the naming correct?

    Posted: 10 Jun 2019 01:52 PM PDT

    Android: Need help with updating a View using JobScheduler

    Posted: 10 Jun 2019 01:30 PM PDT

    I've a situation where I want to use job scheduler to run an async task every 15 minutes to fetch data from a web API. However, after it fetches the data, I want it to show in a list view. This is where I am having trouble. Up till now, I have had the list view as a static variable. But I noticed I am getting a warning that this causes a memory leak. I'm not sure how to go about avoiding this, since I do not seem to be able to pass the list view or an instance of the Main Activity to the job scheduler.

    Any advice would be greatly appreciated. Thank you

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

    Best Approach - Collecting user id/serial number off enterprise-enrolled devices

    Posted: 10 Jun 2019 12:47 PM PDT

    Hello, we are using GSuite to manage Chromebooks. Google offers no way to see what devices users are using (or have used). To fix this issue, I created an extension that does a postback to our internal server with their google userid, device serial number, and local IP address (makes our lives easier linking an IP to a device).

    It was something that came up in a meeting after a security issue came up and we couldn't track down the source. So I tossed together something really quick: I postback the information each time the user signs into the device. This has worked fine but for the first 2 hours of the day our web & mysql server gets pounded with requests because 2000-3000 users are signing in during that time frame (classes start, so 90% of the time it is all at the same time). We have around 30,000 users who are using Chromebooks.

    Now that it is summer I have time to properly set this up. However, I am not sure of a proper approach as I've never had to really set something up like this. I need to collect the device data ideally once everyday or when there is a change so that it can be searchable for administrators.

    So far I have experimented with Redis (which helps a LOT!). However, it's a good bit of work to get the data synced between MySQL/Redis. It also needs to be searchable right away so while this helps with performance I haven't found a way to do this correctly.

    The client will be running javascript (Chrome extension) that is pushed out via a policy. The server is running ASP.NET Core 2.2.

    What is the best approach? Thanks!

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

    IDEA Algorithm multiplication implementation in C

    Posted: 10 Jun 2019 08:04 AM PDT

    Hi, I need to implement the IDEA algorithm but I'm having trouble coding the multiplication 2^16+1.

    My key generation is all fine and I got the right vectors from the paper of the algorithm for the first round. But on the next rounds it goes crazy. I actually think it is due to overflow.

    I use unsigned short as my 16 bits type.
    If anyone had any algorithm or indications that might help me solve this, it would be really appreciated.

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

    Will big companies eventually adopt and primarily use languages like JS and Python, considering they can be used across the stack?

    Posted: 10 Jun 2019 02:30 AM PDT

    If yes, then please elaborate why you think so and if not please do the same. I'm a few months into a career as a front-end React developer and I'd love your perspective on this topic. Thanks in advance.

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

    Question about Antivirus

    Posted: 10 Jun 2019 09:57 AM PDT

    Hello I have an urgent question for a college job, I would like to know how much it would cost to do an antivirus (in terms of money) and hire a team also would cost (in terms of money)

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

    How hard would it be to create my own bash program?

    Posted: 10 Jun 2019 09:49 AM PDT

    I'm working on a project where we are communication with a bash program send commands and other specific things.

    And I was wondering how hard would it be to create my own program say "my-bash" that I can run on a terminal and it will behave just like a bash program?

    I say this because we are using some weird fixes to do our specific things and I think it would be easier If we made our own bash program.

    I would try to use some libraries so that I don't have to implement everything, the important thing is to implement our own communications for specific tasks. For example I will try to find some library to read the bash code.

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

    Im in danger, programmers help

    Posted: 10 Jun 2019 04:45 AM PDT

    I had a whole timeline written up but really this is all that's important. Full.story I guess if wanted but really it just makes me sick thinking about and im out of options. GF cheated I was moving on and she needed help. I did and regretted ever since. I lost everything. and she has had control of my phone remotely that I know since February but.i saw a log on her computer with my Mac address dating back to July 17' so if anyone can put what I found together somehow and make sense or know how to go about securing or removing my data from wherever the hell she has it stored. Please id be in debt to you. If you can seriously help I might not trust u at first but have a ton of screenshots i took from a point and shoot camera before they got erased.

    Know/Clues : (I have looked into most of these but because of this bs I haven't slept more then 2-3 hours a night since February 24th)

    Bootstraped my iPhone to her printer?

    Her phone bookmarks to github, random town in foreign country TripAdvisor page

    MY PHONE has bookmarks to github, stack exchange, robolux? Added bookmarks from travel sites. ( hid links into previous bookmarks. Kept title changed link)

    Remote viewing from Windows computer. Vnc?

    Hours of video and audio over the years of lies and threats. anytime she got really crazy I'd keep it in my pocket recording. Started getting deleted out of my camera roll. Then drive. By the time I noticed they were being deleted my computers were already destroyed so what was left couldn't put on a hard drive. And obviously online storage wasn't an option. She came at me 4 times with sharp construction file. bit into my shoulder like an apple. Everytime I pushed her harder away because I didn't want to hurt her. 4th time I pushed with my leg behind her so I could control the hand with blade so she didn't land on it. The fall cracked a leg bone and that was the most important thing to show I was acting in self defense. She has people from women's abuse organizations. Calling and stopping by the house and gives them an attitude that they are bothering her. It's all some sick game to her. I wouldn't spend a day in jail for anything I did to her. I'm more worried about what I didn't do and now can't prove.

    .pdfs, .aspx, on home screen desktop. Need bridge to open but won't display file. Computer viewing offline?

    Old Apple ID "forgot password" now has no recovery address or phone number. Now connected to Microsoft outlook/ Microsoft GitHub account buisness?

    Computer non stop popup for ^ sign in skydrive with "forgotten Apple ID"

    one point, othy , duo apps,

    Google docs has her resume multiple copies with different Google drive links hidden at bottom or second page. Look up feature?

    MY IPHONE has "daemon ,kernel, xobadfood etc x 50" repeating many times in logs she had in files app but it wasn't the normal files app besides the icon. on her phone as well as in Google chrome app third party licenses.

    MY FILES - shows desktop folder (0 files) can't be deleted but has 300 mb's. Shell?

    GPS spoofing - WeatherBug, carrot

    Settings options dissapear and appear randomly.

    If I search a certain term ie bootstrap, 0xbadfood" . It pops up as a song in Siri suggestions. Screenehot examples.

    My files, drive and docs get random files that say xmgraph and other things. But wont delete.

    My safari looks like safari but alittle off and search results are impossible to find relevant information. 0 when searching "hacked phone" "mobile monitoring" etc

    My wifi seems to work spotty unless her phone is open and her phone.is always on dnd.

    I've noticed anytime I leave when I come back she gets a notification from a random Instagram page at the exact time I get on the block.

    She gets notifications all day long from youtube, umbh apps, ig, FB . Travel/real estate apps + emails that are in a different language usually. she says is from when she lived abroad 6 years ago but won't delete.. also indeed and recipe apps... Tasks?

    Not sure if it's me logging into her Facebook is notifying her secretly. But she never seems to have anything notification wise other then events or birthdays on fb, when 2 months ago she was getting messages everyday. when I looked through her privacy settings it was set to only friends of friends see. Which goes as well for fb "groups" the ones pinned are all magick" "hermetic order" .also names of books she owns hardcopies of. marked on random pages but when I read them it just seems like a weird occult book with codewords that mean something but not much luck in my search. And also has iBooks that seem to be related or hiding somerhing that makes books she's downloaded pop up with codeword typed in.

    FTP WEATHER CALCULATOR IPA Impala studios

    She now has an Android and i keep seeing "UI system" on lock screen. So I figure she has the hidden menu but the ways I've seen on Google don't open it. she always keeps her fingers on the volume keys when I'm around. and if i walk into the room I can see light on her face change as the apps switch.

    I took MY PHONE to Apple they said since I did the lastest update and seems like an inside job. They can't do anything and suggest I forget about my Apple ID start a new one. And lose all my data.

    I know I seem crazy but my stuff is being monitored and something is being collected in a targeted fashion. and I could give a shit less about her info. But to be frank my iCloud has everything from the past 4 years. some txts to friends about incriminating stuff (smoke, ski) but we are all older now and shes threatened their careers so many times and took mine from me when I was helping her. I am begging for your help because I literally am spent. My eyes hurt and I don't sleep anymore. 20k down the toilet in 2-3 months. All my savings are gone. I don't have hope. But i have to somehow take security back and Everytime I feel I figure something out, I hit a wall again. Even non incriminating stuff . I don't want her having access remotely to all my stuff 24/7. Just the data overages alone is adding up to 130 a month and data is shut off unless I leave the house. But this isn't okay. I consider it blackmail and holding the only chance I have at continuing a job I created for myself and enjoy hostage. Today is my birthday. I woke up the same way as usual. Her screaming: I asked if she could please be quiet and let me sleep it's the one day ur supposed to be nice and u destroyed everything ive built. After 20 minutes of listening to her yelling now I'm in the driveway locked out of the house. The cops say cut my loses, "it's 2019 guys get locked away everyday for a spiteful lover who just has to say the right things" forget about it and just make new accounts.. problem is how far does this go. What can she use with all my information over all these years. Forgetting about these accounts could land me in jail for something I didn't do. Where's the line, what can she do. Who knows when the hell my stuff will be safe. Even if I destroyed hers it's obviously backed up to one of the clouds and prob multiple sites. But I'm done I have nothing left and my life went from finally getting to where I worked so hard to get for years. And it crumbled away in weeks trying to help an ex after she cheated. Scariest thing I've ever heard. With the serious dead eyed stare she gets when angry. "youll be locked up getting buttfucked forever when I execute my plan for you faggot" laughs "I gotta stop telling you this before you record me" laughs and smiles. If something doesn't happen soon I only see one option for me. Sorry if this is the wrong thread. I can't Google anymore if I tried. Please point me in the right direction. Sorry and thanks Benjie

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

    Distribution Questions

    Posted: 10 Jun 2019 07:29 AM PDT

    I am just about done writing a small bot for Minecraft and started to consider posting it online for free but wanted to have a section for donations if people like it. Two main questions with this idea.

    Are there any potential legality issues with posting a bot for a game like Minecraft? I already read into the licensing of the libraries I used and should be good on that front but am unsure about the legality of creating a bot for a game. In case it matters, the bot does not alter the code of Minecraft in any way.

    Also, are there any platforms for posting software like this for free but with an additional donations option?

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

    Would someone please be kind enough to write, and run, the following code?

    Posted: 10 Jun 2019 07:16 AM PDT

    (Suffice to say I don't know how to write code, and I apologise if I'm asking a lot.)

    Get a Random Number Generator to choose from 1-37.

    If it chooses 1-36, attempt it again. If 37, then 'x' and stop.

    The value of x is dependant on what attempt we're on. However there is a maximum of 107 attempts before stopping regardless. I've listed the values here, hopefully the formatting is ok: —

    (First column is attempt number, second column is x's value. Underneath this I've listed again just the values of x, in case that's easier for copy+paste purposes)

    001 035 002 034 003 033 004 032 005 031 006 030 007 029 008 028 009 027 010 026 011 025 012 024 013 023 014 022 015 021 016 020 017 019 018 018 019 017 020 016 021 015 022 014 023 013 024 012 025 011 026 010 027 009 028 008 029 007 030 006 031 005 032 004 033 003 034 002 035 001 036 035 037 033 038 031 039 029 040 027 041 025 042 023 043 021 044 019 045 017 046 015 047 013 048 011 049 009 050 007 051 005 052 003 053 001 054 069 055 065 056 061 057 057 058 053 059 049 060 045 061 041 062 037 063 033 064 029 065 025 066 021 067 017 068 013 069 009 070 005 071 001 072 137 073 129 074 121 075 113 076 105 077 097 078 089 079 081 080 073 081 065 082 057 083 049 084 041 085 033 086 025 087 017 088 009 089 001 090 273 091 257 092 241 093 225 094 209 095 193 096 177 097 161 098 145 099 129 100 113 101 097 102 081 103 065 104 049 105 033 106 017 107 001 

    Just x (respectively): —

    35

    34

    33

    32

    31

    30

    29

    28

    27

    26

    25

    24

    23

    22

    21

    20

    19

    18

    17

    16

    15

    14

    13

    12

    11

    10

    9

    8

    7

    6

    5

    4

    3

    2

    1

    35

    33

    31

    29

    27

    25

    23

    21

    19

    17

    15

    13

    11

    9

    7

    5

    3

    1

    69

    65

    61

    57

    53

    49

    45

    41

    37

    33

    29

    25

    21

    17

    13

    9

    5

    1

    137

    129

    121

    113

    105

    97

    89

    81

    73

    65

    57

    49

    41

    33

    25

    17

    9

    1

    273

    257

    241

    225

    209

    193

    177

    161

    145

    129

    113

    97

    81

    65

    49

    33

    17

    1

    If on attempt number 107 what the RNG chooses still isn't 37, then register a value of –575 and stop.

    So to clarify, one run will take anywhere from 1 to 107 attempts.

    Please then run this as many times as possible (ideally at least 30,000 times but I'll understand if you do fewer). Please also keep a running tally of the run outcomes (including the minus 575 where applicable. I reckon it should show up roughly 1 in 18 runs).

    Thank you so much if you take the time (and computational power) to do this.

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

    Noob Java questions

    Posted: 10 Jun 2019 01:02 AM PDT

    These are questions that I couldn't find an answer online, nor could more experienced CS majors answer.

    1. Say I'm creating a for loop like so:

    for (int i = n; i * i < Integer.MAX_VALUE; i *= n) or for (int i = n; i < Integer.MAX_VALUE / i; i *= n)

    In order to find the largest power of n that is smaller than Integer.MAX_VALUE.

    Mathematically speaking, i * i < Integer.MAX_VALUE and i < Integer.MAX_VALUE / i are equivalent. (Given i > 0 of course.) However, since bits allocated to an int is finite, my hypothesis is that is is better to write i < Integer.MAX_VALUE / i than to write i * i < Integer.MAX_VALUE to prevent overflow. Is that correct?

    1. Say I'm initializing a variable inside a while loop like so:

    while ( <BOOLEAN> ) { int i = 1; <DO CALCULATIONS WITH i>; }

    My understanding about declaring variables is that it reserves space in memory for the data to be stored. In this case, does the computer "declare" the variable i, in that it reserves space in memory, in each iteration of the loop, or only in the first iteration?

    1. The textbook I'm reading shows the following method for randomly shuffling the elements in an array, much like randomly shuffling a deck of cards:

    java int[] perm = new int[n]; for (int i = 0; i < n; i++) { int r = i + (int) (Math.random() * (n-i)); int t = perm[r]; perm[r] = perm[i]; perm[i] = t; }

    As I understand, it's choosing the 0th element, switching its position with a random element to its right. Then, it's choosing the 1st element, doing the same thing......

    First, is this method perfectly random? I don't know how to do the maths for this, but don't the elements towards the left have less chances to be shuffled?

    Second, is this method in any way preferable over choosing completely random two different elements and then swapping them an arbitrarily high number of times? For instance,

    java for (int i = 1; i < 1000; i++) { int a = (int) (Math.random() * n); int b = (int) (Math.random() * n); int temp = perm[a]; perm [a] = perm[b]; perm [b] = temp; }

    Or, the naive way to sorting by generating n number of Math.random() and then comparing their values, putting it through a sorting algorithm?

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

    My 10 yo son wants to learn programming. What does he need to begin and what is the best way to get him to learn?

    Posted: 10 Jun 2019 04:59 AM PDT

    I can teach him VBA but that's all I know. Does he need to attend a camp? Is there a weekly program that he can get involved with?

    Is this an expensive hobby? What does he need to start?

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

    How important do you think it is to have a science/tech/engineering/maths background as a programmer?

    Posted: 10 Jun 2019 04:50 AM PDT

    There was an interesting comment on HN (https://news.ycombinator.com/item?id=20142531) that got me thinking about the often assumed link between STEM education and programming as a career.

    Do you think it's important? Are there any other educational subjects or skills that you think are useful? 50% of my current team doesn't have a STEM degree, and it seems to work.

    Also, if you can be bothered, I created a short unscientific survey to try to get more data - https://delibes.typeform.com/to/Uix5hM

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

    Suggest websites that will help me with output tracing in C/C++

    Posted: 10 Jun 2019 04:38 AM PDT

    I have an interview coming up in which they will ask questions on Output Tracing in C/C++ (like this). I know that problem solving regularly helps answering them correctly, but I was wondering if there is any website where I could practice this. Suggest me websites to practice these kind of problems.

    Thanks in advance. Any kind of suggestions will be appreciated.

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

    No comments:

    Post a Comment