w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML videos Categories
Node.js requests randomly begin to hang and won't clear until server restart
After countless hours of debugging and more debugging, I finally found the culprit. An error was being thrown inside of several different mongojs callbacks, which appears to have bubbled up and blocked the connections from closing. Over time, this got to a tipping point and connections started hanging until the file descriptor limit was reached. The error turned out to be in the Now.js node module (which has been abandoned). If there is anyone out there that is running into this issue using Now.js, I forked it and patched the bug. You you can find the commit here: https://github.com/goldfire/now/commit/b5bd54f8950602f752a710c606be6754b759cab2. The way I found this bug was to attach an error listener to the DB object: var db = require('mongojs').connect('...', ['collection']); db.client.

Categories : Javascript

How to set max file size in Linux CeNTOS to server.log
You can use logrotate to deal with log files. It allows automatic rotation, compression, removal, and mailing of log files. Each log file may be handled daily, weekly, monthly, or when it grows too large. It has a size option, so you can configure it to stay under 500MB for your "server.log"

Categories : Linux

Sending the data to the server through post when internet connection comes back
How about storing the data temporarily inside a SQLite database or shared preferences file? You could do something like this to check if the connection is available private boolean isNetworkAvailable() { ConnectivityManager connectivityManager = (ConnectivityManager) getSystemService(Context.CONNECTIVITY_SERVICE); NetworkInfo activeNetworkInfo = connectivityManager.getActiveNetworkInfo(); return activeNetworkInfo != null && activeNetworkInfo.isConnected(); } I would create an Android Service that does this check in the background every few seconds/minutes and does the post if the connection is available.

Categories : Android

What exception is called on internet connection lost while getting data from server?
General approach to this type of problem: Write (temporarily) a catch all style code and write the type of exception somewhere. Test it by knowingly raising the given exception (in your case you can interrupt the connection to the internet). After you have seen the type of the exception you can return to your code and instead of the catch all style code handle the specific exception. Cheers

Categories : Android

How can I send http messages from android app( physical device) to my local server without using internet connection?
Assuming that your devices are on the same Network (connected to the same router) as your computer, you can expose your computer's web server (Apache, presumably?) and then point your app directly at the local network IP address that your computer has (usually something like 192.168.1.x). I have found that the least painless way to do this is to use MAMP or WAMP or LAMP depending on your OS, but of course I have no idea what your specific situation is, so that solution may in fact make things a lot more complicated rather than less. In any event... your computer is on the network at a specific IP address, so it's just a matter of making sure that it's willing to serve this data on whatever port you are looking for it on. If you provide more specification as to your circumstances, we can

Categories : Android

Can android differentiate between a lost internet connection and no internet connect?
You need to use a BroadcastReceiver that will be triggered when the connectivity status for Wi-Fi has changed. Set following things before registering BroadcastReceiver: private class ConnectionChangeReceiver extends BroadcastReceiver { public void onReceive( Context context, Intent intent ) { Log.d(tag, "Inside Broadcast Reciever"); CheckWifiStatus(); } } private void RegisterWifiWatcher() { if(wifiWatcher == null) wifiWatcher = new ConnectionChangeReceiver(); final IntentFilter intentFilter= new IntentFilter(); intentFilter.addAction("android.net.wifi.WIFI_STATE_CHANGED"); intentFilter.addAction("android.net.wifi.STATE_CHANGE"); registerReceiver(wifiWatcher, intentFilter); } WIFI_STATE_CHANGED : Broadcast intent action indicating that Wi-Fi has been enabled,

Categories : Android

No internet access on Android Emulator, Shared Internet Connection
Finally I sorted out my problem. It was problem due to dns server address. I did below steps open CMD Goto your android-sdk/tools path, Like my path is G:Andriod Developmentandroid-sdk ools type this command G:Andriod Developmentandroid-sdk ools>emulator.exe -avd Android_2.3.3 -dns-server 8.8.8.8 -scale 0.75 here Android_2.3.3 is your AVD name, -dns-server 8.8.8.8 will set your DNS address to 8.8.8.8 or 8.8.8.8:55 and -scale will scale your AVD to specified value. this will start a new emulator. Enjoy :) Hope may be helpful to others

Categories : Android

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

IIS Express Internet Explorer cannot display the webpage ... until restart
I have faced the same issue in a perticular scenario. It was like, Page_Load event of 1st page contains code to redirect response to 2nd page and Page_Load event of 2nd page contains code to redirect response back to 1st page. So due to this browser response fell into infinite loop and it shows message: "Internet Explorer cannot display the webpage". So I'll suggest you to check the response redirection logic which may be causing problem.

