问:
Error displayed after adding link to sidebar in laravel
I was trying to add links to sidebar in laravel but I was getting this error message:

Whoops, looks like something went wrong.
3/3 ErrorException in UrlGenerator.php line 314: Route [stock-create] not defined. (View: C:\wamp\www\pump\core\resources\views\layouts\dashboard.blade.php) (View: C:\wamp\www\pump\core\resources\views\layouts\dashboard.blade.php)

```<code>in UrlGenerator.php line 314
at CompilerEngine->handleViewException(object(ErrorException), '1') in PhpEngine.php line 44
at PhpEngine->evaluatePath('C:\wamp\www\pump\core\storage\framework\views/d039c120d96bd9a07957a999c1ef8ecb9005ec81.php', array('__env' => object(Factory), 'app' => object(Application), 'errors' => object(ViewErrorBag), 'page_title' => 'Dashboard', 'site_title' => 'Petrol Pump', 'total_customer' => '22', 'total_machine' => '4', 'total_fuel' => '3', 'total_seller' => '2')) in CompilerEngine.php line 59
at CompilerEngine->get('C:\wamp\www\pump\core\resources\views/dashboard/dashboard.blade.php', array('__env' => object(Factory), 'app' => object(Application), 'errors' => object(ViewErrorBag), 'page_title' => 'Dashboard', 'site_title' => 'Petrol Pump', 'total_customer' => '22', 'total_machine' => '4', 'total_fuel' => '3', 'total_seller' => '2')) in View.php line 149
at View->getContents() in View.php line 120
at View->renderContents() in View.php line 85
at View->render() in Response.php line 53
at Response->setContent(object(View)) in Response.php line 201
at Response->__construct(object(View)) in Router.php line 1085
at Router->prepareResponse(object(Request), object(View)) in ControllerDispatcher.php line 95
at ControllerDispatcher->Illuminate\Routing\{closure}(object(Request))
at call_user_func(object(Closure), object(Request)) in Pipeline.php line 52
at Pipeline->Illuminate\Routing\{closure}(object(Request)) in Authenticate.php line 28
at Authenticate->handle(object(Request), object(Closure), 'admin')
at call_user_func_array(array(object(Authenticate), 'handle'), array(object(Request), object(Closure), 'admin')) in Pipeline.php line 136
at Pipeline->Illuminate\Pipeline\{closure}(object(Request))
at call_user_func(object(Closure), object(Request)) in Pipeline.php line 32
at Pipeline->Illuminate\Routing\{closure}(object(Request))
at call_user_func(object(Closure), object(Request)) in Pipeline.php line 103
at Pipeline->then(object(Closure)) in ControllerDispatcher.php line 96
at ControllerDispatcher->callWithinStack(object(DashboardController), object(Route), object(Request), 'getDashboard') in ControllerDispatcher.php line 54
at ControllerDispatcher->dispatch(object(Route), object(Request), 'App\Http\Controllers\DashboardController', 'getDashboard') in Route.php line 174
at Route->runController(object(Request)) in Route.php line 140
at Route->run(object(Request)) in Router.php line 724
at Router->Illuminate\Routing\{closure}(object(Request))
at call_user_func(object(Closure), object(Request)) in Pipeline.php line 52
at Pipeline->Illuminate\Routing\{closure}(object(Request)) in VerifyCsrfToken.php line 64
at VerifyCsrfToken->handle(object(Request), object(Closure))
at call_user_func_array(array(object(VerifyCsrfToken), 'handle'), array(object(Request), object(Closure))) in Pipeline.php line 136
at Pipeline->Illuminate\Pipeline\{closure}(object(Request))
at call_user_func(object(Closure), object(Request)) in Pipeline.php line 32
at Pipeline->Illuminate\Routing\{closure}(object(Request)) in ShareErrorsFromSession.php line 49
at ShareErrorsFromSession->handle(object(Request), object(Closure))
at call_user_func_array(array(object(ShareErrorsFromSession), 'handle'), array(object(Request), object(Closure))) in Pipeline.php line 136
at Pipeline->Illuminate\Pipeline\{closure}(object(Request))
at call_user_func(object(Closure), object(Request)) in Pipeline.php line 32
at Pipeline->Illuminate\Routing\{closure}(object(Request)) in StartSession.php line 64
at StartSession->handle(object(Request), object(Closure))
at call_user_func_array(array(object(StartSession), 'handle'), array(object(Request), object(Closure))) in Pipeline.php line 136
at Pipeline->Illuminate\Pipeline\{closure}(object(Request))
at call_user_func(object(Closure), object(Request)) in Pipeline.php line 32
at Pipeline->Illuminate\Routing\{closure}(object(Request)) in AddQueuedCookiesToResponse.php line 37
at AddQueuedCookiesToResponse->handle(object(Request), object(Closure))
at call_user_func_array(array(object(AddQueuedCookiesToResponse), 'handle'), array(object(Request), object(Closure))) in Pipeline.php line 136
at Pipeline->Illuminate\Pipeline\{closure}(object(Request))
at call_user_func(object(Closure), object(Request)) in Pipeline.php line 32
at Pipeline->Illuminate\Routing\{closure}(object(Request)) in EncryptCookies.php line 59
at EncryptCookies->handle(object(Request), object(Closure))
at call_user_func_array(array(object(EncryptCookies), 'handle'), array(object(Request), object(Closure))) in Pipeline.php line 136
at Pipeline->Illuminate\Pipeline\{closure}(object(Request))
at call_user_func(object(Closure), object(Request)) in Pipeline.php line 32
at Pipeline->Illuminate\Routing\{closure}(object(Request))
at call_user_func(object(Closure), object(Request)) in Pipeline.php line 103
at Pipeline->then(object(Closure)) in Router.php line 726
at Router->runRouteWithinStack(object(Route), object(Request)) in Router.php line 699
at Router->dispatchToRoute(object(Request)) in Router.php line 675
at Router->dispatch(object(Request)) in Kernel.php line 246
at Kernel->Illuminate\Foundation\Http\{closure}(object(Request))
at call_user_func(object(Closure), object(Request)) in Pipeline.php line 52
at Pipeline->Illuminate\Routing\{closure}(object(Request)) in CheckForMaintenanceMode.php line 44
at CheckForMaintenanceMode->handle(object(Request), object(Closure))
at call_user_func_array(array(object(CheckForMaintenanceMode), 'handle'), array(object(Request), object(Closure))) in Pipeline.php line 136
at Pipeline->Illuminate\Pipeline\{closure}(object(Request))
at call_user_func(object(Closure), object(Request)) in Pipeline.php line 32
at Pipeline->Illuminate\Routing\{closure}(object(Request))
at call_user_func(object(Closure), object(Request)) in Pipeline.php line 103
at Pipeline->then(object(Closure)) in Kernel.php line 132
at Kernel->sendRequestThroughRouter(object(Request)) in Kernel.php line 99
at Kernel->handle(object(Request)) in index.php line 54
</code>```

2/3 ErrorException in UrlGenerator.php line 314: Route [stock-create] not defined. (View: C:\wamp\www\pump\core\resources\views\layouts\dashboard.blade.php)

```<code>in UrlGenerator.php line 314
at CompilerEngine->handleViewException(object(InvalidArgumentException), '2') in PhpEngine.php line 44
at PhpEngine->evaluatePath('C:\wamp\www\pump\core\storage\framework\views/0a6cb83dc869c8b58a8e29ab495dcca8c5afa94f.php', array('__env' => object(Factory), 'app' => object(Application), 'errors' => object(ViewErrorBag), 'obLevel' => '1', 'page_title' => 'Dashboard', 'site_title' => 'Petrol Pump', 'total_customer' => '22', 'total_machine' => '4', 'total_fuel' => '3', 'total_seller' => '2')) in CompilerEngine.php line 59
at CompilerEngine->get('C:\wamp\www\pump\core\resources\views/layouts/dashboard.blade.php', array('__env' => object(Factory), 'app' => object(Application), 'errors' => object(ViewErrorBag), 'obLevel' => '1', 'page_title' => 'Dashboard', 'site_title' => 'Petrol Pump', 'total_customer' => '22', 'total_machine' => '4', 'total_fuel' => '3', 'total_seller' => '2')) in View.php line 149
at View->getContents() in View.php line 120
at View->renderContents() in View.php line 85
at View->render() in d039c120d96bd9a07957a999c1ef8ecb9005ec81.php line 69
at include('C:\wamp\www\pump\core\storage\framework\views\d039c120d96bd9a07957a999c1ef8ecb9005ec81.php') in PhpEngine.php line 42
at PhpEngine->evaluatePath('C:\wamp\www\pump\core\storage\framework\views/d039c120d96bd9a07957a999c1ef8ecb9005ec81.php', array('__env' => object(Factory), 'app' => object(Application), 'errors' => object(ViewErrorBag), 'page_title' => 'Dashboard', 'site_title' => 'Petrol Pump', 'total_customer' => '22', 'total_machine' => '4', 'total_fuel' => '3', 'total_seller' => '2')) in CompilerEngine.php line 59
at CompilerEngine->get('C:\wamp\www\pump\core\resources\views/dashboard/dashboard.blade.php', array('__env' => object(Factory), 'app' => object(Application), 'errors' => object(ViewErrorBag), 'page_title' => 'Dashboard', 'site_title' => 'Petrol Pump', 'total_customer' => '22', 'total_machine' => '4', 'total_fuel' => '3', 'total_seller' => '2')) in View.php line 149
at View->getContents() in View.php line 120
at View->renderContents() in View.php line 85
at View->render() in Response.php line 53
at Response->setContent(object(View)) in Response.php line 201
at Response->__construct(object(View)) in Router.php line 1085
at Router->prepareResponse(object(Request), object(View)) in ControllerDispatcher.php line 95
at ControllerDispatcher->Illuminate\Routing\{closure}(object(Request))
at call_user_func(object(Closure), object(Request)) in Pipeline.php line 52
at Pipeline->Illuminate\Routing\{closure}(object(Request)) in Authenticate.php line 28
at Authenticate->handle(object(Request), object(Closure), 'admin')
at call_user_func_array(array(object(Authenticate), 'handle'), array(object(Request), object(Closure), 'admin')) in Pipeline.php line 136
at Pipeline->Illuminate\Pipeline\{closure}(object(Request))
at call_user_func(object(Closure), object(Request)) in Pipeline.php line 32
at Pipeline->Illuminate\Routing\{closure}(object(Request))
at call_user_func(object(Closure), object(Request)) in Pipeline.php line 103
at Pipeline->then(object(Closure)) in ControllerDispatcher.php line 96
at ControllerDispatcher->callWithinStack(object(DashboardController), object(Route), object(Request), 'getDashboard') in ControllerDispatcher.php line 54
at ControllerDispatcher->dispatch(object(Route), object(Request), 'App\Http\Controllers\DashboardController', 'getDashboard') in Route.php line 174
at Route->runController(object(Request)) in Route.php line 140
at Route->run(object(Request)) in Router.php line 724
at Router->Illuminate\Routing\{closure}(object(Request))
at call_user_func(object(Closure), object(Request)) in Pipeline.php line 52
at Pipeline->Illuminate\Routing\{closure}(object(Request)) in VerifyCsrfToken.php line 64
at VerifyCsrfToken->handle(object(Request), object(Closure))
at call_user_func_array(array(object(VerifyCsrfToken), 'handle'), array(object(Request), object(Closure))) in Pipeline.php line 136
at Pipeline->Illuminate\Pipeline\{closure}(object(Request))
at call_user_func(object(Closure), object(Request)) in Pipeline.php line 32
at Pipeline->Illuminate\Routing\{closure}(object(Request)) in ShareErrorsFromSession.php line 49
at ShareErrorsFromSession->handle(object(Request), object(Closure))
at call_user_func_array(array(object(ShareErrorsFromSession), 'handle'), array(object(Request), object(Closure))) in Pipeline.php line 136
at Pipeline->Illuminate\Pipeline\{closure}(object(Request))
at call_user_func(object(Closure), object(Request)) in Pipeline.php line 32
at Pipeline->Illuminate\Routing\{closure}(object(Request)) in StartSession.php line 64
at StartSession->handle(object(Request), object(Closure))
at call_user_func_array(array(object(StartSession), 'handle'), array(object(Request), object(Closure))) in Pipeline.php line 136
at Pipeline->Illuminate\Pipeline\{closure}(object(Request))
at call_user_func(object(Closure), object(Request)) in Pipeline.php line 32
at Pipeline->Illuminate\Routing\{closure}(object(Request)) in AddQueuedCookiesToResponse.php line 37
at AddQueuedCookiesToResponse->handle(object(Request), object(Closure))
at call_user_func_array(array(object(AddQueuedCookiesToResponse), 'handle'), array(object(Request), object(Closure))) in Pipeline.php line 136
at Pipeline->Illuminate\Pipeline\{closure}(object(Request))
at call_user_func(object(Closure), object(Request)) in Pipeline.php line 32
at Pipeline->Illuminate\Routing\{closure}(object(Request)) in EncryptCookies.php line 59
at EncryptCookies->handle(object(Request), object(Closure))
at call_user_func_array(array(object(EncryptCookies), 'handle'), array(object(Request), object(Closure))) in Pipeline.php line 136
at Pipeline->Illuminate\Pipeline\{closure}(object(Request))
at call_user_func(object(Closure), object(Request)) in Pipeline.php line 32
at Pipeline->Illuminate\Routing\{closure}(object(Request))
at call_user_func(object(Closure), object(Request)) in Pipeline.php line 103
at Pipeline->then(object(Closure)) in Router.php line 726
at Router->runRouteWithinStack(object(Route), object(Request)) in Router.php line 699
at Router->dispatchToRoute(object(Request)) in Router.php line 675
at Router->dispatch(object(Request)) in Kernel.php line 246
at Kernel->Illuminate\Foundation\Http\{closure}(object(Request))
at call_user_func(object(Closure), object(Request)) in Pipeline.php line 52
at Pipeline->Illuminate\Routing\{closure}(object(Request)) in CheckForMaintenanceMode.php line 44
at CheckForMaintenanceMode->handle(object(Request), object(Closure))
at call_user_func_array(array(object(CheckForMaintenanceMode), 'handle'), array(object(Request), object(Closure))) in Pipeline.php line 136
at Pipeline->Illuminate\Pipeline\{closure}(object(Request))
at call_user_func(object(Closure), object(Request)) in Pipeline.php line 32
at Pipeline->Illuminate\Routing\{closure}(object(Request))
at call_user_func(object(Closure), object(Request)) in Pipeline.php line 103
at Pipeline->then(object(Closure)) in Kernel.php line 132
at Kernel->sendRequestThroughRouter(object(Request)) in Kernel.php line 99
at Kernel->handle(object(Request)) in index.php line 54
</code>```

