/dpt/ - Daily Programming Thread

Old Thread: What are you working on Sup Forums?

Other urls found in this thread:

docs.python.org/2/tutorial/controlflow.html#break-and-continue-statements-and-else-clauses-on-loops
strawpoll.me/11076725
jobs.jobvite.com/zappos/job/osyA3fwn
jobs.jobvite.com/zappos/job/ojxA3fwd
jobs.jobvite.com/zappos/job/oqfx3fwZ
jobs.jobvite.com/zappos/job/oS3G3fwo
jobs.jobvite.com/zappos/job/onyA3fwi
ideone.com/Tw405N
ideone.com/eGocn2
45.32.80.36/board.cgi
grokys.github.io/avalonia/avalonia-alpha4/
twitter.com/SFWRedditVideos

promise you wont laugh?
im making my own feed reader except it will only be the backend end and a few pages for auth n stuff. everything else will be done through API. I plan on supporting the fever and ttrss apis

A small patch for an open source game in C++ while learning emacs.

for i in range(4):
print(i)
else:
print("else")
# output:
# 0
# 1
# 2
# 3
# else


WHY.jpg

Python is a good language

yeah looks like python is at fault here

Since it starts at zero, it's somewhat natural especially for powers of 2.

Sounds cool, after looking at the alternatives I ended up replacing Google Reader with nothing. Now I just glance at HN once in a while.

Was talking about the else thing

ah yes the for ... else statement

I'm currently writing a crawler that goes over newspaper sites (local ones without newsfeeds) every half an hour and stores new articles in separate files.
This works so far, but: Are there ressources about how to not fuck with the bandwidth/security/admins of the target sites, i.e. hide a little that I'm crawing? Current approach is to scramble the found urllists of the sites and get them a bit in a chaos, given enough sites it's pretty chaotic and takes time in between two consecutive accesses.

I don't laugh. Good luck.

>using for else
>ever
>not using for else if

>not using until [..] when [..] given-that [..] ensure [..] unless [..] soþlice

so that you don't have to do
broke_loop = False
for element in mylist:
if element:
broke_loop = True
break
if not broke_loop:
print "did not break"

you'd rather not have it? or pick a different keyword?

fake your headers
create a random delay

oh also nobody gives a shit that you're crawling their site esp. at a rate of a half hour each
once you start downloading 15000 of their archived documents back-to-back then they have an issue
that was the only time I was banned for a scraper

oh also follow api rules or you'll get banned

docs.python.org/2/tutorial/controlflow.html#break-and-continue-statements-and-else-clauses-on-loops

Hey guys,

I'm delving into some light SQL at the moment, and I'm wondering if I've understood this correctly? If not, could you provide me with a more precise understanding?

#Sample

SELECT *
FROM library.books; #Selects every column from table library.books and puts it inside a new table

#Exercises from .pdf

SELECT * #Selects every column
FROM library.books #from table library.books
WHERE PublishYear #where row value of column PublishYear
BETWEEN 2001 AND 2004; #is between 2001 exclusive and 2004 inclusive

SELECT AVG(PublishYear)
FROM library.books; #Sends column PublishYear to function AVG() which finds the average value of the column,
#and then selects the returned value of the function AVG()

SELECT * #Selects every column
FROM library.books #from library.books
WHERE PublishYear > ( #where PublishYear is greater than
SELECT AVG(PublishYear) #returned average from AVG(PublishYear) like last exercise
FROM library.books);

SELECT title, #Selects title
COUNT(title) AS DupeCount #and the count of each set of duplicate entries of the title column.
#Stores result of COUNT() in DupeCount column (generated by command)
FROM library.books
GROUP BY title #Groups rows by title
HAVING COUNT(title) > 1; #and only shows titles with COUNT greater than 1 (duplicates)

SELECT * #Selects every column
FROM library.books #from library.books
WHERE PublishYear = 2000; #where PublishYear is 2000

SELECT * #Selects every column
FROM library.books #from library.books
WHERE PublisherID = 12; #where PublisherID is 12


Thanks for any replies!

for i in range(4):
if i == 3:
print(i)
break
print(i)
else:
print("else")

Well, the only hint they'd have would be that the get and post were within seconds of each other so unless you want to sleep() between pages you could just use a few threads and have them wait on each other. But, really, some guy clicking between articles at a rate lower than probably ( minutes > 10 ) between get requests might raise a brow. Why not just have the botnet run it?

>fake your headers
didn't come up with that, will look into it.
>create a random delay
already implemented that in the first version that only had one target site, might use it again a little more

