取消 yum 损坏。Broke Fedora after accidentally cancelled yum update



I just did the same thing on a Fedora 22 system. I couldn’t upgrade or reinstall any of the packages. Running package-cleanup –cleandups wanted to remove glibc, which wanted to pretty much all of the packages on the system.

To resolve the issue, I performed a distro-sync on all of the duplicate packages.

sudo package-cleanup --dupes | perl -pe 's/-\d+.*$//' | sort -u | grep -vP '^Loaded' | xargs sudo dnf distro-sync -y

Then followed up with

sudo dnf upgrade
sudo package-cleanup --cleandupes

电信 光纤猫 贝尔E8-C-EPON 破解超级管理员密码

第二步、以用户名:“telecomadmin” 密码:“nE7jA%5m”登录设备。




3、用记事本或者任何能打开 .conf 的软件(比如 SublimeText)打开backupsettings.conf,然后 ctrl+f 查找 Password,这就是你的超级管理员密码。

4、再次打开,如果之前的还登陆着,先退出,然后用账号名为 telecomadmin,密码为你之前找到的 Password 进行登录。现在我们就能看到完整的设置界面了。

TCPing 工具介绍

TCPing 介绍

TCPing 和 Ping 工具非常类似,但与之不同的是,它通过 TCP 端口工作。TCPing 还支持监听具体某个端口的状态。

因此,即使服务器禁止 Ping,也可以通过 TCPing 来测试与服务器的连接。

TCPing 客户端下载

来自 kirchner 源代码的 TCPing

来自 Eli Fulkerson 源代码的 TCPing

来自 richard 源代码的 TCPing

Eli Fulkerson 写的 TCPing 工具更加强大,可以输出连接时间等信息。而 kirchner 的版本只能输出此端口是否打开。

Linux 用户如果需要更加强大的 TCPing 工具,可以使用此脚本:


  1. 安装 tcptraceroute:

Debian / Ubuntu 用户:

sudo apt-get install tcptraceroute

CentOS / REHL 用户,设置 RepoForge 先,再:

sudo yum install tcptraceroute
  1. 下载 tcpping 脚本:
cd /usr/bin
sudo wget http://www.vdberg.org/~richard/tcpping
sudo chmod 755 tcpping

TCPing 工具使用方法

  • Windows 用户可以将其放入 X:\Windows\System32 文件夹下(X 代表系统分区),然后就可以直接在 CMD 命令行中使用。
  • 类 Unix 系统请自行在 /bin 或其他目录下放置可执行文件或软链接。




from : http://tookdes.org/geek/archives/tcping-intro.html

如何测试连接MsSQL/SQL Server数据库 from 阿里云

如果您所使用的 SQL Server 数据库连不上,可以通过这个方法进行测试数据库连接。


  • .本方法只适用于测试SqlServer数据库连接,请核对您输入的是SqlServer的数据库信息。本文档不适用于MySql数据库。
  • 如何查看数据库信息


1.打开记事本,不要写任何字,然后保存为 dsds.udl (即为重命名)到桌面。







How to upload to Google Cloud Storage buckets using CURL

Signed URLs are pretty nifty feature given by Google Cloud Platform to let anyone access your cloud storage (bucket or any file in the bucket) without need to sign in.

Official documentation gives step by step details as to how to read/write to the bucket using gsutil or through a program. This article will tell you how to upload a file to the bucket using curl so that any client which doesn’t have cloud SDK installed can do this using a simple script.
This command creates a signed PUT URL for your bucket.
 gsutil signurl -c 'text/plain' -m PUT serviceAccount.json gs://test_bucket_location  

Here is my URL:

 https://storage.googleapis.com/[email protected]&Expires=1490266627&Signature=UfKBNHWtjLKSBEcUQUKDeQtSQV6YCleE9hGG%2BCxVEjDOmkDxwkC%2BPtEg63pjDBHyKhVOnhspP1%2FAVSr%2B%2Fty8Ps7MSQ0lM2YHkbPeqjTiUcAfsbdcuXUMbe3p8FysRUFMe2dSikehBJWtbYtjb%2BNCw3L09c7fLFyAoJafIcnoIz7iJGP%2Br6gAUkSnZXgbVjr6wjN%2FIaudXIqAxyz4O6VU%2FIob8RHmfYBD3rYw8oRmZer0g%2BMTDw5Bu3%2BdjbxCriCOkOLWkvlpBGvd71hRP89lxpD%2FwX1N1pzAiRBpmKAhpKrYrq8h4kNLAtTHXYSz5j%2Bzb28UD4YMG52n8UpfyPgFIg%3D%3D  

Now this command will upload a text file to the bucket using the signed URL we created:

 $ curl -X PUT -H 'content-type: text/plain' -d @test_upload.txt https://storage.googleapis.com/[email protected]&Expires=1490266627&Signature=UfKBNHWtjLKSBEcUQUKDeQtSQV6YCleE9hGG%2BCxVEjDOmkDxwkC%2BPtEg63pjDBHyKhVOnhspP1%2FAVSr%2B%2Fty8Ps7MSQ0lM2YHkbPeqjTiUcAfsbdcuXUMbe3p8FysRUFMe2dSikehBJWtbYtjb%2BNCw3L09c7fLFyAoJafIcnoIz7iJGP%2Br6gAUkSnZXgbVjr6wjN%2FIaudXIqAxyz4O6VU%2FIob8RHmfYBD3rYw8oRmZer0g%2BMTDw5Bu3%2BdjbxCriCOkOLWkvlpBGvd71hRP89lxpD%2FwX1N1pzAiRBpmKAhpKrYrq8h4kNLAtTHXYSz5j%2Bzb28UD4YMG52n8UpfyPgFIg%3D%3D  

