Jonathan Li

There are lots of helpful information available on internet, so just share some notes I found useful during application development, to contribute back to the community. Jonathan in Toronto

Monday, May 27, 2013

What Array.prototype.slice.call(arguments) does in javascript

Why using Array.prototype.slice.call(arguments) in javascript? Basically it is used to convert multiple arguments into a single argument in array type, as the some js method may only accept one argument instead of several arguments.

for example:
func2(arg){
  console.log(arg);
}

func1(arg1, arg2, arg3)
{
   arg = Array.prototype.slice.call(arguments);
   func2(arg);
}

It can be understood as the following conversion:
    Array.prototype.slice.call(arguments);
==  Array.prototype.slice(arguments[1], arguments[2], arguments[3], ...)
==  [ arguments[1], arguments[2], arguments[3], ... ]
Posted by Jonathan Li at 8:38 PM No comments:

Monday, May 20, 2013

About XCode project, target, build settings and schema

A target uses build settings to build the output. Targets in a project inherits build settings if it does not specify a build setting. Project have debug or release build settings. Schema is a selection of specifying which target  and which build configuration to build, and on which platform (device or simulator) to run. So schema is a configuration for user operation, it is not a project settings.

A project defines default build settings for all the targets in the project (each target can also specify its own build settings, which override the project build settings). In project-level build configurations. You can specify more than one build configuration for a project; for example, you might have debug and release build settings for a project.

A target inherits the project build settings, but you can override any of the project settings by specifying different settings at the target level. There can be only one active target at a time; the Xcode scheme specifies the active target. Each target can specify its own source file to build.


You can specify build settings at the project or target level. Each project-level build setting applies to all targets in the project unless explicitly overridden by the build settings for a specific target.
Each target organizes the source files needed to build one product. A build configuration specifies a set of build settings used to build a target's product in a particular way. For example, it is common to have separate build configurations for debug and release builds of a product.

An Xcode scheme defines a collection of targets to build, a configuration to use when building, and a collection of tests to execute.
You use Xcode schemes to specify which target, build configuration, and executable configuration is active at a given time.



Posted by Jonathan Li at 8:47 AM No comments:

Sunday, May 19, 2013

Fix the cordova project compile error of unable to find

After creating a cordova project by using the create script provided by cordova download, when compile the project, an error may happen for "unable to find <Cordova/CDVViewController.h>.

If you just search the project, you will not be able to find the mentioned folder or file. That is expected, as xCode refers the dependency path based on application's built output's folder structure, not project's folder structure as visual studio. 

A easy way to fix the issue is doing a build first, and then open the build output folder in finder, 
For example, your XCode project may have set the preference\location\derived data\advanced...\build location to "legacy" instead of "unique", as that would make the main project fails to find the dependent build output, as cordovamay define its own ouput path and the application . Change it to unique should work. You can find the folder and file in the cordovalib' build output.
Posted by Jonathan Li at 9:25 AM No comments:

Wednesday, May 15, 2013

Force perforce to download the local deleted files

If a file was deleted locally, get latest version will not download it from perforce depot. To get the file from server, do the follows:


Use the "Get Revison..." option and enable the "Force Operation" option.

This will tell Perforce to downlaod all the files from depot.
Posted by Jonathan Li at 2:17 PM No comments:

Tuesday, May 14, 2013

Run .app file in ios simulator

In order to run an .app file in ios simulator, just goto ~/Library/Application Support/iPhone Simulator/6.1/Applications/ folder, and find any application in there that you do not need, then replace the existing .app file with the new .app file, optionally, also delete all files in Doucments and Library and tmp folder.
Restart the simulator, your .app file should be ready to run.
Posted by Jonathan Li at 12:39 PM No comments:
Newer Posts Older Posts Home
Subscribe to: Posts (Atom)

Followers

About Me

Jonathan Li
View my complete profile

Blog Archive

  • ►  2025 (3)
    • ►  March (1)
    • ►  February (2)
  • ►  2024 (2)
    • ►  March (2)
  • ►  2023 (1)
    • ►  June (1)
  • ►  2022 (7)
    • ►  August (1)
    • ►  July (1)
    • ►  June (2)
    • ►  January (3)
  • ►  2021 (15)
    • ►  December (4)
    • ►  November (2)
    • ►  October (2)
    • ►  September (4)
    • ►  July (1)
    • ►  January (2)
  • ►  2020 (23)
    • ►  December (2)
    • ►  November (1)
    • ►  September (3)
    • ►  August (2)
    • ►  July (5)
    • ►  June (4)
    • ►  May (2)
    • ►  April (1)
    • ►  March (1)
    • ►  February (1)
    • ►  January (1)
  • ►  2019 (38)
    • ►  November (4)
    • ►  October (5)
    • ►  September (1)
    • ►  August (9)
    • ►  July (4)
    • ►  June (3)
    • ►  May (6)
    • ►  April (3)
    • ►  March (1)
    • ►  January (2)
  • ►  2018 (42)
    • ►  December (2)
    • ►  November (7)
    • ►  October (1)
    • ►  September (3)
    • ►  August (3)
    • ►  July (2)
    • ►  May (5)
    • ►  April (5)
    • ►  March (5)
    • ►  February (4)
    • ►  January (5)
  • ►  2017 (40)
    • ►  December (3)
    • ►  November (5)
    • ►  September (2)
    • ►  August (1)
    • ►  July (5)
    • ►  June (4)
    • ►  May (3)
    • ►  April (1)
    • ►  March (9)
    • ►  February (3)
    • ►  January (4)
  • ►  2016 (27)
    • ►  November (5)
    • ►  October (2)
    • ►  September (5)
    • ►  August (1)
    • ►  April (4)
    • ►  March (4)
    • ►  February (5)
    • ►  January (1)
  • ►  2015 (35)
    • ►  November (3)
    • ►  October (4)
    • ►  September (6)
    • ►  August (3)
    • ►  July (2)
    • ►  June (3)
    • ►  May (6)
    • ►  April (2)
    • ►  March (2)
    • ►  January (4)
  • ►  2014 (45)
    • ►  December (2)
    • ►  November (5)
    • ►  October (5)
    • ►  September (7)
    • ►  August (4)
    • ►  July (4)
    • ►  May (5)
    • ►  April (6)
    • ►  March (1)
    • ►  February (2)
    • ►  January (4)
  • ▼  2013 (43)
    • ►  December (10)
    • ►  November (7)
    • ►  October (3)
    • ►  September (4)
    • ►  July (5)
    • ►  June (4)
    • ▼  May (5)
      • What Array.prototype.slice.call(arguments) does in...
      • About XCode project, target, build settings and sc...
      • Fix the cordova project compile error of unable to...
      • Force perforce to download the local deleted files
      • Run .app file in ios simulator
    • ►  April (2)
    • ►  March (2)
    • ►  February (1)
  • ►  2012 (16)
    • ►  November (3)
    • ►  October (5)
    • ►  September (1)
    • ►  July (2)
    • ►  May (2)
    • ►  April (1)
    • ►  March (1)
    • ►  February (1)
  • ►  2011 (34)
    • ►  November (3)
    • ►  October (2)
    • ►  September (2)
    • ►  June (2)
    • ►  May (1)
    • ►  April (4)
    • ►  March (9)
    • ►  February (9)
    • ►  January (2)
  • ►  2010 (12)
    • ►  December (7)
    • ►  November (4)
    • ►  June (1)
Simple theme. Theme images by gaffera. Powered by Blogger.