How to determine the current iPhone/device model?

How to determine the current iPhone/device model?

Is there a way to get the device model name (iPhone 4S, iPhone 5, iPhone 5S, etc) in Swift?I know there is a property named UIDevice.currentDevice().model but it only returns device type (iPod touch, iPhone, iPad, iPhone Simulator, etc).I a

How to pick an image from gallery (SD Card) for my app?

How to pick an image from gallery (SD Card) for my app?

This question was originally asked for Android 1.6.I am working on photos options in my app. I have a button and an ImageView in my Activity. When I click the button it would redirect to the gallery and I would be able to select an image. T

ROW_NUMBER() in MySQL

ROW_NUMBER() in MySQL

Is there a nice way in MySQL to replicate the SQL Server function ROW_NUMBER()?For example:SELECT col1, col2, ROW_NUMBER() OVER (PARTITION BY col1, col2 ORDER BY col3 DESC) AS intRowFROM Table1Then I could, for example, add a condit

How inject $stateProvider in angular application?

How inject $stateProvider in angular application?

I try to use angular-ui, and try to inject $stateProvider:html

Node.js Download File Using Content Disposition as Filename

Node.js Download File Using Content Disposition as Filename

I'm using the Request module to download files, but I'm not quite sure how to pipe the response to an output stream when the filename must come from the 'Content-Disposition' header. So basically, I need to read the response until the heade

How do I add months to a CURRENT_TIMESTAMP in SQL?

How do I add months to a CURRENT_TIMESTAMP in SQL?

How can I add months to the CURRENT_TIMESTAMP in SQL Server?The solution probably lies in DATEADD() but this works with a date only, not a datetime.Thanks. 1:This works perfectly fineSELECT DATEADD(month,1,CURRENT_TIMESTAMP)From DATEADD

Best way to store an array in MySQL database?

Best way to store an array in MySQL database?

Part of my app includes volume automation for songs.The volume automation is described in the following format:[[0,50],[20,62],[48,92]] I consider each item in this array a 'data point' with the first value containing the position in the so

How to subtract 4 months from today's date?

How to subtract 4 months from today's date?

I need to declare two dates in "Ymd" format: $toDate and $fromDate.$toDate represents today's date and $fromDate needs to be 4 months earlier than today.$toDate = Date('Ymd');$fromDate = ?How do I create $fromDate? 1:Use the magic of str

Data type conversion in MongoDB

Data type conversion in MongoDB

I have a collection called Document in MongoDB. Documents in this collection have a field called CreationDate stored in ISO date type. My task is to count the number of documents created per day and sort by the number asynchronously. The ou

What is the difference between destroy() and delete() methods in Laravel?

What is the difference between destroy() and delete() methods in Laravel?

I'm having a minor issue with Laravel 4. I'd like to use the delete() method on a record but for some reason it doesn't actually delete the record. destroy() does, though, so my code is good. Also, if I pass Teetime::where('date', '=', $for

Using sql date data type and EF4

Using sql date data type and EF4

I have a table w/ a sql date data type. When I look at the EDM markup, the storage element reflects this. The conceptual entity has a data type of DateTime (there doesn't appear to be a Date data type). When I call save changes and have a D

MySQL Nested Select Query?

MySQL Nested Select Query?

Ok, so I have the following query:SELECT MIN(`date`), `player_name`FROM `player_playtime`GROUP BY `player_name`I then need to use this result inside the following query:SELECT DATE(`date`) , COUNT(DISTINCT `player_name`)FROM `player_playt

Parsing non-zero padded timestamps in Python

Parsing non-zero padded timestamps in Python

I want to get datetimes from timestamps like the following :3/1/2014 9:55 with datetime.strptime, or something equivalent.The month, day of month, and hour is not zero padded, but there doesn't seem to be a formatting directive listed here

how to detect a mobile phone in a web application [closed]

how to detect a mobile phone in a web application [closed]

If a web application, how can you figure out the visitor is viewing from a mobile phone?is it also possible figure out the make/model like blackberry versus iphone? 1:You could check their User-Agent string. 2:Scott Hanselman did a po

Data Grid in PHP [closed]

Data Grid in PHP [closed]

I want to use data grid in php to fetch data from a store procedure. Please give me some implemented examples. how to use it in my projects.I am using mysql store procedures.Thanks 1:You can use http://phpgrid.com$dg = new C_DataGrid("SE

windows azure : set blob CORS properties using NodeJS

windows azure : set blob CORS properties using NodeJS

REST API has been released in february to set blob CORS property, but this hasn't been implemented for NodeJS yet.Since I need this feature, I tried to implement it in a module for my azure website running NodeJS.Based on REST API documenta

Doctrine DQL conditional query

Doctrine DQL conditional query

I'm trying to build a dynamic query with Doctrine's query builder. Let's say I'd also like to optionally select an end time in the following (only if one was entered). How would I add this conditionally to the statement? $query = $this->

How to setup timezone xampp mysql and apache?

How to setup timezone xampp mysql and apache?

I am using XAMPP - PHP and MYSQL servers. When I tried to use following - getRates(date('Y-m-d'));function getRates($cDate){$query = "SELECT * FROM randa WHERE date like '$cDate'" //it only worked at times. }?>Then I realized the date('

embed Javascript in .bat files

embed Javascript in .bat files

Is ther any way to execute javascript from a .bat file or embed the javascript in .bat file.I need a javascript code to write/read to a file in a local folder.This javascript i should be able to execute it using a .bat.Is it possible?.Thank

How can I get image created date time or last modified date time from iOS Photos (like camera roll)?

How can I get image created date time or last modified date time from iOS Photos (like camera roll)?

I am a new guy to iOS. Recently, I am developing an iOS application need to check image (in iOS Photos) created date time and modified date time to sort these images by time. I used ALAssetsLibrary to enumerate all images, i can get followi

NSString to NSDate conversion problem

NSString to NSDate conversion problem

I am having a NSString object which I am converting to NSDate with help of NSDateFormatter. Now code works fine here with all the OS but it is creating different Output at client's add (USA region).Here is the code that I am using.NSDateFor

Animate lines in a line graph with D3.js

Animate lines in a line graph with D3.js

I have my line graph, with 2 lines.Data to draw my line graph is pulled from a .csv file.Can anyone explain how I could start off with an empty graph, and when I click a button, my lines animate across the graph?Thanks in advance!! var b

How to set non-namespaced nil and datatype attributes in JAXB

How to set non-namespaced nil and datatype attributes in JAXB

I'm using JAXB with Scala, my marshalling code looks like this:def marshalToXml(): String = { val context = JAXBContext.newInstance(this.getClass()) val writer = new StringWriter context.createMarshaller.marshal(this, writer) writer.toS

Convert UNIX Time to mm/dd/yy hh:mm (24 hour) in JavaScript

Convert UNIX Time to mm/dd/yy hh:mm (24 hour) in JavaScript

I have been usingtimeStamp = new Date(unixTime*1000);document.write(timeStamp.toString());And it will output for example:Tue Jul 6 08:47:00 CDT 2010//24 hour timeScreen real estate is prime, so I would like to take up less space with the da