[Boards: 3 / a / aco / adv / an / asp / b / biz / c / cgl / ck / cm / co / d / diy / e / fa / fit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mu / n / news / o / out / p / po / pol / qa / r / r9k / s / s4s / sci / soc / sp / t / tg / toy / trash / trv / tv / u / v / vg / vp / vr / w / wg / wsg / wsr / x / y ] [Home]
4chanarchives logo
Daily Programming Thread
Images are sometimes not shown due to bandwidth/network limitations. Refreshing the page usually helps.

You are currently reading a thread in /g/ - Technology

Thread replies: 255
Thread images: 38
File: Ce5nYp0W4AAxp5Z.jpg large.jpg (166 KB, 1024x1344) Image search: [Google]
Ce5nYp0W4AAxp5Z.jpg large.jpg
166 KB, 1024x1344
Old /dpt/ at >>53912129

What are you working on?
>>
File: 1454090550232.png (138 KB, 401x305) Image search: [Google]
1454090550232.png
138 KB, 401x305
>>53917850
first 4 memes
>>
>>53917850
thank you for not using a fag image
>>
File: 1457924207442.jpg (12 KB, 261x200) Image search: [Google]
1457924207442.jpg
12 KB, 261x200
3rd 4 memes
>>
>>53917850
>didn't put /dpt/ in the subject.

Fucking retard.
>>
>tfw you finally manned up and started doing the thing and you've gotten a good start but it turned out to be even harder than anticipated and it's going to take a lot of effort just figuring out the algorithms
>>
File: akari eats chippus.png (131 KB, 256x256) Image search: [Google]
akari eats chippus.png
131 KB, 256x256
Rate my tripcode bruteforcer!
$ ./tripforce | grep -i "AKARI"
TRIP: '!0peiaAkarI' -> PASS: 'e6m%bg`LIM'
TRIP: '!5WFDMakarI' -> PASS: 'wb'
TRIP: '!omFAKaRi2o' -> PASS: 'M<`Dw]>vW@'


Just a few issues tho.
What is the legal range of password characters?
It's not just limited to ascii, right?
Also, is it faster to malloc a random 10-char password string, or pass in a char array from the stack?
Also, should I be using rand() for the password generation?
>>
File: stupid shit I read.webm (1 MB, 512x288) Image search: [Google]
stupid shit I read.webm
1 MB, 512x288
>>53917940
/DPT/ Doesn't belong in subject you fucking moron. The name of the thread is not dpt. How fucking retarded does one need to be in order to not being able to grasp that?
>>
File: op.jpg (229 KB, 1920x1080) Image search: [Google]
op.jpg
229 KB, 1920x1080
>>53917915
will my fag image do?


>>53917964
>>53917964
>>53917964
>>
>>53917998
Fuck off, retard.

Many people type 'dpt' into the catalog to easily find the thread.

Literally look at all of the general threads on the entirety of 4chan. They include /{initials}/ in the subject.
>>
>>53917998
>The name of the thread is not dpt
yes it is, people call it /dpt/ all the time

and general threads and board are usually in this format like /g/ - Technology
>>
File: 1454101474335.jpg (7 KB, 273x200) Image search: [Google]
1454101474335.jpg
7 KB, 273x200
>>53918015
>the pic
>>
>>53917996
>What is the legal range of password characters?
Anything that Shift JIS supports.

>It's not just limited to ascii, right?
See above.

>Also, is it faster to malloc a random 10-char password string, or pass in a char array from the stack?
Probably the former.

>Also, should I be using rand() for the password generation?
rand() is obsolete and can't be relied on
>>
>>53918021
it's still searchable with the dpt in the body
>>
>>53917998
You are retarded.http://boards.4chan.org/g/dpt/ <<<<<
>>
>>53917996
>Also, is it faster to malloc a random 10-char password string, or pass in a char array from the stack?
if you're using malloc the libc you're using will have to make a system call to get the memory page, so anything should be faster than allocating memory
>Also, should I be using rand() for the password generation?
use something from <random>
>>
Im goint full focus on javascript. I realized that this is gonna be the future(bcs internetz and shit) and the best tool for fucking with people and also making humble money on the side.
>>
What programming language should I learn?
>>
>>53918054
visual basic
>>
>>53918054
C#
>>
>>53918038
>Probably the former.
Meant the latter.
>>
>>53918027
This thread is still findable >>>/g/dpt because of the "old /dpt/" word tho, so OP is a lucky fag. (still a fag tho)
>>
>>53918054
Java if you want money
>>
>>53918001
Reposting.
>>
>>53918054
c
>>
Does anyone know of any tutorial sites or videos about how to work with SQL and Java?
>>
>>53918063
>>53918066
>>53918086
Why?
>>
>>53918096
Why do you wanna learn a programming language?
>>
File: browser.png (884 KB, 840x926) Image search: [Google]
browser.png
884 KB, 840x926
another day, another tweak to browser #112.
>>
http://pastebin.com/B4JaHnx9
How do I use errno?
>>
>interning at a small business for embedded dev
>I'm the only programmer, the other 2 tech people are the CEO and the EE
>they're having me design and implement things from the ground up
>the CEO loves everything I do and worships the ground I walk on, so I guess I'm doing a good job
>only getting paid $12/hr
I can't help but feel like I'm getting robbed.
The experience is really great at all, and I like everyone here, but I think I'm doing a lot for $12/hr.
>>
>>53918126
lookin good
>>
>>53918136
It's good experience take it
>>
In R, if I put a library load call inside a function def, like this incredibly stupid and contrived example:
customfunc <- function(arg1,arg2){
library(packagename)
return(packagefunction(arg1,arg2))
}


