Posts

Showing posts from June, 2015

visual studio - Javascript object array initializer formatting -

my ide visual studio 2015 resharper 9.2, want javascript object array initializer automatically formated this var x = [{ a: 1, b: 2 },{ a: 3, b: 4 }]; i want round , square brackets together, ideas how can this? it formatted this: var x = [ { a: 1, b: 2 },{ a: 3, b: 4 } ]; you can change formatting rules of vs explained here . problem should solved selecting either block or smart .

Unable to run bluemix container No tenant network -

i following etherpad tutorial. i created container on ubuntu , ran locally. push bluemix worked. when try run container on bluemix following error: sorry, error occurred on our side: unable create network. no tenant network available allocation. [incident id e1d83d17ff51f0ae] is temporary failure or fault? i ran following command $ sudo ice run -p 9080 --name ethernotes registry-ice.ng.bluemix.net/alicesbox/notes:latest this temporary failure. response says "an error occurred on our side". when ibm container created given private ip address reachable other containers sharing account. system unable give instance address. try again. after instance has been created can make public-facing giving public ip address.

C - Parse string from SNMP SET (weird) -

i working on own snmp agent , having trouble processing strings. pretty new snmp well. i've referred following links of implementing own agent : http://www.net-snmp.org/dev/agent/ucddemopublic_8c_source.html http://www.net-snmp.org/dev/agent/example_8h_source.html the second link shows how handle when user attempts set integer type mib object : line 657 shows : intval = *((long *) var_val); my question : how go string? i've tried casting it, strncpy, snprintf, etc. my work : i know, or @ least think, following legal : int setstring(int action, u_char * var_val, u_char var_val_type, size_t var_val_len, u_char * statp, oid * name, size_t name_len) { unsigned char publicstring[10]; static long intval; char *cmd_string = null; /* * define arbitrary maximum permissible value */ switch (action) { case reserve1: //intval = *((long *) var_val); ...

sql - Overlapping Spans -

i trying write query reorders date ranges around particular spans. should looks this row rank begin date end date 1 b 3/24/13 11/1/13 2 10/30/13 4/9/15 3 b 3/26/15 12/31/15 and have become row rank begin date end date 1 b 3/24/13 10/29/13 2 10/30/13 4/9/15 3 b 4/10/15 12/31/15 to explain further, dates in row 2 ranked higher (a>b), dates in row 1 , 3 have change around dates in row 2 in order avoid overlap in dates. i using sql server 2008 r2 you can use following query: ;with cte ( select row, rank, begindate, enddate, row_number() on (order begindate) rn mytable ), toupdate ( select c1.row, c1.rank, c1.begindate, c1.enddate, c2.rank prank, c2.enddate penddate, c3.rank nrank, c3.begindate nbegindate cte c1 left join cte c2 on c1.rn = c2.rn + 1 left join cte c3 on c1.rn = c3.rn - 1 c1.rank = 'b' ) update to...

php - How to Add an Object to Laravel's IOC Container from Middleware -

i want create object in middleware (in case, collection eloquent query), , add ioc container can type-hint method signatures in controllers access it. is possible? can't find examples online. you can easy, in several steps. create new middleware (name want) php artisan make:middleware usercollectionmiddleware create new collection class extend eloquent database collection. step not required, let in future create different bindings, using different collection types. otherwise can 1 binding illuminate\database\eloquent\collection . app/collection/usercollection.php <?php namespace app\collection; use illuminate\database\eloquent\collection; class usercollection extends collection { } add bindings in app/http/middleware/usercollectionmiddleware.php <?php namespace app\http\middleware; use closure; use app\user; use app\collection\usercollection; class usercollectionmiddleware { /** * handle incoming request. * * @param \ill...

Unable to style paper-drawer-panel in Polymer 1.0 using Custom CSS Mixins -

i trying style paper-drawer-panel using custom css mixins mentioned here . paper-drawer-panel.css file applies @apply(--paper-drawer-panel-left-drawer-container); @apply(--paper-drawer-panel-main-container); respectively drawer , main containers. but, styles set using mixins not seem working below code paper-drawer-panel demo have used. <html> <head> <title>paper-drawer-panel demo</title> <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0"> <meta name="mobile-web-app-capable" content="yes"> <meta name="apple-mobile-web-app-capable" content="yes"> <script src="bower_components/webcomponentsjs/webcomponents-lite.js"></script> <link rel="import" href="bower_components/paper-styles/paper-styles.html"> <link rel="stylesheet...

gradle - Is it possible to run integration tests on many spring boot applications at the same time? -

i have gradle project 3 modules use spring-boot. these 3 spring-boot applications running in parallel , interact each other. for example, module1 saves data in module2 , module3 retrieves data module2 via rest apis. i implement integration tests regarding interactions between these 3 spring boot applications (ie. have each of them run separately on different port). possible? how? i know can single spring boot application. ( as explained here )

c# - How to correct replace type of Expression? -

i have 2 classes: public class dalmembershipuser { public string username { get; set; } //other members } public class membershipuser { public string username { get; set; } //other members } i have function: public ienumerable<dalmembershipuser> getmany(expression<func<dalmembershipuser, bool>> predicate) { //but here can use func<membershipuser, bool> //so made transformation query = query.where(expressiontransformer<dalmembershipuser,membershipuser>.tranform(predicate)); } current implementation: public static class expressiontransformer<tfrom, tto> { public class visitor : expressionvisitor { private parameterexpression _targetparameterexpression; public visitor(parameterexpression parameter) { _targetparameterexpression = parameter; } protected override expression visitparamet...

javascript - Invalid left-hand side in assignment for no apparent reason -

i'm receiving kind of error, can't copy whole code (quite big), can find reason why happens. in portion of code '... })})(jqinteractives);</script></textarea>') } else if (ide == "feverchart") { $("#codearea").append('<textarea>'+ '<style>.stretch:after {content: .... i'm using ... indicate code follows there, it's not problem of what's around it, if move it, problem appears in line $("#codearea").append('<textarea>'+ it has nothing '+ because i've tried without , continuing line. i'm using exact same line in other parts of complete code without problems, , don't see problem here either. clues? per comment, moved different place, avoid problems not closing smoething. have same problem when move here: if (ide == "blanktemp") { } else if (ide == "feverchart") { $("#code...

Spring scope HashMap problems -

i've got simple bean <bean id="map" class="java.util.hashmap" > </bean> i assume has singleton scope. every time call getbean("map") empty hashmap though filled before that. why happening? the application context created when application started , destroyed when application ends. can have singleton working in boundaries of 1 application context.

ruby - Rails Conditional Validation in Model from Controller Session Data -

i trying conditionally validate full_name , zip based on whether visitor part of test (visitors part of test have session data). able pass true/false leads controller customer model via customer.visitor_test(), can't access @test in_test? in model. missing? customer.rb /* stripped down code */ class customer < activerecord::base attr_accessor :test validates :full_name, presence: true, if: :not_in_test? validates :zip, presence: true, if: :in_test? def visitor_test(bool) @test = bool end def in_test? @test end def not_in_test? !self.in_test? end end leads_controller.rb /* stripped down code */ class leadscontroller < applicationcontroller def create session[:zip] = zip session[:email] = email session[:full_name] = full_name session[:email_opt_in] = email_opt_in session[:phone] = phone listing = listing.where(id: listing_id).first customer = create_or_update_customer_from_session(listing) ...

regex - Read text file, match & paste text in excel -

i have text file test.txt has 3 columns. 1st & 2nd columns separated 2 spaces , 2nd & 3rd columns 6 spaces. sample: 402115000518432 97517518878 idle 402115001509990 97517490827 idle 402115001555677 97517339229 idle all entries of 1st column begin 40211 i want 1st column of text pasted in 1st column of excel file. i trying following code: dim pattern = "(?<=\s*40211.*).*" dim = 1 each line in file.readlines(richtextbox3.text) dim match = regex.match(line, pattern) if match.success sheet.cells(i, 1).value = match.value += 1 end if next but pasting 3 columns , 1st column not have 40211 part. appreciated. use expression instead: 40211[^\s]*

jquery - datatable, how to display table sorted by a column in this date format? -

i display table sorted column called createdat has format : 2015-03-09t14:46:57.678-04:00 the above date format can parsed date.parse() . so, if have columns : <tbody> <tr><td>2015-03-09t14:46:54.678-04:00</td></tr> <tr><td>2015-03-09t14:46:55.678-04:00</td></tr> <tr><td>2015-03-09t14:46:56.678-04:00</td></tr> <tr><td>2015-02-09t14:46:57.678-04:00</td></tr> <tr><td>2015-02-09t14:46:56.678-04:00</td></tr> <tr><td>2015-03-10t02:46:57.678-04:00</td></tr> <tr><td>2015-03-11t14:41:57.678-04:00</td></tr> <tr><td>2015-03-09t12:46:57.678-04:00</td></tr> <tr><td>2015-03-09t01:46:57.678-04:00</td></tr> </tbody> you can make simple custom sorting plugin , use particular column : $.fn.datatableext.osort['...

java - NullPointerException Error on an Image -

i'm working in java , wanted create arraylist of bufferedimages: arraylist<bufferedimage> anotelist = new arraylist<bufferedimage>(); i want populate arraylist 197 bufferedimages in constructor of drawpanel class. public drawpanel(){ for(int = 0; < 197; i++){ try { anotelist.add(imageio.read(new file("a.png"))); } catch (ioexception e) { e.printstacktrace(); } } setpreferredsize(new dimension(400, 600)); panelsize=getpreferredsize(); height=(int) panelsize.getheight(); width=(int) panelsize.getwidth(); system.out.printf("%d, %d\n",height,width); loadimage(); } then, in drawframe class, create object out of drawpanel class called canvas. use canvas here. /*this checks see if song @ specified time , calls fall method in drawpanel class.*/ public void checkiffall() throws ioexception{ if(song.gettime() / 1000000000 == (jojo.getaarray()[canvas.g...

javascript - Trying to use :not to select ids and have the respective slideshows turn off -

this not being recognised. syntax error saying illegal character on column 29. when clicking button ( #c1 - #c4 ) slider stops. believe isn't recognising not. $('div.nivoslider:not('#c' + id)').data('nivoslider').stop(); yet start specific slideshow working. $('#c' + id).nivoslider({ effect: 'fade' }); i have slider #c1 starting on load. thank you. looking @ code, cutting off string early. (look @ syntax highlighting colors here clue) try this: $('div.nivoslider:not(#c' + id + ')').data('nivoslider').stop();

r - Select (dplyr) operator with '-' -

Image
how use select (dplyr library) operator name containing '-'? example: adultuci %>% select(capital-gain) caused: try this data.frame(`a-b` = 1, c = 2, check.names = false) %>% select(`a-b`) # a-b # 1 1

In Cordova for Windows 8, what is the correct storage option for longterm storage? -

i'm building cordova app windows 8 (surface pro 3) using visual studio 2015 rc. app db need store content such text, image locations, etc. of course want normalize as can db. also, i'm working on web service app use api update database new content needed. according apache cordova choices seem localstorage , indexeddb . i'm not sure of these can reliably need or if there better solution. i've done native android uses sqlite have experience there. my understanding both of transient storage. @ end of page is: "in addition storage apis listed above, file api* allows cache data on local file system." plugin (which haven't used) wraps sqlite is: here .

css ul li nested menu with a padding. How on hoover retain width of the menu? -

example here http://jsfiddle.net/v8yhk7lr/ html <div class="navig_div" id="mainnavig_div" > <ul class="mnav-ul"> <li class="mnav-ul-li"><a href="#">option one</a> <ul class="mnav-ul-ul"> <li><a href="#">option 1 1</a> </li> <li><a href="#">option 1 one longer</a> </li> </ul> </li> <li class="mnav-ul-li"><a href="#gg">option 2 long text</a> <ul class="mnav-ul-ul"> <li><a href="#">option 2 1</a> </li> <li><a href="#">option 2 1 longer</a> </li> </ul> </li> <li class="mnav-ul-li"><a href="#">option three</a> <ul class="mnav-ul-ul"> <li><a href="#">option 3 1</a> </li> <li><a ...

python 3.x - Using py2exe by just running the script, no command-line -

i know there's question answer didn't work me. when append py2exe argument in program, , run it, noticed it's missing bunch of files. when run exe, says file "boot_common.py", line 46 in <module> importerror: no module named 'ctypes' can me on how fix this? here's code: from distutils.core import setup import py2exe, sys import tkinter tk tkinter import filedialog input('press enter continue , select python file want convert when dialog shows up...') tk.tk().withdraw() file_path = tk.filedialog.askopenfilename() sys.argv.append("py2exe") setup(console=[file_path]) also if helps, i'm using 32-bit python interpreter.

Running Boot2docker behind proxy, getting FATA[0020] Forbidden for any interaction with Docker hub -

followed instruction set proxy of boot2docker , getting following fatas, clue fata[0020] https://index.docker.io/v1/repositories/library/busybox/images: forbidden while trying pulling images fata[0020] error response daemon: server error: post https://index.docker.io/v1/users/: forbidden while trying login fata[0000] error response daemon: https://index.docker.io/v1/search?q=ubuntu: forbidden - while searching images updated include result of curl -v https://index.docker.io:443 * rebuilt url to: https://index.docker.io:443/ * connect() proxy 34363bd0dd54 port 8099 (#0) * trying 192.168.59.3... * adding handle: conn: 0x9adbad8 * adding handle: send: 0 * adding handle: recv: 0 * curl_addhandletopipeline: length: 1 * - conn 0 (0x9adbad8) send_pipe: 1, recv_pipe: 0 * connected 34363bd0dd54 (192.168.59.3) port 8099 (#0) * establish http proxy tunnel index.docker.io:443 > connect index.docker.io:443 http/1.1 > host: index.docker.io:443 > user-agent: curl/7.33.0 ...

Generating Define-Use Paths for C Code coverage analysis -

how possible generate uncovered define-use paths c code (using e.g. gcc). saw subject academic. (unlike line coverage) resource: http://whiteboxtest.com/data-flow-testing.php you need tool can determine every definition, possible uses (e.g., computes def-use pairs) in code, associate each def-use pair variable defined , program location (file, line, column) of def , use points. then each def-use pair, need add instrumentation ("probes") program records use of def-use pair, when gets used (usually near use), kind of boolean variable specific def-use pair. because there lot of these useful organize individual booleans boolean array. (obvious optimization minimize number inserted probes: basic block, when executed, satisfy many def-use pairs; boolean representing execution of basic block [block coverage] can stand in set of def-use pairs. i'm sure there other similar optimizations.). after running program, 1 has dump these boolean variables, compute ac...

AssyncTask and socket not working in android java -

i'm making simple app client-server in java, want phone recive , send messages pc, i'm on same lan , pc's ip 192.168.1.8, serversocket running on port 7777. reason client android cant connect think because created socket in thread, have read should use asynctask or handle, tried exception too. class server: public class myserver implements runnable{ private serversocket server; private objectinputstream in; private objectoutputstream out; private socket clientedconnected; public exampleserverznuc(){ try { server= new serversocket(7777); system.out.println("server opened on port 7777"); } catch (ioexception ex) { logger.getlogger(myserver.class.getname()).log(level.severe, null, ex); } } public void sendmessage(string message){ try { out.writeobject(message); out.flush(); } catch (ioexception ex) { logger.getlogger(myserver.class.getname()).log(level.severe, null, ex); } } public vo...

jquery - tokenSeparators in Select2 -

thanks in advance, 2 things: 1- how can take "enter" , "tab" keys token in select2? this of code have. $("#listavalores").val($("#listavalores").val().replace(/\;/g,',')) $("#listavalores").select2({ tags: true, tokenseparators: [';'], maximumresultsforsearch: -1, dropdowncss: {display:'none'}, }); first line transforming input data can used select2. original input can sth this: $("#listavalores").val("value1;value2;value3") these values stored in db , loaded textbox transformed select2. everything working expect, transform part: tokenseparators: [';'] so accepts "enter" , "tab" keys token. can help? tried ascii codes no luck. 2- plus, there tag disable spinner image? (since there no data being loaded don't need loading image appearing) update 2: i had suc...

mysql - Assigning variables according to dynamic queries -

i'm creating function on local server in order calculate value, variables stored on different tables set @tmquery = concat("select sum(x) table", year, " id = ", id); prepare stmt @tmquery; set tm = (execute stmt); i need year , id values (which received parameters) in order filter information can sum() of relevant data, need save sum() value on different variable in order use afterwards, can in order accomplish this?

"Cannot read property 'addEventListener' of null" error in javascript -

i have function saves text txt file. works on own (when have simple html , js file), when add program throws error: cannot read property 'addeventlistener' of null (function(view) { "use strict"; var document = view.document, $ = function(id) { return document.getelementbyid(id); }, session = view.sessionstorage // url when necessary in case blob.js hasn't defined yet , get_blob = function() { return view.blob; } text = "slavik's text"; save_file = $('savefile'); text_filename = "filename.txt"; documemt.getelementbyid('savefile').addeventlistener("submit", function(event) { event.preventdefault(); var bb = get_blob(); saveas( new bb( [text.value] , {type: "text/plain;charset=" + document.characterset} ) , (text_filename.value) + ...

printf prints unexpected last element of a multidimensional array in C, depending on input? -

i'm learning use multidimensional arrays in c , i'm unable understand why printf() gives unexpected result in following program. the idea in program wish initialize 5x2 array , accept 5 integers user scanf populate 2nd index, print array: #include <stdio.h> #include <conio.h> int main(void) { int i=0, mat[5][2] = { {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0} }; printf("please enter 5 integers press enter: \n"); { scanf("%i", &mat[i][2]); i++; } while (getchar() != '\n'); printf("here's 5x2 array looks like: \n"); for(i = 0; < 5; i++){ printf("%i %i", mat[i][1], mat[i][2]); printf(" \n"); } return 0; } if enter integers user, output expected: c:\users\hackr>tmp.exe please enter 5 integers press enter: 0 1 2 3 4 here's 5x2 array looks like: 0 0 0 1 0 2 0 3 0 4 ho...

java - Why can't I access a protected method? -

this question has answer here: why code wrong , java in nutshell said so? [closed] 1 answer i have question protection mechanism different packages in java. can not understand is, why method call not work! package a; class { protected void method(){}; } package b; import a.a; class b extends { } class main extends { b b = new b(); b.method();// error: method() has protected access in package1.a } why!! jls 6.6.2 a protected member or constructor of object may accessed outside package in declared code responsible for implementation of object . being subclass doesn't mean responsible of implementation. here example, again jls : package points; public class point { protected int x, y; void warp(threepoint.point3d a) { if (a.z > 0) // compile-time error: cannot access a.z a.delta(this); ...

ios - Swift infinite loop while iterating array -

i have protocol defined as... @objc protocol mydatasource : class { var currentreportlistobjects:[reportlistobject] { }; } and code iterate returned array (as nsarray objc) in swift as... if let reportlistobjects = datasource?.currentreportlistobjects { reportlistobject:reportlistobject? in reportlistobjects { if let report = reportlistobject { // useful 'report' } } } if reportlistobjects array nil, stuck in infinite loop @ for-loop. equally, if there data in array, iterated , 'something useful' done until end of array reached loop not broken , continues infinitely. what doing wrong? or there blindingly obvious i'm missing here? you've added lot of optionals here confusing things. here's mean: for report in datasource?.currentreportlistobjects ?? [] { // useful 'report' } if ...

asp.net mvc - jquery button in pop up -

i used index.js file write code create , open popup on button click. partial view invoked popup. $("#createform").dialog({ autoopen: false, modal: true, width: 550, height: 420, open: function(event, ui) { $(".ui-dialog-titlebar-close").hide(); } }); $(".buttoncreate").button().click(function() { $.ajax({ // call createpartialview action method url: "/purchaseinvoice/additempartial", type: 'get', success: function(data) { $("#createform").dialog("open"); $("#createform").empty().append(data); $("#editform").hide(); }, error: function() { alert("something seems wrong"); } }); }); the button in popup used invoke function .js file. button not working first time when popup opens when popup opens after closing popup esc button wor...

Is there a way to connect Cloud SQL from tools like SQL YOG if i have a firewall in Office? -

i able connect cloud sql using sql yog using internet data card provides unique ip address handshake process . office cannot connect has firewall. , when ip address receive of firewall instead of host. there better way connect cloud sql office firewall ip restricts handshake process i don't know sql yog is, 1 other option create google compute engine instance. can connect workstation gce instance, , connect cloud sql within instance.

java - Null Pointer Exception while reading from excel? -

public class executetest { @test public void testlogin() throws exception { // todo auto-generated method stub `webdriver webdriver = new firefoxdriver(); readexcelfile file = new readexcelfile(); readobject object = new readobject(); properties allobjects = object.getobjectrepository(); uioperation operation = new uioperation(webdriver); //read keyword sheet sheet rdsheet = file.readexcel(system.getproperty("user.dir")+"\\","testcase.xlsx" , "keywordframework"); //find number of rows in excel file int rowcount = //loop on rows rdsheet.getlastrownum()-rdsheet.getfirstrownum(); //create loop on rows of excel file read (int = 1; < rowcount+1; i++) { row row = rdsheet.getrow(i); //check if first cell contain value, if yes, means new testcase name if(row.getcell(0).tostring().length()==0){ //print testcase detail on console system.out.println(row.getcell(1).tostring()+"----"+ r...

r - Enforcing more logarithmic axis ticks under free scales in facet_wrap() of ggplot2 -

Image
apologies not providing data. big, , mock data, wasnt able reproduce problem. if @ this: you realize facets have no or 1 x-tick. want enforce @ least 2 ticks per facets, though logarithmically scaled. possible? the graph produced code: ggplot(data, aes(x = frequency, y = treatment)) + facet_wrap(~ sg, scale = "free_x") + geom_point(aes(col = factor(treatment)), shape = "|") + scale_color_manual(values = somecols, guide=false) + scale_x_log10()

ios - UIFont doesn't set the correct font name when pointSize is 0 -

why uifont incorrectly print out font name when size set zero? when set size greater zero, correct font name output. there particular reason behind behavior or true bug. uifont* f1 = [uifont fontwithname:@"helveticaneue-thin" size:0]; nslog(@"%@",f1); uifont* f2 = [uifont fontwithname:@"helveticaneue-thin" size:1]; nslog(@"%@",f2); output: <uictfont: 0x7fb90c988e10> font-family: "helvetica"; font-weight: normal; font-style: normal; font-size: 0.00pt <uictfont: 0x7fad92177a90> font-family: "helveticaneue-thin"; font-weight: normal; font-style: normal; font-size: 1.00pt in the documentation : fontsize size (in points) font scaled. value must greater 0.0. you trying implement behaviour not supported. 'incorrect' result expected.

javascript - How to get output from console.log when it is a HTML file -

i have started learning javascript , have made first program simple guess number game. give user feed there guesses, used console.log() . worked on website used learn javascript ( http://www.codecademy.com/learn ), when put in notepad, saved .htm file, , run it, prompts , confirm, no visible feed console.log command. how can console.log command work? here code: <script language="javascript"> confirm("are ready play 'i can guess that'? game player 2 tries guess player 1 number?"); //find out names var player1 = prompt("player 1 name?","your name here"); var player2 = prompt("player 2 name?","your name here"); //player 1 number var place_holder = 0; var p1 =place_holder; while (p1 > 1000 || p1 == 0) { p1 = prompt(player2 + "look away." + " " + player1 + " " + "what number?", "your number 1 1,000 here"); ...

http - Generating SHA-2 certificate with ikeyman -

trying move sha-1 ssl sha-2 ssl since sha-1 certificates expiring of jan 2016. using ikeyman version 8.0.344 generate new sha-2 cert. couple of questions have i generating kdb, , under create new key , cert request have selected: key size: 2048, sig. algorithm: sha2withrsa are these 2 values correct selections? 2.after created cert. request, viewed generated , seeing fingerprint (sha1 digest): num:num:num... signature algorithm: sha256withrsa does matter if fingerprint sha1? thanks theoretically, certificate can forged. but, still researching don't know if there known 'fix' or non-issue ssl security. this question , ensuing discussion may shed light - is sha-1 secure password storage?

android - EXTRA Parameters for Google Chrome Custom Tabs mayLaunchUrl -

google announced google chrome custom tabs , way use google chrome power open webpages instead of using webviews. is there list of possible keys bundle used in maylaunchurl ? right looks extras bundle maylaunchurl there future use. so, there doesn't seem list of keys. the extras field on maylaunchurl: @param extras reserved future use.

elasticsearch - Index template with wildcard type names -

as can read on this section official documentation, can set wildcards in index names, have tested , works fine, but, there way can same type names?. example { "user": { "template": "user-*", "settings": { "index.number_of_shards": 5, "index.number_of_replicas": 1 }, "mappings": { "info": { "dynamic": "strict", "properties": { ... } } "more": { "template": "more-*", "_parent": { "type": "info" }, "dynamic": "strict", "properties": { ... } } } } } thise...

php - Contact Form 7: use hook created using wpcf7_before_send_mail for only one contact form by id -

i working on site several forms created using contact form 7. 1 of these forms, passing variables collected using hidden input field in form. passing these variables email using wpcf7_before_send_mail hook, these values passing every email (i added dynamic variables static text) here's code: add_action( 'wpcf7_before_send_mail', 'wpcf7_add_text_to_mail_body' ); function wpcf7_add_text_to_mail_body($contact_form){ $values_list = $_post['valsitems']; $values_str = implode(", ", $values_list); // mail property $mail = $contact_form->prop( 'mail' ); // returns array // add content email body $mail['body'] .= 'industries selected'; $mail['body'] .= $values_list; // set mail property changed value(s) $contact_form->set_properties( array( 'mail' => $mail ) ); } i trying figure out how pass these values 1 of contact form email templates, via for...

Read annotation of generic class Java -

i had idea use dao class (dao.java): class dao <model extends abstractmodel> { public string geturl() { return model.class.getannotation(mypath.class).url(); } } and model (account.java): @mypath(url = "blabla") class account extends abstractmodel { ... } but problem in case if run @test public void testdaourl() { dao<account> dao = new dao<account>(); dao.geturl(); } model.class seems abstractmodel , not account. is there work around mypath annotation dao (without giving instance of account.class)? thanks in advance idea! ps: mypath-annotation: @retention(runtime) @target(type) @interface mypath { public string url(); } yes, there solution, it's uglier passing class argument dao constructor , more prone error. this trick known type token . i've seen used in deserialization libraries (like gson or jackson json). class dao<model extends abstractmodel> { private final class...

python - Interpolate (or extrapolate) only small gaps in pandas dataframe -

i have pandas dataframe time index (1 min freq) , several columns worth of data. data contains nan. if so, want interpolate if gap not longer 5 minutes. in case maximum of 5 consecutive nans. data may (several test cases, show problems): import numpy np import pandas pd datetime import datetime start = datetime(2014,2,21,14,50) data = pd.dataframe(index=[start + timedelta(minutes=1*x) x in range(0, 8)], data={'a': [123.5, np.nan, 136.3, 164.3, 213.0, 164.3, 213.0, 221.1], 'b': [433.5, 523.2, 536.3, 464.3, 413.0, 164.3, 213.0, 221.1], 'c': [123.5, 132.3, 136.3, 164.3] + [np.nan]*4, 'd': [np.nan]*8, 'e': [np.nan]*7 + [2330.3], 'f': [np.nan]*4 + [2763.0, 2142.3, 2127.3, 2330.3], 'g': [2330.3] + [np.nan]*7, ...

c# - Sort by distance in Lucene.net Spatial 3.0.3 -

i have application in need search geo coordinates. index building fine, using pointvectorstragegy. i able search within circle point p = spatialcontext.makepoint(latitude, longitude); var circle = spatialcontext.makecircle(latitude, longitude, distanceutils.dist2degrees(distance, distanceutils.earth_equatorial_radius_mi)); var args = new spatialargs(spatialoperation.iswithin, circle); var filter = strategy.makefilter(args); var records = searcher.search(booleanquery, filter, data.page * pagesize, sort); the results fine, ordered in descending order, closest last. of now, using sort.relevance . does know how sort results on searching ? implement custom sorting ? there 1 ? if have code, appreciated. i have looked around bit , tried different things. have done , works following: sort = new sort(new sortfield("distance", sortfield.score, false)); true closest first, false otherwise.

sql - How to filter the max value and write to row? -

postgres 9.3.5, postgis 2.1.4. i have tow tables ( polygons , points ) in database. i want find out how many points in each polygon . there 0 points per polygon or more 200000. little hick following. my point table looks following: x y lan 10 11 en 10 11 fr 10 11 en 10 11 es 10 11 en - #just demonstration/clarification purposes 13 14 fr 13 14 fr 13 14 es - 15 16 ar 15 16 ar 15 16 ps i not want count number of points per polygon. want know occuring lan in each polygon. so, assuming each - indicates points falling new polygon, results following: polygon table: polygon count lan 1 3 en 2 2 fr 3 2 ar this got far. select count(*), count.language language, hexagons.gid hexagonswhere hexagonslan hexagons, points_count france st_within(count.geom, hexagons.geom) group language, hexagonswhere order hexagons desc; it gives me following: polygon ...

php - Show different database record every 24 hours -

i building simple app html5 , php , need show different quote every day. have database table 365 quotes , authors in it, can't seem find way show different database record every 24 hours. new programming , searched whole internet answer couldn't find similar this. so have html , php code connect database , show latest record. how can show user database row every 24 hours? this code looks now: <?php $con=mysql_connect('localhost','xxxx','xxxx'); if(!$con) { die ("failed connect: " . mysql_error() ) ; } mysql_select_db("xxxx",$con); $sql = "select * quotes limit 1" ; $mydata=mysql_query($sql,$con) ; while($record = mysql_fetch_array($mydata)) { echo "<h1>" . $record['quote'] . "</h1>"; echo "<br><p> - " . $record['author'] . " - </p>"; } mysql_close($con); ?> thanks in advance guys! add column ...

c# - Best way to provide params to a state transition in a FSM -

i'm in situation 1 of states in fsm needs information outside world job. information needs provided when transition requested. what's best way accomplish this? @ time i'm using fsm class blackboard share inforamtion between states. one dirty solution have information cached in fsm , fill before requesting transition , let state have fsm black board. don't it. my language c# cheers. to show meant passing delegate: class mystatemachine { private readonly func<string> askforname; public mystatemachine(func<string> askforname) { this.askforname = askforname; } // ... void statetransitionforactionx() { var name = askforname(); // ... } } public mystatemachine createmachine() { return new mystatemachine ( () => { console.writeline("please, enter name: "); return console.readline(); } ); } of course, can used data request whatsoever - using console seemed simp...

Forced to define Go struct for casting an unsafe.Pointer() to a C struct -

interoperating c code, not able directly cast structure , forced define equivalent 1 in go. c function libproc.h is int proc_pidinfo(int pid, int flavor, uint64_t arg, void *buffer, int buffersize) the c structure flavor==proc_pidtaskinfo proc_taskinfo defined in sys/proc_info.h (included libproc.h ): struct proc_taskinfo { uint64_t pti_virtual_size; /* virtual memory size (bytes) */ uint64_t pti_resident_size; /* resident memory size (bytes) */ uint64_t pti_total_user; /* total time */ uint64_t pti_total_system; uint64_t pti_threads_user; /* existing threads */ uint64_t pti_threads_system; int32_t pti_policy; /* default policy new threads */ int32_t pti_faults; /* number of page faults */ int32_t pti_pageins; /* number of actual pageins */ int32_t pti_cow_faults; /* number of copy-on-write faults */ int32_t pti_message...

actionscript 3 - how to change prompt size of textinput in flex? -

i have created spark text input component , prompt text in text input using prompt property. font size of prompt small. how change font size of prompt....? create skin host component textinput , set fontsize of label id "promptdisplay". , apply skin textinput

big o - Big O notation for a function with x=>0 -

how should represent function f(x)=2x+1 x->0 big o notation? with reasons please. (i think should written o(x) function seems grow faster constant function while 1 of classmate think should written o(1) .) big-o notation, in nutshell, tells performance of algorithm relative size of input. i.e. can use express "on small input, algorithm fast, double input size algorithm becomes 4 times slower..." . your algorithm's performance constant. doesn't iterate or multiples increased size of input. beyond implementation minutiae optimisation, return result in same amount of time. so it's o(1). you cannot express value of result using big-o.

c# - How do I check for a network connection? -

what best way determine if there network connection available? you can check network connection in .net 2.0 using getisnetworkavailable() : system.net.networkinformation.networkinterface.getisnetworkavailable() to monitor changes in ip address or changes in network availability use events networkchange class: system.net.networkinformation.networkchange.networkavailabilitychanged system.net.networkinformation.networkchange.networkaddresschanged