Daily Archives

Articles indexed Tuesday April 6 2010

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

  • SHA-1 and Unicode

    - by Andrew
    Hi everyone, Is behavior of SHA-1 algorithm defined for Unicode strings? I do realize that SHA-1 itself does not care about the content of the string, however, it seems to me that in order to pass standard tests for SHA-1, the input string should be encoded with UTF-8.

    Read the article

  • Error loading Mongrel in Aptana Ruby Application on Vista

    - by floatingfrisbee
    I'm brand new at Ruby. Trying to set up the first application/project using Aptana Studio. Here are my ruby and gem versions c:\>ruby -v ruby 1.9.1p378 (2010-01-10 revision 26273) [i386-mingw32] c:\>gem -v 1.3.6 I am seeing this error below while starting my ruby application. I'm developing on Vista (sucks, I know but am working on changing that) C:/Ruby/lib/ruby/gems/1.9.1/gems/activesupport-2.3.4/lib/active_support/dependencies.rb:156:in `require': 126: The specified module could not be found. - C:/Ruby/lib/ruby/gems/1.9.1/gems/mongrel-1.1.5-x86-mingw32/lib/http11.so (LoadError) from C:/Ruby/lib/ruby/gems/1.9.1/gems/activesupport-2.3.4/lib/active_support/dependencies.rb:156:in `block in require' from C:/Ruby/lib/ruby/gems/1.9.1/gems/activesupport-2.3.4/lib/active_support/dependencies.rb:521:in `new_constants_in' from C:/Ruby/lib/ruby/gems/1.9.1/gems/activesupport-2.3.4/lib/active_support/dependencies.rb:156:in `require' from C:/Ruby/lib/ruby/gems/1.9.1/gems/mongrel-1.1.5-x86-mingw32/lib/mongrel.rb:12:in `<top (required)>' from C:/Ruby/lib/ruby/gems/1.9.1/gems/activesupport-2.3.4/lib/active_support/dependencies.rb:156:in `require' from C:/Ruby/lib/ruby/gems/1.9.1/gems/activesupport-2.3.4/lib/active_support/dependencies.rb:156:in `block in require' from C:/Ruby/lib/ruby/gems/1.9.1/gems/activesupport-2.3.4/lib/active_support/dependencies.rb:521:in `new_constants_in' from C:/Ruby/lib/ruby/gems/1.9.1/gems/activesupport-2.3.4/lib/active_support/dependencies.rb:156:in `require' from C:/Ruby/lib/ruby/gems/1.9.1/gems/rack-1.0.0/lib/rack/handler/mongrel.rb:1:in `<top (required)>' from C:/Ruby/lib/ruby/gems/1.9.1/gems/rack-1.0.0/lib/rack/handler.rb:17:in `const_get' from C:/Ruby/lib/ruby/gems/1.9.1/gems/rack-1.0.0/lib/rack/handler.rb:17:in `block in get' from C:/Ruby/lib/ruby/gems/1.9.1/gems/rack-1.0.0/lib/rack/handler.rb:17:in `each' from C:/Ruby/lib/ruby/gems/1.9.1/gems/rack-1.0.0/lib/rack/handler.rb:17:in `get' from C:/Ruby/lib/ruby/gems/1.9.1/gems/rails-2.3.4/lib/commands/server.rb:45:in `<top (required)>' from C:/Users/Me - Admin/My Documents/Aptana RadRails Workspace/EventBuzz/script/server:3:in `require' from C:/Users/Me - Admin/My Documents/Aptana RadRails Workspace/EventBuzz/script/server:3:in `<top (required)>' from -e:2:in `load' from -e:2:in `<main>' As a part of fixing this issue, I've installed the following gems and updates c:\>gem update --system Updating RubyGems Nothing to update c:\>gem install rails capistrano mongrel mongrel_cluster Successfully installed rails-2.3.5 Successfully installed net-ssh-2.0.21 Successfully installed net-sftp-2.0.4 Successfully installed net-scp-1.0.2 Successfully installed net-ssh-gateway-1.0.1 Successfully installed highline-1.5.2 Successfully installed capistrano-2.5.18 Successfully installed mongrel-1.1.5-x86-mingw32 Successfully installed mongrel_cluster-1.0.5 9 gems installed Installing ri documentation for rails-2.3.5... Installing ri documentation for net-ssh-2.0.21... Installing ri documentation for net-sftp-2.0.4... Installing ri documentation for net-scp-1.0.2... Installing ri documentation for net-ssh-gateway-1.0.1... Installing ri documentation for highline-1.5.2... Installing ri documentation for capistrano-2.5.18... Installing ri documentation for mongrel-1.1.5-x86-mingw32... Installing ri documentation for mongrel_cluster-1.0.5... Updating class cache with 1380 classes... Installing RDoc documentation for rails-2.3.5... Installing RDoc documentation for net-ssh-2.0.21... Installing RDoc documentation for net-sftp-2.0.4... Installing RDoc documentation for net-scp-1.0.2... Installing RDoc documentation for net-ssh-gateway-1.0.1... Installing RDoc documentation for highline-1.5.2... Installing RDoc documentation for capistrano-2.5.18... Installing RDoc documentation for mongrel-1.1.5-x86-mingw32... Installing RDoc documentation for mongrel_cluster-1.0.5... c:\>gem install mysql Successfully installed mysql-2.8.1-x86-mingw32 1 gem installed Installing ri documentation for mysql-2.8.1-x86-mingw32... Updating class cache with 1641 classes... Installing RDoc documentation for mysql-2.8.1-x86-mingw32... Ideas as to what is going on?

    Read the article

  • How can I use a different id field for one of my CakePHP model associations?

    - by gacrux
    I have an one to many association in which a Thing can have many Statuses defined as below: Status Model: class Status extends AppModel { var $name = 'Status'; var $belongsTo = array( 'Thing' => array( 'className' => 'Thing', 'foreignKey' => 'thing_id', ); } Thing Model: class Thing extends AppModel { var $name = 'Thing'; var $belongsTo = array( // other associations ); var $hasMany = array( 'Status' => array( 'className' => 'Status', 'foreignKey' => 'thing_id', 'dependent' => false, 'order' => 'datetime DESC', 'limit' => '10', ), // other associations ); } This works OK, but I would like Thing to use a different id to connect to Status. E.g. Thing would use 'id' for all of it's other associations but use 'thing_status_id' for it's Status association. How can I best do this?

    Read the article

  • Populate Tree using data from ArrayCollection

    - by jtorrance
    Let's say I had an ArrayCollection like this: public var ac:ArrayCollection= new ArrayCollection([ {item:"dog", group:"Animal"}, {item:"orange", group:"Fruits"}, {item:"cat", group:"Animal"}, {item:"apple", group:"Fruits"} ]); How would I create a Tree component in Flex 3 that uses the groups as nodes, with the appropriate items listed under each node?

    Read the article

  • Bash on Snow Leopard doesn't obey terminal colours

    - by karbassi
    With the new version of Snow Leopard, OSX upgraded the bash version to GNU bash, version 3.2.48(1)-release (x86_64-apple-darwin10.0). Now, my .bashrc sets the following settings: # Colors export TERM=xterm-color export GREP_OPTIONS='--color=auto' GREP_COLOR='1;32' export CLICOLOR=1 export LSCOLORS=ExGxFxDxCxHxHxCbCeEbEb # Setup some colors to use later in interactive shell or scripts export COLOR_NC='\e[0m' # No Color export COLOR_WHITE='\e[1;37m' export COLOR_BLACK='\e[0;30m' export COLOR_BLUE='\e[0;34m' export COLOR_LIGHT_BLUE='\e[1;34m' export COLOR_GREEN='\e[0;32m' export COLOR_LIGHT_GREEN='\e[1;32m' export COLOR_CYAN='\e[0;36m' export COLOR_LIGHT_CYAN='\e[1;36m' export COLOR_RED='\e[0;31m' export COLOR_LIGHT_RED='\e[1;31m' export COLOR_PURPLE='\e[0;35m' export COLOR_LIGHT_PURPLE='\e[1;35m' export COLOR_BROWN='\e[0;33m' export COLOR_YELLOW='\e[1;33m' export COLOR_GRAY='\e[1;30m' export COLOR_LIGHT_GRAY='\e[0;37m' The colours are used later on for output. This used to work in previous version of OSX but not my output is as such: Some ideas that have not worked. Switching Terminal.app from 64-bit to 32-bit.

    Read the article

  • WCF + Add a Binding Extension via Code

    - by FlySwat
    I'm trying to figure out a way to add a binding extension to an endpoint via code, instead of through configuration files. Ideally I want it to simply be an attribute I place on the service method. So far it seems like the only thing that isn't exposed publicly is the binding extensions.

    Read the article

  • Is this correct for disposing an object using IDisposable

    - by robUK
    I have a class that implements the IDisposable interface. I am using a webclient to download some data using the AsyncDownloadString. I am wondering have I correctly declared my event handlers in the constructor and within the using statement of the web client? And is this correct way to remove the event handlers in the Dispose method? Overrule is this the correct way to use the IDisposable interface? public class Balance : IDisposable { //Constructor WebClient wc; public Balance() { using (wc = new WebClient()) { //Create event handler for the progress changed and download completed events wc.DownloadProgressChanged += new DownloadProgressChangedEventHandler(wc_DownloadProgressChanged); wc.DownloadStringCompleted += new DownloadStringCompletedEventHandler(wc_DownloadStringCompleted); } } ~Balance() { this.Dispose(false); } //Get the current balance for the user that is logged in. //If the balance returned from the server is NULL display error to the user. //Null could occur if the DB has been stopped or the server is down. public void GetBalance(string sipUsername) { //Remove the underscore ( _ ) from the username, as this is not needed to get the balance. sipUsername = sipUsername.Remove(0, 1); string strURL = string.Format("https://www.xxxxxxx.com", sipUsername); //Download only when the webclient is not busy. if (!wc.IsBusy) { // Download the current balance. wc.DownloadStringAsync(new Uri(strURL)); } else { Console.Write("Busy please try again"); } } //return and display the balance after the download has fully completed void wc_DownloadStringCompleted(object sender, DownloadStringCompletedEventArgs e) { //Pass the result to the event handler } //Dispose of the balance object public void Dispose() { Dispose(true); GC.SuppressFinalize(this); } //Remove the event handlers private bool isDisposed = false; private void Dispose(bool disposing) { if (!this.isDisposed) { if (disposing) { wc.DownloadProgressChanged -= new DownloadProgressChangedEventHandler(wc_DownloadProgressChanged); wc.DownloadStringCompleted -= new DownloadStringCompletedEventHandler(wc_DownloadStringCompleted); wc.Dispose(); } isDisposed = true; } } }

    Read the article

  • Thread scheduling C

    - by MRP
    include <pthread.h> include <stdio.h> include <stdlib.h> #define NUM_THREADS 4 #define TCOUNT 5 #define COUNT_LIMIT 13 int done = 0; int count = 0; int thread_ids[4] = {0,1,2,3}; int thread_runtime[4] = {0,5,4,1}; pthread_mutex_t count_mutex; pthread_cond_t count_threshold_cv; void *inc_count(void *t) { int i; long my_id = (long)t; long run_time = thread_runtime[my_id]; if (my_id==2 && done ==0) { for(i=0; i< 5 ; i++) { if( i==4 ){done =1;} pthread_mutex_lock(&count_mutex); count++; if (count == COUNT_LIMIT) { pthread_cond_signal(&count_threshold_cv); printf("inc_count(): thread %ld, count = %d Threshold reached.\n", my_id, count); } printf("inc_count(): thread %ld, count = %d, unlocking mutex\n", my_id, count); pthread_mutex_unlock(&count_mutex); } } if (my_id==3 && done==1) { for(i=0; i< 4 ; i++) { if(i == 3 ){ done = 2;} pthread_mutex_lock(&count_mutex); count++; if (count == COUNT_LIMIT) { pthread_cond_signal(&count_threshold_cv); printf("inc_count(): thread %ld, count = %d Threshold reached.\n", my_id, count); } printf("inc_count(): thread %ld, count = %d, unlocking mutex\n", my_id, count); pthread_mutex_unlock(&count_mutex); } } if (my_id==4&& done == 2) { for(i=0; i< 8 ; i++) { pthread_mutex_lock(&count_mutex); count++; if (count == COUNT_LIMIT) { pthread_cond_signal(&count_threshold_cv); printf("inc_count(): thread %ld, count = %d Threshold reached.\n",my_id, count); } printf("inc_count(): thread %ld, count = %d, unlocking mutex\n", my_id, count); pthread_mutex_unlock(&count_mutex); } } pthread_exit(NULL); } void *watch_count(void *t) { long my_id = (long)t; printf("Starting watch_count(): thread %ld\n", my_id); pthread_mutex_lock(&count_mutex); if (count<COUNT_LIMIT) { pthread_cond_wait(&count_threshold_cv, &count_mutex); printf("watch_count(): thread %ld Condition signal received.\n", my_id); count += 125; printf("watch_count(): thread %ld count now = %d.\n", my_id, count); } pthread_mutex_unlock(&count_mutex); pthread_exit(NULL); } int main (int argc, char *argv[]) { int i, rc; long t1=1, t2=2, t3=3, t4=4; pthread_t threads[4]; pthread_attr_t attr; pthread_mutex_init(&count_mutex, NULL); pthread_cond_init (&count_threshold_cv, NULL); pthread_attr_init(&attr); pthread_attr_setdetachstate(&attr,PTHREAD_CREATE_JOINABLE); pthread_create(&threads[0], &attr, watch_count, (void *)t1); pthread_create(&threads[1], &attr, inc_count, (void *)t2); pthread_create(&threads[2], &attr, inc_count, (void *)t3); pthread_create(&threads[3], &attr, inc_count, (void *)t4); for (i=0; i<NUM_THREADS; i++) { pthread_join(threads[i], NULL); } printf ("Main(): Waited on %d threads. Done.\n", NUM_THREADS); pthread_attr_destroy(&attr); pthread_mutex_destroy(&count_mutex); pthread_cond_destroy(&count_threshold_cv); pthread_exit(NULL); } so this code creates 4 threads. thread 1 keeps track of the count value while the other 3 increment the count value. the run time is the number of times the thread will increment the count value. I have a done value that allows the first thread to increment the count value first until its run time is up.. so its like a First Come First Serve. my question is, is there a better way of implementing this? I have read about SCHED_FIFO or SCHED_RR.. I guess I dont know how to implement them into this code or if it can be.

    Read the article

  • How do I find hash value of a 3D vector ?

    - by brainydexter
    I am trying to perform broad-phase collision detection with a fixed-grid size approach. Thus, for each entity's position: (x,y,z) (each of type float), I need to find which cell does the entity lie in. I then intend to store all the cells in a hash-table and then iterate through to report (if any) collisions. So, here is what I am doing: Grid-cell's position: (int type) (Gx, Gy, Gz) = (x / M, y / M, z / M) where M is the size of the grid. Once, I have a cell, I'd like to add it to a hash-table with its key being a unique hash based on (Gx, Gy, Gz) and the value being the cell itself. Now, I cannot think of a good hash function and I need some help with that. Can someone please suggest me a good hash function? Thanks

    Read the article

  • How to get raw jpeg data (but no metatags / proprietary markers)

    - by CoolAJ86
    I want to get raw jpeg data - no metadata. I'm very confused looking at the jpeg "standards". How correct is my understanding of the marker "tree"? 0xFFD8 - Identifies the file as an image 0xFFE? - EXIF, JFIF, SPIFF, ICC, etc 0x???? - the length of the tag 0xFFD8 - Start of Image 0xFFE0 - should follow SOI as per spec, but often preceded by comments ??? 0x???? - Matrices, tags, random data ??? There are never other markers in-between these markers? Or these include the matrices and such? 0xFFDA - Start of Stream - This is what I want, yes? 0xXXXX - length of stream 0xFFD9 - End of Stream (EOI) 0x???? - Comment tags, extra exif, jfif info??? 0xFFD9 - End of Image 0xFF00 - escaped 0xFF, not to be confused with a marker This has been my reading material: http://en.wikipedia.org/wiki/JPEG http://www.sno.phy.queensu.ca/~phil/exiftool/TagNames/JPEG.html http://www.media.mit.edu/pia/Research/deepview/exif.html http://www.faqs.org/faqs/jpeg-faq/part1/section-15.html

    Read the article

  • C++ ofstream cannot write to file....

    - by user69514
    Hey I am trying to write some numbers to a file, but when I open the file it is empty. Can you help me out here? Thanks. /** main function **/ int main(){ /** variables **/ RandGen* random_generator = new RandGen; int random_numbers; string file_name; /** ask user for quantity of random number to produce **/ cout << "How many random number would you like to create?" << endl; cin >> random_numbers; /** ask user for the name of the file to store the numbers **/ cout << "Enter name of file to store random number" << endl; cin >> file_name; /** now create array to store the number **/ int random_array [random_numbers]; /** file the array with random integers **/ for(int i=0; i<random_numbers; i++){ random_array[i] = random_generator -> randInt(-20, 20); cout << random_array[i] << endl; } /** open file and write contents of random array **/ const char* file = file_name.c_str(); ofstream File(file); /** write contents to the file **/ for(int i=0; i<random_numbers; i++){ File << random_array[i] << endl; } /** close the file **/ File.close(); return 0; /** END OF PROGRAM **/ }

    Read the article

  • C++ Class Templates (Queue of a class)

    - by Dalton Conley
    Ok, so I have my basic linked Queue class with basic functions such as front(), empty() etc.. and I have transformed it into a template. Now, I also have a class called Student. Which holds 2 values: Student name and Student Id. I can print out a student with the following code.. Student me("My Name", 2); cout << me << endl; Here is my display function for student: void display(ostream &out) const { out << "Student Name: " << name << "\tStudent Id: " << id << "\tAddress: " << this << endl; } Now it works fine, you can see the basic output. Now I'm declaring a queue like so.. Queue<Student> qstu; Storing data in this queue is fine, I can add new values and such.. now what I'm trying to do is print out my whole queue of students with: cout << qstu << endl; But its simply returning an address.. here is my display function for queues. void display(ostream & out) const { NodePointer ptr; ptr = myFront; while(ptr != NULL) { out << ptr->data << " "; ptr = ptr->next; } out << endl; } Now, based on this, I assume ptr-data is a Student type and I would assume this would work, but it doesn't. Is there something I'm missing? Also, when I Try: ptr->data.display(out); (Making the assumtion ptr-data is of type student, it does not work which tells me I am doing something wrong. Help on this would be much appreciated!

    Read the article

  • What's an example of duck typing in Java?

    - by Cuga
    I just recently heard of duck typing and I read the Wikipedia article about it, but I'm having a hard time translating the examples into Java, which would really help my understanding. Would anyone be able to give a clear example of duck typing in Java and how I might possibly use it?

    Read the article

  • Setting Priorities on Bottons

    - by JONY
    Hello Android Developers, I am trying to figure out how to set priorities on imagebutton. I want to have a layout with a bunch of Icon or buttons that can be selected either by touch, radio, or checked box. As these images are selected they are set on queue to be displayed in order of Precedence. (that is to be pre-determined). The images are displayed once the main action button is touched. Any help will be greatly appreciated. Thank you,

    Read the article

  • what does process geometry mean?

    - by wenlujon
    from ARM DDI 01001, there is a term: process geometry, does it mean the chip size? Caches and write buffers to improve average system performance are now commonplace in ARM® memory systems. Core clock rates have increased at a faster rate than memory access times over recent years. This factor, and smaller process geometries, the economics of on-chip memory, and system power constraints have encouraged the use of caches to meet growing system demands. thanks.

    Read the article

  • Query Execution Failed in Reporting Services reports

    - by Chris Herring
    I have some reporting services reports that talk to Analysis Services and at times they fail with the following error: An error occurred during client rendering. An error has occurred during report processing. Query execution failed for dataset 'AccountManagerAccountManager'. The connection cannot be used while an XmlReader object is open. This occurs sometimes when I change selections in the filter. It also occurs when the machine has been under heavy load and then will consistently error until SSAS is restarted. The log file contains the following error: processing!ReportServer_0-18!738!04/06/2010-11:01:14:: e ERROR: Throwing Microsoft.ReportingServices.ReportProcessing.ReportProcessingException: Query execution failed for dataset 'AccountManagerAccountManager'., ; Info: Microsoft.ReportingServices.ReportProcessing.ReportProcessingException: Query execution failed for dataset 'AccountManagerAccountManager'. ---> System.InvalidOperationException: The connection cannot be used while an XmlReader object is open. at Microsoft.AnalysisServices.AdomdClient.XmlaClient.CheckConnection() at Microsoft.AnalysisServices.AdomdClient.XmlaClient.ExecuteStatement(String statement, IDictionary connectionProperties, IDictionary commandProperties, IDataParameterCollection parameters, Boolean isMdx) at Microsoft.AnalysisServices.AdomdClient.AdomdConnection.XmlaClientProvider.Microsoft.AnalysisServices.AdomdClient.IExecuteProvider.ExecuteTabular(CommandBehavior behavior, ICommandContentProvider contentProvider, AdomdPropertyCollection commandProperties, IDataParameterCollection parameters) at Microsoft.AnalysisServices.AdomdClient.AdomdCommand.ExecuteReader(CommandBehavior behavior) at Microsoft.AnalysisServices.AdomdClient.AdomdCommand.System.Data.IDbCommand.ExecuteReader(CommandBehavior behavior) at Microsoft.ReportingServices.DataExtensions.AdoMdCommand.ExecuteReader(CommandBehavior behavior) at Microsoft.ReportingServices.OnDemandProcessing.RuntimeDataSet.RunDataSetQuery() Can anyone shed light on this issue?

    Read the article

  • weird stuff with asp.net button CSS class

    - by Alexander
    I have the following button: <Club:RolloverButton runat="server" ValidationGroup="Login1" Text="Login" ID="LoginButton" CommandName="Login" CssClass="links" /> .links { display: block; width: 96px; padding: 2px 0px 2px 0px; background: #A53602; text-align: center; text-transform: uppercase; font-size: 10px; color: #FFFFFF; } When this button shows up the first time it shows the style correctly, however if I hover my mouse over this button the layout turns into a standard button, why is that??

    Read the article

  • Forbidden Not authorized to access this feed

    - by user302593
    Hai, I want to create a sites by using java programming. but it contain error like this... Exception in thread "main" com.google.gdata.util.ServiceForbiddenException: Forbidden Not authorized to access this feed at com.google.gdata.client.http.HttpGDataRequest.handleErrorResponse(HttpGDataRequest.java:561) at com.google.gdata.client.http.GoogleGDataRequest.handleErrorResponse(GoogleGDataRequest.java:563) at com.google.gdata.client.http.HttpGDataRequest.checkResponse(HttpGDataRequest.java:536) at com.google.gdata.client.http.HttpGDataRequest.execute(HttpGDataRequest.java:515) at com.google.gdata.client.http.GoogleGDataRequest.execute(GoogleGDataRequest.java:535) at com.google.gdata.client.Service.getFeed(Service.java:1073) at com.google.gdata.client.Service.getFeed(Service.java:936) at com.google.gdata.client.GoogleService.getFeed(GoogleService.java:631) at com.google.gdata.client.Service.getFeed(Service.java:955) at lsites.getSiteFeed(lsites.java:25) at lsites.main(lsites.java:40) what i want to do? Regards, Bhuvana

    Read the article

  • PDO bindparam not working.

    - by jim
    I am trying to save data into a database using PDO. All columns save correctly with the exception of one. No matter what I try, I cannot get the data to go in. myfunc($db, $data) { echo $data; // <----- Outputs my data. example: 'jim jones' $stmt = $db->prepare("CALL test(:id, :data, :ip, :expires)"); $stmt->bindParam(':id', $id, PDO::PARAM_STR); $stmt->bindParam(':data', $data, PDO::PARAM_STR); $stmt->bindParam(':ip', $ip, PDO::PARAM_STR); $stmt->bindParam(':expires', $expires, PDO::PARAM_STR); ... } So even after verifying that the data variable in fact holds my data, the bindParam method will not bind. When I echo the data variable, I can see the data is there. It will not save though. If I copy the echo'd output of the data variable to screen and paste it into a new variable, it WILL save. I'm at this now for a couple of hours. Can someone please have a look? EDIT: I want to also mention that I have tried using bindValue() in place of bindParam() and the data for the data variable will still not save.

    Read the article

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