w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML Categories
Determine number of idle threads on remote machines
From my understanding the information you are looking for can be retrieved from 'TOP' http://www.cyberciti.biz/tips/how-do-i-find-out-linux-cpu-utilization.html the information is taken from the 'Tasks' section of 'TOP' #!/bin/bash getthreads=`top -n 1 | awk '/running/ {print $2, $4, $6}'` totalthreads=`echo "$getthreads" | awk ' {print $1 } '` runningthreads=`echo "$getthreads" | awk ' {print $2 } '` availablethreads=`echo "$getthreads" | awk ' {print $3 } '` echo "Total threads: $totalthreads" echo "Threads is use: $runningthreads" echo "Threads available: $availablethreads" here is a script that extracts the data you need and outputs it. You can adjust as you need. Hope this helps

Categories : Bash

Mounting NFS Folder on to a Remote Machine (Both machines are on Red Hat Linux)
Mounting with "mount" command is not permanent only until the next reboot. If you need a permanent mount you have to edit "/etc/fstab" i.e. usanfsdo1:/home/files /home/mount/files nfs rw 0 0

Categories : Linux

How to run Selenium Webdriver C# tests on multiple remote machines in parallel?
What I've done, I'm not sure if this is the best approach, is adding an entry for each server I want to test in the app.config, within the appsettings section, as follows: <!-- Server URLs to test --> <add key="ApplicationUrl_DEV" value="http://localhost:44404"/> <add key="ApplicationUrl_TEST" value="http://testserver:44404"/> And then in the test class, I add the attributes as: [TestFixture("ApplicationUrl_DEV", "DEV")] [TestFixture("ApplicationUrl_TEST", "TEST")] public abstract class Executer // Test class Each test method in the class will execute N times, once for each ´TestFixture´ attribute. After this, you must overload the class constructor: protected Executer(string urlKey, string environment) { BaseUrl = ConfigurationManager.AppSettings[ur

Categories : C#

Difference between two MySQL databases which are on two different remote machines (mysqldiff usage clarification)
Here's a script I use to compare two different MySQL databases. To compare two remote databases you'll just need to change $db1_host from localhost to the IP address of the other remote server. <?php //------------------------------------------------------------------------------ // Define the variables we'll be using. //------------------------------------------------------------------------------ $db1_con = NULL; $db1_constraints = array(); $db1_dbname = 'db1'; $db1_host = 'localhost'; $db1_password = 'password1'; $db1_tables = array(); $db1_username = 'username1'; $db2_con = NULL; $db2_constraints = array(); $db2_dbname = 'db2'; $db2_host = '123.123.123.123'; $db2_password = 'password2'; $db2_tables = array(); $db2_username = 'username2'; //----------------------------------------

Categories : Mysql

Azure VM pricing - Is it better to have 80 single core machines or 10 8-core machines?
Billing According to Windows Azure Virtual Machines Pricing Details, Virtual Machines are charged by the minute (of wall clock time). Prices are listed as hourly rates (60 minutes) and are billed based on total number of minutes when the VMs run for a partial hour. In July 2013, 1 Small VM (1 virtual core) costs $0.09/hr; 8 Small VMs (8 virtual cores) cost $0.72/hr; 1 Extra Large VM (8 virtual cores) cost $0.72/hr (same as 8 Small VMs). VM Sizes and Performance The VMs sizes differ not only in number of cores and RAM, but also on network I/O performance, ranging from 100 Mbps for Small to 800 Mbps for Extra Large. Extra Small VMs are rather limited in CPU and I/O power and are inadequate for workloads such as you described. For single-threaded, I/O bound applications such as describe

Categories : Azure

