Search Results

Search found 91526 results on 3662 pages for 'clean code'.

Page 209/3662 | < Previous Page | 205 206 207 208 209 210 211 212 213 214 215 216  | Next Page >

  • PHP code not working on IE

    - by Michael Frey
    I have a website with a flag. If it is clicked, the language of the website changes. Here is the code displaying the flag, which is a form with post event: <?php $pagename = $_SERVER['REQUEST_URI']; echo '<form action="'.$pagename.'" method="post"> <input name="formlanguage" type="image" '; if ($_SESSION['lang'] == 0) { echo 'alt="English" src="images/en.png" value="1" '; } else { echo 'alt="Deutsch" src="images/de.png" value="0" '; } echo '/></form>'; ?> Here is the response to that, and this part always fails on IE: if (isset($_POST['formlanguage'])) { $_SESSION['lang']=$_POST['formlanguage']; } I can not figure out why it works on Chrome but not IE. I assume that it might be a setting of IE. But what could that be?

    Read the article

  • An efficient code to determine if a set is a subset of another set

    - by Edward
    I am looking for an efficient way to determine if a set is a subset of another set in Matlab or Mathematica. Example: Set A = [1 2 3 4] Set B = [4 3] Set C = [3 4 1] Set D = [4 3 2 1] The output should be: Set A Sets B and C belong to set A because A contains all of their elements, therefore, they can be deleted (the order of elements in a set doesn't matter). Set D has the same elements as set A and since set A precedes set D, I would like to simply keep set A and delete set D. So there are two essential rules: 1. Delete a set if it is a subset of another set 2. Delete a set if its elements are the same as those of a preceding set My Matlab code is not very efficient at doing this - it mostly consists of nested loops. Suggestions are very welcome! Additional explanation: the issue is that with a large number of sets there will be a very large number of pairwise comparisons.

    Read the article

  • Refactor or Rewrite

    - by Rick J
    Hmm I have a application in flex (codebase around 20K lines) ... its sort of a social network meets digg kind of thing, I need to add more features to it. This is my first ever flex project. Now im in a dilemma as to whether to refactor or rewrite the application. Im having a lot of trouble understanding the existing code (there is no documentation and the original developer is missing!!). Anyone faced with such a dilemma before? any opinions on what i should do?

    Read the article

  • libtool failed with exit code 1 on XCode 4.3

    - by Doz
    I have XCode 4.3 and I am getting this frustrating xml-lib related error. I have a feeling its because of the fact that 4.3 is not using /Developer folder but instead the /Applications/XCode.app/... The error message is below: Libtool /Users/dkatz/Library/Developer/Xcode/DerivedData/RWEngines-ewchevfhokeivnffrputdqapsyxu/Build/Products/Release-iphonesimulator/RWEngines.framework/Versions/A/RWEngines normal i386 cd /Users/dkatz/Sites/xCode/RWA/RWEngines setenv MACOSX_DEPLOYMENT_TARGET 10.6 setenv PATH "/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin:/Applications/Xcode.app/Contents/Developer/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin" /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/libtool -static -arch_only i386 -syslibroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator5.0.sdk -L/Users/dkatz/Library/Developer/Xcode/DerivedData/RWEngines-ewchevfhokeivnffrputdqapsyxu/Build/Products/Release-iphonesimulator -filelist /Users/dkatz/Library/Developer/Xcode/DerivedData/RWEngines-ewchevfhokeivnffrputdqapsyxu/Build/Intermediates/RWEngines.build/Release-iphonesimulator/RWEngines.build/Objects-normal/i386/RWEngines.LinkFileList -ObjC -Xlinker -no_implicit_dylibs -D__IPHONE_OS_VERSION_MIN_REQUIRED=50000 -framework UIKit /Users/dkatz/Library/Developer/Xcode/DerivedData/RWEngines-ewchevfhokeivnffrputdqapsyxu/Build/Products/Release-iphonesimulator/libCorePlot-CocoaTouch.a -framework SenTestingKit -framework QuartzCore -framework Foundation -framework RWCommon -o /Users/dkatz/Library/Developer/Xcode/DerivedData/RWEngines-ewchevfhokeivnffrputdqapsyxu/Build/Products/Release-iphonesimulator/RWEngines.framework/Versions/A/RWEngines And the actual error: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/libtool failed with exit code 1 Thanks guys!

    Read the article

  • iphone: accessing the preferences localization file from code

    - by phonecoddy
    I was just facing the following problem and couldn't find a solution for it. Hopefully someone could help. The app I am working on has some preferences, which are using a localization file. Now I want to use labels in my app, which display the exact names, which are used in the localization file for the preferences. But I couldn't find a way to access the information which is stored in Settings.bundle - en.lproj - localizationfile.strings. to make this clear: If you open your preferences for your app, the display shows the localized string of the title and the value of the setting. I need to access the localized string of the title of each preference from my code. Does any know how to do this?

    Read the article

  • Is there a way to hide annotations in Netbeans or Eclipse?

    - by Boden
    Maybe a dumb question, but it would be nice if there was a way to hide or collapse Java annotations when viewing source in Netbeans (or Eclipse). I'm not finding an option and a quick search didn't turn anything up. Is this one of those "you should never want to do that, code folding is a sin!" things? Personally I'd find it useful for annotated entity classes. All the hibernate / etc annotations are just fluff that I never look at once my mapping is working fine. It's similar to imports, really. (Yes, I can use XML instead of annotations, which I might start doing. But I was just wondering...)

    Read the article

  • If you were developing shareware softwares for windows, would you target the .Net Framework or use n

    - by bohoo
    For the sake of the question, by 'shareware' I mean a software which is relatively small in size (up to few dozens of mb) and available for download and evaluation through a web site. I'm asking this question, because I don't understand something regarding the current state of windows commercial desktop development. It seems to me that: There is no reliable statistic regarding the extent of windows systems with .Net Framework installed. It makes no sense to force the end user to install the 20-60mb .Net for an application which may be smaller. Applications conforms to the term 'shareware' above have a big share on the win os market. Much of them don't need the capabilities of low level languages like c++, and therefore ideally they should be developed with a RAD enviroment. So, One would suppose there will be a blossom of RAD enviroments for native win code. But I know about only one - Delphi, and Delphi is so unpopular. How is that?

    Read the article

  • Accessing form's resources (resx file) from code

    - by kzen
    If I have a form Frm1.cs that is using some icons, images or other resources, these resources get stored in the form's resx file (Frm1.resx). My simple question is how do I access these resources from code? As a workaround I can store these resources in the Project resource file and they will be available via Properties.Resources.resourcename. However, similar syntax does not work for the resources stored in the form's resource file. While searching for a solution I have come across several references to ResourceManager class but was not able to find a way to use that to access the form's resources...

    Read the article

  • Please help me translate C# code to Ruby

    - by Valentin Vasilyev
    Here is the code: using System; using System.Collections.Generic; using System.Linq; namespace cs2 { class Program { static void Main(string[] args) { var i=Fibs.TakeWhile(x=>x < 1000).Where(x=>x % 2==0).Sum(); } static IEnumerable<long> Fibs() { long a = 0, b = 1; while (true) { yield return b; b += a; a = b - a; } } } }

    Read the article

  • How to draw flowchart for code involving opening from text file and reading them

    - by problematic
    like this code fp1=fopen("Fruit.txt","r"); if(fp1==NULL) { printf("ERROR in opening file\n"); return 1; } else { for(i=0;i<lines;i++)//reads Fruits.txt database { fgets(product,sizeof(product),fp1); id[i]=atoi(strtok(product,",")); strcpy(name[i],strtok(NULL,",")); price[i]=atof(strtok(NULL,",")); stock[i]=atoi(strtok(NULL,"\n")); } } fclose(fp1); These symbols sound too similar to differentiate their function,can anyone helps me by any method, or use names of shape according to this site http://www.breezetree.com/article-excel-flowchart-shapes.htm

    Read the article

  • Common views in viewControllers - Code re-usability

    - by Nitish
    I have few common views in most of my viewControllers. What I noticed is that I can reuse single code for all viewControllers which is absolutely wise. For this I decided to create a class Utils which has static methods like +(void)createCommonViews:(float)yAxis:(NSString*)text; In my case common views are three labels and two images. Problem : I am not able to add these views from Utils. I am wondering how can I send self as a parameter so that I may add the views from Utils. It may be wrong to add views outside the viewController. In that case what can be the solution? Taking all these views in a UIView, setting return type of Utils method as UIView and then adding UIView to viewController(after calling method from viewController) might solve my problem. But what I am looking for is some other solution. Thanks, Nitish

    Read the article

  • How do I get callgrind to dump source line information?

    - by Jeremybub
    I'm trying to profile a shared library on GNU/Linux which does real-time audio processing, so performance is important. I run another program which hooks it up to the audio input and output of my system, and profile that with callgrind. Looking at the results in KCacheGrind, I get great information about what functions are taking up most of my time. However, it won't let me look at the line by line information, and instead says I need to compile it with debugging symbols and run the profiling again. The program which I am profiling is not compiled with debug symbols, but the library is. And I know this, because interestingly, source code annotations for cachegrind work fine. When I run callgrind, it says the default is to dump source line information, but it just isn't doing that. Is there some way I could force it to, or figure out what's stopping it?

    Read the article

  • Partitioning requests in code among several servers

    - by Jacques René Mesrine
    I have several forum servers (what they are is irrelevant) which stores posts from users and I want to be able to partition requests among these servers. I'm currently leaning towards partitioning them by geographic location. To improve the locality of data, users will be separated into regions e.g. North America, South America and so on. Is there any design pattern on how to implement the function that maps the partioning property to the server, so that this piece of code has high availability and would not become a single point of failure ? f( Region ) -> Server IP

    Read the article

  • Getters and Setters: Code smell, Necessary Evil, or Can't Live Without Them [closed]

    - by Avery Payne
    Possible Duplicate: Allen Holub wrote “You should never use get/set functions”, is he correct? Is there a good, no, a very good reason, to go through all the trouble of using getters and setters for object-oriented languages? What's wrong with just using a direct reference to a property or method? Is there some kind of "semantical coverup" that people don't want to talk about in polite company? Was I just too tired and fell asleep when someone walked out and said "Thou Shalt Write Copious Amounts of Code to Obtain Getters and Setters"? Follow-up after a year: It seems to be a common occurrence with Java, less so with Python. I'm beginning to wonder if this is more of a cultural phenomena (related to the limitations of the language) rather than "sage advice". The -1 question score is complete for-the-lulz as far as I am concerned. It's interesting that there are specific questions that are downvoted, not because they are "bad questions", but rather, because they hit someone's raw nerve.

    Read the article

  • Conversion of DOM element selection code to jQuery

    - by Tom McDonnell
    I have a large Javascript codebase to convert to jQuery. The code is structured such that DOM elements are created in Javascript (using a library called DomBuilder), and saved to variables if they will be needed later, before being added to the DOM. Eg. var inputs = { submitConfirm: INPUT({type: 'button', value: 'Submit'}), submitCancel : INPUT({type: 'button', value: 'Cancel'}) }; document.appendChild(inputs.submitConfirm); Then later for example... inputs.submitCancel.style.display = 'none'; inputs.submitCancel.addEventListener('click', onClickSubmitCancel, false); My problem is that jQuery seems to lack a way of manipulating DOM elements directly, as opposed to selecting them first (with for example $('#submitCancel'). Can anyone suggest a way to directly translate the last two Javascript lines given above to use jQuery, given that the DOM elements are already available, and so do not need to be selected?

    Read the article

  • Something similar to this C# code in Ruby on Rails

    - by Jimmy
    Hey guys, I am trying to get a collection of objects based on a conditions. Now normally in C# I would do something like this employeesCollection.Where(emp => emp.Name == "john"); how can I do something similar in Ruby on Rails (I am trying to map a collection of objects to a select but I only want to map certain objects that match a condition. My current ruby on rails code looks like this <%= select( 'page', 'id', @post.pages.map {|page| [page.title, page.id]}) %> I want to add a condition to an attribute of page Can anyone help?

    Read the article

  • WiX COM+ error code

    - by Stefan
    I'm trying to register COM+ with WiX. I get the following error. Where can I find the meaning of error code -2146368486? RegisterComPlusAssemblies: DLL: <file name> ComPlusInstallExecute: ErrorInfo: Name='<file name>', ErrorCode='-2146368486', MajorRef='<name>', MinorRef='<invalid>' ComPlusInstallExecute: ErrorInfo: Name='<name>', ErrorCode='-2146368486', MajorRef='<guid>', MinorRef='<invalid>' ComPlusInstallExecute: ErrorInfo: Name='<name>', ErrorCode='-2146368486', MajorRef='<guid>', MinorRef='<invalid>' ComPlusInstallExecute: Error 0x80110401: Failed to install components ComPlusInstallExecute: Error 0x80110401: Failed to register native assembly ComPlusInstallExecute: Error 0x80110401: Failed to register assembly, key: <assembly> ComPlusInstallExecute: Error 0x80110401: Failed to register assemblies

    Read the article

  • Creating an array & outputting its code definition for preloading

    - by user422318
    I want to create a 2d array that represents my 2d canvas. For each pixel, I will look up the value and then save an integer {0, 1, 2, 3, 4} as each element of the array. Unfortunately, this takes way too friggin' long to run each time I load the game. How can I write a script that creates this array for me and outputs the array code so I can just paste it in a js file and have it preloaded? (I'm prototyping a game, so I just need to run this for my test map or two.)

    Read the article

  • Why doesn't this piece of php code work?

    - by Sam Gabriel
    Hey guys, I have a mysql database which stores an id for each picture, as well as the picture's url and its thumbnail url. the thumbnail url is something like thumbs/pic.jpg and the page I'm creating has the folder thumbs in the same place it is created. But when I run this piece of code, nothing shows up: <?php ini_set('display_errors', 'On'); error_reporting(E_ALL | E_STRICT); mysql_connect("localhost", "***", "***") or die(mysql_error()); mysql_select_db("pics") or die(mysql_error()); $results = mysql_query("select id from classpics") or die(mysql_error()); $data=mysql_fetch_array($results); foreach($data as $uno) { echo '<td valign="middle" align="center"><a class="neutral" href="../images.php?id=' . $uno['id'] . '"><img src="'. $uno['thumbs'].'" border="0" /></a></td>'; } ?>

    Read the article

  • Optimize C# Code Fragment

    - by Eric J.
    I'm profiling some C# code. The method below is one of the most expensive ones. For the purpose of this question, assume that micro-optimization is the right thing to do. Is there an approach to improve performance of this method? Changing the input parameter to p to ulong[] would create a macro inefficiency. static ulong Fetch64(byte[] p, int ofs = 0) { unchecked { ulong result = p[0 + ofs] + ((ulong)p[1 + ofs] << 8) + ((ulong)p[2 + ofs] << 16) + ((ulong)p[3 + ofs] << 24) + ((ulong)p[4 + ofs] << 32) + ((ulong)p[5 + ofs] << 40) + ((ulong)p[6 + ofs] << 48) + ((ulong)p[7 + ofs] << 56); return result; } }

    Read the article

  • PHP zip->open returns error code 5 (Read Error)

    - by Manuel Kaspar
    We had a site running, that uses the php zip functionality. Everyhthing worked fine for month - now we moved to a new server and the script doesn't work! $zip-open() returns error Code 5 what is a read error. I found out, that it has to do with the size of the zip files, as they are about 60mb. Smaller sizes about 30mb are working. What could be the reason for that? I didn't find any configuration possiblility about the size of zip files! Thanks, Manu

    Read the article

  • Running NUnit Tests from Code

    - by Dror Helper
    I'm trying to write a simple method that receives a file an runs it using NUnit. The code I managed to build using NUnit's source does not work: if(openFileDialog1.ShowDialog() != DialogResult.OK) { return; } var builder = new TestSuiteBuilder(); var testPackage = new TestPackage(openFileDialog1.FileName); var directoryName = Path.GetDirectoryName(openFileDialog1.FileName); testPackage.BasePath = directoryName; var suite = builder.Build(testPackage); TestResult result = suite.Run(new NullListener(), TestFilter.Empty); The problem is that I keep getting an exception thrown by builder.Build stating that the assembly was not found. What am I missing?

    Read the article

  • Javascript code semantics

    - by Mohammad
    if(myVar = img.parent('a').length > 0){ var Y = 1; }else{ var Y = 2; } When I run this code myVar (being announced for the first time) takes the value of img.parent('a').length > 0 and becomes either false or true depending on the case. First Question: Is this a correct way of defining myVar? Second Question: Am I defining Y for the second time? Is my second 'var' excess? i.e. should i just write Y = 2;

    Read the article

  • Perl code -need some understanding.

    - by benjamin button
    Hi i have a perl code below: foreach (@tmp_cycledef) { chomp; my ($cycle_code, $close_day, $first_date) = split(/\|/, $_,3); $cycle_code =~ s/^\s*(\S*(?:\s+\S+)*)\s*$/$1/; $close_day =~ s/^\s*(\S*(?:\s+\S+)*)\s*$/$1/; $first_date =~ s/^\s*(\S*(?:\s+\S+)*)\s*$/$1/; #print "$cycle_code, $close_day, $first_date\n"; $cycledef{$cycle_code} = [ $close_day, split(/-/,$first_date) ]; } the value of tmp_cycledef comes from output of an sql query: select cycle_code,cycle_close_day,to_char(cycle_first_date,'YYYY-MM-DD') from cycle_definition d order by cycle_code; can anybody tell me what exactly is happening inside the for loop? thanks in advance.

    Read the article

  • PHP code in Drupal 6

    - by abhishekgupta92
    A very standard example of the problem that I am facing is that of a custom content say blog type. Now there is a view namely "My Blog Posts". In that view i take the argument as User:uid. Now, for the link part i simply write the code below: global $user; and send $user-uid as the argument to User:Uid. This give me link for "My Blog Posts" or the blog posts of the logged-in user What I want is a view like "His Blog Posts". So, if i visit the profile of some other user. There should be a tab in his profile "Blog Posts by Me". So for that i need to have the UID of the user whose profile I am visiting. So, how can I get this parameter from URL of his profile or somevhere else.

    Read the article

< Previous Page | 205 206 207 208 209 210 211 212 213 214 215 216  | Next Page >