Search Results

Search found 292 results on 12 pages for 'benjamin oakes'.

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

  • Upcasting without any added data fields.

    - by Benjamin Manns
    In my project I have a generic Packet class. I would like to be able to upcast to other classes (like LoginPacket or MovePacket). The base class contains a command and arguments (greatly simplified): public class Packet { public String Command; public String[] Arguments; } I would like to have be able to convert from Packet to LoginPacket (or any other) based on a check if Packet.Command == "LOGIN". The login packet would not contain any new data members, but only methods for accessing specific arguments. For example: public class LoginPacket : Packet { public String Username { get { return Arguments[0]; } set { Arguments[0] == value; } } public String Password { get { return Arguments[1]; } set { Arguments[1] == value; } } } It would be great if I could run a simple code that would cast from Packet to LoginPacket with something like LoginPacket _Login = (LoginPacket)_Packet;, but that throws a System.InvalidCastException. It seems like this would be an easy task, as no new data is included, but I can't figure out any other way than copying everything from the Packet class to a new LoginPacket class.

    Read the article

  • How to inline a function for only release build.

    - by Benjamin
    // common.h // This is foo funtion. It has a body. __inline void foo() { /* something */ } // a.cpp #include "common.h" // for foo function // Call foo // b.cpp #include "common.h" // for foo function // Call foo I would like to inline the foo function only when I build for release. -I dont want to inline functions for Debug build. I tried it but linker errors annoyed me. In this case, foo function's body is defined in common.h header file. so if I just do //common.h #if !defined(_DEBUG) __inline #endif void foo() { /* something */ } I will be met a link error in DEBUG build. Because two modules try to include common.h. I have no idea to solve it. Is it possible?

    Read the article

  • Scala Map conversion

    - by Benjamin Metz
    I'm a Scala newbie I'm afraid: I'm trying to convert a Map to a new Map based on some simple logic: val postVals = Map("test" - "testing1", "test2" - "testing2", "test3" - "testing3") I want to test for value "testing1" and change the value (while creating a new Map) def modMap(postVals: Map[String, String]): Map[String, String] = { postVals foreach {case(k, v) => if(v=="testing1") postVals.update(k, "new value")} }

    Read the article

  • 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

  • Reading web-service information from assembly app.config file

    - by Benjamin Ortuzar
    I have a plugin architecture solution written in .NET C# 3.5, where each plug-in is an assembly loaded by the main project. Each plug-in connects to a different web-service, so I would like to have the configuration of that plugin in its own plugin.dll.config file instead of having it in the app.config of the main project. I have been looking around and I saw that i could load from each class its own config file: // Get the application configuration file. System.Configuration.Configuration config = ConfigurationManager.OpenMappedExeConfiguration(fileMap,userLevel) I see how that would help me get the basic settings from the appSettings section, but I cant see a way to read the web-service information stored in the plugin.dll.config file. Any help on how to approach this situation is very welcome.

    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

  • 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

  • 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

  • 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

  • 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

  • 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

  • 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

  • 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

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