« first day (2243 days earlier)      last day (2708 days later) » 
00:00 - 18:0019:00 - 23:00

7:14 PM
Can anyone help me? I have an hour to finish an exercise to get a job
7
I need to do simple post, and post my html page to an external api
I've never done this before. I need to do something like:
Url
http(s)://PhantomJsCloud.com/api/browser/v2/[YOUR-KEY]/
Post Body
[REQUEST-JSON]
You should not Base64 Encode, nor UrlEncode your Post Body, or any of it's parts.
Content Type
application/json
in asp.net
thanks guys.
 
you want to use postmaster?
or you need a page that will send the link with that data
or you need to make that API request and respond back with data
 
i need to make a button that sends the data to phantomjscloud
where do I put the API request?
do I put it on my html page or do I need to create a controller of some kind?
 
7:29 PM
@ScottVMeyers You need to do an AJAX call
Either do an ajax call in jQuery
or post to a MVC controller or any codebehind in c#
and use HTTPClient
 
Does PhantomJsCloud allow cross-site?
 
CORS support & JSONP
 
If we help you solve this problem do we get a portion of your paycheck?
 
absolutely!!
considering i'm going to be working for free.
 
So we still get paid right?
 
7:33 PM
using (var client = new HttpClient())
    {
        client.BaseAddress = new Uri("http://localhost:9000/");
        client.DefaultRequestHeaders.Accept.Clear();
        client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));

        // New code:
        HttpResponseMessage response = await client.GetAsync("api/products/1");
        if (response.IsSuccessStatusCode)
        {
            Product product = await response.Content.ReadAsAsync<Product>();
            Console.WriteLine("{0}\t${1}\t{2}", product.Name, product.Price, product.Category);
 
this is stupid. I took a bootcamp, we concentraded on frameworks and not basics. I literally learned no CS. Just a ripoff
yeah, all the donuts you can handle.
 
You don't want to work there anyway.
 
i don't have a choice. its the first company that has even interviewed me in a year
 
Which company?
 
Are you out of school?
 
7:35 PM
nope, no college, no experience.
its a marijuana traceability startup
 
.....a what?
 
^ What he said.
 
there's a lot of red tape for states that have legalized marijuana
the app streamlines the process
from grower to customer.
 
I hate to so this dude-bro, but it sounds like you're not a developer. "No College" and "No experience" would be a non-starter just about anywhere. Try getting on a secretary or office toady and learn to code.
 
i've made some cool web apps, just have no basics.
 
7:38 PM
Wouldn't that be experience?
 
no professional experience.
 
... How? That's like "I've built a car, but don't know how to use a wrench"
 
What are the cool applications you built, put that code on display.
 
they've seen it.
i know specific frameworks pretty well
outside of those, I know zero.
 
Such as?
 
7:39 PM
asp.net, angular
 
never heard of em
 
asp.net is pretty broad, care to narrow a bit? Which aspect of it?
 
Wait, so you're just posting to an API? You don't have to write a script to do this?
> I need to do simple post, and post my html page to an external api
 
i have no idea. i have always used local db's, never used any external apis
 
Is this an actual interview exercise or did they just tell you to do this for a deliverable and you didn't want to say you didn't know how to do it?
 
7:41 PM
@ScottVMeyers Dude you have to do a POST in either an AJAX call or using HttpClient
 
yeah, i want to use an httpclient, but no idea how.
 
I posted code
copy the code
 
Because if you just have to post to a URL just use Postman
 
where do I put it?
 
In your controller you're posting to
you send a model back to your controller
the controller takes the model, converts it to json, sends it to a url in a body
 
7:44 PM
i'm not using angular
 
I think this is more what you need getpostman.com
 
oh nevermind
 
@RoelvanUden Damnit Roel, I saw this in the stars and fell for it 4 days later. =(
 
!!tuesday
 
@mikeTheLiar That didn't make much sense. Use the !!/help command to learn more.
 
7:48 PM
Sound's like you don't know how to develop, sounds like your experience is minimal.
 
this is true.
hence why i'm willing to work for free.
 
If you're good at something, never do it for free. - Abraham Lincoln - 2016
 
Hang out in here. You'll learn a lot. And get trolled a lot.
 
thanks
 
> If you're good at something, never do it for free. - Abraham Lincoln - Failsafe
 
7:50 PM
this goes in my api controller?
 
you shouldnt have an api controller
 
We troll hard, so hard.
 
We have the best trolls
 
Considering you are using an external api, you should be using Mvc.Controller
 
just client side, okay. and how do I call it?
 
7:50 PM
using HttpClient
 
@Failsafe ohh you fail
 
[HttpPost]
public ActionResult MyPostFunc()
{
//HttpClient code goes here
}
 
@TomW aGFyYW1iZSBkaWRuJ3QgZGllIGZvciB0aGlz
 
Even though HttpClient is IDisposable, it is not meant to be short-lived. It has an internal pool of connections that do...weird things
 
@TomW HttpClient is the most current one right?
 
7:53 PM
yarp
 
@Failsafe What exactly is he trying to do?
 
Ok
There is RestSharp also
but also don't do that
 
@Greg call a POST api function
 
From code behind for client side?
 
7:54 PM
client side
or a controller
 
Shouldn't he be using $.ajax({ });
 
it really doesn't matter
 
Well I said earlier it's either AJAX or HttpClient
he has to choose
 
can i ask a CTE SQL question?
 
7:55 PM
Because even if he does <a href="URL\Bitch\Post"> that is still hitting the event.
Why would a controller need another HttpClient request?
 
Do any of us actually understand the task at hand or are we just operating under complete conjecture here?
 
I think we're all trying to hit that donkey in the ass while blindfolded.
 
Hit the ass in the ass?
 
@mikeTheLiar Double the probability of success?
 
okay, what goes in the response code?
 
7:59 PM
An out of memory generating loop.
 
wait, looks like it might be expecting json.
Url
http(s)://PhantomJsCloud.com/api/browser/v2/[YOUR-KEY]/
Post Body
[REQUEST-JSON]
You should not Base64 Encode, nor UrlEncode your Post Body, or any of it's parts.
Content Type
application/json
 
Ok man
 
Is this a site that is like an assignment? That is an oddly helpful error message for a random API
 
@ScottVMeyers - You know, if you have just created a nice MCVE for us with a "uhm what" section then you would have already finished.
 
thats just the documentation from phantomjscloud
 
8:02 PM
Just for a minute consider the advice here: codeblog.jonskeet.uk/2010/08/29/writing-the-perfect-question
 
@ScottVMeyers you are substituting in the right values in this URL, right?
http(s)://PhantomJsCloud.com/api/browser/v2/[YOUR-KEY]/
You're not sending it [YOUR-KEY] and expecting the request to be valid
 
lol, i'm going to put my key in, but I'm not there yet.
i have no idea where I would put that.
 
you substitute [YOUR-KEY]
with your api key
 
that's not what I meant.
I don't know where to put that code
 
also be absolutely certain that you always use https when you pass a key
 
8:06 PM
okay thanks!
good to know.
 
@TomW - You are giving away all the fun parts :P That was the (s) test.
 
that was the stest?
 
yest
 
Don't be so stesty.
 
stasty? is it lunch time soon? ;)
@ScottVMeyers - Do you have visual studio open?
 
8:10 PM
yeah
oh shit, so I have this:
 using (var client = new System.Net.Http.HttpClient()) {
            client.DefaultRequestHeaders.ExpectContinue = false;
            var pageRequestJson = new System.Net.Http.StringContent(System.IO.File.ReadAllText("request.json"));
            var response = client.PostAsync("https://PhantomJScloud.com/api/browser/v2/ak-gf2th-y3wns-xkbj7-hmh1x-2ga4b/", pageRequestJson).Result;
            var responseStream = response.Content.ReadAsStreamAsync().Result;
            using (var fileStream = new System.IO.FileStream("content.jpg", System.IO.FileMode.Create)) {
 
FLX
Hi, i'm looking for someone to help me with a probme about launching a bash console from Process, if someone has 1min thx
 
@FLX Just ask your question
If anyone knows how to answer it they may help
 
Thanks for giving us your API key
5
 
you bet.
what do I do with this?
{
"url":"http://www.highcharts.com/stock/demo/intraday-area",
"renderType":"jpeg"
}
 
@TomW Security, its for chumps!
 
8:12 PM
proxy security
 
@ScottVMeyers use the historical data to inform future stock purchases
 
done and done.
or done.
 
|Done
 
|| Done
 
i'm worried about the content.jpg
 
8:14 PM
@ScottVMeyers Don't forget favicon.ico. Your website won't run without it.
 
@ScottVMeyers worried how?
 
( done && done ) || done
 
The content is likely to be base64 encoded, check the documentation
 
looks like it is hardcoded.
i'll worry about it later.
 
oh OK, apparently not. I've found the example for jpegs in the docs
 
8:16 PM
@ScottVMeyers - I believe that your json shown there (the intraday-area) goes here: System.IO.File.ReadAllText("request.json")
in the "request.json" string
 
cool, thanks!
 
Or at least, that should point to your file
Hm, slightly off sorry.
So you have the option of loading the file there, and it gets stored in
var pageRequestJson
That variable should end up containing your json string
So you can use pageRequesJson = "@{
"url":"http://www.highcharts.com/stock/demo/intraday-area",
"renderType":"jpeg"
}";
and that should work with your test, more code certainly makes things easier to see
For example, what type of view is using the highcharts response from this?
 
it goes in place of this?
new System.Net.Http.StringContent(System.IO.File.ReadAllText("request.json"));
ummm, I have to attach the image to an outgoing email
 
FLX
Ok, so i'm trying to launch a bash terminal from c# and redirct command input from terminal to c# functions. I read some writings about the process class and input/output redirection, took bash.exe from cygwin, but i don't really know what to do now. I tried to adapt the msdn example and pass the "read" bash command as an argument. I can see bash.exe launch, but it just hangs like a stupid black window, I can't interact with it with keyboard.


Do you know how I could grab the user commands from here ? Here is my code. I must say i'm in a Unity context, so no main function. Thx if you have
 
Is it possible to use a strongly typed HTML form across multiple view?
 
8:31 PM
Good day. I am looking for a way to instantiate classes ONLY from within another class. I am writing a library and I do not want users of this library to be able to create instances of certain classes - they must be created through methods of a singleton or static class. What are the ways of achieving this?
 
@TravisJ
sorry
 
@hello - Yes
 
I can't get it anywhere and keep it happy! Do I put it in there asa string, or replace the whole line?
 
Hi guys ! Anyone know a way to convert a js array into a json array in c# ? I know you have to do a JSON.stringify in js but it doesn't seem to have an equivalent in c#.
 
@ScottVMeyers - I am not sure, it seemed to me like all it needed was json input and you showed some sample json. Was it a match? Unsure. The span of code you showed earlier was a good indicator, but are you only supposed to contact that code? Why is it reading and writing to the file system? Why mention highcharts if the output is written to a file? Too many questions to know with certainty that a solution will work here.
 
8:39 PM
okay thanks
 
@SebastienLemichez - That process in c# is called "serialization". JSON.Net is often used.
 
do i put the json into the request.json place?
 
@TravisJ Yeah i found a lot to thing for c# to json and json to c# but no js to json (in c#)
 
@SebastienLemichez - This part of your sentence "no js to json (in c#)" makes me think there is a misunderstanding of process there. Can you expand on what you mean?
@ScottVMeyers - Well, what happens when you run the code you showed earlier (also, are you using visual studio? if so, what is the project type?)
 
web project
 
8:43 PM
@TravisJ I got a js file i need to parse in c#. This file is located there : exilemods.com/js/data.js. I need to parse it for it's html content. So what I thought about to do so was to convert this js object into json and then parse it with newtonsoft json decode
 
holy mother of malformed html batman
 
just needing the data, i'm not the owner of the website
 
But it looks like you want to extract the JSON key/value pairs. Then use an HTML parsing library
 
yeah
except it's not a json format
it's a js object
 
Why would you expect a JSON parser to parse something that is not JSON?
 
8:46 PM
Everything except the top level object appears to string -> string values (which would be valid JSON)
 
I can't find any js parser
 
But I'm not going to go through that whole mess to find the thing that's no valid json
 
how do i inform the view of the controller?
 
@ScottVMeyers that does not make any sense
the MVC cycle does not work like that
 
@SebastienLemichez Why don't you call the standard JavaScript JSON.stringify?
 
8:49 PM
@SebastienLemichez according to jsonlint.com everything inside the top-level object is valid json
 
And then use whatever JSON parser you prefer using to parse the result into your C# objects?
 
Yeah that's was my idea but how can you do it from a c# project ? I tryed Javascript .Net lib but either I did something wrong or it doesn't work
 
"Javascript.NET" because of course that's a thing
 
Everything is a thing - Javeascript all the things
 
8:51 PM
what about eval?
 
Douglas Crockford discourages the use of eval
 
Well if what you have is a string with some javascript in it, and what you need is a javascript object, what else are you going to do?
'Discourage' means 'try not to design your application like that'
but sometimes needs must
 
jQuery secretly uses eval all the time.
So does Angular
Angular is a gross terrible scary form of it.
 
webpack uses it pratically every single second
 
@TomW I thought he wants to parse into C# objects and not JS ones
 
8:55 PM
Indeed he does. TL;DR
 
@mikeTheLiar How did you manage to have a valid json in what i've sent you ? Tryed to substring to get only the var value but it fails json validation.
 
@SebastienLemichez Can I have a look at the string?
 
@SebastienLemichez I copied the contents of that page, deleted the part that says htmlObject =and ran it through jsonlint
2
 
Yeah i saw it (i deleted {} too like an idiot)
Nice
@mikeTheLiar I think I can manage to do something with that thx man
 
well, poop. Time to submit nada. Maybe I can get a job next year.
thanks for trying guys.
 
9:10 PM
Is there a way to do a Linq search on an n-dimensional Array object?
Or convert the Array to something that can be searched that way?
 
@Hypersapien SelectMany()
 
@Hypersapien Yes :) You can do it by implementing IEnumerable<T> for a collection you would have written to encapsulate the arrays
 
Trying to follow. Array (as opposed to "array") doesn't support Linq at all.
I need to write a new class to hold the array?
Array
 
To encapsulate the n-dimensional array
The class should implement IEnumerable<T>
You can then use Linq
 
But you've a contrived situation if you have a variable of type Array in your code. Don't do that; represent it as e.g. int[] - then the variable is IEnumerable<T> and not IEnumerable
 
9:19 PM
Techically it's an Array of "location" objects
 
Linq seems to have been designed with linear collections in mind. You could define a struct to hold the values in the n-dimensions
And then have an array of those structs
 
aha
Cast<T>()
array of any dimension >> IEnumerable<T>
 
I thought Eric Lippert and Jon Skeet discouraged casting
 
@MoonOwl22 I bet they also discourage using Array
 
@KendallFrey Best practices are best practices for a reason
Rather than learn the hard way, I now prefer leeching off the experience of experienced people
 
9:50 PM
Hello everybody!
 
Hello
 
I am trying to implement an pdf viewer in my UWP App. I would like to use a FlipView to display the pdf pages. So I am thinking to use data template property of Flipview with an user control within. Is there any possibility to "override" the flipview item with custom user control or something like this? Like the Microsoft Reader it does.
 
10:05 PM
@SebastienLemichez Why wouldn't you use a JavaScript template engine, to output required data to C#?
@ScottVMeyers You should familiarize yourself with:
 
00:00 - 18:0019:00 - 23:00

« first day (2243 days earlier)      last day (2708 days later) »