• Breaking News

    Sunday, February 4, 2018

    How to make spawning enemies in Unity? Ask Programming

    How to make spawning enemies in Unity? Ask Programming


    How to make spawning enemies in Unity?

    Posted: 04 Feb 2018 04:31 PM PST

    I creating a game in the unity program. The main character always jumps up and planes fly from the left and right (enemies). Does anyone know how to do it? I have no problem with creating a plane flying over the map, but the problem is its respawn in different places and in different quantities. Anyone can know how to do it?

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

    What language or tools are used to make trippy visualizations?

    Posted: 04 Feb 2018 08:40 PM PST

    Using page builders in Wordpress while learning web development

    Posted: 04 Feb 2018 08:29 PM PST

    Hey guys,

    I know that many hate page builders because they serve as replacement to real coding. I'm in the process of learning CSS/html/php and I know that there is no subtitute for real coding. On the other hand, I'm struggling a lot to customize simple things on web sites I'm building and would like to ask what you think about working with page builders while still learning to code. Do you think it's a good practice? In addition, and this is more of a technical question - Do page builders make it harder to add html/css customization? Theoretically, if I work with page builders and add my own code, I still can do whatever I want right?

    Thanks in advance!

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

    How to automate repetitive typing, shipping status checks?

    Posted: 04 Feb 2018 04:33 PM PST

    Hi there!

    I work in a logistics field and often find myself either typing out the same email for the umpteenth time with small variations, or checking an air cargo tracking (we ship small parcels worldwide) site for updates.

    My most used website is Air Canada Cargo where I'll be copy-pasting codes over and over again to check status periodically. Our work is extremely fast paced so I wanted to know if there's a way to automate this process so I can find out only when something changes (they have notifications enabled but the delay is really long compared to checking manually)

    Also we use Windows 10 but a web based login. I used to use a utility back in the day that would type out common sentences but it seems that it's no longer there. Any ideas how I can simplify this process to save my poor fingertips (and sanity)?

    Thanks in advance!

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

    Is there any actual helpful podcasts or audiobooks that will help me get better at coding?

    Posted: 04 Feb 2018 11:22 AM PST

    I am starting a near hour long commute to and from work and want to use the time to try to learn better coding. Javascript, react various front end as well as Node and databases. I am currently very novice in all of this.

    Is there an audio book or podcast that is actually useful in teaching and helping me get better at coding?

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

    How much time is worth investing in online courses and planned projects etc vs actually working on my own projects as a beginner using unity for game development.

    Posted: 04 Feb 2018 09:58 AM PST

    As stated in the title. Is it worth investing in going through a couple courses if im just to the point now where i could slowly start muddling through working on my game concepts in a 2d game using Unity.(im new to c# as well) Or even if the pace is at a slow crawl should i just go for it.

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

    [C] Removing case-sensitivity when searching for a word in a txt file.

    Posted: 04 Feb 2018 06:01 PM PST

    The following piece of code looks at a txt file for a particular word(text2repl) and capitalizes it. It works fine. The only change I need to make is to disable case sensitivity. So for example if the user searches for "chair" and the program finds "Chair", the word should be capitalized. Thank you for reading!

    int index; for(index=0; text2repl[index] != '\0'; index++){ /* Check if character in inputArray is lower Case*/ if(islower(text2repl[index])){ text2repl[index] = toupper(text2repl[index]); } else { text2repl[index] = text2repl[index]; } } text2repl[index] = '\0'; char buffer[MAX_LEN_SINGLE_LINE+2]; char *buff_ptr, *find_ptr; FILE *fp1, *fp2; size_t find_len = strlen(text2find); fp1 = fopen(fileOrig,"r"); fp2 = fopen(fileRepl,"w"); while(fgets(buffer,MAX_LEN_SINGLE_LINE+2,fp1)) { buff_ptr = buffer; while ((find_ptr = strstr(buff_ptr,text2find))) { while(buff_ptr < find_ptr) fputc((int)*buff_ptr++,fp2); fputs(text2repl,fp2); counter=counter+1; maincounter=maincounter+1; buff_ptr += find_len; } fputs(buff_ptr,fp2); } if (counter>0){ assignStruct(counter, path); filecounter=filecounter+1; } fclose(fp2); fclose(fp1); 
    submitted by /u/notyourdaddy
    [link] [comments]

    Need help with finding good literature/sources for "new stuff" in C

    Posted: 04 Feb 2018 01:37 PM PST

    I leaned C in the late 90s (basic stuff), when the books still called it ANSI C. After that i've switched to perl, php, java, python,... and as a hobby fell back to C on arduino/esp8266 etc., but my C knowledge has stayed at the 90's level. A few variables, loops, a pointer here and there, and that's it (and it's worked for me).

    So, now i'm looking for a good book for learning all the "new and advanced stuff" from c99 and later c11? Or any modern C11 book 'for programmers'?

    I started working with android, and used one of the "busy coders guide" android books, where i really liked that it skipped the "intro to programming" part (where first 3/4 of the book are "this is a variable", "a variable is like a pidgeon nest" blah blah, "this is a loop, it's like a ....", etc.) and just went into java/android specific stuff.

    So basically, if you had someone who knew "programming", but needed to learn C(11), what book/course would you recommend?

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

    Python3 midi tempo question

    Posted: 04 Feb 2018 04:34 PM PST

    Hi, I'm trying to use this python3-midi library to parse a midi file, which I then want to play manually with pygame.midi note_on and note_off commands.

    The problem I'm having is that the song isn't playing at the correct speed, and different songs seem to be off by different amounts. (Song1 was played a little too fast compared to playing the file directly, Song2 was played much too fast, etc)

    To start with I am reading the file using:

    import midi pattern = midi.read_midifile("my_file.mid") 

    The resolution of the midi file found in the header can be accessed with:

    pattern.resolution 

    When I print(pattern), Midi Tempo Events show up like this inside of a track:

    midi.SetTempoEvent(tick=0, data=[9, 87, 148]), midi.SetTempoEvent(tick=4545, data=[9, 112, 60]), .... 

    It is my understanding that the 3 bytes of data here actually represent a single number, so I'm using this to get an actual tempo value:

    tempo = int.from_bytes(a_set_tempo_event.data, 'big') 

    Finally I am calculating the fractions of a second per midi tick like so: (I think maybe the problem is in this formula? I'm new to midi and found this part a bit confusing)

    seconds_per_tick = (tempo / pattern resolution) / 1000000.0 

    Then to actually play the song I am using time.perf_counter() in a loop and getting the elapsed time between cycles

    elapsed_seconds = current_time - previous_time 

    And since I know the amount of time that passed, and the amount of time in each tick, I am increasing my current tick with

    current_tick += elapsed_seconds / seconds_per_tick 

    Here is a link to my actual code if it helps.

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

    Run two processes one at a time using system()

    Posted: 04 Feb 2018 03:33 PM PST

    include <stdio.h>

    include <stdlib.h>

    include <unistd.h>

    define N_REPS 50

    define DEFAULT_SLOWDOWN 10000

    int main(int argc, char * argv[]) { int i; int slow_down = DEFAULT_SLOWDOWN;

    if (argc == 1) { fprintf(stderr, "Usage: %s string [delay]\n", argv[0]); return 1; } if (argc >= 3) { slow_down = atoi(argv[2]); }

    for (i = 0; i < N_REPS; i++) { char * cp = argv[1];

     while (*cp) { printf("%c", *cp++); fflush(stdout); usleep(random() % slow_down); } usleep(5000); 

    } return EXIT_SUCCESS; }

    -------------------------------------------------GIVEN INFORMATION:----------------------------------------------------- If you run two "lab2b" processes concurrently with the command: lab2b abcd & foo WXYZ, the output is: aWXbYcZWdXaYZWXbYcZWdXaYZbWcXdYZabWcXdYaZbWcXdYaZbWcXdYaZbWcdXaYbZcWXdYaZWbXcYZdWaXYbZcWXdYaZWbXcYZdWaXYbZcWXdYaZWbXYcZdWXaYbZWcXdYaZWbXcYZdWaXYZWXYZWXYZWXYZWXY

    -------------------------------------------------------OBJECTIVE------------------------------------------------------------ Modify the code to have output look like this: WXYZabcdWXYZabcdWXYZabcdWXYZabcdWXYZabcdabcdWXYZabcd
    -----------------------------------------------------------HINT--------------------------------------------------------------- To achieve this, only one process at a time should be able to perform the "while(*cp)" loop. You have to identify a "critical section" that only one process at a time should be allowed to execute. Use while(system("mkdir junk") != 0); and system("rmdir junk");to achieve this.

    --------------------------------------------------------QUESTION------------------------------------------------------------ How to use "while(system("mkdir junk") != 0);" to create a critical section? Thanks.

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

    Learning java

    Posted: 04 Feb 2018 03:20 PM PST

    Hy there

    I was wondering to learn java . I already have knowladge in coding via C# and i would say i'm on intermediate level. Is there any good tutorial series on youtube or on any other platform that you have profited from ? i appriciate every help :)

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

    Question about 'The Pragmatic Programmer' book

    Posted: 04 Feb 2018 11:46 AM PST

    Automated Youtube Search - HELP

    Posted: 04 Feb 2018 10:59 AM PST

    I would like to create a webpage hosting a single youtube video, with a refresh button. When selected, the refresh button would conduct a youtube search, and populate the first video on said webpage. The search would entail "IMG ----" followed by a randomly generated 4 digit number.

    IMG 8467

    Any help would be appreciated, I have little coding experience beyond HTML.

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

    Simple Netbeans/Java question

    Posted: 04 Feb 2018 09:41 AM PST

    Hey guys, so I just started taking a Java programming class and I'm having trouble getting started. I've read all of my professor's instructions, but I can't seem to get this import command to work (and I can't ask my professor since I joined the class a week late and the due date is tonight, midnight).

    As the title states, I'm using Netbeans IDE 8.2 and the JDK kit 8 update 161 (if those matter). The code error I'm having trouble with is:

    import java.util.Scanner; 

    It's saying that it's an unused import. Any help would be greatly appreciated, and any additional information you would need to help I'll provide!

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

    No idea what to major into

    Posted: 04 Feb 2018 03:53 AM PST

    Hello guys, I need some help in making a decision. I'm trying to decide whether to go into Computer Science or to go into Software Engineering. I'm interested in both Artificial Intelligence development as well as Video Game Development. My university doesn't offer either of these courses that I want to learn. Which should I go for if I'd like to get into those two at some point?

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

    Anyone familiar with FAST ASYNC protocol used by older radios.

    Posted: 03 Feb 2018 10:28 PM PST

    I can't find any documentation after weeks of googling(while selecting years prior to 2008, 2005, etc etc etc) on this protocol and how and if it manipulates data.

    New radios don't have it and we've been trying for months to figure out why it's not passing data as intended, when PLCs are sending out plain ASIC data.

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

    [C] Multi-thread memory management

    Posted: 04 Feb 2018 02:10 AM PST

    Hello,

    I am trying to practice some multi-threaded programming in C and was trying the following exercise: spawning several threads from within a for loop, each of them printing the iteration of the for loop that spawned them.

    My question is if I correctly handled passing the integer iteration counter i to the threads and also dealing with the memory associated with it. I know that another way of doing it would have been by saving all the iteration counters within an array of size NUM_THREADS and then, on pthread_create, just pass in the address of the corresponding element from that array, but I felt that to be a bit of a waste and wanted to exercise the good practices of memory management as well.

    I know that this might not be a big deal, but wanted to get some opinions on it as well. Thanks!

    #include <cstdio> #include <pthread.h> #include <stdlib.h> #include <unistd.h> #define NUM_THREADS 5 void *foo(void *arg) { int *p = (int*)arg; int n = *p; // Sleep exponentially, to see the order usleep(n * n * 100 * 1000); printf("Thread number %d\n", n); free(p); // free memory allocated through malloc return 0; } int main() { pthread_t tid[NUM_THREADS]; int i; for (i = 0; i < NUM_THREADS; i++) { int *n = (int*)malloc(sizeof(*n)); // will free this memory from within each thread *n = i; pthread_create(&tid[i], NULL, foo, n); } for (i = 0; i < NUM_THREADS; i++) { pthread_join(tid[i], NULL); } return 0; } 
    submitted by /u/glacialOwl
    [link] [comments]

    [JavaScript/HTML] Buttons

    Posted: 04 Feb 2018 01:40 AM PST

    I'm doing an assignment and for the life of me I've been trying to get this to work, but can't figure out how to do it, or if I'm just being completely stupid.

    So we just finished touching base on CSS, and with that I knew how to save the code on the CSS and bring it up on the HTML page.

    Is it the same concept with JavaScript?

    For the life of me I can't figure out how to make the damn buttons work.


    <!DOCTYPE html> 

    <html> <head> <body> <script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.1.0/jquery.min.js"></script> <title>Jiggle Into JavaScript</title> <button id="Blue" onclick="Blue()">Blue</button> <button id="Grow" onclick="Grow()">Grow</button> <button id="Fade" onclick="Fade()">Fade</button> <button id="Reset" onclick="Reset()">Reset</button> <div id="box" style="height:150px; width:150px; background-color:orange; margin:25px"></div> <script>

     document.getElementById("Blue").addEventListener("click", function Blue(){ document.getElementById("box").style.backgroundColor = "blue"; }); document.getElementById("Grow").addEventListener("click", function Grow(){ document.getElementById("box").style.height = "250px"; }); document.getElementById("Fade").addEventListener("click", function Fade(){ document.getElementById("box").style.opacity = "0.5"; }); document.getElementById("Reset").addEventListener("click", function Reset(){ document.getElementById("box").style.height = "150px"; }); document.getElementById("Reset").addEventListener("click", function Reset(){ document.getElementById("box").style.opacity = "1"; }); 

    document.getElementById("Reset").addEventListener("click", function Reset(){

     document.getElementById("box").style.backgroundColor = "orange"; }); 

    </script> </body> </html>

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

    Conflicted between 2 choices..

    Posted: 04 Feb 2018 02:47 AM PST

    No comments:

    Post a Comment