w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML videos Categories
grails.serverURL with Nginx doesn't work properly
grails.serverURL does not have anything to do with the outside url (except for absolute links generated from grails). You can configure your nginx to handle any domain and internally do the proper redirects. The caching you have described is probably due to the browser cache.

Categories : Tomcat

Web.Config Debug/Release : Doesn't work
Configuration transformation is only done when publishing. Your base configuration file should have your development settings. If you choose to use the default build configurations, normally the release transform file should contain your production environment settings and the debug transform file will contain your test environment settings. Personally, I usually create a new build configuration for testing and for production and leave the debug and release transforms empty. Edit: If you use the latest version of the SlowCheetah extension for Visual Studio, it will transform your configuration files during the build.

Categories : C#

View Scope doesn't work in faces-config.xml
JSF doesn't do that. You're apparently being misled by the IDE (e.g. Eclipse) giving this warning as if it came from JSF itself. Note that it works fine when you ignore this warning and run the project as is. You've apparently configured your IDE project to be a JSF 1.x project instead of a JSF 2.x one. You'd need to set it right in the project facets configuration in IDE project's properties. Unrelated to the concrete problem, since JSF 2.0 there's no need to register beans in faces-config.xml anymore. You could just use @ManagedBean and friends for that.

Categories : JSF

Why doesn't this bit of code work? Setting variables and config file
Here are a couple things to fix: Start your script with a "shebang," such as: #!/bin/sh This way the shell will know that you want to run this as a Bourne shell script. Also, your conditional at the top of the script doesn't handle the case well in which .rm.cfg exists but doesn't contain a slash character anywhere in it. In that case the rbin variable never gets set. Finally, try adding the line ls ~ at the top so you can see how the shell is interpreting the tilde character; that might be the problem.

Categories : Bash

My ajax is simple, but doesn't work
I think it would be $('#result').text(data + "OKkkkkk"); And I dont think that through the cross domain AJAX will communicate and also you are getting JSON data ,so you need to filter that data and can display. As per your need ,you need an error block like $.ajax({ type:"GET" , url:"http://api.openweathermap.org/data/2.5/weather?q=London,uk" , dataType:"json" , success: function(data){ $('#result').text("data" + "OKkkkkk") }, error : function(){ alert('Ajax call was failed'); } }); If the ajax call is success then it will goto success block and input the result data into result div or if it is fails then it will alerts on going to the error block

Categories : Jquery

jQuery simple getJSON doesn't work
First of all: You have to be sure that your JSON file ( which is regarded in getJSON() ) is accessible and has no any errors. Then use the following snippet: $(document).ready(function(){ $.getJSON('/the/path/to/theJSON',{ format: "json" }).done(function(data){ alert(data.fruit_name); }); });

Categories : Jquery

