Skip to content

ThirteeNov

My personal blog about coding and internet

Menu
  • About me
  • About Zofia Kreasi
  • Cart
  • Checkout
  • Making an airplane game from scratch in Unity
  • My account
  • Privacy Policy
  • Privacy Policy – zkLeaderboard
  • Sample Page
  • Shop
  • Tutorials on Learning JavaScript
  • ZKAccounts – Privacy Policy
Menu

Array of cities in JS and show it on a div

Posted on October 6, 2018August 4, 2020 by Habibie

In this example, I have a bunch of city names as an array variable in JavaScript. Then I want to make a list of links for all the city names. Here I do it using jQuery: <div id=”kotas”></div> <script> var kotas = [ “Banda Aceh”, “Langsa”, “Lhokseumawe”, “Meulaboh”, “Sabang”, “Subulussalam”, “Denpasar”, “Pangkalpinang”, “Cilegon”, “Serang”, “Tangerang…

Read more

How to check is the device connected to internet or not in Android

Posted on August 9, 2018August 4, 2020 by Habibie

With this simple snippet, we can check is the device is connected to internet or not: private boolean isConnected(){ ConnectivityManager connectivityManager = (ConnectivityManager) getSystemService(Context.CONNECTIVITY_SERVICE); NetworkInfo activeNetworkInfo = connectivityManager.getActiveNetworkInfo(); return activeNetworkInfo != null && activeNetworkInfo.isConnected(); } So this “isConnected()” returns true if it’s connected, otherwise it returns false.

Read more

Listing image files in a directory and populate a ListView from it in Android

Posted on August 6, 2018August 4, 2020 by Habibie

I have a directory in sdcard called “mydir” and there are lot of .png image files with another files. Then I want to list only that .png files and populate a ListView from it. I do it like this: String path = “/sdcard/mydir”; File directory = new File(path); if (!directory.exists()){ directory.mkdir(); } File[] files =…

Read more

Simple clickable Android ListView example

Posted on August 5, 2018August 4, 2020 by Habibie

Follow this short tutorial to create a ListView in Android. First let’s create the list view element in our layout file: <ListView android:id=”@+id/lblistview” android:layout_width=”match_parent” android:layout_height=”match_parent” android:layout_marginBottom=”8dp” android:layout_marginEnd=”8dp” android:layout_marginStart=”8dp” android:layout_marginTop=”8dp” app:layout_constraintBottom_toBottomOf=”parent” app:layout_constraintEnd_toEndOf=”parent” app:layout_constraintStart_toStartOf=”parent” app:layout_constraintTop_toTopOf=”parent” /> Then in your Java file: lblist = (ListView)findViewById(R.id.lblistview); String[] items = new String[3]; items[0] = “First item”; items[1] = “Second item”;…

Read more

JSON to Object and Array in Java

Posted on August 5, 2018August 4, 2020 by Habibie

Try this snippet to convert JSON text into object and/or array in Java: JSONObject object = new JSONObject(jsontext); JSONArray array = jsonObj.getJSONArray(“somearray”); for (int i = 0; i < somearray.length(); i++) { JSONObject item = somearray.getJSONObject(i); String somevalue = item.getString(“somekey”); } jsontext is your JSON text.

Read more

Listing all files in a directory in Android

Posted on August 5, 2018August 4, 2020 by Habibie

Let’s say we have a directory in device’s storage called “mydir” and there are files inside it. By using this snippet we can list all names of that files and folders: String path = Environment.getExternalStorageDirectory().getAbsolutePath() + “/maktabamajaziya”; String downloadedbooks = “”; File directory = new File(path); File[] files = directory.listFiles(); for (int i = 0;…

Read more

Requesting permission in run time in Android

Posted on August 5, 2018August 4, 2020 by Habibie

If we are making an app for Android greater than SDK 23, we need to request some sensitive permissions (for example, to write file in external storage) in run time. Here is a snippet to do so: if (Build.VERSION.SDK_INT >= 23) { if (checkSelfPermission(android.Manifest.permission.WRITE_EXTERNAL_STORAGE) == PackageManager.PERMISSION_GRANTED) { } else { ActivityCompat.requestPermissions(this, new String[]{Manifest.permission.WRITE_EXTERNAL_STORAGE}, 1); }…

Read more

If a folder (directory) is not existed, create it – Android Java Snippet

Posted on August 5, 2018August 4, 2020 by Habibie

With this snippet, we are able to check if a folder existed in device’s storage or not. If not, then we create it. Here is the snippet: File directory = new File(Environment.getExternalStorageDirectory().getAbsolutePath() + “/afolder”); if (! directory.exists()){ directory.mkdir(); }  

Read more

Simple PHP read and write to a text file

Posted on August 3, 2018August 4, 2020 by Habibie

This code snippet reads a text file that if it is not existed it will create one with some text in it. Next time this code is executed, if the file existed, PHP echoes the content of the file. <?php $settingfile = “settings.txt”; $filelink = fopen($settingfile, “r”); $filecontent = fread($filelink, filesize($settingfile)); echo $filecontent; fclose($filelink); $newContents…

Read more

Changing the skybox material programmatically in Unity

Posted on July 28, 2018August 4, 2020 by Habibie

I’m using this simple script after attaching it to UI Buttons to change my skybox materials. Let’s say we have two skybox materials with two UI Buttons to switch between them. Here is the script: using System.Collections; using System.Collections.Generic; using UnityEngine; public class ChangeSky : MonoBehaviour { public Material sky1; public Material sky2; public void…

Read more

Unity click and drag script to rotate camera

Posted on July 28, 2018August 4, 2020 by Habibie

Just googling around to find how to rotate camera with mouse click and drag. Thanks to this link: https://answers.unity.com/questions/1189946/click-and-drag-to-rotate-camera-like-a-pan.html This code is originally taken from that link: using System.Collections; using System.Collections.Generic; using UnityEngine; public class CamRotate : MonoBehaviour { public float speed = 3.5f; private float X; private float Y; void Update() { if(Input.GetMouseButton(0)) { transform.Rotate(new…

Read more

Unity iOS ‘GoogleMobileAds/GoogleMobileAds.h’ file not found

Posted on July 18, 2018August 4, 2020 by Habibie

Another one of common errors on building Unity games in Mac when we compile it using XCode is this error that states: ‘GoogleMobileAds/GoogleMobileAds.h’ file not found The quick solution is to reimport GoogleMobileAds plugin. That’s it.

Read more

Solving mach-o linker error on publishing Unity – XCode

Posted on July 18, 2018August 4, 2020 by Habibie

One of common error when we want to build our Unity game from XCode is this mach-o linker error. There are many solutions on internet but in my case, the solution is this simple one: Change target build to 8.0 On Build Settings, set Enable Module to Yes and Enable Bitcode to No.

Read more

JavaScript random numbers examples

Posted on June 24, 2018August 4, 2020 by Habibie

Generating random numbers is a common thing in programming. Here is some examples in JavaScript: //Basic Random Math.random(); //From 0 to specific number Math.random() * 10; //Removing decimals Math.floor(Math.random() * 10); //Random between 5 and 10 Math.floor(Math.random() * 5) + 5; //Random between 5 and 10 (included 10) Math.floor(Math.random() * 5) + 6;

Read more

Creating Depth of Field Effect in Blender

Posted on June 15, 2018August 4, 2020 by Habibie

Depth of Field effect in 3D rendering adds realism to it. It’s easy how to create this effect in Blender. To create DOF effect in Blender first we need to adjust our camera’s focus distance, then add defocus effect on render node as I’ll show you in this tutorial.

Read more

Showing Poly and Vert Statistics in 3Ds Max

Posted on June 15, 2018August 4, 2020 by Habibie

If you sell 3D models online, sometimes marketplaces require poly count or triangles count of your object. In 3Ds Max, it’s easy to show that statistics. Press 7 and it will appear in your viewport. If you need more stat details, go to Views > Viewport Configuration > Statistics.

Read more

PHP & MySQL useful snippets

Posted on May 15, 2018March 23, 2022 by Habibie

For us, working with database in web development is a mandatory task. Here in this post I’m going to list, as much as I know, PHP & MySQL snippets that I frequently use.

Read more

Inserting Arabic text with PHP into MySQL Database

Posted on May 14, 2018August 4, 2020 by Habibie

We need to set the encoding of texts we store into database to UTF-8 if we work with Arabic texts. Otherwise, Arabic texts appear like ?????????? in our database.

Read more

Using Command Prompt to render Blender animations

Posted on May 13, 2018August 4, 2020 by Habibie

We don’t need to open Blender to render our animation to make rendering progress faster. After you set everything, close your Blender and run Command Prompt (in Windows), then navigate to your Blender program directory:

Read more

Blender quick tips and shortcuts

Posted on May 12, 2018August 4, 2020 by Habibie

Working with blender is much faster and easier if you know most of it’s keyboard shortcuts. Here in this post I’m going to list them as much as I can:

Read more

Posts pagination

  • Previous
  • 1
  • …
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • Next
ciihuy2020

Welcome!

  • My YouTube Channel
  • My GitHub Page
  • About me

Categories

  • 3DVista
  • Android
  • Apache
  • C#
  • Cordova
  • Electron & Node JS
  • HTML5, CSS & JavaScript
  • iOS
  • Let's Make Unity Games
  • Misc
  • Photoshop
  • PHP
  • Python
  • Uncategorized
  • Unity
  • WordPress

Recent Posts

  • Hover Reveal script for Unity to show and hide object on mouse hover
  • How to Prevent UI Clicks in Unity from “Bleeding Through” to 3D Objects Behind Them
  • Make objects like wires and cables easily in Unity using Ciihuy Curved Mesh
  • [SOLVED] Can’t Add Custom Domain to Blogger After Losing CNAME Verification
  • iOS App Icon Generator by CiihuyCom
© 2026 ThirteeNov | Powered by Superbs Personal Blog theme