異世界


2012年10月30日 星期二

C# MP3 Sound Capturing/Recording

文章來源: http://www.codeproject.com/Articles/31356/C-MP3-Sound-Capturing-Recording-Component

Mp3 Capture Sample Application

Introduction

It's surprising that there are no components for sound capturing in .NET Framework 3.5. Even designers of WPF and Silverlight 2.0 were focused on graphics so deeply, that they forgot about applications recording sound from user's microphone. It is said that the next version of Silverlight will provide such functionality.

However, what you often want to achieve is to store the recorded sound in MP3 file (or send it as MP3 stream). That's legally complicated due to MP3 patent constraints. And for the same legal reason, we can assume that we will not see MP3 functionality in Microsoft technologies soon (there is WMA instead).

Here you find an easy to use .NET 3.5 component, providing Sound Capturing functionality for a Windows application. It outputs data as raw PCM samples or a regular WAV file. Or you can just set one boolean property to use LAME DLL and perform MP3 compression on the fly.

This article uses a subset of C# MP3 Compressor libraries written by Idael Cardoso which in turn are partially based on A low level audio player in C# by Ianier Munoz. See this website for technical and copyright information regarding the LAME project.

Background

I chose Managed DirectX (MDX) 1.1 to capture sound. The MDX project is currently frozen since Microsoft moved to XNA Game Studio Express (a solution rather inadequate just for capturing bits of sound). MDX is descended by SlimDX Open Source project which exposes roughly similar interfaces and delegates to the nativeDirectSound libraries.

MDX comprises of .NET assemblies delegating calls to native DirectX DLLs of 2006. We expect DirectX in a version backward compatible with the 2006 interfaces to be installed on virtually every Windows computer (yes, also works on Vista).

The component captures sound via MDX from a sound card in raw PCM format. PCM format is a simple sequence of sound sample values. The samples can be 8bit (0..255) or 16bit (-32768..32767) each. Stereo sound is a sequence of pairs of samples (left, right, left, right...). PCM is a proper format for streaming of raw data. Streaming means passing data in small chunks while the total volume of the data may be unknown. Raw PCM is the most basic type of output of Mp3SoundCapture component. If you direct stream this format to a WAV file, you will not be able to play it as WAV file must additionally contain a RIFF header.

WAV (RIFF) format requires the raw PCM data to be prefixed with RIFF header, which apart from format information also contains information about the total length of the PCM data in the file. That's why you can't really stream RIFF data, as the total size of the stream is usually unknown. WAV (RIFF) format is the second type of output of the Mp3SoundCapture component. You can direct stream this format to a WAV file.

The third type of Mp3SoundCapture component output is MP3. A Bit rate (kbit/s) is a parameter which decides MP3 sound quality. Apart from that, the sound quality depends on the format of PCM data being compressed. Not every combination of the bit rate and sampling parameters is allowed. You can usher MP3 stream to an MP3 file.

Using the Code

Setting Up

From your application, add a reference to Istrib.Sound.Mp3.dll assembly (seeIstrib.Sound.Example.WinForms for example). MP3 compression also requires lame_enc.dll library to be located in binaries directory. Istrib.Sound.Mp3.dll assembly references Managed DirectX assemblies (located inDirectX subdirectory). The DirectX assemblies can be also installed in GAC via DirectX End-User Runtimesredistributable available for download at Microsoft site (here: Nov 2008 version).

If you experience "Loader Lock" warning while debugging your application, refer here for a workaround.

Istrib.Sound.Mp3.dll assembly contains a single component: Mp3SoundCapture. You may think of this component as of a sound recorder. You set up its properties prior to calling Start(...) and Stop() methods ("recorder buttons"). You provide a writable stream or a file path to each call to the Start method. Single instance of the component may capture sound many times to many streams/files one by one.

Component Construction

You may use Visual Studio Component Designer to drag and drop the Mp3SoundCapture component from the Visual Studio toolbox to the component surface or create the component manually:

Collapse | Copy Code

mp3SoundCapture = new Mp3SoundCapture();

The component is ready to use just after construction. The default output is MP3 128kbit/s sampled at 22kHz, 16bit, mono. You specify sampling parameters and output format by setting the component properties.

Capturing Device (e.g. A Microphone)

You may use a default Windows recording device:

Collapse | Copy Code

mp3SoundCapture.CaptureDevice = SoundCaptureDevice.Default;

Or choose one of the installed system sound capture devices:

Collapse | Copy Code

mp3SoundCapture.CaptureDevice = SoundCaptureDevice.AllAvailable.First();

Output Format

You set one of the 3 output types:


  • Mp3SoundCapture.Outputs.Mp3 - MP3 format
  • Mp3SoundCapture.Outputs.RawPcm - Raw sample data (without a RIFF header)
  • Mp3SoundCapture.Outputs.Wav - WAV file data (including the RIFF header)

Collapse | Copy Code

mp3SoundCapture.OutputType = Mp3SoundCapture.Outputs.Mp3;

Sampling Parameters

For PCM or WAV output, you may select any available sampling parameters supported by the sound card (PcmSoundFormat.StandardFormats):

Collapse | Copy Code

mp3SoundCapture.WaveFormat = PcmSoundFormat.StandardFormats.First();

... or if you wish to hardcode it:

Collapse | Copy Code

mp3SoundCapture.WaveFormat = PcmSoundFormat.Pcm22kHz16bitMono;

Sampling parameters for MP3 format are restricted to values returned byMp3SoundFormat.AllSourceFormats. Not every combination of the sampling parameters and bit rate is allowed. If you choose the bit rate prior to sampling parameters, then you may use Mp3BitRate.CompatibleSourceFormats property to list compatible values.

Collapse | Copy Code

mp3SoundCapture.WaveFormat = myMp3BitRate.CompatibleSourceFormats.First();
//Or: mp3SoundCapture.WaveFormat = Mp3SoundFormat.AllSourceFormats.First();

MP3 Bit Rate

