w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML videos Categories
While Sending Html Mails from my web application Recieved Mails contains Symbols like &ldquo,&rdquo, ‘
Check with another constructor for htmlView: ContentType mimeType = new System.Net.Mime.ContentType("text/html"); var htmlView = AlternateView.CreateAlternateViewFromString(bodyMessage, mimeType);

Categories : Asp Net Mvc

Apache Multiple Django Sites Including Root
Do you really mean for /app2 to map to /path/to/app1/wsgi.py? Other than that, there is nothing wrong with that Apache configuration snippet. Make sure you are not wrongly setting FORCE_SCRIPT_NAME in your Django settings file. Make sure you aren't use setdefault() in wsgi.py for Django to set DJANGO_SETTINGS_MODULE. See: http://blog.dscpl.com.au/2012/10/requests-running-in-wrong-django.html

Categories : Apache

Apache named-based VirtualHost configuration for multiple sites in one host
This has to be done through your http server configuration (like apache). VirtualHosts is how you split multiple domains across one computer, and their respective .htaccess configuration will give you protection for your site (username/password). If you just want to split the computer into multiple hosts, you don't need to use .htaccess. See the following links Here are some VirtualHost Configuration Examples Apache HTTP Server Tutorial Server Config Files Excerpt from the "example's" link on "Name-Based Virtual Hosts": <VirtualHost 172.20.30.50> DocumentRoot /www/example1 ServerName www.example.com # Other directives here ... </VirtualHost> <VirtualHost 172.20.30.50> DocumentRoot /www/example2 ServerName www.example.org # Other directives

Categories : Apache

Using multiple Django admin sites for multiple databases
@Zack4 I now have almost exactly the same code as you, but mine works. One questionable thing that I see is that--- whereas it will be deprecated in 1.7, I recall having read--- in 1.6.5 which I'm using it's still necessary to include the following in the url config: admin.autodiscover() When I omit that I get a notice that I don't have permission to change anything... not the problem identified in the question but maybe something else is being done that avoids that problem and leaves the one that you have. And what is "core.admin" in your url config? There is no Django module of that name, according to the error message that I get when I try it. Is "core" the name of your project root directory? Maybe there is a conflict with Django's use of the word "core". Finally, in my struggles

Categories : Django

Using same static folder on multiple django sites
In a situation like this, I would use Amazon S3 and CloudFront. You can transparently upload all of your static files to your S3 bucket using django-storages when you run collect static by replacing the default file upload mechanism with boto + s3 as such: DEFAULT_FILE_STORAGE = 'storages.backends.s3boto.S3BotoStorage' As @AdamKG stated, if all of these sites share the same code, with different content, you're probably better off using Django-CMS or moving these sites to database records rather than deploying the same code over and over.

Categories : Django

How to convert multiple web sites hosted on IIS to Azure web sites
Considering www.foo.com/bar, www.foo.com/baz and wildcard.foo.com/bla are 3 independent web applications that share a domain (foo.com): Create a Windows Azure Website for each web application. You don't necessarily need to assign custom domain names to them. Create another, separate website and assign to it the *.foo.com domain using an A record. Refer to Configuring a custom domain name for a Windows Azure web site for instructions. As documented, "With an A record, you map a domain (e.g., contoso.com or www.contoso.com) or a wildcard domain (e.g., *.contoso.com) to the single public IP address of a deployment within a Windows Azure web site. The main benefit of this approach over using CNAMEs is that you can map root domains (e.g., contoso.com) and wildcard domains (e.g., *.contoso.com

Categories : Azure

deploying multiple django projects with apache, one wsgi or many?
No it is not frowned on to use multiple WSGI scripts and doing so is not buggy as such, except to the extent that Django generates a dodgy WSGI script file which you need to change to ensure you don't get environment variable leakage. That said, you may still have issues with third party C extension modules for Python which are broken and don't work in sub interpreters, which is why it is preferred to use daemon mode if you can, as you can workaround such buggy third party modules. So overall there is no issue with mod_wsgi, but you may encounter issues if using other software which uses a sub optimal way of configuring things, or which are broken by design. Personally I would suggest simply not using Windows as it is a poor environment to be running Python web applications. Only use Wi

