w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML videos Categories
My Apache Reverse Proxy is not returning the correct URL when using ProxyPass
Solved: #REDIRECT for http://sysaid.external.com <VirtualHost *:80> ServerName sysaid.external.com ProxyPreserveHost On Redirect / https://sysaid.external.com </VirtualHost> #https://sysaid.external.com <VirtualHost *:443> ServerAdmin webmaster@external.com ServerName sysaid.external.com SSLEngine on SSLCertificateFile /usr/local/etc/apache22/ssl/webmail.external.com.crt SSLCertificateKeyFile /usr/local/etc/apache22/ssl/webmail.external.com.key ProxyPreserveHost On ProxyPass / http://srv-01.internal.local/ ProxyPassReverse / http://srv-01.internal.local/ ProxyPassReverse / http://sysaid.external.com/ </VirtualHost>

Categories : Apache

How to check (in C/C++ code) if Openssl is installed on my computer?
The following will work on Windows and Linux: #ifdef WIN32 libHandle = LoadLibrary( libraryName ); #else libHandle = dlopen( libraryName, RTLD_LOCAL | RTLD_NOW ); #endif

Categories : C++

ASP.NET MVC application, localhost working, remote computer returning "An error occurred while processing your request."
I had this error running on a virtual machine in Amazon AWS. The website had been working some time ago.. like a few months when I left it last. No configuration changes, nothing. Now it doesn't work.... And why would it stop working? Real head scratcher. Maybe a virus infection - It was not set to auto patch... Hmmm.. I'd set the machine to the smallest (micro instance) as a kind of "hibernation" of the site, very little traffic expected and I didn't have this site on my list of priorities... The site "worked" in "micro" instance when I last left it. Tried rebooting first off. Nothing. Then I checked the localhost and it works from there. Weird. Anyway it is time to make some modifications on this site and some upgrades. "Micro" instances are useless when upgraded so I shut

Categories : C#

How to check if a particular service is running in a remote computer using PowerShell
If they all have the same name or display name you can do it in one command. If not you need to run 3 commands. If all have the same name or display name: Get-Service -ComputerName server-a, server-b, server-c -Name MyService | Select Name, MachineName, Status If they have different names or display names: I would do this -- @{ 'server-a' = 'service-a' 'server-b' = 'service-b' 'server-c' = 'service-c' }.GetEnumerator() | ForEach-Object { Get-Service -ComputerName $_.Name -Name $_.Value } | Select Name, MachineName, Status To output to a text file use ... | Set-Content ~DocumentsService_Status.txt where ... is one of the above. Note - your account will need to have privileges to query the remote machines.

Categories : Powershell

How can I check that a computer can access a certain URL and send and receive e-mail?
Use TIdHTTP.Get and try to download http://google.com. Of course it depends on the definition of being connected to the internet. Sometimes web traffic (port 80) is blocked while other ports are open. Fortunately, nowadays most people are actually allowed to browse the web, since it also provides help with their daily activities. Google is probably one of the least firewalled websites with one of the highest uptimes. But still, it's a lucky guess. Depending on what you need it for, you might as well just try your thing and see if it works. If not, apparently the computer was not properly connected, even if it could reach Google. :) [edit] Because of the discussion. InternetCheckConnection is a good alternative too, but it also checks the connection by pinging an actual server. MSDN s

Categories : Delphi

Powershell script to check if a file exists on remote computer list
The equality comparison operator is -eq, not eq. The boolean value "true" in PowerShell is $true. And if you want to compare the result of Test-Path to something the way you do, you must run the cmdlet in a subexpression, otherwise -eq "True" would be treated as an additional option eq with the argument "True" to the cmdlet. Change this: if(Test-Path "\$_c$Windowssvchosts" eq "True") into this: if ( (Test-Path "\$_c$Windowssvchosts") -eq $true ) Or (better yet), since Test-Path already returns a boolean value, simply do this: if (Test-Path "\$_c$Windowssvchosts")

Categories : Powershell

