Posts

Showing posts from April, 2010

c# - Transparency on Windows embedded desktop -

i developing application windows embedded compact 7. 1 of requirements program round button lying on top of other controls (e.g. grid or list ). it seems me, not possible in .net framework, desktop icons provide transparency, on top other icons. why , can use transparency in c# in anyway? sorry missing information: develop in c#, .net 3.5, 2 arm processors, 500 mhz, 1 ghz, use resco components, , support transparency against background. say, system.windows.forms.control not support transparency. just copy following code , , paste . make 1 command button or label or else. background transparent command buttons shown. option explicit private declare function createrectrgn lib _ "gdi32" (byval x1 long, byval y1 long, _ byval x2 long, byval y2 long) long private declare function combinergn lib _ "gdi32" (byval hdestrgn long, byval hsrcrgn1 long, _ byval hsrcrgn2 long, byval ncombinemode long) long private declare function se

webforms - What is the difference between Image Attribute and ImageURL in ASP.NET? -

i have googled , crawled couldn't find reliable info. what difference between changing photo source of image in asp.net by myimage.attributes["src"] = "/files/image1.jpg"; and myimage.imageurl = "~/files/image1.jpg"; the imageurl attribute has advantage can use ~ character, stands application root. myimage.imageurl = "~/files/image1.jpg"; this useful in cases root of application in subfolder , don't need hard code folder's name in code.

phpmyadmin - PHP not working in OS X Server -

Image
i have server running os x 10.8.2. wanted install phpmyadmin, have installed mysql , php (through macports) too. put phpmyadmin folder in root of webserver, when surf http://serveraddress/phpmyadmin on web browser on device source code of index.php file instead of page loaded (see screenshot). can me please? first, open terminal. in it, write: sudo nano /etc/apache2/httpd.conf find row #loadmodule php5_module libexec/apache2/libphp5.so and remove comment beginning of line (remove #). hit ctrl+o , control+x save , quit. then restart apache: sudo apachectl restart then try , reload phpmyadmin.

php - Mobile Site Default Page -

ripping brain out on one, , it's simple i'm missing. have wordpress site client. initially, had setup page using whatever wysiwyg system ipage uses. mobile site default old page, while regular site worked fine. deleted index.html site created...and can guess i've ended with. 404. ideas? well, figured out. in .htaccess file, weebly (which drag , drop system used original design) included snippet of code redirected mobile users index.html. once removed snippet, fine. thanks!

http - How can I get absolute time with java? -

this question has answer here: synchronize java virtual machine system.nanotime 3 answers i want measure how long spend when post http request server1 server2, 1 thing need consider that, server1 , server2 not in same host, , there time not consistent, plan this: i need post parameter named starttime before http request post server2, value is: long starttime = system.currenttimemillis(); when server2 received request server1, variable name endtime : long endtime = system.currenttimemillis(); and result : long result = endtime - starttime; if time of server1 , server2 not consistent, result meaningless, need know how absolute time of starttime , endtime, can me ? why aren't using ntp 2 host in sync? it's complicate task millisecond precision evaluation of latency introduced internet communication between 2 hosts, , need use external

django-wsgiserver for cherrypy and django -

