Posts

Showing posts from June, 2012

php - Issue with code used to pull data from posts in wordpress -

a developer of ours wrote template code wordpress , when particular template applied wordpress page takes wording , presents on end-user page in tidy fashion. at minute, script can display 1 'press release' per month, display multiple per month cannot so. a clear screenshot of issue can found here http://i.stack.imgur.com/tqtld.png <?php /* template name: press releases (beta) */ ?> <?php get_header(); $press_releases = getpressreleases($post->post_content); ?> <div class="container rayures"> <?php require('search_bar.php'); ?> <ol class="breadcrumb"> <li><a href="<?php echo get_site_url(); ?>">home</a></li> <li><!--[if lt ie 8]>&nbsp;/&nbsp;<![endif]--><a href="#">news</a></li> <li><!--[if lt ie 8]>&nbsp;/&nbsp;<![endif]--><a href="#">press releases<...

javascript - JQuery Wildcard ID Selector With Class -

i need create jquery selector select elements id starting newinstruction , class of .individualinstruction . this should match divs id newinstruction0 , newinstruction1 , etc. i can separately this: $('[id^="newinstruction"]') and $('.individualinstruction') however, i'm getting syntax errors when try combine them. simple, there jquery guru out there can point out did wrong? combine them no space like $('[id^="newinstruction"].individualinstruction') document.write($('[id^="newinstruction"].individualinstruction').length); <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.10.1/jquery.min.js"></script> <div id="newinstruction1" class="individualinstruction"></div> <div id="newinstruction2" class="individualinstruction"></div> <div id="newinstruction3" class="individualinst...

html - page break after creating certain charts using JQuery -

i going generate several charts, first page should have header , first 8 charts, how can page break after 8th chart , go second page not have header. each student have data record containing several subjects , scores therefore each report has several charts each subjects. var counter = 1; $.get('/rest/report/' + id, function (data) { data.subjects.foreach(function (subject, idx) { console.log(idx); var container = $('<div class="one-chart"></div>')[0]; if (counter < 8) { $('.charts-container').last().append(container); renderonechart(container, subject.name, subject.scores); counter++; } }); }); $('body').append('<div class="page" ></div>'); }); i think may able target every eighth chart, , use page-break-after: always ensure page break. for instance, if...

Bridge subdomains in Mikrotik -

can give me mikrotik 101 lecture on bridging multiple subdomains computer 192.168.1.* subdomain access shared resource on 192.168.2.*. subdomain? i have tried number of tutorials, in addition trial , error methods, no avail.thanks in advance. it looks don't want bridge, route networks 192.168.1.0/24 , 192.168.2.0/24. consider following computer a: 192.168.1.1/24 connected mikrotik/ether1/ip:192.168.1.254/24 computer b: 192.168.2.1/24 connected mikrotik/ether2/ip:192.168.2.254/24 if add following routes: on computer (windows syntax, need elevation on latest windows): route add 192.168.2.0 mask 255.255.255.0 192.168.1.254 on computer b (windows syntax, need elevation on latest windows): route add 192.168.1.0 mask 255.255.255.0 192.168.2.254 then , b able communicate (ping, access ressources, etc.).

c# - Double-click event fires at window level and control level, even when it is handled within the control -

i working on wpf application have window level double-click event maximizes app window when user double-clicks anywhere within window. however, have custom control within app window, , separate double-click event within custom control. when user double-clicks in custom control, control's double-click event should fire, , window should not resize. code looks this: public class window { private void window_doubleclick(object sender, eventargs e) { /// maximize/minimize window } private void mycustomcontrol_doubleclick(object sender, eventargs e) { /// other things, please don't resize! e.handled = true; } } and xaml looks this: <window x:class="myproject.mywindow" mousedoubleclick="window_doubleclick"> <grid grid.row="0" margin="0"> <local:mycustomcontrol mousedoubleclick="mycustomcontrol_doubleclick"/> </grid> ...

java - Appropriate collection for model of JTable used for selection -

