working on it ...

Filters

Explore Public Snippets

Sort by

Found 42k snippets

    external by benhenda89  1  0  2  0

    Broadleaf Commerce: No "Structured Content" admin menu item

    I'm totally new to Broadleaf Commerce and trying to understand why I don't have any "Structured Content" menu item mentioned here I figured out the sql data got moved to a folder called "old" which added the missing menu item: See here. Still after running those SQL statements there's no Content Structured Content menu item. My guess was that i
    /* 
    Greeting,
    Use this script 
     */
    INSERT INTO BLC_ADMIN_SECTION (ADMIN_SECTION_ID, DISPLAY_ORDER, ADMIN_MODULE_ID, NAME, SECTION_KEY, URL, CEILING_ENTITY) VALUES (-22000, 2000, -2, 'Structured Content', 'StructuredContent', '/structured-content', 'org.broadleafcommerce.cms.structure.domain.StructuredContent');
    
    INSERT INTO BLC_ADMIN_PERMISSION (ADMIN_PERMISSION_ID, DESCRIPTION, IS_FRIENDLY, NAME, PERMISSION_TYPE) VALUES (-22918, 'Maintain Structured Contents', 1, 'PERMISSION_STRUCTUREDCONTENT', 'ALL');
    INSERT INTO BLC_ADMIN_PERMISSION (ADMIN_PERMISSION_ID, DESCRIPTION, IS_FRIENDLY, NAME, PERMISSION_TYPE) VALUES (-22917, 'View Structured Contents', 1, 'PERMISSION_STRUCTUREDCONTENT', 'READ');
    INSERT INTO BLC_ADMIN_PERMISSION (ADMIN_PERMISSION_ID, DESCRIPTION, IS_FRIENDLY, NAME, PERMISSION_TYPE) VALUES (-22916, 'Read Structured Content Template', 0, 'PERMISSION_READ_STRUCTURED_CONTENT_TEMPLATE', 'READ');
    INSERT INTO BLC_ADMIN_PERMISSION (ADMIN_PERMISSION_ID, DESCRIPTION, IS_FRIENDLY, NAME, PERMISSION_TYPE) VALUES (-22915, 'All Structured Content', 0, 'PERMISSION_ALL_STRUCTURED_CONTENT', 'ALL');
    INSERT INTO BLC_ADMIN_PERMISSION (ADMIN_PERMISSION_ID, DESCRIPTION, IS_FRIENDLY, NAME, PERMISSION_TYPE) VALUES (-22914, 'Read Structured Content', 0, 'PERMISSION_READ_STRUCTURED_CONTENT', 'READ');
    
    
    INSERT INTO BLC_ADMIN_PERMISSION_ENTITY (ADMIN_PERMISSION_ENTITY_ID, CEILING_ENTITY, ADMIN_PERMISSION_ID) VALUES (-22046, 'org.broadleafcommerce.cms.structure.domain.StructuredContent', -22914);
    INSERT INTO BLC_ADMIN_PERMISSION_ENTITY (ADMIN_PERMISSION_ENTITY_ID, CEILING_ENTITY, ADMIN_PERMISSION_ID) VALUES (-22047, 'org.broadleafcommerce.cms.structure.domain.StructuredContent', -22915);
    INSERT INTO BLC_ADMIN_PERMISSION_ENTITY (ADMIN_PERMISSION_ENTITY_ID, CEILING_ENTITY, ADMIN_PERMISSION_ID) VALUES (-22048, 'org.broadleafcommerce.cms.structure.domain.StructuredContentItemCriteria', -22914);
    INSERT INTO BLC_ADMIN_PERMISSION_ENTITY (ADMIN_PERMISSION_ENTITY_ID, CEILING_ENTITY, ADMIN_PERMISSION_ID) VALUES (-22049, 'org.broadleafcommerce.cms.structure.domain.StructuredContentItemCriteria', -22915);
    INSERT INTO BLC_ADMIN_PERMISSION_ENTITY (ADMIN_PERMISSION_ENTITY_ID, CEILING_ENTITY, ADMIN_PERMISSION_ID) VALUES (-22050, 'org.broadleafcommerce.common.locale.domain.Locale', -22914);
    INSERT INTO BLC_ADMIN_PERMISSION_ENTITY (ADMIN_PERMISSION_ENTITY_ID, CEILING_ENTITY, ADMIN_PERMISSION_ID) VALUES (-22051, 'org.broadleafcommerce.common.locale.domain.Locale', -22915);
    INSERT INTO BLC_ADMIN_PERMISSION_ENTITY (ADMIN_PERMISSION_ENTITY_ID, CEILING_ENTITY, ADMIN_PERMISSION_ID) VALUES (-22052, 'org.broadleafcommerce.cms.structure.domain.StructuredContentType', -22914);
    INSERT INTO BLC_ADMIN_PERMISSION_ENTITY (ADMIN_PERMISSION_ENTITY_ID, CEILING_ENTITY, ADMIN_PERMISSION_ID) VALUES (-22054, 'org.broadleafcommerce.cms.structure.domain.StructuredContentType', -22915);
    INSERT INTO BLC_ADMIN_PERMISSION_ENTITY (ADMIN_PERMISSION_ENTITY_ID, CEILING_ENTITY, ADMIN_PERMISSION_ID) VALUES (-22053, 'org.broadleafcommerce.cms.structure.domain.StructuredContentFieldTemplate', -22914);
    INSERT INTO BLC_ADMIN_PERMISSION_ENTITY (ADMIN_PERMISSION_ENTITY_ID, CEILING_ENTITY, ADMIN_PERMISSION_ID) VALUES (-22055, 'org.broadleafcommerce.cms.structure.domain.StructuredContentFieldTemplate', -22915);
    
    
    
    INSERT INTO BLC_ADMIN_PERMISSION_XREF (CHILD_PERMISSION_ID, ADMIN_PERMISSION_ID) VALUES (-22916, -22918);
    INSERT INTO BLC_ADMIN_PERMISSION_XREF (CHILD_PERMISSION_ID, ADMIN_PERMISSION_ID) VALUES (-22915, -22918);
    INSERT INTO BLC_ADMIN_PERMISSION_XREF (CHILD_PERMISSION_ID, ADMIN_PERMISSION_ID) VALUES (-22916, -22917);
    INSERT INTO BLC_ADMIN_PERMISSION_XREF (CHILD_PERMISSION_ID, ADMIN_PERMISSION_ID) VALUES (-22914, -22917);
    
    
    INSERT INTO BLC_ADMIN_SEC_PERM_XREF (ADMIN_SECTION_ID, ADMIN_PERMISSION_ID) VALUES (-22000, -22918);
    INSERT INTO BLC_ADMIN_SEC_PERM_XREF (ADMIN_SECTION_ID, ADMIN_PERMISSION_ID) VALUES (-22000, -22917);
    
    
    INSERT INTO blc_admin_role_permission_xref (ADMIN_ROLE_ID, ADMIN_PERMISSION_ID) VALUES (-1, -22918);
    INSERT INTO blc_admin_role_permission_xref (ADMIN_ROLE_ID, ADMIN_PERMISSION_ID) VALUES (-1, -22917);
    
    
    /* 
    
     */
    

    external by dayanrr91  1  0  3  0

    Issues with swagger after migrating to .NET Core 3.0

    After migrating to .NET Core 3.0. I'm having issues configuring swagger. Following is my configuration. public void ConfigureServices(IServiceCollection services) { services.AddMvc().SetCompatibilityVersion(Microsoft.AspNetCore.Mvc.CompatibilityVersion.Version_3_0).AddNewtonsoftJson(); services.AddSwaggerGen(setup =&g
    /* 
    In Net Core 3.0:
    I was trying to configure the ReferenceLoopHandling and for me the selected answer didn't work, so I found this alternative, in the ConfigureServices please add:
     */
    public void ConfigureServices(IServiceCollection services)
    {           
        services.AddMvc().AddNewtonsoftJson(options =>
        {
           options.SerializerSettings.ReferenceLoopHandling = ReferenceLoopHandling.Ignore;
        });
    }
    
    
    /* 
    
     */
    

    external by StackOverflow  1  0  2  0

    Laravel 5.7 Email Verification Link Broken

    At the moment I'm trying to implement the Laravel 5.7 email verification. I have got it so a mail driver will send an email out when registering a user. However, when I click on the email verify button, I get a 404 error. The URL it sends me is this: http://localhost/email/verify/16?expires=1543926629&signature=fa3a2a0d90c5752f99b24a7cf7c789e
    /* 
    Verify in your Http\Controllers\Auth\VerificationController.php if the protected attribute $redirectTo value exist in your routes\web.php or can be handled.
     */
    

    external by Andino Inyang  1  0  2  0

    Why is my Laravel 5.7 session not working?

    I'm trying to get sessions to work in Laravel 5.7, but I can't seem to get it working; I'm not sure why. I've looked at the official docs, looked at a bunch of SO posts, done Googling for the issue on other sites, and I still can't figure it out. Basically, I've got a route like the following in web.php: Route::get('/some_path', 'SomeController@i
    /* 
    Most times all you need is to append the 'middleware function to the route, e.g
     */
    Route::get('/some_path', 'SomeController@index')->middleware('web');
    
    
    /* 
    Then clear cache:
     */
    php artisan config:clear
    php artisan route:clear
    
    
    /* 
    
     */
    

    external by Watercayman  1  0  3  0

    How can I get the user name who posted the post (laravel 5.8)

    I'm try to get the user name who create the post witch is (Problem model), I do not know what is wrong I have try Eager Loading in laravel documentation and I have check these Questions 1 Questions 2 and still get null or Trying to get property 'name' of non-object if I use dd( $problem->user->name); I use laravel 5.8 ProblemsController.ph
    /* 
    Your User model is looking for a user_id field within the problems table to make the relationship work.  Laravel automatically creates the relationship using a snake case for the model relationship using the name of the model + '_id'.
    
    If you change your foreign key on the problems table to user_id instead of addedBy, this will work as it stands.
    
    Or, if you wish to keep the addedBy key, you will need to tell Laravel that you are using a non-standard key.  So, on your User model:
     */
    public function problem()
    {
        return $this->hasMany('App\Problems', 'addedBy');
    }
    
    
    /* 
    should do the trick.  See the docs here.
    
    Unfortunately, it also looks like you haven't defined the actual FK on the table perhaps.  Before the foreign designation, I would expect to see something like:
     */
    $table->unsignedInteger('user_id');
    $table->foreign('user_id')->references('id')->on('users');
    
    
    /* 
    Or if using a newer version of Laravel:
     */
     $table->unsignedBigInteger('user_id');
     $table->foreign('user_id')->references('id')->on('users');
    
    
    /* 
    The docs for migrations are here for V6.
     */
    

    external by StackOverflow  1  0  3  0

    How to add two submit buttons on one form in Struts 2

    I'm developing an application using Struts2. My application is for online shopping. My task is updating and removing the shopping cart item. I have a JSP page and it has 4 text fields. I need to submit these text field's data to the Modify action. Updating and removing submit buttons are in same page, same form. How do I determine which is the butt
    /* 
      How to add 2 submit buttons in one form in struts2
    
    
    Seems you have already done it, type="button" means a button type="submit" is generated via the Struts tag, but you could use type="submit. For description you can refer the documentation. Not much difference between them, because any of them submit the form. If you want to execute different action or method of the action class then you could use additional attributes like action or method in the submit tag.  
    
    
      How do I determine which is the button I've clicked on jsp form
    
    
    It depends on where do you want to do it on the client side or on the server side, or both. On the client side you can use javascript to handle events of the form or the button itself. The code is separated by the different handler, so in the handler you exactly know the element that triggered the event, or use an object target attribute to determine that like in this answer. On the server side you can use a value attribute of the input or button tag that is generated and passed as a parameter by name. Note, not all HTML browsers work with the button value attribute. 
     */
    

    external by StackOverflow  1  0  3  0

    Is there UI inspector tool similar to hawkeye that works with .net 4.5?

    I'm working with a winforms application that is targeting .net 4.5 and I really need to inspect the UI elements. I've used Snoop to inspect wpf elements in the past, and I've come across Hawekeye as well. However, it appears hawkeye is not compatible with .net 4.5. Are there any tools out there than can give me similar results?
    /* 
    Try the nuget package: WinForm.Inspector.Tool
    
    Setup documentation
    
    
    Instantiate the Inspector in your project.
    
    Inspector inspector = new Inspector();
    Ignore specific controls ex. buttons.
    
    inspector.IgnoreTypes = new Type[] { typeof(Button) };
    Skip controls ex. invisible and disabled.
    
    inspector.SkipChilds = GetChildAtPointSkip.Invisible | GetChildAtPointSkip.Disabled;
    
    
    Run your project and press Ctrl + F8 to open the ControlViewer.
    
    Hold down Alt and move your mouse over the controllers to select them.
     */
    

    external by Chirag Khatri  1  0  2  0

    Laravel 5.8 - Eloquent not listening to where on relation

    I'm trying to do a where query on my relation called employee_label. The table employee_label looks like this: +----+-------------+----------+ | id | employee_id | label_id | +----+-------------+----------+ | 1 | 123 | 123 | | 2 | 456 | 456 | | 3 | 768 | 768 | +----+-------------+----------+ The other w
    /* 
    I think you forgot to return your $query object
    
    Instead of
     */
    $query->where('label_id', '=', $request->get('label'));
    
    
    /* 
    Try returning your $query from a employee_label callback method
     */
    return $query->where('label_id', '=', $request->get('label'));
    
    
    /* 
    
     */
    

    external by StackOverflow  1  0  2  0

    .Net Core 3.0 object Type set value

    I'm trying to build my .net core 3.0 web api project but stuck on a statement last 4 days. Here is my problem. I have a filtration model called "GridFilter" this model looks like this : public class GridFilter { public string Operator { get; set; } public string Field { get; set; } public object Value { get; set
    /* 
    Hard so say much without your deserialize code, but: this works fine:
    
    using Newtonsoft.Json;
    using System;
    using System.Collections.Generic;
    using System.Linq;
    
    static class Program
    {
        static void Main()
        {
            var request = @"{""filter"": {""filters"": [{""field"": ""SCT_CATEGORY"", ""value"": 10000, ""operator"": ""eq""}]}}";
            var obj = JsonConvert.DeserializeObject<Request>(request);
            var filter = obj.Filter.Filters.Single();
            Console.WriteLine(filter.Operator); // "eq"
            Console.WriteLine(filter.Logic); // null
            Console.WriteLine(filter.Value); // 10000
            Console.WriteLine(filter.Value2); // null
            Console.WriteLine(filter.Field); // SET_CATEGORY
        }
    }
    public class Request // just to shape the json
    {
        public RequestFilters Filter { get; set; }
    }
    public class RequestFilters // just to shape the json
    {
        public List<GridFilter> Filters { get; } = new List<GridFilter>();
    }
    public class GridFilter
    {
        public string Operator { get; set; }
        public string Field { get; set; }
        public object Value { get; set; }
        public object Value2 { get; set; }
        public string Logic { get; set; }
    }
    
    
    If you also want to be able to serialize retaining the case, you'd need to tell the serializer:
    
    public class Request // just to shape the json
    {
        [JsonProperty("filter")]
        public RequestFilters Filter { get; set; }
    }
    public class RequestFilters // just to shape the json
    {
        [JsonProperty("filters")]
        public List<GridFilter> Filters { get; } = new List<GridFilter>();
    }
    public class GridFilter
    {
        [JsonProperty("operator")]
        public string Operator { get; set; }
        [JsonProperty("field")]
        public string Field { get; set; }
        [JsonProperty("value")]
        public object Value { get; set; }
        [JsonProperty("value2")]
        public object Value2 { get; set; }
        [JsonProperty("logic")]
        public string Logic { get; set; }
    }
     */
    

    external by gregomebije  1  0  2  0

    Laravel 5.7 not sending verify emails

    after successful registration my app doesn't send verification email (It only sends to emails on my domain) and I'm redirected to /email/verify as if it was sent (checked spam and promotion folders). On other hand my forget password system works like a charm so I guess my .env is good. Here are my routes for auth and verification: Route::group([
    /* 
    Add a routeNotificationForMail() method in your App\User that returns the email address you’d like email notifications sent to. In the code below, my ‘email’ field contains the email address for each user
     */
    class User extends Authenticatable implements MustVerifyEmail
    {
        use Notifiable;
        //...
        public function routeNotificationForMail($notification)
        {
           return $this->email;
        }
    }
    
    
    /* 
    
     */
    
    • Public Snippets
    • Channels Snippets