[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
/dpt/ - 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: 16
File: it's a trap.png (873 KB, 1275x677) Image search: [Google]
it's a trap.png
873 KB, 1275x677
Previous thread - >>55118523

What are you working on, /g/?
>>
>>55123856
First for composable continuations!
>>
>>55123856
That's a cute girl.
>>
>>55123856
optimising my parser
>>
>>55123856
Extracting some boilerplate into a 'toolbox' class that I can use in all of my projects.
>>
>>55123880
>girl
>>
File: sub2.png (45 KB, 1236x583) Image search: [Google]
sub2.png
45 KB, 1236x583
Trying to figure out what the fuck is going on here.
>>
I have nothing to work on, give an idea /dpt/
>>
nth for brainfuck being greatest lisp clone

++++[++++>---<]>++.-[--->+<
]>++.++++++.+++[->+++<]>.++
+++++++++++.[-->+++++<]>+++
.[->+++<]>+.-[->+++<]>.+[--
--->+<]>+.+++++++.--------.
-----------.+++.+++++++++++
++.[-->+<]>+.[-->+<]>+++.>>
>>,.[-<+<+>>]++++++++++.--[
-<------>]+[[-]<[-<.-<+>>]+
+++++++++.[-]<<-[->+>+>+<<<
]>>>]
>>
>>55123908
dank meme generator
>>
>>55123908
Write an online video game in machine language.
>>
File: haskell.png (354 KB, 905x460) Image search: [Google]
haskell.png
354 KB, 905x460
>>55123876
You're talking about Monads?
>>
>>55123908
Cellular automaton, make up your own neat rules.
Maybe a war type thing, where two armies start on each side and charge towards each other. Incorporate special units which have the ability to differ from the regular soldiers which just run straight forward.

>>55123923
Shouldn't you be in school?
>>
Spent some time working on procfs parser and reverse engineering some old ass binaries that required me to bootstrap GCC 3 and now I have to do some webshit for work, shit sucks yo.
>>
>>55123928
>Shouldn't you be in school?
I'm sorry, I forgot that we were not allowed to post playful replies on /dpt/. Do you want to downvote me and call a moderator to lock my reply chain for being off-topic, dear StackOverflow autist?
>>
>>55123856
I'm working on a chip8 simulator. Right now doing testing to make sure everything works as expected
>>
>>55123904
Anyone? Why aren't the red and yellow the correct size? They should be split right down the middle.
>>
>>55123959
Playful reply, read, shitpost.
>>
>>55123985
Shitposts are not intrinsically bad. They are part of our "culture", whether you like them or not.
>>
>>55124000
Autism incarnate.
Follow the trail of redpills.
>>
>>55124010
The redpills are just chocolate tic-tacs in the rabbit hole of retardation.
>>
daily reminder: don't argue about C in the presence of the big dick playa unless you want to gag on a thick dick
the rape never ends, shits!
>>
>>55123928
schools got out yesterday
>>
>>55123983
you probably fucked your vertex positions. double check them.

try drawing your triangles 1 by 1 and see if they are correct
>>
>>55124010
Can you control yourself long enough to form a coherent sentence, autist?
>>
>>55124026
C is for women and Indians.

Real first-world men use better languages.
>>
gtihub.com/deeepaaa/hachidori

notice me
>>
>>55124042
>C
>Indians
lol hƿæt
>>
Anyone know the best way to solo learn C++?

Any sites like codecademy which are particularly good or youtube series or..?
>>
>>55124062
nice desktop icons
bad link
>>
>>55124091
http://www.cplusplus.com/doc/tutorial/
>>
>>55124091
cppreference
any book by bjarne stroustrup or scott myers
lots of practice
>>
>>55124034
My vertex positions are there on the screen in viewportVBO2.

They are
-1.0f,1.0f,0.0f,  1.0f,1.0f,0.0f,
0.5f,1.0f,0.0f, 1.0f,1.0f,0.0f,
-1.0f,-1.0f,0.0f, 1.0f,1.0f,0.0f,

0.5f,1.0f,0.0f, 1.0f,1.0f,0.0f,
-1.0f,-1.0f,0.0f, 1.0f,1.0f,0.0f,
0.5f,-1.0f,0.0f, 1.0f,1.0f,0.0f,

0.5f,1.0f,0.0f, 1.0f,0.0f,0.0f,
1.0f,1.0f,0.0f, 1.0f,0.0f,0.0f,
0.5f,-1.0f,0.0f, 1.0f,0.0f,0.0f,


And my vertex shader attribute is attribute size: 3, vertex size: 6, offset: 0. With the other half being colours. The colour attribute is also in that image in that format.
>>
>>55124094
>>55124062
fuck my life

github.com/deeepaaa/hachidori
>>
>>55124104
And in your opinion is this the best way?>>55124114
Thanks I'll hunt for some books
>>
>>55124091
Assuming you already know programming, just read "A Tour of C++"
>>
>>55124094
Paper icon theme

https://github.com/snwh/paper-icon-theme
>>
>>55124116
Oh wait, I fucking see it never mind. It's always a fucking retard mistake that never shows itself until you've shown other people your retardation.
>>
>maintaining old and undocumented php code which uses undocumented C extensions and I don't have the C source code
Send help or kill me here, I just want out of this ride
>>
>>55124129
Kind of, I'm a computer security and forensics graduate and I winged the programming modules, so I'm probably worse off as a result because I really should be starting for scratch and learn all the terminology and things again.

I need it for a few jobs I've applied for
>>
>>55124152
Tell your employer its proprietary garbage and you refuse to work with it, for your own sake and the company's.

pic related: no it's not. Hoarders just don't want to help their neighbors. That's not good. Join us now.
>>
>>55124116
output looks OK to me for those positions. your viewport is not correct, that is why red triangle so so narrow. (width should be half of its height) and you have a yellow rectangle.

what were you trying to do?

as i said, draw them one by one and see what did you wrong
>>
File: Average.png (81 KB, 587x419) Image search: [Google]
Average.png
81 KB, 587x419
This is supposed to give someone the average of the 5 numbers that are entered into the calculator but its not calculating correctly. Anyone know what's wrong?
>>
File: sub3.png (6 KB, 378x179) Image search: [Google]
sub3.png
6 KB, 378x179
>>55124176
It's okay I got it. 0.5 should have been 0.

It was a classic case of tard blindness.
>>
>>55124203
What is order of operations?
It looks like you are dividing the last score by five, instead of summing all of them and then dividing due to the paren placement.

Also I miss VB.
>>
>>55124203
>Anyone know what's wrong?
Yeah, you're not using Python.
>>
>>55124042
>I got raped too many times
I know you did :^)
>>
>>55124165
In that case, I'd go with "Programming -- Principles and Practice Using C++"
Also, be careful following online tutorials as alot of them teach outdated techniques that no longer apply to modern c++
>>
>>55124203
Wrap all of your test scores in parenthesis.

