Posts

Showing posts from June, 2015

unity3d - Android DisplayMetrics inconsistent between devices -

i'm trying use dpi , touch input in unity game recognise gestures consistently across android devices of different sizes. for instance, want virtual thumbstick 2 inches "full left" "full right". given dpi of screen, can convert touches pixels inches this: inchesfromstickcenter = pixelsfromstickcenter/dpi . to dpi, unity offers screen.dpi getting inconsistent results across devices. thumbstick way big, way small. instead went straight android's displaymetrics, xdpi , ydpi , , densitydpi . question difference between declared size in inches , size obtained using displaymetrics see densitydpi rounded value, , should using xdpi or ydpi. i tested things trying compute width of screen in inches (my landscape, these examples assume landscape). when divide screen pixel width (1280) xdpi (195.4) on 1st gen n7, overestimates screen width half inch (6.55 inches, compared under 6 when measured rule). when divide densitydpi (213), it's better answer. wiki

qt - Get a .pro file from a Makefile -

i have project generates makefile using custom script. import project qt creator in way can add new files , compile them automatically (without manually editing makefile every time). to simplify, need .pro file create available makefile. there smarter way manually check dependencies each source file , add them .pro file? qmake -project should create project file. use "add new file..." qt creator maintain .pro file automatically.

javascript - How to retrive only parent child and enable expand to get the child? -

