Why isn't my translator system working in flutter? - flutter

I'm attempt to do a localization translator in flutter for my project. I got help from this tutorial:
https://resocoder.com/2019/06/01/flutter-localization-the-easy-way-internationalization-with-json/
But when I run the program, it only show one language even when I change the language in the laptop setting (I use Chrome for debugging so i had to change language from the laptop setting).
Here's my code:
MAIN.dart:
import 'package:final_translating_test/taylake.dart';
import 'package:flutter/material.dart';
import 'package:flutter_localizations/flutter_localizations.dart';
import 'app_localizations.dart';
import 'dakmilprison.dart';
import 'damw.dart';
void main() {
runApp(MyApp());
}
class MyApp extends StatelessWidget {
// This widget is the root of your application.
#override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Flutter Demo',
debugShowCheckedModeBanner: false,
routes: {
'/1': (context) => TayLake(),
'/2': (context) => DamW(),
'/3': (context) => DakMilPrison(),
},
supportedLocales: [Locale('en', 'US'), Locale('vi', 'VN')],
localizationsDelegates: [
// THIS CLASS WILL BE ADDED LATER
// A class which loads the translations from JSON files
AppLocalizations.delegate,
// Built-in localization of basic text for Material widgets
GlobalMaterialLocalizations.delegate,
// Built-in localization for text direction LTR/RTL
GlobalWidgetsLocalizations.delegate,
],
localeResolutionCallback: (locale, supportedLocales) {
for (var supportedLocale in supportedLocales) {
if (supportedLocale.languageCode == locale!.languageCode &&
supportedLocale.countryCode == locale.countryCode) {
return supportedLocale;
}
}
return supportedLocales.first;
},
home: MyHomePage(),
);
}
}
class MyHomePage extends StatefulWidget {
MyHomePage({
Key? key,
}) : super(key: key);
#override
_MyHomePageState createState() => _MyHomePageState();
}
class _MyHomePageState extends State<MyHomePage> {
#override
Widget build(BuildContext context) {
return Scaffold(
body: Column(
children: [
Stack(
children: [
Image.network(
'https://t4.ftcdn.net/jpg/03/36/07/85/240_F_336078503_3rIlo0PPrbrxyPbR99qXVo6VATqWsHvl.jpg',
filterQuality: FilterQuality.high,
fit: BoxFit.fitWidth,
width: 500,
),
ListTile(
leading:
Icon(Icons.menu_outlined, color: Colors.white, size: 30),
trailing: Icon(Icons.verified_user_outlined,
size: 30, color: Colors.white),
),
],
),
Expanded(
child: PageView(
children: <Widget>[
placeButton(
context,
"titleHoTay",
"https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcRLRsM_lVQtJSMBRgTzeyPIrqdeMFV7M3gCzA&usqp=CAU",
"/1"),
placeButton(
context,
"titleDapW",
"https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcTabeU7lO71WhEE3EY99nU087Xwlj5PAPd76g&usqp=CAU",
"/2"),
placeButton(
context,
"titleNhaNgucDm",
"https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcSzl8XkPISxI0Uqcy0FR6g3cRvtng1Ghu6T9w&usqp=CAUs",
"/3")
],
),
),
],
),
);
}
}
Widget placeButton(BuildContext context, String name, String image, String id) {
return Column(children: [
Padding(
padding: const EdgeInsets.fromLTRB(130.0, 0.0, 130.00, 0.0),
child: ClipRRect(
borderRadius: BorderRadius.circular(20),
child: SizedBox(
height: 300,
width: 400,
child: GestureDetector(
onTap: () {
Navigator.pushNamed(context, id);
},
child: Card(
child: ListTile(
title: Padding(
padding: const EdgeInsets.fromLTRB(20, 5, 20, 0),
child: Text(AppLocalizations.of(context)!.translate(name),
style: TextStyle(fontFamily: 'Manrope', fontSize: 18)),
),
subtitle: Image.network(
image,
height: 250,
),
),
),
),
),
),
),
Container(
height: 40,
width: 200,
padding: EdgeInsets.only(top: 0),
color: Colors.white,
child: ListTile(
leading: Text(
"Rating:",
style: TextStyle(fontFamily: 'Klasik'),
),
trailing: IconButton(
splashRadius: 20,
icon: Icon(Icons.star_border_outlined),
onPressed: () {},
),
),
),
]);
}
APP_LOCALIZATIONS.dart:
import 'dart:async';
import 'dart:convert';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
class AppLocalizations {
final Locale locale;
AppLocalizations (this.locale);
static AppLocalizations? of(BuildContext context) {
return Localizations.of<AppLocalizations>(context, AppLocalizations);
}
static const LocalizationsDelegate<AppLocalizations> delegate =
_AppLocalizationsDelegate();
late Map<String, String> _localizedStrings;
Future<bool> load() async {
String jsonString =
await rootBundle.loadString('lang/${locale.languageCode}.json');
Map<String, dynamic> jsonMap = json.decode(jsonString);
_localizedStrings = jsonMap.map((key, value) {
return MapEntry(key, value.toString());
});
return true;
}
String translate(String key) {
return _localizedStrings[key]!;
}
}
class _AppLocalizationsDelegate
extends LocalizationsDelegate<AppLocalizations> {
const _AppLocalizationsDelegate();
#override
bool isSupported(Locale locale) {
return ['en', 'vi'].contains(locale.languageCode);
}
#override
Future<AppLocalizations> load(Locale locale) async {
AppLocalizations localizations = new AppLocalizations(locale);
await localizations.load();
return localizations;
}
#override
bool shouldReload(_AppLocalizationsDelegate old) => false;
}
en.JSON:
{
"first_string": "Hello! This is the first message.",
"second_string": "If this tutorial helps you, give it a like and subscribe to Reso Coder 😉",
"titleHoTay": "Tay Lake",
"titleDapW": "W Dam",
"titleNhaNgucDm": "DakMil Prison",
"GioiThieu": "Introduction",
"GioiThieuHoTay": "West Lake Dak Mil is an extremely familiar destination for people in the small town of Dak Mil, which not only plays the role of regulating and creating a balance in the landscape for this beautiful town, but also a tourist destination which attracts young people and tourists by the poetic and peaceful scenery. If you have the opportunity to come to the small town of Dak Mil of Dak Nong province, do not forget to check-in at this extremely hot destination.",
"LichSu": "History",
"LichSuHoTay": "West Lake in Dak Mil is a semi-artificial lake, formed in the 1940s. Initially, the lake was planned by the French colonialists to store water for the coffee growing project in Dak Nong. Until 1982, the town continued to invest in expanding the lake surface to better serve the irrigation needs of the people and at the same time become a place to store water from underground aquifers. It is also for this reason that the water here is always blue all year round.",
"ViTriDiaLy": "Geological Location",
"ViTriDiaLyDakMil": "The lake is located 67km from the center of Gia Nghia city to the northeast with an area of ​​more than 10km with an open surface area of ​​108ha and the deepest place reaching 17m. Explaining the special name, locals said, this name comes from the location of the lake. Because it is located in the west of the town, many people have called it West Lake, which has become familiar, over time people add the town's name to form the name Tay Dak Mil lake as it is today.",
"CanhDep":"Beauty scene",
"CanhDepDakMil":"As the most beautiful lake in Dak Mil town, it is not difficult to understand that West Lake is a familiar destination for tourists as well as locals, especially young people. The scenery at West Dak Mil lake is both beautiful and romantic, even though it is located in the middle of the city. From a distance, this lake is divided into two branches, hugging around the green coffee plantation, reminiscent of the image of a beautiful oasis. The winding roads or the rows of green trees around the lake also contribute to the poetic beauty of the lake.",
"GioiThieuDapW":"The unique flow and design of the W dam in Dak Nong make tourists excited and curious. This beautiful dam is one of the familiar check-in places for young people every season when the water rises.",
"LichSuDapW":"W Dak Nong Dam was built in 1999, with an area of ​​about 22 hectares to serve the needs of irrigation and water supply for the lives of local people. Although the original purpose of construction was just to prevent water and serve local life and production, with its unique design, this dam has become a favorite check-in point of local young people as well as tourists when coming to Dak Mil.",
"ViTriDiaLyDapW":"W Dam is located in Dak Sak village, Dak Mil district. to reach this place you just need to move to Duc Manh junction of Dak Sak village, then go through Nguyen Du school and enjoy the unique yet beautiful scence of Dam W.",
"CanhDepDapW":"This monumental dam possesses impressive beauty with large streams of water splashing on the spillways, creating an extremely impressive scene. The scenery here is as beautiful as any famous waterfall in Dak Nong, so it attracts more and more tourists to visit. You can check-in at W Dak Nong dam in many different locations from on the shore to the bottom of the spillway, the white foaming strips of water are the perfect background for you to freely pose and take pictures. ravishingly beautiful. With the unique beauty of W Dam as well as the love of tourists from all over the world, the site is being planned to become one of Dak Mil's tourist attractions."
}
VI.json:
{
"first_string": "Xin chào! Đây là tin nhắn đầu tiên. ",
"second_string": "Nếu hướng dẫn này hữu ích với bạn, hãy like và đăng ký Reso Coder 😉",
"titleHoTay": "Hồ Tây",
"titleDapW": "Đập W",
"titleNhaNgucDm": "Nhà ngục Đắk Mil",
"GioiThieu": "Giới Thiệu",
"GioiThieuHoTay": "Hồ Tây Đăk Mil là một điểm đến cực kỳ quen thuộc với người dân tại thị trấn nhỏ Đắk Mil, không chỉ có vai trò điều hòa và tạo sự cân bằng về cảnh quan cho thị trấn xinh đẹp này mà đây còn là điểm đến thu hút các bạn trẻ và du khách bởi khung cảnh thơ mộng và yên bình. Có dịp đến với thị trấn nhỏ Đăk Mil của tỉnh Đắk Nông, bạn đừng quên đến check-in tại điểm đến cực hot này nhé. ",
"LichSu":"Lịch Sử",
"LichSuHoTay":"Hồ Tây ở Đăk Mil là hồ nước bán nhân tạo, được hình thành từ những năm 1940. Ban đầu hồ được thực dân Pháp quy hoạch để trữ nước phục vụ cho dự án trồng cafe tại Đắk Nông. Đến năm 1982, thị trấn tiếp tục đầu tư mở rộng mặt hồ để phục vụ tốt hơn nhu cầu tưới tiêu của người dân và đồng thời trở thành nơi dung chứa nước từ các mạch nước ngầm. Cũng chính vì nguyên nhân này mà nước tại đây luôn trong xanh quanh năm. ",
"ViTriDiaLy":"Vị Trí Địa Lý",
"ViTriDiaLyDakMil":"Hồ nằm cách trung tâm của thành phố Gia Nghĩa 67km về hướng Đông Bắc với diện tích hơn 10km với diện tích mặt thoáng là 108ha và nơi sâu nhất đạt 17m. Lý giải về cái tên đặc biệt người dân địa phương cho biết, tên gọi này xuất phát từ vị trí của hồ. Do nằm ở phía Tây của thị trấn nên nhiều người đã gọi thành hồ Tây, lâu thành quen, theo thời gian người ta gắn thêm tên thị trấn hình thành nên tên gọi hồ Tây Đăk Mil như hiện tại. ",
"CanhDep":"Cảnh Đẹp",
"CanhDepDakMil":"Là hồ nước đẹp bậc nhất thị trấn Đăk Mil, nên không khó hiểu khi hồ Tây chính là điểm đến quen thuộc của du khách cũng như người dân địa phương, nhất là với các bạn trẻ. Khung cảnh ở hồ Tây Đăk Mil vừa đẹp lãng mạn lại có chút gì đó hoang sơ dù nằm giữa phố thị. Nhìn từ xa hồ nước này được chia thành hai nhánh, ôm quanh đồi trồng cafe xanh mướt khiến ta liên tưởng đến hình ảnh của một ốc đảo xinh tươi. Những con đường uốn lượn hay những hàng cây xanh mướt xung quanh hồ cũng góp phần tạo nên vẻ đẹp thơ mộng của hồ.",
"GioiThieuDapW":"Dòng chảy và thiết kế độc lạ của đập W ở Đăk Nông khiến các tín đồ du lịch phấn khích lẫn tò mò. Đập nước tuyệt đẹp này là một trong những địa điểm check-in quen thuộc của các bạn trẻ mỗi mùa nước lên. ",
"LichSuDapW":"Đập W Đăk Nông được xây dựng từ năm 1999, với diện tích khoảng 22 ha để phục vụ cho nhu cầu tưới tiêu, cung cấp nước phục vụ đời sống của đồng bào địa phương. Mặc dù mục đích xây dựng ban đầu chỉ là để ngăn nước và phục vụ đời sống và sản xuất tại địa phương, tuy nhiên với thiết kế độc đáo, đập nước này đã trở thành điểm check-in yêu thích của các bạn trẻ địa phương cũng như du khách khi đến với Đăk Mil.",
"ViTriDiaLyDapW":"Đập W Đăk Nông tọa lạc tại xã Đăk Săk, huyện Đăk Mil, để đến được địa điểm này bạn chỉ cần di chuyển đến ngã 3 Đức Mạnh của xã Đăk Săk sau đó đi qua ngôi trường Nguyên Du rồi rẽ vào đập W.",
"CanhDepDapW":"Đập nước hoành tráng này sở hữu vẻ đẹp ấn tượng với những luồng nước lớn bắn tung tóe trên các trụ tràn, tạo nên khung cảnh vô cùng ấn tượng. Khung cảnh ở đây đẹp không kém bất cứ thác nước nổi tiếng nào tại Đăk Nông, nên ngày càng thu hút du khách tìm đến thăm quan. Bạn có thể check-in tại đập W Đăk Nông ở nhiều vị trí khác nhau từ trên bờ đến phía dưới đập tràn, những dải nước tung bọt trắng xóa chính là background hoàn hảo để bạn thỏa sức tạo dáng và thu về những bức ảnh đẹp mê hồn. Trước vẻ đẹp độc đáo của đập W cũng như sự yêu thích của du khách thập phương, địa điểm đang được quy hoạch để trở thành một trong những điểm du lịch của Đắk Mil. "
}
TayLake,DamW,DakMilPrison.dart:
import 'package:flutter/material.dart';
import 'app_localizations.dart';
class DamW extends StatelessWidget {
#override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text(AppLocalizations.of(context)!.translate("titleDapW")),
),
body: Scrollbar(
isAlwaysShown: true,
showTrackOnHover: true,
child: SingleChildScrollView(
child: Column(
children: [
printImage("",
170.0),
printTitle(
AppLocalizations.of(context)!.translate("GioiThieu")),
printText(
AppLocalizations.of(context)!.translate("GioiThieuDapW")),
printImage("",
180.0),
printTitle(
AppLocalizations.of(context)!.translate("LichSu")),
printText(
AppLocalizations.of(context)!.translate("LichSuDapW")),
printImage("",
180.0),
printTitle(
AppLocalizations.of(context)!.translate("ViTriDiaLy")),
printText(
AppLocalizations.of(context)!.translate("ViTriDiaLyDapW")),
printImage(
"",
180.0),
printTitle(AppLocalizations.of(context)!.translate("CanhDep")),
printText(
AppLocalizations.of(context)!.translate("CanhDepDapW")),
],
))));
}
Widget printTitle(String text) {
return Container(
child: Text(text,
style: TextStyle(fontSize: 20, color: Colors.grey.shade800)),
padding: EdgeInsets.fromLTRB(0, 50, 50, 0));
}
Widget printText(String text) {
return Container(
child: Text(text,
style: TextStyle(
fontSize: 15,
color: Colors.grey.shade600,
fontFamily: 'Manrope')),
padding: EdgeInsets.fromLTRB(50, 25, 50, 25));
}
Widget printImage(String url, double height) {
return Container(
constraints: BoxConstraints.tightFor(height: height),
child: Image.network(url, fit: BoxFit.fitWidth),
);
}
}
Note:
I have already imported all the package needed,
In fact, TayLake.dart;DamW.dart and DakMilPrison.dart are three different file, but they are basiclly the same format so I just put one of them there. (If you want the code, tell me down below :>)
The localization system is not the exact same as the tutorial, I don't know why but the tutorial is not including null safety so I add a lot of "!" and "?" to fix it (may be that's the reason).

