Wikipedia:Reference desk/Computing

From Wikipedia, the free encyclopedia
Jump to: navigation, search


The Wikipedia Reference Desk covering the topic of computing.

Welcome to the computing reference desk.
Want a faster answer?

Main page: Help searching Wikipedia

How can I get my question answered?

  • Provide a short header that gives the general topic of the question.
  • Type '~~~~' (that is, four tilde characters) at the end – this signs and dates your contribution so we know who wrote what and when.
  • Post your question to only one desk.
  • Don't post personal contact information – it will be removed. All answers will be provided here.
  • Note:
    • We don't answer (and may remove) questions that require medical diagnosis or legal advice.
    • We don't answer requests for opinions, predictions or debate.
    • We don't do your homework for you, though we’ll help you past the stuck point.



How do I answer a question?

Main page: Wikipedia:Reference desk/Guidelines

  • The best answers address the question directly, and back up facts with wikilinks and links to sources. Do not edit others' comments and do not give any medical or legal advice.
 
Choose a topic:
 
See also:
Help desk
Village pump
Help manual


April 19[edit]

detecting non-overlapping repetitions[edit]

I'm trying to way to detect all the non-overlapping repetitions within a given string. I Googled it and Stackoverflow gave me an excellent solution that's exactly what I wanted[1], except it doesn't work. To clarify, it appears bug-free and works as advertised for most string, but it's misbehaving for some reason for the type of strings I'm working with:

   %2FCatSearch%2F155%2Fengraving-tools%2F32&=%2FCatSearch%2F155%2Fengraving-tools%2F36%2C%2FCatSearch%2F155%2Fengraving-tools%2F32%2C%2FCatSearch%2F155%2Fengraving-tools%2F30%2C%2FCatSearch%2F155%2Fengraving-tools%2F26%2C%2FCatSearch%2F155%2Fengraving-tools%2F21%2C%2FCatSearch%2F155%2Fengraving-tools%2F16%2C%2FCatSearch%2F155%2Fengraving-tools%2F11&v=j&facet=%5B%5B%22vend_name%22%2C%22vend_name%22%2C%22Harvey%22%5D%5D

1. Why is my string not working for the repetitions function?

2. Or alternatively, is there another working solution to the problem? ECS LIVA Z (talk) 20:58, 19 April 2017 (UTC)

The solution you linked to finds CONSECUTIVE repetitions; that is, repetitions with no extra characters appearing between the repeated strings. Your example does not have any such repetitions (except the string "55" where "5" is repeated). What type of repetition are you trying to find? Do you want to find cases where the substring is repeated anywhere in the string, with arbitrary strings appearing between the repeated substrings? CodeTalker (talk) 22:05, 19 April 2017 (UTC)
Ah, that's it. Thanks. I'm not sure how to modify the regex though.
Yes, in my case arbitrary strings can appear between the repeated substrings. ECS LIVA Z (talk) 22:17, 19 April 2017 (UTC)
Also in my case all the repeated substrings appear to be longer than 6 characters, so this should help on the runtime complexity part. (counting arbitrary length repeated substrings is probably O(n^3) or even harder). ECS LIVA Z (talk) 22:20, 19 April 2017 (UTC)
In Perl the regexp (.{6,})(.*\1){3} will match a string that contains at least 4 (i.e. 3+1) non-overlapping instances of the same substring of length at least 6, and sets $1 to the repeated substring. But I don't know a way to generalize it so that it tells you how many times the substring is repeated. --76.71.6.254 (talk) 22:59, 19 April 2017 (UTC)
Yeah, I tried this but it doesn't work:
   def repetitions(s):
      r = re.compile(r"(.{6,}?)\1+")
      for match in r.finditer(s):
          yield (match.group(1), len(match.group(0))/len(match.group(1)))
The regex part is pretty tricky. I'm not sure how to get past the consecutive repetitions part. ECS LIVA Z (talk) 23:14, 19 April 2017 (UTC)
  • My pseudocode below uses array indices that start at 1.
If I understand the problem correctly, you want to take as input a string, and return a list of all substrings that are present more that once in S and their repetition indices. So for instance shazhama should return ['h',(2,4);'a',(3,5,7);'ha',(2,4)].
Depending on your computation time constraints, the brutal solution can be enough (O(n^3) does not look too bad):
Define N = length(S)
Initialize result_list as empty
For i from 1 to N
  For j from i to N
    Define snippet=S[i:j]
      If (snippet is not already in result_list)
        Define list_k = every index such that S[k:k+j-i]==snippet;
        If list_k contains more than one element
          Add [snippet, list_k] to result_list
        End If
      End If
  End For
