JS TileMap iOS 8 and swift, incomprehensible archive? - objective-c

I've bridged JS TileMap for my spritekit game. I've put a tmx file in my project and I'm trying to init a JSTileMap object
let map = JSTileMap(fileNamed: "level 1-1.tmx")
i get this error
2014-11-15 17:43:03.428 MyGame[5726:1901295] * Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '* -[NSKeyedUnarchiver initForReadingWithData:]: incomprehensible archive (0x3c, 0x3f, 0x78, 0x6d, 0x6c, 0x20, 0x76, 0x65)'
*** First throw call stack:
(
Could it be that it's not finding the file? I noticed if i change the filename to something nonexistent i get the same error..
Here is the contents of my tmx file
<?xml version="1.0" encoding="UTF-8"?>
<map version="1.0" orientation="orthogonal" width="1000" height="800" tilewidth="1" tileheight="1">
<tileset firstgid="1" name="enemies" tilewidth="80" tileheight="75">
<tile id="0">
<properties>
<property name="name" value="EnemyA"/>
</properties>
<image width="66" height="75" source="../Atlases/iPhone/enemyA.atlas/enemy#2x.png"/>
</tile>
<tile id="1">
<image width="65" height="67" source="../Atlases/iPhone/enemyB.atlas/enemy#2x.png"/>
</tile>
<tile id="2">
<properties>
<property name="name" value="EnemyC"/>
</properties>
<image width="60" height="60" source="../Atlases/iPhone/enemyC.atlas/enemy#2x.png"/>
</tile>
<tile id="3">
<image width="61" height="65" source="../Atlases/iPhone/enemyD.atlas/enemy#2x.png"/>
</tile>
<tile id="4">
<image width="74" height="58" source="../Atlases/iPhone/enemyE.atlas/enemy#2x.png"/>
</tile>
<tile id="5">
<properties>
<property name="name" value="EnemyF"/>
</properties>
<image width="80" height="73" source="../Atlases/iPhone/enemyF.atlas/enemy#2x.png"/>
</tile>
</tileset>
<objectgroup color="#000000" name="Object Layer 1">
<object name="EnemyA" type="enemy" gid="1" x="137" y="489"/>
<object name="EnemyC" type="enemy" gid="6" x="468" y="454"/>
<object name="EnemyB" type="enemy" gid="3" x="310" y="321"/>
</objectgroup>
</map>
i've tried editing it down to just and it still throws that error. I'm making sure to include libz.dylib
what am i doing wrong?

I was using the wrong init method
it should be
let map = JSTileMap(named: "level 1-1.tmx")

Try to remove #2 from your image files source.. Then run it again. I think you cannot use #2 in tiled. Also remove spaces from you tmx name.

Related

MultiApp Kiosk Mode - Installation of Provisioning Package Failed

I am getting an error when I attempt to apply a provisioning package which I have created using Windows Configuration Designer. The PPKG is meant to lockdown a specific local user account to only be able to use 3 apps; Google Chrome, PrintStation and BarTender Designer. I have specified in the code the exact path for each app as well as copy/pasting their shortcuts into the Start Menu. I have checked through the code numerous times and can't seem to resolve this issue. I have included the XML code for your reference below, many thanks in advance, I hope we can get this resolved!
<?xml version="1.0" encoding="utf-8" ?>
<AssignedAccessConfiguration
xmlns="http://schemas.microsoft.com/AssignedAccess/2017/config"
xmlns:rs5="http://schemas.microsoft.com/AssignedAccess/201810/config"
>
<Profiles>
<Profile Id="{A039AA28-6A43-4C89-A561-2BCD06282535}">
<AllAppsList>
<AllowedApps>
<App DesktopAppPath="C:\Program Files\Google\Chrome\Application\chrome.exe" />
<App DesktopAppPath="C:\WINDOWS\system32\shutdown.exe" />
<App DesktopAppPath="C:\Windows\SysWOW64\shutdown.exe" />
<App DesktopAppPath="C:\Windows\explorer.exe" />
<App DesktopAppPath="C:\Windows\SysWOW64\explorer.exe" />
<App DesktopAppPath="C:\Program Files\Seagull\Bartender Suite\PrintStation.exe" />
<App DesktopAppPath="C:\Program Files\Seagull\Bartender Suite\bartend.exe" />
</AllowedApps>
</AllAppsList>
<StartLayout>
<![CDATA[<LayoutModificationTemplate xmlns:defaultlayout="http://schemas.microsoft.com/Start/2014/FullDefaultLayout" xmlns:start="http://schemas.microsoft.com/Start/2014/StartLayout" Version="1" xmlns="http://schemas.microsoft.com/Start/2014/LayoutModification">
<LayoutOptions StartTileGroupCellWidth="6" />
<DefaultLayoutOverride>
<StartLayoutCollection>
<defaultlayout:StartLayout GroupCellWidth="6">
<start:Group Name="Fairview Health Kiosk">
<start:DesktopApplicationTile Size="2x2" Column="0" Row="0" DesktopApplicationLinkPath="%AppData%\Microsoft\Windows\Start Menu\Programs\Google Chrome.lnk" />
<start:DesktopApplicationTile Size="2x2" Column="2" Row="0" DesktopApplicationLinkPath="%AppData%\Microsoft\Windows\Start Menu\Programs\PrintStation.lnk" />
<start:DesktopApplicationTile Size="2x2" Column="4" Row="0" DesktopApplicationLinkPath="%AppData%\Microsoft\Windows\Start Menu\Programs\BarTender Designer.lnk" />
</defaultlayout:StartLayout>
</StartLayoutCollection>
</DefaultLayoutOverride>
</LayoutModificationTemplate>
]]>
</StartLayout>
<Taskbar ShowTaskbar="false"/>
</Profile>
</Profiles>
<Configs>
<Config>
<Account>Test</Account>
<DefaultProfile Id="{A039AA28-6A43-4C89-A561-2BCD06282535}"/>
</Config>
</Configs>
</AssignedAccessConfiguration>

Oracle - How to Capture a value Under an XML TAG

Need Help with the below.
If i wanted to capture a value for a particular tag , how do i approach the same ?. for example
I wanted to capture the value(800.422.2762 (U.S. and Canada)) from the highlighted tag .
<text top="89" left="611" width="177" height="11" font="1">800.422.2762 (U.S. and Canada)</text>
in short , I wanted to hardcode this tag to capture the underlying value every time my program runs .
Sample XML:
<?xml version="1.0" encoding="UTF-8"?>
<pdf2xml producer="popple`enter code here`r" version="0.51.0">
<page number="1" position="absolute" top="0" left="0" height="1188" width="918">
<fontspec id="0" size="27" family="Helvetica" color="#000000"/>
<fontspec id="1" size="9" family="Helvetica" color="#000000"/>
<fontspec id="2" size="9" family="Helvetica" color="#000000"/>
<fontspec id="3" size="9" family="Times" color="#000000"/>
<fontspec id="4" size="12" family="Helvetica" color="#000000"/>
<fontspec id="5" size="12" family="Helvetica" color="#000000"/>
<fontspec id="6" size="9" family="Helvetica" color="#000000"/>
<image top="27" left="54" width="203" height="108" src="ext-resources\bin\asdf-1_1.jpg"/>
<text top="103" left="346" width="123" height="28" font="0"><b>INVOICE</b></text>
<text top="75" left="611" width="211" height="11" font="1">+1 913.217.6000, Fax +1 913.341.3742</text>
<text top="89" left="611" width="177" height="11" font="1">800.422.2762 (U.S. and Canada)</text>
<text top="102" left="611" width="230" height="11" font="1">headquarters#armaintl.org, www.arma.org</text>
<text top="32" left="611" width="104" height="11" font="1">ARMA International</text>
</page>
</pdf2xml>
So far, i have tried the below approach.
I am succeeded in extracting the data but i wanted to extract a particular value based on the hard coded tag. Kindly Help with the approach.
WITH data
AS (SELECT xmltype (
'<?xml version="1.0" encoding="UTF-8"?>
<pdf2xml producer="popple`enter code here`r" version="0.51.0">
<page number="1" position="absolute" top="0" left="0" height="1188" width="918">
<fontspec id="0" size="27" family="Helvetica" color="#000000"/>
<fontspec id="1" size="9" family="Helvetica" color="#000000"/>
<fontspec id="2" size="9" family="Helvetica" color="#000000"/>
<fontspec id="3" size="9" family="Times" color="#000000"/>
<fontspec id="4" size="12" family="Helvetica" color="#000000"/>
<fontspec id="5" size="12" family="Helvetica" color="#000000"/>
<fontspec id="6" size="9" family="Helvetica" color="#000000"/>
<image top="27" left="54" width="203" height="108" src="ext-resources\bin\asdf-1_1.jpg"/>
<text top="103" left="346" width="123" height="28" font="0"><b>INVOICE</b></text>
<text top="75" left="611" width="211" height="11" font="1">+1 913.217.6000, Fax +1 913.341.3742</text>
<text top="89" left="611" width="177" height="11" font="1">800.422.2762 (U.S. and Canada)</text>
<text top="102" left="611" width="230" height="11" font="1">headquarters#armaintl.org, www.arma.org</text>
<text top="32" left="611" width="104" height="11" font="1">ARMA International</text>
</page>
</pdf2xml>')
xmldoc
FROM DUAL)
SELECT x.*
FROM data,
XMLTABLE ('/pdf2xml/page/text'
PASSING xmldoc
COLUMNS text VARCHAR2 (50) PATH '/text') x
/
Output:
TEXT
--------------------------------------------------
INVOICE
+1 913.217.6000, Fax +1 913.341.3742
800.422.2762 (U.S. and Canada)
headquarters#armaintl.org, www.arma.org
ARMA International
Just change the XQuery from
'/pdf2xml/page/text'
to
'/pdf2xml/page/text[#top=89]'
and the result will be
800.422.2762 (U.S. and Canada)
If you only have one source document and only want one node value, you could use XMLQuery instead of XMLTable, with a slightly variation on #wolφi's XPath:
select XMLQuery('/pdf2xml/page/text[#top=89]/text()'
passing xmldoc
returning content) as text
from data;
which gives you an XML fragment, or
select XMLQuery('/pdf2xml/page/text[#top=89]/text()'
passing xmldoc
returning content).getStringVal() as text
from data;
which gives you a string:
TEXT
------------------------------
800.422.2762 (U.S. and Canada)
XMLTable is the way to go if you really have multiple documents or nodes though, of course.
Or change the query into:
SELECT x.*
FROM data,
XMLTABLE ('/pdf2xml/page/text'
PASSING xmldoc
COLUMNS
text VARCHAR2 (50) PATH '/text',
top number PATH '#top',
left number PATH '#left',
width number PATH '#width',
height number PATH '#height',
font number PATH '#font'
) x
where x.top = 89
and x.left = 611
and x.width = 177
and x.height = 11
and x.font = 1;

How to do form block letter printing?

I want to print in block letters in a jasper print. E.g. I have a Bank Format and I want the name to come in the boxes. How does one do that?
Name: [F][I][R][S][T][ ][N][A][M][E]
Option1 - Print cell by cell with a ${FIRST_NAME}.charAt(x) - which is unsustainable
Option2 - Add spaces between characters but this changes based on font size
Option3 - Add padding spaces to the end of the text. Stretch the text to the full width available and characters get distributed equally - how does one do this?
This is normal achieved using a monospaced font.
If you like to achieve it with other fonts or the spacing is very large you can use a subreport (that is called every time you need the fixed space)
Example
Main report (I'm using parameter to test)
Call the subreport with a datasource that contains each letter, I'm using $P{testText}.split("") , since char[] is not allowed in the JRBeanArrayDataSource.
Note: split will give empty first String in java7 but not in java8
<?xml version="1.0" encoding="UTF-8"?>
<jasperReport xmlns="http://jasperreports.sourceforge.net/jasperreports" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://jasperreports.sourceforge.net/jasperreports http://jasperreports.sourceforge.net/xsd/jasperreport.xsd" name="MainFixedSpace" pageWidth="595" pageHeight="842" whenNoDataType="AllSectionsNoDetail" columnWidth="555" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20" uuid="d2bcb5ab-c751-4f39-8753-561b8a6ac629">
<parameter name="testText" class="java.lang.String">
<defaultValueExpression><![CDATA["Hello world"]]></defaultValueExpression>
</parameter>
<parameter name="SUBREPORT_DIR" class="java.lang.String" isForPrompting="false">
<defaultValueExpression><![CDATA["C:\\jdd\\projects\\StackTrace\\jasper\\"]]></defaultValueExpression>
</parameter>
<title>
<band height="25" splitType="Stretch">
<subreport>
<reportElement x="0" y="0" width="555" height="25" uuid="76f53ca9-da1f-46c8-bb3b-aca0dc43d2d3"/>
<dataSourceExpression><![CDATA[new net.sf.jasperreports.engine.data.JRBeanArrayDataSource($P{testText}.split(""))]]></dataSourceExpression>
<subreportExpression><![CDATA[$P{SUBREPORT_DIR} + "MainFixedSpace_subreport.jasper"]]></subreportExpression>
</subreport>
</band>
</title>
</jasperReport>
Subreport
Setup the the fixed space column count in my case 20 columns on each row (you need to adapted it to your case) and set printOrder="Horizontal" The _THIS field will let you access the letter.
<?xml version="1.0" encoding="UTF-8"?>
<jasperReport xmlns="http://jasperreports.sourceforge.net/jasperreports" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://jasperreports.sourceforge.net/jasperreports http://jasperreports.sourceforge.net/xsd/jasperreport.xsd" name="MainFixedSpace_subreport" columnCount="20" printOrder="Horizontal" pageWidth="555" pageHeight="802" columnWidth="27" leftMargin="0" rightMargin="0" topMargin="0" bottomMargin="0" uuid="77ba37de-32e1-4ec6-8496-58d716d0340d">
<field name="_THIS" class="java.lang.String"/>
<detail>
<band height="25" splitType="Stretch">
<textField>
<reportElement x="0" y="0" width="27" height="25" uuid="ffb27000-41ba-419f-8836-b24dbb0dbb25"/>
<textElement textAlignment="Center" verticalAlignment="Middle"/>
<textFieldExpression><![CDATA[$F{_THIS}]]></textFieldExpression>
</textField>
</band>
</detail>
</jasperReport>
Output

How to get the workflow authentication to work in Aviarc

We are trying to roll out authentication into my app and it’s not working for us.
We have set up the Current Authority and Current Authorizer and have even set the login query to be just select ‘a’ so we are guaranteed to get a result set.
We have copied the Login workflow to workflows/system directory.
It doesn’t look like it’s even trying to run the login query.
start.xml workflow:
<workflow>
<authenticate error-screen="login-error" dataset="login">
<show-screen name="login" />
</authenticate>
<call-workflow name="home"/>
</workflow>
login.xml screen:
<screen xmlns:action="urn:aviarc:widget:com.aviarc.toronto.widget.core.action:1"
xmlns:app="urn:aviarc:widget:application">
<group-box visible="y" left="10" right="4" top="10" bottom="4" class="blue">
<image height="80" width="245" left="10" top="5" class="mfcologo" />
<line height="5" left="0" right="0" top="120" class="myerblue" />
<text-static visible="y" left="74" top="151" width="80" height="20" text="User name:" />
<text-static visible="y" left="234" top="151" width="80" height="20" text="Password:" />
<text-edit name="username" left="74" top="182" width="100" height="20" field="login.user_name" />
<text-edit name="password" left="234" top="182" width="100" height="20" field="login.user_password" datatype="password" />
<button left="376" top="182" width="60" height="20" label="Login" action="Next"/>
</group-box>
</screen>
system/Login.xml workflow:
<workflow xmlns:au-security="urn:aviarc:xmlcommand:au.com.aviarc.xmlcommand.security">
<au-security:hash-text text="{$login.user_password}" result-field="login.hashed-password" />
<dataset name="cslogin" databroker="loginqry" query="get-all">
<param name="username" value="{$login.user_name}" />
<param name="password" value="{$login.hashed-password}" />
</dataset>
<if test="dataset-empty" value1="cslogin">
<then>
<set-field field="login.authenticated" value="n"/>
</then>
<else>
<set-field field="login.authenticated" value="y"/>
</else>
</if>
</workflow>
The Workflow authentication requires "username" field to be populated prior to entering it, otherwise the authentication would fail immediately and login error screen will be displayed.
In your example it is fairly easy to fix, changing the line in login.xml screen from:
<text-edit name="username" left="74" top="182" width="100" height="20" field="login.user_name" />
to be:
<text-edit name="username" left="74" top="182" width="100" height="20" field="login.username" />
and updating reference to it in the system/Login workflow.

How to embed and display an SVG image in iReport

I am using iReport 4.5.0, and want to embed an SVG image to generate a PDF.
When using iReport's preview option to run the report, the image won't get rendered to the PDF (i.e. there's an empty space where the image is supposed to be).
I do not see any exceptions in the logs during execution, what's going on?
Here's the image tag code snippet:
<?xml version="1.0" encoding="UTF-8"?>
<jasperReport xmlns="http://jasperreports.sourceforge.net/jasperreports"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://jasperreports.sourceforge.net/jasperreports http://jasperreports.sourceforge.net/xsd/jasperreport.xsd"
name="reportSVGTest" language="groovy" pageWidth="595"
pageHeight="842" columnWidth="555" leftMargin="20" rightMargin="20"
topMargin="20" bottomMargin="20">
<property name="ireport.zoom" value="1.0"/>
<property name="ireport.x" value="0"/>
<property name="ireport.y" value="0"/>
<background>
<band splitType="Stretch"/>
</background>
<title>
<band height="50">
<staticText>
<reportElement x="81" y="13" width="100" height="20"/>
<textElement/>
<text><![CDATA[Hello]]></text>
</staticText>
</band>
</title>
<detail>
<band height="443" splitType="Stretch">
<image hAlign="Center" vAlign="Middle" isUsingCache="true" isLazy="true">
<reportElement x="12" y="17" width="512" height="403"/>
<imageExpression class="net.sf.jasperreports.engine.JRRenderable">
<![CDATA[
net.sf.jasperreports.renderers.BatikRenderer.getInstance(
new java.io.File("C:\\Users\\akshayd\\Desktop\\polygons1.svg"))
]]>
</imageExpression>
</image>
</band>
</detail>
</jasperReport>
I wanted to embed a SVG text in my report, and this topic helped me succeed.
I am using Jaspersoft Studio with full support for JasperReports 5.5.0.
Here is how i did :
Create a image element
Choose Custom expression and let expression empty
Modify JRXML source: add a tag imageExpression in the tag image
<image>
<reportElement x="0" y="60" width="50" height="50" uuid="c0d0856e-0bb1-4634-b8b0- 6f7ace0e3ff3"/>
<imageExpression><![CDATA[net.sf.jasperreports.renderers.BatikRenderer.getInstanceFromText("<svg:svg xmlns:svg=\"http://www.w3.org/2000/svg\" xmlns=\"http://www.w3.org/2000/svg\" version=\"1.0\" width=\"88\" height=\"21\" id=\"svg\"><svg:g id=\"layer1\"><svg:path id=\"path1\" d=\"M 61.799149,2.0342178 L 67.119461,2.0342178 L 67.119461,19.213905 L 61.799149,19.213905 L 61.799149,2.0342178 z\" style=\"text-anchor:start;fill:#FF0000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;\" /></svg:g> </svg:svg>")]]></imageExpression>
</image>
So, i use the method getInstanceFromText of BatikRenderer.
Do not forget to protect double quotes in your SVG text.