Posts

Showing posts from May, 2012

mod rewrite - fat free php in subdirectory, routes not workin -

i'm staging fatfree site, i'm having issue running in subdirectory this htaccess: rewriteengine on rewritebase /~site/ rewritecond %{request_filename} !-l rewritecond %{request_filename} !-f rewritecond %{request_filename} !-d rewriterule .* /~site/index.php [l,qsa] and route i'm using get /*/index=app->show_home i'm having add /* before rest of it, because script keeps including subfolder part of route. this working, suppose, once update dns settings, site no longer have these , have update it. is there setting can apply somewhere allow both scenarios work? the basic required .htaccess goes this: rewriteengine on rewritecond %{request_filename} !-l rewritecond %{request_filename} !-f rewritecond %{request_filename} !-d rewriterule .* index.php [l,qsa] notice how: rewritebase not needed index.php located in same folder .htaccess but when using mod_userdir, little more configuration required: set rewritebase explicitly (as did

spring boot - Loading applicationcontext.xml when using SpringApplication -

could provide example of springapplication loads applicationcontext.xml file? i'm attempting move gwt rpc application restful web service using spring's example (gradle based). have applicationcontext.xml not see how springapplication load it. loading manually via applicationcontext context = new classpathxmlapplicationcontext(args); results in empty context. ...and if worked separate 1 returned from springapplication.run(application.class, args); or there way external beans app context created springapplication.run? you can use @importresource import xml configuration file spring boot application. example: @springbootapplication @importresource("applicationcontext.xml") public class exampleapplication { public static void main(string[] args) throws exception { springapplication.run(exampleapplication.class, args); } }

c - Should a read from FIFO block after all the data was just read from that FIFO? -

i'm learning pipe programming in linux, , having trouble understanding pipe / fifo management. i wrote small program opens fifo created (i did mkfifo newfifo in terminal before executing program). repeatedly read , dump character buffer. i'm filling fifo using echo "message" > newfifo terminal's cmd line. the problem when write fifo, can read data in buffer, read doesn't block anymore. understanding after read data fifo, fifo should empty , read should block. thinking wrong, or incorrectly managing fifo? code below: #include <stdio.h> #include <stdlib.h> #include <unistd.h> #include <fcntl.h> #include <sys/types.h> #define newpipe "./newfifo" void main() { int great_success = 0; int fd; char buffer[20]; fd = open(newpipe, o_rdonly); while (1) { great_success = read(fd, buffer, 20); if (great_success < 0) { printf("pipe failed\n"); } else { printf("

implementing blocking syscalls in Linux -

i understand how implementing blocking i/o syscalls different non-blocking? googling didn't much, links or references appreciated. thanks. http://faculty.salina.k-state.edu/tim/ossg/device/blocking.html blocking syscall put task (calling thread) sleep (block running on cpu), , syscall return after event (or timeout). non-blocking syscall not block thread, checks in-kernel states , returns. more detailed description: http://www.makelinux.net/ldd3/chp-6-sect-2 one important issue: how driver respond if cannot satisfy request? call read may come when no data available, more expected in future. or process attempt write, device not ready accept data, because output buffer full. calling process not care such issues; programmer expects call read or write , have call return after necessary work has been done. so, in such cases, driver should (by default) block process, putting sleep until request can proceed. .... there several forms of wait_event kernel functio

html - Responsive grid with fixed column width -

i guess have simplest problem ever , cannot find ready solution. i need make grid fixed widths , fixed distance between them. i need x columns 400px (x = total width/400), , during browser resizing need grid shrink, column column (columns must keep width size , distance between them). the content flows on columns , should spread out on columns. that's why don't open source grid system (boostrap, skeleton, etc.) use %width, , columns change width on resizing. what simplest way? edit/clarification: this how looks without columns: http://jsfiddle.net/xjrt8qrm/16/show/ <div>see fiddle</div> i want have x columns. x maximum possible amount of 400px columns, depending on users resolution. want 1 row of columns, content spreads on newspaper top bottom. so somehow on pc: http://i.imgur.com/kmd620p.png (you can ignore text/comments there). it's pretty simple. container holds contents together. float left cause them line left right. wh

angularjs - Angular Config Doesn't Work -

i have following code. console.log(apiserverconstants.url) line in factory returns undefined when inject authservice in other code. why? angular.module("webclient.constants", []) .constant("apiserverconstants", { "url": "http://localhost:8080" }); angular.module('webclient', [ // stuff 'webclient.constants' ]) .config( // code }); angular.module('webclient') .factory('authservice', ['$http', 'apiserverconstants', 'localstorageservice', function($http, localstorageservice, apiserverconstants) { return { authenticate: function(data) { // code }, login: function(data, apiserverconstants) { console.log(data); console.log(apiserverconstants.url); // more code } } }]); you inverted injections. ['$http', 'apiserverconstants', 'localstorageservice', function($http, local

c# - returning data into textboxes without postback -

i have form has reference number , notes field. this: ref notes in database have multiple rows: 1234 | note1 | 20/03/2013 18:44 1234 | note2 | 20/03/2013 18:45 i show recent notes in text box. need show reference number too. i do: sqlconnection conn = new sqlconnection(connection_string); sqlcommand comm1 = new sqlcommand(command, conn); conn.open(); sqldatareader dr1 = comm1.executereader(); if (dr1.read()) { textbox.text = dr1.getvalue(0).tostring(); } conn.close(); but there more elegant solution allows me click between each record without postback? if avoiding full postback going use ajax (short asynchronous javascript , xml). you have 2 popular options use microsoft ajax implementation comes asp.net framework , make use of updatepanel , other controls use jquery ajax if have idea on jquery library , data structures used in jquery, go jquery ajax more easy use. from jquery - ajax introduction ‘writing regular ajax code can bit tric

c# - Entity Framework Error when no records are returned -

.net framework 4 | sql server 2008 | entity framework 6 i calling function import calls stored procedure , creates complex object. in cases result 0 records. seems if have case columns in complex object must set allow nulls. don't want because, if there records, non of columns null. causing me have check nulls on of these fields instead of checking if returned list has rows. am doing wrong or way ef set up? update: i'm not sure code want. it's simple select statement. stored procedure call through regular function import. here's how calling that: // district entity list<schoolcollectionsummary_result> summaries = context.getschoolcollectionsummary( schoolyear.schoolyearid, districtorganizationid, schoolorganizationid).tolist(); schoolcollectionsummary_result complex type (entity) based on stored procedure. as enumerate error occurs: {"the 'schoolcollectionid' property on 'schoolcollectionsummary_result' not s

How to handle multiple PouchDB instances in the browser that sync with the same db? -

what recommended way of dealing multiple pouchdb instances in browser synchronize simultaneously same remote/local database? my setup web application in browser synchronizes continuously remote couchdb. web app opened more once (multiple tabs/windows) , create multiple pouchdb instances try sync. in such case, 1 pouchdb instance report remote changes - other instances produce conflict during live sync: { error: true, message: "document update conflict", name: "conflict", result: { doc_write_failures: 0, docs_read: 1, docs_written: 1, end_time: ..., errors: [ custompoucherror ], last_seq: 963, ok: false, start_time: ..., status: "aborting" }, status: 409 } do need ensure 1 pouchdb instance syncs @ time , pass changes around manually? pouchdb replication not work in multiple tabs. an open issue , , wants hop in more welcome to. :)

graphics - Gettting normal point on a Cone -

i'm trying cone primitives working in ray tracer. got intersections of cone , ray working. however, not know how normals of cone way cone defined. define cone following: pos -- vertex of cone size -- height of cone direction -- unit vector defines direction of cone angle -- angle of cone (for more info followed how intersection of line , cone reference on how defined). from gather can use two tangents of point parametric eqn , , using cross product normal. don't know how parametric eqn given way defined cone, , 2 tangents parametric eqn. if somehow has method find normals great to. i ended applying grad function cone equation (x*a+y*b+z*c)^2-(a^2+b^2+c^2)(x^2+y^2+z^2)cos(t)^2 where {x,y,z} = 3d point (point of normal in question) {a,b,c} = direction vector t = angle of cone then using wolframalpha , ends giving me x = (2 (a x+b y+c z)-2 (a^2+b^2+c^2) x cos^2(t)) y = (2 b (a x+b y+c z)-2 (a^2+b^2+c^2) y cos^2(t)) z = (2 c (a x+b y+c z)-2 (a^

vaadin7 - Click listener on image broken in Vaadin 7 -

i run code make button add gridlayout. private image makebutton(string text) { final image imagebutton = new image(text); imagebutton.seticon(new externalresource("https://cdn2.iconfinder.com/data/icons/ios7-inspired-mac-icon-set/128/_app_store_128.png")); imagebutton.addclicklistener(new mouseevents.clicklistener() { @override public void click(mouseevents.clickevent event) { notification.show("hello world"); } }); return imagebutton; } however click event never called. idea how/why happen? use setsource() instead of seticon() .

php - How can I exclude folders with this backup script? -

i'm using great script backup folders on server, there couple of folders want exclude backup. how go excluding them? thanks <?php /* * php: recursively backup files & folders zip-file * (c) 2012-2014: marvin menzerath - http://menzerath.eu * contribution: drew toddsby */ // make sure script can handle large folders/files ini_set('max_execution_time', 600); ini_set('memory_limit','1024m'); // start backup! zipdata('/var/www/html/uploaded', '/var/www/html/uploaded.zip'); echo 'finished.'; // here magic happens :) function zipdata($source, $destination) { if (extension_loaded('zip')) { if (file_exists($source)) { $zip = new ziparchive(); if ($zip->open($destination, ziparchive::create)) { $source = realpath($source); if (is_dir($source)) { $iterator = new recursivedirectoryiterator($source); // skip

