问:
What's wrong with my DMux 4 way?
It's seemingly close to working, it just is messing up at line 7 apparently?

```<code>/**
 * 4-way demultiplexor.
 * {a,b,c,d} = {in,0,0,0} if sel==00
 *             {0,in,0,0} if sel==01
 *             {0,0,in,0} if sel==10
 *             {0,0,0,in} if sel==11
 */

CHIP DMux4Way {
    IN in, sel[2];
    OUT a, b, c, d;

    PARTS:
    DMux(in = in, sel = sel[0], a = out1, b = out2);

    DMux(in = out1, sel = sel[1], a = a, b = b);
    DMux(in = out2, sel = sel[1], a = c, b = d);
}
</code>```

I've implemented my DMux as follows, and I'm just using that as if it were a tree:

```<code>/**
 * Dmultiplexor.
 * {a,b} = {in,0} if sel==0
 *         {0,in} if sel==1
 */

CHIP DMux {
    IN in, sel;
    OUT a, b;

    PARTS:
    Not(in = sel, out = notsel);
    And(a = in, b = notsel, out = a);
    And(a = in, b = sel, out = b);
}
</code>```

答:
Another approach which matches closer to what OP was trying to do (and part where he missed being correct):

Swap b and c in the output to different lines like below:

```<code>CHIP DMux4Way {

IN in, sel[2];
OUT a, b, c, d;

PARTS:
// Put your code here:
DMux(in=in, sel=sel[0], a=dOut1, b=dOut2);

DMux(in=dOut1, sel=sel[1], a=a, b=c);

DMux(in=dOut2, sel=sel[1], a=b, b=d);
</code>```

}

You can see from the truth table that that make sense as well, given that you are narrowing down sel[0]

Title: What's wrong with my DMux 4 way?

Body:
It's seemingly close to working, it just is messing up at line 7 apparently?

/**
 * 4-way demultiplexor.
 * {a,b,c,d} = {in,0,0,0} if sel==00
 *             {0,in,0,0} if sel==01
 *             {0,0,in,0} if sel==10
 *             {0,0,0,in} if sel==11
 */

CHIP DMux4Way {
    IN in, sel[2];
    OUT a, b, c, d;

    PARTS:
    DMux(in = in, sel = sel[0], a = out1, b = out2);

    DMux(in = out1, sel = sel[1], a = a, b = b);
    DMux(in = out2, sel = sel[1], a = c, b = d);
}

I've implemented my DMux as follows, and I'm just using that as if it were a tree:

/**
 * Dmultiplexor.
 * {a,b} = {in,0} if sel==0
 *         {0,in} if sel==1
 */

CHIP DMux {
    IN in, sel;
    OUT a, b;

    PARTS:
    Not(in = sel, out = notsel);
    And(a = in, b = notsel, out = a);
    And(a = in, b = sel, out = b);
}

Body:
Another approach which matches closer to what OP was trying to do (and part where he missed being correct):

Swap b and c in the output to different lines like below:

CHIP DMux4Way {

IN in, sel[2];
OUT a, b, c, d;

PARTS:
// Put your code here:
DMux(in=in, sel=sel[0], a=dOut1, b=dOut2);

DMux(in=dOut1, sel=sel[1], a=a, b=c);

DMux(in=dOut2, sel=sel[1], a=b, b=d);

}

You can see from the truth table that that make sense as well, given that you are narrowing down sel[0]


来源: stackexchange

问:
How do you run a python file from another python file?
Im trying to run another file from my tkinter login system but i cant find the way to do it

Ive tried import file

```<code>if (p == '123') and (u == 'test'):
    import correct
</code>```

Im trying to run the file when those are true

答: you can use execfile(filepath) to get run</p>

ContentLicense: CC BY-SA 4.0

Body:
Im trying to run another file from my tkinter login system but i cant find the way to do it

Ive tried import file

if (p == '123') and (u == 'test'):
    import correct

Im trying to run the file when those are true


问:
How to update the value of the 2D vector at particular index in clojure?
I'm solving a finding treasure problem and I want to change my vector data value. So, How can I do that?

I tried so many things but nothing worked for me. I tried assoc, update, assoc-in, update-in and all.

(println (update-in data [row col] "+"))

(def data1 (-> data (assoc-in [0 0] \+)))

(println data1)
```

<p>So, my vector is like this</p>

<pre class="lang-clj prettyprint-override"><code>["---#--###----"
 "---#---#-#---"
 "-#-####---##-"
 "-#------#----"
 "-############"
 "------------@"]
</code>```

and I want change - with +.

答:
Strings and vectors are immutable in Clojure, so you can only create a copy of the object with updated contents.

Also, you can call assoc or update only on Clojure's built-in data structures. You need to convert the String into a vector first. After updating, you can convert it back to a string by calling (apply str ...) on it.

```<code>(defn to-plus [data x y]
  (update data y (fn [row] (apply str (assoc (vec row) x \+)))))
</code>```

Body:
I'm solving a finding treasure problem and I want to change my vector data value. So, How can I do that?

I tried so many things but nothing worked for me. I tried assoc, update, assoc-in, update-in and all.

(println (update-in data [row col] "+"))

(def data1 (-> data (assoc-in [0 0] \+)))

(println data1)

So, my vector is like this

["---#--###----"
 "---#---#-#---"
 "-#-####---##-"
 "-#------#----"
 "-############"
 "------------@"]

and I want change - with +.

Body:
Strings and vectors are immutable in Clojure, so you can only create a copy of the object with updated contents.

Also, you can call assoc or update only on Clojure's built-in data structures. You need to convert the String into a vector first. After updating, you can convert it back to a string by calling (apply str ...) on it.

(defn to-plus [data x y]
  (update data y (fn [row] (apply str (assoc (vec row) x \+)))))


问:
Issue installing version 10 on a new DNN 9.2.2
I'm trying to install the blog app and keep getting an error message.</p>