is it going to reload packagename every time i call customfunc()?
>>
>>53918136
You say you're interning and getting paid $12/hr. but I thought interning was for free?
>>
Dynamic thread injector for shellcode that will initialize a reverse TCP shell on the victim.
>>
File: the_face.png (212 KB, 343x268) Image search: [Google]
the_face.png
212 KB, 343x268
>>53918182
Ever heard of paid internships?
What basement have you been under?
>>
>>53918182
unpaid internships are basically abuse for anyone who's not an idiot highschooler with zero experience, and lots of people are trying to change the expectations for what you get out of an internship

these days "internship" usually means "a position everyone knows is temporary that pays you not much more than you'd get working retail somewhere, so the company can try you out"
>>
>>53918136
sounds like it's a shitty startup and they can't afford or are too cheap to have a proper programmer so they're using you for work. but could be good for the experience and at least you're not
>doing it for free

an option would be to do your own startup if you feel like being an entrepreneur
>>
>>53918209
>Ever heard of paid internships?
Not really, no.

>>53918234
>these days "internship" usually means "a position everyone knows is temporary that pays you not much more than you'd get working retail somewhere, so the company can try you out"
Didn't know that, always just been hearing internship means you're slaving away for nothing except for "experience".
>>
>>53918182
>All internships are unpaid
Im sorry for your loss anon.
>>
>>53918182
>doing any work for free
this isn't community service, you know
>>
>>53918287
I've never interned anywhere.
>>
>>53918273
Seriously where do you live? Most internships are paid. or are you just in highschool still and dont know?
>>
File: LSD.jpg (22 KB, 394x251) Image search: [Google]
LSD.jpg
22 KB, 394x251
>>53918328
>>
>>53918067
>>53918046
I just tried it.
Using 2 cores on a c2d, I got 45467.7 trips/sec with the stack allocation and 45398.8 trips/sec with the heap allocation.

It's not a huge difference but I'll take it.
Also, how does crypt.h handle strings?
I thought that crypt() passed a malloc'd pointer to a char array, but when i try to free it, it causes a segfault, and I don't see any memory leaks if I leave it alone in valgrind, so I resorted to memmove'ing the string to truncate it further instead of mallocing a new string.
>>
Going to an interview for a functional programming company

Didn't prepare at all

Will update in 4h
>>
>>53918419
I hope you can program in C, Python, Ruby, Perl, and can read Assembly code
>>
>>53917917
this
>>
>>53918394
>The return value points to static data whose content is overwritten by each call.

GNU lets you use crypt_r to which you pass a pointer to your own crypt_data variable.

Did you say you were doing this on multiple cores at a time???
>>
File: confused.png (316 KB, 604x344) Image search: [Google]
confused.png
316 KB, 604x344
>>53918066
>C#
Windowsfag
>>
>>53918519
Mono exists and supports c#/.NET pretty well.
>>
>>53918054
https://swift.org/
>>
Does this work? Am i able to free up memory in the heap in main after using the function?
int* p = createArray();

int* createArray() {
int* arr = new int[20];
return arr;
}
>>
Working on a saas product. Using spring mvc.

When you have a controller which calls a facade which builds a model, and the model has an instance variable of some sort that also needs to execute some method to build part of the model, what is a good way to access it?

public class FolderController extends AbstractController {
public String processRequest(HttpRequest req, HttpResponse res) throws Exception {
Folder folder;
IFolderFacade folderFacade = new FolderFacade(folder);
folderFacade.getFiles();

for (IFile file : folder.files) {
fileFacade.getMetadata();
}

Map map = new HashMap();

for (IFile file in folder.files) {
map.put(file.Filename, file.FileMetadata);
}

return new ModelAndView("folder", map);
}
}


Typing this from memory so it probably has some errors in it. Anyway, my question is mainly about iterating over the files in folder and calling the file facade function on each one. Is this a good practice, or should I put getFileMetadata() in the FolderFacade so I don't have to loop through the files? Basically not sure how best to go about populating an object hierarchy in a controller to be passed off to the DispatcherServlet as a model.
>>
>>53918054
Javascript of course.
>>
>>53918560
yes, that's pretty much the point of heap allocation. you aren't only able, you HAVE TO tho
>>
>>53918588
I think he's talking about Software programming languages sir
>>
>>53918054
java if you're a beginner

C++ otherwise

or fucking anything except for python, haskell, lisp
>>
>>53918515
I was wondering why all my trips were suddenly wrong...
I disabled openmp and the trip output was suddenly correct again.

Maybe I should use pthreads instead of openmp.

>>53918560
You can write constructor/destructor functions to handle that stuff for you so you're not calling free() everywhere.
>>
File: 1454939475116.jpg (10 KB, 252x244) Image search: [Google]
1454939475116.jpg
10 KB, 252x244
>>53918519
>I only like languages nobody cares about or can make profit from
>>
>>53918519
C#/.NET is operating system agnostic, anon.

It is released fully open source under the permissive MIT license.

You can develop in C# for Linux, OSX, iOS, Android, Windows, PS4, Xbone, etc.
>>
>>53918656
>i think C# isn't shit
>>
>>53918654
testing again!

Why are tripcodes so shit?
>>
>>53918646
>C++
I think you meant C
>>
>>53918560
Yes, but why are you using plain new/delete these days? Use std::vector if you need a dynamic array.
>>
File: devenv_2016-04-07_11-39-48.png (11 KB, 865x199) Image search: [Google]
devenv_2016-04-07_11-39-48.png
11 KB, 865x199
>>53918629
>not using Javascript within another langauge
>>
>>53918670
C# is **literally** the best general purpose programming language available right now.
>>
File: mysql_view.png (5 KB, 681x97) Image search: [Google]
mysql_view.png
5 KB, 681x97
Does anyone here know about mysql views? Making a forum and having some trouble "connecting" users to posts to threads, like in the forum front page I need to count number of posts inside a thread and shit to display that info. I've heard people do that by using views and joins, I'm currently trying to make a single view that has user + number of posts + number of threads created by the user but it doesn't work. It says that posts and threads are the same number, does anyone know what's wrong with my code?

