Search Results

Search found 294 results on 12 pages for 'benjamin hannah'.

Page 10/12 | < Previous Page | 6 7 8 9 10 11 12  | Next Page >

  • Is it bad practice to change state inside of an if statement?

    - by Benjamin
    I wrote some code that looks similar to the following: String SKIP_FIRST = "foo"; String SKIP_SECOND = "foo/bar"; int skipFooBarIndex(String[] list){ int index; if (list.length >= (index = 1) && list[0].equals(SKIP_FIRST) || list.length >= (index = 2) && (list[0] + "/" + list[1]).equals(SKIP_SECOND)){ return index; } return 0; } String[] myArray = "foo/bar/apples/peaches/cherries".split("/"); print(skipFooBarIndex(myArray); This changes state inside of the if statement by assigning index. However, my coworkers disliked this very much. Is this a harmful practice? Is there any reason to do it?

    Read the article

  • sql query need a help.

    - by benjamin button
    If i have a table with two fields.customer id and order. let's say i have in total order ID 1,2,3,4 all the customer can have all the four orders.like below 1234 1 1234 2 1234 3 1234 4 3245 3 3245 4 5436 2 5436 4 you can see above that 3245 customer doesnt have order id 1 and 2. how could i print in the query output like 3245 1 3245 2 5436 1 5436 3 EDIT: i dont order table but i have list of order's like we can hard code it in the query(1,2,3,4) i dont have an orders table.

    Read the article

  • Using tarantula to test a Rails app

    - by Benjamin Oakes
    I'm using Tarantula to test a Rails app I'm developing. It works pretty well, but I'm getting some strange 404s. After looking into it, Tarantula is following DELETE requests (destroy actions on controllers) throughout my app when it tests. Since Tarantula gets the index action first (and seems to keep a list of unvisited URLs), it eventually tries to follow a link to a resource which it had deleted... and gets a 404. Tarantula is right that the URL doesn't exist anymore (because it deleted the resource itself). However, it's flagging it as an error -- that's hardly the behavior I would expect. I'm basically just using the Rails scaffolding and this problem is happening. How do I prevent Tarantula doing this? (Or, is there a better way of specifying the links?) Updates: Still searching, but I found a relevant thread here: http://github.com/relevance/tarantula/issues#issue/3 Seems to be coming from relying on JS too much, in a way (see also http://thelucid.com/2010/03/15/rails-can-we-please-have-a-delete-action-by-default/)

    Read the article

  • Perl -check for uninitialized value

    - by benjamin button
    I am doing the below in a perl script: my @pm1_CS_missing_months = `sqlplus -s $connstr \@DLmissing_months.sql`; it takes the output of an sql query. if i have to check for no rows selected,how could i do it? i want to do like this: if(no rows selected) { do this; }

    Read the article

  • percentage of memory used used by a process

    - by benjamin button
    percentage of memory used used by a process. normally prstat -J will give the memory of process image and RSS(resident set size) etc. how do i knowlist of processes with percentage of memory is used by a each process. i am working on solaris unix. addintionally ,what are the regular commands that you use for monitoring processes,performences of processes that might be very useful to all!

    Read the article

  • NET USE command And Network Provider interface.

    - by Benjamin
    When we command "net use" on command prompt, the result has four columns. Status Local Remote Network OK Z: \\10.x.x.x\Public Microsoft Windows Network X: \\10.y.y.y\Public My Network Redirector The Microsoft Windows Network(SMB)'s Status has OK value, but we don't. It's just empty. We implemented NPEnumResource function in our Network Provider dll. But I don't know how can I set the value(OK). How can I do that? Thanks

    Read the article

  • I can't apply prefast /StackHogThreshold option.

    - by Benjamin
    I'm using ddkbuild for building my driver. And I use prefast also. Prefast has /StackHogThreshold option. The default value is 1024 Bytes. But I can't modify the value. It's my input for 'Rebuild All Command Line' C:\Windows\System32\cmd.exe /k "$(SolutionDir)....\ddkbuild.bat" -WIN7WLHA64 -prefast free $(ProjectDir) -cZ

    Read the article

  • Can someone who understands C code help me understand this code?

    - by Benjamin
    INT GetTree (HWND hWnd, HTREEITEM hItem, HKEY *pRoot, TCHAR *pszKey, INT nMax) { TV_ITEM tvi; TCHAR szName[256]; HTREEITEM hParent; HWND hwndTV = GetDlgItem (hWnd, ID_TREEV); memset (&tvi, 0, sizeof (tvi)); hParent = TreeView_GetParent (hwndTV, hItem); if (hParent) { // Get the parent of the parent of the... GetTree (hWnd, hParent, pRoot, pszKey, nMax); // Get the name of the item. tvi.mask = TVIF_TEXT; tvi.hItem = hItem; tvi.pszText = szName; tvi.cchTextMax = dim(szName); TreeView_GetItem (hwndTV, &tvi); //send the TVM_GETITEM message? lstrcat (pszKey, TEXT ("\\")); lstrcat (pszKey, szName); } else { *pszKey = TEXT ('\0'); szName[0] = TEXT ('\0'); // Get the name of the item. tvi.mask = TVIF_TEXT | TVIF_PARAM; tvi.hItem = hItem; tvi.pszText = szName; tvi.cchTextMax = dim(szName); if (TreeView_GetItem (hwndTV, &tvi)) //*pRoot = (HTREEITEM)tvi.lParam; //original hItem = (HTREEITEM)tvi.lParam; else { INT rc = GetLastError(); } } return 0; } The block of code that begins with the comment "Get the name of the item" does not make sense to me. If you are getting the listview item why does the code set the parameters of the item being retrieved, because if you already had the values there would be no need to retrieve them. Secondly near the comment "original" is the original line of code which will compile with a varning under embedded visual c++, but if you copy the exact same code into visual studio 2008 it will not compile. Since I did not write any of this code and am trying to learn is it possible the original author made a mistake on this line, since the *pRoot should point to and HKEY type yet he is casting to an HTREEITEM type which should never work since the data types don't match? (Side note someone with a better reputation should add a windows ce tag to SO since windows mobile is not the same as windows ce.)

    Read the article

  • Drupal 7 is unable to install modules

    - by Benjamin Wong
    My instance of Drupal 7 is unable to install new modules via FTP link. The error message that comes up is as follows : Warning: fileowner() [function.fileowner]: stat failed for temporary://upd92FE.tmp in update_manager_local_transfers_allowed() (line 924 of C:\inetpub\wwwroot\drupal\modules\update\update.manager.inc). My setup is as follows : Windows 7 Home Premium 64 Bit IIS 7.5 + Zend Community Server

    Read the article

  • What's wrong with this statement in perl?

    - by benjamin button
    print "$_", join(',',sort keys %$h),"\n"; It's giving me an error below: Use of uninitialized value in string at missing_months.pl line 36. 1,10,11,12 this print statement is present in a for loop as below: foreach my $num ( sort keys %hash ) { my $h = $hash{$num}; print "$_", join(',',sort keys %$h),"\n"; }

    Read the article

  • Autocommands for Matlab in vim?

    - by Benjamin Oakes
    I use several different programming languages every day, and I'd like to have different tab widths (in spaces) for each. For example: I use the "standard" 2 spaces for Ruby, but all our existing Matlab code uses 4 spaces. I have this from my personal ~/.vimrc: augroup lang_perl au! set tabstop=4 " tabstop length N in spaces set shiftwidth=4 " make >> and friends (<<, ^T, ^D) shift N, not the default 8 set expandtab " Use spaces instead of tabs augroup END augroup lang_ruby au! set tabstop=2 " tabstop length N in spaces set shiftwidth=2 " make >> and friends (<<, ^T, ^D) shift N, not the default 8 set expandtab " Use spaces instead of tabs augroup END Those work, but the following doesn't: augroup lang_matlab au! set tabstop=4 " tabstop length N in spaces set shiftwidth=4 " make >> and friends (<<, ^T, ^D) shift N, not the default 8 set expandtab " Use spaces instead of tabs augroup END I really don't understand how augroup lang_ruby figures out that I'm editing a Ruby file. (My searches brought up ftdetect, but the solution wasn't obvious.) It doesn't seem like vim knows that I'm editing Matlab using augroup lang_matlab. What do I change to make this work?

    Read the article

  • storing an integer constant other than zero in a pointer variable

    - by benjamin button
    int main() { int *d=0; printf("%d\n",*d); return 0; } this works fine. >cc legal.c > ./a.out 0 if i change the statement int *d=0; to int *d=1; i see the error. cc: "legal.c", line 6: error 1522: Cannot initialize a pointer with an integer constant other than zero. so its obvious that it will allow only zero.i want to know what happens inside the memory when we do this int *d=0 which is making it valid syntax. I am just asking this out of curiosity!

    Read the article

  • Break a string into parts, returning all characters

    - by Benjamin
    I want to break a string according to the following rules: all consecutive alpha-numeric chars, plus the dot (.) must be treated as one part all other consecutive chars must be treated as one part consecutive combinations of 1 and 2 must be treated as different parts no whitespace must be returned For example this string: Method(hierarchy.of.properties) = ? Should return this array: Array ( [0] => Method [1] => ( [2] => hierarchy.of.properties [3] => ) [4] => = [5] => ? ) I was unsuccessful with preg_split(), as AFAIK it cannot treat the pattern as an element to be returned. Any idea for a simple way to do this?

    Read the article

  • What's the difference between PATH_NOT_FOUND and NAME_NOT_FOUND

    - by Benjamin
    In Win32 layer, we often meet ERROR_PATH_NOT_FOUND, ERROR_NAME_NOT_FOUND. When does WinAPI(eg CreateFileW, RemoveDirectoryW) return these values? And What's the difference? If I write a file system driver, when do I set STATUS_OBJECT_PATH_NOT_FOUND or STATUS_OBJECT_NAME_NOT_FOUND? I'm so confused. Is there anyone who can explain clearly? Or are there any documents explain this? I couldn't find them. Thanks in advance.

    Read the article

  • How do I use Perl to parse the output of the sqlplus command?

    - by benjamin button
    I have an SQL file which will give me an output like below: 10|1 10|2 10|3 11|2 11|4 . . . I am using this in a Perl script like below: my @tmp_cycledef = `sqlplus -s $connstr \@DLCycleState.sql`; after this above statement, since @tmp_cycledef has all the output of the SQL query, I want to show the output as: 10 1,2,3 11 2,4 How could I do this using Perl?

    Read the article

  • Why do I get strange output from Perl using SQL?

    - by benjamin button
    Here is my Perl code: foreach my $line (@tmp_field_validation) { chomp $line; my ($cycle_code,$cycle_month,$cycle_year)= split /\s*\|\s*/, $line; $cycle_code=~ s/^\s*(.*)\s*$/$1/; $cycle_month=~ s/^\s*(.*)\s*$/$1/; $cycle_year=~ s/^\s*(.*)\s*$/$1/; print "$line\n"; print "$cycle_code|$cycle_month|$cycle_year"; } Here is the output: 1 10 2009 1 10 2009|| What's wrong over here? I expected the pipes to be between the variables. Why are the pipes getting printed after all the three variables?

    Read the article

  • sorting group of lines

    - by benjamin button
    I have a text file like below iv_destination_code_10 TAP310_mapping_RATERUSG_iv_destination_code_10 RATERUSG.iv_destination_code_10 = WORK.maf_feature_info[53,6] iv_destination_code_2 TAP310_mapping_RATERUSG_iv_destination_code_2 RATERUSG.iv_destination_code_2 = WORK.maf_feature_info[1,6] iv_destination_code_3 TAP310_mapping_RATERUSG_iv_destination_code_3 RATERUSG.iv_destination_code_3 = WORK.maf_feature_info[7,6] iv_destination_code_4 TAP310_mapping_RATERUSG_iv_destination_code_4 RATERUSG.iv_destination_code_4 = WORK.maf_feature_info[13,6] iv_destination_code_5 TAP310_mapping_RATERUSG_iv_destination_code_5 RATERUSG.iv_destination_code_5 = WORK.maf_feature_info[19,6] iv_destination_code_6 TAP310_mapping_RATERUSG_iv_destination_code_6 RATERUSG.iv_destination_code_6 = WORK.maf_feature_info[29,6] iv_destination_code_7 TAP310_mapping_RATERUSG_iv_destination_code_7 RATERUSG.iv_destination_code_7 = WORK.maf_feature_info[35,6] iv_destination_code_8 TAP310_mapping_RATERUSG_iv_destination_code_8 RATERUSG.iv_destination_code_8 = WORK.maf_feature_info[41,6] iv_destination_code_9 TAP310_mapping_RATERUSG_iv_destination_code_9 RATERUSG.iv_destination_code_9 = WORK.maf_feature_info[47,6] combination of three lines form a unit: iv_destination_code_9 TAP310_mapping_RATERUSG_iv_destination_code_9 RATERUSG.iv_destination_code_9 = WORK.maf_feature_info[47,6] is one unit. iv_destination_code_9 9 indicates the number by which i have to sort 10 9 8.... i need a shell script/awk which will sort the units in a descending order. how is it possible?

    Read the article

  • Are L'A' and 'A' totally same?

    - by Benjamin
    When we write a program which supports both unicode and multibytes, we often use _T("some string") macro for strings. But, does a character also need to wrap this macro? Are L'A' and 'A' totally same? Don't we need to use _T('A') for a character?

    Read the article

  • How can we manage ProductVersion(A Windows Resource) automatically?

    - by Benjamin
    Windows resources have a FileVersion and a ProductVersion. In native development environment(eg. Win32 app, device driver) How do you manage the ProductVerion automatically? My language is c/c++. And I use Visual Studio 2008. I want to increase the version automatically when I build my projects. Is it possible? I guess there is a simple(and good) way. Thanks in advance.

    Read the article

  • PHP Get images from a UL list

    - by benjamin shrimpton
    I have a long UL list and each LI contains an image tag, dynamically generated from SLideshowPro Director. I need to get the widths of ALL the images inside the UL to use in a CSS width calculation. I have been able to get the image width for the first item, but not all. My PHP is pretty limited, but do I have to make this list into an ARRAY first to allow me to get all the widths? And how do i do that?? These images contain very long id's generated by the CMS, so reading through a directory is not possible, as the images in cache bare not relation to the file names that are output to the HTML page. It has to all be done from the content that's sent to the page. Or could I even use JQuery to do this??

    Read the article

< Previous Page | 6 7 8 9 10 11 12  | Next Page >