[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: 326
Thread images: 34

File: dpt_flat.png (102KB, 1000x1071px) Image search: [Google]
dpt_flat.png
102KB, 1000x1071px
Old thread: >>60167324

What are you working on, /g/?
>>
First for lisp
>>
First for AS3
function tracef(str:String, ... args):void {
var newStr:String = "";
if (str.search(/%[ions]/) != -1 && args.length > 0) {
var arr:Array = str.split(/(%[ions])/);
for (var i:int = 1; i < arr.length; i++) {
if (args.length > 0) {
var t:Object;
switch(arr[i]) {
case "%i":
for each (t in args) {
if (t is int || t is uint) {
arr[i] = t;
args.splice(args.indexOf(t), 1);
break;
}
} break;
case "%s":
for each (t in args) {
if (t is String) {
arr[i] = t;
args.splice(args.indexOf(t), 1);
break;
}
} break;
case "%n":
for each (t in args) {
if (t is Number && !(t is int || t is uint)) {
arr[i] = t;
args.splice(args.indexOf(t), 1);
break;
}
} break;
case "%o":
for each (t in args) {
if (t is Object && !(t is int || t is uint || t is String)) {
arr[i] = t;
args.splice(args.indexOf(t), 1);
break;
}
} break;
default: break;
}
}
}
for each (var p:String in arr) newStr += p;
}
else newStr = str;
trace(newStr);
return;
}
function isPSquare(n:int):Boolean
{
if(n == 0) return false;
var i:int = 1;
while(true) {
if(n < 0) return false;
if(n == 0) return true;
n-=i; i+=2;
} return false;
}
function eratosthenes(limit:int):Array
{
var primes:Array = new Array();
if (limit >= 2) {
var sqrtlmt:int = int(Math.sqrt(limit) - 2);
var nums:Array = new Array(); // start with an empty Array...
for (var i:int = 2; i <= limit; i++) // and
nums.push(i); // only initialize the Array once...
for (var j:int = 0; j <= sqrtlmt; j++) {
var p:int = nums[j]
if (p)
for (var t:int = p * p - 2; t < nums.length; t += p)
nums[t] = 0;
}
for (var m:int = 0; m < nums.length; m++) {
var r:int = nums[m];
if (r)
primes.push(r);
}
}
return primes;
}
>>
>>60173239
Well the Europeans who have actual lives are busy at work, and the NEET burgers are still sleeping in mommy's basement.

I'm waiting until it's time to go to the dentist so I can get back to work and stop shitposting on /dpt/ how about you, OP?
>>
>>60173239
nth for C++
#if defined(_WIN32)
#include <stdlib.h>
#include <stdio.h>
#include <stdarg.h>
#include <time.h>
#include <ctime>
#include <windows.h>
#include <mmsystem.h>

int main(int argv, char **argc)
{
if(!argc[1] || !argc[2] || !argc[3]) throw "CLI Argument error: invoke with 'alarm h m s' ";
int hour = atoi(argc[1]);
int min = atoi(argc[2]);
int sec = atoi(argc[3]);
struct {int h; int m; int s;} tm_alarm;
tm_alarm.h = hour; tm_alarm.m = min; tm_alarm.s = sec;

int sleepTime = 5;
bool alarm = false;
do {
::Sleep(sleepTime*1000);
time_t time = std::time(0);
struct tm *tm_now = localtime(&time);
if((tm_alarm.h) <= (tm_now->tm_hour) &&
(tm_alarm.m) <= (tm_now->tm_min) &&
(tm_alarm.s) <= (tm_now->tm_sec)) {
::PlaySound("Invalid link for BOING sound, replace with a link for custom music", NULL, SND_FILENAME | SND_LOOP | SND_ASYNC);
alarm = true;
for(int i = 0; i < 100000; i++) printf("ALARM\t ALARM\t ALARM\t ALARM\t ALARM");
}
}while(!alarm);
}
#else
throw "Unsupported operating system";
#endif
>>
>>60173324
Europeans aren't human though. Australians on the other hand...
>>
File: qsfml.png (236KB, 1920x1080px) Image search: [Google]
qsfml.png
236KB, 1920x1080px
Just made a thingie that extracts window handle and OpenGL context from SFML and injects QML engine on top of it, pretty satisfied with the results and it could easily work with SDL and GLFW as well.
The only downside is that there's no Qt event loop so you need to manually process events from your framework's event loop and propagate them to the QML proxy so that components can receive them.
>>
File: 1487608084850.jpg (53KB, 312x312px) Image search: [Google]
1487608084850.jpg
53KB, 312x312px
>>60173318
>>
I basically don't have a problem with being sensitive to other people, but what's with the over the top obsession with political correctness in many programming communities?
>>
>>60173460
American PC culture. It doesnt exist outside the western world.
>>
>>60173479
nah, programming has like.. supernatural pc culture, it doesn't reflect general western culture at all.
>>
>>60173506
>he hasn't been to your average liberal college campus
>>
>>60173524
yes, I have, that's why I'm so weirded out about how it's even worse in a lot of github groups and so on
>>
>>60173460
They think that the only reason more women and minorities aren't in programming is because the cis white men create "toxic atmospheres".
Actually, nobody fucking cares who you are or what you look like as long as you:
1) Write good code
2) Don't start every other sentence with "As a woman/person of colour/LGBTQ..."

It just so happens that the people shouting the loudest about the inequalities are simply unable to do either of these relatively simple things.
>>
>>60173533
What could be worse than the communist tumblrinas crying about men in tech while enrolled in some useless shit like latina dance theory
>>
>>60173565
the people that actually write programs to segregrate and censor social and general media. They do it for free
>>
>>60173330
#include <cstdint>
#include <ctime>
#include <chrono>
#include <thread>

constexpr auto SleepTime = 5u;
constexpr auto BeepCount = 1000u;

int main(int argc, char **argv)
{
if (argc < 4) {
std::printf("Usage: %s h m s\n", argv[0]);
return 0;
}

int h = std::atoi(argv[1]),
m = std::atoi(argv[2]),
s = std::atoi(argv[3]);

while (true) {
std::this_thread::sleep_for(std::chrono::milliseconds(SleepTime * 1000));

time_t time = std::time(nullptr);
struct tm *now = localtime(&time);

if (now->tm_hour == h
&& now->tm_min == m
&& now->tm_sec <= s) {
for (unsigned i = 0; i < BeepCount; ++i) {
std::printf("\a");
}
}
}

return 0;
}
>>
File: 1406803019377.jpg (103KB, 1280x720px) Image search: [Google]
1406803019377.jpg
103KB, 1280x720px
>>60173239
>>60173650
>Write program to automate getting RSS feeds for animu
>Scrapes anichart.net's internal API
>Searches nyaa, finds releases of that series
>Adds rss feed to rutorrent
>Works fine
>After a couple of months, anichart changes their internal API; it breaks
>Have to rewrite a good chunk of it
>Works fine again
>A couple of months later nyaa dies
God fucking dammit. Why can't this program just stay working?
I'm sick of rewriting this shit. This program was supposed to help me save time.
>>
File: 1492441164004.png (400KB, 450x720px) Image search: [Google]
1492441164004.png
400KB, 450x720px
How do I learn to write nice and readable code? If I write much code it gets unreadable
>>
Hi guys
/* Question: What is proctecteed access specifier?
* Ques: How does protected acceess specifier govern accessibility
* Ques: of members for derived class and friends of derived class
* Ques: and user of derived class?
*/
#include<iostream>
class Base{
protected:
int prot_mem;
public:
Base() = default;
Base(int l):prot_mem(l){}
};
class Derived:public Base{
public:
friend void foo();
void bar();
Derived() = default;
Derived(int x):Base(x){}
};
/* bar can access prot_mem */
void Derived::bar(){
std::cout<<"Protected member of Base class : " << prot_mem <<std::endl;
}
void foo(Derived& d){
std::cout<<"Friend can access protected inherited members of Base class : "<<
d.prot_mem<<std::endl;
}
int main(){
Derived d1;
d1.bar();//OK
foo(d1);//OK
return 0;
}

