w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML videos Categories
Call a BackEnd-Method from FrontEnd written in BackEnd
I recommend attaching a CSS class name via the CssClass property of your dynamically created button. Then have jQuery handle the click of the button via event delegation using the on () function. Read jQuery on() function documentation for more information. Once you have jQuery handing the event client side, then you have several choices of interacting with the server (__dopostback, ASP.NET AJAX Page Methods, ASP.NET Web API, asmx web services, WCF, etc.).

Categories : Asp Net

Backend and frontend MVC
There is no one-on-one analogy of front- and backend and the MVC model. For example, the admin of a (Django) site is generally considered to be part of the backend - it is not the part of the site the user will see - but part of the admin is definitely the View part of the MVC model. Anything a normal web user sees and/or directly interacts with is part of the frontend, everything else is part of the backend. Now what is the MVC framework used in Django? We have: The Model: this is the part of the application that holds the state of the application. In Django, a big part of this is the database and it's abstraction layer, the Django models. Other parts are user sessions and the request variable. The View: this is the part of the application that presents the state of the application t

Categories : Django

Backend and Frontend Database
I think what you want is a standard web application, which provides a lot of plugins for managing your database (with an ORM). Ruby on Rails and Python/Django spring to mind. Database splitting is not a good idea (look up database consistency, atomic operations, ...)

Categories : Database

Frontend Backend Interaction in Themes
If you need a page with theme options I recommend taking a look here: http://wp.tutsplus.com/tutorials/using-the-settings-api-part-1-create-a-theme-options-page/ It's a good tutorial, but maybe a bit too much for beginners

Categories : PHP

Rails one controller for backend and frontend?
You don’t need separate controllers, you can block off views/actions individually. A common way is to run a filter before certain actions. That way you can keep authentication and controller logic separate. If you want a simple way to make /backend only available to yourself I recommend following the example for basic http auth given in the Rails docs. The line where you define which actions require a password is: http_basic_authenticate_with name: "dhh", password: "secret", except: :index which says to block off all actions except index. You can flip this around by using http_basic_authenticate_with name: "dhh", password: "secret", only: :edit I don’t recommend using the latter because it’s easy to forget to block off an action this way. If you have a user model in your Ra

Categories : Ruby On Rails

Some products disappeared from magento backend and frontend
Try checking the following tables: catalog_product_entity catalog_product_entity_datetime catalog_product_entity_decimal catalog_product_entity_gallery catalog_product_entity_group_price catalog_product_entity_int catalog_product_entity_media_gallery catalog_product_entity_media_gallery_value catalog_product_entity_text catalog_product_entity_tier_price catalog_product_entity_varchar You can find the sku in the catalog_product_entity table.

Categories : Magento

