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

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

Thread replies: 255
Thread images: 47
File: fd.png (389 KB, 934x1000) Image search: [Google]
fd.png
389 KB, 934x1000
What are you working on, /g/?
>>
File: ca.webm (3 MB, 1280x720) Image search: [Google]
ca.webm
3 MB, 1280x720
Ask your much beloved programming literate anything (IAMIA).

>>54052143
Nothing to do with strong typing.

>>54052288
static typing: when typing is done in the static environment
dynamic typing: when typing is done in the dynamic environment.
>>
>>54051262
Pls answer /g/
>>
>>54052440
read the OS book by the minix developer
after that you should be able to read linux docs
>>
>>54052488
I'd rather not read a book.
>>
File: cake.webm (447 KB, 900x506) Image search: [Google]
cake.webm
447 KB, 900x506
>>54052440
https://www.kernel.org/doc/gorman/pdf/understand.pdf
>>
>>54052512
then go fuck yourself
>>
>>54052552
Fuck you you cuck
>>
Just doing simple exercises so I too can one day become a programmer-pro.
And learning a bit about controlling my computer with the terminal, which is lots of fun.

All low-tier stuff, I guess.
>>
>>54052512
hahaha what is this
>>
>>54052638
i remember when I was this cute once
>>
>>54052512
the average python "programmer" ladies and gentlemen
>>
Writing a brainfuck REPL in Rust, I don't even know why.
>>
File: sweat.jpg (20 KB, 230x300) Image search: [Google]
sweat.jpg
20 KB, 230x300
>>54052664
Well I knew about that I joined them like
LEFT JOIN forum_database_users u ON (u.UId = t.TAuthorId)

to get the author of the thread but I have really no idea how to get the lastpost author
>>
>>54052855
Question:
What is 'LastPostFake'?
>>
>>54052923
Everything with Fake is what the website reports, not what I have indexed, I barely ever use it
>>
fizz buzz
>>
So I'm on GNU/LINUX and want to compile C into 16-bit MZ executable for DOS and launch it in dosbox.
Any recommended compilers?
>>
New thread >>54037326
>>
>>54053236
fuck off, let that one die already.
>>
>>54052958
Well...it's not a good idea to join from a date.

Just so we're clear:
We want the thread information, as well as the latest post you've indexed, and the name of the Author of that particular post.

I'm tinkering, give me a bit.
>>
>>54053464
>Well...it's not a good idea to join from a date.
What do you mean? I don't think I was joining from a date

>We want the thread information, as well as the latest post you've indexed, and the name of the Author of that particular post.
Yes, maybe including the id of that particular post would be a good idea. Keep in mind that I only fetch user data when they create a thread in the website so some posts won't have user data while every thread owner will have user data, that's why I used so many ifnulls


On a unrelated note, do you think I should bother with "foreign keys"
>>
>>54053236
fuck off retard
>>
File: System Overview.png (25 KB, 543x463) Image search: [Google]
System Overview.png
25 KB, 543x463
I've finished designing my system and making sure all the building blocks work, now I just have to implement the damn thing.
>>
>>54053609
You already are using foreign keys, sort of.

To put it simply, "TId" in forum_database_users is a foreign key from forum_database_threads.

Is this a schema of your own creation?

There are some changes I could immediately make if I were administrating this database.

First an foremost, I would redo ALL of the column names to NOT use the P, U, or T prefix. That is pretty bad design and just makes life difficult.

Here's how a query could look:
SELECT 
t.ThreadID,
t.Name AS ThreadName,
t.AuthorID AS Author,
u.Name AS AuthorName,
t.LastPostDateUnixFake,
COUNT(p.ID) AS PostCount,
FROM_UNIXTIME(MAX(p.DateEntered/1000)) AS LastPostIndexed
FROM
threads t
LEFT JOIN posts p ON p.ThreadID = t.ThreadID
LEFT JOIN users u ON u.UserID = p.UserID
GROUP BY
t.ThreadID,
t.Name,
t.UserID,
u.Name,
t.LastPostDateFake
ORDER BY MAX(p.DateEntered) DESC
>>
>>54053734
Yes I made this schema from scratch

I kinda added the foreign keys just by try trial and error but I don't really know the benefits or what I could do with them, just heard it increased performance. maybe I'll remove them.

As for your suggestion I really like the prefixes because they make my life easier when I'm working on the indexer itself but I would love to hear some other suggestions you might have
>>
One of my co-workers was apparently under the impression that even half a beer was enough to get you a DUI.

Poor guy. He wasn't partaking in Free Beer Fridays because he was afraid it was illegal to drive after drinking a single beer.

Python is worst language.
>>
>>54054350
>Python is worst language.
Blasphemy
>>
The answer is better compilers.
>The answer is better compilers.

THE ANSWER IS BETTER COMPILERS.
>>
>>54054378
Okay, maybe not worst, but in the same sense that the ugliest chick at the party isn't the ugliest girl in the world.
>>
File: sd.jpg (42 KB, 600x476) Image search: [Google]
sd.jpg
42 KB, 600x476
>/dpt/ has never made anything that is used by 1,000+ users.
>>
>>54054399
Well, aren't you Sherlock fucking Holmes?
>>
File: truth-at-harvard12.jpg (66 KB, 369x379) Image search: [Google]
truth-at-harvard12.jpg
66 KB, 369x379
I'm implementing IEEE754 as bit lists in Python
>>
>>54054391
>ugliest chick at the party isn't the ugliest girl in the world.
Nah man Python is that cool stoner chick who might not be the nicest to look at but is damn fun to hang around with.
>>
File: dfghfghfghfgh.png (868 KB, 812x620) Image search: [Google]
dfghfghfghfgh.png
868 KB, 812x620
So I almost got my firmware working.