what best collection storing data in jtable's model (extending abstracttablemodel) if table contains check box selection in first column , object's attributes in other columns (so boolean attribute not part of domain object in row)? have now, suppose map or list serve better? edited: need mutable collection hold on pair of boolean/person, can retrieve persons boolean set true. public class tablemodelperson extends abstracttablemodel { private string columnname[] = {"yes/no", "first name", "last name"}; private object data[][] = { {true, new person("katy", "brown")}, {false, new person("sam", "brown")}, {true, new person("peter", "brown")} }; @override public int getrowcount() { return data.length; } @override public int getcolumncount() { return columnname.length; } @override public object getvaluea...

c# - Is exists check required before calling StringSet method of StrackExchange.Redis -

i using stackexchange.redis 1.0.450 nuget in c#. have code below checks if keyexists in redis before adding - if (!cache.keyexists(fkey)) { cache.stringset(fkey, serialize(data)); } where cache database object i reading redis set command here http://redis.io/commands/set , found set overwrite existing key value if exists. using stackexchange.redis can safely remove exist check condition , call - cache.stringset(fkey, serialize(data)); appreciate response. yes, can savely remove that. don't check existence lead have 2 access points cache 1 necessary. slow down cache access. you may want consider 3 other things: you may have make set action repeatable in case redis cache not available in moment of access. you may have make initialization of connection repeatable please refer buffer redis stream how make (de)serialization of redis cache entries reliable , fast.

java - JCheckBox not appearing -

Image
i have checked everwhere fix nothing can work make checkbox appear. added panel , added panel window. button appearing must problem checkbox. here code: import java.awt.borderlayout; import java.awt.dimension; import java.awt.point; import java.awt.toolkit; import java.awt.event.keyevent; import javax.swing.jbutton; import javax.swing.jcheckbox; import javax.swing.jframe; import javax.swing.jpanel; public class mainapplication { public static toolkit tk = toolkit.getdefaulttoolkit(); public static void main(string[] args) { mainapplication instance = new mainapplication(); instance.start(); } private jframe window; private jpanel mainpanel; private jpanel contingencypanel; private jbutton applybutton = new jbutton("apply changes"); private jcheckbox autoredlightbox = new jcheckbox("red light"); private jcheckbox autoyellowlightbox = new jcheckbox("yellow light"); private jcheckbox autogree...

Using crontab to make a influxdb backup every week -

so i'm wondering how can make cron job make influxdb backup every friday @ midnigth. in github sh file makes backup job, here link: influxdb backup-restore thanks. so use repo https://github.com/eckardt/influxdb-backup.sh , make crontab job make periodic backup.

c# - Unity 3D scripts move multiple objects -

i have problem. i'm doing project in unity 3d (c#), 3d worlds editor. problem want move multiple objects selecting them. managed move 1 mouse cursor, multiple failed :d code move 1 : public class clickanddrag : monobehaviour { private raycasthit raycasthit; private gameobject gobj; private float distance; private vector3 objposition; private bool bobj; // use initialization void start() { } // update called once per frame void update() { if (input.getmousebutton (0)) { var ray = getcomponent<camera> ().screenpointtoray (input.mouseposition); var hit = physics.raycast (ray.origin, ray.direction, out raycasthit); if (hit && !bobj) { gobj = raycasthit.collider.gameobject; distance = raycasthit.distance; debug.log (gobj.name); } bobj = true; objposition = ray.origin + distance * ray.direction; ...

c++ - How does boost::subgraph work? Can we use filtered graph? -

i use boost::subgraph, , wanted know how works. graph g; add_vertex(a, g); add_vertex(b, g); add_vertex(c, g); add_edge(a, b, g); add_edge(a, c, g); add_edge(c, b, g); graph &g0 = g.createsubgraph(); add_vertex(a, g0); add_vertex(b, g0); what memory cost of g0? guess g0 has store vertices added g0. g0 need store edges on g0. when traversing g0, traverse on g? each edge, need check if target node on g0. if not, skip node. have additional check cost. how works? boost has filtered graph http://www.boost.org/doc/libs/1_55_0/libs/graph/doc/filtered_graph.html how o decide using subgraph or filtered graph? thank you, your problem reference c++ problem , has nothing boost graph. you can not create unbound reference (and cannot rebind either. assignment assigns the object referred to. so in principle had, fixed: graph g; add_vertex(a, g); add_vertex(b, g); add_vertex(c, g); add_edge(a, b, g); add_edge(a, c, g); add_edge(c, b, g); graph& g0 = g.crea...

Installing Spring Cloud Services for Cloudfoundry without OpsManager -

i've installed cloudfoundry on local machine described here , i'd install spring cloud services well. don't know find opsmanager , doubt if deployed @ all. question - possible install spring cloud services without using opsmanager , if so, how achieve it? thanks in advance! i'm pm spring cloud services. the spring cloud services product supported on pivotal cloud foundry installation, , depends on other pivotal commercial products. if you'd consume spring cloud on oss cloud foundry deployment, you'll need create spring boot applications server-side components described in spring cloud oss docs ( http://projects.spring.io/spring-cloud/spring-cloud.html ). example of github project can found here: https://github.com/spring-cloud-samples/fortune-teller .

android wear - Does Wearable.DataApi.getDataItems users UriMatcher -

i'm trying extract data wearable.dataapi matches wear:/someattr/* the motivation i'm using putdatarequest.createwithautoappendedid since want avoid overriding data written in wearable device. i match following uri: wear:/someattr/3/rand1 wear:/someattr/2/rand2 wear:/someattr/3/rand6 but avoid wear:/someotherattr/3/rand1 can use wildcard data dataapi ? i have current workaround of not providing uri wearable.dataapi.getdataitems brings data includes unwanted dataitems wish avoid. any ideas? i found solution in similar question @dzeikei from android official documentation int filter_prefix filter type getdataitems(googleapiclient, uri, int), deletedataitems(googleapiclient, uri, int): if filter set, given uri taken path prefix, , operation apply matching items. so in order match example use uri.builder builder = new uri.builder(); builder.scheme(putdatarequest.wear_uri_scheme).path("someattr"); uri uri = builder.bu...

python - Efficient way to generate nested html sitemap in django with lower SQL queries -

it common use recursive method , trivial answer. make queries as count of pages. there way create such html sitemaps lower queries? def rec_print_childs(page): print "<ul>" child in page.childs: # childs related_name in page module parent field print "<li>"+child.name rec_print_childs(child) print "</li>" print "</ul>" rec_print_childs(parent_node)

c - How to make a function return a pointer to array struct -

i'm working on function in c should return pointer array struct. struct is struct corr{ char nome[128]; char cognome[128]; char password[10]; float importo; }; typedef struct corr correntista; the function return pointer struct is correntista *max_prelievo(file *fcorrentisti, file *fprelievi){ correntista *corr_max[2]; corr_max[0] = (correntista *)malloc(sizeof(correntista)); corr_max[1] = (correntista *)malloc(sizeof(correntista)); /*.........*/ return *corr_max; } in main program want print returned value in following way: *c_max = max_prelievo(fc, fp); printf("correntista con max prelievi:\n"); printf("nome: %s\n", c_max[0]->nome); printf("cognome: %s\n", c_max[0]->cognome); printf("max prelievo: %f\n\n", c_max[0]->importo); printf("correntista con max versamenti:\n"); printf("nome: %s\n", c_max[1]->nome); printf("cognome: %s\n", c_max[1]->cognome); pri...

osx - How can I determine the Printer Total Page Count on Mac? -

i want know how many pages have printed using mac , brother hl-1110 printer. something this on mac. is there way that? i have fount this solution involves lpstat , shows printed jobs not total count. thanks. while printer on, press power button 3 times continues. printer status page. note total page count while replacing new toner. when toner finished, again take printer settings page. actual pages printed replaced catridge subtracting old count new count.

Cannot replace keyword using PHP Regex -

i want replace 'keyword' in <img ..keyword.. /> using php regular expressions. $content = '&lt;img alt="hello" src="http://frbird.qiniudn.com/topic/150609/5576a8837fd32e3b4ece5f6b-hd.jpg"&gt;'; $content = preg_replace('/(&lt;img\s(?!&gt;)*?)(hello)((?!&gt;)*&gt;)/u', '$1%&&&&&%$3', $content); i can't replace 'hello'. please tell me wrong. first translate &lt; , &gt; tokens source string < , > . way far easier handle. preg_replace() , translate them again in target string. $src= strtr('&lt;img alt="hello" src="http://frbird.qiniudn.com/topic/150609/5576a8837fd32e3b4ece5f6b-hd.jpg"&gt;',array('&lt;'=>'<','&gt;'=>'>')); $trg = strtr(preg_replace('/(<img[^>]*")(hello)(".*)/', '$1xxxxx$3', $src),array('<'=>...

c# - Is it possible to send a message not to all observers using .net Rx? -

i have situation there observable , let's 10 observers attached it. send message each new observer until observer somehow says observable recognizes message , process it. @ moment stop sending message other observers. in other words each observer knows how process particular type of message , each 1 take , process message recognizes. others don't need receive after 1 recognizes started processing. how situation implemented reactive extensions? assume need sort of notification observable don't see how can done. this came with. comments, ideas, suggestions , critics welcome. interesting part iobserver<tvalue, tresult> public interface exists in rx library it's used in notification object. did, created iobservable<tvalue, tresult> counterpart, selectivesubject take care of logic call observers until 1 of them returns true , toselective method extension. i'm surprised not done in library, @ least iobservable<tvalue, tresult> part. aft...

Decoding Hash from JSON-String in Perl -

why not work? my $myhashencoded = encode_json \%myhash; %myhashdecoded = decode_json($myhashencoded); i error: reference found even-sized list expected @ ... so changed to: my $myhashencoded = encode_json \%myhash; $myhashdecoded = decode_json($enableinputencoded); but %myhash not same $myhashdecoded . how restore proper hash json string? assuming using json.pm, the documentation says : the opposite of encode_json: expects utf-8 (binary) string , tries parse utf-8 encoded json text, returning resulting reference . so getting put in. you're putting in hashref , you're getting hashref back. if want regular hash, dereference other hashref: my $myhashrefdecoded = decode_json($myhashencoded); %myhashdecoded = %$myhashrefdecoded;

scala - Futures in For comprehension. Detect failure -

i'm using scala's comprehension wait until several futures executed. want handle onfailure (i want write error message log). how can achieve it? this code: val f1 = future {...} val f2 = future {...} { res1 <- f1 res2 <- f2 } { // means both futures executed process(res1, res2) } if want write error message log file can chain error logging onto onfailure part: val f1 = future.successful("test") val f2 = future.failed(new exception("failed")) def errorlogging(whichfuture: string): partialfunction[throwable, unit] = { // here have option of matching on different exceptions , logging different things case ex: exception => // more sophisticated logging :) println(whichfuture +": "+ ex.getmessage) } f1.onfailure(errorlogging("f1")) f2.onfailure(errorlogging("f2")) val res = { res1 <- f1 res2 <- f2 } yield { // means both futures executed println(res1 + res2) } aw...

ios - Cocoapods generate bad xcconfig file - no header search path -

i'm facing problem, of libraries not found in project, , figured out pods.debug.xcconfig file not contains header search path that's reason of this, don't know why , how can solve problem. podfile looks this: platform :ios, '8.0' use_frameworks! target 'project' pod 'fbsdkcorekit', '~> 4.2' pod 'fbsdkloginkit', '~> 4.2' pod 'jsonhelper', '~> 1.6' end and xcconfig file this: framework_search_paths = $(inherited) "$pods_framework_build_path" gcc_preprocessor_definitions = $(inherited) cocoapods=1 ld_runpath_search_paths = $(inherited) '@executable_path/frameworks' '@loader_path/frameworks' other_cflags = $(inherited) -iquote "$pods_framework_build_path/bolts.framework/headers" -iquote "$pods_framework_build_path/fbsdkcorekit.framework/headers" -iquote "$pods_framework_build_path/fbsdkloginkit.framework/headers" -iquote "$p...

How to load own font from CSS file into JavaFX application (I'm using now JDK 8u45) -

when used jdk 8u11 see in application text in own font. when upgraded java jdk 8u45 see font wasn't loaded. can't see warning in console in eclipse (i'm using luna). used css, not working. @font-face { font-family: 'my-font'; src: url('../font/my-font.otf'); } can me?

osx - How do I save data to the clipboard on MacOSX in C -

this question has answer here: manipulate clipboard in c on mac os x 1 answer i'm attempting work around nasty problem involves being locked down in cups printing service filter. application unable write outside of it's domain filter program. & wanted give saving string clipboard go, out of program , readable another. exchange happen user won't know occurred. so way write xdata x clipboard on osx in c? mike as far can tell, os x provides interface clipboard functions in objective c, not plain c. however, can open pipe pbcopy command line utility follows: #include <stdio.h> int main() { file *p = popen("/usr/bin/pbcopy","w"); fprintf(p,"hello world"); /* << copy clipboard */ pclose(p); return 0; }

is there a way to find all the perforce workspaces which are mapping a certain file in the depot? -

i have file on perforce depot , when updating automated script want find workspaces mapping file (with p4 command) , send emails owners of these workspaces (file containing latest view spec of project , recipients of email should notifications can update view spec ) providing none of workspaces want @ using 'host' field, can run: p4 -c have to list of files synced on client. note first involve getting list of workspaces on server, running: p4 clients also may quite resource intensive, if server has lot of clients sync lot of files, recommend using perforce review daemon or perforce swarm code review , notification. more details these available here: http://www.perforce.com/perforce/doc.current/manuals/p4sag/chapter.scripting.html http://www.perforce.com/collaboration hope helps, jen.

linux - Start PHP script before file upload completes -

our apache/php server accepts large-ish file uploads , once gets file behind scenes db calls can take upwards of 300ms. is there way can php processing, db calls before file uploaded? once file uploaded continue , wrap up? i know file part of http request body , apache won't kick off php process until it's complete. however, i'm thinking there may way apache kick off process @ start of request or something...

arrays - Moving rows from spreadsheets to new documents based on owner name with filling information in document -

i have spreadsheet named project log have 6 columns, timestamp task owner date keywords email here have different owners. need create document owner name , move particular owner row owner document. i able looping had issue when duplicate names creating document , sending data per requirement need have 1 document on particular owner , move duplicate owner name owner itself. example of owner column. joe john john here need create document "joe" name , append body whole row have 2 "john"s need create 1 document i.e., "john" , move 2 rows single document if find more on name should able send row particular owner document. and looping code is: function createdocfromsheet() { var ss = spreadsheetapp.getactivespreadsheet(); var sheet = ss.setactivesheet(ss.getsheets()[2]); var numrows=ss.getlastrow(); var values = ss.getdatarange().getvalues() for(n=2;n<=values.length;++n) { var cell = sheet....

How make a list in the Info Window of a Fusion Map from a comma separated list? -

Image
can cell comma separated information turned list? i've got uneven amounts of data (companies) , have display basic list when flag clicked on in fusion map. say have: location: seminole county, fl companies: acme co, box inc, cogs llc ------ location: orange county, fl companies: acme co, dirt inc, shell co on map should 2 flags, is. how can have companies displayed basic list? i can go record , change contain html: companies:<ul><li>acme co</li><li>box inc</li><li>shell co</li></ul but that's pretty clunky. there way template custom info window automate this: i looked online couldn't find , fusion user group says ask here. edit: based on first answer, rows: resulting problem: if format companies values json lists, can loop on them closure templates. latter described in help page , though looping constructs not documented. first, go edit > change columns , set format of companies j...

javascript - MouseOver with Cursor Pointer on Y Axis -

the following implementation shows mouseover event cursor pointer on y axis title label. works , functional. however, want implement mouseover event cursor pointer on y axis (numeric axis) well. current implementation you can apply same color trick axis labels: valueaxis: { labels: { format: "n0", color: "rgba(60,60,60, 0.9995)" }, $(document).on("mouseover", '#chart text[fill="rgba(60,60,60, 0.9995)"]', function(){ $('#chart text[fill="rgba(60,60,60, 0.9995)"]').css("cursor", "pointer"); }); updated demo in example use same color title , labels, use different color

javascript - Implementing tool tips -

i've reviewed docs on imagemapster's web site, numerous posts here, can't tooltips work properly. tried posting html , js on jsfiddle.com unable work properly, here's link sample map http://www.teenspanish.com/imagemap/ . it's simple idea, once map functioning can apply appropriate code real project. 1) hover effects work fine, no concern there. 2) there div under map intended hidden when page loads, visible. move mouse on 1 of hotspots replaced appropriate text, , point on map seems function properly. so, there must missing or incorrect in code regulates onmouseover , onmouseout effects. 3) there way position tooltips on map (hotspots) itself, tooltips do? is, text appears inside div under map, i'd prefer have positioned on hotspots. i have no problem css, have virtually no experience working js, don't know start. sample created various samples i'm come across since stumbling on imagemapster. if review code , let me know what's wrong app...

javascript - Scroll in 100% steps inside div -

i have div contains several children 100% height. on scrolling want go down or height of 1 child, 100%. unfortunately can't figure out how prevent scrolling multiple steps @ time. tried event.preventdefault() , using timeouts, none worked yet. check out fiddle see i've got far - , issue exactly. $container = $('#container'); var doscroll = true; var top = 0; $container.on("scroll", function(event){ event.preventdefault(); if (doscroll) { doscroll = false; top += $container.height(); console.log("scroll event fired"); $container.animate({scrolltop: top}, '700', 'swing', function() { doscroll = true; }); } }); #container { height: 500px; width: 300px; overflow-y: auto; overflow-x: hidden; } .child { height: 100%; width: 100%; } .red { background-color: red; } .blue { background-color: blue; } <script src="https://ajax.googleapis.com/...

javascript - message not shown when page is maximized.just shown when resized -

i have hidden message should shown when hit radiobox.but showing when resize page in smaller here s message , javascript code: <script type="text/javascript"> $(document).ready(function () { $(".whathappened [type=radio]").change(function () { var selval = $('input:radio[name=losstype]:checked').val(); if (selval == "tow_dispatchdisabledvehicle") $('#ersmessage').show(); else $('#ersmessage').hide(); }); }); </script> and message: <div id="ersmessage" style="display:none"> <div class="hidedesktop"> <br/> <br/> error message ........ <ul> <li>call...

javascript - Ajax query string not being posted to ASP.NET controller -

i have ajax function: updateficonfig: function ($appform) { var valid = $appform.valid(); //if not valid validate plugin take care of errors if (valid) { $appform.serialize(); $.ajax({ url: '/identificonfig/defaultconfiguration/updateficonfig', data: $appform, datatype: 'application/json', cache: false, type: 'post', success: function (data) { if (data.error) { cc.jqutils.opendialog(data.errordescription, 'error', 'ok', null, null, null); } else { window.location.href = '/identificonfig/defaultconfiguration'; } } }); } }, which serializes data sent view query string. know data serialized correctly because have viewed string console.log($appform) , , it's correct. however, controller never receives query string. ha...

apache - mod_rewrite with three parameters -

my url: localhost/categories?dpt=mq==&ctg=mq==&nls=mw== i want so: localhost/product-a/departure-a/categories-a/ my htaccess: <ifmodule mod_rewrite.c> rewriterule ^confirmation/?$ confirmation.php [nc,l] rewritecond %{request_filename} !-d rewritecond %{request_filename} !-f rewriterule ^/?([^/]+)/?$ products.php?pdt2=$1 [qsa,nc,l] rewriterule ^/?categories/([^/]+)/?$ categories.php?dpt=$1&ctg=$2&nls=$3 [qsa,nc,l] </ifmodule> but not. wrong? this version of .htaccess comments inside: <ifmodule mod_rewrite.c> # stop rewrite if matches existing file or directory rewritecond %{request_filename} !-d rewritecond %{request_filename} !-f rewriterule .* - [l] # redirect trailing slash rewriterule ^(.+)/$ /$1 [r=301,l,qsa,ne] # confirmation rewriterule ^confirmation$ /confirmation.php [l] # match except slash product rewriterule ^([^/]+)$ /products.php?pdt2=$1 [qsa,l] # match cate...

Create a draw() function inside other function in Javascript Processing -

ok, have piece of code: var = 0; var left = random(width); var right = left +50; var pos = left; var isleft = true; var draw= function() { background(255, 0, 0); fill(255, 0, 0); strokeweight(2); stroke(255, 255, 255); ellipse(pos,400-a,10,10); a=a+0.5; if (isleft === true) { pos +=0.5; } if (pos === right) { isleft = false; } if (isleft === false) { pos -=0.5; } if (pos === left) { isleft = true; } }; basically create bubble floats upwards while moving left , right little bit. idea make happens/starts when click mouse. don't seem know how. still learning how code. can me produce desired effect. thanks , sorry bad english. if want happen if click anywhere example should work you: document.body.addeventlistener("click", draw, false);

c# - Entity Framewrok Code First: Can not rename FK in optional 1:1 relationship -

consider following parent/child model: public class parent { public int id { get; set; } public virtual child mychild { get; set; } } public class child { public int id { get; set; } public int? pid { get; set; } [foreignkey("pid")] public virtual parent myparent { get; set; } } and context: class context : dbcontext { public dbset<one_to_one.case1.child> child { get; set; } public dbset<one_to_one.case1.parent> parent { get; set; } protected override void onmodelcreating(dbmodelbuilder modelbuilder) { base.onmodelcreating(modelbuilder); modelbuilder.entity<parent>() .hasoptional(p => p.mychild) .withoptionalprincipal(p => p.myparent); } } it generates table schema: create table [dbo].[children] ( [id] int identity (1, 1) not null, [myparent_id] int null, constraint [pk_dbo.children] primary...

jquery - DataTables ASP.Net timeout issue -

we using datatables asp.net mvc , identity framework. have set authentication timeout 1 minute using code below: public partial class startup { public void configureauth(iappbuilder app) { ... app.usecookieauthentication(new cookieauthenticationoptions { expiretimespan = system.timespan.fromminutes(1), provider = new cookieauthenticationprovider { ... }); i login , go page datatable , wait timeout. error occurs if timeout expires , datatable tries hit server. datatable works making ajax request server , error comes from. the error javascript error: datatables warning: table id=datatables_table_0 - invalid json response. more information error, please see http://datatables.net/tn/1 i need handle gracefully , redirect user login page. can please? you can use application_error event handler in global.asax file. add the: protected void application_error(object sender, e...

angularjs xeditable and angularjs ui-tinymce together in an editable form -

is way make textarea ui-tinymce part of , editable-form?. found workaround making ng-model of editable-textarea , textarea ui-tinymce same , hide editable-textarea. <form onaftersave="onsave({$data:$data})" editable-form name="forms.{{formname}}" > <textarea ui-tinymce="tinymceoptions" name="desccomp" ng-model="item.desccomp"> </textarea> <div e-ng-show="false" editable-textarea="item.desccomp" e-name="desccomp" > </div> </form> actually, tinymce has inline abilities https://www.tinymce.com/docs/demo/inline/ i'm facing same issue , thinking i'm gonna use tinymce (with angular-ui-tinymce) leaving xeditable case).

Is HTML5 drag and drop compatible with Chrome Apps (packaged)? -

i've tried traditional methods , works webpage in chrome, not when i'm using page packaged app. i'm doing example w3 testing purposes since it's simple. http://www.w3schools.com/html/html5_draganddrop.asp i able work utilizing -webkit-user-drag css property on element (in case image). allowed dragging in app window itself. img { -webkit-user-drag: auto; } i put event listeners other javascript functions (inline javascript not allowed in chrome apps) can seen @ w3 link in description. now drag , drop acts on regular webpage.

Error Injecting endpoint into a bean in Camel -

i have bean defined annotation.i tried using camelbeanpostprocessor camelcontext null. public class helloworld { @endpointinject(uri="direct:copy") private producertemplate template; public final void speak(exchange e) { template.sendbody("a new message"); } public producertemplate gettemplate() { return template; } public void settemplate(producertemplate template) { this.template = template; } } there quite lot of ways of achieving this. bean processor, can implement processor , have access entire exchange, , of course camelcontext well: public class helloworld implements processor { public void process(exchange exchange) throws exception { context = exchange.getcontext() } }

c# - Apply style on Content Control in a Word Document using OpenXML -

Image
i'm trying generate word documents using openxml sdk , word document generator . need apply custom style on contentcontrols (repeating section). for recursive placeholders, use foreach (var item in list) { var datacontext = new openxmlelementdatacontext() { element = openxmlelementdatacontext.element, datacontext = item.value }; var clonedelement = cloneelementandsetcontentinplaceholders(datacontext); setcontentofcontentcontrol(clonedelement, item.value); } openxmlelementdatacontext.element.remove(); i need apply style on element. how can ? i try see generated code "open xml sdk 2.5 productivity tool microsoft office" inspire me: var moduledatacontext = new openxmlelementdatacontext() { element = openxmlelementdatacontext.element, datacontext = module.valeur }; var moduleclonedelement = cloneelementandsetcontentinplaceholders(moduledatacontext); var sdtproperties1 = new sdtproperties(); var styleid1 = new styleid...

sql - How do I aggregate 3 columns that are different with MIN(DATE)? -

Image
i'm facing simple problem here can't solve, have query: select min(tea_iniciotarefa), pfj_id_analista, atc_id, srv_id dbo.tarefaetapaareatecnica inner join tarefa t on t.trf_id = tarefaetapaareatecnica.trf_id srv_id = 88 group srv_id, atc_id, pfj_id_analista order atc_id asc it returns me this: i able group little group srv_id, atc_id, pfj_id_analista gave me these 8 records, can see pfj_id_analista different. what want select date of each srv_id , atc_id, pfj_id_analista don't need grup, if remove pfj_id_analista grouping query works, need column. for eg.: between row number 2 , 3 want date, row 2. same goes rows 5 8, want row 6. ddl tarefaetapaareatecnica (important key: trf_id) create table [dbo].[tarefaetapaareatecnica]( [tea_id] [int] identity(1,1) not null, **[trf_id] [int] not null,** [ets_id] [int] not null, [atc_id] [int] not null, [t...

Javascript Regex "ends with" vs "does not end with" -

the following javascript renders boolean each statement's right: var reg = new regexp(/^[\w\/].*result\b/); console.log(reg.test('pathtofiletest')); -> false console.log(reg.test('path/to/file/test')); -> false console.log(reg.test('/path/to/file//test/result')); -> true console.log(reg.test('/path/to/file/not_a_test$#%$5724')); -> false which great! that's want. want invert ending statement. want other strings do not end in result true, while statement does end in result false. but, can't negate statement. i've tried: ^[\w\/].*^result\b ^[\w\/].*(?!result\b) ^[\w\/].*^(?!result\b) ^[\w\/].^(result\b) among ton of others. missing? application curious the reason i'm asking because i'm using express nodejs. call router.get('/pathstring', function (req, res, next) { //code } the pathstring regex expression. not true or false. something should work ^(?!.*result$).*$ https://r...

Pass string with ampersand (&) from iOS to PHP/MySQL with NSURLSession -

i'm passing large set of strings server ios (swift) php file via post. unfortunately, if user places ampersand (&) in field, rest of field lost. understand why (& signifies next field in message) i'm not sure how fix. func uploadtosql(plan: lessonplan, isnew: bool, callback: ((data: nsdata!, response: nsurlresponse!, error: nserror!) -> void)?) { let url = nsurl(string: "https://myserver.com/receive.php")! var request:nsmutableurlrequest = nsmutableurlrequest(url:url) var bodydata = "author=\(plan.author)&title=\(plan.title)&grade=\(plan.grade)&date=\"\(plan.date)\"&element1=\(plan.element1)&objective1=\(convertedfields[0])&element2=\(plan.element2)&objective2=\(convertedfields[1])&element3=\(plan.element3)&objective3=\(convertedfields[2])&coreprocess1=\(plan.coreprocess1)&corestrand1=\(plan.corestrand1)&corestandard1=\(plan.corestandard1)&coreprocess2=\(plan.coreprocess2...

Python dict inside list doesn't append -

this code. # lista de usuarios userlist = [] userdic = {} userlistquery = userprofile.objects.all() print "printing query " + userlistquery user in range(0,len(userlistquery)): userdic['username'] = userlistquery[user].user.get_username() userdic['titulo'] = userlistquery[user].titulo userdic['descripcion'] = userlistquery[user].descripcion[:60] userlist.append(userdic) print "printing list " + userlist print "printing list 0 " + userlist[0] i want userlist dict list. mean, if print userlist[0]['username'], has return me username in position 0. well, i've many users. use append , i'm adding user list. it's not working well, overwrites user resulting in 1 position list, last user userlistquery. help? the issue here is, same userdic object gets used in each loop, each time userdic['username'] gets overwritten new value. prevent must create new userdic every time. foll...

C program Strings Example how come the result is 98? -

c program strings example how come result 98? #include <stdio.h> int main() { char s[]="%d%d%d"; int a=9,b=8,c=5; printf(s+2,a,b,c); return 0; } string + x operation called pointer arithmetic . way providing reference mathematically calculated memory area , semantics equivalent &string[x] happens behind calculation: (&string + (x * sizeof(*string))) why specific notion when applied pointers. stands arrays decay pointer first element after all. as code, have following string: char s[]="%d%d%d"; and passed format string printf, 2 bytes afterwards, explicitly provides reference "%d%d" therefore this: printf(s+2,a,b,c); is later parsed as: printf("%d%d",a,b,c); printf except 2 integers read , 3rd 1 - ignored.

php - regex in preg_match_all() doesn't work as expected -

i have following string: "<h2>define vim greatest</h2> word processor, <h3>vi</h3>!". i want select h2 , h3 following structure regex. expected output be: array( 0 => <h2>define vim greatviest</h2> 1 => <h3>vi</h3> ) so implement regular expression follow: preg_match_all("/(?:<h2>|<h3>).*vi.*(?:<\/h2>|<\/h3>)/i", $input, $matches) but instead of desirable result above, outputs following result. current output: array( 0 => <h2>define vim greatviest</h2> word prviocessor ever created <h3>vi</h3> ) how can change code/regex, tags in expected output above? well problem is, first missing delimiters regex , second vi case-sensitive, have add i flag , case-insensitivity. so code (just removed vi in regex , grab between h1-6 tags): <?php $input = '"<h2>define vim greatest</h2> word ...

javascript - Moving each blog date to bottom of excerpt -

on site homepage, there grid section 2 latest blog posts. need javascript move date bottom of each block (outside of border). link is: http://abundancepractice-building.flywheelsites.com here structure: <div class="et_pb_column et_pb_column_4_4"> <div class="et_pb_blog_grid_wrapper"> <div class="et_pb_blog_grid clearfix et_pb_bg_layout_light blog-section" style="position: relative; height: 400px;"> <article id="post-226" class="et_pb_post et_pb_no_thumb post-226 post type-post status-publish format-standard hentry category-uncategorized" style="position: absolute; left: 0px; top: 0px;"> <h2><a href="http://abundancepractice-building.flywheelsites.com/what-you-learned-in-grad-school-is-ruining-your-website-and-10-ways-to-fix-it/">what learned in grad school ruining website (and 10 ways fix it)</a></h2> <p class="post-...

php - How can I group my array into groups of 3 elements, sort them by the last element and display the elements? -

i'm trying display array in groups of 3 elements, sorted last element of each group. my array: $info = array('goal','raul','80','foul','moneer','20','offside','ronaldo','60'); my expected output is: 1-foul moneer 20 2-offside ronaldo 60 3-goal raul 80 sorted last value of element groups. i'm using foreach display it: $i = 0; foreach($info $key => $val) { $i++; echo $info[$key] . '<br>'; if ($i % 3 == 0){ echo "<br />"; } is possible ? , if yes, how can change code expected output? this should work you: first array_chunk() array chunks of 3 elements, array have structure: array ( [0] => array ( [0] => goal [1] => raul [2] => 80 ) [1] => array ( [0] => foul [1] => moneer [2] => 20 ) [...

wpf - How to prevent a memory leak when displaying an image by binding to a bytearray? -

i have large treeview full of textboxes, each tooltip containing unique image. image stored in property bytearray , bind it. every time new tooltip displayed more memory used. i scaling image, doesn't address root of problem. if there way free memory used after tooltip no longer displayed? <textblock.tooltip> <stackpanel> <image maxwidth="650" maxheight="400" source="{binding imageasbytearray}"/> <textblock text="{binding filepath, stringformat='full path: {0}'}" /> </stackpanel> </textblock.tooltip> the tooltip can set framework element, dynamically create object behind scenes: <textblock tooltip={binding tooltip} /> then view model or code behind dynamically create object , handle loaded/unloaded event capture when tooltip displays. i've done below canvas case want add other children besides image: var tool...

C++ Pass a string into a pipe to gnuplot -

i'm having small problem passing string gnuplot c++ can pass integers enough, when try string (user defined "title" earlier in code): fprintf(gnuplotpipe, "set title %s\n", title); i error: error: cannot pass objects of non-trivially-copyable type ‘std::string {aka class std::basic_string<char>}’ through ‘...’ so instead tried using: fprintf(gnuplotpipe, "set title %s\n", title.c_str()); and code compiled, when ran got error gnuplot: line 0: undefined variable: h where "h" test sting defined "title". does have ideas on how pass this? thanks in advance! you have put title in quotes: fprintf(gnuplotpipe, "set title \"%s\"\n", title.c_str());

reactjs - React animation / ReactCSSTransitionGroup -

how make following link - spinner - work reactjs http://codepen.io/awesome/pen/zngwr i using webpack: { test: /\.css$/, loader: "style-loader!css-loader" } i know css working other settings. i have tried following, using same css file(copy paste local css ). updated: "return" element, did not write in here. felix kling, noting this. es6: render(){ return <reactcsstransitiongroup transitionname="spinner" > <div key='test' classname="spinner"></div> </reactcsstransitiongroup> } or render(){ return <div key='test' classname="spinner"></div> } this(both) gives me circle , no animation. since asked in comments answer... i believe problem copying on uncompiled scss instead of compiled css. hope helps! :d

jenkins - Inject passwords to the build as environment variables -

i trying set password in jenkins through option in 'build environments' section can used in test password , use it. option checking in "inject passwords build environment variables". problem loosing these values once seed job runs. values added disappearing after seed job runs. did faced problem? how make permanent every time can retrieve pwds in test code? after running seed job, manual changes generated job lost. that's intended behavior of job dsl plugin. to use passwords in job dsl generated job, use credentials plugin store password (or secret) in jenkins. use credentials binding plugin map password environment variable in job. have @ job dsl wiki example .

c# - I can't manage to save my serialized .json in wp8.1 -

i'm attempting write .json file in c# using json.net, can't manage save actual file. current code: list<article> bm = new list<article>(); bm.add(new article() { id = movieid2.text, name = title.text, imagepath = image.text, year = year.text }); string json = jsonconvert.serializeobject(bm.toarray()); system.io.file.writealltext("bookmarks.json", json); but told file class doesn't exist (yet have declared system.io, , msdn confirms windows phone 8.1 supports class: https://msdn.microsoft.com/en-us/library/system.io.file(v=vs.110).aspx ) i have tried various other things, nothing works :/

PHP Saving and outputting GD Lib image - relative and absolute paths -

i have php script generates image using gd lib, saves predefined location. , should output it. my directory structure this: www.example.com/projects/project-1/ inside project-1 directory have these directories: - /imgs/ - /js/ - /css/ - /php/ the script using gd lib in /php/ config.php script constants defined. included in main script. say have 2 constants: define('save_path', '/projects/project-1/imgs/'); //the image not save - not work define('output_path', '/projects/project-1/imgs/'); //this works if there image in location i save image so: imagejpeg($im, save_path.$name, 100); i following error: failed open stream: no such file or directory in /public_html/projects/project-1/php/main.php is possible 1 constant works both saving , outputting? i know can't have absolute save path like: http://www.example.com/projects/project-1/imgs/ and know can't have absolute output path like: /public_html/projects/project-1...

vb.net - How to Select in between row's record from tables in SQL 2008? -

this question has answer here: selecting specific row number in sql [duplicate] 2 answers i wonder, there option "skip"(from linq) in sql select particular rows in table. i mean, in table named "abcd". in table 300 rows there. 300 rows want select rows 233 300 or 233 258. how this?? please help. you can use cte or derived table this: with cte ( select col1, col2, row_number() over(order sortcolumn) rn table ) select * cte rn >= 233 , rn <= 258

javascript - Increase bootstrap collapsed menu height ( when opened) -

Image
i have created basic site bootstrap. using bootstrap navbar, collapsed option smaller devices. i want increased height of ".collapsed navbar-collapsed" takes more space in page. i gladly show image illistrate problem better im not allowed post images on here yet. so pretty when view navigation bar on mobile device, looks great when collapsed menu closed. when click on 3 lined image open menu, shows 1 , half navigation page buttons. there way increase height can see 5 pages have there, if opened menu goes on jumbotron division below it? <nav class="navbar navbar-inverse"> <div class="container-fluid"> <div class="navbar-header"> <button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#mynavbar"> <span class="icon-bar"></span> <span class="icon-bar"></span> <span class...

jQuery select or hide deeply nested div within a div with a class -

i'm looking hide nested div (with class or id name) within container div class name. container div generated application cannot set id on it. don't know how many levels div generated cannot use path - because path changes depending on page generated. it's need use loop or something. here's have <div class ="container"> <div class ="level1"> <div class = "level2"> <other nested divs , html here...> <div class = "leveln" id="idleveln"> content hide <more divs , html here..../> </div> </other nested divs , html here...> </div> </div> </div> i want hide div class = "leveln" id="idleveln". i tried kinds of things give up. tried use find(), filter(), etc... help? thanks you can use .children() selector fil...