MVC3 Razor Camtasia Video Embedding, # param Error :-( - asp.net-mvc-3

Greetings Community!
<object id="myExperienceXXXXXXXX" class="BrightcoveExperience">
<param name="bgcolor" value="#FFFFFF" />
<param name="width" value="448" />
<param name="height" value="251" />
<param name="playerID" value="XXXXXXXXXX" />
<param name="playerKey" value="XXXXXXXXXXX" />
<param name="isVid" value="true" />
<param name="dynamicStreaming" value="true" />
<param name="#videoPlayer" value="XXXXXXXXXXXXX" />
</object>
Notice the last line , I get the following error:
Compiler Error Message: CS0103: The name 'videoPlayer' does not exist in the current context
This value is Required by Camtasia to embed my video in my page. I'm sure there is a simple solution, but I need the "#" sign before the videoPlayer value.
Thanks in advance for any assistance.

# is a reserved character in Razor which should normally be followed by a server side expression. Double it if you want to output it literally:
<param name="##videoPlayer" value="XXXXXXXXXXXXX" />

The # symbol is a reserved character in the Razor view engine. If you want to output a # symbol you can use two # characters to escape the first.
For example:
<param name="##videoPlayer" value="XXXXXXXXXXXXX" />

Not work with the above answers!
It should be the format like this:
<param name="#("#videoPlayer")" value="XXXXXXXXXXXXX" />

Related

How to filter messages using Parameter values

I am trying to deselect files based on the value of the param name "filter_param" within the section. Example input file:
<What>
<Param name="filter_param" value="1" />
<Param name="other_param" value="2" />
<Param name="yet_other_param" value="1" />
...
</What>
The 'filter_param' can have any integer value between 1 and 100 and I am trying to get rid of only the ones that have certain values (e.g. 1 and 2). I am trying filters like
"//Param[#name='What/filter_param' and #value!=1] and //Param[#name='What/filter_param' and #value!=2]"
but without success... Any hints?
Use and inside predicates:
//Param[#name="..." and #value != 1 and #value != 2]
If I understand you correctly, assuming your xml looks like this:
<What>
<Param name="filter_param" value="1" />
<Param name="other_param" value="2" />
<Param name="yet_other_param" value="1" />
<Param name="filter_param" value="100" />
</What>
This xpath expression
//What/Param[not(.[#name="filter_param"][#value<3])]
should output:
<Param name="other_param" value="2"/>
<Param name="yet_other_param" value="1"/>
<Param name="filter_param" value="100"/>
Is that what you are looking for?
In XPath 2.0 you can do
//Param[#name="filter_param" and not(#value=(1, 2))]
to select Param node that contains name attribute that equals to "filter_param" and value attribute is not equal to 1, not equal to 2

How to avoid the Jackrabbit DataStore "table or view does not exist" error?

