PHP cheatsheet
PHP Array Functions 🔗 array_diff (arr1, arr2 …) array_filter (arr, function) array_flip (arr) array_intersect (arr1, arr2 …) array_merge (arr1, arr2 …) array_pop (arr) array_push (arr, var1, var2 …) array_reverse (arr) array_search (needle, arr) array_walk (arr, function) count (count) in_array (needle, haystack) PHP String Functions 🔗 crypt (str, salt) explode (sep, str) implode (glue, arr) nl2br (str) sprintf (frmt, args) strip_tags (str, allowed_tags) str_replace (search, replace, str) strpos (str, needle) strrev (str) strstr (str, needle) strtolower (str) strtoupper (str) substr (string, start, len) PHP Filesystem Functions 🔗 clearstatcache () copy (source, dest) fclose (handle) fgets (handle, len) file (file) filemtime (file) filesize (file) file_exists (file) fopen (file, mode) fread (handle, len) fwrite (handle, str) readfile (file) PHP Date and Time Functions 🔗 checkdate (month, day, year) date (format, timestamp) getdate (timestamp) mktime (hr, min, sec, month, day, yr) strftime (formatstring, timestamp) strtotime (str) time () PHP Regular Expressions Functions 🔗 ereg (pattern, str) split (pattern, str) ereg_replace (pattern, replace, str) preg_grep (pattern, arr) preg_match (pattern, str) preg_match_all (pattern, str, arr) preg_replace (pattern, replace, str) preg_split (pattern, str) Regular Expressions Syntax 🔗 regex meaning ^ Start of string $ End of string .
How to get currently running applications in android ?
Use this code in your app’s `src/MainActivity.kt’ file. import android.app.ActivityManager import android.app.ActivityManager.RunningTaskInfo import android.content.Context import android.os.Bundle import android.widget.TextView import androidx.appcompat.app.AppCompatActivity import java.util.* class MainActivity : AppCompatActivity() { override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) setContentView(R.layout.activity_main) title = "KotlinApp" val textView: TextView = findViewById(R.id.textView) val activityManager = getSystemService(Context.ACTIVITY_SERVICE) as ActivityManager val recentTasks: List<RunningTaskInfo> = Objects.requireNonNull(activityManager).getRunningTasks(Int.MAX_VALUE) for (i in recentTasks.indices) { textView.text = "Application executed: ${recentTasks[i].baseActivity!!.toShortString()}ID: ${recentTasks[i].id}" } } } Make sure you have a TextView with id textView in your XML layout.
Should I use Swift or Objective-C to learn iOS development ?
The Swift programming language is the standard features rich language to create iOS apps, iPadOS apps and MacOS X apps. The present and the future is just Swift on Apple ecosystem. Apple is perfecting Swift every year with updates and new features and capabilities. We are now in the era of SwiftUI, you should go for Swift already. Swift itself is a robust programming language. So go for it! it is standard for hiring, learning, creating apps for Apple operating systems.
What are great ways to promote an iOS app?
I think deeply about marketing and how to reach your target audience online and offline. In this post, I’ll cover all areas of marketing and advertising your mobile application specially the iOS apps. fix a problem, give great value 🔗 Your iOS application must solve a problem or fulfill a need which some users of iPhone or iPad have. describe it for the public 🔗 You should consider writing a comprehensive description which normal people can understand.
How to animate the change of background color of a view on iOS ?
Step by step guide to create background color changing with beautiful animation 🔗 open Main.storyboard add a button as shown below add one @IBAction for touchUpInside of ‘Change Background’ button. Name the function as changeBackgroundClicked. use animate function of UIView to animate the change of background color. It provides us the duration and optional completion as parameters. In changeBackgroundClicked we will change the background color of the view from red to blue and vice versa.
How do you animate the change of background color of a view on Android ?
The idea is to use this code snippet. ColorDrawable[] colorDrawables = { new ColorDrawable(Color.RED), new ColorDrawable(Color.BLUE), new ColorDrawable(Color.GREEN) }; TransitionDrawable transitionDrawable = new TransitionDrawable(colorDrawables); textView.setBackground(transitionDrawable); transitionDrawable.startTransition(2000); In this code snippet, we created a list of colorDrawables, then feed them to the TransitionDrawable. And now we have an animating color change, so we pass it to the setBackground to get the animating colors in the background. Got the idea ? let’s create a complete code example.
How to change background color of selected item in listview in Android ?
The main idea is to use view.setBackgroundColor(getColor(R.color.colorAccent)) to the selected view (list item). Let’s see a complete example. use this xml code in res/layout/activity_main.xml. <?xml version="1.0" encoding="utf-8"?> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" android:padding="8dp" tools:context=".MainActivity"> <ListView android:id="@+id/listView" android:layout_width="match_parent" android:layout_height="match_parent" /> </RelativeLayout> use this Kotlin code in src/MainActivity.kt. import android.os.Build import androidx.appcompat.app.AppCompatActivity import android.os.Bundle import android.widget.ArrayAdapter import android.widget.ListView class MainActivity : AppCompatActivity() { var operatingSystem: Array<String> = arrayOf("Android", "IPhone", "WindowsMobile", "Blackberry", "WebOS", "Ubuntu", "Windows7", "Max OS X") override fun onCreate(savedInstanceState: Bundle?
How to Change Listview Item Color in Android ?
The idea is to create an a list item xml, and give it the design choices you want. If you want to change the list item color, use this xml code android:textColor="@android:color/holo_orange_dark". If you want to change the text to italic or bold, use this xml android:textStyle="italic|bold". And even if you want to change the font itself, you can by this font-family property in xml android:fontFamily="sans-serif-condensed". Now, you got the idea.
Fix Login Loop Ubuntu Linux
If you stuck in the login screen and can’t load the Ubuntu desktop, follow those steps. when you on the login screen, press ctrl + shift + alt + f1. A black screen appeared? No? Just the login page? So try ctrl + shift + alt + f2. Still the login screen? try ctrl + shift + alt + f3. If the login screen still showing? Try to use another external keyboard.
[FIXED] I Can Not Create Database in phpMyAdmin on my website
When I try to create database in phpMyAdmin. This error show up access denied for user 'user'@'localhost' to database 'db'. and there is no buttons to create database in phpMyAdmin page. On CPanel, we can’t create database in phpMyAdmin directly so security reasons. So the fix is to create MySQL database via CPanel not in phpMyAdmin. So, when using CPanel we create Database using Database Wizard as you see in this video .