text:
Q: Check if Word document is already open before opening it in C# I'm doing several things with a Word document in the background and sometimes, if the app fails, an instance of MS Word is left running in the background.
Upon restart, it tries to open the same file and there's a stream of issues related to that.
I'd like to understand (couldn't quite find an applicable answer here) how to check if the file I'm trying to open is already open.
My code:
Microsoft.Office.Interop.Word.Application wordApp = new Microsoft.Office.Interop.Word.Application();
Document wordDoc = new Document();
wordDoc = wordApp.Documents.Open(ref oTemplatePath, ref oMissing, ref oMissing, ref oMissing);
wordApp.Visible = false;

How can I check for the file being already open before executing wordApp.Documents.Open?
Thanks!

A: You can try to open the file, if the file is already open IOException will be thrown and indicate that the file is open:
public bool fileIsOpen(string path)
{
    System.IO.FileStream a = null;

    try
    {
        a = System.IO.File.Open(path,
        System.IO.FileMode.Open, System.IO.FileAccess.Read, System.IO.FileShare.None);
        return false;
    }
    catch (System.IO.IOException ex)
    {
        return true;
    }

    finally
    {
        if (a != null)
        {
            a.Close();
            a.Dispose();
        }
    }
}

A: You can enumerate all Word windows and try to find one with that document. Also if you try to open this file, while it's opened in Word, you will get IOException. But it's not perfect solution :(
Here is solution:
using System;
using System.Collections.Generic;
using System.IO;
using System.Runtime.InteropServices;
using System.Text;

namespace WordExampleApp
{
    class Program
    {
        const int ERROR_SHARING_VIOLATION = -2147024864;
        static readonly string WORD_CLASS_NAME = "OpusApp";
        static readonly string WORD_DOCUMENT_CLASS_NAME = "_WwB";

        delegate bool EnumWindowProc(IntPtr hWnd, IntPtr parameter);

        static void Main(string[] args)
        {
            // Path to exist word document
            string filePath = @"C:\temp\asdasd.docx";

            string documentName = Path.GetFileNameWithoutExtension(filePath);
            var isDocOpened = IsDocumentOpened(documentName);
            Console.WriteLine("Is document opened: {0}", isDocOpened);

            bool canRead = CanReadFile(filePath);
            Console.WriteLine("Can read file: {0}", canRead);
        }
        private static bool CanReadFile(string path)
        {
            try {
                using (var fs = new FileStream(path, FileMode.Open, FileAccess.Read, FileShare.None)) { }
                return true;
            }
            catch (IOException ex) {
                if (ex.HResult == ERROR_SHARING_VIOLATION)
                    return false;
                else throw;
            }
        }

        private static bool IsDocumentOpened(string documentName)
        {
            IntPtr hwnd = FindWindow(WORD_CLASS_NAME, documentName + " - Word");
            List<IntPtr> childs = GetChildWindows(hwnd);
            var classText = new StringBuilder("", 1024);
            var windowText = new StringBuilder("", 1024);

            foreach (var childHwnd in childs)
            {
                if (0 == GetClassName(childHwnd, classText, 1024)) {
                    // something wrong
                }
                if (0 == GetWindowText(childHwnd, windowText, 1024)) {
                    // something wrong
                }
                var className = classText.ToString();
                var windowName = windowText.ToString();
                if (className == WORD_DOCUMENT_CLASS_NAME && windowName == documentName)
                    return true;

                classText.Clear();
                windowText.Clear();
            }
            return false;
        }
        public static List<IntPtr> GetChildWindows(IntPtr parent)
        {
            List<IntPtr> result = new List<IntPtr>();
            GCHandle gcHandle = GCHandle.Alloc(result);
            try {
                EnumWindowProc childProc = new EnumWindowProc(EnumWindow);
                EnumChildWindows(parent, childProc, GCHandle.ToIntPtr(gcHandle));
            }
            finally {
                if (gcHandle.IsAllocated)
                    gcHandle.Free();
            }
            return result;
        }
        private static bool EnumWindow(IntPtr handle, IntPtr pointer)
        {
            GCHandle gch = GCHandle.FromIntPtr(pointer);
            List<IntPtr> list = gch.Target as List<IntPtr>;
            if (list == null)
                throw new InvalidCastException("GCHandle Target could not be cast as List<IntPtr>");
            list.Add(handle);
            return true;
        }

        [DllImport("user32", ExactSpelling = false, CharSet = CharSet.Auto)]
        internal static extern IntPtr FindWindow(string lpClassName, string lpWindowName);

        [DllImport("user32.dll")]
        [return: MarshalAs(UnmanagedType.Bool)]
        static extern bool EnumChildWindows(IntPtr hwndParent, EnumWindowProc lpEnumFunc, IntPtr lParam);

        [DllImport("user32.dll", SetLastError = true, CharSet = CharSet.Auto)]
        static extern int GetClassName(IntPtr hWnd, StringBuilder lpClassName, int nMaxCount);

        [DllImport("user32.dll", SetLastError = true, CharSet = CharSet.Auto)]
        public static extern int GetWindowText(IntPtr hWnd, StringBuilder lpWindowText, int nMaxCount);
    }
}

A: Had the same Problem. My solution was to always open the document as ReadOnly and make a copy of it. I know the question was for a way to check if the document is already opened, but it is not necessary to check this if the document is opened readonly:
public static MsWord.Document CopyTemplate(string Template, MsWord.Application wordApp)
{
      var TemplateDoc = wordApp.Documents.Open(Template, ReadOnly: true);

      TemplateDoc.Select();
      wordApp.Selection.Copy();
      TemplateDoc.Close(SaveChanges: false);

      var NewDoc = wordApp.Documents.Add();
      NewDoc.Select();
      wordApp.Selection.PasteAndFormat(MsWord.WdRecoveryType.wdFormatOriginalFormatting);

      return NewDoc;
}

A: Well I think a simple approach would be checking the title of current running processes:
bool isWordFileAlreadyOpened = false;
var alreadyOpenedProcessForWordFile = Process.GetProcesses().FirstOrDefault(p => p.MainWindowTitle.Contains(alreadyOpenedProcessForWordFile));
isWordFileAlreadyOpened = alreadyOpenedProcess != null;


text:
Q: Recover activity from photo at Fukushima This photo was published at stern magazine online.

I wonder which information about the physical quantities could be reconstructed or computed given this photograph, the exposure time, and the detector size.
The white dots in the image correspond to particle traces on the imaging sensor. Thus by just counting the number of white dots, we know how many gamma photons interacted with the sensor while passing through. I will neglect the fact that the white pixels could also be caused by defect pixels aka "dead pixels". Let's assume the photo was taken with a non-stationary new camera.
So the only physical quantity I could come up is:
$$\frac{\text{# of white dots}}{12\pi \text{sr}\ \text{sensor_area}\cdot \text{exposure_time}}$$
Is there a way to find out more with some very conservative assumptions about the environment? What would these assumptions be?

redpajama_set_name: RedPajamaStackExchange


text:
Q: Difference between two Times in seconds I am trying to print difference between two times in seconds in the given format. I tried all possible solutions, but unable to print below formats
start time: 15:15:30
end time: 15:15:37

difference times:
    15:15:31
    15:15:32
    15:15:33
    15:15:34
    15:15:35
    15:15:36

Any suggestions on how can I achieve this using Java 8?

A: Using the java.time library:
LocalTime startTime = LocalTime.parse("15:15:30");
LocalTime endTime = LocalTime.parse("15:15:37");
for (LocalTime current = startTime; current.isBefore(endTime); current = current.plusSeconds(1)) {
    System.out.println(current);
}

A: You can make 2 different Calendar objects and set the time as your start time and end time.
Compare these 2 instances and add a second until they both becomes equal. You can print them at the same time.
Calendar startTime = Calendar.getInstance(), endTime = Calendar.getInstance();
SimpleDateFormat sdf = new SimpleDateFormat("HH:mm:ss");

startTime.setTime(sdf.parse("15:15:30"));
startTime.add(Calendar.SECOND, 1);
endTime.setTime(sdf.parse("15:15:37"));

while(startTime.compareTo(endTime) < 0) {
    System.out.println(sdf.format(startTime.getTime()));
    startTime.add(Calendar.SECOND, 1);
}

Output
15:15:31
15:15:32
15:15:33
15:15:34
15:15:35
15:15:36


text:
Q: replace odd occurrences of a character using regex in javascript I have a string which contains '#'. I want to replace occurrence of only odd '#' with something else.
For e.g. for below string
This is my string # This is my string # This is my string # This is my string #

output should be
This is my string # This is my string '' This is my string # This is my string ''

Note : considering occurrence starts with 0

A: ([^#]*#[^#]*)#

You can use this.Replace by $1".See demo.
https://regex101.com/r/cT0hV4/9
var re = /([^#]*#[^#]*)#/gm;
var str = 'This is my string # This is my string # This is my string # This is my string #';
var subst = '$1"';

var result = str.replace(re, subst);

A: Try using this regex:
#(.*?(?:#|$))

Regex Demo
EDIT:
var reg = /#(.*?(?:#|$))/;
var message = 'This is my string # This is my string # This is my string # This is my string #';
var substitue = '$1"';

var result = message.replace(reg, substitue);
alert(result);

JSFIDDLE DEMO

A: You can use the following regex to do this
str.replace(/(#.*?)#/g, '$1"')


text:
Q: WDIO Javascript Mocha/Chai crashes NPM when expect fails When running a test, the it blocks are being executed and I'm getting this output.
What I am unable to understand is why the npm command is exiting with an error?
3) GAMETRIBE CELL C WAP DOI - SUCCESS FLOW Webdriver should target and click the subscription CTA:
An element could not be located on the page using the given search parameters ("[class='button']").
running phantomjs
Error: An element could not be located on the page using the given search parameters ("[class='button']").
    at getText() - index.js:312:3

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! webdriver_typescript@1.0.0 test-cellc: `node ./node_modules/typescript/lib/tsc.js && node ./node_modules/webdriverio/bin/wdio ./dist/wdio.conf.mcm.js --suite cellcWapDoi`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the webdriver_typescript@1.0.0 test-cellc script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/davidabes/.npm/_logs/2017-12-14T06_44_07_155Z-debug.log

My test cases look like this:
export default function() {
it('Webdriver should target and click the subscription CTA', function() {
    const yesLink = browser.element("[class='button']");
    console.log(yesLink.getText());
    console.log(yesLink.getTagName());
    yesLink.click();
});

A: It seems if any of the tests fail, then it seems mocha exits with an error code of 1 ... I just can't remember where in the docs I read this.


text:
Q: Adding the ">" to a Process.Start instance How could I tell the program "test.exe" (which is a console application) to output its result to a file.
E.g. usually the program can output the data by doing test.exe > output.txt at the prompt.
How could this be done in this statement?
Process.Start("test.exe", "\"" + exename + "\"").WaitForExit();

A: Use the StandardOutput property as in this example from the MSDN page:
// Start the child process.
Process p = new Process();
// Redirect the output stream of the child process.
p.StartInfo.UseShellExecute = false;
p.StartInfo.RedirectStandardOutput = true;
p.StartInfo.FileName = "Write500Lines.exe";
p.Start();
// Read the output stream first and then wait.
string output = p.StandardOutput.ReadToEnd();
p.WaitForExit();

As you can see you need to set the RedirectStandardOutput property of the Process's StartInfo.

A: and if you only want to redirect the output to a file, called piping, you can ask cmd.exe to do that for you. i.e.
Process.Start("cmd.exe", "/c test.exe \"" + exename + "\" > D:\\testOutput.txt").WaitForExit();

A: You can, in code, redirect the standard output to a FileStream.


text:
Q: debug angular application errors that are not well informative I have started one of my old projects.
Updated all dependencies and angular to the latest version.
Now, when I launch the project - I get an error:
main.ts:12 Error: Can't resolve all parameters for AuthState: (?, ?).
    at getUndecoratedInjectableFactory (core.js:17158)
    at injectableDefOrInjectorDefFactory (core.js:17142)
    at providerToFactory (core.js:17210)
    at providerToRecord (core.js:17192)
    at R3Injector.processProvider (core.js:17008)
    at core.js:16969
    at core.js:1400
    at Array.forEach (<anonymous>)
    at deepForEach (core.js:1400)
    at R3Injector.processInjectorType (core.js:16965)

My question is - How to debug such kind of errors in Angular?
main.ts file, 11 and 12 lines are:
platformBrowserDynamic().bootstrapModule(AppModule)
  .catch(err => console.log(err));

it is an application-scope exception handler.
So, anything I know from the error, that something is wrong with AuthState - but what exactly, where exactly and why - no information.

A: Solved, all NGXS @State() classes now should be prefixed with the @Injectable() decorator.
https://www.ngxs.io/advanced/ivy-migration-guide


text:
Q: Memcache expiration times Is it possible to obtain the remaining time left for a value stored in memcache?

A: No it is not.  If you want something like that, you need to encode it into your value.

A: No. Memcache expire times are only a courtesy and not a guarantee. Any item in the cache may be purged at any time.

A: Yes you can, but it is not a guaranteed value, since it can be purged. I would only advice to check this on a development environment, though.
function getMemcacheKeys() {

    $memcache = new Memcache;
    $memcache->connect('localhost', 11211) or die ("Could not connect to memcache server");

    $list = array();
    $allSlabs = $memcache->getExtendedStats('slabs');
    foreach($allSlabs as $server => $slabs) {
        foreach($slabs AS $slabId => $slabMeta) {
           if (!is_numeric($slabId)) {
                continue;
           }
           $cdump = $memcache->getExtendedStats('cachedump',(int)$slabId);
            foreach($cdump AS $keys => $arrVal) {
                if (!is_array($arrVal)) continue;
                foreach($arrVal AS $k => $v) {
                    echo $k .' - '.date('H:i d.m.Y',$v[1]).'<br />';
                }
           }
        }
    }
}

Copied from: https://stackoverflow.com/a/7480534/338840


text:
Q: Get parent of child element with xpath in Symfony2 Crawler

First Item

Second Item

I can access all links via xpath query.
    $result = $crawler->filterXPath('//ul[@id="menu"]/li/a');

but i wonder if is it possible to access parent element of child element using filterXPath() method without editing xpath query in PHP DomCrawler ?
For example i want to access //ul[@id="menu"] using node element in each() method.
$result = $crawler->filterXPath('//ul[@id="menu"]/li/a');
if($result->count() < 1){
  exit('Query not found.');
}
$result->each(function (Crawler $node)){
    $parentOfNode = $node->parent() // ??
    //...
};


text:
Q: Weblogic Java thread getting stuck I have a J2EE application running in Weblogic 10.3.6  that seems to randomly get 2 stuck threads and I was wondering if anyone can point me in the right direction as to what the struck threads might be waiting on. Here is the thread dump:
"Main Thread" id=1 idx=0x4 tid=12639 prio=5 alive, waiting, native_blocked

            -- Waiting for notification on: weblogic/t3/srvr/T3Srvr@0x92af6588[fat lock]

            at jrockit/vm/Threads.waitForNotifySignal(JLjava/lang/Object;)Z(Native Method)

            at java/lang/Object.wait(J)V(Native Method)

            at java/lang/Object.wait(Object.java:485)

            at weblogic/t3/srvr/T3Srvr.waitForDeath(T3Srvr.java:981)

            ^-- Lock released while waiting: weblogic/t3/srvr/T3Srvr@0x92af6588[fat lock]

            at weblogic/t3/srvr/T3Srvr.run(T3Srvr.java:490)

            at weblogic/Server.main(Server.java:71)

            at jrockit/vm/RNI.c2java(JJJJJ)V(Native Method)

            -- end of trace

        "(Signal Handler)" id=2 idx=0x8 tid=12640 prio=5 alive, native_blocked, daemon

        "(OC Main Thread)" id=3 idx=0xc tid=12641 prio=5 alive, native_waiting, daemon

        "(GC Worker Thread 1)" id=? idx=0x10 tid=12642 prio=5 alive, daemon

        "(GC Worker Thread 2)" id=? idx=0x14 tid=12643 prio=5 alive, daemon

        "(GC Worker Thread 3)" id=? idx=0x18 tid=12644 prio=5 alive, daemon

        "(Code Generation Thread 1)" id=4 idx=0x60 tid=12662 prio=5 alive, native_waiting, daemon

        "(Code Optimization Thread 1)" id=5 idx=0x64 tid=12663 prio=5 alive, native_waiting, daemon

        "(VM Periodic Task)" id=6 idx=0x68 tid=12664 prio=10 alive, native_blocked, daemon

        "Finalizer" id=7 idx=0x6c tid=12665 prio=8 alive, native_waiting, daemon

            at jrockit/memory/Finalizer.waitForFinalizees(J[Ljava/lang/Object;)I(Native Method)

            at jrockit/memory/Finalizer.access$700(Finalizer.java:12)

            at jrockit/memory/Finalizer$4.run(Finalizer.java:189)

            at java/lang/Thread.run(Thread.java:619)

            at jrockit/vm/RNI.c2java(JJJJJ)V(Native Method)

            -- end of trace

        "Reference Handler" id=8 idx=0x70 tid=12666 prio=10 alive, native_waiting, daemon

            at java/lang/ref/Reference.waitForActivatedQueue(J)Ljava/lang/ref/Reference;(Native Method)

            at java/lang/ref/Reference.access$100(Reference.java:11)

            at java/lang/ref/Reference$ReferenceHandler.run(Reference.java:82)

            at jrockit/vm/RNI.c2java(JJJJJ)V(Native Method)

            -- end of trace

        "(Sensor Event Thread)" id=9 idx=0x74 tid=12667 prio=5 alive, native_blocked, daemon

        "VM JFR Buffer Thread" id=10 idx=0x78 tid=12668 prio=5 alive, in native, daemon

        "Timer-0" id=14 idx=0x80 tid=12671 prio=5 alive, waiting, native_blocked, daemon

            -- Waiting for notification on: java/util/TaskQueue@0x92b0ad40[fat lock]

            at jrockit/vm/Threads.waitForNotifySignal(JLjava/lang/Object;)Z(Native Method)

            at java/lang/Object.wait(J)V(Native Method)

            at java/util/TimerThread.mainLoop(Timer.java:509)

            ^-- Lock released while waiting: java/util/TaskQueue@0x92b0ad40[fat lock]

            at java/util/TimerThread.run(Timer.java:462)

            at jrockit/vm/RNI.c2java(JJJJJ)V(Native Method)

            -- end of trace

        "[STUCK] ExecuteThread: '0' for queue: 'weblogic.kernel.Default (self-tuning)'" id=15 idx=0x84 tid=12672 prio=1 alive, native_blocked, daemon

            at java/util/AbstractCollection.toArray(AbstractCollection.java:119)[optimized]

            at java/util/ArrayList.<init>(ArrayList.java:131)[inlined]

            at javax/faces/component/UIComponentBase$FacetsMap.keySetIterator(UIComponentBase.java:2228)[inlined]

            at javax/faces/component/UIComponentBase$FacetsMapValuesIterator.<init>(UIComponentBase.java:2583)[inlined]

            at javax/faces/component/UIComponentBase$FacetsMapValues.iterator(UIComponentBase.java:2567)[optimized]

            at org/ajax4jsf/component/UIDataAdaptorBase.restoreChildState(UIDataAdaptorBase.java:1006)[optimized]

            at org/ajax4jsf/component/UIDataAdaptorBase.restoreChildState(UIDataAdaptorBase.java:1004)[inlined]

            at org/apache/el/MethodExpressionImpl.invoke(MethodExpressionImpl.java:276)

            at com/sun/facelets/el/TagMethodExpression.invoke(TagMethodExpression.java:68)

            at javax/faces/component/MethodBindingMethodExpressionAdapter.invoke(MethodBindingMethodExpressionAdapter.java:88)

            at com/sun/faces/application/ActionListenerImpl.processAction(ActionListenerImpl.java:102)

            at com/CompName/AppName/core/web/CustomActionListener.processAction(CustomActionListener.java:51)

            at javax/faces/component/UICommand.broadcast(UICommand.java:387)

            at org/ajax4jsf/component/AjaxActionComponent.broadcast(AjaxActionComponent.java:55)

            at org/ajax4jsf/component/AjaxViewRoot.processEvents(AjaxViewRoot.java:329)

            at org/ajax4jsf/component/AjaxViewRoot$$com_CompName_AppName_validation_web_ProxyViewRootInterceptor.CGLIB$processEvents$12(Ljavax/faces/context/FacesContext;Lorg/ajax4jsf/event/EventsQueue;Z)V(<generated>)[inlined]

            at weblogic/security/service/SecurityManager.runAs(SecurityManager.java:120)

            at weblogic/servlet/internal/WebAppServletContext.securedExecute(WebAppServletContext.java:2273)

            at weblogic/servlet/internal/WebAppServletContext.execute(WebAppServletContext.java:2179)

            at weblogic/servlet/internal/ServletRequestImpl.run(ServletRequestImpl.java:1490)

            at weblogic/work/ExecuteThread.execute(ExecuteThread.java:256)[optimized]

            at weblogic/work/ExecuteThread.run(ExecuteThread.java:221)

            at jrockit/vm/RNI.c2java(JJJJJ)V(Native Method)

            -- end of trace

        "JFR request timer" id=16 idx=0x88 tid=12673 prio=5 alive, waiting, native_blocked, daemon

            -- Waiting for notification on: java/util/TaskQueue@0x92b0adc0[fat lock]

            at jrockit/vm/Threads.waitForNotifySignal(JLjava/lang/Object;)Z(Native Method)

            at java/lang/Object.wait(J)V(Native Method)

            at java/lang/Object.wait(Object.java:485)

            at java/util/TimerThread.mainLoop(Timer.java:483)

            ^-- Lock released while waiting: java/util/TaskQueue@0x92b0adc0[fat lock]

            at java/util/TimerThread.run(Timer.java:462)

            at jrockit/vm/RNI.c2java(JJJJJ)V(Native Method)

            -- end of trace

        "weblogic.time.TimeEventGenerator" id=18 idx=0x8c tid=12674 prio=9 alive, waiting, native_blocked, daemon

            -- Waiting for notification on: weblogic/time/common/internal/TimeTable@0x92b0c1d0[fat lock]

            at jrockit/vm/Threads.waitForNotifySignal(JLjava/lang/Object;)Z(Native Method)

            at java/lang/Object.wait(J)V(Native Method)

            at weblogic/time/common/internal/TimeTable.snooze(TimeTable.java:286)

            ^-- Lock released while waiting: weblogic/time/common/internal/TimeTable@0x92b0c1d0[fat lock]

            at weblogic/time/common/internal/TimeEventGenerator.run(TimeEventGenerator.java:117)

            at java/lang/Thread.run(Thread.java:619)

            at jrockit/vm/RNI.c2java(JJJJJ)V(Native Method)

            -- end of trace

        "JMAPI event thread" id=19 idx=0x90 tid=12675 prio=5 alive, in native, daemon

        "weblogic.timers.TimerThread" id=20 idx=0x94 tid=12676 prio=9 alive, waiting, native_blocked, daemon

            -- Waiting for notification on: weblogic/timers/internal/TimerThread@0x92b0aec8[fat lock]

            at jrockit/vm/Threads.waitForNotifySignal(JLjava/lang/Object;)Z(Native Method)

            at java/lang/Object.wait(J)V(Native Method)

            at weblogic/timers/internal/TimerThread$Thread.run(TimerThread.java:262)

            ^-- Lock released while waiting: weblogic/timers/internal/TimerThread@0x92b0aec8[fat lock]

            at jrockit/vm/RNI.c2java(JJJJJ)V(Native Method)

            -- end of trace

        "[STUCK] ExecuteThread: '1' for queue: 'weblogic.kernel.Default (self-tuning)'" id=21 idx=0x98 tid=12677 prio=1 alive, native_blocked, daemon

            at com/sun/faces/config/ConfigureListener.attributeRemoved(ConfigureListener.java:321)[optimized]

            at weblogic/servlet/internal/EventsManager.notifyRequestAttributeEvent(EventsManager.java:352)[inlined]

            at weblogic/servlet/internal/RequestEventsFilter$EventsRequestWrapper.removeAttribute(RequestEventsFilter.java:58)[optimized]

            at com/sun/faces/context/RequestMap.remove(ExternalContextImpl.java:1096)[optimized]

            at org/ajax4jsf/component/UIDataAdaptorBase.removeVariable(UIDataAdaptorBase.java:583)[inlined]

            at org/ajax4jsf/component/UIDataAdaptorBase.setupVariable(UIDataAdaptorBase.java:559)[inlined]

            at org/richfaces/component/UITree.setupVariable(UITree.java:360)[optimized]

            at org/ajax4jsf/component/UIDataAdaptorBase.setRowKey(UIDataAdaptorBase.java:357)[optimized]

            at org/ajax4jsf/component/UIDataAdaptorBase.setRowKey(UIDataAdaptorBase.java:324)[inlined]

            at org/richfaces/component/state/TreeState.expandNode(TreeState.java:233)[inlined]

            at com/CompName/AppName/application/group/tree/AppNameTree.expandNode(AppNameTree.java:311)[optimized]

            at org/ajax4jsf/component/AjaxViewRoot$$com_CompName_AppName_validation_web_ProxyViewRootInterceptor.CGLIB$processPhase$9(Ljavax/faces/context/FacesContext;Ljavax/faces/event/PhaseId;Lorg/ajax4jsf/context/InvokerCallback;)V(<generated>)[inlined]

            at org/ajax4jsf/component/AjaxViewRoot$$com_CompName_AppName_validation_web_ProxyViewRootInterceptor$$FastClassByCGLIB$$b62d5b05.invoke(ILjava/lang/Object;[Ljava/lang/Object;)Ljava/lang/Object;(<generated>)[optimized]

            at net/sf/cglib/proxy/MethodProxy.invokeSuper(MethodProxy.java:167)[inlined]

            at com/CompName/AppName/validation/web/ProxyViewRootInterceptor.intercept(ProxyViewRootInterceptor.java:172)[optimized]

            at weblogic/servlet/internal/RequestDispatcherImpl.invokeServlet(RequestDispatcherImpl.java:527)

            at weblogic/servlet/internal/RequestDispatcherImpl.forward(RequestDispatcherImpl.java:253)

            at com/CompName/AppName/core/web/CustomFilter.processRequest(CustomFilter.java:281)[inlined]

            at com/CompName/AppName/core/web/conversation/ConversationFilter.doFilter(ConversationFilter.java:97)[optimized]

            at weblogic/servlet/internal/FilterChainImpl.doFilter(FilterChainImpl.java:56)[optimized]

            at com/CompName/AppName/application/AuthenticationFilter.doFilter(AuthenticationFilter.java:84)

            at weblogic/servlet/internal/FilterChainImpl.doFilter(FilterChainImpl.java:56)[optimized]

            at weblogic/servlet/internal/RequestEventsFilter.doFilter(RequestEventsFilter.java:27)

            at weblogic/servlet/internal/FilterChainImpl.doFilter(FilterChainImpl.java:56)[optimized]

            at weblogic/servlet/internal/WebAppServletContext$ServletInvocationAction.wrapRun(WebAppServletContext.java:3730)

            at weblogic/servlet/internal/WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:3696)

            at weblogic/security/acl/internal/AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)

            at weblogic/security/service/SecurityManager.runAs(SecurityManager.java:120)

            at weblogic/servlet/internal/WebAppServletContext.securedExecute(WebAppServletContext.java:2273)

            at weblogic/servlet/internal/WebAppServletContext.execute(WebAppServletContext.java:2179)

            at weblogic/servlet/internal/ServletRequestImpl.run(ServletRequestImpl.java:1490)

            at weblogic/work/ExecuteThread.execute(ExecuteThread.java:256)[optimized]

            at weblogic/work/ExecuteThread.run(ExecuteThread.java:221)

            at jrockit/vm/RNI.c2java(JJJJJ)V(Native Method)

            -- end of trace

        "ExecuteThread: '0' for queue: 'weblogic.socket.Muxer'" id=24 idx=0x9c tid=12678 prio=5 alive, blocked, native_blocked, daemon

            -- Blocked trying to get lock: java/lang/String@0x92a32e70[fat lock]

            at jrockit/vm/Threads.waitForUnblockSignal()V(Native Method)

            at jrockit/vm/Locks.fatLockBlockOrSpin(Locks.java:1402)[optimized]

            at jrockit/vm/Locks.lockFat(Locks.java:1503)[optimized]

            at jrockit/vm/Locks.monitorEnterSecondStageHard(Locks.java:1045)[optimized]

            at jrockit/vm/Locks.monitorEnterSecondStage(Locks.java:996)[optimized]

            at jrockit/vm/Locks.monitorEnter(Locks.java:2170)[optimized]

            at weblogic/socket/EPollSocketMuxer.processSockets(EPollSocketMuxer.java:153)

            at weblogic/socket/SocketReaderRequest.run(SocketReaderRequest.java:29)

            at weblogic/socket/SocketReaderRequest.execute(SocketReaderRequest.java:42)

            at weblogic/kernel/ExecuteThread.execute(ExecuteThread.java:145)

            at weblogic/kernel/ExecuteThread.run(ExecuteThread.java:117)

            at jrockit/vm/RNI.c2java(JJJJJ)V(Native Method)

            -- end of trace

        "ExecuteThread: '1' for queue: 'weblogic.socket.Muxer'" id=25 idx=0xa0 tid=12679 prio=5 alive, blocked, native_blocked, daemon

            -- Blocked trying to get lock: java/lang/String@0x92a32e70[fat lock]

            at jrockit/vm/Threads.waitForUnblockSignal()V(Native Method)

            at jrockit/vm/Locks.fatLockBlockOrSpin(Locks.java:1402)[optimized]

            at jrockit/vm/Locks.lockFat(Locks.java:1503)[optimized]

            at jrockit/vm/Locks.monitorEnterSecondStageHard(Locks.java:1045)[optimized]

            at jrockit/vm/Locks.monitorEnterSecondStage(Locks.java:996)[optimized]

            at jrockit/vm/Locks.monitorEnter(Locks.java:2170)[optimized]

            at weblogic/socket/EPollSocketMuxer.processSockets(EPollSocketMuxer.java:153)

            at weblogic/socket/SocketReaderRequest.run(SocketReaderRequest.java:29)

            at weblogic/socket/SocketReaderRequest.execute(SocketReaderRequest.java:42)

            at weblogic/kernel/ExecuteThread.execute(ExecuteThread.java:145)

            at weblogic/kernel/ExecuteThread.run(ExecuteThread.java:117)

            at jrockit/vm/RNI.c2java(JJJJJ)V(Native Method)

            -- end of trace

        "ExecuteThread: '2' for queue: 'weblogic.socket.Muxer'" id=26 idx=0xa4 tid=12680 prio=5 alive, in native, daemon

            at jrockit/ext/epoll/EPoll.epollWait0(ILjava/nio/ByteBuffer;II)I(Native Method)

            at jrockit/ext/epoll/EPoll.epollWait(EPoll.java:115)

            at weblogic/socket/EPollSocketMuxer.processSockets(EPollSocketMuxer.java:156)

            ^-- Holding lock: java/lang/String@0x92a32e70[fat lock]

            at weblogic/socket/SocketReaderRequest.run(SocketReaderRequest.java:29)

            at weblogic/socket/SocketReaderRequest.execute(SocketReaderRequest.java:42)

            at weblogic/kernel/ExecuteThread.execute(ExecuteThread.java:145)

            at weblogic/kernel/ExecuteThread.run(ExecuteThread.java:117)

            at jrockit/vm/RNI.c2java(JJJJJ)V(Native Method)

            -- end of trace

        "ExecuteThread: '3' for queue: 'weblogic.socket.Muxer'" id=27 idx=0xa8 tid=12681 prio=5 alive, blocked, native_blocked, daemon

            -- Blocked trying to get lock: java/lang/String@0x92a32e70[fat lock]

            at jrockit/vm/Threads.waitForUnblockSignal()V(Native Method)

            at jrockit/vm/Locks.fatLockBlockOrSpin(Locks.java:1402)[optimized]

            at jrockit/vm/Locks.lockFat(Locks.java:1503)[optimized]

            at jrockit/vm/Locks.monitorEnterSecondStageHard(Locks.java:1045)[optimized]

            at jrockit/vm/Locks.monitorEnterSecondStage(Locks.java:996)[optimized]

            at jrockit/vm/Locks.monitorEnter(Locks.java:2170)[optimized]

            at weblogic/socket/EPollSocketMuxer.processSockets(EPollSocketMuxer.java:153)

            at weblogic/socket/SocketReaderRequest.run(SocketReaderRequest.java:29)

            at weblogic/socket/SocketReaderRequest.execute(SocketReaderRequest.java:42)

            at weblogic/kernel/ExecuteThread.execute(ExecuteThread.java:145)

            at weblogic/kernel/ExecuteThread.run(ExecuteThread.java:117)

            at jrockit/vm/RNI.c2java(JJJJJ)V(Native Method)

            -- end of trace

        "Timer-1" id=28 idx=0xac tid=12683 prio=5 alive, waiting, native_blocked, daemon

            -- Waiting for notification on: java/util/TaskQueue@0x92b0c9b0[fat lock]

            at jrockit/vm/Threads.waitForNotifySignal(JLjava/lang/Object;)Z(Native Method)

            at java/lang/Object.wait(J)V(Native Method)

            at java/lang/Object.wait(Object.java:485)

            at java/util/TimerThread.mainLoop(Timer.java:483)

            ^-- Lock released while waiting: java/util/TaskQueue@0x92b0c9b0[fat lock]

            at java/util/TimerThread.run(Timer.java:462)

            at jrockit/vm/RNI.c2java(JJJJJ)V(Native Method)

            -- end of trace

        "VDE Transaction Processor Thread" id=31 idx=0xb0 tid=12684 prio=2 alive, waiting, native_blocked, daemon

            -- Waiting for notification on: com/octetstring/vde/backend/standard/TransactionProcessor@0x92b0ba48[fat lock]

            at jrockit/vm/Threads.waitForNotifySignal(JLjava/lang/Object;)Z(Native Method)

            at java/lang/Object.wait(J)V(Native Method)

            at java/lang/Object.wait(Object.java:485)

            at com/octetstring/vde/backend/standard/TransactionProcessor.waitChange(TransactionProcessor.java:367)

            ^-- Lock released while waiting: com/octetstring/vde/backend/standard/TransactionProcessor@0x92b0ba48[fat lock]

            at com/octetstring/vde/backend/standard/TransactionProcessor.run(TransactionProcessor.java:212)

            at jrockit/vm/RNI.c2java(JJJJJ)V(Native Method)

            -- end of trace

        "DoSManager" id=34 idx=0xb8 tid=12686 prio=6 alive, sleeping, native_waiting, daemon

            at java/lang/Thread.sleep(J)V(Native Method)

            at com/octetstring/vde/DoSManager.run(DoSManager.java:433)

            at jrockit/vm/RNI.c2java(JJJJJ)V(Native Method)

            -- end of trace

        "Timer-2" id=35 idx=0xbc tid=12687 prio=5 alive, waiting, native_blocked, daemon

            -- Waiting for notification on: java/util/TaskQueue@0x92b0ce80[fat lock]

            at jrockit/vm/Threads.waitForNotifySignal(JLjava/lang/Object;)Z(Native Method)

            at java/lang/Object.wait(J)V(Native Method)

            at java/util/TimerThread.mainLoop(Timer.java:509)

            ^-- Lock released while waiting: java/util/TaskQueue@0x92b0ce80[fat lock]

            at java/util/TimerThread.run(Timer.java:462)

            at jrockit/vm/RNI.c2java(JJJJJ)V(Native Method)

            -- end of trace

        "[STANDBY] ExecuteThread: '2' for queue: 'weblogic.kernel.Default (self-tuning)'" id=37 idx=0xc4 tid=13075 prio=5 alive, waiting, native_blocked, daemon

            -- Waiting for notification on: weblogic/work/ExecuteThread@0x872bbdf0[fat lock]

            at jrockit/vm/Threads.waitForNotifySignal(JLjava/lang/Object;)Z(Native Method)

            at jrockit/vm/Locks.wait(Locks.java:1964)[inlined]

            at java/lang/Object.wait(Object.java:485)[inlined]

            at weblogic/work/ExecuteThread.waitForRequest(ExecuteThread.java:205)[optimized]

            ^-- Lock released while waiting: weblogic/work/ExecuteThread@0x872bbdf0[fat lock]

            at weblogic/work/ExecuteThread.run(ExecuteThread.java:226)

            at jrockit/vm/RNI.c2java(JJJJJ)V(Native Method)

            -- end of trace

        "[STANDBY] ExecuteThread: '3' for queue: 'weblogic.kernel.Default (self-tuning)'" id=38 idx=0xc8 tid=13076 prio=5 alive, waiting, native_blocked, daemon

            -- Waiting for notification on: weblogic/work/ExecuteThread@0x872e99f8[fat lock]

            at jrockit/vm/Threads.waitForNotifySignal(JLjava/lang/Object;)Z(Native Method)

            at jrockit/vm/Locks.wait(Locks.java:1964)[inlined]

            at java/lang/Object.wait(Object.java:485)[inlined]

            at weblogic/work/ExecuteThread.waitForRequest(ExecuteThread.java:205)[optimized]

            ^-- Lock released while waiting: weblogic/work/ExecuteThread@0x872e99f8[fat lock]

            at weblogic/work/ExecuteThread.run(ExecuteThread.java:226)

            at jrockit/vm/RNI.c2java(JJJJJ)V(Native Method)

            -- end of trace

        "ConversationReaper" id=44 idx=0xe0 tid=13104 prio=5 alive, sleeping, native_waiting, daemon

            at java/lang/Thread.sleep(J)V(Native Method)

            at com/CompName/AppName/core/web/conversation/ConversationManager$ConversationReaper.run(ConversationManager.java:405)

            at jrockit/vm/RNI.c2java(JJJJJ)V(Native Method)

            -- end of trace

        "DynamicListenThread[Default]" id=47 idx=0xe8 tid=13106 prio=9 alive, in native, daemon

            at java/net/PlainSocketImpl.socketAccept(Ljava/net/SocketImpl;)V(Native Method)

            at java/net/PlainSocketImpl.accept(PlainSocketImpl.java:390)

            ^-- Holding lock: java/net/SocksSocketImpl@0x9224b198[biased lock]

            at java/net/ServerSocket.implAccept(ServerSocket.java:453)

            at java/net/ServerSocket.accept(ServerSocket.java:421)

            at weblogic/socket/WeblogicServerSocket.accept(WeblogicServerSocket.java:38)

            at weblogic/server/channels/DynamicListenThread$SocketAccepter.accept(DynamicListenThread.java:535)

            at weblogic/server/channels/DynamicListenThread$SocketAccepter.access$200(DynamicListenThread.java:417)

            at weblogic/server/channels/DynamicListenThread.run(DynamicListenThread.java:173)

            at java/lang/Thread.run(Thread.java:619)

            at jrockit/vm/RNI.c2java(JJJJJ)V(Native Method)

            -- end of trace

        "DynamicListenThread[Default[1]]" id=48 idx=0xec tid=13107 prio=9 alive, in native, daemon

            at java/net/PlainSocketImpl.socketAccept(Ljava/net/SocketImpl;)V(Native Method)

            at java/net/PlainSocketImpl.accept(PlainSocketImpl.java:390)

            ^-- Holding lock: java/net/SocksSocketImpl@0x922a64b0[biased lock]

            at java/net/ServerSocket.implAccept(ServerSocket.java:453)

            at java/net/ServerSocket.accept(ServerSocket.java:421)

            at weblogic/socket/WeblogicServerSocket.accept(WeblogicServerSocket.java:38)

            at weblogic/server/channels/DynamicListenThread$SocketAccepter.accept(DynamicListenThread.java:535)

            at weblogic/server/channels/DynamicListenThread$SocketAccepter.access$200(DynamicListenThread.java:417)

            at weblogic/server/channels/DynamicListenThread.run(DynamicListenThread.java:173)

            at java/lang/Thread.run(Thread.java:619)

            at jrockit/vm/RNI.c2java(JJJJJ)V(Native Method)

            -- end of trace

        Blocked lock chains

        ===================

        Chain 2:

        "ExecuteThread: '1' for queue: 'weblogic.socket.Muxer'" id=25 idx=0xa0 tid=12679 waiting for java/lang/String@0x92a32e70 held by:

        "ExecuteThread: '2' for queue: 'weblogic.socket.Muxer'" id=26 idx=0xa4 tid=12680 in chain 1

        Chain 3:

        "ExecuteThread: '3' for queue: 'weblogic.socket.Muxer'" id=27 idx=0xa8 tid=12681 waiting for java/lang/String@0x92a32e70 held by:

        "ExecuteThread: '2' for queue: 'weblogic.socket.Muxer'" id=26 idx=0xa4 tid=12680 in chain 1

        Open lock chains

        ================

        Chain 1:

        "ExecuteThread: '0' for queue: 'weblogic.socket.Muxer'" id=24 idx=0x9c tid=12678 waiting for java/lang/String@0x92a32e70 held by:

        "ExecuteThread: '2' for queue: 'weblogic.socket.Muxer'" id=26 idx=0xa4 tid=12680 (active)


text:
Q: Process.Start giving file not specified error in .net core I want to do printing in .net core.
To do this I am using Process of System.Diagnostics.
I tried following code below:
var printJob = new Process
{
    StartInfo = new ProcessStartInfo
    {
        FileName = path,
        UseShellExecute = true,
        Verb = "print",
        CreateNoWindow = true,
        WindowStyle = ProcessWindowStyle.Hidden,
        WorkingDirectory = Path.GetDirectoryName(path)
    }

};
But Verb property is missing in StartInfo in .net core.
So then I decided to do printing as follows:
Process.Start("LPR -S ip -P 'Star TSP800L Peeler (TSP828L)' -o 'D:\testpdf.pdf'");

But it gives me

The system cannot find the file specified

whereas the file is present at given location.
Right now I am trying to test with local printer on my windows 10 machine, but what I need is to print to network printer from ubuntu machine.
Can someone tell me, why I am getting file not found error.
I have found following link, but it is using StartInfo, which is not helpful to me in this case.
Process.Start in C# The system cannot find the file specified error
Error in Process.Start() -- The system cannot find the file specified

A: Do something like this:
 public static void PrintToASpecificPirnter()
        {
            using (PrintDialog printDialog = new PrintDialog())
            {
                printDialog.AllowSomePages = true;
                printDialog.AllowSelection = true;
                if (printDialog.ShowDialog() == DialogResult.OK)
                {
                    var StartInfo = new ProcessStartInfo
                    {
                        CreateNoWindow = true,
                        UseShellExecute = true,
                        Verb = "printTo",
                        Arguments = "\"" + printDialog.PrinterSettings.PrinterName + "\"",
                        WindowStyle = ProcessWindowStyle.Hidden,
                        FileName = fileName
                    };

                    Process.Start(StartInfo);
                }

            }
    }


text:
Q: components not appearing after JLayeredPane I have a single class extended from JFrame. I have multiple JLayeredPanes inside it. I want to switch from one JLayeredPane to another. For that what I does is;

*

*remove the current JLayeredPane like remove(pane1);

*repaint();

*add components to new JLayeredPane and set bounds

*add(pane2)
This removes my current JLayeredPane  and shows next JLayeredPane. But the components are not added in correct position. For example, I have a jscrollpane containing a textarea. Only the scroll pane is appearing and text area is missing. Also, the size of comboboxes has changed. Why is this happening?
Here is a zip file containing entire java files http://s000.tinyupload.com/index.php?file_id=33381866612121130517

A: I combined this JLayeredPane example with this CardLayout example to demonstrate multiple, selectable layered panes.

import java.awt.BorderLayout;
import java.awt.CardLayout;
import java.awt.Color;
import java.awt.Dimension;
import java.awt.EventQueue;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.RenderingHints;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.util.Random;
import javax.swing.JComboBox;
import javax.swing.JFrame;
import javax.swing.JLayeredPane;
import javax.swing.JPanel;

/**
 * @see https://stackoverflow.com/a/36587584/230513
 * @see https://stackoverflow.com/a/6432291/230513
 * @see https://stackoverflow.com/questions/6432170
 */
public class CardPanel extends JLayeredPane {

    private static final Dimension d = new Dimension(320, 240);
    private static final Random random = new Random();
    private static final JPanel cards = new JPanel(new CardLayout());
    private static final JComboBox combo = new JComboBox();
    private final String name;

    public CardPanel(String name) {
        this.name = name;
        this.setBackground(new Color(random.nextInt()));
        this.add(new LayerPanel(1 * d.height / 8), 100);
        this.add(new LayerPanel(2 * d.height / 8), 101);
        this.add(new LayerPanel(3 * d.height / 8), 102);
    }

    @Override
    public Dimension getPreferredSize() {
        return d;
    }

    @Override
    public String toString() {
        return name;
    }

    private static class LayerPanel extends JPanel {

        private static final Random r = new Random();
        private int n;
        private Color color = new Color(r.nextInt());

        public LayerPanel(int n) {
            this.n = n;
            this.setOpaque(false);
            this.setBounds(n, n, d.width / 2, d.height / 2);
        }

        @Override
        public void paintComponent(Graphics g) {
            super.paintComponent(g);
            Graphics2D g2d = (Graphics2D) g;
            g2d.setRenderingHint(
                RenderingHints.KEY_ANTIALIASING,
                RenderingHints.VALUE_ANTIALIAS_ON);
            g2d.setColor(color);
            g2d.fillRoundRect(0, 0, getWidth(), getHeight(), 16, 16);
            g2d.setColor(Color.black);
            g2d.drawString(String.valueOf(n), 5, getHeight() - 5);
        }
    }

    public static void main(String[] args) {
        EventQueue.invokeLater(new Runnable() {

            @Override
            public void run() {
                create();
            }
        });
    }

    private static void create() {
        JFrame f = new JFrame();
        f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        for (int i = 1; i < 9; i++) {
            CardPanel p = new CardPanel("Panel " + String.valueOf(i));
            combo.addItem(p);
            cards.add(p, p.toString());
        }
        JPanel control = new JPanel();
        combo.addActionListener(new ActionListener() {

            @Override
            public void actionPerformed(ActionEvent e) {
                JComboBox jcb = (JComboBox) e.getSource();
                CardLayout cl = (CardLayout) cards.getLayout();
                cl.show(cards, jcb.getSelectedItem().toString());
            }
        });
        control.add(combo);
        f.add(cards, BorderLayout.CENTER);
        f.add(control, BorderLayout.SOUTH);
        f.pack();
        f.setLocationRelativeTo(null);
        f.setVisible(true);
    }
}


text:
Q: Determining $\text{Aut}(\mathbb{Z}_{3} \times \mathbb{Z}_{4} \times\mathbb{Z}_{5}).$ The way I attempted to solve it was to use the fact that $\text{Aut}(\mathbb{Z}_3 \times \mathbb{Z}_4 \times \mathbb{Z}_5) \cong U(3) \times U(4) \times U(5) \cong \mathbb{Z}_2 \times \mathbb{Z}_2 \times \mathbb{Z}_4$. However, we technically were not allowed to use this fact. So, I was wondering how one could solve this just from knowing that $\text{Aut}(\mathbb{Z}_3 \times \mathbb{Z}_4 \times \mathbb{Z}_5) \cong \text{Aut}(\mathbb{Z}_{60}) \cong \mathbb{Z}_{60}^{\times}?$ I'm guessing one could just write out the elements of $\mathbb{Z}_{60}^{\times}$ by hand and solve it that way, but is there a faster way than that?

A: Hint If $f \in \text{Aut}(\mathbb{Z}_3 \times \mathbb{Z}_4 \times \mathbb{Z}_5)$ then
$$f(1,0,0) \mbox{ has order } 3 \\
f(0,1,0) \mbox{ has order } 4 \\
f(0,0,1) \mbox{ has order } 5$$


text:
Q: Type check an Any variable for Data Class I have a class that has a constructor of type Any. I'm passing an instance of a Data Class to that constructor. How can I type check the Any variable to make sure it contains a Data Class?
What I tried so far:
private var myObject : Any

fun dataClassTypeCheck(): Boolean {
      if (myObject is KClass<*>) {return true}
      return false
    }

A: If you want to know if myObject has a type which is a data class then it's:
myObject::class.isData.
If you want to know if myObject is a KClass object of a data class then it's: myObject.isData

A: if you have Class<?>:
MyObjectClass::class.java.kotlin.isData

and if you have instance of class:
myObject.javaCalass.kotlin.isData


text:
Q: How to run a loop in R using a matrix rather than a vector? I am using DESeq2 and I would like to extract expression counts of a list of genes I am interested in using the function plotCounts and then plot them.  The genes are stored as Ensembl names.
I can do this quite easily using a for loop with a vector containing the list of Ensembl names (eg, ENSEMBL_name below), but I would like to label the plots with the more informative gene symbols (short names).
I have a matrix with the Ensembl names and associated symbols (for eg):
ENSMBL_name <- c("ENSMUSG00000005066", "ENSMUSG00000008873", "ENSMUSG00000001098", "ENSMUSG00000012879")
Symbol_name <- c("gene_dp", "gene_uf", "gene_yn", "gene_xx")

GENE_names <- cbind(ENSMBL_name, GENE_name)

I would like to use the ENSEMBL_name column to get the plotCounts data for the particular gene and then label it with the associated Symbol_name. Something like the following:
<SYMBOL_name>_Counts <- plotCounts(dds, gene = "<ENSMBL_name>", intgroup = c("KO", "Cond"),
                          returnData = TRUE)

<SYMBOL_name>_plot <- ggplot(<SYMBOL_name>_Counts, aes(x = factor(Cond, levels = c("NON", "IND")), y = count, color = Geno, group = Geno)) +
  scale_y_log10() + ggtitle("<SYMBOL_name>")

The <ENSEMBL_name> and <SYMBOL_name> are where I would like the ensemble and gene symbols from the GENE_names matrix to be inserted.
As far as I understand, if I do a nested loop with the GENE_names then it would run all of the symbols vs each Ensemble name (or vice versa) and I can't get my head around using any of the apply functions for this.
I'm sure there is a very simple way of doing this, but it is beyond my current level of R programming ability. Any help would be appreciated.


text:
Q: Installing new Node.js in Rasberry OS on VM - no such file or directory after 'node' command I tried to install latest version od node with
'nvm install node'
After that when I use command 'node' I have message:
-bash: /home/pi/.nvm/versions/node/v16.14.2/bin/node: No such file or directory
When I try:
'sudo apt-get install nodejs-legacy'
I have message:
'Package nodejs-legacy is not available, but is referred to by another package.'
What am I doing wrong?


text:
Q: Find Page Last Modified at Certain Date & Time How can I find the page which was last modified on 2011-07-20T20:48:16+00:00 other than opening every page?

A: Okay, I've got it.
I looked in wp_posts table in phpmyadmin, clicked on the post_modified column to get it in chronological order, and looked for the appropriate datetime.


text:
Q: React NW.js menubar setup crash I created a React NW.js application using the npx create-nw-react-app ... command line. I'm working in a Linux environment.  So far, so good. I managed to make it work with some custom configuration like window size or title. But when I tried to setup a menu, the application just crashed to desktop. As the documentation said, I wrote in the index.tsx file:
    var menu = new nw.Menu({ type: 'menubar' });

    var submenu = new nw.Menu();
    submenu.append(new nw.MenuItem({ label: 'Item A' }));
    submenu.append(new nw.MenuItem({ label: 'Item B' }));

    menu.append(new nw.MenuItem({
      label: 'First Menu',
      submenu: submenu
    }));

    nw.Window.get().menu = menu;

No variables are null, but this is not working. Any idea?
Thanks for your help!

A: This appears to be a bug with the latest builds of NW.js and is not related to React.
I can recreate the crash by simply running nw.exe by itself (version 0.64.1), right-clicking the window to open DevTools, and entering the following in the console:
nw.Window.get().menu = new nw.Menu({ type: 'menubar' });

If I downgrade to 0.62.2, the same command works without crashing. It looks like an issue has already been opened: https://github.com/nwjs/nw.js/issues/7870


text:
Q: R: make symmetric matrix from lower diagonal I have a lower triangular of a matrix that I'm trying to convert to a dissim matrix and thus it needs to be symmetric.
print(rdf)

         X0        X1        X2        X3 X4
0 0.0000000        NA        NA        NA NA
1 0.5340909 0.0000000        NA        NA NA
2 0.5340909 0.0000000 0.0000000        NA NA
3 0.3200000 0.5227273 0.5227273 0.0000000 NA
4 0.6263736 0.4945055 0.4945055 0.5384615  0

library(gdata)
upperTriangle(rdf) <- lowerTriangle(rdf)
isSymmetric(rdf)
       X0        X1        X2        X3        X4
0 0.0000000 0.5340909 0.5340909 0.6263736 0.4945055
1 0.5340909 0.0000000 0.3200000 0.0000000 0.5227273
2 0.5340909 0.0000000 0.0000000 0.5227273 0.4945055
3 0.3200000 0.5227273 0.5227273 0.0000000 0.5384615
4 0.6263736 0.4945055 0.4945055 0.5384615 0.0000000
[1] FALSE

What is going on? Note, I don't need to use gdata

A: You need to make sure that the elements you're copying are ordered correctly:
m <- matrix(NA,4,4)
m[lower.tri(m,diag=TRUE)] <- 1:10
     [,1] [,2] [,3] [,4]
[1,]    1   NA   NA   NA
[2,]    2    5   NA   NA
[3,]    3    6    8   NA
[4,]    4    7    9   10

makeSymm <- function(m) {
   m[upper.tri(m)] <- t(m)[upper.tri(m)]
   return(m)
}
makeSymm(m)

Or you can use the built-in
Matrix::forceSymmetric(m,uplo="L")


text:
Q: Measure theory proof verification. A specific property of sets with positive measure and the Lebesgue measure. I have a proof for the following question, could someone please verify it as i'm not confident whether its right.

Let $E\subset \mathbb{R}$, such that  $m(E)>0$, and $m(E^c)>0$ where $m$ denotes the Lebesgue measure. Show that there exists an $x\in \mathbb{R}$, $r_n \rightarrow 0$ such that: $$\frac{1}{4}\leq \lim_{n\rightarrow \infty} \frac{m([x-r_n,x+r_n]\cap E)}{2r_n}\leq \frac{3}{4}$$
In proving this, we're allowed to use a stronger result: Besicovitcz theorem: $\exists x\in \mathbb{R}$ $$\frac{1}{4}\leq \liminf \frac{m([x-r,x+r]\cap E)}{2r} \leq \limsup \frac{m([x-r,x+r]\cap E)}{2r} \leq \frac{3}{4}$$

$Proof$
Following the hint by GEdgar:    Given an $x$ satisfying the stronger result you are allowed to use, choose a sequence $r_n→0$ so that you approach the $\limsup$.
Besicovitcz theorem gives us the required $x \in \mathbb{R}$. lets call $f(r)=\frac{m([x-r,x+r]\cap E}{2r}$, and lets call $A=\lim_{R \rightarrow 0} \sup_{0\leq r\leq R} f(r)$.
Now lets have a general sequence. We can let $r_1$ be anything so lets have $r_1=1$. Also, let $0\leq r_n \leq \frac{1}{2^{n-1}}$.  Limsup always exists, so bu definition of a limit, if $0< R< \delta$, then $|\sup f(r) -A| < \frac{1}{2^n}$. Take $R< \min(\delta,\frac{1}{2^n})$ (to ensure that its bounded $\frac{1}{2^n}$. )
Then we start choosing $0<r_n< R$ such that $|f(r_n)-\sup_{0<r<R} f(r)|< \frac{1}{2^n}$. So then for $0<r_n< R< \min (\delta, \frac{1}{2^n})$, by the triangle inequality: $|f(r_n)-A|<\frac{1}{2^{2n}}$. So letting $n\rightarrow \infty$, we get that $f(r_n)\rightarrow A$.


text:
Q: Questions of string comparison in oracle I am reading basics of oracle and came across strange statement.  I don't know how much true it is.
Statement says

"   String value '2' is greater than String value '100'.   Character
  '1' is less than Character '10'. "

Kindly throw some light on above topic.  I understand that internally comparison must be happening using ASCII values.  I am seeking some good logical explanation.

A: It means that numbers treated as strings are not sorted in numerical order but in lexical order, the same way words are sorted in a dictionary. That is, characters are compared one at a time from the left side.
In your first example, "2" is greater than "100" because the '2' is compared to the '1' and found to be bigger. Compare this to the ordering of "C" and "BAA" in a dictionary.
In your second example, "1" is less than "10" because the "1" fully matches the "1" in the left side of "10", but the "10" has characters following the match. Therefore it is greater. Again, compare this to the ordering of "B" and "BA" in a dictionary.

A: You are exactly correct in assuming that they are sorted by ASCII values - this is called an alphabetic sort.  The strings are sorted not as numeric values but as text.
The alphabetic sort compares the values position by position.  When comparing the string '2' with the string '100' it starts by comparing '2' with '1'.  '2' comes after '1' (the ASCII values of '2' is greater than the ASCII value of '1') alphabetically so the comparison stops so '100' will be listed before '2' in an alphabetic sort.  This is exactly equivalent as comparing 'b' to 'azz' - since 'a' comes before 'b', 'azz' will be sorted before 'b'.
Your text is pointing this out because this behavior while understandable is non-intuitive.  You would expect a sort to place '100' after '2' since 2 < 100, but that is not was the sort does.


text:
Q: What criteria should be used in deciding whether or not to create another Visual Studio Project (.NET)? I have a large solution with around a hundred projects. Some people say it's too much, other people say it could be ok. The root of the question really is what criteria should be used in deciding whether or not to create another Visual Studio Project, as opposed to using one that already exists? What's the best practice?
For example:
1) Should I create a new project when adding a new feature that is somewhat independent of other existing features? Would this be a right or wrong reason to create a new project. Should namespaces here be used instead?
2) Should I create a new project when developing another tier or layer (the classic Data Access, Business, Presentation layers). Should namespaces here be used instead?
3) Should I create new projects to separate my interfaces from my implementation. Is this enough of a reason to create a new project?
Etc. These sub questions don't really need to be answered specifically, but this is the kind of criteria I'm looking for.
Thanks

A: Basically I would say that you need to create a new project when you need to create a new assembly that will be used by at least 2 assemblies, for the rest just use the namespaces.
For example, say you have a business logic layer, and it is used in 2 different applications that share some common rules, you can create a new project.
If later you want to add new rules specific to other projects, you can still use the namespace BusinessLogic but create a new project.
The thing is to understand the use of namespaces and assemblies. To me:

*

*Namespaces are useful to separate concerns, like BusinessLogic shouldn't be in the same namespace as DataAccess.

*Assemblies are useful for technical reasons, like I want to use this assembly in other assemblies.

By following these definitions you can easily refactor your code, or create a new assembly from existing code that needs to be used elsewhere after some time without changing your namespaces and editing existing working code.
To answer your specific questions:
1) If this is a "pluggable" feature that will be instantiated dynamically then yes, if not you don't need to do it (I don't say it would be bad though)
2) Namespaces should be used anyway
3) Here I would say yes if you instantiate your implementations dynamically, otherwise namespaces would do the job

A: For maintaining these large no. of projects, use Solution Folders which are used to group projects that fall into same functionality, layer, tier, See Using Solution Folders on MSDN.
Also see these articles and SO QA for help reference and suggestions on structuring solution and projects in Visual Studio:
How to structure Visual Studio solutions
See new VS tool: Layered Architecture Solution Guidance 2012
Solution: Per application, or per application suite
The Ultimate Visual Studio Solution Structure
Structuring Solutions in Visual Studio and Team Foundation


text:
Q: How to ScaleContent the image inside a TileList im in Flash CS5.
I have a TileList that loads its images from an XML, not all the images are the same size so they do not llook consistent wiyh the TileList.
So i want the TileList to Scale the images it gets from the XML.
How can i do this?
Thank you for any help i received.

A: This should do what you want.
img.addEventListener(Event.COMPLETE, onLoad )
private function onLoad( e:Event ):void{
  var scale:Number = (targetHeight) / img.contentHeight;
  this.img.scaleX = scale;
  this.img.scaleY = scale;
}


text:
Q: How to append an element to each element of a list ? (Prolog) I'll like to append an element to each element of a list. the element must be a list too.
Exemple :
A = [a,b,c]
B = [ele,ele2]

The result would be:
R = [[a,ele,ele2],[b,ele,ele2],[c,ele,ele2]]

I tried
 maplist(custom_append,A,B,R).

But it returns false with
custom_append(X,Y,[X|Y]).

How can I achieve this ?

A: Note that B is not a list over which you want to iterate, you want to append an element of A to the same list B.
The easiest way to achieve this, is probably by swapping the order of the elements in the custom_append/3 to:
custom_append(Y, X, [X|Y]).
and then we can obtain this by using a maplist/3:
maplist(custom_append(B), A, R).
we thus already make something that behaves quite similar to partial application: we pass a functor custom_append(B), and Prolog will then make a call with custom_append(B, Ai, Ri) (Ai and Ri are here used to denote the elements of the lists A and R).

A: The straightforward way would be like this:
append_list([], _, []).

append_list([A|As], B, [[A|B]|Cs]) :-
    append_list(As, B, Cs).

Don't even need to use maplist.


text:
Q: Can we customize/brand the `setup/connect` page used in the Device Authentication OAuth flow? We have a device app using the Device Authentication OAuth flow towards Salesforce.
This flow returns an url (https://domain/setup/connect) and a user code that the user has to enter into the page at this url, after which Salesforce returns an access token to the app.
If we use a community url as the domain in the first step of the Device Authentication flow, it returns a url that's specific for this community, f.i. https://mysandboxdomain.cs85.force.com/communityname/setup/connect (A generic link would be test.salesforce.com/setup/connect).
This page allows the user to enter said user code and then redirects to the community login where the user can login using username/password or social. This all works fine and gives the device app an access token through a services/oauth2/token url it was polling after successful authentication.
Now my question is, can we brand or customize the setup/connect page that redirects to our community? Even just adding a logo and changing some colors would help, but if Visualforce or Lightning can be used it would be great.
PS.
There seems to be a difference (color mainly) between the community url and the generic test url, which make me suspect there must be something possible:
https://mysandboxdomain.cs85.force.com/communityname/setup/connect

test.salesforce.com/setup/connect

A: The different background color already made me suspect that something would be possible and it indeed is.
You can change the logo, the background color and the footer in the Community Administration settings, under Login and Registration

The results:


text:
Q: For which $k \in \mathbb{N}$ and $p \in[1,\infty]$ is $u \in W^{k,p}(B_1(0))$? Let $u: \overline B_1(0)\subset\mathbb{R^2}\to\mathbb{R}$ defined by
$$u(x_1,x_2)=x_1x_2(1-\sqrt{x_1^2+x_2^2})$$
For  which $ k \in \mathbb{N} $ and $ p \in[1,\infty] $ is $ u \in W^{k,p}(B_1(0)) $ ?
I  don't  have any  clue. Thanks  for  helping !


text:
Q: Add new button to Custom Object Lookup dialog box I have a number of lookup fields on an object.  When I click the magnifying glass to select items from the lookup the Account and Contact object lookup dialogs have a "New" button next to the go.

However, for my custom objects, there is no button to create a new record from the dialog box.

Is there a way to have a new button from there?  Or is there a way to have a custom button OR link on the Add/Edit pages such that I can quick create a record for a lookup on the parent object without leaving the page.
Otherwise, for all of my custom objects people must go to a number of different lookup objects, create the records, then go to the detail object and add all the fields.

A: So that "New" button is a feature called "Quick Create" It's an old old old feature.
Right now, it does not support custom objects. You can vote on the idea here: https://success.salesforce.com/ideaView?id=08730000000BqPaAAK
something to consider is that Quick Create will ignore any validation rules you have on those objects. Many admins frown upon it's use because it can cause a lot of bad or incomplete data to be created in the system.
Some options you can consider instead of having them go to a different tab to create:

*

*Look into creating Quick Actions (Chatter Publisher Actions) to create the records

*Replace all your pages with visualforce pages so you can create your own version of quick create (Don't do this! Terrible idea but I wanted at least 2 items)

Quick actions are really your best bet but you can't do them from the lookup dialog window. But it would save them from having to leave the record they're viewing.


text:
Q: Central Limit Theorem Approximation Exercise
Every time Sherry buys a book it is a math book with probability 0.3
  and a novel with probability 0.7. Sherry keeps her math books in a
  bookcase that can hold 50 math books and keeps her novels in a
  different bookcase that can hold 100 novels. What is the probability
  that she fills up her math bookcase before she fills up her novels
  bookcase, assuming they are initially empty? Assume Sherry continues
  her book buying patterns even after one or both of her bookcases gets
  filled.
  Use indicator random
  variables and the central limit theorem to approximate the desired probability.

Question: Is be attempt below correct?
My attempt:
Let p = 0.3, n = 149 purchases
$P$[she fills up at least 50 math books in 149 purchases] = $P$[($X$ - np)/ √(np(1-p))] = $P$[($X$ - (149)(0.3))/√(149(0.3)(0.7)) ≥ (50 - 44.7)/√(31.29)] = $P$[$Z$ ≥ 0.95] = $0.8289$
Therefore, the probability of filling up her math bookcase before her novel bookcase is approximately 83%.


text:
Q: SQL replacing a value in a table and field I have a table named BAO.CLASS and a First_name field. Inside the firstnamr field I need to replace  all names that has letter  "A" with number "1" please help

A: Query:
UPDATE BAO.CLASS
SET firstname = 1
WHERE firstname like '%A%'

A: UPDATE BAO.CLASS
SET First_name = 1
WHERE First_name like 'A%'
Because %A% will replace everything with an A in it, and A% will replace only the names that will start with an A, %A will replace everything that ends with an A.
http://www.w3schools.com/sql/sql_like.asp

A: You mean to replace all occurences of 'A' with '1'? With most database systems, use:
UPDATE BAO.CLASS
SET First_name = REPLACE(First_name, 'A', '1')
WHERE First_name LIKE '%A%'

But honestly, first try to make yourself more clear.


text:
Q: How do I set-up a search box in IE 9 like the one that was available in IE 8? In the top left-hand side in IE 8 there was a convenient search box which I loaded with DuckDuckGo.  I liked to be able to use this engine so easily but I just upgraded to IE 9 and there is no search box...how do I search my preferred engine directly from IE 9?

A: IE9 doesn't have a separate search box, instead it lets you search directly from the address bar. It works pretty much the same as the search box in previous versions: press Ctrl+E, type your query and press Enter.
For more information, see here:
http://windows.microsoft.com/en-US/windows7/Search-with-the-Internet-Explorer-9-Address-bar
If DuckDuckGo isn't currently your default search provider, you can select it at the bottom of the search result list that appears when you press Ctrl+E. If it isn't even listed there (though it should be, if you used it in IE8), go to http://duckduckgo.com/ and add it using the "IE" link at the bottom.

A: See this question/answer on Microsoft's Answers site.
You want to click the dropdown arrow next to the address bar:

A: Search for Quero Toolbar. Install the Quero Toolbar. It adds a search box to the right of the Menu toolbar in IE 9, 10, 11. Please print out and read about all the options.
Sorry can't post an picture of IE and Quero Toolbar


text:
Q: Django in-memory database model creation failure I'm using MariaDB MEMORY engine. I defined max_heap_table_size in my.cnf, restarted the database service. Now, I run the migration and get:
django.db.utils.ProgrammingError: Storage engine MEMORY doesn't support BLOB/TEXT columns
My erroneous model is:
class Department(models.Model):
    name = models.CharField(max_length=100)
    tag = models.CharField(max_length=10)
    dtype = models.PositiveSmallIntegerField()
    info = models.CharField(max_length=64000)

Though, max VARCHAR is 65535.What is the problem?

A: As the docs state here, 65.535 are actually bytes, which leads to a maximum of 21.844 characters if using UTF-8.

A variable-length string. M represents the maximum column length in
  characters. The range of M is 0 to 65,535. The effective maximum
  length of a VARCHAR is subject to the maximum row size (65,535 bytes,
  which is shared among all columns) and the character set used. For
  example, utf8 characters can require up to three bytes per character,
  so a VARCHAR column that uses the utf8 character set can be declared
  to be a maximum of 21,844 characters.

Since the max_length of a CharField in a Django model specifies the length in characters rather than in bytes, I assume this is what causes the error.

A: Make the table MyISAM or InnoDB.  Either will quickly cache your string, thereby making respond as if it were "in-memory".
As for the confusing error message -- a VARCHAR that needs more than 64K bytes is silently turned into MEDIUMTEXT.
If your string can be broken into multiple pieces, you could have multiple rows.  (Have a second column with a row number of some kind.)


text:
Q: Indentation superfunction LaTeX There are a lot of questions on here that are about indentation and I feel like what most people are looking for is something similar to the following.
It would be nice to have some sort of function to call, \indent{}, so that everything sounded by {} was placed one tab length from the left margin.
Also, the ability to call this function inside itself, so that, for instance,
 %this is an example of what I am talking about.
\indent{
    textbody1

    \indent{
        textbody2
    }
}

resulted in the entirety of textbody2 being one tab unit away from the entirety of textbody1's left margin.
Is this possible?

A: Since \indent is already used, I used \myindent and used \mytab for the "tab" size.  Pretty much any length will do.
\documentclass{article}
\usepackage{lipsum}
\usepackage{showframe}

\newlength{\mytab}
\setlength{\mytab}{\bibindent}

\newcommand{\myindent}[1]% #1 = text to be indented
{\ifvmode\else\par\fi
\bgroup\advance\leftskip by \mytab
#1\egroup\par}

\begin{document}
\lipsum[1]
\myindent{\lipsum[2]
  \myindent{\lipsum[3]}
  \lipsum[4]
}
\lipsum[5]
\end{document}

A: You can use lists, with the help of enumitem for setting parameters more easily.
\documentclass{article}
\usepackage{enumitem}

\usepackage[nopar]{lipsum} % just for the example

\newenvironment{subindent}[1][0.5in]
  {\itemize[label={},leftmargin=#1,nosep]\item\relax}
  {\enditemize}

\begin{document}

\lipsum[2]
  \begin{subindent}
  \lipsum[3]
    \begin{subindent}[1in]
    \lipsum[4]
    \end{subindent}
  \lipsum[5]
  \end{subindent}
\lipsum[6]

\end{document}


text:
Q: Automatically copying dll.config to a referenced projects output directory I used the method suggested in the following post to include an App.config file to Class Library project.
Equivalent to 'app.config' for a library (DLL)
It works as mentioned and creates the .dll.config file in respective Class Library projects output directory (e.g. ApiCommunicator\bin\Debug).
I have referenced this Class Library project as a "Project Reference" from another Console Application project within the same Visual Studio solution.
Now the problem is, the .dll is getting copied to the Console Projects output directory (i.e. Engine\bin\Debug) but the .dll.config doesn't. If I manually copy it, everything works fine but is there a way to configure Visual Studio to auto copy .dll.config to any other project's output directory which references the Class Library project?
Thanks,
Bathiya

A: Although I am late, but my answer can help others. I used the following command as pre-build event:
copy /Y $(SolutionDir)\[YOUR_LIBRARY_PROJECT]\app.config $(ProjectDir)$(OutputPath)[YOUR_LIBRARY_NAME].dll.config
I tried to be dynamic as much as possible, and the above command worked.
I posted the same answer at the question Can we autocopy the *.dll.config? as well.

A: It would have to be the other way around: Projects referencing your dll could copy it's dll.config from a known location as a post-build event.
However I think it would be much better to provide the configuration from within the consumer application's configuration. That way each referencing project would have an option to adjust the configuration to its needs, which I would think is a critical feature.
If that is not the case, then I don't see the reason for having the .dll.config, and you can just hardcode the values.

A: You can use the 'Build Events' tab of your project properties to run command line instructions post-build or even pre-build. This way, you can use a simple
copy /Y "<yourconfigfilepath>" "<yourprojectfilepath>\Engine\bin\Debug\"

This will copy the dll.config file you are needing over to the correct directory.


text:
Q: Forbidden Response Code in Image Fetch I'm a little confused with exactly what's going on with this request. As you can see by clicking on the link with a standard browser, the item image displays fine with a 200 response code. (This can be seen by opening the developer tools in the network section of most browsers.) However, I wrote a script that will ping the URL for the response code using standard Java classes, and I'm getting a 403 Forbidden response code:
static public void main(String[] args) throws IOException
{
    URL my_url = new URL("http://www.gessi.it/static/images/products/zoom/01410.png");

    URLConnection u = my_url.openConnection();

    if (u instanceof HttpURLConnection)
    {
        HttpURLConnection http_u = (HttpURLConnection) u;

        System.out.println("Response code: " + http_u.getResponseCode());
        System.out.println("Response message: " + http_u.getResponseMessage());
    }
}

Does anyone know why the script would receive the forbidden code, while standard browsers can view the image just fine? In the past, I've seen some image fetches fail with my scripts, because Java can't natively handle complicated 302 redirects and such, but there's none of that in this case.

A: http_u.setRequestProperty("User-Agent", "Mozilla 9.10");

The server looks for the User-Agent request header so it does not need to serve crawlers, harvesters and the like.


text:
Q: Python app with its menu added to the right click of the OS mouse I would like to know if it is possible, using python, to create a desktop application which is added to the mouse right click menu and add sub items to it. And also, how to link a sub menu item with a function in my code.
For instance, if a user is reading a PDF; he would :

*

*select a text

*right click on the mouse and find the app entry on the mouse's right click menu

*click it,

*gets a list of sub menus of the entry

*selects one and that should perform a function of the app.

A: Take a look at this article:
https://msdn.microsoft.com/en-us/library/windows/desktop/cc144171(v=vs.85).aspx
Hope it helps.


text:
Q: Filter in ng-repeat on clicking Button I have a Json which m getting in $scope.notifications.
**Json**
0:{
    $$hashKey: "object:31"
    action: "wrote a comment"
    creationDate: "2015-11-23 13:48:55.0"
    post: Object
    seen: true
    user: Object
   }

This Json has a key : seen which can be either true or false . I have to filter out those objects in ng-repeat whose key :seen is= false on clicking button unread notifications.
and then again clear the filter on clicking All Notifications button.
HTML

            <button type="button" class="btn btn-link btnUnreadFilter active" data-filter="all" id="btnShowAll">All Notifications</button>

             <button type="button" class="btn btn-link btnUnreadFilter" data-filter="unread" id="btnShowOnlyUnread" ng-click="actions.unreadNotifications()">Unread Notifications</button>

            <button type="button" class="no-click-bind" data-toggle="tooltip" data-placement="top" data-original-title="Mark as read"  ng-click="actions.redirectToPost(notification.post.uuid, $index)">

            </button>

                {{notification.user.authorName}} {{notification.action}}
                {{notification.post.title}}

 Jan 21 2016

A: Try something like:
ng-repeat="notification in notifications | filter:seenFilter"

where seenFilter is set to {seen:true}, {seen:false} or true by the controller. Example:
$scope.actions.unreadNotifications = function(){
  $scope.seenFilter = {seen:false}
}


text:
Q: Transparent background for WPF Listview Header I wish to create a table using ListView.
The background of table header must be transparent.
How to achieve this?

A: Set the Background of the ListView to Transparent and define a GridViewColumnHeader style that sets its Background to Transparent:
<ListView ...
          Background="Transparent">
    <ListView.Resources>
        <Style TargetType="GridViewColumnHeader">
            <Setter Property="Background" Value="Transparent" />
        </Style>
    </ListView.Resources>
    <ListView.View>
        <GridView>
            <GridViewColumn .../>
        </GridView>
    </ListView.View>
</ListView>


text:
Q: No emitters found for type ext-json I have this error "No emitters found for type ext-json" in running my django...
i dont have any idea about my situation.
i just followed this tutorial and the example is good.
http://weblog.mattdorn.com/content/restful-web-apps-with-django-piston-and-ext-js/
i have followed on making handlers.py, emmiters.py and the others step...
this my url.py
from django.conf.urls.defaults import *
from piston.resource import Resource
from phonebook.api.handlers import PhonebookHandler

phonebook_handler = Resource(PhonebookHandler)

urlpatterns=patterns('',
    url(r'^phonebooks/(?P<id>\d+)/$',phonebook_handler, {'emitter_format': 'ext-json'}),
    url(r'^phonebooks$',phonebook_handler, {'emitter_format': 'ext-json'}),
)

my emitters.py and handlers.py is same to the tutorial,... the different is my models.py
from django.db import models
from django.contrib.auth.models import User

CHOICES = (
    (u'M', u'Male'),
    (u'F', u'Female'),
)

class Phonebook(models.Model):
    fullname = models.CharField(max_length=50,null=True)
    address = models.CharField(max_length=100,null=True)
    age = models.IntegerField(max_length=2,null=True)
    gender = models.CharField(max_length=1, choices=CHOICES)
    phonenumber = models.CharField(max_length=15,null=True)
    def __unicode__(self):
        return self.fullname

is there are any installation about ext-json?

A: You need to import your custom emitter class at some point so that it gets registered.


text:
Q: Configure OLEDB Data Source in Coldfusion I need to access a 3rd Party software database using their propriety OLEDB connector. I've installed their OLEDB software and can confirm using Regedit.
When trying to create a Data Source in the Coldfusion Administrator, I found that the OLEDB data sources have been deprecated since coldfusion MX.
On searching further, I haven't been able to find any alternative way of configuring the data source.
Can you please advise how can I access the OLEDB data source?
Any links or direction would be really appreciated.

A: I believe you will have to use the 'Other' option value in the datasource driver dropdown. and then provide repective info in the following page. They say that all the OLEDB drivers that might exist will not be listed in the drop down and hence you will have to o the manual way of things.
Further details here" http://www.rvclandtrust.org/CFDOCS/Advanced_ColdFusion_Administration/datasources_ADV_MJS2.html


text:
Q: Apache VFS SFTP moveTo command fails I am using Apache vfs sftp to copy a file to remote linux box and then rename it.
copy works fine, but when  i try to rename the file, it fails.
I am using vfs 2.0 and jsch 0.1.50
Source(remoteFileTmp)       : /tmp/abc.txt
Destination(remoteFileDest) : /home/myName/work/abc.txt

Command that I used is as below:
remoteFileTmp.moveTo(remoteFileDest);

The exception that i get is as below:
Exception in thread "main" java.lang.RuntimeException: org.apache.commons.vfs2.FileSystemException: Could not rename "sftp://hostname/tmp/abc.txt" to "sftp://hostname/home/myName/work/abc.txt".
    at com.transfer.SFTPTransfer.uploadRename(SFTPTransfer.java:85)
    at com.transfer.MainClass.main(MainClass.java:23)
Caused by: org.apache.commons.vfs2.FileSystemException: Could not rename "sftp://hostname/tmp/abc.txt" to "sftp://hostname/tmp/abc.txt" to "sftp://hostname/home/myName/work/abc.txt".
    at org.apache.commons.vfs2.provider.AbstractFileObject.moveTo(AbstractFileObject.java:1116)
    at com.transfer.SFTPTransfer.uploadRename(SFTPTransfer.java:59)
    ... 1 more
Caused by: 4: Failure
    at com.jcraft.jsch.ChannelSftp.throwStatusError(ChannelSftp.java:2833)
    at com.jcraft.jsch.ChannelSftp.rename(ChannelSftp.java:1910)
    at org.apache.commons.vfs2.provider.sftp.SftpFileObject.doRename(SftpFileObject.java:289)
    at org.apache.commons.vfs2.provider.AbstractFileObject.moveTo(AbstractFileObject.java:1102)
    ... 2 more

Directory /home/myName/work exists.
Note: when i try to move (rename) files in the same folder it works fine.
i.e for the below input rename is succesfful.
source = /tmp/abc.txt
destination = /tmp/abc.txt_renamed

So is it that it supports rename only within the same directory?

A: This is caused by one of the open issues in the Apache VFS library when doing moveTo over SFTP :-(
https://issues.apache.org/jira/browse/VFS-590
and this
https://issues.apache.org/jira/browse/VFS-589


text:
Q: Why is my iPod nano reading everything out loud and functioning abnormally? I just reset my iPod nano 7th gen via iTunes to remove some broken tracks and then resynced it, and when I unplugged it after disconnecting it, everything was quite broken.
First of all (with a headset plugged in) the iPod is reading everything out loud....screen dim, music, double tap to open, etc. But then, in conjunction with this, I can't control the screen like normal...you have to double-tap to open anything and I can't swipe side to side to get to settings so I can't try to change whatever mode this is. When you slide a finger over the icons, a little selection square moves over them with you.
What's going on?

A: It's in VoiceOver mode (an accessibility feature). I don't have an iPod nano, but on iOS, under General, there's an Accessibility menu where you can turn it off.

A: You can fix it, but its a bit of a pain.

*

*Swipe left using two fingers till you get to Settings and double tap.

*Double tap General.

*Fiddle with it till you get down to Accessibility and Double tap.

*Double tap VoiceOver.

*Turn off VoiceOver.

Should work fine from there. I had the same problem with my 6th Gen Nano.

A: You can swipe to the next screen by using two fingers instead of one, and then move the selection box to whichever element you want to choose and open it by double-tapping.


text:
Q: JSON Encode giving me invalid JSON file in PHP - generated from MYSQL I am trying to generate a JSON file for a unity game to read. I use C# to call the PHP file where I use a MYSQL query to get the relevant information from my database. I am getting the content I want but when I encode as a JSON file it is unreadable. I can see what is happening but I don't know how to fix! I am getting }{ after each record when encoding happens. This is the relevant bit of code in my php file (I think)
$sqlnew = "SELECT DISTINCT
   content.ContentTitle,
   content.ContentBody,
   user_habits.value,
  user_habits.boolean,
  users.User_ID

FROM user_habits
       INNER JOIN users
         ON user_habits.user_id = users.User_ID,
     content_habitparameters
       INNER JOIN content
         ON content_habitparameters.Content_ID = content.Content_ID
WHERE users.User_ID = 1
AND ((user_habits.value >= content_habitparameters.Min_Value
and user_habits.value <= content_habitparameters.Max_Value)
OR user_habits.boolean = content_habitparameters.Boolean)";

$result = $conn->query($sqlnew);

if ($result->num_rows > 0)
{
   $dbdata = array();
}
while ($row = $result->fetch_assoc())
{
$dbdata[]=$row;
}

//print array in JSON format
echo json_encode($dbdata);

My SQL result looks like this:

*

*ContentTitle: Average Daily Cigarettes - ContentBody: Smoking cigarettes creates a link between e.g. Being on the phone and smoking. You need to break these habits to succeed. Be aware of when you tend to reach for a fag and think of alternatives for those situations. - value: 30 - user_habits.boolean: - users.User_ID: 1 users.Username lz7cjc

*ContentTitle: Fight one big temptation to avoid lots of smaller ones - ContentBody: Give yourself the best chance of success by removing all smoking related items from your house, the car, work and anywhere else you spend time. Avoid buying tobacco products and it will be much harder to give in to a temptation. Behaviour change is not just about will power. It is also about how easy it is to stop or start doing something. Make it hard to smoke and it will be easier to resist temptation - value: - user
when I encode into a JSON file I get this:
[  {"ContentTitle":"Average Daily Cigarettes",
    "ContentBody":"Smoking cigarettes creates a link between e.g. Being on the phone and smoking. You need to break these habits to succeed. Be aware of when you tend to reach for a fag and think of alternatives for those situations.",
    "value":"30",
    "boolean":null,
    "User_ID":"1",
    "Username":"lz7cjc"
   },{
    "ContentTitle":"Fight one big temptation to avoid lots of smaller ones",
    "ContentBody":"Give yourself the best chance of success by removing all smoking related items from your house, the car, work and anywhere else you spend time. Avoid buying tobacco products and it will be much harder to give in to a temptation. Behaviour change is not just about will power. It is also about how easy it is to stop or start doing something. Make it hard to smoke and it will be easier to resist temptation\r\n",
    "value":null,
    "boolean":"1",
    "User_ID":"1",
    "Username":"lz7cjc"
  },{

And obviously I can't read that in unity. I guess one way to solve is to create multiple JSON files but that is clunky even for me.
Help much appreciated. Thanks

A: well your json_encoding an array which may be referred to as a List with arrays that could be referred to as Maps.
For instance you pass into the function an array like this:
array( // this is a List, you have only object
 array( // this is a Map, you have key value pairs
  'Content-Title' => ...,
  'ContentBody'   => ...,
 ),
 array( // this is a Map, you have key value pairs
  'Content-Title'=>...,
  'ContentBody'   => ...,
 ),
)

encoded this adds a [ ] at the endings to indicate it is a List.
[{...}{...}]

If you want to have a map / json object you have to specify keys when adding results and call those keys in you C# script.
$count = 1;
while ($row = $result->fetch_assoc())
{
 $dbdata["result-$count"] = $row;
 $count++;
}

this will in turn give you an array like:
array( // this is a Map, you have key value pairs
'result-1' => array( // this is a Map, you have key value pairs
  'Content-Title' => ...,
  'ContentBody'   => ...,
 ),
'result-2' => array( // this is a Map, you have key value pairs
  'Content-Title'=>...,
  'ContentBody'   => ...,
 ),
)

which should result in an encoding like:
{"result-1":{...},"result-2":{...}}

Edit:
Some languages have Maps and Lists as separate data types C# has them separate. While in PHP an array has the function of both.
A map in general as the name suggests is a construct that MAPS out values with the help of user specified keys.
$map = array(
 'this_key'                           => 'will_give_me_this_result',
 'and_this_one'                       => 'will_give_me_value_at_this_key',
 'I_help_you_find_whats_on_the_right' => ' \0/" ',
);

While a list doesn't necessary use keys to point to values. You can use indexes 0,1.. they have the function of keys but still wouldn't be considered keys since they specify the position of the value and don't need to be explicitly set.
$list = array(
 'IM at position 0',
 "and Im at 1, but hey you don't need me to tell you this, I'll always be here",
 "position 2, well unless you manipulate me bastard",
 array(
  'let me be clear',
  'my parent is still just a value of outer most array',
  "you still now the position of it"
 )
);

Now, if we json_encoded these two arrays:

*

*array / $map

{"this_key":"will_give_me_this_result","and_this_one":"will_give_me_value_at_this_key","I_help_you_find_whats_on_the_right":" \\0\/\" "}

*array / $list

["IM at position 0","and Im at 1, but hey you don't need me to tell you this, I'll always be here","position 2, well unless you manipulate me bastard",["let me be clear","my parent is still just a value of the outer most array","you still now the position of it"]]

Notice the different brackets?
The [ ] indicate the objects inside are in a predictable 0,1,2 order, they don't need keys to specify them.
On the other hand { } specify a map. You can see that there are  multiple "key_key" : "value_value" occurrences. Well that's because you need keys to know what value is what.
Now, I personally don't know C# and how to decode json in that particular language so I went on a hunch that you want to get some kind of key:value result and you couldn't because your json output indicates a List not a Map.
Here are the arrays in json_encoding but spaces added for visibility.

*

*array / $map

{
 "this_key":"will_give_me_this_result",
 "and_this_one":"will_give_me_value_at_this_key",
 "I_help_you_find_whats_on_the_right":" \\0\/\" "
}

*array / $list

[
  "IM at position 0",
  "and Im at 1, but hey you don't need me to tell you this, I'll always be here",
  "position 2, well unless you manipulate me bastard",
 [
   "let me be clear",
   "my parent is still just a value of the outer most array",
   "you still now the position of it"
 ]
]

A: if you are using PDO, try:
$dbdata = $result->fetchAll(PDO::FETCH_ASSOC);
echo json_encode($dbdata);
This fetches the result as php array.
That should not create an invalid json.

A: so it wasn't the JSON file/XML it was Unity being unable to handle the data. Thanks to everyone who pointed this out.
This is a truncated view of what has been successfully implemented:
{
PlayerTipsJSON loadedPlayerData = JsonUtility.FromJson<PlayerTipsJSON>(json);
for (int i = 0;i<loadedPlayerData.data.Count; i++)
        {
            Debug.Log(loadedPlayerData.data[i].User_ID + "\n");
            Debug.Log(loadedPlayerData.data[i].ContentTitle + "\n");
            Debug.Log(loadedPlayerData.data[i].ContentBody+ "\n");
            Debug.Log(loadedPlayerData.data[i].value + "\n");
            Debug.Log(loadedPlayerData.data[i].boolean + "\n");
        }
}
[System.Serializable]
    public class PlayerData
    {
        public string fromJSONusername;
        public string ContentTitle;
        public string ContentBody;
        public int User_ID;
        public int value;
        public bool boolean;
    }

    [System.Serializable]
    public class PlayerTipsJSON
    {
        public List<PlayerData> data;
    }

I haven't commented the code as I didn't write it and to be honest not 100% sure what is going on! I think it is an array of an array.


text:
Q: why hive doesn't show empty partition count when i use group by? this is just a curiosity: why hive doesn't show empty partition count when i use group by?
select count(*), partition_date
from table
group by partition_date;

result is:
count----------------partition_date
746 ----------------20160901
1155----------------20160906
589 ----------------20160907
639 ----------------20160908
763 ----------------20160909
1502----------------20160912
1188----------------20160913
601 ----------------20160914
675 ----------------20160915
766 ----------------20160916

Now i wasn't able to see 3 partitions: 20160905, 20160904, 20160903.
If i do a count on these specific partitions it gives me count=0.
select count(*) from table where partition_date=20160905;
select count(*) from table where partition_date=20160904;
select count(*) from table where partition_date=20160903;

But this way i did it without using group by, and that's why it gives me a result.
If i do it again using group by, i still get a void result
select count(*), partition_date from table where partition_date=20160905 group by partition_date;

I tried in other ways, but i still can't get the count of empty partitions using group by...
select count(*), partition_date from table group by partition_date having count(*)>=0;
select count(*), partition_date from table group by partition_date having count(*)=0;
select count(*), partition_date from table where partition_date in (20160905, 20160904, 20160903) group by partition_date;

This is the only solution that i found, there is another way?
select AA.partition_date,nvl(BB.CN,0) as CC
from (select distinct partition_date as partition_date from table) AA
left join
    (select partition_date, count(*) as CN from table group by partition_date) BB
on AA.partition_date = BB.partition_date;

So my final questions are:

*

*is this related to MapReduce Jobs?

*How these MapReduce jobs works to give results of these queries?

*Do you know a tricky way to count empty partitions?


text:
Q: How do i add up all elements of a command line argument here is my code
#include <stdio.h>
#include <stdlib.h>

int main(int argc,char* argv[])
{
    int a;
    for(int i=1;i<=argc;i++){
        a+=atoi(argv[i]);
    }
    printf ("%d",a);
}

I keep getting segmentation faults but i am trying to add up all elements of the command line so for example ./a.out 5 6 7 would give 18 as the output, cheers.

A: The problem (with the crash) is the loop itself:
for(int i=1;i<=argc;i++)

The argc argument is the number of arguments passed to the program, including the "program name" at argv[0]. So valid indexes for the actual arguments are argv[1] to argv[argc - 1].
Furthermore the argv array is terminated by a null pointer, which will be at argv[argc].
Since you include argv[argc] in your loop you pass a null pointer to atoi which leads to undefined behavior and likely crashes.
The simple solution is to use less-than < instead of less-than-or-equal as the loop condition:
for(int i=1;i<argc;i++)

A: You never initialized a to 0. Also, use strtol() function.
#include <stdio.h>
#include <stdlib.h>

int main(int argc, char **argv) {
    int a = 0;
    for (int i = 1; i < argc; i++) {
        a += strtol(argv[i], NULL, 10);
    }
    printf("%d\n", a);
    return EXIT_SUCCESS;
}


text:
Q: How can I prepare a TortoiseSVN installer to use the serf HTTP library instead of neon? I'm going to be distributing instructions on how to access our new Subversion repository with TortoiseSVN. Because it's hosted on Windows, and we have some large files in the repository, we have to use the Serf HTTP library instead of neon.
This is normally specified by manually editing the Subversion "servers" file on the client machine and adding the line
http-library=serf

Is there a way I can customize the TortoiseSVN installer to do this automatically? I'm just trying to get it up and running as easy as possible for our new SVN users.


text:
Q: Будет ли диск с файловой системой raid1 работать нормально без второго диска? Я купил хост, где имеется два диска каждый по 500гб.
Но эти диски использовались в режиме raid1, в итоге мне было доступно только 500гб.
Но я захотел отказаться от raid1 в пользу дополнительного пространства.
Я отключил второй диск от raid1 такими командами:
mdadm --fail /dev/md0 /dev/nvme1n1p1
mdadm --remove /dev/md0 /dev/nvme1n1p1

После я на втором диске создал свои разделы ext4, и у меня получилось на хосте 1000 гб.
Сейчас разбивка выглядит так lsblk:
NAME        MAJ:MIN RM   SIZE RO TYPE  MOUNTPOINT
nvme0n1     259:0    0   477G  0 disk
├─nvme0n1p1 259:2    0    32G  0 part
│ └─md0       9:0    0    32G  0 raid1 [SWAP]
├─nvme0n1p2 259:3    0   512M  0 part
│ └─md1       9:1    0   511M  0 raid1 /boot
└─nvme0n1p3 259:4    0 444.4G  0 part
  └─md2       9:2    0 444.3G  0 raid1 /
nvme1n1     259:1    0   477G  0 disk
└─nvme1n1p1 259:5    0   477G  0 part  /mnt/tmp

Как видно, разделы первого диска остались в файловой с raid1.
Вопрос: будет ли первый диск работать нормально в файловой системе raid1 без второго диска?
Вот что показывает cat /proc/mdstat:
Personalities : [raid1] [linear] [multipath] [raid0] [raid6] [raid5] [raid4] [raid10]
md2 : active raid1 nvme0n1p3[0]
      465894720 blocks super 1.2 [2/1] [U_]
      bitmap: 4/4 pages [16KB], 65536KB chunk

md0 : active (auto-read-only) raid1 nvme0n1p1[0]
      33520640 blocks super 1.2 [2/1] [U_]

md1 : active raid1 nvme0n1p2[0]
      523264 blocks super 1.2 [2/1] [U_]

unused devices: <none>

A: Если исходить из теории то работать он конечно будет,  а сам факт неисправности будет виден только специальным утилитам управления RAID'ом.
Поэтому в целом можно оставить все как есть, если данные не критичны конечно.