w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML videos Categories
Android - Bluetooth Printer not finished printing but throws IOException: Socket Closed
What happpend if you put a Thread.sleep(2000) right before the socket.close()? I work on bluetooth SPP and I had the same issue (Socket close before the end of data transfer). I think that the broadcast of socket.close() is faster than the transmission of the data, then all the data are not analyze by the BT printer when the close request is send

Categories : Android

I have example source for accessing GCM sever without application sever and I try to convert winapi source
Your question is not clear for me. In windows, if you want to access to the Internet(http), you can use WinInet or WinHttp api sets. http://msdn.microsoft.com/en-us/library/windows/desktop/aa383630(v=vs.85).aspx http://msdn.microsoft.com/en-us/library/windows/desktop/aa382925(v=vs.85).aspx

Categories : Java

Main thread closed while the worker thread not finished
You should terminate the workthread safely before the maindlg is destroyed. Here is the answer [Terminating a thread gracefully not using TerminateThread() ]

Categories : C++

Let other class know when data finished downloading
You should use delegates for this purpose. Just google to find details about delegates. Here is a simple tutorial. Basic idea, is to pass a handle of your main view controller to your subclass and the subclass will inform the mainview controller after processing json and send back the results to mainview controller using delegate. Hope this helps.

Categories : IOS

Using data from delegate after NSURLConnection has finished
NSURLConnection works asynchronously. The line NSLog(@"Errorlog %@", del.errorLog); // Returns null is executed before the connection has finished loading (probably before it even started loading).

Categories : Objective C

how to know when listview is finished loading data on android
You should not rely on the condition of "finish loading data", instead, you should set the image view visibility on the fly. You should do something like this in your getView method of your list view adapter. @Override public View getView(int position, View convertView, ViewGroup parent) { final ItemView item; if (convertView == null) { item = mLayoutInflator.inflate(R.layout.listlayout) } else { item = (ItemView) convertView; } ImageView image = (ImageView)item.findViewById(R.id.yourimageidinitemview); if(mTodoTask[posistion].isChecked) { image.setVisibility(View.Visible); } else { image.setVisibility(View.Invisible); } return item; }

Categories : Android

AJAX/PHP – callback after finished loading data
Read the docs http://api.jquery.com/jQuery.ajax/ Use the success callback to append the body and then the complete and error callbacks to clear things up correctly. $("#somebutton").click(function(){ alert("fetching…"); $.post('loadmore.php', { somevariable: somevariable }) .success(function(data){$("body").append(data)}) .error(function(){alert("oh dear")}) .complete(function(){alert("finished loading…")}); }); Remember to always have a fallback for removing the loader - nothing worse than just having a loader and no way to remove it from the page and continue using the application / web site.

Categories : PHP

