Search Results

Search found 1226 results on 50 pages for 'kim thomas'.

Page 13/50 | < Previous Page | 9 10 11 12 13 14 15 16 17 18 19 20  | Next Page >

  • Efficient heaps in purely functional languages

    - by Kim
    As an exercise in Haskell, I'm trying to implement heapsort. The heap is usually implemented as an array in imperative languages, but this would be hugely inefficient in purely functional languages. So I've looked at binary heaps, but everything I found so far describes them from an imperative viewpoint and the algorithms presented are hard to translate to a functional setting. How to efficiently implement a heap in a purely functional language such as Haskell? Edit: By efficient I mean it should still be in O(n*log n), but it doesn't have to beat a C program. Also, I'd like to use purely functional programming. What else would be the point of doing it in Haskell?

    Read the article

  • default maven compiler setting

    - by Jeeyoung Kim
    Hello Maven gurus, Right now, I'm writing a small java application by my own, with few maven pom.xml files. I want to make all my maven packages to compile with jdk 1.6, and I can't find a good way to do it without manually setting it on every single POMs - I'm sick of copy-and-pasting <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-compiler-plugin</artifactId> <configuration> <source>1.6</source> <target>1.6</target> </configuration> in every single pom.xml file I generate. Is there a simpler way to resolve this issue?

    Read the article

  • Class 'org.springframework.http.converter.ResourceHttpMessageConverter' not found - how to correct?

    - by Ash Kim
    Eclipse STS is reporting I have problem with my spring project. It's a fresh project generated from the Spring Web MVC Project Template (File-New-Spring Template Project-Spring Web MVC ). When I create the project it has no problems - it's only once I modify the pom (by adding the hibernate dependencies) that STS then picks up the spring problem. Strangely if I revert the pom the problem remains. Also I can run the project on a spring tc server and all works correctly. Any ideas how I can satisfy this problem report? "Class 'org.springframework.http.converter.ResourceHttpMessageConverter' not found" mvc-config.xml /src/main/webapp/WEB-INF/spring line 9 Spring Beans Problem mvc-config.xml: <?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:mvc="http://www.springframework.org/schema/mvc" xsi:schemaLocation=" http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-3.0.xsd"> <mvc:annotation-driven /> <!-- <= PROBLEMATIC LINE REPORTED BY STS --> <!-- Resolves view names to protected .jsp resources within the /WEB-INF/views directory --> <bean class="org.springframework.web.servlet.view.InternalResourceViewResolver"> <property name="prefix" value="/WEB-INF/views/"/> <property name="suffix" value=".jsp"/> </bean> </beans>

    Read the article

  • Jquery: highlight element on mouseover without hanging or lagging.

    - by Kim Jong Woo
    When I had elements highlighted upon mouseover, it would work fine with sites with minimal number of elements. But when the number of elements on a page was very big, the effect would "lag" so to speak. It would take a while for each elements to highlight upon mouseover event. Has someone solved this problem successfully ? I've seen a prototype.js example that does not lag.

    Read the article

  • appending <a href> to keywords in rails

    - by kim
    Basically, there are some keywords that i want to pick out and assign a link to them dynamically. How should i go about in doing this? Let's say i have something like this; <p>ruby, rails, php, python, django and sinatra</p> and i would like to assign links to keywords like ruby and python, so the end results should look like this; <p><a href="http://www.ruby-lang.org">ruby</a>, rails, php, <a href="http://www.python.org">python</a>, django and sinatra</p> Any help or suggestion would be much appreciated!

    Read the article

  • How to call regular JS function with params within jQuery ?

    - by Kim
    Is there another way to run a regular JS function with params passed than what I use below ? It seems redundant use a on-the-way function to do this. function regularJSfunc(param1,param2) { // do stuff } $(document).ready(function(){ $('#myId').change(function(){ regularJSfunc('data1','data2'); }); } Using a .bind event seems much better, however I am not sure how to access the params. Note: Example below doesnt work. $(document).ready(function(){ $('#myId').bind('change',{'data1','data2'},regularJSfunc); }

    Read the article

  • Using Google Common Collection in GWT

    - by Jeeyoung Kim
    This is a simple problem, but I'm having problems with it... I'm trying to use Google common collection's Objects.equal() method in a GWT client code, but I'm keep getting the error "20:12:10.001 [ERROR] [gwt_regex] Line 39: No source code is available for type com.google.common.base.Objects; did you forget to inherit a required module?" Tried to Google for the answer, but couldn't find any answer regarding this - everyone just said "Google collection should work off the box with GWT".

    Read the article

  • Extending an entity

    - by Kim L
    I have class named AbstractUser, which is annotated with @MappedSuperclass. Then I have a class named User (@Entity) which extends AbstractUser. Both of these exist in a package named foo.bar.framework. When I use these two classes, everything works just fine. But now I've imported a jar containing these files to another project. I'd like to reuse the User class and expand it with a few additional fields. I thought that @Entity public class User extends foo.bar.framework.User would do the trick, but I found out that this implementation of the User only inherits the fields from AbstractUser, but nothing from foo.bar.framework.User. The question is, how can I get my second User class to inherit all the fields from the first User entity class? Both User class implementation have different table names defined with @Table(name = "name").

    Read the article

  • issue about Concept of JFrame, JLabel and ContentPane

    - by Sun Hong Kim
    I just study window programming with awt. I see through several codes but I can not get concepts of JFrame, JLabel and ContentPane. I think JFrame only make outer Frame. ContentPane is container that contain JLabel that has contents(text, button, radio etc...). I don't know this is correct T.T Why I ask this is I failed combine the contents. I can not make TextField and InternalFrame at a time. I want to know the concept. I hope you take my question right.

    Read the article

  • using an array in a custom formula in crystal reports xi

    - by Kim Sharpe
    I have a formula which is working; the formula uses an array. I tried to extract the formula to create a custom formula but now get an error in the syntax. I am wondering if the array is causing the problem as the error is on the line: last_element_current:=val(sc_array[1]) + 1; and the error is: the ) is missing and highlights the variable sc_array before the index [1].

    Read the article

  • How to show jQuery is working/waiting/loading ?

    - by Kim
    How do I show a loading picture and/or message to the user ? If possible, would I like to know how to make it full screen with grey-dimmed background. Kinda like when viewing the large picture from some galleries (sorry, no example link). Currently do I add a CSS class which has the image and other formating, but its not working for some reason. Results from the search do get inserted into the div. HTML <div id="searchresults"></div> CSS div.loading { background-image: url('../img/loading.gif'); background-position: center; width: 80px; height: 80px; } JS $(document).ready(function(){ $('#searchform').submit(function(){ $('#searchresults').addClass('loading'); $.post('search.php', $('#'+this.id).serialize(),function(result){ $('#searchresults').html(result); }); $('#searchresults').removeClass('loading'); return false; }); });

    Read the article

  • How to return radio checked object with jQuery ?

    - by Kim
    HTML <input type="radio" name="rdName" id="uniqueID1" value="1" checked="checked"> <input type="radio" name="rdName" id="uniqueID2" value="2"> <input type="radio" name="rdName" id="uniqueID3" value="3"> jQuery #1 $('input:radio[name=rdName]:checked').val(); jQuery #2 $('input[name=rdName]:checked'); jQuery #1 gets the value of checked radio, but I need to get the whole object to get the ID. jQuery #2 get this (from Chrome Dev console). Object "0" is the actual object I need, but I am unable to just that. 0: HTMLInputElement constructor: function Object() context: HTMLDocument length: 1 prevObject: Object selector: input[name=rdName]:checked __proto__: Object Any ideas how to isolate the needed object ?

    Read the article

  • C++ cin questions

    - by Kim
    This seems to be weird: int main(int argc, char* argv[]) { cout << "function main() .." << '\n'; char ch = 0; double number_value=1.1; cin >> ch; cin.putback(ch); cin >> number_value; cout << "1 .. " << " " << cin.good() << " " << number_value << '\n'; cin >> number_value; cout << "2 .. " << " " << cin.good() << " " << number_value << '\n'; return 0; } If I input the following: 7a 1 I get the following: function main() .. 7a 1 1 .. 1 7 2 .. 0 0 I understand the: 1 .. 1 7 but why the variable number_value is 0. cin.good() shows failure so nothing would have read and the value in number_value from the previous assignment would remain. I expect the value of 7.

    Read the article

  • JSONArray does not work when I am getting the JSON string from the server

    - by Taehoon A Kim
    I've looked up some answers but am not sure why mine is failing exactly... The code looks something like this HttpResponse httpResponse = httpClient.execute(httpPost); HttpEntity httpEntity = httpResponse.getEntity(); String json = EntityUtils.toString(httpEntity); //Convert to JsonArray JSONArray jsonArray = new JSONArray(json); Log.i(DEBUG_TAG, Integer.toString(jsonArray.length())); for (int i = 0; i < jsonArray.length(); i++) { JSONObject jsonObject = jsonArray.getJSONObject(i); Log.i(DEBUG_TAG, jsonObject.getString(KEY_ID)); // creating new HashMap HashMap<String, String> map = new HashMap<String, String>(); // adding each child node to HashMap key => value map.put(KEY_ID, jsonObject.getString(KEY_ID)); map.put(KEY_TITLE, jsonObject.getString(KEY_TITLE)); map.put(KEY_ARTIST, jsonObject.getString(KEY_ARTIST)); map.put(KEY_DURATION, jsonObject.getString(KEY_DURATION)); map.put(KEY_VOTECOUNT, jsonObject.getString(KEY_VOTECOUNT)); map.put(KEY_THUMB_URL, jsonObject.getString(KEY_THUMB_URL)); map.put(KEY_GENRE, jsonObject.getString(KEY_GENRE)); //Adding map to ArrayList if (Integer.parseInt(jsonObject.getString(KEY_VOTECOUNT)) == -1){ //If VoteCount is -1 then add to header headerList.add(map); }else { songsList.add(map); } } } catch (UnsupportedEncodingException e) { e.printStackTrace(); } catch (ClientProtocolException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } When I run logcat on String json, it seems to show correct info which is kind of like this... { "userdata": [ { "id": "8", "title": "Baby One More Time", "artist": "Britney Spears", "duration": "03:24:00", "votes": "0", "thumb_url": "http://api.androidhive.info/music/images/dido.png", "genre": null }, { "id": "2", "title": "As Long As You Love Me", "artist": "Justin Bieber", "duration": "05:26:00", "votes": "0", "thumb_url": "http://api.androidhive.info/music/images/enrique.png", "genre": "Rock" } ] } and the logcat on JSONArray jsonArray = new JSONArray(json); tells me that jsonArray.length() 10-31 22:57:28.433: W/CustomizedListView(26945): error! Invalid index 0, size is 0 Please let me know Thank you,

    Read the article

  • Running Maven Goals in CLI.

    - by Jeeyoung Kim
    Hello, I have a maven pom.xml file with multiple instances of a same goal defined (inside with different s). I'm wondering how I can run a specific goal via maven command line. I've tried mvn --help, but I couldn't find an entry regarding this.

    Read the article

  • When exactly does a method have side effects?

    - by Kim
    As I always understood it, any change to the programs state (or anything to do with IO) is a side effect. It does not matter, whether the change occurs in a global variable or in a private field of the object the method is called on. It follows that all methods which do not return anything either do nothing at all or have a side effect. My confusion comes from one of our university's instructors (who is still a student and thus not omniscient yet;) ) telling me setters don't have side effects.

    Read the article

  • How to map a Dictionary<string, string> spanning several tables

    - by Kim Johansson
    I have four tables: CREATE TABLE [Languages] ( [Id] INTEGER IDENTITY(1,1) NOT NULL, [Code] NVARCHAR(10) NOT NULL, PRIMARY KEY ([Id]), UNIQUE INDEX ([Code]) ); CREATE TABLE [Words] ( [Id] INTEGER IDENTITY(1,1) NOT NULL, PRIMARY KEY ([Id]) ); CREATE TABLE [WordTranslations] ( [Id] INTEGER IDENTITY(1,1) NOT NULL, [Value] NVARCHAR(100) NOT NULL, [Word] INTEGER NOT NULL, [Language] INTEGER NOT NULL, PRIMARY KEY ([Id]), FOREIGN KEY ([Word]) REFERENCES [Words] ([Id]), FOREIGN KEY ([Language]) REFERENCES [Languages] ([Id]) ); CREATE TABLE [Categories] ( [Id] INTEGER IDENTITY(1,1) NOT NULL, [Word] INTEGER NOT NULL, PRIMARY KEY ([Id]), FOREIGN KEY ([Word]) REFERENCES [Words] ([Id]) ); So you get the name of a Category via the Word - WordTranslation - Language relations. Like this: SELECT TOP 1 wt.Value FROM [Categories] AS c LEFT JOIN [WordTranslations] AS wt ON c.Word = wt.Word WHERE wt.Language = ( SELECT TOP 1 l.Id FROM [Languages] WHERE l.[Code] = N'en-US' ) AND c.Id = 1; That would return the en-US translation of the Category with Id = 1. My question is how to map this using the following class: public class Category { public virtual int Id { get; set; } public virtual IDictionary<string, string> Translations { get; set; } } Getting the same as the SQL query above would be: Category category = session.Get<Category>(1); string name = category.Translations["en-US"]; And "name" would now contain the Category's name in en-US. Category is mapped against the Categories table. How would you do this and is it even possible?

    Read the article

  • Instagram API and Zend/Loader.php

    - by Jaemin Kim
    I want to use Instagram API and I found this code. <html> <head></head> <body> <h1>Popular on Instagram</h1> <?php // load Zend classes require_once 'Zend/Loader.php'; Zend_Loader::loadClass('Zend_Http_Client'); // define consumer key and secret // available from Instagram API console $CLIENT_ID = 'YOUR-CLIENT-ID'; $CLIENT_SECRET = 'YOUR-CLIENT-SECRET'; try { // initialize client $client = new Zend_Http_Client('https://api.instagram.com/v1/media/popular'); $client->setParameterGet('client_id', $CLIENT_ID); // get popular images // transmit request and decode response $response = $client->request(); $result = json_decode($response->getBody()); // display images $data = $result->data; if (count($data) > 0) { echo '<ul>'; foreach ($data as $item) { echo '<li style="display: inline-block; padding: 25px"><a href="' . $item->link . '"><img src="' . $item->images->thumbnail->url . '" /></a> <br/>'; echo 'By: <em>' . $item->user->username . '</em> <br/>'; echo 'Date: ' . date ('d M Y h:i:s', $item->created_time) . '<br/>'; echo $item->comments->count . ' comment(s). ' . $item->likes->count . ' likes. </li>'; } echo '</ul>'; } } catch (Exception $e) { echo 'ERROR: ' . $e->getMessage() . print_r($client); exit; } ?> </body> </html> In here, I found Zender/Load.php, and I've never heard about that. Is it okay to go http://www.zend.com/en/products/guard/downloads here, and download Zend for linux?? And for another question, is this code available to use Instagram API?? For last, could you let me know that is there any simple code to use Instagram API? Thank you.

    Read the article

  • Javascript: gradually adding to string in each iteration ?

    - by Kim Jong Woo
    I have a string like this that is split up: var tokens = "first>second>third>last".split(">"); What I would like in each iteration is for it to return Iteration 0: "last" Iteration 1: "third>last" Iteration 2: "second>third>last" Iteration 3: "first>second>third>last" I am thinking of using decrementing index for loop.... but is there a more efficient approach ? for (int w = tokens.length-1; w == 0; w--) { }

    Read the article

  • Java Swing: JWindow appears behind all other process windows, and will not disappear

    - by Kim Jong Woo
    I am using JWindow to display my splash screen during the application start up. however it will not appear in front of all windows as it should, and it will not disappear as well. import java.awt.BorderLayout; import java.awt.Color; import java.awt.Dimension; import java.awt.Font; import java.awt.Toolkit; import javax.swing.BorderFactory; import javax.swing.ImageIcon; import javax.swing.JLabel; import javax.swing.JPanel; import javax.swing.JWindow; public class MySplash { public static MySplash INSTANCE; private static JWindow jw; public MySplash(){ createSplash(); } private void createSplash() { jw = new JWindow(); JPanel content = (JPanel) jw.getContentPane(); content.setBackground(Color.white); // Set the window's bounds, centering the window int width = 328; int height = 131; Dimension screen = Toolkit.getDefaultToolkit().getScreenSize(); int x = (screen.width - width) / 2; int y = (screen.height - height) / 2; jw.setBounds(x, y, width, height); // Build the splash screen JLabel label = new JLabel(new ImageIcon("splash.jpg")); JLabel copyrt = new JLabel("SplashScreen Test", JLabel.CENTER); copyrt.setFont(new Font("Sans-Serif", Font.BOLD, 12)); content.add(label, BorderLayout.CENTER); content.add(copyrt, BorderLayout.SOUTH); Color oraRed = new Color(156, 20, 20, 255); content.setBorder(BorderFactory.createLineBorder(oraRed, 0)); } public synchronized static MySplash getInstance(){ if(INSTANCE==null){ INSTANCE = new MySplash(); } return INSTANCE; } public void showSplash(){ jw.setAlwaysOnTop(true); jw.toFront(); jw.setVisible(true); return; } public void hideSplash(){ jw.setAlwaysOnTop(false); jw.toBack(); jw.setVisible(false); return; } } So in my main class which extends JFrame, I call my splash screen by SwingUtilities.invokeLater(new Runnable(){ @Override public void run() { MySplash.getInstance().showSplash(); } }); However, the JWindow appears behind the all open instances of windows on my computer. Hiding the JWindow also doesn't work. SwingUtilities.invokeLater(new Runnable(){ @Override public void run() { MySplash.getInstance().hideSplash(); } });

    Read the article

  • How to approach this SQL query

    - by Kim
    I have data related as follows: A table of Houses A table of Boxes (with an FK back into Houses) A table of Things_in_boxes (with an FK back to Boxes) A table of Owners (with an FK back into Houses) In a nutshell, a House has many Boxes, and each Box has many Things in it. In addition, each House has many Owners. If I know two Owners (say Peter and Paul), how can I list all the Things that are in the Boxes that are in the Houses owned by these guys? Also, I'd like to master this SQL stuff. Can anyone recommend a good book/resource? (I'm using MySQL). Thanks!

    Read the article

< Previous Page | 9 10 11 12 13 14 15 16 17 18 19 20  | Next Page >