FFmpeg in a bash script ( quotes ) -

i'm working on script open text file ffmpeg commands. ( 10 command generated other project ) each command working when copy paste terminal manually, when script run, simple commands work stuck on " no such filter : ..." error. here command : -i 1.mp4 -i 2.mp4 -i 3.mp4 -i 4.mp4 -i 5.mp4 -i 6.mp4 -filter_complex '[0:0][0:1][1:0][1:1][2:0][2:1][3:0][3:1][4:0][4:1][5:0][5:1]concat=n=6:v=1:a=1:unsafe=1 [v] [a]' -map '[v]' -map '[a]' -aspect 16:9 -s 1280x720 -c:v mpeg4 -c:a libmp3lame -y track_0.mp4 i think problem in " ' " try escape them " \' " ffmpeg telling me no such filter: ''' here script assuming variable args set dynamically ( example have set manually ) : #!/bin/bash args="-i 1.mp4 -i 2.mp4 -i 3.mp4 -i 4.mp4 -i 5.mp4 -i 6.mp4 -filter_complex '[0:0][0:1][1:0][1:1][2:0][2:1][3:0][3:1][4:0][4:1][5:0][5:1]concat=n=6:v=1:a=1:unsafe=1 [v] [a]' -map '[v]' -map '[a]' -aspe

