« first day (2289 days earlier)      last day (2667 days later) » 

12:43 AM
I agree, being a god would be exhausting.
 
 
2 hours later…
3:11 AM
GoodMorning!!
 
 
3 hours later…
6:26 AM
Hi! Anyone know how to convert a string to a property? Something like this:
converting the string "name" to Person.FindByName(String value) or Person.Name without doing a switch statement for each properties.
Are there libraries that can do this like Linq, etc.?
 
 
2 hours later…
8:12 AM
One more case: private List<Address> addresses { get; set; } public List<Address> Addresses => addresses;Tân Nguyễn 24 mins ago
@Tân Nguyễn: Why a private read-write property and not a backing field? — BoltClock ♦ 17 mins ago
I usually use the way to handle some case like OnlineUsers. Ex: OnlineUsers cannot be changed when user creates a comment or post a new thread to forum. But, it can be assigned in AccountController. Of course, this question doesn't mention about static. — Tân Nguyễn 8 mins ago
I'm flummoxed
 
9:07 AM
can someone please answer this question stackoverflow.com/questions/41773344/…
 
 
2 hours later…
11:09 AM
morning
 
morning
@dodi
@Dodi82 Do you think you could help with some JSON/Database/C# stuff?
 
 
2 hours later…
12:54 PM
ella people wat is up
 
 
2 hours later…
2:34 PM
@Vap0r maybe you should write some notes on the subject , what terms puzzle you, and google them and try to learn about the concept. So actually make learning them a focus, rather than just running into them by accident when you have some other problem, and not being able to focus on understanding it because you're focussed on the other problem.
I might get caught out if somebody spoke about fermentation and respiration and I don't know the differences, but after a couple of hours or days of research, I have a good idea, and might know more than the person i'm speaking with.
but you have to devote that time to learning it this/that term.
 
 
1 hour later…
3:53 PM
morning coders
@MårtenCederholm what do you have
 
Good morning Juan
Anyone worked with Angular 2 before?
 
4:08 PM
na not yet
 
@juanvan Dont know if you are still here. I need to eat dinner but will be back in a bit. I have problem extracting data from a table that I downloaded via HTTPClient and then desieralized wtith JSON
from a databse that is
 
ya ill be here for the next 3-4 hrs
 
@MårtenCederholm "Deserialized with json" Do you mean deserialized from json?
 
json-> object
 
The http response is (probably) json formatted. That can be deserialized to an object
@MårtenCederholm what's the problem?
 
4:20 PM
is eating he will be a little prob
 
4:40 PM
Ok
public class Model
    {
        public async static Task<RootObject> GetData()
        {
            HttpClient http = new HttpClient();
            HttpResponseMessage response = await http.GetAsync("http://api.scb.se/OV0104/v1/doris/sv/ssd/START/ME/ME0104/ME0104D/ME0104T4");
            HttpContent content = response.Content;
            string result = await content.ReadAsStringAsync();
            var data = JsonConvert.DeserializeObject<RootObject>(result);
            return data;
        }
That is the class that includes fetching the data as well as what Json2Csharp gave me when inputting the URI I used
The variable clas and rootobject was generatd by json2csharp.com
 
Looks fine so far
 
THis is part of the table
I'm not very good with lists (forgot some along the way). If you look at the table (I will try and explain what I mean, english isnt my first language though). I can fetch the name by writing
Console.WriteLine(myData.variables[0].valueTexts[1].ToString());
RootObject myData = await Model.GetData();
That is what I run to get the data, so I store it in myData
Now the problem is, I don't understand how to fetch the % that is in the actual table
What I need to do, is for every year, fetch all the % and find all the region/regions (if two have the same) with the highest % of that year
 
OK, so the problem is that the json result doesn't match the format that you want?
 
Well the problem is, I don't understand/know how to get all the information out
 
I don't see what connection that table has to the types you have there
 
4:46 PM
That is the pdf for the API description
 
Is the API designed to calculate those percentages for you and return them, and you're asking how to specify that it should do that?
Or are you asking how to manipulate this data in code to produce the desired output?
 
Im asking how to get the data out. I presume all the numbers are already there since I specified what data I wanted.
They just provide statistics that they collect
 
What do you mean by "get the data out"?
 
:P
Sorry
What I mean is, when I fetch via the URI it should give me that table (that i linked a part of) so that I can then look at every year and find the highest percantage for that year and what region had it. Then do that for every year. Sorry for not being able to properly explain
 
OK, I don't think any of us can answer that for you. You have more familiarity with this API than anybody else here, I'd assume. If it doesn't format its results the way you want, you'll have to design an algorithm for transforming the data then write some code that does that. I don't think we can be any more specific
 
4:53 PM
Ok
Thanks anyways :)
 