On similar lines, you can create a RESUMABLE URL and then upload file using following command:

 $ curl -v -X 'POST' -H 'content-type: text/plain' -H 'x-goog-resumable:start' '[signed url]' -d ''  

This command gives ‘session URI’ which is similar to signed url, but longer!

 $ curl -v -X PUT -d @test_upload.txt -H 'content-type: text/plain' '[session URI]'  

Simple isn’t it!





iOS tab bar icon size。

You should prepare 3 images icons for each tab bar item (1x, 2x and 3x).

First create the 3x at 75w 75h pixels (maximum: 144 x 96) and save it as [email protected]

Then resize it to 50w 50h pixels (maximum: 96 x 64) and save it as [email protected]

Finally resize it to 25w 25h pixels (maximum: 48 x 32) and save it as iconTab0.png.

Now all you need is to select those 3 images at your finder and drag them to your image assets.



enter image description here

enter image description here



python -mSimpleHTTPServer







Swift Custom Table View Cell Example 自定义 UITableViewCell


Custom Table View Cell Example

The asker of the original question has solved their problem. I am adding this answer as a mini self contained example project for others who are trying to do the same thing.

The finished project should look like this:

enter image description here


Create a new project

It can be just a Single View Application.

Add the code

Add a new Swift file to your project. Name it MyCustomCell.swift. This class will hold the outlets for the views that you add to your cell in the storyboard.

import UIKit class MyCustomCell: UITableViewCell {     @IBOutlet weak var myView: UIView!     @IBOutlet weak var myCellLabel: UILabel! }

We will connect these outlets later.

Open ViewController.swift and make sure you have the following content:

import UIKit class ViewController: UIViewController, UITableViewDelegate, UITableViewDataSource {      // These strings will be the data for the table view cells     let animals: [String] = ["Horse", "Cow", "Camel", "Sheep", "Goat"]      // These are the colors of the square views in our table view cells.     // In a real project you might use UIImages.     let colors = [UIColor.blueColor(), UIColor.yellowColor(), UIColor.magentaColor(), UIColor.redColor(), UIColor.brownColor()]      // Don't forget to enter this in IB also     let cellReuseIdentifier = "cell"      @IBOutlet var tableView: UITableView!      override func viewDidLoad() {         super.viewDidLoad()          tableView.delegate = self         tableView.dataSource = self     }      // number of rows in table view     func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -> Int {         return self.animals.count     }      // create a cell for each table view row     func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {          let cell:MyCustomCell = self.tableView.dequeueReusableCellWithIdentifier(cellReuseIdentifier) as! MyCustomCell          cell.myView.backgroundColor = self.colors[indexPath.row]         cell.myCellLabel.text = self.animals[indexPath.row]          return cell     }      // method to run when table view cell is tapped     func tableView(tableView: UITableView, didSelectRowAtIndexPath indexPath: NSIndexPath) {         print("You tapped cell number \(indexPath.row).")     } }

Setup the storyboard

Add a Table View to your view controller and use auto layout to pin it to the four sides of the View Controller. Then drag a Table View Cell onto the Table View. And then drag a View and a Label onto the Prototype cell. (You may need to pull the bottom of the prototype cell down so that it is a little bigger.) Use auto layout to fix the View and the Label how you want them arranged within the content view of the Table View Cell. For example, I made my View be 100×100.

enter image description here

Other IB settings

Custom class name and Identifier

Select the Table View Cell and set the custom class to be MyCustomCell (the name of the class in the Swift file we added). Also set the Identifier to be cell (the same string that we used for the cellReuseIdentifier in the code above.

enter image description here

Hook Up the Outlets

  • Control drag from the Table View in the storyboard to the tableView variable in the ViewController code.
  • Do the same for the View and the Label in your Prototype cell to the myView and myCellLabel variables in the MyCustomCell class.


That’s it. You should be able to run your project now.


  • The colored views that I used here could be replaced with anything. An obvious example would be a UIImageView.
  • If you are just trying to get a TableView to work, see this even more basic example.
  • If you need a Table View with variable cell heights, see this example.

How do I set adaptive multiline UILabel text? UILable 文本自动换行

 This is much better approach if you are looking for multiline dynamic text label which exactly takes the space based on its text.

No sizeToFit, preferredMaxLayoutWidth used

Below is how it will work.

enter image description here

 Lets set up the project. Take a Single View application and in Storyboard Add a UILabel and a UIButton. Define constraints to UILabel as below snapshot:

enter image description here

Set the Label properties as below image:

enter image description here

Add the constraints to the UIButton. Make sure that vertical spacing of 100 is between UILabel and UIButton

enter image description here

Now set the priority of the trailing constraint of UILabel as 749

enter image description here

Now set the Horizontal Content Hugging and Horizontal Content Compression properties of UILabel as 750 and 748

enter image description here

Below is my controller class. You have to connect UILabel property and Button action from storyboard to viewcontroller class.

import UIKit  class ViewController: UIViewController {  @IBOutlet weak var textLabel: UILabel! var count = 0 let items = ["jackson is not any more in this world", "Jonny jonny yes papa eating sugar no papa", "Ab", "What you do is what will happen to you despite of all measures taken to reverse the phenonmenon of the nature"]   @IBAction func updateLabelText(sender: UIButton) {     if count > 3 {         count = 0     }     textLabel.text = items[count]     count = count + 1 }  override func viewDidLoad() {     super.viewDidLoad()     // Do any additional setup after loading the view, typically from a nib.     //self.textLabel.sizeToFit()     //self.textLabel.preferredMaxLayoutWidth = 500 }  override func didReceiveMemoryWarning() {     super.didReceiveMemoryWarning()     // Dispose of any resources that can be recreated. }   }

Thats it. This will automatically resize the UILabel based on its content and also you can see the UIButton is also adjusted accordingly.