You're dividing the last score by 5.

Goddamn, you're fucking dumb.
>>
I just replaced one important std::vector<> with std::deque<>. Execution time went from 5.5 seconds to 0.08 seconds and that's in unoptimized build. Optimized timings went from 0.3 seconds to 0.05 seconds. I was prepared for a multi-hour battle to try and coax more speed out of the system, but all I did was change one line and that was it.

Again shows the importance of using the right data structure. deque cannot always replace vector, but if all you're doing is appending at the end and removing from the beginning and you need O(1) random access, then deque is for you.
>>
>>55124226
>I miss VB
Went from that to C#.

I have never looked back. Fuck VB.
>>
>>55124295
>I was prepared for a multi-hour battle to try and coax more speed out of the system, but all I did was change one line and that was it.
This is why you never optimize until you get the project solidified.

99% of optimizations are due to very small common-sense things, like doing a buffer, and then doing I/O, rather than I/O on a loop.
>>
>>55124308
I suppose I mostly just miss BASIC in general. Just a nostalgia thing I guess.
>>
>>55124295
>but if all you're doing is appending at the end and removing from the beginning and you need O(1) random access, then deque is for you.
wow, who would have though

>removing from std::vector's beginning
back to the python
>>
>>55124226
the five scores are integers and the answer should be displayed as a decimal, such as 80.5
>>
>>55124347
Holy shit, kill yourself if you can't read the thread or figure this out.

Two anons have told you EXACTLY what you are doing wrong.
>>
>>55124347
Yes, that is all well and good. But you are not averaging.
You are doing
score1 + score2 + score3 + score4 + score5 / 5


And what you need is
(score1 + score2 + score3 + score4 + score5) / 5


I really hope this is clear enough, or you should go back to remedial math and learn about averages.
>>
Sup /dpt/, what text editor do you guys like to use?
www.strawpoll.me/10508463/
>>
>>55124410
Ed
>>
>>55124270
Thanks man
>>
>>55124410
Whoops, clicked on acme rather than atom
Captcha's fault
>>
Working on an application that pulls data from db related to search query.

Can anyone help me out with this? Im trying to print out all the values from a list that are between two values. Here is my code so far.

searchq = 3001
#else:
#sys.exit()


nums = []

for r in results:
if 2400 < searchq and searchq < 3600:
nums.append(r['numbers'])
print nums < 2800
>>
>>55124588
"nums < 2800" is a boolean expression, so it will print out either True or False.
for i in nums:
if i < 2800:
print i
>>
Abstract algebra is pretty cool

