Search Results

Search found 93 results on 4 pages for 'kay ell'.

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

  • Java Generic Casting Type Mismatch

    - by Kay
    public class MaxHeap<T extends Comparable<T>> implements Heap<T>{ private T[] heap; private int lastIndex; public void main(String[] args){ int i; T[] arr = {1,3,4,5,2}; //ERROR HERE ******* foo } public T[] Heapsort(T[]anArray, int n){ // build initial heap T[]sortedArray = anArray; for (int i = n-1; i< 0; i--){ //assert: the tree rooted at index is a semiheap heapRebuild(anArray, i, n); //assert: the tree rooted at index is a heap } //sort the heap array int last = n-1; //invariant: Array[0..last] is a heap, //Array[last+1..n-1] is sorted for (int j=1; j<n-1;j++) { sortedArray[0]=sortedArray[last]; last--; heapRebuild(anArray, 0, last); } return sortedArray; } protected void heapRebuild(T[ ] items, int root, int size){ foo } } The error is on the line with "T[arr] = {1,3,4,5,2}" Eclispe complains that there is a: "Type mismatch: cannot convert from int to T" I've tried to casting nearly everywhere but to no avail.A simple way out would be to not use generics but instead just ints but that's sadly not an option. I've got to find a way to resolve the array of ints "{1,3,4,5,2}" into an array of T so that the rest of my code will work smoothly.

    Read the article

  • Intel Assembly Programming

    - by Kay
    class MyString{ char buf[100]; int len; boolean append(MyString str){ int k; if(this.len + str.len>100){ for(k=0; k<str.len; k++){ this.buf[this.len] = str.buf[k]; this.len ++; } return false; } return true; } } Does the above translate to: start: push ebp ; save calling ebp mov ebp, esp ; setup new ebp push esi ; push ebx ; mov esi, [ebp + 8] ; esi = 'this' mov ebx, [ebp + 14] ; ebx = str mov ecx, 0 ; k=0 mov edx, [esi + 200] ; edx = this.len append: cmp edx + [ebx + 200], 100 jle ret_true ; if (this.len + str.len)<= 100 then ret_true cmp ecx, edx jge ret_false ; if k >= str.len then ret_false mov [esi + edx], [ebx + 2*ecx] ; this.buf[this.len] = str.buf[k] inc edx ; this.len++ aux: inc ecx ; k++ jmp append ret_true: pop ebx ; restore ebx pop esi ; restore esi pop ebp ; restore ebp ret true ret_false: pop ebx ; restore ebx pop esi ; restore esi pop ebp ; restore ebp ret false My greatest difficulty here is figuring out what to push onto the stack and the math for pointers. NOTE: I'm not allowed to use global variables and i must assume 32-bit ints, 16-bit chars and 8-bit booleans.

    Read the article

  • Implementing Java Priority Queue

    - by Kay
    public class PriorityQueue<T> { private PriorityNode<T> head, tail; private int numItems; public PriorityQueue(){ numItems = 0; head=null; tail=null; } public void add(int priority, T value){ PriorityNode<T> newNode = new PriorityNode<T>(priority,value); if(numItems == 0){ head = newNode; tail = newNode; } else{ head.setNext(newNode); head = newNode; } } } Where PriorityNode is defined as: public class PriorityNode<T> implements Comparable<T> { private T value; private PriorityNode<T> next; private int priority; public PriorityNode(int priority,T newValue){ value = newValue; next = null; priority = 0; } public PriorityNode(T newValue){ value = newValue; next = null; priority = 0; } public void setPriority(int priority){ this.priority = priority; } public int getPriority(){ return this.priority; } public T getValue(){ return value; } public PriorityNode<T> getNext(){ return next; } public void setNext(PriorityNode<T> nextNode){ this.next = nextNode; } public void setValue(T newValue){ value = newValue; } public int compareTo(int pri) { // TODO Auto-generated method stub if(this.priority<pri){ return -1; } else if(this.priority == pri){ return 0; } else{ return 1; } } } I'm having a lot of difficulty using the Comparator here and implementing a priority queue - please point me in the right direction.

    Read the article

  • Significant new inventions in computing since 1980

    - by Alan Kay
    This question arose from comments about different kinds of progress in computing over the last 50 years or so. I was asked by some of the other participants to raise it as a question to the whole forum. Basic idea here is not to bash the current state of things but to try to understand something about the progress of coming up with fundamental new ideas and principles. I claim that we need really new ideas in most areas of computing, and I would like to know of any important and powerful ones that have been done recently. If we can't really find them, then we should ask "Why?" and "What should we be doing?"

    Read the article

  • Intel IA-32 Assembly

    - by Kay
    I'm having a bit of difficulty converting the following java code into Intel IA-32 Assembly: class Person() { char name [8]; int age; void printName() {...} static void printAdults(Person [] list) { for(int k = 0; k < 100; k++){ if (list[k].age >= 18) { list[k].printName(); } } } } My attempt is: Person: push ebp; save callers ebp mov ebp, esp; setup new ebp push esi; esi will hold name push ebx; ebx will hold list push ecx; ecx will hold k init: mov esi, [ebp + 8]; mov ebx, [ebp + 12]; mov ecx, 0; k=0 forloop: cmp ecx, 100; jge end; if k>= 100 then break forloop cmp [ebx + 4 * ecx], 18 ; jl auxloop; if list[k].age < 18 then go to auxloop jmp printName; printName: auxloop: inc ecx; jmp forloop; end: pop ecx; pop ebx; pop esi; pop ebp; Is my code correct? NOTE: I'm not allowed to use global variables.

    Read the article

  • a full-screen UIImagePickerController with the right scale?

    - by Kay
    Hi, I'm customizing my image picker controller and I want to have a full-screen viewfinder. I think this might be pretty an old topic and I found an answer here: http://www.gorbster.net/blog/archives/144 But what I want to know is if there's a way to achieve this without distorting the scale of the image. If I scale that clipped preview image, I'm distorting its original x-y ratio, and I want to avoid it. Is there a way to prevent the preview image from being clipped so that I could retain the original 1200x1600 ratio? Thanks!

    Read the article

  • How to bind gridview using linq/Entity Framework?

    - by Kay
    I need to bind GridView, I am using this code: ProductDBEntities db = new ProductPDBEntities(); var pro = from u in db.Products where u.PID == 1 select u; if (pro != null) { GridView1.DataSource = pro; GridView1.DataBind(); } and getting this error. System.InvalidOperationException: Sequence contains more than one element Can somebody please tell me what am I doin wrong?

    Read the article

  • Real-time aggregation of files from multiple machines to one

    - by dmitry-kay
    I need a tool which gets a list of machine names and file wildcards. Then it connects to all these machines (SSH) and begins to monitor changes (appendings to the end) in each file matched by wildcards. New lines in each such file are saved to the local machine to the file with the same name. (This is a task of real-time log files collecting.) I could use ssh + tail -f, of course, but it is not very robust: if a monitoring process dies and then restarts, some data from remote files may be lost (because tail -f does not save the position at which it is finished before). I may write this tool manually, but before - I'd like to know if such tool already exists or not.

    Read the article

  • Speed up the loop operation in R

    - by Kay
    Hi, i have a big performance problem in R. I wrote a function that iterates over an data.frame object. It simply adds a new col to a data.frame and accumulate sth. (simple operation). The data.frame has round about 850.000 rows. My PC is still working about 10h now and i have no idea about the runtime. dayloop2 <- function(temp){ for (i in 1:nrow(temp)){ temp[i,10] <- i if (i > 1) { if ((temp[i,6] == temp[i-1,6]) & (temp[i,3] == temp[i-1,3])) { temp[i,10] <- temp[i,9] + temp[i-1,10] } else { temp[i,10] <- temp[i,9] } } else { temp[i,10] <- temp[i,9] } } names(temp)[names(temp) == "V10"] <- "Kumm." return(temp) } Any ideas how to speed up this operation ?

    Read the article

  • Get the src part of a string [duplicate]

    - by Kay Lakeman
    This question already has an answer here: Grabbing the href attribute of an A element 7 answers First post ever here, and i really hope you can help. I use a database where a large piece of html is stored, now i just need the src part of the image tag. I already found a thread, but i just doesn't do the trick. My code: Original string: <p><img alt=\"\" src=\"http://domain.nl/cms/ckeditor/filemanager/userfiles/background.png\" style=\"width: 80px; height: 160px;\" /></p> How i start: $image = strip_tags($row['information'], '<img>'); echo stripslashes($image); This returns: <img alt="" src="http://domain.nl/cms/ckeditor/filemanager/userfiles/background.png" style="width: 80px; height: 160px;" /> Next step: extract the src part: preg_match('/< *img[^>]*src *= *["\']?([^"\']*)/i', $image, $matches); echo $matches ; This last echo returns: Array What is going wrong? Thanks in advance for your anwser.

    Read the article

  • jquery live problem

    - by Kay
    Hi, I have a website which uses jquery and lots of mouseover/mouseout effect. So far I used the .bind() method of jquery but if you have 1000 event handlers, this is slowing down your browser a lot. So, I want to move to use .live or .delegate. One part of my portal site is a chat area. User can set chat messages which will then be displayed in a simple table. There is a feature that if you move the mouse over a chat message a trash can will appear allowing you to delete the message (if it is by you or you are a moderator). The trash bin is in the same table cell as the chat message. The problem: Using .bind() it worked like a charm. This is the old code: function CreateChatMessageContextMenu(ctrl, messageID, message, sender) { var a = document.createElement("a"); a.href = "javascript:RemoveChatMessage(" + messageID + ");" a.id = 'aDeleteChatMessage' + messageID; a.style.display = 'none'; var img = document.createElement("span"); img.className = "sprite-common messages-image sprite-common-btnDelete"; a.appendChild(img); ctrl.appendChild(a); $(ctrl) .bind('mouseover', function(event) { $('#aDeleteChatMessage' + messageID).show() }) .bind('mouseout', function(event) { $('#aDeleteChatMessage' + messageID).hide() }); return; } 'ctrl' is the reference to a table cell. Now, using .live() the trashbin also appears but it is flickering a lot and when I move the mouse over the trashbin, it is disappearing or inactive. I have the feeling that more events are thrown or something. It seems like the 'mouseout' is thrown when moving over the trashbin, but the thrashbin is inside the tablecell so mouseout should not be triggered. The new code is as follows. $(document).ready { $('.jDeleteableChatMessage').live('mouseover mouseout', function(event) { var linkID = '#aDelete' + event.target.id; if (event.type == 'mouseover') { $(linkID).show(); } else { $(linkID).hide(); } return false; }); } function CreateChatMessageContextMenu(ctrl, messageID, message, sender) { if (!UserIsModerator && (UserLogin != sender)) return; ctrl.id = 'ChatMessage' + messageID; var deleteString = 'Diese Chatnachricht löschen'; if (UserLang == '1') deleteString = 'Delete this chat message'; var a = document.createElement("a"); a.href = "javascript:RemoveChatMessage(" + messageID + ");" a.id = 'aDeleteChatMessage' + messageID; a.style.display = 'none'; var img = document.createElement("span"); img.className = "sprite-common messages-image sprite-common-btnDelete"; img.alt = deleteString; img.title = deleteString; a.appendChild(img); ctrl.appendChild(a); $(ctrl).addClass('jDeleteableChatMessage'); } I add a class to tell jQuery which chat cell have a trash bin and which don't. I also add an ID to the table cell which is later used to determine the associated trash bin. Yes, that's clumsy data passing to an event method. And, naturally, there is the document.ready function which initialises the .live() method. So, where is my mistake?

    Read the article

  • getURL, parsing web-site with german special characters

    - by Kay
    I am using getURL() and htmlParse() - how can I make web-site content with special characters to be displayed properly? library(RCurl); library(XML) script <- getURL("http://www.floraweb.de/pflanzenarten/foto.xsql?suchnr=814") doc <- htmlParse(script, encoding = "UTF-8") xpathSApply(doc, "//div[@id='content']//p", xmlValue)[2] [1] "Bellis perennis L., Gänseblümchen" # should say: [1] "Bellis perennis L., Gänseblümchen" > Sys.getlocale() [1] "LC_COLLATE=German_Austria.1252;LC_CTYPE=German_Austria.1252;LC_MONETARY=German_Austria.1252;LC_NUMERIC=C;LC_TIME=German_Austria.1252"

    Read the article

  • Bizzare Java invalid Assignment Operator Error

    - by Kay
    public class MaxHeap<T extends Comparable<T>> implements Heap<T>{ private T[] heap; private int lastIndex; private static final int defaultInitialCapacity = 25; public void add(T newItem) throws HeapException{ if (lastIndex < Max_Heap){ heap[lastIndex] = newItem; int place = lastIndex; int parent = (place – 1)/2; //ERROR HERE********** while ( (parent >=0) && (heap[place].compareTo(heap[parent])>0)){ T temp = heap[place]; heap[place] = heap[parent]; heap[parent] = temp; place = parent; parent = (place-1)/2; }else { throw new HeapException(“HeapException: Heap full”); } } } Eclipse complains that there is a: "Syntax error on token "Invalid Character", invalid AssignmentOperator" With the red line beneath the '(place-1)' There shouldn't be an error at all since it's just straight-forward arithmetic. Or is it not that simple?

    Read the article

  • Why is false being returned in this function

    - by Kay
    Hello all, I have this function below which makes it to the second IF function which sets the variable th as true but what is returned is false? Why?! public boolean nodeExist(TreeNode Tree, T value){ boolean th = false; if(Tree.getValue()!= null){ if(value == Tree.getValue()){ th = true; }else{ if(value.compareTo((T) Tree.getValue()) < 0){ nodeExist(Tree.getLeft(), value); }else{ nodeExist(Tree.getRight(), value); } } }else{ th = false; } return th; }

    Read the article

  • How is this function being made use of?

    - by Kay
    Hello all, I am just studying a few classes given to me by my lecturer and I can't understand how the function heapRebuild is being made used of! It doesn't change any global variables and it doesn't print out anything ad it doesn't return anything - so should this even work? It shouldn't, should it? If you were told to make use of heapRebuild to make a new function removeMac would you edit heapRebuild? public class MaxHeap<T extends Comparable<T>> implements Heap<T>{ private T[] heap; private int lastIndex; public T removeMax(){ T rootItem = heap[0]; heap[0] = heap[lastIndex-1]; lastIndex--; heapRebuild(heap, 0, lastIndex); return rootItem; } protected void heapRebuild(T[ ] items, int root, int size){ int child = 2*root+1; if( child < size){ int rightChild = child+1; if ((rightChild < size) && (items[rightChild].compareTo(items[child]) > 0)){ child = rightChild; } if (items[root].compareTo(items[child]) < 0){ T temp = items[root]; items[root] = items[child]; items[child] = temp; heapRebuild(items, child, size);} } } }

    Read the article

  • Removing object/array difference from different arrays [duplicate]

    - by Kay Singian
    This question already has an answer here: remove objects from array by object property 3 answers I have two JavaScript objects: object_1 = [ {'value': '9:00', 'text':'9:00 am', 'eventtime':'09:00:00' }, {'value': '9:30', 'text':'9:30 am', 'eventtime':'09:30:00' }, {'value': '10:00', 'text':'10:00 am', 'eventtime':'10:00:00' }, {'value': '10:30', 'text':'10:30 am', 'eventtime':'10:30:00' }, {'value': '11:00', 'text':'11:00 am', 'eventtime':'11:00:00' }, {'value': '11:30', 'text':'11:30 am', 'eventtime':'11:30:00' }, ]; object_2 = [ {'eventtime': '10:30:00'}, {'eventtime': '11:00:00'} ]; I want to remove the object in object_1 which has the same eventtime value and store it in a new array/object . Please help me do so, I cant find a solution to this. This will be the new array/object: object_new = [ {'value': '9:00', 'text':'9:00 am', 'eventtime':'09:00:00' }, {'value': '9:30', 'text':'9:30 am', 'eventtime':'09:30:00' }, {'value': '10:00', 'text':'10:00 am', 'eventtime':'10:00:00' }, {'value': '11:30', 'text':'11:30 am', 'eventtime':'11:30:00' }, ];

    Read the article

  • Google Chrome Extensions: Launch Event (part 4)

    Google Chrome Extensions: Launch Event (part 4) Video Footage from the Google Chrome Extensions launch event on 12/09/09. Aaron Boodman and Erik Kay, technical leads for the Google Chrome extensions team discuss the UI surfaces of Google Chrome extensions and the team's content not chrome philosophy. They also highlight the smooth, frictionless install and uninstall process for Google Chrome's extensions system and present the team's initiatives in the space of security and performance. From: GoogleDevelopers Views: 2963 12 ratings Time: 15:44 More in Science & Technology

    Read the article

  • Google Chrome Extensions: UI Design

    Google Chrome Extensions: UI Design Erik Kay, an engineer at Google, provides more information about the UI of Google Chrome's extension system. For more information visit code.google.com/chrome/extensions. From: GoogleDevelopers Views: 10120 57 ratings Time: 03:49 More in Science & Technology

    Read the article

  • Google Chrome Extensions: Launch Event (part 2)

    Google Chrome Extensions: Launch Event (part 2) Video Footage from the Google Chrome Extensions launch event on 12/09/09. Aaron Boodman and Erik Kay technical leads for the Google Chrome extensions team present a quick history of the extensions system of Google Chrome and discuss its design principles, focusing on why extensions are webby. From: GoogleDevelopers Views: 3035 12 ratings Time: 05:25 More in Science & Technology

    Read the article

  • Google Chrome Extensions: Launch Event (part 3)

    Google Chrome Extensions: Launch Event (part 3) Video Footage from the Google Chrome Extensions launch event on 12/09/09. Erik Kay and Aaron Boodman, technical leads for the Google Chrome Extensions team demonstrate how to build, debug and share a Google Chrome extension. From: GoogleDevelopers Views: 2974 13 ratings Time: 08:28 More in Science & Technology

    Read the article

  • Google Chrome Extensions: UI Design

    Google Chrome Extensions: UI Design Erik Kay, an engineer at Google, provides more information about the UI of Google Chrome's extension system. For more information visit code.google.com/chrome/extensions. From: GoogleDevelopers Views: 10120 57 ratings Time: 03:49 More in Science & Technology

    Read the article

  • Google Chrome Extensions: Launch Event (part 2)

    Google Chrome Extensions: Launch Event (part 2) Video Footage from the Google Chrome Extensions launch event on 12/09/09. Aaron Boodman and Erik Kay technical leads for the Google Chrome extensions team present a quick history of the extensions system of Google Chrome and discuss its design principles, focusing on why extensions are webby. From: GoogleDevelopers Views: 3036 12 ratings Time: 05:25 More in Science & Technology

    Read the article

  • Google I/O 2010 - Developing web apps for Chrome Web Store

    Google I/O 2010 - Developing web apps for Chrome Web Store Google I/O 2010 - Developing web apps for the Chrome Web Store Chrome 101 Erik Kay Google Chrome is a powerful platform for developing web apps. With Chrome web apps, we're making it easier for users to discover and use these apps. Learn how to build and sell apps for the Chrome Web Store. For all I/O 2010 sessions, please go to code.google.com From: GoogleDevelopers Views: 8 0 ratings Time: 01:00:29 More in Science & Technology

    Read the article

  • Google Chrome Extensions: Launch Event (part 4)

    Google Chrome Extensions: Launch Event (part 4) Video Footage from the Google Chrome Extensions launch event on 12/09/09. Aaron Boodman and Erik Kay, technical leads for the Google Chrome extensions team discuss the UI surfaces of Google Chrome extensions and the team's content not chrome philosophy. They also highlight the smooth, frictionless install and uninstall process for Google Chrome's extensions system and present the team's initiatives in the space of security and performance. From: GoogleDevelopers Views: 2968 12 ratings Time: 15:44 More in Science & Technology

    Read the article

  • Google Chrome Extensions: Launch Event (part 3)

    Google Chrome Extensions: Launch Event (part 3) Video Footage from the Google Chrome Extensions launch event on 12/09/09. Erik Kay and Aaron Boodman, technical leads for the Google Chrome Extensions team demonstrate how to build, debug and share a Google Chrome extension. From: GoogleDevelopers Views: 2975 13 ratings Time: 08:28 More in Science & Technology

    Read the article

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