Why does the compiler complains about foo accessing protected int Base::prot_mem?
What I read is friend of derived class can access protected members of base through derived class object. What am I missing?
>>
>>60173239
>>60173433
>>60173651
>>60173696
What are these "Avatars" you are using? Lol...
>>
>>60173696
Stop using meme languages, that'll sort out 90% of the ugliness right off the bat.
>>
>>60173706
That won't work for a standalone function, the friend void foo() inside of derived is as if it was a class member that had no definition and only declaration.
>>
>>60173734
Yes! Memes! I love them too!
>>
>>60173735
That's a "Meme Macro" as we call them... Not a "Standalone Function".
>>
>>60173735
>What are u saying bro?
>>
>>60173735
>>60173706
Fixed it my fucking bad
friend void foo(Derived&);
>>
>>60173793
Nice freaking Meme my "Bro".
>>
Why does it loop forever?
#include <stdio.h>

int main()
{
int result[4];
for (int number_current_matches = 0, i = 1; number_current_matches < 4;
i++)
{
//printf("Matching %d\n", i);
int sum_multipliers = 0;
for (int j = 1; j <= i; j++)
{
if (i % j == 0)
{
sum_multipliers += j;
}
}
if (sum_multipliers == 2 * i)
{
//printf("\tSUCCESS! %d is perfect\n", i);
result[number_current_matches] = i;
number_current_matches++;
}
}
printf("%d", result);
return 0;
}
>>
>>60173560
This.
Incompetent assholes are trying to gain unfair advantages by riding the SJW/feminist bandwagon.
>>
I need help with my C programming course.

The exercice is asking me to load up a set of data in a matrix of 30x12

Said matrix can be of one data type only but in each element I need to save two variables.

I'm at loss here, I know how to build up the matrix but how else do I make sure it saves two dinstinct variables in one element of a different data type?

I cannot use any record array.
>>
>>60174018
Are the values integral?
If so just use bit packing.
Say the values are in range 0-65k, you can just use 32-bit integer and pack each variable in the lower & higher 16 bits.
>>
bump from yesterday...
does anyone here know anything about x86?
specifically, x86 real mode?
or more specifically, how to disable write-protection on shadow-ram?
>>
>>60174018
Array of structs.

If you can't use structs then use a 32 bit field, with the upper 16 bits for v1 and lower bits for v2.
That's properly autistic though.
>>
>>60174036
Two variables an integer and a float(which is expressed in %).

>>60174049
But I need to save these data in the matrix remember.
>>
Something along the lines of.
void set(uint32_t *val, uint16_t high, uint16_t low)
{
*val = ((uint32_t)high << 16) | uint16_t low;
}

void get(uint32_t val, uint16_t *high, *uint16_t low)
{
*high = val >> 16;
*low = val & 0xFFFF;
}
>>
>>60174113
I forgot to link the post: >>60174018
>>
>>60174103
You can have an array (or matrix) of structs, anon.

A struct is a datatype btw, either you're not telling us something or your exercise is trying to be smart but is poorly worded and you can take advantage of it.
>>
>>60173814
bump
>>
>>60173814
>>60174213
>Why does it loop forever?
It doesn't.
>>
>>60174018
struct {
int anInteger;
float aFloat;
} data[30][12];
>>
>>60173814
Use a better language which doesn't allow looping.
>>
>>60174310
Inb4 you bring up some stupid shit about Turing Complete programming languages being bad.
>>
>>60174310
Fuck off
>>
>>60174310
>>>/trash/
>>
>>60174323
Not "bad". Just shit.
>>60174334
>>60174349
Anon, what.
>>
Why can't operating systems boot other operating systems?

Imagine if you're in nautilus or whatever and you double click an EFI file and it's like "WARNING: This is a boot-time application. It can be run, but requires an unconditional transfer of all hardware control. Stop this operating system and launch [filename]? [No (default)] [Yes]"
>>
Does anyone here has Lynda.com premium account? I need one exercise files for one course

The guy who torrented it fucked up big time

I only need someone to dl one exercise files
>>
>>60173239
I'm working on a remake of Space Station 13 but in sepples with SDL2 and using Lua for modding/customization. There's really nothing right now but I'm working on collisions. I'll put it on memehub once I get collisions and stuff done.
>>
>>60174759
Because there is a lot of hardware initialisation and kernel-level stuff that happens when an operating system boots up. There isn't a way an operating system can pass that shit off to something else easily.
>>
>>60174759
something something interrupts
>>
>>60174818
Wrong thread.
>>>/vg/
>>
>>60174876
>/dpt/ - Daily Programming Thread
>What are you working on, /g/?
I'm pretty sure I am in the correct thread. I am programming and the OP was asking what I am working on.
>>
>>60174759
can you imagine the fucking riots

"TECH SUPPORT WHENEVER I CLICK GRUBX64.EFI MY COMPUTER CRASHES TO THE BOOT MENU"

"gg no re"
>>
>>60174965
"did you actually read the warning that popped up before you clicked ok"

"WHAT THE FUCK IS READING"
>>
>>60174759
they can.
look up grub4dos.
>>
I'm working on a minimalist versatile 2D game framework with C89 and SDL, it will pretty much be a bare bones data-oriented implementation of the ECS paradigm, but with an OOP-like interface, plus some really basic and essential component types like things that can have an animated sprite and a position on the screen and perform a behavior on a schedule, worlds that can be made out of tiles that can have various flags and sometimes be animated, a togglable system for checking collisions, etc. I'll then extend it with RPG elements and create one of those sentimental RPGs that people play for the story and aesthetic (e.g. Off, Lisa, Undertale, Yume Nikki, Mother 3, etc). Except I'll majorly shit it up. Then it'll be like a joke.
>>
File: 1452471092796.png (372KB, 1280x720px) Image search: [Google]
1452471092796.png
372KB, 1280x720px
>>60175229
>https://gna.org/projects/grub4dos/
>Expired certificate
That's just sloppy. Anyway, thats an extension to grub. It's not a ""real"" full-blown operating system.
>>
So I'm designing an Entity Component System for a small project in MonoGame and I'm wondering where does the implementation of specific interactions go? Say for instance I have a missle entity with an EffectComponent that makes the blow up effect. If the EffectComponent has a Draw method do I check some sort of EffectType or how do I go about differentiating different component types that are under the same component? Do I implement a MissleEffectComponent as a sub class of the EffectComponent and have it handled there instead?
>>
>>60173814
Other than the algorithm being totally dumb, inefficient and ungeneralizing, you don't want to do this:
int result[4];
printf("%d", result);

