text:
Q: ORACLE - to subquery or not to subquery? I have the following 2 queries:
SELECT ENTITY_ID FROM KRIM_ENTITY_NM_T KE
    WHERE TO_NUMBER(KE.PREFIX_NM) >= 5 OR
    lower(KE.TITLE_NM) LIKE '%professor%' OR
    lower(KE.TITLE_NM) LIKE '%senior lecturer%' OR
    lower(KE.SUFFIX_NM) LIKE '%professor%' OR
    lower(KE.SUFFIX_NM) LIKE '%senior lecturer%';
-- result = 712

 SELECT MBR_ID FROM KRIM_GRP_MBR_T KG WHERE KG.MBR_TYP_CD = 'P' AND KG.GRP_ID = '2012';
-- result = 691

The 2 tables are related via MBR_ID and ENTITY_ID
KG.MBR_ID = KE.ENTITY_ID
Per the result count - there is a delta of 21.
Question:  What is the best way to get a listing of ENTITY_IDs that do not show up in the SELECT MBR_ID query?
Would the best approach be a sub-query or JOIN?
Also I'm thinking that EXISTS IN OR NOT IN would be needed here.  Just having trouble with putting those 2 approaches together.
(I'm not worried about performance, I just need to run this once for some clean-up work and throw it away).

A: A couple of ways to do this come immediately to mind:
You can use an OUTER JOIN and look for the NULLs:
SELECT ENTITY_ID
  FROM KRIM_ENTITY_NM_T KE
  LEFT OUTER JOIN (SELECT MBR_ID
                     FROM KRIM_GRP_MBR_T
                     WHERE MBR_TYP_CD = 'P' AND
                           GRP_ID = '2012') kg
    ON kg.MBR_ID = KE.ENTITY_ID
  WHERE (TO_NUMBER(KE.PREFIX_NM) >= 5 OR
         lower(KE.TITLE_NM) LIKE '%professor%' OR
         lower(KE.TITLE_NM) LIKE '%senior lecturer%' OR
         lower(KE.SUFFIX_NM) LIKE '%professor%' OR
         lower(KE.SUFFIX_NM) LIKE '%senior lecturer%') AND
        kb.MBR_ID IS NULL

Or you can use NOT IN:
SELECT ENTITY_ID
  FROM KRIM_ENTITY_NM_T KE
  WHERE (TO_NUMBER(KE.PREFIX_NM) >= 5 OR
         lower(KE.TITLE_NM) LIKE '%professor%' OR
         lower(KE.TITLE_NM) LIKE '%senior lecturer%' OR
         lower(KE.SUFFIX_NM) LIKE '%professor%' OR
         lower(KE.SUFFIX_NM) LIKE '%senior lecturer%') AND
        KE.ENTITY_ID NOT IN (SELECT MBR_ID
                               FROM KRIM_GRP_MBR_T KG
                               WHERE KG.MBR_TYP_CD = 'P' AND
                                     KG.GRP_ID = '2012')

Personally, I've found that the OUTER JOIN method performs better, but others have said the opposite, so test and determine what works best at your site.
EDIT
You can also use the MINUS set operator:
SELECT ENTITY_ID
  FROM KRIM_ENTITY_NM_T KE
  WHERE TO_NUMBER(KE.PREFIX_NM) >= 5 OR
        lower(KE.TITLE_NM) LIKE '%professor%' OR
        lower(KE.TITLE_NM) LIKE '%senior lecturer%' OR
        lower(KE.SUFFIX_NM) LIKE '%professor%' OR
        lower(KE.SUFFIX_NM) LIKE '%senior lecturer%'
MINUS
SELECT MBR_ID AS ENTITY_ID
  FROM KRIM_GRP_MBR_T KG
  WHERE KG.MBR_TYP_CD = 'P' AND
        KG.GRP_ID = '2012'

A: not exists or not in would both work, but maybe you're fooled by the 'or's in the query. Because of operator precedence, you have to add some parentheses:
Using in, embedding the second query exactly as you wrote it:
SELECT ENTITY_ID FROM KRIM_ENTITY_NM_T KE
    WHERE
    ( TO_NUMBER(KE.PREFIX_NM) >= 5 OR
      lower(KE.TITLE_NM) LIKE '%professor%' OR
      lower(KE.TITLE_NM) LIKE '%senior lecturer%' OR
      lower(KE.SUFFIX_NM) LIKE '%professor%' OR
      lower(KE.SUFFIX_NM) LIKE '%senior lecturer%'
    ) AND
    ENTITYID NOT IN (
      SELECT MBR_ID FROM KRIM_GRP_MBR_T KG WHERE KG.MBR_TYP_CD = 'P' AND KG.GRP_ID = '2012'
    )

Using exists:
SELECT ENTITY_ID FROM KRIM_ENTITY_NM_T KE
    WHERE
    ( TO_NUMBER(KE.PREFIX_NM) >= 5 OR
      lower(KE.TITLE_NM) LIKE '%professor%' OR
      lower(KE.TITLE_NM) LIKE '%senior lecturer%' OR
      lower(KE.SUFFIX_NM) LIKE '%professor%' OR
      lower(KE.SUFFIX_NM) LIKE '%senior lecturer%'
    ) AND
    NOT EXISTS (
      SELECT * FROM KRIM_GRP_MBR_T KG
      WHERE KG.MBR_TYP_CD = 'P' AND
        KG.GRP_ID = '2012' AND
        KG.MBRID = KE.ENTITYID
    )


text:
Q: Jira software: trigger a script on release? I'd like, on "Release" button pressed, to trigger a server-side script of my own. I don't need to use big thing like Jenkins, I just need to run a simple script.
I looked into the documentation and found "Listeners" on earlier versions, but there is nothing in the doc for latest version.
Any idea?

A: Can you wrap your remote script in an HTTP interface and trigger it via a webhook? https://developer.atlassian.com/jiradev/jira-apis/webhooks

A: you can also use the script runner plugin for jira, which can execute a script with a ssh on a server or whatever you like

redpajama_set_name: RedPajamaStackExchange


text:
Q: How to update VS projects' frameworks from 2.0 to 4.0 safely? We have about 5 big projects in 2.0 .NET framework. We are using VS 2008. We are decided to change our framework to 4.0 and upgrading to VS 2012. What are the possible problems in this situation? Which ways or steps should we follow? Any suggestions?

A: The only thing that can be suggested is: test it. The actual upgrade should be pretty simple. You may get a few warnings or errors where types or methods have been marked [Obsolete], in which case it usually advises you on the type/method to look at for a replacement, however there can also be implementation changes that impact some (minority of) code. For example, sometimes a bug-fix can lead to your previously working code... not working (if you were inadvertently or deliberately using a behaviour that was not guaranteed).
There is no magic wand here; you just need to test it, but it shouldn't be too painful, especially if you have a test suite.
Also: if you're doing an upgrade anyway, why not go to 4.5?


text:
Q: cmake link error - order dependency or something else? I'm trying to build Sigil on Ubuntu 14.04.  It compiles but won't link.
I've read this (the error there looks very much like what I'm seeing) and this.  I was sure I'd found the culprit, but when I looked in the build files, the Python libraries were already last in the link order:
kevin@aphrodite:~/src/Sigil$ grep -r 'target_link_libraries' .
./src/CMakeLists.txt~:target_link_libraries( ${PROJECT_NAME} ${QT_MAIN} ${HUNSPELL_LIBRARIES} ${PCRE_LIBRARIES} gumbo ${MINIZIP_LIBRARIES} ${BOOST_LIBS} ${XERCES_LIBRARIES} ${XERCESEXTENSIONS_LIBRARIES} ${PYTHON_LIBRARIES} )
./src/CMakeLists.txt:target_link_libraries( ${PROJECT_NAME} ${QT_MAIN} ${HUNSPELL_LIBRARIES} ${PCRE_LIBRARIES} gumbo ${MINIZIP_LIBRARIES} ${BOOST_LIBS} ${XERCES_LIBRARIES} ${XERCESEXTENSIONS_LIBRARIES} ${PYTHON_LIBRARIES} )
./3rdparty/minizip/CMakeLists.txt:target_link_libraries( ${PROJECT_NAME} ${ZLIB_LIBRARIES} )
./cmake_extras/FindPythonLibs.cmake:#    target_link_libraries(${_NAME} ${PYTHON_LIBRARIES})

I'm not very familiar with cmake, so I'm stumped.  The only other thing I can think of is that I have two different versions of Python installed (2.7 and 3.4) because a bunch of core Ubuntu packages require 2.x and Sigil requires 3.x.  If that's the problem, I don't know what to do about it.
Here's the build command, which succeeds:
cmake -G "Unix Makefiles" -DCMAKE_PREFIX_PATH=/home/kevin/local/qt/5.4/gcc_64/lib/cmake -DCMAKE_BUILD_TYPE=Release -DPYTHON_LIBRARY=/usr/bin/python3.4 -DFORCE_BUNDLED_COPIES=1 /home/kevin/src/Sigil