1/3 InvalidArgumentException in UrlGenerator.php line 314: Route [stock-create] not defined.

```<code>in UrlGenerator.php line 314
at UrlGenerator->route('stock-create', array(), true) in helpers.php line 616
at route('stock-create') in 0a6cb83dc869c8b58a8e29ab495dcca8c5afa94f.php line 141
at include('C:\wamp\www\pump\core\storage\framework\views\0a6cb83dc869c8b58a8e29ab495dcca8c5afa94f.php') in PhpEngine.php line 42
at PhpEngine->evaluatePath('C:\wamp\www\pump\core\storage\framework\views/0a6cb83dc869c8b58a8e29ab495dcca8c5afa94f.php', array('__env' => object(Factory), 'app' => object(Application), 'errors' => object(ViewErrorBag), 'obLevel' => '1', 'page_title' => 'Dashboard', 'site_title' => 'Petrol Pump', 'total_customer' => '22', 'total_machine' => '4', 'total_fuel' => '3', 'total_seller' => '2')) in CompilerEngine.php line 59
at CompilerEngine->get('C:\wamp\www\pump\core\resources\views/layouts/dashboard.blade.php', array('__env' => object(Factory), 'app' => object(Application), 'errors' => object(ViewErrorBag), 'obLevel' => '1', 'page_title' => 'Dashboard', 'site_title' => 'Petrol Pump', 'total_customer' => '22', 'total_machine' => '4', 'total_fuel' => '3', 'total_seller' => '2')) in View.php line 149
at View->getContents() in View.php line 120
at View->renderContents() in View.php line 85
at View->render() in d039c120d96bd9a07957a999c1ef8ecb9005ec81.php line 69
at include('C:\wamp\www\pump\core\storage\framework\views\d039c120d96bd9a07957a999c1ef8ecb9005ec81.php') in PhpEngine.php line 42
at PhpEngine->evaluatePath('C:\wamp\www\pump\core\storage\framework\views/d039c120d96bd9a07957a999c1ef8ecb9005ec81.php', array('__env' => object(Factory), 'app' => object(Application), 'errors' => object(ViewErrorBag), 'page_title' => 'Dashboard', 'site_title' => 'Petrol Pump', 'total_customer' => '22', 'total_machine' => '4', 'total_fuel' => '3', 'total_seller' => '2')) in CompilerEngine.php line 59
at CompilerEngine->get('C:\wamp\www\pump\core\resources\views/dashboard/dashboard.blade.php', array('__env' => object(Factory), 'app' => object(Application), 'errors' => object(ViewErrorBag), 'page_title' => 'Dashboard', 'site_title' => 'Petrol Pump', 'total_customer' => '22', 'total_machine' => '4', 'total_fuel' => '3', 'total_seller' => '2')) in View.php line 149
at View->getContents() in View.php line 120
at View->renderContents() in View.php line 85
at View->render() in Response.php line 53
at Response->setContent(object(View)) in Response.php line 201
at Response->__construct(object(View)) in Router.php line 1085
at Router->prepareResponse(object(Request), object(View)) in ControllerDispatcher.php line 95
at ControllerDispatcher->Illuminate\Routing\{closure}(object(Request))
at call_user_func(object(Closure), object(Request)) in Pipeline.php line 52
at Pipeline->Illuminate\Routing\{closure}(object(Request)) in Authenticate.php line 28
at Authenticate->handle(object(Request), object(Closure), 'admin')
at call_user_func_array(array(object(Authenticate), 'handle'), array(object(Request), object(Closure), 'admin')) in Pipeline.php line 136
at Pipeline->Illuminate\Pipeline\{closure}(object(Request))
at call_user_func(object(Closure), object(Request)) in Pipeline.php line 32
at Pipeline->Illuminate\Routing\{closure}(object(Request))
at call_user_func(object(Closure), object(Request)) in Pipeline.php line 103
at Pipeline->then(object(Closure)) in ControllerDispatcher.php line 96
at ControllerDispatcher->callWithinStack(object(DashboardController), object(Route), object(Request), 'getDashboard') in ControllerDispatcher.php line 54
at ControllerDispatcher->dispatch(object(Route), object(Request), 'App\Http\Controllers\DashboardController', 'getDashboard') in Route.php line 174
at Route->runController(object(Request)) in Route.php line 140
at Route->run(object(Request)) in Router.php line 724
at Router->Illuminate\Routing\{closure}(object(Request))
at call_user_func(object(Closure), object(Request)) in Pipeline.php line 52
at Pipeline->Illuminate\Routing\{closure}(object(Request)) in VerifyCsrfToken.php line 64
at VerifyCsrfToken->handle(object(Request), object(Closure))
at call_user_func_array(array(object(VerifyCsrfToken), 'handle'), array(object(Request), object(Closure))) in Pipeline.php line 136
at Pipeline->Illuminate\Pipeline\{closure}(object(Request))
at call_user_func(object(Closure), object(Request)) in Pipeline.php line 32
at Pipeline->Illuminate\Routing\{closure}(object(Request)) in ShareErrorsFromSession.php line 49
at ShareErrorsFromSession->handle(object(Request), object(Closure))
at call_user_func_array(array(object(ShareErrorsFromSession), 'handle'), array(object(Request), object(Closure))) in Pipeline.php line 136
at Pipeline->Illuminate\Pipeline\{closure}(object(Request))
at call_user_func(object(Closure), object(Request)) in Pipeline.php line 32
at Pipeline->Illuminate\Routing\{closure}(object(Request)) in StartSession.php line 64
at StartSession->handle(object(Request), object(Closure))
at call_user_func_array(array(object(StartSession), 'handle'), array(object(Request), object(Closure))) in Pipeline.php line 136
at Pipeline->Illuminate\Pipeline\{closure}(object(Request))
at call_user_func(object(Closure), object(Request)) in Pipeline.php line 32
at Pipeline->Illuminate\Routing\{closure}(object(Request)) in AddQueuedCookiesToResponse.php line 37
at AddQueuedCookiesToResponse->handle(object(Request), object(Closure))
at call_user_func_array(array(object(AddQueuedCookiesToResponse), 'handle'), array(object(Request), object(Closure))) in Pipeline.php line 136
at Pipeline->Illuminate\Pipeline\{closure}(object(Request))
at call_user_func(object(Closure), object(Request)) in Pipeline.php line 32
at Pipeline->Illuminate\Routing\{closure}(object(Request)) in EncryptCookies.php line 59
at EncryptCookies->handle(object(Request), object(Closure))
at call_user_func_array(array(object(EncryptCookies), 'handle'), array(object(Request), object(Closure))) in Pipeline.php line 136
at Pipeline->Illuminate\Pipeline\{closure}(object(Request))
at call_user_func(object(Closure), object(Request)) in Pipeline.php line 32
at Pipeline->Illuminate\Routing\{closure}(object(Request))
at call_user_func(object(Closure), object(Request)) in Pipeline.php line 103
at Pipeline->then(object(Closure)) in Router.php line 726
at Router->runRouteWithinStack(object(Route), object(Request)) in Router.php line 699
at Router->dispatchToRoute(object(Request)) in Router.php line 675
at Router->dispatch(object(Request)) in Kernel.php line 246
at Kernel->Illuminate\Foundation\Http\{closure}(object(Request))
at call_user_func(object(Closure), object(Request)) in Pipeline.php line 52
at Pipeline->Illuminate\Routing\{closure}(object(Request)) in CheckForMaintenanceMode.php line 44
at CheckForMaintenanceMode->handle(object(Request), object(Closure))
at call_user_func_array(array(object(CheckForMaintenanceMode), 'handle'), array(object(Request), object(Closure))) in Pipeline.php line 136
at Pipeline->Illuminate\Pipeline\{closure}(object(Request))
at call_user_func(object(Closure), object(Request)) in Pipeline.php line 32
at Pipeline->Illuminate\Routing\{closure}(object(Request))
at call_user_func(object(Closure), object(Request)) in Pipeline.php line 103
at Pipeline->then(object(Closure)) in Kernel.php line 132
at Kernel->sendRequestThroughRouter(object(Request)) in Kernel.php line 99
at Kernel->handle(object(Request)) in index.php line 54
</code>```

This is my first time of using Laravel, could someone tell me what I am doing wrong?

答:
It's highly probable that your route is :

```<code>stock.create
</code>```

and not

```<code>stock-create
</code>```

Body:
I was trying to add links to sidebar in laravel but I was getting this error message:

Whoops, looks like something went wrong.
3/3 ErrorException in UrlGenerator.php line 314: Route [stock-create] not defined. (View: C:\wamp\www\pump\core\resources\views\layouts\dashboard.blade.php) (View: C:\wamp\www\pump\core\resources\views\layouts\dashboard.blade.php)

