w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML videos Categories
Editing server.properties programmatically causes no change?
Usually Application reads properties at sturtup and sets theese properties to java objects. So if you are changing properties during your application lifetime you need to take care about rereading them after your change and recreating (refreshing) objects that use them. For more specific example please provide some code.

Categories : Java

How to programmatically change the selected item in this drop down menu?
Use the .selected property of the option; that will update the .selectedIndex of the select automagically. POC .HTA: <html> <head> <Title>select</Title> <hta:application id="select" scroll = "no"> <script type="text/vbscript"> Function doIt() ' select Item2 With document.getElementById("lbDemo") MsgBox "Before: " & .selectedIndex .options(1).selected = True MsgBox "After: " & .selectedIndex End With End Function </script> </head> <body> <select id="lbDemo" size="4"> <option value=Item1>Item1</option> <option value=Item2>Item2</option> <option value=Item3>Item3</option> </select> <hr /> <input type="butt

Categories : Javascript

Customizing change Text and Background Color of row Item programmatically in Android
it doesn't work because the children of a listview are being re-used each time you scroll. you should either update the data and call notifyDataSetChanged , or update the data and use something like: int visiblePosition = mListView.getFirstVisiblePosition(); View view = mListView.getChildAt(position - visiblePosition); if(view!=null) { // update the view to have a different background and other stuff... } notes about the second way: on some adapterViews the second way might not work as expected. i'm not sure what will happen when changing the size of the view .

Categories : Android

In a grid change the Selected Item Model properties but it should not reflect back in the grid unless user saves it
Instead of having a designated property in your view model for the selected item, in your xaml that displays the grid you can use something like this: <Window xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:local="clr-namespace:WpfApplication3" xmlns:i="http://schemas.microsoft.com/expression/2010/interactions" xmlns:ie="http://schemas.microsoft.com/expression/2010/interactivity" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" mc:Ignorable="d" x:Class="WpfApplication3.MainWindow" x:Name="MyMainWindow"> <Grid> <DataGrid x:Name="myGrid" ItemsSource="{Binding myItems}"> &l

Categories : Wpf

Getting Exception while reading file content using solr line entity processor
BinFileDataSource works with InputStream while FileDataSource. You can try using the FileDataSource instead to check for the Casting issue. <dataSource type="FileDataSource" name = "fds"/>

Categories : Solr

How to change the existing custom properties/properties in .pptx files using Apache POI
You'll want to take a look at the JavaDocs for XSLFSlideShow. From there, you'll see it has a method getProperties(). That returns a POIXMLProperties object, which lets you get at the three different kinds of properties that an OOXML file (such as .pptx) has - core, extended and custom. Next, you'll need to work out what kind of properties the ones you want to change are. Assuming you wanted to change the title (a core property), you'd do something like: OPCPackage pkg = OPCPackage.open("input.pptx"); XSLFSlideShow slideshow = new XSLFSlideShow(pkg); POIXMLProperties props = slideshow.getProperties(); CoreProperties cp = props.getCoreProperties(); cp.setTitle("I changed the title!"); FileOutputStream out = new FileOutputStream("output.pptx"); slideshow.write(out); out.close(); pkg.clos

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

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

jquery .css() won't set multiple properties programmatically
In Javascript when constructing an object you can only define keys as strings.. meaning the values in property1 and property2 will not be passed.. instead the strings 'property1' and 'property2' will be passed.. To overcome this, create the object in advanced, then pass it whole: (working jsFiddle) var cssObj = {}; cssObj[property1] = '50px'; cssObj[property2] = '50px'; $('.greenbox').css(cssObj); Edit: I couldn't find it in the docs to back me up but the case is this: When you use the following notation: {key1:value1, key2:value2} javascript parses the keys as names, and even though there's a variable with the same name defined javascript is not passing the value but only the name - this is how it was built - the keys cannot be passed as variables. Using cssObj[peroperty1] works be

Categories : Jquery

