Posts

Showing posts from May, 2014

visual studio 2012 - In VS2012 how do I filter the Object Browser to display objects in my Project? -

Image
in vs2012 how filter object browser display objects accessible project? as far can make out ui can configured show either 1) installed on machine. 2) manually selected subset of installed on machine. 3) referenced entire solution. so useful view of all, namely view of referenced current project? the msdn states can use view can referenced project http://msdn.microsoft.com/en-us/library/vstudio/exy1facf%28v=vs.100%29.aspx "the object browser lets select , examine namespaces, classes, methods, , other programming symbols available use in project." but can't see how it. you can use class view (ctrl + shift + c) see references available per project. look in projects references section of each project in class view. example: class library in solution here, looking @ system.collections classes. example: wpf project in solution here looking system.diagnostics classes to view class in object browser , right click , choose, "brow

Findbugs not working in Eclipse for Android project error java.rmi.Remote -

when run findbugs plugin in eclipse following error in log !entry edu.umd.cs.findbugs.plugin.eclipse 2 2 2013-05-01 11:13:13.289 !message following classes needed findbugs analysis on project android-enterprise-im-client missing: !subentry 1 edu.umd.cs.findbugs.plugin.eclipse 2 0 2013-05-01 11:13:13.289 !message java.rmi.remote i found post: eclipse findbugs plugin fails android project asking java.rmi.remote mentions "disable of detector configurations under project properties->findbugs->detector configuration" if disable detectors error goes away don't warnings either. my eclipse version is: eclipse ide java developers version: juno service release 2 build id: 20130225-0426 findbugs version is: 2.0.2.20121210 anyone know how solve this?

twitter bootstrap - Dropdown menu with full width submenu -

i trying create dropdown menu using bootstrap twitter. need have submenu has width same main menu, , placed below it. bootstrap provide standard dropdown menu placed right below clicked li item , width dependent on li. of course understandable submenu child of clicked li, have easy tricks make change? or solution write own dropdown this? what more, need responsive. you can tweak css .dropdown-submenu make appear below parent dropdown. for example, .dropdown-submenu .dropdown-menu{ left:10px; top:32px; } demo

precision - Java double addition rounding off -

in java following expression results into new double(1.0e22) + new double(3.0e22) = 4.0e22 but new double(1.0e22) + new double(4.0e22) = 4.9999999999999996e22 i expecting 5.0e22 . double limit 1.7976931348623157e308 . appreciate help. machine's architecture x64 , jvm 64 bit. welcome planet of floating point units. unfortunately, in real world, have give precision speed , breadth of representation. cannot avoid that: double approximate representation. actually, cannot represent number finite precision. still, it's approximation: less 0.00000000001% error. has nothing double upper limits, rather cpu limits, try doing more math python: >>> 4.9999999999999996 / 5. 1.0 >>> 5. - 4.9999999999999996 0.0 see? side note, never check equality on double , use approximate equality: if ((a - b) < epsilon) where epsilon small value. java library has more appropriate, idea. if insterested in theory, standard floating point operations

java - getX() & getY() MotionListener -

im searching coordinates x/y chessboard contain cases ! use system.out.println it's not method... need these data method getx() , gety() ! column: a-h row: 1-8 im searching since 3 hours..... import java.awt.color; import java.awt.container; import java.awt.dimension; import java.awt.eventqueue; import java.awt.gridlayout; import java.awt.event.actionevent; import java.awt.event.mouseadapter; import java.awt.event.mouseevent; import javax.swing.jframe; import javax.swing.jpanel; public class coordboutons extends jframe { coordboutons() { super("gridlayout"); setdefaultcloseoperation(exit_on_close); container contenant = getcontentpane(); contenant.setlayout(new gridlayout(8, 8)); (int = 0; < 8; i++) { (int j = 0; j < 8; j++) { contenant.add(new caseechiquier(i, j)); } }

xts - Convert daily to weekly/monthly data with R -

