<keyword> <id> <title> <where> <prize>
Ex: Regex 10 Blablabla Miami 1250
Keyword: text
id: number
title: text
prize: number (like 150)
It's about SMS integration. This string comes from web service. I need to control this order. There is no character limit for texts. Just <where> must be 15 character. Maybe I can use regex but how is it? Can anybody help me?
I think you need something like:
^\w+\s+\d+\s+\w+\s+\w{1,15}\s+\d+$
Which matches the string if it has the next format:
<word - keyword>
<one or more spaces>
<number - id>
<one or more spaces>
<word - title>
<one or more spaces>
<word not longer than 15 symbols - where>
<one or more spaces>
<number - prize>
Related
How to set-up a model in icCube to allow to drill down to the details, when details contain text fields?
The idea is to get a list, with column names containing the text fields (in combination with amount fields). Just like a simple SQL statement would give.
I have tried the following:
a) added a technical dimension that is linked to the rows (via rownumber) and added MIN Aggregation for the text fields. With the idea to use these when a DRILLTHROUGH MDX statement is invoked. The DRILLTHROUGH function works, but does not give the values next to each other for the measures. Result is like:
b) added each unique line a line number and loaded the line number as lowest detail in one of the dimensions. Added attributes for these text and date items for the "drillthrough" columns. Next, added calculated measures to get the property for these attributes. The drillthrough is now effectively a drillby to the lowest details. It works, but this is not nice as it blows up my dimension.
c) tried to use the widget data source SQL, but it is not available for text files, and it does not work for MSAccess files (too slow).
The preferable solution should works in the dashboards and in any XMLA/REST API interface.
Enclosed this example
the schema file
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<schemaFactory revisionNumber="7">
<schemaDefinition name="drilltrhough-text" description="" group="Issues" loadOnStartup="false">
<activateIncrementalLoad>false</activateIncrementalLoad>
<useUnknownMembersInFacts>true</useUnknownMembersInFacts>
<autoCleanUpTableColumns>false</autoCleanUpTableColumns>
<useFactPartitioning>false</useFactPartitioning>
<callGarbageCollector>NONE</callGarbageCollector>
<backup>NONE</backup>
<nonEmptyCachePolicy>NONE</nonEmptyCachePolicy>
<nonEmptyCacheType>REGULAR</nonEmptyCacheType>
<nonEmptyCachePersistency>MEMORY</nonEmptyCachePersistency>
<storagePolicy>DEFAULT</storagePolicy>
<hierarchyUniqueNameStyle>IncludeDimensionName</hierarchyUniqueNameStyle>
<inMemoryDS name="data">
<memoryDataTable tableName="data" rowLimit="-1" id="d9429713-9be8-4c63-9b40-4a20388e7563">
<column name="dimension" tableType="STRING" type="STRING" selected="true" primaryKey="false"/>
<column name="amount" tableType="STRING" type="STRING" selected="true" primaryKey="false"/>
<column name="text" tableType="STRING" type="STRING" selected="true" primaryKey="false"/>
<addRowNumber>false</addRowNumber>
<stringDateConverter></stringDateConverter>
<trimStrings>true</trimStrings>
<columnSeparator>,</columnSeparator>
<commentMarker>#</commentMarker>
<dataAsString>dimension, amount, text
a, 10,some text
b, 20, some more text
c, ,text without an amount</dataAsString>
</memoryDataTable>
</inMemoryDS>
<multiLevelDimension dataTableId="d9429713-9be8-4c63-9b40-4a20388e7563" isTimeDimension="false" isDefaultTimeDimension="false" isIndexingByRange="false" id="86d118f0-71ba-4826-a6ac-343eac96fb05" name="Dimension">
<multiLevelHierarchy hasAllLevel="true" allLevelName="All-Level" allMemberName="All" name="Dimension" isDefault="true">
<level name="Dimension - L" nameUnique="false" nameUniqueInParent="false" keyUnique="false" ignoreNameCollision="false">
<nameCol name="dimension"/>
<orderType>BY_NAME</orderType>
<orderKind>ASC</orderKind>
</level>
</multiLevelHierarchy>
</multiLevelDimension>
<cube id="caa9c520-f953-4c77-9e72-76c8668170f7" name="Cube">
<defaultFacts measureGroupName="Facts" partitioningLevelName="" partitioningType="NONE" newGeneration="true" dataTableId="d9429713-9be8-4c63-9b40-4a20388e7563" aggregateDataSourceFacts="false" unresolvedRowsBehavior="ERROR">
<rowFactAggregationType>ADD_ROW</rowFactAggregationType>
<measure name="Amount" aggregationType="SUM">
<dataColumn name="amount"/>
</measure>
<measure name="Text" aggregationType="MIN">
<dataColumn name="text"/>
</measure>
<links dimensionId="86d118f0-71ba-4826-a6ac-343eac96fb05">
<viewLinks type="LAST_LEVEL">
<toColumns name="dimension"/>
</viewLinks>
</links>
</defaultFacts>
</cube>
</schemaDefinition>
</schemaFactory>
- the mdx
drillthrough
select [Measures].members on 0
, [Dimension].[Dimension].[Dimension - L] on 1
from [cube]
return Name([Dimension])
the result
This is not related to having a measure of type STRING.
You're performing a multi-cell result drillthrough (which is an extension of standard MDX in icCube). In that case, the result is "organized" per result cell meaning each [Measures] being in its own category (you can add another Amount measure and you'll see the same behavior).
Instead you should perform a single cell drillthrough:
drillthrough
select [Dimension].[Dimension].[Dimension -L].[a] on 0
from [cube]
And the result should look like:
You can see the [Measures].[Info] being on the same row (as all the other measures).
Hope that helps.
I have got a Qt application which receive strings in JSON objects from the Disqus API:
{ "title": "Swiftkey pr\u0102\u0160dit votre choix d\u2019emoji gr\u0102\u02d8ce au clavier Swiftmoji" }
(there's more but I only write what matters here)
Then I put the title string in a QString:
// Assuming that "reply" is the QNetworkReply * containing the Disqus API response.
QByteArray disqusReply = reply->readAll();
// disqusReply == "{ \"title\": \"Swiftkey pr\u0102\u0160dit votre choix d\u2019emoji\ gr\u0102\u02d8ce au clavier Swiftmoji" }"
QJsonDocument doc = QJsonDocument::fromJson(disqusReply);
QJsonObject obj = doc.object();
QString title = obj["title"].toString();
Later I write it in a QML Text. It should display "Swiftkey prédit votre choix d'emoji grâce au clavier Swiftmoji" but it displays "Swiftkey prĂŠdit votre choix d'emoji grâce au clavier Swiftmoji" instead.
As you can see there are some encoding issues, with two successive Unicode characters which should be interpreted as one character only ("ĂŠ" instead of "é" and "â" instead of "à" here). How can I do (with Qt or QML) to display the right characters? Which encoding conversions I have to perform (with Qt or QML) in order to solve those encoding issues?
Additional informations: the bug occurs on Windows 10 64-bit.
EDIT : you can find the bug here: https://disqus.com/api/3.0/threads/list.json?since=2016-05-18T14%3A08%3A27%2B00%3A00&forum=frandroid&api_key=7o0xSBOEzN2AG6yxcJgeJbeEbACBfGhgnoIRHu7umbifKAvXQpisYKT3KSXF9nPN
Well, I think the problem in double encoding or something else from server side, not from client's. Because your code must be pr\u00e9dit instead of pr\u0102\u0160dit. If you'll use clean_title instead of title of your json-answer you'll get the right string cause it's encode is correct.
UPD:
As I said in comment - there are two replies with same news. Id 4836688567 has wrong encode string. And 4836587900 correct. There are many double variants of news with different encoding.
First:
{
"feed":"https://frandroid.disqus.com/httpwwwfrandroidcomandroidapplications358721_swiftkey_predire_choix_demoji_grace_clavier_swiftmoji/latest.rss",
"identifiers":[],
"dislikes":0,
"likes":0,
"message":"",
"id":"4836688567",
"createdAt":"2016-05-18T09:08:43",
"category":"448171",
"author":"3938134",
"userScore":0,
"isSpam":false,
"signedLink":"http://disq.us/?url=http%3A%2F%2Fwww.frandroid.com%2Fandroid%2Fapplications%2F358721_swiftkey-predire-choix-demoji-grace-clavier-swiftmoji&key=nqCbe6jgfwM-skLyqTf3lg",
"isDeleted":false,
"raw_message":"",
"isClosed":false,
"link":"http://www.frandroid.com/android/applications/358721_swiftkey-predire-choix-demoji-grace-clavier-swiftmoji",
"slug":"httpwwwfrandroidcomandroidapplications358721_swiftkey_predire_choix_demoji_grace_clavier_swiftmoji",
"forum":"frandroid",
"clean_title":"Swiftkey pr\u0102\u0160dit votre choix d\u2019emoji gr\u0102\u02d8ce au clavier Swiftmoji",
"posts":0,
"userSubscription":false,
"title":"Swiftkey pr\u0102\u0160dit votre choix d\u2019emoji gr\u0102\u02d8ce au clavier Swiftmoji",
"highlightedPost":null
}
Second:
{
"feed":"https://frandroid.disqus.com/swiftkey_predit_votre_choix_d8217emoji_grace_au_clavier_swiftmoji/latest.rss",
"identifiers":["358721 http://www.frandroid.com/?p=358721"],
"dislikes":0,
"likes":1,
"message":"",
"id":"4836587900",
"createdAt":"2016-05-18T08:16:30",
"category":"448171",
"author":"3938134",
"userScore":0,
"isSpam":false,
"signedLink":"http://disq.us/?url=http%3A%2F%2Fwww.frandroid.com%2Fandroid%2Fapplications%2Fgoogle-apps%2F358721_swiftkey-predire-choix-demoji-grace-clavier-swiftmoji&key=UU8IrLN_UDXEggF6wHjAYg",
"isDeleted":false,
"raw_message":"",
"isClosed":false,
"link":"http://www.frandroid.com/android/applications/google-apps/358721_swiftkey-predire-choix-demoji-grace-clavier-swiftmoji",
"slug":"swiftkey_predit_votre_choix_d8217emoji_grace_au_clavier_swiftmoji",
"forum":"frandroid",
"clean_title":"Swiftkey pr\u00e9dit votre choix d\u2019emoji gr\u00e2ce au clavier Swiftmoji",
"posts":13,
"userSubscription":false,
"title":"Swiftkey pr\u00e9dit votre choix d’emoji gr\u00e2ce au clavier Swiftmoji",
"highlightedPost":null
}
As you see, difference in url from where news comes. But why some of them encoded wrong - this is a question.
UPD 2:
Or maybe it's RSS bug. Let's take prédit word. In second variant RSS returns xml with content which has been already encoded to é and feed link looks like normal. In first variant RSS returns ĂŠ and its feed link looks like anormal - feel like it takes whole url and do another encode.
Have you tried
QByteArray disqusReply
= QString::fromUtf8(reply->readAll().data()).toLocal8Bit();
? You might prefer delaying this conversion until actually writing the string into the QML text.
QJsonDocument requires UTF-8 encoded strings. Is your document encoded in UTF-8 when you load it?
I've got through the entire FORM integration successfully except for the encryption.
Version 3 requires AES encryption and I don't understand how to implement this stage.
Previously, the CFML script constructed the crypt field at the end using this:
//** call to include file to encrypt
crypt = base64Encode (SimpleXor(stuff,EncryptionPassword));
This called the functions file which did the actual work.
The help I need is in creating a new script in the function.cfm file and also what the call should be.
Can anyone help, please?
Cheers
Here's a snippet of the code:
<cfscript>
ThisVendorTxCode = "#sfo_id#";
ThisVendorName = "pivotell";
stuff = "VendorTxCode=" & ThisVendorTxCode & "&";
stuff = stuff & "VendorName=" & ThisVendorName & "&";
</cfscript>
<cfset encryptionKey = generateSecretKey( "AES" ) />
//** call to include file to encrypt
<cfset crypt = encrypt(stuff,encryptionKey,"AES","hex") />
<cfoutput>
<form action="https://test.sagepay.com/gateway/service/vspform-register.vsp" method="post" id="form1" name="form1">
<input type="hidden" name="VPSProtocol" value="3.00">
<input type="hidden" name="TxType" value="PAYMENT">
<input type="hidden" name="Crypt" value="#crypt#">
</form>
</cfoutput>
I've truncated the full thing for simplicity.
It took me 3 days and 3 nights to figure this out.
Please read page 37 of the Sage Pay Form Integration and Protocol Guidelines 3.00.
A1.1 The Crypt Field
The Crypt field should contain all the other transaction information in plain text as Name=Value fields separated by ‘&’
characters. Ensure that all mandatory fields are present and that
there are no spaces after the ‘&’ character.
This string should then be encrypted using AES (block size 128-bit) in CBC mode with PKCS#5 padding using the provided password as both
the key and initialisation vector and encode the result in hex
(making sure the letters are in upper case).
Prepend the ‘#’ sign to the beginning of the encoded result.
Together with the last answer on this post. It should sort it.
... Since your password string is not base64 encoded, the resulting key
length is too small, ie (12) instead of (16) bytes. ...The solution is
to base64 encode it first... Also, the iv parameter should be binary
<cfset keyIVBytes = charsetDecode(yourKeyString, "utf-8")>
<cfset base64Key = binaryEncode(keyIVBytes, "base64")>
<cfset result = encrypt(plainString, base64Key,"AES/CBC/PKCS5Padding", "hex", keyIVBytes)>
I have the following somewhere in a page:
<asp:Localize ID="locChangePasswordPrompt" runat="server"
Text="Change Your Password" meta:resourcekey="locChangePasswordPrompt" />
I am localizing using sql server database and I have stored the FRENCH corresponding values in the db.
Do if u do a query:
SELECT TOP 1000 [ResourceType]
,[CultureCode]
,[ResourceKey]
,[ResourceValue]
,[Preserve]
FROM [CLeX].[dbo].[StringResource]
where resourcekey like 'locChangePasswordPrompt%'
You get the values:
ResourceType CultureCode ResourceKey ResourceValue Preserve
common/UserPreferences.aspx en locChangePasswordPrompt 1
common/UserPreferences.aspx en locChangePasswordPrompt.Text Change Your Passwordss 1
common/UserPreferences.aspx en-US locChangePasswordPrompt 1
common/UserPreferences.aspx en-US locChangePasswordPrompt.Text Change Your Passwordss 1
common/UserPreferences.aspx fr locChangePasswordPrompt 1
common/UserPreferences.aspx fr locChangePasswordPrompt.Text Changez votre mot de passe 1
However, I am still not able to get the FRENCH values at all. In fact, not even the English values are being pulled from the DB. Localize simply pulls the text from its text attribute.
What could possibly be the reason?
Did you configure your DB Resource Provider?
Using a BizTalk Map and wondering if there's a good way to do the following.
I need to map a received Invoice to a list of Orders. However each Order must contain only two line items (let's assume the Invoice has an even number).
This means that Invoice(1, 2, 3, 4) should map to Orders(Order (1, 2), Order (3, 4)).
Essentially, I need to create new parent elements when (index % 2 == 0).
Is there a functoid-only way of doing this?
XML example below:
<Invoice>
<Client>Client1</Client>
<Line>
<Code>1</Code>
<Price>$1.00</Price>
<Qty>1</Qty>
</Line>
<Line>
<Code>2</Code>
<Price>$2.00</Price>
<Qty>2</Qty>
</Line>
<Line>
<Code>3</Code>
<Price>$3.00</Price>
<Qty>3</Qty>
</Line>
<Line>
<Code>4</Code>
<Price>$4.00</Price>
<Qty>4</Qty>
</Line>
</Invoice>
to
<Orders>
<Order>
<Client>Client1</Client>
<OrderItem>
<Code>1</Code>
<Qty>1</Qty>
</OrderItem>
<OrderItem>
<Code>2</Code>
<Qty>2</Qty>
</OrderItem>
</Order>
<Order>
<Client>Client1</Client>
<OrderItem>
<Code>3</Code>
<Qty>3</Qty>
</OrderItem>
<OrderItem>
<Code>4</Code>
<Qty>4</Qty>
</OrderItem>
</Order>
</Orders>
What I've tried:
Standard mapping: A single Order with all lines, as expected
Value Mapping to Client based on index % 2: Order per line (half have Client)
Table Looping (Gated to index % 2) + Extractor to Client: Order per line, only half lines
What I'm likely to end up doing:
XSLT
Or, C# manipulation after mapping
In the advanced functoids section of the toolbox look for the 'index' functoid.
Add a scripting functoid on the output.
Add C# code to check for the indexes you want to match.
You can switch output on and off by returning a boolean from the scripting functoid.