2022-08-28

Setup VNC on Ubuntu 20.04

 

sudo apt updatesudo apt install xfce4 xfce4-goodiessudo apt install tigervnc-standalone-serversudo apt install tightvncservervncserver


Alternatively for VINO

gsettings set org.gnome.Vino require-encryption false

小米电视不能访问电脑共享文件

 找到samba的配置文件smb.conf,在里面[global]位置下面加入 server min protocol = CORE 保存文件后记得重启samba服务

 sudo nano /etc/samba/smb.conf
 server min protocol = CORE 

CTRL+O , CTRL + X
sudo service smbd restart

2022-04-18

Java学习路线排列(B站)

 Java学习路线排列


第一部分:JavaSE-筑基、结丹Java零基础教程视频(适合Java 0基础,Java初学入门)

https://www.bilibili.com/video/BV1Rx411876f

数据结构与算法_适合零基础学习数据结构与算法

https://www.bilibili.com/video/BV1HQ4y1d7th

图书管理系统JavaSE项目实战训练-适合学完Java零基础同学巩固

https://www.bilibili.com/video/BV1tV411J77q

MySQL基础入门到精通视频教程-MySQL数据库实战(内含MySQL34道面试题)

https://www.bilibili.com/video/BV1fx411X7BD

JDBC从入门到精通视频教程-JDBC实战精讲

https://www.bilibili.com/video/BV1Bt41137iB

动力节点最新JavaWeb视频教程,javaweb零基础入门到精通IDEA版-【已完结】

https://www.bilibili.com/video/BV1Z3411C7NZ

2021-04-24

2021 PUBLIC DNS

114.114.114.114  

114.114.115.115

114.114.114.119

114.114.115.119

180.76.76.76   百度DNS

223.5.5.5   阿里DNS

223.6.6.6  阿里DNS

119.29.29.29  腾讯DNS


2021-04-14

Linux 常用命令

sleep 10 && xset dpms force off


ps -aux


sudo lsof -i:3389


ssh -L 3389:localhost:5900 -C -N -l rocky localhost

sudo iptables -t nat -A OUTPUT -o lo -p tcp --dport 3389 -j REDIRECT --to-port 5900


sudo apt-get remove openssh-client openssh-server

sudo apt-get install openssh-client openssh-server


gsettings set org.gnome.Vino require-encryption false  //

Ubuntu Setup

sudo apt update

Chrome

https://www.google.com/chrome/


DoubleCommand

sudo apt install doublecmd-gtk


qbittorrent

sudo apt-get update && sudo apt-get install qbittorrent 

https://github.com/bill-ahmed/qbit-matUI

2020-12-31

Port Forward using Ngrok

1. Visit
https://ngrok.com/
2. Download
https://ngrok.com/download
3. Register using unique key
4. Run
ngrok http 111 -host-header="localhost:1111"
5. Config
tunnels:
    proxy:
        proto: http
        addr: 8080
        host-header: localhost:8080
    gui:
        proto: tcp
        addr: 888
        host-header: localhost:888
x

2020-04-07

Highlight table row to highlight Episodes


<script>
    var episodeStringArray = ['S10E', 'S11E', 'S12E', 'S13E', 'S14E', 'S15E', 'S16E', 'S17E', 'S18E', 'S19E', 'S20E', 'S21E', 'S22E', 'S23E', 'S24E', 'S25E', 'E1', 'E01', 'E2', 'E02', 'E3', 'E03', 'E4', 'E04', 'E5', 'E05', 'E6', 'E06', 'E7', 'E07', 'E8', 'E08', 'E9', 'E09', 'E10', 'E11', 'E12', 'E13', 'E14', 'E16', 'E17', 'E18', 'E19', 'E20', 'E21', 'E22', 'E23', 'E24', 'E25', 'E26', 'E27', 'E28', 'E29', 'E30', 'EP1', 'EP01', 'EP2', 'EP02', 'EP3', 'EP03', 'EP4', 'EP04', 'EP5', 'EP05', 'EP6', 'EP06', 'EP7', 'EP07', 'EP8', 'EP08', 'EP9','EP09', 'EP10', 'EP11', 'EP12', 'EP13', 'EP14', 'EP16', 'EP17', 'EP18', 'EP19', 'EP20', 'EP21', 'EP22', 'EP23', 'EP24', 'EP25', 'EP26', 'EP27', 'EP28', 'EP29', 'EP30', 'EP31', 'EP32', 'EP33', 'EP34', 'EP35', 'EP36', 'EP37', 'EP38', 'EP39', 'EP40',' SP '];

    $('tr').each(function () {
        var title = $(this).text().toUpperCase();
        if (episodeStringArray.some(v => title.indexOf(v) > 1)) {
            $(this).css("background-color", "#F4F1F1 ");
            console.log(1);
        }
    })

