w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML Categories
Can the Java Metro stack be used in commercial closed source projects?
After some more research I found that the Netbeans framework is licensed with the same construct (GPLv2 and CDDL) and luckily the guys at Netbeans took the time to explain the how what and why a bit: Netbeans license FAQ Here is what they say about dual-licensing: Dual-licensing is the practice of distributing identical software under two (or more) different sets of terms and conditions. When software is dual-licensed, recipients can choose which terms under which they want to obtain the software. The two usual motivations for dual-licensing are business models and license compatibility. [...] Additional search for details about CDDL brought me to this site containing a nice summary: why the dislike for cddl Here is one of the parts relevant that is to my question: CDDL i

Categories : Java

Adding Two Vectors of Different Size: Optimal Run-time and Optimal Memory Management
std::vector<int> c; const size_t minSize = std::min(a.size(), b.size()); c.reserve(minSize); // avoids useless reallocation for (size_t i = 0; i < minSize; ++i) c.push_back(a[i] + b[i]);

Categories : C++

SQL Server convert to optimal short date
not really that hard, if you are using sqlserver 2008+ cast(@date as date) or convert(date, @date) Since you are using sqlserver 2005 CONVERT(CHAR(10), @date, 121) However if you are going to compare with another date, keep the datetime format and remove the time part: dateadd(day, 0, datediff(day, 0, @date))

Categories : SQL

Is there a more optimal way to retrieve multiple values from an XML Column in SQL Server
Try to use XQuery statement FLWOR. It should reduce parsing time. See http://msdn.microsoft.com/en-us/library/ms190945.aspx

Categories : Sql Server

Wordpress sliding drawer plugin doesn't stay closed after converting page to HTML
Is the jQuery script library loading properly? I am doubtful of the src URL of your script at the document head: <script type="text/javascript" src="./jquery.js"></script> These URLs might be the problem. It may work correctly in your local server, but not on a live URL. You may need to change it to "/jquery.js" because the "." refers to the current directory. The "/" right at the start refers to the root URL. <script type="text/javascript" src="/jquery.js"></script> Please try it and let me know the result.

Categories : Javascript

newbie: is it possible to wordpress theme with LAMP stack
Of course it is possible, but it doesn't make any sense and integrating the two platforms would still require a developer and most likely would ultimately be more work (not to mention be a lot harder to update and maintain both from an admin perspective and a development perspective) than simply mimicking the design or functionality of one of the Wordpress theme home pages you like while staying in your current platform and framework. In short, yes it's technically possible, but realistically it doesn't particularly make sense to do so. The only reason I can think you might want to use Wordpress for the home page and your own custom platform for the rest of the site is to avoid paying your developer for more hours to build the homepage on your platform, but integrating Wordpress with your

Categories : Wordpress

How to know if the last closed activity was the last activity in the stack in Android?
Maintain the activity stack of your application. You can achieve this by many ways: If your application has multiple entry points, then you can track which activities your user has opened and where they currently are, and accordingly when the the stack is pushing out its last item, pop the service. If your app doesn't have multiple entry points, then you can just monitor the onStop of your Launcher activity. If you want to also stop your service while multi-tasking, you'll have to be more creative with intents and sending a few flags as payloads. Maybe stop the service onStop if a flag isn't set by starting another one of your activities.

Categories : Android

When should SQL server connection be closed in a script?
You don't have to do them at all. After header('Location... you should use exit immediately. Open connections are closed when the script exits automatically. You could manually close them and use exit after that, though. You only need to worry about manually closing the connections if you're running out of connections during long-running scripts, but you may have other problems at that point.

Categories : PHP

.NET SQL Server connection being prematurely closed
The simplest thing to do would be to check the connection state and open it if necessary: if(conn.State == ConnectionState.Closed)//Can't quite remember the exact syntax { conn.Open(); } //do DB stuff here.

Categories : Sql Server

TCP server socket is closed if i switched to another app
In android, the decision whether to keep your app running or not depends a lot on the existence of a Context whether it is an Activity, Service or BroadcastReceiver. According to android's documentation: An empty process is one hosting no activities or other application components (such as Service or BroadcastReceiver classes). These are killed very quickly by the system as memory becomes low. For this reason, any background operation you do outside of an activity must be executed in the context of an activity BroadcastReceiver or Service to ensure that the system knows it needs to keep your process around. So what do you want to do is starting a service once your activity is started and from that service spawn a thread that will manage the TCP server. that way you will be fine as l

Categories : Java