Anyone know any really good resources for it, both mathematical and programming oriented?
>>
>>55124661
I am actually trying to pull out the numbers from the list called:

r["numbers"]
>>
>>55124717
So each result has a list of numbers and you want to print only those that are less than 2800?
>>
>>55123856
Switched to Ubuntu because I want to learn sonething new and also I want my root rights.

>Windows 10 does not even allow you to upgrade a tablet's firmware. I had to use Win7 for it.

Also learning Java alongside with C# and C++.
>>
>>55124785
correct, these are house numbers, so i want to print all of the house numbers that are greater then 2000 and less then 3000 for example.
>>
>>55124824
So like this:
print([n for r in results for n in r['numbers'] if n < 2800])
>>
>>55124890
>print([n for r in results for n in r['numbers'] if n < 2800])

THANK YOU!
>>
>>55124803
That seems like a lot of languages to tackle at once, but maybe you're a quicker study than I am.
>>
>be phd student
>spend two weeks writing and debugging a python script to process my data
>it managed to churn through all of it in five hours
>feel proud
>show it off to postdoc at the lab
>he proceeds to do the same thing in five minutes with essentially a Bash one-liner (several pipes and process substitution plus some extra lines, but the bulk of the work was a one-liner)
>it processes all the data in 30 minutes and produces the same results

what should I do I feel terrible now

the smug bastard just left
>>
>>55124919
I had experience with C# before and it is very similiar to Java so it is easy. I picked C++ because my friends(yes they exists :^) ) and I agree that we pick up this one for a group project.
>>
>>55124961
was your python script faster then the bash one-liner?
>>
>>55124961
Phd
>Why
>>
>>55124961
get good fag
>>
>>55124988
You failed your reading tests growing up, didn't you?
>>
>>55124988
he said 5 hours
>>
>>55125016
oops, read that wrong

