Posts

Showing posts from May, 2015

php - Dynamic field names in Laravel 5.1 -

i need create checkbox in laravel 5.1 name so: <input type="checkbox" name="groups[1]"> <input type="checkbox" name="groups[2]"> i using following code, doesn't work. know correct way code this? {!! form::checkbox('groups[{{ $user->id }}]', 'administrator', in_array('administrator', $user->roles()->lists('name')->toarray())) !!} the output is: <input checked="checked" name="groups[<?php echo e($user->email); ?>]" value="administrator" type="checkbox"> you cannot use blade inside php. concatinate id normal. try this: form::checkbox('groups['.$user->id.']', 'administrator', in_array('administrator', $user->roles()->lists('name')->toarray())) !!}

jquery - PHP write JSON file via AJAX -

i want post data via jquery/ajax json-file, don't receive data json object. my json content looks this: foo=abc&bar=def but want one: { "foo" : "abc", "bar" : "def } html <form id="foobar"> <label for="bar">a bar</label> <input id="foo" name="foo" type="text" value="" /> <input id="bar" name="bar" type="text" value="" /> <input type="submit" value="send" /> </form> js var request; $("#foobar").submit(function(event){ if (request) { request.abort(); } var $form = $(this); var serializeddata = $form.serialize(); request = $.post("datasaveajax.php", {json : json.stringify(serializeddata)}); event.preventdefault(); }); php

wso2esb - Can an excel datasource in WSO2 data service take a variable name for the excelURL -

the following excel data source definition in wso2 data service. there way define property in proxy , use excel url in excel data source of data service ? in other words, need excel file dynamically determined. following data source definition in data service <config id="organisationimportdatasource"> <property name="excel_datasource">c:/organisations.xls</property> </config> instead of this, possible use below <config id="organisationimportdatasource"> <property name="excel_datasource">get-property('filename', 'default') </property> </config> filename property defined in calling proxy the excel data source validated @ wso2 startup. trying above not work. re-aligned our requirement limitation excel data source need pre-defined , redefined our requirement ensure tenant specificity of excel data source. this, uploaded excel in specific locati

Can I implement multiple icons for one Google Chrome extension? -

i'm trying develop extension has 2 icons, , each icon clicked new modal / pop-up showed. somehow possible? in manifest.json example when add array of .png default_icon non-image appears in google chrome instead of intended array of .png .

JQGrid: making all checkboxes checked by default -

after adding following in jqgrid :- models {name: 'checkbox', index: 'checkbox', width:"5%", formatter: "checkbox", formatoptions: { disabled: false } }, columns "select" jqgrid has displayed column having check boxes correct default check boxes checked not expected. i not sure if default behavior of jqgrid check box column. don't want display check boxes checked default. how fix this? per default checkboxes non-checked . can use defaultvalue property of formatoptions change default value: formatoptions: {defaultvalue: "yes"} by way setting of width in % (like width:"5%" ) not supported jqgrid.

Java - I need to update JTextFields in a Swing GUI program -

