Jump to content

Wikipedia:Reference desk/Computing: Difference between revisions

From Wikipedia, the free encyclopedia
Content deleted Content added
Line 497: Line 497:
:when you say copy, do you mean you copy and paste text from the Windows clipboard into nano which is running in a console window? if you do cat > file.txt (paste, then Ctrl-D) do you still get extra line breaks? [[User:Asmrulz|Asmrulz]] ([[User talk:Asmrulz|talk]]) 10:36, 26 April 2017 (UTC)
:when you say copy, do you mean you copy and paste text from the Windows clipboard into nano which is running in a console window? if you do cat > file.txt (paste, then Ctrl-D) do you still get extra line breaks? [[User:Asmrulz|Asmrulz]] ([[User talk:Asmrulz|talk]]) 10:36, 26 April 2017 (UTC)
:::::::: HI [[sSer:Asmrulz]]: Yes, that's what I mean, and the last timre I tried that in the method of (cat > script.sh AND_THEN paste AND_THEN CTRL+D it did work without problems). [[User:Ben-Yeudith|Ben-Yeudith]] ([[User talk:Ben-Yeudith|talk]]) 11:12, 27 April 2017 (UTC)
:::::::: HI [[sSer:Asmrulz]]: Yes, that's what I mean, and the last timre I tried that in the method of (cat > script.sh AND_THEN paste AND_THEN CTRL+D it did work without problems). [[User:Ben-Yeudith|Ben-Yeudith]] ([[User talk:Ben-Yeudith|talk]]) 11:12, 27 April 2017 (UTC)
::::::::: Then I guess it's nano. [[User:Asmrulz|Asmrulz]] ([[User talk:Asmrulz|talk]]) 11:45, 27 April 2017 (UTC)


= April 26 =
= April 26 =

Revision as of 11:45, 27 April 2017

Welcome to the computing section
of the Wikipedia reference desk.
Select a section:
Want a faster answer?

Main page: Help searching Wikipedia

   

How can I get my question answered?

  • Select the section of the desk that best fits the general topic of your question (see the navigation column to the right).
  • Post your question to only one section, providing a short header that gives the topic of your question.
  • Type '~~~~' (that is, four tilde characters) at the end – this signs and dates your contribution so we know who wrote what and when.
  • Don't post personal contact information – it will be removed. Any answers will be provided here.
  • Please be as specific as possible, and include all relevant context – the usefulness of answers may depend on the context.
  • 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.
    • We don't conduct original research or provide a free source of ideas, but we'll help you find information you need.



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.
See also:


April 22

need help with assignment in Unity/C#

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?

Unity/C# code
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;

public class PlayerController : MonoBehaviour {

    private Rigidbody rb;
    public float speed;
    public Text winLose;
    public Text winLoseTwo;
    Vector3 startPosition;
    float moveHorizontal = 0f;
    float moveVertical = 0f;
    public AudioClip enemyHit;
    public AudioClip collect;
    public AudioClip hole;
    public AudioClip checkpoint;
    private AudioSource source;
    private AudioSource hit;
    public float hitVol;
    public int playerOneScore;
    public int playerTwoScore;
    public Text pOS;
    //pOS will display playerOneScore
    public Text pTS;
    //pTS will display playerTwoScore


    void Start()
    {
        rb = GetComponent<Rigidbody>();
        winLose.text = "";
        playerOneScore = 0;
        playerTwoScore = 0;
        pOS.text = "Player-1's score:" + playerOneScore;
        pTS.text = "Player-2's score:" + playerTwoScore;

        //this stores the starting position so the players can be sent back if they hit a hole or enemy
        startPosition = transform.position;
    }

    // Update is called once per frame this currently does nothing
    void Update () {   
        
            }