sorry :(
>>
File: PhD in Incompetence.png (125 KB, 813x600) Image search: [Google]
PhD in Incompetence.png
125 KB, 813x600
>>55124961
You have brought shame to /dpt/
Complete sudoku immediately
>>
>>55125040
Saved. Will repost it every single thread from now on.
>>
>>55125040
>
a.set(i, j);


Why not just
a[i] = j;
?
>>
>>55125077
ssshhhh
>>
>>55124961
Wow, I would probably just kill myself.
>>
>>55125068
You're doing God's work
>>
>>55125077
java
>>
>>55125113
That doesn't explain why two different forms of the same operation are happening.
>>
>>55125077
>>55125096
>>55125113
Agreed, there's a
a[j] = temp
just below, so this means there's Java®
syntactic sugar for that, no? So why use it only half-assedly?
>>
>>55125122
a[anything] would be invalid in java. there is no syntactic sugar.
>>
>>55125141
Huh? What's happen
>>
>>55124295
>using a vector as a queue
>queue did the job better
Who would've thought
>>
>>55125153
error: array required, but ArrayList<Integer> found
>>
>>55125172
Okrite. Guess graduate meme was being retarded. ty
>>
The code in the image was >>54777355
>>
>>55124988
No, it was literally ten times slower.

>>55124990
I want to be cool like postdoc-senpai.

>>55125006
>>55125040
>>55125103
please don't bully me friends I'm suffering enough as it is

I will spend this weekend rethinking my life choices
>>
Still a bit stuck, im trying to now pull out the addresses that match the numbers in the range.

"""Search query"""
searchq = 2800
minnum = searchq - 100
maxnum = searchq + 100


"""Finds numbers between two"""
print([n for r in results for n in r['numbers'] if minnum < n < maxnum])


"""Pulls out address matching num"""
for r in results:
if n in r['numbers']:
print r['co_address']


output I am getting:
[2751, 2736]
3001 HENNEPIN AVE # 1310
[Finished in 0.198s]

The list [co_address] matches up with the numbers in [numbers]. How can I make it print out all the addresses within the two numbers listed above?
>>
>>55125196
https://archive.rebeccablacktech.com/g/thread/S54776509#p54777355
>>
File: out fucking skilled.jpg (313 KB, 4685x2457) Image search: [Google]
out fucking skilled.jpg
313 KB, 4685x2457
>>55124961
On the bright side you probably made his day.
>>
what do you guys look for in a secure chat system?
>>
>>55125231
not needing to interact with people
>>
Here's an old classic

https://archive.rebeccablacktech.com/g/thread/S51488679#p51488714
>>
>>55125231
the ability to chat
>>
>>55125231
A breathalyzer.
>>
>>55125231
security
>>
>>55124961
I've been in that situation before while learning, when I was helping someone else to learn the reverse happened. It's to be expected that the mentor knows better than you but don't forget you'll be on par with them one day.
>>
>>55125231
4chan, but open source and not web browser needed.
>>
>>55125229
Yeah he did seem smug about it.

>>55125268
Did it feel good to crush a young man's self-esteem?

Did you hear a faint snap from the depth of his soul?

Just curious.
>>
>>55125303
So you aren't just a bad coder, but you've also got a weak soul?
>>
>>55125201
So you have a numbers list and a co_address list, and related values are at matching indexes right? You can iterate with the index like that:
for n, i in zip(results, itertools.count(0)):
print(n, r['co_address'][index])

which requires importing itertools. I remember there being a shortcut, but maybe I'm mixing it up with another language... Quite sure of that actually.

On a side note: fuck this
x for a in b
in python, it becomes unreadable when nested. Just go for everything is an expression ffs!
>>
>>55125268
>don't forget you'll be on par with them one day.
that is a lie though. one guy works 2 weeks on some thing and other one accomplishes it on 5 minutes and does it even better? OP is a bad programmer and will be a failure no matter what.

I gave some lab courses at university, some people just can't do it. no matter how willing they are
>>
>>55125303
also

>don't forget you'll be on par with them one day.
There's no guarantee of that. I might well suck forever and/or drop out and/or off myself yet. Plus I'm nearing the end of the second year of my PhD and still suck.

Hell, the postdoc has a fucking biology and maths background while I have a BSc in Compsci.

>>55125317
Clearly.
>>
>>55125343
Just remember, you might not be able to do but at least you can try to try to do
>>
>>55125303
Maybe programming is not for you?

Just become one of those braindead instructors and you will be fine
>>
>he doesn't get erections when working with lambda expressions
>>
>>55125339
substitute
 results
for
 r['numbers']
, sorry.
>>
>>55125343
>I have a BSc in Compsci
the memes are real
>>
>>55125231
why bother rewriting Tox or SSL IRC? Why do people in this thread feel the need to always reinvent the wheel?
>>
>>55125303
>Did it feel good to crush a young man's self-esteem?
You should be fucking excited when someone shows you up.

This is your chance to be better.

THIS IS YOUR CHANCE TO LEARN.

Holy shit, this new generation of pansy, fragile "men" is pathetic.
>>
>>55125339
NameError: name 'index' is not defined

I imported itertools
>>
>>55125358
Heh, fresh off the boat from C, kid? [ TODO: finish copypasta ]
>>
>>55125303
I wasn't discouraged when it happened to me, I realized then that the person above me has been doing this for years where I had been doing it for months. I made sure to mention it to the person I was helping too
>don't get discouraged, I have been in the same situation, I have much more experience with this and your solution is fine

This kind of sentiment should be true in all forms of teaching, students and teachers need to be humble and understanding, if you're not you're probably going to suffer self imposed stress or doubt which will only make things worse.

>>55125340
I guess it's not true for everyone but still something like that isn't even that fair. The original person wrote something new in Python, the teacher is just stringing together existing tools. My judgment on this situation depends heavily on the context. If the student was under restrictions, lacked knowledge of tools, etc. It would be hard of me to fault someone for not knowing the existence of a tool and it's one of the reasons we have teams in practice.
>do you know of a an existing solution to this problem? If not I'm going to make one
>>
>>55125377
Which you can substitute for i, because it's supposed to come from the for loop. Sorry.

Also don't miss >>55125359
>>
>>55125399
lol thank you, after applying all the changes you told me im looking at this:

[2751, 2736]
(3001, '3')
[Finished in 0.214s]
>>
>>55125370
I know bash man, and I understand how his script works after studying it for a while.

I also know I will probably never hear a problem explained to me and proceed to scratch my head and bang out a line with six pipes and sed regexp sorcery to solve it. There's just no way. It looked like a warlock casting a spell. Which demons do I have to sign a blood pact with to do it?
>>
>>55125343
>Plus I'm nearing the end of the second year of my PhD and still suck.
You only suck at things that are new to you, you should realize how vast this field is. Most of the professional programmers I know are willing to admit they're shit and so am I, there is always room for improvement and someone will always know more than you about something.

Your problems are not your skill but your perspective, you need to be more rationale. If you're egotistical think of how much more you know than those below you in experience.
>>
>>55125418
>Which demons do I have to sign a blood pact with to do it?
Wait, did you think the trap thing was a meme?

Go buy a fucking skirt.
>>
>>55125408
just in case you want to see it all,

http://pastebin.com/sCKn1n1R
>>
>>55125408
And what are you going to do? Are you asking me a question? In this case I'm not in your mind man, provide a sample dataset so I get why co_address doesn't contain "HENNEPIN AVE". Or you can finish your program yourself if you're able to now, but just say I'm done on the thread.
>>
>>55125388
He is a second year CS PhD, he should already know about gnu utilities for processing stuff.

And even then, what kind of magic tool his instructors used in 5 mins but he could only replicate same functionality on python in two weeks? He sounds like a lousy programmer looking for a patting on his head
>>
>>55125462
Sorry, im good, it wont even print out the address list anymore haha

[/code]

It should be pulling out all the addresses that start with the numbers pulled out in the line of code above.
>>
>>55125491
PhD is in Chemometrics, not CS.

My BSc was in CS.
>>
When working with C I always find myself trying to recreate the features I've used in C++. Am I doing it wrong? Should I just go back to C++?
>>
>>55125367
Because you learn when you reinvent the wheel. Before using something, you should have an understanding of how something works.
>>
anybody have a tutorial for importing obj and mtl files into opengl?
>>
>>55124697
https://www.amazon.com/Book-Abstract-Algebra-Second-Mathematics/dp/0486474178
>>
>>55125432
kys
>>
>>55125798
like what?
>>
>>55125231
Serverless, distributed discovery protocol and full encryption.
>>
>>55125231
emotes
>>
>>55126174
heartily seconded
>>
>>55125231
I personally like secure chat systems where the author is law enforcement friendly ;)
>>
>>55126174
>Serverless, distributed discovery protocol
sounds like it leaks your IP
>>
>>55125358
I get erections from benchmarks.
>>
Starting off my file manager project. I had a basic implementation working in HTML and CSS, but I got sick and tired of that shit. So I want to create an API and CLI client instead. My objective is to make it fast, secure and simple to use. Requests are stateless and one serve a single purpose. Complexity is up to the client.
I'll be using Go, but I'm not sure how to serialize the data between the client and server. Protobuf is faster/smaller, but JSON makes it easier to debug. Protobuf requires a 3rd party library, while JSON is built-in. Protobuf makes it easy to share the model between applications, but taints the application with protobuf specific code. What does /dpt/ think?
>>
>>55126336
Good point.
>>
>>55125993
Nothing wrong with it, just don't get carried away with metaprogramming in preprocessor macros.
>>
>>55126487
I've mused over the exact same topic and decided Protobuf is not that much better than gzipped JSON to take away human readability. It's also a huge library and painfully slow in the browser.
>>
>>55126688
What about speed? Isn't gzip compression relatively slow?
>>
>>55124134
>>55124034
>>55123904

