Posts

Showing posts from April, 2010

javascript - Turn several strings of structured text into HTML table -

for example have following text no tags @ within html page: color: red shape: square side: 1mm as rows needed, 3 quite enough question. 1 be. in rows i'll have the beginning of text string , colon+space (: ) , the end of text string . how should turn the beginning of text string <tr><td> , colon+space :</td><td> , the end of text string </td></tr> ? thanks @andrew willems (the script) , @phil (further suggestions) , running. the original text here has unnecessary lines before , after text demonstrate need dealing with, , ability deal with, lines. var opening = '<table id="newborn_table"><tbody>'; var closing = '</tbody></table>'; var origtext = document.queryselector('#source').innertext; var lines = origtext.split('\n').filter(function(line) { return (line !== ""); }); var rowstext = ''; lines.foreach(function(line) { ...

python - TypeError: 'JavaPackage' object is not callable -

i getting below error whilie trying run word count example using sparkstreaming,python. not sure how proceed. below command running , error. /opt/spark/bin/spark-submit --jars spark-streaming_2.10-2.0.0.jar test_kafka.py broker.txt "localhost:2181:mytopic" error: traceback (most recent call last): file "/home/ubuntu/kafka/libs/test_kafka.py", line 21, in <module> kvs = kafkautils.createdirectstream(ssc, [topic], {"metadata.broker.list": brokers}) file "/opt/spark/python/lib/pyspark.zip/pyspark/streaming/kafka.py", line 122, in createdirectstream file "/opt/spark/python/lib/pyspark.zip/pyspark/streaming/kafka.py", line 195, in _get_helper typeerror: 'javapackage' object not callable

javascript - Calculate all item totals to subtotal Jquery -

note: bunch of people have had similar questions code set little differently solutions won't work here. i have subtotal variable should add each total(price * quantity) each item , return combined total. i'm getting subtotal coming as: 8.99undefinedundefinedundefined. if add new item it's now: 8.9911.99undefinedundefined here's code: // defining order items // ea item creates new row 3 td cells. includes item description , price var $burger = $("<tr><td class='addedburger'>royale w/ cheese</td><td></td><td>$8.99</td> <td id='burgercount'></td> </tr>"); var $pizza = $("<tr><td class='addedpizza'>arugula pizza</td><td></td><td>$11.99</td> <td id='pizzacount'></td> </tr>"); var $pork = $("<tr><td class='addedpork'>smoked pork ribs</td><td></td><td...

hadoop - ClickStream Data Analysis -

Image
i new bigdata analysis , came across interesting scenario called clickstream data analysis . know clickstream data. know more , different scenarios in can used in best interests of business , set of tools need process data in different steps of each scenario. any appreciated. thank you. what clickstream data? it virtual trail user leaves behind while surfing internet. clickstream record of user's activity on internet, including every web site , every page of every web site user visits, how long user on page or site, in order pages visited, newsgroups user participates in , e-mail addresses of mail user sends , receives. both isps , individual web sites capable of tracking user's clickstream. clickstream data may include information like: browser height-width,browser name,browser language, device type (desktop,laptop,tablets,mobile),revenue,day,timestamp,ip address, url,number of products added in cart, number of products removed,state,country,billing zip co...

gnu make - How can default env variable in gnu makefile target -

i want this test.install: export build_number=${build_number:-$${another_var}} but not working. come blank edit: this works fine. provided export build_number in shell before invoking make command test.install: export build_number=${build_number} these not working . both give blank build_number test.install: export build_number=${build_number:-$${another_var}} and test.install: export build_number=${build_number:-55}} if want expand variables in bash rather in makefile, you'll need escape expansion otherwise make going variable literally called build_number:-${another_var} or build_number:-55 test.install: export build_number=$${build_number:-$${another_var}} test.install: export build_number=$${build_number:-55}}

python - How to get Read the Docs to generate py-modindex.html? -