```<code>05/26/2019 20:49:27
Admin Alert
host

2sxc-Api Auto-Log Exception 2sInst[3e Path http://enjoythisworld.com/deskt
2sxc-Api:Auto-Log Exception

2sInst[3e]:Path: http://enjoythisworld.com/desktopmodules/2sxc/api/app-sys/installer/installpackage?packageUrl=https://2sxc.org/Portals/0/adam/AppCatalog/5EMutByRNEWtODu1sMkpDg/Download/2sxcApp_Blog_03.00.02.zip

2sInst[3e]DNN.Enviro[1b]Dnn.Publsh[70]:()

2sInst[3e]:install package:https://2sxc.org/Portals/0/adam/AppCatalog/5EMutByRNEWtODu1sMkpDg/Download/2sxcApp_Blog_03.00.02.zip

2sInst[3e]Dnn.MapA2I[53]:get appid from instance for Z:2 Mod:451 not found = null

2sInst[3e]Zip.Imp[6f]:import zip from url:https://2sxc.org/Portals/0/adam/AppCatalog/5EMutByRNEWtODu1sMkpDg/Download/2sxcApp_Blog_03.00.02.zip, isApp:True

2sInst[3e]Zip.Imp[6f]:try to download:https://2sxc.org/Portals/0/adam/AppCatalog/5EMutByRNEWtODu1sMkpDg/Download/2sxcApp_Blog_03.00.02.zip to:C:\Inetpub\vhosts\enjoythisworld.com\httpdocs\desktopmodules\tosic_sexycontent_\4po5clpp.vke.zip

Server Name: GenericAU04

Check
05/26/2019 20:49:27
General Exception
host
Enjoy This World
AbsoluteURL /desktopmodules/2sxc/api/app-sys/installer/installpackage Defa
AbsoluteURL:/desktopmodules/2sxc/api/app-sys/installer/installpackage

DefaultDataProvider:DotNetNuke.Data.SqlDataProvider, DotNetNuke

ExceptionGUID:f9b14e08-800d-4577-b7f3-4751cf4e96ec

AssemblyVersion:

PortalId:-1

UserId:-1

TabId:-1

RawUrl:

Referrer:

UserAgent:

ExceptionHash:EUTd+51qrnU8qi8gRlrnBDlmOGY=

Message:An error occurred while installing the app: Could not download app package from 'https://2sxc.org/Portals/0/adam/AppCatalog/5EMutByRNEWtODu1sMkpDg/Download/2sxcApp_Blog_03.00.02.zip'.

StackTrace:

at ToSic.SexyContent.WebApi.InstallerController.InstallPackage(String packageUrl) in C:\Projects\2sxc-dnn742\Website\DesktopModules\ToSIC_SexyContent\Sxc WebApi\InstallerController.cs:line 51 at lambda_method(Closure , Object , Object[] ) at System.Web.Http.Controllers.ReflectedHttpActionDescriptor.ActionExecutor.<>c__DisplayClass10.b__9(Object instance, Object[] methodParameters) at System.Web.Http.Controllers.ReflectedHttpActionDescriptor.ActionExecutor.Execute(Object instance, Object[] arguments) at System.Web.Http.Controllers.ReflectedHttpActionDescriptor.ExecuteAsync(HttpControllerContext controllerContext, IDictionary`2 arguments, CancellationToken cancellationToken) --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at System.Web.Http.Tracing.ITraceWriterExtensions.d__18`1.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at System.Web.Http.Controllers.ApiControllerActionInvoker.d__0.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at System.Web.Http.Tracing.ITraceWriterExtensions.d__18`1.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at System.Web.Http.Filters.ActionFilterAttribute.d__5.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Web.Http.Filters.ActionFilterAttribute.d__5.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at System.Web.Http.Filters.ActionFilterAttribute.d__0.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at System.Web.Http.Filters.ActionFilterAttribute.d__5.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Web.Http.Filters.ActionFilterAttribute.d__5.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at System.Web.Http.Filters.ActionFilterAttribute.d__0.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at System.Web.Http.Controllers.ActionFilterResult.d__2.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at System.Web.Http.Filters.AuthorizationFilterAttribute.d__2.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at System.Web.Http.Filters.AuthorizationFilterAttribute.d__2.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at System.Web.Http.Filters.AuthorizationFilterAttribute.d__2.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at System.Web.Http.Filters.AuthorizationFilterAttribute.d__2.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at System.Web.Http.Controllers.ExceptionFilterResult.d__0.MoveNext()
InnerMessage:Could not download app package from 'https://2sxc.org/Portals/0/adam/AppCatalog/5EMutByRNEWtODu1sMkpDg/Download/2sxcApp_Blog_03.00.02.zip'.

InnerStackTrace:

at ToSic.Eav.Apps.ImportExport.ZipImport.ImportZipFromUrl(String packageUrl, Boolean isAppImport) at ToSic.SexyContent.WebApi.InstallerController.InstallPackage(String packageUrl) in C:\Projects\2sxc-dnn742\Website\DesktopModules\ToSIC_SexyContent\Sxc WebApi\InstallerController.cs:line 32
Source:ToSic.SexyContent.WebApi

FileName:

FileLineNumber:0

FileColumnNumber:0

Method:

Server Name: GenericAU04
</code>```

答:
I'm guessing that your server doesn't have an internet connection - maybe communication between the server and the internet is prohibited. To work around this, download the app directly from the app catalog and upload/install it from the zip.

Best, iJungleboy

Body:
I'm trying to install the blog app and keep getting an error message.

05/26/2019 20:49:27
Admin Alert
host

2sxc-Api Auto-Log Exception 2sInst[3e Path http://enjoythisworld.com/deskt
2sxc-Api:Auto-Log Exception

2sInst[3e]:Path: http://enjoythisworld.com/desktopmodules/2sxc/api/app-sys/installer/installpackage?packageUrl=https://2sxc.org/Portals/0/adam/AppCatalog/5EMutByRNEWtODu1sMkpDg/Download/2sxcApp_Blog_03.00.02.zip

2sInst[3e]DNN.Enviro[1b]Dnn.Publsh[70]:()

2sInst[3e]:install package:https://2sxc.org/Portals/0/adam/AppCatalog/5EMutByRNEWtODu1sMkpDg/Download/2sxcApp_Blog_03.00.02.zip

2sInst[3e]Dnn.MapA2I[53]:get appid from instance for Z:2 Mod:451 not found = null

2sInst[3e]Zip.Imp[6f]:import zip from url:https://2sxc.org/Portals/0/adam/AppCatalog/5EMutByRNEWtODu1sMkpDg/Download/2sxcApp_Blog_03.00.02.zip, isApp:True

2sInst[3e]Zip.Imp[6f]:try to download:https://2sxc.org/Portals/0/adam/AppCatalog/5EMutByRNEWtODu1sMkpDg/Download/2sxcApp_Blog_03.00.02.zip to:C:\Inetpub\vhosts\enjoythisworld.com\httpdocs\desktopmodules\tosic_sexycontent_\4po5clpp.vke.zip

Server Name: GenericAU04

Check
05/26/2019 20:49:27
General Exception
host
Enjoy This World
AbsoluteURL /desktopmodules/2sxc/api/app-sys/installer/installpackage Defa
AbsoluteURL:/desktopmodules/2sxc/api/app-sys/installer/installpackage

DefaultDataProvider:DotNetNuke.Data.SqlDataProvider, DotNetNuke

ExceptionGUID:f9b14e08-800d-4577-b7f3-4751cf4e96ec

AssemblyVersion:

PortalId:-1

UserId:-1

TabId:-1

RawUrl:

Referrer:

UserAgent:

ExceptionHash:EUTd+51qrnU8qi8gRlrnBDlmOGY=

Message:An error occurred while installing the app: Could not download app package from 'https://2sxc.org/Portals/0/adam/AppCatalog/5EMutByRNEWtODu1sMkpDg/Download/2sxcApp_Blog_03.00.02.zip'.

StackTrace:

at ToSic.SexyContent.WebApi.InstallerController.InstallPackage(String packageUrl) in C:\Projects\2sxc-dnn742\Website\DesktopModules\ToSIC_SexyContent\Sxc WebApi\InstallerController.cs:line 51 at lambda_method(Closure , Object , Object[] ) at System.Web.Http.Controllers.ReflectedHttpActionDescriptor.ActionExecutor.<>c__DisplayClass10.b__9(Object instance, Object[] methodParameters) at System.Web.Http.Controllers.ReflectedHttpActionDescriptor.ActionExecutor.Execute(Object instance, Object[] arguments) at System.Web.Http.Controllers.ReflectedHttpActionDescriptor.ExecuteAsync(HttpControllerContext controllerContext, IDictionary`2 arguments, CancellationToken cancellationToken) --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at System.Web.Http.Tracing.ITraceWriterExtensions.d__18`1.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at System.Web.Http.Controllers.ApiControllerActionInvoker.d__0.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at System.Web.Http.Tracing.ITraceWriterExtensions.d__18`1.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at System.Web.Http.Filters.ActionFilterAttribute.d__5.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Web.Http.Filters.ActionFilterAttribute.d__5.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at System.Web.Http.Filters.ActionFilterAttribute.d__0.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at System.Web.Http.Filters.ActionFilterAttribute.d__5.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Web.Http.Filters.ActionFilterAttribute.d__5.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at System.Web.Http.Filters.ActionFilterAttribute.d__0.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at System.Web.Http.Controllers.ActionFilterResult.d__2.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at System.Web.Http.Filters.AuthorizationFilterAttribute.d__2.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at System.Web.Http.Filters.AuthorizationFilterAttribute.d__2.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at System.Web.Http.Filters.AuthorizationFilterAttribute.d__2.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at System.Web.Http.Filters.AuthorizationFilterAttribute.d__2.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at System.Web.Http.Controllers.ExceptionFilterResult.d__0.MoveNext()
InnerMessage:Could not download app package from 'https://2sxc.org/Portals/0/adam/AppCatalog/5EMutByRNEWtODu1sMkpDg/Download/2sxcApp_Blog_03.00.02.zip'.

