• Breaking News

    Saturday, October 12, 2019

    Will mastering any one programming language allow the person to easily pick up any other language? Ask Programming

    Will mastering any one programming language allow the person to easily pick up any other language? Ask Programming


    Will mastering any one programming language allow the person to easily pick up any other language?

    Posted: 12 Oct 2019 08:21 PM PDT

    How to store datetime information for recurring events?

    Posted: 12 Oct 2019 08:32 PM PDT

    I'm building a simple personal website to remind me about events that are on around me. Some examples of events might be:

    • A market that is on every 3rd Saturday of each month from 8am-2pm.

    • A restaurant that is open 5pm-11pm on weekdays, and then 12pm-11pm on weekends.

    • A public holiday that takes place once a year.

    I'm wondering about the best way to store this information in a DB. Places I've worked at that need to store public holiday information usually just get someone to manually scrape a government website for holiday information and then seed the DB every year with the next year's holidays. This too manual for me, since I don't want to have to keep scraping x number of websites all the time.

    My current best solution would be to store each start 'datetime' as a string of crontab-like syntax, so every weekday from 5pm-11pm would be: "0 16-22 * * 1-5". Then write something to check particular dates against that string to see whether that event is happening today (or in the near future if I want some forewarning). I think that would solve my problem, but it seems like a lot of work to parse a crontab string like that and then successfully match it against a datetime.

    Do other people do this? If so, are there any packages I can use to check today's date against a crontab string? Is it a good/bad idea? What are some other ways to solve this problem?

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

    Should you ever worry about someone copying your work and claiming it as their own?

    Posted: 12 Oct 2019 04:34 PM PDT

    Today I went to a local tech meetup and presented my portfolio site (which is hosted on GitHub pages). The purpose I presented was to get feedback on it.

    After the talk, a girl (whom, if I recall correctly, is a bootcamp grad) walked up to me, asked what my Github username was, and walked away.

    Because of this experience, I've got a feeling that she's going to just copy the site, put her name on it, and use it as hers. Am I overthinking things here?

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

    How can you tell how many people are on a network in Java?

    Posted: 12 Oct 2019 02:01 PM PDT

    I'm programming a Java "packet sniffer" for a client. Example: Let's say you're at Starbucks and you want to know how busy it is before you order. You just open "Client's app" and it tells you how busy Starbucks is and when the best time to order is. It does this by reading how many clients are on a specific WiFi network.

    How can I tell how many clients (WiFi users) are on a WiFi network using Java?

    Any help would be appreciated. Thanks.

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

    Why does typing print('hello world') in jsbin or jsfiddle activate the computer's actual printer page? (Macbook Pro)

    Posted: 12 Oct 2019 06:12 AM PDT

    Running a NodeJS App 24x7

    Posted: 12 Oct 2019 09:57 PM PDT

    I have a nodejs webapp that connects as a client to a websocket and sends me push notifications whenever certain events occur. It also has functionality to send requests to a REST API based on information received from the same websocket.

    So far I have been running this app locally and keeping my laptop on at all times. But soon I am going to be traveling so keeping the laptop on 24x7 is no more an option.

    What can I do such that I will be able to run this app 24x7 (since it must be connected to the websocket at all times) without having to keep my laptop running?

    The only option I can think of is to run the app locally on a Digital Ocean Droplet and then RDP into the droplet whenever I need to use it. This way it runs 24x7 and I can access it whenever I want by RDPing into the droplet. The only concern I have is if the cheaper droplets will be powerful enough to allow me to RDP into them and use the app without lag.

    This app does not need to be access on the web. Would bundling it as an Electron app and then running it on a remote server be considered better practise than just running it at 127.0.0.1?

    Appreciate your inputs.

    Thank You!

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

    REST API constraint clash

    Posted: 12 Oct 2019 03:53 PM PDT

    Two constraints that seem to clash for me are Server-Client and Code on Demand. The first says that the client and server should be separate in their concerns; the client should know nothing about the server except for resource URI's. The second allows for the server to return executable code to be run on the client.

    Two points here.

    If the client returns some script code specific to some client doesn't that somewhat break the separation of concerns imposed by the server-client constraint?

    Why do we need a "constraint" that opens up the type of data that can be sent back in a response? Is it precisely because of my first point, that client specific know-how would not otherwise be allowed?

    Bonus:: Isn't the Client-Server constraint just a subset of the Layered Architecture constraint anyways??

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

    What would be a simple way to write a bot that reads email subject lines and creates data from them?

    Posted: 12 Oct 2019 01:27 PM PDT

    Looking to scan, and export how frequent I receive emails from certain addresses as well as scan the subject text for word frequencies. Im new to programming so realize this may not be the best place?

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

    Selenium scripting vs XXS

    Posted: 12 Oct 2019 12:31 PM PDT

    Hey AskProgramming, I'm having a hard time understanding if selenium is different from XXS and am not getting the answer off google. I proposed selenium as an automation solution at work to automate data entry and IT instantly aggressively rejected this idea as dangerous because it's XXS. Could anyone explain this to me?

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

    Postman Problem -- Array Help

    Posted: 12 Oct 2019 01:59 PM PDT

    The problem is as follows:

    Peter the postman became bored one night and, to break the monotony of the night shift, he carried out the following experiment with a row of mailboxes in the post office. These mailboxes were numbered 1 through 150, and beginning with mailbox 2, he opened the doors of all the even-numbered mailboxes, leaving the others closed. Next, beginning with mailbox 3, he went to every third mail box, opening its door if it were closed, and closing it if it were open. Then he repeated this procedure with every fourth mailbox, then every fifth mailbox, and so on. When he finished, he was surprised at the distribution of closed mailboxes. Write a program to determine which mailboxes these were.

    I drafted some code in Java to solve this problem -- but it's not giving me the result I should be getting, which should show boxes 1, 4, 9, 16, 25, 36, 49, 64, 81, 100, 121, 144 (square numbers) as closed.

    Here is my code:

    import java.util.Scanner;

    public class Lab01 {

    public static void main(String[] args) {

    String[] box = new String[150];

    for (int i = 0; i < 150; i++)

    {

    box[i] = "closed";

    }

    for (int x = 1; x < 150; x = x + 2)

    {

    if (box[x] == "closed")

    {

    box[x] = "open";

    }

    else

    {

    box[x] = "closed";

    }

    }

    for (int y = 2; y < 150; y++)

    {

    for (int z = y; z < 150; z = z + 1)

    {

    if (box[z] == "closed")

    {

    box[z] = "open";

    }

    else

    {

    box[z] = "closed";

    }

    }

    }

    for (int w = 0; w < 150; w++)

    {

    System.out.println("Box " + (w + 1) + " is " + box[w]);

    }

    }

    }

    Any help would be greatly appreciated.

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

    SQL Beginner Having Trouble Creating Multiple Tables

    Posted: 12 Oct 2019 01:28 PM PDT

    I'm working on a project that requires multiple tables be created using Oracle for a hypothetical law firm. I'm super new to programming and SQL and I'm having trouble getting the tables to work.

    Does anyone see any glaring issues with the following code?

    CREATE TABLE Motions (

    MotionID int NOT NULL,

    Date varchar(20) NOT NULL,

    CaseID int,

    PRIMARY KEY (MotionID),

    CONSTRAINT FK_CaseID FOREIGN KEY (CaseID)

    REFERENCES Case(CaseID)

    );

    CREATE TABLE Firm (

    FirmID INT NOT NULL,

    FirmName varchar(10) NOT NULL,

    PRIMARY KEY (FirmID)

    );

    CREATE TABLE Judge (

    JudgeID INT NOT NULL,

    JFirstName varchar(10) NOT NULL,

    JLastName varchar(10) NOT NULL,

    Circuit# varchar(10) NOT NULL,

    CaseID int,

    PRIMARY KEY (JudgeID),

    CONSTRAINT FK_CaseID FOREIGN KEY (CaseID)

    REFERENCES Case(CaseID)

    );

    CREATE TABLE Attorney (

    AttnID INT NOT NULL,

    FirstName varchar(10) NOT NULL,

    LastName varchar(10) NOT NULL,

    FirmID INT NOT NULL,

    PRIMARY KEY (AttnID),

    CONSTRAINT FK_FirmID FOREIGN KEY (FirmID)

    REFERENCES Firm(FirmID)

    );

    CREATE TABLE Case (

    CaseID INT NOT NULL,

    AttnID INT NOT NULL,

    MotionID INT NOT NULL,

    PRIMARY KEY (CaseID),

    CONSTRAINT FK_AttnID FOREIGN KEY (AttnID)

    REFERENCES Attorney(AttnID),

    CONSTRAINT FK_MotionID FOREIGN KEY (MotionID)

    REFERENCES Motions(MotionID)

    );

    CREATE TABLE Client (

    ClientID INT NOT NULL,

    CFirstName varchar(20) NOT NULL,

    CLastName varchar(20) NOT NULL,

    Phone# number(10) NOT NULL,

    Address varchar(20) NOT NULL,

    CaseID int,

    PRIMARY KEY (ClientID),

    CONSTRAINT FK_CaseID FOREIGN KEY (CaseID)

    REFERENCES Case(CaseID)

    );

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

    Could json replace HTML?

    Posted: 12 Oct 2019 05:12 PM PDT

    Pretty much the title, I know that HTML5 has improved a lot since the old days. But also nowadays it's rare to find xml, since most people prefer json. I also think that json is somewhat better to work with than javascript. So I would like to know your thoughts on why it could or couldn't.

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

    Have people become too lazy to learn coding?

    Posted: 12 Oct 2019 07:19 PM PDT

    I should note that I'm a late millennial myself and that not everybody is the same. With that said...

    I can't help but take note of the fact how most coders I see (both online and offline) are almost always 30+ years old. And it doesn't matter what kind of programmer it is. It's not a secret that millennials and those under 30 have created a culture that is hilariously lazy in many ways as most people now seem to have very low attention spans and can't put down their phones. I feel like nobody has the patience to do anything even semi-complicated anymore because they just lose interest. I still remember how I spent dozens of hours watching and reading tutorial content before I was able to have even a basic grasp on coding. That's not even counting all the other time that went into (and still goes into) trial and error style learning experiences.

    Even in the game dev community it seems like most of the coders are over 30.

    Do you think the laziness of modern culture is making it so that most people just simply don't have the patience or attention span to learning coding anymore? Where are all the 20 something coders? Of course they exist but they appear to be a very small minority?

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

    Why does my static website render correctly locally and on Github pages but render incorrectly on my own web server?

    Posted: 12 Oct 2019 12:24 PM PDT

    How does block chain work outside of cyptocurrency?

    Posted: 11 Oct 2019 11:43 PM PDT

    So, I know that when crypto is involved, we have dozens of people performing algos to retrieve a key, and they exchange the effort with money, plus their work makes it harder and more secure. How does all this work outside of crypto currency? Medical records are often used as an example, do they mine it themselves? Is it even similar?

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

    How on earth do I print this to the screen??? [c++] -loops

    Posted: 12 Oct 2019 01:38 PM PDT

    I have to output exactly what you see below on the screen using loops, please disregard the periods for spacing. The pattern consists of a right triangle and an inverted right triangle side by side. I looked all over the internet and couldn't find a single solution. I assume I have to append the inverted triangle function to the regular right triangle function, but I honestly don't have a clue on how to do that. Could anyone please help me!

    Pattern A ........................Pattern B

    _____________________________________

    +................................++++++++++

    ++...............................+++++++++

    +++............................ ++++++++

    ++++...........................+++++++

    +++++.........................++++++

    ++++++.......................+++++

    +++++++....................++++

    ++++++++..................+++

    +++++++++................++

    ++++++++++..............+

    __________________________________

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

    I thought java compiles in the given sequence?

    Posted: 12 Oct 2019 09:31 AM PDT

    So, yeah, obviously it does most of the time, but while just I just tiped something in, I got the certain problem:

    Input in Main Class:

    System.err.println(3);

    System.out.println(2);

    There are 2 outputs I get randomly I think:

    Output 1:

    2

    3

    Output 2:

    3

    2

    When using this Input:

    System.err.println(3); System.err.println(3);

    System.out.println(2); System.out.println(2);

    I even get outputs like that:

    32

    2

    (empty line)

    3

    or:

    3

    32

    2

    Seems to be caused by the different data streams, but I couldn't find an explanation yet and I don't want to just to guess what the problem is. My guess is that both data streams are compiled simultaneously (That seems pretty likely.). Can someone please explain? :-)

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

    Program to automatically update certain cells in google sheets

    Posted: 12 Oct 2019 07:18 AM PDT

    Just what the title says. Would like it to update a few cells in a row with the same content every day. Skipping two rows for the weekend.

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

    Best modern IPC options in Windows?

    Posted: 12 Oct 2019 07:13 AM PDT

    I recently had a conversation with a product vendor that maintains a VB6 app that controls some specialized hardware. In that conversation, I suggested they take their current app and separate out their business logic (proprietary stuff) from their UI, and open up their business logic via an API.

    The business logic would likely reside in a running process that third-parties could automate. Most of the examples of this kind of stuff that come to mind, though, are based in COM (MS Office, QuickBooks). I am to understand that COM is a dying technology, but I don't know what (if anything) would take its place. Given the constraint that this is a Windows-based desktop application (which isn't necessarily a given, but I'd like to assume so for this discussion), what would be a better choice for third-party desktop apps to talk to a locally running server application (and why)?

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

    Advice on a school project - Creating an AI agent to play an imperfect information card game

    Posted: 12 Oct 2019 05:04 AM PDT

    Hi everyone

    I'm tasked with creating an AI to play the game Love Letter. Love Letter is an imperfect information 2-4 player card game. There is a large number of possibilities in this game and my laptop or probably any other computer has the computation power to determine all possible game states.

    I need some advice on which search algorithm to use. Bear in mind that I don't have a supercomputer at my disposal. I have been researching Counter Factual Regret Minimisation however it seems like this still uses a lot of computational power. I've implemented a basic agent that utilises basic strategies such as counting seen cards etc. However, to make a more complex agent, I am stumped.

    Any advice is appreciated.

    Cheers

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

    Making a custom RSS feed for my university website

    Posted: 12 Oct 2019 04:47 AM PDT

    My university has a website where it posts announcements. I can't afford to miss these announcements, and at the same time, checking the website every day is kinda cumbersome. The website has no RSS feed.

    The announcements are posted on a web page with the following as the format for the URL of an announcement : http://example.com/news/detail/1/n where n is the announcement ID, which is numeric.

    When there is an announcement, the above web page (http://example.com/news/detail/1/180, for example), contains the announcement in the following format : ``` <div class="middleconten">

     <h3> Title </h3> 

    11 October, 2019

     <p> <a href='/some/link' target='_blank'>Click here for more details</a> </p> </div> 

    and when there is no announcement, (that is, when a user visits a web page with a `n` value, that doesn't correspond to an actual announcement ID, http://example.com/news/detail/1/1234567890, for example), the web page is as follows : <div class="middleconten">

     <h3> </h3> 

    1 January, 1970

     <p> </p> </div> 

    `` How do I make a RSS feed for the website capturing the<h3>value, thehref` attribute, and the date?

    Note : the n value, or the announcement ID, increments every time an announcement is made.

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

    Drawing Lines Between Two 2D Points In Unity

    Posted: 12 Oct 2019 04:01 AM PDT

    So it turns out Unity lacks a facility for this, so I'm building it myself. My current code has this as the result:

    https://i.gyazo.com/56f073b16682e0dd126cf7747bbe8c0f.png

    This is two lines:

    • (50, 50) -> (100, 100)
    • (100, 100) -> (500, 500)

    clearly, there's something going wrong here - I think it's the angle. The code for LineManager is as follows:

    using System.Collections; using System.Collections.Generic; using UnityEngine; public class LineManager : MonoBehaviour { //line drawing utility [SerializeField] Texture lineTexture = null; void OnGUI() { DrawLine(new Vector2(50, 50), new Vector2(100, 100), 5); DrawLine(new Vector2(100, 100), new Vector2(500, 500), 5); } //snip OnDrawGizmos void DrawLine(Vector2 first, Vector2 second, float width) { //parse the line data Vector2 midPoint = new Vector2((first.x + second.x) / 2, (first.y + second.y) / 2); float halfLength = (second - first).magnitude / 2; float angle = ((second.x - first.x) / (second - first).magnitude) * (180 / Mathf.PI); //draw the line Rect rect = new Rect(midPoint.x - halfLength, midPoint.y - 5, halfLength * 2, width); Debug.Log(midPoint); Debug.Log(halfLength); Debug.Log(angle); Debug.Log(rect); GUI.BeginGroup(new Rect(0, 0, Screen.width, Screen.height)); GUIUtility.RotateAroundPivot(angle, midPoint); GUI.DrawTexture(rect, lineTexture); GUIUtility.RotateAroundPivot(-angle, midPoint); GUI.EndGroup(); } } 

    The repository can be found here: https://github.com/Ratstail91/FamilyTree

    Basically, the algorithm I've got there spits out 40.5 degrees, where it should spit out 45 degrees perfectly. If I set the angle to 45 just before GUI.BeginGroup() then the result is correct.

    Thanks in advance.

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

    No comments:

    Post a Comment