that would just print the address of the array and not the array itself (hint: you need a loop for that too).

Also, why not printing the perfect numbers on the fly? You wouldn't even need an array then.
>>
>>60174818
>SS13
Man that game was fun, the only bad thing really was the awful BYOND framework shit.

If I said #pn would that mean anything to you?
>>
>>60175398
>#pn
No idea what that is. Is it some kind of IRC server?
>>
>>60175424
It was a long shot, never mind.
>>
>>60175296
You could have the type of effect to produce be an element of the EffectComponent's state, in the same way, for example, that your core component probably has state like where its entities are on the screen.
>>
To create an adjacency matrix graph in Java could I use a two dimensional (nxn) array to store the arraylists that store the edge & vertex objects?

Also how would the method look within an edge class that gets each of the endpoints within graph?

Any help is appreciated?
>>
Telegram Chatbot which learns from interaction based on trigger - response
in Python hosted in GAE
>chntybot
if anyone is interested
>>
>>60175589
In an adjacency matrix, you don't need arraylists at all. You could have a two dimensional array of size NxN, and each cell would store any data you want to store under the edge between those two vertices, or null if there is no such edge. Then you could have an additional one dimensional array of size N that stores any data you want to store under the vertices themselves.

To find the endpoints of an edge within the graph, just look at the two indices into the two dimensional array you used to get to the edge, and there's your endpoints. In fact, under an adjacency matrix representation, it's generally assumed you use the endpoints to look up edge data, not the other way around.
>>
>>60175589
Why? I don't understand what you are trying to do here senpai

  int[] weights;

weights = new int[n * n];

addEdge(i, j, w)
{
weights[i * n + j] = w;
}
>>
Let's make lists for every language of tasks, which can't be solved efficiently in these languages, /dpt/!
I'll start:

>Prolog
>Anything practical
>>
im using the 4x2chan python api to get posts, but all of the posts are missing their newlines

4chan is the same thing and the posts come with their newlines just fine, but the 4x2chan api seems to be fucking it up
>>
File: Untitled.png (26KB, 912x97px) Image search: [Google]
Untitled.png
26KB, 912x97px
What is wrong with this?
>>
File: 1458736814525.png (895KB, 900x675px) Image search: [Google]
1458736814525.png
895KB, 900x675px

import glob
import os
from random import choice
from string import digits
from random import randint

extensions = ['.jpg', '.png', '.gif', '.jpeg', '.webm']


def random():
new_ext = extensions[randint(0, 4)]
return '14{0}'.format(''.join(choice(digits) for i in range(11))) + new_ext


for meme in extensions:
meme_folder = os.getcwd()
rename = glob.glob(meme_folder + '*' + meme)
for thing in rename:
new_name = meme_folder + random()
while os.path.isfile(new_name):
new_name = meme_folder + random()
else:
os.rename(thing, meme_folder + random())



My Anti-Archieve CIA script
>>
>>60174038
blog post time!
I finally figured out how to disable write protection on shadow-rom.
turns out the bits that control it are hidden somewhere deep in the chipset's northbridge configuration space. that sucks since I have to write chipset-specific code now.
next problem, the dos memory chain somehow corrupts immediately after my program terminates. it's fine before the final return instruction, then suddenly the last block's Z is set to M for some reason and it ends up including rom code in the memory chain.
ugh why does this shit have to be so fucking complicated.
>>
Newb here, why does python behave like this:

>>> 0.1+0.2
0.30000000000000004
>>> 0.1+0.3
0.4
>>> 0.1+0.4
0.5
>>> 0.1+0.2
0.30000000000000004
>>> 0.1+0.1
0.2


I understand that small values are added and such. But why 0.1 + 0.2 gives retarded results, and other sums give normal results?
>>
>>60177084
Read IEEE 754
>>
>>60177084
Because they're doubles.
>>
>>60177084
http://floating-point-gui.de/
>>
>>60177124
But that would be autistic.
>>
>>60177131
Computers are autistic.
>>
>>60177125
hey I like this. makes me want custard too for some reason.
>>
>>60177163
did you get raped by a computer
>>
>>60176898
nvm solved it myself incase no one cares

for some reason 4x2chan uses </p> tags for their newlines instead of 4chans </br> tag
>>
>>60177174
I don't want to talk about it.
>>
in python, do you think bitwise operators for dividing by 2 / multiplying by 2 and adding 1 are faster than the typical instructions? i'm going to be implementing heapsort
>>
>>60176946
You need parentheses around your bindings list.
>>
>>60176898
Doesn't cripplechan have an API?
>>
File: sharp edges.png (17KB, 295x395px) Image search: [Google]
sharp edges.png
17KB, 295x395px
>>60177084
0.1 is a repeating sum in binary. like, how 1/3 in decimal is 0.333333333333333.

.1 in decimal is .000110011001100110011, etc. This stuff is binary, with only a certain amount of floating point precision.
>>
Vices aren't inherently wrong, they're just conducive to wrongs. For example, a gluttonous, greedy slob can still be a good person, it's just harder for him than it would be if he gave up gluttony, greed, and sloth.
>>
File: 1493516414777.jpg (51KB, 768x960px) Image search: [Google]
1493516414777.jpg
51KB, 768x960px
>>60177237
wat
>>
File: 1491600963002.png (313KB, 700x995px) Image search: [Google]
1491600963002.png
313KB, 700x995px
Trying to create an algorithm which will convert any undecidable problem into a decidable one.
>>
this is a test post, ignore it
>>
Currently trying to get my instruction fetcher for my processor working...

Instructions are variable length from 1-4 words in length. After all words are read it raises a 'done' signal and a finished instruction tuple is made available (PC, Instruction, Instruction_size, AccessOOB) for the decoder, which transforms the tuple into a much larger tuple of control signals. Every stage of the processor gets one of these 'signal wavefronts' before it goes on the next stage.

If the decoder decodes a branch instruction, the fetcher's currently executing fetch is invalid and it must pause execution.

Currently having issues with it working in the fully pipelined manner I expect (request for instruction word at the next address is fetched as soon as the previous value is made available). It's waiting until the next cycle to send the next request and set the 'done' flag. It's starting to piss me off, Verilog is a nightmare. I know exactly what I want, but the language is so unintuitive and baroque I'm having difficulty realizing the hardware I envision.
>>
>>60177321
acknowledged
>>
>>60177321
What?
>>
>>60177222
>like, how 1/3 in decimal is 0.333333333333333.
It's not though. 0.333333333333333 isn't the full number.
>>
GCC 7.1 ReleasedGCC 7.1 ReleasedGCC 7.1 ReleasedGCC 7.1 Released

AWW FUCK YEAH NIGGA
>>
>>60177420
It's shit though. Even my "toy" compiler is better.
>>
>>60177084
>>> 0.1+0.2
0.30000000000000004
>>> round((0.1+0.2),3)
0.3
>>> print "{:.9f}".format(0.1+0.2)
0.300000000
>>> print "{:.8f}".format(0.1+0.2)
0.30000000
>>> print "{:.7f}".format(0.1+0.2)
0.3000000

