Dexter  Goodwin

Dexter Goodwin

1623150540

Leveraging Webpack Power to Import All Files From one Folder.

Did you know that apart from import  and require  there are some Webpack specific methods that you can use directly in your components to import files you need ? Let me tell you the story of how I figured it out.

Using Require to load images

In our codebase, we had a component that rendered some logos in the footer.

It looked something like this:

And the code looked like this:

<template>
  <div class="_game-provider-logos">
    <div class="container-fluid">
      <b-img-lazy :src="logoNetent" alt="Netent Logo" fluid />
      <b-img-lazy :src="logoYggrasil" alt="Yggrasil logo" fluid />
      <b-img-lazy :src="logoScientificGames" alt="Scientific Games logo" fluid />
      <b-img-lazy :src="logoMicrogaming" alt="Microgaming logo" fluid />
      <b-img-lazy :src="logoSlingo" alt="Slingo logo" fluid />
    </div>
  </div>
</template>

<script>
  export default {
    name: 'FooterGameProviders',
    created () {
      this.logoMicrogaming = require(`@/assets/images/footer/microgaming.png`)
      this.logoNetent = require(`@/assets/images/footer/netent.png`)
      this.logoScientificGames = require(`@/assets/images/footer/scientific-games.png`)
      this.logoSlingo = require(`@/assets/images/footer/slingo.png`)
      this.logoYggrasil = require(`@/assets/images/footer/yggdrasil.png`)
    }
  }
</script>

So, as you can see it was a pretty much dummy component. It just imported some images from the asset folder using require function and displayed them using the bootstrap component.

#image-loading #vue #javascript #webpack

What is GEEK

Buddha Community

Leveraging Webpack Power to Import All Files From one Folder.

Umeng Analytics & Push Flutter Plugins

Umeng Analytics&Push Flutter Plugins(umeng_analytics_push) 

  • Language: English | 中文简体
  • Umeng API: umeng:analytics & umeng:push
  • Tip: From v2.1.0 supported Umeng "Compliance Guide" Android IOS, and made appropriate adjustments to facilitate integration.
  • Note: The following document description shall prevail, do not refer to the settings in the example

Usages

Import

dependencies:
  umeng_analytics_push: ^x.x.x #The latest version is shown above, plugin1.x supports flutter1.x, plugin2.x supports flutter2.x

# Or import through Git (choose one, Git version may be updated more timely)

dependencies:
  umeng_analytics_push:
      git:
        url: https://github.com/zileyuan/umeng_analytics_push.git

Android pretreatment settings (with Kotlin example)

Create a custom FlutterApplication class as the startup class, if the push function is not needed, uemng_message_secret is set to null or ""

package com.demo.umeng.app

import io.flutter.app.FlutterApplication
import io.github.zileyuan.umeng_analytics_push.UmengAnalyticsPushFlutterAndroid

class MyFlutterApplication: FlutterApplication() {
    override fun onCreate() {
        super.onCreate();
        UmengAnalyticsPushFlutterAndroid.androidPreInit(this, "uemng_app_key", "channel", "uemng_message_secret")
    }
}

Modify MainActivity, add Umeng settings

package com.demo.umeng.app

import android.os.Handler
import android.os.Looper
import android.content.Intent
import androidx.annotation.NonNull;
import io.flutter.embedding.android.FlutterActivity
import io.flutter.embedding.engine.FlutterEngine
import io.flutter.plugins.GeneratedPluginRegistrant
import io.github.zileyuan.umeng_analytics_push.UmengAnalyticsPushFlutterAndroid
import io.github.zileyuan.umeng_analytics_push.UmengAnalyticsPushPlugin

class MainActivity: FlutterActivity() {
    var handler: Handler = Handler(Looper.myLooper())

    override fun configureFlutterEngine(@NonNull flutterEngine: FlutterEngine) {
        GeneratedPluginRegistrant.registerWith(flutterEngine);
    }