For MP3 output format, you specify one of the available bit rates. Again - you cannot pair each bit rate with each sampling parameters. If you choose sampling parameters prior to bit rate, then you may usePcmSoundFormat.GetCompatibleMp3BitRates() extension method to enumerate through compatible MP3 bit rates.

Collapse | Copy Code

mp3SoundCapture.Mp3BitRate = myPcmSoundFormat.GetCompatibleMp3BitRates().First();
//Or mp3SoundCapture.Mp3BitRate = Mp3BitRate.AllValues.First();

... or if you wish to hardcode it:

Collapse | Copy Code

mp3SoundCapture.Mp3BitRate = Mp3BitRate.BitRate128;

Volume Normalization Option

Often when an application records and stores many pieces of sound, it is required to adjust their volume so that all of them were at similar volume level. The Mp3SoundCapture has the NormalizeVolume property at your disposal to perform this transformation for you. Setting true causes all recorded sound pieces to be normalized, i.e. volume of the most loud section of the piece will be turned up to the highest possible level and all other sections will be turned up proportionally.

Collapse | Copy Code

mp3SoundCapture.NormalizeVolume = true;

Note that the normalization algorithm must read the whole stream to find the loudest place, then rewrite the whole stream adjusting the volume of each sample. It means that the entire stream must be buffered before it is directed to the output. Mp3SoundCapture uses a temporary file to buffer the data when normalizing. MP3 compression, if applied, is done after the normalization. When you have recorded a sizeable piece of sound, the gross of processing takes place after calling Stop() met method, not on the fly (as it is whenNormalizeVolume is false). It may take time. Here Mp3SoundCapture offers an asynchronous stopping.

Capturing

To start capturing, just call Start(Stream) method passing an open, writable stream (you must close it yourself after capturing has stopped - not obvious when using asynchronous stopping). You may also callStart(string) method passing an output file name.

To stop capturing, just call the Stop() method.

Asynchronous Stop()

As mentioned above, when normalizing, it may take some time after calling Stop() before all captured data is written to the output stream. Mp3SoundCapture has an option of immediately leaving Capturing state and passing all buffer processing to a separate thread. You can start the next recording session not waiting for the last bytes of data from the previous one. By default, the asynchronous behavior is disabled. To enable it, set:

Collapse | Copy Code

mp3SoundCapture.WaitOnStop = false;

Note that you cannot close your output buffer passed to Start(Stream) method until aMp3SoundCapture.Stopped event is fired. Use Stopped event arguments to get the reference to the stream which is ready for closing or - if you used Start(string filePath) - a path of the file which has just been closed by Mp3SoundCapture:

Collapse | Copy Code

private void mp3SoundCapture_Stopped(object sender, Mp3SoundCapture.StoppedEventArgs e)
{
//Now the e.OutputFileName file is ready and contains all captured data
dataAvailableLbl.Text = "Data available in " + e.OutputFileName;
dataAvailableLbl.Visible = true;
}

Points of Interest


In some development environment configurations, you may get "Loader Lock" error (which is really a warning) while starting your application under the debugger. It's a well-known design issue in Managed DirectX. You may disable this error in Visual Studio debugger settings (most people do this without observable consequences). I preferred not to do this. Instead I found a workaround: if the project which references Istrib.Sound.Mp3.dll also explicitly references Managed DirectX assemblies (Microsoft.DirectX andMicrosoft.DirectX.DirectSound), then the warning is not raised. Otherwise the warning is shown by the debugger each time any assembly referencing Managed DirectX libraries is loaded into the Application Domain.

However - what I experienced - you cannot use Visual Studio Add Reference... wizard to add the DirectXGAC assembly reference. That's not an issue when you reference a local copy of DirectX assemblies (like in the example: DirectX subdirectory).

The workaround for the GAC problem is to add the reference to GAC assemblies manually editing your csproj file with a text editor:

Collapse | Copy Code

<ItemGroup>
...
<Reference Include="Microsoft.DirectX">
<Name>Microsoft.DirectX</Name>
</Reference>
<Reference Include="Microsoft.DirectX.DirectSound">

<Name>Microsoft.DirectX.DirectSound</Name>
</Reference>
...
</ItemGroup>

Visual Studio Add Reference... wizard generates identical XML except it includes full assembly version info. This should work as well... but it does not, at least on my machines.

2012年10月28日 星期日

MonoDevelop 3.0.4.7 for openSUSE

Packages for MonoDevelop 3.0.4.7 not yet available. The latest available version is MonoDevelop 3.0.4.6
openSUSE 11.4 : 1-click install

 

file : MonoDevelop.ymp


<metapackage xmlns:os="http://opensuse.org/Standards/One_Click_Install" xmlns="http://opensuse.org/Standards/One_Click_Install">
  <group>
    <name>MonoDevelop</name>
    <summary>MonoDevelop IDE</summary>
    <description>MonoDevelop is a free GNOME IDE primarily designed for C# and other .NET languages.</description>
    <repositories>
      <repository recommended="true">
        <name>Mono</name>
        <summary>Mono Project</summary>
        <description>.NET for Linux, Unix, and Windows

Packages Maintained by the Mono Project
</description>
        <url>http://download.opensuse.org/repositories/Mono/openSUSE_11.4/</url>
      </repository>
      <repository recommended="false">
        <name>openSUSE:11.4</name>
        <summary>The openSUSE 11.4 distribution</summary>
        <description>The openSUSE 11.4 distribution.

rpm and iso file downloads are disabled by intention, please use our
official released RCs from the download mirrors.
  </description>
        <url>http://download.opensuse.org/distribution/11.4/repo/oss/</url>
      </repository>
    </repositories>
    <software>
      <item>
        <name>monodevelop</name>
        <summary>A Full-Featured IDE for Mono and Gtk#</summary>
        <description>MonoDevelop is a full-featured integrated development
