Author Archives: Robins

How to use matlab xlswrite

Take matrix A=[1, 2, 3, 4;5, 6, 7, 8] as an example for introduction
Case 1:
Enter data into the specified EXCEL, without specifying the workbook or cell location
Enter xlswrite(‘1.xlsx’,A) in the MATLAB main window and press enter and we will see in excel 1.xlsx and sheet1 as follows

Note: 1 If you put Sheet2 before Sheet1, the data will be written to Sheet2.
2 When this command is executed, the Excel being written should be in the closed state.
Example 2:
Type xlswrite(‘1.xlsx’,A,2) in the main window into the specified sheet without specifying A cell, and press enter

We are putting A matrix in the second sheet. And we need to be careful because we are in sheet3 and not Sheet2.

    example 3 write the data to the specified sheet, specify the location, enter xlswrite(‘1.xlsx’,A,3,’C5′) in the main window of MATLAB, enter

We will see in Sheet2 in the third position that matrix A was written from c5 cell. We could also have written xlswrite(‘1.xlsx’,A,3,’ c5 :F6′). Same result, but the former is simpler and more convenient.

From: http://www.taody.com/zhishi/93f9803fea09f4e0e56f555a.html

Uninstall Anaconda under Windows

Find the Uninstall-Anaconda. Exe file in the directory where you installed your Anaconda and run the Uninstall file.
After uninstalling, if there are still problems with the version, switch to anaconda2 and install Anaconda3 instead. 2 and 3 can be installed on a computer at the same time.

Blender graphic tutorial: loop cut for polygon modeling commands

The polygon modeling command is only available under edit mode

this command is called Loop Cut and Slide short for Loop Cut shortcut key (Ctrl + R)


Blender loop cut operation design is very smooth. The basic steps are as follows:

    first press the shortcut key on the object to be looped Ctrl + R. At this time, different previews will be generated with different mouse positions. When previewing, scroll mouse wheel up and down to increase or decrease the number of ring cut edges, and the preview effect will also change accordingly (this step is optional). If you are satisfied with the preview, click the left mouse button. Slide the mouse to move the cut edge of the ring (optional). If you are satisfied with the preview, click the left mouse button again.

The whole process requires two left mouse clicks

Summary of unity3d 11 SceneManager scene management usage

I. Unity level
Level loading and unloading during Unity use is a basic feature provided by most 3D engines.
because level switching is very common in games.
in previous releases Unity’s level switches used:

Application.loadedLevel();

Take a look at the Application class, which has more and more functions. Look only at levels related:

 [Obsolete("Use SceneManager.LoadScene")]
        public static void LoadLevel(string name);

        [Obsolete("Use SceneManager.LoadScene")]
        public static void LoadLevel(int index);

        [Obsolete("Use SceneManager.LoadScene")]
        public static void LoadLevelAdditive(string name);

        [Obsolete("Use SceneManager.LoadScene")]
        public static void LoadLevelAdditive(int index);
  //
        // Abstracts:
        //     ///
        //     Unloads all GameObject associated with the given scene. Note that assets are
        //     currently not unloaded, in order to free up asset memory call Resources.UnloadAllUnusedAssets.
        //     ///
        //
        // Parameter:
        //   index:
        //     Index of the scene in the PlayerSettings to unload.
        //
        //   scenePath:
        //     Name of the scene to Unload.
        //
        // Return Results:
        //     ///
        //     Return true if the scene is unloaded.
        //     ///
        [Obsolete("Use SceneManager.UnloadScene")]
        public static bool UnloadLevel(string scenePath);
        //
        // Abstracts:
        //     ///
        //     Unloads all GameObject associated with the given scene. Note that assets are
        //     currently not unloaded, in order to free up asset memory call Resources.UnloadAllUnusedAssets.
        //     ///
        //
        // Parameter:
        //   index:
        //     Index of the scene in the PlayerSettings to unload.
        //
        //   scenePath:
        //     Name of the scene to Unload.
        //
        // Return Results:
        //     ///
        //     Return true if the scene is unloaded.
        //     ///
        [Obsolete("Use SceneManager.UnloadScene")]
        public static bool UnloadLevel(int index);

Note:
this is the loading and unloading of levels in the previous Application.
of course there is now a new change in the new version (Unity5.3 above) that the SceneManager class handles.
SceneManager class Untiy
Since Unity5.3, Unity’s level switch has added new SceneManager classes to handle it.
of course has to be installed with Unity documentation help, and given the following path, it will know to open locally. Local links:

file:///C:/Program%20Files/Unity5.3.0/Editor/Data/Documentation/en/Manual/UpgradeGuide53.html
can also search the SceneManager to view in Unity.