How Can I Return Exit Code To Variable On Local Computer From Script Run On Remote Computer?
I do it like this: invoke-command -session $Remote -scriptblock { mycommand } $remotelastexitcode = invoke-command -session $Remote -ScriptBlock { $lastexitcode } if ( $remotelastexitcode -ne 0 ) { "$remotelastexitcode" exit 1 }

Categories : Powershell

Programatically set the time server of a remote computer to match the control computer?
You might be better off using Group Policy to set the time server. http://technet.microsoft.com/en-us/library/cc779145(v=WS.10).aspx

Categories : C#

Running a jar in a computer java.lang.UnsatisfiedLinkError lwjgl.dll in another computer
This problem generally occurs when your jar trying to use native library of operating system.In windows it is "LWJGL.DLL". java.lang.UnsatisfiedLinkError occurs if the JVM cannot find this file. try to find the existence of this file in machine 2 where your jar file is not working and try to add them to path if they does not exists.

Categories : Java

Executing command ls from windows computer to linux computer
I'm certain you could do something with sockets and system calls, but it would probably be easier to use the built in facilities and/or programs available for each. If both are on the same network, you could run an FTP or SSH server program on the Ubuntu computer and connect to it via a FTP/SSH client, like PuTTY. Sending 'ls' through PuTTY would then yield what you want it to. OpenSSH vsFTPd

Categories : C#

How can I sort tuples by reverse, yet breaking ties non-reverse? (Python)
Just using sorted should suffice >>> sorted(results) [('10', 'George'), ('10', 'Mary'), ('9', 'Adam'), ('9', 'Frank'), ('9', 'John')] default cmp function checks precedence of a tuple by comparing each member of tuple, from 0 to n, in that order

Categories : Python

PHP - MySQL Check only returning False
This is more of a code review answer, but it should help you nonetheless. First off, you will want to create a function to retrieve the status instead of including code files in this way: function getStatusId($db) { $result = $db->query('SELECT ID FROM status'); $rows = $result->fetchAll(PDO::FETCH_COLUMN, 0); return current($rows); // return first row or false } This function takes an existing database connection as its input and returns the value of the ID column. To call it: // create database connection $db = new PDO('mysql:dbname=removed', 'removed', 'removed'); // call your function if (getStatusId($db) == 1) { echo 'on'; } else { echo 'off'; } See also: PDO

Categories : PHP

Check if a field returning from stored procedure has value?
Change your stored procedure to: ALTER PROCEDURE [dbo].[o_By_RNum] @rNum varchar(50) ,@ServiceType varchar(50) ,@Direction varchar(1) = NULL ,@VendorID int AS BEGIN SELECT ISNULL(o_num,0) FROM RemoteOrder WHERE r_num LIKE @rNum AND r_ServiceType = @ServiceType AND (@Direction is Null OR Direction = @Direction) AND VendorID = @VendorID END this way you will have actual SELECT that will show results in Management Studio. Then instead of last 4 lines after command.Parameters.Add("@VendorID", SqlDbType.Int).Value = IIf(IsNothing(VENDORID), DBNull.Value, VENDORID) that add RETURN_VALUE parameter and ExecuteNonQuery just do RetVal = command.ExecuteScalar()

Categories : SQL

Obj-C/Cocoa How to check if [string characterAtIndex:i] is returning an NSRangeException?
Hi Oliver, I just stumbled upon this question and thought I'd answer it, though I hope you have worked it out since and haven't been stuck on this for 6 months ;) Firstly, assuming that stringLength == [string length] then you need to check that the index is strictly less than stringLength, not less that or equal, ie: for (i=0; i < stringLength; i++) { unichar currentCharacter = [string characterAtIndex:i]; ...} As an example, a 5 character string has 5 valid indexes; 0, 1, 2, 3 and 4. That fix should stop you from getting an exception, but here is some more explanation of exceptions (which I wrote before noticing your off-by-one error in the index): Exceptions aren't like normal return values, they are like a special emergency channel by which a function can inform its caller

Categories : Objective C

