Posts

Showing posts from February, 2015

ios - How to know the object name based on memory address in objective c -

hi 1 of app crashing repeatedly , giving below error. *** -[cfstring release]: message sent deallocated instance 0x1b7a3b70 is there way object name using memory address. used instruments (zombie) , enabled zombies in xcode no luck. can please me in issue stuck please me. it's string. cfstring bridged nsstring. knowledge, use debugger , breakpoints. break points can step through code, , use quicklook see details objects.

java - Android Tabhost show fragment overlay -

i having problem using tabhost, when starting app, shows main fragmentactivity, shows me fragment should visible when tab selected main.java extending fragmentactivity mtabhost = (fragmenttabhost)findviewbyid(android.r.id.tabhost); mtabhost.setup(this, getsupportfragmentmanager(), r.id.realtabcontent); mtabhost.addtab(mtabhost.newtabspec("tab1").setindicator("tab1"),myfragment.class, null); myfragment.java public class myfragment extends fragment { public view oncreateview(layoutinflater inflater, viewgroup container, bundle savedinstancestate){ return inflater.inflate(r.layout.fragmentlayout, container, false); } } main.xml <android.support.v4.app.fragmenttabhost xmlns:android="http://schemas.android.com/apk/res/android" android:id="@android:id/tabhost" android:layout_width="match_parent" android:background="@color/black" android:layout_height="m

r - Extracting unique partial elements from vector -

i need list of unique subject ids (the part before _ , after /) contents of folder below. [1] "." "./4101_0" "./4101_0/4101 baseline" [4] "./4101_1" "./4101_2" "./4101_2_2" [7] "./4101_3" "./4101_4" "./4101_5" [10] "./4101_6" right i'm doing (using packages stringr , foreach). # create list of contents folder.list <- list.dirs() # split entries "/" subids <- str_split(folder.list, "/") # each entry in list, retrieve second element subids <- unlist(foreach(i=1:length(subids)) %do% subids[[i]][2]) # split entries "_" subids <- str_split(subids, "_") # take second element after splitting, unlist it, find unique entries, remove na , coerce numeric subids <- as.numeric(na.omit(unique(unlist(foreach(i=1:len

z3 - How to get all the variables that were added to any constraint in a Solver? -

i using z3py , trying set of variables in constraint in solver. can call solver.assertions() astvector , loop on vector , objects of type boolref , example, i'm stuck. how can recursively iterate on assertion, boolref instance example, individual variables? thanks taylor answer. think second link addresses question. in more detail, python script leo added in previous answer walks ast, astmap ensures shared sub-expressions walked once.

ember.js - adding action to select (combobox) in emberJs -

i trying add events 2 values in combobox using emberjs. have tried. <select class="bs-select form-control input-small"> <option {{action 'alldata' }}>all data </option> <option {{action 'mydata' }}>my data </option> </select> i have added 2 functions in controller name alldata & mydata these functions never gets called. should ? you can try using binding instead. {{view ember.select}} see: http://emberjs.com/api/classes/ember.select.html you can add binding value , add observer in controller when señection changes.

Highlight Normal only for filetype in vim -

so, i'm pretty happy i've discovered how set highlighting when open particular file in vim. i'm doing javascript files, of them 'hi jsstringd' , 'hi jsfunction' etc. use trigger it: if has("autocmd") augroup javascript au! au bufreadpost *.js call setupjavascript() augroup end ... i want change color of 'normal' or foreground text, javascript files. this works set color: execute 'hi normal ctermfg=' normaltext but how limit filetype? results in files having 'normal' highlighted color. edit: clarify, open javascript file , works. open file (say .jade file) , 'normal' color remains 'normaltext' value. use autocmd fires javascript file type autocmd filetype javascript execute 'hi normal ctermfg=' normaltext however think have problems if switch between multiple files in 1 session since highlighting global. to work around add filetype autocmd fires on bufenter (o

c# - Model Validation from Unit Testing only works for string -

i have got class this model: public class circle { [required(errormessage = "diameter required")] public int diameter { get; set; } [required(errormessage = "name required")] public string color { get; set; } } testing: [testmethod] public void testcircle() { circle circle = new circle(); circle.diameter = 5; circle.color = "black"; validationcontext contex = new validationcontext(circle, null, null); validator.validateobject(circle , contex); } i expecting it'd fail whenever diameter or color null. however, above testing failed when string parameter, color, null. why? how should in order validate diameter well? you shouldn't use required attribute numeric properties. use range attribute instead: the requiredattribute attribute specifies when field on form validated, field must contain value. validation exception raised if property null, contains empty string (""), or

deployit - Always deploy artifact of file.File type -

