citeproc-java: CLSType PAPER_CONFERENCE ending up in an empty body - bibliography

I am feeling the CSLItemData item and then calling CSL.makeAdhocBibliography.
When the type of item is BOOK I get an apropriate body back. However when the item type is PAPER_CONFERENCE the body is empty. Is there anything I have to consider?
As an experiment while debugging I changed the type from PAPER_CONFERENCE to BOOK and I got a body back shwoing the title of my conference paper.

Related

Why do I fail to submit data to textarea with python requests.post()

I want to use the requests.post tool to automatically query domain name attribution on this websitea website,But the return value is always empty, I guess it is because the post method failed to transfer the data to the textarea
url = 'http://icp.chinaz.com/searchs'
data = {
'hosts':'qq.com',
'btn_search':'%E6%9F%A5%E8%AF%A2', '__RequestVerificationToken=':'CfDJ8KmGV0zny1FLtrcRZkGCczG2owvCRigVmimqp33mw5t861kI7zU2VfQBri65hIwu_4VXbmtqImMmTeZzqxE7NwwvAtwWcZSMnk6UDuzP3Ymzh9YrHPJkj_cy8vSLXvUYXrFO0HnCb0pSweHIL9pkReY',
}
requests.post(url=url,data=data,headers=headers).content.decode('utf-8')
I'd be very grateful if you could point out where I'm going wrong
I have tried to replace headers and so on.

PubNub message format in callbacks

When I get a callback, I get an object passed in. The content of the object seems to have two levels of 'encoding'. It always seems to consist of 3 basic elements:
My data
Timestamp
Channel
in that order so [0]=data, [1] = timestamp and [2] = channel where timestamp and channel are PubNub supplied strings. My data comes in as a JSON object (string, numeric, or object etc.) in the first item returned.
But nowhere can I find in the documentation that this structure (i.e. 3 incoming 'objects') is actually defined. If it is defined then I should be able to map a type or class to it, to better handle it, i.e. cast it to a 'PubNubMessage' class [object data; string timestamp; string channel;]?
Can someone please point me at a document where this message format is actually defined?

How to assign a value to an Orchard ContentPickerField from code?

I am working on an Orchard site that needs to be able to use some customized forms to create new content items.
To handle this I'm using a controller to display a form and then trying to create the new content items on post back by populating the dynamic items and then sending them through the ContentManagerService's Create() function.
This is working ok until I got to the content picker field I have as part of my content item.
In my project I have a content type of Question Record that has a SubmittedBy field that is a Content Picker Field.
Here is what I can see in the immediate window while processing the post back:
> dynamic q = _questionService.NewQuestion("Why doesn't this work?");
{Custom.Website.Models.Question}
base {Orchard.ContentManagement.ContentPart}: {Custom.Website.Models.Question}
IsNew: true
OriginalQuestion: "Why doesn't this work?"
Summary: null
> q.QuestionRecord
{Orchard.ContentManagement.ContentPart}
base {System.Dynamic.DynamicObject}: {Orchard.ContentManagement.ContentPart}
ContentItem: {Orchard.ContentManagement.ContentItem}
Fields: Count = 5
Id: 0
PartDefinition: {Orchard.ContentManagement.MetaData.Models.ContentPartDefinition}
Settings: Count = 0
TypeDefinition: {Orchard.ContentManagement.MetaData.Models.ContentTypeDefinition}
TypePartDefinition: {Orchard.ContentManagement.MetaData.Models.ContentTypePartDefinition}
Zones: {Orchard.UI.ZoneCollection}
> q.QuestionRecord.SubmittedBy
{Orchard.ContentPicker.Fields.ContentPickerField}
base {Orchard.ContentManagement.ContentField}: {Orchard.ContentPicker.Fields.ContentPickerField}
ContentItems: null
Ids: {int[0]}
The ContentItems property is read-only and the Ids when assigning a new int[] to the Ids array I get a System.ObjectDisposedException with the message: Instances cannot be resolved and nested lifetimes cannot be created from this LifetimeScope as it has already been disposed.
Are there any workarounds to get this value set in code or do I need to create my own property to store the related content item ids? It would be very helpful to have the admin interface of the ContentPickerField also available.
Thanks.
If you have a reference to the ContentPickerField, you can assign it a value using the Ids property.
In example (assuming your content type has a part called Question which has a field called SubmittedBy):
var submittedByField = ((dynamic)q.ContentItem).Question.SubmittedBy;
sbmittedByField.Ids = new[] { submittedById };
As Bertrand mentioned, the format to access a content field is: contentItem.PartName.FieldName.
If you attached a field to a type directly via the admin, the part name has the same name as the type name, hence contentItem.TypeName.FieldName (where TypeName is actually the name of the implicitly created part).

