Posts

Showing posts from March, 2015

How can I make a pure assembly project in Visual Studio? -

how can make masm project in visual studio? remember doing in class while back, i've since forgotten, , google getting me inline assembly. start win32 console mode project template. delete .cpp files. right-click project in solution explorer window, custom build rules, check microsoft macro assembler. in vs2015 use build dependencies, build customizations, check masm. add new .asm file right-clicking source files node, add, code, c++ file, sure use .asm extension. in property window change file type c/c++ code gets passed linker. linker settings, manifest file, generate = no. these settings build , debug sample .asm file: .486 .model flat .code start: ret end start

javascript - How to show processing animation / spinner during ajax request? -

i want basic spinner or processing animation while ajax post processing. i'm using jquery , python. looked @ documentation can't figure out put ajaxstart , ajaxstop functions. here js: <script type="text/javascript"> $(function() { $('.error').hide(); $("#checkin-button").click(function() { var mid = $("input#mid").val(); var message = $("textarea#message").val(); var facebook = $('input#facebook').is(':checked'); var name = $("input#name").val(); var bgg_id = $("input#bgg-id").val(); var thumbnail = $("input#thumbnail").val(); var datastring = 'mid='+mid+'&message='+message+'&facebook='+facebook+'&name='+name+'&bgg_id='+bgg_id+'&thumbnail='+thumbnail; $.ajax({ type: "post...

javascript - Open infoWindow of specific marker from outside Google Maps (V3) -

i can't seem head around problem: i've got map (a lot of) markers (companies) come generated xml file. below map, want show (non-javascript-generated) list of companies displayed on map. when click company in list, map pan specific marker , open infowindow. thing want map , list 2 separate things... what right way tackle problem? thanks! important markerinfo dynamic... function initialize_member_map(lang) { var map = new google.maps.map(document.getelementbyid("large-map-canvas"), { center: new google.maps.latlng(50.85034, 4.35171), zoom: 13, maptypeid: 'roadmap' }); var infowindow = new google.maps.infowindow; downloadurl("/ajax/member-xml-output.php", function(data) { var xml = data.responsexml; var markers = xml.documentelement.getelementsbytagname("marker"); var bounds = new google.maps.latlngbounds(); (var = 0; < markers.length; i++) { var company = markers[i].getattribute("company...

iphone - From view to child table view -

can start view based based app , when button touched jump "child view" navigationbar , button go main view? also...would violation of apple's store rules? sure - trick have navigation controller present, use setnavigationbarhidden:yes animated:no to make hidden in root view. in child views there pushing them normal use setnavigationbarhidden:no animated:yes in viewwillappear . (tweak animated property make way prefer) i don't think violates rules, have used in app visual main menu pushes child views , can pop them return visual main menu showing no navigation bar.

php - How do you turn on the cache in CakePHP? -

i using cakephp. have action in controller produces static content pages of app. want cache entire action/view. controller pages , action main. not seeing cached files view appear in tmp/cache folder. i have uncommented cache.check setting in core.php, reads: configure::write('cache.check', true); i have added cache helper pages controller: var $helpers = array('javascript','cache'); i have told controller cache action called "main": var $cacheaction = array('main/'=>86400); i have confirmed there other cache files (the model cache) in app/tmp/cache folder today, know isn't permissions issue. here top of pages controller: var $name = 'pages'; var $helpers = array('javascript','cache'); var $uses = array(); var $components = array('authentication','security'); var $cacheaction = array('main/'=>86400); i not sure missing enable cache of view in cachephp. missing som...

iphone - I add buttons on scrollview but buttons are not working -

i new in iphone.i added 10 buttons on scrollview.buttons scroll properly,but 5 buttons working last 5 buttons not working.please suggest me next. it sounds 1 of 2 things either ... there no associated actions buttons (programatically or in ib) there view covering buttons , taking touch events try swapping position of 2 of buttons (one working , 1 not) , see if continue work before. if do, looks actions not set up. if have changed, there issue buttons placed.

objective c - Uncrustify spacing issue with macro inside method call -

i attempting use uncrustify on project of mine, running issues spacing changes makes when macro used receiver of objective-c message. example, given following macro , method call, expect spacing remain is. #define nilornotnsnull(val) ({id __val = (val); (__val == [nsnull null]) ? nil : __val;}) title_ = [nilornotnsnull([dict objectforkey:@"post_title"]) copy]; however, result. #define nilornotnsnull(val) ({id __val = (val); (__val == [nsnull null]) ? nil : __val;}) title_ = [nilornotnsnull ([dict objectforkey:@"post_title"])copy]; it appears if uncrustify not recognize text in parentheses argument macro, i'm not sure heck thinks is. seems uncrustify bug me, issue config, figured i'd ask here filing issue on github. here config i'm using: https://gist.github.com/812314 if offer insight, i'd appreciate it. i don't exact output when run using config. version using? version output follows: macbook-adamd:~ adamd$ uncrustify ...

Running Prolog Sicstus through a shell file -

i've been trying run file through shell script , write output file. the script simple: /usr/local/sicstus4.1.1/bin/sicstus -l run --goal "runh('examples/calls_matlab.pl', s), halt." > "/users/andrew/dropbox/ip/modelling phase/rules.txt" however, when run this, fails following error: sicstus(24883,0x7fff70916ca0) malloc: * error object 0x10082b408: incorrect checksum freed object - object modified after being freed. * set breakpoint in malloc_error_break debug on other hand, if remove "halt" goal, everything's fine, sicstus still running. is there way exit sicstus, without having incur error above through shell script? i appreciate time. andreas what if run script , redirect input pipe /dev/null ? , remove halt option. /usr/local/sicstus4.1.1/bin/sicstus -l run --goal "runh('examples/calls_matlab.pl', s)." > "/users/andrew/dropbox/ip/modelling phase/rules.txt" < /dev/null ...

objective c - AudioServicesPlaySystemSound not playing sounds -

i playing small .wav file using audiotoolbox. audioservicesplaysystemsound (soundfileobject); but not playing. what reason? if you're in simulator, make sure in system prefrences → sound, "play user interface sound effects" not turned off. if you're on device, check ringer switch not set silent.

Rails - Why is my custom validation being triggered for only a build command -

i have sentence , correction model has_one , belongs_to relationship respectively. for reason when do def create @sentence = sentence.find(params[:sentence_id]) @correction = @sentence.build_correction(params[:correction]) a custom validation wrote correction being called @ build_correction point. validation below class correction < activerecord::base attr_accessible :text, :sentence_id, :user_id belongs_to :sentence belongs_to :user validate :correction_is_different_than_sentence def correction_is_different_than_sentence errors.add(:text, "can't same original sentence.") if (text == self.sentence.text) end the problem reason on validation correction object doesn't have sentence id set (despite used build_correction method) , complains "you have nil object .... while executing nil.text" in if clause in validation above. so question why validation occuring build command, thought triggers on crea...

hardware - How to change machines on a nlkvm-4 kvm swtich -

hi got hands on newlink nlkvm-4 4 port kvm switch came me without user manual. googled , found other kvm user guides not find newlink nlkvm-4 manual on line. have 2 machines hooked @ moment , have no idea how switch 1 other. has 1 let me know function key sequence switch , other function key sequences might helpful me. thanks i found reference hitting leftside ctrl twice followed number 1 4. ctrl ctrl 1 port 1 i'm guessing. i'd try using top row of numbers , number pad numbers. sound of it, you're not holding down control key.

sql - Question regarding efficient table usage in MySQL -

i want users in web app able sign different "events". each event has things describing such name, date of event, description, , people describing event. should create individual table each event? or should have event row/column in event table? in relational database create multiple tables, each 1 different aspect of event. have organiser table location table , events table in event table have id of organiser , id of location, , data event. 3 tables describe event more don't need repeat data. organiser may have multiple events, @ multiple locations. each organiser , location needs 1 entry (usually) in respective tables. dc

eclipse - Android Debug Bridge and Samsung Captivate -

i have tried installing samsung captivate drivers, adb not see them. have got google adb drivers in sdk directory everytime try install driver says windows think have best driver device. keeps mtb driver. have tried uninstalling mtb driver keeps coming back. trying debug bridge work samsung captivate. adb devices shows nothing. try use samsung kies. has samsung drivers in. you can find here : http://www.samsung.com/uk/support/main/supportmain.do works fine me samsung i5700 on win7 x64

linux - Can I get a faster output pipe than /dev/null? -

i running huge task [automated translation scripted perl + database etc.] run 2 weeks non-stop. while thinking how speed saw translator outputs (all translated sentences, info on way) stdout time. makes work visibly slower when output on console. i piped output /dev/null , thought "could there faster?" it's output it'd make difference. and that's question i'm asking you, because far know there nothing faster... (but i'm far being guru having used linux on daily basis last 3 years) output /dev/null implemented in kernel, pretty bloody fast. output pipe isn't problem now, it's time takes build strings getting sent /dev/null. recommend go through program , comment out (or guard if $be_verbose ) lines useless print statements. i'm pretty sure that'll give noticeable speedup.

apache2 - localhost not going to desired VirtualHost -

i have several virtalhosts set on computer. i'd visit site i'm working on different pc using comp's ip address, every config i've tried keeps taking me different virtual host (in fact first virtualhost set on comp). how set apache virtualhost configs ensure ip address takes me site want to. /etc/apache2/sites-available/site-i-want-to-show-up-with-ip-address.conf contains: <virtualhost *:80> serveradmin webmaster@localhost serveralias currentsite.com documentroot /path/to/root/of/site-i-want-to-show-up servername localhost scriptalias /awstats/ /usr/lib/cgi-bin/ customlog /var/log/apache2/current-site-access.log combined </virtualhost> and /etc/apache2/sites-available/site-that-keeps-showing-up.conf contains: <virtualhost *:80> serveradmin webmaster@localhost serveralias theothersite.com documentroot /path/to/it <directory /> options followsymlinks allowoverride none </directory> </vi...

About C++ STL list class method erase() -

the documentation of list::erase() says, "call destructor before", mean? if want erase(it) item , push_back(*it) item again, illegal since destructed already? yes, result in undefined behavior. once erase list iterator invalidate iterator, meaning object references no longer guaranteed valid. means if try use iterator in context, including trying dereference value add list again, result in undefined behavior, crash program, overwrite important memory, or nothing. if want move element of list back, consider using list's splice method: mylist.splice(mylist.end(), mylist, it); this moves element end without making copy.

sharepoint - Authenticated user cannot log in, "The user does not exist or is not unique." -

this weird one. have wss3 site, no moss, custom membership , role provider authenticates against crm. users have been added site user list once logged in have correct display names. on dev , stage works fine, on uat users can't past login screen. login screen working, in if type incorrect password user comes right message, meaning custom provider working fine. if fill login form in correctly redirected straight login screen, iis logs showing login screen sent authenticated user site , sent back. setting site allow anonymous access shows user not logged in on site side after authenticating correctly. the uls logs show: user not exist or not unique. found 1 trusted forests nzct.local. found 0 trusted domains adding logging code site have verified membership provider correctly set, , can find user when asked. also, when accessing site user list, can find sp user right name. it refuses set current user authenticated user. weird. have checked authentication p...

jquery - How to load file into javascript -

i have html table should updated according file user uploads. in other words, user able upload file, , change contents of table according file content. file size can several mb. options ? must upload file server, or can done in client side ? ! no, cannot manipulate files on client side. unless convince user turn off security application.

timezone - Better python datetime display? -

i'm using babel , pytz time zones. however, of america, maps not helpful in dropdown box: "america/new_york" displays "eastern time", "america/nipigon" displays "eastern time". is there way conversion add city info? other timezones seems okay, "asia/jakarta" converts "indonesia (jakarta) time" works me babel 0.9.5 , pytz 2010b. py.tz #!/usr/bin/env python import pytz import babel.dates tz = pytz.timezone('america/new_york') print babel.dates.get_timezone_location(tz) output $ python tz.py united states (new york) time how running it? versions? if stuck versions have, why not use continent/city entries? here's starting point you. determines both continent , city, can format want. tzs.py #!/usr/bin/env python import pytz import babel.dates import re country_timezones = {} (country, tzlist) in pytz.country_timezones.iteritems(): country_name = pytz.country_names[co...

php - Replacing tags in braces, even nested tags, with regex -

example preg_replace('/\{[a-za-z.,\(\)0-9]+\}/', 'replaced', 'lorem ipsum dolor sit {tag1({tag2()})}, consectetur adipiscing elit.'); the result: lorem ipsum dolor sit {tag1(replaced)}, consectetur adipiscing elit. question as can see "tag2" has been replaced, want replace "tag1" know how can this? (in cases might this: {tag1({tag2({tag3()})})}) , on.) btw using preg_replace_callback, easier show preg_replace here site can test code: http://www.spaweditor.com/scripts/regex/index.php you need add curly braces character set. here's pattern used: /\{[a-za-z.,\(\)\{\}0-9]+\}/ and here result: "lorem ipsum dolor sit replaced, consectetur adipiscing elit."

excel - excelsheet query -

dadasdf\sdasdasd\qazxbbjj\test.txt above string in cell a1 in excelsheet,i want extract last word cell.i.e,i want test.txt,how can acchive using excel function.if acchived declaring variable me out. its clunky w/ formula can vba. to module add; function getfilename(cell range) getfilename = mid(cell.value, 1 + instrrev(cell.value, "\")) end function then in cell can =getfilename(a1)

templates - Want to print out a list of items from another view django -

i have view displays list items. def edit_order(request, order_no): try: status_list = models.status.objects.all() order = models.order.objects.get(pk = order_no) if order.is_storage: items = models.storageitem.objects.filter(orderstoragelist__order__pk = order.pk) else: items = models.storageitem.objects.filter(orderservicelist__order__pk = order.pk) except: return httpresponsenotfound() i want put these list of item in view. unfortunately proving trickier thought. @login_required def client_items(request, client_id = 0): client = none items = none try: client = models.client.objects.get(pk = client_id) items = client.storageitem_set.all() item_list = models.storageitem.objects.filter(orderstoragelist__order__pk = order.pk) except: return httpresponse(reverse(return_clients)) return render_to_response('items.html', {'items':items, 'client':client, 'item_list...

php - ldap_add error too vague -

i using php-ldap manage posix accounts on linux machine. able search database in php. , able add users via command line "ldapadd". however, when try add user via php ldap_add, "object class violation" error (errno 65). i have tried can think of, error has not changed. have looked see if there alternative php-ldap, have not found one. the problem when error in general ldap guide, says "this error returned entry added or entry modified violates object class schema rules. additional information returned error detailing violation." , lists 8 possible causes. i need more in depth error, cannot find it. ldap_error no help. ideas how dig deaper here? i figured out how dig deeper. using ubuntu dumping logs /var/log/{debug,syslog} in order more info had increase log level 424 in /etc/ldap/slapd.d/cn=config.ldif then able see error in logs told me doing wrong... using dc attribute inetorgperson objectclass. thanks.

html - CSS: my side bar overflow the container div's border when I set it's height to 100% -

my side bar overflow container div's border when set it's height 100%, know if there way can have it's height 100% minus px. here source: <div id="main"> <br /><br /> <div class="content"> <div id="sidecontent"> <h1 id="title">title</h1> ***** </div> <div id="sidebar"> <div class="sidebox"> **** </div> </div> </div> <div class="bottom"></div> </div> #main { position: relative; background:transparent url('/public/images/main_bg.png') top left repeat-y; padding:37px 37px 37px 37px; margin-left: auto ; margin-right: auto ; width:940px; min-height: 363px; } #main div.top, #main div.bottom { height:70px; width:1015px; ...

php - how do i get the 1st day of week from current date -

i 1st date of week? ie. if 2011-01-01 2011-01-01 if 2011-01-06 2011-01-01 if 2011-01-20 2011-01-14 if 2011-01-21 2011-01-21 sorry misleading , making question confusion. i want date of 1st day of week, ie. either 1 or 7 or 14 or 21 or 28 by far straight-forward way subtract number of day of week (0 = sunday 'w' , 1 = monday 'n' ) in days date: $date = strtotime('2011-02-09'); $sunday = strtotime('-' . date('w', $date) . ' days', $date); $monday = strtotime('-' . (date('n', $date) - 1) . ' days', $date);

interface - WCF Service and Properties -

here question, have solution 4 projects in wcf service : dll library : service interface. dll library : service code. form application : service hosting application. form application : service client application. i'd have properties of service accessible hosting application not client one. if declare property in client interface both have access it. in fact, service manage user identity login , keep list of user logged in. i'd able show list in hosting application, debugging tool. don't want service client able access list. how can ? thank in advance. you can put put code "2" (service code). since share interface client not exposed. also, if logic (authentication , authorization) "hosting app" specific maybe should in hosting app rather service code.

MySql Full text or Sphinx or Lucene or anything else? -

i using mysql , have few tables need perform boolean search on. given fact tables innodb type, found out 1 of better ways use sphinx or lucene. have doubt in using these, queries of following format, select count(*) cnt, date_format(convert_tz(wrdtrk.createdongmtdate,'+00:00',:zone),'%y-%m-%d') dat t_twitter_tracking wrdtrk wrdtrk.word (:word) , wrdtrk.createdongmtdate between :stdate , :enddate group dat; the queries have date field needs converted timezone of logged in user , field used group by. now if migrate sphinx/lucene able result similar query above. beginner in sphinx, of these 2 should use or there better. actually groupby , search ' wrdtrk.word (:word)' major part of query , need move boolean search enhance user experience. database has approximately 23652826 rows , db innodb based , mysql full text search doesnt work. regards roh yes. sphinx can this. don't know like (:word) does, can query @word "exactword"...

.net - Does -eq keyword in power shell test reference equality or use Object.Equals() -

does "-eq" in powershell test reference equality (like "==" in c#) or equivalent of calling object.equals() the test on equality not simple. consider 'a' -eq 'a' returns true. means powershell more call equals. further objects equals called expected. add-type -typedefinition @" using system; public class x { public string property; public x(string s) { property = s; } public override bool equals(object o) { system.console.writeline("equals on {0}", property); return property == ((x)o).property; } public override int gethashcode() { return 20; } } "@ $o1 = new-object x 'a' $o2 = new-object x 'a' $o1 -eq $o2 besides powershell uses conversion quite heavily. if operands not of same type, right operand converted type of left operand. that's why '1' -eq 1 succeeds.

ruby - Rspec not working, or raise not raising? -

i'm working on learning tdd while writing small ruby programs. have following class: class mydirectory def check(dir_name) unless file.directory?(dir_name) raise runtimeerror, "#{dir_name} not directory" end end end and i'm trying test rspec test. describe mydirectory "should error if doesn't exist" 1 = mydirectory.new one.check("donee").should raise_exception(runtimeerror, "donee not directory") end end it never works, , don't understand wrong rspec output. failures: 1) mydirectory should error if doesn't exist failure/error: one.check("donee").should raise_error(runtimeerror, "donee not directory") runtimeerror: donee not directory # ./lib/directory.rb:4:in `check' # ./spec/directory_spec.rb:9:in `block (2 levels) in <top (required)>' i'm hoping simple i'm missing, i'm not seeing it. if checkin...

android - Driving a service API from a BroadcastReceiver -

i error message when attempt bind onreceive() of receiver local service before drive bespoke api on it. "intentreceiver components not allowed bind services" what best way of getting piece of data service while in broadcast reciever. many thanks. p.s. need answer synchronously i.e. have wait on answer service callback may not possible. what best way of getting piece of data service while in broadcast reciever. if broadcastreceiver created else (e.g., activity) , set registerreceiver() , "something else" should binding service , doing work. if broadcastreceiver component registered in manifest, need rethink approach whatever problem trying solve. these sorts of broadcastreceivers cannot bind services , cannot spend time doing work. if broadcastreceiver cannot work in less than, say, 10ms, should delegate control service via startservice() . service can work on background thread. p.s. need answer synchronously i.e. have wait on an...

iphone - Why is my NSURLConnection so slow? -

i have setup nsurlconnection using guidelines in using nsurlconnection mac os x reference library, creating nsmutableurlrequest post php script custom body upload 20 mb of data (see code below). note post body (line breaks , all) match existing desktop implementation. when run in iphone simulator, post successful, takes order of magnitude longer if run equivalent code locally on mac in c++ (20 minutes vs. 20 seconds, respectively). any ideas why difference dramatic? understand simulator give different results actual device, expect @ least similar results. thanks const nsuinteger kdatasizepost = 20971520; const nsstring* kuploadurl = @"http://www.someurl.com/php/test/upload.php"; const nsstring* kuploadfilename = @"test.data"; const nsstring* kusername = @"testuser"; const nsstring* khostname = @"testhost"; srandom(time(null)); nsmutabledata *uniquedata = [[nsmutabledata alloc] initwithcapacity:kdatasizepost]; (unsigned int = 0 ; ...

c# - Remove HTTP headers from a raw response -

let's make request url , raw response, this: http/1.1 200 ok date: wed, 28 apr 2010 14:39:13 gmt expires: -1 cache-control: private, max-age=0 content-type: text/html; charset=iso-8859-1 set-cookie: pref=id=e2bca72563dfffcc:tm=1272465553:lm=1272465553:s=zn2zv8oxlfpt1bjg; expires=fri, 27-apr-2012 14:39:13 gmt; path=/; domain=.google.co.uk server: gws x-xss-protection: 1; mode=block connection: close <!doctype html><html><head>...</head><body>...</body></html> what best way remove http headers response in c#? regexes? parsing kind of httpresponse object , using body? edit: i'm using socks make request; that's why raw response. headers , body separated empty line. easier without re. search first empty line.

SQL Server 2008 R2 RTM on MSDN? -

sql server 2008 r2 has supposedly been released manufacturing. know when it's supposed show on msdn? i asked msdn concierge, , said available in may, said didn't have fixed date yet. i'm not sure why delay, didn't clarify when pressed her. sorry don't have date - maybe closer site can out. update: kept pressing, , said she'd expect may 3rd, wasn't official, we'll see happens. i'm anxious try out rtm, i'm checking every day well.

php - how to return multiple array items using json/jquery -

hey guys, quick question, have query return multiple results database, while know how return 1 result, not sure how return multiple in jquery. want take each of returned results , run them through prepare function. have been trying use 'for' handle array of data don't think can work since returning different array values. if has suggestions, appreciate it. jquery retrieval success: function(json) { for(i=0; < json.rows; i++) { $('#users_online').append(online_users(json[i])); $('#online_list-' + count2).fadein(1500); } } php processing $qryuserscount1="select active_users.username,count(scrusersonline.id) rows scrusersonline left join active_users on scrusersonline.id=active_users.id topic_id='$topic_id'"; $userscount1=mysql_query($qryuserscount1); while ($row = mysql_fetch_array($userscount1)) { $onlineuser= $row['username']; $rows=$row['rows']; if ($username==$onlineuse...

iphone - UIButton grid activate same time dragging -

i have grid of various uibuttons (5 x 5)... have uicontroleventtouchupinside.. means when user wants choose various buttons need press each, 1 one... how can activate buttons when user dragging finger on various buttons. here code use: for (i = 0; < num_caselles; i++) { lletra = [[uibutton alloc] initwithframe:cgrectmake(pos_h, pos_v, mida_boto, mida_boto)]; [botones addobject: lletra]; [lletra settitle: [caselles objectatindex: i] forstate: uicontrolstatenormal]; lletra.tag = i; [lletra addtarget:self action:@selector(lletrapitjada:) forcontrolevents: uicontroleventtouchupinside]; } you can react to: uicontroleventtouchdragenter or uicontroleventtouchdragexit to handle these cases.

c# - How to get common library to read App.config of current executable -

i have common library , 2 executables. each executable refers common library functionality. common library read app.config of exe running. is there specific api calls this? you may take @ configurationmanager class: var somevalue = configurationmanager.appsettings["somekey"]; would read appsettings section of app.config/web.config of executing process.

c# - Is there a way to automate MS Office applications without license? -

i writing application perform automation in excel. have ms office (2007) installed on work computer , application working fine referencing the microsoft excel 12.0 object lirary. the target machine has office installed not registered. 1 of preinstalled editions. attempting run application on target machine error saying office not installed? i'm assuming have have registed office use object libraries? there anyway around not have office license key lying around , quite expensive? see if can run excel manually on machine. if can this, should able automate well. if cannot, don't expect able somehow miraculously (and legally) make work through automation. automating office through object library no different using through ui. need have licensed , installed copy of office in order able use it.

ios - How to get the status of bluetooth (ON/OFF) in iphone programmatically -

i trying status of iphone/ipod bluetooth whether on or off programmatically. possible using apple api or third party api. a little bit of research sam's answer thought i'd share can without utilizing private api, few caveats: it work on ios 5.0+ it work on devices support bluetooth le spec (iphone 4s+, 5th generation ipod+, ipad 3rd generation+) simply allocating class cause application ask permission use bluetooth stack user (may not desired), , if refuse, thing you'll see cbcentralmanagerstateunauthorized retrieval of bluetooth state async, , continuous. need setup delegate state changes, checking state of freshly allocated bluetooth manager return cbcentralmanagerstateunknown that being said, method seem provide real time updates of bluetooth stack state. after including corebluetooth framework, #import <corebluetooth/corebluetooth.h> these tests easy perform using: - (void)detectbluetooth { if(!self.bluetoothmanager) { ...

c# - Why datetime cannot compare? -

my c# unit test has following statement: assert.areequal(logouttime, log.first().timestamp); why failed following information: assert.areequal failed. expected:<4/28/2010 2:30:37 pm>. actual:<4/28/2010 2:30:37 pm>. are not same? update: use if care second: assert.areequal(logouttime.tostring(), log.first().timestamp.tostring()); have verified number of ticks/milliseconds equal? if datetime.now() twice back, appear same number down minute , down second , vary ticks. if want check equality minute, compare each datetime degree. information on rounding datetimes, see here a note resolution : the property used measure performance. however, because of low resolution, not suitable use benchmarking tool. better alternative use stopwatch class.

mercurial - File in repository after clone, but no history -

we have mercurial repository converted subversion while ago , have today noticed there files in repository have no history whatsoever. one of sympomts of behaviour hg status reports file clean, while hg log reports no changesets same file: > hg clone [repo] > hg st -c filewithmissinghistory.cs c filewithmissinghistory.cs > hg blame filewithmissinghistory.cs filewithmissinghistory.cs: no such file in rev [...] > hg log filewithmissinghistory.cs > hg log filewithmissinghistory.cs -f abort: cannot follow nonexistent file: "filewithmissinghistory.cs" > hg log -v | grep filewithmissinghistory.cs [gives output, there arechangesets mentioning file] obviously filenames have been changed in example. i've tried using hg verify, command reports repo fine. has experienced , there bring history "back life"? placing dummy history on files in question acceptable, suboptimal. edit: i've done more investigation , noticed "filewithmis...

.net - Pattern for GUI applet for sound control -

writing sound control applet gui communicates device via usb. there several type of controls being used, faders, knobs, on/off switches. although there functional similarites there different calcualtions, ranges , settings each, though gets funneled big structure , shipped across. question this: there specific pattern should looking @ clean up? @ present every control has specific event handler updates main control strucure, change in gui appearence, , updates device, seems messy , cumbersome , i'm thinking there's established pattern sort of thing, i'm not knowledgable. an architecture every control has "changed" event handler updates main structure makes sense in application user can manipulate 1 control @ time. if events each control have same signature, code has 1 handler method - if in codebase each control has own method same identical main-structure-updating code, place refactoring. if each control has different properties , different thin...

asp.net - Default action for http handler? -

i'm working on setting site controls access directory downloads using ihttpmodule. since files zip, exe, rar, , on, default handler isn't being applied , session state isn't available. i've added custom http handler directory uses irequiredsessionstate session available in module. however, i'm @ loss with process request method in handler. there way call default action process request? since i'm trying serve downloads, closest i'm going going doing context.response.trasmitfile()? @ point, there point in having http module, , security check in handler? thanks!

java - What is jasper report's algorithm for using a data source? -

i have created custom data source implementing interface jrdatasource. interface looks this: public interface jrdatasource { /** * tries position cursor on next element in data source. * @return true if there next record, false otherwise * @throws jrexception if error occurs while trying move * next element */ public boolean next() throws jrexception; /** * gets field value current position. * @return object containing field value. object type must * field object type. */ public object getfieldvalue(jrfield jrfield) throws jrexception; } my question following: in way jasper report call functions obtaining fields in .jrxml. e.g: if( next() )){ call getfieldvalue every field present in page header while( next() ){ call getfieldvalue every field present in detail part } call getfieldvalue every field present footer } the previous example, experimentally in fact found out not that. question arised. thanks! ...

c# - Prism v4, MEF WPF DataBinding -

first, few questions regarding databinding: is default datacontext control set codebehind? example, if have variable ordernumber in test.xaml.cs, can reference in xaml {binding ordernumber} ? is correct can databind properties of object? i have prism service in separate module/assembly import shell application via mef. i'm trying databind on doesn't appear working. my workaround below. in shell.xaml.cs: [import(allowrecomposition = false)] private iribbonservice _menuservice; public iribbonservice menuservice { { return _menuservice; } } public void onimportssatisfied() { debug.writeline("imports satisfied", "prism"); this._modulemanager.loadmodulecompleted += new eventhandler<loadmodulecompletedeventargs>(modulemanager_loadmodulecompleted); //todo figure out how bind ribbon ribbon.datacontext = _menuservice; ribbonappmenu.datacontext = _menuservice.applicationmenudata; } is there way set da...

Haskell ambiguous type -

findmult lst n = [x | x <- lst, x `mod` n == 0] primes num = let n = [2..num] x = ceiling (sqrt num) nsqrt = [2..x] not_prime = map (findmult n) nsqrt in diff2 n (concat not_prime) has following problem when try run it <interactive>:1:0: ambiguous type variable `t' in constraints: `realfrac t' arising use of `primes' @ <interactive>:1:0-8 `floating t' arising use of `primes' @ <interactive>:1:0-8 `integral t' arising use of `primes' @ <interactive>:1:0-8 probable fix: add type signature fixes these type variable(s) i tried using fromintegral don't think used correctly gives me compilation error. please help. the purpose of find prime numbers until num. you error messages when use integral value floating value expected (or vice versa). in case problem you're calling sqrt , takes floating point value argument, on num making compiler think n...

asp.net mvc - Understanding MVC Models -

in models have: public class bidmodel { public int id { get; set; } public string firstname{ get; set; } public string lastname{ get; set; } public int price{ get; set; } public string date{ get; set; } } where or how should define global list list<bidmodel> mylist = new list<bidmodel>; can add items in 1 controller remove items controller, change content of list wherever want.ok know work database need list of offers becase dont want queries base. in mode-view-controller, controllers responsibility hand correct model down view, depending on action calling. in mind. don't want create global list bidmodel . since using mvc 3 can pass down view quite nicely using dynamic property viewbag . consider this: public actionresult retreiveallbids() { var bids = bidrepository.getallbids(); viewbag.bids = bids.toarray(); return view(); } you of course use linq-to-* depending on orm / data storage is. might idea on how...

javascript - How can I read and write OData calls in a secure way? (not vulnerable to CSRF for example?) -

what secure way open odata read/get endpoint without risks csrf attacks this one? i haven't looked @ source, how msft odata library compare jquery in regard: odata designed prevent json-hijacking attack described in link returning objects json results, makes payload invalid javascript program , such won't executed browser. this independent of whether use datajs or jquery. haven't looked @ exact result jquery, know datajs "unwrap" results more natural-looking result, without artificial top-level objects. in particular, wcf data services implementation .net doesn't support jsonp out of box, although there couple of popular simple solutions add it. @ point, though, you've opted allowing data seen other domains, shouldn't done user-sensitive data.

amazon ec2 - Recommendations for Hadoop on EC2? -

when running hadoop in ec2, seem have 2 options: a: manage cluster myself, using ec2-specific shell scripts come hadoop. b: use elastic mapreduce, , pay little convenience. i'm leaning towards b, i'd appreciate advice people more experience. here questions: are there tasks can done 1 of these methods not other? are there other options besides these 2 i'm overlooking? if choose b, how easy go a? is, what's danger of vendor lock-in? i have been told people close amazon elastic mapreduce (emr) development team there @ least 2 other advantages using emr: a) amazon actively applying bug fixes , performance enhancements hadoop code base used on emr, , b) amazon employs high performance network between emr servers , s3 servers may not available between ec2 servers , s3 servers. update: see @mat's comments refute rumored advantages of using emr.

c# - Where the finally is necessary? -

i know how use try-catch-finally. not advance of using finally can place code after try-catch block. there clear example? update : not great answer. on other hand, maybe is answer because illustrates perfect example of finally succeeding developer (i.e., me) might fail ensure cleanup properly. in below code, consider scenario exception other specificexception thrown. first example still perform cleanup, while second not, though developer may think "i caught exception , handled it, surely subsequent code run." everybody's giving reasons use try / finally without catch . can still make sense with catch , if you're throwing exception. consider case* want return value. try { dosomethingtricky(); return true; } catch (specificexception ex) { logexception(ex); return false; } { doimportantcleanup(); } the alternative above without finally (in opinion) less readable: bool success; try { dosomethingtricky(); succe...

Identity function in Scheme -

is identity function pre-defined in scheme? yes, it's called values . actually, that's used multiple values, it's generalized multiple-arity identity function.

html - Super simple CSS tooltip in a table, why is it not displaying and can I make it work? -

i have been trying implement many different tooltips on page client, he's adamant have picture of product show when hover on product name in order page. decided use super simple css tooltip, it's easy implement , want. works on dynamic page, others tried didn't. i have made example here: css tooltip in table example .<-- updated remove errors . html: <table class="mytable" id="cart"> <tr id="titles"> <th id="varekodetext">varekode</th> <th id="produkttext">produkt</th> <th id="pristext">pris</th> <th id="emptee">&nbsp;</th> <th id="antalltext">antall</th> <th id="pristotaltext">pris total</th> <th id="sletttext">slett</th> </tr> <tbody> <tr class="even first" id="topborder" height="40px...