#region Program Collections UnityEngine, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null
// H:\Unity\UnityProject\ShiftLevels\Library\UnityAssemblies\UnityEngine.dll
#endregion

using UnityEngine.Internal;

namespace UnityEngine.SceneManagement
{
    //
    // Parameter:
    //     ///
    //     Scene management at run-time.
    //     ///
    public class SceneManager
    {
        public SceneManager();


        public static int sceneCount { get; }
        //

        public static int sceneCountInBuildSettings { get; }


        public static Scene GetActiveScene();

        public static Scene[] GetAllScenes();
        // Parameter:
        //   index:
        //     Index of the scene to get. Index must be greater than or equal to 0 and less
        //     than SceneManager.sceneCount.
        public static Scene GetSceneAt(int index);

        // Return Results:
        //     ///
        //     The scene if found or an invalid scene if not.
        //     ///
        public static Scene GetSceneByName(string name);

        //     Searches all scenes added to the SceneManager for a scene that has the given
        //     asset path.
        //     ///
        //
        // Parameter:
        //   scenePath:
        //     Path of the scene. Should be relative to the project folder. Like: "AssetsMyScenesMyScene.unity".
        public static Scene GetSceneByPath(string scenePath);
        [ExcludeFromDocs]
        public static void LoadScene(int sceneBuildIndex);
        [ExcludeFromDocs]
        public static void LoadScene(string sceneName);

        // Parameter:
        //   sceneName:
        //     Name of the scene to load.
        //
        //   sceneBuildIndex:
        //     Index of the scene in the Build Settings to load.
        //
        //   mode:
        //     Allows you to specify whether or not to load the scene additively. See SceneManagement.LoadSceneMode
        //     for more information about the options.
        public static void LoadScene(int sceneBuildIndex, [DefaultValue("LoadSceneMode.Single")] LoadSceneMode mode);

        // Parameter:
        //   sceneName:
        //     Name of the scene to load.
        //
        //   sceneBuildIndex:
        //     Index of the scene in the Build Settings to load.
        //
        //   mode:
        //     Allows you to specify whether or not to load the scene additively. See SceneManagement.LoadSceneMode
        //     for more information about the options.
        public static void LoadScene(string sceneName, [DefaultValue("LoadSceneMode.Single")] LoadSceneMode mode);
        [ExcludeFromDocs]
        public static AsyncOperation LoadSceneAsync(int sceneBuildIndex);
        [ExcludeFromDocs]
        public static AsyncOperation LoadSceneAsync(string sceneName);

        // Parameter:
        //   sceneName:
        //     Name of the scene to load.
        //
        //   sceneBuildIndex:
        //     Index of the scene in the Build Settings to load.
        //
        //   mode:
        //     If LoadSceneMode.Single then all current scenes will be unloaded before loading.
        public static AsyncOperation LoadSceneAsync(int sceneBuildIndex, [DefaultValue("LoadSceneMode.Single")] LoadSceneMode mode);

        // Parameter:
        //   sceneName:
        //     Name of the scene to load.
        //
        //   sceneBuildIndex:
        //     Index of the scene in the Build Settings to load.
        //
        //   mode:
        //     If LoadSceneMode.Single then all current scenes will be unloaded before loading.
        public static AsyncOperation LoadSceneAsync(string sceneName, [DefaultValue("LoadSceneMode.Single")] LoadSceneMode mode);
        //

        // Parameter:
        //   sourceScene:
        //     The scene that will be merged into the destination scene.
        //
        //   destinationScene:
        //     Existing scene to merge the source scene into.
        public static void MergeScenes(Scene sourceScene, Scene destinationScene);
        //
        // Abstracts:
        //     ///
        //     Move a GameObject from its current scene to a new scene. /// It is required that
        //     the GameObject is at the root of its current scene.
        //     ///
        //
        // Parameter:
        //   go:
        //     GameObject to move.
        //
        //   scene:
        //     Scene to move into.
        public static void MoveGameObjectToScene(GameObject go, Scene scene);
        //

        // Return Results:
        //     ///
        //     Returns false if the scene is not loaded yet.
        //     ///
        public static bool SetActiveScene(Scene scene);

        //     ///
        public static bool UnloadScene(string sceneName);
        //
        // Abstracts:
        //     ///
        //     Unloads all GameObjects associated with the given scene. Note that assets are
        //     currently not unloaded, in order to free up asset memory call Resources.UnloadAllUnusedAssets.
        //     ///
        //
        // Parameter:
        //   sceneBuildIndex:
        //     Index of the scene in the Build Settings to unload.
        //
        //   sceneName:
        //     Name of the scene to unload.
        //
        // Return Results:
        //     ///
        //     Returns true if the scene is unloaded.
        //     ///
        public static bool UnloadScene(int sceneBuildIndex);
    }
}