InnerStackTrace:

at ToSic.Eav.Apps.ImportExport.ZipImport.ImportZipFromUrl(String packageUrl, Boolean isAppImport) at ToSic.SexyContent.WebApi.InstallerController.InstallPackage(String packageUrl) in C:\Projects\2sxc-dnn742\Website\DesktopModules\ToSIC_SexyContent\Sxc WebApi\InstallerController.cs:line 32
Source:ToSic.SexyContent.WebApi

FileName:

FileLineNumber:0

FileColumnNumber:0

Method:

Server Name: GenericAU04


问:
get value using jquery
i want to get value of h:outputText label using jquery,
for</p>

```<code><h:outputText id="cal_att_to_date"
  binding="#{Attendance_Calculation.cal_att_to_date}">
     <f:convertDateTime type="date" pattern="dd-MMM-yyyy" timeZone="GMT+5:30"/>    </h:outputText>
</code>```

答:
It should be

```<code>$('#cal_att_to_date').text();
</code>```

although i would be more sure, if you displayed the rendered HTML that your code produces.

ContentLicense: CC BY-SA 3.0

Title: get value using jquery

Body:
i want to get value of h:outputText label using jquery,
for

<h:outputText id="cal_att_to_date"
  binding="#{Attendance_Calculation.cal_att_to_date}">
     <f:convertDateTime type="date" pattern="dd-MMM-yyyy" timeZone="GMT+5:30"/>    </h:outputText>

Body:
It should be

$('#cal_att_to_date').text();

although i would be more sure, if you displayed the rendered HTML that your code produces.