SELECT
ifnull(`u`.`UId`, `p`.`PAuthorId`)AS `VUId`,
ifnull(`u`.`UName`, 'Unknown')AS `VUName`,
ifnull(count(`p`.`PAuthorId`), 0)AS `VUPosts`,
ifnull(`u`.`UPostsFake` ,-(1))AS `VUPostsFake`,
ifnull(max(`p`.`PDate`) ,-(1))AS `VULastPost`,
ifnull(count(`t`.`TAuthorId`), 0)AS `VUThreads`
FROM
(
forum_posts AS p
LEFT OUTER JOIN forum_users AS u ON((u.UId = p.PAuthorId))
LEFT JOIN forum_threads AS t ON((p.PAuthorId = t.TAuthorId))
)
GROUP BY
`p`.`PAuthorId`
>>
>>53918750
Kek'd
>>
>>53918670
You're welcome to have your opinion, but C# is really fucking good now.
>>
>>53918670
>me being a hipster makes C# shit
>>
>>53918750
it literally isn't
>>
>>53918770
>implying C# wasn't shit before hipsters started using it

As both a C and C++ programmer, thou hath zozzled me
>>
File: pooh.jpg (55 KB, 640x640) Image search: [Google]
pooh.jpg
55 KB, 640x640
>>53918794
>As both a C and C++ programmer
>>
>>53918794
>zozzled
Wouldn't your usage imply that he drugged you or got you wasted with alcohol?

I am confus
>>
>>53918813
Say something bad about C
>>
>>53918751
>using ifnull on what appears to be a primary key

Damn, son, you've got issues in your table design before you start making views.
>>
>>53918833
I'm only a little light-headed right now
>>
>>53918860
It's not actually a forum, I'm indexing a forum and I only fetch user data when the user creates a thread, so there's alot of posts in forum_posts that don't have a recognized "owner"
>>
>>53918846
It silently destroys data.

Now you tell me that the language shouldn't hold my hand.

And I say that it's better to use a language that requires destruction of data to be explicitly casted in most agile development environments.

Then you tell me to kill myself.


>saved this thread three posts
>>
>>53918813
>>53918794
>I've never worked on a real project so I don't know how helpful classes and STL are
When will this meme die
>>
>>53918903
?
>>
>>53918813
>>53918691
>implying STL templates aren't faster than anything you NEETs can write in C
>>
>>53918903
?
>>
>>53918889
>silently destroy your own data
>C IS SILENTLY DESTROYING MY DATA!!11
>>
File: wojak.jpg (68 KB, 700x700) Image search: [Google]
wojak.jpg
68 KB, 700x700
>have to write implementation of 'uniq' for lab
>takes a while but it works
>feelsgoodman.jpg
>run in valgrind to make sure no bugs
>valgrind show no errors
>write bash script that executes my implementation of uniq
>fucking segfault
JUST.
>>
>>53918883
Give me short examples of table data, along with expected output.

I'll plug them into my database and write you something real quick.
>>
>>53918935
>>53918918
u got me
>>
>>53918954
lol
>>
File: cactuschan.png (962 KB, 1073x773) Image search: [Google]
cactuschan.png
962 KB, 1073x773
>>53918960
I have a cactus I bet you'd love to sit on
>>
>>53918954
The beauty of C
>>
File: 89b2d3cac4.png (390 KB, 1920x1080) Image search: [Google]
89b2d3cac4.png
390 KB, 1920x1080
>>53917850
>What are you working on?
Mathematical anal rape in Rust.
>>
File: juicyj.png (315 KB, 540x720) Image search: [Google]
juicyj.png
315 KB, 540x720
>>53919064
trippy mayne.

the fuck is it?
>>
File: frac.png (569 KB, 1920x1080) Image search: [Google]
frac.png
569 KB, 1920x1080
>>53919094
Fractals, m8.
>>
In Python, is there a more efficient way to declare several variables who all have the same value than this?

a, b, c = 0, 0, 0
>>
>>53918954
if you're segfaulting nowadays you either suck or are doing something wrong. if bounds get that complex don't use raw pointers.
>>
>>53919107
can you not do

a = b = c = 0
?
>>
>>53919106
but, I mean, of what use?

the pine cone holds the seeds.
>>
>>53918889
C is like an airplane, you need to really know what the you're doing and still most of the crashes stem from operator error.
>>
>>53919132
I suppose. Just wondering if there was some shorter way for a snek pleb.
>>
>>53918563
>spring mvc
you're fired
>>
>>53918955
You mean this? http://sqlfiddle.com/#!9/c93d9/1

I want to count the number of posts of everyone, even people that I haven't retrieved (haven't created threads, that's why the "Unknown")
>>
>>53919167
Thank you for supporting my point.
>>
>>53918955
>>53919203
Forgot to mention, UFakePosts and UFakeThreads is the number of posts and threads reported by the third party forum I'm indexing, I think they're missing from that database schema
>>
>>53918889
>it silently destroys data.
only if you tell it to.

silently destroy yourself.
>>
File: Frac2.png (3 MB, 1919x1079) Image search: [Google]
Frac2.png
3 MB, 1919x1079
>>53919145
Fun. I want to practice my Rust and I like doing fractals.
If I wanted to make a game, I would have to make lot's of graphics, story, gameplay etc and I would get bored quickly. I don't have any idea for useful program too.
Creating fractal renderer is more fun because I only need optimization and mathematical skills to do that. I also was able to do by-hand assembler optimizations, learn some asm, SDL2, GLSL, fixed point math and create something that looks really nice with small amount of repetitive/easy-but-boring work.
>>
>>53918889
>use VB.NET
>System("RM -RF /")
>compiler automatically inserts dialogbox to confirm with the user
thank you based microsoft
>>
>>53919170

