[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: 32
File: tumblr_nb1u3l2b4O1rprfy4o3_1280.jpg (337 KB, 1280x1449) Image search: [Google]
tumblr_nb1u3l2b4O1rprfy4o3_1280.jpg
337 KB, 1280x1449
Old thread: >>51653845

What are you working on, /g/?
>>
Himegoto was shit and you trapfags should kill yourselves.
>>
File: ruby.png (89 KB, 959x833) Image search: [Google]
ruby.png
89 KB, 959x833
First for OOP scripting
>>
>>51660641
>expecting help from people whose jobs you're trying to steal

When will the curryniggers learn?
>>
You sure you want to do this, OP? I really suggest deleting the thread and making a new one.
>>
>>51660640

Am I supposed to cast my mallocs or is this simply done to maintain compatibility with C++?

like
object *obj = (object *) malloc(sizeof(object) * size);
>>
>>51660705
I'm almost sure that you don't have to cast malloc in C but yuo have to in C++. So yeah the latter.
>>
>>51660705
C++ compatibility. Actually there are better reasons to NOT cast malloc.
>>
>>51660734
let's see
>qt anime gril screenshot
>tired pics of old codgers

Really, do you hate cute things?
>>
If you could crossbreed any two programming languages, which ones would you pick; and what would you call the offspring?
>>
>>51660756
>gril
>>
>>51660756
mcfucking mckill yourself
>>
>>51660761
Lua and D, I'd call it Lucifer.
>>
>>51660761
Java and python

I'd call it TAKETHEPOO2THELOO
>>
>>51660761
Lisp and C
I call it Gen-2
>>
>>51660761
Javascript and Php :^)
>>
>>51660810
python isn't for curryniggers, it's for ADD shitkids
>>
Why do so many people believe C is an ancient and outmoded language?
Most programming languages look identical to C give or take some boilerplate.
>>
Why do people still use Java when Scala exists
>>
When subtracting numbers from registers in the ALU, do people usually do (A-B) (Input 1 - Input 2) or (B-A) (Input 2 - Input 1)?
>>
>>51660899
They draw from C, yes, but at the same time they provide other abstractions that make it easier to work with the language and features that save a lot of programmer's time while also providing a more expanded and safer standard library.
>>
How do you feel guys that your superior language doesn't generate $ for you?

You can talk shit about this and that language all day.
>>
>>51660761
haskell + scala

maximum autism
>>
Took a C class, but how do I get good?

This is my current plan:

K&R->SICP->Introduction to Algorithms->Contribute to open source project
>>
>>51660973
Haskala

it deserves to happen
>>
I have a table with a lot of foreign keys. When I insert into this table, I want to check to make sure that the foreign keys exist, ie insert a row into the foreign key's table if one doesn't already exist.

Which is the better way to do this (or am i missing the best way?):
A) INSERT OR IGNORE into all of the foreign key tables every time I insert into the table
B) do a try/catch, catch a failed foreign key constraint and insert then

It takes about 3x longer to do the INSERT OR IGNORE, but the try/catch feels hacky and gross
>>
>>51660999
>Contribute to open source project
Stick to your own pet projects before trying to contribute to something else.
You'll probably be overwhelmed by the complexity of non-trivial programs.
>>
>>51660999
K&R -> read mpv source code -> contribute to mpv -> profit
>>
>>51660761
C and Java
I'd call it C#
>>
>>51660761
C+++
>>
>>51660705
malloc returns a null pointer in C, so you have to cast it to the type you actually want.
For example:
int *v = (int *)malloc(n * sizeof(int));

allocates memory for a vector of n integers.
>>
File: 161017757_44042348.jpg (67 KB, 590x632) Image search: [Google]
161017757_44042348.jpg
67 KB, 590x632
>>51661334
>a null pointer in C
>>
real dpt here

>>51660709
>>51660709
>>51660709
>>
>>51661334
void pointer you nigger and you cast it in C++, not required in C
>>
>>51661334
You're fucking retarded. Read K&R last week and thinks he knows what he's talking about
>>
>>51661334
whoops, I meant a void pointer, a null pointer is what you get if malloc can't find enough memory.
>>
>>51660920
SBT is literally unusable.
>>
ops image would look good on their knees. even has handles
>>
how DO I get gud at C
I heard K&R is a meme
>>
>>51661390
>>51661386
You're right, guess I need to thank my fucking C/C++ professors
>>
>>51661584
Use Learn C The Hard Way
>>
>>51661599
were they Pajeets?
>>
https://www.fsf.org/appeal/

I hope you'll all be giving something.

We need the FSF.
>>
>>51661584
I used C programming: a modern approach from King.
It's a very thourough book.

You should read K&R only AFTER you learned C.
>>
http://pastie.org/private/40lahdhhvo0q51tdcwd6tg

Download from hebe board on 8 channel.

>>51661584
Write more C.

