Click here to Skip to main content
15,123,118 members

Comments by Chris Copeland (Top 134 by date)

Chris Copeland 3 days ago View
   
You shouldn't have posted this as a solution but instead used the "Improve question" on your original question.
Chris Copeland 3 days ago View
   
It's kind of hard to diagnose what might not be working because we don't know the structure of your HTML. What is '.timeline-compendium__content'?
Chris Copeland 3 days ago View
   
What steps have you taken to debug this code? "does not work" isn't enough for us to go on, you need to use your browser's developer tools to inspect and debug the Javascript code, and use your PHP IDE to debug the PHP code to give us a clearer idea of the issue.

Is the JS producing a 400/500 response back? Is the PHP code failing at a certain point? It's hard for us to tell by just looking at the example you've given.
Chris Copeland 24-Nov-21 11:17am View
   
That's not a lot to go on, what part of your code is still assuming that there's a session active?

That being said, if you take a look at the session_destroy() documentation I don't think calling session_destroy() is enough. The documentation says that it won't unset global variables, and they provide an example (see Example #1) for completely removing all session data.
Chris Copeland 22-Nov-21 8:29am View
   
Chris Copeland 22-Nov-21 8:22am View
   
You've also not provided complete code. If the issue is in model.BVMS_PMON = data.BIW; then you've not given us any code to tell us what this model variable is. Is it a class? We can't see what the BVMS_PMON property is but if I was to guess it's going to be a string, and you cannot assign a bool to a string without converting it.
Chris Copeland 22-Nov-21 8:19am View
   
Again, you need to debug your Javascript code to see what happens when it runs. This means putting in breakpoints and stepping through the code to see what happens. Without any errors visible in the console, you're reliant on debugging the code.

Debugging in Chrome
Debugging in Firefox
Debugging in Edge

It's important to get used to debugging code because this will be your primary way of testing and analysing code when it's not working correctly. Every good developer will switch to debugging when their code isn't working as intended.
Chris Copeland 22-Nov-21 6:43am View
   
If your console is not producing an error message (which it should do if some part of the script is not working properly) then you may need to debug your Javascript and step through the code line-by-line and see what isn't working.

For example, it may be failing to load the Q1.xml file. In your switch(xmlReq.readyState) block you only return if the ready state is something unexpected. Also, you haven't got an error event handler setup:

xmlReq.addEventListener('error', function (e) {
  console.log('An error occurred!');
});

At this stage on you can debug and identify what error is being produced. If you can provide us with information about the error, we might be able to provide some support.
Chris Copeland 22-Nov-21 4:20am View
   
Yes Javascript routing can detect the path of the URL when the page is loaded, so having something like /view/episode-1-some-title/ would be loaded correctly.

I suppose the main benefit of this is distribution and sharing? Imagine if someone opened a product page and wanted to share it with their friends or partner as a suggested present for Christmas, they will typically take the URL from the browser and send it across. Without this functionality in the URL, they'd have to give detailed instructions to find the correct page. And if they wanted to bookmark the page, well that would be impossible if the URL wasn't constructed properly.

Search engines also struggle a little bit at the moment with SPAs, though they're making best efforts to try and improve their indexing engines. If the entire application was locked behind button presses however, that would become impossible to index.
Chris Copeland 19-Nov-21 4:58am View
   
You're welcome! 😊
Chris Copeland 15-Nov-21 12:18pm View
   
You'll need to amend either the API endpoint to correctly produce the result you're expecting (we can't see this code, you haven't included it, you can always edit your original question by using the Improve Question button) or amend your Javascript to correctly consume the data.

As I said, your Javascript is expecting a JSON object in the response body, but you can see from the console.log() line that it's producing a JSON array instead. Either your Javascript is wrong or the result returned from the API endpoint is wrong, you need to assess which is the correct result.
Chris Copeland 15-Nov-21 11:47am View
   
This sounds more like the API isn't producing the output that you expect, rather than an issue with this piece of code in particular. You might need to look at the documentation for the API endpoint and see why it's producing an incompatible response.

Your code is expecting a JSON object back with properties such as 'dnum', 'num' but you can clearly see the actual response out is a JSON array of objects.
Chris Copeland 11-Nov-21 4:13am View
   
You've provided an example of a JSON payload, is this how it's stored in the PHP? If it's stored as a string you'll need to use json_decode() which takes a JSON string and converts it into an object. Then you can access the properties of the JSON accordingly.

Also remember that this JSON decoded would be an object so you need to reference the properties of said object. Ie. $object->data->orders->order
Chris Copeland 22-Oct-21 4:49am View
   
What do you mean "display the result of this code"? This is the code for a PHP file so you'd need to run it through a PHP webserver, such as XAMPP
Chris Copeland 15-Oct-21 5:12am View
   
If this is where the problem exists then it sounds like PHP isn't able to decode the JSON content correctly, have you tried printing out the value of $data to inspect what the content looks like?

var_dump($data);
Chris Copeland 13-Oct-21 6:27am View
   
You haven't told us what's wrong with the code. What error(s) are you encountering, what part of the code isn't working as intended?

Also your code seems to have two Main() methods which is odd, have you just copied and pasted multiple files into one big block?
Chris Copeland 13-Oct-21 6:24am View
   
That's your problem, you're trying to mix and match the PDO class (which I would say is probably a better choice to use) with the sqlsrv_ methods. In order to establish a connection for sqlsrv_query() you have to use sqlsrv_connect()

If you want to use PDO instead then that's fine, you'll have to use the PDO-specific methods such as PDO::query
Chris Copeland 13-Oct-21 5:43am View
   
It's hard to diagnose this without knowing what's in the conn.php file, but it sounds like the $conn variable isn't being initialised as a database connection. Check that the $conn variable is actually being assigned from sqlsrv_connect(), and possibly provide the contents here (with any credentials removed)
Chris Copeland 8-Oct-21 9:55am View
   
You had code on here previously and now you've removed it, why? Providing us with code gives us some context where we can provide advice, without it we can't know what you have and haven't tried.
Chris Copeland 5-Oct-21 6:05am View
   
This isn't a very clear request. Is the output that you've provided what you expect the produced content to be, or is it what is currently being produced? Also, what do the numbers in parenthesis mean?

You can already store the result of that function in one variable: var value = sum(1234);
Chris Copeland 5-Oct-21 5:04am View
   
What seems to be the issue? Is it that the click event isn't being raised, or that you don't understand how to dynamically add the content to the downloadFile() method?

Also, how come you're binding a click event handler to the li element? Does the myFunction() function actually exist?
Chris Copeland 4-Oct-21 8:24am View
   
I think you need to do some research into WPF + data binding + observable collections. You would update your main view-model "Items" property to be an ObservableCollection<copycloneviewmodel>, this will add the automatic binding so when an item is added to the collection the visual tree gets refreshed and renders the new items.

You would add your new string property to the CopyCloneViewModel (since that is the object that is being rendered at that level of the tree), and bind the TextBox Text property to the new string property within your child control.

So think of it like this: your main view-model has the collection of CopyCloneViewModels, each of which has a text property. Then in your XAML you're creating a child control for each one of these view-models (correct), and then in your child control you'll bind your TextBox.Text property to the text property in the CopyCloneViewModel.
Chris Copeland 4-Oct-21 7:02am View
   
You still haven't closed the $(document).ready() block correctly. The }); at the end of your script block is closing the $.ajax call, but the parent $(document).ready() still needs to be closed.
Chris Copeland 4-Oct-21 6:49am View
   
Your code still isn't correct, you've not closed the $(document).ready() block. If you look at the code you can see that you're missing the }); which would close that function call, and you have a closing } below your script closing tag.
Chris Copeland 4-Oct-21 5:04am View
   
Can you elaborate on "I have a few problems there too"? If you can explain what is and isn't working then we can provide suggestions.
Chris Copeland 21-Sep-21 10:29am View
   
I think this might be that troll user again.

"I am not debating here IF it's worse or the same because I believe it simply doesn't matter but if it makes any profitable difference which I am closer to think it does not. I have found several articles that confirms it so far."

If you've found several articles (and therefore done your homework already) why are you asking questions here? Are you purposefully just trying to catch people out and call them out?
Chris Copeland 14-Sep-21 4:12am View
   
If you're positive that the response status is okay but Sendgrid isn't showing any activity on the account then you need to raise a support ticket with Sendgrid. I'm not completely convinced that you've been looking at the correct Sendgrid account and/or looked at all the different areas to find the issue. But maybe raising a Sendgrid support ticket should get you some answers hopefully. I can offer no solution.
Chris Copeland 13-Sep-21 8:22am View
   
So there's absolutely nothing in Sendgrid to indicate that it attempted to generate the email, and send it to the email address? And yet your code doesn't produce any errors and it has a response status code of accepted?

Something doesn't add up, either the API is producing an invalid response, or there should be something in Sendgrid to indicate what went wrong. If neither is true then you'll need to raise a support ticket with the Sendgrid team to have them investigate.

Are you sure you've debugged your code and the "response.StatusCode" is accepted?
Chris Copeland 13-Sep-21 6:28am View
   
If the status code is accepted then there could be many causes for the email not to go through. I would suggest (having used Sendgrid myself in the past) to login to Sendgrid and check the activities to see whether it has marked the email as having been sent. See whether Sendgrid is reporting any problems with finding and/or populating the email template, and whether the delivery status of the email is confirmed.
Chris Copeland 13-Sep-21 4:12am View
   
So what is happening exactly? Is the code throwing an exception; if so, what does the exception tell you is wrong? Is the call to "SendEmailAsync" returning a response with a status code that isn't accepted; if so, what is the status code, have you looked at the documentation to see what it means?

You need to provide us with more context than "Email not send", use your debugger to step through and inspect your code to work out what errors is bring produced, then you can start to work on a solution.
Chris Copeland 10-Sep-21 5:00am View
   
The responsibility of debugging and working that out relies on you - the developer - to do, and it'll be good to practise doing it. A large part of development is things not working and having to take the time to debug and work out why not.

That being said, the fact that your error is reporting $ is not defined tells me you perhaps haven't included jQuery as a dependency on your page? I don't understand why you're using a combination of both vanilla JS and then the one single line of jQuery?
Chris Copeland 6-Sep-21 6:46am View
   
Deleted
One thing that might be worth looking into is:


You've set your method to "GET", but you use the $_POST variable in your PHP code. Since you've set the method to "GET" you'd need to instead look at the $_GET variable.
Chris Copeland 11-Aug-21 6:40am View
   
I agree with TheRealSteveJudge, making a website responsive without leveraging an existing framework is going to be quite a challenge. You're going to need exhaustive knowledge of media query selectors, something which you've not used in the CSS you've provided.

This page has some documentation on the use of media selectors
Chris Copeland 10-Aug-21 4:09am View
   
You won't be able to connect directly via an ARN because your ODBC connectors don't understand how to translate the ARN descriptor into a connection string. Instead you are going to need the database address. You need to speak to your DevOps team and explain the situation and ask for all the information needed to establish an ODBC connection to the database.
Chris Copeland 5-Aug-21 11:26am View
   
This is a repost of this question you asked already, please don't repost the same questions but instead review the solutions already provided to you.
Chris Copeland 5-Aug-21 10:18am View
   
I can't immediately see a problem with this code, how are you binding the ViewModel to the Window itself? And are you using the ComboBox within a template or style? Have you confirmed that the query is loading values from the database, ie. check with a debugger to step through the code?

I will note that the ComboBox isn't provided with a DisplayMemberPath so it will probably try to call ToString() on each of the objects in the collection.
Chris Copeland 5-Aug-21 6:02am View
   
You need to do some research into regular expressions and understand how they work. A good starting point would be to look at "anchors" (which can be used to detect the start and end of a string), and "alternation" (which can be used to check for combinations of options)

/^hello/g checks that the string starts with the word "hello", while /world$/g checks that the string ends with the word "world"

/(hello|world)/g checks that the string contains either the word "hello" or "world"
Chris Copeland 4-Aug-21 10:55am View
   
That explains it then, that version of PHP does not have the "get_magic_quotes_gpc" method, so you need to upgrade the version of Wordpress that's running to one that doesn't use that method. The alternative is to downgrade your PHP version back to 7.
Chris Copeland 4-Aug-21 8:22am View
   
There's not enough context here to work out what it is you're actually trying to accomplish. You've populated a combo-box with weekdays, but what's the calculation for total hours? If you mean hours in the day then it would be 24 * the number of selected items?
Chris Copeland 4-Aug-21 8:18am View
   
Also worth noting that this Wordpress page explains that the function should have been fixed.
Chris Copeland 3-Aug-21 4:14am View
   
You are very welcome :)
Chris Copeland 2-Aug-21 4:11am View
   