Finalizing a Cursor that has not been deactivated or closed or database not closed error
When you are done with the cursor, you need to call Cursor.close(). Leaving it not closed leads to memory leaks. E.g.: Cursor cursor = null; try { cursor = getContentResolver().query(myUri, MY_PROJECTION, null, null, null); if (cursor != null && cursor.moveToFirst()) { // moar code } } finally { if (cursor != null) { cursor.close(); } }

Categories : Android

How do I run custom js function when angular js finished retrieving data from the server (and updating the dom)?
If you want to react to only specific interpolation changes (in your case, user.articles) you could set a $watch listener for it in your controller: $watch('user.articles.length', valueChanged); And if you want to run some code only after DOM is changed: var timeout; function valueChanged () { if (!timeout) { // only run doStuffWhenDOMChanged when the $digest loop is finished and call stack is empty: timeout = $timeout(doStuffWhenDOMChanged, 10); } } function doStuffWhenDOMChanged() { //do stuff here... timeout = null; }

Categories : Angularjs

How to save data when a program is closed
I typically create XML files to store parameter fields that require saving. http://www.dotnetperls.com/xmlwriter It works well enough when you've not got sensitive material and you need to get parameters back without much heavy parsing.

Categories : Visual Studio 2010

Application gets closed when terminal is closed, how to stop this?
Use nohup to prevent child processes from being killed when the terminal closes. spawn nohup /usr/bin/firefox https://www.google.com/ I assume there's more to the script, since there's no need to use Expect just to start firefox.

Categories : Python

Select Data From Closed Excel Sheet Using ADO
You should use Excel 12.0 for .xlsx files. Example: Provider=Microsoft.ACE.OLEDB.12.0;Data Source=c:myFoldermyExcel2007file.xlsx; Extended Properties="Excel 12.0 Xml;HDR=YES"; from connectionstrings

Categories : Excel

HttpClient Connection closed in between while data is transferring
finally solved the issue, setting the following header worked for me. method.setRequestHeader("Accept-Encoding", "gzip, deflate"); and postResponse = IOUtils.toString(new GZIPInputStream(method.getResponseBodyAsStream()));

Categories : Java

retrieve excel data from closed workbook with ado
When you attempt to CopyFromRecordset you are already at the end-of-file (EOF) so there is no data to copy. Move the CopyFromRecordset statement earlier in your code, before looping through it. And the argument for this method is a RecordSet object: .CopyFromRecordset objrecordset

Categories : Excel

how to clean the data when the popup window is closed in jquery
You can do $('#popup_box').empty(); to empty the div. if you want to do it after fade animation is over then: $('#popup_box').fadeOut("slow", function(){ $(this).empty(); });

Categories : Javascript

GUI Save Feature so that when the GUI is closed, when it reopens it has the same data visible
You'll want to attach a WindowListener to the FutureValueFrame and monitor for the windowClosing event. When this occurs, you will want to write the settings you want to keep. When the application is loaded, you would simply read these settings in and apply them to your application Check out How to write Window Listeners for more details As for the actual storage, you have a number of options... You could use the Properties API which has save and load functionality, but is based on a simple key/value pair API. You could also use the Preferences API, which has a little more functionality (store primitives), but you lose control over where the data is stored (more or less) The choice will come down to what it is you want to achieve and the amount of work you want to go to

Categories : Java

How to stop Socket to send a lot of useless data when closed?
I think you should use a delimiter character, to tell the Server your Client it's about to die. Add that character of code in onPause method of your Android Activity/Fragment. Then in your Server, just get the String or byte and compare it against your Delimiter String/Character and stop the Server listening for the Connection.

Categories : Android

Windows Phone 8: Updating Live Tile data when app is closed
Does this mean I need to have separate instantiations of this class, one for the main application and the background agent? Yes. You must think of the background agent as a separate application. Though there is ways to share data between your application and your background agent, but the extra complexity isn't worth it in your case. Note that you can share the implementation of your class between the application and the background agent by putting it in a third project (and referencing this project from both the application and the agent).

Categories : Windows Phone 8

extracting all data from database but "attempt to re-open an already-closed object"
You have to close your cursor in get_All_Ex_Data(), after your loop. The thing you open and close in onPreExecute and onPostExecute is the db helper. Edit : is your database helper a singleton ? You have an example of a singleton here: Using Singleton design pattern for SQLiteDatabase

Categories : Android

VBA Copy data from an unopened CSV file to worksheet without opening closed CSV
Assuming that you want to just grab the data and put it in your current workbook. I recorded a macro using the Data -> Import Data method and in VBA and it seems to work with the CSV file closed: Print to consecutive column: Sub Macro1() Dim MyDocuments, strFileName, myToday, file, strConnection As String MyDocuments = Environ$("USERPROFILE") & "My Documents" myToday = Format(Date, "mmddyy") strFileName = "DataFile" & myToday & ".csv" strConnection = "TEXT;" & MyDocuments & "DataFolder" & strFileName With ActiveSheet.QueryTables.Add(Connection:= _ strConnection, Destination:=Range("$A$1")) .Name = "temp" .FieldNames = True .RowNumbers = False .FillAdjacentFormulas = False .PreserveFormatt

Categories : Csv

How can I show a PyQt modal dialog and get data out of its controls once its closed?
Here is simple class you can use to prompt for date: class DateDialog(QDialog): def __init__(self, parent = None): super(DateDialog, self).__init__(parent) layout = QVBoxLayout(self) # nice widget for editing the date self.datetime = QDateTimeEdit(self) self.datetime.setCalendarPopup(True) self.datetime.setDateTime(QDateTime.currentDateTime()) layout.addWidget(self.datetime) # OK and Cancel buttons buttons = QDialogButtonBox( QDialogButtonBox.Ok | QDialogButtonBox.Cancel, Qt.Horizontal, self) buttons.accepted.connect(self.accept) buttons.rejected.connect(self.reject) layout.addWidget(buttons) # get current date and time from the dialog def dateTime(self):

Categories : Python

Client prints Half Data Before Connection is Closed By Server on Socket
try flush data after sent. it needs if you use socket with fdopen FILE *fdsock = fdopen(sock, "a+"); ... fwrite(fdsock, 1, 1 "A"); fflush(fdsock); ... fclose(fdsock); and to finish socket, close with shutdown(sock, SD_SEND); UPDATE Take memset out of loop

Categories : C

How to draw closed spline 3D (closed curve 3d) through unordered list of points3D. How to arrange points3D?
It sounds like you're looking for the Concave Hull of the data set. Unfortunately, I don't know of any pre-canned algorithms, but the link references a paper that another developer was starting from, as well as some sample code, so maybe that'll help you in the right direction.

Categories : C#

Object transfer between client sever
I would look at providing a series of web services (basically these would look like normal http GET or POST commands to the client) that would either respond with XML or JSON formatted responses, the requirements would depend on what you have available on the client I guess (you could do both and use a parameter as part of the request to change the format) Take a look at Web Service for more details. The basic requirement would be to standardise your input and and output in such as way as it would not matter what client you were connecting with This also means that you would be (potentially) communicating via standard ports and the all the messy protocol stuff is taken care for you. Can do this using Tomcat and servlets, which adds another layer between the client and the database. T

Categories : Java

how to group by week (7 days) in sql sever
DATEDIFF(WK, 0, ) should do the trick. SELECT DATEDIFF(WK, 0, MyDate) , COUNT(*) FROM (VALUES ('2013-01-01') , ('2013-01-02') , ('2013-01-03') , ('2013-01-04') , ('2013-01-05') , ('2013-01-06') , ('2013-01-07') ) AS X(MyDate) GROUP BY DATEDIFF(WK, 0, MyDate) EDIT: With date formatting it goes like this: SELECT CONVERT(VARCHAR(5), DATEADD(WK, WK, 0), 103) + ' - ' + CONVERT(VARCHAR(5), DATEADD(DD, 6, DATEADD(WK, WK, 0)), 103) , Cnt FROM ( SELECT DATEDIFF(WK, 0, MyDate) AS WK , COUNT(*) AS Cnt FROM (VALUES ('2013-01-01') , ('2013-01-02') , ('2013-01-03') , ('2013-01-04') , ('2013-01-05') , ('2013-01-06') , ('2013-01-07') ) AS X(MyDate) GROUP BY DATEDIFF(WK, 0, MyDate) ) AS X

Categories : SQL

How to determine the RAM Size of my MongoDB Sever
There is a tool in the later versions of MongoDB to help with finding out how big your working set is, it is still quite experimental but it should work: http://docs.mongodb.org/manual/reference/command/serverStatus/#serverStatus.workingSet The best way to use this is simply to make a automated test script which will use your application and in the meantime print out serverStatus and archive the value of the working set document. You can graph it, etc etc and come to a reasonable conclusion of what your RAM needs to be.

Categories : Mongodb

Sql Sever with spring jdbc template
You can try this SQL String: String sql = "SELECT Mon, "CC Flag" FROM (SELECT *, ROW_NUMBER() OVER (ORDER BY Msisdn)AS RowNum FROM ME_PREPAID) AS MyDerivedTable WHERE MyDerivedTable.RowNum BETWEEN 2 AND 100";

Categories : Java

Simple Client Sever application in C #
After sending a message, you should call the Flush() method: bufferedStream.Write(byteArray, 0, byteArray.Length); bufferedStream.Flush(); // add this line

Categories : C#

Connecting to a SQL Server through another Sever connection that's not linked
You'd need either OPENROWSET or OPENDATASOURCE Found examples here: OPENROWSET: SELECT * FROM OPENROWSET('SQLNCLI', 'DRIVER={SQL Server};SERVER=MyServer;UID=MyUserID;PWD=MyCleverPassword', 'select @@ServerName') OPENDATASOURCE: SELECT * FROM OPENDATASOURCE ('SQLNCLI', -- or SQLNCLI 'Data Source=OtherServerInstanceName;Catalog=RemoteDB;User ID=SQLLogin;Password=Secret;').RemoteDB.dbo.SomeTable

Categories : SQL

SQL Sever(2005) Agent not completing VBS script
Firstly, you should be applying patches monthly when they come out, hence rebooting monthly. The days when people proudly measured uptime in years are gone due to the unfortunately all-too-necessary patch cycle. If you genuinely need 24/7/365 access (hint: unlikely) you need a high-availability setup with clustering or replication. Secondly, I don't think your diagnosis is correct. All objects should be released when the VBScript engine object is destroyed, regardless of whether you released them explicitly. So do you think the FSO is being held in memory? How have you confirmed this? You could in principle use sysinternals Process Explorer check that the associated DLL is unloaded by the SQL server agent process, which will happen usually within a few minutes of the last object bein

Categories : SQL

Spring Framework does not required sever. Is it true?
Yes. You can run a standalone spring application. Your main class will be the entrypoint, you can load the bean definitions using ClassPathXmlApplicationContext. E.g. public static void main() { ApplicationContext ctx = new ClassPathXmlApplicationContext("ctx.xml"); YourService service = ctx.getBean(YourService.class) service.doSomething(); } Then everything in doSomething() can use dependency injection. Update: Since you seem to need to run a webapp without a web server - you can't. You need a servlet container (which would be a 'web server' here). What you can do is use an embedded web server like jetty or tomcat-embedded and launch the process from a standalone app. If by "web server" you mean a remote physical (or virtual machine) - you don't need it - you can install

Categories : Spring

how to find number of files opened in tomcat sever
As the system level, on Linux, you can use lsof. Example (replace TOMCAT_PID with the process Id of your Tomcat process) lsof -p TOMCAT_PID And if you know more specifically what you're looking for, just grep for it: lsof -p TOMCAT_PID | grep /path/to/somewhere EDIT: I've never used it, but on Windows I'd try something like this: http://technet.microsoft.com/en-us/sysinternals/bb896653.aspx

Categories : Java

How to download/install paramiko on any sever from Python script?
An easy way (and scary) would be to define an external bash file with execution permissions: installer.sh #!/bin/sh pip install paramiko I'm assuming pip is installed, but you can concatenate any set of commands in order to install paramiko. Then from your Python file foo.py try: import paramiko except: import subprocess subprocess.call('./installer.sh', shell=True) However installation issues are not subject of your application, you should considerate using distutils to define dependencies in your installation setup.py of your package using the install_requires

Categories : Python

Sendmail in GAE dev sever doesn't show the email body
I ran into this same issue a couple weeks ago. I ended up adding the following VM arguments to eclipse when running the DevAppServer: -Dmail.log_mail_level=WARNING -Dmail.log_mail_body=true

Categories : Eclipse

iOS how to upload a large asset file into sever by streaming
Assuming your data is too big to fit into memory: An effective and reliable approach would utilize a bounded pair of CFStreams (see CFStreamCreateBoundPair). The bounded stream pair's input stream is set to the NSMutableURLRequest's HTTPBodyStream property. The bounded stream pair's output stream will be used to write bytes obtained from a fixed size memory buffer which has been filled with ALAssetRepresentation's getBytes:fromOffset:length:error: method. The size of the bounded stream pair's transfer-buffer should be the same as the size of the buffer for the asset representation. Setting up the code will require a couple lines of code and some experience with NSStreams and handling the events (there are often a few subtleties with NSStreams). This approach works as follows: Creat

Categories : IOS

pass runat="sever" or control of asp.net value to html tags
May be this will help <form > <asp:Label ID="Label1" ClientIDMode='static' runat="server" Text="hello"></asp:Label> <input type="text" name="requestparameter" ClientIDMode='static' id="requestparameter" onclick='SetValue' ><br /> <input type="submit" name="submit" value="Submit"> </form> <script> function SetValue(){ document.getElementById('<%=requestparameter.ClientID %>').value= document.getElementById('<%=Label1.ClientID %>').innerHTML } </script>

Categories : Javascript

Overriding Go's default HTTP Sever redirect behaviour
I'd like to disable this behaviour and handle all paths myself. I'm a Go newbie, and it seems as if I could create my own Server instance and override the Handler attribute, but I'm not sure how to? Instead of registering handlers with the http.DefaultServeMux through the http.Handle or http.HandleFunc methods just call: http.ListenAndServe(":8080", MyHandler) where MyHandler is an instance of a type that implements the http.Handler interface. http.ListenAndServe in turn is just a short-hand method that does the following: func ListenAndServe(addr string, handler http.Handler) error { server := &http.Server{Addr: addr, Handler: handler} return server.ListenAndServe() } so you could do that directly instead as well. Inside your handler you can then parse/route

Categories : Http

The underlying connection was closed: The connection was closed unexpectedly wcf service
The first thing i will do is, instead of returning the full list of candidates i will return an empty list. If that works fine, then it is very clear that the size of the data is a problem. To modify the size play with your binding parameters.

Categories : Wcf

Python Simple Sever and Client script (Socket programming)
while True: client_socket, address =server_socket.accept() print "Connection from ", address data = client_socket.recv(512) print "RECIEVED:" , data This should be: client_socket, address =server_socket.accept() print "Connection from ", address while True: data = client_socket.recv(512) print "RECIEVED:" , data server_socket.accept() will wait indefinitely until a new client is connected. Actually your loop is like : "accept a client and receive one time the data he sent".

Categories : Python

Recursively copy files by file extension to remote sever
Perhaps you can try our grep with ls: scp `/bin/ls |grep '.txt'` user@destination:/path/to/copy/ It will ask for the password only once ;-) UPDATE: for recursive copying, tree can be used (it has to be installed first) scp `tree -if --noreport .|grep ".txt"` user@destination:/path/to/copy/

Categories : Linux



© Copyright 2017 w3hello.com Publishing Limited. All rights reserved.