• Breaking News

    Wednesday, March 13, 2019

    Does anyone else walk around/coffee/rubber duck debug 30%+ of the day? Ask Programming

    Does anyone else walk around/coffee/rubber duck debug 30%+ of the day? Ask Programming


    Does anyone else walk around/coffee/rubber duck debug 30%+ of the day?

    Posted: 13 Mar 2019 07:38 AM PDT

    I find myself making little new progress staring at my screen.

    I find myself walking around, looking at the floor, talking to myself through the steps of my code.

    After my walk, I write down pseudo code, and I get back to programming.

    Wondering if I'm an oddball or if others do this. Did you tell your coworkers?

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

    Can someone ELI5 what a Java servlet is?

    Posted: 13 Mar 2019 02:55 PM PDT

    I made one following a tutorial, but I'm super new to Java and coding in general and I don't feel like I have basic concepts down enough to build on.

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

    Can someone please point me in the right direction about what I'm doing wrong? [JavaScript]

    Posted: 13 Mar 2019 08:43 PM PDT

    I'm trying to make a Firefox extension that will add a context menu with options to search through my custom search engine "rabbit".

    Each option should append as a pre-fix to the selected text and then search rabbit for it. For example, if I highlight "reddit" with my mouse then right click and select "abc search" it should search rabbit for "abc reddit".

    I have gotten as far as making the context menu's work and the search engine work. The problem is when I highlight "reddit" and click search, it only returns "abc" and not "abc reddit".

    Can anyone please give me an idea of how to proceed from here?

    //

    "use strict"; function getSelectionText() { var text = ""; if (window.getSelection) { text = window.getSelection().toString(); } return text; } const selectionText = getSelectionText(); function onCreated() { if (browser.runtime.lastError) { console.log("error creating item:" + browser.runtime.lastError); } else { console.log("item created successfully"); } } browser.menus.create({ id: "xyz-search", type: "radio", title: "XYZ search", contexts: ["selection"], checked: false }, onCreated); browser.menus.create({ id: "abc-search", type: "radio", title: "ABC search", contexts: ["selection"], checked: false }, onCreated); browser.menus.onClicked.addListener(function(info) { if (info.menuItemId == "xyz-search") { browser.search.search({ query: "xyz" + selectionText, engine: "rabbit" }); } else if (info.menuItemId == "abc-search") { browser.search.search({ query: "abc" + selectionText, engine: "rabbit" }); } browser.browserAction.onClicked.addListener() }); 

    //

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

    how can I add Google's updated Noto emoji to my Macbook?

    Posted: 13 Mar 2019 07:02 PM PDT

    I found an emoji file that worked to replace the default Apple emoji last year, but it was an older version and some emoji are missing.

    Does anyone have a working file in the correct format to be installed and readable on Mac? The latest .tif file can be found on Github here, but it has to be converted to work on Macs I believe.

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

    Any "Macro Software" that allows me to create macros with advanced conditions using C# or another programming language or script?

    Posted: 13 Mar 2019 06:56 PM PDT

    I'm looking to code some macros for a game, but not just a simple one with basic iteration or repetition.

    I want the output of the macro to change depending on if the key is being clicked once, or being held down for long. If it's pressed once and released I want to run a macro with a 500 millisecond delay in it and multiple key presses. If it's being held down for longer than those previous 500 ms, I want to keep one of the buttons down. In a game I pretty much want to do a dodge maneuver (Shift button plus Left button) to the left when initially pressing 'A' (WASD layout), but keep the left arrow key down as long as I press 'A' after the initial dodge.

    The pseudo-code would look something like this:

    If key pressed down (A) then

    Press down (Left and Shift)

    Wait 500 milliseconds

    Release only (Shift) to stop dodging

    If key released (A) or if another button is pressed

    Release (Left and Shift) and exit the macro

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

    Question on a quick public DB setup for a newb

    Posted: 13 Mar 2019 06:47 PM PDT

    Hey all,

    Are there any good steps by steps that you've used for a mySQL or MSSQL DB setup for a beginner (the IT setup side, fine with SQL)? A little hand holding via a good tutorial and/or something easier to roll out would be nice. I'd like something public facing on whatever makes life easy and secure (I can pay if it helps the setup). I plan to learn the nitty gritties over time, but would love a quick initial thing that works and is secure and I can expand on as I find time. Have DB and programming experience, but not on the setup. "Google it" I know. Would just like suggestions on something modern and effective for a learner that would like something up quick. Thank you.

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

    Simple question about bash command

    Posted: 13 Mar 2019 06:38 PM PDT

    I am reviewing a quiz to study for a test I have tomorrow. The quiz is about basics of bash. So the instructions for the question I'm having troubel with is to simply "indicate the linux commands that you type to do the following." The question is "Find what particular ls command you are using when you type ls."

    I'm struggling to word this properly in google to find the right result. What I come up with is "find." But if I try "find ls" I get an error. Maybe I'm suppose to use find ls in a different directory like a bin folder?

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

    Raspberry Pi WifiJammer to run on startup

    Posted: 13 Mar 2019 06:19 PM PDT

    OK, so I have installed wifijammer for kali on my raspberry pi but I need this to run immediate on startup. How will I accomplish this?

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

    C++ desperation

    Posted: 13 Mar 2019 05:52 PM PDT

    So I'm in a c++ intro class that I'm about to fail if I don't get some help.

    The class went from two copy and paste labs in visual studio to "now draw the fuckin owl". Basically I want to copy my lab directions to someone and see what I have to do. I can handle future projects if I just can understand the basics.

    Where can I find people to help me out with something like this? I can even offer venmo or some shit.

    Searching individual problems gets me no where but more complicated messes.

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

    Is is possible to edit a rails model generated by scaffolding?

    Posted: 13 Mar 2019 05:41 PM PDT

    I'm fairly new to ruby on rails and I created an instructor model using the following code:

    rails g scaffold Instructor instructor_id:integer first_name:string last_name:string

    However I forgot that rails automatically creates a primary key so that instructor id is not necessary. Is there a way to go back and delete the instructor id?

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

    [C++] What does having & after a function return type declaration do?

    Posted: 13 Mar 2019 04:32 PM PDT

    I'm learning about copy assignment operator overloading and one of the examples has this function

    MyClass& MyClass::operator=(const MyClass& objToCopy) { cout << "Assignment op called." << endl; if (this != &objToCopy) { // 1. Don't self-assign delete dataObj; // 2. Delete old dataObj dataObj = new int; // 3. Allocate new dataObj *dataObj = *(objToCopy.dataObj); // 4. Copy dataObj } return *this; } 

    What does the & after the MyClass do? Does it mean that the function will return a reference to this instead of a copy?

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

    My Professor believes if you don't get it yourself then you won't get it. It sucks, ​and I need help!

    Posted: 13 Mar 2019 03:51 PM PDT

    Hello! My Professor believes if you don't get it yourself then you won't get it. It suck especially since the class in a 101 class. This is the problem I am having trouble with:

    "The following presents an incorrect Python code solution to the open file routine. Carefully review,

    understand, find and correct the mistakes. Search the web for code you might not understand. For

    example, Python file exists, or the "mode" operations for the open statement."

    fileName = str()

    if firstTime = "1":

    fileName = input("Enter the CSV File Name to Process: ")

    if (sys.path.datafile(fileName)):

    print("Input file exists - Append update in progress")

    processType = "A"

    datafile = open(fileName, "a")

    else:

    print("Input file does not exist - new file created")

    processType = "X"

    datafile = open(datafile, "r")

    while (processType != "C") and (ProcessType != "A"):

    processType = input("Enter a C to create or an "A" ro append a file: ")

    processType = upper()

    else:

    firstTime = "0"

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

    [NOOBIE REQUEST] I want to learn ActionScript to create my card game. What's the best way ?

    Posted: 13 Mar 2019 03:49 PM PDT

    Hi guys,

    First of all, you should know that I am a complete beginner in programming/dev (I learnt a bit of HTML/CSS here and there but that's about it, never done a full website or anything).

    I invented a card game that I want to show to the world, so I thought the best way to do this is to program it from scratch. I looked for infos and went to the conclusion that the easiest way of creating a basic 2D card game is in AS3.

    I have a few questions about all of this :

    1- Honestly, is it really doable for someone like me? I'm ready to work hard on it but maybe I don't realise that it'd be too diffcult without prior notions.

    2- I'll be using the free trial of Animate CC for now, do you think it is a good choice ? Couldn't install FlashDevelop, don't know why...

    3- What are the best online contents to learn step by step AS3 ?

    It's about everything I got in mind, but be sure to see me around for a while for lot of other questions.

    Also I'm sorry if my wrinting is not perfect as I'm not a native english speaker.

    Thanks in advance and wish you all a great day/evening !

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

    Concepts to measure text relevance to a given subject?

    Posted: 13 Mar 2019 03:36 PM PDT

    I do side work writing/improving a research project web application for some political scientists. This application collects articles pertaining to the U.S. Supreme Court and runs analysis on them, and after nearly a year and half, we have a database of around 10,000 articles (and growing) to work with.

    One of the primary challenges of the project is being able to determine the "relevancy" of an article - that is, the primary focus is the federal U.S. Supreme Court (and/or its justices), and not a local or foreign supreme court. Since its inception, the way we've addressed it is to primarily parse the title for various explicit references to the federal court, as well as to verify that "supreme" and "court" are keywords collected from the article text. Basic and sloppy, but it actually works fairly well. That being said, irrelevant articles can find their way into the database - usually ones with headlines that don't explicitly mention a state or foreign country (the Indian Supreme Court is the usual offender).

    I've reached a point in development where I can focus on this aspect of the project more, but I'm not quite sure where to start. All I know is that I'm looking for a method of analyzing article text to determine its relevance to the federal court, and nothing else. I imagine this will entail some machine learning, but I'm not particularly well-versed in that field. I've looked into some concepts such as tf-idf weighting and vector space modeling, but I'm too early into research to know if that's a good fit for what I want. Can anyone point me in some kind of direction?

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

    I am getting wrong password

    Posted: 13 Mar 2019 01:49 PM PDT

    I am getting a wrong password for the site..

    spacedustgame.space

    Registration goes as planned.. everything shows up fine in the DB.. but it is still just returning wrong password.. could someone take a look at this issue and help figure out what could be wrong?

    https://github.com/nytstar/SpaceDustGameMMO/issues/32

    I would greatly appreciate it. <3!<

    Problem has been solved!! Go me!

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

    Algebracket Script

    Posted: 13 Mar 2019 01:48 PM PDT

    Is there a way to write a script that would find the values for each slider on Algebracket.com in order to get a chosen team to be selected as the champions?

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

    Is there a way to access a file inside a .zip in a Linux environment

    Posted: 13 Mar 2019 06:53 AM PDT

    I want to find a specific line of text inside of a file and print it on my screen using Linux commands. I know I could do:

    find -name '[filename]' | xargs grep -i '[text I'm looking for inside file]'

    However, my file is inside a .zip file. I know unzip -l [.zip file name] will list of all files inside of .zip file, but it won't let me access in order to "grep" the information I need.

    Is there a solution to this?

    Thank you.

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

    Message Broker for messages with a due date

    Posted: 13 Mar 2019 09:54 AM PDT

    Hello r/AskProgramming,

    I want to implement an event handler for a game I am currently developing. In this game, the player interacts with the server through events. For example, the player sends his troops to an enemy to attack him. This will create an event with a due-date (current time + time for the troops to "walk" the distance).

    My plan was to use a message-broker to store all events in a message-queue and consume them, when they are due. Also, all events should be ordered by their due-dates and new events should be inserted in the right order. The problem is, that I can't find a message-broker who would support this.

    Does anyone know a message-broker (or any other tool) to accomplish this task? Thanks

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

    Met a guy that told me he could help, but my project is ‘too close to the metal’ what does this mean?

    Posted: 13 Mar 2019 09:52 AM PDT

    Can you help me out with MVC in a Java project?

    Posted: 13 Mar 2019 09:00 AM PDT

    Hello!

    Can anyone lend me a hand with designing an MVC window for my assignment? Unfortunately MVC has been skimmed over in our lectures.

    Basically, we are making a game. Before making the game window, the user is greeted by a config window where they chose resolution and other "View" details for the game window (which is also designed with MVC)

    I have a working prototype of it, but I feel like my MVC design is, well, wrong.

    So the way I understand it, we are separating Model and View to have modularity (like if I wanted to swap out the window View for something else) and we have the Controller to interact with the program (it's kinda like a bridge I guess?).

    Controller sees Model & View and Model & View only see the Controller. Model is the logical representation of data and the View is the user interface, of sorts.

    Is this correct?

    Ok so now to the actual implementation.

    Right now I have interfaces for configModel, configView and configController.

    The public methods are:

    Model

    +getResolution()

    +setResolution

    View

    +setController()

    +setStage()

    +open()

    +close()

    Controller

    +getResolutionListener()

    +getStartButtonListener()

    +getResolutionObservableList()

    +setModel()

    +setView()

    +setStartButtonCommand()

    The way I reasoned is:

    Model saves all of the selections to be passed to a Config class which is used by the game window's view.

    View is a JavaFX window, I set the Stage (top level container) from the launcher to have more control and I have public methods to open/close the window.

    Controller is the painful part. Right now it defines the actions of various buttons and lists in the view. I feel like this is major wrong, but I have no idea where to put these otherwise. I had a half-idea to rewrite it using only Command pattern... Again, it kinda binds this Controller to the View... The start button command is actually passed from the launcher to avoid extra layers of spaghetti code, the laucher (Main) sets the start button to open the game window and build the config class.

    Idk. I feel like I'm doing something major wrong.

    Edit formatting

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

    Novice API building question - Use ClassLibrary, or create my own Data Layer?

    Posted: 13 Mar 2019 08:58 AM PDT

    I'm working on a pet project API that pulls data from a SQL Server db. The schema isn't incredibly complex, but there are a handful of tables with foreign keys and such that are giving me issues.

    In my solution I have the WebApplication project and a ClassLibrary project. Following this tutorial I generated entities from my database tables and views.

    I built a controller for the "Magic" table, which lives in an isolated bubble, and it works great.

    I then tried a few others, most notably "Weapon" and have run into a bunch of errors. My next thought was to build a WeaponView in the database that joined in all of the foreign keys, but that produced different errors when I tried to build a control.

    At this point I'm considering abandoning this specific course of action altogether. It would be more work, but what I'm considering is setting up a connection to the DB and building a datalayer with contracts that selects only what I want and doesn't do any fancy auto-generated nonsense like the ADO.NET generator did while generating my entitites.

    My question is this: Am I going to be better off building my own data layer and writing out the SELECT statements exactly as I want them + contracts, or should I continue to use the tutorial above and troubleshoot as I go? I'm starting to realize that I'm a bit limited in what I'm going to have access to if I only reference my tables directly because some of the "important data" in my API is going to be the result of multiple joins anyway.

    Any advice or suggestions would be helpful. I'm still very much in the learning phase of this skill set.

    Here's a quick snapshot of my solution as-is, if it'll be any help.

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

    What would happen to current 301 redirects if i add https redirect

    Posted: 13 Mar 2019 08:45 AM PDT

    if i add this

    RewriteEngine On

    RewriteCond %{HTTPS} !=on

    RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI}

    [L,R=301]

    what will happen to all my http normal 301 redirects due to moving pages?

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

    What is the best way to post to a Wordpress site from a 3rd party app?

    Posted: 13 Mar 2019 05:35 AM PDT

    I own a content writing company, and I'm currently trying to build an app that will allow for my writers to post blogs to our clients' websites programmatically.

    I want the app to work with Shopify, BigCommerce, and Wordpress sites/stores.

    Shopify was easy to set up. They have a well documented one-click authentication process that simply redirects a user to sign in to their store and it then returns an auth token.

    Bigcommerce made a lot of sense too. A user can go to their store, generate an api key and then enter that into my app, easy-peasy.

    Wordpress is where i'm having trouble. Wordpress sites have an REST API that can accept POST requests to it's blog right? How do I authenticate my requests? Generally just kind of confused about how this works, not the most seasoned programmer as you can probably tell, this might be a dumb question :/ Let me know if clarification is needed.

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

    No comments:

    Post a Comment