End For
Return result_list
Regexping can give elegant solutions, but efficient solutions are good, too. TigraanClick here to contact me 16:26, 21 April 2017 (UTC)
Thank you so much! This is excellent. ECS LIVA Z (talk) 18:47, 21 April 2017 (UTC)

Extending a network attaching an eth[edit]

I want to extend the range of my wi-fi to cover two flats in different floors. For that, I'd want to connect an eth cable to a router's eth port, pass the cable through the stairs (20m), and attach some device at the other end, so that the recipient also gets a wireless connection. I don't want to use a repeater to make the wireless signal more powerful nor those networks through routers connected to the power lines.

What device would I have to connect to the other end of the cable? Would this device also need to be plugged? --Hofhof (talk) 21:03, 19 April 2017 (UTC)

What you want is a wireless access point. It will need to have a connection to your router to be a part of your network, so you'll still need to plumb that cat6. ᛗᛁᛟᛚᚾᛁᚱPants Tell me all about it. 21:30, 19 April 2017 (UTC)
So, I connect a cat6 to my router and the WAP at the other end? And does the WAP get its power from the cat6, like a mouse, keyboard or external HDD get the power from the USB cable?--Hofhof (talk) 22:21, 19 April 2017 (UTC)
Sorry for the late response. No, the WAP will need power from its own adapter. Each WAP should come with a power adapter and cable when you order it. Ethernet can't carry power the way USB can. ᛗᛁᛟᛚᚾᛁᚱPants Tell me all about it. 17:38, 21 April 2017 (UTC)

Google Power over Ethernet and ensure that whatever WAP you pickup can be powered in this manner. This is very common, requires no configuration, and is easy to use. 97.102.87.227 (talk) 23:40, 22 April 2017 (UTC) — Preceding unsigned comment added by 97.102.87.227 (talk) 23:39, 22 April 2017 (UTC)

April 20[edit]

Date calculations in Microsoft Excel: how to calculate the difference between two dates[edit]

Does Microsoft Excel have any way to perform the following date calculation? I have an "earlier date" (let's just say, June 27, 1907). I have a "later date" (let's just say, February 5, 2011). And I want a calculation that tells me how many years, months, and days have elapsed between the two dates. So, I want my "final answer" to be something like: "103 years; 7 months; and 9 days" (or whatever the actual calculation is). What I normally do is this: I take the earlier date and "minus" it from the later date. In this case, that gives me 37,844 days. I take that value (37,844 days) and divide it by 365.25 days (i.e., one year). And, in this case, that gives me 103.6112 years. So, for various reasons, this method is not "good enough" for my purposes. First, I'd like an "answer" that is reported back as "xx years; xx months; and xx days" format (as opposed to "103.6112 years"). Second, I want the computer to perform an exact calculation, taking into account leap years, etc. (My division by 365.25 is just a simple and generic approximation. The exact results would depend on whether or not the specific dates did -- or did not -- entail leap days.) So, is it possible to get what I want from Excel? Thanks. Joseph A. Spadaro (talk) 03:37, 20 April 2017 (UTC)

Not to my knowledge. You can format the cell containing the result to show what the date would be if that amount of time had elapsed since the stroke of midnight, December 31st, 1899. Or use something like this to figure it out. ᛗᛁᛟᛚᚾᛁᚱPants Tell me all about it. 05:02, 20 April 2017 (UTC)
It looks like you can use the DATEDIF function to do this. It may depend on which version of Excel you are using.--Phil Holmes (talk) 07:59, 20 April 2017 (UTC)
I am using Microsoft Office 2016. I looked at that "DATEDIF" function. But, that does not do what I am looking for. That simply tells me how many years (or how many months; or how many days) have elapsed between two dates. As far as I can tell, that is. And I can already do that with the simple "minus" calculation that I referred to above. Joseph A. Spadaro (talk) 11:46, 20 April 2017 (UTC)