in UrlGenerator.php line 314
at CompilerEngine->handleViewException(object(ErrorException), '1') in PhpEngine.php line 44
at PhpEngine->evaluatePath('C:\wamp\www\pump\core\storage\framework\views/d039c120d96bd9a07957a999c1ef8ecb9005ec81.php', array('__env' => object(Factory), 'app' => object(Application), 'errors' => object(ViewErrorBag), 'page_title' => 'Dashboard', 'site_title' => 'Petrol Pump', 'total_customer' => '22', 'total_machine' => '4', 'total_fuel' => '3', 'total_seller' => '2')) in CompilerEngine.php line 59
at CompilerEngine->get('C:\wamp\www\pump\core\resources\views/dashboard/dashboard.blade.php', array('__env' => object(Factory), 'app' => object(Application), 'errors' => object(ViewErrorBag), 'page_title' => 'Dashboard', 'site_title' => 'Petrol Pump', 'total_customer' => '22', 'total_machine' => '4', 'total_fuel' => '3', 'total_seller' => '2')) in View.php line 149
at View->getContents() in View.php line 120
at View->renderContents() in View.php line 85
at View->render() in Response.php line 53
at Response->setContent(object(View)) in Response.php line 201
at Response->__construct(object(View)) in Router.php line 1085
at Router->prepareResponse(object(Request), object(View)) in ControllerDispatcher.php line 95
at ControllerDispatcher->Illuminate\Routing\{closure}(object(Request))
at call_user_func(object(Closure), object(Request)) in Pipeline.php line 52
at Pipeline->Illuminate\Routing\{closure}(object(Request)) in Authenticate.php line 28
at Authenticate->handle(object(Request), object(Closure), 'admin')
at call_user_func_array(array(object(Authenticate), 'handle'), array(object(Request), object(Closure), 'admin')) in Pipeline.php line 136
at Pipeline->Illuminate\Pipeline\{closure}(object(Request))
at call_user_func(object(Closure), object(Request)) in Pipeline.php line 32
at Pipeline->Illuminate\Routing\{closure}(object(Request))
at call_user_func(object(Closure), object(Request)) in Pipeline.php line 103
at Pipeline->then(object(Closure)) in ControllerDispatcher.php line 96
at ControllerDispatcher->callWithinStack(object(DashboardController), object(Route), object(Request), 'getDashboard') in ControllerDispatcher.php line 54
at ControllerDispatcher->dispatch(object(Route), object(Request), 'App\Http\Controllers\DashboardController', 'getDashboard') in Route.php line 174
at Route->runController(object(Request)) in Route.php line 140
at Route->run(object(Request)) in Router.php line 724
at Router->Illuminate\Routing\{closure}(object(Request))
at call_user_func(object(Closure), object(Request)) in Pipeline.php line 52
at Pipeline->Illuminate\Routing\{closure}(object(Request)) in VerifyCsrfToken.php line 64
at VerifyCsrfToken->handle(object(Request), object(Closure))
at call_user_func_array(array(object(VerifyCsrfToken), 'handle'), array(object(Request), object(Closure))) in Pipeline.php line 136
at Pipeline->Illuminate\Pipeline\{closure}(object(Request))
at call_user_func(object(Closure), object(Request)) in Pipeline.php line 32
at Pipeline->Illuminate\Routing\{closure}(object(Request)) in ShareErrorsFromSession.php line 49
at ShareErrorsFromSession->handle(object(Request), object(Closure))
at call_user_func_array(array(object(ShareErrorsFromSession), 'handle'), array(object(Request), object(Closure))) in Pipeline.php line 136
at Pipeline->Illuminate\Pipeline\{closure}(object(Request))
at call_user_func(object(Closure), object(Request)) in Pipeline.php line 32
at Pipeline->Illuminate\Routing\{closure}(object(Request)) in StartSession.php line 64
at StartSession->handle(object(Request), object(Closure))
at call_user_func_array(array(object(StartSession), 'handle'), array(object(Request), object(Closure))) in Pipeline.php line 136
at Pipeline->Illuminate\Pipeline\{closure}(object(Request))
at call_user_func(object(Closure), object(Request)) in Pipeline.php line 32
at Pipeline->Illuminate\Routing\{closure}(object(Request)) in AddQueuedCookiesToResponse.php line 37
at AddQueuedCookiesToResponse->handle(object(Request), object(Closure))
at call_user_func_array(array(object(AddQueuedCookiesToResponse), 'handle'), array(object(Request), object(Closure))) in Pipeline.php line 136
at Pipeline->Illuminate\Pipeline\{closure}(object(Request))
at call_user_func(object(Closure), object(Request)) in Pipeline.php line 32
at Pipeline->Illuminate\Routing\{closure}(object(Request)) in EncryptCookies.php line 59
at EncryptCookies->handle(object(Request), object(Closure))
at call_user_func_array(array(object(EncryptCookies), 'handle'), array(object(Request), object(Closure))) in Pipeline.php line 136
at Pipeline->Illuminate\Pipeline\{closure}(object(Request))
at call_user_func(object(Closure), object(Request)) in Pipeline.php line 32
at Pipeline->Illuminate\Routing\{closure}(object(Request))
at call_user_func(object(Closure), object(Request)) in Pipeline.php line 103
at Pipeline->then(object(Closure)) in Router.php line 726
at Router->runRouteWithinStack(object(Route), object(Request)) in Router.php line 699
at Router->dispatchToRoute(object(Request)) in Router.php line 675
at Router->dispatch(object(Request)) in Kernel.php line 246
at Kernel->Illuminate\Foundation\Http\{closure}(object(Request))
at call_user_func(object(Closure), object(Request)) in Pipeline.php line 52
at Pipeline->Illuminate\Routing\{closure}(object(Request)) in CheckForMaintenanceMode.php line 44
at CheckForMaintenanceMode->handle(object(Request), object(Closure))
at call_user_func_array(array(object(CheckForMaintenanceMode), 'handle'), array(object(Request), object(Closure))) in Pipeline.php line 136
at Pipeline->Illuminate\Pipeline\{closure}(object(Request))
at call_user_func(object(Closure), object(Request)) in Pipeline.php line 32
at Pipeline->Illuminate\Routing\{closure}(object(Request))
at call_user_func(object(Closure), object(Request)) in Pipeline.php line 103
at Pipeline->then(object(Closure)) in Kernel.php line 132
at Kernel->sendRequestThroughRouter(object(Request)) in Kernel.php line 99
at Kernel->handle(object(Request)) in index.php line 54

2/3 ErrorException in UrlGenerator.php line 314: Route [stock-create] not defined. (View: C:\wamp\www\pump\core\resources\views\layouts\dashboard.blade.php)

in UrlGenerator.php line 314
at CompilerEngine->handleViewException(object(InvalidArgumentException), '2') in PhpEngine.php line 44
at PhpEngine->evaluatePath('C:\wamp\www\pump\core\storage\framework\views/0a6cb83dc869c8b58a8e29ab495dcca8c5afa94f.php', array('__env' => object(Factory), 'app' => object(Application), 'errors' => object(ViewErrorBag), 'obLevel' => '1', 'page_title' => 'Dashboard', 'site_title' => 'Petrol Pump', 'total_customer' => '22', 'total_machine' => '4', 'total_fuel' => '3', 'total_seller' => '2')) in CompilerEngine.php line 59
at CompilerEngine->get('C:\wamp\www\pump\core\resources\views/layouts/dashboard.blade.php', array('__env' => object(Factory), 'app' => object(Application), 'errors' => object(ViewErrorBag), 'obLevel' => '1', 'page_title' => 'Dashboard', 'site_title' => 'Petrol Pump', 'total_customer' => '22', 'total_machine' => '4', 'total_fuel' => '3', 'total_seller' => '2')) in View.php line 149
at View->getContents() in View.php line 120
at View->renderContents() in View.php line 85
at View->render() in d039c120d96bd9a07957a999c1ef8ecb9005ec81.php line 69
at include('C:\wamp\www\pump\core\storage\framework\views\d039c120d96bd9a07957a999c1ef8ecb9005ec81.php') in PhpEngine.php line 42
at PhpEngine->evaluatePath('C:\wamp\www\pump\core\storage\framework\views/d039c120d96bd9a07957a999c1ef8ecb9005ec81.php', array('__env' => object(Factory), 'app' => object(Application), 'errors' => object(ViewErrorBag), 'page_title' => 'Dashboard', 'site_title' => 'Petrol Pump', 'total_customer' => '22', 'total_machine' => '4', 'total_fuel' => '3', 'total_seller' => '2')) in CompilerEngine.php line 59
at CompilerEngine->get('C:\wamp\www\pump\core\resources\views/dashboard/dashboard.blade.php', array('__env' => object(Factory), 'app' => object(Application), 'errors' => object(ViewErrorBag), 'page_title' => 'Dashboard', 'site_title' => 'Petrol Pump', 'total_customer' => '22', 'total_machine' => '4', 'total_fuel' => '3', 'total_seller' => '2')) in View.php line 149
at View->getContents() in View.php line 120
at View->renderContents() in View.php line 85
at View->render() in Response.php line 53
at Response->setContent(object(View)) in Response.php line 201
at Response->__construct(object(View)) in Router.php line 1085
at Router->prepareResponse(object(Request), object(View)) in ControllerDispatcher.php line 95
at ControllerDispatcher->Illuminate\Routing\{closure}(object(Request))
at call_user_func(object(Closure), object(Request)) in Pipeline.php line 52
at Pipeline->Illuminate\Routing\{closure}(object(Request)) in Authenticate.php line 28
at Authenticate->handle(object(Request), object(Closure), 'admin')
at call_user_func_array(array(object(Authenticate), 'handle'), array(object(Request), object(Closure), 'admin')) in Pipeline.php line 136
at Pipeline->Illuminate\Pipeline\{closure}(object(Request))
at call_user_func(object(Closure), object(Request)) in Pipeline.php line 32
at Pipeline->Illuminate\Routing\{closure}(object(Request))
at call_user_func(object(Closure), object(Request)) in Pipeline.php line 103
at Pipeline->then(object(Closure)) in ControllerDispatcher.php line 96
at ControllerDispatcher->callWithinStack(object(DashboardController), object(Route), object(Request), 'getDashboard') in ControllerDispatcher.php line 54
at ControllerDispatcher->dispatch(object(Route), object(Request), 'App\Http\Controllers\DashboardController', 'getDashboard') in Route.php line 174
at Route->runController(object(Request)) in Route.php line 140
at Route->run(object(Request)) in Router.php line 724
at Router->Illuminate\Routing\{closure}(object(Request))
at call_user_func(object(Closure), object(Request)) in Pipeline.php line 52
at Pipeline->Illuminate\Routing\{closure}(object(Request)) in VerifyCsrfToken.php line 64
at VerifyCsrfToken->handle(object(Request), object(Closure))
at call_user_func_array(array(object(VerifyCsrfToken), 'handle'), array(object(Request), object(Closure))) in Pipeline.php line 136
at Pipeline->Illuminate\Pipeline\{closure}(object(Request))
at call_user_func(object(Closure), object(Request)) in Pipeline.php line 32
at Pipeline->Illuminate\Routing\{closure}(object(Request)) in ShareErrorsFromSession.php line 49
at ShareErrorsFromSession->handle(object(Request), object(Closure))
at call_user_func_array(array(object(ShareErrorsFromSession), 'handle'), array(object(Request), object(Closure))) in Pipeline.php line 136
at Pipeline->Illuminate\Pipeline\{closure}(object(Request))
at call_user_func(object(Closure), object(Request)) in Pipeline.php line 32
at Pipeline->Illuminate\Routing\{closure}(object(Request)) in StartSession.php line 64
at StartSession->handle(object(Request), object(Closure))
at call_user_func_array(array(object(StartSession), 'handle'), array(object(Request), object(Closure))) in Pipeline.php line 136
at Pipeline->Illuminate\Pipeline\{closure}(object(Request))
at call_user_func(object(Closure), object(Request)) in Pipeline.php line 32
at Pipeline->Illuminate\Routing\{closure}(object(Request)) in AddQueuedCookiesToResponse.php line 37
at AddQueuedCookiesToResponse->handle(object(Request), object(Closure))
at call_user_func_array(array(object(AddQueuedCookiesToResponse), 'handle'), array(object(Request), object(Closure))) in Pipeline.php line 136
at Pipeline->Illuminate\Pipeline\{closure}(object(Request))
at call_user_func(object(Closure), object(Request)) in Pipeline.php line 32
at Pipeline->Illuminate\Routing\{closure}(object(Request)) in EncryptCookies.php line 59
at EncryptCookies->handle(object(Request), object(Closure))
at call_user_func_array(array(object(EncryptCookies), 'handle'), array(object(Request), object(Closure))) in Pipeline.php line 136
at Pipeline->Illuminate\Pipeline\{closure}(object(Request))
at call_user_func(object(Closure), object(Request)) in Pipeline.php line 32
at Pipeline->Illuminate\Routing\{closure}(object(Request))
at call_user_func(object(Closure), object(Request)) in Pipeline.php line 103
at Pipeline->then(object(Closure)) in Router.php line 726
at Router->runRouteWithinStack(object(Route), object(Request)) in Router.php line 699
at Router->dispatchToRoute(object(Request)) in Router.php line 675
at Router->dispatch(object(Request)) in Kernel.php line 246
at Kernel->Illuminate\Foundation\Http\{closure}(object(Request))
at call_user_func(object(Closure), object(Request)) in Pipeline.php line 52
at Pipeline->Illuminate\Routing\{closure}(object(Request)) in CheckForMaintenanceMode.php line 44
at CheckForMaintenanceMode->handle(object(Request), object(Closure))
at call_user_func_array(array(object(CheckForMaintenanceMode), 'handle'), array(object(Request), object(Closure))) in Pipeline.php line 136
at Pipeline->Illuminate\Pipeline\{closure}(object(Request))
at call_user_func(object(Closure), object(Request)) in Pipeline.php line 32
at Pipeline->Illuminate\Routing\{closure}(object(Request))
at call_user_func(object(Closure), object(Request)) in Pipeline.php line 103
at Pipeline->then(object(Closure)) in Kernel.php line 132
at Kernel->sendRequestThroughRouter(object(Request)) in Kernel.php line 99
at Kernel->handle(object(Request)) in index.php line 54

1/3 InvalidArgumentException in UrlGenerator.php line 314: Route [stock-create] not defined.