    void FixedUpdate()
    {
        // the following two lines gets directional input from the keyboard
        if (this.gameObject.CompareTag("Player1"))
        {
        moveHorizontal = Input.GetAxis("Horizontal");
        moveVertical = Input.GetAxis("Vertical");
    }
        else
        {
           moveHorizontal = Input.GetAxis("Horizontal2");
           moveVertical = Input.GetAxis("Vertical2");
        }

        //this line stores the two lines of input into a single variable called movement
        Vector3 movement = new Vector3(moveHorizontal, 0.0f, moveVertical);

        pOS.text = "Player-1's score:" + playerOneScore;
        pTS.text = "Player-2's score:" + playerTwoScore;

        //the following conditional tells the player to move during the game
        // this is use to prevent people from moving after the game is done 
        // so the player will only move if they have not lost
  
              if (winLose.text != "You Lose!! :(")
        {
            rb.AddForce(movement * speed);
            //speed is set in unity so user can decide fast the player can move
        }
        

    }

        void Awake()
    {

        source = GetComponent<AudioSource>();

    }

    void OnTriggerEnter(Collider other)
    {
        if (other.gameObject.CompareTag("Sphere"))
        {
// when player touches the golden sphere which is the goal
            other.gameObject.SetActive(false);
            if (this.gameObject.CompareTag("Player1")){
                winLose.text = "You Win!!!"; }
            else { winLoseTwo.text = "You Win!!!"; }
            // this tell player that they have won
        }
        
        if (other.gameObject.CompareTag("Enemy"))
        {
            //when player collides with enemy (the red guys)
            //other.gameObject.SetActive(false);
            
            source.PlayOneShot(enemyHit, hitVol);
            //plays a sound when a player collides with an enemy

            //transform.position = startPosition;


            if (this.gameObject.CompareTag("Player1"))
                {
                playerOneScore -= 15;
            }
            else { 
                playerTwoScore -= 15; }
             //players lose 15 points upon touching enemy
        }
        
        if (other.gameObject.CompareTag("Hole"))
        {
            transform.position = startPosition;
                //resets the ball position if player touches a hole
                //i.e. sends player to start or checkpoint
        }

        if (other.gameObject.CompareTag("Checkpoint"))
        {
            startPosition = transform.position;
            //this lets the player be sent to the last checkpoint they touched instead of start if they hit a hole
            
            source.PlayOneShot(checkpoint, hitVol);
            
            if (this.gameObject.CompareTag("Player1"))
            {
                playerOneScore += 10;
            }
            else 
            { playerTwoScore += 10; }
        }

        //the following if statements tells a player of they win or lose based on whether or not the other player wins or lose
        if (winLose.text == "You Win!!!")
        {
            winLoseTwo.text = "You Lose!! :(";
        }
        if (winLoseTwo.text == "You Win!!!")
        {
            winLose.text = "You Lose!! :(";
        }
        if (winLose.text == "You Lose!! :(")
        {
            winLoseTwo.text = "You Win!!!";
        }
        if (winLoseTwo.text == "You Lose!! :(")
        {
            winLose.text = "You Win!!!";
        }

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

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)[reply]
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)[reply]
Changes since working version are commented out
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;

public class PlayerController : MonoBehaviour {

    private Rigidbody rb;
    public float speed;
    public Text winLose;
    public Text winLoseTwo;
    Vector3 startPosition;
    float moveHorizontal = 0f;
    float moveVertical = 0f;
    public AudioClip enemyHit;
    public AudioClip collect;
    public AudioClip hole;
//    private AudioSource source;
    private AudioSource hit;
    public float hitVol;
//    public int playerOneScore;
//    public int playerTwoScore;
//    public Text pOS;
//    //pOS will display playerOneScore
//     public Text pTS;
//    //pTS will display playerTwoScore


    void Start()
    {
        rb = GetComponent<Rigidbody>();
        winLose.text = "";
  //      playerOneScore = 0;
  //      playerTwoScore = 0;
  //      pOS.text = "Player-1's score:" + playerOneScore;
  //      pTS.text = "Player-2's score:" + playerTwoScore;

        //this stores the starting position so the players can be sent back if they hit a hole or enemy
        startPosition = transform.position;
    }

