w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML videos Categories
iOS Programmatically Creating a View
- (void)showBanner { UIView *newView = [[UIView alloc] initWithFrame:self.view.bounds]; newView.backgroundColor = [UIColor grayColor]; [self.view addSubview:newView]; [newView performSelector:@selector(removeFromSuperView) withObject:nil afterDelay:5.0f]; } Very preliminary, but should work

Categories : IOS

Programmatically creating tab bar for ViewController
Take a look at this Documentation given by Apple: ViewControllers. Sample Code : - (void)applicationDidFinishLaunching:(UIApplication *)application { UITabBarController *tabBarController = [[UITabBarController alloc] init]; FirstViewController* vc1 = [[FirstViewController alloc] init]; SecondViewController* vc2 = [[SecondViewController alloc] init]; NSArray* controllers = [NSArray arrayWithObjects:vc1, vc2, nil]; tabBarController.viewControllers = controllers; // Add the tab bar controller's current view as a subview of the window [window addSubview:tabBarController.view]; }

Categories : Iphone

Creating a UICollectionView programmatically
Header file:-- @interface ViewController : UIViewController<UICollectionViewDataSource,UICollectionViewDelegateFlowLayout> { UICollectionView *_collectionView; } Implementation File:-- - (void)viewDidLoad { [super viewDidLoad]; self.view = [[UIView alloc] initWithFrame:[[UIScreen mainScreen] bounds]]; UICollectionViewFlowLayout *layout=[[UICollectionViewFlowLayout alloc] init]; _collectionView=[[UICollectionView alloc] initWithFrame:self.view.frame collectionViewLayout:layout]; [_collectionView setDataSource:self]; [_collectionView setDelegate:self]; [_collectionView registerClass:[UICollectionViewCell class] forCellWithReuseIdentifier:@"cellIdentifier"]; [_collectionView setBackgroundColor:[UIColor redColor]]; [self.view addSubview:_

Categories : IOS

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#

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

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

Creating UITableViewCells programmatically
the way that I would solve that sort of problem is indeed switching to programmatic creation because then you can do subclass and implement and same functionality throughout your xibs only once. For instance lets say you have a cell that needs to have a square inside it colored red and sometimes you need another square colored green inside the red square. Well you can have a base class of MiddleSquareCell and then subclass it with GreenSquareCell which just has an override for painting the green square. Another advantage to programmatic solutions is configuration options. So for instance you could have a class SquareCell and then have a configuration option when you create it that says [squareCell setRedSquareVisible]; Or [squareCell setRedSquareVisible]; [squareCell setGreenSquare

Categories : IOS

Creating Facebook Ads programmatically with Ads API or Atlas API
To create ads on Facebook, you'll want to use the Facebook Ads API. This API is JSON based and pretty much any Graph API client library should be able to connect to it. One caveat is you'll need to request access to the Ads API, which might take a bit of time to get reviewed and enabled. The documentation for this API is here: https://developers.facebook.com/docs/ads-api/ The Atlas API is primarily used to serve display ads and measure their performance. It doesn't sound like that's your primary use case here.

Categories : Facebook

iOS SDK: about using properties when creating objects programmatically?
Generally, you will just define properties if you'll need to access them more than once. You can do this in the .m file's interface: @interface MyObject() @property (weak, nonatomic) UIDatePicker *myPicker; @end You will then be able to access it by either _myPicker or self.myPicker. You shouldn't need another NSDate property in your class because you can access the set date at any time: _myPicker.date For your last question: the latter of the two is merely extra sanity checks. While you're writing your own code, and you should know what subviews you're adding in, it can't hurt to double check the type of the subviews incase anything should go wrong and you try to access selectors that don't exist. This is a larger programming question though and not necessarily objective-c or iOS

Categories : IOS

Programmatically creating a hyperlink to a worksheet
It is not working because of how "SubAddress" is setup. Change it to this: Sub Test2() Dim Name As String Sheets(Sheets.Count).Select Name = ActiveSheet.Name Sheets("Summary").Select Range("A10").Select ActiveCell.FormulaR1C1 = "" Range("A10").Select ActiveSheet.Hyperlinks.Add Anchor:=Selection, Address:="", SubAddress:=Name & "!A1", TextToDisplay:="Link" End Sub

Categories : Excel

Creating keystore for jarsigner programmatically
This is how you can add a private key to your new keystore: ... char[] password = "123".toCharArray(); ks.load(null, password); PrivateKeyEntry entry = new PrivateKeyEntry(pair.getPrivate(), new java.security.cert.Certificate[]{PKCertificate}); ks.setEntry("hive",entry , new KeyStore.PasswordProtection("123".toCharArray())); fos = new FileOutputStream("hive-keystore.pkcs12"); ks.store(fos, password); fos.close(); I've tried it with jarsigner and it gave no errors, so it should be fine.

Categories : Java

Creating part programmatically not working in kepler
Find answer just after posting question: Problem: @PostConstruct annotated method is not called Solution: from Why isn't my @Inject-able/@PostConstruct methods being injected? There are typically two reasons why injection fails. Mismatched Annotations: Ensure your bundles use Import-Package with a package version to pull in the standard annotations rather than a Require-Bundle on the javax.annotation bundle. Import-Package: javax.inject;version="1.0.0",javax.annotation; version="1.0.0" Unresolvable Injections: The injector attempts to resolve objects in the context. If an object cannot be resolved in the context, and it's not marked as @Optional, then the method will not be injected. The injector does not normally log when such situations occur as it is an expected occurrence

Categories : Java

Getting unknown database exception while creating schema programmatically?
You need to add one more property in your hibernate config file, to create the database/schema automatically: <property name="hibernate.hbm2ddl.auto">create</property>

Categories : Java

Black screen when programmatically creating navigation controller
It's not showing anything, because there is nothing to show really :). When you do this programmatically, you have to : 1. Instantiate the navigation controller 2. Instantiate the view controllers you want to put in it. 3. Create an array of these objects 4. Add the array to navigation controller 5. Set navController to view. Code snippet: UINavigationController *navContr = [[UINavigationController alloc]init]; FirstViewController *firstViewContr = [[FirstViewController alloc] init]; MapViewController *mapContr = [[MapViewController alloc] init]; NSArray *vcArray = [NSArray arrayWithObjects: mapContr, firstViewContr, nil]; [navContr setViewControllers:vcArray]; [self.window setRootViewController:navContr]; [self.window makeKeyAndVisible]; return YES;

Categories : IOS

When creating a directive programmatically with $compile, how do you call the link function?
$compile(template) actually returns the link function. So productDirective(productScope) is actually the call to the link function. Source : http://docs.angularjs.org/api/ng.$compile Returns {function(scope[, cloneAttachFn])} – a link function which is used to bind template (a DOM element/tree) to a scope

Categories : Javascript

TFS: Creating Bugs and Writing the Description Programmatically Space Issue
Ok, I figured it out. Even though I am using append line once the string is put into the TFS Bug Description(Or also called Steps) it surrounds the entire string with <(p)> html which of course puts it all on one line. To fix this I just added more appends to put <(p)> around each of my desired lines.

Categories : C#

creating proxy using wsdl programmatically and wsdl parsing
using System; using System.Collections.Generic; using System.Text; using System.Reflection; using System.CodeDom; using System.CodeDom.Compiler; using System.Security.Permissions; using System.Web.Services.Description; namespace ConnectionLib { public class WSProxy { [SecurityPermissionAttribute(SecurityAction.Demand, Unrestricted = true)] public static object CallWebService(string webServiceAsmxUrl, string serviceName, string methodName, object[] args) { System.Net.WebClient client = new System.Net.WebClient(); // Connect To the web service System.IO.Stream stream = client.OpenRead(webServiceAsmxUrl + "?wsdl"); // Now read the WSDL file describing a service. ServiceDescription description = Serv

Categories : C#

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

Creating New Xcode Project Based On Existing Files. (Creating Laps into an NSTimer)
You can open your project and choose "add files" from the "file" menu (or drag and drop from finder). I'd suggest choosing the option to copy them to your folder, and make sure you have a checkmark next to your project as you're adding the files. Unfortunately, the process of integrating this new code into your app is a non-trivial exercise and depends entirely upon the particulars of your project, and on the code you're adding to your project. For example, copying .h and .m files (if the names are unique), is easy. But does your project use NIBs or Storyboards? How about the code you're copying in? How are you going to integrate the user interface files. It's non-trivial and it's hard for us to answer in the abstract. If you want to create a new project for your LapTimer.xib, LapTim

Categories : IOS

Creating multiple lockup tables Vs. creating single lookup table
If you just plan to use for a lookup, I would go for the one table solution. If you where planing to store other information about the assets based on their model, for example whether a vehicle was petrol / diesel, or a PC was a desktop or laptop, then the multi table solution may work much better.

Categories : Database

creating a relationship between two tables and creating a foreign key
You should create a constraint: http://dev.mysql.com/doc/refman/5.6/en/innodb-foreign-key-constraints.html

Categories : Mysql

Is creating tasks via a for loop different to creating them individually?
The problem is that your lambda expression captures c - the variable c, not its value at the time of task creation. So by the time you start the tasks, c will be 9. Even if you started them within the loop, there's still no guarantee that the code in the lambda expression will start to execute before the change to c. To fix this, you can use a separate local variable for each iteration of the loop: int c = 1; for (int i = 1; i <= 4; i++) { int temp = c; taskArray[i-1] = new Task(() => calculateRows(temp, true)); c = c + 2; } foreach (Task t in taskArray) { t.Start(); } Or bypass c entirely and compute temp from i: for (int i = 1; i <= 4; i++) { int temp = i * 2 - 1; taskArray[i-1] = new Task(() => calculateRows(temp, true)); } foreach (Task t in tas

Categories : C#

Error creating applicationContext.xml: Error creating bean with name 'sessionFactory' defined in ServletContext resource
Your log hints "java.lang.ClassCastException: org.springframework.orm.hibernate3.LocalDataSourceConnectionProvider cannot be cast to org.hibernate.service.jdbc.connections.spi.ConnectionProvider" It seems that you're using Hibernate4 with spring-hibernate3-support: hibernate-core-4.1.8.Final.jar org.springframework.orm.hibernate3.LocalSessionFactoryBean

Categories : Java

asp.net/javascript creating cookies, advantages creating client side or server side?
Are there any alternatives creating the cookie via server side code or via javascript? No. Actually my server side is a asp.net rest service so probably this isn't a good idea? REST services usually do not deal or know about cookies. They could but it's not a common practice. REST services are using different techniques of authentication, such as sending some value in the Authorization HTTP request header. Are there any advantages or disadvantages in using either method? It would really depend on your scenario and what kind of information you are attempting to store. For example with a server side script you could create an HttpOnly cookie which is not accessible by client scripts, only by server side scripts. In any case you should not be storing sensitive information in

Categories : Javascript

When creating dynamic textboxes a space allocates always when creating the next set of dynamic text box set
The reason for the white space is because of this line in your function: $('#NewlyCreatedSelectBoxes').find('input').remove(); The above line only removes the input elements from the DIV NewlyCreatedSelectBoxes and leaves the <br> tags which cause the whitespace. You can simply use .empty() to remove all child nodes from a selected element. What you have to do is replace the above line with $('#NewlyCreatedSelectBoxes').empty(); Here is a working demo

Categories : HTML

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

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

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 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

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

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

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

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

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 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

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

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

How to enable WCF traces programmatically?
You first need to access the trace object by name, as its defined in the .config file. For example: TraceSource ts = new TraceSource("System.ServiceModel"); Then you can set the filter level to all, none or anything in between: ts.Switch.Level = SourceLevels.Off; // nothing ts.Switch.Level = SourceLevels.All; // everything ts.Switch.Level = SourceLevels.Warning; //warning or higher BTW - the TraceSource class is in the System.Diagnostics namespace, so don't forget the appropriate using statement.

Categories : Wcf

Add DIV background image programmatically
Try this: Use "/" instead of "" div_img.Style.Add("background-image", "url('" + "../emp_pic/" & myDataSet.Tables(0).Rows(0).ItemArray(29).ToString() + "')")

Categories : HTML

Getting json string programmatically C#
You need to use a JSON parser to turn it in to something useful. ServiceStack.Text (available via NuGet or download) has an excellent one that can turn json strings in to first-class POCOs. using ServiceStack.Text; public sealed class SomeObject { public string expand { get; set; } public List<string> projects {get; set; } } And convert thusly: SomeObject object = jsonString.FromJson<SomeObject>(); Note, I would make my POCOs a little more c# friendly and alias away the lower-case: using ServiceStack.Text; using ServiceStack.DataAnnotations; public sealed class SomeObject { [Alias("expand")] public string Expand { get; set; } [Alias("projects")] public List<string> Projects {get; set; } }

Categories : C#



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