How to check is the MediaStore.Audio.Media.ARTIST field empty?

I have been working on a MediaPlayer app, where I use the MediaStore.Audio.Media to get all the songs on the SD card and their title, album, artist, etc. tags. I have a custom adapter where I want to check if the Artist field is empty, so I could set "Artist unknown" for that field. The adapter and the cursor I use are in my opinion irrelevant to this question so I'm not going to paste any code here, since this problem occurs outside the adapter as well.
Here is the problem: when an mp3 song doesn't have an artist tag, the cursor for the artist field (the MediaStore.Audio.Media.ARTIST field) returns "". I have no idea what kind of data type that is (it should be String) because whenever I compare it to a String with the value "", the comparison is false. Even if I assign the return value of that field to a temporary String, and than compare that with the before mentioned "", I still get false. I even tried null, "unknown", "", nothing works.
I've really hit a dead end here and any kind of help would be greatly appreciated.
Thank you in advance, Ivan.
I'm using the very same field (MediaStore.Audio.Media.ARTIST), but what I noticed is different.
When you try to retrieve the song's artist info and currently ther's no info available, what you get is <unknown> string.
I wanted to change that info too and I just went for a:
String artist = (((cursor.getString(cursor.getColumnIndex(MediaStore.Audio.Media.ARTIST)) == null)
|| cursor.getString(cursor.getColumnIndex(MediaStore.Audio.Media.ARTIST)).equals("")
|| cursor.getString(cursor.getColumnIndex(MediaStore.Audio.Media.ARTIST)).equals("<unknown>")) ?
"Artist Unknown" : cursor.getString(cursor.getColumnIndex(MediaStore.Audio.Media.ARTIST)));
the "null and equals.("")" checks should be useless anyway.

:: how to parse KSOAP ARRAYTPE response ::

I need some help in understanding how to parse the KSOAP RESPONSE in j2me.
below is the actual ksoap response i get after making a ksoap request.
<AddressArray>
<AddressBin>
<UserSeqID>200</UserSeqID>
<AddressID>115</AddressID>
<ZipCode>10005</ZipCode>
<IsPrimary>false</IsPrimary>
<State>New York</State>
<StateID>37</StateID>
<StateCode>NY</StateCode>
<City>New York Mills village</City>
<CityID>11701</CityID>
<StreetAddress>90 feet rd</StreetAddress>
<NickName>Gym</NickName>
</AddressBin>
<AddressBin>
<UserSeqID>200</UserSeqID>
<AddressID>110</AddressID>
<ZipCode>10002</ZipCode>
<IsPrimary>false</IsPrimary>
<State>New York</State>
<StateID>37</StateID>
<StateCode>NY</StateCode>
<City>New York city</City>
<CityID>11700</CityID>
<StreetAddress>5th Street</StreetAddress>
<NickName>Home</NickName>
</AddressBin>
<AddressBin>
<UserSeqID>200</UserSeqID>
<AddressID>114</AddressID>
<ZipCode>10002</ZipCode>
<IsPrimary>true</IsPrimary>
<State>New York</State>
<StateID>37</StateID>
<StateCode>NY</StateCode>
<City>New York city</City>
<CityID>11700</CityID>
<StreetAddress>4th Street</StreetAddress>
<NickName>Office</NickName>
</AddressBin>
</AddressArray>
here is the ksoap response template
<AddressArray>
<AddressBin>
<UserSeqID>int</UserSeqID>
<AddressID>int</AddressID>
<ZipCode>string</ZipCode>
<IsPrimary>boolean</IsPrimary>
<State>string</State>
<StateID>int</StateID>
<StateCode>string</StateCode>
<City>string</City>
<CityID>int</CityID>
<StreetAddress>string</StreetAddress>
<NickName>string</NickName>
</AddressBin>
<AddressBin>
<UserSeqID>int</UserSeqID>
<AddressID>int</AddressID>
<ZipCode>string</ZipCode>
<IsPrimary>boolean</IsPrimary>
<State>string</State>
<StateID>int</StateID>
<StateCode>string</StateCode>
<City>string</City>
<CityID>int</CityID>
<StreetAddress>string</StreetAddress>
<NickName>string</NickName>
</AddressBin>
</AddressArray>
please let me know how should i map the soap xml respone to custom java classes ?
I don't know how it works in J2ME, but what I did with Android was to run a loop the size of the PropertyCount(which in your case would be the PropertyCount of AddressArray) of the SOAP response, access every individual property of that (your case AddressBin) while in the loop, and then again access every property of that property (your case UserSeqID, AddressID, etc.), put them into a String, parse those to the desired variables and put those variables in a model and put those models in an array.
If you want them to be automatically serialized I can't help you with that because I don't know how that works.
Hope this helps.

Resources