• Breaking News

    Saturday, May 16, 2020

    How to have my computer go to sleep after a windows scheduled task ONLY if the computer was woken up by the task in the first place Ask Programming

    How to have my computer go to sleep after a windows scheduled task ONLY if the computer was woken up by the task in the first place Ask Programming


    How to have my computer go to sleep after a windows scheduled task ONLY if the computer was woken up by the task in the first place

    Posted: 16 May 2020 12:37 PM PDT

    UPDATE

    I have figured out a way to do this with pretty minimal awake time. Since I know the execution time of my script down to a narrow range (Give or take 20-30 seconds for my longest-running script), I have created a batch file with a PowerShell script to put my computer to sleep while allowing other wake-up timers. I have put this batch file on task scheduler, scheduling them around 6-7 minutes after my task normally finishes, and making the task require my computer to be idle for 5 minutes. Although I may have some tiny mishaps with this script, I should be good for the most part, and 5 minutes is plenty of time to ensure my computer does not accidentally sleep on me.

    Here is the batch file code (found online somewhere): powershell.exe -command "Add-Type -AssemblyName System.Windows.Forms; [System.Windows.Forms.Application]::SetSuspendState([System.Windows.Forms.PowerState]::Suspend, $false, $false)

    I have removed some of the XML file bit for the scheduled task, but here is some of the XML code you can use to do something similar: -<Settings> <MultipleInstancesPolicy>IgnoreNew</MultipleInstancesPolicy> <DisallowStartIfOnBatteries>false</DisallowStartIfOnBatteries> <StopIfGoingOnBatteries>true</StopIfGoingOnBatteries> <AllowHardTerminate>true</AllowHardTerminate> <StartWhenAvailable>false</StartWhenAvailable> <RunOnlyIfNetworkAvailable>false</RunOnlyIfNetworkAvailable> -<IdleSettings> <Duration>PT5M</Duration> <WaitTimeout>PT0S</WaitTimeout> <StopOnIdleEnd>false</StopOnIdleEnd> <RestartOnIdle>false</RestartOnIdle> </IdleSettings> <AllowStartOnDemand>true</AllowStartOnDemand> <Enabled>true</Enabled> <Hidden>false</Hidden> <RunOnlyIfIdle>true</RunOnlyIfIdle> <DisallowStartOnRemoteAppSession>false</DisallowStartOnRemoteAppSession> <UseUnifiedSchedulingEngine>true</UseUnifiedSchedulingEngine> <WakeToRun>false</WakeToRun> <ExecutionTimeLimit>PT72H</ExecutionTimeLimit> <Priority>7</Priority> </Settings>

    Original

    Using Windows Task Scheduler

    I have a task I want to run at 5:30 PM Daily, but I'm not sure if I'll be on that computer at the time of the task.

    So, I want to allow Windows to wake my computer to run the task. The issue is, I do not want my computer awake if I'm not using it.

    My question is: Can I have windows put my computer to sleep after it completes a task only if it was woken up by the task, but allows it to stay awake if the computer was already awake?

    I'm sure I could use powercfg -lastwake, but I'm not sure how to read the output to check

    I'm using a batch file for this task as well, if that's relevant

    submitted by /u/croganm
    [link] [comments]

    Explain RPN (Reverse Polish notation gif)

    Posted: 16 May 2020 07:06 PM PDT

    I am applying for a new job.

    They have given a test project, I have almost finished it.

    I have one questions.

    After ">" user can type values into console.

    Program will evaluate result.

    > 1 2 +

    3 > dup

    3 3 > *

    9 > 3 repeat dup * *

    9 729 >

    I am confused by repeat, I can not make 729

    Also note they are other complex functions in rpn, also those are done.

    submitted by /u/KhalilMirza
    [link] [comments]

    Anti cheat software with ring 0 privileges, should I be worried?

    Posted: 16 May 2020 03:04 AM PDT

    Hello fine people, I hope this question is allowed on here. Recently gaming communities on reddit are upset because some games implemented anti cheat software which function almost like a driver with ring 0 privileges, as far as I understand it. I'm no expert and have no professional background in this field but I would like to understand this issue better.

    So people in gaming subreddits are saying anti cheat software are basically root kits which would allow the companies or hackers full access to the customer windows systems which I guess is probably true. But this is also true for every driver software and other software which is updated regularly right?

    As I was looking for more information I found forums where programmers sell r0 cheats for multiplayer games, are companies that make anti cheat software just playing catch up to the hackers?

    Please excuse my bad English, I hope somebody is willing to share some knowledge. Thank you.

    submitted by /u/Arti0n
    [link] [comments]

    Why is it so hard to scrape the Australian Coronovirus case numbers?

    Posted: 16 May 2020 09:45 PM PDT

    I'm on a team that is collecting and providing international and regional coronavirus data (for free). Part of that is having tons of scrapers to collect data from governments, some of which choose to present it only as interactive maps (France) or daily press releases of incremental change (China) or other scraping-hostile methods.

    I'm not sure what's going on with Australia: https://www.health.gov.au/resources/total-covid-19-cases-and-deaths-by-states-and-territories

    A comment from one of our scraper devs:

    This site is no longer a straight HTML scrape. Now, an app called Qlik Sense injects markup into the page. I've poked and prodded in the Network pane for a while and have found all their charting libraries and such, but the underlying source of data is non-obvious to me.

    The widgets have a common class and an unique id. The IDs are passed to Drupal via qlik_components array, but from there I can't successfully search for those IDs or the resulting, rendered values in the network pane.

    There is a different page with some of the information in text form, but that's apparently edited manually and often out of date / moves around.

    Thanks for any advice.

    submitted by /u/jonhuang
    [link] [comments]

    Need help with two functions [C++]

    Posted: 16 May 2020 08:21 PM PDT

    Hello guys, I'm having problem writing 2 functions in C++.

    First function is called "TheLeader" which takes 2 parameters, N (number of people) and M (ejection number) and it needs to return the ordinal number of the person who will become the leader. I need to use std::list for this function. So first the list is filled with ordinal numbers from 1 to N. After the list is formed, we go through the list and remove every Mth element until there is only one element remaining (if we come to end of the list we go to the beginning). For example, if the list has 11 people (with ordinal numbers from 1 - 11) and if M is 4, the ejection order should be 4, 8, 1, 6, 11, 7, 3, 2, 5, 10; so the number 9 will become the leader. This function also has a third parameter "write_the_number" (bool) with default value false. If write_the_number is true, the function needs to print the ordinal number of every ejected person in the ejection order, and if it's false it shouldn't print anything.

    Second function is "SafePlace". It takes for parameters M(ejection number), N1 and N2 (number M is between N1 and N2) and returns ordinal number of the safe place in the circle, i.e. the place we should stand on so that we don't become a leader for any N in the range of N1 and N2. If there is more than one safe place, the function should return the ordinal number of the safest place with lowest ordinal number and if there is none the function returns 0. The operation of this function is based on calling the function "TheLeader" for all values N in the range from N1 to N2 and noting who will be elected leader in all these cases (the place is safe if the person standing in that place will not be the leader for any N in the range from N1 to N2).

    Here is what I've done for the first function so far:

    int TheLeader(int N, int M, bool write_the_number = false) { std::list<int> my_list; // filling the list with numbers from 1 to N std::list<int>::iterator it = my_list.begin(); for(int i = 1; i <= N; i++) my_list.insert(it, i); // removing elements until there is only one element in the list int number_of_shifts = 0; std::list<int>::iterator it2 = my_list.begin(); for(;;) { if(my_list.size() == 1) break; it2++; number_of_shifts++; if(number_of_shifts == M) { if(write_the_number) std::cout << std::distance(it2, my_list.begin()) << std::endl; it2 = my_list.erase(it2); number_of_shifts = 0; } else if(it2 == my_list.end()) { for(auto it3 = my_list.rbegin(); it3 != my_list.rend(); it3++) it2--; std::advance(it2, M - number_of_shifts); if(write_the_number) std::cout << std::distance(it2, my_list.begin()) << std::endl; it2 = my_list.erase(it2); number_of_shifts = 0; } } return *it; } 

    This isn't working, although I don't get any syntax errors. I'm having problems going from the beginning when we reach the list end and also keeping track of what element I need to eject.

    Any help is appreciated and thank you in advance.

    submitted by /u/temp000321
    [link] [comments]

    For Anybody Now Working Remote (Which is probably everybody)

    Posted: 16 May 2020 09:35 AM PDT

    Since working remote, have you found yourself having a much harder time getting work done from not being able to bounce ideas off co-workers?

    submitted by /u/cabahugma
    [link] [comments]

    Improving the level of my planning process/code?

    Posted: 16 May 2020 07:46 PM PDT

    Hello,

    I'm a 2nd year studying CS going into my third year this coming October. The issue I'm having is that I've found that, since I admittedly had been slacking through my degree so far, I'm not very good at creating logical systems that are easy to build upon and use in my code. I feel like my code is at a standard far lower than my peers and I'd like to change that but I'm not really sure where to start or how to really build up a skill like that.

    I'd like to take advantage of this time between this year and the next that I'm stuck indoors to create some projects and expand my GitHub presence so that I can have reasonably decent job prospects by the time I graduate. Of course, I would continue this work into the coming year. If any of you have found yourselves in similar positions in the past, how did you turn things around? What kind of projects did you take on or what kind of books did you read? I'm looking forward to the responses.

    Thanks

    submitted by /u/CodeRevived
    [link] [comments]

    I need the proper term for this piece of my program.

    Posted: 16 May 2020 04:18 PM PDT

    Picture this: You need to read User information for different systems, lets say JIRA and RedMine. You want to manage them inside your program so you create a representation of both in your own model. So, you want to interchange data between the 2 platforms and your own. So you need a "bridge" to move data betwen (Jira)->(Your program) and (RedMine)->(Your program). How would you call these parts that do the conversion? Transformers? Bridge? Translator? I want to use the right technical term for this piece of software. How would you call it?

    submitted by /u/shinobicl
    [link] [comments]

    GUIs - Tips for drawing boxes for screen capture (C++)

    Posted: 16 May 2020 02:49 PM PDT

    Hey all,

    I'm typically an embedded systems programmer, so the GUI world is new and confusing to me. I'm unfamiliar with the world and would love some guidance to getting started so I can head off on my own.

    End Goal

    I trying to leverage the tesseract-ocr C++ library for a kanji reading application. If I'm reading Japanese and cannot select the text, then I want to capture the text and run it through OCR. So I want to draw a box and capture the screen similar to how screen snipping tools work. To do this...

    1. Click the top left corner of the target text.
    2. Drag it to the bottom right of the target text.
    3. Capture the screen within the box and save it to a bit map.
    4. Run OCR on the text. If the OCR reads incorrectly, give the option to the user to draw the incorrect reads with a mouse.

    Being new to the world of GUIs, I looked around for libraries and came across ImGui. After fussing around with it for a while I'm realizing this is probably not what I'm looking for. I realized that ImGui can be built on top of OpenGL, so I went and looked at open OpenGL. Unfortunately, OpenGL is very complicated and low level, so this doesn't seem like what I want either.

    So, I'm looking for some guidance. What tools exist that will give me what I'm looking for? I prefer terminal tools, so I want to minimize reliance on GUIs past drawing a box.

    Tips, tricks, or information that should help me here? Thanks in advance.

    submitted by /u/Pan4TheSwarm
    [link] [comments]

    Looking for a C# book recomendation

    Posted: 16 May 2020 02:39 PM PDT

    Hello! Long time programmer first-time subredittor. I am 19 years old and I currently have 6 years of casual unity 3D experience. I know how programming works and have been programming since I can remember. Recently in school, we had to read an e-book on python programming. My python programming knowledge has gotten a lot better from it. Since reading the e-book I realized how much c# knowledge I'm missing because of my self-thought approach. (googling what I need to do for the last 6 years). I use a lot more c# then I do Python in my life so I would like to improve my c# knowledge. I am looking for a book or a course or something for someone who knows how to code and already has a self-thought knowledge of c#. I don't want any flashy courses that don't explain anything just desperately try to make learning the language fun but all they really achieve is getting way too in your face. I hope someone suggests something I'm looking for a physical book but I will accept an online course thing or something. I hope someone can help me out thanks in advance and stay healthy :) ! (sorry for my bad grammar I'm not a native speaker)

    submitted by /u/the_TIGEEER
    [link] [comments]

    Am I making a mistake in my search for jobs?

    Posted: 16 May 2020 02:31 PM PDT

    I was laid off a month ago because of the lockdown's effect on my company. So I signed up for Indeed, LinkedIn, Dice, and StackOverflow's jobs boards. I found job postings through those sites and applied.

    More and more, I'm being taken to strange jobs posting sites like Nexxt and HireMojo, Jora, and JobLeads. I've never heard of any of these sites, and they want me to sign up, create a profile, and share personal information before they'll even show me the jobs listings.

    Should I avoid websites like this? I feel like there are so many third-party companies that try to get between engineers and employers because they want to skim money off of the hiring process.

    I used to be a teacher, so I don't have a lot of job-hunting knowledge in software development. I'm self-taught and worked my way up into a Java engineer position at a company where one of my friends worked. Any tips at all in my search would be appreciated.

    submitted by /u/Nightmare_Tonic
    [link] [comments]

    Help with realtime data from API

    Posted: 16 May 2020 01:48 PM PDT

    I am trying to build my personal screener for Stock Prices. It will pull data from an API, and will process the data and display quite a few convoluted calculated indicators along with charts (candlestick charts). The API supports Go, Python, C#, Node, Java and Rust. I have quite a bit of experience with C# and WPF, but that does not support Linux, my current platform. I do have a working knowledge in JS and Python, and I am currently learning Go. However, as there are time-sensitive operations, I have no clue which of the languages (and UI/graphing libraries/frameworks) to choose.

    Here are my requirements:

    • Must be fast
    • Must be cross-platform (so no WPF)

    So, any suggestions?

    submitted by /u/Mycroft2046
    [link] [comments]

    F#

    Posted: 16 May 2020 01:45 PM PDT

    Hello everyone,

    Can someone help me with defining a function in F# language leafCount :: Tree<'a> -> int that returns an integer represents the total number of leaves in a tree. I have to use foldT and define at most one helper function.

    submitted by /u/tahmina77
    [link] [comments]

    Performance of multiple single-threaded processes

    Posted: 16 May 2020 12:54 PM PDT

    Hi,

    I've noticed a peculiar behaviour on my machine, which I was unable to google. Hence, the long post.

    My machine is Ryzen 2600X (6 cores, 12 threads) with 64 GB RAM. The system is Fedora 30 Server. Queue system is Torque PBS.

    I've noticed that, under certain conditions, the more single-threaded tasks I have, the slower each task is.

    The test was: using bash loop, submit N single-threaded tasks, they run simultaneously, collect run times. For each N = 1, 2, 3, ... 9, the test was repeated 4 times, making a single data block. Acerage run time was calculated for each N within a block. The test job was a python numpy script, a purely CPU-dependent job:

    def heavy0(N):

    a = np.random.random(N

    b=a*a*a*a*a

    c=b**0.5 * b**1.3 * b * 0.2323536123

    print(timeit.timeit('heavy0(int(1e8))', setup='from __main__ import heavy0', number=10)) # option 1

    print(timeit.timeit('heavy0(int(1e4))', setup='from __main__ import heavy0', number=100000)) # option 2

    For option 1, two data blocks were collected and the run times are:

    N threads ; mean run time, s

    1; 28.3; 28.3

    2; 32.6; 32.1

    3; 34.9; 34.7

    4; 40.9; 39.3

    5; 45.1; 45.2

    6; 53.9; 53.9

    7; 60.3; 60.4

    8; 69.2; 69.3

    9; 78.5; 78.4

    The same data as a plot: https://imgur.com/a/H6eJJhf

    The run time increases smoothly and kind of exponentially.

    At first I thought, ok, memory is way too fast, this must be a CPU issue.

    But then, I asked myself, is my option 1 actually memory-independent? I used option 2, with smaller array and more repetitions. Option 1 peak maximum resident set size was 3079 megabytes, while for option 2 it was only 27 megabytes. The run times are:

    N threads mean run time, s

    1; 27.9

    2; 28.8

    3; 29.1

    4; 29.7

    5; 30.0

    6; 33.2

    7; 36.3

    8; 39.6

    9; 42.8

    The break in a trend happens at 6 threads, where hyperthreads start being used (I had a single background process this time).

    Thus, with small-memory simultaneous processes, their run time depends slightly on their quantity. With large-memory processes, the dependence is significant.

    The question is, what is happening, and how do I improve performance of the large memory case? The script is a mere model, but the principle is the same - multiple single-threaded jobs.

    Thank you.

    Edit: Formatting. Also, indents in the code disappeared...

    submitted by /u/nctrd
    [link] [comments]

    I want to launch a MMORPG

    Posted: 16 May 2020 12:11 PM PDT

    So, I've been thinking about launching a MMORPG or a game online. I'm currently learning about coding and stuff and I want it to be my first project. Can yall give me some tips? How to start, where can I host it, and stuff. The more tips, the better. Thanks in advance

    submitted by /u/_Lasagnaa_
    [link] [comments]

    Need help finding an API for a party app

    Posted: 16 May 2020 11:45 AM PDT

    Hi all,

    I am in need of an API or just general guidance on creating a party system for an app idea I have. My goal is to allow for someone to create a party and others will join with a randomly generated code, similar to how Zoom video calls and other applications with private rooms work. I attempted to find software related to this but I am unable to express it in a concise enough way to get any results on Google. Any help would be appreciated!

    submitted by /u/Camphi
    [link] [comments]

    What's a good first commit message that is not "first commit", "init commit" or anything like that?

    Posted: 16 May 2020 06:47 AM PDT

    What is a good way to initialize a repo without having the first commit be "first commit", or "init", or anything like that?

    submitted by /u/drecklia
    [link] [comments]

    Visual Basic Button Colour Change

    Posted: 16 May 2020 08:56 AM PDT

    How would I make a button's background colour change if my pointer was on top of it?

    submitted by /u/-Smudg3-
    [link] [comments]

    Is it possible to read in a postgres dump with sql alchemy?

    Posted: 16 May 2020 07:29 AM PDT

    Should I continue in this field?

    Posted: 16 May 2020 09:23 AM PDT

    Like I love programming absolutely love it and I almost easily learn new topics but like every job I see is like you gotta know this that and the other thing and it's like how can I ever possibly learn all this and remember it enough to pretend I'm smart and get it a job also it doesn't help I feel like I'm not good enough like a part of me is like you could be big but another part is like you suck

    submitted by /u/cutiepieheather
    [link] [comments]

    Is it possible for my university to see if someone is sharing their screen during an online exam?

    Posted: 16 May 2020 07:48 AM PDT

    Recently at one class (which I'm not attending) a professor sent an email stating that they know some students were sharing their screen with each other and working together during an online exam (it's on Moodle if you are familiar with it).

    My question is, how can they tell if someone is sharing their screen, without any software installed on the computer? Is it possible at all?

    submitted by /u/Parasztkiller
    [link] [comments]

    No comments:

    Post a Comment