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

App Throws Fatal Error, then reboots and works
For anyone reading this that may have a similar problem the answer can be found here RuntimeException: Unable to instantiate application and if that is not quite what you're looking for try here Exception when I run my application from Eclipse

Categories : Android

Html.TextBoxFor works but EditorFor throws an error - why?
EditorFor works only for strings without a custom template. You'll need to create an Int32 template on path ~/Views/Shared/EditorTemplates/Int32.cshtml in order to make that work. If you don't want to create a template for Int32 type, use TextBoxFor that will work as you already realized.

Categories : Asp Net Mvc

PsExec Throws Error Messages, but works without any problems
This is because PowerShell sometimes reports a NativeCommandError when a process writes to STDERR. PsExec writes the infoline PsExec v1.98 - Execute processes remotely Copyright (C) 2001-2010 Mark Russinovich Sysinternals - www.sysinternals.com to STDERR which means it can cause this. For more information, see these questions / answers: http://stackoverflow.com/a/1416933/478656 http://stackoverflow.com/a/11826589/478656 http://stackoverflow.com/a/10666208/478656

Categories : Windows

Navigating to Record works, but deep link throws error?
I am no ember-data expert, but it seems that it is returning a promise. Therefore you should try: App.ItemsRoute = Ember.Route.extend({ model : function(){ var accountPromise = App.Account.find(1); var itemsPromise = Ember.Deferred.create(); accountPromise.then(function(account){ itemsPromise.resolve(account.get("items")); }); return itemsPromise; } }); Why does it have to be it that way? App.Account.find(1); performs an asynchronous call and therefore returns a promise. That's why you can't immediately return the items, you have to wait for accountPromise to be fulfilled. You return a new promise (itemspromise) which gets fulfilled when the accountPromise gets fulfilled. Because you return a Promise, Ember waits for it to be fulfilled and uses the resul

Categories : Ember Js

Python turtle throws an error on close
Seems that your loop tries to continue after Tk has destroyed some important objects. You could signal the closing event via a flag: import turtle import random import time import Tkinter as tk turtle.hideturtle() closed = False def on_close(): global closed closed = True exit() # Register hander for close event tk._default_root.protocol("WM_DELETE_WINDOW", on_close) class Mus: def __init__(self): turtle.setx(random.randint(1,100)) turtle.sety(random.randint(1,100)) turtle.circle(random.randint(1,100)) # check the flag while not closed: Mus() turtle.exitonclick()

Categories : Python

Python reading date from excel throws error
I believe that you should only skip the header: for raw_index in range(1, sheet.nrows): ... You are checking that sheet.cell(row_head,col_index).value == mydate, and then you want to iterate over the rows, but you should skip row_head first - it is ==mydate, which is not a date but a simple 'Expiration Date' string.

Categories : Python

Calling a function from a string in Python throws error
From the error, your iMode is a string. The iMode is not a method. There must be something wrong with your declaration. And in the class you can use self.iMode, no need to use getattr. I think you may look for the function like eval.

Categories : Python

