-  [WT]  [PS]  [Home] [Manage]

  1.   (new thread)
  2. [ No File]
  3. (for post and file deletion)
/pr/ - Programming
  • Supported file types are: C, CSS, DOC, DOCX, GIF, H, JAVA, JPG, PDF, PNG, SVG, SWF, TXT, WEBM
  • Maximum file size allowed is 10000 KB.
  • Images greater than 200x200 pixels will be thumbnailed.
  • Currently 484 unique user posts. View catalog

  • Blotter updated: 2011-01-12 Show/Hide Show All

There's a new /777/ up, it's /Trump/ - Make America Great Again! Check it out. Suggest new /777/s here.

Movies & TV 24/7 via Channel7: Web Player, .m3u file. Music via Radio7: Web Player, .m3u file.

WebM is now available sitewide! Please check this thread for more info.

Neckbearded Basement Dweller 15/05/27(Wed)17:08 No. 4737 [Reply]
4737

File 143273931665.png - (12.44KB , 1025x176 , 145.png )

I'm trying to figure out this problem. Here's my code in python:

def reversible(limit):
num_list = ()
for num in range(1,limit):
num = str(num)
if num[-1] == 0:
break
else:
sum = int(num) + int(num[::-1])
checker = 0
for i in str(sum):

if int(i) % 2 == 0:
break
Message too long. Click here to view the full text.


1 post omitted. Click Reply to view.
>>
Neckbearded Basement Dweller 15/05/28(Thu)17:38 No. 4739

Say you have a number 13739, is there an algorithm to break that down to its two components x and reverse(x)?


>>
Neckbearded Basement Dweller 15/06/15(Mon)21:45 No. 4761

>>4739
Most of the cause of the slow speed is because python loops are slow. You can look up numba, which is a jit compiler that can speed up numerical computations like this very well.

If you really want to reverse a number without converting to string, you could do mod 10, subtract result and divide 10. Numba should speed that up nicely since it's a numerical loop.


>>
Neckbearded Basement Dweller 15/07/13(Mon)20:52 No. 4768

my solution (quick n dirty)

n=0for i in xrange(10,1000000000): if i%10==0: pass else: c=False j=int(str(i)[::-1]) for k in str(i+j): if int(k)%2==0: c=True if c==False: n+=1print n


Solution still unknown coz the program is still running (on an ARM v6 lol), I expect it to finish by tomorrow morning.




Revealing your power level Neckbearded Basement Dweller 15/07/07(Tue)20:11 No. 4766 [Reply]
4766

File 14362927069.jpg - (38.29KB , 372x399 , To_the_idiots_with_love_45bdf1_4806225.jpg )

Today at work, in a code comment explaining the motivation for a design decision, I took a short jab at people calling themselves "webdevs" but who can't get right what I was doing. Fortunatelly, as I usually read and rethink what I write, I realized that was being a smug asshole so I removed that part of the comment and committed.

Tell me, /pr/, what's the worst thing you've written or seen someone else write in code comments?




Neckbearded Basement Dweller 14/07/03(Thu)05:32 No. 4501 [Reply]
4501

File 140435837030.png - (141.51KB , 1178x583 , SDFDSFSDFSDF.png )

This author is really starting to piss me off. I paid 15 dollars for this shit, and I think I have picked out two huge errors he has made. Book is Java 7 for Absolute Beginners, by Jay Bryant.

First example:
On page 79, he says that

int a = 0;
int b = 1;
String s = "s";
String sToo = "s";
System.out.println(a == b);
System.out.println(s == sToo);

will generate the results "true" and "false" respectively. Eclipse begs to differ. Here's what it says:

false
Message too long. Click here to view the full text.


9 posts and 3 images omitted. Click Reply to view.
>>
Nattajerk 15/03/04(Wed)22:29 No. 4702

i tend to get book reviews long before i buy a book these days, after being stung by C++ Primer Plus and Learning PHP & MySQL before, not even the animal books are safe from bad authors.

