Getting Syntax errors in PlantUML - plantuml

I have PlantUML code:
#startuml
hide methods
hide stereotypes
!define Table(name,desc) class name as "desc" << (T,#FFAAAA) >>
!define Enum(name,desc) class name as "desc" << (E,#FFFFAA) >>
!define primary_key(x) <b>x</b>
!define not_null(x) <u>x</u>
!define unique(x) <color:green>x</color>
Enum(menuitemtype,"Menu item types") {
category
text
sticker
user_action
}
Table(menuitem,"Menu item") {
primary_key(id) INTEGER
not_null(unique(name)) VARCHAR[32]
type INTEGER
anonymous BOOLEAN
parent INTEGER
type INTEGER
}
Table(chat,"Telegramm chats") {
primary_key(id) INTEGER
not_null(unique(chat_id)) INTEGER
is_group BOOLEAN
}
Table(requester,"Bot requester") {
primary_key(id) INTEGER
not_null(unique(tele_id)) INTEGER
is_boot BOOLEAN
user_name VARCHAR[32]
last_name VARCHAR[32]
first_name VARCHAR[32]
is_active BOOLEAN
last_access DATETIME
}
menuitem -- menuitemtype
menuitem "0..N" --> "1" menuitem
requester "1" --> "N" chat
#enduml
I take a code from here: https://gist.github.com/QuantumGhost/0955a45383a0b6c0bc24f9654b3cb561
When NetBeans' PlantUML plugin actually displays the structure:
The java tool /usr/share/plantuml/plantuml.jar installed on Ubuntu 16 with apt-get gives follow error:
$ cat SystemDB/schema.puml | plantuml -syntax -v
(0.000 - 119 Mo) 117 Mo - PlantUML Version 8024
(0.048 - 119 Mo) 115 Mo - GraphicsEnvironment.isHeadless() false
ERROR
5
Syntax Error?
and generates follow file
I see that stereotypes are convenience according to: http://plantuml.com/PlantUML_Language_Reference_Guide.pdf - chapter 1.21

On Ubuntu, apt-get installs a (sometimes very) old version of PlantUML, and that's why there are syntax errors.
You can see how to install it using a script, or follow that script to install it by hand. Once you install it that way, you can updated it by downloading the latest .jar file from PlantUML.com.

Related

Libreoffice .xls to .pdf conversion breaks single page content into multiple pages on Ubuntu 18.04

I am facing issue during conversion of .xls to .pdf through libreoffice command line mentioned below.
sudo /usr/bin/soffice --headless --nologo --nofirststartwizard --norestore --convert-to pdf:calc_pdf_Export --outdir '/home/user/Downloads/' '/home/user/Downloads/file.xlsx'
Its converted successfully, however it breaks .xls single content page into multiple pages in pdf. I want to convert xls single content page to pdf single page through page scaling. We can do that manually (can refer this https://stackoverflow.com/a/19947539 ) through Menu Formatting -> Page ->Sheet ->Scale Scaling mode. But I don't want user interference during conversion of Xls to Pdf!
I have gone through many Articles but not found the proper solution as I want it through command line. Is there any option in command line syntax to scale it on the fly?
We can achieve this through applying macros on that specific XLSX on run time and after than we can execute PDF conversion command. The steps I followed to implement this solution mentioned below.
Step 1 :- Store a macro on server.
in my case I have stored here (/opt/libreoffice/presets/basic/Standard/Module1.xba).
Content of Module1.xba is
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE script:module PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "module.dtd">
<!--
* This file is part of the LibreOffice project.
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*
* This file incorporates work covered by the following license notice:
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed
* with this work for additional information regarding copyright
* ownership. The ASF licenses this file to you under the Apache
* License, Version 2.0 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
-->
<script:module xmlns:script="http://openoffice.org/2000/script" script:name="Module1" script:language="StarBasic">REM ***** BASIC *****
Sub FitToPage
Dim document As Object, pageStyles As Object
document = ThisComponent
pageStyles = document.StyleFamilies.getByName("PageStyles")
For i = 0 To document.Sheets.Count - 1
Dim sheet As Object, style As Object
sheet = document.Sheets(i)
style = pageStyles.getByName(sheet.PageStyle)
style.ScaleToPagesX = 1
Next
On Error Resume Next
document.storeSelf(Array())
document.close(true)
End Sub
Sub Main
End Sub
</script:module>
Step 2:- Apply the above macro on xls file through below command.
$cmd = 'export HOME=/var/www && /opt/libreoffice/program/soffice --headless --nologo --nofirststartwizard --norestore /home/usr/demo.xls macro:///Standard.Module1.FitToPage';
Step 3 :- Generate Pdf after applying macro through command line.
$cmd = 'export HOME=/var/www && /opt/libreoffice/program/soffice --headless --nologo --nofirststartwizard --norestore --convert-to pdf:writer_web_pdf_Export --outdir /home/usr/ /home/usr/demo.xls';
Note :- The only catch in this implementation is that spreadsheets file should not be read only.
Adding on to #ABHI 's answer, the correct path of the user's default macro file is at
Linux:
~/.config/libreoffice/4/user/basic/Standard/Module1.xba
Windows:
%AppData%\LibreOffice\4\user\basic\Standard\Module1.xba

CakePHP Localization of static data

CakePHP Version: 3.6.6
I apologise in advance for such a long post but I believe this is all the information needed for someone to be able to help.
===========================================================================
SECTION 1
// WHAT I'D LIKE' TO ACHIEVE
Ultimately I'd like my application to automatically detect the language of the user and change the following accordingly:
Text.
Date format.
Number format.
Currency.
In an effort to realise this I started by simplifying it by not attempting to automatically detect the language of the user but manually changing the locale in config/app.php.
===========================================================================
SECTION 2
// THE INFORMATION I'VE REFERENCED
Internationalization & Localization - Here
I18N Shell - Here
===========================================================================
SECTION 3
// WHAT I HAVE BEFORE I START
config/app.php
'defaultLocale' => env('APP_DEFAULT_LOCALE', 'en_GB'),
config/bootstrap.php
ini_set('intl.default_locale', Configure::read('App.defaultLocale'));
// Welcome controller
?php
namespace App\Controller;
use App\Controller\AppController;
use Cake\Event\Event;
// For translation
use Cake\I18n\I18n;
use Cake\I18n\Time;
use Cake\I18n\Number;
class WelcomeController extends AppController
{
public function index()
{
// Get the default locale
$defaultLocale = I18n::getDefaultLocale();
echo $defaultLocale . '<br />';
// Date
$date = new Time('2017-12-05 23:00:00');
echo $date . '<br />';
// Number
echo Number::format(123.50) . '<br />';
// Currency
echo Number::currency(1250.00) . '<br /><br />';
}
}
// index.ctp
<?= __('Welcome') ?>
<br />
<?= __('What would you like to do today!') ?>
// This is what the browser displays
en_GB
05/12/2017, 23:00
123.5
£1,250.00
Welcome
What would you like to do today!
===========================================================================
SECTION 4
// WHAT I'VE DONE
1. Created a folder in src named Locale
2. Created a folder in Locale named de_DE
3. Navigated to the bin with the cli.
4. Typed cake i18n extract and clicked enter.
5. After clicking enter the following is displayed by the cli:
Current paths: None
What is the path you would like to extract?
[Q]uit [D]one
[C:xampp\htdocs\app_name\src] >
I then add the following after > and click enter
C:xampp\htdocs\app_name\src\Template\Welcome
6. After clicking enter the following is displayed by the cli:
Current paths: C:xampp\htdocs\app_name\src\Template\Welcome
What is the path you would like to extract?
[Q]uit [D]one
[D] >
7. I then click enter and the following is displayed by the cli:
Would you like to extract the messages from the CakePHP core? (y/n)
[n] >
8. I then click enter and the following is displayed by the cli:
What is the path you would like to output?
[Q]uit
[C:xampp\htdocs\app_name\src\Template\Welcome\Locale] >
I then add the following after > and click enter
C:xampp\htdocs\app_name\src\Locale
9. I then click enter and the following is displayed by the cli:
Would you like to merge all domain strings into the default.pot file? (y/n)
[n] >
10. I then click enter and the following is displayed by the cli:
Extracting...
Paths: C:xampp\htdocs\app_name\src\Template\Welcome
Output Directory: C:xampp\htdocs\app_name\src\Locale\
====================================================================> 100%
Done.
11. After this I have a default.pot file in the src/Locale folder. I copy and paste this file into the de_DE folder.
The contents of this folder are as below:
# LANGUAGE translation of CakePHP Application
# Copyright YEAR NAME <EMAIL#ADDRESS>
#
#, fuzzy
msgid ""
msgstr ""
"Project-Id-Version: PROJECT VERSION\n"
"POT-Creation-Date: 2018-09-05 09:20+0000\n"
"PO-Revision-Date: YYYY-mm-DD HH:MM+ZZZZ\n"
"Last-Translator: NAME <EMAIL#ADDRESS>\n"
"Language-Team: LANGUAGE <EMAIL#ADDRESS>\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=utf-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=INTEGER; plural=EXPRESSION;\n"
#: Template/Welcome/index.ctp:52
msgid "Welcome"
msgstr ""
#: Template/Welcome/index.ctp:58
msgid "What would you like to do today!"
msgstr ""
I then add the following into the 2 msgstr so they look like the below:
#: Template/Welcome/index.ctp:52
msgid "Welcome"
msgstr "abc"
#: Template/Welcome/index.ctp:58
msgid "What would you like to do today!"
msgstr "xyz"
I then change the default locale in config/app.php to:
'defaultLocale' => env('APP_DEFAULT_LOCALE', 'de_DE'),
I then refresh the browser and the below is displayed:
de_DE
05.12.15, 23:00
123,5
1.250,00 €
Welcome
What would you like to do today!
===========================================================================
SECTION 5
// RESULT
The locale, date, number and currency have changed but NOT the text. It still displays:
Welcome
What would you like to do today!
And I was expecting it to display:
abc
xyz
===========================================================================
SECTION 6
// WHAT I'VE TRIED TO FIX IT
I added the below to the middleware - Application.php:
// Add middleware and set the valid locales
$middlewareQueue->add(new LocaleSelectorMiddleware(['en_GB', 'de_DE']));
And this is what the browser displayed:
de_DE
05/12/2015, 23:00
123.5
£1,250.00
Welcome
What would you like to do today!
The locale is still de_DE but the date, number and currency have reverted back to English?
===========================================================================
SECTION 7
// SUMMARY
I'd really appreciate any help on this because it would be brilliant if I could get my application localized and have the functionality of allowing a user to use my application in their native language. I'm really restricting my market if I can't get this working.
If there's anything else that I haven't written but you need please don't hesitate to let me know.
Many thanks in advance for any help. Z.
===========================================================================
#ndm - Thanks for the response, learnt a lot already but still no cigar.
I downloaded Poedit and opened it. I then clicked on "Edit a translation" and opened default.pot file from the Locale folder.
Everything looks good and the below is displayed:
Welcome
What would you like to do today!
I then click on 'Create new translation' and select German from the dropdown, the window is divided into 2 halves:
On the left - Source text - English.
On the right - Translation - German.
I highlight 'Welcome' and select the German equivalent 'Willkommen' which is then populated in the right window. I do the same for 'What would you like to do today'.
At this point the right window is populated with the German equivalents so I go to Save as and save the file in my de_DE folder in the src/Locale folder.
My de_DE folder is now populated with 2 files as detailed below:
de.mo
de.po
I open the de.po file and the contents are detailed below:
# LANGUAGE translation of CakePHP Application
# Copyright YEAR NAME <EMAIL#ADDRESS>
#
msgid ""
msgstr ""
"Project-Id-Version: PROJECT VERSION\n"
"POT-Creation-Date: 2018-09-05 09:41+0000\n"
"PO-Revision-Date: 2018-09-05 14:26+0100\n"
"Language-Team: LANGUAGE <EMAIL#ADDRESS>\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
"X-Generator: Poedit 2.1.1\n"
"Last-Translator: \n"
"Language: de\n"
#: Template/Welcome/index.ctp:52
msgid "Welcome"
msgstr "Willkommen"
#: Template/Welcome/index.ctp:58
msgid "What would you like to do today!"
msgstr "Was würden Sie heute gerne machen!"
I then clear the cache (tmp/cache/persistent) and refresh the browser.
To confirm I have the below in config/app.php
'defaultLocale' => env('APP_DEFAULT_LOCALE', 'de_DE'),
And I have commented out the middleware reference.
Unfortunately the text has still not been translated?
It seemed like a relatively straight forward process so I'm surprised it hasn't worked. I'm hoping you can see something that I've done incorrectly in the process I've used as documented above.
Thanks again, Z.
// WHAT I'VE TRIED AS A FIX
1. I've tried changing the language definition in config/app.php from:
'defaultLocale' => env('APP_DEFAULT_LOCALE', 'de_DE'),
to
'defaultLocale' => env('APP_DEFAULT_LOCALE', 'de'),
then cleared the cache and refreshed but no luck.
2. I reversed the above then tried changing the language definition in the de.po file from:
"Language: de\n" to de_DE\n
then cleared the cache and refreshed but still no luck.
.pot files are templates (in PO format), you use them to create the final translation files in .po (plain) or .mo (binary) format from them (these are the files that CakePHP is looking for), or to update the latter with changed messages.
You can rename and edit the files manually, or use tools like Poedit that provide a GUI for the gettext tools which can help you with creating/updating .po/.mo files.
Whenever making changes to translation files, remember to clear the cache (tmp/cache/persistent) afterwards!
I know this is a bit late, but for anyone who stumbles across this tread.
Check the permissions of the src/Locale, src/Locale/de_DE and .po &.mo files.
I had a similar issue that the .po and .mo files I had generated were not readable by the web server user, and the translations of text failed silently, as appears to be the case in the OPs question.

Codename one - Android build error

I encounter an error when trying to send my app to the server for building (android). Netbeans outputs the following message (actual username removed):
Prompting for password
Building for username: <actualUsernameHere>
/home/user/NetBeansProjects/OPKP/build.xml:338: The attribute can't be empty
BUILD FAILED (total time: 6 seconds)
Build.xml (around line 338):
<target name="build-for-android-device" depends="clean,copy-android-override,copy-libs,jar,clean-override">
<codeNameOne
jarFile="${dist.jar}"
displayName="${codename1.displayName}"
packageName = "${codename1.packageName}"
mainClassName = "${codename1.mainName}"
version="${codename1.version}"
icon="${codename1.icon}"
vendor="${codename1.vendor}"
subtitle="${codename1.secondaryTitle}"
targetType="android"
keystoreAlias="${codename1.android.keystoreAlias}"
keystore="${codename1.android.keystore}"
certPassword="${codename1.android.keystorePassword}"
automated="${automated}"
/> //line 338
</target>
Also Codename One settings won't show up...
It stared when I received this error:
Cannot use a cn1lib with java version greater then the project java version
At the same time Netbeans had a problem with JavaFX. So I downloaded the latest jdk and add a hint in codename one: java.version -> 8. This fixed both issues, but now I can't build my app.
EDIT:
Codename_settings.properties file (some info are hidden, but are present in the file):
#
#Tue Jul 11 14:27:58 CEST 2017
codename1.ios.appid=
codename1.ios.release.provision=
codename1.arg.java.version=8
codename1.arg.rim.obfuscation=false
codename1.arg.ios.project_type=ios
foobarfoo=This is a description of what we are going to do
codename1.arg.ios.interface_orientation=UIInterfaceOrientationPortrait\:UIInterfaceOrientationPortraitUpsideDown\:UIInterfaceOrientationLandscapeLeft\:UIInterfaceOrientationLandscapeRight
codename1.displayName=
codename1.android.keystoreAlias=
codename1.ios.release.certificate=
codename1.arg.ios.background_modes=,bluetooth-central,bluetooth-peripheral
codename1.android.keystorePassword=<actualPassHidden>
codename1.ios.provision=
codename1.arg.ios.add_libs=;CoreBluetooth.framework
codename1.arg.ios.dsym=false
codename1.arg.android.release=true
roid.keystoreAlias=<actualAliasHidden>
codename1.arg.ios.statusbar_hidden=false
codename1.languageLevel=5
codename1.android.keystore=<actualPathHidden>
codename1.arg.ios.pods=,Cordova
codename1.vendor=CodenameOne
codename1.arg.win.ver=8
codename1.ios.certificatePassword=
codename1.ios.debug.certificatePassword=
codename1.mainName=Main
codename1.ios.release.certificatePassword=
codename1.arg.ios.prerendered_icon=false
codename1.ios.debug.certificate=
libVersion=169
codename1.arg.android.xpermissions=<uses-permission android\:name\="android.permission.BLUETOOTH"/><uses-permission android\:name\="android.permission.BLUETOOTH_ADMIN"/><uses-permission android\:name\="android.permission.ACCESS_COARSE_LOCATION"/>
codename1.arg.ios.application_exits=false
codename1.secondaryTitle=CodenameOne_Template
codename1.description=
codename1.ios.debug.provision=
codename1.arg.build.incSources=1
codename1.arg.j2me.nativeThemeConst=0
codename1.rim.certificatePassword=
codename1.version=2.0
codename1.ios.certificate=
codename1.icon=icon.png
codename1.rim.signtoolCsk=
codename1.arg.ios.plistInject=<key>NSBluetoothPeripheralUsageDescription</key><string>${foobarfoo}</string>
codename1.arg.android.debug=false
codename1.rim.signtoolDb=
codename1.arg.ios.includePush=false
codename1.arg.ios.testFlight=false
codename1.packageName=com.ijs.opkp
Does anyone know what can be the problem?
Looking thru the entries in the properties vs. the XML it seems the displayName property is blank. I didn't check everything but that seems to be an issue.

Vncsharpwpf error

I downloaded a code a link after i run it from VS2010 the error show up
Warning 3 The tag 'RemoteDesktopWpf' does not exist in XML namespace 'clr-namespace:VncSharpWpf;assembly=VncSharpWpf'. Line 44 Position 14. C:\VNCSHARPWPF\VncSharpWpf-0.0.2_2\VncSharpWpf_Example\MainWindow.xaml 44 14 VncSharpWpf_Example
Warning 2 Importing key file "VncSharpWpf.pfx" was canceled. VncSharpWpf
Warning 1 Cannot import the following key file: VncSharpWpf.pfx. The key file may be password protected. To correct this, try to import the certificate again or manually install the certificate to the Strong Name CSP with the following key container name: VS_KEY_1F91AEA45AB30623 VncSharpWpf
Delete VncSharpWpf.pfx from project VncSharpWpf, and you can build the project.

Extending AD Schema - Unable to update due to constraint

I'm adding some attributes from live to staging for testing purposes, I'm using ldifde:
D:\Shared>ldifde -i -v -f attr3.ldf -j .
Connecting to "myDomain.com"
Logging in as current user using SSPI
Importing directory from file "attr3.ldf"
Loading entries
1: CN=myAttribute,CN=Schema,CN=Configuration,DC=myDomain,DC=com
Entry modified successfully.
1 entry modified successfully.
The command has completed successfully
D:\Shared>
But when I try to update it using vbs, I got:
C:\Users\update.vbs(8, 1) Active Directory: The requested operation did not
satisfy one or more constraints associated with the class of the object.
Please notice that other attributes, the original ones, are able to be updated, this issue is only for the ones I'm importing.
So, I wonder if I'm missing some step like link or detach the new attribute after imported.
This is attr3.ldf
#attr3.ldf
#adding my new attribute
dn: CN=myAttribute,CN=Schema,CN=Configuration,DC=myDomain,DC=com
changetype: add
objectClass: top
objectClass: attributeSchema
cn: my-Attribute
distinguishedName: CN=my-Attribute,CN=Schema,CN=Configuration,DC=myDomain,DC=com
instanceType: 4
whenCreated: 20100401175340.0Z
whenChanged: 20100401175341.0Z
uSNCreated: 24154
attributeID: 2.16.840.1.113805.111
attributeSyntax: 2.5.5.12
isSingleValued: TRUE
rangeLower: 0
rangeUpper: 1
uSNChanged: 24163
showInAdvancedViewOnly: TRUE
adminDisplayName: my-Attribute
adminDescription: my-Attribute
oMSyntax: 64
searchFlags: 0
lDAPDisplayName: myAttribute
name: my-Attribute
schemaIDGUID:: tonVW6suWUu1Gev/D1pI9Q==
isMemberOfPartialAttributeSet: TRUE
objectCategory: CN=Attribute-Schema,CN=Schema,CN=Configuration,DC=myDomain,DC=com
#The following attributes were removed because I was getting:
#Add error on entry starting on line 1: Unwilling To Perform
#The server side error is: 0x20e7 The modification was not permitted for security
#reasons.
#The extended server error is:
#000020E7: SvcErr: DSID-03152D2C, problem 5003 (WILL_NOT_PERFORM), data 0
#objectGUID:: eTKYtnXbCE2fPMgc8UIe0w==
#attributeSecurityGUID:: VAGN5Pi80RGHAgDAT7lgUA==
And this is the vbs code,
'update.vbs
Set objUser = GetObject("LDAP://CN=John Lennon,CN=Users,DC=myDomain,DC=com")
objUser.myAttribute="someValue" 'Also tried with integers but not luck
objUser.SetInfo
Thanks,
m0dest0.
Thank you JPBlanc, you are right, I was missing to add the attr to the class and then refresh the schema,
Register the dll, regsvr32 schmmgmt.dll
Open Run and type mmc.exe
Add Active directory schema snap-in
Right click on the class, properties and hit the Add button and so on.
Finally, refresh the schema:
C:\Users>admod -sc refreshschema
AdMod V01.17.00cpp Joe Richards (joe#joeware.net) March 2011
Modifying ROOTDSE...
DN Count: 1
Using server: myServer.myDomain.com:389
Directory: Windows Server 2008 R2
Modifying specified objects...
DN: ROOTDSE...
The command completed successfully
Regards,
Adding an attribute to the Schema is not enought, you must also add the attribute to the user class (in the schma) if you want to use it in a user object. You must modify your LDIF file:
# Define your attribute
# Reload the schema
dn:
changetype: modify
add: schemaUpdateNow
schemaUpdateNow: 1
-
# modify user class
Have a look to your Schema using Microsoft MMC (registering schmmgmt.dll)
If you still have trouble, I can help again tomorow morning.

Resources