Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x

.NET Programming

132K

Solutions

38K

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

Hello Experts

I am getting a json response from a URL which I am trying parse it and capture code to store in the DB

Its returning the string ok but I am unable to remove the quoted strings to save the code in the DB
 

 Dim jResults As Object = JObject.Parse(Json)
        Dim jsonResulttodict = JsonConvert.DeserializeObject(Of Dictionary(Of String, Object))(Json)
        Dim firstItem = jsonResulttodict.Item("error")
        Dim seconditem = jsonResulttodict.Item("success")
        Dim thirditem = jsonResulttodict.Item("codes")

example string:

'{"error":"","success":"1 code generated successfully","codes":["QTESTA2HLT"]}


I am getting the code as [{  "QTESTA2HLT"  }]

Al I want is to read as QTESTA2HLT

please advise

thanks
0
Vim Reference Guide
Vim Reference Guide

Vim is a powerful text editor favored by many sysadmins and developers - here are some commands that you'll want to keep in your back pocket!

Hello,
I need to draw a linebetween two rows of datagridview .
Example gridA and gridB are two grids. The user select row1 of gridA and row3 of gridB , there should a line drawn in between row1 of gridA and row3 of gridB.
I have tried a lot to achieve this but with little success. Any suggestions are highly appreciated.
Regards
0
I am trying to install .net framework 4 and it is taking alot of time. I have tried to manually force the windows installer and also downloaded another offline installer but still the same.

It takes more than an hour for the framework to install which is very time consuming.
0
Hi Experts,

Looking for some options to integrate splunk + chatbot + amazon alex.

  1. Assume we have some data shipped to splunk.
  2. Some kind of chatbot to scan splunk data and send voice announcement on a particular event..probably to alexa? or pc speaker etc. (I know splunk has some inbuilt alerts)
  3. On demand - voice command to get status using Amazon Alex

any information would be really helpful.

thanks in advance
0
Dear,
I want to have the effect to disable further update (like to show gray background color), to whole page, when it's being idle for a while, by these

        .overlay {
            background: #e9e9e9;
            display: none;
            position: absolute;
            top: 0;
            right: 0;
            bottom: 0;
            left: 0;
            opacity: 0.5;
        }
$(function () {
    // 1000ms=1s, here test use 10s, you could modify. 
    var time = 5000;
    var set = setInterval(function () {
        $(".overlay").show();
        $("#dialog").dialog();
    }, time);
});
    <div class="overlay">
        <div id="loading-img">
        </div>
    </div>

Open in new window

but I cannot get what I want, below
http://my-friend.co/RegRec2?id=18&user_abbr=mc2&readonly=n

what to adjust?
0
I need to get the width and height of a web page using vb.net code behind. Anyone have a clue?
0
Using the below piece of code.  Attempting to test sending an email.  I do receive the "Sent" message box but never receive an email.  Any ideas?
 Private Sub SMTP_Click(sender As Object, e As RoutedEventArgs)

        Try
            Dim myServer As New SmtpClient()
            myServer.Host = Me.txtServer.Text
            myServer.Port = Me.txtPort.Text

            'Server Credentials
            Dim nc As New NetworkCredential()
            nc.UserName = Me.txtUserName.Text
            nc.Password = Me.txtPassword.Text
            'assigned credetial details to server
            myServer.Credentials = nc

            'create sender address
            Dim from = New MailAddress(Me.txtEmail.Text, Me.txtEmail.Text)

            'create receiver address
            Dim receiver = New MailAddress(Me.txtEmail.Text, Me.txtEmail.Text)

            Dim myMessage = New MailMessage(from, receiver)
            myMessage.Subject = "Test SMTP for " & Me.txtServer.Text
            myMessage.Body = "Test SMTP for Server: " & Me.txtServer.Text & _
                                         "; Port: " & Me.txtPort.Text & _
                                         "; UserName: " & Me.txtUserName.Text & _
                                         "; Password: " & Me.txtPassword.Text & _
                                         " - SUCCESSFUL! "

            myServer.Send(myMessage)
            MsgBox("Sent")
        Catch ex As Exception
            MsgBox(ex.Message)
        End Try