>follow api rules
care to elaborate?

What I crawl is not that much per site.

Hey dpt, I forgot how much I missed you guys.

>could just use a few threads and have them wait on each other.
Not a bad idea.

>Why not just have the botnet run it?
Involving non-local machines doesn't really have an appeal to me - yet.

C strings or std strings?

Rotating headers such as user agent, using proxies, and randomizing delays between requests are all decent ways. If you are really determined you could use a lib like selenium to fake user actions during each request, although that would be a horribly inefficient approach. Like another user said, sending 2 or 3 requests to a site every 30 min wont trigger any flags most likely.

>puts it inside a new table
No, it just returns the results of the query. It's not in a "new table".

>between 2001 exclusive and 2004 inclusive
BETWEEN is inclusive. 2001 in this case is actually evaluating January 1st, 2001

Everything else looks fine.

Please do not use an anime image next time

should i apply to internships even if i don't meet all the requirements? i'm a csci major but some of the postings wants specific things like
>Ability to create layouts using advanced and semantic HTML5 and CSS3
>Knowledge of DOM scripting with native JavaScript and JS frameworks such as jQuery
which i don't know anything about. it's like this for most internship postings

strawpoll.me/11076725

std::strings are null terminated

then learn those things

Fuck, you just triggered my PTSD of trying to get an internship in college.

It's astounding how many of them require actual work experience.

What the fuck is their definition of an internship?

Either way, apparently you can still apply and have a good chance of getting the internship. It's like how business always list "3-5 years working with this" when they actually don't really care.

Yes, but they are also length prefixed.

>What the fuck is their definition of an internship?
The answer you search for is "really cheap employee"

stfu indians are bro tier

Depends, how much do you enjoy hammering nails under your toenails?

Threadly reminder that lisp > hasklel

>yfw hasklel can't even treat code as data

PROLOG or bust.

Stop avatarfagging.

front end dev: jobs.jobvite.com/zappos/job/osyA3fwn
iOS: jobs.jobvite.com/zappos/job/ojxA3fwd
information security: jobs.jobvite.com/zappos/job/oqfx3fwZ
software engineer: jobs.jobvite.com/zappos/job/oS3G3fwo
android dev: jobs.jobvite.com/zappos/job/onyA3fwi

it says "please limit to 2 applications" at the bottom of every page but not at the main internship page, so idk if that means you can apply twice to every internship or to only 2 internships. which 2 of these internships do you think's the best to apply for? fwiw i'm most experienced with java

Bad news for you buddy
ideone.com/Tw405N

It's two applications per job posting.

>went to interview today
>spaghetti.jpeg
>run home
>house locked
JUST

A different keyword would be wonderful. At first look, the else feels like it should execute if there was nothing in the list to loop over:

for element in mylist:
print(element)
else:
print("no elements to show")

instead of doing
if len(mylist) == 0: # doesn't even work with iterators
print("no elements to show")
else:
for element in mylist:
print(element)

Gee, you sure are stupid. You still can't embed NULs, but length() is O(1) because they are length prefixed.

Yeah my bad ideone.com/eGocn2
It didn't work the first time because constructor expects a c-string

>constructor expects a c-string
I thought all string literals since C++11 where std::string? Or it is just trying to preserve back-compat semantics?

>doesn't even work with iterators
looped = false
for element in mylist:
looped = true
print(element)

if not looped:
print("no elements to show")

Backwards compatibility

>>>/general/rules/13

Why not use something like isEmpty(mylist)

I just got over 4000 failed SQL injection attempts on my CGI script written in C!
It's a comment board!

45.32.80.36/board.cgi
Please try it out and don't spam it pls.

Well I think string literals are still const char[], not sure about it though.

DELET THIS GIF

Because
>doesn't even work with iterators

Iterators/Generators don't create lists in memory they just give the object for each iteration, so you can only loop once. No way to check the length without looping over them

a = [1, 2, 3, 4]
b = (i for i in a if i % 2 == 0)
len(a) # 4
len(b) # object of type 'generator' has no len()

How accurate is CodeEval's Timing?
Is there a better rating than 1ms?

Also general experiences with codeEval? Is it worth my time or are there better alternatives for practicing/not getting rusty.

>>>/global/rules/13
Oh that's neat. How do I link to specific board rules? >>>Sup Forumsrules/2

They are forever const char*

I feel mentally damaged now for programming in python.

>warning: ISO C++ forbids converting a string constant to 'char*' [-Wpedantic]
In C++11 and C++14.
>warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]
In C++98.