need load parent node sake of performance , load children when user clicks on icon, , icon not seem expand when not carry child node. can me? my code return in json. below: "jsondata": [ { "id": "13", "text": "mainbox", "parent": "#", "state": { "opened": false, "disabled": false, "selected": false }, "children": false, "icon": null, "li_attr": "{class = 'jstree-leaf' }", "a_attr": null } ] edit jquery below: root = $('#tree-files').jstree({ 'core': { 'data': //code before }, "plugins": ["themes", "json_data", "ui", "contextmenu"] }); i figured out answer. hope someone. root = $('#tree-files').jstree({ '

Bash script to execute a python package on all files in a folder -

i trying run python package called metl putty , use in files contained in folder. python package metl , using load data contained in 3 .csv files called upload-a.csv, upload-b.csv , upload-c.csv everything works when process manually using following commands: metl -m migration.pickle -t new_migration.pickle -s folder_test/upload-a.csv config3.yml metl -m migration.pickle -t new_migration.pickle -s folder_test/upload-b.csv config3.yml metl -m migration.pickle -t new_migration.pickle -s folder_test/upload-c.csv config3.yml all data every file correctly uploaded or updated , pickle files updated accordingly. but instead of doing manually want make loop files contained in 'folder_test/' folder, tried following bash script: folder_var=folder_test x in $folder_var metl -m migration.pickle -t new_migration.pickle -s $x config3.yml done what happens after pickle files created no data uploaded database. try this for x in folder_test/* metl -m migration.pickle

python - Powershell windows server 2012 .Path Error installing Hortonworks Data Platform (HDP) -

i'm trying install hadoop windows (hortonworks data platform 2.0), in windows server 2012 enviroment, , creating next powershell command $currentpath = (get-itemproperty -path $key -name) .path + ';' i error at line:1 char:52 +$currentpath = (get-itemproperty -path $key -name) .path + ';' + unexpected toke '.path' in expression or statement + categoryinfo : parsererror:(:) [], parentcontainserrorrecordexception + fullyqualifiederrorid : unexpectedtoken what doing wrong, keep in mind i'm going oficial documentation horton works http://docs.hortonworks.com/hdpdocuments/hdp2/hdp-2.1-win-latest/bk_installing_hdp_for_windows/content/win-softwareinstall-ps.html#win-cli-python let's see, to start, have space here ) .path secondly path not appear valid property returned cmdlet once correct errant space still not work thirdly, specifying parameter -name without providing value

swift - Optional value error after updating to Xcode 6 GM -

i have updated xcode 6 gm , fixing issues have appeared. things working have encountered error unsure how rectify. i have code in viedidload(): currencyformatter.numberstyle = nsnumberformatterstyle.currencystyle currencyformatter.currencycode = nslocale.currentlocale().displaynameforkey(nslocalecurrencysymbol, value: nslocalecurrencycode)! i error on second line. fatal error: unexpectedly found nil while unwrapping optional value i'm sure solution simple i'm pretty new programming haven't been able find fix. you're using wrong method currency code. wouldn't problem, method returns nil because couldn't find value. explicitly unwrapped optional adding ! , should avoided. i suggest following code: currencyformatter.numberstyle = nsnumberformatterstyle.currencystyle let locale = nslocale.currentlocale() if let currencycode = locale.objectforkey(nslocalecurrencycode) as? string { currencyformatter.currencycode = currencycode

eclipse - OpenSSL AES_set_encrypt_key crashes C++ program -

i trying use openssl aes encryption/decryption. code looks follows: // buffers unsigned char encryptedbuffer[1024]; unsigned char outbuffer[1024]; unsigned char key[128/8]; memset(key, 0, sizeof(key)); aes_key enc; aes_key dec; aes_set_encrypt_key(key, 128, &enc); aes_set_decrypt_key(key, 128, &dec); unsigned char text[] = "hello world"; cout << text << endl; aes_encrypt(text,encryptedbuffer,&enc); aes_decrypt(encryptedbuffer,outbuffer,&dec); cout << outbuffer << endl; on compilation program crashes, giving windows message program stopt working. far have found out happens on call of aes_set_encrypt_key(key, 128, &enc); ideas doing wrong? i using eclipse (mingw) on windows , have installed openssl 1.0.1i. edit: linked openssl lib eclips going project >> properties >> c/c++ build >> settings under mingw c++ linker libraries under libraries (-l) includet libeay32 , ssleay32 under library s

c# - Error when calling WCF service in HTML page -

i need create wcf service retrieve data sql database in c# , consume wcf service in html5 using json. i created wcf service , working when tried consume in html shows "object object error(failed load resource: server responded status of 415 (cannot process message because content type 'application/json; charset=utf-8' not expected type 'text/xml; charset=utf-8'.)" help me resolve this web.config : <?xml version="1.0"?> <configuration> <appsettings> <add key="aspnet:usetaskfriendlysynchronizationcontext" value="true" /> </appsettings> <system.web> <compilation debug="true" targetframework="4.5" /> <httpruntime targetframework="4.5"/> </system.web> <system.servicemodel> <behaviors> <servicebehaviors> <behavior> <!-- avoid disclosing metadata information, set va

render lists on fly using django templates -

in mako, can write following generate dynamic html <% months=['jan','feb', .. 'dec'] %> <% weeks=['mon','tue',..'sun'] %> % m in months: % w in weeks: ${m} ${w} % endfor % endfor whats recommended coding same in django(django templates) without lists coming context variables? i've used django custom template tag filters under templatetags/my_filters.py from django import template register = template.library() @register.assignment_tag def weekdays(): return ['monday', 'tuesday', 'wednesday', 'thursday', 'friday', 'saturday', 'sunday'] and in template {% load my_filters %} {% weekdays w %} {% in w %} <option value="{{forloop.counter0}}">{{i}}</option> {% endfor %}

sql - Aggregating 15-minute data into weekly values -

i'm working on project in want aggregate data (resolution = 15 minutes) weekly values. i have 4 weeks , view should include value each week , every station. dataset includes more 50 station. what have this: select name, avg(parameter1), avg(parameter2) data week in ('29','30','31','32') group name order name but displays avg value of weeks. need avg values each week , each station. thanks help! the problem when 'group by' on name flatten weeks , can perform aggregate functions on them. your best option group on both name , week like: select name, week, avg(parameter1), avg(parameter2) data week in ('29','30','31','32') group name, week order name ps - it' not entirely clear whether you're suggesting need 1 set of results stations , 1 weeks, or whether need set of results every week @ every station (which answer provides solution for). if require former separate queri

Shell returns all files when regex doesn't match any file in directory? -

i use below command in shell file , works fine in directories regex matches. problem is, lists files when there no match regex. knows why has behaviour? there anyway avoid it? find . -type f -mtime +365 | egrep '.*xxx.yyy*.*'|grep -v "[^.]/" | xargs ls -lrt | tr -s " " | cut -d" " -f6-9 thanks time. note: m using script splunk forwarder on solaris 8. if input of xargs empty, execute ls -lrt in current folder. try xargs -i "{}" ls -lrt "{}" instead. forces xargs put input arguments place in command executes. if doesn't have input, can't , skip running command @ all. if have gnu xargs , can use switch --no-run-if-empty instead. if doesn't work, try move grep ing find , can use -ls display list of files. avoid running ls command if no file matches.

java - converting .jar file to .exe in ubuntu -

trying convert jar file executable 1 on ubuntu 14.04 platform.the executed command java -jar bank.jar , throws msg no main manifest attribute, in bank.jar kindly me fix issue you doon't need convert jar executable. need manifest file in jar. here can read solution: can't execute jar- file: "no main manifest attribute"

How to extract specific columns from a space separated file in Python? -

i'm trying process file protein data bank separated spaces (not \t). have .txt file , want extract specific rows and, rows, want extract few columns. i need in python. tried first command line , used awk command no problem, have no idea of how same in python. here extract of file: [...] seqres 6 b 80 ala leu ser ile lys lys ala gln thr pro gln gln trp seqres 7 b 80 lys pro helix 1 1 thr 68 ser 81 1 14 helix 2 2 cys 97 leu 110 1 14 helix 3 3 asn 122 ser 133 1 12 [...] for example, i'd take 'helix' rows , 4th, 6th, 7th , 9th columns. started reading file line line loop , extracted rows starting 'helix'... , that's all. edit: code have right now, print doesn't work properly, prints first line of each block (helix sheet , dbref) #

minecraft - Show image in Lua -

is there way show image in lua? tried things load_image (i saw in computercraft documentation) can't work. the purpose of show image in computercraft, uses lua write programs. lua (not lua) not have such functionality on own. should consult computercraft api docs, such this

java - Differences in Queue methods -

why queue have 2 different methods each retrieving element , removing element? retrieving methods: element() , element peak() removing methods: element poll() , element remove() what difference between them (except return-type differences in first case)? you should read javadoc queue : remove() : retrieves , removes head of queue. this method differs poll in throws exception if queue empty. element() : retrieves, not remove, head of queue. this method differs peek in throws exception if queue empty. (emphasis mine.)

Android: hide action bar menu views regardless the menu items -

i using navigation drawer switch between fragments. , action bar menu items different regarding fragments. i want hide menu item views when drawer opened. referring doc, suggest find menu item id , hide item. however, menu items different fragments, so, how can hide/show menu item views on action bar? there flag control it? by way, see in doc says can return false in onprepareoptionsmenu() make not displayed, tried , ended in vain. did misunderstand it? public boolean onprepareoptionsmenu (menu menu) added in api level 1 prepare screen's standard options menu displayed. called right before menu shown, every time shown. can use method efficiently enable/disable items or otherwise dynamically modify contents. default implementation updates system menu items based on activity's state. deriving classes should call through base class implementation. parameters menu options menu last shown or first initialized oncreateoptionsmenu(). returns must return true menu

ios - Error with core-data -

Image
when add autologin attribute on entity utente code don t work, if delete attribute code work, why??? ps: needed new attribute, can me pls :) unresolved error error domain=nscocoaerrordomain code=134100 "the operation couldn’t completed. (cocoa error 134100.)" userinfo=0x10970aae0 {metadata={ nspersistenceframeworkversion = 479; nsstoremodelversionhashes = { utente = ; }; nsstoremodelversionhashesversion = 3; nsstoremodelversionidentifiers = ( "" ); nsstoretype = sqlite; nsstoreuuid = "c879290e-f81b-4d22-b6ff-12f34b97820f"; "_nsautovacuumlevel" = 2; }, reason=the model used open store incompatible 1 used create store}, { metadata = { nspersistenceframeworkversion = 479; nsstoremodelversionhashes = { utente = ; }; nsstoremodelversionhashesversion = 3; nsstoremodelversionidentifiers = ( "&quo

arrays - call_user_func_array passing additional params to method -

in app.php file have this: for url one: http://mywebroot/myapp/param1/param2 # leftover in $url, set params, else empty. $this->params = $url ? array_values($url) : []; print_r($this->params); // gives me dumped array values should // can see array ( [0] => param1 [1] => param2 ) // trying pass array controller: // // # call our method requested controller, passing params if method call_user_func_array([ $this->controller, $this->method ], $this->params); // don't worry `$this->controller`, // `$this->method` part, end calling method class bellow. in controller file have: class home extends controller { // here expecting catch params // public function index($params = []){ var_dump($params); // gives `string 'param1' (length=6)`? array? // not relevant question # request view, providing directory path,

android - AltBeacon Library - reduce bluetooth scan period -

i using altbeacon library , trying detect beacons. want reduce time between scan cycles. mbeaconmanager.setbackgroundscanperiod(30000l); as per documentation above line should set background scan period 3 seconds. but, still see scan period 5 mins (300000 ms). missing anything? there 2 method calls: mbeaconmanager.setbackgroundscanperiod(1100l); mbeaconmanager.setbackgroundbetweenscanperiod(30000l); the first call sets how long bluetooth scan last, , second call sets how long there between bluetooth scans. commands above 1.1 second scan every 31.1 seconds. you should set backgroundscanperiod 1100 ms or more, because beacons advertise once per second have slight chance of being missed if transmission on boundary of when start , stop scanning.

ios - Change UIButton BG color on highlighted, but preserve layer corner radius? -

i’m changing background colour of uibutton via category method, using 1px 1px image: - (void)setbackgroundcolor:(uicolor *)backgroundcolor forstate:(uicontrolstate)state { uigraphicsbeginimagecontextwithoptions(cgsizemake(1, 1), no, 0); [backgroundcolor setfill]; cgcontextfillrect(uigraphicsgetcurrentcontext(), cgrectmake(0, 0, 1, 1)); uiimage *backgroundimage = uigraphicsgetimagefromcurrentimagecontext(); [self setbackgroundimage:backgroundimage forstate:state]; uigraphicsendimagecontext(); } however, overrides setting of .layer.cornerradius . need button rounded corners, 1 background colour can change on highlighted. any way around this? corner radius needs dynamic. so, had ensure button.layer.maskstobounds turned on. problem solved, no subclassing required.

jquery - How to place the text inside the layer using kinetic js? -

i new kineticjs & canvas i generating map via kineticjs & canvas using svg path.... map has been rendered successfully.. i need place text center of each layer in canvas. i try achieve, still unable parse text layer. please see jsfiddle link below. using method generating method var simpletext = new kinetic.text({ x: path.getx(), y: path.gety(), text: key, fontsize: 24, fontfamily: 'calibri', width:path.getwidth() , align: 'center', fill: 'white' }); kindly advice - js fiddle this jsfiddle: http://jsfiddle.net/edward_lee/dqhzjnut/18/ you need calculate bound of each path place text center of path. find minimum x, y , maximum x, y in path.dataarray has svg data. var minx = 9999; var miny = 9999; var maxx = -1; var maxy = -1; path.dataarray.foreach(function(data){ if(data.command == 'c' || data.command == 'l'){ if(data.start.x < minx) minx = data.start.x;

c++ - Getting a bool reference from std::vector<bool> -

i know it's bad habit, i'd know workaround or hack problem. have class this: template <class t> class : std::vector<t> { t& operator()(int index) { // returns _reference_ object return this->operator[](index); } }; it's possible things this: a<int> a{1,2,3,4}; a(3) = 10; but stops working if uses bool template parameter a<bool> a{true, false, true}; std::cout << a(0) << std::endl; // not possible if (a(1)) { /* */ } // not possible std::vector<bool> specialized version of vector ( http://www.cplusplus.com/reference/vector/vector-bool/ ) doesn't allow such things. is there way how reference of boolean variable std::vector? or different solution? is there way how reference of boolean variable std::vector? no. or different solution? return typename std::vector<t>::reference instead of t& . bool , return vector's proxy type; others, return regular reference.

function - Calling php query in javascript -

so have jscript creates new text input , drop-down select each addition. first 1 have on page fine since php function gets called on page. issue have drop-down not populated query since not have javascript function calling php function. im not sure how add in. here jscript function. var counter = 1; var limit = 45; function addinput(divname){ if (counter == limit) { alert("you have reached limit of adding " + counter + " inputs"); } else { var newdiv = document.createelement('div'); newdiv.innerhtml = "hop " + (counter + 1) + " <br><input type='text' name='myinputs[]'><br>" + "type "+ (counter + 1) + " <br><select name='myinputs2[]' data-rel='chosen'><?php query() ?></select>" ; document.getelementbyid(divname).appendchild(newdiv); counter++; } } here html. drop-down (the first d

Create Spring context in OSGI through the API -

to clarify question further: i have spring xml file camel routes. want bootstrap route in bundleactivator. steps in osgi world initialize , start springcontext , register osgi registry. want custom through api – need control rather use spring dm. under stand need use osgi classes. examples follow: this not start routes: configurableapplicationcontext ctx = new genericapplicationcontext(); configurableenvironment environment = ctx.getenvironment(); //set props context xmlbeandefinitionreader xmlreader = new xmlbeandefinitionreader((beandefinitionregistry) ctx); classpathresource classpathresource = new classpathresource("context.xml",properclassloader ); xmlreader.loadbeandefinitions(classpathresource); ctx.refresh(); ctx.start(); thanks. what looking called managed service factories. take @ description @ eclipse gemini project.

How to modify different parts of a numpy array of complex numbers in parallel using python? -

how modify different parts of numpy array of complex numbers in parallel using python? question seems give answer numpy array real coefficients: is shared readonly data copied different processes python multiprocessing? , not complex coefficients. you need view array containing twice number of floats floats complex numbers: >>> shared_array_base = multiprocessing.array(ctypes.c_double, 3*3*2) >>> shared_array = np.ctypeslib.as_array(shared_array_base.get_obj()) >>> shared_array = shared_array.view(np.complex128).reshape(3, 3) the complex number format [re0, im0, re1, im1, re2, im2, ...]: >>> shared_array[1,1] = 1+2j >>> shared_array.base array([ 0., 0., 0., 0., 0., 0., 0., 0., 1., 2., 0., 0., 0., 0., 0., 0., 0., 0.]) >>> shared_array.base.base <multiprocessing.sharedctypes.c_double_array_18 object @ 0x7f7c1b5d1f80>

laravel - Eloquent ORM resulting MySQL select not returning all rows -

i using laravel's eloquent orm query database infomation, reason resulting query isn't returning of rows. eloquent query: \permit::selectraw('concat(lk_departments.dept_id, ".") dept_id, '. 'lk_departments.dept_name, '. 'count(distinct permits.permit_number) total') ->leftjoin('lk_departments', 'permits.dept_id', '=', 'lk_departments.dept_id') ->where('permits.permit_number', '!=', 'n/a') ->wherebetween('permits.valid_date', [$query_info['start_date'], $query_info['end_date']]) ->groupby('lk_departments.dept_name') ->orderby('lk_departments.dept_name', 'asc') ->get() resulting query: select concat(lk_departments.dept_id, ".") dept_id, lk_departments.dept_name, count(distinct permits.permit_number) total permits left join

ruby - Creating nested resources in Rails 4 -

i want make rails-app logic this: every client has campaign, every campaign has quest, every quest has mission. campaign belongs_to client, quest belongs_to campaign , mission belongs_to quest. im trying make nested routes "/client/client_id/campaigns/campaign_id/quest/quest_id/mission" , how should make routing? if have 4-level nesting in routes if fine? how should make index action client_quests? i think know answer. in routes.rb resources :clients resources :campaigns ........... on... end end

casting - Why to cast a class to be compared before overriding equals()? -

so in code segment below, why cast "other" class explicitly after has passed equality test of getclass() results. public boolean equals(object other) { . . . if (getclass() != other.getclass()) return false; person person = (person)other; . . . } you can person.getteronperson() when doing comparison. recall object class not contain necessary methods retrieve values want.

jquery - php for statement is working only once -

here problem, i have php statement, , whatever do, goes once through it... check vars it, , write them sure... seems ok... never works... here code ($user initialized session var): for($i=0;$i<=($size);$i++){ $test = $db->prepare("insert `test`(`val`) values ('in!!')"); $test->execute(); $name = ''; if($i==0){ $name = $db->quote("test"); }else{ $name = $db->quote("number $i"); } $number = $db->quote($i); //insert $query = "insert `test`(`name`,`number`) values ($name,$number)"; $insert = $db->prepare($query); if($insert->execute()){ $id = ''; $get = $db->prepare("select last_insert_id();"); $get->execute(); foreach($get $myid){ $id = $myid[0]; } if(!(isrel($db,$user))){ if(!(setisrel($db,$user,1))){ $error = false; }

infrared - IR Hex to Raw IR code conversion -

how hex ir code 0000 006d 0022 0003 00a9 00a8 0015 003f 0015 003f 0015 003f 0015 0015 0015 0015 0015 0015 0015 0015 0015 0015 0015 003f 0015 003f 0015 003f 0015 0015 0015 0015 0015 0015 0015 0015 0015 0015 0015 0015 0015 003f 0015 0015 0015 0015 0015 0015 0015 0015 0015 0015 0015 0015 0015 0040 0015 0015 0015 003f 0015 003f 0015 003f 0015 003f 0015 003f 0015 003f 0015 0702 00a9 00a8 0015 0015 0015 0e6e into raw ir code this int[] irdata = {4600,4350,700,1550,650,1550,650,1600,650,450,650,450,650,450,650,450,700,400,700,1550,650,1550,650,1600,650,450,650,450,650,450,700,450,650,450,650,450,650,1550,700,450,650,450,650,450,650,450,650,450,700,400,650,1600,650,450,650,1550,650,1600,650,1550,650,1550,700,1550,650,1550,650}; mir.sendirpattern(37470, irdata); the first 4 numbers there have special meaning: 1 - 0000 indicates raw ir data (you can ignore value) 2 - frequency 3 - length of first burst pair sequence 4 - length of second burst pair sequence the

Listing last 3 days items in directory using PHP -

i have following php code list data directory folder, question how list values last 3 days? secondly, asking possible add pagination code? <?php function getfilelist($dir) { // array hold return value $retval = array(); // add trailing slash if missing if(substr($dir, -1) != "/") $dir .= "/"; // open pointer directory , read list of files $d = @dir($dir) or die("getfilelist: failed opening directory $dir reading"); while(false !== ($entry = $d->read())) { // skip hidden files if($entry[0] == ".") continue; if(is_dir("$dir$entry")) { $retval[] = array( "name" => "$dir$entry/", "type" => filetype("$dir$entry"), "size" => 0, "lastmod" => filemtime("$dir$entry") ); } elseif(is_readable("$dir$entry")) { $retval[] = ar

c# - this.Controls.Add() visibility = false -

when programmatically adding label during runtime in c#, label's visibility gets changed false after "this.controls.add(whatever), not true. idea how around this? public partial class form1 : form { public form1() { initializecomponent(); label label = new label(); label.location = new point(15, 15); label.text = "test"; label.autosize = true; messagebox.show(convert.tostring(label.visible)); this.controls.add(label); messagebox.show(convert.tostring(label.visible)); } } the first messagebox displays "true", while second messagebox displays "false" you're adding label form hasn't been shown (yet), of course since entire form isn't visible, label on form isn't visible either. when form shown, label become visible.

Adjacent circles with HTML and CSS -

Image
i wonder if it's possible, , if - how, draw adjacent circles seen on image below html , css? you may try this: jsfiddle demo ( added few more circles make more interesting ) css #container { position: relative; width: 100%; padding-bottom: 100%; } #circle { position: absolute; width: 50%; height: 50%; background-color: #000000; border-radius: 50%; } #small-circle{ margin-top: 25%; margin-left: 45.5%; position: absolute; width: 40%; height: 40%; background-color: #e5e5e5; border-radius: 50%; }#smallest-circle{ margin-top: 55%; margin-left: 78%; position: absolute; width: 20%; height: 20%; background-color: #f00; border-radius: 50%; } html <div id="container"> <div id="circle"> </div> <div id="small-circle"> </div> <div id="smallest-circle"> </div> </div>

java - Spring - UTF-8 characters in object hydrated from forms -

i'm using spring retrieve validated object form: @requestmapping(value = "/docreate", method = requestmethod.post) public string docreate(model model, @valid offer offer, bindingresult result) { system.out.println(offer.getname()); } the problem offer doesn't contain proper utf-8 characters within it. for example, having żółć entered in field corresponding offer.name , end &#380;ó&#322;&#263; running above code.

javascript - Creating a binding list projection from a list of search terms -

i trying create filtered list projection collection of search terms. instance, if have 1 search term, can this: if (options.groupkey == "filtered") { this._items = data.getitemsfromgroup(this._group); var query = windows.storage.applicationdata.current.localsettings.values["filters"]; this._items = this._items.createfiltered(function (item) { if (item.content.search(query) > -1) { return true } else { return false } }) } but if 'filters' local setting crlf delimited list, this: cisco microsoft dell currently, search compare each term 'cisco/nmicrosoft/ndell' won't work. content.search doesn't accept array. should loop in createfiltered function somehow? doesn't seem in spirit of projection. accepted way this? what storing , object in "filters" settings every filter property? work you? if (options.groupkey == "filtered") {

batch file - Auto click yes in javascript -

i automate click in javascript file used convert xlsx csv. i provide snippet of script gives alert. after alert given, there way click yes being asked automatically? using create formatting utility. // determine whether or not linefeed characters should removed. var msg = "would remove linefeed characters cells?"; var title = "remove linefeed characters"; var removelf = alert.yes == alert(msg, title, alert.yesno + alert.question); // click 'yes' button here. if need user click on yes... ¿why don't assign true alert.yes ?

api - Facebook deauthorization callback is not called -

i have fb app, when enter deauthorization callback url development box address, box pinged request after app removal on fb: post /facebook/deauthorize http/1.1 host: bashman.org accept: */* content-length: 261 content-type: application/x-www-form-urlencoded connection: close fb_sig_uninstall=1&fb_sig_locale=de_de&fb_sig_in_new_facebook=1&fb_sig_time=1322732591.2685&fb_sig_added=0&fb_sig_user=1476224117&fb_sig_country=de&fb_sig_api_key=e39a74891fd234bb2575bab75e8f&fb_sig_app_id=32352348363&fb_sig=f6bbb27324aedf337e5f0059c4971 (the keys fake here) but! when enter production box url in deauthorization callback url, post request never made. tested tcpdump. no request on production machine, why? i checked mtr route production box ip address request came from, ok, 0% packet lost. the hostname port , path correct, tested 1k times, no firewall, ids, or other systems blocking ethernet slot. why post callback not called? (how can fix it?) ho

ruby - How to zip the content from a set of urls -

i have list of urls: urls = ["google.com", ..., ...] i zip content of urls after getting them, without downloading them , zipping them. is there way pipe content rubyzip ? , keeps adding things zip? something like: photos.each |photo| zip["photo_#{photo.id}.png"] = file.open(photo.url) end

c# - Delete many items with foreach and Entity Framework -

Image
please see details : database records jn_country records : jn_players records : this code : list<int> ids=new list<int> {12, 14}; foreach (var item in ids) { try { _service.delete(item); } catch (exception e) { } } first time => item 12 error : innerexception {"the delete statement conflicted reference constraint \"fk_dbo.jn_players_dbo.jn_country_jn_country_id\". conflict occurred in database \"juventusapk\", table \"dbo.jn_players\", column 'jn_country_id'.\r\nthe statement has been terminated."} system.exception {system.data.sqlclient.sqlexception} this true.because registered player country second time => item 14 error : innerexception {"the delete statement conflicted reference constraint \"fk_dbo.jn_

c# - Make controller more efficient by choosing method dynamically -

i have these 2 methods in repository: public ienumerable<post> posts { { return context.posts; } } public ienumerable<editables> editables { { return context.editables; } here method: public actionresult saveedit(int activeid,string text, string prop, string repomethod) { var elementtoedit = _repository.<dynamic insert post or editable>.elementat(activeid); var type = elementtoedit.gettype(); propertyinfo p = type.getproperty(prop); p.setvalue(elementtoedit, text, null); _repository.updatebiglinkedit(elementtoedit, activeid); return null; } so, ii possible make methid more dynamic , insert right method _repository.editables.elementat(activeid) or _repository.post.elementat(activeid); by passing name of nethod view? or have go way? yes can, using generic method: public t getelement<t>(int id) { if (ty

css - My dropdown list is too long -

my sub-menu dropdown list long , want have "column" type of instead of "top bottom" list look.....what coding need add or change? how looks now: .primary-nav ul ul.children li.page_item_has_children:after, .primary-nav-container ul ul.sub-menu li.menu-item-has-children:after { border-top: 6px solid transparent; border-right: none; border-bottom: 6px solid transparent; border-left: 6px solid #ccc; top: 25%; right: 6px; } .primary-nav ul li a, .primary-nav-container ul li { padding-bottom: 0.75em; font-size: 14px; color: #888; text-transform: capitalize; -webkit-transition: .25s ease-in-out; -moz-transition: .25s ease-in-out; -ms-transition: .25s ease-in-out; -o-transition: .25s ease-in-out; transition: .25s ease-in-out; } .primary-nav ul li a:hover, .primary-nav ul li.current_page_item a, .primary-nav-container ul li a:hover, .primary-nav-container ul li.current_page_item { color: #222; } .pri

php - How to override edit_orm_one_to_one.html.twig in SonataDoctrineORMAdminBundle? -

how can ovverride template sonatadoctrineormadminbundle / resources / views / crud /edit_orm_one_to_one.html.twig in sonatadoctrineormadminbundle? just override other vendor bundle. take on here in symfony documentation. make sure copy on whole directory structure of vendor bundle , place files in need override.

jsp - prevent double form submit with javascript on h:commandLink in jsf under jdk 8 -

we have jsf/tomcat/hibernate/oracle application upgrade java 8. develop using eclipse. upon upgrading java 8 (jdk 8) upgrading eclipse luna , tomcat 7.0.54 have experienced 2 issues. less serious 1 of graphical renderings have new not before. more serious issue have double form submission prevention script causing our h:commandlink components hang up. after clicking on such link, url gets appended #, , subsequent clicks on link (or other buttons on page) show our alert "already submitted - please wait..." comes our script. our script is: // prevent double form submissions var defaultsubmit = null; var formsubmitted = false; function initform() { if (defaultsubmit == null) { defaultsubmit = document.forms[0].submit; document.forms[0].submit = submitform; document.forms[0].onsubmit = checkformsubmission; } formsubmitted = false; } function checkformsubmission() { if (formsubmitted) { alert('already submitted - please wa

android - Change view background color into a listview -

i'm trying change background color on view component, not success public view getview(int position, final view convertview, viewgroup parent) { view view = convertview; try { if (view == null) { layoutinflater vi = (layoutinflater) mcontext .getsystemservice(context.layout_inflater_service); view = vi.inflate(r.layout.listview_accounts, null); // --clonechangerequired(list_item) } final account listitem = (account) mlist.get(position); // --clonechangerequired if (listitem != null) { int color = listitem.getcolor(); view vcolor = (view) view .findviewbyid(r.id.lv_account_view_color); vcolor.setbackgroundcolor(color); } } } catch (exception e) { } return view; } i can set text in textview, set color not working. can helps me how set color? thanks the example color used is: -16711717 edit listvie

java - Using PowerMockito to mock method with void return-type: "invalid void parameter" -

i having trouble trying unit test java code @ point calls native methods. basically, trying use powermockito mock class call native. able mock non-void methods fine, keep getting compilation errors when try mock method of void return type. here example of code i'm trying test: public class classthatcallsnative { void initobject(bytebuffer param1, int param2) { //calls native } int getid(int param1) { //calls native } } i have code in test class: powermockito.when(mclassthatcallsnative.getid(mockit.anyint())).thenreturn(0); this line of code compiles fine, following line compilation error: powermockito.when(mclassthatcallsnative.initobject(mockit.any(bytebuffer.class), anyint())).donothing(); the error message says invalid void parameter , points .initobject. idea doing wrong? for void methods, need use below one powermockito.donothing().when(mclassthatcallsnative.initobject(mockit.any(bytebuffer.class), anyint()))

sql - COLUMN STORE INDEX vs CLUSTERED INDEX..Which one to use? -

Image
i’m trying evaluate type of indexes use on our tables in sql server 2014 data mart, using power our olap cube in ssas. have read documentation on msdn , still bit unclear right strategy our use case ultimate goal of speeding queries on sql server cube issues when people browse cube. i have tables related each other shown in following snow flake dimensional model. majority of calculations going in cube, count distinct of users (userinfokey) based on different combination of dimensions (both filters , pivots). keeping in mind, sql experts suggest in terms of creating indexes on tables?. have option of creating column store indexes on tables (partitioned hash of primary keys) or create regular primary keys (clustered indexes) on tables. 1 better scenario? understanding cube doing lot of joins , groupby’s under covers based on dimensions selected user. i tried both versions sample data , performance isn’t different in both cases. before same experiment real data (it’s going take

c# - Changing ListView's selected item from code -

Image
i'm constructing application using wpf , i'm having trouble figuring out how display new selection in listview that's selected via code. i have listview bunch of items. want put button moves selected item next item in view. have able deselect item, move next item, , select selection appears user. my xaml code follows: <border grid.row="1" cornerradius="10" borderbrush="black" borderthickness="10"> <listview x:name="lvlogpackets" background="#ff0c3a58" foreground="white" selectionchanged="lvlogpackets_selectionchanged" selecteditem="{binding mode=twoway, updatesourcetrigger=propertychanged, path=isselected}"> <listview.contextmenu> <contextmenu name="lvcmenu" opened="menuopened_click"> <menuitem header="filter checked" ischeckable="true" checked="menuviewcheckbox_c

javascript - Can images under other have focus (for hovering over)? -

i have page-full of thumbnails, let's call them a,b,c, etc. laid out like: a,b,c,d,e, f,g,h,i,j, k,l,m,n .. etc. when hover-over one, gets z-index:+1 , enlarges 2.5 times size - hence, if hover on a, enlarges & obscures b , f , g. therefore next see e.g. b 1 must move mouse away enlarged version of (at point image enlarge) , move mouse b. hence lots screen 'flashing' etc. is there way display a, when mouse moves away top-left portion, underlying next in line (b) has focus , enlarges. i looked @ html's <area> , <map> tags without success. currently have: <!doctype html public "-//w3c//dtd xhtml 1.0 transitional//en" "http://www.w3.org/tr/xhtml1/dtd/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="content-type" content="text/html; charset=utf-8" /> <title>...</title> <style type="text/css&

scala - Correction for error: - required:spray.httpx.marshalling.ToResponseMarshallable -

i'm new scala, , trying write little rest api. using scala 11.2, spray 1.3.1 , akka 2.3.6. i trying compile example spray. error each of routes is: type mismatch; found : string("pong!!!!!!!!") required: spray.httpx.marshalling.toresponsemarshallable i unsure if versions incompatibility issue or missing reference. here route definition taken spray example : package com.shenandoah.sbir.httpinterface import spray.routing.httpservice trait httpinterface extends httpservice { def pingroute = path("ping") { { complete("pong!!!!!!!!") } } def pongroute = path("pong") { { complete("pong!?") } } def piproute = path("pip") { { complete("moonshine") } } def rootroute = pingroute ~ pongroute ~ piproute } here actor: package com.shenandoah.sbir.httpinterface import akka.actor._ class httpinterfaceactor ex

Strange python error with subprocess.check_call -

i'm having strange error python subprocess.check_call() function. here 2 tests should both fail because of permission problems, first 1 returns 'usage' (the "unexpected behaviour"): # test #1 import subprocess subprocess.check_call(['git', 'clone', 'https://github.com/achedeuzot/project', '/var/vhosts/project'], shell=true) # shell output usage: git [--version] [--exec-path[=<path>]] [--html-path] [--man-path] [--info-path] [-p|--paginate|--no-pager] [--no-replace-objects] [--bare] [--git-dir=<path>] [--work-tree=<path>] [--namespace=<name>] [-c name=value] [--help] <command> [<args>] commonly used git commands are: [...] now second test (the "expected behaviour" one): # test #2 import subprocess subprocess.check_call(' '.join(['git', 'clone', 'https://github.com/achedeuzot/project

javascript - Update new color in Color Picker Palette -

i installed jquery plugin color picker: colpick.js , don't know how set new color circle icon in color palette (after refresh page element's bg changed circle icon in palette still in default color area color:'003a7d .it not updating.)(however,color picker , cookie working well.) this code: html : <div id="picker"></div> js : if($.cookie('body_color')) { $('body,.livebgchanger ul li a').css('background-color', $.cookie('body_color')); } else { $('body,.livebgchanger ul li a').css('background-color', '#003a7d'); } $('#picker').colpick({ flat:true, submit:0, layout:'full', color:'003a7d', //default color onchange:function(hsb,hex,rgb,el){ $('body,.livebgchanger ul li a').css('background-color', '#' + hex); $.cookie('body_color', '#' + hex, { ex