VideoJS player not loading .webm video file for Firefox (throws "Video Error". Works when no other video sources (like mp4/mov) are provided
It seems mov videos are not supported by HTML5 Firefox implementation, I get this error: Specified "type" attribute of "video/mp4" is not supported. Load of media resource http://dev.muzioapp.com.s3-website-us-east-1.amazonaws.com/content/ourMuzeVid1.mov failed. The explanation about this (maybe) confusion is here: http://stackoverflow.com/a/5080583/208067 When the video is not embedded as a html5 video, Firefox looks for a suitable plugin to play the video and finds QuickTime. The video tag does not.

Categories : HTML

Frapi API throws 500 error for correct action url, otherwise throws ERROR_INVALID_ACTION_REQUEST
By looking at other parts of your API, mainly the default API calls that are set, we can see that the rewrite-rules are working fine. http://www.serverstars.net/collection/foo.json The problem is likely to reside in the model that is either selecting data from the mysql-query and puts it into the $this->data variable, or the problem resides between PHP and MySQL. Whilst I can't give you a direct answer, I would suggest you look at the following: Make sure all the permissions are set properly by looking at: http://frapi.github.io/installing/index.html#frapi.installing.configuring.apache Print the results from the mysql query directly after having received it and use die() (yes, try print-and-die debugging), In your banned collection controller, try removing the MySQL query and pu

Categories : Api

Medium data publish works and Large data publish throws an error? (Node.js & RabbitMQ)
Are you having a problem using the 'amqp' module directly? If so, their issue tab on github is probably the best place to report the problem. If you like, try using my 'servicebus' module as well: https://github.com/mateodelnorte/servicebus. 'npm install servicebus' will get it for you.

Categories : Javascript

p:button outcome throws NPE while h:outputLink value works
This problem is caused by the fact that you are using your final URL as the navigation "outcome", which must actually map to either a specified navigation case or an implicit navigation case (matching a view file on disk). To resolve this, you should use the "outcome" attribute as it is intended (I agree the JSF docs could maybe be clearer on this,) and use the view-id in your button configuration instead: <p:button outcome="/management/product/read.xhtml" value="Navigate"> <f:param name="product" value="#{...}" /> </p:button> This will cause the NavigationCase to resolve successfully, and when the URL is encoded using HttpServletResponse.encodeUrl(), PrettyFaces will handle rewriting the URL to the desired "/admin/product/edit". Note that you can also achieve th

Categories : JSF

SQLite syntax error, but SQL string works manually (python)
This is probably a bug* in sqlite3. While this test code works fine with python3.3 and sqlite 3.7.15.2, it fails with sqlite 3.7.3. That means it should be fixed in newer versions, so you'd need to update your sqlite version (or python) to make it work, or work around this by not using multiple values sets. *edit: actually not a bug, just a feature that was only introduced in version 3.7.11

Categories : Python

Code works, but throws Incompatible Pointer Type warning
PORTB is probably not defined as an int which means that when you take the address of PORTB you won't get an int *. If you are sure you're right and that you can use an int * for PORTB you can use a cast to tell the compiler that it doesn't need to worry. You can cast it like this: ptr = (int*)&PORTB Go to the definition of PORTB and let us know what type it is. Edit 2: I've written an explanation of why you SHOULDN'T USE MY ABOVE ANSWER, and by the time I got around to correcting it I see that @ouah has already posted a correct answer so I ask you to please use it instead of mine. For an explanation as to why, read my Edit 1 below. Edit 1: My assumption was that you knew that PORTB was an int and that you're casting it from void*. Thanks @H2CO3 for pointing out that it is in fa

Categories : C

JSOUP throws url status 503 in Eclipse but URL works fine in browser
You have to set a User Agent: Document doc = Jsoup.connect(url).timeout(30000).userAgent("Mozilla/17.0").get(); (Or others; best you choose a browser user agent) Else you'll get blocked. Please see also: Jsoup: select(div[class=rslt prod]) returns null when it shouldn't

Categories : Java

getJSON Web API works on Development Server but IIS Express 7.5 throws 404 Not found
Visual Studio Development Server runs your application on a specific port so that http://localhost:<port>/api/OSList will work. If you deploy your application to IIS, your application does not run on a dedicated port but 80 (by default) along with other apps. In that case, your URI must include your application name as well. So, if your application name is MyWebApi, then your URI must be http://localhost/mywebapi/api/OSList. getJSON must be something like $.getJSON("/mywebapi/api/OSList", null).

Categories : Jquery

httpclient.execute works but overloaded function throws exception
See the below code is working fine for me HttpContext localContext = new BasicHttpContext(); localContext.setAttribute(ClientContext.COOKIE_STORE, Util.cookieStore); try { HttpResponse response = httpclient.execute(httppost, localContext); } catch (ClientProtocolException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } But you are trying to pass ResponseHandler and it accepts httpContext

Categories : Java

Python zipfile module erroneously thinks I have a zipfile that spans multiple disks, throws BadZipfile error
I get the same error on a similar file although I am using python 3.4 Was able to fix it by editing line 205 in zipfile.py source code: if diskno != 0 or disks != 1: raise BadZipFile("zipfiles that span multiple disks are not supported") to: if diskno != 0 or disks > 1: Hope this helps

Categories : Python

Polymer.dart: using strong types for child components throws exception, var works
I had similar problem, with the error appearing in following code: DivElement templ = query("#myElem"); var ct = templ.xtag; //CustomTable ct = templ.xtag; ct.people = [new Person('aaa', 'aaa'), new Person('vvv', 'vvv')]; where CustomTable extends PolymerElement Fortunately, it seems to be fixed in latest SDK and Polymer (I tried SDK 0.6.21.3_r26639 and polymer 0.6.21+3) I checked your example and it works as well.

Categories : Dart

Akka Scheduler throws exceptions only in MicroKernel but works fine in eclipse IDE for scala
It should create Actors with ActorSystem like in the code below: case object StartSched class Test extends Actor with ActorLogging { def receive = { case StartSched => context.system.scheduler.schedule( 30 milliseconds, (1000*60*30) milliseconds){ self ! updateUows(new Timestamp(new java.util.Date().getTime())) } } } object Main { def main(args: Array[String]) { val sys = ActorSystem("Test") sys.actorOf(Props[Test]) } } To start it in MicroKernel you should extend Bootable trait and overload two methods: startup and shutdown. Docs And creating ActorSystem inside an Actor is a very bad decision.

Categories : Scala

ImageBrush throws exception when trying to set Window background
Your image's build action is probably set to Content, change it to Resource Set the item (your image file) to be a Resource. (In Visual Studio) Right click,Properties,Build Action,Resource

Categories : Wpf

Button.setBackground(Drawable background) throws NoSuchMethodError
You might be testing on an API below level 16 (Jelly Bean). The setBackground method is only available from that API level onwards. I would try with setBackgroundDrawable (deprecated) or setBackgroundResource if that's the case. For instance: Drawable d = getResources().getDrawable(R.drawable.ic_launcher); Button one = new Button(this); // mediocre one.setBackgroundDrawable(d); Button two = new Button(this); // better two.setBackgroundResource(R.drawable.ic_launcher);

Categories : Java

Background Image is displayed OK at design time but compiler throws exception at runtime (when debugging)?
hey KingBoy the problem is related to the properties that you have set for your image..right now your image property is set to DesignTime.So make it to Content and Copy Always Everything will just work fine.you can do this by click on your image and then set its properties in property Window..hope it helps you..

Categories : C#

Stopwatch that works on background
A simple countdown timer will work, and will persist through onPause() if you allow it to. new CountDownTimer(30000, 1000) { public void onTick(long millisUntilFinished) { mTextField.setText("seconds remaining: " + millisUntilFinished / 1000); } public void onFinish() { mTextField.setText("done!"); } }.start(); Refer to this source for more information. You can also update TextViews if you need to show the timer. Edit for count up specifically, try Chronometer, which can be found at this link. You can also find a demo of this in the Samples APK.

Categories : Android

cannot add a requestdescriptor for a same class restkit ios throws error nsinternal inconsistency error
You can't add a descriptor for the same key twice. You haven't added any code, but I know that you're adding all of your mappings and descriptors in the method where you're calling 'patch'. Don't... Separate your configuration from your usage. Put all of your mapping and descriptor setup code into one method and call it once before you do anything else. Then, when you want to 'patch', call a different method which just does that and doesn't include any additional mappings.

Categories : IOS

Import statements are missing in android eclipse and throws "project contains error(s), please fix it before running it" error
That shouldn't be the case usually. You can try the auto import of the library needed instead of manually inserting the library one by one by ctrl+shift+O. Another common problem is that you included the library but it still cannot reference it correctly. Something like cannot reference R.id.xxx, that can be solved by making sure that you don't have import android.R in your code. Hope that helps :)