Follow-up: I found this page on the internet: How to use dates and times in Excel. A little bit down the page, there is a section entitled "How to Find the Number of Days, Months, and Years Between Two Dates". It has an extremely unwieldy formula. But, it does work. Thanks. Joseph A. Spadaro (talk) 12:01, 20 April 2017 (UTC)

Yeah, it looks like a hot mess, but it's actually simple. You just work through subtraction, starting at years, then doing months, then days. Honestly, I wouldn't bother. I'd take a guess and punch it into a date calculator, then refine my guess based on that, and have it done in a minute or two. But I'm impatient like that, more interested in results than in reusability. ᛗᛁᛟᛚᚾᛁᚱPants Tell me all about it. 12:28, 20 April 2017 (UTC)
Thanks. Yes, I agree. But, I need this calculation for a lot of dates (not just for one or two dates). So, I can't be bothered to go through a "trial and error" for each and every one that I need. I wanted a formula that will do all the calculations for me. I agree. If I only needed this for one or two dates, I would have used your method of "trial and error" and refining the results. Thanks. Joseph A. Spadaro (talk) 13:08, 20 April 2017 (UTC)
  • Apparently, you found a formula that works (even though it is ugly), but depending on what you use the results for, you should be wary that "months" and "years" are not fixed-length units of measurements, because of leap years and non-fixed month length. For instance, the formula will say there is "one month and zero days" in the interval February 1, 2017 - March 1 2017, and the same for March 1 2017 - April 1 2017, but the latter is 31 days instead of the former's 28.
I don't think I taught you anything, but if you are looking at the "days" part in "10 years, 8 months and 5 days" you probably want a good precision to compare the dates, which that phenomenon will destroy. TigraanClick here to contact me 13:58, 20 April 2017 (UTC)
Thanks. Yes, exactly. And I had assumed (wrongly) that Excel would have some "simple" calculation for all of this. One that would, in fact, take into account leap years, leap days, different month lengths, etc. It seems that it (Excel, that is) does not. If doing one or two calculations, it's probably just easier to do the whole mess manually. Thanks. Joseph A. Spadaro (talk) 14:10, 20 April 2017 (UTC)
Make sure not to work with dates before March 1, 1900, because the Windows version of Excel falsely believes that February 29, 1900 existed in the Gregorian calendar. Jc3s5h (talk) 14:10, 20 April 2017 (UTC)

(edit conflict)If you want to store it in a vba module, try this:

'this function performs the calculations
Private Function GetDiffInYYMMDDFormat(earlyDate As Date, laterDate As Date) As String
    Dim years As Integer
    Dim months As Integer
    Dim days As Integer
    Dim container As Date
    
    container = laterDate - earlyDate
    years = Year(container) - 1900
    months = Month(container) - 1
    days = Day(container) + 1
    
    GetDiffInYYMMDDFormat = "" & years & " years, " & months & " months, " & days & " days"
End Function

'call this sub to get the result
Public Sub CalcuateDateDifference()
    'replace "A1" and "A2" with the actual cells that contain the earlier and later dates, respectively
    ActiveCell.Text = GetDiffInYYMMDDFormat(Range("A1").Value, Range("A2").Value) 
End Sub

I'd have offered this last night, except I use Open Office at home, and didn't want to bother proof-reading my code for syntax errors and proper capitalization. This actually obfuscates the leap year, but as the format you said you wanted doesn't account for leap years, this isn't actually a problem. Also, if you're going to abstract this back to a count of days for any reason, you will need to add 1 day if the date range crosses the millennium. (2000 was an the rarest year in the leap year formula. ᛗᛁᛟᛚᚾᛁᚱPants Tell me all about it. 14:49, 20 April 2017 (UTC)