</script>

2020-04-04

Add GreyMode for Site

CSS:

.greyMode {
    -moz-filter: grayscale(100%);
    -webkit-filter: grayscale(100%);
    filter: gray; /* IE6-9 */
    filter: grayscale(100%);
}


Homepage:

<html class="greyMode">

2019-10-28

Batch Rename File/Folder with C#

            // BATCH RENAME FOLDER
            System.IO.DirectoryInfo _dirAA = new System.IO.DirectoryInfo(@"C:\Users\rockymay\Downloads\ROCKY\xx\");
            foreach (System.IO.DirectoryInfo _dir in _dirAA.GetDirectories())
            {
               foreach(var _dir1 in _dir.GetDirectories())
                {
                    foreach (var _dir2 in _dir1.GetDirectories())
                    {
                        foreach (var _dir3 in _dir2.GetDirectories())
                        {
                            if (_dir3.Name.Contains("[BT-btt.com]"))
                            {

                                string _name = _dir3.Name.Replace("[BT-btt.com]", "");
                                string newpath = _dir2.FullName + "\\" + _name;
                                System.IO.Directory.Move(_dir3.FullName, newpath);
                                Console.Write("#");
                            }
                        }
                    }
                }
            }



            // BATCH RENAME FILE
            foreach (String filePath in Directory.GetFiles(@"C:\Users\rockymay\Downloads\ROCKY\xx\", "*.*", SearchOption.AllDirectories))
            {
                File.Move(filePath, filePath.Replace("[BT-btt.com]", ""));
                Console.Write("#");
            }

2019-10-01

Crop Image in C#

                //Crop Image to Proper Size

                var img = Image.FromFile("screenshot.png");
                Bitmap bmpImage = new Bitmap(img);
                Bitmap bmpCrop = bmpImage.Clone(new Rectangle(1370, 340, 200, 140), bmpImage.  //width distance, height distance,  new share width, new shape height
                PixelFormat);
                bmpCrop.Save("12.jpg");





2019-04-01

How to Avoid Disk100% for Utorrent

Follow these steps:

1. Make sure you are using uTorrent 2.2.1, because that's the most stable and most allowed torrent client on every torrent site. You can download it from http://utorrent.hu/download/utorrent-2-2-1-2/
2. Open the uTorrent settings (CTRL+P)
3. Tick the preallocate files button and untick all the updating and data sending related things
4. Go to advanced settings
5. Set bt.prio_first_last_piece to true
6. Set diskio.coalesce_write_size to 8388608
7. Set diskio.flush_files to false
8. Set diskio.sparse_files to true
9. Go to cache settings
10. Tick the override default cache, and set the cache size to 368MB
11. Apply and save the settings
12. After restarting uTorrent you will see way less or maybe absolutely no disk overload issues anymore



2018-12-10

Hide IISExpress/Run IIS Express at Background

create vbs file as :
-----
Dim App,Site 
Site = "BlogMVC"
If Len(Site) < 1 Then
    Site = WScript.Arguments(0)
End If
App = """%PROGRAMFILES%\IIS Express\iisexpress""" & _
          " /site:" & Site
If Len(Site) > 0 Then
    Set WshShell = CreateObject("WScript.Shell")
    WshShell.Run App, 0
    Set WshShell = Nothing
End If
------



AND RUN!

2018-07-27

Call Divert Setting

It is available in settings menu of different phone morever you can call on a number provided by service provider to divert calls.

Anyways you can try below numbers as per requirements.

Call diversion when busy:

**67*number#

Divert to the given number

#67#

deactivate call diversion

##67#

Erase call diversion

*#67#

Request status for call diversion

Call diversion in case the handset is turned off or has not coverage:

**62*number#

Divert to the given number

#62#

deactivate call diversion

##62#

Erase call diversion

*#62#

Request status for call diversion

Call diversion for not responding

**61*number**x#

Divert to the given number aber x seconds (x=5,10,15,20,25,30)

#61#

Deactivate call diversion

##61#

Erase call diversion

*#61#

Request status of call diversion

Call diversion for all conditions above:

*#004*number#

Divert to the given number

#004#

Deactivate call diversion

##004#

Erase call diversion

*#004#

Request status for call diversion

Always divert:

*#21*number#

Always divert to given number

#21#

Deactivate call diversion

##21#

Erase call diversion

*#21#

Request status for call diversion

Erase all call diversions:

##002#[dial]

Remove all call diversions


2018-04-24

Getting Current Controller/Action in MVC

Getting Current Controller/Action in MVC



@{
    var controller = ViewContext.RouteData.GetRequiredString("controller");
    var action = ViewContext.RouteData.GetRequiredString("action");
}




https://stackoverflow.com/questions/6398189/getting-current-controller-action-from-within-partial-view

Click Once, Sort by Name, Click Twice Sort by Desc in MVC

Click Once, Sort by Name, Click Twice Sort by Desc in MVC



    ViewBag.NameSortParm = sortOrder == "name" ? "name_desc" : "name";
    // Rest of your sortOrder param goes here...

    var persons = from s in db.PRT_FEE_PRICES
                  select s;
    switch (sortOrder)
    {
        case "name":
            persons = persons.OrderBy(s => s.NAME);
            break;
        case "name_desc":
            persons = persons.OrderByDescending(s => s.NAME);
            break;
        // ...
    }


2018-04-22

Question: How to pass dot parameter to id in MVC

Question: How to pass dot parameter to id in MVC

Solution:
Add following in Web.config

<system.webServer>
    <modules runAllManagedModulesForAllRequests="true" />
    <validation validateIntegratedModeConfiguration="false" />
</system.webServer>
  
 
 

https://stackoverflow.com/questions/32392776/can-i-pass-dot-as-parameter-to-id-in-controller-method-in-mvc


2018-02-05

How to binding IP Address in LAN of IISExpress


1. Locate file "applicationhost.config" in <Document>/IISExpress/config

2. Scroll down to the code of :





  
        
             
        
        
             
        

3. Adding your binding IP Address as follows:


  




3. Run CMD in admin of following


netsh http add urlacl url=http://192.168.1.1:8080/ user=everyone  






3. Run IISExpress, you are good to go!


2017-08-14

Convert Txt to Image

https://forums.asp.net/t/1832136.aspx?how+to+convert+text+to+image+in+c+


        public static void LoopingFolders()
        {
            Console.WriteLine("Please enter target Folder Path?");
            string basePath = Console.ReadLine();
         
            DirectoryInfo di = new DirectoryInfo(basePath);
            foreach (var dir in di.GetDirectories())
            {
                foreach(var file in dir.GetFiles("*.txt"))
                {
                    string content = File.ReadAllText(file.FullName);
                    string name = file.FullName;
                    SaveTxtAsImage(content, name);
                }
            }
        }
        public static void SaveTxtAsImage(string content, string targetFileName)
        {

       

       
            Bitmap bitmap = new Bitmap(1, 1);
            Font font = new Font("Arial", 30, FontStyle.Bold, GraphicsUnit.Pixel);
            Graphics graphics = Graphics.FromImage(bitmap);
            int width =600;
            int height = 800;

            bitmap = new Bitmap(bitmap, new Size(width, height));
            graphics = Graphics.FromImage(bitmap);
            graphics.Clear(Color.LightYellow);
            graphics.SmoothingMode = SmoothingMode.AntiAlias;
            graphics.TextRenderingHint = TextRenderingHint.AntiAlias;

            graphics.DrawString(content, font, new SolidBrush(Color.FromArgb(255, 0, 0)), 0, 20);
       
            graphics.Flush();
            graphics.Dispose();

            string fileName = targetFileName + ".jpg";
            bitmap.Save( fileName, ImageFormat.Jpeg);


        }

2017-07-16

Branch Decision Path Statement Coverage


Statement Coverage is calculated when test cases cover all statement in logic.

Branch Coverage, aka decision coverage, covers both true and false conditions.

Path Coverage covers the distinct paths that the test cases could be.



In a word:


  1. Branch coverage and Decision coverage are one and the same
  2. 100% LCSAJ(Linear Code Sequence and Jump.) coverage implies 100% Branch/Decision coverage
  3. 100% Path coverage implies 100% Statement coverage
  4. 100% Branch/Decision coverage implies 100% Statement coverage
  5. 100% Path coverage implies 100% Branch/Decision coverage


Detail, please refers to:

Setup VNC on Ubuntu 20.04

  sudo apt update sudo apt install xfce4 xfce4-goodies sudo apt install tigervnc-standalone-server sudo apt install tightvncserver vncserver...