Programatically getting the version of a font in OSX |
Well I stumbled upon the answer five minutes after posting. I was basically
looking at the wrong place, hoping to find it in CTFontDescriptorRef. It
looks like the right place to look is CTFontRef, which you can create from
a CTFontDescriptor via CTFontCreateWithFontDescriptor.
Then you can use CTFontCopyAttribute, and a bunch of different things are
available, namely kCTFontVersionNameKey.
|
Access JSF and Primefaces version numbers programatically |
For PrimeFaces, you can use the Constants class:
org.primefaces.util.Constants.VERSION
|
How to get java control panel cache path programatically in java? |
I don't know if there is a guaranteed way to get the java cache path
programatically. But it is probably moot anyway. Unless your applet is
"trusted":
it is unlikely it will have permission to find out what the cache location
is, and
it is unlikely it will have permission to delete files in the cache ... or
anywhere else on the user's machine.
FWIW, if your applet has permission to read files on the user's machine, it
should be able to load the Deployment Configuration File into a Properties
object and get the cache directory location(s) from the relevant
properties.
|
WPF change style (with trigger) programatically |
Bind your IsSelected property to some bool value in the ViewModel and
toggle that.
<ListView.ItemContainerStyle>
<Style TargetType="ListViewItem">
<Setter Property="IsSelected" Value="{Binding IsSelected}"/>
</Style>
</ListView.ItemContainerStyle>
Item ViewModel:
private bool _isSelected;
public bool IsSelected
{
get { return _isSelected; }
set
{
_isSelected = value;
NotifyPropertyChange("IsSelected");
}
}
In WPF you don't manipulate UI elements in procedural code, instead you use
DataBinding and manipulate your models / ViewModels' properties
As an aside, I recommend against using PNG or other bitmap based stuff for
regular UI elements in WPF.
Instead of that you should create your UI using WPF elements
|
How to change the background of a button programatically? |
You are trying to use solutions for WPF in Winforms. This will not work.
The class you need is System.Drawing.Image (or System.Drawing.Bitmap, which
inherits from Image).
Bitmap b = new Bitmap(@"C:myBitmap.jpg");
myButton.Image = b;
Be sure to call Dispose on your Bitmap if and when it is no longer in use.
|
Programatically change drawableLeft of Button |
I recomend that instead of using a button you use an Imageview and add an
onclick listener to it. That way you can just do
Imageview.setbitmap(bitmap) and create a bitmap from one of your drawables
|
How to change current window programatically? |
Is it about tabs? If it's about windows, then, you may want to take a look
at this page.
http://developer.chrome.com/extensions/windows.html
|
How do I programatically change tab names in a WPF TabControl? |
WPF is designed with data/UI separation in mind. One of the reasons you're
having trouble finding a solution is because what you're trying to do is a
no-no; instead of programmatically changing the UI's header text, you
should be changing the underlying data instead, and allowing the WPF
plumbing to update how the data is displayed.
A WPF tab control can literally contain any type of object; you could fill
it with integers or strings or FooBars or whatever. There's no guarantee
that any of these objects will define a Header property, and it's up to the
developer to configure data bindings or templates which instruct the
TabControl just how a FooBar or a whatever should be displayed.
In an ideal WPF application which adheres to the MVVM design pattern, you
might have your TabControl bou
|
How to change Programatically Product visiblity in Magento |
<?php
require_once 'app/Mage.php';
umask(0);
$product_id = 'your_product_id';
Mage::app('default');
$product = Mage::getModel('catalog/product');
$product->load($product_id);
$product->setVisibility(4);
$product->save();
?>
here product get by product id and updating the product with visibility 4.
if you want to add new product
<?php
require_once 'app/Mage.php';
umask(0);
$product_id = 'your_product_id';
Mage::app('default');
$product = Mage::getModel('catalog/product');
$product->setVisibility(4);
$product->save();
?>
|
Programatically change "Reject call with message" |
Quick response messages can only be altered through Call settings UI as the
values are stored in Phone app's shared preference,
respond_via_sms_prefs.xml. See RespondViaSmsManager.java:
/** SharedPreferences file name for our persistent settings. */
private static final String SHARED_PREFERENCES_NAME =
"respond_via_sms_prefs";
public void setInCallScreenInstance(InCallScreen inCallScreen) {
mInCallScreen = inCallScreen;
if (mInCallScreen != null) {
// Prefetch shared preferences to make the first canned response
lookup faster
// (and to prevent StrictMode violation)
mInCallScreen.getSharedPreferences(SHARED_PREFERENCES_NAME,
Context.MODE_PRIVATE);
}
}
Only Phone app can read/write from/to the file.
Default values are set in respond_via_sms_setting
|
Change WPF window Size programatically in MVVM |
Try setting the 'Application.Current.MainWindow' property in the Loaded
event in the MainWindow.xaml.cs file:
private void MainWindow_Loaded(object sender, RoutedEventArgs e)
{
Application.Current.MainWindow = this;
}
UPDATE >>>
My friend, please remember, you said you wanted to use
Application.Current.MainWindow... this is how you could use it. However, if
you want to do this the MVVM way, then why don't you just bind the value to
the Window.Width properties?
<Window Width="{Binding Width}" MinWidth="{Binding Width}"
MaxWidth="{Binding Width}">
...
</Window>
Please note that binding to Window.Width is not enough for this to work.
|
Change the Color of Customized Listview Programatically? |
if you want to set the background color of ListView's row than try
row.setBackgroundColor(Color.RED); // (or any color) inside getView()
so your code should be
@Override
public View getView(int position, View convertView, ViewGroup
parent) {
View row = super.getView(position, convertView, parent);
row.setBackgroundColor(Color.RED); // or any color
TextView Description = (TextView) row
.findViewById(R.id.description);
Log.d("SPOC COUNT", "" + SPOC.size());
Log.d("SPOC POSitiON", "" + position);
Description.setText(SPOC.get(position).getDescription());
return row;
}
|
NSPredicateEditor Change Control Height Programatically |
I FINALLY figured out the answer! Hurray!
Here is the simple answer: SetFrame DOES NOT WORK with AUTOLAYOUT!
Instead you have to edit the constraints!
This means set a constraint for 'height' on the NSPredicateEditor and
IBOutlet it to your code.
Then use the following command.
NSInteger newRowCount = [_predicateEditor numberOfRows];
NSInteger rowHeight = [_predicateEditor rowHeight];
[[_predicateEditorHeight animator] setConstant:rowHeight*newRowCount];
Works like a charm!
|
Change Screen Orientation programatically using a Button |
Yes it is implementable!
ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
ActivityInfo.SCREEN_ORIENTATION_PORTRAIT
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
ActivityInfo
http://developer.android.com/reference/android/content/pm/ActivityInfo.html
Refer the
link:
Button buttonSetPortrait = (Button)findViewById(R.id.setPortrait);
Button buttonSetLandscape = (Button)findViewById(R.id.setLandscape);
buttonSetPortrait.setOnClickListener(new Button.OnClickListener(){
@Override
public void onClick(View arg0) {
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
}
});
buttonSetLandscape.setOnClickListener(new Button.OnClickListener(){
@Override
public void onCl
|
How do I change the position of this element on the ViewController programatically? |
bgImageView.frame =CGRectMake(x,y,width,height);
If you want to maintain the previous values:
bgImageView.frame =CGRectMake(x,y, bgImageView.frame.sizewidth,
bgImageView.frame.size.height);
|
How to recognize iPhone contact change programatically |
check out the ABAddressBookRegisterExternalChangeCallback function. It's
sort of a weird API but this will allow you to receive a callback when the
address book changes in a different app or thread. Your local cached
address book should not be affected by these changes. I don't think there
are any convenience functions for telling what changes were made but you
may be able to manually find some changes by comparing your cached version
to a new ABAddressBook instance
|
Button text color change programatically |
Is there a better way to go about it?
Step #1: Add a TextView[] buttons data member to the activity or fragment
Step #2: In onCreate(), after setContentView(), call findViewById() four
times, one per button, and put each button into the buttons array
Step #3: Rewrite onClick() to:
for (TextView button : buttons) {
if (button==v) {
button.setTextColor(Color.RED);
}
else {
button.setTextColor(Color.WHITE);
}
}
|
Change View height programatically Smoothly |
You could write a for loop, where the view's height is increased by very
little, than a pause is made before increasing the counter. In this way,
the user will have the impression of a smooth transition.
|
How to change language of keyboard in spanish programatically in android |
Someone may correct me but I'm fairly certain there is no option to do that
at runtime. The keyboard itself is an application and therefore to change
the input language the user has to do that themselves in the settings of
whatever keyboard they are using. You can not change it from your app.
|
how do I programatically change system-wide desktop picture? |
Take a look at Preferences and Settings Programming Guide. This should
help.
Edit:
Here is the sample code:
NSString* newImgPath = @"/Users/cody/Desktop/stuff/imgs/Black_mac.png";
NSUserDefaults* defaults = [NSUserDefaults standardUserDefaults];
NSMutableDictionary* desktopDict = [NSMutableDictionary
dictionaryWithDictionary:[defaults
persistentDomainForName:@"com.apple.desktop"]];
NSMutableDictionary* bgDict = [desktopDict objectForKey:@"Background"];
NSMutableDictionary* spaces = [bgDict objectForKey:@"spaces"];
[spaces enumerateKeysAndObjectsUsingBlock:^(NSString* key,
NSMutableDictionary* obj, BOOL *stop) {
[obj enumerateKeysAndObjectsUsingBlock:^(id key, NSMutableDictionary*
prefs, BOOL *stop) {
[prefs setObject:newImgPath forKey:@"ImageFilePath"];
[prefs setObj
|
How do I programatically change a drawable resource's background color |
One approach is this:
public class MyDrawable extends ShapeDrawable{
private Paint mFillPaint;
private Paint mStrokePaint;
private int mColor;
@Override
protected void onDraw(Shape shape, Canvas canvas, Paint paint)
{
shape.drawPaint(mFillPaint, canvas);
shape.drawPaint(mStrokePaint, canvas);
super.onDraw(shape, canvas, paint);
}
public MyDrawable() {
super();
// TODO Auto-generated constructor stub
}
public void setColors(Paint.Style style, int c){
mColor = c;
if(style.equals(Paint.Style.FILL)){
mFillPaint.setColor(mColor);
|
Correct Way to Programatically Trigger Change Event of ASP.net CascadingDropDown using JavaScript |
According to you, my answer on How can I trigger an onchange event
manually? also solves your problem:
There's a couple of ways you can do this. If the onchange listener
is a function set via the element.onchange property and you're not
bothered about the event object or bubbling/propagation, the easiest
method is to just call that function:
element.onchange();
If you need it to simulate the real event in full, or if you set the
event via the html attribute or addEventListener/attachEvent, you
need to do a bit of feature detection to correctly fire the event:
if ("createEvent" in document) {
var evt = document.createEvent("HTMLEvents");
evt.initEvent("change", false, true);
element.dispatchEvent(evt);
}
else
element.fireEvent("onchange");
|
Change type of transition when switching view controllers programatically |
You can set the modalTransitionStyle
secondViewController.modalTransitionStyle =
UIModalTransitionStyleCrossDissolve;
If that doesn't work, try
self.modalTransitionStyle = UIModalTransitionStyleCrossDissolve;
|
How to change Windows 7 Aero / Window border color programatically? |
Maybe you could contact the developer of this small application. Ask how he
did it.. i'm not sure he used C# to accomplish this. But it's worth a shot.
This is my final search, I couldn't find anything else usefull so...
|
how to convert .cer to .pfx programatically using Java |
Look at the Java KeyStore class, and how to get an instance of it with the
PKCS12 keystore type.
Then look at the setKeyEntry() and store(). That should give you a very
good start to achieving your goal.
|
My Java version is the newest version but my JVM is still 1.5? |
What does this site say?
http://www.java.com/en/download/uninstallapplet.jsp
You should probably look for version 1.7, not 1.6. (That's more current)
If you have an older version of Java, go here:
http://java.com/en/download/index.jsp
|
Android to set/change/remove Lock Screen PIN, Password or Unlock Pattern programatically |
Caused by: java.lang.SecurityException: No active admin
ComponentInfo{dilli.passwordtest/dilli.passwordtest.MainActivity}
In order to modify device administrator settings, your app has to be
approved by the user as a device administrator. You need to have
implemented a DeviceAdminReceiver with the appropriate policies, and the
user has to have gone into the security screen in Settings and activated
your application as a device administration app.
|
Programatically getting a screenshot of a Java applet |
Have you tried using java.awt.Robot?
Rectangle rect = yourGragphicsConfiguration.getBounds();
BufferedImage image = new Robot().createScreenCapture(rect);
If you know the position of your applet you might be able to get it with
BufferedImage dest = image.getSubimage(appletX, appletY, appletHeight,
appletWidth);
|
Android how to programatically create scrollview and add programatically created views into it |
You probably do not want to use a horizontalscroll view to create "pages".
Try looking at PageViewer
This automatically builds in all the sywpe and inflating logic for you.
Basically you will get a call to inflate a certain page. There you can then
create your view (dynamically if you wish) and then just return the root to
be rendered.
|
Delete Excel rows programatically using Java |
Perhaps using a VBA macro would be more helpful in this situation? VBA
macros can be embedded into your spreadsheet, so running them could be a
lot easier.
Here is a good place to get started with VBA:
http://msdn.microsoft.com/en-us/library/office/ee814737(v=office.14).aspx
|
How would i create an ActiveMQ Producer programatically in Java for Mule? |
Get a connection factory a go from there:
Connection connection =
amqConnector.getConnectionFactory().createConnection();
Session session = connection.createSession(false,
Session.AUTO_ACKNOWLEDGE);
Queue queue = session.createQueue("yourQueue");
MessageProducer producer = session.createProducer(queue);
...
Don't worry about session.createQueue: it's not going to re-create the
existing queue, it's just going to use it.
|
java.util.NoSuchElementException while starting an OSGi framework programatically |
Service Loader searches the classpath for the interface you have asked for
-- in this case FrameworkFactory. To fix it you need to put an OSGi
Framework implementation on the classpath.
For example if you choose Felix, make sure that
org.apache.felix.framework-<version>.jar is present on the classpath
when you launch your application.
|
Can a Java Factory class be structured to instantiate either Java 6 or Java 7 specific class based on JVM version? |
You can do this without having to worry about the versions. You can even
build the "Java 7" to run on Java 6, but won't work because it needs
classes which are not there. i.e. you can have one JAR which runs in Java 6
for them all. Also you don't need to use reflection.
|
java.lang.VerifyError when deploying the new version of my Java EE web application |
Judging from what I'm seeing in your stack trace, I believe the application
is unable to connect to the database or an LDAP. This causes the
autowiring of one of the beans to fail which then cascades over into the
other beans.
Ensure that the application can properly connect to any external resources
required by the beans.
|
How to change Tomcats JVM version? |
Navigate to the directory where Tomcat is installed, and go into the in
folder (/tomcat/bin). Right-click the file catalina.bat, and then select
Edit
Scroll down in the code until you pass the end of the beginning “rem”
comments, and insert the following code pointing to your JDK’s root
directory:
set JAVA_HOME=/opt/Oracle_Java/jdk1.7.0_21
Save your changes, and restart Tomcat.
|
Change version of a dependent gem |
Just specify the version of the faraday-stack gem in your Gemfile before
gem A or B.
gem 'faraday-stack', '0.1.5'
gem 'A'
gem 'B'
I believe this is pretty much a duplicate of this question.
|
Why can't I change my Ruby version using RVM? |
Are you in the same session where you invoke: rvm --default use 1.9.2-p290
and ruby -v?
Please take a look at the answer here for detailed explanation: Why do I
need to use "rvm use default" after opening new terminal window?
|
Cannot change org.springframework-version in STS |
Solved -
http://www.captaindebug.com/2013/03/creating-spring-32-mvc-web-app.html#.Uf7V-WTbrus
- quoting the author - Now, I could have used the fix outlined in my
previous blog; however, the Guys at Spring have been busy and now the
solution to this problem is to simply upgrade to Spring version
3.2.2-RELEASE
|
iOS App - Change Version Number Scheme |
I don't think the Apple cares the format of the version number. I started
with 1.0.0 then switched to 1.1 and then released 1.52. As long as the
version number is different it is fine. Check out google chrome versions
they always have weird version numbers
|
How to change the version of a compilation unit? |
I've compiled the library with g++ (instead of gcc) which resulted in the
desired compilation unit. However, this still resulted in the DWARF error
thrown by gdb and so I compiled the latest version of gdb on the machine
and finally it works now.
|