|
Hi,
We are using Git Source Control for our project, for some reason we got a mess in our main branch when we were taking files from two branches, I want to check if there is any tool that can show us, the files that are different in two given branches if we put, just file names are enough for me, if it can show more details like what are those differences, that's also good, but if at least it shows me the files that are different it would be great.
|
|
|
|
|
|
my vs tool is : Visual Studio Community 2017 for Mac
Version 7.8.3 (build 2)
compile detail error: Error CS1056: Unexpected character '�' (CS1056)
how to fix this issue?
|
|
|
|
|
You have an invalid character in the source file that you are trying to compile. The message should include a line and character number telling you where the problem lies.
|
|
|
|
|
Hello
I am just wondering why, if I have these lines of code in my aspx file
<asp:label id="LblDate" runat="server" cssclass="dateStyle" text="Label">
<asp:panel id="pnlFormFields" runat="server">
<asp:panel id="pnlThankYouMessage" runat="server" cssclass="panel" visible="False">
why I would get the following red underlined errors (VS 2017) in my corresponding aspx.vb file:
pnlFormFields.Visible = False
pnlThankYouMessage.Visible = True
LblDate.Text = ReturnDate()
Not declared or inaccessible due to protection levels.
What should I have, please?
Thanks!
|
|
|
|
|
The most likely cause is that your controls are declared inside a data-bound control - FormView , GridView , ListView , etc.
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
Thanks, Richard, for replying.
I have this:
Function ReturnDate() As String
Code for ordinal date
End Function
And then:
Protected Sub SendEmail_Click(sender As Object, e As System.EventArgs)
SMTP code here
End Sub
And this, where the errors occur:
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
'user_name.Focus()
pnlFormFields.Visible = False
pnlThankYouMessage.Visible = True
LblDate.Text = ReturnDate()
End Sub
The forms tell the user 'thank you' when he clicks on 'Send' (the form), but I didn't think it would be part of the SMTP
Protected Sub SendEmail_Click , and I didn't think the 'show date'would be part of the Date Function, so I put the three lines of code above (the ones with the errors) in that
Protected Sub Page_Load
.
Thanks again.
|
|
|
|
|
As I said, the problem is most likely that your controls are part of a data-bound control. That's in the .aspx file, not the .aspx.vb file.
The other option would be if the CodeFile or Inherits attributes on the <%@ Page ... %> directive don't match the code-behind file.
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
That's now working fine, Richard, many thanks.
|
|
|
|
|
I am trying this from many days with no success,
User first fills the registration form and after clicking submit, all JavaScript validations should fire (no field should be blank and all fields should meet criteria) and after that,all details must be saved in database (SQL)server( created table in database) and grid view must be displayed.
1. In grid view, there must be two links (select and delete) starting of every row and also one addnew button on top of the grid view.
2. when clicked on addnew button, it should display only registration form with all empty fields and submit&reset buttons(Grid view should not be visible here, only form).
3. when clicked on select link, the selected row details must appear in registration form with corresponding field values inside text boxes and after modifying those details and clicked on update button( update button must be visible below registration form only) , details must bt updated to data base.
Validation part is completed and delete also working fine.
Can any one help me with remaining query?
|
|
|
|
|
Suppose I create an asp.net website project that loads data into griview from the class library, declaring the library to use loading data for griview
//file: ChitietSP.aspx
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Diagnostics; // Debug
using connectSQL; // warning
public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
LoadData();
}
}
string sSQL;
private void LoadData()
{
sSQL = "SELECT * FROM TABKHACHHANG ";
sSQL += "ORDER BY MASOPHIEU;";
GridView1.DataSource = ClsConnecSQL.FillDatatable(sSQL);
}
}
//file: clsConnecSQL.cs
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
//using connectSQL;
namespace connectSQL
{
public class ClsConnecSQL
{
public static DataTable FillDatatable(string sSQL)
{
//Do somthing...
}
}
}
I have declared the library namespace to be used is still error, asking you to help me
using connectSQL; // warning
GridView1.DataSource = ClsConnecSQL.FillDatatable (sSQL); // error not found connectSQL namespace
|
|
|
|
|
What is the error or warning that you see and where does it occur?
|
|
|
|
|
using connectSQL;
GridView1.DataSource = FillDatatable (sSQL);
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
"If you just follow the bacon Eddy, wherever it leads you, then you won't have to think about politics." -- Some Bell.
|
|
|
|
|
|
without errors as you described, I have an error not finding the derived class:
GridView1.DataSource = clsConnecSQL.FillDatatable(sSQL); //It's not find clsConnecSQL.xxx ???
|
|
|
|
|
in winForm I declare as above is a good run but in asp.net webForm why don't I understand the namespace, get rid of errors:
The type or namespace name 'connectSQL' could not be found (are you missing a using directive or an assembly reference?)
modified 19-Mar-19 0:02am.
|
|
|
|
|
Good day everyone!
This is one of the programming issue that I have ever faced and got totally confused about the right keywords to use. I want to capture the keywords that online users searching using any of the search engines used. Base on the keywords, I then make a search query on my webpage then display the appropriate result instead of irrelevant information.
For instance, if some searched for Building a happy home and my site luckily appears on SERP, by luck, the user clicks on site link; I would like to get the question Building a happy home then on my webpage make a search as
Dim key_Word as String
SELECT*FROM tablename WHERE columnName = key_Word
I tried UrlReferrer.ToString and Request.Urlreferrer.Host as suggested in some sites but returns only www.google.com without the question
Please how do I achieved this?
|
|
|
|
|
I think most search engines stop you doing this now, they want you to use their own tools to see that data.
|
|
|
|
|
Hello !
I have a question about what the best approach/design pattern could be to achieve communication between two or more MVC API's on the same machine.
Currently I have a single Web API delivering data to my web site. For reasons too long to explain here, we are refactoring the API to split it in multiple modules. One being the main API with the core information (think : Order database with detailed info), and the satellite API's having lists of orders, but without their details.
Of course, when a satellite API gets a request, it could just reply with the list of orders (which it knows of), but I want it to reply with the details of each orders ..
Important to mention is that all data is in memory, no database is behind the whole thing (otherwise it would be trivial).
Knowing that all API's would be on the same server, and that I obviously want to avoid ping-pong between the client site and the API's .. I would like to have my satellite API ask my main API about this information.
I have looked into WCF services, but I am not sure if that's the appropriate solution, and also about how to integrate it in my existing projects. I do already have the multiple API's running (not in prod) as normal ASP .Net MVC projects.
In an ideal world, I would simply "expose" a few methods from the main API, so that the other ones can call it. I've also looked at the other ways to do IPC, but I am unsure which would be best in my case.
Side questions about WCF Services:
- do they have to be a project of their own ? or could I say that a few methods in my API are the actual service ?
- What about the service reference that the client has to know of ? how do I specify where the service actually runs ? This is not necessarily known during dev, what if the server is hosted elsewhere ?
- Do I have to care about async calls here ?
Note: I'm obviously new to WCF, be kind
Thanks a lot
Fred
|
|
|
|
|
As you have tried to keep the question compact, the one-liner answer to this would be to use Microservices architecture and use each individual module as a separate service; read here .NET Microservices. Architecture for Containerized .NET Applications | Microsoft Docs
Quote: I have a single Web API delivering data to my web site. I can see a microservice here.
Quote: when a satellite API gets a request, Another microservice here.
Quote: Important to mention is that all data is in memory, no database is behind the whole thing (otherwise it would be trivial). Another microservice here, that manages the data for the entire system—keeping the data aside and giving it some high-availability, as if this service goes down, entire cluster is down. This is the point that you need to discuss with your team again. Quote: I would like to have my satellite API ask my main API about this information. Exactly the core benefit of microservice architecture, your clients would only need to know the website. Internal communication and services would be abstracted away from them.
Quote: I have looked into WCF services, WCF is quite old and doesn't quite fit the modern demands of the solutions. If, for instance, you would want to go to cloud hosting solutions, then microservices and their modern approach to communication is much more scalable and feasible. WCF although supports various protocols, sometimes that extra optionality is a downside. Trust me with this—or not.
Quote: I would simply "expose" a few methods from the main API, so that the other ones can call it. I've also looked at the other ways to do IPC, but I am unsure which would be best in my case. Since, ASP.NET Web API is based on REST, talk about REST mostly and in REST you can use services like OpenAPI (Swagger) and generate a documentation for the users that they can access.
About Swagger Specification | Documentation | Swagger | Swagger
Now coming to the last part of your question,
Quote: do they have to be a project of their own ? or could I say that a few methods in my API are the actual service ? You can decide, a single project might have more complex structure and developmental issues. Separate projects would be simpler to manage. This is for WCF and ASP.NET etc. For microservices, you should try to keep everything separate. You can even use different languages and runtimes.
Quote: What about the service reference that the client has to know of ? how do I specify where the service actually runs ? This is not necessarily known during dev, what if the server is hosted elsewhere ? You should consider using DNS for that. Most services are to be managed by the hosting providers, they allow you to control that. Your API definition will grant enough information to the users that they can manage it from there.
Quote: Do I have to care about async calls here ?
Yes, if you want to have a scalable solution, then yes. A friend of mine (along with me) worked on a course that speaks about the same thing, Asynchronous Programming in .NET Core [Video]
I hope this answers your questions.
The sh*t I complain about
It's like there ain't a cloud in the sky and it's raining out - Eminem
~! Firewall !~
|
|
|
|
|
Thanks !
I will dig deeper into the micro-services architecture, in fact, it's a bit my goal with each API.
Good to know that WCF can be left out of the picture.. it was kind of everywhere when I googled looking for alternatives :s
Fred
|
|
|
|
|
Yeah, I've played this game before, and while it's nice to think that everything is in memory and so it should be easy, there are some surprising hurdles that need to be cleared first. Here are some of my IPC notes.
The most important initial concern that you need to address is: what is the exact nature of the communications that need to occur between the services? Is the communication simplex or do we need duplex? What sort of update rate can we expect to see? Do we need to acknowledge connection (like TCP) or can we fire-and-forget (like UDP)? Will you only ever have 2 communicating modules, or might you want to add more down the line?
Defining the nature of the interactions will help you determine the appropriate technology to use. In the most basic model: one application writes data that can be read by another application, the easiest thing in the world is to have it write to a file that the other app(s) will read. This is a good, stable solution that works well in situations where race conditions are low-impact issues.
If you need duplex communications, things become slightly more complicated. For most purposes, a LocalDB instance can be used to share data between applications. This can work very well for bi-directional communication between applications, but, like the file method, it does not work for event-based interactions: it just shares flat data.
If the two processes need to talk, i.e. one needs to actively query the other, the level of complexity jumps considerably. You can query the other over the NIC using the standard WebAPI format and HttpClients, and that's likely to be your easiest solution. I know it sounds stupid, but having walked this path before, unless you're willing to spend some time architecting an IPC process, it is the easiest route. Another option is to have your process actively watch directories for changes and use the file approach, but there is a serious performance cost to implementing this solution.
The other option is to make use of an Inter-Process Communication (IPC) technology. In .NET that generally means using Pipes or Memory-Mapped Files. Both have benefits and pitfalls, but are best suited to event-driven processes and the communication of complex data.
Memory-Mapped files are the closest thing to what you're initially talking about. It's a section of memory that can be shared between multiple processes that has certain thread safety mechanisms that attempt to address concurrency problems. I can tell you from the start, there are complexities to using these that will surprise you, and I've not had enough success with these to advise you more about them.
Pipes are the IPC processor that I do know a bit more about, and they come in 2 flavors: named and anonymous. Named pipes provide a great mechanism for multiple processes to hook into a central bus and talk to one another. They're a good way to have an extensible system that future modules can hook into. Using them appropriately requires you to do a couple of things: first you must secure them appropriately because they are available via RPC over the network, and second is to develop an addressing and message-passing scheme for your modules.
Anonymous pipes are unidirectional (though 2 anon pipes used in conjucntion can provide full duplex communications) and work well when you have a pre-defined number of modules. The work in this case is moved from developing addressing/messaging over to initial establishment of the pipe.
There are other approaches, many encapsulated by WCF in fact, that are generally touched on here:
Interprocess Communications - Windows applications | Microsoft Docs
Anyway, have fun dipping into the joy that is IPC!
"Never attribute to malice that which can be explained by stupidity."
- Hanlon's Razor
|
|
|
|
|
The end game looks something like this:
- One main API
- Several smaller API's, mostly independant, but occasionally requiring to get data from the main API's in-memory repository.
If I had had the liberty to do it, I would have used Redis or something similar instead of having one in-memory repo for each API, but it's not a possibility due to company standards etc.. That would have been easy .. because aside from sharing some data, my API's don't really need to communicate.
Nathan Minier wrote: what is the exact nature of the communications that need to occur between the services? Smaller API's would just request info, and the main API would reply, never the other way around.
Nathan Minier wrote: Is the communication simplex or do we need duplex? Simplex. Only from the smaller API's to the main API, never the other way around (otherwise I'd have seriously screwed up my architecture..).
Nathan Minier wrote: What sort of update rate can we expect to see? The actual update of the data in the memory of the main API is not an issue, I already have a flip-flop mechanism that prevents delivering data while it is being updated. So basically anyone asking data is only getting it from the "active" part of the memory, while the "inactive" is being updated. Thus the smaller API's would also query from the "active" part. And I'm not managing TB's of data either
Nathan Minier wrote: Do we need to acknowledge connection (like TCP) or can we fire-and-forget (like UDP)? Fire & forget could do (it's on the same server) as long as I can ensure that there is no data loss (which screams more TCP than UDP anyway :s)
Nathan Minier wrote: Will you only ever have 2 communicating modules, or might you want to add more down the line?
One main, multiple "clients". They're not truly clients because all API's would be autonomous and managing their own set of data, but the whole thing is related, and in time, we will want to cover more business areas, so we will definitely have more "clients".
|
|
|
|
|
Hi All,
I am little (a lot in fact) hazy on ASP.NET authentication methods...
At any rate I am trying to diagnose the following problem on an existing web app that use OpenID to query our ADFS server to authenticate users.
We followed that process:
https://docs.microsoft.com/en-us/windows-server/identity/ad-fs/operations/configuring-alternate-login-id
And the AlternateLoginID is a custom LDAP attribute (namely interactUsername )
With some custom C# code I created a an AD user with the following properties:
UPNLogon: IU-3762@licensys.com
SAMAccountName: dev\IU-3762
interactUsername: llandersxA
when I try to login with llandersxA on the ADFS login page, it tells me:
Incorrect user ID or password. Type the correct user ID and password, and try again.
And replace the user name I entered (llandersxA ) with dev\llandersxA before trying again (which is not recognised either)
Any idea on what I might be missing? or link that could help on that topic?
Cheers!
[EDIT] the plot thickens!
If the interactUsername looks like an email, say llanderxA@foo.bar it works!
modified 4-Mar-19 22:33pm.
|
|
|
|
|
Please note I have very limited knowledge of MVC. I have found helpful articles using MVC on this topic, but am having trouble distinguishing MVC vs Core differences. For example, I found a great answer in this forum but I don't quite understand the controller portion.
I'm wanting to bind a dropdown list to a database table.
I have a Costcenters model (and in my context file I have "public virtual DbSet<costcenters> Costcenters { get; set; }"):
public partial class Costcenters
{
public int Id { get; set; }
public string CostcntrNo { get; set; }
public string CostcntrName { get; set; }
public string CostcntrMngr { get; set; }
}
I'd like to add the dropdown to my Register.cshtml page, submitting the Id but listing the CostcntrNo in the dropdown:
<select asp-for="Input.CostcntrId" class="form-control" asp-items="@(new SelectList(Model.Costcenters,"Id","CostcntrNo"))">
<option disabled selected style="display:none">--select an option--</option>
</select>
Here's the part I believe I'm messing up on. All I've added to Register.cshtml.cs so far for this is (shortened for the question):
public List<Costcenters> Costcenters { get; set; }
[BindProperty]
public InputModel Input { get; set; }
public class InputModel
{
[Required]
public int CostcntrId { get; set; }
}
public async Task<IActionResult> OnPostAsync(string returnUrl = null)
{
if (ModelState.IsValid)
{
var user = new ApplicationUser
{
CostcntrId = Input.CostcntrId
}
}
Would the easiest way to complete this be to add a "LINQ query" in here?
Currently when I run this in development, I receive the "Value cannot be null" error. I may be closer than I think, but I have a poor understanding of this method so any explanation is greatly appreciated.
|
|
|
|
|