    override fun onNewIntent(intent: Intent) {
        // Actively update and save the intent every time you go back to the front desk, and then you can get the latest intent
        setIntent(intent);
        super.onNewIntent(intent);
    }

    override fun onResume() {
        super.onResume()
        UmengAnalyticsPushFlutterAndroid.androidOnResume(this)
        if (getIntent().getExtras() != null) {
            var message = getIntent().getExtras().getString("message")
            if (message != null && message != "") {
                // To start the interface, wait for the engine to load, and send it to the interface with a delay of 5 seconds
                handler.postDelayed(object : Runnable {
                    override fun run() {
                        UmengAnalyticsPushPlugin.eventSink.success(message)
                    }
                }, 5000)
            }
        }
    }

    override fun onPause() {
        super.onPause()
        UmengAnalyticsPushFlutterAndroid.androidOnPause(this)
    }
}

Modify the AndroidManifest.xml file

<application
  android:name="com.demo.umeng.app.MyFlutterApplication">
</application>

Add the vendor push channel, see the official documentation for details umeng:push:vendor

Modify MyFlutterApplication

package com.demo.umeng.app

import io.flutter.app.FlutterApplication
import io.github.zileyuan.umeng_analytics_push.UmengAnalyticsPushFlutterAndroid

class MyFlutterApplication: FlutterApplication() {
    override fun onCreate() {
        super.onCreate();
        UmengAnalyticsPushFlutterAndroid.androidInit(this, "uemng_app_key", "channel", "uemng_message_secret")
        // Register Xiaomi Push (optional)
        UmengAnalyticsPushFlutterAndroid.registerXiaomi(this, "xiaomi_app_id", "xiaomi_app_key")
        // Register Huawei Push (optional, need add other infomation in AndroidManifest.xml)
        UmengAnalyticsPushFlutterAndroid.registerHuawei(this)
        // Register Oppo Push (optional)
        UmengAnalyticsPushFlutterAndroid.registerOppo(this, "oppo_app_key", "oppo_app_secret")
        // Register Vivo Push (optional, need add other infomation in AndroidManifest.xml)
        UmengAnalyticsPushFlutterAndroid.registerVivo(this)
        // Register Meizu Push (optional)
        UmengAnalyticsPushFlutterAndroid.registerMeizu(this, "meizu_app_id", "meizu_app_key")
    }
}

Modify the AndroidManifest.xml, fill in the real id or key

<application
  android:name="com.demo.umeng.app.MyFlutterApplication">
    <!-- Vivo push channel start (optional) -->
    <meta-data
        android:name="com.vivo.push.api_key"
        android:value="vivo_api_key" />
    <meta-data
        android:name="com.vivo.push.app_id"
        android:value="vivo_app_id" />
    <!-- Vivo push channel end-->

    <!-- Huawei push channel start (optional) -->
    <meta-data
        android:name="com.huawei.hms.client.appid"
        android:value="appid=huawei_app_id" />
    <!-- Huawei push channel end-->
</application>

Use the following parameters to send, accept offline messages

"mipush": true
"mi_activity": "io.github.zileyuan.umeng_analytics_push.OfflineNotifyClickActivity"  

If the App needs to use proguard for obfuscated packaging, please add the following obfuscated code

-dontwarn com.umeng.**
-dontwarn com.taobao.**
-dontwarn anet.channel.**
-dontwarn anetwork.channel.**
-dontwarn org.android.**
-dontwarn org.apache.thrift.**
-dontwarn com.xiaomi.**
-dontwarn com.huawei.**
-dontwarn com.meizu.**

-keepattributes *Annotation*

-keep class com.taobao.** {*;}
-keep class org.android.** {*;}
-keep class anet.channel.** {*;}
-keep class com.umeng.** {*;}
-keep class com.xiaomi.** {*;}
-keep class com.huawei.** {*;}
-keep class com.meizu.** {*;}
-keep class org.apache.thrift.** {*;}

-keep class com.alibaba.sdk.android.** {*;}
-keep class com.ut.** {*;}
-keep class com.ta.** {*;}

