w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML videos Categories
DB Connection in mongo-db native client
Try using the singleton pattern: In your main express app.js connect to the database and create the database instance: var Database = require('database.js'); ... mongodb.connect(config.dbAddress, function (err, db) { if(err) { return console.log('Error connection to DB'); } Database.setDB(db); app.listen(config.appPort); }); Then in any other file you need to use the database require database.js again: var Database = require('database.js'); ... ArticleProvider = function() { this.db = Database.getDB(); }; ... Finally the database.js file follows the singleton pattern: /** Database Singleton Object database.js is used throughout the app to access the db object. Using mongodb native drivers the db object contains a pool of connections that are used to make reque

Categories : Node Js

Client Socket Connections Being Denied By Server on Windows Host For Small Number (16 < x < 24) of Simulataneous Client Connection Attempts
I would check how many connections are in the TIME_WAIT state of the TCP connection. I have seen this type of problem due to many connections being open/closed causing socket exhaustion due to the TIME_WAIT. To check it, run: netstat -a

Categories : Java

zeromq: PULL/PUSH client crashes after upon connection of 31. server on windows
Ok. I pinned it down to this issue here. The problem is, that on windows by default there is a FD_SETSIZE limit of 64. (This makes the code crash - actually for the 32. worker). FD_SETSIZE can be modified during building 0mq (CPPFLAG="-DFD_SETSIZE=1024"). Now the crashes are gone.

Categories : C++

C# HttpListener and Windows Firewall
This is because HttpListener is built on top of http.sys which will listen on the port you specified on behalf of your program. I haven't found a way to allow only a single program using HttpListener through the Windows Firewall, but you might want to limit your inbound rule to system components only by: Entering typing system in the field "This program" in the tab "Program and services" Selecting protocol type TCP in the tab "Protocols and Ports" together with the port you will be listening on

Categories : C#

Windows Firewall inbound rules and environment PATH variable
Despite setting the inbound firewall rule to allow any connections to 'java', hoping it would pick up the environment PATH value, I still couldn't get the connection working. In the end changing the jenkins.xml file to not use the 'java' PATH variable and instead use 'C:Program FilesJavajre7injava.exe' and setting the inbound firewall rule back to match this worked. Interesting that Windows saw the PATH variable and the literal file path so differently that it didn't satisfy the firewall rule (perhaps it's by design and a security feature?).

Categories : Misc

Trying to open ports via Windows Firewall, but only when process is running (Error: "Syntaxerror")
start "Origin" /DE:Origin Origin.exe Guess only: The help for start indicates that there should be a SPACE between the D and the E.

Categories : Windows

How to check if port or program is allowed in Windows 2008 firewall using netsh advfirewall commands
Yanick, Is the reason you can't use PowerShell down to the restrictions in BladeLogic? If so, we've developed a workaround for calling Powershell scripts from BladeLogic! :) -John.

Categories : Windows

c++ server doesn't close TCP socket connection after the connection process is killed on client
The default values for TCP keepalive are around 2 hours (in BSD/Linux implementations). Are you sure you have TCP keeaplives options set when you are seeing connectoins still up after 10 hours? I am thinking that your application perhaps is not explicitly setting the keepalive option. One way would be to use get socket option and pass SO_TCPKEEPALIVE to check if the keepalive is indeed set. And if it is not set, then please go ahead and set it. You might find this discussion helpful: How to use SO_KEEPALIVE option properly to detect that the client at the other end is down?

Categories : C++

Jersey as REST client, maintaining a connection (or validating connection)
The underlying connections are opened for each request and closed after the response is received and entity is processed (entity is read). final WebTarget target = ... some web target Response response = target.path("resource").request().get(); System.out.println("Connection is still open."); System.out.println("string response: " + response.readEntity(String.class)); System.out.println("Now the connection is closed."); If you don't read the entity, then you need to close the response manually by response.close(). Also if the entity is read into an input stream (by response.readEntity(InputStream.class)), the connection stays open until you finish reading from the InputStream. In that case, the InputStream or the Response should be closed manually at the end of reading from InputStre

Categories : Rest

how to compile gtk+ application for native windows (and not for X windows)?
The application needs to be compiled using MinGW and not Cygwin. The full list of steps I followed: 1) Download MinGW 2) Install MinGW to a folder without spaces, e.g. to c:MinGW. 3) Download gtk+. Even though my machine is 64bit, I went for the 32 bit download of gtk+ because compatibility warnings on the 64bit download page. The GTK+ Win32 downloads are here. I went for the all-in-one version. 4) Extract gtk+ to a folder without spaces, e.g. c:gtk 5) If you don't already have an application, you can use the gtk+ hello world source code. Save this to a folder, e.g. c:myapp 6) Open a windows command prompt and cd to the folder in step 5. E.g. cd c:myapp 7) In the command window, add your MinGW folder to the windows PATH, e.g. c:myapp> set PATH=c:gtkin;%PATH% 8) In the

Categories : C++

iOS native client app for website
You should look at using the provided RESTful interfaces for each platform (drupal / joomla).

Categories : Iphone

Connection to Mongodb-Native-Driver in express.js
how to connect to the database? In order to connect using the MongoDB native driver you need to do something like the following: var util = require('util'); var mongodb = require('mongodb'); var client = mongodb.MongoClient; var auth = { user: 'username', pass: 'password', host: 'hostname', port: 1337, name: 'databaseName' }; var uri = util.format('mongodb://%s:%s@%s:%d/%s', auth.user, auth.pass, auth.host, auth.port, auth.name); /** Connect to the Mongo database at the URI using the client */ client.connect(uri, { auto_reconnect: true }, function (err, database) { if (err) throw err; else if (!database) console.log('Unknown error connecting to database'); else { console.log('Connected to MongoDB database server at:'); console.log('

Categories : Node Js

Can we build an native client app in C++ which can run on chrome OS?
You can. See the app "PNaCl Examples" in the Chrome Web Store. It runs on my Chromebook with Version 31.0.1650.35 beta. I think PNaCl is built-in as of Version 31. However, NaCl is much older, and probably works with even earlier versions.

Categories : Misc

Native Client plugin using tesseract library
It may be easiest to try debugging. See https://developers.google.com/native-client/devguide/devcycle/debugging#gdb The link above gives a lot of detail, but here is the basics: Run chrome with --enable-nacl-debug on the commandline, and navigate to your page. The NEXE will not load, and instead will wait for a debugger connection. Launch the native client debugger: $NACL_SDK_ROOT/toolchain/linux_x86_newlib/bin/x86_64-nacl-gdb In gdb, type: nacl-manifest hello_tutorial.nmf then target remote :4014 (the link above mentions running nacl-irt ... as well, it gives additional information if the crash is not in your code, but often is not necessary) At this point, you should be connected to the paused NEXE, type c to continue The NEXE should crash, as before. Type bt to print a stack backtrac

Categories : C++

Tuning node-mongodb-native connection pool size
In scenarios like this, the first step is always to start to with the DB. If you have queries that are slow to respond, those queries should appear in the slow logs. Take a look at the official docs for profiling. The default value for "slow" queries is about 100ms, so if your slow queries are because of the DB, you will see evidence there. Additionally, take a look at the graphs for the DB. By "the graphs", I mean your Nagios/Cacti/Zabbix/ServerDensity/MMS charts of what the server is doing. If you do not have these, start there. Tweaking the connection pool size is useless if you don't actually know how many connections you have or what your CPU looks like. Any good tools or strategies to confirm or rule out the driver connection pool size as a bottleneck? Once you have ruled out

Categories : Node Js

How to get a sum of values in array in Google Native Client inside C++?
I have the same problem, i want to send a string array var nativeArray = new Array(); nativeArray[0] = "Item 1" nativeArray[1] = "Item 2" naclModuleElement.postMessage(nativeArray) and nothing gets called in the HandleMessage Sending nativeArray.length works and shows '2' in NaCl side After some investigation, i saw that there is no AsArray() function in pp::Var class Only primitives are available There is a class pp:VarArrayBuffer which could be used to send/recieve binary info.. this could help (did not download the example posted in it though)

Categories : Javascript

Looking for the timeout properties of native java CORBA on the client-side
I can confirm for glassfish 3.1.2.2 that the suggested solution in Some CORBA properties are ignored does work. The required system properties may be set as java command parameters java -Dcom.sun.corba.ee.transport.ORBWaitForResponseTimeout=5000 -Dcom.sun.corba.ee.transport.ORBTCPConnectTimeouts=100:500:100:500 -Dcom.sun.corba.ee.transport.ORBTCPTimeouts=500:2000:50:1000 -cp .. or in your code with System.setProperty("com.sun.corba.ee.transport.ORBWaitForResponseTimeout","5000"); It is mandatory to set the ORB parameters as system properties. They have no effect if used as Properties for the InitialContext.

Categories : Java

Windows Mobile emulator network connection on Windows 7 64bit
You are talking about two different things. One is "How to 'cradle' Devcie Emulator Images and the other is how to get a working virtual network card in Emulator Image: For the virtual network setup look here: http://www.petenetlive.com/KB/Article/0000241.htm. You need to install a special driver. For 'docking' (cradle) option download Device Emulator Manager and after starting a Windows Mobile Emulator select 'Cradle' in the context menu of the running emulator inside device emulator manager. If you have problems with docking, chack that DMA is enabled in WMDC Connection Settings. Also check the option "USB to PC" (Start-Settings-Connections) and ActiveSync Connection setup inside emulated Windows Mobile device. As you have done changes that may conflict with the desired setup, I reco

Categories : Misc

BCP IN error : [Microsoft][SQL Server Native Client 10.0]Unexpected EOF encountered in BCP data-file
Oh, BTW, i was getting frustrated with the same issue today. Turns out the format file had a prefix length specifier that had a value of 2 (auto prompted during format file generation - why?) for field two which was a varchar field. Once I made it to field length specifier to 0, file started working. PS: my file was tab separated.

Categories : Csv

Best practice for managing different consistency levels using the Datastax Cassandra native java client
So perhaps the simplest option is stick with a single Session instance and set the CL for each query. Not only is that the simplest option, it is the option. In version 1.0.2 of the driver there was no way to set the consistency level anywhere else that per-query. There was no per-Session CL. Since version 2.0 of the Java driver, the global default consistency level can be set for the Cluster through the Cluster.Builder.withQueryOptions() method. Though, for what is worth, my personal opinion is that the CL is an important parameter of each query. So I wouldn't find it crazy to set it for each query even when it's to keep the default of ONE for documentation sake (i.e. to say "I do have though about what is the relevant CL for this query and it's ONE").

Categories : Java

Native windows Linux
As wine demonstrates, the PE format isn't really the problem with compatibility. PE only defines how the program is pieced together at load time. Under windows, RUNDLL interprets it, loads all the program sections to memory, loads all the supporting dlls to memory and patches up the function pointers so that there is a program sitting in memory ready to go. (See http://msdn.microsoft.com/en-us/library/ms809762.aspx for more details. Its a good read!) There is little stopping you writing a kernel module to do all of this. With the details in the page linked above it may not be to hard and someone may already have done it. The real issue is the fundamentals of the operating system. Even if linux could load a PE, there would be problems around the fundamental difference in file names

Categories : Linux

Oracle C++ connection without installing the Oracle client or instant client
There are a handful of companies that have reverse engineered the Oracle network protocol so that they don't need to include any sort of client software. Normally, these are companies that implement things like wire protocol ODBC drivers. Since the Oracle network protocol is undocumented and subject to change across releases, this is generally not a trivial undertaking-- you're talking dozens if not hundreds of man-years of effort. The vast majority of applications like the one you link to will either be using JDBC behind the scenes and will include the thin JDBC driver or will be installing the Instant Client transparently as part of the installation process. The whole point of the Instant Client was to allow application developers to bundle it with their applications so that the appl

Categories : C++

WP8 - Re-using a native DLL through Windows Runtime Component
The DLL must be included in your XAP package. Something you can see being taken care of in the Output window when you build your app, it starts with the "Begin Xap packaging" messages and then lists all the files that get added. The runtime error says it is not being included. There is remarkably little guidance on how to ensure that a file gets included in a phone package when MSBuild cannot figure out the dependencies by itself. It certainly won't for your DLL, no way the build system can tell if it isn't a project in your solution. Seems you're operating a bit on the bleeding edge in this case :) But this works well when I try it, going by the MSBuild output and not by actually testing it: Project + Add Existing Item. Navigate to your DLL and select it. Select it in the Solutio

Categories : Windows Phone 8

Native Windows Phone 8 Image API
If you use the PhotoChooserTask, you can set the desired values to the PixelHeight and PixelWidth properties and it will automatically show the native image cropping page: photoChooser.PixelHeight = 500; photoChooser.PixelWidth = 500; However there is no way to open it from elsewhere (i.e without a PhotoChooseTask).

Categories : C#

Windows Phone 8 - Native and CLR Runtime
Microsoft reveals very few details about the OS itself. Other than it being a trade-secret, it would be rather self-defeating since this evolves fast on mobile platforms. You should only focus on the api that's provided, this ensures that you'll get store certification and hope that your app still works on later phone editions. WinRT is that api, along with a smattering but short list of native api functions. You'll indeed get the CoreCLR derived from Silverlight, a trimmed version of the desktop CLR. It includes the language projection that makes it easy to use WinRT from a managed app. P/Invoke is not supported. It is not a problem in practice, other than portability, Phone8 supports developing native C++ libraries that expose their classes through WinRT. Usable from any language

Categories : Dotnet

Emacs error: Mac native windows are not in use or not initialized
Your init.el file calls x-display-pixel-width unconditionally, but that function doesn't work when running Emacs in a terminal. Change init.el to only use x-display-pixel-width if window-system is non-nil, e.g.: (when window-system ... include the piece of code defining emacs-min-left here )

Categories : Osx

How to use libgit2 from a native C++ application on Windows? (Microsoft VC++)
This strongly suggests a calling convention mismatch to me. libgit2 uses __stdcall by default, for a number of reasons, while Visual Studio defaults to creating projects that use the __cdecl calling convention. While your program can use either calling convention and successfully call libgit2 using a different one, the easiest solution is probably just to use the same calling convention for both. When you configure libgit2, you can turn off the STDCALL flag, which will cause it to emit a library built with __cdecl calling conventions: cmake %PATH_TO_LIBGIT2_SOURCE% -DTHREADSAFE=ON -DSTDCALL=OFF cmake --build .

Categories : Visual C++

Client-Server connection
Multi-client servers are generally written one of two ways: Create a thread for each client. To do this you would create a thread to handle the calls to accept() on the server socket and then spawn a new thread to handle calls on the Socket that it returns. If you do this, you need to make sure you isolate the code for each socket as much as possible. The accept thread will loop forever, or until a flag is set, and will just call accept, spawn a thread with the new socket, and go back to calling accept. All of the work is in the child thread. Use NIO, or another technology, to multi-plex work into 1 more more threads. NIO uses a concept sometimes called select, where your code will be called when there is input available from a specific socket. If you are just doing a small server, you

Categories : Java

Why is my client closing the connection
I think that the problem is in the way that you are trying to read data on the client side. byteLus = ois.read(); The read() method reads a single byte of data! Reference: the javadoc. But you seem to be assuming that it will (somehow) read a number of bytes into buffer. (Or something. The code is so wrong, it is not obvious what you think it should be doing!) But frankly, there are lots of other problems with your code, both on the client and the server size. Some of the problems are as follows: You should (probably) not be using read() or write(buffer) on an ObjectStream. You should be using readObject() and writeObject(obj) ... or using DataInputStream / DataOutputStream. The way you are reading the file on the server side is broken. You are ignoring the result of the

Categories : Java

Can Client Socket Connection be anything?
As Keith stated, the "ComputerName" you specify when creating the socket is the DNS name of the machine. That means that when you create the socket, your computer does a DNS lookup to determine the IP address of the server you're trying to connect with. As zapl stated, Windows computer names are != to DNS names (they're unknown by the DNS server that does the resolution). Java sockets can also be created using an InetAddress, which is the preferred method because in many cases your server won't have it's name registered with the DNS.

Categories : Java

Ruby DevKit on Windows 8, still can't install native extension
Sorry, I used the wrong DevKit. For Ruby 1.9.3 and below, we should use DevKit-tdm-32-4.5.2-20111229-1559-sfx.exe The mingw is for 2.0 and above. It works great now.

Categories : Ruby

how to install node-mongodb-native with nodejs in windows
Mongoose has a dependency on the npm package monogodb. If you look at the npm page for mongodb here, https://npmjs.org/package/mongodb, you'll find the homepage form the package is http://mongodb.github.com/node-mongodb-native/ That page is node-mongodb-native. So, there's nothing you need to do special to get it, as doing npm install mongoose is enough to install the native package.

Categories : Windows

gem install mysql2 windows native extention etc problems
That actually seems like a bug on extconf.rb:37 instead of a missing dependency or some compilation problem. Assuming that you triple-check that your ruby version is supported by this version of the gem and you are using the lastest version supported for your ruby version, I suggest open an issue on github.

Categories : Mysql

How to use native classes in Windows Phone runtime component
If I were you I would opt to create a WinRT wrapper around your existing class as opposed to using inheritance. If you delegate all functionality of your runtimeTestClass WinRT class to a private instance of your testclass then you will be able to use it from c#.

Categories : C++

ssl connection from an openLDAP client to an IBM LDAP
IBM's website has a discussion of this error. A number of possibilities, mostly server side, about keys not being in the keystore, expired, or not using port 636. So you can look at this and see if it helps you.

Categories : Ssl

persistent connection by mail client
The connection is not actually persistence. Whenever you authenticate to one of this mail clients it stores a persistent authentication cookie in your browser if you select remember me. This cookie holds your user information. As long as this cookie is valid web application doesn't prompt you for username and password. This cookie is deleted when log-out. You can learn more about cookie here.

Categories : Http

Meteor client loses connection
Meteor uses a data-on-the-wire principle. So it can load in the browser and needs a connection to the internet to maintain the 'liveness' of the data. So when you lose connectivity its built smart to try and reconnect. So at first it'll try to reconnect is small intervals. What you see there is that meteor is retrying to connect to the server status is its waiting to retry. connected is false retryCount shows how many times it has tried to connect again retryTime shows the last time or next time it tried/will try to connect (not sure which it is) There aren't any errors at this point but meteor will build up a que of whatever you do (changes to the collection, etc) and then as soon as it connects it will commit these to the server. Instead of refreshing the browser you could use Met

Categories : Meteor

Mysql2: close client connection
Use client.close. From the docs: Mysql2::Client#close Immediately disconnect from the server, normally the garbage collector will disconnect automatically when a connection is no longer needed. Explicitly closing this will free up server resources sooner than waiting for the garbage collector. Have you got multiple long-running processes that only use the mysql connection for a short time? That should be the only case where this is an issue. If your processes are ending then the connection will be closed as part of garbage collection, so your issue lies elsewhere.

Categories : Ruby

Client-Server connection with sockets
Look at those lines: IPAddress ipep =IPAddress.Parse(comboBox1.SelectedItem.ToString()); Socket server = new Socket(AddressFamily.InterNetwork , SocketType.Stream, ProtocolType.Tcp); IPEndPoint ipept = new IPEndPoint( ipep, hostPort); NetworkStream nStream = tcpClient.GetStream(); You are creating a new socket but you are sending the data to the socket stored in the variable tcpClient that is global (since it was not defined in the method), thus totally ignoring the IPEndPoint parsed from the combobox. You should not create a new socket in order to send data to the clients. Instead, store all clients in a collection and retrieve the appropriate one based on the input of the combobox.

Categories : C#

Client Server Connection's Message
A try/catch might work nicely. try { server.Start(); // server.SomeTestCall(); - Try this if Start() does not throw an exception // when failing to actually start the server MessageBox.Show("Server is started."); } catch { server.Dispose(); MessageBox.Show("Server failed to start."); }

Categories : C#



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