.NET Programming

134K

Solutions

39K

Contributors

The .NET Framework is not specific to any one programming language; rather, it includes a library of functions that allows developers to rapidly build applications. Several supported languages include C#, VB.NET, C++ or ASP.NET.

Share tech news, updates, or what's on your mind.

Sign up to Post

Hi I need some help refining my regEx

I need to split the example the numbers eg ". 2 " however I also need  to split on "--n. 5 " and keep the "n."
Note: i'm first splitting on ". 1 " has the preceding Lexical doesn't have '--'

What I'm getting is every number, which I don't need!
I do need the Lexical If there is 1 And the sentance

using System;
using System.Collections.Generic;
using System.Text.RegularExpressions;

public class Example
{
    public static void Main()
    {
        Regex SentanceSpit = new Regex(@"\.(\s+\d+\s+)|\.--([a-z]+\.)\s+\d+\s+");
        string Line = @"abandon v. 1 give up or over, yield, surrender, leave, cede, let go, deliver (up), turn over, relinquish: I can see no reason why we should abandon the house to thieves and vandals. 2 depart from, leave, desert, quit, go away from: The order was given to abandon ship. 3 desert, forsake, jilt, walk out on: He even abandoned his fianc,e. 4 give up, renounce; discontinue, forgo, drop, desist, abstain from: She abandoned cigarettes and whisky after the doctor's warning.--n. 5 recklessness, intemperance, wantonness, lack of restraint, unrestraint: He behaved with wild abandon after he received the inheritance.";
        // Output strings
		string Term;
		string Lexical; // not every example have diferant Lexical
        string[] WordsExample;
        string[] Words;
        string Example;
		string[] FirstSecond = Regex.Split(Line, @"\s1\s");
		if (FirstSecond.Length ==2)
		{
			string 

Open in new window

0
Become a Certified Penetration Testing Engineer
LVL 19
Become a Certified Penetration Testing Engineer

This CPTE Certified Penetration Testing Engineer course covers everything you need to know about becoming a Certified Penetration Testing Engineer. Career Path: Professional roles include Ethical Hackers, Security Consultants, System Administrators, and Chief Security Officers.

I am having some difficulty reading from word autocorrect file which is named MSO2057.acl by Word and is in the following folder on my computer.

  C:\Users\Faheem.Ahmad\AppData\Roaming\Microsoft\Office

I am trying to get the total number of AutoCorrect Entries in my MSO2057.acl file using the following Macro Code

MsgBox Application.AutoCorrect.Entries.Count

Open in new window


When I run this code the message box tells me that I have got 17 Autocorrect Entries in my    .acl   file. This can't be correct because I know I have more than thousand Autocorrect Entries in my .acl file.  When I use the Autocorrect feature in my Word documents that works fine and I can certainly use all my Autocorrect short cuts which are stored in my .acl file. This shows that Word is reading correctly from my MSO2057.acl file. However, when it comes calculating the number of Autocorrect entries using the macro code I have provided above it looks the Word is looking into a different .acl file.
This problem is even more strange because only a couple of days ago, the same line of Macro code was giving me the correct number of Autocorrect entries.
I hope my question is clear.
I would like to know how this could be happening - why Word is not reading from my MSO2057.acl file when I run my macro code - but at the same word is reading from my MSO2057 file correctly when I am using the Autocorrect feature in Word.
0
I am new to aws cloud programming/services. I am starting out with aws beginner course. As a developer, I want to see if I can migrate and host my code/database to aws cloud. for example, I have an asp.net project . Does aws support .net platform ?
what is the best course/resource I can take a look at for this.
0
I am not a web developer, i am sys admins and i am trying to assist the web apps support dpt.

We have to environments:
UAT and PROD

In UAT if i browse to this URL:
http://pe01.uat.lcl/EWS-DEV/EngineService.svc I get the following on the browser

EngineService Service

You have created a service.

To test this service, you will need to create a client and use it to call the service. You can do this using the svcutil.exe tool from the command line with the following syntax:

svcutil.exe http://pe01.uat.lcl/EWS-DEV/EngineService.svc?wsdl

You can also access the service description as a single file:

http://pe01.uat.lcl/EWS-DEV/EngineService.svc?singleWsdl

This will generate a configuration file and a code file that contains the client class. Add the two files to your client application and use the generated client class to call the Service. For example:

C#
class Test
{
    static void Main()
    {
        EngineServiceClient client = new EngineServiceClient();
        // Use the 'client' variable to call operations on the service.
        // Always close the client.
        client.Close();
    }
}

Visual Basic
Class Test
    Shared Sub Main()
        Dim client As EngineServiceClient = New EngineServiceClient()
        ' Use the 'client' variable to call operations on the service.
        ' Always close the client.
        client.Close()
    End Sub
End Class

Open in new window


But if I go to PROD and browse
http://pe01.prod.lcl/EWS-PROD/EngineService.svc I get the following:

Server Error
404 - File or directory not found.
The resource you are looking for might have been removed, had its name changed, or is temporarily unavailable

Open in new window


Thanks for your your help
0
I open an excel program from my .net program. The user sends data to the cells and then closes the form inside excel.

How can I monitor this application close and if it does get closed I return to my .net application?
0
I need to embed a webbrowser to link to a specific website that will only work in Google Chrome or FireFox - they are not supporting IE.

I am using windows forms in visual studio (vb.net)

Can I embed a webbrowser that will run Chrome or Firefox embedded in my form and NOT opening up in a separate window?

Thanks!
0
Hello Experts,
I have a GridView, where I want to add a DropDown column.  When the page is loaded, the drop down should be populated with its selected value.  Please let me know how to achieve it.
FYI, I am using ASP.NET and C#.  Please try to help.  Thank you in advance.

Thank you!
0
I am getting script errors when using a Webbrowser embedded in a .NET Windows forms VS19 project, using VB.
Using a simple form with just the Webbrowser control and setting the URL to a login page that works fine in Edge or an external IE window, the project immediately returns JS errors and fails. I can supress the error display, but the URL still, of course, fails.

An error has occurred in the script on this page
Line: 1
Char: 1
Error: Syntax error
Code: 0

I've tried this with all versions of VS from 10  up to 19, using a WIndows10 machine with Edge and IE installed.

Can anyone help, please?
Thanks
0
Hi Expert,
I have advice to use Webhook to get data and they provided the Json file.see below.
But i need to understand how to get data from server. for example how to write the code (c#)for when candidateStatusUpdated updated how i catch the data.
I understand server will send data. so i need to understand what are the steps i have to use.



{
    "_id" : String,
    "type" : "candidateStatusUpdated",
    "object" : {
        "company" : {
            "_id" : String,
            "name" : String,
            "friendly_id" : String,
        },
        "position" : {
            "_id" : String,
            "name" : String,
            "location" : {
                "name" : String
            },
        },
        "stage_was" : {
            "id" : String,
            "name" : String
        },
        "entered_previous_stage" : Date,
        "stage" : {
            "id" : String,
            "name" : String
        },
        "entered_stage" : Date,
        "candidate" : {
            "_id" : String,
            "name" : String,
            "email_address" : String,
            "phone_number" : String,
            "profile_photo_url" : String,
        },
        "acting_user" : {
            "_id" : String,
            "email_address" : String,
            "name" : String
        },
        "time_in_previous_stage" : Number,
    },
    "creation_date" : Date
}

Open in new window

0
I Unable to install .net 3.5 on Server 2016 STD

I have tried using the wizard by default and also pointing to e:\sources\sxs\ (DVD)

dism /online /enable-feature /featurename:netfx3 /all /limitaccess /source:e:\sources\sxs
Get error messege 14081
0
Microsoft Azure 2017
LVL 19
Microsoft Azure 2017

Azure has a changed a lot since it was originally introduce by adding new services and features. Do you know everything you need to about Azure? This course will teach you about the Azure App Service, monitoring and application insights, DevOps, and Team Services.

Hi Expert,
I'm geeting error in the object "Invalid token 'object' in class, struct, or interface member declaration"

but if i changed to _object it's no error but no records showing
any idea how to use this Json results. I will really appriciated if any one show me where i'm doing mistake.

public Object object { get; set; }


Json results
 [
    {
        "_id": "weew",
        "type": "companyNotePosted",
        "stream_id": "ewewe",
        "object": {
            "body": "dsfdf",
            "attachments": [],
            "company_id": "eerer",
            "acting_user": {
                "_id": "4444",
                "email_address": "erer",
                "name": "ere",
                "username": "rere",
                "initial": "G",
                "creation_date": "2018-01-18T15:15:39.704Z",
                "verified_email": true,
                "updated_date": "2019-06-28T08:54:02.820Z"
            },
            "mentioned": {
                "7c017c82d5a9": {
                    "_id": "7c017c82d5a9",
                    "email_address": "errer",
                    "hex_color": "color3",
                    "initial": "s",
                    "name": "ffff",
                    "tz_offset": -60,
                    "creation_date": "2019-05-08T08:32:35.570Z",
                    "terms": "2019-06-05T13:15:52.406Z",
                    "username": "ffff",
                    "notification_settings": {
                        

Open in new window

0
I have 1 server with a bunch of micro services that ingest data from gps tracking units

Each micro service maintains it own cache to stop expensive round trips to the database
This works really well, and performance is good

Now we want to horizontally scale and load balance the data
However, in our tests we see the car report to one server, then on next TCP session it jumps to a different server where the cache is not the same
When we do things like software odometer, this really screws up and things go out of sync

The obvious thing is to move to some sort of distributed cache, but considering we are processing 60,000 records a second, having a distributed cache will obviously be slower due to the networking aspect, each record may hit the cache 6 times
I've been looking at redis which looks quick, but again, the networking aspect seems to be the bottle neck.

I was thinking of having some sort of syncing mechanism which distributes to all the servers, but i'm not sure if this would just be way too complicated or if this type of issue has been addressed before with some sort of framework

I'm open to ideas here on option and areas to investigate
Our stack is mainly .net core console apps/services with some java apps
0
I'm planning to put a DataGrid or ListView controls to my WPF desktop application. In fact i couldn't decide it which control or structure is best fitting my requirements. So i'd like to explain my aim.

1) There's a list of pre-defined checks for users
2) I'd like to show these all checks(Appx. 20-25 Checks) to user
3) User will select which checks they want to RUN
4) Prompt user about check status (IN QUE, STARTED, FINISHED)
5) I'd like to give access links for finished checks' output files.

 wpf_1.pngwpf_2.pngwpf_3.png
Each checks has own function in sample class file like below

namespace WpfTestApp
{
    internal static class Class1
    {
        public static void RUN()
        {
            // RUN CODE
        }


        public static void NamingCheck()
        {
            //some coding stuff in here for QAZ0001
        }

        public static void ConsistencyCheck()
        {
            //some coding stuff in here WSX0005
        }

        public static void MetricsCheck()
        {
            //some coding stuff in here EDC0010
        }

        public static void ComprasionCheck()
        {
            //some coding stuff in here RFV0002
        }

    }
}

Open in new window




I tried to figure out how it look like, you can find on attachment files.

I'm newbie at WPF and have some challanges and i'd like to ask experts.

1) When clicked "RUN" button how should be code structure, because it should only run selected checks.
2) How to update container control for "Progress Status" and "Output File" sections on runtime.

and most important thing is for me how to bind these checks to control.

3) Because i'm planning to add DataGrid or ListView.DataGrid from MaterialDesignXAMLToolkit and as you can see from attached picture"wpf_sample_controls.png", i have to binding them. How can i handle it?

Any help would be grateful! I'm really appreciate if you can guide me!

Thank you.wpf_sample_controls.png
0
Hi,

I have create 2 classes. the problem is following List no records is showing
public class DirectoryResponse
    {
        public List<Company> Companyname { get; set; }
    }


    [XmlType(TypeName = "Company")]
    public class Company
    {
    public string _id { get; set; }
    public string  name { get; set; }
    public string friendly_id { get; set; }
    public DateTime creation_date { get; set; }
    public DateTime updated_date { get; set; }
    public int member_count { get; set; }
    public string initial { get; set; }

    
    





    }

Open in new window


Call form following class

RestAPI1 Class

public  List<Company> GetCompanyDetails(bool onlyCurrent = true)
        {


 var raw = response.Content.Replace("Date\":\"0000-00-00\"", "Date\":null").RemoveTroublesomeCharacters();
                var package = JsonConvert.DeserializeObject<DirectoryResponse>(raw);
                // return JsonConvert.DeserializeObject<T>(s);
                //raw.FromJson<DirectoryResponse>()



                if (package != null)
                {


                    var com = package.Companyname;

                    return com;
}

Open in new window


No errors . But no records returning. When it's debug raw variable get all the results.
But package.Companyname is not getting results


 Interface of  RestAPI1 Class
public interface IrestClient
    {
        List<Company> GetCompanyDetails(bool onlyCurrent = true);
    }

Open in new window

0
Hi Experts!

Need help with the following Iinq query. The issue is that the query causes a stackover flow error. Is there a better way to write this in Linq?
One option is to gather all 'people' into memory and then do a for loop through 'perToSearch' and see if it can be found in 'people'.
So, there are many records in 'people' (>100K) and 'perToSearch' (>100K), the example below is to simplify the data set.

Here's the code:
using System;
using System.Collections.Generic;
using System.Linq;
using Microsoft.VisualStudio.TestTools.UnitTesting;

namespace UnitTestProject2
{

    internal class Person
    {   public int  PerId;
        public string FirstName;
        public string LastName;
    }

    [TestClass]
    public class UnitTest2
    {
        [TestMethod]
        public void LinqQuery()
        {
            //Arrange
            List<Person> people = new List<Person>()
            {
                new Person() {PerId = 1, FirstName = "Deku", LastName = "Midoriya"},
                new Person() {PerId = 1, FirstName = "Shoto", LastName = "Todoroki"},
                new Person() {PerId = 1, FirstName = "Ochaco", LastName = "Uraraka"},
            };

            List<int> perToSearch = new List<int>() { 1, 2, 3, 4, 5, 6 };

            //Act
            var x = (from p in people
                     where perToSearch.Contains(p.PerId)
                     select p).ToList();
        }
    }
}

Open in new window

0
Greetings

I have getting a strange error while testing an ASP.NET application. I am using a test account to access the application. It is currently running on a test server. I can access the application, I can navigate through application. There is however, one issue I have found when accessing a particular page. I am asked for my credentials again. If I ignore the request I get a 401 error and if I provide the credentials again, it get "Cannot reach this page" error (see attached). I tried a few times, the apppool will stop and I will need to restart it.

No errors reported in the logs or in the application's exceptions.

When running locally (debugging), no issues.

Any thoughts?
0
I have ASP.NET master page with Menu Control and I need to make it 508 compliance which requires onFocus and onBlur events for keyboard equivalent to OnMouseOver and OnMouseOut event. ASP Menu control doesn't provide these events out of box.

I tried Attributes.Add on pageload but it doesn't work for MenuItems.

<asp:Menu ID="Menu1" runat="server">
  <Items>
     <asp:MenuItem Text="Files" Value="File" NavigateUrl="~/HomePage.aspx">
           <asp:MenuItem Text="Items" NavigateUrl="/ItemSelect.aspx" ></asp:MenuItem>
     </asp:MenuItem>
  </Items>
</asp:Menu>

How can I add onFocus and onBlur events for ASP Menu control?
0
I'm having a little trouble customizing my DataGrid to display things exactly the way I want them to. I have so far been able to establish groups and subgroups and that is working. The only thing I'm struggling with now is customizing the subgroup expander headers. The image below should help illustrate what I mean.
DataGrid screenshotThe area highlighted in green has no text value to display. It therefore just shows the expander button but no heading. I'd prefer it if in this case the height of the expander header was 0 (or the header was just hidden).
For the area highlighted in yellow it's almost perfect. The only thing I want to change is to eliminate the single pixel border above the expander header because this is a subgroup.
Here is my Xaml markup:
    <UserControl.Resources>

        <Style TargetType="DataGridCell">
            <Setter Property="IsTabStop" Value="False"/>
        </Style>

        <ControlTemplate x:Key="ExpanderButtonTemplate" TargetType="{x:Type ToggleButton}">
            <Border Background="{TemplateBinding Background}"
                    BorderBrush="{TemplateBinding BorderBrush}"
                    BorderThickness="{TemplateBinding BorderThickness}"
                    Padding="{TemplateBinding Padding}"
                    Margin="0,5,0,5">
                <Grid>
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="Auto"/>
                        <ColumnDefinition Width="*"/>
           

Open in new window

0
Hi,

 

Can you help on this?

 I am using .net 2017(4.5.2).

Rebex.Net.Sftp.dll is not working in Visual studio .net version 2017 (4.5.2) which was working fine in Visual studio .net version 2015 .

 

In 2015, the same dll was working fine without license key but in 2017 it is not working without license key.

 

please help to provide a similar dll which works in .net version 4.5.2 without license key.

 

Error message as below:

 

Trial license key for Rebex.Sftp not set. Please go to  https://www.rebex.net/support/trial-key.aspx to get one and start your 30-day trial period.

Can you please provide any other services to connect to remote server? which dlls i need to download also?
0
CompTIA Cloud+
LVL 19
CompTIA Cloud+

The CompTIA Cloud+ Basic training course will teach you about cloud concepts and models, data storage, networking, and network infrastructure.

Hello Experts,

I am  new to SSRS and I have deployed SSRS to the SERVER. The reports are getting opened on the Server but on my personal computer they are not opening. Please find attachments showing error.

error.PNG
error-in-Detail.PNG
set-up-screen.PNG
Server Configuration:
Windows Server 2012 R2
Mircosoft Report Viewer 2012 Runtime
Microsoft Report Viewer Redistributable 2008 SP1
Microsoft .NET Framework 4 Mulit-Targeting Pack

While I was working on it I also found following issue :

Could not load file or assembly 'Microsoft.ReportViewer.WebForms, Version=9.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)

But I see its not coming now and I did not even provide version 9.0.0.0 assembly to it because I have only 8.0.0.0 version.

More Inputs:
I have just deployed the Reports on Server on my local server they are working well.
reports url is being referenced from code as following:

WhatsApp-Image-2019-11-01-at-02.50..jpeg

Please help!
0
I have an app that has a native login, google login, facebook login, and login with apple.
 
Right now, the flow is that the authentication request  hits our auth controller, and then is directed to their respective function based on a authentication parameter. Is this best practice? Or should we create different controllers for each? The issue is for some fields we have username and password, and other (like apple) we have an UID and a Token, so we can pass the UID and Token as "username and password" but it seems hack, would there be a better way to do this?
0
I am trying to install .NET Framework 4.8 via powershell.  There is nothing that shows what the command is.

Does anyone have a small script or one line command that I can use.   I want to use this in a task sequence in MDT 2012 .

Thanks
0
Dear EE,

My Web server stuck and i restarted it. In event log below is the error i see.

1.      Message : ORA-03113: end-of-file on communication channel

Details:
Message: HandlingInstanceID: 12d6bbb6-8560-4a7d-9eb7-2a5ea0adfdd0
An exception of type 'Oracle.DataAccess.Client.OracleException' occurred and was caught.
----------------------------------------------------------------------------------------
10/16/2019 09:13:18
Type : Oracle.DataAccess.Client.OracleException, Oracle.DataAccess, Version=2.112.1.0, Culture=neutral, PublicKeyToken=89b483f429c47342
Message : ORA-03113: end-of-file on communication channel
Process ID: 144215
Session ID: 554 Serial number: 15831
Source : Oracle Data Provider for .NET
Help link :
Errors : Oracle.DataAccess.Client.OracleErrorCollection
DataSource : NETSOLprod
Procedure : PAC_SER_ChangePOSStatus
Number : 3113
ErrorCode : -2147467259
Data : System.Collections.ListDictionaryInternal
TargetSite : Void HandleErrorHelper(Int32, Oracle.DataAccess.Client.OracleConnection, IntPtr, Oracle.DataAccess.Client.OpoSqlValCtx*, System.Object, System.String, Boolean)
HResult : -2147467259
Stack Trace :    at Oracle.DataAccess.Client.OracleException.HandleErrorHelper(Int32 errCode, OracleConnection conn, IntPtr opsErrCtx, OpoSqlValCtx* pOpoSqlValCtx, Object src, String procedure, Boolean bCheck)
   at Oracle.DataAccess.Client.OracleException.HandleError(Int32 errCode, OracleConnection conn, String procedure, IntPtr opsErrCtx,
0
I'm still learning so much about Xaml but one thing I currently need is a background that looks like alternating colors of grid rows like this:
GridlinesI'm reasonably sure I'd use a VisualBrush element to do this but I honestly have no idea how to construct the thing. I need a thin border between each "row" and every alternate "row" needs a different color.
0
I'd like to have a different appearance for an element when it's inside a StackPanel vs when inside another container. When in a StackPanel, I want the element to have a 5 pixel margin but not when inside other controls. Let Let me use the Rectangle object as an example. This might be the literal markup:
<Grid>
    <Grid.ColumnDefinitions>
        <ColumnDefinition Width="*"/>
        <ColumnDefinition Width="*"/>
    </Grid.ColumnDefinitions>
    <Rectangle Grid.Column="0" Fill="LightBlue" Width="70" Height="30" HorizontalAlignment="Left"/>
    <Rectangle Grid.Column="1" Fill="LightCoral" Width="70" Height="30" HorizontalAlignment="Left"/>
</Grid>
<StackPanel Orientation="Horizontal">
    <Rectangle Fill="LightBlue" Width="70" Height="30" HorizontalAlignment="Left" Margin="5"/>
    <Rectangle Fill="LightCoral" Width="70" Height="30" HorizontalAlignment="Left" Margin="5"/>
</StackPanel>

Open in new window

But what I want is for the Margin attribute to automatically be set whenever the rectangle is inside the StackPanel rather than me having to explicitly state it every time I insert one. I'm sure Xaml styles can accomplish this but I'm not sure how. Can anybody point me in the right direction?
0

.NET Programming

134K

Solutions

39K

Contributors

The .NET Framework is not specific to any one programming language; rather, it includes a library of functions that allows developers to rapidly build applications. Several supported languages include C#, VB.NET, C++ or ASP.NET.