Search Results

Search found 135 results on 6 pages for 'joao ramos'.

Page 3/6 | < Previous Page | 1 2 3 4 5 6  | Next Page >

  • Extended FindWindow

    - by João Angelo
    The Win32 API provides the FindWindow function that supports finding top-level windows by their class name and/or title. However, the title search does not work if you are trying to match partial text at the middle or the end of the full window title. You can however implement support for these extended search features by using another set of Win32 API like EnumWindows and GetWindowText. A possible implementation follows: using System; using System.Collections.Generic; using System.Linq; using System.Runtime.InteropServices; using System.Text; public class WindowInfo { private IntPtr handle; private string className; internal WindowInfo(IntPtr handle, string title) { if (handle == IntPtr.Zero) throw new ArgumentException("Invalid handle.", "handle"); this.Handle = handle; this.Title = title ?? string.Empty; } public string Title { get; private set; } public string ClassName { get { if (className == null) { className = GetWindowClassNameByHandle(this.Handle); } return className; } } public IntPtr Handle { get { if (!NativeMethods.IsWindow(this.handle)) throw new InvalidOperationException("The handle is no longer valid."); return this.handle; } private set { this.handle = value; } } public static WindowInfo[] EnumerateWindows() { var windows = new List<WindowInfo>(); NativeMethods.EnumWindowsProcessor processor = (hwnd, lParam) => { windows.Add(new WindowInfo(hwnd, GetWindowTextByHandle(hwnd))); return true; }; bool succeeded = NativeMethods.EnumWindows(processor, IntPtr.Zero); if (!succeeded) return new WindowInfo[] { }; return windows.ToArray(); } public static WindowInfo FindWindow(Predicate<WindowInfo> predicate) { WindowInfo target = null; NativeMethods.EnumWindowsProcessor processor = (hwnd, lParam) => { var current = new WindowInfo(hwnd, GetWindowTextByHandle(hwnd)); if (predicate(current)) { target = current; return false; } return true; }; NativeMethods.EnumWindows(processor, IntPtr.Zero); return target; } private static string GetWindowTextByHandle(IntPtr handle) { if (handle == IntPtr.Zero) throw new ArgumentException("Invalid handle.", "handle"); int length = NativeMethods.GetWindowTextLength(handle); if (length == 0) return string.Empty; var buffer = new StringBuilder(length + 1); NativeMethods.GetWindowText(handle, buffer, buffer.Capacity); return buffer.ToString(); } private static string GetWindowClassNameByHandle(IntPtr handle) { if (handle == IntPtr.Zero) throw new ArgumentException("Invalid handle.", "handle"); const int WindowClassNameMaxLength = 256; var buffer = new StringBuilder(WindowClassNameMaxLength); NativeMethods.GetClassName(handle, buffer, buffer.Capacity); return buffer.ToString(); } } internal class NativeMethods { public delegate bool EnumWindowsProcessor(IntPtr hwnd, IntPtr lParam); [DllImport("user32.dll")] [return: MarshalAs(UnmanagedType.Bool)] public static extern bool EnumWindows( EnumWindowsProcessor lpEnumFunc, IntPtr lParam); [DllImport("user32.dll", SetLastError = true, CharSet = CharSet.Auto)] public static extern int GetWindowText( IntPtr hWnd, StringBuilder lpString, int nMaxCount); [DllImport("user32.dll", SetLastError = true, CharSet = CharSet.Auto)] public static extern int GetWindowTextLength(IntPtr hWnd); [DllImport("user32.dll", SetLastError = true, CharSet = CharSet.Auto)] public static extern int GetClassName( IntPtr hWnd, StringBuilder lpClassName, int nMaxCount); [DllImport("user32.dll")] [return: MarshalAs(UnmanagedType.Bool)] public static extern bool IsWindow(IntPtr hWnd); } The access to the windows handle is preceded by a sanity check to assert if it’s still valid, but if you are dealing with windows out of your control then the window can be destroyed right after the check so it’s not guaranteed that you’ll get a valid handle. Finally, to wrap this up a usage, example: static void Main(string[] args) { var w = WindowInfo.FindWindow(wi => wi.Title.Contains("Test.docx")); if (w != null) { Console.Write(w.Title); } }

    Read the article

  • Jump-start Your Mind

    - by João Angelo
    I haven’t written in a while mostly because I’ve spent my time reading what others wrote and today I’m writing purely motivated by what I just finished reading. Mindfire: Big Ideas for Curious Mind by Scott Berkun was such a pleasure to read and ended up igniting parts of my mind which I have to admit were becoming a bit numb that I felt the urge to take some time to first say thank you to the author and then recommend it to all your curious minds out there. Now, go read it… it’s time well spent.

    Read the article

  • How to boot from a debootstrap based install?

    - by João Pinto
    I would like to boot a testing Ubuntu release from a directory (which contains a debootstrap based install). As far as I understand I just need someway to tell the boot process (initrd scripts?) that it should chroot() into the specified dir immediately after mounting the root partition, and then resume the regular upstart/init start. Could someone provide some instructions on how to achieve this?

    Read the article

  • What's the major outage you've been part of?

    - by Marco Ramos
    Outages are some of the things we try to avoid but they're inevitable: they happen (very rarely, we hope) and we have to know how to deal with them (and learn from them). So, what's the major outage you've been part of? How did you and your team deal with it? What have you learned for the future? Please share your thoughts :)

    Read the article

  • Ubuntu 12.10 "fakeRAID" RAID0 installation

    - by João André
    I have 2 80 Gb HDD's with a RAID 0 motherboard configuration (Intel Z77, fakeRAID) with a 100 Gb partition running Windows 7 and a 60 Gb partition where I would like to install Ubuntu 12.10. However, even though the installer seems to correctly detect the RAID 0 array, GRUB2 is not installed and the computer boots into Windows normally. The same thing does not happen when installing Fedora 17. The installer (Anaconda) also detects the disk array, but GRUB2 installation is successful. What exactly are the differences between Ubiquity and Anaconda? And is there a way to correctly install GRUB2 in a fakeRAID system, since there are no alternative Ubuntu CDs?

    Read the article

  • Collection RemoveAll Extension Method

    - by João Angelo
    I had previously posted a RemoveAll extension method for the Dictionary<K,V> class, now it’s time to have one for the Collection<T> class. The signature is the same as in the corresponding method already available in List<T> and the implementation relies on the RemoveAt method to perform the actual removal of each element. Finally, here’s the code: public static class CollectionExtensions { /// <summary> /// Removes from the target collection all elements that match the specified predicate. /// </summary> /// <typeparam name="T">The type of elements in the target collection.</typeparam> /// <param name="collection">The target collection.</param> /// <param name="match">The predicate used to match elements.</param> /// <exception cref="ArgumentNullException"> /// The target collection is a null reference. /// <br />-or-<br /> /// The match predicate is a null reference. /// </exception> /// <returns>Returns the number of elements removed.</returns> public static int RemoveAll<T>(this Collection<T> collection, Predicate<T> match) { if (collection == null) throw new ArgumentNullException("collection"); if (match == null) throw new ArgumentNullException("match"); int count = 0; for (int i = collection.Count - 1; i >= 0; i--) { if (match(collection[i])) { collection.RemoveAt(i); count++; } } return count; } }

    Read the article

  • 302 Redirect causes garbage at end of Wordpress link in Facebook

    - by Joao
    When I try to link my Wordpress blog to Facebook, the url doesn't resolve properly. There's garbage appended at the end and Facebook is not able to retrieve information from the site. Happens in every page, post or main entry. Here's what happens: http://clarissarezende.com.br/ shows up in Facebook as http://clarissarezende.com.br/UPLcS/ (when copy/paste the link) and no information about the site shows up in FB. I'm using Wordpress 3.3.1 with ProPhoto 4. Recently I moved the DNS entry on my ISP. The blog is hosted at clarissarezende.com.br/public_html/blog2 and before the DNS would point to public_html and then I changed it to public_html/blog2. Note that I did not move any Wordpress files. Made the (I think) necessary changes all over Facebook, but still no dice... Any ideas on what can be happening?

    Read the article

  • Inside BackgroundWorker

    - by João Angelo
    The BackgroundWorker is a reusable component that can be used in different contexts, but sometimes with unexpected results. If you are like me, you have mostly used background workers while doing Windows Forms development due to the flexibility they offer for running a background task. They support cancellation and give events that signal progress updates and task completion. When used in Windows Forms, these events (ProgressChanged and RunWorkerCompleted) get executed back on the UI thread where you can freely access your form controls. However, the logic of the progress changed and worker completed events being invoked in the thread that started the background worker is not something you get directly from the BackgroundWorker, but instead from the fact that you are running in the context of Windows Forms. Take the following example that illustrates the use of a worker in three different scenarios: – Console Application or Windows Service; – Windows Forms; – WPF. using System; using System.ComponentModel; using System.Threading; using System.Windows.Forms; using System.Windows.Threading; class Program { static AutoResetEvent Synch = new AutoResetEvent(false); static void Main() { var bw1 = new BackgroundWorker(); var bw2 = new BackgroundWorker(); var bw3 = new BackgroundWorker(); Console.WriteLine("DEFAULT"); var unspecializedThread = new Thread(() => { OutputCaller(1); SynchronizationContext.SetSynchronizationContext( new SynchronizationContext()); bw1.DoWork += (sender, e) => OutputWork(1); bw1.RunWorkerCompleted += (sender, e) => OutputCompleted(1); // Uses default SynchronizationContext bw1.RunWorkerAsync(); }); unspecializedThread.IsBackground = true; unspecializedThread.Start(); Synch.WaitOne(); Console.WriteLine(); Console.WriteLine("WINDOWS FORMS"); var windowsFormsThread = new Thread(() => { OutputCaller(2); SynchronizationContext.SetSynchronizationContext( new WindowsFormsSynchronizationContext()); bw2.DoWork += (sender, e) => OutputWork(2); bw2.RunWorkerCompleted += (sender, e) => OutputCompleted(2); // Uses WindowsFormsSynchronizationContext bw2.RunWorkerAsync(); Application.Run(); }); windowsFormsThread.IsBackground = true; windowsFormsThread.SetApartmentState(ApartmentState.STA); windowsFormsThread.Start(); Synch.WaitOne(); Console.WriteLine(); Console.WriteLine("WPF"); var wpfThread = new Thread(() => { OutputCaller(3); SynchronizationContext.SetSynchronizationContext( new DispatcherSynchronizationContext()); bw3.DoWork += (sender, e) => OutputWork(3); bw3.RunWorkerCompleted += (sender, e) => OutputCompleted(3); // Uses DispatcherSynchronizationContext bw3.RunWorkerAsync(); Dispatcher.Run(); }); wpfThread.IsBackground = true; wpfThread.SetApartmentState(ApartmentState.STA); wpfThread.Start(); Synch.WaitOne(); } static void OutputCaller(int workerId) { Console.WriteLine( "bw{0}.{1} | Thread: {2} | IsThreadPool: {3}", workerId, "RunWorkerAsync".PadRight(18), Thread.CurrentThread.ManagedThreadId, Thread.CurrentThread.IsThreadPoolThread); } static void OutputWork(int workerId) { Console.WriteLine( "bw{0}.{1} | Thread: {2} | IsThreadPool: {3}", workerId, "DoWork".PadRight(18), Thread.CurrentThread.ManagedThreadId, Thread.CurrentThread.IsThreadPoolThread); } static void OutputCompleted(int workerId) { Console.WriteLine( "bw{0}.{1} | Thread: {2} | IsThreadPool: {3}", workerId, "RunWorkerCompleted".PadRight(18), Thread.CurrentThread.ManagedThreadId, Thread.CurrentThread.IsThreadPoolThread); Synch.Set(); } } Output: //DEFAULT //bw1.RunWorkerAsync | Thread: 3 | IsThreadPool: False //bw1.DoWork | Thread: 4 | IsThreadPool: True //bw1.RunWorkerCompleted | Thread: 5 | IsThreadPool: True //WINDOWS FORMS //bw2.RunWorkerAsync | Thread: 6 | IsThreadPool: False //bw2.DoWork | Thread: 5 | IsThreadPool: True //bw2.RunWorkerCompleted | Thread: 6 | IsThreadPool: False //WPF //bw3.RunWorkerAsync | Thread: 7 | IsThreadPool: False //bw3.DoWork | Thread: 5 | IsThreadPool: True //bw3.RunWorkerCompleted | Thread: 7 | IsThreadPool: False As you can see the output between the first and remaining scenarios is somewhat different. While in Windows Forms and WPF the worker completed event runs on the thread that called RunWorkerAsync, in the first scenario the same event runs on any thread available in the thread pool. Another scenario where you can get the first behavior, even when on Windows Forms or WPF, is if you chain the creation of background workers, that is, you create a second worker in the DoWork event handler of an already running worker. Since the DoWork executes in a thread from the pool the second worker will use the default synchronization context and the completed event will not run in the UI thread.

    Read the article

  • Play audio in javascript with a good performance

    - by João
    I'm developing a browser game where the player can shoot. Everytime he shoots it play a sound. Currently i'm using this code to play sounds in JavaScript: var audio = document.createElement("audio"); audio.src = "my_sound.mp3"; audio.play(); I'm worried about performance here. Will 10 simultaneous sounds impact my game performance too much? Will all audio objects stay in memory even after they are played?

    Read the article

  • How can I enable auto-switching HDMI sound on Ubuntu 12.04?

    - by João Ciocca
    I've just installed Ubuntu 12.04 on my Lenovo G550 notebook and decided to test the main thing I use it for, on Windows: watching movies and series on my living room TV. Plugged in the HDMI cable, screen auto-configured nicely - awesome. But the sound is coming through my notebook's speakers, instead of my TV. Searched for almost an hour on Google, found a couple of things - nothing that helped, though. Here are two links that made me sad: Another question on AskUbuntu "a better sounding world" post about HDMI On 2, David says that autoswitching was disabled... so how can I enable it?

    Read the article

  • Assessing Relative Maintainability

    - by João Bragança
    We (a contractor, actually) are implementing an off the shelf system to replace a legacy homegrown system for the core domain of the company (designing widgets). Unfortunately both systems will have to run concurrently for some time, as the product just isn't ready yet. Also, the decision was made to only migrate some of the widgets from the legacy system, based on date of last sale activity. Later on a new requirement came down: certain people in the company, most of them outside of the widget development context, want to search all widgets. The search results screen has 3 pieces of data: a GUID, a human readable id that is searchable, and a brief description (may need to be searchable in the future). In the widget details, there will be multiple screens. These screens align very well along SOA / bounded context lines - a screen for marketing data, a screen for sales history, etc. UML ahead! I am probably using the wrong kind of arrows here so please forgive me. The current solution - which is not in production yet - is something like the following: Both systems will be queried and the controller will merge the results. The new system has its own proprietary query language (we've alleviated this a bit with a LINQ provider). It also puts a lot of data on the wire. 15 search results typically run about 60k of unintelligible SOAP-wrapped xml. So I would prefer to avoid querying this system directly. These two systems publish events to help us integrate with other systems, mainly an ERP system. One of these events contains all the data necessary for the search screen. I proposed the following alternative: However I am being told that 'adding another database' will create more maintenance down the road. However, I believe this to be false, as I had to add a relatively simple feature that took several hours longer than anticipated because of this merging code. I want to get a feel for which system is more maintainable in the long run. I personally have not had the burden of maintaining any large system. I want something more than my gut. Specifically I'd like to know if having more, specialized physical databases is more or less maintainable than having less larger physical databases.

    Read the article

  • Is there an official Ubuntu free technical support team?

    - by João Pinto
    I have found that there is an "Ubuntu Support Team" at https://launchpad.net/~ubuntu-helpteam but I am not sure it's official or active. Please note that I am not referring to bug fixing support, I am referring to the broader OS support, with people available to engage users needing support with a problem and drive it to a proper resolution. Is there an official team for this purpose with a clear scope and activity plan ?

    Read the article

  • Detecting Installed .NET Framework Versions

    - by João Angelo
    A new year is upon us and it’s also time for me to end my blogging vacations and get back to the blogosphere. However, let’s start simple… and short. More specifically with a quick way to detect the installed .NET Framework versions on a machine. You just need to fire up Internet Explorer, write the following in the address bar and press enter: javascript:alert(navigator.userAgent) If for any reason you need to copy/paste the resulting information then use the next command instead: javascript:document.write(navigator.userAgent)

    Read the article

  • WoW runs faster on GNOME Shell compared to Unity

    - by João Vinholi
    I have been trying to run WoW on Ubuntu 12.04. When I run it on unity, the frame rate is very low and it is impossible to play. Although, when I launch it on gnome shell, for some reason, the frame rate gets very high and the playing experience is very comfortable. The problem is that I prefer running Unity instead of gnome shell, but I like to play WoW too. Is there a way to run WoW on Unity, with no lag?

    Read the article

  • Wow is very faster on GNOME Shell comparing to unity

    - by João Vinholi
    I have been trying to run WoW on ubuntu 12.04. When I run it on unity, the frame rate is very low and it is impossible to play. Although, when I launch it on gnome shell, for some reason, the frame rate gets very high and the playing experience is very comfortable. The problem is that I prefer running unity instead of gnome shell, but I like to play WoW too. Is there a way to run WoW on unity, with no lag?

    Read the article

  • Can't install NetBeans

    - by João Vinholi
    I had never had problems with netbeans installation, but now I am. I have downloaded JDK and JRE properly as I always do and I have started the installation using the terminal as well. When the screen for JDK directory selection comes, I select the JDK folder that I have downloaded, but for some reason the following warning is shown: "An error occurred while validating the path." Do you know what could be?

    Read the article

  • arrays format (Javascript)

    - by João Melo
    i have a list of users, with minions, something like this: User52: minion10 minion12 User32: minion13 minion11 i've been keeping in an array where the "location" is the id, like this: Users: [52]User minions: [10]minion [12]minion [32]User minions: [13]minion [11]minion so i can access them easily like this: user[UserID].minions[MinionID] (ex: user[32].minions[11]) but when i print it or send it by json i get something like this: {,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,minion,,,,,,,,,,,,,,minion} but should i keep using like this or should i change to something like this: User = function(){ this.minions = ...; this.getMinion = function(value){ for(var m in this.minions){ if(this.minions[m].id == value){ return this.minions[m]; break; } } } } and get it like this: user.getMinion(MinionID); Question: i get better performance using a "short" array but using loops every time i need a minion, or using "long" arrays, but no need for loop and getting values directly from the id "name"?

    Read the article

  • More info: a "stand-alone" installer for Management Studio Express 2008

    - by AaronBertrand
    Last February, I blogged about something I was initially very happy about: a stand-alone installer for Management Studio Express (SSMSE) 2008 . Now users could allegedly download a much smaller installer, and only install the client tools without having to install an instance of SQL Server Express. While the latter is true, the former remains a pipe dream. Bill Ramos stated in his 2009-02-20 announcement : "We teased out the Tools portion of SQL Server 2008 Express with Tools into it’s own download."...(read more)

    Read the article

  • More info: a "stand-alone" installer for Management Studio Express 2008

    - by AaronBertrand
    Last February, I blogged about something I was initially very happy about: a stand-alone installer for Management Studio Express (SSMSE) 2008 . Now users could allegedly download a much smaller installer, and only install the client tools without having to install an instance of SQL Server Express. While the latter is true, the former remains a pipe dream. Bill Ramos stated in his 2009-02-20 announcement : "We teased out the Tools portion of SQL Server 2008 Express with Tools into it’s own download."...(read more)

    Read the article

  • Utilizing Java API from a Cobol program

    - by Hector Ramos
    We have some COBOL programs running on our mainframe and we need one of those to communicate with our back end vault through a Java API. Is there any way a Cobol program can invoke the Java program? Would it be possible to use a Web Service from Cobol? How would I integrate a Cobol program with anything else?

    Read the article

  • Getting past dates in HP-UX with ksh

    - by Alejandro Atienza Ramos
    Ok, so I need to translate a script from a nice linux & bash configuration to ksh in hp-ux. Each and every command expects a different syntax and i want to kill myself. But let's skip the rant. This is part of my script anterior=`date +"%Y%0m" -d '1 month ago'` I basically need to get a past date in format 201002. Never mind the thing that, in the new environment, %0m means "no zeroes", while actually in the other one it means "yes, please put that zero on my string". It doesn't even accept the "1 month ago". I've read the man date for HP-UX and it seems you just can't do date arithmetic with it. I've been looking around for a while but all i find are lengthy solutions. I can't quite understand that such a typical administrative task like adding dates needs so much fuss. Isn't there a way to convert my one-liner to, well, i don't know, another one? Come on, i've seen proposed solutions that used bc, had thirty plus lines and magic number all over the script. The simplest solutions seem to use perl... but i don't know how to modify them, as they're quite arcane. Thanks!

    Read the article

  • EXC_BAD_ACCESS signal received

    - by Hector Ramos
    When deploying the application to the device, the program will quit after a few cycles with the following error: Program received signal: "EXC_BAD_ACCESS". The program runs without any issue on the iPhone simulator, it will also debug and run as long as I step through the instructions one at a time. As soon as I let it run again, I will hit the EXC_BAD_ACCESS signal. In this particular case, it happened to be an error in the accelerometer code. It would not execute within the simulator, which is why it did not throw any errors. However, it would execute once deployed to the device. Most of the answers to this question deal with the general EXC_BAD_ACCESS error, so I will leave this open as a catch-all for the dreaded Bad Access error. EXC_BAD_ACCESS is typically thrown as the result of an illegal memory access. You can find more information in the answers below. Have you encountered the EXC_BAD_ACCESS signal before, and how did you deal with it?

    Read the article

  • Firefox extension development firefox4

    - by Jesus Ramos
    So I've been working on updating old extensions for use with FF4 and Gecko 2 but I am having some issues where I am getting an error that says, classID missing or incorrect for component.... Has anyone else had a similar issue or know of how to get around this? function jsshellClient() { this.classDescription = "sdConnector JavaScript Shell Service"; this.classID = Components.ID("{54f7f162-35d9-524d-9021-965a3ba86366}"); this.contractID = "@activestate.com/SDService?type=jsshell;1" this._xpcom_categories = [{category: "sd-service", entry: "jsshell"}]; this.name = "jsshell"; this.prefs = Components.classes["@mozilla.org/preferences-service;1"] .getService(Components.interfaces.nsIPrefService) .getBranch("sdconnector.jsshell."); this.enabled = this.prefs.getBoolPref("enabled"); this.port = this.prefs.getIntPref("port"); this.loopbackOnly = this.prefs.getBoolPref("loopbackOnly"); this.backlog = this.prefs.getIntPref("backlog"); } jsshellClient.prototype = new session(); jsshellClient.prototype.constructor = jsshellClient; When calling generateNSGetFactory on the prototype for this it gives an error in the Error Console in FF4 complaining about the classID. I'm pretty sure that nothing else is using the same GUID so I don't see the problem.

    Read the article

< Previous Page | 1 2 3 4 5 6  | Next Page >