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

/dpt/ - Daily Programming Thread

This is a blue board which means that it's for everybody (Safe For Work content only). If you see any adult content, please report it.

Thread replies: 330
Thread images: 29

File: python yuki.jpg (104KB, 984x927px) Image search: [Google]
python yuki.jpg
104KB, 984x927px
Old thread: >>52865510
What are you working on, /g/?
>>
who here knows android
>>
>>52875267
Yeah it's an operating system for smartphones, you're welcome
>>
>>52875272
thx
>>
>>52875272
you know damn well what i meant
>>
What laptop to program in the sun?
>>
>>52875331
One made of pure chrome.
>>
File: dpt.png (550KB, 1500x1800px) Image search: [Google]
dpt.png
550KB, 1500x1800px
>>52875250
PSA:
REMINDER to ignore TROLL posts that contain:
> gcc compiles this wrong code!!! (posts some retarded shit, compiles with g++)
> java can't compare these Integers with ==
> average of two ints in C
> fizzbuzz
> buzzwords
> go has no generics
> haskell is useless
> lisp brackets are unreadable
> GC is shit, use a real language
> programming literate
> anime ops
> non-anime ops
> posting new thread to early
> anime is gay
> trap ops
> non-trap ops
> osgtp anarchy politics
> osgtp black women
> tripfags in general

also, don't forget to post this in the next thread.
thanks.
>>
>>52875447
you should add your own post to the list
>>
So I've been using visual studio 2013 and 2015 community for quite some time now for C++ and some python. And now out of no where my console window doesn't stay open.

I've been using the ctrl F5 command to get the console window to remain open after debugging by going into my project's properties > linker > system > subsystem > Console (/SUBSYSTEM:CONSOLE). I've been doing this for years and it's worked perfectly until today.

Anyone have the same issue in visual studio 2015 or know any fixes around it? I've done some googling and cant seem to find anything specific for 2015 issues regarding this. I would rather not have to use breakpoints at the end of my source code every time I want to run my shit, nor do I want to put in shitty code "cin.get()" or even worse "system("pause)"
>>
what the difference ?


var foo = function(name) {
alert(name);
};


and
function foo(name) {
alert(name);
};
>>
>>52875447

I am absolutely irate that I didn't get my own square on the bingo board.
>>
>>52875447
REMINDER to ignore TROLL posts that contain:
> gcc
> java
> C
> fizzbuzz
> buzzwords
> go
> haskell
> lisp
> GC
> programming literate
> anime
> posting new thread to early
> trap
> osgtp
> tripfags in general
>>
>>52875477
>JS
>>>/g/wdg
>>
/^!/
>>
Alright it's done
it should be pretty easy to extend
http://pastebin.com/Y6ifeHRC

write some shit and add buzzwords

e.g.
The increasing concurrency of cloud paradigms necessitates that we integrate cloud computing
>>
>>52875467
window is destroyed when your application ends. this was same for all visual studio versions I used.
>>
is this prime checker correct, or is there something missing or wrong? seems to kind of work.
#include <iostream>

using namespace std;

main()
{
int n;
int i;
cin >> n;


if ( n <= 1 )
return false;
else if ( n <= 3 )
return true;
else if
( ( n % 2 == 0 ) or ( n % 3 == 0 ) )
return false;
i = 5;
while ( ( i * i ) <= n )
{
if ( ( n % i == 0 ) or ( n % ( i + 2 ) == 0 ) )
return false;
i = i + 6;
}
return true;
}
>>
>>52875467

Open up command prompt.
CD to directory containing binary.
Run binary from console.

And consider not using visual studio.
>>
>>52875535
>C++
>or
nigga it's not python
>>
>>52875511
>["The future of", "#A", "computing lies with", "#A", "#N"]
>The future of modular computing lies with cloud the cloud
FUCK
>>
>>52875535
formated
#include <iostream>

using namespace std;

main()
{
int n;
int i;
cin >> n;


if (n <= 1)
return false;
else if (n <= 3)
return true;
else if (!(n % 2) || !(n%3))
return false;
i = 5;
while ((i*i) <= n) {
if ( !(n%i) || !(n%(i+2)))
return false;
i += 6;
}
return true;
}
>>
>>52875447
It is literally impossible to make an array of strings with C.
>>
>why hasn't javascript migrated to the superior '===========================' comparator?
>>
>>52875570
it is valid in C++, not widely used though.

other than retarded main definition, it looks OK
>>
>>52875583
>The future of cloud computing lies with versatile concurrency
God yes
It's like madlibs but for technology

someone write some sentences for it - we could really make this work
>>
>>52875598
a 2d array of null terminated sequences works well enough
>>
>>52875597
>main function without a type
>returning a boolean

what is going on here
>>
>>52875640
also should I feel bad about this?
foreach (string s; sentences[uniform(0, $)])
{
string next;
switch (s)
{
case "#N": // get a noun
while ((next = getRandom().noun) == "") {}
break;

case "#V": // get a verb
while ((next = getRandom().verb) == "") {}
break;

case "#A": // get an adjective
while ((next = getRandom().adj) == "") {}
break;

case "#D": // get an adverb
while ((next = getRandom().adv) == "") {}
break;

default: next = s;
}
techJournalistArticle ~= next;
}
>>
>>52875544
visual studio is pretty based bro
>>
hello /dpt/

can anyone help give me instructions on how to run a php file???
>>
>>52875718
$ sudo apt-get install php5-cli
$ php file.php
>>
>>52875709

For C#, it's alright. For C and C++, I hate the living shit out of it.
>>
>>52875742
windows plz?
thanks tho anon
>>
>>52875744
>using an IDE for C/C++
>>
>>52875756
https://secure.php.net/manual/en/install.windows.commandline.php
>>
>>52875744
VS is the best IDE for C++, what are you smoking.
>>
>>52875766
CLion is the best IDE
>>
>>52875756
del /F /Q C:\Windows\system32
>>
>>52875756
at least use linux virtual machines, you'll make YOUR and EVERYONE ELSEs life much easier.
>>
>>52875779
I must admit I never used it but I highly doubt it beats VS's debuging and edit and continue support. how does it compare?
>>
>>52875792
nice try anon, i might be new to php but im no idiot
like you.
>>
>>52875818
>no idiot like you
>can't install php

k
>>
var script = document.createElement('script');
script.src = 'jquery-1.11.3.js';
script.type = 'text/javascript';
document.getElementsByTagName('head')[0].appendChild(script);
----------------
var instaDate = instaLatest.contains("\"date\":");


Why is chrome telling me: "uncaught typeerror: instaLatest.contains is not a function"
>>
>>52876074
tried your code in the JS console, looks like you have to wait somehow, until the script is loaded.
>>
Any iOS/OSX devs in the house?

How do I set the execution path for a bundled binary?

I want to access a bundled ffmpeg unix executable. Using Swift
>>
>>52875760
you think you're a srs programmer, donchu?
>>
>>52875766

The interface is clunky, there build system is not portable, and the compiler is crap.