a work around if formatting is the issue, not a work around if accuracy is an issue.
>>
>>60177430
ebin
>>
>>60177420
Will gcc ever get the apple's block extension support for C?
>>
File: 1482808406860.jpg (91KB, 1280x720px) Image search: [Google]
1482808406860.jpg
91KB, 1280x720px
What's the point of using inheritance to implement a sorted list SortedList as a subclass of List? I save myself typing on some basic methods but now I have to override all the methods that the client can use to break sorting order, like a method that adds at a specific location.
>>
>>60177420
oh damn I've been waiting so long for this. awesome!
>>
>>60177449
who cares about c

>>60177475
same
>>
>>60177420
whats new
>>
>>60177420
Holy shit gentoos testing packages are ancient!
Calculating dependencies... done!
[ebuild R ] sys-devel/gcc-5.4.0-r3:5.4.0::gentoo
>>
File: tumblr_mv04dboZ9c1rq7oq3o1_400.jpg (18KB, 400x400px) Image search: [Google]
tumblr_mv04dboZ9c1rq7oq3o1_400.jpg
18KB, 400x400px
currently trying to implement a way for a character to go through a maze using a wall follower algorithm thing is I keep getting stuck where it would loop infinitely up/down or left/right. What would be a way to go about this in a good manner? I thought about an additional method that will check which direction it is going so it doesn't re-loop the same directions.
>>
>>60177495
c++17
>>
>>60177472
public void foo(List<Thing> things) {}

