19 2012

迎接 Diablo 3的到来

分类目录: Zheclei @ 12:07 上午

还记得大学时在寝室一堆人拼命MF,6年过去了,现在Diablo 3来了。

你还在等什么呢!


29 2012

Linux Command

分类目录: Linuxheclei @ 11:30 下午

1.判断操作系统32位/64位:uname –p   或 getconf LONG_BIT

2.安装JVM

先从网上下载jdk(jdk-1_5_0_02-linux-i586.rpm) ,推荐SUN的官方网站www.sun.com,下载后放在/home目录中,当然其它地方也行。
进入安装目录
#cd /home
#cp jdk-1_5_0_02-linux-i586.rpm /usr/local
#cd /usr/local
给所有用户添加可执行的权限
#chmod +x jdk-1_5_0_02-linux-i586.rpm.bin
#./jdk-1_5_0_02-linux-i586.rpm.bin
此时会生成文件jdk-1_5_0_02-linux-i586.rpm,同样给所有用户添加可执行的权限
#chmod +x jdk-1_5_0_02-linux-i586.rpm
安装程序
#rpm -ivh jdk-1_5_0_02-linux-i586.rpm
出现安装协议等,按接受即可。

3.配置JVM

将环境变量加入到profile中,如果写入到(/etc/profile)对所有用户都生效,如果只对某个用户生效写入到(/home/username/profile)中

export JAVA_HOME = /usr/java/jdk1.5

export PATH = $PATH:$JAVA_HOME/bin:$JAVA_HOME/jre/bin

exportCLASSPATH=.:/usr/java/jdk1.5/lib:/usr/java/jdk1.5/jre/lib:$CLASSPATH

验证安装结果

[root@b java]# java -version

-bash: java: command not found

错误原因是环境变量未生效。

[root@b java]# source /etc/profile

[root@b java]# java –version

4.解压 tar -zxvf apache-tomcat-5.5.23.tar.gz

—————————————————————————–

1.获取86_64 Bit getconf LONG_BIT
2.chmod a+x
3.rpm -vih
4.tar xvfz ***.tar.gz
5.unzip ***.zip
6.ps -ef | grep cassandra
7.tail -f /usr/lib/cassandra/system.log (-f follow,监控)
8.ln -s source desc        unlink或rm删除
9.lsof -i:8080

10.chmod 770 /home/program
11.chgrp program /home/program

标签: ,


16 2011

NoSql Links 2011/08/16

分类目录: WEBheclei @ 11:35 下午

1.Rainbird 分布式实时统计系统

2.Cassandra简介

3.Cassandra

标签:


12 2011

C# Tip: Monitoring Clipboard Activity in C#

分类目录: winheclei @ 8:02 上午

C#监视剪贴板活动

转:http://www.developer.com/feedback.php/http:/www.developer.com/net/csharp/article.php/3359891

标签:


07 2011

Windows7 自定义右键菜单

分类目录: winheclei @ 11:13 下午

打开注册表文件

Win + R键,在运行中输入“regedit”打开注册表文件

定位到“HKEY_CLASSES_ROOT”节点

在目录上添加右键菜单

HKEY_CLASSES_ROOT\Directory\shell
添加项并双击修改default为右键菜单中显示的名称

image

在新建的项下建立“command”并修改default值为具体的执行语句
“cmd.exe /k cd %1”

image

在所有文件上添加右键菜单

HKEY_CLASSES_ROOT\AllFilesystemObjects\shell

步骤同目录方式

在指定后缀文件上添加右键菜单

HKEY_CLASSES_ROOT\*file\shell
* 号为文件的后缀,如css文件:cssfile,js文件:jsfile

步骤同目录方式

实际上HKEY_CLASSES_ROOT最上面有后缀名的default值对应,

例如:

1.css文件,HKEY_CLASSES_ROOT/.css的default值为CSSfile

2.js文件,HKEY_CLASSES_ROOT/.js的default值为JSfile

参考:

http://maketecheasier.com/customize-the-right-click-menu-in-windows-7-injecting-extra-features/2009/12/22

http://www.sevenforums.com/726207-post3.html

标签: , ,


17 2011

修改华为HG255D超级密码,改用原路由

分类目录: tutorialheclei @ 4:38 下午

一、描述

上海电信光纤改造一律统一给换了光猫和华为HG255D低端无线路由器,导致部分功能不能实现。

