Search Results

Search found 12222 results on 489 pages for 'initial context'.

Page 23/489 | < Previous Page | 19 20 21 22 23 24 25 26 27 28 29 30  | Next Page >

  • jQuery - Why editable-select list plugin doesn't work with latest jQuery?

    - by Binyamin
    Why editable-select list plugin<select><option>value</option>doesn't work with latest jQuery? editable-select code: /** * Copyright (c) 2009 Anders Ekdahl (http://coffeescripter.com/) * Dual licensed under the MIT (http://www.opensource.org/licenses/mit-license.php) * and GPL (http://www.opensource.org/licenses/gpl-license.php) licenses. * * Version: 1.3.1 * * Demo and documentation: http://coffeescripter.com/code/editable-select/ */ (function($) { var instances = []; $.fn.editableSelect = function(options) { var defaults = { bg_iframe: false, onSelect: false, items_then_scroll: 10, case_sensitive: false }; var settings = $.extend(defaults, options); // Only do bg_iframe for browsers that need it if(settings.bg_iframe && !$.browser.msie) { settings.bg_iframe = false; }; var instance = false; $(this).each(function() { var i = instances.length; if(typeof $(this).data('editable-selecter') == 'undefined') { instances[i] = new EditableSelect(this, settings); $(this).data('editable-selecter', i); }; }); return $(this); }; $.fn.editableSelectInstances = function() { var ret = []; $(this).each(function() { if(typeof $(this).data('editable-selecter') != 'undefined') { ret[ret.length] = instances[$(this).data('editable-selecter')]; }; }); return ret; }; var EditableSelect = function(select, settings) { this.init(select, settings); }; EditableSelect.prototype = { settings: false, text: false, select: false, wrapper: false, list_item_height: 20, list_height: 0, list_is_visible: false, hide_on_blur_timeout: false, bg_iframe: false, current_value: '', init: function(select, settings) { this.settings = settings; this.select = $(select); this.text = $('<input type="text">'); this.text.attr('name', this.select.attr('name')); this.text.data('editable-selecter', this.select.data('editable-selecter')); // Because we don't want the value of the select when the form // is submitted this.select.attr('disabled', 'disabled'); var id = this.select.attr('id'); if(!id) { id = 'editable-select'+ instances.length; }; this.text.attr('id', id); this.text.attr('autocomplete', 'off'); this.text.addClass('editable-select'); this.select.attr('id', id +'_hidden_select'); this.initInputEvents(this.text); this.duplicateOptions(); this.positionElements(); this.setWidths(); if(this.settings.bg_iframe) { this.createBackgroundIframe(); }; }, duplicateOptions: function() { var context = this; var wrapper = $(document.createElement('div')); wrapper.addClass('editable-select-options'); var option_list = $(document.createElement('ul')); wrapper.append(option_list); var options = this.select.find('option'); options.each(function() { if($(this).attr('selected')) { context.text.val($(this).val()); context.current_value = $(this).val(); }; var li = $('<li>'+ $(this).val() +'</li>'); context.initListItemEvents(li); option_list.append(li); }); this.wrapper = wrapper; this.checkScroll(); }, checkScroll: function() { var options = this.wrapper.find('li'); if(options.length > this.settings.items_then_scroll) { this.list_height = this.list_item_height * this.settings.items_then_scroll; this.wrapper.css('height', this.list_height +'px'); this.wrapper.css('overflow', 'auto'); } else { this.wrapper.css('height', 'auto'); this.wrapper.css('overflow', 'visible'); }; }, addOption: function(value) { var li = $('<li>'+ value +'</li>'); var option = $('<option>'+ value +'</option>'); this.select.append(option); this.initListItemEvents(li); this.wrapper.find('ul').append(li); this.setWidths(); this.checkScroll(); }, initInputEvents: function(text) { var context = this; var timer = false; $(document.body).click( function() { context.clearSelectedListItem(); context.hideList(); } ); text.focus( function() { // Can't use the blur event to hide the list, because the blur event // is fired in some browsers when you scroll the list context.showList(); context.highlightSelected(); } ).click( function(e) { e.stopPropagation(); context.showList(); context.highlightSelected(); } ).keydown( // Capture key events so the user can navigate through the list function(e) { switch(e.keyCode) { // Down case 40: if(!context.listIsVisible()) { context.showList(); context.highlightSelected(); } else { e.preventDefault(); context.selectNewListItem('down'); }; break; // Up case 38: e.preventDefault(); context.selectNewListItem('up'); break; // Tab case 9: context.pickListItem(context.selectedListItem()); break; // Esc case 27: e.preventDefault(); context.hideList(); return false; break; // Enter, prevent form submission case 13: e.preventDefault(); context.pickListItem(context.selectedListItem()); return false; }; } ).keyup( function(e) { // Prevent lots of calls if it's a fast typer if(timer !== false) { clearTimeout(timer); timer = false; }; timer = setTimeout( function() { // If the user types in a value, select it if it's in the list if(context.text.val() != context.current_value) { context.current_value = context.text.val(); context.highlightSelected(); }; }, 200 ); } ).keypress( function(e) { if(e.keyCode == 13) { // Enter, prevent form submission e.preventDefault(); return false; }; } ); }, initListItemEvents: function(list_item) { var context = this; list_item.mouseover( function() { context.clearSelectedListItem(); context.selectListItem(list_item); } ).mousedown( // Needs to be mousedown and not click, since the inputs blur events // fires before the list items click event function(e) { e.stopPropagation(); context.pickListItem(context.selectedListItem()); } ); }, selectNewListItem: function(direction) { var li = this.selectedListItem(); if(!li.length) { li = this.selectFirstListItem(); }; if(direction == 'down') { var sib = li.next(); } else { var sib = li.prev(); }; if(sib.length) { this.selectListItem(sib); this.scrollToListItem(sib); this.unselectListItem(li); }; }, selectListItem: function(list_item) { this.clearSelectedListItem(); list_item.addClass('selected'); }, selectFirstListItem: function() { this.clearSelectedListItem(); var first = this.wrapper.find('li:first'); first.addClass('selected'); return first; }, unselectListItem: function(list_item) { list_item.removeClass('selected'); }, selectedListItem: function() { return this.wrapper.find('li.selected'); }, clearSelectedListItem: function() { this.wrapper.find('li.selected').removeClass('selected'); }, pickListItem: function(list_item) { if(list_item.length) { this.text.val(list_item.text()); this.current_value = this.text.val(); }; if(typeof this.settings.onSelect == 'function') { this.settings.onSelect.call(this, list_item); }; this.hideList(); }, listIsVisible: function() { return this.list_is_visible; }, showList: function() { this.wrapper.show(); this.hideOtherLists(); this.list_is_visible = true; if(this.settings.bg_iframe) { this.bg_iframe.show(); }; }, highlightSelected: function() { var context = this; var current_value = this.text.val(); if(current_value.length < 0) { if(highlight_first) { this.selectFirstListItem(); }; return; }; if(!context.settings.case_sensitive) { current_value = current_value.toLowerCase(); }; var best_candiate = false; var value_found = false; var list_items = this.wrapper.find('li'); list_items.each( function() { if(!value_found) { var text = $(this).text(); if(!context.settings.case_sensitive) { text = text.toLowerCase(); }; if(text == current_value) { value_found = true; context.clearSelectedListItem(); context.selectListItem($(this)); context.scrollToListItem($(this)); return false; } else if(text.indexOf(current_value) === 0 && !best_candiate) { // Can't do return false here, since we still need to iterate over // all list items to see if there is an exact match best_candiate = $(this); }; }; } ); if(best_candiate && !value_found) { context.clearSelectedListItem(); context.selectListItem(best_candiate); context.scrollToListItem(best_candiate); } else if(!best_candiate && !value_found) { this.selectFirstListItem(); }; }, scrollToListItem: function(list_item) { if(this.list_height) { this.wrapper.scrollTop(list_item[0].offsetTop - (this.list_height / 2)); }; }, hideList: function() { this.wrapper.hide(); this.list_is_visible = false; if(this.settings.bg_iframe) { this.bg_iframe.hide(); }; }, hideOtherLists: function() { for(var i = 0; i < instances.length; i++) { if(i != this.select.data('editable-selecter')) { instances[i].hideList(); }; }; }, positionElements: function() { var offset = this.select.offset(); offset.top += this.select[0].offsetHeight; this.select.after(this.text); this.select.hide(); this.wrapper.css({top: offset.top +'px', left: offset.left +'px'}); $(document.body).append(this.wrapper); // Need to do this in order to get the list item height this.wrapper.css('visibility', 'hidden'); this.wrapper.show(); this.list_item_height = this.wrapper.find('li')[0].offsetHeight; this.wrapper.css('visibility', 'visible'); this.wrapper.hide(); }, setWidths: function() { // The text input has a right margin because of the background arrow image // so we need to remove that from the width var width = this.select.width() + 2; var padding_right = parseInt(this.text.css('padding-right').replace(/px/, ''), 10); this.text.width(width - padding_right); this.wrapper.width(width + 2); if(this.bg_iframe) { this.bg_iframe.width(width + 4); }; }, createBackgroundIframe: function() { var bg_iframe = $('<iframe frameborder="0" class="editable-select-iframe" src="about:blank;"></iframe>'); $(document.body).append(bg_iframe); bg_iframe.width(this.select.width() + 2); bg_iframe.height(this.wrapper.height()); bg_iframe.css({top: this.wrapper.css('top'), left: this.wrapper.css('left')}); this.bg_iframe = bg_iframe; } }; })(jQuery); $(function() { $('.editable-select').editableSelect( { bg_iframe: true, onSelect: function(list_item) { alert('List item text: '+ list_item.text()); // 'this' is a reference to the instance of EditableSelect // object, so you have full access to everything there // alert('Input value: '+ this.text.val()); }, case_sensitive: false, // If set to true, the user has to type in an exact // match for the item to get highlighted items_then_scroll: 10 // If there are more than 10 items, display a scrollbar } ); var select = $('.editable-select:first'); var instances = select.editableSelectInstances(); // instances[0].addOption('Germany, value added programmatically'); });

    Read the article

  • Are there any other causes of this error that are NOT related to initial setup?

    - by LordScree
    I'm trying to diagnose an issue at a customer site. They are receiving the following error: A network-related or instance-specific error occurred while establishing a connection to SQL Server I've seen this a few times, but only during the initial setup - it's often caused by one of the following: The database server is turned off The network connection between the database server and the application is closed or somehow blocked (e.g. a firewall) The SQL Server instance is not set up to receive remote connections from the application server (e.g. TCP is turned off, remote connections are disabled, or the "SQL Server Browser" service is stopped/disabled) However, if I assume that no configuration changes have been made, I'm trying to postulate on what the reason might be for getting this error at a random point after the initial setup. My initial thought is: SQL Server machine has run out of resources (e.g. RAM) and is unable to accept new requests from the application server Is this a valid theory? What other possible causes are there of this error that are not related to the initial setup of the server / application connection? Or is it simply impossible that this error could occur without a configuration change having been made (either on the SQL Server side, application side, or somewhere in-between (network))? NOTE: I believe this question differs from the plethora of questions related to this error message because the application and server have been talking to each other quite happily until now (most, if not all, other questions seem to relate to initial setup).

    Read the article

  • Set the JAXB context factory initialization class to be used

    - by user1902288
    I have updated our projects (Java EE based running on Websphere 8.5) to use a new release of a company internal framework (and Ejb 3.x deployment descriptors rather than the 2.x ones). Since then my integration Tests fail with the following exception: [java.lang.ClassNotFoundException: com.ibm.xml.xlxp2.jaxb.JAXBContextFactory] I can build the application with the previous framework release and everything works fine. While debugging i noticed that within the ContextFinder (javax.xml.bind) there are two different behaviours: Previous Version (Everything works just fine): None of the different places brings up a factory class so the default factory class gets loaded which is com.sun.xml.internal.bind.v2.ContextFactory (defined as String constant within the class). Upgraded Version (ClassNotFound): There is a resource "META-INF/services/javax.xml.bind.JAXBContext" beeing loaded successfully and the first line read makes the ContextFinder attempt to load "com.ibm.xml.xlxp2.jaxb.JAXBContextFactory" which causes the error. I now have two questions: What sort is that resource? Because inside our EAR there is two WARs and none of those two contains a folder services in its META-INF directory. Where could that value be from otherwise? Because a filediff showed me no new or changed properties files. No need to say i am going to read all about the JAXB configuration possibilities but if you have first insights on what could have gone wrong or help me out with that resource (is it a real file i have to look for?) id appreciate a lot. Many Thanks! EDIT (according to comments Input/Questions): Out of curiosity, does your framework include JAXB JARs? Did the old version of your framework include jaxb.properties? Indeed (i am a bit surprised) the framework has a customized eclipselink-2.4.1-.jar inside the EAR that includes both a JAXB implementation and a jaxb.properties file that shows the following entry in both versions (the one that finds the factory as well as in the one that throws the exception): javax.xml.bind.context.factory=org.eclipse.persistence.jaxb.JAXBContextFactory I think this is has nothing to do with the current issue since the jar stayed exactly the same in both EARs (the one that runs/ the one with the expection) It's also not clear to me why the old version of the framework was ever selecting the com.sun implementation There is a class javax.xml.bind.ContextFinder which is responsible for initializing the JAXBContextFactory. This class searches various placess for the existance of a jaxb.properties file or a "javax.xml.bind.JAXBContext" resource. If ALL of those places dont show up which Context Factory to use there is a deault factory loaded which is hardcoded in the class itself: private static final String PLATFORM_DEFAULT_FACTORY_CLASS = "com.sun.xml.internal.bind.v2.ContextFactory"; Now back to my problem: Building with the previous version of the framework (and EJB 2.x deployment descriptors) everything works fine). While debugging i can see that there is no configuration found and thatfore above mentioned default factory is loaded. Building with the new version of the framework (and EJB 3.x deployment descriptors so i can deploy) ONLY A TESTCASE fails but the rest of the functionality works (like i can send requests to our webservice and they dont trigger any errors). While debugging i can see that there is a configuration found. This resource is named "META-INF/services/javax.xml.bind.JAXBContext". Here are the most important lines of how this resource leads to the attempt to load 'com.ibm.xml.xlxp2.jaxb.JAXBContextFactory' which then throws the ClassNotFoundException. This is simplified source of the mentioned javax.xml.bind.ContextFinder class: URL resourceURL = ClassLoader.getSystemResource("META-INF/services/javax.xml.bind.JAXBContext"); BufferedReader r = new BufferedReader(new InputStreamReader(resourceURL.openStream(), "UTF-8")); String factoryClassName = r.readLine().trim(); The field factoryClassName now has the value 'com.ibm.xml.xlxp2.jaxb.JAXBContextFactory' (The day i understand how to format source code on stackoverflow will be my biggest step ahead.... sorry for the formatting after 20 mins it still looks the same :() Because this has become a super lager question i will also add a bounty :)

    Read the article

  • Atomikos rollback doesn't clear JPA persistence context?

    - by HDave
    I have a Spring/JPA/Hibernate application and am trying to get it to pass my Junit integration tests against H2 and MySQL. Currently I am using Atomikos for transactions and C3P0 for connection pooling. Despite my best efforts my DAO integration one of the tests is failing with org.hibernate.NonUniqueObjectException. In the failing test I create an object with the "new" operator, set the ID and call persist on it. @Test @Transactional public void save_UserTestDataNewObject_RecordSetOneLarger() { int expectedNumberRecords = 4; User newUser = createNewUser(); dao.persist(newUser); List<User> allUsers = dao.findAll(0, 1000); assertEquals(expectedNumberRecords, allUsers.size()); } In the previous testmethod I do the same thing (createNewUser() is a helper method that creates an object with the same ID everytime). I am sure that creating and persisting a second object with the same Id is the cause, but each test method is in own transaction and the object I created is bound to a private test method variable. I can even see in the logs that Spring Test and Atomikos are rolling back the transaction associated with each test method. I would have thought the rollback would have also cleared the persistence context too. On a hunch, I added an a call to dao.clear() at the beginning of the faulty test method and the problem went away!! So rollback doesn't clear the persistence context??? If not, then who does?? My EntityManagerFactory config is as follows: <bean id="myappTestLocalEmf" class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean"> <property name="persistenceUnitName" value="myapp-core" /> <property name="persistenceUnitPostProcessors"> <bean class="com.myapp.core.persist.util.JtaPersistenceUnitPostProcessor"> <property name="jtaDataSource" ref="myappPersistTestJdbcDataSource" /> </bean> </property> <property name="jpaVendorAdapter"> <bean class="org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter"> <property name="showSql" value="true" /> <property name="database" value="$DS{hibernate.database}" /> <property name="databasePlatform" value="$DS{hibernate.dialect}" /> </bean> </property> <property name="jpaProperties"> <props> <prop key="hibernate.transaction.factory_class">com.atomikos.icatch.jta.hibernate3.AtomikosJTATransactionFactory</prop> <prop key="hibernate.transaction.manager_lookup_class">com.atomikos.icatch.jta.hibernate3.TransactionManagerLookup</prop> <prop key="hibernate.connection.autocommit">false</prop> <prop key="hibernate.format_sql">true"</prop> <prop key="hibernate.use_sql_comments">true</prop> </property> </bean>

    Read the article

  • WPF MVVM TreeView item source losing context after command

    - by user3955716
    I have a treeview which contains files, every view model holds an item source which is an ObservableCollection with files items: public ObservableCollection<CMItemFileNode> SubItemNode On each item i have context menu options (Delete, Execute..). If i move from one viewModel to another the ObservableCollection of files updated correctly and presented correctly but, when i perform a context menu command like delete file item, the command execute good but when i move to another view model (which holds SubItemNode ObservableCollection of is own) after the command executed the WPF still thinks i'm in the last view model i was in and not the one i'm really on. Very important to mention is that when i update to .net 4.5 (which unfortunantly i can't do) everything is ok and the ObservableCollection addresses the correct view model. Here is the treeView: <TreeView x:Name="Files" Margin="0,5,5,0" Grid.Row="6" Grid.Column="2" ItemsSource="{Binding SubItemNode}" HorizontalAlignment="Stretch" HorizontalContentAlignment="Stretch" VerticalAlignment="Stretch" Height="300" Grid.RowSpan="6" Width="300" dd:DragDrop.IsDragSource="True" dd:DragDrop.IsDropTarget="True" dd:DragDrop.DropHandler="{Binding}" dd:DragDrop.UseDefaultDragAdorner="True"> <TreeView.Resources> <Style TargetType="{x:Type TreeView}"> <Setter Property="local:CMTreeViewFilesBehavior.IsTreeViewFilesBehavior" Value="True"/> </Style> <Style TargetType="{x:Type TreeViewItem}"> <Setter Property="IsSelected" Value="{Binding IsSelected}" /> <Setter Property="local:CMTreeViewFilesItemBehavior.IsTreeViewFilesItemBehavior" Value="True"/> </Style> <SolidColorBrush x:Key="{x:Static SystemColors.HighlightBrushKey}" Color="Transparent" /> <SolidColorBrush x:Key="{x:Static SystemColors.HighlightTextBrushKey}" Color="Black" /> </TreeView.Resources> <TreeView.ContextMenu> <ContextMenu> <MenuItem Header="View File" Command="{Binding ExecuteFileCommand}" /> <Separator /> <MenuItem Header="Delete all" Command="{Binding DeleteAllFilesCommand}" /> <MenuItem Header="Delete selected" Command="{Binding DeleteSelectedFilesCommand}" /> </ContextMenu> </TreeView.ContextMenu> <TreeView.ItemTemplate> <HierarchicalDataTemplate ItemsSource="{Binding SubItemNode}" > <Grid> <Grid.ColumnDefinitions> <ColumnDefinition Width="Auto"/> <ColumnDefinition Width="*"/> </Grid.ColumnDefinitions> <Image Grid.Column="0" Margin="2" Width="32" Height="18" Source="{Binding Path=Icon}" HorizontalAlignment="Left" VerticalAlignment="Center" /> <TextBlock Text="{Binding Path=Name}" Grid.Column="1" Margin="2" VerticalAlignment="Center" Foreground="{Binding Path=Status, Converter={StaticResource ItemFileStatusToColor}}" FontWeight="{Binding Path=IsSelected, Converter={StaticResource BoolToFontWidth}}"/> </Grid> </HierarchicalDataTemplate> </TreeView.ItemTemplate> </TreeView> Am I doing somthing wrong? and why in .net 4.5 it works well ?

    Read the article

  • How can we change color of a text programmatically ?

    - by user297535
    My code is -(UIImage *)addText:(UIImage *)img text:(NSString *)text1{ int w = img.size.width; int h = img.size.height; CGColorSpaceRef colorSpace = CGColorSpaceCreateDeviceRGB(); CGContextRef context = CGBitmapContextCreate(NULL, w, h, 8, 4 * w, colorSpace, kCGImageAlphaPremultipliedFirst); CGContextDrawImage(context, CGRectMake(0, 0, w, h), img.CGImage); CGContextSetRGBFillColor(context, 0.0, 0.0, 1.0, 1); char* text = (char *)[text1 cStringUsingEncoding:NSASCIIStringEncoding]; CGContextSelectFont(context, "Arial", 18, kCGEncodingMacRoman); CGContextSetTextDrawingMode(context, kCGTextFill); CGContextSetRGBFillColor(context, 255, 255, 255, 2); CGContextShowTextAtPoint(context, 10, 170, text, strlen(text)); CGImageRef imageMasked = CGBitmapContextCreateImage(context); CGContextRelease(context); CGColorSpaceRelease(colorSpace); return [UIImage imageWithCGImage:imageMasked]; } -(UIImage *)addText:(UIImage *)img text:(NSString *)text1{ int w = img.size.width; int h = img.size.height; CGColorSpaceRef colorSpace = CGColorSpaceCreateDeviceRGB(); CGContextRef context = CGBitmapContextCreate(NULL, w, h, 8, 4 * w, colorSpace, kCGImageAlphaPremultipliedFirst); CGContextDrawImage(context, CGRectMake(0, 0, w, h), img.CGImage); CGContextSetRGBFillColor(context, 0.0, 0.0, 1.0, 1); char* text = (char *)[text1 cStringUsingEncoding:NSASCIIStringEncoding]; CGContextSelectFont(context, "Arial", 18, kCGEncodingMacRoman); CGContextSetTextDrawingMode(context, kCGTextFill); CGContextSetRGBFillColor(context, 255, 255, 255, 2); CGContextShowTextAtPoint(context, 10, 170, text, strlen(text)); CGImageRef imageMasked = CGBitmapContextCreateImage(context); CGContextRelease(context); CGColorSpaceRelease(colorSpace); return [UIImage imageWithCGImage:imageMasked]; } How can we change the color of the text programmatically? Answers will be greatly appreciated!

    Read the article

  • How can I make TextToSpeech to speak a text with max volume and restore original volume after speak end?

    - by HelloCW
    I save the current volume both STREAM_RING and STREAM_MUSIC before sTts.get().speak(s, TextToSpeech.QUEUE_ADD, null), I hope the TextToSpeech can speak a text with max volume, but in fact I find the TextToSpeech speak the text with current volume, it seems that sTts.get().speak is asynchronous. How can I make TextToSpeech to speak a text with max volume and restore original volume after speak end? Thanks! public class SpeechTxt { private static SoftReference<TextToSpeech> sTts; public static void SpeakOut(final Context context, final String s) { final Context appContext = context.getApplicationContext(); if (sTts == null) { sTts = new SoftReference<TextToSpeech>(new TextToSpeech(appContext, new TextToSpeech.OnInitListener() { @Override public void onInit(int status) { if (status == TextToSpeech.SUCCESS) { speak(appContext, s); } else { } } })); } else { speak(appContext, s); } } private static void speak(Context context, String s) { if (sTts != null) { switch (sTts.get().setLanguage(Locale.getDefault())) { case TextToSpeech.LANG_COUNTRY_AVAILABLE: case TextToSpeech.LANG_COUNTRY_VAR_AVAILABLE: case TextToSpeech.LANG_AVAILABLE: { sTts.get().setPitch((float) 0.6); sTts.get().setSpeechRate((float) 0.8); int currentRing=PublicParFun.GetCurrentVol(context, AudioManager.STREAM_RING); int currentPlay=PublicParFun.GetCurrentVol(context, AudioManager.STREAM_MUSIC); PublicParFun.SetRingVol(context, 0); PublicParFun.SetPlayVol(context,1000000); sTts.get().speak(s, TextToSpeech.QUEUE_ADD, null); PublicParFun.SetRingVol(context, currentRing); PublicParFun.SetPlayVol(context,currentPlay); break; } case TextToSpeech.LANG_MISSING_DATA: { break; } case TextToSpeech.LANG_NOT_SUPPORTED: // not much to do here } } } public static int GetCurrentVol(Context myContext,int streamType){ AudioManager mAudioManager = (AudioManager)myContext.getSystemService(Context.AUDIO_SERVICE); int current = mAudioManager.getStreamVolume( streamType); return current; } public static void SetRingVol(Context myContext,int vol){ SetVol(myContext,AudioManager.STREAM_RING, vol); } public static void SetPlayVol(Context myContext,int vol){ SetVol(myContext,AudioManager.STREAM_MUSIC, vol); } private static void SetVol(Context myContext,int streamType,int vol){ AudioManager mAudioManager = (AudioManager)myContext.getSystemService(Context.AUDIO_SERVICE); int max = mAudioManager.getStreamMaxVolume(streamType); if (vol>max){ vol=max; } mAudioManager.setStreamVolume(streamType,vol, 0); } }

    Read the article

  • Copying the bitmap contents of a UIView's context to that of another UIView

    - by Joonas Trussmann
    Basically what I want to do is copy the already rendered content (a PDF drawn into the UIView's graphics context using CGContextDrawPDFPage()) onto a similar UIView, without having to re render the PDF. The idea is, that I'd then be able to perform an animated transform on the UIView and later re render the PDF with more accuracy. For both UIViews I'm using a larger-than-screen CATiledLayer to make it easier to rerender the PDF once the user zooms in, if that makes any difference. Any tips? I'm kind of lost here.

    Read the article

  • Device Driver IRQL and Thread/Context Switches

    - by Christian Hoglund
    Hi, I'm new to Windows device driver programming. I know that certain operations can only be performed at IRQL PASSIVE_LEVEL. For example, Microsoft have this sample code of how to write to a file from a kernel driver: if (KeGetCurrentIrql() != PASSIVE_LEVEL) return STATUS_INVALID_DEVICE_STATE; Status = ZwCreateFile(...); My question is this: What is preventing the IRQL from being raised after the KeGetCurrentIrql() check above? Say a context or thread swithch occurs, couldn't the IRQL suddenly be DISPATCH_LEVEL when it gets back to my driver which would then result in a system crash? If this is NOT possible then why not just check the IRQL in the DriverEntry function and be done with it once for all?

    Read the article

  • XML documentation to context sensitive help

    - by Yonas
    These days a number of commercial and open source tools have been developed for this purpose. However(unfortunately), non of them meet my requirement for specific problem I am dealing with. Currently, I am working on a project that exposes a different classes and functions to user as scripting interface. the user can use the objects from custom scripting interface and call methods to solve some specific problem. The problem I am facing is users of my classes need some sort of documentation in order to write their script efficiently. To address this problem am planing to use the compiler generated XML file to provide context sensitive help, which allows users to mouse over on any of the controls and corresponding methods from the GUI and read the reference documentation of the class/method. Now ... here are my questions: Can I get the sample source code? Can any one give me someone point me to some sort of best approach to address the problem?

    Read the article

  • Canvas context used but not updated on canvas

    - by John Doe
    I am developing an small html5 game, where I have the following code: if(object.blocks){ var blocks = object.blocks, that = this; each(blocks,function(index){ that.blocks.push(new Block(this[index])); }); } I receive an object with some configuration and instantiate blocks with it. It works fine, but the Block class has an method, called draw: this.draw = function (ctx){ if(ctx){ var colors = ['#FF0000','#FFFF00','#0000FF','#00FF00'], color = Math.round(Math.random() * colors.length-1); ctx.fillStyle = colors[color]; ctx.fillRect(this.x,this.y,this.width,this.height); } }; It was working before I moved it into the Block class, but now it draws nothing. This is the code that calls draw: render: function(ctx){ each(this.blocks,function(index){ this[index].draw(ctx); }); } The context comes from the html page, from the main canvas.

    Read the article

  • CGPDFContextCreateWithURL not correctly creating context

    - by mjdth
    Using the following code, the ctx is not correctly being created. It remains nil: #import <QuartzCore/QuartzCore.h> @implementation UIView(PDFWritingAdditions) - (void)renderInPDFFile:(NSString*)path { CGRect mediaBox = self.bounds; CGContextRef ctx = CGPDFContextCreateWithURL((CFURLRef)[NSURL URLWithString:path], &mediaBox, NULL); CGPDFContextBeginPage(ctx, NULL); CGContextScaleCTM(ctx, 1, -1); CGContextTranslateCTM(ctx, 0, -mediaBox.size.height); [self.layer renderInContext:ctx]; CGPDFContextEndPage(ctx); CFRelease(ctx); } @end In the console it shows: <Error>: CGPDFContextCreate: failed to create PDF context delegate. I've tried several different paths so I'm fairly certain that is not the problem. Thanks for any advice!

    Read the article

  • Application Context in Rails

    - by Sean McMains
    Rails comes with a handy session hash into which we can cram stuff to our heart's content. I would, however, like something like ASP's application context, which instead of sharing data only within a single session, will share it with all sessions in the same application. I'm writing a simple dashboard app, and would like to pull data every 5 minutes, rather than every 5 minutes for each session. I could, of course, store the cache update times in a database, but so far haven't needed to set up a database for this app, and would love to avoid that dependency if possible. So, is there any way to get (or simulate) this sort of thing? If there's no way to do it without a database, is there any kind of "fake" database engine that comes with Rails, runs in memory, but doesn't bother persisting data between restarts?

    Read the article

  • "Method definition not in @implementation context"?

    - by Nathan Hess
    I put this in X-code: - (void)viewDidLoad { [super viewDidLoad]; NSString *path = [[NSBundle mainBundle] pathForResource:@"DrinkArray" ofType:@"plist"]; NSMutableArray* tmpArray = [[NSMutableArray alloc] initWithContentsOfFile:path]; self.drinks = tmpArray; [tmpArray release]; // Uncomment the following line to display an Edit button in the navigation bar for this view controller. // self.navigationItem.rightBarButtonItem = self.editButtonItem; } And it says this on the first line: "Method Definition not an @implementation context" Could anyone help?

    Read the article

  • Blending Three Images into Graphics Context Using Alpha Blend Mode kBlendModeOverlay

    - by steganous
    Does kCGBlendModeOverlay not work exactly like Photoshop's Overlay blending mode? I'm trying to overlay three images into a graphic context via: [uiimageGreen drawAtPoint:CGPointMake(x, y) blendMode:kCGBlendModeOverlay alpha:1.0]; [uiimageRed drawAtPoint:CGPointMake(x, y) blendMode:kCGBlendModeOverlay alpha:1.0]; [uiimageBlue drawAtPoint:CGPointMake(x, y) blendMode:kCGBlendModeOverlay alpha:1.0]; In the end, if I overlay just two of the three, the result is much closer to my desired output color in places where both images intersect. Adding the third image, however, causes the first-drawn image's color to be dominant in the resulting mix of colors. (e.g. in the above code, green comes out dominant, when the result should actually be white) Do you get the same result if you try?

    Read the article

  • Which JavaScript MVC framework to use for wysiwyg editing and floating context-sensitive settings pa

    - by ernests
    I'm developing a cms that allows editing everything on the page (generated server-side with a template engine) by just clicking on it — the area turns into input field, textarea or a full-featured tinyMCE editor, Template defines editable elements like "page heading", "copyright footer text", "image", "rich text block" etc. Along with that there's always a flotaing panel with several tabs, some of which contain general settings like page bacground color, font settings etc, but some are context sensitive (e.g., the clicking on "image" editable field triggers to display uploading/cropping/captioning interface in the floating panel). All settings in the panel are either simple inputs or sliders or checkboxes. I'm new to using MVC with javascript, and in fact haven't used it much before. jQuery is used as code library for the project. Should i use JavascriptMVC, SproutCore or anything else? Does any of them allow some kind of sandboxing (within bounds of commmon sense) to allow some javascript code by user-generated skins on my cms? thank you!

    Read the article

  • imported function name is not visible in entities context

    - by ali moharrami
    hi I am working on silverlight application which uses EF. I am able to retrieve the data. But I want to execute a stored procedure which returns no value. I tried using Import function. and the function is created in DataModel.Designer.cs : public int ClearWorkflow(Nullable<global::System.Guid> processId) { ObjectParameter processIdParameter; if (processId.HasValue) { processIdParameter = new ObjectParameter("ProcessId", processId); } else { processIdParameter = new ObjectParameter("ProcessId",typeof(global::System.Guid)); } return base.ExecuteFunction("ClearWorkflow", processIdParameter); } But the function name is not visible in entities context while accessing in silverlight.

    Read the article

  • CSharpCodeProvider: Why is a result of compilation out of context when debugging

    - by epitka
    I have following code snippet that i use to compile class at the run time. //now compile the runner var codeProvider = new CSharpCodeProvider( new Dictionary<string, string>() { { "CompilerVersion", "v3.5" } }); string[] references = new string[] { "System.dll", "System.Core.dll", "System.Core.dll" }; CompilerParameters parameters = new CompilerParameters(); parameters.ReferencedAssemblies.AddRange(references); parameters.OutputAssembly = "CGRunner"; parameters.GenerateInMemory = true; parameters.TreatWarningsAsErrors = true; CompilerResults result = codeProvider.CompileAssemblyFromSource(parameters, template); Whenever I step through the code to debug the unit test, and I try to see what is the value of "result" I get an error that name "result" does not exist in current context. Why?

    Read the article

  • the name 'controlname' does not exist in the current context

    - by zohair
    Hi, I have a web application that I'm working on(ASP.NET2.0 with C#)[Using VS2005]. Everything was working fine, and all of a sudden I get the error: Error 1 The name 'Label1' does not exist in the current context and 43 others of the sort for each time that I used a control in my codebehind of the page. This is only happening for 1 page. And it's as if the codebehind isn't recognizing the controls. Another interesting thing is that the intellisense isn't picking up any of the controls either.. I have tried to clean the solution file, delete the obj file, exclude the files from the project then re-add them, close VS and restart it, and even restart my computer, but none of these have worked. Please Help. Thank you

    Read the article

  • Android: How to find the position clicked from the context menu

    - by Josemalive
    Hi, I have a list view filled with data. I set up a context menu for the listview using the following code: list.setOnCreateContextMenuListener ( new View.OnCreateContextMenuListener() { public void onCreateContextMenu(ContextMenu menu, View view, ContextMenu.ContextMenuInfo menuInfo) { AdapterContextMenuInfo mi =(AdapterContextMenuInfo) menuInfo; menu.add(0, 0, 0, "Delete item"); } } ); I have the following method override to control de contextmenu menuitem selected: @Override public boolean onContextItemSelected(MenuItem item) { switch(item.getItemId()) { case 0: ShowAlert("hello from delete item"); break; default: return super.onContextItemSelected(item); } return true; } In this overrided method, how could i find the item of the list view that was clicked? Thanks in advance. Best Regards. Jose

    Read the article

  • The node to be inserted is from a different document context

    - by BDotA
    When I am Calling AppendChild, I get this error: The node to be inserted is from a different document context." static public XmlNode XMLNewChildNode(XmlNode oParent, string sName, string sNamespaceURI, string sNodeType) { XmlNode oNode = moDoc.CreateNode(sNodeType, sName, sNamespaceURI); oParent.AppendChild(oNode); return oNode; } this is a code that is converted from its VB 6.0 version which was this: please ignore the optional parametes, I have overloads for them in C# version: Public Function XMLNewChildNode(ByVal oParent As IXMLDOMNode, ByVal sName As String, Optional ByVal sNamespaceURI As String = "", Optional ByVal sNodeType As String = "element") As IXMLDOMNode '**************** DESCRIPTION ******************* 'Create a new Child Node for passed Parent. '***************** VARIABLES ******************** Dim oNode As IXMLDOMNode '************************************************ Set oNode = moDoc.createNode(sNodeType, sName, sNamespaceURI) Call oParent.appendChild(oNode) Set XMLNewChildNode = oNode End Function so anything is different in VB 6.0 and C# for working with XMLs?

    Read the article

  • Context menu not firing when clicking on a line in a MovieClip

    - by Quandary
    Question: In Flash AS3, I have a furniture movieclip (converted from CAD) in another movieclip [to crop the border]. My first problem was that it didn't fire onclick at all. So I had to draw a background, and it started working when I did not click on a CAD drawing line. Then I checked mousevent.target for classname, and if it was not CustomMovieClip, I took object.parent.parent. That worked for onclick. But now I seem to have a similar problem with the contextmenu. When I right-click anywhere, I get the contextmenu, but the context menu event-handler doesn't fire if I right-clicked on a CAD line (but it works if I right-click on the background)... The problem now is it doesn't fire, so I can't take target.parent.parent.

    Read the article

  • how do I get the index of a firing context menu item

    - by fishhead
    I would like to determine the index of the selected context menu item. But I don't want to build a unique eventhandler for each menu item...how do I do this MenuItem mi= StatusContextMenu.MenuItems.Add("Set option"); mi.MenuItems.Add(0,new MenuItem("Set to A", new EventHandler(SetLetter)) ); mi.MenuItems.Add(1,new MenuItem("Set to B", new EventHandler(SetLetter))); mi.MenuItems.Add(2,new MenuItem("Set to C ", new EventHandler(SetLetter))); mi.MenuItems.Add(3,new MenuItem("Set to D", new EventHandler(SetLetter))); private void SetLetter(object sender, System.EventArgs e) { index = ???? } C#, .net 2.0

    Read the article

  • How to get site context/information during the PreapplicationStartMethod

    - by Mike
    When you run the same web based application as a multi-tenant application for different clients is there a way during the PreapplicationStartMethod to gain some kind of context to the site that is being started? More specifically I'd like to get the host header information (the "bindingInformation" attribute value from the applicationHost.config); I have found ways to get this information at the time of a specific request long after the application has started. Is there a way to get the information during the application startup process? This is an MVC 3 application and IIS 7.5.

    Read the article

  • Gaining application/module context from a symfony task

    - by Martin Chatterton
    I have written a reporting suite, and I have a specific report that builds a CSV file. Serving this file via a browser on demand isn't an issue, but I need to be able to build this CSV file nightly, and email round a link to be able to download it. Essentially, I need to be able to replace a specific action with a symfony task, run via cron. So how do I gain application/module context from a symfony task? And secondly, how would I invoke the SwiftMailer library from a symfony task? I'm using symfony v1.4.4 and PHP v.5.2.13. Thanks in advance for your help.

    Read the article

< Previous Page | 19 20 21 22 23 24 25 26 27 28 29 30  | Next Page >