Open in new window

0
If I remember correctly hen I was sitting in math classes a long time ago, there was a simple rule to establish the number of decimals needed to keep accuracy.

My problem is that I have a number of units and a price (resulting in a market value).

For example, if I have 3,976,796.834 units and the price is 10.052580533713, the resulting MV will be 39,977,070.4400.

Now I need to define how many digits I will need to keep (and I cannot keep 12) in order to keep the most accurate value.
0
I have msdn license on dynamics crm 2016
and want to find out the cost of hosting in azure
Or hosting using local vendor.

Of course, azure will be the best but not sure how to install dynamics and most important is the cost.

If anyone has been facing this and tell me more. I will be very appreciate

Thanks
0
Hi ,

I want suggestions to refactor the below code. The code is small.

1. map is a key value Dictionary Object. This populated from backend.
2. IEnumerable<SdtBlock> ccBlocks  [is Ienumerable collection]     . Content Control from Word file
3. IEnumerable<SdtRun> ccRuns       [is Ienumerable collection]    . Content Control from Word file

Each map item.Key can be Either ccBlocks or ccRun.

Based on map item.Value I need to perform actions.
Any recommendation is appreciated, you can point out if anything looks incorrect or adding property or sub function to make code leaner.

Thanks in advance

using (WordprocessingDocument myDoc = WordprocessingDocument.Open(destFilename, true))
            {
                MainDocumentPart mainPart = myDoc.MainDocumentPart;
                DocumentFormat.OpenXml.Wordprocessing.Document bodyDoc = mainPart.Document;
                IEnumerable<SdtBlock> ccBlocks = bodyDoc.Descendants<SdtBlock>();
                IEnumerable<SdtRun> ccRuns = bodyDoc.Descendants<SdtRun>();

                foreach (var item in cBO.map)
                {
                    
                    SdtBlock myBlock = ccBlocks.FirstOrDefault(ccb => ccb.Descendants<SdtAlias>().FirstOrDefault().Val == item.Key);
                    SdtRun myRun = ccRuns.FirstOrDefault(ccb => ccb.Descendants<SdtAlias>().FirstOrDefault().Val == item.Key);
                  
                    Text textContent=new Text();
                    if (myBlock != null)
 

Open in new window

0
What is a Denial of Service (DoS)?
What is a Denial of Service (DoS)?

A DoS is a malicious attempt to prevent the normal operation of a computer system. You may frequently see the terms 'DDoS' (Distributed Denial of Service) and 'DoS' used interchangeably, but there are some subtle differences.

We are currently running VS Team Explorer 2017 (Version 15.2) in a Citrix environment.  This is running on 2012r2.  We have multiple users that run the system and a few are seeing issues with the application crashing within about 30 seconds after starting up.  It does not appear to be the application directly, but maybe something related to it.  The application actually starts, and if you click fast enough you can actually do things, but after about 30 seconds or so, we get a crash and it closes.

This does not effect all users, just a few.  We have tried resetting their Visual studio parts in the Registry, and Appdata folders, as well as even taking it as far as resetting their profile.  

In the logs I get a .NET crash, and then the Application Error.

Application: devenv.exe
Framework Version: v4.0.30319
Description: The process was terminated due to an unhandled exception.
Exception Info: System.InvalidOperationException
   at System.Security.AccessControl.CommonAcl.ThrowIfNotCanonical()
   at System.Security.AccessControl.CommonAcl.AddQualifiedAce(System.Security.Principal.SecurityIdentifier, System.Security.AccessControl.AceQualifier, Int32, System.Security.AccessControl.AceFlags, System.Security.AccessControl.ObjectAceFlags, System.Guid, System.Guid)
   at System.Security.AccessControl.DiscretionaryAcl.AddAccess(System.Security.AccessControl.AccessControlType, System.Security.Principal.SecurityIdentifier, Int32, …
0
Hi-

I want to know how to remove temp files after Response.End

If I add File.Delete(prcss_docPath) in the finally the download does not complete.

        string srcTemplate = String.Empty;
        string prcss_docPath = String.Empty;
        string dnNo = String.Empty;
        try
        {
             srcTemplate    = "FileSrc.docx"
            prcss_docPath = "File.docx";
            bool processed = false;
            File.Copy(srcTemplate, prcss_docPath, false);
            ContractProcess cps = new ContractProcess();
            processed = cps.ParseWordTemplate(prcss_docPath, dnNo);

            if (processed)
            {
                Response.Clear();
                 FileInfo file = new FileInfo(prcss_docPath);
                Response.ContentType = "Application/msword";
                Response.AppendHeader("Content-Disposition", "inline; filename=" + file.Name);
                Response.AppendHeader("Content-Length", file.Length.ToString());
                Response.Flush();
                Response.TransmitFile(prcss_docPath);
                Response.End();
                Response.Close();
            }
        }
        finally //Delete the files.
        {

         }

Open in new window

0
In eclipse when i selected a method and do control+alt+H i get
An internal error occurred during: "Fetching children of orchestrate".
GC overhead limit exceeded

how to resolve this error. please advise
0
Hello,
How can i convert this functon compatible to listview
 Private Sub ListBox1_MouseDown(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles ListBox1.MouseDown
        If e.Button = MouseButtons.Left Then
            Dim pt As New Point(e.X, e.Y)
            startIndex = ListBox1.IndexFromPoint(pt)

            If startIndex >= 0 Then
                Dim itemRc As Rectangle = ListBox1.GetItemRectangle(startIndex)
                startPoint = ListBox1.PointToScreen(New Point(ListBox1.Width, itemRc.Top + (itemRc.Bottom - itemRc.Top) / 2))
                endPoint = startPoint
                lastIndex = -1
                ListBox1.DoDragDrop(ListBox1.Items(startIndex).ToString(), DragDropEffects.Move)
            End If
        End If
    End Sub

Open in new window



  Private Sub ListBox2_DragOver(ByVal sender As Object, ByVal e As System.Windows.Forms.DragEventArgs) Handles ListBox2.DragOver
        Dim lbPoint As Point = ListBox2.PointToClient(New Point(e.X, e.Y))
        Dim index As Integer = ListBox2.IndexFromPoint(lbPoint)
        If index >= 0 Then
            ListBox2.SelectedIndex = index
            Dim itemRc As Rectangle = ListBox2.GetItemRectangle(index)
            Dim key As String
            If lastIndex <> index Then
                If lastIndex <> -1 Then
                    key = startIndex & "|" & lastIndex
                    If Not connections.ContainsKey(key) Then
                        ControlPaint.DrawReversibleLine(startPoint, endPoint, Panel1.BackColor)
                    End If
                End If
                key = startIndex & "|" & index
                If Not connections.ContainsKey(key) Then
                    endPoint = ListBox2.PointToScreen(New Point(0, itemRc.Top + (itemRc.Bottom - itemRc.Top) / 2))
                    ControlPaint.DrawReversibleLine(startPoint, endPoint, Panel1.BackColor)
                End If
                lastIndex = index
            End If
        End If
    End Sub

Open in new window


  Private Sub ListBox2_DragDrop(ByVal sender As Object, ByVal e As System.Windows.Forms.DragEventArgs) Handles ListBox2.DragDrop
        Try

            Dim endIndex As Integer = ListBox2.IndexFromPoint(ListBox2.PointToClient(New Point(e.X, e.Y)))
            If endIndex >= 0 Then
                connections.Add(startIndex & "|" & endIndex, Nothing)
            End If
            Panel1.Refresh()
        Catch ex As Exception
            Exit Sub
        Finally
            Panel1.Refresh()
        End Try

    End Sub

Open in new window


ListBox2.GetItemRectangle(index)
GetitemRectangle,IndexFromPoint is not a part of listview
0
Hello,
Need some advice on how to create a program that can draw data model?
This works but,need to use datagridview
https://www.experts-exchange.com/questions/21540913/Need-some-advice-on-how-to-create-a-program-that-can-draw-data-model.html


Any suggestions are appreciated.

Cheers
0
Hello,
How can I have a multicolumn bound listbox .
Bound to datatable
I am using vb.net desktop.
0
rest web services Standard vs business exception differences not clear. when to use which one and how. Both seems almost same to me in terms of error handling
 please advise​
0
Hi,
I am reading below link

https://docs.oracle.com/cd/E19798-01/821-1841/6nmq2cp1v/index.html

I was not very clear when we use content type application/xml  and when we use application/x-www-form-urlencoded and when we use json. what is importance of content type and practical uses of it. How media type is different from content type or mime type. what is the meaning of payload. please advise
0
I am working on a .Net application that is using nHibernate and I am passing through a structured datatype into a stored procedure.

I am using an extended method like this

    public static class StructuredExtensions
    {
        private static readonly Sql2008Structured structured = new Sql2008Structured();

        public static IQuery SetStructured(this IQuery query, string name, DataTable dt)
        {
            return query.SetParameter(name, dt, structured);
        }
    }

Open in new window


The full code of this is in the attached file,

The SQL User Defined Table Type is

CREATE TYPE [dbo].[CEQBM_CEQBN_TYP] AS TABLE(
	[PRNCPL_ACC_CD] [char](10) NOT NULL,
	[BRANCH_ACC_CD] [char](10) NOT NULL,
	[COPY_MISC_DLR_FG] [bit] NOT NULL DEFAULT ((0)),
	[COPY_LABR_HRS_FG] [bit] NOT NULL DEFAULT ((0)),
	[COPY_CSUM_COST_FG] [bit] NOT NULL DEFAULT ((0)),
	[COPY_PART_PRICE_FG] [bit] NOT NULL DEFAULT ((0)),
	[COPY_TRVL_RATE_FG] [bit] NOT NULL DEFAULT ((0)),
	[COPY_DISC_FG] [bit] NOT NULL DEFAULT ((0)),
	[COPY_TAX_RATE_FG] [bit] NOT NULL DEFAULT ((0)),
	[COPY_REJ_RESN_FG] [bit] NOT NULL DEFAULT ((0)),
	[COPY_CNTR_OBLG_FG] [bit] NOT NULL DEFAULT ((0)),
	[COPY_LABR_OVRS_FG] [bit] NOT NULL DEFAULT ((0)),
	[EDIT_MISC_DLR_FG] [bit] NOT NULL DEFAULT ((0)),
	[EDIT_LABR_HRS_FG] [bit] NOT NULL DEFAULT ((0)),
	[EDIT_CSUM_COST_FG] [bit] NOT NULL DEFAULT ((0)),
	[EDIT_PART_PRICE_FG] [bit] NOT NULL DEFAULT ((0)),
	[EDIT_TRVL_RATE_FG] [bit] NOT NULL DEFAULT ((0)),
	

Open in new window

0
Setting up LaraDock for Laravel
Setting up LaraDock for Laravel

Learn how to set up LaraDock in a Laravel project - LaraDock gives us an easy way to run a Laravel application using Docker in a single command.

Dear,
Is there a way to save/store (within one button event) relevant latitude or longitude of the relevant position, already to the map below?

http://my-friend.co/RegRec2?id=18&user_abbr=mc2&readonly=n
0
Hello Experts,
In a Windows Service program, I am trying to delete a file.  It works fine in my machine.  For example if the file is found, my program  deletes it and if the file not found, I get exception.  Same program when copied to production, neither the file gets deleted, not do I get any exception.  I am sure it goes to delete portion of the method.  Because I tested it with log4net.  FYI, in development I am using Windows 7 Pro and in Production Windows Server 2008 R2.  Any idea?  Below is my code.  Please help.

Thank you in advance.


public void DeletePMTFile()
        {
            string fullName = System.Configuration.ConfigurationManager.AppSettings["FULL_NAME"];
            string filePath = System.Configuration.ConfigurationManager.AppSettings["FILE_PATH"];
            var reader = new StreamReader(fullName);
            reader.Close();

            FileInfo fileName = new FileInfo(fullName);
            if (File.Exists(fullName))
            {
                try
                {
                    Array.ForEach(Directory.GetFiles(filePath), File.Delete);
                }
                catch (System.IO.IOException e)
                {
                    log.Error("DeletePMTFile: Error while deleting the file" + e.Message);
                    return;
                }
            }
            else
            {
                log.Warn("DeletePMTFile: " + filePath.Trim() + " not found");
            }
        }

Open in new window

0
Hi,



I have two tables created from 2 xml files which are linked by the NSC column, How do I create a new table with data from table2 by merging data from table2 to table1, where the fields from table2 are included in table1, for example if table1 contains

NSC:   F1                            F2

1         AGD, AGD1            AGD

2        AGD                        AGD, AGD1



table2 contains:

NSC:   AGD   AGD1

1         XXX    YYY

2        ZZZ    WWW



How do I create table3?



NSC:   F1                            F2

1         XXX;YYY                XXX

2        XXX                        XXX;YYY


Thanks,

Victor
0
Hi

I can successfully write to the MS message queue by doing this:
using (MessageQueue alertsQueue = new MessageQueue(Program.alertsQueuePath))
                {
                    BinaryMessageFormatter formatter = new BinaryMessageFormatter();
                    System.Messaging.Message message = new System.Messaging.Message(this, formatter);

                    alertsQueue.Send(message, "CommonObject");
                }

Open in new window


where "this" is a class called clsCommon.cs and is a populated object with values

Then on another console app, i need to read this message and i guess deserialise it
i.e.
   public void MqReceiveCompleted(object sender, ReceiveCompletedEventArgs e)
        {
            try
            {
                mq.EndReceive(e.AsyncResult);

                clsCommon objClsCommon = new clsCommon();
                string strObjClsCommon = e.Message.Body.ToString();

//here is need to convert the string I just got into objClsCommon

Open in new window


any ideas?
0
Hi All

I have the following applications

1. Web app (asp.net)
2. TCP importer windows forms app (imports data from gps devices in cars)
3. Translator console app - takes messages from MS Message Queue and puts in SQL DB
4. Alerts console app - takes messages from a different Message Queue and sends sms/emails

all have different teams, and with excepting of web app, all are having to store in memory little objects to speed up performance instead of doing DB lookups
We are processing 100 records a second (and it will keep growing), so we have to have stuff like a key value pair in memory (i.e. ImeiNumber, DB ID)

As each app has its own implementation of an in memory dictionary, and there are lots of them which all do different things, but ultimately storing the same data, I was thinking of a distributed memory cache, or some sort of API where it returns the data instead of doing a DB lookup
I think an API will be heavier, and currently apps 2,3and4 are on same windows 2016 server

I've been looking around and found memcache and memcacheD
However, it seems quite related to php etc, and not .net
I was wondering if there are are pure .net alternatives
We are using framework 4.5

What would you do in my position, and have you had an real experience with this
I'm currently a bit overwhelmed with all the data online, and would value so guidance and advice of what to use
0
I have created a desktop application and designed some reports using sap crystal report. First to design report I used database from sql server management studio and put all the field on report. But I have to deploy it client side with localDB after connecting my application with local db I am able to access database on my forms but cant getting data on report. I fetched data in datatable then I am setting datatable as datasource for report but I am getting error."Failed to open the connection Details: Database Vendor Code:4060"

Please provide me correct answer as soon as possible.
Error.PNG
0

.NET Programming

132K

Solutions

38K

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.