Posts

Showing posts from May, 2010

ios - UITableViewCell subclass: in what delegate method is it appropriate to do changes to the cells layer? -

i have created subclass of uitableviewcell set look/layout of cell. want add rounded corners cell calling setcornerradius on cells layer. know can set tableview:cellforrowatindexpath: when creating cell, this: - (uitableviewcell *)tableview:(uitableview *)tableview cellforrowatindexpath:(nsindexpath *)indexpath { mycell *cell = [tableview dequeuereusablecellwithidentifier:@"mycell"]; ... [cell.layer setcornerradius:7.0f]; [cell.layer setmaskstobounds:yes]; } however, want keep look/layout related code inside subclass itself, question is: in delegate method in uitableviewcell subclass appropriate changes cells layer? if cell loaded nib, add code initwithcoder: method. if create using -initwithstyle:reuseidentifier: add there. basically, add appropriate init method of cell subclass.

d3.js - How do I change circular to rectangular node in D3 force layout -

can please let me know how change circular node rectangular node in d3 force directed graph? please see following code forced directed graph please find html script here. you have append rect svg element instead of circle . so, in script, shows this: var node = svg.selectall(".node") .data(graph.nodes) .enter().append("circle") .attr("class", "node") .attr("r", 5) .style("fill", function(d) { return color(d.group); }) .call(force.drag); you should change maybe this: var node = svg.selectall(".node") .data(graph.nodes) .enter().append("rect") .attr("class", "node") .attr("width", 40) .attr("height", 20) .style("fill", function(d) { return color(d.group); }) .call(force.drag); and, shows: node.attr("cx", function(d) { return d.x; }) .attr("cy&

c# - WPF window's title bar is cramped on Windows 7 -

Image
sorry these dumb questions i'm quite new wpf need guidance! i have ribbonwindow in wpf application, spacing around , within title bar not correct. there space under title , not enough above whole thing looks bit cramped. again, lots of searching on interweb , no satisfactory explanation or advice. i'm not sure if limited windows 7 that's i'm seeing problem. if talking text shown in screen shot, no, there no styling can applied except typeface ( font ) adjustments. can see image, icon not line quite right text, normal. cannot add padding or margin text. set using window.title property.

jquery - Set invalid input to initial value -

i have input on change send value via ajax , saved db. need prevent sending empty value or value not numeric , should or vice versa. calling ajax function after few if/else blocks. works ok, possible set invalid changed input previous value? example have input value "456321". user change "abcde". not numeric isn't send server need change value "456321". keep hidden field filled initial value. suppose have value "4321" shown in text box. load value textbox in hidden field. on change of value when making ajax request, if value correct update hidden field correct value else replace value in textbox value in hidden field. hope helps... sample code: <input type="text" id="textbox" value="1234"/> <input type="hidden" id="hidden" value="1234"/> $('#textbox').change(function(){ if(parseint($('#textbox').val())) { $('#hid

web services - HTTPS requests in Restlet Java framework -

i'm new restlet framework , pretty webservices in general. i'm managing fine send requests 'http' resources try , hit 'https' resources code following error: no available client connector supports required protocols: 'https' . please add jar of matching connector classpath. so solved adding .jar project don't know one. or.. bit more complicated that. appreciated! ps - using restlet 2.1.2 try this: in addition standard restlet jar files, need reference jar files https. 'simple' https connector uses these jar files: lib/com.noelios.restlet.ext.simple_3.1.jar lib/org.simpleframework_3.1/org.simpleframework.jar lib/com.noelios.restlet.ext.ssl.jar lib/org.jsslutils_0.5/org.jsslutils.jar found here: http://restlet.org/learn/guide/2.2/core/security/https

ggplot2 - Add "size"-legend for ggfluctuation plot in R -

i have made "heatmap" similar first 1 here (the grey one): https://stats.stackexchange.com/questions/9050/how-to-display-a-matrix-of-correlations-with-missing-entries this done using ggfluctuation, part of ggplot2 package. x=read.table(file="mydata.csv", sep =",", h=t) row.names(x)<-x[,1] x<-x[,2:3] mat=data.matrix(x) ggfluctuation(as.table(mat)) + theme(legend.position="none") + labs(x="", y="") + theme(axis.text.x = element_text(angle = 90, hjust = 1)) + scale_size_area() + labs(title = "main title") 1) make legend, indicates values corresponds diffent sizes of squares - possible 2 ) making multiple heat maps, scale squares same size corresponds same value in of heat maps. can done.

linux - Collectd server not writing down received client data -

i have pretty strange problem collectd. i'm not new collectd, using long time on centos based boxes, have ubuntu tls 12.04 boxes, , have strange issue. so, using version 5.2 on ubuntu 12.04 tls. 2 boxes residing on rackspace (maybe important, i'm not sure). network plugin configured using 2 local ips, without firewall in between , without security (just try set simple client server scenario). on both servers collectd writes in configured folders should write, on server machine doesn't write data received client. troubleshooted tcpdump, , can see udp traffic , collectd data, including hostname , plugin names client machine, received on server, not flushed appropriate folder (configured collectd) ever. running root user, avoid troubleshooting permissions. anyone has idea or similar experience this? or maybe idea troubleshooting beside trying crawl internet (i think clicked on every sensible link google gave me in last 2 days) , checking network layer (which looks