This method accepts any kind of list. It would suck if you have to create methods for every list implementation out there.
>>
>>60173460
>Big companies realize technology is fundamental this age
>But those evil IT guys charge too much for "doing nothing"
>Flood the market with subpar incompetents of all kinds pretending to advocate a noble cause
>Wages are in an all time low and crashing even further
>Win-win for schlomo
>>
>>60177517
Does it have modules?
>>
>>60177540
...no :(
>>
>>60177501
Yeah, so is Arch, it's been 2 hours and it's not on 7.1 yet, but at least 6.3.1 is marked as out of date already.
>>
File: 1459677990780.jpg (83KB, 700x700px) Image search: [Google]
1459677990780.jpg
83KB, 700x700px
Should any language have number comparison operators?
>>
>>60177507
Just use A* you dufus.
>>
>>60177420

Too bad it'll be years before it actually shows up in Ubuntu and Debian's repositories...
>>
>>60177420
$ pacman -Syu
:: Synchronizing package databases...
mingw32 is up to date
mingw64 is up to date
msys is up to date
:: Starting core system upgrade...
there is nothing to do
:: Starting full system upgrade...
there is nothing to do

hnnnngggggg
>>
@60177570
>Ubuntu and Debian
What sort of retard actually uses those?
>>
>>60177523
I guess? So what you're saying is that I don't have to rewrite that method since it works the same for both a sorted list and a normal list? That's already the only advantage I can think of, saving typing.
>>
in python
for regular nonbinary division, addition, and multiplication (each done 12345678 times)
>real 0m2.769s
>user 0m2.768s
>sys 0m0.000s

for bitwise operations <<= 1, >>= 1, and |= 1
>real 0m3.062s
>user 0m3.060s
>sys 0m0.000s
>>
>GCC 8 WHEN
>>
>>60177593
>So what you're saying is that I don't have to rewrite that method since it works the same for both a sorted list and a normal list?
The method works on any class that implements the List interface. Stack, Vector, ArrayList etc.
>That's already the only advantage I can think of, saving typing.
Imagine writing a method that sorts a list.
>>
Potanon here. Thanks to DPT's suggestions last week, I have an updated script. please enjoy:

def main():
number = input("Enter a number: ")
na = int(number)
if na == 0:
print("More than 0, please.")
main()
elif na >= 1:
print("B-" + "A-N-" * na + "A-S")
print("IS BANANAS!")
else:
print("I said a number! Try again.")
main()

main()
>>
how do i go from being a brainlet to >tfw to intellegence
>>
>>60177779
Try to consume the brain of someone with higher IQ. Repeat as many times as necessary.
>>
>>60177572
>pacman
>>
https://wit.ai/blog/2017/05/01/new-duckling
Why does Facebook use Haskell?
>>
>>60177836
>https://wit.ai/blog/2017/05/01/new-duckling
>Haskell is notoriously one of the best choices out there to provide a type-safe DSL, whereas C++ would have required ninja coding skills (which we don’t have) to do the same without segfaults!
Because they are shitters
>>
>>60177836
I really like Haskell, but isn't it really hard to write something 'fast' in a lazy language?
>>
>>60177744
What does this do?
>>
>>60177744
Doesn't it crash when I type 'a'?
>>
gonna make a web-app to construct SQL statements wrapped in a selected language after I spent an hour trying to figure out which queries were missing the single quotation marks before their values

idc if its already out I'm going to make a better looking one
>>
>>60177472
Inheritance is garbage. Use interfaces instead.
>>
>>60177836
With functional programming you write less code, and can more easily verify it's correct. Companies like forecasting things, with func programming you can do so. There won't be a silly bug that pops up X years later that sinks one of your services.

I personally don't like Haskell though, everything I do is in OCaml right now
>>
File: Fetcher.png (55KB, 1535x876px) Image search: [Google]
Fetcher.png
55KB, 1535x876px
>>60177328
Re-wrote it sort-of. Haven't tested yet, but the RTL looks promising.

https://pastebin.com/VTFttNd5
>>
>>60178115
Why OCaml? Just because it's more mature/performant?
>>
c++ or python
>>
>>60178115
But why did they choose Haskell? There are plenty of other functional programming languages out there.
>>
>>60177896
>What does this do?
How does it feel not being able to read and understand English?

>>60177966
Why yes, yes it does. Looks like I'm going back to the drawing board. It should be pretty simple to fix.
>>
c# or assembly
>>
>>60178246
Yes.
>>
html or fortran
>>
>>60178271
>How does it feel not being able to read and understand English?
How does it feel not being able to write a simple piece of code?
>>
>>60178246
c++
>>60178291
assembly
>>60178310
html
>>
css or manually setting bits in RAM
>>
File: Variables vs Table.png (14KB, 387x551px) Image search: [Google]
Variables vs Table.png
14KB, 387x551px
So what is the main benefit to using a table to store my variables as possessed to just storing them bare?

Is it just faster to remember the "key" to a variable rather than typing out the entire variable name every time I need to access it?

I'm not a programmer
>>
>>60178042
>Use interfaces instead.
How would that solve the problem of anything related to OOP being garbage?
>>
>>60178310
or html fortran
>>
How did
bool genders;

Turn into
bool? genders;

To
int genders;

???
>>
>>60178436
Societal progress
>>
>>60178436
>tfw 4 billion genders soon
>>
Anyone use a cloud to store their programming files? does it cause problems with syncing etc especially with git? I just want to be able to work on my stuff from different PCs

or do you just git clone from github every time? seems shit because then you must commit and push everytime you want to continue smething
>>
>>60178436
>>60178445
>>60178469
What will happen when we reach past
unsigned long long genders;


??????
>>
>>60178469
What is double?
>>
>>60178493
And make it trouble!
>>
>>60178256
Facebook uses OCaml too https://ocaml.org/learn/companies.html

Facebook's spam detection service is powered by their library called Haxl (written in Haskell). Likely there was an existing regex library they built off of which was already verified by Haskell proj as a core library or something. If you do CMU's intro to Func Programming course and read Robert Harper's ML book, one of the first things they have you do is debug a regex library. Functional languages make it dead simple to build highly advanced filters and shit likely why FB uses it.

Haskell is also extensively used in Oil/Gas industry, and genome sequencing type work because of said filters applied to gigantic datasets. It's also used to make DSLs in those industries so they can hire people who don't know Haskell.

>>60178162
For all the reasons listed in these posts https://existentialtype.wordpress.com/?s=haskell and just because I was taught SML so using OCaml is easy for me. I also use Rust and Elixir sometimes
>>
semester is over now I have all summer to work on personal projects

Not sure what to start with
>>
Is there a decent multidimensional array wrapper in the stl? Having to work with c-style arrays is fucking impossible above 2 dimensions.
>>
>>60178589
Make it one very large project that is just beyond your current skill set. What are your current skills?
>>
>>60178617
??? How is it impossible? Also, you might as well use Vectors of Vector and so on.
>>
Has anyone here solved P = NP yet?
>>
>>60178626
My recent class was c# so I'm using that a lot more now and next semester will be using ASP so I want to make some sort of web service around that
>>
>>60178637
My array is 4 dimensional and allocated on the heap because it's too big to go on the stack. Using c-style arrays I have to do shit like
>arr[xSize*xSize*xSize * x + ySize*ySize * y + zSize * z + w] = 0;

Using a vector of vectors isn't much better, because then I end up with initialization code like
>array<array<array<array<int, wSize>, zSize>, ySize>, xSize>* = new array<array<array<array<int, wSize>, zSize>, ySize>, xSize>();
It's like I'm writing in Java
>>
>>60178708
Look up Eigen. It's a BLAS and contains an implementation of n-dimensional arrays.
>>
i wanna make a program that can predict the future price of a certain stock. Where would I begin with this
>>
>>60173239
Making my own programming language.
I haven't implemented too many functions/control structures yet, but it's kind of fun to program with minimal stdlib.

Here's how to calculate factorials
(set x 5)
(set total 1)
(while (eq false (eq x 1))
(set iterator 1)
(set sum 0)
(while (eq false (eq iterator x))
(set sum (+ sum total))
(set iterator (+ iterator 1)))
(set total (+ total sum))
(set x (+ x -1)))
(print total)
>>
>>60178754
Just code it in the future and get it by using
stockPrices - oneDay
>>
>>60178763
What are you writing it in?
>>
>>60178770
Cx
>>
>>60178800
I chose to write it in Lua to avoid writing any more Lua in the future.

Though my reasoning was a bit flawed as Lua gets exponentially more shitty as your project grows.
>>
File: Untitled.png (986KB, 1045x804px) Image search: [Google]
Untitled.png
986KB, 1045x804px
Thoughts on this guy? I like him
>>
>>60178832
He's gotten some things wrong, but his explanations are all right.
>>
>>60178832
literally who
>>
>>60178488
We will need to use mpz_t
>>
There an easier way to do this in C++? Program reads an array of strings and counts how many words end with "ed". i.e an array with red, black, bread, and creed returns 2 because 2 words end with ed. Input always assumed to be lowercase.

int returnNumOfEDs(array list[])
{
int num(0), arrrayLength, stringLength;
string temp;

arrayLength = list.size();

for(int i=0;i<arrayLength;i++)
{
temp = list[i];
stringLength = temp.size();

if(temp[stringLength-2]=='e' && temp[stringLength-1]=='d')
{
num++;
}
}
return num;
}
>>
>>60178845
A CS guy that appears in Computerphile videos on YouTube
>>
>>60178832
I'm a third year undergraduate at UoN, that guy is my computer security lecturer. He's pretty chill, but he seems to be very tinfoil hat-ish about the NSA
>>
>>60178706
I have no idea with respects to that, I find web stuff very boring. You can make a web server that does... uhh...

The whole point of networking is to communicate, whether it be people or other computers, so to me it seems like the whole philosophy and motivation of networking is to serve other people. If you are doing this for yourself you are probably going to have a hard time picking a useful project.

Personally, I'd like a nice free music streaming service I can put on my server. Something that has a well integrated command and control and streaming service. What exists currently usually just has clients as remote sinks and it literally streams the audio instead of the files which is just fucking retarded (local play is more reliable), and gives the user very limited or un-tightly-coupled control. A nicer way to do it is to have an audio player that play partially received files, buffer them, cache them locally to some preset limit (say 250MB). The client should allows the user to setup playlists and should prefetch the audio files, have the user be able to browse a library etc.

I've been using icecast and some shitty webadmin written in PHP I forget the name of.
>>
>>60178617
Use coq next time.
Axiom array : Type -> nat -> Type.
(* [array T n] is an array with items of type [T] and size [n]. *)

Check array.

Inductive list (T : Type) (n : nat) : Type :=
| empty : n = O -> list T n
| node : forall m : nat, m = S n -> T -> list T m -> list T n.
(* [list T n] is an list with items of type [T] and size [n]. *)

Check list.
Check empty.
Check node.

Definition multi_array : Type -> forall n : nat, list nat n -> Type :=
fun T n dims =>
let fix f n dims :=
match dims with
| empty _ _ H => T
| node _ _ m H dim l => array (f m l) dim
end in
f n dims.
(* [multi_array T n dims] is array with items of type [T] and [dims] for
ecahc dimension. *)

(* What? My documentation sucks? I know. *)
>>
File: figure_2.png (401KB, 1280x960px) Image search: [Google]
figure_2.png
401KB, 1280x960px
Doing an extra credit project for my Physics E&M Class... Pic related is a graph of the electric field of a line in 3D (the line in the Z direction)

I think I'm doing this right, but I'm not too terribly sure
>>
>>60178896
>but he seems to be very tinfoil hat-ish about the NSA
Sounds like /ourguy/
>>
>>60178688
No, but I'm on it. Screencap my post anon.
>>
>>60178865
If you're willing to use different datastructures.
#include <vector>
#include <string>
#include <iostream>

unsigned countEd(std::vector<std::string> &names)
{
unsigned count = 0;
for (auto &name : names) {
if (name.substr(name.size() - 2, 2) == "ed")
count++;
}
return count;
}
>>
>>60178896
Naturally happens when you start getting into security.

First you wonder why everything is literally backdoored to fuck with weak standards, piles of bugs you find almost instantly and even weaker excuses for keeping everything weak. Then you discover it can only be that way by design and everybody thinks your hat is aluminum.

It's like reading DJ Bernstein's posts on the IETF crypto research working group mailing list. He consistently accuses people of trying to cram in sabotaged standards and they (often being direct NSA employees sitting on the groups) try and accuse him of being a tinfoiler but he's right, the shitty standards are by design http://bada55.cr.yp.to/
>>
I have a coworker who, despite being very smart, and even very knowledgeable about software, writes the most horrible code imaginable. Entire programs are stuffed into single functions, artificially stretched thanks to relentless repetition; variable and class names so uninformative as to make grown men weep; basic language features ignored, when they could make everything shorter and more readable; and OOP abuse so sick and twisted that it may be considered a war crime. Of course, being a very smart person who has been programming since before I was born makes him fairly impervious to criticism, so even a simple 'Do you see how much better this function is when written this way?' is hopeless. How can I make him see the light, realize the truth, and be able to tell good code from bad?
>>
File: 1459001051258.gif (957KB, 500x418px) Image search: [Google]
1459001051258.gif
957KB, 500x418px
how big should something be to warrant me putting it on github?
obviously I dont think I should make an account for my ten line fizzbuzz.
>>
>>60179024
tell him to learn javascript ES8
>>
Using c# and sqlite, how do you read the whole database into the program (list or array) so that you can run queries on it, not the database?
I don't want to connect to the database everytime I run a query, since it would eat up a lot of resources.
>>
>>60179034
Nobody cares if you post something shitty there.
There are literally bots with thousands of repos with single files in them, that don't even contain code.
>>
>>60179046
Do not do it.
>>
>>60179024
You can't change people, anon, least of all programmers.
>>
>>60179046
Why do you even have a database?
Databases are faster than you seem to think, and queries aren't very expensive.
>>
>>60178989
>>60179011
He's also very gung ho about his courseworks. We're basically asked to use Kali to attack various weak machines, with the obvious issue being that lots of people decide to try to attack the university network or each other. Apparently the module has been protested by the university IT team every year since he started running it, which is kind of funny. They basically get pen testing for free.
>>
File: shit.jpg (618KB, 2048x1536px) Image search: [Google]
shit.jpg
618KB, 2048x1536px
god fucking damnit why won't this work?
>>
Rate my program
cd ..
cd code
ls
cd .. ..
cd code
code
>>
On wednesdays we kode.
>>
>>60179047
yeah I dont imagine the user base would care, but if I were to ever apply for a job and the company I applied to wanted to look at my github projects, would they care what I have on there?
>>
>>60178436
>bool genders
Is 'true' male or female? Only a fool would do that.
typedef enum { Male, Female /*, MentallyIll */ } Gender;
Gender gender;
>>
I want to learn Assembly for romhacking.

I have excellent python and some C, but that's all.

Where do I start?
>>
>>60179148
gender = 23;
>>
>>60179049
Why?
>>60179059
I have roughly 20k entries in the database, and it needs to be edited. I'm worried about performance because the program will run 24/7 except once a month when the computer restarts. I don't want it to eat up memory.
>>
>>60179124
>>60179130
go away karlie
>>
File: wtfthisshitagain.png (248KB, 1620x1167px) Image search: [Google]
wtfthisshitagain.png
248KB, 1620x1167px
>>60179123
also
>>
>>60179164
Of fuck off. I don't care if she writes any kind of shit code. She's a role model to Taylor Swift fans and if she gets a few girls into coding it's a job well done.
>>
>>60179144
You could make one repo with lots of small things, and separate repos for larger things. That way it won't be cluttered with loads of shit when anybody decides to look at it.
>>
File: wtfthisshitagain.png (227KB, 900x728px) Image search: [Google]
wtfthisshitagain.png
227KB, 900x728px
>>60179176
also
>>
File: wtfthisshitagain.png (229KB, 997x745px) Image search: [Google]
wtfthisshitagain.png
229KB, 997x745px
>>60179199
also
>>
>>60179162
>I don't want it to eat up memory.
And yet you want to copy the entire database to memory.

Either you have everything in a flat file and read it when the program starts, or you query a database. The database might actually be faster here.

You just have to understand that querying the database is the most performant option here.
>>
File: wtfthisshitagain.png (232KB, 1025x694px) Image search: [Google]
wtfthisshitagain.png
232KB, 1025x694px
>>60179214
this is ridiculous
>>
File: wtfthisshitagain.png (231KB, 972x722px) Image search: [Google]
wtfthisshitagain.png
231KB, 972x722px
>>60179235
holy shit
>>
Is Scala any good?
>>
>>60179260
Better than Java, worse than a lot of other languages. I personally like Clojure more.
>>
>>60179235
>>60179248
ive seen that one so many times, it always marks it as wrong too.
>>
>>60179161
<source>:5:14: error: assigning to 'Gender' from incompatible type 'int'
gender = 23;
^~
1 error generated.

23 is no gender, motherfucker.
>>
>>60179291
gender = (Gender) 23;
>>
>>60179291
>23 is no gender
I identify as the integer 23
>>
>>60179234
The problem I have is, that the user, upon running a query, is supposed to select some items and then print them on paper.
I already have the database load into a datagridview upon program start, so the user can select all elements to print.
Based on the selection, elements are drawn so they can be printed. Is there a better solution?
>>
>>60179273
>I like Clojure
Opinion discarded.
>>
>>60179273
Why do you prefer Clojure?
>>
I need to get good at string manipulation in c. I come from interpreted languages like ruby and javascript. can anyone recommend any books or tutorials that will help make char arrays and pointers and what not 'click'?
>>
>>60179148
>Is 'true' male or female?
It's clear to any non-retard that it doesn't matter as long as it's distinct from 'female'.
>>
>>60179381
to make sure nobody assumes it
>>
File: absolutely haram.jpg (49KB, 600x532px) Image search: [Google]
absolutely haram.jpg
49KB, 600x532px
>>60179399
>>60179314
but typecasting to enum is haram
>>
File: 1489654638545.jpg (240KB, 600x849px) Image search: [Google]
1489654638545.jpg
240KB, 600x849px
>>60178995
Me too, but I'm trying to prove its undecidability.
>>
>>60179377
>I come from interpreted languages
How can you come from something which does not exist?
>>
>>60179377
I'm currently reading both K&R and LCTHW, but I don't feel like either are helping me 'think' the way that I need to with C.
>>
How the fuck do I start thinking object oriented? I just type all my code in Main, regardless if I need to retype it later.
My colleague writes in objects that he uses in his own library. Despite that, I very rarely see him use it.
What's the appeal? How do I learn it?
>>
>>60178998
Uhhhhh, I'm not that advanced. No clue whats happening there.
>>
>>60179489
I'm not sure what you mean by that but you made me realize that I meant dynamic languages, interpretation vs compilation isn't my issue, I think it's the manual memory management and the fact that strings are treated like arrays and processed by each character.
>>
File: ProofGeneral.png (158KB, 727x821px) Image search: [Google]
ProofGeneral.png
158KB, 727x821px
>>60178949
Coq is cute.
>>
>>60179586
I know. You can write and type everything with that.
>>
>>60179578
>I meant dynamic languages
That's not a thing either, assuming you mean "dynamically" typed.
>>
>>60179563
don't bother
>>
>>60179350
pls respond
>>
>>60177420
GCC binaries get slower with every new release.
>>
>>60179645
No, not really, but I still don't understand why you said you want to load the whole database into your program.
>>
>>60179563
>How the fuck do I start thinking object oriented?
If your brain isn't severely damaged already it's nearly impossible.
>>
>>60179564
Right.

std::vector
is the same thing as vector if you have
using namespace std;
at the start of the code file.

So
std::vector<std::string>
is the same thing as
vector<string>
.

The & in
vector<string> &var
makes it so that the entire vector doesn't get copied when the function is called. It works fine without it.

for (auto name : names)
loops over all elements in names where name is the element that we're looping over at the moment.

name.substring(name.size() - 2, 2)
copies two characters beginning two characters from the end of the string, i.e. the last two characters. They are then compared to
"ed"
. If they are the same, count is incremented.

Most of the stuff in my version is just there to either make it a bit faster (&,
std::vector
), or just things that I prefer (
std::vector
instead of vector (btw prefer this in any serious project)).
>>
>>60179663
The whole database is literally one table with one column, it's just that it has a lot of rows, that's why. And it won't grow, apart from rows.
I thought a database would be easier to manage than a txt file.
>>
>>60179373
I like the Lisp features like macros, and representing code as data.

While Clojure isn't a good Lisp, it is a better language than Scala.
>>
>>60179641
>>60179686
Why? I'm already writing in java, and he's always acting smug, as in, why bother programming in a higher language if you're not gonna use objects.
>>
>>60179759
Wait

What database functionality are you even using if you only have one column.

I think a database might have been the wrong choice here, especially if you never add anything to it.
>>
>>60179817
>higher language
>objects
>>
>>60179623
yes that's what I meant. can you recommend any books that could help?
>>
>>60179817
>I'm already writing in java
Then you should stop immediately.
>"""higher language"""
>objects
He's clearly an idiot and it's safe to ignore him.
>>
>>60179837
A "dynamically" typed language does not and cannot possibly exist.
>can you recommend any books that could help?
My only recommendation would be something which you said didn't help you. Just try writing a lot of programs, even simple ones. That's really the only way you're going to learn.
>>
>>60179892
>A "dynamically" typed language does not and cannot possibly exist.
What the fuck are you on about.

Dynamic typing is a thing.
>>
>>60179833
The posibility to run queries on it. There might be a second row coming, the program is still in development.
The thing is, I want to be able to easily add, remove or edit the data in the rows. Also to read in .csv files to add several rows at once.
>>
>>60179905
>Dynamic typing is a thing.
How can something which is by definition impossible be "a thing"? It's a self-contradiction.
>>
>>60179798
>I like the Lisp features like macros, and representing code as data.
If you like Lisp, than it's obivous that you'd prefer Clojure.
>While Clojure isn't a good Lisp, it is a better language than Scala.
I've heard that Clojure isn't a Lisp. I don't know why though.
>>
>>60179834
>>60179838
What's the point of C# and java then? Why not just stick to C++?
>>
>>60179994
What IS the point of Java?
>>
>>60179892
>A "dynamically" typed language does not and cannot possibly exist.
are you hinting at the idea that a language is independent from its implementation or what?
>>
>>60179994
>What's the point of C# and java then?
I don't know. The fact that someone would willingly use them is baffling to me.
>Why not just stick to C++?
It's bad too, but if Java and C# are your only other options then definitely stick to it.
>>
>>60180013
>>60180042
t. unemployed
>>
>>60180025
Type-correctness can be checked at runtime, but that doesn't mean that the typing rules themselves are somehow dynamic.
>>
How autistic is ASP.NET? Do I have to make the front end using the wysiwyg / other autismal microsoft tools? I have some C# backend code for a server application, and I'd like to make a website for it too. Trying to figure out whether I should use ASP.NET (since I have a lot of the backend code in C# already, this should be the best option assuming ASP.NET isn't TOO bad) or if it's easier to just re-implement a lot of it in node or something.
>>
>>60179653
clang > gcc anyway tbqh
>>
>>60180133
>ASP(ie).NET
Pretty autistic.
>>
>>60180137
t. Tim Cuck
>>
>>60179732
>The & in
vector<string> &var
makes it so that the entire vector doesn't get copied when the function is called. It works fine without it.
If you're not using an ancient compiler, the vector will most likely not be copied, but moved to the function (look up move semantics). Passing a reference is perfectly fine (and probably cheaper than moving anyway), but I thought I'd mention that copying is not as much of a hazard as it used to be pre-C++11.
>>
>>60179949
What about using an ORM like entity framework.
Your database will be held in a cached object at fiest run, so as long as your database object (dbContext) is running, your queries will be checked if said query result already exists locally.
>>
>>60180133
Dont use razor engine. Do a rest service (web api project) and its prety comfy
>>
>>60180133
rest dotnetcore sempai then host it on linux
>>
>>60180195
I don't know, never used it. In fact this is my first actual project, that I am not doing just for fun. It's supposed to be a barcode printing program in which the user can select data from the database and then it is converted into barcodes, which are then printed to paper.
Care to explain more about the framework, or if there is a simpler way I can write my program?
>>
>>60180216
I'd prefer to use no engine, I want it as vanilla as possible. Do I have to use anything ASP-specific on the frontend to make it communicate nicely with the backend, or is it all just standard HTTP commands?

>>60180232
Oh shit, didn't even consider hosting really. I'll have to double check because some of the backend might be using newer C# features that aren't in core, but that's a good point.
>>
JS web-dev shitter question, inb4 >>/wdg/

JSONP allows you to bypass same-origin policy for GET requests. Is there any way to bypass same-origin policy for a POST request using AJAX?
>>
@60180400
Your kind has their own thread. Is it that fucking hard to understand?
>>>/g/wdg/
>>
>>60180440
>using @

hello newfriend :^)
>>
>>60180465
Next time, ignore @ posters.
>>
@60180465
>not knowing about '@'
>:^)
It's pretty clear that this is your first post in this thread.
Here's where you belong:
>>>/g/wdg/
>>
>>60180477
someone's jimjams are jangled
>>
@60180502
See >>60180440
>>
>>60180518
fampai, your jeremies are so rumbled
>>
>>60179992
The biggest selling point of Lisp is that all code is just parenthesised lists,
(a b (c d e) f (g h i))
is not only valid syntax, but the only syntax.