i downloaded , installed django-wsgiserver app can use cherrypy django project. used pip install , added settings.py. see runwsgiserver command on manage.py. when try run following error ./manage.py runwsgiserver keyerror: 'default' what might fault? u need more information? setting.py installed_apps = ( 'django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', 'django.contrib.sites', 'django.contrib.messages', 'django.contrib.staticfiles', 'django_wsgiserver', 'south', # uncomment next line enable admin: 'django.contrib.admin', # uncomment next line enable admin documentation: # 'django.contrib.admindocs', ) edit:i solved it...had add db engine :p..but message ./manage.py runwsgiserver host=0.0.0.0 staticserve=false validating models.. 0 errors found october 06, 2013 - 11:02:37 django version 1.5.4, using settings

javascript - Infinite loop when looping through 3 elements. Whats wrong? -

im trying create "plugin" facebook button. loop renders first div. , not other divs. why? jsfiddle <style>body{background: #ccc;}</style> <div name="q" data-id="3" data-width="200"></div> <div name="q" data-id="1" data-width="300"></div> <div name="q" data-id="1" data-width="400"></div> <script> var s = document.getelementsbyname("q"); (var = 0; < s.length; i++) { e = s[i]; w = e.attributes['data-width'].value; = e.attributes['data-id'].value; var o={}; o.iframe = document.createelement('iframe'); o.iframe.setattribute('src', 'http://resources2.news.com.au/images/2012/09/27/1226482/758034-tardar-sauce-the-cat.jpg'); o.iframe.width = w; o.iframe.height = w + 100; o.iframe.border =

c# - Activate XAML Storyboard on Button Click (Windows 8 Application) -

basically, how activate simple storyboard animation button, instead of having play automatically? trying normal buttons, toggle buttons , toggle switches here, none have worked. i intend image of door move right upon clicking button, , move left when clicking again. should repeat behavior indefinitely when clicked. what goes mainpage.xaml file. <grid> <grid.background> <imagebrush imagesource="assets/1.png"/> </grid.background> <image source="assets/rightdoor.png" x:name="rightdoor" horizontalalignment="center" height="1000" margin="276,166,-2665,-398" verticalalignment="top" width="3755"> <image.rendertransform> <!--<compositetransform x:name="imagetransform"/>--> <transformgroup> <translatetransform x:name="rdformtranslate" x ="1" y="1&q

Python SQLAlchemy Database Migrations -

this question has answer here: ways manage db migrations sqlalchemy? [closed] 2 answers what correct way handle database migrations in sql alchemy? if update orm class underlying table updated itself? correct way of doing this? you tagged question flask, assume using flask-sqlalchemy. if that's case, take @ flask-migrate , flask extension wraps alembic. alembic database migration tool written author of sqlalchemy.

Actionscript create a value object from Json -

i have large json file pass actionscript , want generate value object. what best way of doing this? trying code: public function report(data:object) { if(data.score){ this.score = data.score; } if(data.title){ this.title = new object(); this.title.response = data.title.text; } } doing more 100 json property tedious. how can create value object json? you can use json class' parse method, this: var myjson:object = json.parse( data ); after myjson object common object data. no need in duplicate values 1 object another..

ios - How to decompose storyboard views into XIBs -

is possible me extract views on storyboard individual .xib files? think having lot of views in storyboard makes confusing , hard view code in 13 inch screen. thanks. it's not possible in automatic way, need copy paste views xibs. can instantiate view controllers in storyboard. something this: uistoryboard *sb = [uistoryboard storyboardwithname: @"storyboard" bundle:[nsbundle mainbundle]]; uiviewcontroller *vc = [storyboard instantiateviewcontrollerwithidentifier:@"id"];

jquery - get the class of the parent html element -

hi guys i'm trying class of parent element of element clicked ex: <div class="mydiv"><a href="#" class="link">click me</a></div> i want class of parent div(mydiv) i tried didn't work: $(document).ready(function(){ $(".link").click(function(){ var div=$(this).parent().classname; alert(div); }); }); it gives me (undefined). 1 can help? .parent() gives jquery object , classname property of dom element try: var div=$(this).parent()[0].classname; // use [0] dom element , property or var div= $(this).parent().attr("class"); //use jquery attr value of attribute class

Markdown lists in Vim -

when creating list in markdown file, insert new item when pressing <cr> . want apply both ordered , unordered lists. implies that, in ordered lists, list item number increment automatically. also, if press <cr> on list item no content, remove item , add new line, ending list; current behaviour. i managed achieve of functionality want this stackoverflow question autocommand: autocmd filetype markdown setlocal com=s1:/*,mb:*,ex:*/,://,b:#,:%,:xcomm,n:>,b:- | set formatoptions=tcroqln but autocommand doesn't work ordered lists , doesn't end list when <cr> pressed on blank list item. is possible add 2 features? to handle ordered lists, treat them comments - sigil, add :setlocal com+=b:1. won't auto-increment, think markdown when rendering list, anyway. there's no built-in logic ending list, can press <c-u> remove automatically inserted comment. if that's not enough you, :imap <buffer> <cr> <cr>...

syntax - How to write a Cron Job to execute simple php script? -

i have php script on server , want run every 2 minutes using cron job. */2 * * * * http://mydomain.com/_adder.php i suspect command syntax wrong. do need add command before script url? way run script? any appreciated. the cron-job execute program on (local) machine. a url not program. it's link ressource. whether ressource triggers php-script execution not of cron's business. in case, run cron-job periodically visit given url. e.g. using wget command (a "non-interactive web-page downloader") */2 * * * * wget --quiet -o /dev/null http://mydomain.com/_adder.php

regex - How can I implement grouping preference in antlr? -

i want write lexer , parser take expressions like (4+y)*8 4+5*x (3)+(z*(4+w))*6 and parse them considering priority of multiplication on addition. in particular, can't figure out how avoid 4+5*x being grouped as multiplication(addition(4,5),5) instead of addition(4+multiplication) my lexer looks that: plus : '+'; times : '*'; number : [0-9]+'.'?[0-9]*; variable : [(a-z)|(a-z)]+; opening : '('; closing : ')'; whitespace : [ \t\r\n]+ -> skip ; the correct grouping happen automatically if define lower-priority operations closer "root expression" rule higher-priority ones: expr : e=multdivexpr ( plus e=multdivexpr | minus e=multdivexpr )* ; multdivexpr : e=atomexpr ( times e=atom | div e=atom | rem e=atom )* ; atom : number | variable | opening e=expr closing ; a simple way understand what's going on think recursive d

database - sqlplus connect but sql developer and jdeveloper does not -

today sql developer stop connecting oracle database , jdeveloper either. gives me infamous error message io error: network adapter not establish connection but when connect throw sql plus, connects normally. disabled firewall still error. yesterday made restore point windows operating system. don't know if has problem. thing remember did. i working weeks , happened now. how can solve problem? need wokr on jdeveloper , sql developer oracledbconsoleorcl service not start, caused problem? , how start it after restaring pc sqlplus not connect , tells me oracle doesnot exist go start->programs-> {oracle database instance }-> configuration , migration tools -> net configuration assistant a window open, select first option( listener configuration) click next , select delete , finish. then again select listener configuration , select add , finish i don't remember how solved problem. in notes had scribbled below. can try resolving problem tns s

Why does C# prohibit internal access on interface members? -

c# deliberately prevents me putting internal access modifier on interface members. i'm pretty sure had put additional effort implementing restriction when have allowed well. there should reason spend effort - one? for me useful have internal access modifiers on interfaces realize "mutability prevention outside". e.g. consider following interface: interface imessage { ... datetime lastsenttimestamp { get; internal set; } ... } internally, within message broker, able set lastsenttimestamp . external users of api should not able change it. of course ditch interface , use class instead, however, removes pros of interfaces (e.g. change implementation anytime, etc.) q1: don't why restrict me. there particular reason? q2: i'm looking workaround particular situation above. splitting interface in 2 ( imessage , iinternalmessage ) looks big pain in ass , not option left... i guess conflict c# designers have seen cannot implement inte

java - Reload Changed Classes Warning window appear when run my program -

Image
recently see warning in ide (intellij idea) when want run program (swing application) : how can fix problem? this message related jrebel, can use do not show dialog in future option or uninstall jrebel.

pdf - itextsharp 5.4.4 - GetDrawingImage decodes this image the wong way - why? -

this pdf displayed on firefox in c# program wrote using itextsharp 5.4.4, used getdrawingimage method of pdfimageobject , grabled image. i used itextsharp in following way: pdfreader reader = new pdfreader(filename); pdfreadercontentparser parser = new pdfreadercontentparser(reader); imagerenderlistener listener = new imagerenderlistener(); parser.processcontent(pagenumber, listener); where imagerenderlistener irenderlistener , implements renderimage method in following way: public void renderimage(imagerenderinfo renderinfo) { pdfimageobject image = renderinfo.getimage(); pdfobject obj = image.get(pdfname.filter); pdfname filter = null; if (obj pdfname) { filter = (pdfname)obj; } else if (obj pdfarray) { foreach(var o in (pdfarray)obj) { if (o pdfname) { filter = o pdfname; break;

c++ - Looking for clarification regarding array references in function definitions and prototypes -

i idea modify array in function need declare parameter reference in function definition: bool sortinput(ifstream &infile, studenttype (&students)[maxsize], int size) and declared prototype since wouldn't compile otherwise: bool sortinput(ifstream &, studenttype (&students)[maxsize], int); however doesn't seem pass array reference. make call different function , doesn't see of changes (all print array prints nothing). know fact array has been modified because printing within original function shows changes, don't seem carry on global array variable , stay within scope of function modifies despite being passed reference. i've read countless other threads , google searches i'm sure function definition proper state proper form prototype. you don't have pass array reference because passed pointer. pass size. in sort function copy of variable size modified in main function zero.

vb.net - Create BMP Screenshot and save as 8pp Grayscale -

i'm having lot of problems trying accomplish task. know how create screenshot , save bitmap.... dim printscreen new bitmap(thewidth, theheight, pixelformat.format24bpprgb) dim xscreenshot graphics = graphics.fromimage(printscreen) dim thetest new size(thewidth, theheight) dim thexloc string = "200" dim theyloc string = "200" xscreenshot.copyfromscreen(thexloc, theyloc, 0, 0, thetest) printscreen.save("c:\temp\printscreen.bmp", imageformat.memorybmp) however when pull options pixelformat. there no option save in 8pp. trying because have been using aforge.imaging library image comparisons , in order compare grayscale images have in 8pp format.

java - CWAC-Camera Take Photo on touch screen -

i've tried implementing onclicklistener on camerafragment, however, never seems called. missing quite simple. have ideas? public class cwaccamerafragment extends camerafragment implements onclicklistener { //... @override public void onclick(view v) { // todo auto-generated method stub takepicture(); toast.maketext(getactivity(),"click", toast.length_long).show(); } is there way ensure onclick event occurs? in demo app, added following democamerafragment : @override public void onstart() { super.onstart(); getview().setonclicklistener(new view.onclicklistener() { @override public void onclick(view v) { log.e(getclass().getsimplename(), "got here"); } }); } log messages showed fine. hence, afaict, approach works, perhaps there bug in how wired in click listener.

Creating Makefile that compiles multiple C files for use in Minix -

i trying create makefile compiles multiple c files use in minix. how change makefile compiles multiple files @ same time? below current state of makefile. cflags = -d_posix_source ldflags = cc = cc ld = cc prog = test objs = test.o $(prog): $(objs) $(ld) $(ldflags) $(objs) -o $(prog) clean: rm -rf $(prog) $(objs) i thought list other programs after prog , objs such as prog = test test2 objs = test.o test2.o but didn't work. ideas? in advance. split way: prog1 = test prog2 = test2 obj1 = test.o obj2 = test2.o $(prog1): $(obj1) $(ld) $(ldflags) $(obj1) -o $(prog1) $(prog2): $(obj2) $(ld) $(ldflags) $(obj2) -o $(prog2) etc

multithreading - How is the atomic unlock-and-block achieved in the implementation of synchronization primitives like mutexes and condition variables? -

for example, suppose using atomic spinlock on integer flag ensure 1 thread modifies wait-queue mutex maintains @ given time. when thread tries lock mutex, want enqueue , set flag 0 before blocks , unlocker dequeue thread queue , set runnable. consider 2 threads present, 1 locking , other releasing mutex @ same time. if locker preempted after added himself queue , set flag 0 (but not blocked yet) , unlocker tried dequeue , make thread runnable, wouldn't useful since thread hasn't blocked yet. make-runnable call waste more importantly, locker thread block after , remain blocked forever. how atomicity achieved ensure correctness? similar scenario can imagined in condition variables release of mutex , blocking itself.

Hooking two batch files together with set values (premature exit?) -

one problem crashes trying call createserver.bat @ end of this del %userprofile%\desktop\terrariaserver\filebin\serverparams.cmd wget http://***/serverparams.cmd call serverparams.cmd if name==default ( del %userprofile%\desktop\terrariaserver\filebin\serverparams.cmd call senderror.bat ) else ( randomport -default -defaut -default timeout /t 1 ) if not name==default ( sysresourceoutput timeout /t 5 call sysresources if %ram% gtr 1600 ( call %userprofile%\desktop\terrariaserver\createserver.bat ) ) though createserver.bat alone runs fine. another problem linking set values calling serverparams.cmd.. or setting serverparams values correctly @ all, using above, though running through series of commands in startserver below a-ok (in base directory). call setname.cmd call setvars.cmd set path=%userprofile%\desktop\terrariaserver echo set port=%var1% >%path%\%name%_set.cmd echo set players=%var2% >>%path%\%name%_set.cmd echo set autocreate=%var3% >>%path%\%na

android - Validating a Dialog EditText using .contains and \\W -

i have ontextchangedlistener watches edittext see if contains "non-word" characters so; input.addtextchangedlistener(new textwatcher() { public void aftertextchanged(editable s) {} public void beforetextchanged(charsequence s, int start, int count, int after) {} public void ontextchanged(charsequence s, int start, int before, int count) { if (input.gettext().tostring().contains("\\w")) { input.seterror("error"); } else{ } }}); however code not seem recognise ("\\w") non-word characters. have used check other edittexts in instances replaces non-word characters without prompting works fine; string locvalidated = textlocation.gettext().tostring().replaceall("\\w", "-"); it seem cannot use \\w check if edittext contains such characters, replace them. there workaround this? string.contains() not check regular e

c# - How to Inherit from Generic Parent -

i have parent class public class genericrepository<tentity> tentity : class { //implementation } and want inherit class, can't seem right,here attempts public class customerrepository<customer> : genericrepository<customer> { //implementation } or this, public class customerrepository<t> : genericrepository<t> t : new customer() { } or one public class customerrepository<t> : genericrepository<customerrepository<t>> t : customerrepository<t> { } no matter do, error. please show me how can inherit class, classes share same namespace error 'genericrepository' not contain constructor takes 0 arguments customerrepository.cs it seems base class has no constructor without parameters, if derived class must declare a.constructor , call base class constructor parameter. class mybase { public mybase(object art) { } } class derived : mybase {

iphone - ScrollView Not Working with objects inside of it -

my scroll view not working. using xcode 5 storyboards. want create view many buttons , scroll down through it. code .h file: http://gyazo.com/d4cc31d445c483459a6eb1250da39f53 code .m file: http://gyazo.com/4fa0c9e1effe225a92f6ed1341fbd3b2 i go interface builder , add tab bar on top button switches previous view. add scroll view of default size, run app, , scrolls. however, adjust size of scroll view in size inspector , add button @ top , @ bottom, doesn't work anymore. i'm not sure wrong. have iboutlets hooked correctly also. thanks lot mehtaiphoneapps

java - how to index website data contents in database for making a website word search? -

i want implement website word search (user searches word , gets sentences include word specific website) in java myself (without using lucandra,solr,nutch,... mean),till can content (text,not source code) of website of jsoup,but don't know how index datas in database,i searched google understand algorithms known indexers such solr use,i have understood things such using inverted list or hashtable,... in general,i want know should do? i want use cassandra db,so read cassandra secondry indexing,but have know more it,is should focus on?

ajax - PHP: print text without having to go to the top of the page -

i have function sends mails. here is. can see @ end if checks corrects echoes "email sent!" , there errors if user doesn't compile inputs. if(isset($_post['submit'])) { $name = $_post['name']; $visitor_email = $_post['email']; ... blahblah // validation if(empty($name)||empty($visitor_email)) { $errors .= "\n field mandatory. "; } if(isinjected($visitor_email)) { $errors .= "\n email format wrong!"; } if(empty($errors)) { // send email $to = $your_email; $subject="my subject"; ... blah blah $headers = "from: $from \r\n"; mail($to, $subject, $body,$headers); echo 'email sent'; } } email sending works fine. problem form inside jquery toggled div. , when message needs displayed (wheter error message field mandatory or email has been sent), user gets redirected top of p

ruby - Determining if 4 given integer points creates a square -

i'm programmer noob, , i've been working through problems on codeeval practice. right now, i'm working on codeeval's "find square" problem. https://www.codeeval.com/open_challenges/101/ the method i'm utilizing 1 described joel brown: https://softwareengineering.stackexchange.com/questions/176938/how-to-check-if-4-points-form-a-square i'm passing 9 out of 10 test cases given. thing though codeeval doesn't seem give test inputs, i'm working blind on figuring out case i'm missing. i'm assuming case that's suppose test "true" leaking through else statement, meaning i'm missing 1 of possible point assignment positions given points. def is_square? a, b, c, d #distances between points ab = math.sqrt((a[0] - b[0])**2 + (a[1] - b[1])**2) ac = math.sqrt((a[0] - c[0])**2 + (a[1] - c[1])**2) ad = math.sqrt((a[0] - d[0])**2 + (a[1] - d[1])**2) cd = math.sqrt((c[0] - d[0])**2 + (c[1] - d[

c - Infinite Loop with Pointers - Why? -

i relatively new c & pointers. trying sort , print linked list of structs. either missing logical error or not understanding pointers. can please explain me missing in code? thank kindly in advance! // *** sort linked list ( merge sort ) *** struct address_node *newroot; // ptr, rearptr, , temproot struct pointers newroot = root; root = root->next; while (root != null) { temproot = root; ptr = newroot; rearptr = newroot; while (ptr != null) { printf("here"); if ((root->frequency) == (ptr->frequency)) { // special case: determine read hierarchy repeated // entries if ((root->read_order) < (ptr->read_order)) { if (ptr == newroot) { root = root->next; temproot->next = newroot; newroot = temproot; ptr = null;

Javascript: edit an images height in a for loop -

i'm trying edit images height repeating in loop in javascript can't figure out need add in. here variables if it's important: var i; var start = 1; var seg = document.getelementbyid("selsegs").value; var parent = document.getelementbyid("divinch"), //parent appendchild imagepath = 'inchwormsegment.gif', //variable image img; //adding img element here loop: for(i = start; i<=seg; i++) { img = new image(); //creating new image object img.src = imagepath; // element src = imagepath img.style.height = "215px"; // sets height of in loop // img.style.height = (img.style.height * .9) + "px"; - nothing parent.appendchild(img); //appendchild adds child (img) object } i've tried adding in math can't figure out supposed go let me know if fiddle accomplishes trying do: http

javascript - How to select optgroup -

is there way select optgroup ? it seems disabled time. have tried searching javascript solutions not find ones. well can have example here: http://www.w3schools.com/tags/tryit.asp?filename=tryhtml_optgroup its more tag, tell options below. or caption. if want select multiple ones might use jquery created select. mean custom one, or can use checkboxes , merge them in list select tag. there no other way select 2 options 1 select element. each select must have 1 , 1 value. other way add value each option, , seperate them using , . there no option select optgroup way group options under or more label them. i getting warning alert missing point, want click on optgroup , select value under it? think might condition!

iphone - TabBars and iOS 7 -

i have uitabbarcontroller i'm pushing controller on top of using uinavigationcontroller. on ios 6 , below, tabbar of parent controller slides away , toolbar of new view controller presented. on ios 7 tabbar doesn't animate away if run code [self.navigationcontroller settoolbarhidden:yes animated:no]; edit - okay narrowed problem ios 7 not respecting hidesbottombarwhenpushed property, followed answers in hidesbottombarwhenpushed ignored in ios 7 didn't work. view pushed has toolbar buttons , buttons responding touches, it's tabbar on top of toolbar. in ios7 need set property hidesbottombarwhenpushed yes on presented controller instead of presenter controller hides tabbar.

php - CSS Sprites displaying wrong image - works in localhost -

the server removing space between background-position properties of sprites causing sprites display first image of sprite instead of image should displaying. used work fine on server , still works fine on localhost. haven't made changes server though ... suggestions? website http://hiphopvip.com you have bug in minimizing script script minify css files , replace every space '-' that's why background-position doesn't work way it's supposed to. what class using miminizing css?

java - Selenium firefox driver takes 30-40 seconds to launch firefox -

i developing tests using selenium webdriver 2.3 , initializing browsers below: if (testbrowser.equalsignorecase("mozilla")) { dvr = new firefoxdriver(); system.out.println("invoking firefox in system"); } else if (testbrowser.equalsignorecase("ie")) { file file = new file(system.getproperty("user.dir")+"/iedriverserver.exe"); system.setproperty("webdriver.ie.driver", file.getabsolutepath()); dvr = new internetexplorerdriver(); } else if (testbrowser.equalsignorecase("chrome")) { file file = new file(system.getproperty("user.dir")+"/chromedriver.exe"); system.setproperty("webdriver.chrome.driver", file.getabsolutepath()); dvr = new chromedriver(); } evertime firefox launched takes 30-40 seconds, while launching rest of browsers chrome or safari e.t.c launch within seconds. though tried solution suggested in blog below didn't work me: https://groups.goog

c# - Dependency property in custom control is sharing memory/values unexpectedly -

i have following set up: custom wpf control (base class), deriving canvas implementation of base class an observablecollection<t> dependency property on implementation i have test app displays 3 unique instances of custom control (e.g. <custom:mycontrol x:name="test1" /> , test2, test3, , on). when run , debug app, contents of observablecollection<t> same 3 instances of control. why this? chart: [contentproperty("datagroups")] public abstract class chart : canvas { static chart() { defaultstylekeyproperty.overridemetadata(typeof(chart), new frameworkpropertymetadata(typeof(chart))); } public observablecollection<chartdata> datagroups { { return (observablecollection<chartdata>)getvalue(datagroupsproperty); } set { setvalue(datagroupsproperty, value); } } public static readonly dependencyproperty datagroupsproperty = dependencyproperty.register("datagro

emacs - enable other minor mode after calling for my node -

i'd write minor mode switches several other modes when run. kind of umbrella mode. now i'm stack simplest task - create mode enables single other mode. i'v wrote (require 'whitespace) (define-minor-mode myspace-mode "some doc" nil nil (if myspace-mode (whitespace-mode 1) (whitespace-mode -1) ) ) when toggle mode m-x nothing happens. when evaluate directly (whitespace-mode ±1) works expected. what miss? there 1 parameter missing definition. reason, (if ...) form interpreted keymap parameter. try this: (define-minor-mode myspace-mode "some doc" nil nil nil (if myspace-mode (whitespace-mode 1) (whitespace-mode -1)))

php - Bootstrap typeahead and forms - Object of class mysqli could not be converted to string -

i have having issues twitter's bootstrap type ahead. far going smoothly, when drop value user selected in typeahead form , post update function script below error catchable fatal error: object of class mysqli not converted string in the below php , mysql code $race_name = print_r($_post['race'],true); echo gettype($race_name); echo $race_name; $race_query= mysqli_query($dbc." select city, date, name, state race_info name '$race_name'")or die ('could not find race: '.mysqli_error()); as can see have tried force variable string. when echo gettype confirms string, still receiving error.

how data types in the Java programming language map to the data types in native programming languages such as C and C++,specifically -

chapter 3 of book "the java native interface programmer’s guide , specification",which says "the mapping of primitive types straightforward",i'm little confused sentence. know size of c data types uncertain,it depends on environment program run ,complie... such size of int type may 2 bytes or 4 bytes. size of java data types definite.the size of int 4 bytes. so,how jni map data types between java , c/c++ clearly. any answers appreciated! well, in c, there module called stdint.h defines types int64_t , int32_t , , friends, make mapping "straightforward." but you're right note in particular implementation of c, size of plain old int not specified exactly. author indeed pretty loose word "straightforward," , assuming read claim "java's int maps c signed integer type of 32 bits."

android - How to calculate distance from different markers in a map and then pick up the least one -

i have distance different markers on map current location of device , pick shortest one. have lat , long markers , current location lat , long can fetched dynamically. suppose have 5 markers on map, bangalore (lat : 12.971599, long : 77.594563), delhi (lat : 28.635308, long : 77.224960), mumbai (lat : 19.075984, long : 72.877656), chennai (lat : 13.052414, long : 80.250825), kolkata (lat : 22.572646, long : 88.363895). now suppose user standing somewhere near hyderabad (lat : 17.385044, long : 78.486671). when user clicks button, app should calculate distance each marker , pick , return shortest one, bangalore here. there way possible of local databases. can on please.? can suggest me nice way this, or come code if please can. thanx in advance. from comment see expect maximum of 70-80 locations. not much. you can brute force search on markers , take minimum. iterate on markers, , search min distance: list<marker> markers = createmarkers(); // return

apache - htaccess redirect subdomain to subfolder of another domain -

i'm using .htaccess proxy redirect content of subdomain subfolder of domain as: www.domain1.com/support show content site1-support.domain2.com while keeping address bar showing hxxp://www.domain1.com/support. to this, i've created empty folder called "support" under www.domain1.com , add .htaccess: <ifmodule mod_rewrite.c> rewriteengine on rewriterule ^/?support/(.*)$ http://site1-support.domain1.com/$1?proxy=http://site1-support.domain2.com [p] </ifmodule> this works, whenever there ? in url doesn't show page, such hxxp://www.domain1.com/kb.php?article=1 any htaccess gurus out there? if want forward article=1 redirectrule should add qsa flag. rewriterule ^/?support/(.*)$ http://site1-support.domain1.com/$1?proxy=http://site1-support.domain2.com [qsa,p] hope helps, , understood question correctly. :)

ios - How do I define my app home screen group name? -

Image
i'd define default folder name on home screen apps (which ad hoc distributed), such default apps when dragged ("productivity", "utilities", "games", "navigation"): instead of default name "folder": how can achieve this? edit: i tried adding lsapplicationcategorytype info.plist, doesn't seem affect anything. i think work on appstore versions. tested bunch of ad-hoc releases , appstore releases. - ad-hoc releases - "folder" name appears. appstore versions - app, moved onto other app - it's category name used. (in case ad-hoc moved onto appstore app, appstore app's category used). anyways, checked out lsapplicationcategorytype https://developer.apple.com/library/ios/documentation/general/reference/infoplistkeyreference/articles/launchserviceskeys.html#//apple_ref/doc/uid/tp40009250-sw8 did use example "education" - public.app-category.education ? either way - might not

android - Location update in background service not working after exit application -

i have implemented service updates location in background, android app not working(crashed) while existing application using key. following code. public class locationservice extends service { private static final string tag = "location"; private locationmanager mlocationmanager = null; private static final int location_interval = 0; private static final float location_distance = 0f; private static context mcontext; private static int messagecount; private class locationlistener implements android.location.locationlistener{ location mlastlocation; public locationlistener(string provider) { mcontext = (context)locationdetails.locationcontext; log.e(tag, "locationlistener " + provider); mlastlocation = new location(provider); } @suppresswarnings("deprecation") @override public void onlocationchanged(location location) { try { messagecount++; log.e(tag, "onlocationchanged: "

wpf Datagrid :which Validation method is best for datagrid -

i want validate datagrid cell namely item column when user input against database table itemmaster .my doubt method best me validate input ,validationrule or idataerrorinfo ? this question 100% duplicate. have found answer yourself. use idataerrorinfo because able validate input inside viewmodel able access values/properties/data if needed validation. futhermore able swap viewmodels , change validation not able achieve validationrules easly. validation of viewmodel properties should done in viewmodel. centralized , testable. shouldnt not become part of view except has whatever reason. you should use validationrules when have binding between 2 control properties in scenario validation belongs "view" anyways , stays inside view part of mvvm.

savefiledialog - Save ArrayList into CSV-File Apache Wicket -

how can "write" arraylist in file, can download after writing? 1 element in list 1 line in csv-file. for example: have arraylist<string> mylist = service.getlist want write in file. in simple client-only-application easy. have apache wicket . nice, have filebrowser, can specify, in directory want download it. i thought, work way: final file filetosave = new file("exported objects.csv"); writer writer = null; try { writer = new bufferedwriter(new filewriter(filetosave)); writer.write(""); (obj o : listo) { writer.append(o.getasd); } } catch (ioexception ex) { // report } { try { writer.close(); } catch (exception ex) { } } but won't. have use jboss-server . on local jetty-served worked, on jboss-server it's not possible way. wicket-version: 1.4.7 see wick

if statement - Continue the search inside a DO loop -

i wrote simple fortran code in order following: assume have integer numbers n1 , n2 have common divisors. example 3 , 6 both divided 3. here code program test integer i,n1,n2 write(*,*)' please enter 2 numbers: ' read(*,*)n1,n2 i=2,10,1 if(mod(n1,i).eq.0.and.mod(n2,i).eq.0)then n1=n1/i n2=n2/i endif n1=n1 n2=n2 enddo write(*,*)n1,n2 pause end this works fine example (3,6). however, there cases (4,8) in numbers have more 1 common divisor, in case 2 , 4. example (16,24). want compute maximum common divisor of 2 numbers , reduce them (i.e. 3,6 1 , 2), code returns first 1 (4,8 returns 2, 4 instead of 1,2). how should modified in order calculate maximum divisor? many in advance! you stay i , till if -statement false . in other words: if number can divided i , don't go i+1 , try divide i again. edit: think easiest way use do while -loop. calculate divisor, have multiply i . gcd = 1 i=2,10,1 while (mod(n1,i).e

android - Class Cast Exception with Fragment lists and Activities -

Image
i'm inexperienced java , nearing finish of first android app, when worst fear happened , reached error have don't know how interpret. the basics of app 5 lists, selected drawer menu. each list opens static xml views contents on it. works in portrait smoothly. in landscape, view dualpane, list on left, , contents on right. getting there works fine too. error when go landscape on 1 list, later on try going landscape on list. can please try me figure out happening? main activity import android.content.context; import android.content.intent; import android.content.sharedpreferences; import android.content.res.configuration; import android.net.uri; import android.os.bundle; import android.support.v4.app.actionbardrawertoggle; import android.support.v4.app.fragment; import android.support.v4.app.fragmentmanager; import android.support.v4.app.fragmenttransaction; import android.support.v4.view.gravitycompat; import android.support.v4.widget.drawerlayout; import android.