这个问题,我要问百度知道知道不知道知道就知道不知道就不知道不要知道说不知道不知道说知道到头来知道变成不知道不知道还是不知道天知道地知道百度知道知道若要问我知道不知道知道不知道也不知道。
晕了吧你!null - Watch more free videos
Supporting MAC is my way to support Linux
这个问题,我要问百度知道知道不知道知道就知道不知道就不知道不要知道说不知道不知道说知道到头来知道变成不知道不知道还是不知道天知道地知道百度知道知道若要问我知道不知道知道不知道也不知道。
晕了吧你!
at
16:41
0
comments
labels: life
at
19:43
0
comments
labels: php
makewatermark();
function makewatermark()
{
///////////////
// php imagemagick test harness
//
// create a watermarked image
///////////////
//xoffset of the watermark
//yoffset of the watermark
//the original image to be watermarked
$rawimage = NewMagickWand();
MagickReadImage( $rawimage, 'cyclops.gif' );
MagickWriteImage($rawimage, 'new_image.jpg' );
$originalimage='new_image.jpg';
//the watermark to apply
$watermarkimage = "sphinx.gif";
//top end opacity number (totally transparent)
$opacity0 = @MagickGetQuantumRange();
//bootom opacity (totally visible)
$opacity100 = 0;
//desired opacity percentage
// THIS IS THE ONE TO SET
$opacitypercent = 50;
//gather the actual opacity number
$opacity = $opacity0 - ($opacity0 * $opacitypercent/100 ) ;
//validate the opacity number
if ($opacity > $opacity0){
$opacity = $opacity0;
}elseif ($opacity <0){
$opacity = 0;
}
//initialize the wands
$sourceWand = NewMagickWand();
$compositeWand = NewMagickWand();
//read in the images
@MagickReadImage($compositeWand, $watermarkimage);
@MagickReadImage($sourceWand, $originalimage);
//setting the image index
MagickSetImageIndex($compositeWand, 0);
MagickSetImageType($compositeWand, MW_TrueColorMatteType);
//seting the opacity level
MagickEvaluateImage($compositeWand, MW_SubtractEvaluateOperator, $opacity, MW_OpacityChannel) ;
//combining the images
@MagickCompositeImage($sourceWand, $compositeWand, MW_ScreenCompositeOp, 0, 0);
//print out the image
MagickWriteImage( $sourceWand, 'new_image.jpg' );
//header("Content-Type: image/jpeg");
//MagickEchoImageBlob($sourceWand);
}
?>
at
03:14
1 comments
labels: php
Your website should look professional, be available all the time, and
be written to SELL so that you get some business out of it!
We can help you do it the right way - the way that gets results!
Below are some website development costs.
Initial Consultation - FREE!
* You can show us what you want, and we will suggest ways to do it
properly.
o How to take great pictures.
o How to write text that sells.
o How to save money in domain hosting and name registration.
o Then, you can decide whether you want us to help you.
o If you don't know anything about the Internet or marketing, we
will explain things in layman's terms, not in "tecky" terms!
Contact us.
Prices are approximate because of many variables. How
fast do you need it? How much development needs to be done? Who is going to
supply the text and photos? Don't forget that promotion of your website is as
important as having a website. In our opinion, there is little use for a
website that no one visits. We want to see your website succeed as much as
you do! Having visitors coming to your website in a buying mood - that is
what we want to happen for your website.
Website development costs:
Basic Package - $380
* 1 page, approximately 300 words
(Note: you provide the text)
* Your contact information
* 1 email link, 6 links within website, 6 links outside of website
* Your logo (provided by you in .jpg or .gif format)*
* 2 photos (provided by you in .jpg format)**
* Free tracker installed on website.
Contact us.
Bronze Package - $790
* 2 - 5 pages, approximately 300 words per page
.
(Note: you provide the text)
* Your full contact information
.
* Up to 5 email links, 12 links within website, 12 links outside of
website
.
* Your logo (provided by you in .jpg or .gif format) on all pages*
.
* Up to 10 photos (provided by you in .jpg format)**.
* Free tracker installed on website.
Contact us.
Promotion Package - $999
* For those who presently have a website, but it is not drawing
traffic. You need qualified visitors - ones that are in a buying mood
for your product or service.
* People searching on the web are looking for your product or service.
Have your website show at the top of the search engine results pile!
* Analysis of present log files, if any.
* Website pages optimized for search engines and directories
(including Meta Tags, Image Tags, and keyword "loading" of up to 6
pages).
* Locating suitable reciprocal linking websites - minimum 15
but we suggest 30.
(including finding appropriate websites, sending requests and answering
emails, and putting links with descriptions on site).
Example
* Hand submitting to top 10 free major search engines and
directories
(Google, Yahoo, MSN, HotBot, Lycos, Canada, etc. - package does not include
submission to search engines that charge for listings)***
Contact us.
Hosting
* Basic hosting starts at $12/month. We used to recommend a
cheaper hosting service, for about $5/month, but we found that they were
unreliable - a fair number of times the website would not be viewable.
You want 99% reliability, with fast connections, full backup in case of
power failure, daily backup of data, and other critical items.
Read more about hosting.
Maintenance/Promotion - $90/month
* Your website will be professionally watched over.
* Continuous promotion - resubmission to search engines if needed.
* We will answer your questions about or respond to link requests.
* You can have changes done easily.
Click here for more
* Your website will look fresh - put your press releases on, etc.
* We will answer requests for reciprocal links, if appropriate.
* We will be available to answer your questions.
* Up to 1.5 hours per month, not compounding.
* Note: price may vary with complexity of website.
Website Link-Building
* Reciprocal linking will increase your website
visitor numbers from other websites.
* Reciprocal linking will raise your profile
on the major search engines.
* Having other websites linked to yours will
benefit your traffic for years.
* 30 other websites linked to your site -
approximately $450 (depends on certain criteria).
Hourly rate
for website development costs:
* $60/hour (USD)
* Basically, we charge for our time. We have the
proper tools and experience to get your job done quickly and
professionally. We are a home-based business with low overheads. We
constantly keep up on the latest methods of promotion, as well as
purchasing tools (programs) that help us do our job faster and more
effectively - to your benefit. We have been in the website development
business since 2000. Call us
today. Toll free in North America 1- 866-726-0788.
* How do our prices compare to other
companies?
Master level Web Development costs from $75-120/hr.
Custom Graphics costs $65-$75/hr.
On-Site Digital Photography costs $80+/hr.
Maintenance Contracts are negotiated for around $55-$75/hr.
Web Design Consulting costs $100-$300/hr.
Some companies cost $95 - $120/hr. across the board.
Setting up a Link Directory - we charge about $12/link. Here's
the competition's rate (taken from this web page:
http://www.simplywebhosting.com/websitemanagement.shtml
Advertising and Marketing Services
Price
Custom reciprocal link directory with 100
targeted reciprocal links $3000 per directory
Additional reciprocal links added to an
existing reciprocal link directory $20 per link
at
21:08
0
comments
labels: Blogged
at
13:54
0
comments
labels: linux
1. File selection: to select which file you want to plot
##############################
Public i As Integer
Sub FileSelect()
' File dialog to select files
'==============================
Dim fd As filedialog
Set fd = Application.filedialog(msoFileDialogFilePicker)
'Declare a variable to contain the path
'of each selected item. Even though the path is aString,
'the variable must be a Variant because For Each...Next
'routines only work with Variants and Objects.
Dim vrtSelectedItem As Variant
ActiveSheet.Cells.Clear
With fd
If .Show = -1 Then
i = 1
For Each vrtSelectedItem In .SelectedItems
Cells(i, 1).Value = vrtSelectedItem
i = i + 1
Next vrtSelectedItem
Else 'The user pressed Cancel.
End If
End With
'Set the object variable to Nothing.
Set fd = Nothing
' Sort the file list as Ascending, otherwise it will be sorted by selecting sequence
'==================================
ActiveWorkbook.Worksheets("Sheet1").Sort.SortFields.Clear
ActiveWorkbook.Worksheets("Sheet1").Sort.SortFields.Add Key:=Range("A1"), _
SortOn:=xlSortOnValues, Order:=xlAscending, DataOption:=xlSortNormal
With ActiveWorkbook.Worksheets("Sheet1").Sort
.SetRange Range("A:A")
.Header = xlNo
.MatchCase = False
.Orientation = xlTopToBottom
.SortMethod = xlPinYin
.Apply
End With
End Sub
2. Main module: to re-arrange the data, format them then plot it.
##############################
Sub Main()
' Initialization
'=================
Dim LastCell As String
Dim wb_1 As Object
Dim ws_3 As Worksheet
Dim ws_plot As Worksheet
Dim FileName As String
Dim R_last As Integer
Set wb_1 = ActiveWorkbook
Set ws_3 = wb_1.Sheets(3)
Set ws_plot = wb_1.Sheets(2)
wb_1.Sheets(1).Activate
' Call the files inserted in worksheet(1), and variable i is public var, declared in module 2.
'=================================
Dim j As Integer
j = 1
R_last = 1
For j = 1 To i - 1
FileName = wb_1.Sheets(1).Cells(j, 1).Value
Call doloop(FileName, R_last, wb_1, ws_3, ws_plot)
Next j
' Delete some useless rows for plotting
'=========================================
Dim k, R_plot As Integer
For k = 2 To R_last
If Left(Cells(k, 1).Value, 1) = ":" Then
Range(Cells(k, 1), Cells(k + 3, 1)).EntireRow.Select
Selection.Delete Shift:=xlUp
R_plot = k - 1
End If
Next k
' Plot the chart
'=================
Dim xyRange, ErrAmount As String
xyRange = "A3:A" & R_plot & "," & "C3:C" & R_plot
ErrAmount = "=" & ws_plot.Name & "!N4:" & "N" & R_plot
ws_plot.Activate
ActiveSheet.Shapes.AddChart.Select
ActiveChart.SetSourceData Source:=Range(xyRange), PlotBy:=xlColumns
ActiveChart.ChartType = xlLine
With ActiveChart.SeriesCollection(1)
.ErrorBar Direction:=xlY, Include:=xlBoth, Type:=xlCustom, Amount:=ErrAmount, MinusValues:=ErrAmount
End With
End Sub
Function doloop(FileName As String, ByRef R_last As Integer, ByRef wb_1 As Object, ByRef ws_3 As Worksheet, ByRef ws_plot As Worksheet)
Dim wb As Object
Dim PosC, R_Str, C_Str As String
Dim R, C As Integer
' Open the text file and copy contents
'=======================================
Workbooks.OpenText FileName:=FileName, Origin:=936, StartRow:=1, DataType:=xlDelimited, TextQualifier:=xlDoubleQuote, Tab:=True
ActiveSheet.Cells.SpecialCells(xlCellTypeLastCell).Select
LastCell = Selection.Address(RowAbsolute:=True, ReferenceStyle:=xlR1C1)
PosC = InStrRev(LastCell, "C")
R_Str = Right(Left(LastCell, PosC - 1), Len(Left(LastCell, PosC - 1)) - 1)
C_Str = Right(LastCell, Len(LastCell) - PosC)
R = CInt(R_Str) ' total number of rows
C = CInt(C_Str) ' total number of columns
Range(Cells(1, 1), Cells(R, C)).Select
Selection.Copy
Set wb = ActiveSheet.Parent
ws_3.Activate
With ws_3
.Cells(R_last, 1).Activate
.Paste
End With
Application.CutCopyMode = False
wb.Close SaveChanges:=False
R_last = R_last + R
' Move the Standard Deviation part to the right side
'=====================================================
ws_3.Activate
Range(Cells(R_last - R, 1), Cells(R_last - R + R / 2 - 1, C)).Select
Selection.Copy
ws_plot.Activate
With ActiveSheet
.Cells((R_last - R - 1) / 2 + 1, 1).Activate
.Paste
End With
ws_3.Activate
Range(Cells(R_last - R + R / 2, 1), Cells(R_last - 1, C)).Select
Selection.Copy
ws_plot.Activate
With ActiveSheet
.Cells((R_last - R - 1) / 2 + 1, C + 2).Activate
.Paste
End With
End Function
at
12:17
0
comments
labels: excel
at
17:41
0
comments
labels: howto
PackageKit only checks once per the update interval, by default once every day.
It does not check on every desktop login.
You can change this behaviour by changing
/apps/gnome-packagekit/force_
at
21:27
0
comments
stardict主页中文字典
http://stardict.sourceforge.net/Dictionaries_zh_CN.php星际译王的巴比伦词库 http://reciteword.sourceforge.net/stardict/babylon.php
StarDict Lingvo Dictionaries http://reciteword.sourceforge.net/stardict/lingvo.php
金山词霸词库http://reciteword.sourceforge.net/stardict/powerword.php
下载tarball包,用7-zip解压,然后把dict.dz改为dict.gz再用7-zip解压,得到dict文件,然后把dict 和idx这两个文件拷到~/Library/weDict 即1.1.3为/var/mobile/Library/weDict 1.1.3以前为/var/root/Library/weDict/
安装正常后,应该为同名的两个文件 dict和idx,运行后会生成第三个同名文件idxc. 如果没有这个目录,而是在Library下有一个 weDict文件的话,请删除这个文件,重新安装。
推荐手动安装,使用winscp(windows)或 fugu(mac).
5.真人发音如何安装?
下载地址为:http://prdownloads.sourceforge.n … TS.tar.bz2?download
安装路径为 ~/Library/weDict下载后将解压好的 WyabdcRealPeopleTTS目录通过winscp(windows)或fugu(mac)上传到安装目录。
只支持单词发音,不支持词组发音。没有声音的话,请确认手机不是在振动模式。
6. 1.0.2运行不了v0.8?
从目前情况来看,好像是运行不了,我的版本的是1.1.1,没有在102上测 。哪位老大愿意帮忙测一下的话,按以下步骤,把错误信息发给我。
6.1 iphone安装好openssh,weDict 0.8及相应字典。
6.2 putty联接到iphone运行如下命令:cd /Applications/weDict.app
./weDict
6.3 把错误信息发给我laoren@office.weiphone.com
7. 1.1.3查本地单词死机?
不是死机,是因为权限的问题。用ziphone破解的1.1.3后安装的installer的所有者还是root,所以建立的 /var/mobile/Library/weDict的目录仍为 root所有,而weDict用户权限为mobile, 当查询时,因为权限问题,没有办法建立缓存文件,所以很慢。解决办法:chown -R mobile:mobile /var/mobile/Library/weDict
可以用putty联上运行,也可以在iphone上安装mobileTerminal运行。
at
10:48
0
comments
labels: iphone
[global]
usershare owner only = False
workgroup = workgroup
server string = %h server (Samba, Ubuntu)
dns proxy = no
log file = /var/log/samba/log.%m
max log size = 1000
syslog = 0
panic action = /usr/share/samba/panic-action %d
encrypt passwords = no
passdb backend = tdbsam
obey pam restrictions = yes
unix password sync = yes
passwd program = /usr/bin/passwd %u
passwd chat = *Enter\snew\s*\spassword:* %n\n *Retype\snew\s*\spassword:* %n\n *password\supdated\ssuccessfully* .
pam password change = yes
map to guest = bad user
usershare allow guests = yes
security = share
[printers]
comment = All Printers
browseable = no
path = /var/spool/samba
printable = yes
create mask = 0700
[print$]
comment = Printer Drivers
path = /var/lib/samba/printers
[test]
path = /home/cross/test
writeable = yes
; browseable = yes
guest ok = yes
at
17:30
0
comments
at
17:06
0
comments
at
00:07
0
comments
I really don't know how many people will switch between more than 2 input methods, while imsettings, as a project, just provide such a function.
This is useless to me, and costing almost 7m memory when booting up fedora.
This is the solution to stop it, and still keeping scim in your system.
Put 'DISABLE_IMSETTINGS=true' in the first line of '/etc/X11/xinit/xinitrc.d/50-xinput.sh'.
###############################################################################
IMSettings
==============
IMSettings is a framework that delivers Input Method
settings and applies the changes immediately. so it will
takes an effect without restarting applications and the
desktop.
Background
==============
Input Method is used to input some dozens of characters that
can't be represented with ASCII characters, with some
framework such as XIM and SCIM via GTK+/Qt
immodule. particularly which to handle languages that is a
bit complex to do the same thing with the keyboard layout
such as XKB. In the past, those frameworks has been applied
through the environment variables, such as XMODIFIERS and
GTK_IM_MODULE. and can't be influenced immediately and can't
be without restarting the desktop because of its nature -
it's being inherited from the parent process unless it's
being brought up with the obvious thing from the terminal
say. Also, there are no such framework to bring up the
necessary process at the run time - of course anyone could
runs it manually though, it's totally out of focus on this
project.
Features
============
* Provide the information of Input Method through IMSettings
* Provide the DBus service to start/stop process of Input
Method
* Provide the way to apply Input Method to applications
immediately
Scope
=========
IMSettings may helps when:
* you may want to disable Input Method entirely to use
features on any applications, which actually can't use
with Input Method because of the key conflicting.
* you may try another Input Method without closing current
desktop session.
* someone may wants to borrow your desktop temporarily,
which uses different Input Method.
* the appropriate Input Methods needs to be installed by
default regardless of you use, such as Live image.
Supported Toolkits
======================
* GTK+ (with GConf backend)
* Xfce (with GConf backend and a plugin for xfce-mcs-manager)
* X (with IMSettings XIM server; require libgxim)
Information files for Input Method
======================================
To make Input Methods available from IMSettings, every Input
Methods that hopes so has to have the information file to
let IMSettings know. those files is usually put under a
directory where you can change the default value with
--with-xinputdir. the filename has to contain .conf or
something that you can also change the default value with
--with-xinput-suffix to avoid listing every Input Methods
that might not work for some languages. Input Methods
doesn't support multiple languages such as XIM doesn't have
to have .conf suffix or so. xim.conf can deals with such
configuration files properly for appropriate languages
according to current locale.
Available parameters
=======================
The following parameters can be described as the shell
environment variables like FOO=BAR in the information file.
* AUXILIARY_PROGRAM=
An optional program that may want to bring up for Input
Method, such as the panel and the toolbar and so on.
* AUXILIARY_ARGS=
A list of command line options for AUXILIARY_PROGRAM.
* GTK_IM_MODULE=
GTK+ immodule name that want to use.
* ICON=
An icon file to use in GUI.
* IMSETTINGS_IGNORE_ME=
A parameter to hide Input Method from the inventory. you
however can still take an action against such Input Method
via IMSettings.
* LONG_DESC=
An optional long description to explain what this Input
Method is.
* PREFERENCE_PROGRAM=
An optional program that set up Input Method. IMSettings
itself do nothing on this parameter. but other tools, such
as im-chooser will take an action for that.
* PREFERENCE_ARGS=
A list of command line options for PREFERENCE_PROGRAM.
* QT_IM_MODULE=
Qt immodule name that want to use.
* SHORT_DESC=
An optional short description to explain what this Input
Method is. this variable is also sued for the key to do
something on IMSettings. e.g. to start/stop Input Method
and get the information and so on. so this parameter has
to be unique.
* XIM=
This variable is used for XIM. actually it looks like
XMODIFIERS=@im=$XIM.
* XIM_PROGRAM=
A XIM server be brought up to communicate through XIM
protocol.
* XIM_ARGS=
A list of command line options for XIM_PROGRAM.
Other variables used in xinput.sh
====================================
* DISABLE_IMSETTINGS=
If you want to disable imsettings feature entirely, set true. you'll
miss the feature able to change IM on demand but just need to reboot
or restart the desktop after changing something.
* IMSETTINGS_DISABLE_DESKTOP_CHECK=
If your desktop has XSETTINGS manager support and you're sure it also
supports imsettings, please file a bug to imsettings. and set true
temporarily to ignore checking the desktop.
Processes
============
* im-settings-daemon
A DBus service that provide a facility to start/stop IM processes.
* im-info-daemon
A DBus service that provide Input Method information.
* gconf-im-settings-daemon
A DBus service that provide a bridge to communicate GTK+ through GConf.
* imsettings-xim
A XIM bridge between client applications and real XIM server.
* imsettings-applet
An applet that provides a facility of changing IM temporarily. this also
supports XIM bridge. if imsettings-xim is running, this applet will sends
a signal to be terminated.
at
15:34
0
comments
there are two type of share,
1) traditional way, GUI: system-config-samba.
2) nautilus-share, right click the folder you want to share, which is default in ubuntu. this need a line 'usershare owner only = False' to put into the global section in smb.conf, sometimes, 'usershare allow guests = yes' is also needed. This is working on the command of 'net usershare'.
1) system-config-samba will modify smb.conf; while 2) nautilus-share, using 'net usershare' will not change smb.conf. So these are different ways for sharing.
In Ubuntu, no matter what method you use, both works fine. But fedora, so far, only 1) works, while 2) always saying "'net usershare' returned error 255: net usershare: usershares are currently disabled".
at
12:57
1 comments
labels: bug
import java.lang
proc=java.lang.Runtime.getRuntime().exec("c:\\app.exe") // this app.exe is compiled from c
br=java.io.BufferedReader(java.io.InputStreamReader(proc.getInputStream()))
print br.readLine()
java.lang.System.out.println("last line")
=========================
Why not using os.popen() from python, is because there is a bug about calling popen. :)
at
16:36
0
comments
at
03:13
0
comments
python 可以用popen调用一个c语言的可执行程序。但是效率如何呢?
1)一个c程序: 调用一个循环求和从1到1000的function 10000次。
之所以要调用循环求和从1到1000,是因为这个function要声称另外的一个可执行文件供python调用,所以外部框架c和python都差不多,就是要往复调用这个function,以得出python与c的沟通效率。
#######################
/*
* File: newmain.c
* Author: cross
*
* Created on 26 November 2008, 16:08
*/
#include <stdio.h>
#include <stdlib.h>
struct timeb {
time_t time;
unsigned short millitm;
short timezone;
short dstflag;
};
//ftime returns a struct with above structure.
int internal_loop(){
int ii=0,ss=0;
while (ii<1000)
{
ss+=ii;
ii++;
}
printf("%i\n",ss);
return ss;
}
int main(int argc, char** argv) {
struct timeb t1,t2;
double i=0,s=0;
ftime(&t1);
int repeat = 10000;
while(i<repeat){
s+=internal_loop();
i++;
}
ftime(&t2);
printf("%.1f\n",s);
printf("time = %ld.%d\n",t1.time,t1.millitm);
printf("time = %ld.%d\n",t2.time,t2.millitm);
return (EXIT_SUCCESS);
}
##################
2)以上的internal_loop function被单独生成一个c的可执行文件b.o,供python调用。以下是python代码。
##################
import datetime
import os
t1= datetime.datetime.now()
j=0
k=1000
for i in range(1,k):
printed=os.popen('/home/cross/NetBeansProjects/Application_2/b.o')
printed.readlines()
printed.close()
print # to print a new line
t2= datetime.datetime.now()
tstr=[(t2-t1).seconds,(t2-t1).microseconds] # the attributes of timedelta class: senconds and microseconds, from http://docs.python.org/lib/datetime-timedelta.html#l2h-602
print 'Repeated sum of 1-1000 ',k,' times : '
print tstr
###############
3) 只用python单独完成和1)一样的过程,python代码如下:
########################
import datetime
t1= datetime.datetime.now()
k=10000
for i in range(1,k):
j=0
for ii in range(1,1000):
j=j+ii
print j
print # to print a new line
t2= datetime.datetime.now()
tstr=[(t2-t1).seconds,(t2-t1).microseconds] # the attributes of timedelta class: senconds and microseconds, from http://docs.python.org/lib/datetime-timedelta.html#l2h-602
print 'Repeated sum of 1-1000 ',k,' times : '
print tstr
#####################
总结
如果成功运行以上两个程序,同样是运行10000次,1)耗时274毫秒;2)20秒。
可见python与其他程序通过popen这种字符沟通的效率是比较低的。以上,1)是同一个程序调用一个子函数,速度当然是最理想的。而2)是通过console的字符交换得以沟通,这种效率当然低,甚至这还远不如主程序和子程序的沟通效率。
通过1)和3)的比较,可以很容易看出来python的语法简单,但是python比c慢也是事实,3)用时3.8秒。
at
18:28
0
comments
Calling c (or other programs) from python
1. swig (to generate a python extention from c)
2. dl, python object (to call c shared library)
3. os.popen() (to call other exetuable programs)
In this example, I will use the 3rd method.
1) c program.
This is an example from netbeans, it can print all the arguments, argv[0] is the program name.
# args.c ###################################
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
int main(int argc, char**argv) {
int i;
// Prints arguments
printf("Arguments:\n");
for (i = 0; i < argc; i++) {
printf("%i: %s\n", i, argv[i]);
}
return 0;
}
#############################
####
gcc args.c -o a.out
####
2) python script
# in python script ################
import os
printed = os.popen('./a.o hello world')
>>> printed.readline()
'Arguments:\n'
>>> printed.readline()
'0: ./a.o\n'
>>> printed.readline()
'1: hello\n'
>>> printed.readline()
'2: world\n'
>>> printed.readline()
''
##################################
Here printed is an python array object, all the methods for array are available.
at
15:29
0
comments
指针变量在定义中允许带初始化项。如:
int i, *ip=&i;
注意, 这里是用&i 对ip初始化, 而不是对*ip初始化。和一般变量一样,对于外部或静态指针变量在定义中若不带初始化项, 指针变量被初始化为NULL, 它的值为0。 Turbo C中规定, 当指针值为零时, 指针不指向任何有效数据, 有时也称指针为空指针。
int i=200, x;
int *ip;
我们定义了两个整型变量i,x,还定义了一个指向整型数的指针变量ip。i,x中可存放整数,而ip中只能存放整型变量的地址。我们可以把i的地址赋给ip:
ip=&i;
此时指针变量ip指向整型变量i.
字符指针
char *cp;
于是可用:
cp=a string;
使cp指向字符串常量中的第0号字符a, 如图所示。
CP----- | a | | s | t | r | i | n | g | \0|
以后我们可通过cp来访问这一存贮区域, 如*cp或cp[0]就是字符a,而cp[i]或*(cp+i)就相当于字符串的第i号字符,但企图通过指针来修改字符串常量的行为是没有意义的。
而char *Names[]表示指向字符的指针数组。
Turbo C中,数组名是数组的第0号元素的地址,因此下面两个语句是等价的
p=&a[0];
p=a;
根据地址运算规则,a+1为a[1]的地址,a+i就为a[i]的地址。
下面我们用指针给出数组元素的地址和内容的几种表示形式:
(1). p+i和a+i均表示a[i]的地址, 或者讲,它们均指向数组第i号元素, 即指向a[i]。
(2). *(p+i)和*(a+i)都表示p+i和a+i所指对象的内容,即为a[i]。
(3). 指向数组元素的指针, 也可以表示成数组的形式,也就是说,它允许指针变量带下标, 如p[i]与*(p+i)等价。
对于二维数组:
我们把a[0],a[1],a[2]看成是一维数组名,可以认为它们分别代表它们所对应的数组的首地址,也就是讲,a[0]代表第 0 行中第 0 列元素的地址,即&a[0][0], a[1]是第1行中第0列元素的地址,即&a[1][0],根据地址运算规则,a[0]+1即代表第0 行第1列元素的地址,即&a[0][1],一般而言,a[i]+j即代表第i行第j列元素的地址, 即&a[i][j]。
另外,在二维数组中,我们还可用指针的形式来表示各元素的地址。如前所述,a[0]与*(a+0)等价,a[1]与*(a+1)等价,因此a[i]+j就与*(a+i)+j等价,它表示数组元素a[i][j]的地址。
因此,二维数组元素a[i][j]可表示成*(a[i]+j)或*(*(a+i)+j),它们都与a[i][j]等价,或者还可写成(*(a+i))[j]。
在Turbo C中, 可定义如下的指针变量:
int (*p)[3];
指针p为指向一个由3个元素所组成的整型数组指针。在定义中,圆括号是不能少的, 否则它是指针数组, 这将在后面介绍。
指针数组
int *a[10];
定义了一个指针数组,数组中的每个元素都是指向整型量的指针,该数组由10个元素组成,即 a[0],a[1],a[2], ..., a[9],它们均为指针变量。a为该指针数组名,和数组一样,a是常量,不能对它进行增量运算。a为指针数组元素a[0]的地址,a+i为a[i]的地址,*a就是a[0],*(a+i)就是a[i]。
指针函数
当一个函数声明其返回值为一个指针时,实际上就是返回一个地址给调用函数,以用于需要指针或地址的表达式中。
格式:
类型说明符 * 函数名(参数)
当然了,由于返回的是一个地址,所以类型说明符一般都是int。
例如:int *GetDate();
函数指针
指向函数的指针包含了函数的地址,可以通过它来调用函数。声明格式如下:
类型说明符 (*函数名)(参数)
其实这里不能称为函数名,应该叫做指针的变量名。这个特殊的指针指向一个返回整型值的函数。指针的声明笔削和它指向函数的声明保持一致。
指针名和指针运算符外面的括号改变了默认的运算符优先级。如果没有圆括号,就变成了一个返回整型指针的函数的原型声明。
例如:
void (*fptr)();
把函数的地址赋值给函数指针,可以采用下面两种形式:
fptr=&Function;
fptr=Function;
取地址运算符&不是必需的,因为单单一个函数标识符就标号表示了它的地址,如果是函数调用,还必须包含一个圆括号括起来的参数表。
可以采用如下两种方式来通过指针调用函数:
x=(*fptr)();
x=fptr();
第二种格式看上去和函数调用无异。但是有些程序员倾向于使用第一种格式,因为它明确指出是通过指针而非函数名来调用函数的。
指针的指针
指针的指针看上去有些令人费解。它们的声明有两个星号。例如:
char ** cp;
如果有三个星号,那就是指针的指针的指针,四个星号就是指针的指针的指针的指针,依次类推。当你熟悉了简单的例子以后,就可以应付复杂的情况了。当然,实际程序中,一般也只用到二级指针,三个星号不常见,更别说四个星号了。
指针的指针需要用到指针的地址。
char c='A';
char *p=&c;
char **cp=&p;
利用指针的指针可以允许被调用函数修改局部指针变量和处理指针数组。
void FindCredit(int **);
main()
{
int vals[]={7,6,5,-4,3,2,1,0};
int *fp=vals;
FindCredit(&fp);
printf(%d\n,*fp);
}
void FindCredit(int ** fpp)
{
while(**fpp!=0)
if(**fpp<0)>
=====================
char *Names[]=
{
"Bill",
"Sam",
"Jim",
"Paul",
"Charles",
0
};
main()
{
char **nm=Names; /* nm是一个2维字符数组 */
while(*nm!=0) printf("%s\n",*nm++); /* *nm是指针,以确定指针指向非null */
/* 对于字符数组,数组名虽然是指针,但是也可以表示整个数组指向的字符串。反而“*数组名“却返回错误Segmentation fault。*/
}
先用字符型指针数组Names的地址来初始化指针nm。每次printf()的调用都首先传递指针nm指向的字符型指针,然后对nm进行自增运算使其指向数组的下一个元素(还是指针)。注意完成上述认为的语法为*nm++,它首先取得指针指向的内容,然后使指针自增。
注意数组中的最后一个元素被初始化为0,while循环以次来判断是否到了数组末尾。具有零值的指针常常被用做循环数组的终止符。程序员称零值指针为空指针(NULL)。
at
19:52
0
comments
labels: C/C++
int main ( int argc, char **argv ){}
int main ( int argc, char *argv ) {}
Quote:
An array of char pointers can be represented as a function parameter one of two ways: char *name[] or char **name. I have chosen to use the latter, you can use either one, it is a matter of style, which I refuse to dictate
#####################
In the code you quoted, the former is correct, the latter is wrong. (But since this is C, both main functions should return 0.)
Under certain circumstances, an array decays to a pointer to its first element. In that way, char **argv and char *argv[] are equivalent.
#####################
char *argv .. u r sending a pointer to a char as an argument..this can be a normal pointer or point to a array of chars...
char **argv .. u r sending a pointer to an array of pointers as an argument . which means, each element of this array can itself point to a char array..
at
18:09
0
comments
labels: C/C++
To use /proc/sys/vm/drop_caches, just echo a number to it.
To free pagecache:
# echo 1 > /proc/sys/vm/drop_caches
To free dentries and inodes:
# echo 2 > /proc/sys/vm/drop_caches
To free pagecache, dentries and inodes:
# echo 3 > /proc/sys/vm/drop_caches
As this is a non-destructive operation and dirty objects are not freeable, run sync first!
Here are the before and after results from my desktop:
# free
total used free shared buffers cached
Mem: 2074840 1656052 418788 0 140108 907920
-/+ buffers/cache: 608024 1466816
Swap: 3911816 76436 3835380
# sync ; echo 3 > /proc/sys/vm/drop_caches ; free
total used free shared buffers cached
Mem: 2074840 698472 1376368 0 268 126488
-/+ buffers/cache: 571716 1503124
Swap: 3911816 76436 3835380
at
23:04
0
comments
labels: linux
How is a LEFT JOIN different from a normal join? First of all, the syntax is quite different and somewhat more complex. Besides looking different, the LEFT JOIN gives extra consideration to the table that is on the left.
Being "on the left" simply refers to the table that appears before the LEFT JOIN in our SQL statement. Nothing tricky about that.
This extra consideration to the left table can be thought of as special kind of preservation. Each item in the left table will show up in a MySQL result, even if there isn't a match with the other table that it is being joined to.
Here are the tables we used in the previous Mysql Joins lesson.
Position | Age |
---|---|
Dad | 41 |
Mom | 45 |
Daughter | 17 |
Dog |
Meal | Position |
---|---|
Steak | Dad |
Salad | Mom |
Spinach Soup | |
Tacos | Dad |
We executed a simple query that selected all meals that were liked by a family member with this simple join query:
SELECT food.Meal, family.Position
FROM family, food
WHERE food.Position = family.Position
When we decide to use a LEFT JOIN in the query instead, all the family members be listed, even if they do not have a favorite dish in our food table.
This is because a left join will preserve the records of the "left" table.
The code below is the exact same as the code in the previous lesson, except the LEFT JOIN has now been added to the query. Let's see if the results are what we expected.
// Make a MySQL Connection
// Construct our join query
$query = "SELECT family.Position, food.Meal "."FROM family LEFT JOIN food ".
"ON family.Position = food.Position";
$result = mysql_query($query) or die(mysql_error());
// Print out the contents of each row into a table
while($row = mysql_fetch_array($result)){
echo $row['Position']. " - ". $row['Meal'];
echo "
";
}
?>
Success! The LEFT JOIN preserved every family member, including those who don't yet have a favorite meal in the food table! Please feel free to play around with LEFT JOIN until you feel like you have a solid grasp of it. This stuff isn't easy!
Another example for 'JOIN', 'LEFT JOIN' and 'RIGHT JOIN' is here:
http://www.wellho.net/mouth/158_MySQL-LEFT-JOIN-and-RIGHT-JOIN-INNER-JOIN-and-OUTER-JOIN.html
at
18:58
0
comments
labels: mysql
Selecting a database:
mysql> USE database;
Listing databases:
mysql> SHOW DATABASES;
Listing tables in a db:
mysql> SHOW TABLES;
Describing the format of a table:
mysql> DESCRIBE table;
Creating a database:
mysql> CREATE DATABASE db_name;
Creating a table:
mysql> CREATE TABLE table_name (field1_name TYPE(SIZE), field2_name TYPE(SIZE));
Ex: mysql> CREATE TABLE pet (name VARCHAR(20), sex CHAR(1), birth DATE);
Load tab-delimited data into a table:
mysql> LOAD DATA LOCAL INFILE "infile.txt" INTO TABLE table_name;
(Use \n for NULL)
Inserting one row at a time:
mysql> INSERT INTO table_name VALUES ('MyName', 'MyOwner', '2002-08-31');
(Use NULL for NULL)
Retrieving information (general):
mysql> SELECT from_columns FROM table WHERE conditions;
All values: SELECT * FROM table;
Some values: SELECT * FROM table WHERE rec_name = "value";
Multiple critera: SELECT * FROM TABLE WHERE rec1 = "value1" AND rec2 = "value2";
Reloading a new data set into existing table:
mysql> SET AUTOCOMMIT=1; # used for quick recreation of table
mysql> DELETE FROM pet;
mysql> LOAD DATA LOCAL INFILE "infile.txt" INTO TABLE table;
Fixing all records with a certain value:
mysql> UPDATE table SET column_name = "new_value" WHERE record_name = "value";
Selecting specific columns:
mysql> SELECT column_name FROM table;
Retrieving unique output records:
mysql> SELECT DISTINCT column_name FROM table;
Sorting:
mysql> SELECT col1, col2 FROM table ORDER BY col2;
Backwards: SELECT col1, col2 FROM table ORDER BY col2 DESC;
Date calculations:
mysql> SELECT CURRENT_DATE, (YEAR(CURRENT_DATE)-YEAR(date_col)) AS time_diff [FROM table];
MONTH(some_date) extracts the month value and DAYOFMONTH() extracts day.
Pattern Matching:
mysql> SELECT * FROM table WHERE rec LIKE "blah%";
(% is wildcard - arbitrary # of chars)
Find 5-char values: SELECT * FROM table WHERE rec like "_____";
(_ is any single character)
Extended Regular Expression Matching:
mysql> SELECT * FROM table WHERE rec RLIKE "^b$";
(. for char, [...] for char class, * for 0 or more instances
^ for beginning, {n} for repeat n times, and $ for end)
(RLIKE or REGEXP)
To force case-sensitivity, use "REGEXP BINARY"
Counting Rows:
mysql> SELECT COUNT(*) FROM table;
Grouping with Counting:
mysql> SELECT owner, COUNT(*) FROM table GROUP BY owner;
(GROUP BY groups together all records for each 'owner')
Selecting from multiple tables:
(Example)
mysql> SELECT pet.name, comment FROM pet, event WHERE pet.name = event.name;
(You can join a table to itself to compare by using 'AS')
Currently selected database:
mysql> SELECT DATABASE();
Maximum value:
mysql> SELECT MAX(col_name) AS label FROM table;
Auto-incrementing rows:
mysql> CREATE TABLE table (number INT NOT NULL AUTO_INCREMENT, name CHAR(10) NOT NULL);
mysql> INSERT INTO table (name) VALUES ("tom"),("dick"),("harry");
Adding a column to an already-created table:
mysql> ALTER TABLE tbl ADD COLUMN [column_create syntax] AFTER col_name;
Removing a column:
mysql> ALTER TABLE tbl DROP COLUMN col;
(Full ALTER TABLE syntax available at mysql.com.)
Batch mode (feeding in a script):
# mysql -u user -p <> source batch_file;
Backing up a database with mysqldump:
# mysqldump --opt -u username -p database > database_backup.sql
(Use 'mysqldump --opt --all-databases > all_backup.sql' to backup everything.)
(More info at MySQL's docs.)
Join tables:
# SELECT * FROM cars JOIN colors ON colors.car_ID=cars.id
# SELECT * FROM cars AS cr JOIN colors AS cl ON cl.car_ID=cr.id
After the ON, we state on wich columns the tables should join. Every color has a reference to a car by the "car_ID" column. Every car has an
ID, and these two columns are the link between the two tables.
at
17:50
0
comments
in lyx, to replace the name of bibliography with reference, using report as document class
\renewcommand{\bibname}{References}
marked as TeX
==================================
\newcommand \renewcommand
\newcommand{cmd}[args][opt]{def}
\renewcommand{cmd}[args][opt]{def}
\providecommand{cmd}[args][opt]{def} -- LaTeX2e
These commands define (or redefine) a command.
* cmd The name of the new or redefined command. A \ followed by a string of lower and/or uppercase letters or a \ followed by a single nonletter. For \newcommand the name must not be already defined and must not begin with \end; for \renewcommand it must already be defined. The \providecommand command is identical to the \newcommand command if a command with this name does not exist; if it does already exist, the \providecommand does nothing and the old definition remains in effect.
* args An integer from 1 to 9 denoting the number of arguments of the command being defined. The default is for the command to have no arguments.
* opt (LaTeX2e only) If present, then the first of the number of arguments specified by args is optional with a default value of opt; if absent, then all of the arguments are required.
* def The text to be substituted for every occurrence of cmd; a parameter of the form #n in cmd is replaced by the text of the nth argument when this substitution takes place.
Examples
\newcommand{\water}{H$_2$O}
This would allow one to write, e.g.,
The formula for water is \water.
or
\water\ is the formula for water.
Note, in the second case, the trailing \ followed by a blank is required to ensure a blank space after the H2O; LaTeX ignores the blank following a command, so the space has to be specifically inserted with the \
As a second example consider
\newcommand{\hypotenuse}{$a^{2}+b^{2}$}
Note that this will produce the desired formula in text (paragraph) mode because of the $...$ in the definition. In math mode, however, the first $ in the definition will cause LaTeX to leave math mode, causing problems.
In LaTeX 2.09 a standard trick for getting around this is to put the math-mode expression in an \mbox, viz.,
\newcommand{\hypotenuse}{\mbox{$a^{2}+b^{2}$}}
In LaTeX2e the \ensuremath command has been provided to alleviate this problem. The argument of the \ensuremath command is always processed in math mode, regardless of the current mode. Using this mechanism the above could be written as
\newcommand{\hypotenuse}{\ensuremath{a^{2}+y^{2}}}
at
15:40
0
comments
labels: howto
From man:
-exec command ;
Execute command; true if 0 status is returned. All following arguments to find are taken to be arguments to the command until an argument consisting of `;' is encountered. The string `{}' is replaced by the current file name being processed everywhere it occurs in the arguments to the command, not just in arguments where it is alone, as in some versions of find. Both of these constructions might need to be escaped (with a `\') or quoted to protect them from expansion by the shell. The command is executed in the starting directory.
find . -type f -exec file '{}' \; # '{}' or {}, and there is a space before '\';
Runs ‘file’ on every file in or below the current directory. Notice
that the braces are enclosed in single quote marks to protect them from
interpretation as shell script punctuation. The semicolon is similarly
protected by the use of a backslash, though single quotes could have
been used in that case also.
-----------------------------------------------------------------
`{}' is replaced by the current file name being processed;
\ is used for the iteration of found files.
; is to tell -exec that the job is done.
Example: find . -exec grep 'title="Phoca Gallery"' {} \; -ls
Normally above example suits our search jobs.
at
13:50
0
comments
What is called 'orphan', and what is 'obsolete'? Fedora and Ubuntu give us contradictive and confusing definition.
Let's have a look here.
=========================================
Fedora:
"package-cleanup(1)"
--orphans
List installed packages which are not available from currenly configured repositories.
--leaves
List leaf nodes in the local RPM database. Leaf nodes are RPMs that are not relied upon by any other RPM.
=========================================
Ubuntu:
--'synaptic-status-installed(local or obsolete)'
Display only packages that are not (for longer) included in one of the specified repositories.
--"deborphan"
deborphan finds "orphaned" packages on your system. It determines which packages have no other packages depending on their installation and shows you a list of these packages.
=========================================
Accordingly, orphans(fedora)=obsolete(ubuntu), leaves(fedora)=orphan(ubuntu).
at
19:18
0
comments
labels: linux
# deb cdrom:[Ubuntu 9.04 _Jaunty Jackalope_ - Release i386 (20090420.1)]/ jaunty main restricted
# See http://help.ubuntu.com/community/UpgradeNotes for how to upgrade to
# newer versions of the distribution.
deb http://gb.archive.ubuntu.com/ubuntu/ jaunty main restricted
deb-src http://gb.archive.ubuntu.com/ubuntu/ jaunty main restricted
## Major bug fix updates produced after the final release of the
## distribution.
deb http://gb.archive.ubuntu.com/ubuntu/ jaunty-updates main restricted
# deb-src http://gb.archive.ubuntu.com/ubuntu/ jaunty-updates main restricted
## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu
## team. Also, please note that software in universe WILL NOT receive any
## review or updates from the Ubuntu security team.
deb http://gb.archive.ubuntu.com/ubuntu/ jaunty universe
# deb-src http://gb.archive.ubuntu.com/ubuntu/ jaunty universe
deb http://gb.archive.ubuntu.com/ubuntu/ jaunty-updates universe
# deb-src http://gb.archive.ubuntu.com/ubuntu/ jaunty-updates universe
## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu
## team, and may not be under a free licence. Please satisfy yourself as to
## your rights to use the software. Also, please note that software in
## multiverse WILL NOT receive any review or updates from the Ubuntu
## security team.
deb http://gb.archive.ubuntu.com/ubuntu/ jaunty multiverse
# deb-src http://gb.archive.ubuntu.com/ubuntu/ jaunty multiverse
deb http://gb.archive.ubuntu.com/ubuntu/ jaunty-updates multiverse
# deb-src http://gb.archive.ubuntu.com/ubuntu/ jaunty-updates multiverse
## Uncomment the following two lines to add software from the 'backports'
## repository.
## N.B. software from this repository may not have been tested as
## extensively as that contained in the main release, although it includes
## newer versions of some applications which may provide useful features.
## Also, please note that software in backports WILL NOT receive any review
## or updates from the Ubuntu security team.
deb http://gb.archive.ubuntu.com/ubuntu/ jaunty-backports main restricted universe multiverse
# deb-src http://gb.archive.ubuntu.com/ubuntu/ jaunty-backports main restricted universe multiverse
## Uncomment the following two lines to add software from Canonical's
## 'partner' repository.
## This software is not part of Ubuntu, but is offered by Canonical and the
## respective vendors as a service to Ubuntu users.
deb http://archive.canonical.com/ubuntu jaunty partner
# deb-src http://archive.canonical.com/ubuntu jaunty partner
deb http://security.ubuntu.com/ubuntu jaunty-security main restricted
# deb-src http://security.ubuntu.com/ubuntu jaunty-security main restricted
deb http://security.ubuntu.com/ubuntu jaunty-security universe
# deb-src http://security.ubuntu.com/ubuntu jaunty-security universe
deb http://security.ubuntu.com/ubuntu jaunty-security multiverse
# deb-src http://security.ubuntu.com/ubuntu jaunty-security multiverse
# ============================================================================
# latest (beta versions) versions:
# deb http://ppa.launchpad.net/fta/ubuntu intrepid main
# http://medibuntu.org/
# sudo wget http://www.medibuntu.org/sources.list.d/intrepid.list --output-document=/etc/apt/sources.list.d/medibuntu.list
# the public key:
# sudo apt-get update && sudo apt-get install medibuntu-keyring
# ==========================================
# Google
deb http://dl.google.com/linux/deb/ stable non-free
# wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | sudo apt-key add -
# Or goto http://www.google.com/linuxrepositories/apt.html to download the key, then install by using synaptic
# Wine
#sudo wget http://wine.budgetdedicated.com/apt/sources.list.d/hardy.list -O /etc/apt/sources.list.d/winehq.list
# wget -q http://wine.budgetdedicated.com/apt/387EE263.gpg -O- | sudo apt-key add -
# Miro
deb http://ftp.osuosl.org/pub/pculture.org/miro/linux/repositories/ubuntu jaunty/
# =========================
# PPA
# Firefox
deb http://ppa.launchpad.net/ubuntu-mozilla-daily/ppa/ubuntu jaunty main
# key: sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 247510BE
# Banshee
deb http://ppa.launchpad.net/banshee-team/ppa/ubuntu jaunty main
# key: sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 6E80C6B7
# Openoffice
deb http://ppa.launchpad.net/openoffice-pkgs/ppa/ubuntu jaunty main
# key: sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 247D1CFF
# Ubuntu-netbook-remix
deb http://ppa.launchpad.net/ubuntu-mobile/ppa/ubuntu jaunty main
# key: sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys C6598A30
# Ubuntu-tweak
deb http://ppa.launchpad.net/tualatrix/ppa/ubuntu jaunty main
deb-src http://ppa.launchpad.net/tualatrix/ppa/ubuntu jaunty main
# key: sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys E260F5B0
# for Mac users
deb http://ppa.launchpad.net/mactel-support/ppa/ubuntu jaunty main# key: sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 2B97B7B8
# chromium
deb http://ppa.launchpad.net/chromium-daily/ppa/ubuntu jaunty main
#key: sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 4E5E17B5
at
16:08
0
comments
labels: update
说话的声音,形态和招牌动作都模仿的很象,搞笑。
并且谁得到布什的支持,估计谁就没戏了。哈
at
15:02
0
comments
labels: Blogged
首次试录,简要介绍podcast。
用手机录的,试试效果。哈
original audio
at
17:34
1 comments
labels: ukpodcast
First you should decode the file to the raw format:
$ amrnb-decoder Sound1.amr Sound2.raw
which should produce something like this:
================================================== =================
TS 26.104
REL-5 V5.4.0 2004-03
REL-6 V6.1.0 2004-03
3GPP AMR Floating-point Speech Decoder
================================================== =================
Secondly, you can convert the resulting .raw file to other preferred format in Audacity.
In Audacity, using 'File->Import->Raw Data' to open the raw file by selecting 8000 as the sample rate.
at
14:33
0
comments
A little bit jealous of Mac users, because those stupid people have a smart itune.
Compared with clever us, linux users, we have to confront the bloody true world.
Here are my favorite music players. So far, none of them can be called perfect.
1. Rhythmbox 0.11.6
As a 'music' player supporting podcasting, for audio ones, it works very very well, just like itune, the episodes can be marked new or old. super!
And support Chinese characters.
But it can not do the right things of video podcast transferring to ipod, even though it can play video now using visualization.
2. Banshee 1.4
Almost can do everything, including video podcast transfering to ipod, and a sync button.
But 1) not support transferring music or videos with Chinese file name correctly. Yes, you can transfer them, but when you reconnect ipod, most of the songs in ipod can not be recognized. Maybe the database in ipod is destroyed by the Chinese characters; Except everytime you re-sync your music library in ipod.
And 2) Doesn't mark the item is new or listened. (compared with Rhythmbox and amarok)
3. Songbird 1.0
Great products and ideas from mozilla. In the current 0.70 version, the synchronaztion works. (add something to tell ipod the item is video, so ipod nano 3rd gen will not see and hear any video podcasts)
And support Chinese characters.
But it has same shortcoming with firefox 1) too much memory usage, because of internal web engine embeded. 2) Without new/old marks in Ipod. Also, 3) It can not watch folders, but this feature is coming in half of year, feb 2009. 4) Very weak functionality for podcasting.
4. Amarok
Mark new or old, video podcasting and transfering, supporint Chinese characters. Only missing the sync button, but it can add the new podcast episodes to a queue, which collects all the items are waiting for transferring to ipod.
But 1) No sync button, have to manually sync each playlist, transfer episode and delete old episodes. 2) Very odd KDE interface and menu, difficult to find the right place to show what's in ipod libary and how to transfer or sync.
at
16:53
2
comments
先放上一段英语学习的mp3来调试。很快就会有这个podcast的介绍。
original audio
at
14:22
0
comments
labels: ukpodcast
Paul Murphy, noted recently,
MacOS X is the no brainer option…[it] mostly just stays out of the way of knowledgeable users. In fact, for many it meets the IT ideal: it works so well, they don’t know it’s there or doing anything to help them - they just click and expect it to work; because, well, it just does.
When Linux can do that too (and Ubuntu brings us pretty close), it makes it ever harder to justify licensing Windows. Now if the educational software vendors can just become platform agnostic, I’ll be a happy camper.
at
10:44
0
comments
labels: Blogged
具体方法如下(只针对GBK/GB18030编码的情况):
安装Mutagen(ubuntu下终端运行 sudo apt-get install python-mutagen)后,在终端执行:
mid3iconv -e gbk *.mp3
find . -iname "*.mp3" -execdir mid3iconv -e gbk {} ;
at
10:11
0
comments
labels: howto
Install NFS Server Support
at the terminal type
sudo apt-get install nfs-kernel-server nfs-common portmap
(Optional: sudo dpkg-reconfigure portmap)
sudo /etc/init.d/portmap restart
Editing /etc/exports
the /etc/exports file is used for creating a share on the NFS server
invoke your favorite text editor or
sudo vi /etc/exports
Here are some quick examples of what you could add to your /etc/exports
For Full Read Write Permissions allowing any computer from 192.168.1.1 through 192.168.1.255
at
15:48
0
comments
Blogged from: http://mwcnews.net/content/view/9256/166/
at
17:12
0
comments
labels: Blogged
New features in Ubuntu 8.10:
at
16:37
0
comments
labels: linux
at
17:00
0
comments
labels: howto
at
15:09
0
comments
yum install bash-completionNow you will get the ability to use TAB to autocomplete your command and COMMAND OPTIONS.
at
01:53
0
comments
女王第二次与google‘合作’,上次是在youtuble上开设皇家频道。这次是以女王的头像的google的logo。
这个Royal Channel on YouTube 公布了 54个皇室的视频,已经被浏览160万次,如果女王自己也做一个blog的话,这个浏览量应该能给皇室带了更多的广告效益。2006年女王的演讲还被受准作为podcast发行。可见女王作为一个internet的使用者,已经走在了我们绝大多数人的前面,google以之作为logo,不足为怪。
但是在这个视频中,个人发现一点比较有趣的现象,主要负责接待的google高官,无一带领带,都是敞开西服上衣,里面衬衫领子,随意凌乱的自由状态。相比其他员工在女王来临之前的毕恭毕敬的联系打招呼,可以形成一个较为鲜明的对比。也许,这就是google的dressing code,或许,google在释放什么信息。哈。纯属个人理解。但是我还是比较喜欢这种风格,即便是面女女王这样的人物。
Google, well done.
at
19:03
0
comments
labels: life
To remove packages that has been installed as dependencies for the package you are removing if they are only needed for that particular package.
a yum plugin must be installed. Otherwise, yum doesn't provide the capability.
yum install yum-remove-with-leavesNow yum will automatically have the same function as apt-get autoremove.
at
23:38
0
comments
1. Find and review "lost" packages
You can find orphaned packages (ie packages not in the repositories anymore) with the toolpackage-cleanup
from theyum-utils
package:yum install yum-utils; package-cleanup --orphans
.
Old packages with a failing "%postun" script will remain partly
installed. Remove them with rpm -e package-name-and-version. It's often
helpful to run this command after the update, too.
at
03:39
0
comments
Wine中对话框默认的字体是Tahoma,在我们的LINUX上,Tahoma字体是无法正常显示中文的。比如Wine configuration中的"确定""取消"等就变成了"<<"">>"的字样。
解决方法很简单:
在wine的regedit中,找到:
\HKEY_LOCAL_MACHINE\Software\Microsoft\Windows NT\CurrentVersion\FontSubstitutes
方法1. 直接地将这个键设为空,问题就解决了。
方法2. 将MS Shell Dlg设置为一种自己字库中已有的中文字体即可,如果已经将windows中宋体取来使用了,字库中SimSun对应宋体(这是Windows的,LINUX下默认是没有的),在这里设置为 SimSun即可。
at
11:53
0
comments
at
11:21
0
comments
at
03:49
0
comments
at
12:15
0
comments
labels: Blogged
at
01:59
0
comments
1. Google Reader MP3 Player
Google Reader has an inbuilt MP3 player that is pretty much the same
as Gmail player but it also works on non-Google websites. This player
has volume controls, no Google branding and it auto-detects the
duration of the music file so your readers know how long the song will
last. Here’s a live example followed by the HTML embed code:
To use this MP3 player on your website or blog, copy-paste the
following code and replace the MP3_FILE_URL with the link to your MP3
file.
2. Yahoo! MP3 Player
If you think normal is boring, check this out. Yahoo! offer a code generator (Easy Listener) to help you create a Flash based MP3 player that matches your website color theme and layout. See example:
Though this Easy Listener MP3 player requires you to pass the
address of the web page that contains the MP3 file(s), you can directly
pass the MP3 link and it will work just fine. Supports auto play and
you can decide where the meta data associated with the MP3 file should
be displayed.
3. Yahoo! Media Player
If you maintain an MP3 blog or run a podcast and regularly link to
MP3 files, it makes little sense to embed a separate Flash player with
every MP3 file. I would therefore recommend using the Yahoo! Media Player that auto-detects links to MP3 files in your web pages and creates an embedded player for each link.
All you have to do is insert the following link in your blog
template and all MP3 hyperlinks will be converted into inline MP3
players. This also has the shuffle feature and visitors can easily skip
to any song in the playlist. Excellent stuff.
4. Odeo MP3 Player
Odeo offers a pretty impressive MP3 player (see example)
that works perfect in web pages as well as RSS readers but a small
issue is that Odeo Player requires you to type the exact duration of
the song in the embed code. You can skip this step but then the
progress bar won’t reflect the true status when you play the
song. And there are no volume controls.
To use Odeo MP3 player in your website, add the following code replacing MP3_FILE_URL and DURATION with relevant values.
<embed src= "http://www.odeo.com/flash/audio_player_standard_gray.swf" quality="high" width="300" height="52" allowScriptAccess="always" wmode="transparent" type="application/x-shockwave-flash" flashvars= "valid_sample_rate=true&external_url=[MP3 file address]" pluginspage="http://www.macromedia.com/go/getflashplayer"> </embed>Summary: With so many choices, how do you pick the right MP3 player for your website ?
at
14:44
0
comments
labels: howto