xmlel parsing using fxml - parsing

I have a packet like this :
[{message,<<"1529424074151_7FEAC332-2AA0-410B-93C1-6A50D73EB91C">>,chat,<<"en">>,{jid,<<"testuser">>,<<"xmpp-qa.myhost.me">>,<<"7FEAC332-2AA0-410B-93C1-6A50D73EB91C">>,<<"testuser">>,<<"xmpp-qa.myhost.me">>,<<"7FEAC332-2AA0-410B-93C1-6A50D73EB91C">>},{jid,<<"testuser2">>,<<"xmpp-qa.myhost.me">>,<<"7FEAC332-2AA0-410B-93C1-6A50D73EB91C">>,<<"testuser2">>,<<"xmpp-qa.myhost.me">>,<<"7FEAC332-2AA0-410B-93C1-6A50D73EB91C">>},[],[{text,<<>>,<<"H\nJ\nK\nL">>}],undefined,[{mam_archived,{jid,<<"testuser2">>,<<"xmpp-qa.myhost.me">>,<<>>,<<"testuser2">>,<<"xmpp-qa.myhost.me">>,<<>>},<<"1529424074316547">>},{stanza_id,{jid,<<"testuser2">>,<<"xmpp-qa.myhost.me">>,<<>>,<<"testuser2">>,<<"xmpp-qa.myhost.me">>,<<>>},<<"1529424074316547">>},{xmlel,<<"message_format">>,[],[{xmlel,<<"messageId">>,[],[{xmlcdata,<<"1529424074151_7FEAC332-2AA0-410B-93C1-6A50D73EB91C">>}]},{xmlel,<<"messageTime">>,[],[{xmlcdata,<<"1529424074151">>}]}]},{xmlel,<<"markable">>,[{<<"xmlns">>,<<"urn:xmpp:chat-markers:0">>}],[]}],#{ip => {10,100,66,249},mam_archived => true,stanza_id => 1529424074316547}}]
I want to get the value of "format" inside :
{xmlel,<<"format">>,[],[{xmlcdata,<<"sms">>}]},
so here it will be "sms"
Can anyone tell me how to get this value i am using fxml and ejabberd 18.04.
right now i am trying :
Temp_format = fxml:get_subtag(Pkt, <<"message_format">>),
and :
fxml:get_path_s(Packet, [{elem, "message_format"}])
but both are giving me error :
** Reason = {error,function_clause,[{fxml,get_subtag,[{file,"src/fxml.erl"},{line,175}],

Related

bitcoin transaction block height

Hi I check that in the blockchain.info or blockr.io or other block explorer when checking one transaction ( not my own wallet transaction ) I could see the return value of "block_height" which can be use to count the transaction confirmation using block_count - block_height.
I have my own bitcoin node with -txindex enabled and I add additional txindex=1 in the conf.
But when using "bitcoin-cli decoderawtransaction " the parameters was never there.
How do I turn on that ? Or is it a custom made code ?
Bitcoind run under Ubuntu 14.04 x64bit version 0.11.0
I disable the wallet function and install using https://github.com/spesmilo/electrum-server/blob/master/HOWTO.md
The decoderawtransaction command just decodes the transaction, that is, it makes the transaction human readable.
Any other (though useful) information which is not related to the raw structure of a transaction is not shown.
If you need further info, you might use getrawtransaction <tx hash> 1, which returns both the result of decoderawtransaction and some additional info, such as:
bitcoin-cli getrawtransaction 6263f1db6112a21771bb44f242a282d04313bbda5ed8b517489bd51aa48f7367 1
-> {
"hex" : "010000000...0b00",
"txid" : "6263f1db6112a21771bb44f242a282d04313bbda5ed8b517489bd51aa48f7367",
"version" : 1,
"locktime" : 723863,
"vin" : [
{...}
],
"vout" : [
{...}
],
"blockhash" : "0000000084b830792477a0955eee8081e8074071930f7340ff600cc48c4f724f",
"confirmations" : 4,
"time" : 1457383001,
"blocktime" : 1457383001
}

Getting error in imagemagick

I am running a simple string to compare screenshot but i am getting an error
Error : 0x80041771
Code : 80041771
Source : ImageMagickObject.MagickImage.1
I am still getting output but my script got halted due to above error
Option Explicit
Sub Compare_Image()
Dim img
Dim msgs
Set img = CreateObject("ImageMagickObject.MagickImage.1")
msgs = img.Composite("C:\Users\manasm\Desktop\test\osd4_1.bmp",
"C:\Users\manasm\Desktop\test\osd4_sm.bmp", "-compose", "difference",
"C:\Users\manasm\Desktop\test\DIFFBLOCK.bmp")
Set img=Nothing
WScript.Quit(0)
End Sub
Please give some clue

getarguments in typo3 from URL

I am working in TYPO3 .....
how can i get arguments from URL
i passed arguments in url like this ,
as a template in resources folder , file name : list.html
<f:form action="update" object="{hotel}" arguments="{myArgument: argumentname}" name="hotel">
and in controller in updateAction() , i want to fetch that agruments , so i write like this ,
$this->view->assign('hotel', array('test' => 'hello' . isset($this->arguments['myArgument']) .'##' . $this->getParametersSafely('myArgument')));
and i make the function in controller...
public function getParametersSafely ($parameterName) {
if ($this-> request-> hasArgument ($parameterName)) {
return $this-> request->getArgument($parameterName);
}
}
So please help me this is not working
I guess "this is not working" means the string in the fluid variable {hotel} is kind of not what you expect? Or what exactly is not working?
First of all isset() returns a boolean, taht you should not just add to your string.
Secondly, if you use arguments="{myArgument: argumentname}"fluid expects argumentname to be a variable passed to the template. If you want to pass a string, you need to specify it: arguments="{myArgument: 'argumentname'}".

Cassandra thrift Erlang insert

I'm currently trying to get my head wrap around Cassandra/thrift with Erlang...
I have a Column Family named "mq" (as in message queue)...
I would like to have a row per user (with an user_id), each message would be a new column with timestamp for name and the message as the value.
Here's in Cassandra-cli what I'm doing :
create keyspace my_keyspace;
use my_keyspace;
create column family mq with comparator=UTF8Type and key_validation_class=UTF8Type;
%% Adding to user_id (00000001) the message "Hello World!"
set mq['00000001']['1336499385041308'] = 'Hello Wold';
Everything works great with Cassandra-cli
However, When I'm trying to insert from Erlang, I'm running into some issue :
1>rr(cassandra_types).
2>{ok, C}=thrift_client_util:new("localhost", 9160, cassandra_thrift,[{framed, true}]).
3>thrift_client:call(C, 'set_keyspace', ["peeem"]).
4>thrift_client:call(C,'insert',["00000001",
#columnPath{column_family="mq"},
#column{name="1336499385041308", value="Hello World!"},
1
]
).
Here's the error :
{error,{bad_args,insert,
["00000001",
#columnPath{column_family = "mq",super_column = undefined,
column = undefined},
#column{name = "1336499385041308",value = "Hello World!",
timestamp = undefined,ttl = undefined},1]}}}
Any help would be appreciated...
EDIT 1 :
I have found out that it should be (as it works for someone else) :
thrift_client:call(C,'insert', ["00000001", #columnParent{column_family="mq"}, #column{name="123456",value="Hello World!"}, 2]).
Here's the related error message :
** exception error: no match of right hand side value {{protocol,thrift_binary_protocol,
{binary_protocol,{transport,thrift_framed_transport,
{framed_transport,{transport,thrift_socket_transport,
{data,#Port<0.730>,infinity}},
[],[]}},
true,true}},
{error,closed}}
in function thrift_client:send_function_call/3 (src/thrift_client.erl, line 83)
in call from thrift_client:call/3 (src/thrift_client.erl, line 40)
Ok I have found out what was the issue, or issues to be correct...
Here's my code in order to connect and insert...
rr(cassandra_types).
{ok, C}=thrift_client_util:new("localhost", 9160, cassandra_thrift,[{framed, true}]).
{C1, _} = thrift_client:call(C, 'set_keyspace', ["my_keyspace"]).
thrift_client:call(C1,'insert', ["00000001", #columnParent{column_family="mq"}, #column{name="1234567",value="Hello World !", timestamp=0}, 2]).
In fact We should insert into the new thrift_client that 'set_keyspace' returns... apparently for every call done through thrift a new thrift_client is generated and should be used.
Further more, We should use columnParent instead of columnPath (not sure why yet, it just works). And timestamp in the #column is mandatory...
I hope this helps someone else.
I recommend checking out https://github.com/ostinelli/erlcassa instead of reinventing the Thrift-wrestling wheel.

Why is url not registered?(Drupal 6.x)

I'm using hook_menu to register new url so that accessing this url would return some data to ajax function. As title suggested, this url is not registered. How do I know that? I've tried typing this in address bar but, drupal, return main template only rather than the tests string that I created. I'm positive that my module is working for php issues error if I intentionally write wrong syntax. And, yes, I clear cache whenever I make changes. Here's the code -
function test_menu() {
$my_form['test'] = array(
'title' => 'Test address',
'page callback' => 'test',
'access arguments' => array('access content'),
'type' => MENU_CALLBACK,
);
return $my_form;
}
function test(){
$a= "testing";
return $a;
}
Drupal is returning the variable, but your code isn't exposing it. To see it, add the following line to the test() function before the return line:
drupal_set_message('Variable $a: ' . $a);
This will display the text and the variable value in the content area of the page, so that you know that Drupal is registering the path (and is running the test() function and can use its variables):
Variable $a: testing
If $a is an array, this will not display it's value, but only the type of the variable ('Array'). To see the elements of this array:
$a = array ('testing', 'element2', 'item3');
Use the PHP print_r() function to print an indented list of the array's elements. Enclose it in HTML pre tags to have the indentation line up nicely:
drupal_set_message('<pre>Array $a: ' . print_r($a). '</pre>');
This will output the array in this format:
Array
(
[0] => testing
[1] => element2
[2] => item3
)

Resources