Search Results

Search found 144 results on 6 pages for 'miguel ribeiro'.

Page 4/6 | < Previous Page | 1 2 3 4 5 6  | Next Page >

  • Guidelines of when to use locking

    - by miguel
    I would like to know if there are any guidelineswhich a developer should follow as to when (and where) to place locks. For instance: I understand that code such as this should be locked, to avoid the possibility of another thread changing the value of SomeHeapValue unexpectedly. class Foo { public SomeHeapObject myObject; public void DoSummat(object inputValue_) { myObject.SomeHeapValue = inputValue_; } } My question is, however, how deep does one go with the locking? For instance, if we have this code: class Foo { public SomeHeapObject myObject; public void DoSummat(object inputValue_) { myObject.SomeHeapValue = GetSomeHeapValue(); } } Should we lock in the DoSummat(...) method, or should we lock in the GetSomeHeapValue() method? Are there any guidelines that you all keep in mind when strcturing multi-threaded code?

    Read the article

  • HierarchicalDataTemplate Distinct leaves

    - by miguel
    I have a set of data that is structured like this: ItemA.GroupA ItemB.GroupA ItemC.GroupB ItemD.GroupC I need to present the data in a WPF Tree View like this: GroupA --- ItemA --- ItemB GroupB --- ItemC GroupC --- ItemD What XAML can I use to group the leaves by distinct value? For instance, there could be multple items in the collection which are GroupA.ItemA, however, I only want to present the node and leaf once.

    Read the article

  • jQuery attach function to 'load' event of an element

    - by Miguel Ping
    Hi, I want to attach a function to a jQuery element that fires whenever the element is added to the page. I've tried the following, but it didn't work: var el = jQuery('<h1>HI HI HI</H1>'); el.one('load', function(e) { window.alert('loaded'); }); jQuery('body').append(el); What I really want to do is to guarantee that another jQuery function that is expecting some #id to be at the page don't fail, so I want to call that function whenever my element is loaded in the page. To clarify, I am passing the el element to another library (in this case it's a movie player but it could be anything else) and I want to know when the el element is being added to the page, whether its my movie player code that it is adding the element or anyting else.

    Read the article

  • Thread Local Storage and local method variables

    - by miguel
    In c#, each thread has its own stack space. If this is the case, why is the following code not thread-safe? (It is stated that this code is thread-safe on this post: Locking in C# class Foo { private int count = 0; public void TrySomething() { count++; } } As count is an int (stack variable), surely this value would be isolated to an individual thread, on its own stack, and therefore thread-safe? I am probably missing something here, but I dont understand what is actually in Thread Local Storage if not stack-based variables for the thread?

    Read the article

  • How are DynamicResources built?

    - by miguel
    Are dynamic resources truly dynamic? If I define a DynamicResource, I realise that an expression is created (where?) that is not translated into a resource until runtime, however, What I do not understans is whether this dynamicresouce, once built, is now "Static" For instance, if I create a context menu via a dynamicresource, are the menuitems which are created at runtime on access then static, even if they are bound?

    Read the article

  • how to use font-faces in css file within spring 3

    - by miguel.angel
    I'm trying to use font-faces inside a style.css file. I have put my style font .ttf file into resources with Spring 3. When use font-faces i need to put the path to the .ttf file like this: @font-face{ font-family: NosiferCaps-Regular; src: url('../fonts/1942/1942.ttf'); } .myClass{ font:39px/1.2 NosiferCaps-Regular, verdana ; text-shadow:2px 2px 9px gray; } So, how do I refer to "src: url('../fonts/1942/1942.ttf')" inside a style.css file with Spring?

    Read the article

  • Spring & Hibernate EJB Events

    - by Miguel Ping
    Is it possible to define a spring-managed EJB3 hibernate listener? I have this definition in my persistence.xml: <properties> <property name="hibernate.ejb.interceptor" value="my.class.HibernateAuditInterceptor" /> <property name="hibernate.ejb.event.post-update" value="my.class.HibernateAuditTrailEventListener" /> </properties> But I would like to manage HibernateAuditInterceptor and HibernateAuditTrailEventListener with spring, so I can do some bean injection (ex: session-scoped bean) within these classes. Is this possible?

    Read the article

  • How are DynamicResources built? Use in contextmenus.

    - by miguel
    Are dynamic resources truly dynamic? If I define a DynamicResource, I realise that an expression is created (where?) that is not translated into a resource until runtime, however, What I do not understans is whether this dynamicresouce, once built, is now "Static" For instance, if I create a context menu via a dynamicresource, are the menuitems which are created at runtime on access then static, even if they are bound? If so, how can i create a dynamic context menu in XAML?

    Read the article

  • Site images don't refresh after setting expired headers on .htaccess

    - by Miguel Hernandez
    I have a site that uses a CSS sprite for all the images. I set the .htaccess file to set the expired headers to a future time as they recommend to improve site performance. However, when I updated the sprite image none of my browsers on two different computers seem to fetch the new image. I deleted the .htaccess serveral times but no luck. I am sure this must be easy as pie to fix but right now I am out of options. Here is the code inside my .htaccess file: # CONFIGURE media caching # Header unset ETag FileETag None <FilesMatch "(?i)^.*\.(ico|flv|jpg|jpeg|png|gif|js|css)$"> Header unset Last-Modified Header set Expires "Fri, 21 Dec 2012 00:00:00 GMT" Header set Cache-Control "public, no-transform" </FilesMatch> <IfModule mod_deflate.c> <FilesMatch "\.(js|css)$"> SetOutputFilter DEFLATE </FilesMatch> </IfModule> Thanks!

    Read the article

  • I can not get the text from a selected item in a listview...pleeeeasss help.

    - by Miguel
    I always get an ClassCastException error... i do not what else to do... - I'm using a data biding concept to populated the listview from a sqlite3 database. - I just want to get the selected item text after a long press click. This is the code of the activity: public class ItemConsultaGastos extends ListActivity { private DataHelper dh ; TextView seleccion; private static String[] FROM = {DataHelper.MES, DataHelper.ANO}; private static int[] TO = {R.id.columnaMes, R.id.columnaAno }; public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.muestrafechas); this.dh = new DataHelper(this); Cursor cursor = dh.selectAllMeses(); startManagingCursor(cursor); this.mostrarFechas(cursor); ListView lv = getListView(); lv.setOnItemLongClickListener(new OnItemLongClickListener(){ @Override public boolean onItemLongClick(AdapterView<?> arg0, View arg1,int row, long arg3) { //here is where i got the classCastException. String[] tmp = (String[]) arg0.getItemAtPosition(row); //tmp[0] ist the Text of the first TextView displayed by the clicked ListItem Log.w("Gastos: ", "El texto: " + tmp[0].toString()); return true; } }); } private void mostrarFechas(Cursor cursor) { SimpleCursorAdapter adapter = new SimpleCursorAdapter(this,R.layout.muestrafechasitem,cursor, FROM, TO); setListAdapter(adapter); } } ///// This is the xml where a define the rows to show on the listview <TextView android:id="@+id/espacio" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text=" " /> <TextView android:id="@+id/columnaAno" android:layout_width="wrap_content" android:layout_height="wrap_content" android:textSize="20sp" android:layout_toRightOf="@+id/espacio"/> <TextView android:id="@+id/separador1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text=" -- " android:layout_toRightOf="@+id/columnaAno" android:textSize="20sp" /> <TextView android:id="@+id/columnaMes" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_toRightOf="@+id/separador1" android:textSize="20sp"/>

    Read the article

  • Get a string sequence from a node-set in xpath 1.0

    - by Miguel
    I'm using xpath 1.0 to parse an html file and I want to get a string sequence from a node-set. First I select a node-set (eg: //div) and then I want the string-value of each node of the set. I've tried with string(//div) but it only returns the string-value of the first node in the set. Example <foo> <div> bbbb<p>aaa</p> </div> <div> cccc<p>aaa</p> </div> </foo> I expect a result like ('bbbbaaa', 'ccccaaa') but I only get 'bbbaaa'

    Read the article

  • Ember Data Sycn - LocalStorage+REST+RealTime+Online/Offline

    - by Miguel Madero
    We have a combination of requirements in terms o data access. Pre-load some reference data. We need reference data to survive browser restarts instead of just living in memory to avoid loading it all the time. I'm currently using the LocalStorageAdapter for that. Once we have it, we would like to sync changes (polling or using Socket.IO in the background and updating the LocalStorage could do the trick) There're other models that are more transactional, where we would need to directly go to the Server and get/save them. It would be nice to use something like the RESTAdapter for that. Lastly, there're some operations that should work off-line and changes should be synced later. To make it more concrete: * We pre-load vendor and "favorite products" into Local Storage. We work offline with those. * We need to sync server changes to vendor and product information. * If they search the full catalog, that requires them to be online. * When offline, we need to allow users to add something to their cart or even submit and order. We would like to queue this action and submit it when they have an Internet Connection. So a few questions are derived from this: * Is there a way to user RESTAdapter in combination with LocalStorage? * Is there some Socket.IO support? (Happy to do this part manually) * Is there Queueing support? Ideally at the Ember-Data level. I know we will have to do a lot of this manually and pull together the different lego pieces, but I wanted to ask for some perspective from experience Ember devs.

    Read the article

  • WebKit gets blank when clicking on the menu toolbar

    - by Miguel Ángel Ortuño
    Hi y'all. I've embebed a WebKit view into a modal dialog using Carbon and appereantly everything works fine. However there's a little problem. When I click on the menu toolbar the view gets completely blank getting visible only when I interact with it. Seems like the control stops reciving the 'paint window' event when I call MenuSelect function. All the events are managed by the parent window because of the nature of the application (videogame). Does anybody know what this behaviour is due to and how can I avoid it? Thanks for all.

    Read the article

  • How do I stop a bouncy JQuery animation?

    - by Miguel
    In a webapp I'm working on, I want to create some slider divs that will move up and down with mouseover & mouseout (respectively.) I currently have it implemented with JQuery's hover() function, by using animate() and reducing/increasing it's top css value as needed. This works fairly well, actually. The problem is that it tends to get stuck. If you move the mouse over it (especially near the bottom), and quickly remove it, it will slide up & down continuously and won't stop until it's completed 3-5 cycles. To me, it seems that the issue might have to do with one animation starting before another is done (e.g. the two are trying to run, so they slide back and forth.) Okay, now for the code. Here's the basic JQuery that I'm using: $('.slider').hover( /* mouseover */ function(){ $(this).animate({ top : '-=120' }, 300); }, /* mouseout*/ function(){ $(this).animate({ top : '+=120' }, 300); } ); I've also recreated the behavior in a JSFiddle. Any ideas on what's going on? :) ==EDIT== UPDATED JSFiddle

    Read the article

  • How can I intercept a Tomcat request at socket level?

    - by Miguel Pardal
    Hi, I'm doing a performance study for a web application framework running on Apache Tomcat 6. I'm trying to measure the time overhead of handling HTTP requests. What I would like to do is: / // just before first request byte is read long t1 = System.nanoTime(); // request is processed... // just after final byte is written to response long t2 = System.nanoTime(); / Then I would compute the total time (t2 - t1). Is there a way to do this? Thanks for your help!

    Read the article

  • Callbacks on GUI Thread

    - by miguel
    We have an external data provider which, in its construtor, takes a callback thread for returning data upon. There are some issues in the system which I am suspicious are related to threading, however, in theory they cannot be, due to the fact that the callbacks should all be returned on the same thread. My question is, does code like this require thread synchronisation? class Foo { ExternalDataProvider _provider; public Foo() { // This is the c'tor for the xternal data provider, taking a callback loop as param _provider = new ExternalDataProvider(UILoop); _provider.DataArrived += ExternalProviderCallbackMethod; } public ExternalProviderCallbackMethod() { var itemArray[] = new String[4] { "item1", "item2", "item3", "item4" }; for (int i = 0; i < itemArray.Length; i++) { string s = itemArray[i]; switch(s) { case "item1": DoItem1Action(); break; case "item2": DoItem2Action(); break; default: DoDefaultAction(); break; } } } } The issue is that, very infrequently, DoItem2Action is executingwhen DoItem1Action should be exectuing. Is it at all possible threading is at fault here? In theory, as all callbacks are arriving on the same thread, they should be serialized, right? So there should be no need for thread sync here?

    Read the article

  • What is the most efficient way of associating information with a Type in .Net?

    - by Miguel Angelo
    I want to associate custom data to a Type, and retrieve that data in run-time, blasingly fast. This is just my imagination, of my perfect world: var myInfo = typeof(MyClass).GetMyInformation(); this would be very fast... of course this does not exist! If it did I would not be asking. hehe ;) This is the way using custom attributes: var myInfo = typeof(MyClass).GetCustomAttribute("MyInformation"); this is slow because it requires a lookup of the string "MyInformation" This is a way using a Dictionary<Type, MyInformation: var myInfo = myInformationDictionary[typeof(MyClass)]; This is also slow because it is still a lookup of 'typeof(MyClass)'. I know that dictionary is very fast, but this is not enough... it is not as fast as calling a method. It is not even the same order of speed. I am not saying I want it to be as fast as a method call. I want to associate information with a type and access it as fast as possible. I am asking whether there is a better way, or event a best way of doing it. Any ideas?? Thanks!

    Read the article

  • All Callbacks on GUI Thread - Multithreading issues possible?

    - by miguel
    We have an external data provider which, in its construtor, takes a callback thread for returning data upon. There are some issues in the system which I am suspicious are related to threading, however, in theory they cannot be, due to the fact that the callbacks should all be returned on the same thread. My question is, does code like this require thread synchronisation? class Foo { ExternalDataProvider _provider; public Foo() { // This is the c'tor for the xternal data provider, taking a callback loop as param _provider = new ExternalDataProvider(UILoop); _provider.DataArrived += ExternalProviderCallbackMethod; } public ExternalProviderCallbackMethod(...) { //...(code omitted) var itemArray[] = new String[4] { "item1", "item2", "item3", "item4" }; for (int i = 0; i < itemArray.Length; i++) { string s = itemArray[i]; switch(s) { case "item1": DoItem1Action(); break; case "item2": DoItem2Action(); break; default: DoDefaultAction(); break; } //...(code omitted) } } } The issue is that, very infrequently, DoItem2Action is executingwhen DoItem1Action should be exectuing. Is it at all possible threading is at fault here? In theory, as all callbacks are arriving on the same thread, they should be serialized, right? So there should be no need for thread sync here?

    Read the article

  • setfirstresult & setmaxresult in child collection

    - by Miguel Marques
    I have and entity lets call it Entity, and a Child collection Children. I have a screen where the user has the Entity information, and a list with the Children collection, but that collection can be get very big, so i was thinking about using paging: get the first 20 elements, and lazy load the next only if the user explicitly presses the next button. So i created in the Entity Repository a function with this signature: IEnumerable<Child> GetChildren(Entity entity, int actualPage, int numberOfRecordsPerPage) I need to use the setfirstresult and setmaxresult, not in the Agregate root Entity, but in the child collection. But when i use those two configurations, they allways refer to the entity type of the HQL/Criteria query. Other alternative would be to create a HQL/Criteria query for the Child type, set the max and first result, then filter the ones who are in the Entity Children collection (by using subquery). But i wasn't able to do this filter. If it was a bidirectional association (Child refering the parent Entity) it would be easier. Any suggestions? Any

    Read the article

  • jQuery trigger custom event synchronously?

    - by Miguel Angelo
    I am using the jQuery trigger method to call an event... but it behaves inconsistently. Sometimes it call the event, sometimes it does not. <a href="#" onclick=" $(this).trigger('custom-event'); window.location.href = 'url'; return false; ">text</a> The custom-event has lots of listeners added to it. It is as if the trigger method is not synchronous, allowing the window.location.href be changed before executing the events. And when window.location.href is changed a navigation occurs, interrupting everything. How can I trigger events synchronously? Using jQuery 1.8.1. Thanks! EDIT I have found that the event, when called has a stack trace like this: jQuery.fx.tick (jquery-1.8.1.js:9021) tick (jquery-1.8.1.js:8499) jQuery.Callbacks.self.fireWith (jquery-1.8.1.js:1082) jQuery.Callbacks.fire (jquery-1.8.1.js:974) jQuery.speed.opt.complete (jquery-1.8.1.js:8991) $.customEvent (myfile.js:28) This proves that jQuery trigger method is asynchronous. Oohhh my... =\

    Read the article

  • Specify a OneWay Binding in HandleBars - Ember

    - by Miguel Madero
    Is there a way to Specify a OneWay Binding in HandleBars? bind-attr always calls Ember.bind, which always create a two way binding. This seems to be the case for elements that don't even change: <img {{bind-attr class=":class-name-to-always-apply"}}> But even in cases where the element could change, we might have reasons to update it manually (e.g. performance or we don't want to change it on textChanged, but do it manually)

    Read the article

  • DonXml does WCF in NYC

    - by gsusx
    Tomorrow is WCF day in New York city!!!!! My good friend and Tellago's CTO Don Demsak will be doing a session WCF Data and RIA Services at the WCF fire-starter event to be hosted at the Microsoft offices in New York city. Don has a encyclopedic knowledge of both technologies and will be sharing lots of best practices learned from applying these technologies in large service oriented environments. In addition to Don, my crazy Cuban friend Miguel Castro will also be presenting three sessions at the...(read more)

    Read the article

  • Final Notes from the ODF Plugfest in Granada

    <b>Zona-M:</b> "A representative of the Spanish Ministry of Presidency, Miguel Angel Amutio Gomez, started the day explaining the crucial points of the Spanish law 11/2007: the right for everybody to use whatever digital technology they like best and the obligation for all Public Administrations to avoid discrimination of citizens based on their technological choices."

    Read the article

< Previous Page | 1 2 3 4 5 6  | Next Page >