sql - Does Oracle have a time-to-live feature for rows? -

in cassandra used using ttl clause of upserts sets number of seconds after upserted data deleted. does oracle have feature this? haven't been able find it. there ways implement feature, don't believe built in. easiest way have createdat column in table specifies when row has been inserted. then, create view recent rows, recent day: create view v_table select t.* table t t.createdat >= sysdate - 1; this fixes data access side. delete rows, need additional job periodically delete old rows in table.

html - Foundation 5: Change Container color behind Tabs & Tab Content Panels -

i working on building web app using foundation 5 framework. have page contains comments , updates section, navigated tabs , contained within panels. i added box shadow tab content panels contain updates , comments, there margins on either side white space don't blend styling of rest of page. i used inspect element @ at element margins fall into, , part of content panels themselves. how go changing background margins blend rest of page, , tabs & content white box shadow? the html tab , accompanying panels follows: <div id ="tabs"> <ul class="tabs" data-tab role="tablist"> <li class="tab-title active" role="presentational" ><a href="#panel2-1" role="tab" tabindex="0" aria-selected="true" controls="panel2-1">updates</a></li> <li class="tab-title" role="presentational" ><a href="#panel2-2"

.net - Mono and missing references -

i'm new .net , using mono (great combination know), , having trouble missing references code developed in visual studio. i know if possible have these libraries mono? system.web.entity devexpress.web.v14.1 devextreme.webforms.v14.1 dotnet.highcharts system.web.datavisualization system.deployment aspose.cells thanks help... it looks need add project reference missing nuget packages. if have monodevelop 4.x or under, go here first , follow instructions install nuget add-in. (if have version 5.0 or later, should come built in already.) then, right-click on references folder , there should option manage/install nuget add-ins. click that. search names of packages in search box, install them, , should able resolve references.

