Recently, I'm reading a book about SQL.
In that book, I can't understand this term - Ad Hoc Query.
I want to know what is exactly means "Ad Hoc Query"
Help me, plz.
Thanks in advance.
Hi all
New to wpf and therefore struggling a bit.
I am putting together a quick demo before we go for the full implementation
I have a treeview on the left with
Continent
Country
City structure
when a user select the city it should populate some textboxes in a tabcontrol on the right hand side
I made it sort of work but cannot make it work with composite objects.
In a nutshell can you spot what is wrong with my zaml or code.
Why is not binding to a my CityDetails.ClubsCount or CityDetails.PubsCount?
What I am building is based on http://www.codeproject.com/KB/WPF/TreeViewWithViewModel.aspx
Thanks a lot for any suggestions or reply
DataModel
public class City
{
public City(string cityName)
{
CityName = cityName;
}
public string CityName { get; set; }
public string Population { get; set; }
public string Area { get; set; }
public CityDetails CityDetailsInfo { get; set; }
}
public class CityDetails
{
public CityDetails(int pubsCount,int clubsCount)
{
PubsCount = pubsCount;
ClubsCount = clubsCount;
}
public int ClubsCount { get; set; }
public int PubsCount { get; set; }
}
ViewModel
public class CityViewModel : TreeViewItemViewModel
{
private City _city;
private RelayCommand _testCommand;
public CityViewModel(City city, CountryViewModel countryViewModel):base(countryViewModel,false)
{
_city = city;
}
public string CityName
{
get { return _city.CityName; }
}
public string Area
{
get { return _city.Area; }
}
public string Population
{
get { return _city.Population; }
}
public City City
{
get { return _city; }
set { _city = value; }
}
public CityDetails CityDetailsInfo
{
get { return _city.CityDetailsInfo; }
set { _city.CityDetailsInfo = value; }
}
}
XAML
<DockPanel>
<DockPanel LastChildFill="True">
<Label DockPanel.Dock="top" Content="Title " HorizontalAlignment="Center"></Label>
<StatusBar DockPanel.Dock="Bottom">
<StatusBarItem Content="Status Bar" ></StatusBarItem>
</StatusBar>
<Grid DockPanel.Dock="Top">
<Grid.ColumnDefinitions>
<ColumnDefinition/>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="2*"/>
</Grid.ColumnDefinitions>
<TreeView Name="tree" ItemsSource="{Binding Continents}">
<TreeView.ItemContainerStyle>
<Style TargetType="{x:Type TreeViewItem}">
<Setter Property="IsExpanded" Value="{Binding IsExpanded,Mode=TwoWay}"/>
<Setter Property="IsSelected" Value="{Binding IsSelected,Mode=TwoWay}"/>
<Setter Property="FontWeight" Value="Normal"/>
<Style.Triggers>
<Trigger Property="IsSelected" Value="True">
<Setter Property="FontWeight" Value="Bold"></Setter>
</Trigger>
</Style.Triggers>
</Style>
</TreeView.ItemContainerStyle>
<TreeView.Resources>
<HierarchicalDataTemplate DataType="{x:Type ViewModels:ContinentViewModel}"
ItemsSource="{Binding Children}">
<StackPanel Orientation="Horizontal">
<Image Width="16" Height="16" Margin="3,0" Source="Images\Continent.png"/>
<TextBlock Text="{Binding ContinentName}"/>
</StackPanel>
</HierarchicalDataTemplate>
<HierarchicalDataTemplate DataType="{x:Type ViewModels:CountryViewModel}"
ItemsSource="{Binding Children}">
<StackPanel Orientation="Horizontal">
<Image Width="16" Height="16" Margin="3,0" Source="Images\Country.png"/>
<TextBlock Text="{Binding CountryName}"/>
</StackPanel>
</HierarchicalDataTemplate>
<DataTemplate DataType="{x:Type ViewModels:CityViewModel}" >
<StackPanel Orientation="Horizontal">
<Image Width="16" Height="16" Margin="3,0" Source="Images\City.png"/>
<TextBlock Text="{Binding CityName}"/>
</StackPanel>
</DataTemplate>
</TreeView.Resources>
</TreeView>
<GridSplitter Grid.Row="0" Grid.Column="1" Background="LightGray"
Width="5" HorizontalAlignment="Stretch" VerticalAlignment="Stretch"/>
<Grid Grid.Column="2" Margin="5" >
<TabControl>
<TabItem Header="Details" DataContext="{Binding Path=SelectedItem.City, ElementName=tree, Mode=OneWay}">
<StackPanel >
<TextBlock VerticalAlignment="Center" FontSize="12" Text="{Binding CityName}"/>
<TextBlock VerticalAlignment="Center" FontSize="12" Text="{Binding Area}"/>
<TextBlock VerticalAlignment="Center" FontSize="12" Text="{Binding Population}"/>
<!-- DONT WORK WHY-->
<TextBlock VerticalAlignment="Center" FontSize="12" Text="{Binding SelectedItem.CityDetailsInfo.ClubsCount}"/>
<TextBlock VerticalAlignment="Center" FontSize="12" Text="{Binding SelectedItem.CityDetailsInfo.PubsCount}"/>
</StackPanel>
</TabItem>
</TabControl>
</Grid>
</Grid>
</DockPanel>
</DockPanel>
Hello.
I am using a ComboBox bound under a DataContext:
<tk:DataGridTemplateColumn.CellEditingTemplate>
<DataTemplate>
<ComboBox
ItemsSource="{Binding Source={StaticResource CategoriesCollection}"
DisplayMemberPath="Title"
SelectedItem="{Binding Category}" />
</DataTemplate>
</tk:DataGridTemplateColumn.CellEditingTemplate>
When the row is initiated the value of Category is null. Once I select the first value in the ComboBox it sets it up. But when I select another value, it doesn't get changed.
I'm thinking about converting a few usercontrols to use templates instead. One of these is my own UC which contains some controls, one of which is a repeater. Is it possible to specifcy a template for the second level usercontrol from the template for the first (which would be on the page)?
Hi All
I am having a problem in RSpec when my mock object is asked for a URL by the ActionController. The URL is a Mock one and not a correct resource URL.
I am running RSpec 1.3.0 and Rails 2.3.5
Basically I have two models. Where a subject has many notes.
class Subject < ActiveRecord::Base
validates_presence_of :title
has_many :notes
end
class Note < ActiveRecord::Base
validates_presence_of :title
belongs_to :subject
end
My routes.rb file nests these two resources as such:
ActionController::Routing::Routes.draw do |map|
map.resources :subjects, :has_many => :notes
end
The NotesController.rb file looks like this:
class NotesController < ApplicationController
# POST /notes
# POST /notes.xml
def create
@subject = Subject.find(params[:subject_id])
@note = @subject.notes.create!(params[:note])
respond_to do |format|
format.html { redirect_to(@subject) }
end
end
end
Finally this is my RSpec spec which should simply post my mocked objects to the NotesController and be executed... which it does:
it "should create note and redirect to subject without javascript" do
# usual rails controller test setup here
subject = mock(Subject)
Subject.stub(:find).and_return(subject)
notes_proxy = mock('association proxy', { "create!" => Note.new })
subject.stub(:notes).and_return(notes_proxy)
post :create, :subject_id => subject, :note => { :title => 'note title', :body => 'note body' }
end
The problem is that when the RSpec post method is called.
The NotesController correctly handles the Mock Subject object, and create! the new Note object. However when the NoteController#Create method tries to redirect_to I get the following error:
NoMethodError in 'NotesController should create note and redirect to subject without javascript'
undefined method `spec_mocks_mock_url' for #<NotesController:0x1034495b8>
Now this is caused by a bit of Rails trickery that passes an ActiveRecord object (@subject, in our case, which isn't ActiveRecord but a Mock object), eventually to url_for who passes all the options to the Rails' Routing, which then determines the URL.
My question is how can I mock Subject so that the correct options are passed so that I my test passes.
I've tried passing in :controller = 'subjects' options but no joy.
Is there some other way of doing this?
Thanks...
Let's say you have the following table:
items(item_id, item_parent)
... and it is a self-referencing table as item_parent refers to item_id.
What SQL query would you use to SELECT all items in the table along with their depth where the depth of an item is the sum of all parents and grand parents of that item.
If the following is the content of the table:
item_id item_parent
----------- -----------
1 0
2 0
3 2
4 2
5 3
... the query should retrieve the following set of objects:
{"item_id":1,"depth":0}
{"item_id":2,"depth":0}
{"item_id":3,"depth":1}
{"item_id":4,"depth":1}
{"item_id":5,"depth":2}
P.S. I'm looking for a MySQL supported approach.
I'm trying to figure out the jQuery statement to rename "apple" with "orange:"
<a id="#alvin" href="http://www.camille.com"><ins class="xxx">Anna</ins>apple</a>
Can this be done easily?
Hi
I want to write a mysql statement which will return a list of results from one table along with a comma separated list of field from another table. I think an example might better explain it
Table 1
========================
id First_Name Surname
----------------------
1 Joe Bloggs
2 Mike Smith
3 Jane Doe
Table 2
========================
id Person_Id Job_id
---------------------
1 1 1
2 1 2
3 2 2
4 3 3
5 3 4
I want to return a list of people with a comma separated list of job_ids. So my result set would be
id First_Name Surname job_id
------------------------------
1 Joe Bloggs 1,2
2 Mike Smith 2
3 Jane Doe 3,4
I guess the sql would be something like
select id, First_Name, Surname, (SELECT job_id FROM Table 2) as job_id from Table 1
but obviously this does not work so need to change the '(SELECT job_id FROM Table 2) as job_id' part.
Hope this makes sense
Thanks
John
I have a cache implementation like this:
class X
{
private final Map<String, ConcurrentMap<String, String>> structure = new HashMap...();
public String getValue(String context, String id)
{
// just assume for this example that there will be always an innner map
final ConcurrentMap<String, String> innerStructure = structure.get(context);
String value = innerStructure.get(id);
if(value == null)
{
synchronized(structure)
{
// can I be sure, that this inner map will represent the last updated
// state from any thread?
value = innerStructure.get(id);
if(value == null)
{
value = getValueFromSomeSlowSource(id);
innerStructure.put(id, value);
}
}
}
return value;
}
}
Is this implementation thread-safe? Can I be sure to get the last updated state from any thread inside the synchronized block? Would this behaviour change if I use a java.util.concurrent.ReentrantLock instead of a synchronized block, like this:
...
if(lock.tryLock(3, SECONDS))
{
try
{
value = innerStructure.get(id);
if(value == null)
{
value = getValueFromSomeSlowSource(id);
innerStructure.put(id, value);
}
}
finally
{
lock.unlock();
}
}
...
I know that final instance members are synchronized between threads, but is this also true for the objects held by these members?
Maybe this is a dumb question, but I don't know how to test it to be sure, that it works on every OS and every architecture.
I'm just taking a look at CoffeeScript for the first time so bare with me if this is a dumb question. I'm familiar with the hidden pattern methodology however I'm still wrapping my head around object prototypes.
I'm trying to create a basic class for controlling a section on my site. The problem I'm running into is losing defined class variables within a different scope. For example, the code below works fine and creates the properties within the object perfectly. However when I jump into a jQuery callback I lose all knowledge of the class variables storing some of the jQuery objects for multiple uses.
Is there a way to grab them from within the callback function?
class Session
initBinds: ->
@loginForm.bind 'ajax:success', (data, status, xhr) ->
console.log("processed")
return
@loginForm.bind 'ajax:before', (xhr, settings) ->
console.log @loader // need access to Session.loader
return
return
init: ->
@loginForm = $("form#login-form")
@loader = $("img#login-loader")
this.initBinds()
return
I have A Script that has a Select statement to go to multiple sub select statements however once there I can not seem to figure out how to get it to go back to the main script. also if possible i would like it to re-list the options
#!/bin/bash
PS3='Option = '
MAINOPTIONS="Apache Postfix Dovecot All Quit"
APACHEOPTIONS="Restart Start Stop Status"
POSTFIXOPTIONS="Restart Start Stop Status"
DOVECOTOPTIONS="Restart Start Stop Status"
select opt in $MAINOPTIONS; do
if [ "$opt" = "Quit" ]; then
echo Now Exiting
exit
elif [ "$opt" = "Apache" ]; then
select opt in $APACHEOPTIONS; do
if [ "$opt" = "Restart" ]; then
sudo /etc/init.d/apache2 restart
elif [ "$opt" = "Start" ]; then
sudo /etc/init.d/apache2 start
elif [ "$opt" = "Stop" ]; then
sudo /etc/init.d/apache2 stop
elif [ "$opt" = "Status" ]; then
sudo /etc/init.d/apache2 status
fi
done
elif [ "$opt" = "Postfix" ]; then
select opt in $POSTFIXOPTIONS; do
if [ "$opt" = "Restart" ]; then
sudo /etc/init.d/postfix restart
elif [ "$opt" = "Start" ]; then
sudo /etc/init.d/postfix start
elif [ "$opt" = "Stop" ]; then
sudo /etc/init.d/postfix stop
elif [ "$opt" = "Status" ]; then
sudo /etc/init.d/postfix status
fi
done
elif [ "$opt" = "Dovecot" ]; then
select opt in $DOVECOTOPTIONS; do
if [ "$opt" = "Restart" ]; then
sudo /etc/init.d/dovecot restart
elif [ "$opt" = "Start" ]; then
sudo /etc/init.d/dovecot start
elif [ "$opt" = "Stop" ]; then
sudo /etc/init.d/dovecot stop
elif [ "$opt" = "Status" ]; then
sudo /etc/init.d/dovecot status
fi
done
elif [ "$opt" = "All" ]; then
sudo /etc/init.d/apache2 restart
sudo /etc/init.d/postfix restart
sudo /etc/init.d/dovecot restart
fi
done
I'm trying to create a table (a work schedule) I have coded previously using python, I think it would be a nice introduction to the Clojure language for me.
I have very little experience in Clojure (or lisp in that matter) and I've done my rounds in google and a good bit of trial and error but can't seem to get my head around this style of coding.
Here is my sample data (will be coming from an sqlite database in the future):
(def smpl2 (ref {"Salaried"
[{"John Doe" ["12:00-20:00" nil nil nil "11:00-19:00"]}
{"Mary Jane" [nil "12:00-20:00" nil nil nil "11:00-19:00"]}]
"Shift Manager"
[{"Peter Simpson" ["12:00-20:00" nil nil nil "11:00-19:00"]}
{"Joe Jones" [nil "12:00-20:00" nil nil nil "11:00-19:00"]}]
"Other"
[{"Super Man" ["07:00-16:00" "07:00-16:00" "07:00-16:00"
"07:00-16:00" "07:00-16:00"]}]}))
I was trying to step through this originally using for then moving onto doseq and finally domap (which seems more successful) and dumping the contents into a html table (my original python program outputed this from a sqlite database into an excel spreadsheet using COM).
Here is my attempt (the create-table fn):
(defn html-doc [title & body]
(html (doctype "xhtml/transitional")
[:html [:head [:title title]] [:body body]]))
(defn create-table []
[:h1 "Schedule"]
[:hr]
[:table (:style "border: 0; width: 90%")
[:th "Name"][:th "Mon"][:th "Tue"][:th "Wed"]
[:th "Thur"][:th "Fri"][:th "Sat"][:th "Sun"]
[:tr
(domap [ct @smpl2]
[:tr [:td (key ct)]
(domap [cl (val ct)]
(domap [c cl]
[:tr [:td (key c)]]))])
]])
(defroutes tstr
(GET "/" ((html-doc "Sample" create-table)))
(ANY "*" 404))
That outputs the table with the sections (salaried, manager, etc) and the names in the sections, I just feel like I'm abusing the domap by nesting it too many times as I'll probably need to add more domaps just to get the shift times in their proper columns and the code is getting a 'dirty' feel to it.
I apologize in advance if I'm not including enough information, I don't normally ask for help on coding, also this is my 1st SO question :).
If you know any better approaches to do this or even tips or tricks I should know as a newbie, they are definitely welcome.
Thanks.
The text file has hundreds of these entries (format is MT940 bank statement)
{1:F01AHHBCH110XXX0000000000}{2:I940X N2}{3:{108:XBS/091502}}{4:
:20:XBS/091202/0001
:25:5887/507004-50
:28C:140/1
:60F:C0914CHF7789,
:61:0912021202D36,80NTRFNONREF//0887-1202-29-941
04392579-0 LUTHY + xxx, ZUR
:86:6034?60LUTHY + xxxx, ZUR vom 01.12.09 um 16:28 Karten-Nr. 2232
2579-0
:62F:C091202CHF52,2
:64:C091302CHF52,2
-}
This should go into an Array of Hashes like
[{"1"=>"F01AHHBCH110XXX0000000000"},
"2"=>"I940X N2",
3 => {108=>"XBS/091502"}
etc.
} ]
I tried it with tree top, but it seemed not to be the right way, because it's more for something you want to do calculations on, and I just want the information.
grammar Mt940
rule document
part1:string spaces [:|/] spaces part2:document
{
def eval(env={})
return part1.eval, part2.eval
end
}
/ string
/ '{' spaces document spaces '}' spaces
{
def eval(env={})
return [document.eval]
end
}
end
end
I also tried with a regular expression
matches = str.scan(/\A[{]?([0-9]+)[:]?([^}]*)[}]?\Z/i)
but it's difficult with recursion ...
How can I solve this problem?
I want to write an iterator for my 'toy' Trie implementation.
Adding already works like this:
class Trie:
def __init__(self):
self.root = dict()
pass
def add(self, string, value):
global nops
current_dict = self.root
for letter in s:
nops += 1
current_dict = current_dict.setdefault(letter, {})
current_dict = current_dict.setdefault('value', value)
pass
The output of the adding looks like that:
trie = Trie()
trie.add("hello",1)
trie.add("world",2)
trie.add("worlds",12)
print trie.root
{'h': {'e': {'l': {'l': {'o': {'value': 1}}}}}, 'w': {'o': {'r': {'l': {'d': {'s': {'value': 2}, 'value': 2}}}}}}
I know, that I need a __iter__ and next method.
def __iter__(self):
self.root.__iter__()
pass
def next(self):
print self.root.next()
But AttributeError: 'dict' object has no attribute 'next'. How should I do it?
[Update] In the perfect world I would like the output to be one dict with all the words/entries with their corresponding values.
Hello
I have a button inside an ascx inside an update panel inside aspx content page. When the button is clicked i want it to run a JS function that causes to show a panel. Here is my Code.
<pre>
<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="ABC.ascx.cs" Inherits="App.ABC" %>
<script type= "text/javascript" language="javascript">
var val1=0;
var val2=0;
function ShowPanel(val2)
{
if(val2 != 0)
{
switch(val2)
{
case 1 :
document.getElementById('<%=pnl1.ClientID%>').style.visibility = 'visible';
break;
}
}
return false;
}
</script>
<asp:LinkButton ID="lbl1" runat="server" OnClick="return ShowPanel(1);">count</asp:LinkButton>
I am not sue how to do this. Please help
Update #1 - ABC.ascx is in updatepanel in the aspx page XYZ.aspx
<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="ABC.ascx.cs" Inherits="App.ABC" %>
<script type= "text/javascript" language="javascript">
var val1=0;
var val2=0;
function ShowPanel(val2) {
if (val2 != 0) {
switch (val2) {
case 1:
document.getElementById("<%= this.pnl1.ClientID%>").style.display = "none";
break;
}
}
return false;
}
</script>
<div>
<div style="text-align:center">
</div>
<table style="width:100%; text-align:center; border-color:#99CCFF" border="3">
<tr style="text-align:left">
<td><asp:LinkButton ID="lbl1" runat="server" OnClientClick="return ShowPanel(1);">count</asp:LinkButton>
</td>
<td style="text-align:right"><asp:Button ID="btnHide1" runat="server" Text="hide"
Height="18px" Width="32px"/>
</td>
</tr>
<tr>
<td colspan="2"><asp:Panel ID="pnl1" runat="server" Visible="false"> </asp:Panel>
</td>
</tr>
</table>
</div>
I can't for the life of me figure out this Sqlite syntax.
Our database contains records like:
TX, Austin
OH, Columbus
OH, Columbus
TX, Austin
OH, Cleveland
OH, Dayton
OH, Columbus
TX, Dallas
TX, Houston
TX, Austin
(State-field and a city-field.)
I need output like this:
OH: Columbus, Cleveland, Dayton
TX: Dallas, Houston, Austin
(Each state listed once... and all the cities in that state.)
What would the SELECT statement(s) look like?
I'm trying to get the count of the number of times a player played each week like this:
player.game_objects.extra(select={'week': 'WEEK(`games_game`.`date`)'}).aggregate(count=Count('week'))
But Django complains that
FieldError: Cannot resolve keyword 'week' into field. Choices are: <lists model fields>
I can do it in raw SQL like this
SELECT WEEK(date) as week, COUNT(WEEK(date)) as count FROM games_game
WHERE player_id = 3
GROUP BY week
Is there a good way to do this without executing raw SQL in Django?
Hi All,
I have to generate XML in the below format
<objects>
<items>
<item ="delete">
<searchfields>
<searchfield name="itemname" value="itemValue" />
</searchfields>
</item>
</items>
</objects>
So I have generated the CS file using xsd.exe by converting the above XML to XSD.
xsd.exe -c -l:c# -n:XmlSerializationDeleteObject DeleteObject.xsd
The CS file that is generated contains 4 classes.
My question is i have to build the XML in the above mentioned format using the class that is generated. I am able to serialize the class files one by one which retirns one tag at a time, but i am unable to build it in the way that i mentioned above.
Please help
Regardas,
jebli
Hey Guys,
I'm trying to build a multi model form - but one of the issues, is I need to link the models within the form.
For example, lets say the form I have has the following models: Users, Profiles
When creating a new user, I'd like to create a new profile simultaneously, and then link the two. The issue is, if neither have been created yet, they don't have ID's yet - so how can I assign linking values?
Thanks!
-Elliot
I am trying to map the ReferralContract.AssessmentId property to Referral.Assessment.Id
The below code works but I am sure that there is a cleaner way to do.... Please tell me this is so ;-)
// Destination classes
public class Referral
{
public Referral()
{
Assessment = new Assessment();
}
public int Id { get; set; }
public Assessment Assessment { get; set; }
}
public class Assessment
{
public int Id { get; set; }
}
// Source Class
public class ReferralContract
{
public int Id { get; set; }
public int AssessmentId { get; set; }
}
The Automapper mapping I am using is
Mapper.CreateMap<ReferralContract, Referral>()
.ForMember(x => x.Assessment, opt => opt.MapFrom(scr => new Assessment
{
Id = scr.AssessmentId
}));
As far as I know there is not a significantly more elegant way to write the following....
string src;
if((ParentContent!= null)
&&(ParentContent.Image("thumbnail") != null)
&&(ParentContent.Image("thumbnail").Property("src") != null))
src = ParentContent.Image("thumbnail").Property("src").Value
Do you think there should be a C# language feature to make this shorter?
And if so, what should it look like?
for example, something like extending the ?? operator
string src = ParentContent??.Image("thumbnail")??.Property("width")??.Value;
Apologies for the rather contrived example, and my over-simplified solution.
I'm wanting to create a shoutbox, though I'm wondering if there is another way to go about this rather than using setInterval to query the database for new shouts every number of seconds. Honestly, I don't like having to go about it this way. Seems a bit redundant and repetitive and just plain old wrong. Not to mention the blinking of the shouts as it grabs the data.
So I'm wondering on how the professionals do this? I mean, I've seen shoutboxes that work surperb and doesn't seem to be using any setInterval or setTimeout javascript functions to do this.
Can anyone suggest any ideas or an approach to this that doesn't use setInterval or setTimeout??
Thanks :)
I have following object structure, deseralized from XML (WS):
<ns2:Category>
<ns2:CategoryId>800003</ns2:CategoryId>
<ns2:CategoryName>Name1</ns2:CategoryName>
<ns2:Categories>
<ns2:Category>
<ns2:CategoryId>800008</ns2:CategoryId>
<ns2:CategoryName>Name2</ns2:CategoryName>
<ns2:Categories>
<ns2:Category>
<ns2:CategoryId>800018</ns2:CategoryId>
<ns2:CategoryName>Name3</ns2:CategoryName>
<ns2:Categories/>
</ns2:Category>
<ns2:Category>
<ns2:CategoryId>800028</ns2:CategoryId>
<ns2:CategoryName>Name4</ns2:CategoryName>
<ns2:Categories/>
</ns2:Category>
</ns2:Categories>
</ns2:Category>
<ns2:Category>
<ns2:CategoryId>800009</ns2:CategoryId>
<ns2:CategoryName>Name5</ns2:CategoryName>
<ns2:Categories>
<ns2:Category>
<ns2:CategoryId>800019</ns2:CategoryId>
<ns2:CategoryName>Name6</ns2:CategoryName>
<ns2:Categories>
<ns2:Category>
<ns2:CategoryId>800119</ns2:CategoryId>
<ns2:CategoryName>Name7</ns2:CategoryName>
<ns2:Categories/>
</ns2:Category>
<ns2:Category>
<ns2:CategoryId>800219</ns2:CategoryId>
<ns2:CategoryName>Name111</ns2:CategoryName>
<ns2:Categories/>
</ns2:Category>
</ns2:Categories>
</ns2:Category>
</ns2:Categories>
</ns2:Category>
</ns2:Categories>
</ns2:Category>
How would I find Category object with CategoryId 800119 efficiently? So, Im looking for something like FindCategory(long categoryId) - Prefferably with LINQ to objects.
Any other option?
I've tried everything (every method that shows up on a SO search), but I can't get it to work.
I'm trying to parse this:
questions = (
{
owner = {
"display_name" = "Neil";
};
title = "Initialising ";
"up" = 11;
"view" = 92;
}
);
I'm trying to get the display_name under owner.