Search Results

Search found 11318 results on 453 pages for 'josh close'.

Page 15/453 | < Previous Page | 11 12 13 14 15 16 17 18 19 20 21 22  | Next Page >

  • Keystrokes in Winforms app causing window to close unexpectedly

    - by Paul Sasik
    I have a strange issue that has arisen recently: Whenever I enter text, even a single character, into a textbox in any Form in my application it causes the form and its parent to close. I've checked for the following so far: Errant/mis-assigned event handlers that may be interpreting a keystroke as a Form cancel I am using keypreview in several windows but debugging shows this to not be a cause Happens in any form of the application Happens even with brand new text boxes dropped on the form Tried removing the WithEvents declaration from text box declarations (VB.NET) The result is DialogResult.Cancel when I break the code after Show or ShowDialog The forms do not use AcceptButton or CancelButton properties (set to none) Note: I am modifying a large codebase with a lot of code that I have yet to touch What else could be causing this strange behavior?

    Read the article

  • how to close ie8 tabs

    - by omair iqbal
    this code below is not closing tab in internet explorer 8 if i post wm_close command to Wnd it closes internet explorer but i want to close the current tab not entire 'ieframe' is FindWindowEX(Wnd , 0, 'Frame Tab', nil) supposed to retun handle to ie frame? if yes why is it not closing the current tab in internet explorer thanks in advance var Wnd,WndChild : hwnd; begin Wnd := FindWindow('IEFrame', nil); WndChild := FindWindowEX(Wnd , 0, 'Frame Tab', nil); postmessage(WndChild,wm_close,0,0); end;

    Read the article

  • jQuery UI Dialog cause page jump on open & close on ASP.NET

    - by Gal V
    Hello all, I have an ASP.NET C# page, with image thumbnails in it. I created a script that opens a jQuery UI Dialog on each hover on a thumbnail that shows me the thumbnail in larger size in a dialog view, and when I hover out - dialog closes. My little annoying problem is, that in every mouseover (trigger dialog to open) - the page makes itself 'longer' - a scrollbar appears on the side of the browser, and it seems like the page gets longer when a dialog is openning, but it shouldn't do so. When I hover off (mouseout) - the dialog disappears and the page returns to its normal state. Because of this- when I hover through the thumbnails, my page 'jumps'. I looked for a solution for this, and I've added return false; for each dialog open, and close - and it still doesn't make any different. Sorry for the unperfect english, and thanks for all helpers!

    Read the article

  • How to close a window (unload a NIB)?

    - by Paperflyer
    I have a custom NSWindowController subclass that loads a NIB file during initialization like this: self = [super initWithNibNamed:@"myNib"]; if (self != nil) { [self window]; } The nib contains some custom views and some other controls. The NSWindowController is the file's owner and at least one of the views even binds to it. Simply, what do I have to do to close and release that window? I spend the whole day trying to figure that out and I am still clueless. Please help me.

    Read the article

  • close camera application in blackberry

    - by user324884
    I need to close camera when a file is taken from camera. I invoke camera by Invoke method and added FileJournalListener and then use Inject.post. But it si working fine in simulator and but not working in actual device. any Idea. ....... case FileSystemJournalEntry.FILE_ADDED: filepath=path; EventInjector.KeyEvent inject = new EventInjector.KeyEvent(EventInjector.KeyEvent.KEY_DOWN,Characters.ESCAPE, 50); inject.post(); inject.post(); ............

    Read the article

  • Facebook Connect via Javascript doesn't close and doesn't pass session id

    - by ensnare
    I'm trying to authenticate users via Facebook Connect using a custom Javascript button: <form> <input type="button" value="Connect with Facebook" onclick="window.open('http://www.facebook.com/login.php?api_key=XXXXX&extern=1&fbconnect=1&req_perms=publish_stream,email&return_session=0&v=1.0&next=http%3A%2F%2Fwww.example.com%2Fxd_receiver.htm&fb_connect=1&cancel_url=http%3A%2F%2Fwww.example.com%2Fregister%2Fcancel', '_blank', 'top=442,width=480,height=460,resizable=yes', true)" onlogin='window.location="/register/step2"' /> </form> I am able to authenticate users. However after authentication, the popup window just stays open and the main window is not directed anywhere. In fact, it is the popup window that goes to "/register/step2" How can I get the login window to close as expected, and to pass the facebook session id to /register/step2? Thanks!

    Read the article

  • Close resources before exiting JFrame and TCP communication in Java

    - by Oz Molaim
    1. I'm writing a chat based application on TCP communication. I'm using NetBeans and I want to add functionality to the default EXIT_ON_CLOSE when exiting JFrame. The reason of course is because I want to clean resources and end threads safely. How can I call a method that clear resources and only then close the JFrame safely and end the process. 2. I need to implement the server side. The server has List/HashMap/Queue of 'Socket' with their chat nick-names. Is there any simple design pattern to do it correctly because I don't want to re-invent the wheel. thanks.

    Read the article

  • PHP and MySQLi close()

    - by Theopile
    Hello all. I am new to mysql and php, but am attempting to make my own cms to help make managing my websites easier. Can someone explain the mysqli's close() function. 1)Is it nesseccary? 2)What exactly does it do? 3)I heard that after php runs its script that it closes the connection, is that true? 4)Lastly, is there a security issue when not closing your connection to the database? Thanks

    Read the article

  • Android-Close Other Apps

    - by Luke
    I have some code that will launch a different application using intents but what can I do to close or kill the other app? Here is the launch code (works great): Intent i = new Intent(); i.setAction(Intent.ACTION_MAIN); i.addCategory(Intent.CATEGORY_LAUNCHER); i.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); i.setComponent( new ComponentName(resolveInfo.activityInfo.applicationInfo.packageName, resolveInfo.activityInfo.name)); I tried to kill the background processes but no luck: ActivityManager activityManager = (ActivityManager) context.getSystemService(context.ACTIVITY_SERVICE); activityManager.killBackgroundProcesses("com.pandora.android"); I also tried this to kill it: context.stopService(new Intent(context, Class.forName("com.bla.bla")));

    Read the article

  • windows popup close before display dos . xls

    - by Edgar Trejo
    Good morning! I'm trying to display a document. Xls in a popup window on IE8 but before showing the window closes automatically. Here I show the code javascript: function hacerExportarExcel(){ var url = contextPath + "/exportarCarteraCreditoExcel.do" window.setTimeout("window.open('"+url+"', '_blank', 'width=950,height=500,scrollbars=yes')",1000); } action: try { response.setContentType("application/vnd.ms-excel"); response.setHeader("Content-Disposition", "inline; filename=ConsultaCartera.xls"); consulta.setPdf(response.getOutputStream()); administracionCreditoConsulta.exportarCarteraCreditoExcel(consulta); } catch (Exception e) { logger.logError(e); } finally { response.getOutputStream().flush(); response.getOutputStream().close(); } Can someone please help me! Thanks!

    Read the article

  • Android / Java rare and seemingly impossible exception causing force close

    - by Guzba
    Hello all, I have an interesting problem being reported to me from an android application I have published. I have a two-dimensional array that I am iterating through using two for loops like so: for (int i = 0; i < arr.length; ++i) { for (int j = 0; j < arr[i].length; ++j) { if (arr[i][j] != 0) // does stuff } } The problem is, somehow arr[i][j] != 0 is throwing an ArrayIndexOutOfBoundsException. But very rarely. I have thousands of people use the app on a daily basis and get maybe twenty force close reports. Is this something I can't avoid, maybe a problem with the phones memory, etc. or is there something I can do that I haven't thought of yet? Thanks.

    Read the article

  • Making JQuery horizontal accordion close on click

    - by user310404
    Example: http://vincent-massaro.com/map/ Currently, the script allows you to click on a piece of the accordion to open it, but it is set to close on mouseleave. When I set the mouseleave to .click, it gets confused and doesn't know what state it is in. The code controlling this is below, and the full script is in haccordion.js linked in the page source. If someone could help me modify this script, I would be very grateful! Thanks in advance. $target.click(function(){ haccordion.expandli(config.accordionid, this) config.$lastexpanded=$(this) }) if (config.collapsecurrent){ //if previous content should be contracted when expanding current $target.mouseleave(function(){ $(this).stop().animate({width:config.paneldimensions.peekw}, config.speed) }) }

    Read the article

  • codingstyle "blanking after open and before close brackets"

    - by Oops
    Hi, I really like the "blanking after open and before close brackets"-codingstyle in modern codes Java/C#/C++ . e.g. calling a function: foo(myparam); // versus foo( myparam ); Do you have a better name for this codingstyle? where does it come from? Do you like it either, what is the reason for you to use it or not use it? a few years ago people said "you are blanking" if one has used too much blank space characters in a forumspost or email. many thanks in advance regards Oops

    Read the article

  • codingstyle "blanking after open and before close brackets"

    - by Oops
    I really like the "blanking after open and before close brackets"-codingstyle in modern codes Java/C#/C++ . e.g. calling a function: foo(myparam); // versus foo( myparam ); Do you have a better name for this codingstyle? where does it come from? Do you like it either, what is the reason for you to use it or not use it? a few years ago people said "you are blanking" if one has used too much blank space characters in a forumspost or email. many thanks in advance regards Oops edit: two cons, any pros out there?

    Read the article

  • WPF MessageBox close without any action

    - by developer
    Hi, I have a confirmation message box for the user in one of my apps. Below is the code for that, MessageBoxResult res= System.Windows.MessageBox.Show("Could not find the folder, so the D: Drive will be opened instead."); if (res == MessageBoxResult.OK) { MessageBox.Show("OK"); } else { MessageBox.Show("Do Nothing"); } Now, when the user clicks on the OK button, I want certain code to execute but when they click on the red cross at the upper right corner, I just want the messagebox to close without doing anything. In my case I get 'OK' displayed even when I click on the red cross icon at the upper right corner. Is there a way I can have 'Do Nothing' displayed when I click on the cross. I not want to add any more buttons.

    Read the article

  • Close TCP port 80 and 443 after forking in Django

    - by audiodev
    I am trying to fork() and exec() a new python script process from within a Django app that is running in apache2/WSGI Python. The new python process is daemonized so that it doesn't hold any association to apache2, but I know the HTTP ports are still open. The new process kills apache2, but as a result the new python process now holds port 80 and 443 open, and I don't want this. How do I close port 80 and 443 from within the new python process? Is there a way to gain access to the socket handle descriptors so they can be closed?

    Read the article

  • Dojo - How to position tooltip close to text?

    - by user244394
    Like the title says i want to be able to display the tooltip close to the text, currently it is displayed far away in the cell. Tobe noted the tooltip positions correctly for large text, only fails for small text. In DOJO How can i position the tooltip close to the text? I have this bit of code snippet that display the tooltip in the grid cells. Screenshot attached, html <div class="some_app claro"></div> ... com.c.widget.EnhancedGrid = function ( aParent, options ) { var grid, options; this.theParentApp = aParent; dojo.require("dojox.grid.EnhancedGrid"); dojo.require("dojox.grid.enhanced.plugins.Menu"); dojo.require("dojox.grid.enhanced.plugins.Selector"); dojo.require("dojox.grid.enhanced.plugins.Pagination"); dojo.require("dojo.store.Memory"); dojo.require("dojo.data.ObjectStore"); dojo.require("dojo._base.xhr"); dojo.require("dojo.domReady!"); dojo.require("dojo.date.locale"); dojo.require("dojo._base.connect"); dojo.require("dojox.data.JsonRestStore"); dojo.require("dojo.data.ItemFileReadStore"); dojo.require("dijit.Menu"); dojo.require("dijit.MenuItem"); dojo.require('dijit.MenuSeparator'); dojo.require('dijit.CheckedMenuItem'); dojo.require('dijit.Tooltip'); dojo.require('dojo/query'); dojo.require("dojox.data.QueryReadStore"); // main initialization function this.init = function( options ) { var me = this; // default options var defaultOptions = { widgetName: ' Enhancedgrid', render: true, // immediately render the grid draggable: true, // disables column dragging containerNode: false, // the Node to hold the Grid (optional) mashupUrl: false, // the URL of the mashup (required) rowsPerPage: 20, //Default number of items per page columns: false, // columns (required) width: "100%", // width of grid height: "100%", // height of grid rowClass: function (rowData) {}, onClick: function () {}, headerMenu: false, // adding a menu pop-up for the header. selectedRegionMenu: false, // adding a menu pop-up for the rows. menusObject: false, //object to start-up the menus using the plug-in. sortInfo: false, // The column default sort infiniteScrolling: false //If true, the enhanced grid will have an infinite scrolling. }; // merge user provided options me.options = jQuery.extend( {}, defaultOptions, options ); // check we have minimum required options if ( ! me.options.mashupUrl ){ throw ("You must supply a mashupUrl"); } if ( ! me.options.columns ){ throw ("You must supply columns"); } // make the column for formatting based on its data type. me.preProcessColumns(); // create the Contextual Menu me.createMenu(); // create the grid object and return me.createGrid(); }; // Loading the data to the grid. this.loadData = function () { var me = this; if (!me.options.infiniteScrolling) { var xhrArgs = { url: me.options.mashupUrl, handleAs: "json", load: function( data ){ var store = new dojo.data.ItemFileReadStore({ data : {items : eval( "data."+me.options.dataRoot)}}); store.fetch({ onComplete : function(items, request) { if (me.grid.selection !== null) { me.grid.selection.clear(); } me.grid.setStore(store); }, onError : function(error) { me.onError(error); } }); }, error: function (error) { me.onError(error); } }; dojo.xhrGet(xhrArgs); } else { dojo.declare('NotificationQueryReadStore', dojox.data.QueryReadStore, { // // hacked -- override to map to proper data structure // from mashup // _xhrFetchHandler : function(data, request, fetchHandler, errorHandler) { // // TODO: need to have error handling here when // data has "error" data structure // // // remap data object before process by super method // var dataRoot = eval ("data."+me.options.dataRoot); var dataTotal = eval ("data."+me.options.dataTotal); data = { numRows : dataTotal, items : dataRoot }; // call to super method to process mapped data and // set rowcount // for proper display this.inherited(arguments); } }); var queryStore = new NotificationQueryReadStore({ url : me.options.mashupUrl, urlPreventCache: true, requestMethod : "get", onError: function (error) { me.onError(error); } }); me.grid.setStore(queryStore); } }; this.preProcessColumns = function () { var me = this; var options = me.options; for (i=0;i<this.options.columns.length;i++) { if (this.options.columns[i].formatter==null) { switch (this.options.columns[i].datatype) { case "string": this.options.columns[i].formatter = me.formatString; break; case "date": this.options.columns[i].formatter = me.formatDate; var todayDate = new Date(); var gmtTime = c.util.Date.parseDate(todayDate.toString()).toString(); var gmtval = gmtTime.substring(gmtTime.indexOf('GMT'),(gmtTime.indexOf('(')-1)); this.options.columns[i].name = this.options.columns[i].name + " ("+gmtval+")"; } } if (this.options.columns[i].sortDefault) { me.options.sortInfo = i+1; } } }; // create GRID object using supplied options this.createGrid = function () { var me = this; var options = me.options; // create a new grid this.grid = new dojox.grid.EnhancedGrid ({ width: options.width, height: options.height, query: { id: "*" }, keepSelection: true, formatterScope: this, structure: options.columns, columnReordering: options.draggable, rowsPerPage: options.rowsPerPage, //sortInfo: options.sortInfo, plugins : { menus: options.menusObject, selector: {"row":"multi", "cell": "disabled" }, }, //Allow the user to decide if a column is sortable by setting sortable = true / false canSort: function(col) { if (options.columns[Math.abs(col)-1].sortable) return true; else return false; }, //Change the row colors depending on severity column. onStyleRow: function (row) { var grid = me.grid; var item = grid.getItem(row.index); if (item && options.rowClass(item)) { row.customClasses += " " +options.rowClass(item); if (grid.selection.selectedIndex == row.index) { row.customClasses += " dojoxGridRowSelected"; } grid.focus.styleRow(row); grid.edit.styleRow(row); } }, onCellMouseOver: function (e){ // var pos = dojo.position(this, true); // alert(pos); console.log( e.rowIndex +" cell node :"+ e.cellNode.innerHTML); // var pos = dojo.position(this, true); console.log( " pos :"+ e.pos); if (e.cellNode.innerHTML!="") { dijit.showTooltip(e.cellNode.innerHTML, e.cellNode); } }, onCellMouseOut: function (e){ dijit.hideTooltip(e.cellNode); }, onHeaderCellMouseOver: function (e){ if (e.cellNode.innerHTML!="") { dijit.showTooltip(e.cellNode.innerHTML, e.cellNode); } }, onHeaderCellMouseOut: function (e){ dijit.hideTooltip(e.cellNode); }, }); // ADDED CODE FOR TOOLTIP var gridTooltip = new Tooltip({ connectId: "grid1", selector: "td", position: ["above"], getContent: function(matchedNode){ var childNode = matchedNode.childNodes[0]; if(childNode.nodeType == 1 && childNode.className == "user") { this.position = ["after"]; this.open(childNode); return false; } if(matchedNode.className && matchedNode.className == "user") { this.position = ["after"]; } else { this.position = ["above"]; } return matchedNode.textContent; } }); ... //Construct the grid this.buildGrid = function(){ var datagrid = new com.emc.widget.EnhancedGrid(this,{ Url: "/dge/api/-resultFormat=json&id="+encodeURIComponent(idUrl), dataRoot: "Root.ATrail", height: '100%', columns: [ { name: 'Time', field: 'Time', width: '20%', datatype: 'date', sortable: true, searchable: true, hidden: false}, { name: 'Type', field: 'Type', width: '20%', datatype: 'string', sortable: true, searchable: true, hidden: false}, { name: 'User ID', field: 'UserID', width: '20%', datatype: 'string', sortable: true, searchable: true, hidden: false } ] }); this.grid = datagrid; };

    Read the article

  • Python Image Library, Close method

    - by DNN
    Hello, I have been using pil for the first time today. And I wanted to resize an image assuming it was larger than 800x600 and also create a thumbnail. I could do either of these tasks separately but not together in one method (I am doing a custom save method in django admin). This returns a "cannot identify image file" error message. The error is on the line "image = Image.open(self.photo)" after "#if image is size is greatet than 800 x 600 then resize image." I thought this may be because the image is already open, but if i remove the line I still get issues. So I thought I could try closing after creating a thumbnail and then reopening. But I couldn't find a close method.... This is my code: def save(self): #create thumbnail Thumb_Size = (75, 75) image = Image.open(self.photo) if image.mode not in ('L', 'RGB'): image = image.convert('RGB') image.thumbnail(Thumb_Size, Image.ANTIALIAS) temp_handle = StringIO() image.save(temp_handle, 'jpeg') temp_handle.seek(0) suf = SimpleUploadedFile(os.path.split(self.photo.name)[-1], temp_handle.read(), content_type='image/jpg') self.thumbnail.save(suf.name+'.jpg', suf, save=False) #if image is size is greatet than 800 x 600 then resize image. image = Image.open(self.photo) if image.size[0] > 800: if image.size[1] > 600: Max_Size = (800, 600) if image.mode not in ('L', 'RGB'): image = image.convert('RGB') image.thumbnail(Max_Size, Image.ANTIALIAS) temp_handle = StringIO() image.save(temp_handle, 'jpeg') temp_handle.seek(0) suf = SimpleUploadedFile(os.path.split(self.photo.name)[-1], temp_handle.read(), content_type='image/jpg') self.photo.save(suf.name+'.jpg', suf, save=False) #enter info to database super(Photo, self).save()

    Read the article

  • Close application on error

    - by poke
    I’m currently writing an application for the Android platform that requires a mounted SD card (or ExternalStorage). I know that it might not be the best way to require something like that, but the application will work with quite a lot of data, and I don’t even want to think about storing that on the device’s storage. Anyway, to ensure that the application won’t run without the external storage, I do a quick check in the activity’s onCreate method. If the card is not mounted, I want to display an error message and then quit the application. My current approach looks like this: public void onCreate ( Bundle savedInstanceState ) { super.onCreate( savedInstanceState ); setContentView( R.layout.main ); try { // initialize data storage // will raise an exception if it fails, or the SD card is not mounted // ... } catch ( Exception e ) { AlertDialog.Builder builder = new AlertDialog.Builder( this ); builder .setMessage( "There was an error: " + e.getMessage() ) .setCancelable( false ) .setNeutralButton( "Ok.", new DialogInterface.OnClickListener() { public void onClick ( DialogInterface dialog, int which ) { MyApplication.this.finish(); } } ); AlertDialog error = builder.create(); error.show(); return; } // continue ... } When I run the application, and the exception gets raised (I raise it manually to check if everything works), the error message is displayed correctly. However when I press the button, the application closes and I get an Android error, that the application was closed unexpectedly (and I should force exit). I read some topics before on closing an application, and I know that it maybe shouldn’t happen like that. But how should I instead prevent the application from continuing to run? How do you close the application correctly when an error occurs?

    Read the article

  • Flex 3 Close UrlLoader throws exception

    - by gmoniey
    I am trying to simulate a 'HEAD' method using UrlLoader; essentially, I just want to check for the presence of a file without downloading the entire thing. I figured I would just use HttpStatusEvent, but the following code throws an exception (one that I can't wrap in a try/catch block) when you run in debug mode. <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" initialize="init()"> <mx:Script> <![CDATA[ private static const BIG_FILE:String = "http://www.archive.org/download/gspmovvideotestIMG0021mov/IMG_0021.mov"; private var _loader:URLLoader; private function init():void { _loader = new URLLoader(); _loader.addEventListener(HTTPStatusEvent.HTTP_STATUS, statusHandler); _loader.addEventListener(IOErrorEvent.IO_ERROR, errorHandler); _loader.addEventListener(SecurityErrorEvent.SECURITY_ERROR, errorHandler); _loader.load(new URLRequest(BIG_FILE)); } public function unload():void { try { _loader.close(); _loader.removeEventListener(HTTPStatusEvent.HTTP_STATUS, statusHandler); _loader.removeEventListener(IOErrorEvent.IO_ERROR, errorHandler); _loader.removeEventListener(SecurityErrorEvent.SECURITY_ERROR, errorHandler); } catch(error:Error) { status.text = error.message; } } private function errorHandler(event:Event):void { status.text = "error"; unload(); } private function statusHandler(event:HTTPStatusEvent):void { if(event.status.toString().match(/^2/)) { status.text = "success"; unload(); } else { errorHandler(event); } } ]]> </mx:Script> <mx:Label id="status" /> I tried using ProgressEvents instead, but it seems that some 404 pages return content, so the status event will correctly identify if the page exists. Anyone have any ideas?

    Read the article

  • How to properly close a UDT server in Netty 4

    - by Steffen
    I'm trying to close my UDT server (Netty 4.0.5.Final) with shutDownGracefully() and reopen it on the same port. Unfortunately, I always get the socket exception below although it waits until the future has completed. I also added the socket option SO_REUSEADDR. What is the proper way to do this? Exception in thread "main" com.barchart.udt.ExceptionUDT: UDT Error : 5011 : another socket is already listening on the same UDP port : listen0:listen [id: 0x323d3939] at com.barchart.udt.SocketUDT.listen0(Native Method) at com.barchart.udt.SocketUDT.listen(SocketUDT.java:1136) at com.barchart.udt.net.NetServerSocketUDT.bind(NetServerSocketUDT.java:66) at io.netty.channel.udt.nio.NioUdtAcceptorChannel.doBind(NioUdtAcceptorChannel.java:71) at io.netty.channel.AbstractChannel$AbstractUnsafe.bind(AbstractChannel.java:471) at io.netty.channel.DefaultChannelPipeline$HeadHandler.bind(DefaultChannelPipeline.java:1006) at io.netty.channel.DefaultChannelHandlerContext.invokeBind(DefaultChannelHandlerContext.java:504) at io.netty.channel.DefaultChannelHandlerContext.bind(DefaultChannelHandlerContext.java:487) at io.netty.channel.ChannelDuplexHandler.bind(ChannelDuplexHandler.java:38) at io.netty.handler.logging.LoggingHandler.bind(LoggingHandler.java:254) at io.netty.channel.DefaultChannelHandlerContext.invokeBind(DefaultChannelHandlerContext.java:504) at io.netty.channel.DefaultChannelHandlerContext.bind(DefaultChannelHandlerContext.java:487) at io.netty.channel.DefaultChannelPipeline.bind(DefaultChannelPipeline.java:848) at io.netty.channel.AbstractChannel.bind(AbstractChannel.java:193) at io.netty.bootstrap.AbstractBootstrap$2.run(AbstractBootstrap.java:321) at io.netty.util.concurrent.SingleThreadEventExecutor.runAllTasks(SingleThreadEventExecutor.java:354) at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:366) at io.netty.util.concurrent.SingleThreadEventExecutor$2.run(SingleThreadEventExecutor.java:101) at java.lang.Thread.run(Thread.java:724) A small test program demonstration the problem: public class MsgEchoServer { public static class MsgEchoServerHandler extends ChannelInboundHandlerAdapter { } public void run() throws Exception { final ThreadFactory acceptFactory = new UtilThreadFactory("accept"); final ThreadFactory connectFactory = new UtilThreadFactory("connect"); final NioEventLoopGroup acceptGroup = new NioEventLoopGroup(1, acceptFactory, NioUdtProvider.MESSAGE_PROVIDER); final NioEventLoopGroup connectGroup = new NioEventLoopGroup(1, connectFactory, NioUdtProvider.MESSAGE_PROVIDER); try { final ServerBootstrap boot = new ServerBootstrap(); boot.group(acceptGroup, connectGroup) .channelFactory(NioUdtProvider.MESSAGE_ACCEPTOR) .option(ChannelOption.SO_BACKLOG, 10) .option(ChannelOption.SO_REUSEADDR, true) .handler(new LoggingHandler(LogLevel.INFO)) .childHandler(new ChannelInitializer<UdtChannel>() { @Override public void initChannel(final UdtChannel ch) throws Exception { ch.pipeline().addLast(new MsgEchoServerHandler()); } }); final ChannelFuture future = boot.bind(1234).sync(); } finally { acceptGroup.shutdownGracefully().syncUninterruptibly(); connectGroup.shutdownGracefully().syncUninterruptibly(); } new MsgEchoServer().run(); } public static void main(final String[] args) throws Exception { new MsgEchoServer().run(); } }

    Read the article

  • How do i close the alert dialog that displays custom view

    - by Asdfg
    I have an activity named MainActivity which has a button. On click of that button i am displaying an AlertDialog which contains a custom view named ChildWindow.xml. That custom view has multiple textboxes and a OK button. On click of the OK button, i am calling a method of MainActivity. I am able to access the ChildWindow here as view.getRootView().findViewById(R.id.txtFirstName); Once the user clicks on the OK button, i have to close the alert dialog which i am able to do as view.getRootView().setVisibility(View.GONE); My problem is even though i have closed the the ChildWindow in the above statement, i am able to get reference to the textbox in the next line which means AlertDialog is closed but child window is still there. This is how the OK button click looks like: This works as expected: EditText tb = (EditText) view.getRootView().findViewById(R.id.txtFirstName); Toast toast = Toast.makeText(getApplicationContext(), tb.getText(), Toast.LENGTH_LONG); toast.show(); view.getRootView().setVisibility(View.GONE); This should not work as i am closing the alert dialog and then getting the reference of the textbox but this works too. view.getRootView().setVisibility(View.GONE); EditText tb = (EditText) view.getRootView().findViewById(R.id.txtFirstName); Toast toast = Toast.makeText(getApplicationContext(), tb.getText(), Toast.LENGTH_LONG); toast.show(); I think i am closing the alert dialog but i am not destroying it from the memory. Can someone point me out what am i missing here?

    Read the article

  • how to close a java frame with threads

    - by user261002
    I have a java frame that I want to close it automatically after 3 or 4 seconds. I found out I must used threads. but I dont know how exactly to do it, this a dumy part of my code : package intro; import java.awt.*; import java.io.IOException; //import view.LangMenu; public class IntroClass extends Frame { private int _screenWidth = 0; private int _screenHeight = 0; private int _screenCenterx = 0; private int _screenCentery = 0; //private static final String SOUND_PATH="/sounds/introSound.midi"; public IntroClass() { Toolkit thisScreen = Toolkit.getDefaultToolkit(); Dimension thisScrrensize = thisScreen.getScreenSize(); _screenWidth = thisScrrensize.width; _screenHeight = thisScrrensize.height; _screenCenterx = _screenWidth / 2; _screenCentery = _screenHeight / 2; setBackground(Color.pink); Label lbl = new Label("Welcome To Dots Game. Samaneh Khaleghi", Label.CENTER); add(lbl); setUndecorated(true); setLocation((_screenCenterx*50)/100,_screenCentery-(_screenCentery*50)/100); setSize((_screenWidth * 50) / 100, (_screenHeight * 50) / 100); WaitClass r = new WaitClass(); r.start(); view.DotsBoardFrame d=new view.DotsBoardFrame(); main.Main.showScreen(d); } class WaitClass extends Thread { boolean running = true; public void run() { while (running) { try { Thread.sleep(50); } catch (InterruptedException ex) { ex.printStackTrace(); } } } } }

    Read the article

  • Excel automation: Close event missing

    - by chiccodoro
    Another hi all, I am doing Excel automation via Interop in C#, and I want to be informed when a workbook is closed. However, there is no Close event on the workbook nor a Quit event on the application. Has anybody done that before? How can I write a piece of code which reacts to the workbook being closed (which is only executed if the workbook is really closed)? Ideally that should happen after closing the workbook, so I can rely on the file to reflect all changes. Details about what I found so far: There is a BeforeClose() event, but if there are unsaved changes this event is raised before the user being asked whether to save them, so at the moment I can process the event, I don't have the final file and I cannot release the COM objects, both things that I need to have/do. I do not even know whether the workbook will actually be closed, since the user might choose to abort closing. Then there is a BeforeSave() event. So, if the user chooses "Yes" to save unsaved changes, then BeforeSave() is executed after BeforeClose(). However, if the user chooses to "Abort", then hits "file-save", the exact same order of events is executed. Further, if the user chooses "No", the BeforeSave() isn't executed at all. The same holds as long as the user doesn't click any of these options.

    Read the article

  • Problem with close socket

    - by zp26
    Hi, I have a problem with my socket program. I create the client program (my code is below) I have a problem when i close the socket with the disconnect method. Can i help me? Thanks and sorry for my English XP CFSocketRef s; -(void)CreaConnessione { CFSocketError errore; struct sockaddr_in sin; CFDataRef address; CFRunLoopSourceRef source; CFSocketContext context = { 0, self, NULL, NULL, NULL }; s = CFSocketCreate( NULL, PF_INET, SOCK_STREAM, IPPROTO_TCP, kCFSocketDataCallBack, AcceptDataCallback, &context); memset(&sin, 0, sizeof(sin)); int port = [fieldPorta.text intValue]; NSString *tempIp = fieldIndirizzo.text; const char *ip = [tempIp UTF8String]; sin.sin_family = AF_INET; sin.sin_port = htons(port); sin.sin_addr.s_addr = (long)inet_addr(ip); address = CFDataCreate(NULL, (UInt8 *)&sin, sizeof(sin)); errore = CFSocketConnectToAddress(s, address, 0); if(errore == 0){ buttonInvioMess.enabled = TRUE; fieldMessaggioInvio.enabled = TRUE; labelTemp.text = [NSString stringWithFormat:@"Connesso al Server"]; CFRelease(address); source = CFSocketCreateRunLoopSource(NULL, s, 0); CFRunLoopAddSource(CFRunLoopGetCurrent(), source, kCFRunLoopDefaultMode); CFRelease(source); CFRunLoopRun(); } else{ labelTemp.text = [NSString stringWithFormat:@"Errore di connessione. Verificare Ip e Porta"]; switchConnection.on = FALSE; } } //the socket doesn't disconnect -(void)Disconnetti{ CFSocketInvalidate(s); CFRelease(s); } -(IBAction)Connetti { if(switchConnection.on) [self CreaConnessione]; else [self Disconnetti]; }

    Read the article

< Previous Page | 11 12 13 14 15 16 17 18 19 20 21 22  | Next Page >