SQL Server session stays open when application is closed
Entity framework uses the underlying SQL Server ADO.NET provider which pools database connections as they are an expensive operation to create and flush each time. You can flush the connection pool using a SqlConnection.ClearPool method call on your Application_End event handler. Note: I would not recommend disabling or flushing the connection pool for production code. An alternate method for development can be to modify to disable pooling via you connection string using the Pooling=false option.

Categories : C#

determine if client has closed connection to server using socket
Here is some code I believe can be used to detect exiting socket... Originator of this code was stated as Andrew Gillard no other licence information was available... <?php $host = '127.0.0.1'; $port = 7010; gc_enable(); set_time_limit(0); function socketError($errorFunction, $die=false) { $errMsg = socket_strerror(socket_last_error()); echo $errorFunction.' '.$errMsg." "; if ($die) die("Program Ended "); } //Attempt to create our socket. The "@" hides PHP's standard error reporting, if (!($server = @socket_create(AF_INET, SOCK_STREAM, SOL_TCP))) socketError('socket_create', true); //socket_set_option($server, SOL_SOCKET, SO_REUSEADDR, 1); if (!@socket_bind($server, $host, $port)) socketError('socket_bind', true); if (!@socket_listen($server)) socketError('socket_list

Categories : PHP

Fatal: Server unexpectedly closed network connection
The command is working fine for me. However, your question suggests that you're trying to connect to an FTP server. WinSCP can handle both SCP/SFTP and FTP connections, but to my knowledge psftp supports only SFTP (a file transfer protocol based on SSH, not to be confused with FTPS). If your server is not an SSH server, you need an FTP client for the data transfer (e.g. ftp.exe shipped with Windows). If your server is an SSH server, try running psftp with the option -v to get more information, and also check the logs on the server.

Categories : Powershell

application crashes if the server is closed due to timeout. How can I catch it?
Please try the following public String getData(String url) { HttpClient httpclient = new DefaultHttpClient(SetHttpParams.setHttp( 50000, 50000)); HttpGet httpget = new HttpGet(url); HttpResponse response; try { response = httpclient.execute(httpget); if (response.getStatusLine().getStatusCode() == 200) { org.apache.http.HttpEntity entity = response.getEntity(); if (entity != null) { InputStream instream = entity.getContent(); String res = Functions.convertStreamToString(instream); } } } catch (ConnectTimeoutException e) { } catch (SocketTimeoutException e) { } catch (IOException ex) { } } String res is your string where the response will be stored

Categories : Android

Server dies on `send` if client was closed with Ctrl+c
When you call send() on an already closed connection, the operating system may issue SIGPIPE to your process. Usually the default handler for SIGPIPE is to kill your process. In order to prevent this from occurring, you can either ignore the signal (e.g., with signal(SIGPIPE, SIG_IGN) or sigignore(SIGPIPE)), or you can pass the MSG_NOSIGNAL option to send(): int send_result = send(newfd, ok, 3, MSG_NOSIGNAL); if (send_result >= 0) { /* okay, but check if all your data got sent! */ if (send_result < 3) /* ...do something */; } else { switch (errno) { /* ... */ case EPIPE: /* sending on a closed connection... */ } } Now, instead of issuing SIGPIPE, the send() call will fail, and errno will be set to EPIPE.

Categories : C

Run a python socket server and if closed remotely start it listening again
The way you usually program a threaded socket server is: call accept() in a loop spawn a new thread to handle the new connection A very minimal example would be somethig like this: import socket import threading import time server = socket.socket(socket.AF_INET, socket.SOCK_STREAM) server.bind(('0.0.0.0', 9999)) server.listen(1) def handle(conn): conn.send(b'hello') time.sleep(1) # do some "heavy" work conn.close() while True: print('listening...') conn, addr = server.accept() print('handling connection from %s' % (addr,)) threading.Thread(target=handle, args=(conn,)).start() You're spawning new threads in which you create your listening socket, then accept and handle your connection. And while socketIsOpen is True your programm will be using a lot of

Categories : Python