I have one last problem.

Pic related is my switch matrix around the arrow keys, as you can see there are five rows and 16 columns.
>>
>>54054424
And if you brought her to a business lunch, she'll embarrass the fuck out of you.

My programming language is metaphor form is a cute librarian that knows how to enjoy the little things, but is also extremely knowledgeable when necessary. She also knows how to talk to literally anyone, with a universally compatible personality type.

Guess my language-fu.
>>
>>54054399
But I have, anon.

>1,000

Small time.
>>
File: why nigga, shit nigga.jpg (33 KB, 471x355) Image search: [Google]
why nigga, shit nigga.jpg
33 KB, 471x355
>>54054409
>>
>>54054468
C?
>>
>>54054468
Haskell?
>>
>>54054446
What's this.
>>
>>54054468
Common Lisp
>>
File: P1060546.jpg (2 MB, 4592x3448) Image search: [Google]
P1060546.jpg
2 MB, 4592x3448
>>54054446
This is the array which represents the switch matrix. KC_NO stands for an empty space, such as a column which doesn't extend all the way to the bottom. The 15th column, where those two arrow keys are attached would basically be sixth row since there's two switches in one column.

How do I put two keys in one column? Making a sixth row for the last arrow key is not an option.

>>54054509
A keyboard
>>
>>54054505
>>54054507
>>54054512
Additional hint:
She's very low-maintenance, and doesn't need much coercion to do exactly as I tell here. I also never have to worry about her misunderstanding what I'm telling her, as she'll ask for clarification if I'm not explicit.