Don't worry, we all know those feels.

Was doing some byteswapping lately, and wondered why the fuck the return value came out exactly the same as the input. I didn't notice that I had returned the input integer until half an hour later.
>>
>>55126752
Good point. I did not consider gzip time, because it's native in the browser. Might be more relevant, when both systems are communicating with native Protobuf implementations.
>>
>>55126767
Didn't you debug your application a single time for that whole one and a half hour? Check lines one by line and see it is correct until return input?
>>
>>55126821

Just 30 minutes. The problem is that I was completely ignoring the return value because I just assumed that it was correct, and so I ended up sitting in gdb tearing my hair out when every single function worked exactly like it should work, yet when back in main() the output to terminal showed a completely incorrect value.

It was after I had made some changes and forgotten to change the return value, but yes, I am retarded.
>>
>>55123925
Funny way to spell first-order multimonadic effects.
>>
>>55123856
hi anons
never did SQL/php , tring to get a JSON back
 $sql =**my query;

$result = mysql_query($sql);

while($r = mysql_fetch_assoc($result)) $rows[] = $r;
print json_encode($rows);



i get
 mysql_fetch_assoc() expects parameter 1 to be resource, boolean given in *while($r = mysql_fetch_assoc($result)) $rows[] = $r;*
>>
>>55126998
Effect systems are just a meme
>>
>>55126336
Easy solution, make it serverless, distributed, end-to-end encrypted discovery and delivery protocol.
>>
what did you guys major in? I selected computer science as my major but since i'm just taking the prerequisite classes now (calc, physics, etc.) i can still switch if i need to. i just want to be a code monkey
>>
>>55127077
>serverless, distributed
leaks your IP
>>
>>55127019
what about you google your problems you faggot?
>>
>>55127077
>end-to-end encrypted discovery
You are unaware of the meaning of one (or more) of those words, aren't you?
>>
>>55127299
already searched m8
>>
>>55127019
Enjoy your injections!
>>
>>55127270
I'm currently majoring in InfoSec
I kind of wish I did CS, but it also landed me a nice job so I can't complain
>>
>>55127282
Yes, but it's unlinkable to your identity.