    // Update is called once per frame this currently does nothing
    void Update () {   
        
            }

    void FixedUpdate()
    {
        // the following two lines gets directional input from the keyboard
        if (this.gameObject.CompareTag("Player1"))
        {
        moveHorizontal = Input.GetAxis("Horizontal");
        moveVertical = Input.GetAxis("Vertical");
    }
        else
        {
           moveHorizontal = Input.GetAxis("Horizontal2");
           moveVertical = Input.GetAxis("Vertical2");
        }

        //this line stores the two lines of input into a single variable called movement
        Vector3 movement = new Vector3(moveHorizontal, 0.0f, moveVertical);

//        pOS.text = "Player-1's score:" + playerOneScore;
//        pTS.text = "Player-2's score:" + playerTwoScore;

        //the following conditional tells the player to move during the game
        // this is use to prevent people from moving after the game is done 
        // so the player will only move if they have not lost
  
              if (winLose.text != "You Lose!! :(")
        {
            rb.AddForce(movement * speed);
            //speed is set in unity so user can decide fast the player can move
        }
        

    }

        void Awake()
    {

        source = GetComponent<AudioSource>();

    }

    void OnTriggerEnter(Collider other)
    {
        if (other.gameObject.CompareTag("Sphere"))
        {
// when player touches the golden sphere which is the goal
            other.gameObject.SetActive(false);
            if (this.gameObject.CompareTag("Player1")){
                winLose.text = "You Win!!!"; }
            else { winLoseTwo.text = "You Win!!!"; }
            // this tell player that they have won
        }
        
        if (other.gameObject.CompareTag("Enemy"))
        {
            //when player collides with enemy (the red guys)
            //other.gameObject.SetActive(false);
            
//            source.PlayOneShot(enemyHit, hitVol);
            //plays a sound when a player collides with an enemy

//            //transform.position = startPosition;


//          if (this.gameObject.CompareTag("Player1"))
//               {
//               playerOneScore -= 15;
//            }
//            else { 
//                playerTwoScore -= 15; }
//             //players lose 15 points upon touching enemy
        }
        
        if (other.gameObject.CompareTag("Hole"))
        {
            transform.position = startPosition;
                //resets the ball position if player touches a hole
                //i.e. sends player to start or checkpoint
        }

        if (other.gameObject.CompareTag("Checkpoint"))
        {
            startPosition = transform.position;
            //this lets the player be sent to the last checkpoint they touched instead of start if they hit a hole
            
//           source.PlayOneShot(checkpoint, hitVol);
            
//            if (this.gameObject.CompareTag("Player1"))
//            {
//                playerOneScore += 10;
//            }
//            else 
//            { playerTwoScore += 10; }
        }

        //the following if statements tells a player of they win or lose based on whether or not the other player wins or lose
        if (winLose.text == "You Win!!!")
        {
            winLoseTwo.text = "You Lose!! :(";
        }
        if (winLoseTwo.text == "You Win!!!")
        {
            winLose.text = "You Lose!! :(";
        }
        if (winLose.text == "You Lose!! :(")
        {
            winLoseTwo.text = "You Win!!!";
        }
        if (winLoseTwo.text == "You Lose!! :(")
        {
            winLose.text = "You Win!!!";
        }

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)[reply]

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)[reply]
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)[reply]


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)[reply]

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)[reply]

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)[reply]
Hello Bubba73's daughter! I hope something in my above rambling is helpful! ApLundell (talk) 04:33, 22 April 2017 (UTC)[reply]
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)[reply]

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)[reply]
  • 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)[reply]
    • 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)[reply]
[1] (be sure to turn annotations on). ᛗᛁᛟᛚᚾᛁᚱPants Tell me all about it. 23:31, 22 April 2017 (UTC)[reply]