From time to time, our Jackrabbit (v2.6.1) system fails to automatically create the DATASTORE_DATASTORE table in an Oracle database, when setting up new environments. In this case, we see the following error in the application log file:
DbDataStore - Can not insert new record
java.sql.SQLSyntaxErrorException: ORA-00942: table or view does not exist
at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:447)
at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:396)
at oracle.jdbc.driver.T4C8Oall.processError(T4C8Oall.java:951)
at oracle.jdbc.driver.T4CTTIfun.receive(T4CTTIfun.java:513)
at oracle.jdbc.driver.T4CTTIfun.doRPC(T4CTTIfun.java:227)
at oracle.jdbc.driver.T4C8Oall.doOALL(T4C8Oall.java:531)
at oracle.jdbc.driver.T4CPreparedStatement.doOall8(T4CPreparedStatement.java:208)
at oracle.jdbc.driver.T4CPreparedStatement.executeForDescribe(T4CPreparedStatement.java:886)
at oracle.jdbc.driver.OracleStatement.executeMaybeDescribe(OracleStatement.java:1175)
at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:1296)
at oracle.jdbc.driver.OraclePreparedStatement.executeInternal(OraclePreparedStatement.java:3613)
at oracle.jdbc.driver.OraclePreparedStatement.execute(OraclePreparedStatement.java:3714)
at oracle.jdbc.driver.OraclePreparedStatementWrapper.execute(OraclePreparedStatementWrapper.java:1378)
at org.apache.commons.dbcp.DelegatingPreparedStatement.execute(DelegatingPreparedStatement.java:172)
at org.apache.commons.dbcp.DelegatingPreparedStatement.execute(DelegatingPreparedStatement.java:172)
at org.apache.commons.dbcp.DelegatingPreparedStatement.execute(DelegatingPreparedStatement.java:172)
at org.apache.jackrabbit.core.util.db.ConnectionHelper.execute(ConnectionHelper.java:516)
at org.apache.jackrabbit.core.util.db.ConnectionHelper.reallyExec(ConnectionHelper.java:404)
at org.apache.jackrabbit.core.util.db.ConnectionHelper$3.call(ConnectionHelper.java:379)
at org.apache.jackrabbit.core.util.db.ConnectionHelper$3.call(ConnectionHelper.java:375)
at org.apache.jackrabbit.core.util.db.ConnectionHelper$RetryManager.doTry(ConnectionHelper.java:557)
at org.apache.jackrabbit.core.util.db.ConnectionHelper.exec(ConnectionHelper.java:375)
at org.apache.jackrabbit.core.util.db.ConnectionHelper.query(ConnectionHelper.java:359)
at org.apache.jackrabbit.core.data.db.DbDataStore.addRecord(DbDataStore.java:321)
at org.apache.jackrabbit.core.value.BLOBInDataStore.getInstance(BLOBInDataStore.java:121)
at org.apache.jackrabbit.core.value.InternalValue.getBLOBFileValue(InternalValue.java:626)
at org.apache.jackrabbit.core.value.InternalValue.create(InternalValue.java:381)
at org.apache.jackrabbit.core.value.InternalValueFactory.create(InternalValueFactory.java:108)
at org.apache.jackrabbit.core.value.ValueFactoryImpl.createBinary(ValueFactoryImpl.java:77)
Our Jackrabbit configuration for the DataStore looks like this:
<DataStore class="org.apache.jackrabbit.core.data.db.DbDataStore">
<param name="url" value="jdbc:oracle:thin:#//db:1521/SID" />
<param name="user" value="foo" />
<param name="password" value="foo" />
<param name="databaseType" value="oracle" />
<param name="driver" value="oracle.jdbc.OracleDriver" />
<param name="minRecordLength" value="1024" />
<param name="maxConnections" value="3" />
<param name="copyWhenReading" value="true" />
<param name="tablePrefix" value="" />
<param name="schemaObjectPrefix" value="datastore_"/>
</DataStore>
This only seems to happen when we have multiple Jackrabbit instances on the same database instance, with each Jackrabbit instance in its own database schema/user. The issue only occurs with the DATASTORE_DATASTORE table - all other Jackrabbit tables work fine in this scenario.
What could be causing this issue?
A hint for answering this question can be found in the Jackrabbit DataStore FAQ:
Q: When I use the database data store I get the message: 'Table or view does not exists'. A: Maybe the data store table already exists in another schema. When starting the repository, the database data store checks if the table already exists (using a database meta data call), and will create the table if not. If the table exists, but is in another schema, the table is not created, but accessing it may fail (if the other schema is not in the schema search path for this user).
It turns out that for the DataStore (all other tables use a different way of checking for the existence of the tables), Jackrabbit uses the database's metadata to check for the existence of the DATASTORE_DATASTORE table, and this is done in a way that does not take the user's database schema into account by default. That means that if there is another Jackrabbit schema on the same Oracle instance that already has a table called DATASTORE_DATASTORE, then Jackrabbit will think that the table is already there and will not try to create it in the user's schema.
Setting the recommended tablePrefix property in the DataStore configuration does NOT work:
<DataStore class="org.apache.jackrabbit.core.data.db.DbDataStore">
<param name="url" value="jdbc:oracle:thin:#//db:1521/SID" />
<param name="user" value="foo" />
<param name="password" value="foo" />
<param name="databaseType" value="oracle" />
<param name="driver" value="oracle.jdbc.OracleDriver" />
<param name="minRecordLength" value="1024" />
<param name="maxConnections" value="3" />
<param name="copyWhenReading" value="true" />
<param name="tablePrefix" value="foo." />
<param name="schemaObjectPrefix" value="datastore_"/>
</DataStore>
Doing this (with the period at the end of tablePrefix) will cause the table never to be found by Jackrabbit, and will result in even more errors, since Jackrabbit will not try to create the table every time the application is started.
There are two ways for fixing this permanently:
Unique Table Name
This fix requires to manipulate either the tablePrefix or schemaObjectPrefix values so that the name of the table is unique in the whole database. For example for the first Jackrabbit instance use this:
<DataStore class="org.apache.jackrabbit.core.data.db.DbDataStore">
<param name="url" value="jdbc:oracle:thin:#//db:1521/SID" />
<param name="user" value="foo1" />
<param name="password" value="foo1" />
<param name="databaseType" value="oracle" />
<param name="driver" value="oracle.jdbc.OracleDriver" />
<param name="minRecordLength" value="1024" />
<param name="maxConnections" value="3" />
<param name="copyWhenReading" value="true" />
<param name="tablePrefix" value="" />
<param name="schemaObjectPrefix" value="FOO1_"/>
</DataStore>
This results in the table called FOO1_DATASTORE for this user. A second Jackrabbit instance in the same database could then use a configuration like this to ensure a unique table name:
<DataStore class="org.apache.jackrabbit.core.data.db.DbDataStore">
<param name="url" value="jdbc:oracle:thin:#//db:1521/SID" />
<param name="user" value="foo2" />
<param name="password" value="foo2" />
<param name="databaseType" value="oracle" />
<param name="driver" value="oracle.jdbc.OracleDriver" />
<param name="minRecordLength" value="1024" />
<param name="maxConnections" value="3" />
<param name="copyWhenReading" value="true" />
<param name="tablePrefix" value="" />
<param name="schemaObjectPrefix" value="foo2_"/>
</DataStore>
This results in this schema's table to be called FOO2_DATASTORE.
While this works, it's somewhat ugly and error-prone, since it requires changes to the configuration which are easily missed - and also is different from all of the other Jackrabbit tables, which work fine without this hack.
Custom DbDataStore Class
The other solution is working around the issue in Jackrabbit's code. The original issue stems from the way Jackrabbit checks for the presence of the table in the database, through its ConnectionHelper.tableExists method (http://grepcode.com/file/repo1.maven.org/maven2/org.apache.jackrabbit/jackrabbit-core/2.6.1/org/apache/jackrabbit/core/util/db/ConnectionHelper.java?av=f#201), which checks for a flag called checkTablesWithUserName, which is set to false by default, resulting in a global check in the whole database (wrong!):
To get that flag set to true, a separate constructor needs to be called that allows to set the flag to true. To make this work, we need to create our own UserCheckDbDataStore class - it needs to be in the same package as the ConnectionHelper class to make use of the alternative constructor:
package org.apache.jackrabbit.core.util.db;
import javax.sql.DataSource;
import org.apache.jackrabbit.core.data.db.DbDataStore;
import org.apache.jackrabbit.core.util.db.ConnectionHelper;
public class UserCheckDbDataStore extends DbDataStore {
#Override
protected ConnectionHelper createConnectionHelper(DataSource dataSrc) throws Exception {
// Provide "true" as the second parameter to check in the user's schema
return new ConnectionHelper(dataSrc, true, false);
}
}
With this class in the classpath, the following Jackrabbit configuration works fine in the scenarios I have tested on both Oracle and MySQL:
<DataStore class="org.apache.jackrabbit.core.util.db.UserCheckDbDataStore">
<param name="url" value="jdbc:oracle:thin:#//db:1521/SID" />
<param name="user" value="foo" />
<param name="password" value="foo" />
<param name="databaseType" value="oracle" />
<param name="driver" value="oracle.jdbc.OracleDriver" />
<param name="minRecordLength" value="1024" />
<param name="maxConnections" value="3" />
<param name="copyWhenReading" value="true" />
<param name="tablePrefix" value="" />
<param name="schemaObjectPrefix" value="datastore_"/>
</DataStore>
Ideally, this bug/feature should be reported in the Jackrabbit bug tracker, but I'm not sure whether it would be fixed/merged since there have been similar requests with very little progress in the past.