Categories : Asp Net

What is the equivalent switch to /MT (VC++) for g++ in linux (CentOS)?
I'm guessing that you mean that your users have to install Intel Threading Building Blocks (TBB) on their Linux machines. If you're using the Intel TBB functionality and your clients have to compile your source code then they need to have Intel TBB installed. An alternative approach would be to compile the source code for your clients and only supply them with your solution binaries and not the source code - then they would not have to install TBB.

Categories : C++

Problems installing R on Linux CentOS 6.3
Hi You can install the missing packages by downloading rpm and install using rpm command libjpeg.so.62 and kernel-headers To install .rpm package use the following steps rpm -iv package.rpm Try yum install R After that. :)

Categories : R

How to check host connection with internet connection
use this method : public static boolean isInternetConnected(Context context) { final ConnectivityManager conMgr = (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE); final NetworkInfo activeNetwork = conMgr.getActiveNetworkInfo(); final Dialog dialog = new AlertDialog.Builder(context).setIcon(R.drawable.ic_launcher).setTitle("Connection Error!!") .setMessage("Internet Connection not found. Check your settings.").setNegativeButton("ok", null).create(); if (activeNetwork != null && activeNetwork.isConnected()) return true; else dialog.show(); return false; } If you don't want to show the toast comment it. Don't forget to place permission in manifest file. Here is the permission : <uses-permission a

Categories : Android

How can i remove Python modues from Linux in centos
I had a similar problem on Mac (Lion 10.7.5). I just linked the libmysqlclient.18 like this: sudo ln -s /usr/local/mysql/lib/libmysqlclient.18.dylib /usr/lib/libmysqlclient.18.dylib I hope it helps

Categories : Python

Invalid configuration i686-redhat-linux-gnu on CentOS
i also run into the same problem, according to qmailtoaster installation script the command suppose to be rpmbuild --rebuild --with cnt5064 vqadmin-toaster-2.3.7-1.4.1.src.rpm built it has the same error msg as above and I Google around and found out vqadmin build error many of our programs are running automake versions that PREDATE 64-bit linux... and while most apps will build just fine (albeit less optimized), vqadmin 2.3.7 does NOT build successfully in this "unknown-linux" environment. He offers a x86_64 rpm at the bottom

Categories : Linux

Executing Linux-CentOS Command Line via PHP codings
Check your php.ini. The exec command probably is given in the disable_functions string. Remove it from this option. If it is forbidden by safe_mode you probably can turn it on by: php_admin_value safe_mode off in your webserverconfig (httpd.conf) For both methods reload/restart your apache/web-server to load the new configuration.

Categories : PHP

what is significance of "Mlocked" in /proc/meminfo file in Linux (CentOS)
mlock(2) and related syscalls enable (privileged) programs to lock virtual memory segment into physical RAM. It is rarely used. I guess the Mlocked line of /proc/meminfo is measuring this (probably system-wide cumulative). See proc(5)

Categories : Linux

Installing subversion under /apps other than /var/www/ is not working. Centos Linux version
In the httpd.conf file your Document Root Section probally says <Directory "/var/www"> Also you can give apache ownership of that directory but only if such is placed in the document root. (If I understand you this may not work for you) chown -R apache.apache /apps Apache can access items outside the root but that is soemthing I am not familiar with and you can look into the apache Alias EDIT As the comment under your OP says SVNADMIN should be able to create the repo and you should be able to hit it. mkdir /app/svn svnadmin create /app/svn/testrepository chown svn:svn -R /app/svn Subversion also is very nice about keeping space low since it only stores revisions to projects instead or brand new versions each time. EDIT Setup Walkthrough - Posted in comments

Categories : Svn

Created a java test script in eclipse, how do i run it in a headless linux CentOS VM?
People usually use either PhantomJS or "Headless Chrome" to run in a headless environment. Also, some people run regular browsers from a XVFB framebuffer. Here is a blog article that I found that explains how to install XVFB. xvfb-run --server-args='-screen 0, 1024x768x16' google-chrome -start-maximized http://example.com > /dev/null & Using XVFB and VNC, you could probably login remotely and watch your tests run on the headless box but I haven't tried this. You would have to experiment with it.

Categories : Java

unable to install jdk-7u25-linux-i586.rpm on Centos 6 - unpack200 error
Sounds like you have a 64-bit machine, and you're trying to install the 32-bit version of Java. To do that, you'll need to install the libgcc.i686 package to get the 32-bit runtime libraries. Not sure why you don't already have them.

Categories : Java