问:
How to retrieve method type inside a package?
How can I get the type of the method (whether it's a FUNCTION or a PROCEDURE) inside a package?

```<code>CREATE OR REPLACE PACKAGE SAMPLE_PACKAGE IS

PROCEDURE procedure1;

PROCEDURE procedure2;

FUNCTION function1(
  key_           IN VARCHAR2) RETURN BOOLEAN;

END SAMPLE_PACKAGE;
</code>```

My package will be like this, it will have multiple Functions and Procedures.

I tried examples like How do I differentiate between Procedures and Functions in Oracle's Metadata? using user_arguments and user_procedures tables but it seems to be costly when it comes to a large data set

```<code>SELECT up.object_name, up.procedure_name, up.overload,
CASE WHEN ua.object_id IS NULL THEN 'PROCEDURE' ELSE 'FUNCTION' END AS method_type
FROM user_procedures up LEFT JOIN user_arguments ua ON ( ua.object_id = up.object_id
         AND ua.subprogram_id = up.subprogram_id AND ua.position = 0 )
WHERE up.object_name = 'MY_OBJECT';
</code>```

答:
```<code>select object_name, object_type, name, type
from user_identifiers
where  object_type like 'PACKAGE%'
and usage in ('DECLARATION', 'DEFINITION')
and type in ('FUNCTION', 'PROCEDURE');
</code>```

This simple query returns all user defined packages. Feel free to filter out what you need.

Body:
How can I get the type of the method (whether it's a FUNCTION or a PROCEDURE) inside a package?

CREATE OR REPLACE PACKAGE SAMPLE_PACKAGE IS

PROCEDURE procedure1;

PROCEDURE procedure2;

FUNCTION function1(
  key_           IN VARCHAR2) RETURN BOOLEAN;

END SAMPLE_PACKAGE;

My package will be like this, it will have multiple Functions and Procedures.

I tried examples like How do I differentiate between Procedures and Functions in Oracle's Metadata? using user_arguments and user_procedures tables but it seems to be costly when it comes to a large data set

SELECT up.object_name, up.procedure_name, up.overload,
CASE WHEN ua.object_id IS NULL THEN 'PROCEDURE' ELSE 'FUNCTION' END AS method_type
FROM user_procedures up LEFT JOIN user_arguments ua ON ( ua.object_id = up.object_id
         AND ua.subprogram_id = up.subprogram_id AND ua.position = 0 )
WHERE up.object_name = 'MY_OBJECT';

Body:
select object_name, object_type, name, type
from user_identifiers
where  object_type like 'PACKAGE%'
and usage in ('DECLARATION', 'DEFINITION')
and type in ('FUNCTION', 'PROCEDURE');

This simple query returns all user defined packages. Feel free to filter out what you need.


问:
How to get the content of the element using explicit wait instead of sleep() using Selenium and Java
I'm trying to get the content of an element. I've implemented an explicit wait of 20 seconds before the statement of getting content. But I can't get the content. I can get the content of the element if I use sleep() for 2 seconds. The code I tried is:

```<code>WebDriverWait wait1 = new WebDriverWait(driver,20);
wait1.until(ExpectedConditions.visibilityOfElementLocated(By.xpath("XPath")));
String value = driver.findElement(By.xpath("xpath")).getAttribute("text-content");
System.out.println("Value is : " + value);

Output - Value is :
</code>```

The code with sleep():

```<code>WebDriverWait wait1 = new WebDriverWait(driver,20);
Thread.sleep(2000);
String value = driver.findElement(By.xpath("xpath")).getAttribute("text-content");
System.out.println("Value is : " + value);

Output - Value is : $0.00
</code>```

I'm not getting the value if I use implicit wait also. It is recommended not to use sleep(). Using explicit wait is always the best practice. Why am I not getting the content of the element using explicit wait?

答:
The relevant HTML would have helped us to debug the issue in a better way. However as the desired text contains the $ character so a better approach will be to induce WebDriverWait for the expectation for checking if the given text is present in the element and you can use either of the following solutions:

textToBePresentInElementLocated:

```<code>System.out.println(new WebDriverWait(driver, 20).until(ExpectedConditions.textToBePresentInElementLocated(By.xpath("xpath"), "$")).getAttribute("text-content"));
</code>```

textToBePresentInElementValue:

```<code>System.out.println(new WebDriverWait(driver, 20).until(ExpectedConditions.textToBePresentInElementValue(By.xpath("xpath"), "$")).getAttribute("text-content"));
</code>```

Body:
I'm trying to get the content of an element. I've implemented an explicit wait of 20 seconds before the statement of getting content. But I can't get the content. I can get the content of the element if I use sleep() for 2 seconds. The code I tried is:

WebDriverWait wait1 = new WebDriverWait(driver,20);
wait1.until(ExpectedConditions.visibilityOfElementLocated(By.xpath("XPath")));
String value = driver.findElement(By.xpath("xpath")).getAttribute("text-content");
System.out.println("Value is : " + value);

Output - Value is :

The code with sleep():

WebDriverWait wait1 = new WebDriverWait(driver,20);
Thread.sleep(2000);
String value = driver.findElement(By.xpath("xpath")).getAttribute("text-content");
System.out.println("Value is : " + value);

Output - Value is : $0.00

I'm not getting the value if I use implicit wait also. It is recommended not to use sleep(). Using explicit wait is always the best practice. Why am I not getting the content of the element using explicit wait?

Body:
The relevant HTML would have helped us to debug the issue in a better way. However as the desired text contains the $ character so a better approach will be to induce WebDriverWait for the expectation for checking if the given text is present in the element and you can use either of the following solutions:

textToBePresentInElementLocated:

System.out.println(new WebDriverWait(driver, 20).until(ExpectedConditions.textToBePresentInElementLocated(By.xpath("xpath"), "$")).getAttribute("text-content"));

textToBePresentInElementValue:

System.out.println(new WebDriverWait(driver, 20).until(ExpectedConditions.textToBePresentInElementValue(By.xpath("xpath"), "$")).getAttribute("text-content"));


问:
How do I stretch a container in flutter so that it occupies the remaining screen?
I'm trying to maximize the screen as there is an unused white gap at the bottom (below the green bar which is the countdown/timer for the qn) :

Code:

    final quizBottomContentText = Container(
      width: MediaQuery.of(context).size.width,
      padding: EdgeInsets.only(left:30.0, right:30.0, top: 30.0, bottom: 30),
      child: Text(
        questions[questionNum].title,
        style: TextStyle(fontSize: 18.0),
      )
    );

    final quizOptions = Container(
      width: MediaQuery.of(context).size.width,
      padding: EdgeInsets.only(left: 40.0, right:40.0, bottom: 40.0),
      child: Center(
        child: Column(
                  children: questions[questionNum].options.map<Widget>(
                    (option) =>  SimpleRoundButton(
                        backgroundColor: Color.fromRGBO(58, 66, 86, 1.0),
                        buttonText: Text(option,
                            style: TextStyle(
                                color: Colors.white
                            ),
                        ),
                        textColor: Colors.white,
                        onPressed: (){},
                    ),
              ).toList(),
        )
      )
    );

    final countdown = CountdownWidget(
          width: MediaQuery.of(context).size.width,
          duration: 20,
          triviaState: triviaState,
        );

    final quizBottomContent = Container(
     width: MediaQuery.of(context).size.width,
      child: Column(
        children: <Widget>[quizBottomContentText, quizOptions, countdown], // need countdown
      ),
    );
```

<p>I've been trying the following but I cant seem to get what I want:</p>

<pre class="lang-dart prettyprint-override"><code> // Column for quizBottomContent
 mainAxisAlignment: MainAxisAlignment.spaceBetween,
</code>```

答: Wrap your bottom widget in Column inside Expanded (I think, this is what you want)

Body:
I'm trying to maximize the screen as there is an unused white gap at the bottom (below the green bar which is the countdown/timer for the qn) :

Code:

    final quizBottomContentText = Container(
      width: MediaQuery.of(context).size.width,
      padding: EdgeInsets.only(left:30.0, right:30.0, top: 30.0, bottom: 30),
      child: Text(
        questions[questionNum].title,
        style: TextStyle(fontSize: 18.0),
      )
    );

    final quizOptions = Container(
      width: MediaQuery.of(context).size.width,
      padding: EdgeInsets.only(left: 40.0, right:40.0, bottom: 40.0),
      child: Center(
        child: Column(
                  children: questions[questionNum].options.map<Widget>(
                    (option) =>  SimpleRoundButton(
                        backgroundColor: Color.fromRGBO(58, 66, 86, 1.0),
                        buttonText: Text(option,
                            style: TextStyle(
                                color: Colors.white
                            ),
                        ),
                        textColor: Colors.white,
                        onPressed: (){},
                    ),
              ).toList(),
        )
      )
    );

    final countdown = CountdownWidget(
          width: MediaQuery.of(context).size.width,
          duration: 20,
          triviaState: triviaState,
        );

    final quizBottomContent = Container(
     width: MediaQuery.of(context).size.width,
      child: Column(
        children: <Widget>[quizBottomContentText, quizOptions, countdown], // need countdown
      ),
    );

I've been trying the following but I cant seem to get what I want:

 // Column for quizBottomContent
 mainAxisAlignment: MainAxisAlignment.spaceBetween,


问:
python 2.7.6 to 2.7.12 broke my script
I'm working on a simple script to send data to an elasticsearch node, but after changing my python version the script no longer runs.  It says the error is on line 6, but I have no idea why.  I've tried adding a comma after the 'yes', but it had no effect.  I've tried moving my braces and parenthesis down and it had to effect.  (I'm leaving out the import and other defined variables for brevity)

```<code>if "Temporary failure in name resolution" or "Timeout" in output:
            es.index(index='data', doc_type='data', body={
            'macs' : '',
            'data' : line,
            'date' : datetime.now(),
            'down' : 'yes' })
</code>```

Here are the errors:

```<code>    snmpwalk: Timeout

Traceback (most recent call last):
  File "script.py", line 6, in <module>
    'down' : 'yes' })
  File "build/bdist.linux-x86_64/egg/elasticsearch/client/utils.py", line 69, in _wrapped
  File "build/bdist.linux-x86_64/egg/elasticsearch/client/__init__.py", line 279, in index
  File "build/bdist.linux-x86_64/egg/elasticsearch/transport.py", line 327, in perform_request
  File "build/bdist.linux-x86_64/egg/elasticsearch/connection/http_urllib3.py", line 105, in perform_request
elasticsearch.exceptions.ConnectionError: ConnectionError(<urllib3.connection.HTTPConnection object at 0x7f2507668090>: Failed to establish a new connection: [Errno -3] Temporary failure in name resolution) caused by: NewConnectionError(<urllib3.connection.HTTPConnection object at 0x7f2507668090>: Failed to establish a new connection: [Errno -3] Temporary failure in name resolution)
</code>```

Thanks

答:
This could either be a network issue or mmapfs directory for elastic search has maxed out.

Try running the following to restart your network server

```<code>sudo service network-manager restart
</code>```

If it does not work, then change your mmap count by running this command

```<code>sudo sysctl -w vm.max_map_count=262144
</code>```

Reference
https://www.elastic.co/guide/en/elasticsearch/reference/current/vm-max-map-count.html

Title: python 2.7.6 to 2.7.12 broke my script

Body:
I'm working on a simple script to send data to an elasticsearch node, but after changing my python version the script no longer runs.  It says the error is on line 6, but I have no idea why.  I've tried adding a comma after the 'yes', but it had no effect.  I've tried moving my braces and parenthesis down and it had to effect.  (I'm leaving out the import and other defined variables for brevity)