如果不需要IP TV功能可以直接使用原来自己的路由器。需要IP TV的获取telecomadmin密码后请阅读参考4

方法有二:

1.直接电话10000要账户密码,然后在以前的路由器中输入就可以了。

2.修改telecomadmin密码,查找账户密码。然后再输入到以前的路由器中。

下面介绍方法2

二、步骤

安装FireFox3的请直接阅读请阅读参考2

下面介绍使用Fiddler实现修改密码功能

1.下载地址http://www.getfiddler.com/dl/Fiddler2Setup.exe

2.安装

4.浏览器输入:http://192.168.1.1,用useradmin登录,密码在电信送到无线路由器底部。

5.点击“安全”-“广域网访问设置”

安全-广域网访问设置

6.双击启动Fiddler

启动Fiddler

7.选中“安全”-“广域网访问设置”(5图)中的“使能”,点击确定

8.在“Fiddler”中查找“http://192.168.1.1/html/security/set.cgi?RequestFile=html/security/urlfilter.asp”的链接

security/set.cgi

9.右键链接,鼠标点击“Unlock For Editing”

修改请求

10.删除 “Inspectors”中的“TextView”内容

编辑

修改为“InternetGatewayDevice.UserInterface.X_ATP_UserInfo.1.Userpassword=密码”

11.右键刚才选中的链接,鼠标点击“Unlock For Editing”,打把钩去掉

取消编辑状态

12.点击“Reissue”

重新发送请求

到此修改telecomadmin超级管理员密码成功

13.退出使用telecomadmin用户登录

14.选择“网络”-“宽带设置”

telecomadmin登录

15.鼠标选择中间部位,右键查看源文件,这是显示html源码

在源代码中搜索“var WanPPP”,在“var WanPPP”后面继续搜索“ad”,”ad”+数字开头的就是新登录帐户,后面一个自然就是密码了。

用户名密码

有了用户名密码一切都好办了吧!

三、结论

1.修改telecomadmin密码:InternetGatewayDevice.UserInterface.X_ATP_UserInfo.1.Userpassword=密码

2.华为是脆弱的

3.电信是万恶的

4.世界是自由的

四、参考

1.google

3.电信光纤进户FTTH华为HG255D无线路由器自定义配置(破解)


标签: , , ,


22 2011

FileUpload : Page Cannot be displayed and maximum request length exceeded error

分类目录: WEBheclei @ 10:17 下午

By default, ASP.NET permits only files that are 4,096 kilobytes (KB) or less to be uploaded to the Web server.  To upload larger files, we must change the maxRequestLength parameter of the <httpRuntime> section in the Web.config file. By default, the <httpRuntime> element is set to the following parameters in the Machine.config file:

<httpRuntime

executionTimeout=“90“

maxRequestLength=“4096“

useFullyQualifiedRedirectUrl=“false“

minFreeThreads=“8“

minLocalRequestFreeThreads=“4“

appRequestQueueLimit=“100“

/>

We can change the value of maxRequestLength to a desired value in our web.config of the application. For 10 mb we can set it to 10240 KB. Even in this case if user tries to upload a file with size more than 10 mb we than get the above “Page cannot be displayed error ” or the page simply hang up. In this case we can catch the error in the Application_Error event handler of the Global.asax file.

void Application_Error(object sender, EventArgs e)

{

if (System.IO.Path.GetFileName(Request.Path) == “Default.aspx”)

{

System.Exception appException = Server.GetLastError();

if (appException.InnerException.Message == “Maximum request length exceeded.”)

{

Server.ClearError();

Response.Write(“The form submission cannot be processed because it exceeded the maximum length allowed by the Web administrator. Please resubmit the form with less data.”);

Response.Write(“<BR><a href=’Default.aspx’>Click Here to go back to page</a> </BR>”);

Response.End();  } } }

I tried with the above code, but it isn’t consistent.

The best solution for this could be to set the value of maxRequestLength to a very high value.

and checking in the code for the size.

Say changing the value to say 700mb ( not sure what the maximum length of request could be)

<httpRuntime useFullyQualifiedRedirectUrl=“true“

maxRequestLength=“716800“

/>

And checking for the length in your code

// Putting the constraint of 1 mb

if (FileUpload1.FileContent.Length < 1024){

FileUpload1.SaveAs(@”C:/MyFolder/” + FileUpload1.FileName);}

