Programming :: Formatting A Datetime String - In G++ ?
Jul 10, 2011
I copied and tested a piece of simple formatting a datetime string code from book, c++ cookbook, page 201, Chapter5 section2, Example5-4. but it wont compile in my g++ 4.5.2(on ubuntu 10.04, kernel2.6.35-25)
Example 5-4 formatting a datetime string
Using namespace std;
View 1 Replies
ADVERTISEMENT
Oct 22, 2010
copy string a to string b and change string b with toupper() and count the chars
View 3 Replies
View Related
Sep 9, 2010
In Python 2.6.5, I could import from mx.DateTime.ISO import ParseDateTimeUTC With 2.7 I cannot.Here is the error. My module util_lib contains the import noted above.
File "util_lib.py", line 46, in <module>
from mx.DateTime.ISO import ParseDateTimeUTC
ImportError: No module named mx.DateTime.ISO
What changes do I need to make, to import on pre-2.7 and 2.7?
View 2 Replies
View Related
Oct 25, 2010
I have spent lots of time trying to figure out how to parse the domain part of this file but am stuck.
How should this be approached:
Code:
Code:
The domains need to be parse at a maximum for 4 levels then the remainder will be put the last field.
View 3 Replies
View Related
Oct 20, 2010
I have a column of datetime entries which I sorted to removed duplicate entries.
I have still lots of entries which are adjacent to each other by 1 second.
How would I go about removing any entries which have an offset of the previous or after entry by 1 second?
Code:
View 5 Replies
View Related
Dec 29, 2010
I'm changing some syscalls functions into kernel 2.6.36.2
So i'm doing this :
Code:
But i have a output like this : Date 1293619251
How can i convert inode->i_atime into D:M:Y h:m Format?? or just simply D:M:Y
View 1 Replies
View Related
May 3, 2011
I've been trying to understand pthread in C a little better. So I made a simple program that takes in a string from the command line and creates a thread to print the string. I've looked online and copied the basic concepts but there are something things I'm confused about. The programs works just fine, but I have questions. Here's what I have so far.
[Code]....
One thing I'd like to know is why the 3rd argument in the pthread_create function which is my SendMessage function needs to be typecasted to a void pointer and then send the address of the function. Also as for the 4th argument, I would see typecasting to void pointer in some of the pthread examples I saw online, but in my case I'm passing a char pointer, would this be correct? In which case would I ever want to pass a void pointer?
Do I need a pthread_exit(NULL) in my main and in the SendMessage function? If so, why? I added the sleep() function so that I could let the pthread_exit function in my SendMessage function execute first. I simply saw that the online examples on pthread had pthread_exit() in both locations.
View 6 Replies
View Related
Oct 16, 2010
I have a set of lines as ahown below:
Leon went to school
Leon came back from school..
Leon had dinner...
I have to replace the line containing "dinner" by a single string LUNCH...
View 2 Replies
View Related
Feb 25, 2011
I need to creates string suffixes out of a Reference string. for eg. suffixes of abcdefg will be
1)bcdefg
2)cdefg
3)defg
and so on...
create an array of pointers to point to the first few characters and then use that pointer to print the rest of the string.But when i print using the pointer i get GARBAGE values! shudn't std::cout<<ptr[w] print the string following the char it is pointing to? why do i get garbage values?
View 9 Replies
View Related
Apr 18, 2010
So if I'm given a location of a file like:
How can I just take the type of the file at the end? I know I can use strrchr() for a period to get the pointer to the period just before file type. Is there a build in string function that will just take the rest of the string from a certain point on forward in the string? I know it wouldn't be much work to make it myself, but I figured I would find out if it already existed before doing it.
View 9 Replies
View Related
Mar 13, 2010
Code:
The error is:
Code:
What I want to do is take input of ip4 as a string, convert it to an integer to add 1 to it, then reconvert it back to a string. Its not working.
My full code is:
Code:
View 1 Replies
View Related
Oct 12, 2009
I've been given a custom-made string class which handles string, wstring and bstr. It has a number of methods and assignment operators to convert to and from different types. The app I work on compiles happily in VS6 and VS2008, but when trying to compile in Redhat (version 4.1.1 in Redhat 5.0)
[code]....
View 4 Replies
View Related
Nov 11, 2010
I have the following two type of strings1: A/D2: A/C/DI am trying to write a subroutine to check whether all of the letters in string 1 appears in string 2. If yes, return true. If not, return false. In the above example, all the letters (A and D) in string 1 are also present in string 2, so I return true.
View 4 Replies
View Related
Oct 21, 2010
I have the following query:
Code:
$sql="SELECT table1.datetime, table1.user_id, table2.ip, FROM table1,table2 WHERE id='$id' AND (table1.id = table2.id AND table1.datetime = table2.datetime)";
In table2 the datetime fields are about 1 to 2 seconds off due to the source of the data, which I cannot change.
Is it possible via a query match table1.datetime & table2.datetime by HH:MM (ie. to the minute instead of to the second)?
View 1 Replies
View Related
Oct 13, 2010
I need to manipulate a column in a log file from the following format:
Prior to importing to a mysql database.
Unfortunately, I am not able to configure the device which is sending the logs to use the correct standard datetime format.
View 4 Replies
View Related
Apr 5, 2011
I'd like to know if it's possible in my program (C/C++) to create a filesystem on a partition, maybe with advanced options too. I don't want to call the shell and execute the usual commands to do that, so I wonder if there are some native Linux syscalls or external libraries to do that.
View 6 Replies
View Related
Mar 26, 2011
Do I have the convert the int to a string using stringstream then convert the string to a char? or is there a more direct way?Also is there a way to tell the length of a int?
View 5 Replies
View Related
Apr 13, 2011
I wrote an expect script that tests user authentication against a RADIUS server. The username is an email address, including an @ sign. I recently wrote an HTML/PHP front end to allow others to input username/password into a form and then see the results when they hit submit. Expect code that takes two args username, and password
Code:
expect "#"
send "test aaa group radius [lindex $argv 0] [lindex $argv 1] new-code
"expect "#"
[code]....
Every works as it's supposed to, except for the output of the script. When it displays on the webpage, it's segmented weirdly with all throughout. What I've found is when I remove the @ sign in the username input, it fixes it. Is there any part of HTML or PHP that treats the @ as a special character? 1 more thing is that I have another HTML/PHP/EXP script that works fine with the @.
View 2 Replies
View Related
Jun 30, 2010
I need to extract som text from a text file. The text is a test log with system info at the top and results further down. What I need is to add different tags with formatting before and after each line. I have prepared a template with html formatting, but the number of lines in the test log may be different from case to case, so I need to be able to add formatting tags by need. Can this be done using bash script, sed, awk, head, tail... ?
View 4 Replies
View Related
Oct 11, 2010
I need a script which can format the below text file which contains comments
Code:
Code:
Output should be:
Code:
Code:
Script should compare the column name and paste the output in above said manner.
View 13 Replies
View Related
Jul 23, 2010
I'm writing a script that takes the date attribute of a file when it was created and appending it to the name. I'm pretty close to what I need, but the date appears in yyyy-mm-dd format and I want it to read mm-dd-yyyy. What I have done so far is something like
for ((i=1;i<=50;i++));
do fdate=`stat -c %y Video Snapshot $i.png|awk {'print$1'}`;
newname=Personname-$fdate-$i.png;
mv Video Snapshot $i.png $newname;
done
This works decently but the date comes out in the yyyy-mm-dd format. How do I change it?
View 10 Replies
View Related
Jan 9, 2010
I have a script that presents download link, but it shows download links in one line.How do I get it to show each link in its own line?
my $message_text =
join "
",
[code]...
View 9 Replies
View Related
Nov 24, 2010
I have a serial port program which is reading a string .if(read(readfd,sResult,1)>0)where sResult is unsigned char sResult[10];if sResult is array of 10 then iam getting string perfectly but if iam making sResult only as unsigned char I am getting NULL value CODE BELOW
Code:
unsigned char sResult;
main()
{
readfd = open("/dev/ttyUSB0", O_RDONLY);
if (readfd == -1)
{
perror("READ: open_port: Unable to open /dev/ttyUSB0-
[Code]...
View 2 Replies
View Related
May 28, 2011
I updated to current, which includes perl 5.14.0. In updating to the latest DateTime module (0.70) via cpan, I receive this:
Code:
Lots of them. The same error occurs when 'make test'ing manually from the DateTime tarball. I see that DateTime 0.70 has been reported to be OK with 5.14.0 on linux (in fact, there are no fails for it). I uninstalled perl, removed all the perl5 directories, reinstalled it, upgraded all the default modules. DateTime still fails like this. Maybe current's perl has been compiled with different options?
View 14 Replies
View Related
Sep 13, 2010
I want normal substring of a string that actually is a url as follows
SITEURL/main.php?page=122&type=download_file&fileID=9&user Id=user1&org=org1&mainmenu=main1&submenu=sub1
What I want is a substring like below
org1_user1_main1_sub1
View 5 Replies
View Related
Dec 8, 2010
Which effect does the $ before the string have? This $ before a double-quoted string is used in many initscripts on Fedora 13, but not on Ubuntu 8.04.
View 2 Replies
View Related
Sep 20, 2009
I'm having problems completing my school exercises with awk.
Heres the desired outcome:
Code:
./my_awk 2
ACG GAG ATT AGG AGG ATC CCA CCA
CAC AGG ACG GAG ATT AGG AGG ATC
So it generates data in group of threes, 8 groups per row and prints it. My problem is that I can't seem to get awk to append stuff to string so I could print it nicely to screen. It just prints empty lines per the parameter given to it.
Heres my code so far:
Code:
#!/bin/sh
awk -v rows=$1 '
BEGIN {
[code]....
View 2 Replies
View Related
Jul 6, 2010
Iam trying to check a value less than or equals 0.The value iam getting is after doing grep a file . but its throwing error .
Code:
When i execute this it throws
Code:
View 8 Replies
View Related
Dec 27, 2008
I need to extract a price from a string, this may vary in the future so it may be 12.99 or 14.99. i thought a sed command might crack it and i need to write to a file:<td><b class="priceLarge">?6.99</b>I need to extract the price 6.99(with no ?)so extract anyhting between "> and </B> and write it to a file such as tmp1.txt .
View 1 Replies
View Related
Oct 23, 2010
i am compiling the following program in linux. it's in c language. after the compilation with gcc when i run the executable file. it asks for input. but when i enter a name. i prints "Segmentation fault" and then terminate the program. can you please help me.
#include <stdio.h>
#include <ctype.h>
#include <stdlib.h>
#include <unistd.h>
[code]....
View 1 Replies
View Related