Wikipedia:Reference desk/Archives/Computing/2016 September 15

From Wikipedia, the free encyclopedia
Computing desk
< September 14 << Aug | September | Oct >> September 16 >
Welcome to the Wikipedia Computing Reference Desk Archives
The page you are currently viewing is an archive page. While you can leave answers for any questions shown below, please ask new questions on one of the current reference desk pages.


September 15[edit]

Compiling file information[edit]

I'm not sure of the proper term for this, so it's difficult for me to search this out. I have a large collection of files in nested folders. Those files obviously have various attributes (file size, created date, etc.) What I would like to do is to capture that information directly into a file rather than just seeing it on the Windows Explorer screen. What would that operation be called and is there a Windows 10 compatible program that does this? I would eventually want to put all this into an Excel file, but a dump to a CSV or whatever would be fine. Ideally, it would be capable of grabbing the display resolution of video files (a feat W10 doesn't seem to be able to perform). Matt Deres (talk) 00:37, 15 September 2016 (UTC)[reply]

I would call that metadata. Much of it is in the file directory, but perhaps not all, such as video file resolutions. It would be easier to gather the directory info in Linux, just requiring a script, but still possible in Windows. StuRat (talk) 01:42, 15 September 2016 (UTC)[reply]
The command line tool dir will probably do what you need. Here is online documentation for that tool. You might want to use the /s option, for recursion into subdirectories; you might wish to use > to output directly into a file. Examples are provided in the documentation.
Excel should be able to import that text file, and you can use "Text to Columns" to parse it into columns.
Surely there are hundreds of other ways to do what you want, but this approach uses tools that are built into Windows by default.
Nimur (talk) 02:43, 15 September 2016 (UTC)[reply]
Thank you; I will give dir a try when I'm back on my home computer. The links provided show examples of parameters on including or excluding file types and so on, but don't say much on what file attributes get returned. If I'm reading this correctly, it looks like I will only get filename, extension, and file size. Matt Deres (talk) 15:19, 16 September 2016 (UTC)[reply]
The flag /T controls how timestamps are displayed. You can show:
  • /Ta for last-access time
  • /Tc for file-creation time
  • /Tw for file-modification (write) time.
The documentation and "dir" help-text might not be the most user-friendly in the world, if you haven't got 30 years of experience with Microsoft's command-line interface; so if I'm glossing over a technical detail that isn't self-explanatory, just let me know. Nimur (talk) 16:01, 16 September 2016 (UTC)[reply]
Karen's Directory Printer may be useful to you. (((The Quixotic Potato))) (talk) 14:50, 18 September 2016 (UTC)[reply]

From Maximum subarray problem:

The algorithm can also be easily modified to keep track of the starting and ending indices of the maximum subarray.

I'm trying to work out exactly how to do that. So far I managed to figure out how to track the ending index. Here's what I have so far:

def max_subarray(A):
    max_ending_here = max_so_far = A[0]
    start = end = 0
    for i, val in enumerate(A, 1):
        max_ending_here = max(val, max_ending_here + val)
        if max_ending_here > max_so_far:
            end = i
        max_so_far = max(max_so_far, max_ending_here)
    print start, end, A[start: end]
    return max_so_far

I'm at a loss as how to figure out how to track the start index. Pizza Margherita (talk) 02:59, 15 September 2016 (UTC)[reply]

Hey Pizza Margherita,
The maximum subarray problem article (in the External Links section) links to many implementations of the algorithm, some of which track the start index and end index.
In particular, the "maxsumseq" and "maxsumit" implementations in the "Python" section of the "Greatest subsequential sum" page on the Rosetta Code website track the start index and end index.
I agree that the modification to do this is not be as obvious or as "easy" as the article says.
--DavidCary (talk) 14:29, 16 September 2016 (UTC)[reply]
Sorry for my late response. Thank you so much! Pizza Margherita (talk) 18:58, 17 September 2016 (UTC)[reply]
Resolved

RegEx[edit]

So, I'm kinda learning RegEx. I'm trying to use AWB to run a bot, and I have this:

..WikiProject Belgrade..........................

which finds {{WikiProject Belgrade|class=Start|importance=}} However, if I do one more dot it stops working, as it is more than the string on the current page. I have also disabled the "singleline" mode. Any ideas? Dat GuyTalkContribs 15:00, 15 September 2016 (UTC)[reply]

What exactly are you trying to match? If you want to match any text within double braces that starts with the words "WikiProject Belgrade", you could use
\{\{WikiProject Belgrade[^}]*\}\}

CodeTalker (talk) 17:01, 15 September 2016 (UTC)[reply]

Fixed already, thanks for the help anyways. Dat GuyTalkContribs 17:52, 15 September 2016 (UTC)[reply]


Problem in Android memory management[edit]

I have a phone running on Android 5.0. Since it has option to use a memory card I do, and I have set all new data like pictures etc to be directly set to memory card and not phone memory, but still reverse seems to happen - all the things I wanna go to memory card make it to phone memory, causing it to be clogged up, especially for apps etc which don't like to be sent anywhere but phone memory (BTW, can one somehow sent apps etc to memory card instead? ) But, mainly how to use memory card for things that can be sent there ? Please help. Jon Ascton  (talk) 22:16, 15 September 2016 (UTC)[reply]

P.S. I have also heard of something called rooting, which is said to be a total problem-ender, how about some guidance in "rooting", if someone good soul can ?

  • We have an article on rooting. Basically it means getting the equivalent of administrator rights in Windows: the ability to modify programs, system files, etc.. Before doing so, you may want to check; it might invalidate any support guarantee you had when purchasing the phone. Since phone manufacturers try to make their devices unrootable, you usually need a bit of tinkering and looking at various tech forums for your particular hardware. Of course, cynics will say it is not really "your" hardware if you cannot change its operating system.
As for the memory card problem, without more precisions we cannot help. What steps did you take to "set all new data to be directly set to memory card"? TigraanClick here to contact me 11:51, 16 September 2016 (UTC)[reply]
  • One possibility is that the memory card isn't properly seated, so it makes intermittent contact. When the memory card isn't detected, it would then revert to storing data on the phone. Try turning off the phone, removing the memory card, ensuring that the contacts on both sides are clean (wiping them with an alcohol soaked Q-tip, and allowing to dry, if needed), then reseat it. If this isn't the problem, it shouldn't hurt anything. StuRat (talk) 15:10, 16 September 2016 (UTC)[reply]