Categories : Django

Howto configure Apache WSGI for multiple separate Django instances?
You may need to set WSGIPythonHome since you have different Django installations. WSGIPythonPath is used to define additional directories, but this option do not set default python installation. So probably, your default python directory also includes django (1.5) and recognize this version as the default django version. I do not know your python and django installation and configuration but this might be the reason. Additional info for WSGIPythonHome

Categories : Python

How can I host multiple Django instances (on different subdomains) on a single Apache instance?
This link expains how to serve 2 different Django projects from the same Apache server: Multiple Sites in Django

Categories : Django

Hash table implementation collision avoidance and resolution in C++
Each table entry will need to contain the set of key/value pairs that match the hash. You'll then need to search that set for the requested key after looking up the table entry. If collisions are rare, then a simple vector of pairs is probably good enough. If they are frequent enough that the search is too slow, and you can't reduce the frequency by enlarging the table or using a better has function, then consider sorting the vector and using a binary search, or using std::map, or another hash table (with a different hash function), to store the colliding elements. Of course, unless this is a learning exercise, you'd usually just use std::unordered_map (or the Boost, TR1 or STL equivalents if you can't use a C++11 library). Also, always remember the Rule of Three when designing a class

Categories : C++

Why Don't Hash Tables for Strings Simply Use This Collision-Less Function? (included below)
HashCode is only a helper field for HashMap, HashTable and similar structures. It doesn't have to be non-collision, it's only used to speed up the sorting process and lookup. Having a perfect yet complicated algorithm is not neccessary, and if it's too complex, it would only slow down the process. Not to mention that some giant number isn't exactly practical for this purpose. It's in a good detail explained on the wikipedia page.

Categories : Java

GoogleTest 1.6 with Cygwin 1.7 compile error: 'fileno' was not declared in this scope
Setting the C++ standard to -std=gnu++0x rather than -std=c++0x, worked for me. You can try the statement: g++ -std=gnu++0x -DGTEST_OS_CYGWIN=1 -I"E:sourcegtest-1.6.0include" -O0 -g3 -Wall -c -fmessage-length=0 -MMD -MP -MF"src/challenge.d" -MT"src/challenge.d" -o "src/challenge.o" "../src/challenge.cpp" Setting symbol (-DGTEST_OS_CYGWIN=1) has got nothing to do with this error.

Categories : C++

how can i resolve the default apache page for django with apache
Make sure that you have mod_wsgi installed and enabled for Apache. You will also want to ensure that you have defined both WSGIProcessGroup and WSGIScriptAlias (configuration directives for mod_wsgi) for the virtual host.

Categories : Django

Django, problems with overriding model in sites packages
Subclassing the model is an example of model inheritance. It is not possible to 'override the model and route to the same db table'. A better approach would be to subclass ModelChoiceField, and override label_from_instance to display a site instance as you wish. Then use your model choice field to select the site in your form.

Categories : Django

django.contrib.sites.models.Site gives example.com as the server url
The Site object is stored in the database. Change it there, and you're done. from django.contrib.sites.models import Site mysite = Site.objects.get_current() mysite.domain = 'mysite.com' mysite.name = 'My Site' mysite.save() Alternatively, you can change it in the /admin/ section of your site at /admin/sites/site/1/. This allows you to run multiple sites from the same code-base.

Categories : Python

Django pagination - example from documentation. How to display with all sites number?
You can try this: {% for num in contacts.paginator.page_range %} {% ifequal num contacts.number %} <span class="current"><b>{{ num }}</b></span> {% else %} <a href="?page={{ num }}"> {{ num }}</a> {% endifequal %} {% endfor %}

Categories : Django

