Browsing 7239 questions and answers with Jon Skeet

Change server time to local time that is sent by Facebook

I am using Facebook C# SDK to get some data from my Facebook page. When I get objects of data, at that time I get one field: created_time : 2014-05-23T11:55:00+0000 As it is...
Jon Skeet
people
quotationmark

I would use DateTimeOffset.ParseExact, specifying the format string an the invariant culture: DateTimeOffset value = DateTimeOffset.ParseExact(text, "yyyy-MM-dd'T'HH:mm:ssK", ... more 5/23/2014 1:04:37 PM

people

Oracle JDBC PreparedStatement method call via Reflection fails

I'm using the standard Oracle JDBC Driver (JDK6 Thin Driver) and attempting to call a method on PreparedStatement via Reflection. I can call the method directly, but when I...
Jon Skeet
people
quotationmark

I believe the problem is that you're trying to use a method which you've asked for via a class you don't have access to. That apparently implicitly limits the method's visibility, even though the method itself is public. Here's a similar... more 5/23/2014 12:46:34 PM

people

what are invalid character for anchor tag

my application was developed in asp.net mvc 4. we have list of jobs. now we have allowed all special characters in job name, but </ characters causes issue in creating...
Jon Skeet
people
quotationmark

If you mean for the display part of the anchor tag, everything should be fine - you should be getting ASP.NET MVC to perform any escaping required to represent your text properly in HTML, e.g. using @Html.AnchorLink(...). It's far better... more 5/23/2014 12:23:29 PM

people

Xamarin Multiple HTTP Requests slow down the app

I'm using Xamarin to develop an iOS app. One of the features is to download videos in hls format which means that each video can have between 100 to 1000 chunks to download. So I...
Jon Skeet
people
quotationmark

There are two many problems with the current code: It's inefficient in terms of reading the data It's synchronously writing the data, which is obviously a problem if you're on the UI thread The "write the data asynchronously" is... more 5/23/2014 9:51:04 AM

people

Lambda expression with empty paren ()

I came across code like: var vpAlias = null; var prices = session.QueryOver<Vehicle>() .Left.JoinAlias<VehiclePrice>(x => x.VehiclePrice, () => vpAlias, x...
Jon Skeet
people
quotationmark

It just means it's an empty parameter list - for delegate types which don't have any parameters. The fact that you can write x => x.Id is really just a shorthand for (x) => x.Id which is in turn a shorthand for (Vehicle x) =>... more 5/23/2014 9:01:49 AM

people

Format Date according to locale and then get the date part

What I want to achieve is to convert a date in format yyyyMMdd to locale format i.e yyyy/MM/dd or dd/MM/yyyy etc. I am not interested in the time part, I just require date. The...
Jon Skeet
people
quotationmark

It sounds like you've already got the parsing part sorted - that's entirely separate from the formatting part. For formatting, I suspect you want: DateFormat localeFormat = DateFormat.getDateInstance(DateFormat.MEDIUM, locale); String... more 5/23/2014 8:03:32 AM

people

How do I create the java date object without time stamp

I want to create a Date object without a TimeZone (eg : 2007-06-21). Is this possible? When I use the following method it prints like Thu Jun 21 00:00:00 GMT...
Jon Skeet
people
quotationmark

If you want to format a date, you need to use DateFormat or something similar. A Date is just an instant in time - the number of milliseconds since the Unix epoch. It doesn't have any idea of time zone, calendar system or format. The... more 5/23/2014 5:50:24 AM

people

substring from specific point of the string(from reverse side )

I wanted to substring from special point. abcdef.png I want .png Here i tried string str = "abcdef.png"; str = str.Substring(0, str.Length - 4); but then...
Jon Skeet
people
quotationmark

Just use the overload which takes a single parameter - the start point: str = str.Substring(str.Length - 4); Or better, use a method designed to get the extension of a filename - Path.GetExtension: string extension =... more 5/22/2014 6:59:38 PM

people

What is the purpose of a closed constructed type?

I'm studying generics types in C#, and I have found this MSDN article http://msdn.microsoft.com/en-us/library/sz6zd40f.aspx about generic classes. Almost everything is OK, but I...
Jon Skeet
people
quotationmark

Well, this is certainly an odd declaration: internal class SubclaseGenerica<T> : ClaseBase <long> { } In this case, it's a generic type - so it's declaring a new type parameter T. However, it's supplying a type argument of... more 5/22/2014 6:48:35 PM

people

How do I reference a DLL in a .net script without Visual Studio

How do I reference a DLL in a C# script? I'm not using Visual Studio, I'm just using NPP with a C# plugin to write a quick one file script. That script needs to reference a third...
Jon Skeet
people
quotationmark

Now we know the plugin you're using, it's easy. Just read the documentation on "Using .NET assemblies". In particular, it sounds like you want: //css_reference iTextSharp.dll; That's assuming the library is one of the locations CSScript... more 5/22/2014 6:42:28 PM

people