w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML videos Categories
How to write apps that syncs to device's refresh rate?
You should use animation APIs. See for instance the documentation of ValueAnimator: http://developer.android.com/reference/android/animation/ValueAnimator.html#setFrameDelay%28long%29 This documentation says: "The frame delay may be ignored when the animation system uses an external timing source, such as the display refresh rate (vsync), to govern animations." I don't know whether all devices use vsync (would be curious to test), but it sounds very much like the right way to get animation smoothness. See the developer's guide about property animation: http://developer.android.com/guide/topics/graphics/prop-animation.html In addition, there is an API that will give you the refresh rate: http://developer.android.com/reference/android/view/Display.html#getRefreshRate%28%29 ((WindowManag

Categories : Android

informing interface methods are implemented via __call?
No this will not work. While __call() is really nice for a dynamic coding style it's disadvantages are that you cannot enforce the signatures of the dynamic methods in an interface and you won't get an automated documentation for it. But I think if you are at a point where you want to create an interface for those methods, there should be no need to use __call() anymore. I would just hardcode the methods.

Categories : PHP

How to fix an error that keeps informing me that an abstract keyword is not used and hence i need to declare a body
Auto implemented properties got introduced in C#3.0. If you are using version lesser than 3.0, you need backup field for your property like this - private string firstName; public string FirstName { get { return firstName; } set { firtName = value; } } From MSDN - In C# 3.0 and later, auto-implemented properties make property-declaration more concise when no additional logic is required in the property accessors. They also enable client code to create objects. When you declare a property as automatic, the compiler creates a private, anonymous backing field that can only be accessed through the property's get and set accessors.

Categories : C#

I am trying to make a function that "syncs" a list with only the numeric, non-blank lines of a text file
The reason y remains empty is because you are modifying it in the local scope, not the global scope. Since you start off with y as an empty list anyways, how about just defining it when it's actually going to contain something? Here's a working example: def parse_file(x): y = [] with open(x, 'r') as f: for line in f: if (line.strip()).isdigit(): y.append(int(line.strip())) return y y = parse_file(x)

Categories : Python

Use of tab-size style (CSS) attribute seems to be being ignored - could be a browser bug, want to check before informing mailing list
Please check the MDN documentation on the tab-size property. It is still an experimental property and as such you need to add vendor prefixes to make it work in some browsers. Chrome accepts plain old tab-size without a vendor prefix, but to add Firefox and Opera support you will need to do the following: tab-size:4; -moz-tab-size:4; -o-tab-size:4;

Categories : HTML

How to prevent GXT Dialog from closing on failed validation
Are you using GXT 3.0.x? Using GXT 3.0.x I would solve your request by setting dialog.setHideOnButtonClick(false); To manage the closing of the dialogbox use this code: dialog.getButtonById(PredefinedButton.OK.name()).addSelectHandler(new SelectHandler() { @Override public void onSelect(SelectEvent event) { if (netScanName.getValue() == null) { Util.alert("All fields are required!"); } else { dialog.hide(); } } }); Don't know if this code will work with earlier versons of GXT.

Categories : Java

What is the best way to prevent user from using SaaS app after failed payment
Stripe charges the card on a recurring basis for you. Your application isn't responsible for creating new charges for users who have subscribed for your service. From the docs Stripe makes handling failed payments easy. Stripe can automatically retry a recurring payment after it fails, and can automatically cancel the customer's subscription if it repeatedly fails. How long to wait, and how many times to retry, can be easily set in your account settings. I might track a :subscription_active boolean or similar on my User model. When a user logs in, you can check against the API to see the status of a user's subscription. The API docs have this to say about the status of a subscription in the response (emphasis my own): Possible values are trialing, active, past_due, canceled, or

Categories : Ruby On Rails

Rails: Nested form with STI inheritance informing forms, how to make work with AJAX?
Well, I still don't know if this is the easiest, or DRYist way to do it, but I ended up putting the whole form in the partial, and then just not bothering with nested forms. This worked just fine with the AJAX solution. It makes me sad to repeat the form elements they have in common every time, but it's worth it for the AJAX functionality. I'll try making a bit more DRY, it occurs to me I could try making the subclass partial not need a form, but it could still call a super class form partial to insert the elements each subclass has in common.

