Posts

Showing posts from June, 2012

c - About vfork() system call? -

#include <stdio.h> #include<unistd.h> #include<sys/types.h> #include<sys/wait.h> #include<stdio.h> #include<stdlib.h> int main() { pid_t child_pid = vfork(); if(child_pid < 0) { printf("vfork() error\n"); exit(-1); } if(child_pid != 0) { printf("hey parent %d\nmy child %d\n",getpid(),child_pid); wait(null); } else { printf("hey child %d\nmy parent %d\n",getpid(),getppid()); execl("/bin/echo","echo","hello",null); exit(0); } return 0; } output: hey child 4 parent 3 hey parent 3 child 4 hello my question : why "hello" printed after execution of parent process? have started learning vfork(). please me this? after parent process executed, goes wait(null); blocks parent process until child process calls execl() or exit . therefore child process when parent blocked calling

html - Uploading files with AJAX to PHP -

i'm seding data - including files php, if throuh html , post everyting works alright, not while trying upload ajax , wonder why. $scope.aceptar = function() { var form = $('form'); var formdata = new formdata(form); var file_1 = document.getelementbyid('file_1').files[0]; var file_2 = document.getelementbyid('file_2').files[0]; var file_3 = document.getelementbyid('file_3').files[0]; formdata.append(file_1.name, file_1); formdata.append(file_2.name, file_2); formdata.append(file_3.name, file_3); $.ajax({ method: "post", url: "http:dsfs43r4.php", data: formdata, processdata: false, async: false, success: function(data) { console.log(data); }, error: function(data) { alert("error&quo

c# - Sorting IEnumerable<string> -

this question has answer here: natural sort order in c# 12 answers i've got ienumerable<string> values like: pp pp.10.0 pp.6.0 pp.6.1 pp.8.3 kp.10.1 kp kp.3.20 ... etc i'd organize them alphabetically, keeping values double digits (in example above ones 10.0 , 10.1) below ones single digits. in other words, after sorting should this: kp kp.3.20 kp.10.1 pp pp.6.0 pp.6.1 pp.8.3 pp.10.0 i tried simple ienumerable<string>.orderby(x => x, stringcomparer.currentcultureignorecase) doesn't quite work in case. also bear in mind pp , kp parts could have dots in them well, if you're thinking of splitting string. just create own comparer , pass overload of orderby : https://msdn.microsoft.com/de-de/library/bb549422(v=vs.110).aspx for example: ienumerable<string>.orderby(x => x, new mycomparer

jquery - Trigger click of an element on the basis of a button using JavaScript code in HTML markup and/or attribute(s) -

i want trigger click on icon(image) specific class/id using onclick (or using other way) of button. please see image reference. clicking "1" should trigger "2". calling javascript function "launchtopwm" use following code trigger click: $(".custom_toggle_menu_default").trigger("click"); but wondering if can call code or perform fucntionality using click etc, href='javascript:$(".custom_toggle_menu_default").trigger("click");' following code: html 1: <img class="custom_toggle_menu_default" src="cc/tt/uu/images/launchtopwm.png"> html 2: <a id="tsp" class="sp" href="launchtopwm()">cnw</a> give id element , show second anchor through pure javascript. <!doctpe html> <html> <head> <title> button style </title> <style> </style> </head> <body

c# - How do I handle the whitespaces of a registry path? -

i'm creating process in application makes possible run commands in command prompt. when want export registry key, use reg export path file access registry key , export information file. if use path contains no whitespaces @ all, works fine. use path whitespaces, e.g. hkey_current_user\software\nvidia corporation , not work. i'm appending path string stringbuilder command, string looks this: string path = "hkey_current_user\\software\\nvidia corporation" . do have change string contained in path ? or there special static method can use format string? you need surround path quotes. might help: string path = "\"hkey_current_user\\software\\nvidia corporation\"";

apache - Suddenly 404 errors in cPanel -

we have shared host , want 2 sites on addon domain. the first site no problem second site addon domain ii when go wordpress page, face strange problem , that's problem files too. for example on page: http://song-fa.ir/wp-admin/install.php sometimes page installed , cpanel 404 error page. even static files such js file created error 404 specified in following file: http://song-fa.ir/wp-includes/js/jquery/jquery.js?ver=1.12.4 reset entire host solve problem , installation again perhaps problem solved

linux - Supporting graphpad prism in R and add external library to poratbleR -