To some up the debugging process:
hard code a different language to check whether the translations are correctly registered
MaterialApp(
locale: Locale('vi'),
...
)
If this works, make sure the language is correctly configured for the system. for Chrome:
Open the Chrome preferences
Search for "Languages"
Find "Order languages based on your preference"
Sort the preferred language to the top.

Related

flutter-keyboard hides itself when clicked on textfield

I/ViewRootImpl#799941b[MainActivity](12513): ViewPostIme pointer 0
I/ViewRootImpl#799941b[MainActivity](12513): ViewPostIme pointer 1
D/InputMethodManager(12513): SSI - flag : 0 Pid : 12513 view : com.example.facatte
D/InputMethodManager(12513): prepareNavigationBarInfo() DecorView#f0b7259[MainActivity]
D/InputMethodManager(12513): getNavigationBarColor() -855310
D/InputMethodManager(12513): prepareNavigationBarInfo() DecorView#f0b7259[MainActivity]
D/InputMethodManager(12513): getNavigationBarColor() -855310
V/InputMethodManager(12513): Starting input: tba=com.example.facatte ic=io.flutter.plugin.editing.InputConnectionAdaptor#8b758fe mNaviBarColor -855310 mIsGetNaviBarColorSuccess true , NavVisible : true , NavTrans : false
D/InputMethodManager(12513): startInputInner - Id : 0
I/InputMethodManager(12513): startInputInner - mService.startInputOrWindowGainedFocus
D/InputTransport(12513): Input channel destroyed: 'ClientS', fd=93
W/IInputConnectionWrapper(12513): getExtractedText on inactive InputConnection
W/IInputConnectionWrapper(12513): requestCursorAnchorInfo on inactive InputConnection
I/ViewRootImpl#799941b[MainActivity](12513): MSG_RESIZED: frame=(0,0,1080,2340) ci=(0,83,0,989) vi=(0,83,0,989) or=1
I/ViewRootImpl#799941b[MainActivity](12513): Relayout returned: old=(0,0,1080,2340) new=(0,0,1080,2340) req=(1080,2340)0 dur=12 res=0x1 s={true 518951051264} ch=false
D/InputMethodManager(12513): HSIFW - flag : 0
I/ViewRootImpl#799941b[MainActivity](12513): MSG_RESIZED: frame=(0,0,1080,2340) ci=(0,83,0,126) vi=(0,83,0,126) or=1
I/ViewRootImpl#799941b[MainActivity](12513): Relayout returned: old=(0,0,1080,2340) new=(0,0,1080,2340) req=(1080,2340)0 dur=12 res=0x1 s={true 518951051264} ch=false
This is the output in console when tapping on the textfield.
The keyboard comes up for 2 seconds and then hides automatically. It doesnt throw any error too !
GlobalKey<ScaffoldState> _scaffoldKey = new GlobalKey<ScaffoldState>();
final _formKey = GlobalKey<FormState>();
TextEditingController textEditingController = new TextEditingController();
return Scaffold(
key: _scaffoldKey,
body : Form(
key: _formKey,
child: TextField(
controller: textEditingController,
decoration: new InputDecoration(
hintText: 'Type Your Data',
),
),
));
Or If you are using Multiple TextFields then use a separate controller for each TextField. I hope this will work for you.

