strdate=15/06/2010
DateTime dt = DateTime.Parse(strdate, System.Threading.Thread.CurrentThread.CurrentCulture.DateTimeFormat);
i cannot able to get the datetime value as dd/mm/yyyy.
it is giving exception 'string is not recognized as a valid datetime'
oly if it is in 06/15/2010 it is working. how to get the same format in dt.
So i'd like to do this:
switch (keyPath) {
case @"refreshCount":
//do stuff
case @"timesLaunched":
//do other stuff
}
but apparently you can only use integers as the switch quantity. Is the only way to do this parse the string into an integer identifier and then run the switch statement?
like this:
nsinteger num = nil;
if (keyPath isEqual:@"refreshCount") {
num = 0
}
if (keyPath isEqual:@"timesLaunched") {
num = 1
}
I'm trying to optimize this code to be as quick as possible because its going to get called quite often.
thanks,
Nick
Hello,
I have this string: '30/05/2010', and I would like to enter it to a smallDatetime field.
In the database it should look something like this 2010-05-30 15:33:25
Any Idea how?
TY
Hello guYz plz help me out in making it possible to open the files by the adress provided in an array of strings.........
a way to open file is as given below...
ifstream infile;
infile.open("d:\aslam.txt");
but how can i open file providing an array of string as an adress of file.....
like this
infile.open(arr[i]); (but its not working)
plz help me.........
Intention is to take a current line which contains commas, store trimmed values of all space and store the line into the array.
Why does this not work?
String[] currentLineArray = currentInputLine.replace("\\s", "").split(",");
I am very much new to android so need some good help with a code example.
I am getting a date in form of string from a server in the following format
2012-08-17 00:00:00
I want to compare this string with current date to find the difference between the dates in the form of year, months and days...
I tried playing around it in the following code
Date currentDate = new Date(System.currentTimeMillis());
Log.v("@@@@@@@@@","Current Date: " + currentDate);
Date passDate = new SimpleDateFormat().parse(passDateString);
Log.v("@@@@@@@@@","Pass Date: " + passDate);
dateDifference = passDate.compareTo(currentDate);
but it returned with following exception
04-15 12:08:29.101: V/@@@@@@@@@(1161): Current Date: Sun Apr 15 12:08:29 GMT+01:00 2012
04-15 12:08:29.101: W/System.err(1161): java.text.ParseException: Unparseable date: 2012-08-17 00:00:00
04-15 12:08:29.111: W/System.err(1161): at java.text.DateFormat.parse(DateFormat.java:645)
04-15 12:08:29.111: W/System.err(1161): at org.apis.PassesListItemAdapter.getView(PassesListItemAdapter.java:77)
04-15 12:08:29.111: W/System.err(1161): at android.widget.AbsListView.obtainView(AbsListView.java:1315)
04-15 12:08:29.111: W/System.err(1161): at android.widget.ListView.makeAndAddView(ListView.java:1727)
04-15 12:08:29.111: W/System.err(1161): at android.widget.ListView.fillDown(ListView.java:652)
04-15 12:08:29.111: W/System.err(1161): at android.widget.ListView.fillFromTop(ListView.java:709)
04-15 12:08:29.111: W/System.err(1161): at android.widget.ListView.layoutChildren(ListView.java:1580)
04-15 12:08:29.111: W/System.err(1161): at android.widget.AbsListView.onLayout(AbsListView.java:1147)
04-15 12:08:29.111: W/System.err(1161): at android.view.View.layout(View.java:7034)
04-15 12:08:29.111: W/System.err(1161): at android.widget.RelativeLayout.onLayout(RelativeLayout.java:909)
04-15 12:08:29.111: W/System.err(1161): at android.view.View.layout(View.java:7034)
04-15 12:08:29.111: W/System.err(1161): at android.widget.FrameLayout.onLayout(FrameLayout.java:333)
04-15 12:08:29.111: W/System.err(1161): at android.view.View.layout(View.java:7034)
04-15 12:08:29.111: W/System.err(1161): at android.widget.FrameLayout.onLayout(FrameLayout.java:333)
04-15 12:08:29.111: W/System.err(1161): at android.view.View.layout(View.java:7034)
04-15 12:08:29.111: W/System.err(1161): at android.view.ViewRoot.performTraversals(ViewRoot.java:1049)
04-15 12:08:29.111: W/System.err(1161): at android.view.ViewRoot.handleMessage(ViewRoot.java:1744)
04-15 12:08:29.111: W/System.err(1161): at android.os.Handler.dispatchMessage(Handler.java:99)
04-15 12:08:29.111: W/System.err(1161): at android.os.Looper.loop(Looper.java:144)
04-15 12:08:29.111: W/System.err(1161): at android.app.ActivityThread.main(ActivityThread.java:4937)
04-15 12:08:29.111: W/System.err(1161): at java.lang.reflect.Method.invokeNative(Native Method)
04-15 12:08:29.111: W/System.err(1161): at java.lang.reflect.Method.invoke(Method.java:521)
04-15 12:08:29.111: W/System.err(1161): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
04-15 12:08:29.111: W/System.err(1161): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
04-15 12:08:29.111: W/System.err(1161): at dalvik.system.NativeStart.main(Native Method)
I am stuck... please help
Raj
Hi all.I am trying to get date format from Day name and time like "Monday" and second string "08:15" and it must like 10:05:2010 08:15 and then I will make subtracting from date of today. DateTime.Parse("08:15") it works but it outputs todays date. I want to get date of day name. I also usedDateTime.Parse("08:15").AddDays(1)it gaves me next days date.Here I want to get date of next Monday with and "08:15" time.
Is there any alternative to this:
Organizations.Include("Assets").Where(o => o.Id == id).Single()
I would like to see something like:
Organizations.Include(o => o.Assets).Where(o => o.Id == id).Single()
to avoid the hard-coded string "Assets".
Using Python I need to delete all charaters in a multiline string up to the first occurrence of a given pattern. In Perl this can be done using regular expressions with something like:
#remove all chars up to first occurrence of cat or dog or rat
$pattern = 'cat|dog|rat'
$pagetext =~ s/(.*?)($pattern)/$2/xms;
What's the best way to do it in Python?
How can we get the numbers 7 and 4 and 5 from the following string:
MODULE potmtpMAIN main
<info: "Enterprise Optimizer 7.4 for COR Technology 5.5 -- Advanced Solver Edition", url:"http://EO.riverlogic.com", url_menu:"EO Online...", app_id:"EOAS",app_name:"Enterprise Optimizer AS", **app_major:7**, **app_minor:4**,**app_micro:5**,app_copyright:"\251 1996-2010 River Logic Inc.\r\nAll Rights Reserved.">
Thank You in advance
for(int i = 1;i<100;i++)
string strI = i.tostirng();
in here, if i is 1 then strI is '1'
But I want to get '01'
or '001'
it looks quite easy. but there's only article about datetime.tostring("yyyy-MM-dd") :(
Hi,
How can i print only certain words from a string in python ?
lets say i want to print only the 3rd word (which is a number) and the 10th one
while the text length may be different each time
mystring = "You have 15 new messages and the size is 32000"
thanks.
In python:
s = '1::3'
a = s.split(':')
print a[0] # '1' good
print a[1] # '' good
print a[2] # '3' good
How can I achieve the same effect with zsh?
The following attempt fails:
s="1::3"
a=(${(s/:/)s})
echo $a[1] # 1
echo $a[2] # 3 ?? I want an empty string, as in Python
folks, i have a string like
AxxBCyyyDEFzzLMN
I want to replace all x and y and z with _ so that the output is
A_BC_DEF_LMN
How to do that?
I know a series of tr 'x' '' | tr 'y' '' will work, but I want to do taht in one go, without using pipes
thanks in advance
I have a client who is wanting to create a link which contains product codes so that his customers hit a page with just those products displayed in an attempt to increase conversion rates from affilliate sites.
My question is whats the best way to send these multiple products in a single URL
For example:
http://www.mydomain.co.uk/bespoke-list.php?catNo=234-324-232-343
Obviously then the site would grab the codes from the string and display them...
We're going to be using PHP!
Thanks in advance.
The post office actually publishes a list of commonly used street suffixes in addresses:
http://www.usps.com/ncsc/lookups/abbr_suffix.txt
I want to take this list and make a ruby function that takes a string, takes the last word ("183 main strt".split[' '].last) and if it matches any of the commonly used street suffixes ("strt"), replace it with the official Postal Service Standard Suffix ("st").
Is there a better way to approach this than a massive str.sub.sub.sub.sub.sub?
var_dump('<a>')
// or
var_dump("<a>")
// or
var_dump("\x3Ca>")
// all result in
string(3) ""
What is going on? Only putting a space after the less-than sign works for me.
PHP Version 5.2.10-2ubuntu6.4
I want to convert an int to a string but if it is a single digit I want to add a leading 0
Is that one of the built in format options? or do I have to do it manually?
I have a list of
uids: ['1234','4321','1111']
and I would like to turn this into a single string of:
"uid = '1234' OR uid = '4321' OR uid = '1111'"
What's the most efficient way to do this?
Thanks!
I'm new to java and i'm trying to find a way of incrementing through an user input IP address range.
For example from 192.168.0.1 to 192.168.0.255. However the way my application works at the moment is the take the from and to ip addresses as a String.
Is there a way I can increment through all the ip addresses the user input from and to?
Hope this makes sense and please dont flame me, I have looked for an answer!