isVid parameter in Brightcove

Good morning,
does anybody know anything about the purpose of the value: <param name="isVid" value="true" /> in the brightcove player-configuration?
on the website they just say that it's a bool-value and has to be set to "true". Nothing about what it's doing.
The parameter isVid is required when you embbed a video inside an HTML file,
<script language="JavaScript" type="text/javascript" src="
http://admin.brightcove.com/js/BrightcoveExperiences.js"></script>
<object id="myPlayer" class="BrightcoveExperience">
<param name="bgcolor" value="#FFFFFF" />
<param name="width" value="486" />
<param name="height" value="412" />
<param name="playerID" value="1234567890" />
<param name="playerKey" value="AQ~~,AAAAstMe5SE~,5vOZ123456789bOfHyhc1i" />
<param name="isVid" value="true" />
<param name="#videoPlayer" value="ref:myVid12345" />
</object>
I think is not well described on the docs...
isVid: Boolean Required to be true for all video players.
http://support.brightcove.com/en/video-cloud/docs/player-configuration-parameters

How to insert default joomla texteditor in module?

I need to create joomla 1.5 module with textfields wrapped with default texteditor. Could anyone help me, please? Here is my mod_...xml
<params>
<param name="felicitation" type="text" default="Желаем хорошего настроения и счастья:)!" label="Текст поздравления" description="укажите текст поздравления" size="60">
</param>
<param name="message" type="textarea" default="Дорогой друг! От всей души поздравляем тебя с Днём рождения! Желаем благополучия, личностного самосовершенствования, достижения намеченных целей.Сотрудники Центра развития молодёжных волонтёрских программ." cols="30" rows="7" label="Текст письма" description="текст поздравления в письме">
</param>
<param name="image" default="" type="imagelist" label="Выберите картинку" description="" directory="images/stories" >
</param>
</params>
The editor field isn't part of the standard field elements in Joomla 1.5 although it is available in Joomla 2.5 and above.
In your case, you will need to create a custom parameter type. See this response on how to setup a custom field element for the editor.

