w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML videos Categories
How to launch unit tests under EclEmma without using the VisualVM launcher with that launcher installed
I too have encountered this issue and have found no acceptable solution. I know it is not much of an answer but I ended up uninstalling VisualVM and resorting to reinstalling it when I need it, for the duration I need.

Categories : Eclipse

How Launcher decides which app icon to place in launcher?
When a developer publishes an app, he/she can decide if app has "launcher" icon(set a launcher intent in manifest file which is embedded in the APK). Other apps maybe services or other kind of apps that has no launching behavior.

Categories : Android

set custom launcher as default launcher by code
I want to set my custom launcher as default launcher That is not possible. The user can set your home screen as the default home screen, such as by pressing HOME and choosing your app as the default. However, you cannot force the user to accept your home screen as the default. But the following code is not working. It crashes That code does not set your "custom launcher as default launcher". That simply controls whether or not you are even a potential option for being a home screen (if you are disabled, you cannot possibly be the home screen). As to why it is crashing, without a stack trace, that will be difficult to determine.

Categories : Android

Facebook Unity SDK has error when send request with custom friends in Unity Webplayer
One of the Facebook software engineers here. Are you passing in null to the data or title param for FB.AppRequest()? There's a bug where it doesn't handle that correctly currently. Either exclude that or pass in an empty string. We'll get that fix ASAP. Thanks for finding that. Update: The latest SDK version has that fix.

Categories : Facebook

Is it practical to start a Unity game from an Android app and revert back from Unity to the app?
You should be able to have two activities in your app, one using your java code and another with the Unity game. Android is already pretty good at switching between activities. Check out this: http://developer.android.com/training/basics/firstapp/starting-activity.html You'll probably need to add your Java project as a plugin in Unity and override the AndroidManifest.xml in the Unity project to load the Java activity. Check out this documentation on extending android projects in Unity: http://docs.unity3d.com/Documentation/Manual/PluginsForAndroid.html

Categories : Android

Unity Register For One Interface Multiple Object and Tell Unity Where to Inject them
In the example below you have an interface implemented twice and injected on demand into two different client classes, just as you request. The trick is to use named registrations. class Program { static void Main(string[] args) { IUnityContainer container = new UnityContainer(); container.RegisterType<IFoo, Foo1>("Foo1"); container.RegisterType<IFoo, Foo2>("Foo2"); container.RegisterType<Client1>(new InjectionConstructor(new ResolvedParameter<IFoo>("Foo1"))); container.RegisterType<Client2>(new InjectionConstructor(new ResolvedParameter<IFoo>("Foo2"))); Client1 client1 = container.Resolve<Client1>(); Client2 client2 = container.Resolve<Client2>(); } } public interface IF

Categories : C#

Unity iOs - screen gets black when changing rotation while Unity is paused
Not sure if you have fixed this, Its been a while... But the reason that your UnityViewController is not functioning properly is because a view controller that is not visible will not receive rotation events. Because you are setting your view controller as the root view controller, the UnityDefaultViewController defined in "iPhone_View.mm" is not receiving rotation events. I have been studying Unity's rotation for a while now as I have my own issue with a similar setup. There are a few things that you might be able to try: In iPhone_View.mm there is a function that is defined called: UpdateOrientationFromController(UIViewController* controller) that might be able to solve your problem. You would want to call this function on the view controller that you designed yourself where you plac

Categories : IOS

Xcode cannot parse exported project from Unity 4 after being upgraded from unity 3
Some Unity packages install editor scripts that modify the XCode project after it's generated. These scripts can cause the symptom described, if they have a bug, or if they subtly interfere with each other. Search your project for OnPostprocessBuild calls, try disabling them one-by-one, generate a fresh XCode project each time, and see if it starts opening with XCode. If it does start working, diff the working and non-working versions of Unity-iPhone/project.pbxproj, and see if you can figure out why.

Categories : IOS

Unity.AutoRegistration ?? Convention Based Registration Unity
It appears that what you are looking for is this: container.ConfigureAutoRegistration() .LoadAssemblyFrom(typeof(ITest).Assembly.Location) .LoadAssemblyFrom(typeof(Test).Assembly.Location) .Include(If.ImplementsITypeName, Then.Register()) .ApplyAutoRegistration(); This will tell Unity.AutoRegistration to register all types where there is an interface with the same name, prefixed with I.

Categories : C#