Clojure breaks this promise by having
[a b c d]
be valid syntax.

Also a lot of the traditional Lisp functions are either missing or renamed.
>>
@60180542
>fampai
>>>/v/
>>>/b/
>>
>>60179123
new blog post
I fixed it
>>
>>60177307
You'll have to design a trans-Turning machine for it to run on. Which means you'll have to discover a new layer of language complexity for it to be necessary and sufficient for.
>>
>>60173734
But go is both a meme language and a beautiful one
>>
http://www.emojicode.org/docs/

So why are you not writing something impressive emojicode yet?

I was thinking about implementing a binary tree sort but the syntax is just so confusing
>>
>>60180329
Not sure you'd have the time to learn the framework or if you'd be willing to use it. It has helped me before in both desktop and web applications and it's secure by default.

But the usage would be straightforward, you'd need to create a dbContext class, a model class which would have the same property names as the columns in your database, then install the provider for your database should be something like "entity framework sqlite" then generate the connection string.

Then finally you'd get the data using linq or raw sql queries for example:
gridView.DataSource = db.someTable.ToList();
//Or
gridView.DataSource = (from x in db.someTable.First(x => x.someColumn == someValue)).ToList();
gridView.DataBind();

or
var query = from x in db.Table
where x.Column1 == "Value"
select new TableModel { Column1 = x.Column1, Column2 = x.Column2 };