c# 4.0 - Display a contact using storagekind.phone -

i want display phone contact only,using storagekind.phone. because retrieve contact using filterkind but, need storagekind only. me plz look if want use storagekind have go accounts class of using microsoft.phone.userdata; this... account accounttype = new account(); storagekind strgkind = storagekind.phone; accounttype.kind = strgkind; hope helps you..

css - sass background mixins using url -

this question has answer here: have variable in images path in sass? 3 answers guys create background mixin instead writing repeated url @mixin bgimage($name){ $url:"../images/$name.png"; background: url($url);} and,it never accept valuee $name variable i called @include bgimage(name.png); and in css output came wrong this background: url("../images/$name.png"); is there way write url in mixin ? ot how in short way try variable interpolation of #{$name} @mixin bgimage($name) { $url:"../images/#{$name}.png"; background: url($url); } and pass filename, without extension, mixin parameter: @include bgimage(your-png-file-without-extension); since appended in $url variable of mixin

c# - Start Application only once (Mono) -

i'm developing mono application in c#, start once. know, can achieved mutex. how can bring application front using mono? tried getting process via process.getprocessbyname("audiocuesheeteditor") but couldn't access mainwindowhandle. how can bring running application front? thanks answers. edit: now have been able mainwindowhandle, it's intptr. how bring handle front? tried window wrunning = new window(handle); wrunning.present(); but gave me exception :(. i have been able fix file system watcher: filesystemwatcher fswrunning = new filesystemwatcher(path.gettemppath() + "audiocuesheeteditor"); fswrunning.filter = "*.txt"; fswrunning.changed += delegate(object sender, filesystemeventargs e) { log.debug("filesystemwatcher called changed"); if (paudiocuesheeteditor != null) { log.debug("paudiocuesheeteditor != null");

php - Dropdownlist gets clear when choosing value from this dropdown -

i have created 3 cascading dropdownlist using below html , php code <?php @$city=$_get['city']; @$locality=$_get['locality'];// use line or below line if register_global off if(strlen($city) > 0 , !is_numeric($city)){ // check if $city numeric data or not. echo "data error"; exit; } if(strlen($locality)>0 , is_numeric($locality)){ echo "data issue"; exit; } ///////// getting data mysql table first list box////////// $quer2=mysql_query("select distinct city_name,city_id city order city_name"); ///////////// end of query first list box//////////// /////// second drop down list check if category selected else display subcategory///// if(isset($city) , strlen($city) > 0){ $quer=mysql_query("select distinct locality_name locality city_id='$city' order locality_name"); }else{$quer=mysql_query("select distinct locality_name locality order locality_name"); } ////////// end of query second subcategor

symfony - Doctrine - querybuilder - how to make to results from "join" query were not alternately? -

i have table stats , stat_values. these tables in relatioship many 1 (a stat can have lot of stat_value) i created query via querybuilder: return $this->getentitymanager() ->createquerybuilder() ->select(array('s', 'v')) ->from("cmailingdefaultbundle:stat", "s") ->leftjoin("cmailingdefaultbundle:statvalue", "v") ->where("s.project = :project") ->andwhere("v.iscurrent = 1") ->setparameter("project", $project ) ->getquery() ->getresult(); it works good, don't have result in way (i make simpler, because structure of array big): [0] => stats.field1, stats.field2, ..., stat_values.field1, stat_values, ... [1] => stats.field1, stats.field2, ..., stat_values.field1, stat_values, ... etc... but have: [0] => stats.field1, stats.field2, ... [1] => stat_values.field1, stat_values ... etc... it "litle bit"

apache - why can't use 443 in httpd.conf? -

if use 443 in httpd.conf , want start httpd, error message is: (98)address in use: make_sock: not bind address [::]:443 (98)address in use: make_sock: not bind address 0.0.0.0:443 no listening sockets available, shutting down unable open logs actually don't use 443, check port of 443 by: lsof -i:443 i think port of 443 used in ssl.conf, can't use in httpd.conf. when use 444 or 666 in httpd.conf, can start httpd. this reason?

How do I gracefully handle an Android service being killed by OS? -

i have service required run long periods of time in background. foreground service not suitable due notification. needs run quietly in background doing it's polling. , behaves should. not problem, background. when service killed user , ondestroy() called, data saved db - no problem there. when phone turned off have broadcast receiever listens screenoff/on. again no problem saving there. the problem when os kills service due low memory. service killed , don't believe ondestroy() called. if is, data not stored. if service killed , has been running while, information has gathered lost. so after that, question is: how should gracefully clean resources , save data? there way can run code save data before system kills service? have considered making service save database @ intervals of few minutes reduce amount of data loss. not sure how performance wise. queries inserting 30 rows in period of 5 minutes. less. i relatively new android development , have tried best proble