Categories : Ruby On Rails

How to Prevent "sqlite_config failed error_code = 21. THIS SHOULD NEVER occur" errors
This happens due to incorrect usage of SQLite Api according to http://stackoverflow.com/a/5285486/1438915 This answer may help you in solving your problem. check SQLite

Categories : Java

How to Install Pebble SDK on Mac OS X
My personal recommendation is to run the Pebble SDK on a Virtual Machine running Ubuntu. I tried getting it installed on Mac OS, and all steps appeared to go as they should, but things were never working right, even after a fair amount of troubleshooting (and I am an experienced Unix/Linux admin). Plus, it did some funny things to some of the custom Unix stuff I had in Mac OS. I installed a VM with Ubuntu and had it up and running quickly and without any complications. VirtualBox (http://virtualbox.org) is free and works well. You can use Eclipse (and many others) for editing code. And most importantly, you don't run any risk of messing anything up on your Mac OS system while fudging around with the Unix system on your Mac OS install. Ubuntu is probably the easiest of the *nixes for non-

Categories : C

Sending boolean to Pebble with PebbleKit
As far as I understand you have to send an Dictionary of keys and objects to the watch. In Objective C it looks like this: NSDictionary *update = [NSDictionary dictionaryWithObjects:objects forKeys:keys]; Keys are all integer and objects I would think can be of Boolean. In my case only String what works well. In a loop I perform something like this on the watch: t=dict_find(received,count); strcpy(strs[count], dict_find(received,count)->value->cstring); But I have to tell you that I am still a rookie.

Categories : Android

Pebble Watch pushing data to iOS when app is in background mode
The Watchface <-> Phone app documentation clearly states that: Only one iOS application can be connected to the watch at a given time; Only the iOS application can (re-)open the channel to the watch app. So your watchface app will be able to send messages to the app, as long as: Your iOS application is the last 3rd party app that used the channel to the watch Your iOS application was not killed in the background (for example, you declared a background mode to make sure you would stay online) Finally, note that the SDK provides you with a callback when the message are not delivered so your watchface app would know if the app was killed and would be able to display a specific message to the user. This is my understanding of the documentation but I have not been able to try that y

Categories : IOS

How to Prevent Image SaveAs + Prevent Image Drag&Drop to Desktop + Prevent Screenshot on a Desktop Browser
To prevent the user right-clicking on the image and choosing Save As, you can add the code oncontextmenu="return false". oncontextmenu detects the user right-clicking and return false stops the action. Then if you do the code draggable="false" the user can't drag the image, even if they select it. I don't think there is a way to stop people using screengrabbers, but here is some code that stops Google Images and other search engines grabbing the image: <meta name="robots" content="noimageindex"></meta>. So all in all, try this method: <meta name="robots" content="noimageindex"></meta><img src="mygreatimage.png" alt="An awesome image" oncontextmenu="return false" draggable="false">

Categories : PHP

Chromecast app starting from sample TicTacToe - failed to start application: request failed
In file README_ECLIPSE.txt it says: In GameActivity at line 91, the code makes a call to the app name "TicTacToe". This is a whitelisted app name at which the TicTacToe receiver is located, so you can simply build and run the app without worrying about whitelisting your own receiver. So please do not change anything in the sample code (to replace with your AppId), just build and run to see if it works for you. If you can't make that work, please check the answer here: Unable to debug Whitelisted device / ApplicationSession failing to start

Categories : Android

Failed to load resource: the server responded with a status of 412 (Precondition Failed)
Probably you're browser is handling this POST the same as Safari is... see: http://avnwx.blogspot.co.at/2011/10/debuggers-lie.html in my case this problem was solved by adding a timestamp to the URL of the linked file to stop my browser from pulling up the cached version.

Categories : Javascript

PERCPU: allocation failed, size=256 align=256, failed to allocate new chunk
The largest chunk available from a module from the per-cpu pool depends upon the current usage by other modules that are already loaded in the Linux kernel. The size of the percpu pool depends upon whether the following configs are defined in the kernel config. CONFIG_HAVE_SETUP_PER_CPU_AREA CONFIG_SMP A typical initial size of the per-cpu pool at boot-up is 32KB per cpu. It can vary if the architecture specific setup_per_cpu_area() function is defined. The exact amount of memory reserved for the percpu pool is logged to the console during the Linux kernel boot. For example, Linux kernel 3.2 on my Intel Core 2 Duo P8700 machine, logs the following : PERCPU: Embedded 13 pages/cpu @f77d1000 s31616 r0 d21632 u53248 The percpu pool is 13 pages i.e. 52KB for each cpu, 104KB total. The

Categories : Linux

activeCollab: Failed to connect. Reason: Failed to load class 'Swift_1_SimpleCharacterReaderFactory'
That is not a known issue, so we recommend that you upgrade to the latest stable release (3.3.18 at the moment). You can find the upgrade instructions here. Upgrade should resolve the potential problem that you did not upload all the files properly, plus activeCollab 3.3 has auto-upgrade feature which will make similar error less likely to happen in the future.

Categories : Misc

C9.IO - Debugging Failed - Failed to open socket on port 15400, waiting 1000 ms before retrying
Looks like an older process is already running . You have to kill the older process yourself. See the solution posted here : https://github.com/ajaxorg/cloud9/issues/2170.

Categories : Node Js

Mountain Lion, failed to install ruby on rails [ERROR: Failed to build gem native extension.]
Either download and install 'command line tools' from apples developer download page: https://developer.apple.com/downloads/ or just install xcode through App Store.. and try again. And as mentioned by someone else in the comments, rbenv is a much better and easier way to manage your rubies on Mac OS X, so consider making the switch. to remove rvm from your system do: rvm implode and then restart your shell to make sure you are installing rbenv in a clean environment. for detailed instructions on how to install a decent rails dev environment on mac take a look at the instructions i put together in a blog post here: http://blog.parsalabs.com/blog/2013/08/27/setting-up-a-ruby-on-rails-4-development-environment-on-a-clean-mac-os-x-installation/ they worked for me, hope you will find the

Categories : Ruby On Rails

MVC local dev The underlying provider failed on open - Login failed for user 'NT AUTHORITYANONYMOUS LOGON' in Firefox only
While most solutions to this indicated that you needed to set or add Integrated Security=True; to the connection string among other possible solutions. I first found that if I set impersonate to true and passed in my own domain username and password that it fixed it but this was a bad solution as it required me to store my details. The actual solution which solved this particular problem with least possible issues was to set impersonate to false and bam no further issues.

Categories : Sql Server

Re-Run testng failed xml file to excute failed test cases
Just run an .xml file you need using IDE(with plugin) or add it to pom.xml if you use Maven. All documentation about testng.xml you can find here

Categories : Selenium

curl_easy_perform() failed: failed FTP upload (the STOR command) error
Set curl_easy_setopt(curl, CURLOPT_ERRORBUFFER, char* allocatedMemoryForErrorBuffer); The character pointer will have a bit more detail about the error that is occurring. Typically, this works for HTTP requests but my understanding is that it should work for FTP as well.

Categories : C++

Gradle Build Failed: "occurred evaluating root project...failed to create a task or type gettype"
For anyone else having the same issue, as Greg mentioned above, switching to the official Google Android Gradle plugin should work: http://tools.android.com/tech-docs/new-build-system/user-guide There are a number of other questions that I believe were using the unofficial version in this question since it comes up high on search results when searching for the Android Gradle plugin.

Categories : Android

Oozie failed to take stdout for failed actions
Can you provide sample workflow.xml you are referring to? If a node fails then you can use error to="errorHandlingNode"/> and try to access the stdout in error handling node. If not atleast you could get the name of failed node as ${wf:lastErrorNode()}.

Categories : Hadoop

Git: git svn rebase failed. RA layer request failed
Answering your questions in reverse order. Index mismatch: 4c97d1eea751f79ddf4e58f48f41e89dc8d254bd != 35962f4b5051693558a975b48ff903f061908235 rereading a2530aabd7ce119d35f63954e075b1c86067809d This basically means that it has not been able to successfully, or completely, read the named revision, and so it is starting to fetch from svn again from that revision. In your case it is r58087 of your repository that is causing you problems. Based on this blogpost, it seems most likely that this revision is too large, and the server is timing out while you are trying to retrieve it. Based on the collective wisdom of the internet, you have a couple of choices: You can try to upgrade the server, assuming that you have that capability to a later/latest svn version. You can upgrade your svn c

Categories : GIT

SSH -L connection successful, but localhost port forwarding not working "channel 3: open failed: connect failed: Connection refused"
ssh -v -L 8783:localhost:8783 myacct@server.com ... channel 3: open failed: connect failed: Connection refused When you connect to port 8783 on your local system, that connection is tunneled through your ssh link to the ssh server on server.com. From there, the ssh server makes TCP connection to localhost port 8783 and relays data between the tunneled connection and the connection to target of the tunnel. The "connection refused" error is coming from the ssh server on server.com when it tries to make the TCP connection to the target of the tunnel. "Connection refused" means that a connection attempt was rejected. The simplest explanation for the rejection is that, on server.com, there's nothing listening for connections on localhost port 8783. In other words, the server software that yo

Categories : Osx

Error: Gradle: Execution failed "Running /Applications/Android Studio.app/sdk/build-tools/android-4.2.2/aapt failed"
This is because one or more of your asset names have unsupported characters present. Replace all capitals with lowercase letters. Replace all spaces and dashes with an under-bar/underscore. AND to be safe, remove all numbers too. Another suggestion I've seen going around is to make sure your SDK is up to date, but from my own experience it has always been the names of imported assets.

Categories : Gradle

Client.Error.MessageSend - Channel.Connect.Failed error NetConnection.Call.Failed: HTTP: Status 404: url:
HTTP: Status 404 clearly means the server is not able to find the page you're looking for. The URL you're using is invalid. http://localhost:8080/demo/spring/messagebroker/amf Maybe you are missing a trailing slash or something. For the list of HTTP error codes: http://en.wikipedia.org/wiki/List_of_HTTP_status_codes#4xx_Client_Error

Categories : Java

WordPress Site Error failed to open stream: HTTP request failed! HTTP/1.1 404 Not Found
To make the path request local and not over the network I had to use the WordPress template tag get_template_directory() instead of get_bloginfo('stylesheet_directory') .

Categories : Wordpress

YouTube Data API failed to open stream: HTTP request failed! HTTP/1.0 403 Forbidden
is file_get_contents supported on your web server? many web servers dont support this function due to security risks. have you looked into using curl instead? maybe something like this: $option = array( 'part' => 'snippet', 'q' => 'search_query', 'type' => 'video', 'key' => 'your_key' ); $url = "https://www.googleapis.com/youtube/v3/search?".http_build_query($option, 'a', '&'); $curl = curl_init($url); curl_setopt($curl, CURLOPT_HTTPAUTH, CURLAUTH_ANY); curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, true); curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1); curl_setopt($curl, CURLOPT_HTTPHEADER, false); $json_response = curl_exec($curl); curl_close($curl); $responseObj = json_decode($json_response);