Are the names in the leftmost column (I assume they are regions in Sweden?) represented as one of the properties of the Variable class?
I can't see your data, so I can't visualise how it maps that table to JSON
oh hey, it's publicly available and unauthenticated
I can read it myself
groovy
 
Console.WriteLine(myData.variables[0].valueTexts[1].ToString());
that gives me a region name corresponding to the table
So I know I have fetched, at least some of the data
In the API description they talk about key and value for getting the actual data
I think my model might be wrong though
I think I will have to try and do it with generating the model from the JSON query instead
public class Selection
{
    public string filter { get; set; }
    public List<string> values { get; set; }
}

public class Query
{
    public string code { get; set; }
    public Selection selection { get; set; }
}

public class Response
{
    public string format { get; set; }
}

public class RootObject
{
    public List<Query> query { get; set; }
    public Response response { get; set; }
}
 
I would assume that to represent a table of percentages like that, you'd need a type that looks something like class Row { string Region; List<double> Percentages ;} (pseudocode)
Hmm this API is not very intuitive
 
I wouldnt think so. It's a company that I believe is owned by the government :D
Its an administrative authority
 
A more logical data type to work with would be something like {Region, Year, AmountOfThing} I guess
Where each cell would be one of those
I don't speak Swedish so I haven't so far figured out what these numbers represent
 
5:03 PM
Well, the top row
Are the years
So its ranging from 1974 - 2014
The left is each municipal in the country with respecitive region code
Then the % are how many people voted for each year for each municipal
 
ah right
not that it matters much I guess, it's just data
 
i'm trying to make a general license management system
is there any 'easy' guide available on internet?
i've googled several
 
I see numbers that might be...tens of thousands of people who voted, or something?
 
and understood nothing
 
You see numbers? How did you find that?
:D
 
5:13 PM
@MårtenCederholm visited the URL in my browser
 
All I see are the percantages
 
you people are not good people
not friendly
not helpful people
 
@ARr0w go beg somewhere else
 
not begging. i don't need too
specially to poor people like you
 
@MårtenCederholm hmm that doesn't sound right, most of these are three digits
surely a percentage should be between 0 and 100
 
5:16 PM
well they are 95.3% for example
 
 
Those are region numbers D
Each corresponds to a municipal
But it says in the API description that the data is stored with a key and value. Can't figure out what keys they are refering too :D
That is just an example
Not the data Im looking at
 
OK well the result I get is like so
If those numbers are regions, then I can't see any actual data here
just row and column names
 
Me neither :D
Thats the problem. I mean, the data is clearly in the table but I cant find it when I download it via the URI
I guess it's stored in ME0104B8
 
I think you're getting a table metadata result
see section 4.3
so it describes the table but doesn't give you values
 
5:31 PM
Yeah
Yeah, I dont know how to get to the data part haha.
I feel really stupid
 
I've read that section and I can't figure it out either
They seem to assume you know what the URI should be
 
The only URI/URL I can find is this
http://api.scb.se/OV0104/v1/doris/sv/ssd/START/ME/ME0104/ME0104D/ME0104T4
 