if "Temporary failure in name resolution" or "Timeout" in output:
            es.index(index='data', doc_type='data', body={
            'macs' : '',
            'data' : line,
            'date' : datetime.now(),
            'down' : 'yes' })

Here are the errors:

    snmpwalk: Timeout

Traceback (most recent call last):
  File "script.py", line 6, in <module>
    'down' : 'yes' })
  File "build/bdist.linux-x86_64/egg/elasticsearch/client/utils.py", line 69, in _wrapped
  File "build/bdist.linux-x86_64/egg/elasticsearch/client/__init__.py", line 279, in index
  File "build/bdist.linux-x86_64/egg/elasticsearch/transport.py", line 327, in perform_request
  File "build/bdist.linux-x86_64/egg/elasticsearch/connection/http_urllib3.py", line 105, in perform_request
elasticsearch.exceptions.ConnectionError: ConnectionError(<urllib3.connection.HTTPConnection object at 0x7f2507668090>: Failed to establish a new connection: [Errno -3] Temporary failure in name resolution) caused by: NewConnectionError(<urllib3.connection.HTTPConnection object at 0x7f2507668090>: Failed to establish a new connection: [Errno -3] Temporary failure in name resolution)

Thanks

Body:
This could either be a network issue or mmapfs directory for elastic search has maxed out.

Try running the following to restart your network server

sudo service network-manager restart

If it does not work, then change your mmap count by running this command

sudo sysctl -w vm.max_map_count=262144

Reference
https://www.elastic.co/guide/en/elasticsearch/reference/current/vm-max-map-count.html


问:
Setting up slurm.conf file for single computer
Hi I am attempting to utilize a processing pipeline which is written to run on multiple computer clusters using slurm however I would prefer to run it on a single compluter.  I am on Ubuntu 18 and have installed slurm-wlm however I have not been able to get the pipeline to read my slurm.conf file which I made from Slurm Version 18.08 Configuration Tool online with the goal of running this as a single node so I dont have to rewrite the pipeline code.

Everytime I attempt to run this pipeline sh script the log-file gives this error

sbatch: error: _parse_next_key: Parsing error at unrecognized key: SlurmctldHost
  sbatch: error: Parse error in file /etc/slurm-llnl/slurm.conf line 2: "SlurmctldHost=charlie-Z370M-D3H"
  sbatch: fatal: Unable to process configuration file

charlie-Z370M-D3H is the hostname

below is my slurm.conf text and I hope someone can see what I need to do to get this to work

```<code>#
SlurmctldHost=charlie-Z370M-D3H
#SlurmctldHost=
#
#DisableRootJobs=NO
#EnforcePartLimits=NO
#Epilog=
#EpilogSlurmctld=
#FirstJobId=1
#MaxJobId=999999
#GresTypes=
#GroupUpdateForce=0
#GroupUpdateTime=600
#JobFileAppend=0
#JobRequeue=1
#JobSubmitPlugins=1
#KillOnBadExit=0
#LaunchType=launch/slurm
#Licenses=foo*4,bar
#MailProg=/bin/mail
#MaxJobCount=5000
#MaxStepCount=40000
#MaxTasksPerNode=128
MpiDefault=none
#MpiParams=ports=#-#
#PluginDir=
#PlugStackConfig=
#PrivateData=jobs
ProctrackType=proctrack/cgroup
#Prolog=
#PrologFlags=
#PrologSlurmctld=
#PropagatePrioProcess=0
#PropagateResourceLimits=
#PropagateResourceLimitsExcept=
#RebootProgram=
ReturnToService=1
#SallocDefaultCommand=
SlurmctldPidFile=/var/run/slurmctld.pid
SlurmctldPort=6817
SlurmdPidFile=/var/run/slurmd.pid
SlurmdPort=6818
SlurmdSpoolDir=/var/spool/slurmd
SlurmUser=slurm
#SlurmdUser=root
#SrunEpilog=
#SrunProlog=
StateSaveLocation=/var/spool
SwitchType=switch/none
#TaskEpilog=
TaskPlugin=task/affinity
TaskPluginParam=Sched
#TaskProlog=
#TopologyPlugin=topology/tree
#TmpFS=/tmp
#TrackWCKey=no
#TreeWidth=
#UnkillableStepProgram=
#UsePAM=0
#
#
# TIMERS
#BatchStartTimeout=10
#CompleteWait=0
#EpilogMsgTime=2000
#GetEnvTimeout=2
#HealthCheckInterval=0
#HealthCheckProgram=
InactiveLimit=0
KillWait=30
#MessageTimeout=10
#ResvOverRun=0
MinJobAge=300
#OverTimeLimit=0
SlurmctldTimeout=120
SlurmdTimeout=300
#UnkillableStepTimeout=60
#VSizeFactor=0
Waittime=0
#
#
# SCHEDULING
#DefMemPerCPU=0
FastSchedule=1
#MaxMemPerCPU=0
#SchedulerTimeSlice=30
SchedulerType=sched/backfill
SelectType=select/cons_res
SelectTypeParameters=CR_Core
#
#
# JOB PRIORITY
#PriorityFlags=
#PriorityType=priority/basic
#PriorityDecayHalfLife=
#PriorityCalcPeriod=
#PriorityFavorSmall=
#PriorityMaxAge=
#PriorityUsageResetPeriod=
#PriorityWeightAge=
#PriorityWeightFairshare=
#PriorityWeightJobSize=
#PriorityWeightPartition=
#PriorityWeightQOS=
#
#
# LOGGING AND ACCOUNTING
#AccountingStorageEnforce=0
#AccountingStorageHost=
#AccountingStorageLoc=
#AccountingStoragePass=
#AccountingStoragePort=
AccountingStorageType=accounting_storage/none
#AccountingStorageUser=
AccountingStoreJobComment=YES
ClusterName=cluster
#DebugFlags=
#JobCompHost=
#JobCompLoc=
#JobCompPass=
#JobCompPort=
JobCompType=jobcomp/none
#JobCompUser=
#JobContainerType=job_container/none
JobAcctGatherFrequency=30
JobAcctGatherType=jobacct_gather/none
SlurmctldDebug=3
#SlurmctldLogFile=
SlurmdDebug=3
#SlurmdLogFile=
#SlurmSchedLogFile=
#SlurmSchedLogLevel=
#
#
# POWER SAVE SUPPORT FOR IDLE NODES (optional)
#SuspendProgram=
#ResumeProgram=
#SuspendTimeout=
#ResumeTimeout=
#ResumeRate=
#SuspendExcNodes=
#SuspendExcParts=
#SuspendRate=
#SuspendTime=
#
#
# COMPUTE NODES
NodeName=linux[1-32] CPUs=1 State=UNKNOWN
PartitionName=debug Nodes=linux[1-32] Default=YES MaxTime=INFINITE State=UP
</code>```