SceneManager for some operations to obtain scenes
(a)
SceneManager
class in UnityEngine. SceneManagement
description: runtime scene management.
static variable sceneCount: total number of scenes currently loaded. The number of scenarios loaded before
is returned.
sceneCountInBuildSettings: in BuildSettings number.
(b)
CreateScene: creates an empty new scenario at runtime, using the given name.
creates an empty new scenario at run time, using the given name.
new scenes will be added to the level with existing already open scenes. The path for the new scene will be empty. This function is used to create a scenario at run time. Create a scenario editor of time (for example, make editing scripts or tools you need to create the scene), using editorscenemanager. Newscene.

public static SceneManagement.Scene GetActiveScene()
live activity Scene.
description: gets the current active scenario.
the currently active scene will be used as the target to instantiate the new game object scene by the script.

using UnityEngine;
using UnityEngine.SceneManagement;

public class GetActiveSceneExample : MonoBehaviour
{
    void Start()
    {
        Scene scene = SceneManager.GetActiveScene();

        Debug.Log("Active scene is '" + scene.name + "'.");
    }
}

public static SceneManagement.Scene GetSceneAt(int index);
index: scene index. Indexes must be greater than or equal to 0 and less than Scenemanager. Scenecount.
Return:
returns a scenario reference based on the given parameters.
gets the list index of the scene manager in the scene being added:

using UnityEditor;
using UnityEditor.SceneManagement;
using UnityEngine.SceneManagement;
using UnityEngine;
public class Example
{
    // adds a menu item which gives a brief summary of currently open scenes
    [MenuItem("SceneExample/Scene Summary")]
    public static void ListSceneNames()
    {
        string output = "";
        if (SceneManager.sceneCount > 0)
        {
            for (int n = 0; n < SceneManager.sceneCount; ++n)
            {
                Scene scene = SceneManager.GetSceneAt(n);
                output += scene.name;
                output += scene.isLoaded ?" (Loaded, " : " (Not Loaded, ";
                output += scene.isDirty ?"Dirty, " : "Clean, ";
                output += scene.buildIndex >=0 ?" in build)\n" : " NOT in build)\n";
            }
        }
        else
        {
            output = "No open scenes.";
        }
        EditorUtility.DisplayDialog("Scene Summary",output, "Ok");
    }
}

(5)
public static SceneManagement.Scene GetActiveScene();
gets the current active scenario.
the current active scenario will be used as the target to instantiate the new object by the script.

using UnityEngine;
using UnityEngine.SceneManagement;

public class GetActiveSceneExample : MonoBehaviour
{
    void Start()
    {
        Scene scene = SceneManager.GetActiveScene();

        Debug.Log("Active scene is '" + scene.name + "'.");
    }
}

public static void LoadScene(int sceneBuildIndex, SceneManagement.LoadSceneMode mode = LoadSceneMode.Single);
public static void LoadScene(string sceneName, SceneManagement.LoadSceneMode mode = LoadSceneMode.Single);

SceneName: The name or path of the scene to load.
SceneBuildIndex: Index of scenarios under load in “Build Settings”.
Mode: Allows you to specify whether you want to load the add scene. See the LoadScene mode for more information about options.
LoadSceneMode: used when the player loads a scene.
Single: close all current scenes and load a new scene.
Additive: adds the scene to the currently loaded scene.
you can use this asynchronous version: LoadSceneAsync.

using UnityEngine;
using UnityEngine.SceneManagement;

public class ExampleClass : MonoBehaviour {
    void Start () {
        // Only specifying the sceneName or sceneBuildIndex will load the scene with the Single mode
        SceneManager.LoadScene ("OtherSceneName", LoadSceneMode.Additive);
    }
}

Iv. Implementation code of 5.3
The code:

/**************************************************************************
Copyright:@maxdong
Author: maxdong
Date: 2017-07-04
Description:Loading levels can be loaded and unloaded in groups. Uses Unity version 5.3.0.
This is because it uses a class for scene management, which was added in 5.3.0 or later.
Test operation: Use the spacebar to switch between scenes, and then wait 5 seconds before starting the unload.
**************************************************************************/
using UnityEngine;
using System.Collections;
using UnityEngine.SceneManagement;

[System.Serializable]
public class LevelOrder
{

    [Header("Name of each group of levels")]
    public string[] LevelNames;
}

