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

Can't get django-testapp to work or create a superuser with django-norel
This has nothing to do with django-nonrel. Does your settings.py file exist? If it does, it's probably syntactically incorrect, run python settings.py to identify the SyntaxError.

Categories : Python

Error in creating superuser django
2 min google search and here it is: How to fix locale issue on MacOsX Please modify the locale name accordingly, maybe to en_US.UTF8 as in this link it's for italian.

Categories : Python

Does Django require an IDE an does ASP.NET require Visual Studio?
The need to recompile your code while using Visual Studio is due to the design of the programming language used - not due to Visual Studio. Java is the same, whether or not you are using NetBeans, Eclipse, or NotePad. An IDE is typically not required, but as you pointed out, it makes life easier. I started out using vim to program in Python - but now use Eclipse. Django comes with built-in command line tools to help you build your initial project, but in theory, you could manually create these files.

Categories : Asp Net

Does the simpleGrid require additional downloads?
Check the fiddle (http://jsfiddle.net/rniemeyer/QSRBR/) provides in the Simple Grid sample. It need the KO library + knockout.simpleGrid.1.3.js And you need to define the PageGridModel ko.applyBindings(new PagedGridModel(initialData));

Categories : Javascript

Bluetooth Low Energy does it require additional hardware controller?
Yes, both the devices needs bluetooth 4.0 chip to communicate for BLE.None of the BLE communication can happen over classic bluetooth, check wiki link and differnce, BLE has low data transfer rate as compared to classic bluetooth

Categories : Misc

django datatables additional data from server to template
I also use datatables with django, including server side processing. The problem with what you want to achieve is that datatables itself is making a very specific request to the url, and expecting certain data so it can update the table. You could possibly implement a custom fnServerData function, extract your sMeow value and do your processing, and then delegate to fnCallback for datatables to update the table. However, this will only allow you to use the sMeow values from javascript, since the processing is happening client-side (so no django templating). Taking the code example directly from the link above (and adding a little, see comments): $(document).ready(function() { $('#example').dataTable( { "bProcessing": true, "bServerSide": true, "sAjaxSource":

Categories : Jquery

django dajaxice javascript callback with additional parameters
Am I correct to assume this flag will depend on something from within the ajax function? If so, could you not pass your flag as a part of the returned json? function callback(data) { alert(data.message); if (data.flag) { /* do something */} }

Categories : Javascript

Making additional data available in template context in django cms
Make it a plugin, register the plugin and use its render method. See the docs.

Categories : Misc

django admin additional field on changelist page
Well, I found it out myself. The way to do it is to override the queryset() in BookAdmin class. Like: def queryset(self, request): return Book.objects.all().select_related('author') That is it. Django will load the Author in the same time it loads Book. So there will be only on database hit rather than over 100 hits.

Categories : Django

How to send django models into a template with additional custom fields?
Just make it a property on the model. class Post(Model) @property def age(self): return now() - self.timestamp

Categories : Python

Why is my Django installation delivering an empty HTTP response? (Additional)
Set: WSGIApplicationGroup %{GLOBAL} in your Apache configuration. This will work around issues with third party extension modules in Python that will not work with Python sub interpreters and can crash. If that doesn't help, you likely have shared library conflict issues that are causing crashes. Both of these issues are described in the official mod_wsgi documentation. So go check out the Frequently Asked Questions page in the mod_wsgi documentation for further links.

Categories : Python

best way to add additional fields to django-rest-framework ModelViewSet when create
Update: Since v3 you need to do this: def perform_create(self, serializer): serializer.save(owner=self.request.user) The principle remains the same. You want to make the owner field of your book serializer read-only and then set the association with the user in pre_save(). Something like: def pre_save(self, obj): obj.owner = self.request.user See the tutorial section on "Associating Snippets with Users". I hope that helps.

Categories : Python

Django: Require Checkbox to be ticked to Submit Form
Something like from django import forms class MyForm(forms.Form): check = forms.BooleanField(required = True) # your other form fields For a BooleanField, required = True will check if the box is checked. This is because data will only be submitted if it is checked. Source: https://docs.djangoproject.com/en/dev/ref/forms/fields/#django.forms.BooleanField Validates that the value is True (e.g. the check box is checked) if the field has required=True.

Categories : Python

How to get superuser privileges in Ruby?
According to this site : http://ruby.about.com/od/rubyversionmanager/qt/Rvm-And-Sudo.htm you can start executing the script using the rvmsudo command. In your terminal window or shell script: rvmsudo ruby blockreddit.rb

Categories : Ruby

can't create superuser with custom userprofile
In this book said: Option 2: Subclass AbstractUser: Choose this option if you like Django’s User model fields the way they are, but need extra fields. Maybe you have to subclass AbstractBaseUser. See here or a full example. Edit USERNAME_FIELD should be used if you want to use another username field. If you want that, you must subclass AbstractBaseUser instead of AbstractUser, because the last one already has defined a USERNAME_FIELD Hope helps!

Categories : Django

create row of date while creating superuser
Try this function as signal handler: def location_title(sender, instance, created, **kwargs): # Don't fire up on updates. if not created: return # Only handle new superusers. if not instance.is_superuser or not instance.is_active: return # Create a `Location` entry for new superuser. l = Location(user_id=instance.pk) l.save() post_save.connect(location_title, sender=User) Adding choices to model field: Django CharField has a named argument choices that allows you to give the end user a list of possible values, and a proper validation of them in forms. The format of the iterable is as follows <internal_value>, <display_value>. Once a field has been passed a choices argument, you can access display value connected to it's interna

Categories : Python

Is there much additional overhead when retrieving an additional row from a SQL Server table
You can simply use a SQL Join statement to retrieve Questions along with all corresponding answers. Select * from Questions inner join Answers on Questions.ID = Answers.QuestionID Just to give an example.

Categories : Sql Server

setuid bit on, yet program can't open a superuser file
Because /superuser.cpp is the name of a file in the filesystem root, not in the current working directory. Use superuser.cpp or ./superuser.cpp if the file is in the same path as you are when you run the program.

Categories : C++

TypeScript with require.js and jquery does not work on production server (require.js Script Error)
Are you compiling your website in Release mode when you are deploying to your server? In that case you need to add a release version in the project file: <PropertyGroup Condition="'$(Configuration)' == 'Release'"> <TypeScriptSourceMap> --module AMD</TypeScriptSourceMap> </PropertyGroup> <Target Name="BeforeBuild"> <Message Text="Compiling TypeScript files" /> <Message Text="Executing tsc$(TypeScriptSourceMap) @(TypeScriptCompile ->'&quot;%(fullpath)&quot;', ' ')" /> <Exec Command="tsc$(TypeScriptSourceMap) @(TypeScriptCompile ->'&quot;%(fullpath)&quot;', ' ')" /> </Target> In TypeScript 0.8.2+ the format is: <PropertyGroup Condition="'$(Configuration)' == 'Debug'"> <TypeScr

Categories : Jquery

Check jquery in paths / require.config - Require.js
Please Checkout this http://blog.falafel.com/blogs/basem-emara/2013/03/01/how-to-avoid-loading-jquery-twice-with-requirejs. It might help.

Categories : Javascript

Monobjc MSBuild tasks not working (additional libraries/excluded assemblies/additional assemblies)
The ExcludedAssemblies tag should work. Its goal is to exclude some assemblies from being embedded in the generated binary. That also means that these assemblies should be accessible elsewhere (i.e. the Resources folder). For the AddtionalLibraries, this is clearly a bug. Can you file one ?

Categories : Osx

Django - Integrating django-profiles (and django-registration) with django-facebook
Here's how I suggest you do things. Do away with django-facebook and look into django-allauth. It will handle accounts (registration, logic, connecting social accounts). Also, django-profiles has many issues with 1.5+ for me and I don't bother with it and instead create my own profiles app and UserProfile model with any additional fields that wouldn't be handled by django-allauth. An example from one of my implementations class UserProfile(models.Model): user = models.OneToOneField(User) default_address = models.OneToOneField(Address, blank=True, null=True) default_tshirt_size = models.CharField(blank=True, null=True, choices=constants.tshirt_sizes, max_length=50) default_shoe_size = models.CharField(blank=True, null=True, choices=constants.shoe_sizes, max_length=50) Y

Categories : Python

Django django-haystack cannot import CategoryBase from django-categories on the first run
Finally managed to fix it!!!! Root cause was in from categories.models import Category in videos app, which is another app model importing the Category which extends CategoryBase, and it's causing circular reference, to fix it, in the models.py of videos app, change from direct import to lazy import as below: categories = models.ManyToManyField('categories.Category', null=True, blank=True) Update: Above fix only worked very briefly and then I got other circular import problems on other models, what finally fixed it was upgrading haystack to v2.1.0

Categories : Django

Add additional directories to ack.vim
You have to write a custom command (e.g. :AckMore) or redefine the :Ack command to include additional paths. Sketch (not working; I don't use those plugins): :command! -nargs=* AckMore execute 'Ack' <q-args> g:gem_directory

Categories : Vim

Add Additional Jpabnel
I'm not sure... but is this ok?: redLabel.add(p);// <- redLabel is JLabel,and p is JPanel...? If I've understood the problem... you should also add redLabel to some panel.

Categories : Java

Additional condition in for each
No it's not possible. You can use the old "normal" for loop for that: auto iter = std:begin(list) for (int i = 0; iter != std::end(list); ++iter, ++i) { auto& it = *iter; // ... }

Categories : C++

get additional value from form
Error is here: @Html.Hidden("hidMode", Request.QueryString["mode"].ToString()) You give name hidMode to hidden field and expect it as cmd in your controller. So either rename hidden field or rename input parameter in a controller action

Categories : Asp Net Mvc

Django with VS2010 gives me "ImportError: No module named django.core.management" when running
Ok with a lot of fooling around I found this directory: %LOCALAPPDATA%MicrosoftWeb Platform InstallerinstallersPythonDetectInstalls In a mangled sub-folder there is a powershell script DetectPythonInistalls.ps1 that has these two lines for checking if python is installed already: $regKey = "hklm:SOFTWAREPythonPythonCore$pythonVersionInstallPath"; $correctRegKey = "hklm:SOFTWAREWow6432NodePythonPythonCore$pythonVersionInstallPath"; Uninstalling all my pythons did not remove these keys. After removing these registry keys with regedit, WPI allowed me to install its own version of python 2.7 and all the other goodies to go with the Windows Azure Python SDK and it worked.

Categories : Python

Django-How to make the django inbuilt auth view recognize the customized form
You should override the URL to pass your custom form class as a view keyword argument. Details in How to override a view from an external Django app.

Categories : Python

django.contrib.comments.moderation.AlreadyModerated error in zinnia django
I came across this issue too. The way I was able to fix it was to link back to the model_bases folder in the original zinnia package. In my site's 'zinnia' folder (where the updated South migrations are stored): $ ln -sf <python-path>/lib/python2.7/site-packages/zinnia/models_bases .

Categories : Python

Django ajax no refresh:django view without redirecting or refreshing a page
You may want to try the Ajax library for Django project: http://www.dajaxproject.com/ In case you've never heard of Ajax, here's the definition from Wikipedia: Ajax (an acronym for asynchronous JavaScript and XML) is a group of interrelated web development techniques used on the client-side to create asynchronous web applications. With Ajax, web applications can send data to, and retrieve data from, a server asynchronously (in the background) without interfering with the display and behavior of the existing page.

Categories : Python

Django - How to Authenticate users while logging in (or) registering while using django-bootstrap-toolkit?
In your auth method, if auth_form.is_valid() returns False, you do not return a response object. The same is the case in def register(request): . If it is a GET request, the method does not return a response object. Hence the error(s)

Categories : Django

HTML5 form attributes with Django forms and django-bootstrap-toolkit
You can set the value of the widget.attrs to pass certain other HTML attributes to the form. >>> from django import forms >>> name = forms.TextInput(attrs={'size': 10, 'title': 'Your name',}) >>> name.render('name', 'A name') u'<input title="Your name" type="text" name="name" value="A name" size="10" />' -Django Docs

Categories : Django

Django - Accessing model from django.contrib's User class via ManyToManyKey
There you go: if user.is_authenticated() and story not in liked_stories: In this line the error is thrown. The code you have posted does not resemble the code you are executing.

Categories : Django

Subclassing django-registration 1.0 forms for django 1.5 custom user models
Some parts are most definitely not Django 1.5 compatible yet: https://bitbucket.org/ubernostrum/django-registration/src/8f242e35ef7c004e035e54b4bb093c32bf77c29f/registration/forms.py?at=default#cl-48 class RegistrationForm(forms.Form): # ... def clean_username(self): # ... # The line below needs fixing existing = User.objects.filter(username__iexact=self.cleaned_data['username']) if existing.exists(): raise forms.ValidationError(_("A user with that username already exists.")) else: return self.cleaned_data['username'] So unless those methods are changed and/or you subclass them, it won't work yet. For your specific case this registration form should do the trick: from registration import forms as registration_for

Categories : Django

How to add additional actions to command
There are a couple of things you can try. If you are just trying to prevent your window from closing, you can override the OnClosing method and set the cancelled flag: protected override void OnClosing(CancelEventArgs e) { e.Cancel = true; base.OnClosing(e); } If you want to specifically alter the behavior, you can register with preview versions of the command: <Window.CommandBindings> <CommandBinding Command="ApplicationCommands.Close" PreviewExecuted="CloseCommandHandler" PreviewCanExecute="CanExecuteHandler" /> </Window.CommandBindings> The preview routed events will happen before the standard events, allowing you to handle the logic before your base class.

Categories : C#

How to publish additional artifact with sbt (one-jar)
I have no experience with one-jar but here is an alternative : give sbt-assembly a try. Same principle but with an existing option to publish the jar.

Categories : Scala

Navigation UL/LI additional space
I can not figure out why I'm getting a space to the left of each of the LI tags Because you format them with display:inline-block - and have whitespace between the tags. That's basic "HTML behavior", that any whitespace between two inline(-block) elements is condensed to one space character when displayed. Either float the LI instead, or write them without whitespace between the tags, meaning ...</li><li>...

Categories : HTML

Additional event handler
Form what I understood the client might be preventing the event propagation from elements where they have a click handler registered. Since you are registering the event handler to the body element it will be fired only when the triggered in a particular element is propagated all the way upto the body element. A dirty possible solution is to add the handler to all the elements in the page, but this will not work for elements which are added dynamically. jQuery('body *').click(function(event){ alert('clicked'); }); Demo: Problem (clicking on T1 does not fire the click event) Demo: Solution

Categories : Javascript



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