答:
I have had the same issue and it turns out that the conf-file generated on that webpage is only valid for 18.08
If you look at the webpage where you created the slurm.conf-file you may notice that it is only valid for version 18.08.
Thus, please verify that your version of SLURM is at least 18.x, since the key "SlurmctldHost" in the conf-file was introduced then.

You can verify your version of SLURM by simple typing "dpkg -l | grep slurm" and note which version is installed. For Ubuntu 18.x the default package installed is of slurm-version 17.11.9. (You might have to download the source-code from https://www.schedmd.com/archives.php by selecting the version you have installed and download it to your local machine.

Unpack it and look into "/doc/html/"-dir where you´ll find t he corrensponding configurator-html-script for your version.) E.g. if your version is 17.11.9, then the corresponding key of "SlurmctldHost" (as introduced in 18.08), is  "ControlMachine" in version 17.11.9. So use the configurator-html-script in your local slurm-doc-dir to generate a valid slurm.conf for your installed version of slurm.
I did that and it works fine.

Body:
Hi I am attempting to utilize a processing pipeline which is written to run on multiple computer clusters using slurm however I would prefer to run it on a single compluter.  I am on Ubuntu 18 and have installed slurm-wlm however I have not been able to get the pipeline to read my slurm.conf file which I made from Slurm Version 18.08 Configuration Tool online with the goal of running this as a single node so I dont have to rewrite the pipeline code.

Everytime I attempt to run this pipeline sh script the log-file gives this error

sbatch: error: _parse_next_key: Parsing error at unrecognized key: SlurmctldHost
  sbatch: error: Parse error in file /etc/slurm-llnl/slurm.conf line 2: "SlurmctldHost=charlie-Z370M-D3H"
  sbatch: fatal: Unable to process configuration file

charlie-Z370M-D3H is the hostname

below is my slurm.conf text and I hope someone can see what I need to do to get this to work

#
SlurmctldHost=charlie-Z370M-D3H
#SlurmctldHost=
#
#DisableRootJobs=NO
#EnforcePartLimits=NO
#Epilog=
#EpilogSlurmctld=
#FirstJobId=1
#MaxJobId=999999
#GresTypes=
#GroupUpdateForce=0
#GroupUpdateTime=600
#JobFileAppend=0
#JobRequeue=1
#JobSubmitPlugins=1
#KillOnBadExit=0
#LaunchType=launch/slurm
#Licenses=foo*4,bar
#MailProg=/bin/mail
#MaxJobCount=5000
#MaxStepCount=40000
#MaxTasksPerNode=128
MpiDefault=none
#MpiParams=ports=#-#
#PluginDir=
#PlugStackConfig=
#PrivateData=jobs
ProctrackType=proctrack/cgroup
#Prolog=
#PrologFlags=
#PrologSlurmctld=
#PropagatePrioProcess=0
#PropagateResourceLimits=
#PropagateResourceLimitsExcept=
#RebootProgram=
ReturnToService=1
#SallocDefaultCommand=
SlurmctldPidFile=/var/run/slurmctld.pid
SlurmctldPort=6817
SlurmdPidFile=/var/run/slurmd.pid
SlurmdPort=6818
SlurmdSpoolDir=/var/spool/slurmd
SlurmUser=slurm
#SlurmdUser=root
#SrunEpilog=
#SrunProlog=
StateSaveLocation=/var/spool
SwitchType=switch/none
#TaskEpilog=
TaskPlugin=task/affinity
TaskPluginParam=Sched
#TaskProlog=
#TopologyPlugin=topology/tree
#TmpFS=/tmp
#TrackWCKey=no
#TreeWidth=
#UnkillableStepProgram=
#UsePAM=0
#
#
# TIMERS
#BatchStartTimeout=10
#CompleteWait=0
#EpilogMsgTime=2000
#GetEnvTimeout=2
#HealthCheckInterval=0
#HealthCheckProgram=
InactiveLimit=0
KillWait=30
#MessageTimeout=10
#ResvOverRun=0
MinJobAge=300
#OverTimeLimit=0
SlurmctldTimeout=120
SlurmdTimeout=300
#UnkillableStepTimeout=60
#VSizeFactor=0
Waittime=0
#
#
# SCHEDULING
#DefMemPerCPU=0
FastSchedule=1
#MaxMemPerCPU=0
#SchedulerTimeSlice=30
SchedulerType=sched/backfill
SelectType=select/cons_res
SelectTypeParameters=CR_Core
#
#
# JOB PRIORITY
#PriorityFlags=
#PriorityType=priority/basic
#PriorityDecayHalfLife=
#PriorityCalcPeriod=
#PriorityFavorSmall=
#PriorityMaxAge=
#PriorityUsageResetPeriod=
#PriorityWeightAge=
#PriorityWeightFairshare=
#PriorityWeightJobSize=
#PriorityWeightPartition=
#PriorityWeightQOS=
#
#
# LOGGING AND ACCOUNTING
#AccountingStorageEnforce=0
#AccountingStorageHost=
#AccountingStorageLoc=
#AccountingStoragePass=
#AccountingStoragePort=
AccountingStorageType=accounting_storage/none
#AccountingStorageUser=
AccountingStoreJobComment=YES
ClusterName=cluster
#DebugFlags=
#JobCompHost=
#JobCompLoc=
#JobCompPass=
#JobCompPort=
JobCompType=jobcomp/none
#JobCompUser=
#JobContainerType=job_container/none
JobAcctGatherFrequency=30
JobAcctGatherType=jobacct_gather/none
SlurmctldDebug=3
#SlurmctldLogFile=
SlurmdDebug=3
#SlurmdLogFile=
#SlurmSchedLogFile=
#SlurmSchedLogLevel=
#
#
# POWER SAVE SUPPORT FOR IDLE NODES (optional)
#SuspendProgram=
#ResumeProgram=
#SuspendTimeout=
#ResumeTimeout=
#ResumeRate=
#SuspendExcNodes=
#SuspendExcParts=
#SuspendRate=
#SuspendTime=
#
#
# COMPUTE NODES
NodeName=linux[1-32] CPUs=1 State=UNKNOWN
PartitionName=debug Nodes=linux[1-32] Default=YES MaxTime=INFINITE State=UP


