Jump to content

Markup

Members
  • Posts

    612
  • Joined

  • Last visited

Everything posted by Markup

  1. C/C++ is necessary for understanding key concepts and logical programming. I'd expect any competent programmer to have knowledge of most languages. My favourite languages are Python, C/C++, JavaScript. I do not like Java at all, although it is still quite good. Functional languages such as Haskell are interesting... Database Management and Networking are mainly tool based. You'd need to know a shell language such as bash. For databases you'll need to know SQL and a language to perform SQL statements. Database management SQL would probably be better suited to a scripting language such as python. Apps are unfortunately popular now. Java(android), xcode/C++/objective c?(apple), HTML+CSS+JavaScript. It's hard to suggest a language because IMO you should learn a language that enables you to complete interesting goals quickly otherwise you get frustrated and bored quickly. My first language was Small/Pawn for AMXX where I scripted server plugins for a game called counterstrike. When I had finished a plugin I had something I could share with others and play with which was great as fun. Nowadays I do impulse projects - example, my friend was using a JavaScript IRC client yesterday, I decided I'd write a grease monkey script to hook the qwebirc client and create an IRC bot. The interesting part being the hooking process(JavaScript is fun). It doesn't stop there though. Once I discovered I liked JavaScript I decided I'd compile googles v8 JavaScript engine which is written in C++. So now I'm using JavaScript in C++( have done this for CPython too). Imo, http://www.cplusplus.com/doc/tutorial/, follow this tutorial up until object oriented programming. Data types, operators, control structures and functions are core to most languages. Then have a play around and look at other languages.
  2. The manufacturing process of CPUs doesn't have a 100% yield. If they produce a quad core CPU and 1 core is defective then they sell it as a tri core. They also disable cores to meet market demand. http://www.cpu-world.com/info/AMD/Unlocking_cores_and_L3.html http://www.zdnet.com/blog/btl/why-amds-triple-core-phenom-is-a-bigger-deal-than-you-think/6334 http://www.legitreviews.com/amd-triple-core-marketing-hype-or-mainstream-killer_240
  3. Connection was definitely fast enough, I probably didn't know how to work it properly. What do you think of the Nexus 7, what do you use it for?
  4. Looking to buy a tablet £300 max. Currently I'd pick Nexus 7 > Samsung Galaxy Tab 3 I've ruled out Apple because of the developer limitations. One of my main media requirements is streaming over http, VLC for Android should be fine for this but when I tested it out in the shop on a Nexus 7 it'd only play sound (mkv) and I didn't have enough time to try other files. Thoughts on 7" / 10", screen size for media compared to portability/ergonomics. The iPad mini is the perfect [email protected]". Having played with the Nexus 7 it felt just a little bit too small @ 7". Galaxy Tab 3 is 8", but the Nexus 7 is much faster(is speed even an issue?).
  5. Going back to this. It doesn't work on firefox because firefox overflows to the right not downwards. Changing height for width and top for left makes it work, although it's not aligned properly. Edit: http://jsfiddle.net/ERnxH/12/ $(document).ready( function(){ page = 1; } ); $("#next").click( function(){ var width = $("#book").outerWidth() $("#container").css("left",(-width * page) + "px"); page += 1; } ); $("#back").click( function(){ page -= 1; var width = $("#book").outerWidth() $("#container").css("left",(-width * (page-1)) + "px"); console.log($("#container").css("left")); } ); This works on firefox, and accounts for padding/border which is the hardcoded 16.
  6. Something else too, if it ends between a tag then it replaces the last few chars with an end tag?: >>> element.innerHTML.length 1493 >>> element.innerHTML.substring(1480, 1493); "nbsp;<i>I</i>" >>> str.substring(1480, 1493); "nbsp;<i>I mus"
  7. So the real fix honest is: var fixstr = document.createElement("div"); fixstr.innerHTML = story; story = fixstr.innerHTML;
  8. And another one I've found: Edit: this one was caused because it doesn't have an opening <i> highlighted by the red </i> element.innerHTML.substring(1199, 1210);"y. <br> &nb"str.substring(1199, 1210);"y.</i> <br>"str.substring(1199, 1220);"y.</i> <br> &nb"
  9. Okay so replace only replaces the first occurence. The fix is: story = story.replace(/\r/g,"");
  10. There are definitely carriage returns, at least on firefox. You've readded the insertBefore error aswell
  11. Edit: solution to original problem Well your problem is that when you set innerHTML it strips \r\n to \n. To fix just use .replace("\r",""); on the book data after you've retrieved it. function openStory(path){ xmlhttp = new XMLHttpRequest(); xmlhttp.open("GET",path,false); xmlhttp.send(null); var lines = xmlhttp.responseText.split("[[zxjz]]"); story=lines[1]; story = story.replace("\r",""); }
  12. Did you test this on firefox? Isn't working for me You need to change insertBefore to [email protected] 690 TypeError: Not enough arguments to Node.insertBefore. div.insertBefore(leftPage); Firefox again You really need to update your browser. 23.0.1
  13. I rarely use linux for desktop use and know hardly anything about distributions, but for a beginner I think it has to be Ubuntu. I personally use Arch which I have on my raspberrypi and on a virtual machine.
  14. Did you test this on firefox? Isn't working for me You need to change insertBefore to [email protected] 690 TypeError: Not enough arguments to Node.insertBefore. div.insertBefore(leftPage); Firefox again
  15. The dropbox link is giving a 403 forbidden, so the example doesn't work.
  16. What's going on with the if brackets in nextPage ? Edit: got it
  17. I guess this continues from above. This is a single threaded tick based multiplexed/non-blocking io server. Messages go through a chain of protocols, each protocol functions independently but can be chained together. python dictionary -> JSON encoded -> AES encryption -> internet -> AES decryption -> JSON decoded -> python dictionary
  18. What's the actual "name" of your computer? > Alienware > OptiPlex > Studio Hybrid > Dimension > Precision Workstation > Studio XPS > Inspiron > XPS > Vostro > Legacy Systems > Studio and the model number afterwards
  19. Boot up in safe mode and run the scan. Privileges wise you just need to right click run as administrator (assuming>vista). Run HijackThis and paste logs here/other technical support forums.
  20. The toArrayFromFile uses a method named AJAX https://developer.mo..._XMLHttpRequest Web requests are subject to cross-site restrictions. Cross-site restrictions can be disabled but only the server system operator can change that. Find a host that allows this. Cross-site restrictions can be bypassed by using a server side proxy script which resides on the same site. I don't think tumblr allows users to upload php files so this isn't possible. Use http://imgur.com/ instead of imageshack Dropbox is suppose to be for private sharing. If you reach a certain limit it'll be disabled. I can set you up with an unrestricted cross-site access on my server and ftp upload if you want. Simple example using CORS: "http://example.com/xsite.php" <?php header("Access-Control-Allow-Origin: *"); print "test" ?> "http://content.host/index.html" <!DOCTYPE html> <html> <head> <script> function doreq() { var xhr = new XMLHttpRequest(); xhr.open("GET", "http://example.com/xsite.php", true); xhr.onreadystatechange = function(){ if(xhr.readyState == 4 && xhr.status == 200) document.getElementById('lol').innerHTML = xhr.responseText; }; xhr.send(null); } </script> </head> <body> <div id="lol"> a </div> <button onclick="doreq();">press</button> </body> </html> https://developer.mo...r_compatibility Firefox&Chrome&IE10 support CORS. IE 8/9 support it via XDomainRequest not XMLHttpRequest. Best to use jQuery because it'll do automatic detection and select the right method. (may need $.support.cors = true) Via .htaccess Header set Access-Control-Allow-Origin "*"
  21. Not that I know much about hardware. You may still be able to sell your current card for a decent price, allowing you to purchase a single new one. If you're going to SLI, then you're practically doubling the wattage drawn from the PSU into graphics alone. If this is greater than the output of your PSU, then you'll need to consider the cost of upgrading the PSU as well. Of course a single new card may have the same problem, so you'll need to check on that. Performance gain through 2xSLI isn't double. A handy comparison using 570's here: http://www.tomshardw...ng,2865-10.html iirc this is due to PCI-E bandwidth limitations which is usually specified on the motherboard specs. Yours specifically http://www.asus.com/...#specifications The PCIEX16_2 slot shares bandwidth with the PCIEX1_1 slot, PCIEX1_2 slot and USB3_34 connector. The PCIEX16_2 runs at x1 mode by default for system resource optimization. Max x4 Edit: bandwidth will actually be fine for this motherboard There used to be problems using SLI such as micro stuttering, although I have no idea what the state of this is now. If your old card fails, you're back to where you started. Edit: Temperature issues could also occur
  22. A progression to my previous post, although no code to show at the moment. I've implemented an RSA encrypted exchange of AES256 keys which are used to encrypt communication. That is: generate/load RSA keys for both clients A and B A and B exchange public keys generate AES keys and IV's for both clients A and B A and B exchange AES keys and IV's via RSA encryption A and B can then exchange AES encrypted data Specifically, I've implemented communication over sockets, but it uses file style io. Need to recode the RSA part, and then work out how to properly interface it. Here you can see 2 threads fighting to debug into stdout. Edit: forgot to mention the strange sense of satisfaction waiting a minute for the program to generate 2 RSA keys.
  23. Perhaps a thread where we post snippets of code that others may find useful / interesting? I was interested in making a command line tool to pipe data through to AES encrypt/decrypt. Originally wanted to implement it in Haskell but I'm still unable to comprehend that language. Ended up writing it in python. Wanted to use it on windows but python says no at the moment. Using PyCrypto: https://www.dlitz.ne...tware/pycrypto/ aes256.py import sys import struct from Crypto import Random from Crypto.Hash import SHA256 from Crypto.Cipher import AES random_generator_file = Random.new() # format # -----header------ # iv <- 16bytes # chunksize <- <Q # ----------------- # ------chunk------ # size <- <Q # data <- chunksize # ----------------- def encrypt(key, infile, outfile, chunksize=1024): iv = random_generator_file.read(16) encryptor = AES.new(key, AES.MODE_CBC, iv) outfile.write(iv) outfile.write(struct.pack('<Q', chunksize)) while True: chunk = infile.read(chunksize) outfile.write(struct.pack('<Q', len(chunk))) if len(chunk) == 0: break elif len(chunk) % chunksize != 0: chunk += 'M' * (chunksize - len(chunk) % chunksize) outfile.write(encryptor.encrypt(chunk)) def decrypt(key, infile, outfile): iv = infile.read(16) decryptor = AES.new(key, AES.MODE_CBC, iv) chunksize = struct.unpack('<Q', infile.read(struct.calcsize('Q')))[0] while True: size = struct.unpack('<Q', infile.read(struct.calcsize('Q')))[0] if size == 0: break chunk = infile.read(chunksize) outfile.write(decryptor.decrypt(chunk)[:size]) mode = sys.argv[2] hashkey = SHA256.new() hashkey.update(sys.argv[1]) key = hashkey.digest() if mode == "encrypt": encrypt(key, sys.stdin, sys.stdout) elif mode == "decrypt": decrypt(key, sys.stdin, sys.stdout) Edit: don't you think text url shorten'ers are really annoying, eg when you're browsing raw text caches and you can't follow the link because it's been shortened with '...'
  24. Same script for each show, different arguments for each cronjob. We're using the && operator (command?) to process 2 commands. script1.sh && script2.sh If script1.sh exits with success, then it'll process script2.sh. If script1.sh exits with an error, then script2.sh will not be processed. * * * * * /home/test/scripts/fortcronjob.sh ID MODULUS >> /home/test/scripts/fortcronjob.log 2>&1 && COMMAND HERE Your current cron command replaces COMMAND HERE at the ende Maybe: Monday @ 8pm, every 4 weeks from the first monday you implement the counter. 0 20 * * MON * /home/test/scripts/fortcronjob.sh "soulshow_monday_every_4_weeks" 4 >> /home/test/scripts/fortcronjob.log 2>&1 && /home/test/lagain.sh "Ivor's Show" soulshow "ivor_soulshow.mp3" 70
  25. Perhaps, test.cron * * * * * /home/test/scripts/fortcronjob.sh 10 2 >> /home/test/scripts/fortcronjob.log 2>&1 && date >> /home/test/scripts/test.cron.log 2>&1 fortcronjob.sh dir_data="/home/test/.fortcronjob/" if [ $# != 2 ] then echo "Usage: unique_id week_modulus" exit 1 fi instance_id=$1 instance_mod=$2 counter=0 exit_value=1 file_data="$dir_data$1" if [ ! -e "$file_data" ] then echo "id:$instance_id - no data, starting from 0" else source "$file_data" fi counter=$(( $counter % $instance_mod )) if [ $counter == 0 ] then echo "id:$instance_id - true" exit_value=0 else echo "id:$instance_id - t-$(( $instance_mod - $counter ))" fi counter=$(( $counter + 1 )) echo "counter=$counter" > "$file_data" exit $exit_value mkdir ~/.fortcronjob/ edit fortcronjob.sh to refer to ~/.fortcronjob/ as an absolute path( non relative ) chmod fortcronjob.sh (I think it just needs +x for others) Give each cronjob task a seperate id and required modulus value Make sure you leave in the stdout/stderr redirection for the fortcronjob.sh script otherwise it'll spam your mail * * * * * /home/test/scripts/fortcronjob.sh ID MODULUS >> /home/test/scripts/fortcronjob.log 2>&1 && COMMAND HERE brb dinner Edit: I used a number for ID, but it can be any valid file name. You'll need to implement each counter on the week it should start, else you'll need to go around editing the counter files. Every 4weeks Monday = MODULUS 4, with the counter @ 0 on that week. Every 2weeks Wednesday = MODULUS 2, with the counter @ 0 on one of the weeks.
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.