public class ChangLevelsHasMain : MonoBehaviour
{
    [Header("List of All Levels")]
    public LevelOrder[] levelOrder;
    private static int index;
    private int totalLevels = 0;
    private int levelOrderLength;

    void Start ()
    {
        for (int i = 0; i < levelOrder.Length; i++)
        {
            totalLevels += levelOrder[i].LevelNames.Length;
        }

        if (totalLevels != SceneManager.sceneCountInBuildSettings)
        {

        }
        levelOrderLength = levelOrder.Length;
    }

    // Update is called once per frame
    void Update ()
    {
        if (Input.GetKeyDown(KeyCode.Space))
        {
            bool isOk = LoadNextLevels();
            if (isOk)
            {
                InvokeRepeating("UnloadLastLevel", 2.0f, 5);
            }
        }
    }

    bool LoadNextLevels()
    {
        bool bResult = true;
        //index = index % levelOrderLength;
        if (index < 0 || index >= levelOrderLength)
        {
            bResult = false;
            return bResult;
        }

        int LoadTimes = levelOrder[index].LevelNames.Length;
        for (int i = 0; i < LoadTimes; i++)
        {
            SceneManager.LoadSceneAsync(levelOrder[index].LevelNames[i], LoadSceneMode.Additive);
        }
        return bResult;
    }

    void UnloadLastLevel()
    {
        if (index == 0)
        {
            index++;
            CancelInvoke("UnloadLastLevel");
            return;
        }
        // Previous Set of Levels
        int TmpLast = (index - 1) >= 0 ?(index - 1) : levelOrderLength - 1;
        int LoadTimes = levelOrder[index].LevelNames.Length;
        for (int i = 0; i < LoadTimes; i++)
        {
            Scene Tmp = SceneManager.GetSceneByName(levelOrder[index].LevelNames[i]);
            if (!Tmp.isLoaded)
            {
                return;
            }
        }

        // After the next level is fully loaded, unload the previous level.
        for (int i = 0; i < levelOrder[TmpLast].LevelNames.Length; i++)
        {
            SceneManager.UnloadScene(levelOrder[TmpLast].LevelNames[i]);
        }
        index++;
        CancelInvoke("UnloadLastLevel");
    }
}

That’s it. The
code primarily loads levels by group, and then unloads them by group.
test, press the space bar to load, each set of levels after a certain time, (set here in 5 seconds) automatically uninstall the previous set of levels. The main map is not unmounted and will always be there.
How is it set up?The first thing you need to do is put all the levels you need to work on in Build Setting. Otherwise, an error will be reported during loading.
as shown in the figure below:

Then hang the code on any object object on the main map.

Markdown real time preview of sublime Text3

As mentioned above in Sublime Text3’s Package Control Installation and Usage, Sublime has powerful plug-in extensions, and this article details how to preview or even refresh the preview in real time when writing Markdown documentation with Sublime.


0. Review: Plug-in installation method, which will be used repeatedly in the future

    combination Ctrl+Shift+P bring up the command panel and enter Package Control: Install Package, press enter and enter the Package name to be installed (one by one, not multiple at the same time) in the search box. After a few seconds, the installation will be successful


    The plugin is introduced
    Introduces a few common plug-ins for the Markdown class:

    function

    0

    2

    4

    5

    6

    8

    0

    2

    3

    4

    function
    1 MarkdownEditing 3 a plug-in that improves the Markdown editing features in Sublime Markdown
    7 MarkdownPreview 9 Markdown to HTML, Preview in the browser
    MarkdownLivePreview provides real-time preview in the edit box
    LiveReload 1 a plug-in that provides real-time refresh preview of documents such as md/ HTML

    5
    The next few plug-ins are presented at a time.


    1. MarkdownEditing
    The Markdown editor, as the name suggests, is a must-have plug-in for Markdown writers, which not only highlights the syntax of Markdown but also supports syntax highlighting for many programming languages.
    special note: MarkdownEditing is enabled only for files in md\mdown\ MMD \ TXT format.
    features
    MarkdownEditing implements a series of optimizations for the editing of Markdown documents, both visually and conveniently. Such as:
    Color schemes like Byword and iA Writer automatically match asterisks (*), underscores (_), and back quotes (‘) in selected text by pressing the above symbols to automatically add matching symbols before and after the selected text to facilitate bold, italic, and code box input
    Effect:


    2. MarkdownLivePreview
    function
    Real-time preview Markdown file, md file on the left and preview results on the right. Can be used with MarkdownEditing.
    use
    MarkdownLivePreview turns off live preview by default, so now that you have the plugin installed, you should definitely use it. Open in Preferences -& GT; Package Settings -> MarkdownLivePreview -> Add a "markdown_live_preview_on_open" to the right of Settings: true,, and restart sublime.
    This is because the default configuration on the left side is unchangeable (read only), and the edit area on the right side is the user-defined area.
    rendering

