Posts

Showing posts from May, 2014

c - What are #pragma equivalencies in gcc? -

my compiler ignoring: #pragma data_section(..., "iram_init"); and #pragma code_section(..., ".icode"); where ... function. this causing segmentation errors when run program. suppose because incorrect syntax gcc compiler ? equivalent ? thanks (context: on raspberry pi in raspian) the equivalent are: __attribute__((section(".icode"))) void fct1(int toto) { ... } __attribute__((section("iram_init"))) int fct2(void) { ... } __attribute__((section(".var"))) int myvar; but take care linker script (commonly ".ld" gnu tools): thoses sections have defined , mapped correct memory

ios - Why is Swinject model class registered without ".inObjectScope( .Container )" producing a singleton? -

this question people lot of experience of swinject swift. i show problematic code, , question @ bottom. there's quite lot of code, sorry that. this myswinjectstoryboard.swift registration: import swinject extension swinjectstoryboard { class func setup () { defaultcontainer.register( stopwatch.self ) { responder in stopwatch( signals: responder.resolve( signalsservice.self )! ) } defaultcontainer.register( signalsservice.self ) { _ in signalsservice() }.inobjectscope( .container ) defaultcontainer.register( imageservice.self ) { responder in imageservice( signals: responder.resolve( signalsservice.self )! , stopwatch: responder.resolve( stopwatch.self )! ) }.inobjectscope( .container ) defaultcontainer.registerforstoryboard( startupviewcontroller.self ) {

node.js - javascript sql.js giving error Uncaught Error: file is encrypted or is not a database -

here <script> tag in html page giving me error: uncaught error: file encrypted or not database <script> var file = "/data/mydb.sqlite"; var db = new sql.database(file); db.run("select * webusers", function(err, rows) { rows.foreach(function (row) { console.log('webusers created user: '+row.username); }); }); </script> as mentioned in comments, constructor doesn't take string, takes uint8array containing sqlite database. one way use ajax request database arraybuffer , transform uint8array. var file = "/data/mydb.sqlite"; var xhr = new xmlhttprequest(); xhr.open('get', file, true); xhr.responsetype = 'arraybuffer'; xhr.onload = function() { var data = new uint8array(this.response); var db = new sql.database(data); db.run("select * webusers", function(err, rows) { rows.foreach(function(row) { console.log('webuse

sql - prevent any update or delete from table -

i have table added boolean column done when column true want prevent unautorized action (delete, update) on row. i wrote trigger: create trigger productstock_beforeupdate before update or delete on table each row execute procedure trig() create or replace function trig() returns trigger $$ begin if tg_op='update' or tg_op='delete' if old.done=true raise exception 'cant that'; return null; end if; end if; return new; end; $$ if autorized transaction wants change data have first disable trigger. this idea should work when try delete row done=false it returns me "0 rows deleted" , not perform delete. any idea wrong trigger? this caused fact update go through need return new record. delete go through, need return old record. quote manual thus, if trigger function wants triggering action succeed without altering row value, new (or value equal thereto)

python - How do I prevent `format()` from inserting newlines in my string? -

it might mistake, cmd = 'program {} {}'.format(arg1, arg2) newline between 2 args... program 1\n2 what should put them in 1 line ( cmd need passed system shell)? arg1 contains \n . use strip() cmd = 'program {} {}'.format(arg1.strip(), arg2.strip())

amazon web services - Cloudfront 403 error while accessing files uploaded by another account -

Image
i have cloudfront distribution takes 1 of s3 buckets origin server. files uploaded s3 third party attachment uploader. when try access file in s3 via cloudfront getting 403 forbidden error access denied xml (as below). when manually upload files s3 bucket able access file via cloudfront. the permission both files same except owner of file. file uploaded me manually owner, of file account , file uploaded uploader, uploader. third party attachment uploader gives full access of object bucket owner. also, have restricted bucket access not viewer access. what reasons can cause error? how go debugging this? when second aws account uploads content s3 bucket serving content via cloudfront oai, uploaded file needs have oai canonical id added --grant read=id="oai-canonical-id" when file uploade; add s3 bucket owner grant full=id="bucketownerid". aws cli used perform uploaded. adjust according method used. when file viewed in s3 bucket, permissions have c

java - What is the difference between a layer and a component? -

