Search Results

Search found 400 results on 16 pages for 'casey jordan'.

Page 10/16 | < Previous Page | 6 7 8 9 10 11 12 13 14 15 16  | Next Page >

  • How do you hide a Swing Popup when you click somewhere else.

    - by Casey Watson
    I have a Popup that is shown when a user clicks on a button. I would like to hide the popup when any of the following events occur: The user clicks somewhere else in the application. (The background panel for example) The user minimizes the application. The JPopupMenu has this behavior, but I need more than just JMenuItems. The following code block is a simplified illustration to demonstrate the current usage. import java.awt.*; import java.awt.event.ActionEvent; import javax.swing.*; public class PopupTester extends JFrame { public static void main(String[] args) { final PopupTester popupTester = new PopupTester(); popupTester.setLayout(new FlowLayout()); popupTester.setSize(300, 100); popupTester.add(new JButton("Click Me") { @Override protected void fireActionPerformed(ActionEvent event) { Point location = getLocationOnScreen(); int y = (int) (location.getY() + getHeight()); int x = (int) location.getX(); JLabel myComponent = new JLabel("Howdy"); Popup popup = PopupFactory.getSharedInstance().getPopup(popupTester, myComponent, x, y); popup.show(); } }); popupTester.add(new JButton("No Click Me")); popupTester.setVisible(true); popupTester.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); } }

    Read the article

  • How to fix Eclipse validation error "No grammar constraints detected for the document"?

    - by Casey
    Eclipse 3.5.2 is throwing an XML schema warning message: No grammar constraints (DTD or XML schema) detected for the document. The application.xml file: <?xml version="1.0" encoding="UTF-8"?> <application xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/application_5.xsd" version="5"> </application> I do not want to disable the warning. How can I get Eclipse to correctly validate the XML document?

    Read the article

  • When does logic belong in the Business Object/Entity, and when does it belong in a Service?

    - by Casey
    In trying to understand Domain Driven Design I keep returning to a question that I can't seem to definitively answer. How do you determine what logic belongs to a Domain entity, and what logic belongs to a Domain Service? Example: We have an Order class for an online store. This class is an entity and an aggregate root (it contains OrderItems). Public Class Order:IOrder { Private List<IOrderItem> OrderItems Public Order(List<IOrderItem>) { OrderItems = List<IOrderItem> } Public Decimal CalculateTotalItemWeight() //This logic seems to belong in the entity. { Decimal TotalWeight = 0 foreach(IOrderItem OrderItem in OrderItems) { TotalWeight += OrderItem.Weight } return TotalWeight } } I think most people would agree that CalculateTotalItemWeight belongs on the entity. However, at some point we have to ship this order to the customer. To accomplish this we need to do two things: 1) Determine the postage rate necessary to ship this order. 2) Print a shipping label after determining the postage rate. Both of these actions will require dependencies that are outside the Order entity, such as an external webservice to retrieve postage rates. How should we accomplish these two things? I see a few options: 1) Code the logic directly in the domain entity, like CalculateTotalItemWeight. We then call: Order.GetPostageRate Order.PrintLabel 2) Put the logic in a service that accepts IOrder. We then call: PostageService.GetPostageRate(Order) PrintService.PrintLabel(Order) 3) Create a class for each action that operates on an Order, and pass an instance of that class to the Order through Constructor Injection (this is a variation of option 1 but allows reuse of the RateRetriever and LabelPrinter classes): Public Class Order:IOrder { Private List<IOrderItem> OrderItems Private RateRetriever _Retriever Private LabelPrinter _Printer Public Order(List<IOrderItem>, RateRetriever Retriever, LabelPrinter Printer) { OrderItems = List<IOrderItem> _Retriever = Retriever _Printer = Printer } Public Decimal GetPostageRate { _Retriever.GetPostageRate(this) } Public void PrintLabel { _Printer.PrintLabel(this) } } Which one of these methods do you choose for this logic, if any? What is the reasoning behind your choice? Most importantly, is there a set of guidelines that led you to your choice?

    Read the article

  • Implementing a non-public assignment operator with a public named method?

    - by Casey
    It is supposed to copy an AnimatedSprite. I'm having second thoughts that it has the unfortunate side effect of changing the *this object. How would I implement this feature without the side effect? EDIT: Based on new answers, the question should really be: How do I implement a non-public assignment operator with a public named method without side effects? (Changed title as such). public: AnimatedSprite& AnimatedSprite::Clone(const AnimatedSprite& animatedSprite) { return (*this = animatedSprite); } protected: AnimatedSprite& AnimatedSprite::operator=(const AnimatedSprite& rhs) { if(this == &rhs) return *this; destroy_bitmap(this->_frameImage); this->_frameImage = create_bitmap(rhs._frameImage->w, rhs._frameImage->h); clear_bitmap(this->_frameImage); this->_frameDimensions = rhs._frameDimensions; this->CalcCenterFrame(); this->_frameRate = rhs._frameRate; if(rhs._animation != nullptr) { delete this->_animation; this->_animation = new a2de::AnimationHandler(*rhs._animation); } else { delete this->_animation; this->_animation = nullptr; } return *this; }

    Read the article

  • Capistrano Error

    - by Casey van den Bergh
    I'm Running CentOS 5 32 bit version. This is my deploy.rb file on my local computer: #======================== #CONFIG #======================== set :application, "aeripets" set :scm, :git set :git_enable_submodules, 1 set :repository, "[email protected]:aeripets.git" set :branch, "master" set :ssh_options, { :forward_agent => true } set :stage, :production set :user, "root" set :use_sudo, false set :runner, "root" set :deploy_to, "/var/www/#{application}" set :app_server, :passenger set :domain, "aeripets.co.za" #======================== #ROLES #======================== role :app, domain role :web, domain role :db, domain, :primary => true #======================== #CUSTOM #======================== namespace :deploy do task :start, :roles => :app do run "touch #{current_release}/tmp/restart.txt" end task :stop, :roles => :app do # Do nothing. end desc "Restart Application" task :restart, :roles => :app do run "touch #{current_release}/tmp/restart.txt" end end And this the error I get on my local computer when I try to cap deploy. executing deploy' * executingdeploy:update' ** transaction: start * executing deploy:update_code' executing locally: "git ls-remote [email protected]:aeripets.git master" command finished in 1297ms * executing "git clone -q [email protected]:aeripets.git /var/www/seripets/releases/20111126013705 && cd /var/www/seripets/releases/20111126013705 && git checkout -q -b deploy 32ac552f57511b3ae9be1d58aec54d81f78f8376 && git submodule -q init && git submodule -q sync && export GIT_RECURSIVE=$([ ! \"git --version\" \\< \"git version 1.6.5\" ] && echo --recursive) && git submodule -q update --init $GIT_RECURSIVE && (echo 32ac552f57511b3ae9be1d58aec54d81f78f8376 > /var/www/seripets/releases/20111126013705/REVISION)" servers: ["aeripets.co.za"] Password: [aeripets.co.za] executing command ** [aeripets.co.za :: err] sh: git: command not found command finished in 224ms *** [deploy:update_code] rolling back * executing "rm -rf /var/www/seripets/releases/20111126013705; true" servers: ["aeripets.co.za"] [aeripets.co.za] executing command command finished in 238ms failed: "sh -c 'git clone -q [email protected]:aeripets.git /var/www/seripets/releases/20111126013705 && cd /var/www/seripets/releases/20111126013705 && git checkout -q -b deploy 32ac552f57511b3ae9be1d58aec54d81f78f8376 && git submodule -q init && git submodule -q sync && export GIT_RECURSIVE=$([ ! \"git --version`\" \< \"git version 1.6.5\" ] && echo --recursive) && git submodule -q update --init $GIT_RECURSIVE && (echo 32ac552f57511b3ae9be1d58aec54d81f78f8376 /var/www/seripets/releases/20111126013705/REVISION)'" on aeripets.co.za

    Read the article

  • Databinding a list (in an object) to a combobox in VB.net

    - by Casey
    VB 2008 .NET 3.5 I have a custom "Shipment" object that contains a list of "ShippingRate" objects. This list of "ShippingRates" is accessible through a property "Shipment.PossibleShippingRates." That property simply returns a copy of the list of "ShippingRate" for that particular Shipment. My UI layer receives a list of "Shipment" objects from the BLL. This list is databound to a datagridview, and shows details relevant to the Shipment such as Shipping Address, etc. I want to bind the "Shipment.PossibleShippingRates" property to a combobox, such that when the user changes the grid row, the combobox reflects the "PossibleShippingRates" for that "Shipment." In addition, I need a way to store the "ShippingRate" they selected from the combobox for later use. I have tried a few ideas, but none of them work properly. Any ideas on how to do this?

    Read the article

  • Problem releasing UIImageView after adding to UIScrollView

    - by Josiah Jordan
    I'm having a memory problem related to UIImageView. After adding this view to my UIScrollView, if I try to release the UIImageView the application crashes. According to the stack trace, something is calling [UIImageView stopAnimating] after [UIImageView dealloc] is called. However, if I don't release the view the memory is never freed up, and I've confirmed that there remains an extra retain call on the view after deallocating...which causes my total allocations to climb quickly and eventually crash the app after loading the view multiple times. I'm not sure what I'm doing wrong here though...I don't know what is trying to access the UIImageView after it has been released. I've included the relevant header and implementation code below (I'm using the Three20 framework, if that has anything to do with it...also, AppScrollView is just a UIScrollView that forwards the touchesEnded event to the next responder): Header: @interface PhotoHiResPreviewController : TTViewController <UIScrollViewDelegate> { NSString* imageURL; UIImage* hiResImage; UIImageView* imageView; UIView* mainView; AppScrollView* mainScrollView; } @property (nonatomic, retain) NSString* imageURL; @property (nonatomic, retain) NSString* imageShortURL; @property (nonatomic, retain) UIImage* hiResImage; @property (nonatomic, retain) UIImageView* imageView; - (id)initWithImageURL:(NSString*)imageTTURL; Implementation: @implementation PhotoHiResPreviewController @synthesize imageURL, hiResImage, imageView; - (id)initWithImageURL:(NSString*)imageTTURL { if (self = [super init]) { hiResImage = nil; NSString *documentsDirectory = [NSString stringWithString:[NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) lastObject]]; [self setImageURL:[NSString stringWithFormat:@"%@/%@.jpg", documentsDirectory, imageTTURL]]; } return self; } - (void)loadView { [super loadView]; // Initialize the scroll view hiResImage = [UIImage imageWithContentsOfFile:self.imageURL]; CGSize photoSize = [hiResImage size]; mainScrollView = [[AppScrollView alloc] initWithFrame:[UIScreen mainScreen].bounds]; mainScrollView.autoresizingMask = ( UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight); mainScrollView.backgroundColor = [UIColor blackColor]; mainScrollView.contentSize = photoSize; mainScrollView.contentMode = UIViewContentModeScaleAspectFit; mainScrollView.delegate = self; // Create the image view and add it to the scrollview. UIImageView *tempImageView = [[UIImageView alloc] initWithFrame:CGRectMake(0.0, 0.0, photoSize.width, photoSize.height)]; tempImageView.contentMode = UIViewContentModeCenter; [tempImageView setImage:hiResImage]; self.imageView = tempImageView; [tempImageView release]; [mainScrollView addSubview:imageView]; // Configure zooming. CGSize screenSize = [[UIScreen mainScreen] bounds].size; CGFloat widthRatio = screenSize.width / photoSize.width; CGFloat heightRatio = screenSize.height / photoSize.height; CGFloat initialZoom = (widthRatio > heightRatio) ? heightRatio : widthRatio; mainScrollView.maximumZoomScale = 3.0; mainScrollView.minimumZoomScale = initialZoom; mainScrollView.zoomScale = initialZoom; mainScrollView.bouncesZoom = YES; mainView = [[UIView alloc] initWithFrame:[UIScreen mainScreen].bounds]; mainView.autoresizingMask = ( UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight); mainView.backgroundColor = [UIColor blackColor]; mainView.contentMode = UIViewContentModeScaleAspectFit; [mainView addSubview:mainScrollView]; // Add to view self.view = mainView; [imageView release]; [mainScrollView release]; [mainView release]; } - (UIView *)viewForZoomingInScrollView:(UIScrollView *)scrollView { return imageView; } - (void)dealloc { mainScrollView.delegate = nil; TT_RELEASE_SAFELY(imageURL); TT_RELEASE_SAFELY(hiResImage); [super dealloc]; } I'm not sure how to get around this. If I remove the call to [imageView release] at the end of the loadView method everything works fine...but I have massive allocations that quickly climb to a breaking point. If I DO release it, however, there's that [UIImageView stopAnimating] call that crashes the application after the view is deallocated. Thanks for any help! I've been banging my head against this one for days. :-P Cheers, Josiah

    Read the article

  • Using windows command line from Pascal

    - by Jordan
    I'm trying to use some windows command line tools from within a short Pascal program. To make it easier, I'm writing a function called DoShell which takes a command line string as an argument and returns a record type called ShellResult, with one field for the process's exitcode and one field for the process's output text. I'm having major problems with some standard library functions not working as expected. The DOS Exec() function is not actually carrying out the command i pass to it. The Reset() procedure gives me a runtime error RunError(2) unless i set the compiler mode {I-}. In that case i get no runtime error, but the Readln() functions that i use on that file afterwards don't actually read anything, and furthermore the Writeln() functions used after that point in the code execution do nothing as well. Here's the source code of my program so far. I'm using Lazarus 0.9.28.2 beta, with Free Pascal Compiler 2.24 program project1; {$mode objfpc}{$H+} uses Classes, SysUtils, StrUtils, Dos { you can add units after this }; {$IFDEF WINDOWS}{$R project1.rc}{$ENDIF} type ShellResult = record output : AnsiString; exitcode : Integer; end; function DoShell(command: AnsiString): ShellResult; var exitcode: Integer; output: AnsiString; exepath: AnsiString; exeargs: AnsiString; splitat: Integer; F: Text; readbuffer: AnsiString; begin //Initialize variables exitcode := 0; output := ''; exepath := ''; exeargs := ''; splitat := 0; readbuffer := ''; Result.exitcode := 0; Result.output := ''; //Split command for processing splitat := NPos(' ', command, 1); exepath := Copy(command, 1, Pred(splitat)); exeargs := Copy(command, Succ(splitat), Length(command)); //Run command and put output in temporary file Exec(FExpand(exepath), exeargs + ' __output'); exitcode := DosExitCode(); //Get output from file Assign(F, '__output'); Reset(F); Repeat Readln(F, readbuffer); output := output + readbuffer; readbuffer := ''; Until Eof(F); //Set Result Result.exitcode := exitcode; Result.output := output; end; var I : AnsiString; R : ShellResult; begin Writeln('Enter a command line to run.'); Readln(I); R := DoShell(I); Writeln('Command Exit Code:'); Writeln(R.exitcode); Writeln('Command Output:'); Writeln(R.output); end.

    Read the article

  • PHP MySQL Update query

    - by Jordan Pagaduan
    I have a website that has an update query. Example. Table name - myTable Table Content - id(AI) name -- myName age -- 13 image -- (no values) birthdate -- (no values) I only put values in name and age. In image and birthdate, I haven't put anything. If I edit it and update it and I don't put anything in name and in age, I only put values in image and in birthdate. The output is like this. (This ouput I wanted) Table name - myTable Table Content - id(AI) name -- myName age -- 13 image -- myImage.jpg birthdate -- Feb. 31, 2010 This is my code: <?php //mysql connect... //mysql select database... $sql = "UPDATE myTable SET name = '".$name."', age = '".$age."', image = '".$image."', birthdate"'$birthdate.."' WHERE id = $id"; mysql_query($sql); ?> I used this code but the output is: Table name - myTable Table Content - id(AI) name -- (no values) age -- (no values) image -- myImage.jpg birthdate -- Feb. 31, 2010 Feel free to ask if you don't understand my question Thank you

    Read the article

  • Problem with room/screen/menu controller in python game: old rooms are not removed from memory

    - by Jordan Magnuson
    I'm literally banging my head against a wall here (as in, yes, physically, at my current location, I am damaging my cranium). Basically, I've got a Python/Pygame game with some typical game "rooms", or "screens." EG title screen, high scores screen, and the actual game room. Something bad is happening when I switch between rooms: the old room (and its various items) are not removed from memory, or from my event listener. Not only that, but every time I go back to a certain room, my number of event listeners increases, as well as the RAM being consumed! (So if I go back and forth between the title screen and the "game room", for instance, the number of event listeners and the memory usage just keep going up and up. The main issue is that all the event listeners start to add up and really drain the CPU. I'm new to Python, and don't know if I'm doing something obviously wrong here, or what. I will love you so much if you can help me with this! Below is the relevant source code. Complete source code at http://www.necessarygames.com/my_games/betraveled/betraveled_src0328.zip MAIN.PY class RoomController(object): """Controls which room is currently active (eg Title Screen)""" def __init__(self, screen, ev_manager): self.room = None self.screen = screen self.ev_manager = ev_manager self.ev_manager.register_listener(self) self.room = self.set_room(config.room) def set_room(self, room_const): #Unregister old room from ev_manager if self.room: self.room.ev_manager.unregister_listener(self.room) self.room = None #Set new room based on const if room_const == config.TITLE_SCREEN: return rooms.TitleScreen(self.screen, self.ev_manager) elif room_const == config.GAME_MODE_ROOM: return rooms.GameModeRoom(self.screen, self.ev_manager) elif room_const == config.GAME_ROOM: return rooms.GameRoom(self.screen, self.ev_manager) elif room_const == config.HIGH_SCORES_ROOM: return rooms.HighScoresRoom(self.screen, self.ev_manager) def notify(self, event): if isinstance(event, ChangeRoomRequest): if event.game_mode: config.game_mode = event.game_mode self.room = self.set_room(event.new_room) #Run game def main(): pygame.init() screen = pygame.display.set_mode(config.screen_size) ev_manager = EventManager() spinner = CPUSpinnerController(ev_manager) room_controller = RoomController(screen, ev_manager) pygame_event_controller = PyGameEventController(ev_manager) spinner.run() EVENT_MANAGER.PY class EventManager: #This object is responsible for coordinating most communication #between the Model, View, and Controller. def __init__(self): from weakref import WeakKeyDictionary self.last_listeners = {} self.listeners = WeakKeyDictionary() self.eventQueue= [] self.gui_app = None #---------------------------------------------------------------------- def register_listener(self, listener): self.listeners[listener] = 1 #---------------------------------------------------------------------- def unregister_listener(self, listener): if listener in self.listeners: del self.listeners[listener] #---------------------------------------------------------------------- def clear(self): del self.listeners[:] #---------------------------------------------------------------------- def post(self, event): # if isinstance(event, MouseButtonLeftEvent): # debug(event.name) #NOTE: copying the list like this before iterating over it, EVERY tick, is highly inefficient, #but currently has to be done because of how new listeners are added to the queue while it is running #(eg when popping cards from a deck). Should be changed. See: http://dr0id.homepage.bluewin.ch/pygame_tutorial08.html #and search for "Watch the iteration" print 'Number of listeners: ' + str(len(self.listeners)) for listener in list(self.listeners): #NOTE: If the weakref has died, it will be #automatically removed, so we don't have #to worry about it. listener.notify(event) def notify(self, event): pass #------------------------------------------------------------------------------ class PyGameEventController: """...""" def __init__(self, ev_manager): self.ev_manager = ev_manager self.ev_manager.register_listener(self) self.input_freeze = False #---------------------------------------------------------------------- def notify(self, incoming_event): if isinstance(incoming_event, UserInputFreeze): self.input_freeze = True elif isinstance(incoming_event, UserInputUnFreeze): self.input_freeze = False elif isinstance(incoming_event, TickEvent) or isinstance(incoming_event, BoardCreationTick): #Share some time with other processes, so we don't hog the cpu pygame.time.wait(5) #Handle Pygame Events for event in pygame.event.get(): #If this event manager has an associated PGU GUI app, notify it of the event if self.ev_manager.gui_app: self.ev_manager.gui_app.event(event) #Standard event handling for everything else ev = None if event.type == QUIT: ev = QuitEvent() elif event.type == pygame.MOUSEBUTTONDOWN and not self.input_freeze: if event.button == 1: #Button 1 pos = pygame.mouse.get_pos() ev = MouseButtonLeftEvent(pos) elif event.type == pygame.MOUSEBUTTONDOWN and not self.input_freeze: if event.button == 2: #Button 2 pos = pygame.mouse.get_pos() ev = MouseButtonRightEvent(pos) elif event.type == pygame.MOUSEBUTTONUP and not self.input_freeze: if event.button == 2: #Button 2 Release pos = pygame.mouse.get_pos() ev = MouseButtonRightReleaseEvent(pos) elif event.type == pygame.MOUSEMOTION: pos = pygame.mouse.get_pos() ev = MouseMoveEvent(pos) #Post event to event manager if ev: self.ev_manager.post(ev) # elif isinstance(event, BoardCreationTick): # #Share some time with other processes, so we don't hog the cpu # pygame.time.wait(5) # # #If this event manager has an associated PGU GUI app, notify it of the event # if self.ev_manager.gui_app: # self.ev_manager.gui_app.event(event) #------------------------------------------------------------------------------ class CPUSpinnerController: def __init__(self, ev_manager): self.ev_manager = ev_manager self.ev_manager.register_listener(self) self.clock = pygame.time.Clock() self.cumu_time = 0 self.keep_going = True #---------------------------------------------------------------------- def run(self): if not self.keep_going: raise Exception('dead spinner') while self.keep_going: time_passed = self.clock.tick() fps = self.clock.get_fps() self.cumu_time += time_passed self.ev_manager.post(TickEvent(time_passed, fps)) if self.cumu_time >= 1000: self.cumu_time = 0 self.ev_manager.post(SecondEvent(fps=fps)) pygame.quit() #---------------------------------------------------------------------- def notify(self, event): if isinstance(event, QuitEvent): #this will stop the while loop from running self.keep_going = False EXAMPLE CLASS USING EVENT MANAGER class Timer(object): def __init__(self, ev_manager, time_left): self.ev_manager = ev_manager self.ev_manager.register_listener(self) self.time_left = time_left self.paused = False def __repr__(self): return str(self.time_left) def pause(self): self.paused = True def unpause(self): self.paused = False def notify(self, event): #Pause Event if isinstance(event, Pause): self.pause() #Unpause Event elif isinstance(event, Unpause): self.unpause() #Second Event elif isinstance(event, SecondEvent): if not self.paused: self.time_left -= 1

    Read the article

  • Creating Array of settings names and values using ADO.NET Entities

    - by jordan.baucke
    I'm using an ADO.NET Entities (.edmx) data-model along with MVC2 to build an application. I have a DB table where I want to store settings for method that run elsewhere. MVC2 allows me to create a view, editor, etc. to update this table which is great, but now when I want to do simple assignments based on column titles I'm a bit confused. For example, I would like to easily build an array that I could offset into the record's value based on it's "Title" Column: var entities = new ManagerEntities(); Setting[] settings = entities.settings.ToArray(); This returns something like: Settings[0].[SettingTitle][SettingValue] However, I would like to more easily index into the value than having to loop through all the returned settings, when they're already index. string URL_ID_NEED = [NeededUrl][http://www.url.com] Am I missing something relatively simple? Thanks! ========================= *Update* ========================= Ok, I think I've got a solution, but I'm wondering why this would be so complicated, and if I'm just not thinking of the right context for ADO.NET objects, here's what I did: public string GetSetting(string SettingName) { var entities = new LabelManagerEntities(); IEnumerable<KeyValuePair<string, object>> entityKeyValues = new KeyValuePair<string, object>[] { new KeyValuePair<string, object>("SettingTitle", SettingName) }; EntityKey key = new EntityKey("LabelManagerEntities.Settings", entityKeyValues); // Get the object from the context or the persisted store by its key. Setting settingvalue = (Setting)entities.GetObjectByKey(key); return settingvalue.SettingValue.ToString(); } This method handles the job of querying the Entities by "Key" to get back the correct value as a returned string (which I can than strip out the " ", or or cast to an integer, etc. etc.,) Am I just duplicating functionality that already exists in ADO.NET's design patterns (I'm pretty new to it) -- or is this a reasonable solution?

    Read the article

  • Creating text file from as2

    - by Jordan
    I'm trying to find a way to write to a text file from as2. I don't want to use any php or asp because my app needs to run without an internet connection. As3 has FileReference.save() and judging by the amount of searching I've done, as2 doesn't have that simple of a solution. Does anyone have a way even if its hacky to write to a txt file from as2?

    Read the article

  • How do I use a .NET class in VBA? Syntax help!

    - by Jordan S
    ok I have couple of .NET classes that I want to use in VBA. So I must register them through COM and all that. I think I have the COM registration figured out (finally) but now I need help with the syntax of how to create the objects. Here is some pseudo code showing what I am trying to do. EDIT: Changed Attached Objects to return an ArrayList instead of a List The .NET classes look like this... public class ResourceManagment { public ResourceManagment() { // Default Constructor } public static List<RandomObject> AttachedObjects() { ArrayList list = new ArrayList(); return list; } } public class RandomObject { // public RandomObject(int someParam) { } } OK, so this is what I would like to do in VBA (demonstrated in C#) but I don't know how... public class VBAClass { public void main() { ArrayList myList = ResourceManagment.AttachedObjects(); foreach(RandomObject x in myList) { // Do something with RandomObject x like list them in a Combobox } } } One thing to note is that RandomObject does not have a public default constructor. So I can not create an instance of it like Dim x As New RandomObject. MSDN says that you can not instantiate an object that doesn't have a default constructor through COM but you can still use the object type if it is returned by another method... Types must have a public default constructor to be instantiated through COM. Managed, public types are visible to COM. However, without a public default constructor (a constructor without arguments), COM clients cannot create an instance of the type. COM clients can still use the type if the type is instantiated in another way and the instance is returned to the COM client. You may include overloaded constructors that accept varying arguments for these types. However, constructors that accept arguments may only be called from managed (.NET) code. Added: Here is my attempt in VB: Dim count As Integer count = 0 Dim myObj As New ResourceManagment For Each RandomObject In myObj.AttachedObjects count = count + 1 Next RandomObject

    Read the article

  • How do I use custom member properties for people on my .NET website

    - by Jordan S
    I am trying to make an asp.net website using Visual web dev and C# that accesses data in an SQL database. For my site, I need to be able to save and access additional user properties such as age and gender. I have been playing around with the built in .NET Login tools but I don't understand how to keep track of the additional properties (age, gender...) I could store all the users information in my own database but how do I correlate the users data in my DB to the usernames in the member database that is automatically created?

    Read the article

  • C# Class Library wont register for COM

    - by Jordan S
    Hello All, I am trying to gain access to a .NET class library in Microsoft Excel. To do this I know that the .NET class library must be registered with COM. So I tried going to my Assembly Info and Setting COM Visible to true. Then on the build tab I set Register for COM Interop for true also. I checked the AssemblyInfo.cs file and it does contain [assembly: ComVisible(true)]. But for some reason when I try to add a reference to the Class Lib in Excel the namespace does not show up in the list. I made a quick test Class library with nothing in it and did the same thing (set COM Vis = true , and Register For COM Interop = true) and that one does show up on the list of available references. I can't figure out what the difference is between the two classes. I am not sure if my class is actually being registered for COM interop or not. Does anyone know what I can do to fix this???

    Read the article

  • How to sketch out an event-driven system?

    - by Jordan
    I'm trying to design a system in Node.js (an attempt at solving one of my earlier problems, using Node's concurrency) but I'm running into trouble figuring out how to draw a plan of how the thing should operate. I'm getting very tripped up thinking in terms of callbacks instead of returned values. The flow isn't linear, and it's really boggling my ability to draft it. How does one draw out an operational flow for an event-driven system? I need something I can look at and say "Ok, yes, that's how it will work. I'll start it over here, and it will give me back these results over here." Pictures would be very helpful for this one. Thanks. Edit: I'm looking for something more granular than UML, specifically, something that will help me transition from a blocking and object-oriented programming structure, where I'm comfortable, to a non-blocking and event driven structure, where I'm unfamiliar.

    Read the article

  • Help finding longest non-repeating path through connected nodes - Python

    - by Jordan Magnuson
    I've been working on this for a couple of days now without success. Basically, I have a bunch of nodes arranged in a 2D matrix. Every node has four neighbors, except for the nodes on the sides and corners of the matrix, which have 3 and 2 neighbors, respectively. Imagine a bunch of square cards laid out side by side in a rectangular area--the project is actually simulating a sort of card/board game. Each node may or may not be connected to the nodes around it. Each node has a function (get_connections()), that returns the nodes immediately around it that it is connected to (so anywhere from 0 to 4 nodes are returned). Each node also has an "index" property, that contains it's position on the board matrix (eg '1, 4' - row 1, col 4). What I am trying to do is find the longest non-repeating path of connected nodes given a particular "start" node. I've uploaded a couple of images that should give a good idea of what I'm trying to do: In both images, the highlighted red cards are supposedly the longest path of connected cards containing the most upper-left card. However, you can see in both images that a couple of cards that should be in the path have been left out (Romania and Maldova in the first image, Greece and Turkey in the second) Here's the recursive function that I am using currently to find the longest path, given a starting node/card: def get_longest_trip(self, board, processed_connections = list(), processed_countries = list()): #Append this country to the processed countries list, #so we don't re-double over it processed_countries.append(self) possible_trips = dict() if self.get_connections(board): for i, card in enumerate(self.get_connections(board)): if card not in processed_countries: processed_connections.append((self, card)) possible_trips[i] = card.get_longest_trip(board, processed_connections, processed_countries) if possible_trips: longest_trip = [] for i, trip in possible_trips.iteritems(): trip_length = len(trip) if trip_length > len(longest_trip): longest_trip = trip longest_trip.append(self) return longest_trip else: print card_list = [] card_list.append(self) return card_list else: #If no connections from start_card, just return the start card #as the longest trip card_list = [] card_list.append(board.start_card) return card_list The problem here has to do with the processed_countries list: if you look at my first screenshot, you can see that what has happened is that when Ukraine came around, it looked at its two possible choices for longest path (Maldova-Romania, or Turkey, Bulgaria), saw that they were both equal, and chose one indiscriminantly. Now when Hungary comes around, it can't attempt to make a path through Romania (where the longest path would actually be), because Romania has been added to the processed_countries list by Ukraine. Any help on this is EXTREMELY appreciated. If you can find me a solution to this, recursive or not, I'd be happy to donate some $$ to you. I've uploaded my full source code (Python 2.6, Pygame 1.9 required) to: http://www.necessarygames.com/junk/planes_trains.zip The relevant code is in src/main.py, which is all set to run.

    Read the article

  • Javascript add a PHP file.

    - by Jordan Pagaduan
    var editing = false; if (document.getElementById && document.createElement) { var butt = document.createElement('BUTTON'); var buttext = document.createTextNode('Ready!'); butt.appendChild(buttext); butt.onclick = saveEdit; } function catchIt(e) { if (editing) return; if (!document.getElementById || !document.createElement) return; if (!e) var obj = window.event.srcElement; else var obj = e.target; while (obj.nodeType != 1) { obj = obj.parentNode; } if (obj.tagName == 'TEXTAREA' || obj.tagName == 'A') return; while (obj.nodeName != 'P' && obj.nodeName != 'HTML') { obj = obj.parentNode; } if (obj.nodeName == 'HTML') return; var x = obj.innerHTML; var y = document.createElement('TEXTAREA'); var z = obj.parentNode; z.insertBefore(y,obj); z.insertBefore(butt,obj); z.removeChild(obj); y.value = x; y.focus(); editing = true; } function saveEdit() { var area = document.getElementsByTagName('TEXTAREA')[0]; var y = document.createElement('P'); var z = area.parentNode; y.innerHTML = area.value; z.insertBefore(y,area); z.removeChild(area); z.removeChild(document.getElementsByTagName('button')[0]); editing = false; } document.onclick = catchIt; This code is a quick edit and I want to add a PHP script that will UPDATE my database base on the changes on the text.

    Read the article

  • CSS breaks in Explorer (insert humor here)

    - by Jordan
    This Wordpress site works fine in Firefox and Safari. However viewing in Explorer 7 (don't care about 6) breaks the header/navigation area. Weirdly enough, refreshing the page fixes the alignment issue, but then hides the header. http://anothersideof.me Any suggestions would be greatly appreciated.

    Read the article

  • PHP - Find parent key of array

    - by Jordan Rynard
    I'm trying to find a way to return the value of an array's parent key. For example, from the array below I'd like to find out the parent's key where $array['id'] == "0002". The parent key is obvious because it's defined here (it would be 'products'), but normally it'd be dynamic, hence the problem. The 'id' and value of 'id' is known though. [0] => Array ( [data] => [id] => 0000 [name] => Swirl [categories] => Array ( [0] => Array ( [id] => 0001 [name] => Whirl [products] => Array ( [0] => Array ( [id] => 0002 [filename] => 1.jpg ) [1] => Array ( [id] => 0003 [filename] => 2.jpg ) ) ) ) )

    Read the article

  • Automatically created NSManagedObject subclasses don't use ARC

    - by Jordan
    My project is ARC enabled (the build settings have Objective-C Reference Counting set to YES). There are no file exceptions to this, it is enabled project wide. (Latest stable version of Xcode). When I create an NSManagedObject subclass via File New for a Core Data entity, the generated header uses the following in its property declarations: @property (nonatomic, retain) But 'retain' is not ARC!! Is this a bug, or is there something I'm missing or not understanding? There are no build warnings - if this is a bug though, how can I remedy it?

    Read the article

  • Scrolling with CSS

    - by Jordan Trulen
    I have 4 tables that need to scroll, they are set up as follows: Table1(static) Table2(Horizontal Scrolling) Table3(Vertical Scrolling) Table4(Horizontal and Vertical Scrolling) Table1 Table2 Table3 Table4 The tricky part of this is that Table 3 and 4 need to keep in sync as this is a listing of data broken out into two tables. Table 2 and 4 are in the same situation. Any ideas? No Javascript please as we have a script that works, but it is far too slow to work. Thanks.

    Read the article

  • What file format contents starts with "URES"?

    - by Jordan
    I have a number of files that contain data in a format I am not familiar with. All of the data files begin with the same byte sequence, presumably a file header, and the sequence is "URES". I'm assuming that these files are some kind of resource file, perhaps a collection of data or other files all embedded into one file; that's just a guess however. Does anyone know what format this is/might be? If so, how would I interrogate the file? Are there applications that let me open these kind of files? Do you know of any libraries or APIs that I can use to gain programmatic access the data?

    Read the article

  • Looping music with intro in XNA using SoundEffect

    - by Jordan Roher
    I have two sound files: Sound A is an 18 second intro designed to be played once Sound B is a 1 minute looping track I'd like to play Sound A once, then once Sound A is done, immediately play Sound B and keep looping Sound B until I tell it to stop. This is supposed to be looping town music in an RPG. I've tried doing this in code using just SoundEffect, but there's a tiny yet noticeable gap between the end of Sound A and the beginning of Sound B. Even if I put monitoring code watching Sound A's SoundEffectInstance.State in the Update() function, I haven't been able to start Sound B exactly when Sound A finishes so that it's seamless. I'd prefer to use SoundEffect because I can load WMA files rather than being stuck with WAVs in XACT.

    Read the article

< Previous Page | 6 7 8 9 10 11 12 13 14 15 16  | Next Page >