Why my simple filter in Jersey doesn't work?
I suspect your JAX-RS mapping for serving requests through Jersey may be /services/*. So you are attempting to filter a request that Jersey is not configured to process. /* Will match a wider set of URLs.

Categories : Java

Simple MySQL Insert doesn't work?
You'r inserting field user(string) as non string try this: if(isset($_POST['putUser'])) { $user = mysql_real_escape_string($_POST['user']); $amount = $_POST['amount']; $what = $_POST['what']; $country = $_POST['country']; $platform = $_POST['platform']; $query = mysql_query('INSERT INTO sells(id, user, amount, what, country, platform) VALUES (NULL , "'.$user.'", 1, 1, 1, 1)'); if($query) { echo 'ok'; } else { die(mysql_error()); } } As everybody say on comments, you shouldn't use the post info direct on mysql query, this make "sql injection atack" the easyiest thing on the world. You should scape some characters from string to prevent this. And do some research about PDO on PHP this link may help here

Categories : PHP

Rails 3.2.1 simple JQuery ajax example doesn't work
Try renaming /views/main/ajax_msg.js to /views/main/ajax_msg.js.erb so that file can handle embedded Ruby? For debugging and to make sure it's rendering embedded ruby you can just try doing any other string in there: jQuery('#div_hello').html("<%= puts 'blah' %>"); I think that is the problem.

Categories : Ruby On Rails

simple jquery selector doesn't work in chrome
$('#scheduleBox').on('change', '.selectCity', (function() { var cityToShow = $('option:selected', this).val(); switch(cityToShow) { case '0': $('.bucuresti, .cluj, .otopeni, .iasi').show(); break; case '1': $('.cluj, .otopeni, .iasi').hide(); $('.bucuresti').show(); break; case '2': $('.cluj, .bucuresti, .iasi').hide(); $('.otopeni').show(); break; case '3': $('.bucuresti, .otopeni, .iasi').hide(); $('.cluj').show(); break; case '4': $('.bucuresti, .otopeni, .cluj').hide(); $('.iasi').show();

Categories : Javascript

Simple read from text file algorithm doesn't work
You are using C-style strings (char arrays) without properly allocated memory, and you are just manipulating with the pointer, so you are not appending characters into your string: // build the string... it starts at <begin> and ends at <end> const char *string = ""; for (int i = begin; i < end; i++) { string += line.at(i); } Use std::string instead: /// build the string... it starts at <begin> and ends at <end> std::string str; for (int i = begin; i < end; i++) { str += line.at(i); } Or allocate memory by hand, use the proper indexing, terminate the string with '' character and don't forget to delete the string after you don't need it anymore: char *string = new char[end - begin + 1]; int j = 0; for (int i = begin; i < end; i++) { string[j

Categories : C++

Simple/Single layer perceptron algorithm doesn't work
There are at least three problems with your code: You are redeclaring the error variable, it was first meant to be a summarized error, then you declare it again as a per-output-neuron error, which leads to the lose of information reagarding the whole process Your stopping criterion is bad - it should be a mean absolute value of errors, not just sum of errors - consider simple network, which classyfies one training example of label 0 as 1, it will result in negative error in your code, so training stops, even though it is far from being over It is not true, that after training with var inp = [ {in:[1,1], out:1}, {in:[0,0], out:0}, {in:[0,1], out:0}, ]; you will get f( [1,0] ) == 0, this is not how perceptron works. It will simply find such a line in the 2 dimensioal plane, that [

Categories : Javascript

Simple CSS3 keyframe animation doesn't work in Firefox
It seems that background-position is not an valid transition/animation property. For some reason it works in Chrome, but the only other solution is to fade-in-out absolutely positioned images, or to animate background position of image sprite. Which is exatly what I had done.

Categories : CSS

Simple Servlet doesn't work in eclipse, build folder is empty, throwing ClassNotFoundException
First of all which kind of project are you using??? Any project will have a Java Build Path set. To get to it.. Go to Project and right click on it and select Properties. e.g XYZ Project --->Right Click--->Properties Under that Choose Java Build Path and select Source tab. where under the window you can find a Path Specifier "Default Output Folder" this should contain path of your build folder as seen in image. If it is not containing the path than you can go to browse and select the path for build folder. Keep in Mind that all your servlet's classes should be here and it needed to be configured. Hope it helps.. And feel free to comment if you need more help.

Categories : Java

HTML, PHP, JavaScript -- How to make a button for each individual record in a database? Seems simple but doesn't work
Your problem is $resultArrayImplode; is a string, so var resultArray = <?php echo $resultArrayImplode; ?> renders as: var resultArray = 1,2,3,4,5 Which is a syntax error. What you can do is use JSON. JSON syntax is JavaScript syntax, so all you need to do is: var arrayEntries = <?php echo json_encode($resultArray); ?>; This should render as something like: var arrayEntries = [1,2,3,4,5]; Which is perfect JavaScript syntax. Then the rest of your code should work.

Categories : PHP

*Actually* getting nginx to reload config
I happen to have had similar problems, each time that was a simple issue (that took me a long time to find though). For instance (sorry if some points are obvious - but sometimes we focus on the difficult, ignoring the obvious - at least that's my case) ensure the symlink is present in sites-enabled root path has read access all the way from / (at at least x) for the nginx user is subber.localhost well defined in /etc/hosts for local tests (or local DNS), Maybe you could try to force the IP on which listen is listening. Eg instead of listen 80 you could try listen 127.0.0.1:80; # OR listen 192.168.0.1:80; # you local address (or remote if that's the case)

Categories : Nginx

NGinx config for redirecting domain
this works fine for me: http { server { listen 80; server_name service1.domain.com; location / { proxy_pass http://192.168.0.2:8181; proxy_set_header host service1.domain.com } } server { listen 80; server_name service2.domain.com; location / { proxy_pass http://192.168.0.3:8080; proxy_set_header host service2.domain.com; } } } have a try?

Categories : Nginx

Nginx Config: one Server name and two Applications
what keyword you need is 'passenger_base_uri' reference from:http://www.modrails.com/documentation/Users%20guide%20Nginx.html#deploying_rails_to_sub_uri The following is a simple example Suppose that you already have a server virtual host entry: http { ... server { listen 80; server_name www.phusion.nl; root /websites/phusion; } ... } And you want your Ruby on Rails application to be accessible from the URL http://www.phusion.nl/rails. To do this, make a symlink in the virtual host’s document root, and have it point to your Ruby on Rails application’s public folder. For example: ln -s /webapps/mycook/public /websites/phusion/rails Next, set passenger_enabled on and add a passenger_base_uri option to the server block: http { ... server { listen 80

Categories : Ruby On Rails

Linking nginx config with installing
ln -fs /etc/configuration/nginx/nginx/app.conf /etc/nginx/sites-available/app You need to link it to sites-enabled and not available - and it will probably work for you. I would also not change the name of the conf-file, for clarity: ln -fs /etc/configuration/nginx/nginx/app.conf /etc/nginx/sites-enabled/ would make it work Looks like you are doing some configuration management of your own, have you check out puppet, chef, cfengine, saltstack?

Categories : Shell

Nginx and Unicorn Basic Config
Normally app_server would be defined in another file as an upstream. For example - on my debian system I have a location set up similar to yours pointing to an upstream called www in my /etc/nginx/sites-enabled directory I have a file called upstream_www_app with the following content upstream www { server localhost:24910 fail_timeout=0 weight=5; } 24910 is the port defined in my applications config/unicorn.rb and my main nginx.conf includes all files in the sites-enabled directory.

Categories : Ruby On Rails

Nginx config for serving snapshots to the Google bot
Ok first let me explain why google uses ?_escaped_fragment_, This is used for websites that rely on ajax, and mark their page with hashes, like for example if you have http://example.com/gallery/#!image1 and each time the user changes to the next image you update the hash to image2, image3, but if the user goes directly to http://example.com/gallery/#!image50 your javascript uses that hash to load the 50th image directly instead of image1 ( servers can't see the hash part, only javascript can ). So google uses this _excaped_fragment_ to tell the server which page it's trying to cache. For more explanation use this link As for why you get a 404 error, I think because you used a $1 without using a capturing block, The right rule would be something like this location / { if ($args ~ "_

Categories : Angularjs

How to configure Phalcon in the Nginx config file
This is the link to the official phalcon nginx configurations. http://docs.phalconphp.com/en/latest/reference/nginx.html

Categories : PHP

How do i restart nginx only after the config test was successful on ubuntu?
Actually as far as i know, nginx would show an empty message and it won't actually restart if the config is bad, the only way to screw it up is by doing an nginx stop then start again, it would succeed to stop but fail to start.

Categories : Ubuntu

Spring frame work config issue "prefix context for for element context:annotation-config is not bound"
The following works for me: test.xml <?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:context="http://www.springframework.org/schema/context" xmlns:dwr="http://www.directwebremoting.org/schema/spring-dwr" xmlns:mongo="http://www.springframework.org/schema/data/mongo" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd http://www.springframework.org/schema/data/mongo http://www.springframework.org/schema/data/mongo/spring-mongo-1.0.xsd http://www.dire

Categories : Java

heroku django - process based on static file path (like nginx config in normal server) or atleast middleware
You can force your django app server serve static content for you by defining custom view and adding it into URLs like this: urlpatterns += patterns('', (r'^static/(?P<path>.*)$', view.MyStaticFilesView.as_view()), ) So now you can get path variable and create your own logic. Just ensure that you return images, texts or any other content with propper content-type. And also you can track __someconstantstring and redirect anywhere you want. This method will cause additional load to your app server.

Categories : Python

Where is my nginx being configured? Changing nginx.conf still brings me to the 'Welcome to nginx' page
when you rewrited the nginx.conf in the folder of source code of nginx and installed it firstly, it will be copied to /usr/local/nginx/conf/nginx.conf (without specially modification of the configure in the folder of source code). But when you do this secondly, the nginx.conf in the folder of source code will be copied to /usr/local/nginx/conf/nginx.conf.defualt,and it usually don't work unless you use nginx -c /usr/local/nginx/conf/nginx.conf.defualt to assign its configure file evertime. There is a line NGINX_CONF_FILE="/usr/local/nginx/conf/nginx.conf" in your script above,which indicates the configure file clearly. To handle this, I suggest rewrite /usr/local/nginx/conf/nginx.conf (not the one in the folder of source code) instead.

Categories : Nginx

Nginx sites-enabled, sites-available: Cannot create soft-link between config files in Ubuntu 12.04
You need to start by understanding that the target of a symlink is a pathname. And it can be absolute or relative to the directory which contains the symlink Assuming you have foo.conf in sites-available Try cd sites-enabled sudo ln -s ../sites-available/foo.conf . ls -l Now you will have a symlink in sites-enabled called foo.conf which has a target ../sites-available/foo.conf Just to be clear, the normal configuration for Apache is that the config files for potential sites live in sites-available and the symlinks for the enabled sites live in sites-enabled, pointing at targets in sites-available. That doesn't quite seem to be the case the way you describe your setup, but that is not your primary problem. If you want a symlink to ALWAYS point at the same file, regardless of the wher

Categories : Ubuntu

Why passing a simple pointer in this simple example will not work
You are assigning the results of malloc to the parameter ptr, which is local. You should be assigning it to what ptr points to. void f(int **ptr, int size, int value) { *ptr = (int*)malloc(sizeof(int) * size); // Rest of code }

Categories : C

Magento: Anchor Categories and Simple/Config Products
I would put the configurable product and simple products in their same categories. And if you have a category listing page, maybe try using a cms block to load a specific category of products on a category landing page. So for example, if you have Products>Electronics and you want to show electronics in the Products category, just add a cms block calling Electronics on the Products page so that the links will be their correct links (not /products or /product name). But magento creates a root/product-name url for all items. And being an anchor really just lets you use sort the items in that category by filters. Hope that helps

Categories : Magento

Nginx - Rewriting url to $url.php, and if doesn't exist, rewrite to $url/
Try using try_files: http://wiki.nginx.org/HttpCoreModule#try_files For example (untested): try_files $uri $uri/ /test.php

Categories : Nginx

expose_php not work (nginx)
finally I got it . the reason is about the configure options below is the original configure options ./configure --prefix=/usr/local/php-5.3.26 --with-config-file-path=/usr/local/php-5.3.26/etc/ --enable-fpm --enable-debug --with-openssl --with-pcre-regex --with-zlib --with-bz2 --with-curl=/usr/lib/ --with-readline=/lib --with-libxml-dir=/usr/lib --with-mysql=/usr/local/mysql and I changed to the fowlloing ./configure --prefix=/usr/local/php-5.3.26 --sysconfdir=/usr/local/php-5.3.26/etc/ --with-config-file-path=/usr/local/php-5.3.26/etc/ --with-config-file-scan-dir=/usr/local/php-5.3.26/etc

Categories : PHP

How to test simple ruby method, with timing and config dependencies
You may be able to use timecop as part of the solution (which also scores highly for me as "best-named gem, ever"). It is simple to use, and patches most sources of time data in sync, so that if for example your Utils module uses standard methods to assess time, it should have the same concept of "now" as Time.now shows. Note this won't work if Utils is making a call to external API on another process, in which case you should stub it to return uptime values needed in your test assertions. The following rspec snippet by way of example, and making some assumptions about what you have available (such as module under test being called Server) describe "#should_restart?" before :each do Timecop.travel( Time.parse("2013-08-01T12:00:00") ) Server.start # Just a guess # Using `mo

Categories : Ruby

Why doesn't Nginx load balancing balance bandwidth?
It sounds like the configuration is doing exactly what you asked it to do. You configured a proxy on the first server IP, right? So data has to go from the user to the proxy, then to the server, then the reply from the server back to the proxy and then to the user. It's triple because the first server sees three flows (both servers' output from the proxy and the second server's input to the proxy) while the second server sees one (its output to the proxy). It is perfectly balancing the traffic into equal flows, the first server just sees three flows and the second just one. As for how you fix it, it depends what's wrong with it and what you're trying to accomplish, which you haven't told us.

Categories : Nginx

Nginx no longer starts and doesn't give output
You seem to have a problem here: #server { listen 80 default; server_name anything; # Everything is a 404 location / { return 404; } } server is commented out, but the other lines in that set are not. If you intended on commenting out the entire server block, you'll need to use: #server { # listen 80 default; # server_name anything; # # Everything is a 404 # location / { # return 404; # } #}

Categories : Ruby On Rails

nginx: error_page dont work with rewrite
Please take a look at the directive recursive_error_pages, and it works for me. And kudos to Jim D.

Categories : Nginx

Nginx auth_basic and rewrite in subdirectory does not work
Use: error_page 404 =200 /my-project/index.php; instead of ugly rewrites: if (-f $request_filename) { break; } rewrite ^(.*)$ /my-project/index.php last; Reference: http://nginx.org/r/error_page http://wiki.nginx.org/IfIsEvil http://wiki.nginx.org/Pitfalls P.S. try_files doesn't work with alias because of bug: http://trac.nginx.org/nginx/ticket/97, but you can replace alias with root directive: http://nginx.org/r/root

Categories : Nginx

I don't see the Web.Debug.config and Web.Release.config files on my web.config after upgrading my project to VS2012
I found the answer in a post here: how to add files in web.config transformation process? In your "App Data" folder you'll find your publish profiles you created and can right click on them to add a config transform file.

Categories : Visual Studio 2012

which config.xml do I work with?
One file is Cordova's xml file (www) and the other is a platform-specific config.xml. I add all changes in the config.xml above the www directory which works fine. If you want to compile for iOS & android you may use the other one?

Categories : Javascript

Mongodb replica set auto reconect don't work after down and up for nginx + uwsgi with several processes
After a change in your replica set (no primary, new primary, etc.), the next operation will throw an AutoReconnect exception. After that one failed operation, the underlying PyMongo MongoReplicaSetClient will reconnect to the replica set, and future operations may succeed. If there is a new primary, MongoReplicaSetClient will find it and future operations will succeed. If there is no primary, no operations can succeed unless you set your ReadPreference to PRIMARY_PREFERRED. See the docs here: http://mongoengine-odm.readthedocs.org/en/latest/guide/connecting.html#replicasets The reconnection process must happen once per uwsgi process. So if there is a change to your replica set, you can expect one AutoReconnect exception per uwsgi process.

Categories : Python

Have you managed to make your node nginx proxy setup on Heroku work?
This article contains instructions on setting up nginx as a proxy on Heroku, in conjunction with OpenResty, Lua, and LuaRocks. node.js isn't mentioned. It uses this buildpack. Haven't tried it myself but seems someone has got it working.

Categories : Node Js



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