Editing Media Properties programmatically in Umbraco (4.11)
you should be able to exactly what you've already done but replace the line: Document doc = new Document(mediaItemId); with Media doc = new Media(mediaItemId); You will of course have to make sure that your Media type has a "likes" property. This can be done in the "Settings > Media types" section of Umbraco in the same way that you can add properties to document types.

Categories : C#

How to add properties (markers, geopoints, etc...) to a Google Android Map v2 created programmatically
That is because the GoogleMap does not yet exist. commit() schedules the map to be created, but it is not created by the time you try calling getMap(). Either: Switch to inflating a layout containing the MapFragment, as you can call getMap() after inflation is complete, or Delay the getMap() call to some later point, or Subclass MapFragment and call getMap() and add your marker in a method like onActivityCreated() (basically, anything called after onCreateView() has completed)

Categories : Android

How to change the colour of of a main menu item, when submenu item is hovered
I could be missing something here as I haven't actually seen your markup, (no offense but I'm not visiting your site to look for it) but you could update your CSS to something like this: nav li.active.parent > a, nav li:hover > a { background-image: url(http://horyzon.de/images/images/navbg.png); color: #FFF; }

Categories : HTML

Is it possible to set/change the value of every item in an array that does not use incremental values for item placement (0,1,2,etc...)?
Because you didnt exactly post how your array looks like I assume a structure. This code will reset all boolean to false: var array = { "id1":"foo", "id2":"bar", "id3":true, "id4":1, "id5":false, }; $.each(array,function(index,obj){ if(typeof obj === 'boolean' ) array[index] = false; }); console.log(array); Here is a jsfiddle (Check console log) Trick to understand this is that an array in javascript is also an object with numeric keys. The keys don't have to be numeric though, and you can still access the array using non-numeric key. for example using the array above, array["id1"] is perfectly valid in javascript. It is equivalent of array.id1 UPDATE The 'array' variable is not really an array here but an object. Please read @BalusC's comment below for

Categories : Jquery

Select Item in ListView Programmatically
You have to handle the TextChanged event of your TextBox: //TextChanged event handler for your textBox1 private void textBox1_TextChanged(object sender, EventArgs e) { ListViewItem item = listView1.Items.OfType<ListViewItem>() .FirstOrDefault(x => x.Text.Equals(textBox1.Text, StringComparison.CurrentCultureIgnoreCase)); if (item != null){ listView1.SelectedItems.Clear(); item.Selected = item.Focused = true; listView1.Focus();//Focus to see it in action because SelectedItem won't look like selected if the listView is not focused. } } You can also use ListView.FindItemWithText method, but notice that it matches the exact string which starts the item text, that means you have to handle

Categories : C#

How can I programmatically select an item in a listbox?
int i = AppSettings.ReadSettingsVal("beltprinter"); //Save it as an int. listBoxBeltPrinters.SelectedItem = listBoxBeltPrinters.Items.IndexOf(i); lblSelectedPrinter.Text = listBoxBeltPrinters.SelectedItem.toString();

Categories : C#

How to highlight a LongListSelector Item on the UI programmatically
I am not sure whether I understood your question correctly since I am new in windows phone development. Here is the code for changing the background of stackpanel and adding textblock to it programmatically. enter code here // Constructor public MainPage() { InitializeComponent(); // change the background of stackpanel StackPanel st = new StackPanel(); SolidColorBrush mysolidbrush = new SolidColorBrush(); mysolidbrush.Color = Color.FromArgb(255, 100,100,10); // RGB color st.Background = mysolidbrush; // Adding textblock to the stackpanel TextBlock txtblk = new TextBlock(); st.Children.Add(txtblk); } Best, B

Categories : C#

How can I programmatically determine whether new work item added to TFS using C#
I don't know if it's what you need, but maybe you could suscribe to server events (implementing an application) and filter them to check what kind of event and what to do with it. Here you have a sample: Team Foundation Server Event Service

Categories : C#

How can I add a new item to system.webServer/handlers programmatically in ASP.NET
Does this help you: http://www.iis.net/configreference/system.webserver/handlers It contains programmatic and command line examples

Categories : Asp Net

Can't set selected item in radiobuttonlist control programmatically
You're searching for the item with the string of "CurAnswer" as the value, and not the contents of the CurAnswer variable. Try this: rbl.SelectedIndex = rbl.Items.IndexOf(rbl.Items.FindByValue(CurAnswer.ToString)) If that doesn't work, if you set the SelectedValue it should change the selected item. Try this in your last line in the loop: rbl.SelectedValue = rbl.Items.FindByValue(CurAnswer).ToString

Categories : Vb.Net

How to add a bitmap Image as Combo Box Item in WPF programmatically?
BitmapImage actually derives from ImageSource. So you can use it as the Source of Image. Observe: private ComboBox CreateSymbolComboBox(List<BitmapImage> images, int selectedIndex, bool isEnabled) { ComboBox cb = new ComboBox(); foreach (BitmapImage img in images) { cb.Items.Add(new Image() {Source = img}); } return cb; }

Categories : Wpf

Programmatically Accessing CQ5 Content using the JCR
You don't need and don't want to call JcrUtils.getRepository in a Sling/CQ app, you should rather access the SlingRepository OSGi service that CQ provides. The simplest is to use an @Reference annotation in an OSGi declarative services @Component - there are multiple examples of this in the Apache Sling codebase, the http://svn.apache.org/repos/asf/sling/trunk/samples/slingbucks sample is a good starting point for that. If your code executes as part of request processing, you don't need to create a Session yourself, you can get it by calling request.getResourceResolver().adaptTo(Session.class) where request is the SlingHttpServletRequest that you get in a Sling servlet.

Categories : Java

Enable Android Preference Item programmatically in Java
This method is deprecated, because it is irrelevant to a fragment-based activity: This method was deprecated in API level 11. This function is not relevant for a modern fragment-based PreferenceActivity. However, if you decide to build your PreferenceActivity without fragments, it is perfectly fine for you to use this method (You have to use it, to be honest). If you do want to use fragments, read more about them in PreferenceActivitys here.

Categories : Android

changing menu item programmatically is not working in android
Since you did not provide any other code, I can't say much about it. However, whenever you want to change the menu, you should call invalidateOptionsMenu(). What that does is it invalidates the menu, which in turn forces it to be recreated. During its recreation, one of the callbacks is onPrepareOptionsMenu(Menu menu). This is where you can make the change to your menu. Example: // This is where I want to change the menu. Can be anywhere in your activity. invalidateOptionsMenu(); Then override this method // Override this method to do what you want when the menu is recreated @Override public boolean onPrepareOptionsMenu(Menu menu) { menu.findItem(R.id.pencil).setVisible(false); return super.onPrepareOptionsMenu(menu); }

Categories : Android

How to remove programmatically all the content of a section?
You need to reference Microsoft.Office.Interop.Word With that you can create a new word application. Dim oWordObj as Word.Application = CreateObject("Word.Application") From there you can grab the necessary word document Dim oDoc as Word.Document = //Grab your document here From there, there are many easily searched ways to modify the document. Start looking into this and you should find what you need.

Categories : Vb.Net

UIPickerView change content text size after loading content into picker
If I understood your question correctly, you may want to take a look at this answer. The strategy is basically to truncate (ellipsis) instead of font shrinking. Edit (based on comment) I would strongly advise against setting all text to the minimum font. Lets say you have elements as such: Pear Peach ok, so far these will fit your label perfectly, with a good font size. Now you add a longer item: Pear Peach Strawberry Pineapple and now all your items are a little bit smaller, but thats still readable, so it's acceptable. And then a huge item appears, such as: Pear Peach Strawberry Pineapple SomeKindOfExoticFruitThatHasAnIncredibleLongName which would make all items inside your picker become incredibly small, and difficult to read. But if you still want to go down that roa

Categories : IOS

Adding asp controls to programmatically added content
Its kinda hard to tell what your going for, but I will do my best to get as close as I can. The first thing is you need some control to work as a "container". This can be just about any control you like. In my test for this scenario I did something like this: <div runat="server" id="ContainerDiv"></div> The next thing is you need a way to manage your Id. I did this by creating a simple variable and method like so: private int IdCount = 0; private string GetNewID() { return string.Format("try{0}", IdCount++); } Now you say you want an achor tag that also has a CommandName and CommandArgument a LinkButton will do this. You can add a LinkButton to your div above like this: ContainerDiv.Controls.Add( new LinkButton() { ID = GetNewID(), CommandName

Categories : C#

How to display .m file content in objective c programmatically?
You should take a look at my answer to this question. The best solution seems to be ParseKit.

Categories : Objective C

Programmatically add content to static table view cell in IOS 6
How did you even create an IBOutlet for a single cell? The only thing you normally should be able to to if you want to personalize your cell in a xib is create a custom cell and use it programmatically in your cellForRow: atIndexPath:. However, I think the simplest solution here would be to do everything in code, as your app seems to be simple: - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { NSString *identifier = @"Cell"; UITableViewCell *yourCell = [tableView dequeueReusableCellWithIdentifier:identifier]; if(!yourCell){ yourCell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease]; } if(indexPath.row == yourDesiredCellInde

Categories : IOS

How to programmatically open docx then convert to pdf in memory and then get byte content of pdf in C#?
You can utilise the Word Automation Services Service in SharePoint 2010. There is a nice example at http://pholpar.wordpress.com/2011/10/27/using-sharepoint-2010-word-automation-services-to-convert-document-synchronously/ of how to do this in a synchronous manner.

Categories : C#

How can I programmatically add content to new/existing executable using c# and possibly make the solution work on a mac?
I think that it's true for most binary file formats (including the executables), appending data to a well-formed file will not affect the usage of the file, the way it is typically interpreted by most programs. You could, maybe, take advantage of this. To embed, you'll need to take your (existing) target executable and simply append some binary data to it. That data will have two parts: A magic word (to denote the presence of an appended resource) The resource itself. So, this: [target executable data] Becomes this: [target executable data] [magic word] [resource] To read the resource from the target executable, simply have that executable open itself, search for the magic word and, if it's present, start reading the resource appended after it. This is what WinRAR does (or at l

Categories : C#

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

How to show inner content in list item outside of that list item without being covered up by descending list items
You must set the z-index of the clicked 'li' higher and in return the former clicked 'li' back. Here is the example: fiddle And here the script: var oldli; $('li').click( function(){ $(oldli).toggleClass('displayNone displayBlock'); $(oldli).css("z-index","1"); $(this).toggleClass('displayBlock displayNone'); $(this).css("z-index","5"); oldli=$(this); } );

Categories : Javascript

How to detect the difference between a change made by a user and a change made programmatically?
If you just change the value with el.value = x, the change event is not triggered. For example, this won't log anything to the console: var el = document.getElementById('el') el.onchange = function(){ console.log('changed'); }; el.value = 'asasassasa'; So, if you're seeing it's being triggered twice, it's either because: You're manually triggering it with el.onchange(). In this case, just remove the this call. Or: The event handler is bound to the element more than once. You have to locate where that's happening.

Categories : Javascript

Will git store diffs of binary files that change in content, but never change size?
If you're really storing Intel HEX format files, you don't have anything to worry about - they are text files. They just happen to represent binary data. From the wikipedia entry: The format is a text file, with each line containing hexadecimal values encoding a sequence of data and their starting offset or absolute address. Editorial note: The change you made in your test isn't valid - G is not a hexadecimal digit, and besides that, you didn't update the checksum.

Categories : GIT

Remove duplicate items from list if certain properties match and get the top item based on some ordering
The simplest way to group on multiple properties is to use an anonymous type: var groups = users.GroupBy(user => new { Name, Type, SubType, }); This works because the implementation of anonymous types is such that they override the Equals method to compare the values of each member of the type, and also overrides the GetHashCode method to make it a composite hash of the hashes of all of the values of the object. If you just created a new named type you would need to handle all of that yourself, which is simply tedious.

Categories : C#

File content in Sublime does not change on Git branch change
Sublime Text does not have any built-in way to do this. Though perhaps a Sublime Text plugin could do it by combining the file refresher plugin in the forum thread with a Python equivalent to watchr. This Sublime Forum thread asks how to make a file in a different tab update automatically, given that Sublime Text is already frontmost. The asker couldn't find a way to make Sublime Text do that, but as a workaround, wrote a plugin that lets them hit a hotkey to reload all open tabs. You could try to solve this with the same principle, by making a system-wide hotkey to switch to ST2 and back. You could implement the hotkey with AutoHotkey for Windows or Quicksilver or Keyboard Maestro for Mac. It's not as good as automatic updating, but it's the next best thing. You could hit the hotkey eve

Categories : GIT

Change height of cell with change frame of content
This is the code i used to set the UITableViewCell height dynamically: - (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath { NSDictionary* dict = [branchesArray objectAtIndex:indexPath.row]; NSString* address = [NSString stringWithFormat:@"%@,%@ %@ %@ %@",[dict objectForKey:@"locality"],[dict objectForKey:@"city"],[dict objectForKey:@"address"],[dict objectForKey:@"contactNumber"], [dict objectForKey:@"contactEmail"]]; CGSize constraint = CGSizeMake(220, MAXFLOAT); CGSize size = [address sizeWithFont:[UIFont fontWithName:@"Helvetica" size:14.0f] constrainedToSize:constraint lineBreakMode:NSLineBreakByWordWrapping]; CGFloat height1 = MAX(size.height, 110.0f); return height1+20; } as well as set the frame in - (UITableViewCe

Categories : IOS

Programmatically change SQL Server configuration
You do not have write permissions on drive C: for your custom user. EDIT: var query = @"BACKUP DATABASE [aveed_co] TO DISK = 'C:akup.bak' WITH INIT ,NOUNLOAD ,NAME = N'aveed_co' ,NOSKIP ,STATS = 10 ,NOFORMAT ,COMPRESSION"; using (var connection = new SqlConnection(@"Server=myServerAddress;Database=aveed_co;User Id=myUsername;Password=myPassword;")) { connection.Open(); using (var command = new SqlCommand(query, connection)) { command.CommandTimeout = 0; command.ExecuteNonQuery(); } } SQL Server must be abl

Categories : C#

how to change the language in ios without restarting the app programmatically?
I have done same kind of task in my recent project Need to support Arabic & English. Where I need to change Language according selected option from list. I have created two .xib one for Arabic and one for english and then select // for setting bundle +(void) setContentBundle{ SS AppDelegate *delegate = [[UIApplication sharedApplication] delegate]; NSString *currentLanguage; if([delegate.strLanguage length]> 0) { currentLanguage = delegate.strLanguage; }else { currentLanguage = @"en"; } if ([currentLanguage isEqualToString:@"ar"]) { // If ARABIC. languageBundle = nil; NSString* path = [[NSBundle mainBundle] pathForResource:@"ar" ofType:@"lproj"]; languageBundle = [NSBundle bundleWithPath:path]; }el

Categories : Iphone

Change OS X system volume programmatically
You need to get the default audio device first: #import <CoreAudio/CoreAudio.h> AudioObjectPropertyAddress getDefaultOutputDevicePropertyAddress = { kAudioHardwarePropertyDefaultOutputDevice, kAudioObjectPropertyScopeGlobal, kAudioObjectPropertyElementMaster }; AudioDeviceID defaultOutputDeviceID; UInt32 volumedataSize = sizeof(defaultOutputDeviceID); OSStatus result = AudioObjectGetPropertyData(kAudioObjectSystemObject, &getDefaultOutputDevicePropertyAddress, 0, NULL, &volumedataSize, &defaultOutputDeviceID); if(kAudioHardwareNoError != result) { // ... handle error ... } You can then set your volume on channel 1 (left) and

Categories : Objective C



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