in UrlGenerator.php line 314
at UrlGenerator->route('stock-create', array(), true) in helpers.php line 616
at route('stock-create') in 0a6cb83dc869c8b58a8e29ab495dcca8c5afa94f.php line 141
at include('C:\wamp\www\pump\core\storage\framework\views\0a6cb83dc869c8b58a8e29ab495dcca8c5afa94f.php') in PhpEngine.php line 42
at PhpEngine->evaluatePath('C:\wamp\www\pump\core\storage\framework\views/0a6cb83dc869c8b58a8e29ab495dcca8c5afa94f.php', array('__env' => object(Factory), 'app' => object(Application), 'errors' => object(ViewErrorBag), 'obLevel' => '1', 'page_title' => 'Dashboard', 'site_title' => 'Petrol Pump', 'total_customer' => '22', 'total_machine' => '4', 'total_fuel' => '3', 'total_seller' => '2')) in CompilerEngine.php line 59
at CompilerEngine->get('C:\wamp\www\pump\core\resources\views/layouts/dashboard.blade.php', array('__env' => object(Factory), 'app' => object(Application), 'errors' => object(ViewErrorBag), 'obLevel' => '1', 'page_title' => 'Dashboard', 'site_title' => 'Petrol Pump', 'total_customer' => '22', 'total_machine' => '4', 'total_fuel' => '3', 'total_seller' => '2')) in View.php line 149
at View->getContents() in View.php line 120
at View->renderContents() in View.php line 85
at View->render() in d039c120d96bd9a07957a999c1ef8ecb9005ec81.php line 69
at include('C:\wamp\www\pump\core\storage\framework\views\d039c120d96bd9a07957a999c1ef8ecb9005ec81.php') in PhpEngine.php line 42
at PhpEngine->evaluatePath('C:\wamp\www\pump\core\storage\framework\views/d039c120d96bd9a07957a999c1ef8ecb9005ec81.php', array('__env' => object(Factory), 'app' => object(Application), 'errors' => object(ViewErrorBag), 'page_title' => 'Dashboard', 'site_title' => 'Petrol Pump', 'total_customer' => '22', 'total_machine' => '4', 'total_fuel' => '3', 'total_seller' => '2')) in CompilerEngine.php line 59
at CompilerEngine->get('C:\wamp\www\pump\core\resources\views/dashboard/dashboard.blade.php', array('__env' => object(Factory), 'app' => object(Application), 'errors' => object(ViewErrorBag), 'page_title' => 'Dashboard', 'site_title' => 'Petrol Pump', 'total_customer' => '22', 'total_machine' => '4', 'total_fuel' => '3', 'total_seller' => '2')) in View.php line 149
at View->getContents() in View.php line 120
at View->renderContents() in View.php line 85
at View->render() in Response.php line 53
at Response->setContent(object(View)) in Response.php line 201
at Response->__construct(object(View)) in Router.php line 1085
at Router->prepareResponse(object(Request), object(View)) in ControllerDispatcher.php line 95
at ControllerDispatcher->Illuminate\Routing\{closure}(object(Request))
at call_user_func(object(Closure), object(Request)) in Pipeline.php line 52
at Pipeline->Illuminate\Routing\{closure}(object(Request)) in Authenticate.php line 28
at Authenticate->handle(object(Request), object(Closure), 'admin')
at call_user_func_array(array(object(Authenticate), 'handle'), array(object(Request), object(Closure), 'admin')) in Pipeline.php line 136
at Pipeline->Illuminate\Pipeline\{closure}(object(Request))
at call_user_func(object(Closure), object(Request)) in Pipeline.php line 32
at Pipeline->Illuminate\Routing\{closure}(object(Request))
at call_user_func(object(Closure), object(Request)) in Pipeline.php line 103
at Pipeline->then(object(Closure)) in ControllerDispatcher.php line 96
at ControllerDispatcher->callWithinStack(object(DashboardController), object(Route), object(Request), 'getDashboard') in ControllerDispatcher.php line 54
at ControllerDispatcher->dispatch(object(Route), object(Request), 'App\Http\Controllers\DashboardController', 'getDashboard') in Route.php line 174
at Route->runController(object(Request)) in Route.php line 140
at Route->run(object(Request)) in Router.php line 724
at Router->Illuminate\Routing\{closure}(object(Request))
at call_user_func(object(Closure), object(Request)) in Pipeline.php line 52
at Pipeline->Illuminate\Routing\{closure}(object(Request)) in VerifyCsrfToken.php line 64
at VerifyCsrfToken->handle(object(Request), object(Closure))
at call_user_func_array(array(object(VerifyCsrfToken), 'handle'), array(object(Request), object(Closure))) in Pipeline.php line 136
at Pipeline->Illuminate\Pipeline\{closure}(object(Request))
at call_user_func(object(Closure), object(Request)) in Pipeline.php line 32
at Pipeline->Illuminate\Routing\{closure}(object(Request)) in ShareErrorsFromSession.php line 49
at ShareErrorsFromSession->handle(object(Request), object(Closure))
at call_user_func_array(array(object(ShareErrorsFromSession), 'handle'), array(object(Request), object(Closure))) in Pipeline.php line 136
at Pipeline->Illuminate\Pipeline\{closure}(object(Request))
at call_user_func(object(Closure), object(Request)) in Pipeline.php line 32
at Pipeline->Illuminate\Routing\{closure}(object(Request)) in StartSession.php line 64
at StartSession->handle(object(Request), object(Closure))
at call_user_func_array(array(object(StartSession), 'handle'), array(object(Request), object(Closure))) in Pipeline.php line 136
at Pipeline->Illuminate\Pipeline\{closure}(object(Request))
at call_user_func(object(Closure), object(Request)) in Pipeline.php line 32
at Pipeline->Illuminate\Routing\{closure}(object(Request)) in AddQueuedCookiesToResponse.php line 37
at AddQueuedCookiesToResponse->handle(object(Request), object(Closure))
at call_user_func_array(array(object(AddQueuedCookiesToResponse), 'handle'), array(object(Request), object(Closure))) in Pipeline.php line 136
at Pipeline->Illuminate\Pipeline\{closure}(object(Request))
at call_user_func(object(Closure), object(Request)) in Pipeline.php line 32
at Pipeline->Illuminate\Routing\{closure}(object(Request)) in EncryptCookies.php line 59
at EncryptCookies->handle(object(Request), object(Closure))
at call_user_func_array(array(object(EncryptCookies), 'handle'), array(object(Request), object(Closure))) in Pipeline.php line 136
at Pipeline->Illuminate\Pipeline\{closure}(object(Request))
at call_user_func(object(Closure), object(Request)) in Pipeline.php line 32
at Pipeline->Illuminate\Routing\{closure}(object(Request))
at call_user_func(object(Closure), object(Request)) in Pipeline.php line 103
at Pipeline->then(object(Closure)) in Router.php line 726
at Router->runRouteWithinStack(object(Route), object(Request)) in Router.php line 699
at Router->dispatchToRoute(object(Request)) in Router.php line 675
at Router->dispatch(object(Request)) in Kernel.php line 246
at Kernel->Illuminate\Foundation\Http\{closure}(object(Request))
at call_user_func(object(Closure), object(Request)) in Pipeline.php line 52
at Pipeline->Illuminate\Routing\{closure}(object(Request)) in CheckForMaintenanceMode.php line 44
at CheckForMaintenanceMode->handle(object(Request), object(Closure))
at call_user_func_array(array(object(CheckForMaintenanceMode), 'handle'), array(object(Request), object(Closure))) in Pipeline.php line 136
at Pipeline->Illuminate\Pipeline\{closure}(object(Request))
at call_user_func(object(Closure), object(Request)) in Pipeline.php line 32
at Pipeline->Illuminate\Routing\{closure}(object(Request))
at call_user_func(object(Closure), object(Request)) in Pipeline.php line 103
at Pipeline->then(object(Closure)) in Kernel.php line 132
at Kernel->sendRequestThroughRouter(object(Request)) in Kernel.php line 99
at Kernel->handle(object(Request)) in index.php line 54

This is my first time of using Laravel, could someone tell me what I am doing wrong?

Body:
It's highly probable that your route is :

stock.create

and not

stock-create


来源: stackexchange

问:
Python: List of dictionaries: How to - nice printout using sys.stdout
I have the following list of dictionaries:

```<code>[{'Sequence': 'TGACCCTGCTTGGCGATCCCGGCGTTTC', 'Start': '52037', 'Strand': '+', 'End': '52064'}, {'Sequence': 'TGATCGCGCAACTGCAGCGGGAGTTAC', 'Start': '188334', 'Strand': '+', 'End': '188360'}, {'Sequence': 'TGATCCGGCACTCGTTGGAGTTCGTATC', 'Start': '245882', 'Strand': '+', 'End': '245909'}, {'Sequence': 'TGACCTTGGTCAGATCGATGACCGTAAT', 'Start': '318422', 'Strand': '+', 'End': '318449'}, {'Sequence': 'TGACCCGCGTATTTTGGAGCAGAAGTATC', 'Start': '343421', 'Strand': '+', 'End': '343449'}, {'Sequence': 'TGATCCGGCACTCGTTGGAGTTCGTATC', 'Start': '359576', 'Strand': '+', 'End': '359603'}, {'Sequence': 'TGATCGGCAATTCCTATGGCAAGTATC', 'Start': '457457', 'Strand': '+', 'End': '457483'}, {'Sequence': 'TGATCGAGGCGCCAGTTGTGCCCGTATT', 'Start': '627296', 'Strand': '+', 'End': '627323'}, {'Sequence': 'TGATCCAAGTGAACCCCCGCCCAGTAAA', 'Start': '637265', 'Strand': '+', 'End': '637292'}, {'Sequence': 'TGACCGGAAGACCGCCGTCGAGCGTATC', 'Start': '829035', 'Strand': '+', 'End': '829062'}, {'Sequence': 'TGATCGCGGCACCGACACCGGTCGTAAT', 'Start': '864440', 'Strand': '+', 'End': '864467'}, {'Sequence': 'TGATCGTTTCCGTGCTCGGAGCGTATC', 'Start': '934160', 'Strand': '+', 'End': '934186'}, {'Sequence': 'TGACCTGGCTCGAGGCCTGAGGAGTAAA', 'Start': '1162006', 'Strand': '+', 'End': '1162033'}, {'Sequence': 'TGACCCGCCGCAACATCCCCTTCGTAAA', 'Start': '1294515', 'Strand': '+', 'End': '1294542'}]
</code>```

I would like to acquire the following output (redirecting prints via sys.stdout):

```<code>Start:1234  End:5678  Strand:+  Sequence:ABCDEFG
...
</code>```

So far, my idea involves looping through the list and using the get-method to get the value of the key and then do a manual printout, basically like this:

```<code>for item in dictList:
    print("Start"+item.get('Start'))
    print("End"+item.get('End'))
    ...
</code>```

I am not sure how to deal with the newlines though. I read about sys.stdout flush to avoid
newlines, but since I do not want to avoid all newlines, I am not sure if this would suit my aim.

Is there a smarter/shorter way to do this?

Update

Thanks to Aleksey, I thought of changing my print statement to:

```<code>for item in dictList:
    print("Start"+str(item.get('Start'))+"  "+"End"+str(item.get('End'))+"  "+"Strand"+str(item.get('Strand'))+"  "+"Sequence: "+str(item.get('Sequence')))
</code>```

Update2

so far, I am sticking to this:

```<code>print(ecf+"  "+replicon+"  -  "+"Validated results: Total number of hits: "+str(len(finalList)))
print("")

for item in finalList:
    print("Start: "+str(item.get('Start'))+"  "+"End: "+str(item.get('End'))+"  "+"Strand: "+str(item.get('Strand'))+"  "+"Sequence: "+str(item.get('Sequence')))
</code>```

which prints:

```<code>ECF02  pSymA  -  Validated results: Total number of hits: 284

Start: 2876  End: 2903  Strand: +  Sequence: GAACTACAGGAAGTTCATGGTCTCCTTC
Start: 2876  End: 2900  Strand: +  Sequence: GAACTACAGGAAGTTCATGGTCTCC
Start: 9214  End: 9238  Strand: +  Sequence: GAACGTCGGGCGCAAGAGCCGCTTT
...
</code>```

please note: dictList was replaced by finalList. Due to parts of my script running before those prints

答:
You could use .format_map(each_dic) or later Python 3.5+ added alternative .format(**each_dic). Uses each dict in the list in each print with formatting.

```<code>for each_dic in dictList:
    print('Sequence: {Sequence:<29} '
          'Start: {Start:>7} '
          'Strand: {Strand} '
          'End: {End:>7}'.format_map(each_dic))
</code>```