environment (IDE) for mono and Gtk#. It was originally a port of
SharpDevelop 0.98. See http://monodevelop.com/ for more information.</description>
      </item>
      <item>
        <name>monodevelop-debugger-gdb</name>
        <summary>GDB for MonoDevelop</summary>
        <description>GDB Debugger Addin for MonoDevelop.</description>
      </item>
      <item recommended="false">
        <name>monodevelop-java</name>
        <summary>Monodevelop Java Addin</summary>
        <description>Java language integration with MonoDevelop based on ikvm.</description>
      </item>
      <item recommended="false">
        <name>monodevelop-vala</name>
        <summary>Monodevelop Vala Addin</summary>
        <description>Vala language support for MonoDevelop.</description>
      </item>
      <item recommended="false">
        <name>monodevelop-database</name>
        <summary>Monodevelop Database Addin</summary>
        <description>Addin for MonoDevelop for an integrated database explorer and editor.</description>
      </item>
    </software>
  </group>
</metapackage>


image

image

Mono for openSUSE 11

 

Download Mono for openSUSE

    This distribution supports installing packages via Zypper. Add the following repository to Zypper:

    http://download.mono-project.com/download-stable/openSUSE_11.4

To add the repository, execute the following commands (as root):

zypper addrepo http://download.mono-project.com/download-stable/openSUSE_11.4 mono-stable
zypper refresh --repo mono-stable
zypper dist-upgrade --repo mono-stable





OS: OpenSUSE 12


Mono:  for OpenSUSE 11


安裝過程:


密碼:
linux-s11a:~ # zypper addrepo http://download.mono-project.com/download-stable/openSUSE_11.4 mono-stable
Adding repository 'mono-stable' ..........................................[done]
Repository 'mono-stable' successfully added
Enabled: Yes
Autorefresh: No
GPG check: Yes
URI: http://download.mono-project.com/download-stable/openSUSE_11.4


linux-s11a:~ # zypper refresh --repo mono-stable
Retrieving repository 'mono-stable' metadata --------------------------------[|]


New repository or package signing key received:
Key ID: 9E4071780505DE52
Key Name: Release Monkey (Mono Release Key) <release-manager@xamarin.com>
Key Fingerprint: A299B985E9B2B8A5972CED1C9E4071780505DE52
Key Created: Thu Aug 25 12:57:01 2011
Key Expires: (does not expire)
Repository: mono-stable


Do you want to reject the key, trust temporarily, or trust always? [r/t/a/?] (r): a
Retrieving repository 'mono-stable' metadata .............................[done]
Building repository 'mono-stable' cache ..................................[done]
Specified repositories have been refreshed.
linux-s11a:~ # zypper dist-upgrade --repo mono-stable
Loading repository data...
Reading installed packages...
Computing distribution upgrade...


Problem: nothing provides libtiff.so.3 needed by libgdiplus0-2.10-0.sle11.xamarin.i586
Solution 1: keep obsolete libgdiplus0-2.10-6.1.4.i586
Solution 2: break libgdiplus0-2.10-0.sle11.xamarin.i586 by ignoring some of its dependencies


Choose from above solutions by number or cancel [1/2/c] (c): ^Clinux-s11a:~ # zypper dist-upgrade --repo mono-stable
Loading repository data...
Reading installed packages...
Computing distribution upgrade...


Problem: nothing provides libtiff.so.3 needed by libgdiplus0-2.10-0.sle11.xamarin.i586
Solution 1: keep obsolete libgdiplus0-2.10-6.1.4.i586
Solution 2: break libgdiplus0-2.10-0.sle11.xamarin.i586 by ignoring some of its dependencies


Choose from above solutions by number or cancel [1/2/c] (c): 1
Resolving dependencies...
Computing distribution upgrade...


The following NEW packages are going to be installed:
  boo-2_0_9_4 ndesk-dbus ndesk-dbus-glib


The following packages are going to be REMOVED:
  banshee banshee-backend-engine-gstreamer banshee-backend-io-gio banshee-backend-platform-gnome banshee-backend-platform-unix banshee-core
  banshee-dmp banshee-dmp-apple-devices banshee-dmp-mtp banshee-extensions-default dbus-sharp-glib notify-sharp tomboy tomboy-lang


The following packages are going to be upgraded:
  apache2-mod_mono boo glade-sharp2 glib-sharp2 gnome-print-sharp gtk-sharp2 gtk-sharp2-complete gtk-sharp2-doc gtk-sharp2-gapi ikvm mono-basic
  mono-tools webkit-sharp xsp


The following packages are going to be downgraded:
  art-sharp2 gconf-sharp2 gnome-sharp2 gnome-vfs-sharp2 gtksourceview-sharp2 libmono-2_0-1 mono-addins mono-core mono-data mono-data-oracle
  mono-data-postgresql mono-data-sqlite mono-devel mono-extras mono-locale-extras mono-mvc mono-nunit mono-wcf mono-web mono-winforms monodevelop
  monodoc-core


The following packages are going to change vendor:
  apache2-mod_mono      openSUSE -> Novell, Inc.
  art-sharp2            openSUSE -> Novell, Inc.
  boo                   openSUSE -> Novell, Inc.
  gconf-sharp2          openSUSE -> Novell, Inc.
  glade-sharp2          openSUSE ->            
  glib-sharp2           openSUSE ->            
  gnome-print-sharp     openSUSE -> Novell, Inc.
  gnome-sharp2          openSUSE -> Novell, Inc.
  gnome-vfs-sharp2      openSUSE -> Novell, Inc.
  gtk-sharp2            openSUSE ->            
  gtk-sharp2-complete   openSUSE ->            
  gtk-sharp2-doc        openSUSE ->            
  gtk-sharp2-gapi       openSUSE ->            
  gtksourceview-sharp2  openSUSE -> Novell, Inc.
  ikvm                  openSUSE ->            
  libmono-2_0-1         openSUSE ->            
  mono-addins           openSUSE ->            
  mono-basic            openSUSE -> Novell, Inc.
  mono-core             openSUSE ->            
  mono-data             openSUSE ->            
  mono-data-oracle      openSUSE ->            
  mono-data-postgresql  openSUSE ->            
  mono-data-sqlite      openSUSE ->            
  mono-devel            openSUSE ->            
  mono-extras           openSUSE ->            
  mono-locale-extras    openSUSE ->            
  mono-mvc              openSUSE ->            
  mono-nunit            openSUSE ->            
  mono-tools            openSUSE -> Novell, Inc.
  mono-wcf              openSUSE ->            
  mono-web              openSUSE ->            
  mono-winforms         openSUSE ->            
  monodevelop           openSUSE -> Novell, Inc.
  monodoc-core          openSUSE ->            
  webkit-sharp          openSUSE -> Novell, Inc.
  xsp                   openSUSE -> Novell, Inc.



