Posts

Showing posts from March, 2012

javascript - Constantly getting an email: Cannot read property "0" from undefined -

i getting emails "me" in it: cannot read property "0" undefined. i think has google apps script because started when tried code something. (for details: trying code "contact form" website) i cant post images yet because of reputation have few links here: http://i.stack.imgur.com/mgv6e.jpg http://i.stack.imgur.com/a3hje.png any appreciated, thanks! you need turn off trigger. go script.google.com . create blank script. once in apps script editor click on "resources"->"all triggers" you see triggers associated account. can click on x icon next ones want delete.

asp.net mvc - All .Net sample apps giving assembly issues -

Image
recently project of mine starting having issues linq in views. couldn't figure out why happening created project in vs 2013 using default web app template mvc 4. giving me same issues. app runs fine, intellisence isn't referencing model being used , references model in view giving error: the type arguments method 'system.web.mvc.html.labelextensions.labelfor<tmodel,tvalue>(system.web.mvc.htmlhelper<tmodel>, system.func<tmodel,tvalue>>)' cannot inferred usage. the project created .net 4.5.1 target framework , can verified in project's properties , web.config: <compilation debug="true" targetframework="4.5.1" /> <httpruntime targetframework="4.5.1" /> i have tried creating sample mvc app on computer , moving over. worked fine on other computer, giving same error once opened on main computer. any ideas causing issue , how resolve it? sorry writing here don't have enough rep

sql - How can i convert numeric value to datetime? -

i have sql database table name : tb_event_log columns name : ndatetime,nuserid column ndatetime has anumeric values 1433923965,1433865660,1433841912,.... i want convert values in ndatetime column date , time values and preview in datagridview the example values provided can interpreted seconds since 1970-01-01 00:00:00 utc (the unix epoch). depends on programming environment how convert these values presentable formats. involves creation of date(/time) objects right constructor, or formatting right format string.

View the pdf file & verify contents(text) In Protractor Javascript (IE & chrome) -

is there way retrieve stream(text) url ' http://www.princexml.com/samples/flyer/flyer.pdf ' using javascript(in protractor), process & contents of either variable or text file out downloading it currently i'm able achieve using http.request() specified in ' http://www.hacksparrow.com/using-node-js-to-download-files.html ' & saving new pdf file, parsing new file using pdfreader.js , getting contents. want process buffer http.request() & return contents directly without saving/downloading , processing contents.

xml - Select a node that has a specific attribute value in javascript -