doing your homework requires doing your homework to do your homework, it's ridiculous.


>>
4503 inter 15/04/22(Wed)23:04 No. 4727



>>
Neckbearded Basement Dweller 15/06/15(Mon)10:09 No. 4760

>>4501
if two constant strings are of the same value they will likely be interned and share the same ref so:
String s1 "123";
String s2 "123";
s2==s1 will be true as the are really the same ref.
but if one or the other is modified, the ref will change
for reliablity use the equals method on objects and == on primitives
which also means on your own classes you may need to override the equals method




Neckbearded Basement Dweller 15/05/25(Mon)05:22 No. 4735 [Reply]
4735

File 143252415564.png - (6.85KB , 213x213 , Icpc_logo.png )

ACM programming competitions are done - Russia kicking ass.
Thoughts?




Subscription Manager Neckbearded Basement Dweller 15/05/30(Sat)07:18 No. 4743 [Reply]
4743

File 143296310212.png - (51.87KB , 2200x1000 , woocommerce-logo.png )

Hey guys , I had a offer to build a subscription service with premium content . I want wordpress to manage payments and subscriptions . To build the custom content i'm using codeigniter .I'm using woocommerce + subscription , Is this the best approach ?




Wanting to learn to program johon wkes 15/01/14(Wed)03:11 No. 4669 [Reply]
4669

File 142120146693.jpg - (5.15KB , 192x249 , imagesVGHIFR3K.jpg )

Wanting to learn a program language two questions;
1. What is an easy beginner language to learn.
2. What language after the beginner language to follow up with.


7 posts and 1 image omitted. Click Reply to view.
>>
Neckbearded Basement Dweller 15/02/22(Sun)01:08 No. 4696
4696

File 142456369551.gif - (1.98MB , 350x251 , 1423686769031.gif )

Just learn Python 3. Its highly documented, easy to use, easy to program and will give you a good idea on what you're doing

alternatively, if you dont really like python, try Ruby. its a different approach to the same thing.


after that it depends on what you want to do. If you want "practical for moneys", learn Java, or C#, or C++

if you want to do OS dev, or microcontrollers, do C

if you want to do webdev, do JS, PHP, HTML/CSS, SQL and see what frameworks interest you(Ruby on rails, node, angular, etc)

if you want to be a special snowflake, use Lisp with SBCL, Hasklel, or ASM

just dont start with C or Assembly, really. a bunch of retards who didnt start with it will say you'll learn how the computer really works! which is largely untrue. Autistically managing resources is a waste of time for most development. using malloc isn't a hardcore skill.

Message too long. Click here to view the full text.


>>
Neckbearded Basement Dweller 15/05/29(Fri)05:19 No. 4740

1. Python is a very easy language to learn, especially if you understand the fundamentals of programming.
2. I would say C, or maybe Java, since Java has a higher level of abstraction.


>>
idoit4thelulz 15/06/02(Tue)03:59 No. 4744

I'll be different and say start with Racket. Don't even think about a second language yet though. Where you go next is a bridge to cross when the time comes.

BTW, I started with BASIC in the 80's, immediately followed by Z-80 assembly language. Now I code in C and Perl mostly. But anyway, asm back then wasn't so difficult because the machines were much simpler (check out MOS 6502, for example). Actually BASIC->ASM path would still work fine today if someone happens to have a simple 80's machine. Modern hardware and OS are too big of hurdles for that sort of thing.




Any help is appreciated! Neckbearded Basement Dweller 15/06/05(Fri)10:56 No. 4745 [Reply]
4745

File 143349458999.jpg - (40.12KB , 500x428 , 1433312565948.jpg )

Hello 7chan, I don't come here ever but I need help from someone familiar with python. I know nothing of programming and I need to modify a game in a variety of ways. Most of the modifications I'm able to figure out on my own, they're as simple as changing a few variables. However I've hit a dead end, and I need to make one more change.