my major development framework java spring framework. have write service layers, controller layer, dao layer, repository layer , on. there thousands of tons of layering. think component based development approach become more productive layering. spring calls every java beans component. think there should major difference between component , layer. layer passive component active. component fires events, call life cycle callbacks methods , actively handle task. on other hand layer gives abstraction. fundamental difference between layer , component? concepts of layer , component different, don't replace each other. layer abstraction. abstract business logic database interactions, or http endpoint handlers. layer consists of components. there may multiple components in layer. let's continue concrete examples. have user , group entities in system. have necessary endpoint handlers both, named usercontroller , groupcontroller . these components , form endpoint handle

How to dynamically create a c++ array with known 2nd dimension? -

i have function: void foo(double[][4]); which takes 2d array 2nd dimension equal 4. how allocate 2d array can pass function? if this: double * arr[4]; arr = new double[n][4]; where n not known compiler. cannot compile. if use generic 2d dynamic array, function foo not take it. as asked, best use typedef typedef double four[4]; 4 *arr; // equivalently double (*arr)[4]; arr = new four[n]; without typedef more cryptic double (*arr)[4]; arr = new double [n][4]; you should consider using standard containers ( std::vector , etc) or containers of containers though.

javascript - Use the pipe character in an Angular Filter expression -

i use '|' character in angular 1 filter expression lie {{ ctrl.items | map: 'name|id' | join: ',' }} is there kind of character escaping use? know | character used calling filter, use concat 2 properties 'name' , 'id'. and yes, know write function in controller concatenate 2 properties i'm interested if there way in expression. ps: filter map , join repo: https://github.com/a8m/angular-filter update : in controller: ctrl.items = [{ name: 'ape', id:1 }, { name: 'john', id:2 }]; in template: <input type='hidden' value="{{ ctrl.items | map: 'name|id' | join: ',' }}" > expected output: <input type='hidden' value="ape|1,john|2" > you have create custom filter form value mentioned you. var app = angular.module('myapp', []); app.filter('map', function() { return function(input, propname) { var prop = propname.split

c - Scanning double number in a matrix -

Image
i scan matrix text file seems code wrote works integer not float. #include <stdlib.h> #include <stdio.h> #define max 10000 int main(void) { file *fp; int i, j; char s[max], ch; if ((fp = fopen("3.txt", "r")) == null) { printf("can not open file!\n"); exit(1); } int row = 0; while (fgets(s, max, fp) != null) //count line row++; rewind(fp); // int col = 0; //count col while (ch != '\n') //(ch=fgetc(fp))!='\n'&&(ch=fgetc(fp))!='\r' { if (ch == ' ') col++; ch = fgetc(fp); } col++; // double** jz = malloc(row * sizeof(double*)); //allocate spaces (i = 0; < row; i++) jz[i] = malloc(col * sizeof(double)); rewind(fp); (i = 0; < row; i++) //read in data (j = 0; j < col; j++) { if (!fscanf(fp, "%lf", &jz[i][j])) { break; } } (i = 0; < row; i++) //print matrix (j = 0; j < col; j++) {

javascript - Why does Animate marginLeft does not work? -

i'm building slider animating marginleft not work , can't figure out why. a fade opacity doesn't work also. $currentslide.find('.content').animate({ marginleft: '-100%', opacity: 0 }, speed); settimeout(function() { $currentslide.removeclass('active'); $nextslide.addclass('active'); $nextslide.find('.content').animate({ marginleft: '0%', opacity: 1 }, speed); }, speed); here can see 2 slides ( $currentslide , $nextslide ) first slide should fade out animating marginleft -100% , second slide sould vice versa. [edit] sliding click on white bars example: https://codepen.io/anon/pen/dpnrqq [edit]: example me doesn't should work! failure found: change $currentslide.find('.content').animate to $currentslide.find('.slide-content').animate

pointers - F# - Do ref cells need to be deleted explicitly? -

are ref cells pointers in sense reference data on heap, , need explicitly deleted? examples i've seen online don't have explicit delete calls. are ref cells pointers in sense reference data on heap, , need explicitly deleted? no. f# runs on clr, manages memory automatically via garbage collector. memory resources, ones use heap, not need explicit cleanup developer, , in fact, there no mechanism can explicitly delete specific object. instead, reference cell become eligible garbage collection when there no more references it. sometime after that, cleaned automatically gc. this true types generate in f#, well, such records, discriminated unions, classes, etc.