Flutter - flutter_inappwebview - GL error: Out of memory

I use the flutter_inappwebview plugin to run a WebView (PostUrl). but I found an error when displaying my web. Here's an example of my coding:
import 'dart:async';
import 'dart:convert' show utf8;
import 'dart:typed_data';
import 'package:flutter/material.dart';
import 'package:flutter_inappwebview/flutter_inappwebview.dart';
import 'package:smartmosque/Api/ApiServer.dart';
import 'package:smartmosque/Utils/Global.dart';
class PaymentLinkAjaPage extends StatefulWidget {
final String token;
PaymentLinkAjaPage({this.token});
#override
_PaymentLinkAjaPageState createState() => _PaymentLinkAjaPageState();
}
class _PaymentLinkAjaPageState extends State<PaymentLinkAjaPage> {
InAppWebViewController webView;
String url = "";
double progress = 0;
void actionBack() {
if (url.length > 100) {
Navigator.pop(context);
Navigator.pop(context);
Navigator.pop(context);
} else {
Navigator.pop(context);
}
}
#override
Widget build(BuildContext context) {
return WillPopScope(
onWillPop: () {
actionBack();
return Future.value(true);
},
child: Scaffold(
backgroundColor: Global.primaryRed,
appBar: AppBar(
title: Text("Infak Link Aja!"),
elevation: 0,
leading: IconButton(
icon: Icon(Icons.clear),
onPressed: () {
actionBack();
}),
),
body: Container(
child: Column(
children: <Widget>[
Container(
padding: EdgeInsets.only(left: 20, right: 20),
child: progress < 1.0
? LinearProgressIndicator(value: progress)
: Container()),
Expanded(
child: ClipRRect(
borderRadius: BorderRadius.only(
topLeft: Radius.circular(20),
topRight: Radius.circular(20)),
child: InAppWebView(
initialHeaders: {},
initialOptions: InAppWebViewGroupOptions(
crossPlatform: InAppWebViewOptions(
debuggingEnabled: true,
useShouldOverrideUrlLoading: false)),
onWebViewCreated: (InAppWebViewController controller) {
webView = controller;
var encodetext = utf8.encode("message=${widget.token}");
Uint8List postdata = Uint8List.fromList(encodetext);
webView.postUrl(url: urlWebLinkAja, postData: postdata);
},
androidOnPermissionRequest:
(InAppWebViewController controller, String origin,
List<String> resources) async {
return PermissionRequestResponse(
resources: resources,
action: PermissionRequestResponseAction.GRANT);
},
onReceivedServerTrustAuthRequest:
(controller, challenge) async {
return ServerTrustAuthResponse(
action: ServerTrustAuthResponseAction.PROCEED);
},
onLoadStart:
(InAppWebViewController controller, String url) async {
setState(() {
this.url = url;
// print("urlstart: $url");
});
},
onLoadStop: (controller, url) async {
setState(() {
this.url = url;
});
},
onProgressChanged:
(InAppWebViewController controller, int progress) {
setState(() {
this.progress = progress / 100;
});
},
),
))
],
),
),
),
);
}
}
and here's the error log:
E/OpenGLRenderer( 5918): GL error: Out of memory!
F/OpenGLRenderer( 5918): glFinish error! GL_OUT_OF_MEMORY (0x505)
W/google-breakpad( 5918): ### ### ### ### ### ### ### ### ### ### ### ### ###
W/google-breakpad( 5918): Chrome build fingerprint:
W/google-breakpad( 5918): 70.0.3538.110
W/google-breakpad( 5918): 353811052
W/google-breakpad( 5918): ### ### ### ### ### ### ### ### ### ### ### ### ###
F/libc ( 5918): Fatal signal 6 (SIGABRT), code -6 in tid 6041 (RenderThread), pid 5918 (gma.example)
Softversion: PD1731F_EX_A_1.18.3
Time: 2020-09-28 15:17:37
*** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
Build fingerprint: 'vivo/1724/1724:8.1.0/OPM1.171019.011/compil08311518:user/release-keys'
Revision: '0'
ABI: 'arm64'
pid: 5918, tid: 6041, name: RenderThread >>> com.example.test <<<
signal 6 (SIGABRT), code -6 (SI_TKILL), fault addr --------
Abort message: 'glFinish error! GL_OUT_OF_MEMORY (0x505)'
x0 0000000000000000 x1 0000000000001799 x2 0000000000000006 x3 0000000000000008
x4 0000007b2cd44588 x5 0000007b2cd44588 x6 0000007b2cd44588 x7 0000007b2cd44588
x8 0000000000000083 x9 0000000010000000 x10 0000007b2cd43cb0 x11 8f38f30250d84677
x12 8f38f30250d84677 x13 0000000000000000 x14 ffffffffffffffdf x15 8f38f30250d84677
x16 0000005f418bffa8 x17 0000007bd2ec4134 x18 8f38f30250d84677 x19 000000000000171e
x20 0000000000001799 x21 0000000000000083 x22 0000007bd29a9a70 x23 0000000000000502
x24 0000007bd29a9b3e x25 0000000000000505 x26 0000007bd29a9b24 x27 0000007bd29a9b3e
x28 0000000000000505 x29 0000007b2cd43cf0 x30 0000007bd2e6a630
sp 0000007b2cd43cb0 pc 0000007bd2e6a658 pstate 0000000060000000
backtrace:
#00 pc 000000000001e658 /system/lib64/libc.so (abort+120)
#01 pc 00000000000083e4 /system/lib64/liblog.so (__android_log_assert+296)
#02 pc 00000000000468fc /system/lib64/libhwui.so (android::uirenderer::debug::GlesErrorCheckWrapper::assertNoErrors(char const*)+384)
#03 pc 0000000000089b00 /system/lib64/libhwui.so (android::uirenderer::Caches::flush(android::uirenderer::Caches::FlushMode)+164)
#04 pc 00000000000752fc /system/lib64/libhwui.so (android::uirenderer::renderthread::Bridge_destroyHardwareResources(android::uirenderer::renderthread::destroyHardwareResourcesArgs*)+12)
#05 pc 0000000000076934 /system/lib64/libhwui.so (android::uirenderer::renderthread::MethodInvokeRenderTask::run()+24)
#06 pc 0000000000076cc8 /system/lib64/libhwui.so (android::uirenderer::renderthread::SignalingRenderTask::run()+28)
#07 pc 0000000000077c18 /system/lib64/libhwui.so (android::uirenderer::renderthread::RenderThread::threadLoop()+336)
#08 pc 0000000000011590 /system/lib64/libutils.so (android::Thread::_threadLoop(void*)+276)
#09 pc 00000000000aa03c /system/lib64/libandroid_runtime.so (android::AndroidRuntime::javaThreadShell(void*)+136)
#10 pc 0000000000077968 /system/lib64/libc.so (__pthread_start(void*)+36)
#11 pc 000000000001fa30 /system/lib64/libc.so (__start_thread+68)
Lost connection to device.
Running flutter doctor:
Doctor summary (to see all details, run flutter doctor -v):
[√] Flutter (Channel stable, 1.20.4, on Microsoft Windows [Version 10.0.18363.1082], locale en-US)
[√] Android toolchain - develop for Android devices (Android SDK version 29.0.2)
[√] Android Studio (version 3.6)
[√] VS Code (version 1.49.2)
[√] Connected device (1 available)
• No issues found!

Mapfish & Geoserver & Leaflet