14 packages to upgrade, 22 to downgrade, 3 new, 14 to remove, 36  to change vendor.
Overall download size: 85.7 MiB. After the operation, additional 17.5 MiB will be used.
Continue? [y/n/?] (y): y
Retrieving package gtk-sharp2-doc-2.12.11-0.sle11.xamarin.i586                                                 (1/39),   2.5 MiB (  3.3 MiB unpacked)
Retrieving: gtk-sharp2-doc-2.12.11-0.sle11.xamarin.i586.rpm .....................................................................[done (305.7 KiB/s)]
Retrieving package libmono-2_0-1-2.10.6-0.xamarin.i586                                                         (2/39),   4.2 MiB ( 10.5 MiB unpacked)
Retrieving: libmono-2_0-1-2.10.6-0.xamarin.i586.rpm .............................................................................[done (386.5 KiB/s)]
Retrieving package mono-core-2.10.6-0.xamarin.i586                                                             (3/39),  25.4 MiB ( 73.0 MiB unpacked)
Retrieving: mono-core-2.10.6-0.xamarin.i586.rpm .................................................................................[done (473.6 KiB/s)]
Retrieving package ndesk-dbus-0.6.0-8.3.noarch                                                                 (4/39),  42.3 KiB ( 97.0 KiB unpacked)
Retrieving: ndesk-dbus-0.6.0-8.3.noarch.rpm ...................................................................................................[done]
Retrieving package boo-2_0_9_4-0.9.4.9-30.1.noarch                                                             (5/39), 451.8 KiB (  1.8 MiB unpacked)
Retrieving: boo-2_0_9_4-0.9.4.9-30.1.noarch.rpm ..................................................................................[done (36.6 KiB/s)]
Retrieving package mono-locale-extras-2.10.6-0.xamarin.i586                                                    (6/39), 412.5 KiB (  1.9 MiB unpacked)
Retrieving: mono-locale-extras-2.10.6-0.xamarin.i586.rpm ......................................................................................[done]
Retrieving package mono-data-2.10.6-0.xamarin.i586                                                             (7/39),   3.7 MiB ( 10.8 MiB unpacked)
Retrieving: mono-data-2.10.6-0.xamarin.i586.rpm .................................................................................[done (457.5 KiB/s)]
Retrieving package gtk-sharp2-gapi-2.12.11-0.sle11.xamarin.i586                                                (8/39), 168.7 KiB (  1.7 MiB unpacked)
Retrieving: gtk-sharp2-gapi-2.12.11-0.sle11.xamarin.i586.rpm .....................................................................[done (41.6 KiB/s)]
Retrieving package glib-sharp2-2.12.11-0.sle11.xamarin.i586                                                    (9/39),  83.9 KiB (177.3 KiB unpacked)
Retrieving: glib-sharp2-2.12.11-0.sle11.xamarin.i586.rpm ......................................................................................[done]
Retrieving package boo-0.9.4.9-30.1.noarch                                                                      (10/39),   4.4 KiB (    0 B unpacked)
Retrieving: boo-0.9.4.9-30.1.noarch.rpm .......................................................................................................[done]
Retrieving package mono-data-sqlite-2.10.6-0.xamarin.i586                                                     (11/39), 122.3 KiB (411.9 KiB unpacked)
Retrieving: mono-data-sqlite-2.10.6-0.xamarin.i586.rpm ........................................................................................[done]
Retrieving package mono-data-postgresql-2.10.6-0.xamarin.i586                                                 (12/39), 160.7 KiB (476.7 KiB unpacked)
Retrieving: mono-data-postgresql-2.10.6-0.xamarin.i586.rpm ....................................................................................[done]
Retrieving package mono-data-oracle-2.10.6-0.xamarin.i586                                                     (13/39), 153.6 KiB (479.1 KiB unpacked)
Retrieving: mono-data-oracle-2.10.6-0.xamarin.i586.rpm ........................................................................................[done]
Retrieving package gtk-sharp2-2.12.11-0.sle11.xamarin.i586                                                    (14/39),   1.2 MiB (  3.3 MiB unpacked)
Retrieving: gtk-sharp2-2.12.11-0.sle11.xamarin.i586.rpm .........................................................................[done (277.3 KiB/s)]
Retrieving package gnome-vfs-sharp2-2.24.2-1.11.i586                                                          (15/39),  74.5 KiB (356.8 KiB unpacked)
Retrieving: gnome-vfs-sharp2-2.24.2-1.11.i586.rpm .............................................................................................[done]
Retrieving package art-sharp2-2.24.2-1.11.i586                                                                (16/39),  28.1 KiB (112.8 KiB unpacked)
Retrieving: art-sharp2-2.24.2-1.11.i586.rpm ...................................................................................................[done]
Retrieving package mono-web-2.10.6-0.xamarin.i586                                                             (17/39),   3.6 MiB (  9.8 MiB unpacked)
Retrieving: mono-web-2.10.6-0.xamarin.i586.rpm ..................................................................................[done (470.4 KiB/s)]
Retrieving package webkit-sharp-0.3-14.1.noarch                                                               (18/39),  26.2 KiB ( 63.6 KiB unpacked)
Retrieving: webkit-sharp-0.3-14.1.noarch.rpm ..................................................................................................[done]
Retrieving package glade-sharp2-2.12.11-0.sle11.xamarin.i586                                                  (19/39),  35.6 KiB ( 72.8 KiB unpacked)
Retrieving: glade-sharp2-2.12.11-0.sle11.xamarin.i586.rpm .....................................................................................[done]
Retrieving package gnome-sharp2-2.24.2-1.11.i586                                                              (20/39), 121.6 KiB (600.2 KiB unpacked)
Retrieving: gnome-sharp2-2.24.2-1.11.i586.rpm .................................................................................................[done]
Retrieving package gnome-print-sharp-2.26.0-34.2.i586                                                         (21/39),  43.2 KiB (206.7 KiB unpacked)
Retrieving: gnome-print-sharp-2.26.0-34.2.i586.rpm ............................................................................................[done]
Retrieving package xsp-2.10.2-21.2.noarch                                                                     (22/39), 265.7 KiB (918.6 KiB unpacked)
Retrieving: xsp-2.10.2-21.2.noarch.rpm ........................................................................................................[done]
Retrieving package monodoc-core-2.10.6-0.xamarin.i586                                                         (23/39),   7.5 MiB ( 10.9 MiB unpacked)
Retrieving: monodoc-core-2.10.6-0.xamarin.i586.rpm ..............................................................................[done (449.4 KiB/s)]
Retrieving package mono-winforms-2.10.6-0.xamarin.i586                                                        (24/39),   3.9 MiB (  9.8 MiB unpacked)
Retrieving: mono-winforms-2.10.6-0.xamarin.i586.rpm .............................................................................[done (443.5 KiB/s)]
Retrieving package mono-nunit-2.10.6-0.xamarin.i586                                                           (25/39), 204.9 KiB (466.3 KiB unpacked)
Retrieving: mono-nunit-2.10.6-0.xamarin.i586.rpm .................................................................................[done (50.8 KiB/s)]
Retrieving package gtk-sharp2-complete-2.12.11-0.sle11.xamarin.i586                                             (26/39),   2.4 KiB (    0 B unpacked)
Retrieving: gtk-sharp2-complete-2.12.11-0.sle11.xamarin.i586.rpm ..............................................................................[done]
Retrieving package gconf-sharp2-2.24.2-1.11.i586                                                              (27/39),  29.3 KiB ( 77.0 KiB unpacked)
Retrieving: gconf-sharp2-2.24.2-1.11.i586.rpm .................................................................................................[done]
Retrieving package gtksourceview-sharp2-0.12-100.2.noarch                                                     (28/39),  65.4 KiB (161.8 KiB unpacked)
Retrieving: gtksourceview-sharp2-0.12-100.2.noarch.rpm ........................................................................................[done]
Retrieving package apache2-mod_mono-2.10-20.1.i586                                                            (29/39),  29.1 KiB ( 59.6 KiB unpacked)
Retrieving: apache2-mod_mono-2.10-20.1.i586.rpm ...............................................................................................[done]
Retrieving package mono-tools-2.10-35.9.noarch                                                                (30/39),   1.0 MiB (  2.6 MiB unpacked)
Retrieving: mono-tools-2.10-35.9.noarch.rpm .....................................................................................[done (346.3 KiB/s)]
Retrieving package mono-basic-2.10-31.10.noarch                                                               (31/39), 638.3 KiB (  2.8 MiB unpacked)
Retrieving: mono-basic-2.10-31.10.noarch.rpm ..................................................................................................[done]
Retrieving package ikvm-0.46.0.1-0.novell.noarch                                                              (32/39),  14.7 MiB ( 39.0 MiB unpacked)
Retrieving: ikvm-0.46.0.1-0.xamarin.noarch.rpm ..................................................................................[done (483.3 KiB/s)]
Retrieving package mono-extras-2.10.6-0.xamarin.i586                                                          (33/39), 969.2 KiB (  2.6 MiB unpacked)
Retrieving: mono-extras-2.10.6-0.xamarin.i586.rpm ...............................................................................[done (216.9 KiB/s)]
Retrieving package mono-mvc-2.10.6-0.xamarin.i586                                                             (34/39),   1.1 MiB (  3.6 MiB unpacked)
Retrieving: mono-mvc-2.10.6-0.xamarin.i586.rpm ..................................................................................[done (341.0 KiB/s)]
Retrieving package mono-devel-2.10.6-0.xamarin.i586                                                           (35/39),   5.3 MiB ( 13.8 MiB unpacked)
Retrieving: mono-devel-2.10.6-0.xamarin.i586.rpm ................................................................................[done (400.3 KiB/s)]
Retrieving package mono-wcf-2.10.6-0.xamarin.i586                                                             (36/39),   2.1 MiB (  5.8 MiB unpacked)
Retrieving: mono-wcf-2.10.6-0.xamarin.i586.rpm ..................................................................................[done (378.0 KiB/s)]
Retrieving package mono-addins-0.6.2-0.xamarin.noarch                                                         (37/39), 508.0 KiB (  1.2 MiB unpacked)
Retrieving: mono-addins-0.6.2-0.xamarin.noarch.rpm ..............................................................................[done (123.2 KiB/s)]
Retrieving package monodevelop-2.4.2-1.11.noarch                                                              (38/39),   5.0 MiB ( 19.7 MiB unpacked)
Retrieving: monodevelop-2.4.2-1.11.noarch.rpm ...................................................................................[done (425.0 KiB/s)]
Retrieving package ndesk-dbus-glib-0.4.1-8.2.noarch                                                           (39/39),   8.1 KiB ( 10.3 KiB unpacked)
Retrieving: ndesk-dbus-glib-0.4.1-8.2.noarch.rpm ..............................................................................................[done]
Removing tomboy-lang-1.10.2-2.1.2 .............................................................................................................[done]
Installing: gtk-sharp2-doc-2.12.11-0.sle11.xamarin ............................................................................................[done]
Installing: libmono-2_0-1-2.10.6-0.xamarin ....................................................................................................[done]
Installing: mono-core-2.10.6-0.xamarin ........................................................................................................[done]
Installing: ndesk-dbus-0.6.0-8.3 ..............................................................................................................[done]
Additional rpm output:
warning: /var/cache/zypp/packages/mono-stable/noarch/ndesk-dbus-0.6.0-8.3.noarch.rpm: Header V3 DSA/SHA1 Signature, key ID 7e2e3b05: NOKEY