What isn't working with the code you've provided? We need some context on whether you're receiving an error, or whether it's just not behaving as you would expect. We can't see what happens on your screen when you run this code, so we can't know what the output of running it is!
Chris Copeland 27-Jul-21 9:49am View
   
Following up on this after some thought, if you also want to protect the user from malicious actors accessing the cookies or local storage to see their purchase history, you could also use a JWT token to make things secure. Upon checkout generate a JWT token and store the purchase information in the database against the token, and send the token back to the browser to be stored in a cookie or local storage.

Upon registration, accept the JWT token as part of the submit process, and then look-up whether any purchases were made. This is far more secure because the JWT token does not expose the purchase information directly, and are incredibly difficult to forge. Some JWT tokens also allow you to use a signing key to encrypt and decrypt the contents, so you can even store the purchase information within the token and omit the database component altogether.
Chris Copeland 27-Jul-21 5:55am View
   
The reason NuGet exists is to try and resolve some of these referencing hellscapes. With NuGet packages you can clearly and distinctly provide all referenced dependencies, however with Project References you're dependent on the linker to work everything out. The release mode builds are notorious for optimizing out code and dependencies it doesn't think are being used, even if they are (imagine trying to reflectively load an assembly but the build removes it as being unused!)
Chris Copeland 27-Jul-21 5:43am View
   
