Search Results

Search found 88955 results on 3559 pages for 'code wizard'.

Page 86/3559 | < Previous Page | 82 83 84 85 86 87 88 89 90 91 92 93  | Next Page >

  • Silverlight Recruiting Application Wrap-up and Source Code

    Hey everyone, it is the day you've all been waiting for.  So what makes April 8th so special?  Today on the live webinar I added the last module to the Silverlight Recruiting Application, both in the code-behind and in the MVVM/Prism versions.  Here is a quick look at the end result: Pretty neat, right? :) To get some of the pre-requisites out of the way, to play with this you will need... Visual Studio 2008 Silverlight 3 WCF RIA Services Beta for VS2008 (last version release for 2k8) Ideally you'll all have downloaded the Q1 2010 release, but if not I included the assemblies for you as well that you'll need.  The database is also included as a SQL Server 2008 .mdf, so no need for any extra setup there either.  Once you have all that setup, click on the next link to... Download the full Telerik Silverlight Recruiting Application...Did you know that DotNetSlackers also publishes .net articles written by top known .net Authors? We already have over 80 articles in several categories including Silverlight. Take a look: here.

    Read the article

  • HTML5 point and click adventure game code structure with CreateJS

    - by user1612686
    I'm a programming beginner. I made a tiny one scene point and click adventure game to try to understand simple game logic and came up with this: CreateJS features prototypes for creating bitmap images, sprites and sounds objects. I create them and define their properties in a corresponding function (for example images(); spritesheets(), sounds()...). I then create functions for each animation sequence and "game level" functions, which handle user interactions and play the according animations and sounds for a certain event (when the level is complete, the current level function calls the next level function). And I end up with quite the mess. What would be the "standard (if something like that exists)" OOP approach to structure simple game data and interactions like that? I thought about making game.images, game.sprites, game.sounds objects, which contain all the game data with its properties using CreateJS constructors. game.spriteAnimations and game.tweenAnimations objects for sprite animations and tweens and a game.levelN object, which communicates with a game.interaction object, processing user interaction. Does this make any sense? How do you structure your simple game code? Thanks in advance!

    Read the article

  • xna download website source code

    - by Emre Canbazoglu
    I have to download the html code of a web site during the game. I am taking the poster url of a movie from the imdb web site by scrapping the html ( also other informations ). I have to do the download process many times during the game for different movies. I can download and scrap the html but downloading the html takes too much time and it causes the game to slow down(freeze while downloading). How can I solve this problem? My one approach is to download and scrap all the information and store them in a database before the game and during the game access this information from the database. I think this will work properly but that is not what I exactly want. It would be better if it is dynamic. I also thought of using multi-threading but I am a bit confused about how to implement threading in xna. I read some articles about it but it is not so clear. I mean when should I start the thread and what about the update function etc. I need your help guys

    Read the article

  • HTML Parsing for multiple input files using java code [closed]

    - by mkp
    FileReader f0 = new FileReader("123.html"); StringBuilder sb = new StringBuilder(); BufferedReader br = new BufferedReader(f0); while((temp1=br.readLine())!=null) { sb.append(temp1); } String para = sb.toString().replaceAll("<br>","\n"); String textonly = Jsoup.parse(para).text(); System.out.println(textonly); FileWriter f1=new FileWriter("123.txt"); char buf1[] = new char[textonly.length()]; textonly.getChars(0,textonly.length(),buf1,0); for(i=0;i<buf1.length;i++) { if(buf1[i]=='\n') f1.write("\r\n"); f1.write(buf1[i]); } I've this code but it is taking only one file at a time. I want to select multiple files. I've 2000 files and I've given them numbering name from 1 to 2000 as "1.html". So I want to give for loop like for(i=1;i<=2000;i++) and after executing separate txt file should be generated.

    Read the article

  • Programming Practice/Test Contest?

    - by Emmanuel
    My situation: I'm on a programming team, and this year, we want to weed out the weak link by making a competition to get the best coder from our group of candidates. Focus is on IEEExtreme-like contests. What I've done: I've been trying already for 2 weeks to get a practice or test site, like UVa or codechef. The plan after I find one: Send them (the candidates) a list of direct links to the problems (making them the "contest's problem list) get them to email me their correct answers' code at the time the judge says they have solved it and accept the fastest one into the team. Issues: We had practiced on UVa already (on programming challenges too), so our former teammate (which will be in the candidate group) already has an advantage if we used it. Codechef has all it's answers public, and since it shows the latest ones it will be extremely hard to verify if the answer was copied. And I've found other sites, like SPOJ, but they share at least some problems with codechef, making them inherit the issue of Codechef So, what alternatives do you think there are? Any site that may work? Any place to get all stuff to set up a Mooshak or similar contest (as in the stuff to get the problems, instructions to set up the server itself are easy to google)? Any other idea?

    Read the article

  • Best practice with branching source code and application lifecycle

    - by Toni Frankola
    We are a small ISV shop and we usually ship a new version of our products every month. We use Subversion as our code repository and Visual Studio 2010 as our IDE. I am aware a lot of people are advocating Mercurial and other distributed source control systems but at this point I do not see how we could benefit from these, but I might be wrong. Our main problem is how to keep branches and main trunk in sync. Here is how we do things today: Release new version (automatically create a tag in Subversion) Continue working on the main trunk that will be released next month And the cycle repeats every month and works perfectly. The problem arises when an urgent service release needs to be released. We cannot release it from the main trunk (2) as it is under heavy development and it is not stable enough to be released urgently. In such case we do the following: Create a branch from the tag we created in step (1) Bug fix Test and release Push the change back to main trunk (if applicable) Our biggest problem is merging these two (branch with main). In most cases we cannot rely on automatic merging because e.g.: a lot of changes has been made to main trunk merging complex files (like Visual Studio XML files etc.) does not work very well another developer / team made changes you do not understand and you cannot just merge it So what you think is the best practice to keep these two different versions (branch and main) in sync. What do you do?

    Read the article

  • Error mounting: mount exited with exit code 13

    - by Mike Williamson
    I keep a windows partition on my laptop for the occaisional bit of Photoshop work. A while ago I noticed that Windows had disappeared from my grub boot menu and when I try to mount the windows partion, my system hangs for a bit and then I get this: Unable to mount 105 GB Filesystem Error mounting: mount exited with exit code 13: ntfs_attr_pread_i: ntfs_pread failed: Input/output error Failed to calculate free MFT records: Input/output error NTFS is either inconsistent, or there is a hardware fault, or it's a SoftRAID/FakeRAID hardware. In the first case run chkdsk /f on Windows then reboot into Windows twice. The usage of the /f parameter is very important! If the device is a SoftRAID/FakeRAID then first activate it and mount a different device under the /dev/mapper/ directory, (e.g. /dev/mapper/nvidia_eahaabcc1). Please see the 'dmraid' documentation for more details. It seems that chkdsk is a windows command but since I can't boot into windows (since its the windows partition that is the problem) I'm not sure what to do. Here is the output of fdisk to give you the lay of the land: Disk /dev/sda: 250.1 GB, 250059350016 bytes 255 heads, 63 sectors/track, 30401 cylinders Units = cylinders of 16065 * 512 = 8225280 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Disk identifier: 0x98000000 Device Boot Start End Blocks Id System /dev/sda1 1 10199 81923436 83 Linux /dev/sda2 * 10200 22947 102398310 7 HPFS/NTFS /dev/sda3 22948 29164 49938052+ 83 Linux /dev/sda4 29165 30401 9936202+ 5 Extended /dev/sda5 29165 30401 9936171 82 Linux swap / Solaris Any guidance would be appreciated!

    Read the article

  • What design patterns are the worst or most narrowly defined?

    - by Akku
    For every programming project, Managers with past programming experience try to shine when they recommend some design patterns for your project. I like design patterns when they make sense or if you need a scalbale solution. I've used Proxies, Observers and Command patterns in a positive way for example, and do so every day. But I'm really hesitant to use say a Factory pattern if there's only one way to create an object, as a factory might make it all easier in the future, but complicates the code and is pure overhead. So, my question is in respect to my future career and my answer to manager types throwing random pattern-names around: Which design patterns did you use, that threw you back overall? Which are the worst design patterns, that you shouldn't have a look at if it's not that only single situation where it makes sense (read: which design patterns are very narrowly defined)? (It's like I was looking for the negative reviews of an overall good product of amazon to see what bugged people most in using design patterns). And I'm not talking about Anti-Patterns here, but about Patterns that are usually thought of as "good" patterns. Edit: As some answered, the problem is most often that patterns are not "bad" but "used wrong". If you know patterns, that are often misused or even difficult to use, they would also fit as an answer.

    Read the article

  • Learning to code first game, few questions on basic game development and 3D

    - by ProgrammerByDay
    I've been programming for a while, and I'm concurrently learning how to make a basic game and slimdx, and wanted to talk to someone to hopefully get a few pointers. I've read that Tetris is the "Hello, world" of game programming, which made sense to me, so I decided to give it a shot. I've been able to code up a basic version in a few hours, which I'm quite happy with, but I had a few questions about 3D programming. Right now I'm using Direct3D to do display the blocks without any textures (just colored squares). I have a data structure (2d array of bytes, where each byte denotes the presence of a block and its color) which is the "game board," and on every render() call I create a new vertex buffer of the existing squares in the game board, and draw those primitives. This feels very inefficient, and I wondering what would be the idiomatic way of doing this in a 3D world, with matrix/rotations/translation operations. I know 3D is overkill for such a project, but I want to learn any 3d concepts that I can while I'm doing it. I understand that what you'd usually want to do is keep the same vertices/vertex buffers but manipulate them with matrices to achieve rotations/translations, etc. To do so, I assume what would happen is I'd have one vertex buffer for the "active" piece, since that'll be constantly rotated and moved, and have one vertex buffer for the frozen pieces on the bottom of the board, which is pretty much stationary, but will need to be changed/recreated when the active piece becomes frozen. Right now I'm just clearing and redrawing on every render call, which seems like the easiest way to do things, although I wonder if there's a more efficient way to deal with changes. Obviously there are a lot of questions I'm asking here, but if you can even just point me a step or two ahead in terms of how I should be thinking, it'd be great. Thanks

    Read the article

  • Inserting HTML code with jquery

    - by J. Robertson
    One of our web applications is a page that takes in a serial number and various information is returned and displayed to the user. The serial is passed via AJAX, and based on the response, one of the following can happen - An error message is shown A new form replaces the previous form Now, the way I am handling this is to use jQuery to destroy (using $.remove()) the table that displayed the initial serial form, then I'm appending another html table that contains another form. Right now I am including that additional form as part of the html source, and just setting it to display:none, then using jQuery to show it when appropriate. However, I don't like this approach because if someone views source on the page, they can see that table html code that is not being displayed. My next thought would be to use AJAX to read in another HTML file, and append it that way. However, I am trying to keep down the number of files this project uses, and since most pages in our project will use AJAX, I could see a case where there are multiple files containing HTML snippets - and that feels sloppy to me. What is the best way to handle a case where multiple html elements are being shown and removed with jQuery?

    Read the article

  • RPi and Java Embedded GPIO: Java code to blink more LEDs

    - by hinkmond
    Now, it's time to blink the other GPIO ports with the other LEDs connected to them. This is easy using Java Embedded, since the Java programming language is powerful and flexible. Embedded developers are not used to this, since the C programming language is more popular but less easy to develop in. We just need to use a dynamic Java String array to map to the pinouts of the GPIO port names from the previous diagram posted. This way we can address each "channel" with an index into that String array. static String[] GpioChannels = { "0", "1", "4", "17", "21", "22", "10", "9" }; With this new dynamic array, we can streamline the main() of this Java program to activate all the ports. /** * @param args the command line arguments */ public static void main(String[] args) { FileWriter[] commandChannels; try { /*** Init GPIO port for output ***/ // Open file handles to GPIO port unexport and export controls FileWriter unexportFile = new FileWriter("/sys/class/gpio/unexport"); FileWriter exportFile = new FileWriter("/sys/class/gpio/export"); for (String gpioChannel : GpioChannels) { System.out.println(gpioChannel); // Reset the port unexportFile.write(gpioChannel); unexportFile.flush(); // Set the port for use exportFile.write(gpioChannel); exportFile.flush(); // Open file handle to port input/output control FileWriter directionFile = new FileWriter("/sys/class/gpio/gpio" + gpioChannel + "/direction"); // Set port for output directionFile.write(GPIO_OUT); directionFile.flush(); } And, then simply add array code to where we blink the LED to make it blink all the LEDS on and off at once. /*** Send commands to GPIO port ***/ commandChannels = new FileWriter[GpioChannels.length]; for (int channum=0; channum It's easier than falling off a log... or at least easier than C programming. Hinkmond

    Read the article

  • How does this ruby error handling module code work

    - by Michael Durrant
    Trying to get a better handle on ruby exception handling. I have this code (from a book): def err_with_msg(pattern) m = Module.new (class << m; self; end).instance_eval do define_method(:===) do |e| pattern === e.msg end end m end So ok this is a method. We're creating a new Module. I think of module as mix-ins. Not sure what it's doing here. Not we add the module to the class. Fair enough. Then we have self on its own. What that for? I guess we have a little anonymouse method this is just about self. hmmm ok, now for each of the above, check the pattern match. but for each, I thought the above for for a new Module, did the module get to use instance's by being included? A better explanation of what's going on here would be most helpful.

    Read the article

  • Usage of repository between EF model and code consumer

    - by jim
    I have binary data in my database that I'll have to convert to bitmap at some point. I was thinking whether or not it's appropriate to use a repository and do it there. My consumer, which is a presentation layer, will use this repository. For example: // This is a class I created for modeling the item as is. public class RealItem { public string Name { get; set; } public Bitmap Image { get; set; } } public abstract class BaseRepository { //using Unity (http://unity.codeplex.com) to inject the dependancy of entity context. [Dependency] public Context { get; set; } } public calss ItemRepository : BaseRepository { public List<Items> Select() { IEnumerable<Items> items = from item in Context.Items select item; List<RealItem> lst = new List<RealItem>(); foreach(itm in items) { MemoryStream stream = new MemoryStream(itm.Image); Bitmap image = (Bitmap)Image.FromStream(stream); RealItem ritem = new RealItem{ Name=item.Name, Image=image }; lst.Add(ritem); } return lst; } } Is this a correct way to use the repository pattern? I'm learning this pattern and I've seen a lot of examples online that are using a repository but when I looked at their source code... for example: public IQueryable<object> Select { return from q in base.Context select q; } as you can see no behavior is added to the system by their approach, so I was confused that maybe repository is something else and I got it all wrong. At the end there should be extra benifits of using them right?

    Read the article

  • Struggling with the Single Responsibility Principle

    - by AngryBird
    Consider this example: I have a website. It allows users to make posts (can be anything) and add tags that describe the post. In the code, I have two classes that represent the post and tags. Lets call these classes Post and Tag. Post takes care of creating posts, deleting posts, updating posts, etc. Tag takes care of creating tags, deleting tags, updating tags, etc. There is one operation that is missing. The linking of tags to posts. I am struggling with who should do this operation. It could fit equally well in either class. On one hand, the Post class could have a function that takes a Tag as a parameter, and then stores it in a list of tags. On the other hand, the Tag class could have a function that takes a Post as a parameter and links the Tag to the Post. The above is just an example of my problem. I am actually running into this with multiple classes that are all similar. It could fit equally well in both. Short of actually putting the functionality in both classes, what conventions or design styles exist to help me solve this problem. I am assuming there has to be something short of just picking one? Maybe putting it in both classes is the correct answer?

    Read the article

  • Most effective work habit for coding? [on hold]

    - by Cris
    Working on a big solo project (~15,000 LOC), I am encountering the following phenomenon: I seem to work best when I program in short bursts of 10-15 minutes. Right now I am working on a section which is a complete first time for me architecturally and if I have any architectural issues that emerge when doing the implementation, I seem to be able to best serve these by taking a total break. Then, later, sketching out the ideas on some paper. And when I feel I have sufficient clarity, then going back to code. This iterates until that architectural issue for that section is resolved. This seems quite counter intuitive: that I can progress more quickly by coding less, and taking more breaks. I am nearing the end of the sections which are "first times" for me, and about to dive into stuff which I am much more familiar and am wondering if this counter intuitive efficiency will continue. So my question is: even for regular coding of sections one is familiar with, which don't require constant re-clarification of the best architecture, is more progress to be attained by taking more breaks and coding in bursts?

    Read the article

  • ubi-partman failed with exit code 10 during 12.10 fresh install

    - by Austen
    ive been trying to install ubuntu 12.10 on my acer aspire one 534h,using an iso from the official site and a 16gb flash drive using unetbootin. my aa1 is running factory settings (xp). it will boot fine from the usb, but the installation throws the error in the title after choosing my wifi options, and contineus to give the error after every subsequent step. after trying to complete the installation ingoring the error, it hangs on the ask ubuntu screen. ive tried reformatting and reflashing (sorry, heavy android user) ubuntu to the flash drive, to no avail... do i need to format somthing else, or is it something to do with th Hdd and RAID drives? ive looked in my BIOS and found nothing related. only the option for sata or ide... any help would be great, as ive been working at this all day... edit: the error message was ubi-partman has failed with exit code 10. see (gave a directory) for more info. it then informed me that if i continued the install could be incomplete or completly broken. not sure abouth the wording in the second part, but the error is word for word... thank you.

    Read the article

  • Eclipse Java Code Formatter in NetBeans Plugin Manager

    - by Geertjan
    Great news for Eclipse refugees everywhere. Benno Markiewicz forked the Eclipse formatter plugin that I blogged about sometime ago (here and here)... and he fixed many bugs, while also adding new features. It's a handy plugin when you're (a) switching from Eclipse to NetBeans and want to continue using your old formatting rules and (b) working in a polyglot IDE team, i.e., now the formatting rules defined in Eclipse can be imported into NetBeans IDE and everyone will happily be able to conform to the same set of formatting standards. And now you can get it directly from Tools | Plugins in NetBeans IDE 7.4: News from Benno on the plugin, received from him today: The plugin is verified by the NetBeans community and available in the Plugin Manager in NetBeans IDE 7.4 (as shown above) and also at the NetBeans Plugin Portal here, where you can also read quite some info about the plugin:  http://plugins.netbeans.org/plugin/50877/eclipse-code-formatter-for-java The issue with empty undo buffer was solved with the help of junichi11: https://github.com/markiewb/eclipsecodeformatter_for_netbeans/issues/18 The issue with the lost breakpoints remains unsolved and there was no further feedback. That is the main reason why the save action isn't activated by default. See also the open known issues at https://github.com/markiewb/eclipsecodeformatter_for_netbeans/issues?state=open Features are as follows:  Global configuration and project specific configuration.  On save action, which is disabled by default. Show the used formatter as a notification, which is enabled by default.  Finally, Benno testifies to the usefulness, stability, and reliability of the plugin: I use the Eclipse formatter provided by this plugin every day at work. Before I commit, I format the sources. It works and that's it. I am pleased with it. Here's where the Eclipse formatter is defined globally in Tools | Options: And here is per-project configuration, i.e., use the Project Properties dialog of any project to override the global settings:  Interested to hear from anyone who tries the plugin and has any feedback of any kind! 

    Read the article

  • E: Sub-process /usr/bin/dpkg returned an error code (1)

    - by kss
    sudo apt-get install acroread, i got the following output Reading package lists... Done Building dependency tree Reading state information... Done Suggested packages: libldap2 libgnome-speech7 The following NEW packages will be installed: acroread 0 upgraded, 1 newly installed, 0 to remove and 6 not upgraded. 1 not fully installed or removed. Need to get 0 B/60.1 MB of archives. After this operation, 142 MB of additional disk space will be used. (Reading database ... 237901 files and directories currently installed.) Unpacking acroread (from .../acroread_9.5.1-1precise1_i386.deb) ... dpkg: error processing /var/cache/apt/archives/acroread_9.5.1-1precise1_i386.deb (--unpack): failed in write on buffer copy for backend dpkg-deb during `./opt/Adobe/Reader9/Browser/intellinux/nppdf.so': No space left on device No apport report written because MaxReports is reached already dpkg-deb: error: subprocess paste was killed by signal (Broken pipe) Processing triggers for bamfdaemon ... Rebuilding /usr/share/applications/bamf.index... Processing triggers for desktop-file-utils ... Processing triggers for gnome-menus ... Processing triggers for man-db ... /usr/bin/mandb: can't write to /var/cache/man/1645: No space left on device Errors were encountered while processing: /var/cache/apt/archives/acroread_9.5.1-1precise1_i386.deb E: Sub-process /usr/bin/dpkg returned an error code (1)

    Read the article

  • Whether to separate out methods or not

    - by Skippy
    I am new to java and want to learn best coding practices and understand why one method is better than another, in terms of efficiency and as the coding becomes more complicated. This is just an example, but I can take the principles from here to apply elsewhere. I have need an option to display stuff, and have put the method stuff separately from the method to ask if the user wants to display the stuff, as stuff has a lot of lines of code. For readability I have done this: public static void displayStuff () { String input = getInput ("Display stuff? Y/N \n"); if (input..equalsIgnoreCase ("Y")) { stuff (); } else if (input.equalsIgnoreCase ("N")) { //quit program } else { //throw error System.out.print("Error! Enter Y or N: \n"); } } private static String stuff () { //to lots of things here return stuff (); } Or public static void displayStuff () { String input = getInput ("Display stuff? Y/N \n"); if (input..equalsIgnoreCase ("Y")) { //to lots of things here stuff; } else if (input.equalsIgnoreCase ("N")) { //quit program } else { //throw error System.out.print("Error! Enter Y or N: \n"); } } Is it better to keep them together and why? Also, should the second method be private or public, if I am asking for data within the class? I am not sure if this is on topic for here. please advise.

    Read the article

  • What is logical cohesion, and why is it bad or undesirable?

    - by Matt Fenwick
    From the c2wiki page on coupling & cohesion: Cohesion (interdependency within module) strength/level names : (from worse to better, high cohesion is good) Coincidental Cohesion : (Worst) Module elements are unrelated Logical Cohesion : Elements perform similar activities as selected from outside module, i.e. by a flag that selects operation to perform (see also CommandObject). i.e. body of function is one huge if-else/switch on operation flag Temporal Cohesion : operations related only by general time performed (i.e. initialization() or FatalErrorShutdown?()) Procedural Cohesion : Elements involved in different but sequential activities, each on different data (usually could be trivially split into multiple modules along linear sequence boundaries) Communicational Cohesion : unrelated operations except need same data or input Sequential Cohesion : operations on same data in significant order; output from one function is input to next (pipeline) Informational Cohesion: a module performs a number of actions, each with its own entry point, with independent code for each action, all performed on the same data structure. Essentially an implementation of an abstract data type. i.e. define structure of sales_region_table and its operators: init_table(), update_table(), print_table() Functional Cohesion : all elements contribute to a single, well-defined task, i.e. a function that performs exactly one operation get_engine_temperature(), add_sales_tax() (emphasis mine). I don't fully understand the definition of logical cohesion. My questions are: what is logical cohesion? Why does it get such a bad rap (2nd worst kind of cohesion)?

    Read the article

  • General List of Common Programming Errors

    - by javamonkey79
    As one journey's from apprentice to journeyman to master I've noticed that one accumulates a list of best practices for things they've been bitten by. Personally, I write most of my stuff in java & SQL so my list tends to be slated towards them. I've accumulated the following: When doing list removal, always reverse iterate Avoid adding items to a list you are currently iterating on Watch out for NullPointerExceptions Now, I know there are language specific "common errors" links out there like this one. And I'm also aware of the pragmatic programmer tips, Martin Fowler's "code smells". Does anyone know of any good lists out there of things like I've listed above (re: list removal, adding items, etc). My guess is that there are some good QA folks out there that can probably throw me a bone here. I'm not looking for things the compiler can catch - I'm looking for common things that cause bugs. In the event that there isn't a list out there already then I welcome posting your own findings here. Thanks in advance!

    Read the article

  • Prefer class members or passing arguments between internal methods?

    - by geoffjentry
    Suppose within the private portion of a class there is a value which is utilized by multiple private methods. Do people prefer having this defined as a member variable for the class or passing it as an argument to each of the methods - and why? On one hand I could see an argument to be made that reducing state (ie member variables) in a class is generally a good thing, although if the same value is being repeatedly used throughout a class' methods it seems like that would be an ideal candidate for representation as state for the class to make the code visibly cleaner if nothing else. Edit: To clarify some of the comments/questions that were raised, I'm not talking about constants and this isn't relating to any particular case rather just a hypothetical that I was talking to some other people about. Ignoring the OOP angle for a moment, the particular use case that I had in mind was the following (assume pass by reference just to make the pseudocode cleaner) int x doSomething(x) doAnotherThing(x) doYetAnotherThing(x) doSomethingElse(x) So what I mean is that there's some variable that is common between multiple functions - in the case I had in mind it was due to chaining of smaller functions. In an OOP system, if these were all methods of a class (say due to refactoring via extracting methods from a large method), that variable could be passed around them all or it could be a class member.

    Read the article

  • Entry level engineer question regarding memory mangement

    - by Ealianis
    It has been a few months since I started my position as an entry level software developer. Now that I am past some learning curves (e.g. the language, jargon, syntax of VB and C#) I'm starting to focus on more esoteric topics, as to write better software. A simple question I presented to a fellow coworker was responded with "I'm focusing on the wrong things." While I respect this coworker I do disagree that this is a "wrong thing" to focus upon. Here was the code (in VB) and followed by the question. Note: The Function GenerateAlert() returns an integer. Dim alertID as Integer = GenerateAlert() _errorDictionary.Add(argErrorID, NewErrorInfo(Now(), alertID)) vs... _errorDictionary.Add(argErrorID, New ErrorInfo(Now(), GenerateAlert())) I originally wrote the ladder and rewrote it with the "Dim alertID" so that someone else might find it easier to read. But here was my concern and question. "Should one write this with the Dim AlertID, it would in fact take up more memory; finite but more, and should this method be called many times could it lead to an issue? How will .NET handle this object AlertID. Outside of .NET should one manually dispose of the object after use (near the end of the sub)." I want to ensure I become a knowledgeable programmer that does not just rely upon garbage collection. Am I over thinking this? Am I focusing on the wrong things?

    Read the article

  • polipo E: Sub-process /usr/bin/dpkg returned an error code (1)

    - by ICXC
    @me:/home$ sudo apt-get install polipo Reading package lists... Done Building dependency tree Reading state information... Done The following NEW packages will be installed: polipo 0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded. Need to get 198 kB of archives. After this operation, 799 kB of additional disk space will be used. Get:1 http://sy.archive.ubuntu.com/ubuntu/ precise/universe polipo amd64 1.0.4.1-1.1 [198 kB] Fetched 198 kB in 2s (97.5 kB/s) Selecting previously unselected package polipo. (Reading database ... 169595 files and directories currently installed.) Unpacking polipo (from .../polipo_1.0.4.1-1.1_amd64.deb) ... Processing triggers for doc-base ... Processing 1 added doc-base file... Processing triggers for man-db ... Processing triggers for install-info ... Processing triggers for ureadahead ... Setting up polipo (1.0.4.1-1.1) ... Starting polipo: Couldn't open config file /etc/polipo/config: 2. invoke-rc.d: initscript polipo, action "start" failed. ****dpkg: error processing polipo (--configure): subprocess installed post-installation script returned error exit status 1 Errors were encountered while processing: polipo E: Sub-process /usr/bin/dpkg returned an error code (1)****

    Read the article

  • Explaining Asteroids Movement code

    - by Moaz ELdeen
    I'm writing an Asteroids Atari clone, and I want to figure out how the AI for the asteroids is done. I have came across that piece of code, but I can't get what it does 100% if ((float)rand()/(float)RAND_MAX < 0.5) { m_Pos.x = -app::getWindowWidth() / 2; if ((float)rand()/(float)RAND_MAX < 0.5) m_Pos.x = app::getWindowWidth() / 2; m_Pos.y = (int) ((float)rand()/(float)RAND_MAX * app::getWindowWidth()); } else { m_Pos.x = (int) ((float)rand()/(float)RAND_MAX * app::getWindowWidth()); m_Pos.y = -app::getWindowHeight() / 2; if (rand() < 0.5) m_Pos.y = app::getWindowHeight() / 2; } m_Vel.x = (float)rand()/(float)RAND_MAX * 2; if ((float)rand()/(float)RAND_MAX < 0.5) { m_Vel.x = -m_Vel.x; } m_Vel.y =(float)rand()/(float)RAND_MAX * 2; if ((float)rand()/(float)RAND_MAX < 0.5) m_Vel.y = -m_Vel.y;

    Read the article

< Previous Page | 82 83 84 85 86 87 88 89 90 91 92 93  | Next Page >