Programming

Count the number of people around you by monitoring wifi signals — Github Repo

Learn Programming - Thu, 01/17/2019 - 14:41

Check out this neat github repo that uses WiFi signals to see who's around you.

https://github.com/schollz/howmanypeoplearearound

submitted by /u/roy-m-kim
[link] [comments]

Learn to program

Learn Programming - Thu, 01/17/2019 - 14:38

Hey I am in 10th grade and I have programming as a subject. Our teacher gave us a challenge that if we could make a harmless virus that can "enter" the hole school he would give us a degree so i was hoping someone could help me make a "virus" that lets the teacher be unable to access their computer for like one day. So just like a black screen that cant be removed for one day? Is that even possible?

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

Flask, postgresql, sqlalchemy

Learn Programming - Thu, 01/17/2019 - 14:28

Hi,

I have created a database cluster and user with all permissions for it, so I can log in to it through psql. I can also connect via psycopg2. However when I try using sqlalchemy I get a password authentication fails error. I believe I have installed everything required, and if I can access it via psychopg2 I would not think I need to make any additional changes like exporting variables. With Flask, I'm using:

app = Flask("__name__") app.config["SQLALCHEMY_DATABASE_URI"] = 'postgresql://user_here:password_here@localhost/database' db = SQLAlchemy(app)

In my psycopg2 script to test the db I was passing the authentication strings like this

con = psycopg2.connect( host='localhost', dbname='dbname', user = 'user_here', password = 'password_here') cur = con.cursor()
  1. Am I doing anything obviously wrong?

  2. What is the best practice for authenticating to access postgresql? Any searches I do for this involve flask-login or authentication for end users, when I just mean connecting to the database. I am using psql --dbname=library --password to access fine. And the psycopg2 method above works, but I'm just hardcoding the password into that script, so I figure there must be some better method.

Thanks.

submitted by /u/toothing-stone
[link] [comments]

First programming job, how do I deal with my very specific, narrow type of retardation?

Learn Programming - Thu, 01/17/2019 - 14:02

Hi guys, hope you can help me.

I've always suspected that I was cognitively impaired in some specific way and finally got tested by a neurologist.

The tests scores were average to slightly better than average except for one:

The spotting information on a screen test score said that my 'reaction is very, severely retarded'. The neurologist actually had me re-do the test an hour later to make sure, just because my score was so extraordinarily slow.

Essentially, the test looked like this:

I'm shown a grid of 5x5 numbers / letters / images and I'm supposed to find a specific number / letter / image. The grid then gets bigger in every round.

No I'm in my first programming job and my mentor has to be super patient whenever we pair up.

He says 'click on run', and it takes me ages to find run.

When he says 'Open the css folder', even if there's only ten or so folders, I've typed in CSS on the keyboard to highlight the folder long before my eye can register it. Too bad if the folder is called _css or something.

I know most of the shortcuts in Visual Studio and Windows, which makes navigation quicker, but I'm immediately lost once there's a log of info on the screen and I'm supposed to find a specific part.

It's really embarrassing and apart from learning shortcuts and kind of knowing by heart where I can expect certain elements, I don't know how to work on that.

If there's only like ten elements shown, I should see what I'm looking for long before I've sorted alphabetically and then picked out the right one based on its position in the alphabet...

submitted by /u/Meet-Doublemint-Dave
[link] [comments]

Kubernetes Command Line Tools

Programming - Thu, 01/17/2019 - 13:57
Categories: Programming

Beginner web developer here struggling understanding javascript loops!

Learn Programming - Thu, 01/17/2019 - 13:56

Hi everybody. I am a beginner programmer and i am really struggling with writing loops i understand what they are use for but i just don't feel comfortable enough to write them out was wondering if anyone had any good resources or advice so i could get a better understanding thanks in advance!

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

Let's try to clear up some Git misconceptions

Learn Programming - Thu, 01/17/2019 - 13:40

I've learned quite a bit about Git since I started using it, and I'd like to share some hopefully instructive 'revelations' I've had along the way.

  1. You don't need Github to use Git

That one can seem fairly obvious, but I remember being confused at first. You can use git entirely locally, and I would even say you should learn that way.

  1. A remote repository can be anywhere

A remote repository is simply a repository your "local" repository is communicating to. From the Pro Git book:

Remote repositories can be on your local machine. It is entirely possible that you can be working with a “remote” repository that is, in fact, on the same host you are. The word “remote” does not necessarily imply that the repository is somewhere else on the network or Internet, only that it is elsewhere. Working with such a remote repository would still involve all the standard pushing, pulling and fetching operations as with any other remote.

  1. A branch (in the Git sense) is a reference to a commit

