Jump to content
Search In
  • More options...
Find results that contain...
Find results in...


  • Content Count

  • Joined

  • Last visited

Everything posted by espurritado

  1. I'm not sure I understand exactly the problem you are having. If your problem is that there might come more than one type of exception from within a try statement, just add several catch clauses try{ <whatever comes in> } catch (ExceptionTypeOne e){ <handle exception> } catch (ExceptionTypeTwo e){ <handle exception> } If your problem is that you want to differenciate according to the content of the exception, you should look into the 'e' object so you can try and find whatever you are looking for
  2. scrapy will most likely be the solution you need.
  3. python has datetime. wit it you can create an object representing a time, a date or a date and time. you can make it so it parses an input string in whichever format you want to give it to it
  4. you could consider connecting to the remote pc via ssh using paramiko
  5. you could go with Sikuli It's basically a tool to script movements and actions on the computer. It also recognizes images so instead of using coordinates like you would have to do in AHK you can just use an image of what you want to act on. The code you would have to write is basically a python code with a nice IDE so you can see what you are clicking on instead of just adding file images. also, I'm just going to get you out of your error here: Part of your learning process has to be to look at a piece of code and think "How can this be applied to what I want to do", more often than not, you will find that something completely unrelated can help you solve part of a problem and you will learn a lot that way. Also if you want to get into coding don't go and look online for a piece of code that will solve your problem (which I know you didn't do) but don't refuse a tool when you have the opportunity. If no one used any tool developed by others we would never have gotten even to punch cards.
  6. oh crap, I'm really sorry, I've been reading the slides from that class and the exercise I had to do and I'm not completely sure I even understand them, let alone explain it to someone else. Good luck with it
  7. I took a class in which the professor gave about a week (two lessons) about CORBA. In his words "This thing is ancient and I would be surprised if even one of you ever used it". Imagine my surprise when I heard the other day a coworker asking about how to do something with CORBA. I don't really remember much but post the assignment and what you already got and I might be able to somewhat guide you in the right direction, I'm pretty sure I still have the class slides around somewhere.
  8. if you want to do something with the image, you might want to actually open it as an image instead of as text. Talking from experience, you are more than likely to have a corrupt image as a result since most image formats have redundancies and checks to make sure it's ok. If you are still set on reading as a text file, there's a way to read the file as a stream of bytes, so you wont have the problem you are currently having (which is the charset)
  9. I'm a bit rusty in haskell, but as I see it you would need the first two elements as variables not just the first. from your code would be something like this func (x:xs) | x>0 = x-1 | x>0 head(xs)=head(xs)+length(xs) | (x:func xs) As I said, it's been a while so I don't remember if this is the way to do it or if the parenthesis are necessary. As I'm writing this, it occurs to me that you would need to create the case that there are not enough elements in xs
  10. I think the best thing you can do is go for the python API https://docs.python.org/3.6/c-api/ And do a favor to the world and use the latest version, no one is doing any good keeping python 2 going when there's python 3
  11. you've got no listener, you throw the event but there's no one to take care of it. The fast way to do this is to add this code to main: KeyListener keyListener=new KeyListener(){ @Override public void keyTyped(KeyEvent ke) { } @Override public void keyPressed(KeyEvent ke) { } @Override public void keyReleased(KeyEvent ke) { } }; frame.add(keyListener) and get rid of the key events you've got below. This I can't remember for sure, but you might need to add the keyListener to the game object instead of the frame. Try one of them and if it does not work try the other one
  12. alright, let's do it so it's quite simple to reason from the basics: I assume this images would change every time you open the page so the function you want to use must be defined as the onload attribute of the html body <body onload="myOnLoadFunction()"> now, on the html create 9 img tags with the id attribute image1 through image9 and place them on a 3x3 grid Let's go to the javascript part: You need to store the name of every image so you are able to reference it. The easiest way is to name them img0 through imgN with N being the number for the last image and just make a loop assigning the names var i=0 for(i=0;i<numImages;i++){ listImages.push("img"+i); } now you want a function to generate 9 random numbers without repetition. There was a thread in the forum about it a few days ago. Check it out here. Finally you want to set those images in the img tags you defined earlier. To change the image in a img tag you need to do document.getElementById("img tag id").setAttribute("src","new image name"); This should be everything you need to reason the logic into your program
  13. I took a class that taught it. It was quite interesting the way you set up the parameters and the results of the function. I really liked the way it makes you think about recursive functions. However, I must say, since I took the class I haven't really used the language for anything. I would recommend to study it since it actually helps with understanding concepts and algorithms
  14. your problem is with the charset, try making it open with a different charset until you find the one that matches.
  15. it's been a while since I've done anything with an arduino, but let's try this: create a global variable on which you keep track of the state of the button (other than reading the value of the button) create a global variable on which you keep track of the operation you have to perform (extend or retract) at the beginning of the loop, store in a variable the current value of the button if the current value is low update the global variable with the current value go to the next iteration of the loop if the current value is high if the value on the global button value variable is low change the operation you have to do (change extend to retract or retract to extend) update the global button value with the current value of the button perform the operation the global operation variable tells you to do go to the next iteration of the loop this logic should make it work
  16. oh crap I just saw it. you are not closing the literal in the href <a href="file:///H:\Why\Why.htm">
  17. I assume the image is in the same folder and the name and extension are correct
  18. The easiest way to do it would be to generate the random number to an auxiliar variable, check if the generated number is in the set and if it's not, add it to the set. On the amount of numbers you are generating for that range is more than likely that at least one, if no more, are repeated if you don't check. If you want to understand this try reading about the birthday problem.
  19. well this is going to be kind of obvious and probably you have checked it already but, have you checked it's the same spelling? what happens if for scissors you use just an else instead of an else if?
  20. No, the first and the last address in a subnet are reserved, that's why you only go from to, would be the subnet address and would be the broadcast address. Even then, the default gateway should be the address where you would go in case what you are looking for is not in your network. The default gateway has to be the address where you send the package to connect to a system in a different (but accessible network), the internet or any other network. I'm guessing right now that it has to be you main router
  21. You are printing the reference to the object. Do something like: int[] aux=rowSums(arr2D); for(int i=0;i<aux.length;i++){ System.out.println(aux[i]); }
  22. I think it would be simpler if given a certain task, you got a list of every worker qualified to do the task, and from that list, get the one with less current jobs. I would assume task qualification is not a linear score, but a list of possible things to do, which may or may not be related to each other.
  23. It is possible (and done in some companies). You need OCR and to tell the program which fields in the text you want to keep. Then it's just a matter of creating the email with the fields you want and send it.
  24. When Linus and Luke did the Cherry MX factory tour they mention at some point that at that moment the assembly line was doing a special order for the German goverment