Cannot get the SelectedValue of the Drop Down List ASP.NET -

ok, when want selectedvalue of dropdownlist when click button, selectedvalue return "" (nothing), please me thanks! here source <tr> <th style="float:left"> <asp:dropdownlist id="ddlcategory" runat="server" ></asp:dropdownlist> <asp:textbox id="txtsearch" runat="server"></asp:textbox> <asp:imagebutton id="btnsearch" runat="server" height="20px" imageurl="~/img/search.png" onclick="btnsearch_click" width="20px" /> <asp:linkbutton id="lbtnsearch" runat="server" postbackurl="~/search.aspx">advanced search</asp:linkbutton> </th> </tr> and here code behind public partial class _default : system.web.ui.page { sqlconnection con = new sqlconnection(configurationmanager.connectionstrings["connectionstring"].connectionstr

javascript - Can't detect scroll event since Chrome update -

i updated chrome mac v41.0.2272.101 , realized unable detect javascript scroll event on window when full-screen element has overflow: hidden. don't know why used work few days ago, didn't touch code since update. weird thing is: works on safari. i created simple fiddle show you: https://jsfiddle.net/4cd2uf0c/3/ example: <div class="scroll-div"></div> .scroll-div { position: absolute; top: 0; left: 0; height: 100%; width: 100%; background-color: red; overflow: hidden; } $(window).on('scroll', function() { alert('this used work before on chrome mac'); }); any ideas or workaround? thanks lot!

if statement - Syntax Issue involving eststo -

i stuck following syntax problem involving eststo (stata version 13). i have restricted analysis subgroup of dataset. generate subsample1=0 replace subsample1=1 if [(cs_rb010==2009 & l.rb210==1 & l.unmetneed==0) | (cs_rb010==2010 & l.rb210==1 & l.unmetneed==0)] now want run models created , bring them in table. end used eststo . problem stata won´t let me use if command: i've tried possible combinations , if messing up. please see below. ssc install estout, replace eststo clear xtset pid cs_rb010 eststo: xi: logit unmetneed i.employment age agesq i.education i.maritalstatus i.cs_rb020 if subsample1=1, or eststo: xi: logit unmetneed i.employment age agesq i.education i.maritalstatus il.selfratedhealth i.cs_rb020 if subsample1=1, or eststo: xi: logit unmetneed i.employment age agesq i.education i.maritalstatus il.selfratedhealth i.makeendsmeet i.cs_rb020 if subsample1=1, or esttab esttab using "c:\users\joana\documents\mphil\silc datasets\

MYSQL Timestampdiff output formatting last two decimals -

simple question what best way change output displays last 2 decimals? select avg(timestampdiff(hour, start_it,start_qa) so output of '13.2500' displays '13.25'. thanks help. normally, in application layer. if insist on doing in database, can use format() : select format(avg(timestampdiff(hour, start_it,start_qa), 2)

android - 40+ ImageButtons on one screen? -

for last 10+ hours try large (40+) amount of images (in imagebutton format) on single android screen without out of memory errors. activity work on image picker coloring book app. images of various sizes in range of (500 1200)x(500 1200), pngs (if matters). i have tried: horizontal scroll view images added code. result slow (i on ui thread) , consumes large memory space. horizontal scroll view images added code via asyncthread. result fast still consumes large memory space. i user experience of 1 most! grid view , list view - both choppy (testing on first nexus 7). memory usage better. what considering view pager - first results better grid view performance perspective (i have not completed moment assess memory usage should better understand). yet, dislike user experience , prefer scrollable list of images. conversion of resources jpg (will rid of transparency byte?) downsizing images max 500x500px none of solutions seems android photo gallery app available on dev

Default of malloc'd bool value within struct in C? -

what value of bool within struct when try access n->mybool? i'm interested know "default" value of bool after allocating memory not assigning true of false value. #include <stdbool.h> typedef struct node { bool mybool; } node; void main() { node* n = malloc(sizeof(node)); return; } edit: corrected typo in code (should sizeof(node) not sizeof(node) there no default value. space allocated malloc uninitialized, , trying read n->mybool before writing value cause undefined behaviour.

c# - How to keep integrity on soft delete? -

i have following situation: have system 1 entity related entities in cases (40% of system). i'm using entity framework, can retrieve items property (e.g isdeleted ) equals false, means, retrieve data correctly, i'm able , it's ok. but, i'm trying figure out how can check if there's registry related principal entity before soft deletion. since have more 450 entities on system, it's not option validation hand on every table. there's anything, configuration, flags... can perform validation?

Receiving a TypeError in FF and Chrome for JavaScript Function -

please help...i have tried correct error in firefox , chrome. receiving current error when run function. "typeerror: obj1.options not function". have tried many things including trying change onclick function jquery .click() function , placing between jquery document.ready function. works fine in ie, throws typeerror in other browsers. multiple type errors 1 addmember function , 1 remove member. may old deprecated javascript. offered appreciated. thanks function removemember(idx, idx2){ //centralizes code remove selected items multiple select (listbox). //loops "backward" maintain valid indexing counters while removing items. var obj = idx; var obj2 = idx2; var ncount = 0; ncount = obj.options.length - 1; ( ncount; ncount > -1; ncount -- ) { if ( obj.options(ncount).selected == true ) { var ooption = document.createelement("option"); ooption.text = obj.options(ncount).text;

android - Disable adb force-stop in the app -

i trying disable force stop of android app writing. "force stop" disabled in settings. expecting see same behavior using adb, can kill app if send force-stop command using adb. is there way can disabled in app? essentially, behavior should same in both cases. thanks. your app cannot control that. app process killed os, cannot prevent this.

ruby on rails - Using an array of hashes I need to compare two values -

i have following array of hashes: [{"dwidnote"=>14, "streetaddress"=>"250 palm valley blvd.", "propertyaddress"=>"250 palm valley blvd."}, {"dwidnote"=>16, "streetaddress"=>"2801 alaskan way", "propertyaddress"=>"2801 alaskan way"}, {"dwidnote"=>17, "streetaddress"=>"300 lakeside drive", "propertyaddress"=>"300 lakeside drive "}, {"dwidnote"=>18, "streetaddress"=>"3817 parkdale", "propertyaddress"=>"3817 parkdale "}] i need compare values keys streetaddress , propertyaddress see if match. values not match need display value key dwidnote . how do this? assuming array in variable named a this: a.select{|e| e['streetaddress'] != e['propertyaddress']}.map{|e| e['dwidnote']} will return this: [17, 18]

Getting error "cant concat str to byte" python -

i found code written in python2.7 , decided write changes run python3.1, code backdoor want install on home computer fun. unfourtunately ran error "cant concat bytes str" when tried send command client computer, think has changes form python2.7 python3.1, sorry if im unclear im trying explain best can. here server script: import sys import threading import paramiko import socket host_key=paramiko.rsakey(filename='/home/jack/.ssh/id_rsa') class server(paramiko.serverinterface): def __init__(self): self.event=threading.event() def check_channel_request(self,kind,chanid): if kind == 'session': return paramiko.open_succeeded return paramiko.open_failed_administratively_prohibited def check_auth_password(self,username,password): if (username=='root') , (password=='toor'): return paramiko.auth_successful return paramiko.auth_failed try: sock=socket.socket(sock

java - EasyMock: How to Verify Method Order for Set of Values Where Order of Set Does Not Matter -

i have test in have set of specific values 2 different methods execute once each value in set. need check 2 methods called in specific order in relation each other, not in relation order of set of values. example: string[] values = { "a", "b", "c" }; (...<loop on values...) { methodone(value); methodtwo(value); } it not matter order values in, need verify methodone() , methodtwo() called each value in set , methodone() called before methodtwo() . i know can create control , expect methodone() , methodtwo() each value, control.verify() , depends on values being in specific order. is there elegant way this? thanks you can using andanswer() . basically, inside andanswer() methodone() set variable hold passed in value was. then in andanswer() methodtwo() assert same argument matches saved methodone answer. since each call methodone modify variable make sure methodtwo() called after methodone(). note sol

wpf in c# returning error "not all code paths return a value" on GetProductRecords() -

this question has answer here: not code paths return value 5 answers public class productrecord { private int _code; private string _name; private int _quantity; private string _size; private string _unit; private datetime _dateordered; private string _manufacturer; public int code { { return _code; } set { _code = value; } } public string name { { return _name; } set { _name = value; } } public int quantity { { return _quantity; } set { _quantity = value; } } public string size { { return _size; } set { _size = value; } } public string unit { { return _unit; } set { _unit = value; } } public datetime dateordered { { return _dateordered; } set { _dateordered = value; } } public string manufacturer { { return _manufacturer; } set { _manufacturer = value; } } public static l

php - How does form buttons can select checkboxes in the next page? -

i have buttons in first_page.php, , checkboxes in second_page.php. need select corresponding checkbox query string this: when "first value button" pressed --> "second_page.php" "my first value" checkbox selected. first_page.php : <form action="second_page.php"> <input class="btn" type="submit" value="first value button"> <input class="btn" type="submit" value="second value button"> <input class="btn" type="submit" value="third value button"> </form> second_page.php : <form name="name" method="post" action="#"> <input type="checkbox" name="mybox[]" value="my first value"/> <span>my first box</span><br /> <input type="checkbox" name="mybox[]" value="my second value"/> <span&g

firewall - How to programmatically set Fiddler Win8 Loopback Exemptions? -

Image
we need ensure fiddler exempting apps every build. what we’re noticing after initial exempt all, , after couple of builds, our tests fail because apps no longer exempted. we want programmatic way check , set exemptions before each test run ensure apps included. i’ve searched registry , appears not using configuration file. has anyone, ever, been able programmatically set fiddler exemptions? enableloopback.exe command-line utility included fiddler. simply run -all command-line argument automatically exempt application packages. alternatively, ctrl+click winconfig button in fiddler toolbar (which runs enableloopback.exe -all itself).

java - Printing a shape based on inputs from the user -

i trying print shape based on input; shape "x". inputs must positive odd ints, , arbitrary brush character. have code completed user input, need code prints shape. here have far: public class testprogram { public static void main(string[] args) { int height = 5;//any positive odd int 5 not work correctly. not sure going on. char brush = '*'; (int row = 0; row < height/2; row++) { (int = row; > 0; i--) { system.out.print(" "); } system.out.print(brush); (int = (height/2); >= 2*row; i--) { system.out.print(" "); } system.out.print(brush); system.out.print("\n"); } (int row = 1; row < (height/2)+1; row++ ) { system.out.print(" "); } system.out.print(brush); system.out.print("\n"); (int row = (

python - how to apply ceiling to pandas DateTime -

suppose have pandas dataframe column values datetime64[ns] . out[204]: 0 2015-03-20 00:00:28 1 2015-03-20 00:01:44 2 2015-03-20 00:02:55 3 2015-03-20 00:03:39 4 2015-03-20 00:04:32 5 2015-03-20 00:05:52 6 2015-03-20 00:06:36 7 2015-03-20 00:07:44 8 2015-03-20 00:08:56 9 2015-03-20 00:09:47 name: datetime, dtype: datetime64[ns] is there easy way convert them nearest minute after time? i.e. want following: out[204]: 0 2015-03-20 00:01:00 1 2015-03-20 00:02:00 2 2015-03-20 00:03:00 3 2015-03-20 00:04:00 4 2015-03-20 00:05:00 5 2015-03-20 00:06:00 6 2015-03-20 00:07:00 7 2015-03-20 00:08:00 8 2015-03-20 00:09:00 9 2015-03-20 00:10:00 name: datetime, dtype: datetime64[ns] i wrote complicate code first converts them string , extracts 3 portions of 00:09:47 , convert them integers, unless last portion (seconds) 00 , make last portion (seconds) 00 , adds 1 middle portion (minutes) except if middle portion (minutes) 59 in case adds first p

xml - hexadecimal 0X19 is an invalid character -

so, i building xml string based on values dataset using xmlwriter. it building xml string per settings , conditions specified. if there more 1000 records in dataset , when try build xml string getting above error. hexadecimal 0x19 invalid character how pass this. have spent around 6 hrs trying figure out. please help quite simply, you're not allowed character in xml document, no matter how mark up. quote spec : char ::= #x9 | #xa | #xd | [#x20-#xd7ff] | [#xe000-#xfffd] | [#x10000-#x10ffff] roughly translated, means before 0x20, you're allowed tab (0x09), newline (0x0a) , carriage return (0x0d). the normal way overcome sort of issue use another, embedded, encoding base64 .

Why Java file doesn't find the Drawable xml file in android studio? -

Image
i making alarm clock. in 1 of java file have find drawable file this: layout.setbackgroundresource(r.drawable.view_touch_selector); but, shows error , says can't resolves symbol view_touch_selector . don't know why it's happening although have corresponding view_touch_selector created. update (after original android's answer): can't resolve symbol 'r' error! 'r' becomes red in each file. i think problem view_touch_selector has not been created in generated r.java file. anomaly (may common) you'll have try 1 or more of steps listed below (ordered easiest/short time longer). if execute step 1, compile. try step 2, compile, , on. android studio, using either file or menu bar: select res/drawable folder project tree , select file -> synchronize. menu -> build -> rebuild project menu -> build -> clean project, build it. file -> invalidate caches / restart menu tools -> android -> sync project

actionscript 3 - How to detect a unique person in front of media station -

i need create application capable of detecting person entering , leaving area in front of big screen. since sensors infrared , ultrasound can fooled multiple persons thinking of using face / person recognition. 1 option use kinekt sensor. questions: system reliable? there option? thanks bundle! i've used kinect kind of projects in actionscript , unity c# , can that's best , solution detect person , mantain low cost. have 2 possibilities use kinect as3: first use air ane (adobe native extension) , interface c++/c# dll application. second 1 use old trick of socket communication. have 2 application as3 , c#/c++ , put them in communication tcp/udp connection on loopback interface. imho best solution first one, don't have write protocol communicate call methods , receive events normal api.

javascript - Jquery mobile script conflicting on bootstrap 3 -

is there way me use jquery mobile script without conflicting on bootstrap 3? issue links not working when used jquery mobile script whenever remove script links working fine. use jquery mobile pop feature. i'm newbie on jquery , bootstrap web development, apologize if question seems newbie.. in case highly appreciated. <!doctype html> <html> <head lang="en"> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1"> <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.1/css/bootstrap.min.css"> <link rel="stylesheet" href="http://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css"> <link rel="stylesheet" href="http://code.jquery.com/mobile/1.4.5/jquery.mobile-1.4.5.min.css"> </head> <style> body { padding: 20px 50px 150px;

css3 - CSS @import inside a class -

i attempting following: .bootstrap-scope { @import "bootstrap.min.css"; } i know bootstrap.min.css in proper place because placing @import "bootstrap.min.css"; @ top of css page works fine. anyways, point able scope out affected bootstrap. bootstrap applied enclosing div <div class="bootstrap-scope"> ... </div> any ideas? seems should straightforward. this post suggested put import inside class.. there alternatives? you cannot @import inside css rule. @import statements must declared outside selectors. from the mdn page on @import : the @import css at-rule allows import style rules other style sheets. these rules must precede other types of rules, except @charset rules; not nested statement, cannot used inside conditional group at-rules. such functionality require nested selectors, not exist in css. you have write such thing in less or sass, , preprocess css. your linked question suggests creating

angularjs - My $scope variable not updated -

i have collection of objects service: $scope.rooms = testdata.list().rooms; // {"room1":{"name":"bathroom"},"room2":{"name":"wcc"},"room3":{"name":"kitchen"}}; i need find room $routeparams.id $scope.room = $scope.rooms[$routeparams.id]; // example $routeparams.id = 'room1' if inspect in view: {{rooms}} {{room}} i see how rooms dynamically updated, room undefined . if call in view this: {{room = rooms[roomuid]}} // $scope.roomuid = $routeparams.id it found room expected. why can not find room in controller? updated: i found problem, $scope.rooms collection empty when try find room id. $timeout $scope.room work expected, how start finding room after $scope.rooms populated? $timeout(function(){$scope.room = $scope.rooms[$routeparams.id];}, 3000); i solved by: if($routeparams.id){ $scope.action = 'edit'; $scope.roomid = $routeparams.id; $sc

Which of these is more appropriate for learning C#: Visual Studio Express Web or Desktop? -

i downloaded visual studio express web without knowing there 2 other versions (windows desktop , windows). checked on stackoverflow , saw "windows desktop" version better learning c#. visual studio express web? equally ide learn c# on? i assuming want create simple console , windoze desktop apps (not modern ui apps). in case, you want use visual studio express windows desktop . here short explanation of each edition for: vs express windows desktop: creating desktop apps , console apps. vs express windows: 1 creating modern ui apps, ones run full screen in windows 8. vs express web: 1 creating web apps using .net technologies such asp.net mvc. other options microsoft has new version if vs called visual studio community . vs community vs professional, free. according vs website , acceptable usage individual developers follows: q: can use visual studio community? a: here’s how individual developers can use visual studio community:

linux - Ubunutu - .ssh folder exists but I cannot see it? only through terminal -

when go terminals , use $ cd ~/.ssh able enter directory, proves exists. however, when use other file browser, cannot find .ssh folder! why happening?? desperately need access .ssh perhaps invisible? can me (ubuntu 14.04) any files or directories start dot hidden. cannot seen file browser. open terminal , ls -a now see .ssh directory listed. make sure using ls -a command in right home directory. if able cd ~ssh 1 user use ls -a command in user's home directory. if want see files in file browser create directory without starting dot , copy contents .ssh directory new directory have created. sudo mkdir /home/user_name/sshfolder sudo cp /home/user_name/.ssh/* /home/user_name/sshfolder/ now open file system browser , verify contents. hope helpful.

Passing vectors by reference in C++ functions -

freshman cs student here. i'm trying write project, flexible to-do list using vectors. however, can't life of me figure out what's wrong code. it's supposed select function chosen user options menu function, , continue ask user add things list unless choose otherwise. whole thing end when user chooses "done" option 7, , after that's verified there no items left in tasklist array. here's code: #include <fstream> #include <iomanip> #include <iostream> #include <string> #include <sstream> #include <vector> using namespace std; void options() { cout << "\nwhat do?\n\n" << endl; cout << "1) add list. \n"; cout << "2) show next item on list. \n"; cout << "3) next item on list, , remove it. \n"; cout << "4) list items \n"; cout << "5) save list. \n"; cout << "6) load list. \n"; c

Compare two objects with "<" or ">" operators in Java -

how make 2 objects in java comparable using "<" or ">" e.g. myobject<string> obj1= new myobject<string>(“blablabla”, 25); myobject<string> obj2= new myobject<string>(“nannaanana”, 17); if (obj1 > obj2) something. i've made myobject class header as public class myobject<t extends comparable<t>> implements comparable<myobject<t>> , created method comp gain got can use "sort" on list of objects, how can compare 2 objects each other directly? if(obj1.compareto(obj2) > 0) the way? you cannot operator overloading in java. means not able define custom behaviors operators such + , > , < , == , etc. in own classes. as noted, implementing comparable , using compareto() method way go in case. another option create comparator (see docs ), specially if doesn't make sense class implement comparable or if need compare objects same class in different ways.

php - SimplePie RSS not accepting variable with comma separated strings -

i'm trying use simplepies "$feed->set_feed_url (array());" function having major difficulty understanding why wont accept values. when add urls manually (i.e directly below), work fine. feeds go through ok , displays feeds needed. $feed ->set_feed_url (array( 'http://www.theverge.com/tag/rss', 'http://feeds.ign.com/ign/all' )); i have urls in database table pulling out normal while loop. append comma , remove trailing comma nice simplepie array. so: while($row = mysqli_fetch_array($pullallaccountsdoit)){ $result4mdb .= $row[0] . ","; } $result4mdb = substr($result4mdb, 0, strlen($result4mdb) -1); echo "the result is: " . $result4mdb; when this, , echo out " $result4mdb ", prints out: the result is: http://www.gamespot.com/feeds/mashup/,http://www.theverge.com/tag/rss meaning variable , printing out need. far good. go simplepie code, put in varialble so: $feed ->set_feed_url (array