Search Results

Search found 988 results on 40 pages for 'josh pearce'.

Page 21/40 | < Previous Page | 17 18 19 20 21 22 23 24 25 26 27 28  | Next Page >

  • try/catch: errors or exceptions?

    - by Josh
    OK. I may be splitting hairs here, but my code isn't consistent and I'd like to make it so. But before I do, I want to make sure I'm going the right way. In practice this doesn't matter, but this has been bothering me for a while so I figured I'd ask my peers... Every time I use a try... catch statement, in the catch block I always log a message to my internal console. However my log messages are not consistent. They either look like: catch(err) { DFTools.console.log("someMethod caught an error: ",err.message); ... or: catch(ex) { DFTools.console.log("someMethod caught an exception: ",ex.message); ... Obviously the code functions properly either way but it's starting to bother me that I sometimes refer to "errors" and sometimes to "exceptions". Like I said, maybe I'm splitting hairs but which is the proper terminology? "Exception", or "Error"?

    Read the article

  • jQuery eval of ajax inline script not throwing errors

    - by Josh
    http://stackoverflow.com/questions/606794/debugging-ajax-code-with-firebug This question is quite similar, though old and without real answers. I'm currently putting together an app that has scripts that get loaded in with an ajax request. An example: var main = _main.get(); main.load( someurl ); Where someurl is a page that contains an inline script element: <script type="text/javascript"> $(document).ready( function(){ var activities = new activities(); activities.init(); }); </script> jQuery will do a line by line eval of js that lives in inline script tags. The problem is, I get no errors or any information whatsoever in firebug when something goes awry. Does anyone have a good solution for this? Or a better practice for loading pages which contain javascript functionality? Edit: A little progress... so at the top of the page that is being loaded in via ajax, I have another script that was being included like this: <script type="text/javascript" src="javascript/pages/activities.js"></script> When I moved the inline $(document).ready() code in the page to the end of this included file, instead, syntax errors were now properly getting thrown. As an aside, I threw a console.log() into the inline script tag, and it was being logged just fine. I also tried removing the $(document).ready() altogether, and also switching it out for a $(window).load() event. No difference. May have something to do with the inline scripts dependency on the included activities.js, I guess. :: shakes head :: javascript can be a nightmare.

    Read the article

  • Column layout in HTML(5)/CSS

    - by Josh P.
    Is there a way in HTML5/CSS to have the columns layed out as shown below, and still have the text flow correctly? ###### ###### # C1 # # C2 # # # # # ###### ###### ###### ###### # C3 # # C4 # # # # # ###### ###### ###### ###### # C5 # # C6 # # # # # ###### ######

    Read the article

  • .animate question/help

    - by Josh
    So, I've built this navigation bar so far and I'm curious if it's even possible to achieve what I'm thinking. Currently, when you hover over each of the links they drop down (padding is increased). Now, what I'm curious in doing is if you hover over say "test1", test2-4 also drop with it but in the padding that has been created from the drop down, "test1" information shows up. Allowing the user to click or read whatever information is in there. Also, if the user would like to, they can move their mouse to test2 and everything would animate (opacity, this I can do I think) to whatever is in the test2 field, test3 doing the same and so on. I haven't had much success with this, I've created a completely separate panel before, but that didn't exactly work or I wasn't doing it correctly. Here is what I've been working on, ANY help would be appreciated! Thanks! <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <script type="text/javascript" src="jquery.js"></script> <script type="text/javascript"> $(function() { $("#nav li > a").hover(function() { $(this).stop().animate({paddingTop: "100px"}, 100); }, function() { $(this).stop().animate({paddingTop: "10px"}, 200); }); }); </script> <style type="text/css"> #nav { position: absolute; top: 0; left: 60px; padding: 0; margin: 0; list-style: none; } #nav li { display: inline; } #nav li a { float: left; display: block; color: #555; text-decoration: none; padding: 10px 30px; background-color: #d1d1d1; border-top: none; } </style> </head> <body> <div id="wrap"> <ul id="nav"> <li><a href="">test1</a></li> <li><a href="">test2</a></li> <li><a href="">test3</a></li> <li><a href="">test4</a></li> </ul> </div> </body> </html>

    Read the article

  • How do I convert HTML to RTF (Rich Text) in .NET without paying for a component?

    - by Josh Kodroff
    Is there a free third-party or .NET class that will convert HTML to RTF (for use in a rich-text enabled Windows Forms control)? The "free" requirement comes from the fact that I'm only working on a prototype and can just load the BrowserControl and just render HTML if need be (even if it is slow) and that Developer Express is going to be releasing their own such control soon-ish. I don't want to learn to write RTF by hand, and I already know HTML, so I figure this is the quickest way to get some demonstrable code out the door quickly.

    Read the article

  • Multiple circles -> One Polygon?

    - by Josh
    Using Google Maps API v3, I was able to create multiple google.maps.Circle objects on my map. However, I now need to "connect" them somehow. I have the following map with multiple circles: I now need to get it to look something like this: I've looked all over the Internet for solutions, but to no avail. Any ideas?

    Read the article

  • Utility methods in objective-c

    - by Josh P.
    Where should I place utility methods in objective-c? E.g. additional path handling utility methods which are called by multiple classes. I have seen examples where they are placed in the main appdelegate file and are therefore available to all. This seems a bit weird to me though however...

    Read the article

  • Controlling ASP.NET output cache memory usage

    - by Josh Einstein
    I would like to use output caching with WCF Data Services and although there's nothing specifically built in to support caching, there is an OnStartProcessingRequest method that allows me to hook in and set the cacheability of the request using normal ASP.NET mechanisms. But I am worried about the worker process getting recycled due to excessive memory consumption if large responses are cached. Is there a way to specify an upper limit for the ASP.NET output cache so that if this limit is exceeded, items in the cache will be discarded? I've seen the caching configuration settings but I get the impression from the documentation that this is for explicit caching via the Cache object since there is a separate outputCacheSettings which has no memory-related attributes. Here's a code snippet from Scott Hanselman's post that shows how I'm setting the cacheability of the request. protected override void OnStartProcessingRequest(ProcessRequestArgs args) { base.OnStartProcessingRequest(args); //Cache for a minute based on querystring HttpContext context = HttpContext.Current; HttpCachePolicy c = HttpContext.Current.Response.Cache; c.SetCacheability(HttpCacheability.ServerAndPrivate); c.SetExpires(HttpContext.Current.Timestamp.AddSeconds(60)); c.VaryByHeaders["Accept"] = true; c.VaryByHeaders["Accept-Charset"] = true; c.VaryByHeaders["Accept-Encoding"] = true; c.VaryByParams["*"] = true; }

    Read the article

  • Default Values in XForms Input

    - by Josh
    I have an XForm that has certain fields that may often be left blank (optional street address). Is there is technique to set a default value for that field, preferably a space (I am running into weird formatting issues with CSS). The html form way of value="" doesn't work, neither does setting a default value in the XML schema. EXAMPLE: <xforms:input ref="clientaddress/streetaddress2" model="model_inventory" > <xforms:label>Street Address (Line 2)</xforms:label> Leaving this field blank results in <streetaddress2/> in the resulting xml document I want <streetaddress> </streetaddress>

    Read the article

  • Lucene search taking TOOO long.

    - by Josh Handel
    I;m using Lucene.net (2.9.2.2) on a (currently) 70Gig index.. I can do a fairly complicated search and get all the document IDs back in 1 ~ 2 seconds.. But to actually load up all the hits (about 700 thousand in my test queries) takes 5+ minutes. We aren't using lucene for UI, this is a datastore between processes where we have hundreds of millions of pre-cached data elements, and the part I am working on exports a few specific fields from each found document. (ergo, pagination doesn't make since as this is an export between processes). My question is what is the best way to get all of the documents in a search result? currently I am using a custom collector that does a get on the document (with a MapFieldSelector) as its collecting.. I've also tried iterating through the list after the collector has finished.. but that was even worse. I'm open to ideas :-). Thanks in advance.

    Read the article

  • Use Javascript to copy Text from Label

    - by Josh
    Hello All- Label1 (asp.net control) is located inside Panel1 of my webpage and I have a button called bt. What is the Javascript to copy the Text from Label1 to the clipboard? Thanks, @ artlung, I placed the below code just outside of my form but inside the body. The last line of code I placed inside Panel1 of my form. Anything wrong with this code because nothing happens when I click the Copy to Clipboard button. <script language="JavaScript"> var clip = new ZeroClipboard.Client(); clip.addEventListener( 'mouseDown', function(client) { // set text to copy here clip.setText( document.getElementById('form1.Label1').value ); // alert("mouse down"); } ); clip.glue( 'd_clip_button' ); </script> The next line of code is above the script tags but inside Panel1 in my form <div id="d_clip_button">Copy To Clipboard</div>

    Read the article

  • java, swing, Gridlayout problem

    - by josh
    I have a panel with GridLayout But when I'm trying to run the program, only the first button out of 100 is shown. Futhermore, the rest appear only when I move the cursor over them. What's wrong with it? Here's the whole class(Life.CELLS=10 and CellButton is a class which extends JButton) public class MainLayout extends JFrame { public MainLayout() { setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); setSize(650, 750); setLayout(new FlowLayout()); //setResizable(false); final JPanel gridPanel = new JPanel(new GridLayout(Life.CELLS, Life.CELLS)); for (int i=0; i<Life.CELLS; i++) { for (int j=0; j<Life.CELLS; j++) { CellButton jb = new CellButton(i, j); jb.setPreferredSize(new Dimension(jb.getIcon().getIconHeight(), jb.getIcon().getIconWidth())); buttons[i][j] = jb; grid[i][j] = false; gridPanel.add(jb); } } add(gridPanel); } } This is code of CellButton package classes; import javax.swing.JButton; import javax.swing.ImageIcon; import javax.swing.JFrame; public class CellButton extends JButton { private int x; private int y; boolean alive; ImageIcon icon; boolean next; // icons for grids final ImageIcon dead = new ImageIcon(JFrame.class.getResource("/images/image1.gif")); final ImageIcon live = new ImageIcon(JFrame.class.getResource("/images/image2.gif")); public CellButton(int X, int Y) { super(); x = X; y = Y; alive = false; icon = dead; setIcon(icon); } public int getX() { return x; } public int getY() { return y; } public boolean isAlive() { return alive; } public void relive() { alive = true; icon = live; setIcon(icon); } public void die() { alive = false; icon = dead; setIcon(icon); } public void setNext(boolean n) { next = n; } public boolean getNext() { return next; } public ImageIcon getIcon() { return icon; } }

    Read the article

  • Git checkout doesn't change anything, and it's getting very frustrating

    - by Josh
    I really like git. At least, I like the idea of git. Being able to checkout my master project as a separate branch where I can change whatever I want without risk of screwing everything else up is awesome. But it's not working. Every time I checkout a branch to another branch, make changes to the one branch, and then checkout the original branch, I still have all the files and changes that happened in the other branch. This is getting extremely frustrating. I've read that this can happen when you have files open in the IDE while doing this, but I've been pretty careful about that and both closed the files in the IDE, closed the IDE, and shut down my rails server before switching branches, and this still happens. Also, running 'git clean -f' either deletes everything that happened after some arbitrary commit (and randomly, at that), or, as in the latest case, didn't change anything back to its original state. I thought I was using git correctly, but at this point, I'm at my wit's end here. I'm trying to work with a bunch of experimental code using a stable version of my project, but I keep having to manually track down and fix all the changes I made. Any ideas or suggestions? git checkout -b photo_tagging git branch # to make sure it's right # make a bunch of changes, creations, etc git status # see what's changed since before git add . # approve of the changes, I guess, since if I do git commit after this, it says no changes git commit -m 'these are changes I made' git checkout master git branch #=> *master # look at files, tags_controller is still there, added in photo_tagging # and code added in photo_tagging branch are still there in *master This seems to happen whether I do a commit or not on the branch.

    Read the article

  • How do you write your QTP Tests?

    - by Josh Harris
    I am experimenting with using QTP for some webapp ui automation testing and I was wondering how people usually write their QTP tests. Do you use the object map, descriptive programming, a combination or some other way all together? Any little code example would be appreciated, Thank you

    Read the article

  • Imagemagick - File Naming

    - by Josh Crowder
    I am using the convert command to convert a pdf to multiple pngs, I need the naming conventions to be slide-##.png at the moment they come out like slide-1.png but because there is 20+ slides when I loop through them to add them into the model the order comes up wrong, so it looks like slide-1.png slide-10.png slide-11.png and so on, how can I force convert to use double numbers like 01 02 03 and so forth or is there a better way to loop through them, this is the code I have at the moment def convert_keynote_to_slides system('convert -size 640x300 ' + keynote.queued_for_write[:original].path + ' ~/rails/arcticfox/public/system/keynotes/slides/'+File.basename( self.keynote_file_name )+'0%d.png') slide_basename = File.basename( self.keynote_file_name ) files = Dir.entries('/Users/joshcrowder/rails/arcticfox/public/system/keynotes/slides') for file in files #puts file if file.include?(slide_basename +'-') self.slides.build("slide" => "#{file}") if file.include?(slide_basename) end end

    Read the article

  • how to move and print squares visited by a knight in following order?

    - by josh kant
    Lets say you have a 5/5 board and you place and the knight started moving form the middle square. Every time knight moves it has to follow the following pattern. its easy if you draw what i mean. I am trying to code for the possible moves and print out the no. of moves in the nXn (in this case 5X5) board. The print out should be the no. of order in which the knight moved. { //move 1 //2 squares up and 1 to the left //move 2 //2 squares up and 1 to the right //move 3 //1 square up and 2 to the right //move 4 //1 square down and 2 to the right //move 5 //2 squares down and 1 to the right //move 6 //2 squares down and 1 to the left //move 7 //1 square down and 2 to the left //move 8 //one square up and 2 to the left } Any help would be appreciated. Thank you in advance..

    Read the article

  • How big can a user agent string get?

    - by Josh
    If you were going to store a user agent in a database, how large would you accomdate for? I found this technet article which recommends keeping UA under 200. It doesn't look like this is defined in the HTTP specification at least not that I found. My UA is already 149 characters, and it seems like each version of .net will be adding to it. I know I can parse the string out and break it down but I'd rather not. EDIT Based on this Blog IE9 will be changing to send the short UA string. This is a good change.

    Read the article

  • How-to build a droplet application in Xcode4?

    - by Josh
    In Xcode3 there used to be a template to build "Droplet" Applications (head/nibless apps that would throw whatever dropped at them at an "on open" Applescript method). In Xcode4 this template is unfortunately gone. What are the required steps to setup an xcode4 droplet project? modify the info.plist i guess to make the app handle drops get rid of the nib (also involves changes in main.m and both AppDelegate.h and AppDelegate.m i guess) Maybe somebody even still has Xcode3 installed and could create an empty applescript droplet app and upload it somewhere? that would be very interesting. thanks! (or is there maybe even a way to export an app bundle created with the AppleScript Editor to Xcode?)

    Read the article

  • How can I find the program making a harmonica sound?

    - by Josh
    A friend has a Windows XP SP3 machine that plays a harmonica sound for about 5 seconds throughout the day at what seems to be random intervals (every couple hours). My question is how can I find the program making this sound? Is there a Windows API hook for monitoring audio access? I've gone through and checked all the standard Windows sounds in the Control Panel and right now the theme is set to no sounds and I personally checked to make sure none of the events have a sound specified. I also checked the Task Scheduler to make sure there wasn't something scheduled to go off every couple hours. Any ideas on how to go about finding the bugger?

    Read the article

  • "Microsoft DNS Client" vs. getaddrinfo?

    - by Josh K
    Right now, my application is using the c-ares asynchronous DNS resolver library on Windows below cURL, and I have users complaining that it behaves differently from other windows apps. One particular user said that "other applications are using the Microsoft DNS client" and experiences no problems. cURL itself has an asynchronous DNS implementation that uses getaddrinfo() in a thread. My guess is that would be equivalent behavior to using the "DNS Client" and its host of functions (e.g. DnsQuery?) So, dear Lazyweb, I ask if there is a tangible difference between the behavior of getaddrinfo() vs. using the actual Dns* APIs from the Win32 API.

    Read the article

  • How to Write to a User.Config file through ConfigurationManager?

    - by Josh G
    I'm trying to persist user settings to a configuration file using ConfigurationManager. I want to scope these settings to the user only, because application changes can't be saved on Vista/Win 7 without admin privileges. This seems to get me the user's configuration, which appears to be saved here in Win 7 ([Drive]:\Users\[Username]\AppData\Local\[ApplicationName]\[AssemblyName][hash]\[Version\) Configuration config = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.PerUserRoamingAndLocal); Whenever I try to save any changes at all to this config I get this exception: InnerException: System.InvalidOperationException Message="ConfigurationSection properties cannot be edited when locked." Source="System.Configuration" StackTrace: at System.Configuration.SectionInformation.VerifyIsEditable() at System.Configuration.MgmtConfigurationRecord.GetConfigDefinitionUpdates(Boolean requireUpdates, ConfigurationSaveMode saveMode, Boolean forceSaveAll, ConfigDefinitionUpdates& definitionUpdates, ArrayList& configSourceUpdates) I have tried adding a custom ConfigurationSection to this config. I have tried adding to the AppSettingsSection. Whenever I call config.Save() it throws the exception above. Any ideas? I tried using the ApplicationSettingsBase class through the Project-Settings designer, but it doesn't appear that you can save custom types with this. I want similar functionality with the ability to save custom types. Thanks.

    Read the article

  • Knight movement.... " how to output all possible moves. "

    - by josh kant
    The following is the code i wrote.. I have to write it for nXn but for easyness i tried to test it for 5X5. It does not display my output... could anybody tell me whats wrong with the following code: { #include <iostream> #include <iomanip> using namespace std; void knight ( int startx, int starty, int n, int p[][5], int used [][5], int &count); int main ( ) { const int n = 5; // no. of cloumns and rows int startx = 0; int starty = 0; int p[5][5]; int used[5][5]; int count = 1; int i= 0; int j = 0; //initializing the array for ( i = 0; i < 5; i++) { for ( j = 0; j < 5; j++) { p[i][j] = 0; used [i][j] = 0; } } //outputting the initialized array.. i=0; while ( i< 5) { for ( j = 0; j < 5; j++) { cout << setw(3) << p[i][j]; } i++; cout << endl; } knight (startx,starty,n,p,used,count); return 0; } void knight ( int x, int y, int n, int p[][5], int used [][5], int &count) { int i = 0; //knight (x,y,n,p,used,count) for ( i = 0; i < n*n; i++) { if ( used [x][y] == 0 ) { used[x][y] = 1; // mark it used; p[x][y] += count; //inserting step no. into the solution //go for the next possible steps; //move 1 //2 squares up and 1 to the left if (x-1 < 0 && y+2 < n && p[x-1][y+2] == 0) { used[x-1][y+2] = 1; p[x-1][y+2] += count; knight (x-1,y+2,n,p,used,count); used[x-1][y+2] = 0; } //move 2 //2 squares up and 1 to the right if ( x+1 < n && y+2 < n && p[x+1][y+2] == 0 ) { used[x+1][y+2] = 1; p[x+1][y+2] += count; knight (x+1,y+2,n,p,used,count); used[x+1][y+2] = 0; } //move 3 //1 square up and 2 to the right if ( x+2 < n && y+1 < n && p[x+2][y+1] == 0 ) { used[x+2][y+1] = 1; p[x+2][y+1] += count; knight (x+2,y+1,n,p,used,count); used[x+2][y+1] = 0; } //move 4 //1 square down and 2 to the right if ( x+2 < n && y-1 < n && p[x+2][y-1] == 0 ) { used[x+2][y-1] = 1; p[x+2][y-1] += count; knight (x+2,y-1,n,p,used,count); used[x+2][y-1] = 0; } //move 5 //2 squares down and 1 to the right if ( x+1 < n && y-2 < n && p[x+1][y-2] == 0 ) { used[x+1][y-2] = 1; p[x+1][y-2] += count; knight (x+1,y-2,n,p,used,count); used[x+1][y-2] = 0; } //move 6 //2 squares down and 1 to the left if ( x-1 < n && y-2 < n && p[x-1][y-2] == 0 ) { used[x-1][y-2] = 1; p[x-1][y-2] += count; knight (x-1,y-2,n,p,used,count); used[x-1][y-2] = 0; } //move 7 //1 square down and 2 to the left if ( x-2 < n && y-1 < n && p[x-2][y-1] == 0 ) { used[x-2][y-1] = 1; p[x-2][y-1] += count; knight (x-2,y-1,n,p,used,count); used[x-2][y-1] = 0; } //move 8 //one square up and 2 to the left if ( x-2 < n && y+1< n && p[x-2][y+1] == 0 ) { used[x-2][y+1] = 1; p[x-2][y+1] += count; knight (x-2,y+1,n,p,used,count); used[x-2][y+1] = 0; } } } if ( x == n-1 && y == n-1) { while ( i != n) { for ( int j = 0; j < n; j++) cout << setw(3) << p[i][j]; i++; } } } Thank you!!

    Read the article

  • #pragma init and #pragma fini using gcc compiler on linux

    - by Josh
    I would like to build some code which calls some code on loadup of the shared library. I thought i would do it like this: #pragma init(my_init) static void my_init () { //do-something } int add (int a,int b) { return a+b; } So when i build that code with gcc -fPIC -g -c -Wall tt.c It returns gcc -fPIC -g -c -Wall tt.c tt.c:2: warning: ignoring #pragma init tt.c:4: warning: ‘my_init’ defined but not used So its warning my #pragmas. I tried this in real code and my code aborted because a function hadn't been called in the pragma section because it was ignored. How do i get gcc to use these #pragma init and fini statemets?

    Read the article

< Previous Page | 17 18 19 20 21 22 23 24 25 26 27 28  | Next Page >