- Strength to Increase Rep
- +8
- Strength to Decrease Rep
- -2
- Upvotes Received
- 59
- Posts with Upvotes
- 50
- Upvoting Members
- 27
- Downvotes Received
- 3
- Posts with Downvotes
- 3
- Downvoting Members
- 3
All-around coder/developer for desktop/web/etc. Windows & Linux admin. Super-User.
- Interests
- Coding, VB.Net, Python, C, Windows, Linux, Mint, Ubuntu, Embedded Code, Arduino, Raspberry Pi, Art,…
- PC Specs
- Windows 8/Kubuntu 14.04 (HP Laptop), Windows 7/Ubuntu 13.04 with KDE (HP Desktop), Linux Mint 12 with…
132 Posted Topics
![]() | Re: You have an event loop up at the top (`while done==False:`) that runs until the user has quit. Because of the indention, your event loop runs until completion and only *then* draws what you wanted it to. Your indention signifies a 'code block'.Everything in that code block will run until … |
Re: when you write a view function, it must have a `request` parameter (try writing one without it). This is because Django automatically passes the `HttpRequest()` to your view so you can use it. You don't have to use it, I have plenty of views that do absolutely nothing with the … | |
Re: @sa_2, on line 282 you mixed single quotes with double quotes. The syntax highlighting shows it right here: cout<<' \t\t¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥\n\n\n"; Next time start a new question, so more people can help you. | |
Re: It's been a while since I messed with VB, but I can't find anything that sticks out as far as the overflow situation. It's hard to read anything the way you're building those queries. I'm pretty sure that they're prone to SQL injection anyway. Have you looked at [prepared statements](https://msdn.microsoft.com/en-us/library/system.data.sqlclient.sqlcommand.prepare(v=vs.110).aspx)? … | |
Re: I would refer to the API documentation for `DataResult<fmd>`. I'm sure there are methods to help you retrieve the images it captures. I'm not sure which SDK you are using, and the DigitalPersona documentation (which I think you may be using) requires that you purchase support. DigitalPersona does have a … | |
Re: I think it would help if you weren't shadowing the `cosa` name in your `for` loop. Classes should use CamelCase, to distinguish them from function names and other stuff. Instantiating a class is like calling a function, so if you are instantiating a `Cosa`, and not trying to call a … | |
Re: The data is compressed with gzip. I tested it with: $ curl http://stores.ebay.com/honesty-seller-ly9999 > bad_data $ file bad_data bad_data: gzip compressed data, from FAT filesystem (MS-DOS, OS/2, NT) The site is served with the header `Content-Encoding: gzip`, which isn't correct unless you request it with a `Accept-encoding: gzip`. Anyway, this … | |
Re: ..Commenting to move from 'Unanswered.' In the future, you may want to provide more information (such as a small example of what you have tried so far). For now, this article will help you learn how to ask smart questions to get smart answers: [How To Ask Questions The Smart … | |
Re: It looks like you are hard coding each possible answer. It would take pages to exhaust every possibility. Maybe try splitting the input on `-`, and parsing the two values you need (using `strsep()` and `sscanf()`). Once you have the two values, you can calculate whatever value you need. | |
Re: ..Commenting to move from 'Unanswered.' In the future, you may want to provide more information (such as a small example of what you have tried so far). For now, this article will help you learn how to ask smart questions to get smart answers: [How To Ask Questions The Smart … | |
Re: ..Commenting to move from 'Unanswered.' In the future, you may want to provide more information (such as a small example of what you have tried so far). For now, this article will help you learn how to ask smart questions to get smart answers: [How To Ask Questions The Smart … | |
Re: ..Commenting to move from 'Unanswered.' In the future, you may want to provide more information (such as a small example of what you have tried so far). For now, this article will help you learn how to ask smart questions to get smart answers: [How To Ask Questions The Smart … | |
Re: ..Commenting to move from 'Unanswered.' In the future,you may want to provide more information (such as a small example of what you have tried so far). For now, this article will help you learn how to ask smart questions to get smart answers: [How To Ask Questions The Smart Way](http://www.catb.org/esr/faqs/smart-questions.html) | |
Re: I was about to post this same message. It opens automatically when I load a page, and that's neat, but closing it only lasts for thirty seconds or so. I thought it was a new message when it opened the second time. I guess it just wanted to be open. | |
Re: This ID generator depends on enough time elapsing between calls. I can see that running this kind of code in a fast loop could make duplicates: for (int i = 0; i < 10; i++) { Console.WriteLine (DateTime.Now.ToString ("hh-mm-ss.ffff")); } Output: 05-16-12.2358 05-16-12.2779 05-16-12.2780 // <- Many duplicates are created. … | |
Re: This was posted in the wrong forum (looking for [Software Development -> Java](https://www.daniweb.com/software-development/java/9)). I'm posting to remove from 'Unanswered'. | |
Re: Put the form on your page with an id (let's say `'contactForm'`) and css set to `'display: none'`, so it's easily accessible with javascript but initially hidden. Make your "show form" button/link/whatever with an onclick event (there are multiple ways to do this): <a href='#contactForm' onclick='javascript: show_form();'> E-mail me. </a> … | |
Re: What is the content and type of `cfg.project["samples"][0]["files"]["bam"]`? A Tuple/List/Set/Dict? Maybe stepping through a debugger, or even a simple debug-print would help you see what you are getting, or why you're not getting what you think you should. testdata = cfg.project['samples'][0]['files'] print('Actual files content:') print('{!r}'.format(testdata)) print('Actual bam content:') print('{!r}'.format(testdata['bam'])) Also, … | |
Re: This question is difficult to understand. I don't think the wall of output text helps. Maybe you could word it differently, or provide a little pseudo-code to help us understand what exactly you are trying to do? What are the comparisons? A file? What does "takes that to [metadata][phenotype][embryo]" mean? … | |
Re: All three of these options are working for me: Plain `echo "string" > file`: read -p "What is your variable: " WHATIS echo "This should be a bunch of lines I want this \"variable\" to be embedded it is $WHATIS" > ./test.txt `cat` with `HEREDOC` and variable expansion: read -p … | |
Re: What is the actual problem? Is there a traceback when you run it? You say: >while p is less than the length of the list... ..which is basically describing what your code does. Can you give me a more general explanation? Like "I want to shift the ordinance of every … | |
Re: Small typo in that example, the font name. Should be `'Times New Roman'` | |
Re: I can only find python-based "watermark" plugins at the moment. You may have to make one. The `PIL` or `pillow` libraries can help you work with images. Outside of GIMP, I see the [StegHide](http://steghide.sourceforge.net/) application recommended for this. | |
Re: I see that your `__init__` method is misspelled, but you're gonna want an instance to work with. You have a `calculating` class, but no object. Instantiate the class: mycalc = calculating() ...then use the method (`mycalc.addition`). Also, its good practice in python for classes to start with a capital letter. … | |
Re: `enumerate()` is great for grabbing an index and item at the same time, and `f.tell()` can tell you the current position in the file: for i, line in enumerate(file): print('{lineno} ({pos}): {line}'.format( lineno=i + 1, pos=file.tell(), line=line)) | |
Grabs the location and name of the script file itself. | |
Re: You could use `RegEx`, but that may be overkill. I think `GetFiles` supports glob matching like `GetFiles("C:\dir", "*.exe")`, but you don't want to call `GetFiles` multiple times. So maybe a simple `If` statement would suffice: If IO.Path.GetExtension(s) = ".exe" Then MyOtherBox.Items.Add(IO.Path.GetFileNameWithoutExtension(s)) Else WithoutThisTypeBox.Items.Add(IO.Path.GetFileNameWithoutExtension(s)) End If My VB.Net is rusty, but … | |
Re: Sounds like homework. If you post what you have tried so far I'm sure you would receive the help you are looking for. | |
Re: This is an old post, but I didn't see any translation tables in here. So here you go, a less secure encryption method for low-risk data: rot13 = str.maketrans( 'ABCDEFGHIJKLMabcdefghijklmNOPQRSTUVWXYZnopqrstuvwxyz', 'NOPQRSTUVWXYZnopqrstuvwxyzABCDEFGHIJKLMabcdefghijklm') encrypted = 'This is encrypted'.translate(rot13) print(encrypted) decrypted = encrypted.translate(rot13) print(decrypted) You can make the translation tables almost anything you … | |
Re: This would probably be better for [Shell Scripting](https://www.daniweb.com/software-development/shell-scripting/113) [Snippets](https://www.daniweb.com/software-development/shell-scripting/code/_/113). Also, some [code formatting](https://www.daniweb.com/community/syntax) would help. | |
Re: I kinda wish you could toggle a live preview for the editor. It shouldn't be shown all the time (might be bad for large posts), but when it's shown it would automatically update the preview. I've seen this on other sites and I really like it. It helps me check … | |
Re: just type it out. Put a blank line before the code, make sure all of the code lines are indented with 4 spaces. # I did not use the </>Code button. print('Hello World.') You can also use the tilde character (\`) to do "inline code" such as this: `int c … | |
Re: What is the error? Copy and paste the stacktrace/output. Also, formatting your code would help you get an answer. It makes it much easier to spot simple errors. Use the "</> Code" button, and paste your code there, or just make sure it is all indented with 4 spaces. | |
Re: I took a different approach to solving this problem. Instead of grepping for newline characters from the start, I used the `file` command to tell me the mime type of the file. If the file is binary, then nothing is done. If the file is a text file, it is … | |
Re: You'll need to use something like [OCR](en.wikipedia.org/wiki/Optical_character_recognition). I've never messed with it myself, but I can see from a quick google search that there are [libraries](http://www.atalasoft.com/products/dotimage/ocr/tesseract) available for .Net. | |
Re: ..replied to the third post. Bumping to remove from 'Unanswered'. | |
Re: 3 posts for 1 question? Usually people don't just write programs for you here. Why does it have to be in Turbo C? Can it be in C? | |
Re: ..replied to the third post. Bumping to remove from 'Unanswered'. | |
Re: You could also do this with a `Process`. import functools import multiprocessing def background(func): @functools.wraps(func) def wrapper(*args, **kwargs): p = multiprocessing.Process(target=func, args=args, kwargs=kwargs) p.start() return wrapper Also, I wanted to point something out for new people that may be reading this. I think it's a good practice to use the … | |
Re: I always say that it helps to have a problem to solve. Find something you want to do, maybe a tool to make your everyday tasks easier, or making a better version of some tool you use. Find something that interests you and just start trying to make it. It … | |
Re: I like this. I modified it so the function name would be included with `frame.f_code.co_name`. | |
Re: You are talking about very low-level stuff, which would vary depending on the BIOS. I doubt this functionality is baked in to the .Net framework. It would pose serious security risks if the BIOS password could be easily set by just any .Net application (Administrator or not). ![]() | |
Re: Are you sure that `Session["LastName"]` is being set properly in the first place? I mean the cookie is being set properly? I think the only reason your new code wouldn't work is if `Session["LastName"]` is `null`. And yes, the `string lastName = (string)Session["LastName"];` replacement would be correct. | |
Re: scripts or libraries? For libraries I would look at [PyPi](http://pypi.python.org), that is the standard. For scripts, there is no "gold standard". Just google for whatever tool you are looking for. If most of the results happen to come from Github then so be it. | |
Re: This comment is here to remove this crazy post from `Unanswered`. Don't ask people to write software/patches for you. | |
Re: using System; using System.Collections.Generic; // Creating and adding answers. Dictionary<String, String> answers = new Dictionary<String, String> () { {"mykey1", "myanswer1"}, {"mykey2", "myanswer2"} }; // Adding on the fly. answers.Add ("mykey3", "myanswer3"); // Retrieving answers. String trykey = "mykey2"; String answer; Boolean retrieved = answers.TryGetValue (trykey, out answer); if (retrieved) { … | |
Re: You could look at making a [cgi](https://docs.python.org/3.4/library/cgi.html) script, but I don't recommend it. You should look into [HTML](www.w3schools.com/html/)/[JavaScript](http://www.w3schools.com/js/) and [AJAX](http://www.w3schools.com/ajax/default.ASP)/[Forms](http://www.w3schools.com/html/html_forms.asp), and make a Python backend like [Flask](http://flask.pocoo.org/), [Django](http://djangoproject.com), or [Bottle](http://bottlepy.org). Basically you have a Python app running server-side, that accepts a [GET](http://www.w3schools.com/tags/ref_httpmethods.asp) or [POST](http://www.w3schools.com/tags/ref_httpmethods.asp) request. A GET request would look … | |
I think Snippets and Tutorials should be excluded from 'Unanswered', or a new section should be created called 'Open Questions' that doesn't include snippets and tutorials. Most of the snippets/tutorials don't receive an answer for a long time and they cloud the view when looking for a quick question to … | |
Re: If I understand your problem, you want to scale the button size based on how long a show runs? Kinda like the guide on a cable box? Here is one solution I came up with, I broke it into functions to make it easier to read: # Needed to parse … | |
Re: The odd numbers in your example are 2 and 4. So 6 is correct. The even number in your example is 3. So 3 is correct. I would've probably did something like this: def findproductandsum(userinput): # Initialize counters. finalproduct, finalsum = 1, 0 # Iterate over index and character in … |
The End.