>>53919132 seems pretty easy. one step above a pajeet doing it for you, which is exactly what will happen if you keep using python.
>>
>>53917996
It's converted to Shift-JIS, which pretty much means all you need to do is delete \ and ~ and boom, you just converted ascii to SJIS.

Also holy shit, do your comparison in the program, if you actually want a fast brute forcer. Passing all those lines though a pipe just to be checked by regex is fucking slow, when all you need to do is strstr for trips and memcmp for passwords in the program.
>>
>>53919203
>>53919224
That fiddle isn't loading for me, but either way, you're not filtering your aggregations.

See this helps, hard to say without access to the data:
SELECT
ifnull(`u`.`UId`, `p`.`PAuthorId`)AS `VUId`,
ifnull(`u`.`UName`, 'Unknown')AS `VUName`,
ifnull(count(*) FROM forum_posts p WHERE p.PAuthorId = u.UId, 0) AS `VUPosts`,
ifnull(`u`.`UPostsFake` ,-(1))AS `VUPostsFake`,
ifnull(max(`p`.`PDate`) ,-(1))AS `VULastPost`,
ifnull(count(*) FROM forum_threads t WHERE t.TAuthorId = p.PAuthorId, 0)AS `VUThreads`
FROM
forum_users AS u
LEFT OUTER JOIN forum_posts p ON p.PAuthorId = u.UId
GROUP BY
`p`.`PAuthorId`


If TAuthorId and PAuthorId represent the same data, they should have the same name. Don't rename the same data just because it's in another table.

