|
To support what Griff has already said, the thing you need to do most in order to enter the market as a professional developer is to create working applications. Find projects that pique your interest. There are plenty of articles here on CP that represent working applications.
Look at the CP home page. Set your filter to C#, and then browse the articles that it shows. Good luck!
The difficult we do right away...
...the impossible takes slightly longer.
|
|
|
|
|
Thank you for your responses.
Blazor seems intresting because it is used for frontend and for backend development, this thing looks atractive I will take a look on it.
Thank you for your time.
|
|
|
|
|
coco243 wrote: Blazor seems intresting because it is used for frontend
I suggest javascript rather than that. There is more market for javascript.
|
|
|
|
|
imho, you need to make decisions about:
1) type of app(s): windows, mac, linux ... or, app that runs on all those, or, only runs in browsers.
2) if you choose the .NET framework, language choice gets easier.
3) front-end, and/or back-end ? MS facility or non-MS backend tools ?
i suggest you start by using WinForms ... get familiar with interacting with controls using events ... understand inheritance (classes, subclasses), and using interfaces. study use of abstract and virtual.
There excellent books on learning C# WinForms.
imho, what you learn will help you move to another .NET language and/or .NET framework.
«The mind is not a vessel to be filled but a fire to be kindled» Plutarch
|
|
|
|
|
When I finished to read the C# introduction book thats were the questions în my head, to start with UI windows programming or web developing?
The ideea is that I've spended a lot of time with C++ and WINAPI without
succeding entering in the freelanging programming market and now I wish to get the way that leads me to be able to work and make an income while I am adding more and more knowledge, I want to learn tools that help me not those that pushes me away from my goal.
Thank you
|
|
|
|
|
coco243 wrote: I want to learn tools that help me not those that pushes me away from my goal. i've given you my best advice ... how long are you going to sit by the river, thirsty, thinking about what's the best water ?
Make choices, and get to work. Research skills most in use now, that companies are hiring entry-level positions for.
«The mind is not a vessel to be filled but a fire to be kindled» Plutarch
|
|
|
|
|
Forget about freelancing for the moment, you are focusing on the wrong issue. Decide whether you want to do desktop or web apps and get learning and practicing on the skills you need for whichever path you choose. Then find a job that will increase your learning and experience and give you a solid grounding in the commercial world. Only then will you have the necessary attributes to consider looking for freelance work.
|
|
|
|
|
I "reimaged" myself along your line of thought but scanned the web sites first to determine where the demand lay. I went for (small) fixed bids, to open hourly (no web cams or keyboard loggers, thank you) ... then took that experience and parlayed that into independent long term contracts. All remote. I focused on .NET at the time which has carried me for the last 15+ years.
I'd become an "AI expert" today ... but I think half of it is a con. Ethics.
"Before entering on an understanding, I have meditated for a long time, and have foreseen what might happen. It is not genius which reveals to me suddenly, secretly, what I have to say or to do in a circumstance unexpected by other people; it is reflection, it is meditation." - Napoleon I
|
|
|
|
|
Yey Gerry, something like that I am doing now, for the moment I have started some blazor tutorials on microsoft site to see what blazor can do and what can I do with it and also I pay attention on some freelancing sites to see the demand.
|
|
|
|
|
I'm refactoring some code that imports Google contacts. This screenshot[^] shows the parameters being sent. It is identical to the previous version, with the exception of the Client Id and Client Secret.
Now, for some reason, I'm getting this:
Google.Apis.Requests.RequestError
Request had insufficient authentication scopes. [403]
Errors [
Message[Insufficient Permission] Location[ - ] Reason[insufficientPermissions] Domain[global]
]
This appears to be complaining about the scope, yet it's hasn't changed. Not sure if that's what this message means.
I've been Googling & reading the docs, and I don't see what's wrong. I'm really stuck on this. Can someone point me in the right direction?
In theory, theory and practice are the same. But in practice, they never are.”
If it's not broken, fix it until it is.
Everything makes sense in someone's mind.
|
|
|
|
|
If you are refactoring code, and it worked before you started, then the obvious thing to do is go back to the original code and compare it to the refactored version - it's quite likely that scope for a variable has changed and it was (or is) "hiding" the required value, or perhaps you a missing a call that you needed before.
But without the original and refactored code, there really isn't anything we can do!
"I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
"Common sense is so rare these days, it should be classified as a super power" - Random T-shirt
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
The code is different because Google changed their auth process.
In theory, theory and practice are the same. But in practice, they never are.”
If it's not broken, fix it until it is.
Everything makes sense in someone's mind.
|
|
|
|
|
That's not refactoring!
Refactoring is the process of restructuring code, while not changing its original functionality. The goal of refactoring is to improve internal code by making many small changes without altering the code's external behavior.
You need to find out what the new process involves, and upgrade the code to be compliant. At a guess, Google will have a list of changes that need to be made - I'd start there, or ask their tech support.
"I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
"Common sense is so rare these days, it should be classified as a super power" - Random T-shirt
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
try
{
string message = "device=camera;item=ois;command=start;\\r\\n";
byte[] bytes = Encoding.ASCII.GetBytes(message);
Socket s = null;
IPEndPoint hostEndPoint;
IPAddress hostAddress = null;
int conPort = 80;
hostAddress = IPAddress.Parse("127.0.0.1");
hostEndPoint = new IPEndPoint(hostAddress, 9103);
s = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
s.ReceiveTimeout = 1000*15;
s.Connect(hostEndPoint);
if (!s.Connected)
{
Console.WriteLine("Unable to connect to host");
}
s.Send(bytes);
s.Close();
}
as my thought, the data should be sent out after sockct.send. but actually it don't work. the data been sent out after socket.close. i had been stuck by this 2 days. i had searched information using bing and google 2 days, nothing useful. it is suffering. it is appreciated for any suggestion. thanks.
[edit]
Closing <pre > tag added - OriginalGriff
[/edit]
i want to best
modified 5-Jul-23 0:10am.
|
|
|
|
|
Have you looked at this: Socket.Send Method (System.Net.Sockets) | Microsoft Learn[^]
Quote: If you are using a connection-oriented protocol, Send will block until the requested number of bytes are sent, unless a time-out was set by using Socket.SendTimeout. If the time-out value was exceeded, the Send call will throw a SocketException. In nonblocking mode, Send may complete successfully even if it sends less than the number of bytes you request. It is your application's responsibility to keep track of the number of bytes sent and to retry the operation until the application sends the requested number of bytes. There is also no guarantee that the data you send will appear on the network immediately. To increase network efficiency, the underlying system may delay transmission until a significant amount of outgoing data is collected. A successful completion of the Send method means that the underlying system has had room to buffer your data for a network send. You should probably read teh "Remarks" section for the Close method as well: Socket.Close Method (System.Net.Sockets) | Microsoft Learn[^]
And your code is a little odd: you check if the connection failed, explicitly report the problem, and then use the connection as if it had succeeded ...
"I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
"Common sense is so rare these days, it should be classified as a super power" - Random T-shirt
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
thank you ,my fellows. i made a misktake. i place wrong "//r//n" as "/r/n" ,but maybe server side is not so solid, when i closed the socket , it processed the data as normal. so it make me confused. thanks all the information.
i want to best
|
|
|
|
|
You're welcome!
"I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
"Common sense is so rare these days, it should be classified as a super power" - Random T-shirt
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
viming wrote: should be sent out after sockct.send
That is what I thought a long time ago.
But a 'socket' is just a implementation of the protocol 'TCP' (built on 'IP') and that is how it works. Actually a socket just connects to the OS driver that implements that.
I found that in practice it doesn't matter. It gets sent quickly enough.
Other thing you might keep in mind is that only writes, not reads, require that a socket is actually communicating. Thus if you unplug your computer from the network while a computer at the other end it waiting ('read') for you to send something it will stay that way forever (while application is running.)
There are several ways that can happen usually involving infrastructure failures. But just a simple as someone accidently unplugging a network cable (plugging the cable back in does not fix that.)
That is why reads must set a timeout. Every socket implementation I have used always sets that to infinite by default.
|
|
|
|
|
I have a problem with this code, because it gives me following error message
Object reference not set to an instance of an object when I use the line
values[countValues] = reader2.GetString("textinfo"); in the code below
Can someone help me?
<pre lang="C#">
public static string[] values;
int countValues = 0;
using (var connection = new MySqlConnection(connString))
{
connection.Open();
string query = "select * from showvalues where idvalue = '" + idStatus + "'";
using (var command2 = new MySqlCommand(query, connection))
{
using (var reader2 = command2.ExecuteReader())
{
while (reader2.Read())
{
listBoxMeasurement.Items.Add(reader2.GetString("textinfo"));
values[countValues] = reader2.GetString("textinfo");
countValues++;
}
countValues = 0;
connection.Close();
}
}
}
|
|
|
|
|
The values array doesn't exist. You defined it as something that CAN hold an array, but you never defined an array for it to hold.
An array can only exist when it is told how many elements it can hold:
public static string[] values;
values = new string[20];
|
|
|
|
|
A couple of things:
1) This is one of the most common problems we get asked, and it's also the one we are least equipped to answer, but you are most equipped to answer yourself.
Let me just explain what the error means: You have tried to use a variable, property, or a method return value but it contains null - which means that there is no instance of a class in the variable.
It's a bit like a pocket: you have a pocket in your shirt, which you use to hold a pen. If you reach into the pocket and find there isn't a pen there, you can't sign your name on a piece of paper - and you will get very funny looks if you try! The empty pocket is giving you a null value (no pen here!) so you can't do anything that you would normally do once you retrieved your pen. Why is it empty? That's the question - it may be that you forgot to pick up your pen when you left the house this morning, or possibly you left the pen in the pocket of yesterday's shirt when you took it off last night.
We can't tell, because we weren't there, and even more importantly, we can't even see your shirt, much less what is in the pocket!
Back to computers, and you have done the same thing, somehow - and we can't see your code, much less run it and find out what contains null when it shouldn't.
But you can - and Visual Studio will help you here. Run your program in the debugger and when it fails, it will show you the line it found the problem on. You can then start looking at the various parts of it to see what value is null and start looking back through your code to find out why. So put a breakpoint at the beginning of the method containing the error line, and run your program from the start again. This time, the debugger will stop before the error, and let you examine what is going on by stepping through the code looking at your values.
But we can't do that - we don't have your code, we don't know how to use it if we did have it, we don't have your data. So try it - and see how much information you can find out!
2) Never concatenate strings to build a SQL command. It leaves you wide open to accidental or deliberate SQL Injection attack which can destroy your entire database. Always use Parameterized queries instead.
When you concatenate strings, you cause problems because SQL receives commands like:
SELECT * FROM MyTable WHERE StreetAddress = 'Baker's Wood' The quote the user added terminates the string as far as SQL is concerned and you get problems. But it could be worse. If I come along and type this instead: "x';DROP TABLE MyTable;--" Then SQL receives a very different command:
SELECT * FROM MyTable WHERE StreetAddress = 'x';DROP TABLE MyTable; Which SQL sees as three separate commands:
SELECT * FROM MyTable WHERE StreetAddress = 'x'; A perfectly valid SELECT
DROP TABLE MyTable; A perfectly valid "delete the table" command
And everything else is a comment.
So it does: selects any matching rows, deletes the table from the DB, and ignores anything else.
So ALWAYS use parameterized queries! Or be prepared to restore your DB from backup frequently. You do take backups regularly, don't you?
"I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
"Common sense is so rare these days, it should be classified as a super power" - Random T-shirt
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
OriginalGriff wrote: It's a bit like a pocket:
Nice analogy.
|
|
|
|
|
I'm using the predicate builder like this:
foreach (var vendorAssignment in vendorAssignments)
{
var jobPredicate = PredicateBuilder.New<Job>();
jobPredicate = jobPredicate.And(x => x.AppCompanyId == 1);
jobPredicate = jobPredicate.And(x => !x.DeletedDT.HasValue);
jobPredicate = jobPredicate.And(x => x.Id == vendorAssignment.ParentId);
var job = (from j in dc.Jobs
select j).Where(jobPredicate).FirstOrDefault();
}
Do I need to redefine the PredicateBuilder for each loop iteration? Or is it possible to somehow do this?
var jobPredicate = PredicateBuilder.New<Job>();
jobPredicate = jobPredicate.And(x => x.AppCompanyId == 1);
jobPredicate = jobPredicate.And(x => !x.DeletedDT.HasValue);
foreach (var vendorAssignment in vendorAssignments)
{
jobPredicate = jobPredicate.And(x => x.Id == vendorAssignment.ParentId);
var job = (from j in dc.Jobs
select j).Where(jobPredicate).FirstOrDefault();
}
Is there some way to remove the job part somehow?
In theory, theory and practice are the same. But in practice, they never are.”
If it's not broken, fix it until it is.
Everything makes sense in someone's mind.
|
|
|
|
|
There is no way to remove part of the predicate. Once it's built, it stays that way.
In your example, since you're adding more and more And clauses in a loop and executing the query in each iteration of the loop, only the first query is going to match anything. All subsequent queries will try to match a single ID value against multiple values at the same time and fail. An ID cannot be both, for example, 2 and 3 at the same time.
You have two choices. If you have a small number of vendor assignments, you can change the And to an Or and execute the query once. I don't know if this is going to work for you as I don't know exactly what you're doing:
foreach (var vendorAssignment in vendorAssignments)
{
jobPredicate = jobPredicate.Or(x => x.Id == vendorAssignment.ParentId);
}
var job = (from j in dc.Jobs
select j).Where(jobPredicate).FirstOrDefault();
OR, and this will probably work better for you, you can build a base predicate and just use that as a template to append an And clause to it:
var basePredicate = PredicateBuilder.New<Job>();
basePredicate = basePredicate.And(x => x.AppCompanyId == 1);
basePredicate = basePredicate.And(x => !x.DeletedDT.HasValue);
foreach (var vendorAssignment in vendorAssignments)
{
var jobPredicate = basePredicate.And(x => x.Id == vendorAssignment.ParentId);
var job = (from j in dc.Jobs
select j).Where(jobPredicate).FirstOrDefault();
}
|
|
|
|
|
Thanks Dave. I actually have 3 different queries that use AppCompanyId and DeletedDT, so I think the base query is what I want.
In theory, theory and practice are the same. But in practice, they never are.”
If it's not broken, fix it until it is.
Everything makes sense in someone's mind.
|
|
|
|
|