Search Results

Search found 2762 results on 111 pages for 'michael turner'.

Page 69/111 | < Previous Page | 65 66 67 68 69 70 71 72 73 74 75 76  | Next Page >

  • Why my custom CStatic derived control does not receive WM_SIZE message?

    - by Michael P
    Hello everyone! I'm currently developing a custom control that derives from CStatic MFC class (Smart Device C++ project). I have created the control class using VC++ MFC class wizard, selecting CStatic class as its base class. I have used Class View to add OnSize event handler for my control class (I have selected WM_SIZE message from messages list), and new OnSize method has been created by Visual Studio along with ON_WM_SIZE() statement between BEGIN_MESSAGE_MAP(...) and END_MESSAGE_MAP(). The problem is that my control does not receive WM_SIZE thus OnSize method is never called - I used MoveWindow to change size of my control - its size changes as I have seen on dialog window but WM_SIZE message is never being sent. When I send WM_SIZE through SendMessage or PostMessage function - the control OnSize method is called normally. What do I wrong? I've read MSDN docs about CStatic control and there is no information that WM_SIZE message is never sent to a static control window. Sorry for my bad English.

    Read the article

  • How to preserve whitespace indentation of text enclosed in HTML <pre> tags excluding the current indentation level of the <pre> tag in the document?

    - by Michael Barton
    I'm trying to display my code on a website but I'm having problems preserving the whitespace indentation correctly. For instance given the following snippet: <html> <body> Here is my code: <pre> def some_funtion return 'Hello, World!' end </pre> <body> </html> This is displayed in the browser as: Here is my code: def some_funtion return 'Hello, World!' end When I would like it displayed as: Here is my code: def some_funtion return 'Hello, World!' end The difference is that that current indentation level of the HTML pre tag is being added to the indentation of the code. I'm using nanoc as a static website generator and I'm using google prettify to also add syntax highlighting. Can anyone offer any suggestions?

    Read the article

  • php preg_match pattern to extract a specific information, regex

    - by Michael
    I need to extract a specific Id from a html document but the problem is that the id must not "be used". Here is the html content http://pastebin.com/wF2dx8JZ As you may see there are different html blocks . Some of them contain the "Used" word so I need to extract only the first id which is not used. Basically I can write a simple pattern like : $pattern = "/javascript:tw(.*))/"; preg_match_all($pattern, $content, $matches); $id = $matches[1][0]; However in this case I'm also getting the "ids" which are used so I don't know how to exclude them from the equation . Any idea would be highly appreciated.

    Read the article

  • How can I create a MethodInfo from an Action delegate

    - by Michael Meadows
    I am trying to develop an NUnit addin that dynamically adds test methods to a suite from an object that contains a list of Action delegates. The problem is that NUnit appears to be leaning heavily on reflection to get the job done. Consequently, it looks like there's no simple way to add my Actions directly to the suite. I must, instead, add MethodInfo objects. This would normally work, but the Action delegates are anonymous, so I would have to build the types and methods to accomplish this. I need to find an easier way to do this, without resorting to using Emit. Does anyone know how to easily create MethodInfo instances from Action delegates?

    Read the article

  • Firefox extension dev: observing preferences, avoid multiple notifications

    - by Michael
    Let's say my Firefox extension has multiple preferences, but some of them are grouped, like check interval, fail retry interval, destination url. Those are used in just single function. When I subscribe to preference service and add observer, the observe callback will be called for each changed preference, so if by chance user changed all of the settings in group, then I will have to do the same routine for the same subsystem as many times as I have items in that preferences group. It's a great redundancy! What I want is observe to be called just once for group of preferences. Say extensions.myextension.interval1 extensions.myextension.site extensions.myextension.retry so if one or all of those preferences are changed, I receive only 1 notification about it. In other words, no matter how many preferences changed in branch, I want the observe callback to called once.

    Read the article

  • Best way to implement refusing a value change by the user in Swing?

    - by Michael Borgwardt
    I have a JCheckBox that should not be checked by the user when a certain other field is empty. So now I want to have an error popup and then reset the checkbox (I've considered disabling the checkbox, but the connection to the other field is non-obvious, and a tooltip text IMO not visible enough). What's the correct way to do that in Swing? Through a PropertyVetoException? Where do I throw it and where do I catch it? My first (probably ugly) idea would be to add a ChangeListener that itself shows the popup and resets the value.

    Read the article

  • What's a clean way to break up a DataTable into chunks of a fixed size with Linq?

    - by Michael Haren
    Update: Here's a similar question Suppose I have a DataTable with a few thousand DataRows in it. I'd like to break up the table into chunks of smaller rows for processing. I thought C#3's improved ability to work with data might help. This is the skeleton I have so far: DataTable Table = GetTonsOfData(); // Chunks should be any IEnumerable<Chunk> type var Chunks = ChunkifyTableIntoSmallerChunksSomehow; // ** help here! ** foreach(var Chunk in Chunks) { // Chunk should be any IEnumerable<DataRow> type ProcessChunk(Chunk); } Any suggestions on what should replace ChunkifyTableIntoSmallerChunksSomehow? I'm really interested in how someone would do this with access C#3 tools. If attempting to apply these tools is inappropriate, please explain! Update 3 (revised chunking as I really want tables, not ienumerables; going with an extension method--thanks Jacob): Final implementation: Extension method to handle the chunking: public static class HarenExtensions { public static IEnumerable<DataTable> Chunkify(this DataTable table, int chunkSize) { for (int i = 0; i < table.Rows.Count; i += chunkSize) { DataTable Chunk = table.Clone(); foreach (DataRow Row in table.Select().Skip(i).Take(chunkSize)) { Chunk.ImportRow(Row); } yield return Chunk; } } } Example consumer of that extension method, with sample output from an ad hoc test: class Program { static void Main(string[] args) { DataTable Table = GetTonsOfData(); foreach (DataTable Chunk in Table.Chunkify(100)) { Console.WriteLine("{0} - {1}", Chunk.Rows[0][0], Chunk.Rows[Chunk.Rows.Count - 1][0]); } Console.ReadLine(); } static DataTable GetTonsOfData() { DataTable Table = new DataTable(); Table.Columns.Add(new DataColumn()); for (int i = 0; i < 1000; i++) { DataRow Row = Table.NewRow(); Row[0] = i; Table.Rows.Add(Row); } return Table; } }

    Read the article

  • JBoss Clustered Service that sends emails from txt file

    - by michael lucas
    I need a little push in the right direction. Here's my problem: I have to create an ultra-reliable service that sends email messages to clients whose addresses are stored in txt file on FTP server. Single txt file may contain unlimited number of entries. Most often the file contains about 300,000 entries. Service exposes interface with just two simple methods: TaskHandle sendEmails(String ftpFilePath); ProcessStatus checkProcessStatus(TaskHandle taskHandle); Method sendEmails() returns TaskHandle by which we can ask for ProcessStatus. For such a service to be reliable clustering is necessary. Processing single txt file might take a long time. Restarting one node in a cluster should have no impact on sending emails. We use JBoss AS 4.2.0 which comes with a nice HASingletonController that ensure one instance of service is running at given time. But once a fail-over happens, the second service should continue work from where the first one stopped. How can I share state between nodes in a cluster in such a way that leaves no possibility of sending some emails twice?

    Read the article

  • What is your favorite convention for organizing a ASP.NET project?

    - by Michael Rosario
    Hello world. My team is starting a brand new ASP.NET solution which will probably become large. Inspired by ASP.NET MVC, we currently express all data access objects in a model project. We, however, do not have good conventions for organizing ASP.NET ascx's and aspx's. We have already reviewed DotNetNuke and want to avoid the complexity of driving the whole application through a single default.aspx . What is the best way to organize a non-MVC ASP.NET solution? Your tips, links, and advice are greatly appreciated!

    Read the article

  • declarative authorization and has_and_belongs_to_many

    - by Michael Balsiger
    Hi, I have a little problem with declarative-authorization. I have a User and Role Model with a has_and_belongs_to_many association. I've created a Role named :moderator in my authorization_rules.rb Is it possible that a User with the Role Moderator only gets the Users that have the Moderator Role assigned to it?? -- User.with_permissions_to(:index) I thought it would be possible like that: role :moderator do has_permission_on :users, :to => :index do if_attribute :roles => contains { ????? } end end I also created a named_scope in my User Model because I thought it would help... class User has_and_belongs_to_many :roles named_scope :by_role, lambda { |role| { :include => :roles, :conditions => {"roles.name" => role} } } end Does anyone knows if it's possible to do this with declarative_authorization? Thanks for your help!

    Read the article

  • Add blank cell at end of UITable

    - by Michael
    I'm trying to add an additional cell for custom content as the last cell in a tableView, without altering the dictionary that creates the other content of the table. I think the place to add it is in cellForRowAtIndexPath rather than adding one to the numberOfRowsInSection, which just crashes if I do. I get a cellCount from the dictionary that creates the data for the table, then in cellForRowAtIndexPath, I have: if (indexPath.row == cellCount) { ... stuff goes here return cell; } of course, this never gets called. If I do if (indexPath.row == cellCount -1) it overwrites the last cell with content. I can get this to work if I add a blank entry into the xml from which I am populating the dictionary, but that's ugly. Example code would be neat!

    Read the article

  • Javascript : assign variable in if condition statement, good practice or not?

    - by Michael Mao
    Hi all: I moved one years ago from classic OO languages such like Java to Javascript. The following code is definitely not recommended (or even not correct) in Java: if(dayNumber = getClickedDayNumber(dayInfo)) { alert("day number found"); } function getClickedDayNumber(dayInfo) { dayNumber = dayInfo.indexOf("fc-day"); if(dayNumber != -1) //substring found { //normally any calendar month consists of "40" days, so this will definitely pick up its day number. return parseInt(dayInfo.substring(dayNumber+6, dayNumber+8)); } else return false; } Basically I just found out that I can assign a variable to a value in an if condition statement, and immediately check the assigned value as if it is boolean. For a safer bet, I usually separate that into two lines of code, assign first then check the variable, but now that I found this, I am just wondering whether is it good practice or not in the eyes of experienced javascript developers? Many thanks in advance.

    Read the article

  • Is there a way to use the OSX cocoa NSApplication method activateIgnoringOtherApps: to activate an a

    - by Michael Minerva
    This may be a dumb question but it seems like activateIgnoringOtherApps: may be the only way to activate an app using Cocoa. I have a java app that loads up a Cocoa app and I want the Cocoa app to be activated when this happens. The problem is I do not want to have to launch an intermediate app (some sort of controller) and use this app to activateIgnoringOtherApps: my other Cocoa app. Is there some way to use activateIgnoringOtherApps: to force my Cocoa app to become active?

    Read the article

  • How can I dynamically clear all controls in a user control?

    - by Michael
    Is it possible to dynamically (and generically) clear the state of all of a user control's child controls? (e.g., all of its TextBoxes, DropDrownLists, RadioButtons, DataGrids, Repeaters, etc -- basically anything that has ViewState) I'm trying to avoid doing something like this: foreach (Control c in myUserControl.Controls) { if (c is TextBox) { TextBox tb = (TextBox)c; tb.Text = ""; } else if (c is DropDownList) { DropDownList ddl = (DropDownList)c; ddl.SelectedIndex = -1; } else if (c is DataGrid) { DataGrid dg = (DataGrid)c; dg.Controls.Clear(); } // etc. } I'm looking for something like this: foreach (Control c in myUserControl.Controls) c.Clear(); ...but obviously that doesn't exist. Is there any easy way to accomplish this dynamically/generically?

    Read the article

  • Can Visual Studio 2010 Test .net 3.5 SP1 Projects?

    - by Michael Stum
    I have some projects in a solution that are running on .net 3.5 SP1 (and can never ever be updated to 4.0 as they are SharePoint projects). When I try to create a new Visual C# Test Project in VS2010 Premium, I have to choose .net 4.0 which is apparently intended. Now I don't care about what my Unit Test project is (don't have to care about VS2008 users), but I do care if I can safely test 3.5 Projects in it due to the different CLRs and slight C# language differences?

    Read the article

  • Puzzled with nib files...

    - by Michael
    I know nib files are serialized objects and they have owner, outlets to make connections. Using XCode Navigation window template I created application, which in its order created 2 nib files - MainWindow and SecondView. I can't understand how MainWindow is referring to SecondView, there is no connection between those two as far as I can see. SecondView's owner is UIViewController and in MainWindow there is a navigation tab which is also UIViewController. But how they are connected in IB I can't understand... Also I don't understand who is instanciating MainWindow's owner object and where that object is being kept, where is the variable which is UIApplication myApp = [[UIApplication alloc] init]. If I create 10 nib files with UIViewController owner, who will trigger their deserialization? If some class is nib file's owner, what is the essential responsibilities of that class? Is it deserializing nib file into memory? Sorry for unorganized questions, I've been reading numerous articles and docs about nib files, but it is still confusing.

    Read the article

  • Yes, another thread question...

    - by Michael
    I can't understand why I am loosing control of my GUI even though I am implementing a thread to play a .wav file. Can someone pin point what is incorrect? #!/usr/bin/env python import wx, pyaudio, wave, easygui, thread, time, os, sys, traceback, threading import wx.lib.delayedresult as inbg isPaused = False isStopped = False class Frame(wx.Frame): def __init__(self): print 'Frame' wx.Frame.__init__(self, parent=None, id=-1, title="Jasmine", size=(720, 300)) #initialize panel panel = wx.Panel(self, -1) #initialize grid bag sizer = wx.GridBagSizer(hgap=20, vgap=20) #initialize buttons exitButton = wx.Button(panel, wx.ID_ANY, "Exit") pauseButton = wx.Button(panel, wx.ID_ANY, 'Pause') prevButton = wx.Button(panel, wx.ID_ANY, 'Prev') nextButton = wx.Button(panel, wx.ID_ANY, 'Next') stopButton = wx.Button(panel, wx.ID_ANY, 'Stop') #add widgets to sizer sizer.Add(pauseButton, pos=(1,10)) sizer.Add(prevButton, pos=(1,11)) sizer.Add(nextButton, pos=(1,12)) sizer.Add(stopButton, pos=(1,13)) sizer.Add(exitButton, pos=(5,13)) #initialize song time gauge #timeGauge = wx.Gauge(panel, 20) #sizer.Add(timeGauge, pos=(3,10), span=(0, 0)) #initialize menuFile widget menuFile = wx.Menu() menuFile.Append(0, "L&oad") menuFile.Append(1, "E&xit") menuBar = wx.MenuBar() menuBar.Append(menuFile, "&File") menuAbout = wx.Menu() menuAbout.Append(2, "A&bout...") menuAbout.AppendSeparator() menuBar.Append(menuAbout, "Help") self.SetMenuBar(menuBar) self.CreateStatusBar() self.SetStatusText("Welcome to Jasime!") #place sizer on panel panel.SetSizer(sizer) #initialize icon self.cd_image = wx.Image('cd_icon.png', wx.BITMAP_TYPE_PNG) self.temp = self.cd_image.ConvertToBitmap() self.size = self.temp.GetWidth(), self.temp.GetHeight() wx.StaticBitmap(parent=panel, bitmap=self.temp) #set binding self.Bind(wx.EVT_BUTTON, self.OnQuit, id=exitButton.GetId()) self.Bind(wx.EVT_BUTTON, self.pause, id=pauseButton.GetId()) self.Bind(wx.EVT_BUTTON, self.stop, id=stopButton.GetId()) self.Bind(wx.EVT_MENU, self.loadFile, id=0) self.Bind(wx.EVT_MENU, self.OnQuit, id=1) self.Bind(wx.EVT_MENU, self.OnAbout, id=2) #Load file usiing FileDialog, and create a thread for user control while running the file def loadFile(self, event): foo = wx.FileDialog(self, message="Open a .wav file...", defaultDir=os.getcwd(), defaultFile="", style=wx.FD_MULTIPLE) foo.ShowModal() self.queue = foo.GetPaths() self.threadID = 1 while len(self.queue) != 0: self.song = myThread(self.threadID, self.queue[0]) self.song.start() while self.song.isAlive(): time.sleep(2) self.queue.pop(0) self.threadID += 1 def OnQuit(self, event): self.Close() def OnAbout(self, event): wx.MessageBox("This is a great cup of tea.", "About Jasmine", wx.OK | wx.ICON_INFORMATION, self) def pause(self, event): global isPaused isPaused = not isPaused def stop(self, event): global isStopped isStopped = not isStopped class myThread (threading.Thread): def __init__(self, threadID, wf): self.threadID = threadID self.wf = wf threading.Thread.__init__(self) def run(self): global isPaused global isStopped self.waveFile = wave.open(self.wf, 'rb') #initialize stream self.p = pyaudio.PyAudio() self.stream = self.p.open(format = self.p.get_format_from_width(self.waveFile.getsampwidth()), channels = self.waveFile.getnchannels(), rate = self.waveFile.getframerate(), output = True) self.data = self.waveFile.readframes(1024) isPaused = False isStopped = False #main play loop, with pause event checking while self.data != '': # while isPaused != True: # if isStopped == False: self.stream.write(self.data) self.data = self.waveFile.readframes(1024) # elif isStopped == True: # self.stream.close() # self.p.terminate() self.stream.close() self.p.terminate() class App(wx.App): def OnInit(self): self.frame = Frame() self.frame.Show() self.SetTopWindow(self.frame) return True def main(): app = App() app.MainLoop() if __name__=='__main__': main()

    Read the article

  • Easy way to add multiple existing .csproj to a Visual Studio Solution?

    - by Michael J Swart
    I've checked out a branch of C# code from source control. It contains maybe 50 projects in various folders. There's no existing .sln file to be found. I intended to create a blank solution to add existing solutions. The UI only lets me do this one project at a time. Is there something I'm missing? I'd like to specify a list of *.csproj files and somehow come up with a .sln file that contains all the projects.

    Read the article

  • How to scale an Image in ImageView to keep the aspect ratio

    - by michael
    Hi, In android, I defined an ImageView's layoutWidth to be 'fill_parent' (which takes up the full width of the phone). My question is if the Image i put to ImageView is bigger than the layoutWidth, android will scale it, right? But what about the height? when android scale it, will it keeps the aspect ratio? What I find out is, there is some 'white space' at the top/bottom of the ImageView when android scales an image which is bigger than the ImageView. Is that true? If yes, how can I eliminate that white spaces? Thank you.

    Read the article

  • Question about WeakHashMap

    - by michael
    Hi, In the Javadoc of "http://java.sun.com/j2se/1.4.2/docs/api/java/util/WeakHashMap.html", it said "Each key object in a WeakHashMap is stored indirectly as the referent of a weak reference. Therefore a key will automatically be removed only after the weak references to it, both inside and outside of the map, have been cleared by the garbage collector." And then Note that a value object may refer indirectly to its key via the WeakHashMap itself; that is, a value object may strongly refer to some other key object whose associated value object, in turn, strongly refers to the key of the first value object. But should not both Key and Value should be used weak reference in WeakHashMap? i.e. if there is low on memory, GC will free the memory held by the value object (since the value object most likely take up more memory than key object in most cases)? And if GC free the Value object, the Key Object can be free as well? Basically, I am looking for a HashMap which will reduce memory usage when there is low memory (GC collects the value and key objects if necessary). Is it possible in Java? Thank you.

    Read the article

  • Private Java class properties mysteriously reset between method calls....

    - by Michael Jones
    I have a very odd problem. A class property is mysteriously reset between method calls. The following code is executed so the constructor is called, then the parseConfiguration method is called. Finally, processData is called. The parseConfiguration method sets the "recursive" property to "true". However, as soon as it enters "processData", "recursive" becomes "false". This problem isn't isolated to a single class -- I have several examples of this in my code. How can this possibly be happening? I've tried initialising properties when they're declared outside any methods, I've tried initialising them in constructors... nothing works. The only complication I can think of here is that this class is invoked by an object that runs in a thread -- but here is one instance per thread, so surely no chance that threads are interfering. I've tried setting both methods to "synchronized", but this still happens. Please help! /** * This class or its superclasses are NOT threaded and don't extend Thread */ public class DirectoryAcquirer extends Manipulator { /** * @var Whether to recursively scan directories */ private boolean recursive = false; /** * Constructor */ public DirectoryAcquirer() { } /** * Constructor that initialises the configuration * * @param config * @throws InvalidConfigurationException */ public DirectoryAcquirer(HierarchicalConfiguration config) throws InvalidConfigurationException { super(config); } @Override protected void parseConfiguration() throws InvalidConfigurationException { // set whether to recurse into directories or not if (this.config.containsKey("recursive")) { // this.recursive gets set to "true" here this.recursive = this.config.getBoolean("recursive"); } } @Override public EntityCollection processData(EntityCollection data) { // here this.recursive is "false" this.logger.debug("processData: Entered method"); } }

    Read the article

< Previous Page | 65 66 67 68 69 70 71 72 73 74 75 76  | Next Page >