How to create multiple partition in USB

In this article we will see that how to create multiple partition in usb. These steps are very easy and helpful.

We remind that common USB drives in Windows are identified as Basic, while USB sticks and SD cards as Removable. This feature is realized by checking RMB (removable media bit) on the flash controller.

Method 1 - From Command Prompt

Please following all the steps.

1.  Diskpart
2. list disk
3. select disk * (* your disk number)
4. clean
5. create partition primary size = * (* desired partition size in MB)
6. assign letter = * (* desired partition letter)
7. create partition primary ( for remaining capacity)
8. assign letter = * (* desired partition letter)

NB: format the partitions for use them.



Example:-

We have 32GB USB pendrive in which making 1st partition of 16GB and second is 12GB. 

C:\Windows\system32>diskpart

DISKPART> list disk

DISKPART> select disk 1

DISKPART> clean

DISKPART>create partition primary size = 16384

DISKPART> assign letter = I

DISKPART> create partition primary 12288

DISKPART> assign letter = J





Method 2 - From Disk Management

1.  Open Disk Management console (type diskmgmt.msc) and Format it into NTFS file system.

2. Right-click the partition on the USB stick and select Shrink Volume in the context menu.

3.Specify the size of free space after shrinking and click Shrink. For example, we want to create two partitions of 7 GB and 8 GB on the 15 GB storage device.





4.Right-click the unpartitioned space and select New Simple Volume to create another partition.



5.For instance, let’s create a FAT32 partition




The Trust relationship between this workstation and the primary domain failed

In this article we will see that how to fix error The Trust relationship between this workstation and the primary domain failed
           
The following procedure describes how to use the netdom command to reset a machine account password. This procedure is most frequently used on domain controllers, but also applies to any Windows machine account.


You must run the tool locally, from the Windows-based computer whose password you want to change. Additionally, you must have administrative permissions locally and on the computer account's object in Active Directory to run Netdom.exe.




There we have two method please follow all the steps:-

Method 1 :-

At a command prompt, type the following command:

netdom resetpwd /s:server /ud:domain\User /pd:*


Example:- netdom.exe resetpwd /s:domaincontroller.justrelief.net /ud:justrelief.net\administrator /pd:*

After successfully run command please run below command also.

gpupdate /force 



A description of this command is:

/s:server is the name of the domain controller to use for setting the machine account password. This is the server where the KDC is running.

/ud:domain\User is the user account that makes the connection with the domain you specified in the /s parameter. This must be in domain\User format. If this parameter is omitted, the current user account is used.

/pd:* specifies the password of the user account that is specified in the /ud parameter. Use an asterisk (*) to be prompted for the password.


Method 2 :- 

Please re-join computer in domain.

You need remove the pc from the domain, joined it to a temporary workgroup, restart the pc and join it back to the domain. It needs a second restart to enable the user to login.


Hope these steps fix your issue. if still issue persist kindly comment on Comment box.


 Group Policy use Regional Settings to change date format


In this article we will see that how to change date and time format to use regional settings. we have  requirement to change the American Date format (MM/dd/yyyy) to the ISO 8601 format (yyyy-MM-dd).

Configure Group Policy

First open Group Policy Management and go to User Configuration -> Preferences -> Control Panel Settings -> Regional Options.




Next right click on the area and choose New -> Regional Options.

Now go to Date and set the following values:

Short date format: yyyy-MM-dd

Date separator: –



Now the important part: Go through all tabs and press F5. You will notice that all red lines will change into green lines.

F5 – Mark all settings on the page as “green” (apply all)

F6 – Mark current setting as “green” (apply this setting)

F7 – Mark current setting as “red” (don’t apply this setting)

F8 – Mark all settings on the page as “red” (don’t apply).


Now go to the Common tab and click on OK.

It is important to go through all tabs and to press F5 otherwise the settings will not apply. I do not know why but I found this solution here.




Apply the settings to your Clients

To apply the settings simply do the following things:

Restart your Client machine



Or

Run cmd as Administrator and run the following command:


gpupdate /force

After the command executed successfully you need to Log off and Log on again on your Client machine to apply the settings.

The result will look like this:


That´s it. You have successfully changed the date format.

I wanted to share this information since I wasted quite some time searching for a solution why my settings would not apply. I hope this post is useful for you. See you next time.

Create Android Application from WebView in Android Studio