Look at Python help page: string - Common string operations for further reference and examples.

ContentLicense: CC BY-SA 3.0

Body:
I have the following list of dictionaries:

[{'Sequence': 'TGACCCTGCTTGGCGATCCCGGCGTTTC', 'Start': '52037', 'Strand': '+', 'End': '52064'}, {'Sequence': 'TGATCGCGCAACTGCAGCGGGAGTTAC', 'Start': '188334', 'Strand': '+', 'End': '188360'}, {'Sequence': 'TGATCCGGCACTCGTTGGAGTTCGTATC', 'Start': '245882', 'Strand': '+', 'End': '245909'}, {'Sequence': 'TGACCTTGGTCAGATCGATGACCGTAAT', 'Start': '318422', 'Strand': '+', 'End': '318449'}, {'Sequence': 'TGACCCGCGTATTTTGGAGCAGAAGTATC', 'Start': '343421', 'Strand': '+', 'End': '343449'}, {'Sequence': 'TGATCCGGCACTCGTTGGAGTTCGTATC', 'Start': '359576', 'Strand': '+', 'End': '359603'}, {'Sequence': 'TGATCGGCAATTCCTATGGCAAGTATC', 'Start': '457457', 'Strand': '+', 'End': '457483'}, {'Sequence': 'TGATCGAGGCGCCAGTTGTGCCCGTATT', 'Start': '627296', 'Strand': '+', 'End': '627323'}, {'Sequence': 'TGATCCAAGTGAACCCCCGCCCAGTAAA', 'Start': '637265', 'Strand': '+', 'End': '637292'}, {'Sequence': 'TGACCGGAAGACCGCCGTCGAGCGTATC', 'Start': '829035', 'Strand': '+', 'End': '829062'}, {'Sequence': 'TGATCGCGGCACCGACACCGGTCGTAAT', 'Start': '864440', 'Strand': '+', 'End': '864467'}, {'Sequence': 'TGATCGTTTCCGTGCTCGGAGCGTATC', 'Start': '934160', 'Strand': '+', 'End': '934186'}, {'Sequence': 'TGACCTGGCTCGAGGCCTGAGGAGTAAA', 'Start': '1162006', 'Strand': '+', 'End': '1162033'}, {'Sequence': 'TGACCCGCCGCAACATCCCCTTCGTAAA', 'Start': '1294515', 'Strand': '+', 'End': '1294542'}]

I would like to acquire the following output (redirecting prints via sys.stdout):

Start:1234  End:5678  Strand:+  Sequence:ABCDEFG
...

So far, my idea involves looping through the list and using the get-method to get the value of the key and then do a manual printout, basically like this:

for item in dictList:
    print("Start"+item.get('Start'))
    print("End"+item.get('End'))
    ...

I am not sure how to deal with the newlines though. I read about sys.stdout flush to avoid
newlines, but since I do not want to avoid all newlines, I am not sure if this would suit my aim.

Is there a smarter/shorter way to do this?

Update

Thanks to Aleksey, I thought of changing my print statement to:

for item in dictList:
    print("Start"+str(item.get('Start'))+"  "+"End"+str(item.get('End'))+"  "+"Strand"+str(item.get('Strand'))+"  "+"Sequence: "+str(item.get('Sequence')))

Update2

so far, I am sticking to this:

print(ecf+"  "+replicon+"  -  "+"Validated results: Total number of hits: "+str(len(finalList)))
print("")

for item in finalList:
    print("Start: "+str(item.get('Start'))+"  "+"End: "+str(item.get('End'))+"  "+"Strand: "+str(item.get('Strand'))+"  "+"Sequence: "+str(item.get('Sequence')))

which prints:

ECF02  pSymA  -  Validated results: Total number of hits: 284

Start: 2876  End: 2903  Strand: +  Sequence: GAACTACAGGAAGTTCATGGTCTCCTTC
Start: 2876  End: 2900  Strand: +  Sequence: GAACTACAGGAAGTTCATGGTCTCC
Start: 9214  End: 9238  Strand: +  Sequence: GAACGTCGGGCGCAAGAGCCGCTTT
...

please note: dictList was replaced by finalList. Due to parts of my script running before those prints

Body:
You could use .format_map(each_dic) or later Python 3.5+ added alternative .format(**each_dic). Uses each dict in the list in each print with formatting.

for each_dic in dictList:
    print('Sequence: {Sequence:<29} '
          'Start: {Start:>7} '
          'Strand: {Strand} '
          'End: {End:>7}'.format_map(each_dic))

Look at Python help page: string - Common string operations for further reference and examples.


问:
How to capture what parameters are passed to stored procedure inside ssis package runtime
I have a scenario where my client informed me that their sql server agent jobs fail sometimes. On investigation, we found that the sql agent job calls an ssis package, which internally calls an SP with parameters (?,?,?), and the error is being generated in TSQL inside SP as per the error message.

I want to capture the parameters to test SP execution in a new query window, manually. We do not have an SSDT tool in the client environment with which to debug the SSIS package to identify parameters, however we have imported the ssis package in SSMS.

Is there any way I can capture the parameter passed at runtime to SP via the ssis package in SSMS?

答: You can turn on sql server profiler and capture the queries being run againt the database when SSIS package is executed, there you can see what parameters being passed in.</p>


问:
In which specific cases are the two used - matplotlib.pyplot.imshow() and matplotlib.pyplot.show()?
I went through the documentation of both but the documentation does not specify for a specific use case for both. I have also found that sometimes the imshow() property on its own displays the figures but sometimes the show() property needs to be used to display the figure. In the documentation , the imshow() property mentions about displaying the image on the axes but the word "axes" is missing from the show() property. What does the word axes more specifically refer to?

imshow() documentation

show() documentation

答:
Except for both, imshow and show having the word "show" in them, they have nothing in common.

imshow is a plotting command. It is hence on the same level as other plotting commands like plot, scatter, pcolor, contour etc. Those plotting command will produce some graphical data representation inside an axes. An axes is essentially the rectangle you see around your plot.

plt.show() is the command you need to give at the end to produce the graphical output. It is the function which makes the figure which has previously been produced by one or more plotting commands to actually show up on screen - hence the name "show".

So you usually have

```<code>import matplotlib.pyplot as plt
<plotting command>
plt.show()
</code>```

E.g.

```<code>plt.scatter(...)
plt.show()
</code>```

or

```<code>plt.imshow(...)
plt.show()
</code>```

Now in some cases, depending on the environment where you run your code, the use of plt.show() is not needed. This is because the environment is aware of there being a matplotlib plot being generated and it will therefore generate its output automatically for you without the need to call plt.show(). This would be mainly inside of IPython sessions or Jupyter notebooks.

In summary: In order to produce a plot with an image, you call plt.imshow(..). Whether or not you then need to call plt.show() to invoke the representation on screen depends on the environment. In case you do not want to show the image on screen, but e.g. save it to a file instead, you would omit plt.show() and call

```<code>plt.imshow(...)
plt.savefig(...)
</code>```

instead.

Body:
Except for both, imshow and show having the word "show" in them, they have nothing in common.

imshow is a plotting command. It is hence on the same level as other plotting commands like plot, scatter, pcolor, contour etc. Those plotting command will produce some graphical data representation inside an axes. An axes is essentially the rectangle you see around your plot.

plt.show() is the command you need to give at the end to produce the graphical output. It is the function which makes the figure which has previously been produced by one or more plotting commands to actually show up on screen - hence the name "show".

So you usually have

import matplotlib.pyplot as plt
<plotting command>
plt.show()

E.g.

plt.scatter(...)
plt.show()

or

plt.imshow(...)
plt.show()

Now in some cases, depending on the environment where you run your code, the use of plt.show() is not needed. This is because the environment is aware of there being a matplotlib plot being generated and it will therefore generate its output automatically for you without the need to call plt.show(). This would be mainly inside of IPython sessions or Jupyter notebooks.

In summary: In order to produce a plot with an image, you call plt.imshow(..). Whether or not you then need to call plt.show() to invoke the representation on screen depends on the environment. In case you do not want to show the image on screen, but e.g. save it to a file instead, you would omit plt.show() and call

plt.imshow(...)
plt.savefig(...)

instead.


问:
Difference between a data warehouse and a MOLAP server
What is the difference between a data warehouse and a MOLAP server?
Is the data stored at both the data warehouse and on the MOLAP server?

When you pose a query, do you send it to the data warehouse or the MOLAP server?

With ROLAP, it kind of makes sense that the ROLAP server pose SQL queries to the data warehouse (which store fact and dimension tables), and then do the analysis. However, I have read somewhere that ROLAP gathers its data directly from the operational database (OLTP), but then, where/when is the data warehouse used?

答:
The 'MOLAP' flavour of OLAP (as distinguished from 'ROLAP') is a data store in its own right, separate from the Data Warehouse.

Usually, the MOLAP server gets its data from the Data Warehouse on a regular basis. So the data does indeed reside in both.

The difference is that a MOLAP server is a specific kind of database (cube) that precalculates totals at levels in hierarchies, and furthermore structures the data to be even easier for users to query and navigate than a data warehouse (with the right tools at their disposal).
Although a data warehouse may be dimensionally modelled, it is still often stored in a relational data model in an RDBMS.
Hence MOLAP cubes (or other modern alternatives) provide both performance gains and a 'semantic layer' that makes it easier to understand data stored in a data warehouse.

The user can then query the MOLAP server rather than the Data Warehouse. That doesn't stop users querying the Data Warehouse directly, if that's what your solution needs.

You're right that when the user queries a ROLAP server, it passes on the queries to the underlying database, which may be an OLTP system, but is more often going to be a data warehouse, because those are designed for reporting and query performance and understandability in mind. ROLAP therefore provides the user-friendly 'semantic layer' but relies on the performance of the data warehouse for speed of queries.


问:
Remove the # hash from URL when using Vue.js in Laravel Homestead
I have a Laravel 5.2 setup running in Homestead and using Vue.js router to build an SPA. I'm trying to completely remove the #hash from the URL which I know can be done, but I keep getting errors:

I've added rewrite ^(.+)$ /index.html last; to my vhosts file in Homestead:

```<code>server {

    listen 80;
    listen 443 ssl;
    server_name app.myproject.dev;
    root "/home/vagrant/Code/vibecast/app.myproject.com/public";

    rewrite ^(.+)$ /index.html last;

    index index.html index.htm index.php;

    charset utf-8;

    ...

}
</code>```

When I restart and open a page I get a 500 Internal Server Error.

Is there anything I need added to routes in Laravel?

```<code>var router = new VueRouter({
    hashbang: false,
    history: true,
    linkActiveClass: "active"
})
</code>```

I can get it working without the #hash (or the modified hosts file) when navigating around, but fails when I reload a page.

答:
You can make Vue Router and Laravel Router work together nicely by making the following changes:

At the end of your routes/web.php add the next lines:

```<code>Route::get('{path}', function() {
  return view('your-vuejs-main-blade');
})->where('path', '.*');
</code>```

You need to add this at the end of file because you need to preserve the previously declared laravel routes in order to work properly and not be overwritten by the 404 page or vue-router's paths.

In your Vue router's config use the following:

```<code>import Vue from 'vue'
import Router from 'vue-router'

Vue.use(Router)

let router = new Router({
    mode: 'history', //removes # (hashtag) from url
    base: '/',
    fallback: true, //router should fallback to hash (#) mode when the browser does not support history.pushState
    routes: [
        { path: '*', require('../components/pages/NotFound.vue') },
        //... + all your other paths here
    ]
})
export default router
</code>```

However, when navigating between laravel and vue-router, you need to keep in mind that leaving vue-router's page to a laravel page you must use a window.location.href code, an  tag or some sort of programmatic navigation in order to fully exit Vue-router's instance.

Tested this with Laravel 5.5.23, Vue 2.5.9, Vue-Router 3.0.1

Body:
I have a Laravel 5.2 setup running in Homestead and using Vue.js router to build an SPA. I'm trying to completely remove the #hash from the URL which I know can be done, but I keep getting errors:

I've added rewrite ^(.+)$ /index.html last; to my vhosts file in Homestead:

server {

    listen 80;
    listen 443 ssl;
    server_name app.myproject.dev;
    root "/home/vagrant/Code/vibecast/app.myproject.com/public";

    rewrite ^(.+)$ /index.html last;

    index index.html index.htm index.php;

    charset utf-8;

    ...

}

When I restart and open a page I get a 500 Internal Server Error.

Is there anything I need added to routes in Laravel?

var router = new VueRouter({
    hashbang: false,
    history: true,
    linkActiveClass: "active"
})

