50% Off/-

50% Off/-

Php

50% Off/-

50% Off/-

Web

50% Off/-

50% Off/-

Latest Added Tutorials

version: "3.2" services: zookeeper: image: bitnami/zookeeper:3 ports: - 2181:2181 environment: ALLOW_ANONYMOUS_LOGIN: "yes" kafka-0: image: bitnami/kafka:2 ports: - 9092:9092 environment: KAFKA_CFG_ZOOKEEPER_CONNECT: zookeeper:2181 ALLOW_PLAINTEXT_LISTENER: "yes" KAFKA_LISTENERS: >- INTERNAL://:29092,EXTERNAL://:9092 KAFKA_ADVERTISED_LISTENERS: >- INTERNAL://kafka-0:29092,EXTERNAL://localhost:9092 KAFKA_LISTENER_SECURITY_PROTOCOL_MAP: >- INTERNAL:PLA...Continue Reading
We can integrate JWTS token for Spring REST API by using following component: import io.jsonwebtoken.Claims; import io.jsonwebtoken.JwtParser; import io.jsonwebtoken.Jwts; import io.jsonwebtoken.impl.DefaultClaims; import io.jsonwebtoken.io.Decoders; import io.jsonwebtoken.security.Keys; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.stereotype.Component; import java.util.Date; import java.util.function.Function; @Component public class JwtUtils { private static final Logger logger = LoggerFactory.getLogger(J...Continue Reading
Normally Glassfish looks at the cacerts.jks certificate file stored in the GLASSFISH_SERVER\glassfish\domains\domain1\config location.You can change this configuration or replace cacerts.jks file with your cacerts file. There are some default JVM Options which Glassfish is used:      -XX:+UnlockDiagnosticVMOptions      -XX:NewRatio=2      -XX:MaxPermSize=192m      -Xmx512m      -client      -javaagent:C:/glassfish5/glassfish/li...Continue Reading
First Step: localhost:8081 when you encounter a user login screen, run this code:  - select account_status from dba_users where username = 'ANONYMOUS'; if you encounter this error: SP2-0640: Not connected, firstly run this code: sqlplus /nolog - alter user ANONYMOUS identified by anonymous; - alter user ANONYMOUS account unlock;
Flutter TextFormField Phone Number Formatter Converts phone number 00000000 to (000) 000 0000 class PhoneNumberFormatter extends TextInputFormatter { PhoneNumberFormatter(); @override TextEditingValue formatEditUpdate( TextEditingValue oldValue, TextEditingValue newValue, ) { if (!oldValue.text.contains("(") && oldValue.text.length >= 10 && newValue.text.length != oldValue.text.length) { return TextEditingValue( text: "", selection: TextSelection.collapsed(offset: 0), ); }...Continue Reading
class ApiHelper { static const String BASE_PATH = "http://api.example.com"; static const String API_PATH = "/api"; Future<ApiResponseModel> request(String url, {Map<String, String> queryParameters, bearerToken = '', isSSL = false}) async { return _innerRequest(url, 'GET',bearerToken,isSSL); } Future<ApiResponseModel> _innerRequest(String url, String type, [postParams,bearerToken = '']) async { url = _getUrl(url); Dio dio = _getDio(bearerToken); try { var response; if(type=='GET')...Continue Reading
PostsDataSource class PostsDataSource(private val scope: CoroutineScope) : PageKeyedDataSource<Int, Question>() { private val repository = QuestionRepository() override fun loadInitial( params: LoadInitialParams<Int>, callback: LoadInitialCallback<Int, Question> ) { scope.launch { try { val response = repository.getQuestionsAsync(1) when { response.success -> { val listing = response.data val...Continue Reading
Fragment import android.os.Bundle import androidx.fragment.app.Fragment import android.view.LayoutInflater import android.view.View import android.view.ViewGroup import androidx.lifecycle.Observer import androidx.lifecycle.ViewModelProvider import androidx.recyclerview.widget.LinearLayoutManager import com.codesenior.period.tracker.R import com.codesenior.period.tracker.adapters.QuestionAdapter import com.codesenior.period.tracker.factories.QuestionViewModelFactory import com.codesenior.period.tracker.repositories.QuestionRepository import kotlinx.andr...Continue Reading
Events abstract class CounterEvent {} class IncrementEvent extends CounterEvent{} class DecrementEvent extends CounterEvent{} Bloc Class import 'dart:async'; import 'package:fluttertemplate/blocs/bloc.dart'; import 'counter_event.dart'; /// More Detail: /// https://www.didierboelens.com/2018/08/reactive-programming-streams-bloc/ /// https://pub.dev/documentation/rxdart/latest/ /// https://blog.soshace.com/understanding-flutter-bloc-pattern/ class CounterBloc extends Bloc { int _counter = 0; final _counterStateController = StreamController<i...Continue Reading
Number Increment Decrement Widget import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; import 'package:kadir_alkan_kuafor/models/general_model.dart'; import 'package:kadir_alkan_kuafor/models/number_increment_decrement_model.dart'; class NumberIncrementDecrement extends StatefulWidget { final NumberIncrementDecrementModel numberIncrementDecrementModel; NumberIncrementDecrement({Key key, this.numberIncrementDecrementModel}) : super(key: key); @override StateContinue Reading
We can use FTPClient class in apache commons library to send UTF-8 encoded file names, such as Turkish, chinese, german etc. ftpClient = new FTPClient(); String server ="ftp.server.com"; int port = 21; String user ="test"; String pass ="test"; ftpClient.setControlEncoding("UTF-8");//must be before connect() method ftpClient.connect(server, port); ftpClient.login(user, pass); ftpClient.enterLocalPassiveMode(); ftpClient.setFileType(FTP.BINARY_FILE_TYPE); ftpClient.sendCommand("OPTS UTF8 ON");//we should send this command...Continue Reading
We can use following class to set alarm for multiple day of weeks: import android.app.AlarmManager; import android.app.PendingIntent; import android.content.BroadcastReceiver; import android.content.Context; import android.content.Intent; import java.util.Calendar; public class AlarmStartRadioHelper { private Context mContext; private Class<? extends BroadcastReceiver> mBroadcastReceiverClass; private static int RQS_1 = 1002; private String mActionName; public AlarmStartRadioHelper(Context context, Class<? extends Broa...Continue Reading
Showing admob interstitial ads when splash screen is loaded with a timer can be implemented as follows: package com.codesenior.admob; import android.content.Intent; import android.os.Bundle; import androidx.appcompat.app.AppCompatActivity; import com.google.android.gms.ads.AdListener; import com.google.android.gms.ads.AdRequest; import com.google.android.gms.ads.InterstitialAd; import java.util.Timer; import java.util.TimerTask; public class SplashActivity extends AppCompatActivity { private InterstitialAd mInterstitialAd; private Timer...Continue Reading
Android simple GET Request: import android.os.AsyncTask; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.net.HttpURLConnection; import java.net.URL; public class HttpGetRequestTask extends AsyncTask<String, Integer, String> { private RequestResponseHandler requestResponseHandler; public HttpGetRequestTask(RequestResponseHandler requestResponseHandler) { this.requestResponseHandler=requestResponseHandler; } protected String doInBackground(String... urls) {...Continue Reading
Create a notification on Android: String name=""; String message=""; int MID=12345; NotificationManager notificationManager = (NotificationManager) getActivity() .getSystemService(Context.NOTIFICATION_SERVICE); if(notificationManager==null)return; String NOTIFICATION_CHANNEL_ID = "step_counter_channel"; NotificationChannel mChannel; if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.O) { int importance = NotificationManager.IMPORTANCE_LOW; mChannel = new NotificationChannel(NOTIFICATION_CHANNEL_ID, "step_counter_channe...Continue Reading

© 2019 All rights reserved. Codesenior.COM