w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML videos Categories
Broken example in Google Drive SDK quick start documentation
Apparently you need to import the following dependency as well in order for the code to work. It contains the JacksonFactory class. <dependency> <groupId>com.google.http-client</groupId> <artifactId>google-http-client-jackson2</artifactId> <version>1.16.0-rc</version> </dependency>

Categories : Java

Broken user, broken Data.Binary or broken installation?
The Problem Let's review what you think you're doing and what you are doing. You think you are using binary to encode a list of Ints and write that bytestring into a file. Then, you read from the file and decode a list of Ints only to have it fail. What you are actually doing is encoding a list of Ints as a bytestring then encoding that bytestring as a bytestring (so, an extra length field is prepended to the bytes) and writing that bytestring to disk. Your decode then fails because you have on disk encode(encode(list)) instead of encode(list). The solution Just change the line reading: encodeFile worldfile $ encode world to encodeFile worldfile world Reading Hexdump 00000000 00 00 00 00 00 00 00 20 00 00 00 00 00 00 00 03 |....... ........| 00000010 00 00 00 00 00 00 00

Categories : Haskell

`-webkit-overflow-scrolling: touch` broken for initially offscreen elements in iOS7
Looks like there is a workaround to this problem on apple dev forums So many thanks to Mr Baicoianu. Basically you need to listen to touch events on the parent scroll div. So in my case add: document.getElementById("scrollbox").addEventListener('touchstart', function(event){}); to the onBodyLoad function. I guess this is some event propagation issue, solved by listening at a higher level.

Categories : IOS

