w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML videos Categories
Closing Liferay dialog box programmatically
Save the popup reference, and use that to close the popup later: var myPopup; AUI().all('.employee-dialog').on( 'click', function(event){ [..] myPopup = Liferay.Util.openWindow([...]); } ); Use the saved popup reference in onclick: <input value="delete" type="button" onclick="myPopup.close();document.location.href=' [...]

Categories : Javascript

Closing windows (not Swing) programmatically in Java
Try using the taskkill command example: taskkill /IM notepad.exe this site has some of its uses, maybe it will help! :) http://www.tech-recipes.com/rx/446/xp_kill_windows_process_command_line_taskkill/ try{ Process process = runtime.exec("taskkill /IM notepad.exe"); } catch (IOException ioe){ JFrame alertFrame = new JFrame(); JOptionPane.showMessageDialog(alertFrame, "Error closing notepad."); } I haven't tested the taskkill command but this is from a working example

Categories : Java

Add UISearchBar programmatically to a programmatically added UITableView in a normal ViewController
Is your object implementing the delegate methods in UISearchDisplayDelegate? In other words, you have to define what happens when text is entered in the search bar, it does not happen automatically for you.

Categories : Objective C

Custom TableViewCell is not called (programmatically)
Have you set the delegate and the data source of the table view: yourTableView.delegate = self; yourTableView.dataSource = self; You should do this in your view controller.

Categories : Objective C

