Hi there,
I am in need of reorganizing a large CSV file. The first column, which is currently a 6 digit number needs to be split up, using comma's as the field separator.
For example, I need this:
022250,10:50 AM,274,22,50
022255,11:55 AM,275,22,55
turned into this:
0,2,2,2,5,0,10:50 AM,274,22,50
0,2,2,2,5,5,11:55 AM,275,22,55
Let me know what you think!
Thanks!
I'm adding hotkeys to a web application in order to enable keyboard shortcuts for our CSRs to use, to reduce injury and increase calls-per-hour. I'm using an ASP.net UserControl to inject javascript into the page and it's working great.
I want the control to "just work", so that when hotkeys are assigned, using a declarative syntax, if the hotkeyed letter exists in the link text, it will be highlighted automatically, so the developer doesn't have to do anything, and also to maintain consistency in visual cues.
Here's the code to assign hotkeys, if it matters:
<uc:HotKeysControl ID="theHotkeys" runat="server" Visible="true">
<uc:HotKey ControlName="AccStatus$btnInvoiceEverBill" KeyCode="ctrl+v" />
<uc:HotKey ControlName="AccStatus$btnRefund" KeyCode="ctrl+u" />
<uc:HotKey ControlName="thirdControl" KeyCode="ctrl+p" />
</uc:HotKeysControl>
I want something like:
<a href="whatever" name="thirdControl">Make a <span class=hotkey">P</span>ayment</a>
...but I'm not married to the idea of injecting a <span/> in there if there's a better way.
How can I do this in CSS or JQuery? Is there a way to pass in a letter to a CSS style and have it change the color of the text displayed? Should I generate javascript to highlight the text when the page loads?
What would/did you do in this situation?
I have a txt file on the server which contains 10 lines of text. The text file is rewritten sometimes, and I get new lines using "\r\n". My problem shows when I want to load the lines in javascript variables. I do it like this, but this work only for numbers or for the last line of the file, because its not using the breakline tag: var x = '<?php echo $file[0]; ?>';
Ive tried to alert(x) but it`s not working.... (working only if I read the last line)
Any idead ?
In the following example, I didn't expect, that 1.2345foo would be parsed. Since I am reading data files, it is probably better to raise an error and notify the user.
Is peek() the correct thing to do here?
#include <iostream>
#include <sstream>
int main()
{
std::stringstream in("1.2345foo");
double x;
in >> x;
if (in) {
std::cout << "good\n";
}
else {
std::cout << "bad\n";
}
}
Output
good
So i have a 1 long line with characters, for example numbers[1-1024] in one line(no "\n", "\t" and "\b"):
1 2 3 4 5 6 7 8 9 10 11 ... 1024
How do i extract and print characters for example exactly 55 characters after 46? So output would be:
47 48 49 ... 101
Thanks.
I'm making my own forums and I don't want any BB code on it, but instead my own,
so i've gotten [b][u][img] working etc.
But i'm having problems with [quote=1][/quote] where the number is the user id...
E.G lets say I quote someone
So once I submit my post: (The variable $post would be:)
'[quote=1] Quoted post :P[/quote]'
How would I then get the number out the string? (But not the wrong number -not a number in the quoted post)
(So I could then use str_replace() to replace with a table which makes it looked quoted)
?? :)
Let's say you had a string
test = 'wow, hello, how, are, you, doing'
and you wanted
full_list = ['wow','hello','how','are','you','doing']
i know you would start out with an empty list:
empty_list = []
and would create a for loop to append the items into a list
i'm just confused on how to go about this,
I was trying something along the lines of:
for i in test:
if i == ',':
then I get stuck . . .
data <- read.delim("C:\\test.txt", header = FALSE, sep = "$$$$$")
Error in scan(file, what = "", sep = sep, quote = quote, nlines = 1, quiet = TRUE, :
invalid 'sep' value: must be one byte
Why there is a restriction like this? Can I overcome it?
When I send a URL like abc.efg.com/query?para1=cat;para2=dog, play WS API always convert it to abc.efg.com/query?para1=cat%03Bpara2%03Ddog. Of course, there are http:// in the beginning in the URL. my code is as below.
val url= "http://abc.efg.com/query?para1=cat;para2=dog"
val response = WS.url(url).get()
When I use fidder or netmon to look at the data that sent to sever, I found play framework WS (2.1.5) always change to the URL above I mentioned. How do I tell WS not to convert?
char *a = "apple";
printf("%s\n", a); \\ fine
printf("%s\n", a[1]); \\ compiler complains an int is being passed
Why does indexing a string pointer give me an int? I was expecting it to just print the string starting at position one (which is actually what happens when i use &a[1] instead). why do i need to get the address?
Let's assume I have the string
NSString* myString = @"Hello,";
How can I remove the comma without leaving a space? I have tried:
NSString* newString = [myString stringByReplacingOccurrencesOfString:@"," withString:@""];
and
NSString* newString = [myString stringByTrimmingCharactersInSet:[NSCharacterSet punctuationCharacterSet]];
But both are leaving spaces.
#include <stdio.h>
int main() {
char read = ' ';
while ((read = getchar()) != '\n') {
putchar(read);
}
return 0;
}
My input is f (followed by an enter, of course). I expect getchar() to ask for input again, but instead the program is terminated. How come? How can I fix this?
I have some unicode codepoints (\u5315\u4e03\u58ec\u4e8c\u4e0a\u53b6\u4e4b), which I have to convert into actual characters they represent.
What's the simplest way to do so?
Thank you.
In my .gvimrc I have following lines:
set listchars=tab:\.\ ,trail:-
set softtabstop=2
set shiftwidth=2
set tabstop=2
set expandtab
When I change last line to set noexpandtab the indents can be seen and marked with .
Is there a way to make vim treat expanded tabs like "normal" tab so that list option works as expected?
I have a column that contains HTML strings and has characters like ® and ™ in it. I want to replace all such characters with their HTML equivalent. Is this possible?
What I mean is, do animators work on an animation in say Flash (or some other kind
of key frame animation program) and then export it to the iphone somehow?
For example, say I am an animator and I want to create a person waving for an iphone
game. What type of external program would I use and then what libraries on the iphone
sdk would I use to load them in?
I was given an interview question:
// The first example:
char text[] = "henri";
char *p;
p = text;
*(p + 1) = 'E'; // Output = hEnri
// Now If we want to remove the "e" ie hnri, we would go for?????
*(p + 1)=?????
The obvious answer is to copy the rest of the array "back" one position. But this seems... unpleasant. Surely there is some better way?
I have a byte array that may or may not have null bytes at the end of it. After converting it to a string I have a bunch of blank space at the end. I tried using Trim() to get rid of it, but it doesn't work. How can I remove all the blank space at the end of the string after converting the byte array?
I am writing this is C#.
I have a dialog with a number of Alt-Letter shortcuts on labels for textboxes/etc. This dialog can present data in either an editable or a read-only mode. I've received a request to hide the underlines for the shortcuts if the dialog is in read only mode. Other than editing the label text at runtime (ugh) is there any way to remove them?
If you don't know what I'm referring to by alt-Letter shortcuts see this question.
I am trying to find a frequency of each symbol in any given text using an algorithm of O(n) complexity. My algorithm looks like:
s = len(text)
P = 1.0/s
freqs = {}
for char in text:
try:
freqs[char]+=P
except:
freqs[char]=P
but I doubt that this dictionary-method is fast enough, because it depends on the underlying implementation of the dictionary methods. Is this the fastest method?
char nm; int i=0;
double thelow, theupp; double numbers[200];
for(i=0;i<4;++i)
{ { char nm; double thelow,theupp; /*after erased ,created again*/
scanf("%c %lf %lf", &nm, &thelow, &theupp);
for (k = 0; ; ++k) ;
{ scanf("%lf",numbers[k]);
if(numbers[k]=='\n') break;
}
/*calling function and sending data(nm,..) to it*/
} /*after } is seen (nm ..) is erased*/
;
}
I want say compiler : hey my dear code read only i-th row,dont touch characters at placed in next line. because characters at placed in next line is token after i increased by 1 and nm ,thelow,theupp is being zero or erased after then again created.
how can I do ?
input;
D -1.5 0.5 .012 .025 .05 .1 .1 .1 .025 .012 0 0 0 .012 .025 .1 .2 .1 .05 .039 .025 .025
B 1 3 .117 .058 .029 .015 .007 .007 .007 .015 .022 .029 .036 .044 .051 .058 .066 .073 .080 .088 .095 .103