Aaah
> Browsing (HTTP verb POST) the /API-NAME/APIVERSION/LANGUAGE/DATABASE-ID/LEVEL1.../LEVELN/TABLE-ID
requires a JSON formatted query object. The query object specifies what
data should be retrieved from the data cube. The result will be formatted in
the format specified in the query
So it expects you to POST a query object
to the same URI
They really shouldn't say "Browsing" there. Browsing to a URL is usually a GET
 
Ok :P
Do you know how to do that? ;-)
@TomW
 
5:52 PM
How to do what?
 
How to make a query object
im trying to find it :)
 
section 4.4
example right before section 4.5
 
6:15 PM
Yeah, thanks a lot @TomW
 
 
1 hour later…
7:37 PM
hey people ! i need help regarding Inheritance and interfaces
i have to make classes for a normal car, electric car, trunk and both normal and electric bike
both electric and normal car are inherited from Car class , same with bikes and Bike class.
Car, Bike and trunk are inherited from Vehicle
now i have to add more properties and a method to a vehicle using Gas and other method and properties to an electric vehicle
since in C# multi inheritance is not allowed and interfaces cannot have type values i dont know how to do that
 
@ItayZaguri What do you mean by "interfaces cannot have type values"?
 
7:52 PM
i meant int, floats etc..
 
I don't understand
 
can them ?
i get an error when i try to define an int inside an interface
 
Interface members can return any type you want.
What do you mean by "define an int"?
Interfaces can't contain variables
They contain methods, properties, and events
 
so how can i get electric cars,bikes to have more values specific to them ?
 
You can make an interface for gas vehicles, etc.
 
8:01 PM
yeah but interfaces cannot contain variables
 
Right...
 
so im missing something here i guess
how can interfaces contain properties if they cant contain variables ?
Please Help
 
8:49 PM
That's just how the language is designed
Properties are syntactic sugar for functions, sort of
 
do u have any solution for me ?
 
@ItayZaguri Properties are the solution
 
get and set ?
 
Depends what you need
 
i need for example for an electric vehicle to have a float type batteryTime
 
9:01 PM
So make a property for that
 
so i have to implement the get;set; both in electric car and electric bike ?
isn't it double coding ?
 
9:24 PM
@ItayZaguri no.... electric car and electric bike can inherit from interface vehicle where contains a property of batteryTime
that way you can set the value of batteryTime in each respective class
Does that make sense?
 
yes thanks
can i do the same thing with an enum ?
 
Boo
I'm back
 
@ItayZaguri I think so. You can try it out :)
Report back if you have questions or need help
Do you mean something like this: stackoverflow.com/questions/3965172/…
 
9:42 PM
thats great thanks , but i have to implement the enum in every class ?
 
9:56 PM
An electric vehicle implements IVehicle Interface and extends Vehicle
So a Vehicle is its parent and it overrides its properties and methods
the interface is used so you wouldn't have to figure out each time whether the Vehicle is a electric or a gas and just use it
 
electric and gas have different properties and method so i do have to know that
 
why do they have different methods
they both drive but in different ways
 
cuz thats what i was asked to do ;)
 
make an interface that supports these extra methods then
a seperate one
 
yeah i made 2 interfaces "IElectric" "IFuel"
but can i somehow make an enum property inside the interface ?
 
10:06 PM
well you wouldn't want to
you can't
and you shouldn't
because thats not the purpose of the interface
 
but i was asked to make an option for a fuel-using cars to show what kind of fuel they use
 
interface doesn't hold implementations only declarations
a class
 
@ItayZaguri So you can put an enum property in the IFuel interface, sure
 
@KendallFrey yeah but then i have to implement it in each class using IFuel ?
 
Well, yes, because it's going to be different for each class
 
10:19 PM
every car using Fuel uses a particular Fuel type (Octan95, Octan98 etc..)
its not that different, they just use different fuel type
 
Yeah, so the property is going to be different
 
10:56 PM
can anyone tackle this question? stackoverflow.com/questions/41785397/…
 

« first day (2289 days earlier)      last day (2667 days later) »