I'm using Geoserver 2.13.2 with leaflet0.7.2, I have deployed Geoserver Tomcat 9.0 and followed all steps mentioned in this and I have installed mapfish v3.
I'm trying to print a map and wms layers and I'm using the this plugin.
But when I start printing I got following problem:
Error while generating PDF:
com.itextpdf.text.DocumentException: org.mapfish.print.InvalidJsonValueException: spec.layers[0].baseURL has an invalid value: http://a.tile.openstreetmap.org/ (spec.layers[0].baseURL has an invalid value: http://a.tile.openstreetmap.org/)
at com.itextpdf.text.pdf.PdfDocument.add(PdfDocument.java:821)
at com.itextpdf.text.Document.add(Document.java:277)
at org.mapfish.print.config.layout.Page$1.add(Page.java:76)
at org.mapfish.print.config.layout.MapBlock.render(MapBlock.java:81)
at org.mapfish.print.config.layout.Page.render(Page.java:73)
at org.mapfish.print.config.layout.MainPage.render(MainPage.java:63)
at org.mapfish.print.config.layout.Layout.render(Layout.java:59)
at org.mapfish.print.output.AbstractOutputFormat.doPrint(AbstractOutputFormat.java:31)
at org.mapfish.print.output.PdfOutputFactory.print(PdfOutputFactory.java:58)
at org.mapfish.print.MapPrinter.print(MapPrinter.java:176)
at org.mapfish.print.servlet.MapPrinterServlet.doCreatePDFFile(MapPrinterServlet.java:370)
at org.mapfish.print.servlet.MapPrinterServlet.createAndGetPDF(MapPrinterServlet.java:166)
at org.mapfish.print.servlet.MapPrinterServlet.doGet(MapPrinterServlet.java:97)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:634)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:741)
at org.springframework.web.servlet.mvc.ServletWrappingController.handleRequestInternal(ServletWrappingController.java:165)
at org.springframework.web.servlet.mvc.AbstractController.handleRequest(AbstractController.java:177)
at org.springframework.web.servlet.mvc.SimpleControllerHandlerAdapter.handle(SimpleControllerHandlerAdapter.java:52)
at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:1038)
at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:942)
at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:998)
at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:890)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:634)
at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:875)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:741)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:231)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:53)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
at org.geoserver.filters.ThreadLocalsCleanupFilter.doFilter(ThreadLocalsCleanupFilter.java:26)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
at org.geoserver.filters.SpringDelegatingFilter$Chain.doFilter(SpringDelegatingFilter.java:69)
at org.geoserver.wms.animate.AnimatorFilter.doFilter(AnimatorFilter.java:73)
at org.geoserver.filters.SpringDelegatingFilter$Chain.doFilter(SpringDelegatingFilter.java:66)
at org.geoserver.filters.SpringDelegatingFilter.doFilter(SpringDelegatingFilter.java:41)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
at org.geoserver.platform.AdvancedDispatchFilter.doFilter(AdvancedDispatchFilter.java:37)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:320)
at org.geoserver.security.filter.GeoServerCompositeFilter$NestedFilterChain.doFilter(GeoServerCompositeFilter.java:70)
at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:127)
at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java:91)
at org.geoserver.security.filter.GeoServerCompositeFilter$NestedFilterChain.doFilter(GeoServerCompositeFilter.java:74)
at org.geoserver.security.filter.GeoServerCompositeFilter.doFilter(GeoServerCompositeFilter.java:91)
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334)
at org.geoserver.security.filter.GeoServerCompositeFilter$NestedFilterChain.doFilter(GeoServerCompositeFilter.java:70)
at org.springframework.security.web.access.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:119)
at org.geoserver.security.filter.GeoServerCompositeFilter$NestedFilterChain.doFilter(GeoServerCompositeFilter.java:74)
at org.geoserver.security.filter.GeoServerCompositeFilter.doFilter(GeoServerCompositeFilter.java:91)
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334)
at org.geoserver.security.filter.GeoServerAnonymousAuthenticationFilter.doFilter(GeoServerAnonymousAuthenticationFilter.java:51)
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334)
at org.geoserver.security.filter.GeoServerCompositeFilter$NestedFilterChain.doFilter(GeoServerCompositeFilter.java:70)
at org.springframework.security.web.authentication.www.BasicAuthenticationFilter.doFilterInternal(BasicAuthenticationFilter.java:158)
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
at org.geoserver.security.filter.GeoServerCompositeFilter$NestedFilterChain.doFilter(GeoServerCompositeFilter.java:74)
at org.geoserver.security.filter.GeoServerCompositeFilter.doFilter(GeoServerCompositeFilter.java:91)
at org.geoserver.security.filter.GeoServerBasicAuthenticationFilter.doFilter(GeoServerBasicAuthenticationFilter.java:81)
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334)
at org.geoserver.security.filter.GeoServerCompositeFilter$NestedFilterChain.doFilter(GeoServerCompositeFilter.java:70)
at org.springframework.security.web.context.SecurityContextPersistenceFilter.doFilter(SecurityContextPersistenceFilter.java:105)
at org.geoserver.security.filter.GeoServerSecurityContextPersistenceFilter$1.doFilter(GeoServerSecurityContextPersistenceFilter.java:52)
at org.geoserver.security.filter.GeoServerCompositeFilter$NestedFilterChain.doFilter(GeoServerCompositeFilter.java:74)
at org.geoserver.security.filter.GeoServerCompositeFilter.doFilter(GeoServerCompositeFilter.java:91)
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334)
at org.springframework.security.web.FilterChainProxy.doFilterInternal(FilterChainProxy.java:215)
at org.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy.java:178)
at org.geoserver.security.GeoServerSecurityFilterChainProxy.doFilter(GeoServerSecurityFilterChainProxy.java:142)
at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:357)
at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:270)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
at org.geoserver.filters.LoggingFilter.doFilter(LoggingFilter.java:101)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
at org.geoserver.filters.XFrameOptionsFilter.doFilter(XFrameOptionsFilter.java:79)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
at org.geoserver.filters.GZIPFilter.doFilter(GZIPFilter.java:47)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
at org.geoserver.filters.SessionDebugFilter.doFilter(SessionDebugFilter.java:46)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
at org.geoserver.filters.FlushSafeFilter.doFilter(FlushSafeFilter.java:42)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:200)
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:202)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:96)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:541)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:139)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:92)
at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:688)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:74)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:343)
at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:373)
at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:65)
at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:868)
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1594)
at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
at java.lang.Thread.run(Unknown Source)
Caused by: org.mapfish.print.InvalidJsonValueException: spec.layers[0].baseURL has an invalid value: http://a.tile.openstreetmap.org/ (spec.layers[0].baseURL has an invalid value: http://a.tile.openstreetmap.org/)
at org.mapfish.print.map.readers.HTTPMapReader.checkSecurity(HTTPMapReader.java:136)
at org.mapfish.print.map.readers.HTTPMapReader.<init>(HTTPMapReader.java:76)
at org.mapfish.print.map.readers.TileableMapReader.<init>(TileableMapReader.java:42)
at org.mapfish.print.map.readers.OsmMapReader.<init>(OsmMapReader.java:50)
at org.mapfish.print.map.readers.OsmMapReader$Factory.create(OsmMapReader.java:43)
at org.mapfish.print.map.readers.MapReaderFactoryFinder.create(MapReaderFactoryFinder.java:36)
at org.mapfish.print.map.MapChunkDrawer.renderImpl(MapChunkDrawer.java:120)
at org.mapfish.print.ChunkDrawer.render(ChunkDrawer.java:55)
at org.mapfish.print.ChunkDrawer.tableLayout(ChunkDrawer.java:49)
at com.itextpdf.text.pdf.PdfPTable.writeSelectedRows(PdfPTable.java:855)
at com.itextpdf.text.pdf.ColumnText.goComposite(ColumnText.java:1978)
at com.itextpdf.text.pdf.ColumnText.go(ColumnText.java:999)
at com.itextpdf.text.pdf.ColumnText.go(ColumnText.java:993)
at com.itextpdf.text.pdf.ColumnText.go(ColumnText.java:981)
at com.itextpdf.text.pdf.PdfPRow.writeCells(PdfPRow.java:583)
at com.itextpdf.text.pdf.PdfPTable.writeSelectedRows(PdfPTable.java:831)
at com.itextpdf.text.pdf.PdfPTable.writeSelectedRows(PdfPTable.java:964)
at com.itextpdf.text.pdf.ColumnText.goComposite(ColumnText.java:1986)
at com.itextpdf.text.pdf.ColumnText.go(ColumnText.java:999)
at com.itextpdf.text.pdf.ColumnText.go(ColumnText.java:993)
at com.itextpdf.text.pdf.ColumnText.go(ColumnText.java:981)
at com.itextpdf.text.pdf.PdfDocument.addPTable(PdfDocument.java:2717)
at com.itextpdf.text.pdf.PdfDocument.add(PdfDocument.java:759)
... 111 more
Caused by: org.mapfish.print.InvalidJsonValueException: spec.layers[0].baseURL has an invalid value: http://a.tile.openstreetmap.org/
at org.mapfish.print.map.readers.HTTPMapReader.checkSecurity(HTTPMapReader.java:133)
... 133 more
Here is the config.yml file:
#===========================================================================
# allowed DPIs
#===========================================================================
dpis: [75, 150, 300,254,72]
#===========================================================================
# the allowed scales
#===========================================================================
scales:
- 25000
- 50000
- 100000
- 200000
- 500000
- 1000000
- 2000000
- 4000000
#===========================================================================
# the list of allowed hosts
#===========================================================================
hosts:
- !localMatch
dummy: true
- !ipMatch
ip: www.camptocamp.org
- !dnsMatch
host: demo.opengeo.org
port: 80
- !dnsMatch
host: terraservice.net
port: 80
- !dnsMatch
host: sigma.openplans.org
- !dnsMatch
host: demo.mapfish.org
layouts:
Legal:
mainPage:
pageSize: LEGAL
items:
- !map
spacingAfter: 30
width: 440
height: 483
#===========================================================================
A4 portrait:
#===========================================================================
metaData:
# title: '${mapTitle}'
author: 'MapFish print module'
subject: 'Simple layout'
keywords: 'map,print'
creator: 'MapFish'
titlePage:
pageSize: A4
items:
- !text
spacingAfter: 150
- !text
font: Helvetica
fontSize: 40
spacingAfter: 100
align: center
text: '${layout}'
- !image
maxWidth: 160
maxHeight: 160
spacingAfter: 100
align: center
url: http://trac.mapfish.org/trac/mapfish/attachment/ticket/3/logo_v8_sphere.svg?format=raw
footer: &commonFooter
height: 30
items:
- !columns
config:
cells:
- paddingBottom: 5
items:
- !text
backgroundColor: #FF0000
align: left
text: a red box
- !text
align: right
text: 'Page ${pageNum}'
- !image
align: center
maxWidth: 100
maxHeight: 30
spacingAfter: 200
url: 'http://geoserver.org/img/geoserver-logo.png'
#-------------------------------------------------------------------------
mainPage:
pageSize: A4
rotation: true
# header:
# height: 50
# items:
# - !text
# font: Helvetica
# fontSize: 30
# align: right
# text: '${layout}'
items:
- !text
text: '${mapTitle}'
fontSize: 30
spacingAfter: 30
- !map
spacingAfter: 30
width: 440
height: 483
- !columns
# columns can have an absolute position. In that case, they need the 3 following fields:
absoluteX: 410
absoluteY: 310
width: 100
items:
- !scalebar
type: bar
maxSize: 100
barBgColor: white
fontSize: 8
align: right
- !text
text: '${comment}'
spacingAfter: 30
- !attributes
source: data
spacingAfter: 30
columnDefs:
id:
columnWeight: 2
header: !text
text: ID
backgroundColor: #A0A0A0
cell: !text
text: '${id}'
name:
columnWeight: 5
header: !text
text: Name
backgroundColor: #A0A0A0
cell: !columns
config:
cells:
- backgroundColor: '${nameBackgroundColor}'
borderWidth: 1
borderColor: '${nameBorderColor}'
items:
- !text
text: '${name}'
icon:
columnWeight: 2
header: !text
text: Symbol
backgroundColor: #A0A0A0
cell: !image
align: center
maxWidth: 15
maxHeight: 15
url: 'http://www.mapfish.org/svn/mapfish/trunk/MapFish/client/mfbase/mapfish/img/${icon}.png'
- !text
font: Helvetica
fontSize: 9
align: right
text: '1:${scale} ${now MM.dd.yyyy}'
footer: *commonFooter
What do I need to do for printing to work??