in xml : <elements> <product id="1"> <brand>xxxxxxx</brand> <dci>xxxxx</dci> <therapeutic_area>xxxxxx</therapeutic_area> </product> <product id="2"> <brand>xxxxxx</brand> <dci>xxxx</dci> <therapeutic_area>xxxx</therapeutic_area> </product> <product id="3"> <brand>xxx</brand> <dci>xxxx</dci> <therapeutic_area>xxxxx</therapeutic_area> </product> i need select node has specific attribute value. instance 2 i tried not work: alert(xmldoc.getelementsbytagname("product")[0].getattributenode("2")); thanks in advance help try var list=xmldoc.getelementsbytagname("product"); (

java - Javax JCR Node getProperties and Titles -

i given node , request form node. node nn = node.getnode("jcr:content"); from here can following value of nn.getproperty("cq:lastmodified") what trying properties without asking each 1 name. node nn = node.getnode("jcr:content"); propertyiterator pi = nn.getproperties(); now can iterate on properties , print values so: while(pi.hasnext()) { property p = pi.nextproperty(); string val = p.getstring(); } but how can find title of property? i not sure can try getname() method because property interface subinterface of item interface. can try below : while(pi.hasnext()) { property p = pi.nextproperty(); string name = p.getname(); string val = p.getstring(); }

Modify variables inside a function with javascript -

i'd know if posible, having 1 or more variables pass them function , variables modified. think posible objects, behave references, don't know. with 1 var do: var = increase(something); but if have, example, 2 variables recipies, , exchange them? exchange_recipies(book1, book2); you variables parameters inside function... there way i'm missing? edit: know can done in many ways i'll state here don't due obvious limitations: -use global variables. -use objects -return array , reasign. edit2: is possible change value of function parameter? helped me, think answer uncomplet , there ways of doing this. if variables declared globally wouldn't need pass them function since can addressed inside function. var = 1 function bar(){ = increase(something); } for example. this means avoid changing variables parameters , can address them function (dependant on nesting, ergo, if variable declared inside function can't addressed outs

python - How to add any new library like spark-csv in Apache Spark prebuilt version -

i have build spark-csv , able use same pyspark shell using following command bin/spark-shell --packages com.databricks:spark-csv_2.10:1.0.3 error getting >>> df_cat.save("k.csv","com.databricks.spark.csv") traceback (most recent call last): file "<stdin>", line 1, in <module> file "/users/abhishekchoudhary/bigdata/cdh5.2.0/spark-1.3.1/python/pyspark/sql/dataframe.py", line 209, in save self._jdf.save(source, jmode, joptions) file "/users/abhishekchoudhary/bigdata/cdh5.2.0/spark-1.3.1/python/lib/py4j-0.8.2.1-src.zip/py4j/java_gateway.py", line 538, in __call__ file "/users/abhishekchoudhary/bigdata/cdh5.2.0/spark-1.3.1/python/lib/py4j-0.8.2.1-src.zip/py4j/protocol.py", line 300, in get_return_value py4j.protocol.py4jjavaerror where should place jar file in spark pre-built setup able access spark-csv python editor directly well. at time used spark-csv, had download commons-

java - In maven project how i can specify a relative path to file -

in javafx project create without maven specify relative path .css file main.class.getresource("login.css").toexternalform() and it's work.but when create maven project , use path got runtime exception, if use path ./main/java/com/sowl/addstudent.css or other have exception resource not found. , tried path use thred thread.currentthread().getcontextclassloader().getresource("addstudent.css").toexternalform() and again have runtime exception.how can specify path javafx.css.stylemanager. in advance,thx in maven projects, resources go src/main/resources , not src/main/java default. so if want call main.class.getresource("login.css") (relative path), login.css has in same package main, in resources directory. if call someclassloader.getresource("addstudent.css") or someclass.getresource("/addstudent.css") (absolute path), addstudent.css has directly in src/main/resources .

c# - How to add an session value to a custom webforms for markters save action? -

i'm using sitecore webforms marketers (wffm). between content delivery server (cds) , content management server (cms) web service. have written custom save action. i'm looking manner send session value cds cms server without custom hidden field. must friendly content editor. have solution? thanks lot. jordy i looked , way working hidden field. if put field type of hidden field on form, in save action can set hidden fields value value session , save database action pass on data web service. i tried looking @ adding fields collection of fields goes database classes needed protected. would hear if else has nifty way of getting round issue though.

c# - Create Thumbnail of HtmlImage -

i trying create thumbnail of htmlimage. i trying use getthumbnailimage system states htmlimage not contain definition getthumbnailimage. i trying this: system.drawing.image im = (system.drawing.image)i.getthumbnailimage(100, 100, null, new system.intptr()); where htmlimage. tried casting ( (system.drawing.image) ). point me in right direction or provide idea on how solve it? thank you.

javascript - jQuery File Upload in AngularJS -

i'm trying upload file jquery file upload in combination angularjs. i have multistep form, 2 steps of multistep form: <div ng-switch="step"> <div ng-switch-when="1"> <h1>identity</h1> <form name="steponeform" data-file-upload="options" enctype="multipart/form-data" novalidate autocomplete="off"> <input type="submit" ng-click="next(steponeform.$valid)" value="next" /><br> <span class="button fileinput-button" ng-class="{disabled: disabled}"> <input type="file" id="fileupload" name="files[]" multiple="" > </span> <button type="button" class="btn btn-primary start" data-ng-click="submit()"> <span>start upload</span>

arrays - For loop in an $firebaseArray -

i found similar topics, of them outdated because i'm using angularfire 1.1.1. i had angularjs app creating markers on google map. data stored in external json files , worked fine when turned arrays. when put data firebase database stopped working. ng directives data works fine, when accessing array data data in js code not work. app.controller('mapctrl', ['$scope', '$firebasearray', function($scope, $firebasearray){ var ref = new firebase("https://radiant-inferno-6439.firebaseio.com/tracks"); var syncobject = $firebasearray(ref); ... with old offline json version logging syncobject looked this: [object, object, object] 0: object 1: object 2: object length: 3 __proto__: array[0] but looks this: [] 0: object 1: object 2: object $$added: () { [native code] } $$error: () { [native code] } $$getkey: () { [native code] } $$moved: () { [native code] } $$notify: () { [nati

javascript - wrong ajax response on nodejs -

i playing ajax on nodejs, can better understand node. the form (client-side) <form id="fruitform" method="post" action="/"> <div class="table"> <div class="row"> <div class="cell label">bananas:</div> <div class="cell"><input name="bananas" value="2"/></div> </div> <div class="row"> <div class="cell label">apples:</div> <div class="cell"><input name="apples" value="5"/></div> </div> <div class="row"> <div class="cell label">cherries:</div> <div class="cell"><input name="cherries" value="20"/></div> </div> <div class="row"> <div class="cell label">total:</div> <div id="results" class="cell">0 i

Django-Haystack autoquery gives strange results with solr backend -

i using django 1.5 along haystack 2.1.0. while using auto-query on 1 of models found following behavior. test_search = "charles ken" searchqueryset().models(foo, foosome, foogone).auto_query(test_search) the above query gives multiple results. test_search = "charles k" searchqueryset().models(foo, foosome, foogone).auto_query(test_search) the above query gives no results. doing wrong ? edit : the field in concern edge_ngram <fieldtype name="edge_ngram" class="solr.textfield" positionincrementgap="1"> <analyzer type="index"> <tokenizer class="solr.whitespacetokenizerfactory" /> <filter class="solr.lowercasefilterfactory" /> <filter class="solr.worddelimiterfilterfactory" generatewordparts="1" generatenumberparts="1" catenatewords="0" catenatenumbers="0" catenateall="0" s

tree - Use significant attributes only, or use full set of attributes to build J48 model after checking information gain? -

weka's j48 allows 1 check information gain on full set of attributes, should use significant attributes build model? or should use full set of attributes? in data mining, there multi-way trade-off between number of features use, accuracy, , time takes generate model. in theory, you'd want include every possible feature boost accuracy; however, going data mining in way guarantees lengthy model generation times. further, models produce textual decision trees j48 aren't useful when tree has thousands of nodes. depending on how many features start out with, may want remove features don't provide large enough information gain. if have small number of features begin (e.g. fewer 20), might make sense keep of them. if wish limit number of features use, best choose highest information gain. worthwhile things principal component reduction (which can done through weka) select best features.

dse cassandra solr doesnt return _uniqueKey in response -

im using datastax 4.6. solr client queries data using _uniquekey. version 4.6 limitation using simple primary key removed. how can configure solr or create table in cassandra, receive in solr response information synthetic key _uniquekey. there no problem when use compound keys, simple. drop table if exists unitable; create table if not exists unitable ( "depid" int primary key, "parentid" int, "name" text ); insert unitable ( "depid", "parentid", "name" ) values ( 689, 2, 'test' ); <?xml version="1.0" encoding="utf-8" standalone="no"?> <schema name="autosolrschema" version="1.5"> <types> <fieldtype class="org.apache.solr.schema.trieintfield" name="trieintfield"/> <fieldtype class="org.apache.solr.schema.textfield" name="textfield"> <analyzer> <tokenizer class="so

Facebook SDK 3.0 Logout Not Working in android Application from any other Intent -

i using facebook login in android app,its login . after successful login intent goes next page. from second page trying logout facebook ,its not working help me resolve it. else suggest me working example facebook login,logout,getting profile information latest sdk4.2. link have used my logout method public void logoutfromfacebook() { masyncrunner.logout(this, new requestlistener() { @override public void oncomplete(string response, object state) { log.d("logout facebook", response); if (boolean.parseboolean(response) == true) { //logout successss } } }); } this facebook login code androidfacebookconnectactivity.java public class androidfacebookconnectactivity extends activity { // facebook app id private static string app_id = "*************" ; // replace app id // instance

exception - android unable to resume activity on result using camera -

i have problem using camera. take photo , save on file. on result camera save photo on gallery , inside internal folder. i've got unable resume activity nullpointer exception. with code open camera: private void photobuttonclicked() { if (!runscreen.isadded()) { return; } intent takepictureintent = new intent(mediastore.action_image_capture); if (takepictureintent.resolveactivity(getpackagemanager()) != null) { // create file photo should go file photofile = null; try { photofile = createimagefile(); } catch (ioexception ex) { } if (photofile != null) { takepictureintent.putextra(mediastore.extra_output, uri.fromfile(photofile)); startactivityforresult(takepictureintent, 2); } } } private file createimagefile() throws ioexception { // create image file name string timestamp = new simpledateformat("yyyymmdd_hhmmss"

sql - ORDER BY depending on parameter results in error -

i have stored procedure initiates order depending on parameter: drop procedure [dbo].[getusersbyclusterandusername] go create procedure [dbo].[getusersbyclusterandusername] @sortfield [nvarchar] (256) = 'username', @sortorder [int] = 0 select * [user] order case when @sortorder = 0 case when @sortfield = 'username' user_username when @sortfield = 'lastlogindate' user_lastlogindate when @sortfield = 'creationdate' user_creationdate end end asc, case when @sortorder = 1 case when @sortfield = 'username' user_username when @sortfield = 'lastlogindate' user_lastlogindate when @sortfield = 'creationdate' [user_creationdate] end end desc return 0 go however... if call procedure this: exec dbo.getusersbyclusterandusername @sortorder=1, @sortfield='username' i following error: msg 241, le

Positioning tooltip in the kendo chart -

is there way position tooltip in kendo chart apart modifying css class k-chart-tooltip ? i want tooltip positioned @ top using kendo chart attributes. here image on how should look: image if change .k-chart-tooltip style, applied tooltips used in application. applying tooltip style on chart control possible, if can bring kendo chart tooltip inside chart control instead of tag (latest kendo version feature). then can apply tooltip css style on kendochart. i not have idea how bring kendo tooltip inside chart control.

excel - VBA Match Function "Method 'Match' of Object 'WorksheetFunction' Failed" -

i'm trying use match vba function in programming project in excel first row number "1" in it. code i'm using is: dim borradorvar integer borradorvar = worksheetfunction.match(1, sheets("usuarios").range("a1,a100"), 0) can explain i'm doing wrong? thanks! you should refer range as range("a1:a100") instead of range("a1,a100") using comma refer a1 , a100 only. also, if not sure if there match or not, can use application.match , store result in variant variable instead. difference application.match returns error when fails, , can check if has failed or not. example (check msdn full code): dim var variant var = application.match(cells(irow, 1).value, worksheets(isheet).columns(1), 0) if not iserror(var) debug.print "there match" else debug.print "no match found" end if a word of warning: if match after row 32,767 your code not run , because exceeds range of in

Java Castor Unmarshal byte array -

good day community, i have question regarding castor unmarshaling in java. mentioned using castor unmarshal webservice response contains byte array (byte[]) .. please refer below: public class viewreportresponse { private string reportid; private byte[] report; //getters , setters here ... i have used castor before unmarhsal webservice responses, admittedly, responses strings. problem lyes byte array returned believe castor chokes on unmarshaling it. my castor-mapping file provided below: <class name="com.domain.reporting.client.service.viewreportresponse"> <map-to xml="viewreportresponse" xsi:schemalocation="http://domain.com/schemas/reportingservice/generatereport" ns-uri="http://domain.com/schemas/reportingservice/generatereport" ns-prefix="ns2" /> <field name="reportid"> <bind-xml name="reportid" node=&

apache camel 2.9.1 works with spring 3.1.x and Spring 4.x -

hi using camel-2.9.1 default underlying dependency spring 3.0.5. working fine in production. have use feature of spring 3.1.x or spring 4.x. camel-2.9.1 works if replace underlying spring jars 3.1.x or spring 4.x. since in production don't want upgrade camel jars. same camel-jars of 2.9.1 works spring 3.1.x or spring 4.x

objective c - ios webview loadHTML string with link css -

i load html string in link local css file lies in docment folder, ...<head><link href="a.css">...</head>... then call webview.loadhtml:htmlstring baseurl:docurl; css loaded ok. change a.css 's body {background:url(b.gif);} //previous a.gif , pop webview's view controller, , re-push new 1 in webview load same html string link same css body's background image has been changed. comes problem: times webview load changed background, while times load old image though css changed! , maybe realloc view controller times, maybe load right one! can teach me how fix it? lot!

reverse engineering - Alloy traces and projection issues -

i find difficult understand way traces , projections work in alloy . cannot desirable results. in following example try project on course , see how students enrolling, seems never have relation. when use normal view (without projection) multiple solutions fine.. want know way (step-by-step) of how created using traces (trace back). open util/ordering[course] sig student {} sig course { roster : set student } pred enroll (c, c' : course, snew : student) { c'.roster = c.roster + snew } pred init(c: course) { no c.roster } fact traces { init[first] c: course - last | let c' = next[c] | s: student | enroll[c, c', s] } pred show {} run show 5 i'm not sure of try accomplish. think notion of time missing in model. have roster given course changing on time concept. it seems bypassed "good practice" directly ordering course concept, guess want first course have no student, second course have new 1 etc .... (which

java - wait the end of the execution of a process -

in code i'm trying convert file mdl file xml using simex tool. use xml file analysis. when convert file manually or if treat small model (via process....) ,no error has been occured. the problem when try convert big model via process using code : if(!(xmlfile.exists())) {process child; child = runtime.getruntime().exec("cmd.exe /c start /min "+system.getproperty("user.dir")+"\\simex\\mdltoxml.bat "+path+" "+xmlpath+" " +system.getproperty("user.dir")+"\\simex\\",null,null); try { child.waitfor(); } catch (interruptedexception e) { e.printstacktrace(); } this code work small model ,so think problem that's project analyse xml file before end of transformation because error : exception in thread "main" org.jdom2.input.jdomparseexeception:error on line of document file (......xml):fin prématurée du fichier............ so want know how can wait end of transf

c - Detecting unresolved symbols in an ELF executable -

let's have 2 files: // shared.c (will compiled 'shared.so') #include <stdio.h> int f() { printf("hello\n"); } and // exe.c (will compiled 'exe') #include <stdio.h> int f(); int main() { int i; scanf("%d", &i); if (i == 5) f(); } i compile both files following: gcc -shared shared.c -o libshared.so gcc exe.c -o exe -lshared -l. when run exe , type 5, call f , exit. however, if delete f shared.c , recompile runtime symbol lookup error if type 5. there way can check exe has symbols work independent of user input in case? preferrably without running it. you can use ldd -r exe command list shared library dependencies. here output example without f function: $ ld_library_path=. ldd -r ./exe linux-vdso.so.1 (0x00007ffcfa7c3000) libshared.so => ./libshared.so (0x00007f303a02e000) libc.so.6 => /lib64/libc.so.6 (0x0000003e26c00000) /lib64/ld-linux-x86-64.so.

vba - How to change and synchronize a dependent table field across MS Access -

it seems ms access has ability synchronize change in table name across dependencies. e.g. naming table global tblglobal show new changes in tables , forms. however, there doesn't seem way fields within table. there tools or methods this? edit: mistake< meant query other queries depend on instead of table other queries depend on.

java - run.bat command line JVM argument not passed as expected -

i'm trying pass run.bat -djava.messaging.serverpeerid=1 , args '=' been replaced space. arguments passed main.java gets set true java.messaging.serverpeerid.... shouldn't . main should have got arg appropriately..... sample piece of code set args = :loop1 if %1= "" goto contiarg else ( # echo here : echo " args ... %1" set args = %args% %1 shift ) goto loop1 line echo line throwing errorven used double quotes u mentioned..... = standard delimiter in batch/cmd.exe way pass argument enclose in double quotes (use run.bat "-djava.messaging.serverpeerid=1" ). java should able handle quotes if wish can dequote argument using %~1 when passed java.

jquery - Select 'i' element inside child span -

i have html structure: <div id="grouplist"> <div class="element"> <span class="label label-default" data-index="0"> big big big big big big big name!.txt <i class="fa fa-times"></i> </span> </div> </div> the <i> icon of font-awesome remove .element . if select in jquery: $(document).off('click').on('click', '#grouplist .element > span', function() it works. want execute function when user press icon inside i. like: $(document).off('click').on('click', '#grouplist .element > span > i', function() but doesn't work. missing here? i'd suggest, given html: // select <i> element 'fa' , 'fa-times' class-name, // exists within element matching '.element' selector'; // when <i> element clicked: $('.element i.fa.fa-times').on(

ibm mobilefirst - Worklight Server/DB down, Hybrid app shows a dialog with "Server is temporarily unavailable". No error callback? -

Image
we have case worklight server's (v6.1.0.02-20150509) database down, , server not connect , hybrid app presented below dialog. we did not provide dialog , content in app, must come worklight client framework. since phone set french, see there english/french mix in text. what wondering whether there way catch this? there seems no callback , seems adapter call did not timeout , did not return error our code. also, why worklight framework showing visual error dialog? framework should provide callbacks , hooks, , not visual ui app developers did not create. christian, using ibm worklight studio 6.1.0.02-20150608-1406 followed these 2 scenarios: use wl.client.connect wlcommoninit() while server running mysql database of server (wrklght) shut down in scenario connect failed , reached onfailure callback. use wl.client.invokeprocedure wlcommoninit() (instead of connect ) while server running mysql database server of server (wrklght) shut down. procedur

how to parse a time in Ruby which takes a string in HH:MM and calculate seconds into the day -

this question has answer here: ruby: convert time seconds? 6 answers i have method takes string in hh:mm format , should calculate how many seconds day is time.strptime(mystring, "%h:%m") - time.now.beginning_of_day

r - Prompt user without waiting -

i have long running process, coded in "r". continue running in rstudio, don't want use batch mode. i allow user gracefully terminate long running process, example pressing escape key. if user doesn't press anything, process continues, without waiting. i have read other stackoverflow posts, perhaps need prompt user using scan/readline on different thread. way, main execution thread isn't blocked. isn't there simpler way? thank pointers/suggestions. richard rogers further comments: i've made few mistakes: i didn't realize pressing escape in rstudio while code running halts execution. i can't seem determine execution ends when press escape. maybe can use simpler question. here simple function: processdata <- function() { continue <- true iteration <- 1 testdata <- vector(mode = "integer", length = 100000) while (continue) { writelines(sprintf("processing iterati

Syncing Podio and Dropbox -

is possible sync podio , dropbox when add data podio app instantaneously updates dropbox. know possible add files dropbox podio looking way add podio files dropbox. you can zapier allow have 5 zaps free free version pull changes every 15 minutes

JointJS and Extending Devs -

i'm trying extend joint.shapes.devs.atomic model "maximum call stack size exceeded" error. this apparently normal behavior devs module. ( see following link: https://groups.google.com/forum/#!topic/jointjs/md5s_fkpl_m ). i wondering if there way work around this? better edit devs module directly? solution in above link won't work me, since i'll need able convert data json. edit i've made own object based on devs model. can extend model need to, still don't solution. don't think offers same kind of flexibility extending looking for. if has better option please let me know.

How can I query Perforce for a list of users who have workspaces that reference a particular file in the depot? -

i query perforce server list of users have active workspace view specification references given file in depot. for example, given file //root/folder/file.txt command should return list of users have active workspace view specification references //root/folder/file.txt alternatively command return workspaces reference file, , should straight forward list of owners of workspaces. first you'll workspaces, , can run through list of workspaces owner. to workspaces need loop on every workspace in server , run(assuming filename question): p4 files //root/folder/file.txt@<workspace name> if 'no such files' error, workspace doesn't have version of file synced. of workspaces have file, can owner in spec. note query checking see if workspace has file synced, not mapped. general assumption if map , don't sync it, file unmapped.

using grep with multiple entries in r to find mathcing strings -

i have searched question online seem find every answer one. if have vector of strings: dd <- c("sflxgrbfg_sprd_2011","sflxgrbfg_sprd2_2011","sflxgrbfg_sprd_2012") and want find entires '2011' in string can use ifiles <- dd[grep("2011",dd)] how search entries combination of strings included, without using loop? for example, find entries both '2011' , 'sprd' in string, in case return sflxgrbfg_sprd_2011 how can done? define variable tomatch <- c('2011','sprd) and loop through entries hoping there better solution? note: make useful different strings. possible to determine entries have these strings without them being in order shown. example, 'sflxlgrbfg_2011_sprd' if want find more 1 pattern, try indexing logical value rather number. way can create "and" condition, string both patterns extracted. ifiles <- dd[grepl("2011",dd) & grepl