Jump to content

WanderingFool

Member
  • Posts

    556
  • Joined

  • Last visited

Everything posted by WanderingFool

  1. The thing to note is moving from the standard 2d gates to a 3D structure requires more initial investment (R&D and building the factories, as they may require new equipment to be built). So while the initial cost of such products might be higher than consumer grade stuff, the fact the density decreases will have benefits to the consume *down the road*. The way to look at it is like, what is the major cost of making flash? It isn't the lithography, but the purified silicon wafers. So the more you can build out of a single wafer the cheaper things become. Although someone can correct me if I am wrong.
  2. Perhaps it's been too long since my algo classes and graph theory, but is there additional information for the problem? Say each location is a vertex, so you have n vertices. How are they connected? Are the edges (paths/roads) connecting two points a-b defined already/are there one way edges? I could be wrong, but I would imagine there might be a way to set this form of a question up as a flow network. If this could be setup as a flow network (in polynomial time), then it may be a polynomial time (Minimum-cost flow problem). I hope this helps, or at least sparks a bit of insight into the problem. If it is an NP problem, then I would just try thinking of a way to formulate it into a 3-sat...thus making it a np-complete problem
  3. I was hoping there would be some method like grub which would work, but I don't think it can. The issue is the 3 computers use different CPU architectures, so it isn't as simple as just installing it 3 times. My problem is one of the PC's doesn't have boot from network (needs to be esata), and the other doesn't have an internet connection.
  4. Hopefully someone can help me figure this out, as this is a bit of a different situation and I have been having troubles finding out if this would be possible. So to make the overall goal as short as possible the following is what I am trying to do: 1 ssd, 3 different computers with 3 different hardware specs (1 without internet access) The goal is to install ubuntu 14.04 onto 3 different partitions, and have it so each machine has a partition that it can boot from (manually selected by the user). Effectively my use case would be, I bring the SSD to the computer, plug it in via a dock and boot using the SSD and having something similar to GRUB to select the OS which was installed with that computer's hardware. My current setup is I have 4 separate drives, one drive for each computer which I bring along and a second data drive. I just want to consolidate them all into one drive though, so it is easier to carry around (I currently need to carry all 4 drives, as I cannot leave them at the computers where they boot from). (VM's are not an option either) Any help would be appreciated, as I am really at a lose of what to even google. I only really know about setting up dual boots, but nothing about trying to setup 1 harddrive that could be used to boot into multiple computers.
  5. The way I look at it, copyrights should only really belong to the entirety of the work and no API's. Yes you could make the argument that complex API's should be copyrightable, but my argument is it is about the implementation of the API's. Otherwise things like WINE would not exist (if Microsoft wished it)...or even emulators (they are emulating or reimplementing portions of the game hardware's API)
  6. Well in the case of getting trapped in walls, this actually starts getting into how you decide to implement your physics. You could make it so when you detect a collision when traveling right you only block moving right (and not left). With similar concepts for up and down. This actually means you could travel through walls if you are spawned inside of them (ie you don't get trapped). Another option would be to block the movement before you collide with a wall...ie. instead of using x, and y make a tempx and tempy which has the position if you were to move. tmpX = x + cos (angle) * speedtmpY = y + sin (angle) * speedif map (floor (((tmpX + size * 2) / wall) mod wall), floor ((tmpY / wall) mod wall)) = 0 and map (floor (((tmpX - size * 2) / wall) mod wall), floor ((tmpY / wall) mod wall)) = 0 then x = tmpXend ifif map (floor ((tmpX / wall) mod wall), floor (((tmpY + size * 2) / wall)) mod wall) = 0 and map (floor ((tmpX / wall) mod wall), floor (((tmpY - size * 2) / wall)) mod wall) = 0 then y = tmpYend if Something similar to that... Either way it will depend on how you decide you want your physics.
  7. So there are a few things regarding collision to be mindful of. The first is the width of the object, and the second is where the origin of the image is. e.g. is the x,y coordinate of the player actually the bottom left, center left, top left, bottom right, bottom center...etc. I will assume for this purpose the bottom left is the (x, y) coordinate of the player (you could adjust accordingly) So now this becomes a simple collision detection of rectangles. The important thing here is there are 4 points on a rectangle, and you currently are only checking a single point. So here is my pseudo code for it map(floor(x/width), floor(y/width)) == 1 //Wall collision at bottom left side//means you are going leftmap(floor((x+playerwidth), floor(y/width)) == 1 //Wall collision bottom right sidemap(floor(x/width), floor((y+playerwidth)/width)) == 1 //Wall collision at top left sidemap(floor((x+playerwidth), floor((y+playerwidth)/width)) == 1 //Wall collision at top rightside So really you need to check all 4 sides for the collision
  8. The passwords are actually hashed passwords, so the attacker would also need to brute-force to get the password. To be honest, I agree with Microsoft in that it is a bit overblown. The fact is the attacker would have to have to be inside your network in order to really do anything, and I bet there are countless other vulnerabilities you could exploit to do more damage.
  9. Well as SSL said, flood fill is probably the easiest (assuming you use recursion, personally I dislike using recursion on this type of problem because if you get 1000x1000 with all 0's you actually will end up with a stack overflow...but that is beside the point, since you are learning use recursion...and if you come up with a solution and have free time try implementing flood fill without recursion (using stacks)). To address the "color", "color" is just meant as a way to distinguish that you have already processing a point. So if you know the values inputted are always 0 and 1, then you can use the value 2 to tell your program that you have already processed a pixel (and don't have to enter the recursion loop for it). Hope that makes sense. e.g. _abca111b101c101Starting from the (b,b) pixel111121101111121121You would be at (c,c) and looking for the next "0" if we didn't color (b,b) with 2 you would end up going back to (b,b) and end up in an infinite loop. The purpose of coloring is basically to say that you already processed the pixel
  10. It would be very simple to automate the process Yes he only shows deleting his video, but if you notice he shows deleting his video through a browser that isn't logged in as him. He used the identifier from the url as well as the session token from the browser he was not logged into. So it would have been simple to run a script saying delete all videos...or at least automate it so you could delete the videos you want (ie putting the url into a program and having the program delete the video)
  11. ZeferiniX Just a quick note, padX and padY are never used. Why not try (also set padX and padY to equal what the x and y equal at the beginning) int startx = ((int)padX) / 2; int starty = ((int)padY); int endx = ((int)padX) / 2 + 150; int endy = ((int)padY); *Sorry I don't have enough time to figure out if this solution works, just as a note of where to go
  12. The only thing I would add is the work it out by hand method. If your program isn't working find a simple test case where it fails. Then go through each step by hand, and see whether you get the same "wrong" output. If you do, you will learn more about your program, and if you get the right result you can revert to the print statements to figure out where you have gone wrong.
  13. alphabeta Personally I would still try approaching this problem without using regular expressions. The reason I say this by using things like regular expressions to solve these problems is you don't learn necessarily how to program. You can know a language, but to me programming is about how you approach problems and how you build your solutions. While knowing regex is good, and in general this would be an ideal real world solution, you aren't really learning too much by using regex in this case. Here is my ansi c version of a solution (Sorry I am into java right now, so I am not comfortable with the C++ libraries at the moment), but the approach to the problem is the important thing imho. /* containsHelloinputText: the input characters, assumes input is not a null pointer and assumes input is 1+ characters long, null terminated and only lowercaseoutput: 0 failed to find hello 1 hello was foundGeneral approach.The thing to recognize is you only need to find the letters h, e, l, l, o in that orderYou don't have to worry about erasing things from the inputText, but just need to rememberwhich character you have found in the target word and start searching for the next characterafter it like what madknight3 was sayingActually this is probably a lot quicker than regular expressions in the sense of run time,given that regular expressions should have a fair amount of overhead. Although this isn'treally optimized so I guess if someone wants to test by they can (assuming I got this correct)p.s. I haven't even compiled this code, so it could fail miserably*/int containsHello(const char* inputText) { int indexForTargetWord = 0; int indexForInputText = 0; const char* targetWord = "hello"; /* So indexForInputText will be 0, and we will compare the inputText's character against the targetWord's character. If it is a match, we will start searching for the next character in targetWord If it is not a match, we need to keep incrementing indexForInputText until we find one If we reach the end of inputText then we know the targetword's characters never ended up in the inputText's text */ for(indexForTargetWord = 0; targetWord[indexForTargetWord] != 0; indexForTargetWord++) { /* We are comparing here, but */ while(inputText[indexForInputText] != targetWord[indexForTargetWord]) { if(inputText[indexForInputText] == 0) return 0; /* We have reached the end, and have not found the word */ indexForInputText++; } /* Getting here means we found the character, but we still need to look one character in the future for next time, so increment */ indexForInputText++; } /* we have matched the full word if we hit this return */ return 1;}
  14. I disagree, they do not make money off the video being played. They make money off the ad being played, and that creates a problem when channels start disabling ads while doing their own sponsor spots. Remember even though youtube still had ads when google bought it, the ad revenue wasn't enough to make it profitable. All of that said, I am not sure how I feel about this. What should google do then?
  15. Well that is what you get when you try compiling java code as c. It just won't work (System.out.println is java ) To @airfrog19 Clock is an abstract class, which means you can't just create a clock. Try something like LocalTime clock = LocalTime.now();System.out.println(clock.tostring()); //Might have missed a capital or two
  16. I am sorry, but I disagree with this assertion completely. To me this is akin to leaving your door to your house unlocked when you leave and saying the owner is ahead of the game when they start locking the doors (after a neighbour tells them you they walked into your house when you went out). This is actually scary that car companies would offer such features without doing an ounce of protection. The fact that they are updating the cars (which btw won't happen for at least another week) to use httpS just shows how short-sighted they were in terms of security. Security 101, use encrypted connections whenever the data passed through is important. *edit Actually to add onto this, no knowing of any malicous attacks doesn't mean there hasn't been some. The fact the vehicle can be entered and left without showing a trace of being broken into means the crimes might not be reported (or if they are reported the police wouldn't believe them). This premise is the thieves who could solve this type of problem, would also be smart enough to know not to steal all items in the car and spread the attacks over time. (Thus raising no red flags, as again if only one or two expensive items go missing when there are still a few remaining in the vehicle the police are more likely to chalk it up to fraud or misplacing items)
  17. alphabeta take care in reading your assignment, because the devil is in the details. Look at the bolded portion of the quote, and underlined portion That means instead of using > in comparing the values, you really need be using >=
  18. Well without getting too complex into optimization, lets just discuss the simplest ones. You have a number X, and trying to see how many divisors/factors it has. I am going to say X is the number, and D is a divisor. X = D * N; //Since by definition D has to be multiplied by a whole number N is also a full number So looking at this formula there is no point in finding D and then later finding N....but lets limit the case by saying only finding D's so that D < N. So now you are pairing up each D with an N. So the count should be 2 times the amount of D's you find. The exception would be when D * D = X, then you can add one. So with that math said a loop to count the factors could look something like this. int targetNum = 123456;int numFactors = 1; //1 will always be a factor so start at 2double sqrtOfTarget = sqrt(targetNum);for(d = 2; d < sqrtOfTarget; d++) { //Notice that I an only going to the sqrt...because anything //beyond sqrtOfTarget will now mean targetNum = d * n; where d > n...so d would have been counted already when d and n were switched if(targetNum%d == 0) numFactors++;}numFactors = numFactors * 2; //To compensate for the matching n's//Now we have a problem when it is a sqrt, ie numbers like 9 as 3 would not have been counted.//Luckily we can do a single check of d to determine thatif(d*d == targetNum) //Since d is now equal to the number closest int above = sqrtofTarget numFactors++;//And presto, numFactors should be the number correct with doing less than half the amount of compares (if I am correct)//So on 100,000,000, instead of doing 100 million compares, you are only doing 10 thousand
  19. Should also be noted in Java *cough android*, static variables do not always retain their values. ie when you temporarily go away from the app in android the GC might eliminate the static variable values, so you have to save and recover those values.
  20. Perhaps I was a bit too liberal with the delete all command...but when you do cleanup of a program, I would expect that if you do use commands that will recursively wipe a directory that you would at least put in checks to ensure that you aren't cleaning out the wrong folder (or an important folder). Some methods I have seen in the past was the uninstaller wipes the directories that it has created and then cleans out the top level files...this is more a fine approach to the situation, it prevents the deletion of unwanted data (unless you happened to store stuff in the folder which it created, but that is another issue all-together). I hope this makes more sense. Basically I am saying if steam is normally in somewhere like C:\pf\steam, it shouldn't just say delete everything in c:\pf\steam, but rather it should have knowledge of the files that should be in the top level directory and delete those, and then delete the files in the sub-folders *although if possible only delete the files that you know were created, but that can be another issue and more complex*. If they had gone with that approach then worst case scenario you wipe a few folders worth of data and definately no critical data (like entire harddrives worth of data). The main thing that I have an issue with though is that it has in the comments scary, and yet they took zero precautions to check that they weren't deleting the wrong thing
  21. Well it isn't a problem in Linux, it is a problem of using a command that basically assumes you have already run the checks to make sure you aren't about to wipe out stuff you don't need. To be honest, I would have thought that Steam would be able to have come up with better solutions to uninstalling than just calling the delete all commands *they did a similar approach on windows*. It is like using the format command on windows to clear a drive...you need to be careful when you use it not to do the wrong drive
  22. http://www.pcworld.com/article/2871653/scary-steam-for-linux-bug-erases-all-the-personal-files-on-your-pc.html Basically if you manually move your steam folder around in linux, and if some other conditions line up it will end up calling the rf command and wiping out all data that you have write access too *and from the sounds of it, it includes usb devices as well* This does seem a bit scary that they would leave a line as dangerous as this (and even have it commented as scary, which means someone saw it and didn't bother to fix it). If the commenter had the insight to know it was potentially scary, then they should also have had the knowledge to flag it and run checks before running that scary command. To put this in perspective, they could easily have added in lines that checked the $STEAMROOT wasn't blank. For more reading (https://github.com/ValveSoftware/steam-for-linux/issues/3671) Actually it is a bit concerning at how even Windows has a similar problem *albeit a bit less concerning* ( Whenever creating an uninstalling I feel it would be in the companies best interested to actually write one properly and not just go by the "lets delete the entire directory it was installed to" approach
  23. Actually by the sounds of it *could be wrong* it might be even better than this. From my understanding of this, is when you install a program you have to get consent but any updates to it are automatically assumed to have consent *under the concept that the auto-update doesn't install additional software, just pure updating* Again I could be wrong, but I this is what I feel was intended from reading this.
  24. SickSix66 please give more information, but I haven't done C# for a bit, but don't all classes have to have a namespace associated with them? namespace [name] { //classes in here valid } //classes not in here invalid? Maybe I am wrong, I haven't actually tried and as an fyi as others have said please put more effort into explaining the problem you have, it makes it hard to guess and given the length of code you posted any details are usually helpful (and make people more willing to help and go the extra mile)
  25. Personally I don't really too much of a problem, this was just a simple privilege escalation attack. You would need access to the computer or already or already have a program running on the target computer, and if I read the report correctly essentially all this attack allows you to do is create folders anywhere you want. Ultimately this is a pretty minor bug, and there are likely already a few other bugs in the wild that do more than this.
×