Search Results

Search found 3022 results on 121 pages for 'loose typing'.

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

  • Is it better for class data to be passed internally or accessed directly?

    - by AaronSzy
    Example: // access fields directly private void doThis() { return doSomeWork(this.data); } // receive data as an argument private void doThis(data) { return doSomeWork(data); } The first option is coupled to the value in this.data while the second option avoids this coupling. I feel like the second option is always better. It promotes loose coupling WITHIN the class. Accessing global class data willy-nilly throughout just seems like a bad idea. Obviously this class data needs to be accessed directly at some point. However, if accesses, to this global class data can be eliminated by parameter passing, it seems that this is always preferable. The second example has the advantage of working with any data of the proper type, whereas the first is bound to working with the just class data. Even if you don't NEED the additional flexibility, it seems nice to leave it as an option. I just don't see any advantage in accessing member data directly from private methods as in the first example. Whats the best practice here? I've referenced code complete, but was not able to find anything on this particular issue.

    Read the article

  • How can I send keypresses to a running process object?

    - by Waffles
    I am trying to make C# launch an application (in this case open office), and start sending that application keypresses such that it would appear as though someone is typing. So ideally, I would be able to send a running open office process the keypress for the letter "d", and open office would then type d on the paper. Can anyone give me direction as per how to go about this? I have tried to do the following: p = new Process(); p.StartInfo.UseShellExecute = true; p.StartInfo.CreateNoWindow = false; p.StartInfo.FileName = processNames.executableName; p.Start(); p.StandardInput.Write("hello"); But that doesn't get me the desired effect - I don't see the text typed out in open office.

    Read the article

  • Is there any way to get Visual Studio 2008 to update .net style comments automatically?

    - by Jon Cage
    I've been writing a lot of VC++ 2008 / CLI software recently and am using the C#/CLI style documentation: /// <summary> /// Function the does stuff /// </summary> /// <param name="someParam">Specifies some option</param> /// <returns>true if it worked</returns> bool DoStuff( bool someParam ); I find myself re-typing those blocks quite frequently and frankly, it's getting repetitive. Is there any way to get Visual Studio to create / update those blocks automatically as you create new function definitions or update existing definitions?

    Read the article

  • Javascript: setTimeout() - help needed

    - by ilkin
    Hi guys, I'm currently doing a highlighting function on a webpage and im using the jquery plugin for that. My code looks like this: var input = function() { var matchword = $('#searchbox').val(); if(matchword != "") { $('body').removeHighlight(); $('body').highlight($('#searchbox').val()); } } $(document).ready(function() { $('#searchbox').keyup(function() { setTimeout("input()", 2000); }); }); It works fine if there is not so large amount of data on the page. But in case of large amount of data on the page the whole process is slowing down which causes that inputbox is freezing untill the letter is hightlighted. So the typing is not smooth. I tryed to use a setTimeout but it seems doesnt help. Any ideas?

    Read the article

  • How to run a .class file in Windows 7 OS?

    - by jNoob
    Hi, This is probably a stupid question, but how do I run a class file on windows 7? I usually create my own .java files and then use a basic IDE (with JDK6) to compile it to a class and run it automatically. My professor gave a .class file that we are supposed to play with extensively but I have no idea how to to run it here. Note that I cannot run it by typing: java classname.class because it contains gui stuff especially buttons and such. If I do the above I get the following error: java.lang.NoClassDefFoundError: Test1/2/class Caused by: java.lang.ClassNotFoundException: Test1.2.class at java.net.URLClassLoader$1.run(Unknown Source) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(Unknown Source) at java.lang.ClassLoader.loadClass(Unknown Source) at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source) at java.lang.ClassLoader.loadClass(Unknown Source) at java.lang.ClassLoader.loadClassInternal(Unknown Source) Could not find the main class: Test1.2.class. Program will exit. Exception in thread "main" Any help would be highly appreciated. Thanks.

    Read the article

  • Ruby on Rails: has_many through frustrations

    - by Joe Cairns
    I'm having a frustrating problem with a has_many through: namely the fact that the through models are not created until save. Unfortunately, I need to set data on these models prior to saving the parent. Here's the loose setup: class Wtf < ActiveRecord::Base belongs_to :foo belongs_to :bar end class Bar < ActiveRecord::Base has_many :wtfs has_many :foos, :through => :wtfs end class Foo < ActiveRecord::Base has_many :wtfs has_many :bars, :through => :wtfs def after_initialize Bar.all.each do |bar| bars << bar end end end Everything is fine except that I need to access the "wtf"'s prior to save: f = Foo.new = # f.bars = [list of bars] empty list here f.wtfs = [] f.save! = true now I get stuff f.wtfs = [list of stuff] I even went so far as to explicitly create the wtfs doing this: def after_initialize Bar.all.each do |bar| wtfs << Wtf.new( :foo => self, :bar => bar, :data_i_need_to_set => 10) end end This causes the f.wtfs to be populated, but not the bars. When I save and retrieve, I get double the expected wtfs. Anyone have any ideas?

    Read the article

  • Jquery Works in FF but not IE at all

    - by Shawn
    I set up the SimpleModal plugin to work from our Ad server(Real 24/7). Essentially, attempting to make an interstitial ad. I serve a popupAd.js file from the Ad Server to our homepage(index.php), Here is the code for popupAd.js: $(document).ready(function() { $.modal('<iframe src="/welcomeAd.htm" height="525" width="562" style="border:0;" scrolling="no"/>', { closeHTML: "<a href='#' title='Close' align='right' style='color:#666>(X) Continue to website</a>", containerCss: { backgroundColor: '#fff', borderColor: "#0063dc", height: 525, padding: 0, width: 562, }, overlayCss:{ backgroundColor:"#fff", }, opacity:100, overlayClose: true }); }); This opens a modal window on the homepage which then loads welcomeAd.htm which contain nothing other than the ad call to the creative. Here is the code: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/1999/REC-html401-19991224/loose.dtd"> <html> <head> <title>Company Name</title> <!------ AD SERVER SETUP begin ------> <!------ OAS SERVER SETUP end ------> </head> <body style="margin: 0; padding: 0; width: 100%; height: 100%"> <script type="text/javascript" language="JavaScript"> <!-- AD SERVER CALL; //--> </script> </body> </html> This all works in FF but does nothing in IE, of which I am running IE7. Also, the closeHTML doesn't show up in Safari, though, the ad does.

    Read the article

  • Proper use of of typedef in C++

    - by dicroce
    I have coworkers who occasionally use typedef to avoid typing. For example: typedef std::list<Foobar> FoobarList; ... FoobarList GetFoobars(); Personally, I always hate coming across code like this, largely because it forces me to go lookup the typedef so I can tell how to use it. I also feel like this sort of thing is a potential slippery slope... If you do this, why aren't you doing it more? (pretty soon, your code is totally obfuscated). I found this SO question regarding this issue: when should I use typedef in C I have two questions: 1) am I truly alone in disliking this? 2) If the vast majority of people think this sort of typedef use is OK, what criteria do you use to determine whether to typedef a type?

    Read the article

  • Repeating characters in VIM insert mode

    - by Cthutu
    Is there a way of repeating a character while in Vim's insert mode? For example, say I would like to insert 80 dashes, in something like emacs I would type: Ctrl+U 8 0 - The only way I know how to do it in VIM is to exit normal mode for the repeat argument, then go back into insert mode to type the dash, then exit to insert the actual dashes, AND then go back into insert mode to carry on typing. The sequence is a really long: <ESC> 8 0 a - <ESC> a It would be nice not to switch in and out of modes. Thanks

    Read the article

  • CSS bug in text input field - MSIE7

    - by Uri Bruck
    I have an input text in a form that has a problem in MSIE7. When the text field is filled and I continue typing, the background starts scrolling left along with the text. This is the form when the text field is filled http://img155.imageshack.us/i/screen2rl.jpg/ The background image, a white rectangle with rounded corners, scrolls left with the text, leaving the black background. This is the CSS for this text field: border: none; background: url('/wp-content/themes/pokerbuddy/images/field.png') top left no-repeat; width: 100px; height: 20px; padding: 0px; font-size: 80%; color: #399; display:inline; Is there any way to solve this in MSIE7?

    Read the article

  • CodeMirror Dynamic Syntax Validation

    - by rawr
    Been trying to decide between using CodeMirror or Ace editor. I've been leaning towards CodeMirror, however there's one feature of Ace that I really like and that is how it does syntax validation. So as I'm typing there can appear a warning or error icon in the left gutter area beside the line number, and when I hover over it it gives me a little description. Is there any way to get this functionality in CodeMirror? Specifically, I'm using the css mode for CodeMirror. It'd also be nice to be able to add in my own custom validation. Thanks.

    Read the article

  • Aside from performance concerns, is Java still chosen over Groovy/JRuby etc.?

    - by yar
    [This is an empirical question about the state-of-the-art: I am NOT asking if Java is cooler or less cool than the dynamic languages that work in the JVM.] Aside from cases where performance is a main decision factor, do companies/developers still willingly chose Java over Groovy, JRuby or JPython? Personal Note: The reason I am asking is that, while I do some subset of my professional work in Ruby (not JRuby, for now), in my personal projects I use Java. While I have written non-trivial apps in Groovy, I prefer Java, but I wonder if I should just get over it and do everything in Groovy. I like Java because I feel that static typing saves me time and aids refactoring. (No, I am not familiar with Scala.) However, I feel that this very empirical, on-topic programming question may inform my decision.

    Read the article

  • Notepad++ Move Caret Outside Bracket

    - by marknadal
    I've searched everywhere and can't find an answer to something incredibly simple and useful for Notepad++. When using autoclose, the cursor gets stuck inside, which is good until I've finished typing the parameters. How do I get the caret to jump outside of the currently nested autoclosed element? Regardless of it being (), {}, [], "", '', ? CTRL+B does does something similar, but it goes to the inside of the left bracket first, and then to the outside of the right bracket, which is where I want to be. This only works for brackets though, not tags and qoutations Hitting CTRL+B twice is cumbersome and manually hitting "right arrow" requires too much hand motion while coding. And finally, is there anyway I can map this to "SHIFT+Space"?

    Read the article

  • Clojure: using *command-line-args* in the script rather than REPL

    - by Teflon Mac
    I've clojure running within Eclipse. I want to pass arguments to clojure when running it. In the below the arguments are available in the REPL but not in the script itself. What do I need to do such that in the below typing arg1 in the REPL will return the first argument? Script: (NS Test) (def arg1 (nth *command-line-args* 0)) After clicking on the Eclipse "Run"... Clojure 1.1.0 1:1 user=> #<Namespace test> 1:2 test=> arg1 nil 1:3 test=> *command-line-args* ("bird" "dog" "cat" "pig") 1:4 test=> (def arg2 (nth *command-line-args* 1)) #'test/arg2 1:5 test=> arg2 "dog" 1:6 test=>

    Read the article

  • C++: Where can I define the body for a private function?

    - by Martijn Courteaux
    Hi, I have a header like this (header guards not shown): class GameSystem { public: GameSystem(Game *pcGame); virtual ~GameSystem(); void Setup(); private: void InitGame(); void RunGame(); void ExitGame(); Game *m_pcGame; /* Properties */ int m_nWidth; int m_nHeight; int m_nFps; bool m_bFullscreen; }; Where can I define the body for InitGame(), RunGame() and ExitGame()? Can I define it in my .cpp file? If so, how? Or am I obliged to make their body in my .h file? I'm using Eclipse and I began typing: void GameSystem:: and then he doesn't suggest the private functions.

    Read the article

  • How to pass parameters with spaces via cstdlib system

    - by buchtak
    Hi, I have this windows console app which takes a file, do some calculations, and then writes the output to a specified file. The input is specified in "app.exe -input fullfilename" format. I need to call this application from my C++ program, but I have a problem with spaces in paths to files. When I call the app directly from cmd.exe by typing (without specifying output file for clarity) "c:\first path\app.exe" -input "c:\second path\input.file" everything works as expected. But, when I try using cstdlib std::system() function, i.e. std::system(" \"c:\\first path\\app.exe\" -input \"c:\\second path\\input.file\" "); the console prints out that c:\first is not any valid command. It's probably common mistake and has simple solution, but I have been unable to find any. Thx for any help.

    Read the article

  • Is there a Javadoc-like plugin for Xcode that automatically generates the doc template?

    - by Mark
    I'm aware of Doxygen to generate the documentation. What I'm looking for is quick way to insert documentation in Xcode similar to what Eclipse does when editing Java files. Let's say I have an objective-c method with a couple of arguments like this: -(NSInteger*) sumOf: (NSInteger*) one and:(NSInteger*) two {... In Eclipse, if you place the cursor above the method and type: /**<Enter> you get a Javadoc template pre-populated with @param and @return tags. Is it possible to achieve something similar in Xcode? After typing /**<Enter>, I'd like to get this automatically: /** * * @param one * @param two * * @return */ -(NSInteger*) sumOf: (NSInteger*) one and:(NSInteger*) two {...

    Read the article

  • [Android] Returning to a ListView with a text filter

    - by sosiouxme
    I enabled text filtering on my ListView in the expected way; adding android:textFilterEnabled=”true” in resource definition and (as I'm using a SimpleCursorAdapter) setting a FilterQueryProvider that provides a filtered cursor like so: public Cursor runQuery(CharSequence constraint) { Cursor cur = mDba.fetchTrackers(mCurrentGroupId, constraint.toString()); startManagingCursor(cur); return cur; } My question is this: once the user selects a list item, goes off to another activity, and returns to this one, how can I control the state of the filter previously applied? What I'm seeing right now is that when I return to the activity, the cursor being used is the unfiltered one set on the filter at creation, but the filter text they typed is still shown (and typing keys causes the filter to be applied). What I'd like to do is either clear the filter, or keep the filtered cursor that the activity was left with.

    Read the article

  • Hide div based on url

    - by Ghetto Styles
    Sorry if this is another repost. I have been attempting to find a solution but nothing works that I have tried. I am using a blog which I have full html control over. I can usually find my way around basic html but when it comes to Java or CSS I am a complete newb. Sorry, I know absolutely nothing. Now that that is out of the way. I have two sidebar div's that I am trying to hide on one specific url to utilize more space for a content iframe. This is one of the coded I have tried to use which doesn't seem to work or I am missing something. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <script language="text/javascript" <?php &#36;(function(){ if (window.location.search === "mywebsite/Videos.html") { &#36;('#navleft').hide(); } else { &#36;('#navleft').show(); } }); ?> </script> Please remember I do not know anything when it comes to php or java. I want to do this for both #navright and #navleft. Also this is in the CSS section. Thanks for any help!! #navright{ width: 200px; } #navleft{ width: 200px; } #content{ margin:0px; }

    Read the article

  • Drupal - db_fetch_array returns NULL for every row

    - by darudude
    I'm using Drupal's db_fetch_array to fetch rows from my db_query. However, every row returned is equal to NULL. Typing the query into PHP myadmin works, so I have no idea whats going on. db_num_rows returns the number of rows as well. Here is the code: if(count($rebuild_ids)) { $ids=implode(",",$rebuild_ids); $type_stmt = "SELECT * from {" . ItemType::$type_table_name . "} where id IN ($ids)"; $new_items=db_query($type_stmt); if(!$new_items || db_num_rows($new_items) == 0) { return; } while($row = db_fetch_array($new_items)); { if ($row!=NULL) { echo "I work!" $game_items[] = $row['id']; ItemInstance::$nid_to_item_type_code[$row['nid']] = $row['id']; } } } However, it never gets into the third if statement (i.e. never echos "I work!") Any ideas?

    Read the article

  • Class Method not working in objective c

    - by byteSlayer
    In my code I have a class called 'ProfileShareViewController', In which I have imported another class I have created called 'OwnProfileData', And I have also created an Instance of that class (class = OwnProfileData) as a property Of 'ProfileShareViewController' and synthesized it (instance called 'OwnProfile'). In another class I have called 'EditProfileViewController', I have imported the 'ProfileShareViewController', and now I am trying to change a property of the OwnProfile object from the ProfileShareViewController within the EditProfileViewController class. For some reason that doesn't work. I have Tried typing: [[ProfileShareViewController ownProfile] setName:@"Ido"]; (The property I am trying to set is Name, and as it is synthesized in OwnProfileData, I am using 'setName'). This doesn't work and I get the warning: "No known class method for selector 'ownMethod'. Any Idea as for why that might happen and how I can fix this? Thanks for your comments! Any support is highly appreciated!

    Read the article

  • Capistrano deploy:migrate Could not find rake-0.9.2.2 in any of the sources

    - by Kyle
    My Capistrano deploy:migrate task is set to run a simple rake db:migrate command, as follows: env PATH=/home/user/.gems/bin sh -c 'cd /home/user/app/releases/20121003140503 && rake RAILS_ENV=production db:migrate' When I run this task during an ssh session manually it completes successfully. However when I run from my local development box, I receive the following error: ** [out :: app] Could not find rake-0.9.2.2 in any of the sources I am able to locate my rake gem by typing which rake via ssh (/home/user/.gems/bin/rake) and rake --version gives me "rake, version 0.9.2.2," so I don't understand why this command fails via Capistrano?

    Read the article

  • How to create a shape acting like a textbox?

    - by subho100
    Please refer this control http://www.charlespetzold.com/blog/2009/10/Using-Text-Outlines-in-Silverlight.html The formattedtext control is a shape which helps to generate the shape of the text with proper geometry. I would like to make this control act like a text box with cursors and features like typing in from keyboard. Right now I use an invisible text box with a formattedtext control to act like that. But the cursor position always creates a problem when the size of the text is not equal to the size of the rendered text as shape. Can anyone please show the way to achieve this.

    Read the article

  • Tests that are 2-3 times bigger than the testable code

    - by HeavyWave
    Is it normal to have tests that are way bigger than the actual code being tested? For every line of code I am testing I usually have 2-3 lines in the unit test. Which ultimately leads to tons of time being spent just typing the tests in (mock, mock and mock more). Where are the time savings? Do you ever avoid tests for code that is along the lines of being trivial? Most of my methods are less than 10 lines long and testing each one of them takes a lot of time, to the point where, as you see, I start questioning writing most of the tests in the first place. I am not advocating not unit testing, I like it. Just want to see what factors people consider before writing tests. They come at a cost (in terms of time, hence money), so this cost must be evaluated somehow. How do you estimate the savings created by your unit tests, if ever?

    Read the article

  • How do you stop Eclipse from inserting a certain class in Content-Assist?

    - by fletchgqc.mp
    I'm using SpringSource Tool Suite (Eclipse) to program with Grails, and I'm also using JFreechart in the program. In Grails you log by typing log.info("method worked"). Unfortunately JFrechart has a class called "Log" with Static methods like "info". This means that in STS I type log.info and then when I type space or ( Eclipse "assists" me by importing the JFreechart Log class and changing what I've typed to Log.info(message). Very irritating. I reckon I could turn off the Eclipse option to "insert single proposals automatically", but I like this feature. Can I instruct Eclipse not to give me content assist from this particular JFreechart class?

    Read the article

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