Posts

Showing posts from May, 2013

How to save output expect in bash -

i trying make script save output of command show version in cisco. i need made connection 1 server ssh connection, , have connection device. in file out.txt, have output of first connection, ssh connection, dont know how save output of show version #!/usr/bin/expect -f #!/bin/sh spawn ssh -l user x.x.x.x expect "login as:" expect "password:" send "password\r" expect "$\r" send "telnet nemonic\r" expect "$\r" expect "login:" send "user\r" expect "password:" send "password\r" expect "*>" send "terminal length 0\r" send "show version \r" expect "*>" set results $expect_out(buffer) set config [open out.txt w] puts $config $results close $config send "exit\r" expect eof send "\r" send "exit\r" could me? best regards i solve log_file -noappend status.txt after command show version thank &a

java - Why isn't a qualified static final variable allowed in a static initialization block? -

case 1 class program { static final int var; static { program.var = 8; // compilation error } public static void main(string[] args) { int i; = program.var; system.out.println(program.var); } } case 2 class program { static final int var; static { var = 8; //ok } public static void main(string[] args) { system.out.println(program.var); } } why case 1 cause compilation error? the jls holds answer (note bold statement): similarly, every blank final variable must assigned @ once; must definitely unassigned when assignment occurs. such assignment defined occur if , if either simple name of variable (or, field, simple name qualified this) occurs on left hand side of assignment operator. [ §16 ] this means 'simple name' must used when assigning static final variables - i.e. var name without qualifiers.

python - ActionPrevious getting an unexpected background -

i've made rule in kv button class have specific background (provided in image). when created actionbar contains actionprevious , actionbutton widgets, both seemed same background. , understand actionbutton instance got background, since inherits button , actionitem classes, why did actionprevious same background? inherits boxlayout , actionitem , neither of have button class. what's reason behind it? also, side question actionprevious has property with_previous which, when set true , adds clickable arrow. however, title of widget remains unclickable. docs property make whole widget clickable. while it's not big deal, i'd rather want entire actionprevious widget background change on press. possible achieve this? mean when press arrow, space around , app icon turns blue, text doesn't, if it's part of different widget. here code visualize question: from kivy.base import runtouchapp kivy.lang import builder kivy.uix.actionbar import actionb

oracle - PL-SQL Delete item from a table of Objects -

i'm trying delete item variable of type table of objects: create or replace type "t_attributepage_attributelist" table of o_attributepage_attributelist; create or replace type "o_attributepage_attributelist" object ( wizattreditid number, internalindex number, dimensionobjectid number, attributename varchar2(50), attributelabel varchar2(50), attributetype number, attributelength varchar2(50), mandatoryattribute number, readonly number, name varchar2(2000), num number, ismodified number, colour number); i'm itterating through list of objects, checked , ls_attr_list.count 16 , try delete 1 item when criteria met error : ora-01403: no data found which raised @ line : ls_attr_list.delete(i); for in 1..ls_attr_list.count loop begin

querydsl - How to perform MINUS operation in elasticsearch -

i'm trying create minus query mysql (dataset1-dataset2) in elasticsearch using querydsl can't find way. anyone show me way? tx in advance you can use bool query must , must not. documentation on bool query you put query dataset1 in must , query dataset2 in must_not: { "bool" : { "must" : { dataset1 } "must_not" : { dataset2 } } } for example: { "query": { "filtered": { "filter": { "bool": { "must": { "range": { "@timestamp": { "lte": 1467811620000, "gte": 1467811520000 } } }, "must_not": { "term": { "_type": "bus-api" } } } } } } } this return documents between 2

ios - Analyse recorded audio file with Swift for speech to text -

i'm able record audio swift ios , play recorded audio file. i'm asking if possible check recorded audio file background noise & volume/decibel can decide enough speech text framework. framework not problem , have researched available ones. i'm curious if can analyse recorded audio file avfoundation or accelerate framework or other framework check if audio file good/clear enough process speech text framework. i don't have lot of audio knowledge i've researched bit , found out can peak , average decibel values while recording background noise? any information helpful analysing recorded audio file swift. snr estimation pretty developed domain. need implement voice activity detector separate noise speech , separately compute noise energy , signal energy , calculate ratio. goes beyond simple math though, need understand statistics implement reasonable algorithm wada snr implemented here . you not able find implementation of in swift, such softwa

Installing additional R build tools manually -

Image
tldr; what rstudio when tells you missing additional build tools , asks if install these? dialogue not working, need install these manually. complete story i've updated to r 3.3.1 rstudio 0.99.902 and yesterday noticed little demo project build process fails. build console looks like: i checked, , it's due r project having data directory example text file in it. rstudio tells me i'm missing additional build tools (i have latest/frozen version of rtools 3.3 installed) , asks me if want install these: however, when press ok , nothing happens. the build tools rstudio referring rtools compiler toolchain used windows systems. can find them at: https://cran.r-project.org/bin/windows/rtools/ given using r 3.3.1, should prefer rtools33.exe . normally, rstudio should attempt automatically download + install rtools when accepting dialog; if it's not, sounds bug.

python - takefocus = NO fails to prevent tkinter.ttk.Notebook tabs from taking focus -

in following example, have set notebook not take focus, tabs skipped on while navigating widget widget using shortcuts supported enable_traversal() . works, not entirely. if tab being displayed (but doesn't have focus), pressing <alt-key> underline-style shortcut gives focus. how can prevent this? from tkinter import * tkinter import ttk root = tk() nb = ttk.notebook(root, takefocus = no) nb.enable_traversal() f1 = frame(nb) b1a = button(f1, text = 'charlie') b1b = button(f1, text = 'delta') f2 = frame(nb) b2a = button(f2, text = 'echo') b2b = button(f2, text = 'foxtrot') b1a.pack() b1b.pack() b2a.pack() b2b.pack() f1.pack() f2.pack() nb.pack() nb.add(f1, text = 'alpha', underline = 0) nb.add(f2, text = 'bravo', underline = 0) why add underline=0 ? remove piece of code in both lines. also, add argument takefocus=false while adding tabs. , remove takefocus when creating notebook.

ios - PHFetchOptions predicate with NSDate compare -

hello had been working photos.framework stuck predicate comparison of phfetchoptions class in documents see can use startdate use in predicate. code @interface viewcontroller () { nsmutablearray * moments; } @end @implementation viewcontroller - (void)viewdidload { [super viewdidload]; // additional setup after loading view, typically nib. moments = [nsmutablearray array]; if([phphotolibrary authorizationstatus] == phauthorizationstatusnotdetermined) { [phphotolibrary requestauthorization:^(phauthorizationstatus status) { [self loadcollections]; }]; }else { [self loadcollections]; } } - (void)viewwillappear:(bool)animated { [super viewwillappear:animated]; [self loadcollections]; } - (nsdate*)dateaddingdays:(nsinteger)days todate:(nsdate*)argdate { nscalendar * gregorian = [nscalendar currentcalendar]; nsdateformatter * formatter = [[nsdateformatter alloc]init]; [formatter se

java - Connection Manage File Throw Exception. please provide solution .thanks -

code-1 : (working fine) package com.connection; import java.sql.*; public class sqlserverjdbc { public static void main(string[] args) { try { string server,user,password,database; int port; string jdbcurl; server="admin-pc"; port =1433; user="sa"; password="admin@123"; database="ordd_login_db"; class.forname("com.microsoft.sqlserver.jdbc.sqlserverdriver"); system.out.println("#- driver load"); jdbcurl="jdbc:sqlserver://"+server+":"+port+";user="+user+";password="+password+";databasename="+database+";"; system.out.println("constring="+jdbcurl); connection con=drivermanager.getconnection(jdbcurl); system.out.println("# - connection obtained"); statement stmt=con.createstatement(); system.out.println

How to manipulate the build result of a Jenkins pipeline job? -

i'm having trouble manipulate build result of jenkins pipeline. i've narrowed down following issue: know why following jenkins pipeline doesn't make build result success? instead build fails. print "setting result failure" currentbuild.result = 'failure' print "setting result success" currentbuild.result = 'success' i guess design, "result can worse" in setresult() : // result can worse if (result==null || r.isworsethan(result)) { result = r; logger.log(fine, + " in " + getrootdir() + ": result set " + r, logger.isloggable(level.finer) ? new exception() : null); } that's bummer

PHP 7 / C get value from HashTable -

i'm trying overwrite , old extension php 5.4 php 7. in old code there function double get_arr_value(char *key, hashtable *table) returns (at least should) value of array double. definition this: double get_arr_value(char *key, hashtable *table) { double val; zend_string *zend_key = zend_string_init(key, 3, 0); if (zend_hash_exists(table, zend_key)) { zval *zv_dest = zend_hash_find(table, zend_key); if (zv_dest != null) { int type = z_type_p(zv_dest); if(type == is_double) { val = (zv_dest)->value.dval; } else if(type == is_long) { val = (double)((zv_dest)->value.lval); } else if(type == is_string) { val = (double)atof((zv_dest)->value.str->val); } } } return val; } any idea where's problem? i'm not c programmer , i'm little bit lost here.

sql server - SQL JOIN doubling values -

Image
i have 2 temp tables following data: temp_aht temp_1 i use query join 2 tables on column incident: select count(distinct a.incident) nr_of_tickets ,a.[service] ,sum(case when a.status_switch in ('assigned » in progress','assigned » pending','assigned » resolved','assigned » closed') a.totalseconds else null end) assignedtime ,sum(case when a.status_switch in ('in progress » assigned','in progress » assigned','in progress » pending','in progress » resolved') a.totalseconds else null end) progresstime ,sum(case when a.status_switch in ('pending » assigned','pending » in progress') a.totalseconds else null end) pendingtime ,sum(b.creation) creation ,sum(b.[call duration]) [call duration] ##temp_aht inner join ##temp_1 b on a.incident = b.incident_id group a.[service],b.creation,b.[call duration] if join tables above query sums won't c

python - socket set blocking raising OSError: [Errno 11] Resource temporarily unavailable -

i creating socket , using communicate python processes. i create socket way because have file descriptor: sock = socket.fromfd(fd, socket.af_inet, socket.sock_stream) if receive lot of requests raise [errno 11] resource temporarily unavailable. when message not fit send buffer of socket, send() blocks, unless socket has been placed in nonblocking i/o mode. in nonblocking mode fail error eagain or ewouldblock in case. select(2) call may used determine when possible send more data. then looks in nonblocking i/o mode , raising eagain error. so set blocking: sock.setblocking(1) but keep having same error. socket.fromfd documentation says: the socket assumed in blocking mode firstly, have no idea "python process" is. process process. language written in, or interpreter may interpreting something, has nothing anything. next, not sure "i create socket way because have file descriptor" means. don't see creating anythi

node.js - AWS Elastic Beanstalk ebextension not executing shell script to use npm install -

i need install separate framework created inside node js application running on elastic beanstalk. i have tried putting scripts inside main package.json file permission errors when installs. so created config file , tried running npm install container_commands. didn't want run npm said command missing. tried adding correct environment path variables npm, work when done manually through ssh, gave same error couldn't find npm command. so finally. i created bash script through ebextension installs application , run script container_commands. the script gets created correctly never runs. if ssh instances , execute manually sudo works. app deploys without erros never seems execute script, know because node_modules folders never created. i'm not sure errors in logs , when tried didn't find useful. here ebextension: files: "/tmp/install_application.sh": mode: "000755" owner: root group: root content: |

formatting - Change the format/style of existing code in Visual Studio; is it possible? -

i have searched , down this, allthe answers find changing auto formatting options visual studio new code. i'm wonder if possible change format of existing code. example: if(myboolean) { return 1; } else { return 0; } becomes: if(myboolean) { return 1; } else { return 0; } is there built in feature missing, or perhaps extension can recommend? for vs2012 tools / options / text editor /all languajes/ tabs , should select (none, block or smart). can choose size of tabs. https://msdn.microsoft.com/en-us/library/ms165330(v=vs.100).aspx . hope helps.

php - REST API - Co-dependent Endpoint Dry Run Flow? -

i'm developing private rest api , running issue of codependency of subresources when posting create parent level resource. for example.. i have following parent endpoint.. /products and following child endpoints relative /products.. /products/[product_id]/categories /products/[product_id]/media /products/[product_id]/shippingzones /products/[product_id]/variants with rest api, /products has ability accept post payload following keys: 'categories', 'media', 'shippingzones', 'variants'. if of these keys set, /products endpoint drill down , create , associate sub resources based on payload keys respectively current post request @ /products. here's code executed on post request /products, showing how presently being handled. i'll issue @ hand after take moment glance through below, maybe you'll see issue before explain it? protected function post() { if (!$this->validatepermissions()) { return;

node.js - gm Error in aws lambda: string yields empty buffer -

i'm trying upload buffer s3 after doing auto-orient transformation using amazon lambda. i'm sending buffer nodejs api so: var data = request.payload; if (data.file) { var media = request.server.plugins.dogwater.media; var name = data.file.hapi.filename; var local_path = "./uploads/" + name; var file = fs.createwritestream(local_path); console.log('adding media...') file.on('error', function(err) { console.error(err) }); data.file.pipe(file); data.file.on('end', function(err) { var pic = { gallery_id: request.params.gallery_id, type: 1 }; console.log("\n\n\ndata.file = ",data.file) media.create(pic) .then(function(media) { httprequest({

javascript - jQuery.parseJSON stop working when passed more data -

i have script query database , echo out json code results. javascript takes , store in variable using jquery.parsejson method populates text box autocomplete. works perfect if return less 30 rows on database query. looks jquery.parsejson method fails when passed more data. how change code make able parse more data? thank help. json code: { "display":true, "url":"http://project-url", "autocomplete": [ { "value":"1", "desc":"ford", "model":"edge", "label":"1 ford edge" }, { "value":"2", "desc":"toyota", "model":"camry", "label":"2 toyota camry" }, { "value":"3", "desc":&qu

sql - Percentage of group total -

Image
i'm trying add new column calculate percentage total of each pack type week. the code below results in following. so new column display percentage of total number of hectoliters specific week. code: set datefirst 1 select datepart (wk, t0.u_orc_be_proddate) [week produced], --display week number of date produced ( case when t5.u_orc_be_name '%cans%' 'cans' when t5.u_orc_be_name '%bottles%' 'bottles' when t5.u_orc_be_name '%key keg%' 'key keg' when t5.u_orc_be_name '%ss keg%' 'ss keg' when t5.u_orc_be_name '%e-keg%' 'ss keg' end )as [pack type], --collate item types pack types sum(t5.u_orc_be_hectoliter * t0.cmpltqty) [total hectoliters] --calculate total hl in order owor t0 inner join oitt t1 on t0.itemcode = t1.code inner join oitm t2 on t1.code = t2.itemcode left join [@orc_be_pack_type] t5 on t5.code = t2.u_orc_be_pac

python 3.x - Is it safe to read a dangerous website with urllib -

some websites can dangerous , see if can understand why so. i've understood such sites considered risky since run malicious javascripts. wonder if safe open dangerous site urllib. i've written following code tries print source code of user input website screen. know if following lead critical issues import urllib urllib import request url = input('url:\n') x = urllib.request.urlopen(url) raw = x.read() try: print(raw.decode('utf-8')) except exception e: print(type(e), e) if type(raw) == bytes: print(raw.decode('latin-1')) we may underline fact each time visit website, website (via access.log) & isp (transparent proxy log + routeur log) & governement (via massive surveillance program) have keep traces of visit - @ least timestamp, public ip adress , url visited- the public ip address point of view start point potential malicious/dangerous things (a man in middle attack example). if know , assume that, can

twitter bootstrap - How to cancel/disable hover and active effects coming from another CSS library? -

i using social buttons bootstrap add social buttons on web site. file css, using font awesome , has around 20+ classes defined various social networks. buttons, defined bootstrap social have hover , active effects. what want disable hover/active effect, buttons become static, i.e. without hover/click functionality. ideally, i'd have css class, "btn-static", cancel style changes coming hover/active effects. is possible? i avoid creating separate css class every social network, or modifying original css file. hoping add custom class cancel hover/active events. for example, here button defined: <span class="btn btn-social btn-facebook"> <span class="fa fa-facebook"></span>facebook </span> i have tried using: .btn-static:active, .btn-static:hover { background-color: none; } and .btn-static:active, .btn-static:hover { background-color: inherit; } but makes button have transparent background. want keep o

xcode - No such module ZFDragableModalTransition in Swift -

Image
i have xcode project. trying run folioreaderkit . i've installed project requirements such cocoapods , carthage , i've fixed errors except zfdragablemodaltransition . i've downloaded , added project on , over, i've added link binary i'm still getting same error. "no such module zfdragablemodaltransition in swift" new in swift , xcode therefore might make mistake didn't manage yet. have suggestion? you can see error attached images. if want run folioreaderkit example project , new swift , xcode suggest use cocoapods instead of carthage. don't have run folioreaderkit.xcodeproj . just go example folder , follow steps: open terminal on example folder; run pod install (you need cocoapods installed); open example.xcworkspace file on xcode , run; to add project using cocoapods create podfile , add: use_frameworks! target 'myapp' pod 'folioreaderkit', '~> 0.7' end then use pod install

Open git bash shell window, execute command and remain after term signal -

i have batch file sets environment opening number of "git bash" shell windows. works apart 1 annoying feature if press ctrl c (or send other term signal) whole bash window close. i want window behave if has been opened , when receives term signal goes bash prompt. here current contents of setup.bat file: c: cd \project\ start "" "%systemdrive%\program files (x86)\git\bin\sh.exe" --login -i -l -c "source ali.sh && mvn spring-boot:run" cd \project2\ start "" "%systemdrive%\program files (x86)\git\bin\sh.exe" --login note first start command runs maven , when want restart command (press ctrl+c) closes whole window. second start command creates new bash window in directory works normal bash window ctrl+c, want have run command @ start. is possible? many help something might work you: c: cd \project\ start "" "%systemdrive%\program files (x86)\git\bin\sh.exe" --login -i -l -c &qu

php - Convert collection of models into an array with id as key -

i using laravel html component create dropdown list groups user can belong. the list of groups comes groups table. currently in controller code looks like $groups = array(); $groupmodels = group::all(['id', 'name']); foreach ($groupmodels $groupmodel) { $groups[$groupmodel->id] = $groupmodel->name; } return view('myview', compact('groups')); and in view have following code create dropdown {!! form::select('group', $groups, null, ['class' => 'form-control']) !!} this works, trying see if there way avoid foreach loop , directly convert list of models array. possible? use pluck() method: $groups = group::pluck('name', 'id'); return view('myview', compact('groups'));

java - Why does JavaFX table.getItems().clear() clear the ObservableList as well -

i've javafx table defined as: tableview<person> table = new tableview<>; //person class contains firstname,lastname & email properties //table has 3 columns first name, last name & email an observablelist of person s observablelist<person> persons = fxcollections.observablearraylist(); a background service, task populate table dynamically adding entries( person objects) observablelist persons . table binded as: table.itemsproperty().bind(service.valueproperty()); everything working fine... i've found if clear table items by table.getitems().clear(); it not clears table, observablelist persons . i'm wondering if bidirectional binding? if unbind before calling getitems().clear() on table, produces same result. explain point i'm not getting here? when set itemsproperty of tableview , doing set reference (pointer) stored in property, point specified observablelist , rather making exact copy of specified list. th

Rails: Using same custom validation method for multiple models -

i have method in 3 models, i'd extract , dry things up. i'm having problem default value of attr. when field empty evaluated empty string "" instead of nil , have write conditional in method avoid adding "http" empty string. where should put method , how can include in models? should optimize method? if so, , how can set default attr value nil (rails/db/both)? before_validation :format_website def format_website if website == "" self.website = nil elsif website.present? && !self.website[/^https?/] self.website = "http://#{self.website}" end end you can put method in app/models/concerns folder, example, validatable module (i.e. validatable.rb ): module concerns::validatable extend activesupport::concern def format_website if website.blank? self.website = nil elsif !self.website[/^https?/] self.website = "http://#{self.website}" end end end and inclu

regex - Split string by keeping "-" in words while eliminating it in other places in Java -

i want split string str = "hello, ,, one-word. yes - no: yea?" string[] parts = [hello, one-word, yes, no, yea] so far, have used str.split("(\\p{punct}*\\s)+")) gives parts = [hello, one, word, yes, no, yea] , , str.split("[\\p{punct}&&[^-]]*\\s")) gives parts = [hello, one, -, word, yes, -, no, yea] . how split str , keeping - s , _ s in words eliminating them , other regex in other places? want eliminate cases of multiple punctuation , white space, such ., , , . you can split using regex in java: "\\s+-\\s+|(?:(?!-)[\\s\\p{punct}])+" regex demo code demo

gulp - My browsersync server refreshes the page but with old content -

what want i want setup gulp bundle files make changes source code , reload browser automatically. i use browser-sync development server, browserify bundle javascript files , gulp task runner. what's problem it worked @ first, when save source file, browser reloaded, old code loaded , change not reflected. need refresh browser manually. i blame factor-bundle browserify plugin, splits bundle 3 bundles - a, b , common (index.js, tests.js , app.js in case actual app code in app.js). what have far gulpfile.js [relevant code only]: the critical code bundletypescript function var gulp = require('gulp'); var browserify = require("browserify"); var source = require('vinyl-source-stream'); var buffer = require('vinyl-buffer'); var watchify = require("watchify"); var sourcemaps = require('gulp-sourcemaps'); var tsify = require("tsify"); var gutil = require("gulp-util"); var browsersync = require

c# - Possible bug in ZipArchive with archive mode update? -

i ran problem ziparchivemode.update if zip file contains "directory entries". i know there no such thing directory entry tools produce entries ziparchiveentry.length = 0 , ziparchiveentry.name = "" directories in zip file. the following code corrupts zip file: using (ziparchive archive = zipfile.open(@"d:\temp\test.zip", ziparchivemode.update)) { } as can see nothing @ except opening zip file ziparchivemode.update , dispose in end. the problem "directory entries" seem treated file entries. in output there new 0 byte entries directory names. i still can open zip file , extract files per drag&drop. attempts extract zip file result in error messages. maybe because there 2 entries same fullname? my workaround avoid ziparchivemode.update , use temporary memorystream . iterate on entries, ignore "directory entries" , copy file entries stream. way worked. is bug in ziparchive or entries directories wrong? if want

c# - Why is this Brush with a #00FFFFFF value not equal to Brushes.Transparent? -

Image
i'm retrieving list of brushes via reflection class. want make sure brush in list not transparent ( #00ffffff ). however, comparing brushes.transparent returns false though value in fact #00ffffff . var brushes = getlistofbrushes(); var brush = brushes.first(c => c != brushes.transparent); console.writeline(brush); // prints "#00ffffff" the reliable way in case check string representation if starts `#00" feels hacky. in example screenshot below brush returned first() call matches predicate although should not: since compare brushes want cast<solidcolorbrush>() or pre-filtering if aren't solid colors (i.e. not transparent default). you can compare brush.color brushes.transparent.color .

javascript - ReferenceError: $ is not defined although jQuery was added in Layout.jade -

i getting error when trying run basic javascript code in node.js referenceerror: $ not defined @ object.<anonymous> (/home/ubuntu/workspace/nodetest2/public/javascripts/global.js:5:1) @ module._compile (module.js:409:26) @ object.module._extensions..js (module.js:416:10)

sql server - SQL query hierarchical XML with multiple sub-elements -

i'm using microsoft sql server. i have simple hierarchy directional graph in xml: declare @xml xml = cast( '<root> <node node_id="1"> <edge>2</edge> <edge>3</edge> <edge>4</edge> </node> <node node_id="2"> <edge>1</edge> <edge>3</edge> </node> </root>' xml); my desired output table this: source_node_id | dest_node_id 1 | 2 1 | 3 1 | 4 2 | 1 2 | 3 a query this: select b.value('data(@node_id)','int') source_node_id, a.b.value('(edge/text())[1]', 'int') dest_node_id @xml.nodes('/root/node') a(b); only returns first edge: source_node_id | dest_node_id 1 | 2 2 | 1 this 1 little better: select b.value('data(@node_id)','int') sour

javascript - Modal Lightbox Gallery and Carousel Slider incompatible? -

it seems quite challenging add both bootstrap carousel slider , lightbox gallery in single page without significant issues. problem: when clicking on lightbox image gallery opens picture gallery , @ same time carousel slider image gets hijacked gallery images. culprit seems either classes: .item , img , or .inner-carousel is possible add both modal lighbox , carousel slider single page without issues? to recreate issue: click on image gallery, modal pop up, close window, , carousel slider has been replaced gallery images. http://jsfiddle.net/2aasoyej/ html: <div class="container"> <div class="row"> <h1>bootstrap 3 lightbox hidden gallery using modal</h1> <hr> <div class="row"> <div class="col-12 col-md-4 col-sm-6"> <a title="image 1" href="#"> <img class="thumbnail

c# - Knight's Tour recursion -

is able find mistake in knight's tour code ? can't seem find it, , i'm getting infinite loop, not stack overflow private bool heuristic(int[,] board, int x, int y, ref int jmp) { if (x < 0 || x > 7 || y < 0 || y > 7 || board[x, y] > 0) return false; board[x, y] = ++jmp; if (jmp == 64) return true; if (heuristic(board, x + 2, y + 1, ref jmp) || heuristic(board, x + 2, y - 1, ref jmp) || heuristic(board, x - 2, y + 1, ref jmp) || heuristic(board, x - 2, y - 1, ref jmp) || heuristic(board, x + 1, y + 2, ref jmp) || heuristic(board, x + 1, y - 2, ref jmp) || heuristic(board, x - 1, y + 2, ref jmp) || heuristic(board, x - 1, y - 2, ref jmp)) return true; board[x, y] = 0; jmp--; return false; } and calling it: var board = new int[8,8]; var x = 0; var y = 0; var jmp = 0; var result = heuristic(board, x, y, ref jmp); i need have jmp variable i'm preforming multiple t

tree - mysql flat design to php nested array -

i have simple mysql user table flat design below. table ordered group5, ..., libuser ascending. ╔════════╤════════╤════════╤════════╤═══════════╗ ║ group5 │ group4 │ group3 │ group2 │ libuser ║ ╠════════╪════════╪════════╪════════╪═══════════╣ ║ g5_1 │ g4_1 │ g3_1 │ g2_1 │ libuser_1 ║ ╟────────┼────────┼────────┼────────┼───────────╢ ║ g5_1 │ g4_1 │ g3_1 │ g2_1 │ libuser_2 ║ ╟────────┼────────┼────────┼────────┼───────────╢ ║ g5_1 │ g4_1 │ g3_1 │ g2_1 │ libuser_3 ║ ╟────────┼────────┼────────┼────────┼───────────╢ ║ g5_1 │ g4_1 │ g3_1 │ g2_2 │ libuser_4 ║ ╟────────┼────────┼────────┼────────┼───────────╢ ║ g5_1 │ g4_1 │ g3_2 │ g2_3 │ libuser_5 ║ ╟────────┼────────┼────────┼────────┼───────────╢ ║ .... │ .... │ .... │ .... │ .... ║ ╟────────┼────────┼────────┼────────┼───────────╢ ║ g5_n │ g4_n │ g3_n │ g2_n │ libuser_n ║ ╚════════╧════════╧════════╧════════╧═══════════╝ i want transform flat design hierarchical nest

c# - The type 'ClientBase<>' is defined in an assembly that is not referenced -

i'm having troubles compiling this: var client = new xmlsoccercom.demoservice.footballdatademosoapclient(); client.checkapikey("my_api_key"); the checkapikey method red , xamarin says me "the type clientbase<> defined in assembly not referenced. add reference in assembly system.servicemodel (...)" what error means? you need add reference assembly. in solution explorer, under project right-click references -> add reference. find system.servicemodel in list of framework assemblies. check box , press ok.

jquery - onclick JavaScript function gives error: the function is not defined -

i getting error when calling onclick function. when comment ajax call, works fine. if ajax call there, function not work, give error: searchuser not defined function searchuser() { try { var userid = document.getelementbyid("uuid"); alert(userid); .ajax({ type: "get", url: "/ajax/searchuser.cfm" data: { method: "searchuser", empid: userid }, success: function(data) { if (data != "") { } else { var tempstr = data.substring(1, data.length - 1); var resultarray = tempstr.split(","); var firstname = resultarray[0]; var lastname = resultarray[1]; var firstnameelem = document.getelementbyid("firstname"); var lastnameelem =

c# - How to obtain the derived class type from base when calling a method -

ive searched internet , didnt see solution, should simple cant figure out. i need obtain derived class type within method passes in base class: class base { } class derived1 : base { } class derived2 : base { } void somemethod(base obj) { type basetype = obj.gettype(); type derivedtype = obj.???? } void main() { base d1 = new derived1(); base d2 = new derived2(); somemethod(d1); somemethod(d2); } .gettype() returns actual type of current object. doesn't return base type. if somemethod(new derived1()) , obj.gettype() return derived1 (seems want).

jsf 2.2 - Is the class extending ClientBehaviorBase can be considered as an injection target? -

Image
the bean defined simple follows: @named @requestscoped public class confirmbean { private string confirmmsg; public confirmbean(){ confirmmsg = "are sure want delete file ?"; } // getters & setters } and class inheriting clientbehaviorbase @facesbehavior(value = "confirm") public class confirmdeletebehavior extends clientbehaviorbase { @inject confirmbean confirmbean; //@inject //confirmejbbean confirmejbbean; //@ejb //confirmejbbean confirmejbbean; @override public string getscript(clientbehaviorcontext behaviorcontext) { return "return confirm('"+confirmbean.getconfirmmsg()+"');"; } } with taglib file- <namespace>http://www.custom.tags/jsf/delete</namespace> <tag> <tag-name>confirmdelete</tag-name> <behavior> <behavior-id>confirm</behavior-id>

sql - getting name and value from xmltype attribute in oracle -

description hello, have problem extracting attribute names , values xmltype value in oracle. basically, have table, let's tablea , has xmltype column, let's call tablea_config . values in tablea_config have structure this: <tableaconfig someattribute1="value1" someattribute2="value2" someattribute3="value3" /> . number of attributes , names may vary , not known beforehand. need (for each row) create new xmlelement called tableaconfiglist , contains xmlelements called tableaconfig , each of has 2 attributes: name , value . now, number of tableaconfig nodes must equal number of attributes in tablea_config column, , each holds name of corresponding attribute in name attribute , value in value attribute. example from: <tableaconfig someattribute1="value1" someattribute2="value2" someattribute3="value3" /> i should get: <tableaconfiglist> <tableaconfig name="someattribute