>>55127300
Of course, I meant to apply that to delivery only.
>>
>>55127330
thanks
>>
Is perl a dead language? I know nothing about programming but I have this strange fascination with perl.
>>
>>55127418
Check out Perl 6.
>>
>>55127438
It's shit.
>>55127418
No. Perl is great.
>>
File: image.jpg (3 KB, 300x57) Image search: [Google]
image.jpg
3 KB, 300x57
>>55127446
your shit
>>
>>55127458
>another tripfag
When will it end?
>>
>>55127458
My shit?
We don't need more retarded tripfags, thanks. Kindly fuck off.
>>
>>55127520
>more
I've been here longer than the fucking DPT, you insufferable newfag.
>>
SQL problem
Any idea of a reason why last_insert_id() wouldn't return anything at all ?

I don't have any problem in my table since I can select the last entry with its Id.
>>
>>55127539
Who the fuck cares?
>>
>>55127609
I-I thought maybe you would, A-Anon-kun ;_;
>>
>>55127539
thank you for posting with a trip that I can filter, tripfag
>>
>>55125197
>I want to be cool like postdoc-senpai.
grow out your neckbeard
>>
Why did no one tell me it was literally this easy?

using (var dc = new DataContext(connectionString))
{
tickets = dc.ExecuteQuery<Ticket>(query).ToList();
}


Provide connection string and a class object and you can suck a database table into a list of objects really fucking fast without worrying about conversions or any other bullshit.
>>
>>55127605
What's the type of the PK?
>>
>>55127672
as opposed to a tripfag that can't be filtered?
>>
what is the point of encryption when your cpu is backdoor, your OS keeps caches of all files defeating the secret files, etc?
>>
>>55127964
You give the warm and fuzzy feeling of false securitay.
>>
>>55127997
>You give
Fucking auto-correct, "it gives".
>>
>>55127921
int
>>
>>55127964
And how would a hacker gain access to the cache?
>>
>>55128081
>what is paging
>>
>>55128081
he could gain important docs or incriminating data if its a fed

>>55127964
This is why full disk encryption is the recommended thing to do when locking down your files.
>>
>>55128020
Show me the create statement.
>>
Currently reading through Nick Parlante's crash course on pointers and memory in C.
http://cslibrary.stanford.edu/102/PointersAndMemory.pdf

I recommend all of his materials for anyone needing a refresher or additional info -- it's good stuff.
>>
>>55127913
does something like this exist for c++?
>>
>>55124961

You need to kill him before anyone finds out your shame.
>>
File: clover-archive.png (5 KB, 512x512) Image search: [Google]
clover-archive.png
5 KB, 512x512
I made a Chrome extension that archives 4chan threads.
At the time I started this project, no archiving system worked very well and most broke reply quotelinks (which are generated by JS btw) or other functionality.
This system aims to archive 4chan threads as perfectly as possible by downloading the original CSS/JS and modifying them for local viewing.
It hasn't been tested on every single board and on every single kind of thread, but it seems to work perfectly right now.
It uses the beautiful chrome notifications by the way.
Only thing is I have to warn you, it can crash your browser if the thread is big and you try downloading full images.
I actually started this in dec 2014 (and posted about it here), but after getting it to work in late jan 2015 and after a while of testing, a change in the way 4chan works broke its core functionality (it still downloaded original images though since it uses the API), I got frustrated and gave up until recently.
It works fine now and it's better (especially since all requests are async now).

Here's this thread archived a couple minutes ago as a test:
https://a.uguu.se/UfiRSSxFt6iO_g-55123856-dpt-daily-programming-thread.7z
As you can see you can even change 4chan's settings (image expansion, quote expansion etc) and it will work as if it was online.

https://github.com/reasv/Chrome-Thread-Archiver
>>
what do you guys think of my floor function?

typedef unsigned long long ull;
typedef long double ld;

ull floor(ld x) {
for (ull i = 0; i < x+1; i++) {
if (i+1 > x)
return i;
}
};
>>
I pretty much took this code right out of a textbook so I don't really understand what's wrong here. The man page for stat seems to agree with my code as well...

#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>

struct stat statbuf;
mode_t modes;

// expected declaration specifiers or '...' before string constant
stat("tracks.cdb",&statbuf);
// initializer element is not constant
modes = statbuf.st_mode;
>>
File: 1389426763683.jpg (27 KB, 345x395) Image search: [Google]
1389426763683.jpg
27 KB, 345x395
>>55128440
>typedef
>for
>return
pic related

>>55128447
You gonna have to put that in a function, son.
>>
>>55128470
holy fucking shit time for a break
>>
>>55128470
what's wrong with typedef, for and return? I'm pretty much a novice on C++
>>
can someone help me understand pointers a bit more

