Posts

RSA Chat Messenger(Number Format Exception in Java) -

im doing rsa chat messenger(single server,multiple clients).i have included send,decrypt,exit button.when client sends message 1 client other client.the client recieves message gets in encrypted form , clicks decrypt button original message.but when im clicking decrypt button im getting awt-eventqueue-0" java.lang.numberformatexception , getting wierd characters in decryption section. here code: private string bytestostring(byte[] encrypted) { // todo auto-generated method stub //return null; string test = ""; (byte b : encrypted) { test += byte.tostring(b); } return test; } public static void main(string ... args) { // take username user string name = joptionpane.showinputdialog(null,"enter name :", "username", joptionpane.plain_message); string servername = "localhost"; try { new chatclient( name ,servername); } catch(exception ex) { out.println( ...

php - Comparison of 0 to a string fails -

update: 0 isn't using default value, after testing condition failing suggested answers. function test($value='a') { if ($value != 'a') { echo 'ok'; } else { echo 'not ok'; } } test(); // outputs not ok test('a'); // outputs not ok test(0); // outputs not ok, should output ok? test('0'); // outputs ok test(null); // outputs ok test(false); // outputs ok this kind of throwing 1 of functions. surprised see 0 , null works fine. know why php interpreting 0 default value? in php, comparing string 'a' number 0 causes change of string number. in case 'a' gets converted 0 , of course 0 == 0 . see here details. for completeness, fix, same linked documentation is use strict comparison operators (===, !==) comparison operators

c - where will be the output of the user from kernel using procfs? -

ssize_t dev_read(struct file *filp,char *buf,size_t count,loff_t *offset) { int len = count >= strlen(chr_arr.array) ? strlen(chr_arr.array) : count; *offset += len; if (*offset >= strlen(chr_arr.array)) return 0; if (copy_to_user(buf,chr_arr.array,len)) return -efault; return len; } i want read value kernel , use in user application, using procfs api read kernel , use in user space. the above read function read kernel , store in user buffer(buf). if want read output user application value read kernel stored in user space ?? me in ?? if value exposed in procfs, user application needs open procfs node file , read other file. fancy stuff's done in kernel. if you're trying write kernel component exposes procfs, you'll need similar code quoted handle read() calls procfs node.

How to breakout from an iframe? -

i have site works within iframe, want breakout iframe, , redirect site, whole new site own url should open, not maintaining current url or iframe. i have tried <meta http-equiv="refresh" content="0"; url="http://www.newsite.com/newurl.html"> , header ('location:http://www.newsite.com/'); they didnt work out me. try this: <script type="text/javascript"> if (top.location!= self.location) { top.location = 'http://www.newsite.com/'; } </script> if runs within iframe redirect parent window http://www.newsite.com/ .

tortoisegit - What should Git committers do to avoid overwriting others' changes? -

i created git repository on bitbucket project 5 committers. of new git , using tortoisegit. have master branch , want simple "svn-like" workflow: other people's changes, make changes yourself, let other people see changes. one particular committer seems having lot of trouble git , he's overwritten other people's changes several times now. undoing damage difficult, because don't know git either. can't watch him uses git, don't know does, i'd tell him: here's ensure doesn't happen . svn be: before committing, update first, merge changes , test still works . should tell him git? if you're going use git, should use power git offers... branches! on assumption don't want complicate workflow more necessary though, tell developer before committing, git pull --rebase . in nutshell, will: a) save off local changes, b) pull remote changes (that is, changes others have committed and pushed), c) replay local changes onto new co...

INSPECT verb in COBOL program -

here example used inspect verb. inspect function reverse (ws-addr(7:4)) tallying ws-count leading spaces display 'count :' ws-count compute ws-length = 4 - ws-count display 'length :' ws-length i not getting right output below input, input-1 - 43we ws-count = 0 length = 4 input-2 - 85 ws-count = 2 length = 2 input-3 - 74oi ws-count = 2 length = 2 for input-3 ws-count should come 0 getting 2 value. please find console window screen shot below, in-values :%orig243we count :000 length :004 addresslines: 43we<br> ws-sub :004 in-values :%orig385 count :002 length :002 addresslines: 85<br> ws-sub :005 in-values :%orig474oi count :002 length :002 could me resolve this. you must initialize identifier-2 before execution of inspect statement begins. so says ibm enterprise cobol language reference, , words similar in cobol manual. identifier-2 target field of t...

java - What is causing this runnable thread to be skipped -

i have attempted follow examples have found on implementing runnable thread, reason code skipped. for sake of having better understanding, can tell me preventing thread code executing? mainactivity.java: import android.os.bundle; import android.support.v4.app.fragment; import android.support.v7.app.actionbaractivity; import android.view.layoutinflater; import android.view.menu; import android.view.menuitem; import android.view.view; import android.view.viewgroup; import android.widget.textview; public class mainactivity extends actionbaractivity { @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_main); if (savedinstancestate == null) { getsupportfragmentmanager().begintransaction() .add(r.id.container, new placeholderfragment()).commit(); } } @override public boolean oncreateoptionsmenu(menu menu) { ...