Search Results

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

Page 33/62 | < Previous Page | 29 30 31 32 33 34 35 36 37 38 39 40  | Next Page >

  • c++ creating ambigram from string

    - by mike_hornbeck
    I have a task to implement "void makeAmbigram(char*)" that will print on screen ambigram of latin string or return something like 'ambigram not possible'. Guess it's just about checking if string contains only of SNOXZHI and printing string backwards. Or am I wrong ? I'm a complete noob when dealing with cpp so that's what I've created : #include <iostream> using namespace std; char[]words; char[]reversed; char[] ret_str(char* s) { if(*s != '\0') ret_str(s+1); return s; } void makeAmbigram(char* c) { /* finding chars XIHNOZS and printing ambigram */ } int main() { cin>>words; reversed = ret_str(words); makeAmbigram(reversed); return 0; } I can reverse string but how to check if my reversed string contains only needed chars ? I've found some function but it's hard or even imposible to implement it for greater amount of chars : http://www.java2s.com/Code/C/String/Findcharacterinstringhowtousestrchr.htm

    Read the article

  • Manipulating both unicode and ASCII character set in C#

    - by Murlex
    I have this mapping in my C# application string [,] unicode2Ascii = { { "&#3001;", "\x86" } }; ஹ - is the unicode value for a tamil literal "ஹ". This is the raw hex literal for the unicode value saved by MS Word as a byte sequence. I am trying to map these unicode value "strings" to a hex value under 255 (so as to accommodate non-unicode supported systems). I trying to use string.replace like this: S = S.replace(unicode2Ascii[0,0], unicode2Ascii[0,1]); However the resultant ouput has a ? instead of the actual hex 0x86 stored. Any pointer on how I could set the encoding for the second element of that array to something like windows-1252? Or is there a better way to do this conversion? thanks in advance

    Read the article

  • BlackBerry - Cropping image

    - by rupesh
    Hi all i want to crop a part of Image ,for that i am using following code: int x=20; int y=50; int [] rgbdata=new int[(0+width-x+height-y)* (image.getWidth())]; image.getARGB(rgbdata, 0, image.getWidth(), x, y, width, height); cropedImage=new Bitmap(image.getWidth(),image.getWidth()); cropedImage.setARGB(rgbdata, 0,image.getWidth(), 80,80, width, height); x an y are the position from where the cropping will be done in the rectangular form. but it is not working can any one help me out please. any sample code will work for me. its urgent. thanks in advance

    Read the article

  • Overwriting a range of bits in an integer in a generic way

    - by porgarmingduod
    Given two integers X and Y, I want to overwrite bits at position P to P+N. Example: int x = 0xAAAA; // 0b1010101010101010 int y = 0x0C30; // 0b0000110000110000 int result = 0xAC3A; // 0b1010110000111010 Does this procedure have a name? If I have masks, the operation is easy enough: int mask_x = 0xF00F; // 0b1111000000001111 int mask_y = 0x0FF0; // 0b0000111111110000 int result = (x & mask_x) | (y & mask_y); What I can't quite figure out is how to write it in a generic way, such as in the following generic C++ function: template<typename IntType> IntType OverwriteBits(IntType dst, IntType src, int pos, int len) { // If: // dst = 0xAAAA; // 0b1010101010101010 // src = 0x0C30; // 0b0000110000110000 // pos = 4 ^ // len = 8 ^------- // Then: // result = 0xAC3A; // 0b1010110000111010 } The problem is that I cannot figure out how to make the masks properly when all the variables, including the width of the integer, is variable. Does anyone know how to write the above function properly?

    Read the article

  • Convert bit vector (array of booleans) to an integer, and integer to bit vector, in Java.

    - by dreeves
    What's the best way to unstub the following functions? // Convert a bit-vector to an integer. int bitvec2int(boolean[] b) { [CODE HERE] } // Convert an integer x to an n-element bit-vector. boolean[] int2bitvec(int x, int n) { [CODE HERE] } Or is there a better way to do that sort of thing than passing boolean arrays around? This comes up in an Android app where we need an array of 20 booleans to persist and the easiest way to do that is to write an integer or string to the key-value store. I'll post the way we (Bee and I) wrote the above as an answer. Thanks!

    Read the article

  • Set hidden form field values with JavaScript but request still empty

    - by tigerstyle
    HI volks, I try to set some hidden form field values with an onclick event. Ok, after I did something like this: document.getElementById('hidden_field').value = 123; I can output the value with the firebug console by entering this: alert(document.getElementById('hidden_field').value); So the values are definitely set. But now when I submit the form, the hidden field values are still empty. Do you have any idea whats going wrong? Thx for your answers.

    Read the article

  • How to detect padding on an integer and treat it as a string?

    - by Sirber
    I have this function to prepare variable to be used in a SQL query: function sqlize($mInput) { if (!isset($mInput)) $mInput = "null"; elseif (strtolower($mInput) == "null") { } elseif (is_numeric($mInput)) { } elseif (is_string($mInput)) { $mInput = trim($mInput); $mInput = addslashes($mInput); $mInput = '"' . $mInput . '"'; } else $mInput = "null"; return $mInput; } I have a string "0004", which is going in a "varchar field", is cought by is_numeric, and is saved as "4" and not "0004". Is there a way to detect the padding and process it as a string? Thank you!

    Read the article

  • How to manipulate string to delete quotes?

    - by user1751581
    I am trying to manipulate a string so that any quotes (") within <a href> and <\a> get taken out... Sorry if its been asked before but I just can't get it to work! By the way, I am POSTing the data from a form and then manipulating the string. This is basically html but its in the form of a string, and I want to take out quotes on things like images and links... Another thing is, I do not want to escape the quotes because that would break the link... And the whole point is that the html can be used and work fine... But now, something is automatically creating a second set of quotes inside the normal quotes, like this: <a href="\"http://www.example.com/\""></a> Example input would be: <p><a href="http://www.example.com">example</a></p> Heres how it appears when I echo it however: <p><a href=\"http://www.example.com\">example</a></p> Heres how I want it to look: <p><a href="http://www.example.com">example</a></p> So I would actually be trying to get rid of the (/) my bad...

    Read the article

  • jQuery way to replace just a text node with a mix of HTML and text

    - by hippietrail
    In my web browser userscript project I need to replace just one text node without affecting the other HTML elements under the same parent node as the text. And I need to replace it with more than one node: <div id="target"> some text<img src="/image.png"> </div> Needs to become: <div id="target"> <a href="#">mixed</a> text <a href="#">and</a> HTML<img src="/image.png"> </div> I know jQuery doesn't have a whole lot of support for text nodes. I know I could use direct DOM calls instead of jQuery. And I know I could just do something like $('#target').html(my new stuff + stuff I don't want to change). What I'd like to ask the experts here is, Is there a most idiomatic jQuery way to do this?

    Read the article

  • Reading Characher from Image

    - by Chinjoo
    I am working on an application which requires matching of numbers from a scanned image file to database entry and update the database with the match result. Say I have image- employee1.jpg. This image will have two two handwritten entries - Employee number and the amount to be paid to the employee. I have to read the employee number from the image and query the database for the that number, update the employee with the amount to be paid as got from the image. Both the employee number and amount to be paid are written inside two boxes at a specified place on the image. Is there any way to automate this. Basically I want a solution in .net using c#. I know this can be done using artificial neural networks. Any ideas would be much appreciated.

    Read the article

  • Subscript text in pdf C#

    - by daft
    How do I insert a subscript charachter in a string in C#? I have nor problems appending a superscript 2 in the same string using char.ConvertFromUtf32(178);, but I struggle with finding a similar solution for the subscripted text. Actually, I'm struggling with finding ANY solution at all to this rather embarrassing issue. :)

    Read the article

  • How do you return a string from a function correctly in Dynamic C?

    - by aquanar
    I have a program I am trying to debug, but Dynamic C apparently treats strings differently than normal C does (well, character arrays, anyway). I have a function that I made to make an 8 character long (well, 10 to include the \0 ) string of 0s and 1s to show me the contents of an 8-bit char variable. (IE, I give it the number 13, it returns the string "0001101\0" ) When I use the code below, it prints out !{happy face] 6 times (well, the second one is the happy face alone for some reason), each return comes back as 0xDEAE or "!\x02. I thought it would dereference it and return the appropriate string, but it appears to just be sending the pointer and attempting to parse it. This may seem silly, but my experience was actually in C++ and Java, so going back to C brings up a few issues that were dealt with in later programming languages that I'm not entirely sure how to deal with (like the lack of string variables). How could I fix this code, or how would be a better way to do what I am trying to do (I thought maybe sending in a pointer to a character array and working on it from the function might work, but I thought I should ask to see if maybe I'm just trying to reinvent the wheel). Currently I have it set up like this: this is an excerpt from the main() display[0] = '\0'; for(i=0;i<6;i++) { sprintf(s, "%s ", *char_to_bits(buffer[i])); strcat(display, s); } DispStr(8,5, display); and this is the offending function: char *char_to_bits(char x) { char bits[16]; strcpy(bits,"00000000\0"); if (x & 0x01) bits[7]='1'; if (x & 0x02) bits[6]='1'; if (x & 0x04) bits[5]='1'; if (x & 0x08) bits[4]='1'; if (x & 0x10) bits[3]='1'; if (x & 0x20) bits[2]='1'; if (x & 0x40) bits[1]='1'; if (x & 0x80) bits[0]='1'; return bits; } and just for the sake of completion, the other function is used to output to the stdio window at a specific location: void DispStr(int x, int y, char *s) { x += 0x20; y += 0x20; printf ("\x1B=%c%c%s", x, y, s); }

    Read the article

  • How to remove words based on a word count

    - by Chris
    Here is what I'm trying to accomplish. I have an object coming back from the database with a string description. This description can be up to 1000 characters long, but we only want to display a short view of this. So I coded up the following, but I'm having trouble in actually removing the number of words after the regular expression finds the total count of words. Does anyone have good way of dispalying the words which are less than the Regex.Matches? Thanks! if (!string.IsNullOrEmpty(myObject.Description)) { string original = myObject.Description; MatchCollection wordColl = Regex.Matches(original, @"[\S]+"); if (wordColl.Count < 70) // 70 words? { uxDescriptionDisplay.Text = string.Format("<p>{0}</p>", myObject.Description); } else { string shortendText = original.Remove(200); // 200 characters? uxDescriptionDisplay.Text = string.Format("<p>{0}</p>", shortendText); } }

    Read the article

  • Jquery convert string of one type to string array.....

    - by chandru_cp
    Consider a string which is {"Table" : [{"Bird" : "Peacock"}, {"Bird" : "Crow"}]} to this ["Peacock", "Crow"] in jquery... Is this possible? EDIT: I am doing this but didnt work... $(document).ready(function() { var obj = JSON.parse('{"Table" : [{"Bird" : "Peacock"},{"Bird" : "Crow"}]}'); myarray = []; $.each(obj.table, function(i, v) { myarray.push(v.Bird); }); $("#tags").autocomplete(myarray, { width: 138, max: 4, highlight: false, multiple: true, multipleSeparator: " ", scroll: true, scrollHeight: 300 }); });

    Read the article

  • Rails- MiniMagick commands not working

    - by digitalWestie
    I'm running windows xp and I've got MiniMagick and ImageMagick installed (latest versions). I'm now using the console to test out that everything works. Using the ms command prompt image magick works no problem. I'm testing this by using the identify command. Now, when I try to use MiniMagick from the console by entering image = MiniMagick::Image.new('image.jpg') It returns MiniMagickError, "ImageMagick command ("identify \"input.jpg\"") failed: {:status_code = #"'identify' is not recognized as an internal or external command,\noperable program or batch file.\n"} Can anybody help?

    Read the article

  • Format String become 0001, 0010 etc

    - by trycatch4j
    Hi all.., I have number : 1, 2, 3, 4, 10 But I wanna print that number 0001 0002 0003 0004 0010 I have search in google, the keyword is number format. but I've got nothing, I just get, frmat decimal such ass 1,000,000.00. hope you can suggest me a reference or give me some problem solving. Thanks,

    Read the article

  • How can I format strings for use as structure field names in MATLAB?

    - by Elpezmuerto
    I want to remove hyphens (-), slashes (/) and white space () from a string name(i) so that I can use it as a structure field name. This is the ugly way I am currently doing it using the function strrep: cell2mat(strrep(strrep(strrep(name(i), '-',''),'/',''),' ', '')) I have also tried other variations, such as: strrep(name(i),{'-','/'},{'',''}); strrep(name(i),['-','/'],['','']); What is a more efficient way of doing this?

    Read the article

< Previous Page | 29 30 31 32 33 34 35 36 37 38 39 40  | Next Page >