How can I use soundcloud API to search new songs?

I can not use soundcloud API to search new songs, example https://soundcloud.com/search?q=nonstop-vol14-phia-sau-em. Soundcloud API return only old songs.
How can I use soundcloud API to search new songs?
You can use the SoundCloud API to search for tracks.
Example: http://api.soundcloud.com/tracks.json?client_id=[CLIENT_ID]&q=nonstop%20Phia%20Sau%20Em&filter=public
Results:
[{"id":471243825,"kind":"track","created_at":"2018/07/13 16:31:52 +0000","last_modified":"2018/07/13 16:31:54 +0000","permalink":"nonstop-phia-sau-em","permalink_url":"https://soundcloud.com/vi-t-h-219347540/nonstop-phia-sau-em","title":"Nonstop Phía Sau Em","duration":3284369,"sharing":"public","waveform_url":"https://w1.sndcdn.com/NHQyA6PpGFcT_m.png","stream_url":"https://api.soundcloud.com/tracks/471243825/stream","uri":"https://api.soundcloud.com/tracks/471243825","user_id":398075790,"artwork_url":"https://i1.sndcdn.com/artworks-000373448307-3e1aeq-large.jpg","comment_count":0,"commentable":true,"description":"Mọi người nghe nếu có gì sai bỏ qua nha hoặc không hay thì mọi người góp ý giúp mình để mình hoàn thiện hơn nhé. cám ơn mọi người đã cố gắng lắng nghe =))","download_count":10,"downloadable":true,"embeddable_by":"all","favoritings_count":0,"genre":"Soundtrack","isrc":null,"label_id":null,"label_name":null,"license":"all-rights-reserved","original_content_size":78817533,"original_format":"mp3","playback_count":0,"purchase_title":null,"purchase_url":null,"release":"","release_day":null,"release_month":null,"release_year":null,"reposts_count":0,"state":"finished","streamable":true,"tag_list":"","track_type":null,"user":{"avatar_url":"https://i1.sndcdn.com/avatars-000472674369-d550z9-large.jpg","id":398075790,"kind":"user","permalink_url":"http://soundcloud.com/vi-t-h-219347540","uri":"https://api.soundcloud.com/users/398075790","username":"Việt Hà","permalink":"vi-t-h-219347540","last_modified":"2018/07/13 16:34:28 +0000"},"likes_count":15,"attachments_uri":"https://api.soundcloud.com/tracks/471243825/attachments","bpm":null,"key_signature":"","user_favorite":false,"user_playback_count":null,"video_url":null,"download_url":"https://api.soundcloud.com/tracks/471243825/download"},{"id":216723926,"kind":"track","created_at":"2015/07/28 14:58:18 +0000","last_modified":"2018/01/05 14:23:20 +0000","permalink":"mp3-phia-sau-em-kay-tran-ft-binz","permalink_url":"https://soundcloud.com/binz-le/mp3-phia-sau-em-kay-tran-ft-binz","title":"[mp3] Phía Sau Em - Kay Trần ft Binz","duration":224490,"sharing":"public","waveform_url":"https://w1.sndcdn.com/QFSqry1QpiQh_m.png","stream_url":"https://api.soundcloud.com/tracks/216723926/stream","uri":"https://api.soundcloud.com/tracks/216723926","user_id":11577043,"artwork_url":"https://i1.sndcdn.com/artworks-000124615926-ck3v4s-large.jpg","comment_count":199,"commentable":true,"description":"Mixed, Mastered : Sino\nImage : Anh Khôi\nLyrics :\nPhía trước em là đoạn đường dài anh ko nơi đấy\nVì giờ này phía sau lưng em anh bước một mình về\n\nDù đã biết mất em nhưng sao lòng anh vẫn nhói đau \nDù chẳng nói ra câu nhưng anh sẽ luôn ở phía sau \nLà người cho em bờ vai sẽ chia câu chuyện \nI will be waitting for you....for you \nLà người cho em vòng tay bên em mỗi khi \nem khóc vì ai \nChắc có lẽ , Chắc có lẽ, Chắc có lẽ\nVì em đã quên đi những giấc mơ,\nđể anh lại đây cùng những muộn phiền \nRồi cứ thế em bước đi và không cần nghĩ suy\n A đa phải cố quên đi đau thương người hỡi \n\nChorus : \n\nNo No please come back to me\n i will be waiting for you x2 \nXin em hãy một lần nhìn về phía sau,nơi bình minh \nXin em hãy một lần nhìn về phía sau,nơi hoàng hôn\n Chỉ có mỗi riêng anh luôn chờ em\n\nRap\nNỗi buồn này chắc đâu ai hiểu\nPhố dài ta ngược nhau hai chiều\nAnh về lối cũ ta thường qua\nEm về nơi khác bên người ta\nĐường anh về vẫn là gió và mây\nEm đã xa khỏi vòng tay\nGiờ em thêm 1 người mới còn anh thêm 1 bài hát buồn cùng Kay \nAnh muốn gọi gió cho tóc em bay\n\"Gọi nắng trên vai em gầy\"\nNhư là Trịnh Công Sơn anh viết\nNiềm vui kia anh biết\nChôn vùi mãi nơi đây\nEm cứ để con tim này tổn thương cũng được \n em cứ để lòng tin anh dần chết . \nEm cứ để anh điên khùng vô cảm vậy\n mang hết yêu thương đi anh không cần đến .\n Em à ! Đợi chờ không phải là hạnh phúc \nanh biết rằng yêu không nhất thiết phải gần nhau\nnhưng anh thấy nổi nhớ lớn dần lên từng phút \ncảm giác quen thuộc như sắp thêm 1 lần đau ... Vì em\n\nĐã quên đi những giấc mơ để anh lại đây\nCùng những muộn phiền\n(lang thang nơi đây anh bước một mình”\nAnh biết quên mau với em điều đó dễ\nNhững tháng ngày dài đôi ta chỉ có thế\nCon tim cố chấp cứ nghĩ rằng có thể\nThấy em nơi cũ nhưng người đâu có về đâu , no\n\nChorus : \n\nNo No please come back to me\n i will be waiting for you x2 \nXin em hãy một lần nhìn về phía sau,nơi bình minh \nXin em hãy một lần nhìn về phía sau,nơi hoàng hôn\n Chỉ có mỗi riêng anh luôn chờ em\n\nAnh vẫn luôn âm thầm phía sau mà\nĐiều đó em ko cần biết đâu\nGo on và tìm them hạnh phúc\nĐễ những hy vọng trong anh mất dần từng phút\nNếu vô tình em tìm về nơi đầu tiên\nGặp anh nơi đó em đừng ngạc nhiên vì\nAnh vẫn luôn ở đó\n\n\n\n\n\n","download_count":0,"downloadable":false,"embeddable_by":"all","favoritings_count":0,"genre":"VietRap","isrc":null,"label_id":null,"label_name":null,"license":"all-rights-reserved","original_content_size":8970048,"original_format":"mp3","playback_count":0,"purchase_title":null,"purchase_url":null,"release":"","release_day":null,"release_month":null,"release_year":null,"reposts_count":1596,"state":"finished","streamable":true,"tag_list":"RnB","track_type":null,"user":{"avatar_url":"https://i1.sndcdn.com/avatars-000207099477-q5ydaq-large.jpg","id":11577043,"kind":"user","permalink_url":"http://soundcloud.com/binz-le","uri":"https://api.soundcloud.com/users/11577043","username":"Binz Da Poet","permalink":"binz-le","last_modified":"2017/02/28 05:52:01 +0000"},"likes_count":16079,"attachments_uri":"https://api.soundcloud.com/tracks/216723926/attachments","bpm":null,"key_signature":"","user_favorite":false,"user_playback_count":null,"video_url":null,"download_url":null},{"id":459239736,"kind":"track","created_at":"2018/06/16 16:36:49 +0000","last_modified":"2018/06/16 16:42:10 +0000","permalink":"nonstop-viet-mix-yeu-em-tu-phia-sauth","permalink_url":"https://soundcloud.com/phi-lyhoang/nonstop-viet-mix-yeu-em-tu-phia-sauth","title":"nonstop viet mix yeu em tu phia sau...(TH)...","duration":2772582,"sharing":"public","waveform_url":"https://w1.sndcdn.com/t8VGQO0klec0_m.png","stream_url":"https://api.soundcloud.com/tracks/459239736/stream","uri":"https://api.soundcloud.com/tracks/459239736","user_id":247179497,"artwork_url":"https://i1.sndcdn.com/artworks-000361561242-7ujman-large.jpg","comment_count":0,"commentable":true,"description":"","download_count":0,"downloadable":false,"embeddable_by":"all","favoritings_count":0,"genre":"nhac viet","isrc":null,"label_id":null,"label_name":null,"license":"all-rights-reserved","original_content_size":110890840,"original_format":"mp3","playback_count":0,"purchase_title":null,"purchase_url":null,"release":"","release_day":null,"release_month":null,"release_year":null,"reposts_count":0,"state":"finished","streamable":true,"tag_list":"","track_type":null,"user":{"avatar_url":"https://i1.sndcdn.com/avatars-000314128981-ayx9w6-large.jpg","id":247179497,"kind":"user","permalink_url":"http://soundcloud.com/phi-lyhoang","uri":"https://api.soundcloud.com/users/247179497","username":"ly hoang phi","permalink":"phi-lyhoang","last_modified":"2017/06/01 09:15:46 +0000"},"likes_count":3,"attachments_uri":"https://api.soundcloud.com/tracks/459239736/attachments","bpm":null,"key_signature":"","user_favorite":false,"user_playback_count":null,"video_url":null,"download_url":null},{"id":292714388,"kind":"track","created_at":"2016/11/12 17:16:55 +0000","last_modified":"2018/10/30 12:53:03 +0000","permalink":"nonstop-vinahouse-phia-sau-mot-co-gaidj-mario-remix2016","permalink_url":"https://soundcloud.com/marionguyen6789/nonstop-vinahouse-phia-sau-mot-co-gaidj-mario-remix2016","title":"Nonstop Vinahouse - Phía Sau Một Cô Gái 2016(Dj Mario - Remix)vol.4","duration":3581330,"sharing":"public","waveform_url":"https://w1.sndcdn.com/K8Qs9AyVZojN_m.png","stream_url":"https://api.soundcloud.com/tracks/292714388/stream","uri":"https://api.soundcloud.com/tracks/292714388","user_id":209547623,"artwork_url":null,"comment_count":26,"commentable":true,"description":"Hay anh lùi bước về sau để thấy e gãy lun nhỉ kkk","download_count":0,"downloadable":false,"embeddable_by":"all","favoritings_count":0,"genre":"","isrc":null,"label_id":null,"label_name":null,"license":"all-rights-reserved","original_content_size":631674924,"original_format":"wav","playback_count":0,"purchase_title":null,"purchase_url":null,"release":"","release_day":null,"release_month":null,"release_year":null,"reposts_count":339,"state":"finished","streamable":true,"tag_list":"Vinahouse","track_type":null,"user":{"avatar_url":"https://i1.sndcdn.com/avatars-000270205046-6r633c-large.jpg","id":209547623,"kind":"user","permalink_url":"http://soundcloud.com/marionguyen6789","uri":"https://api.soundcloud.com/users/209547623","username":"marionguyen6789","permalink":"marionguyen6789","last_modified":"2016/10/08 15:01:58 +0000"},"likes_count":3039,"attachments_uri":"https://api.soundcloud.com/tracks/292714388/attachments","bpm":null,"key_signature":"","user_favorite":false,"user_playback_count":null,"video_url":null,"download_url":null},{"id":290942684,"kind":"track","created_at":"2016/11/01 10:25:29 +0000","last_modified":"2016/11/01 10:30:55 +0000","permalink":"nonstop-ph-a-sau-m-t-c-g-i","permalink_url":"https://soundcloud.com/tu-n-punk/nonstop-ph-a-sau-m-t-c-g-i","title":"Nonstop Phía Sau Một Cô Gái Remix - Liên Khúc Nhạc Trẻ Remix Tâm Trạng Buồn Hay Nhất 2017 Vol 3.mp3","duration":4222461,"sharing":"public","waveform_url":"https://w1.sndcdn.com/fxcKMLv6W85Z_m.png","stream_url":"https://api.soundcloud.com/tracks/290942684/stream","uri":"https://api.soundcloud.com/tracks/290942684","user_id":204626028,"artwork_url":null,"comment_count":14,"commentable":true,"description":null,"download_count":0,"downloadable":false,"embeddable_by":"all","favoritings_count":0,"genre":null,"isrc":null,"label_id":null,"label_name":null,"license":"all-rights-reserved","original_content_size":65981393,"original_format":"mp3","playback_count":0,"purchase_title":null,"purchase_url":null,"release":"","release_day":null,"release_month":null,"release_year":null,"reposts_count":236,"state":"finished","streamable":true,"tag_list":"soundcloud:source=android-3rdparty-upload","track_type":"recording","user":{"avatar_url":"https://i1.sndcdn.com/avatars-000203854833-lf2oe9-large.jpg","id":204626028,"kind":"user","permalink_url":"http://soundcloud.com/tu-n-punk","uri":"https://api.soundcloud.com/users/204626028","username":"Tuấn Punk","permalink":"tu-n-punk","last_modified":"2017/08/15 17:41:03 +0000"},"likes_count":1557,"attachments_uri":"https://api.soundcloud.com/tracks/290942684/attachments","bpm":null,"key_signature":"","user_favorite":false,"user_playback_count":null,"video_url":null,"download_url":null},{"id":289891094,"kind":"track","created_at":"2016/10/25 13:16:15 +0000","last_modified":"2018/08/03 14:43:26 +0000","permalink":"nonstop-viet-mix-phia-sau-1-co-gai-han-phuc-nhe-an-coi-remix","permalink_url":"https://soundcloud.com/an-t-6/nonstop-viet-mix-phia-sau-1-co-gai-han-phuc-nhe-an-coi-remix","title":"NonStop - Việt Mix - Phía Sau 1 Cô Gái - Hạnh Phúc Nhé - An Còi Remix","duration":5066661,"sharing":"public","waveform_url":"https://w1.sndcdn.com/RGUf9mceUuAb_m.png","stream_url":"https://api.soundcloud.com/tracks/289891094/stream","uri":"https://api.soundcloud.com/tracks/289891094","user_id":68422968,"artwork_url":"https://i1.sndcdn.com/artworks-000190557658-142wy6-large.jpg","comment_count":25,"commentable":true,"description":"\n\nhttps://theartistunion.com/tracks/2db482'>Download for free on The Artist Union","download_count":100,"downloadable":false,"embeddable_by":"all","favoritings_count":0,"genre":"","isrc":null,"label_id":null,"label_name":null,"license":"all-rights-reserved","original_content_size":202645420,"original_format":"mp3","playback_count":0,"purchase_title":null,"purchase_url":"https://theartistunion.com/tracks/2db482","release":"","release_day":null,"release_month":null,"release_year":null,"reposts_count":143,"state":"finished","streamable":true,"tag_list":"","track_type":null,"user":{"avatar_url":"https://i1.sndcdn.com/avatars-000143131428-r8qclu-large.jpg","id":68422968,"kind":"user","permalink_url":"http://soundcloud.com/an-t-6","uri":"https://api.soundcloud.com/users/68422968","username":"An Tộ 12","permalink":"an-t-6","last_modified":"2016/10/15 08:09:36 +0000"},"likes_count":1111,"attachments_uri":"https://api.soundcloud.com/tracks/289891094/attachments","bpm":null,"key_signature":"","user_favorite":false,"user_playback_count":null,"video_url":null,"download_url":null},{"id":469166688,"kind":"track","created_at":"2018/07/09 04:20:25 +0000","last_modified":"2018/07/09 04:20:39 +0000","permalink":"phia-sau-em-kay-tran-thao-pham","permalink_url":"https://soundcloud.com/user-196915779/phia-sau-em-kay-tran-thao-pham","title":"Phia Sau Em Kay Tran Thao Pham","duration":212525,"sharing":"public","waveform_url":"https://w1.sndcdn.com/rfDBXoK6xtrU_m.png","stream_url":"https://api.soundcloud.com/tracks/469166688/stream","uri":"https://api.soundcloud.com/tracks/469166688","user_id":281332621,"artwork_url":null,"comment_count":0,"commentable":true,"description":"","download_count":0,"downloadable":false,"embeddable_by":"all","favoritings_count":0,"genre":"","isrc":null,"label_id":null,"label_name":null,"license":"all-rights-reserved","original_content_size":5099031,"original_format":"mp3","playback_count":0,"purchase_title":null,"purchase_url":null,"release":"","release_day":null,"release_month":null,"release_year":null,"reposts_count":44,"state":"finished","streamable":true,"tag_list":"","track_type":null,"user":{"avatar_url":"http://a1.sndcdn.com/images/default_avatar_large.png?1541088121","id":281332621,"kind":"user","permalink_url":"http://soundcloud.com/user-196915779","uri":"https://api.soundcloud.com/users/281332621","username":"leim","permalink":"user-196915779","last_modified":"2017/01/09 13:22:03 +0000"},"likes_count":617,"attachments_uri":"https://api.soundcloud.com/tracks/469166688/attachments","bpm":null,"key_signature":"","user_favorite":false,"user_playback_count":null,"video_url":null,"download_url":null},{"id":363001535,"kind":"track","created_at":"2017/11/30 14:08:54 +0000","last_modified":"2018/10/23 08:25:44 +0000","permalink":"phia-sau-em-binz-ft-kay-tran-full-shen-remix-dj-do-nhung","permalink_url":"https://soundcloud.com/shenproducer/phia-sau-em-binz-ft-kay-tran-full-shen-remix-dj-do-nhung","title":"Phía Sau Em - Binz ft Kay Trần - ( Full ) Shen Remix [Dj Đỗ Nhung]","duration":359765,"sharing":"public","waveform_url":"https://w1.sndcdn.com/7rZr6RAPViYz_m.png","stream_url":"https://api.soundcloud.com/tracks/363001535/stream","uri":"https://api.soundcloud.com/tracks/363001535","user_id":236134051,"artwork_url":"https://i1.sndcdn.com/artworks-000263236277-smk702-large.jpg","comment_count":2188,"commentable":true,"description":"Đây mới là ver chính chủ nhé ! . Ver trên mạng là ver nháp . Click Buy Dlw\nhttps://theartistunion.com/tracks/264675","download_count":0,"downloadable":false,"embeddable_by":"all","favoritings_count":0,"genre":"Dance & EDM","isrc":null,"label_id":null,"label_name":null,"license":"all-rights-reserved","original_content_size":14420461,"original_format":"mp3","playback_count":0,"purchase_title":null,"purchase_url":"https://theartistunion.com/tracks/264675","release":"","release_day":null,"release_month":null,"release_year":null,"reposts_count":2312,"state":"finished","streamable":true,"tag_list":"Shen \"Đỗ Nhung\" Vinahouse \"phía sau em\" kaytran Binz Congdongdjonline","track_type":null,"user":{"avatar_url":"https://i1.sndcdn.com/avatars-000471282903-itfxkt-large.jpg","id":236134051,"kind":"user","permalink_url":"http://soundcloud.com/shenproducer","uri":"https://api.soundcloud.com/users/236134051","username":"Shen","permalink":"shenproducer","last_modified":"2018/08/04 08:51:58 +0000"},"likes_count":3019,"attachments_uri":"https://api.soundcloud.com/tracks/363001535/attachments","bpm":null,"key_signature":"","user_favorite":false,"user_playback_count":null,"video_url":null,"download_url":null},{"id":261757835,"kind":"track","created_at":"2016/05/01 05:09:04 +0000","last_modified":"2016/05/01 05:20:09 +0000","permalink":"nonstop-mong-kiep-sau-van-la-anh-em-dj-co-vu","permalink_url":"https://soundcloud.com/trang-mins-299842550/nonstop-mong-kiep-sau-van-la-anh-em-dj-co-vu","title":"Nonstop - Mong kiếp sau vẫn là anh em - DJ CÒ VŨ","duration":3810917,"sharing":"public","waveform_url":"https://w1.sndcdn.com/xIFva0uuY3JY_m.png","stream_url":"https://api.soundcloud.com/tracks/261757835/stream","uri":"https://api.soundcloud.com/tracks/261757835","user_id":223594104,"artwork_url":"https://i1.sndcdn.com/artworks-000160658894-233pn7-large.jpg","comment_count":9,"commentable":true,"description":"","download_count":0,"downloadable":false,"embeddable_by":"all","favoritings_count":0,"genre":"Dancehall","isrc":null,"label_id":null,"label_name":null,"license":"all-rights-reserved","original_content_size":152421755,"original_format":"mp3","playback_count":0,"purchase_title":null,"purchase_url":null,"release":"","release_day":null,"release_month":null,"release_year":null,"reposts_count":89,"state":"finished","streamable":true,"tag_list":"","track_type":null,"user":{"avatar_url":"https://i1.sndcdn.com/avatars-000221623842-vuhha0-large.jpg","id":223594104,"kind":"user","permalink_url":"http://soundcloud.com/trang-mins-299842550","uri":"https://api.soundcloud.com/users/223594104","username":"Trang Min's","permalink":"trang-mins-299842550","last_modified":"2016/05/01 06:15:58 +0000"},"likes_count":843,"attachments_uri":"https://api.soundcloud.com/tracks/261757835/attachments","bpm":null,"key_signature":"","user_favorite":false,"user_playback_count":null,"video_url":null,"download_url":null}]