Django sites framework, creating primary and slave logic for sensitive urls
I think you're thinking overly complex, a simple decorator should do the trick (untested): def proxy(view): @wraps(view) def wrapper(request, *args, **kwargs): current_site = get_current_site(request) try: main_site = Site.objects.get(id=1).domain # or set this hard except Site.DoesNotExist: raise Http404 if current_site != main_site: return HttpResponseRedirect('http://{0}{1}?next=http://{2}/'.format( main_site, request.path, current_site) ) return view(request, *args, **kwargs) return wrapper urls_site_b.py urlpatterns = patterns('', url(r'^foo/$', proxy(bar), name='bar'), ) Now make sure urls_site_a.py also has this pattern (obviously you wouldn't need to decora

Categories : Django

Can a server run Nginx for some sites and Apache Nginx Reverse Proxy for others?
server { server_name example.com; location / { # assuming apache is on port 81 for example proxy_pass http://127.0.0.1:81; # to make apache detect the host header proxy_set_header Host $host; } # if you have assets folders, you can let nginx serve them directly, # instead of passing them to apache location /images { # or /css or /js .. etc try_files $uri =404; } } Note: in the case of assets, sometimes some sites serve assets through rewrites, or even handled by the application it self, you can pass it to apache by adding that in the assets location as a fallback like this location /images { try_files $uri @apache; } location @apache { proxy_pass http://127.0.0.1:81; } In apache you create a virtual host <Virtua

Categories : Apache

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

PHP Sessions on multiple sites
I have much the same problem because I use a custom user handler that takes sessions. I found that logging onto two different related sites on the same server using the same browser window but with different tabs there was crosstalk. If this is not acceptable, I suggest you rename your session variables by site vis: $_SESSION['site1']['isloggedin']=1;

Categories : PHP

Multiple sites with wildcard SSL on IIS 6
If you need to secure only http://app.site1.com then you don’t need to buy wildcard ssl certificate. You can simply secure your website using domain SSL Certificate. (Recommended SSL: RapidSSL Certificate, Thawte SSL123, QuickSSL Premium) Suppose your all three websites are hosted on same IP address. When user type https://www.site1.com then he will not redirect to your https://app.site1.com but visitor will get domain mismatch error in his browser because of same IP address. Wildcard SSL can only secure your primary domain plus unlimited sub domain for that primary domain name. Example: site1.com, www.site1.com, mail.site1.com, blog.site1.com If you want to secure *site1.com and *.site2.com then you should go with Multi Domain SSL Certificate instead of Wildcard ssl certificate.

Categories : Misc

Run multiple sites on the same GWT application
You could use the following way to arrange your projects : - my.application.core.project : it holds all the business logic and views for the application except for the entry point -my.application.customerX.project : it holds only the entry point and the property files used for having the connection to the db, probably customerX specific theme -my.application.customerY.project : it holds only the entry point and the property files used for having the connection to the db, probably customerY specific theme Such an organization of the projects would allow you to have a common core that is distributed to each of the customers and also the ability to build on top of the core customer-specific impelementations.

Categories : Gwt

asp.net multiple sites / facets mvc
Although it would most likely be possible to create these as separate projects with common authentication tokens (I can think of at least one- albeit hackish- way to do this), based on your requirements I would strongly suggest a single project with an admin Area to separate (and namespace) off your models, views and controllers for the admin functions. Although you do not specify which version of ASP.NET MVC you are working with, Areas have been available within MVC since version two. This would allow your admin related views, controllers, models and other classes to be logically grouped together under /Areas/Admin in the project structure (which can spend most of it's time collapsed if you want to keep things hidden away) and also for any classes to be namespaced to SiteProject.Admin.C

Categories : Asp Net

AWS-EC2, how to set multiple public sites with just one instance?
You can add multiple secondary IP addresses to your EC2 instances inside a VPC - See here: http://aws.typepad.com/aws/2012/07/multiple-ip-addresses-for-ec2-instances-in-a-virtual-private-cloud.html Then you can attached a public elastic IP addresses to these private IPs. See instructions here: http://docs.aws.amazon.com/AmazonVPC/latest/UserGuide/vpc-ip-addressing.html#WorkWithEIPs Then you can use Route 53 (or other DNS service) to point your URL to the IPs of your sites. Here is a link to the getting start with Route 53: http://docs.aws.amazon.com/Route53/latest/DeveloperGuide/GetStarted.html Update: Once you have your multiple IP you need to point your Domain URL to the different IP. With Route 53 as a distributed and highly available DNS service, you can add these records. See on t

Categories : Linux

Nginx with multiple sites in subfolders
What about using something like the alias function offered by nginx? http://wiki.nginx.org/HttpCoreModule#alias If that doesn't work for your workflow, does symlinking to the /core directory prevent that error?

Categories : Nginx

How to redirect with Htaccess TO multiple sites?
If this is strictly an apache thing (e.g. not using scripts, DNS, controllers, etc) then you can use a RewriteMap directive and define a random map. The RewriteMap directive can only be defined in server or vhost config, so you'll get an error if you try to define it in an htaccess file. In server/vhost config, define map: RewriteMap recipes rnd:/path/to/file/servers.txt In your servers.txt file: random_server recipe1|recipe2|recipe3|recipe4|recipe5|recipe6|recipe7|recipe8|recipe9 (etc) Then in either your server/vhost config or in the htaccess file in your www.randomrecipes.com domain's document root: RewriteEngine On RewriteCond %{HTTP_HOST} ^(www.)?randomrecipes.com$ [NC] RewriteRule ^/?$ http://www.${recipies:random_server}.com/ [L,R]

Categories : Htaccess

How can I load multiple sites in different context?
You can't access pages from other domains with JavaScript unless the domain explicitly allows your domain. Typically you would use a server-side language for this, or better, use the website's public API. If they don't have a public API they probably wont appreciate you crawling their site.

Categories : Javascript

manage ads to multiple sites in javascript
I worked at a spot that used javascript in order to render ads. This is how I accomplished it. First, server type. I was running an NGINX web server with a PHP-FPM backend, with Varnish (cache) in front of it. The server was basically serving up static files, so this kept server load tremendously low. This is a decent tutorial for setting that up on CentOS I used an Amazon Elastic Beanstalk, small instance type, to run this. It never needed to spin up more than one Small instance to serve somewhere in the neighborhood of 2.5MM javascripts per hour. Keep in mind, it's just serving small text snippets. The tags looked like this: <script type="text/javascript" src="http:/ads.someserver.com/1234"></script> Where the [1234] was the tag ID number. Each publisher could have mul

Categories : Javascript

Searching multiple sites or databases at once
You won't be able to integrate directly with each site most likely, so you're stuck having to login to each and do your work. But there is some hope! Check out Selenium (http://docs.seleniumhq.org/) for automating web tasks. For example, you should be able to "record" yourself logging in and clicking to a page - and then in the future you just run a script and Selenium will do it for you. Should save a few steps. You'd still need a tab open per site, but it should help.

Categories : Database

Laravel 4 multiple sites with single codebase
I think you can just duplicate the public folder and rename it to anything you want. The trick here is to point your domains to the different public folders you renamed into. This enables you to have the same backend with multiple sites. Then, the next thing you need to configure is your routes.php. That's it.

Categories : PHP

New sites are created but not showing in My Sites drop down
Not sure if you ever resolved this or not, however since this page was the first to come up with I googled the issue, I figured it could use an answer. For me, it was human error due to the fact that I was managing so many users. I ended up not assigning them to my overall admin account. Once you go into the site's users and make sure to add your admin username, the site should show up.

Categories : Misc

How do large sites store data over multiple servers?
Build your app on top of Amazon Web services or Windows Azure and let them worry about this since it's fairly complex.

Categories : Database

Reusing python flask code across multiple different sites
Normally for these types of scenarios the "behaves differently based on Host" logic is built in the application. So the better solution is #3 but my suggestion is to not use app dispatch. Build the logic to get the configuration for the hostname directly in the main application (for example you can load the specialized configurations in a @before_request handler and use a single DB instance). If you plan to use only one small server, as you said, this solution is light on resource. 50 different uWSGI instances with their own processes would fill your memory and start swapping easily.

Categories : Python

Collision between multiple objects
One possible solution that might be robust against the problem you described (totally untested): Move your object for a full time-step dt Check for collisions with other objects, this might be more than one object Calculate the 'time of impact' by interpolation, which is some real number that is smaller than the time step. Do this for each object you collided with, and choose the minimum one. This gives you the time to the first collision t_col < dt. Redo the last step, but now move the object only for t_col so that it exactly hits the object and then start flipping velocities and other collision related physics. You can now either finish the step here if you are lazy (probably ok, since dt should be small), or continue to move for another dt - t_col and see if you hit something else.

Categories : Algorithm

andengine manage multiple collision
If all sprites in your game have body and they are colliding with other body object then you can use Contact Listener in andengine Contact Listener will automatically detect which two body objects are colliding and you can make some effects on collision

Categories : Android

SharePoint Client Object Model - How to read a list with the same name in multiple sites
After a review with a colleague we manage to fix the problem. It seems that I was doing an improper call to a method that was not defined in the scope of the javascript class. Those are the kind of silly mistakes that bug you out for several hours because you overlook them. Below is the actual working code after some refactoring so anyone can have it here for future references. $(document).ready(function () { SP.SOD.executeOrDelayUntilScriptLoaded(loadMyProjects,'SP.js'); }); var $ddlMyProjects; var $ddlMyProjectsNewItem; var $ddlMyProjectsEditItem; var allProjects = new Array(); function loadMyProjects() { $ddlMyProjectsNewItem = $("#ctl00_ctl32_g_03acc13b_954d_4bdc_9544_b379206bc9d5_ctl00_ctl05_ctl00_ctl00_ctl00_ctl04_ctl00_Lookup"); $ddlMyPro

Categories : Javascript

Obtaining the hash of a file using the stream capabilities of crypto module (ie: without hash.update and hash.digest)
From the quoted snippet in the question: [the Hash class] It is a stream that is both readable and writable. The written data is used to compute the hash. Once the writable side of the stream is ended, use the read() method to get the computed hash digest. So what you need to hash some text is: var crypto = require('crypto'); // change to 'md5' if you want an MD5 hash var hash = crypto.createHash('sha1'); // change to 'binary' if you want a binary hash. hash.setEncoding('hex'); // the text that you want to hash hash.write('hello world'); // very important! You cannot read from the stream until you have called end() hash.end(); // and now you get the resulting hash var sha1sum = hash.read(); If you want to get the hash of a file, the best way is create a ReadStream from th

Categories : Node Js

Continuous Collision Detection - how to find the collision according to these 2 equations in C++
This is probably a question for StackExchange Mathematics. But here's my answer: The two equations tell you where the centers P_1 and P_2 of the circles or balls are at some point in time t are. Now you need to find a value for t for which the distance between P_1 and P_2 is the sum of the radii which I will call d (like distance). According the the theorem of Pythagoras the square of the distance of the two points is the sum of the squares of the coordinate differences. This square of the distance is a quadratic polynomial in t, i.e. a*t*t+b*t+c. Now you can find the value of t where the two balls or circles collide by setting this equal to d*d and solving for t. If there is no solution, then the balls/circles won't collide.

Categories : C++

In a file/array, search for hash key, and replace it with the hash value, do this for all hash keys/values
You exhaust your file the first time through your loop using the initial $find and $replace key/value pair. There are two potential solutions: Open the file for reading during each iteration of your while loop (expensive) Move the foreach loop to the outside of the while and iterate the hash each time (less expensive) example: REPLACE: for my $line (@gtfarray) { while(my ($find, $replace) = each %hash) { if($line =~ s/$find/$replace/g) { push @newgtf, $line; next REPLACE; # skip to next iteration } } # if there was no replacement, push the old line push @newgtf, $line }

Categories : Perl

Securely store password hash django
You're just assigning values to variables. You should be assigning it to the form: if RegForm.is_valid(): clearUserName = RegForm.cleaned_data['userNm'] clearPassNoHash = RegForm.cleaned_data['userPass'] RegForm.userPass = bcrypt.hashpw(clearPassNoHash.encode("utf-8"), bcrypt.gensalt(14) ) RegForm.save()

Categories : Django



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