I can get it working without the #hash (or the modified hosts file) when navigating around, but fails when I reload a page.

Body:
You can make Vue Router and Laravel Router work together nicely by making the following changes:

At the end of your routes/web.php add the next lines:

Route::get('{path}', function() {
  return view('your-vuejs-main-blade');
})->where('path', '.*');

You need to add this at the end of file because you need to preserve the previously declared laravel routes in order to work properly and not be overwritten by the 404 page or vue-router's paths.

In your Vue router's config use the following:

import Vue from 'vue'
import Router from 'vue-router'

Vue.use(Router)

let router = new Router({
    mode: 'history', //removes # (hashtag) from url
    base: '/',
    fallback: true, //router should fallback to hash (#) mode when the browser does not support history.pushState
    routes: [
        { path: '*', require('../components/pages/NotFound.vue') },
        //... + all your other paths here
    ]
})
export default router

However, when navigating between laravel and vue-router, you need to keep in mind that leaving vue-router's page to a laravel page you must use a window.location.href code, an <a> tag or some sort of programmatic navigation in order to fully exit Vue-router's instance.

Tested this with Laravel 5.5.23, Vue 2.5.9, Vue-Router 3.0.1


问:
Bootstrap 4 Glyphicons not showing on Angular 4 project
I'm working on an Angular 4 Project using Bootstrap 4 with Sass, and I want to use the glyphicons but when I use the following code:

```<code><button class="btn btn-sm btn-primary"><span class="glyphicon glyphicon-thumbs-up"></span>Like</button>
</code>```

For example, when making a "like" button, the icon doesn't show.

I configured the project to compile the SCSS stylesheets with the ng-serve command, my angular-cli.json looks like this:

```<code>{
  "$schema": "./node_modules/@angular/cli/lib/config/schema.json",
  "project": {
    "name": "front-end-informatorio"
  },
  "apps": [
    {
      "root": "src",
      "outDir": "dist",
      "assets": [
        "assets",
        "favicon.ico"
      ],
      "index": "index.html",
      "main": "main.ts",
      "polyfills": "polyfills.ts",
      "test": "test.ts",
      "tsconfig": "tsconfig.app.json",
      "testTsconfig": "tsconfig.spec.json",
      "prefix": "app",
      "styles": [
        "../node_modules/bootstrap/scss/bootstrap.scss",
        "../node_modules/bootstrap/scss/main.scss"

      ],
      "scripts": [],
      "environmentSource": "environments/environment.ts",
      "environments": {
        "dev": "environments/environment.ts",
        "prod": "environments/environment.prod.ts"
      }
    }
  ],
  "e2e": {
    "protractor": {
      "config": "./protractor.conf.js"
    }
  },
  "lint": [
    {
      "project": "src/tsconfig.app.json",
      "exclude": "**/node_modules/**"
    },
    {
      "project": "src/tsconfig.spec.json",
      "exclude": "**/node_modules/**"
    },
    {
      "project": "e2e/tsconfig.e2e.json",
      "exclude": "**/node_modules/**"
    }
  ],
  "test": {
    "karma": {
      "config": "./karma.conf.js"
    }
  },
  "defaults": {
    "styleExt": "scss",
    "component": {}
  }
}
</code>```

I tried linking this in my index.html:

```<code><link data-require="bootstrap-css@3.3.6" data-semver="3.3.6" rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.css"/>
</code>```

It made the icons work, but also also changed the whole style of my project.

How do I achieve it without overlapping the styles?

答:
Bootstrap 4 dropped Glyphicons support. (see: https://getbootstrap.com/docs/4.0/migration/#components)

This means that you'll need to use some other icon font, like Font Awesome.

Quick start for Font Awesome

Grab the script from the get started page

Paste it in your

Start using! Search for the icons on FontAwesome.com

Explore the docs to unleash the full potential of Font Awesome!

Example:

<!DOCTYPE html>

    <meta charset="utf-8">
    <title>Bootstrap + Font Awesome</title>
    <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@4.0.0/dist/css/bootstrap.min.css">

That was easy!

      <button type="button" class="btn btn-primary">Works also with buttons! </button>

```

Angular Font Awesome component

The Font Awesome team is working on an Angular Font Awesome component. It is right now in pre-release, but you can find it here.

ContentLicense: CC BY-SA 4.0

Body:
I'm working on an Angular 4 Project using Bootstrap 4 with Sass, and I want to use the glyphicons but when I use the following code:

<button class="btn btn-sm btn-primary">Like</button>

For example, when making a "like" button, the icon doesn't show.

I configured the project to compile the SCSS stylesheets with the ng-serve command, my angular-cli.json looks like this:

{
  "$schema": "./node_modules/@angular/cli/lib/config/schema.json",
  "project": {
    "name": "front-end-informatorio"
  },
  "apps": [
    {
      "root": "src",
      "outDir": "dist",
      "assets": [
        "assets",
        "favicon.ico"
      ],
      "index": "index.html",
      "main": "main.ts",
      "polyfills": "polyfills.ts",
      "test": "test.ts",
      "tsconfig": "tsconfig.app.json",
      "testTsconfig": "tsconfig.spec.json",
      "prefix": "app",
      "styles": [
        "../node_modules/bootstrap/scss/bootstrap.scss",
        "../node_modules/bootstrap/scss/main.scss"

      ],
      "scripts": [],
      "environmentSource": "environments/environment.ts",
      "environments": {
        "dev": "environments/environment.ts",
        "prod": "environments/environment.prod.ts"
      }
    }
  ],
  "e2e": {
    "protractor": {
      "config": "./protractor.conf.js"
    }
  },
  "lint": [
    {
      "project": "src/tsconfig.app.json",
      "exclude": "**/node_modules/**"
    },
    {
      "project": "src/tsconfig.spec.json",
      "exclude": "**/node_modules/**"
    },
    {
      "project": "e2e/tsconfig.e2e.json",
      "exclude": "**/node_modules/**"
    }
  ],
  "test": {
    "karma": {
      "config": "./karma.conf.js"
    }
  },
  "defaults": {
    "styleExt": "scss",
    "component": {}
  }
}

I tried linking this in my index.html:

<link data-require="bootstrap-css@3.3.6" data-semver="3.3.6" rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.css"/>

It made the icons work, but also also changed the whole style of my project.

How do I achieve it without overlapping the styles?

Body:
Bootstrap 4 dropped Glyphicons support. (see: https://getbootstrap.com/docs/4.0/migration/#components)

This means that you'll need to use some other icon font, like Font Awesome.

Quick start for Font Awesome

Grab the script from the get started page

Paste it in your <head>

Start using! Search for the icons on FontAwesome.com

Explore the docs to unleash the full potential of Font Awesome!

Example:

<!DOCTYPE html>
<html>
  <head>
    <meta charset="utf-8">
    <title>Bootstrap + Font Awesome</title>
    <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@4.0.0/dist/css/bootstrap.min.css">
    <script defer src="https://use.fontawesome.com/releases/v5.0.8/js/all.js"></script>
  </head>
  <body>
    <div class="container">
      <!-- display 4 class makes the font size increase -->
      <h1 class="display-4"><i class="fab fa-stack-overflow"></i></h1>
      <p>That was easy! <i class="far fa-thumbs-up"></i></p>
      <button type="button" class="btn btn-primary">Works also with buttons! <i class="fas fa-link"></i></button>
    </div>
  </body>
</html>

Angular Font Awesome component

The Font Awesome team is working on an Angular Font Awesome component. It is right now in pre-release, but you can find it here.


问:
t-sql: dense rank that is increased at every occurence of a flag
I have a table that has Parent Rows and Children Rows.
The table consists of an increasing sequence, a row indicating whether it is a child or a parent and a code. I need to create ranking (an increasing number) that is increased only at every occurrence of IsParent column (values:0,1).

This is the table that I have: original table

This is the desirable result table: result table

答:
DDL and Sample data would be great, however, looks like you want to use a Window Function. This isn't tested with your data, but this should give you the expected output.</p>

```<code>SUM(IsParent) OVER (ORDER BY [Row Number]
                    ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW)
</code>```

Body:
DDL and Sample data would be great, however, looks like you want to use a Window Function. This isn't tested with your data, but this should give you the expected output.

SUM(IsParent) OVER (ORDER BY [Row Number]
                    ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW)


问:
Serve GeoServer Tiles in XYZ format
I am using GeoServer and seed tiles on my server. The tiles are created successfully but i dont know which pattern the directory structure is following... (i.e. .../EPSG_4326_05/0_0/00_06.png)
I want to use the tiles in a OpenLayers application and there i want to use a OSM source which is using the XYZ-pattern which is commonly used as URL pattern for tile-serving.
Is there a way to tell the geoserver it should create the tiles with the XYZ structure?</p>

答:
This may be too late by here is my XYZ URL for geoserver layer:

```<code>http://localhost/gwc/service/tms/1.0.0/gis:service@EPSG%3A900913@png/{z}/{x}/{-y}.png
</code>```

Geoserver will cache the tiles automatically as you request through URL.

Title: Serve GeoServer Tiles in XYZ format

Body:
This may be too late by here is my XYZ URL for geoserver layer:

http://localhost/gwc/service/tms/1.0.0/gis:service@EPSG%3A900913@png/{z}/{x}/{-y}.png

Geoserver will cache the tiles automatically as you request through URL.


问:
.net core mvc Mocking Identity and claims and test if user has claim
I'm trying to unit test my controller logic, it's a (.Net core 2 mvc App) I have a controller that returns details of an item if the user has specific claim, and I want to unit test that using XUnit.

Here is the controller:

```<code>public async Task<IActionResult> Details(int? id)
{
    if (id == null)
    {
        return NotFound();
    }

    var controlException = await _context.ControlException.FirstOrDefaultAsync(m => m.Id == id);

    if (controlException == null)
    {
        return NotFound();
    }
    if (User.HasClaim("control Claim", "control Claim"))
    {
            return View(controlException);
    }
    else
    {
        return RedirectToAction("AccessDenied", "Account");
    }

}
</code>```

My Unit test code is : (GetContextWithData() return InMemory test Database)

```<code>[Fact]
public async Task VerifyDetailsViewType()
{

    using (var context = GetContextWithData())
    using (var _controller = new ControlExceptionsController(context))
    {
        var userStore = new Mock<IUserStore<ApplicationUser>>();

        var userManager = new UserManager<ApplicationUser>(
                         userStore.Object, null, null, null, null, null, null, null, null);

        var cp = new Mock<ClaimsPrincipal>();
        cp.Setup(m => m.HasClaim(It.IsAny<string>(), It.IsAny<string>()))
          .Returns(true);
        cp.Setup(m => m.Identity).Returns(identityMock.Object);

        _controller.ControllerContext.HttpContext = new DefaultHttpContext();
        _controller.ControllerContext.HttpContext.Request.Headers["Referer"] = "http://www.test.nl";

        var result = await _controller.Details(888);
        Assert.IsType<ViewResult>(result);
    }
}
</code>```

My test failed because the result is "RedirectToAction" and not "ViewResult".

I know because the user does't have the claim, so the question is how can I assign a claim to the user, in other words how can I mock the Identity and claims and manage this.

答:
You need to assign the principal to the controller to allow the code to exercise to completion as desired.

You mock the principal but do not assign it to the controller in the test.

```<code>_controller.ControllerContext.HttpContext.User = cp.Object;
</code>```

Body:
I'm trying to unit test my controller logic, it's a (.Net core 2 mvc App) I have a controller that returns details of an item if the user has specific claim, and I want to unit test that using XUnit.

Here is the controller:

public async Task<IActionResult> Details(int? id)
{
    if (id == null)
    {
        return NotFound();
    }

    var controlException = await _context.ControlException.FirstOrDefaultAsync(m => m.Id == id);

    if (controlException == null)
    {
        return NotFound();
    }
    if (User.HasClaim("control Claim", "control Claim"))
    {
            return View(controlException);
    }
    else
    {
        return RedirectToAction("AccessDenied", "Account");
    }

}

My Unit test code is : (GetContextWithData() return InMemory test Database)

[Fact]
public async Task VerifyDetailsViewType()
{

    using (var context = GetContextWithData())
    using (var _controller = new ControlExceptionsController(context))
    {
        var userStore = new Mock<IUserStore<ApplicationUser>>();

        var userManager = new UserManager<ApplicationUser>(
                         userStore.Object, null, null, null, null, null, null, null, null);

        var cp = new Mock<ClaimsPrincipal>();
        cp.Setup(m => m.HasClaim(It.IsAny<string>(), It.IsAny<string>()))
          .Returns(true);
        cp.Setup(m => m.Identity).Returns(identityMock.Object);

        _controller.ControllerContext.HttpContext = new DefaultHttpContext();
        _controller.ControllerContext.HttpContext.Request.Headers["Referer"] = "http://www.test.nl";

        var result = await _controller.Details(888);
        Assert.IsType<ViewResult>(result);
    }
}

My test failed because the result is "RedirectToAction" and not "ViewResult".

I know because the user does't have the claim, so the question is how can I assign a claim to the user, in other words how can I mock the Identity and claims and manage this.

Body:
You need to assign the principal to the controller to allow the code to exercise to completion as desired.

You mock the principal but do not assign it to the controller in the test.

_controller.ControllerContext.HttpContext.User = cp.Object;


问:
Checking to see if a MySQL row is populated
I have a page that writes to a MySQL table. The table has a set amount of rows (24).

I have an $id variable that's set by a rand() function. I basically want to pull the row at that $id, so if $id was 3, I want to pull the third row. Then, I want to check if there is a price set at that row (indicating that the row is being used). If there is no price, I want to keep $id at the value it has been set at and proceed with the query. If there is a price, I want to re-randomize the $id variable, and check again if that row is used up. When it finds an empty row, proceed with the query.

My solution semi-works, but it seems to have a <10% chance of overwriting a used row, for some reason. I want it to never overwrite a used row.

Here's my code:

```<code>    mysql_select_db("delives0_booklet", $con);

    $query = "SELECT * FROM booklet WHERE id = '$id'";

    $res = mysql_query($query,$con);

    $newId = $id;

    while($row = mysql_fetch_array($res))
    {
        if($row['price'] != 0)
        {
            do{
                $newId = rand(1, 24);
            }while($newId == $id);
        }
    }
    $id = $newId;
    mysql_query("UPDATE booklet SET price = '$price', advertiser = '$advertiser', image = '$image', monthsRemaining = '$monthsRemaining', availability = 1 WHERE id = '$id'");
</code>```

Edit
I had the idea to do this. I loop through the table and I put the 'id' of each unfilled spot into an array. Then I pick randomly from that array. However, there seems to be a bug that I can't find, since the array keeps showing as having nothing in it, even after the loop is run, and $i is the correct figure.

```<code>        mysql_select_db("delives0_booklet", $con);

    $query = "SELECT * FROM booklet";

    $res = mysql_query($query,$con);
    $i = 0;
    $isEmpty = array();

    while($row = mysql_fetch_array($res))
    {

            if($row['price'] == 0)
            {
                $isEmpty[i] = $row['id'];
                $i = $i + 1;
            }
    }
    echo $i . " unfilled spots.";
    $n = 0;
    while($n<$i)
    {
        echo $isEmpty[$n];
        $n = $n + 1;
    }
    if($i > 0)
    {
        $id = $isEmpty[rand(0, $i)];
    }
    if($i == 0)
    {
        echo 'All spots have been filled.';
    }
</code>```

答:
If I understand the problem correct, this should work:</p>

```<code>SELECT *
FROM booklet
WHERE price = 0 OR price IS NULL
ORDER BY RAND()
</code>```

ContentLicense: CC BY-SA 2.5

Body:
I have a page that writes to a MySQL table. The table has a set amount of rows (24).

I have an $id variable that's set by a rand() function. I basically want to pull the row at that $id, so if $id was 3, I want to pull the third row. Then, I want to check if there is a price set at that row (indicating that the row is being used). If there is no price, I want to keep $id at the value it has been set at and proceed with the query. If there is a price, I want to re-randomize the $id variable, and check again if that row is used up. When it finds an empty row, proceed with the query.

My solution semi-works, but it seems to have a <10% chance of overwriting a used row, for some reason. I want it to never overwrite a used row.

Here's my code:

    mysql_select_db("delives0_booklet", $con);

    $query = "SELECT * FROM booklet WHERE id = '$id'";

    $res = mysql_query($query,$con);

    $newId = $id;

    while($row = mysql_fetch_array($res))
    {
        if($row['price'] != 0)
        {
            do{
                $newId = rand(1, 24);
            }while($newId == $id);
        }
    }
    $id = $newId;
    mysql_query("UPDATE booklet SET price = '$price', advertiser = '$advertiser', image = '$image', monthsRemaining = '$monthsRemaining', availability = 1 WHERE id = '$id'");

Edit
I had the idea to do this. I loop through the table and I put the 'id' of each unfilled spot into an array. Then I pick randomly from that array. However, there seems to be a bug that I can't find, since the array keeps showing as having nothing in it, even after the loop is run, and $i is the correct figure.

        mysql_select_db("delives0_booklet", $con);

    $query = "SELECT * FROM booklet";

    $res = mysql_query($query,$con);
    $i = 0;
    $isEmpty = array();

    while($row = mysql_fetch_array($res))
    {

            if($row['price'] == 0)
            {
                $isEmpty[i] = $row['id'];
                $i = $i + 1;
            }
    }
    echo $i . " unfilled spots.";
    $n = 0;
    while($n<$i)
    {
        echo $isEmpty[$n];
        $n = $n + 1;
    }
    if($i > 0)
    {
        $id = $isEmpty[rand(0, $i)];
    }
    if($i == 0)
    {
        echo 'All spots have been filled.';
    }

Body:
If I understand the problem correct, this should work:

SELECT *
FROM booklet
WHERE price = 0 OR price IS NULL
ORDER BY RAND()


问:
offline location tracking
I want to draw employee's live location and traveled path ,

I am running a service in background continuously to get location details and storing to server , at admin side I am drawing the path by those records stored in db.

I am getting the path like  a square in offline while am able to clearly in online

how can i store the correct lat long values in server in offline,

I want to draw the path clearly in offline also ,how can I achieve that, please suggest me a way, thank you.

答: Create a local Database and store locations in it. Whenever internet connected send these values to server. You can draw path from local Db or Server values.

Title: offline location tracking


问:
Stata input command not allowing local macros
I found this curious behavior in the input command for Stata.

When you pass a local macro as an argument either for one variable or multiple, the input command gives this error:

'`' cannot be read as a number

Here are two examples that give the same error:

```<code>clear
local nums 1 1 1
input a b c
    `nums'
end

clear
local num 1
input a b c
    1 1 `num'
end
</code>```

Is there a way to pass macros into the input command?

答:
This is in substance largely a comment on the answer to Aaron Wolf, but the code makes it too awkward to fit in a physical comment.

Given stuff in a local, another way to do it is

```<code>clear
local num "1 1 1"
set obs 1

foreach v in a b c {
   gettoken this num : num
   gen `v' = `this'
}
</code>```

Naturally, there are many ways to get 1 1 1 into three variables.

Body:
I found this curious behavior in the input command for Stata.

When you pass a local macro as an argument either for one variable or multiple, the input command gives this error:

'`' cannot be read as a number