Public key signatures

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)[reply]

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)[reply]
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)[reply]
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)[reply]
There's, of course, an article at Digital signature that is pretty good. ApLundell (talk) 17:43, 22 April 2017 (UTC)[reply]
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)[reply]
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)[reply]
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)[reply]
  • This is a real risk (it has been used to steal real money, in 10k+ amounts). Crypto is still so unfamiliar that almost all end-users have no real appreciation for what's happening or what they've received. This makes them prone to being deceived. A simple attack is to take something that is provably (and genuinely) from a trusted source, add some fraud, then wrap it up further with a technically valid signature from the overall fraudster. Every part of this is cryptographically valid (and so the tools don't highlight it as suspicious). The deception is to mislead the recipient as to who is vouching for what parts of it. Yet again, we're back to simple social engineering, which most software still doesn't watch out for.
As a learning tool, I'd suggest the command line version of OpenPGP and working with it to do a large number of tasks (many web guides) to become familiar with it long before you need to use such tools in any real-world situation. Then follow Bruce Schneier's blog. Andy Dingley (talk) 12:12, 24 April 2017 (UTC)[reply]
That's an interesting suggesting I will check out, thank you.--Testing questions (talk) 15:28, 25 April 2017 (UTC)[reply]

April 23

Review for Macbook Pro 15" mid-2015 integrated graphics

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 [2]

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

Model 1 has thousands upon thousands of reviews on the internet[4][5][6][7][8][9][10][11][12][13], 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[14][15] 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)[reply]

Using Arduino without using it

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)[reply]

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)[reply]
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. [16] And there's plenty of instructions[17] on how to use them. ApLundell (talk) 15:08, 23 April 2017 (UTC)[reply]
Or you can skip all that and pay a couple extra bucks to buy chips with the Arduino software loaded and ready to go.[18]. ApLundell (talk) 15:11, 23 April 2017 (UTC)[reply]
You need to be able to sell a few tens of thousands before considering anything much cheaper than is talked about here. The next step up is to produce something on a tiny board like in those small black blobs inside toys.
  • "What is an Arduino?" is actually quite a hard question to answer. The minimal generic 'duino is an AVR chip with a copy of the open-source Arduino bootloader burned into its memory, thus allowing compiled Arduino sketches to be downloaded to it. You can make this yourself from raw chips and a larger board (as part of some embedded system), or by attaching an outsourced Arduino as a daughter board. Commercial products make all of these routes cheap and easy: you can buy the AVR chips (in several sizes, both logical and physical), you can buy AVRs with a factory-loaded Arduino bootloader, or you can buy a Mini 'duino as a small board with pins more cheaply (literally "a couple of bucks") than I can have the chips assembled for me, and far more simply than having to assemble a board with a small quad pack CPU on it. I can also (and have done) burn my own bootloaders with a programmer costing a couple of $10, but it's tiresome to do this.
Another option is to abandon writing Arduino sketches and write directly for the AVR chip. It's not hard to program this, the skillset transfers pretty easily. If you're doing realtime, muti-threading or especially interrupts, then it's easier than making an Arduino sketch achieve the same. One you've done this, you can burn that directly to the chip and avoid needing a bootloader at all.
This month, the embedded Mini Arduino board is much the favourite option of these. Andy Dingley (talk) 11:44, 24 April 2017 (UTC)[reply]
Oh yes definitely. If you're not doing more than a thousand there's no point even thinking about making your own board at this price level. Dmcq (talk) 12:35, 24 April 2017 (UTC)[reply]

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

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)[reply]

You'd probably want to use -\d+ instead, since the version with the asterisk will match a single dash even if it's not followed by a number. Also, depending on the contents of the document, you might want to enhance the regular expression to avoid matching, for example, the last 5 characters of a phone number like 555-1212 or a date like 4-24-2017. This would be easy if the desired negative numbers are always preceded by a space or some other recognizable character. CodeTalker (talk) 14:29, 24 April 2017 (UTC)[reply]