问:
Installing parmap using anaconda3
I want to install parmap in anaconda3 for windows 64. If I try  conda install -c marufr parmap, I receive an error reporting a conflict between python 2.7 and python 3.6 which is the current python version of my anaconda3. Is there any way to solve this issue? This is the error that I am receiving:

UnsatisfiableError: The following specifications were found to be in conflict:

-parmap->python 2.7*

-python 3.6*

答:
(parmap author here)

I recently realized the conda packages where not set to be arch-independent and I was building only linux packages in my channel. This is the reason why it was not possible to install parmap with conda install -c zeehio parmap on windows.

Anyway, I added parmap to conda-forge, so now it is possible to:

```<code>conda install -c conda-forge parmap
</code>```

Or

```<code>pip install parmap
</code>```

Whatever option you like best.

parmap works with python2.7 and python3 (as of May 2019, tested on python 3.3 through 3.7) and it works on all platforms supported by multiprocessing (Windows, OSX, Linux included).

Title: Installing parmap using anaconda3

Body:
(parmap author here)

I recently realized the conda packages where not set to be arch-independent and I was building only linux packages in my channel. This is the reason why it was not possible to install parmap with conda install -c zeehio parmap on windows.

Anyway, I added parmap to conda-forge, so now it is possible to:

conda install -c conda-forge parmap

Or

pip install parmap

Whatever option you like best.

parmap works with python2.7 and python3 (as of May 2019, tested on python 3.3 through 3.7) and it works on all platforms supported by multiprocessing (Windows, OSX, Linux included).


问:
Convert Android SMS table date to meaningful DateTime format using other than Java
I'm wondering how to convert Sms table date value e.g. 1293457709636 (miliseconds) to meaningful Date time value using Microsoft platforms, not Java.

I've just made a backup of my SMS messages from a HTC phone. I exported as XML file and for the date i have something like this: 1301061775000. I've got a solution from this post: Android - get date time from SMS timestamp in miliseconds but unfortunately require to have installed and also knowledge of Java which i'm not.

