Search Results

Search found 421 results on 17 pages for 'luis yang'.

Page 12/17 | < Previous Page | 8 9 10 11 12 13 14 15 16 17  | Next Page >

  • Java multi Generic collection parameters complie error

    - by Geln Yang
    Hi, So strange!Please have a look the code first: public class A { } public class B extends A { } public class C extends A { } public class TestMain { public <T extends A> void test(T a, T b) { } public <T extends A> void test(List<T> a, List<T> b) { } public static void main(String[] args) { new TestMain().test(new B(), new C()); new TestMain().test(new ArrayList<B>(), new ArrayList<C>()); } } The statement "new TestMain().test(new ArrayList(), new ArrayList())" get a "Bound mismatch" compile error, while "new TestMain().test(new B(), new C())" is compiled ok. Bound mismatch: The generic method test(T, T) of type TestMain is not applicable for the arguments (ArrayList, ArrayList). The inferred type ArrayList is not a valid substitute for the bounded parameter It seems the type of the second generic List parameter is limited by the Type of the first.Is it a feature or a bug of the compile program? ps, jdk:1.6,IDE:Eclipse 3.5.1

    Read the article

  • What is a simple way to combine two Emacs major modes, or to change an existing mode?

    - by Winston C. Yang
    In Emacs, I'm working with a file that is a hybrid of two languages. Question 1: Is there a simple way to write a major mode file that combines two major modes? Details: The language is called "brew" (not the "BREW" of "Binary Runtime Environment for Wireless"). brew is made up of the languages R and Latex, whose modes are R-mode and latex-mode. The R code appears between the tags <% and %. Everything else is Latex. How can I write a brew-mode.el file? (Or is one already available?) One idea, which I got from this posting, is to use Latex mode, and treat the code of the form <% ... % as a comment. Question 2: How do you change the .emacs file or the latex.el file to have Latex mode treat code of the form <% ... % as a comment?

    Read the article

  • Extract parts of html using regex

    - by Fred Yang
    I have a simple requirement to extract text in html. Suppose the html is <h1>hello</h1> ... <img moduleType="calendar" /> ...<h2>bye</h2> I want to convert it into three parts <h1>hello</h1> <img moduleType="calendar" /> <h2>bye</h2> The aim is to extract text in two categories, simple html and special tags with <img moduleType="Calender".

    Read the article

  • Pass a range into a custom function from within a cell

    - by Luis
    Hi I'm using VBA in Excel and need to pass in the values from two ranges into a custom function from within a cell's formula. The function looks like this: Public Function multByElement(range1 As String, range2 As String) As Variant Dim arr1() As Variant, arr2() As Variant arr1 = Range(range1).value arr2 = Range(range2).value If UBound(arr1) = UBound(arr2) Then Dim arrayA() As Variant ReDim arrayA(LBound(arr1) To UBound(arr1)) For i = LBound(arr1) To UBound(arr1) arrayA(i) = arr1(i) * arr2(i) Next i multByElement = arrayA End If End Function As you can see, I'm trying to pass the string representation of the ranges. In the debugger I can see that they are properly passed in and the first visible problem occurs when it tries to read arr1(i) and shows as "subscript out of range". I have also tried passing in the range itself (ie range1 as Range...) but with no success. My best suspicion was that it has to do with the Active Sheet since it was called from a different sheet from the one with the formula (the sheet name is part of the string) but that was dispelled since I tried it both from within the same sheet and by specifying the sheet in the code. BTW, the formula in the cell looks like this: =AVERAGE(multByElement("A1:A3","B1:B3")) or =AVERAGE(multByElement("My Sheet1!A1:A3","My Sheet1!B1:B3")) for when I call it from a different sheet.

    Read the article

  • Serialize HTMLDocument and then rendering it in the server?

    - by Yang Bo
    Hi, After some Google search, I did not find anything fill my need. I want to save the current web page just as what it is. I mean, many web pages has Javascript executed and CSS changed, so after some user interactive, the web page may be different from the one when it is firstly loaded into browser. And I want to save the current web page state to the sever and rendering it in the server. Is there any Javascript library for this task? Thanks!

    Read the article

  • How to use FMS with C# ASP.NET

    - by Luis Reyes
    Hi, I actually need a way to work with a Flash media Server using c# and asp.net. And I don't have a clue about how to accomplish that I've been looking for documentation but haven't found anything worth so far. Thx in advance. Edit: What I want is to edit a Shared Object in FMS from Asp.net.

    Read the article

  • How to know when a user has really released a key in Java?

    - by Luis Soeiro
    (Edited for clarity) I want to detect when a user presses and releases a key in Java Swing, ignoring the keyboard auto repeat feature. I also would like a pure Java approach the works on Linux, Mac OS and Windows. Requirements: When the user presses some key I want to know what key is that; When the user releases some key, I want to know what key is that; I want to ignore the system auto repeat options: I want to receive just one keypress event for each key press and just one key release event for each key release; If possible, I would use items 1 to 3 to know if the user is holding more than one key at a time (i.e, she hits 'a' and without releasing it, she hits "Enter"). The problem I'm facing in Java is that under Linux, when the user holds some key, there are many keyPress and keyRelease events being fired (because of the keyboard repeat feature). I've tried some approaches with no success: Get the last time a key event occurred - in Linux, they seem to be zero for key repeat, however, in Mac OS they are not; Consider an event only if the current keyCode is different from the last one - this way the user can't hit twice the same key in a row; Here is the basic (non working) part of code: import java.awt.event.KeyListener; public class Example implements KeyListener { public void keyTyped(KeyEvent e) { } public void keyPressed(KeyEvent e) { System.out.println("KeyPressed: "+e.getKeyCode()+", ts="+e.getWhen()); } public void keyReleased(KeyEvent e) { System.out.println("KeyReleased: "+e.getKeyCode()+", ts="+e.getWhen()); } } When a user holds a key (i.e, 'p') the system shows: KeyPressed: 80, ts=1253637271673 KeyReleased: 80, ts=1253637271923 KeyPressed: 80, ts=1253637271923 KeyReleased: 80, ts=1253637271956 KeyPressed: 80, ts=1253637271956 KeyReleased: 80, ts=1253637271990 KeyPressed: 80, ts=1253637271990 KeyReleased: 80, ts=1253637272023 KeyPressed: 80, ts=1253637272023 ... At least under Linux, the JVM keeps resending all the key events when a key is being hold. To make things more difficult, on my system (Kubuntu 9.04 Core 2 Duo) the timestamps keep changing. The JVM sends a key new release and new key press with the same timestamp. This makes it hard to know when a key is really released. Any ideas? Thanks

    Read the article

  • Func<T> injecting with Windsor container

    - by yang
    Here is a code excerpt from AspComet project that works with Autofac. public MessageBus(IClientRepository clientRepository, Func<IMessagesProcessor> messagesProcessorFactoryMethod) { this.clientRepository = clientRepository; this.messagesProcessorFactoryMethod = messagesProcessorFactoryMethod; } How can I inject "Func<IMessagesProcessor> messagesProcessorFactoryMethod" with Windsor, is it possible? Thanks.

    Read the article

  • Executing certain code for every method call in C++

    - by Luís Guilherme
    I have a C++ class I want to inspect. So, I would like to all methods print their parameters and the return, just before getting out. The latter looks somewhat easy. If I do return() for everything, a macro #define return(a) cout << (a) << endl; return (a) would do it (might be wrong) if I padronize all returns to parenthesized (or whatever this may be called). If I want to take this out, just comment out the define. However, printing inputs seems more difficult. Is there a way I can do it, using C++ structures or with a workaroud hack?

    Read the article

  • Concatenate SQL script from Powershell

    - by Jeff Meatball Yang
    I have a bunch of (50+) XML files in a directory that I would like to insert into a SQL server 2008 table. How can I create a SQL script from the command prompt or Powershell that will let me insert the files into a simple table with the following schema: XMLDataFiles ( xmlFileName varchar(255) , content xml ) All I need is for something to generate a script with a bunch of insert statements. Right now, I'm contemplating writing a silly little .NET console app to write the SQL script. Thanks.

    Read the article

  • Hos to group the complex list objects by using Linq

    - by Daoming Yang
    I want to select and group the products, and rank them by the number of times they occur. For example, I have an OrderList each of order object has a OrderProductVariantList(OrderLineList), and each of OrderProductVariant object has ProductVariant, and then the ProductVariant object will have a Product object which contains product information. A friend helped me with the following code. It could be compiled, but it did not return any value/result. I used the watch window for the query and it gave me "The name 'query' does not exist in the current context". Can anyone help me? Many thanks. var query = orderList.SelectMany( o => o.OrderLineList ) // results in IEnumerable<OrderProductVariant> .Select( opv => opv.ProductVariant ) .Select( pv => p.Product ) .GroupBy( p => p ) .Select( g => new { Product = g.Key, Count = g.Count() });

    Read the article

  • How to create stackoverflow's post voting like jquery/ajax function?

    - by Daoming Yang
    Can I use Jquery to call an action and then change the image when it success, just like stackoverflow's post voting function? In my view, I'm using the following code, but I don't want to refresh the browser. Can anyone provide some code about this for me? Many thanks. <%if (!item.IsPrinted) { %> <%=Html.ImageLink("~/Content/images/web/delete.png", "printed", "MarkAsPrinted", "Order", item.TaskID, null, null)%> <%} else {%> <img src="~/Content/images/web/star.png" alt="printed" /> <% } %>

    Read the article

  • Trouble bringing a Blackberry App to Foreground

    - by Luis Armando
    I have an app that is listening in background and when the user clicks "send" it displays a dialogue. However I need to bring my app to foreground so the user answers some questions before letting the message go. but I haven't been able to do this, this is the code in my SendListener: SendListener sl = new SendListener(){ public boolean sendMessage(Message msg){ Dialog myDialog = new Dialog(Dialog.D_OK, "message from within SendListener", Dialog.OK,Bitmap.getPredefinedBitmap(Bitmap.EXCLAMATION), Dialog.GLOBAL_STATUS) { //Override inHolster to prevent the Dialog from being dismissed //when a user holsters their BlackBerry. This can //cause a deadlock situation as the Messages //application tries to save a draft of the message //while the SendListener is waiting for the user to //dismiss the Dialog. public void inHolster() { } }; //Obtain the application triggering the SendListener. Application currentApp = Application.getApplication(); //Detect if the application is a UiApplication (has a GUI). if( currentApp instanceof UiApplication ) { //The sendMessage method is being triggered from //within a UiApplication. //Display the dialog using is show method. myDialog.show(); App.requestForeground(); } else { //The sendMessage method is being triggered from // within an application (background application). Ui.getUiEngine().pushGlobalScreen( myDialog, 1, UiEngine.GLOBAL_MODAL ); } return true; } }; store.addSendListener(sl); App is an object I created above: Application App = Application.getApplication(); I have also tried to invoke the App to foreground using its processID but so far no luck.

    Read the article

  • Binary Search Tree for specific intent

    - by Luís Guilherme
    We all know there are plenty of self-balancing binary search trees (BST), being the most famous the Red-Black and the AVL. It might be useful to take a look at AA-trees and scapegoat trees too. I want to do deletions insertions and searches, like any other BST. However, it will be common to delete all values in a given range, or deleting whole subtrees. So: I want to insert, search, remove values in O(log n) (balanced tree). I would like to delete a subtree, keeping the whole tree balanced, in O(log n) (worst-case or amortized) It might be useful to delete several values in a row, before balancing the tree I will most often insert 2 values at once, however this is not a rule (just a tip in case there is a tree data structure that takes this into account) Is there a variant of AVL or RB that helps me on this? Scapegoat-trees look more like this, but would also need some changes, anyone who has got experience on them can share some thougts? More precisely, which balancing procedure and/or removal procedure would help me keep this actions time-efficient?

    Read the article

  • entity framework vNext wish list

    - by Fred Yang
    I have been intensively studying and use ef4 in my project. I do feel the improvement that it has over version 1. But I found that I have something I cannot get around easily. Here is a list I want it to be better in ef vNext. the model designer should allow multiple view of the same model, so that I don't need cram all my entity into a single view. respect user's manual edit of edmx. Currently, the some database view object simply can not be imported to the model because the designer "smartly" think that the view does not have a primary key, so that I have to manually edit the edmx to correct designer's behavior. But in the next "update from database" task, designer will revert my customization. For now, I simply fallback to manually edit the edmx file at all, or I have to use compare tool to keep the new update, and rollback and put the new update into my old edmx file manually. Designer should be improved to allow default behavior and user's manual control. I want control not to let the designer refresh the change of imported object. support user defined table function. linq is about Composability, stored proc dos not support composability. I wish I could use user defined table function which support this. What are you wishes for EF vNext?

    Read the article

  • Fact table with multiple facts

    - by Jeff Meatball Yang
    I have a dimension (SiteItem) has two important facts: perUserClicks perBrowserClicks however, within this dimension, I have groups of dimensions based on an attribute column (let's call the groups AboveFoldItems, LeftNavItems, OnTheFlyItems, etc.) each have more facts that are specific to that group: AboveFoldItems: eyeTime, loadTime LeftNavItems: mouseOverTime OnTheFlyItems: doesn't have any extra, but may in the future Is the following fact table schema ok? DateKey SessionKey SiteItemKey perUserClicks perBrowserClicks eyeTime loadTime mouseOverTime It seems a little wasteful since only some columns pertain to some dimension keys (the irrelevant facts are left NULL). But... this seems like it would be a common problem, so there should be a common solution for this, right?

    Read the article

  • Should we deploy a Webkit browser for our intranet applications?

    - by Jeff Meatball Yang
    At my place of employment, we are increasingly finding it difficult to develop for IE, which was historically the easiest browser to target, from an intranet-app point of view. It was already deployed. It already understood NTLM authentication, thus well integrated with our domain-level security. It had neat, albeit non-standard features such as XMLDOM and XmlHTTP. Now, we are increasingly irritated by issues presented by IE: There are several versions: IE 7, 8, and soon 9 beta, which all have slightly different issues related to performance, functionality (especially re:security and zones), and aesthetics. IE 7 and 8 are slower than Webkit-based browsers. Period. There are technology limitations such as missing canvas element, CSS bugs, etc. that make it hard to use 3rd party packages or even consistently write code across IE versions. Users are increasingly using Firefox or Chrome, even for intranet use. Does anyone have experience with making a transition? Any advice would be welcome.

    Read the article

  • Does the order of columns matter in a group by clause?

    - by Jeff Meatball Yang
    If I have two columns, one with very high cardinality and one with very low cardinality (unique # of values), does it matter in which order I group by? Here's an example: select dimensionName, dimensionCategory, sum(someFact) from SomeFact f join SomeDim d on f.dimensionKey = d.dimensionKey group by d.dimensionName, -- large number of unique values d.dimensionCategory -- small number of unique values Are there situations where it matters?

    Read the article

< Previous Page | 8 9 10 11 12 13 14 15 16 17  | Next Page >