Posts

Showing posts from June, 2010

linux - java string regex head not contains -

i have string : [root@slave1 ~]# test -d /root/workspace/servers || echo not found [root@slave1 ~]# test -d /root/workspace/servers || echo not found not found [root@slave1 ~]# test -d /root/workspace/servers || echo not found [root@slave1 ~]# test -d desktp || echo not found not found and want find word not found without echo @ first as can see , in string , there 2 match how can ?? use negative lookbehind. "(?<!\\becho )not found(?=\\s|$)" you use same regex in grep. grep -op '(?<!\becho )not found(?=\s|$)' file (?<!\becho ) - don't lookafter echo<space> not found(?=\s|$) - match not found strings must followed space or line end.

vlc - Stdout to memory python -

i wanted stream raspivid using vlc. followed below link raspivid -o - -t 9999999 -w 1280 -h 1024 -b 500000 -fps 20|cvlc -vvv stream:///dev/stdin --sout '#rtp{sdp=rtsp://:8080/}' :demux=h264 now wanted record streamed result in vlc cvlc -vvv stream:///rtsp://0.0.0.0:8554/}' --sout=file/ps:record.mpg am doing right? alternative approach/methods appreciated.

delphi - Why do literals of the form [...] have meaning that appears to depend upon context? -

consider following program: {$apptype console} type tmyenum = (enum1, enum2, enum3); var arr: tarray<tmyenum>; enum: tmyenum; begin arr := [enum3, enum1]; // <-- array enum in arr writeln(ord(enum)); writeln('---'); enum in [enum3, enum1] // <-- looks array above writeln(ord(enum)); writeln('---'); readln; end. the output is: 2 0 --- 0 2 --- why 2 loops produce different output? because array contains order information , set not. explanation use of documentation: the internal data format of static or dynamic array : is stored contiguous sequence of elements of component type of array. components lowest indexes stored @ lowest memory addresses. walking on these indices for in loop is done in incremental order : the array traversed in increasing order, starting @ lowest array bound , ending @ array size minus one. on other side, internal data format of set : is bit array each bi

javascript - CSS display inline-block and fill all spaces with elements -

i have elements display:inline-block, , these's 1 elements that's bigger rest causing space between elements, in picture. here's fiddle example. http://jsfiddle.net/uu64hyed/ note: expand result window width see full problem. css .calendermonth_header { height:35px; line-height:35px; text-align:center; background-color: rgba(221,221,221,1); border-bottom: 1px solid rgba(221,221,221,1); } .calendermonth { height: 160px; width:160px; margin:10px; border-radius:2px; background-color: rgba(238,238,238,1); border: 1px solid rgba(221,221,221,1); display:inline-block; vertical-align:top; cursor:pointer; } .activemonth { height:340px; width:340px;} .calendermonth:hover { border: rgba(0,153,204,1) 1px solid} js $(document).ready(function(e) { var months = [ {month:'january', state:''}, {month:'feburary', state:''}, {month:'march', state:''},

java - Holding multiple values at same index in array -

my code retrieves number of steps, output instruction @ each step via loop. there title, description, video, , audio. however, trying think of way store each variable structure. came with, don't think array can store multiple values @ same index. for(int = 0; < qrdata.number_steps; i++){ system.out.println("inside loop"); array[i].settitle(btn_instructions.get(i)); array[i].setdescription(instruction_row.get(i)); array[i].setinstructionvideo(videos.get(i)); array[i].setaudioinstruction(audio.get(i)); } what better way store these values, easy retrieve later? i'm pretty sure method doesn't work. you should create object like: public class datastorage{ private string title; private string description; private file audiofile; private file videofile; public datastorage(string title, string description, file audiofile, file videofile){ this.title = title; this.description = description

python - Show Progress Bar during a system call in tkinter -

i try input user. make system call , pass input argument on button press (next in case). during time add indeterminate progress bar widget in current window until system call return , gets next function. somehow progress bars doesn't shows , see next window itself. below code same. from tkinter import * import ttk class app: def __init__(self, master): #copy root self.master = master #label root self.title_frame = frame(self.master) self.title_label= label(self.title_frame, text="my application") #position title label self.title_frame.pack(fill=x) self.title_label.pack() #create frame containing details self.detail_frame1 = frame(self.master) self.detail_frame2 = frame(self.master) #create entry input details self.input1 = entry(self.detail_frame1) self.function() def function(self): #copy root wind

google play - How to find out if chat support is human or bot -

i did not know ask question. try here ( if doesn't fit here, let me know i'll remove it ) well, having contact support chat google developer console 'guy' called artemis. made me quite skeptical because of name ( there chat bot out there called artemis ) , additionally support bad. guess bot. but well, email support not work either, have try support chat again. how can find out ( ideally in polite way artemis being human ) if bot? there turig-test question can ask?