Installing: boo-2_0_9_4-0.9.4.9-30.1 ..........................................................................................................[done]
Additional rpm output:
warning: /var/cache/zypp/packages/mono-stable/noarch/boo-2_0_9_4-0.9.4.9-30.1.noarch.rpm: Header V3 DSA/SHA1 Signature, key ID 7e2e3b05: NOKEY



Installing: mono-locale-extras-2.10.6-0.xamarin ...............................................................................................[done]
Installing: mono-data-2.10.6-0.xamarin ........................................................................................................[done]
Installing: gtk-sharp2-gapi-2.12.11-0.sle11.xamarin ...........................................................................................[done]
Installing: glib-sharp2-2.12.11-0.sle11.xamarin ...............................................................................................[done]
Installing: boo-0.9.4.9-30.1 ..................................................................................................................[done]
Additional rpm output:
warning: /var/cache/zypp/packages/mono-stable/noarch/boo-0.9.4.9-30.1.noarch.rpm: Header V3 DSA/SHA1 Signature, key ID 7e2e3b05: NOKEY



Installing: mono-data-sqlite-2.10.6-0.xamarin .................................................................................................[done]
Installing: mono-data-postgresql-2.10.6-0.xamarin .............................................................................................[done]
Installing: mono-data-oracle-2.10.6-0.xamarin .................................................................................................[done]
Installing: gtk-sharp2-2.12.11-0.sle11.xamarin ................................................................................................[done]
Removing banshee-dmp-mtp-2.4.1-2.1.3 ..........................................................................................................[done]
Removing banshee-dmp-apple-devices-2.4.1-2.1.3 ................................................................................................[done]
Removing banshee-2.4.1-2.1.3 ..................................................................................................................[done]
Installing: gnome-vfs-sharp2-2.24.2-1.11 ......................................................................................................[done]
Additional rpm output:
warning: /var/cache/zypp/packages/mono-stable/i586/gnome-vfs-sharp2-2.24.2-1.11.i586.rpm: Header V3 DSA/SHA1 Signature, key ID 7e2e3b05: NOKEY