Harder to read.
>>
>>53919330
[Err] 1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'FROM uol_posts p WHERE p.PAuthorId = u.UId, 0) AS `VUPosts`,
ifnull(`u`.`UP' at line 4



Also here's the sql file if the fiddle is not working http://pastebin.com/CZPhCiS6
>>
Is it possible to get into programming as a hobby if I
>hardly know any math
>literally don't know shit about computers (yet)
>have a €300 four year old desktop

>inb4 what are you even doing here
I-it just seems interesting, and I'd like doing something useful with my time.
>>
>>53919271
here's my idea for you:

>trippy cone

>"seeds" appear randomly along your fractals. >the user simply clicks on the seed to harvest it.
>the user's cursor is displayed by a small circle which he moves around the "map"
>the cursor must be fully within the seed for a perfect click
>the more perfect clicks, the more points, and the trippier it gets
>however
>the seeds decay throughout time
>if the user lets a seed decay, it messes up the fractal for part of the map, making it so less and less seeds come from that region
>non-perfect clicks have the same effect as decay, but less severe
>non-perfect clicks earn less points
>user can use his seed money to buy smaller cursors, quicker mouse movement, and other power ups such as making seeds stop decay for a bit
>as the game progresses in time the seeds appear faster, maybe they decay faster sometimes too
I think there's a lot to work with. I could go on and on. It all assumes your fractals are moving and dynamic which I can't tell from your images.
>>
>>53919434
Yes it's possible.

http://www2.sunysuffolk.edu/tangy/cst112%5CText_book%2810th_ed%29.pdf

Get to work.
>>
>>53919434
>hardly know any math
math can be learned (or gleaned from wikipedia)
>literally don't know shit about computers
just learn what an OS is and how your computer stores information between the CPU and RAM, it takes all of 20 minutes.
>have a €300 four year old desktop
You don't need anything fancy for programming unless you're doing heavy 3D graphics.
>>
File: 1459519252157.jpg (58 KB, 415x571) Image search: [Google]
1459519252157.jpg
58 KB, 415x571
>>53919434
Nothing is impossible anon.
>>
>>53919434
It always pisses me off when people think they need a good computer to learn how to program.

Install some lightweight distro, read an intro Python or intro C book, and work through it. Ez.

You don't need to be good at math until after you learn a language and want to make really cool things, but you can make just pretty cool things without crazy math.

You won't need much math at all for an intro book though.

For a distro, you could go with lubuntu or something.

For intro books, I recommend these two:

C Primer Plus by Stephen Prata
Think Python by Allen Downey

I recommend learning C first because if you know C, you can learn python super easily.
I honestly don't know if it's hard or not to learn C if you only know Python, though. Someone else might contribute their experience regarding that.
>>
In c, how do I have a value which is #defined at the top of the file, but allow it to be optionally be changed based on arguments passed when the program is invoked?
>>
>>53919501
Yeah I never got that. Compilation is the most intense thing you're gonna do.

On learning, I learned Python first, then went to C++, C, *insert language here*. Taking a class on program structures really helped understand that learning python is retarded for a beginner. LEARN C FOR GOD SAKES. Yes you can blow your arm off in C, but that's a good thing.
>>
>>53919562
You can't. Make it a global variable if you have to.
>>
>>53919386
Sorry, those lines should be like this:
ifnull(SELECT count(*) FROM forum_threads t WHERE t.TAuthorId = p.PAuthorId, 0)AS `VUThreads`
>>
>>53919439
It could be fun game, but I didn't make it for that purpose.
If I used floats it could even work on browser and it would have stable 60FPS, but I purposely used fixed point math. I want to get as much precision as I can to make videos like:
https://www.youtube.com/watch?v=0jGaio87u3A
For now I only have 2 FPS, but I'm working on optimizing it. I want to make a tool for creating videos like that and exploring fractals bu hand in real time.
>>
>>53919571
You can, use #IFDEF WHATEVER

then in compilation use -DWHATEVER
>>
Electron capture code for energy-mass conversion events in supernova and neutron star crusts.
>>
File: ZwKryTy.png (35 KB, 838x781) Image search: [Google]
ZwKryTy.png
35 KB, 838x781
>>53919386
>>53919574
It should work, by the way.

I tested the syntax on my production database.
>>
>>53918179
Yes, I think so. Use require instead.
>>
>>53919298
Are you sure that regex is a bottleneck here?
Because I see 100% cpu usage every time i run tripforce and it's not printing to the screen.
Does grep simply discard output if it can't catch up?
>>
>>53919282
A pajeet? You're implying I'm somehow gonna do this for a living?

>top kek
I'm an MD-PhD-student. Let's see your precious programming pajeets take my job any day in the coming 50 years.
>>
>>53919574
>>53919609
With
SELECT
ifnull(`u`.`UId`, `p`.`PAuthorId`)AS `VUId`,
ifnull(`u`.`UName`, 'Unknown')AS `VUName`,
ifnull((SELECT count(*) FROM forum_posts p WHERE p.PAuthorId = u.UId), 0)AS `VUPosts`,
ifnull(`u`.`UPostsFake` ,-(1))AS `VUPostsFake`,
ifnull(max(`p`.`PDate`) ,-(1))AS `VULastPost`,
ifnull((SELECT count(*) FROM forum_threads t WHERE t.TAuthorId = p.PAuthorId), 0)AS `VUThreads`
FROM
forum_users AS u
LEFT OUTER JOIN forum_posts p ON p.PAuthorId = u.UId
GROUP BY
`p`.`PAuthorId`


It works on the schema I gave to you because it's pretty small but in my real one (uol_posts = 49913 rows, uol_threads = 42 rows) etc it never returns the result, probably just freezes mysql
>>
>>53919584
yeah it's cool. got a good link to describe how to do some of this stuff? guessing you're using OpenGL.

I never learned about Mr. Mandelbrot in school.
>>
>be me
>dream in code
>make some shit iPad apps
>people say I'm a prodigy
>I only know Obj-C
>steal other people's code
>dafuq is a low level
>mfw
>>
>>53919657
For mandelbrot generation algorythm:
http://www.wikiwand.com/en/Mandelbrot_set
Fixed point Math written in asm I wrote from scratch, I couldn't find any resources for help.
Also I just created github repository:
https://github.com/funmaker/mandelrust
You can see how multiplication and addition/subtraction works in f8_120.rs

Also I forgot to say: One of my lecturers said he can give me access to some powerful computer with lot's of processors to test out my program.
>>
I am wasting too much time,
just so much fucking,
I go to facebook to check shit then get sidetracked by a fly
i check on youtube by manually getting into the site and checking the subscriptions,
i go through many news sites to check up on anthing new.
i am wasting so much precious time on this shit.
i keep getting sidetracked,
what do you guys know that i can use to keep track of everything i want?
like a hub that aways updates me on whats new on social media, news and video sites.
I tried getting into RSS feeds, but damn some of the sites i use barely convey hat they mean with the title.
is there something that would ease my pain?
should i move this question on to /sqt/ or a thread of its own?
>>
>>53919655
50,000 rows is nothing. I did give you the less efficient way, but it shouldn't be that bad.

Something like this maybe:
SELECT
ifnull(`u`.`UId`, `p`.`PAuthorId`)AS `VUId`,
ifnull(`u`.`UName`, 'Unknown')AS `VUName`,
ifnull(`u`.`UPostsFake` ,-(1))AS `VUPostsFake`,
COALESCE(p.postCount, 0) AS `VUPosts`,
COALESCE(t.threadCount, 0) AS `VUThreads`,
ifnull(max(`p`.`PDate`) ,-(1))AS `VULastPost`
FROM forum_users as u
LEFT JOIN (
SELECT COUNT(*) as postCount, PAuthorId
FROM forum_posts
GROUP BY PAuthorId) p ON p.PAuthorId = u.UId
LEFT JOIN (
SELECT COUNT(*) as threadCount, TAuthorId
FROM forum_threads
GROUP BY TAuthorId) t ON t.PAuthorId = u.UId
GROUP BY
`p`.`PAuthorId`
>>
>>53919761
        GROUP BY TAuthorId) t ON t.PAuthorId = u.UId

should be
        GROUP BY TAuthorId) t ON t.TAuthorId = u.UId


Typing this shit in notepad with no IntelliSense. I need muh crutch.
>>
>>53919644
getting pretty defensive over a little joke there pal
>>
>>53919761
>
    ifnull(max(`p`.`PDate`) ,-(1))AS `VULastPost`

Oh, and for this line you're going to have to rejoin that table under a different alias, or something.

For now, remove that line and lemme know if it works.
>>
Let's say I have a set g of groups, that each contain one or more functions. Starting at group 1, I need to execute the functions inside that group. I then want to step to group 2 and execute its functions, while at the same time running the functions in group 1. I want it to continue in this fashion for some predetermined time.

How can I implement it efficiently?
>>
>>53919644
To be fair, Indians are overrepresented as doctors by like a factor of 10.
>>
>>53918015

Obviously everyone's going to use this thread, because it has a cock in the OP image, rather than an actual programmer.
>>
>>53919738
install this shit https://chrome.google.com/webstore/detail/stayfocusd/laankejkbhbdhmipfmgcngdelahlfoji?hl=en
>>
>>53919825
because being a doctor isn't difficult it just takes spending many years in med school and reading thousands of pages of textbooks and memorizing various things about the body, illnesses and medicines.
>>
>>53919825
Yeah, but they are doctors in India. They can't practice medicine in US/Europe if they don't go through some pretty lengthy education.
>>
>>53919853
what is your opinion in mr.dream in pajeet?
>>
>>53919860
>Almost 10 percent of the physicians in the U.S. are of Indian origin. Consider that for a moment -- Indians, who represent barely 1 percent of the total American population, account for one-in-ten of its doctors, perhaps the most prestigious and difficult career to obtain.
>>
>>53919877
Why are they so efficient at stealing white collar jobs?
>>
>>53919877
Doesn't specify where they got their education. Unlike programmers who got educated in India, MDs who got their degrees there can't just up and move to the US and start working as MDs there.

>dat percentage
Impressive, tho.
>>
I'm >>53919912, and I do have to concede that there are a lot of first- and second generation immigrants in my med school.

Not as many in my MD-PhD-program though. Hm.
>>
>>53919761
That one works but doesn't have the "Unknown" users (users that posted but weren't retrieved)

I'm currently testing this one

SELECT
ifnull(`u`.`UId`, `p`.`PAuthorId`)AS `VUId`,
ifnull(`u`.`UName`, 'Unknown')AS `VUName`,
ifnull(
count(`p`.`PAuthorId`),-(1)
)AS `VUPosts`,
ifnull(
(
SELECT
count(0)
FROM
`forum_threads` `t`
WHERE
(`u`.`UId` = `t`.`TAuthorId`)
),
0
)AS `VUThreads`,
ifnull(`u`.`UPostsFake` ,-(1))AS `VUPostsFake`,
ifnull(`u`.`UThreadsFake` ,-(1))AS `VUThreadsFake`,
ifnull(max(`p`.`PDate`) ,-(1))AS `VULastPost`
FROM
(
`forum_posts` `p`
LEFT JOIN `forum_users` `u` ON(
(`u`.`UId` = `p`.`PAuthorId`)
)
)
GROUP BY
`p`.`PAuthorId`
ORDER BY
ifnull(count(`p`.`PAuthorId`), 0)DESC


Seems to work fine, do you see any problem with it?
>>
>>53919812
bump
>>
>>53919911
there are no competent doctors left in India. they all went to america to make more money.
>>
>>53919951
>
    ifnull(
count(`p`.`PAuthorId`),-(1)
)AS `VUPosts`,

This part doesn't do what you think it does.

It literally counts up the non-null values in that column. Isn't that entire column returning the same number?
>>
>>53919856
thanks, atleast its a start,
>>
>>53918126
where to download, senpai?
>>
repostan:

Let's say I have a set g of groups, that each contain one or more functions. Starting at group 1, I need to execute the functions inside that group. I then want to step to group 2 and execute its functions, while at the same time running the functions in group 1. I want it to continue in this fashion for some predetermined time.

How can I implement it efficiently?
>>
>>53919871
No real opinion. He'll probably get that "job at Apple" that he dreams of (I think that's what he said he wanted, but I haven't seen the video in a while), but as he grows older, he'll probably find that nobody really thinks he's special anymore.

>>53919938
You get your bachelor's degree in India. You move to the US and do your graduate studies there. Universities take you in to fill a diversity quota.
>>
File: table.png (9 KB, 393x443) Image search: [Google]
table.png
9 KB, 393x443
>>53920000
I think because it's
FROM
(
`forum_posts` `p`


it counts the times that unique ID was in the table, seems fine here so far
>>
teach me how to DP, dpt
>>
>>53920052

For each group, spawn a thread that executes the functions in order?
>>
>>53920052
Why the fuck did you repost the exact same post in this thread?

Why the fuck aren't you telling us what language you're using, or even really what it is you're trying to do?

Any language that has easy threading mechanics will allow you to do this.

Consider C# with async calls and Tasks.
>>
>>53920060
>Universities take you in to fill a diversity quota.

Wait just one fucking second. I'm Indian (third gen born in US), and I'll tell you that diversity is the last thing we give to universities. There are so many other Indians at any given university that it's even harder for us to get in than whites. The reason being is that we are grouped into the Asian category, which makes us compete against xian chang, and pajeet singh.
>>
>>53920099

>DP
Dynamic Programming?

It seems in the past week we've had a few people coming in here who don't know what dynamic programming is. Have none of you ever taken a basic algorithms class, and are all of you unwilling to look on Wikipedia?

Or do you mean some other "DP"?
>>
>>53920125
I'm using Python. I'm trying to execute a bunch of logic gates that flip between states. Right now I have a tiny amount of gates, but when I'm done it's gonna contain something like 500 gates (it's a simulation of a cell's biochemistry).

S-sorry.
>>
>>53920145
ruby_btfo.jpg
>>
>>53920191
don't use p. it's complete shit
>>
>>53920200
But I don't know anything else, other than a tiny amount of C++. And I need to get this shit done pronto.
>>
>>53920135

>we are grouped into the Asian category
Well damn... that actually sucks.
>>
>>53920238
getting pthreads set up in C++ would probably be easier than dealing with the clusterfuck that is p., just look at some examples of pthreads
>>
>>53920000
Thanks by the way
>>
>>
>>53920309
binary trees are cute! CUTE!
>>
>>53920383

Anon, that's not a binary tree, that's a parse tree.
>>
>>53920391
Parse trees are cute! CUTE!
>>
>>53920391
what an embarrassing mistake

something i've been working on is using huffman's and it sort of looked like the diagram I made
>>
>>53920383
>>53920399
trees are gay and only for fedora tippers
>>
>>53920471
uguu~
>>
>>53920471
life is a tree.

is Google ProtoBuf still the gold standard for packaging/unpackaging tcp/ip streams?
>>
File: 1459999999999.png (367 KB, 470x415) Image search: [Google]
1459999999999.png
367 KB, 470x415
>>53917850
gonna make a perfect windows xp image viewer 'mimic' for learning purposes
>>
>>53920482
speaking of which, you know what else is cute? deconstructors.

ClassName::~ClassName ();
>>
Damnit, I see conflicting views everywhere. Is it a bad idea to learn C with K&R (2nd Edition) I am already 3 chapters in and don't feel like switching. I do supplement with "C A Software Engineering Approach" for reference and more indepth explainations. Will I be okay or will develop a bad style from this apparently outdated book?
>>
>>53920553
learn C++ or java

C is mostly irrelevant in this day and age
>>
>>53920582
That wasn't my question idiot.
>>
>>53920553
Why bother with C, when you can learn high-level and actually do things?

Unless you want to be a low-level dev, of course.
>>
>>53920603
deal w/ it
>>
>>53920553
Mate, just get on with it. C has barely changed since when that book was written if basically at all.
Go for it yeah
>>
>>53920553

C has not changed too much between versions. If you learn C89 from K&R, switching to C99 or C11 will be trivial.

>>53920613

Learning C doesn't prevent you from learning higher level languages. On the contrary, it makes it easier to see what the fuck those higher level languages are actually doing under the hood, rather than simply relying on blind faith.

I will consistently hold the view that programmers should get a more well-rounded education that includes computer architecture, preferably in a commonly used low level language such as C and/or C++. If you use languages like Python or Ruby, it generally helps to know how the interpreter works. My first language was C++, and my second language was Ruby. After I had learned Ruby, I was curious about what the fuck an "object" really was. Looking through the Ruby source code was actually rather enlightening, and I can't see why anyone would want to deny themselves this sort of experience. You work with abstractions every day and you don't think to yourself "how do these abstractions work?"
>>
>>53920508
thats a good idea for a learning tool anon.
>>
Reverse a String


String moo = "ILoveHorses";
String boo = "";

for(int i = moo.length();i >= 0;i--)
{
boo += moo.charAt(i);
}

>>
>>53920827
a = "String"
b = a.reverse
>>
>>53920827
var x = "ayy".Reverse();
>>
>>53920827
reverse "topkek"
>>
>>53920827
Hired

>>53920854
>>53920872
Not hired since you guys cannot implement algorithms on your own


Superior Java programmers win once again
>>
>>53920827
Wouldn't your example be more efficient just to do
String boo = "sesroHevoLI";
?
>>
Anyone use Boost.graph? Is it awesome?
>>
>>53920905
>implying I'll work for a company that rolls their own Reverse method
>>
>>53920905
>reinventing the wheel
I'm glad I can't work at your "company"
>>
>>53920935
>>53920926

you need to know how to implement your own algorithms because there is not a library for every situation which will help you
>>
>>53920910
Funny story, last time I was whiteboarding at an interview (didn't take the job, not enough PTO), I did exactly that.

They asked me to print the reverse of the string "I Play Basketball" or something like that.

I wrote print "llabteksaB yalP I" and explained that while I could write a method that would reverse any string, this is the most efficient and simply way to perform exactly the task you asked of me.

According to them, it was actually the best answer they've received on that.
>>
>>53920966
please ask a question that requires writing algorithms if that is what you want
>>
>>53920966
>implying a 4 line solution to reverse a string implies you know algorithms
>>
>>53920966
There's a library for Reverse, though.

You didn't even say "Without using something that's been tested by thousands of people who are better programmers than everyone here..."

Fuck off.
>>
Constant time reverse:
string.crbegin();
>>
>>53920966
You also need to know how to overcome DRY coding. That's why fizzbuzz is popular because you implement something has no real value and you can't use a std function in it's place.
>>
basic or python
>>
>>53920996
>>53921007
>>53921010
>>53921029
It's true you guys still haven't done it okay guys try this one


public class Application {
public static void main(String[] args) {

String one = "Hello";
String two = "Hello";

if(one == two) {
System.out.println("one == two");
}
else {
System.out.println("one != two");
}
}
}



What does the following code print out?
>>
>>53921042
Java
>>
>>53920985
desu I think that's kind of a dumb answer

there are uses for a method/function that reverses a string, especially when user input is involved
>>
>>53920827

1. i needs to be initialized to length - 1. Initializing it to length will give you an out of range error.
2. Use a string builder.

import java.lang.StringBuilder;

public class Reverser {
public static String reverse(String s) {
StringBuilder sb = new StringBuilder(s.length());
for (int i = s.length() - 1; i >= 0; i--) {
sb.append(s.charAt(i));
}
return sb.toString();
}

public static void main(String[] args) {
String foo = "abc";
System.out.println(reverse(foo));
}
}
>>
>>53921069
"one == two"
>>
>>53921075
is the location of jakarta and both politically and economically dominant within indonesia containing over 50% of the population in spite of being only the fourth largest island in the country.
>>
>>53921137
so close, but yet so far.
String reversed = new StringBuilder(str).reverse().toString();
>>
>>53921069
I'm in a c++ mood right now

bool stringEq(std::string one, std::string two){
bool flag = false;
int count = 0;
for(int i = 0; i < one.length(); ++i) if(one[i] == two[i]) ++count;
if(count == one.length()) flag = true;
return flag;
}
>>
Is this bad practice?
The mode enum also serves as the argument number to check for.
    /* determine query mode */
pmode_t mode;
if (argc == 1)
mode = NO_QUERY_MODE;
else
{
mode = (!strcmp(argv[1], "-i")) ? CASE_AGNOSTIC : CASE_SENSITIVE;
if (!validate_query(argv[mode]))
return 1;
}
>>
>>53920985
That's stupid though, because only an autist round do that, since a normal person would realise that he implicitly meant to reverse any string.
>>
>>53921137
Using a string builder is not necessary a new string is just fine
>>
>>53921165

I'll be honest, I really don't program in java much. Thanks though, I'll remember that.

>>53921199

http://c2.com/cgi/wiki?ShlemielThePainter
>>
Why is it in programming everything starts a 0? It is so stupid and confusing since naturally humans are taught everything starts at one everything should be replaced starting at the number one
>>
>>53921333
Because arrays are built on the concept of a Base (starting location) and an index (offset into the array). For an array starting ad 0x1234, the first element is at 0x1234 + 0, the next at 0x1234 + 1 = 0x1235, etc
>>
>>53921166
well memed
>>
>>53921369
the starting location should be 1
>>
>>53921333
1) we are not taught that. our number is system is base 10. we have 10 digits. 0-9.
2) 0 is off. remember to think of transistors making up the binary calculations as lightbulbs.
on is 1. there are only two functions.
3) 0 is necessary. before there was Creation there was necessarily nothing.
>>
>>53921333
Switch to Lua :)
>>
>>53921333
Because 0 exists in computers. 0 in real life means nothing, but on computers how do you represent nothing? By blowing up a memory block? It starts at 0 because 0 exists. It's not confusing at all to think as 0 as the first position.
>>
>>53921392
Why?
>>
>>53921392
>>53921403
>>53921405
logically and mathematically it makes more sense for the first position to be 1 not zero
>>
>>53921418
It's increasing clear you just don't understand how memory is addressed.
>>
>>53920018
nowhere atm.

you can google browser #110, but it might not work anymore.
>>
>>53921333

Some languages exist that start indices at 1. In general, however, this is bad. We don't need to introduce extra subtraction instructions or extra bytes of unused memory.

We start things at 0 because it's equivalent to adding the index times the size of the object to a base pointer. In C, if I have some char pointer or array s, if I ask for s[0], I am looking for the character pointed at by s. If I ask for s[1], I am looking for the character located at address s+1, and so on.

It's most efficient for the machine.

>>53921392

Programs that are efficient use less CPU cycles. When less CPU cycles are used, the operating system can let the CPU be idle for longer. When the CPU is less idle for longer, less electricity is used. When less electricity is used, less coal and oil are burned. When less coal and oil are burned, the ecological damage we are inflicting upon the Earth is reduced.

Every individual sub instruction necessary to calculate an array offset just because you wanted to start arrays at 1 would add up. Eat shit, Anon.
>>
>>53921418
Think about it this way, 9 is the 10 number in a base 10 system. That's mathematically accurate. 0 is the 1st number in a base 10 system. Make sense??
>>
>>53920827
void reverseString(string& str) {
for (unsigned int e = str.length() - 1; e >= str.length() / 2; e--) {
if (str.length() % 2 != 0 && e == str.length() / 2)
break;
//else
str[e] = str[e] xor str[str.length() - (e+1)];
str[str.length() - (e+1)] = str[str.length() - (e+1)] xor str[e];
str[e] = str[e] xor str[str.length() - (e+1)];
}
}
>>
File: 1459858143590.jpg (737 KB, 1090x1500) Image search: [Google]
1459858143590.jpg
737 KB, 1090x1500
>>53917850
This is why I roll my own.
>>
how do I get a programming job lads?
>>
>>53921449
I still want it to be at 1 it makes more sense to me

>>53921453
So far logically this is the best answer that makes more sense but I still want it to start at index 1
>>
>>53921514

>I still want it to be at 1
The world doesn't revolve around you.

>>53921477

Anon, don't xor swap characters. I think we've already gone over why this is bad.
>>
>>53921541
You are correct the world revolves around lewd ruby images
>>
>>53921514
You'll have to accept the fact if you want to do anything in programming. 0x0 is the first address in memory. Everything revolves around this fact.
>>
>>53921392
>>53921418
fuck off fucking retard
>>
>>53921571
Why can't the first address in memory be changed to 0x1
>>
Is there an IDE for javascript?
I got a huge pile of js dumbed on me and I was told to fix it but I don't know anything about it, would be really useful to have context based autocomplete and quick jump to functions etc.
Does something like that exist or should I write my own for vim?
>>
File: Network_data_flow_through_kernel.png (993 KB, 3489x1952) Image search: [Google]
Network_data_flow_through_kernel.png
993 KB, 3489x1952
>>
>>53921609
U G L Y
G
L
Y
>>
>>53921592
arrays are basically syntactic sugar for
*(pointer + offset)


and it feels completely natural for all algorithms etc that you'd use arrays for
>>
>>53921600
Notepad++?
It has syntax highlight, contextual autocomplete and with hoykeys you can jump between functions.
>>
>>53917850
Hey guys, how do I greentext?
>>
>>53921600
theres a javascript editor inside google docs thats pretty solid also (which is also about the only time you should ever use javascript)
>>
>>53921600
Visual Studio Code, if you want something lightweight.
>>
>>53921592
>>53921392
>>53921418
Its that way because of offsets, Pajeet.

>Some location in memory: X
>X + 1 would be the byte right after it.

So if X is an Array and you want the first item, it's X. Technically X(+0). If you want the second item it's X(+1).

Tldr learn more low level pajeet
>>
>>53921562

No lewd images for you, Anon!

And when did I ever say I gave out lewd images anyways? I said I had another thread for "doing lewd things". You need to learn not to extrapolate too much on these things.
>>
>>53921592
what do you do with 0x0 then? if you start at 1 you've wasted space.

If you really can't accept it just read this sentence again until you do.
>>
>>53921683
there shouldn't be an 0x0
memory should start 1 too
>>
>>53921645
>
>>
>>53920508
One of the better idea's I heard on /g/, I might do this myself. What language are you doing this in?
>>
>>53921592
Not sure if you're trolling or retarded
>>
>>53921693
should integers start at 1 too? so there is no 0?
>>
>>53921634
>>53921656
>>53921660
It is a rather big project so I was looking for something more serious tools.
I am not going to install windows just to browse through the code, I would rather keep using grep as I do now.
Thread replies: 255
Thread images: 38

banner
banner
[Boards: 3 / a / aco / adv / an / asp / b / biz / c / cgl / ck / cm / co / d / diy / e / fa / fit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mu / n / news / o / out / p / po / pol / qa / r / r9k / s / s4s / sci / soc / sp / t / tg / toy / trash / trv / tv / u / v / vg / vp / vr / w / wg / wsg / wsr / x / y] [Home]

All trademarks and copyrights on this page are owned by their respective parties. Images uploaded are the responsibility of the Poster. Comments are owned by the Poster.
If a post contains personal/copyrighted/illegal content you can contact me at [email protected] with that post and thread number and it will be removed as soon as possible.
DMCA Content Takedown via dmca.com
All images are hosted on imgur.com, send takedown notices to them.
This is a 4chan archive - all of the content originated from them. If you need IP information for a Poster - you need to contact them. This website shows only archived content.