Posts

Showing posts from July, 2012

javascript - Regular expression Spanish and Arabic words -

how can write regular expression matches valid spanish , arabic words. in english know, a-za-z , in hebrew א-ת , in russian А-Яа-яёЁ . use javascript. the range a-za-z english words unacceptably simple , naïve. leaves out manner of letters accents , other special marks used in loan words, etc. instance, won't match word "naïve", first sentence. use \p{latin} script, instead. the range א-ת hebrew words wrong. leaves out hebrew presentation forms, cantillation marks, yiddish digraphs, , more. use \p{hebrew} script, instead. the range А-Яа-яёЁ russian again incomplete , wrong. use \p{cyrillic} script, instead. the spanish alphabet uses same 26 letters english, plus ñÑ. again, don't hardcode these range. many spanish words use accented vowels. use \p{latin} script match spanish words. regexes won't distinguish spanish english. for arabic, use \p{arabic} script. javascript, regex, , unicode you said you're using javascript. unfor...

C# - What is the Select Source dialog as it applies to the GetDevice method? -

i trying use method described this: public device getdevice(string productname) the productname name of device appears in select source dialog. what select source dialog that's being referred to? as this link mentions (look " showing “select source” dialog " heading), dialog allows users select isis device. it's part of dotimage framework, called showselectsource , used this: isisdevice dev = null; if (this.acquisition.showselectsource(this)) dev = this.acquisition.devices.default; i guess works folderbrowserdialog . user selects device of choosing , can use selection retrieve device getdevice .

javascript - Flowplayer on IE8 Loading issues -

hay guys im trying use flowplayer load videos on flyout on ie 8. think not compatability issue since have page videos load , player displayed. occures when try load video using java script onto flyout. of bliack space player should be. <!-- internet explorer flyout --> <div id="videoflyoutie<?=$itemz['newsid']?>" class="popupwrapper" style="display:none;position:absolute;top:10px;left:auto;"> <div class="firstpopupdiv" style="left:center;height:auto;width:620px;"> <div class="popupdivinner" style="display:block;" class="hidesteps"> <h1 style="color:#333333;" ><?=$itemz['title']?><div id="title"></div></h1> <hr/> <div id="tst<?=$itemz['newsid']?>"> <ce...

c# - Conver radiobutton to a char -

Image
i have 3 radio buttons. please see image. i define variable char temp; what want if "male" selected temp = "m"; if "female" selected then temp = "f"; if "both" selected then temp = "b". my unfinished code: temp = convert.tochar(this.controls.oftype<radiobutton>().firstordefault(r => r.checked)); thanks advice. edit: controls in groupbox. in debug mode. got error. ?groupbox4.controls.oftype() {system.linq.enumerable.oftypeiterator} source: null , ?groupbox4.controls.oftype().firstordefault(r=>r.checked).text expression cannot contain lambda expressions edit 2: see image. run code exception. if understood correctly, based on (not-so-recommended) assumption each radiobutton's name starts different letter. temp = convert.tochar(this.controls.oftype<radiobutton>().firstordefault(r => r.checked).name.substring(0, 1)); edit: same assumptio...

php - Find most favored area on an image -

what mean-stat-equation should use when have image n-number sample-size of selections? i have unique problem hoping advice, don't miss out on anything. problem: find favored/liked/important area on image based on user selection of areas in different selection ratios. scenario: consider image of dog , , hundreds of users selecting area on image in various resolutions, obvious area of focus in selections area containing dog. can record x1,x2,y1,y2 co-ordinates , put them db, if want automatically generate versions of image in set of resolutions should able recognize area max attraction of users. methods think work are: find average center point of selections , base selection in that. - simple not accurate. use algorithm k means or em clustering don't know 1 best suited. looking forward brilliant solution problem more info on problem: actual image 1024x768 image, , selections made on of common mobile phone resolutions. objective automatically generate mobile phone...

javascript - echo text from input -

i trying make basic border radius generator. have input field user type in number of choice shown below: <label>border radius:</label> <input name="border-radius" class="jj_input" type="text" size="2" /> i have output area want number have typed in appear before "px" <div class="yourcode"> border-radius: *number_appears_here*px; </div> im not sure how go this, please point me in right direction. please let me know if has been answered already. in advance. the input element has onchange (or onkeyup) event can use. can execute javascript inside event sets innertext of target div. onchange fires after validation (mostly means when user leaves box). if want change directly after input, , keyboard input permitted, can use keydown/up event. in example below onkeyup used <label>border radius:</label> <input name="border-radius" class="jj_input...

html - Blackberry Scroll issue -

