在设备上调试sqlite数据库(Debugging sqlite database on the device)
我目前正在为Android的WiFi应用程序工作。 我无法尝试访问设备上的数据库。 仿真器中的调试对我来说不起作用,因为模拟器中没有WiFi支持。 我试图通过使用将数据库文件拉出设备
adb pull data/data/package-name/databases/database-name
但是我收到错误“权限被拒绝”。 在这个答案中Android:数据库文件存储在哪里? Commonsware建议通过在调试模式下运行来提取数据库文件。 但它也不行。 任何帮助如何调试数据库而不生根设备将不胜感激。
I am presently working on an WiFi application for Android. I am having trouble trying to access the database on the device. Debugging in the emulator doesn't work for me, because there is no WiFi support in the emulator. I tried pulling the database file out of the device by using
adb pull data/data/package-name/databases/database-name
But I get the error "Permission denied.". In this answer Android: Where are database files stored?, Commonsware has suggested to pull database file by running in debug mode. But it doesn't work too. Any help on how to debug the database without rooting the device would be much appreciated.
原文:https://stackoverflow.com/questions/6928849
最满意答案
一个解决方案是将两个变量刷新到会话中:
- 消息本身
- 你的警报的“类”
例如:
Session::flash('message', 'This is a message!'); Session::flash('alert-class', 'alert-danger');
然后在你的看法:
@if(Session::has('message')) <p class="alert {{ Session::get('alert-class', 'alert-info') }}">{{ Session::get('message') }}</p> @endif
注意我已经在
Session::get()
放置了一个默认值 。 这样你只需要覆盖它,如果警告应该是除了alert-info
类以外的东西。(这是一个快速的例子,未经测试:))
One solution would be to flash two variables into the session:
- The message itself
- The "class" of your alert
for example:
Session::flash('message', 'This is a message!'); Session::flash('alert-class', 'alert-danger');
Then in your view:
@if(Session::has('message')) <p class="alert {{ Session::get('alert-class', 'alert-info') }}">{{ Session::get('message') }}</p> @endif
Note I've put a default value into the
Session::get()
. that way you only need to override it if the warning should be something other than thealert-info
class.(that is a quick example, and untested :) )
相关问答
更多-
req.flash()旨在为您提供所有消息的平面列表,或者包含特定类型的所有消息的平面列表。 无论哪种方式,消息对象本身都不会告诉您类型,因为假设您已经知道它。 但是,如果req.flash()由req.session.flash支持,则可以使用自己的功能。 首先,您需要准备自己的消息列表,其中包含您想要的信息,以便您可以将其传递给您的视图。 例如, var messagesByType = req.session.flash || {}, allMessages = []; Object.keys ...
-
为了访问我的理解中的$errors ,你必须将它添加到ErrorBag中,所以你可以这样做: return redirect()->route('admin.events.create')->withErrors('not_found', $e->getMessage); 然后你可以访问$errors变量并在视图中找到它。 更新:对于那些可能在Google搜索结果中找到此答案的人: 基于这两个答案: 这里和这里以及OP的确认: 将Illuminate \ Session \ Middleware \ St ...
-
一个解决方案是将两个变量刷新到会话中: 消息本身 你的警报的“类” 例如: Session::flash('message', 'This is a message!'); Session::flash('alert-class', 'alert-danger'); 然后在你的看法: @if(Session::has('message'))
{{ Session::get( ...
-
Laravel 5 laracasts flash消息不显示错误div(Laravel 5 laracasts flash messaging not showing error div)[2022-11-29]
只需将flash:消息更改为Session :: put,并确保它们位于“web”中间件组下。 Route::group(['middleware' => ['web']], function () { Route::get('/', function () { return view('index'); }); Route::post('sendemail', function () { $data = array( 'n ... -
在Laravel 5中,如何使用href自定义会话flash消息(In Laravel 5, How to customize Session flash message with href)[2023-07-19]
使用此代码 在route.php中添加路由 Route::get('/resend_mail', 'VerificationMailController@resend'); //replace with your desired location 在VerificationMailController.php中 public function resend(){ //do your resend verification mail code } 比使用此代码显示重新发送消息 if ($user ... -
Laravel 5 - 通过示例不能正常工作来实现Flash消息(Laravel 5 - Implement Flash Messages with example not working)[2023-07-01]
正如你在例子中看到的,你必须执行重定向来使用flash消息(例如,使用back()或redirect()助手)。 它们在下一个请求中可见,而不是当前的。 As you can see in examples, you have to perform redirect to use flash messages (eg. with back() or redirect() helpers). They are visible on the next request, not current one. -
没有太大区别,例如,前者是用于在会话中存储用户输入的常用任务的便利方法,以便在验证失败时重新填充表单。 There isn't much difference, the former is a convenience method for the commonly needed task of storing the user's input in a session in order to repopulate the form if validation fails, for example.
-
Laravel 4:页面刷新时不会消失会话Flash消息(Laravel 4: Session Flash Message Not Disappearing on Page Refresh)[2023-07-23]
这不是一个合适的人吗? return View::make('superadmin::login')->with('message', 'Invalid credentials'); 然后在你看来: @if($message)@endif 这是因为你不需要闪光,因为在闪光后你永远不会使用重定向。 Wouldn't this be a beter ... -
你应该以这种方式调试 清除sessions文件夹中的所有文件 在您的控制器中,您可以使用任何给定的两种方式创建Flash消息 Session::flash('error', 'error message'); return redirect()->back(); 要么 return redirect()->action('Controller@method', $var)->with('error', ['error message']); 然后在你的刀片 @if (Session::has(' ...
-
在Illuminate\Session\Store类中,您可以找到存储会话时调用的save方法。 Aka实际上是session_set_save_handler 。 https://github.com/laravel/framework/blob/7acc98e112cce4e04f30c7ee4fc0a53dbc5c425b/src/Illuminate/Session/Store.php#L261 在那一行$this->ageFlashData(); 方法被调用。 该方法包含以下代码 $thi ...