Vote count: 0 I'm trying to use Jade for a simple web app for html templating. I have JSON that looks like: { "responses": [ { "fieldOne": 1, "fieldTwo": 2, "fieldThree": "Some string" }, { "fieldOne": 10, "field2": 20, "fieldFour": "Some other string" } ] } I'm trying to loop over this responses list in Jade, and create a row in a table for each response. The looping seems to work fine, the issue is that some responses are missing fields, and I'd like to put a blank in that cell if the field is missing. I'm passing into Jade a map (from Spark) with only one entry, "responseData", which maps to the whole JSON object. body div table thead tr th Field One th Field Two th Field Three th Field F...
ادامه مطلبVote count: 0 I have some piece of JScode that can detect / display alert when user is performing a right click. However i want to simulate an automatic mouse right click action through a javascript. thank you for your support / guidance in this topic asked 1 min agoMani Let's block ads! بخوانید...
ادامه مطلبVote count: 0 I am just wondering how to draw the dynamic updating path in tensorflow playground. You could click play the button and then you'll see the path (at the right side under OUTPUT). What kind of javascript script it is? asked 1 min agoFrank Fan Let's block ads! بخوانید...
ادامه مطلبVote count: 0 I'm trying to bootstrap my Angular 2 RC5 application following this guide https://angular.io/docs/ts/latest/guide/ngmodule.html Below is my code import { AppModuleNgFactory } from './app.module.ngfactory'; import {platformBrowser} from "@angular/platform-browser"; platformBrowser().bootstrapModuleFactory(AppModuleNgFactory); However , when I tried to compile typescript code, I got the following error appmain.ts(1,36): error TS2307: Caot find module './app.module.ngfactory'. How can I generate the app.module.ngfactory file? Which tool should I use? asked 1 min agoToan Nguyen Let's block ads! بخوانید...
ادامه مطلبVote count: 0 In a project I'm working on, I'm separating a lot of bigger files into smaller pieces so they're easier to work with. One specific example is creating class based views from function based views in Django: # app/views/LoginView.py class LoginView(View): ... # urls.py from app.views import LoginView urlpattes = [ # Here, I have to use LoginView twice url(r'^login', LoginView.LoginView.as_view()) ] Above, I have to use LoginView twice when I want to call it, since importing LoginView imports the module, and not the method from the module, even though they are the same name. Ideally, I'd like to avoid having to call LoginView.LoginView each time. In Javascript, I can just say expo...
ادامه مطلبVote count: 0 Originally I was using the following to swap the values of 2 variables at random when the page loaded: var value1 = 260; var value2 = 325; var chosenValue = Math.random() < 0.5 ? value1 : value2; if (value1 == chosenValue) { var val = value1; } else { var val = value2; } if (value1 == chosenValue) { var val2 = value2; } else { var val2 = value1; } However now I need to swap out 4 values and I no idea how to go about doing that. var value1 = 260; var value2 = 325; var value3 = 195; var value4 = 130; Note that each value must be used only once and must be displayed in random order each time page is loaded. help? asked 1 min agoBruce Let's block ads! بخوانید...
ادامه مطلبVote count: 0 In my Node.JS code, i wanted to know some of my asynchronous code execution without debugging (debugging could interrupt my asynchronous cals) application by printing out all filename: line numbers, in order of code execution. As of now, i'm using DEBUG=* npm start to see debug logs on express. But, it's not giving enough information i'm looking for. Is there any better way or module to achieve this? asked 1 min agoPrasad.CH Let's block ads! بخوانید...
ادامه مطلبVote count: 0 I want to copy a sheet from files X,Y and Z to a new file Master11Aug2016. If there already exists a file called Master11Aug2016 in the folder it works, but when there is not it retus an error on the copy line stating . Dim place As String place = "C:Users..." Dim fname As String dt = Format(CStr(Now), "ddmmmyy") fname = "Master" & dt Dim path As String path = place & fname & ".xlsx" Workbooks.Add ActiveWorkbook.SaveAs Filename:=(path) Dim X, Y, Z As String X = Dir(place & "X.xlsx") Y = Dir(place & "Y.xlsx") Z = Dir(place & "Z.xlsx") Workbooks.Open (X) Workbooks(X).Sheets("Sheet1").Calculate Workbooks(X).Sheets("Sheet1").Copy Before:=Workbooks(path).Sheets(1) [error here] Workb...
ادامه مطلبVote count: 0 I came across variable declaration wherein is multiple objects. Here's code: var $slider = $('#slider'); var $slideContainer = $('.slides', $slider); Can somebody explain me how it works? asked 39 secs agoTomsz Comasz Let's block ads! بخوانید...
ادامه مطلبVote count: 0 I have a bash script as below: ------------------------------ #!/bin/bash VAR_A=$(echo "cat //artifact/fileName" | xmllint --shell BuildResult.xml | sed '/^/ >/d' | sed 's/]*.//g' | tr -d 'n' | awk -F"-------" '{print $3}') echo $VAR_A ------------------------------ I have jenkins installed on a windows machine and via cygwin openssh, I am coecting to the suse linux machine in which this script is residing. When I am calling the above script via an ANT sshexec command configured in Jenkins, it is ruing ok but no output. On the other hand, when I am ruing the same script from within the SUSE Linux system, it is echoing current result. I am not able to figure...
ادامه مطلبVote count: 0 I´m leaing javascript OOP and I´m having issues understanding inheritance. Could you explain me why the outcomes from this two codes differ? : function a(){} function b(){ this.uno = "hello"} b.prototype = new a(); function c(){ this.dos = "bye"} c.prototype= new b(); var obj = new c(); console.log(obj.uno); console.log(obj.dos); console.log(obj.constructor); //hello //bye //[function: a] function a(){} function b(){ this.uno = "hola"} b.prototype = new a(); function c(){ this.dos = "bye"} c.prototype = {constructor:b} var obj = new c(); console.log(obj.uno); console.log(obj.dos); console.log(obj.constructor); //undefined //bye //[function: b] I tr...
ادامه مطلبVote count: 0 i have a shell script and argument as date . I'm looking for some help in design ,where i will have to create UI and pass the date . So that It will call the shell script with argument[it should open unix terminal and call the shell script with useame and password] . The whole shell script runs on LINUX server. i would preferably looking on Mark-logic/Java/Unix and Scala. I should not use web server in my application. Can some one please suggest how to call the shell script from java application with out using Appserver/Webserver. asked 32 secs agoxmlalcholic...
ادامه مطلبVote count: 0 When following the openDDS install guide I attempt to run configure from within the command prompt but receive this output: C:UsersSupervisorDesktopopendds>C:UsersSupervisorDesktopopenddsconfigure.cmd Can't find a compiler, set PATH or run this script with the --compiler option. For Microsoft Visual C++, run this script from the Visual Studio Command Prompt. Stopped at configure line 336. This error relates to this section of code within the perl script (as seen by the line number): if ($opts{'compiler'}) { my $standard = 0; for my $stdcomp (@{$platforminfo{$op...
ادامه مطلبVote count: 0 so i have this set of strings which are stored in an array i want to search the array so when the string is found it should say found and when its not found it should say invalid this is what i have so far cout...
ادامه مطلبVote count: 0 can someone give me a quick OS X script I can use to check process 'x' every 30 seconds and if the process is dead restart it in the same way one starts an application by double clicking on it in finder? for example, if Textedit has quit restart test.txt. asked 42 secs agoozz Let's block ads! بخوانید...
ادامه مطلبVote count: 0 I am looking for something that functions to what amounts to JavaScript injectection, but safer. This idea can be most effectively observed by your broswer's console and start noodling with something like document.getElementById('btnSubmit').value = 'I took over your button'; after a quick inspection of the site in question. I would effectively would like to amend an established website to a local machine for the purpose of pre-filling fields as an exercise of efficiency in a work process. The Background So far, JavaScript seems to be the best candidate for accessing elements with a document read in by a browser, and JavaScript injection is the only feasible method of sort of a...
ادامه مطلبVote count: 0 i'm trying to make an array with 30 integer elements between 0 and 2 randomly chosen. When some number is chosen 10 times, i can't append it anymore. In the end, i need an array with 30 elements with 10 numbers 0, 10 numbers 1 and 10 numbers 2. Here's what i'm trying: import random array_size = 30 number = 3 counter = [0, 0, 0] solution = [] for i in range(array_size): number = random.randrange(number) #generates numbers between 0 and 2 while counter[number] > 10: number = random.randrange(number) counter[number] += 1 solution.append(number) As result, i have more than 10 elements of the same number. I believe the problem is in the random number that i put in the while is not c...
ادامه مطلبVote count: 0 Lets say you have a couple object literals defined that are classes to various apps, like: var dataStorage = { some class to store app data info } var setup = { some class to setup the data in dataStorage } var app = { some class for the main app view } var controller = { some class to control the flow } and the flow is dependent on callbacks. So the controller will make its own instances of the object literal class's defined using var app_instance = Object.create(app) and then start each app accordingly using .startApp(callback) for each object/class above, which takes a callback that is executed when that app or object/class is done. This typically means something was updated...
ادامه مطلبVote count: 0 Input: function timer() { decimal++; cs++; //counts time in centiseconds decimalOut.ierHTML = decimal; if (decimal >= 100) { decimal = 0; sec++; if (sec > 59) { sec = 0; min++; colon.ierHTML = ":"; minOut.ierHTML = min; } if (sec 0) { sec = "0" + sec; } secOut.ierHTML = sec; } if (decimal...
ادامه مطلبVote count: 0 So, i'm trying to get all 'skillpoints' values from the api file(part of it below): 2016-08-07 00:13:34 0 and sum them up, how can i do it? asked 1 min ago10anat120 Let's block ads! بخوانید...
ادامه مطلب