i'm trying read docs generate py-modindex.html file. research this question lead me following setup: setup.py in project directory has following contents, minimum needed pytest work , haven't been changed since got part of project working: import setuptools setuptools.setup( name='polygons', packages=setuptools.find_packages(), ) docs/requirements.txt contains single line: sphinx-autodoc-annotation the read docs repository url points github repository. the rtd setting "install project inside virtualenv using setup.py install" checked. the rtd setting "requirements file" points docs/requirements.txt . the "module index" link gets included in index.html , py-modindex.html file missing. my understanding virtualenv setting above, rtd use setup.py file install project sphinx can read documentation found in python docstrings. i'm using function annotations , sphyinx-autodoc-annotation make use of when cre...

python - Nearest match merge on two columns (pandas) -

similar 1 of previous questions ( merge dataframes on nearest datetime / timestamp ), merge 2 pandas data frames on 2 datetime columns using nearest match: let , b 2 dataframes follows: a = pd.dataframe({"id":["a", "a", "c" ,"b", "b"], "init_date":["01/01/2015","07/02/2014","08/02/1999","01/01/1991","06/22/2014"], "fin_date":["04/16/1923","09/24/1945","06/24/1952","11/26/1988","10/05/1990"]}) in [15]: out[15]: id fin_date init_date 0 04/16/1923 01/01/2015 1 09/24/1945 07/02/2014 2 c 06/24/1952 08/02/1999 3 b 11/26/1988 01/01/1991 4 b 10/05/1990 06/22/2014 b = pd.dataframe({"id":["a", "a", "c" ,"b", "b"], "date":["02/15/2015","06/30/2014","07/02/1999","10/05/1990",...

javascript - NodeJs Require a File -

i using nodejs. possible require javascript file in node in browsers? because when use require() method calls javascript file no access global variables in server.js "use strict" guess. needed load module , make continuation of main file since module depends on global variables. edit: i have server.js file: var settings = require("settings.js"); var clients = require("clients.js"); var removepack = []; /**here runs websocket server**/ ... ... //when new socket connects: io.on("connection", function(socket){ var socket.id = math.random(); var client = clients.create(socket.id); }); here clients.js file: exports.create = function(){ self.team = settings.generaterandomteam(); /*the problem here. can´t access settings variable*/ self.maxspeed = settings.maxspeed; ... ... return self; } edit 2: when use settings = require("settings.js") following error: typeerror: settings.generaterandomteam()...

What are the requirements to install TensorFlow with python 3? -

i trying install tensorflow enabled gpu. using instructions form the official site . first, created environment: conda create --name tf_py3_tf_gpu python=3.5 then activated environment , got version appropriate machine: export tf_binary_url=https://storage.googleapis.com/tensorflow/mac/gpu/tensorflow-0.10.0rc0-py3-none-any.whl then went ahead , ran pip3 install: (tf_py3_tf_gpu)user~/envs/tf_py3_tf_gpu/lib/python3.5/site-packages $ pip3 install --upgrade $tf_binary_url but error: -bash: pip3: command not found however, cluster connecting not allow me use apt-install install pip3 (if there way install conda environment or of style awesome! allowed , have normal pip). anyway went ahead , did normal pip see if worked: pip install --ignore-installed --upgrade $tf_binary_url however, failed message: (tf_py3_tf_gpu)user~/envs/tf_py3_tf_gpu/lib/python3.5/site-packages $ pip install --upgrade $tf_binary_url collecting tensorflow==0.10.0rc0 https://storage.googleapis....

python - Django drf-nested-routers - model object has no attributed related field -

i creating api using drf-nested-routers application django rest framework . application tracker users have sessions , tasks. each user can have 3 active tasks , can work on each of these tasks in given session. my (abbreviated) models are: #models.py class user(models.model): name = models.charfield() class task(models.model): start_date = models.datefield() task_title = models.charfield() user = models.foreignkey(user, on_delete=models.cascade) class session(models.model): session_date = models.datefield() user = models.foreignkey(user, on_delete=models.cascade, related_name='sessions') task_one = models.foreignkey(related_name="task_one") task_one_attempts = models.integerfield() task_two = models.foreignkey(related_name="task_two") task_two_attempts = models.integerfield() i have created following (abbreviated) serializers these models: #serializers.py class taskserializer(serializers.modelserializer)...

Firebase Analytics incorrect active user count -

Image
i integrating app firebase , have added ability users create accounts using email, facebook, google accounts. my app still under development , yet pushed app store. available on ios right now. firebase analytics reports there 38 active users when 1 actively building it. active users unique users initiated sessions period of time. when install, uninstall , install app again, counted 2 active users. if you'd learn more firebase dashboard metric, check out firebase documentation .

sql server - Using Parameters in ALTER TABLE ...Add default statement -

i cannot use parameter set default value column due properties variable, error was: the name "mart" not permitted in context. valid expressions constants, constant expressions, , (in contexts) variables. column names not permitted. how can convert variable value constant or better way assign value(a value of parameter) column? lot declare @database varchar(100) set @database='mart' create table #temp ( name varchar(256), [rows] int, reserved varchar(90), [data] varchar(90), index_size varchar(90), unused varchar(90), delta_date datetime default getdate() ) alter table #temp add databese varchar(100) declare @sqlstring1 nvarchar(500) set @sqlstring1 = n'alter table #temp add default "'+@database+'" database' exec sp_executesql @sqlstring1 alter table temp add default '''+@database+''' ......

Java Huge csv file processing and storing using Apache Spark/ Kafka/ Storm to Cassandra -

i working on requirement need read sensor data csv/tsv , insert cassandra db. csv format: sensor1 timestamp1 value sensor1 timestamp2 value sensor2 timestamp1 value sensor2 timestamp3 value details: user can upload file our web application. once file uploaded, need display unique values column user in next page. for example -> sensor1 node1 sensor2 node2 sensorn create user can either map sensor1 existing primary key called node1, in case timestamps , values sensor1 added table primary key equal node1 or create primary key, in case timestamps , values added new primary key. i able implement using java8 streaming , collection. working small csv file. question: how can upload huge csv/ tsv file (200 gb) web application? shall upload file in hdfs , specify path in ui? have split huge file small chunks (50 mb each). how can unique values first column? can use kafka/ spark here? need insert timestamp/ value cassandra db. again can use kafka/ spark here? ...

javascript - Why my postMessage does not work on chrome and firefox? -

i made 2 pages, page a.html is: <script> var popup = window.open("b.html"); popup.postmessage("hello there!", "*"); function receivemessage(event) { alert(event.data); } window.addeventlistener("message", receivemessage, false); </script> and page b.html <script> function receivemessage(event) { alert(event.data); event.source.postmessage("hi there yourself!", "*"); } window.addeventlistener("message", receivemessage, false); </script> if open a.html in ie, can these scripts work , alert() popup message on each of page. however, when load a.html in chrome or firefox, open b.html in window , alert() won't executed @ all. why?

Octave compare two arrays -

given 2 column vectors,i need compare each element of vector first element of vector b in first iteration , return logical array. second element of vector b each element of vector , return logical array forth. number of logical arrays equal number of elements in vector b. a=1:10; b=[5 6 7]; j=1:length(b), i=1:10, c=b(j)==a(i); end; end; ex: after first iteration of inner loop need return [0 0 0 0 1 0 0 0 0 0] try this: a = 1:10 b = [5 6 7] output = zeros(3,10); = 1:length(b) output(i,:) = (a == b(:,i)) % b(:, i) meas using index value end output = 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 1 0 0 0

php - Is laravel-ide-helper compatible with laravel 5.3? -

laravel-ide-helper github: https://github.com/barryvdh/laravel-ide-helper when use "composer install" throw these errors [symfony\component\console\exception\commandnotfoundexception] there no commands defined in "ide-helper" namespace. script php artisan ide-helper:generate handling post-install-cmd event returned error [runtimeexception] error output: is laravel-ide-helper compatible laravel 5.3? adding line 'barryvdh\laravelidehelper\idehelperserviceprovider', in app.php 'providers' array fixed it.

immutable.js - How to map over key-values in a map to produce another map with ImmutableJS? -

how, using immutablejs , produce new map mapping on key/value pairs of input map? in scala, this: scala> map(1->2, 3->4).toseq.map{case (k, v) => (k*k) -> (v*v*v)}.tomap res1: scala.collection.immutable.map[int,int] = map(1 -> 8, 9 -> 64) (this case trivially squares key , cubes value.) in javascript, i'm hoping like: immutable.fromjs({1: 2, 3: 4}).map((v, k) => [k*k, v*v*v]).tojs() // { 1: 8, 9: 64 } (i'm using es6 via babel .) i realize isn't guaranteed produce defined result, due potential key collision. in application preventing elsewhere. i'm using orderedmap , if makes difference. the function looking mapentries . here's example: immutable.fromjs({1: 2, 3: 4}).mapentries(([k, v]) => [k*k, v*v*v]).tojs() // { 1: 8, 9: 64 } mapentries takes function takes key/value pair array, , should return new key/value pair array.

How do you make sure email you send programmatically is not automatically marked as spam? -

this tricky 1 , i've relied on techniques, such permission-based emails (i.e. sending people have permission send to) , not using blatantly spamish terminology. of late, of emails send out programmatically have started being shuffled people's spam folder automatically , i'm wondering can it. this despite fact these particular emails not ones humans mark spam, specifically, emails contain license keys people have paid money for, don't think they're going consider them spam i figure big topic in ignorant simpleton. use email authentication methods, such spf , , dkim prove emails , domain name belong together, , prevent spoofing of domain name. spf website includes wizard generate dns information site. check reverse dns make sure ip address of mail server points domain name use sending mail. make sure ip-address you're using not on blacklist make sure reply-to address valid, existing address. use full, real name of addressee in field,...

android - Open SSL vs Secure SSL -

could 1 let me know difference between open ssl , secure ssl. acutely have posted new android application @ play store, uses remote api. at api server have installed secure ssl. still being rejected , support team says application has "openssl vulnerabilities in apps". i using oovoo sdk in application, may contains above issue. but here know difference between open , secure ssl. thanks!

mysql - Using current lat/lng to query database and return data to user in php -

so have issue want able query data user's current location still new json , trying figure out how send data main page. here hidden inputs lat/lng values on index.php page <input type="hidden" id="latitude"> <input type="hidden" id="longitude"> here code send lat/lng tables.php index.php page $.getjson(geocoding).done(function(location) { $('#latitude').html(position.coords.latitude); $('#longitude').html(position.coords.longitude); $.ajax({ url:'table.php', method: 'post', datatype: 'json', data:{ lat: $('#latitude').val(), lng: $('#longitude').val() }, success: function(data){ console.log(); } }); }); i using datatables display data on index.php page. <link rel="stylesheet...

c# - How to enable a Toolbar in Xamarin Forms -

Image
i have simple xamarin project xaml , use material design, seems enable default toolbar doesn't show along mainpage. or need add toobar xaml? mainpage.xaml : <contentpage xmlns="http://xamarin.com/schemas/2014/forms" xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" xmlns:local="clr-namespace:material" x:class="material.mainpage"> <label text="welcome xamarin forms!" verticaloptions="center" horizontaloptions="center" /> <toolbaritem name="test" /> </contentpage> style.xml : <style name="maintheme" parent="maintheme.base"> </style> <style name="maintheme.base" parent="theme.appcompat.light.darkactionbar"> <item name="windownotitle">true</item> <item name="windowactionbar">false</item...

vba - How to run macro in word without opening it? -

how run macro in word without opening it. went through same question asked before. solution is: dim word dim worddoc set word = createobject("word.application") word.visible = false set worddoc = word.documents.open("d:\working_folder\abc.doc") word.run "<macroname>" worddoc.save word.quit set worddoc = nothing set word = nothing this working me in case file name specific ( "abc.doc" ). what if want run macro word files in same folder? macro defined in files, want know how filenames in folder. untested, this: dim word, fldr, f dim worddoc set word = createobject("word.application") word.visible = false fldr = "d:\working_folder\" f = dir(fldr & "*.doc*") while f<>"" set worddoc = word.documents.open(fldr & f) word.run "<macroname>" worddoc.save worddoc.close f = dir() loop word.qu...

physics - How to simulate directional wind? -

i developing hair strand system project. using verlet integration simulate gravity , wind. wind vector vector. want make more realistic wind. is there papers or articles should read about? thanks. it depends on how deep want go simulation. suppose want more interesting uniform wind varying direction , intensity. suggest adding turbulent velocity each strand 3d curl/simplex noise. animated perlin noise might cheap , fast enough needs, might able more dramatic effects curl noise. the original paper curl noise here: http://www.cs.ubc.ca/~rbridson/docs/bridson-siggraph2007-curlnoise.pdf you can find several implementations of it, basic idea still same - perturbing particles according underlying flow-field.

android - RecyclerView inside Coordinate layout -

Image
i using recyclerview inside coordinator layout.in main.xml have save button , edit text field. on click save button need pass edit text value next xml have recyclerview. run time error occurs. happening code? mainactivity: public class mainactivity extends appcompatactivity implements recyclerviewadapter.onitemclicklistener { edittext textin,txtheading; button buttonadd,btnsave; linearlayout container; private recyclerview myrecyclerview; private linearlayoutmanager linearlayoutmanager; private recyclerviewadapter myrecyclerviewadapter; private recyclerview.layoutmanager recyclermanager; @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_main); myrecyclerview = (recyclerview)findviewbyid(r.id.recyclerview_builderxml); linearlayoutmanager = new linearlayoutmanager(this, linearlayoutmanager.vertical, false); myrecyclerviewadapter = new recyclerviewadapter(this); ...

jsp - Why I am getting java.lang.IllegalStateException when the validate servlet is called? -

i have login web application. whenever login, request must validated validate servlet , must forwarded admin.jsp fine except got exception java.lang.illegalstateexception. code: /* * developer : suraj gautam * campus: shankerdev * faculty: bim * company : unknown company */ package com.suraj.technepbankapplication; import java.io.ioexception; import java.sql.connection; import java.sql.drivermanager; import java.sql.preparedstatement; import java.sql.resultset; import java.sql.sqlexception; import javax.servlet.servletexception; import javax.servlet.annotation.webservlet; import javax.servlet.http.httpservlet; import javax.servlet.http.httpservletrequest; import javax.servlet.http.httpservletresponse; /** * * @author suraj gautam */ @webservlet(name = "validate", urlpatterns = {"/validate"}) public class validate extends httpservlet { databean bean = new databean(); int count = 0; @override protected void doget(httpservletrequest req, httpservlet...

java - BufferedReader / Scanner Last Line Reading Issue -

while solving problem @ hacker-rank facing issue scanner/bufferedreader unable read last. input provided them like 10 abcdefghijk 2 r 1 2 w 3 4 so both scanner/bufferedreader unable read last line. if input code seems work fine. 10 abcdefghijk 2 r 1 2 w 3 4 (end of input) public class scannertest { public static void main(string[] args) { // todo auto-generated method stub scanner input = new scanner(system.in); int len = input.nextint(); input.nextline(); string inputstring = input.nextline(); int qc = input.nextint(); input.nextline(); system.out.println(); system.out.println(len + inputstring + qc); for(int i=0;i<qc;i++){ string l = input.next(); int le = input.nextint(); int ri = input.nextint(); input.nextline(); system.out.println(l+le+ri); } input.close(); } } here sample code using. kno...

r - Multiple x-axis labels for time-series data -

Image
i able plot time-series data using ggplot2 . however, want highlight seasonal information alongwith time-series data. here's code: library(zoo) library(ggplot2) <- read.table(text = " season quarter sales season1 2014q1 20 season1 2014q2 40 season1 2014q3 60 season1 2014q4 80 season2 2015q1 30 season2 2015q2 40 season2 2015q3 80 season3 2015q4 90 season3 2016q1 100 season3 2016q2 120 season3 2016q3 140 ", header = true, sep = "") a$quarter<-as.yearqtr(a$quarter) a$quarter<-as.date(a$quarter) ggplot(data=a,aes(x=quarter, y=sales)) + geom_line() this works in able draw time-series data. now, want label constitutes season 1, 2 etc. 1 way use color or linetype . however, doesn't seem work because breaks continuity of time-series. # doesn't work... ggplot(data=a,aes(x=quarter, y=sales)) + geom_line(...

gulp - What is "Code over configuration"? -

i have seen terms many times on google code on configuration or configuration on code . tried on searching on google, still got nothing. started work on gulp again mystery came code on configuration . can please tell me both , difference on them? since tagged gulp, i'll give popular comparision tool (gruunt) tell difference. grunt’s tasks configured in configuration object inside gruntfile, while gulp’s coded using node style syntax. taken here so configuration have give tool information needs work thinks has work. if focus on code tell tool steps has complete directly. there's quite bunch of discussion 1 better. you'll have have read , decide fits project best.

haskell - Convert a entryGetText into Int gtk2hs -

i'm trying convert entrytext string, can use other functions. `unsafeperformio (entrygettext txtmagn)` while trying compile code, error message: `couldn't match type ‘io a0 -> a0’ ‘[char]’ expected type: string actual type: io a0 -> a0 probable cause: ‘unsafeperformio’ applied few arguments in first argument of ‘putstrln’, namely ‘unsafeperformio’` thanks in advance this because wrote putstrln unsafeperformio (entrygettext txtmagn) here pass unsafeperformio putstrln parameter. meant: putstrln (unsafeperformio (entrygettext txtmagn)) now unsafeperformio . name suggests, unsafe , you'd better have clear idea trying accomplish. safely pull out value out of io , use later: text <- entrygettext txtmagn putstrln text

Ajax not working in webview android -

i trying call ajax android webview , it's not working. getting error in console window 08-29 12:28:16.411: e/content(14146): [object object] @ 1: http://loconav.com/assets/m/history_selector-1b620f001e31e9dfeff6981b3ee9b290.js 08-29 12:28:16.536: e/content(14146): uncaught typeerror: undefined not function @ 1: http://loconav.com/assets/m/history_selector-1b620f001e31e9dfeff6981b3ee9b290.js 08-29 12:28:16.683: e/content(14146): uncaught typeerror: undefined not function @ 1: http://loconav.com/assets/m/history_selector-1b620f001e31e9dfeff6981b3ee9b290.js 08-29 12:28:16.883: e/content(14146): uncaught typeerror: undefined not function @ 1: http://loconav.com/assets/m/history_selector-1b620f001e31e9dfeff6981b3ee9b290.js 08-29 12:28:17.202: e/content(14146): uncaught typeerror: undefined not function @ 1: http://loconav.com/assets/m/history_selector-1b620f001e31e9dfeff6981b3ee9b290.js i using android code webview = (webview) findviewbyid(r.id.webview); webview.setweb...

javascript - Checking if object not null before accessing property -

this question has answer here: javascript test existence of nested object key 41 answers var how = $('how'); var id = $('myid'); if ((how != null && !how.value.blank()) || myid != null) { return true; } else { alert('error'); } is there easier way check not null , checking if value of element blank without having both != null , calling value? since null falsy, shorter version be if((how && !how.value.blank()) || myid != null) { ... } note above code , own snippet both assume if how exists, have property called value , , throw exception if not case.

c# - Input.GetAxisRaw not working? not moving horizontal -

public float movespeed = 0.0f; public float maxmovespeed = 30f; private vector3 input; private charactercontroller controller; void update () { input = new vector3 (input.getaxisraw("horizontal"), 0, 0); controller.move (vector3.forward * movespeed * time.deltatime); if (getcomponent<rigidbody> ().velocity.magnitude < maxmovespeed) { getcomponent<rigidbody> ().addforce (input * movespeed); } } i want player keep moving forward not moving left , right. there no errors. suspect logic flaw can't figure out.

asp.net - How can I synchronize physical files manually in a Kentico web farm? -

we have non-standard kentico architecture kentico have advised supported long synchronization of physical files between load balanced servers disabled , handled manually. correct way manually synchronize web farm server files? wondered using tool dirsync assume require 1 server act primary, whereas kentico new media file, example, may saved of physical servers. i'm hoping identify definitive solution issue. thanks. kentico web farm default synchronizes physical files automatically if web farm working properly. each request can served different server kentico serializes file binary database shared servers , re-creates file on server missing. i'm not aware of situation web farms supported, file synchronization isn't. it's either or nothing, there no middle solution. can more specific of why synchronization of physical files not working on end? long servers see database (which should otherwise wf not working @ all) file synchronization work. ps: if fi...

php - magento enterprise catalog category permission not working -

i have setup category permission 1 customer group on apparel category. not working properly. showing apparel category restricted , guest user in menu , when click on it, goes no-route page. according standard magento enterprise feature not show restricted category non permissible user group. did not override regarding catalog menu default functions working. thanks in advance

sql server - updating a column using cursor having loops -

i have table | code | descd | slnum | |------|-------|-------| | 10 | | 0 | | 10 | b | 0 | | 12 | c | 0 | | 12 | d | 0 | | 11 | e | 0 | | 11 | f | 0 | and have update slnum column using cursor having loops | code | descd | slnum | |------|-------|-------| | 10 | | 1 | | 10 | b | 2 | | 12 | c | 1 | | 12 | d | 2 | | 11 | e | 1 | | 12 | f | 3 | how resolve this? have tried not giving me correct output declare @value int declare @s int=1 declare scursor cursor select slnum trec update of slnum open scursor fetch next scursor @value while @@fetch_status = 0 begin if exists(select * trec) -- missing begin update trec set slnum=@s current of scursor select @s=@s+1 end else begin update trec set slnum=@s current of scursor end fetch next scur...

javascript - changing React.js form values from a chrome extension -

i'm not developing in react.js, i'm working on chrome extension needs programatically fill form values different kinds of sites. the site uses react.js, , i'm filling value in usual way with: element = document.queryselector("input[name=firstname]"); element.value = "something"; when user clicks submit button, gets error form element, if element has value: "this information required." it doesn't if fire "change" event element. evt = document.createevent("htmlevents"); evt.initevent("change", false, true); element.dispatchevent(evt); there method in react.js framework need call programatically change value? react.js experienced users appreciated! i found solution. call element.select(); before changing value.

applicative - In Haskell, is there an abstraction for the <?>-operator? -

i found myself writing code: import control.applicative ((<|>)) x = ma <|> mb <?> c (<?>) :: maybe -> -> x <?> _ = x nothing <?> y = y where ma :: maybe a , mb :: maybe a , c :: a , , x :: a . basically, code says: pick first alternative not empty , default c . can call "reverse maybe monad" analogy <?> pure . equivalently, have written just x = ma <|> mb <|> pure c, but feel uncomfortable irrefutable pattern. or, of course, x = frommaybe c (ma <|> mb) because frommaybe === flip <?> . the <?> operator inspired parsec. suspicious when find myself defining utility functions that, couldn't find defaulting behavior anywhere. apparently alternative , applicative not powerful enough. did miss type-class? i think it's idea leave things @ (<?>) = flip frommaybe . if you'd generalize though, foldable seems simplest class notion of emptiness: (...

javascript - How to get session data in .js file -

in application when user login particular user id stored in session. want id in js file.in js file contain state provider,factory etc js var sessionvalue = "'"+<%=session["userid"]%>+"'" alert(sessionvalue) but show error( unexpected ) 1.you can assign session value hidden field. <input type="hidden" name="userid" id="userid" value="<%= session["userid"] %>"> get hidden field value javascript function. function getuserid() { var userid = document.getelementbyid('userid').value; alert(userid); }

javascript - Display popups with leaflet ( large dataset ) -

im using leaflet & geojson-vt visualize large dataset (geojson 70,000 polylines features) is there way show smoothly popup (it contains polyline data) on click event on 1 of multiple polylines ? i using geojson-vt , example here add tiles leaflet map. i tried function oneachfeature(feature, layer) { layer.on('click', function(e) { layer.bindpopup(feature.properties.numero); }); } l.geojson($scope.dataoffile.data, { oneachfeature: oneachfeature }).addto(map); but map keep freezing. not sure i'm understanding... example draws canvas layer vector tiles, has no interaction method. if polygons use point in polygon original data. since it's lines may want experiment on plugin using 0 weight (transparent) lines.

c++ - Caffe Installation - NuGet packages for OpenCv 2.4 and OpenBlas 0.2.14 missing - throwing several build errors on Visual Studio 2015 -

i absolute beginner in caffe , trying build caffe solution on windows 10 on visual studio 2015 opencv 3.1.0 on c++. have been following https://www.youtube.com/watch?v=nrzaf2sxhhm youtube link reference. these steps have followed till now:- 1.i have uninstalled opencv 2.4 nuget packages library , have installed opencv default build (opencv 310) instead. 2.also have enabled nuget packages going tools->options->nuget package manager->package sources , have checked microsoft , dot net option there. 3.just fyi, want run in cpu mode (no gpu) , have changed settings in commonsettings.props follows, <cpuonlybuild> true </ cpuonlybuild> <usecudnn > false </usecudnn> 4.i have changed blas configuration default (atlas) open since openblas v 0.2.14.1 installed in nuget packages. # blas configuration (default = atlas) blas ?= open i still getting following build errors- severity code description project file line suppression sta...

android - Is there actually a minimum API level for AppCompatActivity? -

i have read appcompatactivity can used api levels 15 , on. work api level 17 , eclipse (neon) , can't make work. have added both android-support-v4.jar , android-support-v7-appcompat.jar in ref libraries , i'm of course importing android.support.v7.app.appcompatactivity. more specifically: 1) style name="apptheme" parent="theme.appcompat.light.darkactionbar" doesn't work. "no resource found matches ..." error. 2) if don't use (so eclipse can complile project), app crashes (by extending main activity 'appcompatactivity' (instead 'activity'). so, there minimum api level or special setting needed using appcompatactivity not find anywhere? (please not reference me similar issues posted in stackoverflow.com. have read them all, replies. suggest import 'appcompt' jars, etc., did day one. , suggest use theme.appcompat.light.darkactionbar (or noactionbar, etc.) standard, me doesn't work.)

swift2 - Swift POST request don't work -

i'm trying make post request swift. goal post accesstoken facebook server not work. here's code: let myurlfb = nsurl(string: "myapiserver"); let requestfb = nsmutableurlrequest(url:myurlfb!); requestfb.httpmethod = "post";// compose query string //we make post string let poststringfb = fbsdkaccesstoken.currentaccesstoken().tokenstring requestfb.httpbody = poststringfb.datausingencoding(nsutf8stringencoding); let task = nsurlsession.sharedsession().datataskwithrequest(requestfb) { data, response, error in if error != nil { print("error=\(error)") return } the answer follows: {"statuscode":400,"error":"bad request","message":"child \"access_token\" fails because [access_token required]","validation":{"source":"payload","keys":["access_token"]}}) here way can consume po...