Get OS name with C [Linux, portable for distros: Centos, Debian, Fedora, OpenSUSE, RedHat, Ubuntu]
You could try to use popen(3) to run and read the output of command /usr/bin/lsb_release -ds. If that fails, you might read and parse /etc/issue Notice that clever or paranoid sysadmins might edit and configure that /etc/issue file at will. But I don't understand why you want to know all that (from inside a C program), in other words, why the uname syscall is not enough. In particular, there are a lot of Debian (or Redhat) derived specialized distributions, and I don't understand why the name of the particular distribution would matter to a C program. It matters much more for packaging purposes....

Categories : C

Connection lost after query runs for few minutes in PostgreSQL
My guess, reading your problem, is that you are hitting out of memory issues. Craig's suggestion to turn off overcommit is a good one. You may also need to reduce work_mem if this is a big query. This may slow down your query but it will free up memory. work_mem is per operation so a query can use many times that setting. Another possibility is you are hitting some sort of bug in a C-language module in PostgreSQL. If this is the case, try updating to the latest version of PostGIS etc.

Categories : Postgresql

Randomly Getting ExecuteNonQuery requires an open and available connection
You can check if you connection still open before execute query if (sqlCon.State == System.Data.ConnectionState.Open) { insCmd.ExecuteNonQuery(); } else { sqlCon.Open(); insCmd.ExecuteNonQuery(); } }

Categories : C#

I have to restart my Java socket connection for multiple file transfer
Try flushing just after output.write(buffer, 0, bytesRead); If this still doesn't work I found mine server/client works best with objectoutputstreams that you use in the the following way. oos = new ObjectOutputStream(socket.getOutputStream()); ois = new ObjectInputStream(socket.getInputStream()); // always call flush and reset after sending anything oos.writeObject(server.getPartyMembersNames()); oos.flush(); oos.reset(); YourObject blah = (YourObject) ois.readObject();

Categories : Android

what does openerp-server do after I restart server with the para--update?
you tend to use this in development along with a database parameter -d. This means that openerp will connect to the database and then update this module. Note that it is update only, it won't install. If other modules depend on the module being upgraded they will also be upgraded. You can also pass in a comma separated list of modules.

Categories : Postgresql

Linux: What programs are accessing the Internet?
Using netstat -an you will see which ports that are in a connection at the moment. If you want to see which process that is connected to a certain, port 80 in this case, you can use lsof -i tcp:80 Well, you need to be root, of course.

Categories : Linux

Why does LocationListener need an internet connection
No Getting GPS doesn't need internet necessarily. But Getting correct coordinates using GPS in a stable, working and compatible way is a mess. Often you switch between providers and make use of internet to give good estimates IF GPS isn't responding very well. Make sure GPS is working and found a nice signal, because the internet can increase GPS initializing speed. GPS is really slow to load. It may take 6 to 8 minutes, especially if coverage is poor. Only after the GPS has actually determined its position. During the first few minutes you won't see anything, since no updates have occurred. Maybe you use NETWORK_PROVIDER in stead of GPS_PROVIDER. Like this locationManager.requestLocationUpdates(LocationManager.NETWORK_PROVIDER, 0, 0, locationListener); Try using: locationManage

Categories : Android

Using svn on an unreliable internet connection
As far as I know, there aren't any commands that are connection-resilient. You could checkout the source code piecemeal, one folder at a time using sparse directories, but unfortunately you might still receive errors: svn co the folder structure: svn checkout http://svn.apache.org/repos/asf/subversion/trunk --depth immediates Then svn up each folder in turn: svn up --set-depth infinity build svn up --set-depth infinity contrib etc. And then set the depth of the parent folder to infinity so that subsequent updates retrieve changes for every folder, recursively: svn up --set-depth infinity A bit unwieldy, but it might reduce your frustrations with your unreliable internet connection.

Categories : Svn

How to check internet connection with c?
InetnetCheckConnection causes linking error because you probably(certainly) didn't link Wininet.lib http://msdn.microsoft.com/en-us/library/windows/desktop/aa384346%28v=vs.85%29.aspx

Categories : C

Is this possible to use recaptcha without internet connection
Recaptcha is a service. Each request is handled by a foreign server, so no chance without an internet connection. btw: A website without internet connection is not a real scenario ;) If you use external services, you must have a chance to reach them.

Categories : PHP