Image
i have daily prices series on wide range of products; want convert new dataframe weekly or monthly data. i first used xts in order apply to.weekly function...which works ohlc format. sure there may exist function similar to.weekly dataframe format not ohlc. there different posts related following: does rollapply() allow array of results call function? or averaging daily data weekly data i using: length(bra) 1 2416 test<-bra[seq(1,2416,7),] would there more efficient approach? thanks. let's try data: library(zoo) tt <- seq(sys.date(), by='day', length=365) vals <- data.frame(a=runif(365), b=rnorm(365), c=1:365) z <- zoo(vals, tt) now define function extracts year , number of week (drop %y if don't need distinguish between years): week <- function(x)format(x, '%y.%w') you can use function aggregate zoo object mean (for example): aggregate(z, by=week, fun=mean) which produces result:

Please correct the following Python CGi program -

please correct following cgi program #!usr/bin/python print "content-type : text/html\n\n" print "<html><body><span>hello world</span></body></html>" what wrong above code? i getting 500 internal server error , working through command prompt. and please tell me why need keep 2 "\n" in statement print "content-type : text/html\n\n" i think first line should be #!/usr/bin/python and if doesn't work try #!/usr/bin/env python you have missed / before usr

jquery - internal server eroor 500 django when using simplejson.loads(request.raw_post_data) -

i'm trying receive json object jquery client when call simplejson.loads(request.raw_post_data) internal server error 500. server receives call since i'm getting callback fro server when simplejson.loads(request.raw_post_data) line commented. uncomment line error thrown. ajaxtest.html <!doctype html> <html> <head> <script src="//ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script> <script type="text/javascript"> $(document).ready(function() { $("#post").click(function(){ var test = new object(); test.name = "kalle"; test.pw = "kula"; $.ajax({ url: "ajaxtest/", type: 'post', datatype: 'json', data: {client_response: json.stringify(test), csrfmiddlewaretoken: '{{ csrf_token}}'}, success: functi

Reading a binary file on backwards using python -

i try read file backwards (from end begin). example below this, ask community - there more elegant solution question? import os, binascii chunk = 10 #read file blocks (big size) src_file_path = 'd:\\src\\python\\test\\main.zip' src_file_size = os.path.getsize(src_file_path) src_file = open(src_file_path, 'rb') #open in binary mode while src_file_size > 0: #read file last byte first :) if src_file_size > chunk: src_file.seek(src_file_size - chunk) byte_list = src_file.read(chunk) else: src_file.seek(0) byte_list = src_file.read(src_file_size) s = binascii.hexlify(byte_list) #convert '\xfb' -> 'fb' byte_list = [(chr(s[i]) + chr(s[i+1])) in range(0, len(s), 2)] #split, note below print(byte_list[::-1]) #output reverse list src_file_size = src_file_size - chunk src_file.close() #close file upd know opinion of experts - need pay attention newbie in python? there potential flaw in

python - How can I correct this rounding down function? -

how can correct rounding down function? def round_down(num, prec): uod = round(num, prec) if uod > num: return uod - 1/10^prec return uod it raises: typeerror: unsupported operand type(s) ^: 'float' , 'int'. ^ not mean think means. use ** instead. from python documentation : the ^ operator yields bitwise xor (exclusive or) of arguments, must plain or long integers. also, mgilson noted, 1/10 equal 0 in python 2.x, want use 1.0/10 instead: def round_down(num, prec): uod = round(num, prec) if uod > num: return uod - 1.0/10 ** prec return uod

iphone - Xcode wont allow 2 projects on my phone at a time.? -

i've been working on few apps , when run them on iphone, xcode let 1 app on phone @ time, , if load app in xcode, , try run it, kind of on writes first app instead of haveing 2 apps on. have done wrong or new xcode , ios6 stop piracy? no, apps have same bundle identifier. i'd check project settings make sure each app has unique bundle identifier.

c# - Nhibernate empty query -

