Mortscript XML Parser - Windows Mobile Development and Hacking General

New Version, v2.3
# v2.3 Minor tweak to allow passing a filename instead of
# naruzo 20080117 an XML string
# Added option to disable string shrinking (shrinkString)
# Added a filter option. filterType can be "include" or "exclude"
#
Click to expand...
Click to collapse
I bundled RSSWeather.mscr (an example script that accesses Yahoo! weather feeds), the readme and the parser into one archive. The only file necessary to use the parser itself is parseXML.mscr.
There is also a new example included in the archive, topStories.mscr, which is a tool to access the Yahoo! top stories news feed (http://rss.news.yahoo.com/rss/topstories) and utilizes the new filterTags functionality to improve performance. The script reads each news item, pulls down the image file from Yahoo!'s site and stores several pieces of information in the registry for use in other scripts/rlToday/etc.
==================================================
Hello there!
I wrote an XML parser for Mortscript. From the synopsis:
parseXML.mscr is an XML parser written in Mortscript.
Writing a custom parser for every application tends to waste a lot of effort and time. Although a custom script for 1 particular application may be faster, parseXML.mscr simply offers a way to parse any XML into an easily accessible data structure with minimum coding/Mortscript experience.
The initial use case was to parse a Yahoo! weather RSS feed for use in my rlToday home screen (RSSWeather.mscr) An example script for parsing the Yahoo! Top Stories feed also exists (topStories.mscr)
parseXML is not staggeringly fast, but several options exist that can improve performance. I have not run it against any particularly hairy XML, but in theory it should be able to handle any well-formed XML.
Click to expand...
Click to collapse
### Output:
The following XML:
<rss version="2.0" >
<channel>
<title>ChannelTitle</title>
<item>
<title>ItemTitle</title>
<description lang="en" country="US">This is the description</description>
</item>
</channel>
</rss><!-- Published by blah 2007 -->
Parses to this data structure:
struct["rss"]["version"] = 2.0
struct["rss"]["channel"]["title"] = ChannelTitle
struct["rss"]["channel"]["item"]["title"] = ItemTitle
struct["rss"]["channel"]["item"]["description"]["lang"] = en
struct["rss"]["channel"]["item"]["description"]["country"] = US
struct["rss"]["channel"]["item"]["description"]["value"] = This is the description
struct["comment"] = Published by blah 2007
Click to expand...
Click to collapse
Enjoy!

thanks
NOw i go tmore idea on how to do other stuff.

v3patel said:
NOw i go tmore idea on how to do other stuff.
Click to expand...
Click to collapse
I hope so!
The parser uses Mortscript 'references' to build the data structure, which are a new (and very handy) feature as of version 4.1, if I remember correctly.

@naruzopsycho:
I'm trying to understand your xml parser and what the output would be. Is the output data written to registry, or to a specific file? Please forgive me my very limited knowledge about mortscript that I'm unable to understand your file completely.
The real use I have for this is to understand the weather cache file for pointUI, which is written in xml format (please refer to the attachment), to read the temperature and weather code and insert those to registry to update the S2U2 user weather as suggested in this thread:
http://forum.xda-developers.com/showthread.php?t=390841
I have posted the same question in the above thread and I think you may have a better idea of how to read the xml file.
Thank you for your help!

Related

[Release-28th May 2009]Code Snippet Viewer v0.5.1 + Code Snippet Creator v0.5.0

With this tool you can lookup CodeSnippets on the Go! Just add them to the Access Database, convert it with the included tool "Code Snippet Creator" and copy it to your Device and start "Code Snippet Viewer"
The Viewer is Tested on my Stock HTC Kaiser - But it should run on any Touchscreen powered WM Device with netcfv2
Code:
Code Snippet Viewer v0.5.1
---
1. Copy the "Release" dir on your Windows Mobile Device with .NETcf2
2. Run "CodeSnippetViewer.exe" on Device
- Version 0.5.1
.Fix
- Version 0.5.0
.Release
Code:
Code Snippet Creator v0.5.0
---
1. Run "csviewer.exe" on Desktop PC
2. Press "Create Database" Button to create "CodeSnippets.txt"
3. Copy "CodeSnippets.txt" to your Device, where "CodeSnippetViewer.exe" is located
The Snippets are read out of the "CodeSnippets.mdb", feel free to add your Snippets there, and Post it on XDA-Developers
- Version 0.5.0
.Release
Download
http://www.scilor.com/codesnippets.html
If you have suggestions to improve this, just post it here!
Space Holder for additional things later on
WOW.. very interessting and helpfull Prog thank you
No Problem, if you have suggestions post it here
what is it for?
sorry for this question im just a newbie,
when i see it right r u german, so pm me pls in german if u can THX!
Ok I don't know exactly what this is for? I wish I did because it looks intriguing.
so what is it for now? can anybody describe it please?
You can create an Access Database for Code Snippets or other things you need to access on the go
then you can convert it and upload it to you phone
Website Added:
http://scilor.sc.funpic.de/codesnippets.html
i have tested your app. but it doesnt work. when i use your sample files, it works, but when i generate a new txt from my mdb, there is an error starting the app. ArgumentOutOfRangeException
here is my exported *.txt. I love this program. great work. i try to sync the mdb with a mysql db in the the net. so i can add new snippets online and sync them back to the device.... i have a cms on my website, where i have some modules which i can use for this. it works also with syntax highligtning (on the net) for some of the programming languages.
Thank you for your feedback, but I have the problem, that it doesnt works in the emulator anymore, I do not know why, it worked before xD
I'll If I can find teh problem.
NEW VERSION
Problem should be fixed!
many thx. i will try this @home, because i am now @work i will try to make an exporter with PHP for my online version to, when i have it done, i can mail them to you. this exporter should be easy to code. i can also make an importer, so that you can import a textfile.
the next idea could it be, that you mobile can add a new recordset with a new snippet, so the sync ist complete... but this only an idea by me...
Here you have the needed code for exporting from SQL to textfile (Routine from the Creator):
I have stripped it down just to show the important things
Code:
oRS.Open "SELECT * FROM CodeSnippets ORDER BY ProgrammingLanguage ASC, Category ASC, UnderCategory ASC", oConn, adOpenKeyset
oRS.MoveFirst
txtData = oRS.RecordCount & vbNewLine
For I = 1 To oRS.RecordCount
TempData = oRS.Fields("ID").Value & ">{.+.}<" & _
oRS.Fields("ProgrammingLanguage").Value & ">{.+.}<" & _
oRS.Fields("Category").Value & ">{.+.}<" & _
oRS.Fields("UnderCategory").Value & ">{.+.}<" & _
oRS.Fields("Snippet").Value
txtData = txtData & Replace(TempData, vbNewLine, ".>-NewLine-<.") & vbNewLine
'This Replaces all linebreaks in the Tempdata and attaches it to txtData and also adds a line break afterwards
oRS.MoveNext
DoEvents
Next
oRS.Close
oConn.Close
Call frmViewer.txt_WriteAll(PathTo & "CodeSnippets.txt", txtData)
Here Is a php I wrote from sketch without testing:
Code:
'Connect to the DB first
$newLine = '
';
'Sry that is a new line I do know if "\n" works instead
$SQLString = "SELECT * FROM CodeSnippets ORDER BY ProgrammingLanguage ASC, Category ASC, UnderCategory ASC";
if ($SQLAnswer = mysql_query($SQLString))
{
$txtData = mysql_num_rows($SQLAnswer).$newLine;
while($row = mysql_fetch_object($SQLAnswer))
{
$TempData = $row->ID.'>{.+.}<';
$TempData .= $row->ProgrammingLanguage.'>{.+.}<';
$TempData .= $row->Category.'>{.+.}<';
$TempData .= $row->UnderCategory.'>{.+.}<';
$TempData .= $row->Snippet;
$txtData .= $newLine.str_replace('.>-NewLine-<.', $newLine, $TempData).$newLine;
}
}
'Write $txtData to a File!
yes this should do the job. i will try it at the weekend. many thx
the rapidshare link show the old version. Can you please update the file or the link?
i have done the online version. there is a *.sql file included, this generates the needed MySQL tables. Also there is a slightly modified *.mdb. i have only modified the Formular.
next there are the needed php an html files for the webserver. the html file is a template, so anyone can modify it.
Update:
i have done some Additions. Included is now EditArea a OpenSource Syntax Highlightning Script. Also i have added a new version of the SQL table, since there is a new field "highlight", this is only for the JavaScript, this field will not be exported in any way.
Now you can manualy add a ProgrammingLanguage or Category by the textfield OR you can choose one from existing Selectbox.
The last time i have forgotten to say, that you must configure the MySQL connection in the common.php. have a look at the following block and put in the right values:
Code:
define("DATABASE_NAME","");
define("DATABASE_USER","");
define("DATABASE_PASSWORD","");
define("DATABASE_HOST","");
Sorry, made a mistake on my website, now it points to the new version
there is no new *.exe file in the zip :-( the directory contains only some txt files :-( please reupload the file.
Sry, here it is again.
Had a problem with my packer

[APP] VipRegExport 8.0 Registry backup Utility based on ini file

I have created small utility Called VipRegExport.
Requirement : .netCF 2.0 higher
What Utility Do
It reads input ini file and create registry export per section for every values in that section. It saves registry in .reg file.
Sample ini file
# Secion name will file name to be export registry values in it
# this is how you can comments
[MyKeys]
F01=HKLM\Software\Microsoft\Shell\Keys
F02=HKCU\Software\Microsoft\Today\Keys
#Setting for all third party software
[MySoftware]
F03=HKCU\Software\HButton
F04=HKCU\Software\waku
F05=HKEY_CURRENT_USER\Software\TodayAgenda
F06=HKEY_CURRENT_USER\Software\pocketMax
F07=HKEY_CURRENT_USER\Software\AlenSoft
F08=HKCU\Software\Microsoft\Shell\TaskSwitch
F09=HKLM\Software\ThrottleLauncher
F10=HKEY_CURRENT_USER\Software\Parlingo
F11=HKEY_CURRENT_USER\Software\Mort
F12=HKEY_CURRENT_USER\Software\Ghisler
F13=HKEY_CURRENT_USER\Software\FdcSoft
F14=HKEY_CURRENT_USER\Software\CallCalendar2
F15=HKEY_LOCAL_MACHINE\SOFTWARE\SHEALD
F16=HKLM\Software\HTC\HTCHome\Weather\Settings
F17=HKEY_LOCAL_MACHINE\Software\Pointui
F18=HKEY_LOCAL_MACHINE\Software\WiFiFoFum
F19=HKLM\Software\Apps\VicSoft ClearTemp
F20=HKEY_LOCAL_MACHINE\Software\Saman
[MyExtention]
F21=HKEY_CLASSES_ROOT\.mscr
F22=HKEY_CLASSES_ROOT\.mortrun
F23=HKEY_CLASSES_ROOT\MortScript
F24=HKEY_CLASSES_ROOT\.mbi
F25=HKEY_CLASSES_ROOT\MortButtonInfo
F26=HKEY_CLASSES_ROOT\.reg
F27=HKEY_CLASSES_ROOT\regfile
F28=HKEY_CLASSES_ROOT\.pdf
F29=HKEY_CLASSES_ROOT\AdobeReaderLE.2
[MySetting]
S01=HKLM\Software\Softick\Card Export\RunTrayClientAtStartup
S02=HKLM\Software\HTC\PHONE\BatteryIconLevel
S03=HKLM\Software\HTC\PHONE\bShowBatteryIcon
S04=HKCU\Software\Microsoft\Internet Explorer\Main\Default storage location\All Files
S05=HKCR\SystemFileAssociations\image\shell\save\Save Location\Default
S06=HKCR\SystemFileAssociations\audio\shell\save\Save Location\Default
S07=HKCR\SystemFileAssociations\video\shell\save\Save Location\Default
S08=HKCU\Software\HTC\Camera\4.00\Strings\Save Location
S09=HKLM\Software\HTC\Camera\General\EnableDCIM
S10=HKLM\Software\HTC\SUPL AGPS\EnableAGPS\Assisted GPS
S11=HKLM\Software\HTC\SUPL AGPS\EnableAGPS
S12=HKCU\ControlPanel\Phone\ShowSIM
S13=HKEY_CURRENT_USER\ControlPanel\BackLight\QKeyLedTimeout
S14=HKLM\Software\OEM\Power\ShowMovingChargeBar
S15=HKCU\ControlPanel\Sounds\RingTone0\Sound
S16=HKCU\ControlPanel\Sounds\RingTone0\script
S17=HKCU\ControlPanel\Sounds\RingTone0\Category
S18=HKLM\Security\Policies\Policies\0000101a
S19=HKLM\Software\Microsoft\Shell\ShowTitleBarClock
S20=HKCU\Software\Microsoft\Today\Skin
S21=HKCU\ControlPanel\Keybd\DefaultKeyLock
S22=HKLM\Software\HTC\HTCHome\TabSetting
Click to expand...
Click to collapse
There are three command line arguments supported
argument 1 : <inifilename including path> if not given then default is VipRegExport.ini
argument 2 : <Output Folder name including path> If not given default Application Folder
argument 3 : <slient Option> Default is 'N'. If you want to run in slient option then pass third parameter as "Slient"
What is slient option : It will not display any error message like "Registry key does not exist to export" and exit application after export completes.
GUI also gives ability to select input file as well output Folder.
HKEY_LOCAL_MACHINE\Security\Policies\Policies\000010a will export just one key 0000101a in HKEY_LOCAL_MACHINE\Security\Policies\Policies
where as F03=HKEY_CURRENT_USER\Software\HButton will export all keys and subkeys under that registry.
Basically if you want to export full registry including all subkeys and values then put actual key name in value If you only want to just export single keyvalue in specific registry then put keyname\valuename.
It also support HKCU, HKLM, HKCR, HKUS formats as well.
Restriction : Currently export can not export some new registry type like reg_multi_size etc but so far none of my registry values that I needed to export are of those type they mostly String, int, and binary value they all are supported.
Above restriction is removed. Now utility support all types of Registry. Credit Goes to Elemris craetor Kheb. ELemris Thank for helping me out on and sharing your code.
Uploaded new version
Now you can export entire registry with below in INI file
[MyFULLRegistry]
F01=HKLM
F02=HKCU
F03=HKCR
Version 8.0
Fixed "\" in key reported in post # 10
Version 9.0
Quick Fixed "@" in key http://forum.xda-developers.com/showpost.php?p=8347552&postcount=10
If you like my work then please consider donating
FAQ:
Do we need to put F01, F02..... what's happening if I have 2 F01?
F01, F01, F03 is just key in ini File It is not used any where in Program but it is needed in ini file as they are part of ini like section , key and value
Posted Version 4.0
Posted Version 4.0
posted new version 6.0.
Completely working. no restriction any more.
Interesting, thanks.
just one question, then.
So using:
[MyKeys]
F01=HKLM
F02=HKCU
F03=HKCR
will make complete registry dump? in one file?
I wouldn't ask, but i just cannot test it at this moment..
Can not export all reg's at present but i will include in next version
pupakota said:
Interesting, thanks.
just one question, then.
So using:
[MyKeys]
F01=HKLM
F02=HKCU
F03=HKCR
will make complete registry dump? in one file?
I wouldn't ask, but i just cannot test it at this moment..
Click to expand...
Click to collapse
New version can export entire registry
Strange,
F50=HKEY_LOCAL_MACHINE\SOFTWARE\HTC\Manila\Configuration
returns an empty key
I have a question:
Do we need to put F01, F02..... what's happening if I have 2 F01?
F01, F01, F03 are basic part if inin and they are needed.
romualdrichard said:
Strange,
F50=HKEY_LOCAL_MACHINE\SOFTWARE\HTC\Manila\Configuration
returns an empty key
I have a question:
Do we need to put F01, F02..... what's happening if I have 2 F01?
Click to expand...
Click to collapse
F01, F01, F03 is just key in ini File It is not used any where in Program but it is needed in ini file as they are part of ini like section , key and value
F50=HKEY_LOCAL_MACHINE\SOFTWARE\HTC\Manila\Configu ration
Click to expand...
Click to collapse
notice that space between configu
and
ration
here.
Tipo here only. I found that it tries to write this key but I have:
[HKEY_LOCAL_MACHINE\SOFTWARE\HTC\Manila] instead and empty.
Maybe the key is locked or something like that.
\\ are not written correctly I think in name of keys?
I tried to backup F10=HKEY_CURRENT_USER\Software\FdcSoft (pimBackup settings) and found that the custom list (folders list) does not have \
I have "\Windows\Rings\*.*"=dword:00000001 in the backup reg
But after, in the reg I have WindowsRings*.*
Looks like, the import (from sktools) needs \\ to save \...
Actuly it was fixed in version 7.5 but i did not released it.
It is now fixed in new version 8.0
Hi,
May be a good option would be to have an information in the .ini to set the export directory when you load the ini.
romualdrichard said:
Hi,
May be a good option would be to have an information in the .ini to set the export directory when you load the ini.
Click to expand...
Click to collapse
I will add in next version. Right now planning to add WAP export e.g emails setting, wi-fi setting etc exported to xml
Hi v3patel,
stuff like this must be a sticky, because it helps us devs a little bit. Ok there are more other things, but not based on a ini file. With that and mort i have done now two tests and they look really good. I hope you will support it further. And when i read your last post (top on my one) then it is very interesting. Thank you for sharing with us...

[UTILITY] Lua 5.1 tools: compiler, decompiler, snippets & extendable lua.dll with SDK

[UTILITY] Lua 5.1 tools: compiler, decompiler, snippets & extendable lua.dll with SDK
Hi!
This package contains lots of useful tools for Manila3D Lua5.1 editing. You can find here a compiler a decompiler, a small script repository at post #3 and ExtLua, which provides developers the possibility to extend M3D's functionality.
Also check m9editor which is a really great application to edit mode9 files by 6Fg8!
And check Manila kitchen project which hosts the decompiled scripts with a LUA IDE and everything ready to go.
You might want to try out mode9 converter too.
ChangeLog
LuaDec 2.0
Finds out where locals are
Read more here
LuaDec 1.9
Some changes regarding LDS(2) strings and for loops (it's still a bit unstable)
LuaDec has a new option to disassemble instead of decompile
The provided lua package (lua, luac and luadec) is now unicode compilant, it will read and write the unicode variants of the scripts instead of the ascii variants.
Read more here
LuaDec 1.0
Added LDS2 support to both luadec and luac
Fixed OP_TFORLOOP handling
Read more here
LuaDec Beta6
Improved luadecguesser with fast mode
Fixed a crashing when encountering boolean values
Increases happy face rate in XDA-developers forum
Read more here
LuaDec Beta5
Improved luadecguesser
Read more here
luaDec Beta4
Upvalue handling
Added a brute-force local variable searcher application
Read more here
luaDec Beta3
Generic for loop handling
Improved local variable handling
Read more here
ExtLua 0.1
Initial release
Read more here
luaDec Beta2
Less crashing
More decompiling
Read more here
LuaDec Beta1
Decompiling simpler scripts and recompiling them will result in a semantically identical compiled lua script!
Numeric for loops are fixed, they should work fine
Complex boolean expressions and conditional statements will make luadec crash
Only works with ascii files. Don't forget to convert the lua files to ascii then back to unicode
Good to know
Luadec will output a "-- Lua5.1" or "-- Warning" comment to lines, where you should check the output.
If luadec crashes try running it with the "-d" parameter to acquire as much information as you can.
Compile your lua files with the "-s" parameter set.
It was compiled with Visual C++ 2008, so you might need the MSVC++ 2008 redistributables too.
Valid Numbers are in range from -32768.0 to 32767.0. Numbers not in this range will be cropped by the compiler.
There is a decompilation tutorial starting here
DL link: http://winmo.sztupy.hu/luadec.html
I start a repository at post #3 for them, but you can just look at the decompiled rhodium2 scripts too.
Does not work for me.
Useful snippets of code
Succesfully decompiled scripts
All rhodium and rhodium2 scripts:
http://winmo.sztupy.hu/manilakitchen.html
Run an application:
Code:
Shell_NavigateTo(command,parameters)
Add an eventhandler to an event: (thx D-MAN666)
Code:
object.EventName:connect(functionRef, scopeRef);
object.EventName:disconnect(functionRef, scopeRef);
Where events can be: onPress, onRelease, onReleaseOutside
Example (from 4aefb03d_manila):
Code:
require("hitfeedback")
OnPhotoTouchPress = function(loc_0)
gnPhotoTouchPressY = loc_0._ymouse
Camera3DHitFeedback:Press()
end
PhotoHitTarget.onPress:connect(OnPhotoTouchPress)
sztupy said:
More detail please... no output? crash ? missing dlls?
Click to expand...
Click to collapse
It simply return "cannot execute this file", tested on XP and Win7 beta
do you have to do something first at manila files?
for me say bad headers!
@udk : i'm running on win 7 beta too and it's working in CMD...
utopykzebulon said:
@udk : i'm running on win 7 beta too and it's working in CMD...
Click to expand...
Click to collapse
That's strange, maybe I miss some files.
udK said:
It simply return "cannot execute this file", tested on XP and Win7 beta
Click to expand...
Click to collapse
Do you have the MS Visual C++ 2008 redistributables? (MSVCR9 and MSVCP9)
utopykzebulon said:
do you have to do something first at manila files?
for me say bad headers!
@udk : i'm running on win 7 beta too and it's working in CMD...
Click to expand...
Click to collapse
did you unicode2ansi them?
sztupy said:
did you unicode2ansi them?
Click to expand...
Click to collapse
yes it's work onw thx man
For "ERROR_nil" you have to decompile lua files with chunkspy and correct it manually
utopykzebulon said:
yes it's work onw thx man
For "ERROR_nil" you have to decompile lua files with chunkspy and correct it manually
Click to expand...
Click to collapse
I' now comparing the VM docs of 5.0 and 5.1 and I'm comparing the changes. I already corrected a lot of bugs, so in the next version you might not even need chunkspy
sztupy said:
I' now comparing the VM docs of 5.0 and 5.1 and I'm comparing the changes. I already corrected a lot of bugs, so in the next version you might not even need chunkspy
Click to expand...
Click to collapse
you're great man
waiting for your relase!
Alpha 2:
Less chatty (no more "arg" values)
Fixed constant loading errors
fixed function variables
Added handlers to the new opcodes
Some changes to OP_TEST
Check first post for links.
I also started a repository for useful snippets of code at post #3
Wow, that looks promising!
Hi!
beta1 is released. I also added a compiler (and an interpreter just in case), that was changed to use TF3D's Q16.16 numeric encoding format. (Thanks to D-MAN for deciphering the encoding)
Currently luadec is able do decompile a lot of scripts, except:
Scripts with too much local variables
Scripts with complex boolean expressions and conditional statements
Scripts where luadec crashes while decompiling
This means however that recompiling small scripts WORK, and will result in a semantically identical files (semantically means it will do the same as the original. Usually the only thing that is changed is the line number of the function declarations (yes, lua stores this information in the compiled files) )
Tutorial
For example, to change 4aefb03d_manila do the following:
1. Convert it to ascii
Code:
luaconv 4aefb03d_manila x uni2asc
2. Decompile
Code:
luadec x > m.lua
3. Edit m.lua
4. Recompile using luac from my package
Code:
luac -s m.lua
5. Convert output back to unicode
Code:
luaconv luac.out 4aefb03d_manila.new asc2uni
Here is an example: this will run footprints instead of HTCAlbum
Code:
require("hitfeedback")
gnPhotoTouchPressY = -1
Camera3DHitFeedback = HitFeedback(Camera3D)
OnPhotoTouchPress = function(loc_0)
gnPhotoTouchPressY = loc_0._ymouse
Camera3DHitFeedback:Press()
end
OnPhotoTouchRelease = function(loc_0)
Camera3DHitFeedback:Release()
if gnPhotoTouchPressY ~= -1 and loc_0._xmouse < CameraSprit.Position.x and noImage2DCamera._visible == false then
Shell_NavigateTo("\\Windows\\HTCFootprint.exe", "")
end
gnPhotoTouchPressY = -1
end
OnPhotoTouchReleaseOutside = function()
Camera3DHitFeedback:Release()
end
PhotoHitTarget.onPress:connect(OnPhotoTouchPress)
PhotoHitTarget.onRelease:connect(OnPhotoTouchRelease)
PhotoHitTarget.onReleaseOutside:connect(OnPhotoTouchReleaseOutside)
You're the best
Now we can create a lots of manila mods
i try it now
thanks a lot for this tool
one of the best with mode9editor
edit after use:
really a giant leap in manila research....
fantastic work, sztupy. Already working on integration with m9editor. You're going to break the final frontier
6Fg8 said:
fantastic work, sztupy. Already working on integration with m9editor. You're going to break the final frontier
Click to expand...
Click to collapse
it will be fantastic....
WOW! manila's inside out
great work
i'm using windows 7 beta and i'm getting this error:
the application has failed to start because its side-by-side configuration is incorrect. Please see the application event log or use the command-line sxstrace.exe tool for more detail.
how to correct this?
pcarvalho said:
WOW! manila's inside out
great work
i'm using windows 7 beta and i'm getting this error:
the application has failed to start because its side-by-side configuration is incorrect. Please see the application event log or use the command-line sxstrace.exe tool for more detail.
how to correct this?
Click to expand...
Click to collapse
Did you install the MSVC++ 2008 redistributables?
sztupy said:
Did you install the MSVC++ 2008 redistributables?
Click to expand...
Click to collapse
yes, all that you say in first post is installed...
in the log i have:
Activation context generation failed for "C:\Users\XXXXXXXXX\Desktop\lua\luadec.exe". Dependent Assembly Microsoft.VC90.DebugCRT,processorArchitecture="x86",publicKeyToken="1fc8b3b9a1e18e3b",type="win32",version="9.0.21022.8" could not be found. Please use sxstrace.exe for detailed diagnosis.
and found this...
http://www.gamedev.net/community/forums/topic.asp?topic_id=493103

[Sous-Chef's TIPs] Love .PROVXML's? Hate Not Knowing If It Worked?

So there you are; in the heat of the kitchen, adding your favourite ROM ingredients ... pinch of this, sprinkle of that. Like all good chefs, you decide to take a taste of your preparation before serving to others - nothing is more embarrassing than a meal gone wrong.
So you try it ... wait! you say, something is not right. You're positive you added the ingredients but it's not right. Could it be that a darn .PROVXML didn't get processed in a package? Which one? Time to look at the .PROVXML and check if the entries made it ... what happens if you have a hundred or more .PROVXML's in your kitchen .\PACKAGES or .\EXT folder?
Well, here's a few quick tips for those who love/hate those .PROVXML's
Tip #1: dotFred (FdcSoft) Task Manager 3.1
dotFred Task Manager includes an option to install Provision(er) .XML files. To use it however, you need to make sure that an .XML header appears as the first line of your .PROVXML file. Additionally, you'll need to temporarily rename the .PROVXML to .XML before copying to your device for testing with dotFred Task Manager.
Code:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
Once you've confirmed that all is well with your .XML, remove the .XML header and rename the file back to .PROVXML ... you're done.
URL: http://www.dotfred.net/TaskMgr.htm
Tip #2: Log .PROVXML Processing
Another handy little trick, is to add the following code to the end of your .PROVXML file. Place the code at the end of the .PROVXML file - just before/above the </wap-provisioningdoc> statement. This way, the characteric is the last item processed if all is well with the contents of the .PROVXML file.
Place your logging registry value in the OEM registry sub-key; for example, HKLM\Software\OEM\PROVXML ... same place as the MASD sub-key where package version information usually appears. Saves having to look all over the device registry.
Code:
<wap-provisioningdoc>
...
<!-- Add Registry Entry To Log PROVXML (XDADevelopers DD.MM.YYYY) -->
<characteristic type="Registry">
<characteristic type="HKLM\Software\OEM\PROVXML">
<parm name="[COLOR=blue]<SIMPLENAME>[/COLOR]" datatype="string" value="[COLOR=blue]<PROVXMLFileName>[/COLOR]" />
</characteristic>
</characteristic>
</wap-provisioningdoc>
<SIMPLENAME>
Simple friendly registry (REG_SZ) value name; stick with the basics: a-z, A-Z, 0-9. For example, if your .PROVXML file is entitled mxip_Package_MyApp_0_0_0_0, you could set the [SIMPLENAME] to: MyApp0000
<PROVXMLFileName>
Actual .PROVXML filename; that's what it's all about right? What's the point of adding something meaningless. For example, if your .PROVXML file is entitled mxip_Package_MyApp_0_0_0_0, you would set <PROVXMLFileName> to: mxip_Package_MyApp_0_0_0_0.provxml.
Tip #3: RAPICONFIG
Another method to test .PROVXML file is to use the RAPICONFIG utility. XDA members cruiserrr and kheechun report that RAPICONFIG is a quick (and painless) way to test .PROVXML files. Copy the RAPICONFIG (and other utilites) to your kitchen, connect your mobile device via ActiveSync, prepare an .XML file with the registry keys to upload/download, and submit the .XML via RAPICONFIG.
URL: http://forum.xda-developers.com/showthread.php?p=1899755#post1899755
URL: http://msdn.microsoft.com/en-us/library/bb737283.aspx
Tip #4: ANSI or Not To ANSI. And If Not, UTF-8 with/without Signature
Well that is the question, and frankly, i'm not sure there's a right or wrong answer. For example, some Microsoft forum/blog entries seem to elude to ANSI being the preferred choice if the .PROVXML will contain certificate information.
Other forum/blog entries and seasoned chefs will tell you to save them as UTF-8 with Unicode BOM Signature. Others yet, will recommend UTF-8 ... no signature.
So, that is the question indeed ...
Understanding Provisioning
http://msdn.microsoft.com/en-us/library/aa456234.aspx
Metabase Settings
http://msdn.microsoft.com/en-us/library/bb737493.aspx
Provisioning for Windows Mobile-Based Devices
http://msdn.microsoft.com/en-us/library/ms894922.aspx
Configuration Service Provider Reference for Windows Mobile-Based Devices
http://msdn.microsoft.com/en-us/library/ms889539.aspx
Thanks for sharing, these are all good suggestions.
In my case, when I want to know if my provxml is going to work, I usually just put the file into an installable cab and run it on the phone. If setup was successful, then at least I've confirmed that the syntax was good.
You have to rename the *.provxml file to _setup.xml and then insert it into a cab with:
Code:
MAKECAB _setup.xml InstallCabFile.cab
Another tool to check syntax is the free Microsoft XML editor.
Best regards,
-boggsie
boggsie said:
Another tool to check syntax is the free Microsoft XML editor.
Click to expand...
Click to collapse
XML Notepad 2007
http://www.microsoft.com/DownLoads/...49-787d-4118-ba5f-4f30fe913628&displaylang=en
IMHO the most "easyer" way to know if the syntax is OK is to rename the provxml to .xml and double click it:
If properly written, Internet Explorer (IE) will launch and display the full text
If not, IE will display where it stopped reading (where the error is) and the provxml will not be displayed
Other important aspect is the "file operations":
A provxml will not execute a file operation on a non-existing directory (folder), so the whole provxml contents won't be executed
my 2 cents and congrats for all your great tuts hilaireg
Very, very nice info indeed. HUGE thanks for sharing these tips!
gtrab said:
Other important aspect is the "file operations":
A provxml will not execute a file operation on a non-existing directory (folder), so the whole provxml contents won't be executed
Click to expand...
Click to collapse
This is virtually always what trips me up - forgetting to make a dir before doing something.
With regards to ANSI/UTF-8 etc. I always save as UTF-8 (no signature) and don't have any issues. If I mistakenly save as something else (perhaps by copying the xml into a new file) then I have problems with it not running.
I use all the methods commented here but I am missing another one: rapiconfig.exe lets you download the registry part you want as xml and as well upload it. Combining this with ceregeditor and a dump key like described above it is easy to see if things happened. In fact, rapiconfig can download the answer to a file as well.
Very useful for the start menu, hardkeys, owner, etc.
indeed, I found that RAPICONFIG.exe is the BEST so far, really made my life much easier OP if possible please include that to the top post
It would be my pleasure to add that to the first post. I haven't personally tried this method ... would you mind writing up the steps/procedures and any tips? If you have some links, it would be helpful to have them as well in case other members need the tools.
Cheers,
hilaireg said:
It would be my pleasure to add that to the first post. I haven't personally tried this method ... would you mind writing up the steps/procedures and any tips? If you have some links, it would be helpful to have them as well in case other members need the tools.
Cheers,
Click to expand...
Click to collapse
here you will find a great post with a nice how-to-do.
http://forum.xda-developers.com/showthread.php?p=1899755#post1899755
Yup, found it via the above link as well, it contains instructions on how to extract binary data into XML/provisional XML for UC.
However if you want to test your XML/PROVXML, just use the command
rapiconfig.exe /p <file.xml>
It'll feedback if there is any error in the XML.
However to make a postivie confirmation, you still have to check your file system/registry to see if the actions are taken.
Here is the official information:
http://msdn.microsoft.com/en-us/library/bb737283.aspx
Provisioning overview and Rapi~ Utilities
What can be 'provisioned' for phones?
1 Server provisioning
2 User provisioning
3 Mobile subscriber provisioning
4 Mobile content provisioning
5 Internet access provisioning
Provisioning Mobile Devices an introduction/article about 'provisioning'.
Windows Mobile Provisioning Samples some samples provided by Microsoft
Understanding Provisioning This is the main concept
Here my RapiUtils;
- RapiAttr: Modifies a file's attributes
- RapiCopy: Copies a file between the desktop and a connected device
- RapiDir: Create or remove a directory on the device
- RapiExists: Determines if a file exists
- RapiMove: Move or delete a file on the device
- RapiProc: List and terminate processes on the device
- RapiReg: View and modify registry keys on the device
- RapiStart: Launches an executable on the device
- RapiSync: Sync files from a directory to the device
- RapiTime: View and modify a file's timestamp
- RapiTree: Produces a "dir" like output of a directory.
- RapiGrab.bat: Uses RapiCopy to take a screen shot of the device and copy it to the desktop
- BatteryMon.exe: Desktop utility to present a simple graph showing battery charge for a connected device.
- CeKeyboard2.exe: Desktop utility to copy keyboard keys from the desktop to a connected device.
.NET XML PowerToys:
Generating XML Documents from XML Schemas
The XML Diff and Patch GUI Tool
Using the XML Diff and Patch Tool in Your Applications
Using the XSD Inference Utility
XML Tools Update
Power Toys for .NET Compact Framework 3.5
&
NETCFv35.Messages.EN.wm.cab
MSXML SDK
Would it not be great when we have a Bootstrapping Server here on XDA-Developers ? Converting our _setup.xml via makecab into *.CPF (CAB Provisioning File) and upload 'm to our (future) OMA DM server <g>
Understanding Bootstrapping
Have a nice read and rapi-config-battle,
Edit:
While surfing the net I stubmled upon Mobile Profiler (freeware) and it does a nice job for me; creating on the fly wap-provisioningdocs
-=[ extract downloaded *.exe with Universal Extractor to obtain the *.cab without using ActiveSync ]=-
Mobile Profiler (slightly edited) description;
Mobile Profiler is a tool for creating and restoring system states in XML based snapshots.
It is specialized to save and restore network settings like proxy servers and connection entries. Though there is more..
Whenever you switch a phone profile, Mobile Profiler restores the assigned snapshot.
There is a stand alone mode available for users without phoneAlarm (not free) or for manual switching. \o/
Many things can be stored into a snapshot ;
system settings,
registry keys,
file operations.
The snapshots are simple XML document which can be manipulated with any unicode aware editor.
Have fun,
Senax
I also had a problem with my .provxml and sometimes I wonder if the file itself was missed.. are there any standard naming of .provxml files? I had my .provxml configuration files in "Sources\Devices\HTC Raphael\OEM Packages\HTC Raphael Packages\OperatorPkg" am using osKitchen by the way..
I really don't see any errors in my .provxml but you can take a look at it and tell me if I missed something.
-update-
oh and I got to ask, I read here somewhere in this thread that if the reg key does not yet exists, it will not read my specific reg entry? Is there anyway that I can create this key using .provxml?
Nullstring said:
I also had a problem with my .provxml and sometimes I wonder if the file itself was missed.. are there any standard naming of .provxml files?
Click to expand...
Click to collapse
Assuming you have looked at the links in Post #1 (Tip 4), I haven't found much more on the subject.
I had my .provxml configuration files in "Sources\Devices\HTC Raphael\OEM Packages\HTC Raphael Packages\OperatorPkg" am using osKitchen by the way..
I really don't see any errors in my .provxml but you can take a look at it and tell me if I missed something.
Click to expand...
Click to collapse
Other than the header not having been removed as noted in Post #1 (Tip 1), the rest of the file looks fine to me. Have you tried using FDC Task Manager to import the .PROVXML?
oh and I got to ask, I read here somewhere in this thread that if the reg key does not yet exists, it will not read my specific reg entry?
Click to expand...
Click to collapse
AFAIK, the registry key should be created automatically - providing of course that the key path is valid.
Is there anyway that I can create this key using .provxml?
Click to expand...
Click to collapse
I make use of .provxml files extensively in my Raphael Kitchen; feel free to download it and examine the operator packages.
@hilaireg
thank you for that wonderful information! After fixing these xmls in VS IDE, they finally worked.. I just removed these comments and extra blank lines and put all these reg entries in one node <characteristic type="Registry"> they all seems to work now.
1 last question. in my OperatorPkg folder, I have 10 .provxml files and they were named mxiupdate_oemoperators_###.provxml + 1 mxiupdate_OEMVERSION_###.provxml
is it ok to just add my own .provxml? If I try to name it not in standard way like my_own_settings.provxml, is that ok?
Nullstring said:
@hilaireg
thank you for that wonderful information! After fixing these xmls in VS IDE, they finally worked.. I just removed these comments and extra blank lines and put all these reg entries in one node <characteristic type="Registry"> they all seems to work now.
1 last question. in my OperatorPkg folder, I have 10 .provxml files and they were named mxiupdate_oemoperators_###.provxml + 1 mxiupdate_OEMVERSION_###.provxml
is it ok to just add my own .provxml? If I try to name it not in standard way like my_own_settings.provxml, is that ok?
Click to expand...
Click to collapse
You should be able to add your .provxml to those that appear, observe the file naming convention however. Some .provxml only run when the device goes through a full reinitialization (first-time run), others run whenever the device is reset/soft initialized.
REF: http://msdn.microsoft.com/en-us/library/bb737493.aspx
Lastly, I usually create my "operator" package which contains all of the .provxml I need.
Cheers,
Provxml sequence: 1.) mxipcold*, 2.) mxip_* 3.) mxipupdate
Basically a copy of what I just wrote to the OSB thread, however technically it belongs better here:
You know that there are not many methods to debug this early phase of boot when the provxml execute, so I supplied a dedicated trace at the end of each provxml:
Code:
<!-- trace execution begin
*** change the [B][COLOR=Red]<filename>[/COLOR][/B].traced below to the name of
*** the .provxml where you copy this at the end.
Purpose: Utilize the creation of a shortcut
to get a system timestamped artifact in the context
of the current provxml execution.
After Cold Boot (Hard Reset), you can sort the
directory \Windows\ProvXml\ by file date and
you have the sequence of .provxml execution listed.
-->
<characteristic type="FileOperation">
<characteristic type="%CE2%\ProvXmlTrace" translation="install">
<characteristic type="MakeDir" />
<characteristic type="[COLOR=Red][B]mxipupdate_windowslive_1[/B][/COLOR].traced" translation="install">
<characteristic type="Shortcut">
<parm name="Source" value="%CE2%\solitare.exe" translation="install"/>
</characteristic>
</characteristic>
</characteristic>
</characteristic>
<!-- end of trace activity -->
Result was that from all executed provxml (their names were timestamped traced in the \windows\ProvXmlTrace directory) the sequence is this:
all mxipcold* in the relative sequence of their packages.sof
mxip_* others (also mxip_cold_* which is something that the HtcInit may care about later) in the relative sequence of their packages.sof
all mxipupdate* in the relative sequence of their packages.sof
Mind that the name of the package in the name of the provxml file is the reason to pick it like above, not the directory it is stored in! So no matter where you store the *.provxml in your kitchen path, it is only the name and the highest priority match it has for execution above.
I noticed this because I had a file "mxipcold_smartfon_TB.provxml" put last in the sequence row of my packages (some Z_OEM_my settings), also had the *.DSM set correctly and likewise the packages.sof definition. However there was also a file "mxipcold_smartfon_1.provxml" which was part of the \SYS\CommonNonEA package and this was further up the list in packages.sof. Still it was not at the top of the list, where only other mxip_* and mxipupdate packages were located. So for sure it is that first come all mxipcold*, then all mxip_* and finally all mxipupdate packages. It is also sure that mxip*<packagename>*.provxml will be executed at highest place in priority no matter by which <guid>.dsm in the packages.sof it has been elevated there.
You must note that HTC (others maybe as well) have an additional method to initialize the device. You may find a driver "htcinit.dll" in the OEM drivers section which will then call a "HtcColdBoot.exe". This may have additional capabilities and put the mxip*.provxml in possibly another sequence.
Since this is part of the OEM and the native Windows mobile has their own coldboot treatment (via coldinit.exe) their worksplit and alignment requires dedicated attention if you want to keep the OEM part.
Above findings come from the pure Windows Mobile treatment (i.e. without htcinit.dll driver).
You can trace sequence with above listed method in your own environment.

[DEV][TOOL][PROJECT] Android APK Translation [CMD + GUI]

Android APK Translation - CMD Line Tool
CMD Line - The Idea
Files involved: "strings.xml", "arrays.xml", "plurals.xml"
translated files:
strings.xml - http://pastebin.com/embed_iframe.php?i=5u40nHZP
arrays.xml - http://pastebin.com/embed_iframe.php?i=93v9vZUk
plurals.xml - http://pastebin.com/embed_iframe.php?i=GwBuFdmW
original files:
strings.xml - http://pastebin.com/embed_iframe.php?i=r2W4yYvh
arrays.xml - http://pastebin.com/embed_iframe.php?i=Lfff9Pur
plurals.xml - http://pastebin.com/embed_iframe.php?i=eSe8yf4S
1) Get translated files from a translator.
2) Sort & delete tags/nodes with duplicate attributes from the translated files.
3) Get original files from the ROM.
4) Sort & delete tags/nodes with duplicate attributes from the original files.
5) Merge translated files with original files
(Optional) Discard all XML tags/nodes with attributes that doesn't exist in the original XML
Suggested Tool Syntax
Code:
apktrans [OPTS] --i rom/strings.xml --t translated/strings.xml --o merged/strings.xml
OPTS:
-s - sort xml nodes
-d - delete duplicate xml nodes
-m - discard xml nodes not present in the source xml
Notes
The node is considered a duplicate if there is another node with the same attributes, no matter how many children it have inside of it.
The node with more children overwrites the node with less.
Needed Tool Features
sort xml tags by attribute name
delete duplicate xml tags by attribute name
preserve node properties - ability to work on any kind of tags (string & arrays - children) - see example
should work with UTF-8
Android APK Translation - GUI Tool
GUI - The Idea
Original idea and source code: APK Translation Wizard
For the purpose of explanation, its assumed we want to translate from English source files to Vietnamese without a region code
File Structure
Code:
/
/apks-compiled - holds the apk files after encoding
/apks-frameworks - holds the framework files
/apks-source - holds the apk files for decoding/translation
/apks-translation - holds the apk files after encoding (with the translated files)
/core - holds the application files (binaries, scripts, etc...)
/i18n-crowdin - holds the translation files from the [URL="http://crowdin.net/project/miui-rom-translation"]MIUI translation project[/URL]
/i18n-other - holds the other translation files (drawable, raw, xml, etc...)
Decode Window - APK Decoding
Selectbox: Select which APK files you want to decode - apk files should be present inside the "/apks-source" directory
Selectbox: Select which framework file to use for APK decoding - framework file should be present inside "/apks-frameworks" directory
Button: Decode APK files - using APKTool​
Config Window - Tool Configuration
Button: Load original files - /res/values/strings.xml, /res/values/arrays.xml, /res/values/plurals.xml
Seletbox: Select destination locale - required - vi
Selectbox: Select destination region - optional - rVI
Button: Start Translation Process - set up /res/values-vi (and /res/values-vi-rVI if selected)​
Translation - strings.xml
View: APK_NAME | ATTRIBUTE_NAME | ORIGINAL STRING | TRANSLATED STRING
APK_NAME - name of the decoded apk
ATTRIBUTE_NAME - name of the tag's attribute we are translating
ORIGINAL STRING - the original string for translation
TRANSLATED STRING - the translated string*
*as appears in the /res/values-vi/strings.xml file OR /res/values-vi-rVI/strings.xml file OR empty if none
Button: Sort all tags - sorts all tags by attribute name
Button: Delete duplicate tags - delete tags with duplicate attribute name
Button: Import an XML patch - imports an XML file and merges the tags that have the same attributes
Button: Commit Translation - writes the translated xml file - /res/values-vi(-rVI)/strings.xml
Description
The user will be able to edit the TRANSLATED STRING column only.
The use will be able to edit tags which present only inside the source xml file (the decoded file) so to avoid adding tags which doesn't exist in the application we are translating.
If a tag is present in the XML patch but is missing in the source file; it will be discarded.
Translation - arrays.xml
View: APK_NAME | ATTRIBUTE_NODE_NAME | ORIGINAL STRINGS LIST | TRANSLATED STRINGS LIST
APK_NAME - name of the decoded apk
ATTRIBUTE_NODE_NAME - name of the tag/node's attribute we are translating
ORIGINAL STRINGS LIST - a list of the node's children which includes the original strings for translation
TRANSLATED STRINGS LIST - a list of the node's children which includes the translated strings*
*as appears in the /res/values-vi/arrays.xml file OR /res/values-vi-rVI/arrays.xml file OR empty if none
Button: Sort all nodes - sorts all nodes by attribute name - should NOT sort the children b/c their order is important!
Button: Delete duplicate nodes - delete nodes with duplicate attribute names
Button: Import an XML patch - imports an XML file and merges the nodes that have the same attributes
Button: Commit Translation - writes the translated xml file - /res/values-vi(-rVI)/arrays.xml
Description
ORIGINAL STRINGS LIST & TRANSLATED STRINGS LIST column will have a list of all properties (children) which belong to a specific ATTRIBUTE_NODE_NAME.
The user will be able to edit the TRANSLATED STRINGS LIST column only.
The user will be able to edit nodes which present only inside the source xml file (the decoded file) so to avoid adding nodes which doesn't exist in the application we are translating.
If a node is present in the XML patch but is missing in the source file; it will be discarded.
If a node in the XML patch includes more children then a node in the source file; All additional children will be discarded.
Translation - plurals.xml
View: APK_NAME | PLURAL_ATTRIBUTE_NODE_NAME | ATTRIBUTE_NAME | ORIGINAL STRING | TRANSLATED STRING
APK_NAME - name of the decoded apk
PLURAL_ATTRIBUTE_NODE_NAME - name of the plural's node attribute we are translating
ATTRIBUTE_NAME - name of the plural's node tag attribute we are translating
ORIGINAL STRING - original string for translation
TRANSLATED STRING - translated string*
*as appears in the /res/values-vi/plurals.xml file OR /res/values-vi-rVI/plurals.xml file OR empty if none
Button: Sort all plural nodes - sorts all nodes by attribute name - should NOT sort the children b/c their order is important!
Button: Delete duplicate plural nodes - delete nodes with duplicate attribute names
Button: Import an XML patch - imports an XML file and merges the nodes that have the same attributes
Button: Commit Translation - writes the translated xml file - /res/values-vi(-rVI)/plurals.xml
Description
The user will be able to edit the TRANSLATED STRING column only.
The user will be able to edit nodes which present only inside the source xml file (the decoded file) so to avoid adding nodes which doesn't exist in the application we are translating.
If a node is present in the XML patch but is missing in the source file; it will be discarded.
If a node in the XML patch includes more children then a node in the source file; All additional children will be discarded.
Encode Window - APK Encoding
Selectbox: Select which APK files you want to encode - will be taken from the "/projects" directory
Selectbox: Select which framework file to use for APK encoding - framework file should be present inside "/apks-frameworks" directory
Checkbox: Replace "Resources.arsc" - after compilation, the compiled APK will be unzipped, the Resources.arsc file will be taken out and put inside the original APK*.
Button: Encode APK files - using APKTool
*this is to avoid signature issues within the APK files.​
Android Localization - Useful Resources
Android SDK Guide on Localization
http://developer.android.com/guide/topics/resources/localization.html
http://developer.android.com/guide/topics/resources/providing-resources.html#BestMatch
http://developer.android.com/guide/topics/resources/providing-resources.html#table2
Mobile Country Codes (MMC)
http://en.wikipedia.org/wiki/List_of_mobile_country_codes
List of ISO-639-1 Codes (Country Codes)
http://en.wikipedia.org/wiki/List_of_ISO_639-1_codes
List of ISO-3166-1-alpha-2 Codes (Region Codes)
http://en.wikipedia.org/wiki/ISO_3166-1_alpha-2​
Examples of Usage
Note: trimmed due to forum length limits, notice that the xml tags are not sorted.
translated strings.xml:
Code:
<?xml version="1.0" encoding="UTF-8"?>
<resources>
<string name="common_minutes_ago">%s minutter siden</string>
<string name="common_hours_ago">%s timer siden</string>
<string name="common_days_ago">%s dage siden</string>
<string name="app_name">Browser</string>
</resources>
original strings.xml:
Code:
<?xml version="1.0" encoding="UTF-8"?>
<resources>
<string name="common_minutes_ago">%s minutes ago</string>
<string name="common_hours_ago">%s hours ago</string>
<string name="common_days_ago">%s days ago</string>
<string name="app_name">Browser</string>
<string name="app_settings">Settings</string>
<string name="urltitlebar_gotourl">GO</string>
<string name="urltitlebar_hint">Search or type in a URL</string>
<string name="search_description">Bookmarks, History, Google suggestions</string>
</resources>
final strings.xml:
Code:
<?xml version="1.0" encoding="UTF-8"?>
<resources>
<string name="common_minutes_ago">%s minutter siden</string>
<string name="common_hours_ago">%s timer siden</string>
<string name="common_days_ago">%s dage siden</string>
<string name="app_name">Browser</string>
<string name="app_settings">Settings</string>
<string name="urltitlebar_gotourl">GO</string>
<string name="urltitlebar_hint">Search or type in a URL</string>
<string name="search_description">Bookmarks, History, Google suggestions</string>
</resources>
Duplicate lines are always right after each other, right? I could throw together a script to delete the second line I think. I don't have time right now, but if no one has posted anything by this afternoon, I'll give it a shot for you.
SifJar said:
Duplicate lines are always right after each other, right? I could throw together a script to delete the second line I think. I don't have time right now, but if no one has posted anything by this afternoon, I'll give it a shot for you.
Click to expand...
Click to collapse
there is no need to create a script.
There are many text editors that can do that.
e.g. Notepad++
line 64-65
Code:
<string name="car_mode_disable_notification_message">برای خروج از حالت خودرو انتخاب کنید.</string>
<string name="car_mode_disable_notification_message">برای خروج از حالت خودرو انتخاب کنید</string>
in the above example there is a dot (.) more in 1st line, and for that reason a program will not recognise it as duplicate.
In notepad++ you can check for specific content, mark the duplicated and then delete the marked lines.
We need to delete a duplicate line of "<string name="car_mode_disable_notification_message">" so we make it in notepad++ to search for duplicates that have this pattern
Code:
<string name=" ">
and delete duplicate lines.
I am sure that this can be done because i have used it in the past (long ago).
I'll search some more to remember and post the way to do it.
Merged with Post#1
Merged with Post#1
Useful Resources
Merged with Post#1
Well, I decided to go ahead and throw together this:
deldupe.exe
Basically, pass the XML to deldupe.exe (drag the XML and drop it on EXE, or run it from command line like this: "deldupe.exe example.xml"). It'll delete all the lines with the same "name" attribute. It'll leave the first one. I tested it on the example XML you posted in your first post, got this as a result:
test.xml
Seems about right I think.
Dunno if you actually need this or not anymore, but it only took a few minutes to make, so I figured I may as well.
EDIT: It's also probably easier than messing with a text editor's settings. Just drag and drop, job done.
Merged with Post#1
I have to be honest, I'm not really sure what you mean. In the first file you linked, in reference to XML nodes, I can't see any duplication...
And the second part, I'm not really sure what you want. I understand you want to delete the duplicate lines from each version of each file. But I don't get the bit about merging. What is the final result you want to achieve?
I'm probably just being stupid here, but I can't really work out what it is you want the tool to do. If you could try and explain it in another way or something, I might be able to help.
EDIT: With the nodes stuff: Do you mean deleting a whole array when it is duplicated? If so, I think that could be trickier, but I could try it. I won't until I get confirmation though, don't want to waste time on something that isn't right
Also, seeing as they couldn't be sorted, it would probably be a longer process.
Merged with Post#1
Ah I think I got you now. This seems a LOT more complicated than what the app I posted already does. I might be able to do this, but I most likely won't I'm afraid. I will see what I can do though.
I have some ideas of stuff that might work. I'll start working on a few of them now.
EDIT: I have modified my previous script to now delete elements with duplicate "name" attributes, regardless of position in file. i.e. if an element with attribute is found a second time, it will be ignored. The next step is to modify the app to do this for two files, and then attempt to make it merge the results. I will look into nodes following that. I have made more progress than I had expected to be able to, I am now more hopeful about the chances of being successful.
OK, here is a new, updated EXE. This one takes two inputs, an original XML and a translated XML. It deletes duplicates from both (from anywhere, don't have to be line after each other), then merges all translated strings into the original XML, and saves it. You need to run it from the command line, something like this:
Code:
apk-trans.exe trans.xml orig.xml dest.xml
Gives this output with the two shortened XML fragments you posted: dest.xml (even with me manually duplicating some lines, in random places)
Here's the EXE: apk-trans.exe
I'll work on removing duplicate nodes next, then make it a little more user friendly (e.g. usage instructions built it, some sort of sign it is doing something, maybe an optional GUI [it would appear if app was run with no parameters, so command line usage would still work]).
I reckon removing duplicate nodes could be the hardest part. I may now stop working on this for today and resume tomorrow.
EDIT: At this point, this should work for files like strings.xml. plurals.xml and arrays.xml will both not work. Not actually sure how it would handle files like that. The duplicate deletion stuff shouldn't change them at all. Not sure what the merging will do. Probably also nothing. I'll test now though. EDIT: I tested, spits out the original (untranslated) XML, almost unchanged (spacing at start of line is slightly different, but that shouldn't matter at all)
EDIT: Updated the EXE, noticed it output XMLs with the wrong encoding, fixed that.
EDIT: Saw updated first post - this EXE does pretty much what the command line tool described at the start describes, for strings.xml. It doesn't sort, but it automatically deletes duplicates and those not not present in the original XML.
I've updated the first post with the most recent info and examples so that newcomers can easily get all the info they need.
Hopefully we can turn this into a serious project, next thing I'm going to create a couple of GUI images to better portray how and what the application should do.
@SifJar
Thanks a lot for your help so far my dear friend. I'm hopeful that we can achieve all the required features and make Android translation process an easier experience No doubt that it will catch a lot of attention as soon as its done!
EDIT:
I've tried the tool with the following files and I think I found a bug, the tool hangs...
Please see attached file.
First post have been updated again to better fit the new section
Thanks to the mods for moving it!
Huh. Dunno why it doesn't work with those files. I will look into it more a bit later on.
EDIT: It does work. It just takes a while and there is no visible sign the program is running. That is one of the things I mentioned above as needing to work on. I was focusing more on the functionality for the time being.
SifJar said:
Huh. Dunno why it doesn't work with those files. I will look into it more a bit later on.
EDIT: It does work. It just takes a while and there is no visible sign the program is running. That is one of the things I mentioned above as needing to work on. I was focusing more on the functionality for the time being.
Click to expand...
Click to collapse
Hmm weird, I'm on a Quad-Core Q6600 and I let it run for 10min but it didn't finish yet How much time did it take on your machine?
Thanks!
I didn't time it, but it took a while. I added some command line output to reassure that it is doing something, here's an updated binary:
{see below}
Usage is as before, only now you must add |more to the end of the command, or you won't get any command line output. (Limitation of the scripting language I use seemingly).
EDIT: Seems to take less than 10 mins on my computer, which is lower spec than yours. I'll add a GUI with a progress bar now to show proper progress.
EDIT: OK, here's a new .exe (again). This time, if you add a fourth parameter (can be anything, but I use "gui"), a progress bar will be shown, to show how the tool is progressing. Seems to work nicely for me. Usage is something like this:
Code:
apk-trans.exe t_strings.xml s_strings.xml dest.xml gui |more
The |more gives command line output, the "gui" parameter gives progress bar. You can have both. |more is not necessary if you just want the progress bar (has info on what is currently being done under progress bar on window, same info as is output to cmd line).
Here's the EXE: http://d.pr/f/VmwC
Obviously I will improve the GUI in future, this is just a quick thing thrown together in a few minutes.
Can you please make it so it will generate a proper exit code (0) and get rid of the pop-up if not in GUI mode?
Since it will be used mainly in bash a graphical GUI will be rarely used...
Btw, which language are you using?
EDIT:
Perhaps you could create a GIT for it on Github or similar so others can share their input...
Aternus said:
Can you please make it so it will generate a proper exit code (0) and get rid of the pop-up if not in GUI mode?
Since it will be used mainly in bash a graphical GUI will be rarely used...
Btw, which language are you using?
EDIT:
Perhaps you could create a GIT for it on Github or similar so others can share their input...
Click to expand...
Click to collapse
There should be no pop up if not in GUI mode. And no, I can't change the way it exits, sorry.
I am using AutoHotKey (AHK). Maybe I'll stick up the source somewhere. Give me a minute.
https://github.com/SifJar/apk-trans

Categories

Resources