Search Results

Search found 33736 results on 1350 pages for 'project structure'.

Page 215/1350 | < Previous Page | 211 212 213 214 215 216 217 218 219 220 221 222  | Next Page >

  • Is this the correct way to build a Perl hash that utilizes arrays?

    - by Structure
    This is the first time I have manipulated hashes and arrays in this way -- and it is working. Basically, for every key there are multiple values that I want to record and then print out in the form "key -- value -- value -- val..." My code is as follows. I am surprised that it works, so concerned that it works "by mistake". Is this the correct way to accomplish this task, or is there a more efficient or appropriate method? while ($source =~ m/(regex)/g) { #Get all key names from source $listkey = $1; #Set current list key to the current regex result. $list{$listkey} = ++$i unless $list{$listkey}; #Add the key to the hash unless it already exists. $list{$listkey} = [] unless exists $list{$listkey}; #Add an array for the hash unless the hash already exists. while ($loopcount==0) { if ($ifcount==0) { $listvalue=result_of_some_function_using_list_key; #Get the first list value from the list key. $ifcount++; #Increment so we only get the first list value once. } else { $listvalue=result_of_some_function_using_list_value; #Update the last list value. } if ($listvalue) { #If the function returned a value... push @{$list{$listkey}}, $listvalue; #...then add the value to the hash array for the key. } else { #There are no more values and we need a new key. $listkey=0; #Reset variable. $domain=0; #Reset variable. $loopcount++; #Increment loop counter to exit loop. } } $ifcount=0; #Reset count variable so the next listvalue can be generated from the new key. $loopcount=0; #Reset count variable so another loop can begin for a new key. } foreach $listkey (keys %list) { #For each key in the hash. print "$listkey --> "; #Print the key. @values = @{$list{$listkey}}; #Reference the arrays of the hash. print join ' --> ', @values; #Print the values. print "\n"; #Print new line. }

    Read the article

  • how to turn visual studio windows forms project into an application?

    - by Pieter888
    Hey everyone, I programmed an hour-sheet application and now I would like to publish it so people can install and run it. I've tried the publish function of visual studio 2008 but this gives me a clickOnce application/installer that's really confusing, but it works when I run it, but when I export the installer to another pc it installs it crashes at the end of the install. so I tried just coping the installed files but then the program crashes at startup. Is there a simple way to compile the application to a simple standalone executable or maybe containing a separate folder containing the resources (images/classes)?

    Read the article

  • Using intermediate array for hashCode and equals

    - by Basilevs
    As its a pain to handle structural changes of the class in two places I often do: class A { private B bChild; private C cChild; private Object[] structure() { return new Object[]{bChild, cChild}; } int hashCode() { Arrays.hashCode(structure); } boolean equals(Object that) { return Arrays.equals(this.structure(), ((A)that).structure()); } } What's bad about this approach besides boxing of primitives? Can it be improved?

    Read the article

  • Satisfying indirect references at runtime.

    - by automatic
    I'm using C# and VS2010. I have a dll that I reference in my project (as a dll reference not a project reference). That dll (a.dll) references another dll that my project doesn't directly use, let's call it b.dll. None of these are in the GAC. My project compiles fine, but when I run it I get an exception that b.dll can't be found. It's not being copied to the bin directory when my project is compiled. What is the best way to get b.dll into the bin directory so that it can be found at run time. I've thought of four options. Use a post compile step to copy b.dll to the bin directory Add b.dll to my project (as a file) and specify copy to output directory if newer Add b.dll as a dll reference to my project. Use ILMerge to combine b.dll with a.dll I don't like 3 at all because it makes b.dll visible to my project, the other two seem like hacks. Am I missing other solutions? Which is the "right" way? Would a dependency injection framework be able to resolve and load b.dll?

    Read the article

  • Trouble recording unique regex output to array in perl

    - by Structure
    The goal of the following code sample is to read the contents of $target and assign all unique regex search results to an array. I have confirmed my regex statement works so I am simplifying that so as not to focus on it. When I execute the script I get a list of all the regex results, however, the results are not unique which leads me to believe that my manipulation of the array or my if (grep{$_ eq $1} @array) { check is causing a problem(s). #!/usr/bin/env perl $target = "string to search"; $inc = 0; $once = 1; while ($target =~ m/(regex)/g) { #While a regex result is returned if ($once) { #If $once is not equal to zero @array[$inc] = $1; #Set the first regex result equal to @array[0] $once = 0; #Set $once equal to zero so this is not executed more than once } else { if (grep{$_ eq $1 } @array ) { #From the second regex result, check to see if the result is already in the array #If so, do nothing } else { @array[$inc] = $1; #If it is not, then assign the regex search result to the next unused position in the array in any position. $inc++; #Increment to next unused array position. } } } print @array; exit 0;

    Read the article

  • How to prevent unit test from using util from test project?

    - by calucier
    I am using eclipse and I have two projects, project1 and project1-test. Below is the example layout of my projects: project1 -src --my.package ----MyClass.java --my.package.util ----util.java project1-test -src --my.package ----MyClassTest.java --my.package.util ----util.java MyClass.java makes a static call to the util.java in project1. MyClassTests.java is testing MyClass.java. When the test class runs, it fails and complains that MyClass.java is referencing a method in util.java that doesn't exist. Under project1, the method being referenced exists in util.java but under project1-test, the method doesn't. When I run MyClassTests.java, the util.java that is being referenced from MyClass.java is from project1-test when it should be project1. Is there some way to make MyClass.java not reference util.java from project1-test when running MyClassTest.java?

    Read the article

  • Why does this PNG file look so poorly when embedded as a resource in a Qt project?

    - by George Edison
    Here is the PNG file and what it looks like in a QWebView when accessed via http://sstatic.net/so/img/logo.png: When accessed via HTTP: <img src="http://sstatic.net/so/img/logo.png" width='250' height='61' /> When accessed via a resource: <img src="qrc:/images/logo.png" width='250' height='61' /> As you can see, the only modification was the src attribute of the image tag... why the drop in quality? Edit: The file is being shrunk via width: and height: in the style attribute, if that makes a difference. I updated the code.

    Read the article

  • Combining two exe files

    - by Sophia
    Here's some background to my problem: I have a project in Visual C++ 2006 and a project in in Visual C++ 2010 Express. Both compiles to form an exe file each. I cannot convert my 2006 project to 2010 because I get a lot of "unable to load project" errors. I also cannot port my 2010 project code to 2006 (I always get errors no matter what I try, something to do with libraries). My final solution requires me to only have ONE executable. Is there anything I can do to achieve that? I've done some quick search on Google and found there to be exe joiners, but I've also heard that those things are often used to make malware. For reference, I am working with "dummy" clients, and therefore want to simplify things on their end as much as possible. Thus, having them executing one exe is better than having them execute two. Also, I do not wish for their antivirus to go haywire because I used some program to join two exe together. What do? Edit: The two project files do different things. For example, the project in VS2006 one sets up a server, and the project in VS2010 one grabs info on the user's OS. The code for the "server", I think, has a lot of dependencies and for some reason cannot convert to Visual c++ 2010. The code for "grabbing" requires some newer libraries and compiling options, and would not work if I port to 2006.

    Read the article

  • Possible to push a hash value only if it is unique?

    - by Structure
    In the example code below, assuming that the value $keyvalue is constantly changing, I am attempting to use a single line (or something similarly contained) to test and see if the current $keyvalue already exists. If it does, then do nothing. If it does not, then push it. This line would reside within a while statement which is why it needs to be contained within a few lines. Preserving order does not matter as long as there are no duplicate values. my $key = "numbers"; my $keyvalue = 1; my %hash = ($key => '1'); push (@{$hash{$key}}, $keyvalue) unless exists $hash{$key}; I am not getting any errors with use strict; use warnings;, but at the same time this is not working. In the example above, I would expect that since the default value is 1 that the $keyvalue would not be pushed as it is also 1. Perhaps I have gotten myself all turned around... Are there adjustments to get this to work or any alternatives that can be used instead to accomplish the same thing?

    Read the article

  • How to save enum settings in Visual Studio project properties?

    - by zaidwaqi
    Hi, In the Settings tab in Visual Studio, I can see Name, Type, Scope, Value table. Define settings is intuitive if the data type is already within the Type drop-down list i.e. integer, string, long etc. But I can't find enum anywhere. How do I save enum settings then? For now, I have the following which clutter my code too much. public enum Action { LOCK = 9, FORCED_LOGOFF = 12, SHUTDOWN = 14, REBOOT, LOGOFF = FORCED_LOGOFF }; and I define Action as int in the setting. Then I have to do, switch (Properties.Settings.Default.Action) { case 9: SetAction(Action.LOCK); break; case 12: SetAction(Action.FORCED_LOGOFF); break; case 14: SetAction(Action.SHUTDOWN); break; case 15: SetAction(Action.REBOOT); break; default: SetAction(Action.LOCK); break; } Would be nice if I could simply do something like SetAction(Properties.Settings.Default.Action); to replace all above but I dont know how to save enum in setting. Hope my question is clear. Thanks.

    Read the article

  • How to complete a git clone for a big project on an unstable connection?

    - by LaPingvino
    I am trying to git clone the LibreOffice codebase, but at the moment I have an internet connection by mobile phone of about 300kbps and it's just anything but stable. I can get the connection back any moment, but then the git clone process already stopped working, and no way to get it running again. Is there some way to have a more failure-resistant git clone download? One option I considered myself is to download someone else's .git directory, but that is overly dependent of others and doesn't seem like the best possible solution to me.

    Read the article

  • How can I write output to a new external file with Perl?

    - by Structure
    Maybe I am searching with the wrong keywords or this is a very basic question but I cannot find the answer to my question. I am having trouble writing the result of my whois command to a new external file. My code is below. It takes $readfilename, which is a file name which has a list of IPs, and $writefilename, which is the destination file for output. Both are user-specified. For my tests, $readfilename contains three IP addresses on three separate lines so there should be three separate whois results in the user specified output file. if ($readfilename) { open (my $inputfile, "<", $readfilename) || die "\n Cannot open the specified file. Please double check your file name and path.\n\n"; open (my $outputfile, ">", $writefilename) || die "\n Could not create write file.\n\n"; while (<$inputfile>) { my $iplookupresult = `whois $_`; print $outputfile $iplookupresult; } close $outputfile; close $inputfile; } I can execute this script and end up with a new external file, but over half of the file has binary garbage data (running on CentOS) and only one (or a portion of one) of the whois lookups is readable. I have no idea how half of my file is ending up binary... but my approach must be incorrect. Is there a better way to achieve the same result?

    Read the article

  • How can I keep up to date on the latest web development standards?

    - by Structure
    First off, I know that this question begs the other question - should the latest web development standards be followed and further will they remain relevant? That aside, I am focused on GUI development, usability, etc. Front-end web development that utilizes XHTML, CSS, JavaScript, etc. I know there are many gurus and thought leaders out there but with my projects I simply do not always have time to follow them all and keep up with the latest development standards. However, this is obviously very important. So how can I keep myself up to date on the latest web development standards while maintaining productivity? Are there any specific groups or organizations to monitor for this? Best practices that one might follow?

    Read the article

  • Is it possible to embed C code in a C# project?

    - by Jonathan
    I know that it's possible to compile my C code into a dll, and then use P/Invoke to call that code. What I wondered if it was possible to have a chunk of C code embedded directly in my code, perhaps only available to one class... Something like this (non-working) example: public class MyClass { extern "C" { int do_something_in_c(int i) { return i*2; } } public int DoSomething(int value) { return do_something_in_c(value); } } I've been trying for a few hours using Visual Studio 2008, but I'm not getting anywhere, and I suspect that it isn't actually possible. Can anyone confirm or deny this? Thanks.

    Read the article

  • Why a revert a file in EGit, but the dirty symbol '<' still exist in the project view?

    - by Happier
    I try EGit revert for several days, It's very confuse that when I revert the file following the user guide, and I still got the file dirty symbol in the related file. http://wiki.eclipse.org/EGit/User_Guide#Reverting_Changes I choose 'Replace with' - 'File in Git Index', it works, the content has been revert, but the symbol stays the same, sometimes, the symbol will disappear after a while, but sometimes, it didn't disappear. I'm using eclipse on windows, I'm not sure it's about the '\r\n' character. But I use 'Compare with ' - 'File in Git Index', two files look the same. Hope someone can tell me why, I think it can be a bug? Thank you in advance.

    Read the article

< Previous Page | 211 212 213 214 215 216 217 218 219 220 221 222  | Next Page >