Posts

Showing posts from August, 2015

sql - Does "Join" order will lead to different query performance -

this question has answer here: does sql join order affect performance? 6 answers i have 2 tables (table1 table2), table2 larger table1. script 1: select t1.a, t2.b table1 t1 join table2 t2 on t1.pk = t2.fk script 2: select t1.a, t2.b table2 t2 join table1 t1 on t1.pk = t2.fk does performance script #1 better script #2? you using inner join answer no . this produce same amount of data due join type, , joining same relations in both queries, identical. it have been different if had used left join , because in left join, data master(left) table kept, , matching data details table(right) . so if had used left join, , placed larger table on left side, query have produced more data , slower put larger table in right side.

How can generalized RDF triples easier show "the completeness of the RDFS entailment rules", and what does that even mean? -

the w3c recommendation rdf 1.1 concepts , abstract syntax defines generalized rdf triple (i.e., non-standard triple each of subject/predicate/object can iri/bnode/literal). about possible use, gives example: it convenient loosen requirements on rdf triples. example, completeness of rdfs entailment rules easier show generalization of rdf triples. what "completeness of rdfs entailment rules" mean? (searching "complete" or "entail" in w3c recommendation rdf schema 1.1 doesn’t give results.) and in way easier show generalized rdf triples normative rdf triples? these notions explained , defined in detail in rdf semantics , in appendix entailment rules . completeness , in context, refers completeness of doing entailment checking computation of deductive closure via entailment rules. suppose have 2 rdf graphs (s , e), , s logically entails e, closure complete if can derive e s. in appendix mentioned above, shown not case rdf-entai...

java - How to create custom component model for MapStruct? -

mapstruct provides component models creating converters. but, these converters generated independent spring components. there way "put" them conversionservice ? here example of adding spring converters conversion service. there way of creating custom component model uses coversionserviceawareconverter super class? we haven't looked spring's conversion service yet, there no support provided out of box. you cannot create custom component models atm., couldn't register generated mappers manually conversion service?

javascript - jquery keyup dynamically generated div -

