Posts

Showing posts from January, 2010

ios - UISplitViewController - Use as slideout-style menu -

i'm struggling bit new uisplitviewcontroller in ios 8. i want achieve slideout-style menu on iphone (landscape , portrait) on ipad in portrait orientation , persistent sidebar on ipad in landscape orientation. i got uitableviewcontroller master , uinavigationcontroller couple of uiviewcontrollers detail in splitviewcontroller. is possible to new uisplitviewcontroller in ios 8? first enough iphone sliding thing run :d thank :) the uisplitviewcontroller that. sliding menus , everything. it works dream if use book. , requires setup of uinavigationcontrollers part of magic. tutorial highly recommended first time. it's easy messed otherwise. :) http://nshipster.com/uisplitviewcontroller/

c# - how to load a different _layout.cshtml depending on role? -

my app have different roles, 1 role global administrator, have options adding users, adding companies, etc. the template bought has 1 _layout.cshtml, need loads different 1 depending on role of user. one has different menu. my viewstart @{ layout = "~/views/shared/_layout.cshtml"; } and layouts.cshtml <!doctype html> <html> <head> <meta http-equiv="content-type" content="text/html; charset=utf-8"/> <meta charset="utf-8" /> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta http-equiv="x-ua-compatible" content="ie=edge"> <title>inspinia | @viewbag.title</title> <link href='https://fonts.googleapis.com/css?family=open+sans:400,300,600,700' rel='stylesheet' type='text/css'> <!-- add local styles, plugins css file --> @if (issectiondefined("st...

angularjs - Is it possible to return wether or not an image has loaded in javascript -

i'm (attempting) working on function right return whether or not user has gravatar. javascript limited cross-site checks feels kinda hacky. i'm writing in django use , write api for... i'd rather see if there way client side instead of server side, maybe that's wrong mentality. this being written in angular directive; i've came far. $scope.hasavatar = function(user) { if (user === undefined) return false; var url = 'http://www.gravatar.com/avatar/' + md5(user.email); var image = new image(); image.onload = function() { return true; } image.onerror = function() { return false; } image.src = url + "?d=404"; } i'm still learning javascript. know because of nature of javascript doesn't wait call onload or onerror, completes function, defaults false. am barking wrong tree trying solve way? or possible callbacks or promises? appreciate help. you should pro...

java - Import PDF from adobe -

i looking following in andriod studio user open mail client , click preview on pdf. opens file in adobe reader. the user makes comments in adobe , when done press share my andriod app shown , users selects app my andriod app gets pdf , saves externally server. i have part 1,2,3 far not 4,5. understanding can not access applications storage, poster posted this, unsure on how use that? in order pdf you'll need create activity use case listens "sharing" intents. shareactivity.java void oncreate (bundle savedinstancestate) { // intent, action , mime type intent intent = getintent(); string action = intent.getaction(); string type = intent.gettype(); if (intent.action_send.equals(action) && type != null) { if ("application/pdf".equals(type)) { handlepdf(intent); } } else if (intent.action_send_multiple.equals(action) && type != null) { if (type.startswith(...

how to mock QueueItems[] using mockito? -

queueitems[] items = .... how can mock object queueitems[] using mockito? i tried : arraylist workitems = mock(arraylist.class); queueitems = mock(queueitems.class); but not working. if want customly create array of items, should create such array , insert mocks array. should not try mock array, core java implementation. also, list s better use allow more flexibility. example: @runwith(mockitojunitrunner.class) public class testclass { @mock private queueitem item1; private list<queueitem> items; @before public void setup() { items = new arraylist<queueitem>(); // mocked queueitem first entry in list items.add(item1); } @test public void simpletest() { invokesomemethodwithlist(items); mockito.verify(item1).somemethod(); } }

c# - If a volatile reference has changed between a thread loading the reference and calling a function on it, can the old object be garbage collected? -

i have 2 threads executing code below: static volatile foo; void update() { newfoo = new something(); foo = newfoo; } void invoke() { foo.bar(); } thread executes update , thread b executes invoke . 2 threads have timing such invoke loads address of foo , update overwrites foo , , garbage collection happens before bar called into. is possible garbage collection may collect old object referenced foo , causing bar invoked on memory has been collected? note question out of curiosity. i'm open better title. the garbage collector pause state of running threads long enough resolve race conditions surrounding memory accesses made thereby. whether static variable foo volatile or not, garbage collector know identities of object call bar might invoked upon, , ensure such object object continue exist long there execution path via normal or "hidden" fields thereof possibly accessed, via keepalive call might performed on it, or via might ref...

Updating GCC, received errors during 'make' -

i'm trying update gcc on computer running rhel6.6-server edition in lab. keep receiving errors after running 'make' command. here's of code: /usr/bin/ld: /usr/local/gcc-5.1.0/gcc-build/./gmp/.libs /libgmp.a(mp_set_fns.o): relocation r_x86_64_32 against `__gmp_default_allocate' can not used when making shared object; recompile -fpic /usr/local/gcc-5.1.0/gcc-build/./gmp/.libs/libgmp.a: not read symbols: bad value collect2: error: ld returned 1 exit status make[6]: *** [libjavamath.la] error 1 make[6]: leaving directory `/usr/local/gcc-5.1.0/gcc-build/x86_64-unknown-linux-gnu/libjava/classpath/native/jni/java-math' make[6]: entering directory `/usr/local/gcc-5.1.0/gcc-build/x86_64-unknown-linux-gnu/libjava/classpath/native/jni' /bin/sh ../../scripts/check_jni_methods.sh make[6]: leaving directory `/usr/local/gcc-5.1.0/gcc-build/x86_64-unknown-linux-gnu/libjava/classpath/native/jni' make[5]: *** [all-recursive] error 1 make[5]: leaving di...

file - CSV manipulation using php -

hey learning php , manipulating csv files here. i'm creating random key generator courses. adding new column keys course. i have managed this. when run script row being read , key generated that. example if have 3 courses a,b,c 4 keys generated , added csv. can have or tips on reading , writing csv? <?php $file= fopen("input.csv","r"); $output=fopen("output.csv","w"); function gen_keys($length=10) { $characters = '0123456789abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz'; $characterslength = strlen($characters); $randomstring = ''; ($i = 0; $i < $length; $i++) { $randomstring .= $characters[rand(0, $characterslength - 1)]; } return $randomstring; } //echo gen_keys(); $list=array(); while(!feof($file)) { //print_r(fgetcsv($file)); $list=fgetcsv($file); //$list=array_filter($list); $list[]=gen_keys(); echo "<br />"; print_r($list); ...

variables - Update globalChannelMap in Mirth Connect -

i inherited mirth connect (v2.2.1) instance , learning how works. i'm learning how globalchannelmap variables work, , i'm stumped misbehaving filter on source connector. in theory can edit csv text file in mirth connect folders directory update globalchannelmap called filter. but in practice csv file updated yet source connector filter continues call prior globalchannelmap txt file. step missing update globalchannelmap ? there simple way output current contents of globalchannelmap ? you may need redeploy. if you're seeing you're using old global channel map (using calkno's method), means need redeploy channel. channel's need redeployed anytime code content changed, internal library (such code template), transformer, or global channel map.

ios - Prevent keyboard dismissal on UITableView cell touch -

i have uitableview several rows buttons inside. same page contains uitextfield control. once activated textfield input want keep active if press button within cell within uitableview. right touch on uitableview dismiss keyboard , doesn't trigger uitouchupinside . tried disable cancellable content touch didn't help. you try using custom gesture recognizer var tap:uitapgesturerecognizer = uitapgesturerecognizer(target: self, action: "dismisskeyboard") self.view.addgesturerecognizer(tap) then add action func dismisskeyboard() { self.view.endediting(false) } if user taps anywhere on screen, wont dismiss keyboard since wont end editing.

c - while ... readdir causing segementation fault -

in main call following function deletefolder(): void deletefolder(){ struct dirent *next_file; dir *folder; char filepath[256]; folder = opendir("./game/wow"); while((next_file = readdir(folder)) != null){ //this causing segmentation fault. dont know why?? sprintf(filepath, "%s/%s", "./game/wow", next_file->d_name); remove(filepath); } } i can't figure out why happening? while((next_file = readdir(folder)) != null){ //this causing segmentation fault. dont know why?? i suspect there error in opening directory. add error checking code. folder = opendir("./game/wow"); if ( folder == null ) { perror("unable open folder."); return; } while((next_file = readdir(folder)) != null){ ...

sql server - Recursion On A Many To Many Table Parent To Child To Parent -

my boss has given me single table. related_items_table item | accessory --------------------- tv | antennae tv | power cord tv | remote laptop | power cord laptop | carrying case camera | carrying case camera | lens ipod | headphones the best way describe boss wants results walk through process. the user searches tv. tv found , accessories tv antennae, power cord & remote. the accessories antennae, power cord & remote used find other related items. power cord accessory laptop. antennae & remote not accessories other item. the item laptop used find item's accessories, power cord & carrying case. the accessories power cord & carrying case used find other related items. power cord finds no new items (we know power cord associated tv & laptop). carrying case accessory camera. the item camera used find item's accessories, carrying case...

java - Spring application fails on startup with NoClassDefFoundError when deployed in tc Server with Insight -

i have spring-based app (packaged war) runs fine in jetty , "ordinary" tomcat 7, produces strange noclassdeffounderror when it's deployed tc server spring insight. class it's complaining can't found in jar in web-inf/lib folder (and i've double-checked no competing jars exist in tomcat shared lib folder). here's stack trace, showing spring thinks can't locate class hierarchicalloop : java.lang.classnotfoundexception: com.foo.hierarchicalloop<com.foo.loop> @ org.apache.catalina.loader.webappclassloader.loadclass(webappclassloader.java:1714) ~[na:na] @ org.apache.catalina.loader.webappclassloader.loadclass(webappclassloader.java:1559) ~[na:na] ... 32 common frames omitted wrapped by: java.lang.noclassdeffounderror: com/foo/hierarchicalloop<com/foo/loop> @ java.lang.class.getdeclaredconstructors0(native method) ~[na:1.7.0_60] @ java.lang.class.privategetdeclaredconstructors(class.java:2532) ~[na:1.7.0_60] @ jav...

java - What kind of Database use as local database for PC Software? -

i want build simple windows pc software java. need store data 100 phone contacts. can oracle or mysql database or array in code. problem dbms need server offline or online , don't want put data direct on code.if use localhost when give friends can't access it. don't want use online database. want local database or resource system android values resource or sqlite. how can it? ideas welcomed. what looking called embedded database . there several java embedded databases, example h2 database , hsqldb , apache derby . sqlite can used in regular java applications, it's not android-specific.

mysql - Finding changes in value by dates -

i have table this: datetime | value ----------------------------------- 2015-05-01 12:23:41 | 12 2015-05-01 22:13:11 | 21 2015-05-02 9:13:41 | 23 2015-05-02 17:23:41 | 32 each day has 100 entries @ random time. need calculate following: daily increase - difference between first entry of today , first entry of yesterday (for each day) daily avg increase - difference between avg value today , avg value yesterday (for each day) how can write sql query these values? what first entry of each date group date portion, , minimum datetime this: select date(datecol), min(datecol) mytable group date(datecol); this see results like: | 2015-05-01 | 2015-05-01 12:23:41 | once have values, can join 2 tables each date next previous one, this: select t1.firstdate, t2.seconddate from( select date(datecol) wholedate, min(datecol) firstdate mytable group date(datecol)) t1 join( select date(datecol) wholedate, min(datecol) secon...

dataframe - R table manipulation -

i have data.frame below product=c(rep("a",4),rep("b",2)) ww1=c(201438,201440,201444,201446,201411,201412) ww2=ww1-6 diff=rep(6,6) demand=rep(100,6) df=data.frame(product,ww1,ww2,diff,demand) df<- df[with(df,order(product, ww1)),] df product ww1 ww2 diff demand 1 201438 201432 6 100 2 201440 201434 6 100 3 201444 201438 6 100 4 201446 201440 6 100 5 b 201411 201405 6 100 6 b 201412 201406 6 100 i want add rows based upon conditions below. for row in data, if product on earlier row same product on current row, ww1 on earlier row not same ww1-1 on current row (basically ww1 difference 1), add new row. for newly added row: product same product on earlier row. ww1 ww1 on earlier row + 1 ww2 ww2 on earlier row + 1 ww_diff 6 demand 0 the final output need below: product ww1 ww2 ww_diff demand 201438 201432 6 100 201439 201433 6 0 201440 201434 6 100 2...

php - What is the most secure method of logging someone into a website? -

i trying ascertain best way keep logged website after have verified log in correct. i tried have @ "keep me logged in" - best approach upvoted answer said should generate token , store token in database! surely wholly unsecure because takes database hack , cookie editing elses account? could please provide me date secure way of doing this? thanks. we posted blog secure authentication long-term persistence (a.k.a "remember me"), largest difference between blog post , ircmaxell's answer "keep me logged in" - best approach separation of lookup (which not constant-time ) , validation (which constant-time). in strategy outlined in our blog post, aren't storing tokens in database, you're storing sha-256 hash of token. if attacker leaks these values, has crack sha-256 hashes of strong random tokens. they're better off launching reverse shell lets them authenticate user (or proceed take on entire machine local kernel exploit)....

javascript - different pages loading into div with delay -

i'm trying load 3 different html files div, 1 after other, delay of 5 seconds. after cycles through 3 want carry on repeating. tried using timeout still not working.any appreciated.. code snippet below <script type="text/javascript"> $(document).ready(function() { jquery(window).load (function timeout() { settimeout(function () { if($("#news_sections").hasclass("news1")){ $("#news_sections").attr('class', "news2"); $( "#news_sections" ).load( "section2.html" ); }else if($("#news_sections").hasclass("news2")){ $("#news_sections").attr('class', 'news3'); $( "#news_sections" ).load( "section3.html" ); }else{ $("#news_sections").attr('class...

visual studio 2013 - NuGet downloads all packages, doesn't update references -

i have project set allow nuget download missing packages automatically check missing packages during build in visual studio . in solution folder, there packages folder , contains need project. references them in project still broken. i have tried removing references , adding them nuget, nuget says item in project (it in packages folder) though reference there , project can't build. way can seem around manually go each of packages in packages folder , select every .dll. is there better way this? open package manager console , type: update-package -reinstall this should refresh references based on each project's packages.config file.

linux - authentication for SSH into EC2 with new user failing -

i working chef on ec2 instances, , created user data script passed in through knife ec2 command, creates new user, copies public key file default ec2-user , sets correct ownership , permissions. #!/bin/bash chefuser="$(date +%s | sha256sum | base64 | head -c 32)" useradd $chefuser echo $chefuser 'all=(all) nopasswd:all' | tee -a /etc/sudoers cp -f /home/ec2-user/.ssh/authorized_keys /tmp/ chown $chefuser /tmp/authorized_keys runuser -l $chefuser -c 'mkdir ~/.ssh/' runuser -l $chefuser -c 'mkdir ~/.aws/' runuser -l $chefuser -c 'chmod 700 ~/.ssh/' runuser -l $chefuser -c 'mv -f /tmp/authorized_keys ~/.ssh/' runuser -l $chefuser -c 'chmod 600 ~/.ssh/authorized_keys' checking ownership , permissions seems return expected after running script: # ls -l .ssh/authorized_keys -rw-------. 1 nwyzmthimdbmnzljotgxzmu1nde1zme0 root 396 may 29 11:28 .ssh/authorized_keys # stat -c '%a %n' .ssh/ 700 .ssh/ # stat -c '%a %n...

MathML UpIntegrals -

i new html, css , mathml can produce mathematics rendered in firefox pretty well, if slowly. problem how use integral symbols in stix fonts. <mo>&#x222b;</mo> produces slanted symbol default. using fontfamily="stixintegralsup" has no effect on firefox produces integral symbol in other browsers. have stixmath fonts installed integral symbols not have unicode. how use these symbols without unicode? in short, how produce integral symbol in firefox? in short, how produce integral symbol in firefox? <math display="block" xmlns="http://www.w3.org/1998/math/mathml"><mo>∫</mo></math> if don't want equation centered, <math xmlns="http://www.w3.org/1998/math/mathml"><mstyle displaystyle="true"><mo>∫</mo></mstyle></math> update using fontfamily="stixintegralsup" has no effect on firefox produces integral symbol in other bro...

javascript - How to get object properties if it's inside an array? -

i have js object structure this: object { name: "name"; id: "id"; subgroups_id : array[1] 0: 9 } i want subgroup_id , turn name of subgroup according id of subgroup, i'm using angularjs , i'm doing this: var users = angular.module('groups', ['app']); users.controller('groupsctrl', ['$scope', 'apiservice', 'rpcservice', function($scope, apiservice){ function getgroupslist() { $scope.groupslist = []; apiservice.getgroups(0) .success(function (data) { $scope.groupslist = data; console.log($scope.groupslist); }) .error(function (data, status, headers) { }); }; getgroupslist(); }]); if can explain me how appreciate it thank you. assume group name in groupslist $scope.groupslist[yourobj.subgroups_id][0] -- yourobj.subgroups_id // array[1] 0: 9 yourobj.subgroups_id[0] // 9 $scope.grou...

Isomorphic Javascript App Fallbacks -

as isomorphic javascript apps become more popular, how people handling fallbacks when javascript not available? seems progressive enhancement doesnt make sense when bulk of site built in js. options see simplified landing page, or perhaps pre-rendering service. have suggestions or experience here?

python - SQLAlchemy. How to order on many to many relationship? -

i have sqlalchemy model named notetype relationship named sections . notesection table joined notetype table through notetypetosectionmap . i want sections list on notetype model ordered position field on notetypetosectionmap model. code have below seems randomly ordering sections. does know how ordering work? thanks! class notetype(modelabstract): __tablename__ = "notetype" id = db.column(db.integer, primary_key=true) name = db.column(db.string(255)) description = db.column(db.string(255)) sections = db.relationship("notesection", secondary=notetypetosectionmap.__table__, primaryjoin=id==notetypetosectionmap.__table__.c.notetypeid, secondaryjoin=id==notetypetosectionmap.__table__.c.notesectionid, order_by=notetypetosectionmap.__table__.c.position) - class notetypetosectionmap(modelabstract): __tablename__ = "notetypetosectionmap" id = db.colum...

automation - automated script to install python package over a proxy? -

would possible write little python script automatically install needed python library import if needed library wasn't installed? currently using try: import xlrd #library iterate through excel docs except importerror: raise importerror('xlrd not installed, use "sudo pip install xlrd"\n') but more automated. as mentioned in comments setup.py approach 1 , quite easy. beyond if need install dependencies across multiple servers suggest have @ solution http://www.ansible.com/home or https://puppetlabs.com/ as one-off can too: ssh user@yourserver.com 'pip install xlrd' edit - following on comments: once have created setup.py specifying dependency on xlrd have run on every machine want install app. in order checkout automation tool advised above. you that's dirty: try: import xlrd #library iterate through excel docs except importerror: subprocess import call call(["pip", "install", ...

jquery - Hide div when clicking outside of it doesn't work on iPad -

i have following code: $(document).on('click touch', function(e) { var nav = $(e.target).closest('.nav-js-trigger'); var hidden = $(e.target).closest('.show-nav') if ( nav.length > 0 ) { $('.show-nav').not( nav.next().toggleclass('show-nav') ).removeclass('show-nav'); } else if ( hidden.length === 0 ) { $('.show-nav').removeclass('show-nav'); } }); it hides menu div if user clicks outside of it. test this: click on menu link. click outside of yellow div. the div should hidden. the problem this not work on ipad . why? here fiddle . i have added click touch , tried touchend , touchstart . got message: comments may edited 5 minutes so i'll post answer instead. i suggest using touchend in tests, touch event not exist. maybe tests failed because of browser cache? have tried putting listener on document.documentelement , document.body a...

How to rotate object in a circle in android -

i have circle object , inside of there more small objects supposed turn around circle. circle spinning can not rotate objects large circle. i happy if help thank you rotate of circle <?xml version="1.0" encoding="utf-8"?> <set android:interpolator="@android:anim/linear_interpolator" xmlns:android="http://schemas.android.com/apk/res/android"> <rotate android:todegrees="360" android:startoffset="0" android:repeatmode="restart" android:repeatcount="800" android:pivoty="50%" android:pivotx="50%" android:fromdegrees="0" android:duration="3500"/> </set> rotate of object inside circle <?xml version="1.0" encoding="utf-8"?> <set android:interpolator="@android:anim/linear_interpolator" xmlns:android="http://schemas.android.com/apk/res/android"> <rotate android:todegrees=...

VBA Class : Collection.item member is a collection . How to retrieve sub collection item elements -

i have template data header of file ((string1, string2...) group1 header (string1, string2...) group1/line1 (string1, string2...) group1/line2 (string1, string2...) group2 header (string1, string2...) group2/line1 (string1, string2...) group2/line2 (string1, string2...) note : datas belonging group header , group line different type if on same 'coloumn' (raw data comes text file) i create main class (populate collection) , data class (populate item : cdata_nomination), works individualy need create : -1 file collection (i have multiples files) store -- fields (file header) , -- x sub collection (groups) wich store --- fields (group header) --- x sub collection store ---- fields (line data) in folowing code on line 170 .odpo group collection every data store on collection property let (....). seem store ! public function nomcreate(m_sfilepath string, m_objdatalist() string, m_cldpo collection) cdata_nomination 10 on error goto err_handler dim ...

user interface - Visual Tkinter Python IDE doesn't work -

Image
i downloaded visual tkinter python ide. unfortunately, when try open new project failed error: full size version i read error , found out there may chance versions don't match. my version of python 2.6 (32-bit). when open regular python tkinter program , run it works ok, don't know why in ide dosen't work.

listview - SharePoint 2013 Partial Security on the page -

Image
this in sharepoint 2013. have calendar app in sub site has permissions owners, designers not visitors. visitors can not see calendar. sub site has permissions including visitors well. placed calendar on home page of sub site webpart. fine without problems anytime owners , designers visit page, when visitors visit page throwing error below. site has permissions view except calendar on page. my expectation is...the page should come visitor, hide calendar. that not happening, instead...it throwing error below. what missing here? thanks in advance -satyen

extjs - How to run "sencha app watch" without a webserver -

i serving extjs 5.1 development application on local (nginx) web server, , don't need development webserver sencha cmd when running sencha app watch . is there flag or other command equivalent without running web server? alternativelly, equivalent command building development app (not making entire build proccess of production app) without " watch " characteristics? ie. issued automatically ide every time save .js file. you can switch off web server. go sencha.cfg file located @ <app name>\app\.sencha\app , put @ bottom of file: skip.web.start=true or skip.web.start=1

ios - Swift Store Kit In app Purchase transactionState -

i have make app uses store kit add character .. i have added paymentqueue function when pop-up displayed , press cancel , transactionstate .completed in method if user cancels transaction obtains character without paying. func paymentqueue(queue: skpaymentqueue!, updatedtransactions transactions: [anyobject]!) { println("add paymnet") transaction:anyobject in transactions { var trans = transaction skpaymenttransaction switch trans.transactionstate { case .purchased: println("purchase successful") skpaymentqueue.defaultqueue().finishtransaction(transaction skpaymenttransaction) queue.finishtransaction(trans) break; case .failed: println("buy cancelled") skpaymentqueue.defaultqueue().finishtransaction(transaction skpaymenttransaction) queue.finishtransaction(trans) break; default: println(...

sql server - Left Join multiple tables on a parent table and subtract one column from the parent table -

i have 3 tables ( donor_detail , items & store ) left joined on 1 parent table ( donated_items ), there column quantity in parent table wish subtract table's column issued_donation.issued_quantity here sql left joins not understanding how should subtract column. i.e. donated_items.quantity - issued_donation.issued_quantity select t1.*, t2.donor_name,t2.id, t3.id,t3.item_name, t4.store_name, t4.id donated_items t1 left join donor_detail t2 on t1.donor_id = t2.id left join items t3 on t1.item_id = t3.id left join stores t4 on t1.store_id = t4.id your question isn't clear, suspect you're talking subtracting values, not columns. if i'm right, have join other table ( issued_donation ) , can add selected fields t1.quantity - t5.issued_quantity remainingquantity .

javascript - Bootstrap material design - Ripples not showing in popover -

i using bootstrap material design: https://fezvrasta.github.io/bootstrap-material-design/bootstrap-elements.html this includes neat ripple effect when pushing buttons, , works everywhere in page except in popover div has display:none in html made visible user javascript. html: <a href="#" class="pop" data-id="#popover_div1" data-container="body" data-placement="top" title="popover title">click open popover</a> <div id="popover_div1" style="display: none"> <div> <img class="img-rounded" src="img/temp.png" alt="temp" height="25" width="25"/> div content </div> <div> <div class="btn-group"> <a href="javascript:void(0)" class="btn btn-default">5</a> <a href="javascript:void(0)" class="bt...

Unkown type name "Enemy" error after including all headers in C -

i'm developing game sdl 2.0 in c , have following problem: after including needed .h files on each file, compiler shows error ( unknown type name 'enemy' ) on shoots.h , have function parameter of type enemy declared on enemy.h. the header files think i'm getting error bullet.h, enemy.h, mobs.h, , shoots.h. (there more sdl.h ) bullet.h #ifndef bullet_h_included #define bullet_h_included #include "sdl.h" typedef struct bullet *bullet; #endif // bullet_h_included enemy.h #ifndef enemy_h_included #define enemy_h_included #include "sdl.h" #include "shoots.h" typedef struct enemy *enemy; #endif // enemy_h_included mobs.h #ifndef mobs_h_included #define mobs_h_included #include "enemy.h" typedef struct enemylist *enemylist; typedef struct enemyposition *enemyposition; #endif // mobs_h_included shoots.h #ifndef shoots_h_included #define shoots_h_included #include "sdl.h" #include "player.h...

CSS or JQuery responsive 'image fill div' with a catch -

i trying replicate neat method of resizing images , filling div responsive design. basically, following happens. on resize, images resize fill parent div while maintaining equal margin between each image. once div gets small, images overflow (as 1 block display , float left) here magic: on overflow of images, images again resize fill div, , repeats perfect image placement in parent div, least amount of space wastage. here follows example if explanation hard understand: example regards, matt http://codepen.io/anon/pen/ovwpvo html <img src="http://placehold.it/350x150"> <img src="http://placehold.it/350x150"> <img src="http://placehold.it/350x150"> <img src="http://placehold.it/350x150"> <img src="http://placehold.it/350x150"> <img src="http://placehold.it/350x150"> <img src="http://placehold.it/350x150"> <img src="http://placehold.it/350x1...

Android- Updating UI elements with threading -

i have textview want change thread , again , again (like digital clock). i'm having problems setting time between 2 changes. here, code: display1 = (textview) findviewbyid(r.id.textview1); thread timer2 = new thread(){ @override public void run() { synchronized (this){ runonuithread(new runnable() { @override public void run() { int = 0; display1.settext("" + i); try { sleep(2000); } catch (interruptedexception e) { e.printstacktrace(); } display1.settext("" + (i+1)); } }); } } }; timer2.start(); this sleep(2000); function makes textview invisible given time want stand still till next change. how can that? ...

c# - TargetInvocationException when using SemanticResultKey -

Image
i want build grammar accept multiple number. has bug when repeat number saying 'twenty-one'. kept reducing code find problem. reached following piece of code grammar builder: string[] numberstring = { "one" }; choices numberchoices = new choices(); (int = 0; < numberstring.length; i++) { numberchoices.add(new semanticresultvalue(numberstring[i], numberstring[i])); } gb[1].append(new semanticresultkey("op1", (grammarbuilder)numberchoices), 1, 2); now when pronounce "one one" still gives me exception which when googled it, states exception outside code, wondering bug in microsoft.speech dll or missing something edit 1: i played around code, , made recognition async follow: sre.recognizeasync(recognizemode.multiple); instead of sre.recognize(); now when 'twenty-one'for example gets exception: base = {"duplicated semantic key 'op1' in rule 'root."} i know problem grammar, did made repeated ...

vba - Adding text to a combobox -

currently have simple combobox populates 3 items when clicked: functionbox .additem "add blank issue" .additem "move existing issue" .additem "reorder issues" end however, combobox empty before dropdown arrow selected. when combobox appears want show like, "please select 1 of options below". i tried setting 'value' of combobox 'test'. test shows in editor, not when run application. i want make sure string goes away when down arrow selected , user cannot interact it. any advice? i can provide screenshots if unclear. thanks! goto design view of form, click on combo box in question , change text value want say. edit - didnt see 2nd part of question put in dropbuttonclick event. changing combobox1 needed private sub combobox1_dropbuttonclick() combobox1.value = "" end sub

delphi - TEdit and focus selection works different depending on Show/showmodal -

when switching focus between tedits , selection changes depending on way show form. when show form.show , , swith between 2 tedits , text selected. when show form form.showmodal , , switch between, cursor @ end of newly focused tedit reproduce : create new form 2 tedits , type text in both. switch between both tedits , whole text selected, when show form modal, caret positioned behind text. why there difference in functionality? , can change it. i found code responsible : procedure tstylededit.doenter; var form: tcommoncustomform; begin inherited; form := tcommoncustomform(root); if not model.isreadonly , model.inputsupport , not ftextservice.hasmarkedtext , ((form = nil) //next part returns false or (form.formstate * [tfmxformstate.showing] = [tfmxformstate.showing]) or (form.formstate = [tfmxformstate.engaged])) edit.selectall else begin updateselectionpointpositions; updatecaretposition; end; end; doenter protected method , suc...

Java Lock a range of array -

i'm trying implement array-based lock-free binary search tree. in order make work concurrently, should lock range of array in method. how can achieve it? public int getindex(int data){ int index = 1; while(index<this.capacity && this.array[index] != 0){ if(data < this.array[index]) index = index *2; else if (data> this.array[index]) index = index * 2 + 1; else break; } if(index >= this.capacity) return -1; else return index; } public void insert(int data){ int index = this.getindex(data); if (index == -1) { this.reallocate(); index = this.getindex(data); this.array[index] = data; } else { if (this.array[index] == 0) this.array[index] = data; } } i'm getting put data in getindex method , in...

html - @media query not working for all rules -

i'm stuck on 1 because @media query works first rule, not after it. for example have "subbutton" disappear when screen goes below set width, need change h2 heading size down 2.5em (currently 4.5em on desktop). subbutton altered media query when viewed on iphone. any ideas on doing wrong? * edit * have included code targeting media query. have tried of different classes, id's still no luck. further insight appreciated /** mobile **/ @media screen , (max-width: 767px), screen , (max-device-width: 767px) { #subbutton { display:none; } .primarycontainer h2 { font-size: 2.5em; } } html <section class="contentcontainer" id="primarybackground"> <div class="container"> <div class="row"> <div class="col-md-8 col-md-offset-2 primarycontainer"> <h2>get rocket ship growth!</...

knockout.js - Knockout Kendo and primitive values -

i know, why non primitive values not working in kendo-knockout bindings. i have 2 dropdownlists: <!-- 1 works fine --> <input data-bind="kendodropdownlist: { data: names, value: selectectedvalue1, datatextfield: 'name', datavaluefield: 'id', valueprimitive: true }" /> <!-- 1 doesn't work --> <input data-bind="kendodropdownlist: { data: names, value: selectectedvalue2, datatextfield: 'name', datavaluefield: 'id', valueprimitive: false }" /> and simple vm: var datajs = [{'id':1,'name':'name 1'}, {'id':2,'name':'name 2'}, {'id':3,'name':'name 3'}, {'id':4,'name':'name 4'}, {'id':5,'name':'name 5'} ]; var viewmodel = function() { this.names = ko.observablearray(datajs); this.selectectedvalue1= ko.observable(null); this.selectectedvalue2=...

javascript - How to show submenu bar on sidebar when mouse over? -

how show submenu bar on sidebar when mouse on , close when mouse leave? can me solve problem? newbie on using jquery. js code not working $(function(){ $('.nav').hover(function(){ $(this).animate({width:'200px'},500); },function(){ $(this).animate({width:'35px'},500); }).trigger('mouseleave'); }); html <div class="col-xs-6 col-sm-3 sidebar-offcanvas" id="sidebar" role="navigation" style="border-radius: 2px 2px 2px 2px;"> <ul class="nav"> <li><a href="#" data-toggle="collapse" data-target="#sub1">setting <span class="caret"></span></a> <ul class="nav collapse" id="sub1" style="font-weight:bold"> <li><a href="#"><span class="glyphicon glyphicon-chevron-right"></span> add account<...

AngularJS how do I execute code only after a promise is resolved? (with Restangular) -

this might nooby question still haven't been able head around promises , how write code them. (i've read several articles of them abstract , haven't written enough have clear picture) i've got angujlarjs application gets data through http request server sends promise @ first. i've been able retrieve response promise , use in app. because code poorly written. executes other code before promise resolved leading problems. starts loading page before has data. what have is: var usertotals = *http request returns promise $scope.data = usertotals.$object //code someting $scope.data what need (i think) var usertotals = *http request returns promise $scope.data = usertotals.$object. beforethisresolves(function{ show fancy loading icon or }) .whenthis resolves(function{ //code someting $scope.data } however can't syntax correct. this looks in general: var promise = $http.post('/url'); console.log('request sta...

Best Practice for setting up RabbitMQ cluster in production with NServiceBus -

currently have 2 load balanced web servers. starting expose functionality on nsb. if create 2 "app" servers create cluster between 4 servers? or should create 2 clusters? i.e. cluster1: web server a, app server a cluster2: web server b, app server b seems if 1 cluster, how keep published message being handled same logical subscriber more once if subscriber deployed both app server , b? is reason put rabbitmq on web servers message durability (assuming didn't have of app services running on web server well)? in case assumption using cluster mirroring message app server. correct? endpoints vs servers nservicebus uses concept of endpoints. endpoint related queue on receives messages. if endpoint scaled out either high availability or performance still have 1 queue (with rabbitmq). if have instance running on server , b both (with rabbitmq) messages same queue. i wouldn't think in app servers think in endpoints , non functional requirement...

vb.net - How can to stop the "ding" sound while pressing enter -

i need stop "ding" sound while pressing enter use send message. there code: private sub textbox2_keydown(sender object, e system.windows.forms.keyeventargs) _ handles textbox2.keydown if e.keycode = keys.enter textbox3.readonly = true if textbox2.text = ("") else dim postdata = "token=" & textbox1.text & "&msg=" & textbox3.text & ": " & textbox2.text dim request webrequest = webrequest.create("http://url.com/msg.php") request.method = "post" dim bytearray byte() = encoding.utf8.getbytes(postdata) request.contenttype = "application/x-www-form-urlencoded" request.contentlength = bytearray.length dim datastream stream = request.getrequeststream() datastream.write(bytearray, 0, bytearray.length) datastream.close() dim response web...

cakephp - How to load a xml file in plugins webroot -

i using cakephp-3.0 in component of plugin, want load xml file in plugins webroot. simplexml_load_file('rangemessage.xml') the file can't found. debugging path debug(realpath('')); says, actual directory /path/to/app/webroot . xml-file in /path/to/app/plugins/myplugin/webroot how can find file without using absolute path? you can use plugin::path() retrieve absolute path plugin, don't have hardcode it. plugin::path('yourplugin') . 'webroot' . ds . 'rangemessage.xml' see api > cake\core\plugin::path()

html - Slants cross over responsive -

Image
is there anyway create similar attached html/css, works responsive? without using image? unable oragne border & content added in css .left { border-bottom: 70px solid #3488b1; border-right: 1000px solid transparent; height: 0; position: absolute; bottom:0; width: 1px; opacity:.5; } .right { border-bottom: 70px solid #3488b1; border-left: 1000px solid transparent; height: 0; width: 1px; position: absolute; bottom:0; } .footer {height:100px;} & html <div class="footer"> <span class="left"> </span> <span class="right"></span> </div> one way use transforms. html, body { height:100%; width:100%; } #responsive { position:relative; height:25%; width:80%; overflow:hidden; min-height: 80px; } #trione { position:absolute; background-color:aqua; height:300%; width:300%; transform: rotate(10deg); top:55%...

java - How to write and run apache Giraph Custom code? -

i have been working on giraph last 10 days.i got ideas how install , execute given examples in giraph. want design own custom code,so need of you.if done please let me know , give idea. what need create new project, package foo , class foo1 in package. project must reference giraph-core jar files. class foo1 must extends class abstractcomputation. should override compute function of abstractcomputation. in compute function develop own graph algorithm based on vertex-oriented paradigm. for more information how implement own algorithm, can examples provided in giraph-examples package of giraph simpleconnectedcomponents.java , singlesourceshortestpaths.java. after implement foo1, should create jar file project , pass jar file command using -libjars parameter.

javascript - How to improve Gulp task performance with gulp-sass plugin? -

i have sass file long loop (generate 800 lines of css) compiles 25 seconds. it's long. how can minimize compile time? thanks! this how compile sass using gulp-sass , takes 800ms or less. sure use node version, not ruby gulp-ruby-sass ? ruby slower node.js. the loop may problem, sure using each or for, never while. generated big grid system more less 200 selectors , fast. try task config below: var sass = require('gulp-sass'); var sourcemaps = require('gulp-sourcemaps'); var autoprefixer = require('gulp-autoprefixer'); var gulpif = require('gulp-if'); var minify = require('gulp-minify-css'); var argv = require('yargs').argv; var cache = require('gulp-cached'); // values console flags. var = { dev: argv.develop, prod: argv.production }; // gulpfile config. var config = { sass: { src: './src/**/*.scss', dest: 'src/', maps: '/' } }; gulp.task...

java - Single process blocking queue -

i writing application communicates hardware. while application can receive , process multiple requests simultaneously in parallel, hardware cannot! the hardware requires these parallel requests organised linear request chain each 1 executed 1 after other. i have requirement able prioritise requests given of background processes no urgency , live , need jumped front of queue immediate processing. i don't have experience queues surprised if such library didn't exist. see https://docs.oracle.com/javase/7/docs/api/java/util/priorityqueue.html i advise using wrapper requests has priority value queue. instance, can use long value, calculate value = timestamp % n * prioritylevel n dependent on how long takes process events prioritylevel value lower means more urgent (bigger zero) edit : after specification in comments it seems need create instance of threadpoolexecutor , pass own queue instance of priorityblockingqueue . task put pool need implement...

neural network - error: Matrix dimensions must agree in matlab for building confusion matrix -

i know question has been asked before didn't answer out of them. , didn't mathworks.com i'm trying build confusion matrix ann. testsize number of testset files have. output = sim(net,yt);%testing network confusionmatrix(10,10);%building confusion matrix i=1:(testsize-2)*10 j=1:10 m(j) = abs(output(i,i)-1); end minimum = find(m == min(m)); confusionmatrix(floor((i-1)/(testsize-2)) + 1,minimum) = confusionmatrix(floor((i-1)/(testsize-2))+1); end and below whole code. it's speech recognition based on testsets , trainsets. trainset=dir('trainset'); maxlength=0; i=3:length(trainset) file=strcat('trainset\',trainset(i).name); sub_direction=dir(file); j=3:length(sub_direction) path=strcat(file,'\',sub_direction(j).name); sample=wavread(path); % reading files if(length(sample) > maxlength) maxlength = length(sample); end end end testset=dir('testset'); i...