And here's the link command, which fails.  Are there any smoking guns here?
kevin@aphrodite:~/src/Sigil$ make linuxbinpkg
[  1%] Automatic moc for target sigil
[  1%] Built target sigil_automoc
[  5%] Built target gumbo
[ 10%] Built target zlib
[ 13%] Built target hunspell
[ 14%] Built target minizip
[ 21%] Built target pcre
Linking CXX executable ../bin/sigil
/usr/bin/ld: error in /usr/bin/python3.4(.eh_frame); no .eh_frame_hdr table will be created.
CMakeFiles/sigil.dir/Misc/EmbeddedPython.cpp.o: In function `EmbeddedPython::instance()':
EmbeddedPython.cpp:(.text+0x26): undefined reference to `Py_Initialize'
EmbeddedPython.cpp:(.text+0x2b): undefined reference to `PyEval_InitThreads'
EmbeddedPython.cpp:(.text+0x30): undefined reference to `PyEval_SaveThread'
CMakeFiles/sigil.dir/Misc/EmbeddedPython.cpp.o: In function `EmbeddedPython::EmbeddedPython()':
EmbeddedPython.cpp:(.text+0x127): undefined reference to `Py_Initialize'
EmbeddedPython.cpp:(.text+0x12c): undefined reference to `PyEval_InitThreads'
EmbeddedPython.cpp:(.text+0x131): undefined reference to `PyEval_SaveThread'
CMakeFiles/sigil.dir/Misc/EmbeddedPython.cpp.o: In function `EmbeddedPython::~EmbeddedPython()':
EmbeddedPython.cpp:(.text+0x24e): undefined reference to `PyEval_RestoreThread'
EmbeddedPython.cpp:(.text+0x253): undefined reference to `Py_Finalize'
EmbeddedPython.cpp:(.text+0x27c): undefined reference to `PyEval_RestoreThread'
EmbeddedPython.cpp:(.text+0x281): undefined reference to `Py_Finalize'
EmbeddedPython.cpp:(.text+0x2aa): undefined reference to `PyEval_RestoreThread'
EmbeddedPython.cpp:(.text+0x2af): undefined reference to `Py_Finalize'
EmbeddedPython.cpp:(.text+0x2d8): undefined reference to `PyEval_RestoreThread'
EmbeddedPython.cpp:(.text+0x2dd): undefined reference to `Py_Finalize'
EmbeddedPython.cpp:(.text+0x306): undefined reference to `PyEval_RestoreThread'
CMakeFiles/sigil.dir/Misc/EmbeddedPython.cpp.o: In function `EmbeddedPython::addToPythonSysPath(QString const&)':
EmbeddedPython.cpp:(.text+0x32a): undefined reference to `PyGILState_Ensure'
EmbeddedPython.cpp:(.text+0x339): undefined reference to `PySys_GetObject'
EmbeddedPython.cpp:(.text+0x35c): undefined reference to `PyUnicode_FromString'
EmbeddedPython.cpp:(.text+0x38d): undefined reference to `PyList_Append'
EmbeddedPython.cpp:(.text+0x3b6): undefined reference to `PyGILState_Release'
CMakeFiles/sigil.dir/Misc/EmbeddedPython.cpp.o: In function `EmbeddedPython::QVariantToPyObject(QVariant&)':
EmbeddedPython.cpp:(.text+0xd97): undefined reference to `Py_BuildValue'
EmbeddedPython.cpp:(.text+0xdc9): undefined reference to `Py_BuildValue'
EmbeddedPython.cpp:(.text+0xdeb): undefined reference to `Py_BuildValue'
EmbeddedPython.cpp:(.text+0xe0e): undefined reference to `Py_BuildValue'
EmbeddedPython.cpp:(.text+0xe31): undefined reference to `Py_BuildValue'
CMakeFiles/sigil.dir/Misc/EmbeddedPython.cpp.o:EmbeddedPython.cpp:(.text+0xe57): more undefined references to `Py_BuildValue' follow
CMakeFiles/sigil.dir/Misc/EmbeddedPython.cpp.o: In function `EmbeddedPython::QVariantToPyObject(QVariant&)':
EmbeddedPython.cpp:(.text+0xe82): undefined reference to `PyList_New'
EmbeddedPython.cpp:(.text+0xeff): undefined reference to `PyList_SetItem'
EmbeddedPython.cpp:(.text+0x103d): undefined reference to `PyUnicode_FromKindAndData'
EmbeddedPython.cpp:(.text+0x10a4): undefined reference to `PyList_New'
EmbeddedPython.cpp:(.text+0x114e): undefined reference to `PyUnicode_FromKindAndData'
EmbeddedPython.cpp:(.text+0x115c): undefined reference to `PyList_SetItem'
EmbeddedPython.cpp:(.text+0x124b): undefined reference to `Py_BuildValue'
EmbeddedPython.cpp:(.text+0x1299): undefined reference to `Py_BuildValue'
CMakeFiles/sigil.dir/Misc/EmbeddedPython.cpp.o: In function `EmbeddedPython::PyObjectToQVariant(_object*, bool)':
EmbeddedPython.cpp:(.text+0x179a): undefined reference to `PyFloat_Type'
EmbeddedPython.cpp:(.text+0x17a8): undefined reference to `PyType_IsSubtype'
EmbeddedPython.cpp:(.text+0x180a): undefined reference to `PyUnicode_AsUTF8'
EmbeddedPython.cpp:(.text+0x1944): undefined reference to `PyFloat_AsDouble'
EmbeddedPython.cpp:(.text+0x19e4): undefined reference to `PyLong_AsLongLong'
EmbeddedPython.cpp:(.text+0x1bec): undefined reference to `PyBytes_AsString'
EmbeddedPython.cpp:(.text+0x1dd4): undefined reference to `_PyUnicode_Ready'
EmbeddedPython.cpp:(.text+0x1e03): undefined reference to `PyTuple_Size'
EmbeddedPython.cpp:(.text+0x1e2f): undefined reference to `PyTuple_GetItem'
EmbeddedPython.cpp:(.text+0x1f8b): undefined reference to `PyList_Size'
EmbeddedPython.cpp:(.text+0x1fb7): undefined reference to `PyList_GetItem'
CMakeFiles/sigil.dir/Misc/EmbeddedPython.cpp.o: In function `EmbeddedPython::getPythonErrorTraceback(bool)':
EmbeddedPython.cpp:(.text+0x25e0): undefined reference to `PyErr_Fetch'
EmbeddedPython.cpp:(.text+0x25f3): undefined reference to `PyErr_NormalizeException'
EmbeddedPython.cpp:(.text+0x2604): undefined reference to `PyImport_ImportModule'
EmbeddedPython.cpp:(.text+0x263c): undefined reference to `PyObject_CallMethod'
EmbeddedPython.cpp:(.text+0x2793): undefined reference to `PyErr_Clear'
CMakeFiles/sigil.dir/Misc/EmbeddedPython.cpp.o: In function `EmbeddedPython::runInPython(QString const&, QString const&, QList<QVariant> const&, int*, QString&, bool)':
EmbeddedPython.cpp:(.text+0x2b52): undefined reference to `PyGILState_Ensure'
EmbeddedPython.cpp:(.text+0x2bbc): undefined reference to `PyUnicode_FromString'
EmbeddedPython.cpp:(.text+0x2bee): undefined reference to `PyImport_Import'
EmbeddedPython.cpp:(.text+0x2c1b): undefined reference to `PyObject_GetAttrString'
EmbeddedPython.cpp:(.text+0x2c54): undefined reference to `PyCallable_Check'
EmbeddedPython.cpp:(.text+0x2c71): undefined reference to `PyErr_Occurred'
EmbeddedPython.cpp:(.text+0x2d37): undefined reference to `PyGILState_Release'
EmbeddedPython.cpp:(.text+0x2e9f): undefined reference to `PyTuple_New'
EmbeddedPython.cpp:(.text+0x2f35): undefined reference to `PyTuple_SetItem'
EmbeddedPython.cpp:(.text+0x3005): undefined reference to `PyObject_CallObject'
CMakeFiles/sigil.dir/Misc/EmbeddedPython.cpp.o: In function `EmbeddedPython::callPyObjMethod(PyObjectPtr&, QString const&, QList<QVariant> const&, int*, QString&, bool)':
EmbeddedPython.cpp:(.text+0x318d): undefined reference to `PyGILState_Ensure'
EmbeddedPython.cpp:(.text+0x31f4): undefined reference to `PyObject_GetAttrString'
EmbeddedPython.cpp:(.text+0x3226): undefined reference to `PyCallable_Check'
EmbeddedPython.cpp:(.text+0x3243): undefined reference to `PyErr_Occurred'
EmbeddedPython.cpp:(.text+0x32cd): undefined reference to `PyGILState_Release'
EmbeddedPython.cpp:(.text+0x33b9): undefined reference to `PyTuple_New'
EmbeddedPython.cpp:(.text+0x3437): undefined reference to `PyTuple_SetItem'
EmbeddedPython.cpp:(.text+0x34f6): undefined reference to `PyObject_CallObject'
CMakeFiles/sigil.dir/Misc/EmbeddedPython.cpp.o: In function `EmbeddedPython::~EmbeddedPython()':
EmbeddedPython.cpp:(.text+0x30c): undefined reference to `Py_Finalize'
CMakeFiles/sigil.dir/Misc/PyObjectPtr.cpp.o: In function `PyObjectPtr::~PyObjectPtr()':
PyObjectPtr.cpp:(.text+0x1f): undefined reference to `PyGILState_Ensure'
CMakeFiles/sigil.dir/Misc/PyObjectPtr.cpp.o: In function `PyObjectPtr::setNewRef(_object*)':
PyObjectPtr.cpp:(.text+0x8a): undefined reference to `PyGILState_Ensure'
PyObjectPtr.cpp:(.text+0xa3): undefined reference to `PyGILState_Release'
CMakeFiles/sigil.dir/Misc/PyObjectPtr.cpp.o: In function `PyObjectPtr::fromVariant(QVariant const&)':
PyObjectPtr.cpp:(.text+0x14d): undefined reference to `PyGILState_Ensure'
PyObjectPtr.cpp:(.text+0x16c): undefined reference to `PyGILState_Release'
PyObjectPtr.cpp:(.text+0x183): undefined reference to `PyGILState_Ensure'
PyObjectPtr.cpp:(.text+0x1a4): undefined reference to `PyGILState_Release'
PyObjectPtr.cpp:(.text+0x1c0): undefined reference to `PyGILState_Ensure'
PyObjectPtr.cpp:(.text+0x1df): undefined reference to `PyGILState_Release'
PyObjectPtr.cpp:(.text+0x203): undefined reference to `PyGILState_Ensure'
PyObjectPtr.cpp:(.text+0x220): undefined reference to `PyGILState_Release'
CMakeFiles/sigil.dir/Misc/PyObjectPtr.cpp.o: In function `PyObjectPtr::setObject(_object*)':
PyObjectPtr.cpp:(.text+0x42a): undefined reference to `PyGILState_Ensure'
PyObjectPtr.cpp:(.text+0x444): undefined reference to `PyGILState_Release'
CMakeFiles/sigil.dir/Misc/PyObjectPtr.cpp.o: In function `PyObjectPtr::~PyObjectPtr()':
PyObjectPtr.cpp:(.text+0x3d): undefined reference to `PyGILState_Release'
PyObjectPtr.cpp:(.text+0x5f): undefined reference to `PyGILState_Release'
CMakeFiles/sigil.dir/Misc/PyObjectPtr.cpp.o: In function `QtMetaTypePrivate::QMetaTypeFunctionHelper<PyObjectPtr, true>::Destruct(void*)':
PyObjectPtr.cpp:(.text._ZN17QtMetaTypePrivate23QMetaTypeFunctionHelperI11PyObjectPtrLb1EE8DestructEPv[_ZN17QtMetaTypePrivate23QMetaTypeFunctionHelperI11PyObjectPtrLb1EE8DestructEPv]+0xf): undefined reference to `PyGILState_Ensure'
PyObjectPtr.cpp:(.text._ZN17QtMetaTypePrivate23QMetaTypeFunctionHelperI11PyObjectPtrLb1EE8DestructEPv[_ZN17QtMetaTypePrivate23QMetaTypeFunctionHelperI11PyObjectPtrLb1EE8DestructEPv]+0x2d): undefined reference to `PyGILState_Release'
PyObjectPtr.cpp:(.text._ZN17QtMetaTypePrivate23QMetaTypeFunctionHelperI11PyObjectPtrLb1EE8DestructEPv[_ZN17QtMetaTypePrivate23QMetaTypeFunctionHelperI11PyObjectPtrLb1EE8DestructEPv]+0x4f): undefined reference to `PyGILState_Release'
CMakeFiles/sigil.dir/Misc/PyObjectPtr.cpp.o: In function `QtMetaTypePrivate::QMetaTypeFunctionHelper<PyObjectPtr, true>::Delete(void*)':
PyObjectPtr.cpp:(.text._ZN17QtMetaTypePrivate23QMetaTypeFunctionHelperI11PyObjectPtrLb1EE6DeleteEPv[_ZN17QtMetaTypePrivate23QMetaTypeFunctionHelperI11PyObjectPtrLb1EE6DeleteEPv]+0x14): undefined reference to `PyGILState_Ensure'
PyObjectPtr.cpp:(.text._ZN17QtMetaTypePrivate23QMetaTypeFunctionHelperI11PyObjectPtrLb1EE6DeleteEPv[_ZN17QtMetaTypePrivate23QMetaTypeFunctionHelperI11PyObjectPtrLb1EE6DeleteEPv]+0x2d): undefined reference to `PyGILState_Release'
collect2: error: ld returned 1 exit status
make[3]: *** [bin/sigil] Error 1
make[2]: *** [src/CMakeFiles/sigil.dir/all] Error 2
make[1]: *** [src/CMakeFiles/linuxbinpkg.dir/rule] Error 2
make: *** [linuxbinpkg] Error 2

Here's the verbose output from the part that fails:
Linking CXX executable ../bin/sigil
cd /home/kevin/src/Sigil/src && /usr/bin/cmake -E cmake_link_script CMakeFiles/sigil.dir/link.txt --verbose=1
/usr/bin/c++    -std=c++11 -O3 -DNDEBUG   CMakeFiles/sigil.dir/sigil_constants.cpp.o CMakeFiles/sigil.dir/main.cpp.o CMakeFiles/sigil.dir/Tabs/TabBar.cpp.o CMakeFiles/sigil.dir/Tabs/TabManager.cpp.o CMakeFiles/sigil.dir/Tabs/FlowTab.cpp.o CMakeFiles/sigil.dir/Tabs/ContentTab.cpp.o CMakeFiles/sigil.dir/Tabs/TextTab.cpp.o CMakeFiles/sigil.dir/Tabs/CSSTab.cpp.o CMakeFiles/sigil.dir/Tabs/AVTab.cpp.o CMakeFiles/sigil.dir/Tabs/ImageTab.cpp.o CMakeFiles/sigil.dir/Tabs/MiscTextTab.cpp.o CMakeFiles/sigil.dir/Tabs/SVGTab.cpp.o CMakeFiles/sigil.dir/Tabs/OPFTab.cpp.o CMakeFiles/sigil.dir/Tabs/NCXTab.cpp.o CMakeFiles/sigil.dir/Tabs/WellFormedCheckComponent.cpp.o CMakeFiles/sigil.dir/Tabs/XMLTab.cpp.o CMakeFiles/sigil.dir/SourceUpdates/PerformHTMLUpdates.cpp.o CMakeFiles/sigil.dir/SourceUpdates/PerformOPFUpdates.cpp.o CMakeFiles/sigil.dir/SourceUpdates/PerformNCXUpdates.cpp.o CMakeFiles/sigil.dir/SourceUpdates/PerformCSSUpdates.cpp.o CMakeFiles/sigil.dir/SourceUpdates/AnchorUpdates.cpp.o CMakeFiles/sigil.dir/SourceUpdates/LinkUpdates.cpp.o CMakeFiles/sigil.dir/SourceUpdates/WordUpdates.cpp.o CMakeFiles/sigil.dir/SourceUpdates/UniversalUpdates.cpp.o CMakeFiles/sigil.dir/BookManipulation/Book.cpp.o CMakeFiles/sigil.dir/BookManipulation/BookReports.cpp.o CMakeFiles/sigil.dir/BookManipulation/Index.cpp.o CMakeFiles/sigil.dir/BookManipulation/CleanSource.cpp.o CMakeFiles/sigil.dir/BookManipulation/FolderKeeper.cpp.o CMakeFiles/sigil.dir/BookManipulation/Headings.cpp.o CMakeFiles/sigil.dir/BookManipulation/Metadata.cpp.o CMakeFiles/sigil.dir/BookManipulation/XhtmlDoc.cpp.o CMakeFiles/sigil.dir/BookManipulation/GuideSemantics.cpp.o CMakeFiles/sigil.dir/ResourceObjects/Resource.cpp.o CMakeFiles/sigil.dir/ResourceObjects/TextResource.cpp.o CMakeFiles/sigil.dir/ResourceObjects/HTMLResource.cpp.o CMakeFiles/sigil.dir/ResourceObjects/CSSResource.cpp.o CMakeFiles/sigil.dir/ResourceObjects/ImageResource.cpp.o CMakeFiles/sigil.dir/ResourceObjects/AudioResource.cpp.o CMakeFiles/sigil.dir/ResourceObjects/VideoResource.cpp.o CMakeFiles/sigil.dir/ResourceObjects/MiscTextResource.cpp.o CMakeFiles/sigil.dir/ResourceObjects/SVGResource.cpp.o CMakeFiles/sigil.dir/ResourceObjects/FontResource.cpp.o CMakeFiles/sigil.dir/ResourceObjects/OPFParser.cpp.o CMakeFiles/sigil.dir/ResourceObjects/OPFResource.cpp.o CMakeFiles/sigil.dir/ResourceObjects/NCXResource.cpp.o CMakeFiles/sigil.dir/ResourceObjects/XMLResource.cpp.o CMakeFiles/sigil.dir/Dialogs/About.cpp.o CMakeFiles/sigil.dir/Dialogs/AddMetadata.cpp.o CMakeFiles/sigil.dir/Dialogs/ClipboardHistorySelector.cpp.o CMakeFiles/sigil.dir/Dialogs/DeleteFiles.cpp.o CMakeFiles/sigil.dir/Dialogs/DeleteStyles.cpp.o CMakeFiles/sigil.dir/Dialogs/EditTOC.cpp.o CMakeFiles/sigil.dir/Dialogs/OpenWithName.cpp.o CMakeFiles/sigil.dir/Dialogs/SelectCharacter.cpp.o CMakeFiles/sigil.dir/Dialogs/SelectHyperlink.cpp.o CMakeFiles/sigil.dir/Dialogs/SelectId.cpp.o CMakeFiles/sigil.dir/Dialogs/SelectIndexTitle.cpp.o CMakeFiles/sigil.dir/Dialogs/SelectFiles.cpp.o CMakeFiles/sigil.dir/Dialogs/MetaEditor.cpp.o CMakeFiles/sigil.dir/Dialogs/MetaEditorItemDelegate.cpp.o CMakeFiles/sigil.dir/Dialogs/HeadingSelector.cpp.o CMakeFiles/sigil.dir/Dialogs/PluginRunner.cpp.o CMakeFiles/sigil.dir/Dialogs/Preferences.cpp.o CMakeFiles/sigil.dir/Dialogs/PreferenceWidgets/AppearanceWidget.cpp.o CMakeFiles/sigil.dir/Dialogs/PreferenceWidgets/CleanSourceWidget.cpp.o CMakeFiles/sigil.dir/Dialogs/PreferenceWidgets/KeyboardShortcutsWidget.cpp.o CMakeFiles/sigil.dir/Dialogs/PreferenceWidgets/LanguageWidget.cpp.o CMakeFiles/sigil.dir/Dialogs/PreferenceWidgets/SpellCheckWidget.cpp.o CMakeFiles/sigil.dir/Dialogs/PreferenceWidgets/PreserveEntitiesWidget.cpp.o CMakeFiles/sigil.dir/Dialogs/PreferenceWidgets/PluginWidget.cpp.o CMakeFiles/sigil.dir/Dialogs/RenameTemplate.cpp.o CMakeFiles/sigil.dir/Dialogs/Reports.cpp.o CMakeFiles/sigil.dir/Dialogs/ReportsWidgets/AllFilesWidget.cpp.o CMakeFiles/sigil.dir/Dialogs/ReportsWidgets/HTMLFilesWidget.cpp.o CMakeFiles/sigil.dir/Dialogs/ReportsWidgets/LinksWidget.cpp.o CMakeFiles/sigil.dir/Dialogs/ReportsWidgets/ImageFilesWidget.cpp.o CMakeFiles/sigil.dir/Dialogs/ReportsWidgets/CSSFilesWidget.cpp.o CMakeFiles/sigil.dir/Dialogs/ReportsWidgets/ClassesInHTMLFilesWidget.cpp.o CMakeFiles/sigil.dir/Dialogs/ReportsWidgets/StylesInCSSFilesWidget.cpp.o CMakeFiles/sigil.dir/Dialogs/ReportsWidgets/CharactersInHTMLFilesWidget.cpp.o CMakeFiles/sigil.dir/Dialogs/LinkStylesheets.cpp.o CMakeFiles/sigil.dir/Dialogs/SearchEditor.cpp.o CMakeFiles/sigil.dir/Dialogs/ClipEditor.cpp.o CMakeFiles/sigil.dir/Dialogs/IndexEditor.cpp.o CMakeFiles/sigil.dir/Dialogs/SpellcheckEditor.cpp.o CMakeFiles/sigil.dir/Dialogs/ViewImage.cpp.o CMakeFiles/sigil.dir/Exporters/ExportEPUB.cpp.o CMakeFiles/sigil.dir/Exporters/ExporterFactory.cpp.o CMakeFiles/sigil.dir/Exporters/NCXWriter.cpp.o CMakeFiles/sigil.dir/Exporters/XMLWriter.cpp.o CMakeFiles/sigil.dir/Exporters/EncryptionXmlWriter.cpp.o CMakeFiles/sigil.dir/Importers/ImportEPUB.cpp.o CMakeFiles/sigil.dir/Importers/Importer.cpp.o CMakeFiles/sigil.dir/Importers/ImporterFactory.cpp.o CMakeFiles/sigil.dir/Importers/ImportHTML.cpp.o CMakeFiles/sigil.dir/Importers/ImportTXT.cpp.o CMakeFiles/sigil.dir/Misc/AppEventFilter.cpp.o CMakeFiles/sigil.dir/Misc/UpdateChecker.cpp.o CMakeFiles/sigil.dir/Misc/Utility.cpp.o CMakeFiles/sigil.dir/Misc/FindReplaceQLineEdit.cpp.o CMakeFiles/sigil.dir/Misc/FilenameDelegate.cpp.o CMakeFiles/sigil.dir/Misc/XHTMLHighlighter.cpp.o CMakeFiles/sigil.dir/Misc/CSSHighlighter.cpp.o CMakeFiles/sigil.dir/Misc/CSSInfo.cpp.o CMakeFiles/sigil.dir/Misc/HTMLEncodingResolver.cpp.o CMakeFiles/sigil.dir/Misc/HTMLSpellCheck.cpp.o CMakeFiles/sigil.dir/Misc/HTMLPrettyPrint.cpp.o CMakeFiles/sigil.dir/Misc/PasteTargetComboBox.cpp.o CMakeFiles/sigil.dir/Misc/Plugin.cpp.o CMakeFiles/sigil.dir/Misc/PluginDB.cpp.o CMakeFiles/sigil.dir/Misc/QCodePage437Codec.cpp.o CMakeFiles/sigil.dir/Misc/RasterizeImageResource.cpp.o CMakeFiles/sigil.dir/Misc/SearchOperations.cpp.o CMakeFiles/sigil.dir/Misc/Language.cpp.o CMakeFiles/sigil.dir/Misc/UILanguage.cpp.o CMakeFiles/sigil.dir/Misc/SettingsStore.cpp.o CMakeFiles/sigil.dir/Misc/SpellCheck.cpp.o CMakeFiles/sigil.dir/Misc/KeyboardShortcut.cpp.o CMakeFiles/sigil.dir/Misc/KeyboardShortcutManager.cpp.o CMakeFiles/sigil.dir/Misc/XhtmlEntitiesDtd.cpp.o CMakeFiles/sigil.dir/Misc/Ncx20051Dtd.cpp.o CMakeFiles/sigil.dir/Misc/FontObfuscation.cpp.o CMakeFiles/sigil.dir/Misc/TempFolder.cpp.o CMakeFiles/sigil.dir/Misc/OpenExternally.cpp.o CMakeFiles/sigil.dir/Misc/TOCHTMLWriter.cpp.o CMakeFiles/sigil.dir/Misc/ValidationResult.cpp.o CMakeFiles/sigil.dir/Misc/XMLEntities.cpp.o CMakeFiles/sigil.dir/Misc/PyObjectPtr.cpp.o CMakeFiles/sigil.dir/Misc/EmbeddedPython.cpp.o CMakeFiles/sigil.dir/Misc/GumboInterface.cpp.o CMakeFiles/sigil.dir/MiscEditors/ClipEditorModel.cpp.o CMakeFiles/sigil.dir/MiscEditors/ClipEditorTreeView.cpp.o CMakeFiles/sigil.dir/MiscEditors/IndexEditorModel.cpp.o CMakeFiles/sigil.dir/MiscEditors/IndexEditorTreeView.cpp.o CMakeFiles/sigil.dir/MiscEditors/IndexEntries.cpp.o CMakeFiles/sigil.dir/MiscEditors/IndexHTMLWriter.cpp.o CMakeFiles/sigil.dir/MiscEditors/SearchEditorTreeView.cpp.o CMakeFiles/sigil.dir/MiscEditors/SearchEditorModel.cpp.o CMakeFiles/sigil.dir/pcre/SPCRE.cpp.o CMakeFiles/sigil.dir/pcre/PCRECache.cpp.o CMakeFiles/sigil.dir/pcre/PCREReplaceTextBuilder.cpp.o CMakeFiles/sigil.dir/ViewEditors/BookViewEditor.cpp.o CMakeFiles/sigil.dir/ViewEditors/BookViewPreview.cpp.o CMakeFiles/sigil.dir/ViewEditors/CodeViewEditor.cpp.o CMakeFiles/sigil.dir/ViewEditors/LineNumberArea.cpp.o CMakeFiles/sigil.dir/ViewEditors/Searchable.cpp.o CMakeFiles/sigil.dir/ViewEditors/ViewWebPage.cpp.o CMakeFiles/sigil.dir/MainUI/MainApplication.cpp.o CMakeFiles/sigil.dir/MainUI/MainWindow.cpp.o CMakeFiles/sigil.dir/MainUI/FindReplace.cpp.o CMakeFiles/sigil.dir/MainUI/BookBrowser.cpp.o CMakeFiles/sigil.dir/MainUI/ClipsWindow.cpp.o CMakeFiles/sigil.dir/MainUI/PreviewWindow.cpp.o CMakeFiles/sigil.dir/MainUI/TableOfContents.cpp.o CMakeFiles/sigil.dir/MainUI/OPFModel.cpp.o CMakeFiles/sigil.dir/MainUI/OPFModelItem.cpp.o CMakeFiles/sigil.dir/MainUI/NCXModel.cpp.o CMakeFiles/sigil.dir/MainUI/ValidationResultsView.cpp.o CMakeFiles/sigil.dir/qrc_main.cpp.o CMakeFiles/sigil.dir/qrc_About.cpp.o CMakeFiles/sigil.dir/qrc_javascript.cpp.o CMakeFiles/sigil.dir/qrc_icon.cpp.o CMakeFiles/sigil.dir/sigil_automoc.cpp.o  -o ../bin/sigil -rdynamic ../lib/libhunspell.a ../lib/libpcre.a ../lib/libgumbo.a ../lib/libminizip.a /usr/bin/python3.4 /home/kevin/local/qt/5.4/gcc_64/lib/libQt5Xml.so.5.4.1 /home/kevin/local/qt/5.4/gcc_64/lib/libQt5XmlPatterns.so.5.4.1 /home/kevin/local/qt/5.4/gcc_64/lib/libQt5PrintSupport.so.5.4.1 /home/kevin/local/qt/5.4/gcc_64/lib/libQt5Svg.so.5.4.1 /home/kevin/local/qt/5.4/gcc_64/lib/libQt5WebKitWidgets.so.5.4.1 /home/kevin/local/qt/5.4/gcc_64/lib/libQt5Concurrent.so.5.4.1 ../lib/libzlib.a /home/kevin/local/qt/5.4/gcc_64/lib/libQt5Widgets.so.5.4.1 /home/kevin/local/qt/5.4/gcc_64/lib/libQt5WebKit.so.5.4.1 /home/kevin/local/qt/5.4/gcc_64/lib/libQt5Network.so.5.4.1 /home/kevin/local/qt/5.4/gcc_64/lib/libQt5Gui.so.5.4.1 /home/kevin/local/qt/5.4/gcc_64/lib/libQt5Core.so.5.4.1 -Wl,-rpath,/home/kevin/local/qt/5.4/gcc_64/lib

A: As a starting point, try to manually input the following command line

[OMITTED, SEE EDIT HISTORY IF INTERESTED]

Basically I have only replaced Python3.4 with Python2.7; please double check the name of the library in /usr/bin

I see now you have a solution, the root problem is that in the CMakeLists.txt, this line
find_package (PythonLibs 3.4)

Should be:
find_package (PythonLibs 3.4 REQUIRED)

A: Antonio's suggestion to put in a call to message(STATUS "PYTHON_LIBRARIES = ${PYTHON_LIBRARIES}") led me to /facepalm.
In my cmake command, I had put -DPYTHON_LIBRARY=/usr/bin/python3.4.  That is an executable, not a library.  I'm not sure about the exact sequence of events that led me to put that in there, but I think it went like this:

*

*Tried to build with only Python 2.7 installed; cmake failed because it couldn't find a suitable version of Python.

*Installed Python 3.4.  If I tried to build again at this point, maybe it failed because cmake doesn't really have a "clean" option, so perhaps it was stuck on Python 2.7.

*Put in that bogus library path.

So then cmake succeeds, apparently happy with the bogus path which it doesn't actually use for anything, just writes in the Makefile.
After starting over with a clean project tree, I saw this line which I don't think I ever saw before:
Found PythonLibs: /usr/lib/x86_64-linux-gnu/libpython3.4m.so (found suitable version "3.4", minimum required is "3.4")

And now make works!


text:
Q: Installing MoinMoin -wiki to my user directory on a server with no root access I posted this on webapps, but they told me to come here :)
I've been trying to install MoinMoin -wiki on this webserver, where I have no root access.
The server doesn't support wsgi, but it does support cgi/fcgi/etc.
I've scoured google for a simple guide on how to accomplish this, but the only guides I found were from the year 2004 or so. Other guides always assumed that one has root access.
So can anyone link a good tutorial for my question or just help me out here?
Your help is appreciated :)
P.S. Sorry if this is the wrong stack -page
edit:
It's a Linux server, Ubuntu if I recall correctly cba to check now, as I think it's not relevant.
I want the wiki to end up in my public_html folder so that username.server.com/wiki would point to it.
I don't want to ask for them to open an extra port, though it is possible. I just want to get it over http and port 80.

A: For CGI support you can use Mac description:
http://moinmo.in/HowTo/MacOSXwithApacheServer
or Apache on Windows:
http://moinmo.in/HowTo/WindowsWithApacheServer
MoinMoin comes as well with its own standalone server implemented in wikiserver.py. You can start it on any non root port > 1024 just via $ python wikiserver.py (by default port 8080)


text:
Q: Getting IP address of Logstash-forwarder machine I've setup the Elasticsearch, Logstash, Kibana log viewing tools on my systems. There are 2 machines in my configuration now (Amazon EC2 instances):

*

*54.251.120.171 - Logstash-server where ELK is installed

*54.249.59.224 - Logstash-forwarder - sends "/var/logs/messages" log to Logstash-server

On logstash-server, this what my configs (in different files) look like :-
input {
  lumberjack {
    port => 5000
    type => "logs"
    ssl_certificate => "/etc/pki/tls/certs/logstash-forwarder.crt"
    ssl_key => "/etc/pki/tls/private/logstash-forwarder.key"
  }
}

filter {
 if [type] == "syslog" {

    grok {
      match => { "message" => "%{SYSLOGTIMESTAMP:syslog_timestamp} %{SYSLOGHOST:syslog_hostname} %{DATA:syslog_program}(?:\[%{POSINT:syslog_pid}\])?: %{GREEDYDATA:syslog_message}" }
      add_field => [ "received_at", "%{@timestamp}" ]
      add_field => [ "received_from", "%{host}" ]
    }
    syslog_pri { }
    date {
      match => [ "syslog_timestamp", "MMM  d HH:mm:ss", "MMM dd HH:mm:ss" ]
    }
  }
}

output {
  elasticsearch { host => localhost }
  stdout { codec => rubydebug }
}

On logstash-forwarder, this what my config file looks like, it forwards the /var/log/messages, /var/log/secure logs to logstash-server
{
    "network": {
        "servers": [ "54.251.120.171:5000" ],
        "timeout": 15,
        "ssl ca": "/etc/pki/tls/certs/logstash-forwarder.crt"
    },

    "files": [
        {
        "paths": [
                "/var/log/messages",
                "/var/log/secure"
        ],
        "fields": { "type": "syslog" }
        }
    ]
}

This is what my Kibana interface looks like after it has fetched the indexed logs from Elasticsearch.

So my question is, I need a way to retrieve IP address of the logstash-forwarder i.e. 54.249.59.224 in case there's a log event.
The reason why I'm asking this is in a real scenario, we might have many logstash-forwarders (say 10), with all 10 of them sending logs to our logstash-server. So I need someway to tag all the log events, so that I can identify which logstash-server has sent which log event.
I'll need to use the IP address (maybe some other information as well) to search for log events in the Kibana interface.
Can someone please help me to do this? :)
Or incase someone has a better idea how to do this effectively in a different way, you're most welcome!

A: You will need to modify the Lumberjack input filter and server to do this. See the following diffs:
https://github.com/stanhu/logstash-input-lumberjack/commit/0861c9d95caa46370f17a82353710bc78ea2c82e
https://github.com/stanhu/logstash-forwarder/commit/b711d273a24ab3fe1b4a7b6005d2f26983cac859
Until these changes get merged into logstash-forwarder and logstash-input-lumberjack, the easiest way to use this right now is to modify your installed files directly. If you're using the current Debian packages, they are here:
/opt/logstash/lib/logstash/inputs/lumberjack.rb
/opt/logstash/vendor/bundle/jruby/1.9/gems/jls-lumberjack-0.0.20/lib/lumberjack/server.rb

To the input filter configuration file (e.g. /etc/logstash/conf.d/01-lumberjack-input.conf), add:
client_address_field => "client_address"

Your logstash config should look something like this:
input {
  lumberjack {
    host => "localhost"
    port => 5000
    type => "logs"
    ssl_certificate => "/etc/pki/tls/certs/logstash-forwarder.crt"
    ssl_key => "/etc/pki/tls/private/logstash-forwarder.key"
    client_address_field => "client_address"
  }
}

Restart logstash on the machine, and check whether the client_address field is now being added to each message.

A: This is what the 'host' field (which you're also copying to 'received_from') is for.


text:
Q: Alter required attribute for customer attribute I am migrating customers from Mage 1 to Mage 2.
The mage 1 instance did not require first name and last name (it was used as a back end repository for a mobile app).
When I am importing the customers it is telling me that first name and last name are required.
I know that in mage 1 I was able to alter a property and set required to false.
I am unsure on how to do this in mage 2.
Ideally I would like to set to false, do the import and then set to true when the script is finished.

A: From what I can see the table looks the same from 1.9.x
UPDATE eav_attribute SET is_required = 0 WHERE attribute_code = 'lastname'
It might still work. Backup and try it.


text:
Q: Checking if a TensorFlow install has XLA support How can I check if a particular TensorFlow install was built with XLA support?  There is an option in configure to turn it off or on, but I don't see how to interrogate those options from Python.

A: According to release notes for version 1.12.0

The pre-built binary for 1.12 is built with XLA support linked in by default.

You should be able to check for it inside
tensorflow.contrib.compiler
or simply run:

import tensorflow as tf
from tensorflow.contrib.compiler import xla

if there is an ImportError you know xla isn't present.
The code referenced from here.
Also for reference XLA Overview.


text:
Q: Internet explorer sometimes download pdf as ......xhtml (web page) I have followed the recipe for downloading pdf file. Sometimes i can download. But sometimes I am unable to download the actual PDF-file on Internet Explorer.
All I get is an alert box that contains "What you want to do the .....xhtml file?
open or save
"
Anyone see any errors or problems with this code?
Thank you
public static void download(byte[] file, String fileName, String mimeType) {

    facesContext = FacesContext.getCurrentInstance();
    extCtx = FacesContext.getCurrentInstance().getExternalContext();
    resp = (HttpServletResponse) extCtx.getResponse();
    int _BUFSIZE = 32 * 1024;

    int length = 0;
    ServletOutputStream op;
    try {
        op = resp.getOutputStream();
        resp.setCharacterEncoding("ISO 8859-9");
        resp.setContentType(mimeType + ";charset=ISO 8859-9;");
        resp.setContentLength(file.length);
        resp.setHeader("Content-disposition", "attachment;filename=\"" + fileName + "\"");
        resp.setHeader("Cache-Control", "cache, must-revalidate");
        resp.setHeader("Pragma", "public");
        DataInputStream in = new DataInputStream(new ByteArrayInputStream(file));
        byte[] bbuf = new byte[_BUFSIZE];

        while ((in != null) && ((length = in.read(bbuf)) != -1)) {
            op.write(bbuf, 0, length);
        }
        in.close();
        op.flush();
        op.close();
        facesContext.responseComplete();
    } catch (IOException e) {
        e.printStackTrace();
    } finally {

    }
}

A: If your mimeType is "application/pdf", it seems your code is fine.
Try following and test.
In IE;
Tools>Internet Options>Advanced tab, uncheck "Do not save encrypted files to disk"
PDF is not natively supported in MSIE browsers... You need an installed and enabled PDF file reader ActiveX control to render the PDF file stream.

A: #RESOLVED
İt is because of the file name includes Turkish characters. And IE doesn't support on the file name that is why returning an empty html file.
I have replaced all TR characters to English Characters.
public static void ReplaceTurkishCharsToEnglish(String str){
    str = str.replace("ğ", "g");
    str = str.replace("Ğ", "G");
    str = str.replace("İ", "I");
    str = str.replace("ı", "i");
    str = str.replace("ü", "u");
    str = str.replace("Ü", "U");
    str = str.replace("ö", "o");
    str = str.replace("Ö", "O");
    str = str.replace("ş", "s");
    str = str.replace("Ş", "S");
    str = str.replace("ç", "c");
    str = str.replace("Ç", "C");
}


text:
Q: Let X be a set and let $ \tau_1 $ and $ \tau_2 $ topologies over X. Show that if (X, $ \tau_1 $) e (X, $ \tau_2 $) are compact Hausdorff spaces... i)Let X be a set and let $ \tau_1 $ and $ \tau_2 $ topologies over X. Show that if (X, $ \tau_1 $) e (X, $ \tau_2 $) are compact Hausdorff spaces, then $ \tau_1 $ = $ \tau_2 $ or $ \tau_1 $ and $ \tau_2 $ are incomparable.
ii) Let {$ X_i: i \in I $} be a family of compact Hausdorff spaces . Show that $ \sigma $ is a topology over the set $ \prod_ {i \in I} X_i $ that makes all projections and ($\prod_ {i \in I} X_i, \sigma $) is compact, so $ \sigma $ matches the product topology on $ \prod_ {i \in I} X_i $.

My attempt at i) went like this
Assume that $\tau_1 \subset \tau_2$. Then the identity map: (X,$\tau_2$)→(X,$\tau_1$)is continuous. Let C be closed in $\tau_2$, so, X\C $\in \tau_2$. Since $\tau_2$ is compact,C is compact as a subspace of $\tau_2$. Because continuous maps map compact sets to compact sets, C is also compact as a subspace of $\tau_1$. But $\tau_1$ is Hausdorff, so this means that C is closed in $\tau_1$. We showed that every closed set in $\tau_2$ is closed in $\tau_1$, so $\tau_2 \subset \tau_1$ and therefore $\tau_1 =\tau_2$.
Similarly if we instead assume $\tau_2 \subset \tau_1$, the same argument also shows $\tau_1 =\tau_2$.
I'm having bigger troubles with ii)
Thanks in advance for any help.

A: Well, in order to apply $i)$, you just need to show that $\sigma$ is Hausdorff (the product topology is compact by Tychonoff).
We just want to prove that if all the projections are continuous and each $X_i$ is Hausdorff, then $\sigma$ is Hausdorff.
Indeed, let $x\neq y\in \prod_{i\in I} X_i$ and fix some $j$ such that $x_j\neq y_j$. Since $X_j$ is Hausdorff, there exist open sets $U,V\subseteq X_j$ such that $U\cap V$ is empty and $x_j\in U$ and $y_j\in V$. Now, let $\pi_j:\prod_{i\in I}X_i\to X_j$ denote the corresponding projection. Then, $\pi_j^{-1}(U)\cap \pi_j^{-1}(V)=\emptyset$ and by continuity of $\pi_j$, both of these sets are open. Furthermore, clearly $x\in \pi_j^{-1}(U)$ and $y\in \pi_j^{-1}(V)$. Thus, $\sigma$ is Hausdorff.


text:
Q: How to popup an activity in Android? I am working with chat application. I have developed a grid layout for smileys.
I have two activities A and B.
A is for chat window with smiley button and B for smileys grid layout. Activity B has some to generate a layout of smileys.
I want to popup an activity B when user presses smiley button in A.
How to achieve this??

A: Edit you manifest file with:
<activity android:theme="@android:style/Theme.Dialog">

A: If i have got your problem then You can create layout with smiley image statically and call in Activity B and use in Activity A.

A: You can create a simple activity and for it's design, create a layout that is not full screen layout:
Then add this Activity in the manifest file and add this theme to it:
android:theme="@android:style/Theme.Translucent.NoTitleBar"

And then you can add a blur effect to the surrounding of this Activity by adding this in onCreate of this Activity:
getWindow().setFlags(WindowManager.LayoutParams.FLAG_BLUR_BEHIND, WindowManager.LayoutParams.FLAG_BLUR_BEHIND);


text:
Q: POST Nest API to get access token with ESP8266 or Arduino I am intending to POST Nest API to get the access token with ESP8266 or Arduino.
I read  carefully https://developers.nest.com/guides/api/how-to-auth#test_for_csrf_attacks  and  Calling nest api with esp8266 using arduinoEDK
I tried to POST api.home.nest.com wth  with  URL:/oauth2/access_token  but don't know what port to: I tried  80, 9553 and 443 with no success.

A: Nest runs its API over HTTPS, which uses port 443. Even if they allowed port 80 you should not use that; you'd be transmitting your credentials or API token unencrypted, which is dangerous.
If your code is running on an ESP8266 be sure to use an SSL library. It's not enough to just speak the HTTP protocol to port 443.
You didn't share any code so I can't advise further, but consider using the BearSSL::WiFiClientSecure class for your connection.
There's a good example of this at
https://github.com/esp8266/Arduino/blob/master/libraries/ESP8266HTTPClient/examples/BasicHttpsClient/BasicHttpsClient.ino
You'll need to know the SSL fingerprint for the Nest server. You can find this by running
openssl s_client -connect api.home.nest.com:443 < /dev/null 2>/dev/null | openssl x509 -fingerprint -noout | cut -d'=' -f2

in a terminal window on a Mac or Linux computer. The fingerprint allows your client to confirm that the server is who it claims to be.
As I write this, the fingerprint is currently:
DE:AA:EB:EE:C0:4B:14:97:27:C8:29:46:5C:05:44:2C:26:DE:55:6B

Be aware that this can change with time (or even depending on the specific server which handles your request), so you may need to change it. You can find the line that calls client->setFingerprint() in the example at the link above; that's where you'd use server fingerprint.


text:
Q: Skip an iteration in ModelBuilder? I am trying to iterate through some feature classes, named "Hos_AllPatients2014", and select the certain data and name it "Hos_IP", then export it to the corresponding folder "Hos". I have already made folders for each "Hos" that contain another layer I had to make for each. However, there are some "AllPatients2014" feature classes for which I do not have a folder. I thought I deleted them all out, but found out halfway through my model running that it had an error and stopped. I would have liked to have had the model contain a portion to check if "Hos_IP" already exists, and if so move on to the next iteration. Instead, I had to create a new folder with the remaining "AllPatients2014" and started the model again.
I would like to find out how to get the model to make this check for a feature class and skip to the next iteration if it exists. I would also be interested to figure out if the folder for "Hos" exists, and if not, create a folder for it and go ahead and export the data like the rest.
I don't know how helpful a picture of my model will be, but it is included. Also open to hearing how I can refine the whole thing.

A: You can implement if-then-else logic with Branching
http://resources.esri.com/help/9.3/arcgisdesktop/com/gp_toolref/automating_your_work_with_models/branching_colon_implementing_if_then_else_logic.htm


text:
Q: How to look for values based on case insensitive keys in HashMap using Javascript I have below logic where I have passed an JSON object and an HashMap :-
export const modifyKeys = (obj: { [x: string]: any; }, myMap: any) => {
    Object.keys(obj).forEach(key => {
        if (myMap !== undefined) {
            if (myMap.has(key)) {
                var fieldName = myMap.get(key);
                //console.log('Field Name::', fieldName);
                obj[fieldName] = obj[key];
                delete obj[key];
                if (typeof obj[fieldName] === "object") {
                    modifyKeys(obj[fieldName], myMap);
                }
            }else{
                delete obj[key];
            }
        }
    });
}

My map contains key-value and in this JSON object, I will look for corresponding attributes to match with the key and perform some operations like replacing that attribute by the value of HashMap and if no match found then delete that attribute itself from the JSON object. But the problem is right now the key has to be case-sensitive because of which some data gets skipped. I want to consider the case-insensitive during the match. For instance, for JSON object like this
{
 firstName: 'Vinod',
 LastName: 'Kumar'
}

and with Map containing the key-value as FirstName-f_name, the match should happened and final object should become like this
{
 f_name: 'Vinod',
 LastName: 'Kumar'
}

Any suggestion guys, thanks

A: Had to loop through keys in myMap... but the following should work providing you dont have any keys whose only difference is case...   Basically just created normalized keys by using .toLowerCase();

export const modifyKeys = (obj: {[x: string]: any;}, myMap: any) => {
  Object.keys(obj).forEach(key => {
    var normalizedKey = key.toLowerCase();
    if (myMap !== undefined) {
      var mapKeys = Object.keys(myMap);
      var keyFound = false;
      for (var index = 0; index < mapKeys.length && !keyFound; index++) {
        var mapKey = mapKeys[index];
        var normalizedMapKey = mapKey.toLowerCase();
        if (normalizedMapKey == normalizedKey) {
          var fieldName = myMap[mapKey];
          obj[fieldName] = obj[key];
          delete obj[key];
          if (typeof obj[fieldName] === 'object') {
            modifyKeys(obj[fieldName], myMap);
          }
          keyFound = true;
        }
      }
      if (!keyFound) {
        delete obj[key];
      }
    }
  });
}


text:
Q: iOS safari overflow-y cut on modal After hours of searching the community i haven't been able to solve my problem.
Im currently building a horizontal scroll div with several modals. When i make overflow-x scroll work, it works fine on all devices except iOS Safari.
This is my code:
Markup

card content

card content

Style
#parent {
overflow-y: hidden;
}

#scroll {
overflow-x: auto;
min-width: 100vw;
-webkit-overflow-scrolling: touch;
}

#card {
width: 222px;
height: 360px;
}

when click a card it activates a modal which is supposed to be full width and height. Works fine on Chrome and firefox but it gets cutout on safari mobile.
References:
Screenshot iOS Screenshot Android


text:
Q: Sqlite database locked issue in iOS I am opening and closing db properly. But still when i try to insert record in table, it is giving database locked error. Please suggest what to do.
-(void)insertInDatabase:(NSMutableDictionary *) dict
{

    NSArray *dbPath = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory,    NSUserDomainMask, YES);
    NSString *documentsDirectory = [dbPath objectAtIndex:0];
    NSString *DBPath=[documentsDirectory stringByAppendingPathComponent:@"InvoiceScannerDB.sqlite"];
    AppDelegate *appDelegate = (AppDelegate *)[[UIApplication sharedApplication] delegate];
    [appDelegate checkAndCreateDatabase: DBPath];

    sqlite3 * database;

    if(sqlite3_open([DBPath UTF8String], &database) == SQLITE_OK){
//      NSLog(@"open");
        NSString *sql = [[NSString alloc] initWithFormat:@"select *  from Ticket where DELIVERY_SEQ='%@'and DOC_DATE='%@' and ROUTE_CODE='%@'", [dict valueForKey:@"DELIVERY_SEQ"],[dict valueForKey:@"DOC_DATE"],[dict valueForKey:@"ROUTE_CODE"]];

        sqlite3_stmt *statement, *statement1, *statement2;

        if(sqlite3_prepare_v2(database, [sql UTF8String], -1, &statement, NULL) == SQLITE_OK){

            NSLog(@"sqlite3_prepare_v2: %s", sqlite3_errmsg(database));

                //  NSLog(@"Statement %@",statement);
            if(sqlite3_step(statement) == SQLITE_ROW){
                NSLog(@"statement: %s", sqlite3_errmsg(database));

                    // Update Ticket for total scan count
                NSLog(@"Same record found in  local db");
                NSString *sqlUpdate = [[NSString alloc] initWithFormat:@"update Ticket set SCAN_INVOICE = '%ld' where DELIVERY_SEQ='%@'and DOC_DATE='%@' and ROUTE_CODE='%@'", (long)[[dict valueForKey:@"SCAN_INVOICE"] integerValue], [dict valueForKey:@"DELIVERY_SEQ"], [dict valueForKey:@"DOC_DATE"], [dict valueForKey:@"ROUTE_CODE"]];
                if(sqlite3_prepare_v2(database, [sqlUpdate UTF8String], -1, &statement2, NULL) == SQLITE_OK){

                    sqlite3_step(statement2);
                        //                  NSLog(@"Scan count updated successfully");

                }
                else{
                    NSLog(@"Not updated data");
                }
                sqlite3_finalize(statement2);
            }
            else {
                    // Insert
                NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init];
                dateFormatter.locale = [[NSLocale alloc] initWithLocaleIdentifier:@"en_US"];
                [dateFormatter setDateFormat:@"dd-MMM-yyyy"];
                NSString *newDateString = [dateFormatter stringFromDate:[NSDate date]];

                NSString *sqlInsert = [[NSString alloc] initWithFormat:@"insert into Ticket (DELIVERY_SEQ, DOC_DATE, ROUTE_CODE, TOTAL_INVOICE, SCAN_INVOICE, InsertedDate) values('%@','%@', '%@','%ld','%ld', '%@')", [dict valueForKey:@"DELIVERY_SEQ"], [dict valueForKey:@"DOC_DATE"], [dict valueForKey:@"ROUTE_CODE"], (long)[[dict valueForKey:@"TOTAL_INVOICE"] integerValue], (long)[[dict valueForKey:@"SCAN_INVOICE"] integerValue], newDateString];

                NSLog(@"Insertion Query %@", sqlInsert);

                if(sqlite3_prepare_v2(database, [sqlInsert UTF8String], -1, &statement1, NULL) == SQLITE_OK){

                    if(sqlite3_step(statement1) == SQLITE_DONE)
                    {

                    } else {
                        NSLog(@"error: %s", sqlite3_errmsg(database));
                    }
                }
                else{
                        NSLog(@"Not inserted data");
                }
                sqlite3_finalize(statement1);
            }
        }
        else{
            NSLog(@"COULD NOT OPEN DB");
        }
        sqlite3_finalize(statement);
    }
    sqlite3_close(database);

}

Kindly help me on this Issue

A: You are executing statement1 and statement2 before you finalize the original statement. You should close this first SELECT statement that tests to see if there are any rows of data before you try to do the INSERT or UPDATE. That might not be the actual source of the busy database error, but it's a wonderful illustration of how easy it is to accidentally (and unnecessarily) perform two SQL statements at the same time.
If fixing this does not remove the error, then you must have some other code that is locking the database. I know that you assured us that you've checked all of the open and close statements and that you don't have any multithreaded database interaction, but the "busy" message means that the database is simply busy doing something else, so you have to figure out what is doing this.
If the problem persists, I might suggest centralizing the opening/closing of the database (that way, it's easy to insert a "is it already open" check). Frankly, I might go a step further and eliminate the process of opening and closing the database for every database interaction, but that's up to you.


text:
Q: net::ERR_NAME_NOT_RESOLVED on dynamic script load I am trying to load a script (from the same origin!) during run time (on button click), but for a strange reason I get in the console the error: net::ERR_NAME_NOT_RESOLVED
The example is in this link: https://www.crazygao.com/ef4/tst.htm
By clicking the text area, a call is initialized to load a form - this one though using the same dynamic script loading, for some strange reason succeed.
When clicking on the "+" to add item inside the combo box, the error will be triggered - the requested script will fail to load.
Note the way I am doing the calls:
// Call to external function in a script:
_.Run=function(p) {
    if(_.xT(p)=="S") p={f:p}; // If the call is string, it will convert it to function name
    if(!window[p.f]) { // If the function not exists in global scope, need to look for the JS file to request it.
        _.xR("/"+p.x||p.f,function() { _.Run(p); }); // Dynamic loader
    }
    else { window[p.f](p.v); } // Run the function
}

// Short hand for loading script on runtime:
_.xR=function(p,f,a) {
    var r=_.xM("script"); // I am creating new <script> tag
    _.xW(r,"charset","UTF-8"); // I set attribute "charset" to "UTF-8"
    r.src=p; // I set the source
    // "a" is not relevant for here - I cut it off
    document.head.appendChild(r); // I append to document head
}

// Short hand for creating new element and appending it to the DOM
_.xM=function(t,i,r,s,c,u) {
    t=document.createElement(t);
    if(t.nodeName=="IMG") t.ondragstart=function(e) { e.preventDefault(); }
    if(i) t.id=i;
    if(r) _.xI(r).insertBefore(t,u);
    /* Unnecessary data I cut off */
    return t;
}

// Short hand for getting element by ID
_.xI=function(e,c) {
    if(_.xT(e)=="S") e=document.getElementById(e); return (e||c)?e:document.body;
}

// Short hand for getting type of variable
_.xT=function(e) {
    if(e instanceof Array) return "A";
    if(e instanceof ML) return "L";
    if(e instanceof Date) return "D";
    if(e instanceof FF) return "F";
    if(e instanceof _.P) return "P";
    if(e instanceof _.C) return "C";
    if(e instanceof Image) return "I";
    if(typeof e==="number"&&!isNaN(e)) return "N";
    if(typeof e==="string") return "S";
    if(typeof e==="boolean") return "B";
    if(typeof e==="function") return "Q";
    return e?"O":null;
}

// Short hand for setting or removing attribute
_.xW=function(c,n,v,s) {
    return s?_.xW(c,n,_.xW(c,n,"~")?0:v):c[(v?(v=="~"?"get":"set"):"remove")+"Attribute"](n,v);
}

I don't believe I have any mistake in the "shortcuts", as they are working for other scripts that been loaded (can see in the example link).
In the server nothing is blocking, as the same directory is read by the same script and succeed to download (in the example link: ML.js succeed, Lang.js fail)
Thanks a lot for the help

A: Yes: Seems that the root cause of the problem is not missing "/", but repeating preceding "/" causing "https:////ef4/Lang.js" -> The browser perhaps treat this as "https://ef4/Lang.js" - hence a mistake...
Problem Solved:)


text:
Q: web audio API and filter coefficients I'm learning to use the web audio api to synthesize and process sound. I see there's a BiquadFilterNode class I can use, but it only allows to specify one of the filter types defined ("lowpass",   "highpass", "bandpass", "lowshelf", "highshelf", "peaking", "notch", "allpass") and control it through the meta parameters of such filters: Q, gain and center-frequency.
Is there a way to specify the actual coefficients of the digital filter? In other words, for a filter of the form:
       b_0 + b_1*z^(-1) + b_2*z^(-2)
H(z) = -----------------------------
       1 + a_1*z^(-1) + a_2*z^(-2)

can I somehow directly specify the values of b_0, b_1, b_2, a_1, a_2?
I ask because although the predefined filter types are very handy, they don't necessarily cover all the use cases. By specifying the coefficients it would be possible to implement first-order filters, parametric sections, etc.

A: This isn't possible.  There's a proposal for an entirely separate DSP API in the WG, but it's not completely baked yet.

A: It's not currently possible, but is a simple API to add.
At the least, it's clear we need to add support for 1st-order filters.


text:
Q: Entity Framework 4.3.1 Migrations - enable automatic migration and creating a new database in the same time I have played with Entity Framework 4.3 migrations for some time now, but I have trouble achieving the next behavior: In case my code runs on an existing database, I want the database to be migrated automatically to the latest version, but in case the database doesn't exist, the database should be created automatically from the migrations.
I think the problems is related to the first migration that you create. If you create the first migration using -IgnoreChanges parameter (or manually delete them as explained here: http://thedatafarm.com/blog/data-access/using-ef-migrations-with-an-existing-database/), you will not be able to use migrations in order to create a new table using the DbMigrator class. because you don't have the initial migration. If you create the first migration without using -IgnoreChanges, than the migration of the existing database will not be possible. Does anybody has any solution for this problem?

A: So you have existing database and you want to use migrations on that database and in the same time you want to support database creation by migrations in case of new deployment?
It looks like little bit unsupported use case. The simplest in this case (not tested) would be either conditional compilation or conditional migration driven by some AppSettings key. It means creating initial migration as if you don't have the database and modify Up method to:
public override void Up() {
    if (ConfigurationManager.AppSettings["NewDatabaseRequired"] == "true") {
        // Here is generated content
    }
}

or
public override void Up() {
#if NewDatabaseRequired
    // Here is generated content
#endif
}

There is plenty of other  more complicated options including scripting your current database, modify the script to end if tables already exist, add a script as a resource to your migration assembly and execute the script in the Up method generated with -IgnoreChanges.
As another option you can open additional database connection and check if tables from migration already exists (by querying sys.tables view in SQL Server). This will not need generated script.


text:
Q: form effect - smoothly highlight even when you move the mouse away hi someone know how to make this form effect: http://www.clouddigitalmedia.co.uk/contact-us When you click the form field, it will smoothly highlight even when you move the mouse away from the field, unless you hit the click button outside the box.
I'm not sure if this is a CSS3 thing, or maybe there is a jQuery for this.

A: They are using the pseudo-class of :focus. This basically says that if the mouse has the text blinker inside of it, then apply the styles. Here is an example
input{
 /*Transition Properties*/
}
input:focus{
  border:2px solid blue;
}

http://jsfiddle.net/dZ4Jh/2/


text:
Q: Apache Site Aliases & WordPress Multisite I'm attempting to allow users to access the same multisite content on a sub-site by using both www.example.com as well as www.example.org.
Upon initial setup, I simply redirected all allowed hosts / server aliases (e.g. www.example.org) to the Server Name entry (e.g. www.example.com). This worked fine for the last few months.
However, I was recently approached by the client who is requesting the requested domain remain in the browser's address bar (a simple redirect from an Apache no longer fulfills client requirements). They are in the non-profit sector and the .org extension is important to them.
With single-site setups, I'd usually use update_option('siteUrl', $_SERVER['SERVER_NAME']) to achieve this functionality. However, with a multisite, my research suggests that those hooks do not work the same way.
What is the secret to doing this? I find it hard to believe we can't have a similar functionality in the multisite world.


text:
Q: exec terminate command by the space in single quotes I have a simple bash script goes like
#!/bin/bash
set -e
SPARK_CONF="--master ... \
...
--conf spark.driver.extraJavaOptions='-verbose:gc -XX:+PrintGCDetails -XX:+PrintGCDateStamps' \
--conf ...."
SPARK_CMD="spark-submit $SPARK_CONF"
echo $SPARK_CMD
exec $SPARK_CMD

I'll get an error
Error: Unrecognized option: -XX:+PrintGCDetails

I can see that I print the whole command before exec it, so I copied the printed command, and paste in my shell then I found it can be executed successfully.
I tried to replace the single quote with \" but still the same error.
Also, if I replace exec with eval, it will also work. I googled around the difference between them, but didn't found why exec will terminate inside the quotes...
I just want to understand why exec fail in this case.
Update:
According to https://unix.stackexchange.com/a/444949/524235, I changed my related part to
set -e -x

SPARK_CONF="--master ... \
...
--conf spark.driver.extraJavaOptions='-verbose:gc -XX:+PrintGCDetails -XX:+PrintGCDateStamps' \
--conf ...."
SPARK_CMD=($SPARK_HOME/bin/spark-submit $SPARK_CONF)
"${SPARK_CMD[@]}"

It's still failing with the same error message mentioned above, but I can see the executed command becomes:
.../bin/spark-submit ...
--conf 'spark.driver.extraJavaOptions='\''-verbose:gc' -XX:+PrintGCDetails '-XX:+PrintGCDateStamps'\'''
...

I can see there're some extra single quotes and backslash added into the command, how can I progress now?


text:
Q: Dynamically creating a series of oscillators that play with keyup/down The problem is this:
In the following example, http://jsfiddle.net/GmgGY/2/
when you click on the orange button it creates a new div. When you click on this div it plays an oscillator. If you push a key on the keyboard (keydown) it plays it as well. It then stops playing it when the keyboard character is lifted (keyup). This is good and what I want.
However, when you click the orange button multiple times and create multiple synths. When you push a key on the keyboard all of them play (which is what I want) but only the last created one seems to respond to the keyup event.I want all of them to respond to the keyup event.Not just the last one.
I am not sure how to fix this.
Each dynamically created div has a unique ID but also a class that is universal to all of them. I thought there might be a way to select the class (  synth.class) and launch a universal oscillator.disconnect() on keyup ???
Another thing I'm thinking is my problem might need some kind of iterating thread that compensates for whatever DOM issue is causing this (assuming it isn't just exclusively the programming thus far). But I am not sure.
The Javascript code is below. I tried to keep it as minimal as possible but I couldn't figure out how to make it any smaller than this and still have it be clear. I omitted the html and css elements but kept them in the JSfiddle example.
$(function(){

var SynthCreationModule = (function(){
context = new webkitAudioContext();
var orangeButton;
var applicationArea = document.getElementById("applicationArea"),
orangeButton = document.getElementById("orangeButton"),
counterSynth = 1;
counterPitchInput = 1;
orangeButton.addEventListener("click",createSynth, false);

function createSynth () {
  var synth = document.createElement("div");
  synth.className  = "synth";
  synth.id = "synthid" + (counterSynth++);
  applicationArea.appendChild(synth);
  var pitchInput = document.createElement('input');
  pitchInput.type = "range";
  pitchInput.className  = "pitchInputClass";
  pitchInput.id = "pitchInput" + (counterPitchInput++);
  pitchInput.min = "0";
  pitchInput.max="2000";
  synth.appendChild(pitchInput);

synth.onmousedown= function () {
   oscillator = context.createOscillator(),
   oscillator.type = 2;
   oscillator.frequency.value = pitchInput.value;
   oscillator.connect(context.destination);
   oscillator.noteOn(0);

};

synth.onmouseup = function ()    {
oscillator.disconnect();

};

// Keydown & keyup events to launch oscillator. ( These don't work properly if you create two or more synths. Playing a key down works, but keyup only works on the last created synth. The previous created synths will continue to create additional oscillators but the keydown will not work to stop them.

var keydown = false;

$('body').keydown(function() {
    if(!keydown){
        synth.onmousedown();
        keydown = true;
    }
});

$('body').keyup(function() {
    synth.onmouseup();
    keydown = false;
});

$(synth).draggable();

};

}());

});

A: Your problem is actually that you never explicitly declare and scope "oscillator" - so it's going into globals.  Try putting "this." in front of each occurrence of "oscillator", and it will work.
This isn't ideal code, though, because you're attaching a whole extra body event handler for each synth - your code
$('body').keydown(function() {
    if(!keydown){
        synth.onmousedown();
        keydown = true;
    }
});

is creating a whole separate function call and calling attachEventHandler on the body under the hood, with "synth" bound to the new version; it might be better to track the list of synths (even getting them back from a body.getElementsBySelector()) and calling noteOn/Off on each one.  Up to you, though.


text:
Q: show unity launcher links in dash I have added a couple of links to the unity launcher dragging .desktop files to it
I save them in ~/.local/application and then drag them to the unity launcher
But when I call the dash (win key) they don't appear in it...
all I get it the myapp.desktop file...
Is there some way that they can show up in the dash?

A: I found the problem...
I had my .desktop files in ~/.local/application, and they should be in ~/.local/share/applications
I just dragged them to the unity launcher and now I have them available at the dash


text:
Q: How to collapse methods in the NetBeans files by default? How can collapse methods in files by default? for example Java files.
When opening the file I found methods expanded.
So I want to make them collapsed by default.
Is there a feature in NetBeans to do that?

A: You can collapse it by using the keymap:
i.e.
The default is CTRL+SHIFT+-.
But you can adjust this in Tools->Options->Keymap.
they stay like that if you reopen the file.


text:
Q: Transparent proxy with CA-Signed certificates Is this possible?
My understanding goes as far as this:
A non-proxy aware client will negotiate SSL directly with a listener, without every sending a CONNECT request to identify the destination host. A transparent proxy would need a destination host in order to forge a certificate with the hostname for the client.
I've read that some browser support the "server_name" extension in the client hello message which will identify the destination host and that if the extension is present this can be done. However, I'm unaware which browsers if any support this extension.
I would think that this should be possible but my efforts so far using squid and burp haven't been successful.
I understand that there's no way to obtain the destination host in the initial connection phase but I would think that with the correct configuration it would be possible to allow a forwarded connection in the initial phase then capture the returned certificate in order to read the destination then be able to inject the proxy's own CA-signed certificate at this point with the hostname derived from the legitimate certificate.
I think the best bet to get this working (if it's at all possible) is using squid's bump-server-first method http://wiki.squid-cache.org/Features/BumpSslServerFirst
I'm interested to hear if anyone has ever successfully gotten this to work.


text:
Q: Cannot convert from float to int I have some code like this:
void drawPlot()
{
    String[] dataItemPrices = loadStrings("itemPrices.csv");  //load in .csv file, store as string array
    itemName = new String[dataItemPrices.length-1];
    itemPrice = new float[dataItemPrices.length-1];

    for (int i=0; i<dataItemPrices.length-1; i++)
    {
        //split array to consider commas
        String[] tokensItemPrices = dataItemPrices[i+1].split(",");
        itemName[i] = tokensItemPrices[0];
        itemPrice[i] = Float.parseFloat(tokensItemPrices[1]);

        dataMin = min(dataMin,itemPrice[i]);
        dataMax = max(dataMax,itemPrice[i]);

        itemPriceScaled = new float[map(itemPrice[i], dataMin, dataMax,
                                        0, (height-100))];
    }
}

The last line of code is causing problems, when I compile I get "cannot convert from float to int".
The only int is the [i] but that's used to access an array, it can't be that can it? Otherwise how can I access the array?
Help please!
Thanks!

A: There are a few possible alternatives:

*

*You are creating a new float array and you need an int size for it, does map return a float? If this is the case, map could need major modifications.

*What kind of parameters does map need?  itemPrice[i], dataMin and dataMax are all floats(height could be too), is this correct? In this case, a cast to (int) could be enough or your function prototype needs to be fixed...
Please add the code for map and all variables declarations to your question.
Edit:
After your comment and looking at your code, maybe this is what you want to do: populating an array with prices (taken from the itemPrice array) "scaled" using map that has obviously the same size as the other two arrays:
void drawPlot()
{
    String[] dataItemPrices = loadStrings("itemPrices.csv");  //load in .csv file, store as string array
    itemName = new String[dataItemPrices.length-1];
    itemPrice = new float[dataItemPrices.length-1];
    itemPriceScaled = new float[dataItemPrices.length-1]; // <<<<<Added

    for (int i=0; i<dataItemPrices.length-1; i++)
    {
        //split array to consider commas
        String[] tokensItemPrices = dataItemPrices[i+1].split(",");
        itemName[i] = tokensItemPrices[0];
        itemPrice[i] = Float.parseFloat(tokensItemPrices[1]);

        dataMin = min(dataMin,itemPrice[i]);
        dataMax = max(dataMax,itemPrice[i]);

        itemPriceScaled[i] = map(itemPrice[i], dataMin, dataMax,
                                        0, (height-100)); //<<<Modified
    }
}


text:
Q: Converting greek utf letters to latex symbols I have a collection of notes on my iPad, written using a markdown editor/viewer (trunk notes) that does not understand latex, but does display greek. Is there a simple way to convert the greek letters (e.g. convert the UTF-8 symbol 0xCEB1, α) to their latex equivalents (\alpha)? I am using pandoc for the conversion, which is pasting a LaTeX header onto the output before conversion to TeX or ConTeXt.

A: In ConTeXt (both MkIV and MkII with utf-8 encoding), Greek letters work out of the box in text and math mode. (You need a text font with Greek letters)
\starttext
α $α$
\stoptext

With MkIV, Unicode characters behave like ASCII characters, so $\hat α$ is same as $\hat {α}$. In MkII, you need to use the latter form.

A: I use the following code to make unicode symbols work both as normal text and in mathmode. But then xelatex is needed to compile it:
\usepackage{fontspec}
\setmainfont[Ligatures=TeX]{STIXGeneral}

\def\textalpha{α} \catcode`\α=\active \defα{\relax\ifmmode \alpha \else \textalpha \fi}