You've not answered the questions I posed in my previous comment though. You say the up and down key events aren't working but you're providing no context. You need to check the browser console and look for potential errors, you may even need to debug the JS file to step through the code to see what isn't working.

Remember that we can't see your screen or the output of your code, so you need to do some work to identify what the new problem is.
Chris Copeland 27-Jul-21 5:05am View
   
"it's not working" isn't enough to go off of, we need more information on what exactly isn't working. Have you checked the browser console to see what the error is? What is the error you're receiving? Or is it just not triggering?
Chris Copeland 27-Jul-21 4:15am View
   
If you're getting the FileNotFoundException for the Serilog assembly name then you absolutely have to add a NuGet reference to it for your executable file. VS projects aren't always magical in resolving which dependencies are needed for which projects, and especially as you chain more dependencies together (ie. A -> B -> C). You probably don't need to add Serilog to your "B" library, just to the project executing the code.
Chris Copeland 25-Jul-21 10:51am View
   
This is because you're trying to use getElementsById and not getElementById. Remove the extra 's' after the 'Element' part.
Chris Copeland 23-Jul-21 4:19am View
   
I don't understand this question, what do you mean without binding it and without programmatically? How are you planning on actually putting the number into the textbox? In WPF the standard model would be to use binding, but in your first example you've not provided a path to bind to.
Chris Copeland 20-Jul-21 10:13am View
   
