使用Nifi的PutDatabaseRecord处理器在MySQL中插入阿拉伯字符(非拉丁)时,这些字符已被替换为“ ???????”
插入后,阿拉伯字符串将替换为??????。我已经使用utf8创建了MySQL表。
ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_general_ci
请让我知道是否有人获得相同的分辨率。同样使用Sqoop,阿拉伯字符将替换为“ ????????”。
答案 0 :(得分:0)
我发现了Sqoop的解决方案,我在连接字符串中添加了以下部分
for Google map there's no need to add firebase dependency.
here I am sharing you complete code for google map.
in manifest you need to add google map library-
<!-- Add Google Map Library -->
<uses-library android:name="com.google.android.maps" />
<activity android:name=".activities.ActivityMap" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
<!-- Allow to connect with internet -->
<uses-permission android:name="android.permission.INTERNET" />
</manifest>
to use google maps you need to get map key.
Open your command prompt by typing cmd in your run. Start ⇒ Run ⇒ type cmd.
c:\<path-to-jdk-dir>\bin\keytool.exe -list -alias androiddebugkey
-keystore "C:\users\<user-name>\.android\debug.keystore" -storepass android -keypass android
keytool.exe -list -alias androiddebugkey -keystore "C:\users\ravi\.android\debug.keystore" -storepass android -keypass android
Go to https://developers.google.com/maps/documentation/android-sdk/intro?csw=1
and get your map key by giving MD5 fingerprint.
and generate your key-
layout - place your key to layout.
main.xml
<?xml version="1.0" encoding="utf-8"?>
<com.google.android.maps.MapView
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/mapView"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:clickable="true"
android:apiKey="05M-7qOGbEjYduPPUdQgJt9ysL8HToawGdvu_ow"
/>
Extend your activity by MapActivity.
to get map -
public class AndroidGoogleMapsActivity extends MapActivity {
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
}
@Override
protected boolean isRouteDisplayed() {
return false;
}
}
// to display zooming controls
public class AndroidGoogleMapsActivity extends MapActivity {
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
// Displaying Zooming controls
MapView mapView = (MapView) findViewById(R.id.mapView);
mapView.setBuiltInZoomControls(true);
}
@Override
protected boolean isRouteDisplayed() {
return false;
}
}
mapView.setSatellite(true); // Satellite View
mapView.setStreetView(true); // Street View
mapView.setTraffic(true); // Traffic View
You can also change map type like satellite, streetview etc.,
///////////////////////////////////////////////////////
To show a location on the map by passing latitude and longitude of that location.
MapController mc = mapView.getController();
double lat = Double.parseDouble("48.85827758964043"); // latitude
double lon = Double.parseDouble("2.294543981552124"); // longitude
GeoPoint geoPoint = new GeoPoint((int)(lat * 1E6), (int)(lon * 1E6));
mc.animateTo(geoPoint);
mc.setZoom(15);
mapView.invalidate();
/////////////////////////////////////////
For displaying marker on the map you need to create new class which extends ItemizedOverlay.
Create new class and name it as AddItemizedOverlay.java and write following code.
public class AddItemizedOverlay extends ItemizedOverlay<OverlayItem> {
private ArrayList<OverlayItem> mapOverlays = new ArrayList<OverlayItem>();
private Context context;
public AddItemizedOverlay(Drawable defaultMarker) {
super(boundCenterBottom(defaultMarker));
}
public AddItemizedOverlay(Drawable defaultMarker, Context context) {
this(defaultMarker);
this.context = context;
}
@Override
protected OverlayItem createItem(int i) {
return mapOverlays.get(i);
}
@Override
public int size() {
return mapOverlays.size();
}
@Override
protected boolean onTap(int index) {
Log.e("Tap", "Tap Performed");
return true;
}
public void addOverlay(OverlayItem overlay) {
mapOverlays.add(overlay);
this.populate();
}
}
/////////////////////////////////////////////////
Add this code to your ActivityMap -
List<Overlay> mapOverlays = mapView.getOverlays();
Drawable drawable = this.getResources().getDrawable(R.drawable.mark_red);
AddItemizedOverlay itemizedOverlay =
new AddItemizedOverlay(drawable, this);
OverlayItem overlayitem = new OverlayItem(geoPoint, "Hello", "Sample Overlay item");
itemizedOverlay.addOverlay(overlayitem);
mapOverlays.add(itemizedOverlay);
////////////////////////////////////////////////////////////////////////////
You can also get the latitude and longitude of location which was touched. Open your AddItemizedOverlay.java and add below method.
public class AddItemizedOverlay extends ItemizedOverlay<OverlayItem> {
/*................. Add this method ........*/
@Override
public boolean onTouchEvent(MotionEvent event, MapView mapView)
{
if (event.getAction() == 1) {
GeoPoint geopoint = mapView.getProjection().fromPixels(
(int) event.getX(),
(int) event.getY());
// latitude
double lat = geopoint.getLatitudeE6() / 1E6;
// longitude
double lon = geopoint.getLongitudeE6() / 1E6;
Toast.makeText(context, "Lat: " + lat + ", Lon: "+lon, Toast.LENGTH_SHORT).show();
}
return false;
}
}
now run your project.