Search Results

Search found 75 results on 3 pages for 'amith kk'.

Page 2/3 | < Previous Page | 1 2 3  | Next Page >

  • non blocking client server chat application in java using nio

    - by Amith
    I built a simple chat application using nio channels. I am very much new to networking as well as threads. This application is for communicating with server (Server / Client chat application). My problem is that multiple clients are not supported by the server. How do I solve this problem? What's the bug in my code? public class Clientcore extends Thread { SelectionKey selkey=null; Selector sckt_manager=null; public void coreClient() { System.out.println("please enter the text"); BufferedReader stdin=new BufferedReader(new InputStreamReader(System.in)); SocketChannel sc = null; try { sc = SocketChannel.open(); sc.configureBlocking(false); sc.connect(new InetSocketAddress(8888)); int i=0; while (!sc.finishConnect()) { } for(int ii=0;ii>-22;ii++) { System.out.println("Enter the text"); String HELLO_REQUEST =stdin.readLine().toString(); if(HELLO_REQUEST.equalsIgnoreCase("end")) { break; } System.out.println("Sending a request to HelloServer"); ByteBuffer buffer = ByteBuffer.wrap(HELLO_REQUEST.getBytes()); sc.write(buffer); } } catch (IOException e) { e.printStackTrace(); } finally { if (sc != null) { try { sc.close(); } catch (Exception e) { e.printStackTrace(); } } } } public void run() { try { coreClient(); } catch(Exception ej) { ej.printStackTrace(); }}} public class ServerCore extends Thread { SelectionKey selkey=null; Selector sckt_manager=null; public void run() { try { coreServer(); } catch(Exception ej) { ej.printStackTrace(); } } private void coreServer() { try { ServerSocketChannel ssc = ServerSocketChannel.open(); try { ssc.socket().bind(new InetSocketAddress(8888)); while (true) { sckt_manager=SelectorProvider.provider().openSelector(); ssc.configureBlocking(false); SocketChannel sc = ssc.accept(); register_server(ssc,SelectionKey.OP_ACCEPT); if (sc == null) { } else { System.out.println("Received an incoming connection from " + sc.socket().getRemoteSocketAddress()); printRequest(sc); System.err.println("testing 1"); String HELLO_REPLY = "Sample Display"; ByteBuffer buffer = ByteBuffer.wrap(HELLO_REPLY.getBytes()); System.err.println("testing 2"); sc.write(buffer); System.err.println("testing 3"); sc.close(); }}} catch (IOException e) { e.printStackTrace(); } finally { if (ssc != null) { try { ssc.close(); } catch (IOException e) { e.printStackTrace(); } } } } catch(Exception E) { System.out.println("Ex in servCORE "+E); } } private static void printRequest(SocketChannel sc) throws IOException { ReadableByteChannel rbc = Channels.newChannel(sc.socket().getInputStream()); WritableByteChannel wbc = Channels.newChannel(System.out); ByteBuffer b = ByteBuffer.allocate(1024); // read 1024 bytes while (rbc.read(b) != -1) { b.flip(); while (b.hasRemaining()) { wbc.write(b); System.out.println(); } b.clear(); } } public void register_server(ServerSocketChannel ssc,int selectionkey_ops)throws Exception { ssc.register(sckt_manager,selectionkey_ops); }} public class HelloClient { public void coreClientChat() { Clientcore t=new Clientcore(); new Thread(t).start(); } public static void main(String[] args)throws Exception { HelloClient cl= new HelloClient(); cl.coreClientChat(); }} public class HelloServer { public void coreServerChat() { ServerCore t=new ServerCore(); new Thread(t).start(); } public static void main(String[] args) { HelloServer st= new HelloServer(); st.coreServerChat(); }}

    Read the article

  • fatal error LNK1112: module machine type 'X86' conflicts with target machine type 'AMD64'

    - by KK
    Hi, I am using VS 2003 .Net on 32 bit XP OS. I have also installed "Microsoft Platform SDK" on my machine. Can I build vc++ application (binaries) targeted for 64 bit OS? I am using following project options : Name="VCLinkerTool" AdditionalOptions="/machine:AMD64 bufferoverflowU.lib" OutputFile="\bin\Release\MM64.dll" LinkIncremental="1" SuppressStartupBanner="TRUE" AdditionalLibraryDirectories="&quot;C:\Program Files\Microsoft Platform SDK\Lib\AMD64&quot;" GenerateDebugInformation="TRUE" ProgramDatabaseFile="\bin\Release\MM64.pdb" GenerateMapFile="TRUE" MapFileName="\bin\Release\MM64.map" MapExports="TRUE" MapLines="TRUE" OptimizeReferences="2" EnableCOMDATFolding="2" ImportLibrary=".\Release/MM64.lib" TargetMachine="0"/> I am getting following error: fatal error LNK1112: module machine type 'X86' conflicts with target machine type 'AMD64' Do I need to build project on 64 bit OS or I need to change project settings to resolve this error. Please help me to resolve this issue.

    Read the article

  • control with ID 'GridView1' could not be found for the trigger in UpdatePanel 'UpdatePanel1'

    - by Kk
    I have two gridview in update panel and m adding entries from one gridview to another on selectedIndexChanged event what m trying to do is updating update panel on this event selectedindexchanged ...but my gridview is inside accordian control so it does not get initialized and hence i get this error ..... control with ID 'GridView1' could not be found for the trigger in UpdatePanel 'UpdatePanel1' Anybody knows solution?

    Read the article

  • what's the correct way to release a new website?

    - by kk
    so i've been working on a website on and off for about a year now, and i'm finally at a point where it's functional enough to test out in a sort of private beta (not ready for live release). but i never thought about the correct process for doing this and what things i need to take care of. i've never released a public website before. some of the questions/concerns i have in mind: 1) is it against my MSDN license agreement to release a website using the software? 2) how do i protect my "idea"? is it a bad idea to find random people you don't know to test out your site? can you make them digitally sign some sort of NDA? 3) i'm using some open source code - any proper way to release open source code to live production? 4) how much traffic can a place like discountasp.net handle anyway? can hosting sites generally handle large volume of traffic? any comments/suggestions regarding the proper/safe way to release a public website would be appreciated. i've been working on this for a while and never actually sat down to think about the right way to move from a personal side project to a live production website.

    Read the article

  • change UIbutton color inside UITableViewCell

    - by KK
    I have a simple problem ... but its turning into a very difficult problem .. i have a button inside uitableviewcell and want to change its color through code .... i could aceive it by changing its background image. But its kinna hazy ... its not the solid color ... and when i use [cell.button setBackgroundColor:[UIcolor redColor]] ... the button color does not change ... any help appreciated thanks

    Read the article

  • send email C# using smtp server with username password authentification

    - by KK
    I have a piece of code that sends email.. heres the code This is not working for me. This a remote smtp service ... and i double checked that email web access works fine .. i can login using the gui, recieve and send emails. But when i try to do it through code .. it fails with the message ... {System.Net.Mail.SmtpException: The SMTP server requires a secure connection or the client was not authenticated. The server response was: 5.7.0 No AUTH command has been given. Can anybody advise ... and also they dont have EWS exposed ie.e exchange web service ./.. this is the way to go .. port is 25 and no SSL or TLS Button b = sender as Button; try { MailMessage msg = new MailMessage(senderEmail, recieverEmail, "afdasfas", "safasfa"); //MailMessage msg = new MailMessage(senderEmail, recieverEmail, subject, subject); System.Net.Mail.SmtpClient mailclient = new System.Net.Mail.SmtpClient(EmailSmtpServer, outgoingPort); System.Net.NetworkCredential auth = new System.Net.NetworkCredential(senderEmail, senderPassword); mailclient.Host = EmailSmtpServer; mailclient.UseDefaultCredentials = false; mailclient.Credentials = auth; mailclient.Send(msg); MessageBox.Show(b.Content + ":WORKED"); } catch (Exception e4) { MessageBox.Show(b.Content + ": " +e4.Message); MessageBox.Show(b.Content + ": " + e4.StackTrace); }

    Read the article

  • sending email exchange web service works in US but not when run from columbia

    - by KK
    I have posted similar question before . I have tried 2 things here .. C# code to make use of MS exchange web service exposed by our companys server, and send emails. THis works in our US offfice ... when i run the same application from our columbian client .. it does not work. C# code to send email a) use senMail C# API b) C# script to manually do the telnet to client smtp outgoing email server and send emails. BOth work in our US office .... but does not work when run from columnbian client location I need a solution asap ... pls help ..

    Read the article

  • exchange web service C# code send email from home

    - by KK
    Is it possible to wrtie C# code as below .. and send email using my home network. I have a valid user name and password on that exchange server. Is there any configuration that i can set to achieve this. BY THE WAY ... this code blow works when i run it within office network .... i want this code to work when run from any network .... Thank you for your help guys ... String cMSExchangeWebServiceURL = (String)System.Configuration.ConfigurationSettings.AppSettings["MSExchangeWebServiceURL"]; String cEmail = (String)System.Configuration.ConfigurationSettings.AppSettings["Cemail"]; String cPassword = (String)System.Configuration.ConfigurationSettings.AppSettings["Cpassword"]; String cTo = (String)System.Configuration.ConfigurationSettings.AppSettings["CTo"]; ExchangeServiceBinding esb = new ExchangeServiceBinding(); esb.Timeout = 1800000; esb.AllowAutoRedirect = true; esb.UseDefaultCredentials = false; esb.Credentials = new NetworkCredential(cEmail, cPassword); esb.Url = cMSExchangeWebServiceURL; ServicePointManager.ServerCertificateValidationCallback += delegate(object sender1, X509Certificate certificate, X509Chain chain, SslPolicyErrors sslPolicyErrors) { return true; }; // Create a CreateItem request object CreateItemType request = new CreateItemType(); // Setup the request: // Indicate that we only want to send the message. No copy will be saved. request.MessageDisposition = MessageDispositionType.SendOnly; request.MessageDispositionSpecified = true; // Create a message object and set its properties MessageType message = new MessageType(); message.Subject = subject; message.Body = new TestOutgoingEmailServer.com.cogniti.mail1.BodyType(); message.Body.BodyType1 = BodyTypeType.HTML; message.Body.Value = body; message.ToRecipients = new EmailAddressType[3]; message.ToRecipients[0] = new EmailAddressType(); //message.ToRecipients[1] = new EmailAddressType(); //message.ToRecipients[2] = new EmailAddressType(); message.ToRecipients[0].EmailAddress = "[email protected]"; message.ToRecipients[0].RoutingType = "SMTP"; //message.CcRecipients = new EmailAddressType[1]; //message.CcRecipients[0] = new EmailAddressType(); //message.CcRecipients[0].EmailAddress = toEmailAddress.ElementAt(1).ToString(); //message.CcRecipients[0].RoutingType = "SMTP"; //There are some more properties in MessageType object //you can set all according to your requirement // Construct the array of items to send request.Items = new NonEmptyArrayOfAllItemsType(); request.Items.Items = new ItemType[1]; request.Items.Items[0] = message; // Call the CreateItem EWS method. CreateItemResponseType response = esb.CreateItem(request);

    Read the article

  • How to run Android instrumentation tests from the command line (in Kubuntu)?

    - by KK
    We are able to run instrumentation tests of Android from the command line on Windows by launching: adb shell am instrument -w <package.test>/android.test.InstrumentationTestRunner This gives us good results. Using the same architecture, we are unable to run the same in Kubuntu. We have the same setup in Kubuntu. Can someone let us know, if there are packages with same name.. Then what package will the adb shell point? How will the emulator connect with adb shell from cmd line? DO we need to do any changes to do so in Kubuntu ?

    Read the article

  • how do you create a social graph?

    - by kk
    this is a totally unfamiliar area for me. can anyone point me in the right direction on how to create a social graph and the best way to represent it? i'm building a website in C#/asp net and need to create a "friends" feature... is this type of thing usually stored entirely in the DB? if so, how?

    Read the article

  • insert VBS variable within a single-quoted WMI query

    - by jiaoziren
    Hi all, I am really frustrated by the snippet below: Dim objFSO, varSrc, varDest, varExt Set objFSO = CreateObject("Scripting.FileSystemObject") varSrc = WScript.Arguments(0) varDest = WScript.Arguments(1) varExt = WScript.Arguments(2) If objFSO.FolderExists(varSrc) Then WScript.Echo varSrc strComputer = "." Set objWMIService = GetObject("winmgmts:" _ & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2") Set colMonitoredEvents = objWMIService.ExecNotificationQuery _ ("SELECT * FROM __InstanceCreationEvent WITHIN 10 WHERE " _ & "Targetinstance ISA 'CIM_DirectoryContainsFile' AND " _ & "TargetInstance.GroupComponent= " _ & "'Win32_Directory.Name=""c:\\\\kk ""'") Do Set objLatestEvent = colMonitoredEvents.NextEvent WScript.Echo objLatestEvent.TargetInstance.PartComponent Loop Else WScript.Echo "Bazinga" End If I tried to replace c:\\kk with varSrc however it seems impossible for WSH to recognize it in WMI query - not to mention it was within a single quote! I have tried chr(34) and it didn't work. Please help if possible. Much appreciated!

    Read the article

  • Pass javascript array to php by using curly braces key name

    - by user7031
    My js code: $(function(){ var arr = new Array('jj', 'kk', 'oo'); $.post('test12.php', {'arr[]': arr}, function(data){ alert(data); }); }); PHP code: <?php echo print_r($_POST['arr']); The thing is,$.post receive a key named 'arr[]',it should be used in PHP as 'arr[]' instead of 'arr',but '$_POST['arr[]']' doesn't work,'arr' works.Which seems that Jquery might do something with curly braces '[]' before sending something to PHP. Secondly,when I remove the single quotas around 'arr[]',PHP can not receive anything by using $_POST['arr'];,I don't know why? Doing this task in a traditional way with no curly braces: $.post('test12.php', {arr: arr}, function(data){ alert(data); }); It works fine. So when sending javascript array to PHP,why bothering using single quote and curly braces like 'arr[]' instead of using a concise way like arr:arr My return result is Array( [0]=>jj [1]=>kk [2]=>oo ) 1 Notice there is a 1 under the array,why?

    Read the article

  • how to get width of column in charting ColumnSeries. I have not DataPointStyle. It takes the default

    - by KK
    how to get width of column in charting ColumnSeries. I have not DataPointStyle. It takes the default I have set the itemssource to col.ItemsSource = new KeyValuePair[]{ new KeyValuePair(DateTime.Now.AddMonths(1), 100), new KeyValuePair(DateTime.Now.AddMonths(2), 200), new KeyValuePair(DateTime.Now.AddMonths(3), 300), new KeyValuePair(DateTime.Now.AddMonths(4), 400) }; I get 4 column with some even width. How to I print its value .... its taking it by default ... thank you.

    Read the article

  • JQuery transition animation

    - by kk-dev11
    This program randomly selects two employees from a json-object Employees array, winnerPos is already defined. For better user experience I programmed these functions to change pictures one by one. The animation stops when the randomly selected person is shown on the screen. The slideThrough function will be triggered when the start button is pressed. function slideThrough() { counter = 0; start = true; clearInterval(picInterval); picInterval = setInterval(function () { changePicture(); }, 500); } function changePicture() { if (start) { if (counter > winnerPos) { setWinner(); start = false; killInterval(); } else { var employee = Employees[counter]; winnerPic.fadeOut(200, function () { this.src = 'img/' + employee.image; winnerName.html(employee.name); $(this).fadeIn(300); }); counter++; } } } The problem is the animation doesn't work smoothly. At first it works, but not perfect. The second time the transition happens in an irregular way, i.e. different speed and fadeIn/fadeOut differs from picture to picture. Could anyone help me to fine-tune the transition?

    Read the article

  • why "$(opener.document).ready()" is not working?

    - by KK
    I tried something like, below in popup-window, but not working... any correction at line 3, please suggest. function closePopup() { window.opener.history.go(0); $(opener.document).ready(function(){ window.opener.some_function(some_variable); self.close(); }); }

    Read the article

  • Genymotion in Ubuntu

    - by fareed fareedi
    Is there anybody to help me? I've installed Virtualbox and Genymotion on Ubuntu successfully. Then I selected Samsung Galaxy s5 4.4.2 on Genymotion, downloaded it succesfully either, but I've got problems in installation of APK. So I did genymotion translation 1.1 and gapps-kk, but yet my APK didn't work. When I started Genymotion appeared viber, tango, Google service, etc, but unfortunately it has stopped.

    Read the article

< Previous Page | 1 2 3  | Next Page >