Categories : PHP

Viewstate verification failed. Reason: The viewstate supplied failed integrity check.
You can check if the problem is into the machine authentication code(MAC). Set enableViewStateMac="false". If you no longer get view state errors, the problem is related to the MAC feature. Also you can generate a new machineKey and copy it into the web.config of your app on each server. Here are some links that might help... explanation of machineKey http://msdn2.microsoft.com/en-us/library/w8h3skw9.aspx machineKey generator http://www.codeproject.com/aspnet/machineKey.asp

Categories : Asp Net

Github windows: Commit failed: Failed to create a new commit... continued issues
If you have a process blocking (keeping an handle) on a git resource, you can track it using process explorer. Search for any process referencing ".gitindex" and you will be able to kill it.

Categories : GIT

R: failed installation Slidify - Error: Command failed (1) not recognized as a i/e command
try this method, Install slidifyLibraries from Windows command prompt http://thiagosilva.wordpress.com/2013/02/17/installing-slidify-on-a-windows-machine/

Categories : R

Jenkins job failed due to tests failed. Source code for tests include AWT GUI tests, how to use Xvfb plugin
A Putty session and a jenkins job will probably have 2 slightly different run environments. Because of the way it was configured, Putty wants to use your remote X server, while jenkins is probably headless and requires xfvb or similar environment. For your tentative trough Putty to work, you might want to add "ForwardX11Trusted yes" in /etc/ssh/sshd_config on your server, or use xauth. But this will make your GUI appear on your Windows client. Probably not what you really want: you don't want to have to export your display to a remote server to run your automated build. To fix jenkins, I am not 100% sure yet. The Xfvb plugin fails because you already have a server running on the port it tries to use. You may want to check with netstat -ln and search for ports (potentially around 6000+).

