Jump to content

Computer Science

  1. Started by mathematic,

    following was asked of bingchat and chatcpt. Both gave wrong answers. Any thoughts? ---------------------- Geometry problem: Semi-circle inside triangle: Triangle with known length sides a, b, c where a is the longest. Place inside the triangle a semi-circle with entire diameter resting on side a, which is horizontal. The arc of the semicircle is maximum possible inside the triangle. Known - triangle dimensions. Unknown r (semi-circle arc radius) and x (distance along a from left end of a to center of diameter). Find equations for r and x In terms of all possible triangles.

    • 1

      Reputation Points

    • 20 replies
    • 2.3k views
    • 1 follower
  2. Started by Genady,

    What are advantages of using Latex vs MS Word for math expressions in the posts? At least visually, IMO, the latter is better than the former. Compare Latex: MS Word: Plus, the latter gives more presentation choices such as font, size, etc.

  3. Started by Genady,

    I've asked ChatGPT a question and got an answer, which is correct, but ... Here it is: Why doesn't it consider B herself?

    • 2

      Reputation Points

    • 56 replies
    • 8.5k views
    • 3 followers
  4. I'm attempting to understand 'self' in Python on a deeper level since I find myself not fully comprehending it when I use it. Consider the following code: class FoodItems: def __init__(self, other arguments): some code def main(): some code item1 = FoodItems item1.main() For the [def main()] function I'm not passing the 'Self' argument in it, yet the code works when I call it. After reading this post, my understanding of 'Self' is that it must be provided every time a method is defined under the class. I receive the error (missing 1 needed positional argument:'self') if I pass 'Self' and then call the method. Could someone please clarify this to me? Whe…

    • 0

      Reputation Points

    • 1 reply
    • 735 views
  5. Started by Lizwi,

    Hi I have learnt that notepad is HTML editor, then what is HTML itself, is HTML a software? Can I edit directly on HTML? For example, if I do programming in python I write a code in python itself not in any editor. Is HTML a software like python? Thanks

    • 2

      Reputation Points

    • 13 replies
    • 3.3k views
    • 2 followers
  6. Started by WalidKhan,

    I'm attempting to compile a hello world c programme on the mac terminal and getting the following errors: mysource.c:1:19: error: /usr/local/include/stdio.h: Permission denied mysource.c: In function ‘main’: mysource.c:2: warning: incompatible implicit declaration of built-in function ‘printf’ This is what I typed into the terminal (the name of the.c file is mysource): MacBook-Pro:~ drummer014$ gcc mysource.c -o mysource I had xcode 3 installed and received the same error, then I installed xcode 4.2 today and am experiencing the same issue. I'm using a MacBook Pro running Snow Leopard. I have tried typing gcc and then dragging the file into the terminal after …

    • 0

      Reputation Points

    • 1 reply
    • 972 views
  7. Started by Bunty12,

    Hello everyone, I'm having trouble understanding the GCD of two numbers in Java. I'm trying to understand the algorithm and code from an online resource but I'm having trouble with the code. The code provided is: public static int gcd(int a, int b) { if (a == 0) return b; return gcd(b % a, a); } I don't understand why the code is written this way or what it is doing. Can anyone provide some insight and explain the code to me? Thanks!

    • 1

      Reputation Points

    • 3 replies
    • 769 views
  8. Started by purpledolly79,

    I know this isn't exactly computer science, but I figured a computer scientist could give me tips, the pictures on my laptop come out grainy and ugly. Is there a way I can fix the problem without spending any money?

    • 1

      Reputation Points

    • 3 replies
    • 736 views
  9. Started by Bunty12,

    Create an algorithm for the Subset Sum problem that runs in time O(nK) or better. Given a set X = {x1, x2, …, xn} of n integers and another integer K, the algorithm should check if there is a subset X' of X whose elements sum to K and if so, it should find this subset. For example, if X = {5, 3, 11, 8, 2} and K = 16, the algorithm should answer YES since the subset X' = {5, 11} has a sum of 16. I have referred to this code from the issue I'm trying to solve: please stop spamming us with advertising! I believe that utilizing dynamic programming techniques can improve the complexity of the problem from O(nK) to something lower. I have discovered an algorithm …

    • 0

      Reputation Points

    • 0 replies
    • 509 views
  10. How can same machine take same machine as input(is it same machine taking encoding of itself as input—if that’s the case, what does that means some examples to understand this)? (in Universal Turing Machine, i know it was possible). What does that even mean here? I feel like adding a turing machine flipper is like cheating and should not be allowed as well.

  11. Started by WalidKhan,

    I'm newbie to algorithms and also was working upon developing a Quick Sort algorithm with such a duplex partition to ensure that it works quickly even on sequences with many equal components. My approach was as follows: def randomized_quick_sort(a, l, r): if l >= r: return k = random.randint(l, r) a[l], a[k] = a[k], a[l] #use partition3 m1,m2 = partition3(a, l, r) randomized_quick_sort(a, l, m1 - 1); randomized_quick_sort(a, m2 + 1, r); def partition3(a, l, r): x, j, t = a[l], l, r for i in range(l + 1, t+1): if a[i] < x: j += 1 a[i], a[j] = a[j], a[i] elif a[i]>x: …

    • 0

      Reputation Points

    • 1 reply
    • 844 views
  12. Consider the example: class Quirky { public static void main(String[] args) { int x = 1; int y = 3; System.out.println(x == (x = y)); // false x = 1; // reset System.out.println((x = y) == x); // true } } I am unsure whether the Java Language Specification contains a rule regarding what value should be loaded to compare with the right side (x = y) of an equation, given that the value on the right side should be calculated first according to the order implied by brackets. Why does the first expression evaluate to false, but the second evaluate to true? I would have expected (x = y) to be evaluated first, and t…

    • 1

      Reputation Points

    • 2 replies
    • 734 views
  13. Started by CrystalMagic,

    Are there computer programs in the public domain that can calculate the defrosting of organs and cells of mammals?

    • 0

      Reputation Points

    • 2 replies
    • 920 views
  14. A step in programming is a function in mathematics. Proof: A function is a relationship between two sets. A set can be represented as being a list or tuple of programs. A function is just a transition between programs. Therefore a step is a function. [g] This viewpoint is from the perspective of both the philosophy of both mathematics and computer science.

    • 1

      Reputation Points

    • 14 replies
    • 1.4k views
    • 2 followers
  15. Started by XYZAY,

    Hi, I am a sixth form student and I am doing a project on AES encryption. Would you mind spending a few minutes on my survey if you know anything about this topic please? This is a legit form made using Microsoft Forms and doesn’t collect any of your information. All responses are anonymous so please do not worry about privacy issues. Thank you so much for your time! https://forms.office.com/Pages/ResponsePage.aspx?id=jfakcxZB5EmSpP77prTGWy1dX0Ny2w5LnBoACi2iurBUN0ZCODZLMzI1QjkzRVBJSlJBNVRXSkQ1MS4u

    • 0

      Reputation Points

    • 0 replies
    • 419 views
    • 1 follower
  16. Started by WalidKhan,

    I have a question about the functioning of 2PL and deadlocks. I'm not sure why this is so difficult for me to grasp, but I tried drawing a pseudo sequence diagram to help. Is my understanding of 2PL correct? I am aware that deadlock handling is not exclusive to 2PL. Is it accurate that if T1 acquires a writelock (exclusive) and T2 tries to acquire a readlock, T2 is obliged to wait? I realise that only one transaction may have a writelock, however according to 2PL, if a transaction is updating (has the writelock), another transaction cannot read (acquire the readlock). Looking forward

    • 0

      Reputation Points

    • 1 reply
    • 599 views
  17. Knowing that we are on the verge of the AI singularity, if it has not already happened, what does that mean for the Turing Test? It's a good question, and one that I think that we should ponder for a moment. The problem is not that they're trying to trick humans anymore into thinking that they are AI. At this point in our humane evolution we have created amazing feats in just 12 years. The field of Artificial Intelligence has really gained a lot of momentum. That being said, what does the Turing test hope to accomplish? I would rather talk to an AI, knowing that it is an AI, and have a deeply meaningful, impactful conversation. These AI's are not only speaking to you…

    • 0

      Reputation Points

    • 0 replies
    • 646 views
    • 1 follower
  18. Hello! If I have, let's say 1000 numbers or 10k numbers, and they all add up to 100 when combined, what would be the most efficient way to verify that in fact the sum of all of them is 100? I was thinking of a Merkle Tree, but I'm not really sure how to apply it in this case. I could just do n + n1 + n2 + n3....+ n10k, but that's not really scalable nor efficient. Thanks beforehand for any help.

    • 0

      Reputation Points

    • 2 replies
    • 1k views
  19. The most prevalent type of exception appears to be java.io.IOException, which also appears to be the most unclear. When I write using sockets, files, and so on, I keep getting the throws IOException error. I've never had one fired on me, so I'm curious what it is that is intended to fire the exception. The documentation is inadequate in clarifying what is going on: This indicates that an I/O exception of some kind has happened. This class represents the generic category of exceptions generated by failed or interrupted I/O operations. What are some scenarios in which an IOException could be raised, and how should it be used?

    • 0

      Reputation Points

    • 1 reply
    • 2.8k views
    • 1 follower
  20. Started by PeterBushMan,

    https://www.tutorialspoint.com/execute_lisp_online.php https://onecompiler.com/commonlisp/3yt4frr3y Two of them cant give the output of the simple program, (+ 2 3).

    • 0

      Reputation Points

    • 3 replies
    • 1.4k views
    • 1 follower
  21. Started by Rilex,

    Hello, I had a little fun with ChatGPT. I gave it some of my theory about consciousness and asked it to act as Richard Dawkins giving a counterargument. Then, Michio Kaku backed it up As we reflect upon ourselves, we are drawn towards something within us that is timeless, something beyond our physical selves that we cannot fully comprehend. This inner essence, this consciousness, is the very essence of our being. This raises many questions. For example, if we were to create a clone of another human, identical in every way, would the clone possess the same consciousness as its original? While the clone may seem identical at the moment of its creation…

    • 0

      Reputation Points

    • 8 replies
    • 2k views
    • 1 follower
  22. Started by kenny1999,

    Long time ago I happened to read some articles about CD/DVD rot, I don't remember the details now but the key point was - Data stored on CD/DVD would lose a little bit over time. Is it real? If a CD/DVD disc is kept and stored normally, will there be some data loss after 10 or 20 years?

  23. Started by toucana,

    This is a recent video posted by a computer repair YT channel I follow. What intrigued me was the nature of the problem. Basically a computer gamer tried to improve the performance of an Asus laptop by applying liquid metal to the motherboard - instead of the thermal paste normally used on heatsinks. And it left me wondering - Did they sleep through the class about metal being an excellent conductor of electricty - or what ? Kudos to the repair guy for getting this one running again ! https://www.youtube.com/watch?v=B-mClhyaJng

    • 0

      Reputation Points

    • 0 replies
    • 495 views
  24. I have a front-end (React) application. I want to build it and deploy to 3 environments - dev, test and production. As every front-end app it needs to call some APIs. API addresses will vary between the environments. So they should be stored as environment variables. I utilize S2I Openshift build strategy to create the image. The image should be built and kind of sealed for changes, then before deployment to each particular environment the variables should be injected. So I believe the proper solution is to have chained, two-stage build. First one S2I which compiles sources and puts it into Nginx/Apache/other container, and second which takes the result of the f…

    • 0

      Reputation Points

    • 0 replies
    • 857 views
  25. When I click on an item inside a dropdown list, the item is correctly clicked but the error: "stale element is not attached to the page document" is raised. I guess this error is raised because of an element I use as changed inside the DOM or has been refreshed, but I didn't find any solutions for now. Here's my code: exam_question_type = self.driver.find_element(By.XPATH, f"//*[name()='svg'][@class='css-19bqh2r']") exam_question_type.click() WebDriverWait(self.driver).until(ec.visibility_of_element_located((By.CSS_SELECTOR, 'class=" css-b02ejv-menu"')) select_question_type = self.driver.find_elements(By.CSS_SELECTOR, 'class="CustomOptionMenu_button__2GnMd"') for …

    • 0

      Reputation Points

    • 1 reply
    • 1.2k views

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.