gridView.DataSource = query.ToList();

or
gridView.DataSource = db.Table.SqlQuery("SELECT * FROM Table").ToList(); 


Where db is a new context of the database set outside the scope of the list functions so it's always present to check for cache.
>>
>>60178949
Are you using proof general? Is there a way to have unicode for only a certain amount of things?
>>
>>60180755
>http://www.emojicode.org/docs/
for what purpose
>>
File: g-dexists.gif (2MB, 235x240px) Image search: [Google]
g-dexists.gif
2MB, 235x240px
>yfw you realize Kotlin exists

Kotlin is even going native soon with LLVM. Soon I will have a single programming language for my phone, for my desktop, and for my server. The Kotlin master race is coming, are you guys ready?
>>
>>60179892
I'm not sure what you're on about with the semantics of dynamic typing etc, but you're right anon. I'm gonna continue with the two books I have and then move on to "The standard C library". I was just feeling discouraged and fatigued.
>>
>>60180809
bragging and shitposting
>>
racket or ocaml?
>>
>>60180796
No emacs-nox only.
>unicode
Non ascii should be banned in code except for strings. When you'll have to copy paste 屁眼 variable each time you want to use it you'll understand why non ascii (except in strings) must be banned.
>>
>>60181057
OCaml
>>
File: github.png (7KB, 1071x154px) Image search: [Google]
github.png
7KB, 1071x154px
rate my new project
>>
>>60181243
wow
trying to impress nearby cutie pies young man
>>
>>60181243
No script to compile?
>>
>>60181255
real men compile manually
>>
can someone link me the dpt roll thingy with the programs you knwo the thingy
>>
>>60181347
No. Real coder always automate everything that can be automated. You ain't a coder, you're a joke.
>>
>>60181371
>You ain't a coder
Is that supposed to be an insult?
>>
>>60181384
It depends. But for someone who think she/he is a coder, yes.
>>
>>60179151
Anyone?

