I do try to build a factur-x using Mustang library.
For minimum profile, a Buyer legal registration identifier is required.
For this I build a trade party object:
TradeParty recipient = new TradeParty(
"My Client",
"My address",
"06000",
"City",
"FR")
.setID("123 456 789 10111");
My issue is the following:
I'm able to build an XML (that's what I want)
I'm not able to set the organization ID and pass the schemeID to 0002 (for french factur-X).
I didn't find how to set
Here is what is expected:
<ram:SpecifiedLegalOrganization>
<ram:ID schemeID="0002">123 456 789 10111</ram:ID>
</ram:SpecifiedLegalOrganization>
I do also have to set the business process type, which is specific for Chorus Pro (in france):
<ram:BusinessProcessSpecifiedDocumentContextParameter>
<ram:ID>A1</ram:ID>
</ram:BusinessProcessSpecifiedDocumentContextParameter>
Here, A1 means invoice deposit, A2 means prepaid invoice deposit, ... By default (in the absence of this field), the case A1 is applied.
The output for recipient :
<ram:BuyerTradeParty>
<ram:ID>123 456 789 10111</ram:ID>
<ram:Name>My Client</ram:Name>
<ram:PostalTradeAddress>
<ram:PostcodeCode>06000</ram:PostcodeCode>
<ram:LineOne>My address</ram:LineOne>
<ram:CityName>City</ram:CityName>
<ram:CountryID>FR</ram:CountryID>
</ram:PostalTradeAddress>
</ram:BuyerTradeParty>
SpecifiedLegalOrganisation/ID has been added to Mustang 2.5 https://www.mustangproject.org/mustang-2-5-0/, please report an issue via https://github.com/ZUGFeRD/mustangproject/issues if there are further requirements vis á vis Chorus Pro I am not aware of.
as you indicated (and as described in the english FX spec 1.05 e.g. on page 115 as well as in the technical annex to ZUGFeRD with a cardinality 0..1) BT-23, i.e. ram:BusinessProcessSpecifiedDocumentContextParameter is optional so you can just omit it unless you need other values. Do you require to set anything nonstandard here?
However, so far nobody ever requested being able to set the legalorganisation +ID and scheme ID, which means that probably nobody ever used Mustang so far to write invoices vis á vis the french authorities (only to german ones or for factur-x B2B invoices).
However, I just added the possibility, you can now use someTradeParty.setLegalOrganisation(new LegalOrganisation("0815", "0002")). This will become part of the next release, could you please confirm that this works and is all you need?
I am new to the world of ML and data mining and looking for the help and guidance to find unusual behavior on my log file.
Assuming I have a cvs file which logs users sessions start time and end time and the policy numbers that they have worked on similar to below.
Start_date, username, end_date, Policy_numbers
2018-01-02 10:01, user1, 2018-01-02 10:10, PO-123
2018-01-02 10:05, user2, 2018-01-02 10:20, PO-456
2018-01-02 10:11, user1, 2018-01-02 10:45, PO-789 | PO-999 (| is delimiter here)
Is there any Python or java library/module/code or open-source application to identify patterns such as : Most users logged in during 10 AM to 5 PM , Average number of sessions per days in a month, Average length of session and … ,
I expect application recognize various of patterns and suggest it to me in a list or way that I can pick those one which matters to business.
(If I recognize the pattern then I can find the answers by some queries and no need for pattern recognition- that would be an easy job to do)
Then is there a way to train the system by these recognized patterns to find unusual behaviors such as : find users who logged in after 5:00 PM , find sessions took way longer than average and ...
Thanks for any thought.
Using FQL, by means of which finds events that contain a given word. FQL works only in API version <2.1. By which I use the Graph API Explorer to display events. Eg.
search?q=york&type=event
Example of FQL
SELECT Eid, name, location, start_time, description, pic_small, creator, event venue FROM WHERE start_time> "Sun Jun 21 0:00:35 GMT 2015" AND (CONTAINS ("york")
I would like to make a search events by using RestFB not using FQL, but do not know how. The documentation is scarce.
I answered this already on github, but perhaps someone else find this useful.
Your special case is not in the documentation, but you can transfer the knowledge you find in the documentation and solve your problem: http://restfb.com/#searching
Connection<Event> eventList =
facebookClient.fetchConnection("search", Event.class,
Parameter.with("q", "york"), Parameter.with("type", "event"));
Now, you can iterate over the eventList.
Here you can find how this can be done: http://restfb.com/#fetching-connections
I have data in a database in the format below:
a:19:{s:9:"raceclass";a:5:{i:0;a:1:{i:0;s:7:"250cc B";}i:1;a:1:{i:1;s:6:"OPEN B";}i:2;a:1:{i:2;s:9:"Plus 25 B";}i:3;a:1:{i:3;s:8:"Vet 30 B";}i:4;a:1:{i:4;s:7:"Vintage";}}s:9:"firstname";a:1:{i:0;a:1:{i:0;s:5:"James";}}s:12:"middle_FIELD";a:1:{i:0;a:1:{i:0;s:1:"R";}}s:8:"lastname";a:1:{i:0;a:1:{i:0;s:9:"Slaughter";}}s:5:"email";a:1:{i:0;a:1:{i:0;s:29:"jslaughter#xtrememxseries.com";}}s:8:"address1";a:1:{i:0;a:1:{i:0;s:18:"21 DiMartino Court";}}s:4:"city";a:1:{i:0;a:1:{i:0;s:6:"Walden";}}s:5:"state";a:1:{i:0;a:1:{i:0;s:8:"New York";}}s:3:"zip";a:1:{i:0;a:1:{i:0;s:5:"12586";}}s:7:"country";a:1:{i:0;a:1:{i:0;s:13:"United States";}}s:6:"gender";a:1:{i:0;a:1:{i:0;s:4:"Male";}}s:3:"dob";a:1:{i:0;a:1:{i:0;s:10:"06/04/1974";}}s:5:"phone";a:1:{i:0;a:1:{i:0;s:12:"845-713-4421";}}s:5:"skill";a:1:{i:0;a:1:{i:0;s:12:" AMATEUR (B)";}}s:11:"ridernumber";a:1:{i:0;a:1:{i:0;s:2:"69";}}s:8:"bikemake";a:1:{i:0;a:1:{i:0;s:3:"HON";}}s:8:"enginecc";a:1:{i:0;a:1:{i:0;s:3:"450";}}s:9:"amanumber";a:1:{i:0;a:1:{i:0;s:7:"1094649";}}s:10:"amaexpdate";a:1:{i:0;a:1:{i:0;s:5:"03/12";}}}
How can I write a regular expression to manipulate the above string to get data in the following format?:
raceclass - 250cc B, OPEN B, Plus 25 B, Vet30, Vintage
firstname - James
middle_FIELD - R
address1 = 21 DiMartino Court
city - walden
state - New york
zip - 12586
country - United States
gender - Male
dob - 06/04/1974
phone - 845-713-4421
skill - AMATEUR (B)
ridernumber - 69
bikemake - HON
enginecc - 450
amanumber - 1094649
amaexpdate - 03/12
This data isn't suitable for a regular expression. You should use a proper parser with a proper grammar for handling this string. There are several good options for that in Java, such as ANTLR.
Alternatively, if that is not an option it looks like you only want to handle things between "". Take a look at the java class Scanner. You should be able to get something working with that. Just look through the string and look for a ". If found start to gather text into a buffer. Once you have found another " ignore tokens until you have found the next " or the end of the input text.
I have a complex json written in a string. I know java and a little of mysql. I need to make a database out of the json.
I'm using some twitter data so the tweets contain the description of the user who tweeted it and in case it's been retweeted, it contains the description of the user who tweeted it before this user.
My objective is to create a user table ( or array or any other data structure ) which contains all the tweets this user tweeted, and all his tweets which have been retweeted.
The tweet object contains around 50-80 objects so giving an example here will make this post really long.
Example
StatusJSONImpl{createdAt=Wed Sep 28 12:04:55 IST 2011, id=118936707830775808, text='RT #nytimesbits: Google's Biggest Threat Is Google http://t.co/kTNqJFJC', source='web', isTruncated=false, inReplyToStatusId=-1, inReplyToUserId=-1, isFavorited=false, inReplyToScreenName='null', geoLocation=null, place=null, retweetCount=6, wasRetweetedByMe=false, contributors=null, annotations=null, retweetedStatus=StatusJSONImpl{createdAt=Wed Sep 28 05:35:26 IST 2011, id=118838689248985088, text='Google's Biggest Threat Is Google http://t.co/kTNqJFJC', source='The New York Times', isTruncated=false, inReplyToStatusId=-1, inReplyToUserId=-1, isFavorited=false, inReplyToScreenName='null', geoLocation=null, place=null, retweetCount=6, wasRetweetedByMe=false, contributors=null, annotations=null, retweetedStatus=null, userMentionEntities=[], urlEntities=[URLEntityJSONImpl{start=34, end=54, url=http://t.co/kTNqJFJC, expandedURL=http://nyti.ms/pR9DfX, displayURL=nyti.ms/pR9DfX}], hashtagEntities=[], user=UserJSONImpl{id=14434070, name='NYTimes Bits Blog', screenName='nytimesbits', location='The Cloud', description='News and analysis on tech and business. Also here: select retweets from NYT tech writers and friends. Account maintained by David F. Gallagher (#davidfg).', isContributorsEnabled=true, profileImageUrl='http://a1.twimg.com/profile_images/108833947/bits75_normal.jpg', profileImageUrlHttps='https://si0.twimg.com/profile_images/108833947/bits75_normal.jpg', url='http://nytimes.com/bits', isProtected=false, followersCount=53180, status=null, profileBackgroundColor='9ae4e8', profileTextColor='000000', profileLinkColor='0000ff', profileSidebarFillColor='e0ff92', profileSidebarBorderColor='87bc44', profileUseBackgroundImage=true, showAllInlineMedia=false, friendsCount=139, createdAt=Fri Apr 18 20:49:26 IST 2008, favouritesCount=5, utcOffset=-18000, timeZone='Eastern Time (US & Canada)', profileBackgroundImageUrl='http://a3.twimg.com/profile_background_images/4780380/twitter_post.png', profileBackgroundImageUrlHttps='https://si0.twimg.com/profile_background_images/4780380/twitter_post.png', profileBackgroundTiled=true, lang='en', statusesCount=6360, isGeoEnabled=false, isVerified=true, translator=false, listedCount=4671, isFollowRequestSent=false}}, userMentionEntities=[UserMentionEntityJSONImpl{start=3, end=15, name='NYTimes Bits Blog', screenName='nytimesbits', id=14434070}], urlEntities=[URLEntityJSONImpl{start=51, end=71, url=http://t.co/kTNqJFJC, expandedURL=http://nyti.ms/pR9DfX, displayURL=nyti.ms/pR9DfX}], hashtagEntities=[], user=UserJSONImpl{id=17989546, name='Wolfgang Fasching-K.', screenName='wwwof', location='Vienna', description='Digital ist besser. Fokus: IT & Internet, World News & US Politik, Medien & Pop/Kultur. http://www.riverone.at', isContributorsEnabled=false, profileImageUrl='http://a0.twimg.com/profile_images/67758989/SF050069-w_normal.JPG', profileImageUrlHttps='https://si0.twimg.com/profile_images/67758989/SF050069-w_normal.JPG', url='null', isProtected=false, followersCount=59, status=null, profileBackgroundColor='C0DEED', profileTextColor='333333', profileLinkColor='0084B4', profileSidebarFillColor='DDEEF6', profileSidebarBorderColor='C0DEED', profileUseBackgroundImage=true, showAllInlineMedia=false, friendsCount=64, createdAt=Tue Dec 09 17:09:35 IST 2008, favouritesCount=0, utcOffset=3600, timeZone='Vienna', profileBackgroundImageUrl='http://a3.twimg.com/profile_background_images/234523169/Naschmarkt-Wien-Juni10-2010-s.jpg', profileBackgroundImageUrlHttps='https://si0.twimg.com/profile_background_images/234523169/Naschmarkt-Wien-Juni10-2010-s.jpg', profileBackgroundTiled=true, lang='en', statusesCount=269, isGeoEnabled=false, isVerified=false, translator=false, listedCount=4, isFollowRequestSent=false}}
For JSON parsing, I recommend Jackson. Also, in order to validate your input, you should have a look at JSON Schema (for which I have an implementation if you want).
Here is how to parse a JSON in a string using Jackson:
final ObjectMapper mapper = new ObjectMapper();
final JsonNode node = mapper.readTree(yourInput);
// Access members:
node.get(0); // access node 0 of an array
for (final JsonNode entry: node) {
... // cycle through array nodes
}
node.get("foo"); // access property "foo" of an object
node.get("foo").getTextValue(); // access as a text
// etc etc
It also has a s*load of options to serialize to POJOs if that's what you want.
Your first step will be to parse the JSON to get an object graph, using a library like gson or any of several others.
Then (and this seems really general, but it's a pretty open question) it's a matter of determining what the schema should be, creating the tables, and looping through the object graph populating them.
You might look at "document databases" (so-called NoSQL) rather than SQL ones if you're allowed to, as they usually allow the schema to be more fluid.
If your problem is just with Twitter, you can look for dedicated APIs like Twiiter4J or Spring Social, that should provides ready java beans for tweets.
If you're realizing a small project Gson is the best solution for parsing. But if your making something more sophisticated, I suggest you to use Jackson for parsing and Hibernate as a middleware between application and sql database.