Posts

Showing posts from January, 2010

what does "@SOME_VALUE@" mean in C++ header -

i've seen in c++ headers: #define value_a @value_a@ or #if @value_a@ ... #endif so, tell me @@ mean? thanks lot. probably got source code other source (not yours) , not someheader.h someheader.h.in all @something@ tags substituted configure script on program configuration. configure , proper header file @something@ substituted. some reading autoconf info documentation make light darkness.

sql - how to get a Distinct Count of users from two related but different tables -

apologies sql not strong point me, , whilst appears similar lots of other queries cannot translate situation successfully. i have 2 tables related common value (id , issue) if row in table 2 exists. i need distinct count of users raising particular issues. have users in both tables, table 2 user taking precedence if exists. there reporter in table 1, there may not stringvalue of name (fieldtype = 1) in table 2. if there stringvalue "user" , reporter can ignored. table 1 | id | reporter| type | | 1 | 111111 | 1 | | 2 | 111111 | 2 | | 3 | 222222 | 2 | | 4 | 333333 | 1 | | 5 | 111111 | 1 | | 6 | 666666 | 1 | table 2 |issue | stringvalue | fieldtype| | 1 | fred | 1 | | 1 | bananas | 2 | | 2 | jack | 1 | | 5 | steve | 1 | i have total of 4 issues of right type (1,4,5,6), 3 reporters (111111,333333,666666) , 2 stringvalues(fred, steve). total count of distinct users = 4

php - Strange Forbidden 403 Error - Solution Needed -

Image
i have blog add-post.php page contains simple form action: <form id="form" action="add-post-php.php" method="post" enctype="multipart/form-data"> i have file, add-post-php.php in same folder add-post.php . enter details of blog form , press submit , get: forbidden you don't have permission access /add-post-php.php on server. additionally, 404 not found error encountered while trying use errordocument handle request. i've tested on localhost , works correctly the permission of file set @ 0644, i've tried @ 0755, no improvement. there nothing wrong .htaccess file , there no other .htaccess files in directory. i've tried using full url path in form action my add-post-php.php script in full is: <?php include("php/settings.php"); // contains db connections ?> <?php $id= time(); $month = date("m"); $year = date("y"); $path = "images/posts/$year/

javascript - how can I extract in js object and operation -

there obejct nestobject want nestobject['weakness']['modules']['weakness'][item] = {'enabled': true}; nestobject['weakness']['modules']['weakness'][item]['check_list'] = file_leak_list; i try this: var aaa = nestobject['weakness']['modules']['weakness'][item] aaa = {'enabled': true}; aaa['check_list'] = file_leak_list; but doesn't work how can write code elegant? that json maybe? var nestobject = { weakness:{ modules:{ weakness:{ item:{enabled:true, check_list:"file_leak_list"} } } } }; alert(aaa.enabled); aaa.enabled = false; alert(aaa.enabled); alert(aaa.check_list); aaa.check_list = "some file"; alert(aaa.check_list); http://jsfiddle.net/bernardobj/kdnsc8fr/ can provide jsfiddle ??

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

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

javascript - Get values from multiple inputs jQuery with same name and add the the values together -

