Posts

Showing posts from March, 2013

apache configuration for simple python run in kali linux through php script -

Image
the problem: how apache configuration simple python program run in kali linux through php script. i tried shows blank window. php script: <?php $co = escapeshellcmd('/root/desktop/python1.py'); $op = shell_exec($co); echo $op; ?> in var_dump shows null. me.. you want point shell program <?php $co = escapeshellcmd('/bin/sh /root/desktop/python1.py'); $op = shell_exec($co); echo $op; ?> or use python self $co = escapeshellcmd('/usr/bin/python /root/desktop/python1.py'); ps when know command, escapeshell redundant, can use shell_exec directly <?php $op = shell_exec('/bin/bash /root/desktop/python1.py'); echo $op; ?>

php - Regex that finds JSON string inside another string -

i extract json string within string. currently getting full string using file_get_contents , running following pattern on string: https://regex101.com/r/5jauco/1 pretty gives multiple matches. i extract json string saved in window._shareddata haven't been able achieve that. have idea how that? why not include _shareddata in regex like? _shareddata\s*=\s*\{.+\} or lookbehind: (?<=_shareddata\s=)\s*\{.+\} or take json capturing group: _shareddata\s*=\s*(\{.+\}) one concern lookbehind if add additional whitespace character between _shareddata , = won't match. this works since there no linebreaks in json.

Change state of a parent from the child in ReactJs -

supposing have parent component. parent.jsx render() { const headers = ["id","desc1", "desc2", "actions"]; return( <div> <input type = "text" placeholder = "product brand" value={ this.state.desc }/> <input type = "text" placeholder = "product brand" value={ this.state.desc2 }/> <button type = "button" onclick = { this.handlesubmit.bind(this) }>add</button> <customtable mystate = { this.state } header = { headers } data = { this.props.store.productbrandlist }/> </div> ) } and customtable.jsx renderheaders(){ return( this.props.header.map(function(header, index){ return <th key={index}>{header}</th> }) ) } renderrows(){ // console.log("here1"); // return( // <listitem datarows = { this.props.data

php - how to i calculate the total sum -

as title stated; how calculate total when user checked multiple checkboxs on selected hotel? and how make whenever total added , current total (which in mysql) exceed 500k, alert pop saying budget exceeded thanks you! code: <?php require ("config.php"); $link = mysqli_connect($h,$u,$p,$db) or die(mysqli_error()); $query = "select bil, hotel, total, address hotels" or die(mysqli_error()); $result = mysqli_query($link,$query); echo "<table border=2>"; echo "<tr><th><b>hotel</th><th><b>total(rm)</th><th>address</th></tr>"; while ($row = mysqli_fetch_array($result)) { echo "<tr><td>$row[hotel]</td>"; echo "<td>rm $row[total]</td>"; echo "<td>$row[address]</td>"; echo "<td><a href='delete.php?del=$row[bil] '&g

c# - Entity Framework Navigation Property with Composite Foreign Key -

ef 6.1.3. i have domain contains many instances of "header/ item" type pattern, header can have many items (1 many), , has "current" or "latest" item. this represented follows: header guid id guid currentitemid item currentitem icollection<item> allitems item headerid id the pk of items headerid + itemid. reason being that, far, common access pattern items list items related given header, , having headerid first part of pk/clustered index means data clustered index seeks. our problem when use currentitem navigation property, ever uses itemid lookup, results in not great query plans. i assume because conventions ef use currentitemid currentitem. question is, there way tell ef perform joins currentitem mapping header.id,header.currentitemid -> item.headerid,item.id? i believe slight different scenario 1 described here: composite key foreign key in case, have 1 one mapping not 1 top many, , there doesn

In Perl, how do I reference a value within a loop after I exited a loop still in another loop -

i've been working on days. so, project work protein data bank files (*.ent) using perl. have whole huge directory full of them, , need calculate distance between atoms cd1 , od2. if od2 not present, calculate distance between atom cd1 , oe2. never both atoms present in file. isn't issue me now, can directly print out values in each file within if , elsif condtional. but when exit if/elsif conditional, memory of values in each file, goes away. again, i've done lot of hard work open whole loop of files print solutions each file. essentially, in order calculate distance, need calculate radial distance 2 points: p(x1,y1,z1) , q(x2,y2,z2), point p x,y,z coordinates of cd1 atom, , point q x,y,z distance of od2 or oe2. called them alternatives cd1 atom coordinates. pq distance = sqrt[(x2 - x1)^2 + (y2 - y1)^2 + (z2 - z1)^2] in order deal 800 (*.ent) files, used foreach loop iterative on files in directory, , while loop loop through them. there several columns of *.ent

c++ - fill a mulit-dimentional matrix with uniformly distributed random numbers with diffierent ranges -

i want fill 10000x2 matrix in opencv (v3.2) random numbers in uniform distribution different ranges each column , here problem following code: mat centers(10000, 2, cv_32f); rng rng(time(null)); rng.fill(centers, rng::uniform, scalar(0, 0), scalar(10, 1000)); i expect first column randomly filled values between 0 , 10 , second column filled values between 0 , 1000. both columns filled values between 0 , 10, decided implemented in following form. mat centers(10000, 2, cv_32f); rng rng(time(null)); rng.fill(centers.colrange(0, 1), rng::uniform, 0, 10); rng.fill(centers.colrange(1, 2), rng::uniform, 0, 1000); but not work either. think because rng::fill not support noncontinuous matrices (which not mentioned in documentation) remaining way use loop waste of time , performance. doing sth wrong above or should give , use loop you have misinterpreted api documentation of rng::fill() , defines parameters , b as: a - first distribution parameter; in case of uniform d

java - How to ignore error in JDBC's executeBatch function -

i want insert data rdbms(mysql5.7, jdbc5.1), , using executebatch speed up. found when 1 insert sql of batch of statement cannot execute properly, remain ignored. have not expectd. want let rdbms ignore error sql , continue execution. can tell me should or show me right documentation url. , glad help! and know "insert ... on duplicate key ... " can ignore duplicate key error , want 1 more general solution. mysql jdbc doc connection connection = getconn(); statement statemenet = connection.createstatement(); (searchuseritem user: result.getitems()) { string query = "insert table values(some_values)"; } int[] re = statemenet.executebatch(); ananlysebatchresult(re); statemenet.close(); connection.close();

python - Fill an existing numpy array with a scalar function -

i have 1 dimensional numpy array needs refilled data. data @ given index computed function foo what have like for in in range(n): arr[i] = foo(i, state) this performance bottleneck of code. considered numpy.fromiter returns new array everytime. rather reuse array save space , time.

c - I am generating signal and facing the strange behaviour -

i have started getting hands of signals in linux here strange behavior happening in code. have started , searched have not found anything, sorry if question lame, here code- void handler(int sig ){ printf("inside handler\n"); } int main(int argc, char * argv[], char * envp[]){ if( signal(sigint, handler) ==sig_err ) exit(exit_failure); for(size_t = 0; ; i++){ printf("%d\n", i); sleep(2); } } i know printf , signal calls not idea use have not studied sigaction till now. according book , others tutorial if press ctrl+c has call handler every time here strange thing: when pressing ctrl+c once, it's calling handler next time it's terminating program. why strange thing happening? the manual page signal syscall says: if signal signum delivered process, 1 of following happens: if disposition set sig_ign, signal ignored. if disposition set sig_dfl, default action associated signal (se

machine learning - how to set train batch size when using input_fn in tensorflow -

in tensorflow estimator/estimator.py , function fit , partial_fit , predict , on, says when using input_fn , batch_size must none. so, set batch_size. in code, input_fn needed because use select features origin data. thanks.

jquery - Create plugin for Umbraco -

i new umbraco , cannot find links on creating plugin umbraco. i have created plugin , contains jquery code. have integrate in umbraco cms. the plugin load on content edit pages work on input fields. i need integrate in umbraco admin screen of user add license key , other information. can provide link or tutorial me out in this. i have looked packages well, how manage screen in umbraco plugin screen. in umbraco, piece sounds hoping create entering license info called "dashboard". @ least that's first way go doing that. here's documentation extending backoffice dashboard: umbraco - extending backoffice - dashboards to inject js umbraco backoffice, need create new plugin folder in app_plugins folder , add package.manifest file register of pieces of plugin in umbraco. if add package.manifest, inject javascript umbraco backoffice: { javascript: [ '~/app_plugins/myplugin/myplugincontroller.js' ] } i wrote quick/sloppy plu

android - Not able to build Ionic 2 project -

i migrated ionic 2 project latest version (i.e, 3.0.0). perfect until, generated new page ( discountoption ) in project today. generated 4 files instead of 3 (*.module.ts new one). here code: discount-option.module.ts import { ngmodule } '@angular/core'; import { ionicpagemodule } 'ionic-angular'; import { discountoption } './discount-option'; @ngmodule({ declarations: [ discountoption, ], imports: [ ionicpagemodule.forchild(discountoption), ], exports: [ discountoption ] }) export class discountoptionmodule { } app.module.ts ... import { discountoption } '../pages/orders/biller/discount-option/discount-option'; @ngmodule({ declarations: [ ... discountoption ], imports: [ browsermodule, httpmodule, ionicmodule.forroot(myapp), ionicstoragemodule.forroot() ], bootstrap: [ionicapp], entrycomponents: [ ... discountoption ], providers: [ ... ] }) export class appmodu

How can I connect my MySQL database with Cloud JIRA Database? -

i having 1 asp.net application in used mysql database. mysql database having list of issues in 1 of table. want access database of our cloud jira , want insert issues of mysql db cloud jira db directly asp.net application. is there api available so? best approach fulfill above requirement? if using jira cloud, not able access database @ all. it's part of limitation of cloud. might able use rest api depends on looking achieve exactly. however, recommend find way export issues asp.net application csv file , restore csv file cloud jira since jira has ability create issues excel file. note that, may need contact atlassian support restoring jira csv file since have full control on instances.

office365 - Using Microsoft Graph Explorer to fetch AD users and get Delta changes -

using microsoft graph explorer test delta user functionality. per documentation, should expect next link response each request until navigate users. in final response, should delta link. don't delta link in last response. has got success in using microsoft graph api fetch delta changes? works fine azure ad graph library not new microsoft graph api fetch delta users. you should use beta endpoint if not already. delta feature still in preview. the url https://graph.microsoft.com/beta/users/delta . i'm getting @odata.deltalink property on last page of results there.

java - How to ensure that file is created by me? -

sometimes java program needs send .dll or .so file client computer remote machine. there possibility ensure .dll (.so) file created me , not hacker? firstly, thought digital signature (java.security package) first choice, cannot verify signature in remote machine, because java may not available there. there other choices? what trying achieve knowing non repudiation . is: a service provides proof of integrity (nobody has modified file) , origin of data (you genuine creator of file). an authentication can asserted genuine high assurance. it's not java or c# or language itself, it's concept doesn't depends on programming language using. every language has it's own classes, libraries, mecanisms... dealing that, in better or easier way others. specifically in java, can start taking here . steps need: generate pair of keys (only done once). sign every document create on client side (that ensures nobody can change it, nobody can take it&#

c++ - QT Android app should start just after android boot log -

we trying create qt 5.7 application android m6. our requirement is, our gui application(qt 5.7 application android m6) should start after "android" boot logo. before home screen, need start/lunch our app. could please suggest method how can make happen? development environment: os: andriod m6 board: imx6q-sabre auto qt version - qt 5.7 you should documentation: boot qt boot qt embedded linux built using tools , resources yocto project, , based on yocto's reference distribution (poky).

In kartik/gridview of yii2 export link is not display its shows the #? -

i have written following code export data csv or other format using kartik/gridview plugin in yii2. when click on export button display # sign on each type of export hot fix issue. index.php <?php use yii\helpers\html; use yii\grid\gridview; use yii\widgets\pjax; use app\models\adminusermaster; use yii\helpers\url; use app\models\subadminroles; use kartik\export\exportmenu; /* code design coloumns */ $gridcolumns = [ ['class' => 'yii\grid\serialcolumn'], 'full_name', 'email', ['class' => 'yii\grid\actioncolumn'], ]; /* code create export menu */ echo exportmenu::widget([ 'dataprovider' => $dataprovider, 'columns' => $gridcolumns, 'target' => exportmenu::target_blank,

Simplification of assigning a class to odd elements with jquery -

can me in simplifying below code. all trying replace "feature-overlay-b" class "feature-overlay-r" odd elements. tried using ".feature-box:odd" below worked. avoid adding numbers each time did :p <script> jquery(document).ready(function( $ ) { if ($(".feature-box")[1]){ document.getelementsbyclassname("feature-box")[1].childnodes[1].classname = "feature-overlay-r"; } if ($(".feature-box")[3]){ document.getelementsbyclassname("feature-box")[3].childnodes[1].classname = "feature-overlay-r"; } if ($(".feature-box")[5]){ document.getelementsbyclassname("feature-box")[5].childnodes[1].classname = "feature-overlay-r"; } if ($(".feature-box")[7]){ document.getelementsbyclassname("feature-box")[7].childnodes[1].classname = "feature-overlay-r"; } if ($(".feature-box")[9]){ document.getelementsbyclassna

c# - Optimizing a Unity CharacterSelection -

in game, got teachers make player increase skills. @ moment, there 12 guys, wrote base class them. this class selects correct data own "teacherdataclass". data set index editor. my code: [serializefield] int teacherindex; // set index in editor -> selection of teacher npcteacherdata teacherdata; // data class private void start() { npcteacherdata[] teachers = // collection of teachers { new teacheralchemist(), new teacherblacksmith(), new teacherbowyer(), new teacherbutcher(), new teacherhunter(), new teacherinnkeeper(), new teacherjuggler(), new teachermessenger(), new teacherpriest(), new teachertamer(), new teacherthief(), new teachertownguard() }; teacherdata = teachers[teacherindex]; // right teacher index } so looks fine , works fine. if not want use editor, com

sqlite3 - Entity framework Core ObjectDisposeException: "Safe handle has been closed" -

setup entity framework core 1.1 wpf application .net 4.5.2 the problem: i encountering exception while running query on sqlite database. system.objectdisposedexception occurred hresult=0x80131622 message=safe handle has been closed source=mscorlib stacktrace: @ system.runtime.interopservices.safehandle.dangerousaddref(boolean& success) @ system.stubhelpers.stubhelpers.safehandleaddref(safehandle phandle, boolean& success) @ microsoft.data.sqlite.interop.nativemethods.sqlite3_sqlite3.sqlite3_db_filename(sqlite3handle db, intptr zdbname) @ microsoft.data.sqlite.interop.nativemethods.sqlite3_sqlite3.db_filename(sqlite3handle db, intptr zdbname) @ microsoft.data.sqlite.interop.nativemethods.sqlite3_db_filename(sqlite3handle db, string zdbname) @ microsoft.data.sqlite.interop.versionedmethods.strategy3_7_10.getfilename(sqlite3handle db, string zdbname) @ microsoft.data.sqlite.interop.versionedmethods.getfilename(

android - java.lang.ClassNotFoundException: Didn't find class "com.sun.xml.bind.v2.ContextFactory" -

i facing following issue in android studio please me javax.xml.bind.jaxbexception with linked exception: [java.lang.classnotfoundexception: didn't find class "com.sun.xml.bind.v2.contextfactory" on path: dexpathlist[[zip file "/data/app/pkg.demo-2.apk"],nativelibrarydirectories=[/data/app-lib/pkg.demo-2, /vendor/lib, /system/lib]]]

windows installer - Powershell Get MST Info -

i have read information out of msi applied mst. know how read tables pure msi don't know how apply mst. i used msi: process { try { # read property msi database $windowsinstaller = new-object -comobject windowsinstaller.installer $msidatabase = $windowsinstaller.gettype().invokemember("opendatabase", "invokemethod", $null, $windowsinstaller, @($path.fullname, 0)) $query = "select value property property = '$($property)'" # $query = "select action customaction action = '$($customaction)'" $view = $msidatabase.gettype().invokemember("openview", "invokemethod", $null, $msidatabase, ($query)) $view.gettype().invokemember("execute", "invokemethod", $null, $view, $null) | out-null $record = $view.gettype().invokemember("fetch", "invokemethod", $null, $view, $null) try { $valu

java - Different Link in context menu depending on ImageView Clicked -

i have activity has crests of different teams, when 1 clicked context menu displayed possibility of opening teams wikipedia page on browser. managed create different context menu depending on imageview have no idea how i'm going pass link. ? context_menu.xml <?xml version="1.0" encoding="utf-8"?> <menu xmlns:android="http://schemas.android.com/apk/res/android"> <item android:id="@+id/link" android:title="open wikipedia page" /> </menu> teams class public void oncreatecontextmenu(contextmenu menu, view v, contextmenu.contextmenuinfo menuinfo){ super.oncreatecontextmenu(menu,v,menuinfo); menuinflater inflater = getmenuinflater(); switch (v.getid()){ case r.id.atalanta: menu.setheadertitle("atalanta"); inflater.inflate(r.menu.context_menu,menu); br

java - Operations on the DiscriminatorValue -

i want map 2 classes 1 table , use inheritance represent relationships. e.g. class represents general task type id not equal 3 or 4. class b more specific task type id 3 or 4, code can seen this, @entity @table(name = "task") @inheritance(strategy= inheritancetype.single_table) @discriminatorcolumn(name="task_type_id",discriminatortype= discriminatortype.integer) @discriminatorvalue(value="not 3 or 4") public class { // properties } @entity @table(name = "task") @inheritance(strategy= inheritancetype.single_table) @discriminatorcolumn(name="task_type_id",discriminatortype= discriminatortype.integer) @discriminatorvalue(value="3 or 4") public class b extends { // properties } how handle discriminatorvalue part operations "not", "or"?

android - Adding a button for each group in an ExpandableListView -

i'm using expandablelistview group items , child items generated data get. need button on bottom of each generated group onclicklistener invokes function has know group button affiliated to. adding list_group.xml layout file add button on sample data title -header , adding list_item.xml add every single sample data -textview element. it's first project using android studio , got stuck trying fix problem. here screenshot of how list looks like i'm trying add button button item is. this function fill list data: private void preparelistdata(ccypair[] ccypairs) { listdataheader = new arraylist<string>(); listdatachild = new hashmap<string, list<string>>(); int counter = 0; // adding child data (ccypair p : ccypairs){ listdataheader.add("sample data title"); list<string> tempexpinfo = new arraylist<string>(); temp

ajax - Code 401 when issuing a POST request through Android -

when i'm accessing url postman works fine, through android i'm getting 401 error: 04-07 03:53:26.920 850-1142/system_process i/activitymanager: start u0 {cmp=vems.visioneering.com.vems/.utils.profileactivity} uid 10061 on display 0 04-07 03:53:26.957 26244-26244/vems.visioneering.com.vems v/action id: http://192.168.16.2:8081/vems/rest/ajax/getprofileobj 04-07 03:53:26.962 26244-26273/vems.visioneering.com.vems w/defaultrequestdirector: authentication error: unable respond of these challenges: {} 04-07 03:53:26.962 26244-26273/vems.visioneering.com.vems v/httpresponse: org.apache.http.message.basichttpresponse@83d69b6 04-07 03:53:26.962 26244-26273/vems.visioneering.com.vems v/status code: 401 04-07 03:53:26.963 26244-26244/vems.visioneering.com.vems d/androidruntime: shutting down vm my code is: try { defaulthttpclient client = new defaulthttpclient(); client.getparams().setparameter(clientpnames.allow_circular_redirects, true); httppost httppost = new ht

java - onLocationChanged not being called within the IndoorAtlas location manager -

when testing able receive updates onstatuschanged within ialocationlistener, onlocationchanged not being called. ideas why is? i have followed instructions indooratlas ( http://docs.indooratlas.com/android/dev-guide/getting-user-location.html ) video youtube ( https://www.youtube.com/watch?v=2exkv4xl5rg ) still not able location. do have in area have mapped or should read location no matter am? package com.bignerdranch.android.indoormapping; import android.manifest; import android.support.v4.app.activitycompat; import android.support.v4.app.fragment; import android.support.v4.app.fragmentactivity; import android.support.v4.app.fragmentmanager; import android.os.bundle; import android.util.log; import com.indooratlas.android.sdk.ialocation; import com.indooratlas.android.sdk.ialocationlistener; import com.indooratlas.android.sdk.ialocationmanager; import com.indooratlas.android.sdk.ialocationrequest; public class mappingactivity extends fragmentactivity { private final

css3 - Make !important the whole .class selector -

is possible make entire .class css selector important? i'm thinking in kind of structure: .custom-selector !important { display: inline-block; vertical-align: middle; position: relative; padding-left: 5px; } i don't know if it's possible. no, it's not possible. !important thought instrument of last resort , such should used sparingly. !important ing whole selectors caricature idea.

excel - Running out of VBA Memory -

im running code below, want to. issue having though when keep sheet running period of time 10 min pop error message saying have run out of memory. is there put in code use prevent this? my code below, sub auto_open() call schedulecopypriceover end sub sub schedulecopypriceover() timetorun = + timevalue("00:00:10") application.ontime timetorun, "copypriceover" end sub sub copypriceover() dim lrow long dim ws worksheet set ws = thisworkbook.sheets("orders") application.screenupdating = false srow = 1 5000 if ws.cells(srow, 19) = srow ws.cells(srow, 12).select activecell.formular1c1 = "ready" call schedulecopypriceover elseif ws.cells(srow, 20) = srow ws.cells(srow, 12).select activecell.formular1c1 = "cancel" end if next call schedulecopypriceover end sub sub auto_close() on error resume next application.ontime timetorun

Error when deleting or editing form data from database using PHP and MySQL -

Image
everything in code seems work fine, except when try edit/delete queried data. delete nothing... , edit gives me error shown below: current code: (login/database information missing privacy reasons): // create connection $db = new mysqli($servername, $username, $password, $dbname); // check connection if ($db->connect_error) { die("connection failed: " . $cdb->connect_error); } echo "connected <br>"; $thisphp = $_server['php_self']; if (!isset($_post['btnedit'])) { echo <<<eot <form action="$thisphp" method="post"><br> employer id: <input type="text" name="eid"><br> company name: <input type="text" name="compname"><br> address: <input type="text" name="address"><br> phone: <input type="text"

asp.net - Entity Framework attempting to perform a migration when one is not needed -

i have asp.net mvc web application database built using code first entity framework. made small front-end validation updates application, deployed test environment no issues. on deploying same application live environment application fails "automatic migration not applied because result in data loss." error. i didn't create migrations part of update, nor have migrations been created since application's last deployment either test or live environments - migrationhistory table in each database lists of migrations have been performed far, no migrations outstanding. brought copy of live database down onto development machine testing purposes, error not occur there when using live database same code says needs migrated. i have couple of questions - know circumstances cause kind of issue, , there way resolve without affecting content of live database?

Android WebViewClient: How To Get POST request body -

i have requirement request body post request in our webview . doesn't webresourceresponse in webviewclient.shouldinterceptrequest has method this. has had same issue , how did worked around it? thanks!

angularjs - I am trying to use $resource for fetching data from ASP.NET webApi but it is not working -

Image
i new webapi angular , cannot find proper solution this, please me out , if can please suggest me resources learn topic. productresource.js file: (function () { "use strict"; angular.module('random') .factory('productresource', function ($resource) { return $resource("http://localhost:60208/"); }); }); t.js file var app = angular.module("jobsapp", []); app.controller("jobcontroller", function($scope,$http,productresource) { $scope.jobs = productresource.query(); }); index.cshtml file: <div ng-app="jobsapp"> <div ng-controller="jobcontroller"> <table class="table"> <tr> <th>job id</th> <th>description</th> <th>minimum</th> <th>maximum</th> </tr> <tr ng-repeat="j