I have an object structure with 3 objects. location > lochierarchy > customtable.
On the original source xml -erdata, I get only details for location object. I have derived the information for lochierarchy and the customtable.
If I have at least one column value for lochierarchy and customtable, I am able to use the following code and fill up the derived values.
xml
<LOCATIONS>
<location>1000</location>
<siteid>xyg</siteid>
<LOCHIERARCHY>
<SYSTEMID>abdc</SYSTEMID>
<PARENT></PARENT>
<CUSTOMTABLE>
<DEPT>MECHANICAL</DEPT>
<OWNER></OWNER>
</CUSTOMTABLE>
</LOCHIERARCHY>
List locHierarchyList =irData.getChildrenData("LOCHIERARCHY");
int locHrSize=locHierarchyList.size();
for (int i=0;i<locHrSize;i++)
{
irData.setAsCurrent(locHierarchyList,i);
irData.setCurrentData("PARENT","xyyyyg");
List customTablerList =irData.getChildrenData("CUSTOMTABLE");
int custSize=customTablerList .size();
for (int i=0;i<custSize;i++)
{
//set values
}
But I am getting the source xml with only the location data below and I'm trying to build the children data. I am missing something here.
Incoming XML
<LOCATIONS>
<location>1000</location>
<siteid>xyg</siteid>
</LOCATIONS>
My Code
irData.createChildrenData("LOCHIERARCHY");
irData.setAsCurrent();
irData.setCurrentData("SYSTEMID", SYSTEM);
irData.setCurrentData("PARENT", parentLoc);
irData.createChildrenData("CUSTOMTABLE");
irData.setAsCurrent();
but this is not working. Can anyone help me out?
got it, just had to use another method of createChildrenData.
irData.createChildrenData("LOCHIERARCHY",true);
This one did the trick. It creates the child set and make it as current.
I am trying to create this URL link:
mysite.com/Vote/2/Learn-to-code
Where
area = vote,
id = 2,
topicURL = Learn-to-code
In my routing, I have this to handle this URL pattern:
context.MapRoute(
"Topic",
"Vote/{id}/{topicURL}",
new { controller = "Topic", action = "TopicAnswers" },
new[] { "eus.UI.Areas.Vote.Controllers"}
);
But I am having trouble generating the URL link. Here's my attempt:
#Html.ActionLink("ViewBag.TopicTitle", "TopicAnswers", new { area = "Vote", controller = "Topic", id = ViewBag.TopicId, topicURL = #ViewBag.TopicURL })
First question is: How do I use ViewBag.TopicTitle? If I remove the quotes, it gives red squiggly error. I put the quotes in just so I could run the app to see what URL this generates.
It generates a monster URL.
mysite.com/Vote/Topic/TopicAnswers/2?url=Learn-to-code
However, the URL actually works. But I would really like to create my short and clean looking URL.
mysite.com/Vote/2/Learn-to-code
Any tips greatly appreciated, gracias.
Ok, I did this and it works. This is so simple to read and understand.
#ViewBag.TopicTitle
Is there any good reason why I should attempt to use #Html.ActionLink(...). That just feels like spaghetti.
For starters, why do they place the parameters ("text", action, controller) in this order? That is such a twisty path. This is far more natural to think of:
(controller, action, "text") ... is it not?
I used below configuration for filtering my csv file but it is unable to filter.
I used static interceptor for filtering, do I need to use any other interceptor? Please suggest me what I need to write in below config file.
My csv file sample below.
Id,Name,First,Last,Display,Job,Department,OfficeNo,OfficePh,MobilePh,Fax,Address,City,State,ZIP,Country
1,chris#contoso.com,Chris,Green,Chris Green,IT Manager,Information Technology,123451,123-555-1211,123-555-6641,9821,1 Microsoft way,Redmond,Wa,98052,United States
2,ben#contoso.com,Ben,Andrews,Ben Andrews,IT Manager,Information Technology,123452,123-555-1212,123-555-6642,9822,1 Microsoft way,Redmond,Wa,98052,United States
3,david#contoso.com,David,Longmuir,David Longmuir,IT Manager,Information Technology,123453,123-555-1213,123-555-6643,9823,1 Microsoft way,Redmond,Wa,98052,United States
4,cynthia#contoso.com,Cynthia,Carey,Cynthia Carey,IT Manager,Information Technology,123454,123-555-1214,123-555-6644,9824,1 Microsoft way,Redmond,Wa,98052,United States
my flume-conf.properties file is listed below, and I am expecting output like (Id=1) go through ch1 and (Id=2) go through ch2 and other Id(3,4) go through default channel.
Please help me out doing it.
a1.sources=src1
a1.channels=ch1 ch2
a1.sinks=s1 s2
a1.sources.src1.type=exec
a1.sources.src1.command=tail -F /home/manish/TwitterExample /Import_User_Sample_en.csv
a1.channels.ch1.type=memory
a1.channels.ch1.capacity=10000
a1.channels.ch1.transactioncapacity=100
a1.channels.ch2.type = memory
a1.channels.ch2.capacity = 10000
a1.channels.ch2.transactioncapacity = 100
Static interceptor as follows
a1.sources.src1.interceptors=i1
a1.sources.src1.interceptors.i1.type=static
a1.sources.src1.interceptor.i1.key=Id
a1.sources.src1.interceptor.i1.value=1
a1.sources.src1.interceptor.i1.preserveExisting=false
a1.sources.src1.interceptor=i2
a1.sources.src1.interceptor.i2.type=static
a1.sources.src1.interceptor.i2.key=Id
a1.sources.src1.interceptor.i2.value=2
a1.sources.src1.interceptor.i2.preserveExisting=false
a1.sources.src1.fileHeader=true
a1.sources.src1.selector.type=multiplexing
a1.sources.src1.selector.header=Id
a1.sources.src1.selector.mapping.1=ch1
a1.sources.src1.selector.mapping.2 =ch2
a1.sources.src1.selector.default = ch2
a1.sinks.s1.type=hdfs
a1.sinks.s1.hdfs.path=hdfs://kdp.ambarikdp1.com:8020/user/data/twitter
a1.sinks.s1.hdfs.filetype=DataStream
a1.sinks.s1.hdfs.rollCount=0
a1.sinks.s1.hdfs.rollSize=0
a1.sinks.s1.hdfs.rollInterval=300
a1.sinks.s1.hdfs.serializer=HEADER_AND_TEXT
a1.sinks.s2.type = hdfs
a1.sinks.s2.hdfs.path = hdfs://kdp.ambarikdp1.com:8020/user/data/t2
a1.sinks.s2.hdfs.filetype = DataStream
a1.sinks.s2.hdfs.rollCount = 0
a1.sinks.s2.hdfs.rollSize = 0
a1.sinks.s2.hdfs.rollInterval = 300
a1.sinks.s2.hdfs.serializer=HEADER_AND_TEXT
a1.sources.src1.channels=ch1 ch2
a1.sinks.s1.channel=ch1
a1.sinks.s2.channel = ch2
At least, the way you are using multiple interceptors is wrong. Interceptors must be added as a list this way:
a1.sources.src1.interceptors = i1 i2
Then, you can configure each one of them:
a1.sources.src1.interceptors.i1.type = ...
a1.sources.src1.interceptors.i1.other = ...
...
a1.sources.src1.interceptors.i2.type = ...
a1.sources.src1.interceptors.i2.other = ...
...
Being said that, I think the static interceptor is not what you need, since AFAIK it always adds the same static header to all the events. I mean, all the events will have the same header name and value, independently of the "id" field.
Please, have a look on How to use regex_extractor selector and multiplexing interceptor together in flume?, i.e. using the Regex Extractor Interceptor instead.
I have a json string: {"jsonrpc":"2.0","result":[{"event":{"id":"27151641","name":"TSW Pegasus FC (Res) v Sun Hei SC (Res)","countryCode":"HK","timezone":"GMT","openDate":"2014-02-19T12:30:00.000Z"},"marketCount":14},{"event":{"id ":"27151646","name":"Humble Lions v Boys Town FC... etc etc
So the result bit is a list of event/marketcount pairs. I've used the parse method in a class module called jsonlib which I got from http://code.google.com/p/vba-json/issues/attachmentText?id=15&aid=150001000&name=jsonlib.cls&token=31ObtlGBtaGXd2KR0QLyffX_x8Y:1359742317106
This creates an object (jason_obj) which represents the result bit above. Now I want to get a list of ids for each event. I can use the for each ... construct to return each event/marketcount pair as an object, but I can't work out how to get to the id field that is somewhere in the event object. I tried to use the tostring method to get a clue, and from that this code should work but it doesn't:
For Each eventItem In jason_obj
this_eventx = eventItem("event")
this_id = this_eventx("id")
Next
Don't know much about accessing objects/collections. Can anyone help? Thanks
Objects need to be set and references should use item:
For Each eventItem In jason_obj
set this_eventx = eventItem.item("event")
this_id = this_eventx.item("id")
Next
HTH
Yes it did
I'm passing parameters to a server from a Flash Builder application. I want to search both for "teachers" and for "rooms". I can do this via an HTML page, as follows:
<input type="checkbox" name="searchFor" value="teachers" />teachers
<input type="checkbox" name="searchFor" value="rooms" />rooms
So there are two inputs, both named searchFor. When submitted, the request looks like this:
searchFor: teachers
searchFor: rooms
In other words, two parameters are passed.
I'm trying to do the same thing in Flash Builder using an object called param:
param.query = pQuery;
param.searchFor = "teachers";
param.searchFor = "rooms";
searchUsersService(param);
Flex overwrites the one with the other, as I suspected it would, so all that is submitted is "rooms". Is it possible to pass two parameters with the same name? (or do I need to ask the server guys to rename their search parameters?)
Thanks.
You can't. It will only override the previous value:
param.query = pQuery;
param.searchFor = "teachers";
param.searchFor = "rooms"; //Will obviously override the previous value
searchUsersService(param);
What you can do is:
param.searchFor = [ "teachers", "rooms" ];
Or
param.searchFor = new ArrayCollection();
param.searchFor.add( "teachers" );
param.searchFor.add( "rooms" );
And then in the server side you can get all the values from your array.