April 24

Recommendation for software to make compilation music CDs

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)[reply]

For ripping CDs I use Sound Juicer, Ubuntu's default ripper. To compile compilations I use SoX to take the sources and emit a .CDR file which I burn with wodim. -- Finlay McWalter··–·Talk 08:49, 24 April 2017 (UTC)[reply]
Just saw this query and thanks for the suggestions. I've used Windows software for the purpose till now but I am inclining towards moving to Linux as I just have had so many problems with databases, and things just stop working with new releases of windows. I think it would allow me more control as I could fix the software if things go wrong. I need interoperability with a spreadsheet and to be able to print labels and CD covers easily. Actually I only put the track names only on the case rather than the CD - this makes for less work. I just print an identifying picture and id on the CDs. Dmcq (talk) 12:04, 24 April 2017 (UTC)[reply]
Personally I don't create a cover slip (the audio CDs I create are small samples for a pub quiz, so obviously a track listing is a bad thing). Perhaps unfortunately, I'm a "I'll write a Python program" type person, so if I did need some kind of database and cover-sheet printing solution, that's what I'd probably do, and it wouldn't be helpful for other people in general. -- Finlay McWalter··–·Talk 12:10, 24 April 2017 (UTC)[reply]
Thanks, but I should state that I want to use Windows and I don't want to use a command-line interface. Bubba73 You talkin' to me? 14:19, 24 April 2017 (UTC)[reply]
I use a completely customized setup, with a front-end I wrote, a batch files modified from one I found on SO, VLC Media Player and a custom MySQL database for similar functionality at my home. If you're looking to create such a system, I wouldn't mind sharing some of the insights I got from (and difficulties I had) setting that up, but I don't want to bore you to tears if the answer you're looking for is more "SoftwareSoft's Generic Media Player Classic Plus Lite 2017 v1.2 Enhanced Edition does everything you want." ᛗᛁᛟᛚᚾᛁᚱPants Tell me all about it. 14:43, 24 April 2017 (UTC)[reply]
Yes, basically what I want is a simple system, really for two slightly different things. (10 I want to read in several CDs and it shows me the complete list of songs. I want to choose songs from that list to burn to a CD. It keeps track of the total amount selected from a CD, so I know how many I can get. After I burn that CD, it marks those songs as done and I can choose another set to burn to another CD, etc. Mode (2) - similar, but I want to read only certain songs from the source CDs. Bubba73 You talkin' to me? 17:07, 24 April 2017 (UTC)[reply]
Windows Media Player should actually do all that. it will rip and burn music, and .wma's have a lossless codec option, so no mp3 distortion. It's just a matter of setting up your library to show all files instead of automatically sorting them. Since you need to be there to swap CDs, I don't see how ripping them one at a time is a bad thing (if you have multiple drives, I believe WMP will rip from all of them simultaneously, though I'm not sure). ᛗᛁᛟᛚᚾᛁᚱPants Tell me all about it. 17:36, 24 April 2017 (UTC)[reply]
My first thought was iTunes, which I'm sure will do all that. --Viennese Waltz 07:36, 25 April 2017 (UTC)[reply]
I've never used iTunes, but I read that it's really strict with DRM (to the point of adding DRM to ripped music), so I wonder if it's suitable for something like this. ᛗᛁᛟᛚᚾᛁᚱPants Tell me all about it. 12:58, 25 April 2017 (UTC)[reply]
I don't think it is as strict as it used to be. My brother lost a lot of music he personally ripped when iTunes decided it was pirated and deleted it from his laptop and phone. That was years ago and they've apparently been much better since. 209.149.113.5 (talk) 13:33, 25 April 2017 (UTC)[reply]
Same thing happened to a friend of mine, hence my reservations. I'm sure they've gotten a bit better, though. They couldn't possibly have gotten any worse. ᛗᛁᛟᛚᚾᛁᚱPants Tell me all about it. 14:07, 25 April 2017 (UTC)[reply]
I suspect you have other bugs - Windows or iTunes on Windows bugs. I've used iTunes on the Mac since Powerbook G4 times, and while iTunes Store music used to come with DRM, I've never had iTunes delete any of my music or add anything to ripped music, wether ripped to MP3 or AAC. iTunes has quirks, and they keep deproving the UI, but it is reasonably to use, and it can burn playlist in most formats to plain old CDs. --Stephan Schulz (talk) 17:31, 25 April 2017 (UTC)[reply]
My friend (to whom this happened) has a Mac. Used it with his iPod at the time, and now with his iPhone. He also has a (neck) beard and wears flannel to his job in a call center. Sometimes I wonder if I want to remain friends with him. (Yes, I'm being facetious.) He's not particularly technical, though he is young enough to have grown up around computers. It could have been a head space and timing fault. ᛗᛁᛟᛚᚾᛁᚱPants Tell me all about it. 17:51, 25 April 2017 (UTC)[reply]
Or a classical PBCK error with a touch of Chinese Whispers ;-). --Stephan Schulz (talk) 18:31, 25 April 2017 (UTC)[reply]
Well it definitely wasn't Chinese whispers, but it certainly could have been one of the others. He is, after all, marginally smarter than your average box of rocks. Yes, Scott. I know you're reading thing. Knowing my handle on WP and how to find my contributions page does not make you a hacker. ᛗᛁᛟᛚᚾᛁᚱPants Tell me all about it. 18:49, 25 April 2017 (UTC)[reply]
I tried Windows Media Player. It does rip and burn, bu I still have to do most of the work in making compilation CDs. There is a fluke where it says to drag songs to the playlist, but that doesn't work - you have to right click and send it. But it still leaves most of the work to me - things programs are good at. As far as I can tell, it doesn't tell me the total length of the selected songs until I get them into the area ready to burn. This is needed to see if I can get more songs on the CD or if I have selected too many to go on the CD. Also, after I have used a song on a CD, it doesn't mark that it has already been used. Bubba73 You talkin' to me? 01:27, 26 April 2017 (UTC)[reply]
MySQL, SharpDevelop and the right google search time, then! Seriously, I'm out of ideas that don't involve hacking something together. Sorry bout that. ᛗᛁᛟᛚᚾᛁᚱPants Tell me all about it. 04:48, 26 April 2017 (UTC)[reply]
Yeah I used to use Windows Media Player. But then its database got into a mess. And so now I hate it though to a much lesser degree that Windows Word which I just hate hate hate. So I moved away to Wiamp, which isn't supported. Dmcq (talk) 12:04, 26 April 2017 (UTC)[reply]

