Eclipse Bug: Unhandled event loop exception No more handles

Question: I've built a GUI using Swing and the MigLayout.
I am using Eclipse 4.2.2 (64-bit) on Windows 7 Ultimate.
Every time I click back into the window to edit my code, a popup comes up, then I'm prompted to restart Eclipse, and the Event log says the following:
 org.eclipse.swt.SWTError: No more handles
    at org.eclipse.swt.SWT.error(SWT.java:4387)
    at org.eclipse.swt.SWT.error(SWT.java:4276)
    at org.eclipse.swt.SWT.error(SWT.java:4247)
    at org.eclipse.swt.widgets.Widget.error(Widget.java:468)
    at org.eclipse.swt.widgets.Control.createHandle(Control.java:704)
    at org.eclipse.swt.widgets.Label.createHandle(Label.java:199)
    at org.eclipse.swt.widgets.Control.createWidget(Control.java:744)
    at org.eclipse.swt.widgets.Control.<init>(Control.java:112)
    at org.eclipse.swt.widgets.Label.<init>(Label.java:101)
    ...

I'm attaching screenshots of the error messages.
Has anyone else encountered this bug with Eclipse? Do you know of a work-around or a fix?
Comment: Exact same problem here. I wish someone would come with a better alternative than just downgrading...
Comment: Here's a bug that seems related to this problem : https://bugs.eclipse.org/bugs/show_bug.cgi?id=402983 . It seems that having a dual monitor setup could be related ... Do you guys work on 2 monitors as I do ?
Comment: I have this problem and I'm on two monitors
Comment: Yea, it's irritating. I still haven't found a proper solution.
Comment: I have this problem persistent in one my pc, but it does not happen in another pc. It is quite annoying. I have to stuck with Eclipse 3.8 and ADT2.1
Comment: Amazin. I have this error on a brand new computer with fresh install with such a versions of java and eclipse what I was using before without any such a problem.
Comment: I know this is an old topic but...for me I was able to delete the ".projects" directory in .metadata/.plugins/org.eclipse.core.resources/ directory and then everything worked fine. I did loose some local history...no biggie to me
Answer: I had the same problem, turned out that TeamViewer was causing this.
In your TeamViewer go to:
Extras → Options → Advanced → QuickConnect button, configure it and disable the show QuickConnect button.
Comment: I can't see QuickConnect option in v13.0.6447
Answer: There is a workaround: Change the Java editor to WindowBuilder.
Eclipse → Windows → Preferences → File Associations →, choose WindowBuilder Editor as Java default editor.
Comment: Full path is Eclipse / Windows / Preferences and then General / Editors / File Associations
And in my case there is no "WondowBuilder Editor" available as editor :(
Comment: I tried the same thing but the error still there.
I have installed the window builder and choose as default java editor.
Comment: It is working partially to me. I have installed and finally got not such an errors when switching to java editor. But I still got it when I have switched to (e.g.) variable view in debug perspective.
Comment: nice one! you can actually download the window builder here http://download.eclipse.org/windowbuilder/WB/release/R201309271200/4.3/
Comment: I did installed the windowBuilder plugin and it seemed it worked but after a while it started again
Comment: I added "Java Editor" under the "associated editors" and marked it as default and that worked.
Comment: Does not solved my problem.
Answer: As suggested by Nineroad Installing WindowBuilder as the default editor for files with a *.java extention fixed this issue for me.
In Eclipse, navigate to Help > Install New Software
Add http://archive.eclipse.org/windowbuilder/WB/release/R201309271200/4.3 to the "Work with" path, select all components suggested, and install WindowBuilder.
Once complete, Eclipse will request restart.
Once restarted, within Eclipse navigate to Window > Preferences.
In The Preferences dialogue-box navigate to General > Editor > File Associations.
Under "File Associations" list, be sure to select *.java file types. The bottom window (labeled "Associated Editors") should have WindowBuilder as an option. Select WindowBuilder and click "Default" to the right, to set WindowBuilder as your default *.java file editor.
This fixed the SWT error for me.
Note: Eclipse
Version: Kepler Service Release 2
Windows 7 64-bit
Answer: It is hardware problem at all.
If you have nView, turn off Desktop Manager. In case of ATI, turn off HydraVision.
This works fine on Eclipse Kepler (Standard) and Android Developer Tools Edition.
Comment: Sorry, i know it is a very old post to bump but Wow thank you so much! it really solved my problem! in my case it was AMD Catalyst controll center and i had to go to "Settings > Advanced View" and then to the left, "HydraVision > Manage Desktop > General Settings > Enable Desktop Management" and untick this.

Note: The paths above are translated in english, the transation may not be accurate at all.

Thanks!!!!
Answer: I had DisplayFusion running, which is a special Windows program used to manage multiple monitors. Turning it off seemed to fix this issue for me.
Comment: A commenter on [the Eclipse bug](https://bugs.eclipse.org/bugs/show_bug.cgi?id=402983#c67) suggests that adding a compatibility entry for `eclipse.exe` and checking `Disable TitleBar Buttons (this application only)` as a less drastic solution.
Answer: in short: check out if the bold sections below may save your day :-)
(This answer may help but the source problem is still not found. I'll update my findings if satisfyingly solved.)
<updates...>
update: It just happened again and occurred on dragging/positioning of one XML file (Tomcats content.xml) underneath all other files. (Opened by "XML Editor": Provider: Eclipse Web Tools Platform, Plug-in Name: XML editor, Version: 1.0.700.v201005192212, Plug-in Id: org.eclipse.wst.xmleditor.doc.user)
update2: On further looking into it the error disappears when I move the editor back to the other files (all open editors in one area). Furthermore it appears only when entering or leaving this XML editor, not on e.g. making changes to it and saving it via CRTL+S. Other than that the JBoss-related exception from below occurs on the CTRL+S event, but independent of this issue (so it may not be related at all).
update3: Getting even closer: since some time there has been a new editor positioning feature around. (Initially I was a bit confused, but now I am getting the point and even visually can see what is meant and what makes the difference...).
So there are two ways to position editors vertically or horizontally next to other editors:

positioning it inside the same "panel" (indicated by a global and two inner panels/borders/rectangles around the editors) and
positing it next to the old "panel" (indicated by a rectangle frame around the old panel and the new one.

So putting an editor in a new "global" panel (2.) works fine, putting it in a new "local" panel (1.) causes the issue
(that's actually very helpful because I can still continue to work quite efficiently)
(maybe somebody else could report this bug appropriately)
(it also seems not related to the XML editor mentioned above since it also happens e.g. on property files)
update 4: I am using Windows 7 in hibernate mode. Meaning I don't start my Eclipse too often. Now I realized that Eclipse itself had been started (looking at the Task Manager) 2 times (visually and using ALT+TAB for open windows navigation this was not obvious).
After (stopping/killing all open instances and) restarting the problem does not occur anymore.
update 5: In this duplicate question somebody stated it would have been solved by the latest windows update: https://stackoverflow.com/a/19316804/1915920 . I'll check this out for myself, but currently I cannot reproduce the problem anyways.
update 6: In another situation I had this and it seemed related to some property window (in this case Jasper Reports) that updated its content automatically, based on the current editor (like an outline view). So it could be a good idea to close and re-open (all) outline and/or property windows.
</...updates>
The error in general indicates, that some program(s) have (propably) unusually many (probably thousands?) of operating system file handles open.
So one should check if outside or inside of Eclipse a lot of files are opened at the same time or opened over a short period of time,
but not properly closed (they could be visually closed, but the operating system still thinks they are beeing used because
the application did not properly free the file handles somehow).
Now I have this issue currently as well. If I look in the Error Log (Window->Show View->General->Error Log)
I can see a lot of the following org.jboss.ide.eclipse.archives.core.* exceptions immediately before.
Since I don't use the installed JBoss Developer Studio Plugin (that is likely related to this one) right now and
no associated window or editor is opened (only some toolbar "JBoss Central" and perspective "JBoss" buttons) I'll have
a look if disabling these will help on this sporadic problem.
Also I closed all open editors, restarted Eclipse and open them and can't see this issue right now again.
Problems occurred when invoking code from plug-in: "org.eclipse.core.resources".

...
java.lang.NullPointerException
    at org.jboss.ide.eclipse.archives.core.WorkspaceChangeListener$2.visit(WorkspaceChangeListener.java:74)
    at org.eclipse.core.internal.events.ResourceDelta.accept(ResourceDelta.java:69)
    at org.eclipse.core.internal.events.ResourceDelta.accept(ResourceDelta.java:49)
    at org.jboss.ide.eclipse.archives.core.WorkspaceChangeListener.resourceChanged(WorkspaceChangeListener.java:70)
    at org.eclipse.core.internal.events.NotificationManager$1.run(NotificationManager.java:291)
    at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
    at org.eclipse.core.internal.events.NotificationManager.notify(NotificationManager.java:285)
    at org.eclipse.core.internal.events.NotificationManager.broadcastChanges(NotificationManager.java:149)
    at org.eclipse.core.internal.resources.Workspace.broadcastPostChange(Workspace.java:396)
    at org.eclipse.core.internal.resources.Workspace.endOperation(Workspace.java:1531)
    at org.eclipse.core.internal.resources.Workspace.run(Workspace.java:2354)
    at org.eclipse.ui.actions.WorkspaceModifyOperation.run(WorkspaceModifyOperation.java:118)
    at org.eclipse.ui.internal.editors.text.WorkspaceOperationRunner.run(WorkspaceOperationRunner.java:75)
    at org.eclipse.ui.internal.editors.text.WorkspaceOperationRunner.run(WorkspaceOperationRunner.java:65)
    at org.eclipse.ui.editors.text.TextFileDocumentProvider.executeOperation(TextFileDocumentProvider.java:456)
    at org.eclipse.ui.editors.text.TextFileDocumentProvider.saveDocument(TextFileDocumentProvider.java:772)
    at org.eclipse.ui.texteditor.AbstractTextEditor.performSave(AbstractTextEditor.java:5068)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at org.jboss.tools.common.editor.ObjectMultiPageEditor.saveX(ObjectMultiPageEditor.java:403)
    at org.jboss.tools.common.editor.ObjectMultiPageEditor.doSave(ObjectMultiPageEditor.java:385)
    at org.eclipse.ui.internal.SaveableHelper$2.run(SaveableHelper.java:150)
    at org.eclipse.ui.internal.SaveableHelper$5.run(SaveableHelper.java:276)
    at org.eclipse.jface.operation.ModalContext.runInCurrentThread(ModalContext.java:464)
    at org.eclipse.jface.operation.ModalContext.run(ModalContext.java:372)
    at org.eclipse.ui.internal.WorkbenchWindow$13.run(WorkbenchWindow.java:1812)
    at org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator.java:70)
    at org.eclipse.ui.internal.WorkbenchWindow.run(WorkbenchWindow.java:1809)
    at org.eclipse.ui.internal.SaveableHelper.runProgressMonitorOperation(SaveableHelper.java:284)
    at org.eclipse.ui.internal.SaveableHelper.runProgressMonitorOperation(SaveableHelper.java:263)
    at org.eclipse.ui.internal.SaveableHelper.savePart(SaveableHelper.java:155)
    at org.eclipse.ui.internal.WorkbenchPage.saveSaveable(WorkbenchPage.java:3777)
    at org.eclipse.ui.internal.WorkbenchPage.saveEditor(WorkbenchPage.java:3790)
    at org.jboss.tools.common.model.ui.texteditors.SaveAction3.run(PropertiesTextEditorComponent.java:357)
    at org.eclipse.jface.action.Action.runWithEvent(Action.java:499)
    at org.eclipse.jface.commands.ActionHandler.execute(ActionHandler.java:119)
    at org.eclipse.ui.internal.handlers.E4HandlerProxy.execute(E4HandlerProxy.java:90)
    at sun.reflect.GeneratedMethodAccessor58.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at org.eclipse.e4.core.internal.di.MethodRequestor.execute(MethodRequestor.java:56)
    at org.eclipse.e4.core.internal.di.InjectorImpl.invokeUsingClass(InjectorImpl.java:243)
    at org.eclipse.e4.core.internal.di.InjectorImpl.invoke(InjectorImpl.java:224)
    at org.eclipse.e4.core.contexts.ContextInjectionFactory.invoke(ContextInjectionFactory.java:132)
    at org.eclipse.e4.core.commands.internal.HandlerServiceHandler.execute(HandlerServiceHandler.java:167)
    at org.eclipse.core.commands.Command.executeWithChecks(Command.java:499)
    at org.eclipse.core.commands.ParameterizedCommand.executeWithChecks(ParameterizedCommand.java:508)
    at org.eclipse.e4.core.commands.internal.HandlerServiceImpl.executeHandler(HandlerServiceImpl.java:213)
    at org.eclipse.e4.ui.bindings.keys.KeyBindingDispatcher.executeCommand(KeyBindingDispatcher.java:285)
    at org.eclipse.e4.ui.bindings.keys.KeyBindingDispatcher.press(KeyBindingDispatcher.java:504)
    at org.eclipse.e4.ui.bindings.keys.KeyBindingDispatcher.processKeyEvent(KeyBindingDispatcher.java:555)
    at org.eclipse.e4.ui.bindings.keys.KeyBindingDispatcher.filterKeySequenceBindings(KeyBindingDispatcher.java:376)
    at org.eclipse.e4.ui.bindings.keys.KeyBindingDispatcher.access$0(KeyBindingDispatcher.java:322)
    at org.eclipse.e4.ui.bindings.keys.KeyBindingDispatcher$KeyDownFilter.handleEvent(KeyBindingDispatcher.java:84)
    at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
    at org.eclipse.swt.widgets.Display.filterEvent(Display.java:1262)
    at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1056)
    at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1081)
    at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1066)
    at org.eclipse.swt.widgets.Widget.sendKeyEvent(Widget.java:1108)
    at org.eclipse.swt.widgets.Widget.sendKeyEvent(Widget.java:1104)
    at org.eclipse.swt.widgets.Widget.wmChar(Widget.java:1525)
    at org.eclipse.swt.widgets.Control.WM_CHAR(Control.java:4723)
    at org.eclipse.swt.widgets.Canvas.WM_CHAR(Canvas.java:344)
    at org.eclipse.swt.widgets.Control.windowProc(Control.java:4611)
    at org.eclipse.swt.widgets.Canvas.windowProc(Canvas.java:340)
    at org.eclipse.swt.widgets.Display.windowProc(Display.java:4977)
    at org.eclipse.swt.internal.win32.OS.DispatchMessageW(Native Method)
    at org.eclipse.swt.internal.win32.OS.DispatchMessage(OS.java:2549)
    at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3757)
    at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$9.run(PartRenderingEngine.java:1113)
    at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
    at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.run(PartRenderingEngine.java:997)
    at org.eclipse.e4.ui.internal.workbench.E4Workbench.createAndRunUI(E4Workbench.java:138)
    at org.eclipse.ui.internal.Workbench$5.run(Workbench.java:610)
    at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
    at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:567)
    at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:150)
    at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:124)
    at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196)
    at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:110)
    at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:79)
    at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:354)
    at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:181)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:636)
    at org.eclipse.equinox.launcher.Main.basicRun(Main.java:591)
    at org.eclipse.equinox.launcher.Main.run(Main.java:1450)
    at org.eclipse.equinox.launcher.Main.main(Main.java:1426)

