Search Results

Search found 4616 results on 185 pages for 'strings'.

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

  • Given a few strings, how many strings can be lexicographically least by modifying the alphabet?

    - by Jackson W
    Number of strings can be huge as in 30000. Given N strings, output which ones can be lexicographically least after modifying the english alphabet. e.g. acdbe...... for example if the strings were: omm moo mom ommnom "mom" is already lexicographically least with the original english alphabet. we can make the word "omm" least by switching "m" and "o" in the alphabet ("abcdefghijklonmpqrstuvwxyz"). the other ones you cant make lexicographically last, no matter what you do. any fast way to do this? I have no ways to approach this except try every single possible alphabet

    Read the article

  • Edit strings vars in compiled exe? C++ win32

    - by extintor
    I want to have a few strings in my c++ app and I want to be able to edit them later in the deployed applications (the compiled exe), Is there a way to make the exe edit itself or it resources so I can update the strings value? The app checks for updates on start, so I'm thinking about using that to algo send the command when I need to edit the strings (for example the string that contains the url used to check for updates). I don't want to use anything external to the exe, I could simply use the registry but I prefer to keep everything inside the exe. I am using visual studio 2010 c++ (or any other version of ms visual c++).

    Read the article

  • Passing a string from C# to cpp with COM

    - by Yaron Naveh
    I have a C# COM server which is consumed by a cpp client. One of the C# methods returns a string. In cpp the returned string is represented in Unicode (UTF-16), at least according to the memory view. Is this always the case with COM strings? Is there a way to use UTF-8 instead? I saw some code where strings were passed between cpp and c# as byte arrays. Is there any benefit in this?

    Read the article

  • How to pass a string containing both single and double quotes as a parameter to XSLT in PHP?

    - by Boaz
    Hi, I have a simple PHP-based XSLT trasform code that looks like that: $xsl = new XSLTProcessor(); $xsl->registerPHPFunctions(); $xsl->setParameter("","searchterms", $searchterms); $xsl->importStylesheet($xslDoc); echo $xsl->transformToXML($doc); The code passes the variable $searchterms, which contains a string, as a parameter to the XSLT style sheet which in turns uses it as a text: <title>search feed for <xsl:value-of select="$searchterms"/></title> This works fine until you try to pass a string with mixes in it, say: $searchterms = '"some"'." text's quotes are mixed." In that point the XSLT processor screams: Cannot create XPath expression (string contains both quote and double-quotes) What is the correct way to safely pass arbitrary strings as input to XSLT? Note that these strings will be used as a text value in the resulting XML and not as an XPATH paramater. Thanks, Boaz

    Read the article

  • How do I generate a random string of up to a certain length?

    - by slavy13
    I would like to generate a random string (or a series of random strings, repetitions allowed) of length between 1 and n characters from some (finite) alphabet. Each string should be equally likely (in other words, the strings should be uniformly distributed). The uniformity requirement means that an algorithm like this doesn't work: alphabet = "abcdefghijklmnopqrstuvwxyz" len = rand(1, n) s = "" for(i = 0; i < len; ++i) s = s + alphabet[rand(0, 25)] (pseudo code, rand(a, b) returns a integer between a and b, inclusively, each integer equally likely) It doesn't work because shorter lengths are as likely as longer ones, meaning it's more likely to generate a shorter string than a longer one, so the result is not uniform.

    Read the article

  • explain this macro

    - by deostroll
    #define __T(x) L ## x Found in code from one of the MFC source header file. It is mostly used for converting strings to ........ (I don't know what). If I am correct it converts strings to LPCTSTR...don't know what that type is either... I can't seem to convert char* into LPCTSTR. While MFC file handling, the following code will always return error while trying to open the file... char* filepath = "C:\\Program Files\\Microsoft Office\\Office12\\BITMAPS\\STYLES\\GLOBE.WMF"; if( !file.Open((LPCTSTR)filepath , CFile::modeRead, &fexp) ) { fexp.ReportError(); return 1; } But instead if I wrote it this way, it doesn't give error: if( !file.Open( _T("C:\\Program Files\\Microsoft Office\\Office12\\BITMAPS\\STYLES\\GLOBE.WMF") , CFile::modeRead, &fexp) ) { fexp.ReportError(); return 1; } I am looking at passing a variable as the first argument to the CFile::Open() method.

    Read the article

  • bitwise OR on strings

    - by mr.bio
    How can i do a Bitwise OR on strings? A: 10001 01010 ------ 11011 Why on strings? The Bits can have length of 40-50.Maybe this could be problematic on int ? Any Ideas ?

    Read the article

  • Algoritms for "fuzzy matching" strings

    - by Alexey Romanov
    By fuzzy matching I don't mean similar strings by Levenshtein distance or something similar, but the way it's used in TextMate/Ido/Icicles: given a list of strings, find those which include all characters in the search string, but possibly with other characters between, preferring the best fit.

    Read the article

  • Parse Directory Structure (Strings) to JSON using PHP

    - by Ecropolis
    I have an array of file-path strings like this videos/funny/jelloman.wmv videos/funny/bellydance.flv videos/abc.mp4 videos/june.mp4 videos/cleaver.mp4 fun.wmv jimmy.wmv herman.wmv Is there a library or easy way I can get to a data structure json or xml? Something like this: (I see there are a lot of snippets available for traversing actual folders, but again, I just have strings.) { files:{ file:[ { filename:'fun.wmv' }, { filename:'jimmy.wmv' }, { filename:'herman.wmv' } ], folder:{ foldername:'videos', file:[ { filename:'abc.mp4' }, { filename:'june.mp4' }, { filename:'cleaver.mp4' } ], folder:{ foldername:'funny', file:[ { filename:'jelloman.wmv' }, { filename:'bellydance.flv' } ] } } } }

    Read the article

  • Using Linq to concatenate strings

    - by tags2k
    What is the most efficient way to write the old-school: StringBuilder sb = new StringBuilder(); if (strings.Count > 0) { foreach (string s in strings) { sb.Append(s + ", "); } sb.Remove(sb.Length - 2, 2); } return sb.ToString(); ...in Linq?

    Read the article

  • Delphi / MySql : Problems escaping strings

    - by mawg
    N00b here, having problems escaping strings. I used the QuotedStr() function - shouldn't that be enough. Unfortunately, the string that I am trying to quote is rather messy, but I will post it here in case anyone wants to paste it into WinMerge or KDiff3, etc. I am trying to store an entire Delphi form into the database, rather than into a .DFM file. It has only one field, a TEdit edit box. The debugger shows the form as text as 'object Form1: TScriptForm'#$D#$A' Left = 0'#$D#$A' Top = 0'#$D#$A' Align = alClient'#$D#$A' BorderStyle = bsNone'#$D#$A' ClientHeight = 517'#$D#$A' ClientWidth = 993'#$D#$A' Color = clBtnFace'#$D#$A' Font.Charset = DEFAULT_CHARSET'#$D#$A' Font.Color = clWindowText'#$D#$A' Font.Height = -11'#$D#$A' Font.Name = 'MS Sans Serif''#$D#$A' Font.Style = []'#$D#$A' OldCreateOrder = False'#$D#$A' SaveProps.Strings = ('#$D#$A' 'Visible=False')'#$D#$A' PixelsPerInch = 96'#$D#$A' TextHeight = 13'#$D#$A' object Edit1: TEdit'#$D#$A' Left = 192'#$D#$A' Top = 64'#$D#$A' Width = 121'#$D#$A' Height = 21'#$D#$A' TabOrder = 8'#$D#$A' end'#$D#$A'end'#$D#$A before calling QuotedStr() and ''object Form1: TScriptForm'#$D#$A' Left = 0'#$D#$A' Top = 0'#$D#$A' Align = alClient'#$D#$A' BorderStyle = bsNone'#$D#$A' ClientHeight = 517'#$D#$A' ClientWidth = 993'#$D#$A' Color = clBtnFace'#$D#$A' Font.Charset = DEFAULT_CHARSET'#$D#$A' Font.Color = clWindowText'#$D#$A' Font.Height = -11'#$D#$A' Font.Name = ''MS Sans Serif'''#$D#$A' Font.Style = []'#$D#$A' OldCreateOrder = False'#$D#$A' SaveProps.Strings = ('#$D#$A' ''Visible=False'')'#$D#$A' PixelsPerInch = 96'#$D#$A' TextHeight = 13'#$D#$A' object Edit1: TEdit'#$D#$A' Left = 192'#$D#$A' Top = 64'#$D#$A' Width = 121'#$D#$A' Height = 21'#$D#$A' TabOrder = 8'#$D#$A' end'#$D#$A'end'#$D#$A''' afterwards. The strange thing is that my complete command 'INSERT INTO designerFormDfm(designerFormDfmText) VALUES ("'object Form1: TScriptForm'#$D#$A' Left = 0'#$D#$A' Top = 0'#$D#$A' Align = alClient'#$D#$A' BorderStyle = bsNone'#$D#$A' ClientHeight = 517'#$D#$A' ClientWidth = 993'#$D#$A' Color = clBtnFace'#$D#$A' Font.Charset = DEFAULT_CHARSET'#$D#$A' Font.Color = clWindowText'#$D#$A' Font.Height = -11'#$D#$A' Font.Name = ''MS Sans Serif'''#$D#$A' Font.Style = []'#$D#$A' OldCreateOrder = False'#$D#$A' SaveProps.Strings = ('#$D#$A' ''Visible=False'')'#$D#$A' PixelsPerInch = 96'#$D#$A' TextHeight = 13'#$D#$A' object Edit1: TEdit'#$D#$A' Left = 192'#$D#$A' Top = 64'#$D#$A' Width = 121'#$D#$A' Height = 21'#$D#$A' TabOrder = 8'#$D#$A' end'#$D#$A'end'#$D#$A''");' executes in a MySql console, but not from Delphi, where I pass that command as parameter command to a function which ADOCommand.CommandText := command; ADOCommand.CommandType := cmdText; ADOCommand.Execute(); I can only assume that I am having problems escpaing sequences which contain single quotes (and QuotedStr() doesn't seem to escape backslahes(?!)) What am I doing that is obviously, glaringly wrong?

    Read the article

  • ASP.NET user database without web.config connection strings

    - by vikp
    Hi, I'm wondering whether it's possible to use built in ASP.NET application services (aspnet_user, aspnet_role etc table) without specifying a connection string in a web.config. At the moment I store connection strings externally, but I keep finding hard-coded connection strings all over the web.config xml, various providers etc. It's driving me crazy. Thank you

    Read the article

  • Are there public domain collections of translations for strings commonly used in software applicatio

    - by Malcolm
    It seems to me that there must be some public domain collection of gettext compatible PO files that we could search for 1:1 or fuzzy translations for strings commonly used in software applications? Is there a technical and copyright friendly way to query services like Google's Translator Toolkit, LaunchPad, Mygengo, etc. to find translations for common strings? Thank you, Malcolm

    Read the article

  • sql to compare two strings in MS access

    - by tksy
    I am trying to compare a series of strings like the following rodeo rodas carrot crate GLX GLX 1.1 GLX glxs the comparision need not be case sensitive i am trying to write a sql where i am updating the first string with the second string if they match approximately. Here except the second string all the other examples match. I would like to write a query which updates the strings except the second one. is this possible directly in a query in ACCESS thanks

    Read the article

  • Erlang : flattening a list of strings

    - by ErJab
    I have a list like this: [["str1","str2"],["str3","str4"],["str5","str6"]] And I need to convert it to ["str1", "str2", "str3", "str4", "str5", "str6"] How do I do this? The problem is that I'm dealing with lists of strings, so when I do lists:flatten([["str1","str2"],["str3","str4"],["str5","str6"]]) I get "str1str2str3str4str5str6" However, if the elements of the original list where just atoms, then lists:flatten would have given me what I needed. How do I achieve the same with strings?

    Read the article

  • machine learning and code generator from strings

    - by BCS
    The problem: Given a set of hand categorized strings (or a set of ordered vectors of strings) generate a decision function to categorize more input. The question: are there any tools out there that will do that? I'm thinking of some kind of reasonably polished, download, install and go kind of things, as opposed to to some library or a brittle academic program.

    Read the article

  • Load a list of localized strings at once in IOS

    - by Victor Ronin
    I want to show a table with the list of strings which are localized. The straightforward method would be: a) Point data source to my ViewController b) Define an array c) Allocate the array in my ViewController and init (arrayWithObjects) it with the strings from localized resources (NSLocalizedString) d) Use this array in UITableViewDataSource delegated methods Mainly my concern is item b). The construction looks quite heavy and I wonder whether I can somehow specify and load whole list of localized string at once.

    Read the article

  • Compare versions as strings

    - by Dmitriy
    Comparing version numbers as strings is not so easy... "1.0.0.9" "1.0.0.10", but it's not correct. Obvious way to do it properly is parse these strings, convert to numbers and compare as numbers. Is it other way to do it more "elegant"? For example, boost::string_algo...

    Read the article

  • Is String.concat slower than Array approach to join strings

    - by Rajat
    Strings in JavaScript are immutable. Across the web and here on Stack Overflow as well, I came across the Array approach to concatenate strings: var a = []; a.push(arg1,arg,2....); console.log(a.join('')); I know that this approach is better than the simple console.log(arg1 + arg2 +.....); for reasons of skipping creating intermediate objects but how does it fair better against : arg1.concat(arg2,arg3.....);

    Read the article

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