i have created html page blackberry. have done right not able scroll divisions using trackpad. i testing in blackberry bold. here code: <!doctype html> <html> <head> <meta name="handheldfriendly" content="true" /> <meta http-equiv="content-type" content="text/html;charset=utf-8" /> <meta http-equiv="content-type" content="text/html; charset=iso-8859-1"> <meta name="viewport" content="width=device-width,height=device-height,target- densitydpi=device-dpi,user-scalable=no,initial-scale=1.0"> <title>xxxx</title> </head> <body class="claimtype"> <div class="mainwrapper"> <header> <h1>claim type<span></span></h1> </header> <article> <div class="claimtype_content"> <div class="claim_summary"> <h3> <label>plan no:<...

java - Interpolating irregularly located data to -

i trying display colored surface in worlwind java , colors depend on latitude/longitude located values (e.g temperature) set of irregularly located data. i'm using example found in gov.nasa.worldwindx.examples.analytics package. there class interpolator2d there doesn't seem able compute irregularly located data. as far know i'm missing 1 thing in order : way generate grid of regularly placed points set of randomly located points. far don't have way that. putting aside wwj stuff, need way generate interpolated (and maybe extrapolated) grid of values set of arbitrary located values. any idea, code, api or algorithm welcome. doesn't matter if solution not working in lat/lon coordinates, arbitrary coordinates fine. ps : want in java : https://stackoverflow.com/a/3867302/1435322 thanks.

jquery - Replace live() with on() -

from documentation $(selector).live(events, data, handler); // jquery 1.3+ $(document).delegate(selector, events, data, handler); // jquery 1.4.3+ $(document).on(events, selector, data, handler); // jquery 1.7+ i'm using jquery 1.7.1 this works, static elements , dynamically loaded elements: $("input").live("change", function () { alert("hello"); }); this doesn't work, not static elements: $("document").on("change", "input", function () { alert("hello"); }); what missing? write like $(document).on("change", "input", function () { alert("hello"); }); you can replace document closer parent element exist in dom better performance. like $('#closest_static_container_id').on("change", "input", function () { alert("hello"); }); if use $("document") jquery search node/tag ...

JSF navigation and passing parameters -

i'm having problems jsf navigation , passing parameters; scenario: three pages: artists, albums, tracks for each page bean: artistbean, albumbean, trackbean (session scoped) the artist page contains list of artists, each artistname link , when clicking navigate album page lists albums artist. similarly, when clicking album, navigate track page list of tracks album. the links looks follows: page artist: <h:commandlink action="#{albumbean.showalbums(artist)}" value="#{artist.name}" /> page album: <h:commandlink action="#{trackbean.showtracks(album)}" value="#{album.name}" /> the beans looks follows: albumbean: public string showalbums(artist artist){ [generate list of albums, fetched page "albums" using getalbumlist()] return "albums"; } public list<album> getalbumlist(){ return albumlist; } trackbean: public str...

windows - Loading two dlls which are themselves statically linked with different version of a library causes a crash when these both are loaded in a executable -

we have 2 dlls , b. both use different versions of library c linked statically them. when load these dlls in executable, , use functionality program crashes. can explain reason behind , how fix it? see issue in xp , works fine in windows 7 (somehow) the program crashes because different versions of c dll have different type definitions conflict each other. if have fields don't exist in 1 version , exist in another, depending on type of dll, you'll 2 different scenarios. managed fail bind , tell that. unmanaged corrupt memory , nasty error elsewhere unexpectedly. you're seeing different behavior between oses because xp memory management differently 7 (leading me believe it's unmanaged dlls), it's tough tell.

html - Border color order -