...which frankly rules all of these out.
>>
>>54054495
I'm thinking of maybe making a programmer's calculator, and you should be able to change rounding rules, bases, toggle individual bits and shit
>>
File: sdfsdfsdf.png (60 KB, 1829x130) Image search: [Google]
sdfsdfsdf.png
60 KB, 1829x130
>>54054524
Well, thanks to anon I forgot that I wanted to attach a picture of the array

   { KC_##K00, KC_##K01, KC_##K02, KC_##K03, KC_##K04, KC_##K05, KC_##K06, KC_##K07, KC_##K08, KC_##K09, KC_##K0A, KC_##K0B, KC_##K0C, KC_##K0D, KC_##K0E, KC_##K0G }, \
{ KC_##K10, KC_##K11, KC_##K12, KC_##K13, KC_##K14, KC_##K15, KC_##K16, KC_##K17, KC_##K18, KC_##K19, KC_##K1A, KC_##K1B, KC_##K1C, KC_##K1D, KC_##K1E, KC_##K1G }, \
{ KC_##K20, KC_NO, KC_##K21, KC_##K22, KC_##K23, KC_##K24, KC_##K25, KC_##K26, KC_##K27, KC_##K28, KC_##K29, KC_##K2A, KC_##K2B, KC_##K2C, KC_NO, KC_NO }, \
{ KC_##K30, KC_NO, KC_NO, KC_##K31, KC_##K32, KC_##K33, KC_##K34, KC_##K35, KC_##K36, KC_##K37, KC_##K38, KC_##K39, KC_##K3A, KC_##K3B, KC_##K3C }, \
{ KC_##K40, KC_NO, KC_NO, KC_##K41, KC_##K42, KC_NO, KC_NO, KC_##K45, KC_NO, KC_NO, KC_NO, KC_##K49, KC_##K4A, KC_##K4B, KC_##K4C, KC_##K4D, KC_##K4E } \
>>
>>54054526
I dunno, Ruby?
>>
>>54052326

> tfw I'm gonna take the AP computer science course without taking the class just because I can
>>
man xinput doesnt tell me much
can i use xinput to remap keyboard keys?
>>
>>54054526
Java
C++


...Perl ?
>>
>>54054524
Is that a diy keyboard from scratch ?
>>
Any tips on getting familiar with Eclipse?

I've only coded Java using notepad but I need to be familiar with Eclipse asap.
>>
>>54054641
>I've only coded Java using notepad
Jesus christ. Why?

Using an IDE like Eclipse or IntelliJ gives you lots of quality-of-life things, and the sooner you learn them, the better.

I can't remember which book I used for Java back in the day, or I'd recommend stuff. I'm sure Eclipse has decent 'Getting Started' documentation.
>>
File: P1060519.jpg (2 MB, 4592x3448) Image search: [Google]
P1060519.jpg
2 MB, 4592x3448
>>54054592
not entirely from scratch.

It's a magicforce, I wanted to replace the switches and ended up bricking parts of the PCB when trying to desolder them. I decided that it'd be easier to just handwire it and have a fully programmable keyboard (it was anyway about time that I'd learn how to use the TMK firmware) than it'd be to try to repair the PCB (which I spent an afternoon trying).

I took the casing and the gateron switches I wanted to replace the stock outemu blues with and wired them up to a teensy. Then I spent a good twelve hours configuring the firmware and subsequently fixing shit.
>>
>>54054526
Scratch
>>
>>54054641
>Any tips on getting familiar with Eclipse?
Ctr+Shift+O, Ctr+Shift+F, Alt+Shift+S, Alt+Shift+R, Ctr+Shift+T and Ctr+H
>>
>>54054719
oh, I forgot the most useful one: Ctr+Shift+C
>>
>>54054675
because my professor was a cunt who told us that's the only way to code with java until the last day of class
>>
Do I have to find programming interesting enough to research/do it in my free time to get a job in it? I've recently started getting a CS degree and it seems like everyone else in my classes is more motivated than me.
Half the class asks questions that are beyond what the teacher has taught.

I mean, don't get me wrong, I like programming. My programming classes are the only ones I actually enjoy doing work for. At the same time, I don't feel any particular desire to write my own code unless I need to.
Should I just quit CS while I'm ahead?
>>
>>54054759
Probably.

If you're not hungry to know more about particular things, ESPECIALLY in programming, you're going to be stuck in a single-class code monkey position.
>>
can you help me finish my monty hall simulation?
https://en.wikipedia.org/wiki/Monty_Hall_problem

i'm trying to prove to /pol/ that it's not jewish tricks that switching is the best choice most of the time
>>>/pol/71040918

here's what i got so far

package montyHall;

import java.util.Random;

public class Simulate {

public static int generateNumber(int x){ // returns a random value between 1 and x
Random rand = new Random();
int y = rand.nextInt(x);
return (y + 1); // add 1 to change it from 0 inclusive to x exclusive, to 1 inclusive to x inclusive
}

public static void main(String[] args){
boolean[] doors = new boolean[3];
for(int i = 0; i < doors.length; i++){
doors[i] = false;
}
doors[generateNumber(3)] = true;

int selectedDoor = generateNumber(3);
}

}


i should be working on my algorithms homework instead of this crap but these 12 year olds are pissing me off
>>
>>54054759
>At the same time, I don't feel any particular desire to write my own code unless I need to.

If you're just doing it for the money, you won't be happy.
>>
>>54054740
Ctrl+Shift+R, Ctrl+O ?
>>
File: ss (2016-04-15 at 09.20.53).png (10 KB, 388x231) Image search: [Google]
ss (2016-04-15 at 09.20.53).png
10 KB, 388x231
>>54054399
>not writing software that is being used by literally thousands of people at THIS VERY moment
Are you even trying?
>>
>>54054784
ignore the random blooper with adding 1, you get what i'm going for in general though. i had copied and pasted that function from a different project i'm working on
>>
anyone have any interesting ideas for side projects?
i have no imagination
>>
If the end goal was make scheme like language compiler with easy interface to c++, how should I go on about it?
Code example could be something like
(c-include "foo.h")
(c-link "foo")
(let ((x (new Foo)))
(print Foo::static_var)
(print (x.fn)))
>>
>>54054784
If they literally cannot understand the Wikipedia article, then what makes you think your shitty python script will convince them?

What if Python was created by a jew?

The wiki explains it in-depth already.
>>
>>54054818
Try to make a QR code detection mobile app, preferably without usings libs
>>
>>54054749
>not googling it
>not reading any books
>>
>>54054840
>preferably without usings libs
Why?
>>
>>54054775
To be honest, being a code monkey doesn't sound too bad. If I got paid a livable wage, I would be fine writing mostly monotonous code.

>>54054787
>If you're just doing it for the money, you won't be happy.
Like I said, I enjoy it well enough. So far, I think programming might be a good middle-ground between soulless high-paying work and penniless creative work. But if every programming job requires people who are super motivated, I fear I might not make the cut.
>>
>>54054862
To learn shit. What else is there?
>>
>>54054840
i would rather it be something that hasn't been done ad nauseum
but thanks for the idea
>>
>>54054838
because i'll run ten thousand trials and they won't be able to beat me in arguments with their sheer level of retardation and lack of understanding
>>
File: shitposting.png (234 KB, 700x624) Image search: [Google]
shitposting.png
234 KB, 700x624
>>54054887
>arguing with /pol/
I think you're the one who's retarded.
>>
>>54054759
Not at all. I'm a comp eng student who's just doing thing because I'm mildly interested in it and I'm pretty good at it. I've already worked a year placement doing one random language and various internship with others and I can tell you it's easy shit if you're not a complete social outcast and can nail interviews.
>>
>>54054818
If you haven't automated your house yet get on it
>>
File: sweating man.jpg (66 KB, 445x414) Image search: [Google]
sweating man.jpg
66 KB, 445x414
>>54054958
>it's easy shit if you're not a complete social outcast
>>
>>54053734
Did you manage to get the stuff working?
>>
File: repl.jpg (2 MB, 1752x1166) Image search: [Google]
repl.jpg
2 MB, 1752x1166
How many Libre Software LISP-descended systems with a REPL must a true Gentooman have installed on their system, /g/?
>>
>>54052419

What's an environment?
>>
File: wew.png (97 KB, 1860x636) Image search: [Google]
wew.png
97 KB, 1860x636
Alright /g/, pic related is a code in Swift, what would be the Java equivalent of it??
>>
>>54055172
I started writing it down, but it doesn't fit into this textarea.
>>
>>54055214
kek
>>
>>54055172

What text editor/theme?
>>
>>54055274
Xcode/Dusk
>>
I wrote a small tic tac toe game.
Want to make something else to learn a bit of python. but not sure what
>>
>>54055150
REPL is an acronym for "REEEEE poo in loo"
>>
File: buttserver.png (171 KB, 800x600) Image search: [Google]
buttserver.png
171 KB, 800x600
>>54055465

How many Rajeets do you know that do REPL based development?
>>
Professional Java programmer here willing to help any of you with your assignments or homework

Here at /dpt/ we care about our programming members we are all a family
>>
>>54055597
Fag
>>
>>54055624
Liking 2d traps is not gay Anon...
>>
>>54055597
Doing good work there anon, don't let douchebags deter you.
>>
>>54055647
Thank you lets make /dpt/ great again by one real programming post at a time
>>
>>54055172
so is Swift just an even shittier clone of JS?
>>
>>54055647
We don't want Pajeet or any of his friends here.
>>
>>54055692
No.
>>
>>54055692
It's a worse Java
>>
Is there a way to use php to hide a button for a set amount of time after it's pressed? All of the things I've seen on google for php timers are about execution time. I know it runs somewhat parallel on webpages so I don't think I can just you sleep to wait and then change a check variable back to 1.
>>
found this on pol
 
if(car == 1){
status[0] = true;
}
if(car == 2){
status[1] = true;
}
if(car == 3){
status[2] = true;
}
>>
>>54055692
Except it's just as powerful as C++ and Java, but faster.
>>
>>54055828

<script>
<?php
$current_time = time();
//connect to db
// check if there is no expire timestamp in db
if($thereIsNoTimestampInDB){
$expire_time = $current_time + (24 * 60 * 60 * 3); // increase 3 days to timestamp
//save timestamp to database
}else{
//get Timestamp from DB and save it to $expire_time
if($expire_time > $current_time){
echo "var expired=true;\n";
}else{
echo "var expired=false;\n";
}
}
?>
</script>

>>
>>54055172
looks like javascript, does it perform better than nodejs?
>>
>>54055886
Thanks man, I'll give a go at implementing it.
>>
>>54055934
You are welcome my main programming language is Java though. I haven't done php in awhile.
>>
File: 1459111126188.jpg (222 KB, 1600x1920) Image search: [Google]
1459111126188.jpg
222 KB, 1600x1920
>>54055878
>faster than C++
>>
I like pegging.
>>
>>54056084
whats that?
>>
>>54055878
>faster than C++ and Java
http://benchmarksgame.alioth.debian.org/u64q/swift.html
considering Objective-C is generally slower than C++ how would you even think Swift (which has been known to be slower than Objective-C from the beginning) would be faster?
>>
File: fast.png (70 KB, 1476x222) Image search: [Google]
fast.png
70 KB, 1476x222
>>54055902
>>54055692
https://swift.org/about/
>>
File: kys.png (102 KB, 1112x896) Image search: [Google]
kys.png
102 KB, 1112x896
>>54056170
>>
>>54056255
maybe for small benchmarks
idiomatic Swift is going to be slower and performance in full programs will most likely suffer
https://blog.sudeium.com/2015/02/10/swift-1-dot-2-performance-pretty-much-fine/
>>
>>54056308
> feb 2015 news
lad, we're on 2.2 now, update your shit man.
>>
>>54056491
let's see some real world statistics then
there's a reason apple wrote "Up to"
>>
>>54053655
>Webportal as a home automation interface

The pajeet is too strong
>>
I'm building a GCC cross compiler, is it possible to specify the target triplet to produce a flat 16 or 32 bit binary? if not, is writing an ELF loader in a second stage bootloader a good idea? or too much work?
I absolutely will not use GRUB.
>>
File: 1383858664.png (58 KB, 246x162) Image search: [Google]
1383858664.png
58 KB, 246x162
>>54056727
>I'm building a GCC cross compiler
you're fucked m8.
>>
>>54056727

The problem with building flat binaries is that you don't really have clear distinction between data and code segments. To my knowledge, no currently supported GCC target triplet supports flat binary formats, so if you really wanted to make your own binary format for everything, you'd have to port GCC to your system.

Also, it is perfectly acceptable to make your own ELF loader in your bootloader. You could also make a PE loader if you'd prefer to use that instead. Although if you plan on using PE, you're pretty much limited to x86 and... well, ARM support for PE files is pretty shitty, and PE on any other architecture is dead (even if Win NT supported MIPS or PowerPC at one point). So yeah, just make your own ELF loader. It's not THAT complicated of a format.
>>
>>54057012
Alright, thanks. I'll write an ELF loader.
Btw, do I need to have two cross compilers, one for 32bit protected mode and another for long mode? or can x86_64-elf produce 32bit protected mode code using -m32?
Should I be building an x86_64 cross compiler instead of i686 regardless if I'm using long mode? I do plan on going into long mode at some point in time however.
>>
File: 1456382262546.jpg (8 KB, 205x246) Image search: [Google]
1456382262546.jpg
8 KB, 205x246
> tfw developers who literally do nothing but write to spec

The bane of my existence. If your write your shit to spec and all text on the website becomes purple, fucking talk to someone about it. You don't sit alone in your own little bubble, there rest of your team and any other team that you interact with (sysadmins, product managers, app support, etc) have to deal with the consequences of your laziness. "Oh but I wrote it to spec!" Go fuck yourself.
>>
>>54057150
I like to write a spec for large hobby projects, and then get onto the programming and use the spec as a reference, so I don't forget any ideas I might have come up with.
But of course, I modify the spec where due.
Anything wrong with that? or is it just stupid?
>>
File: beyondfizzbuzz.jpg (36 KB, 381x499) Image search: [Google]
beyondfizzbuzz.jpg
36 KB, 381x499
who here ludum dare?
>>
>>54057182
That's fine because you're flexible. The spec isn't law, it's just a representation of the goal.
>>
/*    grab the sprite offset */
lua_getfield( L, -1, "sprite" );
lua_getfield( L, -1, "offset" );
lua_getfield( L, -1, "x" );
offset.x = floor( lua_tonumber(L, -1) );
lua_getfield( L, -2, "y" );
offset.y = floor( lua_tonumber(L, -1) );
lua_getfield( L, -3, "w" );
offset.w = floor( lua_tonumber(L, -1) );
lua_getfield( L, -4, "h" );
offset.h = floor( lua_tonumber(L, -1) );
/* grab the sprite frame */
lua_getfield( L, -7, "sprite" );
lua_getfield( L, -1, "frame" );
int frame = floor( lua_tonumber( L, -1 ) );
/* grab the sprite clip */
lua_getfield( L, -2, "sprite" );
lua_getfield( L, -3, "clip" );
lua_rawgeti( L, -1, frame );
lua_getfield( L, -1, "x" );
clip.x = floor( lua_tonumber(L, -1) );
lua_getfield( L, -2, "y" );
clip.y = floor( lua_tonumber(L, -1) );
lua_getfield( L, -3, "w" );
clip.w = floor( lua_tonumber(L, -1) );
lua_getfield( L, -4, "h" );
clip.h = floor( lua_tonumber(L, -1) );
/* grab the sprite texture */
lua_getfield( L, -5, "sprite" );
lua_getfield( L, -6, "texture" );
int texture = floor( lua_tonumber( L, -1 ) );

My lua script is holding an entity table, which has a sprite table inside it. It's not my intention to throw everything on the script side, I just want the script side to hold "metadata". I'm experimenting, and right now I need a little clarification on something. What can I do to easily go back to the sprite table, and go to the next field in it with -1? I tried settable and insert but those didn't seem to work. Thanks
>>
File: browser #112.png (39 KB, 494x724) Image search: [Google]
browser #112.png
39 KB, 494x724
same shit; different day
>>
>>54057098

>or can x86_64-elf produce 32 bit protected mode code using -m32?

Maybe? Fucking try it. I'm too lazy to turn on my shitty ass build box in the living room to see if it'll work.

>>54057150

If the spec is flawed, the programmer can't be blamed.
>>
>>54052326
CS50x

Anyone else doing CS50?
>>
OK /dpt/, I want your opinion on something.
I am studying a new pattern of development that I never saw before (MVP).
To study it, I downloaded an example source code and I am creating my own App, but taking a look on that source code to make sure I am doing the right thing.
Am I a bad programmer for doing this?
>>
>>54057771
Yes.
>>
>>54057771
for using mvp instead of mvc? yes

listening to fowler when you're starting out is a recipe for self-loathing and underproduction
>>
>>54057832
What would be the right way to learn a new pattern or concept if I never saw or used before?

>>54057833
Care to elaborate?
MVP seems to be pretty solid way to deal with Android development.
>>
File: tc_000.png (4 KB, 640x400) Image search: [Google]
tc_000.png
4 KB, 640x400
I'm trying to get Borland Turbo C to work under dosbox.
Linking shits itself, pic related.
>>
File: Fun.jpg (31 KB, 225x272) Image search: [Google]
Fun.jpg
31 KB, 225x272
>>54057585

There's a difference between following a flawed spec and not giving a fuck when things are clearly wrong.
>>
>>54057979
Ok, got it. Wrong /lib folder
>>
>>54057979
>obsolete compiler in an emulated obsolete os

Why torture yourself? What good could come from it?
>>
>>54058262
Displaying meme images using 320x200 256 color mode
>>
>>54058262
>obsolete compiler in an emulated obsolete os
Agreed, he should be using DJGPP like a sane person.
>>
>>54058399
Oh, ther's also Open Watcom which is faster but more of a pain in the ass to deal with than DJGPP.
>>
>>54055831
Looks like a keyboard status map, also:

status[car] = true;


will register when 'car' key is pressed.
>>
>>54057319
nevermind, I forgot lua_pop lol
>>
File: manly_tears.jpg (8 KB, 177x238) Image search: [Google]
manly_tears.jpg
8 KB, 177x238
>>54058324
>13h mode
>Best mode
>>
Is it possible to make a regexp that can match either characters or strings?
"[,=()] | wew"
doesn't work as expected.
>>
Hey /g/ got a question for you.

I am trying to implement when a user inputs a number after trying choose an account to work with to be able to stay on that account with that specific information and not other ones. Any idea on how one would implement something like this? Here's what I got so far.

int main()
{
Account acc0, acc1, acc2, acc3, acc4, acc5, acc6, acc7, acc8, acc9;
Account list[10] = { acc0, acc1, acc2, acc3, acc4, acc5, acc6, acc7, acc8, acc9 };

acc0.setAccountId(0), acc1.setAccountId(1), acc2.setAccountId(2), acc3.setAccountId(3),
acc4.setAccountId(4), acc5.setAccountId(5), acc6.setAccountId(6), acc7.setAccountId(7),
acc8.setAccountId(8), acc9.setAccountId(9);

int inputaccnum;
cout << "Please enter an account number from 0-9: " << endl;
cin >> inputaccnum;
acc0.setBalance(rand() % 20000 + 10000);
acc0.setInterest(1.5 + ((double)rand() / RAND_MAX) * (5.0 - 1.5));

int menuchoice;
do
{
cout << endl << "Enter 1 to make a deposit" << endl;
cout << "Enter 2 to make a withdraw" << endl;
cout << "Enter 3 to check balance" << endl;
cout << "Enter 4 to check interest rate" << endl;
cout << "Enter 5 to display account summary" << endl;
cout << "Enter -1 to return to the main menu" << endl;
cin >> menuchoice;

if (menuchoice = 1)
{
int deposit;
cout << "Enter the amount you'd like you to deposit: ";
cin >> deposit;
acc0.deposit(deposit);
}
else if (menuchoice = 2)
{
int withdraw;
cout << "enter the amount you'd like to withdraw: ";
cin >> withdraw;
acc0.withdraw(withdraw);
}
else if (menuchoice = 3)
{
cout << "Current Balance: " << acc0.getBalance;
}
else if (menuchoice = 4)
{
cout << "Monthly interest rate: " << acc0.getMonthlyInterestRate << endl;
cout << "Yearly interest rate: " << acc0.getInterest;
}
return 0;
}
>>
C++ bros, i need help again.

Is there a color/class container that can store rgb values kind of like

CONTAINER rgb;
rgb.red = GetRValue(color);
rgb.green = GetGValue(color);
rgb.blue = GetBValue(color);

I was using int variables but its not efficient.
>>
>>54057979
> autism
>>
>>54058595
I'm no regex wizard, but what about
([,=()] | wew)
>>
File: dosbox_009.webm (72 KB, 320x200) Image search: [Google]
dosbox_009.webm
72 KB, 320x200
>>54058592
It works.

My converter is in C#. Now I have to learn how to do the work using backgroundWorker, in order to get a progressbar and to prevent UI from freezing.
>>
>>54055743
It's a better C#
>>
File: Untitled.png (2 MB, 1680x1010) Image search: [Google]
Untitled.png
2 MB, 1680x1010
I just changed the mouse behavior in browser #112 so it doesn't instantly switch to a different thread when the tile's thread changes and the mouse moves. I used to think that was a desirable feature, but it's annoying when accidentally bumping the mouse and losing the thread I'm reading.

this image gives a hint at what I mean. this thread moved to a different tile while I was reading it. now when I bump the mouse I stay in the same thread. and all is right in the world.

/end blog post
>>
>>54059005
what happens if the web devs change something, will the browser break?
>>
>>54058757
make one? tf
and it would be more pythonic do do 'color.getRValue()' etc
>>
>>54059056
it's a possibility. #110 had trouble after the last major site change (apr/may 2014?).

#111 fixed things, but was unreleased.

and now #112 is nearing release. I anticipate much whining when people see it's just the exe and not the code.
>>
>>54059005
well shit. spoke too soon.
changing that behavior introduced a new (old, and annoying) problem where the mouse enters the grid and displays the wrong thread. had to revert.
>>
So lets say you're using curl on a page.

3/5ths of the time it returns a link
1/5th of the time it returns a link to the link you want
1/5th it returns a page that just says please wait... and then redirects to a page that has the link when in browser

When you use curl and it happens to be that 1/5th what can be done so it redirects to the second page to get the link
>>
File: ..jpg (47 KB, 579x300) Image search: [Google]
..jpg
47 KB, 579x300
>>54059238
>>
Just in case you had forgotten:

http://www.bbc.co.uk/news/technology-35559439
>>
I'm not familiar with the codebase, but I'm looking into contributing to Visual Studio Code. It really needs an option to change the syntax of the current file.
>>
>>54059272
yeah, and male birth control is coming any day now (they said that 50 years ago).

basically, news articles don't always amount to much.
>>
>>54059300
>change the syntax of the current file.
What does that even mean?
>>
>>54059259
Can you please explain your post
>>
>>54059065
Rate my code

int class container
{
int red(int redvalue)
{
int redcontainer;
redcontainer = GetRValue(redvalue);
return redcontainer;
}
};
>>
>>54059335
no
>>
>>54059318
Oops, I meant syntax highlighting.
>>
>>54059318
>>54059355
Fuck, I meant syntax highlighting mode. Like set to use C++/Python/CSS style highlighting for a file type it might not be familiar with.
>>
>>54059330
It means, Rephrase the question.
But I don't use CURL so I doubt I can help.
>>
>>54059378
So you curl a page

1/3rd of the time it returns a "Please wait..." page
This page, on a normal browser would redirect to a second page that has the link that I am trying to get

however, due to this being curl it only downloads the page with the "Please wait..." and has no information which would allow me to get to the second page that has the link that I need.

How can I get a workaround with this
>>
>>54059370
You want Visual Studio (the IDE?) to do syntax highlighting for foreign file types? What's the point? I haven't used it in years.
>>
>>54059418
Visual Studio Code
https://en.wikipedia.org/wiki/Visual_Studio_Code
It's free software and cross platform. I have no idea why it has "Visual Studio" in the name though.
>>
>>54059405
sounds like a "recursive" thing.
I know how to code for it, but don't know curl.
>>
File: himelewd.jpg (274 KB, 600x480) Image search: [Google]
himelewd.jpg
274 KB, 600x480
So I'm putting some of the finishing touches on my C++ backend and looking to begin development of the frontend. The frontend will get data through a tcp/ip connection with the backend, data will be serialized with ProtoBuf. the GUI on the frontend will be pretty simplisitc, think tables and graphs, mainly trying to display data in a neat manner with few added frills needed.

What language does friday night /dpt/ recommend I use? choices are C++, C#, GO and Python. what GUI library does /dpt/ recommend with that? I only have minimal experience with C#/VS GUI development.

thanks lads.
>>
Which term do you prefer, 'nipple brackets' or 'curly braces'?
>>
File: 1460598916863.webm (3 MB, 1280x720) Image search: [Google]
1460598916863.webm
3 MB, 1280x720
>>54059457
Doesn't matter what you call them. They SUCK. Only shitty parsers need them.
>>
>>54058821
Now I'm trying to read files containing image data. I want to use int 21h, but somehow I fail.
>>
>>54059450
Protobuf with node is amazing. Seriously way better than the others but I'd probably go with Go from your choices. Idk about gui
>>
>>54059477
Go kicks ass. It has wrappers to create GUI applications, but I've never worked with that.
>>
>>54058757
>>54059335
Shit.
struct Color {
unsigned int red : 8;
unsigned int green : 8;
unsigned int blue : 8;
};
>>
>>54059549
>unsigned int red : 8;
Use uint8_t, turbonerd.
>>
>>54059567
>not using uint_fast8_t typedef'd as u8
pls fgt, I'm trying to make things ez for the newbie, plus it's not like it has any difference in code generation when you're using bitfields.
>>
>>54059549
Thanks anon, im a noob programmer.

Also, isnt that what structs are, just containers for information in a more structured way?
>>
>>54058623
Anyone willing to do my c++ homework from this code I posted as long as they delivar within 24 hours? Totally willing to pay the dude $10 and it's probably more than half done at this point.
>>
>>54059450

As a Python dev (specifically Flask and Django) making GUIs in Python is kind of a pain in the ass unless you're doing web stuff.

I'd say C# because GUIs in VS are easy peasy.
>>
Will VR headsets make it easier to code GUIs?
>>
>>54060050
Maybe "code" wasn't the best word.
Will VR (and hand-tracking) make it easier to layout/design GUIs?
>>
haskell is fucking nutty
>>
File: dosbox_010.webm (28 KB, 320x200) Image search: [Google]
dosbox_010.webm
28 KB, 320x200
>>54059469
File opening works.
Now I need to make some kind of loop system. I need an array of pointers to filenames.
>>
>>54060113
I forget, which prog does the screencap webms?
>>
>>54060132
dosbox has built-in support for capturing avi, and then I simply convert it to webm
>>
>>54060197
Why do people still use AVI?
>>
>>54054399
tox already accomplished that
>>
>>54060209
its an extremely simple container to implement,

you could stuff h265/aac streams in it if you wanted
>>
>>54060260
But as a result, don't the files tend to be pretty large, even with lower quality?
>>
>>54060197
oh
well, I googled for my own, and will try this to record the screen:
https://technet.microsoft.com/en-us/magazine/2009.03.utilityspotlight2.aspx
>>
>>54060341
sure, but its easier for software (dosbox in this instance) to record the screen context and put it in an AVI for outside programs to consume.

getting mp4 or mkv or what have you working would require far more time/resources than
stuff this in an AVI container, with no sound:
>The video portion of the movie is encoded with the 32bit ZMBV (Zip Motion Block Video) CODEC, which allows for reasonably fast encoding of low color content.
>>
File: Untitled.png (22 KB, 396x155) Image search: [Google]
Untitled.png
22 KB, 396x155
>>54060394
RIP system32
>>
hello lads
>>
File: FUCK THIS.png (45 KB, 1078x851) Image search: [Google]
FUCK THIS.png
45 KB, 1078x851
Anyone here knows boostrap/css? This shit is driving me nuts

My structure goes basically like this

div.row
div.col-sm-12
div.row.data-container
div.col-md-4.data-panel
h2
div.well
my shit here



well seems to be fucking shit up with it's padding, how do I fix this?
>>
>>54060629
>front-end
Found the faggot.
>>
>>54060652
If I worked with this I would've solved it by now
>>
>>54060086
just becaues your dumb doesnt mean you should be so nasty to other languages. haskell is fun, challenging and a much smarter language then whatever you use
>>
>>54059549
Why on earth would you use bit-fields for this?
>>
>>54059598
Sounds to me like you're the newbie here. Go back to C 101.
>>
File: Untitled.png (156 KB, 579x971) Image search: [Google]
Untitled.png
156 KB, 579x971
>>54060577
I'm getting my anus prepared.
that ugly orange text isn't very encouraging.
>>
>>54059493
Go is a badly designed language. All it has going for it is speed.
>>
>>54057012
>To my knowledge, no currently supported GCC target triplet supports flat binary formats, so if you really wanted to make your own binary format for everything, you'd have to port GCC to your system.

AVR supported that, I used it. Anyway, how do they build flash images for openwrt routers then? There surely is a way.
>>
>>54059466
Enjoy your inferior, slow-as-heck toy language.
>>
has anyone ever used PostgreSQL with C++? It looks like there's a C library called libpq and then libpqxx with questionable maintenance/upkeep. what would be the recommendation?

>>54060598
hello GTP, good to see your social life is still active and exciting.
>>
>>54060741
>hello GTP, good to see your social life is still active and exciting.

Well, I did just get home from being out all day. I'd say my social life is just fine.
>>
I am making $3000 a week doing web dev but I hate it and it's so boring and not real programming what it do?
>>
>>54052774
Nice.
>>
>>54060749
keep doing it, its 3k a week
>>
>>54060763
But I want to do real programming and all the places nearby are web development javascript and php no C++ or C feels bad man hell I'd even take Java
>>
>>54060749

What web dev are you doing and where?
>>
>>54060737
Actually, it's obscure, fast-as-hell language.
>>
>>54060785

which language is that?
>>
>>54060820
PowerBASIC
>>
>>54060848

Lad...
>>
>>54060874
>Tfw you, Ruby, and OSGTP will never be in a wild interracial orgy with black shemales all programming in the same room afterwards
>>
>>54060874
Pretty much the response I expected. Those who have never used it almost always thumb their nose at it (most likely because they see "BASIC")
>>
I have to do it guys. I'm going to learn Java.

I'm taking the mandatory course in it over this summer and I want to go in knowing it already.

I want that easy Google Play Store money too, so I'm probably going to make some shitty game at some point.

How should I learn Java? I pretty much know the basics (i.e. its OOP), I know some C++ etc, but nothing really about the standard library and whatnot.

Any recommended books/resources? Thanks.
>>
>>54060903
>He thinks it's easy to make money on Google Play store

LaughingSystems.exe
>>
>>54060903
Something I've found works well for getting the feel of a new language is to take code from a language you already know and translate it into the new language. Once you do a basic translation go back and optimize it for that current language.
>>
>>54060910
Not loads obviously. One of my acquaintances has some shitty apps up and makes some change from it.
>>
>>54060922
Good idea, I'll try that out, thanks.
>>
>>54060923
What apps are they and how much change?
>>
>>54060894

I don't hate BASICs, I just don't think I've heard anything positive about PowerBASIC. I don't think I've ever heard anything about PowerBASIC.

>>54060885
>wild interracial orgy

Yes!

>black shemales

No, damn it!
>>
Java is the language of aristocrats and noblemen.

public static void main (String[] args){

int n = 10;
System.out.println(fibonacci(n));

}

private static long fibonacci (int n){

if(n == 0)

return 0;

else if(n == 1)

return 1;

else

return fibonacci(n - 1) + fibonacci(n - 2);

}
>>
>>54060958
>all of those extra blank lines
>recursive fibonacci in java
gf
>>
>>54060950
>I don't think I've ever heard anything about PowerBASIC.
Like I said -- obscure. It doesn't help that there's no free demo for it, and the only/main creator died ahwile back. But his creation lives on.
>>
>>54061033

Gimme the deets, nigga. I want to hear about how fast it is.
>>
>$200 compiler for PowerBASIC

It's like I'm back in the 1980s before free compilers were a thing.
>>
I know neither Objective-C nor Swift. Should I bother learning Obj-C, or just focus on Swift?
>>
>>54061083

By learning one you'll largely be learning the other.
>>
>>54061083

Considering Swift is the new hotness meant to replace the aging Obj-C, learn Swift.
>>
>>54060958

If you say so, bit writing an O(2^n) Fibonacci is unacceptable.
>>
File: browser.webm (1 MB, 840x668) Image search: [Google]
browser.webm
1 MB, 840x668
>>54060709
ok, that screen recorder program was shit and had no way to control the video quality. but here's the result after converting to webm.
this webm makes browser look like shit, but here it is anyway.
>>
http://www.cplusplus.com/reference/cstdlib/atoi/
For something like this would it be possible to pass parts of an array with pointers? (i.e. I want atio to convert the first and second half of an array into separate ints)
>>
>>54061138

Right? Everybody knows to use the closed form equation.
>>
>>54061042
It's can be as fast as C (if you don't write crappy code), and let's you use inline assembly.
>>
>>54058623
you already have your array of accounts declared. In your menu choices, rather than setting the values of acc0, set the value of the account at the index inputaccnum

list[inputaccnum].deposit(deposit);//etc
>>
>>54061186

Interdasting. Since you use it, any sample code?
>>
I'm reading the C# Players Guide and just got to the section on reference and value types. I understand the difference between the two but when I got to the 'Test Yourself" section I incorrectly thought that value types live on the stack and not the heap. In what situations are value types stored on the heap?
>>
>>54061083
swift

not that it matters since obj-c is easy anyway and you can pickup both
>>
>>54061207
What, like "Hello, world?"
>>
>>54060629
pls
>>
>>54061359

I mean real things that you've actually used it for.
>>
>>54061305
value types are stored on the stack. what was the example you got wrong?
>>
>>54061391
It would be a wall of text.

Just imagine a mixture C/C++/BASIC, along with winapi calls, but WITHOUT the annoying braces {
and the semi-colons;
}

To me, PowerBASIC is like taking C/C++ and making it easier to understand and nicer to look at. The ALL CAPS default for the language's keywords took some getting use to, but I don't mind it now.
>>
>>54061456
He was asking for a wall of text you twit.
>>
File: proyecto2.png (260 KB, 1921x1075) Image search: [Google]
proyecto2.png
260 KB, 1921x1075
I'm interested in c# gui's for sql

can you suggest me any books or tutorials about oledb or anything db related?
>>
>>54061430

That's what I thought. It was a series of true/false questions. This was the specific question:

The contents of a value type can be placed in the heap.

Answer:
True
>>
>>54061305
value types can be either in the stack or heap depending on how you do them

reference is always on the heap

a value type member of a class is on the heap for example
>>
I hate this fucking job search. I don't want any of these jobs but I have to beg for every single one.

I just want to make games even though I have no goddamn experience, but I'm not going to be able to do that if I'm working full hours on something else
>>
>>54061305
https://blogs.msdn.microsoft.com/ericlippert/2010/09/30/the-truth-about-value-types/
>>
>>54061391
OK, say you have a bunch of text (a string; a file; a webpage; whatever).
This pulls out some text based on its surroundings:
FUNCTION IsolateText (BYREF sourceText AS WSTRING, BYREF startText AS WSTRING, BYREF endText AS WSTRING, OPTIONAL BYREF initialPos AS LONG) AS WSTRING
LOCAL startPos, endPos AS LONG

startPos = IIF(ISMISSING(initialPos), 1, initialPos)
startPos = INSTR(startPos, sourceText, startText)
IF startPos = 0 THEN
IF ISFALSE(ISMISSING(initialPos)) THEN initialPos = 0 'return 0 if not found
EXIT FUNCTION
END IF
startPos += LEN(startText)
IF ISFALSE(ISMISSING(initialPos)) THEN initialPos = startPos
endPos = INSTR(startPos, sourceText, endText)
FUNCTION = MID$(sourceText, startPos TO endPos - 1)

END FUNCTION


It's called like this:
tempStr = IsolateText(hugeStr, "starting text", "ending text")
>>
>>54061565

As a person who works full time but also does filmmaking for a hobby (which is a very time consuming process) you have time to work on your game in your free time. It's about prioritizing what you do with your free time. This means less time gaming and posting on g and more time spent working.
Thread replies: 255
Thread images: 47

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

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