C + + pauses the black window system (“pause”); (get ch(), getchar(), system (pause)’s connection and difference

In a c++ program, if it is a window, sometimes it will disappear with a flash. If you don’t want it to disappear, add:

system(“pause”);

Note: Do not add after the return statement, it will not be executed.

Analysis:

System () is a call to the system command;

pause pause command;

When run here, it will say “Press any key to continue…” or “Press any key to continue…” ;

In VS2008, can be called directly

VC 6.0, to add the following header file!

#include < stdlib.h>  
The

Supplement: http://bbs.csdn.net/topics/390231844

http://www.gidnetwork.com/b-61.html (the answer), 9/f,

1:

I don’t know why I often see people declare “void main” on CSDN

is not a standard entry point for C++

standard supports only two kinds of announcements

first type “int main”

int main(int argc, char *argv[]))

declares “void main” may have unexpected results

this doesn’t just apply to C++, C works as well

is this the textbook’s fault?Or is it the professors’ fault?

2:

do not use system(“pause”) to pause. Use STD ::cin. Get or getchar() instead.

why don’t you use system(“pause”)?

for two reasons

1: not portable
Two: it’s very expensive

where is it important?Let’s look at the process of system(“pause”)

1: pause your program

2: start the OS in the sub-process

3: finds the command to execute and allocates the memory for it

4: wait for input

5: recycle memory

6: end OS

7: continue your program

Getch () :
header file: conio. H
function purpose: read a character from the console, but not displayed on the screen
e.g. :
char ch; Or int ch;
getch (); Or ch = getch ();
with getch (); It waits for you to press any key before continuing with the following statement;
with ch = getch (); It waits for you to press any key, assigns the ASCII character to ch, and then executes the following statement.

getchar():
Extract characters from IO stream!
this function is declared in the stdio.h header file and used to include the stdio.h header file. Such as:
# include< stdio.h>
int getchar (void);
getch has the same basic functions as getchar, except that getch gets the key value directly from the keyboard and does not wait for the user to press enter. As soon as the user presses a key,
getch returns immediately. Getch returns the ASCII code entered by the user and returns -1 on error. The
getch function is commonly used in program debugging. During debugging, the relevant results are displayed in a critical position for viewing, and then the getch function is used to pause the program,
when any key is pressed after the program continues to run.