get list of logged on users on remote windows computer from a list computer
It (csv file) should be formatted as follows: computername server1 server2 server3 'Computername' is the column name. This can be derived from the code snippet as the Foreach-Object refers to the ComputerName property.

Categories : Windows

Parse XML file to check 2 child nodes before returning a 3rd node to datalist
Ditch that old xml parser Use LINQ2XML. It's simple and cool XElement doc=XElement.Load("yourXml.xml"); var lst=doc.Elements("Job") .Where(x=>x.Element("filter1").Element("value").Value=="texas" && x.Element("filter2").Element("value").Value=="admin") .Select(y=> new { title=y.Element("JobTitle").Value, id=y.Element("ReqId").Value }) .ToList(); Now you can iterate over lst foreach(var l in lst) { l.title; l.id; }

Categories : C#

Reverse a String without using Reverse. It works, but why?
If the string passed through is "hello", the loop will be doing this: reverse = 'h' + string.Empty reverse = 'e' + 'h' reverse = 'l' + 'eh' until it's equal to olleh

Categories : C#

Ping remote computer from another remote computer and get result back
According to Windows IT Pro (referred in Microsoft TechNet): PsExec displays the process's exit code and returns the exit code as its own exit code. So, your batch should work. Put ECHO ErrorLevel=%ERRORLEVEL% after PSEXEC ... just to get sure. To disable outputing, append >NUL 2>NUL or >NUL 2>&1 to PSEXEC ... command-line. Without /f as you used (where did you get it???)

Categories : Windows

jQuery Mobile Site using an ajax $.get() to check username availability returning previous page code in return data
Here's a face palm! My controller was authenticating and kicking it back out to a login page. Apparently php redirects act funky with ajax return data. Rather then returning the login page code it was returning the previous page code. I Removed the authentication and it works fine. Unbelievable! I'm going to go work at a gas station or something :)

Categories : Jquery

Memory Card not present still memory check returning true
Check for public static boolean isExternalStorageRemovable () Added in API level 9 Returns whether the primary "external" storage device is removable. If true is returned, this device is for example an SD card that the user can remove. If false is returned, the storage is built into the device and can not be physically removed. Environment.getExternalStorageDirectory() refers to whatever the device manufacturer considered to be "external storage". On some devices, this is removable media, like an SD card. On some devices, this is a portion of on-device flash More on this already answered by @CommonsWare here http://stackoverflow.com/a/5695129/786337 http://stackoverflow.com/a/15612964/786337

Categories : Android

Oracle Query is returning value when setting value to it, but not returning value when passing date value
Since you're already forcing the date format, you can use the following query instead: SELECT INCIDENT_ID FROM INC_SM1 I WHERE I.CLOSE_TIME >= START_DATE AND I.CLOSE_TIME < END_DATE

Categories : Oracle

Python - Chaining methods: returning `self` vs returning a new cloned object
Django does this so that the base query can be kept around and reused, without inheriting changes from a future "child" query, like your exclude() on your filter(). I'm guessing somebody tried storing queries for later, and realized that didn't work well without copying. I cloned the django repo and did a quick git log on django/db/models/query.py, searching for the phrase clone. The patch that introduces this change is here: https://github.com/django/django/commit/d4a3a4b

Categories : Python

JavaScript, stringify, replacer - returning undefined vs. returning nothing
If you don't provide an explicit return, the return value is undefined. Your second function always returns undefined, in other words. Because the function always returns undefined, there'll never be anything included in the JSON stringified result, so the overall effect is that you get undefined. It's sort-of an anti-pattern to do this: if (something) { return whatever; } else { return somethingElse; } Your first function would be more idiomatic as: str = JSON.stringify(o,function(k,v) { return Object.isSealed(this) ? undefined : v; }); edit — note that JSON.stringify() calls your replacer function first with an empty key, and "v" equal to this a new wrapper object containing the object to be stringified (and note that that object is not sealed). That is, before chec

Categories : Javascript

