Retrieving NSString from parsed xml file - nsstring

I use nsxmlparser to parser data from server. I am trying to pass data to detail table view but I can't get the data into NSString.
This is my .xml
<?xml version="1.0" encoding="UTF-8"?>
< videos >
<Video id="1">
<name>Video 1</name>
<link>http://www.ebookfrenzy.com/ios_book/movie/movie.mov</link>
</Video>
<Video id="2">
<name>Video 2</name>
<link>http://www.ebookfrenzy.com/ios_book/movie/movie.mov</link>
</Video>
<Video id="3">
<name>Video 3</name>
<link>http://www.ebookfrenzy.com/ios_book/movie/movie.mov</link>
</Video>
<Video id="4">
<name>Video 4</name>
<link>http://www.ebookfrenzy.com/ios_book/movie/movie.mov</link>
</Video>
<Video id="5">
<name>Video 5</name>
<link>http://www.ebookfrenzy.com/ios_book/movie/movie.mov</link>
</Video>
<Video id="6">
<name>Video 6</name>
<link>http://www.ebookfrenzy.com/ios_book/movie/movie.mov</link>
</Video>
</videos >
Links are the same, nevermind those. Problem is I cant get this link entry into NSString. Here is how I try to do:
NSString *videoString = [[videos objectAtIndex:indexPath.row] objectForKey:#"link"];
NSURL *fileURL = [NSURL URLWithString:videoString];
mp = [[MPMoviePlayerController alloc] initWithContentURL:fileURL];
[mp.view setFrame:CGRectMake(0, 70, 320, 270)];
[self.view addSubview:mp.view];
mp.fullscreen = YES;
[mp play];
If I try to use element in UILabel, I am able to show it in the label.
UILabel *label;
label.text = [[videos objectAtIndex:indexPath.row] objectForKey:#"name"];
Yet, when I try to retrieve it as NSString, I am unsuccesfull.
How can I use element as NSString ? Thanx in advance..

Related

Task edit document preview component Alfresco

First question:
I want to implement a preview of the document in the form of the task-edit of the workflows... How can I do this? I try to adapt the document-details.xml and document-details.ftl to workflow-details.xml and workflow-details.ftl but not works. I tried to copy the components that have web-preview of the document-details files to workflow-details. Any hint to make this?
I have this in workflow-details.ftl:
<#include "include/alfresco-template.ftl" />
<#templateHeader>
<#script type="text/javascript" src="${url.context}/res/modules/documentlibrary/doclib-actions.js" group="document-details"/>
<#link rel="stylesheet" type="text/css" href="${url.context}/res/components/document-details/document-details-panel.css" group="document-details"/>
<#link rel="stylesheet" type="text/css" href="${url.context}/res/components/workflow/task-edit-header.css" group="workflow-details"/>
<#templateHtmlEditorAssets />
</#>
<#templateBody>
<#markup id="alf-hd">
<div id="alf-hd">
<#region scope="global" id="share-header" chromeless="true"/>
<#region id="title" scope="template"/>
<#if page.url.args.nodeRef??>
<#region id="path" scope="template"/>
</#if>
</div>
</#>
<#markup id="bd">
<div id="bd">
<div class="share-form">
<#region id="data-header" scope="page" />
<div class="yui-gc">
<div class="yui-u first">
<#if (config.scoped['WorkflowDetails']['workflow-details'].getChildValue('display-web-preview') == "true")>
<#region id="web-preview" scope="template"/>
</#if>
</div>
</div>
<#region id="data-form" scope="page" />
<#region id="data-actions" scope="page" />
</div>
</div>
</#>
</#>
<#templateFooter>
<#markup id="alf-ft">
<div id="alf-ft">
<#region id="footer" scope="global"/>
<#region id="data-loader" scope="page" />
</div>
</#>
</#>
In workflow-details.xml I add this component:
<component>
<region-id>web-preview</region-id>
<sub-components>
<sub-component id="default">
<evaluations>
<evaluation>
<evaluators>
<evaluator type="config.component.evaluator">
<params>
<element>WorkflowDetails/workflow-details/display-web-preview</element>
</params>
</evaluator>
</evaluators>
<url>/components/preview/web-preview</url>
<properties>
<nodeRef>{nodeRef}</nodeRef>
<api>api</api>
<proxy>alfresco</proxy>
<dependencyGroup>workflow-details</dependencyGroup>
</properties>
</evaluation>
</evaluations>
</sub-component>
</sub-components>
</component>
This not shows the web-preview, only creates:
<div id="template_x002e_web-preview_x002e_workflow-details">
<div id="template_x002e_web-preview_x002e_workflow-details_x0023_default"> </div>
</div>
What's my error?
Second question:
In the preview of the Aikau page I get: Warning: unimplemented annotation type: Widget signature in the console of the firebug of the Mozilla Firefox and the document is displayed without the digital signatures... But, for example, if I upload a document with a digital signature, I can see the document with the signature in the page of document-details of the document. The preview of this page is different? How can I implement this preview?
The main problem you have here is that the you don't have any nodeRef request parameter when viewing a workflow task (this is mapped to the {nodeRef} token that is assigned to the <nodeRef> element in the web-preview component. As a result the web-preview WebScript will not have a node to render.
You are either going to need to make a customization such that the nodeRef of the attached file is included as a request parameter when viewing the workflow task or use your own WebScript (other than the web-preview WebScript) in order to access the nodeRef of the document to preview.
A couple of other things to consider here, is that it is entirely possible to have more than one document assigned to a workflow, so you'd need to handle that scenario (i.e. which document is previewed, or how to preview all documents).
I don't think that this is going to be a simple customization though.
It can be easier to just use the javascript previewer that is integrated in share (pdf.js). If you use directly the javascript library, it shouldn't be difficult to open a preview.
There are examples in the official site of the project: pdf.js
you can use the share webscript to initialise the javascript with the list of urls of the documents attached to the workflow. If the document attached is not a pdf, you will need to use its pdf rendition.
For future references. You can do it as follows (example):
Create Share extension and add the following container to the /src/main/amp/config/alfresco/templates/org/alfresco/workflow-details.ftl:
<div class="yui-gc">
<div class="yui-u first">
<#if (config.scoped['DocumentDetails']['document-details'].getChildValue('display-web-preview') == "true")>
<#region id="web-preview" scope="template"/>
</#if>
</div>
</div>
Also add the same #templateHeader as in the document-details.ftl. Your workflow-details.ftl will look like this:
<#include "include/alfresco-template.ftl" />
<#templateHeader>
<#script type="text/javascript" src="${url.context}/res/modules/documentlibrary/doclib-actions.js" group="document-details"/>
<#link rel="stylesheet" type="text/css" href="${url.context}/res/components/document-details/document-details-panel.css" group="document-details"/>
<#templateHtmlEditorAssets />
</#>
<#templateBody>
<#markup id="alf-hd">
<div id="alf-hd">
<#region scope="global" id="share-header" chromeless="true"/>
<#region id="title" scope="template"/>
<#if page.url.args.nodeRef??>
<#region id="path" scope="template"/>
</#if>
</div>
</#>
<#markup id="bd">
<div id="bd">
<div class="share-form">
<#region id="data-header" scope="page" />
<#region id="data-form" scope="page" />
<div class="yui-gc">
<div class="yui-u first">
<#if (config.scoped['DocumentDetails']['document-details'].getChildValue('display-web-preview') == "true")>
<#region id="web-preview" scope="template"/>
</#if>
</div>
</div>
<#region id="data-actions" scope="page" />
</div>
</div>
</#>
</#>
<#templateFooter>
<#markup id="alf-ft">
<div id="alf-ft">
<#region id="footer" scope="global"/>
<#region id="data-loader" scope="page" />
</div>
</#>
</#>
Add the WebPreview component to the \src\main\amp\config\alfresco\site-data\template-instances\workflow-details.xml:
<!-- WebPreview -->
<component>
<region-id>web-preview</region-id>
<sub-components>
<sub-component id="default">
<evaluations>
<evaluation>
<evaluators>
<evaluator type="config.component.evaluator">
<params>
<element>DocumentDetails/document-details/display-web-preview</element>
</params>
</evaluator>
</evaluators>
<url>/components/preview/web-preview</url>
<properties>
<nodeRef>{nodeRef}</nodeRef>
<api>api</api>
<proxy>alfresco</proxy>
<dependencyGroup>document-details</dependencyGroup>
</properties>
</evaluation>
</evaluations>
</sub-component>
</sub-components>
</component>
Your workflow-details.xml will look like this:
<?xml version='1.0' encoding='UTF-8'?>
<template-instance>
<template-type>org/alfresco/workflow-details</template-type>
<properties>
<pageFamily>documentlibrary</pageFamily>
</properties>
<components>
<!-- Site Navigation -->
<component>
<region-id>navigation</region-id>
<sub-components>
<sub-component id="default">
<evaluations>
<!-- if referred from my tasks page: Task toolbar -->
<evaluation id="tasks">
<evaluators>
<evaluator type="equals.component.evaluator">
<params>
<referrer>{referrer}</referrer>
<tasks>tasks</tasks>
</params>
</evaluator>
</evaluators>
<url>/components/workflow/task-toolbar</url>
</evaluation>
<!-- if referred from my workflows page: Workflows toolbar -->
<evaluation id="workflows">
<evaluators>
<evaluator type="equals.component.evaluator">
<params>
<referrer>{referrer}</referrer>
<workflows>workflows</workflows>
</params>
</evaluator>
</evaluators>
<url>/components/workflow/workflow-toolbar</url>
</evaluation>
<!-- if in site: Site navigation -->
<evaluation id="site">
<evaluators>
<evaluator type="site.component.evaluator"/>
</evaluators>
<url>/components/navigation/collaboration-navigation</url>
</evaluation>
</evaluations>
</sub-component>
</sub-components>
</component>
<!-- WebPreview -->
<component>
<region-id>web-preview</region-id>
<sub-components>
<sub-component id="default">
<evaluations>
<evaluation>
<evaluators>
<evaluator type="config.component.evaluator">
<params>
<element>DocumentDetails/document-details/display-web-preview</element>
</params>
</evaluator>
</evaluators>
<url>/components/preview/web-preview</url>
<properties>
<nodeRef>{nodeRef}</nodeRef>
<api>api</api>
<proxy>alfresco</proxy>
<dependencyGroup>document-details</dependencyGroup>
</properties>
</evaluation>
</evaluations>
</sub-component>
</sub-components>
</component>
<!-- Path -->
<component>
<region-id>path</region-id>
<sub-components>
<sub-component id="default">
<evaluations>
<!-- if in site: Site title -->
<evaluation id="site">
<evaluators>
<evaluator type="site.component.evaluator"/>
</evaluators>
<url>/components/document-details/path</url>
</evaluation>
<!-- otherwise: Repository title -->
<evaluation id="repo">
<url>/components/document-details/repo/path</url>
</evaluation>
</evaluations>
</sub-component>
</sub-components>
</component>
</components>
</template-instance>
If you want to place the component in an arbitrary region, you may need to use JavaScript, for example:
...
var container = YAHOO.util.Dom.get('user-list');
var web_preview = YAHOO.util.Dom.get('template_x002e_web-preview_x002e_workflow-details_x0023_default');
YAHOO.util.Dom.insertAfter(web_preview, container);
...
The container with ID==user-list I placed in the userdetails.ftl which added to the share-config-custom.xml as follows:
...
<field id="mswf:userDetails" set="userDetails" label="...">
<control template="/org/alfresco/components/form/controls/workflow/userdetails.ftl" />
</field>
...
The result may look as shown below.
Here is an easier solution that handles multiple documents and uses web-preview component:
In your share-config-custom.xml override packageItems field:
<field id="packageItems" set="items">
<control template="/com/yourdomain/components/form/controls/workflow/packageitems.ftl" />
</field>
Control template (/com/yourdomain/components/form/controls/workflow/packageitems.ftl):
<#include "/org/alfresco/components/form/controls/workflow/packageitems.ftl" />
<#assign el>${controlId}-wp</#assign>
<#assign dependencyGroup="web-preview">
<#include "/org/alfresco/components/preview/include/web-preview-css-dependencies.lib.ftl" />
<#include "/org/alfresco/components/preview/include/web-preview-js-dependencies.lib.ftl" />
<div class="yui-g" id="${el}"></div>
<script type="text/javascript">//<![CDATA[
(function(){
var nodeRefs = ("${field.value?html}" || "").split(',');
for (var ni = 0; ni < nodeRefs.length; ni++) {
Alfresco.util.loadWebscript({
url: Alfresco.constants.URL_SERVICECONTEXT + "components/preview/web-preview",
properties: { nodeRef: nodeRefs[ni], htmlid: "${el}-preview-" + ni},
target: "${el}"
});
}
})();
//]]></script>

Video playing in ASP.Net page

I want to play video in my asp.net page. I am using the code
<object classid="clsid:6BF52A52-394A-11D3-B153-00C04F79FAA6" id="Player1" width="440" height="379">
<param name="URL" value="~/DBVideo/citibank.mpeg">
<param name="http://">
<param name="AutoStart" value="1">
<param name="ShowControls" value="">
<param name="ShowStatusBar" value="1">
<param name="ShowDisplay" value="1">
<param name="stretchToFit" value="1">
<param name="volume" value="32" />
<embed runat="server" id="Video"
type="application/x-mplayer2" pluginspage="http://www.microsoft.com/Windows/Downloads/Contents/MediaPlayer/"
width="440" height="379" src="~/DBVideo/citibank.mpeg"
filename="~/DBVideo/citibank.mpeg" autostart="1" showcontrols="1" showstatusbar="1" showdisplay="1">
</embed>
</object>
Now only the media player symbol is coming but the video is not playing.
Can anybody help me where the problem is??
and if I want to play the video from SQL server 2008 database (varbinary field) then what would I do?
If you're allowed to use HTML5, you can use video tag
<video width="320" height="240" controls>
<source src="movie.mp4" type="video/mp4">
<source src="movie.ogg" type="video/ogg">
<source src="movie.webm" type="video/webm">
Your browser does not support the video tag.
</video>
As for getting video from sql: you can use http handler which extracts file from SQL and probably caches it http://msdn.microsoft.com/en-us/library/46c5ddfy%28v=vs.100%29.aspx

How do I just fullscreen the Videodisplay and not the whole application?

I'm working on a video chat in Flex with Red5. I'm using the following code:
stage.fullScreenSourceRect = new Rectangle(vidDisp.x,vidDisp.y, vidDisp.width, vidDisp.height);
stage.scaleMode = StageScaleMode.NO_SCALE;
stage.displayState = StageDisplayState.FULL_SCREEN
This code gives me a weird half cut fullscreen. Does anyone know any other way?
Thanks.
#Siddharth here's the videoContainer from that implementation:
<!--Video Player-->
<mx:Box id="videoContainer" width="100%" height="{Math.floor(this.width * 0.6)}">
<mx:VideoDisplay id="player" width="100%" height="100%" autoPlay="false" autoRewind="false" bufferTime="4" playheadUpdateInterval="1000" />
</mx:Box>

Using javascript function to updates styles in ASP.Net

Okay so I have a Silverlight 4 app sitting on a page with a couple banners. Depending on some variables within the Silverlight app I need to show one of the banners and re-position the Silverlight app so that it lines up with the bottom of the banner. To accomplish this I have been using HtmlPage.Window.Invoke("MethodToShowTheBannerIWant"). Each banner has it's own function that attempts to show the correct banner and position the app to line up properly. Something like
function ShowFirstBanner() {
FirstBannerStyle.style.display = 'block';
SilverlightAppStyle.style.marginTop = '120px';
SilverlightAppStyle.style.height = '495px';
}
Each banner looks like
<table id="FirstBannerStyle" style="position:absolute;top:0px;left:0px;display:none;height:50px;" width=100% border="0" cellpadding="0">
<tr>
<td><img src="http://www.bannerimageurl.jpg" usemap="#Map2" border="0"></td> </table>
with a map in the like this
<map name="Map2"><area shape="poly" coords="763,19,769,91,985,92,981,69" href="http://www.xxxxxxx.com/cal.htm" target="_self" />
<area shape="rect" coords="11,73,88,89" href="http://www.xxxxxxx.com/index.htm" target="_self">
<area shape="rect" coords="121,70,186,88" href="http://www.xxxxxxx.com/courses.htm" target="_self">
<area shape="rect" coords="217,70,327,90" href="http://www.xxxxxxx.com/ts.htm">
<area shape="rect" coords="365,70,521,91" href="http://www.xxxxxxx.com/po.htm">
<area shape="rect" coords="556,71,618,91" href="http://www.xxxxxxxx.com/au.htm" target="_self">
<area shape="rect" coords="655,72,726,91" href="http://www.xxxxxxx.com/CU/index.htm" target="_self">
</map>
and the Silverlight app area looks like this
<form id="form1" runat="server" style="height:100%">
<div id="silverlightControlHost" style="height:100%;text-align:center">
<object data="data:application/x-silverlight-2," type="application/x-silverlight-2" width="100%" height="100%">
<param name="source" value="ClientBin/XXX.XXX.XXX.xap"/>
<param name="onError" value="onSilverlightError" />
<param name="background" value="white" />
<param name="minRuntimeVersion" value="4.0.50826.0" />
<param name="autoUpgrade" value="true" />
<param name="InitParams" value=<%=System.Configuration.ConfigurationManager.AppSettings.GetValues(0).FirstOrDefault()%>/>
<param name="windowless" value="true" />
<a href="http://go.microsoft.com/fwlink/?LinkID=149156&v=4.0.50826.0" style="text-decoration:none">
<img src="http://go.microsoft.com/fwlink/?LinkId=161376" alt="Get Microsoft Silverlight" style="border-style:none"/>
</a>
</object><iframe id="_sl_historyFrame" style="visibility:hidden;height:0px;width:0px;border:0px"></iframe></div>
<div id="InvisibleFrame"></div>
</form>
The issue I am having is that this process works great in IE8, but doesn't work at all in IE9 or Firefox. When my code hits the HtmlPage.Window.Invoke("ShowFirstBanner") it gets stuck right there and never moves past that line, but does not display any error message and instead will just sit indefinitely waiting for that command to complete. If I comment out the code withing the function it makes the call and continues as normal. So something related to how I'm updating the styles Firefox and IE9 doesn't like. Anyone have an idea for a way to do this that will work in all browsers?
Where are "FirstBannerStyle" and "SilverlightAppStyle" defined in your JavaScript?
You need to grab the element by its ID:
document.getElementById('FirstBannerStyle').style.display = 'block';
or if you're using jQuery:
$('FirstBannerStyle').show()

Flex - Issues with linkbar dataprovider

I'm having some issues displaying a linkbar.
The data I need to display is in a XML file.
However, I couldn't get the linkbar to display a xmllist (I did indeed read that you cannot set a xmlllist as a linkbar dataprovider... ). So, I'm transforming the xmllist in a array of objects.
Here is some code.
XML file:
<data>
<languages>
<language id="en">
<label>ENGLISH</label>
<source></source>
</language>
<language id="fr">
<label>FRANCAIS</label>
<source></source>
</language>
<language id="es">
<label>ESPAÑOL</label>
<source></source>
</language>
<language id="jp">
<label>JAPANESE</label>
<source></source>
</language>
</languages>
</data>
AS Code that transforms the xmllist in an array of objects:
private function init():void
{
var list:XMLList = generalData.languages.language;
var arr:ArrayCollection = new ArrayCollection;
var obj:Object;
for(var i:int = 0; i<list.length(); i++)
{
obj = new Object;
obj.id = list[i].#id;
obj.label = list[i].label;
obj.source = list[i].source;
arr.addItemAt(obj, arr.length);
}
GlobalData.instance.languages = arr.toArray();
}
Linkbar code:
<mx:HBox horizontalAlign="right" width="100%">
<mx:LinkBar id="language" dataProvider="{GlobalData.instance.languages}" separatorWidth="3" labelField="{label}"/>
</mx:HBox>
The separator is not displaying, and neither do the label.
But the array is populated (I tested it).
Thanks for any help you can provide =)
Regards,
BS_C3
#Decado
Here's the code for the linkbar I used:
<mx:LinkBar id="language"
dataProvider="{GlobalData.instance.languages}"
labelFunction="language_labelFunction"
itemClick="language_itemClick(event)"
styleName="GLBLinkBTN"
separatorColor="#FFFFFF"
separatorWidth="1"
linkButtonStyleName="HPLanguages"
/>
And here's the function for the labelfunction:
private function language_labelFunction(item:Object):String
{
return item.label;
}
Hope this helps.
Regards
This does what you're looking for. See if you can adapt it.
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute">
<mx:Array id="dataProvider">
<mx:Object id="en" label="English" />
<mx:Object id="fr" label="French" />
<mx:Object id="es" label="Espanol" />
<mx:Object id="jp" label="Japanese" />
</mx:Array>
<mx:LinkBar
horizontalCenter="0"
verticalCenter="0"
dataProvider="{dataProvider}"
labelField="label" />
</mx:Application>
I found a solution to my issue.
I used a labelfunction in the linkbar (instead of label property). Using a label function did the trick.
But I still do not quite understand why the label property wasn't working...

Resources