the first is that the two functions exist in different header files, this one basically you write #include< stdio.h> Getchar (), can accept a character, press enter to end, and display on the screen, and can clear forward just write
2. Getch (), receive a character, on the screen does not show
you write more, practice should be understood
Getchar () gets a character from the input device that is displayed on the screen, getch gets a character from the input device,
but the character is not displayed on the screen, for example:
#include < stdio.h>
int main()
{
printf(“%c”,getchar()); Suppose you get a character f from the keyboard here and press enter and you’ll see something like this
f
f
the first f is the f that you typed in, the second f is the f that printf gets
#include < stdio.h>

int main () {
printf (” % c “, getchar ());
}
suppose you enter an f and the result is
f this f is the printf output f
getchar is optimized,
getchar input character, until you press enter, then execute the code
getch without hitting enter
System (“pause”) can freeze the screen to observe the execution results of the program.
getch can not only pause the program
but also get a character
system(“pause”) is just a simple pause
the difference is the mechanism of action, although the effect looks the same. The
system return value is the result after you call the Shell command, and the getch() function will return the result provided by the function.
usually, the return value of Shell command may be unexpected and uncertain. Sometimes, it is impossible to judge whether the command
is executed successfully through the return value, which will have an impact on the program that conducts subsequent processing according to the return value. The return value of the function determines whether the
line is held successfully. But you don’t judge the return value at all, and you don’t process it, so you don’t have to worry about these differences.

How to Disassemble/Assemble Galaxy S4 i9500 for Screen/Parts Repair!

How to Disassemble/Assemble Galaxy S4 for Screen/Parts Repair!


Download this video for viewing in HD on your smartphone or computer.
Click Here to Download High-Quality HD video to your Smartphone or Computer.
This video was brought to you by AndroidRoot.org. Click Here to See at AndroidRoot.org
For those of you who need to repair your Galaxy S4 for either LCD screen replacement or parts replacement (such as fixing broken micro USB port, camera, etc…etc…), here’s a video tutorial that shows you how to easily disassemble and re-assemble your Galaxy S4.
You will need:
#00 Screwdriver
Plastic tool or guitar pick
Step 1. Unscrew the 9 visible screws.

 
Step 2. Start near the volume rockers and insert your plastic tool/guitar pick in between the screen and the frame.

Step 3. Carefully slide your plastic tool along the edges until the frame pops off.


Step 4. To take the motherboard out, make sure you pop off connectors as shown below.

Step 5. There’s one black screw on top right that holds the motherboard, unscrew it.

Step 6. Carefully pull the motherboard out, it should pop out easily.  If you need to replace the camera on the Galaxy S4, you can simply pop it off the motherboard and replace with a new one.


Step 7. If you are replacing the screen/digitizer, you will need to pull out the sensors at the top, the vibrating motor (on left side) and also the 3.5mm headphone jack on top right.

You might also have to take the bottom USB board out.

Step 8. Once you’ve replaced your screen/digitizer or other parts, you can easily re-assemble your Galaxy S4 starting with the motherboard.

Step 9. Nicely pop the motherboard back in place.

Step 10. Re-connect all the connectors you poped off and make sure you connect the blue wire from the USB board.

Next screw the black screw back on the top right.

Step 11. It’s time to put the frame back on, carefully place on top of your phone.  It should nicely fit and you will hear popping sounds and the frame gets put back on.

Make sure there’s no spaces in between the screen and the frame.

Step 12. Screw all the 9 screws back.

Step 13. Insert your SIM card and your battery, then turn on your phone.  Once turned on, test your video camera, audio recording, sound, bluetooth, and wifi.  Make sure they are all working.  If for some reason it doesn’t work, you will have to re-disassemble and check your connections.

Overall, disassembling the Galaxy S4 is a pretty easy process so long as you have a #00 screw driver and some type of plastic tool so you don’t leave nicks and scratches.
When disassembling your Galaxy S4, we highly recommend you to have a LOT of time on your hands and you do it slowly if this is the first time you are disassembling a smartphone.  Otherwise, this is something any one can do.
 
 
 

Need Help?Follow/add me on Google+, Facebook, or Twitter!

GooglePlus

Facebook

Twitter

Want to stay updated on latest Galaxy S4 Root news?

Sign up for our Galaxy S4 Root Newsletter here so you get ROM of the week and more!

Galaxy S4 Reference

You will need a rooted Galaxy S4 to install all ROM/kernels.

NOTE: THE AUTHOR OF THIS SITE IS NOT RESPONSIBLE IF YOU MESS UP YOUR PHONE, PLEASE READ INSTRUCTIONS TWICE BEFORE TRYING IF THIS IS YOUR FIRST TIME TO ROOTING AND CUSTOM ROMS!

First time to rooting and custom ROMs?

Please see our
Galaxy S4 Root FAQ FIRST!!!

[Python] numpy library array splicing np.concatenate Detailed explanation and examples of official documents

In practice, we often encounter array splicers, and concatenate is a very useful array manipulation function based on the Numpy library.
1, Concatenate (A1, A2…) Axis =0) official document details

concatenate(...)
    concatenate((a1, a2, ...), axis=0)

    Join a sequence of arrays along an existing axis.

    Parameters
    ----------
    a1, a2, ... : sequence of array_like
        The arrays must have the same shape, except in the dimension
        corresponding to `axis` (the first, by default).
    axis : int, optional
        The axis along which the arrays will be joined.  Default is 0.

    Returns
    -------
    res : ndarray
        The concatenated array.

    See Also
    --------
    ma.concatenate : Concatenate function that preserves input masks.
    array_split : Split an array into multiple sub-arrays of equal or
                  near-equal size.
    split : Split array into a list of multiple sub-arrays of equal size.
    hsplit : Split array into multiple sub-arrays horizontally (column wise)
    vsplit : Split array into multiple sub-arrays vertically (row wise)
    dsplit : Split array into multiple sub-arrays along the 3rd axis (depth).
    stack : Stack a sequence of arrays along a new axis.
    hstack : Stack arrays in sequence horizontally (column wise)
    vstack : Stack arrays in sequence vertically (row wise)
    dstack : Stack arrays in sequence depth wise (along third dimension)

2. Parameters
The parameter passed in must be a tuple or list of multiple arrays. In addition, the direction of splicing should be specified. The default is Axis = 0, which means longitudinal splicing of array objects on axis 0 (longitudinal splicing along axis= 1). Note: Generally, Axis = 0 means to operate on the array of this axis, and the operation direction is another axis, namely Axis =1.

In [23]: a = np.array([[1, 2], [3, 4]])

In [24]: b = np.array([[5, 6]])