is there a cleaner way to copy an array into a bigger one, with the empty spaces at the end being 0, other than creating a new one and iterating? this is in java

So don't use an else statement on a for loop stupid

Either use arraylist (which does precisely what you said), or copy it yourself.

Like
said, use ArrayList. Or if this is for an assignment or something use System.arraycopy(). It functions like memmove() from C.

i'll look into arraycopy because it's for an assignment. we're working with very large numbers in binary so i assumed the iteration method would be really slow but then i realized i'm retarded and it doesn't work like that so the questions kind of moot but still it might look cleaner

Not like other programming languages have better ways to do that. The only thing I know that implements an else clause like that is the twig template engine

{% for user in users %}
{{ user.username|e }}
{% else %}
no user found
{% endfor %}

Thank you very much!
Would +rep

Do yu hev GeitHab?
I loeve GeitHab.

const char* not char* dummass. They are still not stdstrings. However "abc"s is a stdstring in C++11 if that's what you are confusing it with.

>want to multiply a variable
>end up dereferencing it
wtf I hate C now

Will there an IDE like Visual Studio for Linux distros?

Is there one? Eclipse is almost on its level.

Text editors are edge lords' maymay.

>went to interview
>seems good
>didn't get picked
it doesn't matter in the end

Sup Satan. Once Lintards figure out how to get WPF working on Linux you'll be able to use VS with WINE or whatever the fuck.

try QtCreator

I use it to create python programs' GUI, I know about it, but it "only" supports C++.

I will only learn that when it needs to be used, but none currently. My internship is at Nokia (Szeged) and I asked arou nd the offices and they do not use it cause they want to build new system from scratch based on a different company's technology(guess which).

I will probably work for them after college, they hire all students immediately after the diploma, this is true to every company in the country.

68th for Scala!

>73 replies

sasuga scala

Is it true that Haskell programmers are TOO SMART to be employed?

no but it is true that haskell is a useless toy language

makin progress. gotta wire everything up and shorten the led strip and put everything so you can't see it and then done.

there is tiny oled display (which is way smaller than I thought - maybe buying a bigger oen) which should display room and outside temperature in the end

Every thread user

Every thread

>somewhat offtopic

>want to find "trustable" programmers
>don't give a shit about their titles or prev experience

My problem is all I find is pedantic retards who don't know what their titles say they should, or poo in the loo tier programmers.

Last time I hired someone, I had to end up doing the work myself, paying him, and fixing that messy code...

Where the fuck do I find people who want to engage in interesting projects for money? this is not a stable job offer or anything like this, I just want someone to have for occasional jobs

Anyone have any idea where to find them? I'm lost

Well, you can trust me.

gimme your bank account number, I will pay you now in advance

hire me too

I work on fun new projects all the time

both of you are welcome aboard, any desired wage?

All I want is a nice comfy part-time job writing C.
Nobody in my part of the world wants to hire me without a bachelors in computer science and 5+ years experience in a laundry list of technologies.

All I want is someone who gets the job done, and can adapt to different jobs.

I'm looking for android dev now

Already in the works
grokys.github.io/avalonia/avalonia-alpha4/

>using a special encoder for calculators
>go to extreme lengths to input special characters needed like the left arrow, including hex editing input files and using special windows encodings on my input file
>turns out the person who programmed it (completely undocumented and closed-source, mind) mapped the -> command to the left arrow unicode character and didn't accept anything else

fucking hours wasted and there's not even anyone to be mad at

Jetbrain's stuff or QtCreator

What are the pros and cons of the various IDEs out there (for Windows)? I see most of you swear to eclipse, is this because it has features NetBeans do not offer? Is it habit?

I like NetBeans and can't seem to get comfy in Eclipse although I have tried a couple of times. Any reason not to stay in NetBeans?

>What are you working on Sup Forums?
Blockchain, on the cloud. Synergised and vertically integrated for streamlined UX.

If you are in windows just go use Visual Studio.

Use Visual Studio for everything but Java.

If you're working with Java, go with IntelliJ.

In Java, what does

private foo(){ }

Create? Wtf is it, a class, a method, or what?

A syntax error.

I'm in Java lecture right now and it was on my instructors lecture slide, but she didn't explain it

I guess it's the (private) constructor for a class named foo.

I've had good experience with it. Helped get me a job after being neet for several years

Oh, that's probably it.

Goes to show you that context is everything

I'm not sure why you would have a private constructor like that, though.