That is certainly one of the most important things to understand about Git. A branch is just a bookmark. When you delete a branch, you're removing the bookmark/branch, not the pages/commits (*). Branches are there to help you make sense of the commit graph you're building, they do not constitute the graph.

  1. A rebase does not modify any existing commit

When you rebase a branch, you're creating new commits on the branch you are rebasing onto. Your branch bookmark will follow, but the 'former' commits are still in your graph (*).

  1. There are SHA hashes, but it's not about encryption

At first, I believed that since Git used SHA hashes, some sort of encryption was going on. In fact, your files are simply compressed, and SHA are mostly used because they provide a nice (quasi) unique identifier for everything that Git stores.

  1. A merge commit can have more than 2 parents

You can merge 3, 4 or more commits if you like to. They are called octopus merges, and they can go wrong sometimes. Linus once wrote this after a 66-parent commit broke some stuff:

I just pulled the sound updates from Takashi, and as a result got your merge commit 2cde51fbd0f3. That one has 66 parents. [...]

It's pulled, and it's fine, but there's clearly a balance between "octopus merges are fine" and "Christ, that's not an octopus, that's a Cthulhu merge".

(*) Even if it's not immediate, keep in mind that at some point a non reachable commit will be garbage collected.

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

Processing Python

Learn Programming - Thu, 01/17/2019 - 13:36

Hello, everyone