It is possible to convert from this format to something like mm/dd/yyyy HH:ii:ss using Microsoft (don't shoot me!) tools/ide/languages (.NET, C#, VB) or PHP because I have to automate somehow this process since there are more than 600 messages.

答:
The android datetime is milli-secs since Jan 1, 1970. I use the following exention method to convert it to a .NET DateTimeOffset.</p>

```<code>public static DateTimeOffset Epoch = new DateTimeOffset(new DateTime(1970, 1, 1), TimeSpan.Zero);

...

public static DateTimeOffset FromMilliSecsSinceEpoch(this long millSecs)
{
    return Epoch + TimeSpan.FromMilliseconds(millSecs);
}
</code>```

Body:
The android datetime is milli-secs since Jan 1, 1970. I use the following exention method to convert it to a .NET DateTimeOffset.

public static DateTimeOffset Epoch = new DateTimeOffset(new DateTime(1970, 1, 1), TimeSpan.Zero);

...

public static DateTimeOffset FromMilliSecsSinceEpoch(this long millSecs)
{
    return Epoch + TimeSpan.FromMilliseconds(millSecs);
}


问:
Amazon Redshift: Undefined use of FROM keyword: DELETE table_name FROM
While reading through a former employee's AWS Redshift SQL queries, I came across something that simplifies down to this:

delete
    names
from
(
    select 'Stu' AS last_name
) kill_list
where
    kill_list.last_name = names.last;
```

<p>When I run it against Redshift, it looks like it works as if I ran:</p>

<pre class="lang-sql prettyprint-override"><code>delete from
    names
using
(
    select 'Stu' AS last_name
) kill_list
where
    kill_list.last_name = names.last;
</code>```

However I can't find any documentation about using the FROM clause after the table name that you are deleting from so I'm wondering if this is valid sql code or if it's invalid but we got lucky and Redshift evaluated it the way we wanted it to.

When I try running it here using Postgres v10, get a syntax error:
https://www.db-fiddle.com/f/nYQz84mgNMctMiS38zk5AZ/0

答:
From DELETE - Amazon Redshift:

```<code>DELETE [ FROM ] table_name
[ {USING } table_name, ... ]
[ WHERE condition ]
</code>```

So, the FROM is optional.

Body:
While reading through a former employee's AWS Redshift SQL queries, I came across something that simplifies down to this:

delete
    names
from
(
    select 'Stu' AS last_name
) kill_list
where
    kill_list.last_name = names.last;

When I run it against Redshift, it looks like it works as if I ran:

delete from
    names
using
(
    select 'Stu' AS last_name
) kill_list
where
    kill_list.last_name = names.last;

However I can't find any documentation about using the FROM clause after the table name that you are deleting from so I'm wondering if this is valid sql code or if it's invalid but we got lucky and Redshift evaluated it the way we wanted it to.

When I try running it here using Postgres v10, get a syntax error:
https://www.db-fiddle.com/f/nYQz84mgNMctMiS38zk5AZ/0

Body:
From DELETE - Amazon Redshift:

DELETE [ FROM ] table_name
[ {USING } table_name, ... ]
[ WHERE condition ]

So, the FROM is optional.


问:
QVBoxLayout how to add spacer row
Is it possible to add a spacing row to a QVBoxLayout?  I tried using a QPushButton and then hiding, but this doesn't work.

I want the layout to contain 5 buttons with a spacing row between buttons 4 and 5.

答:
You don't need to handle the QSpacerItem yourself (the documentation lists the methods you should use instrad of creating the QSpacerItem).

If you want to add a space with a specific size, you can use QVBoxLayout::addSpacing():

```<code>    QWidget* w = new QWidget();
    QVBoxLayout* layout = new QVBoxLayout(w);
    layout->addWidget(new QPushButton("first"));
    layout->addWidget(new QPushButton("second"));
    layout->addWidget(new QPushButton("third"));
    layout->addWidget(new QPushButton("fourth"));
    layout->addSpacing(50);
    layout->addWidget(new QPushButton("fifth"));
    w->show();
</code>```

It will be a minimum space of 50 pixel between fourth and fifth:

If you want to put the button fifth at the bottom and keep the others at the top, use QVBoxLayout::addStretch():

```<code>    QWidget* w = new QWidget();
    QVBoxLayout* layout = new QVBoxLayout(w);
    layout->addWidget(new QPushButton("first"));
    layout->addWidget(new QPushButton("second"));
    layout->addWidget(new QPushButton("third"));
    layout->addWidget(new QPushButton("fourth"));
    layout->addStretch(1);
    layout->addWidget(new QPushButton("fifth"));
    w->show();
</code>```

Title: QVBoxLayout how to add spacer row

Body:
You don't need to handle the QSpacerItem yourself (the documentation lists the methods you should use instrad of creating the QSpacerItem).

If you want to add a space with a specific size, you can use QVBoxLayout::addSpacing():

    QWidget* w = new QWidget();
    QVBoxLayout* layout = new QVBoxLayout(w);
    layout->addWidget(new QPushButton("first"));
    layout->addWidget(new QPushButton("second"));
    layout->addWidget(new QPushButton("third"));
    layout->addWidget(new QPushButton("fourth"));
    layout->addSpacing(50);
    layout->addWidget(new QPushButton("fifth"));
    w->show();

It will be a minimum space of 50 pixel between fourth and fifth:

If you want to put the button fifth at the bottom and keep the others at the top, use QVBoxLayout::addStretch():

    QWidget* w = new QWidget();
    QVBoxLayout* layout = new QVBoxLayout(w);
    layout->addWidget(new QPushButton("first"));
    layout->addWidget(new QPushButton("second"));
    layout->addWidget(new QPushButton("third"));
    layout->addWidget(new QPushButton("fourth"));
    layout->addStretch(1);
    layout->addWidget(new QPushButton("fifth"));
    w->show();


问:
What are the symptoms of a stack overflow in a C++ program?
I just ran into an issue where a stack overflow in a threaded c++ program on HPUX caused a SEGV_MAPERR when a local object tried to call a very simple procedure.  I was puzzled for a while, but luckily I talked to someone who recognized this as a stack size issue and we were able to fix the problem by increasing the stack size available to the threads. </p>

<p>How can I recognize when the stack overflows?  Do the symptoms differ on windows/linux/hpux?  </p>

答:
How can I recognize when the stack overflows?

If you know the stack size, where the stack starts and the direction it grows in memory, you can simply check the address of the stack pointer and see if it past the end of the stack. C++ does not allow direct access to the stack pointer. You could easily write a small function in assembly to perform this analysis and link it into you program.

OwnerDisplayName: Plasmer

ContentLicense: CC BY-SA 2.5

Body:
I just ran into an issue where a stack overflow in a threaded c++ program on HPUX caused a SEGV_MAPERR when a local object tried to call a very simple procedure.  I was puzzled for a while, but luckily I talked to someone who recognized this as a stack size issue and we were able to fix the problem by increasing the stack size available to the threads.

How can I recognize when the stack overflows?  Do the symptoms differ on windows/linux/hpux?

OwnerDisplayName: cdv


问:
Django South migration leaks memory
I am running Django 1.2.1 with South 0.7.2 and DEBUG = False.
Still a very simple data migration leaks memory:

```<code>def forwards(self, orm):
  for tr in orm.TestResult.objects.all():
    tr.software = tr.test_result.test_run.software
    tr.save()
</code>```

The amount of TestResults is pretty big, but that should not be a real problem besides a long runtime. Unfortunately the process grows till my machine is out of memory.

答:
I think it's better in your case to execute an sql upate query on all objects instead of updatnig records one by one. You can use execute with an sql statement like this one (I don't know what database or data stucture you're using, so this is just an example):

```<code>UPDATE TestResult
   SET TestResult.software = TestRun.software
  FROM TestResult JOIN TestRun
       ON TestResult.test_run_id = TestRun.id
</code>```

Title: Django South migration leaks memory

Body:
I am running Django 1.2.1 with South 0.7.2 and DEBUG = False.
Still a very simple data migration leaks memory:

def forwards(self, orm):
  for tr in orm.TestResult.objects.all():
    tr.software = tr.test_result.test_run.software
    tr.save()

The amount of TestResults is pretty big, but that should not be a real problem besides a long runtime. Unfortunately the process grows till my machine is out of memory.

Body:
I think it's better in your case to execute an sql upate query on all objects instead of updatnig records one by one. You can use execute with an sql statement like this one (I don't know what database or data stucture you're using, so this is just an example):

UPDATE TestResult
   SET TestResult.software = TestRun.software
  FROM TestResult JOIN TestRun
       ON TestResult.test_run_id = TestRun.id


问:
VS2017 Task Runner Explorer No Tasks Found
I'm trying to set up gulp in an MVC Core project within VS 2017. I have what I believe to be a valid gulpfile.js:

```<code>var gulp = require('gulp');
var rimraf = require('rimraf');
var concat = require('gulp-concat');
var cssmin = require('gulp-cssmin');
var uglify = require( 'gulp-uglify' );

var paths = {
    webroot: './wwwroot/',
};

paths.js = paths.webroot + 'js/**/*.js';
paths.minJs = paths.webroot + 'js/**/*.min.js';
paths.css = paths.webroot + 'css/**/*.css';
paths.minCss = paths.webroot + 'css/**/*.min.css';
paths.concatJsDest = paths.webroot + "js/site.min.js";
paths.concatCssDest = paths.webroot + "css/site.min.css";

gulp.task("clean:js", function (cb) {
    rimraf(paths.concatJsDest, cb);
});

gulp.task("clean:css", function (cb) {
    rimraf(paths.concatCssDest, cb);
});

gulp.task( "clean", ["clean:js", "clean:css"] );
</code>```

But when I open Task Runner Explorer I get the message "(no tasks found)".

I've checked to ensure all the gulp packages were installed via npm. I also added a package.json file. But the tasks are still not being found.

What am I doing wrong?

答:
I was faced the same issue, and fix this after running two commands. Please refer below the process:

1) Right click on your gulp file in visual-studio, and choose "Open Command Line > PowerShell"

2) Run the command npm install gulp for install gulp. (You have to install gulp in your project, no matter if you have already installed gulp globally, but in this case you have to install the gulp in your project)

and press enter.

3) After execution of command go to task runner explorer in Visual-Studio and press the refresh button.

After pressing the refresh button you will see all your task list under task runner.

If you found any error related to "missing module" in output window like below:

Then you have to install missing npm plugins, for this just run the below command (into powershell):
npm install and press enter.
This command will install all the missing plugin, refer below image:

And then press again the refresh button in task runner explorer and you will see all your gulp task list under task runner window.

Hope this solution will help.

Body:
I'm trying to set up gulp in an MVC Core project within VS 2017. I have what I believe to be a valid gulpfile.js:

var gulp = require('gulp');
var rimraf = require('rimraf');
var concat = require('gulp-concat');
var cssmin = require('gulp-cssmin');
var uglify = require( 'gulp-uglify' );

var paths = {
    webroot: './wwwroot/',
};

paths.js = paths.webroot + 'js/**/*.js';
paths.minJs = paths.webroot + 'js/**/*.min.js';
paths.css = paths.webroot + 'css/**/*.css';
paths.minCss = paths.webroot + 'css/**/*.min.css';
paths.concatJsDest = paths.webroot + "js/site.min.js";
paths.concatCssDest = paths.webroot + "css/site.min.css";

gulp.task("clean:js", function (cb) {
    rimraf(paths.concatJsDest, cb);
});

gulp.task("clean:css", function (cb) {
    rimraf(paths.concatCssDest, cb);
});

gulp.task( "clean", ["clean:js", "clean:css"] );

But when I open Task Runner Explorer I get the message "(no tasks found)".

I've checked to ensure all the gulp packages were installed via npm. I also added a package.json file. But the tasks are still not being found.

What am I doing wrong?