javascript - how to change baseUrl path in init.js -

i need define nodejs library (from pr_name/node_modules/lib_name ). @ pr_name/static/js/init.js file defined baseurl path: baseurl: 'static', then defined paths @ static dir. how can add node library different path? require.config({ baseurl: 'static', paths: { 'jquery': 'libs/jquery/dist/jquery.min', 'jquery.maskedinput': 'libs/jquery.maskedinput/dist/jquery.maskedinput.min', 'bootstrap': 'libs/bootswatch-dist/js/bootstrap.min', 'xlsx-chart': '???' // <-- not @ static @ node_modules } upd. 'xlsx-chart': '/node_modules/xlsx-chart/chart', and 'xlsx-chart': '../node_modules/xlsx-chart/chart', both gives me error @ browser console. require.js:165 uncaught error: script error "xlsx-chart", needed by: export-stats where export-stats has xlsx-chart require: define(['xlsx-chart'], function(x

dom - Parse text and link pairs from HTML into PHP array with same order -

consider html, littered whitespace or irrelevant tags div , span : <div> <span><a href="#1">title 1</a></span> <p>paragraph 2</p> <p>outside 3 <a href="#4">title 4</a> </p> </div> how can convert php array of link , text pairs, in same order in html. {"#1", "title 1" }, {null, "paragraph 2"}, {null, "outside 3" }, {"#4", "title 4" }, the problem dom searches $html->find("a, p") capture 4 twice, once , once inside 3. i'm wondering if solution traverse document "linearly", human read element element left right, , if node has text, pick parent node's href , if any. if viable, how go through dom this? have solution, preferably simple html dom parser or simple regexp, alternatively built-in php framework. i @ https://github.com/salathe/spl-examples/wiki/recursivedomiterator r

android - Draw tooltip in drawable -

i want add tooltip button. there easy way this. want draw shape. find methods draw view or suggest add lib. possible draw tooltip(make tooltip xml)? <?xml version="1.0" encoding="utf-8"?> <layer-list xmlns:android="http://schemas.android.com/apk/res/android"> <item android:width="12dp" android:height="12dp" android:gravity="bottom|center_horizontal"> <rotate android:fromdegrees="45" android:pivotx="50%" android:pivoty="50%" android:todegrees="45"> <shape android:shape="rectangle"> <corners android:bottomrightradius="2dp"/> <gradient android:angle="0" android:endcolor="#cc00b8 " android:startcolor="#ef89ff "

linux - How can I disable input using X libraries from a C++ application -

i making application raspberry pi , when application run clicks , keyboard presses aren't contained in application - 'go through' desktop causing other things clicked , typed in behind application. i've found far think need using x11 libraries disable input. can use xinput disable input command line , understand call system( " xinput command disable input" ) xinput doing c functions ideally directly application code. looking @ xinput code, can see xchangedeviceproperty()/xichangedeviceproperty() functions being used can't quite figure out how use these in isolation application.

Query documents with a greater value than the average in ElasticSearch -

i have messages in elasticsearch. have sender of message , length of message in 2 different fields. can average message length grouped message sender following query: post /document/_search?pretty { "aggs": { "app": { "terms": { "field": "message_sender" }, "aggs": { "avg_length": { "avg": { "script" : "doc['message_length'].values[0]?.tointeger()" } } } } } } (note: know looks weird, length of message stored string, that's why have convert integer.) my problem is: how can list out messages longer average of group? if sender_1's average message length 100, list out messages greater that. i trying use selector bucket no results. i'm asking how can have feature similar sql having in elasti

javascript - Angular 2.0.0 with angular-cli 1.0.0-beta.15: using typescript, how to integrate external libraries as in previous versions -

i'm creating application using angular 2 . started using in rc2 phase , after alot of updates made app according released rc got run on angular 2.0.0 final version. as i'm using angular-cli , updated latest version ( 1.0.0-beta.15 ). did required changes needed e.g. uses webpack instead of systemjs. my problem is, can't seem find way include external libraries (lets take jquery example) application without need include cdn. in previous versions of angular 2 there angular-cli-build.js this: var angular2app = require('angular-cli/lib/broccoli/angular2-app'); module.exports = function(defaults) { return new angular2app(defaults, { vendornpmfiles: [ 'systemjs/dist/system-polyfills.js', 'systemjs/dist/system.src.js', 'zone.js/dist/**/*.+(js|js.map)', 'es6-shim/es6-shim.js', 'reflect-metadata/**/*.+(js|js.map)', 'rxjs/**/*.+(js|js.map)', '@angular/**/*.+(js

java - How to set a cell editable when row is selected in WLISTBOX ZK? -

i want make specific cell editable when row selected in wlistbox in zk framework? because there no answer of wanted mvvm or mvc decided go mvvm. here working fiddle. i'm pasting important code here when link shouldn't work anymore : <listbox model="@load(vm.items)" selecteditem="@bind(vm.selected)" hflex="true" height="300px"> <listhead> <listheader label="name" width="80px"/> <listheader label="price" align="center" width="80px" /> <listheader label="quantity" align="center" width="80px" /> </listhead> <template name="model" var="item"> <listitem > <listcell> <label visible="@load(vm.selected ne item)" value="@load(item.name)" /> <textbox visible="

java - Using JAXB binding extensions in wsimport -

i know how enable extensions in plain jaxb bindings file - list them in root element's extensionbindingprefixes : <jaxb:bindings version="1.0" xmlns:jaxb="http://java.sun.com/xml/ns/jaxb" xmlns:xjc="http://java.sun.com/xml/ns/jaxb/xjc" jaxb:extensionbindingprefixes="xjc" ...> however, jax-ws bindings file doesn't have anywhere put attribute. <jaxws:bindings version="2.0" xmlns:jaxws="http://java.sun.com/xml/ns/jaxws" xmlns:jaxb="http://java.sun.com/xml/ns/jaxb" xmlns:xjc="http://java.sun.com/xml/ns/jaxb/xjc" wsdllocation="../wsdl/schema.wsdl" ...> it cannot go in root, nor in of nested jaxb:bindings elements. how supposed enable binding extensions? example command-line arguments used jaxws-maven-plugin:2.4.1: -keep -s 'target/generated-sources/wsimport' -d 'target/classes' -encoding utf-8 -extensi

Android Instrumentation Test fail on Travis CI AVD but work on local emulator -

if run instrumentation tests on local emulator run 10 out of 10 times when try run same tests on avd in travis ci, randomly failed java.lang.runtimeexception: not launch intent intent { } within 45 seconds. perhaps main thread has not gone idle within reasonable amount of time? there animation or repainting screen. or activity doing network calls on creation? see threaddump logs. reference last time event queue idle before activity launch request xxxxxxx , last time queue went idle was: xxxxxxxxx. if these numbers same activity might hogging event queue. i have tried removing progress bars , still issue happening randomly , on travis. travis.yml looks this: env: global: - android_target=android-19 - android_abi=armeabi-v7a before_script: - android list targets - echo no | android create avd --force -n test -t $android_target --abi $android_abi - emulator -avd test -no-skin -no-audio -no-window -no-boot-anim & - android-wait-for-emulat

jasper reports - How to draw a line for end of the page? -

Image
i working on jasper reports. in reports, want have border style below data ______ ______ ______ ______ |__h1__|__h2__|__h3__|__h4__| | | | | | | | | | | | | | | | | | | | | |______|______|______|______| ----------page footer-------- i bottom border last line of every page. getting ______ ______ ______ ______ |__h1__|__h2__|__h3__|__h4__| | | | | | | | | | | | | | | | | | | | | there needs gap footer cannot use line in page footer. if use line in page footer, last row of report not have bottom border. is there way conditionally enable bottom border based on row being last row of page? draw line columnfooter band , set isfloatcolumnfooter="true" isfloatcolumnfooter=true , render column footer below last detail or group footer on particular column example <?xml versio

Symfony and Monolog - how to make it send everything below WARNING level to stdout and everything else to stderr -

while using monolog in symfony's console commands messages being outputed stderr. how configure monolog make send below warning level stdout , else stderr? the easies way how monolog's (symfony's actually, bridge) consolehandler works: https://github.com/symfony/monolog-bridge/blob/master/handler/consolehandler.php /** * before command executed, handler gets activated , console output * set in order know write logs. * * @param consolecommandevent $event */ public function oncommand(consolecommandevent $event) { $output = $event->getoutput(); if ($output instanceof consoleoutputinterface) { $output = $output->geterroroutput(); } $this->setoutput($output); } so can extend , override behavior store both outputs , decide use here https://github.com/symfony/monolog-bridge/blob/master/handler/consolehandler.php#l153-l160 /** * {@inheritdoc} */ pro

Spark xml processing in a csv file -

i have csv or tab separated file below: 1001,2016-02-23,req,<xmlstring><user><name>name1</name><addr>address1</addr></user></xmlstring>,20.0 1002,2016-02-24,req,<xmlstring><user><name>name2</name><addr>address1</addr></user></xmlstring>,30.0 i want read file , convert each line csv file (including xml attributes) can put hive. like this: 1001,2016-02-23,req,name1,address1,20.0 1002,2016-02-24,req,name2,address1,20.0 how in spark? how read each row , process xml bit , generate output? thanks using rdd = sc.textfile(...) read file each row in tuple. process each line, rdd.map(lambda row: row.split(',')).map(lambda row: yourfilterfunction(row)) with new spark api can read csv files , infer schema think hardcode kind of code. you should learn , read documentation before asking question has been asked thousands of times...

php - If statement never evaluates to true (even when it should) -

i'd created if statement "if ($user_roles == 3) " , $user_roles has value of "3" condition supposed true result false. here code below: public function viewsponsorinfo($sponsor_id) { $id = $sponsor_id; $user_id = user::where('id','=',$id)->get(); $user_roles = []; foreach ($user_id $id) { array_push($user_roles, $id->role); }/* dd($user_roles);*/ if ($user_roles == 3) { $orga = organization::where('orga_id','=',$sponsor_id)->get(); dd($orga); return view('pages.ngo.view-sponsor-information',compact('orga')); }else{ $indi = individual::where('indi_id','=',$sponsor_id)->get(); dd($indi); return view('pages.ngo.view-sponsor-information',compact('indi')); } } $user_roles is not 3 , can never be. it's array. contents, however, can three. try: if(in_array(3, $us

String Output Alignment in Java -

Image
practice question part 1 practice question part 2 this practice question rather hard me. below code static method(the main method fixed -unchangeable, , signature of static method given), , intention matches between characters , print them out. but there concerns: 1) how ensure doesn't print when strings aligned there characters makes boolean false , result not aligned instead? (e.g amgk second string & first string java programming course) 2) how make print right? spaces off , letters aren't wanted. 3) if there more 1 character in str1, choose put, , how omit rest when there match? would appreciate pseudocode guide beginner me in solving problem. public class q3 { public static void main(string[] args) { scanner sc = new scanner(system.in); system.out.print("enter first string:"); string input1 = sc.nextline(); system.out.print("enter second string:"); string input2 = sc.nextline(); system.out.println();

oop - Java architectural class design for a real world senario -

this problem need implement in java: a car can petrol car or diesel car, , hybrid car plugged petrol or diesel not both. also, hybrid car has ability run on electricity, while not using petrol or diesel @ , decided @ run time whether select electricity or other fuel source (petrol or diesel appropriate). here need implement oop concepts in mind example when hybrid car running in petrol mode method in petrol type should invoked if diesel diesel class running method should invoked. i new oop , came following design know it's wrong if 1 can me please. and tried decorator design pattern correct me if deign wrong above scenario.. car interface public interface car { public void running(); } petrol car class class petrolcar implements car{ public void running() { system.out.println("running in petrol"); } } diesel car class public class dieselcar implements car{ public void running() { system.out.println("runni

android - Error when adding RxPresso to project -

i got error message when trying add rxpresso( https://github.com/novoda/rxpresso/ ) project: warning:conflict dependency 'io.reactivex:rxjava'. resolved versions app (1.1.9) , test app (1.0.14) differ. see http://g.co/androidstudio/app-test-app-conflict details. i'm using rxjava 1.1.9. how can add rxpresso in project? thx lot to avoid problems rxjava , android support libraries version, go app/build.gradle file , in dependencies section paste: androidtestcompile ('com.novoda:rxpresso:0.2.0') { exclude group: 'com.android.support', module: 'support-annotations' exclude group: 'io.reactivex' }

Android - Images from an URL through web services according to Screen Density? -

i'm working on android app. pretends many countries, need change icons, , "drawables" according user's country has logged-in app user's country mobile operators, maybe country's flag, etc. i planing restfully through url on web service (using volley). but, talking android's multiple screen densities, don't know if in case "valid" 1 single image size service put on app, or depending on device's screen density request respective images server (if practice). how have proceeded on these cases? comment appreciate, thanks!! i believe case have described valid , approach. you can parse images applicable screen densities on server, pull them app based on file naming or sorting conventions. i.e. density = getdensity -> pull images images/density alternatively, if these images sufficiently small, perform resizing in-app after pull simplify process using bitmapfactory methods.

html - Center container AND use negative margin -

i styling figures. i want make when image smaller text column, figure shrinks size , centers, i'm using: div { width: 20em; margin: 0 auto; background-color: #f8f8f8; } figure { display: table; margin: 1rem auto; padding: 2rem 2rem; background-color: #eee; } figure img { max-width: 100%; margin: 0 auto; } <div><figure> <img src="https://placehold.it/100x100" alt="100x100 placeholder"> </figure> <figure> <img src="https://placehold.it/400x100" alt="400x100 placeholder"> </figure></div> the problem want figure bleed outside column when image size of column. i'd use: div { width: 20em; margin: 0 auto; background-color: #f8f8f8; } figure { display: table; margin: 1rem -2rem; padding: 2rem 2rem; background-color: #eee; } figure img { max-width: 100%; margin: 0 auto; } <div><figure&

sql server - Difference between fetchrow_array and fetchall_arrayref when working with stored procedures -

i have used both fetch result of stored procedure. have noticed fetchrow_array returns output of rows select inside stored procedure. whereas fetchall_arrayref returns status of stored procedure in last row, along selected rows in stored procedure. why have difference , there way avoid getting status of stored procedure inside fetchall_arrayref? my stored procedure create procedure [dbo].[check_date_proc] @datestart datetime begin select check_date date_table data_date = @datestart end; go and call exec check_date_proc '20160920'; fetchrow_array returns 20160920 fetchall_arrayref returns 20160920 0 thanks depending on database type working (and depending on perl dbd driver), getting multiple result sets. there way processing multiple result sets (for ex., if have executed 2 statements have resulted in 2 result sets; , want both of them). look here sample code. since, in case, want ignore status of stored

Firebase unable to write Security Rules for Unique Data -

i want vannumber unique //vanwithagent after root "/vanwithagent" vanwithagent : { "-kshjydyi49rpzwskdg1" : { // "agentmobile" : "sdfs", "agentname" : "sdfsdf", "isagentassignedwithtask" : false, "vanname" : "fsdf", "vannumber" : "sf", "vanpresentlocation" : { "currlattitude" : "n/a", "currlongitude" : "n/a", "pin" : "n/a" } } } rules have written: { "rules": { //rules ".read": "auth != null", ".write": "auth != null", "vanwithagent": { "$vanwithagentid": { "vannumber":{ ".validate":"!(root.child('vanwithagent').child(data.child('vannumber').val()).exists())"

xml - Enforcing validation of a secondary attribute based on another attribute in XSD -

question is there way enforce subtype "percent" if basetype "percent" ? i mean, have validation fail if basetype "percent" subtype isn't "percent" ? xml partial <quantity name="abc" basetype="percent" value="2" subtype="percent"/> xsd pertinent sections <xs:element name="thing"> <xs:complextype> <xs:attribute name="name" type="xs:string" use="required"/> <xs:attribute name="basetype" type="basetype" use="required"/> <xs:attribute name="value" type="xs:double" use="required"/> <xs:attribute name="subtype" type="subtype" use="required"/> </xs:complextype> </xs:element> <xs:simpletype name="bas

grails - create-app creates the application in the current directory -

i'm using latest grails version (3.1.12) , following official getting started guide . i'm stuck @ 2.3 creating application . c:\users\xehpuk\grails-apps>grails | enter command name run. use tab completion: grails> create-app helloworld | application created @ c:\users\xehpuk\grails-apps | resolving dependencies. please wait... these new contents of c:\users\xehpuk\grails-apps : .gitignore build build.gradle gradle gradle.properties gradlew gradlew.bat grails-app src obviously, command create-app creates app in current directory instead of subdirectory helloworld , if had used option --inplace . why , how change this? the issue using create-app command within grails shell , shouldn't be. the create-app command should run command line of os such: grails create-app helloworld

wordpress - Everytime a new wp multisite is created blank admin screen -

everytime create new site in multisite wordpress installation wp-admin screen blank why? white screens php errors. try debug , see are. see https://codex.wordpress.org/wp_debug add define( 'wp_debug', true ); define( 'wp_debug_log', true ); define( 'wp_debug_display', false); in wp-config.php , debug.log file in wp-content. change "display" line true define( 'wp_debug_display', true); to dump them browser log them.

jquery - Dynamic id for div tag in partial View -

i trying add partial view dynamically main view. problem not able dynamic id div tag in partial view when add main view multiple times. as not able id, unable hide partial view based on div tag. can please suggest me missing. in advance help. below piece code: partial view: <div id=@viewbag.divactionid> <div id="div_actionsbtns"> <img src="~/images/trash.png" alt="delete" class="editbtn" id="btn_actiondelete" /> <img src="~/images/move.png" alt="move" class="editbtn" id="btn_actionmove" /> </div> <div id="div_editactions"> ...... </div> </div> <script> jquery(document).ready(function ($) { $('#btn_actiondelete').on('click', function () { var divparent = $('#div_editactions').parent().attr('id'); $('#divparent&

github - Is my AdMob ad unit id a piece of "private information" -

i don't know this, really. have never heard people talking ad unit ids, think is kind of "private" , should not disclosed? is ad unit ids piece of private information? happen if do disclose id? ok? yes , should never share or post online. use ad unit id spam requests , admob account flagged or banned. your ad unit id contains admob developer id. example, ca-app-pub-[developerid]/[adid] . i'm not sure how information harm exactly, unique you.

c++ - Resolve build errors due to circular dependency amongst classes -

i find myself in situation facing multiple compilation/linker errors in c++ project due bad design decisions (made else :) ) lead circular dependencies between c++ classes in different header files (can happen in same file) . fortunately(?) doesn't happen enough me remember solution problem next time happens again. so purposes of easy recall in future going post representative problem , solution along it. better solutions of-course welcome. a.h class b; class { int _val; b *_b; public: a(int val) :_val(val) { } void setb(b *b) { _b = b; _b->print(); // compiler error: c2027: use of undefined type 'b' } void print() { cout<<"type:a val="<<_val<<endl; } }; b.h #include "a.h" class b { double _val; a* _a; public: b(double val) :_val(val) { } void seta(a *a) { _a = a; _a->print();

c# - Can't find parameter on querystring -

i have query string in parameter want between apostrophes : select * mytable t t.name= ':name' however when debugging code tells me not find parameter : protected bool validname(string n, nhibernate.isession sesion){ var result= sesion.createsqlquery(queries.getquery("queryname")) .setparameter("name", n) .uniqueresult(); the query parser should apply sql statements your. try doing query this: select * mytable t t.name = :name i recommend using hql , sample: var result = session.createquery("from entity t t.name = :name") .setparameter("name", n) .uniqueresult(); where entity entity references table (by mapping).

java - How to make EL relational operators to work on Tomcat 8/JSTL 1.2 -

this question has answer here: comparing numbers in el expression not seem work 2 answers i'm having strange behavior since our upgrade tomcat 6 tomcat 8.0.32. relational operators (<, >, <=, >=) not working variables defined c:set public class serviceconstants { public static final integer my_const = 15; } below code (updated): <%@ page iselignored="false"%> <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> <c:set var="a" value="<%=serviceconstants.my_const%>"/> <c:set var="b" value="${127}" /> <html> <body> <br/>a: ${a} <br/>b: ${b} <br/>using variables {b > a}: ${b > a} <br/>using variables {b gt a}: ${b gt a} <br/>hardcoded values {127 > 15}: ${127 > 15} </body> <

PostgreSQL: calculating multiple averages in one query -

i'd calculate average amount of money spent per day past 7, 30, 90 , 180 days. know how using pl/pgsql, i'd prefer in 1 query if possible. this: select sum(amount)/days transactions created_at > current_date - ((days || ' day')::interval) , days = any(array[7,30,90,180]); error: column "days" not exist you can use unnest convert array table , use correlated subquery calculate average: select days, (select sum(amount)/days transactions created_at > current_date - ((days || ' day')::interval) ) average unnest(array[7,30,90,180]) t(days)

javascript - jQuery code doesn’t work properly after submitting Ajax.BeginForm in asp.net mvc -

i tried minimize huge problem small 1 created new sample web project; mvc-empty in vs. created 1 view named „index” in home controller. index view code: @model webapplication16.viewmodels.home.indexvm @{ viewbag.title = "index"; } @html.partial("~/views/home/_orders.cshtml", model.orders) @section scripts{ <script src="~/scripts/jquery.validate.js"></script> <script src="~/scripts/jquery.validate.unobtrusive.js"></script> <script src="~/scripts/jquery.unobtrusive-ajax.js"></script> <script> $("#type").change(function () { $('#order-current > img').remove(); var currentorder = "#type_" + $("#type").find('option:selected').text(); var $img = $(currentorder).clone(); $img.removeclass("hidden"); $("#order-current").append($img);

google chrome - How to create buttons and text enters with javascript in scripts. (Tampermonkey) -

im creating scripts (javascript) using tamper monkey. used scripts on platform create buttons , boxes enter text on website want script happen (for example creating button on google.com , when clicked function). have few examples tube mp4 converter thats directly on youtube website itself. (if helps) if requires html or css in not familiar languages. how create buttons , text boxes script put javascript code? script this code create button ( add javascript button using greasemonkey or tampermonkey? ) : // ==userscript== // @name _adding live button // @description adds live example button, styling. // @include https://stackoverflow.com/questions/* // @grant gm_addstyle // ==/userscript== /*--- create button in container div. styled , positioned css. */ var znode = document.createelement ('div'); znode.innerhtml = '<button id="mybutton" type="button">' + 'for pete\'s sake, don

php - Troubleshooting composer: classes not autoloading with CodeIgniter 3 -

problem i trying use paypal checkout rest sdk requires paypal library autoloaded through composer. have gone through steps enable composer in codeigniter 3 when go controller autoloading paypal\rest\apicontext class following error: fatal error: class 'paypal\rest\apicontext' not found in c:\xampp\htdocs\php\toucan-talk\app\modules\paypal\controllers\paypal.php on line 15 what have far here composer.json file { "require": { "paypal/rest-api-sdk-php" : "*" } } i have set $config['composer_autoload'] = true; in config.php file. here controller <?php use paypal\rest\apicontext; class paypal extends mx_controller { public function __construct() { $api = new apicontext( ); var_dump($api); } } question how troubleshoot composer , autoloader can pinpoint autoload process failing. well here solution: in config.php instead of setting... $config[&#

arrays - Using a class function inside another function in the same class in C++ -

how go using function swap inside class function rotate matrix? haven't been able find answers this. void matrix::swap(int& a, int& b) { int temp = a; = b; b = temp; } void matrix::rotatematrix() { int n = m_matrixsize; int level = 0; int last = n-1; int numoflevels = n/2 ; while(level < numoflevels) { for(int = level;i < last; i++) { swap(matrix[level][i], matrix[i] [last]); swap(matrix[level][i], matrix[last][last - + level]); swap(matrix[level][i], matrix[ last - + level][level]); }//end ++level; --last; }//end while }//end rotatematrix like mentioned above had use scope operator in front of swap. matrix::swap, fixed problem. had name of array incorrectly labeled.

javascript - How to wait for a function to finish its execution in angular 2.? -

below code, want login() , authenticated() functions wait getprofile() function finish execution. tried several ways promise etc. couldn't implement it. please suggest me solution. import { injectable } '@angular/core'; import { tokennotexpired } 'angular2-jwt'; import { myconfig } './auth.config'; // avoid name not found warnings declare var auth0lock: any; @injectable() export class auth { // configure auth0 lock = new auth0lock(myconfig.clientid, myconfig.domain, { additionalsignupfields: [{ name: "address", // required placeholder: "enter address", // required icon: "https://example.com/address_icon.png", // optional validator: function(value) { // optional // accept addresses more 10 chars return value.length > 10; } }] }); //store profile object in auth class userprofile: any;

c# - When working base and derived classes what is the best way to deal with AppSettings, that will allow for testability -

i hope decent question, background have abstract base class, base class has concrete method implementations accessible derived classes. base class , of derived classes have set of unique variables. of common functionality in concrete methods of base class (which not virtual cannot overridden) each of derived classes getting of these values appsettings in app.config file. so question this, best place put these const values following best practices , allow code testable (this last piece important)? the 2 options know are: 1) create static config class has of values each of classes. great normal consts, retrieving app.config values fail unless, either test project has values in own app.config file (this seems dirty hack me) 2) other option declare them , values settings in using class, adheres declare use principle, makes class un-testable unless again add values app.config of test project. public abstract class baseclassa { private const string path = "\parentcla