Categories : Linux

GitHub - failed to connect to github 443 windows/ Failed to connect to gitHub - No Error
Well I did following steps Google the error Got to SO Links(here, here) which suggested the same thing, that I have to update the Git Config for proxy setting Damn, can not see proxy information from control panel. IT guys must have hidden it. I can not even change the setting to not to use proxy. Found this wonderful tutorial of finding which proxy your are connected to Updated the http.proxy key in git config by following command git config --global http.proxy http[s]://userName:password@proxyaddress:port Error - could not resolve proxy some@proxyaddress:port. It turned out my password had @ symbol in it. Encode @ in your password to %40 because git splits the proxy setting by @ git config --global http.proxy http[s]://userName:password(encoded)@proxyaddress:port B

Categories : GIT

prevent the same request done more than once
"Not working" clientside: I would say disabling document.getElementById("btnAdd").disabled = true; is a little more safe than just making it invisible. On top of that, consider adding a loading animation in the form of a GIF from http://www.ajaxload.info/ so that the user knows they have to wait. Ideally, you'd be making ajax calls and could re-enable the button if the action failed or returns a message. Worst case scenario, you could remove the button from the page altogether, but that's not a very good idea if the action fails and the user will need to press it again. "Not working" serverside: On the database level, catch and reject duplicates (to your criteria) to ensure that even if they do slip one past, you don't end up with duplicate data.