April 25

Copying a Bash script from Windows into WSL (CMD) adds carriage returns

I copy a Bash script from a .sh file stored in Windows10 into nano in WSL (CMD). Yet, the script is copied with carriage returns and these break script execution in WSL. Before copying, I access the script file with Notepad++.

The more the CMD window (tty) is narrower, the more carriage returns are created when the script is created.

I start nano with the following syntax (.sh give Bash highlighting) and the CR characters are seen as little Green boxes:

nano ~/ses.sh && chmod +x ~/ses.sh && sh ~/ses.sh && rm ~/ses.sh

Any ideas? Ben-Yeudith (talk) 12:30, 25 April 2017 (UTC)[reply]

Windows always prefers 0D 0Ah for a new line in text files. Use Notepad++. NPP also allows to replace the \r\n by \n when setting the checkboxes in the find and replace dialog box, using CTRL+H. && is a new command in the same line, accepted by Linux and Windows. --Hans Haase (有问题吗) 12:41, 25 April 2017 (UTC)[reply]
Too bad I didn't mention that (edited to mention): I copy the script TO Nano FROM Notepad++, yet Carriage returns are still created as per the length of the CMD TTY window. This seems unrelated to the particular text editor I copy from, user:Hans Haase. Ben-Yeudith (talk) 12:55, 25 April 2017 (UTC)[reply]
Once using a Windows editor, the CRs are inserted. Remove them manually by STRG+H and replace \r\n by \n, using the checkboxes insode the replace dialog box. How did You transfer the file from Linux to Windows? --Hans Haase (有问题吗) 13:06, 25 April 2017 (UTC)[reply]
I have no problem to remove them in Notepad++, the problem is that they are inserted when the script conent is pasted in nano (to be later saved in a file and executed inside WSL), hence, they are included inside the nano script. When I do search and replace in nano on either \r\n or \r I find nothing but that doesn't really matter because I am looking for a way to prevent Windows to add these in the pasting anyway. Ben-Yeudith (talk) 13:15, 25 April 2017 (UTC)[reply]
The transfer is with WSL. You can copy and paste anything you want in the WSL window and there shouldn't be any problem with that naturally, the point is working cross platform easily with WSL. Ben-Yeudith (talk) 13:17, 25 April 2017 (UTC)[reply]
Adjust the checkboxes inside the find and replace dialog! --Hans Haase (有问题吗) 14:42, 25 April 2017 (UTC)[reply]
Again, my problem is not with Notepad++. This has nothing to do to any GUI editor in Windows. Ben-Yeudith (talk) 16:59, 25 April 2017 (UTC)[reply]
when you say copy, do you mean you copy and paste text from the Windows clipboard into nano which is running in a console window? if you do cat > file.txt (paste, then Ctrl-D) do you still get extra line breaks? Asmrulz (talk) 10:36, 26 April 2017 (UTC)[reply]
HI sSer:Asmrulz: Yes, that's what I mean, and the last timre I tried that in the method of (cat > script.sh AND_THEN paste AND_THEN CTRL+D it did work without problems). Ben-Yeudith (talk) 11:12, 27 April 2017 (UTC)[reply]
Then I guess it's nano. Asmrulz (talk) 11:45, 27 April 2017 (UTC)[reply]