In this article we will learn that how to create android application from webview in android studio. This class is the basis upon which you can roll your own web browser or simply use it to display some online content within your Activity. We can also specify HTML string and can show it inside our application using a WebView. Basically, WebView turns application into a web application.


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"
    tools:context=".MainActivity">

       <WebView
            android:id="@+id/webView"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            tools:layout_editor_absoluteX="8dp"
            tools:layout_editor_absoluteY="8dp" >

        </WebView>

</RelativeLayout>


MainActivity.java

public class MainActivity extends AppCompatActivity  {

WebView myWebView;

@Override
    protected void onCreate(Bundle savedInstanceState) {

        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        myWebView = (WebView) findViewById(R.id.webView);
        WebSettings webSettings = myWebView.getSettings();
        webSettings.setJavaScriptEnabled(true);
        myWebView.loadUrl("https://www.onlinenetworkssolution.com");
        myWebView.setWebViewClient(new WebViewClient());
   
   }

}


  //Click on back button
    @Override
    public void onBackPressed() {
        if (myWebView.canGoBack()) {
            myWebView.goBack();
        } else {
            super.onBackPressed();
        }
  }




AndroidMainfest.xml

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    package="com.ons">

    <uses-permission android:name="android.permission.INTERNET" />
    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />


    <application
        android:allowBackup="true"
        android:icon="@mipmap/logo"
        android:label="@string/app_name"
        android:logo="@mipmap/mylogo"
        android:roundIcon="@mipmap/mylogo_round"
        android:supportsRtl="true"
        android:theme="@style/AppTheme"
        tools:ignore="GoogleAppIndexingWarning">
        <activity android:name=".MainActivity">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
  
    </application>

</manifest>

How to Reduce APK size in Android Studio


In this article we will learn that how to reduce the APK size in Android. To download any application (APK file) from the play store, if that application is too large then obviously, you will not download that application. In today’s world, everyone needs an application which is smaller so it is important to reduce the APK size.

In this whole process we need to some changing in our build.gradle(Module:app) and Proguard-rules.pro so please following all the step by step.



Please check screenshot for build.gradle changing.




Step 1: build.gradle
android {

    buildTypes {
        release {
            minifyEnabled true
            shrinkResources true
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

Please check screen shot of changing in Proguard-rules.pro.





Step2 1: Proguard-rules.pro

-keeppackagenames org.jsoup.nodes
-dontwarn com.squareup.okhttp.**

Show no Internet connection in Android Studio


In this article we will learn that how to show No Internet Connection Dialog. It is very pretty simple though. Showing No Internet Connection Dialog is very helpful in app like WebView app and all other apps which are mainly dependent on Internet to work. Making this is very easy and just take few minutes.



First you need to add below permission to your manifest file.



<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
    <uses-permission android:name="android.permission.INTERNET" />
    <uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />

Next go to your MainActivity.Java and below methods below onCreate Method.



public boolean isConnected(Context context) {
     ConnectivityManager cm = (ConnectivityManager)
    context.getSystemService(Context.CONNECTIVITY_SERVICE);
    NetworkInfo netinfo = cm.getActiveNetworkInfo();
    if (netinfo != null && netinfo.isConnectedOrConnecting()) {
        android.net.NetworkInfo wifi = cm.getNetworkInfo(ConnectivityManager.TYPE_WIFI);
        android.net.NetworkInfo mobile = cm.getNetworkInfo(ConnectivityManager.TYPE_MOBILE);
        if((mobile != null && mobile.isConnectedOrConnecting()) || (wifi != null && wifi.isConnectedOrConnecting())) return true;
        else return false;
    } else
        return false;
}
public AlertDialog.Builder buildDialog(Context c) {
    AlertDialog.Builder builder = new AlertDialog.Builder(c);
    builder.setTitle("No Internet Connection");

    builder.setMessage("You need to have Mobile Data or wifi to access this. Press ok to Exit");
    builder.setPositiveButton("Ok", new DialogInterface.OnClickListener() {

        @Override
        public void onClick(DialogInterface dialog, int which) {

            finish();
        }
    });

    return builder;
}



You may get many errors here click on the error text and press Alt+Enter on your keyboard. Repeat the step for all error text like this.

Next replace below line of code in MainActivity.Java
   

setContentView(R.layout.activity_main);

with below code

if(!isConnected(MainActivity.this)) buildDialog(MainActivity.this).show();
else {
    Toast.makeText(MainActivity.this,"Welcome", Toast.LENGTH_SHORT).show();
    setContentView(R.layout.activity_main);
}
   
Note:- Now run the code on your phone with Mobile data and WiFi connection turned off to see the desired output i.e, No Internet connection Dialog when there is no internet connection on your Android Device