-  [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
  • Maximum file size allowed is 10000 KB.
  • Images greater than 200x200 pixels will be thumbnailed.
  • Currently 346 unique user posts. View catalog

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

Reminder: IPv6 enabled users have exclusive access to the /vip6/ board. You don't need access to /VIP/ to access /vip6/.

Channel7 is streaming Movies and TV daily, click here for the web player, or here for the .m3u.


Neckbearded Basement Dweller 13/05/07(Tue)09:57 No. 3673 [Reply]
3673

File 136791347562.jpg - (182.77KB , 900x784 , apod.jpg )

I realize this is only tangentially related to "programming", but i'm sure the /pr/ crowd will be the ones who can answer this question, so here goes...

I'd like to host a team-vs-team wargame on an extra box i have lying around. There will be 3-5 virtualized servers running in a virtuallized LAN on this one box. It's fairly straightforward to setup, so no issues there, but my worry is that (due to the type of people who will be logging in), i'm risking my internet connection being used for nefarious purposes. I don't want to put myself in a situation where I have the FBI knocking down my door because of something some other asshole did, however the VMs will need at least some internet access to be usable for the game.

So my question is, how can I go about firewalling them from the hostbox? Players will need to be able to SSH in, and also have access to the debian software repos (outgoing http requests). Can iptables accomplish this safely? What can I do to make sure these are the only two types of network traffic that can occur?


>>
Here To Help November Neckbearded Basement Dweller 13/05/08(Wed)20:16 No. 3694

I need more information to help you:
Are your friends local or remote? (aka are they with you at home or are they at there homes)


>>
Neckbearded Basement Dweller 13/06/09(Sun)15:15 No. 3879

iptables masquerading




Neckbearded Basement Dweller 13/05/22(Wed)14:40 No. 3782 [Reply]
3782

File 136922643248.gif - (824.95KB , 300x169 , 1339587336544.gif )

Hey guys,

I'm pretty new to website development, and I'm stuck on one thing.

I'm trying to get a countdown timer (which is universal, meaning anyone visitng my website will see the exact same time), which counts down every 3 days. Once the countdown timer ends, I want it to display a value from my mysql database table at random. So for example, I would have 10 values recorded on my mysql database:

1. person 1
2. person 2
3. person 3 etc

and at the end of the countdown timer it would pick one of those values at random, and display it for 5 minutes. Then I would like it to start the cycle over again.

How can I achieve this?


4 posts omitted. Click Reply to view.
>>
Neckbearded Basement Dweller 13/05/23(Thu)07:01 No. 3793

>>3786

Thanks


>>
ice!.RAPE.curg 13/05/25(Sat)09:18 No. 3813

>>3789
apache and sql


>>
Neckbearded Basement Dweller 13/06/07(Fri)06:38 No. 3874

>>3789
>It's old, therefore useless and no one should use it!
This makes no sense at all.




Neckbearded Basement Dweller 13/06/05(Wed)21:16 No. 3867 [Reply]
3867

File 137045979115.jpg - (293.94KB , 1440x900 , 1344577446918.jpg )

why is + i absolutely necessary in (myName.length + i) in the following coding? isnt that kind of redundant since you've already specified j = i?
var text = "Hello hello Jodi hello hello Jeff hello hello \
hello Jeff hello hello hello";
var myName = "Jeff";
var hits = [];
for(var i = 0; i < text.length; i++) {
if (text[i] == "J") {
for(var j = i; j < (myName.length + i); j++) {
hits.push(text[j]);
}
}
}
if (hits.length === 0) {
console.log("Sorry not found!");
}
Message too long. Click here to view the full text.


1 post omitted. Click Reply to view.
>>
Nattajerk 13/06/06(Thu)03:57 No. 3869

I'm looking at it but I cant quite figure out why or what this does. at first I thought it was looking for every occurance of myName, but that doesnt seem to be the case, it just looks like it finds every occurance of J and then pushes the next characters the length of myname.

its a bit confusing.

anyways, what happens here is the reason it takes myName.length + i is because its using that as an index of where to seek the string "text", if you had just done myName.length it would never be able to complete past the length of myName because the "i" variable would be passed the length.

essentially, it could be written the same way as

for (var j = 0; j < myName.length); j++) { hits.push(text[j+i]); }


indeed, that may even be a bit more concise, as it explains that its pushing the text at the index of j + i.

there is a major problem with this, though. if the string has less characters at the end of the string that exists in myName, your program will crash, as the index of the string will be out of bounds.