Installing: art-sharp2-2.24.2-1.11 ............................................................................................................[done]
Additional rpm output:
warning: /var/cache/zypp/packages/mono-stable/i586/art-sharp2-2.24.2-1.11.i586.rpm: Header V3 DSA/SHA1 Signature, key ID 7e2e3b05: NOKEY



Installing: mono-web-2.10.6-0.xamarin .........................................................................................................[done]
Installing: webkit-sharp-0.3-14.1 .............................................................................................................[done]
Additional rpm output:
warning: /var/cache/zypp/packages/mono-stable/noarch/webkit-sharp-0.3-14.1.noarch.rpm: Header V3 DSA/SHA1 Signature, key ID 7e2e3b05: NOKEY



Installing: glade-sharp2-2.12.11-0.sle11.xamarin ..............................................................................................[done]
Installing: gnome-sharp2-2.24.2-1.11 ..........................................................................................................[done]
Additional rpm output:
warning: /var/cache/zypp/packages/mono-stable/i586/gnome-sharp2-2.24.2-1.11.i586.rpm: Header V3 DSA/SHA1 Signature, key ID 7e2e3b05: NOKEY



Installing: gnome-print-sharp-2.26.0-34.2 .....................................................................................................[done]
Additional rpm output:
warning: /var/cache/zypp/packages/mono-stable/i586/gnome-print-sharp-2.26.0-34.2.i586.rpm: Header V3 DSA/SHA1 Signature, key ID 7e2e3b05: NOKEY



Installing: xsp-2.10.2-21.2 ...................................................................................................................[done]
Additional rpm output:
warning: /var/cache/zypp/packages/mono-stable/noarch/xsp-2.10.2-21.2.noarch.rpm: Header V3 DSA/SHA1 Signature, key ID 7e2e3b05: NOKEY
Updating /etc/sysconfig/xsp2...
redirecting to systemctl



Installing: monodoc-core-2.10.6-0.xamarin .....................................................................................................[done]
Installing: mono-winforms-2.10.6-0.xamarin ....................................................................................................[done]
Installing: mono-nunit-2.10.6-0.xamarin .......................................................................................................[done]
Installing: gtk-sharp2-complete-2.12.11-0.sle11.xamarin .......................................................................................[done]
Installing: gconf-sharp2-2.24.2-1.11 ..........................................................................................................[done]
Additional rpm output:
warning: /var/cache/zypp/packages/mono-stable/i586/gconf-sharp2-2.24.2-1.11.i586.rpm: Header V3 DSA/SHA1 Signature, key ID 7e2e3b05: NOKEY



Removing banshee-backend-platform-gnome-2.4.1-2.1.3 ...........................................................................................[done]
Installing: gtksourceview-sharp2-0.12-100.2 ...................................................................................................[done]
Additional rpm output:
warning: /var/cache/zypp/packages/mono-stable/noarch/gtksourceview-sharp2-0.12-100.2.noarch.rpm: Header V3 DSA/SHA1 Signature, key ID 7e2e3b05: NOKEY



Installing: apache2-mod_mono-2.10-20.1 ........................................................................................................[done]
Additional rpm output:
warning: /var/cache/zypp/packages/mono-stable/i586/apache2-mod_mono-2.10-20.1.i586.rpm: Header V3 DSA/SHA1 Signature, key ID 7e2e3b05: NOKEY