c# - How to convert null to string in Event Gridview RowDeleting on Textbox -

i want convert value null string in event gridview rowdeleting on textbox. but error "object reference not set instance of object." code behide: protected void gvterm_rowdeleting(object sender, gridviewdeleteeventargs e) { textbox txtcountryrate_te = (textbox)gvterm.rows[e.rowindex].findcontrol("txtcountryrate_te"); if (txtcountryrate_te == null) { txtcountryrate_te.text = string.empty; //<== error object reference not set instance of object. } } thanks in advance. ;) the error tells happening. trying access , set property of null object. to set string.empty text object. create new instance of object empty text. protected void gvterm_rowdeleting(object sender, gridviewdeleteeventargs e) { textbox txtcountryrate_te = (textbox)gvterm.rows[e.rowindex].findcontrol("txtcountryrate_te"); if (txtcountryrate_te == null) {

ms access - Combine 2 queries with sum involved -

i have 2 similar queries both table being switched treatment patient in second query: select treatment.phys_id phys_id, physician.fname, physician.lname, sum(treatment.charge) totcharge physician inner join treatment on physician.phys_id = treatment.phys_id group treatment.phys_id, physician.fname, physician.lname; the output of both is: phys_id___fname___lname____totcharge when combined, need add 2 queries' columns of totcharge actual totcharge. however, when union these 2 queries tables stack on top of each other , union rearanges both tables identical phys_ids next each other. how can make 2 queries' totcharges add up? you can use subqueries add charges @ physician level: select physician.phys_id phys_id, physician.fname, physician.lname, (select nz(sum(treatment.charge)) treatment treatment.phys_id = physician.phys_id) + (select nz(sum(patient.charge)) patient patient.phys_id = physician.phys_id) total charge physician; alternativel

json - Trouble POSTing using cURL, PHP, and Basic Authentication -

Image
i made similar post last week, can found here . having problems authentication, believe i've solved. error message different, @ least. i'm trying recreate successful post made our vendor via postman executing curl commands in php. here example curl command documentation: curl -i -k -u '<api_key>': -xpost --data-urlencode assessment_data@/path/to/test/file.json "https://<your_subdomain>.vendor.org/api/v1/import"; echo "" this php code, not work: <?php session_start(); include('../connect.php'); include('../functions.php'); function curlpost($url, $headers, $username, $password, $post) { $ch = curl_init(); curl_setopt($ch, curlopt_url, $url); curl_setopt($ch, curlopt_cainfo, 'certificate.pem'); curl_setopt($ch, curlopt_ssl_verifypeer, true); curl_setopt($ch, curlopt_ssl_verifyhost, 2); curl_setopt($ch, curlopt_httpheader, $headers); curl_setopt($ch, curlinf

c# - Castle Windsor: how to pass an argument to the constructor of a 'child' item of the to-be-resolved type -

i'm trying find out best (nicest) way pass argument constructor of child object of auto-resolved parameter. why? because have program computations against same "production" database (defined in config file, no argument required). needs run work on 'copy' of database. therefore requiring different connection string. the connection string can supplied on constructor, , not known @ compile time. problem can't (or not know how to) access constructor because buried deep inside generated items. consider following (simplified) code snippet: public class example { protected readonly igeneratesomethingfactory factory; public example(igeneratesomethingfactory factory) { factory = factory; } public task dosomething(string connectionstring, string a, string b) { //needs run somehow using supplied connection string ... return task.run(() => factory.createsomething().execute(a, b)); //= task.run(() =>

postgresql - Very simple in memory storage -

i need simple storage keep data, before added postgresql. currently, have web application collects data clients. data not important. application collects 50 kb of data (simple string) 1 client. collect 2gb data per hour. data not needed asap , it's nothing if lost. there existing solution store in memory while (~ 1 hour), , write in postgresql. don't need query in way. can use redis, probably, redis complex task. can write myself, tool must handle many requests store data (maybe 100 per second) , existing solution may better. thanks, dmitry if not plan work data operatively why want store in memory? may create unlogged table , store data in table. look @ documentation details: unlogged if specified, table created unlogged table. data written unlogged tables not written write-ahead log, makes them considerably faster ordinary tables. however, not crash-safe: unlogged table automatically truncated after crash or unclean shutdown. content

clojure - Understanding recur -

trying out snippet of code , doesn't seem working quite right.. (defn- multiple_of? [div num] (= (mod num div) 0)) (defn sum_of_multiples_from ([start] (sum_of_multiples_from start 0)) ([start total] (if (<= start 0) total (recur (dec start) (or (multiple_of? 3 start) (multiple_of? 5 start) (+ total start) start))))) i receive following error: java.lang.boolean cannot cast java.lang.number i guessing has with: (recur (dec start) (or (multiple_of? 3 start) (multiple_of? 5 start) (+ total start) start))))) but i'm not sure why, i'm new clojure, i'm trying grasp of recur. your or call returns boolean ( (multiple_of? 3 start) ) start multiple of 3. in clojure, or returns 1 of arguments -- either first truish 1 if 1 exists, or last falsish 1 otherwise.

javascript - AngularJS Dropdown and Textbox Filter -

i have ng-repeat creates table of data. each entry has several properties, including ip address, mac address, author , more. have textbox automatically sorts ip address, want provide dropdown allows users select property filter by. for example, default behavior typing "12" box, entries "12" in ip address displayed. if user selects "author" dropdown , types "mark" textbox, entries "mark" author displayed. i tried setting textbox's ng-model "selectfiler.value" didn't work. <form> <select ng-model="selectfilter"> <option value="incident_at">incident date</option> <option value="ip_addr" selected="selected">ip address</option> <option value="mac_addr">mac address</option> <option value="created_at">created on</option> <option value="author"

how to slide down the action bar in android to display something like coversation -

i want display conversation between me , admin when dragged action bar. since new android programming dont know how slide action bar also. following code decoy(dummy) code, coz not letting me post question without sample code. please me drag or slide down action bar display conversation. thank you. import android.support.v7.app.actionbaractivity; import android.os.bundle; import android.view.menu; import android.view.menuitem; import android.widget.button; import android.view.view; public class mainactivity extends actionbaractivity { @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_main); button bt=(button)findviewbyid(r.id.button); bt.setonclicklistener(new view.onclicklistener() { public void onclick(view v) { } { } } @

html - Weird sub menu dropdown -

i have weird submenu dropdown on specific page , overlap text title of product. see image. http://i.imgur.com/qiq6ri9.png but when got home page. looks okay. http://i.imgur.com/u4mtikb.png this cc on sub menu. html lines: <ul class="category_menu"> <li><a href="http://www.asakapa.com/under-20-dollar">under $20</a></li> <li class="dropdown"><a href="http://www.asakapa.com/men">men </a> <ul class="drop-nav"> <li><a href="http://www.asakapa.com/men-apparel">apparel</a></li> <li><a href="http://www.asakapa.com/men-matches">watches</a></li> <li><a href="http://www.asakapa.com/men-footwears">footwear</a></li> <li><a href="http://www.asakapa.com

HTML SVG Line and applying transition to change in x1 y1 attributes in javascript -

i have svg line after 5 seconds receives new x1 y1 coorindates. how apply transition line smoothly moves. in code attached, i'm able change it's color through smooth transition, location blinks 1 spot other. <html> <head> <meta name="viewport" content="initial-scale=1.0, user-scalable=no" /> <meta http-equiv="content-type" content="text/html; charset=utf-8"/> <head> </head> <body> <script language="javascript"> setinterval(function trackuser () { var x_one = 45; var y_one = 13; var r_one = 50; var x_two = 55; var y_two = 85; var r_two = 36; var x_thr = 70; var y_thr = 35; var r_thr = 28; var first = (-math.pow(x_two,2)+math.pow(x_thr,2)-math.pow(y_two,2)+math.pow(y_thr,2)+math.pow(r_two,2)-math.pow(r_thr,2))/(-2*y_two+2*y_thr);

swift - iOS CoreBluetooth print CBService and CBCharacteristic -

i using swift develop ios application integrate bluetooth printer print out information. have used corebluetooth framework can't know service, characteristic can writevalue print out //find cbservice func peripheral(peripheral: cbperipheral!, diddiscoverservices error: nserror!) { //println("cbperipheraldelegate diddiscoverservices") service in peripheral.services { println("service: discover service \(service)") println("service: uuid \(service.uuid) ") peripheral.discovercharacteristics(nil, forservice: service as! cbservice) } } //find cbcharacteristics func peripheral(peripheral: cbperipheral!, diddiscovercharacteristicsforservice service: cbservice!, error: nserror!) { //if service.uuid == cbuuid(string: "18f0"){ characteristic in service.characteristics { let chara: cbcharacteristic? = characteristic as? cbcharacteristic println("char: service \(se

javascript - Is this feature or bug, for Setting focus to a textbox? -

this can seen on knockout.js site well. when open page in ie11 or ff 38 , , go example 2: click-to-edit , click on name - bert bertington, caret (cursor) of textbox @ start of text, while in chrome @ end. if feature, suggest how keep caret in end when label changes textbox in ie11 , ff38. i able fix in ff38 resetting contents of observable below, not work in ie11. var str = self.msg(); self.msg(''); self.msg(str); i using knockout-3.2.0 if matters. update the issue seems browsers rather knockout (sorry confusion). i tried setting focus of text field using jquery , javascript .focus() functions , still getting same result on ie11 , firefox 38. any appreciated. you correct, issue of how different browsers handle focus event. workaround manually set cursor end of text within textbox. an example of doing can found here . if want happen automatically using knockout, have create own custom binding based on hasfocus binding, or modify

zero an array inside a struct in c++ -

this question has answer here: how come array's address equal value in c? 7 answers i have struct defined in program. struct a{ int arr[10]; } lets have pointer it. a * = new a; i can 0 in 2 ways: memset(&a->arr,0,sizeof(a)); memset(a->arr,0,sizeof(a)); both work , same! which 1 more correct? this correct way array memset(a->arr,0,sizeof(a->arr)) picked out arr member in case there other structure members not need touched. makes no difference in example following likewise memset(a->arr,0,sizeof(a));

java - Setting hadoop.tmp.dir on Windows gives error: URI has an authority component -

i'm trying specify base directory hdfs files in hdfs-site.xml under windows 7 (hadoop 2.7.1 built source, using java sdk 1.8.0_45 , windows sdk 7.1). can't figure how provide path specifies drive. my hdfs-site.xml looks this: <configuration> <property> <name>dfs.replication</name> <value>1</value> </property> <property> <name>hadoop.tmp.dir</name> <value>xxx</value> </property> </configuration> and tried various values xxx , tested hdfs namenode -format , leading 1 of these 2 errors: xxx=d:/tmp/hdp : 15/07/10 23:38:33 error namenode.namenode: failed start namenode. java.lang.illegalargumentexception: uri has authority component @ java.io.file.<init>(file.java:423) @ org.apache.hadoop.hdfs.server.namenode.nnstorage.getstoragedirectory(nnstorage.java:329) xxx=d:\tmp\hdp : error common.util: syntax error in uri file://d:\tmp\hdp/dfs/name ot

linux - How to config wget to retry more than 20? -

i used d4x continue download, it's obsolete ubuntu. use flashgot wget continue download. wget stops after 20 tries, have restart manually. there conf file modify retry times more 20? the wget cli automatic created wget, please don't tell me make options wget cli. use the --tries option : wget --tries=42 http://example.org/ specify --tries=0 or --tries=inf infinite retrying (default 20 retries). the default value can changed via config file, if thing; open /etc/wgetrc , there for: # can lower (or raise) default number of retries when # downloading file (default 20). #tries = 20 uncomment tries=20 , change want. the default retry 20 times, exception of fatal errors "connection refused" or "not found" (404), not retried

java - Choice in Mule Flow -

i trying divide flow according data present in map, formed after using mule transformer xmlmapper , xml map.. i have tried many ways.. 1 of them present in mule site was.. <choice> <when expression="#[message.payload['interface_id'] == 'bk131108.1655.000698']" evaluator="map-payload"> <processor-chain doc:name="processor chain"> </when> </choice> but won't work. help??? remove: evaluator="map-payload" you forcing use of old expression evaluation framework while providing mel expression. after removing it, , if message payload map contains "interface_id" key, expression should work.

ios - rightBarButtonItem seems to stack when moving from one viewController to another -

my problem have created rightbarbuttonitem each view in storyboard, rightbarbuttonitem in app supposed keep track of total cost of items user has added shopping list. in viewdidload on first viewcontroller set rightbarbuttonitem's customview uilabel . when moving viewcontroller set viewcontroller's rightbarbuttonitem 1 previous viewcontroller . however, when move previous viewcontroller viewcontroller's rightbarbuttonitem doesn't change when try update it. instead, looks did when moved previous time, if move same viewcontroller again first viewcontroller's rightbarbuttonitem seems 1 step behind should upon return. in other words, viewcontroller's rightbarbuttonitem seems stack when moving viewcontroller . any appreciated. -- relevant code: viewdidload - first viewcontroller double total; - (void)viewdidload{ total = 0; nsstring *text = [nsstring stringwithformat:@"$%.2f", total]; uifont *cellfont = [uifont fontwithn

shell - Cause bash statement to error if its subshell errors -

is there concise, general, idiomatic bash construction force statement error when subshell invokes errors? example, cd $(git rev-parse --show-toplevel) will invariably return 0 if git command errors, makes difficult script like cd $(git rev-parse --show-toplevel) && echo 'success!' of course can following, wondering if there better way: dir=$(git rev-parse --show-toplevel) && cd $dir && echo 'success!' it's not quite general solution, in example do: cd $(git rev-parse --show-toplevel || echo -@) && echo 'success!' this solution works turns output command won't accept if command in substitution fails.

osx - Android Studio Fail to set up on Mac OS X -

i using mac os x yosemite 10.10.3 jdk version 1.7.0 this error android studio set wizard refresh sources: failed fetch url http://dl.google.com/android/repository/addons_list-2.xml, reason: file not found fetched add-ons list refresh sources failed fetch url http://dl.google.com/android/repository/repository-10.xml, reason: file not found refresh sources: failed fetch url http://dl.google.com/android/repository/repository-10.xml, reason: file not found there nothing install or update. platform-tools, extra-android-m2repository , 2 more sdk components not installed use jdk 6 os x update 2014-001 apple support page , try installing set android sdk path try again

php - Creating a User who has-and-belongs-to-many existing Courses with a CakePHP form -

i have app 2 associated models: user , course, related habtm association. there registration form new user may enter username , select courses part of (from list of existing courses in database), form saves new users - doesn't save join table. the join table ( courses_users ) has columns course_id , user_id , , 2 models this: // user.php class user extends appmodel { public $name = 'user'; public $hasandbelongstomany = array( 'courses' => array( 'classname' => 'course', 'jointable' => 'courses_users', 'foreignkey' => 'user_id', 'associatedforeignkey' => 'course_id' ) ); } // course.php class course extends appmodel { public $name = 'course'; public $hasandbelongstomany = array( 'users' => array( 'classname' => 'user', '

reactjs - window.scrollTo() in react components? -

where have put window.scrollto(0,0) call in react component? i tried put directly render , tried componentdidupdate (to wait till rendered), somehow the scrollbars stay @ same position. -- edit -- the problem css height/overflow of window , body. see: https://stackoverflow.com/a/18573599/1016383 well, window.scrollto(0,0) stick top of page. you correct in saying code should live in componentdidmount function, need tell scroll. locate id of element want scroll , obtain it's y coordinates, enter window.scrollto , should work. may need height of component , add dymamic value obtained.

Type of all elements in Python list -

is there way print out type of all elements of given list in python? for example [1, 2, 3.5] give int, int, float . the closest existing resource i've found answering question is: test type of elements python tuple/list , gives holistic true/false outputs (which not i'm looking for). try following: for l in lst: print(type(l)) where lst = [1,2,3.5]

Change CSV name in Rails without respond_to block -

i have button allows users download csv in rails 3.2 app. view <%= link_to "export registration data", learn_registrants_path(format: "csv", :id => @event.id), :class => "btn btn-default btn-primary" %> controller def export_registrants @event = event.find(params[:id]) if current_learner.id == @event.registration_contact_id registrants = eventregistration.includes.where(event_id: @event.id) csv = registrantsexport.new(registrants).to_csv render text: csv end end with code above csv file gets downloaded named learn_registrants.csv . add event_id csv name. found filename: option used in respond block, can't use here. ideas on how can change csv name without refactoring use respond_to block? you use send_data instead: send_data csv, :filename => 'your_file_name.csv', :disposition => 'inline', :type => "multipart/related" or can change file nam

cx_freeze + selenium + python 3 : No module named 'httplib' -

im trying buld app selenium, have setup.py: import sys cx_freeze import setup, executable path_drivers = ( "c:\python34\lib\site-packages\pyqt5\plugins\sqldrivers\qsqlmysql.dll", "sqldrivers\qsqlmysql.dll" ) includes = ["atexit","pyqt5.qtcore","pyqt5.qtgui", "pyqt5.qtwidgets","pyqt5.qtsql", "selenium"] includefiles = [path_drivers] excludes = [ '_gtkagg', '_tkagg', 'bsddb', 'curses', 'email', 'pywin.debugger', 'pywin.debugger.dbgcon', 'pywin.dialogs', 'tcl', 'tkconstants', 'tkinter' ] packages = ["os"] path = [] # dependencies automatically detected, might need fine tuning. build_exe_options = { "includes": includes, "include_files": includefiles, "excludes": excludes, "packages":

Centering Text over Image using Foundation -

so i'm trying seems simple thing, yet can't seem work...center text on image. want image scale entire width of screen, no white space on either side, , scale height let's 30% of screen, , put text right in center of image. i created show problem: https://jsfiddle.net/sq9we118/ i've tried: text-align: center; ^^ nothing. also: top: 50%; left: 50%; ^^which moves text on 50%, not move down @ all. i've tried more this, can't remember did. i've tried multiple 'div' setups image , text in same div, separate divs, text in separate div, various css settings found answers on site others similar problem, none have worked me. i'm using foundation, if makes difference. tried without foundation, , couldn't image scale 100% width of screen without left , right white space. also also, can see, have: width: 100%; height: 15em; for image. if change height %, image disappears. can pixels both, want image scale screen sizing. i'

android - Latest update on enabling and disabling mobile data programmatically -

although "duplicate", current answers out of date and, mostly, no longer apply. thought provide updated resource here, if possible, save people time, have done, researching issue. i've been googling around see latest information on being able enable , disable mobile data within app (if wifi not available). this 1 of latest things can find: did know can no longer disable/enable data on lollipop widget? there answer that, quote: there never api it. developers using workaround calling method via reflections. google did close "exploit". there discussion: replacement setmobiledataenabled() api feb 2015. there these questions here: how disable mobile data on android this asked in 2010 , latest answer updated 1 liner on dec 2014. enable/disable data connection in android programmatically and this, accepted answer in 2012. what's latest on issue? can still done? i use workaround only works rooted phones. the setmob

javascript - alter array object property then save back to localStorage? -

i'm doing cart , want increment qty if item_id exising in localstorage. <button data-item_id="1" data-item_name="cake" data-item_price="2 dollar">add cart</button> not sure why below code doesn't work, added new object instead of increment qty value. $(function(){ $('button').click(function(){ var item_id = $(this).attr('data-item_id'); var item_name = $(this).attr('data-item_name'); var item_price = $(this).attr('data-item_price'); var arr = json.parse(localstorage.getitem('cart')) || []; var obj = {}; if(arr.length === 0){ // first time insert obj.item_id = item_id; obj.item_name = item_name; obj.item_price = item_price; obj.item_qty = 1; }else{ $(arr,function(i){ //doesn't work here

ruby - Connect to 2 databases from same model in Rails -

i have application run in 2 different countries. lets , brazil. have user model connects or brazil depending on param passed calling: user.establish_connection("brazil_db") user.establish_connection("us_db") the problem facing if user comes in middle of session brazil user activerecord drops brazil connection , connects db. is there way manage such situations in activerecord? you should have 1 database nationality flag on relevant tables, or 2 different applications deployed in different datacentres. kind of thing will enormous hassle. activerecord can handle having different tables in different databases, it's not capable of understanding how handle 1 table living in several @ same time. need extension manage this. the problem becomes serious when things like: model.find(params[:id]) which connection should use that? unless have additional context answer "i don't know." it sounds should deploy 2 instances of applica

reporting services - Set chart axis label for individual groups with an expression -

Image
i'm on vs2012 ssrs , trying report prepared each agentid. agent needs see bar highlighted , ids other agents should hidden. we agreed can go plan a putting or planb hiding ids other selected 1 horizontal label. i've illustrated in picture id 22222. i managed highlight bar expression on fill property of series. i'm not sure how modify axis label individually. think property axis label refers label every group. can hide of them, can't manipulate them individually. in category group properties can dynamically assign axis label entry. on value-by-value basis , effects labels, not grouping. if have multiple labels end same won't end grouped together. so in case expression label like =iif(fields!agent_id.value=parameters!agent_id.value,fields!agent_id.value," ") do note: i've used space(" ") , not empty string(""). using empty string ssrs fill empty categories numbers. space blank out category name.

Grails 3 functional test -

i trying upgrade application grails 2 grails 3. however, functional test working in grails 2 fails run now. in grails 2, use restbuilder send request , response. in grails 3, there no corresponding restbuilder release. how can send post , request in grails 3 functional test? thanks much. my test code in grails 2: void testrequestnewenvironment() { setup: def rest = new restbuilder(connecttimeout:1000, readtimeout:20000) int timeout = 10 string environmentid = 0 string environmentstatus = "not ready" when: /** * postmethod. send out post , response status should 200 , body of response include env_id */ def resp = rest.post('http://localhost:8080/test-environment-manager/environment') { contenttype "multipart/form-data" buildfile= new file('script.sh') username = "apps" keepenvflag = "false" env_flavor = "default" } then:

ruby on rails - install gem in local machine -

i using pry gem debugging rails application. have specified in gemfile , using it. dont need push gemfile pry gem specified. everytime need revert original gemfile , push remote repo. i wondering there way can install pry gem in local machine , use in rails app globally dont have specify gem in gemfile.?? i tried gem install pry but when use binding.pry in rails controller, says undefined method `pry' #<binding:0x0000000619398> with bundler can create groups according environments. can intall gem development group. put line below in gemfile. gem 'pry', :group => :development

chef - Error executing action `run` on resource 'execute[wait for leader]' -

i using chef cookbook dcos on-premise setup. here 2 issues faced, second 1 being 1 still stuck on.... 1. package dcos-el-repo not found: *10.40.1.2 * package dcos-el-repo not found: http://repos.mesosphere.io/dcos/el/7/noarch/rpms/dcos-el-repo-7-0.el7.centos.noarch.rpm * note: able bypass manually installing rpm on each node , commenting out _repo.rb recipe running. not sure why wouldn't work via recipe though. 2. execute[wait leader] action run 10.40.1.9 error executing action run on resource 'execute[wait leader]' 10.40.1.9 ================================================================================ 10.40.1.9 10.40.1.9 10.40.1.9 mixlib::shellout::shellcommandfailed 10.40.1.9 ------------------------------------ 10.40.1.9 expected process exit [0], received '2' 10.40.1.9 ---- begin output of ping -c 1 leader.mesos ---- 10.40.1.9 stdout: 10.40.1.9 stderr: ping: unknown host leader.mesos 10.40.1.9 ---- end output o

char - Scanning a single character in c -

this question has answer here: scanf skips every other while loop in c 10 answers i have used following code snippet read several values single character constant variable rating not accepting value. doesn't execute particular scanf statement. how resolve this? char name[100],locality[100],vision[100],mission[100]; char rating; int dept,stud; printf("enter college name\n"); scanf("%s",name); printf("enter college locality\n"); scanf("%s",locality); printf("enter college's vision\n"); scanf("%s",vision); printf(" enter college's mission\n"); scanf("%s",mission); printf("enter number of departments\n"); scanf("%d",&dept); printf(" enter student strength\n"); scanf("%d",&stud); printf(" enter college rating\n

immutable.js - Immutable JS - Convert List to Map -

how turn [['a', 1], ['b', 2]] into {a: 1, b: 2} via immutable.js? > var map = immutable.map([['a', 1], ['b', 2]]); works me. > map.get('a'); 1 http://facebook.github.io/immutable-js/docs/#/map

nullpointerexception - Null Pointer Exception on Array in Java -

the following code returning nullpointerexception in java. can clarify mistake? public void deposit2() { bankaccounts[] accounts2 = new bankaccounts[10]; accounts2[3].deposit(); } bankaccounts[] accounts2 = new bankaccounts[10]; is same as bankaccounts[] accounts2 = {null, null, null, ... null }; // (10 times) you need assign values elements of accounts2 (or, @ least element 3) before attempt dereference them.

How to retrieve out parameter from mysqli stored procedure in php? -

i want access out parameter, mysqli database using stored procedures, , save in php variable printing message on web page. my stored procedure is: delimiter $$ create procedure insertuser (in _name varchar(50), in _username varchar(50), in _password varchar(50), in _email varchar(50), in _cellnumber int(11), in _estatename varchar(50), out _rply varchar(50)) begin declare count1 int; declare count2 int; declare varestateid int; declare _result varchar(50); select count(*) count1 users username = _username; select count(*) count2 users email = _email; if (count1+count2 < 1) insert users (username , passkey , email) values (_username ,_password,_email); insert estatedetails (estatename, estateownerusername) values (_estatename, _username); select estateid varestateid estatedetails estateownerusername = _username; insert usersdetail (username, name, cell1, estateid, accounttype) values (_username, _name, _cellnumber, varestateid, 'owner'); set _result = 'in

ruby on rails - Fixtures with polymorphic association not working -

i'm trying implement rolify gem have trouble adding fixtures scope it. last line of (model) test below fails because moderator role seems given @user globally instead of organization one. fixtures below aren't using resource_id , resource_type , mentioned in gem documentation fixtures, i'm not sure how use them. how should set scope moderator role organization one? roles.yml moderator: id: 1 resource: 1 (organization) users.yml one: email: example@example.com roles: moderator, organizations(:one) # hoping set scope of role organization 1 isn't (seems set role globally). test.rb def setup @moderator_role = roles(:moderator) @organization1 = organizations(:one) @organization2 = organizations(:two) @user = users(:one) end test "should moderator if fixtures correct" assert_equal @user.has_role?('moderator'), true assert_equal @user.has_role?(:moderator, @organization1), true assert_equal @u

How to flip ImageView in Android? -

i working on application need flip imageview on touch , transfer control second activity. please me. i tried lot haven't succeed. thank in advance. you can use animation apis available android 3.0 , above. if need pre-honeycomb, can use library called nineoldandroids . check out this answer exact code use.

vowpalwabbit - Vowpal Wabbit: obtaining a readable_model when in --daemon mode -

i trying stream data vw in --daemon mode, , obtain @ end value of coefficients each variable. therefore i'd vw in --daemon mode either: - send me current value of coefficients each line of data send. - write resulting model in "--readable_model" format. i know dummy example trick save_namemodel | ... vw in daemon mode save model given file, isn't enough can't access coefficient values file. any idea on how solve problem ? unfortunately, on-demand saving of readable models isn't supported in code shouldn't hard add. open source software there users improve according needs. may open issue on github, or better, contribute change. see: this code line binary regressor saved using save_predictor() . 1 envision "rsave" or "saver" tag/command store regressor in readable form being done in code line as work-around may call vw --audit , parse every audit line feature names , current weights would: make vw slower

ios - MPMoviePlayerController automatic pause at second X -

i have automatic stop player @ second x , don't know kind of notification have used. after, when user taps anywhere on screen player continue run video. - (ibaction)playmovie:(id)sender { nsstring *filepath = [[nsbundle mainbundle] pathforresource:@"movie" oftype:@"m4v"]; nsurl *fileurl = [nsurl fileurlwithpath:filepath]; _movieplayer = [[mpmovieplayercontroller alloc] initwithcontenturl:fileurl]; [[nsnotificationcenter defaultcenter] addobserver:self selector:@selector(movieplaybackdidfinish:) name:mpmovieplayerplaybackdidfinishnotification object:_movieplayer]; //here don't know notification have used [[nsnotificationcenter defaultcenter] addobserver:self selector:@selector(movieplaybackpause:) name:mpmovieplayerplaybackstatedidchangenotification object:_movieplayer]; _movieplayer.controlstyle = mpmoviecontrolstyledefault; _movieplayer.initialplaybacktime = 2.5; _movieplayer.shouldautoplay = yes;

python - Modify query parameters in current GET request for new url -

i access page path /mypage?a=1&b=1&c=1 . want create link similar url, parameters changed: /mypage?a=1&b=2&c=1 , b changed 1 2. know how current arguments request.args , structure immutable, don't know how edit them. how make new link in jinja template modified query? write function modifies current url's query string , outputs new url. add function template context can used in jinja templates. from flask import request werkzeug import url_encode @app.template_global() def modify_query(**new_values): args = request.args.copy() key, value in new_values.items(): args[key] = value return '{}?{}'.format(request.path, url_encode(args)) <a href="{{ modify_query(b=2) }}">link updated "b"</a>

c# - How to convert DataRow[] to List<string[]> -

i have datatable dt; datarow[] drarray = dt.select().toarray(); my requirement want convert drarray list<string[]> or converting datatable list<string[]> in fastest way. i think want: list<string[]> results = dt.select() .select(dr => dr.itemarray .select(x => x.tostring()) .toarray()) .tolist(); this works if items stored in dr.itemarray have overriden .tostring() in meaningful way. luckily primitive types do.

bash - Batch Renaming in Shell -

i have full list of files like, 1066_hasoffers.apk.apk.txt 161_genesys.apk.apk.txt 231_attendance.apk.apk.txt 2956_bookingbug.apk.apk.txt 3394_sumall.apk.apk.txt 4306_vocus.apk.apk.txt ..... and one-liner rename them (say). 1066_hasoffers.txt 161_genesys.txt 231_attendance.txt 2956_bookingbug.txt 3394_sumall.txt 4306_vocus.txt .... how can done ? rename command can used: rename 's/apk.apk.//' *.txt which remove apk.apk file names. or can use loop in bash: for in *.txt; new=${i%apk.apk.txt}txt mv "${i}" "${new}" done

shell - Makefile loop results from ls command -

i have list of text files, when executing following command: ls *.txt will result in like: foo.txt bar.txt baz.txt now if want have output like: file: foo.txt file: bar.txt file: baz.txt how achieve in makefile? i've been trying: txtfiles = $$(ls *.txt) list: $(txtfiles) $(txtfiles): echo "file:" $@ but when running make list , results with: file: $ file: $ i thinking of trying achieve using placeholders % wasn't sure how that. note: instead of $$(ls *.txt) i'm guessing use $(wildcard *.txt) ? note: instead of $$(ls *.txt) i'm guessing use $(wildcard *.txt) ? you have to. also add .phony: $(txtfiles) before $(txtfiles): rule make explicit request .

linux - Obtaining UNIQUE VALUE occurrences count in a set of COLUMNS using AWK -

ignoring columns 1 & 2 (only rest of columns); obtain occurrence count of unique values (ignoring odd ones) following set of data. i have tried: awk '{ a[$3, $4, $5, $6, $7]++ } end { (b in a) { cnt+=1 } {print cnt}}' file i obtain 76 don’t expect value. > 0 0 > 1 0 0 > 2 0 2 > 3 0 0 6 > 4 0 0 8 > 5 0 0 10 > 6 0 2 14 > 7 0 2 16 > 8 0 0 6 20 > 9 0 0 8 24 > 10 0 0 8 26 > 11 0 0 10 32 > 12 0 0 10 34 > 13 0 2 14 40 > 14 0 2 16 42 > 15 0 0 8 24 48 > 16 0 0 8 24 50 > 17 0 0 8 26 56 > 18 0 0 10 32 60 > 19 0 0 10 34 64 > 20 0 0 10 34 66 > 21 0 2 14 40 72 > 22 0 0 8 24 48 76 > 23 0 0 8 24 50 82 > 24 0 0 8 26 56 88 > 25 0 0 8 26 56 90 > 26 0 0 10 32 60 96 > 27 0 0 10 3

c# - What's the proper way to set up a WCF service with a EF database? -

i'm working on project become more familiar wcf services , entity framework , ran road block. have simple wcf service ef code first database context implemented in separate class library. have console application host service , client use service. leaves me following 2 questions: given i'm using 'code first new database', proper place initialize database? service handle or should initialized within service host? idea create/initialize database within host , treat existing database within service. a regular user client should have read access database; however, i'll need along lines of 'admin' client has ability add/remove entries. correct way have multiple clients access database through single service, provide them different permissions? i've taken @ following 2 articles - this one , this one . however, these both discuss using existing database , didn't answer questions. in advance! 1) service host should not know db platform i