Just looking for a good intro to assembly
>>
>>60177420
What's new? I bet it's a bunch of useless C++ features.
>>
>>60181438
Assembly is pretty self-explanatory. Learning all the opcodes and optimisation techniques is the hard part.

https://software.intel.com/en-us/articles/introduction-to-x64-assembly

Protip: use the C standard library (or even some of your own C source) as quick-and-dirty tools.
Pro^2tip: learn to use gdb.
>>
This is bad, and I feel bad. Is there anyway to simplify it? Can't be Bash or Gentoo for "reasons"
$a = Get-PSDrive | findstr C:\
$a = $a.Split() -replace "[^0-9]"
$a = $a.Trim() -ne""
$a = $a -join ","

cleanmgr /VERYLOWDISK

$b = Get-PSDrive | findstr C:\
$b = $b.Split() -replace "[^0-9]"
$b = $b.Trim() -ne""
$b = $b -join ","

$a-$b > CleanMgrLog
>>
>>60181515
what the holy fucknuggest is that
>>
rate my helloworld.
https://pastebin.com/CwKLX3aW
>>
>>60181566
That's not even funny. Try something more crazy.
>>
>>60181438
what platform, and what kind of roms?
>>
>>60181530
Me trying to get by without awk. I have no idea what I'm doing.
>>
Should I learn Rust or Crystal? I seem to like Crystal better but it's fairly new and doesn't have as large of a community.

Also, how do I get ideas for programming projects? I've been on a coder's block for a month now and it's driving me crazy.
>>
Is R worth learning?
>>
>>60181646
People doing statistics seem to be moving to it from spss and sas when they can. It really is specific to statistics and you could use it as alternative to matlab so if you need something else don't bother but otherwise it is decent languge and has nice ecosystem.
>>
>>60178976
Wires don't have polarization my dude, the force at the 45 degree points should be just as large as the ones on the axii.
>>
>>60181611
Pick up Kotlin. It's the master race language.

>Also, how do I get ideas for programming projects? I've been on a coder's block for a month now and it's driving me crazy.
I know that feel. What kind of programming are you interested in general? Phone apps? Graphics? Database? Scientific computing?
>>
>>60181695
>It's the master race language.
Impossible. It's POO.
>>
>>60181695
>What kind of programming are you interested in general?

I've done a little bit of everything and I'm just kinda out of ideas
>>
>>60181695
but it's just Java with slightly less boilerplate

It's so similar and dull it's not even worth the effort of designing a new language
>>
Solving a programming exercise for students in my group, because some exercises prepared by lecturer are a bit annoying. It's in C language.
>>
>>60181806
whats the problem?
>>
File: Waveform.png (33KB, 1535x876px) Image search: [Google]
Waveform.png
33KB, 1535x876px
>>60178125
Just watched Patton and made some rice.

Here are the results of testing

>First clock is a reset state (rst is high)
>next clock initializes the memory read (ready is high)
>next clock data from the memory becomes available (valid is high)
>next cycle (!!!) done goes high and Instruction, PC, etc. are set
>this repeats 4 times
Though you can't see it AccessOOB goes high on the next 'done' because addr > MEMORY_SIZE (16 for testing).

I can't really see why there is the wait; hell when the next clock starts, data_valid is no longer high. If I can get it to work like that, then I can have fully pipelined fetching/decoding. There will later be an executive in charge of setting the invalidate flag to invalidate prefetched ops in the case of a branch.
>>
>>60181757
>but it's just Java with slightly less boilerplate
Kind of as it is completely interoperable with Java but it's so much more. More importantly, it'll be compiling to LLVM soon which means you get native support.

>It's so similar and dull it's not even worth the effort of designing a new language
Nope, it's basically Swift outside of iOS.
>>
New thread:

>>60182035
>>60182035
>>60182035
>>
>>60181937
The students are freshmen CS and he gave them an example code that reads and stores the logic formula in an expression tree and wants them to evaluate the expression by traversing the tree. The problem is, they're just beginner programmers and didn't even have a basic intro to algorithms yet. On top of that his way of writing programs is confusing and he even uses global variables.
>>
>>60181970
But Swift is so similar and dull it's not even worth the effort of designing a new language...
>>
>>60182107
sure
>>
>>60181511
Thanks my dude, I'll take a look

>>60181594
Game Boy for a start anyway
>>
>>60182122
YES I AM
>>
>>60173330
>C++
>Literally just C
splain yourself
>>
>>60179732
Oh, that makes a lot of sense now. Thanks! But the part where you pass the vector by reference. What do you mean by "doesn't get copied". I'm not understanding why you chose to use & because the array or vector won't be modified at all.
>>
File: 1452886371607.gif (1MB, 209x180px) Image search: [Google]
1452886371607.gif
1MB, 209x180px
I started learning Lisp and I'm not quite sure how workflow for Lisp is supposed to work. I'm really confused on how I'm supposed to handle the whole write/test/debug cycle with it. I'm coming from a C/C++ background and I'm a long time Vim user. Any advice?
Thread posts: 326
Thread images: 34


[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.