In [25]: np.concatenate((a, b), axis=0)
Out[25]:
array([[1, 2],
       [3, 4],
       [5, 6]])

The incoming array must have the same shape, and the same shape here is sufficient for the same shape between the arrays on the axis axis in the splicing direction
If the array object is splicing axis= 1, the direction is horizontal axis 0, a is a 2*2 dimensional array, Axis = 0 is 2, B is a 1*2 dimensional array, axis= 0 is 1, the shapes of the two are different, then an error will be reported

In [27]: np.concatenate((a,b),axis = 1)
---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
<ipython-input-27-aa1228decc36> in <module>()
----> 1 np.concatenate((a,b),axis = 1)

ValueError: all the input array dimensions except for the concatenation axis must match exactly

Transpose B, and b is a 2*1 dimensional array:

In [28]: np.concatenate((a,b.T),axis = 1)
Out[28]:
array([[1, 2, 5],
       [3, 4, 6]])

C++ cin.ignore Use of ()

The function of CIN. Sync () is to clear the buffer, while cin. Ignore () is also used to delete the data in the buffer, but it has more accurate control over the deleted data in the buffer.
Cin. Ignore () can be used if you want to take only one part of the buffer and discard the other.
cin.ignore(int intExp, char chExp);
Where intExp is an integer expression, or it can be an integer value that represents the maximum number of characters that can be ignored in a line, such as intExp=100; There is also a parameter, chExp, which is a character expression. Ignore () if you come across a character that equals chEXP, and if you don’t get chEXP after ignoRE100, just stop ignore(), so 100 is the maximum number of characters that ignore().
here are some examples

#include<iostream>
#include<cstdlib>
int main()
{
  int ival1 = 0, ival2 = 0;
  std::cin >> ival1;
  std::cin.ignore(100, '\n');
  std::cin >> ival2;
  std::cout << "ival1 = " << ival1 << std::endl;
  std::cout << "ival2 = " << ival2 << std::endl;
  system("pause");
  return 0;
}


After you press Enter, Ival1 receives 12, the rest is cleared, because Enter is itself a blank line, and then the input stream will wait for the second input to assign a value to ival2. The if there is no middle the STD: : cin. Ignore (100), '\ n') , will not wait for the second input, output ival1 = 12 ival2 = 34 directly:

Ignore (2, '\n')
STD ::cin. Ignore (100, ‘\n’) STD ::cin. Ignore (2, ‘\n’), after ival1 receives 12, ignore will clear two characters:

Why is iVAL2 4 instead of 78?
Because the IO objects we use are cin cout manipulation char data, no matter what data we input, cin cout will be transformed into char for processing, for example, we want to output the value of a plastic variable, then before the output, cout will turn the value of the variable into characters, in the output (C++ Primer Plus In essence, the c + + insertion operator adjusts its behaviors to fit the type of data that follows it.), so ignore to clear out a space above and one character at a time, so the remaining 4, 56, 78, the buffer so ival2 is equal to 4.
(3) If cin. Ignore () does not give the parameter, the default parameter is cin. Ignore (1,EOF), that is, one character before EOF will be cleared out.

Install Seaborn, plot, Jieba in Anaconda

Seaborn is a very useful visualization package from Stanford university.
the original anaconda installation does not contain seaborn, which needs to be installed.
specific installation method:
1. From the beginning of your computer, open the CMD command window and type conda install seaborn
or anaconda prompt, conda install seaborn or PIP install seaborn

During the installation, Conda finds the seaborn dependent package based on its dependency, enters Y manually, and when it hits enter, the system automatically downloads and updates them.

Then, in Anaconda’s spider editor, import Seaborn and run without error. Ok, perfect!!
Of course, install plotly in a similar way: open the CMD command window, then type conda install plotly,
install it, and use the conda list to see if it succeeded.
Similarly, to install jieba, you can use either
conda install jieba or PIP install jieba

Unity learning — stop coroutine

The StopCoroutine method is similar to the StartCoroutine method, with two overloads.
void StopCoroutine(string methodName)
void StopCoroutine(IEnumerator routine)
this method can either pass in the methodName of the coroutine method as a parameter of type string or of type IEnumerator. Next, the StopCoroutine method is used:

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class StopCoroutine : MonoBehaviour {

    IEnumerator DoSomething(float someParameter)
    {
        print("DoSomething Loop");
        yield return null;
    }
     IEnumerator Start()
    {
        StartCoroutine("DoSomething",2.0f);
        yield return new  WaitForSeconds(1);
        StopCoroutine("DoSomething");
    }
}