so, it might be safer to say

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


>>
Neckbearded Basement Dweller 13/06/06(Thu)09:08 No. 3870

>>3869
Ohh, so if the string's last bit was ...eliJh", it would crash.
makes sense.

"if you had just done myName.length it would never be able to complete past the length of myName because the "i" variable would be passed the length."

or if i just put in myName.length, it would try to take the first 4 letters of the string itself, since j is dependent upon i in this instance where j = i?

the following code spits out [J, o, d, i]

var text = "Jodi hello Jodi hello hello Jeff hello hello \
hello Jeff hello hello hello";
var myName = "Jeff";
var hits = [];
for(var i = 0; i < text.length; i++) {
Message too long. Click here to view the full text.


>>
Nattajerk 13/06/07(Fri)03:21 No. 3871

>>3870
what language is this anyway? pretty much any language has built in string comparisons and most modern languages have regex support that can help with things like this.




The CPU & GPU Workshop Neckbearded Basement Dweller 13/06/02(Sun)14:40 No. 3856 [Reply]
3856

File 137017683124.jpg - (464.98KB , 1566x1146 , 2012-09-24-182244.jpg )

Started to compile datasheets for various CPU, GPU, MCU, DSP. As of 20130409 here is what I collected :

magnet:?xt=urn:btih:C0219D319DFF5F21FE1FCFC1F9C92BE1B5451C72&dn=The%20CPU%20%26%20GPU%20Workshop%2020130409&tr=%2ahttp%3a%2f%2ftracker.thepiratebay.org%2fannounce&tr=udp%3a%2f%2ftracker.openbittorrent
.com%3a80%2fannounce&tr=udp%3a%2f%2ftracker.ccc.de%3a80%2fannounce&tr=udp%3a%2f%2ftracker.publicbt.com%3a80%2fannounce&tr=udp%3a%2f%2ftracker.istole.it%3a80%2fannounce&tr=http%3a%2f%2fexodus.desync.co
m%3a6969%2fannounce&tr=http%3a%2f%2fexodus.desync.com%2fannounce&tr=http%3a%2f%2ftracker.ex.ua%2fannounce&tr=udp%3a%2f%2ffr33domtracker.h33t.com%3a3310%2fannounce&tr=udp%3a%2f%2fipv4.tracker.harry.lu%
3a80%2fannounce&tr=udp%3a%2f%2f9.rarbg.com%3a2710%2fannounce&tr=udp%3a%2f%2f9.rarbg.me%3a2710%2fannounce&tr=http%3a%2f%2ffr33dom.h33t.com%3a3310%2fannounce&tr=http%3a%2f%2ftracker.pornoshara.tv%3a2711
%2fannounce

Current size is 6170259106 bytes, approx 6 GB with essentially X86 and ARM stuff.

Please contribute by respecting the established folder tree structure and add as much informations as possible.

Just create another torrent with the same directory tree and share the URI here, so that we can download on the same location for the folders to merge seamlessly.




Neckbearded Basement Dweller 13/05/30(Thu)11:46 No. 3840 [Reply]
3840

File 136990720753.jpg - (18.76KB , 343x377 , 1343636391869.jpg )

http://pastebin.com/BQpvq2tP

My php scripts results keep coming back as 'Array'
I know that it's something to do with the $shuffle value but i need to add multiple mysql_query("select blabla") to $shuffle without it showing up as 'resource id #n'. The moment i add a mysql_fetch_row, it shows up as 'Array'. Is there an alternative way around this?


>>
Neckbearded Basement Dweller 13/05/30(Thu)14:54 No. 3841

Yes, there is an alternative: don't use this jew-created vulnerability-ridden insecure nuisance of a language. The kikes have created PHP in order to enslave the goys who don't have the brains not to use it.

(USER WAS BANNED FOR THIS POST)


>>
Neckbearded Basement Dweller 13/05/31(Fri)09:52 No. 3847

>>3841

..wow


>>
Neckbearded Basement Dweller 13/06/02(Sun)13:57 No. 3855

>>3841

Hi nikita!

Actually he is right, don't use fucking php. It is broken:

The bugs, won't fix list:

https://bugs.php.net/search.php?cmd=display&search_for=&project=&php_os=&php_os_not=&author_email=&bug_type=Bug&boolean=0&bug_age=0&bug_updated=0&order_by=php_version&direction=DESC&limit=30&phpver=&c
ve_id=&cve_id_not=&patch=&pull=&assign=&status=Wont+fix&begin=150

The bugs, not a bug list:
https://bugs.php.net/search.php?cmd=display&search_for=&project=&php_os=&php_os_not=&author_email=&bug_type=Bug&boolean=0&bug_age=0&bug_updated=0&order_by=php_version&direction=DESC&limit=30&phpver=5&
cve_id=&cve_id_not=&patch=&pull=&assign=&status=Not+a+bug&begin=90

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




newbie question Neckbearded Basement Dweller 13/05/12(Sun)06:24 No. 3739 [Reply]
3739

File 136833267041.jpg - (133.28KB , 1024x682 , 1360637291905.jpg )

im trying to assign a variable in perl based on two scenarios, one, either the program hasnt been passed any arguments and thus a default value is set, two, it is assigned the value of the argument passed to it.

the best thing i could come up with was to assign the variable the result of an eval block containing the if statement to try and avoid scope issues, but obviously there remains the issue of giving the eval block the arguments.

any ideas on how to go about doing this?


14 posts omitted. Click Reply to view.
>>
Nattajerk 13/05/30(Thu)22:43 No. 3843

>>3842

which arguments, argv?

I think shift automatically takes arguments from argv, but only if its outside of a subroutine.

if perl recognizes main as I think you want it to, I'm not sure, but you could remove the main sub entirely and enter:

$variable = shift || "or use this default value";


this is probably what you're looking for. this will take the first variable off of the default stack (or argv depending on where you use it) and input it into the variable, however if the stack has nothing in it, it will use the default value to the right.

another option is to kill the program:

$variable = shift or die "No argument detected\n";

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


>>
Neckbearded Basement Dweller 13/05/31(Fri)01:55 No. 3844

>>3843
i need to pull my shit together...


>>
Nattajerk 13/05/31(Fri)03:19 No. 3846

all in all, there's many ways to go about this. lets say you wanted to parse it,

foreach(@ARGV) { switch ($_) { case "-V": die "Version 1.0"; break; case "-f": $file = shift(@ARGV) or die "No file specified."; #you should also check if the next argument is a valid filename. break; default: die "Unknown argument: $_"; } }




Neckbearded Basement Dweller 13/05/27(Mon)14:09 No. 3824 [Reply]
3824

File 13696565957.jpg - (635.99KB , 1680x1050 , 1354488727728.jpg )

How does one go about the creation of an AI


3 posts and 1 image omitted. Click Reply to view.
>>
Neckbearded Basement Dweller 13/05/29(Wed)13:44 No. 3837
3837

File 136982787544.png - (331.33KB , 813x936 , math.png )

>>3832
I mean when you are academic, it is like your papers are write only: you write your papers and there are very few people that read them - impact is very little; I felt like a vegetarian butcher, teaching software engineering, I've no clue what I was teaching about, because I never wrote a practical program, I never experienced how people really build software, so it really was theory and I din't felt I was really teaching my students anything useful, that is how I came to work on Haskell. -- Erik Meijer, a major contributor to the functional programming language Haskell (http://www.youtube.com/watch?v=z0N1aZ6SnBk)


>>
Neckbearded Basement Dweller 13/05/29(Wed)14:45 No. 3838

>>3837
In other words, computer science is like writing in Perl.


>>
Neckbearded Basement Dweller 13/05/29(Wed)20:09 No. 3839

>>3838
Nope. Perl gets read by CPU and does practical job, like filtering a log file, while Haskell, Coq and Agda code never read at all, frequently having less payload than a "public class Main: Program {final public void main() {} }" construct.




Looking for fellow noobs Neckbearded Basement Dweller 13/05/08(Wed)22:12 No. 3696 [Reply]
3696

File 136804395429.png - (427.33KB , 499x344 , 0332123.png )

SHalom fellow basement dwelling neckbeards!!! I have recently been looking to learn programming and a mwondering if there is anyone out there that would be seriously interested in starting a programming/hacking group for begginers, we could potentialy use somthing like FB and fake accounts to communicate (inb4 cancer) and share any knowlage we gained. i would like to know if anybody still on /pr/ or just passing by would like to join me, if so just drop a reply and we can figure out the details


22 posts and 3 images omitted. Click Reply to view.
>>
Nattajerk 13/05/26(Sun)05:58 No. 3817

>>3815
the culture could be super cool, but as far as I know there are no underground nightclubs for hackers out there with an alpha build of Wipeout on hand. and if there are, I havent been to any of them. :C


>>
patchouli!!SyAQpmZGyw 13/05/27(Mon)17:17 No. 3827

>>3817
I think they must be hidden in Angelina Jolies' dead career.


>>
Neckbearded Basement Dweller 13/05/27(Mon)18:43 No. 3828

>>3696

Gimme an irc channel and I'll join ya




patchouli!!SyAQpmZGyw 13/05/13(Mon)01:57 No. 3744 [Reply]
3744

File 13684030594.png - (589B , 350x240 , Balrog!.png )

May I make a suggestion?

I think it would be useful for us to have a sticky for newbie programmers, or people who are willing to learn. Not trying to be mean, but there are way too many of these threads popping up, and they always end up similarly.


8 posts omitted. Click Reply to view.
>>
Neckbearded Basement Dweller 13/05/24(Fri)04:37 No. 3799

>>3744
i agree with this.

im tired of 'jei guise, lerning C, jau do i convert
intrager to flota pleaz'-posts

or the 'whats best language EVERR?'-ones.


>>
Nattajerk 13/05/25(Sat)02:13 No. 3809

>>3798
thats a good start, and can always append links for other languages later.

I wonder if bolding works on this board. i sure hope so, or this post will look silly


>>
Nattajerk 13/05/25(Sat)02:16 No. 3810

http://pastebin.com/qnpkuFfp

bolding does work, so be sure to bold the titles.




Noob Decision Neckbearded Basement Dweller 13/05/08(Wed)16:35 No. 3689 [Reply]
3689

File 136802375678.jpg - (27.85KB , 800x600 , Blue hills.jpg )

Hello /pr/.
I am trying to learn a programming language but I can't seem to decide which I should go with. I want to learn one that is the most "adaptable" I guess. I plan on learning more later but I want the first one to be basically like a swiss army knife, in that I want to be able to use it for anything I want to do. One that i can go... "Oh I want to write my own OS? ok I can do that." "I wander if my gf is cheating on me... well I guess ill just write a keylogger and slip it through her computer's defenses to plant it and see if she is messaging anyone." "Make my own game? No problem..." "Want to try and see if I can break into a site just to see if I can? I can write a program for that.."


15 posts omitted. Click Reply to view.
>>
Neckbearded Basement Dweller 13/05/24(Fri)23:01 No. 3806

I wrote this >>3802

>>3803
>Also Coq and Agda for theorem-proving, and remove Mercury which is more of a marginal language.
>+ remove Perl for being an old read-only piece of crap. Seriously, Python and Ruby make it completely obsolete.
>+ elaborate on Lishp being a family of languages and replace it with Clojure as it's more "functional" than most Lishps and the most actively used nowadays.
>+ mention an ML or at least F#.
I agree 100%.

I'll post an edited version later.


>>
Neckbearded Basement Dweller 13/05/25(Sat)00:08 No. 3807

Seriously, the language you learn first really doesn't matter. As long as you understand the underlying concepts you can switch to any other programming language in a few days. What matters more than the selection of the programming language you pick is whether you have good learning material, a tutor or a good place where you can ask questions and discuss the new concepts or not. In programming languages there are different paradigms/styles. Once you mastered one paradigm, you can immediately switch to another language with the same paradigms. For example once you got how Object Oriented Programming (OOP) works the concepts and features are very similar in C++, C# or Java. Once you got how the more low-level imperative/procedual style, like in (pure) C, works and how you get shit done with that, you can easily pickup Ada.

Here's a little list with worthwhile languages per paradigm (WARNING : OPINIONS AHEAD):

OOP: Smalltalk (for how OOP ought to be), C# or C++ (warning: C++ is a huge mess) for more "real world"ish stuff.

Procedual:
- C (recommended), there are a LOT of libraries for C, so you can do pretty much anything, though some stuff will be significantly harder to do (correctly) under C as in more "high-level" languages. Also the ecosystem around it is HUGE. It can run (after sufficient setup which sometimes is by no means trivial) and pretty much ANY hardware. The overall language is in comparison rather crufty.
- Ada, it's like a way more pedantic C with horrible syntax, fine support for juggling numbers and a quite strong type system.

Functional:
- ML is the father of multiple modern programming languages features a strong powerful type system with automatic type inference, which means the machine is able to fill in the types for you.
Arguably the most widely use ML dialect used is OCaml, which incorporates OOP features as well.
A more recent decedent of ML is F#, which is very much like OCaml, but for .Net.

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


>>
Neckbearded Basement Dweller 13/05/25(Sat)00:10 No. 3808

>>3807
so many typos, fuck i need sleep




Delete post []
Password  
Report post
Reason