Ulyssesallandorothy's Profile

270
Points

Questions
52

Answers
35

  • Hookup on click event for button. On post back get the string from the text box and set it on literal control.

    void button1_Click(Object sender, EventArgs e) {     literalControl.Text = $"{Server.HtmlEncode(textbox1.Text)} - {DateTime.Now}"; } 

    NOTE:- this is okay for very beginning, but getting user input and using it as such is dangerous!

    • 84 views
    • 1 answers
    • 0 votes
  • Asked on July 16, 2020 in .NET.

    Based on @Martin Prikryl answer i created new function for concurrent downloads:

    Works flawlesly:

    public async Task DownloadMultipleFilesConcurrentFromFTP(int NumberOfConnections, string AppName, string RemoteUrl)     {         await Task.Run(async() =>         {             NetworkCredential networkCredential = new NetworkCredential(FTPUsername, FTPPassword);             List<FtpClient> ftpClients = new List<FtpClient>();              for (int i = 0; i < NumberOfConnections; i++)             {                 ftpClients.Add(new FtpClient(FTPHost, networkCredential));                 foreach(FtpClient ftp in ftpClients)                 {                     ftp.ConnectTimeout = ConnectTimeout;                     ftp.SocketPollInterval = SocketPollInterval;                     ftp.ReadTimeout = ReadTimeout;                     ftp.DataConnectionConnectTimeout = DataConnectionConnectTimeout;                     ftp.DataConnectionReadTimeout = DataConnectionReadTimeout;                     ftp.Connect();                     if (ftp.IsConnected)                     {                         using (FileStream read = new FileStream("settings.xml", FileMode.Open, FileAccess.ReadWrite, FileShare.ReadWrite))                         {                             if(ftp.IsConnected == true)                             {                                 if (File.Exists("settings.xml"))                                 {                                     Information info = (Information)xs.Deserialize(read);                                     if (Directory.Exists(info.Downloads))                                     {                                         await ftp.DownloadFileAsync(info.Downloads + "\\" + AppName, RemoteUrl, FtpLocalExists.Overwrite, FtpVerify.Retry);                                     }                                 }                             }                         }                     }                 }             }         });     } 

    Now i just need figure out how return download progress of all files.

    • 128 views
    • 3 answers
    • 0 votes
  • Asked on July 16, 2020 in .NET.

    You just need to do this:

    int m = Numbers[0]; for (int i = 1; i < N; i++) {     m = Numbers[i] > m ? Numbers[i] : m; } Console.WriteLine(m); 

    or this:

    int m = Numbers[0]; for (int i = 1; i < N; i++) {     int n = Numbers[i];     if (n > m)         m = n; } Console.WriteLine(m); 

    No sorting required.

    You code ran fine, however, without error for me.

    • 65 views
    • 2 answers
    • 0 votes
  • Asked on July 16, 2020 in .NET.

    Drag a tooltip control from the toolbox onto your form. You don’t really need to give it any properties other than a name. Then, in the properties of the control you wish to have a tooltip on, look for a new property with the name of the tooltip control you just added. It will by default give you a tooltip when the cursor hovers the control.

    • 73 views
    • 6 answers
    • 0 votes
  • Asked on July 16, 2020 in Mysql.

    It isn’t clear what work you expect isnull(game_name), game_name is null to be doing.

    You’re getting syntax errors referring to year because year is a reserved word and you’re using it without wrapping it backticks (identifier quotes).

    • 78 views
    • 1 answers
    • 0 votes
  • Asked on July 16, 2020 in Mysql.

    You can try this

    select * from tablename group by customer desc, created asc 
    • 67 views
    • 4 answers
    • 0 votes
  • I’m solved the problem – now I using the reCAPTCHA v2 – Checkbox. Change of the version solved the problem. Generating new keys for v2 version solved this problem. Captcha displays and works correctly.

    • 63 views
    • 1 answers
    • 0 votes
  • Asked on July 16, 2020 in Python.

    Try creating an __init__.py file in the same directory as your file. Then add import views in that __init__.py file.

    It should work but if it doesn’t then try adding the following snippet in your code:

    import sys sys.path.append('.') 

    EDIT: This snippet should be at the top of the file, before other imports.

    • 48 views
    • 1 answers
    • 0 votes
  • Your code is riddled with errors:

    pen.pencolor(255, 255, 255) t.pendown() 

    Here you’re talking to two different turtles, your pen and the default turtle which you haven’t touched before now nor ever again. What’s going on here:

    pen.xcor() == 150 or pen.xcor() == 150 

    is there a minus sign missing? Ditto for pen.ycor(). These statements are in the wrong order:

    pen.pendown() pen.penup() pen.forward(1) 

    To actually make a mark on the screen you want:

    pen.pendown() pen.forward(1) pen.penup() 

    Look for that error in two places in your code. This logic:

    if cloud == 7:     pen.pencolor(255, 255, 255) 

    is completely undone by what follows next:

    rY = r.randint(0, 150) gY = r.randint(0, 150) bY = r.randint(0, 255) pen.pencolor(rY, gY, bY) 

    You’re missing an else clause there. In this else clause:

    else:     print('Your landscape, look nice? ') 

    you probably also want a break statement otherwise you’ll never get out of your infinite while True: loop.

    Below is my rework of your code to fix the above, but I make no claim that it does anything useful:

    """ Landscape Drawer.py Draws landscape on a turtle screen """  from turtle import Screen, Pen from random import randint  def controls():     if pen.xcor() == -150 or pen.xcor() == 150 or pen.ycor() == -150 or pen.ycor() == 150:         pen.right(90)         pen.forward(1)         pen.right(90)  def allcode():     while True:         controls()          if pen.ycor() < -75:             r = randint(0, 150)             g = randint(0, 255)             b = randint(0, 150)             pen.pencolor(r, g, b)              pen.pendown()             pen.forward(1)             pen.penup()         elif pen.ycor() > -150 or pen.ycor() < 150:             cloud = randint(1, 7)              if cloud == 7:                 pen.pencolor(255, 255, 255)             else:                 r = randint(0, 150)                 g = randint(0, 150)                 b = randint(0, 255)                 pen.pencolor(r, g, b)              pen.pendown()             pen.forward(1)             pen.penup()         else:             print('Your landscape, look nice? ')             break  screen = Screen() screen.colormode(255)  pen = Pen() pen.hideturtle() pen.speed('fastest')  pen.penup() pen.goto(-300, -300)  allcode()  screen.exitonclick() 
    • 59 views
    • 1 answers
    • 0 votes
  • Asked on July 16, 2020 in Python.

    You can try to use the json module from the standard library to parse the json data, then converting the list of dicts to a Dataframe, like this:

    import json import pandas as pd  json_data = """ {     "results": [         { ..."""    data = json.loads(json_data) events = data["results"][0]["events"]  df = pd.DataFrame(events) 
    • 57 views
    • 1 answers
    • 0 votes