Convert UTC to local C-time

I am running an iOS app. I am getting the following string from a server method (getTimeUTC): 20140621-061250 How can I convert it to the local time? How can I define my date formatter? Is this correct? dateFormatter.dateFormat = @"YYYYMMd-HHmmss&quo

Print a mySQL query in a form

Sorry, newbie question I know, however I've currently got mySQL results only showing when using the echo command through PHP etc.. Now, I am able to source the information fine, however I would like the result of a query to show up in a form e.g. Rat

Inconsistent JMH flow rates when using parallel ()

I'm new to JHM, to test it out I wrote the following simple method @Benchmark @OutputTimeUnit(TimeUnit.SECONDS) public long sumPar(){ return LongStream.rangeClosed(1, LIMIT) .parallel() .sum(); } The results of the test varied greatly # JMH 1.10.3 (r

Process escape sequences in a string in Python

Sometimes when I get input from a file or the user, I get a string with escape sequences in it. I would like to process the escape sequences in the same way that Python processes escape sequences in string literals. For example, let's say myString is

Get period end time for a timestamp? (Round DateTime up)

I'm trying to create a function that returns the period ending datetime for a timestamp, for a given resolution. For example if the resolution is 10 minutes (stored as a TimeSpan) and my timestamp is 2012-08-14 12:34 the period ending time would be 2

Java Jpanel, can not set background color

I have a main class that extends a JFrame, which then adds a jpanel to the jframe. Then I try to set the background color of the jpanel, but to no avail. I'm not really sure where the problem is, according to what i've found on google, simply setting

ValueError: Invalid literal for int () with base 10: 'MSIE'

After I run my Python code on a big file of only HTTP headers, it gives me the above error. Any idea what that means? Here is a piece of the code: users = output.split(' ')[1] accesses = output.split(' ')[3] ave_accesses = int(accesses)/int(users) Ba

The compiler does not prevent loss of precision?

I have been playing around with C++11 lately, and came up with the following sum function: template <typename T> inline T sum(const std::function<T (int)> &f, int initial, int end) { T retval = 0; for(int k = initial; k <= end; k++) { r

Injected javascript does not execute

I'm trying to write a piece of javascript that integrates a webpage with an external system. Currently, what I have is a very small amount of code that dynamically inserts a script element into the page. $(document).ready(function() { var script = do

Perl-csv analysis - rearrange csv data when fields are dynamic

Using Perl, i need to parse and rearrange csv files that has some dynamic fields (devices and associated values) Here is the original csv (the header is here for description only) DISKBSIZE,sn_unknown,hostname,timestamp,origin-timestamp,sda,sda1,sda2

Are there good oracle podcasts?

Are there any good oracle podcasts around? The only ones I've found is produced by oracle corp, and as such are little more than advertising pieces pushing their technology of the moment. I'm specifically interested in Database technologies.Oracle Po

What is the difference between these dates where-clauses?

These two queries return different order counts and it's not entirely clear as to why. The first where clause is the accepted correct version: where year(OrderDate) = 2011 and MONTH(OrderDate) = 8 and DAY(OrderDate) = 3 but if I say something very si

iOS Application Metadata Rejected: MFi Certification PPID #

My iOS app has been rejected and I got the following message from Apple: ....... Reasons for Rejection: MFI Issue We started your review but cannot continue because we cannot locate your MFi Certificate PPID #. Please go to Manage Your Applications i

Static member variable when declared private

When a static member variable is declared private in a class, how can it be defined? Suppose i have the following class declaration class static_demo { private: static int a; public: static int b; void set(int x, int y) { a = x; b = y; } void show()

Wrapper for a C # command line tool

Using MSDN I got the class to write a wrapper for my command line tool. I now am facing a problem, if I execute the exe through the command line with arguments, it works perfect without any errors. But when I try to pass the arguments from the Wrappe

Use & ldquo; this & rdquo; referring to an anonymous delegate

How to use the this (or something of that kind) referring to the delegate instance instead of the class instance ? instance.OnEventFoo += delegate() { if (condition) { instance.OnEventBar += this; } }; Since you can't refer to a variable before it is

How to repair the width / height of the rotating img / div?

This example shows 2 div one without rotation the other with. The rotated image blocks the text. How do I rewrite this so the text isn't covered up? .Rotate { transform: translate(0, -100%) rotate(90deg); transform-origin: bottom left; } <div> <i

Dynamic DataGrid Headers

I've a problem where i need to get the total number of columns, which defines the total columns. Currently i have a function which dictates the header text on the DataGrid.columns. public static string ColumnHeader1 = Properties.Settings.Default.Colu

Have an error in my strings.xml file

<?xml version="1.0" encoding="utf-8"?> <resources> <string name="app_name">DataGush Alpha</string> <string name="action_settings">Settings</string> <string name="hello_wor

Multilingual sites using PHP and XML

I was asked to create a multilingual website in both English and Arabic languages and i have looked over the internet for samples or demos and didn't find yet i have found those ways, Create a directory for each one (Which i really didn't like) Use X

background of the selected option

I have this code here on jsfiddle for a select box: https://jsfiddle.net/v7tqumpe/1/ I want to be able to change the background color of a selected option. It defaults to blue, but I want to change this as well as the color of the text. After some se

Database for an online store

I'm about to make an online e-commerce site for selling some products like footwear,clothes etc. but I'm unable to figure out how to set up the schema for that (tables and all). I'm doing it in Ruby on Rails with Mysql and I'm newbie in ROR. Details

SQl queries do not match accurate results

I have been trying to join two tables (USERS AND USERS_ROLES) based on their role id I put the left join on following query users.id = users_roles.fk_user_id but the output is not correct of users_roles.fk_role_id coulmun and shows NULL where it shou

Check the password before decrypting

I'm writing small program (C++) to encrypt/decrypt files. Before decryption I would like to check if password given by user is correct. My idea: Add at the beginning of file some string (for example: "GOOD"); Encrypt file When decrypting first d