else{

return;}

At least the above solution would save us from the page not displayed error.

And the last solution which i found was creating an httpmodule to intercept the web request.

using System;

using System.Collections.Generic;

using System.Text;

using System.Web;

namespace HAMModule{

public class MyModule : IHttpModule{

public void Init(HttpApplication app){

app.BeginRequest += new EventHandler(app_BeginRequest);

}

void app_BeginRequest(object sender, EventArgs e){

HttpContext context = ((HttpApplication)sender).Context;

// check for size if more than 4 mb

if (context.Request.ContentLength > 4096000){

IServiceProvider provider = (IServiceProvider)context;

HttpWorkerRequest wr = (HttpWorkerRequest)provider.GetService(typeof(HttpWorkerRequest));

// Check if body contains data

if (wr.HasEntityBody()){

// get the total body length

int requestLength = wr.GetTotalEntityBodyLength();

// Get the initial bytes loaded

int initialBytes = wr.GetPreloadedEntityBody().Length;

if (!wr.IsEntireEntityBodyIsPreloaded()){

byte[] buffer = new byte[512000];

// Set the received bytes to initial bytes before start reading

int receivedBytes = initialBytes;

while (requestLength – receivedBytes >= initialBytes){

// Read another set of bytes

initialBytes = wr.ReadEntityBody(buffer, buffer.Length);

// Update the received bytes

receivedBytes += initialBytes;

}

initialBytes = wr.ReadEntityBody(buffer, requestLength – receivedBytes);}}

// Redirect the user to an error page.

context.Response.Redirect(“Error.aspx”);}}

public void Dispose(){}

}}

and add the following information to web.config

<httpModules>

<add type=“HAMModule.MyModule“ name=“MyModule“/>

</httpModules>

inside

<system.web>

The last solution worked properly!!!!

BeginRequest event -The BeginRequest event signals the creation of any given new request. This event is always raised and is always the first event to occur during the processing of a request.

Article on creating a custom http module

http://msdn.microsoft.com/en-us/library/ms227673(VS.80).aspx

标签: ,


27 2011

on-screen keyboard类似输入法

分类目录: Z, winheclei @ 10:37 下午

skip to main | skip to sidebar
Yort on .NET
This is where ‘Yort’ praises, rants, raves and other wise talks nonsense about Microsoft .NET and Visual Studio. Or anything else related to software development or Microsoft that he feels like throwing in. It’s his blog after all…

Saturday, November 18, 2006
On-screen Keyboards
Recently, I wanted to create an on screen keyboard for use with our POS. Actually, I wanted a full keyboard for our ‘kiosk’ mode, and either a full keyboard or more likely a numeric keypad for the POS mode when running with a touch screen.

So, how do you create a virtual, on screen keyboard ? Creating a form/usercontrol with buttons or some other control(s) on it to represent the keyboard is relatively simple. What’s difficult is knowing where to send the key data when the control is clicked, because when you click on the virtual keyboard it tends to get focus, taking it away from the input field that needs the data.

Googling the problem I found several samples that simply raised an event from the on screen keyboard form/control, but that still leaves you with the issue of passing on the key data to some unknown edit field. Most of these samples assumed the keyboard control was either on the same form as the field receiving the key data, or that a reference to the control could be provided, which is fine if you only want to deal with forms within your own application, but sucks otherwise.

A few other samples worked by using API’s to obtain the handle of the control that currently has focus before the keyboard form/control is activated. When the buttons on the virtual keyboard are clicked, the key data is sent to the ‘remembered’ window handle and then the original window is refocused using API’s, or the window is refocused first and then SendKeys is used. This doesn’t work very well though. If the virtual keyboard window overlaps the client window then you get ‘flickering’ as the focus changes between the windows. Also it seems some key data just gets ‘lost’ if you hit buttons on the virtual keyboard quickly, although I’m not sure why.

In the end, thanks to two http://www.codeproject.com/ articles and another Google search, as well as some trial and error on my part, I managed to find the 3 magic things you must do to make an on screen keyboard work. These are;