i have table every border set 1px width solid. want top, left , bottom border black, , right border white. so, used css code border-right-color: white; border-left-color: black; border-top-color: black; border-bottom-color: black; border: solid 1px; the problem comes in ie9, top right corner pixel white, bottom right corner black. i suspect problem comes form way ie9 reorganize style, because when @ css of table in developper tools console, ordered : border-top-color: black; border-right-color: white; border-bottom-color: black; border-left-color: black; border-top-width: 1px; border-right-width: 1px; border-bottom-width: 1px; border-left-width: 1px; border-top-style: solid; border-right-style: solid; border-bottom-style: solid; border-left-style: solid; this let me think that, maybe, order used defined colors makes top border colored black, right border colored white (overwritting top right corner), bottom border colored black (overwritting bottom right corner...

callback - jquery after click -

is there anyway of checking block element remains empty after click event? because need add data if li remains empty after click $('.order_list li').click(function() { $('#search_block').remove(); if( ! $('#search_block').exists()) { $(this).html(search_box); ... exists custom function found on stackoverflow answer update because of $(this).html(search_box); li's content replaced input box, want set text after user clicks on li, without having selected nothing before. update2 .exists() not problem, problem when user click li , li above remains empty $.fn.exists = function () { return this.length !== 0; } update3 the problem http://jsfiddle.net/vsj96/1/ i think $('#search_block').length is easier. but if want know $('#search_block') has content or not then $('#search_block').contents().length

android - Server To Connect Mobile Device Too -

hi new server application side of things. so here questions. have mobile app connect server based on location, id number, , name. when user enters in information text field , clicks submit, information submitted server app on phone, , based on information server server return user number , there desktop client receive notification new user has been registered or added que list. could give me background on things need study, , things need this? implementation behind be. costly. thanks in advance. how users authenticated? using sql database? if you need make connection database , authenticate provided user credentials

c# - Tiff Image Processing -

i want pass tiff image web service, webservice takes tiff image parameter , have operations on tiff image. please suggest me way pass tiff image parameter web service. thanks in advance. upload tiff using html form, enctype="multipart/form-data" . use httpfilecollection files = httpcontext.current.request.files; in web service (the action attribute of form) access uploaded file: httppostedfile file = files["id_of_field_with_filename"]; . here "id_of_field_with_filename" id attribute of <input> tag of html form contains filename. you can uploaded file, example, save it: file.saveas(somedirectory + path.getfilename(file.filename)); note in solution method of web service (the "action") not have parameters. possible load image using html5 file api, convert base64 javascript, , upload string ajax post web service. in case method of web service need have string parameter receive base64-encoded bytes of image.

ruby on rails - RSpec method not getting called? -

i'm pretty explicitly calling method in spec, appears it's not getting called. i'm new rspec tests maybe puts doesn't work in conditions or something? so have method, perform , , calls find_mentions . logically, i've stubbed out find_mentions inside of perform, because don't want call there. describe ".perform" "calls socialapi methods" # test stuff here facebookjob.stub(:find_mentions) facebookjob.perform(@network.id) end end describe ".find_mentions" "should verify , save formatted facebook message" #test stuff here facebookjob.find_mentions(@network) end end i've put puts statement inside find_mentions, on first line, it's not appearing. why this?

entity framework - Linq: adding conditions to the where clause conditionally -

i have query this (from u in datacontext.users u.division == struserdiv && u.age > 18 && u.height > strheightinfeet select new dto_usermaster { prop1 = u.name, }).tolist(); i want add various conditions age, height based on whether conditions provided method running query. conditions include user division. if age supplied want add query. similary, if height provided want add well. if done using sql queries have used string builder have them appended main strsql query. here in linq can think of using if condition write same query thrice, each if block having additional condition. there better way this? thanks time.. if not call tolist() , final mapping dto type, can add where clauses go, , build results @ end: var query = u in datacontext.users u.division == struserdiv && u.age > 18 && u.height > strheightinfeet select u; if (useage) query = query.w...

numpy - Two-sample Kolmogorov-Smirnov Test in Python Scipy -

i can't figure out how two-sample ks test in scipy. after reading documentation scipy kstest i can see how test distribution identical standard normal distribution from scipy.stats import kstest import numpy np x = np.random.normal(0,1,1000) test_stat = kstest(x, 'norm') #>>> test_stat #(0.021080234718821145, 0.76584491300591395) which means @ p-value of 0.76 can not reject null hypothesis 2 distributions identical. however, want compare 2 distributions , see if can reject null hypothesis identical, like: from scipy.stats import kstest import numpy np x = np.random.normal(0,1,1000) z = np.random.normal(1.1,0.9, 1000) and test whether x , z identical i tried naive: test_stat = kstest(x, z) and got following error: typeerror: 'numpy.ndarray' object not callable is there way two-sample ks test in python? if so, how should it? thank in advance you're using one-sample ks test. want ks_2samp : >>> scipy.sta...

iis - How do you take a C# script and make it output a html page? -

i code in php , python, in case have make in c#. i have code, works good. console application. but how can make c# .net can put on iis? basicly instead of outputting console, should write browser. i have tried search c# web, not find anything. thanks help! using system; using system.net; using independentsoft.exchange; namespace sample { class program { static void main(string[] args) { networkcredential credential = new networkcredential("username", "password"); service service = new service("https://myserver/ews/exchange.asmx", credential); try { isgreaterthanorequalto restriction1 = new isgreaterthanorequalto(appointmentpropertypath.starttime, datetime.today); islessthanorequalto restriction2 = new islessthanorequalto(appointmentpropertypath.endtime, datetime.today.adddays(1)); , restriction3 = new and(restriction1, r...

iphone - Automatic relaunch an iOS App -

i'm writing app connects bluetooth 4.0 device. because related personal security, other active in suspend, i'd nice implement sort of 'auto relaunch' mode. i thought wasn't permitted, couple of apps pretend it. first 1 new version of skype , other find car smarter indicated in faq . the former perhaps use kind of voip options , clue latter? in settings panel, appropriate setting enable mysterious cell tower monitoring , haven't found information that... indeed, voip services can allow behavior. ios app programming guide rather keep voip apps awake time, system allows them suspended , provides facilities monitoring sockets them. when incoming traffic detected, system wakes voip app , returns control of sockets it. other method, not aware of way automatically launch app without user intervention.

jquery - Trouble with converting an array of strings into an array of objects-JSON.parse -

i know not horribly difficult based on i've been reading, keep getting error msg. along lines of unexpected identifier. https://gist.github.com/2869105 the gist shows relevant info i'll add main js here. - content_for :javascripts - cache('search_autocomplete') :javascript $(function(){ var products = #{auto_complete_products.to_json}; $("#keywords").autocomplete(products,{ appendtoelement: ".autocomplete" }); }); this how set up. want convert array of strings array of objects, adding image along current name when autocomplete occurs. rails 3.0.7 mac os x lion haml/sass note second file in gist tried, did not work. any appreciated. thanks! i use autocomplete feature way: $('#keywords').autocomplete({source: array_or_hash_or_path}) . so guess need this: $("#keywords").autocomplete({source: #{auto_complete_products.to_json}})

asp.net mvc 3 - Setting table level WillCascadeOnDelete not available -

i'm pulling out hair here. i've seen solutions turning off cascade on delete here, can't implement it. don't know i'm doing wrong here, keep getting below error: 'system.data.entity.modelconfiguration.entitytypeconfiguration' not contain definition 'willcascadeondelete' , no extension method 'willcascadeondelete' accepting first argument of type 'system.data.entity.modelconfiguration.entitytypeconfiguration' found (are missing using directive or assembly reference?) i've added necessary namespaces, don't see option anywhere in intellisense , i'm not getting anywhere searching. i'm in vs 2010 mvc 3 using system; using system.collections.generic; using system.linq; using system.web; using vf2.models; using vf2.models.linktables; using vf2.models.requests; using system.data.entity; using system.data.entity.modelconfiguration.conventions; using system.data.entity.modelconfiguration.configuration; using system....

iphone - Apple says The app references non-public selectors in my app. What does that mean? -

i have uploaded app , application loader has given me warning. went on see mean , found using third party apis due might rejected. can know due library or code saying this? also, app gonna rejected sure? don't wanna wait 10-12 days , know app got rejected. how confirm thing won't or rejected in shorter time?? please help. okay got answer myself. flurry sdk using older version v2. when updated v3 , problem resolved. anyways thanks. :) p.s can check if flurry outdated checking header file. if says, flurryapi.h v2 , if says flurryanalytics v3.

cocoa - How to setup bindings for NSPopUpButton -

i want bind selection of nspopupbutton 1 of predefined values. make simpler, imagine blog app: i'd have blogpost , category entities (core data, although doesn't matter) , each blogpost object has link 1 of category objects (through category property). i want have user change category through nspopupbutton, in xib, have nsarraycontroller holds possible categories , bind button's content values to: bind to: categoriesarraycontroller controller key: arrangedobjects model key: title this nicely populates pop titles of categories. can bind selected object to: bind to: blogobjectcontroller (or directly blog object) controller key: selection model key: category this works , correct category selected in pop up, changing selection doesn't change category under blog post filed, instead changes title of post category selected value. given above bindings makes sense, next step change binding of pop up's content values arrangedobjects (no model...

linux - How to read input while installing Debian package on Debian systems -

i have created small debian package has take input user , print out. in order take input user "read" command on postinst scripts not work on debian systems don't know exact reason, worked in ubuntu systems. later have figured out have use "debconf" debian systems using template file. template file: template: test/input type: text description: enter text, displayed postinst script: db_get test/input echo "you have entered ::$ret" >&2 but when install test package error: can't exec "postinst": no such file or directory @ /usr/share/perl/5.10/ipc/open3.pm line 168. <br>open2: exec of postinst configure failed @ /usr/share/perl5/debconf/confmodule.pm line 59 does know have done wrong? your postinst script should following: #!/bin/bash set -e . /usr/share/debconf/confmodule case "$1" in configure) db_get test/input echo "you have entered ::$ret" >&2...

objective c - When does setter method get called from UIView subclass -

i taking free stanford course on itunesu(193p) , created setting class subclass of uiview , created public property called scale. idea when pinch, scale of view changed accordingly confused when setter of property scale gets called. here relevant code below: @interface faceview : uiview @property (nonatomic) cgfloat scale; //anyone wants publicly can set scale -(void)pinch:(uipinchgesturerecognizer *)gesture; @end @synthesize scale = _scale; #define default_scale 0.90 -(cgfloat)scale{ if(!_scale){ return default_scale; }else { return _scale; } } -(void)setscale:(cgfloat)scale{ nslog(@"setting scale"); if(scale != _scale){ _scale = scale; [self setneedsdisplay]; } } -(void)pinch:(uipinchgesturerecognizer *)gesture{ if ( (gesture.state == uigesturerecognizerstatechanged) || (gesture.state == uigesturerecognizerstateended)){ self.scale *= gesture.scale; gesture.scale = 1; } } whe...

iphone - problems creating static library with CoreData - Cannot create an NSPersistentStoreCoordinator with a nil model -

how reference model have created in static library project? this returns null , throws , error because resources live in static library: //this code in static library - (nsmanagedobjectmodel *)managedobjectmodel { if (__managedobjectmodel != nil) { return __managedobjectmodel; } nsurl *modelurl = [[nsbundle mainbundle] urlforresource:@"ecommerceengine" withextension:@"mom"]; __managedobjectmodel = [[nsmanagedobjectmodel alloc] initwithcontentsofurl:modelurl]; return __managedobjectmodel; } how change pull static library? on iphone, static libraries have .a extention , can contain code. means resources (xibs, images, etc…) must packed either in bundle or shipped separately library. see ios library resources

How do I select the base class from the child object in Django (using model inheritance) -

i have base model , 1 inherits it, similar in setup this: class archive(models.model): pub_date = models.datefield() class archiveb(archive): another_date = models.datefield() how access base class child class? example: archiveb_instance = archiveb.objects.get(pk=5) base_instance = archiveb_instance.archive #this doesn't work. according documentation one-to-one relationship automatically created in child figured let me go backwards. reason want because have third non-archive model has foreignkey archive. want foreignkey archive because way third model can relate archive, not specific archive type. i think might looking archiveb_instance.archive_ptr

apache - mod_rewrite for IE6 to static page on webserver -

our new website not work in ie6 , wont make work <1% of our traffic. want serve page lives on webserver served when user comes site in ie6. best way achieve this? great if can provide code snippet also. i able redirect working using this: rewritecond %{http_user_agent} msie\ 6 rewriterule ^(.*)$ /general/notsupported.html [l,r] however, wanted mask url if comes in on www.example.com/uri/querystring stay there serve page saying "sorry" ie6 not supported. thanks in advance! something should it: rewriteengine on rewritecond %{http_user_agent} whatever_the_ie6_user_agent_string_is rewriterule .* /path/to/your/static/page [r]

javascript - notification update when receive ajax respone -

i have method update notification , when update return number of notification , content of notification json type { "friend_request": 4, "request": [{ "user_id": "1", "picture": "/home/sepdau/", "name": "le chanh"}, { "user_id": "2", "picture": "", "name": "yii php"}, { "user_id": "4", "picture": "13366396884.jpg", "name": "minh le"}, { "user_id": "11", "picture": "", "name": "thang phan"}] }​ when receive update number of notification success function updatenotification(){ $.ajax({ url: '/nevergiveup/index.php/site/updatenotification', type: "post", dat...

php - MySQL: <>1 works but =0 doesn't -

when send query like select id private_messages to_id=1 , opened=0 it doesn't return anything select id private_messages to_id=1 , opened<>1 returns results opened=0. opened columns type enum "1" , "0" (default) values. question is, why first query doesn't return anything? since opened enum, should write: select id private_messages to_id=1 , opened='0' enums set of possible strings. the documentation : an enum string object value chosen list of permitted values enumerated explicitly in column specification @ table creation time.

tfs2010 - Moving code from one TFS server to another -

i have local structure of directories , files. codebase latest version of of code. need upload tfs. how upload bunch of folders , files @ once? currently, i'm looking in "source control explorer". see "add items folder". however, can't figure out how upload folders , files project want add to. what doing wrong? thanks! first, make sure local folder mapped tfs workspace. in add items folder dialog set folders , files want in items add , exlcuded items tabs. these items gets list of pending changes. check-in pending changes.

javascript - Getting Facebook Like button (generated by JS) to appear -

i'm using prettyphoto lightbox image gallery. when image pops up, twitter , facebook buttons appear under it. that's built prettyphoto plugin, , works fine. the problem is, facebook button iframe kind (which doesn't allow user enter comment). want replace html5 button (which opens comment box when click it, instead of liking). i want replace (standard fb code iframe button): <div class="facebook"><iframe src="//www.facebook.com/plugins/like.php?locale=en_us&href='+pp_real_links[set_position]+'&amp;layout=button_count&amp;show_faces=true&amp;width=500&amp;action=like&amp;font&amp;colorscheme=light&amp;height=23" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:450px; height:23px;" allowtransparency="true"></iframe></div> ...with (standard fb code html5 button): <div class="fb-like" data-href="inst...

java - adding/removing days from date code fix needed -

i have code here: public static string addremovedays(string date, int days) throws parseexception { simpledateformat k = new simpledateformat("yyyymmdd"); date d = k.parse(date); d = new date(d.gettime() + days*86400000); string time = k.format(d); return time; } it take string formed "yyyymmdd", , adds int days it. should work days negative - substract days date. when it's math, returns string formated "yyyymmdd". at least should do. works small numbers, if try add (or remove), example, year (365 or -365), returns wierd dates. what's problem? should completley way? d = new date(d.gettime() + days*86400000); if multiply 86400000 365 integer cant hold it. change 86400000 long d = new date(d.gettime() + days*86400000l); and fine.

osx - Firebreath Cmake not found when cmake 2.8.8 is installed on MacOsX -

when trying build xcode project following command line: ./firebreath/prepmac.sh projects/ build/ i get: using projects in: /users/uwecerron/desktop/node/projects generating build files in: /users/uwecerron/desktop/node/build note: build files in /users/uwecerron/desktop/node/build should never modified directly. make changes in cmake , re-run script. ~/desktop/node/build ~/desktop/node ./firebreath/prepmac.sh: line 10: cmake: command not found cmake failed. please check error messages there no error messages, , have cmake 2.8-8 installed. suggestions on do? kinect project using depthjs. when installed cmake have ask if wanted install command line links; accidentally told not to. install cmake again , tell install command-line links , should work fine.

r - ggplot: relative frequencies of two groups -

i want plot except each facet sums 100%. right group m 0.05+0.25=0.30 instead of 0.20+0.80=1.00. df <- rbind( data.frame(gender=c(rep('m',5)), outcome=c(rep('1',4),'0')), data.frame(gender=c(rep('f',10)), outcome=c(rep('1',7),rep('0',3))) ) df ggplot(df, aes(outcome)) + geom_bar(aes(y = (..count..)/sum(..count..))) + facet_wrap(~gender, nrow=2, ncol=1) (using y = ..density.. gives worse results.) i precalculating values outside of ggplot2 , using stat = "identity" : df1 <- melt(ddply(df,.(gender),function(x){prop.table(table(x$outcome))}),id.vars = 1) ggplot(df1, aes(x = variable,y = value)) + facet_wrap(~gender, nrow=2, ncol=1) + geom_bar(stat = "identity")

mysql select timestamps between a and b returning all or 0 timestamps -

tried this select * table timestamp_field between 1330560000 , 1336170420 and this select * table timestamp_field >=1330560000 , timestamp_field<=1336170420 both returning empty result set. but this select * table timestamp_field >= 1330560000 returns rows to make things more absurd select * table timestamp_field <= 1336170420 returns empty result set. of course, there exists timestamp values before, between , after 1336170420=4.may 2012. , 1330560000=1.march 2012. timestamp values ok, @ least phpmyadmin shows correct (human-readable) date-time values. created timestamps parsing strings, with update table set timestamp_field = str_to_date(timestamp_string, '%d.%m.%y') guess i'm missing something, can't find what!? mysql expects date literals , not integer ones: select * table date(timestamp_field) between '2012-03-01' , '2012-05-04' to use integers (assuming seconds since unix epoch), first conv...

c# - Remove seconds from local time but keep format -

assume have utc time string converted local time: utctimestring.tolocaltime().tostring(); => "01/31/2012 12:00:00 pm" how remove seconds result string keep format (set in phone settings?) thanks! utctimestring.tolocaltime().tostring("mm/dd/yyyy hh:mm tt"); http://msdn.microsoft.com/en-us/library/8kb3ddd4.aspx as alternative, can use string.format("{0:d} {0:t}",utctimestring.tolocaltime()); string.format("{0:g}",utctimestring.tolocaltime()); http://msdn.microsoft.com/en-us/library/az4se3k1.aspx

webgl - render OBJ file using THREE.OBJLoader -

how render obj file using three.objloader method, i've sample obj format won't render nor see error in chrome dev tool check out objloader usage sample @ https://github.com/mrdoob/three.js/blob/master/examples/webgl_loader_obj.html#l75 (in action http://mrdoob.github.com/three.js/examples/webgl_loader_obj.html ) var loader = new three.objloader(); loader.load( objurl, function ( object ) { scene.add( object ); } );

php sessions, adding url links to users favourites -

i'm trying design site shows user number of different items, them able add items choose 'view later' page, add favourites. when go page item displayed link take them item viewed. don't want users have sign site therefore can't store selections in database,is there easy way in php. i've been puzzling on last 3 days, appreciated :) you can store data on computer either cookies or html5 localstorage. see if example helps. html <a href="#" class="item" id="item1">item 1</a> <a href="#" class="item" id="item2">item 2</a> <a href="#" class="item" id="item3">item 3</a> js var vieweditems = []; $(".item").click(function() { vieweditems.push($(this).attr("id")); localstorage['vieweditems'] = json.stringify(vieweditems) console.log($(this).attr("id")); console.log('viewedit...

Apache rewrite from root folder, force https -

i redirect traffic mysite.com mysite.com/folder, enforce ssl on pages. currently have in httpd.conf found sample somewhere, don't think working correctly of time. rewriteengine on rewriterule ^/$ https://www.mysite.com/folder/ [r] the ^/$ matches if request / , i.e. root of site. else not matched it. try .* instead. note: if rewrite rule active both http , https version, that'll send infinite redirect loop. in case, may need kind of rewritecond test, too.

database - How do I prevent a Datalog rule from pruning nulls? -

i have following facts , rules: % frequents(d,p) % d=drinker, p=pub % serves(p,b) % b=beer % likes(d,b) frequents(janus, godthaab). frequents(janus, goldenekrone). frequents(yanai, goldenekrone). frequents(dimi, schlosskeller). serves(godthaab, tuborg). serves(godthaab, carlsberg). serves(goldenekrone, pfungstaedter). serves(schlosskeller, fix). likes(janus, tuborg). likes(janus, carlsberg). count_good_beers_for_at(d,p,f) :- group_by((frequents(d,p), serves(p,b), likes(d,b)),[d,p],(f = count)). possible_beers_served_for_at(d,p,b) :- lj(serves(p,b), frequents(d,r), p=r). now construct rule should work predicate returning "true" when number of available "liked" beers @ each pub "drinker" "frequents" bigger 0. i consider predicate true when rule returns no tuples. if predicate false, planning make return bars not having single "liked" beer. as can see, have rule counting beers given drinker @ given pub. have rule giving me...

c++ - QWidget Transformation -

Image
i writing application using qt , have "metro style" interface. finished except don't know how make widget appear , disappear. instance, in wpf can animate (uielement.rendertransform).(translatetransform.y) y becomes 0 or negative. how can move qwidget in qgridlayout can hide? example: after doing research figured out way this. instead of letting qt layout handled myself via move , set width/height functions. overriding resizeevent made update values in case window resized. additionally used setmask ensure widget did not leak on unwanted locations in ui.

linux - Maven: mvn --version java.lang.ClassNotFoundException -

i have installed new maven new fedora 17 64bit. details: java -version java version "1.6.0_32" java(tm) se runtime environment (build 1.6.0_32-b05) java hotspot(tm) 64-bit server vm (build 20.7-b02, mixed mode) javac -version javac 1.6.0_32 echo $java_home /usr/java/jdk1.6.0_32 echo $jre_home /usr/java/jdk1.6.0_32/jre echo $m2_home /usr/local/maven/apache-maven-3.0.4 echo $m2 /usr/local/maven/apache-maven-3.0.4/bin echo $path /usr/local/maven/apache-maven-3.0.4/bin:/usr/local/bin:/usr/bin:/bin:/usr/games:/usr/local/sbin:/usr/sbin:/usr/java/jdk1.6.0_32/bin:/home/bujaka/.local/bin:/home/bujaka/bin which mvn /usr/local/maven/apache-maven-3.0.4/bin/mvn but mvn -version throws java.lang.classnotfoundexception. java.lang.classnotfoundexception: org.apache.maven.cli.mavencli @ org.codehaus.plexus.classworlds.strategy.selffirststrategy.loadclass(selffirststrategy.java:50) @ org.codehaus.plexus.classworlds.realm.classrealm.loadclass(c...

sql server - season based database schema/design -

i have simple schema sports registration system till concept of season introduced: a player registers part of team a team registers part of club a team plays in division an organization creates divisions this happens every season. need way keep track of of every season. best approach here? should introduce "season" entity , make many-to-many relationships between entities above applicable? or there way "archive" every season able pull season based data on fly (for reporting , not)? this design allows teams move different division season season, while not having re-created every year (though doesn't allow things winnipeg jets moving phoenix , keeping old name historical season stats). create table dbo.organizations ( orgid int primary key, name nvarchar(255) not null unique -- , ... other columns ); create table dbo.divisions ( divisionid int primary key, name nvarchar(255) not null, orgid int not null foreign key referenc...

mips - f(n), understanding the equation -

i've been tasked writing mips instruction code following formula: f(n) = 3 f(n-1) + 2 f(n-2) f(0) = 1 f(1) = 1 i'm having issues understanding formula means. from understand passing int n doubly recursive program. so f(0) equation be: f(n)=3*1(n-1) + 2*(n-2) if n=10 equation be: f(10)=3*1(10-1) + 2*(10-2) i know i'm not getting right @ because wouldn't recursive. light shed on equation means great. should able write mips code once understand equation. i think it's difference equation. you're given 2 starting values: f(0) = 1 f(1) = 1 f(n) = 3*f(n-1) + 2*f(n-2) so can keep going this: f(2) = 3*f(1) + 2*f(0) = 3 + 2 = 5 f(3) = 3*f(2) + 2*f(1) = 15 + 2 = 17 so recursive method (i'll write java-like notation): public int f(n) { if (n == 0) { return 1; } else if (n == 1) { return 1; } else { return 3*f(n-1) + 2*f(n-2); // see? recursion happens here. } }

performance - Writing a large project using J programming language -

disclosure this "general" question, perhaps without specific answer, not intended flame war. information before embarking on project. i have implement particular project really benefit data structures , abstractions provided j. large project, meant function central component of large (soft real-time) web application. performance important. i have been trying find information usage of j in large commercial or open source projects, unable find information on base decision move forward. have: searched google trends, received following response: "your terms - j programming language - not have enough search volume show graphs." searched on free(code), , not found single project using j searched on sourceforge, , not found single project using j searched on lambda ultimate, , found following discussion obliquely references apl searched on google , bing, , failed find examples of large scale projects in deployment use j would making mistake in u...

asynchronous - Do WCF support Asynchronously operations' invoke within TransactionScope? -

i trying out wcf transaction implementation , come idea whether asynchronous transaction supported wcf 4.0. for example, have several service operations client\service transaction enabled, in client side, use transactionscope , within transaction, create tasks asynchronously call operations. in situation, assuming transaction going work correctly, right? i doubt much. appears if starting ascync operation no longer participating on original transaction. i wrote little linqpad test void main() { using (var scope = new transactionscope(transactionscopeoption.required)) { try { transaction.current.dump("created"); task.factory.startnew(test); scope.complete(); } catch (exception e) { console.writeline(e); } thread.sleep(1000); } console.writeline("closed"); thread.sleep(5000); } public void test() { using (var scope = new transactionscope(transactionscopeoption.required)) { ...

javascript - Simulate a document.body click event -

i having big of issue. have third party js includes , popup info on button click, in iframe. of course, don't have access iframe. 3rd party captures clicks , closes iframe popup. behaviour - i user, click on "3rd party button, iframe popups anchored bottom right". now, if click anywhere on main parent page (my page), iframe closes. here problem. have custom form fields/spans etc.... in capture clicks before bubble document.body never "click". how can fake out? tried "mousedown" , seems propagate up. said like: jquery(document.body).mousedown(function(){ jquery(document.body).click(); }) so, no matter mousedown, try there click happening. doesn't work. not sure why? if attach click onto div , alert - alerts, perhaps "natively" isn't same. any ideas of simulate body click event when/if element clicked on has had native clicked event captures before can bubble up? edit: have tried various things. ie: <div id=...

xcode - Cocos2d Add photo from iphone photo album -

i want add sprite using photo file of iphone. there simple way so? cocos2d support file system. there method photo file. if format of data cocos receive. you can uiimage using uiimagepickercontroller. then can create ccsprite using following code. ccsprite *myspritefromimage = [ccsprite spritewithcgimage:[mypickerimage cgimage] key:@"pickerimage"];

listview - Does CancelEdit work on TListItem in a TListView in Delphi? -

if try listview1.items[0].editcaption; it works expected allowing me edit first items caption, if while editing try listview1.items[0].canceledit; it not cancel editing. there concept i'm missing, bug, or wrong? this seems problem in delphi 2007 , xe2 (and others). i think problem native control, vcl documented (calls listview_editlabel(handle, -1); ), no effect. according documentation of listview_geteditcontrol , sending list view wm_cancelmode should work, doesn't. a test here shows below works, winapi.windows.setfocus(listview1.handle); interestingly listview1.setfocus doesn't.

android - App inventor offline -

android has developing tool called appinventor, have online use or there download or offline option? app inventor taken on mit new home here @ least used need internet connection because run in browser. unless on local network server hosts you'd need internet access. i haven't played time peeked in on , looks same way (operates in browser, syncs cloud).

javascript - Get objects from an object array -

if have array looks this; markers[56] = { label: "one" }; markers[62] = { label: "two" }; markers[87] = { label: "three" }; markers[125] = { label: "four" }; now have js; for (var thismarker in markers) { //what goes here can access "label" property? } i know simplistic later on there many more properties added object not "label". i believe can access this, for (var thismarker in markers) { alert(markers[thismarker].label); }

delphi - Adding attachments to E-mail bound for Evernote E-mail address defeats HTML content type declaration with Indy TIdSMTP component -

i have delphi 6 application generates e-mails send evernote e-mail address, special e-mail address sending documents via e-mail stored automatically evernote account. i have created html documents , sent them evernote e-mail address using indy 9.x tidsmtp component. set content-type ' text/html '. works fine long as don't add attachments e-mail. add attachment, generated e-mail makes evernote web interface interpret e-mail raw html . in other words, see raw html in document display area if had done "view-source" in browser, instead of seeing rendered web page. e-mail attachments adding avi file , wav file if matters. when add attachments both of them show @ bottom of e-mail in evernote web display area. to repeat, don't add attachments document shows pretty web page in evernote web interface. if add attachments, see raw html. can suggest can try fix problem? have enclosed code use send generated document evernote e-mail address below. varia...