@MjolnirPants: Thanks. But ... huh? I have no idea what any of that means? I don't even know what "vba module" means. I just know how to use Excel, and just the basics at that! What is this "vba module" stuff you are talking about? And what does that have to do with Excel? Thanks. Joseph A. Spadaro (talk) 23:32, 20 April 2017 (UTC)
Press Alt+F11 when you have your workbook open to open the VBA IDE, then near the upper left of that window you'll see a list of all the sheets in your workbook. Double click on the sheet you're using, then paste that code in the big writing window. Then, replace the "A1" and "A2" as indicated (be sure not to delete the quote marks!) with the address of the cells holding your dates, select the cell you want to hold the result (you'll have to move the VBA IDE window aside), then go back to the VBA window, make sure your cursor is on the line that starts ActiveCell.Text = and hit the play button near the top of the VBA window.
Or send me an email and I'll email you an empty workbook set up to do the calculations (though be warned: I can't do excel with VBA over the weekends because I don't have excel at home). ᛗᛁᛟᛚᚾᛁᚱPants Tell me all about it. 23:45, 20 April 2017 (UTC)
@MjolnirPants: Thanks. I will try that when I have some free time, a bit later. So, you are saying that this "vba module" is essentially a component or a feature within Excel? Is that correct? (I never heard of it until just now.) Thanks. Joseph A. Spadaro (talk) 00:27, 21 April 2017 (UTC)
Yes, it's how excel does all the 'advanced' stuff it's capable of. Google excel vba for more. The programming language used (VBA stands for Visual Basic for Applications) is actually quite simple, once you get used to it. It's based on a language called BASIC, which was invented for the specific purpose of both teaching programming, and allowing brand new programmers to write code. ᛗᛁᛟᛚᚾᛁᚱPants Tell me all about it. 02:46, 21 April 2017 (UTC)
Thanks. I will have to check it out. Like I said, I never heard of this till just now. Thanks! Joseph A. Spadaro (talk) 03:51, 21 April 2017 (UTC)

Comparing time series[edit]

I have two sets of time-stamped data that I need to compare in Excel. One set ("real" data) was logged at 2 second intervals initially, then switches to logging at 10-minute intervals (and just to be awkward, this is at hh:02, hh:12, hh:22, etc). The other set (generated by computer prediction) has values every 10 whole minutes (hh:00, hh:10, hh:20, etc). Is there an easy way to compare the predicted data against the closest real data?Iapetus (talk) 14:25, 20 April 2017 (UTC)

I'm not real clear on what you're describing. Could you expound some more? Don't worry if it takes a wall of text, I'll still read it. ᛗᛁᛟᛚᚾᛁᚱPants Tell me all about it. 14:52, 20 April 2017 (UTC)
I have two sets of data (tide data, to be precise). One set is actual, measured tide height data. The other is predicted tide heights for the same time and place. I want to compare them (calculate difference, etc) to assess how well the prediction matches reality. The predicted data consists of a series of values with a time stamp (date and time) every 10 minutes, e.g.:
  • 2016/09/01 16:40 0.318
  • 2016/09/01 16:50 0.315
  • 2016/09/01 17:00 0.312
The real data is similar, but the recording interval is different (and changes part way through the data set):
  • 2016/09/01 16:45:30 1.256
  • 2016/09/01 16:45:32 1.255
  • 2016/09/01 16:45:34 1.243
  • ...
  • 2016/09/01 23:02:00 1.439
  • 2016/09/01 23:12:00 1.446
  • 2016/09/01 23:22:00 1.462
For each epoch in the "predicted" file, I need to find the closest in time "real" value, so I can compare the height values. Is there an easy way to do this in Excel?Iapetus (talk) 15:41, 20 April 2017 (UTC)
You'll probably need VBA for that. I can write the code easily enough if you post a decent sized sample. Let's say one day's worth. ᛗᛁᛟᛚᚾᛁᚱPants Tell me all about it. 15:55, 20 April 2017 (UTC)
Tides follow a sinusoidal path (technically the sine wave caused by the Moon plus the sine wave caused by the Sun), so you should fit the predicted values to such a curve, then use that curve to find the heights at the actual times when samples were taken. Then compare those heights to the actual heights observed. (I say to use the predicted values to plot the curve, since they presumably won't be influenced by other factors, like waves, unlike the actual measurements.) As far as analyzing the results, if your actual readings are consistently higher or lower than the predictions, at certain times of the day, month, or year, then there's something wrong with your model. If your predictions are a bit high just as often as they are too low, with no apparent pattern, then it's probably a good model. StuRat (talk) 16:35, 20 April 2017 (UTC)
For a real roundabout method, you can round the timestamp to the nearest value you want, I found a few formulas you can check out here. You'll have to play around with the exact numbers to get it to what you want. Then use pivot tables to compare the two. uhhlive (talk) 18:28, 20 April 2017 (UTC)
  • to be clear, the code I'm offering to write (I want a good size sample just to check it) will plot the existing predictions and use that plot to generate a new prediction for each exact time of measurement. It's won't be perfect without access to the prediction algorithm, but it'll be closer than comparing times that could be off by up to 5 minutes. ᛗᛁᛟᛚᚾᛁᚱPants Tell me all about it. 18:36, 20 April 2017 (UTC)
I've found a simpler solution: 1) create a new column containing the times rounded to the nearest 10m, using the formula =round(T/X,0)*X (where T is the time and X is 10 minutes in decimal days. 2) Then use Vlookup to find corresponding values. Iapetus (talk) 12:35, 21 April 2017 (UTC)
That will leave you with the same > 5min disparity I mentioned above, but if that's not important, then there you go. ᛗᛁᛟᛚᚾᛁᚱPants Tell me all about it. 12:55, 21 April 2017 (UTC)

April 21[edit]

Monospaced fonts in Chrome[edit]

Is there a reason why monospaced fonts cannot be seen in Google Chrome? For example, as I type this, in the edit box it used to be Courier, but now it is showing up as Arial. And on sites such as Retrosheet, statistical data is difficult to follow in columns without a monospaced font. I have checked the browser settings, and I have Courier listed as my monospaced font. But it just doesn't show up anymore, on any site.    → Michael J    06:45, 21 April 2017 (UTC)

Following up, everything is showing up Arial, even fonts specified to be something else. For example, if I try to make these words should be appearing as Times New Roman, but on my screen they are Arial. My signature should be Century Gothic.    → Michael J    07:34, 21 April 2017 (UTC)
Are you using your computer or someone else's computer? In settings, under Web Content, you can set how fonts are used. You can set it to use Arial for everything or Wingdings for everything - anything you like. If it is not your computer, I expect that the person who set it up went in and set the fonts that way. If it is your computer (and nobody else had access to mess with you), then it is an issue of trying to figure out how your settings got messed up. 209.149.113.5 (talk) 12:46, 21 April 2017 (UTC)
It is my computer, and under the Web Content settings, the fonts are set for Futura (standard), Georgia (serif), Futura (sans-serif), and Courier New (fixed-width). I do not even have Arial selected. Yet everything is showing up Arial. Thanks for your suggestion, but that is not it.    → Michael J    13:46, 21 April 2017 (UTC)
Sometimes poorly written extensions can mess with Chrome's font rendering. I would try disabling all extensions and see if that fixes the problem. If it does, it shouldn't be too hard to turn them back on one at a time to figure out which one is causing the issue. ApLundell (talk) 14:50, 21 April 2017 (UTC)
I do not know what that means, "disabling all extensions". I don't even know what extensions are or where to find them. And if I could find them, how are they disabled?    → Michael J    01:55, 22 April 2017 (UTC)
here are some instructions.
Basically, you click the hamburger button (☰) in the upper right, you click "tools/extensions". You should get a list of all the plugins installed in your browser. There will probably be a couple basic ones from Google, maybe whatever ad-blocker you have installed, and probably just that. Anything else, be suspicious if you don't remember installing it. ApLundell (talk) 17:51, 22 April 2017 (UTC)
Thanks, ApLundell! I found the problem. There was an extension called CSS Override. I'm not sure where it came from, but it's gone now!    → Michael J    20:23, 23 April 2017 (UTC)

Please help identify this graph and suggest software that could replicate it.[edit]

http://imgur.com/JUEpEBi

Can someone please help identify this graph and suggest some kind of software that could replicate it? Much obliged! 138.253.64.157 (talk) 13:22, 21 April 2017 (UTC)

I could do that in Inkscape quickly. It is just a bunch of gradient fill bezier lines. I'd prefer to use Dia, but Dia doesn't do gradient fill on lines. 209.149.113.5 (talk) 13:43, 21 April 2017 (UTC)
D3.js does do this kind of chord diagram (which is what you want, but with a circle rather than mapping one range to another). D3 is super flexible, so I'd be surprised if it can't do exactly what you need. StackOverflow appears to be pretty good with answering D3.js questions. -- Finlay McWalter··–·Talk 13:49, 21 April 2017 (UTC)
(edit conflict)Well, right there on the image is the web address http://www.nicva.org/article/who-is-in-charge-of-the-new-departments, which shows that the chart documents organizational changes by the Northern Ireland Council for Voluntary Action. It's actually a screenshot; the chart at the page is interactive. Looking into that, we can see that it was made with javascript, however the chart itself is hosted on an Amazon web services platform, meaning we can't just go to the domain root and see if it's a company offering a product that might produce that. It relies on another script, however that one has been optimized so that there are no comments in it which would tell us anything about how it was created. It's also hosted on gstatic.com, which is a google content delivery network, so that doesn't tell us anything, either.
I would assume that this was created by software, though I could be wrong. I've been asked to make one-off applets similar to this one from scratch before, and it's really not that uncommon (though optimizing the code for such a project would be unlikely, as it makes the code much harder to change).
As to how you could replicate the chart as depicted in the image: use Inkscape, if you already have the data. If you're trying to produce an interactive version like the one displayed at the source, then I would suggest attempting to contact someone at the NICVA technology department, as their website seems to be maintained internally and trying to find out who made that chart. I know it sounds kinda dumb, but I've done the exact same thing several times before, and always gotten a positive response. I hope this helps. ᛗᛁᛟᛚᚾᛁᚱPants Tell me all about it. 13:51, 21 April 2017 (UTC)
That is a Cosmograph.
It's apparently possible[2][3][4] to make them in Excel, but even having downloaded the file, I don't quite understand how it was done. ApLundell (talk) 21:59, 21 April 2017 (UTC)

April 22[edit]

need help with assignment in Unity/C#[edit]

My daughter is having a problem with an assignment in Unity/C#. This is a two-player game. The arrow keys control the first player and the W-A-S-F keys control the second player. She had this working but she added to the program and the W-A-S-F keys quit working for the second player. I think it must be something simple, but I don't know this language. Can someone help a little?

Thank you. Bubba73 You talkin' to me? 02:24, 22 April 2017 (UTC)

Without looking at the code, I suggest she goes back to the previous working version of the code, then adds in as little as possible at a time, until it breaks again. This should help to isolate the problem. You could also list the previous, working version here, so we can do the same. StuRat (talk) 02:53, 22 April 2017 (UTC)
She sent me the code in a Word file, with the changes she had made highlighted. I've commented out those lines. Bubba73 You talkin' to me? 03:13, 22 April 2017 (UTC)

Two obvious first things to check :

  • Make sure the player object is still tagged "Player1". That would be easy to accidentally change in the editor, and would cause this code to assume the player was player two. (And thus not affected by WASD.) Oh. I misread the question. I thought player 1 was the stuck one.
  • Make sure the script is actually running. Unity scripts can fail surprisingly gracefully with just an error in the log window. Perhaps there's a null reference somewhere and you're not noticing the error because you're staring at the character who stubbornly refuses to move.

ApLundell (talk) 03:29, 22 April 2017 (UTC)

It looks like "speed"(really acceleration) is set in the editor. Make sure it's been correctly set for both players.
There's also a bit of a logical oddity here. This script looks like it will be attached to each player individually, but it contains as member values both player's scores. At best this is redundant, at worst it could cause the scoring to be inconsistent. ApLundell (talk) 03:40, 22 April 2017 (UTC)
In her note to me, she says that the players share the script:
"Horizontal2 and Vertical2 are keyed to wasd (for Player2).
Changes are highlighted including. I commented out a line from the original code so I highlighted just the slashes. Before the changes Player2 responded to wasd, and the code worked properly. Now Player2 is unresponsive. Player1 has always responded.
Two different objects (Player1 and Player2) share the following script." Bubba73 You talkin' to me? 03:51, 22 April 2017 (UTC)


They don't exactly share a script. They each have their own instance of it. I'm not sure she understands that.
In general there's a lot of confusion here trying to use local variables as globals. Typically you'll want to create a singleton "game manager" or "game controller" that has score and stuff, and then the player code can interact with that.
Here's a simple example from one of the official Unity video tutorials. A "game controller" script is attached to an empty object in the scene. (Notice how the DestroyByObject script in that example does a FindByTag call, then it has a reference to the game controller and can then access its public members.)
https://unity3d.com/learn/tutorials/projects/space-shooter-tutorial/counting-points-and-displaying-score
All that said, I can't identify the specific bug that would cause the exact problem described. Hope something I said helps with her assignment. ApLundell (talk) 04:03, 22 April 2017 (UTC)

Oh. I think I have an idea. pOS and pTS are references, but there's no check if they're null. These are variables you've indicated are newly added. Because of the way she's got her scripts set up, she would have to manually set these variables in the editor twice. If she didn't set both of them for each player, it would hit a Null Reference Exception , and bail out of the FixedUpdate function for that player. I'll bet that's it. ApLundell (talk) 04:12, 22 April 2017 (UTC)

Thanks - I sent her a link to all of this but she went to bed about 2 hours ago. She'll see it tomorrow. Bubba73 You talkin' to me? 04:26, 22 April 2017 (UTC)
Hello Bubba73's daughter! I hope something in my above rambling is helpful! ApLundell (talk) 04:33, 22 April 2017 (UTC)
Resolved

She has player 2 working now. She thinks it was because the text displaying the scores was in FixedUpdate() instead of Update(). Bubba73 You talkin' to me? 15:41, 22 April 2017 (UTC)

That's good... But I hope she's also sorted out how she's doing the scoring. In object oriented programming, two instances of an object don't share member variables.They each have their own. ApLundell (talk) 17:34, 22 April 2017 (UTC)
  • Bubba73, this is just a quick infodump, but you can use <syntaxhighlight lang="c#"></syntaxhighlight> to produce better looking code in posts like these. I had actually changed it last night and was going to make a note, but I hit an edit conflict and then had to deal with my kids, and then forgot all about it (I just went ahead for the hell of it and so you can see what it looks like with this edit). I'm glad to see the problem got resolved. ᛗᛁᛟᛚᚾᛁᚱPants Tell me all about it. 17:40, 22 April 2017 (UTC)
    • Programmers have gotten so soft. Back in my day, we punched Fortran on cards. No syntax highlighting - everything was upper case. No indentation or blank lines either. And rarely a blank space that wasn't required.  :-) Bubba73 You talkin' to me? 21:00, 22 April 2017 (UTC)
[5] (be sure to turn annotations on). ᛗᛁᛟᛚᚾᛁᚱPants Tell me all about it. 23:31, 22 April 2017 (UTC)

Public key signatures[edit]

I have recently been introduced to public key cryptography. I came across this problem and I'm not sure how to approach it. If I send someone an encrypted message signed with my signature key, what's to prevent them from encrypting it again and sending it to other people pretending the message is directly from me?

Perhaps I haven't gotten my head around how public key signatures work. If my friend sends me a message signed by him, and I forward it to other people, they will think it's from him right? I'm assuming there is something I'm missing to prevent this situation.--Testing questions (talk) 15:05, 22 April 2017 (UTC)

If A writes a letter to B which begins "Dear B" and signs it with his (A's) private key, then B can't send it to C and convince C that A sent it directly to C, because of the salutation. Similarly, if it's an email message, it will have a To field in the header which identifies whom A sent it to. Of course B can't change the salutation or To header without invalidating the signature. On the other hand, if it's not a message but some other type of document which isn't specifically addressed to B, then B can indeed forward it to C via some unauthenticated channel and convince him that it came directly from A. It's up to C to recognize that the channel is insecure even though the message is signed. But in most cases this would be of limited value to B since A did indeed write the document, and the only thing B is spoofing is whom A sent it to. CodeTalker (talk) 15:42, 22 April 2017 (UTC)
So should you always try to directly address the recipient? What about certificates? Can they prevent recipients encrypting the message again and sending it to someone else?--Testing questions (talk) 15:50, 22 April 2017 (UTC)
The signature should verify that the exact text of the message was encrypted by the original author. You couldn't alter it and preserve that signature.
You could copy/paste the text into a new email, and add your own signature, taking credit for the other person's work. Or you could send the whole thing, signature and all, to a third party, but you couldn't alter it and then reapply the original person's signature. ApLundell (talk) 17:40, 22 April 2017 (UTC)
There's, of course, an article at Digital signature that is pretty good. ApLundell (talk) 17:43, 22 April 2017 (UTC)
The case where you "send the whole thing, signature and all, to a third party" is what I am interested in. That third party would believe it was sent directly to them from the signer with no intermediary. The signer may not have wanted them to see it. CodeTalker helpfully mentioned including salutations that the third party would notice. However, are there any technical means to prevent this happening? Is the only solution for the third parties be expected to do proper authentication so they know who the actual sender is? Is the anything the original signer do to prevent this situation?--Testing questions (talk) 19:02, 22 April 2017 (UTC)
Public key cryptography, by itself, has no concept of sending, receiving, or anything like that. All you get is blocks of data that are encrypted and/or signed. Public key crypto doesn't say anything about how those blocks are moved around, only where they come from and what can be done to them. If you wanted a cryptosystem that did verify *who* transmitted data, and what means it took to get to someone, you would have to build a more sophisticated system which included that information, and protected it appropriately with the relevant checks. In this case, as in most other applications of cryptography for data security, the actual crypto is the easy bit - building a worthwhile, workable system that solves real-world problems (using those basic cryptographic building blocks) is difficult, and quite apt leaving weaknesses which arise not from the crypto itself, but from the difficulties of using it safely. -- Finlay McWalter··–·Talk 19:46, 22 April 2017 (UTC)
Correct, what you're asking about is essentially an authenticated email system. Public key cryptography might be a component of such a system (as it is for DKIM for instance), but PKC by itself doesn't address such issues as authenticating the sender of a message, preventing spoofed resends, etc. CodeTalker (talk) 19:18, 23 April 2017 (UTC)

April 23[edit]

Review for Macbook Pro 15" mid-2015 integrated graphics[edit]

I'm trying to find a review for the mid-2015 Macbook Pro with Intel Iris graphics. I'm specifically interested in its battery life. To clarify, there are two separate models of the mid-2015 15" Macbook Pro:

Model 1: Macbook Pro 15" mid-2015 with AMD graphics [6]

Model 2: Macbook Pro 15" mid-2015 with Intel Iris graphics [7]

Model 1 has thousands upon thousands of reviews on the internet[8][9][10][11][12][13][14][15][16][17], most of them done by reputable sources. Model 2 has no review on the web, as far as I can find. Which is strange because model 1 has been discontinued, while model 2 has not. Model 2 also had better sales compared to model 1 (as reflected by the fact that it's still being manufactured).

I'm specifically interested in the battery life difference between the two models. All I could find are forum posts[18][19] positing that the integrated graphics models has better life, but with no evidence to back it up. A review that contains a proper battery life test should clear that right up. ECS LIVA Z (talk) 04:30, 23 April 2017 (UTC)

Using Arduino without using it[edit]

Once we have written and compiled/uploaded a sketch successfully to the Arduino, (supposing it works with 2 or 3 steeper motors and a gyroscope chip attached to particular terminals of Arduino), is it possible to remove Arduino alltogther and upload the successfully compiled program to some small chip especially designed to take place of Arduino, so this self-created gadget (with an appropriate battery ) can be of portable use without wasting the Arduino itself? 2405:205:4000:9A2B:0:0:12B7:80A0 (talk) 09:30, 23 April 2017 (UTC)

An Arduino board is basically a way of making it easy to do prototyping. A straightforward commercial implementation would simply put the circuit consisting of the processor and some other devices from the Arduino board together with the ones on the prototype breadboard on a small printed circuit board. Dmcq (talk) 13:32, 23 April 2017 (UTC)
Yes! Absolutely. Most of the arduino is just a prototyping board.
The tricky part is that the ATMEGA chips in an Arduino come pre-loaded with the arduino bootloader software, so if you just pop a blank chip into an arduino it's not going to work.
There are many ways to get the bootloader on an blank chip. This is probably the cheapest if you already have some Arduinos laying around, but the proper programmers aren't expensive. [20] And there's plenty of instructions[21] on how to use them. ApLundell (talk) 15:08, 23 April 2017 (UTC)
Or you can skip all that and pay a couple extra bucks to buy chips with the Arduino software loaded and ready to go.[22]. ApLundell (talk) 15:11, 23 April 2017 (UTC)

How do I change a list of numbers to a specific number in notepad++?[edit]

How do I change a list of numbers to a specific number in notepad++?

As some example changing all the numbers between -1 and -32768 (including -1 and -32768) to -32768 201.79.59.205 (talk) 17:42, 23 April 2017 (UTC)


April 24[edit]

Recommendation for software to make compilation music CDs[edit]

I'm asking for a recommendation for software to make compilation music CDs from other CDs. I want to read in several CDs, store the files on the HD, and then pick sets of them to burn to a CD. Years ago I used Roxio and Nero for this, but they got too difficult to use for this purpose. Bubba73 You talkin' to me? 00:59, 24 April 2017 (UTC)