Posts

Showing posts from 2012

sql server - SQL query IF EXISTS -

Image
i want check data exists in table.. my table structure create table [dbo].[indicatordata] ( [id] [bigint] identity(1,1) not null, [value] [float] not null, [indicatorid] [int] not null, [source] [nvarchar](500) not null, [uploaded] [bit] not null, [createdby] [nvarchar](500) null, [createdon] [datetime] null, [lastmodifiedby] [nvarchar](500) null, [lastmodifiedon] [datetime] null ) table 2 create table [dbo].[datafields] ( [dataid] [bigint] not null, [fieldid] [int] not null ) indicatordata.id has relationship datafields.dataid ( indicatordata.id can have multiple combination of datafield) table indicatordata sample data: table datafields sample data: query tried: note : won't pass dataid, pass field id & indicatorid scenario #1 select * indicatordata inner join datafields b on a.id = b.dataid a.indicatorid = 72 , b.fieldid in (59, 207) when pass field id, need combination of values datai

javascript - HTML Radio Button -

i have typed following code in front page , gives error in displaying radio button values (as undefined): function f1() { var fn = document.frm.t1.value; var ln = document.frm.t2.value; var ad = document.frm.s1.value; var sex = document.frm.r1.value; var nat = document.frm.d1.value; var typ = document.frm.r2.value; var typ1 = document.frm.c1.value; var typ2 = document.frm.c2.value; var typ3 = document.frm.c3.value; var budg = document.frm.r3.value; var mail = document.frm.t5.value; var mob = document.frm.t3.value; var resi = document.frm.t4.value; var city = document.frm.d2.value; var com = document.frm.s2.value; document.write("welcome dear " + fn + " " + ln + "<br>" + "your residential address " + ad + " , " + nat + " national " + "<br>" + "you

php - Get div content value during print post data? -

i new wordpress , php , want div content data when print_r($_post) i used add_action( 'save_post', 'wpse_save_meta_fields' ); wordpress hook save data or update data. when print_r($_post) things except selected_element_all div content. how data or resolve ? jquery code ( data file) jquery(document).ready(function() { var postid = "<?php echo $post_id;?>"; jquery("#sel_all_mmy").click(function() { jquery.ajax({ data: { 'post_id': postid }, type: 'post', datatype: 'json', url: "<?php echo get_template_directory_uri();?>/get_all_make_model.php?", success: function(data) { jquery(".selected_element_all").append(data); } }); }); }); html div append data <div class="selected_element_all" style="font-size:15px"> </div> and php code used <?php function wpse_save_

cocoa - Trivial "+[NSTimer scheduledTimerWithTimeInterval:repeats:block:]: unrecognized selector" error -

i banging head against odd error after move 10.12/sierra , xcode 8.1: +[nstimer scheduledtimerwithtimeinterval:repeats:block:]: unrecognized selector sent class 0x7fff78f1fa88 the minimal code (default settings of create new project) reproduce is: // appdelegate.m // #import "appdelegate.h" @interface appdelegate () @property (weak) iboutlet nswindow *window; @property (strong, nonatomic) nstimer * timer; @end @implementation appdelegate - (void)applicationdidfinishlaunching:(nsnotification *)anotification { self.timer = [nstimer scheduledtimerwithtimeinterval:10 repeats:yes block:^(nstimer * _nonnull timer) { nslog(@"ping %@", timer); }]; } the linking includes (core)foundation classes , 'all_load'. must totally trivial - fail is. any , appreciated. thanks, dw. +[nstimer scheduledtimerwithtimeinterval:repeats:block:] ios 10.0+ method. maybe t

vsto - How to set the outlook messageclass for pdf file -

what message class pdf file ipm.document.example word ipm.document.word.document.8.what pdf? "ipm.document.acroexch.document.dc" . take @ document item outlookspy - select item, click item button on outlookspy toolbar, select messageclass property. or click imessage button , select pr_message_class property.

visual studio - How to load/open Registry Class Diagram .CD file? -

Image
how can open registry class diagram (.cd) file ? if directly double click on tries open in visual studio , shows following error message : "class diagram not supported project type." we can open such registry class diagram (.cd) file loading registry editor. follow steps load .cd file in registry editor. 1. open regedit. 2. goto file->load hive.. 3. select .cd file. 4. give temporary key name <xyz>. (under key, .cd file imported) 5. click ok. and can see registry keys imported .cd file under registry key xyz. unload registry, follow same steps (unload hive).

precision calculation in Intrinsic plagiarism detection -

how calculate precision intrinsic plagiarism detection. have suspicious documents. average frequency word class used in order detect plagiarised passages. given suspicious document, code outputs plagiarised passages. how can calculate precision using these plagiarised passages.

browser - What is the max byte size that can be transferred in one package via http(s)? -

so far understand when there get request, data send server browser in multiple packages, depending on size of request. i wondering how bytes fit 1 package. pretty sure read somewhere once, can not find reference. also differ http https? thanks. you mean ip package? ipv4 maximum size 576 bytes while ipv6 1280 bytes. read this: https://en.wikipedia.org/wiki/maximum_transmission_unit it doesn't depend on protocol long transmitted on ip.

statistics - How to return significant matches in R corrplot? -

Image
i return significant matches following result figure fig. 1 library("corrplot") m <- cor(mtcars) # http://www.sthda.com/english/wiki/visualize-correlation-matrix-using-correlogram cor.mtest <- function(mat, ...) { mat <- as.matrix(mat) n <- ncol(mat) p.mat<- matrix(na, n, n) diag(p.mat) <- 0 (i in 1:(n - 1)) { (j in (i + 1):n) { tmp <- cor.test(mat[, i], mat[, j], ...) p.mat[i, j] <- p.mat[j, i] <- tmp$p.value } } colnames(p.mat) <- rownames(p.mat) <- colnames(mat) p.mat } n <- length(mtcars) -1 p.mat <- cor.mtest(mtcars) head(p.mat[, 1:n]) ids <- seq(1,n) corrplot(m, type="upper", order="hclust", tl.pos=c("td"), method="circle", tl.cex = 0.5, tl.col = 'black', diag = false, p.mat = p.mat, sig.level = 0.0000005) fig. 1 output expected output cyl: wt hp disp: wt hp cyl ... r: 3.3.1 o

scripting - Transmit command with netcat / Receive answer and put in txt file -

i have question , try made batch scripting file sends automaticly command server , listen answer put answer in txt file. i want netcat don't know how start it #! /bin/sh while(true) { nc sanderpi 5033 ::this command want send rdtemp1 ::here stuck ... } thanks lot helping :p

TCP sockets on Windows UWP application -

i have problem uwp applications, uses tcp socket connect each other. when 2 devices connected 1 network(hosted e.g. router) works correctly, when 1 of them create hotspot , second connect hosted hotspot, cannot connect each other, because still timeout exeption. maybe encountered similar problem , have resolution this? thanks in advance.

html - "Syntax error" on button click in iframe (SQL Report) -

in application showing sql report inside iframe . inside report there buttons expanding tree view. when open url directly in browser (internet explorer 11), can use these buttons without problem. when clicking on buttons through iframe , following error: script1002: syntax error i don't know how handle error there no error when opening report directly... it's not necessary here code of iframe : <iframe name="iframe1" id="iframe1" src="myurl/myreport?someparameters"></iframe> i've tried adding rs:embed=true url didn't change anything. it have been problem browser report should not load correctly when opening directly or wrong? how can show report inside iframe is? i've found problem, @grafgenerator. suggested using chrome. couldn't download on server because of settings. when wanted change settings, noticed javascript wasn't activated. after activating it, errors disappeared.

Executing Python script without hanging terminal -

now question might seem questions this 1 , this one. however unfortunately above solutions don't work me. need way execute python 3.4.3 script, leave running when terminal closes, , have not hang in terminal , executed directly. pi@raspberrypi:/var/www/html/mysite/scripts $ nohup python3 my.script.py & the above runs script, hangs in terminal, cannot enter other commands until stop it, pressing ctrl + c . is there way achieve this: pi@raspberrypi:/var/www/html/mysite/scripts $ nohup python3 my.script.py & pi@raspberrypi:/var/www/html/mysite/scripts $ (now enter more commands, despite script still running) i hope have provided enough information, can me, thanks! based on quick google search, found start /b python3 my.script.py for windows or python3 my.script.py & on lunix (bash).

jquery - Ajax Post to Overloading c# web service method -

i have webservice in c# , works when don't overload it. when overload , post ajax, gives error. $.ajax({ type: "post", url: "http://localhost:6783/asd.asmx/add", data: data, contenttype: "application/json; charset=utf-8", datatype: "json", success: function (msg) { console.log(msg); }, error: function () { alert("this error"); } }); in c# [webmethod(messagename = "add2")] public int add(int a,int b) { return a+b; } [webmethod(messagename = "add3")] public int add(int a, int b, int c) { return + b + c; } i added this: [webservicebinding(conformsto = wsiprofiles.none)] and when test web service, works. however, doesn't work when called ajax.

ember.js - Re-directing the user when using an old hash route -

we porting our old app ember , in process of doing made few changes url structure. main 1 not using hash routes anymore. in past, our routes domain.com/#profile/some_id/ (singular, id, , hash) , on new 1 domain.com/profiles/username/ (plural, username , without hash). we can handle plural/singular change creating singular route , redirecting user singular plural. import ember "ember"; export default ember.route.extend( { model( params ) { return this.get( "store" ).findrecord( "profile", params.id ); }, aftermodel( model ) { this.transitionto( "profiles", model.get( "username" ) ); }, } ); without hash, redirecting singular , id plural , username works. hash, if add / after hash (as in /#/profile/id ), works. old routes, without / route not redirecting should. is there way of telling ember /#profile/ hash route?

iphone - How to get nearby places from Google SDK using iOS and Swift? -

how can nearby location google sdk in ios , swift? need nearby places without type , category? client don't want use url: https://maps.googleapis.com/maps/api/place/search/json?location=lat,long&radius=1000&sensor=true&key=key you can this api call: https://maps.googleapis.com/maps/api/distancematrix/json?origins=51.226531,4.190688&destinations=51.114476,4.139618|51.148123,4.182590 there 3 parameters in url , json used return response origins contains long , lat of current location of user and destination contains addresses form want find nearest distance. addresses in long , lat format , seperated "|". the response follow { "destination_addresses" : [ "dorpstraat 70, 9140 temse, belgië", "eigenlostraat 38, 9100 sint-niklaas, belgië" ], "origin_addresses" : [ "provinciale baan 37, 9120 beveren, belgië" ], "rows" : [ { "elements" : [

ipad - Paypal Shopping Cart displaying Parent and not the child -

Image
on website add items basket, desktop version fine , shows colour option chosen below parent. my problem on ipad, paypal shopping basket doesnt show user colour have chosen. repeats parent name.

android - Custom Sectioned RecyclerView Inconsistency detected if invoking notifyItemRemoved(position); -

i'm implementing sectionedrecyclerviewadapter . know there many great libraries task, before quit i'd enjoy try. please, before shoot @ me consider prototype , every suggestion improvements welcome. here implementation. concept simple, every pojo wants sectioned must implement sectioned interface 1 method return title of section. linkedhashmap keep track of sections vs indices. import android.support.v7.widget.recyclerview; import android.util.log; import android.view.viewgroup; import java.util.arraylist; import java.util.collections; import java.util.comparator; import java.util.linkedhashmap; import java.util.list; abstract public class sectionedrecyclerviewadapter< headerviewholder extends recyclerview.viewholder, valueviewholder extends recyclerview.viewholder> extends recyclerview.adapter<recyclerview.viewholder> { public interface sectioned { string getsection(); } static final private string ta

import - R - Reading unknown number of files -

this question has answer here: importing multiple .csv files r 12 answers i'm new r. try process experimental data , i'm stuck bug when reading files. want read data files in folder don't know how many there. know files named "subject1manualx.log", x being 1 or higher. since didn't find possibility count how many files in folder, try open files in while loop until exception raised (i.e. try open "subject1manual1.log", "subject1manual2.log" etc). here code (prints debug): # script work on et data temp <- 0 while (temp == 0){ trycatch({ subjectdata <- read.delim("d:/doctorat/xps/xp1-2_lipsmwa/smarteye/subject1/subject1manual3.log") }, warning = function(w){ print(paste("warning", i)) temp <- 1 }, error = function(e){ print(paste("error", i)) temp <-

xcode - 'Error' cannot be constructed because it has no accessible initializers -

not sure if error in code or glitch in xcode. i have class (simplified version sake of clarity) public class error { let errors: [ (title: string, message: string)] = [("some error title","some error message"), ("another error title", "another error message") ] var errorno : int init (_ errorno: int) { self.errorno = errorno } func title () -> string { return self.errors[self.errorno].title } func message () -> string { return self.errors[self.errorno].message } } in class have if somecondition { return error (0) } now strange thing... compiles , runs if let xcode sit idle few moments (not fastest computer i'm using), xcode giving me infamous red dots (with exclamation marks) error: 'error' cannot constructed because has no accessible initialisers next each time error(0) (whatever int use in constructor) i can compile

javascript - threejs - How to rotate object on fixed world axis? -

function rotategearmodel(axis, value) { switch (axis) { case 'x': riduttore.rotation.x = parsefloat(value); $('#gmrotx').attr('value', parsefloat(value).tofixed(3)); break; case 'y': riduttore.rotation.y = parsefloat(value); $('#gmroty').attr('value', parsefloat(value).tofixed(3)); break; case 'z': riduttore.rotation.z = parsefloat(value); $('#gmrotz').attr('value', parsefloat(value).tofixed(3)); break; } } i've experiencing trouble object rotation in threejs. have scene collada model need rotate interactively (user have 1 slider each axe, x y z). if user follows euler order there no problems, if try rotate model following steps "lost in space" experience :)) rotate on x object local axe (the rotation seems aligned world axe); rotate on y object local axe (the rotation seems aligned world axe); rotate on z object local axe (the rot

json - How to map JSONArray to Model using MJExtension -

i got jsonobject this: { "id":123, "coordinate": [ 116.414503, 39.945575 ], } i have defined coordinate model: //coordinate.h @property (nonatomic, assign) float lng; @property (nonatomic, assign) float lat; and target model: //target.h @property (nonatomic, assign) int id; @property (nonatomic, strong) coordinate *coordinate; question how corresponding target class? thanks!

vb.net - Pass an object from form to another in VB -

i have searched through internet , couldn't find answer problem, but, issue have 2 forms; frm_bookmaneger and frm_addbook the first 1 main form , has list of books (named listbook ), treeview , button invoke second form add new book. after filling in of textboxes , information of book, press "add". then, second form closed , info of book kept in instance of book class. problem is: how can pass instance first form store in listbook . for example: if create constructor in form 1 form 2 in form 2: dim f1 form1 = new form1(me) f1.show() f2.close() i can't because form 1 start instantly when start program, , default right doesn't have parameter in oncreatemainform(): protected overrides sub oncreatemainform() me.mainform = global.windowsapplication5.frm1 end sub how can it? first form: public class frm_bookmaneger 'list of book dim listbook list(of book) = new list(of book) private frm_addbook frm_addbook public

javascript - Pass object to PHP through AJAX -

i wondering if possible pass array php function using jquery ajax function. have following javascript arr_data = { field01: "data 01", field02: "data 02", field03: "data 03", field04: "data 04" } $.ajax({ url: "scripts/php/phpfunc.php", type: "get", datatype: "json", data: { 'action': "exec_find", 'field01': arr_data["field01"], 'field02': arr_data["field02"], 'field03': arr_data["field03"], 'field04': arr_data["field04"] }, success: function(result) { // continue program }, error: function(log) { // handle error } }); when try following though arr_data = { field01: "data 01", field02: "data 02", field03: "data 03", field04: "data 04" } $.ajax({ url: &

c# - SQLIte SUM datetimes -

i have database rows, time values. want sum of time values (generaly, format %h:%m). i used sum value that: select sum(n_hores) table; but 0.0. how can ? thanks time values in hh:mm format strings, , strings cannot summed meaningfully. you should convert these time values number ( strftime(%s) returns number of seconds since 1970-01-01, have subtract offset start of day number of seconds corresponding time value): select sum(strftime('%s', mytime) - strftime('%s', '00:00')) mytable you can convert number of seconds time string ( time() returns in hh:mm:ss format): select time(sum(strftime('%s', mytime) - strftime('%s', '00:00'))) mytable

r - glm summary not giving coefficients values -

i'm trying apply glm on given dataset,but summary(model1) not giving me correct output , it's not giving coefficient values estimate std. error z value pr(>|z|) etc, it's giving me na output individual attribute element. text <- c('learned new concept today : metamorphic testing. t.co/0is1ius3aw','bmc bioinformatics biomed central: detecting novel ncrnas experimental #rnomics not easy task... http:/t.co/ui3unxpx #bing @myen','bmc bioinformatics biomed central: small #rna regulatory function scientific ... detecting novel… http:/t.co/wwhoekr0vc #bing','true or false? link(#addition, #classification) http:/t.co/zmjutft8iq #oxytocin','biologists have sense of humor, computational bio people http:/t.co/wfzqaafy') name <- c('qsoft consulting','fabrice leclerc','sungsam gong','frederic','zach stednick') screen_name <-c ('qsoftconsulting','rnomics','sunggong

php - disable if input value is text and enable if it number -

i want : if value of input text, disable. if value of same input number ,then enable. the code is <input type="text" value ="<?php echo $row [0];? disable> this test if value int (cases 1.0 or '1' disabled) : <input type="text" value="<?php echo $row[0];?>"<?php echo !is_int($row[0]) ? ' disabled="disabled"' : ''; ?> /> this test if value float (cases 1 or '1' disabled) : <input type="text" value="<?php echo $row[0];?>"<?php echo !is_float($row[0]) ? ' disabled="disabled"' : ''; ?> /> this test if value int or float or numeric string (cases '1' enabled) : <input type="text" value="<?php echo $row[0];?>"<?php echo !is_numeric($row[0]) ? ' disabled="disabled"' : ''; ?> />

linux - Virtual IP socket communication in mac os -

i experimenting creating multiple ip address same nic hardware of following command in mac os. ifconfig en0 alias 121.3.3.5 192.168.139.255 ifconfig results following en0: flags=8863 mtu 1500 options=10b ether 68:5b:35:7e:b0:dc inet6 fe80::6a5b:35ff:fe7e:b0dc%en0 prefixlen 64 scopeid 0x4 inet 192.168.139.191 netmask 0xfffffe00 broadcast 192.168.139.255 inet 121.3.3.5 netmask 0xff000000 broadcast 192.168.139.255 nd6 options=1 media: autoselect (1000baset ) status: active i ran simple server in machine, tried connecting virtual ip address (121.3.3.5) . able connect,read , write. when tried connect remote server (say ex: imap.gmail.com) not able connect these virtual ip address.. tcp/ip status in sync_sent state java code (to set local virtual ip): inetaddress remoteinet = inetaddress.getbyname("imap.gmail.com"); inetaddress inet = inetaddress.getbyaddress(new byte[]{(byte)121, (byte)3, (byte)3, (byte)5})

c# - Hosting WPF plugin cross-process issue -

i use approach similar http://www.codeproject.com/articles/516431/baktun-shell-hosting-wpf-child-windows-in-another host wpf applications (plugins) in process via addinhost (derived hwndhost) class. this works fine far long don't suspend child process. if parent process frozen. reason parent/child processes sharing same (synchronous) input queue: good or evil - setparent() win32 api between different processes i have tried decouple 2 processes before suspend plugin process setparent win32 function plugin decoupled host-application not rid of problem: public static void decouple(hwndhost hwndhost) { setparent(hwndhost.handle, intptr.zero); } any ideas missing here separate 2 processes don't share same input queue longer? for me solution use attachthreadinput win32 api function detach plugin hwndhost input queue

Get checked row value id with jquery selector -

i try put id value behind radio checked element each record. works fine on view side, want id via jquery selector , post on ajax. html looks following: <td> <input type="radio" name="cursa_radio" id="cursa_radio" value="ticket_selected" route_value ="'.$data['route'][$i]['id'].'"> '.$data['route'][$i]['departure_station'].' //actual td value </td> this ajax: $.ajax({ url: myvariable.urlsite + "curse_interne/getinternalticketprice", type: "post", datatype: 'json', data: $("#first_step").serialize() + '&internal_route_id=' + $("input[name='cursa_radio']:checked ").text('value') + '&' + $("#first_step").serialize(), note url site contorller file , getinternalticketprice function has this: $a = $this->input->post(&#

Google Maps API Missing Locations -

we have found bit of issue google maps api, in places such chiswick missing when searching under types: ['(cities)'] options. var options = { language: 'en-gb', types: ['(cities)'], componentrestrictions: {country: "gb"} }; we can granular , down villages, perfect want do, such items bishop middleham appear fine, moving durham, newcastle, middlesbrough fine, seems fall short places chiswick above (which region of london). the next region along chiswick brentford, works fine on api, acton, hanwell, , hammersmith little different appearing (london borough of hammersmith , fulham). it seems suburbs may missing in full extent? the way can seem chiswick appear if go down street level, don't want appear. has else come across issue? here's code in jsfiddle - https://jsfiddle.net/3373x9mj/ if compare fea

Two Pages on one printed Sheet: Achive multi-page printing options using CSS/HTML -

Image
i creating html pages print them. designed each page separately, have 2 pages on 2 sheets if print them. know every printer having optins "2 pages on 1 sheet".. but not want printing options depend on current document. so question can rephrase in: how can efficient imitate printer-settings using css. imagine following html , css: <html> <head> <style> @page { size: 21cm 29.7cm; margin: 15mm 15mm 15mm 15mm; } html,body { font-family: sans-serif; font-size: 11px; width: 100%; height: 100%; margin: 0; padding: 0; } div.container { width:100%; height:100%; margin: 0; padding: 0; page-break-after:always; } </style>

ios - Upgrading to Swfit 3: cannot override 'init' which has been marked unavailable -

Image
i inherited ios project incorporates apple's researchkit (rk). i have upgraded recent version of rk , swift 3. while have worked in ios , rk, still not confident. anyways, there class called surveytask implements orkorderedtask rk. cannot override 'init' has been marked unavailable at end function, stepz defined, have: super.init(identifier: "survey", steps: stepz) i checked orkorderedtask class definition, has init function. i have been reading initializers haven't found anything. using override or convenience before init in surveytask doesn't change anything. same error. appreciated. xcode version 8.1.

php - Get an average number for multiple embedded documents MongoDB -

i working highcharts make drilldown chart. display multiple projects, average value , drilldown in columns every value. problem is, can't average number per projects.. json mongo looks this: { "_id" : objectid("57f4dd6c45db428df9a5541b"), "id" : 68, "project_code" : 13110202, "samples" : [ { "sample_name" : "1678_2", "perc" : "75.97" }, { "sample_name" : "2012_1b-5", "perc" : "75.33", }, { "sample_name" : "2012_1b-8", "perc" : "77.28", }] }, { "_id" : objectid("57f4dd6c45db428df9a5541a"), "id" : 70,

java - Any Configurations with Apache LDAP that allows one connection per one authenticated user -

is there configuration available apache ldap allows 1 connection per 1 authenticated user ? "cn=priya,dc=example,dc=com" something checks, if connection true/authenticated not allow connection same userid/cn. restricting 1 user per 1 connection.

iterable - julia static field of composite type -

in julia allowed create & use static fields? let me explain problem simplified example. let's have type: type foo bar::dict() baz::int qux::float64 function foo(fname,baz_value,qux_value) dict = jld.load(fname)["dict"] # simple dictionary loading special file new(dict,baz_value,quz_value) end end now, can see, load dictionary jld file , store foo type other 2 variables baz , qux_value . now, let's create 3 foo object type. vars = [ foo("mydictfile.jld",38,37.0) i=1:3] here, can see, of foo objects load same dictionary. quite big file (~10gb)and don't want load many times. so, ask that, there way in julia that, load once , of there 3 types can reach it? (that's way use static keyword inside question) for such simple question, approach might silly, next step, make foo type iterable , need use dictionary inside next(d::foo, state) function. edit actually, i've found way right now. want ask whether correct

css - How to center a html website menu navi -

coding first website. stuck on part, tips menu writing centered , align image head. in advance <!doctype html> <html> <head> <title>a.willi a.g</title> </head> <h1 align="center"> <a href="index.html"><img src="logo.png" alt="a.willi a.g" /></a> </h1> <body><link rel="stylesheet" href="index.css" type="text/css" /></body> <head> <style> ul { list-style-type: none; margin: 0; padding: 0; overflow: hidden; background-color: #333; text-align: left; } li { float: left; } li a, .dropbtn { display: inline-block; color: white; text-align: center; padding: 14px 16px; text-decoration: none; } li a:hover, .dropdown:hover .dropbtn { background-color: black; } li.dropdown { display: inline-block; } .dropdown-content { display: none; position: absolu

php - Laravel form echo variable -

i still learning how work laravel. have learned how make form in laravle. have trouble echo variable. want is: want echo variable value of input-field if variable exists, otherwise should echo nothing. form line looks this {{form::text( 'league_name', '@if(isset($varialble) {{$variable}} @else {{$nothing}} @endif)' )}} how can echo variable in form? i using blade btw. this right way it: {!! form::text('league_name', isset($varialble) ? $variable : '') !!} if you're using php7, can this: {!! form::text('league_name', $varialble) ?? '') !!} update to add placeholder, pass in array third parameter. also, want pass class: {!! form::text('league_name', isset($varialble) ? $variable : '', ['placeholder' => 'my placeholder', 'class' => 'form-control']) !!}

python - Data Aggregation in Django Model -

this model concerned: class order(models.model): guest = models.foreignkey('hotel.guest', on_delete=models.cascade) date = models.datefield(auto_now_add=true) amount = models.integerfield() item = models.foreignkey('hotel.item', on_delete=models.cascade) price = models.integerfield(default=1) is_paid = models.booleanfield(default=false) paid_date = models.datefield(blank=true, null=true) my current view returns list specific guest of unpaid orders: open_orders = order.objects.filter(guest = guest, is_paid=false). i aggregate amount , price per item , date list in new list... the documentation explains how aggregations across entire queryset, , annotations across relationship seem stuck this... i used .values('item_id','date').annotate(sum('amount')).annotate(sum('price')) doesn't seem right. data example: open_orders = (date=11/11/2011,guest=john,amount=2,item=beer,price = 30 = order.a

memory - PHP memory_limit in a shared hosting environment -

i on shared hosting environment , got memory allocation errors. then, checked php in cpanel, , saw memory limit 1024m, ram 512m. searched , saw post saying ram needs greater php memory limit. , said that, can use ini_set() manually set memory limit lower ram. my questions are: (for second opinion) should manually configure memory limit? lower ram? what best memory_limit size should put if ram 512m ? if case, configured successfully, allocation memory error vanish? will lessen performance of website? what happen performance of website? [good , bad] update here got error again: couldn't create child process: /opt/suphp/sbin/suphp first of (answer #1 ) php memory located in ram, can't allocate more ram capacity. keep in mind 512mb ram users on site together, not each request separately. second (answer other): if have 512mb php limit , it's exceeded, scripts taking resources , slow down/stop website. optimize operations , queries.

java - Parse tricky json -

how parse json in java , value of city field? {"20511232":{"id":"20511232", "name":"xyz" ,"address":{"city":"abc","state":"bcv"}}} note root key value of id field. i know can hardcode this json.getjsonobject("20511232").getjsonobject("address").getstring("city"); but if have many such json. note: using org.json.jsonobject don't understand why got voted down.anyways worked out using keys() method suggested @henry in comments.

sitecore8.1 - Sitecore MVC does not give error for .aspx pages -

we using sitecore 8.1 mvc format. discovered if have link like: mywebsite.com/about or mywebsite.com/contact if write mywebsite.com/about.aspx works page there. desired functionality? if don't want have version without .aspx how can that? possible? edit: how url's being generated: <linkmanager defaultprovider="sitecore"> <providers> <clear /> <add name="sitecore" type="sitecore.links.linkprovider, sitecore.kernel" addaspxextension="false" alwaysincludeserverurl="false" encodenames="true" languageembedding="always" languagelocation="filepath" lowercaseurls="false" shortenurls="true" usedisplayname="false" /> </providers> this sitecore default behavior, can do, redirect .aspx page correct url, keep addaspxextension="false" in sitecore link manager configuration, , add following code main layout : stri

html - How jQuery propagation works? -

i work on web app social network parts. the purpose of code display posts particular user (ie user may have voted 'like' or 'dislike' 1 of many of displayed posts) : <c:foreach var="post" items="${requestscope['postvotes']}"> <div class="thread" data-post="${post.key.messageid}" data-vote="${post.value}" data-response-level-message="${post.key.responselevelmessage}"> <c:if test="${post.key.responselevelmessage == 0}"> <hr> <font size="2"> le <fmt:formatdate value="${post.key.messagedate}" /> par <a href="${pagecontext.request.contextpath}/centralstation?section=votepage&currentcontext=${post.key.messageid}">${post.key.messagesende

Subtract a constant from a column in Excel -

Image
=sum(d5,-1) column d 134 23 232 i need subtract 1 each column to e 133 22 231 d e 134 =d1-1 23 =d2-1 232 =d3-1

pandas - Transposing one column in python dataframe -

i have following: index id speed _avg_val 245 1 10 30.5 246 1 2 25.1 i want transpose column id , have following: id (index) speed _avg_val speed_y _avg_val_y 1 10 30.5 2 25.1 i tried use method transposing 1 column in python pandas simplest index possible not work multiple columns. i think can first remove column index , add column id index , unstack , sort second level of multiindex in columns sort_index : print (df) index id speed _avg_val 0 245 1 10 30.5 1 246 1 2 25.1 df = df.drop('index', axis=1) .set_index('id', append=true) .unstack(0) .sort_index(axis=1, level=1) #remove multiindex columns df.columns = ['_'.join((col[0], str(col[1]))) col in df.columns] print (df) speed_0 _avg_val_0 speed_1 _avg_val_1 id 1 10 30.5 2 25.1

python 3.x - Why am I not getting an expected output using logical operators and indexing? -

i having trouble achieving expected output. trying create byte adder using logical operators such and, xor , or. have taken minimal code required reproduce problem out of code, assume finalfirstvalue = "1010" , finalsecondvalue = "0101" . secondvalueindex = (len(finalsecondvalue) - 1) carry, finalans = false, [] in range(-1, -len(finalfirstvalue) - 1, -1): andone = (bool(finalfirstvalue[i])) & (bool(finalsecondvalue[secondvalueindex])) xorone = (bool(finalfirstvalue[i])) ^ (bool(finalsecondvalue[secondvalueindex])) andtwo = (bool(carry)) & (bool(xorone)) xortwo = (bool(carry)) ^ (bool(xorone)) orone = (bool(andone)) | (bool(andtwo)) carry = (bool(orone)) finalans.append(xortwo) secondvalueindex -= 1 answer = ''.join(str(e) e in finalans) print (answer) actual output: falsetruetruetrue expected output: truetruetruetrue the code follows change zeroes , ones. because missing single boolean feel issue indexi

python - How to strictly limit float to two numbers to get hh:mm:ss? -

i newbie in python tries learn it, things vague me right now. hope has time point me in right direction. what trying do? asking 3 inputs convert float (because i've been told raw_input has default value string) . want print them this: hh:mm:ss i this, 3 times: time_to_think = float(raw_input("enter time needed: ")) after that, have if-statement checks if input bigger 50. that works well, until need print them... so have this: if time_to_think > 50 time_to_think_sec = round(time_to_think / 1000) # gives me time think in seconds and now, finally: print "the time needed: %.2f:%.2f:%.2f" % (time_to_think_sec, time_to_think_minutes, time_to_think_hours) i want output strictly: hh:mm:ss . gives me lot of decimals, while want rounded numbers 2 numbers. if time_to_think_sec = 1241414 , want 12 it has with: %.2f:%.2f:%.2f , don't know how fix this. %02f:%02f:%02f didn't trick... the easiest way use datetime module. t

javascript - D3: Panning not working in bar chart -

i've tried implement panning bar chart. have written zoom function, bar charts not displayed @ all. want horizontal scrolling , want dragging bound, such when drag elements values go until last minimum value or maximum value defined on x axis. this have tried far: var data = [{ x: 2, y: 4 }, { x: 5, y: 8 }, { x: 8, y: 10 }, { x: 2, y: 4 }, { x: 5, y: 8 }, { x: 8, y: 19