Recent Questions - Stack Overflow most recent 30 from stackoverflow.com 2019-06-20T14:55:04Z /feeds http://www.creativecommons.org/licenses/by-sa/3.0/rdf /q/56688695 0 Conditional filtering for tableu worksheets using Tabcmd lea /users/11676690 2019-06-20T14:54:36Z 2019-06-20T14:54:36Z <p>I have a dashboard which has two worksheets in it. I have a filter that is applied to only one of the two sheets. It works perfectly when I upload it on the tableau server. However when I use tabcmd to get pdfs of the dashboard by just iterating over that one filter, it applies to both the sheets within the dashboard. I have already set that filter to apply to the desired worksheet. How can I solve this issue?</p> <p>I tried creating a copy of the same filter and applying to the sheet I don't want it to affect. I also did add context to the original filter and then tried to run it through tabcmd. Both options didn't seem to work.</p> <p>Here is my code: The '&amp;Location%20Group=' + LocGroup.replace(' ','%20') filter is getting applied to both sheets instead of 1 Also I am running tabcmd in python</p> <p>for LocGroup in LocationGroup: BatchString = 'tabcmd get "' + View + Dashboard + SnapType + SnapSize + '&amp;Year=' + Year + '&amp;Month=' + Month + '&amp;Location%20Group=' + LocGroup.replace(' ','%20') + '" -f "' + SnapFolder + '\' + Year + '<em>' + Month + '</em>' + LocGroup + SnapType + '"\n' print(BatchString) GetSnaps(BatchString)</p> /q/56688693 0 IIS 10 CA Root Certificcate is not trusted Michael Downey /users/847211 2019-06-20T14:54:35Z 2019-06-20T14:54:35Z <p>I have successfully installed the SSL and I also installed the Trusted Root Certification in the the Trusted Root Certifications Store. </p> <p>Yet it is still saying to install it in the trusted root store. </p> <p><a href="https://www.k-9styles.com/" rel="nofollow noreferrer">https://www.k-9styles.com/</a></p> /q/56688692 0 What does go mod init do exactly MS B /users/10480782 2019-06-20T14:54:33Z 2019-06-20T14:54:33Z <p>What does go mod init do exactly? and when I add the path, for example go mod init user/test what happens exactly?</p> /q/56688690 0 Feed automatic input to powershell scipt rocknrollaki /users/11099006 2019-06-20T14:54:22Z 2019-06-20T14:54:22Z <p>I have a powershell script (.ps1), which asks for multiple user inputs. I want to input the answers automatically, so far I found a way to input only to first prompt, and the script hangs at second prompt. The below will feed "123" to only 1st prompt, how can i modify this to feed input to second prompt as well.</p> <pre><code>cmd /c echo 123 | powershell "C:\temp\Snap.ps1" </code></pre> /q/56688688 0 Strange effect in data-toggle Juan Medina /users/7454302 2019-06-20T14:54:19Z 2019-06-20T14:54:19Z <p>I have a bootstrap navbar in my site but when it is shown collapse, if click on a link the menu does not close, and I would like navigate to the page and the menu will also be closed.</p> <p>I've added </p> <pre><code>data-toggle="collapse" data-target="#navbarNav" </code></pre> <p>And do the trick, but the link have a strange effect when is not collapse (in a desktope mode)</p> <p>I create a fiddle:</p> <p><a href="http://jsfiddle.net/soyjuanmedina/rscdu7gv/3/" rel="nofollow noreferrer">http://jsfiddle.net/soyjuanmedina/rscdu7gv/3/</a></p> <p>An add the code to the link 'Home' and you can see (you need to expand the result window to see the menu not collapsed) and see when click in it the words disappear to appear again</p> /q/56688685 0 Unable to Select Stylesheet for New Angular Project Evan Scott /users/2166009 2019-06-20T14:54:11Z 2019-06-20T14:54:11Z <p>I'm trying to get the Angular CLI working for an existing app that uses .NET Core, before upgrading the app from Angular 2 to 7. I've decided it would be best to make a new Angular project using the CLI and migrate code/components over to the new project incrementally.</p> <p>I changed the name of the current Angular project, navigated out of the project directory and tried to create a new app using ng new . When I select the stylesheet I get the below error. </p> <pre><code>Invalid rule result: Instance of class Promise. </code></pre> <p>I understand that Angular 8 is available, however I have been asked to perform the upgrade to 7 instead. </p> <pre><code>Angular CLI: 7.2.1 Node: 10.15.3 OS: win32 x64 Angular: ... Package Version ------------------------------------------------------ @angular-devkit/architect 0.12.1 @angular-devkit/core 7.2.1 @angular-devkit/schematics 7.2.1 @schematics/angular 7.2.1 @schematics/update 0.12.1 rxjs 6.3.3 typescript 3.2.2 </code></pre> /q/56688684 0 Flutter date \ time localization (12h format vs 24) Andrey Ilyunin /users/7884542 2019-06-20T14:54:08Z 2019-06-20T14:54:08Z <p>Is it possible in Flutter (using platform tools) to localize the data according to the device's preferences (12 hours format vs 24, for example)? By preferences I mean that I can use <code>en_US</code> locale for my device, but explicitly turn on the 24-hours format, so I expect the dates to be shown in the app based on my explicit 24-hours format usage, not just by locale convention.</p> <p>For now I use <code>supportedLocales: kMaterialSupportedLanguages.map&lt;Locale&gt;((String language) =&gt; Locale(language))</code> and <code>localizationsDelegates: const &lt;LocalizationsDelegate&lt;dynamic&gt;&gt;[ GlobalWidgetsLocalizations.delegate, GlobalMaterialLocalizations.delegate,]</code>, and <code>DateFormat.yMd(Localizations.localeOf(context).toString()).add_jms();</code>. Clearly, it uses only locale convention.</p> <p>Still, I didn't find any native Flutter solution to address this problem. Does it exist, or I need to use something like <a href="https://pub.dev/packages/respect_24_hour" rel="nofollow noreferrer">this</a> in order to preserve date &amp; time formatting preferences?</p> /q/56688609 0 Monad for-comprehensions with implicit Monad fails, use inheritance? rausted /users/1364783 2019-06-20T14:50:10Z 2019-06-20T14:54:29Z <p>I am running into this famous 10 year old ticket in Scala <a href="https://github.com/scala/bug/issues/2823" rel="nofollow noreferrer">https://github.com/scala/bug/issues/2823</a></p> <p>Because I am expecting for-comprehensions to work like do-blocks in Haskell. And why shouldn't they, Monads go great with a side of sugar. At this point I have something like this:</p> <pre><code>import scalaz.{Monad, Traverse} import scalaz.std.either._ import scalaz.std.list._ type ErrorM[A] = Either[String, A] def toIntSafe(s : String) : ErrorM[Int] = { try { Right(s.toInt) } catch { case e: Exception =&gt; Left(e.getMessage) } } def convert(args: List[String])(implicit m: Monad[ErrorM], tr: Traverse[List]): ErrorM[List[Int]] = { val expanded = for { arg &lt;- args result &lt;- toIntSafe(arg) } yield result tr.sequence(expanded)(m) } println(convert(List("1", "2", "3"))) println(convert(List("1", "foo"))) </code></pre> <p>And I'm getting the error </p> <blockquote> <p>"Value map is not a member of ErrorM[Int]" result &lt;- toIntSafe(arg)</p> </blockquote> <p>(Not only that, but implicits got confused for Traverse and I had to explicitly pass the implicit m for traverse. But that's the least of my problems)</p> <p>How do I get back to beautiful, monadic-comprehensions that I am used to? Some research shows the <code>FilterMonadic[A, Repr]</code> abstract class is what to extend if you want to be a comprehension, any examples of combining <code>FilterMonadic</code> with scalaz?</p> <ol> <li><p>But can I reuse my Monad implicit and not have to redefine map, flatMap etc? Also that class is gibberish, Builder, GenTraversable, WithFilter are unknown things, I only know Monads.</p></li> <li><p>Can I keep my type alias and not have to wrap around Either or worse, redefine case classes for ErrorM?</p></li> </ol> /q/56688592 0 ReactJS - Disabling a component Ahmed /users/727390 2019-06-20T14:49:11Z 2019-06-20T14:54:18Z <p>I need to disable <strong>PostList</strong> Component in its initial state.</p> <pre><code>import React from 'react'; import PostList from './PostList'; const App = () =&gt; { return ( &lt;div className="ui container"&gt; &lt;PostList /&gt; &lt;/div&gt; ); }; export default App; </code></pre> <p>Whats the best way to disable a component? Possible solutions are to pass a value as props and then apply it to a ui element, However please keep in mind that <strong>PostList</strong> may have inner nested components as well.</p> /q/56688566 0 How to run java10 inside Docker of python3.7? Ehud Lev /users/2479786 2019-06-20T14:47:29Z 2019-06-20T14:54:36Z <p>I have a circleci build that uses <code>python:3.6.6-stretch</code>. most of my services uses python, but I also need java10 + maven.</p> <p>Now it seems impossible to install java10 inside python3 docker.</p> <p>What is the best approach to have a docker that will support python and java ? </p> /q/56688537 0 GTM + JS: How can I match IDs with Category names? Dinomaster /users/11676637 2019-06-20T14:45:27Z 2019-06-20T14:54:44Z <p>On Google Tag Manager I need to create a custom JavaScript variable that gets an ID and then looks up for the correspondent category.</p> <p>So I need ID = [15, 16, 17, 18}</p> <p>to match these Categories = [A, B, C, D]</p> <p>So basically, if ID = 15 the variable would return "A"</p> <p>I've been able to write the code to get the IDs (and it's working). But I'm not sure what to do next, as I'm not very technical on JS</p> <pre><code>function () { var field = document.getElementById("AppointmentTypeID"); return field.value || ""; } </code></pre> <p>Any thoughts? Thank you!</p> /q/56688443 -2 Append float data at the end of each line in a text file OneManArmy /users/7561952 2019-06-20T14:41:20Z 2019-06-20T14:54:45Z <p>I have a .txt file and I'm trying to add float number at the end of each line with incremented value than the last line. This is what I have in the .txt file:</p> <pre><code>&gt;520.980000 172.900000 357.440000 &gt;320.980000 192.900000 357.441000 &gt;325.980000 172.900000 87.440000 </code></pre> <p>and I'm trying to have this result:</p> <pre><code>&gt;520.980000 172.900000 357.440000 1.1 &gt;320.980000 192.900000 357.441000 1.2 &gt;325.980000 172.900000 87.440000 1.3 </code></pre> <p>But can't seem to figure out how to iterate and increment the data.</p> /q/56688436 0 how do i set onclick event within innerHTML? DelphiStudent /users/3763678 2019-06-20T14:41:01Z 2019-06-20T14:54:08Z <p>i am trying to use innerHTML to insert some data into an html page like folowing</p> <pre><code>for(i = 0; i &lt; data.length; i++){ var line = data[i].split("~"); nameslist.innerHTML += '&lt;p onClick='+userclick(line[1])+'&gt;&lt;strong&gt;' + line[0] + ' &lt;/strong&gt;&lt;/p&gt;'; } </code></pre> <p>but onclick event fired automatically directly after the insert and it wont fire when i click on the <code>&lt;p&gt;</code> element </p> <p>how do i use innerhtml properly to add a p element with onclick event and fire it only when user click ? </p> /q/56688245 0 Mysql build row combinations Gerard Luque /users/6017482 2019-06-20T14:30:03Z 2019-06-20T14:54:14Z <p>I have to generate 2 columns with the combinations of others 2. I have a column with product attributes and another column with attribute values, I need to achive this:</p> <pre><code>Attributes Values Color, Size Blue, L Color, Size Blue, XL Color, Size Red, L Color, Size Red, XL </code></pre> <p>But I have this:</p> <pre><code>Attribute Value Color Blue Color Red Size L Size XL </code></pre> <p>I don't see tha way to achieve this also I can have color,sizes,materials and other type of attributes</p> <p>I tried with group_concat but didn't work for this example</p> <pre><code>SELECT p.products_id as 'product_id', pd.products_name as 'name', po.products_options_name as 'attributes', trim(pov.products_options_values_name) as 'attribute_values' -- GROUP_CONCAT(distinct(po.products_options_name)) as 'attributes', -- GROUP_CONCAT(distinct(trim(pov.products_options_values_name))) as 'attribute_values' FROM `products` AS p INNER JOIN `products_description` AS pd ON p.`products_id` = pd.`products_id` INNER JOIN `products_attributes` AS pa ON p.`products_id` = pa.`products_id` INNER JOIN `products_options` AS po ON pa.`options_id` = po.`products_options_id` INNER JOIN `products_options_values` AS pov ON pa.`options_values_id` = pov.`products_options_values_id` WHERE p.products_id = '1476' AND pd.language_id =3 group by trim(pov.products_options_values_name) LIMIT 0 , 30``` </code></pre> /q/56688217 -6 how can I show the information of a list object GustavoNogueira /users/11583536 2019-06-20T14:28:40Z 2019-06-20T14:54:53Z <p>I have books categorized by the category attribute, how can I get the description value of the books to display on a screen?</p> <p>already tried using values ​​() and the keys ()</p> <pre><code>{1: Array(2), 2: Array(1), 4: Array(1), 9: Array(1)} 1: Array(2) 0: {id: 1, description: "teste", category: 1} 1: {id: 73, description: "basica tb", category: 1} length: 2 __proto__: Array(0) 2: Array(1) 0: {id: 3, description: "Teoria das ideias", category: 2} length: 1 __proto__: Array(0) 4: Array(1) 0: {id: 5, description: "Mr with research computer.", category: 4} length: 1 __proto__: Array(0) 9: Array(1) 0: {id: 10, description: "Vote drug thus no.", category: 9} length: 1 __proto__: Array(0) __proto__: Object </code></pre> <p>i need return the title of objects bibliographies</p> /q/56688195 0 how to get row that have number of digit more than two? isabella siagian /users/11038201 2019-06-20T14:27:36Z 2019-06-20T14:54:36Z <p>i want to normalize data that have number of digit more than two in my dataset. </p> <p>I have been tried to use data[feature].astype(str).str.len() > 2 but unsolved. </p> <pre class="lang-py prettyprint-override"><code>def normalisasi(data): column = list(data) for i in column: data[a]= data[i].astype(str).str.len() if data[a] == 5: data[i] = stat.zscore(data[i], axis=1, ddof=1) else: data[i] = data[i] return data </code></pre> <p>I expect to get the result that rows contain the number of digits more than 2 or equal, I can normalize it.</p> <p>sample my dataset:</p> <p>access accommodates amenities availability_30 0.0 2.0 1.0 25.0</p> <p>my expected result value from availability will normalize using function normalization, that is the row that has digit number more than 10.00.</p> /q/56688159 2 Implement loader in windows form like web application Hiren Patel /users/9787228 2019-06-20T14:25:35Z 2019-06-20T14:54:26Z <p>I'm trying displaying <strong>Loader</strong> while any long running process being executing in <strong>windows forms</strong>. I have implemented code for that, but loader being displayed but not in <strong>CenterParent</strong> location, it will be displayed on Center of the screen.</p> <p><strong>Code:</strong></p> <p><strong>CPLoader</strong> is form that I want to display while any process executing.</p> <pre><code>public class CommonLoader { CPLoader cploader = new CPLoader(); readonly Form form = null; public CommonLoader(Form frm) { form = frm; } public void ShowLoader() { try { if (form.InvokeRequired) { try { cploader = new CPLoader(); cploader.ShowDialog(); } catch { Console.WriteLine("Cp loader exception"); } } else { Thread th = new Thread(ShowLoader); th.IsBackground = false; th.Start(); } } catch { Console.WriteLine("Cp loader exception"); } } /// &lt;summary&gt; /// this method will used for hide loader while process stop /// &lt;/summary&gt; public void HideLoader() { try { if (cploader != null) { Thread.Sleep(200); cploader.Invoke(new Action(cploader.Close)); } } catch { Console.WriteLine("Cp loader exception"); } } } </code></pre> <p>I have also try <strong>cploader.ShowDialog()</strong> with <strong>frm.BeginInvoke(new MethodInvoker(delegate(){ cploader.ShowDialog(frm); }))</strong> , If i use BeginInvoke() then i'm unable to close the loader.</p> <p>Please help me to solve this problem.</p> /q/56687940 0 How to deal error "computation cannot be performed with standard 32-bit LAPACK" on linux server? Zhiyuan Lu /users/11676505 2019-06-20T14:14:08Z 2019-06-20T14:54:32Z <p>When I use <code>scipy.linalg.svd()</code> to process a large matrix, the program gives the following error message:</p> <pre><code>Traceback (most recent call last): File "LaplacianMatrix.py", line 98, in &lt;module&gt; LaplacianInverse = LaplacianPinv(Laplacian) File "LaplacianMatrix.py", line 67, in LaplacianPinv UL,SL,VL = linalg.svd(Laplacian) File "/home/task3/dylan/anaconda3/lib/python3.6/site-packages/scipy/linalg/decomp_svd.py", line 125, in svd compute_uv=compute_uv, full_matrices=full_matrices) File "/home/task3/dylan/anaconda3/lib/python3.6/site-packages/scipy/linalg/lapack.py", line 712, in _compute_lwork raise ValueError("Too large work array required -- computation cannot " ValueError: Too large work array required -- computation cannot be performed with standard 32-bit LAPACK. </code></pre> <p>So what can I do to make the code work well?</p> /q/56687061 3 How to compile a python file to exe file? Josh De Juan /users/11676229 2019-06-20T13:27:28Z 2019-06-20T14:54:02Z <p>I have the next code in a <code>.py</code> file with <code>tkinter</code> library that I want to convert into a <code>.exe</code> file to execute it in any Windows PC. When I covert it with <code>pyinstaller appname.py</code> it generates me the <code>build</code> and <code>dist</code> folders with the <code>.exe</code>. But when I execute it doesn't do anything.</p> <p><code>pyinstaller appname.py</code> <code>pyinstaller -F appname.py</code></p> <pre><code>from tkinter import * import os import subprocess import time raiz = Tk() ###################################################################### raiz.geometry("380x560+700+200") raiz.title('EVA APP') #raiz.config(bg="white") raiz.iconbitmap('robot.ico') ###################################################################### # LOGO DANI imagen1=PhotoImage(file="robot_dani.png") Label(raiz, image=imagen1, justify=CENTER).grid(row=1, column=3, pady=20) ###################################################################### # DEFINICIONES def test(): print("FUNCIONA") def TV(): subprocess.Popen(['//cpd-sts/UsersSoftware/TeamViewer_Setup.exe']) def chrome(): subprocess.Popen(['//cpd-sts/UsersSoftware/ChromeSetup.exe']) def impromptu(): os.system("start chrome http://cpd-reporting:9191/_layouts/15/start.aspx#/SitePages/Instalar%20Impromptu.aspx") time.sleep(2) os.system("//cpd-sts/UsersSoftware/IBMiAccess6Release1/DVD-1/Windows/cwblaunch.exe") time.sleep(5) os.system("%windir%/syswow64/odbcad32.exe") time.sleep(2) os.system("mkdir %userprofile%/Desktop/Cognos") os.system("xcopy //cpd-sts/UsersSoftware/Cognos/* %userprofile%/Desktop/Cognos /e /i") time.sleep(2) os.system("msg * Ir a las propiedades de Setup &gt; Compatibilidad &gt; Cambiar la configuración para todos los usuarios &gt; Ejectutar este programa en modo de compatibilidad para Windows XP. Ejecutar Setup &gt; Siguiente &gt; Siguiente...") os.system("xcopy //cpd-sts/UsersSoftware/Webs_Feina/Impromptu.lnk %userprofile%/Desktop /e /i") ####################################################################### # BOTONES botonTest=Button(raiz, text="TEST", command=test) botonTest.grid(row=3, column=2, sticky="e", padx=4, pady=8) botonTV=Button(raiz, text="Team Viewer", command=TV, activeforeground="white", activebackground="#3399ff") botonTV.grid(row=4, column=2, sticky="e", padx=4, pady=8) botonChrome=Button(raiz, text="Google Chrome", command=chrome) botonChrome.grid(row=5, column=2, sticky="e", padx=4, pady=8) botonImpromptu=Button(raiz, text="Instalar Impromptu", command=impromptu) botonImpromptu.grid(row=6, column=2, sticky="e", padx=4, pady=8) ###################################################################### # Ejecución del programa en bucle raiz.mainloop() </code></pre> <p>The program should be executed with tkinter in a window but that window does not appear. It just does not do anything.</p> /q/56686287 1 How to convert JSON to String to post it to Elasticsearch user7851946 /users/7851946 2019-06-20T12:44:28Z 2019-06-20T14:54:29Z <p>I am developing a web-service using drop-wizard which uses Jackson for JSON, which accepts data in JSON format(document in ES), which I need to pass to ES to index it. As this is big JSON, currently I am not having a corresponding JAVA POJO and I am not (de)serializing it, rather I would directly send it to Elastic-search(ES) api, which also needs data in JSON format. </p> <p>But Now i am calling the Java High level rest client to index the document, which requires this JSON to be converted into String format according the code sample provided <a href="https://www.elastic.co/guide/en/elasticsearch/client/java-rest/7.1/java-rest-high-document-index.html" rel="nofollow noreferrer">https://www.elastic.co/guide/en/elasticsearch/client/java-rest/7.1/java-rest-high-document-index.html</a></p> <pre><code>IndexRequest request = new IndexRequest("posts"); request.id("1"); String jsonString = "{" + "\"user\":\"kimchy\"," + "\"postDate\":\"2013-01-30\"," + "\"message\":\"trying out Elasticsearch\"" + "}"; request.source(jsonString, XContentType.JSON); </code></pre> <p>Now as I already have <strong>JSON</strong> coming to my web-service resource, all I need is to convert it to String and call the service but I am not able to get it right. </p> <p><strong>My Resource code</strong></p> <pre><code> @POST @Path("{id}") public Response create(@PathParam ("id") String id, @NotNull JsonNode json){ try { service.add(id,json); URI uri = new URI(id); return Response.created(uri).build(); }catch (Exception e){ log.error("Error indexing doc", e); } } </code></pre> <p><strong>And my service code</strong></p> <pre><code>String jsonStr = json.textValue(); </code></pre> <p><strong>Please help me as I am noob in JSON parsing and basically my requirement is just convert the JSON which came to my Jersey resource to String.</strong></p> /q/56685916 0 How to put this in python so it can loop random with the mask? gigtime24 /users/11673327 2019-06-20T12:22:39Z 2019-06-20T14:54:24Z <p>How would I put this in python so it can loop generate random with mask leading zeros? </p> <pre><code>std::string min = "000000000000000000000000000000000000000000000000000000000000000F"; std::string max = "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364140"; std::string get_random_ecdsa_key() { while (true) { std::string s = get_random_hex(64); if (s &gt;= min &amp;&amp; s &lt; max) { return s; } } } </code></pre> <p>I want it to be like this python but can limit the hex string with zero's for example: 00000000008a9d63ef2c4</p> <pre><code>import random while True: x = random.randint(0xF,0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364140) print hex (x) [2:66].lower() </code></pre> /q/56684580 2 How do I pass an error message from C to Go? srimaln91 /users/3789634 2019-06-20T11:02:06Z 2019-06-20T14:54:31Z <p>I want to pass an error message from C code to Go stack. How I can accomplish this using an out parameter? </p> <p>I'd really thankful if someone can help me.</p> /q/56680289 2 When Python calls C language, the return value is abnormal wythe /users/11674185 2019-06-20T06:36:52Z 2019-06-20T14:54:48Z <p>When Python calls C language, the return value is abnormal(python3.6.5 call gcc)</p> <p>I tried to pass the list to the C.so file and return a value. I tested the C language without any problem, but the returned value always changedwhen I use python call c.so file,and sometime the return values even become a negative value.</p> <pre><code>//part c #include &lt;stdio.h&gt; #include &lt;math.h&gt; extern c; float get_mod(float *array){ int N=sizeof(array); int i; float mod=0; for(i=0;i&lt;N;++i){ mod=mod+pow(array[i],2); } mod=sqrt(mod); return mod; } float get_inner(float *array1,float * array2){ int N; N=sizeof(array1); int i; float inner=0; for(i=0;i&lt;N;i++){ inner = inner+array1[i]*array2[i]; } return inner; } int cos_sim(float *a,float *b){ float get_mod(float *); float get_inner(float *,float *); float mod1; float mod2; float inner; float cs; mod1=get_mod(a); mod2=get_mod(b); inner=get_inner(a,b); cs=inner/(mod1*mod2); float result; result=cs*pow(10,3); int res=result; printf("%d\n",res); return res; } //part python import ctypes from ctypes import * import numpy as np import win32api dll = ctypes.CDLL(r"E:\whywork\zldf\cosine_similarity_c.so") cossim=dll.cos_sim cossim.argtypes=[POINTER(c_float),POINTER(c_float)] arr1 = np.array([1,2,3],dtype="float64") arr2 = np.array([1,2,5],dtype="float64") cossim.restype=c_int result = cossim(arr1.ctypes.data_as(POINTER(c_float)),arr2.ctypes.data_as(POINTER(c_float))) win32api.FreeLibrary(dll._handle) print(result) </code></pre> <p>I want to know how to set the return value when Python calls C</p> /q/55160847 0 Time-series clustering with multiple seeds automated Steve /users/10002359 2019-03-14T11:03:28Z 2019-06-20T14:54:13Z <p>i am trying to use time-series clustering, following the excellent examples of <a href="https://cran.r-project.org/web/packages/dtwclust/vignettes/dtwclust.pdf" rel="nofollow noreferrer">https://cran.r-project.org/web/packages/dtwclust/vignettes/dtwclust.pdf</a> . However, when I use partitional clustering, the seed is very crucial to the results. Is there an automated way, to run the clustering with multiple seed and show the one that yields the lowest total inter-cluster distance?</p> <p>Thanks</p> /q/52022393 0 Numpy 2-D array boolean masking Ben /users/5859802 2018-08-26T00:57:45Z 2019-06-20T14:54:19Z <p>I don't understand one example in this <a href="https://docs.scipy.org/doc/numpy/user/quickstart.html#indexing-with-boolean-arrays" rel="nofollow noreferrer">numpy tutorial</a>.</p> <pre><code>a = np.arange(12).reshape(3,4) b1 = np.array([False, True, True]) b2 = np.array([True, False, True, False]) </code></pre> <p>Then why will <code>a[b1,b2]</code> return <code>array([4, 10])</code>? Shouldn't it return <code>array([[4, 6], [8, 10]])</code>?</p> <p>Any <strong>detailed</strong> explanation is appreciated!</p> /q/46543894 -1 Can I use Apple/Google In app Purchase without paying? Niavart /users/7135941 2017-10-03T11:48:50Z 2019-06-20T14:54:27Z <p>I was tasked for creating a prototype of an app for a client with in app purchase (using ionic). I found <a href="https://alexdisler.com/2016/02/29/in-app-purchases-ionic-cordova/" rel="nofollow noreferrer">this website</a> explaining the process.</p> <blockquote> <p>The first step is to configure your app and the products you would like to offer on iTunes Connect and Google Play Developer Console.</p> </blockquote> <p>I don't have either and from what I understood on reading said websites, I need to pay 99$/year for apple and 25$ for google Pay and neither propose a (free) trial version (I only want to test and make it ready for later serious development).</p> <p>Is it possible to test/use this without paying ? (A trial/student/ version I misssed ?)</p> /q/26193535 12 ERROR: (gcloud.compute.ssh) [/usr/bin/ssh] exited with return code [255] Anh Nguyen /users/4077596 2014-10-04T14:00:14Z 2019-06-20T14:54:43Z <p><p> I kept getting kicked out of my compute engine instance after a few seconds of idle with the indicated error (255). I used 'gcloud compute ssh' to log in. I am using the default firewall setting, which I believe would be good enough for ssh. But if I am missing something, please so indicate and suggest the fix for this error. Basically I can't get any efficient work done at this point having to ssh in so many times.</p> <p>Thanks in advance.</p> <p>Anh- <p></p> /q/8671194 22 Using XPath starts-with or contains functions to search Windows event logs Keith Walton /users/22448 2011-12-29T17:36:16Z 2019-06-20T14:54:42Z <p>By editing the XML filter query manually in Windows event viewer, I can find events where the data matches a string exactly:</p> <pre><code>&lt;QueryList&gt; &lt;Query Id="0" Path="Application"&gt; &lt;Select Path="Application"&gt;*[EventData[Data and (Data="Session end: imzcjflrrsq1sfdk3okc4jpf")]]&lt;/Select&gt; &lt;/Query&gt; &lt;/QueryList&gt; </code></pre> <p>Now, I want to do a partial match:</p> <pre><code>&lt;QueryList&gt; &lt;Query Id="0" Path="Application"&gt; &lt;Select Path="Application"&gt;*[EventData[Data and (Data[starts-with(.,"Session")])]]&lt;/Select&gt; &lt;/Query&gt; &lt;/QueryList&gt; </code></pre> <p>Event log gives me the error:</p> <blockquote> <p>The specified query is invalid</p> </blockquote> <p>Do I have the syntax wrong?</p> /q/3905003 0 insert null into mysql using vb.net Gbolahan /users/112101 2010-10-11T09:31:45Z 2019-06-20T14:54:55Z <p>Is there way to insert null into mysql from an empty text field in vb.net</p> <p>thanks..</p> /q/620881 32 putting html inside an iframe (using javascript) hasen /users/35364 2009-03-06T23:30:11Z 2019-06-20T14:54:40Z <p>Can I create an empty iframe as a placeholder to later insert html into it?</p> <p>In otherwords, suppose I have an empty iframe with an id, </p> <p>How do I insert html in it?</p> <p>I'm using jquery, if that makes it easier.</p>