April 26

Smart phone specification

What is the processor speed and RAM required for a phone that could last for 5 years...? 116.58.204.152 (talk) 19:40, 26 April 2017 (UTC)[reply]

That's impossible to say, as we really can't predict what the operating systems and apps will require 5 years from now. StuRat (talk) 20:30, 26 April 2017 (UTC)[reply]
Which isn't to say that we don't try. Honestly, the best answer I can give to this question is "A phone that won't be released for at least two more years." ᛗᛁᛟᛚᚾᛁᚱPants Tell me all about it. 20:45, 26 April 2017 (UTC)[reply]

.apk file

Looking for ‘’.apk’’ file type(s) opensouce software(s) similar to, or exactly like, or the "MS Office" itself, without on-line connectivity issue.

1) Word, Excel and Outlook are very important; require the full functionality… 2) I would like to sync the Outlook with the PC Outlook without the connectivity issue, desirable. 116.58.201.134 (talk) 20:03, 26 April 2017 (UTC)[reply]

There's always AndrOpen Office. It requires Android 2.3 or later. ᛗᛁᛟᛚᚾᛁᚱPants Tell me all about it. 20:47, 26 April 2017 (UTC)[reply]

April 27

Monitor cracking sound

My monitor (ROG Swift '27) sometimes, but very rarely, make a relatively loud cracking sound. Like cracking your knuckles, whether it's on or when it's been off for a while (even hours). I've read that it's apparently the plastic shell that's expanding and contracting due to temperature?

I believe that's relatively normal and not harmful, at least according to Google? I believe my PlayStation did the same when I owned one. My PC does the same. Matt714 (talk) 09:24, 27 April 2017 (UTC)[reply]