Search Results

Search found 29841 results on 1194 pages for 'random number generator'.

Page 116/1194 | < Previous Page | 112 113 114 115 116 117 118 119 120 121 122 123  | Next Page >

  • OpenOffice Calc: How can I count the number of different items with data pilot?

    - by manu
    Hi all, I have a rather long spreadsheet with historical information of issues solved by some user on a colaborative environment. The spreadsheet have the following (relevant) columns date, week no., project, author id, etc... The week no. is calculated from the date, is basically the year concatenated with the week number within that year; for instance, both 2009-02-18 and 2009-02-20 yield the week number 200908 - the 8th week of year 2009; and 2009-02-23 yields 200909 - the 9th week of year 2009. I need to count how many different users (given by author id) contributed to some project, on a weekly basis. I have setup a data pilot with the week as Row Field, the project as the Column Field, and count-author as the Data Field. However, this counts the author id as different instances. This is not what I need. I need to count how many different users contributed to each project on a weekly basis. I expect to get something like: projects week Project1 Project2 Project3 200901 10 2 200902 2 7 Each inner cell containing how many different users contributed. With the count-author configuration, what I get is how many contributions (total) got the project on that week. Is there a way to tell OpenOffice Calc to do what I want?

    Read the article

  • Do large number of internal broken links affect SEO?

    - by TheBigK
    We've a WordPress blog and had disqus plugin in stalled for several months. Around late August this year, the plugin created a ton of URLs that linked to non-existent location on our website. For example - Correct URL: domain.com/correct-URL/ Disqus created - domain.com/correct-URL/344322/ - Throws 404 domain.com/correct-URL/433466/ - Throws 404 So essentially, Google found a LARGE number of broken links that pointed to unknown locations on our own domain. As the count of those errors (404) rose, our site suffered massive drop in traffic and crawl rate dropped to 10% of what it was earlier. I wish to know - Can large number of (we've over 99k of them) internal broken links cause rankings to drop? I've fixed the issue in one go by creating 301 redirects for each bad URL to correct URL and removing disqus. Google however drops the count by ~1000 daily, as I mark errors as 'fixed' in Google Webmaster Tools. Is there any way to speed this up? Should I setup custom crawl rate to 'Fast' in GWT to make Google crawl our website faster? I'd appreciate your inputs and experience sharing.

    Read the article

  • How do I interpret direct traffic that lands on random pages?

    - by mfg
    Looking at yesterday, according to Google Analytics, I got six direct visitors to my site (their source/medium is direct/(none)). Only one ended up at the actual domain. The other five ended up at miscellaneous foo.com/xyz.html. I did not send out links to people by email, and I'm not sure how likely it is the people would have copy/pasted the URLs. How do the visitors end up there? Is there a way to better capture where they might be coming from?

    Read the article

  • Are there any good examples of open source C# projects with a large number of refactorings?

    - by Arjen Kruithof
    I'm doing research into software evolution and C#/.NET, specifically on identifying refactorings from changesets, so I'm looking for a suitable (XP-like) project that may serve as a test subject for extracting refactorings from version control history. Which open source C# projects have undergone large (number of) refactorings? Criteria A suitable project has its change history publicly available, has compilable code at most commits and at least several refactorings applied in the past. It does not have to be well-known, and the code quality or number of bugs is irrelevant. Preferably the code is in a Git or SVN repository. The result of this research will be a tool that automatically creates informative, concise comments for a changeset. This should improve on the common development practice of just not leaving any comments at all. EDIT: As Peter argues, ideally all commit comments would be teleological (goal-oriented). Practically, if a comment is made at all it is often descriptive, merely a summary of the changes. Sadly we're a long way from automatically inferring developer intentions!

    Read the article

  • Given an integer, determine if it is a Palindrome in less than O(n) [on hold]

    - by user134235
    There is an O(n) solution to the problem of determining if an integer is a palindrome below. Is it possible to solve this problem in O(log n) or better? static void IsPalindrome(int Number) { int OrignalNum = Number; int Reverse = 0; int Remainder = 0; if (Number > 0) { while (Number > 0) { Remainder = Number % 10; Reverse = Reverse * 10 + Remainder; Number = Number / 10; } if (OrignalNum == Reverse) Console.WriteLine("It is a Palindrome"); else Console.WriteLine("It is not a Palindrome"); } else Console.WriteLine("Enter Number Again"); }

    Read the article

  • Ubuntu 11.10 Random reboots how to find root cause?

    - by Indigo42
    All, This issue started with 11.04, I upgraded to 11.10 this week in hopes it would correct it, but after a few days it happened again.. A few times a day, randomly, my monitors will go black and the machine will come back in the post screen and boot up again. Sometimes it boots up properly, sometimes it boots to disk scan (I understand why...the machine just died with a bunch of stuff open) and sometimes it takes several cycles of this to come up. I connected to the system with my laptop and tailed dmesg, syslog, kern.log, and Xorg.0.log. I also ran a cat /proc/kmesg. Nothing is showing up in any of these log files when it happens..it's just like someone has pulled the plug. I just got through running 4 hours of the memory test with no errors. I have a AMD Phenom 9850 Quad-Core Processor and Nvida 9500GT graphics card. This system has been stable for like 4 years. I'm thinking it might be a hardware problem, but how do I find out? Thanks,

    Read the article

  • Segmentation. strcmp [C]

    - by FILIaS
    Hello, I have a file with format: [name][number][amount] number is taken as a string. and im using it in a strcmp. Problem is that i get a segmentation fault. I know that on most cases when strcmp signs segmentation fault it means that one of the parameters is null or cant find its "end" ('\0'). I checked with gdb and i cant say if this is the problem.Take a look: > (gdb) bt full > #0 0x08048729 in lookup (hashtable=0x804b008, hashval=27, > number=0x804b740 "6900101001") > list = 0xffffffff > #1 0x080487ac in add (hashtable=0x804b008, > number=0x804b740 "9900101001", name=0x804b730 "Smithpolow", > time=6943) > new_elem = 0xffffffff > hashval = 27 > #2 0x08048b25 in main (argc=1, argv=0xbffff4b4) > number = 0x804b740 "9900101001" > name = 0x804b730 "Smithpolow" > time = 6943 > i = 2 Code: clientsList *lookup_on_Clients(clientsHashTable *hashtable,int hashval,char number[10]) { printf("NUMBER:%s\n",number); clientsList *list=hashtable[hashval].head; for(list; list!=NULL; list=list->next){ if (strcmp(number,list->number)==0) //SEGMENTATION! return list; } return NULL; } int add ( HashTable* hashtable,char number[10],char* name,int time) { List *new_elem; int hashval=hash (hashtable,number); new_elem=hashtable[hashval].head; if(hashtable[hashval].length>0) { if ((lookup (hashtable,hashval,number))!=NULL) {return 0;} } //an den uparxei stoixeio sth lista if (!(new_elem=malloc(sizeof(struct clientsList)))){ return -1;} //insert values for the new elem new_elem->number=strdup(number); new_elem->name=strdup(name); new_elem->time=time; hashtable[hashval].head=new_elem; new_elem->next=NULL; hashtable[hashval].length++; /* rehash existing entries if necessary */ if(hashTableSize(hashtable)>= 2*primes[PrimesIndex]) { hashtable = expand(hashtable); if (hashtable ==NULL){ return 0; } PrimesIndex++; } return 1; } and the main: FILE * File2; if ( ( File2=fopen(" File.txt","r")) !=NULL ) { // File.txt format: [name number time] e.g lountemis 6900254565 700651 int li = 0; char *lin = (char *) malloc(MAX_LINE * sizeof(char)); while(fgets(lin, MAX_LINE, clientFile2) != NULL) { token = my_linetok(lin, " "); if(token != NULL) { char* number ; char* name; int time; int i; for(i = 0; token[i] != NULL; i++) { name=strdup(token[0]); number=strdup(token[1]); time=atoi(token[2]); if (i==2) { int insertDone=0; insertDone =add(my_hash_table,number,name,time); } } free(name); free(number); free(token); } else { printf("Error reading line %s\n", lin); exit(1); } } } else { printf("Error opening file \nEXIT!"); exit(0); }

    Read the article

  • set target.id to div id and a number?

    - by Claes Gustavsson
    The target id below is map_external, but I would like to get map_external(and a number) I have this: $('#jqt').bind('pageAnimationStart', function(e, info){ if (e.target.id == 'map_external') { if (info.direction =='in') { localiser(); } and it works, and my target page looks like this: <div id="map_external"> content.... </div> but I would like to have a random number aswell, like this: <div id="map_external<%=asp random number%>"> content.... </div> so how do i write if (e.target.id == 'map_external') so that it gets map_external and a number(any number)? Thanks!

    Read the article

  • Give a number to return the approximated value of an Enum?

    - by ElektroStudios
    I have this enumeration: Enum Lame_Bitrate kbps_8 = 8 kbps_16 = 16 kbps_24 = 24 kbps_32 = 32 kbps_40 = 40 kbps_48 = 48 kbps_56 = 56 kbps_64 = 64 kbps_80 = 80 kbps_96 = 96 kbps_112 = 112 kbps_128 = 128 kbps_144 = 144 kbps_160 = 160 kbps_192 = 192 kbps_224 = 224 kbps_256 = 256 kbps_320 = 320 End Enum And I would like to return the approximated value of the Enum given a number. For example, if I have the number 190 then I expect to find the more approximated value in the Enum to return the 192 (kbps_192 value of the Enum), if I have the number 196 then again I expect to return the value 192 (not return the next value 224 because is less approximated). Something like this: Private Sub Test() Dim wma_file As String = "C:\windows media audio file.wma" Dim wma_file_Bitrate As Integer = 172 Dim mp3_bitrate_approximated As Integer mp3_bitrate_approximated = Return_Approximated_Value_Of_Enum(wma_file_Bitrate) End Sub private function Return_Approximated_Value_Of_Enum(byval value as integer) as integer return... enum.find(value).approximated... end function Exist any framework method to find the more approximated number given other number in a Enum? I hope you can understand my question, thank you. PS: I prefer a solution using LINQ extensions if can be.

    Read the article

  • In SQL, how can I count the number of values in a column and then pivot it so the column becomes the

    - by Josh Yeager
    I have a survey database with one column for each question and one row for each person who responds. Each question is answered with a value from 1 to 3. Id Quality? Speed? -- ------- ----- 1 3 1 2 2 1 3 2 3 4 3 2 Now, I need to display the results as one row per question, with a column for each response number, and the value in each column being the number of responses that used that answer. Finally, I need to calculate the total score, which is the number of 1's plus two times the number of 2's plus three times the number of threes. Question 1 2 3 Total -------- -- -- -- ----- Quality? 0 2 2 10 Speed? 2 1 1 7 Is there a way to do this in set-based SQL? I know how to do it using loops in C# or cursors in SQL, but I'm trying to make it work in a reporting tool that doesn't support cursors.

    Read the article

  • Grouping parent node based on child elements values and sequence number.

    - by Mahir
    Hi, I need to transform XML using xslt. Logic: Split the parent if the parent having different child address and append the sequence number with parent name. Also need line number for the child. Here we may have number of parent nodes and each parent node may have more number of child nodes. I have tried numerous ways to achieve this and I am stuck with generating sequence number in the foreach. So can any one try and give a solution for this. Source XML as below: P1 CName1 Address1 CName2 Address2 CName3 Address1 P2 CName1 Address1 The target XML should as below: P1_1 CName1 Address1 1 CName2 Address2 2 CName3 Address1 P1_2 1 CName2 Address2 P2_1 1 CName1 Address1

    Read the article

  • Best way to randomly select columns from random rows of SQL results.

    - by LesterDove
    A search of SO yields many results describing how to select random rows of data from a database table. My requirement is a bit different, though, in that I'd like to select individual columns from across random rows in the most efficient/random/interesting way possible. To better illustrate: I have a large Customers table, and from that I'd like to generate a bunch of fictitious demo Customer records that aren't real people. I'm thinking of just querying randomly from the Customers table, and then randomly pairing FirstNames with LastNames, Address, City, State, etc. So if this is my real Customer data (simplified): FirstName LastName State ========================== Sally Simpson SD Will Warren WI Mike Malone MN Kelly Kline KS Then I'd generate several records that look like this: FirstName LastName State ========================== Sally Warren MN Kelly Malone SD Etc. My initial approach works, but it lacks the elegance that I'm hoping the final answer will provide. (I'm particularly unhappy with the repetitiveness of the subqueries, and the fact that this solution requires a known/fixed number of fields and therefore isn't reusable.) SELECT FirstName = (SELECT TOP 1 FirstName FROM Customer ORDER BY newid()), LastName= (SELECT TOP 1 LastNameFROM Customer ORDER BY newid()), State = (SELECT TOP 1 State FROM Customer ORDER BY newid()) Thanks!

    Read the article

  • MATLAB: What is an appropriate Data Structure for a Matrix with Random Variable Entries?

    - by user568249
    I'm currently working in an area that is related to simulation and trying to design a data structure that can include random variables within matrices. To motivate this let me say I have the following matrix: [a b; c d] I want to find a data structure that will allow for a, b, c, d to either be real numbers or random variables. As an example, let's say that a = 1, b = -1, c = 2 but let d be a normally distributed random variable with mean 0 and SD 1. The data structure that I have in mind will give no value to d. However, I also want to be able to design a function that can take in the structure, simulate an uniform(0,1), obtain a value for d using an inverse CDF and then spit out an actual matrix. I have several ideas to do this (all related to the MATLAB icdf function) but would like to know how more experienced programmers would do this. In this application, it's important that the structure is as "lean" as possible since I will be working with very very large matrices and memory will be an issue.

    Read the article

  • MKV video suddenly stops playing after random time - what could this be?

    - by MEM
    I have this HP USB drive (16GB, NTFS formatted) that has, a MKV video. The USB is always detectable, so is the MKV, but when I connect that USB drive with that MKV video on my HT-C5530 home cinema USB port, the playback just suddenly stops after random time, and it returns to the main menu when I can see the pen and it's contents. I really have no clue about what could be the issue here, has someone else experience something similar? That may help me out on this.

    Read the article

  • With Go, how to append unknown number of byte into a vector and get a slice of bytes?

    - by Stephen Hsu
    I'm trying to encode a large number to a list of bytes(uint8 in Go). The number of bytes is unknown, so I'd like to use vector. But Go doesn't provide vector of byte, what can I do? And is it possible to get a slice of such a byte vector? I intends to implement data compression. Instead of store small and large number with the same number of bytes, I'm implements a variable bytes that uses less bytes with small number and more bytes with large number. My code can not compile, invalid type assertion: 1 package main 2 3 import ( 4 //"fmt" 5 "container/vector" 6 ) 7 8 func vbEncodeNumber(n uint) []byte{ 9 bytes := new(vector.Vector) 10 for { 11 bytes.Push(n % 128) 12 if n < 128 { 13 break 14 } 15 n /= 128 16 } 17 bytes.Set(bytes.Len()-1, bytes.Last().(byte)+byte(128)) 18 return bytes.Data().([]byte) // <- 19 } 20 21 func main() { vbEncodeNumber(10000) } I wish to writes a lot of such code into binary file, so I wish the func can return byte array. I haven't find a code example on vector.

    Read the article

  • What grammar based parser-generator tools exist for ruby?

    - by cartoonfox
    What open source (preferably gem-based) parser-generator options do I have in Ruby? I've used (flex&bison)|(lex&yacc) from C in the past, and I'm comfortable with BNF-style specifications. I've heard of treetop, but it looks a bit alien and verbose compared to yacc... Purpose: I want to convert my text markup language to a BNF and generate the parsing code. I think it's a better strategy than my first-order solution: http://github.com/dafydd/semantictext/blob/master/lib/semantictext/rich_text_parser.rb

    Read the article

  • How can I stop a movie (from current frame) playing when I click on next frame - FLASH CS4?

    - by ladygeekgeek
    I have four movie clips (.f4v) in 4 frames in a movie with watch buttons.. This movie has them been imported into a main movie container that has next and previous buttons. However if i play a movie then hit next frame, the movie continues to play in the background. How can I shop this? The code below shows one of the actionscripts for a movie clip and then the main actionscript in the main movie. I am a flash newbie, so all help appreciated. Many thanks. stop(); watch1_btn.addEventListener(MouseEvent.CLICK, playMovie1); function playMovie1(event:MouseEvent):void { movie1_mc.play(); } // Button Listeners next_btn.addEventListener(MouseEvent.CLICK, nextSection); prev_btn.addEventListener(MouseEvent.CLICK, prevSection); function nextSection(event:MouseEvent):void { var thisLabel:String = pages_mc.currentLabel; // gets current frame label as string var thisLabelNum:String = thisLabel.replace("sct", ""); // cuts the leading letters off of the number var curNumber:Number = Number(thisLabelNum); // converts that string number to a real number if (curNumber < 5) { var nextNum:Number = curNumber + 1; // adds 1 to the number so we can go to next frame label pages_mc.gotoAndStop("sct" + nextNum); // This allows us to go to the next frame label } } /////////////////////////////////////////////////////////////////////////// function prevSection(event:MouseEvent):void { var thisLabel:String = pages_mc.currentLabel; // gets current frame label as string var thisLabelNum:String = thisLabel.replace("sct", ""); // cuts the leading letters off of the number var curNumber:Number = Number(thisLabelNum); // converts that string number to a real number var prevNum:Number = curNumber - 1; // subtracts 1 from the number so we can go to next frame label pages_mc.gotoAndStop("sct" + prevNum); // This allows us to go to the previous frame label }

    Read the article

  • Should I skip authorization, with CanCan, of an action that instantiates a resource?

    - by irkenInvader
    I am writing a web app to pick random lists of cards from larger, complete sets of cards. I have a Card model and a CardSet model. Both models have a full RESTful set of 7 actions (:index, :new, :show, etc). The CardSetsController has an extra action for creating random sets: :random. # app/models/card_set.rb class CardSet < ActiveRecord::Base belongs_to :creator, :class_name => "User" has_many :memberships has_many :cards, :through => :memberships # app/models/card.rb class Card < ActiveRecord::Base belongs_to :creator, :class_name => "User" has_many :memberships has_many :card_sets, :through => :memberships I have added Devise for authentication and CanCan for authorizations. I have users with an 'editor' role. Editors are allowed to create new CardSets. Guest users (Users who have not logged in) can only use the :index and :show actions. These authorizations are working as designed. Editors can currently use both the :random and the :new actions without any problems. Guest users, as expected, cannot. # app/controllers/card_sets_controller.rb class CardSetsController < ApplicationController before_filter :authenticate_user!, :except => [:show, :index] load_and_authorize_resource I want to allow guest users to use the :random action, but not the :new action. In other words, they can see new random sets, but not save them. The "Save" button on the :random action's view is hidden (as designed) from the guest users. The problem is, the first thing the :random action does is build a new instance of the CardSet model to fill out the view. When cancan tries to load_and_authorize_resource a new CardSet, it throws a CanCan::AccessDenied exception. Therefore, the view never loads and the guest user is served a "You need to sign in or sign up before continuing" message. # app/controllers/card_sets_controllers.rb def random @card_set = CardSet.new( :name => "New Set of 10", :set_type => "Set of 10" ) I realize that I can tell load_and_authorize_resource to skip the :random action by passing :except => :random to the call, but that just feels "wrong" for some reason. What's the "right" way to do this? Should I create the new random set without instantiating a new CardSet? Should I go ahead and add the exception?

    Read the article

  • Using Loops for prompts with If/Else/Esif

    - by Dante
    I started with: puts "Hello there, and what's your favorite number?" favnum = gets.to_i puts "Your favorite number is #{favnum}?" " A better favorite number is #{favnum + 1}!" puts "Now, what's your favorite number greater than 10?" favnumOverTen = gets.to_i if favnumOverTen < 10 puts "Hey! I said GREATER than 10! Try again buddy." else puts "Your favorite number great than 10 is #{favnumOverTen}?" puts "A bigger and better number over 10 is #{favnumOverTen * 10}!" puts "It's literally 10 times better!" end That worked fine, but if the user entered a number less than 10 the program ended. I want the user to be prompted to try again until they enter a number greater than 10. Am I supposed to do that with a loop? Here's what I took a swing at, but clearly it's wrong: puts "Hello there, and what's your favorite number?" favnum = gets.to_i puts "Your favorite number is #{favnum}?" " A better favorite number is #{favnum + 1}!" puts "Now, what's your favorite number greater than 10?" favnumOverTen = gets.to_i if favnumOverTen < 10 loop.do puts "Hey! I said GREATER than 10! Try again buddy." favnumOverTen = gets.to_i until favnumOverTen > 10 else puts "Your favorite number great than 10 is #{favnumOverTen}?" puts "A bigger and better number over 10 is #{favnumOverTen * 10}!" puts "It's literally 10 times better!" end

    Read the article

  • What's the difference between single and double quotes in Objective-C?

    - by Alex Mcp
    I'm working through a book exercise to generate some random serial number, and here's my function: NSString *randomSerialNumber = [NSString stringWithFormat:@"%c%c%c%c%c", '0' + random() % 10, 'A' + random() % 26, '0' + random() % 10, 'A' + random() % 26, '0' + random() % 10]; This works and has an output like: 2J6X7. But before, the 0s and As I had wrapped in double quotes, and an example output was 11764iÒ˜. What did I do wrong my first time around, and why did using single quotes fix it?

    Read the article

  • gnuplot - multiple lines with different x ranges

    - by Aly
    Hi, I am using gnuplot to try and plot several lines but each have different x ranges. I am running the following script: # gnuplot script for 'omarConf2EvONLY-vs-everyone-gta-lag-lpas-omarConf1-random-tag-tpas.dat' plot "omarConf2EvONLY-vs-everyone-gta-lag-lpas-omarConf1-random-tag-tpas.dat" using 1:2 with lines title '1' replot "omarConf2EvONLY-vs-everyone-gta-lag-lpas-omarConf1-random-tag-tpas.dat" using 1:3 with lines title '2' replot "omarConf2EvONLY-vs-everyone-gta-lag-lpas-omarConf1-random-tag-tpas.dat" using 1:4 with lines title '3' replot "omarConf2EvONLY-vs-everyone-gta-lag-lpas-omarConf1-random-tag-tpas.dat" using 1:5 with lines title '4' replot "omarConf2EvONLY-vs-everyone-gta-lag-lpas-omarConf1-random-tag-tpas.dat" using 1:6 with lines title '5' replot "omarConf2EvONLY-vs-everyone-gta-lag-lpas-omarConf1-random-tag-tpas.dat" using 1:7 with lines title '6' replot "omarConf2EvONLY-vs-everyone-gta-lag-lpas-omarConf1-random-tag-tpas.dat" using 1:8 with lines title '7' set terminal png size 800,600 set output "omar_vs_everyone-EVONLY.png" replot and the .dat file is just a file with columns such as: 1 0.5 0.5 0.1 2 0.6 1.3 0.8 3 0.7 0.32 4 0.7 0.35 5 1.3 4.32 6 1.67 notice that the columns have different lengths as each line has different x ranges. The problem I have is that it plots funny as shown below:

    Read the article

< Previous Page | 112 113 114 115 116 117 118 119 120 121 122 123  | Next Page >