...
eclipse.buildId=4.3.0.I20130605-2000
java.version=1.7.0_25
java.vendor=Oracle Corporation
BootLoader constants: OS=win32, ARCH=x86_64, WS=win32, NL=de_DE
Framework arguments:  -product org.eclipse.epp.package.reporting.product
Command-line arguments:  -os win32 -ws win32 -arch x86_64 -product org.eclipse.epp.package.reporting.product

installed plugins (Help->About Eclipse->Installation Details->Installed Software: mark all + CTRL+C):
(Eclipse Kepler Java EE and BIRT edition as base install)
  Apache Directory Studio LDAP Browser  2.0.0.v20130628 org.apache.directory.studio.ldapbrowser.feature.feature.group   Apache Software Foundation
  DevUtilsFeature   18.104.22.168209201734  DevUtilsFeature.feature.group   null
  Eclipse IDE for Java and Report Developers    184.108.40.20630613-0530 epp.package.reporting   null
  GlassFish Tools   18.104.22.168307232054  oracle.eclipse.tools.glassfish.feature.group    Oracle
  JarPlug   0.6.1   com.simontuffs.eclipse.jarplug.feature.feature.group    simontuffs.com
  Jaspersoft Studio feature 5.2.0   com.jaspersoft.studio.feature.feature.group Jaspersoft Corporation
  Java EE 5 Documentation   188.8.131.52307232054  oracle.eclipse.tools.javaee.doc.v5.feature.group    Oracle
  Java EE 6 Documentation   126.96.36.199307232054  oracle.eclipse.tools.javaee.doc.v6.feature.group    Oracle
  Java EE 7 Documentation   18.104.22.168307232054  oracle.eclipse.tools.javaee.doc.v7.feature.group    Oracle
  JBoss Developer Studio (Core Features)    7.0.0.GA-v20130720-0044-B364    com.jboss.jbds.product.feature.feature.group    JBoss by Red Hat
  Log Viewer Feature    0.9.8.8 de.anbos.eclipse.logviewer.feature.feature.group    Andre Bossert
  MercurialEclipse  220.127.116.11304290948  mercurialeclipse.feature.group  MercurialEclipse project
  MyLV  1.0.4   mylv_feature.feature.group  null
  Oracle ADF Documentation (220.127.116.11)   18.104.22.168307232054  oracle.eclipse.tools.adf.doc.v11114.feature.group   Oracle
  Oracle ADF Documentation (18.104.22.168)   126.96.36.199307232054  oracle.eclipse.tools.adf.doc.v11115.feature.group   Oracle
  Oracle ADF Documentation (184.108.40.206)   220.127.116.11307232054  oracle.eclipse.tools.adf.doc.v11116.feature.group   Oracle
  Oracle ADF Documentation (184.108.40.206)   220.127.116.11307232054  oracle.eclipse.tools.adf.doc.v11117.feature.group   Oracle
  Oracle ADF Documentation (12.1.2) 184.108.40.206307232054  oracle.eclipse.tools.adf.doc.v1212.feature.group    Oracle
  Oracle ADF Tools  188.8.131.52307232054  oracle.eclipse.tools.adf.feature.group  Oracle
  Oracle Cloud Tools    22.214.171.124307232054  oracle.eclipse.tools.cloud.feature.group    Oracle
  Oracle Coherence Tools    18.104.22.168307232054  oracle.eclipse.tools.coherence.feature.group    Oracle
  Oracle Database Tools 22.214.171.124307232054  oracle.eclipse.tools.database.feature.group Oracle
  Oracle Java EE Tools  126.96.36.199307232054  oracle.eclipse.tools.javaee.feature.group   Oracle
  Oracle Maven Tools    126.96.36.199307232054  oracle.eclipse.tools.maven.feature.group    Oracle
  Oracle Spring Tools   188.8.131.52307232054  oracle.eclipse.tools.spring.feature.group   Oracle
  Oracle WebLogic Scripting Tools   22.214.171.124307232054  oracle.eclipse.tools.weblogic.scripting.feature.group   Oracle
  Oracle WebLogic Server Tools  188.8.131.52307232054  oracle.eclipse.tools.weblogic.feature.group Oracle
  Toad® Extension for Eclipse - Community Edition - Core Plugin 188.8.131.52308140922  com.quest.toadext.core.feature.feature.group    Quest Software, Inc.
  Toad® Extension for Eclipse - Community Edition - MySQL DB Plugin 188.8.131.52308140922  com.quest.toadext.mysql.feature.feature.group   Quest Software, Inc.
  Toad® Extension for Eclipse - Community Edition - Oracle Database Plugin  22.214.171.124308140922  com.quest.toadext.feature.feature.group Quest Software, Inc.
  Toad® Extension for Eclipse - Community Edition - PostgreSQL Plugin   126.96.36.199308140922  com.quest.toadext.postgre.feature.feature.group Quest Software, Inc.

Comment: For me it still happens today (I just migrated to Keppler) when viewing the source of a class file (Ctrl + click on a method that takes you to the source of a compiled class). When viewing the source of that class file if I click on the debug view and then come back to the editor I systematically get this error ... Very annoying when trying to debug something.
Answer: I had the exact same issue. I found here a solution which works for me : https://bugs.eclipse.org/bugs/show_bug.cgi?id=517671#c58
For me it was sufficient to put
export GTK_IM_MODULE=ibus

into ~/.profile.
Hope this will help some of you also.
Comment: thanks... could you repost your answer here:  https://stackoverflow.com/questions/59150005/getting-error-when-opening-eclipse-market      I will mark your answer as correct answer
Comment: thanks a lot. that helps me also. Works in Ubuntu 19.04
Answer: For me, this causes by ATI Desktop Manager.
After killing "HydraDM.exe" process, the problem was gone.
When I re-run it again, the problem return.
So if you're using ATI Graphic Card, try to open Task Manager, locate "HydraDM.exe" (or 64 bit version) then kill it.
Comment: what is `HydraDM.exe`? I cannot find any!
Comment: HydraDM.exe is Desktop Manager for ATI Graphic Card.
Answer: If you use DisplayFusion:

Open Display Fusion settings page
Click compatibility tab
Add Eclipse or STS.exe application
Check "Disable TitleBar Buttons (this application only), "Disable Application Hooks (this application only)", and "Use Process file icon on DisplayFusion taskbar, not window icon"