image of appending of items using jquery function fill(thisvalue) { function suggest(inputstring) { var inputstring = $.trim(inputstring); if(inputstring.length == 0) { $('#suggestions').fadeout('slow'); } else { $('#country').addclass('load'); $.post("<?php echo base_url();?>customer/get_item_list", {querystring: "" + inputstring + ""}, function(data) { if(data.length >0) { $('#suggestions').fadein(); $('#suggestionslist').html(data); $('#country').removeclass('load'); } else { $("#scan_box").val(""); } }); } } var maxinputs = 15; //maximum input items allowed var x = 0; var fieldcount = 0; //to keep track of

mysql data not replicating, but replication seems fine -

i have 4 machine mysql cluster running mariadb 10.0.21. have 2 masters setup, slaving off of each other. , 2 read-only slaves replicating 1st , 2nd db’s respectively. in short, way setup this: db1 replicates -> db2 db1 replicates -> db3 db2 replicates -> db1 db2 replicates -> db4 it's pretty basic 4 db setup. the problem i'm having setup nagios user monitor cluster on 1st db. i checked , log first 3 databases not 4th 1 nagios user. without creating nagios user on each db because i'm replicating mysql database on first 2 database machines. but reason nagios user never created on db4 way on db2 tho replication seems fine on nodes. as recall, have db 2 replicating 4th db. and if show master status on db 2, can see i'm replicating mysql db: mariadb [mysql]> show master status; +--------------------+----------+------------------------------+------------------+ | file | position | binlog_do_db | binlog_ignore_

Keyboard shortcut to override parent constructor in PhpStorm -

is possible override constructor in phpstorm single keyboard shortcut? using "generate constructor" in child class gives me blank one, while "generate override methods -> (find , click parent constructor) ->" not comfortable thing many times every day. thanks.

C programming - read 2 different directories in the same line from a text file -

i trying read 2 different file directories single line in text file. eg// under given.txt file, there multiple lines of input directory , output directory "space" between them in 1 line ../input1.txt ../output1.txt ../input2.txt ../output2.txt ../input3.txt ../output3.txt ..... etc. goal loop reading line line, fetch input#.txt, manipulate it, send output#.txt. my question is, how separately read directories in each line space between them? i have tried google topic, of them either regarding command prompt argc & argv or reading line line 1 directory in each line. eg// under given.txt ../input.txt ../output.txt but these aren't searching for thanks help. assuming paths don't contain spaces, can split string on space (using string manipulation library), return 2 tokens: first read path, , second write path.

How can I assign a value I get from a function to an integer in c? -

i doing school assignment , don't know how proceed without knowing how asked in title. given code (by prof) run , print dice roll (1-6). void showdice (int num) { int diceroll; srand(time(null)); diceroll = (rand() %6) +1; printf("%d\n", diceroll); } i know how call in main function ( showdice(0); ) , prints out. need know how int (or variable) can add total (or counter) variable. thanks you return it. like, int showdice (int num) { int diceroll; srand(time(null)); diceroll = (rand() % 6) + 1; printf("%d\n", diceroll); return diceroll; } also, if intended num number of sides, int showdice (int num) { int diceroll; srand(time(null)); diceroll = (rand() % num) + 1; printf("%d\n", diceroll); return diceroll; } finally, should call srand once (at program startup).

Spring IDE Bean Graphs is blank for blueprint configuration file -

i have installed spring ide 3.7.2 (core + osgi extension), in eclipse mars sr1 java ee. i writing blueprint bundles, , tooling seams work except beans graph, remains empty (with no errors in error log), with similar configuration spring, beans graph displayed after investigating this, seems there no org.springframework.beans.factory.xml.namespacehandler implementation provided http://www.osgi.org/xmlns/blueprint/v1.0.0 namespace. i manage write "quick , dirty" implementation based on 1 found in eclipse gemini blueprint proof of concept is interested in contribution ?

javascript - Angular Service can set data from one controller but not the other -

i have module , 2 controllers : var module = angular.module("app", ["aggrid", "nganimate", "ngsanitize", "ngdialog"]) module.controller("mainctrl", ["$scope", "dataservice","$timeout","datefilter","ngdialog", "$http", function ($scope, $http, $timeout, datefilter, ngdialog, dataservice) { }]); module.controller("modalctrl", ["$scope", "ngdialog", "dataservice", function ($scope, ngdialog, dataservice) { $scope.printentity = function () { console.log(dataservice.getentityarray()); } }]); and service: module.factory("dataservice", function () { var entityarrayservice = []; return { setentityarray: function (entityarray) { entityarrayservice = entityarray; }, getentityarray: function () { return entityarrayservice; } }; }); i can call dataservice.setentityarray(a

Information/Cyber Security informative practice/project? -

i'm heading school run group focuses on strengthening cyber security infrastructure. invite people majors join , learn cyber security, as, learn how , protect others. right group write open source situational reports provide state organization. have group research within darknet. give warning before students enter darknet , have them work in groups. wondering projects (coding, ethical hacking, etc) new , experienced user gain important skills? i apologize if improper question, or misplaced, i'm trying find things benefit myself , fellow students. guidance great. we in same situation, maybe little bit different. have non formal group surabaya hacker link, learn information security our group general no matter how old you, of our member junior high school, senior high school, college studen, , adult. then problem not member know fundamental or basic of it, @ time, in every gathering or meet @ friday 8:00 pm in surabaya, indonesia learn basic ip, how crimp lan cab

java - OpenCV for Android : Illegal Forward Reference -

i using opencv project , works fine except descriptorextractor.java . gives me following error every day: /opencv/src/org/opencv/features2d/descriptorextractor.java error:(26, 29) error: illegal forward reference error:(27, 29) error: illegal forward reference error:(28, 28) error: illegal forward reference error:(29, 30) error: illegal forward reference error:(30, 30) error: illegal forward reference error:(31, 30) error: illegal forward reference error:(32, 30) error: illegal forward reference the file this: public class descriptorextractor { public static final int sift = 1, surf = 2, orb = 3, brief = 4, brisk = 5, freak = 6, akaze = 7, opponent_sift = opponentextractor + sift, opponent_surf = opponentextractor + surf, opponent_orb = opponentextractor + orb, opponent_brief = opponentextractor + brief, opponent_brisk = opponen

ios - Default SDWebImage cache size -

default cache size of sdwebimage. need both number of files , size of total file can handle. if search through sdwebimage files on github "maxcachesize" you'll see there's no default value. since it's @property won't initialised garbage numbers, set 0. apple docs : the alloc method has 1 other important task, clear out memory allocated object’s properties setting them zero. avoids usual problem of memory containing garbage whatever stored before... so there's no restriction default judging condition in clean code: if (self.maxcachesize > 0 && currentcachesize > self.maxcachesize) { //clean code; } afaik there no maximum amount of space application can use either. can eat of available space on device if wish.

java - How to set 4 button on one Listener? -

this simple method don't know code mean this button1 = (button)findviewbyid(r.id.b1); button2 = (button)findviewbyid(r.id.b2); button3 = (button)findviewbyid(r.id.b3); button4 = (button)findviewbyid(r.id.b4); //button1-button4.setonclicklistener(new view.onclicklistener() { public void onclick(view button1-4){ { //do same method button1-4 } } }); button5 = (button)findviewbyid(r.id.b5); button6 = (button)findviewbyid(r.id.b6); button7 = (button)findviewbyid(r.id.b7); button8 = (button)findviewbyid(r.id.b8); //button5-button8.setonclicklistener(new view.onclicklistener() { public void onclick(view button5-8){ { //do same method button5-8 } } }); button9 = (button)findviewbyid(r.id.b9); button10 = (button)findviewbyid(r.id.b10); button11 = (button)findviewbyid(r.id.b11); butto

css - How to make background color of link take up exact height of container div? -

Image
here's jsfiddle: http://jsfiddle.net/cnf6cjm2/ here's html: <div id="header"><ul> <li><a href="#">link 1</a></li> <li><a href="#" id="selected-nav">another link 2</a></li> <li><a href="#">link 3</a></li> </ul></div> here's css: body { margin:10px; padding:0; } #header { height:92px; background:#58585a; position:relative; } #header ul { margin:0; padding:0; list-style-type:none; position:absolute; top:35px; right:16px; } #header ul li { display:inline; font-size:1.25em; } #header ul li { color:#ffffff; text-decoration:none; margin-left:1.5em; padding:35px 0; } #selected-nav { background:#ffa31a; } i have header div has horizontal ul in navigation. have ul absolutely positioned on right side of header div , vertic

How To Limit User Input In Java -

the amount of investment must positive , can value. period of investment in years should positive. annual rate of interest can between 0.25% 14%. import java.util.scanner; public class interestcalculator{ /** * @param args command line arguments */ public static void main(string[] args) { // todo code application logic here scanner input = new scanner(system.in); // entering interest rate system.out.print("please enter annual interest rate between 0.25 10 : "); double annualinterestrate = input.nextdouble(); double monthlyinterestrate = annualinterestrate / 1200; system.out.print("enter number of years: "); int numberofyears = input.nextint(); // entering amount earned system.out.print("enter amount: "); double amountofinterest = input.nextdouble(); // calculating double moneyearned = amountofinterest * monthlyinterestrate

php - message class 'mongoclient' not found codeigniter -

i trying setup mongo db in codeigniter after doing setup when run controller getting error. have tried similler error on stackoverflow no luck. here error: fatal error: class 'mongoclient' not found in /var/www/html/grant/application/libraries/mongo_db.php on line 216 php error encountered severity: error message: class 'mongoclient' not found filename: libraries/mongo_db.php line number: 216 backtrace: your mongo_db class expecting mongoclient class has been loaded , mongo_db trying instantiate it. question didn't include link mongo library using i'm unable debug further, here basic steps. before loading mongo_db library try loading mongo_client $this->load->library('mongo_client'); if libraries rely on composer autoloader make sure have included autoloader class somewhere in bootstrap or configuration include 'vendor/autoload.php' if libraries rely on composer, may want check autoload make sure including libr

User authentication and authorization for Android app which connects to a server running a Spring Boot application -

i developing android application connects connects backend server running spring boot application fetch details. the android app provides login interface user. app provides user option of registering separate username/password , login same instead of using facebook/twitter account. once logged in using facbook/twitter or registered username/password, calls made android app server application, therafter, needs authenticated @ server end also. thus, users have both option of social login custom login. user enter details though android app authentication needs there both android , spring (server) end. for standalone applications built on spring framework, prefer use spring security 1 has android application frontend instead of browser. best way approach problem of user authentication authorization?

javascript - How to click on an angularjs link using python selenium? -

i have following html multiple links use same class , elements, , i'd click on link has ng-switch-when="next" python selenium. <a class="ng-scope" ng-switch-when="prev" ng-click="params.page(page.number)" href="">«</a> <a class="ng-scope" ng-switch-when="first" ng-click="params.page(page.number)" href=""><span class="ng-binding" ng-bind="page.number">1</span></a>< <a class="ng-scope" ng-switch-when="next" ng-click="params.page(page.number)" href="">»</a> this i've tried, there no response webpage. driver.find_element_by_xpath("//a[@class='ng-scope'][@ng-switch-when='next']").click() i know said tried using css classes should work html provided. if doesn't, please post more of relevant surrounding html can adjust css selector. driv

ruby - uninitialized constant Ckeditor::Orm - Rails 4 (ckeditor gem) -

hey guys trying install ckeditor gem on environment can't upload files or pictures this nameerror in ckeditor::picturescontroller#index uninitialized constant ckeditor::orm extracted source: class ckeditor::asset < activerecord::base include ckeditor::orm::activerecord::assetbase delegate :url, :current_path, :content_type, :to => :data validates_presence_of :data i using carrierwave + minimagick , did use command install , did migration well. any appreciated. he not using paperclip correct answer be class ckeditor::asset < activerecord::base include activerecord include ckeditor::orm::activerecord::assetbase include ckeditor::backend::carrierwave end http://www.maxmakedesign.co.uk/development/2014/rails-ckeditor-uninitialized-constant/

java - JVM error while building Ionic project -

when started building android app project found error: failure: build failed exception. * went wrong: unable start daemon process. problem might caused incorrect configuration of daemon. example, unrecognized jvm option used. please refer user guide chapter on daemon @ http://gradle.org/docs/2.2.1/userguide/gradle_daemon.html please read following process output find out more: ----------------------- unrecognized vm option 'maxpermsize=256m' error: not create java virtual machine. error: fatal exception has occurred. program exit. * try: run --stacktrace option stack trace. run --info or --debug option more log output. /var/www/html/ionicapp/platforms/android/cordova/node_modules/q/q.js:126 throw e; ^ error code 1 command: /var/www/html/ionicapp/platforms/android/gradlew args: cdvbuilddebug,-b,/var/www/html/ionicapp/platforms/android/build.gradle,-dorg.gradle.daemon=true error building 1 of platforms: error: /var/www/html/ionica

Android DatePickerDialog: Set min and max date for selection -

i know there quite lot of question none of solutions working me, question. want restrict user select date before today, not able so. public class datepickerdialogfragment extends dialogfragment { private ondatesetlistener listener; public void setlistener(ondatesetlistener listener) { this.listener = listener; } @nonnull @override public dialog oncreatedialog(bundle savedinstancestate) { calendar calendar = calendar.getinstance(); int year = calendar.get(calendar.year); int month = calendar.get(calendar.month); int day = calendar.get(calendar.day_of_month); datepickerdialog dialog = new datepickerdialog(getcontext(), listener, year, month, day); dialog.getdatepicker().setmindate(calendar.gettimeinmillis()); return dialog; } } i showing as: datepickerdialogfragment fragment = new datepickerdialogfragment(); fragment.setlistener(datesetlistener); fragment.show(getsupportfrag

java - How to handle getOrCreateIfAbsent inside a DDD aggregate? -

i have situation in requirements see if has strong opinion it. the project i'm working on requires that, given customer, once customer adds product cart, if cart not present, cart has created. @ moment, aggregate customer , contains cart contains product. because system kind of side 1 supports real e-commerce project, creation of customer , cart taken granted once "addproductcommand" received. in situation, both customer , cart have created if not there already. my current implementation creates customer @ application service if doesn't exist. once created, pass addproductrequest using customer.addproduct(addproductrequest) . addproductrequest contains cart id , product id. problem comes here. once in customer aggregate, if cart not there, have create it. basically, don't have addcart in customer cart entity call first call addproduct . need create cart if it's not there inside customer aggregate , add product it. , this, don't create factory do

delphi - WCN (connect to device using WPS) does not work under Windows 10 -

i have implemented delphi code connect device using wcn (wps) works on windows 7 & windows 8(.1). first, code tries detect proper iwcndevice , , once proper device has been found will: set password empty using wcndevice.setpassword( ) create object implements iwcnconnectnotify. (= wcnconnectionnotify ) call wcndevice.connect( wcnconnectionnotify ) under windows 10, wcndevice retrieved, wcnconnectnotify object can created , following sequence of msm / acm events received: source=0x10: 0x0010:msm / code=0x1: wlan_notification_msm_associating source=0x10: 0x0010:msm / code=0x39: source=0x10: 0x0010:msm / code=0x39: ... source=0x10: 0x0010:msm / code=0x2: wlan_notification_msm_associated source=0x10: 0x0010:msm / code=0x3: wlan_notification_msm_authenticating source=0x4: 0x0004:onex / code=0x1: onexnotificationtyperesultupdate 10 times: source=0x10: 0x0010:msm / code=0x39: then iwcnconnectnotify.connectfailed( ) fires error code 0x800

sql server - Query to fill in the missing matches -

i have following list of dispositions dialler: create table dialleroutcomes ([dialleroutcome] varchar(25)) ; insert dialleroutcomes ([dialleroutcome]) values ('application (a)'), ('answer machine (a)'), ('answering machine (a)'), ('call interested (a)'), ('call unavailable (a)'), ('could not debt (a)'), ('no answer (a)'), ('older customer (a)'), ('answer machine (d)'), ('no answer (d)') ; +---------------------------+ | dialleroutcome | +---------------------------+ | application (a) | | answer machine (a) | | answering machine (a) | | call interested (a) | | call unavailable (a) | | not debt (a) | | no answer (a) | | older customer (a) | | answer machine (d) | | no answer (d) | +---------------------------+ and following data: create table affiliateleads ([affiliate] varc

c# - How to stop the Button Command execution from its Click event WPF -

is there way stop button command execution based on condition on click event? actually want have confirmation popup on of button click in our application. make general solution, have done following: i have extension of wpf button class call appbarbutton contains dependency properties. i have 2 more properties below: isactionconfirmationrequired , confirmationactioncommand . if isactionconfirmationrequired on left button cick event opening confirmation popup. is there way avoid creating new confirmationactioncommand , , use same command property of button ? problem getting if set command , on button click if user not confirmed action still button command execute. c#: public class appbarbutton : button { public appbarbutton() { this.click += appbarbutton_click; } private void appbarbutton_click(object sender, routedeventargs e) { button button = sender button; if (button == null || isactionconfirmationrequired == false

algorithm - Finding product of all elements of all sub arrays of an array -

i having array having n elements. want find out multiplication of elements in sub arrays possible of array a. expecting solution implemented of dp. want store product values in array b. beginner programming. have done lot of google search unable find exact solution query. can me provide me logic of question. example: a={1,2,3} all possible sub arrays {{1},{2},{3},{1,2},{1,3},{2,3},{1,2,3}} so possible products {1,2,3,2,3,6,6} respectively. any appreciable. in advance. this might help: at every instance have make 2 choices: either select element of array in current sub-array or don't.the following recursion might help: f(i,p)=f(i+1,p*arr[i])||f(i+1,p)

c# - How to show corresponding value of a calculated field through html query string to another page -

i'm working on shopping cart functionality allows users add items shopping cart(via add cart button.) have specials page members discounted price items. have passed id(database) , sales price (calculated value) specials page add cart page. i couldnt post images because dont have reputations here url looks like: http://localhost:51231/legobits/shopping/shoppingcartitem.aspx?id=1&salesprice=0.89 you can see url getting values id , salesprice page, , i'm having trouble showing salesprice value in datalist of current page. here code shoppingcartitem.aspx <asp:datalist id="datalist1" runat="server" horizontalalign="center" datakeyfield="id" itemstyle-horizontalalign="left" datasourceid="sqldatasource1"> <itemtemplate> <asp:image id="image1" runat="server" imageurl='<%# eval("thumbnail", "{0}") %>' /> <asp:

git branch - What happen to Git tags pointing to a removed commit -

say following: create branch x create tag t (to branch x ) push remove branch x what happen tag t ? floating there? considered garbage? should remove tags pointing @ branch before removing branch itself? reference from git basics - tagging : git uses 2 main types of tags: lightweight , annotated. lightweight tag branch doesn’t change – it’s pointer specific commit. what happen tag t? let's created branch x commit e , tagged commit tag t . e.g. x (branch) | v a-----b------c------d------e ^ | t (tag) if remove branch x nothing happens tag t . git branch -d x the tag still points commit e . a-----b------c------d------e ^ | t (tag) is considered garbage? no, because com

php - Blank page when accessing page in admin -

i'm getting blank page when click on page link in administration in wordpress /wp-admin/edit.php?post_type=page it happens pages, other post types fine. have lots of pages, 2000. here tried far without luck: switching default theme deactivating plugins deactivating revisions in wp-config here of php settings: wp memory limit: 256mb php post max size: 8mb php time limit: 300 php max input vars: 1920 when turn on wp_debug when click on pages: notice: called constructor method wp_widget deprecated since version 4.3.0! use __construct() in /var/www/vhosts/example.com/wp-includes/functions.php on line 3457 fatal error: allowed memory size of 268435456 bytes exhausted (tried allocate 80 bytes) in /var/www/vhosts/example.com/wp-includes/wp-db.php on line 2258 any appreciated. seems memory issue. can please add following in wp-config.php define( 'wp_max_memory_limit' , '512m' ); let's know if tihs fixes memory issue? e

java - Cloud Foundry for isolated environments -

we have quite large monolithic app (java/spring) , considering splitting microservices , using spring-cloud utilize existing solution common problems (discovery, redundancy etc.). run 1 instance (with different modules) per client. some of our clients small , 1 vps handles , others larger , might use multiple servers. the problem "pack" of microservices should isolated each environment - might different. as reading through resources cloud foundry - looks great - seems best run cloud foundry instance per client , afraid that overkill , quite lot of work 1 client running (which automate as possible). ideal solution begin we provide servers heterogenous os, possible containers (vm/docker/jail/...) restrictions may rur , services restrictions in containers may run. when creating new environment provide list of services run in , solution creates containers, deploys services in them , sets communication channels (message broker) between them. it should handle up

rust - Weird macro behavior for type inference -

i'm trying understand macros & utilizing simple macro create hashmap similar vec! . reason if convert string &str inside macro doesn't seem work. macro_rules! hashmap { ($( $key: expr => $val: expr ),*) => {{ let mut map = ::std::collections::hashmap::new(); $( map.insert($key.clone(), $val.clone()); )* map }} } fn works(){ let value1 = 5; let value1str: &str = &value1.to_string(); let h = hashmap!["key0" => "value0" , "key1" => value1str]; println!("{:?}", h); } // fn does_not_work(){ // let value1 = 5; // let h = hashmap!["key0" => "value0" // , "key1" => &value1.to_string()]; // println!("{:?}", h); // } fn main(){ works(); //does_not_work(); } example on playpen this effective body of works() function: fn works(){

Questions about the eclipse installation genymotion plug-ins -

Image
eclipse genymotion plug-in installation, enter location in install new software link without reaction. deselect 'group items category' check box near bottom of dialog.

ruby - Can not initialize array correctly -

i've been trying code algorithm in minified manner>. believe typical 2d array defining looks unwieldy mx = array.new(n) { array.new(n) } i trying use hint, it's behaviour bit strange me: mx = [[!:&]*n]*n take look: #square matrix n*n n=3 mx = [[!:&]*n]*n #=> [[false, false, false], [false, false, false], [false, false, false]] mx[0][0]=true mx #=> [[true, false, false], [true, false, false], [true, false, false]] # true true true ???? #. how should tame array? repl.it_snippet: avaiable this because sub arrays same instance #square matrix n*n n=3 mx = [[!:&]*n]*n #=> [[false, false, false], [false, false, false], [false, false, false]] mx[0] === mx[1] # true mx[1] === mx[2] # true to fix code, add that n=3 mx = [[!:&]*n]*n mx = mx.flatten.each_slice(n).to_a mx[0][0] = true mx # [[true, false, false], [false, false, false], [false, false, false]] or n=3 mx = ([!:&am

How to pass parameters to powershell command when interpretting script from standard input -

i running powershell script on ssh ssh user@host "powershell -comand - < script.ps1 . works expected long start passing arguments. when put powershell -command - args fails (as documented) '-' specified -command parameter; no other arguments -command permitted. while other way around powershell args -command - fails with: the term 'my' not recognized name of cmdlet, function, script file, or operable program. check spelling of name, or if path included , verify path correct , try again. @ line:1 char:3 + <<<< args -command - + categoryinfo : objectnotfound: (my:string) [], commandnotfounde xception + fullyqualifiederrorid : commandnotfoundexception i intend put in arbitrary list of parameter without parsing. edit: as investigate further, seems doing wrong when command specified explicitly: (local bash) $ echo '\n' | ssh -i master-key admin@10.8.55.78 '$systemroot/system32/windowspowershell/v

java - Split String based on Uppercase and Numbers -

i split string when uppercase letter or number found. ive got working uppercase letters answers on other questions here: string s = "hefneo2h3be1h"; string[] r = s.split("(?=\\p{upper})"); (int = 0; i<r.length; i++){ system.out.println(""+r[i]); how can add numbers regex string s split @ uppercase letters , numbers. thx advice. public static void main(string args[]) { string s = "hefneo2h3be1h"; string[] r = s.split("(?=[a-z0-9])"); (int = 0; i<r.length; i++){ system.out.println(""+r[i]); } }

How to use display:flex in CSS to create a mix of fixed with and dynamic proportional width columns? -

i'm kind of new latecomers display:flex thing in css. want create table 9 column, want column has fixed width, , column has dynamic proportional width against other dynamic proportional width column. content 1 line, , overflow content truncated ellipsis. now, used javascript plugin that. after accidentally stumbles display:flex , i'm thinking i'm going change this, because using javascript heavy if table huge. but i'm confused on how that. read need have container ( <tr> ?) display:flex , column ( <td> ?) getting order value. what need this: col 1: 100px col 2: 100px col 3: 200px col 4: 15% remaining dynamic length col 5: 20% remaining dynamic length col 6: 35% remaining dynamic length col 7: 40% remaining dynamic length col 8: 100px col 9: 250px and code simple table: <table style="width:100%"> <tr> <td><input type="checkbox" onclick="selectall()"</input></td> &l

c++ - Using AudioFormatReader in Juce to load impulse responses -

i creating convolution reverb plugin using juce , having trouble loading in impulse response audio files. i using audioformatreader class. here code have implemented far producing errors: std::ifstream irstream; irstream.open("1 halls 01 large hall l.wav"); audioformatreader(juce::inputstream irstream, const juce::string &wavaudioformat); this attempt @ loading 1 audio file, many. here link audioformatreader class documentation: audioformatreader you can use audioformat::createreaderfor (note pure virtual function, , you'll have use 1 if derived types such wavaudioformat ) alongside file . example... file myfile ("myfile.wav"); audioformatreader* myformatreader = wavaudioformat().createreaderfor (myfile.createinputstream(), true);

ios - Programmatically added buttons target action not working in custom tableviewcell -

i added programmatically 2 buttons in custom tableviewcell, target action not working. can solve problem ?(swift) this code of adding buttons: override func awakefromnib() { super.awakefromnib() func createcuebutton() -> uibutton{ let button = uibutton() button.titlelabel?.textcolor = uicolor.whitecolor() button.titlelabel?.font = uifont.boldsystemfontofsize(16.0) return button } completebutton = createcuebutton() completebutton.settitle("complete", forstate: uicontrolstate.normal) completebutton.backgroundcolor = uicolor.greencolor() completebutton.addtarget(self, action: "buttonpressed:", forcontrolevents: .touchupinside) addsubview(completebutton) deletebutton = createcuebutton() deletebutton.settitle("delete", forstate: .normal) deletebutton.backgroundcolor = uicolor.redcolor() deletebutton.addtarget(self, action: "buttonpressed:", forcontrolevents: