Search Results

Search found 35302 results on 1413 pages for 'string literals'.

Page 172/1413 | < Previous Page | 168 169 170 171 172 173 174 175 176 177 178 179  | Next Page >

  • Building 16 bit os - character array not working

    - by brainbarshan
    Hi. I am building a 16 bit operating system. But character array does not seem to work. Here is my example kernel code: asm(".code16gcc\n"); void putchar(char); int main() { char *str = "hello"; putchar('A'); if(str[0]== 'h') putchar('h'); return 0; } void putchar(char val) { asm("movb %0, %%al\n" "movb $0x0E, %%ah\n" "int $0x10\n" : :"m"(val) ) ; } It prints: A that means putchar function is working properly but if(str[0]== 'h') putchar('h'); is not working. I am compiling it by: gcc -fno-toplevel-reorder -nostdinc -fno-builtin -I./include -c -o ./bin/kernel.o ./source/kernel.c ld -Ttext=0x9000 -o ./bin/kernel.bin ./bin/kernel.o -e 0x0 What should I do?

    Read the article

  • Code Golf: Duplicate Character Removal in String

    - by Alex
    The challenge: The shortest code, by character count, that detects and removes duplicate characters in a String. Removal includes ALL instances of the duplicated character (so if you find 3 n's, all three have to go), and original character order needs to be preserved. Example Input 1: nbHHkRvrXbvkn Example Output 1: RrX Example Input 2: nbHHkRbvnrXbvkn Example Output 2: RrX (the second example removes letters that occur three times; some solutions have failed to account for this) (This is based on my other question where I needed the fastest way to do this in C#, but I think it makes good Code Golf across languages.)

    Read the article

  • How to test if a string is inside a list of predinfined list of string in oracle pl/sql

    - by drupalspring
    I define a list a string which contains different country codes ( for example , USA ,CHINA ,HK ,JPN) How can I check that if a input variable equal to one of the country of the country list in pl/sql . I use the following code to test it but fail, how can I revise it? declare country_list CONSTANT VARCHAR2(200) := USA,CHINA,HK,JPN; input VARCHAR2(200); begin input := 'JPN'; IF input IN (country_list) DBMS_OUTPUT.PUT_LINE('It is Inside'); else DBMS_OUTPUT.PUT_LINE('It is not Inside'); END IF; end;

    Read the article

  • Evaluate a string-expression in XSL

    - by Jerzakie
    Is there any way to evaluate a string expression in XSL? example: <myItem id="1"> <validator expression="$someVariable = '3'" /> </myItem> ... <xsl:variable name="someVariable" select="3" /> <xsl:if test="@expression"> ... I realize this syntax does not work the way I want it to, but is there any way to store the test expression in a variable and then evaluate the expression?

    Read the article

  • How to join list of strings?

    - by satsurae
    Hi all, This is probably seriously easy to solve for most of you but I cannot solve this simply putting str() around it can I? I would like to convert this list: ['A','B','C'] into 'A B C'. Thanks in advance!!

    Read the article

  • Excel plugin: Finding a Chart's Source Data Number Format String

    - by Jack
    I'm currently working on a plugin for excel (using VB.net--not VBA) that will attempt (among other things) to recognize the format of the source data of a chart and configure the chart's series' number format strings appropriately. That is, yearly data should always be two numbers, monthly data should always be a 3-letter month followed by a 2-digit year, etc. The goal is to have a uniform representation across all charts for monthly data, annual data, daily data, etc. My question is this: how do I find the number format string for the cells (or any cell that is part of that series, as I will be assuming all cells that make up a particular series have the same format) that represent the source data for the chart? Note: I can assume that the chart will always point to a range of cells (not, for example, an array of data).

    Read the article

  • SQL Server 2000 - Filter by String Length

    - by user208662
    Hello, I have a database on a SQL Server 2000 server. This database has a table called "Person" that has a field call "FullName" that is a VARCHAR(100). I am trying to write a query that will allow me to get all records that have a name. Records that do not have a name have a FullName value of either null or an empty string. How do I get all of the Person records have a FullName? In other words, I want to ignore the records that do not have a FullName. Currently I am trying the following: SELECT * FROM Person p WHERE p.FullName IS NOT NULL AND LEN(p.FullName) > 0 Thank you

    Read the article

  • Find a control by String from asp.net Web service

    - by jphenow
    Well since it seems relatively difficult to send the object of a WebControl over JSON using jquery.ajax() I've decided to send the name of the control as a string because I know how to do that. Then I promptly realized that, from a web service, I don't actually know how to search for a control by ID name. Since its a service I can't seem to get Control.FindControl() to work so does anyone have ideas or suggestions? All I'm trying to do is call a databind() on my radcombobox. Thanks in advance! For any of you that knows anything about asp.net/rad controls - I'm basically updating a database and want the radcombobox to be in sync with that database again after adding something, before I autoselect what was just added. Other than databind do i have to call anything to refresh that list? Thanks again!

    Read the article

  • Spaces around all hyphens in a string without double-up

    - by Dave
    I'm after a regex that puts spaces around each "-" in a string, eg. 02 jaguar-leopard, tiger-panther 08 would become 02 jaguar - leopard, tiger - panther 08 Note that if the "-" already has spaces around it, no changes are to be made, eg. 02 jaguar - leopard, tiger - panther 08 should not become 02 jaguar - leopard, tiger - panther 08 The number of hyphens are unknown in advance. Thanks for any ideas... Edit: I'm not actually using a language for this. I'm using Ant Renamer (a mass file renaming utility). There are two fields in the renamer GUI, "Expression" and "New name" to provide inputs. This is from the help file as an example: Swapping artist and title from mp3 file names: "Expression" = (.*) - (.*)\.mp3 "New name" = $2 - $1.mp3 Extract episode number and title from series video files with episode number as SnnEmm followed by title: "Expression" = Code\.Quantum\.S([0-9]{2})E([0-9]{2})\.(.*)\.FRENCH.XViD\.avi "New name" = Code Quantum - $1$2 - $3.avi

    Read the article

  • reading a line, tokenizing and assigning to struct in C

    - by Dervin Thunk
    line is fgets'd, and running in a while loop with counter n, d is a struct with 2 char arrays, p and q. Basically, in a few words, I want to read a line, separate it into 2 strings, one up until the first space, and the rest of the line. I clean up afterwards (\n from the file becomes \'0'). The code works, but is there a more idiomatic way to do this? What errors am I running into "unknowingly"? int spc = strcspn(line," "); strncpy(d[n].p, line, spc); d[n].p[spc+1]='\0'; int l = strlen(line)-spc; strncpy(d[n].q, line+spc+1, l); char* nl = strchr(d[n].q, '\n'); if(nl){ *nl='\0'; } n++; Thanks.

    Read the article

  • wchar to char in c++

    - by Chris
    I have a Windows CE console application that's entry point looks like this int _tmain(int argc, _TCHAR* argv[]) I want to check the contents of argv[1] for "-s" convert argv[2] into an integer. I am having trouble narrowing the arguments or accessing them to test. I initially tried the following with little success if (argv[1] == L"-s") I also tried using the narrow function of wostringstream on each character but this crashed the application. Can anyone shed some light? Thanks

    Read the article

  • Transmogrify into date from multiple columns

    - by Dave Jarvis
    What is a better way to program the following SQL: str_to_date( concat(convert(D.DAY, CHAR(2)), '-', convert(M.MONTH, CHAR(2)), '-', convert(M.YEAR, CHAR(4))), '%e-%m-%Y' ) as AMOUNT_DATE I want to convert the columns D.DAY, M.MONTH, and M.YEAR to a date field using MySQL. The above works, but seems much more complicated than it needs to be. (If there's an ANSI SQL way to do it, that would be even better.) Thank you!

    Read the article

  • HowTo parse numbers from string with BOOST methods?

    - by mosg
    Problem: Visual C++ 10 project (using MFC and Boost libraries). In one of my methods I'm reading simple test.txt file. Here is what inside of the file (std::string): 12 asdf789, 54,19 1000 nsfewer:22!13 Then I'm reading it and I have to convert all digits to int only with boost methods. For example, I have a list of different characters which I have to parse: ( ’ ' ) ( [ ], ( ), { }, ? ? ) ( : ) ( , ) ( ! ) ( . ) ( - ) ( ? ) ( ‘ ’, “ ”, « » ) ( ; ) ( / ) And after conversation I must have some kind of a massive of int's values, like this one: 12,789,54,19,1000,22,13 Maybe some one already did this job? PS. I'm new for boost. Thanks!

    Read the article

  • Remove leading zero's from alphanumeic text

    - by cedar715
    I've seen questions to prefix zeros here in SO. But not the other way !! Can you guys suggest me how to remove the leading zeros in alphanumeric text. Are there any built-in APIs or do I need to write a method to trim the leading zero's? Example: 01234 converts to 1234 0001234a converts to 1234a 001234-a converts to 1234-a 101234 remains as 101234 2509398 remains as 2509398 123z remains as 123z 000002829839 converts to 2829839

    Read the article

  • how to write floating value accurately to a bin file.

    - by user319873
    Hi I am trying to dump the floating point values from my program to a bin file. Since I can't use any stdlib function, I am thinking of writting it char by char to a big char array which I am dumping in my test application to a file. It's like float a=3132.000001; I will be dumping this to a char array in 4 bytes. Code example would be:- if((a < 1.0) && (a > 1.0) || (a > -1.0 && a < 0.0)) a = a*1000000 // 6 bit fraction part. Can you please help me writting this in a better way.

    Read the article

  • javascript - switch not working

    - by Fernando SBS
    function FM_log(level, text) { // caso não seja log total escolhe o que loga var log = false; switch (level) { case "addtoprio()":log = true; case "alternaTropas()":log = false; case "sendtroops()":log = false; defalt: log = false; } if ((logTotal == false) && (log == true)) GM_log(horaAtual() + " - "+level+", "+text); else if (logTotal == true) GM_log(horaAtual() + " - "+level+", "+text); } how to do that switch is a way it works?

    Read the article

  • Ignoring characters in a file while parsing

    - by sfactor
    i need to parse through a text file and process the data. the valid data is usually denoted by either a timestamp with TS followed by 10 numbers (TS1040501134) or values with a alpabet followed by nine numbers (A098098098)...so it will be like TS1040501134A111111111B222222222...........TS1020304050A000000000........ However, there are cases when there will be filler 0s when there is no data. So, such a case might be 00000000000000000000TS1040501134A111111111B2222222220000000000TS1020304050A000000000........` Now as we can see I need to ignore these zeros. how might i do this? I am using gnu C.

    Read the article

  • Getting ListView values into a string array?

    - by Andrew
    I have a ListView control set up in details mode, and on a button press I would like to retrieve all column values from that row in the ListView. This is my code so far: Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click Dim items As ListView.SelectedListViewItemCollection = _ Me.ManageList.SelectedItems Dim item As ListViewItem Dim values(0 To 4) As String Dim i As Integer = 0 For Each item In items values(i) = item.SubItems(1).Text i = i + 1 Next End Sub But values just comes out as an empty array. Any ideas? I just want the values array to be filled with the data of that ListView row. Cheers.

    Read the article

  • How can a string timestamp with hours 0 to 24 be parsed

    - by user897052
    I am trying to parse a string timestamp of format "yyyyMMddHHmmss" with DateTime.ParseExact(). The catch is I must allow for an hour value of "24" (i.e. hours can be from 0 to 24; Note: I can't control the input values.) and, of course, that results in an exception. Are there any settings/properties I can set instead of manually parsing/using regex's? If not, any efficient parsing ideas? ex. DateTime.ParseExact("20120911240000", "yyyyMMddHHmmss", System.Globalization.CultureInfo.InvariantCulture); hour 24 means hour 0 of next day (so day + 1, hour = 0)

    Read the article

  • faster strlen ?

    - by Jack
    Typical strlen() traverse from first character till it finds \0. This requires you to traverse each and every character. In algorithm sense, its O(N). Is there any faster way to do this where input is vaguely defined. Like: length would be less than 50, or length would be around 200 characters. I thought of lookup blocks and all but didn't get any optimization.

    Read the article

  • Finding if a sentence contains a specific phrase in Ruby

    - by TenJack
    Right now I am seeing if a sentence contains a specific word by splitting the sentence into an array and then doing an include to see if it contains the word. Something like: "This is my awesome sentence.".split(" ").include?('awesome') But I'm wondering what the fastest way to do this with a phrase is. Like if I wanted to see if the sentence "This is my awesome sentence." contains the phrase "my awesome sentence". I am scraping sentences and comparing a very large number of phrases, so speed is somewhat important.

    Read the article

  • how can I split up this string

    - by lacrosse1991
    I am currently trying to sanitize some log files so they are in an easier format to read, and have been trying to use the gnu cut command, which works fairly well, although I cannot really think of a good way to remove the [INFO] part of the string logs/logs/server_1283258036.log:2010-08-31 23:06:51 [INFO] <NateMar> where?! logs/logs/server_1281904775.log:2010-08-15 22:59:53 [INFO] <BoonTheMoon> §b<BoonTheMoon>§ohhhhhh I would ultimately want to get the strings down to something that resembles the following 2010-08-31 23:06:51 <NateMar> where?! 2010-08-15 22:59:53 <BoonTheMoon> ohhhhhh how should I go about doing this? Have thought about using awk, although Im having a difficult time getting a grip on how that would work, so not sure how to set up something to do that, any help would be greatly appreciated, thanks!

    Read the article

< Previous Page | 168 169 170 171 172 173 174 175 176 177 178 179  | Next Page >