css - stacking DIVs one below another vertically -

Image
html: <div id="container"> <div id="topdiv" /> <div id="maindiv" /> </div> css: #topdiv { height: 25%; width:100%; border:dashed; } #maindiv { height: 75%; width:100%; border:solid; } unable stack divs (topdiv, maindiv) vertically 1 below other. doing wrong? what doing wrong basic thing, self closing div element tags, renders incorrectly. correct syntax <div id="container"> <div id="topdiv"></div> <div id="maindiv"></div> </div> you cannot self close div tags demo click here validate html documents

sql - Dual use of composite foreign keys -

i'm modelling hierarchy of 3 entities therapy planning software. therapy understood number of medications given patient on number of days. want able cancel therapy on given day, in write-only-once fashion (for quality control certification purposes). here's concrete question: ok reuse part of composite foreign key foreign key? in case composite key points medication table day table, points therapy. therapy id included in composite foreign key in medication table, use foreign key, making querying more easy? the table definitions should (modulo hickups in raw sql skills, employ kind of orm): create table therapy ( "id" integer not null, "start" date not null, primary key (id) ); create table day ( "therapy_id" integer not null, "day" integer not null, "revision" integer not null, "comment" text; "cancelled" boolean not null; primary key (therapy_id, day, revision),

wcf - Xamarin Android - Making a Rest request with a complex parameter (object) throws exception, in .NET it works fine (Using channel factory) -

i'm starting use mono droid or xamarin android, so, idea reuse of code use in .net. one of things need android , ios application make calls web services made available using wcf rest json encoding. so code simple: webhttpbinding webbinding = new webhttpbinding(); endpointaddress endpointaddress = new endpointaddress("http://192.168.126.24:8025/services/securitymanagement"); channelfactory<isecuritymanagement> newfactory = new channelfactory<isecuritymanagement>(webbinding, endpointaddress); newfactory.endpoint.behaviors.add(new webhttpbehavior() { defaultoutgoingrequestformat = system.servicemodel.web.webmessageformat.json, defaultoutgoingresponseformat = system.servicemodel.web.webmessageformat.json }); newfactory.endpoint.behaviors.add(new restendpointbehavior()); isecuritymanagement newproxy = newfactory.createchannel(); validateuserexistenceoutput output = newproxy.validateuserexistence(new validateuserexistenceinput() { domain = "critica

How to temporarily suspend clustering in Android Map Extensions? -

i want pause markers clustering during marker drag in process won't "trapped" nearest cluster. it looks way call clusteringsettings.enabled(false) . problem clusteringsettings instance not exposed googlemap after passed in, i.e.: there's no method symmetric setclustering(clusteringsettings) . what correct way suspend clustering during marker drag? edit this problem sounds related, not same

ruby on rails - result of passing a symbol to method -

i have method declaration 1 argument : def my_method(argum) if argum.empty? puts "argument empty" else puts "argument not empty" end end when call method , pass symbol : my_method(:aleatoir_symbol) show me argument not empty , when pass literal symbol my_method(:"") show argument empty i test irb , result : :a_symbol.empty? => false :"".empty? => true my question why when pass symbol :any_symbol show argument not empty ?? i'm searching , find similar question here there 1 answer given't me clear comprehension of reason. clear answer helpful . thank's ** update ** here original question, , open question because don't have answer symbol#empty defined self.to_s.empty? (with self being symbol). so answer question why :"".empty? true : because :"".to_s (the empty string) empty. to adress comment: :any_symbol.empty? false , because :any

javascript - Append div at cursor in a contenteditable div -

this question has answer here: insert html @ caret in contenteditable div 3 answers i have contenteditable div need append div(child) @ caret position? i added text @ caret position using sample in stack. didn't find way append div @ caret position. how it? var appendtext = "<div class='ui-state-default' contenteditable='false'> <span>"+ui.draggable.text()+"</span> <span class='ebappendfieldclose'>x</span> </div>" $("#ebplaceholder").append(appendtext); right use normal method (like this). not sure you're trying do; placing div on cursor position? var appendtext = "<div class='ui-state-default' contenteditable='false'><span>" + ui.draggable.text() + "</span><span class='ebappendfieldclose'>

silverlight - Disable events on element -

i've faced problem, elements placed in other elements mess event, like: i have code expander: <resourcedictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:local="clr-namespace:expander"> <style targettype="local:expander"> <setter property="template"> <setter.value> <controltemplate targettype="local:expander"> <grid> <visualstatemanager.visualstategroups> <visualstategroup x:name="viewstates"> <visualstategroup.transitions> <visualtransition generatedduration="0:0:0.0"/> </visualstategroup.transitions> <visualstate x:name="expanded">

java - adding value on treeset -

ı read text. text that ayse;serdar-9.8;emre-5.2;aytac-3.3 fatma;oytun-8.8;orkun-7.5;onur-5.4;umut-4.4;berk-3.3;can-3.2 derya;veli-7.7;ali-6.5;suat-6.0;yavuz-5.0;oytun-4.2;orkun-3.1 dilara;dogus-8.8;veli-7.4;ali-6.5;suat-5.5;yavuz-3.1 begum;suat-6.6;yavuz-5.1;oytun-4.3;orkun-4.0 beril;caner-8.7;dogus-7.5;veli-6.2;ali-6.1;suat-5.8;yavuz-4.8;oytun-4.0 funda;orkun-9.7;onur-8.3;umut-7.2;berk-6.5;can-5.5 isil;aytac-8.3;caner-7.4;dogus-6.5;veli-5.5;ali-5.4;suat-4.4;yavuz-4.0;oytun-3.9;orkun-3.5;onur-3.4;umut-3.2;berk-3.1;can-3.0 elif;emre-7.4;aytac-6.1 ı cant add "u.eleman" , "u.uyum" values "treeset tsu". gives memory address when ı syso ı cant see them in tsu treeset. want add of them treeset. how can ı that.. please help import java.io.bufferedreader; import java.io.fileinputstream; import java.io.filenotfoundexception; import java.io.fileoutputstream; import java.io.ioexception; import java.io.inputstreamreader; import java.io.reader; import java.io

java - How to split string into parts defined by brackets -

it seems simple, can't find solution. need values string {value1}{value2}.....{valuen} . i've tried create pattern as: (\\{(.*)\\})* or (\\{(.*?)\\})* . in both cases 1 value: between marginal brackets or last value. need replace (.*) meaning anything except }{ . in advance help. i go for: string str = "{value1}{value2}...{valuen}"; str = str.substring(1,str.length-2); // crop first , last bracket string[] results = str.split("\\}\\{"); // array of results i don't matching stuff regex when can go less confusing. next dev who's gonna work on same code.

php - SEO friendly URL not working using .htaccess -

i'm trying implement seo friendly url using .htaccess using rewriterule below rewriterule ^n/article/([a-za-z0-9]+)/$ article.php?title=$1 the actaul url looks this http://localhost/n/article.php?title=this-is-the-first-news-article but want : http://localohst/n/article/this-is-the-first-news-article when applied rewiterule above not change desired url this should it. missing n. not sure why need word title though. rewriterule ^n/article/title/([a-za-z0-9]+)/$ article.php?title=$1

oop - MVC one or separate models? -

i'm working on web site has 2 different possibilities client support. in both of them required submit small form of needed fields. i implemented 1 of them using pretty basic model containing necessary properties name, email , couple of others more, user enters his/hers data, , if fields valid, redirected screen congratulates him on successful submission of form. the second 1 requires same input client first one, except 1 field not included, , there other fields client must fill in order second type of support. i wondering idea use same model both views although neither won't use of properties, since creating 2 distinct models half same properties seems waste me. use inheritance models: let's say, input 1 requires properties a , b , c . input 2 requires b , c , d . create 2 classes: public abstract class mythingybase { public int b { get; set; } public int c { get; set; } } public class input1 : mythingybase { public int {

performance - Why MySQL is very slow when using JOIN instead of WHERE? -

i have 2 tables: create table `test_sample` ( `idtest_sample` varchar(50) not null, `test_samplecol` varchar(45) default null, unique key `idtest_sample_unique` (`idtest_sample`) ) engine=myisam default charset=utf8 and create table `new_table` ( `idnew_table` int(11) not null, unique key `idnew_table_unique` (`idnew_table`) ) engine=myisam default charset=utf8 the first table contains 5 million records while second 1 10 records. the duration of execution of query more 5 seconds: select * test_sample inner join new_table on test_sample.idtest_sample = new_table.idnew_table while query executed (less 0.001 second): select * test_sample test_sample.idtest_sample in ('3','1597','25963','170596','196485', '545963','999999','1265896','1569485','1999999') why first query takes long? did try see execution path ? desc {sql}, first 1 longer the first query entire 5 mill

javascript - Dynamically add items to Listview in jQuery Mobile -

i'm having bit of trouble dynamically adding items listview in jquery mobile. want whatever input user in textbox added list. have following code , can not figure out why desired output not appearing. <script> var listcreated = false; function appendtolist() { if(!listcreated) { $("#items").append("<ul id='list' data-role='listview' data-inset='true'></ul>"); listcreated = true; $("#items").trigger("create"); } $("#list").append("<li>"); $("#list").append(document.getelementbyid(item).value); $("#list").append("</li>"); $("#list").listview("refresh"); } </script> <div data-role="content"> <div id="items"></div> <input type="text" id="item" /> <input type="button" value="add i

ios - How to make button go back to specified view controller -

i have settings page has configure button 1 of settings. have them linked configure page, made button brings me page. instead brings me first tab. want bring me third. if connect button third tab view doesn't work , view reformatted. when go tabs, selected tabs don't go there selected image, instead default highlight. if viewcontrollers managed uinavigationcontroller can use method [self.navigationcontroller poptoviewcontroller:vc animated:yes] provided have reference viewcontroller you'd go back to. related methods are [self.navigationcontroller poptorootviewcontrolleranimated:yes] [self.navigationcontroller popviewcontrolleranimated:yes] all documented here . edit: adding comment text answer completeness , search purposes. if you're using uitabbarcontroller manage set of, example, 2 viewcontrollers. , 1 of viewcontrollers can push viewcontroller on top of want this: tabbarcontroller contain 2 things: 1 viewcontroller , 1 navigationcontroller

Why audio element currentTime on ffmpeg encoded mp3 file in Chrome browser does not work -

i have html5 audio element: <audio id="mp3_audio_player" preload="auto"> <source src="./sound/recording.mp3" type="audio/mpeg"> </audio> and need able play last 4 seconds mp3 recording. javascript is: audio.currenttime = audio.duration-4; audio.play(); works ok in ie10 , firefox, chrome starts playing wrong place. difference between reported audio.currenttime , actual playback position 20s. recording.mp3 created ffmpeg: ffmpeg -i recording.wav -ab 32k recording.mp3 it works, when strip id3v2 header recording.mp3 (deleting first couple bytes in file before audio data). it works when compress ogg. can point me right direction (ffmpeg switches, audio element attributes or whatever) work in chrome? thanks in advance edit: ffmpeg output: ffmpeg version n-53528-g160ea26 copyright (c) 2000-2013 ffmpeg developers built on may 27 2013 15:20:09 gcc 4.7.3 (gcc) configuration: --enable-gpl --enable-version3 -

SQL Log File Not Shrinking in SQL Server 2012 -

i dealing else's backup maintenance plan , have issue log file, have database sits on 1 drive size of 31 gb , log file sits on server size of 20 gb, database in full recovery model. there maintenance plan runs once day complete backup , second plan backup of log file every 15 minutes. have checked , drive log file gets backed , there still plenty of room log file never gets smaller after backup, there missing maintenance plan? thanks in advance the situation describe seems fine. a transaction log backup not shrink log file. however, truncate log, file, means space can reused: from books online ( transaction log truncation ): log truncation automatically frees space in logical log reuse transaction log. also, managing transaction log : log truncation, automatic under simple recovery model, essential keep log filling. truncation process reduces size of logical log file marking inactive virtual log files not hold part of logical log. this

c# - Generate a list of cookies like HttpContext.Request.Cookies in a non-web application? -

i'm writing wpf application encrypts , decrypts cookies, using old asp.net project code reference. web application includes dropdown list of cookie names avaiable process. dropdown list populated using controller.httpcontext.request.cookies . i want include functionality in program, have no httpcontext work with. there way generate equivalent httpcontext purpose? if not, other options have? tried looking folders containing cookies ie/firefox/chrome there ridiculous number of folders/files.

c# - Method to pass 3 different data types to do the same thing? -

i think title might wrong.. haha unsure.. anyway.. i have 3 different data types.. public class data1 { public color color; public int len; public drawingvisual dv; other vars... } public class data2 { public color color; public int len; public drawingvisual dv; other vars different data1 vars... } etc... how can create function pass these in , vars need inside function.. example.. void something(var data) { switch (typeof(data)) { case data1: break; case data1: break; } } this wont work obviously.. example.. how can this? thanks consider create classes hierarchy, , move method something hierarchy. base class: public abstract class data { public color color; public int len; public drawingvisual dv; public abstract void something(); } and 2 derived classes data1 , data2 : public class data1 : data { // other vars... public override void somethi

php - symfony2 KnpPaginatorBundle automatically generate query string -

is there method in twig make knppaginatorbundle generate query string automatically? want this: ?sort=id&page=2 automatically inserted when call function this: knp_current_parameters() so, there such functionality? or how generate link contain sort , page params, without manually passing them within controller?

Error message using Ralink 802.11 n WLAN in Backtrack 5 R3 -

in window7 ultimate (32 bit) run backtrack 5 r3 in vmware workstation , connect via wi-fi tp-link wireless network adapter. see sentence: the connection usb device "ralink 802.11 n wlan" unsuccesful. device in use. why? how change settings in vmware workstation or backtrack?

python - Plug in django-allauth as endpoint in django-rest-framework -

i'm using django-allauth on website social logins. have rest api powered django-rest-framework serves backend of mobile app. there way can directly plug in allauth's authentication backend rest api can validate (and register) users use facebook login in mobile app? to clarify: facebook login part handled native sdks. need endpoint works post /user (that is, creates new user), takes facebook oauth token input instead of email/password etc. you can use libray social authentication django-rest-framework-social-oauth2 . try django-allauth related code urls.py urlpatterns = [ url( r'^rest/facebook-login/$', csrf_exempt(restfacebooklogin.as_view()), name='rest-facebook-login' ), ] serializers.py class everybodycanauthentication(sessionauthentication): def authenticate(self, request): return none views.py class restfacebooklogin(apiview): """ login or register user based on a

android - Java Array list synchronization if written in one thread and read in another -

i have controller class runs in thread , composes local variable list this thread a list = new arraylist<map<string, order>>(); list.add(...); list.add(...); where order java bean several primitive properties string, int, long, etc. once list constructed, reference passed ui thread (thread b) of activity , accessed there. cross-thread communication done using handler class + post() method. so question is, can access list data thread b without synchronization @ all? please note, after constructed in thread a, list not accessed/modified @ all. exists local variable , passed thread b afterwards. it not clear context provide happen: list = new arraylist<map<string, order>>(); list.add(...); list.add(...); if in constructor and list final and this reference not leak constructor and absolutely sure list won't change (for example using unmodifiablelist decorator method) and references order instances not accessible elsewhere may

jquery - Why Chosen.js does not work in awsAccordion.js? -

i have problem select boxes created using chosen.js inside list accordion created using awsaccordion.js . in website select works fine inside accordion when click on select select option drop down hidden (as shown in this screenshot ) because accordion div overflow:hidden , tried solve issue solutions listed in github , solution neither of these works. , when close accordion awsaccordion crashes. why chosen doesn't work inside awsaccordion? the fiddle: http://jsfiddle.net/8tcjq/1/ thank help! best regards. i guess problem lies in source of awsaccordion. when using horizontal accordion <div/> children of <li/> css applied to. for (i = 0; < $(headlis).parent().find('li').length; i++) { $(headlis).parent().find('li').eq(i).css({ 'width': settings.cssattrshor.liwidth + 'px', 'height': settings.cssattrshor.liheight + 'px' }).find('div').css({ 'left': settings.cssa

Java- for loop using << operator -

i'm stuying code , don't understand line does: [(y << 3) + x] (int y = 0; y <= 7; ++y) { (int x = 0; x <= 7; ++x) { final string piececode = piececodes[(y << 3) + x]; if (piececode.length() != 2) throw new illegalargumentexception(); if (!piececode.equals("--")) { pieces[((7 - y) << 3) + x] = checkerspiece.valueof(piececode.charat(0), piececode.charat(1)); } } } (y << 3) means bit shifting 3 times left. it's same multiplying 2^3 = 8. so, whole expression (y << 3) + x becomes y * 8 + x . it should written in form y * 8 + x , because it's more readable , there no performance gain. premature optimization root of evil . it's better left such micro optimizations compiler (or jvm). moreover, board size stored in constant, have in 1 place: final int size = 8; // ... (int y = 0; y <

ios - Google Maps SDK - Core Data -

i use google maps sdk ios in application use core data. when want show view contain map , application crash exception : * terminating app due uncaught exception 'nsinvalidargumentexception', reason: 'object's persistent store not reachable nsmanagedobjectcontext's coordinator' there maybe conflict between application use core data , sdk use core data. thanks did add observer on nsmanagedobjectcontextdidsavenotification ? if so, check context passed notification same use in app (not google maps 1 !) ?

python - Create (json-) array from browser query string -

from geolocation api browser query, this: browser=opera&sensor=true&wifi=mac:b0-48-7a-99-bd-86|ss:-72|ssid:baldur wlan|age:4033|chan:6&wifi=mac:00-24-fe-a7-ba-94|ss:-83|ssid:wlan23-k!17|age:4033|chan:10&wifi=mac:90-f6-52-3f-60-64|ss:-95|ssid:baldur wlan|age:4033|chan:13&device=mcc:262|mnc:7|rt:3&cell=id:15479311|lac:21905|mcc:262|mnc:7|ss:-107|ta:0&location=lat:52.398529|lng:13.107570 i access single values local structured. approach create json array more in depth, split "&" first , "=" afterwards array of values in query. approach use regex (\w+)=(.*) after splitting "&" ends in same depth need there more details accessible datatype. the resulting array should like: { "browser": ["opera"], ... "location": [{ "lat": 52.398529, "lng": 13.107570 }], ... "wifi": [{

c# - Two many-to-one table relationships and insertion with Entity Framework -

Image
i have model similar this: context: idea it's database of samples. 1 sample has details, , several samples can collated collatedsample, , details can collated in collateddetail. so, 1 collatedsample has many collateddetails, , starts many samples, each of has many details. collateddetail has many details too. it's "nice" square. my approach adding records thus: var sample = new sample(); var detail = new detail(); sample.details.add(detail); // suppose add bit more meat these entities... var collatedsample = new collatedsample(); var collateddetail = new collateddetail(); collatedsample.samples.add(sample); collatedsample.collateddetails.add(collateddetail); collateddetail.details.add(detail); context.collatedsamples.addobject(collatedsample); context.savechanges(); so i've added elements eachother, , added detail both sample , collateddetail. on savechanges, update exception jolly message: unable determine principal end of 'samplingmodel.f

constructor - Properties shared between child and parents class in php -

class parents{ public $a; function __construct(){ echo $this->a; } } class child extends parents{ function __construct(){ $this->a = 1; parent::__construct(); } } $new = new child();//print 1 this code above print 1,which means whenever create instance of child class,and assign value properties inherited parent,the property in parent class has been assigned.but code below shows different: class parents{ public $a; function test(){ $child = new child(); echo $this->a; } } class child extends parents{ function __construct(){ $this->a = 1; } } $new = new parents(); $new->test();//print nothing where assign value child class , parent apprently didn't have value assigned child class,why? thanks! in top example, since construct function being called child class, treating object being used if child object using function in parent class if it's own. in bottom ex

javascript - buffer.js:246 "Object 1 has no method 'toLowerCase' -

i m trying make .smil (.xml) parser in javascript. when want test it, node.js me that: buffer.js:246 switch(encoding && encoding.tolowercase()){ ^ typeerror: object 1 has no method 'tolowercase' @ function.buffer.isencoding (buffer.js:246:32) @ assertencoding (fs.js:98:27) @ object.fsread (fs.js:422:5) @ gets (/home/pi/smil_parser.js:8:8) @ read_until (/home/pi/smil_parser.js:28:14) @ home/pi/smil_parser.js:64:14 @ object.oncomplete (fs.js:93.15) gets () indeed 1 of function: var io=require('fs'); ... function gets (file){ var chaine="", cache="", pkmn=0; io.read(file, cache, 0, 1, null, function(err, byte, buf){ if (err || byte===0){return -1;} while ((cache!=="\n")) { chaine=chaine+cache; cache=""; pkmn=io.readsync(file, cache, 0, 1, null); if (pkmn===0){return -1;}

database - How to install and start phpPGAdmin -

this may silly question, can't figure out how use phppgadmin. i've downloaded , unzipped .zip file website, how install it? i'm using mac. i'm starting lift project on remote server , have phppgadmin installed on mac can connect postgresql db on remote host through phppgadmin's gui. i'm new databases , confusing. thanks. if using xampp: http://practicalfoss.blogspot.com/2008/09/how-to-install-postgresql-and.html if not: http://www.farces.com/wikis/naked-server/phppgadmin/

Eclipse cannot find my android 4.1.2 device -

i'm trying run intro "hello world!" app on phone (droid razr maxx) running android 4.1.2 jelly bean using eclipse. have usb debugging enabled, have tried updating drivers/reinstalling drivers phone (i have google usb driver also), , have tried changing type of device computer reads mass storage media device camera. restarts haven't been working (computer, eclipse, phone, meh). when go device doesn't show up, form blank: pic of android device chooser window . clue may happening? you need install motorola device manager. driver of phone installed, having same issue have motorola devices. can download device manager here: https://motorola-global-portal.custhelp.com/app/answers/detail/a_id/88481

tsql - T-SQL Stored Procedure Get No Result -

is there way suppress results stored procedure result set? that has both exec , select statements. edit: let me explain problem little bit more. the exec statement dtsrun pulls data erp , mysql servers temp tables in sql. once data in temp tables. there select statement brings merged data user. user ms access database sends through actual customer on via email. triggered webpage button on customer side "get report". i want suppress first exec statement result set because don't want customer see dts output. otherwise, suppress have ms access execute stored procedure pull select statement itself. there 10 better ways doing. wanted know how suppress result set of exec statement while still running it. set fmtonly on; go exec sp_who; however, has side effects , weird issues. example, in sql server 2012 @ least, if procedure has #temp table, invalid object name error. erland sommarskog goes lot more detail here (just search page fmtonly ). gi

php - How can I pass on a url variable from 1 page to another? -

i've got referral script running on website i've ran problem , unfortunately don't know enough php solve it. the script grabs variable 'ref' url don't have variable time page script running. so process is homepage.com/?ref=xxxxx >user clicks on script page homepage.com/script.php i need homepage.com/?ref=xxxxx >user clicks on script page >homepage passes variable script page homepage.com/script.php?ref=xxxxx i don't have code running on homepage. code on script page is if(isset($_cookie['ref_link'])){ $ref = $_cookie['ref_link']; }else{ $ref = rand(1,9).date('y').date('m').date('d').date('h').date('i').date('s'); $ref = rand_uniqid($ref); setcookie("ref_link",$ref, 9999999999); $insert = "insert cookie_ref(ref_val) values('".$ref."');"; @mysql_query($insert); } $error = ''; //used checking if ip

c# - WCF Service - Don't wait for external web service call -

apologies upfront if elementary question. how initiate external web service call in existing wcf web service , not wait third party service return response before continuing , exiting function allow web service return value immediately? you need make call external service asynchronous. there different options depending on version of framework you're on. if you're on 4.5 take @ async: http://msdn.microsoft.com/en-us/library/vstudio/hh156513.aspx we're doing similar - invoking restful service asynchronously wcf using restsharp. take @ example here: fire , forget within wcf service when "return value immediately" saying want call wcf service non-blocking? return client right away? if need make wcf service contract oneway. see: http://msdn.microsoft.com/en-us/library/ms733035.aspx however, can't return values oneway services.

sql - How to tell if a property of an EntityObject is a primary key or foreign key? -

suppose have class generated entity framework called student . student has following properties: id int, name, string age, int teacherid int suppose further id refers primary key in sql identifies student student object refers , teacherid foreign key tells student's teacher is. suppose want write function takes any entityobject (such one) parameter , returns information properties primary keys , foreign keys. how can this? if not appropriate, how can entity framework tell me properties primary , foreign keys? for now, let's not take consideration composite key fields. looking on code autogenerated, can see primitive properties in generated class have several attributes, , among these edmscalarpropertyattribute has boolean entitykeyproperty seems indicate whether or not property key. how read values of attributes described in article here: http://msdn.microsoft.com/en-us/library/71s1zwct.aspx i'll bet can find consistent pattern how for

javascript - Checking the names of elements from an array of objects selected by jquery -

i'm beginner in js , jquery library. i'd array of input fields particular name, , validate input. each of input fields have name ns[0], ns[1] etc. total number of fields have determined code, since fields generated javascript. i know can have jquery address individual object this: $("input[name=ns\\[0\\]]").val() <input type="text" name="ns[0]"> . however, how can array of these similiar elements, ns[0] ns[x] x has determined based on how many fields have been generated? have other fields different name patterns sharing same css class, using class not option. these boxes in particular div area, in same area other input fields, choosing input boxes of same area selects them well. in other words, how use jquery check name of each input field, after getting entire array of input fields, check each individual name? since have input fields of various names in area determined table id cntr1, select them $('#cntr1 input') . ca

php - Assigning a node to an arbitrary node, how to with Libxml2? -

this question use php, problems , algorithms valid many other libxml2 , w3c dom implementations. core problem: there no $node->replacethisby($othernode) . there "replace text" (using nodevalue property) , replacechild() method — not obviuos neither simple use. in code below, second loop works, need copy nodes 1 dom tree (simulated clone) one. $doc = new domdocument('1.0', 'utf-8'); $doc->load($filexml); $xp = new domxpath($doc); $lst = $xp->query("//td"); $z = clone $lst->item(2); // big , complex node // needs clone freeze node content (before change also). // not work: foreach ($lst $node) $node = $z; // no error messages! //error: $node->parentnode->replacechild($z,$node); // works though: foreach ($lst $node) $node->nodevalue = $z->nodevalue; similar questions: php dom replace element new element php domdocument question: how replace text of node? nodevalue prop

soap - Using WL.Server.signSoapMessage API -

i need sign different part of soap envelope. can done calling wl.server.signsoapmessage api multiple times different values second parameter, namely tag id. i notice when call api second time different tag id. adds new wsse:security stanza instead of inserting signature created wsse:security stanza result of first call api. any pointers? no, wl.server.signsoapmessage api supports signing of single xml element within envelope. , discovered, calling multiple times add additional wsse:security header each time call it. one approach if need sign multiple elements write java code signing of multiple elements (leveraging wssecurity api library of choice). and call out java code within adapter: http://pic.dhe.ibm.com/infocenter/wrklight/v6r0m0/topic/com.ibm.worklight.help.doc/devref/t_calling_java_code_from_a_javas.html

node.js - Updating array within mongodb record with mongoose -

what best way update value within array saved in mongodb record? currently, i'm trying way: record.find({ 'owner': owner}, {}, {sort: { date: -1 }}, function(err, record){ if(!err){ (var = 0; < record[0].array.length; i++){ record[0].array[i].score = 0; record[0].array[i].changed = true; record[0].save(); } } }); and schema looks this: var recordschema = mongoose.schema({ owner: {type: string}, date: {type: date, default: date.now}, array: mongoose.schema.types.mixed }); right now, can see array updates, no error in saving, when query database again, array hasn't been updated. it if explained intent here naming property "array" conveys nothing purpose. guess code hope go , set score of each item there zero. note save being ignored because can save top-level mongoose documents, not nested documents. certain find-and-modify operations on arrays can done single da

bower automatically update bower.json -

i run following commands using bower 1.0.0: mkdir testdir;cd testdir bower init #accept defaults bower install jquery -s #the -s supposed cause update of bower.json less bower.json in bower.json expect see dependencies listed, there none. going on? note: bower install jquery --save work note: option referring documented through bower install **-s**, --save save installed packages project's bower.json dependencies from bower help, save option has capital s -s, --save save installed packages project's bower.json dependencies