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:

Friday, April 19, 2013

Sencha app upgrade from 2.0.1 to 2.1.1


Sencha has changed the way the application gets launched. 
In 2.0.1, the app.js is new an object:
new Ext.Application({
    launch: function() {
        new Ext.Panel({
            fullscreen: true,
            dockedItems: [{xtype:'toolbar', title:'My First App'}],
            layout: 'fit',
            styleHtmlContent: true,
            html: '<h2>Hello World!</h2>I did it!'
        });
    }
});

while in 2.1.1, it just calls a method
Ext.application({
        launch: function () {
            Ext.create('Ext.Panel', {
                fullscreen: true,
                html: 'Hello World!'
            });
        }
    });

If you take a Sencha 2.0.1 app and upgrade it to 2.1.1, then you will need to update the related code to make it work properly.
Posted by Jonathan Li at 11:11 AM No comments:

Tuesday, April 2, 2013

ASP.NET oData tutorial with Web API

Microsoft finally realizes it needs to provide some clean and simple functions to support developers, instead of leaving everything in developer's hands. To see a sample of this, just opening the IIS manager, the 40+ icons will make you feel you need to be a pilot in order to drive a car.
Web API is in the right direction to make things simple, and hope it can keep what it promised. The following are some steps for me to make the ASP.NET Web API oData tutorial work.
1. Install Visual Studio 2012 profiession.
2. Apply Visual Studio update 1
3. Apply Web Tool for Visual Studio 2012.2
4. Get Microsoft ASP.NET Web API OData NuGet package by console command (Why no a GUI tool, is console back in fashion?): "Install-Package Microsoft.AspNet.WebApi.OData"
5 In ProductsController.cs add using System.Web.Http.OData;
6. In WebApiConfig.cs, add using System.Web.Http.OData.Builder;
Now you should be able to build the project. From browser, navigate to the following link to show the sample data.
http://localhost:58478/oData/Products


Posted by Jonathan Li at 12:53 PM No comments:
Newer Posts Older Posts Home
Subscribe to: Posts (Atom)

Followers

About Me

Jonathan Li
View my complete profile

Blog Archive

  • ▼  2026 (1)
    • ▼  January (1)
      • Java SDK version specified in pom.xml for maven pr...
  • ►  2025 (6)
    • ►  December (1)
    • ►  October (1)
    • ►  September (1)
    • ►  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)
    • ►  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.