the examples in the pointer section of some c++ learning site show examples of using them, passing an address to a pointer variable then dereferencing it to pass the value into the address the pointer is pointing to, which I fully understand, but I don't understand why you would do this. What is the use of pointers when you could just assign a value straight into the variable you want instead of creating a pointer to the address then derefencing it to store a value to the same variable anyway?
>>
>>55128447
Which book?
>>
File: sdf.jpg (359 KB, 1172x894) Image search: [Google]
sdf.jpg
359 KB, 1172x894
>>55128498
here you go
>>
>>55128513
Beginning Linux Programming 4th edition. It's chapter 3 on System Calls. As the guy below me pointed out though, there's nothing really wrong with my syntax, didn't put it in main....
>>
>>55128498
pointers make a great work if the size if the object you are going to use may vary. Other wise you would be overwriting data. When using pointers the "stored" size is always the same (an addres), what changes is what is being pointed.
>>
>>55128396
really nice
>>
>>55128488
They're obsolete. They're actually going to be removed in the next standard C++17.
>>
>>55128559
Are they getting rid of if statements too? Those have always been a cancer on programming.
>>
>>55128586
Yeah, C++17 is going to be pure functional.
>>
>>55128559
source?
>>
>>55128599
Good to hear that, it was about time. It's going to be 2017 after all.
>>
Task: implement a unit -> unit function that does nothing in a language of your choice

Haskell: f () = ()
C++: void f(){}
Java: public static class A{ public static void f(){}; }
>>
/g/ can't average two 64 bit integers in Rust.
>>
>>55128722
>>
>>55124091
C++ is the easiest language to learn just read cppreference if you haven't mastered the basics within the first day you should just give up
>>
>>55128722
func f(){}
>>
>>55128722
>unit -> unit function
I literally don't understand what this means even after looking at the examples.
>>
File: 1460752551846.png (138 KB, 237x270) Image search: [Google]
1460752551846.png
138 KB, 237x270
>>55128743
not a function
>>
>>55128722

def fucntion():
pass
>>
>>55128774
as far as you care:
takes nothing does nothing returns nothing
>>
>>55128777
It is in my favourite language.
Also checked.
>>
File: ss+(2016-06-17+at+01.43.00).png (15 KB, 730x248) Image search: [Google]
ss+(2016-06-17+at+01.43.00).png
15 KB, 730x248
>>55128547
so one of the examples the site has is pic related, it would still be the same if you just assigned numbers[0] through numbers[4] to 10, 20, 30, 40, 50 respectively

pointers just reduce the amount of memory used if I were to pass one into a function? Like if I had some large sized object I could perform functions and operations on in a method I'd just increase performance by creating a pointer instead of copying it for the method? That makes more sense on their usefulness, thanks
>>
>>55128599
>pure functional
As if anything could be
>>
>>55128722
What does 'does nothing' even mean?

Here's one in typed λ-calculus:
λ(x:1). x
>>
>>55128599
[WAKE ME UP]

pls no C++ has been trying to cuck itself when it realized no one cares about it's updates anymore. No one I know uses C++14 and sure as fuk no one is going to use C++17
>>
>>55128819
Well it's not actually nothing, it's a singleton type
>>
>>55128788
why would "takes nothing returns nothing" be called
>unit -> unit
is it because "nothing" is considered the base "unit"?
>>
>>55128862
>>55128843
>>
>>55128829
>No one I know uses C++14
Really? It's pretty popular around here.

>>55128843
One might also say THE singleton type. But what does it mean to 'do nothing'? I'd wager it entirely depends on the semantics of the language. Would you accept the λ-calculus solution?
>>
>>55128886
very well but you could at least name it
>>
>>55123856
Monitoring shit at work and reading this
http://conference.scipy.org/proceedings/SciPy2009/paper_1/full_text.pdf
>>
>>55128901
There are no names in pure lambda calc.
>>
>>55128808
This really doesn't demonstrate their usefulness. In fact your way may be more efficient. I don't really think arrays are a good way to understand their usefulness, put that seems like a good exercise at least.
>>
>>55128918
(\function -> ...........)(\(x:())->())
>>
>>55128886
Around where
>>
>>55128935
That wouldn't be a 1 → 1 function anymore.
>>
>>55128958
i didn't say the entire thing had to evaluate to a function, just to define a function
>>
>>55128958
fyi () is the single value of the unit type in haskell and ML

>>55128975
plus the first part could be
\function -> function
>>
>>55128722

Ruby:
def f
end