textFieldShouldReturn does not get called (textField loaded programmatically)
Try moving all the code in viewDidLoad - (void)viewDidLoad { [super viewDidLoad]; searchTextField = [[UITextField alloc] initWithFrame:CGRectMake(10, -26, 300, 30)]; searchTextField.borderStyle = UITextBorderStyleRoundedRect; searchTextField.font = [UIFont fontWithName:@"Heiti TC" size:13]; searchTextField.autocorrectionType = UITextAutocorrectionTypeNo; searchTextField.clearButtonMode = UITextFieldViewModeWhileEditing; searchTextField.delegate = self; searchTextField.contentVerticalAlignment = UIControlContentVerticalAlignmentCenter; searchTextField.placeholder = @"Search on the Channel"; searchTextField.borderStyle = UITextBorderStyleNone;; searchTextField.textAlignment = UITextAlignmentCenter;

Categories : IOS

Programmatically set R.ID
R is a Read-Only class. It is generate at compile time and You should not use reflection to modify its field. Also you should avoid reflection to access the fields values. You should use the official API. The comment at the first row of the class is /* AUTO-GENERATED FILE. DO NOT MODIFY. */

Categories : Android

How to add DRM on epub programmatically?
If you just want to protect your books from copying, then publish them through Amazon or Apple. As long as you don't select otherwise, those bookstores will wrap the books in DRM that allows them to be read only a limited number of devices belonging to the purchaser. If you have some reason for wanting to worry about DRM yourself, then after carefully considering why on earth you'd want to, you'll need to find a vendor who can provide both the DRM technology and the reader (perhaps white-labeled for you) which knows how to read those DRM'd books. You see, DRM is useless unless there's a reader that can read the DRM'd books. And what's more, you need a back-end infrastructure to keep track of which devices belong to which person. There are vendors who provide such solutions. However, you'l

Categories : Misc

Sign JAR programmatically
I Signed jar using pom.xml I happy if it help you: <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <groupId>ABC</groupId> <artifactId>applet</artifactId> <version>ABC</version> <packaging>jar</packaging> <name>applet</name> <url>http://maven.apache.org</url> <properties> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> </properties> <build> <plugins> <plugin> &l

Categories : Java

How can I use JDT compiler programmatically?
org.eclipse.jdt.internal.compiler.Compiler is internal API. According to the JavaDoc of its resolve method: Internal API used to resolve a given compilation unit. Can run a subset of the compilation process. Instead, the official way of compiling Java files and determining the compilation problems is described here. Basically, you create a Java project and invoke Eclipse's builder on it, then query the project's Java problem markers.

Categories : Eclipse

Best way to name objects programmatically using R?
There is a fair amount of guesswork involved in this answer but I think this could help: # get a vector with the column names in data_resp modNames <- colnames( data_resp ) # create empty list models <- as.list( NULL ) # iterate through your columns and assign the result as list members for( n in modNames ) { models[[n]] <- train(data_pred_scale[!is.na(data_resp[, n]), ], ### this may need modification, can't test without data data_resp[!is.na(data_resp[, n]), n], method = "rf", tuneGrid = data.frame(.mtry = c(3:6)), nodesize = 3, ntrees = 500) } # save the whole bunch save( models, file = "models.rda" ) You can now retrieve, just with load( "models.rda ), this one object, the list with a

Categories : R

DetailViewController programmatically iOS
Your labels are not being updated to the correct values because the -isEqualToString: method is used to test whether two NSStrings are equal, and it doesn't actually set the value of any NSString. If you want to assign a value to a string variable, you do it the same as you would assign any other variable. Therefore, in order to set the labels properly, you just need to assign the text property of the UILabels, like this: self.username.text = self.user; self.captiontext.text = self.caption;

Categories : Iphone

Get Datasources programmatically
If your datasources are configured with JNDI then you can list the context and can get all the names (more from here) with Context.list() method and from those name you can find all the datasources the Context.list() returns an enumeration of NameClassPair. Each NameClassPair consists of the object's name and its class name. So just iterate it and check the class name for java.sql.DataSource and then get the object name to retrieve it.

Categories : Java

Change Tab Bar Programmatically
As @H2CO3 mentioned, there is no tabBarController property in NSTabView. If you read the documentation, you’ll notice that NSTabView provides a few selection methods, including -selectTabViewItemAtIndex:, which you can use like so: - (IBAction)startScratch:(id)sender { [_mainTabBar selectTabViewItemAtIndex:1]; } Note that the first tab is at index 0.

Categories : Objective C

Is it possible to run .scf file programmatically
Hand in a ProcessStartInfo with UseShellExecute set to true. This executes the scf in the same way START -> RUN would do.

Categories : C#

How do you programmatically - or from CLI - rotate a PDF?
You can use pdfpages LaTeX package documentclass{article} usepackage{pdfpages} egin{document} includepdf[angle=45]{document.pdf} end{document} The LaTeX document above, compiled via pdflatex, produces a document rotated 45 degrees. There are also tools (wrappers of pdfpages) like pdfjam that can be used directly from command line: $ pdfjam --suffix rotated45 --angle 45 --fitpaper true document.pdf

Categories : PHP

How to kill an 3rd-app programmatically?
You can't kill just any process in Android. From the documentation on Process: Note that, though this API allows us to request to kill any process based on its PID, the kernel will still impose standard restrictions on which PIDs you are actually able to kill. Typically this means only the process running the caller's packages/application and any additional processes created by that app; packages sharing a common UID will also be able to kill each other's processes. Also note that the permission you're requesting in your manifest doesn't work the way you think it does. According to the documentation, KILL_BACKGROUND_PROCESS: Allows an application to call killBackgroundProcesses(String).

Categories : Java

Uncomment code programmatically
If you want to comment code before a build of the specified file you can work with compiler switches and specify the compiler switch when building the file in VS or with MSBuild. You can use something like this: #ifdef _DEBUG //string A = "Test"; #else string A = "Test"; #endif

Categories : C#

Creating UIScrollView Programmatically
I think it is because the scroll view has not been initialized. Right. I can do the allocation and initialization in the above method but then when I want to use it in another method it wont work. It will if you assign your newly minted scroll view to a property or instance variable. That's what they're for. Oh, one other thing. You'll need to make sure that your scroll view is retained somehow. That means changing your topScrollView property to strong, or adding it to a view (which will then retain it), or both.

Categories : IOS

How to perform a p2 Install programmatically
I use a script to perform this operation. There you can define special variables in case you need them. A script which is passed to ruby and run. You should be able to do the same in JAVA. Depends though how platform-independent should it be. An idea for the API would be to look how the Marketplace Client plugin does the installation of the Marketplace plugins.

Categories : Java

how to move across tabs programmatically
jQuery('.next-product').click(function() { var selected = $tabs.tabs('option', 'selected'); $tabs.tabs('select', selected + 1 === amount ? 0 : selected + 1); }); jQuery('.previous-product').click(function() { debugger; var selected = $tabs.tabs('option', 'selected'); $tabs.tabs('select', selected === 0 ? amount - 1 : selected - 1); }); live demo, this may be what you are looking for

Categories : Javascript

C# creating a database programmatically with SMO
It sounds like the Dapper connection issue is a problem with SQL Server doing some of the SMO operations asynchronously. In all likelihood, the new Database is not ready for other users/connections immediately, but requires some small time for SQL Server to prepare it. In "human-time" (in SSMS, or a Breakpoint) this isn't noticeable, but "program-time" it too fast, so you probably need to give it a pause. This may also be the problem with the Role's AddMember, but there a a number of things that could be wrong here, and we do not have enough information to tell. (specifically, does AddMember work later on? and are the strings being passed correct or not?)

Categories : C#

How do I programmatically get a list of packages from apt?
To display the first five packages: import apt_pkg apt_pkg.init() cache = apt_pkg.Cache() i = 5 for pkg in cache.Packages: print(pkg) i -= 1 if i < 0: break The output (when run on my Ubuntu system): $ python apt_package_list.py Reading package lists... Done Building dependency tree Reading state information... Done <apt_pkg.Package object: name:'tesseract-ocr-epo' section: 'universe/graphics' id:48834> <apt_pkg.Package object: name:'omninotify' section: '' id:48674> <apt_pkg.Package object: name:'pipenightdreams' section: 'universe/games' id:43500> <apt_pkg.Package object: name:'mumudvb' section: 'universe/misc' id:41568> <apt_pkg.Package object: name:'mpg123-alsa' section: '' id:41448> <apt_pkg.Package object: name:'tbb-examples'

Categories : Python

Expanding NSOutlineView programmatically
Thanks to all of you to look into this, By putting log, i found out to be , it seems to be [NSOutlineView reloadData ] seems to be blocking call, so after that if i need to expand / collapse group , i am using [pCTOutlineView expandItem:pValue]; and working so far....

Categories : Objective C

Programmatically create json
Try this var json = {"sensors":[]}; $(".marker").each(function() { var x = $(this).attr("data-x"); var y = $(this).attr("data-y"); var id = $(this).attr("data-id"); json.sensors.push({"x":x, "y":y,"id":id}); });

Categories : Javascript

Launch Jetty 9 Programmatically
I just documented one of our examples here a couple weeks back. We'll be documenting more of our examples and adding some as we get requests and as folks submit their own... anyway, this ought to get you going :) http://www.eclipse.org/jetty/documentation/current/embedded-examples.html#embedded-one-webapp

Categories : Java

Configure EasyTracker programmatically
You can use multiple tracker each with a different ga_trackingId as stated in the documentation here: https://developers.google.com/analytics/devguides/collection/android/v2/advanced#multiple-trackers Instead of "changing" ga_trackingId, you should put some condition to use one tracker or another based on your needs.

Categories : Android

Curve Programmatically Calculated?
Not sure about performance, but -0.5 * cos(x * 2pi) + 0.5 AS3: y = -0.5 * Math.cos(x * 2 * Math.PI) + 0.5; seems to be the curve you are looking for. You can view or edit the curve here: wolfram alfa curve

Categories : Performance

Color to transparency - programmatically
If you want to replace the pixel of a given color by "transparent" pixels, you have (1) to test if a given pixel has the required color (2) set it "transparent" by setting alpha to 0. Something like that would do the trick: for x in range(0, _i.size[0]): for y in range(0, _i.size[1]): col = list(_ii[x, y]) if col[0:3] == my_key_color[0:3]: _oo[x,y] = col[0:3]+(0,) # keep RGB, set A to 0 else: _oo[x,y] = col Please note this is a very basic solution where a pixel is either fully transparent -- or leaved as-is. If you looking for more "professional" effect, you will have te refine this a little...

Categories : Python

Programmatically Creating UILabel
Does the following work ? UIFont * customFont = [UIFont fontWithName:ProximaNovaSemibold size:12]; //custom font NSString * text = [self fromSender]; CGSize labelSize = [text sizeWithFont:customFont constrainedToSize:CGSizeMake(380, 20) lineBreakMode:NSLineBreakByTruncatingTail]; UILabel *fromLabel = [[UILabel alloc]initWithFrame:CGRectMake(91, 15, labelSize.width, labelSize.height)]; fromLabel.text = text; fromLabel.font = customFont; fromLabel.numberOfLines = 1; fromLabel.baselineAdjustment = UIBaselineAdjustmentAlignBaselines; // or UIBaselineAdjustmentAlignCenters, or UIBaselineAdjustmentNone fromLabel.adjustsFontSizeToFitWidth = YES; fromLabel.adjustsLetterSpacingToFitWidth = YES; fromLabel.minimumScaleFactor = 10.0f/12.0f; fromLabel.clipsToBounds = YES; fromLabel.backgroundColor =

Categories : IOS

Programmatically instantiating ValueExpressions
This is a known bug in JSF. It has been filed here with the Mojarra team: https://java.net/jira/browse/JAVASERVERFACES-2089 and here with the MyFaces team: https://issues.apache.org/jira/browse/MYFACES-3168. I realize the phrasing of these bug reports is not exactly what you'd expect, but it is the same bug. If you look at the comments: Hi guys, I just hit this bug again while working on a client's code, and noticed Manfred had closed it as 'resolved'? Why was this considered 'resolved'? It's a real problem for me, stopping me doing things like... <h:dataTable value="#{companyImport.importFiles}" var="_importFile"> <h:column> <h:outputText value="#{_importFile.name}:"/> </h:column> <h:column> <m:metawidget value="#{_importFi

Categories : JSF

Set check box value programmatically using jQuery
Try like $("#deleteCheck").val('12345'); OR $(".delete").val('12345'); deleteCheck is your id that should be selected with # and delete is your class that should be selected with .

Categories : Jquery

Accept UAC Prompt Programmatically
I think what you have to do is impersonate a user with administrator privileges. Try this: http://msdn.microsoft.com/en-us/library/chf6fbt4.aspx I have had success with this method before, give it a shot!

Categories : C#

implementation of tab bar programmatically not in the rootView
Create your UITabBarController as per normal. When a user touches a button, push to that controller: YourTabController *tabController = [[YourTabController alloc] initWithNibName:@"Tabs" bundle:nil]; [self.navController pushViewController:tabController animated:YES];

Categories : Iphone

Add items to popup programmatically
Popup is a FrameworkElement and can have only one child (Child) => you cannot add multiple controls inside, but you can set Child to be any UIElement you want. For instance a DockPanel, and than use AddChild on the panel to add further controls. myPopup.Child = new DockPanel();

Categories : C#

How rooting is achieved programmatically?
Rooting is essentially illegal privilege elevation. In most other spheres of computing it's considered a criminal massive exploit. Depending on the make and model, rooting can be anything from flipping a few bytes via the world-read-writeable /dev/exynos-mem, which gives you access to any process's memory to elaborate kernel attacks or going after daemons on the device (e.g., adb). For example, here is a popular exploit that's used in SuperOneClick. Skimming through it, it's some sort of buffer overflow, possibly on vold but as you can see it's not trivial to understand these exploits, let alone replicate them.

Categories : Android

How can I run an ANY CPU .NET executable programmatically in either 32-bit or 64-bit configurations?
According to Rick Byer's article, AnyCPU Exes are usually more trouble than they're worth, the decision on the "bitness" used to launch AnyCPU applications is determined by the OS loader and you don't have any say in the matter. Specifically: AnyCPU EXEs are a little more complicated since the OS loader needs to decide how to initialze the process. On 64-bit OSes they are run as 64-bit processes (unless the 'ldr64' master OS switch says otherwise), and on 32-bit OSes they are run as 32-bit processes. So, it looks like your best option is to create and launch a second, 32-bit exe and launch that.

Categories : C#

Logging into website programmatically
You can do this using HTTPClient which is part of the commons-httpcomponents project now. http://hc.apache.org/httpcomponents-client-ga/ There is an example of what you ask about: http://hc.apache.org/httpcomponents-client-ga/httpclient/examples/org/apache/http/examples/client/ClientFormLogin.java This tells about how to use SSL: http://hc.apache.org/httpcomponents-client-ga/httpclient/examples/org/apache/http/examples/client/ClientCustomSSL.java

Categories : Java

How to programmatically set textview-s and their properties?
Try this ,it may help TextView view = new TextView(this); view.setText("example textview "); //adding layout properties view.setLayoutParams(new LayoutParams(LayoutParams.FILL_PARENT,LayoutParams.WRAP_CONTENT)); // add the textview to the parentLayout parentLayout.addView(view); Related Links : Dynamically add textViews to a linearLayout how to generate dynamic textview in android? Dynamically Add A TextView - Android

Categories : Android

Programmatically port forwarding using c#
http://www.fluxbytes.com/csharp/upnp-port-forwarding-the-easy-way/ It is targeted at Mono but Mono is a compliant CLR and BCL, so it will work on the standard Windows .Net too. Word of warning: I have not tested that library nor the guide myself. Port Forwarding tells the router to do something along the lines of: "Whatever traffic comes in via port X is mine, send it to my IP". More info: https://en.wikipedia.org/wiki/Port_forwarding

Categories : C#

Is it possible to add buttons to a framelayout that was set programmatically?
http://developer.android.com/reference/android/widget/FrameLayout.html "FameLayout is designed to block out an area on the screen to display a single item. Generally, FrameLayout should be used to hold a single child view, because it can be difficult to organize child views in a way that's scalable to different screen sizes without the children overlapping each other. You can, however, add multiple children to a FrameLayout and control their position within the FrameLayout by assigning gravity to each child, using the android:layout_gravity attribute."

Categories : Java



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