Here are two examples that give the same error:

clear
local nums 1 1 1
input a b c
    `nums'
end

clear
local num 1
input a b c
    1 1 `num'
end

Is there a way to pass macros into the input command?

Body:
This is in substance largely a comment on the answer to Aaron Wolf, but the code makes it too awkward to fit in a physical comment.

Given stuff in a local, another way to do it is

clear
local num "1 1 1"
set obs 1

foreach v in a b c {
   gettoken this num : num
   gen `v' = `this'
}

Naturally, there are many ways to get 1 1 1 into three variables.


问:
Can't get MySql string working from other cs file
i try to connect with my MySql connection in a other .cs file but i cant reach the connection string con which is located in the MySQL.cs here is the code i am using:

MainPage.cs

```<code>Data_Layer.MySQL mm = new Data_Layer.MySQL();

        private async void LoginKlik(object sender, EventArgs e)
        {

            try
            {
              mm.con.Open();
            }
         catch
         {}
         finally
         {}
</code>```

I am getting a red line under the line mm.con.Open(); with the statement inaccisebale due protection level

MySQL.cs

```<code>namespace VerlofXamarin.Data_Layer
{
    public class MySQL
    {
            MySqlConnection con = new MySqlConnection("Server=arabig.nl;Port=3306;database=arabignl_project;User Id=arabignl_project;Password=JariR0800;charset=utf8");
    }
}
</code>```

答:
This should do the trick:</p>

```<code>public MySqlConnection con = new MySqlConnection("Server=arabig.nl;Port=3306;database=arabignl_project;User Id=arabignl_project;Password=JariR0800;charset=utf8");
</code>```

Body:
i try to connect with my MySql connection in a other .cs file but i cant reach the connection string con which is located in the MySQL.cs here is the code i am using:

MainPage.cs

Data_Layer.MySQL mm = new Data_Layer.MySQL();

        private async void LoginKlik(object sender, EventArgs e)
        {

            try
            {
              mm.con.Open();
            }
         catch
         {}
         finally
         {}

I am getting a red line under the line mm.con.Open(); with the statement inaccisebale due protection level

MySQL.cs

namespace VerlofXamarin.Data_Layer
{
    public class MySQL
    {
            MySqlConnection con = new MySqlConnection("Server=arabig.nl;Port=3306;database=arabignl_project;User Id=arabignl_project;Password=JariR0800;charset=utf8");
    }
}

Body:
This should do the trick:

public MySqlConnection con = new MySqlConnection("Server=arabig.nl;Port=3306;database=arabignl_project;User Id=arabignl_project;Password=JariR0800;charset=utf8");


问:
How to dynamically disable cloudzoom depending on image width
I'm using cloudzoom and I have the following markup:

```<code><div id="container">
  <img id="main-image" class="cloudzoom" src="/img/image1.jpg" data-cloudzoom="variableMagnification: false, zoomOffsetX: 0, zoomPosition: 'inside', zoomImage: '/img-zoom/image1.jpg" />
  <div id="thumbnail-images">
    <img class='cloudzoom-gallery' src="/img/image2.jpg" data-cloudzoom="useZoom: '.cloudzoom', image: '/img/image2.jpg', zoomImage: '/img-zoom/image2.jpg'">
    <img class='cloudzoom-gallery' src="/img/image3.jpg" data-cloudzoom="useZoom: '.cloudzoom', image: '/img/image3.jpg', zoomImage: '/img-zoom/image3.jpg'">
  </div>
</div>
</code>```

I use this code to initialize cloudzoom:

```<code>$('#container', context).once('initiateCloudzoom').each(function () {
    CloudZoom.quickStart();
});
</code>```

This implementation is working fine, but my question is:

How do I disable cloudzoom if my main image is less than X pixels wide?

Also if when I click one of the thumbnails how do I disable or enable cloudzoom depending on the same condition (image width) once the image has been swapped.

Thanks in advance.

答:
Give disableZoom value to auto. It will disable only if zoom image is the same size or smaller than small image. Note, if you have set magnification levels larger than 1, zoom will not be disabled.</p>

```<code> <div id="container">
  <img id="main-image" class="cloudzoom" src="/img/image1.jpg" data-cloudzoom="variableMagnification: false, zoomOffsetX: 0, zoomPosition: 'inside', zoomImage: '/img-zoom/image1.jpg'" />
  <div id="thumbnail-images">
    <img class='cloudzoom-gallery' src="/img/image2.jpg" data-cloudzoom="useZoom: '.cloudzoom', image: '/img/image2.jpg', zoomImage: '/img-zoom/image2.jpg', disableZoom:'auto'">
    <img class='cloudzoom-gallery' src="/img/image3.jpg" data-cloudzoom="useZoom: '.cloudzoom', image: '/img/image3.jpg', zoomImage: '/img-zoom/image3.jpg', disableZoom:'auto'">
  </div>
</div>
</code>```

Body:
I'm using cloudzoom and I have the following markup:

I use this code to initialize cloudzoom:

$('#container', context).once('initiateCloudzoom').each(function () {
    CloudZoom.quickStart();
});

This implementation is working fine, but my question is:

How do I disable cloudzoom if my main image is less than X pixels wide?

Also if when I click one of the thumbnails how do I disable or enable cloudzoom depending on the same condition (image width) once the image has been swapped.

Thanks in advance.

Body:
Give disableZoom value to auto. It will disable only if zoom image is the same size or smaller than small image. Note, if you have set magnification levels larger than 1, zoom will not be disabled.

 <div id="container">
  <img id="main-image" class="cloudzoom" src="/img/image1.jpg" data-cloudzoom="variableMagnification: false, zoomOffsetX: 0, zoomPosition: 'inside', zoomImage: '/img-zoom/image1.jpg'" />
  <div id="thumbnail-images">
    <img class='cloudzoom-gallery' src="/img/image2.jpg" data-cloudzoom="useZoom: '.cloudzoom', image: '/img/image2.jpg', zoomImage: '/img-zoom/image2.jpg', disableZoom:'auto'">
    <img class='cloudzoom-gallery' src="/img/image3.jpg" data-cloudzoom="useZoom: '.cloudzoom', image: '/img/image3.jpg', zoomImage: '/img-zoom/image3.jpg', disableZoom:'auto'">
  </div>
</div>


问:
How to insert an item into an array that's in an array that's also in an array
I'm trying to insert an item into an multidimensional array and I don't know how to do that.</p>

```<code>    Meteor.users.update(
       { _id: Meteor.userId() }, { $push: {profile: { friends: "hey" } }}
    );
</code>```

答:
```<code>Meteor.users.update(
   { _id: Meteor.userId() }, { $push: {'profile.friends': 'hey'} }
 );
</code>```

Body:
I'm trying to insert an item into an multidimensional array and I don't know how to do that.

    Meteor.users.update(
       { _id: Meteor.userId() }, { $push: {profile: { friends: "hey" } }}
    );


问:
How to get class name from static method?
I'm programming with Qt5.9.  When in a NON static method I can get the class name using:

```<code>    metaObject->className();
</code>```

Is it possible to get the class name when in a static method?

答: QObject::staticMetaObject should do the trick.

Body:
I'm programming with Qt5.9.  When in a NON static method I can get the class name using:

    metaObject->className();

Is it possible to get the class name when in a static method?


问:
dyld: Library not loaded: /usr/local/lib/liblua.5.1.5.dylib
I got the following error while trying to invoke terminal Vim (terminal app from MacVim directory); after I updated homebrew, rvm & reinstalled a new version of Ruby.

```<code>dyld: Library not loaded: /usr/local/lib/liblua.5.1.5.dylib
  Referenced from: /Applications/MacVim.app/Contents/MacOS/Vim
  Reason: image not found
</code>```

Note: Was able to solve it, so  thought I would record if someone stumbles on the same issue.

答:
I use vim installed by homebrew ,my solution is reinstall vim

run
brew reinstall vim

Body:
I got the following error while trying to invoke terminal Vim (terminal app from MacVim directory); after I updated homebrew, rvm & reinstalled a new version of Ruby.

dyld: Library not loaded: /usr/local/lib/liblua.5.1.5.dylib
  Referenced from: /Applications/MacVim.app/Contents/MacOS/Vim
  Reason: image not found

Note: Was able to solve it, so  thought I would record if someone stumbles on the same issue.


问:
Update multiple columns based on a single condition in kdb
I have a table -

```<code>q)t
a b  c
--------
1 10 100
3 20 200
2 30 300
1 40 400
2 50 500
</code>```

I wish to update column b and c values based on a single 'if' condition on column a. For example -

```<code>t:update b:0 from t where a=1
t:update c:0 from t where a=1
</code>```

I could use vector conditional but don't want to as it would evaluate the condition twice for each row and my table has large number of rows.

```<code>update b:?[a=1;0;b], c:?[a=1;0;c] from t
</code>```

Is there any way I can do it in so that 'a=1' condition is evaluated only once for each row?

Edit : I earlier missed mentioning that I want 'b' and 'c' to take some other values in 'else' condition and not just retain their original values -

```<code>update b:?[a=1;0;-1], c:?[a=1;0;-1] from t
</code>```

答:
If you'd like to use a vector conditional without evaluating the condition twice, you can evaluate it first e.g.

```<code>q)x:t.a=1
q)x
10010b
q)update b:?[x;0;-1],c:?[x;0;-1] from t
a b  c
--------
1 0  0
3 -1 -1
2 -1 -1
1 0  0
2 -1 -1
</code>```

Here you evaluate the condition and store the result in a variable, and then use that in the vector conditional

Alternatively you could do two update statements e.g.

```<code>t:update b:0, c:0 from t where a=1
t:update b:-1, c:-1 from t where a<>1
</code>```

Body:
I have a table -

q)t
a b  c
--------
1 10 100
3 20 200
2 30 300
1 40 400
2 50 500