Returning 'nil' from a Lua function in C vs returning 0 values
Yes, this is perfectly valid. If you're trying to request/assign more return values than there are (no matter whether you try to get one or ten), you'll get nil for the undefined ones (i.e. those not returned). function test1() return 5 end local a, b = test1() -- a = 5, b = nil function test2() return 1, 2 end local c, d, e = test2() -- c = 1, d = 2, e = nil function test3() end local f, g = test3() -- f = nil, g = nil You probably can't find it in Lua's source because it's no special case or anything. It's just Lua's generic way to handle return values. Update: The difference you've noticed when trying to print return values is the fact that this is not just an assignment. Of course there is a slight difference between returning nil and returning nothing at all - and it

Categories : C

PHP recognise computer
Is it possible to recognize a certain computer with PHP? No, PHP is a server-side scripting language. What you probably want to identify a specific computer is the MAC address of the network adapter. http://en.wikipedia.org/wiki/MAC_address All of the other implementations you will hear about to find this will be using a client side language, which would be outside the scope of this question.

Categories : PHP

How to get IP of computer on lan if you have the computers name, using c#
Dns.GetHostAddresses Method you can resolve Host name to IP as follows string hostName = "www.Google.com"; IPAddress[] addresslist = Dns.GetHostAddresses(hostName); foreach (IPAddress address in addresslist) { string ip = address.ToString(); }

Categories : C#

How to get C standard on my computer?
It doesn't depend on your computer, but your compiler. After all, the computer (by which I mean the CPU) doesn't deal with C but with machine instructions. It is the compiler that interprets C according to some standard and translates that to CPU-friendly instructions. The GNU Compiler Collection can deal with a variety of C standards, which you can choose from with the -std= flag. Addition: on some (embedded) systems you only have a limited choice of compilers, which may only support a limited number of standards. So in that way the C standard(s) available you may be limited to your computer.

Categories : C

vb Cannot run program on another computer
If you're trying to access the database over the network, use: server="HostMachineIPAaron" (e.g. "10.1.1.1Aaron") and make sure firewall port 1433 is open. If you're transferring the database to another system, set your connection string to: ".Aaron" - the . references the local system.

Categories : Database

Can't use created gem on computer
Try require 'some_token'. Using require in general require takes the name of a ruby file, not the name of a gem. For example, if you have the following directory structure - foo.rb - main.rb Then in main.rb, you can use require 'foo' to use stuff from foo.rb. Using require with gems Notice that the first line of your gemspec has $:.push File.expand_path("../lib", __FILE__). This adds the lib directory of your gem to the search path. Thus, if you have lib/ some_token.rb then you should use require 'some_token'.

Categories : Ruby