-keep public class **.R$* {
    public static final int *;
}

IOS pretreatment settings (with Swift example)

Modify AppDelegate.swift file

import UIKit
import Flutter

@UIApplicationMain
@objc class AppDelegate: FlutterAppDelegate {
    override func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
        GeneratedPluginRegistrant.register(with: self)
        UmengAnalyticsPushFlutterIos.iosPreInit(launchOptions, appkey:"uemng_app_key", channel:"appstore");
        return super.application(application, didFinishLaunchingWithOptions: launchOptions)
    }

    // If you need to handle Push clicks, use the following code
    @available(iOS 10.0, *)
    override func userNotificationCenter(_ center: UNUserNotificationCenter, didReceive response: UNNotificationResponse, withCompletionHandler completionHandler: @escaping () -> Void) {
        let userInfo = response.notification.request.content.userInfo
        UmengAnalyticsPushFlutterIos.handleMessagePush(userInfo)
        completionHandler()
    }
}

Modify Runner-Bridging-Header.h file

#import "GeneratedPluginRegistrant.h"
#import <UMCommon/UMCommon.h>
#import <UMCommon/MobClick.h>
#import <UMPush/UMessage.h>
#import <UserNotifications/UserNotifications.h>
#import <umeng_analytics_push/UmengAnalyticsPushIos.h>

Use in Flutter

Initialize Umeng, call it after agreeing to the "Privacy Policy" according to the "Compliance Guide", two parameter switches, one is log, the other is push

import 'package:umeng_analytics_push/umeng_analytics_push.dart';

UmengAnalyticsPush.initUmeng(false, true);

Click Push response

import 'package:umeng_analytics_push/umeng_analytics_push.dart';
import 'package:umeng_analytics_push/message_model.dart';

UmengAnalyticsPush.addPushMessageCallback((MessageModel message) {
  print("UmengAnalyticsPush Message ======> $message");
});

Operation Alias

import 'package:umeng_analytics_push/umeng_analytics_push.dart';

UmengAnalyticsPush.addAlias('1001', 'jobcode');
UmengAnalyticsPush.setAlias('1002', 'jobcode');
UmengAnalyticsPush.deleteAlias('1002', 'jobcode');

Operation Tags

import 'package:umeng_analytics_push/umeng_analytics_push.dart';

UmengAnalyticsPush.addTags('manager');
UmengAnalyticsPush.deleteTags('manager');

Page buried point operation

import 'package:umeng_analytics_push/umeng_analytics_push.dart';

UmengAnalyticsPush.pageStart('memberPage');
UmengAnalyticsPush.pageEnd('memberPage');

Custom event

import 'package:umeng_analytics_push/umeng_analytics_push.dart';

UmengAnalyticsPush.event('customEvent', '1000');

Use this package as a library

Depend on it

Run this command:

With Flutter:

 $ flutter pub add umeng_analytics_push

This will add a line like this to your package's pubspec.yaml (and run an implicit flutter pub get):

dependencies:
  umeng_analytics_push: ^2.1.3

Alternatively, your editor might support or flutter pub get. Check the docs for your editor to learn more.

Import it

Now in your Dart code, you can use:

import 'package:umeng_analytics_push/umeng_analytics_push.dart';

example/lib/main.dart

import 'package:flutter/material.dart';

void main() => runApp(MyApp());

class MyApp extends StatefulWidget {
  @override
  _MyAppState createState() => _MyAppState();
}

class _MyAppState extends State<MyApp> {

  @override
  void initState() {
    super.initState();
  }

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        appBar: AppBar(
          title: const Text('Plugin example app'),
        ),
        body: Center(
        ),
      ),
    );
  }
} 

Download Details:

Author: zileyuan

Source Code: https://github.com/zileyuan/umeng_analytics_push

#flutter #analytics 

Simpliv LLC

Simpliv LLC

1582887678

Training Course on Leverage the Power of Generations | Simpliv

Description
There are now 4 generations in the workplace and our assumptions of the generations is getting in the way of our work. Are you getting along with your team members?