Also you need some suitable font, STIX works for me.
If you want to actually replace the unicode characters in the source code, that is a different issue. I don't know what kind of tools are available in your environment. I would compile a list of replacements like α \alpha and then write a small script that executes those in order. E.g. there is the replace utility on linux which does one such replacement.

A: Expanding Canaaerus answer In xelatex, package unicode-math allows you to use greek characters in math-mode. Check the following minimum example.
\documentclass{article}

% font selection for normal text
\usepackage{fontspec}

% Packages needed for mathematics
\usepackage{amsmath}
\usepackage{unicode-math}

% Fonts
\setmainfont[Mapping=tex-text]{Linux Libertine O}
\setmathfont{XITS Math}

\begin{document}

\begin{equation}
    a = α + b + β^2_i
\end{equation}

\end{document}

For more info (in greek) look here
Fonts
The fonts that you may use are the following ones (they must be installed in your OS' standard font folder)

*

*Asana-Math. Free font created by Apostolos Syropoulos.

*Stix

*Xits, fork of Stix

*Neo Euler

*Latin Modern Math, OpenType version of the classic TeX font.

*Cambria Math. Proprietary font, distributed with Microsoft software (e.g. MS Office)

Edit
Note though that a and \alpha are different symbols! If you want to convert α to athen the previous approach cannot be used. If that is what you need, then it shouldn't be too difficult to write a script (e.g. in perl or python) that would parse your notes and make the replacements.


text:
Q: Get registered user's country or IP i am very beginner to WP, so excuse me
Q1: does WP be default stores user's country/IP address ?
Q2: how can i know the country/city or IP of each registered user?
it will be nice if this can be shown in /wp-admin/users.php page list, or even if its a DB query that i can run and see the results. I checked many articles and plugins, most of them gives you results for the the visitors nothing for the registered users
Your help is highly appreciated. thnx

A: You can't know the country / IP / etc. of any user:

*

*the admin could create any number of users, and before each of those users log in, there is no way for WP to know their IP

*even after an user logs in, you can't be sure he/she would log in from the same IP or even city, country, etc. each time

What you could see is the last IP that an user used to log in. A good plugin for that (and lots of other useful security functions) would be WordFence. In the dashboard, you can see the last logins from your users, with username, IP and date:


text:
Q: Get active image URL in slide show I have bellow slide show
SlideShow
SlideShow
I have a button and i want when i click that button get the currently showing image URL and use it for my projects.
but i don't know how to get that URL.
any suggestion ?


text:
Q: how to change time name every 5 minutes I made a whatsapp bot using Baileys and made a werewolf game feature, I want the time to change every 5 minutes from morning to night then morning again like a loop until the winner is determined. I use setInterval but it causes spam
I also used Node Corn and the result is the same
the all_room json db
[
{
"code":"FJ32Q",
"group_id":"6288742689173-1610938001@g.us",
"time":"morning",
"night":0,
"status":"starting",
"vote":false
}
]

getTime (function to get time from db)
const getTime = (group) => {
let alldb = JSON.parse(fs.readFileSync('./database/ww/all_room.json'))
satu = alldb.find((obj => obj.group_id == `${group}`));
return satu.time
}

set_time (functon to change value)
const set_time = (times, group) => {
let alldb = JSON.parse(fs.readFileSync('./database/ww/all_room.json'))
satu = alldb.findIndex((obj => obj.group_id == `${group}`));
alldb[satu].time = times
fs.writeFileSync('./database/ww/all_room.json', JSON.stringify(alldb))
}

if(isWS(group.id)){ // true
  setInterval(() => {
    if(getTime() === "morning") {
      set_time("night")
      reply("the sun is setting be careful because the werewolves are starting to roam")
    } else if(getTime() === "night") {
      set_time("morning")
      reply("the sun has risen")
    }
  }, 300000);
}

Result
this is even spam


text:
Q: Adding Headers to Dataframe in R I have a script written in R that is ran weekly and produces a csv. I need to add headers over top of some of the column names as they are grouped together.
Header1 Header2
A  B  C  D E F
1  2  3  4 5 6
7  8  9  a b c

In this example ABC columns are under the "Header1" header, and DEF are under the "Header2" header. Obviously this can be done manually but I was curious if there was a package that can do this. "No" is an acceptable answer.
EDIT: should of added that the file can also be a xlsx. Initially I write off most of my files as CSVs since they usually get used by a script again at some point.

A: It is a bit ugly but you can do on a csv as long as you do not require any merging of cells. I used data.table in my example, but I am pretty sure you can use any other writing function as long as you write the headers with append = FALSE and col.names = FALSE and the data both with TRUE. Reading it back gets a bit ugly but you can skip the first row.
dt <- fread("A  B  C  D E F
1  2  3  4 5 6
7  8  9  a b c")

fwrite(data.table(t(c("Header1", NA, NA, "Header2", NA, NA))), "test.csv", append = FALSE, col.names = FALSE)
fwrite(dt, "test.csv", append = TRUE, col.names = TRUE)

fread("test.csv")
#         V1 V2 V3      V4 V5 V6
# 1: Header1       Header2
# 2:       A  B  C       D  E  F
# 3:       1  2  3       4  5  6
# 4:       7  8  9       a  b  c

fread("test.csv", skip = 1L)
#    A B C D E F
# 1: 1 2 3 4 5 6
# 2: 7 8 9 a b c

If you happen to want your header information back you can do something like this. Read the first line, find the positions of the headers and find the headers itself.
headers <- strsplit(readLines("test.csv", n = 1L), ",")[[1]]

which(headers != "")
# [1] 1 4

headers[which(headers != "")]
# [1] "Header1" "Header2"


text:
Q: E901, or TokenError: EOF in multi-line statement on repl.it I have been coding on a website called https://repl.it.
PEP8 is returning an error at the last line:
E901, or TokenError: EOF in multi-line statement`.

I've tried rewriting the section, redoing the indents, and renaming variables.
-EDIT-
I've checked the indentations and if statements, so here is the new code. Its still pulling up the same issues. Note that I am not very good at code and probably won't understand what you mean right of the bat. I will also try to add comments into the code.
from random import randint
from time import sleep
advList = ["Crawl", "Walk", "Run", "Sprint"]
atkList = ["[A] Punch", "[B] Kick", "[C] Magic"]
restart = 1
myHp = 50
zomHp = 50
battle = 50

#Game Over Screen
if myHp <= 0:
    print("YOU DIED")
    print("GAME OVER")
    quit()

#Endless Game Function
for i in range(0, reset):

    #Traveling Loop
    while battle > 5:
        print(advList)
        trv = str(input("How would you like to advance?"))

        if trv == advList[0]:
            sleep(8)
            myHp = myHp + 10
            battle = randint(0, 40)
        if trv == advList[1]:
            sleep(4)
            myHp = myHp + 5
            battle = randint(0, 30)
        if trv == advList[2]:
            sleep(2)
            myHp = myHp + 2
            battle = randint(0, 20)

        if trv == advList[3]:
            sleep(1)
            myHp = myHp + 1
            battle = randint(0, 10)

#Max Health Cap
        if myHp >= 50:
            myHp = 50
        print("My Hp: ", myHp)
        print('')

#Battle Sequence
    if battle <= 5:
        print ("A zombie  approaches!!!")
        sleep(1)
        while battle <= 5:
            print (atkList)
            atk = str(input("How do you attack?"))
            #Randomizes Hit Chance
            khit = randint(0, 2)
            phit = randint(0, 1)
            mhit = randint(0, 5)
            zhit = randint(0, 4)
#Kick Attack
            if atk == "B":
                dmg = randint(1, 25)
                if khit != 1:
                    print ("Your Attack Missed...")

                if khit == 1:
                    zomHp = zomHp - dmg
                    print (("The Attack Hits for %s damage") %(dmg))
#Punch Attack
            if atk == "A":
                dmg = randint(1, 10)
                if phit == 0:
                    print ("Your Attack Missed...")

                if phit == 1:
                    zomHp = zomHp - dmg
                    print (("The Attack Hits for %s damage") %(dmg))
#Magic Attack
            if atk == "C":
                dmg = randint(1, 50)
                if mhit != 0:
                    print ("Your Attack Missed...")

                if mhit == 0:
                    zomHp = zomHp - dmg
                    print (("The Attack Hits for %s damage") %(dmg)
#Zombie's Hit
            if zhit == 0:
                zdmg = randint(1, 10)
                myHp = myHp - zdmg
                print (("The Zombie's attack Hits for %s damage")(zdmg))
                print ("My Hp:", myHp)
#Zombie Miss
            if zhit != 0:
            print ("My Hp:", myHp)
#Zombie Dies
            if zomHp <= 0:
                print ("You defeated the Zombie!!!")
                battle = 50
#Round End
    print("Zombie's HP:", zomHp)
    print('')

A: I am getting an error on the line
File "<ipython-input-3-252d942b8c20>", line 82
if zhit == 0:
            ^
SyntaxError: invalid syntax

So, I noticed that "zhit" should not be initialized to zero as this conflicts with the comparison operator. Secondly, it would be helpful if you could add comments to the code to understand the purpose of the game. As for the EOF error on pep8, the documentation for pep8 maybe helpful, EOF901 points to E901    SyntaxError or IndentationError. In Python, proper indentation is most important. I hope this helps http://pep8.readthedocs.io/en/release-1.7.x/intro.html
It would also be a good idea to copy this code to a text editor such as Sublime, Atom or Visual Studio and switch to debugging mode to step through the code line by line. I tried the code on Jupyter notebook and did not find this error albeit a different one.
The https://repl.it/languages/python3 site also has its own debug environment. Perhaps, that would help you identify the source of this error.


text:
Q: ImageNet: what is top-1 and top-5 error rate? In ImageNet classification papers top-1 and top-5 error rates are important units for measuring the success of some solutions, but what are those error rates?
In ImageNet Classification with Deep Convolutional
Neural Networks
 by Krizhevsky et al. every solution based on one single CNN (page 7) has no top-5 error rates while the ones with 5 and 7 CNNs have (and also the error rate for 7 CNNs are better than for 5 CNNs).
Does this mean top-1 error rate is the best single error rate for one single CNN?
Is the top-5 error rate simply the accumulated error rate of five CNNs?

A: Your classifier gives you a probability for each class. Lets say we had only "cat", "dog", "house", "mouse" as classes (in this order). Then the classifier gives somehting like
0.1; 0.2; 0.0; 0.7

as a result. The Top-1 class is "mouse". The top-2 classes are {mouse, dog}. If the correct class was "dog", it would be counted as "correct" for the Top-2 accuracy, but as wrong for the Top-1 accuracy.
Hence, in a classification problem with $k$ possible classes, every classifier has 100% top-$k$ accuracy. The "normal" accuracy is top-1.

A:
[...] where the top-5 error rate is the fraction of test images for which
the correct label is not among the five labels considered most
probable by the mode.

First, you make a prediction using the CNN and obtain the predicted class multinomial distribution ($\sum p_{class} = 1$).
Now, in the case of the top-1 score, you check if the top class (the one with the highest probability) is the same as the target label.
In the case of the top-5 score, you check if the target label is one of your top 5 predictions (the 5 ones with the highest probabilities).
In both cases, the top score is computed as the number of times a predicted label matched the target label, divided by the number of data points evaluated.
Finally, when 5-CNNs are used, you first average their predictions and follow the same procedure for calculating the top-1 and top-5 scores.


text:
Q: ubuntu 18.04 shows new folder above removable usb When I create a new folder, it is shown above removable USB or volumes.
How can I fix that?
If there is a way to show all devices on menu bar please tell me.
mkdir 'new folder'


text:
Q: how to mock firebase_messaging in flutter? Hello im trying to mock firebase messaging to get token but when i try to test i get some error,can someone help me to solve this error. This error occur only in testing and not in my emulator or mobile phone. Here is my setupFirebaseAuthMocks. Thank you
my test
Future<void> _firebaseMessagingBackgroundHandler(RemoteMessage message) async {
  await Firebase.initializeApp();
}

void main() {
 setupFirebaseAuthMocks();
 late ProviderContainer container;

 group('AuthenticationControllerTest -', () {
   setUpAll(() async {
     await Firebase.initializeApp();
     FirebaseMessaging.onBackgroundMessage(_firebaseMessagingBackgroundHandler);
     registerThirdPartyServices();
   });
   tearDown(() {
    unregisterThirdPartyServices();
     //container.dispose();
});
    });

Error
MissingPluginException(No implementation found for method Messaging#getToken on channel plugins.flutter.io/firebase_messaging)

here is the method im trying to call
  Future<Result<Failure, bool>> registerUserFirebaseToken() async {
   try {
    log.i('Registering Firebase');
    final fireBaseMessaging = FirebaseMessaging.instance;
    final token = await fireBaseMessaging.getToken();
    log.v('Firebase token: $token');

  await api.post(
    link: '${env.getValue(kAuthUrl)}users/auth/firebase',
    body: {'token': token},
    hasHeader: true,
  );

  return const Success(true);
} catch (e) {
  return Error(Failure(message: 'Firebase registration went wrong, Please try again!', content: e.toString()));
}

}

A: For those having the same issue, there is an example of a Mock on the official firebase messaging Github
Depending on your Mockito's version, you may have to update this code a little bit.
Here is the Mock file I'm using with Mockito v5.3.2
// ignore_for_file: require_trailing_commas

import 'package:firebase_core/firebase_core.dart';
import 'package:firebase_core_platform_interface/firebase_core_platform_interface.dart';
import 'package:firebase_messaging_platform_interface/firebase_messaging_platform_interface.dart';
import 'package:flutter/services.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:mockito/mockito.dart';
import 'package:plugin_platform_interface/plugin_platform_interface.dart';

typedef Callback = Function(MethodCall call);

final MockFirebaseMessaging kMockMessagingPlatform = MockFirebaseMessaging();

Future<T> neverEndingFuture<T>() async {
  // ignore: literal_only_boolean_expressions
  while (true) {
    await Future.delayed(const Duration(minutes: 5));
  }
}

void setupFirebaseMessagingMocks() {
  TestWidgetsFlutterBinding.ensureInitialized();

  setupFirebaseCoreMocks();

  // Mock Platform Interface Methods
  // ignore: invalid_use_of_protected_member
  when(kMockMessagingPlatform.delegateFor(app: anyNamed('app')))
      .thenReturn(kMockMessagingPlatform);
  // ignore: invalid_use_of_protected_member
  when(kMockMessagingPlatform.setInitialValues(
    isAutoInitEnabled: anyNamed('isAutoInitEnabled'),
  )).thenReturn(kMockMessagingPlatform);
}

// Platform Interface Mock Classes

// FirebaseMessagingPlatform Mock
class MockFirebaseMessaging extends Mock
    with MockPlatformInterfaceMixin
    implements FirebaseMessagingPlatform {
  MockFirebaseMessaging() {
    TestFirebaseMessagingPlatform();
  }

  @override
  bool get isAutoInitEnabled {
    return super.noSuchMethod(Invocation.getter(#isAutoInitEnabled),
        returnValue: true, returnValueForMissingStub: true) as bool;
  }

  @override
  FirebaseMessagingPlatform delegateFor({FirebaseApp? app}) {
    return super.noSuchMethod(
      Invocation.method(#delegateFor, [], {#app: app}),
      returnValue: TestFirebaseMessagingPlatform(),
      returnValueForMissingStub: TestFirebaseMessagingPlatform(),
    ) as FirebaseMessagingPlatform;
  }

  @override
  FirebaseMessagingPlatform setInitialValues({bool? isAutoInitEnabled}) {
    return super.noSuchMethod(
      Invocation.method(
          #setInitialValues, [], {#isAutoInitEnabled: isAutoInitEnabled}),
      returnValue: TestFirebaseMessagingPlatform(),
      returnValueForMissingStub: TestFirebaseMessagingPlatform(),
    ) as FirebaseMessagingPlatform;
  }

  @override
  Future<RemoteMessage?> getInitialMessage() {
    return super.noSuchMethod(Invocation.method(#getInitialMessage, []),
            returnValue: neverEndingFuture<RemoteMessage>(),
            returnValueForMissingStub: neverEndingFuture<RemoteMessage>())
        as Future<RemoteMessage?>;
  }

  @override
  Future<void> deleteToken() {
    return super.noSuchMethod(Invocation.method(#deleteToken, []),
        returnValue: Future<void>.value(),
        returnValueForMissingStub: Future<void>.value()) as Future<void>;
  }

  @override
  Future<String?> getAPNSToken() {
    return super.noSuchMethod(Invocation.method(#getAPNSToken, []),
        returnValue: Future<String>.value(''),
        returnValueForMissingStub: Future<String>.value('')) as Future<String?>;
  }

  @override
  Future<String> getToken({String? vapidKey}) {
    return super.noSuchMethod(
        Invocation.method(#getToken, [], {#vapidKey: vapidKey}),
        returnValue: Future<String>.value(''),
        returnValueForMissingStub: Future<String>.value('')) as Future<String>;
  }

  @override
  Future<void> setAutoInitEnabled(bool? enabled) {
    return super.noSuchMethod(Invocation.method(#setAutoInitEnabled, [enabled]),
        returnValue: Future<void>.value(),
        returnValueForMissingStub: Future<void>.value()) as Future<void>;
  }

  @override
  Stream<String> get onTokenRefresh {
    return super.noSuchMethod(
      Invocation.getter(#onTokenRefresh),
      returnValue: const Stream<String>.empty(),
      returnValueForMissingStub: const Stream<String>.empty(),
    ) as Stream<String>;
  }

  @override
  Future<NotificationSettings> requestPermission(
      {bool? alert = true,
      bool? announcement = false,
      bool? badge = true,
      bool? carPlay = false,
      bool? criticalAlert = false,
      bool? provisional = false,
      bool? sound = true}) {
    return super.noSuchMethod(
            Invocation.method(#requestPermission, [], {
              #alert: alert,
              #announcement: announcement,
              #badge: badge,
              #carPlay: carPlay,
              #criticalAlert: criticalAlert,
              #provisional: provisional,
              #sound: sound
            }),
            returnValue: neverEndingFuture<NotificationSettings>(),
            returnValueForMissingStub:
                neverEndingFuture<NotificationSettings>())
        as Future<NotificationSettings>;
  }

  @override
  Future<void> subscribeToTopic(String? topic) {
    return super.noSuchMethod(Invocation.method(#subscribeToTopic, [topic]),
        returnValue: Future<void>.value(),
        returnValueForMissingStub: Future<void>.value()) as Future<void>;
  }

  @override
  Future<void> unsubscribeFromTopic(String? topic) {
    return super.noSuchMethod(Invocation.method(#unsubscribeFromTopic, [topic]),
        returnValue: Future<void>.value(),
        returnValueForMissingStub: Future<void>.value()) as Future<void>;
  }
}

class TestFirebaseMessagingPlatform extends FirebaseMessagingPlatform {
  TestFirebaseMessagingPlatform() : super();
}

and here is the unit test itself
void main() {

 setupFirebaseMessagingMocks();

  setUpAll(() async {
    await Firebase.initializeApp();
    FirebaseMessagingPlatform.instance = kMockMessagingPlatform;
  });

  test('An example of test', () {
      //...
      when(kMockMessagingPlatform.getToken(vapidKey: anyNamed('vapidKey')))
          .thenAnswer(
        (_) => Future.value('DEVICE_ID'),
      );
      //...
  });
}


text:
Q: Loop or function that recognizes the corresponding item of each position I have the following list:
Nlist= [1,2,3,1,3,2,4,4,2,1,3,4,2,2]

And I would like to get this result:
result=["first appearance 1","first appearance 2","first appearance 3",3,2,4,"first appearance 4",1,3,6,6,4,1]

Note that the loop or function must identify the item from each position and subtract the previous position from the current position and so on until the end of the Nlist.
The best I could do by myself was the code below but it's not what I need.
from collections import defaultdict as cd

keys= cd(list); # create dictionary

for key,value in enumerate(Nlist):
    keys[value].append(key)
    # add the positions

import numpy as np

chav_test= keys[1] #select the key

key_test=np.diff(chav_test)

print(key_head)

Note that in the case of the code above I'm having to select the key of one of the items and what I'm looking for is a loop or function that is able to recognize the item from each position and subtract the current position from the previous position generating just a list end as a result. Could someone please help me to solve this problem? Thanks!

A: You can iterate over the list while keeping track of the previous position of each item by storing those in a dictionary. Thus you can look up the previous position and construct the result list accordingly:
previous_position = {}
result = []

for index, item in enumerate(Nlist):
    if item in previous_position:
        result.append(index - previous_position[item])
    else:
        result.append(f'first appearance {item}')
    previous_position[item] = index


text:
Q: How can I get the value of a LivaData at once in Android Studio? savedRecordFileName is a variable of LivaData<String>, I hope to get the value of savedRecordFileName at once in Code A.
You know that LiveData variable is lazy, maybe the value of savedRecordFileName is null in binding.btnStop.setOnClickListener { }, so the code in binding.btnStop.setOnClickListener { } will not be fired when the value of savedRecordFileName is null.
I hope that the code in binding.btnStop.setOnClickListener { } can always be fired, how can I do?
BTW, I think the Code B is not suitable because the value of savedRecordFileName maybe changed by other function.
Code B
binding.btnStop.setOnClickListener {
   mHomeViewModel.savedRecordFileName.observe(viewLifecycleOwner){
        val aMVoice = getDefaultMVoice(mContext,it)
        mHomeViewModel.add(aMVoice)
   }
}

Code A
class FragmentHome : Fragment() {

    private val mHomeViewModel by lazy {
        getViewModel {
            HomeViewModel(mActivity.application, provideRepository(mContext))
        }
    }

    override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? {
       ...
       binding.btnStop.setOnClickListener {
            mHomeViewModel.savedRecordFileName.value?.let{
                val aMVoice = getDefaultMVoice(mContext,it)
                mHomeViewModel.add(aMVoice)
            }
        }
        ...
        return binding.root
    }

}

class HomeViewModel(val mApplication: Application, private val mDBVoiceRepository: DBVoiceRepository) : AndroidViewModel(mApplication) {
    val savedRecordFileName: LiveData<String> = mDBVoiceRepository.getTotalOfVoice().map {
        mApplication.getString(R.string.defaultName, (it+1).toString())
    }
}

class DBVoiceRepository private constructor(private val mDBVoiceDao: DBVoiceDao){
    fun getTotalOfVoice() = mDBVoiceDao.getTotalOfVoice()
}

@Dao
interface DBVoiceDao{
   @Query("SELECT count(id) FROM voice_table")
   fun getTotalOfVoice(): LiveData<Long>
}

Add Content
To Ridcully: Thanks!
I think your way "move all of that into the viewmodel class" is good !
I think it will be OK even if the filename is livedata in your Code C, right?
Code C
viewModelScope.launch(Dispatchers.IO) {
    filename = dao.getFilename() // without livedata.  I think it will be OK even if the filename is livedata
    voice = getDefaultVoice(...) // also do this in background
    add(voice)
    result.postValue(true)
}

A: Solution 1
A simple/tricky/dirty solution would be an empty observe in onViewCreated like:
mHomeViewModel.savedRecordFileName.observe(viewLifecycleOwner){ }

which causes the LiveData to be observed, so it will be queried by Room because it is active and hopefully when you click on the button, the LiveData is filled.

Solution 2
But my favorite approach would be a reactive one. I don't know if you want to take a reactive look toward your code or not, but you can use MediatorLiveData (or take advantage of a library like this) to solve this situation reactively.
Let there be another LiveData in your VM named btnStopClicked and each click changes the value of that LiveData. So, your code may look like this:
class FragmentHome : Fragment() {

    override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? {
       ...
       binding.btnStop.setOnClickListener {
            mHomeViewModel.btnStopClicked.value = null //we don't care about the value
        }
        mHomeViewModel.addVoiceEvent.observe(viewLifecycleOwner){
            val aMVoice = getDefaultMVoice(mContext,it)
            mHomeViewModel.add(aMVoice)
        }
        ...
        return binding.root
    }

}

class HomeViewModel(val mApplication: Application, private val mDBVoiceRepository: DBVoiceRepository) : AndroidViewModel(mApplication) {

    val savedRecordFileName: ... //whatever it was
    val btnStopClicked = MutableLiveData<Any>()

    val addVoiceEvent = savedRecordFileName
        .combineLatestWith(btnStopClicked){srfn, _ -> srfn}
        .toSingleEvent()
}

Also do not forget toSingleEvent because if you don't turn it into an event, it would get called unintentionally in some situations (look at this).

A: As you said, you should do Room queries in background to avoid blocking ui thread. But you shouldn't stop there. Do as much work as possible in a background thread. In your case, on button click, start running a background thread that does all the work: getting name from database (with direct query, which is possible now as you are running in background), getting the default voice, and adding it,  to whatever it is you are adding it to.
You should also move all of that into the viewmodel class.
btnStop.setOnClickListener {
    viewmodel.stop()
}

In viewmodel something like this (java / pseudo code like):
void stop() {
    runinbackgroundthread {
        filename = dao.getFilename() // without livedata
        voice = getDefaultVoice(...) // also do this in background
        add(voice)
        // If you want the action to have a reault, observable by ui
        // use a MutableLiveData and set it here, via postValue()
        // as we are still in background thread.
        result.postValue(true)
    }
}

On how to actually implement my pseudo code  runinbackgroundthread see some official guide here: https://developer.android.com/guide/background/threading
In short, with Kotlin coroutines it should go like this:
viewModelScope.launch(Dispatchers.IO) {
    filename = dao.getFilename() // without livedata
    voice = getDefaultVoice(...) // also do this in background
    add(voice)
    result.postValue(true)
}

A: TL;DR - Code A is better, with extra additions.
As you already know, LiveData is not guaranteed to have a non-null value right after instantiation. Ideally, as for best practice, it is good to always treat LiveData value as ever changing (i.e - assume direct value access twice will produce different values). This is intended behavior as LiveData is designed to be observable instead of you dealing with immediate value.
Hence, listen to the LiveData and update your UI accordingly. For instance, disable or hide the stop button when there's no data inside it.
mHomeViewModel.savedRecordFileName.observe(viewLifecycleOwner) {
    binding.btnStop.isEnabled = it != null
}
binding.btnStop.setOnClickListener {
    mHomeViewModel.savedRecordFileName.value?.also {
        val aMVoice = getDefaultMVoice(mContext,it)
        mHomeViewModel.add(aMVoice)
    }
}