Best approach to doing something once an Internet connection becomes available
This is roughly based on your "best idea". Tony Million's Reachability also posts notifications via NSNotificationCenter when the internet connection changes. All your classes that need to do something when an internet connection becomes available, should register for this notification. On the GitHub page there is an example for that: https://github.com/tonymillion/Reachability#another-simple-example You would initialize the Reachability class in your app delegate, like you do right now. And then your other classes register for the kReachabilityChangedNotification notification with the NSNotificationCenter in their initializer. They also have to deregister from the NSNotificationCenter in their dealloc method. Here is some code you can use as starting point: - (void)registerForReachabi

Categories : IOS

Check for Internet connection in C++?
Personally I think I would solve this in one (or a combination) of the following two approaches. Make a timer with a callback function that checks internet connectivity every x second. Simply check internet access before every communication block and raise an exception if no access is available at given time. You might want to read a similar discussion for C# How to query internet connection status in C# ?

Categories : C++

How to work when internet connection down?
HTML5 has some offline capabilities. http://www.html5rocks.com/en/features/offline But do you really have a business case for this? It will get complicated when you need to try and update stale data etc.

Categories : Asp Net

PHP modules on CentOS Server - Which ones do I need?
I may not have the complete list, but here would be some suggestions: php-mysql php-pdo php-pear php-pecl php-xml If I were you, however, I would install the PEAR package manager, and install all your required extensions or modules from that. Seems like that would be easier to manage all your php libraries from a single source, because I would bet that at some point you'll want to use a php library that's not available via your yum repository.

Categories : PHP

expecting a change of internet connection
You should use this ((Activity) context).startActivityForResult(i, 0); then you can use onActivityResult in your Activity1 @Override protected void onActivityResult(int requestCode, int resultCode, Intent data) { super.onActivityResult(requestCode, resultCode, data); //Check result }

Categories : Eclipse

SQL Connection Over Internet: good practice?
No, exposing your SQL server over the internet is not a good idea. That doesn't stop you from doing it, but: I wouldn't recommend it, unless the data is freely available and public domain (so it doesn't matter if someone gets access to more than you expected), and is trivial to replace (so it doesn't matter if it gets damaged). And even then I'd probably suggest using a service tier and keeping your database server strictly on the "inside". Re encryption: that prevents intermediaries from snooping, but it doesn't limit what the user can do. A malicious user with genuine access could simply connect up and do whatever they want, bypassing whatever rules and filters you have in place.

Categories : C#

Check if device has internet connection
Put this method in the class you want to check connectivity: public static boolean isOnline(Context context) { ConnectivityManager cm = (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE); NetworkInfo netInfo = cm.getActiveNetworkInfo(); if (netInfo != null && netInfo.isConnected()) { return true; } return false; } Then when you need to check connection, do this (using your example): if(isOnline(getApplicationContext()){ webview.loadUrl("http://the.url.com") } else{ Toast.makeText(context, text, duration).show() } You can also create that method in a class and always use it from there, like ExampleClass.isOnline(). Do not forget to add this to your AndroidManifest: <uses-permission android:name="android.permissi

Categories : Java

Phonegap check internet connection
You can check the connection like this: function CheckConnection() { if( !navigator.network ) { // set the parent windows navigator network object to the child window navigator.network = window.top.navigator.network; } // return the type of connection found return ( (navigator.network.connection.type === "none" || navigator.network.connection.type === null || navigator.network.connection.type === "unknown" ) ? false : true ); } returns true for connection and false for no connectivity. In Android Manifest, use the following permission: <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /> <uses-permission android:name="android.permission.INTERNET" /> Edit: Handles windows in iframes as well. Added a

Categories : Android

iOS app freeze during checking internet connection
When you are requesting to the server then reduce the timeoutInterval option and set it to minimum so that request should not wait for long to get the response by this way you can reduce the time of freezing the app. If you want to get rid of it completely then you should run all the process for network check in on another thread possibly in background thread.

Categories : IOS

Socket connection works over LAN but not WAN (internet)
Is this using TCP or UDP? TCP What does this mean for what I am trying to do. Does anyone have any tips about how to get this to work? See below. Is it a matter of the port not being open? Most likely, but you should be able to get more detail from your IOException to confirm the cause. In this question I have answered provided details on port forwarding that you may find useful; C++ Sockets with Router You may also need to configure a firewall to allow ports external access depending on your environment.

Categories : Java

Best UI design to handle no internet connection
There can be several options Option 1: Use AlertDialog to show the disconnection. Set it to non cancelable and with two buttons like retry and exit. Option 2: start disconnection activity using start activity for result if the network disconnection occurs. In the new activity there is a retry button. If retry is set the set OK and finish. And if back button press set CANCEL. now in first activity in onActivityResult if you get RESULT_OK then retry connection.

Categories : Android



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