Search Results

Search found 976 results on 40 pages for 'josh'.

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

  • 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

  • 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

  • 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

  • "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

  • 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

  • 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

  • #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

  • 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

  • MySQL top count({column}) with a limit

    - by Josh K
    I have a table with an ip address column. I would like to find the top five addresses which are listed. Right now I'm planning it out the following: Select all distinct ip addresses Loop through them all saying count(id) where IP='{ip}' and storing the count List the top five counts. Downsides include what if I have 500 ip addresses. That's 500 queries I have to run to figure out what are the top five. I'd like to build a query like so select ip from table where 1 order by count({distinct ip}) asc limit 5

    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

  • 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

  • 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

  • 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

  • CSS placement of text

    - by Josh
    Anyone know how I can get "Posted by AUTHOR on April 3rd, 2010 | 0 Comments" underneath the headline of the news links WITHOUT it being apart of the A CLASS? I want it to look, read, and function like: [IMAGE] HEADLINE Posted by AUTHOR on April 3rd, 2010 | 0 Comments All of that in the initial looking field, then the user can click and it expands further. I can obviously get it to work if I put it in the A CLASS tag, but that's the problem. I can't have it there.

    Read the article

  • WCF object parameter loses values

    - by Josh
    I'm passing an object to a WCF service and wasn't getting anything back. I checked the variable as it gets passed to the method that actually does the work and noticed that none of the values are set on the object at that point. Here's the object: [DataContract] public class Section { [DataMember] public long SectionID { get; set; } [DataMember] public string Title { get; set; } [DataMember] public string Text { get; set; } [DataMember] public int Order { get; set; } } Here's the service code for the method: [OperationContract] public List<Section> LoadAllSections(Section s) { return SectionRepository.Instance().LoadAll(s); } The code that actually calls this method is this and is located in a Silverlight XAML file: SectionServiceClient proxy = new SectionServiceClient(); proxy.LoadAllSectionsCompleted += new EventHandler<LoadAllSectionsCompletedEventArgs>(proxy_LoadAllSectionsCompleted); Section s = new Section(); s.SectionID = 4; proxy.LoadAllSectionsAsync(s); When the code finally gets into the method LoadAllSections(Section s), the parameter's SectionID is not set. I stepped through the code and when it goes into the generated code that returns an IAsyncResult object, the object's properties are set. But when it actually calls the method, LoadAllSections, the parameter received is completely blank. Is there something I have to set to make the proeprty stick between method calls?

    Read the article

  • Dojo load time extremely slow on iis

    - by Josh
    I am currently working on a project that is using Dojo as the js framework. Its a rather rich ui and as such is using (and thus loading) a lot of different .js files for the dojo plug-ins When run on an apache server running on a mac, the files (all around 1k) are served very quickly (1 or 2 ms) and the page loads pretty fast (<5 seconds) When run on IIS on Win 7, the files are served at an unbelievably slow rate (150ms - 1s), thus causing the page to take up to 3 minutes to load. I have searched the internet to try to find a solution and have come up empty. Anyone have any ideas?

    Read the article

  • Installing JavaFX 2.0 in Eclipse Juno for Mac

    - by Josh
    I'm running Mac OS X 10.6.x (Snow Leopard) right now, so I'm pretty sure that there could be some issues with supported systems, but I'm trying to install JavaFX 2.0 (or 2.1.x) in Eclipse Juno for Java EE (version 3.8). I have already installed the e(fx)clipse plugin, but I'm not sure if I'm downloading the right JavaFX .zip file from the Oracle website. I downloaded the JavaFX 2.2 beta release because it seemed to be the only release available for OS X, but I could be wrong. Once I download this archive, I'm not exactly what to do with it/where to place it so that Eclipse recognizes it as the JavaFX 2.2 SDK. I know that I have to go into preferences and set the location of the SDK file, but there doesn't seem to be any selectable .jar file or folder to set it to. Am I doing something wrong here? Any help is appreciated. Edit: I worked around the issue by setting the SDK location to the location of the downloaded JavaFX 2.2 SDK in the JavaFX section in the preferences tree.

    Read the article

  • Entity Framework Custom Query Function

    - by Josh
    I have an Entity Framework 4.0 Entity Object called Revision w/ Nullable DateEffectiveFrom and DateEffectiveTo dates. I was wondering if there was a short-hand way of querying an object's RevisionHistory based on a particular QueryDate date instead of having to use the following query structure: var results = EntityObject.Revisions.Where(x => (x.DateEffectiveFrom == null && x.DateEffectiveTo == null) || (x.DateEffectiveFrom == null && x.DateEffectiveTo >= QueryDate) || (x.DateEffectiveFrom <= QueryDate && x.DateEffectiveTo == null) || (x.DateEffectiveFrom <= QueryDate && x.DateEffectiveTo >= QueryDate)); I've tried creating the following boolean function in the Revision class: partial class Revision { public bool IsEffectiveOn(DateTime date) { return (x.DateEffectiveFrom == null && x.DateEffectiveTo == null) || (x.DateEffectiveFrom == null && x.DateEffectiveTo >= date) || (x.DateEffectiveFrom <= date && x.DateEffectiveTo == null) || (x.DateEffectiveFrom <= date && x.DateEffectiveTo >= date)); } ... } And then updating the query to: var results = EntityObject.Revisions.Where(x => x.IsEffectiveOn(QueryDate)); but this obviously doesn't translate to SQL. Any ideas would be much appreciated.

    Read the article

  • Refering to javascript instance methods with a pound/hash sign

    - by Josh
    This question is similar to http://stackoverflow.com/questions/736120/why-are-methods-in-ruby-documentation-preceded-by-a-pound-sign I understand why in Ruby instance methods are proceeded with a pound sign, helping to differentiate talking about SomeClass#someMethod from SomeObject.someMethod and allowing rdoc to work. And I understand that the authors of PrototypeJS admire Ruby (with good reason) and so they use the hash mark convention in their documentation. My question is: is this a standard practice amongst JavaScript developers or is it just Prototype developers who do this? Asked another way, is it proepr for me to refer to instance methods in comments/documentation as SomeClass#someMethod? Or should my documentation refer to `SomeClass.someMethod?

    Read the article

  • How to add a user to a SharePoint group programatically - Access is Denied

    - by Josh
    I have tried and tried to add a user to a SharePoint group using C# programatically (using a non-site admin). If I am logged in as a site admin, it works fine... but, if I am logged in as a non-site admin then I get an access is denied error. After doing some investigation I found that I needed to either "impersonate" the user (which didn't seem to work) or "ensure the user", so I have ended up at this code (which has worked for some people). Can some help explain to me why the following does not work and still gives me an Access is Denied error? SPSecurity.RunWithElevatedPrivileges(delegate() { using (SPSite site = new SPSite(SPControl.GetContextSite(HttpContext.Current).Url)) //have also tried passing in the ID - doesn't make a difference { using (SPWeb web = site.OpenWeb()) { web.AllowUnsafeUpdates = true; // add user to group SPGroup group = this.Web.Groups[groupList.Items[i].Value]; SPUser spUser = web.EnsureUser(provider + ":" + user.UserName); //provider is previously defined spUser.Email = user.Email; spUser.Name = txtFullName.Text; group.AddUser(spUser); // update group.Update(); } } }

    Read the article

  • Why is Magento 1.4 including javascript files by filesystem path?

    - by Josh
    I am in the process of testing a Magento 1.3 site using Magento 1.4. I am seeing very weird and inconsistent behavior. Instead of including the URL of my javascript files, Magento is creating tags with the full filesystem path of the js files, as so: <script type="text/javascript" src="/home/my_username/public_html/js/prototype/prototype.js"></script> I believe this is related to the new "Themes JavaScript and CSS files combined to one file" function. In fact, when I log into the admin and click "Flush JavaScript/CSS Cache", then the first page load is successful, and I see a single JS include similar to: <script type="text/javascript" src="/media/js/5b8cfac152fcb2a5f93ef9571d338c54.js"></script> But subsequent age loads load every single JS file, with the full path names. Which obviously isn't going to work. Anyone have any ideas on what could be wrong or how to fix this issue?

    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

  • Why won't my image display??

    - by Josh
    Hello All- Do y'all see anything wrong with my code below? I want my image to appear immediately after page opens but it only opens after the report is run. Please let me know. Thanks. <%@ Page Language="C#" AutoEventWireup="true" CodeBehind="SelectionReport.aspx.cs" Inherits="Geocortex.Essentials.WebFramework.SelectionReportPage" Culture="auto" UICulture="auto" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" > <head id="Head1" runat="server"> <title><asp:Literal meta:resourcekey="Title1" runat="server" /></title> </head> <body> <form id="form1" runat="server"> <p> <asp:Image ID="Image1" runat="server" ImageAlign="Left" ImageUrl="~/Images/Loading.gif" style="z-index: 1; left: 254px; top: 15px; position: absolute" /> </p> <gcx:SelectionReportViewer ID="SelectionReportViewer" runat="server" /> </form> </body>

    Read the article

  • Setting the Hostname in IIS Bindings Breaks Website

    - by Josh
    I just got a Windows Server 2008 VPS and I'm having trouble getting IIS7 setup. I created a new website in IIS with the path, ip address, and hostname (like 'www.nameofsite.com') and click OK. When I browse to the site it pulls up "http://www.nameofsite.com" in the browser and... nothing... IE cannot display this webpage. If I blank out the hostname in the bindings and click [Browse] it works fine (it takes me to http://10.10.2.92 - the computer's ip). So entering the hostname breaks the website. Any ideas on what I'm missing? Services I might not have running or roles I'm missing? No server roles were initially installed on the VPS so I installed IIS, DHCP, DNS, and Application Server... overkill, but I wasn't sure what to install.

    Read the article

  • Intersection of Inner Polygons of MKPolygon being colored - iOS

    - by Josh Glick
    I am trying to create a fog of war style map where areas I have visited are uncovered and the rest of the map is "hidden". I am using a MKPolygonOverlay that covers the whole map and create inner polygons around all the locations I have visited. However in areas where these inner polygons overlap, that portion of the overlay is still being drawn. As a new user I can't post pictures but here is a link to the image: http://dl.dropbox.com/u/13815916/Screen%20Shot%202012-06-29%20at%204.40.20%20AM.png

    Read the article

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