this question has answer here: event binding on dynamically created elements? 19 answers this java file generates div & text box dynamically. js file var count = 6; $(document).ready(function(){ $("#addmoreparam").click(function(){ $("#showparam tr:last").before("<tr><td><div style=\"width:150px;background-color:#fff; height:20px;\" contenteditable=\"true\" class=\"paramdiv\" id="+count+"></div></td><td><input type=text name=\"paramvalue" + count +"\" class=paramvalue /></td></tr>"); count++; }); }); below code produces alert when writing div. tried hard bu not giving alert box. $(function(){ $(".paramdiv").on('keyup', '.paramdiv', function(){ alert(...

ios - How I keep iPhone continuous vibrating when receives remote notification? -

i want keep iphone app vibrating when receives remote notification app closed or iphone closed. i can play special sound when receives remote notification, said vibrate sound, use "ksystemsoundid_vibrate" , still don't know how use it. the server can post apns this: {"aps":{ "alert":"receive jane's call", "badge":1, "sound":"opening.m4r"} } but want know how add constant 'ksystemsoundid_vibrate' apns, iphone can play sound , vibrate continuously.

directory - Why can't I import folium python package? -

i've pip installed folium , error when try import in when im working in home directory: --------------------------------------------------------------------------- importerror traceback (most recent call last) <ipython-input-1-af6e4f19ef00> in <module>() ----> 1 import folium //anaconda/lib/python2.7/site-packages/folium-0.3.0.dev0- py2.7.egg/folium/__init__.py in <module>() 3 __future__ import absolute_import 4 ----> 5 folium.folium import map, initialize_notebook, circlemarker 6 7 folium.map import (featuregroup, fitbounds, icon, layercontrol, marker, //anaconda/lib/python2.7/site-packages/folium-0.3.0.dev0- py2.7.egg/folium/folium.py in <module>() 13 import json 14 ---> 15 branca.colormap import stepcolormap 16 branca.utilities import color_brewer 17 branca.six import text_type, binary_type importerror: no module named branca.colormap ho...

XCode don't want to run App on Device -

Image
i click button run , xcode refuse run. my question is: how fix? happens lot of times. way solve me restart xcode. after while, happens again. , again. , again. please how fix. you have solve using manage schemes dialog. follow below path... go to:choose product > scheme > manage schemes. choose manage schemes scheme toolbar menu. click manage schemes @ bottom of scheme editing sheet. if there no scheme available click autocreate scheme either schemes available remove , autocreate scheme now

java - JIT compiler - compiler choosing options -

on 64 bit linux, java8, when running java command, seems 3 options -client / -server / -d64 using 64-bit server compiler. the questions are: ( for 64bit linux java8 ) since -client , -server use same compiler, makes difference specify 1 of 2 options? for long running java daemon program, preferred use -server -xx:+tieredcompilation or without it, when during startup time it's ok little slow. look @ file jre/lib/amd64/jvm.cfg . you'll see lines -server known -client ignore this means -client option ignored. -server nothing, since jdk 8 x64 has 1 jvm includes both c1 , c2 compilers, , tiered compilation on default. with -xx:+tieredcompilation or without it does not matter, because option on default. advanced compilation policy works fine both client-grade , server-grade applications. there no need turn off manually.

In R, use a function apply() inside of lapply that is working over a list of data frames -

i using function from thread , want run on every data.frame in list . can't seem set indexing correctly, , after reading this thought maybe needed leave function outside of original lapply , didn't improve anything. my 2 data frames nas turned list: df1 <- data.frame( = c(1, 2, 3, na), b = c(1, 2, na, na), c = c(1, na, na, na), e = c(5, 6, 7, 8) ) df2 <- data.frame( = c(1, 2, 3, na), b = c(1, 2, na, na), c = c(1, na, na, na), e = c(5, 6, 7, 8) ) mylist <- list(df1, df2) my function inside of lapply: dd <- lapply(seq_along(mylist), function(i){ countna <- function(mylist[[i]]) apply(mylist[[i]], margin = 1, fun = function(x) length(x[is.na(x)])) df_mos <- subset(mylist[[i]], select = c("a", "b", "c")) na_count <- countna(df_mos) x = mylist[[i]][na_count < 2,] x = x[, c("e")] # give me value of e x # return x }) for ...

java - Expression expected after this token -

why popping up? syntax error on token "+", expression expected after token for (int row = 0; row < data.length; row++) { (int col = 7;;) { data[row][col] = [row][1] + [row][2] + [row][3] + [row][4] + [row][5] + [row][6]; }for (int col = 8;;) { data[row][col] = formatter.format(([row][7] / 2650) * 100); } } it appears on every plus sign , equals after data[row][col] = . the [row][col] access expression array, need specify array want access on these indices. therefore every of statements indices should start data for (int row = 0; row < data.length; row++) { (int col = 7;;) { data[row][col] = data[row][7] + data[row][2] + data[row][3] + data[row][4] + data[row][5] + data[row][6]; } (int col = 8;;) { data[row][col] = formatter.format((data[row][7] / 2650) * 100); } } for more information , examples see java tutorial on arrays . also notice have 2 infinite loops, guess code...

java - System out println -

Image
i'm printing 2 lines console. both print, when second 1 has printed, first 1 changes second one, 2 lines identical. i've never encountered before. why second print overwrite first one, , how fix it? public static void main(string args[]){ new mergesort(90000); system.out.println("array mergesorted: " +arrays.tostring(array)); long start = system.currenttimemillis(); mergesort(array, 1, array.length); long end = system.currenttimemillis(); system.out.println("result: " + arrays.tostring(array) ); } the constructor: public mergesort(int n){ random rand = new random(); array = new int[n]; for(int = 0; <array.length; i++){ array[i] = rand.nextint(101); } } rest of code: public static void merge(int[] a, int p, int q, int r){ // //length of subarray 1 int n1 = q-p+1; //length of subarray 2 int n2 = r-q; int[] l = new int[n1+1]; int[] r = new int[n2+1]; for(...

post - send file on cloudprint -

wrote request: content-type: application/x-www-form-urlencoded content-length: sizestring authorization: "bearer " + access_token &printerid=2deb8a6d-86d7-4345-f3ad-ad7e0f7d2591&title=testname&ticket=testticket&content=base64string&contenttransferencoding=base64 and connection www.google.com/cloudprint/submit but no response server (timeout error). doing wrong? example, no problem connection www.google.com/cloudprint/list: content-type: application/x-www-form-urlencoded content-length: sizestring authorization: "bearer " + access_token &proxy=3d9b828e-f8fd-4f83-a32f-96f1f0b35c6b

grails template Method code is too large error? -

if grails template size big , using more g:tags fails compile template engine raise error method code large ? this known issue code blocks within gsps. seem recall maximum size 65,432 lines of code per block. easy way around use comment within gsp. creates new code block , segments gsp code blocks. example: <% // example comment %>

python - Server side filtering of spark-cassandra on PySpark -

i new spark , want know more operation when cooperating cassandra. i have been reminded server side filtering in of tutorials , totally understand importance of doing so. yet tutorials either based on scala or pyspark_cassandra , , none of them using pyspark. just curious if following scriptlet doing server side filtering or not. given sparkconf object conf : sc = pyspark.sparkcontext(conf=conf) sqlcontext = sqlcontext(sc) df = (sqlcontext.read.format("org.apache.spark.sql.cassandra") .options(keyspace="ks", table="tbl").load()) df.filter("id = 1234").show() in addition, did load entire table spark cluster filtering in case? cassandra connector supports predicate pushdown on spark dataframes long pushdown enabled can safely assume basic filters executed on cassandra side. may not complex predicates. if you're in doubt best check basiccassandrapredicatepushdown docstrings . you can check execution plan ( expl...

java - Trouble passing an ArrayList of objects from one class to another -

i'm trying display 2 arraylists on jtextarea having troubles passing arraylist of objects 1 class another. the part of code i'm having problems trying display info following code private void jbuttondisplayactionperformed(java.awt.event.actionevent evt) { for(int i=0; i<bars.size(); i++) { jtextareadisplay.append(jtextareadisplay.gettext() + bars.get(i).tostring() + bars.get(i).getliquor.tostring() + "\n\n"); } } it says can't find symbol: variable getliquor bar class. bar class code i'm trying pass it: arraylist<liquor> liquors; private liquor liquor = new liquor(liquors); public liquor getliquor() { return liquor; } from other class liquor: arraylist<liquor> liquors = new arraylist<>(); public liquor(arraylist<l...

javascript - delete function not working in codeigniter -

my delete function not working. after clicking confirm message it's not deleting. my view looks this: <div id="selected-color" > <?php if ($this->session->userdata('edit_colors')) { foreach ($this->session->userdata('edit_colors') $color) { ?> <div class="col-md-2 selected-color"> <div class="color-box" style="background-color:<?php echo $color; ?>"></div> <div class="selected-color-btn" color='<?php echo $color; ?>' data-toggle="modal" > <input type="hidden" name="color_id" value="<?php echo $color; ?>"> <a class="fa fa-close" data-toggle="modal" onclick='return deleteitem()' name="delete" id="title" img="img1446224811.jpg" bi...

sql - How does GROUP BY work on Ambiguous columns? -

while practicing sql, noticed strange group bys. working on practice problem need obtain users friends in social network. straightforward. we have nested sub-query computes number of friends each user. (this done group by). match our original users table. following query that. select name, grade (select id1 id, count(*) c friend group id1) join highschooler using (id) order c desc limit 10; what don't understand is: why following query return same thing? select highschooler.name, count(*) friendcount friend join highschooler on (friend.id1 = highschooler.id) group highschooler.id order friendcount desc limit 10; there multiple values of highschooler.name, sql pick 1 group? secondly, of above 2 queries preferred? both queries return same results in first query grouping first , joining on id. in second 1 joining first , grouping. make no difference. however, sub-queries logically correct way solve problems of form, "get facts a, conditional...

Using Excel VB to change imported data from Access colour coded accordingly -

Image
what i'm trying change specific range cells specific colours. works when there increase , when more -2.00% should red. however, when decreasing previous time should green, , once below -2.00% should go black again. so cell data in starts @ c2 , ends @ h54. works in row format c2 main d2 continue data, etc. c3 new main data , d3 continue of data, etc. my code have been testing not getting right follows: range("c2").select if range("c2").value >= "-2.00%" selection.font .color = -16776961 .tintandshade = 0 end elseif range("c2").value < "-2.00%" selection.font .themecolor = xlthemecolorlight1 .tintandshade = 0 end end if range("d2").select if range("d2").value <= "-2.00%" & range("c2").value selection.font .color = -11489280 .tintandshade = 0 end elseif range("d2").value > "-2.00%" & range("c2").value selection.font .color = -16776961 ...

heroku - Ruby on Rails: undefined method 'role' for Class -

i'm haing problem in ruby on rails application. have entity called 'hairdresser', properties: irb(main):003:0> hairdresser => hairdresser(id: integer, name: string, surname: string, email: string, auth_token: string, password_digest: string, created_at: datetime, updated_at: datetime, facebook_id: string, first_login: boolean, role: string) i created scaffold in order create new hairdresser entities, when click on "new hairdresser" following error: 2016-03-17t09:14:43.063793+00:00 app[web.1]: actionview::template::error (undefined method `role' #<hairdresser:0x007f9e20f2bc30>): 2016-03-17t09:14:43.063794+00:00 app[web.1]: 25: </div> 2016-03-17t09:14:43.063794+00:00 app[web.1]: 26: <div class="field"> 2016-03-17t09:14:43.063795+00:00 app[web.1]: 27: <%= f.label :role %><br> 2016-03-17t09:14:43.063795+00:00 app[web.1]: 28: <%= f.text_field :role %> 2016-03-17t09:14:43.06379...

postgresql - Where are loopback users stored? -

i using loopback. default, has users api. using postgres via loopback-connector-postgresql . following first 2 pieces of code on this guide , able create users can't figure out how view users. firstly, when try users under /explorer route. receiving 401 authorization required . can't find user data in postgres db either. checked databases , tables , found nothing referring user . users being persisted to? i modified model-config.json user see if can access: "user": { "datasource": "mydb", "public": true } ... but no luck. based on loopback docs can specify memory data must stored in server/datasources.json this: "db": { "name": "db", "connector": "memory", "file": "mydata.json" } for more information can read : https://docs.strongloop.com/display/public/lb/memory+connector notic: the memory connector designed dev...

Can this be done in sharepoint? -

we looking @ using sharepoint architect projects. right have create list of directories (11 exact , sub directories),for each project or building build. setup sharepoint have sort of template or automation build , name these directories? ask users able access when created? i understand question may answered (somewhere out there) may not using correct search terms. ive used terms "sharepoint auto build directories", "sharepoint library template" , related terms that. any appreciated. , examples of how can done better. i creates new site , made file directories needed. assigned permissions , made template. have create new site , apply template , need started right there.

javascript - Clear fields on browser's back button -

i have disabled browser's button using following javascript code. works want code clear fields on form or atleast reload page on browser's button click. using c#. any appreciated. thank you. function disablebackbutton() { window.history.forward() } disablebackbutton(); window.onload = disablebackbutton; window.onpageshow = function (evt) { if (evt.persisted) disablebackbutton() } window.onunload = function () { void (0) } i have tried doing this. doesn't work protected void page_load(object sender, eventargs e) { tbps.text = " "; tbname.text = " "; tbemail.text = " "; tbcontact.text = " "; tbsug.text = " "; rbtheme3.checked = true; rbfoodvar3.checked = true; rbtransport3.checked = true; rbloc3.checked = true; rbtime3.checked = true; } do in jav...

php - how can select timestamp column -

hy have uisng laravel 4 have data this: 2016-02-12 18:32:19 have query this echo $result = sourcemanagement::get(array('id', 'created_at', db::raw("date_format(from_unixtime(created_at), '%y') created_at"))); // print_r($result); why output : [ { "id":1, "created_at":null }, { "id":3, "created_at":null }, { "id":4, "created_at":null }, { "id":7, "created_at":null }, { "id":8, "created_at":null }, { "id":9, "created_at":null }, { "id":10, "created_at":null }, { "id":11, "created_at":null }, { "id":12, "created_at":null }, { "id":13, "created_at"...

types - Increment behavior on strings - PHP easter egg? -

$var = 'test_1'; var_dump(++$var); // string(6) "test_2" $var2 = '1_test'; var_dump(++$var2); // string(6) "1_tesu" $var3 = 'test_z'; var_dump(++$var3); // string(6) "test_a" $var4 = 'test_'; var_dump(++$var4); // string(5) "test_" so apparently, using increment operator on string has effect of increasing digit if last character number, increasing letter , resetting once z if last character in alphabet, , has no effect on non alpha numeric characters. is standard feature, expected in many scripting languages, or did find php easter egg? php follows perl's convention when dealing arithmetic operations on character variables , not c's. example, in php , perl $a = 'z'; $a++; turns $a 'aa', while in c = 'z'; a++; turns '[' (ascii value of 'z' 90, ascii value of '[' 91). note character variables can incremented not decremented , pl...

c# - Finding differences within 2 Lists of string arrays -

i looking find differences between 2 lists of string arrays using index 0 of array primary key. list<string[]> original = new list<string[]>(); list<string[]> web = new list<string[]>(); //define arrays list 'original' string[] original_a1 = new string[3]{"a","2","3"}; string[] original_a2 = new string[3]{"x","2","3"}; string[] original_a3 = new string[3]{"c","2","3"}; //define arrays list 'web' string[] web_a1 = new string[3]{"a","2","3"}; string[] web_a2 = new string[3]{"b","2","3"}; string[] web_a3 = new string[3]{"c","2","3"}; //populate lists original.add(original_a1); original.add(original_a2); original.add(original_a3); web.add(web_a1); web.add(web_a2); web.add(web_a3); my goal find in list 'original' not in 'web' using index 0 primar...

java - spring-data-mongodb customRepository can't use dependency injection -

i trying use customrepository use criteria in repository. create customrepositoryimpl , run success. found ,the property added @autowire annotation can't injected automatically. here code: public class logmessagerepositoryimpl implements logmessagerepositorycustom{ @resource private mongotemplate mongotemplate; public list<logmessage> findbycriteria(){ return mongotemplate.find(query(where("level").regex("info")),logmessage.class); } } mongotemplate null ; i tried debug ,and find bean definition's dependson null. can't figure out why? try use @autowired instead of @resource are sure bean called "mongotemplate" in spring xml-config file? provide slice of coniguration file related mongo?

Accessing Image store in sql server "Image" data type from Android Studio in Imageview -

i want show images sql server "image" data type in android studio. web site running in production , working fine in asp.net hence not feasible convert images in other data type require large testing. pls help... create web service access image via unique id. when client calls web service, should relevant image database, convert byte array format mobile client can use, send byte array response.

php - Symfony 2.8 Twig_Error_Runtime Sonata Admin Bundle -

twig_error_runtime: exception has been thrown during rendering of template ("the "app.security" variable not available.") in sonataadminbundle::standard_layout.html.twig @ line 183. now did not think possible, app being twig global, , have no idea start. trying configure sonata user bundle: fos user bundle , sonata admin bundle little success. edit removed sonatauserbundle , went configuration know worked in other projects. isolated problem being symfony , twig specific rather error in configuration; have removed config files. for else hits problem: app.security deprecated 2.6 , supposed removed in 3.0. has broken bc layer , container not injected more effect app.security has been removed in 2.8 , not in 3.0. see https://github.com/symfony/symfony/issues/18223 , https://github.com/symfony/symfony/commit/bf066dace2922cf1ce335f5f683fc63d5a7e23c2 . don't know if or when fixed. meanwhile solution override sonataadminbundle::standard_layout.html.twig , ...

xcode - Score var updates double randomly -

i'm making game, , i'm working on scoring system. however, i'm facing stupid problem. score var when called increase value unary operator (+=) 1, updates value 2 points, instead of 1, , it's doing randomly. have written protocol, i'm conforming gamescene class, , i'm calling method when there contact between sprites. func wascollected(item: gold) { score += item.pointvalue } could method called twice instead of once? because in console see numbers update sequentially 2 when try collect single point @ random moments. i've tried fix using score++ instead of accessing item.pointvalue property, problem still exists. here method i'm calling while setting text property in custom class , according breakpoint i'm getting character twice single execution of method. i'm doing wrong? i'm doing method, have bitmap graphics i'm using font numbers. var i:nsinteger = 0; < text.length; i++ { //get characte...

Highcharts conflict with extjs -

i trying render 3 highcharts inside extjs tab using prototype adapter. rendering multiple bar charts in single page having click event on bars. charts render below first bar charts not click event have registered them. first chart on page has click event. charts below not click-able though have added click events them. when render same page outside extjs component charts , clicks work fine. guessing there conflict highcharts , extjs. was able replicate issue in jsfilddle http://jsfiddle.net/knpeg/4/ the following javascript code creating extjs component in same highchart rendered 3 times bottom charts have bars not clickable. var centertabpanel = new ext.tabpanel({ region:'center', margins: '0 10 0 0', id:'center-panel', activetab:0, bodystyle:'padding: 8 5 5 8;', autoscroll: true, ...

java - Caused by: javax.persistence.PersistenceException: org.apache.cassandra.serializers.MarshalException: Unexpected extraneous bytes after map value -

i have table in cassandra has column of type map (i.e) source_id_map map when try read row table, see there issue while reading column of map type below caused by: javax.persistence.persistenceexception: org.apache.cassandra.serializers.marshalexception: unexpected extraneous bytes after map value @ com.impetus.client.cassandra.datahandler.cassandradatahandlerbase.setcollectionvalue(cassandradatahandlerbase.java:2526) @ com.impetus.client.cassandra.datahandler.cassandradatahandlerbase.setfieldvalueviacql(cassandradatahandlerbase.java:1504) @ com.impetus.client.cassandra.datahandler.cassandradatahandlerbase.populateviathrift(cassandradatahandlerbase.java:1163) @ com.impetus.client.cassandra.datahandler.cassandradatahandlerbase.oncolumn(cassandradatahandlerbase.java:1054) @ com.impetus.client.cassandra.datahandler.cassandradatahandlerbase.populateentity(cassandradatahandlerbase.java:653) another exception notice below. ...

Is youtube data api totally free -

i going implement python client search videos on youtube different queries. apparently should use youtube data api this. though read quata cost want sure using youtube api totally free of charge. sorry basic. yes, using youtube api not incur monetary cost entity calling api. if go on quota an 403 error returned api. links: youtube api quota details youtube quota calculator google provides a python client of apis, including youtube, handles authentication, forming , making api request datatype translation (i.e. json dictionary, etc.). ( link )

ListView in React Native tutorial cannot reach its scroll to the bottom(Android) -

Image
i made same demo application react native tutorial(0.21) instructs, , run app on simulator(ios 9.2 iphone 6s, nexus_5_api_22_x86 avd) it looks ok, when scroll app bottom, ios app reach end. bug of react listview component? i can't confirm right now, seems listview hides behind action-bar of android. can apply marginbottom: 20 or paddingbottom: 20 listview scroll bottom. like this- <listview style={{ marginbottom: 20 }}> </listview>

c++ - Throw exception if the file does not exist in constructor and try/catch it when creating an object in main(), if good - start using the object -

i want open file in constructor , read data it. check if file can opened should in constructor (from point of view) , if there exception - throw , try/catch in main, when try initialize new object. if exception appears want continue asking user try enter filename. i've came this: fstream fp; class myclass { myclass(const string& n) { //try open file , read data write in list fp.open (n, ios::in); if (!fp) { throw std::runtime_error("could not open file"); } //use fp read data , put data in list } }; void main () { cout << "please enter input file name: \n"; string iname = ""; cin >> iname; ifstream ist{iname}; try { myclass obj(iname); } catch (std::exception &ex) { std::cout << "ouch! hurts, because: " << ex.what() << "!\n"; } /* if file not found or can't opened ...

jquery - Summing up values in custom attr loop in JavaScript -

i have loop generates <li> custom attribute filesize , want search <li> class , sum value, instead returns 2 values next each other , not summing values. https://jsfiddle.net/y6yll0yv/1/ var myelements = jquery(".fileress"); var sumoffilessize = 0; (var = 0; < myelements.length; i++) { var valueofthis = myelements.eq(i).attr("sizefile"); var valuetostr = valueofthis.tostring(); var sumoffilessize = (valuetostr + sumoffilessize); } alert(sumoffilessize); html: <div id="fileinfo1"> <div style="clear:both;padding:5px;" class="fileress" sizefile="206519" id="fileres_0"> <input size="1" type="file" class="file" name="attach[]" id="attacher" style="display:none" multiple="" value="undefined">206519 </div> <div style="clear:both;padding:5px;" class=...

php - Can not take json data with angularjs -

http://moviestolike.pe.hu/get_all_products.php i want take data , print screen in index.html: <!doctype html> <html ng-app="todoapp"> <script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.4.8/angular.min.js"></script> <script src="script.js"></script> <body> <div class="form-group" ng-controller="todocontroller"> <p>movie list page</p> <br> <p>click button see movies</p> <div class="form-group" > <div class="col-sm-10 col-sm-offset-2"> <button type="submit" class="btn btn-primary" ng-click="count = count + 1" ng-init="count=0"> <span class="fa fa-check"></span> count list movie</button> <span> count: {{count}} </span> <button type="submit...

php - preg_match_all does not give results -

i don't know why when execute script doesn't display lines correctly. gives last line of variable lines no input under it. overlooking something? <?php $stop = '06bah'; $input = file_get_contents('file1.txt'); $lines = file('file2.txt'); ($i=0; $i < count($lines); $i++) { preg_match_all("/^($lines[$i].*)$stop/msu", $input, $matches); } ?> file1: 06bah toi00123-11-134-b op_signage 10 05 6 00132-12-172-a 4 pon 05 7 00127-22-683-a 3 pon 05 9 00927-62-133-a 11 pon 05 18 00227-72-542-a 8 ...

php - UnitTest Slim's Error Handler Responses -

i'm developing api service using slim php v3 , i'm trying unit test development using phpunit. i have following in controller( usercontroller) mapped route in slim try { $model = $this->model->findorfail($args['id']); $response->write($model); } catch (modelnotfoundexception $e) { throw new \exception($e->getmessage()); } return $response; to slim "handle error" , return 500 status code( works when execute in browser) now have following test( userstest)... protected function request($method, $url, array $requestparameters = []) { ob_start(); $request = $this->preparerequest($method, $url, $requestparameters); $response = new response(); $app = $this->app; $this->response = $app($request, $response); return ob_get_clean(); } function testgetuserfail() { $response = $this->request('get...

perl how to add proxy to my script -

i want add proxy script interacting networks(mainly want hide ip outgoing request) how use script? use cgi qw/:standard/; use mail::vrfy; use mail::verify; use http::daemon; $emailaddress = $argv[0]; $d = http::daemon->new( localhost => "localhost", # remove listen other machines # (i.e. open-relay... careful of spammers!) localport => 8080 ) || die; print "[proxy url:", $d->url, "]\n"; #print $email_ck; $code = mail::vrfy::checkaddress(addr => $emailaddress,method => 'extended',timeout => 12,debug => 0); print $code; i have proxy address now how add outgoing request eg have use proxy function my $code = mail::vrfy::checkaddress(addr => $emailaddress,method => 'extended',timeout => 12,debug => 0); how it? mail::vrfy uses dns , smtp verify email addresses. guess "proxy address" mean http proxy. kind of proxy server won't you, since no http co...

python - Dinucleotide count skips repeats -

i'm working on finding dinucleotide count in .txt file. sample data set i'm using 'ssss'. code below running of now. import os stseq = open(os.path.expanduser("/users/mitch_whitaker/desktop/a5 count.txt")) lines = stseq.read() mystr = '\t'.join([line.strip() line in lines]) all_counts = [] base1 in ['s', 't']: base2 in ['s', 't']: dinucleotide = base1 + base2 count = lines.count(dinucleotide) print("count " + str(count) + " " + dinucleotide) all_counts.append(count) print(all_counts) i returned 'ss' count of 2 when in reality should 3. me figure out solution skipping occurs while counting characters. your problem here might because of overlapping substrings not being counted. i'm assuming substring sss should counted 2 instances of dinucleotide ss? count() method used return 1. if indeed problem, have design own count method.

Hibernate / JPA - EntityNotFoundException: Unable to find with id -

i have scenario 2 entities have @manytoone relation.the app uses both spring data jpa , hibernate. trying save child entity through spring data jpa repo's save() method , other through hibernate's getsession().save(). ending entity not found exception. after first save, not inserting record in db because of later save failing. looking solution make work! samplecode: entitya = new entitya(); entityadao.save(); //not inserting record entityb b = new entityb(); b.setentitya(a); b.save(); //throwing entitya not found exception. test class: @runwith(springjunit4classrunner.class) @contextconfiguration(locations = { "classpath:test-application-context-dao.xml" }) @transactional(propagation= propagation.requires_new) public class entitytest{ @autowired private entityadao entityadao; private entitybdao entitybdao; @autowired private sessionfactory sessionfactory; @postconstruct public void orderdaotest() { subject = n...

python - HDF5 possible data corruption or loss? -

on wikipedia 1 can read following criticism hdf5: criticism of hdf5 follows monolithic design , lengthy specification. though 150-page open standard, there single c implementation of hdf5, meaning bindings share bugs , performance issues. compounded lack of journaling , documented bugs in current stable release capable of corrupting entire hdf5 databases . although 1.10-alpha adds journaling, backwards-incompatible previous versions. hdf5 not support utf-8 well, necessitating ascii in places. furthermore in latest draft, array data can never deleted. i wondering if applying c implementation of hdf5 or if general flaw of hdf5? i doing scientific experiments generate gigabytes of data , in cases @ least several hundred megabytes of data. data loss , corruption huge disadvantage me. my scripts have python api , hence using h5py (version 2.5.0). so, criticism relevant me , should concerned corrupted data? declaration front: maintain h5py, have...

html5 - Google form doesn't load in iframe in html -

i'm using <iframe> in html5 working correctly other links except google forms. please tell me wrong. here link i'm using: http://www.sciencekidunya.com/event and google form link is: https://docs.google.com/forms/d/1ehenks61n8rmxhxvik7a8l0ockbtpjgn4zpy-vdqjxs/viewform and code is: <body> <center><img src="banner.jpg" width="100%" height="40%"><br><br> <iframe src="https://docs.google.com/forms/d/1ehenks61n8rmxhxvik7a8l0ockbtpjgn4zpy-vdqjxs/viewform"></iframe> </center></body>

How to trace code in ASP.Net MVC from frontend to backend? -

i've been given large mvc solution fix bugs in. i'm skilled in c#, have no experience asp, , don't seem able find debugging/tracing tutorials on mvc. how can understand view/views startup page of app? how can trace c# method called when button in chrome browser (local debugging via iis in vs web 2013) pressed example? check route config default page , routes;

ms word - VBA code to search for text and stop at next occurrence including footnotes, headers etc -

i trying write code search through stories including headers, footers, footnotes etc , stop @ each occurrence user can make decision (it may or may not change), click button again move next occurrence (like word's find next). aware there pretty tricky code performing search , replace using range object , have code working part if project, can't make search , stop @ selected text, carry on looking in different storeies, stops @ end of main document. code below looks though should work if footnote example has text searched for, ignoring it. have done thorough search of site , others , have found several examples search , replace, none search , stop/select. advice gratefully received - thank you. sub testselection() dim rngstory range dim docdocument document set docdocument = activedocument docdocument each rngstory in .storyranges select case rngstory.storytype case 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11 debug.print rngstory.story...

Sitecore sort children by __Created field -

i have sitecore 6.6 solution running mvc , razor. have following line; @html.raw(sitecore.context.database.getitem(mylist.children.lastordefault()["myfield1"]).fields["myfield2"]) the above works fine, except order sorts in. need latest item based on __created field. lastordefault seems take last item in tree, not correspond actual latest created item. can done in 1 line above? how this: mylist.getchildren() .orderby(x => x[sitecore.fieldids.created]) .reverse() .lastordefault() i guess work too: mylist.getchildren() .orderby(x => x.statistics.created) .reverse() .lastordefault() keep in mind though first children retrieved , sorting happen. if have lot of children slow. one general note, shouldn't in view really. you're putting logic in there. model should provide item need (last created).

orchardcms - include Facebook Pixel Code js in orchard -

i need add facebook pixel code script in head section of every page. <!-- facebook pixel code --> <script> !function(f,b,e,v,n,t,s){if(f.fbq)return;n=f.fbq=function(){n.callmethod? n.callmethod.apply(n,arguments):n.queue.push(arguments)};if(!f._fbq)f._fbq=n; n.push=n;n.loaded=!0;n.version='2.0';n.queue=[];t=b.createelement(e);t.async=!0; t.src=v;s=b.getelementsbytagname(e)[0];s.parentnode.insertbefore(t,s)}(window, document,'script','//connect.facebook.net/en_us/fbevents.js'); fbq('init', 'xxx'); fbq('track', "pageview");</script> <noscript><img height="1" width="1" style="display:none" src="https://www.facebook.com/tr?id=xxx&ev=pageview&noscript=1" /></noscript> <!-- end facebook pixel code --> how can this? started working on orchard. read edit cshtml or edit theme... thanks there should layout.cshtml file in themes d...

mysql - YII2 get the date after 10 years and 5 years -

here table structure. tbl_staff firstname varchar(50) midname varchar(50) lastname varchar(50) ... tbl_staff2 first_day_of_service date ... here scenario. first 10 years of stay of staff in organization, he/she given loyalty award , every 5 years after he/she receives first 10 years. my initial code name of staff , date of first day of service. public function actionget_loyalty() { $query = (new \yii\db\query()) ->select(['firstname', 'midname', 'lastname', 'first_day_service']) ->from('tbl_staff') ->limit(100) ->offset(0) ->orderby('first_day_service') ->leftjoin('tbl_staff2', 'tbl_staff2.staff_id = tbl_staff.id'); $command = $query->createcommand(); $data = $command->queryall(); $string = "<table class='table table-striped'><tr>...