Issues with C in realloc() or free() or double free or corruption
This is a significant problem: void cpy_to_q(unsigned char **qs_ptr, unsigned char **qcur_ptr, unsigned char **qsa_ptr, unsigned char *data, int num_bytes, int tot_bytes) { if(*qs_ptr == NULL) { *qs_ptr = (unsigned char *)malloc(num_bytes*sizeof(unsigned char) + 1); *qcur_ptr = *qs_ptr; *qsa_ptr = *qs_ptr; memcpy(*qs_ptr, data, num_bytes); } else { // HERE YOU REALLOC THE BASE PTR, BUT DON"T REPOS THE CUR PTR *qs_ptr = (unsigned char *)realloc(*qs_ptr, tot_bytes*sizeof(unsigned char) + 1); printf("size of q: %d ", tot_bytes); *qsa_ptr += num_bytes; memcpy(*qsa_ptr, data, num_bytes); } } When the allocation final

Categories : C

Free result and close connection before unsetting the mysql object or just unsetting would destroy the object n free up the resources?
You may only have one prepared statement/execution at a time when using mysqli. If you try to open and execute two prepared statements without closing you will generate an error. Any resources you explicitly open past your db abstractor should be dealt with by you during execution time. That is, if you open a connection using the info in the abstractor it is best practice to explicitly close it (but not unset the base resource itself), thereby freeing the resource associated with it. Having a basic mysql-connection is not very resource consuming, but keeping a large number of un-closed connections to your mysql server can cause it to cease accepting connections (depending on config). Most executions, upon completion, will automatically free the associated mysql resources if they aren't exp

Categories : PHP

Local Wordpress install with Remote Database. Error: Remote DB Appears to be already installed
Did you include 'http://' in your URL? Refer : http://wordpress.org/support/topic/you-appear-to-have-already-installed-wordpress-1 Thanks.

Categories : Wordpress

Can I migrate remote SVN to local disk without exporting dmp files on remote server?
You can dump only latest revision range with the -r switch. svnadmin dump REPOS_PATH [-r LOWER[:UPPER]] [--incremental] [--deltas] and then you can load this increment in the new repository. Reference: http://svnbook.red-bean.com/en/1.7/svn.ref.svnadmin.c.dump.html Example: http://www.vioan.ro/wp/2007/07/31/dumprestore-for-subversion-repository/

Categories : Svn

Failed to connect to remote VM. Connection refused. when trying to debug remote java application in Flash Builder 4.7
Each debug argument must be placed in a line by itself, after the -vm argument. This should do the trick: -vmargs -Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=8000

Categories : Java

How can I use ADT on both my Mac and Linux Dev Machines
Try syncing only the actual code files you create, not the project itself (i/e file1.java if you're writing in java, file2.cpp if in C++, etc). You might have to monkey around with adding new files, but that should be as simple as importing/exporting. You're going to have all kinds of trouble syncing paths for 2 different machines... Otherwise try a free source control like assembla

Categories : Android

x:set not working the same on 2 different machines?
I'll throw up my workaround incase anyone else has this issue in the future. No matter what I did, I couldn't figure out why some machines were just refusing to recognise/implement the string() xpath function, so I worked around the problem by changing my code to the following: <c:set var="test2"> <x:out select="$extraSideNavLinks/sideNavLinks/@perm"/> </c:set> This worked consistently on all machines.

Categories : Java

merge remote branches before it gets merged to remote/master?
Whether or not you'll have a merge "problem" depends on what happens on the upstream master prior to the owner merging in branchA. However, regardless of what happens, once branchA does get merged into the upstream master, you can just run the following in your local copy and be "up-to-date": git checkout master git fetch upstream git reset --hard upstream/master This combination will ensure your local copy of master points to the same commit as the upstream copy of master. Since you would do this after the owner merged branchA into the upstream master, your local master will, effectively, still have the changes introduced by branchA. update If you want to make changes to branchA prior to merging into master, I would recommend you create your own branch based on branchA and make your

Categories : GIT

Remote PHP Debugging with Netbeans and XDebug (remote server)
Remember you need to set the Path Mapping in the Debugger tab inside Netbeans Options. Another little big problem I was having when trying to connect from NetBeans remotely was the SSH tunnel. You have to creat it for the port xdebug will work on, 9000 usually. If you experience network problems for a moment, the tunnel might "break" silently and NetBeans will be stuck in the holy "Waiting for connection..." state. In putty, you can right click and Restart Session, but this won't work. You will need to close the putty window and re open the session for it to work again. Hope it helps!

Categories : Misc

Using the iphlpapi.dll in .Net to Add new IP Addresses on x64 machines
As noted, AddIPAddress and all of iphlpapi.dll show and control the dynamic configuration, which doesn't get persisted. You can set the static persisted configuration, which would show up in the TCP/IP settings dialogs, using netsh - run netsh interface ipv4 set /? to see how. It's programmatically accessible via the INetCfg interface, but I think some of it is undocumented. The WMI interfaces are wrappers which mix stuff from both sources, which is why I recommend against using them (as you've noticed, they won't configure disconnected NICs).

Categories : C#

keep 2 mysql dbs identical on two machines
These answers assume that standard replication is not an option for you, for whatever reason: The following options are existing methods for manual data-sync that are well known, and would be good when combined when wrapped into a scripting language like bash etc. for a cronjob as needed with some logic to specify specific tables as needed, guarantee it is safe to run them in light of load, etc. on a production box. Option 1: pt-table-sync The pt-table-sync tool from the Percona MySQL toolkit allows for master-master, master-slave sync on demand in an existing replication scheme. Or you can use it to sync two servers that do not have any relationship. Docs here from Percona Following the example, for one way sync'ing. pt-table-sync --execute h=sourcehost1,u=msandbox,p=msandbox h=d

Categories : PHP

PHP: script works on some machines only
Can't say for certain but it may have to do with you using short tags which is typically disabled by default. Try using <?php instead of just <?. Also your queries may be case sensitive on Linux servers but not on windows servers.

Categories : PHP

Vagrant: different provisioner for different machines
You were on the right track with I have also tried using smartos.vm.provision instead of config Try this simple Vagrantfile out $smartos_script = <<-SHELL touch /opt/foo SHELL $centos_script = <<-SHELL touch /opt/bar SHELL # Vagrantfile API/syntax version. Don't touch unless you know what you're doing! VAGRANTFILE_API_VERSION = "2" Vagrant.configure(VAGRANTFILE_API_VERSION) do |config| config.vm.define :smartos do |smartos| smartos.vm.box = "smartos" smartos.vm.box_url = 'http://dlc-int.openindiana.org/aszeszo/vagrant/smartos-base1310-64-virtualbox-20130806.box' smartos.vm.provision :shell do |shell| shell.inline = $smartos_script end end config.vm.define :centos do |centos| centos.vm.box = "centos" centos.vm.box_url = 'http:

Categories : Ruby

Colour on a image changes on different on machines
This is likely to be more to do with your screen rather than a coding issue. You will find that all screens display images slightly differently. In fact, the image you have posted will look different to me now, than it does on either of your machines. Often the difference is slight. This can be to do with different display technologies (LCD, CRT etc) or just the slight differences in manufacture.

Categories : HTML

RSA Encryption and Decryption on Different Machines
It seems that you don't fully understand of how public key encryption works. Both partners have to generate their own public/private key pair. Afterwards, you share the public keys (that is, M1 sends its public key to M2 and vice versa). In reality, there is the problem of key distribution and authentication, i.e. how do I know that a public key that says it belongs to John really belongs to John? But for your small example, you can ignore this at first. Once both machines have the partner's public keys, you encrypt a message going from M1 to M2 using M2's public key. M2 then decrypts it using its private key. Apply the same idea for the reverse direction. That way, you never have to share any of the prime factors or the private keys (as you correctly noticed, doing that would completel

Categories : C++

Map apache path to different machines, which is the best way?
You can do this routing using mod_proxy module of Apache. Something like this: ProxyPass /webservice http://server1/webservice ProxyPass /test/webservice http://server2/webservice

Categories : Apache

Git, and moving between development machines
"I am happy to overwrite these changes, but I'm not sure how to do it." git reset --hard git pull origin master You can use git in your new computer exactly the same way as you do in your old computer. "Ideally I'd like to be able to exclude some files from being tracked..." Create .gitignore in the same directory and put the names of the files to exclude in it. If you're using windows, How to create .gitignore file

Categories : GIT

Fonts and their sizes on different machines
You can't, because the rendering depends on several factors: The font itself: some computers may not have the font you requested, or the font may have the same name, but be different in its substance. You can avoid this by embedding custom fonts in your deployable package. The screen resolution: fonts are rendered accordingly to the screen resolution in DPI. On screens with higher density, fonts will be bigger (in pixel size), because they'd otherwise be unreadable. Think, for example, of Apple's retina displays, whose resolution is close to 400dpi, compared to a normal screen, with a 72dpi resolution. A string which is 72px high will take 1 inch on the normal screen, being perfectly readable, while will only occupy 0.18 in, being hardly readable. The user has the right to customize the

Categories : Java

JGroups does not work on different machines
If it works on the same machine, your code is fine. Very likely the problem is with discovery - nodes do not find each other. Look at your configured stack and check what discovery protocol you are using. If you are using TCPPING (http://www.jgroups.org/javadoc/org/jgroups/protocols/TCPPING.html) you need to reconfigure the IP addresses of the nodes. Most likely, it will be MPING (http://www.jgroups.org/javadoc/org/jgroups/protocols/MPING.html) which uses multicast to discover nodes. Make sure multicast messages are being sent inbetween these nodes. Typically, firewalls drop this multicast communication (you can temporarily turn off firewall to test). Also, check that your network components are not dropping multicast communication.

Categories : Java

Integrating an API that uses SSL to connect machines
The standard SSL port is 443, but if you're using a library that parses URLs correctly, it will connect to that port automatically if it sees https:// at the beginning. You can use a custom port by providing it after the hostname (separated by a :), such as https://websitename.com:8443/, if you had an SSL service running on port 8443 instead of 443.

Categories : C#

Why do I get different timestamps in python on different machines
An unix timestamp is an offset value between a point in time line and the epoch, it's nothing to do with timezone. When it's converted to a human readable string like '%Y-%m-%d %H:%M:%S' that doesn't include any timezone information, python assumes that you want to use local timezone setting. When you run this datetime.strptime(install['click_date'],'%Y-%m-%d %H:%M:%S') you get a datetime object, which doesn't contain any timezone information and can be only explained as local time. If you run it on an UTC server the object is explained as '2013-07-07 00:33:02 UTC', if on your PST server it is '2013-07-07 00:33:02 PST', they are different points in time line therefore they have different unix timestamp values. To make it treat install['click_date'] as UTC time, timezone offset needs to

Categories : Python

Cannot run VSPackage when developing on multiple machines
The Visual Studio package project type adds an additional tab to the project properties view named VISX. On that tab the Deploy VSIX content to experimental instance for debugging option is checked by default; that´s the reason why package files are copied to the extensions directory of the current user´s profile after build. If you want to start Visual Studio using the experimental hive you must customize the Debug settings of the class library project. Set the Start Action to Start external program and select the devenv.exe file (the file´s location depends on your installation folder) and specify the following commandline arguments: /rootSuffix Exp This allows to debug the extension by pressing F5.

Categories : C#

How to set up Spark cluster on Windows machines?
FYI, I got an answer in the user-group: https://groups.google.com/forum/#!topic/spark-users/SyBJhQXBqIs The standalone mode is indeed the way to go. Mesos does not work under Windows and YARN probably neither.

Categories : Apache

Using state machines with a lot of transaction conditionals
I just modified your state machine to better way to handle conditions. You can use after_transition or before_transition methods class Product < ActiveRecord::Base has_many :orders state_machine :initial => :prelaunch do after_transition :prelaunch, :do => :check_launch after_transition :pending, :do => :has_enough_orders? event :launch do transition :prelaunch => :pending end event :fund do transition :pending => :funded end end def check_launch if launch_at <= Time.now self.launch # call event :launch else # whatever you want end end def has_enough_orders? if orders.count > 10 self.fund # call event :fund else # whatever you want end end end

Categories : Ruby On Rails

Authorize users at a machines level?
Correct me if I misunderstand, but you are asking to only allow visitors on specific machines to access your website? Jumping right into a solution here. The first question is how do you know which machines are "manager's" machines? Do you have a list of their IP addresses? Do you have some other ID on them? If you have their IP addresses, then IP Whitelist them, and block all other ip addresses. If you do not have their IP address, then you are limited. There is no machine ID that can be accessed through a web browser, so you'll need to create your own ID by setting a long lived cookie and a registration process. Since you already have a login process, this next part is fairly easy. You've used this solution before. When you sign in to google mail and click "remember me" and don't nee

Categories : Ruby On Rails

How to distribute an application that relies on DLL's for 32-bit and 64-bit machines
You have to create an additonal ant target such that it builds always a x32 and a x64 variant of your application. I don't want to maintain two separate releases If the ant your skript always produce both deliverys that its not much addional effort.

Categories : Java

C# com interopt failure on american machines
Well, I happens to be that i have faulty declared a DateTime in one of my declarations of a static class... private DateTime myDateTime = Convert.ToDateTime("15/09/2013 12:00:00"); And ofcourse, on a EU system, this will work, but on an American (or even others) this gives an error because there is no 15th month... This gets triggered even before the constructor of my com-accessible class and that's why the error couldn't be handled. Dumb mistake, but proves that sometimes errors look very complex while they are very simple.

Categories : C#

C# Winforms Custom Form Looks Different On Different Machines
There are a couple of likely causes for this: You are using two different OSes. 8 and XP render the same controls completely different. You are using different visual styles (Aero on one, Classic on the other). You did not anchor your controls. Anchoring allows controls on the form to dynamically layout depending on the size of the window.

Categories : C#

Problems w/Crystal Reports and 64 Bit machines
This link suggests installing Crystal reports XIR2 (or higher) + service packs: http://community.spiceworks.com/topic/130438-windows-7-and-crystal-report-viewer-xi-r2 Other links/other suggestions: printdialog.showdialog(); not showing the print dialog in windows 7 with 64 bit Print Dialog Does not show up in Crystal Report Viewer on 64 bit machine

Categories : Dotnet

How to connect to a servlet when both machines are on the same wifi?
This is certainly doable if you do not have any firewall rules blocking such access on the host machine. As 'Eng.Found' pointed out, try using the IP address that is assigned to the Server. If 10.0.2.2. tries to connect to the dev machine itself, it certainly is not the IP address of the Server. To detail it further, First make sure you can access the servlet via localhost on the Server itself. If yes, then get the ip address of the Server and ping it from your dev machine/another device. If you can ping it then you have access to the machine. Else you might have to make sure that some firewall rule(s) is not blocking it. Ping however cannot be associated with ports so you can use a command like 'netstat' on the Server's console to get a list of all ports its listening to (if desired).

Categories : Android

False Sharing only became noticeable on certain machines
False sharing only occurs with blocks of 64 bytes. You need to be accessing the same 64-byte block in all four threads. I suggest you create an object or an array with long[8] and update different cells of this array in all four threads and compare with the four threads accessing independent arrays.

Categories : Java

R knitr: is it possible to use cached results across different machines?
Update: the problem arose from different versions of knitr on different machines. In theory, yes -- if you do not change anything, the cache will be kept. In practice, you have to check carefully what the "small changes" are. The documentation page for cache has explained when the cache will be rebuilt, and you need to check if all three conditions are met.

Categories : R

Java - Connecting two machines on same network
Use a broadcast to send all clients a message. (this could contain the servers IP but think about that! it could be a security issue) There are good examples on sending broadcast messages with java Broadcasting to Multiple Recipients

Categories : Java

AWS EMR machines not combining reduce output
I am running into the same issue - I am using EMR to create an "inverted index" using the streaming API: -input s3n://mybucket/html2 -output s3n://mybucket/results -mapper s3n://mybucket/mapper.py -reducer s3n://mybucket/reduce.py Where //mybucket/html2 has a few html files and mapper.py: def main(args): for line in sys.stdin: line = line.strip() words = line.split() for word in words: #do some preprocessing if word.startswith("http://"): #output the URL with a count of 1 print "%s,%s" % (word, 1) else: #cleanup HTML tags url = get_url() #irrelevant print "%s,%s" % (word, url) if __name__ == "__main__": main(sys.ar

Categories : Amazon

Run script in multiple machines in parallel
I recommend that you use pdsh It allows you to run the same command on multiple machines Usage: pdsh -w machine1,machine2,...,machineN <command> It might not be included in your distribution of linux so get it through yum or apt

Categories : Bash



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