I don't think there is, in the source code Delegate the actual creation is delegated to the unmanaged code to handle. This is probably where the compatibility is checked: Delegate.cs

I don't think there's anything currently built into C# to do this: StackOverflow of the same question, but then I don't see the problem with banging together a quick extension method to implement it.
Chris Copeland 19-Jul-21 7:01am View
   
D'oh, my bad. That's what I get for posting while in a call!
Chris Copeland 19-Jul-21 4:28am View
   
You haven't provided any code that we can use as a context to help out with this issue. Just from your post it sounds like you're not detecting the end of a call and resetting whatever code you have back to the start.
Chris Copeland 16-Jul-21 4:49am View
   
I agree some people learn visually, but we also don't provide full code or solutions on demand. We expect people to take the initiative and make the effort to solve the problems themselves, and provide support along the way. I gave you all of the building blocks necessary to get started, and if you've managed to build a solution then my job is done!

You have also changed your comment since I wrote my previous one, removing the part where you asked for the full solution.
Chris Copeland 16-Jul-21 4:15am View
   
I can't provide you the solution, this is something you'll probably need to develop yourself! It does present a good opportunity to learn more about development, and if you get stuck then you can always post a new question with what you've developed so far :)
Chris Copeland 13-Jul-21 12:11pm View
   
How are you handling the move to the next word? Are you expecting a keyboard button press to scroll to the next position, or do you have a physical button being clicked? Ie. if the user searches and scrolls to the first word, how are they then signalling to the browser they want to move to the next one?
Chris Copeland 13-Jul-21 6:45am View
   
You're welcome :)
Chris Copeland 13-Jul-21 4:16am View
   
Does the window.getSelection() method not work? Are you getting an error? What's the problem?
Chris Copeland 9-Jul-21 8:14am View
   
How come you're using $request->input('id') for one field, yet using dynamic properties ($request->message) for the others? Have you tried replacing the dynamic properties with the input() method to see whether you get different results? $request->input('message');
Chris Copeland 6-Jul-21 10:14am View
   
How are you passing the LicenseHolder into the command? Are you using binding to correctly pass it in as the command parameter? Can we see the XAML for the button part of the screen?
Chris Copeland 5-Jul-21 9:58am View
   
An API generally deals with requests and responses, and very rarely with actual files. When you say "file content should be encrypt" do you actually mean an uploaded file, or the body of the request being sent?
Chris Copeland 1-Jul-21 4:27am View
   
That's up to you to decide, I can't write your application for you. You have the classes and tools you need to handle the user addition. You have your form elements, each containing the fields needed for the user, and you have the backing C# code which will execute something when the form has been filled in. Just take the form elements, populate your user object, and then call database context.
Chris Copeland 30-Jun-21 10:36am View
   
You're not using the Add() method correctly. You need to instantiate an instance of User and pass that into the method. The line you have commented out is the part where you'd create the user class, set the properties and then add it to the context.

You need to do more research into Entity Framework and how to use it. From your existing code you would need to put the logic in the HandleValidSubmit method, and populate it with elements from the form.
Chris Copeland 30-Jun-21 5:28am View
   
You need to use the database context you created ("AppDbContext") to interact with the database. Consider looking over this documentation[^] for a starting point. I know it says EFCore but I believe this also applies to the non-core version of EF.
Chris Copeland 30-Jun-21 4:48am View
   
Well you've created your database context "AppDbContext", and you've built your entities and created the form. It seems like the only thing you've not done is put all of these things together, have you tried actually using the database context to save data to the database?
Chris Copeland 25-Jun-21 5:51am View
   
I'm not sure if there's much you can do to improve that. The only thing you might find is that you end up inserting duplicates into the list, so you could look at using a Dictionary<> instead and use a composite key to work out whether it's been inserted already. Otherwise, if your result sets are containing thousands of records then you'll have to cater for it taking a while!
Chris Copeland 25-Jun-21 5:45am View
   