deployit has file.file tag ( http://docs.xebialabs.com/releases/3.9/deployit/filepluginmanual.html ) has checksum attribute. in our deploy manifest file have provided checksum value. when deploying file, deployit deployed first time. on next deployment skipped deploying file, believe doing because checksum not updated. <file.file name="create file" file="xyz.jar"> <tags> <value>domainserver</value> </tags> <scanplaceholders>false</scanplaceholders> <checksum>45466d0181c11f06f266802bde5416c4df2532</checksum> <targetpath>/dataupload/</targetpath> <createtargetpath>true</createtargetpath> <targetfilename>abc.jar</targetfilename> </file.file> we deploy file when changes , hence need update checksum in deployit manifest file not desirable. what our best option? write program calculate checksum , update manifest file? if so, there ant script can t

r - Repeated measures in MCMCglmm -

i'm analyzing data given, set follows: 2 sites 30 trees in each site (tree nested in site) 12 branches per tree (a branch each direction - n,s,e,w in each of crown level - up, mid, low) (repeated measure) dependent variable shoot damage insect (proportion of shoots damaged per branch) the goal determine if insect damage varies within tree (from data see no effect of cardinal direction , clear effect of crown level) i want model these data using mcmcglmm, i've nested tree in site coding follows (where df data frame): df$tr<-df$site:df$tree my mcmcglmm model follows: prior1 = list(r = list(v = 1, nu = 0.002), g = list(g1 = list(v = 1, nu = 0.002))) fit1<-mcmcglmm(cbind(damage,no.dam) ~ crown+dir+site, random = ~tr, family="multinomial2", prior = prior1, data=df,verbose=f) i'm confused on how specify repeated measures in model. think need use rcov~units or rcov~idh(tr):units however, i'm not sure correct (or off tr

c# - Object reference not set to an instance of an object model fk and virtual field -

this used work. upgraded entity framework 6.1.1 today , have error. i'm getting object using linq this: models.university myuni = dal.university.getbyid(convert.toint16(university.selectedvalue)); lbluniname.text = myuni.name; lblunilang.text = myuni.language.name; when trying view myuni.language null this model: public int? language_id { get; set; } [foreignkey("language_id")] public virtual language language { get; set; } what doing wrong? make sure lazy-loading in not turned-off in configuration: this.configuration.lazyloadingenabled = true; see msdn

vba - Copy and change format -

i want copy text and, using vba, change format (remove space between paragraphs , change alignment), , paste text have copied. code i'm using: sub paste1() application.screenupdating = false selection.pastespecial datatype:=wdpastetext selection.paragraphformat.alignment = wdalignparagraphjustify selection.find .text = "^p" .replacement.text = " " .forward = true .wrap = wdfindcontinue .execute replace:=wdreplaceall end application.screenupdating = true end sub the code works fine, affects entire document , not text have copied. how can fix it? thanks

linux - Exit codes to configure/make/make install -

in company have manually configure , install apaches. i'm working in script automatically install it. problem couldn't find exit code configure/make/make install found workaround check output, barely working. there way check if commands finish successfully? tried using exit(0), commands finish. need know if finish errors. thanks help you can see if previous command failed checking $?. if you're scripting configure/make/make install, you'll following (i'll use configure example): ./configure --install-prefix=/usr/local/ rc=$? if [ $rc != 0 ]; # output messages or take actions because last # command failed, exit same code. exit $rc fi

jquery - changing classes and adding click event -

i changing current class on first click event , class replaced have own click event. here current attempt: $(".originalbutton").on("click", function(){ // works, changes class. $(this).closest(".questions").find(".originalbutton").removeclass("originalbutton").addclass("correctbutton").off("click"); }); now right under event handler added this: $(".correctbutton").on("click", function(){ debugger; }); ideally have else instead of debugger, @ point event isn't firing when correctbutton class button clicked, though when inspect element class updated (from first click event). you need use event delegation adding/removing classes dynamically . use: $(".questions").on("click",'.correctbutton', function(){ debugger; });

php - How to use PHP_EOL without \n and br -

i tried use php_eol without \n , <br/> .but getting output same line.it's not going new line.my php version 5.5 . i'm not echo inside function used return .i tried both of these.but same problem.this example tried. trait footest { public function sayfoo() { return "i 'a'm saying foo trait".php_eol; } } trait bartest { public function saybar() { return "i 'm saying bar trait".php_eol ; } } class traittest { use footest,bartest; private $property = " hello there "; public function getval() { return $this->property ; } } $trait = new traittest; print $trait->getval(); print $trait->sayfoo(); print $trait->saybar(); your code works fine, right click browser , select 'view source' , see raw output, complete line breaks if want see line breaks in browser, need use html (eg <p> or <br> tags)

ruby - angularjs rails routing doesnt work -

i'm having problems when try load angular views in rails app. if in page `{{1+3}} gives me correct result 4. believe routes following stack angular 1.2.20 angular-ui-router (latest) rails 4.1.1 following files #app/assets/javascript/app.js angular .module('app', ['ui.router']) .config(function($stateprovider, $urlrouterprovider, $locationprovider){ $urlrouterprovider.otherwise("/home"); $stateprovider .state('home',{ url: 'home', template: "<h1>test</h1>" }); $locationprovider.html5mode(true); }); #app/views/layout/application.html.erb # please note have added 'app' in body tag <div ng-view> <%= yield %> </div> #config/routes #please note have controller called home root 'home#index' '*path' => 'home#index' what i'm expecting when go http://localhost:3000

C++ Class Internal Memory Management -

i building generic classes object , array can used store data , output data various formats (json, xml, etc.). want able this: object * o1 = new object(); object * o2 = new object(); object * o3 = new object(); o3.addnvp("obj1",o1); o3.addnvp("obj2",o2); o3.printjson(); output: {"obj1":{},"obj2":{}} however, since deconstructor in object calls delete on internal object pointers, i'm afraid users of class might attempt this: object o1; object * o2 = new object(); o2->addnvp("obj1", &o1); ... delete o2; //runtime error because o2 internally attempt delete &o1! what best way mitigate potential runtime error? documentation? deep copying instead of taking incoming references as-is? remove feature altogether , make allocate new objects object * o2 = o1.createsubobject("obj2") ? i'm not sure need worry in terms of memory management.

How to put 2 drop down menu and a search bar nect to each other using the CSS bootstrap -

Image
i using css bootstrap 3.2 in application. i trying place 2 drop down menu "with arrow only- not button style" next each other , right want add search bar. i want use the dropdown menu bootstrap has without button style "arrow only" , small search bar right in vertical center. i have tried dropdown menus , search bar not line up. here screenshot of have done and here code <ul class="nav nav-pills"> <li class="dropdown"> <a class="dropdown-toggle menu-sm-padding" data-toggle="dropdown" href="#"> name <span class="caret"></span> </a> <ul class="dropdown-menu" role="menu"> <li><a href="/user_profile.php">my profile</a></li> <li role="presentation" class="divider"></li> <li><a href="/i

php - Backwards compatible URLs in Laravel -

i've migrated old site onto laravel , support of old urls in new system. used have urls like: old.site.com/page.php but approach doesn't seem work. thoughts? route::get('/page.php', 'homecontroller@index'); the problem web server catching request , trying send .php file, have deal your. have deal rewriters and/or remap. you'll, probably, have rewritings this: rewriteengine on rewriterule ^/foo\.php$ /foo [pt] here's documento this, if using apache 2 web server: http://httpd.apache.org/docs/current/rewrite/remapping.html .

licensing - Offering a PHP application as a hosted solution -

is possible offer php based website application , offer customers hosted solutution, whilst allowing user access own domain name? i think shopify similar can buy package host , show on own domain name. does such setup require php app vendor become hosting provider end user, , have them update domain nameservers, or there way achieve it? thanks if want files hosted on server , have access them - yes, users must change dns records point server(s). the other way allow them download source files , install them on servers. if don't want system abused, can give files clients encoded. wordpress, example, offers both options.

Why do we have two versions of Java? -

why have 2 versions of java ? the jdk oracle , 1 openjdk. and why openjdk available linux ? and on wikipedia,i find java open source .but ,i find copyright information inside oracles jdk saying restricted ??? open jdk trying reinvent wheel giving freedom of choice (you can use cool openjdk jvm or mainstream oracle one) if cool it's linux that question out of scope, besides i'm not sure myself...

Kendo mobile chart not scrollable? -

jsfiddle example here i testinhg on samsung galaxy s4 , mobile emulator chrome. <div class="demo-section"> <div id="drawer"> <a href="#" data-target="dashboard" class="drawer-link active"> dashboard </a> <a href="#" data-target="biomarkers" class="drawer-link">biomarkers</a> <a href="#" data-target="lifestyle" class="drawer-link">lifestyle</a> <a href="#" data-target="settings" class="drawer-link">settings</a> </div> <div id="content-container" > <a id="drawer-trigger" href="#"></a> <div id="dashboard" class="inner-content" style="height: 100%;width:100%;padding:5px;"> <h3>dashboard</h3>

Handling error response in Retrofit android -

i using retrofit networking library. running smoothly. have new requirement, server send me response in json, in case of failure . want grab whole response, right retrofiterror in failure callback, doesn't give server response in of retrofiterror attributes. any kind of appreciated. thanks. i guess trying fields json response returned api during failure. think process failure pretty similar process success. first, response object needs have field map json error field, or field want extract response (success or failure). in success case converted response directly, in case of failure, need call getresponse() on returned retofiterror object converted response, , extract returned data. here example. i have rails backend responds token when successful or list of errors if not successful. here rails controller method if helps, bottom line there json entry errors want examine if create fails. def create @user = user.new(user_params) if @user.save

javascript - resposive layout of wordpress template -

absolutely pulling hair out on 1 don't know jquery. there seems no black , white solution offered anywhere. basically, trying create fluid , responsive portfolio. width of column set 390px want smaller (320px) mobile devises screens < 480px. me 1 please here code (function($) { // $() work alias jquery() inside of function var ww = document.body.clientwidth; $(window).load(function(){ // masonry.js var $container = $('#posts'); $container.imagesloaded(function(){ $container.masonry({ itemselector: '.box', columnwidth: 390, isfitwidth: true }); }); }); use css media queries @media (max-width: 481px) { .box{ width:100%; max-width:320px; } } update: if want use javascript have @ window.matchmedia var mq = window.matchmedia( "(max-width: 481px)" ); if (mq.matches) { var mybox = document.queryselector(".box"); mybox.style.width = &quo

Variable as part of other variable php -

this question has answer here: php dynamic variable name 2 answers i have script: <?php for($i=1; $i<10; $i++):?> <?php if($this->item->nuotrauka{$i}):?> <div class="vobsmall"> <img src="<?php echo $this->item->nuotrauka{$i}; ?>"/> <?php echo $this->item->nuotrauka{$i}; ?> </div> <?php endif; ?> <?php endfor; ?> there's 9 variables $this->item->nuotrauka1 , $this->item->nuotrauka2 etc. as can see here i'm trying call these variables using {i} number of object variable. hovewer code above returns single char variable , not full variable want. how should write {i} here want ? try this: echo $this->item->{"nuotrauka".$i};

google apps script - How to set values for all columns except one? -

Image
my code works great, take events spreadsheet , creates them on google calendar. however, 1 of columns in spreadsheet contains formula. everytime run code, formula disappears , replaced whatever on cell @ time. i know issue is: // record event ids spreadsheet except row 7 range.setvalues(data); how can write loop apply row[0] row[8] skipping row [7]? but here full code reference: function onopen() { var sheet = spreadsheetapp.getactivespreadsheet(); var entries = [{ name : "export events", functionname : "exportevents" }]; sheet.addmenu("update calendar", entries); } //export events spreadsheet calendar// function exportevents() { var sheet = spreadsheetapp.getactivesheet(); var headerrows = 1; // number of rows of header info (to skip) var range = sheet.getdatarange(); var data = range.getvalues(); var calid = "calendar_id"; var cal = calendarapp.getcalendarbyid(calid); (i in data) { if (i

jquery mobile - taphold event fired twice on touch devices -

i'm attempting use jquery's sortable widget on mobile device (jquery-mobile/jquery-touch-punch). taphold event fires twice setup (but once on non-touch devices). <ul id="sortable"> <li>item 1</li> <li>item 2</li> <li>item 3</li> </ul> $(function () { $("#sortable").sortable({ axis: "y", revert: 100 }); $("#sortable").on("taphold", function () { alert("taphold fired"); // fires twice on touch devices }); }); fiddle: http://jsfiddle.net/obft7wrg/2/ any appreciated.

handlebars.js - How to get gulp-handlebars to recognize partials -

i having trouble getting handlebars locate partials. have nested folder structure looks following: some/local/path/handlebars/shared/_shared.hbs some/local/path/handlebars/nested/template1.hbs some/local/path/handlebars/nested/template2.hbs i thought default handlebars supposed mark files start underscore partial, i'm not seeing calls "registerpartials" in output. below last modification i've made gulp task. can't seem figure out how debug - maybe i've been staring @ long. gulp.task('template', function() { return gulp.src(paths.templates) .pipe(handlebars()) .pipe(wrap('handlebars.template(<%= contents %>)')) .pipe(declare({ namespace: 'myapp.templates', noredeclare: true, processname: function(filepath) { return somefunction(filepath); } })) .pipe(concat('templates.js')) .pipe(gulp.dest('outpu

java - get IFolder from IPath for project root -

i have project mytestproject. want ifolder object root. ipath /mytestproject. ipath object need ifolder object. i have folder under project resource. ipath /mytestproject/resource. ifolder using below code ipath path; //and has value /mytestproject/resource final ifolder folder = resourcesplugin.getworkspace().getroot().getfolder(path); please suggest way /mytestproject. projects not have ifolder objects, instead use iproject . both ifolder , iproject extend icontainer interface methods available in both. get iproject project with iproject project = resourcesplugin.getworkspace().getroot().getproject("project name"); so if want code work both ifolder , iproject use icontainer interface.

EXCEL VBA - Data Entry with Multi-Selection UserForm List Box -

i'm trying create user form allows pick options , enter data excel sheet. in user form, have list box several answers. have that user can select multiple answers in list box. if user selects 2 answers, want excel sheet register 2 rows of data. if user selects 3 answers, want excel sheet register 3 rows of data. basically doing described here: http://www.excel-easy.com/vba/userform.html except in "city preference" listbox, can select multiple choices. want excel sheet create line item each city preference chosen, while holding other selections same. i'm thinking code this: for = 1 "total # of items selected in listbox" emptyrow = worksheetfunction.counta(range("a:a")) + 1 worksheet.cell(emptyrow,3).value = "selected item(i) list box" next thanks! use function return array of selected items: public function getselecteditems(lbox msforms.listbox) variant 'returns array of selected items in listbox dim

Why MyClass.class.superclass in Ruby is Module -

i had class named myclass in ruby. when check in irb >class myclass >end > myclass.class.superclass i get => module i need know technical description of output first, lets @ code: myclass.class #=> class funky. class, instance of class named class . meaning these 2 lines pretty similar: class myclass; end myclass = class.new and these similar, too. class myclass; end; myinstance = myclass.new myinstance = class.new.new # know looks funky, works so to: myclass.class.superclass #=> module so class named class inherits module . makes sense since class behaves module except can instantiate it, , cannot included. checkout docs class , module more info , how 2 classes work. realizing ruby "turtles way down" important. , class object being instance of class class 1 of best examples of that, if can head around :)

node.js - findAndModify Error in mongodb - nodejs - error code 17287 -

i getting following error : mongoerror: exception: nextsafe(): { $err: "can't canonicalize query: b advalue bad sort specification", code: 17287 } functions.getnextindex = function(callback){ db.collection('counters').findandmodify( {_id:'productid'}, {$inc: {sequence_value:1}}, function(err,data){ if(!err) callback(data); else callback(err); }); } it seems missing "sort" argument in query. try like: db.collection('counters').findandmodify( {_id:'productid'}, {_id:'descending'}, {$inc: {sequence_value:1}}, function(err,data){ if(!err) callback(data); else callback(err); }); see more here: http://docs.mongodb.org/manual/reference/method/db.collection.findandmodify/

c++ - Multiple tracking in a Video -

Image
i m working on small image processing assignment need track 4 red color object. got how track single one. want know best approach track more 1 point. there 4 points positioned form rectangle can use shape detection or corner detection detect , track points please see image below.. my naive implementation uses technique described @ opencv bounding boxes tracking of red blobs. the following helper function used retrieve center of red objects detected: /* get_positions: function retrieve center of detected blobs. * largely based on opencv's "creating bounding boxes , circles contours" tutorial. */ std::vector<cv::point2f> get_positions(cv::mat& image) { if (image.channels() > 1) { std::cout << "get_positions: !!! input image must have single channel" << std::endl; return std::vector<cv::point2f>(); } std::vector<std::vector<cv::point> > contours; cv::findcontours

Read HTTP request from a SOCKET in perl -

i have problem reading socket in perl . the story goes : 1.1.1.1 server 2.2.2.2 other server opened ssh tunnel on 1.1.1.1 3.3.3.3 ip mozilla firefox i have ssh tunnel opened on port 12345 , tcp.pl "server" oppenning on port 2000 , forwarding raw traffic port 12345 gets again. i have oppened mozilla firefox , put @ socks5 1.1.1.1:2000 (the tcp.pl server), , when surf web, surf 2.2.2.2 's ip, witch good. i wrote someware in code print sockets tcp.pl getting command : `print $buffer;` the problem can read http headers , see stuff get / http/1.1 host: site.com user-agent: mozilla/5.0 (windows nt 6.1; wow64; rv:29.0) gecko/20100101 firefox/29.0 accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8 accept-language: en-us,en;q=0.5 accept-encoding: gzip, deflate cookie: _ga=ga1.2.1235518067.1410367631 connection: keep-alive witch ok, don't quite http content , mean don't html code . part of html code this :g�� ��� <

javascript - IE11 F12 debugger not attaching -

i've added debugger statement javascript that's executed on page load on page b. i've opened page a, opened f12 debugger tools. have "break on exceptions" enabled in f12 debugger tools. i've clicked on link opens page b. i'm shown dialog asking me if want debug visual studio 2010 or visual studio 2012. why didn't open javascript in f12 debugger tools? to make weirder, if close f12 developer tools , click link page b don't dialog asking me if want debug vs 2010 or vs 2012. -eric the dialog you're seeing "just in time" debugger dialog. shown on 2 conditions: the page in debug mode - in scenario happening because page in debug mode , page b has inherited setting (it in same process , setting per process). if f12 isn't open page won't in debug mode (unless configured elsewhere) , debugger keyword ignored. the page encounters reason break (e.g. debugger keyword or unhandled exception) - in case it's

destroy - How to stop admob adview? -

my problem how code adview admob comlete stop when exit on application. have try start getin error. adview cannot resolved ? my code: @override public void ondestroy() { if (mp != null) { mp.release(); mp = null; } super.ondestroy(); adview.destroy(); } }

linux - call a shell script(command line tool) inside another shell script -

i using tool called droidbox experiment. tool has shell script droidbox.sh can invoke through terminal. droidbox.sh takes 1 argument i.e path of apk usage: ./droidbox.sh apk i want call droidbox.sh through shell script. i wrote shell script like #!/bin/bash arg1="/home/xxx/a.apk" /home/xxx/droidbox_4.1.1/droidbox.sh "$arg1" i getting error says python: can't open file 'scripts/droidbox.py': [errno 2] no such file or directory can point out doing wrong? this error because you're running script in different folder folder houses "scripts/droidbox.py" file. can fix in following way(s): move "scripts/" folder directory you're running script out of using "mv /path/to/scripts/ ." move customer script folder contains scripts/droidbox.py , run script there

c# - How to create/edit models via view in asp.net mvc 5 -

Image
i got 1 question related model can see in picture below. as can see got 3 entities , 1:n , m:n relations between them. i want can edit these models through web interface. therefore scaffold (add controller entity framework) these 3 models , got edit/delete/create/ views , of course 1 controller each entity. but there no input/fields created relations automatically vs. thought implement them manually. before want there simpler way implement/scaffold model, can edit relations(checkboxes or (multi)select best)? in advance! for one-many can use dropdownlist tip in partner view (see scott allen's solution . many-many can handled viewmodels , javascript frameworks knockout.

asp.net - Style a XAML button control with C# -

i have xaml button control looks so: <button x:name="my-button" grid.row="3" content="see more foo" click="my-button_click" style="{staticresource bluebuttonstyle}" width="75" height="23" horizontalalignment="right" margin="10,20,90,0" /> i'd change style of button in c# method along lines of: public void changebuttoncolor() { //change style attribute of my-button redbuttonstyle } how go accessing xaml control in c# code behind? this in silverlight 4.0 application. not complete solution, found workaround helped me, thought share. objective of changing style of button disable it. so, instead of changing style, set isenabled attribute of xaml control "false". using c#, able change isenabled attribute definition accessing control directly via: public void enablebutton() { my-button.isenabled = true; } though looks styles have been affected

cocoa - Dismiss NSSavePanel under sandbox environment -

in sandbox environment, nssavepanel controlled powerbox process. i'm wondering if there's way dismiss nssavepanel without having user explicitly click 'cancel' or presses esc? example, if want add 'dismiss' button in accessory view of nssavepanel , there way that? actually apple prohibits invoking ok: method under sandbox, cancel: still works. verified testing app.

find -mindepth -prune conflict? -

i have dir structure like: gameplay/ch1_of_182/ajax.googleapis.com/... gameplay/ch1_of_182/platform.twitter.com/... gameplay/ch1_of_182/privacy-policy.truste.com/... gameplay/ch1_of_182/www.facebook.com/... gameplay/ch1_of_182/www.gameplay.com/... gameplay/ch1_of_182/www-mega.gameplay.com/... gameplay/ch2_of_182/ajax.googleapis.com/... gameplay/ch2_of_182/platform.twitter.com/... gameplay/ch2_of_182/privacy-policy.truste.com/... gameplay/ch2_of_182/www.facebook.com/... gameplay/ch2_of_182/www.gameplay.com/... gameplay/ch2_of_182/www-mega.gameplay.com/... ... gameplay/ch182_of_182/ajax.googleapis.com/... gameplay/ch182_of_182/platform.twitter.com/... gameplay/ch182_of_182/privacy-policy.truste.com/... gameplay/ch182_of_182/www.facebook.com/... gameplay/ch182_of_182/www.gameplay.com/... gameplay/ch182_of_182/www-mega.gameplay.com/... created using wget. want delete of directories , files contain except 2 directories "gameplay.com" in name. i have been trying different

java to android error in eclipse -

i have function in java , want use in eclipse in android project: public string submitform() { defaulthttpclient httpclient = new defaulthttpclient(); httpclient.setredirectstrategy(new laxredirectstrategy()); cookiestore cookiestore = new basiccookiestore(); httpcontext localcontext = new basichttpcontext(); localcontext.setattribute(clientcontext.cookie_store, cookiestore); httpclient.getparams().setparameter(clientpnames.allow_circular_redirects, true); try { (basketitem item: getmodel().getitems()) { ioutil.getconentasstring("bziran_path" + "/add2card.php?vendors=" + "item.getdetail().getvendors()" + "&id=" + "item.getdetail().getid()", httpclient, localcontext); } } catch (clientprotocolexception e) { // todo auto-generated catch block e.printstacktrace(); return null; } catch (ioexception e) { // todo auto-generated catch bl

javascript - How Gzip in Tomcat works -

i doing issues script compression. following found in stackoverflow: "if using in webpage, gzip configuration method in web server. file gzipped server, sent browser. no manual action needed. apache: http://httpd.apache.org/docs/2.0/mod/mod_deflate.html . if delivering code developers, use gzip command." someone told me if such script compression strategy used, make easy debug: when use firebug debug javascript in run time, script see original, uncompressed one, readable. but if use yui compressor, script shown in firebug this: var is_moz=(typeof document.implementation.createdocument!="undefined");var is_chrome=navigator.useragent.tolowercase().indexof("chrome")>-1;var selectedtreenodeidinoper="";var selectedtreenodepkinoper="";var windef="width=490,height=190,toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=1,copyh.... which in horizontal line , hard read. my question how can gzip in tom

ios - Ends of lines getting truncated on iPhone ( EDIT : end of line justification) -

Image
when use .txt file in app (even when fix as can) lines @ end truncated. want text reach end of line (all way right side of screen, first line) . should use type of file? if so, which? , if not, how words reach end of line? thanks p.s. cleantxt doesnt fix problem i want if interpret question correctly (via example), not question of truncation question of justification. want "full justification" i.e. text stretching left right insets text appears rectangular block of text. if yes , using uitextview then: for ios 6 , earlier uitextview *textview = @""; // replace property representing text .txt file textview.textalignment = nstextalignmentjustified; for ios 7+ (above deprecated) unfortunately need either use coretext or uiwebview. see post justified alignment in uitextview

php - Laravel with Eloquent doesn't save model properties on database -

i'm buiding web app using php laravel framework. when save model on database makes insert doesn't save model properties. can't see how fix because laravel log doesn't show mistake. idea? there's model: /** * database table used model. * * @var string */ protected $table = 'test'; // protected $fillable = array('name', 'surname', 'mobile', 'phone', 'mail', 'adress'); // model properties private $name; private $surname; private $mobile; private $phone; private $mail; private $adress; // model constructor function __construct($name, $surname, $mobile, $phone, $mail, $adress) { $this->name = $name; $this->surname = $surname; $this->mobile = $mobile; $this->phone = $phone; $this->mail = $mail; $this->adress = $adress; } and there's php code create user object , save database <?php // create object using model's constructor $user = new user('

postgresql - rails store java object to postgres -

i running rails4 using jruby , postgres db. have jar file call create instance of java object. java object bridge backend calculation engine on different machine. queries calculation engine , stores return values instance variables. need keep unique instance of object per session. possible store instances of java object in postgres? have no idea start on , looking on google hasn't helped advice appreciated. thanks. is possible store instances of java object in postgres? yes, it's bad idea. if must... if want this, can use java's serialization framework byte[] representation of object, can stored in bytea field in postgresql database via pgjdbc. i'm sure rails has mechanism work binary data too, if you'd prefer via rails. better ways objects that're data containers if object doesn't have logic, if it's bunch of instance variables no interesting methods act on them, should map object fields in relation, save each instance vari

Javascript - Error: 102 bad type for inQuery Parse.com -

when run code in cloud bad inner query error when should matching results. objectid's of objects have match? here code: parse.cloud.define("itemsinfo", function(request, response) { var testitems = parse.object.extend("testitem"); var userfavorites = parse.object.extend("userfavourite"); var testitemsquery = new parse.query(testitems); var userfavoritesquery = new parse.query(userfavorites); var installationquery = new parse.query(parse.installation); testitemsquery.exists('item'); testitemsquery.equalto('school', 'union college (ny)'); userfavoritesquery.include('item'); //this makes sure pull of favorite item data instead of pointer object userfavoritesquery.matchesquery("item", testitemsquery); //this run second query against testitems //userfavoritesquery.limit(1000); //limit results 1000 //userfavoritesquery.ascending('userid'); //group user id's in array userfavoritesquery.find({

html - Making sub navigation show on Skeleton Wordpress theme -

trying add sub menu items navigation correct html on navigation, sub menu doesn't show. it's using skeleton wordpress theme , header manually updated , when required needing add sub menu. html: <div id="navigation" > <div class="menu container"> <ul class="row sixteen columns"> <li class="page_item menu-home"><a href="/">home</a></li> <li class="page_item page-item-56"><a href="/about">about</a></li> <ul class="sub-menu"> <li class="page_item page-item-10"><a href="/volunteer">volunteer</a></li> </ul> <li class="page_item page-item-4"><a href="schedule">schedule</a></li> <li class="page_item page-item-3"><a href="shows">shows</a></li> <li class=&quo

r - Transform "ambigous" factor to Posixct value -

this extract dates. df<-structure(c(2l, 3l, 1l, 4l, 5l), .label = c("05jul2014:00:00:00", "07feb2014:00:00:00", "10jul2012:00:00:00", "19apr1998:00:00:00", "22dec2010:00:00:00"), class = "factor") i transform date or posixct. i tried : as.posixct(df,"%d%b%y:%h:%m:%s") but dont seems solution. can show me mistake ? edit : tried this: as.posixct(df, format = "%d%b%y:%h:%m:%s") but obtain na na na na re edit : as.posixct("07feb2014:00:00:00", format = "%d%b%y:%h:%m:%s") return na but as.posixct("072014:00:00:00", format = "%d%y:%h:%m:%s") return "2014-09-07 cest" %b dont seems understand "feb" , computer use "french" locale... (but dont seems understand fev or jan (instead of feb , jan) final? edit i found solution using function : sys.setlocale("lc_time", "c") i don

android - Measure Stream Latency in RTSP Stream -

i have rtsp server stream data , android client. in client have used "videoview" widget of android play stream. have given url of server videoview , started it. have not written code stream , decode data. want measure stream latency in case. is there way measure latency in case?

uitableview - TabBar in TableViewController is not at the bottom -

Image
i trying add tabbar tableviewcontroller not bottom act cell here screenshot: when using uitableviewcontroller storyboard scene, every tab bar or toolbar drag in automatically put tableview tablefooterview . if don't want that, have create uiviewcontroller scene. therefore able drag tab bar or toolbar in it, set auto layout constraints , add uitableview in uiviewcontroller scene (see image below). however , there solution. select navigation controller scene , go attributes inspector. in simulated metrics, go bottom bar , select "translucent tab bar" or "translucent toolbar". then, select uitableviewcontroller scene , repeat previous operation (see picture below). if so, controllers following navigation controller have tab bar or toolbar (that's problem can fixed).

java - conflict in httpclient4.1.jar and httpclient4.2.3.jar -

in line 2 below: when use httpclient4.1.jar in libs setredirectstrategy error removed , laxredirect error occured (and laxredirect import take error)-error(1) below, when use httpclient4.2.3, laxredirect error removed , setredirectstrategy error occured- error(2) below . what do? (use 4.1 or 4.2.3, , chages must done?) defaulthttpclient httpclient = new defaulthttpclient(); httpclient.setredirectstrategy(new laxredirectstrategy()); imports are: import org.apache.http.impl.client.laxredirectstrategy; import org.apache.http.impl.client.defaulthttpclient; and errors are: 1- method setredirectstrategy(laxredirectstrategy) undefined type defaulthttpclient 2- laxredirectstrategy cannot resolved type the redirectstrategy introduced 4.1 , deprecated.so when included 4.1 jar setredirectstrategy worked 4.2.3 didn't. in case can't override system (android's) implementation.so here suggest refer questions no. 1 , no. 2 , no. 3 .

node.js - Running "ember server" fails with error -

i'm trying existing ember app running locally development, when run "ember server" inside app directory, error: version: 0.0.39 livereload server on port 35729 serving on http://0.0.0.0:4200 eacces, unlink 'dist/assets/.gitkeep' error: eacces, unlink 'dist/assets/.gitkeep' per thread https://github.com/stefanpenner/ember-cli/issues/381 tried doing following: npm uninstall -g ember-cli rm -rf node_modules npm cache clear npm install -g ember-cli npm install bower install note had use sudo in front of npm commands rm -rf node_modules. tried per thread https://github.com/bower/bower/issues/475 , again using sudo: npm cache clean npm uninstall -g bower npm install -g bower but none of worked, still same error. i'm new using ember tooling i.e. npm, bower, ember-cli, etc. , have feeling did wrong during install process if i'm having use sudo time. suggestions how fix error? ok, had same issue , way fix is following. in command

SQL Server Rounding (CEILING) -

i've got this: declare @billsec int set @billsec = 67 declare @_cost money set @_cost = 0.1 + (ceiling((@billsec / 60)) * 0.015) print @_cost it's returning 0.12, i'm expecting 0.13 i'm trying round @billsec nearest minute. thanks both operands in @billsec/60 integers result truncated first (integer division). you need make 1 or both decimal or float preserve decimal part. otherwise ceiling no-op pass exact integer. replacing relevant part of code below solve this ceiling(@billsec/60.0)

ios - Bad Access using NSMutableArray with ARC -

at moment creating game cocos2d v3.1 using box2d, have use .mm extensions source files indicate using c++. game contains „endless terrain“ consists of terrain-key-points. created class saves key points named terrainelement. @ beginning of game create nsmutablearray called _elements array , fill random terrainelements. within game loop check iterate on elements, , draw elements visible. app crashes after rather random amount of time. header @interface terrainbase : ccnode{ nsmutablearray * _elements; } part of game loop: while (((terrainelement*)[_elements objectatindex:tokeypoint]).startpoint.x < _currentx+winsize.width*9/8) { //crashes here exc_bad_access, _elements array null terrainelement *element = (terrainelement*)[_elements objectatindex:tokeypoint]; [element drawelement]; tokeypoint++; } i not able figure out why nsmutablearray null. iterate on elements in each loop, , not touch them basically. made property out of _elements array(n

How can I write C++ code to print variable values in python prompt with SWIG -

i new swig , wrap c++ classes , use in python. practice, writing vector class (similar 1 in stl). want print out elements of vector after entering vector name in python environment. it like: >>>v 1 2 3 4 how can achieve that? you can use %template directive , std_vector.i library in .i file. reference: http://www.swig.org/doc3.0/swigdocumentation.html#library_std_vector mymodule.h file (c++ header file) #include <vector> std::vector<int> getvectorint(); mymodule.cpp file (c++ source file) std::vector<int> getvectorint() { std::vector<int> voutput; for(int = 0; < 10; i++) voutput.push_back(i); return voutput; } mymodule.i file (swig interface file) %module mymodule %{ #include "mymodule.h" %} %include "std_vector.i" %template(intvector) std::vector<int>; %include "mymodule.h" python output >>> my_vector = mymodule.getvectorint() >>> m

php - Parse error: syntax error, unexpected T_CONSTANT_ENCAPSED_STRING, expecting ')' -

i have line in php: function remove_dangerous_chars($src) { $list = array( '$', '\', '"', '\', '_request', '_get', '_post', '_cookie', '_files', '_server', '_env', 'globals', '_session', 'toupper' ); when run it, error: parse error: syntax error unexpected t_constant_encapsed_string, expecting ')' you need escape character, backslash, in array - $list = array( '$', '\\', '"', '_request', '_get', '_post', '_cookie', '_files', '_server', '_env', 'globals', '_session', 'toupper' ); and need backslash once in array.

How to privately publish Android apps over the net without giving away apk file? -

i want sell custom apps need know how can privately publish them on net without giving away apk file. there way can give customer password he/she use install app once website without getting apk file? after installation access download should cancelled. you cannot install apps without using apk file, unless target device rooted. even google play downloads apk files applications. stored in /cache/download , can browsed root access. once downloaded, installed in /data/app , requires root access read. google play alpha/beta testing what do, workaround, use google play alpha/beta testing feature private google+ community. allow control able download application through google play, not prevent them rooting device, , retrieving apk. you benefits of google play, , customers wont notice difference, once they've joined google+ community. use alpha/beta testing & stages rollouts

html - how can i add background-image under css3 gradient effect have low opacity -

my photoshop design have gradient colors,have 64 opacity , have pattern i' m have succeeded in gradient , low opacity code example in topic question how can add pattern display: block; position: relative; width:100%; height:100%; background: rgba(137,206,157,1); background: -moz-linear-gradient(top, rgba(137,206,157,1) 0%, rgba(74,187,154,0.64) 100%); background: -webkit-gradient(left top, left bottom, color-stop(0%, rgba(137,206,157,1)), color-stop(100%, rgba(74,187,154,0.64))); background: -webkit-linear-gradient(top, rgba(137,206,157,1) 0%, rgba(74,187,154,0.64) 100%); background: -o-linear-gradient(top, rgba(137,206,157,1) 0%, rgba(74,187,154,0.64) 100%); background: -ms-linear-gradient(top, rgba(137,206,157,1) 0%, rgba(74,187,154,0.64) 100%); background: linear-gradient(to bottom, rgba(137,206,157,1) 0%, rgba(74,187,154,0.64) 100%); filter: progid:dximagetransform.microsoft.gradient( startcolorstr='#89ce9d', endcolorstr='#4abb9a', gradienttype=0 );