Laravel 5 get view name

Update your AppServiceProvider by adding a view composer to the boot method and using ‘*’ to share it with all views: <?php namespace App\Providers; use Illuminate\Support\ServiceProvider; class AppServiceProvider extends ServiceProvider { /** * Bootstrap any application services. * * @return void */ public function boot() { view()->composer(‘*’, function($view){ $view_name = str_replace(‘.’, ‘-‘, $view->getName()); view()->share(‘view_name’, $view_name); … Read more

Does JPA support mapping to sql views?

While using the @Id annotation with fields of directly supported types is not the only way to specify an entity’s identity (see @IdClass with multiple @Id annotations or @EmbeddedId with @Embedded), the JPA specification requires a primary key for each entity. That said, you don’t need entities to use JPA with database views. As mapping … Read more

Row Rank in a MySQL View

Use: SELECT t.id, t.variety, (SELECT COUNT(*) FROM TABLE WHERE id < t.id) +1 AS NUM FROM TABLE t It’s not an ideal manner of doing this, because the query for the num value will execute for every row returned. A better idea would be to create a NUMBERS table, with a single column containing a … Read more

[iOS]How to make a “snapshot” of the current view’s state

I would suggest doing this: Have a method that creates an image out of the contents of the view. -(UIImage*) makeImage { UIGraphicsBeginImageContext(self.view.bounds.size); [self.view.layer renderInContext:UIGraphicsGetCurrentContext()]; UIImage *viewImage = UIGraphicsGetImageFromCurrentImageContext(); UIGraphicsEndImageContext(); return viewImage; } Create a custom init method for your modal view, and also give your modalView an instance variable that can hold a UIImage … Read more

How to set foreground attribute to other non FrameLayout view

The idea is to surround your layout with a FrameLayout, and set the selector and the onClick event to this layout. <FrameLayout xmlns:android=”http://schemas.android.com/apk/res/android” android:id=”@+id/selectableItem” android:layout_width=”wrap_content” android:layout_height=”wrap_content” android:foreground=”@drawable/foreground_row” > <RelativeLayout xmlns:android=”http://schemas.android.com/apk/res/android” xmlns:app=”http://schemas.android.com/apk/res-auto” android:id=”@+id/cardContent” android:layout_width=”match_parent” android:layout_height=”match_parent” android:background=”@drawable/row_background”> … </RelativeLayout> </FrameLayout> You can find a full explanation at my blog: http://antonioleiva.com/unveiling-bandhook-foreground-any-layout/ Or you can extend rhis FRelativeLayout https://gist.github.com/shakalaca/6199283