Categories : Javascript

Prevent GET access to some URI
Under normal circumstances you can use like the following if($_SERVER['REQUEST_METHOD'] == 'GET') //abort or you can create a CI helper for this. if you want to prevent post then use the string 'POST' in if condition. It is this straight forward. Under suspicious circumstances if you want to prevent post(if you feel that request method can be manipulated) NOTE: i haven't used the following and it is just my instant idea. check for http raw input data. $rawdata = file_get_contents('php://input'); may be you can check for strlen greater than zero... or add your logic here. Assuming that you are not looking to solve this only using codeigniter.

Categories : PHP

Prevent Int From Being Subtracted
You may use Integer wrapper class instead of int as Integer class is immutable. Another idea: Do not expose your string as a public variable, simply provide method(s) to modify that int. And if someone tries to subtract that string then you can control that within your method.

Categories : Java

What does SEM_FAILCRITICALERRORS prevent?
System errors that the SEM_NOGPFAULTERRORBOX flag prevent include: Dynamic link errors when loading a DLL (Entry Point Not Found for example). Application initialization errors

Categories : C++

prevent xss attack via url( PHP)
If you're using MVC, then try to decode all ofthe values before routing, and use stript_tags() to get rid of these nasties. And as the docs say, case should not impact anything. If not, create a utility function and do the same while retrieveing the variables from the URI. But I am by no means an XSS expert, so this might be just a part of the trick. From Janis Peisenieks

Categories : PHP



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