Getting XML node matching XPath expression

I'm hoping you can help with this. I tried a number of XPath testers online and wasn't able to find a solution.
I'm trying to get the value of the first node with the '~tid' attribute from this XML:
<Response status="ok" version="1.1">
<Action>
<Page>
<Params>
<Param name="~tid" value="1345811517165"/>
<Param name="~action-type" value="DATA"/>
<Param name="~from-page" value="login"/>
<Param name="~from-act" value="submitData"/>
<Param name="login_USERNAME" value="" type="0"/>
<Param name="login_PASSWORD" value="" type="0"/>
</Params>
</Page>
<Data name="clientData" method="POST">
<Params>
<Param name="timezoneoffset" value=""/>
<Param name="daylightsavings" value=""/>
</Params>
</Data>
</Action>
<Action>
<Page>
<Params>
<Param name="~tid" value="1345811517165"/>
<Param name="~action-type" value="NAV"/>
<Param name="~from-page" value="login"/>
<Param name="~from-act" value="resetPassword"/>
<Param name="~to-page" value="login_resetPassword"/>
</Params>
</Page>
</Action>
<Action>
<Page>
<Params>
<Param name="~tid" value="1345811517165"/>
<Param name="~action-type" value="NAV"/>
<Param name="~from-page" value="login"/>
<Param name="~from-act" value="newUser"/>
<Param name="~to-page" value="login_newUser"/>
</Params>
</Page>
</Action>
</Response>
The XPath I'm using is:
//Params[1]/Param[#name='~tid']/#value
It gets all three values. How can I get just the first one?
Try
/descendant::Params[1]/Param[#name='~tid']/#value
From the W3C XPath specification:
NOTE: The location path //para[1] does not mean the same as the location path /descendant::para[1]. The latter selects the first descendant para element; the former selects all descendant para elements that are the first para children of their parents.
This is the second most FAQ in XPath.
Use:
(//Params/Param[#name='~tid'])[1]/#value
Or even:
(//Param[#name='~tid'])[1]/#value
Explanation:
The XPath pseudo-operator // has lower precedence (priority) than the [] operator.
The usual solution in any laguage when default priority needs to be overriden is to use brackets that explicitly specify the new, wanted priorities.

Resources