Java Date Long to C# Datetime
static DateTime JavaLongToCSharpLong(long javaLong)
TimeSpan ss = TimeSpan.FromMilliseconds(javaLong*1000);
DateTime Jan1st1970 =
new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc);
DateTime ddd = Jan1st1970.Add(ss);
DateTime final = ddd.ToUniversalTime();
C# Datetime to Java Date Long
static long CSharpMillisToJavaLong(DateTime dateTime)
DateTime Jan1st1970 =
new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc);
long diff =
(long)(dateTime.ToUniversalTime() - Jan1st1970)
return diff / 1000;
source: Java Date long to C# Datetime long
This is a legacy code snippet.
CString line = _T("first;second;third");
for (int nIndex=0; AfxExtractSubString(field, line, nIndex, ';'); nIndex++)
fields.Add( field );
Thanks to this and this.
- AppHarbor – Azure Done Right AKA Heroku for .NET – Instant deployments and instant scaling. Stupid simple API. This is Heroku. It doesn’t sound like much, but when you think of how fast you can go from an idea to having someone else tinker with it, you can start to see its power. In literally seconds you can be looking at your rails application deployed and online. Then when you are ready to scale, you can do that. This is power. I’m not sure when I first heard about AppHarbor as a possible .NET version of Heroku. AppHarbor is awesome! It still has a ways to go to be considered Heroku for .NET, but it already has a growing community.
- My 25 Favorite Programming Quotes that are Funny too – Recently I was looking for some good programming quotes for one of my presentation. I was amazed to find that there are some good programming quotes that are really funny and need some brains to figure out the fun part. Here are 25 of them I like in random order.
- Inversion of Control : Practical usage of Interface, Delegate or Events – Inversion of control is an architectural design principle which modifies the general flow of control of a program. Inversion of control is a special circumstance where you will invert the predefined control flow to some arbitrary call defined way down the stream by the user who actually using the component. In this post, I will show you how you can implement inversion of control in your code and also approaches which help you while implementing your own class.
- openredis – Redis Hosting Service – Redis is awesome. While it’s a perfect fit for many applications, just a few of them are using it. We want to help startups and small to medium sized businesses easily get up and running with Redis, without the hassle of setting up backups, monitoring and replication.
- RazorEngine – A templating engine built upon Microsoft’s Razor parsing technology. The RazorEngine allows you to use Razor syntax to build robust templates. Currently we have integrated the vanilla Html + Code support, but we hope to support other markup languages in future.
- The 7 deadly sins of software development – Being a good developer takes a lifetime of training and practice. But without proper discipline, even the best programmers risk falling prey to their worse natures. Some bad habits are so insidious that they crop up again and again, even among the most experienced developers. I speak of nothing less than the seven deadly sins of software development.
- ILSpy – is the open-source .NET assembly browser and decompiler. Development started after Red Gate announced that the free version of .NET Reflector would cease to exist by end of February 2011.
User Interface, User Experience
- Beginner’s Guide to Landing Pages on KISSmetrics – A well-designed landing page can greatly increase conversions for your PPC or email marketing campaigns. Rather than directing visitors from those sources to your general website (where they may have a hard time finding what they’re looking for), you can direct them to a specially-designed landing page that steers them in exactly the direction you want them to take.
- Landing Page Best Practices: the definitive guide (with infographics) – We (at Visual Website Optimizer) are starting a series on the blog where the experts in A/B testing, landing pages, conversion rate optimization will share everything they know about how to increase sales and conversions online.
- Responsive Web Design: What It Is and How To Use It – Responsive Web design is the approach that suggests that design and development should respond to the user’s behavior and environment based on screen size, platform and orientation. The practice consists of a mix of flexible grids and layouts, images and an intelligent use of CSS media queries. As the user switches from their laptop to iPad, the website should automatically switch to accommodate for resolution, image size and scripting abilities. In other words, the website should have the technology to automatically respond to the user’s preferences. This would eliminate the need for a different design and development phase for each new gadget on the market.
- Fight Div-itis and Class-itis With the 960 Grid System – The 960 Grid System encourages the addition of <div> elements and class attributes, especially on complicated pages. Is this really an improvement over nested tables? Creating cleaner code means going beyond the framework and thinking about what it really represents.
- 100+ free HTML email templates – For too long HTML email has been the ugly step-child of the web. It’s time for a change, so we teamed up with some seriously talented designers to bring their skills to the world of HTML email. Every template has been thoroughly tested in more than 20 of the most popular email clients like Outlook 2010, Gmail, Lotus Notes, Apple Mail, the iPhone, and more. They’re ready to roll and are completely free.
- Creating a NuGet Package in 7 easy steps – Plus using NuGet to integrate ASP.NET MVC 3 into existing Web Forms applications – Last month I (Scott Hanselman) wrote a post called Integrating ASP.NET MVC 3 into existing upgraded ASP.NET 4 Web Forms applications where I showed a very manual and very painful way to add ASP.NET MVC support to an existing ASP.NET WebForms application. You’d then have a lovely hybrid that is both MVC and WebForms.
- Integrating jQuery DataTables plugin into ASP.NET MVC applications – JQuery DataTables plugin is an excellent client-side component that can be used to create rich-functional tables in the web browser. This plugin adds lot of functionalities to the plain HTML tables that are placed in web pages such as filtering, paging, sorting, changing page length etc. By default it works with client side rows that are rendered in table (in <tbody> </tbody> section in the HTML code of the table) but it might be configured to use data from the server via Ajax calls. However, to integrate DataTables with server-side code developer must know protocols and parameters that are sent by DataTables and how to use them on server side. This article shows how JQuery DataTables plugin can be integrated into ASP.NET MVC application. It contains step by step examples that show how DataTables plugin interacts with server-side components.
- Synchronicity – A Folder Synchronizing Application – I needed an app that would sync up folders that didn’t involve anything more tedious than just copying the files somewhere. Yes, I’m aware of programs like Microsoft Sync Toy and a third-party product called Sure-Sync, but being a programmer, I figured this would be a fairly straightforward application to write myself. After all, it doesn’t have to be battle-tested for public consumption, and I wanted a certain degree of control over precisely how it works. Besides, it’s more fun to write code than it is to install someone else’s. This article (and the code it describes) is the result.
- SharpPcap – A Packet Capture Framework for .NET – Packet capturing (or packet sniffing) is the process of collecting all packets of data that pass through a given network interface. Capturing network packets in our applications is a powerful capability which lets us write network monitoring, packet analyzers and security tools. The libpcap library for UNIX based systems and WinPcap for Windows are the most widely used packet capture drivers that provide API for low-level network monitoring. Among the applications that use libpcap/WinPcap as its packet capture subsystem are the famous tcpdump and Wireshark. In this article, we will introduce the SharpPcap .NET assembly (library) for interfacing with libpcap or winpcap from your .NET application and will give you a detailed programming tutorial on how to use it.