Looking for a file on the computer
If time is not an issue as you say, you could iterate through all directories trying to get their files. Whenever you run into an UnauthorizedAccessExcpetion you simply ignore that directory and move to the next one in line. Here is the implemantation of a recursive file enumeration method, as suggested by Hans Passant: IEnumerable<string> GetAllAuthorizedFiles(string root, string searchPattern) { foreach (var fname in GetAuthorizedFiles(root, searchPattern)) yield return fname; foreach (var dir in GetAuthorizedDirectories(root)) { foreach (var fname in GetAllAuthorizedFiles(dir, searchPattern)) yield return fname; } } string[] GetAuthorizedDirectories(string root) { try { return Directory.GetDirectories(root); }

Categories : C#

xperfview on a different computer
Why do you try remote connection? if you use xperf -d to stop logging the ETL contains all metadata, so that the symbols can be loaded from any PC you want. Copy it from PC A to PC B and view the ETL there.

Categories : Misc

Where is apk key stored on computer?
In my case I put the Release Keystore file in the source control. Each developer pull the latest version (wish should not change) from the source control. You can set it up as readonly to secure the key if you like. If you are using Eclipse when Signing the app, you have to specify the path to the keystore. So there you can get your own keystore path. On the other hand. If you want to share the Debug Key, in order to play the application from both computers then the key is on your .android directory. If on windows then is c:Users[username].android debug.keystore debug.keyset If on linux/other is similar ~/.android

Categories : Android

How do I uninstall Git from my computer?
Instead of uninstalling Git, you may consider removing the current .git directory located at the root of your project (or moving it to a backup place -just in case-). At the root of your project, run the following commands : git init to create a fresh .git directory, i.e. a Git repository with no commits heroku create to add the heroku remote. git add .; git commit -m "Initial commit of project XXX" to create a new initial commit in your repository git push -f heroku master to push the new repository master. For more informations, have a look to Heroku Git

Categories : GIT

Get Computer Unique ID from PHP
I have created this function to get an unique ID based on hardware (Hard disk UUID). It is possible to use different resources like machine names, domains or even hard disk size to get a better approach depending on your needs. function UniqueMachineID($salt = "") { if (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') { $temp = sys_get_temp_dir().DIRECTORY_SEPARATOR."diskpartscript.txt"; if(!file_exists($temp) && !is_file($temp)) file_put_contents($temp, "select disk 0 detail disk"); $output = shell_exec("diskpart /s ".$temp); $lines = explode(" ",$output); $result = array_filter($lines,function($line) { return stripos($line,"ID:")!==false; }); if(count($result)>0) { $result = array_shift(array_val

Categories : PHP

There is any possibe way to get visitor computer name?
In normal cases, you can't. The only things you can retrieve are: the data sent with the request from the browser and/or the server info. Sending the computer name as part of the request simply doesn't make sense for the browser. Also, I'm skeptical it is even possible (in a reliable way) to get it via other ways.

Categories : PHP

git push error on Mac computer
fatal: Not a git repository (or any of the parent directories) This means your current working directory is not within a git repository. Change directories to a git repository and then run: git push -u origin master

Categories : GIT

How to access wcf service from another computer?
The problem is probably related to this part: <identity> <dns value="localhost" /> </identity> This work work locally because localhost makes sense locally, but across a network it doesn't. You can validate this identity in a number of ways, such as specifying the UPN (user principal name) of the user running the service, or an SPN (Server Principal Name) of the server running the service (although for this you'll have to register a SPN). This article should explain it a little: http://msdn.microsoft.com/en-us/library/ms733130.aspx

Categories : Asp Net

What would cause parameter sniffing one one computer and not another?
Assuming you mean that both machines were connecting to the same server then there was probably a setting difference that caused the inappropriate plan to not be shared between the two connections. In order for a connection to reuse a previously cached plan quite a few settings (plan cache keys) must be the same including ANSI_NULLS, ARITHABORT, Language, DATEFIRST and default schema (if the query relys on any implicit name resolution). You can view these by looking at sys.dm_exec_plan_attributes (the ones where is_cache_key=1 need to be the same between connections). A full list of the attributes where is_cache_key=1 is dbid_execute required_cursor_options compat_level parent_plan_handle date_format language_id status merge_action_type is_replication_specific objectid acceptable_cur

Categories : SQL

Qt deploying issue on other computer
You have three options: Compile Qt with static libraries and link you program with those static libraries. All dependencies will be included in the program binary. Ship Qt dynamic libraries that your program needs with your program. Ask the user to install Qt libraries with the same major version you used to compile your program. I'm not a Windows guys so I can't tell you Windows specifics, but these will do the job.

Categories : C++

Test ASP.NET Web API with SSL from another computer (not localhost)
After messing with this and searching the Internet for answers for a few hours, I finally found something that addressed my issue: Scott Hanselman's blog entry. IIS Express is the answer. SSL and debugging from other clients on the network used to be really difficult prior to VS 2010 SP1 and the advent of IIS Express. In VS 2010 and earlier, Cassini was your default development web server and didn't support SSL. You used to have to download and install the full-blown IIS and run it as a local service on your development machine. Starting with VS 2010 SP1, you can convert your project over to using IIS Express for development. Use the steps on Scott's blog entry if you are on VS 2010. In VS 2012, IIS Express is the default development web server. SSL Using IIS Express, you can turn

Categories : Asp Net



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