Ah my bad, looks like that's a new addition to the C# family. Instead you can use the IndexOf method with the same option: .IndexOf(search, StringComparison.InvariantCultureIgnoreCase) >= 0
Chris Copeland 23-Jun-21 10:51am View
   
Have you tried debugging your code, stepping through line-by-line in your browser, to see what happens at each stage? You should be able to place break-points in different parts of the code and be able to see each of the values as you step through.
Chris Copeland 21-Jun-21 4:07am View
   
Did you follow the advice I gave and subscribe to the catch() method? You've not explained the error that you're receiving.
Chris Copeland 18-Jun-21 4:53am View
   
This question doesn't quite make sense, you don't use jQuery to write Typescript. What is it you're trying to accomplish? Are you having problems using jQuery in Angular? If so there's this blog post[^] which explains extra steps needed to get it working.
Chris Copeland 15-Jun-21 11:38am View
   
What is the type of this.http? It looks like it's returning an Observable<Response> which isn't a documented HttpClient return type.
Chris Copeland 15-Jun-21 4:31am View
   
So what have you tried? Can we see the code you've produced so we can provide guidance and suggestions? Can you also clarify on what you mean by "set something to default"? We have no idea what you're asking here without context.
Chris Copeland 11-Jun-21 4:48am View
   
I can forgive some of the questions as perhaps wanting to get a better understanding of the inner workings of C#, but this question doesn't even make sense. He even included a quotation explaining there's no such thing as parameterized static constructors..
Chris Copeland 11-Jun-21 4:45am View
   
The documentation for session events states that the session state mode must be in "InProc" mode, are you sure your sessions are setup correctly? Also, 1 second is a very short interval to detect timeout, could it not also be that the server might discard the session before it's even properly instantiated?

What sort of debugging have you done? What does the code look like?
Chris Copeland 9-Jun-21 6:05am View
   
Presumably you're maintaining a list somewhere of all the desktop handles that you've created, a collection of IntPtr values. If you want to take screen captures from any of those desktops you'll need to create a new thread (which should not open any handles on the main desktop), switch the thread to the desktop using the SetThreadDesktop() method, then perform whatever screen capture functions you are using.

If you don't switch the thread desktop handle then it won't have access to the handles needed to take screen captures. And if you try and switch the thread desktop of the main thread (or UI thread) then it will likely fail, hence the new thread needed.
Chris Copeland 9-Jun-21 5:49am View
   
Strange that the entry assembly location is giving you the DLL path? In any case, there is also this blog post which outlines another variation. But as both Griff and I have mentioned it's a bad idea to try and store files in the executable directory, you should store them somewhere where permissions aren't going to be an issue. It's very common for applications to use the ProgramData and AppData directories to store files.
Chris Copeland 9-Jun-21 4:59am View
   
However, as an aside since I didn't really answer the question, have you tried using System.Reflection.Assembly.GetEntryAssembly().Location;? The entry assembly is the one identified as having run the Main method.
Chris Copeland 7-Jun-21 4:37am View
   
Can you provide more information on what isn't working? Is the Docker container not starting up? Is the application within the container shutting down with errors? Is the service not available outside of the container?

We need more information before we can possibly think about providing help. What steps have you taken? Have you checked the logs?
Chris Copeland 4-Jun-21 5:20am View
   
Please don't.
Chris Copeland 2-Jun-21 4:11am View
   
I believe you don't have to close the last <?php tag, it happens automatically
Chris Copeland 1-Jun-21 10:47am View
   
If the API has been deprecated, and you know that the Google one works, could you not just use the Google maps instead? Unfortunately it sounds like a limitation in this CMapControl.
Chris Copeland 1-Jun-21 10:46am View
   
Chris Losinger below provides a good compromise. If you absolutely cannot change the DLL then why not write an intermediary C++ DLL which has a method which does accept the char*? Then simply have that method forward the invoke onto the correct method after creating the base::string instance?
Chris Copeland 27-May-21 10:52am View
   
Wasn't aware of the If function, learn something new every day!
Chris Copeland 26-May-21 5:13am View
   
Upgrading is fine if the extra performance can be squeezed out of it. But care needs to be taken to investigate all other avenues as well, as an upgrade could be costly and not actually improve anything.

Consider also looking at things like: running queries and their average execution times, table and row locks, average connection lifetime, I/O read and write times to the hard-drive. All these things can generally be monitored in SQL Server and may help identify points and resources which may need addressing.

I'm not trying to dissuade your from the upgrade, just that it could be disappointing if you upgrade and very little changes. Best to be prepared.
Chris Copeland 26-May-21 4:57am View
   
That being said, I also want to point out that it may not just be hardware. There's also considerations like your network quality, what is your bandwidth like? Slow connection requests + responses could be causing locks on the database.
Chris Copeland 26-May-21 4:56am View
   