It actually does return a value though. In Ruby, everything is an expression, and with functions, the return value is the result of the last expression in the function. If none exist, the default return value is nil, which is an object just like everything else in Ruby, and you can send it messages and such. That said, nil is supposed to represent "nothing", and so would be Ruby's equivalent to unit (except as an argument, since passing nil as an argument would be different than passing nothing).
>>
>>55129013
Unit is a type with a single value
i.e. unit = { () }
so a unit -> unit function takes a unit and returns a unit
(in a pure language, it can only do nothing)

Everything being an expression just means it's an expression based language like Haskell or ML or nearly every FP language.

That said it's weird as fuck that you return nil but you don't call with it. Bad for composability.
>>
>>55128218
Sorry for the late answer.
There it is but I doubt that it can be of any help.


CREATE TABLE Employe(
Id int (11) Auto_increment NOT NULL ,
Nom Varchar (30),
Prenom Varchar (30),
Adresse Varchar (50),
IdVille Int,
PRIMARY KEY (Id )
);

>>
>>55129133
Looks fine frenchfag. Sorry, can't help you any further.
>>
>>55128829

C++17 isn't going to remove features; you're being trolled. C++14 doesn't see much use because it's very young and the features it adds are mostly of the sort that you wouldn't necessarily need. C++11 is starting to see more use, however.

>>55129075

You know, now that you mention it, Ruby does have the prefix * operator, normally used with arrays, for function composition. It effectively applies the elements of the array as arguments to a function. So if I had a function g that took two arguments, I could do this:

x = [1, 2]
g *x # equivalent to g 1, 2


When the * operator is used with an empty array or nil, the result is as if the function were called with no arguments. When any other value is used, it is as if the function were called with one argument, which is that object.

So I guess you can do some function composition, like so:

f *f
>>
>>55129199
>C++17 isn't going to remove features; you're being trolled.
Fuck off white knight tripfag.
>>
>>55129172
Damn.
I'm just gonna go with SELECT MAX(Id) FROM employe; since it returns the value I need but still. This shit is a fucking mistery to me.
>>
>>55129199
> C++14 doesn't see much use

it probably will soon.
gnu++14
GNU dialect of -std=c++14. This is the default for C++ code
>>
>>55129199
C++11 & 14 are the worst things ever to happen to C++
I know one day I'm going to come into work and find some enormous module composed entirely of unintelligible generic auto lambdas
>>
>program in java a lot as a time sink
>just now discover lambda functions
Have I been living under a rock?
>>
>>55129415
Nah, it's pretty new in the Java world. Android still hasn't caught up to Java 8.
>>
;normal binary division
ASL $FD
LDA #$00
ROL

LDX #$08
.loop1
CMP $FC
BCC *+4
SBC $FC
ROL $FD
ROL
DEX
BNE .loop1

LDX #$08
.loop2
CMP $FC
BCC *+4
SBC $FC
ROL $FE
ASL
DEX
BNE .loop2
>>
So I'm trying to right a game with C right now and I'm not sure how to implement game states. At the moment I'm using function pointers but it's kind of messy to be honest. Is there a better way to do this other than using a fat switch statement?
>>
>>55129392

It will be more intelligible than if templates were used.
>>
>>55129541
Hacker code used to steal nude photos! Stay away!
>>
>>55128808
If you want good exercises for practicing pointers make queues, double linked queues and circular queues.
>>
>>55128498
A good example is a large image. When you want to do some kind of processing over said image (say, make it black and white), which would you rather do: send the function a reference to that image object in the form of a pointer, or allocate a new image sized space in memory, copy over every pixel, do the processing you want on this 'copy', then copy each of the modified pixels in the image object back to the original one. Not second method not only consumes more spaces, but it has to iterate over all the pixels of the image multiple times, which is very time inefficient. If you had just passed the function a reference (pointer) to the image object, you have no more space consumed than the size of the pointer, and only need to iterate over the original images pixels once (applying the processing).
>>
>>55129392
every language can be abused to do retarded things.
>>
What's the equivalent to html-xml-utils for perl?

I tried WWW:Mechanize but I don't see anywhere that uses CSS selectors and thats crucial for what I'm doing.
>>
>>55129800
so how about writing regular code, then?
you know, the kind of code that also produces readable compile errors if something goes wrong
>>
>>55129642

Eh, function pointers seem like they could be managed without too much mess.

struct game_state;
extern struct game_state *first_state;
typedef struct game_state* (*update_func)(struct game_state *self);

struct game_state {
void *data;
update_func update;
};

void game_loop(void)
{
struct game_state *state = first_state;
while (1) {
state = state->update(state);
}
}


Basically every state object will have a pointer to its own state data structure, and a visitor function to be called whenever the game state needs to be updated.

>>55130150

1. Clang will give you your readable compiler errors.
2. You don't have to make everything generic.
Thread replies: 255
Thread images: 16

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.