Posts

Showing posts from July, 2015

Java Multidimensional Arrays -

i in process of learning java , confused on multidimensional arrays. when don't mean array syntax more logic of using arrays statements. wondering how incorporate arrays statements correctly , of code in play do, , why there. here code have been working on (based off tutorial) , wondering if explain going on. package tutorial; public class apples { public static void taco(string[] args) { int firstarray[][]={{8,9,10,11},{12,13,14,15}}; int secondarray[][]={{30,31,32,33},{43},{4,5,6}}; system.out.println("this first array"); display(firstarray); system.out.println("this second array"); display(secondarray); } public static void display(int x[][]) { (int row=0;row<x.length;row++) { (int column=0;column<x[row].length;column++) { system.out.println(x[row][column]+"\t"); } system.out.println(); } } so don't understand entire public static void display(int x[][]) {

actionscript 3 - FileReferenceList doesn't fire events -

select , cancel events not fired, did in new project make sure problem didn't came part of code. "event fired" never appears in output when click on "open" after selecting files filereferencelist.browsing dialog. tried filereference , didn't work. other events other elements works (like addedtostage, click, touch, etc). using air as3 projector project on flashdevelop air 14 , flex 4.6.0. this main.as : public class main extends sprite { public function main():void { var asd:filereferencelist = new filereferencelist(); asd.addeventlistener(event.select, traceresult); asd.browse(); trace("filereferencelist browsing..."); } public function traceresult(e:event):void { trace("event fired"); } } application.mxml : <?xml version="1.0" encoding="utf-8" ?> <application xmlns="http://ns.adobe.com/air/application/14.0"> <i

How to test rspecs configure_devise_params in Rails 4? -

simplecov telling me need test method (class requires 100% passing tests in simplecov) how can go testing these in rspec? before_filter :configure_devise_params, if: :devise_controller? def configure_devise_params devise_parameter_sanitizer.for(:sign_up) |u| u.permit(:name, :email, :password, :password_confirmation) end devise_parameter_sanitizer.for(:account_update) |u| u.permit(:name, :email, :password, :password_confirmation, :current_password) end end i have created application_controller_spec.rb file.

php - Inserting rows for grandparents and great grandparents -

i'v created query display table lists state birds, gs.symbol = bird's common name (e.g. robin) , gs.latin = scientific name. gg.name = name of state (e.g. alaska), , gg.idparent = 'usa'. display looks this: <tr><td>brown thrasher</td><td>georgia</td></tr> <tr><td>robin</td><td>michigan, wisconsin</td></tr> and here's query: $stm = $pdo->prepare("select gs.symbol, gs.latin, group_concat(gg.name) names, gg.idparent gw_geog gg left join gs gs on gs.idarea = gg.idarea gg.idparent = 'usa' , gs.desiggen = :refcat group gs.symbol order gs.symbol, gg.name"); $stm->execute(array( 'refcat'=>$refcat, )); i modify table rows ordered taxonomically, , rows featuring names of families (grandparents) , orders (great grandparents) inserted, this: <tr><td><b>passeriformes</b> (order)</td><td></td></tr> <tr><

sublimetext3 - Go to selected string after 'find' in sublime text -

after finding string in single file using sublime 'find' field. there key command begin editing selection? after finding string want - press 'esc' button , able edit selection. hope helps.

web api - Supporting multiple languages in a REST API -

i have collection of cities i'm creating rest api (my first rest api). each city has number of language independent things, such founding date , population count. cities have things depend on language, such title , short description. internally city documents have format: { "population": 9042, "name": { "en": "berlin", "nl": "berlijn", // ... }, // ... } the users of api want view city info specific language only, , like: { "population": 9042, "name": berlin, // ... } i've made these accessible via /cities/:id/:language_code , instance cities/123/en . want implement listing of cities: get /cities . there requested language needed. since result in /cities/:language_code , i'm getting impression putting @ end of url not idea, , suspect i'll better off /en/cities/...whatever... . how typically done in rest apis? big, nicely implemented, ap

iOS Parse: Add / Get array of PFUsers -

in app, have playlist, want share friend. in parse save playlist objects , user created playlist save key: @"user_id" . now changed pointer _user array of users sharing future. saved in @"user_id" column, array of users (users have access same playlist) : [ { "__type" : "pointer", "classname" : "_user", "objectid" : "teh3s20xxx" }, { "__type" : "pointer", "classname" : "_user", "objectid" : "hgkcjhyi9t" }, { "__type" : "pointer", "classname" : "_user", "objectid" : "k2dztekpix" }, { "__type" : "pointer", "classname" : "_user", "objectid" : "4dbmdur6lf" } ] now need check if current user using playlist mentioned above. how can check if user object in @"

db2 - sql statement to select and insert one value from one table rest from outside the tables -

i have 2 db2 tables, table 1 contains rows of constant data id 1 of columns. second table contains id column foreign key id column in first table , has 3 more varchar columns. i trying insert rows second table, entry id col based on clause , remaining columns values outside. table1 has columns id, t1c1, t1c2, t1c3 table2 has columns id, t2c1, t2c2, t2c3 to insert table2, trying query: insert table2 values (select id table1 t1c2 'xxx', 'abc1','abc2'); i know basic missing here. please correcting query.

python - sort lat long by location (top left, top right) using pandas -

Image
i sort list of lat / long points have in pandas ordered by: top left, top right, bottom left, bottom right. aka, top left bottom right. my 4 point collections rectangles, still irregular. have many of them , first idea df.sort([objectid, lat, long] acceding = [true, true, false]) doesn't quite work. all posts i've looked through tagged related take veer off advanced programming. maybe search terms off. hoping sorting method fit needs. this interview question had. approach, accepted, find degree origin of each point. after have each degree, it's pretty straight forward organize 65 < 76 < 76 < 90 . since thorough implementation, reccomend making class, let's call "euclideanpoint". each euclideanpoint has 2 attributes pair (for actual coordinates) , degree. can override < operator , equality operator (by definining special methods in class you're writing, i.e., methods names start , end 2 underscores). from there or

laravel - SQL Join/LeftJoin Statement Returning Null -

i'm trying join 2 queries statement: $item = category::where('type', $item) ->leftjoin('inventory', 'inventory.id', '=', 'categories.id') ->get(); return view::make('general.buy') ->with('items', $item); this view (this returns null): @foreach ($items $item) {{ $item->id }} @endforeach the problem if there no inventory id value equal category id field, query returns id null. does know why happening , how can solve it? should mention new laravel, please keep in mind when rating question. in advance! i think answered own question. it's more left join means. have 2 tables, inventory , category correct? according query (or @ least can tell) generate sql simliar to select category left join inventory on inventory.id = categories.id this says, select rows category , if have match in inventory fill in columns queried (inventory.id) supply v

arrays - Testing for uppercase, why is toUppercase() alphanumeric in javascript? -

how isolate touppercase() disregard numbers live code var data = 'lol'; var data2 = '1 2 3 4'; if(data2 === data2.touppercase()) { document.write('hey'); }else { document.write('nope'); } both write hey document! why in javascript touppercase() think numbers uppercase letters? best way test uppercase not numbers also? you can use regex match see if string contains uppercase letters: var uppercaseletters = /^[a-z]+$/; if(data2.match(uppercaseletters)) { document.write('hey'); } else { document.write('nope'); }

google oauth - Determine if user is a domain administrator -

i see in https://developers.google.com/+/api/latest/people#resource domain name. don't see indication of user role. know if user domain administrator can give them more rights within our application. you must use directory api info. note need oauth token admins rights use api.

css - Footer is Overlapping an element, Quick Solution to auto push it down? -

i apologize ahead of time, not skilled web designer @ all, , did googling before asking this, complicated solutions require creating new divs , stuff, hoping there simple mod or line add existing code footer solve this? here site: http://ratecitident.com/ see how black footer overlapping ratings box, how can prevent this, keep footer @ base on size screen? may not show problem on screen, on sizes, , on phones. how looks on desktop screen: http://gyazo.com/112b627bb056fc0bc6eb48070939d9b7 thanks you can add little bit of code css: div#content { margin-bottom: 20px; } this gonna give more spacing,because forcing footer bottom of content div 20px . you can always,target specific screen using media queries ,in case must target iphone screen,here tutorials media queries. css-tricks.com's tutorial mozilla developer network's tutorial

php - Laravel Eloquent - Ordering by specific ID of the child -

i have 3 models: schedule , shift , , user . schedule has many shift , , each shift belongs schedule , has 1 user . to schedule (with shifts , user), use: schedule::with(['shifts', 'shifts.user'])->find($id); i want order schedule specific user id - i.e. if looking @ schedule, want shift first 1 on schedule. all find online how order parent eloquent model (i.e. schedule here) using orderbyraw() user::orderbyraw(db::raw("field(id, $user_id)")); i tried put in $query of with statement, didn't work: schedule::with( [ 'shifts', 'shifts.user' => function($query) use ($user_id) { $query->orderbyraw(db::raw("field(id, $user_id)")); } ])->find($id); any ideas?

ruby on rails - Kaminari custom config per page -

i have on kaminari config: kaminari.configure |config| config.default_per_page = 50 end and want set custom value per page action: @my_models = mymodel.all.per(20) i set this: @my_models = mymodel.all.per(kaminari.my_custom_per_page) because change test action less objects. possible? class mymodel < activerecord::base paginates_per 20 ... end

vb.net - How do I parse JSON children using JSON.NET? -

i’m trying results in textures: […] in json obtained http://t0.rbxcdn.com/ca063a6bab4e145de481384a8a62d64f , display in listbox. i have code: public class returnobject public property url string public property textures string public property obj string public property mtl string public property final boolean end class dim input2 string = obj.text dim json2 returnobject = jsonconvert.deserializeobject(of returnobject)(input2) obj.text = httpget("http://www.roblox.com/thumbnail/resolve-hash/" + json2.obj) mtl.text = httpget("http://www.roblox.com/thumbnail/resolve-hash/" + json2.mtl) but error error reading string. unexpected token: startarray. path 'textures', line 1, position 313. textures array in json, containing 1 string (mind brackets*): "textures":["bff5714f0b959385663b1fe030b87064"] you can reflect in class structure (mind brackets**): public class returnobject public

html - Error Passing Variable to Include in PHP 5.3 -

index.php if (!$result) { $error = 'no value found.'; include 'error.html'; exit(); } while ($row = mysqli_fetch_array($result)) { $myvalues[] = $row['valueid']; } include 'output.html'; exit(); output.php <?php foreach ($myvalues $allmyvalues): ?> <?php echo $allmyvalues; ?> <?php endforeach; ?> error "undefined variable: myvalues in ...output.php" rest of page displays properly. using apache 2.2.15/php 5.3 any idea wrong? seems functioning, $myvalues not getting passed. running on windows 2k box, don't think upgrading apache/php option. thanks in advance. the problem you're assuming there no results found if $result false ; however, return value returned if there query error. empty result set still considered successful query result. recommend moving logic around bit: $myvalues = array(); if ($result) { while (($row = mysqli_fetch_array($re

mysql - sql select with count condition -

i have 2 tables in db, first table called "questions" , hold questions id, second table called "answers" , hold answers questions (as multiple choices). how select questions have less 4 answers? questions table: id question 1 ...? 2 how many ...? 3 ....? answers table id question_id answer 1 1 54 2 1 11 3 1 22 4 2 england 5 1 5 6 2 turkey how select questions have answers less 4? thanks, select questions.id, questions.question questions inner join answers on questions.id = answers.question_id group questions.id, questions.question having count(questions.id) <4 here go.

android - Custom onClick attribute is not working -

i created compound view consisting of 1 textview , 1 "buy" button . for compound view, made custom attribute called onbuyclick . supposed serve same purpose view 's onclick attribute, have listener not on whole view on button. so, first thing did copy view class onclick attribute does. , worked! (with minor adaptations). but add btnbuy.setonclicklistener(new onclicklistener() { , becomes unable find method want , throws illegalstateexception ( the second one, nosuchmethodexception being caught ). here piece executed once onbuyclick attribute: if (context.isrestricted()) { throw new illegalstateexception("the android:onclick attribute cannot " + "be used within restricted context"); } final string handlername = a.getstring(attr); if (handlername != null) { btnbuy.setonclicklistener(new onclicklistener() { //as "btnbuy." added, crashes once button pressed. private method mhandler; public

javascript - window.history.back();return false;" not working in IE11 -

<select id='orgincountryid' onchange='fillsubdropdownlist(this.value)'> <option>-- select country --</option> <option>malaysia</option> <option>philippines</option> </select> <select id='orgincityid'> <option>-- select city/town --</option> <option>kuala lumpur</option> <option>manila</option> </select> <a href="#" onclick="window.history.back();return false;" class="btngrey"><span>back</span></> it not working ie11, city option missing. when select county city automatically loads. when click button country option shows fine, city option missing in ie, other browsers working fine. try <a href="#" onclick="window.history.go(-1); return false;" class="btngrey"><span>back</span></a> or <a href="#" onclick

assembly - Push constant directly or Mov Eax and Push Eax -

there difference in push constant value directly call function, instead of mov value eax , push eax. for example in c: getstdhandle(std_output_handle); many compilers generate this: ;b8 f5 ff ff ff mov eax,-11 ;50 push eax call getstdhandle and manually i'm using; ;6a f5 push -11 call getstdhandle there wrong pushing value directly instead load on eax , push eax ? what have should ok, assuming code in 32 bit mode. you explicitly specify 32 bit immediate, in case of visual studio (2005) assembler (ml.exe), used full 32 bit operand size instead of sign extended byte value: ; 68 f5 ff ff ff ; push dword ptr -11 even specifying byte ptr visual studio's assembler (ml.exe) works: ; 6a f5 ; push byte ptr -11 however, using word ptr results in 66 prefix , 16 bit push (esp subtracted 2 instead of 4): ; 66 68 f5 ff ; push word ptr -11 in case 66 prefix changes operand size (the value pushed onto stack) 16 bits.

php - Test exception in CodeIgniter using PHPUnit/CIUnit -

i have method in person_model.php: public function getinfo() { $result = array(); try { // } catch(exception $exception) { log_message('error', $exception->getmessage()); } { return $result; } } and how can test exception , make sure log_message() method called when exception caught ? thanks !!! it can't done easily, because there isn't way mock call log_message. code above however, may able test return value or might change if exception thrown. example, let's if exception thrown, , can sure in case returned value empty array. example, test count of return 0.

How to fetch between a range of indexes in mongodb? -

i need help.. there method available fetch documents between range of indexes while using find in mongo.. [2:10] (from 2 10) ? if talking "index" position within array in document want $slice operator. first argument being index start , second how many return. 0 index position 2 "third" index: db.collection.find({},{ "list": { "$slice": [ 2, 8 ] }) within collection if use .limit() .skip() modifiers move through range in collection: db.collection.find({}).skip(2).limit(8) keep in mind in collection context mongodb has no concept of "ordered" records , dependent on query and/or sort order given

windows installer - InstallShield XML File Merge -

i using config xml file installer , need when user upgrades installer, new config file generated should merged previous config file, should save changes user have made on previous config files + should show new config file changes , merged. i used installshield xml file changes option, when changed content in installed config file , upgraded software, instead of merging content, added duplicate node new xml file. below happening : original xml file : <?xml version="1.0"?> <configuration> <startup uselegacyv2runtimeactivationpolicy="true"><supportedruntime version="v4.0" sku=".netframework,version=v4.0"/></startup> </configuration> user manually altered uselegacyv2runtimeactivationpolicy="false" , after when user upgraded software, xml becomes <?xml version="1.0" encoding="utf-8"?> <configuration> <startup uselegacyv2run

html - How to display emoji using angularJs? -

i new angularjs , using "emoji-min.js" , "emoji-min.css" display emoji in text field. but not able display. here code: <!doctype> <html ng-app = "app"> <head> <meta charset="utf-8"> <link rel="stylesheet" href="emoji.min.css"> <script src="angular.min.js"></script> <script src="emoji.min.js"></script> <script> var app = angular.module("app", ["emoji"]) app.controller("appctrl", function ($scope) { $scope.message = "string including emoji codes :smiley:"; }); </script> </head> <body ng-controller="appctrl"> <textarea ng-model="message"></textarea> <p ng-bind-html-unsafe="message | emoji"></p>

Find large strings allocation during java debug session -

after analyzing heap dump found there 30mb strings allocated (single string of 30 mb). there way set break point while debugging application can find code allocates these huge strings? since thousands of strings allocated during application run isn't possible putting break point on each string allocation. believe conditional break point slow well. if possible want exam strings content understand origin of these allocation. example may result of web service call called small amount of data in rare cases huge input (which cases want find). i'd try conditional breakpoint, if meant leaving app running day or two. @ least can on else while running. , other solution take day or 2 implement anyway. failing that, using aspectj add pointcut string constructors , use log message, throw exception etc. same conditional breakpoint should run more quickly.

Qt colliding selection boxes -

this app draws graphic items flags itemismovable , itemisselectable. qgraphicsview handles keyboard , mouse interaction. i select smallest item in surface, if 2 boundingrects() collide; example, imagine 2 rectangles, 1 inside other. user clicking inside rectangle expect 1 selected. my ideas : (1) recalculate z-indexes each time item changes shape. seems little overkill. (2) reimplementing qgraphicsitem.shape() [ items segment paths - if selection on segments , not on bounding box, work ] - returning qpainterpath() didn't seem trick. (3) catch mouse events inside items first , (?) override default selection mechanism. seems overkill. is there easy way achieve goal? thanks, sébastien when user selects item , graphics view receives position, can use position, convert scene coordinates , call qgraphicsscene::items function. return items @ given position. now have list of items @ point user selected, can compare items find smallest , set selected .

elasticsearch - Two same level stats aggregation -

can have 2 same level aggregations? example want have 2 stats aggregation of 2 different fields in single bucket aggregation. how can particularly? ok got solution { "size" : 0, "query" : { "filtered" : { "query" : { "match_all" : { } }, "filter" : { "and" : { "filters" : [ { "numeric_range" : { "transactiondate" : { "from" : "2013-08-01", "to" : "2013-11-01", "include_lower" : true, "include_upper" : true } } }] } } } }, "aggregations" : { "monthwise1" : { "date_range" : { "field" : "transactiondate", "ranges" : [ { "key&q

api - Soundcloud:How to have multiple tracks in one player -

i'm trying figure out how have multiple tracks queued under 1 player case here soudcloud widget api playground , i've tried viewing source of page in iframe xml error. in short replicate player on soundcloud api playground page without having authenticate users , retrieve sets you not have authorise users, have use playlists in order show more 1 track soundcloud widget. can show widget users’ favorites or particular users’ tracks.

javascript - Grouped bar chart "in one line" with D3.js -

Image
i'm trying make particular bar chart d3.js, , don't find example match. code bar chart 2 series (one negative, , 1 positive) disposed on same line, not stacked. i guess maybe it's not clear, i've made on highcharts . want use d3 connect chart map did before. so, know example me? can sort directly chart if series unordered? , if 2 series punctually postive, little 1 appear in front of largest? the trick order data, in order so, can use [d3.ascending()][1] functions: with following example data: data = [{ name: "a", valueright: 1, valueleft: 2 }, { name: "b", valueright: 4, valueleft: 5 }, ...] we have: function leftbound(node) { return d3.max([node.valueleft,-node.valueright]) } function rightbound(node) { return d3.max([node.valueright,-node.valueleft]) } datasort = function(a,b) { res = d3.descending(leftbound(a),leftbound(b)) if(res==0) { return d3.descending(rightbound(a),r

jquery - Document.ready function is not working after new pageload -

my code this, page1.html <button onclick="loadnextpage();"> <div id="main"> </div> function loadnextpage() { /*i calling end code here gives page2.html*/ $("#main").html(response); } page2.html <script type="text/javascript"> $(document).ready(function(){ alert("document.ready in social") jquery("abbr.timeago").timeago(); }); </script> <div class"submain"> <time> <abbr class="timeago" title=${rec[5]}>${rec[5]}</abbr> </time> </div> i getting page2.html inside specified div. problem 2 lines inside document.ready function not working. please me in case. your page2 loading via ajax in case, in page2 script should after element,it should this: <div class"submain"> <time> <abbr class="timeago" title=${rec[5]}>${rec[5]}</abbr> </time&

css3 - Can I do a diagonal line in CSS? -

Image
i want design this: so in fact left side background-color , right side background-color ( divs of course, easy). but can diagonal line css? you can achieve shape skewed pseudo element : demo html : <div> <h1>your title here</h1> </div> css : div{ padding:0 10px 10px; background:#e7e5dd; } h1{ margin:0; display:inline-block; position:relative; z-index:1; padding:10px 50px 10px; overflow:hidden; } h1:before{ content:''; width:100%; height:100%; position:absolute; top:0; left:0; background:#fff; z-index:-1; -webkit-transform: skewx(-20deg); -ms-transform: skewx(-20deg); transform: skewx(-20deg); -webkit-transform-origin:0 0; -ms-transform-origin:0 0; transform-origin:0 0; }

Open iOS app from Costom URL Schema and pass parameters using post method -

can pass "post" parameters along custom url schema open ios application. it not possible, although url parameters should enough pass simple data. added couple links below should pass data using custom url scheme. http://iosdevelopertips.com/cocoa/launching-your-own-application-via-a-custom-url-scheme.html http://www.idev101.com/code/objective-c/custom_url_schemes.html how take parameter url scheme.

php - Undefined index if the array -

i using following function options stored in wordpress. function get_settings( $option ) { $options = get_option( 'my_options', my_default_options() ); return $options[ $option ]; } in above function my_default_options() returns array has default values. if call above function like: get_settings("title"); work fine if "title" exists in default options array. however if title not exist in default options array, following warning: notice: undefined index: how can fix notice? tried following: function get_settings( $option ) { $defaults = my_default_options(); if(in_array($option, $defaults)){ $options = get_option( 'my_options', my_default_options() ); return $options[ $option ]; } } but still returns same notice. make sure if exists or not using isset function get_settings( $option ) { $defaults = my_default_options(); if(in_array($option, $defaults)){ $options = ge

file - Different behaviour of [NSMutableString writeToFile] in iOS7 and iOS8 -

Image
here have demo code saving nsmutablestring in file (filename.dat) nserror* error = nil; nsmutablestring* dat = [[nsmutablestring alloc] initwithcapacity:1]; bool result = [dat writetofile:@"filename.dat" atomically:yes encoding:nsutf8stringencoding error:&error]; but have 2 different output while rung in ios7 , ios8beta5 output xcode5+ios7 output xcode5+ios8 while running in ios7 shows there in error in parsing file path , in ios8beta5 it crash saying [nsfilemanager filesystemrepresentationwithpath:] have nil or empty path . question : in both sdk ios8 , ios7 take nserror argument return error, believe should return error instead of crashing application apple mansion changes regarding it, if yes please give me reference link same. the path pass [nsdata writetofile:atomically:] not complete , should full path. that done getting path documents folder , appending filename.

jquery - Google Analytics Tracking Event Not Working -

i've added tracking event using jquery onclick using google analytics.js doesn't work @ all.. fire event undefined in response. <script> (function(i,s,o,g,r,a,m){i['googleanalyticsobject']=r;i[r]=i[r]||function(){ (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new date();a=s.createelement(o), m=s.getelementsbytagname(o)[0];a.async=1;a.src=g;m.parentnode.insertbefore(a,m) })(window,document,'script','//www.google-analytics.com/analytics.js','ga'); ga('create', 'ua-36828246-2', 'curiousworkout.com'); ga('send', 'pageview'); </script> <script type="text/javascript"> jquery(document).ready(function(){ $('#generate_header').click(function(event){ event.preventdefault(); ga('generate_workout', 'header_click'); window.location = $(this).attr("href"); }); $('#generate_top_list').click(function(){ ga('gener

android - Get the value bottommost TextView that add programmatically? -

Image
i adding textview programmatically on linearlayout : and click on textview , pass ids , texts of textview activity (with sharedpreferences ). but when data sharedpreferences in activity , see data log id , value bottommost textview . (for example see data of textview_3 ). but perhaps had multiple textview on linearlayout , click on 2nd textview or textview me data of bottommost textview . public class chatpage extends activity { textview[] txt; @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.chat_page); txt = new textview[totalpersons]; (int s = 0; s < listofpersons.getlength(); s++) { txt[s] = new textview(chatpage.this); if (group.equals("admin")) { txt[s].setonclicklistener(new onclicklistener() { @override public void oncli

sql - MDX - Sum only selected dimension members? -

i'm quite new mdx , i'm having bit of issue aggregation of 1 of measures. in dsv have "events" table. track agents run these events, , since multiple agents can involved in running single event, have split out separate table of "agent" bridging table in middle: http://imgur.com/uay3moc i want track called "coverage", number of events held in particular week , each agent ran event. if there 3 events held 1 week, , 1 of these events run 2 agents, coverage of 4. when go analyse cube, dragging on week commencing , count of events, note isn't right - considers individual events , not number of agents. dragging on agents solves still want see overall figure without having drag on agents. so created calculated member so: create member currentcube.[measures].[visit coverage] iif([agents].[agent].currentmember.parent null, sum([agents].[agent].[agent], [measures].[events count]), [measures].[events count]); so basically, if agents se

javascript - issues with jquery.mouseenter() jquery.mouseleave() and child elements -

my issue, child(ren) of containers: quint-... , mark-... , seal-... , glyph-... don't respond .mouseenter() or .mouseleave() . here's code project working on, yes - league of legends related content: html: <table class="runes left"> </table> <div class="rune-calc right"> <div class="quint-container"></div> <div class="mark-container"></div> <div class="seal-container"></div> <div class="glyph-container"></div> </div> css: html, body { height:100%; background-color:#f7f7f7; background-size:cover; background-repeat:none; background-position:center; } * { margin:0; padding:0; font-size:12px; font-weight:400; } * .left {float:left;} * .right {float:right;} * .center {margin:auto auto;} * { font-family:inherit; font-size:inherit; font-weight:inherit; text-decoration:none

php - Symfony2 application admin and user area -

i starting project symfony2 framework , need have 2 type of users, admin , simple user. correct create 2 bundles, 1 each type of user areas in asp.net mvc? if have admin area complete different user area, create bundle each. if example adminarea got additional functionality, keep in 1 bundle. i'm not sure asp.net in symfony bundle complete application closed in itself. example blog or forum bundle. or simple pagination can bundle.

c# - Object deep copy in Silverlight -

i trying create copy of objects in silverligth 5 interfaces iformatters , iccloanble not support. * my objects this: (note these obkjects obtained on deserializing xml): tried copy this: [xmlroot(elementname = "component")] public class component { [xmlelement("attributes")] public attributes attributes { get; set; } [xmlignore] public attributes atrbtorginal = new attributes(); [xmlignore] public attributes atrbtcopy{ get; set; } } public component() { atrbtcopy= atrbtorginal ; } sure not work got code on seraching on google : public static class objectcopier { public static t clone<t>(t source) { if (!typeof(t).isserializable) { throw new argumentexception("the type must serializable.", "source");

android - test if a specific key was used to sign an .apk file -

i have .key file , signed .apk file (android phongap application built using phonegap build). how can check if .apk signed using key? you retrieve , compare fingerprints of public keys included in apk file , key file. for apk: unpack file /meta-inf/cert.rsa apk. use keytool -printcert -file cert.rsa compute sha1 + md5 fingerprints. for key file: run keytool -list -v -keystore <keystore file> -alias <key alias> . input keystore password. this output sha1 + md5 fingerprints. if omit -v md5 fingerprint printed.

python - Robbers language - translating back? -

so python robbers language question mentioned here: i made python 'robber's language' translating programme, there way? is great - , enjoying regex solution - there similar regex solution put robbers language in it's original word? you can still use regex substitution pattern consonant followed o , itself: import re print re.sub(r'([bcdfghjklmnpqrstvwxyz])o\1', r'\1', 'tothohisos isos fofunon') output this fun

objective c - How to do a PFRelation or relational database query with parse in IOS -

Image
how can perform pfrelation query when select shop displays menu item associated it. my tables in parse looks menu table/class retailer table/class in ios code have 2 uitableviews 1) uitableview display "shop_name" retailer table, 2) uitableview display "item_name" menu table. i have gone far displaying "item_name" irrespective of association/relation table. code looks this. - (void) retrievefromparse{ pfquery *retrievemenu = [pfquery querywithclassname:@"menu"]; //[retrievemenu wherekey:@"retailer_id" equalto:_shopobjectid]; //test [retrievemenu findobjectsinbackgroundwithblock:^(nsarray *menuobjects, nserror *error) { if(!error){ _menuobjects = [[nsmutablearray alloc]initwitharray:menuobjects]; nslog(@"%@", _menuobjects); } [_menuobjectstableview reloaddata]; }]; } i have logic pass "objectid" of current selectedrow in uitableview1.

Problems making a silent install within a Cusom Action in C# -

i want silently install application named instacal within custom action written in c#. in custom action installing other applications , works fine(they not silently installed!). when silent installation of application named instacal started, nothing ever installed(i check programs , features). in custom action following: int ms = 0; // execute instacal silently - must present on user machine! var filename = path.combine(folder3rdparty, @"instacal\instacal.msi"); process installerprocess; installerprocess = process.start(filename, "/q"); while (installerprocess.hasexited == false) { streamwriter file = new streamwriter("c:\\test.txt", true); file.writeline("ms: " + ms); file.close(); thread.sleep(250); ms += 250; } i writing file test how long time installaltion approximately takes. takes 3 seconds in while loop , afterwards nothing installed. but if use same code in small console application application insta

c# - How to pass initial json to another function in MVC controller -

i trying implement state machine mvc controller. client sends json messages action play of controller. each message has messagecode , other additional data, depends on messagecode. exampple: {messagecode:1, words:["aaa","bbb","ccc"]} {messagecode:2, clientsage: 56, clientsname:"jon"} ... thus, have public jsonresult play(int messagecode) { switch(messagecode){ case 1: //perform additional checks return _dosomething1(words); case 2: //perform additional checks return _dosomething2(clientsage,clientsname); // } and each of private methods _dosomething1,_dosomething2 etc. have different signatures. you use json function return json serialization of properties, like return json(clientsname) and use json() want converto json if want serializa , deserealize json, chek link how to: serialize , deserialize json data

html - How can I make 2 cells inside a CSS display: table-row occupy 50% of the row? -

i have following html: <!doctype html> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title></title> </head> <body> <div id="def" style="margin-bottom: 4rem; margin-left: auto; margin-right: auto; margin-top: 7.25rem; width: 90%;"> <div id="abc" style="display: table-row; width: 100%;"> <div style="width: 50%; height: 20px; background-color: green;"> want fill 45% of width of screen </div> <div style="width: 50%; height: 20px; background-color: red;"> want fill 45% of width of screen </div> </div> </div> </body> </html> i tried code above seems divs inside table-row don't expand in width. if possible solution within div id of abc cannot change style of div def you can following desir

lua - Called function from a new library -

i make script lua in call 1 of function new library. library declared in linit.c because on embedded system. ( create new c library in lua ). think need add link between script , lua source require. have no idea, require seems not answer.

javascript - Why selectAll("element") is important in d3js while generating a chart -

i'm learning d3js these days, following example have tried of d3js documentation. <script> var data = [4, 8, 15, 16, 23, 42]; d3.select(".chart").selectall("div").data(data).enter().append("div").style("width", function(d){return d * 10 + "px"; }).text(function(d){return d;}).attr("class", "bar"); </script> i'm not clear in why selectall() important in code snippet. without selectall() can generate chart, it's creating outside of body tag. can 1 me understand this. role of selectall() in here. thanks. the selectall statement allows manipulate set of dom elements, or without data binding. instance, modify paragraphs in page: // select paragraphs in document , set font color red d3.selectall('p').style('color', 'red'); in d3, manipulate dom elements joining selection of dom elements (which may exist of not) elements in array. rewrite code

php - Hybridauth authentication failing -

i have moved code repository using hybridauth server different one. configured login provider apps facebook/twitter after moving code, none of login seems working. this login.php in hybridauth looks like: $config = 'library/hybridauth/config.php'; require_once("library/hybridauth/hybrid/auth.php"); these files have relative path root directory as: library/hybridauth/config.php infact, access install.php : {domainname}/library/hybridauth/install.php i var_dump-ed following line: // create instance hybridauth configuration file path parameter $hybridauth = new hybrid_auth( $config ); var_dump($hybridauth); and giving me empty hybridauth object. object(hybrid_auth)#1 (0) { } server logs not helping well.. suggestions ? debug logs: info -- <current_ip_address> -- 2014-08-19t17:52:51+00:00 -- enter hybrid_auth::initialize() info -- <current_ip_address> -- 2014-08-19t17:52:51+00:00 -- hybrid_auth::initialize(). php version:

css - Why is transition on 'margin' and 'padding' laggy in webkit browsers? -

i tried apply css transition on margin , padding property. i wanted make background visually larger on hover. increased padding , decreased margin accordingly on hover, text remain on current position. here's code .content { width: 600px; margin: auto; } a.btn { background-color: #5c9e42; color: #fff; text-decoration: none; font-size: 35px; border-radius: 5px; padding: 10px; text-shadow: 2px 2px 2px #696969; transition: 0.3s ease; } a.btn:hover { background-color: #23570e; padding: 20px; margin: -10px; } <div class="content"> <p>lorem ipsum dolor sit amet, consectetur adipisicing elit, sed eiusmod tempor incididunt ut labore et dolore magna aliqua. ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. excepteur

ios - Change entity and update app -

i have app in app store, added new attribute entity. how can update user's entity without deleting app , lose data? thanks 1) click on xcdatamodel file in xcode 2) choose menu editor in upper bar 3) click on add version model 4) create new model based on previous 1 5) perform updates in new created xcdatamodel file the app automatic handle updates

ios7.1 - How to get the day name in ios -

i want name of day. example if have day 01/08/2014 want find 1st day monday,tuesday.....or saturday likewise. how can in ios. please me have @ nsdateformatter : nsdateformatter *dateformatter = [[nsdateformatter alloc] init]; [dateformatter setdateformat:@"eeee"]; nsstring *dayname = [dateformatter stringfromdate:yourdate]; more info within apples date formatting guide

python - Plotting Pandas Time Data -

Image
my data pandas dataframe called 't': b c date 2001-11-13 30.1 2 3 2007-02-23 12.0 1 7 the result of t.index <class 'pandas.tseries.index.datetimeindex'> [2001-11-13, 2007-02-23] length: 2, freq: none, timezone: none so know index time series. when plot using ax.plot(t) don't times series on x axis! i ever have 2 data points how dates in graph (i.e. 2 dates @ either end of x axis)? use implemented pandas command: in[211]: df2 out[211]: b c 1970-01-01 30.1 2 3 1980-01-01 12.0 1 7 in[212]: df2.plot() out[212]: <matplotlib.axes.axessubplot @ 0x105224e0> in[213]: plt.show() you can access axis using ax = df2.plot()

mac address - How to filter virtual adapters mac addresses in java? -

i trying print mac addresses of machine on web app deployed. have seen many questions related mac addresses on so, couldn't solve issue. have tried far following code: public static void main(string[] args) { getmac(); } public static void getmac() { list<string> list = new arraylist<string>(); try { enumeration<networkinterface> networks = networkinterface.getnetworkinterfaces(); while (networks.hasmoreelements()) { networkinterface network = networks.nextelement(); byte[] mac = network.gethardwareaddress(); if (mac != null) { stringbuilder sb = new stringbuilder(); (int = 0; < mac.length; i++) { sb.append(string.format("%02x%s", mac[i], (i < mac.length - 1) ? "-" : "")); } if (!(sb.length() == 0) && !list.contains(sb.tostring())) { if (!sb.tost

javascript - DELETE query onclick automized -

having slight problem here. i'm trying create admin side function delete faq's, , despite fact got script working, need figure out how automate [where clause] per added question. to describe it, every question gets posted , has id in database. want delete on id, per question add delete faq [where faq_id=#] my current code: $sql = "select question, answer faq"; $queryresult = mysql_query($sql) or die (mysql_error()); while ($faqresult = mysql_fetch_array($queryresult)){ $faqquestion = $faqresult['question']; $faqanswer = $faqresult['answer']; echo "<p class='faqquestionadmin'>$faqquestion</p>" . "<p class='faqansweradmin'>$faqanswer</p>" . "<a class=faqdelete>x</a>"; } if(mysql_num_rows($queryresult) <= 0) { echo("<div><p>no q

Single File Into Multiple Files -

i have csv file 4 columns , 279 rows need split individual files. i using following code there 1 small problem, need when creates new file each column adds new line. @ moment prints off 4 columns in 1 row e.g 23/07/2014 11:00 24/07/2014 09:27 35386515447 1771969 s walsh needs be 23/07/2014 11:00 24/07/2014 09:27 35386515447 1771969 s walsh @echo off setlocal set "destdir=c:\destdir" /f "tokens=1*delims=:" %%a in ('findstr /n "." message.txt') ( >"%destdir%\filename%%a.txt" echo(%%b) goto :eof test - paste notepad , says tab replace tab character. @echo off setlocal set "destdir=c:\destdir" /f "tokens=1,*delims=:" %%a in ('findstr /n "." message.txt') ( /f "tokens=1,2,3,4 delims=tab" %%b in ("%%a") ( >>"%destdir%\filename%%a.txt" echo(%%b >>"%destdir%\filename%%a.txt" echo(%%c >>"%de

Rails ActiveRecord scope with multiple conditions -

i have rails app have unit model , status model. status has_many units , unit belongs_to status. i wrote scope on unit find of units specific status, "in service" so: scope :in_service, lambda { where(status_id: status.find_by_unit_status("in service").id)} this allows me call unit.in_service.count count of units in service. but want write scope allow me scope out units status of in service, @ post, , @ station accurate view of units since these other 2 statuses considering unit available. i'm not sure how write this. scope contains multiple conditions or data fields. can lend hand? update i tried writing class method called available this: def self.available unit.where(status_id: status.find_by_unit_status("in service").id) .where(status_id: status.find_by_unit_status("at post").id) .where(status_id: status.find_by_unit_status("at station").id) end i'm not sure if method i'm looking

c++ - Segfault when using arm-linux-gnueabi-g++ -o, no problems without -o -

i trying cross-compile code run on arm cortex a8 (the ar.drone 2.0, if makes difference). i installed ubuntu 12.04 lts 32-bit on virtualbox (with windows 7 64-bit host), , cross-compiled code works fine. on computer, installed same version of ubuntu (without virtualbox), i'm encountering weird errors. smallest code snippet i've gotten demonstrates problem "hello world" program (i can show code here if necessary): i've executed: sudo apt-get install g++ gcc-arm-linux-gnueabi g++-arm-linux-gnueabi when run arm-linux-gnueabi-g++ hello.cpp , cross-compiled code (a.out) works fine on arm. when run arm-linux-gnueabi-g++ -o hello hello.cpp , segfault when executing hello on arm. i've compared outputs of file hello , read-elf -a hello when compiled virtualbox , without, , identical. i don't have gdb on arm, can't gdb find out segfault coming from. any ideas/solutions appreciated. did not have set special on virtualbox, i'm quite confuse

html - How to hide content that is not wrapped by tag using only CSS? -

i have following html: <a href="..."><span>icon</span>text</a> how can remove "text" using css rules? note: need continue see content. based on paulie_d's answer, came solution using font-size : a { font-size: 0; } span { font-size: 16px; } demo based on comments on answer, think might solution. isn't perfect, do. use answer font-size: 0 . paulie_d commented won't work crossbrowser, browser show in font-size of 4px. browser add paulie_d's solution too: a { font-size: 0; visibility:hidden; } span { font-size: 16px; visibility:visible; } to see difference between two: check here .

javascript - Binding jquery autocomplete with json data.Autocomplete not working -

firstly, loading data on document ready , save inside global variable after trying bind autocomplete text box. problem getting error uncaught typeerror: object not function my implemented as var jsondata; $(document).ready(function () { function split(val) { return val.split(/,\s*/); } function extractlast(term) { return split(term).pop(); } $.ajax({ url: "/webservice1.asmx/getemailswithnames", type: "post", data: "{}", datatype: "json", contenttype: "application/json;charset=utf-8", success:function(data){ jsondata = data; callonsuccess(); }, error: function (result) { alert('some error'); } }); })

groovy - Unable to mock Grails Service method when unit testing Controller - MissingMethodException -

am getting following error message when testing controller - see below code. how can correct this? when invoke service method controller (run-app) , works fine. exception: groovy.lang.missingmethodexception: no signature of method: grails.test.grailsmock.isok() applicable argument types: (java.lang.string) values: [h] @ ...vcontrollerspec.test something(vcontrollerspec.groovy:) class: vcontrollerspec import grails.test.mixin.testfor import spock.lang.specification @testfor(vcontroller) @mock(vservice) class vcontrollerspec extends specification { void "test something"() { given: def vservicemock = mockfor(vservice) vservicemock.demand.isok { string yeah -> return true } controller.vservice = vservicemock.createmock() when: def iso = vservicemock.isok("h") then: iso == true } } class: vservice import grails.transaction.transactional @transactional class