Search Results

Search found 31321 results on 1253 pages for 'array size'.

Page 20/1253 | < Previous Page | 16 17 18 19 20 21 22 23 24 25 26 27  | Next Page >

  • Array's index and argc signedness

    - by tusbar
    Hello, The C standard (5.1.2.2.1 Program startup) says: The function called at program startup is named main. [...] It shall be de?ned with a return type of int and with no parameters: int main(void) { /* ... */ } or with two parameters [...] : int main(int argc, char *argv[]) { /* ... */ } And later says: The value of argc shall be nonnegative. Why shouldn't argc be defined as an unsigned int, argc supposedly meaning 'argument count'? Should argc be used as an index for argv? So I started wondering if the C standard says something about the type of array's index. Is it signed? 6.5.2.1 Array subscripting: One of the expressions shall have type ‘‘pointer to object type’’, the other expression shall have integer type, and the result has type ‘‘type’’. It doesn't say anything about its signedness (or I didn't find it). It is pretty common to see codes using negatives array indexes (array[-1]) but isn't it undefined behavior? Should array's indexes be unsigned?

    Read the article

  • MYSQL and Array with PHP for create Tag Cloud

    - by asilloo
    Hi, I'm trying to make a Tag cloud for every user in own page, I'm using PHP5 and Mysql, My table named "tags" and I want to make a array but in short way. The table like below, The array can be like for user1 array={[car,1],[cat,null],[pen,1],[dvd,1],[cd,null]} Username totaltag tag1 tag2 tag3 tag4 tag5 admin 5 car cat pen dvd cd user1 1 1 1 user2 1 2 12 1 user3 3 2 10 1

    Read the article

  • Fill a array with List data

    - by marionmaiden
    How can I fill a array with the data provided by one List? For example, I have a List with Strings: List l = new ArrayList<String>(); l.add("a"); l.add("b"); l.add("c"); then I want to copy this data into a String array: String[] array = ?

    Read the article

  • Storing pointers in multi-dimensional array

    - by sdfqwerqaz1
    My intention is to create a dynamic 3D array in C++ using pointers. MyType*** myArray; myArray = new MyType**[GRID_SIZE]; for (int i = 0; i < GRID_SIZE; ++i) { myArray[i] = new MyType*[GRID_SIZE]; for (int j = 0; j < GRID_SIZE; ++j) { myArray[i][j] = new MyType[GRID_SIZE]; } } Now this 3D array is ready to store MyType instances. What is the correct syntax needed when declaring this array if I want to store pointers to MyType instead of just MyType objects in this array?

    Read the article

  • Dynamically creating/inserting into an associative array in PHP

    - by emil.mp
    I'm trying to build an associative array in PHP dynamically, and not quite getting my strategy right. Basically, I want to insert a value at a certain depth in the array structure, for instance: $array['first']['second']['third'] = $val; Now, the thing is, I'm not sure if that depth is available, and if it isn't, I want to create the keys (and arrays) for each level, and finally insert the value at the correct level. Since I'm doing this quite a lot in my code, I grew tired of doing a whole bunch of "array_key_exists", so I wanted to do a function that builds the array for me, given a list of the level keys. Any help on a good strategy for this is appreciated. I'm sure there is a pretty simple way, I'm just not getting it...

    Read the article

  • Retrieve array key passed on value PHP

    - by Doodle
    I have the following array $group= array( [0] => 'apple', [1] => 'orange', [2] => 'gorilla' ); I run the array group through an for each function and when the loop hits values of gorilla I want it to spit out the index of gorilla foreach( $group as $key){ if ($key==gorilla){ echo //<------ the index of gorilla } }

    Read the article

  • How to find the duplicate and highest value in an array

    - by Jerry
    Hello guys I have an array like this array={'a'=>'2','b'=>'5', 'c'=>'6', 'd'=>'6', 'e'=>'2'}; The array value might be different depending on the $_POST variables. My question is how to find the highest value in my array and return the index key. In my case, I need to get 'c' and 'd' and the value of 6. Not sure how to do this. Any helps would be appreciated. Thanks.

    Read the article

  • Dynamical array of strings in C

    - by Ir0nm
    I'm trying to make array of strings, I have function rLine which reads line from stdin, each inputted line I need to save in array, but I don't have any idea about number of inputted string lines. So I need to dynamically increase array size to store them, I wrote such code: char *res[2], *old = res; while( 1 ){ line = rLine( stdin ), len = strlen( line ); res[row] = (char*)malloc( len + 1); strcpy( res[row++], line); res = (char**) realloc( res, row ); /* adding 1 more row, not sure adding size row? */ if ( /*some cond*/ ) break; } But this code doesn't seem to work, how correctly declare array and increase it size?

    Read the article

  • Sorting an array based on its value

    - by MaxerDude
    I have an Array, Sample: $array { [0] { [something]=1; [something2]=2; } [1] { [something]=2; [something2]=4; } [2] { [something]=5; [something2]=2; } } I want to order the array based on the key something; So it will look like: $array { [0] { [something]=5; [something2]=2; } [1] { [something]=2; [something2]=4; } [2] { [something]=1; [something2]=2; } }

    Read the article

  • How to create a String Array and link it to a Grade array

    - by user1861544
    I have a project that I need to create 2 Arrays, one to hold Student Names and one to hold Student Scores. The user inputs the size of the array, and the array needs to be sorted using BubbleSort (putting the high scores at the top). I have started the project, created the first array for scores, I have successfully done bubble sort and sorted the grades. Now I can't figure out how to make an array for Names, and once I do how do I make the names array correspond to the Grades array BubbleSort? Here is the code I have so far. import java.util.Scanner; public class Grades { public static void main(String[]args){ { Scanner UserIn = new Scanner(System.in); System.out.print( "How many students are there? " ); int[]GradeArray = new int[UserIn.nextInt()]; for( int i=0 ; i<GradeArray.length ; i++ ) { System.out.print( "Enter Grade for Student " + (i+1) + ": " ); GradeArray[i] = UserIn.nextInt(); } bubbleSort(GradeArray); for( int i : GradeArray ) System.out.println( i ); System.out.println(); } } private static void bubbleSort(int[]GradeArray){ int n = GradeArray.length; int temp = 0; String temp2; for(int i=0; i<n; i++){ for(int j=1; j<(n-i);j++){ if(GradeArray[j-1]<GradeArray[j]){ //swap temp=GradeArray[j-1]; GradeArray[j-1]=GradeArray[j]; GradeArray[j]=temp; } } } } } Also how do I change the grades to Double? I started with Int and when I try to change everything to double I get an error saying "Found Double, expected Int".

    Read the article

  • Change find() type of contained model or array transformation

    - by Ramon Marco Navarro
    I have the following model associations: Response->Survey Response->Question Response->Choice Survey->Question Question->Choice I want to create a form where I could answer all the questions for one survey. So I used the following to return the needed data: $questions = $this->Response->Question->find('all', array( 'conditions' => array('survey_id' => $id), 'contain' => array('Choice') ) ); Sample output for debug($questions). Questions Is there a contain() option so that an associated model returns in the find('list') format so that I could use: foreach($question as $questions) { $this-Form-select('field_name', $question['Choice']); } If no option is available, how could I do this using PHP's builting array methods? PS: The foreach block won't turn into a code block. If someone could edit and fix it, please do so and delete this line. Thank you.

    Read the article

  • ruby sortby 3rd element in a multidimential array npot working properly

    - by Steven
    Hi, I'm using ruby to sort an array where each element in the array is another array. I have this: Data = Data.SortBy { |Info| info[3] } example data in this column: 3.1 2 5.65 -1 0.4 -9.43 -10.87 -2.3 It should sort this into: 5.65 3.1 2 0.4 -1 -2.3 -9.43 -10.87 But it comes out like this: 5.65 3.1 2 0.4 -1 -10.87 -2.3 -9.43 It's only comparing the first char of the float... not the whole number?

    Read the article

  • Checking array of censored words against user submitted content

    - by steve-o
    Hello, I have set up an array of censored words and I want to check that a user submitted comment doesn't contain any of these words. What is the most efficient way of doing this? All I've come up with so far is splitting the string into an array of words and checking it against the array of censored words, but I've a feeling there's a neater way of doing this.

    Read the article

  • Perl check for the existence of a value in a regular array

    - by Mel
    I am trying to figure out a way of checking for the existence of a value in an array without iterating through the array. I am reading a file for a parameter. I have a long list of parameters I do not want to deal with. I placed these unwanted parameters in an array @badparams I want to read a new parameter and if it does not exist in @badparams, process it. If it does exist in @badparams, go to the next read.

    Read the article

  • create variable from array actionscript 3

    - by steve
    I'm currently trying to make a dynamic menu via an array and a loop. So when someone clicks on the first item of the array, "menu_bag_mc" it will link to the content "menu_bag_mc_frame" (or some name that will be unique to this array) that is another movieclip that will load. Below is the code I have so far: //right here, i need to make a variable that I can put in the "addchild" so that //for every one of the list items clicked, it adds a movieclip child with //the same name (such as menu_bag_mc from above) with "_frame" appended. //I tried the next line out, but it doesn't really work. var framevar:MovieClip = menuList[i] += "_frame"; function createContent(event:MouseEvent):void { if(MovieClip(root).currentFrame == 850) { while(MovieClip(root).numChildren > 1) { MovieClip(root).removeChild(MovieClip(root).getChildAt(MovieClip(root).numChildren - 1)); } //Here is where the variable would go, to add a child directly related //to whichever array item was clicked (here, "framevar") MovieClip(root).addChild (framevar); MovieClip(root).addChild (closeBtn); } else { MovieClip(root).addChild (framevar); MovieClip(root).addChild (closeBtn); MovieClip(root).gotoAndPlay(806); } } Is there a way to make a unique variable (whatever it is) from the array so that I can name a movieclip after it so it will load the new movieclip? Thanks

    Read the article

  • Why does ffmpeg stop randomly in the middle of a process?

    - by acidzombie24
    ffmpeg feels like its taking a long time. I then look at my output file and i see it stops between 6 and 8mbs. A fully encoded file is about 14mb. Why does ffmpeg stop? My code locks up on StandardOutput.ReadToEnd();. I had to kill the process (after seeing it not move for more then 10 seconds when i see it update every second previously) then i get the results of stdout and err. stdout is "" stderr is below. The output msg shows the filesize ended. I also see a drop in my CPU usage when it stops. I copyed the argument from visual studios. CD to the same working directory and ran the cmd (bin/ffmpeg) and pasted the argument. It was able to complete. int soundProcess(string infn, string outfn) { string aa, aa2; aa = aa2 = "DEAD"; var app = new Process(); app.StartInfo.UseShellExecute = false; app.StartInfo.RedirectStandardOutput = true; app.StartInfo.RedirectStandardError = true; //*/ app.StartInfo.FileName = @"bin\ffmpeg.exe"; app.StartInfo.Arguments = string.Format(@"-i ""{0}"" -ab 192k -y {2} ""{1}""", infn, outfn, param); app.Start(); try { app.PriorityClass = ProcessPriorityClass.BelowNormal; } catch (Exception ex) { if (!Regex.IsMatch(ex.Message, @"Cannot process request because the process .*has exited")) throw ex; } aa = app.StandardOutput.ReadToEnd(); aa2 = app.StandardError.ReadToEnd(); app.WaitForExit(); if (aa2.IndexOf("could not find codec parameters") != -1) return 1; else if (aa == "DEAD" || aa2 == "DEAD") return -1; else if (aa2.Length != 0) return -2; else return 0; } The output of stderr. stdout is empty. FFmpeg version SVN-r15815, Copyright (c) 2000-2008 Fabrice Bellard, et al. configuration: --enable-memalign-hack --enable-postproc --enable-swscale --enable-gpl --enable-libfaac --enable-libfaad --enable-libgsm --enable-libmp3lame --enable-libvorbis --enable-libtheora --enable-libx264 --enable-libxvid --disable-ffserver --disable-vhook --enable-avisynth --enable-pthreads libavutil 49.12. 0 / 49.12. 0 libavcodec 52. 3. 0 / 52. 3. 0 libavformat 52.23. 1 / 52.23. 1 libavdevice 52. 1. 0 / 52. 1. 0 libswscale 0. 6. 1 / 0. 6. 1 libpostproc 51. 2. 0 / 51. 2. 0 built on Nov 13 2008 10:28:29, gcc: 4.2.4 (TDM-1 for MinGW) Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'C:\dev\src\trunk\prjname\prjname\App_Data/temp/m/o/6304266424778814852': Duration: 00:12:53.36, start: 0.000000, bitrate: 154 kb/s Stream #0.0(und): Audio: aac, 44100 Hz, stereo, s16 Output #0, ipod, to 'C:\dev\src\trunk\prjname\prjname\App_Data\temp\m\o\2.m4a': Stream #0.0(und): Audio: libfaac, 44100 Hz, stereo, s16, 192 kb/s Stream mapping: Stream #0.0 -> #0.0 Press [q] to stop encoding size= 87kB time=4.74 bitrate= 150.7kbits/s size= 168kB time=9.06 bitrate= 151.9kbits/s size= 265kB time=14.28 bitrate= 151.8kbits/s size= 377kB time=20.29 bitrate= 152.1kbits/s size= 487kB time=26.22 bitrate= 152.1kbits/s size= 594kB time=32.02 bitrate= 152.1kbits/s size= 699kB time=37.64 bitrate= 152.1kbits/s size= 808kB time=43.54 bitrate= 152.0kbits/s size= 930kB time=50.09 bitrate= 152.2kbits/s size= 1058kB time=57.05 bitrate= 152.0kbits/s size= 1193kB time=64.23 bitrate= 152.1kbits/s size= 1329kB time=71.63 bitrate= 152.0kbits/s size= 1450kB time=78.16 bitrate= 152.0kbits/s size= 1578kB time=85.05 bitrate= 152.0kbits/s size= 1706kB time=92.00 bitrate= 152.0kbits/s size= 1836kB time=98.94 bitrate= 152.0kbits/s size= 1971kB time=106.25 bitrate= 151.9kbits/s size= 2107kB time=113.57 bitrate= 152.0kbits/s size= 2214kB time=119.33 bitrate= 152.0kbits/s size= 2345kB time=126.39 bitrate= 152.0kbits/s size= 2479kB time=133.56 bitrate= 152.0kbits/s size= 2611kB time=140.76 bitrate= 152.0kbits/s size= 2745kB time=147.91 bitrate= 152.1kbits/s size= 2880kB time=155.20 bitrate= 152.0kbits/s size= 3013kB time=162.40 bitrate= 152.0kbits/s size= 3146kB time=169.58 bitrate= 152.0kbits/s size= 3277kB time=176.61 bitrate= 152.0kbits/s size= 3412kB time=183.90 bitrate= 152.0kbits/s size= 3540kB time=190.80 bitrate= 152.0kbits/s size= 3670kB time=197.81 bitrate= 152.0kbits/s size= 3805kB time=205.08 bitrate= 152.0kbits/s size= 3932kB time=211.93 bitrate= 152.0kbits/s size= 4052kB time=218.38 bitrate= 152.0kbits/s size= 4171kB time=224.82 bitrate= 152.0kbits/s size= 4277kB time=230.55 bitrate= 152.0kbits/s size= 4378kB time=235.96 bitrate= 152.0kbits/s size= 4486kB time=241.79 bitrate= 152.0kbits/s size= 4592kB time=247.50 bitrate= 152.0kbits/s size= 4698kB time=253.21 bitrate= 152.0kbits/s size= 4804kB time=258.95 bitrate= 152.0kbits/s size= 4906kB time=264.41 bitrate= 152.0kbits/s size= 5012kB time=270.09 bitrate= 152.0kbits/s size= 5118kB time=275.85 bitrate= 152.0kbits/s size= 5234kB time=282.10 bitrate= 152.0kbits/s size= 5331kB time=287.39 bitrate= 151.9kbits/s size= 5445kB time=293.55 bitrate= 152.0kbits/s size= 5555kB time=299.40 bitrate= 152.0kbits/s size= 5665kB time=305.37 bitrate= 152.0kbits/s size= 5766kB time=310.80 bitrate= 152.0kbits/s size= 5876kB time=316.70 bitrate= 152.0kbits/s size= 5984kB time=322.50 bitrate= 152.0kbits/s size= 6094kB time=328.49 bitrate= 152.0kbits/s size= 6212kB time=334.76 bitrate= 152.0kbits/s size= 6327kB time=340.99 bitrate= 152.0kbits/s

    Read the article

  • File size and mime-type before upload

    - by Marcos Placona
    Hi, I've scavenged on every single topic on this forum to try and find an answer before I posted this. Most people say you should simply use SWFUpload, some others mention Activex, and it keeps going. I know this is do-able, as Google does it with gMail when you try to upload a file that's bigger than 25mb, or executable. My question is, how can I determine the file size and mime-type before the file actually hits my server. I primarily thought it was an impossible task, but Google proves me wrong. Could anyone give me a definitive answer on how to accomplish such task? Thanks

    Read the article

  • Portable way of finding total disk size in Java (pre java 6)

    - by Wouter Lievens
    I need to find the total size of a drive in Java 5 (or 1.5, whatever). I know that Java 6 has a new method in java.io.File, but I need it to work in Java 5. Apache Commons IO has org.apache.commons.io.FileSystemUtils to provide the free disk space, but not the total disk space. I realize this is OS dependant and will need to depend on messy command line invocation. I'm fine with it working on "most" systems, i.e. windows/linux/macosx. Preferably I'd like to use an existing library rather than write my own variants. Any thoughts? Thanks.

    Read the article

  • Selected option in view when SIZE is greater than 1

    - by joe
    How do you get the selected option to be in view on page load? <select name="whatever" size="5"> <option value="1">1</option> <option value="2">2</option> <option value="3">3</option> <option value="4">4</option> <option value="5">5</option> <option value="6">6</option> <option value="7" selected>7</option> <option value="8">8</option> <option value="9">9</option> <option value="10">10</option> </select>

    Read the article

  • ODBC Storage Size

    - by dcp3450
    I'm pulling a lot of text from a MS SQL Server database. I'm not getting all the text (which includes some html. The text is stored perfectly on the database. However, when I run the query to get the data It will only pull part of the text. I pull the data using odbc_exec and store using $variable = odbc_result($runquery,"body"). if i display the content with odbc_result_all($runquery) i get part of the content. if I use echo $body; i get part of the content then some garbage and part of the text from the begining. very strange response. Is there a size limit? Any ideas what I'm missing here?

    Read the article

  • How to set the content size according to the size of UINavigation bar

    - by Deepika
    Hi all I am resizing the navigation bar when my application switches into landscape orientation. But i am not able to set the content size of navigation bar according to its height. Landscape image :- In this image the top left bar item and title of navigation bar are not resizing when it switches into landscape orientation....they should get re sized according to height of navigation bar. Please suggest me any idea for it? Thanks Deepika

    Read the article

  • Why does Python Array Module Process Strings and Lists Differently?

    - by Casey
    I'm having trouble understanding the result of the following statements: >>> from array import array >>> array('L',[0xff,0xff,0xff,0xff]) array('L', [255L, 255L, 255L, 255L]) >>> from array import array >>> array('L','\xff\xff\xff\xff') Traceback (most recent call last): File "<stdin>", line 1, in <module> ValueError: string length not a multiple of item size

    Read the article

< Previous Page | 16 17 18 19 20 21 22 23 24 25 26 27  | Next Page >