在运行调试器时,程序暂停从服务器主输入输出流初始化对象流.以下是代码:
public TFileReader(Client cli)throws Exception{
this.cli = cli;
fileSock = new Socket(cli.ServerIp(), cli.FilePort());
fobjIn = new ObjectInputStream(fileSock.getInputStream());
fobjOut = new ObjectOutputStream(fileSock.getOutputStream());
fobjOut.flush();
}
@Override
public void run(){
try{
System.out.println("file reader thread online");
fobjOut.writeObject(cli.Name());
fobjOut.flush();
String per = (String) fobjIn.readObject();
System.out.println(per+"video filing...");
if(!per.equals("OKF"))
{
throw new Exception("Error In retriving video.");
}
Run Code Online (Sandbox Code Playgroud)
虽然它从断点传递但没有击中断点,它会暂停fobjIn并且不会执行.fobjOutfobjInfobjIn
我想从打字稿中的angular 2模块访问google api库。怎么做。当我尝试访问(gapi)时,我得到了不确定的信息。是否有任何NPM模块可用作我可以使用的angular 2中的打字稿库,或者我必须使用js文件。
以下是模块代码和库参考:
<script src="https://apis.google.com/js/client.js?onload=handleClientLoad"></script>
Run Code Online (Sandbox Code Playgroud)
。
@Component({
selector: "main-app",
template: "{{title}}",
providers: [HTTP_PROVIDERS, AuthService]
})
export class AppComponent implements OnInit {
public title: string = '';
constructor(private _authService: AuthService) {
var gapi: any;
console.log(gapi); // undefined
}
ngOnInit() {
this._authService.getAuthSettings().subscribe((set: AppSetting) => {
this.title = set.Scopes;
});
}
};
Run Code Online (Sandbox Code Playgroud) 我想共享BlockingChannel多个python进程。为了basic_ack从其他python进程发送
。
如何BlockingChannel在多个python进程之间共享。
以下是代码:
self.__connection__ = pika.BlockingConnection(pika.ConnectionParameters(host='localhost'))
self.__channel__ = self.__connection__.channel()
Run Code Online (Sandbox Code Playgroud)
我尝试转储使用,pickle但它确实允许转储频道并can't pickle select.epoll objects
使用以下代码给出错误
filepath = "temp/" + "merger_channel.sav"
pickle.dump(self.__channel__, open(filepath, 'wb'))
Run Code Online (Sandbox Code Playgroud)
目标:
目标是basic_ack从其他python进程的通道发送。
我想对工作表和Google驱动器api使用相同的OAuth代码和令牌,而无需将工作表和驱动器重定向到第2页。
以下是使用oauth 2生成访问代码和令牌的代码
string SCOPE = "https://spreadsheets.google.com/feeds https://docs.google.com/feeds";
OAuth2Parameters parameters = new OAuth2Parameters();
parameters.ClientId = CLIENT_ID;
parameters.ClientSecret = CLIENT_SECRET;
parameters.RedirectUri = REDIRECT_URI;
parameters.Scope = SCOPE;
string authorizationUrl = OAuthUtil.CreateOAuth2AuthorizationUrl(parameters);
OAuthUtil.GetAccessToken(parameters);
string accessToken = parameters.AccessToken;
Run Code Online (Sandbox Code Playgroud)
就像在asp.net mvc中一样,它是通过重定向Google表格API生成的。
我也想使用Google Drive API来获得相同的令牌。
我如何才能为Google Drive API 创建凭据对象,以便与其一起使用。遵循代码打开另一个窗口并将代码发送到该窗口。
var credential = GoogleWebAuthorizationBroker.AuthorizeAsync(new ClientSecrets
{
ClientId = clientId,
ClientSecret = clientSecret
}, scopes, "skhan", CancellationToken.None, new FileDataStore("Drive.Auth.Store")).Result;
Run Code Online (Sandbox Code Playgroud) c# asp.net-mvc oauth google-drive-api google-api-dotnet-client
我将图像绘制到jframe时出现null异常错误.我调试代码并检查图像和帧不是null但仍然在绘制图像到帧时抛出NULL异常.
请看一看 :
public void run(){
try{
ObjectInputStream objVideoIn = new ObjectInputStream(serVideoIn);
byte[] imgbytes=null;
ByteArrayInputStream barrin=null;
JFrame jf = new JFrame();
Graphics ga=jf.getGraphics(); //Getting null exception
//Thread.sleep(10000);
jf.setVisible(true);
jf.setSize(400, 400);
while(true){
int index=0;
//Thread.sleep(300);
int size= (int)objVideoIn.readObject();
imgbytes = new byte[size];
barrin = new ByteArrayInputStream(imgbytes);
System.out.println("image size" + size);
//Thread.sleep(200);
while(index<size)
{
System.out.println("reading image");
int bytesread = objVideoIn.read(imgbytes, index, size-index);
if(bytesread<0){
System.out.println("error in receiving bytes yar");
}
index+=bytesread;
}
//barrin.read(imgbytes, 0, imgbytes.length);
barrin = new ByteArrayInputStream(imgbytes);
buffImg = ImageIO.read(barrin);
if(buffImg==null) …Run Code Online (Sandbox Code Playgroud)