Sorting a matrix with symbolic variables in matlab

How can i sort or arrange this matrix ? The 10th row is showing up now in the very start while it should follow the sequence and comes at 10th place. Few other elements are also misplaced in the middle. All the variables are symbolic in this case. Thank you.
[ P10_1, P10_10, P10_2, P10_3, P10_4, P10_5, P10_6, P10_7, P10_8, P10_9, P1_1, P1_10, P1_2, P1_3, P1_4, P1_5, P1_6, P1_7, P1_8, P1_9, P2_1, P2_10, P2_2, P2_3, P2_4, P2_5, P2_6, P2_7, P2_8, P2_9, P3_1, P3_10, P3_2, P3_3, P3_4, P3_5, P3_6, P3_7, P3_8, P3_9, P4_1, P4_10, P4_2, P4_3, P4_4, P4_5, P4_6, P4_7, P4_8, P4_9, P5_1, P5_10, P5_2, P5_3, P5_4, P5_5, P5_6, P5_7, P5_8, P5_9, P6_1, P6_10, P6_2, P6_3, P6_4, P6_5, P6_6, P6_7, P6_8, P6_9, P7_1, P7_10, P7_2, P7_3, P7_4, P7_5, P7_6, P7_7, P7_8, P7_9, P8_1, P8_10, P8_2, P8_3, P8_4, P8_5, P8_6, P8_7, P8_8, P8_9, P9_1, P9_10, P9_2, P9_3, P9_4, P9_5, P9_6, P9_7, P9_8, P9_9]
The sort function return this.The 10th row should come in the end but it is appearing in the start.
[ P10_1, P10_2, P10_3, P10_4, P10_5, P10_6, P10_7, P10_8, P10_9, P10_10, P1_1, P1_2, P1_3, P1_4, P1_5, P1_6, P1_7, P1_8, P1_9, P2_1, P2_2, P2_3, P2_4, P2_5, P2_6, P2_7, P2_8, P2_9, P3_1, P3_2, P3_3, P3_4, P3_5, P3_6, P3_7, P3_8, P3_9, P4_1, P4_2, P4_3, P4_4, P4_5, P4_6, P4_7, P4_8, P4_9, P5_1, P5_2, P5_3, P5_4, P5_5, P5_6, P5_7, P5_8, P5_9, P6_1, P6_2, P6_3, P6_4, P6_5, P6_6, P6_7, P6_8, P6_9, P7_1, P7_2, P7_3, P7_4, P7_5, P7_6, P7_7, P7_8, P7_9, P8_1, P8_2, P8_3, P8_4, P8_5, P8_6, P8_7, P8_8, P8_9, P9_1, P9_2, P9_3, P9_4, P9_5, P9_6, P9_7, P9_8, P9_9, P1_10, P2_10, P3_10, P4_10, P5_10, P6_10, P7_10, P8_10, P9_10]
horchler suggested in the comments to create proper variable names to make lexicographic sorting using sort work properly. I think this is a very good idea, but unfortunately the format string he suggests does not work. It always pads a zero, ending up with this:
>> P1 = sym('P0%d_0%d',10)
P =
[ P01_01, P01_02, P01_03, P01_04, P01_05, P01_06, P01_07, P01_08, P01_09, P01_010]
[ P02_01, P02_02, P02_03, P02_04, P02_05, P02_06, P02_07, P02_08, P02_09, P02_010]
[ P03_01, P03_02, P03_03, P03_04, P03_05, P03_06, P03_07, P03_08, P03_09, P03_010]
[ P04_01, P04_02, P04_03, P04_04, P04_05, P04_06, P04_07, P04_08, P04_09, P04_010]
[ P05_01, P05_02, P05_03, P05_04, P05_05, P05_06, P05_07, P05_08, P05_09, P05_010]
[ P06_01, P06_02, P06_03, P06_04, P06_05, P06_06, P06_07, P06_08, P06_09, P06_010]
[ P07_01, P07_02, P07_03, P07_04, P07_05, P07_06, P07_07, P07_08, P07_09, P07_010]
[ P08_01, P08_02, P08_03, P08_04, P08_05, P08_06, P08_07, P08_08, P08_09, P08_010]
[ P09_01, P09_02, P09_03, P09_04, P09_05, P09_06, P09_07, P09_08, P09_09, P09_010]
[ P010_01, P010_02, P010_03, P010_04, P010_05, P010_06, P010_07, P010_08, P010_09, P010_010]
I tried to fix the format string but failed. MATLAB refuses to accept the format string which would be needed:
>> P1 = sym('P%.2d_%.2d',10)
Error using sym>createCharMatrix (line
2172)
Symbolic matrix base name must be a
simple variable name.
Error in sym>convertCharWithOption
(line 2138)
s = createCharMatrix(x,a);
Error in sym>tomupad (line 1871)
S = convertCharWithOption(x,a);
Error in sym (line 109)
S.s = tomupad(x,a);
So I wrote my own function to fix this:
function [ s ] = symMatrix( A,set )
%preallocate an empty matrix to fill it in the loop
s=sym(zeros(set));
%just some math t get the required amount of digits.
digits=ceil(log10(max(set)+1));
%generate format string with required digits. Check documentation of sprintf for details
format=['%s%.',num2str(digits),'d_%.',num2str(digits),'d'];
%finally go through the matrix...
for r=1:set(1)
for c=1:set(2)
%...get the right name for each variable ....
sprintf(format,A,r,c);
%...and create a variable with that name.
s(r,c)=sym(n);
end
end
end
Which produces this result:
>> P2=symMatrix('P',[11,11])
P2 =
[ P01_01, P01_02, P01_03, P01_04, P01_05, P01_06, P01_07, P01_08, P01_09, P01_10, P01_11]
[ P02_01, P02_02, P02_03, P02_04, P02_05, P02_06, P02_07, P02_08, P02_09, P02_10, P02_11]
[ P03_01, P03_02, P03_03, P03_04, P03_05, P03_06, P03_07, P03_08, P03_09, P03_10, P03_11]
[ P04_01, P04_02, P04_03, P04_04, P04_05, P04_06, P04_07, P04_08, P04_09, P04_10, P04_11]
[ P05_01, P05_02, P05_03, P05_04, P05_05, P05_06, P05_07, P05_08, P05_09, P05_10, P05_11]
[ P06_01, P06_02, P06_03, P06_04, P06_05, P06_06, P06_07, P06_08, P06_09, P06_10, P06_11]
[ P07_01, P07_02, P07_03, P07_04, P07_05, P07_06, P07_07, P07_08, P07_09, P07_10, P07_11]
[ P08_01, P08_02, P08_03, P08_04, P08_05, P08_06, P08_07, P08_08, P08_09, P08_10, P08_11]
[ P09_01, P09_02, P09_03, P09_04, P09_05, P09_06, P09_07, P09_08, P09_09, P09_10, P09_11]
[ P10_01, P10_02, P10_03, P10_04, P10_05, P10_06, P10_07, P10_08, P10_09, P10_10, P10_11]
[ P11_01, P11_02, P11_03, P11_04, P11_05, P11_06, P11_07, P11_08, P11_09, P11_10, P11_11]
Finally compare the sorting of all three possibilities:
>> P3=sym('P',[11,11])
P3 =
[ P1_1, P1_2, P1_3, P1_4, P1_5, P1_6, P1_7, P1_8, P1_9, P1_10, P1_11]
[ P2_1, P2_2, P2_3, P2_4, P2_5, P2_6, P2_7, P2_8, P2_9, P2_10, P2_11]
[ P3_1, P3_2, P3_3, P3_4, P3_5, P3_6, P3_7, P3_8, P3_9, P3_10, P3_11]
[ P4_1, P4_2, P4_3, P4_4, P4_5, P4_6, P4_7, P4_8, P4_9, P4_10, P4_11]
[ P5_1, P5_2, P5_3, P5_4, P5_5, P5_6, P5_7, P5_8, P5_9, P5_10, P5_11]
[ P6_1, P6_2, P6_3, P6_4, P6_5, P6_6, P6_7, P6_8, P6_9, P6_10, P6_11]
[ P7_1, P7_2, P7_3, P7_4, P7_5, P7_6, P7_7, P7_8, P7_9, P7_10, P7_11]
[ P8_1, P8_2, P8_3, P8_4, P8_5, P8_6, P8_7, P8_8, P8_9, P8_10, P8_11]
[ P9_1, P9_2, P9_3, P9_4, P9_5, P9_6, P9_7, P9_8, P9_9, P9_10, P9_11]
[ P10_1, P10_2, P10_3, P10_4, P10_5, P10_6, P10_7, P10_8, P10_9, P10_10, P10_11]
[ P11_1, P11_2, P11_3, P11_4, P11_5, P11_6, P11_7, P11_8, P11_9, P11_10, P11_11]
>> sort(P1(:)).' %P1 = sym('P0%d_0%d',10)
ans =
[ P01_01, P01_02, P01_03, P01_04, P01_05, P01_06, P01_07, P01_08, P01_09, P02_01, P02_02, P02_03, P02_04, P02_05, P02_06, P02_07, P02_08, P02_09, P03_01, P03_02, P03_03, P03_04, P03_05, P03_06, P03_07, P03_08, P03_09, P04_01, P04_02, P04_03, P04_04, P04_05, P04_06, P04_07, P04_08, P04_09, P05_01, P05_02, P05_03, P05_04, P05_05, P05_06, P05_07, P05_08, P05_09, P06_01, P06_02, P06_03, P06_04, P06_05, P06_06, P06_07, P06_08, P06_09, P07_01, P07_02, P07_03, P07_04, P07_05, P07_06, P07_07, P07_08, P07_09, P08_01, P08_02, P08_03, P08_04, P08_05, P08_06, P08_07, P08_08, P08_09, P09_01, P09_02, P09_03, P09_04, P09_05, P09_06, P09_07, P09_08, P09_09, P010_01, P010_02, P010_03, P010_04, P010_05, P010_06, P010_07, P010_08, P010_09, P01_010, P02_010, P03_010, P04_010, P05_010, P06_010, P07_010, P08_010, P09_010, P010_010]
>> sort(P2(:)).' %P2=symMatrix('P',[11,11])
ans =
[ P01_01, P01_02, P01_03, P01_04, P01_05, P01_06, P01_07, P01_08, P01_09, P01_10, P01_11, P02_01, P02_02, P02_03, P02_04, P02_05, P02_06, P02_07, P02_08, P02_09, P02_10, P02_11, P03_01, P03_02, P03_03, P03_04, P03_05, P03_06, P03_07, P03_08, P03_09, P03_10, P03_11, P04_01, P04_02, P04_03, P04_04, P04_05, P04_06, P04_07, P04_08, P04_09, P04_10, P04_11, P05_01, P05_02, P05_03, P05_04, P05_05, P05_06, P05_07, P05_08, P05_09, P05_10, P05_11, P06_01, P06_02, P06_03, P06_04, P06_05, P06_06, P06_07, P06_08, P06_09, P06_10, P06_11, P07_01, P07_02, P07_03, P07_04, P07_05, P07_06, P07_07, P07_08, P07_09, P07_10, P07_11, P08_01, P08_02, P08_03, P08_04, P08_05, P08_06, P08_07, P08_08, P08_09, P08_10, P08_11, P09_01, P09_02, P09_03, P09_04, P09_05, P09_06, P09_07, P09_08, P09_09, P09_10, P09_11, P10_01, P10_02, P10_03, P10_04, P10_05, P10_06, P10_07, P10_08, P10_09, P10_10, P10_11, P11_01, P11_02, P11_03, P11_04, P11_05, P11_06, P11_07, P11_08, P11_09, P11_10, P11_11]
>> sort(P3(:)).' %P3 = sym('P',10)
ans =
[ P10_1, P10_2, P10_3, P10_4, P10_5, P10_6, P10_7, P10_8, P10_9, P11_1, P11_2, P11_3, P11_4, P11_5, P11_6, P11_7, P11_8, P11_9, P10_10, P10_11, P11_10, P11_11, P1_1, P1_2, P1_3, P1_4, P1_5, P1_6, P1_7, P1_8, P1_9, P2_1, P2_2, P2_3, P2_4, P2_5, P2_6, P2_7, P2_8, P2_9, P3_1, P3_2, P3_3, P3_4, P3_5, P3_6, P3_7, P3_8, P3_9, P4_1, P4_2, P4_3, P4_4, P4_5, P4_6, P4_7, P4_8, P4_9, P5_1, P5_2, P5_3, P5_4, P5_5, P5_6, P5_7, P5_8, P5_9, P6_1, P6_2, P6_3, P6_4, P6_5, P6_6, P6_7, P6_8, P6_9, P7_1, P7_2, P7_3, P7_4, P7_5, P7_6, P7_7, P7_8, P7_9, P8_1, P8_2, P8_3, P8_4, P8_5, P8_6, P8_7, P8_8, P8_9, P9_1, P9_2, P9_3, P9_4, P9_5, P9_6, P9_7, P9_8, P9_9, P1_10, P1_11, P2_10, P2_11, P3_10, P3_11, P4_10, P4_11, P5_10, P5_11, P6_10, P6_11, P7_10, P7_11, P8_10, P8_11, P9_10, P9_11]
I don't know what you mean with "symbolic"? When it's a string, simple parse them as numbers (remove 'P' and replace the underscore '_' with a dot '.').
Finally sort while saving the indices.
this = '[ P10_1, P10_10, P10_2, P10_3, P10_4, P10_5, P10_6, P10_7, P10_8, P10_9, P1_1, P1_10, P1_2, P1_3, P1_4, P1_5, P1_6, P1_7, P1_8, P1_9, P2_1, P2_10, P2_2, P2_3, P2_4, P2_5, P2_6, P2_7, P2_8, P2_9, P3_1, P3_10, P3_2, P3_3, P3_4, P3_5, P3_6, P3_7, P3_8, P3_9, P4_1, P4_10, P4_2, P4_3, P4_4, P4_5, P4_6, P4_7, P4_8, P4_9, P5_1, P5_10, P5_2, P5_3, P5_4, P5_5, P5_6, P5_7, P5_8, P5_9, P6_1, P6_10, P6_2, P6_3, P6_4, P6_5, P6_6, P6_7, P6_8, P6_9, P7_1, P7_10, P7_2, P7_3, P7_4, P7_5, P7_6, P7_7, P7_8, P7_9, P8_1, P8_10, P8_2, P8_3, P8_4, P8_5, P8_6, P8_7, P8_8, P8_9, P9_1, P9_10, P9_2, P9_3, P9_4, P9_5, P9_6, P9_7, P9_8, P9_9]';
% this is the ugly part :)
original = regexp([regexprep(this, {'\[','\]'}, {'',''}) ','], '(.*?),', 'tokens');
m = eval(regexprep(this, {'_', 'P'},{'.',''}));
[s, idx] = sort(m);
original(idx)
As you see, this just works partly, because "symbolic" P10_1 < P10_10, but on numeric level, they're equal. So you just need to figure out to handle it, e.g. ensure you always have two decimal places and complete a leading zero if not.
If it's not a string, ignore this :)