Categories : Android

Common parser error - could not load type...runs fine in localhost but throws error when published on server
In the end the solution was removing the comments in the web.config file...the reason the application ran fine on my localhost IIS and not on the server IIS was that the IIS versions were different and the version on the server's doesn't like comments in web.config.

Categories : Dotnet

Random background changing only works on firefox?
Try like this <script> function my_function() { var imgs = [ 'images/1.jpg', 'images/2.jpg', 'images/3.jpg', 'images/4.jpg', 'images/5.jpg', 'images/6.jpg' ]; document.body.style = 'background: url(' + imgs[Math.round(Math.random() * imgs.length)] + ') no-repeat ; -webkit-background-size: cover; -moz-background-size: cover; -o-background-size: cover; background-size: cover;'; //also you can try like document.getElementByTagName('body').style = 'background: url(' + imgs[Math.round(Math.random() * imgs.length)] + ') no-repeat ; -webkit-background-size: cover; -moz-background-size: cover; -o-background-size: cover; background-size: cover;'; } my_function(); //Just call this </script> It will call the my_function() on each page load.Beca

Categories : Javascript

Customizing the background of a UITableViewCell works, except on its first touch down
Where you create your cell in cellForRowAtIndexPath, set your default selectedBackgroundView there instead of doing it for the first time in setSelected. Or alternatively call the setSelected super method after you set the selectedBackgroundView property in your override.

Categories : IOS

Testing full-text search with textacular and cucumber throws PG::Error: ERROR: function similarity(character varying, unknown) does not exist
For anyone else out there who runs into this issue, you can run bundle exec rake textacular:install_trigram all you like, but if you use rake to run cucumber or rspec, then db:test:prepare is invoked, and since trigram is not being installed through a migration, this has the effect of wiping it from the db when the schema is loaded! # install trigram in test db bundle exec rake textacular:install_trigram RAILS_ENV=test # wipe trigram from db rake cucumber rake rspec To stop this from happening, just run cucumber and rspec without rake! # run cucumber and rspec without rake cucumber rpsec What a horrible problem! 2 days to fix etc...

Categories : Ruby On Rails

How do I implement a full page background without a scroll bar that works in IE8
If you don't want a scroll bar, you can add OVERFLOW: HIDDEN; to the body & html, or you can make sure that the body's contents are absolutely positioned, thus making the body not inherit the height. html, body { margin: 0px; padding: 0px; border: 0px; height:100%; width:100% overflow: hidden; } You can't use background-size in IE8 as it's not supported, CSS3PIE supports it, but it's still it's a javascript solution, so I'd stick with something simple with javascript. In css, this is what we'd originally have to do, this may just work in IE8 with the filters attached, however to be sure, I'd stick with javascript. html { background: url(images/bg.jpg) no-repeat center center fixed; -webkit-background-size: cover; -moz-background-size: cover;

Categories : CSS

Background image is not showing in IE and works fine with other browsers
You should review background's shorthand implementation: background: (color) url(../images/box.png) no-repeat (position-x) (position-y); ^^^^^ there needs to be a space here too I'd recommend moving to individual declaration if you aren't going to specify everything in the shorthand form of background, i.e.: background-image: url(../images/box.png); background-repeat: no-repeat;

Categories : HTML

W3 Validation error - table background image - says no attribute for background
The background attribute (for the table element) was an unofficial extension to HTML that never made it into the specification. Use the CSS background-image property instead.

Categories : HTML

Jquery addClass works for width and height but not for background and color
Try !important if you already have css background for li .selected{ background: blue !important; color: yellow; height: 200px; width: 100px; } DEMO without important DEMO with important

Categories : Jquery

Python Class that Never Throws an AttributeError or TypeError
Something like this, maybe? class DoNothing(object): def __getattr__(self, name): return lambda *args, **kwargs: None Basically, this class responds to any attribute access with a function that accepts any number of arguments and returns None. logger = DoNothing() logger.info("Stuff is being done") # does nothing Since it's using __getattr__() rather than the lower-level __getattribute__(), you can just throw some regular attributes on there if you want some non-method stuff. class LoggerNot(DoNothing): loglevel = 0 Now you have a loglevel attribute that has a reasonable value (i.e. is not a function) if you have code that checks it.

Categories : Python

Opencv polylines function in python throws exception
This function is not enough well documented and the error are also not very useful. In any case, cv2.polylines expects a list of points, just change your line to this: import cv2 import numpy as np img = np.zeros((768, 1024, 3), dtype='uint8') points = np.array([[910, 641], [206, 632], [696, 488], [458, 485]]) cv2.polylines(img, [points], 1, (255,255,255)) winname = 'example' cv2.namedWindow(winname) cv2.imshow(winname, img) cv2.waitKey() cv2.destroyWindow(winname) The example above will print the following image (rescaled):

Categories : Python

Why do some languages return nil when a key is not in a dictionary, while Python throws an exception?
From the Zen of Python (import this): Errors should never pass silently. Unless explicitly silenced. Meaning, a key not found is treated as an error, unless you explicitly code for it, e.g. by catching KeyError or using the dict.get(key, default) method. Python was explicitly designed to be very explicit in this and (most) other respects.

Categories : Python

Writing Python ElementTree to file throws TypeError
Seem following line is cause. print "ERROR: " + dept Change as follow and retry: print "ERROR: ", dept OR print "ERROR: " + str(dept) ADD Second argument to ET.SubElement should be str. Is deptElement is str? If deptElement is Element, use allDepts.append(deptElement). http://docs.python.org/2/library/xml.etree.elementtree.html#xml.etree.ElementTree.SubElement http://docs.python.org/2/library/xml.etree.elementtree.html#xml.etree.ElementTree.Element.append ADD 2 To reproduce error (Python 2.6): >>> from xml.etree import ElementTree as ET >>> allDepts = ET.Element('depts') >>> ET.SubElement(allDepts, ET.Element('a')) <Element <Element a at b727b96c> at b727b22c> >>> with open('a', 'wb') as f: ... tree = ET.ElementTr

Categories : Python

Facebook getAccessToken() returns app access token: works fine in one server but throws app access token in other.
I had the same problem today, turns out I didn't have the "fb_ca_chain_bundle.crt" file included (and I had the same problem before, the .crt was out of date) (https://github.com/facebook/facebook-php-sdk/tree/master/src). So this may be the issue, and it wasn't documented in their instructions, so both times took me a while to figure out.

Categories : PHP

module works for /usr/bin/python but not /opt/local/bin/python
Was having this issue myself this week. The solution with thanks to [1] is to build it yourself from the git sources [2]. git clone https://github.com/Kitware/VTK.git VTK mkdir VTK-build && cd VTK-build ccmake ../VTK Press 't' for advanced mode. Ensure you've set "VTK_WRAP_PYTHON: ON". Press 'c' to run the first configure. Set PYTHON_EXECUTABLE: /to/your/python (for Macports: /opt/local/bin/python) Set PYTHON_INCLUDE_DIR: /to/your/Python.framework/Headers (for Macports: /opt/local/Library/Frameworks/Python.framework/Headers) Set PYTHON_LIBRARY: /to/your/Python.framework/libpythonx.x.dylib (for Macports: /opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/libpython2.7.dylib) Press 'c' to run final configure Press 'g' to generate make files make [sudo] make install

Categories : Python



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