CentOS 5.5下搭建pptp VPN

(原文在 http://blog.renhao.org/2010/08/build-pptp-vpn-on-centos-5-5/comment-page-1/#comment-1682)很好用,一次就成功了,呵呵

前段时间想在自己的服务器上搭建个VPN,结果按照网上的很多方法弄下来却死活上不去。后来经过多次折腾,终于成功的架设了PPTP VPN。不敢保留,将这个经验分享出来,供自己今后参考的同时也能够让需要的朋友找到正确的安装方法。

Linux下常用的VPN服务有两个,一个是pptp,另一个则是openvpn。前者更简单一些,但是只有独立服务器和XEN VPS可以搭建;后者则没有任何限制。前者搭建出来的VPN,不需要特殊的VPN客户端,直接在Windows下创建VPN拨号连接即可;而后者需要安装一个客户端来进行拨号。

废话不说,下面我们就开始在CentOS 5.5下搭建pptp的VPN吧!本教程同样适用于CentOS 5.0~5.4的任意一个版本。 继续阅读“CentOS 5.5下搭建pptp VPN”

最近再搞点混响,没这么简单噢,呵呵。

音乐中音阶的划分是在频率的对数坐标(20×log)上取等分而得

相对响度也是 20log(x),都是以10为底数

 

幅度与音强

人耳对于声音细节的分辨只有在强度适中时才最灵敏。人的听觉响应与强度成对数关系。一般的人只能察觉出3 分贝的音强变化,再细分则没有太多意义。我们常用音量来描述音强,以分贝(dB=20log)为单位。在处理音频信号时,绝对强度可以放大,但其相对强度更有意义,一般用动态范围定义: 动态范围=20×log(信号的最大强度 / 信号的最小强度) (dB),它的动态范围就可以达到96分贝=20Log65536(6分贝/比特)

相对音强 = 20 log(数据),如果想让音强降低x db,即是:

20log(a)- 20log(b)= x;变化得:a/b = 10^(x/20), 再变化一下 a * 系数 = b; 系数 = 1/(10 ^ (x / 20)), 如果要升高或音强,只要乘以一个系数就可以了,而不是加上或减去一个值。

参考数据:

-2db 0.794

-3db 0.708

-20db 0.1

-25db 0.0562

-30db 0.0316

当低于0.01时,就很难很难听出效果了,呵呵。

根据native crash log 查找native出错代码

使用ndk,如果native crash,会打出一大堆带地址的出错信息,这里有一个很给力的python,来自于这个项目,很有用,可以还原回出错的行。

文件下载地址

项目地址在这里:https://code.google.com/p/android-ndk-stacktrace-analyzer/

使用方法如下:只需要三步,

1.得到so的asm文件,2.拿到crash log 3.使用这个脚本,ok 如下:

 

1.android-ndk/android-ndk-1.6_r1/build/prebuilt/linux-x86/arm-eabi-4.2.1/bin/arm-eabi-objdump -S mylib.so > mylib.asm

2.自己adb logcat 拷出来那一堆东西,保存

3.python parse_stack.py libslpi.asm logcat.txt

K歌引擎机型问题简述(坑爹啊!!!)

底层使用ffmpeg + lamemp3 使之能编码mp3.

1.当机器有点卡,导致播放的伴奏会卡。好了,这下就完蛋了,后面所有的都不同步了。

buffer调大就好了。

2.同时播放伴奏和录音,然后合成编码,发现不同步,录音偏慢。因为播放线程即audioTrack有个buffer,如果比较大的话,导致delay很明显。因为人是听到音乐然后开始跟着唱的,呵呵。

这时要让record线程休眠一段时间,这个时间就是填满player的buffer的时间。

3.绝大部分声音和伴奏同步,偶尔不同步,录音偏快,而且有延迟越来越大的趋势。这个是因为机器有点卡,或忙于做别的事情,这时record的buffer满了,而我们还没有来及取,就导致部分数据丢失,所以就导致人声越来越快。

record的buffer调大,整个线程优先级调高,呵呵。

4.moto me86等使用 tegra 2 的系列处理器点击会crash。

我操,这个超级坑爹!因为tegra2系统处理器虽然是arme-v7但是却不支持neon浮点运算库(这个是一个非常重要的可选项,绝大部分都支持)。。。尼玛。。。目前没有好的办法。。。只能单独为他发包了。。。

坑爹的 AudioRecorder 的 setPositionMarker

from stackOverFlow

太坑了。。。

My Android Java Application needs to record audio data into the RAM and process it. This is why I use the class “AudioRecord” and not the “MediaRecorder” (records only to file).

Till now, I used a busy loop polling with “read()” for the audio data. this has been working so far, but it peggs the CPU too much. Between two polls, I put the thread to sleep to avoid 100% CPU usage. However, this is not really a clean solution, since the time of the sleep is not guaranteed and you must subtract a security time in order not to loose audio snippets. This is not CPU optimal. I need as many free CPU cycles as possible for a parallel running thread.

Now I implemented the recording using the “OnRecordPositionUpdateListener”. This looks very promising and the right way to do it according the SDK Docs. Everything seems to work (opening the audio device, read()ing the data etc.) but the Listner is never called.

Does anybody know why?

Info: I am working with a real Device, not under the Emulator. The Recording using a Busy Loop basically works (however not satifiying). Only the Callback Listener is never called.

Here is a snippet from my Sourcecode:

 

public class myApplication extends Activity {

  /* audio recording */
  private static final int AUDIO_SAMPLE_FREQ = 16000;
  private static final int AUDIO_BUFFER_BYTESIZE = AUDIO_SAMPLE_FREQ * 2 * 3; // = 3000ms
  private static final int AUDIO_BUFFER_SAMPLEREAD_SIZE = AUDIO_SAMPLE_FREQ  / 10 * 2; // = 200ms

  private short[] mAudioBuffer = null; // audio buffer
  private int mSamplesRead; // how many samples are recently read
  private AudioRecord mAudioRecorder; // Audio Recorder

  ...

  private OnRecordPositionUpdateListener mRecordListener = new OnRecordPositionUpdateListener() {

    public void onPeriodicNotification(AudioRecord recorder) {
      mSamplesRead = recorder.read(mAudioBuffer, 0, AUDIO_BUFFER_SAMPLEREAD_SIZE);
      if (mSamplesRead > 0) {

        // do something here...

      }
    }

    public void onMarkerReached(AudioRecord recorder) {
      Error("What? Hu!? Where am I?");
    }
  };

  ...

  public void onCreate(Bundle savedInstanceState) {

  try {
      mAudioRecorder = new AudioRecord(
          android.media.MediaRecorder.AudioSource.MIC,
          AUDIO_SAMPLE_FREQ,
          AudioFormat.CHANNEL_CONFIGURATION_MONO,
          AudioFormat.ENCODING_PCM_16BIT,
          AUDIO_BUFFER_BYTESIZE);
    } catch (Exception e) {
      Error("Unable to init audio recording!");
    }

    mAudioBuffer = new short[AUDIO_BUFFER_SAMPLEREAD_SIZE];
    mAudioRecorder.setPositionNotificationPeriod(AUDIO_BUFFER_SAMPLEREAD_SIZE);
    mAudioRecorder.setRecordPositionUpdateListener(mRecordListener);
    mAudioRecorder.startRecording();

    /* test if I can read anything at all... (and yes, this here works!) */
    mSamplesRead = mAudioRecorder.read(mAudioBuffer, 0, AUDIO_BUFFER_SAMPLEREAD_SIZE);

  }
}

Answer:

I believe the problem is that you still need to do the read loop. If you setup callbacks, they will fire when you’ve read the number of frames that you specify for the callbacks. But you still need to do the reads. I’ve tried this and the callbacks get called just fine. Setting up a marker causes a callback when that number of frames has been read since the start of recording. In other words, you could set the marker far into the future, after many of your reads, and it will fire then. You can set the period to some bigger number of frames and that callback will fire every time that number of frames has been read. I think they do this so you can do low-level processing of the raw data in a tight loop, then every so often your callback can do summary-level processing. You could use the marker to make it easier to decide when to stop recording (instead of counting in the read loop).

 

 

终于为开源做了点贡献

http://code.google.com/p/drum-practice/

用scala写了个android小游戏,练习架子鼓的,希望能对大家有些帮助。总算了了一桩心劫。呵呵。虽然没多少人会看到,但总归是做了,问心无愧了。呵呵。

Android 截取圆形图片核心代码

好用,呵呵(http://www.eoeandroid.com/thread-103093-1-1.html)

 

int targetWidth = 100;
int targetHeight = 100;
Bitmap targetBitmap = Bitmap.createBitmap(
targetWidth,
targetHeight,
Bitmap.Config.ARGB_8888);
Canvas canvas = new Canvas(targetBitmap);
Path path = new Path();
path.addCircle(
((float)targetWidth - 1) / 2,
((float)targetHeight - 1) / 2,
(Math.min(((float)targetWidth), ((float)targetHeight)) / 2),
Path.Direction.CCW);
canvas.clipPath(path);
Bitmap sourceBitmap = BitmapFactory.decodeResource(
getResources(),
R.drawable.my_image);
canvas.drawBitmap(
sourceBitmap,
new Rect(0, 0, sourceBitmap.getWidth(), sourceBitmap.getHeight()),
new Rect(0, 0, targetWidth, targetHeight),
null);
ImageView imageView = (ImageView)findViewById(R.id.my_image_view);
imageView.setImageBitmap(targetBitmap);

 

 

vpn销售 架构

首页

帐号 注册登陆 

冲值,在线支付

后台,查看支付信息,已卖出vpn信息

vpn流量控制

vpn带宽限制

充值后自动生成帐号并启用程式。

 

恩,目前就这些,呵呵

scala with android!!! 终于成功了!!!我fuck!!!

 

相当的激动,哈哈,能用scala开发android了!!!哈哈。搞了两天啊!!!尼码。。。都怪android,每次tools更新ant都要改动,导致网上的2010年和2011年的文章都不能用。。。我fuck。。。还好找到一篇最近的。就是用最新的android tools作的! scala还是相当给力的!哈哈

原文在这里:

http://ricky.ez2.us/2012/04/25/%E4%BD%BF%E7%94%A8-scala-%E9%96%8B%E7%99%BC-android-%E7%9A%84%E7%92%B0%E5%A2%83%E5%BB%BA%E6%A7%8B/

非常给力!

 

自己做了一个更简单的,可以看俺的,原理跟上面一样,如下:

先在eclipse中新建android项目,加入scala的nature,然后下载这个文件,把文件夹afei_ant_android_scala中的所有东西解压到project根目录中,修改local.property文件,然后 ant debug 就行了!!!编译完的文件放在bin里头,给力!!!