I am currently trying to re-create the polka do game (https://www.polkadotgame.com) with python in processing. I am just starting to learn python and I really want to make this game. So far I have created the canvas, with 6 balls moving around the canvas with the ellipse command. I also have made a moving ellipse with my mouse (mouseX, mouseY). I have tried really hard to figure out the rest like eating the other balls, and dying when you eat a ball bigger than you. If you gave any help to comment that would be really appreciated.

The code I have so far

https://docs.google.com/document/d/1v_ELyMV0afIEPhsDxLzze1FC3bgQCqSe3-6JVpIyEI4/edit?usp=sharing

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

Is learning how to make GUI applications in Java useful?

Learn Programming - Thu, 01/17/2019 - 13:30

I have honestly wondered this for some time now. I know you can you stop an ex or swing to make gooey applications. Last year I tried making a SQL query writer just for fun. But it was mostly drag and drop with right click to add action items. I knew and has the money ready with the code, but it wasn't like I was reading it all from the ground up..

But I've also read somewhere that most Java coding is server-side anyway so I won't even be working on GUI applications. Is it useful?

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

Need advice brushing up on Java

Learn Programming - Thu, 01/17/2019 - 13:20

I am currently enrolled in a Java 26B class which is the second part to the introduction of Java. I first took 26A about 3-4 years ago and haven't brushed up on it at all. Now I know that I am fully capable of taking this class and passing I just need advice on where I should start to relearn the basics.

I know there are resources like the Standford 106A which I believe is pretty close to the A programming class here. I am totally willing to crunch in they entire class to relearn everything to catch back up. But I was wondering if anyone else has been in my position I am confident I can relearn all topics quickly and want something I can crunch in and refresh as quickly as I am willing to go. I know it will be a big workload but I want to get back on track as quickly as possible.

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

Crawlers are requesting /user/login and /user/register... a PathAuto problem?

Drupal - Open Source Content Platform - Thu, 01/17/2019 - 13:09

Hi, I noticed in the server logs that crawlers were still getting /user/login?destination=... and /user/register pages. I have PathAuto installed, so that's possibly the culprit.

Am I safe in modifying the robots.txt file manually from

Disallow: /user/login/

to

Disallow: /user/login

and for similar paths too? Would that likely fix the problem?

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

[Question] Javascript: Why does Number.MIN_VALUE keep returning Infinity rather than 5e-324? Also "prettier" extension formatting question.

Learn Programming - Thu, 01/17/2019 - 13:07

Question 1: I've tried it in an empty project just to test, and it works, returning 5e-324. But whenever I try it within my assignment project file, it keeps returning Infinity. It's annoying because part of my assignment specs is to return 5e-324, but it refuses to. I'm not dividing anything by zero either, simply comparing two values, and returning Number.MIN_VALUE if true; no other evaluation is happening so I'm not sure why it refuses to give me the right number in this particular source file.

function findSmallest(...numbers) { for (var validate = 0; validate < numbers.length; validate++) { if ( typeof numbers[validate] !== 'string' && typeof numbers[validate] !== 'number' ) throw 'Incorrect type.'; } if (!numbers) return Number.MIN_VALUE; return Math.min.apply(null, numbers);

This is the context it is used in.

Any insight/help appreciated.

Question 2: Why does the 'prettier' extension format my code weird. Is this just the JS standard (2nd day learning javascript)? Why did it create a line break after the '&&'? I put the whole entire expression on one line but I guess it didn't like that, but now it looks even more weird imo.

function buildQueryString(productName, quantity, isGift) { if (productName.match(/[:;,/?@&=+$\s]/) !== null) return `?p=${encodeURIComponent(productName)}&q=${ quantity <= 0 ? '1' : quantity }${isGift ? '&gift' : ''}`; return `?p=${productName}&q=${quantity <= 0 ? '1' : quantity}${ isGift ? '&gift' : '' }`; }

It also formatted another block of code as shown above, where as my original looked like:

function buildQueryString(productName, quantity, isGift) { if (productName.match(/[:;,/?@&=+$\s]/) !== null) return `?p=${encodeURIComponent(productName)}&q=${quantity <= 0 ? '1' : quantity}${isGift ? '&gift' : ''}`; return `?p=${productName}&q=${quantity <= 0 ? '1' : quantity}${isGift ? '&gift' : ''}`; } submitted by /u/a2242364
[link] [comments]

Looking for a good online resource that is NOT free!

Learn Programming - Thu, 01/17/2019 - 13:06

I'm apologizing in advance with the nature of this question, as I know its pretty redundant here, but hopefully somebody can give me a good answer. I have access to funding to complete an online course of my choosing. I'm looking for the best online resource for learning Web Development.. possibly software development too but at the moment I am teaching myself Web Development and that's where most of my experience is. I've went through most of freeCodeCamp, some Udemy courses and a bunch of youtube videos.. but I feel like I need an extra push and some help with creating projects and networking with possible employers. Basically, I'm looking to take advantage of the funding I have available so I don't care about the costs.

I currently have 3 to 4 hours a day available to do coding, and that's the routine I've been sticking to for the past 6 months. I don't think those online boot camps would be any good, because I heard you need at least 10 hours a day? and I also live in a remote part of Canada so I wouldn't be able to attend them in person. So far I've been researching Udacity and Team Treehouse as my options. Was wondering if anybody else has some other suggestions for me? Thanks a lot !!

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

Getting started with Java but can't do the Helsinki MOOC. Looking for feedback on these two sources.

Learn Programming - Thu, 01/17/2019 - 12:59

For transparency, I've dabbled in coding before but nothing too in-depth. Python Intro level things mostly. (What is if/else, what a for loop is etc etc)

However I've recently developed a strong interest in Java. It's used heavily in the company I work, Android development is performed with it, and it's general purpose enough that if there's something I want to do or make, I can probably find a way to do it with Java. It's probably the best "go hard" first language to take seriously.

So here I am.

However, a lot of my practice will be done from the office behind a corporate proxy. The Helsinki MOOC code authentication modules don't work from here and the general usability of it is from here isn't a good experience. Additionally, it's still dated from 2013 and requires the use of older versions of apps and JVM's etc etc.

I looked else where and found John Purcell's Udemy Intro Java Course. And I also found a book that looks very nice called Think Java

I like to move fairly quick so I'm hesitant in trying to make myself sit through a video served course but the counter argument is it will force me to slow down a little.

For anyone that has reviewed both the book and the udemy course - is there a general consensus on which is better? Or are they both good enough that if I picked one over the other I'm probably going to be ok?

Thanks!

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

Fell out of love with iOS development. What should I try next?

Learn Programming - Thu, 01/17/2019 - 12:57

I've been dicking around on and off with iOS development for the past 7 years or so. I never landed any paid work with it but I did have a few apps in the App Store and for a few years I was pretty motivated. While I enjoyed the coding process itself, I started to grow frustrated with anything UI related (I hate autolayout) and I found Apple's restrictions and review process to be esoteric. I've also been a bit turned off by Apple in general lately and subsequently I haven't written a single line of code in months.

I feel it's time to try something different, and and this time it's with the intent of landing paid work. Here's what I'm considering:

  • JavaScript- Although from what I understand learning JS by itself is usless and that you pretty much need to be fluent in HTML/CSS as well. I find this a bit intimidating and like I said before I'm shit with UI design. However it is incredibly popular and versatile in it's applications.
  • Python- admittedly I know little about Python aside from that it's very high in demand and that supposedly it's a pleasure to work with. Unsure of it's applications other than "math and science".
  • C#/ .NET- Also seem quite popular and from what I've read the development environment is a pleasure. Aside from writing desktop apps it can be used for backend and even Unity development.
  • ???

Looking for suggestions. I think after learning both Objective C and Swift to decent levels of proficiency I'm not too scared to pick up a new language, rather I just don't want to waste my time on something that's not a good fit for me. UI is a pain point for me, but maybe I've just been scarred by iOS.

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

Pages