Installing: mono-tools-2.10-35.9 ..............................................................................................................[done]
Additional rpm output:
warning: /var/cache/zypp/packages/mono-stable/noarch/mono-tools-2.10-35.9.noarch.rpm: Header V3 DSA/SHA1 Signature, key ID 7e2e3b05: NOKEY
grep: /etc/gre.d/*.conf: No such file or directory
Error: did not find one of the files in sources//usr/lib/monodoc/sources/gd2i
node `classlib-webkit' is not defined on the documentation map
Root:
Root: Assemblies
Root: Images
Root: Objects
Root: Strings
Root: Methods
Root: Classes
Root: Code Generation
Root: Decimal Representation
Root: Application Domains
Root: Dynamic Code Generation
Root: Exceptions
Root: GC Handles
Root: Garbage Collection
Root: Embedding Mono
Root: Just in Time Compiler
Root: Marshalling
Root: Metadata access
Root: Profiler
Root: Reflection
Root: Threading API
Root: Tracing
Root: JIT Counters
Root: Types
Root: Common Types
Root: Security API calls
Root: Portable Windows Layer
Root: Debugging API
Root: Utility Functions
Root: Unsorted
Documentation index updated



Installing: mono-basic-2.10-31.10 .............................................................................................................[done]
Additional rpm output:
warning: /var/cache/zypp/packages/mono-stable/noarch/mono-basic-2.10-31.10.noarch.rpm: Header V3 DSA/SHA1 Signature, key ID 7e2e3b05: NOKEY



Installing: ikvm-0.46.0.1-0.novell ............................................................................................................[done]
Installing: mono-extras-2.10.6-0.xamarin ......................................................................................................[done]
Installing: mono-mvc-2.10.6-0.xamarin .........................................................................................................[done]
Installing: mono-devel-2.10.6-0.xamarin .......................................................................................................[done]
Installing: mono-wcf-2.10.6-0.xamarin .........................................................................................................[done]
Installing: mono-addins-0.6.2-0.xamarin .......................................................................................................[done]
Removing tomboy-1.10.2-2.1.2 ..................................................................................................................[done]
Additional rpm output:
Unknown media type in type 'all/all'
Unknown media type in type 'all/allfiles'
Unknown media type in type 'uri/mms'
Unknown media type in type 'uri/mmst'
Unknown media type in type 'uri/mmsu'
Unknown media type in type 'uri/pnm'
Unknown media type in type 'uri/rtspt'
Unknown media type in type 'uri/rtspu'



Removing banshee-extensions-default-2.4.1-2.1.3 ...............................................................................................[done]
Additional rpm output:
Unknown media type in type 'all/all'
Unknown media type in type 'all/allfiles'
Unknown media type in type 'uri/mms'
Unknown media type in type 'uri/mmst'
Unknown media type in type 'uri/mmsu'
Unknown media type in type 'uri/pnm'
Unknown media type in type 'uri/rtspt'
Unknown media type in type 'uri/rtspu'



Removing banshee-dmp-2.4.1-2.1.3 ..............................................................................................................[done]
Removing notify-sharp-0.4.0.r3032-2.1.1 .......................................................................................................[done]
Removing banshee-backend-platform-unix-2.4.1-2.1.3 ............................................................................................[done]
Removing banshee-backend-io-gio-2.4.1-2.1.3 ...................................................................................................[done]
Removing banshee-backend-engine-gstreamer-2.4.1-2.1.3 .........................................................................................[done]
Removing banshee-core-2.4.1-2.1.3 .............................................................................................................[done]
Installing: monodevelop-2.4.2-1.11 ............................................................................................................[done]
Additional rpm output:
warning: /var/cache/zypp/packages/mono-stable/noarch/monodevelop-2.4.2-1.11.noarch.rpm: Header V3 DSA/SHA1 Signature, key ID 7e2e3b05: NOKEY


WARNING: SuSEconfig or requested SuSEconfig module not present!



WARNING: SuSEconfig or requested SuSEconfig module not present!


 


Installing: ndesk-dbus-glib-0.4.1-8.2 .........................................................................................................[done]
Additional rpm output:
warning: /var/cache/zypp/packages/mono-stable/noarch/ndesk-dbus-glib-0.4.1-8.2.noarch.rpm: Header V3 DSA/SHA1 Signature, key ID 7e2e3b05: NOKEY



There are some running programs that use files deleted by recent upgrade. You may wish to restart some of them. Run 'zypper ps' to list these programs.
linux-s11a:~ #

2012年10月27日 星期六

軟體開發‧技巧篇

含 [Linux] 標籤的文章 (共30筆)

 

資料來源: http://softdevtricks.funp.tw/?&postag=Linux&page=3


窺探 .bss section 

於4年4個月前收藏
拜 C 語言這種「披著高階語言羊皮的低階語言之狼」所賜,我們可探索記憶體位址背後的意義,也可從實驗觀察 GNU/Linux 中 ELF 格式執行檔裡頭 .bss section 的呈現,本文則針對「窺探」的手法作補充

系統程式 C

部落格 科技 電腦 軟體 程式設計 Linux 作業系統 C
funP網址:http://funp.com/t235947

以 C 語言實做 Functional Language 的 Currying 

於4年4個月前收藏
Functional Language 的 Currying 定義為「把接受多個參數的函數變換成接受一個單一參數的函數,並且返回接受餘下的參數而且返回結果的新函數的技術。」本文試著以 C 語言模擬出 Currying 的特性,語法層面較為接近 Lisp 與 Prolog

程式語言 C

部落格 程式設計 C 軟體 電腦 Linux
funP網址:http://funp.com/t235127

良葛格的 Blog:GTK 入門文件 

於4年4個月前收藏
初步寫的GTK入門文件。。。

API

科技 軟體 程式 程式設計 C語言 Ubuntu Linux gtk GUI 開放原始碼 open source 良葛格
funP網址:http://funp.com/t235562

良葛格的 Blog:GTK 的物件導向架構 

於4年4個月前收藏
C語言如何支援物件導向?來看看GTK怎麼作。。。XD

C

良葛格 科技 程式 程式設計 gtk OO 開放原始碼 object-oriented 物件導向 GUI C語言 Linux
funP網址:http://funp.com/t217669

以 ptrace 系統呼叫來追蹤/修改行程 

於4年5個月前收藏
在「快快樂樂學 GNU Debugger」演講,當時為了說明 GNU Debugger (gdb) 在 Linux 運作的原理,提及 ptrace 系統呼叫,這是何以 gdb 能行使動態追蹤、分析,進而修改執行中行程 (process) 的關鍵。本文試著以簡要的案例,說明如何使用 ptrace 系統呼叫,達到類似 gdb 的行為。

系統程式

部落格 科技 電腦 軟體 開放原始碼 自由軟體 Linux 程式設計
funP網址:http://funp.com/t200879

以 CMake 處理專案的多國語文翻譯 

於4年5個月前收藏
該如何將自由軟體界廣泛使用的 GNU gettext 整合到以 CMake 為建構系統的專案中,又該如何維護 po (原始的翻譯訊息) / gmo (為 GNU gettext 接受的編譯訊息) 檔案呢?

軟體工程

部落格 科技 電腦 開放原始碼 軟體 自由軟體 程式設計 Linux
funP網址:http://funp.com/t196566

LatencyTop:分析系統延遲的工具 

於4年6個月前收藏
如今,世界上幾乎沒有人可以完美地解釋 Linux kernel 每一行的功能與指出潛在的問題,更何況尚有一系列的系統軟體等著我們去處理,所以,如何以工具協助我們釐清問題,就是刻不容緩的議題。

系統程式

部落格 科技 電腦 Linux 開放原始碼 軟體 自由軟體 程式設計
funP網址:http://funp.com/t144566

【Python】[分享] Python optparse package (1) 

於5年2個月前收藏
optparse 是一個能夠讓程式設計人員輕鬆設計出簡單明瞭、易於使用、符合標準的 Unix 命令列程式的 Python 套件。開始學習 Python 之後,我常常會寫一些小程式來處理日常的工作;漸漸地,我發現無法處理參數的程式的彈性有限,於是就開始為我的程式加上解讀命令列參數的功能。在發現這個套件之前,我總是覺得解讀命令列不難,但是要做到像標準 Unix 命令那樣完善的使用者互動和錯誤處置,可就不是一件簡單的事了!發現這個套件,真是如獲至寶!從此不用再為解讀參數煩惱,可以更專注在解決問題上了!

教學 Python 電腦 系統管理 Linux 命令列 參數 科技
funP網址:http://funp.com/t17955

sshfs 在 Embedded Linux 開發的應用 

於5年9個月前收藏
Embedded Linux 開發上使用 SSH filesystem 取代過去 NFS mount 的方式,有許多好處:SSH 加密傳輸、port forwarding、較 NFS 更少的配置、預留 software debug 的可能性。

部落格 Linux 軟體開發 security 嵌入式系統 科技
funP網址:http://funp.com/t962

使用 GNU 工具作為軟體開發基本工具 

於5年10個月前收藏
這份簡報內容包含了 Linux/BSD 簡介、GNU 開發工具簡介、Linux 開發模式與其優勢等。簡報本身採用高橋流 Firefox XUL 格式,需要 Firefox 1.5+ 以播放。

部落格 GNU 程式設計 作業系統 Linux BSD 高橋流
funP網址:http://funp.com/t755

2012年10月13日 星期六

OpenOffice 教學網

 

一、教學影片:

OpenOffice安裝  (免安裝版2.01安裝版 標點符號 )

資料來源 : http://maylike.kh.edu.tw/teach/openoffice201/index.htm


二、軟體說明

  • Base簡介
當我們要分析處理的資料量較為龐大時,應用資料庫工具來管理與維護資料庫,就是最佳的選擇,而在自由軟體OpenOffice.org 中的Base就是一個功能完整的資料庫工具。
OpenOffice.org Base 與Microsoft Access類似,它可以方便使用者建立表單、報告、資料表、查詢、報表等,此外它更支援許多市面上熱門的資料庫軟體,如:Adabas D, ADO, Microsoft Access, MySQL,和通過工業標準的 ODBC 和 JDBC 驅動的數據庫,及以XML的格式進行輸出,並且還可以與OpenOffice.org其他軟體,如Writer及Calc搭配使用,讓我們在管理資料庫及進階辦公室應用時更加得心應手。

安裝下載

  • 官方網站
  • 下載連結

操作技巧

  • 基本操作
  • 進階應用
  • 常見問題

相關連結

  • 線上文件
  • 線上影音
  • 推薦連結
  • 部落格

 

資料來源 : http://wekey.westart.tw

C# 限制程式只執行一次

在 Program.cs 中 加入 RunningInstance()

static class Program
    {
        /// <summary>
        /// 應用程式的主要進入點。
        /// </summary>
        [STAThread]
        static void Main()
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
 
            if (!RunningInstance())
            {
                Application.Run(new Form1());
            }
        }
 
        public static bool RunningInstance()
        {
            //取得目前的程序
            System.Diagnostics.Process current = System.Diagnostics.Process.GetCurrentProcess();
            //取得其他同名稱的程序
            System.Diagnostics.Process[] processes = System.Diagnostics.Process.GetProcessesByName(current.ProcessName);
 
            foreach (System.Diagnostics.Process process in processes)
            {
                //判斷是不是目前的執行緒
                if (process.Id != current.Id)
                {
                    //確定一下是不是從同一個執行
                    if (System.Reflection.Assembly.GetExecutingAssembly().Location.Replace("/", "\\") == current.MainModule.FileName)
                    {
                        //找到~ 回傳 true
                        return true;
                    }
                }
            }
 
            //如果都沒有,則回傳 false
            return false;
        }
    }

 


資訊來源: http://www.programmer-club.com/showSameTitleN/csharp/2345.html