nginx frontend server is not redirecting to apache backend
I was having a similar issue with my Nginx setup with my Apache back end, specifically when Apache was issuing a redirect for: /some-location => /some-location/ Nginx was running on port 80, and my back end Apache on port 8000. and port 8000 was being passed onto the client in the 301 redirect. It took a bit of playing, but I was able to get it to work. Here is what I had to do: location / { proxy_pass http://127.0.0.1:8000; proxy_redirect default; proxy_redirect http://$host:8000/ http:/$host/; ... etc .. } Both Nginx and Apache virtual servers are using the same hostname (i.e. mydomain.com)

Categories : Django

Should I use a separate REST backend project and a javascript heavy frontend?
No best answer here, it really depends on your project. Play allows you to do both anyway. Cases where you'd better go with plain HTML: If you have to support IE 6/7(/8) If your content needs to be found in search engines If you are very content oriented (texts, images) If you want your users to load the page fast Cases where it's better to choose "one page app": A lot of user interactions, keeping a state Collaborative and realtime Non hierachical navigation (graphs) A lot of data-visulisations

Categories : Api

Magento programmatically created attributes showing up in backend but not frontend
Check out your attributes' settings. "Use In Layered Navigation" and "Used in Product Listing" options should be enabled. Also you should use default Magento import/export functionality. Just keep in mind that the script has a really strange and sillent way to handle exceptions in code formating and missing fields, only hard exceptions like missing SKU fields are displayed. Here is a tutorial fromt he magento knowledge base http://www.magentocommerce.com/knowledge-base/entry/tutorial-using-magentos-import-export-profiles

Categories : Magento

Passing a variable from Access (frontend) to SQL (backend) Stored Procedure
There may be a more direct method, but you could: Make a 1 row, 1 column table in SQL Server. Before executing your stored procedure, your Access db can clear that table and insert your value to it (using standard Delete and Insert queries). Then, your stored procedure can access that value (or values) with a simple Select.

Categories : SQL

Handling CSRF/XSRF tokens with Angular frontend and Drupal 7 backend
The solution has to do with how the cookies need to be set and then passed through subsequent requests. Attempts to set them manually did not go well but the solution was simpler than I expected. Each $http call needs to set the options: withCredentials: true Another change I made was to use the term CSRF instead of XSRF, to be consistent with Drupal. I didn't use any built-in AngularJS CSRF functionality.

Categories : Rest

AJAX update delete tr in table : backend works but glitch with frontend
you have to repalce <span class="delete_update"><a href="#" id="$postid;">X</a></span> to <span class="delete_update"><a href="#" id="$postid">X</a></span>

Categories : PHP

magento passing variable to config.xml from frontend
<crontab> <jobs> <company_export_send_order> <schedule> <!-- Use the config path in your system.xml here --> <config_path>globalconnector/general/cron_settings</config_path> </schedule> <run> <model>globalconnector/observer::cronUpdates</model> </run> </company_export_send_order> </jobs> </crontab> In your module's system.xml, simply define a text field in which to enter the cron expression. More detail here: magento cron in backend configuration

Categories : PHP

CodeIgniter backend site to extend to support frontend site
I will suggest this link for complete solition http://philsturgeon.co.uk/blog/2009/07/Create-an-Admin-panel-with-CodeIgniter On this site 3 methods are given choose which fits your requirements

Categories : PHP

sharing settings/config between client and backend
I do the following (note that this is Jade, i have never used require.js or backbone, however as long as you can pass variables from express into your templating language, you should be able to place JSON in data-* attributes on any element you want.) // app.js app.get('/', function(req, res){ var bar = { a: "b", c: Math.floor(Math.random()*5), }; res.locals.foo = JSON.stringify(bar); res.render('some-jade-template'); }); // some-jade-template.jade !!! html head script(type="text/javascript" , src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js") script(type="text/javascript") $.ready(init); function init(){ var json = $('body').attr('data-stackoverflowquestion'); var obj = JSON.parse(json); console.log(o

Categories : Javascript

Django admin/frontend authentication issue
Admin is also a user in django. So, you can't have more than one user logged in at the same time in the same browser, can you? Try the same scenario on facebook. This is what it is. You re fine, there's no problem. On the side note, if you are just getting started with your project use Django 1.5.

Categories : Django

Multiple web.config on shared hosting
The only way to have a subdirectory act as a separate application with its own web.config is to configure it to be a separate IIS application. In a dedicated hosting environment, you'd do this within IIS. However, the fact that you're on a shared hosting platform doesn't automatically make it impossible. Most shared hosting provides a web interface that you use to configure your site, and often - but not always - that interface will give you the ability to set up subfolders as separate applications. I can't tell you whether you have this option or where it is, since I don't know what control-panel software/product your hosting uses (and even if I did, I probably wouldn't be familiar with that specific product/version, but it's worth having a dig around in your control panel to see if yo

Categories : C#

web.config that came with application will not work on shared host
From my question comment. Verify that the ASP.net version of your site matches your hosted website ASP.net version. It looks like you are using ASP.net 2.0. I suspect that the hosted site will be ASP.net 4.0

Categories : Asp Net

Angularjs and php as backend
There's basically two kinds of relevant "routing" both based on URLs, either client side or server side. AngularJS has the $routeProvider which you can configure so when the location changes (handled by $location) the client side template and controller being used also change. On the server side you may have redirects or "routes" that map a URL to a particular PHP file (or Java method) where at the destination it parses the incoming URL to get extra information/parameters. I know nothing about laravel, but googling laravel and authentication came back with this which looks promising: http://bundles.laravel.com/category/authentication I also know things like Zend framework provide many similar options for plugging in some authentication code. Ultimately if you're writing the CRUD operat

Categories : Angularjs

AngularJS and PHP backend
You might want to consider this type of application as actually TWO applications. The first is the backend, the API. You can use your PHP framework to build an API that will allow you to have data persistency, validation (business logic), etc... and forget about the front end for now, you are only building an API for the backend data. The second part of the app is the AngularJS frontend. This includes all of the views and everything that the client sees. None of that is coming from the backend. This allows you to use the backend API (the PHP bit) to act as the data store, with it's own validation for safety, while having the seamless user experience and basic client side validation from AngularJS. Routing is AngularJS, as that is the actual frontend that the client is using. Caching c

Categories : PHP

Deploying shared server controls with web.config transforms
It turns out that this is as simple as changing the build file path parameter to be the solution file instead of the project file. This means that you specify a solution configuration instead of a project configuration. Solution configurations are managed in the configuration manager and you can specify the configuration of each project in the solution configuration so it all works nicely. I have two projects that need to be published (a web application and a WCF service application) and they depend upon five other class library projects. I have it set up so that the class library projects are built using either the Debug or Release configurations and the two projects that have config files that need to be transformed have one configuration per system. One thing of note. In the old

Categories : Visual Studio 2010

Modularization of Backend (Django)
As a beginner you better stick with different projects for different domain, when you gain more experience, you will find out how much of the logic is reused in both and then make a decision of reusing the apps in single project. Please read the section on wsgi: https://docs.djangoproject.com/en/dev/howto/deployment/wsgi/

Categories : Django

PhoneGap with Django Backend
That's right, you cannot run python code on iOS or Android using PhoneGap, but there is no need to do that. Yes, you can build a native mobile application of your site using PhoneGap. I'll try to explain a bit how these technologies compare to each other: Django is a python web framework running on a web server PhoneGap is a framework for building native mobile applications using web technologies (HTML5+CSS+Javascript), the application will run on a mobile device One common approach is to build the mobile UI with i.e. jQuery Mobile and use the Django web application to provide a RESTful API to get data to the application. Take a look at this another question for more details. Edit: Answer the question in the first comment Yes, it's possible to build a fast and well working applic

Categories : IOS

Using memcached with a dynamic django backend
You would cache whatever is being most frequently accessed from your Database. Make a list of the most frequent requests to get data from the database and cache the data in that priority. Cache the most frequent requests based on category of the pictures Cache based on users - power users go into cache (those which do a lot of data access) Cache the most recent inserts (in case you have a page which shows the recently added posts/pictures) I am sure you can come up with more scenarios. I am positive memcached (or any other caching) will help, even though your app is very 'dynamic'.

Categories : Django

How do I configure Simple Backend in Django Registration
The code... url(r'^accounts/register/$', RegistrationView.as_view(success_url=settings.LOGIN_REDIRECT_URL), name='registration_register') ...is technically correct, but it looks like there's a bug in the django-registration library which means it will effectively ignore this value, so you'll have to override the get_success_url() method if you actually want something that works.

Categories : Python

Good Program example Mongodb backend with Django 1.3
Well MongoDB provides an Online shell to test and see MongoDB working you can test some code snippets there and it is much JSON like code, so that would be easy to grasp http://www.mongodb.org/ (there would be an option called try it out) and learn also The below link might help you. http://mongoengine-odm.readthedocs.org/en/latest/django.html

Categories : Django

Which backend for caching results from API calls in Django
As you mentionned it, the results are long lived, so why not save the results to disk as a text file containing the JSON once it has been made for the first time ? I had a similar issue with some API calls extracting huge amounts of data. This is how I solved my problem: Hash the query string (search=noodles => 838f8d9a[..]a370bbfa6df46b171c02f0c) Search for the file with the same hash (838f8d9a[..]a370bbfa6df46b171c02f0c.txt) If the file exists: Check the file creation time (see How to get file creation & modification date/times in Python?) If the file is recent enough, just send the contents of the file as the response. If the file doesn't exist: Generate the contents (as you're doing now) and save the contents in a file (with the hash of the query as filename for future r

Categories : Django

Django custom backend Session Timeout
At settings: SESSION_EXPIRE_AT_BROWSER_CLOSE = False This middleware will check for max 24h + 1h idle: class timeOutMiddleware(object): def process_request(self, request): shouldLogout = False if request.user.is_authenticated(): if 'beginSession' in request.session: elapsedTime = datetime.datetime.now() - request.session['beginSession'] if elapsedTime.seconds > 24*3600: del request.session['beginSession'] shouldLogout = True else: request.session['beginSession'] = datetime.datetime.now() if 'lastRequest' in request.session: elapsedTime = datetime.datetime.now() -

Categories : Django

Change Django Authentication Backend for Testing
Create an alternative settings file, for example myproj/test_settings.py, and specify that settings file when running unit tests. Write the alternative settings file like this: from myproj.settings import * AUTHENTICATION_BACKENDS = ( #'your.ldap.backend', 'django.contrib.auth.backends.ModelBackend', ) That is, the settings inherits everything from your regular settings, but overrides the AUTHENTICATION_BACKENDS definition, with your LDAP backend commented out. Then, run your tests like this: python manage.py test --settings=myproj.test_settings

Categories : Django

DISTINCT keyword IN MYSQL backend in Django?
try shared_file = File.objects.filter(id__in = Share.objects.filter(user_id = log_id) .values_list('file', flat=True)) .annotate(count=Count('share__shared_user_id', distinct=True))

Categories : Mysql

Django Multiple Authentication Backend for one project, HOW?
You can have multiple authentication backends. Just set the AUTHENTICATION_BACKENDS in settings.py of your Django project to list the backend implementations you want to use. For example I often use a combination of OpenID authentication and the standard Django authentication, like this in my settings.py: AUTHENTICATION_BACKENDS = ( 'django.contrib.auth.backends.ModelBackend', 'django_openid_auth.auth.OpenIDBackend', ) In this example Django will first try to authenticate using django.contrib.auth.backends.ModelBackend, which is the default backend of Django. If that fails, then it moves on to the next backend, django_openid_auth.auth.OpenIDBackend. Note that your custom backends must be at a path visible by Django. In this example I have to add django_openid_auth to INSTAL

Categories : Python

AngularJS + Jersey RESTful backend: Authentication & Authorization
If you want to have a loosely coupled API that might be used from other frontends and/or services OAuth is certainly the way to go in my opinion. It can save you a lot of cross domain headaches as well (IE9 won't allow cookies, authentication etc. to be included in cross domain requests for instance). If you're absolutely sure it's only going to be your own frontend, I'd consider placing the API in the same web application, which would solve authentication by using the same as the frontend.

Categories : Angularjs

Updating data in jquery mobile using Django as backend
You could use WebSockets to connect to a node.js server, then broadcast updates to a list of listeners when the data changes in the background process. Read more : http://www.html5rocks.com/en/tutorials/websockets/basics/ http://socket.io

Categories : Jquery

How can I do a fuzzy search using django-haystack and the elasticsearch backend?
No need to fork Haystack, you can update that method in your own backend (for more details, see Stretching Haystack's ElasticSearch Backend). The build_search_kwargs method returns a dictionary so you can just modify the original return value. Disclaimer: this code is just an example of how you could update your own backend, not how to implement fuzzy search. class FuzzyBackend(ElasticsearchSearchBackend): def build_search_kwargs(self, query_string, **kwargs): fuzzy = kwargs.pop('fuzzy', False) fuzzy_field = kwargs.pop('min_similarity', '') search_kwargs = super(FuzzyBackend, self).build_search_kwargs( query_string, kwargs) if fuzzy: search_kwargs = {'fuzzy': {fuzzy_field: query_string}} return search_kwargs

Categories : Django

Code shared between virtual functions
I believe you could use the Non-virtual interface idiom You'd have the base class as follow: class A{ public: void myFunc(); private: virtual void myVirtualFunc(); } with notably the following in the .cpp : void A::myFunc(){ //stuff myVirtualFunc(); //stuff } Then each derived class can reimplement myVirtualFunc() and change its behavior. The virtual is private so you're guaranteed it won't be called anywhere but in the public non-virtual defined by the base class (guaranteeing that the code you need to run for each call will be ran), and the private visibility doesn't prevent the derived class from reimplementing it. The derived class can specify what the virtual does, not where (though as mentioned by @WhozCraig, the derived class still can reimplement the vi

Categories : C++

How do you set "Content-Type" when saving to S3 using django-storages with S3boto backend?
According to this answer, the Content-Type isn't metadata but rather headers that you set up when you upload the file.

Categories : Django

Allowing inactive users to login via custom django backend
Your user gets authenticated successfully, but it's the AuthenticationForm that raises a ValidationError when the user is inactive. You can override the clean method in a subclass to catch the corresponding ValidationError: class InactiveAuthenticationForm(AuthenticationForm): # a bit messy but it should work def clean(self): try: return super(InactiveAuthenticationForm, self).clean() except ValidationError as e: if self.cached_user is not None: # user exists but is not active # behavior that's skipped because of the validation error self.check_for_test_cookie() return self.cleaned_data else: raise e However, consider that a user's is_active flag is a replacement f

Categories : Python

NGINX Reverse Proxy for upstream Django/Gunicorn Backend
Proxy Buffering Generally proxy buffering is only going to help you if you're generating very big web pages, or sending large files. regardless, it's pretty easy to set up, but you will need to tune the buffer sizes to about the size of your largest pages +20% (Any page that doesnt fit in the buffer gets written to disk), or selectively enable proxy buffering on your largest pages. docs: http://wiki.nginx.org/HttpProxyModule#proxy_buffering Caching I don't know much about your app and how dynamic it's content is, but setting up correct Cache Control/ETAG header generation on your app will be the first thing you'll want to look at. This is what will let Nginx know what is safe to proxy. Also, you may wish to setup multiple cache zones to manage the amount of space your caches take on di

Categories : Django

Register & login to django backend from iphone app and mobile browser
If you have already integrated django-registration on your website, then you don't necessarily need to add tastypie just for login,logout etc. Check out the documentation for django-registration at https://django-registration.readthedocs.org/en/latest/quickstart.html#setting-up-urls. If you follow the steps for the default setup, that should provide you with URLs for login, logout etc. If the section on "Required Templates" doesn't make sense to you here, read more about django at http://www.djangobook.com/en/2.0/chapter04.html Once you have these URLs, you can simply make use of the AFNetworking library on iOS to create HTTP requests to login / logout etc. Typically, a django view for registration will serve GET and POST requests differently. If you make a GET request, it will format

Categories : Django

Default django-ajax-uploader with s3 backend gives MalformedXML error
I solved this problem with a custom s3 backend that override the upload function & use django-storages instead of boto to save files. try this : from ajaxuploader.backends.base import AbstractUploadBackend from django.core.files.storage import default_storage class S3CustomUpload(AbstractUploadBackend): NUM_PARALLEL_PROCESSES = 4 def upload_chunk(self, chunk): #save file to s3 self._fd.write(chunk) self._fd.close() def setup(self, filename): self._fd = default_storage.open('%s/%s' % ('uploads/materials/', str(filename)), 'wb') def upload(self, uploaded, filename, raw_data, *args, **kwargs): try: if raw_data: # File was uploaded via ajax, and is streaming in. chunk = uploaded.read(se

Categories : Python



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