this question has answer here: watchservice java 6 [closed] 3 answers i have program looks single notepad file contains information similar to: cardiff : 3245658 bristol : 4726485 manchester : 4728945 these places , numbers coming out of automatic system, , numbers change every 20 seconds or so. need create loop(i'm guessing) when numbers change, program notepad file , update number in jtextfield p.s have created program looks file, gets information needs , puts in correct place, using arraylist, all need how make code automatically update when there change in file, , need without using sort of jbuttons , needs itself. my whole code stands: package window; import java.awt.color; import java.awt.eventqueue; import java.io.bufferedreader; import java.io.filenotfoundexception; import java.io.filereader; import java.io.ioexception; import java.util.arr

mysql - Sql conditional count with join -

i cannot find answer problem here on stackoverflow. have query spans 3 tables: newsitem +------+----------+----------+----------+--------+----------+ | guid | supplier | lastedit | showdate | title | contents | +------+----------+----------+----------+--------+----------+ newsrating +----+----------+--------+--------+ | id | newsguid | userid | rating | +----+----------+--------+--------+ usernews +----+----------+--------+----------+ | id | newsguid | userid | readdate | +----+----------+--------+----------+ newsitem contains newsitems, newsrating contains ratings users give newsitems, , usernews contains date when user has read newsitem. in query want every newsitem, including number of ratings newsitem , average rating, , how many times newsitem has been read current user. what have far is: select newsitem.guid, supplier, count(newsrating.id) numberofratings, avg(newsrating.rating) rating, count(case usernews.userid when 3 1 else null end) numberofreads newsit

plot - Combine base and ggplot graphics in R figure window -

Image
i generate figure has combination of base , ggplot graphics. following code shows figure using base plotting functions of r: t <- c(1:(24*14)) p <- 24 <- 10 y <- a*sin(2*pi*t/p)+20 par(mfrow=c(2,2)) plot(y,type = "l",xlab = "time (hours)",ylab = "amplitude",main = "time series") acf(y,main = "autocorrelation",xlab = "lag (hours)", ylab = "acf") spectrum(y,method = "ar",main = "spectral density function", xlab = "frequency (cycles per hour)",ylab = "spectrum") require(biwavelet) t1 <- cbind(t, y) wt.t1=wt(t1) plot(wt.t1, plot.cb=false, plot.phase=false,main = "continuous wavelet transform", ylab = "period (hours)",xlab = "time (hours)") which generates most of these panels sufficient me include in report. however, plot showing autocorrelation needs improved. looks better using ggplot: require(ggplot2) ac

delphi - Minimize form in Firemonkey application -

i use this: application.minimize; in vcl delphi application, in firemonkey i've got undeclared identifire error. how can minimize firemonkey form? try using windowstate property windowstate := twindowstate.wsminimized;

How to change Icon of Dynamically added value from database into google autocomplete dropdown? -

i appending address stored in database when user searched particular address using google autocomplete place. autocomplete places show me suggestions address default icon. want display new suggestions default icon , address database different icon. how can this? can me this?

How to get Facebook access token with username / password -

using facebook graph api can fb access token. , have visit facebook.com allow application access data through login dialog. is there way facebook access token, using account id , password, api, without visiting facebook.com / without application ? user access token : if want user access token answer no . cannot access user access token without making user visit facebook. do reading on oauth , understand concept app access token : if mean application access token can make curl call facebook. see here details facebook's access token documentation explains different types of access tokens , how obtain , use them - user access tokens require direct interaction user though

android - How to play dailymotion live stream in one time? -

Image
i'm developing android application , should create live stream shower activity. there problem cannot solve. problem is: when open activity. screen comes: when click play button. comes:(problem screen. fourth screen shold come.) have press left-bottom corner of screen(stop button) ... , press same corner again(play button) after actions live stream comes.. what can solve problem? codes are: protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_zindi); getwindow().setflags(windowmanager.layoutparams.flag_fullscreen, windowmanager.layoutparams.flag_fullscreen); final string rsp = convertstreamtostring(this.getresources().openrawresource(r.raw.ceribin2)); wv = (webview) findviewbyid(r.id.webview2); wv.getsettings().setjavascriptenabled(true); wv.loaddatawithbaseurl("http://zaroktv.com.tr/", rsp, null, "text/html; charset=utf-8", null); } private static

matlab - Why does close(gcf) retain a graphical handle in the workspace? -

say plot data in h = figure; plot(1:10); this creates both new window , object in workspace ( h ). if close window (mouse or command line) close(h); it close window h still in workspace. get(h) returns invalid or deleted object. why that? don't rationale of keeping object handle deleted figure can nothing with.

grails - Importing Class in GSPs in IntelliJ IDE -

i use: intellij idea 15.0 grails 2.4.3 if want import class gsp example ${user} ide adds path as ${de.foo.bar.foo.user} and add on top <%@ page import="de.foo.bar.foo.user" %> //this not problem how can prevent ide doesn't add path on gsp instead adds class used in gsp below: <%@ page import="de.foo.bar.foo.user" %> ${user} in intellij can press alt+enter , can replace path import

Why is ""+ int flagged for Java in SonarQube -

in java can convert int string "" + intvalue . sonarqube , sonarlint flag inappropriate. why inappropriate. far know integer.tostring(intvalue) more verbose , same. i can imagine flag if not "" object x used in x + intvalue x initialized integer. ran javascript code. with regards why it's bad, java automatically optimizes string concatenation use stringbuilder instead. means doing this "" + d you're doing new stringbuilder().append(d).tostring(); and if do d + "" you end compiling new stringbuilder(string.valueof(d)).tostring(); which pretty big waste of resources relative calling string.valueof(d);

excel vba - Kill macro returns a 53 error -

this macro returns 53 error. if use csvpath2 variable kill command macro works, if use sprocessfile variable not. sub delete() dim csvpath string dim csvpath2 string dim sprocessfile string csvpath = "c:\test\" 'csvpath2 = "c:\test\*.csv" sprocessfile = dir(csvpath & "*.csv") kill sprocessfile end sub you need complete filespec (including path) on machine: sub delete() dim csvpath string dim sprocessfile string csvpath = "c:\testfolder\" sprocessfile = dir(csvpath & "*.csv") kill csvpath & sprocessfile end sub

c# - Unable to add Microsoft Office Interop Assembly to Project -

Image
i marked question 'not duplicate' because answer other question did not solve problem. this question contain answer helped me (second answer down, object library), still unable add required reference after this. as below answer suggested, checked in c:/windows/assembly , found load of msil files. when checking these in visual studio (under project - add reference) couldn't find them not dlls , folder structure had changed. however, running search here microsoft.office.interop.word allowed me find dll , add project. hooray! i need add following using directive project in order programmatically convert word documents pdf: using microsoft.office.interop.word; however, no matter can't seem find dll or reference assembly: as can see, have office installed on machine well: no matter online, answer seems "make sure have word installed", not helpful do! it should somewhere in c:\windows\assembly\ edited answer due below question

How to see in ASP.NET from which page was a method called? -

i have asp.net mvc project in have method on controller being called 2 separate pages, until behaviour same need different need see if i'm on page or page b know behaviour happens. is there solution viewdata or view or else can check page method called?

ios - Playing remote videos in WatchKit Extension with WKInterfaceMovie -

i'm trying play video on apple watch using wkinterfacemovie . want video on remote server. in similar question solution given , able reproduce local files. it's said in solution, works local files , i'm wondering why is. there sources in documentation or general experience? i beginning wonder, because said in transition guide under the movie object (wkinterfacemovie) that: "the url specify media assets may refer local file or asset located on remote server. remote assets, movie object downloads movie before playing it." so think should possible documentation though wasn't able implement successfully, yet.

text mining - Linking related topics IR -

Image
how link terms (keywords entities) have relation among them through text documents . example of google when search person shows recommendations of other people related person . in picture figured out spouse , presidential candidate , , equal designation i using frequency count technique . more 2 terms occur in same document more chance of them have relation. links unrelated terms pagemarks , verbs , page refences in text document . how should improve , there other easy reliable technique ? you should few techniques 1.) stop word filtering : common in text mining 2 filter words typically not important 2 frequent. the , a , is , on. there predefined dictionaries. 2.) tf/idf : tf/idf re-weights words on how separate documents. 3.) named entity recognition : task @ hand might sufficient focus on names. named entity recognition can extract names documents 4.) linear dirichlet allocation : lda finds concept in documents. concept set of words appear toget