The game is called space fortress and was a DARPA project to test various aspects of learning, reaction time, and gaming. It's a very simple 2D shooting game, nothing complicated. Here's a link for anyone who's interested in it:

https://www.dropbox.com/sh/p6wvyw7jd7vyjlr/AAAuKD6Vlfvsp4Ned0qUls0Va?dl=0

What I need to do is create a wind effect that constantly blows the ship downwards by 0.4 pixels per game tick. That will require adding lines of code that I have no idea where to begin at. If you can't do it yourself I'd appreciate it if you told me how extensive of a modification this would be. I assume it's a simple command to have the ship always move in one direction, -0.4 on the y axis to be exact, but again I'm not a programmer. So any help would be appreciated.


2 posts omitted. Click Reply to view.
>>
Neckbearded Basement Dweller 15/06/06(Sat)11:29 No. 4749

Yes that makes sense. Would adding 'self.position.y -= 0.4'to the compute method under ship.py do that? That's a suggestion I got from a different board.


>>
Neckbearded Basement Dweller 15/06/07(Sun)05:38 No. 4750
4750

File 143364830511.png - (227.25KB , 1920x1080 , Untitled.png )

I was told this would work. But my lack of programming knowledge makes it difficult for me to troubleshoot what I'm doing wrong. I'm not a programming student.


>>
Neckbearded Basement Dweller 15/06/08(Mon)00:58 No. 4751

So I added 'self.position.y += 0.4'in ship.py under computer and it works!

Thanks for taking the time to read this thread.




How bad is it? rayman 14/12/02(Tue)01:39 No. 4625 [Reply]
4625

File iwlmem.c - (1.27KB )

How bad is this piece of code?


7 posts omitted. Click Reply to view.
>>
legit 14/12/20(Sat)23:34 No. 4648
4648

File iwlmem2.c - (1.19KB )

>>4625

I'm attaching an improved version of your code, if you want more info let me know, I had typed then inside the form, but when I submitted, the site said that the file name already existed and I'm not gonna write it all again if it's not worth it.

BTW, here is your source


>>
Neckbearded Basement Dweller 15/05/22(Fri)20:20 No. 4733

>>4648
>args[0]+2
Isn't that just args[2]?


>>
Nattajerk 15/05/25(Mon)14:47 No. 4736

>>4733
no, that is 2 plus the value of args[0].

args+2 would give you the equivalent of args[0+2].




Closures & Callbacks(javascript) Boy Next Door 15/05/04(Mon)13:27 No. 4730 [Reply]

Can someone please explain these two concepts to me? I've been going through different books & youtube videos and I think I got the gist of them, but I'd like an explanation from others. I'm more confused how these concepts tie in with asynchronous vs. synchronous.


>>
Nattajerk 15/05/19(Tue)23:33 No. 4732

A closure can be thought of as a function within a function, which has access to variables in its scope. That's basically all it is, there are some technical things about it but you need not concern yourself with them just yet.

A callback is passing a function to another function as a variable. Wikipedia probably describes it best,

http://pastebin.com/6rXWAQEd

in this, someAction requests a function as a parameter. what this means is you can insert your own compatible function and it will be executed within the someAction function, rather than evaluated it if it were just asking for a standard variable.




show urself and find a bug Neckbearded Basement Dweller 15/04/24(Fri)10:24 No. 4728 [Reply]
4728

File 142986389971.jpg - (438.23KB , 2000x1000 , bug.jpg )

Find da bug!

http://pastebin.com/dKm2G2XV


>>
find bugs in popular open-source projects Neckbearded Basement Dweller 15/04/25(Sat)11:53 No. 4729

Authors of PVS-Studio static code analyzers offer programmers to test their sight and to try finding errors in C/C++ code fragments. https://software.intel.com/en-us/blogs/2015/04/24/lets-play-a-game-find-bugs-in-popular-open-source-projects




Delete post []
Password  
Report post
Reason