Select elements which start with "data-"
Here is a non-JQuery function that will do what you need: function getAllDataElements() { //get all DOM elements var elements = document.getElementsByTagName("*"); //array to store matches var matches = []; //loop each element for (var i = 0; i < elements.length; i++) { var element = elements[i]; //get all attributes for the element and loop them var attributes = element.attributes; for (var j = 0; j < attributes.length; j++) { //get the name of the attribute var attr = attributes.item(j).nodeName; //check if attibute name starts with "data-" if (attr.indexOf("data-") == 0) { matches.push(element); //add it to matches } } } return matche

Categories : Javascript

How to remove elements in an arraylist start from an indicated index
Just use the remove() method for this. Let's assume you want to remove elements with indices from 20 to 30 of an ArrayList: ArrayList<String> list = ... for (int i = 0; i < 10; i++) { // 30 - 20 = 10 list.remove(20); } Once the first element at index 20 is removed element 21 moves to index 20. So you have to delete 10 times the element at index 20 to remove the next 10 elements.

Categories : Java

Setting start levels & auto-start of Eclipse plug-ins: p2.inf vs product definition
It really comes down to a personal preference. The product level is the ultimate final artifact most of the time. As you discovered, it has much better tooling integration. When the product is assembled by Tycho or PDE Build you'll know exactly what's in it and what needs to be started for it in order to work properly. However, sometimes it doesn't feel right to go down to the bundle granularity level in product definitions especially when it's composed of features only. But defining start properties at the feature level or even at the bundle level can be tricky, though. For example, when someone consumes your features/bundles in another product they might have different auto-start/start-level requirements. FWIW, the p2.inf file isn't outdated at all. It's the raw bare metal to modify/op

Categories : Eclipse

cdh4.3,Exception from the logs ,after ./start-dfs.sh ,datanode and namenode start fail
There seems to be a Name Resolution issue. Datanode denied communication with namenode: DatanodeRegistration(0.0.0.0, storageID=DS-30209445-192.168.2.41-50010-1371109358645, infoPort=50075, ipcPort=50020, Here DataNode is identifying itself as 0.0.0.0. Looks like dfs.hosts enforcement. Can you recheck on your NameNode's hdfs-site.xml configs that you are surely not using a dfs.hosts file? This error may arise if the datanode that is trying to connect to the namenode is either listed in the file defined by dfs.hosts.exclude or that dfs.hosts is used and that datanode is not listed within that file. Make sure the datanode is not listed in excludes, and if you are using dfs.hosts, add it to the includes. Restart hadoop after that and run hadoop dfsadmin -refreshNodes. HTH

Categories : Hadoop

"launchctl start error: Bad file descriptor" when trying to start Neo4j server
I had to remove it from launchd and then it would work, like this: balinjdl-mac:local balinjdl$ neo4j start WARNING! You are using an unsupported version of the Java runtime. Please use Oracle(R) Java(TM) Runtime Environment 7. Using additional JVM arguments: -server -XX:+DisableExplicitGC Dorg.neo4j.server.properties=conf/neo4j-server.properties Djava.util.logging.config.file=conf/logging.properties Dlog4j.configuration=file:conf/log4j.properties -XX:+UseConcMarkSweepGC XX:+CMSClassUnloadingEnabled -Dneo4j.ext.udc.source=homebrew Detected installation in launchd, starting it... launchctl start error: Bad file descriptor balinjdl-mac:local balinjdl$ neo4j remove balinjdl-mac:local balinjdl$ neo4j start WARNING! You are using an unsupported version of the Java runtime. Please use Oracle

Categories : Osx

Can't start unicorn, master failed to start, check stderr log for details
The socket is the "file" that nginx and unicorn use as a channel for all communication between them. Where have you defined it? In our unicorn configs, we usually have a line like this: listen APP_PATH + "/tmp/pid/.unicorn.sock Then, in your nginx.conf, you need to tell nginx about this socket, e.g.: upstream unicorn { server unix:/var/www/demo/tmp/pid/.unicorn.sock fail_timeout=0; } location / { root /var/www/demo/current/public ; try_files $uri @unicorns; } location @unicorns { proxy_pass http://unicorn; } In this config file, the first section defines how nginx can reach unicorn. The second one actually routes requests to an abstract location "@unicorns" which, in turn, is defined in the last section. This way you can reuse the @unicorns shorthand if your have more compl

Categories : Ruby On Rails

How to start an Android Activity from an OSGI Bundle start method
I think my topic will provide a response to you, even if not perfect. You may also check FelixDroid which is using a different approach seen on other projects. However, I long for a better solution. Going to see if I can find or write a ContextWrapper that will fill the bill. Full Android support for OSGi bundles (Knopflerfish)

Categories : Android

Re-start dependent OSGI bundles on dependency bundle re-start?
You can call refresh and all bundles will be restarted that had package wirings to the old API bundle. You can call refresh on the console or programmatically FrameworkWiring.refreshBundles(...) For more information you can check the javadoc of the mentioned function.

Categories : Java

How to discern between a drag start and a selection start HTML5-Canvas
When working with mouse primitives, there is no way to know if a mouse-down is part of a click, a double-click, or a drag until a subsequent event is fired. A mouse-down followed by a mouse-move is a drag (if the move is greater than some threshold, to allow for human motion while clicking) A mouse-down followed by a mouse-up is a click if the time span is too great to be a double-click. A mouse-down is a double-click if the down/up/down/up falls withing the double-click threshold. The difference between a drag and a rect-select is based (usually) on whether or not an object is present under the mouse position when the down is fired.

Categories : Javascript

Start another batch file with multiple parameters with the start command?
How to read parameters in a batch file: caller batch start "" "%dirofbatch%data1.exe" "%downloc%" "%dirofbatch%" "%lver%" "%lget%" called batch set "parm1=%~1" set "parm2=%~2" set "parm3=%~3" set "parm4=%~4" echo %parm1% %parm2% %parm3% %parm4%

Categories : Batch File

MVC5 Bundler being too greedy?
If you run with debug=true, by default the bundle's contents will be enumerated as individual links and you can see approximately what its trying to include. It will differ slightly as it will choose .min.js over plain .js.

Categories : Jquery

upgrading from MVC4 to MVC5
have you just updated the project references? Did you also check the web.config? There are also those libraries referenced and usually with specific version numbers of the library itself. in the web.config you can find the referenced libraries for instance in: <runtime> <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"> <dependentAssembly> <assemblyIdentity name="System.Web.Helpers" publicKeyToken="31bf3856ad364e35" /> <bindingRedirect oldVersion="0.0.0.0-2.0.0.0" newVersion="2.0.0.0" /> </dependentAssembly> <dependentAssembly> <assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35" /> <bindingRedirect oldVersion="0.0.0.0-4.0.0.0" newV

Categories : Asp Net Mvc

How to start Marquee text start from bottom of the screen?
<!DOCTYPE html> <html> <body bgcolor="#2E9AFE"> <marquee style="background-color: #2E9AFE; bottom: 0; color: #ffffff; height: 100%; position: absolute; text-align: center;" scrollamount="2" direction="up" loop="true"> <strong>I AM HERE<br/>Vx.0<br/><br/>DEVELOPER<br/>xxxxxx<br/><br/><br/>CONTACT US<br/>xxxxxx</strong> </marquee> </body> </html> Please note, to my knowledge this is not valid HTML. To validate, check out http://validator.w3.org. Also, there were two body tags (instead of one) and some other HTML that wasn't properly formatted, most of which I tried to address. If you're not yet familiar with CSS, just know that it's your friend. (In other words, you'd probably be

Categories : HTML

Process.Start() with arguments to start Google Chrome
You can use shortcut when call the chrome.exe instead using full path location. Module Module1 Sub Main() System.Diagnostics.Process.Start("chrome.exe", "--incognito") End Sub End Module More: start-google-chrome-from-run-windows-key-r UPDATE I found what is your problem in your code. Your code using –-incognito in the parameter, but it should be --incognito. See the first character in that parameter. Should be - instead –. Module Module1 Sub Main() System.Diagnostics.Process.Start("C:Program Files (x86)GoogleChromeApplicationchrome.exe", "--incognito") End Sub End Module

Categories : Dotnet

How can i start a timer like call log duration when activity start?
You can replace your textview by a Chronometer view, set his format using setFormat("HH:MM) and call to start() function when the activity is brought to front. Reference

Categories : Java

mvc5 IdentityAuthenticationManager reset database
You probably want the DefaultIdentityDbContext if you aren't customizing things: Database.SetInitializer(new DropCreateDatabaseAlways<DefaultIdentityDbContext>());

Categories : C#

Hiding links from certain roles in ASP.NET MVC5
Depending on what sort of Membership/User provider you are using, you should just be able to check directly from the View if the user is logged in and in the specific role. So you would end up with something like; @Html.ActionLink("Index", "Home") @Html.ActionLink("About", "Home") @Html.ActionLink("Contact", "Home") @if ( User.Identity.IsAuthenticated ){ if ( User.IsInRole("Admin") ){ @Html.ActionLink("Admin", "AdminController") } } And remember to add [Authorize] attribute to your Admin action method: [Authorize(Roles="Admin")] public ActionResult Admin() { // ... return View(); }

Categories : Asp Net

LinkedIn Authentication on OWIN/MVC5
I posted same question on Katana Project, and got an answer. No immediate plans, but you might want to checkout this project: https://github.com/auth0/auth0-aspnet-owin

Categories : Asp Net Mvc

MVC5 - Most Efficient Way to Access the User Object
The new identity api is intended to be async so you are doing it correctly. You could write it in one line as: User user = await Users.Find(User.Identity.GetUserId()) as User; In RTM it will change a little bit, but the gist of it is the same except the Manager will be have a generic so you don't have to do the cast and will look more like: User user = await Users.FindAsync(User.Identity.GetUserId())

Categories : Asp Net

Get all role names in ASP.NET MVC5 Identity system
I've found that you can use the DbContext via the IdentityStore instance and use the well-known method .Set<T>(). This works for me: var identityStore = new IdentityStore(); foreach (var role in identityStore.DbContext.Set<Role>()) { Debug.WriteLine(role.Name); }

Categories : C#

Howto use new MVC5 Authentication with existing database
Assuming you are using EF, you should be able to do something like this: public partial class tblMember : IUserSecret { public int id { get; set; } public string membership_id { get; set; } public string password { get; set; } ....other fields /// <summary> /// Username /// </summary> string UserName { get { return membership_id; set { membership_id = value; } /// <summary> /// Opaque string to validate the user, i.e. password /// </summary> string Secret { get { return password; } set { password = value; } } } Basically the local password store is called the IUserSecretStore in the new system. You should be able to plug in your entity type into the AccountController constructor like so assuming you implemented e

Categories : Misc

Start an intent to start a specific tab of tab host
In the intent your are sending to TabExercise, you can send the tabindex you want to load, and then call setCurrentTab (int index). Did you try something like this?

Categories : Java

how to start Apache tomcat on system start up?
Install apache tomcat as windows service, and change its startup type as automatic use following link for more info http://tomcat.apache.org/tomcat-6.0-doc/windows-service-howto.html#Installing_services

Categories : Windows

Start service via Application Start vs BOOT_COMPLETED
You can start the service manually with adb shell. See How to start and stop android service from a adb shell? The command is: am startservice com.your.package/.ServiceClassName Depending on the Android version the effective syntax may change slightly, for example: am startservice -n com.your.package/.ServiceClassName am startservice -a com.your.package/.ServiceClassName am startservice --user 0 -n com.your.package/.ServiceClassName

Categories : Android

Compiler Errors after updating Microsoft.Aspnet.Identity in MVC5
Think i have finally found the resource which answers this. There is an asp.net/vs2013 refresh which updates the templates to the beta preview of Identity and removes the breaking changes

Categories : Asp Net Mvc

How to start a program on instance start on AWS EC2
userdata is only executed the very first time that the instance is created. This is by design. You've got a couple of options - all of which use your userdata script Copy the my_application.lnk to the startup folder Register the application in the registry "run" start key (http://blogs.msdn.com/b/powershell/archive/2006/04/25/how-to-access-or-modify-startup-items-in-the-window-registry.aspx) Register it with the task scheduler to configure it to execute on startup (http://technet.microsoft.com/en-us/library/bb490996.aspx)

Categories : Amazon

Button Start New Activity cannot start?
You should not do v.getContext()... You should use getApplicationContext().. The View v is the view you clicked on. So v.getContext() returns the context which the view runs on. This is the issue. I think using Application's context is better and doesn't cause an issue.

Categories : Java

Netbeans 7.3.1 broken
As explained in the installation instructions you need the JDK7 if you want to use any of the Java features.

Categories : Java

ASP.Net MVC 3 Broken Routing
Your route is fine. It is likely the case that your Index method on your HomeController either: does something infinitely, redirects to the same route infinitely, or runs a long-running external call synchronously like a DB select that takes minutes. Break it down to a base case and have your Index method simply return a View that says "Hello World", then go from there.

Categories : C#

Is ticklabel_format broken?
Explanation of scientific notation vs. offset What you get (+1.989e3) is not scientific notation, it is an offset. Scientific notation: In matplotlib scientific notation is seen as a common factor of all the tickvalues printed at the edge of the axis. If you plot very big values on the x-axis, you might see 1e9 or something similar printed. In order to get the "correct" value at the tickmarks you have to multiply by this factor. E.g. say you get 2.2 as one of the tickvalues on the axis, with 1e9 printed at the edge of the axis. In order to get the "correct" value of this tickmark, you must multiply the tickvalue by the common factor: 2.2 * 1e9 = 2.2e9. Offset: An offset is a value you have to add/subtract from the displayed tickvalues (hence the + or - next to the number). As with the s

Categories : Python

Website Broken in IE8
Fix your code errors, in particular the JS call above the doctype. Anything above the doctype throws IE into quirks mode See [Invalid] Markup Validation of delindesign.com excellence - W3C Markup Validator. Scroll down in the validation report to see line numbers and source code. Start fixing the code errors and revalidate.

Categories : Wordpress

broken image PHP (GD)
There's a syntax error, ComFreek is right: imagechar($image, mt_rand(3,5), $x, mt_rand(5,20), $actChar, imagecolorallocate($image, mt_rand(0,155), mt_rand(0,155), mt_rand(0,155)))) or die('Kunne ikke velge GD2!'); // /4? Has one closing parentheses too many, it should be imagechar($image, mt_rand(3,5), $x, mt_rand(5,20), $actChar, imagecolorallocate($image, mt_rand(0,155), mt_rand(0,155), mt_rand(0,155))) or die('Kunne ikke velge GD2!'); // 3 is enough Oh and please, don't use or die. If there's an error, fix it. Don't use a pointless or die message. Let PHP show the errors (as in line X: Unexpected )). Also: don't use th

Categories : PHP

Is jsonToRepJson broken?
You must convert your value toJSON. Eg.: jsonToRepJson $ object [("result", toJSON resultValue)] :) You can read about that change in Yesod 1.2

Categories : Haskell

ios: my vfl constraint is broken
The answer was that I set the 'setTranslatesAutoresizingMaskIntoConstraints' on the parent view and not the button. That line should read: [[self useLocationButton] setTranslatesAutoresizingMaskIntoConstraints:NO];

Categories : IOS

wp_list_pages broken in 3.5?
Is the custom post type flagged as 'hierarchical' or is it being treated as a normal 'post'? The wp_list_pages function only works with hierarchical custom post types: http://codex.wordpress.org/Function_Reference/wp_list_pages (look under the 'post_type' parameter)

Categories : Wordpress

LiveAuthClient broken?
I'm a little late to the party, but since I stumbled across this trying to solve what I assume is the same problem (authenticating users with Live), I'll describe how I got it working. First, the correct NuGet package for an ASP.NET project is LiveSDKServer. Next, getting user info is a multi-step process: Send the user to Live so they can authorize your app to access their data (the extent of which is determined by the "scopes" you specify) Live redirects back to you with an access code You then request user information using the access code This is described fairly well in the Live SDK documentation, but I'll include my very simple working example below to put it all together. Managing tokens, user data, and exceptions is up to you. public class HomeController : Controller {

Categories : Asp Net

Powershell Start-Process to start Powershell session and pass local variables
I'm pretty sure there's no direct way to pass variables from one PowerShell session to another. The best you can do is some workaround, like declaring the variables in the code you pass in -ArgumentList, interpolating the values in the calling session. How you interpolate the variables into the declarations in -ArgumentList depends on what types of variables. For an array and a string you could do something like this: $command = '<contents of your scriptblock without the curly braces>' Start-Process powershell -ArgumentList ("`$Array = echo $Array; `$String = '$String';" + $command)

Categories : Powershell



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