Show your virtual keyboard form without ‘activation’, so it doesn’t get focus when the keyboard is shown.
Intercept the WM_MOUSEACTIVATE message and return MA_NOACTIVATE as the result.
Most important of all – you must NOT use controls that can get focus to represent your buttons.
The third point is the one that I missed for quite a while. Say you place a button control on your form for every ‘key’ on the virtual keyboard. You’ve overridden the WM_MOUSEACTIVATE event so clicking on the form won’t activate it – but you haven’t overridden the individual button control’s so they can still get focus, and when they do they will cause the parent form to be activated as well. If you use a label, picture box or some other control that can’t get focus though, then the form won’t get activated even when the control is clicked – which means you’re free to use SendKeys to pass on the keystrokes. This works exceedingly well, there is no flickering, and none of the keystrokes seem to get lost. Best yet, the code is relatively simple.
So, how exactly do you build the virtual keyboard ?
I recommend you grab a copy of FoxholeWilly’s keyboard control from CodeProject at http://www.codeproject.com/cs/miscctrl/touchscreenkeyboard.asp
This gives you a nice looking, resizable, keyboard. It also supports both alphabetical and QWERTY layouts, as well as a ‘kids’ version. It doesn’t have the Numeric Keypad like I wanted, but with a little image editing and some tweaking of the code it’s easy enough to add.
Unfortunately, this control doesn’t take care of points 1 and 2 from before, or actually pass on the key data for you. To do this, place the control on a host form and connect the control’s
UserKeyPressed event to an event handler. In that event handler place the following line of code;
SendKeys.Send(e.KeyboardKeyPressed);
Because FoxholeWilly’s control already provides a SendKeys formatted string as an event argument, that’s the only line of code needed to pass on the key data.
Now, to prevent the form receiving focus or being activated when it’s shown, simply override the CreateParams property on the host form, like this;
private const int WS_EX_NOACTIVATE = 0×08000000;

protected override CreateParams CreateParams
{
get
{
CreateParams createParams = base.CreateParams;
createParams.ExStyle = createParams.ExStyle & WS_EX_NOACTIVATE;
return createParams;
}
}
Finally, you need to prevent the form getting focus or being activated when it or the keyboard control are clicked on. This is as easy as adding the following code to the host form;
private const int WM_MOUSEACTIVATE = 0×0021;
private const int MA_NOACTIVATE = 0×0003;
protected override void WndProc(ref Message m)
{
//If we’re being activated because the mouse clicked on us…
if (m.Msg == WM_MOUSEACTIVATE)
{
//Then refuse to be activated, but allow the click event to pass through (don’t use MA_NOACTIVATEEAT)
m.Result = (IntPtr)MA_NOACTIVATE;
}
else
base.WndProc(ref m);
}
This code actually came from a comment posted by Dirk Moshage, on Randy More’s CodeProject article (http://www.codeproject.com/samples/onscreenkeyboard.asp) about creating an on screen keyboard. However, because Randy’s keyboard project uses button controls to represent the buttons on screen, most people found the above code didn’t work properly because the child windows (buttons) still got activated, and then activated the parent anyway. In our case, neither FoxholeWilly’s keyboard control or the picturebox it uses to show the keyboard can get focus, which means the WM_MOUSEACTIVATE code actually works the way it’s intended.
That’s all there is to it. Once you have your host form and control configured, you can run the project. Simply put keyboard focus in any control on any window, and use the mouse (or your touch screen) to click on your virtual keyboard. As you click each virtual button, the appropriate key stroke is sent to the control that currently has focus, and the focus remains where it is.
Of course there’s a lot more you can do to improve your keyboard, such as adding a sound when keys are clicked on or implementing ‘type rate’ so keystrokes are sent repeatedly while the mouse button is held down over a particular key. For a basic keyboard though, you should have all you need.
Posted by Yort at 11/18/2006 03:01:00 PM


09 2011

TFS(Team Foundation Server)

分类目录: Zheclei @ 10:45 下午
  • Visual Studio Team System – 常规
  • Team Foundation Server – 常规
  • Team Foundation Server – 安装
  • Team Foundation Server – 管理
  • Team Foundation Server — 构建自动化
  • Team Foundation Server — Power Tools 和加载项
  • Team Foundation Server — 流程模板
  • Team Foundation Server – 报告和数据仓库
  • Team Foundation Server — Team System Web Access
  • Team Foundation Server – 版本控制
  • Team Foundation Server — 工作项目跟踪
  • 标签:


    十二 25 2010

    圣诞快乐

    分类目录: Zheclei @ 1:57 下午

    祝大家圣诞节快乐,帕里怕啦

    – 发送自我的 iPad


    下一页 »