I'd suggest also looking at the resources of the machine that the server is hosted on as well. Increased users slowing down the server is usually a sign that either the machine itself or the version of SQL Server just isn't able to cope with the increased throughput.

This article seems to summarise quite well the differences between the versions. SQL Server Standard seems to support up to 4 CPU sockets or 24 cores, and 100GB+ memory for caching, so is your machine utilising these maximums? If not then you should consider the machine being upgraded before upgrading the SQL Server version.

SQL Server Enterprise simply unlocks a lot of the limitations found in Standard, so if you're not pushing the Standard edition to the maximum then there's no point in upgrading.
Chris Copeland 26-May-21 4:36am View
   
I would suggest that a database becoming progressively slower over time would indicate some sort of database connection leak issue. Have you run any SQL on the database to check on the number of active connections to make sure you're not running out of connection resources? Here is an example
Chris Copeland 25-May-21 10:14am View
   
I'm not sure how that would work, are you saying that if server receives data then it should automatically present that data back the next time the view is rendered? If so, you're heading into database territory where you'll need to store things in a database to retrieve again the next time the view is being rendered.

This sort of sounds like how a "chat" system would work, where messages being sent over sockets land immediately on the page, but when the page is refreshed you would need to retrieve those messages back from a database to display them again when the page loads.
Chris Copeland 25-May-21 4:18am View
   
If you look at the documentation page for BeginAccept you can see at the bottom it says the method is available on .NET Core 2.0, 2.1, 2.2, 3.0, 3.1. You can always check Microsoft's documentation for things like that.
Chris Copeland 20-May-21 9:39am View
   
Have you checked in the Debug output window? Normally when there's an issue with XAML either loading or rendering a resource then it will print out a message accordingly.
Chris Copeland 20-May-21 8:02am View
   
Did you do as I asked and put a breakpoint in the code to see what happens when it runs? Sounds like the code isn't running at all, which could indicate it's not being triggered for some reason. Unfortunately we can't see the rest of your code, nor do we understand how the code should be triggering, so we can't provide that answer.
Chris Copeland 20-May-21 5:39am View
   
What doesn't work, are you getting an exception or is the sound just not playing? The update you provided to your question doesn't match the example that I provided in the link I sent, instead it seems to be using the example from the question itself where the author says that using the new Uri() and MediaPlayer doesn't work.
Chris Copeland 20-May-21 5:34am View
   
What part isn't working? Are you not seeing the count in the textbox, or is the code just not running? Have you tried putting a breakpoint in the code to step through line-by-line and see where you're not getting the results you want?
Chris Copeland 20-May-21 4:27am View
   
If it works under UWP and not under WPF then I suspect there's some difference in the way that the binding works. It would be good if you could provide some of the code surrounding the binding and the view-model so we can take a look and work out what the problem is.
Chris Copeland 14-May-21 4:15am View
   
You haven't given us enough code to investigate or work out what is wrong. I'm not even sure the code you have given us is correct because from first glance it looks like it wouldn't compile. If TxtName is a TextBox then it will not have a texte property. Please post the actual code you're using!
Chris Copeland 30-Apr-21 4:32am View
   
You haven't provided us with any examples or code so we can't diagnose the issue. We need to be able to see what you've written in order to be able to provide help.
Chris Copeland 29-Apr-21 10:28am View
   
And what is the outcome of this code? Do you see the error message? Have you tried debugging the code, stepping through line by line and seeing what the value of path is to make sure it's pointing to the file that you intend to read?
Chris Copeland 25-Mar-21 7:39am View
   
When you say it's not working outside of the function, does the script produce any errors? Have you tried debugging it within the browser to see what part is failing?

I can see immediately that your for loop is checking i<=listcheck.length, you probably need to do a < check instead.
Chris Copeland 19-Mar-21 6:51am View
   
The code you've been provided already loops over the elements you're interested in within the iframe, so the p in the sample code is going to be the elements you need to bind the click event listener to. You just need to write the code which adds the event listener to the p element, calling a function which then prints the text.
Chris Copeland 15-Mar-21 5:34am View
   
Have you tried debugging the code, stepping through and examining the exception that's occurring? One thing that comes to mind is that you're creating the ChromiumWebBrowser and telling it to load the URL, but you're not subscribing to the LoadingStateChanged event to make sure the page has finished loading before you try and print to PDF.

The exception details would provide more information.
Chris Copeland 12-Mar-21 10:34am View
   
What isn't working exactly? You'd need to make your "Main" method method async, make the "PrintToPdfAsync" method async, and await the entire chain. If you don't, what's going to happen is the application is going to close before it's had a chance to print the PDF.
Chris Copeland 11-Mar-21 9:43am View
   
So the code looks like it will handle a new column being added automatically, so what you need to do is amend the query that you're running to select the serial number from the relevant table.
Chris Copeland 10-Mar-21 5:21am View
   