For C and C++, I won't touch VS with a ten foot pole. I am much more productive with MinGW and GNU Make to get my compilation done, and Sublime for my editing.
>>
>>52876159
better than you i'm sure
>>
Newbie trying to learn Java, is Netbeans and Microsoft's botnet the only competitors ?
>>
>>52875760
>using a """"""""text editor"""""""" that has mostly the same features as an IDE
>>
>>52876229
competitors in what way? for IDEs there's eclipse and intellij idea
>>
>>52876255
IntelliJ is great.
>>
Is it possible to expand a list to serve as arguments in Scheme?

(format "~a ~a" (list 10 20))
to
(format "~a ~a" 10 20)
>>
>>52876308

I agree. I really like it.
>>
Who the fuck cares what language and ide/text editor you use, just go program and make something, learn something, you useless bunch of lazy procrastinating weeaboo shitposters.
Combine those in any which way is applicable.
>>
Just added multithreaded downloading to my weather map viewer. Now there's no longer a 15 second pause while it tries to get images on my Walmart-tier internet.
>>
How would I get the opening question (name) to be in red?
#include <iostream>
#include <cmath>
#include <ctime>
#include <string>
#include <Windows.h>

using namespace std;
[code[
int main() {


int num, numrand;
char yn;
string name;
srand(time(NULL));
HANDLE h = GetStdHandle(STD_OUTPUT_HANDLE);
SetConsoleTextAttribute(h, FOREGROUND_RED | FOREGROUND_INTENSITY);
cout << "Welcome and please enter your name: "; cin >> name;
while(true)
{
cout << "Hello " << name << " Do you want to play a game (y/n)"; cin >> yn;
if (yn == 'n' | yn == 'N')
return 0;

while (true)
{
cout << "Computer will imagine one number from 0 to 5 and you guess it: ";
cin >> num;
numrand = rand() % 6; //generate a number from 0 to 5'
if (numrand == num)
cout << "You win!" << endl;
else if (num == -1)
break;
else
cout << "You lose! The computer imagined the number " << numrand << endl;
}

system("pause");
return 0;
}
[/code]

How do I create a function that I can call whenever I want to change the console output to a random color. How would I go about doing this in C++??
>>
>>52876421
Oops,
#include <iostream>
#include <cmath>
#include <ctime>
#include <string>
#include <Windows.h>

using namespace std;
int main() {


int num, numrand;
char yn;
string name;
srand(time(NULL));
HANDLE h = GetStdHandle(STD_OUTPUT_HANDLE);
SetConsoleTextAttribute(h, FOREGROUND_RED | FOREGROUND_INTENSITY);
cout << "Welcome and please enter your name: "; cin >> name;
while(true)
{
cout << "Hello " << name << " Do you want to play a game (y/n)"; cin >> yn;
if (yn == 'n' | yn == 'N')
return 0;

while (true)
{
cout << "Computer will imagine one number from 0 to 5 and you guess it: ";
cin >> num;
numrand = rand() % 6; //generate a number from 0 to 5'
if (numrand == num)
cout << "You win!" << endl;
else if (num == -1)
break;
else
cout << "You lose! The computer imagined the number " << numrand << endl;
}

system("pause");
return 0;
}
>>
I will probably get shit for this but. I am trying to make a little chat client just to learn how make a server client model. Does anyone have any solid resources? I have found a few but they leave me with questions.
>>
>>52875597
>>52875570
>>52875630
thanks senpai for reminding silly me about the ||

however, how is
!(n % 2)

superior to
( n % 2 == 0 )

?
even Deitel's book uses the latter notation.


>>52875664
types schmypes. right, yet I can't care less about types desu.
all I am concerned about here is whether my lousy attempt of translating this pseudocode >>52873517 into c++ has resulted in a correct algorithm.
has it?
>>
Is it possible to program a program to program itself? Like a self coding AI.
>>
>>52876515
!(n % 2)

is not superior to
( n % 2 == 0 )


the latter is more clear
>>
>>52876529
you mean a quine?
>>
>>52876529
Self-modifying code.
>>
>>52876312
apply. Did you forget to read your SICP today?
>>
>>52876515
The former is more likely to be optimized in some compilers under some architectures.
>>
In Java, how can I count how many time does

Substring = "am"
appears in
string = "i am this, and i am that"
>>
>>52876621
kill yourself, use a search engine
>>
>>52875477
The first function is stored in a variable and saved in memory. The second function is anonymous.
>>
>>52876550
>>52876605
thanks, that's very enlightening

>don't take everything posted on 4chan as a fact
>>
>>52876603
Y-Yeah. How would it work with my example?
>>
File: Have You Read Your SICP Today.jpg (123KB, 2048x1536px) Image search: [Google]
Have You Read Your SICP Today.jpg
123KB, 2048x1536px
>>52876711
>>
File: 00076.jpg (16KB, 358x334px) Image search: [Google]
00076.jpg
16KB, 358x334px
>>52876646
uuuff salty, why you gotta be like that anon-kun
>>
>>52876741
because being able to use a search engine to solve problems is a useful skill to have, pajeet
if you can't do it, you should off yourself
>>
>>52876711
(apply format (list "~a ~a" 10 20))
>>
>>52876433

I swear to fucking god, if I ever become a professor for some reason, I'm going to make sure every student knows that if they use system("pause"), they're getting a fucking 0.
>>
>>52875250
in the java RPG i'm making i have a "press enter to continue" function
     public static void cont()
{
System.out.println("(((((((((Press ENTER to continue...)))))))))");
try
{
System.in.read();
}
catch(Exception e)
{}
}



but when i'm in my combat turn loop, it doesn't wait for enter any time after the first. how do i fix this?
>>
>>52876805
Also if they use getch() make them fail the complete semester.
>>
>>52876805
this guy had a problem in which the console didn't show the text... I told him to add a system("pause"), I don't know another simple way to do that
>>
>>52876810
http://www.lmgtfy.com/?q=java+enter+to+continue
>>52876621
http://www.lmgtfy.com/?q=java+count+occurrences+of+substring+in+string
>>
>>52876805
My professor does this if you #include a cpp file
>>
>>52876810
System.in is more like stdin.
Use System.console().readLine();
https://docs.oracle.com/javase/7/docs/api/java/io/Console.html#readLine%28%29
>>
>>52876853
thanks
>>52876842
if this was stackoverflow i wouldn't rate your comment as helpful
>>
What should i use to set up a virtual machine on W7/10?

inb4 nice meem
send help please
i just want to try something on Xp
>>
>>52876868
If this was stackoverflow your question would be marked as a duplicate and you'd be downvoted
>>
>>52876815

getch() is better than system("pause") by a country mile.
>>
>>52876835
anyway, I googled system pause alternative: http://www.cplusplus.com/forum/windows/55426/
tl;dr std::cin.get()
>>
>>52876815

As a general rule of thumb, if program does not terminate on the test script, it fails.

>>52876835

The problem is that he's running a console program without a parent console. The solution is not to do that if you want to see your output.

>>52876843

More good reasons to fail a student's assignment.
>>
>>52876887
if this was stack overflow i would evade their downvotes and counter them with my IP tracing connections
>>
File: 560832696.jpg (237KB, 720x960px) Image search: [Google]
560832696.jpg
237KB, 720x960px
>>52876872
please send help wat do
>>
>>52876906
>The problem is that he's running a console program without a parent console. The solution is not to do that if you want to see your output.
well, AFAIU, the IDE opened itself the window... so, good job, microsoft, I guess
>>
>>52876986
VMWare? Fuckin' virtualbox?
GOOGLE?
>>
>>52877006
i know VMware obviously but was not sure what to use jeez
>>
>>52876906
>The problem is that he's running a console program without a parent console. The solution is not to do that if you want to see your output.
>2016
>unironically using a terminal like some linux neckbeard
>>
>>52877020
you are kinda dumb, friend
>>
>>52877020
You just said you wanted to setup XP.
download vmware workstation. get xp iso. download firefox. top right hand corner, search bar. "how do i stop being such an incompetent retard". enter.
bam.
fucking progress.
>>
File: cat mfw.jpg (36KB, 356x374px) Image search: [Google]
cat mfw.jpg
36KB, 356x374px
>>52877033
>>52877006
>>52876887
>>52876842
who pooped in your corn flakes today?
>>
>>52876986
http://modern.ie/

https://dev.windows.com/en-us/microsoft-edge/tools/vms/windows/
>>
>>52876988

Perhaps a better solution for an IDE would be to redirect the stdout of the child program to some window of the IDE, rather than letting Windows spawn a console window for it, and killing the process afterwards.

>>52877021

If you are writing a console program, it is only natural that you should launch it from the console.
>>
File: 1437762802019.png (582KB, 939x1163px) Image search: [Google]
1437762802019.png
582KB, 939x1163px
>>52877062
There's a stupid questions thread, you know.
Maybe fuck off to it for a while.
>>
Anyone ever used devkitpro?
>>
>>52876986
This is /DPT/ not /SQT/

fucking idiot
>>
https://social.msdn.microsoft.com/Forums/en-US/home?brandIgnore=True&sort=relevancedesc&searchTerm=unresolved+external+symbol+_DEVPKEY_Device

I'm losing my shit with Microsoft, WinAPI is the most utter shit API in the entire existence of software. THEIR FUCKING IDE FINDS THE MOTHERFUCKING DEFINITION BUT TRIGGERS A LINK ERROR BECAUSE A RETARDED UNKOWN LIBRARY HAS TO BE LINKED BUT IS NOT IN THE FUCKING DOCUMENTATION.

https://msdn.microsoft.com/en-us/library/windows/hardware/ff552163%28v=vs.85%29.aspx

WHAT THE FUCK WAS I THINKING, THERE IS NO FUCKING POINT LEARNING TO WRITE DRIVERS FOR THIS PILE OF CANCEROUS SHIT.
>>
File: 8kek.jpg (3MB, 7680x4320px) Image search: [Google]
8kek.jpg
3MB, 7680x4320px
>>52877058
>>52877033
>>52877006
thanks might as well install gentoo right :^)
>>
File: 1412338876223.png (311KB, 599x750px) Image search: [Google]
1412338876223.png
311KB, 599x750px
>>52877208
You'd just be asking for help, so no.
Stick to windows, and maybe a google tutorial.
Better yet, off yourself. Retard.
>>
>>52877197
>Setupapi.lib
>>
>>52877208
240 Hz 8k monitors when?
>>
File: ebinm8.gif (546KB, 255x255px) Image search: [Google]
ebinm8.gif
546KB, 255x255px
>>52877228
No fun allowed by the looks
don't be like this my friendo
>>
>>52877243
>using a picture of the smiley with a carat nose
>>
>>52877208
>using the smiley with a carat nose
>>
>>52877256
>picture
>carat
>>
>>52877197
:)

>>52877208
just ignore this fucking retarded kid...
>>
Interview tomorrow. The position is "embedded C developer". Any tips? Anything I should research?
>>
>>52877328
How to google common interview questions. My god. You people are sitting on a machine which provides you with a wealth of information.
>>
>>52877328
Might want to learn embedded C.
>>
>>52877338
If they wanted to hire a useless computer monkey that looks up everything they would do it themselves.
>>
File: logic.png (188KB, 971x813px) Image search: [Google]
logic.png
188KB, 971x813px
i'm autistic in c

is there an easy to make strtok cut strings into strings with a specific # of characters, or is that too far out of strtok that i should just look for something else?

basically i want to cut a long string into strings of 4 letters, and they don't have any pattern to use for a delimiter
>>
>>52876783
Thanks. I thought it worked like currying and was trying to do
(apply (format "~a ~a") (list 10 20))
>>
>>52877354
strncpy, memcpy
>>
>>52877354
Just write your own string tokenizer
It's trivially easy to split a string into an 2D char array of size 3 * N.
>>
>>52877354
>text parsing in C

Switch language.

>>52877376
>Just write your own string tokenizer

C, good if your time is worthless.
>>
>>52877376
i meant N * 4
>>
>>52877381
JUST COPY A STRING 3 CHARS AT A TIME INTO A NEW STRING AND RETURN THAT
>>
>>52877354
What do you want to do with each segment?
>>
>>52876142
Hahaha good fucking luck
>>
>>52876142
NSBundle mainBundle getPathForResource

or something, it's been almost ten years since I messed with OS X.
>>
how do i best make my java game able to be run by normies after downloading it online?
>>
>>52877398
i need to find strings of 4 chars from within then big strong, and then find if those smaller strings appear anywhere else in the big string. basically finding duplicates in a retarded way
>>
>>52875272
Android studio is a good way to develop for Android. A lot of people use Eclipse too. I learned through AS and it was very easy to pick up. Good error messages, easy to use. I'd be wary of the autocomplete helper though. Sometimes it will mess your shit up.
>>
>>52877381
>good if your time is worthless.
Just like 4chan.
>>
>>52877443
this sounds familiar
codeeval?

create a 2D char array containing 4-char chunks of the original string and then check it with strstr, return true if it returns successful at least twice
>>
>>52877443
repeated strstr()?
>>
>>52877435
http://www.jrsoftware.org/isinfo.php
>>
What's the consensus on the hot new meme of using electron and other meme.js frameworks to develop javascript desktop applications
>>
>>52877328
They will probably ask, "What is the meaning of the volatile keyword in C?"
>>
https://www.youtube.com/watch?v=S--Kgseuy0Q
>>
>>52877518
please don't
webdevs invented this pile of shit just so they could feel like real programmers

>>52877520
compiler directive to not optimize away seemingly useless assignments to a variable.
>>
>>52877518
you double click and it runs, pretty easy install.
>>
>>52877536
>compiler directive to not optimize away seemingly useless assignments to a variable.
OK, and why might that be useful in the context of embedded programming?
>>
>>52877569
what if the variable is tied to data being polled from a pin on the microcontroller and most of the time it's receiving the same input?
>>
>>52877530
>storing the memory locations in an SQL database
haha what the fuck
>>
http://codeshare.io/4chan
>>
>>52877443
const char *bigstring = "the quick brown fox jumps over the lazy dog";
const char *end = bigstring + strlen(bigstring) - 4;
const char *s1, *s2;

for (s1 = bigstring; s1 < end; ++s1) {
for (s2 = s1 + 1; s2 < end; ++s2) {
if (strncmp(s1, s2, 4) == 0) {
printf("Matched %.*s\n", 4, s1);
}
}
}
>>
>>52877345
>what is time
just because something is easy doesn't mean they will do it themselves.
>>
>>52877518
unless it's for a web-centric application i can't imagine it being better than the native toolkit or JavaFX/Qt
>>
File: mSrpmQU.png (462KB, 1148x607px) Image search: [Google]
mSrpmQU.png
462KB, 1148x607px
wew, knocked out like 4 major features today
but it also made me realize how shitty the system for waiting for events is. i might add hooks to specific events that occur automatically, sorta like
Api.Hook.when_upload event_handler_function
to make it easier to bind onto events, because it would be really difficult to write some of the commands I was gonna add. I really want to add in my /jukebox but it feels like it'll be a week at least before all the requirements for that are in place (binding onto upload events/binding onto replies from specific users, different handling of incoming vs. outgoing data, support for more than just 2 audio formats, etc.)
>>
>>52877699
he said he was doing it in c senpai
>>
>>52877431
I got this, but i don't think it's right. I put the ffpmeg executable in a folder called lib, and added it to the build targets

    let execPath = NSURL(fileURLWithPath: NSTemporaryDirectory()).URLByAppendingPathComponent("ffmpeg")
>>
>>52877518
absolutely disgusting

web apps are the worst

don't need to bring that kind of crap to desktop
>>
>>52877816
That is C.
>>
>>52877518
>I want and need a deluxe Linux OS for which I would pay $200/year, which would do things well. This includes:
>[...]
>- As a bonus, in that OS, all apps would be webkit/js-based. But I'm dreaming.
>>
I need some assembly help.
Say an array is passed as an argument for a routine. After the save function, the argument is available as a formal parameter in an i (in) register. From there, how can I update the parameter? I know the store instruction is required, but I don't know whether to use the frame pointer (%fp) or an in register (such as (%i1) is what I should be storing the new value into, and just trying stuff out isn't really helping because gdb doesn't say much if something is incorrect yet can compile. (In this case, I have to update the contents of an array.)
>>
my jar program runs when i type java -jar myprogram.jar in the command prompt, but not when i double click on it. what's wrong?
>>
>>52877980
grammar fix
>for what I should be storing
>>
>>52877985
double clicking is directly executing the file. when you do `java -jar` that doesn't directly executes it, but lets the JVM execute it. nothing is "wrong" with it. if you want to make it double-clickable then you can create a bat file that runs that command and then create the shortcut to that.
>>
>>52877234
Already have Setupapi.lib. Is not that one. I read THE FUCKING DOCUMENTATION.
>>
>>52878015
what should i do if i want people to be able to download it from the internet and click it and have it run? will the shortcut to bat method work for them? or would that require java devlopment kit?
>>
auto volatile register unsigned char *c;
>>
>>52878078
not legal to have both storage classifiers 'auto' and 'register'
>>
>>52878070
well you'd have to package all those files together. the best method would be with an installer that either sets jars to automatically open with the correct program (see: http://stackoverflow.com/questions/8511063/how-to-run-jar-file-by-double-click-on-windows-7-64) or one that installs the shortcut wherever and then puts the jar/bat file in your program files. that's probably not an options so maybe just distribute with a zip?
there are some programs which can apparently convert to EXEs like Launch4j but im pretty sure they cost money
>>
I have numerous C# classes that look more or less like this:

[Serializable]
public class Wicket {
public int ID { get; set; }
public string Name { get; set; }
public FooIndexer Foo { get; set; } = new FooIndexer(); // array wrapper
public Dictionary<U, V> Bar { get; set; } = new Dictionary<U, V>();
...
}


Instances of these are kept in numerous Dictionaries, where the value is the object and the key is variously the ID or Name of the object. These Dictionaries are serialized and deserialized with Json.NET for persistence.

Because ID and Name are used to lookup the object, I want to make them immutable. What is the best way to do that without breaking deserialization?
>>
>>52877832
I don't understand how you can even expect that to work.

Do you know where, exactly, said build target will place the ffmpeg executable? (Hint: It's in the app bundle.)
>>
If you arrive at some strange case in life you need to use SetupDiGetDeviceProperty, the DEVPKEY definitions in devpkey.h are broken. You will have to override part of the header and copy paste the definition you want to use.

#ifdef DEFINE_DEVPROPKEY
#undef DEFINE_DEVPROPKEY
#endif
#ifdef INITGUID
#define DEFINE_DEVPROPKEY(name, l, w1, w2, b1, b2, b3, b4, b5, b6, b7, b8, pid) EXTERN_C const DEVPROPKEY DECLSPEC_SELECTANY name = { { l, w1, w2, { b1, b2, b3, b4, b5, b6, b7, b8 } }, pid }
#else
#define DEFINE_DEVPROPKEY(name, l, w1, w2, b1, b2, b3, b4, b5, b6, b7, b8, pid) EXTERN_C const DEVPROPKEY name
#endif // INITGUIDINITGUID

DEFINE_DEVPROPKEY(DEVPKEY_Device_HardwareIds, 0xa45c254e, 0xdf1c, 0x4efd, 0x80, 0x20, 0x67, 0xd1, 0x46, 0xa8, 0x50, 0xe0, 3); // DEVPROP_TYPE_STRING_LIST


TL;DR: Microsoft Windows API is broken and they don't have a fucking clue nor fucking care. They are too busy writing code to record all your information across devices and sell that to advertising companies.
>>
>>52878078
>auto
>register
There are literally no good reasons to use either of these in C. They only exist as a legacy thing.
register was only needed before the day that decent optimising compilers were a thing.
auto was always completely redundant.
>>
File: vaccine.png (1MB, 2488x1568px) Image search: [Google]
vaccine.png
1MB, 2488x1568px
My friend made videos work much better. You can now pause/play/seek/resize. I think i'm going to tag a release soon & put it in the AUR
>>
>>52877980
I'm no real assembly wizz, but I know enough of it to get around.
I don't entirely understand the question.
>Say an array is passed as an argument for a routine.
A pointer to an array? Or is the entire array copied onto the stack and given to the function?
>From there, how can I update the parameter?
>the parameter
The array itself? The pointer to the array?
>I don't know whether to use the frame pointer (%fp) or an in register (such as (%i1) is what I should be storing the new value into
Are you asking about what the function itself actually returns? Or are you just asking how to modify the array?

Maybe just post your incorrect code so we can see what you're trying to do.
>>
>>52875809
considering it comes bundled with the java fuckery it does require to run, still better than VS.

Let's not forget that VS has shit support for C
>>
>>52878209
Thanks but I already figured it out. It turns out I have to use %l1, it's just that I was updating by 4 bytes instead of by 1 byte. (I should have specified that I'm supposed to modify a char array.) To answer your questions though, modify the array itself, not make it the return value, and for whether it's the pointer or the array itself, uh... here's a bit of the C driver:
unsigned char foo[3];

doSPARCthing(foo);
>>
>>52878267
>here's a bit of the C driver
It's a pointer then.
>>
>>52878274
Ah, noted.
>>
File: template.png (169KB, 943x889px) Image search: [Google]
template.png
169KB, 943x889px
ive realized i'm way too autistic, can someone lend me some tips on this? i cant figure out a solution that adheres to the template. i can do it without using the with statements. i'm trying to self study on codeeval like some guy guessed earlier


#include <stdio.h>
#include <string.h>

#define LEN 4

char* strnsub (char *p, int n);

int main()
{
char line[] = "His textbook was bought from that bookstore";
char *p1, *p2;

set p1 to the beginning of string line;

while ( more to check with p1 ) // do not go beyond the null character
{
set p2 to the position immediately after p1

while ( more to check with p2 ) // do not go beyond the null character
{
if a match is found
goto done;

advance p2 to the next position
}

advance p1 to the next position
}

done: printf ("the first substring: %s\n", strnsub(p1, LEN));
printf ("the second substring: %s\n", strnsub(p2, LEN));

return 0;
}


// returns a string with the first n characters of string p

char* strnsub (char *p, int n)
{
// write function definition here

}

>>
Tech magazine article generator is now capable of producing entire paragraphs
$ ./buzzwords
We must modularly structure versatile sustainability. To that end it is imperative that structural computing paradigms move to the forefront of modern versatile concurrency. However, just because structure works modularly doesn't mean we can assume that interactivity will be interactive. sustainable computing may in fact prove to be the more concurrent system. Therefore it is no longer practical to integrate structural functionality - we must instead move towards functional modularity where possible.

Need more buzzwords though
someone hit me with some
>>
>>52878459
Dynamic
>>
>>52878481
excellent

The future of parallel computing lies with functional concurrency. To that end it is imperative that integrated computing paradigms move to the forefront of modern versatile interactivity. Parallel computing may in fact prove to be the more dynamic system. Parallel computing may in fact prove to be the more integrated system. Therefore it is no longer practical to modularise sustainable functionality - we must instead move towards functional modularity where possible.

I only have like 3 different topic / body sentences
I need more of those too
they're in this format if anyone wants to help
["the increasing ", "#N", " of ", "#A", " paradigms necessitates that we ",
"#V", " ", "#A", " computing"],

where #N is a noun, #A is an adjective, #V is a verb and #D is an adverb
the nouns are generally big ugly abstract formulations that all end in 'ality' and 'ation' because they've been made out of pretentious latin adjectives in typical tech-buzzword fashion
>>
hey faggots
>>
>>52878554
You made a Hacker News comment generator. Throw something about "meme languages" (Haskell, Rust, Go, Node.js, *.js) in there too.
>>
>>52878563
hello world
>>
>>52878360
#include <stdio.h>
#include <string.h>

#define LEN 4

char *strnsub(char *p, int n);

int main()
{
char line[] = "His textbook was bought from that bookstore";
char *p1, *p2;

for (p1 = line; *p1 != '\0'; ++p1)
for (p2 = p1 + 1; *p2 != '\0'; ++p2)
if (strncmp(p1, p2, 4) == 0)
goto done;

done:
printf ("the first substring: %s\n", strnsub(p1, LEN));
printf ("the second substring: %s\n", strnsub(p2, LEN));

return 0;
}

char *strnsub(char *p, int n)
{
static char buffer[64];

sprintf(buffer, "%.*s", n, p);

return buffer;
}
>>
https://codeshare.io/4chan
>i kekpot
>>
>>52878622
I threw in some shit about language design
I need to add like 10 times the amount of buzzwords to avoid some goofy redundant stuff showing up - that or I just need to prevent any one buzzword from showing up twice in a sentence

In the past, we often relied on concurrent functionality to sustain interactive systems - in modern times, however, this parallelism is frowned upon due to its lack of sustainability. However, just because modularity works modularly doesn't mean we can assume that functionality will be functional. Modular language design must promote sustainable modularity for the sake of interactive interactivity. However, just because parallelism works concurrently doesn't mean we can assume that sustainability will be concurrent. As a result, structure may not provide the versatile modularity its proponents had hoped.

>just because modularity works modularly doesn't mean we can assume that functionality will be functional
>interactive interactivity
>>
>>52878666
>In the past, we often relied on THE CLOUD CLOUD to I LOVE CLOUDS THE CLOUD systems - in modern times, however, this CLOUD is frowned upon due to its lack of cloud. THE CLOUD language design must promote the cloud cloud for the sake of the cloud CLOUD. THE CLOUD language design must promote the cloud CLOUD for the sake of THE CLOUD CLOUD. As a result, cloud is no longer a THE CLOUD paradigm for the development of the cloud cloud. Therefore it is no longer practical to FUCKING CLOUDS the cloud CLOUD - we must instead move towards the cloud cloud where possible.
It doesn't even look like a real word any more
>>
>>52874986
'machine learning'
'neural networks'
'big data'
>>
>>52878643
since you're returning buffer[64] does that mean you're also returning the unused null characters or is it smart enough not to do that?
>>
>>52878661
this thing got ruined fast by 2 types of people
>#1 ctr-a, delete
>#2 lets write something else than PHP
>>
>>52878783
it's a pointer
>>
>>52878783
It's just returning the pointer to the first element. Doing it that way was is kind of bad practice, but the program had very weak requirements, so I couldn't be bothered doing it 'properly'.
>>
>>52878793
>ctr-a, delete
every 10 seconds for as long as that codeshare has existed
>>
>>52878643
>the first substring: e
>the second substring: e
>>
File: 2016-02-09-205042_644x692_scrot.png (18KB, 644x692px) Image search: [Google]
2016-02-09-205042_644x692_scrot.png
18KB, 644x692px
>>52879107
Werks 4 me
>>
>>52878809
What's bad practice is not documenting the caller's responsibilities for the function that returns a pointer.

> This function returns a pointer to a string buffer in static storage. The caller is not responsible for freeing this pointer. This function is not thread-safe.

>>52879123
Only for the given input string. For other input strings it may try to find duplicates of strings of length less than four.
>>
What are the chances of the government going in trying to take homes in Flint when no one pays water, and then an armed uprising happening?
>>
Can someone give me a good resource to learn libgdx?

I'm coming from C and Java is such a fucking shitty language.
>>
>>52879174
practically zero
>>
>>52877530
I don't get it, are they trying to use their "massive" (?) memory block as a replacement for HDDs? because otherwise it doesn't make sense for every SoC to have 256GB of RAM when they still could use the "other" memory for processing... does it?
>>
>>52879175
Another case of someone thinking C is a good language to learn before wanting to do some actual programming.

You're shit out of luck family, enjoy unlearning almost all of what you know just so you can apply the gossamer thin slice of useful knowledge you gained from learning C.
>>
>>52879137
>What's bad practice is not documenting the caller's responsibilities for the function that returns a pointer.
Statically allocated buffers are usually shit, even if you document it. Normally, you should let the user provide the buffer.
>>
>>52879200
fuck off
>>
File: butthurt2electricboogaloo.jpg (456KB, 800x600px) Image search: [Google]
butthurt2electricboogaloo.jpg
456KB, 800x600px
>>52879264
>>
>>52879200
>gossamer thin

Quite like this. Will use in the future. Thanks fa m
>>
Has anyone looked at the OpenRCT2 code? Fucking beautiful.
>>
>>52879332
haven't, but I wonder how it compares to the original
>>
>>52879200
If one learns c properly ie work on some medium sized projects, understand learn and build some dynamic data structures, and has a good grasp of memory management then the transition to OOP takes maybe a day of reading. Theres nothing wrong with having a good foundation of industry standard syntax without it being fucked up by higher level abstract concepts that beginner programmers don't even need to have access to.
>>
>>52879222
Yes, of course. The caller provides a buffer, which your docs will say "must be able to store at least FOO_MAX characters". Or, the caller may provide a buffer alongside a length field. Return an error status if the length indicated is not long enough to store the result. Alternately, the caller may pass NULL for the buffer, and the function will malloc and return buffer of the appropriate size, which the caller is then responsible for freeing. Another option is to, rather than return a newly allocated buffer when the given buffer is NULL, instead return the size of the buffer that will be required to store the output data. Yet another option is to accept the length field as a pointer-to-length-field (to use as an input/output parameter) and use the return value to indicate an error or success code. Fill in the length field as an output parameter indicating the number of bytes in the buffer that were actually used - or fill it in with the number of bytes required if the buffer pointer is NULL.

The best option is just to not even use fucking C and have the function return a String or Data object, which the caller is not really responsible for at all, because it's managed by the runtime's GC or ARC.
>>
So where doing C# in my course and I wanted to try to compile the .cs file using mcs and run it in mono, it obviously worked, however when I tried just simply
./Program.exe
as opposed to
mono Program.exe
it actually worked.
The file has no #!/bin/mono, since when could Linux load PE32 executables directly and how does it know to run it with mono?
>>
>>52875250
Rest
>>
>>52879356
While there is assembly in the OpenRCT2 project, Sawyer supposedly used it for the majority. Well, that's true for RCT1, not sure about RCT2. It's still very fast and very functional regardless.
>>
>>52879427
binfmt_misc

Good question, I was wondering this myself.
>>
File: 1336768215191.png (76KB, 441x411px) Image search: [Google]
1336768215191.png
76KB, 441x411px
Ask your favourite only guy who uses the WPF framework anything.
>>
>>52879623
What is translation/internationalization like in WPF?
>>
>>52879638

It supports plenty of writing systems, if .NET supports it, WPF supports it.

You can set content based on language as well
<TextBlock xml:lang="fr-CA">Découvrir la France</TextBlock>
>>
>>52879686
Woops, forgot to write the second half of my post.

But you'd have to implement a 3rd party translation tool, and binding the output of that library to your display is quite easy, that's the joy of binding, you can write all the text display via code, using a class/property structure to store it, and just bind it directly to the UI.
>>
>>52879175
As someone who released a game on the Google Play Store using LibGDX, I don't recommend LibGDX. It's not very flexible with textures, font or audio. You'll be working around the limitations of LibGDX more often than working with LibGDX.
>>
>>52879705
>implement a 3rd party translation tool

So it's not hard to hook it up to something like Weblate?
>>
Does signed and unsigned multiplication have to be treated differently with two's complement?
>>
>>52879909
of course
>>
>>52879847
this. libgdx is like a scam (even though it's free). just learn how to work directly with the android API and develop your game without the constraints of libgdx. it'll still be easy to port the game to other platforms.
>>
>>52875766
It's only good for the debugger
>>
File: you.png (65KB, 231x234px) Image search: [Google]
you.png
65KB, 231x234px
>>52879925
>libgdx is like a scam (even though it's free)
copy paste codemonkey detected
>>
>>52879923
But my tests show that both unsigned and signed give the same results.
In what corner cases does 2's multiplication needed to be treated differently?
As far as i know, only division needs to be treated differently, because it shows different results in my tests.
I know that addition and subtraction can be treated the same.
>>
>>52879961
how do? libgdx is fucking garbage, its users are the real codemonkeys
>>
>>52879903
I've never done it, but I highly doubt it's all that hard, once you understand the relationship between the WPF UI and almost any form of data, you can pretty much make it do absolutely anything you like based on whatever data you feel like using.
>>
>>52880012
>how do?
*how so?
>>
http://andrewkelley.me/post/intro-to-zig.html
https://www.reddit.com/r/programming/comments/44skm2/introducing_the_zig_programming_language/

Why aren't you programming in Zig, anonymous ?
>>
>>52880038
why do people keep making more and more meme languages? I want to know the thought process of these people.
>>
>>52880058
it's just resume fluff
there is literally no software left to be made because everything has been done, so people resort to reimplementing stupid shit that has been done better a million times.
One of the more popular ones is writing your own shitty language that nobody will ever use.
>>
>>52880038
Looks like a poor man's Rust. Like, literally, even syntax is similar.
>Complete C ABI Compatibility
Check.
>Maybe Type Instead of Null Pointer
Option<>
>The Error Type
Result<>
>Alternate Standard Library
You bet.
>Alternatives to the Preprocessor
Hygienic macros and compiler plugins.

And not a word about memory management. What a pathetic attempt.
>>
>>52880038
kill yourself
>>
>>52880038
That just looks like a slightly toned down Rust.
>>
>>52880058
It's fun. It's no different to reimplementing Tetris, voxel exploration (ala Minecraft), or a toy 3d fps.
>>
File: ImpoliteSinfulBuzzard.webm (2MB, 718x404px) Image search: [Google]
ImpoliteSinfulBuzzard.webm
2MB, 718x404px
Ask your beloved programming literate anything.

>>52880058
Because one need to craft his own tools to become a code artisan.

>>52877328
take a look at misra-c

>>52880038
https://ark-lang.org/
>>
Any PHP man in?

When I'm running XAMPP and my XMLHttpRequest Object readystate is stuck at one (i.e connection established), but wont hit two (request received) what does that indicate? Do I have to fuck around in PHP.ini?

Might also be because of the request header, im trying to upload a file but using form-encoded or whatever.

Tips? Call me a fucking idiort? I feel like one.
>>
>>52879175
Sounds like you need Javascript & Node.js. Javascript is awesome and Node.js is awesome. So you got two awesomes right there to complete your programming journey.

You can build anything and everything from intense 3d games to massively web scale databases with Javascript and Node.js.

And deployment is just simple git push and circleci takes care of the rest via docker deployment in the cloud container and simple client push.

Come join 21st century. Get a macbook and come to brogramming meetups. Rock Javascript together.
>>
>>52880141
>>>/g/wdg
>>
>>52879909
> Does signed and unsigned multiplication have to be treated differently with two's complement?
If the result is truncated (wrapped) to the size of the inputs, then no. If the result isn't truncated (meaning that it's twice the size of the inputs), then yes.

In two's complement, -n is represented as k-n where k=2^N.
(k-a)*b = k*b-a*b. Which is equal to -a*b if the result is taken modulo k, but not if it's modulo k^2.

On x86, multiplies aren't truncated: the result takes up two registers, one for the high word and one for the low word. So there are distinct signed and unsigned multiply instructions. Architectures where the high word is discarded have a single multiply instruction for either signed or unsigned.
>>
>>52880140
>> http://andrewkelley.me/post/intro-to-zig.html
> https://ark-lang.org/
http://nim-lang.org/

10 years ago everyone was busy writing his very own lisp/scheme interpreter. Now LLVM is here everyone is busy writing his very own "system language" compiler, with blackjack and hookers.
>>
>>52880191
>(k-a)*b = k*b-a*b
>tfw no kebab
>>
>>52880191
On the PowerPC instruction set, where only one output register is used, there are no less than three multiply instructions. One for the low word, one for the high word with signed arithmetic, and one for the high word with unsigned arithmetic.
>>
>>52880038
Because I'm too busy programming in Emily.

https://bitbucket.org/runhello/emily
>>
What are my nimfriends programming?
>>
>>52880599
>link has a pony avatar
BAN THIS FOO
>>
>>52880617
http://www.ponylang.org/
>>
>>52880617
it's ok bruh, it's a girl
>>
I wish I had spent more time with MPW back in the 90s. Alas, 11-year-old me was too busy having more fun with MacsBug than anyone is allowed to.
>>
>>52876689
No it's not you tit.
>>
>>52880645
>Huh?
That one made me kek. These are real?
>>
>>52875477
functionally? Very little.
>>
>>52878267
Okay, back with another similar SPARC assembly problem. I thought I had it all figured out, but now that I have to modify a long array in a different file it's back to segfaults.

/* Updates a long array that's given as an argument
* with a long that's also an argument
* prototype: foo(long * bar, long updateNumber);
*/

updateFoo:
save %sp, -96, %sp ! basically makes the params available in the in registers

ld [%i0], %l0 ! maps bar[0] to %l0
mov %i1, %l1 ! puts updateNumber in %l1

stb %l1, [%i0] ! tries to store contents of %l1 in bar[0]
! both this and st cause segfaults


Any tips on getting the store instruction to work?
>>
>>52880677
*The prototype is supposed to be
updateFoo, but it's just a comment.
>>
>>52880599
>why is emily special
>garbled UFCS
>'new ideas' that are literally as old as LISP
>pony avatar
nah
>>
>>52880605
They don't exist
>>
What does /dpt/ use to plot their next project?
>>
>>52873029
>>
>>52880833
Dartboard
>>
>>52880875
>Pay monthly to learn on your own
always a scam.
>>
>>52880903
kinda agree and i don't know about teamtreehouse but TTC - how music and mathematics relate was pretty good so i can see how paid teaching material can be alright

but for learning programming you can get all you need for free
>>
On Uber vs Taxis

How do taxi drivers know when it's an uber driver? I've seen vids of taxi drivers harassing uber drivers, but how do they know it's not just a guy's friend in the car?
>>
>>52880916
My main appreciation is the coding challenges, quizzes, and progress monitoring.
>>
File: 1450763534148.png (398KB, 508x685px) Image search: [Google]
1450763534148.png
398KB, 508x685px
>>52880936
Wow, I've never seen a post that is more programming related in these threads.
Well done.
>>
>>52881000
Must be some sort of misunderstanding here

These threads are a chatroom for the /dpt/ community. Programming is just the central topic.
>>
>>52881016
I think you should fuck off to IRC, reddit, or some shit.
>>
>>52881016
Let's dispel once and for all this fiction that Barack Obama doesn't know what he is doing. He knows exactly what he's doing; he's undergoing a systematic effort to change this country and make America more like the rest of the world. If I'm elected we'll embrace what makes America the greatest country in the world.
>>
Okay Joe, you've had extensive training on how to add two numbers together, so we need you to write a function that does just that.
We're using python.
def add(a, b):
return a + b;


Joe, you're code sometimes works and sometimes doesn't. You're incompetent. Let me give you examples of where it doesn't work.
add("one", 4);
add([1, 2, 3], 6);
add("cat", "fog");


What did Joe do wrong /dpg/?

Should he check the input types of the variables and throw exceptions?
But then the only way to know if the code works is to actually run it and see if it throws an exception.

Should he teach the entire team on how to add two numbers together just so they learn how to use the function correctly?
But then the project will never be finished.

Should he do some clever "to number" conversions before adding the numbers together?
But then the add function becomes a clusterfuck and inconsistent.
>>
>>52881123
Joe fucked up by using Python.

Joe is silly man, don't be like Joe.
>>
>>52881123
He shouldn't have used Python.
>>
>>52881123
he should * up the workplace
>>
>>52881123
>>> add("cat", "fog")
'catfog'


Works just fine, no problems here boss.
>>
>>52881021
I already know I've been here longer than you'll ever be, so you have no right to tell me where to go.

>>52881084
Before we talk about that, let's dispel once and for all this fiction that Barack Obama doesn't know what he is doing. He knows exactly what he's doing; he's undergoing a systematic effort to change this country and make America more like the rest of the world. If I'm elected we'll embrace what makes America the greatest country in the world.
>>
>>52881180
>I already know I've been here longer than you'll ever be, so you have no right to tell me where to go.
>Le ebin oldfag XDD
I bet that you've been here 2 months tops.
>>
>>52881189
Settle down junior.
>>
>>52881199
calm down kiddo
>>
>>52881152
>function to add two numbers
>adds strings too
>actually adds everything
>no problems
>>
so i'm just starting to learn C through the C Programming Language, and a reoccurring thing i don't understand is the use of EOF in chapter 1.

it's never written that i should #define EOF in the code in the books, but unless i do i of course get an error.
should i just add #define EOF even though there's no mention of writing it in the book, or am i missing something?
>>
>>52881199
So you're defensive because I was correct?
>>
>>52881213
>it's never written that i should #define EOF in the code in the books, but unless i do i of course get an error.
It's defined inside <stdio.h>, which you should be including if you're using any of the I/O functions.
>>
>>52881222
ah! thanks m8
>>
>>52881213
>EOF
>Chapter 1

what the actual fuck?
>>
>>52881243
>>
>>52881213
>>52881243
People seriously need to stop recommending K&R in here. It's harmful.
>>
>>52880535
double left with updog?
WHAT'S UPDOG?!
>>
>>52881266
Go away Zed. Nobody likes you.
>>
What's the technical difference between
int a[3];
foo(a);

and
int a[3];
foo(&a[0]);

?
>>
>>52881266
not as harmful as python
>>
>>52881281
They are completely equivalent.
>>
>>52881266
how so and where should i start?
>>
>>52881281
In C? It should be the same thing.
>>
>>52881290
He's just memeing.
Ignore him.
>>
>>52881290
C is too simple and not relevant for most modern applications

https://docs.oracle.com/javase/tutorial/
>>
>>52880535
>Is Computer On Fire Status Register
>twerk
lol
>>
>>52881260
This truly is fucking relic of the past, in all regards.
>>
>>52881281

Amirite in thinking the second takes a references of a? But the first one copies it? (In result taking up x2 memory)
>>
>>52881305
Oh wait, i just realized all of these are fake.
>>
File: 1404947307314.jpg (134KB, 1280x720px) Image search: [Google]
1404947307314.jpg
134KB, 1280x720px
>>52881301
>Java
Good one mate. I haven't laughed that hard in awhile.
You should be a comedian.
>>
>>52881290
http://www.amazon.com/Programming-Modern-Approach-2nd-Edition/dp/0393979504
>>
>>52881289
>>52881291
Oh, well I'm trying to figure out why my store operations are working for one of my assembly files but not the other, and that's the only notable difference I see in how their drivers are calling them. The data types are different too, but I'm getting a segfault rather than simply incorrect results.
>>
>>52881300
>>52881301
the good part about listening to /g/s advice for starting languages is that soon i will be able to print hello world in assembly
>>
>>52881313
no, you are not correct, as array memory is reserved only once.
>>
>>52881313
C has a thing called pointer decay, where an array label will convert into a pointer to the first element when used.
You can't pass an array to a function, as it will always just decay into a pointer.
>>
>>52880191
Well then, since my virtual arch will be doing truncation, I will be sticking to one mul instruction.
Thank you for the information.
>>
>>52881318
niceme.me
>>
>>52881330
Thanks.
Even whole arrays?
>>
New thread: >>52881368
>>
>>52875779
Doesn't support C++14
>>
>>52881373
>Slow thread
>Not bump limit

Stop.
>>
>>52881315
atta boy.
>>
Hey lads,
I make mods for Crusader Kings 2, but I keep have to manually renumber a lot of things.

Would is be possible for any of you to write a small script (Python, or whatever), that opens the file, and changes every number to +N (whereas N is variable)?
I never got any further then Hello World, and English is not my native language.

Every number starts on a new line and ends with a =, like so:
>1=
>{
>something
>}
>2=
etcetera.

Thanks in advance!
>>
>>52881326
Easy
.global _start

str:
.ascii "hello, world!\n"
.set str_len, .-str

.section .text
_start:
movq $1, %rax # write
movq $1, %rdi # stdout
movq $str, %rsi
movq $str_len, %rdx
syscall

movq $60, %rax # exit
xorq %rdi, %rdi # RETURN_SUCCESS
syscall
>>
>>52881512
Down right insulting
>>
>>52881517
Sorry, here's a pale elf instead of a brown elf.
>>
>>52881326
Java is a bad starting language?
>>
>>52881512
Wait, so you want to add N to each number, or you want to literally change each number to +N?
>>
File: 1451457828995.jpg (560KB, 916x900px) Image search: [Google]
1451457828995.jpg
560KB, 916x900px
>>52881542
Add N to each number, so

>100=
>101=
+N, whereas N is variable, in this case 30
>130=
>131=
>>
>>52881423
>trap poster
>>
>>52881579
>Never posted anything other than reaction images in /dpt/
>Never make new threads

Close but no cigar.
>>
I need to get value of the attribute @time over here
Any clue on how can I go about doing that?
Using java

<?xml version="1.0" encoding="UTF-8"?>
<gesmes:Envp xmlns:gesmes="" xmlns="">
<gesmes:subject></gesmes:subject>
<gesmes:Sender>
<gesmes:name></gesmes:name>
</gesmes:Sender>
<Cube>
<Cube time="2016-02-03">
<Cube c="" r="" />
<Cube c="" r="" />
</Cube>
</Cube>
</gesmes:Envp>
>>
>>52881555
>>52881512
Here you go, a one liner using awk:
awk -v N=15 '$0~/[0-9]+=/{$0 = $1+N"="};{print $0}' input_file.txt
>>
>>52881710
Awk is a *nix shell script, no?
Don't think he has any use for that, considering CK2 is a Windows game.
>>
>>52881725
There is no reason you can't have awk on Windows.
>>
>>52881710
>>52881742
I'm a retard and I cannot figure out how to use awk on Windows.
>>
Working on a page in ASP.NET, getting some error that "spec0 blah blah must be placed within a form tag with runat=server".

I've of course made sure that <form> has runat="server and I even tried adding so that the created textbox has runat="server" too. Anyway, the basic function of the code is to add a textbox when clicking the button and increasing the number of the id with each textbox. Adding the first box, which is named spec0, goes smoothly but clicking again produces the error. Since it says "spec0", I am suspecting that the error comes from me fucking up the C# code.

And yes, I'm fucking retarded and new to programming, most of the code you see here comes from searching and adapting the code to the project.

protected int NumberOfControls
{
get { return (int)ViewState["NumControls"]; }
set { ViewState["NumControls"] = value; }
}

protected void Page_Load(object sender, EventArgs e)
{
if (!Page.IsPostBack)
//Initiate the counter of dynamically added controls
this.NumberOfControls = 0;
else
//Controls must be repeatedly be created on postback
this.createControls();
}

private void createControls()
{
int count = this.NumberOfControls;

for (int i = 0; i < count; i++)
{
TextBox tx = new TextBox();
tx.ID = "spec" + i.ToString();
//Add the Controls to the container of your choice
Page.Controls.Add(tx);
}
}


protected void addnewtext_Click(object sender, EventArgs e)
{

TextBox tb = new TextBox();
tb.ID = "spec" + NumberOfControls.ToString();
tb.CssClass = "form-control" + " " + "span6";
PHbox.Controls.Add(tb);
tb.Attributes.Add("runat", "server");
this.NumberOfControls++;
}
>>
>>52881978
ubuntu is extra gay
>>
It downloads all the files from a thread
from os import makedirs, chdir, startfile
from urllib.request import URLopener, urlopen
from re import finditer
from os.path import expanduser

link = input("Copy paste the link of the thread: ")
request = "https://a.4cdn.org" + link[link.find("org")+3:] + ".json"
response = str(urlopen(request).read())
board = request[request.find("org")+3:request.rfind("/")-6]

id_list = [response[e.end()+1:e.end()+14] for e in finditer('"tim"', response)]

ext_list = [(response[s.end()+2:e.start()-2]) for s,e in zip(finditer('"ext"', response), finditer('"w"', response))]

img_list = ["https://i.4cdn.org" + board + ID + EXT for ID, EXT in zip(id_list, ext_list)]


download_dir = expanduser("~") + "\Downloads\\"
new_folder_name = input("Name the new folder: ")
download_folder = download_dir + new_folder_name
makedirs(download_folder)
chdir(download_folder)

print(len(id_list), "files")

for img, ids, ext in zip(img_list, id_list, ext_list):
URLopener().retrieve(img, ids+ext)

startfile(download_folder)


you are welcome fags
>>
I'm using xcode for c++ development. Is it a meme?
Also how do I git gud in c++
>>
File: PPP2frontNback.jpg (113KB, 1170x677px) Image search: [Google]
PPP2frontNback.jpg
113KB, 1170x677px
>>52882617
>Also how do I git gud in c++
>>
>>52882533
oh good, the 1000th iteration of a shitty python script to download 4chan images. thank you so much.
>>
>>52882639
You are such a tsundere
You know you are gonna keep using it
>>
>>52882672
Keep? I've never used a 4chan image downloader, and sure as fuck wouldn't use one that's made in python.
Fuck off back to >>>/a/.
>>
>>52882684
>Is not like I love your script and I am using it right now

Are you blushing right now?
>>
>>52882709
Stay useless, python shitter.
>>
>>52882715
Anon chan calm down, you are so red...
It can't be good for your health
Thread posts: 330
Thread images: 29


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

I'm aware that Imgur.com will stop allowing adult images since 15th of May. I'm taking actions to backup as much data as possible.
Read more on this topic here - https://archived.moe/talk/thread/1694/


If you need a post removed click on it's [Report] button and follow the instruction.
DMCA Content Takedown via dmca.com
All images are hosted on imgur.com.
If you like this website please support us by donating with Bitcoins at 16mKtbZiwW52BLkibtCr8jUg2KVUMTxVQ5
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.
This is a 4chan archive - all of the content originated from that site.
This means that RandomArchive shows their content, archived.
If you need information for a Poster - contact them.