I'm using this code to search user in ejabberd:
BareJid bareJid = JidCreate.bareFrom(_user_name + "#domain");
UserSearchManager sm = MainService.getUserSearchManager();
DomainBareJid sDomain = sm.getSearchServices().get(0);
Form form = sm.getSearchForm(sDomain).createAnswerForm();
form.setAnswer("user",_user_name);
ReportedData reportedData = sm.getSearchResults(form, sDomain);
but I got this error:
<iq from='vjud.mnyr' id='jeRII-100' to='admin#mnyr/rsrc' type='error' xml:lang='en'>
<query xmlns='jabber:iq:search'>
<x type='submit' xmlns='jabber:x:data'>
<field type='text-single' var='user'>
<value>1*</value>
</field>
</x>
</query>
<error code='500' type='wait'>
<internal-server-error xmlns='urn:ietf:params:xml:ns:xmpp-stanzas' />
<text xmlns='urn:ietf:params:xml:ns:xmpp-stanzas' xml:lang='en'>Module failed to handle the query
</text>
</error>
</iq>
and in the log:
Reason = {error,{{case_clause,undefined},[{io_lib_pretty,cind_rec,6,[{file,"io_lib_pretty.erl"},{line,813}]},{io_lib_pretty,cind_record,8,[{file,"io_lib_pretty.erl"},{line,765}]},{io_lib_pretty,cind_element,7,[{file,"io_lib_pretty.erl"},{line,849}]},{io_lib_pretty,cind_list,7,[{file,"io_lib_pretty.erl"},{line,819}]},{io_lib_pretty,cind_field,7,[{file,"io_lib_pretty.erl"},{line,795}]},{io_lib_pretty,cind_fields_tail,8,[{file,"io_lib_pretty.erl"},{line,779}]},{io_lib_pretty,cind_element,7,[{file,"io_lib_pretty.erl"},{line,849}]},{io_lib_pretty,cind_list,7,[{file,"io_lib_pretty.erl"},{line,819}]}]}}
Please help me. I'm using Ejabberd v18.0.6 on MacOS using XmppFramework and Smack v4.
I can reproduce the problem easily. It is a small bug, that I've now fixed in this commit:
https://github.com/processone/ejabberd/commit/1be21126342d503205798605725ba5ceef9de42b
Thanks for commenting it!
Related
can you please help me regarding close wizard.
i have created a wizard from xml when i add dates and click on xlsx button,
xlsx generated and wizard close it self. it works fine.
but when i click on pdf, pdf generate successfully but wizard remains open.
how can i close it.
here is my code of xml.
<record id="payment_invoice_wizard_form" model="ir.ui.view">
<field name="name">Invoice Payment Report</field>
<field name="model">invoice.payment_report</field>
<field name="arch" type="xml">
<form string="Invoice Payment Report">
<group>
<field name="start_date"/>
<field name="end_date"/>
<field name="status"/>
</group>
<!-- other fields -->
<footer>
<button name="print_pdf" string="Print" type="object" class="btn-primary"/>
<button name="print_xls" string="Print in XLS" type="object" class="btn-primary"/>
<button string="Cancel" class="btn-default" special="cancel" />
</footer>
</form>
</field>
</record>
on py side i am getting all necessary data and returning this function
#api.multi
def print_pdf(self):
#mycode
return self.env.ref('customer_products.pdf_products').report_action(self)
When Odoo launch the download action of a report it will check if close_on_report_download action attribute is set to true, if so it will return action of type ir.actions.act_window_close which will close the wizard.
#api.multi
def print_pdf(self):
action = self.env.ref('customer_products.pdf_products').report_action(self)
action.update({'close_on_report_download': True})
return action
Edit:
You can implement the same logic, override QWEBActionManager and check if the option is passed through the action definition and if yes close the window.
var ActionManager = require('web.ActionManager');
var session = require('web.session');
ActionManager.include({
ir_actions_report: function (action, options) {
var self = this;
return $.when(this._super.apply(this, arguments), session.is_bound).then(function() {
if (action && action.report_type === 'qweb-pdf' && action.close_on_report_download) {
return self.do_action({ type: 'ir.actions.act_window_close' });
}
});
},
});
In my first outing with csom and the document library, I encountered a difficult error when attempting to access a document library object property as file.File.Title using the following code.
The error is
Object reference not set to an instance of an object on server.
The code shown is what "works" for my exercise.
What step am I missing to be able to use file.File.Title instead of file.FieldValues["Title"].
The code snippet is a very primitive attempt to get a list of files in the default Document library folder. In a following iteration, I need to update the caml to retrieve a specific file.
var lib = ctx.Web.DefaultDocumentLibrary();
ctx.Load(lib);
ctx.ExecuteQuery();
var files = lib.GetItems(CreateAllFilesQuery());
ctx.Load(files);
ctx.Load(files, items => items.Include( item => item.File.Title ));
ctx.ExecuteQuery();
foreach(var file in files )
{
if(!(file.FieldValues["Title"] == null) )
{
string FileName = file.FieldValues["Title"].ToString();
if (FileName == DocumentName)
return true;
}
}
public static CamlQuery CreateAllFilesQuery()
{
var qry = new CamlQuery();
qry.ViewXml = #"<View Scope=\'FilesOnly\'>
<Query></Query>
<ViewFields>
<FieldRef Name='Title' />
<FieldRef Name='ContentType' />
<FieldRef Name='DocIcon' />
</ViewFields>
</View>";
return qry;
}
After further research, I discovered that my caml query was at fault. The syntax error was placing slashes around the Scope value. The corrected query allows me to reference file.File.Title as expected. The additional benefit is that I am only getting back files rather than files and folders.
qry.ViewXml = #"<View Scope='FilesOnly'>
<Query></Query>
<ViewFields>
<FieldRef Name='Title' />
<FieldRef Name='ContentType' />
<FieldRef Name='DocIcon' />
</ViewFields>
</View>";
I am new to caml query and have been struggling for this.
I need the last modified List Item. Only one Item.
That means it should be orderby 'modified' and rowlimit should be 1.
But only rowlimit part of my query is working. Not the orderby part.
This is my Query :
var camlQuery = new SP.CamlQuery();
camlQuery.set_viewXml('<View><Query><OrderBy><FieldRef Name=\'Modified\' Ascending="FALSE"/></OrderBy><RowLimit>1</RowLimit></Query></View>";')
I dont know where I am going wrong.
I even tried removing the Query tags in the above mentioned query.
The query is working, its getting only one record. orderby isnt working i believe.
This is in jQuery. I have written in a function and am calling that function in my Ready function.
Please help me.
Thanks.
In fact, in your example the query returns all results since query contains some errors.
The line:
camlQuery.set_viewXml('<View><Query><OrderBy><FieldRef Name=\'Modified\' Ascending="FALSE"/></OrderBy><RowLimit>1</RowLimit></Query></View>";')
should be replaced with:
camlQuery.set_viewXml('<View><Query><OrderBy><FieldRef Name="Modified" Ascending="FALSE"/></OrderBy></Query><RowLimit>1</RowLimit></View>');
Example: how to get the last item
function getLastItem(listTitle,Success,Error){
var ctx = SP.ClientContext.get_current();
var web = ctx.get_web();
var list = web.get_lists().getByTitle(listTitle);
var query = new SP.CamlQuery();
query.set_viewXml('<View><Query><OrderBy><FieldRef Name="Modified" Ascending="FALSE"/></OrderBy></Query><RowLimit>1</RowLimit></View>');
var items = list.getItems(query);
ctx.load(items);
ctx.executeQueryAsync(
function() {
if(items.get_count() > 0) {
var item = items.getItemAtIndex(0);
Success(item);
}
else
{
Success(null);
}
},
Error
);
}
getLastItem('Contacts',function(item){
console.log(item.get_item('Modified'));
},function(sender,args){
console.log(args.get_message());
});
Rowlimit must be put outside the query. Actually I'm using SharepointPlus (a JavaScript API to deal with Sharepoint) that creates automatically the query for me :-)
So the XML code sent to the server should look like this:
<GetListItems xmlns="http://schemas.microsoft.com/sharepoint/soap/">
<listName>Your list</listName>
<viewName></viewName>
<query>
<Query>
<OrderBy>
<FieldRef Name="Status" Ascending="false"></FieldRef>
</OrderBy>
</Query>
</query>
<rowLimit>1</rowLimit>
<viewFields>
<ViewFields Properties="True">
<FieldRef Name="ID"></FieldRef>
</ViewFields>
</viewFields>
<queryOptions>
<QueryOptions>
<DateInUtc>False</DateInUtc>
<Paging ListItemCollectionPositionNext=""></Paging>
<IncludeAttachmentUrls>True</IncludeAttachmentUrls>
<IncludeMandatoryColumns>False</IncludeMandatoryColumns>
<ExpandUserField>False</ExpandUserField>
<ViewAttributes Scope="Recursive"></ViewAttributes>
</QueryOptions>
</queryOptions>
</GetListItems>
Here there is a full sample, Ascending='True' or Ascending='False' it's case sensitive
<View>
<Query>
<Where>
<Eq>
<FieldRef Name='OrderNum' />
<Value Type='Number'>90696</Value>
</Eq>
</Where>
<OrderBy>
<FieldRef Name='Modified' Ascending='False'/>
</OrderBy>
</Query>
<ViewFields>
<FieldRef Name='Title' />
<FieldRef Name='ID' />
</ViewFields>
<RowLimit>10</RowLimit>
Sharepoint tips
AymKdn is correct, the OrderBy clause should be outside of the Query clause in your Caml. Here's an example:
caml.set_viewXml('<View><OrderBy><FieldRef Name="Modified" Ascending="False"/></OrderBy><RowLimit>1</RowLimit></View>');
The Query clause is used for filtering (Where clause).
Problem: Trying out a simple demo for a custom tabgroup in Titanium Alloy. However, the compiler keeps failing with the message Could not find module: common. What I thought would be a straightforward test is anything but.
Titanium SDK: 3.1.3.GA
OS: iOS 7.x
controllers/index.js
var common = require('common');
function tabGroupClicked(e) {
common.tabGroupClicked(e);
}
Alloy.Globals.parent = $;
Alloy.Globals.tabGroup = $.tabGroup;
Alloy.Globals.selectedTab = $.tab1;
$.index.open();
controllers/common.js
exports.tabGroupClicked = function(e){
if (Alloy.Globals.selectedTab !== e.source){
// reset the selected tab
Alloy.Globals.previousTab = Alloy.Globals.selectedTab;
Alloy.Globals.selectedTab = e.source;
// change the selected flag
Alloy.Globals.previousTab.selected = false;
Alloy.Globals.selectedTab.selected = true;
// change the background image
Alloy.Globals.previousTab.backgroundImage = Alloy.Globals.previousTab.disabledImage;
Alloy.Globals.selectedTab.backgroundImage = Alloy.Globals.selectedTab.selectedImage;
// swapping the zindexes of the childTabs
Alloy.Globals.parent.getView(Alloy.Globals.previousTab.childTab).getView().zIndex=2;
Alloy.Globals.parent.getView(Alloy.Globals.selectedTab.childTab).getView().zIndex=3;
}
};
index.xml
<Alloy>
<Window id="index" class="container">
<View id="tabGroupWindow" zIndex="0" class="container">
<Require src="tabThreeView" id="tabThreeView"/>
<Require src="tabTwoView" id="tabTwoView"/>
<Require src="tabOneView" id="tabOneView" />
</View>
<!-- Custom tab group -->
<View id="tabGroup">
<View id="tab1" onClick="tabGroupClicked"></View>
<View id="tab2" onClick="tabGroupClicked"></View>
<View id="tab3" onClick="tabGroupClicked"></View>
</View>
</Window>
</Alloy>
Can anyone see anything that I'm obviously overlooking? I've cleaned the project, restarted Studio, scoured forums for any reference to this issue. Not finding a reference usually means I forgot some basic detail.
Your help is appreciated.
To use the require function, you have to create a service.
So the common.js module as you nammed it, has to be under this folder : app/lib. If it's not in the lib folder, it will not be recognized, and it will not be required.
You can find more help in this page.
I have a datbase column containing xml and I want to index using apache solr content in that column i have following data-config.xml (configuration). The database name is "solrdb" and columns name is "xmlfield", There seems to be some problem in it, the error is specified at the bottom.
<dataConfig>
<!--Data source to connect to database-->
<dataSource
name="XmlDocDS"
type="JdbcDataSource"
driver="com.mysql.jdbc.Driver"
url="jdbc:mysql://127.0.0.1/solrdb"
user="root"
password="root" />
<!-- Data Source for getting xml columne data-->
<dataSource
name="solrFieldReaderDS"
type="FieldReaderDataSource"/>
<document>
<entity
name="xmltable"
rootEntity="false"
datasource="XmlDocDS"
query="select xmlfield from xmltable">
<field column="xmldata" blob="true" />
<entity
name="page"
dataSource="solrFieldReaderDS"
dataField="xmltable.xmldata"
processor="XPathEntityProcessor"
forEach="/page">
<field column="id" xpath="/mediawiki/page/id"/>
<field column="Title" xpath="/mediawiki/page/title"/>
</entity>
</entity>
</document>
</dataConfig>
The error is following:
SEVERE: Exception while processing: xmltable document : null:org.apache.solr.handler.dataimport.DataImportHandlerException: Unable to execute query: select xmlfield from xmltable Processing Document # 1
The error is thrown in this part of JDBC importer code:
try {
Connection c = getConnection();
stmt = c.createStatement(ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_READ_ONLY);
stmt.setFetchSize(batchSize);
stmt.setMaxRows(maxRows);
LOG.debug("Executing SQL: " + query);
long start = System.currentTimeMillis();
if (stmt.execute(query)) {
resultSet = stmt.getResultSet();
}
LOG.trace("Time taken for sql :"
+ (System.currentTimeMillis() - start));
colNames = readFieldNames(resultSet.getMetaData());
} catch (Exception e) {
wrapAndThrow(SEVERE, e, "Unable to execute query: " + query);
}
So there can be error in connection or query (smth wrong with DB?). Also grep logs for "Executing SQL" and "Time taken for sql :"
there was an error in connection, for some reason it was nto able to connect to my local machine, i changed the database host and it connected!, the problem is that I have the configuration in place and FieldReaderDataSource seems to work fine, but now when it completes everything it says documents indexed/updated = 0
here is my xml configuration
<dataSource
name="jdbcDataSource"
driver="com.mysql.jdbc.Driver"
url="xxxx"
user="yyyy"
password="zzzz" readOnly="true"/>
<dataSource
name="solrFieldReaderDS"
type="FieldReaderDataSource"/>
<document>
<entity
name="tabledata"
dataSource="jdbcDataSource"
query="select codeID,codeText from ArticlePoolState where codeID=3">
<entity
name="xmldata"
dataSource="solrFieldReaderDS"
forEach="/med"
dataField="tabledata.codeText"
processor="XPathEntityProcessor">
<field column="title" xpath="/title"/>
</entity>
</entity>
</document>
The query is fine.