I wish to update column b and c values based on a single 'if' condition on column a. For example -

t:update b:0 from t where a=1
t:update c:0 from t where a=1

I could use vector conditional but don't want to as it would evaluate the condition twice for each row and my table has large number of rows.

update b:?[a=1;0;b], c:?[a=1;0;c] from t

Is there any way I can do it in so that 'a=1' condition is evaluated only once for each row?

Edit : I earlier missed mentioning that I want 'b' and 'c' to take some other values in 'else' condition and not just retain their original values -

update b:?[a=1;0;-1], c:?[a=1;0;-1] from t

Body:
If you'd like to use a vector conditional without evaluating the condition twice, you can evaluate it first e.g.

q)x:t.a=1
q)x
10010b
q)update b:?[x;0;-1],c:?[x;0;-1] from t
a b  c
--------
1 0  0
3 -1 -1
2 -1 -1
1 0  0
2 -1 -1

Here you evaluate the condition and store the result in a variable, and then use that in the vector conditional

Alternatively you could do two update statements e.g.

t:update b:0, c:0 from t where a=1
t:update b:-1, c:-1 from t where a<>1


问:
How to capture what parameters are passed to stored procedure inside ssis package runtime
I have a scenario where my client informed me that their sql server agent jobs fail sometimes. On investigation, we found that the sql agent job calls an ssis package, which internally calls an SP with parameters (?,?,?), and the error is being generated in TSQL inside SP as per the error message.

I want to capture the parameters to test SP execution in a new query window, manually. We do not have an SSDT tool in the client environment with which to debug the SSIS package to identify parameters, however we have imported the ssis package in SSMS.

Is there any way I can capture the parameter passed at runtime to SP via the ssis package in SSMS?

答:
Modify your sp to capture the parameters before doing further processing. Like this :

```<code>    CREATE TABLE dbo.ProcParameters
    (
     SeqNo int identity(1,1),
    ProcNm VARCHAR(255),
    Param1 nvarchar(255),
    Param2 nvarchar(255),
ExecResult NVARCHAR(MAX),
    ExecTime DATETIME DEFAULT(GETDATE())
    )

    create procedure MyProc
    (
     @Param1 nvarchar(255),
    @Param2 nvarchar(255)
    )
    as
    begin
declare @Id int,@ExecResult NVARCHAR(MAX)

     insert into ProcParameters
    (
     ProcNm ,Param1 ,Param2
    )
    VALUES('MyProc',@Param1 ,@Param2)

select @id = @@identity
begin try
    /*

    Your Code goes here

    */
SET @ExecResult ='Success'

   end try
 BEGIN CATCH
select @ExecResult = ERROR_MESSAGE()
END CATCH

UPDATE ProcParameters
SET ExecResult = @ExecResult WHERE SeqNo = @id

    end
</code>```

Now, each time the proc is being executed, the values will be stored in the table ProcParameters and you can get it from there. Also, the result of each execution can be found in the column ExecResult.

Body:
Modify your sp to capture the parameters before doing further processing. Like this :

    CREATE TABLE dbo.ProcParameters
    (
     SeqNo int identity(1,1),
    ProcNm VARCHAR(255),
    Param1 nvarchar(255),
    Param2 nvarchar(255),
ExecResult NVARCHAR(MAX),
    ExecTime DATETIME DEFAULT(GETDATE())
    )

    create procedure MyProc
    (
     @Param1 nvarchar(255),
    @Param2 nvarchar(255)
    )
    as
    begin
declare @Id int,@ExecResult NVARCHAR(MAX)

     insert into ProcParameters
    (
     ProcNm ,Param1 ,Param2
    )
    VALUES('MyProc',@Param1 ,@Param2)

select @id = @@identity
begin try
    /*

    Your Code goes here

    */
SET @ExecResult ='Success'

   end try
 BEGIN CATCH
select @ExecResult = ERROR_MESSAGE()
END CATCH

UPDATE ProcParameters
SET ExecResult = @ExecResult WHERE SeqNo = @id

    end

Now, each time the proc is being executed, the values will be stored in the table ProcParameters and you can get it from there. Also, the result of each execution can be found in the column ExecResult.


问:
How to search for a specified value within an array using jquery
I would like to search for a specific value in an array and return its index.

html:

```<code><div class="container">
  <div class="col-md-6">
    <div id="task0">Task0</div>
  </div>
  <div class="col-md-6">
    <div id="task1">Task1</div>
    <div id="task2">Task2</div>
    <div id="task3">Task3</div>
    <div id="task4">Task4</div>
  </div>
</div>
</code>```

jquery:

```<code>$(document).ready(function() {

  $childArr = $(".col-md-6:last").children().toArray();

  $indexNumber = $.inArray("div#task3", $childArr);

  console.log($indexNumber);

});
</code>```

Unfortunately I get -1. This means that the specified value was not found. But why do I get the -1 ?
If i output the $childArr in console.log I get an array with this values (4) [div#task1, div#task2, div#task3, div#task4].

https://jsfiddle.net/DTcHh/39987/

答:
As Sylwek and Suren Srapyan answers you don't have to use toArray() to accomplish what you want. However if you want to keep this logic you can use the findIndex() function

$(document).ready(function() {

  $childArr = $(".col-md-6:last").children().toArray();

  $indexNumber = $childArr.findIndex(function(child){return child.id == "task3"})

  console.log($indexNumber);
  console.log($childArr);

});```
<pre class="snippet-code-html lang-html prettyprint-override"><code><script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<div class="container">
  <div class="col-md-6">
    <div id="task0">Task0</div>
  </div>
  <div class="col-md-6">
    <div id="task1">Task1</div>
    <div id="task2">Task2</div>
    <div id="task3">Task3</div>
    <div id="task4">Task4</div>
  </div>
</div></code>```

Body:
I would like to search for a specific value in an array and return its index.

html:

Task0

Task1

Task2

Task3

Task4

jquery:

$(document).ready(function() {

  $childArr = $(".col-md-6:last").children().toArray();

  $indexNumber = $.inArray("div#task3", $childArr);

  console.log($indexNumber);

});

Unfortunately I get -1. This means that the specified value was not found. But why do I get the -1 ?
If i output the $childArr in console.log I get an array with this values (4) [div#task1, div#task2, div#task3, div#task4].

https://jsfiddle.net/DTcHh/39987/

Body:
As Sylwek and Suren Srapyan answers you don't have to use toArray() to accomplish what you want. However if you want to keep this logic you can use the findIndex() function

$(document).ready(function() {

  $childArr = $(".col-md-6:last").children().toArray();

  $indexNumber = $childArr.findIndex(function(child){return child.id == "task3"})

  console.log($indexNumber);
  console.log($childArr);

});

<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<div class="container">
  <div class="col-md-6">
    <div id="task0">Task0</div>
  </div>
  <div class="col-md-6">
    <div id="task1">Task1</div>
    <div id="task2">Task2</div>
    <div id="task3">Task3</div>
    <div id="task4">Task4</div>
  </div>
</div>


问:
How to skip the first n rows in sql query
I want to fire a Query "SELECT * FROM TABLE" but select only from row N+1. Any idea on how to do this?

答:
try below query it's work

```<code>SELECT * FROM `my_table` WHERE id != (SELECT id From my_table LIMIT 1)
</code>```

Hope this will help

Body:
try below query it's work

SELECT * FROM `my_table` WHERE id != (SELECT id From my_table LIMIT 1)

Hope this will help


问:
Count of images uploaded in a page
i have created with some X number of images, i want the total count of images to be displayed on top. kindly help me out how can i do this using Java Script or jQuery.</p>

```<code><div class="images">
        <div class="slide">
        <img class="photo"  src="img001.jpg">
        <p>image description</p>
            <button>Delete</button>
        </div>
        <div class="slide">
        <img src="img002.jpg">
        <p>image description</p>
            <button>Delete</button>
        </div>
        <div class="slide">
        <img src="img003.jpg">
        <p>image description</p>
            <button>Delete</button>
        </div>
        <div class="slide">
        <img src="img003.jpg">
        <p>image description</p>
            <button>Delete</button>
        </div>
        <div class="slide">
        <img src="img002.jpg">
        <p>image description</p>
            <button>Delete</button>
        </div>
        <div class="slide">
        <img src="img001.jpg">
        <p>image description</p>
            <button>Delete</button>
        </div>

    </div>
</code>```

答:
```<code>$('.images img').length
</code>```

Should get you all the img tags inside a .images class

Title: Count of images uploaded in a page

Body:
i have created with some X number of images, i want the total count of images to be displayed on top. kindly help me out how can i do this using Java Script or jQuery.

image description

            <button>Delete</button>

image description

            <button>Delete</button>

image description

            <button>Delete</button>

image description

            <button>Delete</button>

image description

            <button>Delete</button>

image description

            <button>Delete</button>

Body:
$('.images img').length

Should get you all the img tags inside a .images class