Search Results

Search found 1545 results on 62 pages for 'manipulation'.

Page 9/62 | < Previous Page | 5 6 7 8 9 10 11 12 13 14 15 16  | Next Page >

  • String manipulation appears to be inefficient

    - by user2964780
    I think my code is too inefficient. I'm guessing it has something to do with using strings, though I'm unsure. Here is the code: genome = FASTAdata[1] genomeLength = len(genome); # Hash table holding all the k-mers we will come across kmers = dict() # We go through all the possible k-mers by index for outer in range (0, genomeLength-1): for inner in range (outer+2, outer+22): substring = genome[outer:inner] if substring in kmers: # if we already have this substring on record, increase its value (count of num of appearances) by 1 kmers[substring] += 1 else: kmers[substring] = 1 # otherwise record that it's here once This is to search through all substrings of length at most 20. Now this code seems to take pretty forever and never terminate, so something has to be wrong here. Is using [:] on strings causing the huge overhead? And if so, what can I replace it with? And for clarity the file in question is nearly 200mb, so pretty big.

    Read the article

  • Speed vs security vs compatibility over methods to do string concatenation in Python

    - by Cawas
    Similar questions have been brought (good speed comparison there) on this same subject. Hopefully this question is different and updated to Python 2.6 and 3.0. So far I believe the faster and most compatible method (among different Python versions) is the plain simple + sign: text = "whatever" + " you " + SAY But I keep hearing and reading it's not secure and / or advisable. I'm not even sure how many methods are there to manipulate strings! I could count only about 4: There's interpolation and all its sub-options such as % and format and then there's the simple ones, join and +. Finally, the new approach to string formatting, which is with format, is certainly not good for backwards compatibility at same time making % not good for forward compatibility. But should it be used for every string manipulation, including every concatenation, whenever we restrict ourselves to 3.x only? Well, maybe this is more of a wiki than a question, but I do wish to have an answer on which is the proper usage of each string manipulation method. And which one could be generally used with each focus in mind (best all around for compatibility, for speed and for security). Thanks.

    Read the article

  • Meta package / quick reference for command line string manipulation tools?

    - by Dylan McCall
    The latest version of the Scribes text editor lets us select some text, hit Alt+X, and then run an arbitrary command. For example, I can run the sort command and the selected text is replaced appropriately. This is quite useful but I am also not very well-versed in awk and the like. Is there something I can grab that will provide more of these commands like sort? Maybe a package with a whole bunch of handy, task-specific string manipulation commands?

    Read the article

  • JavaOne 2012 : Oracle présente la spécification JSR 353, l'API Java pour la manipulation avec souplesse du format JSON

    JavaOne 2012 : Oracle présente la spécification JSR 353 l'API Java pour rendre la manipulation des données JSON plus propre et cohérente JavaOne 2012 s'est achevé hier. L'événement Java le plus important de l'année a levé le voile sur un nombre impressionnant de nouveautés, innovations et ambitions pour l'écosystème Java. Oracle pendant ses sessions a présenté sa feuille de route pour le langage et les points sur lesquels l'entreprise travaille actuellement pour la prochaine version de Java, dont l'intégration des expressions lambda, du moteur JavaScript Nashorn, les annotations, la nouvelle API « date and time » et bien ...

    Read the article

  • BitSet to and from integer/long

    - by ataylor
    If I have an integer that I'd like to perform bit manipulation on, how can I load it into a java.util.BitSet? How can I convert it back to an int or long? I'm not so concerned about the size of the BitSet -- it will always be 32 or 64 bits long. I'd just like to use the set(), clear(), nextSetBit(), and nextClearBit() methods rather than bitwise operators, but I can't find an easy way to initialize a bit set with a numeric type.

    Read the article

  • Cleanest way to build an SQL string in Java

    - by Vidar
    I want to build an SQL string to do database manipulation (updates, deletes, inserts, selects, that sort of thing) - instead of the awful string concat method using millions of "+"'s and quotes which is unreadable at best - there must be a better way. I did think of using MessageFormat - but its supposed to be used for user messages, although I think it would do a reasonable job - but I guess there should be something more aligned to SQL type operations in the java sql libraries. Would Groovy be any good? Any help much appreciated.

    Read the article

  • String manupulation classic interview questions

    - by user189364
    Hi, I am scheduled to have an onsite interview so I am preparing few basic questions. According to the company profile, they are big on string manipulation questions. So far i am manually coded these functions: 1) String length, copy, concat, remove white space 2) Reverse 3) Anagrams 4) Palindrome Please can some can give me a list of more classic string questions which i can practice before going there.

    Read the article

  • How can I partial compare two strings in C?

    - by Nazgulled
    Hi, Let's say I have the following content: Lorem Ipsum is simply dummy text of the printing and typesetting industry. How do I search for dummy or dummy text in that string using C? Is there any easy way to do it or only with strong string manipulation? All I need is to search for it and return a boolean with the result.

    Read the article

  • Simple image editor to select area of image as wallpaper

    - by Kevin
    I've spent way to many hours looking for software to do the following simple task, so now I'll ask. I need software that will open an image and put a 'crop box' on it. You can set the 'crop box' to standard screen resolutions (1024x768) or define a custom one. You can move the 'crop box' around on the image to select the area you want. You can re-size the 'crop box' (selecting a corner and dragging w/mouse) and it maintains the correct aspect ratio. You can save the area in the 'crop box' to use as the Windows background. (The software doesn't need to set it as the background, I can do that myself in Windows XP.) The free software sites (CNET.com, etc.) have lots of image editing software that do things much more complicated than this simple task. I've spent too many hours downloading them to see if they will do this particular task. The ones I've tried would require manual trial and error to get the part of an image that I want saved as an image, with the correct aspect ratio so Windows doesn't screw with it (stretch, tile, crop) when I select it as the wallpaper.

    Read the article

  • Proving file creation dates

    - by Nils Munch
    In a weird case surrounding copyrights of a software system I have developed, I use the fact that I have all the source files of the system in question, created long before I joined the company that claims to own the system. The company being sued by yours truely says that I have simply manipulated to files to appear to be from that date. Is it even possible to fake or manipulate creation dates ? And if so, how can I "prove" that the files really are that old ? Luckily, I stored my project on GitHub, whick confirmed the fact that the files are from that era, but that is besides the point. I run purely Apple OS X.

    Read the article

  • Export to excel - COMMA issue

    - by 6242Y
    I want to put a string in an excel sheet from my Export to excel function. However my string is as follows: string : Red, red wine Go to my head Make me forget that I Still need and on my excel I get unexpected results , column change after comma and also column change when there is no full stop in front of an UPPER CASE alphabet. The Upper case alphabets (without a full stop before them) are also causing this (Go , Make . Still) How can I solve this issue ? I tried removing the spaces after the comma as var desc = ""; if (o.Description.Contains(',')) { var trimmedSplits = new List<string>(); var splits = o.Description.Split(','); foreach (var stringBits in splits) { desc = desc + stringBits.Trim() + ","; } desc = desc.Remove(desc.Length - 1); } dtRow[(int)ProductRangeExportToExcel.Description] = desc;

    Read the article

  • Despeckle line art

    - by Dour High Arch
    We have a number of line-art charts unfortunately saved as JPEGs. They are now riddled with distracting compression artifacts or "speckles". Is there any way of removing these? I do not have the original files and it will be very difficult to recreate them. I am running Windows 7 and tried Paint.Net; none of the filters help. Posterize washed out all the colors and leaves the speckles. Blur makes text unreadable. Noise Reduction wrecks antialiasing of curved lines, and perversely enhances the speckles, making them look like checkerboards. Yes, I have Googled for software to do this; there are many programs that advertise despeckling but, after my experience with Paint.Net, do not want to experiment with applications that show no before and after images. The only example I have seen that does what I want is from a Photoshop tutorial. I have dozens of files and the tutorial requires considerable manual fine-tuning. I would prefer to automate or batch-process this task. Commercial apps are fine, but I do not want to spend over $600 and learning a complex program for a single task.

    Read the article

  • How Do I Parse a String?

    - by Russ
    I am new to bash, and I am creating a script that loops through the files in a directory and based on part of the filename, does something with the file, so far I have this: #!/bin/bash DIR="/Users/me/Documents/import/*" for f in "$DIR" do $t=?????? echo "Loading $f int $t..." done so $f will output something like this: /Users/me/Documents/import/time_dim-1272037430173 out of this, I want time_dim, the directory can be variable length and -1272037430173 is a fixed length (it's the unix timestamp btw). What is the best way to go about this?

    Read the article

  • Not-quite-JSON string deserialization in Python

    - by cpharmston
    I get the following text as a string from an XML-based REST API 'd':4 'ca':5 'sen':1 'diann':2,6,8 'feinstein':3,7,9 that I'm looking to deserialize into a pretty little Python dictionary: { 'd': [4], 'ca': [5], 'sen': [1], 'diann': [2, 6, 8], 'feinstein': [3, 7, 9] } I'm hoping to avoid using regular expressions or heavy string manipulation, as this format isn't documented and may change. The best I've been able to come up with: members = {} for m in elem.text.split(' '): m = m.split(':') members[m[0].replace("'", '')] = map(int, m[1].split(',')) return members Obviously a terrible approach, but it works, and that's better than anything else I've got right now. Any suggestions on better approaches?

    Read the article

  • Application leaking Strings?

    - by Jörg B.
    My .net application does some heavy string loading/manipulation and unfortunately the memory consumption keeps rising and rising and when looking at it with a profiler I see alot of unreleased string instances. Now at one point of time or another I do need all objects t hat do have these string fields, but once done, I could get rid of e.g. the half of it and I Dispose() and set the instances to null, but the Garbage Collector does not to pick that up.. they remain in memory (even after half an hour after disposing etc). Now how do I get properly rid of unneeded strings/object instances in order to release them? They are nowhere referenced anymore (afaik) but e.g. aspose's memory profiler says their distance to the gc's root is '3'?

    Read the article

  • Most efficient way to remove special characters from string

    - by ObiWanKenobi
    I want to remove all special characters from a string. Allowed characters are A-Z (uppercase or lowercase), numbers (0-9), underscore (_), or the dot sign (.). I have the following, it works but I suspect (I know!) it's not very efficient: public static string RemoveSpecialCharacters(string str) { StringBuilder sb = new StringBuilder(); for (int i = 0; i < str.Length; i++) { if ((str[i] >= '0' && str[i] <= '9') || (str[i] >= 'A' && str[i] <= 'z' || (str[i] == '.' || str[i] == '_'))) sb.Append(str[i]); } return sb.ToString(); } What is the most efficient way to do this? What would a regular expression look like, and how does it compare with normal string manipulation? The strings that will be cleaned will be rather short, usually between 10 and 30 characters in length.

    Read the article

  • image filters for iphone sdk development

    - by plsp
    Hi All, I am planning to develop an iphone app which makes use of image filters like blurring, sharpening,etc. I noticed that there are few approaches for this one, Use openGL ES. I even found an example code on apple iphone dev site. How easy is openGL for somebody who has never used it? Can the image filters be implemented using the openGL framework? There is a Quartz demo as well posted on apple iphone dev site. Has anybody used this framework for doing image processing? How is this approach compared to openGL framework? Don't use openGL and Quartz framework. Basically access the raw pixels from the image and do the manipulation myself. Make use of any custom built image processing libraries like this one. Do you know of any other libraries like this one? Can anybody provide insights/suggestions on which option is the best? Your opinions are highly appreciated. Thanks!

    Read the article

< Previous Page | 5 6 7 8 9 10 11 12 13 14 15 16  | Next Page >