• Breaking News

    Saturday, November 25, 2017

    Help learning computer organization and architecture Ask Programming

    Help learning computer organization and architecture Ask Programming


    Help learning computer organization and architecture

    Posted: 25 Nov 2017 01:17 PM PST

    I am taking computer organization and architecture at my university, and I am trying to get through the homework, but about a third of the questions have content I can't find in the book, let alone in the section that it pertains to. Would anyone know where I could better research this part, so I can answer the questions? I am not sure what to look up to find help, so here are some sample questions. Thanks!

    https://pastebin.com/S0LkSLUb

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

    Is there a program/script that can aid in generating a dynamic resume?

    Posted: 25 Nov 2017 02:57 PM PST

    Is there a script or program... or even plug-in for something like LaTeX that can basically allow me to fill in all the basic information for a resume (name, contact, education, past work experience)....

    THEN somehow add a bunch of sections (ex: general skills, technical skills, certifications etc.) that can be "flipped" on or off by adding whatever modifier or checkbox/element. This way you can add a bunch of skills to a list separated by the sections you want, then depending on the job, you can simply check the ones that are relevant to a given job. This way you can simply omit or include certain skills that you may have based on the position you are currently applying for.

    All in the spirit of efficient and uncluttered Resumes.

    If anyone has any idea as to how this could be done or if something exists that can be used to perform this kind of resume building... This novice would love to know.

    Thanks everyone.

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

    Problems with NodeJS image cropping library. I'm definitely doing something wrong. Can anyone help me?

    Posted: 25 Nov 2017 02:54 PM PST

    I'm using the react-image-crop library but for some reason I'm having a hard time with cropping the image. I've tried calling a "child" component method to crop the image and I've tried passing the info to the "parent" component to crop the image but neither seem to work, especially when trying to use ref (I get something about not using ref without an owner but I have no clue what that means). I've created a gist to try to show what I'm currently working with. I'm a full stack software engineer that uses LAMP stack for my job but self taught MERN/MEAN stack so any suggestions or advice would be greatly appreciated as I'm still learning. Thanks!

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

    Ask: Where to start with a web scraper?

    Posted: 25 Nov 2017 02:04 PM PST

    I'm looking for help building a program for my friend. He needs it to dig through a number of college websites to get to the clinical psychology major home page. Once at the home page the program should search the available course for keyword e.g.(spirit) and see if the class is required. So to sum it up the end user would input some .edu urls and keywords. The output should be a simple table saying how many courses in the clinical psychology major have the keywords. I've been messing around with scrapy but I don't know if it's the right way to go. Anyone help would be greatly appreciated, I just want to know if I'm going in the right direction or if there is a program out there that can do what is specified. EDIT: Here is the end game sheet he is suppose to fill out if that helps https://imgur.com/a/ZAJ78

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

    Do a programming language evolve?

    Posted: 25 Nov 2017 01:30 PM PST

    If I pick up a 10 year old book on how to program in java, will the code work on todays modern computers and also in the future?

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

    Simple java methods help

    Posted: 25 Nov 2017 09:02 AM PST

    I need help with the methods of java. I am trying to answer the question

    How would you call that method passing 5 into x and storing the return value into a variable named profits.

    would it be

    static void profits(int x) { System.out.print("profits"); System.out.println("x"); } int x; x = 3; profits(x +5);

    I feel like i am close.

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

    Use queue to go through a matrix (not a maze)

    Posted: 25 Nov 2017 12:42 PM PST

    Hello!

    I've been an assigment of using a queue to solve the following problem:

    Imagine you have an two dimensional array of integers representing apples. 1 is an ordinary apple. 2 is a rotten apple. 0 is absence of apple

    Any rotten apple can its neighbouring(lfet right top bottom) apples rotten.

    e.g

    1 1 1 ....................... 1 2 1

    1 2 1 after one turn. => 2 2 2

    1 1 1 ....................... 1 2 1

    I need to use queue to determine after how many turns all the apples will become rotten.

    I read quite a lot about using queues to search in breadth, but sadly couldn't apply it to my task.

    Any help would be appreciated!

    EDIT: Using the ideas from /u/reddilada (and 7Geordi was probably going in that direction too) I completed my assigment. If anyone for any reason is interested in the code PM me

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

    Human Body Physical Simulation Interacting With 3D Objects Project

    Posted: 25 Nov 2017 12:28 PM PST

    So I'm not a SWE, but I got my undergrad in CS. I had a weird idea for a project and I need to get some advice on tools before I start programming and figure out if it's even a realistic project.

    At the core of this project, I need to simulate how a human body rests on top of a 3D object. I need advice on software that would be best to use for this.

    This program will (1) generate a 3D object, (2) simulate how a human body rests on top of this object in the context of normal physics and gravity, (3) pull some data from this simulation, (I.E. did this person fall off, are they balanced, some kind of positioning data, weight distribution, etc.) and (4) automate this process for high numbers of repetition with different objects.

    I know absolutely nothing about 3D modeling software or their APIs. Maybe somebody has a suggestion on a free tool that can help me achieve the above steps? Maybe somebody else knows where I can access a human body model that's ready for use? Maybe somebody can identify challenging obstacles I haven't considered?

    Thanks for your help.

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

    Need advice transitioning to second job and interview prep

    Posted: 25 Nov 2017 12:22 PM PST

    Currently a contracted front-end (react) engineer at Facebook for ~8 months. Contract is up at the end of the year. This is my first 'real' job.

    I am aiming for a full-time job at FB/Google/similar, but I am not at all prepared for interviews. I do not learn as well without structure, and my last interview cycle went not that great due to my lack of study structure. I am considering doing Interview Kickstart which is a 2 month part-time program in Sunnyvale. However, the first open slot isn't until February. Money is not a factor.

    I have a Full-Time interview at Facebook lined up for whenever I am ready, but I don't want to blow this opportunity. I am happy to take my time and be as prepared as possible but I also fear being out of work for like 4 month is going to be a drag.

    The other option would be to start interviewing at smaller places in December, not being ready to nail the interviews and hope something sticks. Then do the interview prep while I work at this new job, interview where I really want and then leave the smaller job. Maybe stay a year at the small place.

    What would you do? I have to put a deposit down by Monday.

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

    Trouble with Youtube's JavaScript API

    Posted: 25 Nov 2017 11:39 AM PST

    As the title said, I'm having some trouble writing a javascript code that is supposed to play videos in a random order that I currently have stored in an array. There is also supposed to be a button that the user can press which will log a timestamp of how far into the video they were when the button was pressed. As of right now I'm having three problems. 1. When the button is pressed the data is not added to the array I'm using to store the timestamps. 2. I need to export the data to a CSV once all of the videos have been completed. Unfortunately, I cannot even get a blank CSV to be exported unless I swap out the export code with the code used to select a new video and play it. 3. If I do try and just export what I do have to the CSV, no data period will be on the CSV. This was working earlier and I haven't changed the part of the code related to the CSV so I don't know what happened there. My code is as follows: <html> <body> <!-- 1. The <iframe> (and video player) will replace this <div> tag. --> <div id="player"></div>

    <script> //Global variable declarations var id = prompt("Please enter your participant number", ""); let timeIsSet = false; var video1 = {videoID:1, timestamps:[], url:"IMkBE-asHfk"}; var video2 = {videoID:2, timestamps:[], url:"QbeBhdjW1_w"}; var video3 = {videoID:3, timestamps:[], url:"KdhSxMgpJL8"}; var video4 = {videoID:4, timestamps:[], url:"CLuwFhPLJ9Q"}; var video5 = {videoID:5, timestamps:[], url:"Ed1eEhS-fkA"}; var video6 = {videoID:6, timestamps:[], url: "jrJ5WvUec94"}; var video7 = {videoID:7, timestamps:[], url: "7n_1zsCVBxw"}; var video8 = {videoID:8, timestamps:[], url: "1Sqi-AvRiC8"}; var video9 = {videoID:9, timestamps:[], url: "LKP-vZvjbh8"}; var video10 = {videoID:10, timestamps:[], url: "RxJab4dZn-U"}; var videoList = [video1, video2, video3, video4, video5, video6, video7, video8, video9, video10]; var watchedList = [[],[]]; let videosLeft = videoList.length; let currentVideo = -1 //selects a random video function selectVideo() { return Math.floor(Math.random() * videosLeft) } currentVideo = selectVideo() selectVideo() //2. This code loads the IFrame Player API code asynchronously. var tag = document.createElement('script'); tag.src = "https://www.youtube.com/iframe_api"; var firstScriptTag = document.getElementsByTagName('script')[0]; firstScriptTag.parentNode.insertBefore(tag, firstScriptTag); // 3. This function creates an <iframe> (and YouTube player) // after the API code downloads. var player; function onYouTubeIframeAPIReady() { player = new YT.Player('player', { height: '390', width: '640', videoId: videoList[currentVideo].url, events: { 'onReady': onPlayerReady, 'onStateChange': onPlayerStateChange } }); } // 4. The API will call this function when the video player is ready. function onPlayerReady(event) { event.target.playVideo(); } // 5. load another video, you can perform your random code here. function onPlayerStateChange(event) { if (videosLeft <= 0 && event.data === 0) { dataPush() dataExport() } else if (videosLeft > 0 && event.data === 0) { dataPush() videoList.splice(currentVideo,1); videosLeft -= 1; currentVideo = selectVideo(); player.loadVideoById(videoList[currentVideo].url); } } function dataPush() { watchedList[0].push(string(currentVideo.id)); watchedList[0].push("/") watchedList[1].push(currentVideo.timestamps.toString()) watchedList[1].push("/") } function dataExport() { let csvContent = "data:text/csv;charset=utf-8,"; watchedList.forEach(function(rowArray){ let row = rowArray.join(","); csvContent += row + "\r\n"; // add carriage return }); var encodedUri = encodeURI(csvContent); var link = document.createElement("a"); link.setAttribute("href", encodedUri); link.setAttribute("download", id+".csv"); document.body.appendChild(link); // Required for FF link.click(); // This will download the data file named "my_data.csv". } //gets a timestamp and adds it to video#.timestamp function buttonPress() { let timestamp = player.getCurrentTime() videoList[currentVideo].timestamps.push(string(timestamp)) }; </script> <button onclick="buttonPress()">Click me</button> </body> </html> 

    Any help would be very much appreciated, I couldn't find anything on stack exchange or any other programming forums that helped me, and I have no idea what to do next.

    edit: formating

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

    Java multi client messenger

    Posted: 25 Nov 2017 11:37 AM PST

    How can I expand my app to make a multi client tcp messenger? So that i could make any number of clients that exchange information. Generally my assignment is to make clients that exchange time between themselves.

    I have problems with managing ports, how can clients know about each other in network? Everyone should have an array with ports of other clients that updates itself from time to time and than sends messages on it?

    import java.io.BufferedReader; import java.io.BufferedWriter; import java.io.IOException; import java.io.InputStreamReader; import java.io.OutputStreamWriter; import java.net.ServerSocket; import java.net.Socket; import java.net.UnknownHostException; public class Node { public static void main(String[] args) throws IOException { startServer(); startSender(); } public static void startSender() { (new Thread() { @Override public void run() { try { String serverName = "localhost"; int serverPort = 60011; Socket clientSocket = new Socket(serverName, serverPort); BufferedWriter bw = new BufferedWriter( new OutputStreamWriter(clientSocket.getOutputStream())); while (true) { bw.write("time"); bw.newLine(); bw.flush(); //SYNC EVERY: //1 sec = 1000 ms Thread.sleep(5000); } } catch (UnknownHostException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } catch (InterruptedException e) { e.printStackTrace(); } } }).start(); } public static void startServer() { (new Thread() { @Override public void run() { ServerSocket welcomeSocket; try { //READER welcomeSocket = new ServerSocket(60011); Socket s = welcomeSocket.accept(); BufferedReader br = new BufferedReader( new InputStreamReader(s.getInputStream())); String line = null; //while reader line is not empty while ((line = br.readLine()) != null) { //CLK - show time if (line.equals("time")) { System.out.println("asking for time!"); long timer = System.currentTimeMillis(); System.out.println("Time: " + timer); //String strTimer = Long.toString(timer); } } } catch (IOException e) { e.printStackTrace(); } } }).start(); } } 
    submitted by /u/mikaz0
    [link] [comments]

    What techniques do you use when thinking about ways to model subtle or complicated data relationships?

    Posted: 25 Nov 2017 12:59 AM PST

    Ask: Want to build CrossBrowserTesting /Litmus/EOA clone, where to start?

    Posted: 25 Nov 2017 09:42 AM PST

    I have a need to do screenshots on actual devices, not only for landing pages (CrossBrowserTesting) but for email clients (Litmus/Email on Acid). CrossBrowserTesting - $1,500 per month. Litmus - Withdrawing their Preview API. Now $79 per user per month. EmailOnAcid - $1.60 per screenshot.

    These are really unsustainable to support a service that I am developing.

    So I am looking at the possibility of building my own infrastructure/software to support my own screenshot service.

    I just want to get this out of the way, my focus is not on ChromeDP and I don't wish to use it in terms of emulation via user agents. What I want to do is focus on real hardware, os and browser/email clients.

    Now with that in mind, what do I need?

    1) Real devices? Ios, Android, etc.

    2) Server cluster? Array of VMs (Windows/MacOS/Linux)

    3) Browsers - (Chrome, IE/Edge, Firefox, Opera, Safari)

    4) Email Clients - Respective to their OS

    5) Email Accounts (Hotmail/Outlook, Gmail, etc)

    If there are any other components needed let me know.

    But here is where I fall short. What provides the orchestration here? Lets say I have this cluster up and running, connected to 50+ mobile devices. Also multiples of browsers running on each the OS's, with browsers and email clients running in foreground/background...

    What is the mechanism that allows me to submit either a URL or waits for a specific email and then renders all the screenshots and returns them to a user?

    Would love to hear if there are any opensource projects doing something similar here.

    If you have actual experience in building something like this from the ground up. I would very much like to hear from you.

    Finally, and I suppose this is the most important one. What are the gotchas in maintaining this type of service? Where are the pain-points or challenges to getting this up and running?

    For example. Previewmyemail.com was doing unlimited screenshots for a range of email clients for $248 per month and then has gone offline. They stopped updating their Twitter in May and their Facebook no longer exists. I wonder why?

    Thanks for any insights!


    Edit:

    Is this one way they are doing it? By writing a printer driver and saving the contents to a png? https://www.peernet.com/how-to-convert-email-to-tiff/

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

    [Java] Running into issues making a GUI personal planner

    Posted: 25 Nov 2017 08:47 AM PST

    I'm not 100% sure this is the place I should be posting, but I am slightly desperate.

    I'm doing a project for school, and I decided to make a personal planner for one of my friends using Java, with GUI components. I wanted to get some outside thoughts on how other people(likely miles more experienced than I) would tackle it.

    The biggest issues I'm facing right now are the implementation of real-time events into the program and how the personal planner would look.

    For real time events, I'm referring to the fact that a user can create a task to do, assign it a due date, and then the program will pop up reminders based on the proximity of the due date. How would I go about doing this?

    And the display of the personal planner. I'm required to have a weekly and monthly view, a monthly view where

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

    Using VScrollbar widget to scroll 2 text views in Monodevelop, C#

    Posted: 25 Nov 2017 07:30 AM PST

    Say I have 2 text views TextView1 and TextView2 which are inside GtkScrolledWindow1 and GtkScrolledWindow2 respectively. And then I have a vscrollbar1.

    What signals, events, properties do I have to use so that When I scroll, vscrollbar1 it scrolls the 2 text views simultaneously. Monodevelop's documentation isn't really as friendly as I'd hoped it would be and I'm just starting out.

    I tried posting in stackoverflow but no one has answered me yet. I really need help.

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

    GIF stops my webpage from loading ��??

    Posted: 25 Nov 2017 03:43 AM PST

    I am developing a webpage that I'm so far very happy with. But unfortunately I ran into an extremely strange issue.

    I have a div that contains 2 GIFs.

    These GIFs are styled so that one is above the other. I also set a overflow: hidden property to the div so that only the one above shows but the one at the bottom is out of the div borders, so it doesn't show

    What I wanted to do was that when I hover over the div with the mouse, the first gif moves up and out of the div's top border ( so now it doesn't show) and the other div also moves up to become in the div (so now it shows and the other one doesn't)

    I was able to create a code that successfully does this without trouble, but only onclick.

    If i make it an onmouseover event, it no longer works. So if i have my <img> tag and i add onmouseover="changeGIF('tennis')" it just stops working. Here is how the whole thing looks like:

    <div id="animate" onmouseover="changeGIF('tennis')"> <img id="tennis" src="C:\Users\Myownproject\graphics\videos\giphy.gif"> <img id="basketball" src="C:\Users\Myownproject\graphics\videos\basketball.gif"> </div> 

    It just doesn't work, i.e: It doesn't detect that the mouse has moved over to the div. Also if i add that onmouseover attribute to any other element on the page, or if i replace the GIFs with text or something like that, it works again.

    It seems to me that the GIFS are the problem.

    If i make my JS code run when the page containing GIFS loads ( I don't actually have that, only added it temporary for testing) it doesn't actually run at all. But If I make remove the GIFS the JS runs perfectly fine

    Are the GIFS stopping the page from fully rendering. Or is the answer much simpler and I can't see it?

    P.S: I guess I sort of solved the issue by putting another div of the same size on top of this div, and then setting the onmouseover attribute to it. But that ruins the layout on my website completley!

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

    Something wrong with my code.

    Posted: 25 Nov 2017 07:15 AM PST

    Hi! Beginner here, i'm designing a program that converts temperatures. Something is wrong however, when i run the program, and it asks to enter my temperature in my preferred unit(so it can be converted), i keep getting 0 as my value. Could someone please help me identify the mistake. Here's the code:

    include <iostream>

    using namespace std;

    float convertF() { float Celsius; float Fahrenheit; Celsius = ((Fahrenheit - 32) * 5) / 9; return Celsius; } float convertC() { float Celsius; float Fahrenheit; Fahrenheit = (((Celsius * 9) / 5) + 32); return Fahrenheit; }

    int main() { float Celsius; float Fahrenheit; unsigned short choice; cout << "Welcome to the temperature converter.\n"; cout << "Please type '1' for Celsius to Fahrenheit conversion." << endl; cout << "Or, type '2' for Fahrenheit to Celsius conversion." << endl; cin >> choice;

    switch (choice) { case 1: cout<<"Please enter your temp in Celsius"<<endl; cin>>Celsius; convertC(); cout << "\n"; cout << "Computing...\n\n"; cout << "The temperature in Fahrenheit is " << Fahrenheit << ".\n"; cout << "Press any key to terminate the program." << endl; cout << endl; break; 

    case 2:

    cout << "Please enter your temperature in Fahrenheit.\n"; cin >> Fahrenheit; convertF(); cout << "\n"; cout << "Computing...\n\n"; cout << "The temperature in Celsius is " << Celsius << ".\n"; cout << "Press any key to terminate the program." << endl; cout << endl; break; efault: cout << "That is not an option!" << endl; cout << "Please close the program and try again." << endl; break; } return 0; 

    }

    Thanks!

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

    [Swift] Trying to get data to JSONSerialize

    Posted: 25 Nov 2017 07:07 AM PST

    UPDATE: SOLVED

    I am getting this weird message:

    Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'Invalid type in JSON write (OS_dispatch_data)

    I have tried looking up what OS_dispatch_data is but have found no solution.

    Thank you!

    My Code:

     URLSession.shared.dataTask(with: request) { (data, response, error) in do { let y = String(data: data!, encoding: String.Encoding.utf8) print(y) let a = try JSONSerialization.aws_data(withJSONObject: data!, options: []) } catch { print(error.localizedDescription) } }.resume() 

    My JSON i.e. print(y):

    Optional("{\"a\": 1, \"b\": 2}") 

    UPDATE: SOLVED

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

    Java question I am struggling with

    Posted: 25 Nov 2017 10:16 AM PST

    Hi I am done a lab where we had to randomize a card deck The first questions is 1a.

    Draw the memory diagram for each of the following pieces Card c = new Card(12,3);

    would I just say faceValue = 12
    suit = 3 OR faceValue = King
    suit = Clubs

    The second part of the question is Deck d = new

    I have no idea what for this part.

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

    How do I reuse an Access Token using PHP (in WordPress)?

    Posted: 25 Nov 2017 05:56 AM PST

    Hello everyone

    I'm currently making a PHP script for a friend of mine, which he will use on his Wordpress website. The script gets real-time weather data from an API. I'm able to get this data from this API. First, I request an Access token, next I can use this key to request the data I need and this all works. Whenever the page loads/refreshes, the script requests an Access token and next the data.

    However, the owner of the API has asked me to keep reusing the same access token until the token is no longer valid. He asked me to do this so that the script doesn't overload the API. The Access Token should remain valid for 24 hours. I am able to put the access token in a variable, but I need to be able to use this variable for all the loads/requests for the next 24 hours. I believe the API uses OAUTH aunthentication. So my question to you is: How do I store this value/variable so that it can be used for all requests, for multiple clients, for the next 24 hours? Keep in mind that I need this script to work on a WordPress website.

    Any input would be greatly appreciated since I'm not that experienced with PHP. If you want more information, feel free to ask.

    Thanks in advance!

    The API used is the Weather Hexiron API, but you won't find a lot about that online since their website is still under construction.

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

    Programming a keylogging malware (With a twist)?

    Posted: 25 Nov 2017 12:21 PM PST

    Hello,

    Please don't judge me for this question as I do not plan to use this for nefarious purposes. I only want to know if it is possible to use a boilerplate of a malware written in Python used for keylogging and engineer it to log peoples credit card info and send it to a remote server if placed on a POS system. Like I said, I'm only curious for educational purposes. I plan to make it and then see how vulnerable certain systems are to the malware. I can post the code if needed I'm just in a hurry right now.

    Thanks,

    James

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

    I can't install git for some reason.

    Posted: 25 Nov 2017 03:18 AM PST

    Can someone help me with this? I don't really know where else to post.

    I've been trying to install git for a while now, but for some reason it keeps failing.

    I'm running Linux Mint Cinnamon 64-bit.

    https://i.imgur.com/giwOFqk.png

    I ran sudo apt-get update several times already, and it also says that some files are not downloaded. I don't know what else to do.

    EDIT: Thank you guys for your answers, but it still doesn't work :c can someone at least direct me to some other help forums so that I can post there too?

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

    What code is battleforthenet using to make phone calls to congress?

    Posted: 25 Nov 2017 02:45 AM PST

    You enter your phone number, and then they call your phone and when you answer, the phone is ringing and the congressman's voicemail picks up. I want to make this work for my LOCAL politician, is there a company or site that can do this? Or what is the code?

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

    No comments:

    Post a Comment