Are you sure the code you've provided is correct? The JS which assigns the value of data appears to be missing the array parenthesis [] to indicate a collection of objects.
Chris Copeland 9-Mar-21 8:17am View
   
For the issue with only one row being printed, it's probably because the line starting $publishedClasses .= .. isn't contained inside the while loop so it's not going to run on every row. You'd need to move it within the loop to make sure it runs for each record, at the moment it'll only run when the loop has ended.
Chris Copeland 5-Mar-21 5:02am View
   
May I ask why you think this would be necessary? In theory an ASP.NET server would be running on a non-client machine, probably a server somewhere within the infrastructure of the business. Your application code shouldn't be exposed to users, only to administrators maintaining the software, who would probably have access to the password stored in a configuration file?
Chris Copeland 5-Mar-21 4:21am View
   
I found this online documentation[^] which seems to document how to configure CORS in Web API. As I said in my post, you need to "allow" the "localhost" domain to connect to the API.
Chris Copeland 1-Mar-21 10:11am View
   
When you say "async method failed", what do you mean? Which part of the code is failing, do you have an exception?

You also seem to be calling updatepromodetails without using await from the for loop, which means it's going to run and the loop is going to immediate jump to the sleep line. Is that intended?
Chris Copeland 1-Mar-21 6:52am View
   
Certainly, you can see the documentation to be informed of where the data files sit. If the files aren't encrypted (they likely will be, however) then you could easily look at them.

Remember that the likes of Oracle/MSSQL are written in lower-level languages, and will employ enterprise-level methods for protecting the files, making them much harder to decrypt.
Chris Copeland 1-Mar-21 6:27am View
   
It sort of sounds like you want to protect data in a file, and what you might find is it's very difficult to do so. You can perform algorithms on the data, and even encrypt the data using an encryption algorithm (with a key used to decrypt), but you should be aware that it's relatively easy to open a DLL or EXE in a decompilation tool (like ILSpy) and see what that process is.

That process becomes a little more involved once you move down to C/C++ or ASM, but it's still something that can happen.
Chris Copeland 25-Feb-21 8:14am View
   
Sure, I just had a look at this StackOverflow post :)
Chris Copeland 25-Feb-21 6:11am View
   
Thanks!
Chris Copeland 25-Feb-21 6:11am View
   
Just did a quick bit of research on this, apparently you need to use ValueType instead. So to get it working I changed Dim oStruct As Object = CType(rStruct, Object) to Dim oStruct As ValueType = rStruct and that seemed to work
Chris Copeland 25-Feb-21 5:24am View
   
You need to unbox the struct again afterwards, as this contains the reference that was passed into the method. After calling SetValue() unbox the structure again and you should see the amended field.
Chris Copeland 11-Jan-21 11:51am View
   
You've changed the code since this solution was suggested. You're using binding now, but where have you added the SelectedFiles property? Is it on the control/page itself If so, does it use the DependencyProperty model which WPF expects?

Also your code example shows you setting the DataContext of the ListBox to the list itself, and then trying to read a child property called SelectedFiles. Instead, you might want to change your ItemsSource to just "{Binding}"
Chris Copeland 3-Nov-20 8:29am View
   
This is a duplicate of the question you asked on this previous question, did you take the time to read the responses on there?
Chris Copeland 29-Oct-20 11:08am View
   
In addition to the above, after some more searching it might be possible to run an application directly from a byte[] array variable, this would mean loading the embedded resource directly into memory. See this response.

However this doesn't mitigate the fact that an embedded resource in a .NET application can be extracted regardless, so it wouldn't offer complete protection.
Chris Copeland 29-Oct-20 11:05am View
   
Correct, if they can work out where the file was extracted to then it would be possible for them to access it. Similarly if another developer was interested in accessing it, it would be relatively simple for them to extract it from your application directly.

Your best bet would be to extract it to an obscure location, but even then it would take little effort to open Task Manager or Command Prompt to find where it's executing from. I saw some comments on some Stackoverflow questions which seemed to indicate it might be possible by effectively emulating a Windows loader, but I imagine the work involved in this could be quite large.
Chris Copeland 23-Oct-20 8:26am View
   
On the back of my previous comment perhaps sounding a bit ignorant or obtuse, have you looked into the WPF TabControl? That should give you a good starting place.
Chris Copeland 23-Oct-20 8:24am View
   
What seems to be the actual problem here? You've explained what you've achieved, and you've explained when the next part of the process needs to be, but you've not actually described a problem or error that might need some help.

If the purpose of this post was to request help developing this, that's not what the question section is for. You need to build the code, build the interface, develop and debug things, and then if you hit a problem or impasse, we can provide help with that. If you've not actually developed anything yet then there's not much we can really do to help with that.
Chris Copeland 20-Oct-20 8:12am View
   
Have you validated that the value of getSessionValue matches the ID of the element you're trying to update?