Catch the exception thrown at client side when the server closed the pipe
the most common way to know that the other side is dead is the "echo": once in a while(let's say every 10 seconds) the client sends an "echo" - meaning a simple request to the server to get replay. if 3 echo in a row(could be more, depend on you) did not answered by the server, the client decide that the server is down and disconnect his side

Categories : C#

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

Wordpress blog hitting several CPU process on hostgator server than the limit, causing 500 server error
Your problem is most likely related to the underpowered or over-provisioned HostGator shared servers. Since their purchase by EIG last year, they've migrated customers to new hardware, and from my experience (I host 40+ WP blogs with them) this new hardware or provisioning rules has created poor performance for any site that relies on MySQL such as WordPress. Shared hosting is always a gamble as you rely on the hosting provider to manage the number of accounts, and the performance as a whole. I've hosted with HG for years and they've been great, but since late 2013 the performance has been atrocious. Caching is only a band-aid, as the core problem is MySQL performance and the over-crowding of the server. Find another (non EIG) shared web host, or upgrade to a VPS to give you more cont

Categories : Wordpress

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

Two service stack APIs on the same IIS server
You should be able to setup two different applications in IIS as long as they run under different application pools. This will adhere to the guidance in the above linked answer of one single App Host for each App Domain. It is not different from managing different applications (non ServiceStack) applications in IIS.

Categories : C#

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

Glassfish server stack traces not clickable in Eclipse WTP
We have reproduced the problem and filed a bug on GlassFish Tools. You can monitor for future releases on OEPE forum. https://forums.oracle.com/community/developer/english/development_tools/application_development_in_java/enterprise_pack_for_eclipse

Categories : Eclipse

Apache Server can't turn off (EnterpriseDB Installation with Stack Builder)
To restart EnterpriseDB Apache, I did sudo /Library/PostgreSQL/EnterpriseDB-ApachePHP/apache/bin/apachectl graceful Explanation: On my machine this exact problem was because the apachectl was still default Mac OS X. This can be verified by doing which apachectl To which I got the response: /usr/sbin/apachectl This is the default apache in Mac OS X, not the Enterprise DB one. I did not want to mess with system paths so I left this one alone. You can also create aliases to if you bounce apache often.

Categories : Apache

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#

How to set a DB connection timeout for a python/pyodbc/unixODBC/MS ODBC Driver 11 for SQL Server/Linux stack?
http://stackoverflow.com/a/12946908/1552953 This answer refers to being able to set a timeout on the connection: Timeout An optional integer query timeout, in seconds. Use zero, the default, to disable. The timeout is applied to all cursors created by the connection, so it cannot be changed for a given connection. If a query timeout occurs, the database should raise an OperationalError with SQLSTATE HYT00 or HYT01. Note: This attribute only affects queries. To set the timeout for the actual connection process, use the timeout keyword of the pyodbc.connect function. result = None with pyodbc.connect('DRIVER={SQL Server};SERVER=mydb;DATABASE=solarwinds;Trusted_Connection=True', timeout=1) as cnxn: cursor = cnxn.cursor() result = cursor.execute(que

Categories : Python

Heroku and NodeJs - MySql Connection lost: The server closed the connection
You already seem to know what is happening; the MySQL server is closing the connection. Many database services, including ClearDB, to do this (ie, close inactive connections). You're going to have to detect the disconnect event, and recreate the connection. There are instructions in the node-mysql documentation for doing this.

Categories : Mysql

Node.js + setInterval = Connection lost: The server closed the connection
Looks like you're keeping an open connection to a remote MySQL server. The remote server is closing the connection after 8 hours of idle connection. So you have two options. Either you send a keepalive request or you disconnect after your initial request and then open the connection again when timer initiates the next event. Keepalive If you want to send a keepalive request, simply setup a select 1 on an interval timer. select 1 is just a simple query that will cause MySQL to return a result of 1 and reset the MySQL server's connection timeout. It would look something like this. function keepalive() { connection.query('select 1', [], function(err, result) { if(err) return console.log(err); // Successul keepalive }); } setInterval(keepalive, 1000*60*5); Pooling Howeve

Categories : Javascript

How can we write a function List multiPop(int k) that pops k elements from the stack or until the stack is empty?
Translate the following concept in to Java: create a list to store the popped members in. while (the stack is not empty and we have to pop more elements) { add a popped member from the stack to the list } return the list. Done

Categories : Java

Disadvantages of increasing Stack Size and difference between Stack Commit and Reserve
The OBVIOUS consequence of increasing the stack-size is more memory usage. Since the stack isn't enormous in comparison to overall memory in most cases, it's not a big issue. Obviously, if there are many threads using large stacks each, then that can amount to a large amount of the available memory in the machine - particularly if the machine hasn't got huge amounts of memory in the first place. "Reserved" space is allocated but not actually physically present until it has been "touched" - in other words, the physical memory space is not allocated for the stack here - just some space taken out of the virtual memory map for the allocation (so, if you are tight on virtual space because your application needs as much memory as it can get in a 32-bit environment, then it may still be a fact

Categories : C++

Is the vim clipboard a stack? If yes, how can I paste copied data from that stack?
I wouldn't say it is a stack. it works like stack ( for deletion) . I think you need to take a look "numbered registers". Vim has 0-9 numbered registers. If you think it as a stack, the size of the stack is 9 (1-9) for deletion. Yanked things were stored in register 0 and "", no stack structure. I said it works "stack like" but not stack (for deletion) because, with stack data structure, you could not randomly fetch element. you can just pop or push. but with vim's register, you could get any (0-9) element by "1 "3 "5 for example, and keep the "stack" without changing. read :h registers for detail.

Categories : Vim

How to find the call stack when there is just a corrupt stack corefile?
Displaying the call stack requires correct instruction pointer (eip), stack pointer (esp) and valid stack contents. From your output it looks like the stack had been corrupted and the previous function returned to some random address (eip=0x04229c7a). So, you are out of luck. Try running your program under valgrind.

Categories : C

Column stack and row stack with H5py to existing datasets
After rereading some of the documentation on H5py, I realized my mistake. Here is my new script structure that allows me to stack arrays in the HDF5 file: import h5py import numpy arr1 = numpy.random.random((2000,2000)) with h5py.File("Plot0.h5", "w") as f: dset = f.create_dataset("Plot", data = arr1, maxshape=(None,None)) dsetX, dsetY = 2000,2000 go = "" while go == "": go = raw_input("Current Size: " + str(dsetX) + " " + str(dsetY) + " Continue?") arr2 = numpy.random.random((2000,2000)) with h5py.File("Plot0.h5", "r+") as f: dset = f["Plot"] print len(arr2[:]) print len(arr2[0][:]) change = "column" dsetX, dsetY = dset.shape if change == "column": x1 = dsetX x2 = len(arr2[:]) + dsetX

Categories : Python

stack columns in dataframe, and also stack index column
Is this what you're after? In [11]: df1 = df.set_index(['aware', 'aware_2', 'aware_3', 'resp']) In [12]: df1.columns.name = 'heading' In [13]: df1.stack() Out[13]: aware aware_2 aware_3 resp heading 1 0 1 1 respondent a brand volvo engine p country swe age 23 volvo True 0 0 1 2 respondent b brand volvo engine None country swe age 45

Categories : Python

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

Stack by pointers in C working except at stack underflow
When you create the stack you allocate space for a node -- and don't fill it with anything. So after the call to create_stack() you have a blank node on your stack already. I guess you don't want that, doing just void create_stack(stack_node **top, int *status) { *top = NULL; *status = PUSH -1; } will work just fine. You allocate the memory during the push() call anyway any you check for top_stack == NULL during the functions. Alternatively you could have a flag in your stack node to indicate it's not used (then during push you'd not create a new one) but that's too complex for what you want here.

Categories : C

Wordpress - after upload on server 404 on all pages, no css
You need to double check everything, first: Flush the rewrite rules by visiting settings->permalinks then try your pages. Then try: List item login to phpmyadmin for each domain, check out the database... options table... verify the "siteurl", and "home" columns. make sure they match the respective domains. Then try: List itemCheck the DNS zone template. Could very well be possible DNS conflicts.

Categories : CSS

Moving Wordpress site to new server same URL
Use phpmyadmin on the new host to check the table prefixes of the imported database. The "new install" issue means wp-config.php isn't reading the correct database tables. Or, open the database dump and check the database table prefix. And, of course, be sure your database name, user and password are all correct in the new wp-config.php. If you are not changing the domain, there is no need to change URLs in the database. If you do change domains, use http://interconnectit.com/products/search-and-replace-for-wordpress-databases/ to correctly change URLs in plain and serialized data.

Categories : Mysql

Wordpress - writing data to SQL Server
Beside your MySQL Database Connection, that stores all relevant Wordpress data, you need a special connection to your MSSQL Database. You need to setup your PHP Enviroment and make sure that php_mssql extension is installed and activated. I am not sure, if there is a Wordpress MSSQL PDO Database wrapper you can use for your needs, but one way is to make the queries by yourself: Get details from wooComerce Open MSSQL Database Connection: http://php.net/manual/en/function.mssql-connect.php Save Data: http://php.net/manual/de/function.mssql-query.php Close MSSQL Database Connection: http://www.php.net/manual/en/function.mssql-close.php

Categories : PHP

Wordpress installation not get completed in Wamp server
Wordpress is normally a breeze to install. Have you read this Famous 5-Minute Install and the pre-requisites on the same page.

Categories : Wordpress



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