i have next code if (user != null) query = query.where(item => item.user.id == user.id); else if (equipment != null) query = query.where(item => false);// todo: add logic equipment but nhibernate can't build expression tree item => false . someday expression change, must return empty query. there method solve problem? assuming iqueryable of user, try this. if (user != null) query = query.where(item => item.user.id == user.id); else if (equipment != null) query = new list<user>().asqueryable(); edit: op said iqueryover not iqueryiable, had @ source , queryover protected can't see how create empty 1 right now. suggestion use linq provider if can original answer work. if it's not possible ugly hack work now. if (user != null) query = query.where(item => item.user.id == user.id); else if (equipment != null) query = query.where(item => item.user.id < 0 && item.user.id

database - PL/SQL: How select data from table and input into package accepting array type? -

i have pl/sql email package looks like: create or replace package mail_pkg pragma serially_reusable; -- avoids ora-04068 error type array table of varchar2(255); procedure send( p_sender_email in varchar2, p_from in varchar2 default null, p_to in array default array(), p_cc in array default array(), p_bcc in array default array(), p_subject in varchar2 default null, p_body in clob default null); example usage be: begin mail_pkg.send( p_sender_email => 'tim@company1.com', p_from => 'john smith <johns@company2.com>', p_to => mail_pkg.array( 'greg@company3.com','sarah@company4.com'), p_cc => mail_pkg.array( 'admin@company5.com' ), p_bcc => mail_pkg.array( 'sue@company5.com' ), p_subject => 'this subjec

ruby - Create administration area in Rails app -

i'm creating blog rails , first thing i've done administration area (by thing have in application). i've used bootstrap design pages , devise authentication. for models, views , controllers used scaffolding , generated both admin , post models. the problem have create real blog , access administration panel using /admin route. example, create new post should access http:/mysite/admin/posts/new . another problem have totally different design in public blog page (not bootstrap) , of course i'll have different controllers, views , routes. so, can done? i suggest removing admin model in case seems more namespace model. instead create :admin namespace in routes.rb file like: namespace :admin resources :posts end this cause routes inside of block prefixed w/ admin . url editing post on admin side admin/posts/:id/edit . next suggest making admincontroller of admin controllers inherit from. way can specify new layout. can create admin::post

ios - UICollectionView only calling didSelectItemAtIndexPath if user double taps, will not call when user single taps -

i have uicollectionview size of screen. uicollectionviewcells displays same size collectionview. each cell has uiimage size of cell. collectionview has paging enabled full screen photo slideshow user can swipe through. the problem that -(void)collectionview:(uicollectionview *)collectionview didselectitematindexpath:(nsindexpath *)indexpath being called if user taps 2 fingers on cell or long presses 1 finger , releases. not seem have default behaviour of single tap selection. have not made changes collectionview gesture recognizer having trouble finding solution problem. are sure you're not accidentally overriding - (void)collectionview:(uicollectionview *)collectionview diddeselectitematindexpath:(nsindexpath *)indexpath ? "select" vs. "deselect" has tripped me in past xcode's code completion.

animation - How to limit x-axis of 3D animated mesh in MATLAB -

i have animated 3d mesh of sine wave, want limit axis specific ranges. here piece code: [x,t] = meshgrid(x,t); j=1; while 1 j=j+1; y = a*sind(2*pi*f*(j/100+(x*t)/wl)); mesh(y); f(j) = getframe; end movie(f); the values of variables a,f,t , wl predefined user i want limit x-axis 10 20, can show me how it? call xlim after draw mesh. xlim([10 20])

ruby on rails - Limit create action to 1 post per user -

i want make user have 1 matriculation per user. error "undefined method `matriculations' nil:nilclass". how make work? (i use devise user auth if matter). def matriculation_limit if self.user.matriculations(:reload).count <= 1 errors.add(:base, "yuo have 1 matriculation form") else redirect_to new_matriculation_path end end with has_one association, association finder method singular @user.matriculation , not @user.matriculations . , there's no point counting them because there one. regarding comment: you don't need check anywhere how many matriculations user has, because it's singular association, you'll updating association (changing id in foreign key column matriculation_id in users table) class user < activerecord::base has_one :matriculation, :class_name => "user", :foreign_key => "matriculation_id" end class matriculation < activerecord::base belongs_to :user en

c# - AllowAutoRedirect in windowsPhone -

in httpclienthandler have propertie allowautoredirect, on build app windowsphone throw exception: httpclienthandler.allowautoredirect not supported on platform. please check httpclienthandler.supportsredirectconfiguration before using httpclienthandler.allowautoredirect. i want prevent autoredirect. tried use httpwebrequest: var client = (httpwebrequest) webrequest.create(connectionurl); client.headers["allowautoredirect"] = "false"; client.method = "get"; client.headers["useragent"] = @"mozilla/5.0 (windows nt 6.2; wow64) applewebkit/537.31 (khtml, gecko) chrome/26.0.1410.43 safari/537.31"; client.contenttype = "application/json"; client.headers["contentlength"] = client.tostring().length.tostring(); client.begingetresponse(callback, client); private void callback(iasyncresult ar) { var requeststate =(httpwebrequest) ar.asyncstate; using (var poststream = requeststate.endgetrequeststream(ar)) {} } t

ios - Save file with bulk action in to document directory -

i trying save files in document directory, in bulk action , using method: nsurl *url = [nsurl urlwithstring:@"http://www.mywebsite.com/storage/image.png"]; nsdata *data = [nsdata datawithcontentsofurl:url]; nsstring *documentspath = nssearchpathfordirectoriesindomains(nsdocumentdirectory, nsuserdomainmask, yes)[0]; nsstring *downloadfolder = [documentspath stringbyappendingpathcomponent:@"image.png"]; [data writetofile:downloadfolder atomically:true]; this working well, single file, copy in same times files in storage folder in document directory. does know how can that? thanks. if want save image bulk in document directory. you can use nsuserdefaults hold last image index, , increment index 1 when store new image, try this. nsurl *url = [nsurl urlwithstring:@"http://www.mywebsite.com/storage/image.png"]; nsdata *data = [nsdata datawithcontentsofurl:url]; nsstring *documentspath = nssearchpathfordirectoriesindomains(nsdocumentdirect

sql server - VB.NET database data passing error -

i error message "error while inserting record o table… incorrect syntax near keyword ‘return’.incorrect syntax near ‘,’ ." public class form10 dim con new sqlclient.sqlconnection dim cmd, com new sqlclient.sqlcommand dim sqlda new sqlclient.sqldataadapter dim ds new dataset private sub form10_load(byval sender system.object, byval e system.eventargs) handles mybase.load try con.connectionstring = "data source=.\sqlexpress;initial catalog =pharmacy;integrated security =true" catch ex exception messagebox.show(ex.message, "connection error", messageboxbuttons.retrycancel, messageboxicon.error) end try end sub private sub btnclear_click(byval sender system.object, byval e system.eventargs) handles btnclear.click txtdcode.text = "" txtrinvo.text = "" txtcreg.text = "" txtprice.text = "" txtqt

php - Creating a Dynamic Array and returning array from with-in a function -

i'm trying write function selects contents database. problem have lack of understanding of arrays , returning variables functions. i've written function seem going round in circles how build array , return function.php. main php file. (labels , names have been changed protect innocent.) <?php //include '../sb_mysqli_connect.php';//connect database include 'functions.php' ; //include functions list $username = 'foo'; $password = 'bar'; $fields = array( array('username', $username), array('password', $password)); //prep's array multiple statements sbpolldb ("users",$fields, null, 1, null); //function sbpolldb($sbbeta, $sbbecon, $sbbeorder, $sbbelimit, $sbbegroup) echo $tablex['row_name_y']; ?> the function.php file <?php function sbpolldb($sbbeta, $sbbecon, $sbbeorder, $sbbelimit, $sbbegroup){ //sbbeta = table name, sbbecon = condition, sbbeval = value, sbbesort = sort valu

ruby on rails - RSpec suite performance difference -

i've got interesting problem that's causing myself , team lot of headaches when comes running our spec suite. our spec suite broken following sub-folders, , next them total execution time completion: rspec spec/acceptance 311.67s rspec spec/controllers 18.97s rspec spec/decorators 4.39s rspec spec/helpers 9.45s rspec spec/lib 16.88s rspec spec/mailers 5.27s rspec spec/models 121.05s rspec spec/presenters 0.03s rspec spec/workers 19.3s total run time: 8m 27s which improved, in pretty managable. however, if, run rspec spec , run entire suite @ once, total time complete 27m 11s ! so, doing dramatically affecting performance of entire suite when run @ once. i'm hoping can pointers can begin try troubleshoot problem. if helps, i've posted spec_helper.rb file here thanks in advance, joe at guess, i'd integration specs setting databasecleaner :truncation , it's not getting switched :tran

javascript - Wordpress hover over link and several elements change -

this wordpress home page has following html content section (the middle section 3 columns of divs) http://goodsense.etempa.co.uk <div class="seewidgets">[widgets_on_pages id="home page middle box"]</div> <div class="top-area"> <div class="image"> <img alt="primary care" src="/wp-content/uploads/scenarios/primary_care.png" /> </div> <div id="contact_box" class="home_side_box"> <div class="clients"> <img alt="contact us" src="/wp-content/uploads/buttons/contact_button.png" /> </div> </div> <div class="home_side_box home_side_box_gap"> <div class="home_side_box_heading">social media</div> //social media stuff </div> <div class="home_side_box home_side_box_gap&quo

CakePHP Form Dropdown -

i've got table in database outputs this: array( (int) 0 => array( 'price' => array( 'id' => '1', 'amount' => '20', 'price' => '180.00', 'type_id' => '1', 'active' => 'a' ) ), (int) 1 => array( 'price' => array( 'id' => '2', 'amount' => '30', 'price' => '232.50', 'type_id' => '1', 'active' => 'a' ) ), ...and on. i need drop down in form displays amount , price (ie. "20 @ 180.00"), when selected, gets "id" field. i reworked new array called $prices outputs so... array( (int) 0 => array( 'id' => '1', 'amount' => '20', 'price' => '180.00', 'type_id' => '

unit testing - How do I correctly instantiate a new controller when using Ninject? -

i created demo web api application utilizes ninject. application works fine can run it, navigate defined route, , data i'm expecting. want begin adding unit tests test apicontroller. how instantiate new apicontroller? i'm using var sut = new dogscontroller(); results in error, "... not contain constructor take 0 arguments". it's correct don't have constructor takes 0 arguments ninject should taking care of me, correct? how resolve this? you have wired ninject web api application, not unit test project. result, ninject not creating dependencies controller, or controller explicitly creating (in web api application, framework creates controller). you wire ninject unit test project, not correct thing do. should creating controller in tests known state, should either passing in known dependencies, or passing in form of mock dependencies.

java - Loop Through List of Objects in JSP and Submit One of Them -

i have list of products, , want iterate through each in jsp, , have user choose one. once chosen, want submit 1 individual product object model attribute, spring controller. basically, want this. getting 400 error. attempting possible? <form:form method="post" modelattribute="listproduct"> <c:foreach items="${listproduct}" var="prd"> <tr > <td><c:out value="${prd.description}"/></td> <td><c:out value="${prd.productid}"/></td> <td><form:input type="hidden" path="prd" readonly="true"/></td> <td><input type="submit" value="select" /></td> </tr> </c:foreach> </form:form> if using struts2 form variable itera

ubuntu - HipHop-Php VM and auto_prepend -

does know if possible include auto_prepend file hiphop hhvm (latest version)? i don't see in options or documentation feature. no, there no way this. i've love pull request though :)

firebug - Dojo dijit.form.Select corrupting european characters in Firefox -

i have dropdown defined dojotype="dijit.form.select" id="mydropdown" i load json array follows dojo.xhrget({ url: "getoptions", handleas: "json", preventcache : true, timeout : 50000, load : function(data, ioargs) { var options = data.options; mystore.data = options dijit.byid("mydropdown").setstore("mystore") ... where mystore = new dojo.data.itemfilereadstore({}) here json comes server: {"options":{"items":[...,{"name":"crédit","id":57},...]}} when mydropdown rendered in firefox character é becomes �. works fine in ie9 , chrome 26. what strange same character rendered correctly in firefox dojox.grid.datagrid. also if load json directly firefox putting getoptions address, json showing correct characters. when check result of dojo.xhrget() in firebug see same

django memory leak during offline database insertion -

i have following problem when inserting database data during offline process (using management script): from foo.models import bar in links: bar.objects.create() given links has large number of entries. process takes more , more memory during loop. check settings.debug not true

ember.js dynamic route issue -

i have app.user , app.contact models identical , inherit a base class: app.person = ds.model.extend({ firstname: ds.attr('string'), surname: ds.attr('string'), email: ds.attr('string'), fullname: function(){ return this.get('firstname') + " " + this.get('surname'); }.property('firstname', 'surname'), }); app.contact = app.person.extend({ }); app.user = app.person.extend({ }); i want somehow pass these objects new route allow me email them automatically. have mail object references person polymorphic relationship: app.mail = ds.model.extend({ recipients: ds.hasmany('app.person', {polymorphic: true}), }); the problem have shown in fiddle here . for reason model not getting set in app.mailpersonroute route , mystified why. because router has nested routes: app.router.map(function() { this.resource('mail', function(){ this.route('

Compiling via C/C++ and compiler bugs/limits -

i'm looking @ possibility of implementing high-level (lisp-like) language compiling via c (or possibly c++ if exceptions turn out useful enough); strategy number of projects have used. of course, generate c code unlike, , perhaps in dimensions exceeding complexity of, write hand. modern c compilers highly reliable in normal usage, it's hard know bugs might lurking in edge cases under unusual stresses, particularly if go on "well no programmer ever write x bigger y" hidden limit. it occurs me coincidence of these facts might lead unhappiness. are there known cases, or there way find cases, of generated code tripping on edge case bugs/limits in reasonably recent versions of major compilers (e.g. gcc, microsoft c++, clang)? this may not quite answer looking for, quite few years ago, worked on project, parts of system written in higher level language, easy build state machines in processes. language produced c-code compiled. compiler using project gcc

sql server - Fuzzy grouping in SQL -

i need modify sql table group mismatched names, , assign elements in group standardized name. for instance, if initial table looks this: name -------- jon q john q jonn q mary w marie w matt h i create new table or add field existing 1 this: name | stdname -------------------- jon q | jon q john q | jon q jonn q | jon q mary w | mary w marie w | mary w matt h | matt h in case, i've chosen first name assign "standardized name," don't care 1 chosen -- final "standardized name" hashed unique person id. (i'm open alternative solutions go directly numerical id.) have birthdates match on well, accuracy of name matching doesn't need precise in practice. i've looked bit , use jaro-winkler algorithm (see e.g. here ). if knew names in pairs, relatively easy query, there can arbitrary number of same name. i can conceptualize how query in procedural language, i'm not familiar sql. unfortunately don't have direct acce

asp.net - Center non text within a table -

i trying figure out way center "rating" within table, can figure out how align text , images can not figure out how align rating, since technically not text or image. the code looks below <td align="center" style="text-align: center; vertical-align: middle; background-color: #444444;" valign="top"> <cc2:dnnrating id="productreviewaverageoverallratingdnnrating" runat="server" readonly="true" value='<%# eval("productreviewaverageoverallratingdnnrating_value") %>' visible='<%# convert.toboolean(eval("productreviewaverageoverallratingdnnrating_visible")) %>'> </cc2:dnnrating>      ... assume go somewhere within first line. can see text-align there , vertical-align etc... not work. <td align="center" style="text-align: center; vertical-align

objective c - Cocos2D: Multiple actions: CCMoveTo CCAnimate -

i don´t understand, absolutely cannot work, want sequence of actions plays animation , moves sprite using ccanimate ans ccmoveto classes. there bug or special these classes, cause not move nor animate when stringing in ccsequence of actions this. action = [ccsequence actions: [ccmoveto actionwithduration:moveduration position:touchlocation], [ccanimate actionwithanimation:self.walkinganim], [cccallfunc actionwithtarget:self selector:@selector(objectmoveended)], nil]; [self runaction:action]; i if want move , animate action run paralel can use: option1 : use ccspawn instead of ccsequence. ccsequence needed because call function after completion. id action = [ccspawn actions: [ccmoveto actionwithduration:moveduration position:touchlocation], [ccanimate actionwithanimation:self.walkinganim],

sql - Finding Count of Duplicate emails that has a different first and/or last name -

hi i'm having trouble getting right count problem. i'm trying count of duplicate email has different first name and/or different last name. (i.e 123@.com sam 123@.com ben need count of duplicate email) i'm working 2 tables. email_address in mrtcustomer.customer_email table , first , last name in mrtcustomer.customer_master table my code select count(*) (select e.customer_master_id, email_address, customer_first_name, customer_last_name, row_number() on (partition email_address order customer_first_name) rn mrtcustomer.customer_email e join mrtcustomer.customer_master t on e.customer_master_id = t.customer_master_id t.customer_first_name not null , t.customer_last_name not null , customer_first_name != 'unknown' , customer_last_name != 'unknown' group e.customer_master_id, email_address, customer_first_name, customer_last_name order 1 desc) rn > 1 i'm guessing clause wrong. i start this: (edited reflect edits) select email

android - Listview item click issue -

i have added leadbolt ad(entry ad). advertising works correctly listview.click doesn't work when close ad close sign. (listview.click not anything, works when remove adcontroller) public class soundlist extends listactivity { int [] soundfile; mediaplayer mediaplayer; private adcontroller mycontroller; final activity act = this; @override public void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); mycontroller = new adcontroller(act, "111111111"); mycontroller.loadad(); soundfile= new int[] {r.raw.sound1,r.raw.sound2.....}; string[] sounds= getresources().getstringarray(r.array.sounds); // binding array listadapter this.setlistadapter(new arrayadapter<string>(this, r.layout.list_item, r.id.label, sounds)); listview lv = getlistview(); lv.setdescendantfocusability(listview.focus_block_descendants); // listening single list item on click lv.setonitemclicklistener(new onitemc

javascript - how to use a json function for filling combo box with database? -

i new @ html , trying relation between database.and want fill box database i have code <div class="content" data-role="content" id="content" > <div id="car"> <select name="selectcar" class="span12" id="options" > <option value="-1">bir istasyon seçiniz.</option> <option value="1">mimarlık</option> <option value="2">yurtlar</option> <option value="3">bilgisayar mühendisliği</option> <option value="4">kimya mühendisliği</option> <option value="5">rektörlük</option> </select> </div> <div id="cinfo"></div> <button onclick="javascript:callcarinfo.call(this,document.getelementbyid('

asp.net - Toggling checkboxlist item using Javascript -

i have checkboxlist 2 items. having hard time toggling between 2 checkboxlist items using javascript. click on 1 , if other checked, check mark should go away. following markup checkboxlist. <asp:checkboxlist id="chkapplylimits" runat="server" repeatcolumns="2" clientidmode="static" onclick="checkboxtoggle"> <asp:listitem text="yes" value="1"></asp:listitem> <asp:listitem text="no" value="0"></asp:listitem> </asp:checkboxlist> i using following javascript function enable toggle. in javascript, getting child elements of parent , looping through them set checked property false of child elements. finally, making checked property of item clicked true. function checkboxtoggle(event) { if (event.srcelement.type == 'checkbox') { var childnodes = event.srcelement.parentnode.childnodes; (var = 0; < childnodes.length; i++

mongodb - Matching Rules w/ Mongo -

i trying compare objects collection of rules stored in mongo. here example of object , 2 rules: object: { "color": "red" ,"make": "ford" ,"type": "sedan" } rules: [0]{ "color": "red" ,"type": "suv" } [1]{ "make": "ford" } in example, rule 1 should match. have played around different operators ($exists, $or, $and) have had no luck making results match solution working on. great. thanks! i didn't have trouble matching 1 of rules using $or operator: > db.obj.insert({ "color": "red" ,"make": "ford" ,"type": "sedan" }) inserted 1 record(s) in 17ms > db.obj.find({$or:[{color:"red", "type":"suv"}, {make:"ford"}]}) { "_id" : objectid("518ac9be6c49c38046ac4b19"), "color" : "red", &q

apache - .htaccess redirection failure for certain paths -

i have come accross particularly vexing problem .htaccess file. using standard redirection running requests through index.php so: <ifmodule mod_rewrite.c> rewriteengine on rewritebase / #make direct requests /index.php go example.com/ instead rewritecond %{the_request} ^.*/index.php rewriterule ^(.*)index.php$ /$1 [r=301,l] #redirect index.php url parsing , routing rewriterule ^(.*)$ index.php?url=$1 [l,qsa] </ifmodule> is there reason url such as: www.example.com/error/view/404 would bypass redirection , default apache "access denied" or "object not exist" errors? there sort of fix or path apache doesn't allow reason?

rstudio - R fails to start after moving Rprofile -

i'm using r on mac. tried moving rprofile file different location, r didnt start. when tried put rprofile file original location, couldn't remember folder came from. my rprofile file located somewhere in /library/frameworks/r.framework/... now r (and rstudio) fail start, , r gives error message: error: package 'grdevices' not have namespace *** caught segfault *** address 0xa8000000, cause 'memory not mapped' possible actions: 1: abort (with core dump, if enabled) 2: normal r exit 3: exit r without saving workspace 4: exit r saving workspace rstudio gives message: the r session had fatal error. error r error 4 (r code execution error) [errormsg=error : package 'utils' not have namespace ]; occurred at: core::error r::exec::evaluatestring(const std::string &, sexp *, sexp::protect *) /users/rstudio/rstudio/src/cpp/r/rexec.cpp:255 i'm assuming r cannot find rprofile file. how can r (and rstudio) start again? i go exact

ios - Can't add a nil AVCaptureInput -

i have beta tester getting error when trying start video session on our ipad app using opentok ios webrtc sdk. app crashes every time. user on ipad 2 ios 6.1.3. have clue causing such error? best guess involving camera access, i'm @ loss be. i think can prevent crash checking availability of avcaptureinput object before add avcapturesession. to simplify check below code: if ([session canaddinput: backcameradeviceinput]) { [session addinput: backcameradeviceinput]; } i wish helpful :)

c++ - when directly sum up every individual element in a string to int, what is the value represent? -

like when when s = "wendy", got 551. what's that? for(size_t = 0; < s.length(); i++) { sum += s.at(i); } it's sum of ascii values in string. each character corresponds numerical value between 32 , 127 (ignoring wide characters , unicode stuff since that's complicated). if want more information, try looking "ascii".

javascript - fullcalendar - disabling highlight on days during event dragging -

i drag & drop events other dates. my events can dropped days later today. my events cannot dropped dates before today. currently when dragging event, calendar's cells below drag being highlighted. disable highlight days(cells) before today (per point #2) any idea how disable highlight? hi :) needed highlight cell whenever mouse on , way did this: ( kind of hacky :p ) works: goto fullcalendar.js , go function buildtable(shownumbers) , on line 2323 ( @ least in calendar, btw i´m using latest version 1.6 ) edit line: "<div class='cellarea' >"; //this div doesnt have class put class there "cellarea" if (shownumbers) { after went css , made this: .cellarea:hover{ border-color: #cccccc !important; cursor: pointer; background-color: #cccccc; } so point can define color want on cell hover, if define color of html body background color make invisible :). hope works let me know after try.

php - laravel Redirect::to() loses the port -

i'm running development environment through vagrant (ubuntu, nginx, php-fpm) , accessing server on localhost:8080. i'm using laravel 4 , trying set authentication system. seems laravel ignores port using if using alternative port. true? example, when run redirect http://localhost:8080/login /profile end on http://localhost/profile . have suggestions on how can fix/patch this? this smells bug. stuck digging in urlgenerator when looks request->root() . can see there no root() function on symfony\component\httpfoundation\request . try replacing ->root() ->getbaseurl() instead. regardless of outcome, should prepare small test case (with little excess code possible) , report issue on github fixed. if can find solution while you're @ pull request can made fix issue.