1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
********************
****讀取ini file****
********************
function getinit(mfilename,msection,mentry)
local lcinifile,lcvalue,lcbuffer,luentryvalue,lnnumbytes

*-- DECLARE DLL statements for reading/writing to private INI files
declare integer GetPrivateProfileString in Win32API ;
string cSection, string cKey, string cDefault, string @cBuffer, ;
integer nBufferSize, string cINIFile

local minivalue, mresult, mbuffersize
mbuffersize = 255
minivalue = spac(mbuffersize)
mresult=getprivateprofilestring(msection,mentry,"*NULL*",@minivalue,mbuffersize,mfilename)
minivalue=substr(minivalue,1,mresult)
if minivalue="*NULL*"
minivalue=.null.
endif
return minivalue
endfun

demo config ini file

1
2
[section]
entryName=return value

- connection retry policy
- works great with async
- four modes
    - DefaultExcutionStrategy
    - DefaultSqlExecutionStrategy
    - DbExecutionStrategy
    - SqlAzureExecutionStrategy
- throws RetryLimitExceededException

##Configuration

1
2
3
4
5
6
7
8
public class MyConfiguration : DbConfiguration 
{
public MyConfiguration()
{
SetExecutionStrategy("System.Data.SqlClient",
() => new SqlAzureExecutionStrategy(1, TimeSpan.FromSeconds(30)));
}
}

MSDB

參考網址

when use vs2013 deploy website to azure.

error message

1
The type initializer for 'Microsoft.Web.Microsoft.Web.Deployment.DeploymentManager' threw an exception.  The type initializer for 'Microsoft.Web.Microsoft.Web.Deployment.BuiltinTypesCache' threw an exception.

fix:

uninstall dbsqlpackage provider . this packages no longer support.

取得最新的Mono http://www.mono-project.com/download/

Building Mono From a Git Source Code Checkout

To build Mono in 64 bit mode instead use:

1
2
3
4
5
6
PATH=$PREFIX/bin:$PATH
git clone https://github.com/mono/mono.git
cd mono
./autogen.sh --prefix=$PREFIX --disable-nls
make
make install

經過一段時間的實驗. 在別的framework找到可以讓backend的route支援angular html5mode了. 基本方式是如果我路由規則沒有定義的,全部指向index頁面(有ng-view的)

所以基於這個原則. mvc的路由規則就要稍微調整一下. 將原本的DefaultApp修改一下

1
2
3
4
5
6
7
8
9
10
11
12
// 舊
routes.MapRoute(
name: "DefaultApp",
url: "{controller}/{action}/{id}",
defaults: new { controller = "Home", action = "Index", id = UrlParameter.Optional }
);
// 新
routes.MapRoute(
name: "DefaultApp",
url: "app/{controller}/{action}/{id}",
defaults: new { controller = "Home", action = "Index", id = UrlParameter.Optional }
);

然後新增

1
routes.Add(new SingleRoute());

SingleRoute Class

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
public class SingleRoute : RouteBase
{
public override RouteData GetRouteData(HttpContextBase httpContext)
{
var data = new RouteData(this, new MvcRouteHandler());
data.Values.Add("controller", "Home");
data.Values.Add("action", "Index");
return data;
}

public override VirtualPathData GetVirtualPath(RequestContext requestContext, RouteValueDictionary values)
{
return null;
}
}

Client angular side:

1
2
3
4
5
6
7
$stateProvider
.state('state1', {
url: "/state1",
templateUrl: "app/Home/state1" <= mvc route rule
})
$locationProvider.html5Mode(true).hashPrefix('!')

以上

HTML裡有也Element是沒有辦法focus, 原因是因為它們預設的tabindex是-1 所以要讓他們能focus, 只要改變tabindex=0. 就可以了

1
<span tabindex=0>something</span>

when use ngCordova socialSharing plugin. there is a method 『canShareVia』 which can share to specific social application by it’s appPackageName.

To Line(http://line.me) the packageName is jp.naver.line.android

1
2
3
4
var lineAppPackageName = 'jp.naver.line.android';
$cordovaSocialSharing
.shareVia(lineAppPackageName, content, subject, null, '')
...

Response::Download() in Laravel 4.x needs php_fileinfo extension. Sometimes web hosting server doesn’t have that extension on, althought it’s default for php 5.4.

so the way to work around is make a response, and add header to it. See code below

1
2
3
4
5
$file = File::get($filepath);
$response = Response::make($file, 200);
$response->header('Content-Type', $item->mime);
$response->header('Content-Disposition','attachment;filename="'.$filename.'"');
return $response;

之前有寫過一篇有關[Laravel] Laravel with Angular, 但是這個方法在Laravel 5.0裡面是不合用的

所以laravel 5.0的作法如下 在 app/Exceptions/Handler.php 裡修改render function

1
2
3
4
5
6
public function render($request, Exception $e)
{
if ($e instanceof \Symfony\Component\HttpKernel\Exception\NotFoundHttpException)
return response()->view('index')->header('Content-Type', 'text/html');
return parent::render($request, $e);
}

這個效果等於laravel 4.x的app::missing

0%