Reference: Display Fusion FIX
Answer: Wow, what a variety of causes of these error messages! I'll throw one more out:
In my case, Eclipse 4.17 on Ubuntu 16.04LTS was showing these messages for multiple operations. It turns out that 16.04LTS has GTK 3.18, but Eclipse 4.17 requires GTK 3.20. Updating GTK (https://askubuntu.com/questions/933010/how-to-upgrade-gtk-3-18-to-3-20-on-ubuntu-16-04) made the error messages go away.
Answer: I found now 2 ways to work with eclipse without getting "SWTError: No more handles" on my Dell ProBook 6550b Windows 7 64 bit but none of them is really satisfying: I can start windows in "secure mode" or I can downgrade to "eclipse-jee-indigo-SR2-win32-x86_64". I will now try to kill one process after the other until kepler starts working respective until I arrive in secure mode.
... and then a few hours later ...
Finally (for now) I could solve the issue (at least on my laptop: Dell ProBook 6550b Windows 7 64). I "just" had to kill the processes: "DPAgent.exe*32" (DigitalPersona Local Agent) & "DPAgent.exe" (DigitalPersona 64-bit Helper Process) which were luckily running under my user (and not SYSTEM which might have made it impossible to kill depending on your rights). Nevertheless I don't understand how these processes can interfere with SWT handles in eclipse ....
More information on this issue can as well be found here: https://bugs.eclipse.org/bugs/show_bug.cgi?id=402983
Answer: If you have a fresh Windows 7, force a Windows Update. That will make the problem go away. It's a shot in the dark, but solved my problem.
I struggled with it for a day until I realized that newer eclipse releases give the above error with older .net Framework: everything went fine until a driver installed .net 4.0, and from that point Eclipse editor gave the unhandled event loop exception.
Comment: Can confirm that the windows update does fix the issue
Answer: I have a nvidia GPU, and if nView is enabled it happens all the time.
Try to disable it.
It seems that eclipse is not very compatible with softwares that override system window management on multi screen.
Hint how to disable nView: http://nviewdesktopmanager.blogspot.com/2011/08/how-to-disable-nview-desktop-manager.html
Answer: I had the same problem and finally figured out, that it was the Logitech SetPoint Software.
Deinstalled it - and the error is gone.
Answer: I had this issue after installing HP ProtectTools on HP Probook 6470b, because of included Password Manager.
To disable it run "HP ProtectTools Administrative Console", go to "Applications->Settings", open "Applications" tab and uncheck "Status" checkbox.
After PC restart problem should be solved, but you can't use Password Manager anymore :(
Answer: Happens with Eclipse Mars.2 Release (4.5.2) and Multimon TaskBar 2.1 on a dual monitor setup, too. It disappears if MM TaskBar is un-loaded.
UPDATE
Still the same with Oxygen.2 Release (4.7.2).
Answer: Well, somewhat answering my own question here.
I am still unaware of what causes the issue, but I have found an alternative.
Since the Juno release of Eclipse is relatively recent, the bug itself might have something to do with my system's configuration.
I instead downloaded the latest version of its predecessor, Eclipse Indigo.
Now I am able to use Eclipse just fine.
As I do not require any of the new features of Juno, the Indigo release will do just fine.
Answer: "unhandled event loop exception .. no more handles" error (in my case) was caused by the driver of my mouse ! closing my mouse driver solved the problem. It has nothing to do with Eclipse versions, I tried almost all versions after Helios(in both 64bit/32bit) and all of them have the same problem, I also tried to add Eclipse/JRE variable path within advanced windows settings "environment variables". To help you to resolve this error try to close up unused applications and drivers.
Answer: I have the same problem. It is caused by a screen capture software hypersnap7. So I think the hotkey conflict is the reason. Reboot computer, don't start other software, start Android Development Tools and watch which software triger the bug.
Answer: I am running dual monitors and have had this issue with both Kepler and STS 3.4.0.  Killing the HydraDM.exe process worked for me.
Answer: The 'bug' is discussed here https://bugs.eclipse.org/bugs/show_bug.cgi?id=402983. A lot of discussion around 'multiple monitor' set-ups. I experienced the problem today(click in Eclipse (off-the-shelf ADT v22.3.0-887826) Package Explorer then click in java editor, and the "no more handles" error appears). It makes Eclipse unuseable.
Got me thinking that it is a monitor/graphics card problem on my win7 64bit PC, rather than a problem with Eclipse. I re-installed the graphics card (nVidia GTX480) and updated the drivers. Noticed multiple error dialog boxes(samsung monitor not found) relating to my monitor(in fact a single BX2440 monitor set-up) as i closed the system down for reboot. So, on re-boot I upgraded the monitor driver. Then booted again, and the problem has gone(at least for now).
BTW, I don't have Win 7 SP1 installed, so i don't think the 'full Windows update' solution discussed elsewhere on SO necessarily works for everyone.
Comment: I had the exact same problem again today. I re-installed the GTX480 drivers, clicked through a windows dialog box "samsung monitor not found", then moved my mouse from Eclipse package explorer panel to java editor panel, and the 'no more handles' error had gone. Will probably re-occur again, but at least I have a fix for now.
Answer: For me this error was happening on a fresh Eclipse Luna SR2 (4.4.2) install and when trying to add a Mercurial repository, I resolved after downgrading from Java 8 to Java 7.
Answer: I too faced this problem.
OS : Ubuntu 18.04 LTS
I'm using gnome, I switched from Gnome environment to Gnome Classic environment while logging in and it fixed the issue.
(You can also try other environments like unity - In my case this bug did not appear in Unity or Ubuntu, it only appeared in Gnome )
Answer: I work with Liferay dxp-7.2 ga1 in eclipse 2021-12.
I had this same problem, but i solved it changing JVM in the installation menu to java 14, also in Eclipse.ini.
Answer: It's a general error, that can be caused by other things (In the error log, look at the preceding error), but I found my culprit: Theme plugin.
To be more specific: Darkest Dark Theme and DevStyle plugin the theme comes with. In my case I could also see 1 UI element that wasn't styled correctly, but I didn't think much of it until diagnosing the issue.
I wouldn't post this as an answer, but in my ~2 weeks of troubleshooting and googling I found older cases that could also be caused by that specific theme.
Comment: What shocks me is that this error still happens with Eclipse after almost 11 years since I wrote this question. I haven't used Eclipse in at least 6 years, and having used other IDEs, I'm shocked anyone still even bothers with Eclipse. Then again, I'm sure it has gotten better over time, too. In all cases, glad you could find a workaround.
Comment: It's a general exception, much like division by 0. Various circumstances (including user error) can lead to cause general exceptions. In my case the exception isn't even caused by eclipse, but rather a plugin that clearly has a bug/compatibility issue.


Slow performance after switching to HEREMap premium SDK

Question: I am facing performance issues with HEREMap Premium Android SDK in my react-native project. Previously I was using free version of HEREMap, and my map view was performing very well. But once I switched to Premium SDK, view rendering became very slow.
Following were the only changes I did for premium SDK integration,

Invoke setIsolatedDiskCacheRootPath api before MapEngine.getInstance().init
Update licence key information in app/src/main/AndroidManifest.xml

Am I missing something? please help.
Answer: When you invoke setIsolatedDiskCacheRootPath for the first time it will take longer time to download all the map data. So this is expected behaviour for the first time after you have changed to Premium SDK. Also, map loading time depends on your network connection as well. In general, Here recommends having offline map downloaded already in your app.
Edit: You can also try removing setIsolatedDiskCacheRootPath() but then you can to change your manifest file accordingly. Refer "Using a Shared Disk Cache with the Map Service" section in  https://developer.here.com/documentation/android-premium/dev_guide/topics/map-service.html
<service
  android:name="com.here.android.mpa.service.MapService"
  android:label="HereMapService"
  android:process="global.Here.Map.Service.v3"
  android:exported="true" >
  <intent-filter>
    <action android:name="com.here.android.mpa.service.MapService.v3" >
    </action>
  </intent-filter>
</service>

Comment: Thanks for the quick answer... But the performance is slow even after the first time load... AFIK, in starer kit sdk am able to use MapView without calling setIsolatedDiskCacheRootPath. But in premium SDK setIsolatedDiskCacheRootPath() is mandatory.

Is there a way where I can render the map without using setIsolatedDiskCacheRootPath. As there isn't much changes I did (while switching to premium) am struck without any clue here...
Comment: Edit the answer on how you can remove the setIsolatedDiskCacheRootPath()
Comment: I updated as suggested in the edit, but it didn't resolve my issue. What else might be the problem?
Answer: I had the exact same issue and found a solution eventually. The important thing is to use the AndroidXMapFragment in the view's layout:
<FrameLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent" >

    <fragment
        class="com.here.android.mpa.mapping.AndroidXMapFragment"
        android:id="@+id/mapfragment"
        android:layout_width="match_parent"
        android:layout_height="match_parent"/>
</FrameLayout>

and to inflate it in the view using an activity reference that I passed to the view's constructor:
mapLayout = (FrameLayout) activity.getLayoutInflater().inflate(R.layout.map_layout, null);

Afterwards, the map fragment can be fetched and initialized:
mapFragment = (AndroidXMapFragment) activity.getSupportFragmentManager().findFragmentById(R.id.mapfragment);

Comment: I passed the activity as a parameter for the views constructor.
Comment: How did you get activity.getSupportFragmentManager() to work? That method doesn't seem to be accessible off of the activity from ReactContext.


How can we get updated location after app is terminated?

Question: We have used
significantLocationChange(https://developer.apple.com/documentation/corelocation/getting_the_user_s_location/using_the_significant_change_location_service)
for update location but it gives location update sometimes and so it
 is not consistenly giving the location update.
What is the best way to get updated  location frequently when app is
 in terminated stage (not in foreground / not in background)
Comment: This is an old question, I suggest you to research about background tasks app killed. You will find a way. I've implemented a solution for this but can't publish my code due to compliance.
Answer: You have to enable Background modes for Location updates for your app. You can do this by selecting your Project -> Capabilities -> Background Modes and enable Location updates.
Answer: There is no way to do that, IMHO. If the app is terminated you will get no frequent updates, it was the users choice to terminate your app and Apple respects this. iOS does not collect location data in the background and handles it over to your app when your app is started again.
Comment: Terrible wrong. You have many different ways to wake up (relaunch) and work with locations in background. There are plenty of apps published to track users. You can use background task, combine `significanLocationChanges` with `startUpdatingLocation`, and use all of them together
Comment: As I said, you can combine different approaches and get your location updates as you want
Comment: But only after a significant change, or immediately after the app was terminated?
Comment: You can even avoid app being killed using background tasks. It's up to you to kill users battery or make something smarter. But for your question, can be by significant location, can be by notifications, by silent notifications, by beacons... etc
Comment: If your app gets terminated you will need to wait for something then, like you said, significant location or beacon or silent notification what ever. So you will not receive location changes immediately after the app is terminated. Maybe trough tricks, like silent notification... am I right? If you have a trick, then please provide it here so we all can learn, and thx for the down vote btw.
Comment: The votes (not just mine btw) is related to your answer, which is wrong and lacking technical background
Comment: Sorry, but what exactly is technically wrong? There is no way to get immediate location changes after your app was terminated, and iOS does not collect all the updates you missed, so please explain what is wrong, I'm eager to learn. There might be tricks though, as you mentioned, so please tell how to do it, no code needed to be published. People are very fast in judging here, you experienced it as well.


How to search in mysql?

Question: how to select doctor_id which has ability_id equal 1 and 2 and also 3?
( so the answer is 70)
I know that I cant use IN statement
doctor_id| ability_id
-------- | -------------
70       |      1
71       |      2
70       |      2
70       |      3
50       |      1
20       |      2
10       |      2

Comment: Given this question, https://stackoverflow.com/questions/45544626/mysql-select-many-to-many-that-have-all-condition, it's weird that the answer should be 70.
Answer: You can use group by and having:
select doctor_id
from t
group by doctor_id
having sum(ability_id = 1) > 0 and
       sum(ability_id = 2) > 0 and
       sum(ability_id = 3) > 0 ;

The "not use in" is a very strange requirement.  A more natural way to write this is:
select doctor_id
from t
where ability_id in (1, 2, 3)
group by doctor_id
having count(*) = 3;

Answer: An alternative to Gordon's query would be to aggregate by doctor, restrict to abilities in 1, 2, or 3, and then retain those doctors having three distinct abilities.  This would imply that a retained doctor has all three abiliites.
SELECT doctor_id
FROM yourTable
WHERE ability_id IN (1, 2, 3)
GROUP BY doctor_id
HAVING COUNT(DISTINCT ability_id) = 3

Comment: it's correct but  if I changed the last line to  COUNT(*) = 3 that works too , why should  I use distinct  here ,
Comment: @faezehrasouli If a given doctor could have more than one record for a given ability, then using `COUNT(*)` would give a false positive.  E.g. if the doctor had 1, 1, 2 then `COUNT(*)` would report 3, which is wrong.
Comment: You might be OK with just `COUNT(*)` if you are certain that an ability can only ever appear once for a given doctor, but using `COUNT` with `DISTINCT` is always correct.

How to search in mysql?


jquery metisMenu not working inside ng-include

Question: I want to use ng-include to render the sidebar of the template. The template requires jQuery metisMenu plugin for dropdowns.
Issue: Plugin only works when I load the following scripts inside the partial template 'sidebar.html':

and fails when I try to load them inside index.html.
I want to load the plugin only once inside index.html as I may require it in other partials as well. Here's a Plunker of the working model which requires script loading inside partials. Note that on moving scripts from sidebar.html to index.html the dropdown menu stops working.
Any help would be appreciated. Thanks in advance.
Answer: I have the same problem. You need add metisMenu(); in your main controller:
app.controller('mainController', function($scope, Config) {
  $('#side-menu').metisMenu();
});

Answer: It probably doesn't work on index.html because when it's fired the side-menu isn't present yet. This is the way to fire the jQuery method after AngularJS get's the partial for site

Comment: I made changes as per your suggestion. Dropdown still wouldn't work without scripts inside the partial.[Plunker](http://plnkr.co/edit/m3ojOsHuxeyDTZYvX7eJ?p=preview)
Answer: Adding a link object that called $(element).metisMenu() inside of a setTimeout function fixed it for me.
app.directive('sideNav', function() {
return{
    restrict: 'E',
    templateUrl: 'side_nav.html',
    link: function(scope, element, attrs){
       // execute metisMenu plugin
        setTimeout(function(){
            $(element).metisMenu();
        }, 1);
    },
    controller: function(){
        this.selectedNav = {};

        this.selectTab = function(setTab){
            this.tab = setTab;
        };
        this.isSelected = function(checkTab){
            return checkTab === this.tab;
        };

        this.navItems = [{
            name: 'Dashboard',
            icon: 'fa-dashboard'
        },{
            name: 'Logs',
            icon: 'fa-code'
        },{
            name: 'Firm Diagnostics',
            icon: 'fa-stethoscope',
            navItems: [
                {
                    name: 'Disk I/O'
                },{
                    name: 'Disk Space'
                },{
                    name: 'Processor Information'
                },{
                    name: 'Processor Activity'
                },{
                    name: 'Memory Information'
                },{
                    name: 'Memory Usage'
                },{
                    name: 'Network Configuration'
                },{
                    name: 'Processes'
                },{
                    name: 'Services'
                },{
                    name: 'System Information'
                }
            ]
        }];

    },

    controllerAs: 'sideNav'
};});

Answer: You can add onload callback function at ng-include

and call metisMenu function in loaded function
app.controller('MainCtrl', function($scope) {
  $scope.name = 'World';

  $scope.loaded = function() {
    $('#side-menu').metisMenu();
}
});

This is Plunker


Ubuntu on external drive only boots up on the machine it was created on

Question: I'm trying to create a external m.2 with ubutnu on it. On the external disk I created a new partition table using GPT and 3 partitions:
efi partition, fat32, flagged boot and esp
swap partition, linux-swap, no flags
main partition, ext4, no flags
Installed it as the something else option and mounted the main partition to /
I chose the bootloader location as the efi partition.
The external drive boots up without problems on the machine it was made, but not on another machine. Both machines are UEFI
Comment: Does this answer your question? [Installing Ubuntu in a external hard drive and NOT placing GRUB of my C: hard drive](https://askubuntu.com/questions/327229/installing-ubuntu-in-a-external-hard-drive-and-not-placing-grub-of-my-c-hard-dr)
Answer: A known problem on Ubuntu 22.04 (but you didn't identify the release you used).  Ubuntu 23.04+ using the subiquity installer had fixed this issue.
See https://bugs.launchpad.net/ubuntu/+source/ubiquity/+bug/1396379 Grub installs to wrong disk. Do add yourself to the "Does this affect me?" list on the bug.
There are workarounds/solutions in the bug comments. Another problem is that your host system probably will not boot without the external device (since needed grub files are on it).
You probably have an empty efi partition on the second ssd.  Simply copying the first disk's efi to the ssd should allow it to boot on another machine.


Passing 'records' parameter to Pandas to_dict method

Question: I have a dataframe that I'd like to convert to a dictionary. I want each column in the dataframe to be mapped to the values in it.
import numpy as np
import pandas as pd

data = np.random.randn(5,5)
df = pd.DataFrame(data)
dict1 = df.to_dict(outtype = 'records')

Here is the error I get:

Value Error: outtype records not understood

However, when I check the docs for this method, records is listed as a valid parameter. Moreover, I am able to convert my dataframe to all the other dictionary formats mentioned in docs (list, series, and dict). I'm not sure what could be going wrong.
Comment: IIRC, this was added in 0.13 (which is out now).
Comment: What version of Pandas are you using; can check via `import pandas` `pandas.__version__`
Comment: Ah, I am using version .12. I'll update to .13. Thanks!
Comment: @Jeff: Somewhere you could mention that all questions provide Pandas; NumPy, etc versions..Makes life easier for you
Comment: @NipunBatra I agree...but people dont' read instructions IMHO :)
Comment: I edited this: http://stackoverflow.com/tags/pandas/info (may not be visible for a while)
Answer: Try this:
dict1 = df.to_dict('records')


Can I blow air in my irrigation system through a hose bib to winterize it?

Question: I am looking to winterize my irrigation system: I called a professional company last year, and they charged me 100$ for essentially 15 min of work. One of the guys said that this was super easy to do if I wanted to do it myself next year, which indeed sounds interesting.
I have a compressor and an adapter that allows me to blow air through the system (I just bought one).
I watched videos on the topic and I believe I understand the process pretty well:

Enable/open one circuit at a time through the control panel.
Blow the air with the compressor until no water comes out of the circuit. Not for too long to avoid damaging/melting the sprinklers.
"Rince and repeat" for the other circuits.
Make sure the water input stays closed throughout winter :)

Now, most of the videos on the Internet show an underground box with knobs and pipes that one can shut off/on.
In my case, while I do have that box - picture 1 below - it only contains the electro-valves and there is no additional knob or input in there, to shut anything off or for me to plug anything into.

The only pipe that comes to that box is directly connected to a hose bib in the wall - see picture 2 - in a permanent way: it cannot be unscrewed. The hose bib has a secondary output with a knob though: we usually use it to water manually some plants not covered by the sprinkler system. The host bib has a main knob on the top that cuts water supply to both ends.

Now my question is probably stupid, but you never know:
Am I right to assume that I can just:

Shut off the main knob (on top), effectively preventing any water from going in the system.
Open the secondary knob and plug my air compressor on it to start the water-draining process through there.

I am mainly worried about somehow destroying the hose bib with too much pressure or something. It may be silly.
Additionally : I haven't used a compressor before, is there any pressure setting/value that I should be aware off not to burst the pipes? Anything else I should be aware of?
Thank you.
P.S: My compressor is this model in case it matters. I've read in many places that it was more than enough for the task, provided I am a bit patient in between-circuits.
Comment: Most air compressors have a valve/handle to adjust output pressure, so 30/40 pounds should be enough, instead of full pressure output.
Answer: Your compressor can deliver far more pressure than your irrigation pipes can withstand.  Maybe it's adjustable, otherwise without a suitable regulator it could damage your pipes and sprinklers.  It can deliver 165psi, you want 50 at most, probably less.
Your compressor cannot deliver enough air volume to winterize an irrigation system.   It's 2.6CFM.  You want at least 20, probably more.
Your procedure is more or less correct except that you need to manually turn on one valve at a time (in the green box) to blow out one zone at at time.  You say there are no manual adjustments in there.  You are probably wrong.  Pictures would help.   But if it's true, you will need to do it using your system controller.
Some advice: I love DIY and I love saving money but blowing out the sprinklers is one of the things I farm out.  You cannot justify purchasing and storing a compressor big enough for the task if you won't use it for anything else.  Even renting one for a day will cost more than a landscaper will charge.
Comment: When it is blown out, to save problems in the spring disconnect the second valve from the hose bib and cover the hose with plastic wrap or whatever to keep water and other things out. The reason if your hose bib leaks it will freeze in the valves and you will get a first hand experience on changing them. I would suggest since you do not have a usage for the compressor shop and hire the job or get some neighbors and rent one.
Comment: Thanks for your answer, and just for my understanding: the (S)CFM is about the quantity of air that the compressor can deliver without losing pressure, is that correct? So I assume the rationale for the bigger compressor is to be able to maintain said pressure until the whole waterline is filled with pressurized air?
Comment: The trick is that the sprinkler heads will start blowing air once they have blown out water. If you can't maintain pressure on the section of pipe sufficient to blow air from all the sprinkler heads, the ones further along won't blow out water after a few have blown out water and started blowing air. If you have a very large tank you can do that with a small compressor (and then wait a long time), but you are exceedingly unlikely to have a very large tank with a small compressor.
Answer: I am fortunate enough to have a large compressor in my shop. Blowing out the sprinkler system consists of the following steps:

Turn off the water to the system,
Run an air hose from the compressor to a regulator then to an inlet on the double check valve that's intended for blowing out the system.
Set the pressure on the regulator to about 35 psi and connect the air hose after having relived residual pressure by manually opening one zone for a minute or two.
Run the "test program" on the system controller, on my controller the test program runs each zone for a short time, I think the default is 2 minutes. That's enough time to blow most if not all of the water out of the system. The sprinkler heads will start spinning really fast or whistling when the last of the water is expelled.

Now, all that said, you may not have a system controller that has a test pattern, but nearly all of them have a manual "water now" capability which could be used in it's stead.   It does take a large compressor to make it all work.
Comment: @GeorgeAnderson  Just saw on facebook yesterday that the quote is really "you are going to need a bigger boat"
Comment: @crip659 LOL, but I think I'm close enough!   The OP is either going to have to farm this out, or rent a larger compressor.
Comment: Thanks for your answer. I've seen highly divergent opinions on whether a small compressor would do the job - although, much more slowly. I haven't read a good scientific explanation as to why it would or would not work though. I am not trying to be cheap but rather to understand what makes a difference. I guess I'll stay on the safe side and pay the service though.
Comment: What happens is a small compressor can't deliver the volume needed and pressure drops to maybe 5-10 psi...been there, done that!  Of course a lot depends upon your configuration.  If just a few heads on a zone, it might work, but if you have  a large system with like 10-20 heads, as they said in the movie Jaws, "We're gonna need a bigger boat". :)


Separable field extensions are Frobenius algebras

Question: Wikipedia says that if $L/K$ is finite extension then $L/K$ is separable if and only if $L$ is a separable $K$-algebra. I am interested in the "only if" direction, which is outlined in the article.
$L/K$ has a primitive element $a$, and let $p(x) \in K[x]$ be it's minimal polynomial. Writing
$p(x) = (x-a) \sum_{i=0}^{n-1} b_i x^i$
we obtain a separability idempotent for $L/K$:
$\sum_{i=0}^{n-1} a^i \otimes_K \frac{b_i}{p'(a)}$
I would like to prove that this is indeed a separability idempotent by showing that $\{a^i\}$ and $\{\frac{b_i}{p'(a)}\}$ are dual bases with respect to the inner product $(y,z) \mapsto \mathrm{Tr}_{L/K}(yz)$. In particular:
$z = \sum_{i=0}^{n-1}a^i\mathrm{Tr}_{L/K}(\frac{b_i z}{p'(a)})$
or
$z = \sum_{i=0}^{n-1} \mathrm{Tr}_{L/K}(za^i)\frac{b_i}{p'(a)}$
for all $z \in L$, but my Galois theory is a little rusty.
This is more than separability: such algebras, (with non-degenerate trace) are called strongly separable (see A note on strongly separable algebras)
Answer: This only answers the question of the element being a seperability idempotent, not the dual basis claim.
In the first place, in the Wikipedia article the definition of a separability idempotent $$p=\sum x_i\otimes y_i$$ is one that commutes with all elements in $A$ (automatically verified here) and such that $\sum x_i y_i=1$.  This is achieved by the computation:
$p'(a) = \sum_{i=0}^{n-1}b_i a^i$ so $$\sum_{i=0}^{n-1} a^i \frac{b_i}{\sum_{i=0}^{n-1}b_i a^i}=1.$$
To show that the sets $\langle a^i\rangle$ and $\langle \frac{b_i}{p'(a)}\rangle$ are dual bases under the trace form, we need to show $$\langle a^i,\frac{b_j}{p'(a)}\rangle = \delta_{ij}$$ because we already know that $a^i$ span $L$ over $K$.  From these Kroneckers you can immediately get the representations for $z\in L$ you have above.
I started doing a computation to show this but seems to require more time than I can spare now.  I started with $$ \langle a^i,\frac{b_j}{p'(a)}\rangle = \sum_{\sigma} \sigma( a^i\frac{b_j}{p'(a)}) = \sum_{\sigma} \frac{\sigma(a)^i \sigma(b_j)}{p'(\sigma(a))}$$  and noted that $$p'(\sigma(a)) = \prod_{\sigma'\neq \sigma}(\sigma'(a)-\sigma(a))$$ (the product ranges over $\sigma'$ only) but I have not been able to simplify this somehow to show the required identity.


How do you destroy the D.D.T. in Bloons Tower Defense 6?

Question: So I've recently found out about the D.D.T. (Dark Dirigible Titan) and well, every time I try to destroy it, it just makes it past my defense. It has the property of a lead, black, M.O.A.B., pink, and camo bloons!
My defense can't handle the D.D.T. Is there a way to beat it?
Answer: Per the Bloons Wiki Page on the D.D.T., there are very limited ways to take it out.
It would appear that a Monkey Intelligence Bureau is the most surefire way to allow your towers to hit the D.D.T. Certain heroes, like Gwendolin and Striker Jones, can also damage the D.D.T., and should be placed in an optimal spot on your map to hit them as often as possible. Some notable additions from that page include:

Super Glue can fully stun the D.D.T.
Maim MOAB and Cripple MOAB (from the top Sniper upgrade path) can fully stun the D.D.T.
Any "hot" modifier on a Monkey (ex. Hot Shots from the tack shooter, White Hot Spikes from the Spike trap, Hot Shot Grapeshot from the Monkey Ship, and others)
Super Monkey upgraded with the top path (must be Plasma or higher, including Sun Avatar, Sun Temple, and True Sun God), though the tradeoff for Sun Temple and True Sun God is to consume surrounding towers as sacrifices.
Comment: What about a D.D.T. rush, like on round 99? I should use multi-hit towers, right?
Answer: I've found that having one 5th tier tower is usually enough to survive round 90, and three or four thoughtfully-selected 5th tier towers by round 100 makes banded DDTS and the BAD a breeze.
There are strategies using only 4th tier towers to survive DDTs, and some especially experienced players can squeak by with 3rd tier towers. And you want to put some thought into the towers you pick. For example, Cripple MOAB Sniper will easily handle round 90, but it can't handle the rush on round 95 by itself. And Guardian of the Forest Druid on a short map can't take out the round 90 DDTs by itself but can help out dramatically on round 95 by providing significant damage to all of the DDTS in the rush.
But when I'm playing a standard game of Bloons and have the freedom to pick my own strategy with plenty of money, I aim to have at least one 5th tier by round 90 and the economy to add several others by round 100.


In Web2.0 App, Is Icon better than Text in Menu Bar?

Question: Ok, in Web2.0, i saw many sites using action icon instead of text menu. Ex:

This is the menu bar using text menu
[Product] [Search Article] [Place an Order] .....

This is the menu bar using icon
[icon1] [icon2] [icon3] .....

You see web2.0 is just like Desktop app. In Desktop app (like Excel), they use icons a lot in menu bar (Ex: a Door icon is stand for open) & they did a good job that it made a standard in Desktop app.
So how does user feel if they see lot of icon in Web2.0 app?
Do they feel better?
Note:A Web 2.0 site may allow users to interact and collaborate with each other in a social media dialogue as creators of user-generated content in a virtual community, in contrast to Web sites where people are limited to the passive viewing of content. (Wiki)
Web2.0 like Gmail or Facebook where people can interact with the web site just like they did in a desktop app like Gmail.
Comment: What do you mean by 'web 2.0'? That's not really a meaningful term these days, any more than calling something a Webkit app is. Tell us what the app is actually about, what it does and who uses it, that's more useful than just saying 'web 2.0'.
Comment: Web2.0 like Gmail or Facebook where people can interact with the web site just like they did in a desktop app like Gmail. This is a very good example of web2.0 http://www.smartclient.com/smartgwt/showcase/#tree_appearance_node_titles
Comment: I know what the term Web 2.0 means (or meant) but Facebook and GMail are two very different apps. Different uses, different audiences. We need to know about *your* use case so we can help target the answer to a more specific situation. Saying something is web 2.0 is like saying it's a brochureware site. Well, that could mean many different things; what matters is *what the app is actually for*.
Comment: I think it depends on the clarity of the icons. If you don't have the word search, but you have a magnifying glass icon, it's usually pretty clear because that's an established pattern. Is that what you're asking?
Comment: @JonW: just view Web2.0 is like a web page that work like a Desktop application (like Excel), not just a webpage that view content (just like yahoo news or any newpaper page). Ex: can you sort row in yahoo news?
Comment: @SwankyLegg, yes that is what I am asking for, but my question is if we use a lot of icon like that, will that annoy users?
Comment: It depends on the complexity of the actions. I'll properly answer in a second.
Comment: Also, I just realized that this question is essentially yours: http://ux.stackexchange.com/questions/1795/when-to-use-icons-vs-icons-with-text-vs-just-text-links?rq=1
Answer: If you're introducing unfamiliar actions, users get particularly annoyed when designers implement nondescript icons or icons that force them to learn.
Photoshop gets away with it because they provide tooltips.

Gmail similarly provides tooltips on hover, but people were still annoyed at the switch. If you're concerned, provide both and allow your users to choose which they would like (or both), and then test. Randomly serve users one of the versions, then check the time it takes for them to perform the desired action (or reach your outcome if it's commerce-related).
Comment: so people do upset if they don't understand the icon don't they? I use computer for 20 years but sometimes still upset at gmail, so i think using icon at the right place & right time should work, not too many icons
Comment: Absolutely. This question has a much better description of when and why to use different representations of actions: http://ux.stackexchange.com/questions/1795/when-to-use-icons-vs-icons-with-text-vs-just-text-links?lq=1


Grunt sass multiple dest files

Question: Let's see this part of configuration of grunt sass module :
dev: {
    src: 'dev/sass/style.scss',
    dest: '../site/web/assets/css/style.css',
    options: {
        style: 'expand',
        compass: true
    }
}

This works as expected. Now I want Grunt to compile my scss file to 2 destinations, so I tried :
dev: {
    src: 'dev/sass/style.scss',
    dest: ['../site/web/assets/css/style.css','another/path/style.css']
    options: {
        style: 'expand',
        compass: true
    }
}

But it returns an error :
Warning: Unable to write "../site/web/assets/css/style.css,another/path/style.css" file (Error code: undefined). Use --force to continue.

Is it possible ? What am I doing wrong ?
Answer: dest must be a string not an array. you can't define multiple destination files.
you should use the
Files Object Format
dev: {
    options: {
        style: 'expand',
        compass: true
    },
    files: {
        '../site/web/assets/css/style.css': ['dev/sass/style.scss'],
        'another/path/style.css': ['dev/sass/style.scss']
    }
}

or Files Array Format
dev: {
    options: {
        style: 'expand',
        compass: true
    },
    files: [
      {src: ['dev/sass/style.scss'], dest: '../site/web/assets/css/style.css'},
      {src: ['dev/sass/style.scss'], dest: 'another/path/style.css'}
    ]
}

Grunt sass multiple dest files


Running hover function Jquery

Question: I am trying to fix a code with jQuery to show and hide a image by hovering over a component that the image is placed inside. But I cant get it to work properly. I get error:

Uncaught Error: Syntax error, unrecognized expression: img

Can someone please help my to find the error to why it is not working.

$(document).ready(function() {
  $(document).on('mouseenter', '#blog-section', function() {
    $(this).find(":img").show();
  }).on('mouseleave', '#blog-section', function() {
    $(this).find(":img").hide();
  });
});
html {
  background-color: #000000;
  margin: 0;
  padding: 0;
}

.content {
  display: flex;
  flex-direction: column;
  max-height: 300px;
  text-decoration: none;
}

.blog-list {
  height: 50%;
  list-style: none;
}

#blog-section {
  display: flex;
  flex-direction: row;
  text-decoration: none;
}

#blog-section_link {
  text-decoration: none;
}

#blog-section_content {
  display: flex;
  flex-direction: row;
  color: #ffffff;
  text-align: left;
  margin: 20% 0 5% 10%;
  font-family: 'Noto Sans JP', sans-serif;
  width: 70%;
  height: auto;
}

.blog-section_left {
  display: flex;
  flex-direction: column;
  width: auto;
  margin-top: 10%;
}

.blog-section_date,
.blog-section_cat {
  width: auto;
  margin: 0;
  padding: 0;
}

.blog-section_center {
  margin: 5% 10% 0 5%;
}

#blog-section_image {
  width: auto;
  height: 300px;
}

/* Blog page */

.blog-page {
  color: #ffffff;
}
<link rel="preconnect" href="https://fonts.gstatic.com">
<link href="https://fonts.googleapis.com/css2?family=Noto+Sans+JP&display=swap" rel="stylesheet">

datum

kategori

Lorem ipsum dolor sit amet, consectetur adipiscing elit.

datum

kategori

Lorem ipsum dolor sit amet, consectetur adipiscing elit.

datum

kategori

Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Comment: ids have to be unique so I would change the blog section to a class (and all your other duplicate ids).  and why use js for this - why not just use css? Also, don't use headings for styling - it makes your content less accessible and can penalise you in seo
Answer: Better to use hover : https://api.jquery.com/hover/

$(document).ready(function() {
$('#blog-section').hover(function() {
    $(this).find("img").show();
  }, function() {
    $(this).find("img").hide();
  }
);
});
html {
  background-color: #000000;
  margin: 0;
  padding: 0;
}

.content {
  display: flex;
  flex-direction: column;
  max-height: 300px;
  text-decoration: none;
}

.blog-list {
  height: 50%;
  list-style: none;
}

#blog-section {
  display: flex;
  flex-direction: row;
  text-decoration: none;
}

#blog-section_link {
  text-decoration: none;
}

#blog-section_content {
  display: flex;
  flex-direction: row;
  color: #ffffff;
  text-align: left;
  margin: 20% 0 5% 10%;
  font-family: 'Noto Sans JP', sans-serif;
  width: 70%;
  height: auto;
}

.blog-section_left {
  display: flex;
  flex-direction: column;
  width: auto;
  margin-top: 10%;
}

.blog-section_date,
.blog-section_cat {
  width: auto;
  margin: 0;
  padding: 0;
}

.blog-section_center {
  margin: 5% 10% 0 5%;
}

#blog-section_image {
  width: auto;
  height: 300px;
}

/* Blog page */

.blog-page {
  color: #ffffff;
}
<link rel="preconnect" href="https://fonts.gstatic.com">
<link href="https://fonts.googleapis.com/css2?family=Noto+Sans+JP&display=swap" rel="stylesheet">

datum

kategori

Lorem ipsum dolor sit amet, consectetur adipiscing elit.

datum

kategori

Lorem ipsum dolor sit amet, consectetur adipiscing elit.

datum

kategori

Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Running hover function Jquery


Why does my LED light flicker when turning it on using a dimmer switch?

Question: I replaced a flushmont light fixure with a new dimmable LED Flushmount.  I also replaced the old switch (see images below) with a dimmer switch.  When I turn the LED on there is a flicker while it is turning on.  After that initial dimmer it seems to work fine and the dimming feature works well.
Here's a video of the light turning on.
The dimmer switch that I installed is a toggle dimmer (this one)
with 2 brass screws, one copper screw, and a ground wire.  There was no ground on the old switch, so I connected one black wire to one brass screw, the other black wire to the other brass screw, and the blue wire to the copper screw.  Since I am using this as a single pole switch, my understanding is that it shouldn't matter much.
My questions:
1) Is this simply due to having a single LED light on a dimmer?
2) Should I be concerned about my connections in the flushmount fixture or switch?
3) The old switch had the two black wires under one screw.  Should I do the same on one brass screw in the new switch?
Thank you for any help!
Comment: Where are you? The dimmer link you posted is for the US, but **blue** as a wire color would be neutral in UK and hot or switched hot - but definitely not neutral or ground - in the US. According to the installation instructions, this dimmer only requires 2 wires (i.e., hot + switched-hot) plus ground for a single-switch installation.
Comment: I am in the US.  This is old wiring (not sure if it is original) and the house was built in 1958.
Comment: What was the blue wire connected to before?
Comment: The photos in my post show the old switch with wires connected.  The blue wire was attached to one of the brass screw terminals (they are covered in dust/paint it appears).
Comment: I don't have time right now to read everything on this page, but I wanted to quickly write that I recently discovered that some LED lights are designed to *intentionally* flicker (or strobe) if they are not connected properly.
Answer: Connect it electrically the same as before
Based on the pictures, the original connection was:

TWO black wires to one screw
A blue wire to another screw

In that case, the blacks are both hot. One is the incoming hot, the other is an outgoing hot to another location. That is a little odd because there is already a wire nut, so instead all those wires should have been connected using the wire nut with just one short wire (pigtail) to the screw. Under most circumstances, you should only have one wire per screw.
The blue wire is switched hot.
The new dimmer only needs two wires, unless it is used as part of a 3-way switch (i.e., 2nd switch elsewhere).
The instructions are not terribly clear in certain respects. However, it is pretty clear that for a single (not 3-way) switch, it does not matter which wire goes in which screw, as long as you put one wire on one color screw and another wire on a different color screw. Therefore, you put a black wire (just one, more below on that) on the screw that is a different color from the other two screws and the blue wire onto the screw opposite that screw (i.e., other side of switch rather than above it on the same side of the switch). That gets you hot and switched hot connected properly.
Now to the second black wire. The instructions actually say "Your wall switch may have two
wires attached to the same screw. Tape these two wires together before disconnecting." but then never (as far as I can tell) actually says what to do with the taped wires. Taping is not a valid way to permanently connect wires, and I don't think they actually meant "tape together electrically", but rather "tape together so you know where each of these wires that all look the same should go". In this particular situation, what you need to do is wire nut the two wires together and attach a pigtail (short piece of same colored wire) to the screw. Since your picture already shows a wire nut & pigtail, all you actually need to do is move the "extra" wire (the one that was originally on the screw and is not a pigtail) to the wire nut with everything else.
By connecting one black to one brass screw and the other black to the other brass screw, you effectively treated your hots (plural) as if they were travelers (used between 3-way switches). What that actually did (I think) is something like:

switched hot became "common"
hot (incoming) became "traveler 1"
hot (outgoing) became "traveler 2"

When switch is in "traveler 1 ON" mode:

common connects to traveler 1 == Light on
traveler 2 OFF == something elsewhere in the house isn't going to work

When switch is in "traveler 2 ON" mode (which is the same as "traveler 1 OFF" == "just flip the switch":

traveler 1 OFF == Light off
common connects to traveler 2 == everything else in the house works normally

As far as the blinking when turning on the light, I suspect that is simply the way the bulb is handling the initial signal form the dimmer. It is possible that other bulbs will work better, but hard to say. Dimming LEDs is a tricky business - almost amazing that any of them can dim at all when run on AC.
Answer: You should have the installation instructions but they are here if you tossed them.
The first thing that jumps out at me is this note:

Helpful Hint: If you are replacing a single-pole switch, the screw
  on the same side as the different-colored screw is not used

Which is a great achievement in confusingly worded instructions.  Here's what that means:  You only use one of the screws on the side with two screws for the single pole function.  It doesn't really matter which one other than which position will be 'on'.  If you use the brass screw on the side that doesn't have the copper screw, I would expect on to be the 'up' switch position which is what people expect.  Some pictures might help:
A single-pole switch is simple.  Open is off (current can't flow), closed is on (circuit is connected):

A three way switch is slightly different in that each position makes one of the load sides screws hot.  Up position makes brass screw that is alone hot (I think) and the down position makes the brass on on the side of the copper screw hot.  The copper screw is where you are supposed to attach the source hot from the circuit based on the diagram from the instructions.  You need two of these types of switches to make that work as shown here:

But since this is a single-pole configuration, you don't care about the second screw.  You just need one.  You can ignore the other one but it's not a terrible idea to tape it because it will be hot whenever the light is off.
The fact that the two black wires were under one screw means that one is a pass-through for power to something else.  Something that was always on is now on this switch that was not before.  You need to connect those two black wires again.  A wire nut and a pigtail is the correct way to do this.
The blue wire is what goes to the light.  You reconfigured this incorrectly but that's not causing the flickering.  If the dimmer is set to low when you turn it on, it can either flicker or not come on at all.  You might get better results if you turn it up to full brightness first and then lower it.
Comment: The "Single pole...two screws of the same color" in the instructions refers (in a confusing way!) to the **old** switch. The new dimmer switch uses wires on **different color** screws. And in fact, the blue wire is OK because the instructions do **not** specify (surprisingly to me) which wire goes where for a single-pole installation, just that they go on different color screws.
Comment: @manassehkatz Yeah, you are right.  I'll update the answer.  The 'helpful hint' is even more confusing but that's what discusses the new switch.
Answer: I have had flicker problems with some combinations of LED's that were rated for dimming and different brands of switches that were rated for dimming. Your specific brand of led may be the problem. Check the instructions for your dimmer and see if it has your led listed as compatible. The wire on the 1 screw looks to be looped not 2 separate wires (2 wires under a screw like this would be a code violation). If your new switch has screws do the same if it has leads run the lead to the pigtail. If leads on the new switch you might need a larger size wire nut I cannot tell the color of that one. But verify the LED compatibility and that is probably the root cause of the flickering.
Comment: I agree--I think the LED fixture is just not perfectly compatible with the chosen dimmer. I had a similar problem as the OP, except in addition to the annoying flicker, my LED light had a slight, noticeable "buzz".
Answer: I tried all of the suggestions above and the issue persisted.  I am convinced that the LED light with the dimmer is the problem (which most folks seemed to agree on).  It is odd to me that the flicker only occurs when I initially turn it on.  Typically I seem flickering issues with LEDs to be constant while they are on.
Regardless, I purchased a standard single pole switch and all is well.  Looks like dimming just isn't going to be an option in that room.
Thank you all!
Answer: Modern LED bulbs mostly use switching power supplies, which charge up a capacitor to a specific voltage, run the KED from that, and recharge them when the voltage drops low enough to need a recharge.
If the input voltage is too low, it may take several AC cycles to charge the capacitor enough for the LED to light, and the bulb will flicker.
Note that this becomes more obvious when you have a fixture with many LED bulbs close together. Limits on inrush current and sanple-to-sample differences between bulbs can cause some interesting interactions when the dimmer is set close to or below that needed to keep everything charged up.


Any useful personality mode for a RobCo unit?

Question: You can find terminals where you can activate RobCo unit(s) with a selected personality mode.
Are there any useful or practical?
Because i ended up with another enemy when i protected myself from raiders and the bot with Law Enforcement saw that...
Answer: Yes they can be useful. Construction Worker Mode attacks people not wearing hard hats.
Law enforcement mode attacks people with their weapons drawn so if you holster yours it should leave you alone.
The subway Stewart is bugged so it is almost impossible to give the token over you have a window of less then a second.
The medical one is mostly passive it wont actually heal you but is harmless as long as you leave it alone it will go up and shock hostiles though. That is about all I can think of regarding them


SQL Server 2008 or above: Is there a clear criterion to determine whether I should or should not create an index?

Question: I have been reading "Microsoft SQL Server 2008: A Beginner's Guide" and came across the chapter on indices.  The book does a really good job of demonstrating how to create an index, but not why to create an index.
Nor have I been able to find any satisfactory explanations on the Internet. All the different search results I find are variations of a theme: "how to create an index."
My question is this: is there a clear criterion I can use to determine whether I should create an index? I have read so far that indices should be used intelligently, and that it might create overhead problems for tables with frequent inserts, updates, and deletes (which is true for my database).
Is the answer "it depends -- keep monitoring and adjusting" or is there a crisp criterion I can use to determine whether I should use indices?
Thank you for any insight.
Comment: More of an art than a science,etc.
Answer: There's no crisp criterion. There's just rules of thumb:
overall rule: If a field is used in a "decision context" (e.g. a where, join, order by, etc..., then it should be indexed.
After that, it comes down to usage cases. ie
rarely read, frequently modified - indexes may hurt. the overhead of keeping the indexes current will probably outweigh any benefits the indexes would give the relatively rare "read" operations.
frequently read, rarely modified - definitely. index maintenance overhead is only paid when the table is modified. since you modify rarely, the efficiency gains for the read operations will vastly outweigh the index overhead costs.
some reads/some updates - no way to tell - you'd have to benchmark your particular cases. a table with one index will have far less maintenance overhead than a table with hundreds of (overlapping?) indexes.
Comment: Rules of thumb are still helpful and a lot better than no guidance at all. Something like this should have been in the instruction manuals.


Can stranded wire be used for pigtails in a junction box?

Question: I replaced a fixture today that had a piece of 12Ga stranded (probably THHN) wire used as a pigtail.   The building has some wiring in conduit (other wires in this box were solid), so I'm guessing that's what the prior person had handy.
If this is a legitimate use, it seems that it may be worth keeping a bit of stranded wire handy, as the pigtails would be a little easier to work with in a tight box.
I'm in CT, USA.
Comment: As long as the connector used is listed for both solid and stranded and is properly sized, and the terminal the pigtail is terminated on is listed for stranded wire.
Comment: What type of connector are you using to connect the stranded wire to the solid wire? What is the stranded wire terminating on?
Comment: It was connected to two strands of solid with a wire nut, and terminated on a screw terminal of a light switch.
Answer: As long as all the equipment is listed for the use, there's no problem using stranded wire. The UL White Book says that screw terminals and pressure plate terminals can be used with both solid and stranded wire.

UL White Book 2013
Receptacles(RTDV)
Receptacles for Plugs and Attachment Plugs (RTRT)
Terminals
  Terminals of the wire-binding screw, setscrew, or screw-actuated backwired
  clamping types are suitable for use with both solid and stranded
  building wires.

It says switches are solid only, however, you can use terminal connectors such as fork connectors.

Switches (WFXV)
Snap Switches (WJQR)
Terminals
  Terminals of the wire-binding screw, setscrew, or screw-actuated backwired
  clamping types are suitable for use with solid building wires unless
  otherwise indicated either on the device or in the installation instructions.
Terminals of a flush snap switch are permitted for use with Listed field-installed
  crimped-on wire connectors or an assembly, if so identified by
  the manufacturer.
A flush snap switch may also be provided with conductor leads with
  factory-installed crimped-on connectors. Such connectors may be either
  attached to the flush snap switch terminal or are provided with the flush
  snap switch in the smallest unit shipping container and are suitable for
  use with the terminal of the flush snap switch.

Wire connectors (including twist-on wire connectors) can be used for both solid and stranded wire sizes between 30-10 AWG, in combinations listed by the manufacturer. Unless they are clearly marked to be used with one type or the other.

Wire Connectors (ZMKQ)
Wire Connectors and Soldering Lugs (ZMVV)
Wire stranding -- Unless clearly marked "Solid," "SOL," "Stranded" or
  "STR" for a given wire size, wire range or wire combination, conductors in the range 30-10 AWG are both solid and stranded, and 8 AWG and larger
  are for stranded wire only.

Ideal Industries has a handy PDF, that lists all the allowable wire combinations that can be used with their various connectors. For example, the Ideal 74B® (their basic yellow wire-nut) can be used with 1 - 4 #14 solid or stranded conductors.
Comment: As [this question](http://diy.stackexchange.com/q/62269/33) suggests, using fork connectors can make terminating the wire at devices easier.
Comment: Is the "switches" quote accurate?  It doesn't state "solid and stranded" like the receptacles quote.
Comment: @TomG You're correct, I missed that (sorry I was tired). I've updated my answer.
Answer: Yes, stranded wire is okay; see Tester101's answer for more details.
However, I'd like to add some advice: from experience, solid-wire is both easier and more reliable to pigtail, so if you have a choice, prefer the solid wire.
Also, after seeing multiple correctly-sized and -screwed wirenuts gradually slide off of stranded wire, I now always wrap the wire + wirenut in a bit of electrical tape when working with stranded wire.  Some electricians always do this, but I've never had any issues when only working with solid wire (Disclaimer: I am not a professional electrician).


How to convert a plain string containing UTF-8 Data to

Question: I was working on a project and when I load the data returned by an API I receive UTF-8 encoded data in a string instead of a bytes object so I am unable to use the decode function to get a regular string
"\x73\x61\x6D\x70\x6C\x65\x20\x66\x6F\x72\x20\x64\x61\x74\x61"
I get this instead of
b"\x73\x61\x6D\x70\x6C\x65\x20\x66\x6F\x72\x20\x64\x61\x74\x61"
is there a way to convert the utf-8 string to a regular one!
Thank you gorgeous people :)
Comment: You might want to update the title to show your full question. Also, what code are you currently using to accomplish this?
Comment: what do you mean regular string, I think this is already a regular string.
Comment: In Python 3, strings _are_ UTF-8 data — so your question and incomplete title make little sense. Please [edit] your question and try to be clearer about what you want to accomplish.
Comment: @martineau In Python 3, strings (`str`) are Unicode, but not UTF-8.
Answer: >>> x="\x73\x61\x6D\x70\x6C\x65\x20\x66\x6F\x72\x20\x64\x61\x74\x61"
>>> type(x)
<class 'str'>
>>> x
'sample for data'
>>> x.encode("utf-8")
b'sample for data'

Answer: If your response is of type bytes, the following will print human-readable text:
response = b"\x73\x61\x6D\x70\x6C\x65\x20\x66\x6F\x72\x20\x64\x61\x74\x61"
print(response.decode('utf-8')) # 'sample for data'


Are we about chess engines, chess engine configuration, and similar?

Question: There are a lot of questions about chess engines. How to configure them. What the best ones are. Programming them. It's endless.  Are these things about chess, or not. The first several questions, right now, include 7 (or more) about chess engines.
I consider this site to be about people playing chess in a traditional sense and not asking about their chess program algorithms.
Are these sorts of questions off topic, or not?
Comment: I happen to lean to the opposite view, but vote +1 because the question is a good question.
Answer: I think they should be considered on-topic. In my view, the scope of the site is much wider than "people playing chess in a traditional sense" and can include many things unrelated to play, such as history, equipment (including software), cultural references, etc. It's not like this site is under a deluge of questions, and in fact people often worry that there are not enough questions, judging from discussions on chess.meta.
The What topics can I ask about here? page describes a relatively wide scope like the one I allude to above, although it calls some topics "gray areas". Regarding engines, the current wording is "Chess-specific questions about programming a chess engine or other chess software are welcome". So engines are on topic, at least if you are programming them. The wording is too qualified in my opinion; I see no reason to exclude questions about using chess engines.
I'm sure there are many questions you don't care much for, just as there are questions I don't care much for, but I think that's perfectly normal. I'm actually surprised by how large a fraction of questions asked here I consider interesting, compared to other StackExchange sites. Consider StackOverflow, the mother of all sites. I'm a programmer and yet I find 99% of the questions there to be utterly irrelevant to me (even browsing through specific tags doesn't help much). I don't even try browsing through the site; its main use (and it is a great use!) is to find answers using Google.
If we exclude such questions here, where would they go? A chess programming StackExchange? Considering that the chess site is already marginal in terms of traffic, why split it? There are already people who suggest the chess site should be merged into the board games site, something which I would truly hate!
Answer: According to  the poll results in a previous meta question, chess programming questions are on-topic.
I do think the settings questions are drifting into more of a gray area, and will need to be addressed, especially if they start to get out of hand, which they don't appear to have yet.


ASP.NET MVC2 View Model for multiple view forms and data

Question: one thing that has been puzzling me since learning MVC2 is the following case scenario:
I have a view which contains two latest news lists, a login form and a signup form.
Every example I found on Views and View Models so far has a one-to-one example such as a simple login form etc. But how do I create a model that provides the properties and validation for a login and signup form and manages the data for the news lists.
Can I pass multiple models in the strongly typed view?
When I created one model the form validation would fail as it expects all fields - login and signup to be filled.
I am missing some advanced examples or information. Any help is appreciated.
Answer: I usualy create .ascx in this case.
I make ascx strongly typed for the model (in your case LoginModel)
I make a second ascx strongly typed (in your case SignupModel).
Then I make aspx and put those 2 ascx-es inside of it <% Html.RenderPartial("Login", Model.Login); %> and similar for the other one.
And you make aspx also stronly typed as
<code>class PageModel
{
   public LoginModel Login { get; set; }
   public SignupModel Signup { get; set; }
}
</code>


Apple Push Notification is not delivered

Question: I know it's a little bit flooded with Apple's Push Notification Service (APNs) issues all over StackOverflow so I actually did a lot of researches before coming up my question.
Basically, I have followed the apns-php's CertificateCreation, some tutorial like on mobiforge, and some from Matthijs Hollemans. Still, I can't get any notification posted onto my iPad 2.
Basically these are the steps I have done:

I followed the CertificateCreation tutorial, I came out with server_certificates_bundle_sandbox.pem, entrust_root_certification_authority.pem.
Followed the tutorial specified in mobiforge blog, I successfully created the App ID, provisioning profile and linked them together nicely.

Description: APNTest
Bundle Seed ID: Use Team ID
Bundle Identifier: com.learn.APN

Then I enable the Development Push SSL Certificate (only for now) using the same certificate request I have used just now to get the certs, and I download it and install it into my keychain.
I downloaded my provisioning profile in .mobileprovision file and loaded it into Xcode's Organizer under my iPad 2 device.
Next I create a simple application with only these codes:
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
    [[UIApplication sharedApplication] registerForRemoteNotificationTypes:(UIRemoteNotificationTypeAlert | UIRemoteNotificationTypeBadge | UIRemoteNotificationTypeSound)];
    // Override point for customization after application launch.
    return YES;
}

- (void)application:(UIApplication *)application didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken
{
    NSLog(@"%@", deviceToken);
}

- (void)application:(UIApplication *)application didFailToRegisterForRemoteNotificationsWithError:(NSError *)error
{
    NSLog(@"Error: %@", error);
}

Then I configure the build parameters:

Targets > Info > Build Identifier: net.learn.APN
Targets > Build Settings > Code Signing Identity > (I chose the provisioning profile I have installed just now, and it automatically selects the identical profiles for my Debug and Release)

I build and run the application on my iPad 2. My application requesting for Push Notification and after I approved it, the Token ID appeared in my console:
2012-01-19 12:43:26.345 TestAPN[578:707] <3cb08612 9392996b 5332d2fc 5adce03d 994f8959 d7a2ac38 de7bed52 c8e0778e>

I used apns-php, changed the device ID (raw 64 hexa-values), then run the sample_push.php. Script ran successfully, but my device is not receiving any notification
Then I try to use the SimplePush.php. A "Message successfully delivered" appeared, but my iPad still doesn't receive any notification from APN

Question is, which steps have I done wrongly? I'm pretty newbie in this area, and it is actually a requirement for my project that the server need to send out messages to our own applications. We are aware of the third party softwares that send APN on behalf of you, but we would like to implement one ourselves.
I also came across the "APN Feedback Service" and I written this (base on the SimplePush) but sadly it's empty. What should I do now?
<?php
// Put your private key's passphrase here:
$passphrase = '';

$ctx = stream_context_create();
stream_context_set_option($ctx, 'ssl', 'local_cert', 'server_certificates_bundle_sandbox.pem');
stream_context_set_option($ctx, 'ssl', 'passphrase', $passphrase);

// Open a connection to the APNS server
$fp = stream_socket_client(
        'ssl://feedback.sandbox.push.apple.com:2196', $err,
        $errstr, 60, STREAM_CLIENT_CONNECT|STREAM_CLIENT_PERSISTENT, $ctx);

if (!$fp)
        exit("Failed to connect: $err $errstr" . PHP_EOL);

echo 'Connected to APNS' . PHP_EOL;

while (!feof($fp)) {
        $data = fgets($fp, 1024);
        var_dump(unpack("N1timestamp/n1length/H*devtoken", $data));
}
// Close the connection to the server
fclose($fp);

Note

I am aware of the differences between development/production certs.
iPad is not jailbroken, running iOS 5.0.1
Other App Store apps receives notifications normally
XCode 4.2.1, Lion 10.7.2

I hope I'm not duplicates any of the questions here.. ;)
EDIT
When I run php simplepush.php then php feedback.php, I received a feedback with my device ID. My App is still in the iPad, so does it mean my device ID is wrong?
[root@ip-xx-xx-xx-xx SimplePush]# php feedback.php
Connected to APNS
array(3) {
  ["timestamp"]=>
  int(1326962028)
  ["length"]=>
  int(32)
  ["devtoken"]=>
  string(64) "3cb086129392996b5332d2fc5adce03d994f8959d7a2ac38de7bed52c8e0778e"
}

Thanks
EDIT
After much struggling and redoing all the steps written by Matthijs Hollemans, I finally get it working. So the problem lies within the incorrect PEM file generated... hmm
Comment: I reset everything and restart every steps @ http://www.raywenderlich.com/3443/apple-push-notification-services-tutorial-part-12 and now the push notification works... hmm
Comment: The Push notification service has been having trouble over the past few days. Apple sent out an email saying to regenerate your provisioning profiles. You might have been caught in that.
Comment: Thanks. I have resolved my problem by following closely in all the steps in raywenderlich.com. I believe this is something to do with the cert issue. Anyway, I have solved my problem. Should I post my answer up? (Basically is the same as the page does)
Comment: You might as well put up your answer. Anything that helps is good.
Comment: Probably. I will post my steps up here later for others who might need it ;) Basically is the same as the one in the tutorial just some modifications base on XCode 4.2.1 and new Apple cert interface
Answer: I had similar problem, for me the key thing I didn't know is that the device token is different for dev and prod (for the same device).
I was using the device token I got when testing in dev to test in prod. This was working fine in dev, but when I switched to prod I kept the same device token in my python script (assuming, wrongfully, that the device token would be the same for the same device) but the actual device token registered in prod was different.
In practice this wouldn't happen as the device token is sent to the server, but when I was testing I was using hard coded device token as I didn't want to involve the server.
Hopefully this will save someone some frustration.
Comment: But I haven't touch production cert yet. How could I even mess with it? Thanks for the quick reply!
Comment: This is absolutely correct! The device token in production mode is different from the one in development mode. I've been banging my head for hours trying to figure out what was wrong, & this solved it. Thank you!
Comment: This answer just solved a headache i had between client issue's and me personally testing for quite some time. Simply couldn't pinpoint the issue. I take my hat of to u sir! Thanks a bunch.

p.s. My problem even took me to changing the .pem files used by the backend for the prod/dev environment.


Sleep interval in shell script

Question: I've made a basic shell script, which looks for a file existence. It can get a parameter (optional) for sleep interval. If I don't give any, the default one is 60 seconds.
Here is my code:
#!/bin/bash

minutes=60
if [ "$#" -eq 1 ]; then
re='^[0-9]+$'
if ! [[ "$1" =~ re ]]; then
    echo $1 is not a number!
    exit 1
fi
else minutes=$1*60
fi

while [ ! -f uj_aru ]
do
last | grep Apr
sleep "$minutes"
done

After running this I get this error:
sleep: invalid time interval '*60'
I guess here is a small mistake with the variable, but I didn't manage to figure it out.
Comment: Change `minutes=$1*60` to `minutes=$(($1*60))`
Comment: Just note that `sleep 1m` is also a valid syntax https://www.cyberciti.biz/faq/linux-unix-sleep-bash-scripting/
Comment: You also can use `${1-default}` to use `"default"` instead of `$1` if no parameter was given.
Comment: Is it need for the autocheck file every 60 seconds?
Comment: @Alex yes, if I don't give a parameter, the default time is 60 seconds. Otherwise: parameter*60 seconds
Answer: You are not doing a arithmetic that way. You need to do arithmetic evaluation  using $((..)) as
minutes=$(($1*60))

The error is because you are passing a literal string input to sleep which it does not like.

Sleep interval in shell script


Border set in vmin unit causes gap

Question: DESCRIPTION
I have a weird bug where the border causes a small gap between the content and the border itself when set using vmin units.
REPRODUCIBLE SNIPPET
resize the window to see it, as it only happens on some device viewports

body {
  display: flex;
  justify-content: center;
  align-items: center;
  width: 100vw;
  height: 100vh;
  margin: 0;
  padding: 0;
}

.container {
  display: flex;
  width: 80%;
  height: 80%;
  border-right: 1vmin solid red;
}

.content {
  display: flex;
  width: 100%;
  height: 100%;
  background-color: black;
}

PREMISES

I'm setting border with vmin unit to keep it consistent between any screen resolution
Elements should keep current structure (border on parent, background on child)
Both elements should have display: flex

PROBLEM
I suspect the problem stands on how the vmin value is being rounded into pixels, creating that additional pixel which can be seen in similar scenarios (where a child with the background highlights the gap).
WHAT I TRIED

By having display: tables instead of flex fixes the extra px, but this can't be an option as flex is needed
vw / vh or any viewport unit generate the same issue

SOLUTION

A solution for having a flexible border could be to simply set the .container:after with a width in percentage, height to 100% and a background-color instead of the border. This solution works perfectly fine, but it's not a scalable solution in case we require more than just a single border side (e.g. border-right).

CONCLUSION
So premised all this, is there perhaps some trick that can be applied directly to the border (or its element) to get around it?
I'm not concerned about finding the first solution that works; As presented, a solution exists already, so the question is based out of mere curiosity for writing better code.
Comment: You should google subpixel rendering in CSS. There are a host of articles and stack overflow questions
Answer: Try to use box-shadow instead.

body {
  display: flex;
  justify-content: center;
  align-items: center;
  width: 100vw;
  height: 100vh;
  margin: 0;
  padding: 0;
}

.container {
  display: flex;
  width: 80%;
  height: 80%;
  box-shadow: 1vmin 0 0 0 #f00;
}

.content {
  display: flex;
  width: 100%;
  height: 100%;
  background-color: black;
}

box-shadow: 1vmin 0 0 0 #f00; for right border, box-shadow: 0 0 0 1vmin #f00; for full border.

EDIT:
Why the gap is disappear? I think it is because box-shadow is kind of background with some offset. So, the decimal pixel is on the end. I guess.

But keep in mind that it will act different as being said by @doğukan in the comment.

but box-shadow doesn't work like border. see the difference. with border: i.stack.imgur.com/gqgsD.png box-shadow: i.stack.imgur.com/2ZsrA.png if this is not a problem, box-shadow works fine.
Comment: but box-shadow doesn't work like border. see the difference. with border: https://i.stack.imgur.com/gqgsD.png box-shadow: https://i.stack.imgur.com/2ZsrA.png if this is not a problem, box-shadow works fine.
Comment: Incredibly smart way of displaying a border in an alternative yet compatible way, love it!
Comment: Do you perhaps have a reason why the shadow and border approach the unit differently?
Answer: Just set a background to .container?

body {
  display: flex;
  justify-content: center;
  align-items: center;
  width: 100vw;
  height: 100vh;
  margin: 0;
  padding: 0;
}

.container {
  display: flex;
  width: 80%;
  height: 80%;
  background-color: black;
  border-right: 1vmin solid red;
  border-left: 1vmin solid green;
  border-top: 1vmin solid blue;
  border-bottom: 1vmin solid orange;
}

.content {
  display: flex;
  width: 100%;
  height: 100%;
  background-color: black;
}

Comment: This solution is just covering the problem, not solving it, but you're making a good point since it works perfectly fine for this use case. Not a working solution to adopt in case of multiple `.container` childrens with different backgrounds though

Border set in vmin unit causes gap