'Switching' a Tel: link on and off... Preferably CSS only
There really isn't anything wrong with leaving the link on desktop computers. This would for example allow you to click the link to call via Skype or other VOIP program you might have installed. If you still want to change the link, just create two of them. One that is shown for desktops, the other for mobiles.

Categories : HTML

How to get TIME in C++, preferably multi platform
If you want cross-platform compatibility, the clock() function from ctime (see docs) is probably your best bet. It's in milliseconds in Visual Studio (although that's no guarantee that it actually advances in 1-millisecond increments), and is presumably similar in other compilers. Each platform will have its own way of getting higher-resolution timing. On Windows there are timeGetTime() and QueryPerformanceCounter(). You can read about them online; there are tons of articles about each (here's one). If there are other platforms you care about, you'll have to google around or consult their docs for their own high-resolution timing functions.

Categories : C++

Is it possible with pure CSS, preferably compatible to version 2
There is the possibility to insert all you items into a table to get them to the right position, just as you like. But this is a oldschool programming style that is not rly anymore in use. (You have to take care of min and max width's here because of different screen resolutions!) Another option (and the best here) is to get your Big item into a div box and also A+1 and B+2 into divs too. Float them side by side with a clear after the A+1 float and it will work I think. (And dont forget the div arround all items ;) ) Second solution should be your choice, because you can easily get div solutions up on smartphones too and you will save tons of code you dont have to type down. Hope it works, if you have issues with the div code to handle write me. @Johan Bouveng!!! Yeah, you are right b

Categories : CSS

Resolving Unity Dependencies without a Unity.MVC
You're doing it in the right way. With DI you can remove dependencies from your application. So that you can get a "Repository agnostic" application. And you have effectively done it. At least on the projects that 'declare' the dependencies. However, when the application has to run, you need to specify the concrete objects which will be used for the "declared" abstract dependencies (interface, abstract class) is required. You do this by registering the types which object will be used for each abstract dependency. In you sample, when a IUnitOfWork or a DbContext, an instance of MyDbContext is provided. So the projects that 'declare' the dependencies are completely independent of a particular implementation. However, when you register the dependent types, you're loosing that independen

Categories : C#

Running python within flash actionscript (AS2 preferably)
You can prefer this web link about how to use python + Actionscript... [PyAMF - AMF for Python][1] [1]: http://www.pyamf.org/tutorials/actionscript/simple.html

Categories : Python

Store Serialized Objects into Oracle DB (Preferably XML) C#
If your object is mostly text, after you serialize the data (XML or JSON would be fine, assuming all of the properties truly are serializable), I'd recommend compressing your data into a byte array and storing it as binary. When you retrieve it, you'd just decompress it and then deserialize it. Text zips down very nicely, especially XML, so you might get that 50MB down to 10MB or less. Based on your comment, zipping would absolutely be worthwhile. And if you're only adding 10MB or so per day, it sounds like it wouldn't negatively affect your database - just a few GB per year.

Categories : C#

Invite friends to facebook app (not a game) preferably using PHP
As far as I know, there are no features which are restricted to the "type" of app, so game versus app should make no difference. You can open the FB.ui({method: 'apprequests'}) Facebook Javascript dialog on any web page, the app doesn't need to be in a canvas or page tab. The wording may be confusing, but what is meant is that, when a user does accept an invitation, they will be sent to the app canvas. This means that you will need to configure your Facebook app to have a namespace (apps.facebook.com/<namespace>) and you will need to handle users coming from invitations at that point. What you do with them afterwards is up to you, you could redirect them to your website if you wish. You should be aware that the Facebook Requests process is deliberately quite cryptic to avoid gaini

Categories : PHP

Testing GoInstant client code (preferably with PhantomJS)
Testing should work fine with either Selenium and any supported browsers, or PhantomJS. At GoInstant, we use both real browsers and phantomjs internally, along with mocha as our test harness to exercise javascript logic. Make sure that if your tests are looking for specific elements on a page that are populated or influenced by GoInstant, you either retry your test on a timeout, or trigger a callback once you've initialized GoInstant, as the initialization might take enough time after page load to confuse a test. If you're having a specific issue with PhantomJS, Selenium, and GoInstant, consider posting another question on StackOverflow with a code example, or at https://goinstant.com/support Disclosure: I work for GoInstant

Categories : Testing

Get a list of all Resources in my Azure Subscription (Powershell Preferably)
I don't think there's just one function (or PS Cmdlet) to fetch all this information. However each of these can be fetched through both Windows Azure Service Management REST API as well as Window Azure PowerShell Cmdlets. Windows Azure Service Management REST API: http://msdn.microsoft.com/en-us/library/windowsazure/ee460799.aspx. For example, if you want to list storage accounts in your subscription, you would use this: http://msdn.microsoft.com/en-us/library/windowsazure/ee460787.aspx Windows Azure PowerShell Cmdlets: http://msdn.microsoft.com/en-us/library/jj554330.aspx. Again, if you want to list storage accounts in your subscription, you would use this: http://msdn.microsoft.com/en-us/library/dn205168.aspx.

Categories : Powershell

How to style disabled state for tabwidget button preferably using xml
<?xml version="1.0" encoding="utf-8"?> <selector xmlns:android="http://schemas.android.com/apk/res/android"> <!-- Non focused states --> <item android:drawable="@drawable/footer" android:state_focused="false" android:state_pressed="false" android:state_selected="false"/> <item android:drawable="@drawable/footer_pressed" android:state_focused="false" android:state_pressed="false" android:state_selected="true"/> <!-- Pressed --> <item android:drawable="@drawable/footer_pressed" android:state_pressed="true" android:state_selected="true"/> <item android:drawable="@drawable/footer_pressed" android:state_pressed="true"/> </selector>`enter code here`

Categories : Android

Different behavior when double click on jar and run same jar from command prompt on mac
It might run in a little bit different way if you run it from command line than if you ran it by double clicking things. If you want to make sure everything works correctly, don't include special characters in folder/file names.

Categories : Java

Button blinking after click command is executed
I solved the issue by defining ControlTemplate for my buttons. Something like this: <ControlTemplate TargetType="{x:Type Button}" x:Key="PlainButtonTemplate"> <Border x:Name="bdr_main" BorderThickness="1" BorderBrush="LightGray" CornerRadius="6" Background="Transparent"> <ContentPresenter VerticalAlignment="Center" HorizontalAlignment="Center" Margin="0" ContentSource="Content" /> </Border> <ControlTemplate.Triggers> <Trigger Property="IsMouseOver" Value="True"> <Setter TargetName="bdr_main" Property="Background" Value="Transparent"/> </Trigger> <Trigger Property="IsPressed" Value="True"> <Setter TargetName="bdr_main" Property="Backg

Categories : Dotnet

Tutorials for creating right-click command in powershell
That is simple! Copy your png2eps.exe to system folder(e.g. c:Windows or c:windowssystem32). After that, create txt file and put in it: Windows Registry Editor Version 5.00 [HKEY_CLASSES_ROOT.pngshellpng2eps] @="Convert PNG to EPS now!" [HKEY_CLASSES_ROOT.pngshellpng2epscommand] @="png2eps CMD "%1"" Where: CMD - cmd switches and options for png2esp. "%1" - input file name from shell. save txt, and change it extension to reg(e.g. before: file.txt after: file.reg). 2click on reg file and import to registry. Menu item "Convert PNG to EPS now!" you will be see in context menu only if you call it for selected png file(s).

Categories : Windows

DataGrid bind command to cell click
You can use BeginningEdit event in the DataGrid control to handle this scenario. This event will fires before a row or cell enters edit mode. You can identify the selected column from the EventArgs. Example: private void dgName_BeginningEdit(object sender, DataGridBeginningEditEventArgs e) { if (e.Column.Header.ToString() == "Suggested") { //Do Operation } } If you are using MVVM pattern, there are options to pass EventArgs to VM. If you are uusing MVVMLight Toolkit, there is an option called PassEventArgs and set it to TRUE. In VM, //Relay Command private RelayCommand<DataGridBeginningEditEventArgs> _cellBeginningEditCommand; public RelayCommand<DataGridBeginningEditEventArgs> CellBeginningEditComma

Categories : Wpf

MVVM -- Button Click Command(Could not be found)
If you just typed in the sample, you are missing the definition for Command, which is included in their Apex project, Apex.MVVM namespace. It implements the ICommand interface. Options: Download the full source Download the Apex binaries and add a reference Skip ahead and do How Does it Work - The Command Class, which shows the code for Command

Categories : C#

Running a terminal command from NSButton click
Use NSTask. Have a look at documentation and Quartz Composer CommandLineTool. + (void) executeShellCommandAsynchronously:(NSString*)command { NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; NSTask *task = [[[NSTask alloc] init] autorelease]; [task setLaunchPath: @"/bin/sh"]; //we are launching sh, it is wha will process command for us [task setStandardInput:[NSFileHandle fileHandleWithNullDevice]]; //stdin is directed to /dev/null NSArray *args = [NSArray arrayWithObjects: @"-c", //-c tells sh to execute commands from the next argument command, //sh will read and execute the commands in this string. nil]; [task setArguments: args]; [task launch]; [command release]; [pool release]; return; }

Categories : Osx

Jar file won't run via command prompt or double-click
Check this thread: Failing to execute the jar file using java -jar command Basically, what you need to do is when you run the jar, you need to specify the class to be executed in the command line, like so: java -cp test.jar com.app.ClassName

Categories : Java

Button's .click() command not working in Chrome
I recently ran into this problem myself. I believe the issue is that in javascript, this .click() is either treated as the component's onClientClick event, or something else entirely. Not sure on this. In any case, my solution: Instead of calling btnSubmitProd.click(), do __doPostBack('Foo', 'Bar'); where Foo is an arbitrary name (typically the component, so "submitRegionButton") and Bar is an arbitrary value for that name, typically the event (so "click") (also, there are TWO underscores there, not one). Then, in your codebehind: try { if (Request["__EVENTTARGET".ToString() == "Foo" && Request["__EVENTARGUMENT"].ToString() == "Bar" { //call the codebehind directly here OnSubmitRegion(null null); } } I assume your codebehind function is of the form protected void

Categories : Asp Net

Rails queries that consist of counts on associations, preferably with scopes
You might be interested in counter_cache to have simpler queries. It will auto increment a counter to each Person model. http://railscasts.com/episodes/23-counter-cache-column You have to add a friends_count column to your Person model and specify the counter_cache on the belongs_to class Friend < ActiveRecord::Base belongs_to :person, counter_cache: true end

Categories : Ruby On Rails

FInd a US street address in text (preferably using Python regex)
d{1,4}( w+){1,5}, (.*), ( w+){1,5}, (AZ|CA|CO|NH), [0-9]{5}(-[0-9]{4})? In this regex, you have one too many spaces (before ( w+){1,5}, which already begins with one). Removing it, it matches your example. I don't think you can assume that a "unit 123" or similar will be there, or there might be several ones (e.g. "building A, apt 3"). Note that in your initial regex, the . might match , which could lead to very long (and unwanted) matches. You should probably accept several such groups with a limitation on the number (e.g. replace , (.*) with something like (, [^,]{1,20}){0,5}. In any case, you will probably never get something 100% accurate that will accept any variation people might throw at them. Do lots of tests! Good luck.

Categories : Python

Set MenuItem onPressed actions Android actionbar? Preferably programmatic
I'd like to remove the blue square/rectangle highlight shown when the MenuItem is pressed You can use Android Action Bar Style Generator in order to identify and replace/modify the assets you need (try modifying the value of Accent color). and instead just change the color of the item (by just showing the same drawable with a new color, from the res). You should simply use the two colored version (default and pressed) of your image within a specific XML selector to be used as resource for your icon.

Categories : Android

How to bind Command to ios table section header click?
There are a few ways you could achieve this effect. For just your current requirements, the easiest way to achieve it would be to add just a single command to the TestTableSource and to have that command passed on to your section header inside the Action handler. public class TestTableSource : MvxBaseTableViewSource { public ICommand FooCommand { get; set; } // existing code public override UIView GetViewForHeader(UITableView tableView, int section) { var view = new OrderGuestSectionHeader(OrderGuestSectionHeader(tableView, section), () => { Debug.WriteLine("selected " + section.ToString()); if (FooCommand != null) FooCommand.Execute(null); }); return view; } } This Command can then be bound to the ViewModel by ad

Categories : IOS

how do you execute a sql command on a button click and then have it populate a dataset?
You have not provided enough informations to show you more than pseudo code. However, use the using statement to ensure that everything implementing IDisposable gets disposed properly and the connection gets closed (even on error). Use sql-parameters to avoid sql injection and conversion/localization issues. string sql = "SELECT Columns FROM dbo.TableName WHERE Column=@ParamName"; using (var con = new SqlConnection("Connection String Here")) using (var da = new SqlDataAdapter(sql, con)) { da.SelectCommand.Parameters.AddWithValue("@ParamName", "Param Value"); // other parameters DataTable table = new DataTable(); da.Fill(table); dataGridView1.DataSource = table; }

Categories : C#

What's the android ADB command to click the title of the Settings screen
Open settings window adb shell am start -n com.android.settings/.Settings You can use keycodes for DPAD 19 --> "KEYCODE_DPAD_UP" 20 --> "KEYCODE_DPAD_DOWN" 21 --> "KEYCODE_DPAD_LEFT" 22 --> "KEYCODE_DPAD_RIGHT" 23 --> "KEYCODE_DPAD_CENTER" to move down: adb shell input keyevent 20 and up: adb shell input keyevent 19 to select row: adb shell input keyevent 23 It works fine for me (no rooted Samsung Galaxy S3)

Categories : Android

Passing arguments to command line upon button click in c#
Looks like you're missing a space before and after your ip, string.Format would make this easier the read proc.Arguments = string.Format("c/ ping {0} -t", s); Alternatively, a simple way to implement this would be to use the Process.Start(string, string) overload Process.Start("cmd.exe", string.Format("c/ ping {0} -t", s));

Categories : C#

Windows (C# preferably) - How to find out that we are not reading data from socket fast enaugh
The TCP Window is handled by the Kernel and won't be available to you. I guess you could possibly compare the ReceiveBufferSize with number of bytes Received. If this buffer isn't full, then you are waiting.

Categories : C#

Is there a way to enforce that nodes in a JTree must be unique, preferably without writing an implementation of TreeModel?
I think the code is pretty easy to read. Just loop through each and track if it is unique. If you care to track it, it returns true/false if it was added Test of the method DefaultMutableTreeNode child = new DefaultMutableTreeNode("String"); DefaultMutableTreeNode child1 = new DefaultMutableTreeNode("String"); DefaultMutableTreeNode child2 = new DefaultMutableTreeNode("String1"); addUniqueNode(child, model); // Will get added addUniqueNode(child1, model); // Will not get added addUniqueNode(child2, model); // Will get added Method: public boolean addUniqueNode(DefaultMutableTreeNode childNode, DefaultTreeModel model) { DefaultMutableTreeNode root = (DefaultMutableTreeNode) model.getRoot(); // Check each node boolean isUnique = true; for (int i = 0; i < model.getC

Categories : Java

Simplest way to serve dynamic content with .net (& preferably iis) without any form of asp.net / WCF / built in technology
Sounds like a custom asp.net handler could fit you. A handler lets you work at the lowest possible level. http://msdn.microsoft.com/en-us/library/ms228090(v=vs.85).aspx In a custom handler you could read disk files (pages) and return them, build custom html strings and return them and do any other tasks you want. What's more, by registering a handler to a specific custom extension, you could have your own "web execution engine", for example instead of ".aspx" extension, your "pages" could have ".foobar" or any other extension of your choice (including extensionless requests).

Categories : C#

Save clicked images into custom folder(Preferably internal to the app ) instead of gallery
You can delete the file once it's saved in your custom file. If you're not sure of the name of the file the camera took, you can look at the time stamp or, if you're willing to go crazy, you can use FileObserver to wait for the file to be finished writing before deleting it (if concurrency is an issue and something bad happens.) After doing some research, I found that that answer is posted here: Double save image

Categories : Android

To uncheck all checkboxes of primefaces datatable on click of command button
If you want to use a separate button, then you can call the Javascript method provided in the PrimeFaces documentation. unselectAllRows() - Unselects all rows. You would do this by providing your DataTable a widgetVar: <p:dataTable id="multiCars" widgetVar="multiCars" ... > then calling it from a commandButton of type "button" (for client-side processing): <p:commandButton type="button" value="Deselect All" onclick="multiCars.unselectAllRows();" /> That said, why don't you just use a select all/deselect all option provided by the framework? If you remove the header facet of your selectionmode="multiple" column, then it will display a checkbox allowing you to select or deselect all. So instead of <p:column selectionMode="multiple" style="width:2%;align:middle

Categories : JSF

Class implicit cast to integral type (preferably bool) at compiile-time
You cannot provide a type where an expression is expected. But if you add a conversion operator to your wrapper, like so: template<typename T , T VALUE> struct integral_value_wrapper { static constexpr T value = VALUE; constexpr operator T () const { return value; } }; You can then write: if ( is_int<type>() ) // ^^ Which is what standard type traits do.

Categories : C++



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