are there linux based library dplyr , tidyr? find these r-libraries windows , mac not linux. is possible add external library portabler zip ( http://nafiux.github.io/portabler/ ) file. if yes, how add external library portabler zip file? in our application aws lambda invokes r-script using portabler zip file. want add new external dplyr library portabler zip file.

mysql - My SQL Code for Group wise Summary -

my table this attendance ---------- studentid | date | status -------------------------------- 1 | 2017-01-01 | present 1 | 2017-01-02 | present 1 | 2017-01-03 | absent 1 | 2017-01-04 | presnt 2 | 2017-01-01 | absent 2 | 2017-01-02 | present 2 | 2017-01-03 | absent 2 | 2017-01-04 | presnt i want write mysql query output this. studentid | presentcount | absentcount 1 | 3 | 1 2 | 2 | 2 select studentid, date,status attendance studentid=1 select studentid, date,status attendance studentid=2

android - App is getting crashed when I update app through UpdateManager using hockeyapp -

my android app getting crashed while update app through hockeyapp updatemanager. here update code: private void checkforupdates() { // remove store builds! updatemanager.register(this, getresources().getstring(r.string.hockey_app_id), new updatemanagerlistener() { @override public void onnoupdateavailable() { super.onnoupdateavailable(); // no update available -> load login screen // setfragment(r.id.container_login, new loginfragment()); } @override public void onupdateavailable(jsonarray data, string url) { super.onupdateavailable(data, url); } }, true); } it showing update dialog when clicked update after 100% loading app getting crashed. here crash log: onfatalerror, processing error engine(4) com.google.a

c++ - Set sparsity pattern of Eigen::SparseMatrix without memory overhead -

i need set sparsity pattern of eigen::sparsematrix i know (i have unique sorted column indices , row offsets). it's possible via setfromtriplets unfortunately setfromtriplets requires lot of additional memory (at least in case) i wrote small example const long nrows = 5000000; const long ncols = 100000; const long ncols2skip = 1000; //it's quite big! const long ntriplets2reserve = nrows * (ncols / ncols2skip) * 1.1; eigen::sparsematrix<double, eigen::rowmajor, long> mat(nrows, ncols); std::vector<eigen::triplet<double, long>> triplets; triplets.reserve(ntriplets2reserve); for(long row = 0; row < nrows; ++row){ for(long col = 0; col < ncols; col += ncols2skip){ triplets.push_back(eigen::triplet<double, long>(row, col, 1)); } } std::cout << "filling mat" << std::endl << std::flush; mat.setfromtriplets(triplets.begin(), triplets.end()); std::cout << "finished! nnz " << mat.n

sql - Constraints interdependent tables -

this question has answer here: are circular references acceptable in database? 8 answers i created 2 tables dependent on each other this. create table a(no1 number(2) primary key,no2 number(2)); table created. create table b(no1 number(2) primary key,no2 number(2)); table created. alter table add constraint aa foreign key(no2) references b(no1); table altered. alter table b add constraint bb foreign key(no2) references b(no1); table altered. insert values(10,20); insert values(10,20); error @ line 1: ora-02291: integrity constraint (subk.aa) violated - parent key not found insert b values(10,20); insert b values(10,20); error @ line 1: ora-02291: integrity constraint (subk.bb) violated - parent key not found how insert data in table a , b you create invalid constraints: alter table b add constraint bb foreign key(no2

animation - Qt 5.9.0 QML How to Animate an Image with more than 256 colors (ie not a GIF) using AnimatedImage or otherwise -

i can use animatedimage works on gifs this; import qtquick 2.7 import qtquick.controls 2.2 applicationwindow { visible: true width: 640 height: 480 rectangle { width: animation.width; height: animation.height + 8 animatedimage { id: animation; source: "myanimation.gif" } rectangle { height: 8 width: animation.currentframe/animation.framecount * animation.width y: animation.height color: "red" component.oncompleted: console.log("framecount ", animation.framecount); } } } i lot of error messages too. printed on , over; qqmlexpression: expression qrc:/main.qml:26:20 depends on non-notifyable properties: qquickanimatedimage::framecount i took example code here; http://doc.qt.io/qt-5/qml-qtquick-animatedimage.html which doen't work @ all, wrong putting framecount pro

php - how to export a Json file with phpAdmin without COMMENTS (// ..... */) -

i have .json file exported phpadmin tool. problem json invalid.... ask me how possible phpadmin exports json file not correct? comments in file biggest problem. please me because when attach .json tell me json invalid. , firebase can't use this. it seems can't ignore comment generation in json format, if have access phpmyadmin source code on server can remove comment generation pretty in file phpmyadmin/libraries/plugins/export/exportjson.php see exportheader function , other comments search file // (it's not long). if don't have access phpmyadmin source code may able remove comments after file creation (either manually or program on computer if need once or few times). can use 2 regular expressions that, if need further can post example.

java - The method getPactFile() from the type ConsumerInfo is deprecated -

i've got following 2 lines example: https://github.com/dius/pact-jvm/tree/master/pact-jvm-provider consumer.setpactfile(new file("target/pacts/ping_client-ping_service.json")); testconsumerpact = (pact) pactreader.loadpact(consumer.getpactfile()); they result in message: the method getpactfile() type consumerinfo deprecated what use instead? thanks in advance. if looking verify pact provider using junit, can follow 1 instead: https://github.com/dius/pact-jvm/tree/master/pact-jvm-provider-junit

eclipse - Unable to create project from archetype [org.apache.maven.archetypes:maven-archetype-webapp:1.0 -> ] -

tried create new maven based web project in eclipse (kepler) after selecting " [org.apache.maven.archetypes:maven-archetype-webapp:1.0]" after, haven enter group id=com.weather, artifact id=forecast, , finish i got error in 1 dialogue box as unable create project archetype [org.apache.maven.archetypes:maven-archetype-webapp:1.0 -> ] thanks in advance i able create web project other group id, artifact id i.e. com.codehaus.mojo.archetypes webapp-j2ee14 1.3

javascript - Why would this v-text-field loose its binding and formatting when placed inside a tab Vuetify tab component -

i using vuetify , using tabs component. however, when put v-text-field inside 1 of tabs. load page first time click on text field highlights , bound. click on link go tab 2 click 1 , input disappear. cycle through again , input unbound , unformatted. have idea how to keep bound? this code pen https://codepen.io/jakemcallister/pen/rzalrk bellow code: js var demo = new vue({ el: '#demo', data: { title: 'demo', current_object: { name: 'hello' } } }) html: <div id="demo" v-cloak> <h1>{{title | uppercase}}</h1> <v-tabs light :scrollable="false" transition="none"> <v-tabs-bar slot="activators" class="grey lighten-3 light"> <v-tabs-slider class="light-blue darken-4"></v-tabs-slider> <v-tabs-item key="details" href="#details">

file - how to hide a Folder in android programatically -

i trying develop android application hiding folders. i used file.renameto(new file("." + file.getname())); in log i'm getting folder name prefix dot(.), still folder not hidden. on clicking folder in recycler view trying hide folder clicked. also if folder hidden trying un hide it. foldersholder.folderrow.setonclicklistener(new view.onclicklistener() { @override public void onclick(view v) { file file = new file(foldernames.get(position)); if(!file.ishidden()) { file.renameto(new file("." + file.getname())); toast.maketext(context, file.getname() + " hidden", toast.length_short).show(); } else { file.renameto(new file(file.getname().substring(1))); toast.maketext(context, file.getname() + " shown", toast.length_short).show(); } }

Clojure, Compojure: Reading Post Request RAW Json -

i able read raw json of post request. not sure doing in right way or not? code (ns clojure-dauble-business-api.core (:require [compojure.api.sweet :refer :all] [ring.util.http-response :refer :all] [clojure-dauble-business-api.logic :as logic] [clojure.tools.logging :as log] [clojure-dauble-business-api.domain.artwork]) (:import [clojure_dauble_business_api.domain.artwork artwork])) (defapi app (get "/hello" [] (log/info "function begins here") (ok {:artwork (logic/artwork-id 10)})) (post "/create" params (log/info "create - function begins here , body" (:name (:artwork (:params params)))) (ok {:artwork (logic/create-city (:name (:artwork (:params params))))}))) raw json of post request { "artwork": { "id": 10, "name": "default" } } using line (:name (:artwork (:params params))) fetch "name" value abo

bluetooth lowenergy - BLE iOS background advertising -

is there way "force" ios app (coded ble central) continue perform ble scanning in background if running in foreground? using rssi determine proximity , app must run in background , process rssi levels. note: may or may not know, rssi noisy , needs filtered using many samples possible accurate proximity. have tried connecting , disconnecting app to/from ble peripheral, using approach prevents peripheral advertising while connected the ios app. this, in effect, limits amount of advertising ble peripheral needed other nearby ios devices, ideally, prefer not use method. wish weigh in on question, have access modify or parts of advertising payload ble peripheral. you cannot force ios app against apple's rules. if want continue scanning ble devices, app needs in foreground state. alternatively, can monitor ble devices in background. whenever ble device gets close device, limited time scan devices - in background. let beaconregion = clbeaconregion(proximityuuid:

MySQL data integer to SQL Server datetime type -

i have data exported mysql db xls file. there date column integers (like below). want convert integers sql server datetime type. datecolumn 66478 69035 66478 69400 ... maybe know how convert sql server datetime format?

c# - Invoke Methods having Different Parameters -

Image
i facing 1 issue in invoking different methods having different types of parameter. eg. have 3 methods a, b, c parameters follows. a(string text, int num) b(bool type, int num2) c(string text2, boolean type2, int num3) now how invoke these 3 methods 1 one? method names fetched string , stored in array, , after storing them, methods needs invoked using each loop. you can keep in dictionary method names , parameters string , object[] dictionary<string, object[]> methodsinfo = new dictionary<string, object[]> { { "a", new object[] { "qwe", 4 }}, { "b", new object[] { true, 5 }}, { "c", new object[] { "asd", false, 42 }} }; and invoke them using invoke from methodinfo foreach (keyvaluepair<string, object[]> methodinfo in methodsinfo) { gettype().getmethod(methodinfo.key).invoke(this, methodinfo.value); } if methods in class invoke them this type classtype = type.gettype(&quo

Using checkbox with python and Glade -

Image
i'm new on using glade, yet i've made small examples , have never tried using checkbuttons, , make gui in following image: the idea on , off buttons, print different message depending on checkbuttons selected. i've read what's on site " " , few more, dont have minimal idea how start. have @ least 1 such example: if checkbutton selected print: checkbutton selected , check whether selected or not. to run interface know, did this: from gi.repository import gtk builder = gtk.builder() builder.add_from_file("port_manager.glade") handlers = { } builder.connect_signals(handlers) window = builder.get_object("windowport") window.show_all() gtk.main() can please give me simple example of using checkbox please ? did gui in glade manually not programming. first of all, you're using gtk.builder connect_signals method assumes you've declared signal handler method names (callback methods) via glade. anyway, can progr

c++ - Draw triangle with glDrawArray function -

i want draw triangle in opengl gldrawarrays() function. following code: .cpp file: void linedr2::initializegl() { glclearcolor(0, 0, 0, 1.0); glmatrixmode(gl_projection); glloadidentity(); glortho(-10,10,-10,10,1,10); vertices[0].x = 10; vertices[0].y = 5; // vertex 2 vertices[1].x = -10; vertices[1].y = 3; // vertex 3 vertices[2].x = 5; vertices[2].y = -5; } void linedr2::paintgl() { int num_indices = 2; glenableclientstate( gl_vertex_array ); glvertexpointer( 2, gl_float, 0, vertices); gldrawarrays(gl_triangles, 0, num_indices); gldisableclientstate( gl_vertex_array ); } .header file: #include <qwidget> #include <qopenglwidget> #include <gl/glu.h> #include <gl/gl.h&

emacs - Elisp variable bind to itself -

i have elisp code this: (setq nil) (defun testa (a) (add-to-list "abcd")) (testa 'a) what want make a list ("abcd") since argument name of function testa same variable a , local binding of a in function itself, doesn't bind value outside of function. my question is: feature of elisp can't work around if don't rename variable outside or there neat solution? this intended behavior in elisp. more information on variable scoping elisp, the manual has thorough explanation. this post job of explaining scoping. it not possible pass reference variable. possible pass function returns or modifies globally (or dynamically) scoped variable. possible have function modifies known variable. edit: added more detail.

javascript - Chart not displayed after second set of data added -

this part of grails application. user clicks button create api. sent page fill in data , click execute button. once api done executing redirected page (list.gsp), has chart @ top of it. bar chart displays data. chart should display 1 set of data, when second api executed same chart should redisplay two/both sets of data. what's happening on laptop chart disappears after second api executed. on other developers laptop modified code displays fine. totally stumped on one. had them zip project , send me. ran theirs same results. running same version of java (7)and grails (2.2.5). pointers appreciated! <%@ page import="foo.api" %> <!doctype html> <html> <head> <meta name="layout" content="main"> <g:set var="entityname" value="${message(code: 'default.api.label', default: 'api')}" /> <title><g:message code="default.list.label" ar

python - Facing obstacle to install pyodbc and pymssql in ubuntu 16.04 -

i want install pyodbc connection mssql server using sqlalchemy googling , tried in several ways pip install pyodbc followed link pyodbc installation error on ubuntu 16.04 sql server installed have not solved below type error thrown src/pyodbc.h:56:17: fatal error: sql.h: no such file or directory compilation terminated. error: command 'gcc' failed exit status 1 ---------------------------------------- failed building wheel pyodbc for pyodbc case used command sudo apt-get install unixodbc-dev pip install pyodbc and able success pyodbc installation facing comment problem (not able push data mssql server) for pymssql used command sudo apt-get install freetds-dev pip install pymssql then able success pymssql installation , data insert mssql server

selenium - How to convert a sample vb script code to java code -

i want convert below vb script code java in should check var2 should present in var1 var1=test123 var2=test if instring (ucase(var1),ucase(var2)) <> 0 print "pass" end if this should qualify solution string var1 = "test123"; string var2 = "test"; if(var1.touppercase().contains(var2.touppercase())){ system.out.println("pass"); }

r - Highlighting regions in ggplot2 barplot fulfilling a condition -

Image
i want plot horizontal barplot using ggplot2 , highlight regions satisfying particular criteria. in case, if "term" point "e15.5-e18.5_up_down" has more twice number of samples compared point "p22-p29_up_down" , vice-versa, highlight label or region. i have dataframe in following format: clid clsz goid nodesize samplematch phyper padj term ont samplekeys e15.5-e18.5_up_down 1364 go:0007568 289 20 0.141830716154421 1 aging bp ensmusg00000049932 ensmusg00000046352 ensmusg00000078249 ensmusg00000039428 ensmusg00000014030 ensmusg00000039323 ensmusg00000026185 ensmusg00000027513 ensmusg00000023224 ensmusg00000037411 ensmusg00000020429 ensmusg00000020897 ensmusg00000025486 ensmusg00000021477 ensmusg00000019987 ensmusg00000023067 ensmusg00000031980 ensmusg00000023070 ensmusg00000025747 ensmusg00000079017 e15.5-e18.5_up_down 1364 go:0006397 416 3 0.999999969537913 1 mrna processing bp ensmusg00000027510 ensmusg00

Running Wget in scala build.sbt -

i have requirement need download bunch of jars url , place them inside lib directory , add them unmanaged dependancy. i kind of stuck on how in build.sbt . went on sbt documentation , found processbuilder. in mind, came below code. for(i <- jarurls) { val wget = s"wget -p $libdir $anonuser@$hgrooturl/$i" wget ! } this runs wget on bunch of jars , places file in mentioned folder. pretty simple code, unable run this. error "expression of type unit must confirm dslentry in sbt file". how accomplish this? build.sbt isn't scala file, sbt special preprocessing on (that's why don't have def project = etc). your problem happens because every line of code (except imports , definitions) in build.sbt must return expression of type dslentry sbt sees every line of code setting. when want wget executed? usual way define task : lazy val wget = taskkey[unit]("wget") wget := { for(i <- list(1,2,3)) { val wget = s

How do you export data from Excel into Python using For Loops? -

i have figure out how print data excel spreadsheet using for loop , know export each column different variable can manipulate them, example plot graph using plot.ly what have used far is; import xlrd book = xlrd.open_workbook('filelocation/file.xlsx') sheet = book.sheet_by_index(0) j in range(1,4): in range(2,8785): print "%d" %sheet.cell_value(i,j) which prints numbers spreadsheet terminal not useful. but this; import xlrd book = xlrd.open_workbook('filelocation/file.xlsx') sheet = book.sheet_by_index(0) j= 1: in range(2,8785): time= "%s" %sheet.cell_value(i,j) j= 2: in range(2,8785): sys= "%s" %sheet.cell_value(i,j) which declare different variables each column. understand error message seem using loops wrong, not familiar loops in python, have used them in matlab. * edit * fixed indentation in question, fine in original code, not source of error. i pandas s

java - Error in Navigation drawer/error with Nullpointer exception -

Image
hello programmed quiz 3 activitys: 1 = quizactivity, 2= menu2 , 3= menu3. activity 1 , 2 working fine. problem in menu3. there 1 code of line creating nullpoiner excption: void android.support.v7.app.actionbar.setdisplayhomeasupenabled(boolean)' on null object reference when delete line can start (by clicking item on navigation drawer(leads menu3 activity)) menu3 activity. problem when leave out line "burger icon" (you can see on picture) not there anymore. when leave code of line can`t navigate menu3 because when app force closes. how can solve problem? menu3 java: package amapps.impossiblequiz; import static amapps.impossiblequiz.r.id.nv3; public class menu3 extends appcompatactivity { private drawerlayout mdrawerlayout3; private actionbardrawertoggle mtoggle; @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_menu3); toolbar mtoolbar = (toolbar) fin

java - Spring. How to properly configure WebSecurityConfigurerAdapter when using OAuth? -

i working on own oauth implementation spring boot. using authorization_code flow authorize mobile clients. here configuration: protected void configure(httpsecurity http) throws exception { http .formlogin() .and() .httpbasic().disable() .anonymous().disable() .authorizerequests().anyrequest().authenticated(); } so client calls oauth/authorize endpoint , redirects user login form. once user signs in , allows access, app receives authorization_code authorisation server. however, when requesting token given authorization_code, app receives following response server: full authentication required access resource: oauth/token do guys know why may happen? i have tried curl it: curl -f grant_type=authorization_code \ -f client_id=iosapp \ -f code=sxxr2l \ -f redirect_uri=com.iosapp.myapp://oauthredirect \ -x post http://localhost:8080/oauth/token but got same error: {"timestamp":1500929133281,"status":401,"error":&q

How to use session with angularJS and PHP backend -

i'm developing angularjs application php backend, implemented authentication step, , i'm trying display data of authenticated user in view after authentication. i used session token display user data in other view if did read in tutorials sessions , tokens more 2 weeks, still can't display user data. , error in display.php file: undefined index: token how can manage problem? login.php <?php session_start(); $data = json_decode(file_get_contents("php://input")); $connect = mysqli_connect("localhost", "root", "", "database"); if(count($data) > 0) { $email=mysqli_real_escape_string($connect, $data->email); $password=mysqli_real_escape_string($connect, $data->password); $query = 'select * `client` (emailclient = "'.$email.'" , password= "'.$password.'")'; $q = mysqli_query($connect , $query); if(mysqli_num_rows($q) > 0 ) { $

javascript - Custom metabox with select field allowed to be cloned -

function $this->output_trainer_list() gets list of posts , displays in select field. allow clone field, user can choose more 1 trainer, want allow choose 1 trainer once (if choosen, show disabled). can me? $prefix = 'trainer-'; $meta_boxes[] = array( 'id' => 'trainers', 'title' => esc_html__( 'trainers', 'metabox-online-generator' ), 'post_types' => array( 'xxx' ), 'context' => 'advanced', 'priority' => 'low', 'autosave' => false, 'fields' => array( array( 'id' => $prefix . 'c_name', 'type' => 'select', 'clone' => true, 'max_clone' => $this->count_trainer_list(), 'name' => esc_html__( 'wybierz trenera:', 'me

excel - How to insert new row - xlwings -

what i'm trying achieve extend length of table within current excel form (not appending bottom of whole spreadsheet), while not replacing content below table. to this, want insert new rows (for example on row 30). how can this xlwings? i figured out how can done. unfortunately xlwings doesn't seem have functionality built in, it's possible using api. this how inserted new row: sht.range("30:30").api.insert(insertshiftdirection.xlshifttoright)

lisp - Blocked Matrix Multiplication -

i trying create function performs blocked matrix multiplication in allegrocl, keep getting array-index errors. believe due indicies being 0-19 side of 20 x 20 block matrix, i'm unsure of how fix it. error: array index 20 big dimension 20 while accessing #. [condition type: type-error] any or direction appreciated. below code far. (defun bmmul (a b) (let* ((m (car (array-dimensions a))) (n (cadr (array-dimensions a))) (l (cadr (array-dimensions b))) (u 0) (c (make-array `(,m ,l) :initial-element 0))) (loop p 0 (- m n) (loop (+ 0 1) n (setf u (aref c 0)) (loop k p (- (+ p n) 1) (setf u (* (aref k) (aref b k 0)))) (setf (aref c 0) u))) c)) in general, when looping on array index, go :from 0 :below n , n array dimension, when dimension 20, index goes 0 , including 19. another problem seems in innermost loop, want incf , not setf . n

regex - How to get the last element in Pig Script -

Image
i want last element of line using pig script. cant use $ index of last element not fixed. tried using regular expression not working. tried using $-1 didn't work. posting sample actual file contains more of pid's. sample: msh|�~\&|lab|lab|heath|hea-heal|20247||ou�r01|m1738000000001|p|2.3|||er|er| pid|1|yxq120185751001|yxq120185751001||eljkdp@#pdub||19790615|f||| h lggh vw��zhvw fkhvwhu�sd�19380|||||||4002c340778a|000009561|eljkdp@#pdub19790615f i want ot last value of pid i;e eljkdp@#pdub19790615f have tried below code's not working. code 1: stock_a = load '/user/rt/parsed' using pigstorage('|'); data = filter stock_a ($0 matches '.*pid.*'); msh_data = foreach data generate $2 id, $5 ame , $7 dob, $8 gender, $-1 rk; code 2: stock_a = load '/user/rt/parsed' using pigstorage('|'); data = filter stock_a ($0 matches '.*pid.*'); msh_data = foreach data generate $2 id, $5 ame , $7 dob, $8 gender, regex

count - Optimal way of join with counting Arango -

i wanted write efficent query in arango query language working join counting. in database have users , tags , usertag collections. users , tags connected ' edge ' stored in usertag . want list tags (with data tags collection) , each tag - number of users connected tag . what have (it works): for tag in tags let foronetag = ( v, e, p in 1 outbound tag usertag return {e} ) return {tag: tag.tagname, numberofusers: length(foronetag)} i feel not efficient way regarding time , memory. there more 'arangoic' way of doing it? your query good. 1 small optimisation: use return e instead of return {e} , don't have wrap e inside document because it's document. for tag in tags let foronetag = ( v, e, p in 1 outbound tag usertag return e ) return {tag: tag.tagname, numberofusers: length(foronetag)} alternatively use following query. these query more performant returns tags has @ least 1 con

html - click on Image display image on new window -

i data database in images , other fields, want when click on image open in new window code is <a target="_blank" href="#"> <img alt="" src="<%#"data:image/png;base64,"+convert.tobase64string((byte[])eval("imagedata")) %>"" width="200" height="200" /> </a> what should img pass next window , display large or actual size the href attribute of a tag has contain same filepath src attribute inside img tag. added target="_blank" , image open in new window, in original size, showing nothing else image.

delphi - Why does CM_CONTROLLISTCHANGE performs for indirect parent controls? -

i noticed if have main container/parent ( mainpanel ), adding child panel ( childpanel ), perform cm_controllistchange on mainpanel (in twincontrol.insertcontrol() ) fine. but if insert child control ( childbutton ) childpanel , cm_controllistchange fired again main mainpanel ! why that? expecting cm_controllistchange fire childpanel when inserting childbutton childpanel . mcve unit unit1; interface uses windows, messages, sysutils, classes, graphics, controls, forms, dialogs, extctrls, stdctrls; type tmainpanel = class(extctrls.tcustompanel) private procedure cmcontrollistchange(var message: tcmcontrollistchange); message cm_controllistchange; end; tform1 = class(tform) button1: tbutton; memo1: tmemo; procedure button1click(sender: tobject); private public mainpanel: tmainpanel; end; var form1: tform1; implementation {$r *.dfm} procedure tmainpanel.cmcontrollistchange(var message: tcmcontrollistchange); begin if messa

android - Layout pushes up when keyboard popups -

whole layout pushes when keyboard pops up. xml file contains listview , below 2 buttons, when keyboard popups both listview , buttons pushes up. <?xml version="1.0" encoding="utf-8"?> <linearlayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical" tools:context="com.example.athis.buy.homescreen"> <searchview android:layout_width="match_parent" android:layout_height="wrap_content" /> <listview android:id="@+id/list_item" android:layout_width="match_parent" android:layout_height="0dp" android:layout_margintop="10dp" android:layout_weight="8" android:divide

neo4j - Importing relationships result in error message "Mixing specified and unspecified group belongings in a single import isn't supported -

i'm trying import ~10 million rows neo4j database. i'm able import nodes labels , takes less 5 seconds. however, when i'm trying import relationships it's failing. users.csv header id,"first_name","last_name","email","phone1","phone2","password",is_locked,"created_at","updated_at" roles.csv header "id","tenure_start","tenure_end" user_roles.csv header :start_id(user),:end_id(role) this command i'm using import: bin/neo4j-import --into data/databases/graph.db --multiline-fields=true \ --nodes:user import/users.csv \ --nodes:role import/roles.csv \ --relationships:has_role import/user_roles.csv as bruno , tom pointed out. structure must be users.csv id:id(user-id),"first_name","last_name","email","phone1","phone2","password",is_locked,"created_at","updat

javascript - How to set table data as a variable in java that can be change dynamically? -

how can set table data variable in java, can change dynamically? here @ place of " o positive ", want set variable in java or javascript inside jsp page. so, table data keeps on updating dynamically. what ways it? settings.jsp <tr> <td class="text-left">o positive</td> <td class="text-left">o+, a+</td> <td class="text-left">o+</td> </tr> you can use kind of approach example the html <body data-customvalueone="${beanname.attrname}" data-customvaluetwo="${beanname.scndattrname}"> here regular page main content </body> the javascript <script type="text/javascript" src="//cdnjs.cloudflare.com/ajax/libs/jquery/2.1.1/jquery.js"></script> <script type="text/javascript"> jquery(function(){ var valuepassedfromjsp = $("body").attr("data-customvalueone");

excel - Cannot edit cells after touching combobox - I think i've encountered a bug -

so here building form in excel work ya, , make easy on eyes , fool proof removed 90% of ui. on form put activex combo boxes. perfect, , tried edit cell after entered in data in combo box, low woes couldnt. it seemed touching combo box locked every other cell in form. flabbergasted did experimenting , found way isolate issue. created test environment error(doc linked below). when ui removed clicking combobox locks other cells. when ui there, no issue happens. furthermore seems formula bar being disabled cause. is bug, programming error, or else. i'm @ total lost , appreciate help. my test file, how want try it when in edit mode shift+esc hide ui, when hidden hold shift+ctrl type edit bring ui.

xcode - When i build and run my app i don't have any problems, but when i archive i have error -

my parameters are library setup method: cocoapods library: https://github.com/evgenyneu/auk version of library: 7.0 xcode version. example: 8.3.3 os version: ios 9.0 my podfile is platform :ios, '9.0' use_frameworks! target 'myappname' pod 'alamofire', '> 4.0' pod 'paypal-ios-sdk', '> 2.12.0' pod 'moa', '> 8.0' pod 'auk', '> 7.0' pod 'azsclient' end when build , run app in iphone, don't have problems, when try archive solutions submit in itunes connect have various error: value of type 'uiscrollview' has no member 'auk' use of unresolved identifier 'moa' i tried remove library podfile , install carthage, have same result. can me as suspected, workaround has serious downside: setting strip linked product setting no creates archive not validate when uploaded itunes connect validation apple. got message saying binary had issues: non-p

failure to connect to Google SQL First gen (and Second gen?) -

i receiving error when trying load webpage failed connect mysql: (2005) unknown mysql server host ':/cloudsql/testsite:europe-west1:testdatabase' (2)error: i have google compute engine vm set lamp stack (apache/2.4.10 (debian)/ database client version: libmysql - 5.5.55 / php extension: mysqli) i have set instance on google sql user credentials aforementioned vm (i have set both first gen , second gen) i can access both local mysql database on vm google sql databases via phpadmin installed locally however appear have issue db_host credentials in config.php file when run script path = /var/www/html/includes/config.php i usually local mysql databases use // mysql credentials $conf['host'] = 'localhost'; $conf['user'] = 'yourdbuser'; $conf['pass'] = 'yourdbpass'; $conf['name'] = 'yourdbname'; documentation (and github links) recommend path :/cloudsql/project-id:region:sql-db-instance-na

asp.net mvc - Partial view inside main view + save to DB -

Image
i making site entering metadata. on first tab (css tabs) have few dropdowns , after make choices, second tab unlocked. right second tab empty, , contend supposed go there, have put in view. looks this. now, want achieve - when open second tab view in second picture should shown, loaded @html.partial. so, after make choices in first tab, select 1 of items in list in second tab, , written text in editor, of should saved db. here controller action list in second tab: public actionresult asdf() { list<sims_test> = new list<sims_test>(); using (userscontext dc = new userscontext()) { var languageid = thread.currentthread.currentuiculture.name; if (languageid == "en-us") { = dc.sims_test.where(s => s.languageid == "en-us").orderby(a => a.id).tolist(); } else { = dc.sims_test.where(s => s.languageid == &qu