Leverage the Power of Generations aims to generate discussions and open-mindedness that leads to innovative solutions between all age groups. This “generation” course truly applies to every audience and organisation to understand that everyone has something to learn and everyone has something to teach.

Through bite-sized lessons including videos (20 minutes), written material and exercises from your own toolkit, the course focuses on creating common bonds among generations and looking at our differences as assets that can create real change. It is how we choose to work together that determines our success for the future.

Who is the target audience?

Individuals, managers and HR professionals
Basic knowledge
Come with an open mind to learn
What will you learn
To establish that there is conflict among the generations and this is nothing new
Learn that our assumptions about the generations are not always correct
Choose to see our differences among the generations as opportunities not challenges
Learn to be curious, be respectful and find common ground through a common experience
Use tools to guide you to change your perception of the generations
Determine who can help you lead the change process
Understand that everyone has something to learn and something to teach, no matter their generation
Create a dynamic culture of cooperation among the generations

ENROLL

#Leverage The Power Of Generations #Training Course on Leverage the Power of Generations #Leverage the Power of Generations - simpliv #Leverage

How To Delete File From Public Folder In Laravel

In this post we will see how to remove/delete file from public storage, today I will give you demo how to remove file from storage folder in laravel.

So, here I will explain how to delete image from storage folder using Laravel File System and php function file_exists() and unlink().

How To Delete File From Public Folder In Laravel

https://websolutionstuff.com/post/how-to-delete-file-from-public-folder-in-laravel

#how to delete file from public folder in laravel #laravel #php #file #how to delete file from storage folder in laravel #laravel 6 remove file from public folder

Dexter  Goodwin

Dexter Goodwin

1623150540

Leveraging Webpack Power to Import All Files From one Folder.

Did you know that apart from import  and require  there are some Webpack specific methods that you can use directly in your components to import files you need ? Let me tell you the story of how I figured it out.

Using Require to load images

In our codebase, we had a component that rendered some logos in the footer.

It looked something like this:

And the code looked like this:

<template>
  <div class="_game-provider-logos">
    <div class="container-fluid">
      <b-img-lazy :src="logoNetent" alt="Netent Logo" fluid />
      <b-img-lazy :src="logoYggrasil" alt="Yggrasil logo" fluid />
      <b-img-lazy :src="logoScientificGames" alt="Scientific Games logo" fluid />
      <b-img-lazy :src="logoMicrogaming" alt="Microgaming logo" fluid />
      <b-img-lazy :src="logoSlingo" alt="Slingo logo" fluid />
    </div>
  </div>
</template>

<script>
  export default {
    name: 'FooterGameProviders',
    created () {
      this.logoMicrogaming = require(`@/assets/images/footer/microgaming.png`)
      this.logoNetent = require(`@/assets/images/footer/netent.png`)
      this.logoScientificGames = require(`@/assets/images/footer/scientific-games.png`)
      this.logoSlingo = require(`@/assets/images/footer/slingo.png`)
      this.logoYggrasil = require(`@/assets/images/footer/yggdrasil.png`)
    }
  }
</script>

So, as you can see it was a pretty much dummy component. It just imported some images from the asset folder using require function and displayed them using the bootstrap component.

#image-loading #vue #javascript #webpack

sophia tondon

sophia tondon

1620885491

Microsoft Power BI Consulting | Power BI Solutions in India

Hire top dedicated Mirosoft power BI consultants from ValueCoders who aim at leveraging their potential to address organizational challenges for large-scale data storage and seamless processing.

We have a team of dedicated power BI consultants who help start-ups, SMEs, and enterprises to analyse business data and get useful insights.

What are you waiting for? Contact us now!

No Freelancers, 100% Own Staff
Experienced Consultants
Continuous Monitoring
Lean Processes, Agile Mindset
Non-Disclosure Agreement
Up To 2X Less Time

##power bi service #power bi consultant #power bi consultants #power bi consulting #power bi developer #power bi development