This code opens a coroutine called DoSomething, which, if run continuously, prints out the phrase “DoSomething Loop”. So after waiting a second, the code stops the coroutine when it executes on the StopCoroutine line.

note: this is when the StopCoroutine method is not used

note: this is when the method is used
The StopCoroutine method can only stop the same coroutine in the same game script with the same Chinese name and string parameter passed in, and cannot affect the coroutine opened in other scripts. The StopCoroutine method, meanwhile, can only StopCoroutine that was started with an overloaded version of StartCoroutine’s string argument.

Sublime text 3 compiles and executes C/C++ programs directly

1 work environment
(1) PC system: Ubuntu12.04LTS.
(2) editor version: Sublime Text 3
2 achieves its purpose
the background is that I recently started using Sublime Text 3 to edit code, found it very easy to use, and was attracted by its powerful plug-in features. However, using the build that comes with Sublime after editing C/C++ code isn’t easy, so I decided to customize a single-file C/C++ compilation command myself.
3 custom C compilation
(1) in the sublime toolbar, select “tools” -> “Compiling system” -& GT; “New build system” opens with a file name called “Untitled. Sublime -build”. Edit it, add the following code, save it as “myC.sublime-build” and make the path the default.

{
    //"shell_cmd": "make"
    "working_dir": "$file_path",
    "cmd": "gcc -Wall \"$file_name\" -o \"$file_base_name\"",
    "file_regex": "^(..[^:]*):([0-9]+):?([0-9]+)?:?(.*)$",
    "selector": "source.c",

    "variants": 
    [
        {   
        "name": "Run",
            "shell_cmd": "gcc -Wall \"$file\" -o \"$file_base_name\" && \"${file_path}/${file_base_name}\""
        }
    ]
}

After saving, you’ll find something sublime in the “tools” -& GT; “Compiling system” -& GT; See myC’s build system under “New build system”.
(2) edit simple C code for testing

// File name:test_c_build.c
#include <stdio.h>

int main(int argc, char const *argv[])
{
    printf("hello world!\n");
    return 0;
}

Pressing the “Ctrl” + “Shift” + “b” brings up the compilation command selection window
select “myc-run” to compile and the results appear on the console below sublime, as follows:

4 custom C++ to compile
C++ the process is the same as that of C, only with a slightly different file content when creating a new compilation system:

{
    // "shell_cmd": "make"
    "encoding": "utf-8",
    "working_dir": "$file_path",
    "shell_cmd": "g++ -Wall -std=c++0x \"$file_name\" -o \"$file_base_name\"",
    "file_regex": "^(..[^:]*):([0-9]+):?([0-9]+)?:?(.*)$",
    "selector": "source.cpp",

    "variants": 
    [
        {   
        "name": "Run",
            "shell_cmd": "g++ -Wall -std=c++0x  \"$file\" -o \"$file_base_name\" && \"${file_path}/${file_base_name}\""
        }
    ]
}

5 The difference between myC and MyC-Run is that myC only compiles, not executes; Myc-run, on the other hand, is directly executed after compilation.
6 solves the problem that sublime has no input in its own console
because sublime has no input in its own console, so if the program USES functions like cin, the program cannot be executed. In Windows system, you need to call CMD. exe and hand the console over to CMD, so you need to add the command to call CMD when compiling the configuration file.
modify the above myC++.sublime-build as follows,

{
    // "shell_cmd": "make"
    "encoding": "utf-8",
    "working_dir": "$file_path",
    "shell_cmd": "g++ -Wall -std=c++0x \"$file_name\" -o \"$file_base_name\"",
    "file_regex": "^(..[^:]*):([0-9]+):?([0-9]+)?:?(.*)$",
    "selector": "source.cpp",

    "variants": 
    [
        {   
        "name": "Run",
            "shell_cmd": "g++ -Wall -std=c++0x  \"$file\" -o \"$file_base_name\" && \"${file_path}/${file_base_name}\""
        },
        {   
        "name": "RunInCmd",
            "shell_cmd": "g++ -Wall -std=c++0x  \"$file\" -o \"$file_base_name\" && start cmd /c \"\"${file_path}/${file_base_name}\" & pause \""
        }
    ]
}

It’s just adding this sentence,

&& start cmd /c \"\"${file_path}/${file_base_name}\" & pause \"

After saving,
write the sample program myC++_test_example.cpp. It is as follows:

#include <iostream>
#include <string.h>

using namespace std;
int main ()
{
    string str;

    cout << "please enter a string" << endl;
    cin >> str;
    cout << "input string: " << str << endl;

    return 0;
}


execution result:

7 currently only supports compiling single files, the rest will be discussed later.