Converting String to String of Hex and vice-versa in Vb.Net -

i need convert string of totally random characters in can read back! idea is: example string: hi h (ascii) -> 68 (hex) (ascii) -> 69 (hex) so converting hi must have 6869 my value in base64 (i got convert.tobase64string() ), "ascii hex" conversion correct? in base64 have value "4kiw0uewc/+c=" need characters only, special characters can mess system the vb.net convert can translate base64 string :( edit: final solution: got base64 string inside enc variable , converted first in ascii in corrispondent hex using: dim bytes byte() = system.text.encoding.ascii.getbytes(enc) dim hex string = bitconverter.tostring(bytes).replace("-", string.empty) after reversed with: dim b((input.length \ 2) - 1) byte int32 = 0 b.getupperbound(0) b(i) = byte.parse(input.substring(i * 2, 2), globalization.numberstyles.hexnumber) next dim enc new system.text.asciiencoding() result = enc.getstring(b) after got base64string , converted 1 last

javascript - How to load angularjs scripts files -

i have angularjs application, , there bunch of controllers, services , directives. let me controller.js , service.js , directive.js , truth there many more js files three. reduce http request, i'm combining js files one, let me it's app.js . index.html looks like <html lang="en"> <body> <div data-ng-view></div> <script src="app.js"></script> </body> </html> however, in development environment, want debug separated files not combined one. modified index.html gives capability. <html lang="en"> <body> <div data-ng-view></div> <script src="controller.js"></script> <script src="service.js"></script> <script src="directive.js"></script> </body> </html> however, don't want change index.html. possible define like: require('controller.js'); require('s

Android Studio shows no Javadoc for Realm classes -

i experimenting realm android project, unfortunately android studio not show javadoc realm classes. i did searching on topic, , found discussions indicating problem fixed in android studio 1.4 (i using 1.5.1). these discussions imply issue android-studio/gradle/maven. novice respect gradle , maven. things i've tried (based on advice in discussions found): added app's build.gradle apply plugin: 'idea' idea { module { downloadjavadoc = true downloadsources = true } } file->other settings->default settings->maven->importing check boxes 'sources' , 'documentation' after making above changes, did "invalidate caches/restart...", there no change in behavior. thanks help/advice. it bug in our recent releases has meant sources/javadoc wasn't released part of library. working on fixing it. can follow progress here: https://github.com/realm/realm-java/issues/1971

java - Problems with importing a document and changing the strings of the document and outputting the new strings in a new .txt document -

it should output new .txt document, when does, outputs original document. error message: exception in thread "main" java.lang.error: unresolved compilation problem: method must return result of type string if comment out return "ok", otherwise creates new document same details original document. what cause? public static string replace(string filename) { try { scanner file = new scanner(new file(filename)); system.out.println(file); stringbuilder b = new stringbuilder(); string s = ""; while(file.hasnextline()){ s = file.nextline(); if (s.equals("x")) { s = "0"; b.append(s).append(system.getproperty("line.separator")); } else { b.append(s).append(system.getproperty("line.separator")); } } try (printstream out = new printstream(new fileoutputst

How to have Google spreadsheet add new data rows automatically after new Google Analytics report is run? -

i'm using google analytics add-on on google spreadsheets automate weekly report recording on spreadsheets. i'd able record variables history site launch current date. i have scheduled report run every monday , retrieve variable values past week. values written on row in report sheet. i want row appended sheet previous rows have been recorded. how can this? thanks help. copy , paste code below in script editor. run onopen , create menu. can run function menu. copy report row sheet named history , delete copied report row. let me know if have problems. function onopen() { spreadsheetapp.getactivespreadsheet().addmenu( 'weekly report', [ { name: 'move history', functionname: 'moverow' }, ]); } function moverow() { // assumes source data in sheet named report // target sheet of move named history. change name want. var ss = spreadsheetapp.getactivespreadsheet(); var s = ss.getsheetbyname("report&quo

android - Make WebView behave according to device (phone/tablet) -

i have responsive webpage , managed make scale on mobile devices using viewport metatag. need webview render webpage in mobile version on smartphones , in desktop version on tablets. android seems not default since tablets render page using responsive version. basically need know if webview loaded in tablet layout or in phone layout , make use responsive design or not. for example: want same webview render facebook homepage (or other common site has responsive layout) in mobile version on smartphones in desktop version on tablets. how can that?

concatenation - hive concatenate partition all -

how concatenate partitions in 1 single command. eg , in case analyze stats , can run analyze table 'tablename' partition ( 'partition column name' ) compute statistics; dropping etc can run , alter table 'tablename' drop partition ( 'partition column name' '>/=/< etc' 'value' ) but seems there no way concatenate command whole partitions in 1 go. for generating hdfs dfs -ls 'hdfs table location' | awk -f '/' '{print "alter table 'tablename' partition ("$nf") concatenate;"}' is there way can same output in 1 command?

c# - Can I intercept a SOAP response in .NET before a content type binding mismatch ProtocolException? -

i trying debug c# code wrote consume web service. i'm hitting error when receiving response because content type of response doesn't match binding. exception snippet: an exception of type 'system.servicemodel.protocolexception' occurred in mscorlib.dll not handled in user code additional information: content type text/xml of response message not match content type of binding (application/soap+xml; charset=utf-8) the web service external can't change on end. know there lot of troubleshooting steps can take besides (and have tried many, it's not simple changing binding), there way view response message, or more info response, before hit exception? have custom message inspector written afterreceivereply method in it, exception occurs before method hit.

java - How to check null condition for the boolean variable -

i have class shown package com; public class person { boolean registered; public boolean isregistered() { return registered; } public void setregistered(boolean registered) { this.registered = registered; } } the data person object set based on data present in db . problem older records registered filed not present . so how can test if filed present or not ?? package com; public class test { public static void main(string args[]) { person per = new person(); if (per.isregistered()) { } } } how can check if per.isregistered() field present or not person object ?? boolean primitive data type can not null, can true or false. boolean object rapper of boolean data type, null , boolean.true , boolean.false ; public class person { boolean registered; ... } ... person per = new person(); if (per.isregistered()!=null ) { if(!per.isregistered()){ ... }else{ ... } }

Connecting SSMS client to remote SQL Server instance failing with 'AnyAny' firewall rule -

how can connect ssms client remote sql server 2008 r2 instance using sql browser , windows firewall enabled? i find that firewall turned off, can connect fine (without specifying instance name). when turn firewall (domain profile) on, connection attempts time out. so, begin troubleshooting, created 'anyany' firewall rule still failed timeout error. naturally can connect fine either way (firewall turned on/off) when specify instance name , port. sql browser running , listening on udp 1433. sql server running windows 2008 r2. what getting blocked? , why won't custom 'anyany' rule bypass it? the information on this sqlcat blog might helpful you. default, sql browser service runs on udp port 1434. if have firewall configured on sql server, should open port 1434 inbound connections ssms. if need setting remote connections sql server, this guide spot on .

javascript - Using gulp-if with gulp-useref and gulp-uglify -

i want use gulp-useref concatenate of javascript files one. within javascript files have mixture of pre-minified , non-minified files. i uglify files not minified (for build performance reasons) , https://github.com/jonkemp/gulp-useref#transform-streams suggests possible (in fact, looks easy). following gulp task definition: gulp.task('compile', function () { return gulp.src('index.html') .pipe(useref({}, lazypipe().pipe(function() { return gulpif(['*.js', '!*.min.js'], uglify()); }))) .pipe(gulp.dest(paths.build)); }); this works, in concatenated file non-minified files remain unminified (pre-minified files still minified -- expected). my code partially based on this: https://github.com/craigjennings11/gulp-uglifyjs any idea why files not being minified? references gulp gulp-useref gulp-if gulp-uglify lazypipe the problem here useref passing through concatinated file names,

git diff - appears no change, but shows changes -

i messing around , saw odd. think started when enabled strip whitespace in ide. when git diff , i'm getting this: @@ -106,8 +106,8 @@ dashboard.run(function($rootscope) { learnedoffrom: 'sum' }, { - docid: 1011, - fullname: 'lorem', + docid: 1011, + fullname: 'lorem', i'm betting "-" lines had space @ end, show red block, , ide stripped them out on save, reason that's not showing. has else run this? thought odd. first time i've run across seeing "-" , "+" code looks identical , if trailing spaces getting stripped i'm surprised git diff isn't showing big red blocks usual. if @ diff closely, , check whitespace, can see removed lines have trailing space, , added lines no longer that. so change trailing whitespace removed. this diff spaces replaced · visibility: -············docid:·1011,· -············fullname:·&

redirect - Nginx: dynamic proxy from url to subdomain -

i'm trying write nginx conf dynamically redirect url webapp, based on uri. use proxypass directive. example, want redirect http://www.example.com/clientname/ http://clientname.internaldomain.local/webapp so far, succeded replacing new host, uri broken because can't split it. (now can't replace host, dunno why ...) here actual non working conf: server { resolver 192.168.137.71; listen 80; server_name tomservpa1; location ~ (^\/(.*)\/) { set $ccehost $2; proxy_set_header x-forwarded-for $proxy_add_x_forwarded_for; proxy_set_header x-forwarded-host $host; proxy_set_header x-forwarded-server $host; proxy_set_header x-real-ip $remote_addr; proxy_pass http://$ccehost.internaldomain.local:9780/webapp/$new_request_uri; proxy_redirect off; proxy_set_header

java - GSON deserialization with generic types and generic field names -

let's have structure this: json: { "body": { "cats": [{ "cat": { "id": 1, "title": "cat1" } }, { "cat": { "id": 2, "title": "cat2" } }] } } and corresponding pojo: response.class private final body body; body.class private final collection<catwrapper> cats catwrapper.class private final cat cat cat.class private final int id; private final string title; but let have same structure, instead of cat receive truck { "body": { "trucks": [{ "truck": { "id": 1, "engine": "big", "wheels" : 12 } }, { "truck": { "i

oracle - Calculation in query based on the condition -

i have package in oracle contains several procedures, in 1 of procedures need calculate fee based on specific condition this: if x_flag = 1 fee = (.5 * orders.total_count) + (.3 * orders.total_amount) else fee = (.7 * orders.total_count) + (.4 * orders.total_amount) so, better way that? the procedure need add calculation on : procedure informatonrpt ( p_customerid in number, p_orderid in number) begin select cusromers.costomerid, cusromers.costomername, cusromers.coustomerphone, orders.price cusromers inner join orders on cusromers.orderid = orders.orderid when p_customerid null or p_customerid = cusromers.costomerid , p_orderid null or p_orderid = orders.orderid ; end informatonrpt; customers table columns: customerid custumername customerphone ordedid order table columns: orderid price total_amount total_count note that: fee column doesn't e

javascript - How to change attribute on a selected directive from a controller -

Image
i build application interactive svg map angular.js whole app controlled controller, svg wrapped in directive, , every <path> in svg partial directive too. when user clicked on wall, <path> id memorized in custom service , next when user select color, need fill wall color. problem can't access directive within controller. cant share scope directive because have multiple nested directives in controller , want access them id. maybe there design mistake? how can achieve workflow? there code controller, service , directives colorpicker controller app.controller("colorpicker", function($scope, $timeout, appconfig, colorservice) { $scope.colors = []; $scope.currentcolorset = 0; $scope.svgtemplateurl = appconfig.arsvg[$scope.$parent.roomtype.id][$scope.$parent.roomstyle.id] + 'over.svg'; $scope.maxcolorset = math.max.apply(math, jsondata.roomtype[$scope.$parent.roomtype.id].data.roomstyle[$scope.$parent.roomstyle.id].colors.map(function(color

django - CSRF verification Failed - Referer is insecure while host is secure -

i upgraded django 1.8 1.9. afterwards, error on localhost after django admin login: referer checking failed - referer insecure while host secure . everything works fine in production. below snippet of settings.py file: secure_proxy_ssl_header = ('http_x_forwarded_proto', 'https') session_cookie_secure = true csrf_cookie_secure = true those lines in settings.py file fine on production because you're using ssl certificate attached domain. however, on local you're using http://localhost:8000 or similar. if try connect via https://localhost:{{your_port_number}} you'll error err_ssl_protocol_error . the issue in lines 167-168 of django/django/middleware/csrf.py . when you're using https on production, request.is_secure() returning true ...which requires http_referer true or you'll error referenced. one solution adjust settings.py file depending on whether you're in local or production environment . way can add 3 lines set

php - Image is not displaying using TCPDF -

i working in cakephp 3 application. here using tcpdf pdf generation. works fine except image. image not displaying. here pdf() action file: public function pdf() { $this->loadmodel('users'); $users=$this->users->find('all')->select(['firstname','lastname','email','image_path']); $this->set(compact('users')); $this->viewbuilder()->layout('pdf'); } my pdf.ctp file : $html = '<table>'; foreach($users $users) { $html .= '<tr> <td>' . $users['firstname'] . '</td> <td>' . $users['lastname'] . '</td> <td>' . $users['email'] . '</td> <td><img src="/sample/webroot/img/'.$users['image_path'].'"/></td> </tr>'; } $html .= '</table>'; $pdf->writehtml($html, true, false, true, fals

excel - SSIS unable to see data -

Image
i tried import data excel spreadsheet oledb , showed green ticks indicated import took successfully. when checked ms sql server destination table, cannot see data. checked excel files , have data.

python - Django REST Framework : "This field is required." with required=False and unique_together -

i want save simple model django rest framework. requirement uservote.created_by set automatically within perform_create() method. fails exception: { "created_by": [ "this field required." ] } i guess because of unique_together index. models.py: class uservote(models.model): created_by = models.foreignkey(user, related_name='uservotes') rating = models.foreignkey(rating) class meta: unique_together = ('created_by', 'rating') serializers.py class uservoteserializer(serializers.modelserializer): id = serializers.integerfield(read_only=true) created_by = userserializer(read_only=true) class meta: model = uservote fields = ('id', 'rating', 'created_by') views.py class uservoteviewset(viewsets.modelviewset): queryset = uservote.objects.all() serializer_class = uservoteserializer permission_classes = (iscreatedbyorreadonly, )

jboss - WildFly cannot find XMLSchema.dtd -

i have war deploying wildfly 10.0.0.cr5 server. when war packaged, under web-inf/wsdl/dir/dir/ there wsdl, xsd files, , xmlschema.dtd file. 1 of xsds, called xml.xsd , has following @ top of file: <?xml version='1.0'?> <!doctype xs:schema public "-//w3c//dtd xmlschema 200102//en" "xmlschema.dtd" > <xs:schema targetnamespace="http://www.w3.org/xml/1998/namespace" xmlns:xs="http://www.w3.org/2001/xmlschema" xml:lang="en"> when deploy war, fails deploy following exception: failed start service jboss.deployment.unit."mywar.war".install: org.jboss.msc.service.startexception in service jboss.deployment.unit."mywar.war".install: wflysrv0153: failed process phase install of deployment "mywar.war" caused by: java.lang.runtimeexception: jbws024076: service {http://my.co.com/2011}myservice, cannot publish wsdl to: /jboss/wildfly-10.0.0.cr5/standalone/data/wsdl/mywar.war/dir/wsd

ios - Webview not constraining to bottom of view -

Image
i'm having difficulty making webview stick bottom of it's superview. i'm resizing webview based on it's content height , "grow" while being constrained against bottom marker. can see mean these 2 images (webview blacked out): i have tried few things. i'm using resizing webview, , attempting constrain it's superview. func webviewdidfinishload(webview: uiwebview) { print("got here") webview.frame.size.height = 1 webview.frame.size = webview.sizethatfits(cgsizezero) let bottomconstraint = nslayoutconstraint(item: webview, attribute: .bottom, relatedby: .equal, toitem: webview.superview, attribute: .bottom, multiplier: 1, constant: 0) webview.superview!.addconstraint(bottomconstraint) } unfortunately, webview still extends down opposed up. want webview against bottom of mapview, has it's bottom @ top of tab bar. suggestions?

arrays - C++ fill an empty buffer with a single value -

i apologize in advance if using incorrect terminology, i'm new c++ language. have class constructor creates empty buffer using malloc lpd6803pwm::lpd6803pwm(uint16_t leds, uint8_t dout, uint8_t cout) { numleds = leds; pixels = (uint16_t *) malloc(numleds); datapin = dout; clockpin = cout; } my understanding creates empty buffer length of whatever pass numleds dynamically created array correct? i'm using malloc because code goes on arduino has limited memory , want avoid overflows , have read, best way declare arrays don't know size array , want avoid overflow errors. my question is, once array has been created there faster way traditional loop fill array single value. want , microseconds make difference in application. know c++ standard library array classes have fill method, array declared in way? my question is, once array has been created there faster way traditional loop fill array single value. the c standard library provides

Select SQL Statement in Excel VBA -

sub logcheck() dim cn object dim rs object dim strsql string dim strconnection string dim apppath string set cn = createobject("adodb.connection") apppath = application.activeworkbook.path strconnection = "provider=microsoft.ace.oledb.12.0;" & _ "data source=c:\ceo.accdb;" cn.open strconnection s_id = sheets("my").range("a1").value strsql = "select * edo id = ' " & s_id & " '" rs.open strsql, cn if rs = null msgbox "record not found" else msgbox "record found" end if end sub i unable run code. showing error. please me out. thanks! here s_id data search table & id primary key in edo table. in case may detect if recordset empty checking .eof property : sub testifrecordfound() dim strconnection string dim strid string dim strquery string dim objconnection obj

Hide slider control nav when moving down at home page -

i wish on home page http://soulskydesign.com/rale%20engineering/predlog_dizajna/index-2.php hide slide controls (1,2,3,4...) when moving down. how can it? when moving down can see slider controls behind main menu. sorry miss read question before. achievable using z-index the z-index property specifies stack order of element. an element greater stack order in front of element lower stack order. note: z-index works on positioned elements (position:absolute, position:relative, or position:fixed). http://www.w3schools.com/cssref/pr_pos_z-index.asp what want put navigation bar has menu higher z-index nothing shown in front because other elements have lower z-index. z-index:99999 fix issue.

c# - Communication from WCF to WEB API -

i want consume webapi wcf service, i.e. want wcf service call web api. have searched on internet lot, forums concentrating on calling wcf web api, though need reverse of that. is possible do? sure can. use normal httpclient in .net application: using (var client = new httpclient()) { //api base address client.baseaddress = new uri("http://localhost:9000/"); client.defaultrequestheaders.accept.clear(); client.defaultrequestheaders.accept.add(new mediatypewithqualityheadervalue("application/json")); //sending request endpoint api/products/1 httpresponsemessage response = await client.getasync("api/person/1"); if (response.issuccessstatuscode) { //getting result , mapping product object person person = await response.content.readasasync<person>(); } } since didn't specified, above code request. can find more examples here: calling web api .net client in asp.net web api 2 (c#)

ecmascript 6 - avoiding deep nested module imports in an ES6 JavaScript web project -

i trying tackle have javascript project structure. writing es6 syntax webpack. current directory structure looks this project-dir |_ packages.json |_ webpack.config.js |_ html | |_ *** | |_ *** |_ js |_ app.js |_ routes |_ abc-component | |_ components | | |_ abc1.js | | |_ abc2.js | |_ index.js | |_ xyz-component | |_ components | | |_ xyz1.js | | |_ xyz2.js | |_ index.js |_ reducers.js this simpler structure. problem "reducers.js" , "abc1.js/xyz1.js" need access same functionality. so, if functionality lives in "reducers.js" "abc1.js/xyz1.js" have import "../../reducers.js". if functionality lives split in "abc1.js" , "xyz1.js" etc, "reducers.js" have import each 1 of them ".\abc-component\components\abc1.js" , ".\xyz-component\component\xyz1.js".

svn - Xcode: forget about old repositories -

xcode 7.2 gives me warnings every time build: myproject project 2 issues /!\ oldsvnproject /users/grumdrig/src/oldsvnproject missing working copy anotheroldproject /users/grumdrig/src/anotheroldproject missing working copy i haven't used svn in years. these projects have nothing xcode. i've tried deleting reference old subversion repo in xcode -> preferences -> accounts -> repositories . i've deleted every file inside project directory mentions svn, these two: myproject.xcodeproj/project.xcworkspace/xcuserdata/grumdrig.xcuserdatad/userinterfacestate.xcuserstate myproject.xcodeproj/project.xcworkspace/xcshareddata/myproject.xcscmblueprint after quitting xcode. come back. listen, , understand! [xcode] out there! can't bargained with. can't reasoned with. doesn't feel pity, or remorse, or fear. , absolutely not stop, ever, until [frustrated]. aha! believe have it. there old, ossified .svn directory in

Are there side effects of using Javascript non-attached iframes? -

i use non-attached iframes in code send commands webcams: var frm = document.createelement('iframe'); frm.style.visibility = 'hidden'; frm.style.display = 'none'; frm.src = "http://192.168.200.66/command=27"; notice, did not "document.appendchild(frm)". this works, iframes send commands cam expects , i've seen no problems can find no documentation or examples of such usage. are there side effects or problems using iframes way?

c# - Task locking UI in WPF -

i have been trying learn process of using task in wpf , have ran snag more due lack of experience. when executing asychronous call dataservice method "getfuturework" ui thread becomes unresponsive. code can seen below. note project uses mvvm , variable "worklist" observable collection used listiview's itemsource. private async void loadwork() { worklist = await _dataservice.getfuturework("usernamehere"); } dataservice task public async task<ienumerable<futurework>> getfuturework(string username) { using (_db = new dataentities()) { var worklist = await (from items in _db.repair_check_in_tables items.location == username && items.completed == "n" select new futurework { formatteddate = items.estshipdate.tostring(), serviceid = items.service_id, imagepath = @&

css - Mobile media queries issue -

i have html5 theme came responsive css . want add media query iphone 6 plus. have query works on iphone 5, @media (max-width: 479px) { #header .top .inner, section.news-ticker, .section3 .section-wrap, .section2 .section-wrap, #main, .section-navmobile, .footer-wrapper { width: 300px;} this media query on iphone 6 plus gives margin right , left, wanted add new media query max width of 736 px , give #main section width of 360px doesn’t work.. on iphone 6 plus still have large right , left margins , ignores 360px of main container tried different combinations of media widths , no luck something must doing wrong ...

java - What is a NullPointerException, and how do I fix it? -

what null pointer exceptions ( java.lang.nullpointerexception ) , causes them? what methods/tools can used determine cause stop exception causing program terminate prematurely? when declare reference variable (i.e. object) creating pointer object. consider following code declare variable of primitive type int : int x; x = 10; in example variable x int , java initialize 0 you. when assign 10 in second line value 10 written memory location pointed x. but, when try declare reference type different happens. take following code: integer num; num = new integer(10); the first line declares variable named num , but, not contain primitive value. instead contains pointer (because type integer reference type). since did not yet point java sets null, meaning "i pointing @ nothing". in second line, new keyword used instantiate (or create) object of type integer , pointer variable num assigned object. can reference object using dereferencing operator . (a dot

java - Add random String to ArrayList from another Array -

trying populate listview random strings, populates same value everytime click on button same string being chosen. dog , dog , dog ... can please give me hint on that? public class mainactivity extends listactivity { arraylist list1 = new arraylist(); string[] list2 = {"bubbles", "goldie", "dog", "fins", "dory"}; arrayadapter adapter; int randomnum; @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_main); random rand = new random(); randomnum = rand.nextint(list2.length); button add = (button) findviewbyid(r.id.add_button); button delete = (button) findviewbyid(r.id.delete_button); adapter = new arrayadapter(this, android.r.layout.simple_list_item_1, list1); add.setonclicklistener(new view.onclicklistener() { @override