If you're using a more recent version of jQuery you could also try using $(getSessionValue).prop('aria-expanded', 'true'); which seems to be a preferred choice for getting/setting element attributes.
Chris Copeland 15-Oct-20 11:04am View
   
Have you tried debugging this in your browser and see what happens? Are you sure that the value of getSessionValue contains the expected element id?

I did a quick check to see what the $.cookie function does and apparently to read the value of a cookie you shouldn't be passing in another argument other than the cookie name. So I would expect your code to read var getSessionValue = $.cookie('saved_index');
Chris Copeland 15-Oct-20 4:42am View
   
Perhaps it might be worth trying to change the "public_html/" to "/public_html/" and also add a "/" onto the end of the $upload variable. I would think this should resolve your problem. You could also look at using the error_get_last() function to get information on what might have happened?
Chris Copeland 14-Oct-20 10:53am View
   
Several questions on the back of this code:

1. The $upload points to "public_html/.." but should this not be "/public_html/.." as this would normally be the root directory?
2. The $upload also points to "../assests/" which I would assume is meant to be called "assets" instead, are the directory namings correct?
3. The $upload ends with "../music" and then you're appending the filename to this. This would then try and create a file called "/public_html/assests/music<filename>", should the $upload not end with a "/" to indicate that it's a directory?
4. Have you checked the CHMOD permissions on the "assests" and "music" directories to make sure they have the necessary rights to be written to? Something like 0666 should provide read/write access to that directory.
Chris Copeland 6-Oct-20 4:35am View
   
Isn't this essentially the same question as you asked previously? Did you try using the answer given by Richard MacCutchan[^], as you marked it as solved?
Chris Copeland 2-Oct-20 8:46am View
   
As Sandeep Mewara mentioned, have you tried debugging the code and stepping through it line-by-line to see which variables are null? That's not something we can do for you, you have to do that yourself.
Chris Copeland 15-Sep-20 12:06pm View
   
Can you provide more information on what the JPEGStream is producing? I understand they'll be images, but what resolution are they? Are they full RGB or just black and white? And what sort of network speeds are you seeing?

I think the former question will provide more information as image scaling expected by the PictureBox code play an enormous role in how efficient the pictures are rendered.
Chris Copeland 11-Sep-20 4:33am View
   
That would be an optimal solution if your server is going to be moving around and switching networks. If you Google "dynamic dns" you'll find some recommendations. I saw another solution involving setting up a VPN on your router, but if you're switching networks then that probably defeats the purpose.
Chris Copeland 12-Aug-20 4:25am View
   
In your code examples you're using $_FILES but in the question title you mention $_POST, so which one is the one you're trying to use? You should be using $_FILES['file']['tmp_name'], and you've also not provided any code where you're attempting to get the temporary path.
Chris Copeland 11-Aug-20 9:49am View
   
That's unfortunate. Without being able to manipulate the output, I don't think there's any standard way in C# to decode a PHP array output to an object.

In this case you would probably need to either: a) manually parse the response character by character to extract the values you need; b) use regular expressions to extract the information from the text; c) use regular expressions to reformat the response into a valid JSON format and then attempt to deserialize it.

An example regular expression might be something like \[result\]\s+?\=\>\s+?(true|false)
Chris Copeland 24-Oct-19 5:59am View
   
I can't see, in the code you provided, where you're actually adding to the person object to the dictionary?
Chris Copeland 5-Sep-19 11:16am View
   
As RickZeeland explained below, you can use the Id property of a Process object to retrieve the pid.
Chris Copeland 3-Jan-19 11:21am View
   
Sorry for not getting back sooner on this, I was busy over December! It's likely that $searchQuery can be empty or null, and therefore the query would end with " WHERE ", which is invalid. Ideally you'd want to check whether the search query actually has a value, and perhaps adjust the content accordingly:

if ($searchQuery != '') {  $searchQuery = ' WHERE '.$searchQuery;}


You can then use that in your query which would only include the clause if it was populated. If you were to leave it is a "WHERE 1" then the $searchQuery variable would need to begin with " AND "
Chris Copeland 19-Apr-16 12:03pm View
   
That's almost what I need. I've managed to improve the current state of the control using a UniformGrid with a column definition:

<pre lang="c#"><ItemsPanelTemplate>
<UniformGrid Columns="9" IsItemsHost="True"/>
</ItemsPanelTemplate></pre>

This does resize the column widths to the correct percentile to fill the horizontal space, however the rows (as you mentioned) do overlap slightly. I'm seeing a small (perhaps 50 or 100 pixels) of the next row within the ListBox. The only question is, is it possible to make the rows stretch vertically as well as the equal stretch horizontally.

Thanks!
Chris Copeland 22-Feb-16 6:44am View
   
Thanks for the input, I managed to resolve this using the classpath parameter and manually specifying the JAR path and lib directory.
Chris Copeland 1-Dec-15 11:24am View
   
That fixed the issue up, thanks for the help!