- 10月 23 週四 201421:57
How to Make a Domain User the Local Administrator for all PCs
- 10月 18 週六 201410:18
解決 PHP/mySQL 資料庫讀取中文顯示亂碼或問號
解決 PHP/mySQL 資料庫讀取中文顯示亂碼或問號
發佈時間: 2011-01-09 週日
發佈時間: 2011-01-09 週日
- 9月 13 週六 201409:14
Linux 中用戶切換:su 和 su- 的使用 環境變量詳解
大部分Linux發行版的默認賬戶是普通用戶,而更改系統文件或者執行某些命令,需要root身份才能進行,這就需要從當前用戶切換到root用戶,Linux中切換用戶的命令是su或su -,下面就su命令和su -命令最大的本質區別給大家詳解一下:
前者只是切換了root身份,但Shell環境仍然是普通用戶的Shell;而後者連用戶和Shell環境一起切換成root身份了。只有切換了Shell環境才不會出現PATH環境變量錯誤。su切換成root用戶以後,pwd一下,發現工作目錄仍然是普通用戶的工作目錄;而用su -命令切換以後,工作目錄變成root的工作目錄了。用echo $PATH命令看一下su和su - 以後的環境變量有何不同。以此類推,要從當前用戶切換到其它用戶也一樣,應該使用su -命令。
打個比方:在普通用戶下輸入:
$pwd
/home/test (當前用戶目錄)
$su ****** (輸入密碼)
#pwd (再次查看路徑)
/home/test (還是當前用戶目錄)
但是如果換成su -的話結果如下:
$pwd
/home/test(當前用戶目錄)
$su -
****** (輸入密碼)
#pwd (再次查看路徑)
/root (切換到超級用戶目錄)
前者只是切換了root身份,但Shell環境仍然是普通用戶的Shell;而後者連用戶和Shell環境一起切換成root身份了。只有切換了Shell環境才不會出現PATH環境變量錯誤。su切換成root用戶以後,pwd一下,發現工作目錄仍然是普通用戶的工作目錄;而用su -命令切換以後,工作目錄變成root的工作目錄了。用echo $PATH命令看一下su和su - 以後的環境變量有何不同。以此類推,要從當前用戶切換到其它用戶也一樣,應該使用su -命令。
打個比方:在普通用戶下輸入:
$pwd
/home/test (當前用戶目錄)
$su ****** (輸入密碼)
#pwd (再次查看路徑)
/home/test (還是當前用戶目錄)
但是如果換成su -的話結果如下:
$pwd
/home/test(當前用戶目錄)
$su -
****** (輸入密碼)
#pwd (再次查看路徑)
/root (切換到超級用戶目錄)
- 9月 11 週四 201419:37
linux系統下,安裝phpmyadmin顯示一片空白
linux下打印錯誤報告 sudo tail /var/log/httpd/error_log
顯示如下錯誤:phpMyAdmin\libraries\php-gettext\gettext.inc on line 177Fatal error:
顯示如下錯誤:phpMyAdmin\libraries\php-gettext\gettext.inc on line 177Fatal error:
- 9月 11 週四 201417:15
解決:配置虛擬主機,重啟apache,[warn] _default_ VirtualHost overlap on port 80, the first has precedence
在配置第一個虛擬主機的時候,重啟apache的時候,都可能會遇到下面的問題:
[warn] _default_ VirtualHost overlap on port 80, the first has precedence
- 8月 30 週六 201412:52
佈局管理器 動態產生佈局 Layout
為了更好的管理Android應用的用戶界面裡的個組件,Android提供了佈局管理器,通過佈局管理器,Android應用的圖形用戶界面具有良好的平台無關性。這裡什麼叫平台的無關性呢?就是說不同手機。我們知道不同手機它們的屏幕的分辨率、尺寸並不完全相同,而Android的佈局管理器可以根據運行平台來調整組件的大小,而我們所需要做的就是選擇合適的佈局管理器。
與Swing編程不同的是,Android的佈局管理器本身就是一個UI組件,所有的佈局管理器都是ViewGroup的子類:
與Swing編程不同的是,Android的佈局管理器本身就是一個UI組件,所有的佈局管理器都是ViewGroup的子類:
- 8月 30 週六 201412:02
Android 利用 addView 讓 Activity 動態加入多個 View 物件
在 Android 中,你可以利用排版 View 的 addView 函數,
將動態產生的 View 物件加入到排版 View 中,
範例如下 :
- 8月 30 週六 201410:17
Android 元件佈局 RelativeLayout
上一篇介紹過如何使用LinearLayout進行元件佈局,但是單靠一種排版方式,設計出來的介面並不豐富,所以Android也有提供其它的排版方式,本篇將介紹如何使用RelativeLayout(相對佈局)進行排版。其它的排版方式會陸陸續續的介紹!!使用RelativeLayout進行元件佈局
- 8月 30 週六 201410:14
[Android UI 設計] 版面布局Layout-LinearLayout
每一個人第一次接觸到Android UI 設計時,第一個認識的ViewGroup應該都是LinearLayout,因為eclipse自動新增的專案預設就是以「android.widget.LinearLayout 」為主要的版面布局。
LinearLayout是以你設定它的「android:orientation」屬性;值有:垂直(vertical)或水平(horizontal)兩種,用來排列所有的子元件。所有的子元件都被線性堆放在其它元素之後,因此一個設定垂直屬性的每一列只會有一個元件一直向下排列,而不管他們有多寬;而一個設定水平屬性的每一行只有一個元件一直向右排列(高度為最高子元件的高度加上邊框高度)。LinearLayout保持子元件之間的間隔以及互相對齊。
LinearLayout常用屬性
屬性名稱
描述
LinearLayout佈局的方向,可取horizontal(水平)和vertical(垂直)兩種排列方式
內部元件對於父元件的對齊方式
元件的分配大小的權值,數字越大分配越多
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 | android:layout_width="match_parent" android:layout_height="match_parent" android:background="#ff0" android:orientation="vertical" > <Button android:id="@+id/Button15" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="left" android:text="靠左" /> <Button android:id="@+id/Button02" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginLeft="30dp" android:text="離左邊界30dp" /> <Button android:id="@+id/Button01" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="right" android:text="靠右" /> <Button android:id="@+id/Button03" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="center_horizontal" android:text="置中" /> <LinearLayout android:layout_width="wrap_content" android:layout_height="match_parent" android:background="#cc0" android:orientation="horizontal" > <Button android:id="@+id/Button14" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Button" /> <Button android:id="@+id/button2" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Button" /> <Button android:id="@+id/Button11" android:layout_width="wrap_content" android:layout_height="80dp" android:text="以我為列高" /> <LinearLayout android:layout_width="100dp" android:layout_height="match_parent" android:background="#f0f" android:orientation="vertical" > <Button android:id="@+id/button1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Button" /> <Button android:id="@+id/Button16" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Button" /> <Button android:id="@+id/Button17" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Button" /> </LinearLayout> </LinearLayout></LinearLayout> |
- 8月 30 週六 201408:33
Android 從媒體櫃Gallery 選擇圖片
To fetch images on SD Card.Uri will be
android.provider.MediaStore.Images.Media.EXTERNAL_CONTENT_URI
onActivityResult method:
protectedvoid onActivityResult(int requestCode,int resultCode,Intent intent)
{super.onActivityResult(requestCode, resultCode, intent);
if(resultCode == RESULT_OK)
{
Uri photoUri = intent.getData();
if(photoUri !=null)
{
try
{Bitmap bitmap =MediaStore.Images.Media.getBitmap(this.getContentResolver(), photoUri);
//Now you can upload this bitmap to server or do something else.
}catch(Exception e)
{
e.printStackTrace();
}
}
}
}
android.provider.MediaStore.Images.Media.EXTERNAL_CONTENT_URI
onActivityResult method:
protectedvoid onActivityResult(int requestCode,int resultCode,Intent intent)
{super.onActivityResult(requestCode, resultCode, intent);
if(resultCode == RESULT_OK)
{
Uri photoUri = intent.getData();
if(photoUri !=null)
{
try
{Bitmap bitmap =MediaStore.Images.Media.getBitmap(this.getContentResolver(), photoUri);
//Now you can upload this bitmap to server or do something else.
}catch(Exception e)
{
e.printStackTrace();
}
}
}
}
You can create GPO and link the GPO to domain or OU containing all the computers.