K&R is an excellent book. However it assumes you're experienced in programming those difficult 1960s languages already. Maybe read C Primer Plus, or start out with a different language if you're just beginning. Do not use any of the Learn x the Hard Way books.
>>
>>51661634
Starting with Python is a good idea, since you can grasp the basic concepts of programming quick and then easily move to C
>>
File: 1438790653225.png (80 KB, 397x400) Image search: [Google]
1438790653225.png
80 KB, 397x400
>>51661668
>recommending python, a dynamically typed, garbage collected, slow as fuck, "Just werks", reddit tier language to people who want to learn C, the next abstraction layer up from assembly
>>
>>51661634
Oh, heh. Programming exercise: spot the bug in my bash program. (You don't have to know anything about 8 channel to find it.)
>>
>>51661634
>FBI: The Post
>>
>>51661668
no fuck python
>>
Building a Magic: The Gathering client in c++ using Winsock and Open GL.

If anyone happens to know enough about those things combined, any brilliant ideas for serializing board states using minimal bandwidth?
>>
File: 1448815081009-3.jpg (81 KB, 578x960) Image search: [Google]
1448815081009-3.jpg
81 KB, 578x960
http://pastie.org/private/xfcqvargmv35reehgj4evq

Fixed 8 channel downloader.

>>51661761
I genuinely appreciate teenage girls and have a 17 year old girlfriend.

>>51661809
Python is excellent. Get version 3.
>>
>>51661851
json
>>
>>51661736
to be fair, python is the least "just werks" of most if not all hgi level scripting languages

>reddit tier language
what the fuck does that even mean
i want this meme to end
>>
>>51661872

JSON and XML were the obvious choices but since I don't need to be compatible with anything else in existence I figured I'd come up with something that shaves a few bytes off. Probably not the best use of time desu.
>>
>>51661886
just make it abstractable and leave this problem for later, you got bigger issues to deal with right now if you're gonna create a networked game using opengl
>>
>>51661897
Basically everything is already abstracted into "Sockets Helper", "UI Helper", etc

My biggest problem right now is how in the fuck did desu get added to the end of my post.

None of the network stuff particularly worries me. Currently trying to invent some manner of scripting language to write cards in (Card Script is my genius working name) that would make adding all the damn cards that exist nice and easy / able to be done by any idiot.
>>
>>51661851
Protobuf
>>
>>51661947
>My biggest problem right now is how in the fuck did desu get added to the end of my post.
Stupid new 4chan filters.

>None of the network stuff particularly worries me. Currently trying to invent some manner of scripting language to write cards in (Card Script is my genius working name) that would make adding all the damn cards that exist nice and easy / able to be done by any idiot.
Why not embedded Lua? The JIT is really fast and it's really easy to write in.
>>
>>51661947
unless you really WANT to write your own scripting language, id suggest using lua or python.
and if you want some advice, look into the composition pattern for handling card effects
start working on that gameboard state because everything else will just be implementation details after you're finished with that
>>
>>51661969

When I say scripting language what I meant was some manner of "compiler" that would take plain english descriptions such as "ETB: tap target creature" in a text file and be able to turn these into a card database for the server to use

I plan to distribute this at some point and can't include cards/art directly for copyright reasons so I want to make it super easy for the "average person" to
A: make their own DB of cards
B: be able to dick around with custom cards if they want for fun.

some understanding of copyright law would be super useful.

XMage (https://github.com/magefree/mage) seems to get away with just not including card images, I haven't bothered to look at how they deal with actual card implementations.

Generally not a fan of the Java Swing UI they're using and to a lesser extent not that big on RMI either so I'm using my uni break to write my own implementation to avoid boredom.
>>
>>51660705
It's not just C++, the early C standards required the cast as well, like C80 or before or some shit so there's really no need.
>>
>>51660665
That crystal makes me cringe
>>
>>51661736
>recommending c, the next abstraction layer uo from assembly to a beginner
>>
File: 150x150 map.webm (2 MB, 1185x596) Image search: [Google]
150x150 map.webm
2 MB, 1185x596
I wish webmcam would stop trimming random chunks of my video.
Why does every webm based application suck ass?
Can freetards get ANYTHING right?
>>
>>51662172
all a beginner needs is variables (WITH EXPLICIT TYPES), control flow and basic functions. you could use java but really C is just cleaner because you don't need the OOP and "verbosity" (fuck you FAGGOTS for making me use that word) right away
>>
File: leavemealone.webm (372 KB, 400x300) Image search: [Google]
leavemealone.webm
372 KB, 400x300
Ask your beloved programming literate anything.
>>
>>51662223
>all a beginner needs is variables (WITH EXPLICIT TYPES),
Did you mean implicit? Why should a beginner worry about irrelevant stuff like variable type?
>>
>>51662252
HOLY SHIT GO DIE IN A FIRE FUCKING SHITKID
>>
>>51662259
>OOP is too verbose
>somehow having to declare variable types for every variable isn't too verbose for a beginner when he could just type a name and a value
>>
>>51662276
IF YOU WANT TO LEARN ANYTHING ABOUT PROGRAMMING YOU SHOULD KNOW WHAT A FUCKING INT IS AND WHAT A FLOAT IS AND SO ON AND IT'S NOT FUCKING MAGIC YOU'RE DOING SIMPLE OPERATIONS ON SETS OF BINARY BITS
>>
rm -rf /* will fuck things up but what does rm * do?
>>
>>51662289
It's funny seeing how many autistic people there are on 4chan

I wonder how much vagina you see with such a strong opinion about binary bits?
>>
>>51662320
>>
>>51662209
Also, does anybody have any of their own map generators I can test this on?

the conditions are basically:
wall:   0
floor: 1
the map must be bordered by a 2 pixel wide border
map must be connected


Although if your map isn't one that connects, tell me, and I'll just connectify it for you.

I might as well turn this into a roguelike at some point, so I'll probably add door usage sometime soon.

Actually, fuck, I'll do even better: I'll turn this into an automatic roguelike.
Fuck, no, even better than that:
A roguelike where you compete with a computer to
A: survive the longest
B: finish first
>>
>>51662223
>all a beginner needs is variables (WITH EXPLICIT TYPES), control flow and basic functions
lel, k tard.
>>
>>51662380
yeah they definitely need abs() divmod() input() open() staticmethod()
all() enumerate() int() ord() str()
any() eval() isinstance() pow() sum()
basestring() execfile() issubclass() print() super()
bin() file() iter() property() tuple()
bool() filter() len() range() type()
bytearray() float() list() raw_input() unichr()
callable() format() locals() reduce() unicode()
chr() frozenset() long() reload() vars()
classmethod() getattr() map() repr() xrange()
cmp() globals() max() reversed() zip()
compile() hasattr() memoryview() round() __import__()
complex() hash() min() set()
delattr() help() next() setattr()
dict() hex() object() slice()
dir() id() oct() sorted()
>>
>>51662380
explicit types are important so the user knows what is happening.
No random crashees because python decided to treat your variable as a string in one specific instance and nowhere else.
>>
>>51662394
types are not even fundamental to programming (Lambda Calculus), you fucking uneducated pleb, programming is not even about computer in first place, that's why C is one of the most disgusting programming languages for learning. take a computer science class or read sicp some time.
>>
File: 1430853197680.png (331 KB, 474x432) Image search: [Google]
1430853197680.png
331 KB, 474x432
>>51662432
>>>/reddit/
>>
>>51662394
What about a middle ground ?

Static typing with compiler type-inference

Look at Scala's type system. It's really fucking cool.
>>
>>51662432
>programming is not about computer science
Who said it was?
If you follow the thread up, the person was asking about programming, not compsci :^)
>>
>>51662455
that actually sounds great. I'm just mainly against the idea of not being able to specify a type at all, and having to jump through hoops to check types.
>>
>>51662459
where in my reply have you read computer science ? are you really this retarded ? please don't be this retarded.
>>
>>51662495
you've gotten comp sci and programming mixed up if you don't think your post is talking about comp sci
>>
>>51662507
i was referring to computers, the machines, not to computer science. and for your information, programming IS part computer science. please now refrain from posting, it's painful.
>>
>>51662526
you have out-autismed me. congratulations, anon.
>>
>>51662289
But they will know what an int is, what a float is, what a string is, what an array is and whatever else, they just won't have the type notations getting in their way, making it easier for them (i.e. not overly verbose for a beginner).
>>
>>51662546
if they're literally 5 years old or have severe ADD it might be a problem to type types.
>>
>>51662495
whoops, I misread computer as computer science.
2tired2sick
>>
>>51662432
>computer programming is not even about computer in first place
>>
Someone suggested to me yesterday that I switch from VB for my first project to using C#. I literally just started a fresh project and found that the simple act of creating an XML file is a hundred times more complex.

Why on earth did someone suggest this?
>>
>>51662610
they're brainwashed microsoft shills. use java instead.
>>
>>51662610
They're brainwashed Microsoft shills, use C++ with PugiXML instead.
>>
How do I get a programming job?
>>
>>51662610
>Someone suggested to me yesterday that I switch from VB for my first project to using C#
That guy is a fucking genius.
>>
>>51662625
Build an ebin github account :DDDD
>>
>>51662623
>guy uses visual basic
>C# is too complex
>use C++ instead
>>
File: 2ea.jpg (11 KB, 200x291) Image search: [Google]
2ea.jpg
11 KB, 200x291
>>51662617
>Java
No thanks, I don't want to have to skin myself alive just to get some relief.

>>51662623
I need to use visual studio, because it's the easiest way to create a UI and make everything Just Work(tm). There's a default xml system in place, it's just a tonne more complex than it was in VB.

>>51662630
Clearly not, because this is now far harder and has completely handicapped me.
>>
>>51662643
>No thanks, I don't want to have to skin myself alive just to get some relief.
epic meme!

>I need to use visual studio
>this is now far harder and has completely handicapped me
suit yourself
>>
>>51662652
Well unless you can suggest a DE that can build GUI's as simply as visual studio can, that would also make my life easier, then I don't see how I'm wrong.
>>
>tfw doing swift
Why is swift such a piece of shit.
It's like, badjava.
>>
>>51662666
QtDesigner
>>
>>51662666
http://www.eclipse.org/windowbuilder/
>>
>>51662643
>Clearly not, because this is now far harder and has completely handicapped me.
At least it's a way more useful skill than VB.
>>
>>51662691
>C++
>Javascript
Pass.

>>51662681
How is this any better?
I'd still be writing in C#, I'm not sure how a DE change will make any difference.

>>51662691
True enough.
>>
>>51662707
java != javascript
>>
>>51662718
When the entire argument is about which language is best, and what DE isn't shit, I think it's beyond me.

I don't know why I find this so insanely hard, I'm sure I understand the concepts of programming, but settling on what to use seems to be 99% of the issue.

Which one would be the best for the generation of xml files using inputs on a GUI and then also use those inputs to create folders/move files.
Also I need to use maps/dictionaries in order to store values.

Which language would best suit all of that.
>>
>>51662707
C# is pretty easy, honestly. I'd expect even someone with only VB experience to bea ble to pick it up pretty easily. I think the WYSIWG editor in Visual Studio is pretty good so you shouldn't have to actually fiddle with XML too much, just drag and drop?

Ignore the naysayers. If you're writing a windows program, there is literally no reason to not use either C# or C++ and develop with Visual Studio. It makes life much easier.
>>
>>51662707
Never said C# is the BEST skill. It's better than VB. Only a fool would not choose Go as the superior programming language.
>>
I'm bored. Anyone have any Python questions/problems? I'm up for anything, who needs help?
>>
>>51662787
Why'd you learn such a shitty language, and not a fast one, like C or C++?
>>
>>51662786
>Only a fool would not choose Go as the superior programming language.
m8...
>>51662787
10/10
>>
>>51662796

Who said that I didn't learn C or C++? I use Python at my agency and really love it, it is a blast to code in and you can do some pretty cool stuff in a short amount of time.

I bet you don't even program.
>>
>>51662787
Why is python so awesome?
>>
>>51662787
I do
1. How shit is codecademy
2. Why'd you do python
3. Is python a meme language?
>>
>>51662823
>forced indents
>>
File: py.png (45 KB, 800x800) Image search: [Google]
py.png
45 KB, 800x800
>>51662787
how do I choose between Python and Ruby?
>>
>>51662823
Functional programming has all the benefits of shitty scripting languages like Python (i.e., small code size, relatively fast to write) AND it'll usually compile to code that's comparable to efficient C/C++ code.

Again, why would you choose Python over Haskell or Racket?
>>
>>51662849
>finger typing
>>
>>51662787
what's the best python IDE?
>>
>>51662824

FIOC and polymorphism. :^)

>>51662834
>1. How shit is codeacademy

I'm not too familiar with that site, but I generally recommend against those types of online course-based learning approaches (especially if you have to pay). Books and experience are always superior.

>2. Why'd you do python

Honestly, I chose it on a whim as the language of choice for my agency (about 9 years ago now). I heard good things at the time and it seemed like it had a bright future. I've been incredibly happy with my decision.

>3. Is python a meme language?

I tend to think anyone who uses the word "meme" in this way is retarded.

>>51662854

Build the same thing in both and you will find out why Python is better.

>>51662855

Once again, it doesn't sound like you actually code.

>>51662880

PyCharm is what some of my employees seem to like, but I prefer good ole vim.
>>
>>51662916
>I heard good things at the time and it seemed like it had a bright future. I've been incredibly happy with my decision.

Pythonfags, everyone. Enjoy your great concurrency support.
>>
>>51660640
Whats the best IDE for java?
>Inb4 java is fuggin shit x'DDDDD
>inb4 Muh hipster frameworks / functional programming x'DDD ;PpPP ;^)
>>
>>51662973
IntelliJ with IdeaVim is decent.
>>
>>51662973
Eclipse
>>
>>51662916
>not using Emacs for Python

If you're going to use a shitty interpreted language, at least do so in an editor with amazing REPL support.

Opinion discarded.
>>
Finally decided to use C# and just get on with it.

But obviously things are a lot less simple now, how does one write a foreach (file in folder) loop?

I'm not sure how to iterate in C# at all.
>>
>>51662973
eclipse
>>
>>51663062
                display_ACTIVEFOLDER.Text = folderBrowserDialog.SelectedPath;
foreach (int element in Directory.GetFiles(display_ACTIVEFOLDER.Text))
{
file = System.IO.Path.GetFileName(folderBrowserDialog.SelectedPath);
listBox_CAT.Items.Add(file);
}


Can someone tell me how much of a retard I am and how I would do this in a way that actually makes sense (currently the foreach says "can't convert type string to int")
>>
>>51663153
Change int to var.
>>
>>51663164
Done, but why?

I'd like to know why I was being retarded.
>>
>>51663170
>Directory.GetFiles(display_ACTIVEFOLDER.Text
Returns strings, not ints.
>>
>>51663187
This is probably a question with far too long an answer to expect a decent response, but how would I best create a way to give the selected files a category, then have them be displayed with that category, then add a description to the category and be able to call on that category in future and the filenames/description contained within it.

I understand I'd have to use a Dictionary, but beyond that I'm a bit lost. Not sure how I'd go about organising the dictionary in a way that I'd be able to edit on the fly.

This is an image of the UI I currently have, it seems awfully convoluted and pretty user unfriendly.
>>
File: ss+(2015-12-03+at+10.36.43).png (5 KB, 450x375) Image search: [Google]
ss+(2015-12-03+at+10.36.43).png
5 KB, 450x375
>>51663264
Forgot image.
>>
>>51662610

Have you ever noticed there's pretty much no shitposting about VB, ever?

Ask yourself why.
>>
>>51663164
change it to string you disgusting nigger
>>
>>51663293
But I'm using C#....
>>
>>51662240
where do you get all these webms from.
>>
>>51660756
Don't be an idiot. You know it's bait with the tumblr filename.
>>
File: squisioir1h.webm (223 KB, 720x404) Image search: [Google]
squisioir1h.webm
223 KB, 720x404
>>51663310
Thank you for your question (though not programming related). I get the webms from the usual meme producers (4chan, reddit, tumbler, japan, neogaf ,...)
>>
>>51663264
There're a million of ways to do this. The proper solution depends on how you iterate throught the data.
One way is to create a dictionary with the category as key and a list of file names as values. This way you get fast lookup times for finding files for a specific category. If you want to look up the categories for a specific file (assuming it can be tagged with multiple categories), the lookup time would be a disaster.
>>
Is there any way to apply Python's indentation-delimited blocks to other languages? C# for example. Say, via a preprocessor or an editor plugin?
>>
>>51663361
Yeah that's what I'm trying to do, I want each category to create a dictionary with the category on the left being used as the key and however mane filenames associated, and I want to force the filenames to only be associated to one category at a time. Removing the association would be as simple as removing the dictionary with the selected category key.

It seems like a highly complex and convoluted mess to me, there really doesn't seem to be a simpler way to display and enter the data that doesn't involve me writing a paragraph on it's usage.
>>
>>51663389
It's not that complex. If you want to list all files by category, do something like this:
for (pair in map) {
for (file in pair.value) {
// handle file
}
}

Looking up files for a specific category would look something like this:
for (file in map[key].value) {
// handle file
}
>>
>>51663434
Damn that looks a lot more confusing than I would've hoped. Still don't particularly understand.

Is there a nice neat way to create a dictionary entry with just a key and then add values to it later? I want to be able to use the listbox to display the dictionary keys so I can more easily delete the entry with that key.

Once I know how to do this all I have to do is parse the information in the dictionary to create an xml file and move the files into the created folders.

Storing data seems to be an insanely difficult task, because I want to store so many different types of data is it worth creating a temporary text file or something to hold it all in?

Need to be able to store, change or remove the category name, the associated filenames and a description.
>>
File: tumblr_l1wsx1R94S1qzmowao1_500.jpg (225 KB, 500x541) Image search: [Google]
tumblr_l1wsx1R94S1qzmowao1_500.jpg
225 KB, 500x541
Trying to implement the gspan algorithm for analyzing subgraph frequencies. Pic related. Anyone got any tips?
>>
File: oreimo.jpg (12 KB, 230x219) Image search: [Google]
oreimo.jpg
12 KB, 230x219
Sup, guys. I'd like to know the best guide to C++ programming. I tried googling but it returned so many results that I thought it would be more efficient asking you nerds. I have a little experience with Java, Javascript, Python and some C. What book or tutorial you did to make understand C++ better, /dpt/?

Also, I heard that if I start wearing girl clothes I will really get better at programming. Is that true? I mean, I'm asking for a friend.
>>
I'm currently learning Java and I'm thinking about applying for internships after I heard that some coders inside companies didn't even know how to make a FizzBuzz. Is this true or just a meme? That's because I thougth that programmers/coders were like very knowledgeble and demi-gods of the computers if you know what I mean.
>>
In Java will I have any problems if I have many threads reading and writing onto an array if the writing is in a synchronized function?

In my situation I would be using a few threads to read an index unique to itself and then write to it. Each thread will only read/write on an index that has no other thread using it, after every thread has written once they all read a new random unique index all together and write again. I'm wondering if there will be a problem reading/writing since the array they are sharing is not volatile/atomic. So far I see no problem from printing it a few times between a few iterations but I'm still worried.
>>
>>51663613
http://en.cppreference.com/w/cpp/language

>Also, I heard that if I start wearing girl clothes I will really get better at programming. Is that true? I mean, I'm asking for a friend.
only if you're programming in haskell
>>
Anyone here competent enough with C# to deal with an utter fucking retard whining at them for a while? Post some way to contact you, skype, steam or something like that.

I'm completely lost and clearly need a hand or I'm not gonna get anywhere.
>>
File: 1430758470020.jpg (751 KB, 1100x1050) Image search: [Google]
1430758470020.jpg
751 KB, 1100x1050
>>51663613
>>
File: stangor-fig09_007.jpg (170 KB, 1648x691) Image search: [Google]
stangor-fig09_007.jpg
170 KB, 1648x691
>>51663640
normies in any profession are mostly stupid as hell
>>
>>51663601
Add a new entry to the dictionary with as value an empty list. You'll be able to add files later on to the list.
I wouldn't bother with tmp files right now. Just leave it in memory and make it just work (tm) first.
>>
>>51663670
Add a synchronization block on the array, not the writer.
>>
File: sd31ghiz.jpg (314 KB, 1648x691) Image search: [Google]
sd31ghiz.jpg
314 KB, 1648x691
>>51663743
>posting outdated information
>>
>>51663670
they will still see the correct value in the array if they lock on the same monitor when reading the index.

also the array doesn't need to be volatile because it's just the reference to the array that becomes volatile, which is useless if it's always the same array and the reference is already known to each thread
>>
>>51663831
Why would I trust the chart made by somebody somebody who's IQ is less than 55?
>>
>>51663842
>somebody somebody
Because you just proved it right.
>>
>>51663870
I reworded part of my sentence and forgot to remove the duplicate word.
For some reason, your perception seems to skip over those sorts of things when checking your post.
>>
>>51663870
Not noticing:
>who's
>>
>>51663870
>who's IQ
y-you too
>>
>>51663798
I still have absolutely no idea how to create a dictionary with a key and an empty list as the string. That's all I'm struggling with at the moment.

Because I need it to hold 3 values, the key is the category name (which I hopefully can actually call later on), the filenames associated and then the long string of text that makes up the description.

It seems like what I want to do is the most complex thing in the world right now.
>>
>>51663723
I'll help you, but I'm not putting anything that can be connected to me on here.

Post your steam.
>>
This may be a bit of a stupid question. I've inherited/taken over development of an open source app; the current automatic update process uses HTTP downloads to transfer the updated files from a shared dropbox link. Unfortunately, the project's become popular enough that I'm able to overload the 100,000 daily hit limit on my account with an update that touches ten or more files. The project itself compresses down to about 3MB, but I'd prefer to retain the current individual file update method if possible. Anyone know of a free service that can be used instead of dropbox?
>>
>>51662973
Use intellij idea. Community edition is free an actually uses javac for compiling and not some internal compiler shit like eclipse.
>>
>>51663918
>open source app

Use github's Releases feature.
>>
>>51663918
Can't you just distribute shit using git?
>>
>>51663910
http://steamcommunity.com/id/sirdoombox
>>
>>51663930
>>51663927
That's what I'm doing, but I don't want to force users to replace their entire folder if I update an XML file. I mean if I have to I can just change the current system to check if there's a new release at github and offer a prompt to download, but if there's an option that preserves the current system that would be nice.
>>
>>51663900
Wrap the file name and description into a single object. Some the object should contain the field fileName and description.
>>
File: ffmpeg.png (156 KB, 400x400) Image search: [Google]
ffmpeg.png
156 KB, 400x400
Why is the documentation for libav* so terrible? Can anyone point me to anything that would help me figure out how to transcode audio files?
>>
>>51663900
dude, it's literally a vending machine. Quit making mountains out of molehills. These data structures are made to help with making data retrievals faster and easier not more complicated for keeping hackers out. That is what closure is about.

dictionary.add( key, value );
>>
>>51663954
A github release can have more than one file in it.
>>
>>51664038
Like I said, it's a stupid problem that doesn't really need to be one. Currently I use appveyor to do the unstable builds, then package up the binary folder for the proper release. If possible I'd like to retain the current update code that allows for only updating the changed files.
https://github.com/chummer5a/chummer5a
>>
File: 1394320974569.gif (2 MB, 260x260) Image search: [Google]
1394320974569.gif
2 MB, 260x260
Since sqg is almost kill, I'll post here, hope that someone will help SQLite newbie.

I'm trying to get values from SQLite Database in my Android App which are in between some dates. They are stored in long values.

Throwing everything inside whereClause works fine, but I know that it can be dangerous thank to injection attacks. What I can't get my head around is how to properly use whereArgs.

This is my working-but-vulnerable whereClause:

whereClause += DreamTable.Cols.DATE + " BETWEEN " + jsonArrayDates.getLong(0) + " AND " + jsonArrayDates.getLong(1)


When I do it like this:

whereClause += DreamTable.Cols.DATE + " BETWEEN ? AND ?";

whereArgsArray.add(jsonArrayDates.getLong(0) + "");
whereArgsArray.add(jsonArrayDates.getLong(1) + "");


and then
whereArgs = whereArgsArray.toArray(new String[whereArgsArray.size()]);


It gives me big fucking nothing, no values. Help me plx, senpaitachi desu wa.
>>
File: itseasy.png (93 KB, 1920x1051) Image search: [Google]
itseasy.png
93 KB, 1920x1051
>>51662643

XML In C# is really easy.

There are better ways like Linq which look nicer but in no way is this xml hard.

Also if you have problems StackOverflow is great because 99% someones had that problem if not ask a question on there.
>>
can someone explain instance variables in Java to me ?
>>
>>51664084
The only problem is that your existing update code assumes the... wait a second. I've never seen anyone use negative version numbers before. It's like the version numbers are counting down to some critical release event.

Anyway, it assumes the individual files are always at the same location in the dropbox folder, rather than in a different location each release as with GH releases. If you want to take the brutal approach, you can use github pages instead of github releases, and then check all of your binaries into your gh-pages branch.

But honestly, maybe you should just redo your update code. It looks like crap.
>>
>>51664228
each object instance of a class has its own "non-static" variables called instance variables. if you set a variable in an instance method to a certain value then the value will only apply to that particular object. if you set a static variable to a certain value then it will apply to all objects because there is only one static variable accessed statically through the class.
>>
>>51664261
>this would never happen with python.png
nope, because python is no good for serious applications
>>
Lua is so fucking good. I don't think I hate myself right now after spending an hour hammering out a project with some slick iterators. And it works with all test cases I've got and it's lightning quick too.
Why isn't there more love for this little language? It's got this really pleasing consistency of all its features since it's really just tables all the way down.
>>
SQL question:

When I create a function where you have to enter several values.
Can I insert these values into several tables ?
Like two "INSERT INTO" one after the other ?
>>
>>51664261
Heh. It's not my code, I just inherited it. Originally the negative numbers were a test naming convention and I never bothered to update it. These just I just discount it by five every time I update. I guess changing the update code to just pull down the latest proper release will do the job as well as the current system does, just with a bit less granularity.
>>
>>51663368
do you mean like a linter?
lots of editors have plugins for them
>>
>>51662113
it's nice enough for shell scripting. has wrappers for most posix apis and such. lack of parallelism sucks donkey balls though.
>>
>>51664200
>Throwing everything inside whereClause works fine, but I know that it can be dangerous thank to injection attacks
Why would you care about local-only SQL-i? I.e. in queries that won't go outside of the phone, just used internally?
>>
>>51660999
>think of something you want to make
>make it
ezpz
>>
>>51664478
Not in a single query. You can do that within a single transaction, however.
>>
>>51664676
Well, I think it's all about making good habits. I'll be, probably, making some webapp in the future, so why not learn now how to do it the proper way?

Also, I'm curious why it doesn't work.

Thanks for no answer.
>>
>>51664763
>I'll be, probably, making some webapp in the future, so why not learn now how to do it the proper way?
When you get to that point you will use an ORM library instead of being a nigger picking the cotton and writing queries manually and worrying about them being not safe. So it's not really a habit to learn.
>>
>>51664770
I'll look into it, thanks anon.
>>
>>51664770
Man you just had to bring race into it. Stay classy, /g/
>>
>>51664713
I'm not familiar with transactions.
But forget about inserting into two different tables.
I got the shit wrong. What I really need to do is inserting a single value into two different tables.
For example I insert some value in table named "room". I have to insert the idRoom into the room table but also in the table "available".
That's where I block
>>
>>51664895
Why would you have a separate table for that instead of just another column in the room? Then you could just:
INSERT INTO `room` (`id`, `available`) VALUES("some id", 1);
>>
>have to make a small change in every function in every controller in the entire company application (over 30)
just fucking kill me
>>
>>51664920
This, it would be better design to let 'availible' be an attribute of the room.
>>
File: 1333.png (3 KB, 469x447) Image search: [Google]
1333.png
3 KB, 469x447
how would you implement hooks in plugins /g/? currently i have System and Plugin
>System sends message to Plugin
>Plugin handles it
and i want it
>system send message to hook object
>hook decides if it want to handle it
>if not, it sends it to plugin
problem appears when i have multiple hooks, what should happen? lets say hook1 handled data, should hook2 get to process this data? im confused here, what the logical answer, what would you expect developing such hooks?
>inb4 just be jourself
>>
My college is giving out a small cash prize to 10 people who can come up with ideas for apps(desktop or mobile) that would be useful for the institution.

Can you please share some interesting ideas? Thanks
>>
>>51664996
Add priority to the hooks so you know which order you want to pass the data to them. Then have the callback function return a boolean, if a hook returns true it means that the next hook is allowed to get the data, if it returns false then it blocks further propagation.
>>
>>51664979
Regex that shit nigga
>>
>>51665019
>the institution
What institution?
>>
>>51660761
PHP and Haskel.

I'd call it Where is your God now?
>>
who here /ruff victory/
>>
File: coropata.webm (177 KB, 608x304) Image search: [Google]
coropata.webm
177 KB, 608x304
Got things about to where they were before remodelling.
>>
>>51665045

the college itself
>>
>>51665129
School shooting detector.
>>
>>51660761
php and C++ so i can fucking have typed functions and variable hints

>tfw 45K per annul
PHP4LYF
>>
>>51660761
B and C. I'd call it D.
>>
>>51664920
The database is already created and I can't modify it. That's a test requirement. But I tought of the same thing as you.
Anyway, any idea on how I should do that ?
>>
Making a PowerShell script to automatically sync my library to Opus on my phone.

Problem is that my phone can't into internal mass storage without rooting, so I can't sync the files directly onto my phone (since Windows can't into mounting MTP as a filesystem).
>>
How do I know a socket has received everything that was sent?
>>
>>51665024
after rethinking multiple possibilities i know that theres no good answer to my problem
>priority
what if two hooks have the same priority? order could be unspecified.
i was also thinking about registering hook to specific message type, and allowing only one hook per type but this wont work too because i need multiple hooks per type, and multiple types per hook.

ill probably send it to all hooks and let the god decide what happen next
>>
fixing my 4chan app so you faggots will stop bitching about it
>>
>>51665382
Post it fag.
>>
>>51665368
google "checksum"
>>
>>51660761
rust and scala.

I'd call it Σ
>>
>>51665407
You misunderstood me. When working with sockets in Python, the TCP headers and all that are skipped, you just get the messages.
So is there a way to find out if you've gotten everything?
>>
File: iconobject.png (18 KB, 300x300) Image search: [Google]
iconobject.png
18 KB, 300x300
>>51665399

try the app store m8
>>
>>51665442
Send EOF or close the connection/send FIN.

TCP is reliable, either you got everything or an error. Excluding malicious intents.
>>
>>51665491
I'd do that, but I'm connecting to a FTP server and it doesn't seem to send those.
The thing is, I'm currently sending LIST, and that works well. But when I send a second LIST, it just bitches the data connection's been closed.
>>
is there a way to learn to enjoy programming
>>
How do I link libraries in C
>>
>>51666294
gcc main.c -lmylib
>>
>>51666267
there are two ways to enjoy it:

a) instant gratification by solving a trivial issue. decompose larger tasks into smaller tasks that give you instant gratification
b) having a difficult problem and getting into the flow as you look into it and slowly start to understand it. once a mental model starts forming and you eventually get that AHA! moment can be quite rewarding

A healthy mix of both makes you a good software dev. If you only focus on a) you'll be part of the problem called "cascade of attention-deficient teenagers".
>>
I need a recommendation, guys.
I need a book that explores the following topics:
networking, guis, i/o, concurrency, general software development.
Something like the java tutorial, but slightly more on point and focused.
The book MUST contain exercises.
If any of you have titles that come to mind, feel absolutely free to post them , even if they don't cover 100% my requirements.
>>
>>51666267
clash of code
https://www.codingame.com/clashofcode
>>
>>51666267
the same way you enjoy anything else, like playing football. You play, if you like continue, if you don't, choose another sport or hobby
>>
File: checkem.gif (2 MB, 589x589) Image search: [Google]
checkem.gif
2 MB, 589x589
>>51666666
Confirmed double Satan
>>
>>51666754
i don't like it but I'm going to uni for cs so i have to do it
>>
>>51660761
Agda and ATS
I'm doing it right now
>>
File: 1400857966432.jpg (40 KB, 500x375) Image search: [Google]
1400857966432.jpg
40 KB, 500x375
>>51666666
>666666
>>
>>51666476
>networking, guis, i/o, concurrency, general software development.
I doubt you'll find all those topics in a single book.
What you might find is something like a "cookbook" which tells you how to write code for those things in a given language, but it will assume you already know how those things work. I can't really help you with such a book, only point you to http://it-ebooks.info/search/?q=cookbook&type=title
if you need a book specific to one of those topics I can help you with that
>>
File: cereal guy.gif (872 KB, 264x212) Image search: [Google]
cereal guy.gif
872 KB, 264x212
>>51666666
>>
>>51666785
>i don't like it but I'm going to uni for cs so i have to do it
Well I assume you atleast like the more theorethical aspects of CS, otherwise you'll be miserable in there.
Try to implement something related to the topics you like, for example when you're studying the automata or a touring machine try to implement an UI so you can see the transictions of the states.
>>
File: 1430420743567.gif (2 MB, 259x197) Image search: [Google]
1430420743567.gif
2 MB, 259x197
>>51666666
>>
>>51660640
FAAAAAAAAAAAAGOOOOOOOOOOOOOOOOOOOOOOOOOT
>>
>>51666918
no i don't really like anything about it


just seeing if there are ways people tolerate it
>>
>>51666978
Then why the fuck are you doing it?
>>
Apple open sourced Swift.

https://swift.org

Apple also now on Github.

https://github.com/apple
>>
>>51667028
Awwww sheeeeit.
Oh yeah baby.
Some big stinky, apple reeking dogshit of a language!
>>
>>51667028
Fuck off to your mac shilling threads macfag
>>
>>51667028
They put the source on github, but there's no code of conduct. Expect this to be taken down shortly (or "swiftly" heh).
>>
File: 1448224637221.jpg (96 KB, 596x628) Image search: [Google]
1448224637221.jpg
96 KB, 596x628
>>51667071
>or "swiftly" heh
>>
>>51665368
> How do I know a socket has received everything that was sent?
On Linux, you can use ioctl(SIOCOUTQ) on the socket; this returns the amount of unsent (i.e. un-ACK'd) data.

Other than that, you're relying upon some form of in-band acknowledgement from the receiver.

Also, when the socket is closed, you need to use shutdown() to close the Tx end and read until EOF before calling close() on the socket. If you just call close(), the connection may just be reset (RST) and pending data lost.
>>
Anyone else find it too difficult to listen to music while trying to be productive? Whether it's lyric-less, I get the feeling that I want to be doing something else. I am only in the learning phase though so maybe it'll only last as long as this phase does.
>>
>>51665620
You know that FTP uses separate connections for control and data, right?

Are you handling setup and teardown of the data channel correctly?

Also, you need to use passive (PASV) mode if the client is behind a firewall or NAT. The default is for the data channel to be established by the server connecting to the client, which requires the client to accept inbound connections.
>>
What is /dpt/'s C/C++ replacement?

Imb4
>using C++
>>
>>51667291
Java
>>
>>51666988
i didn't really want to do anything

but I'm expected to go to uni

and someone said I should do cs
>>
Has anyone ever tried buying multiple cheaper second-hand GPUs just to use for GPGPU?
>>
>>51667291
Ada
>>
>>51667028
looking forward to seeing a Linux port for Swift soon
>>
>>51667291
Rust, D, Anything but Ada
>>
>>51667301
Spending eighteen hours a day on your PC doesn't equip you with the skills or aptitude to do CS.

You've been led on.
Thread replies: 255
Thread images: 32

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.