Posts

Showing posts from March, 2011

dvcs - Bazaar + X = SDLC. What's X? What Issue tracker to choose? -

i liked overview of bazaar dvcs what's recommended issue tracker use? hope jira+fisheye work looks there's no explicit evidence of it. please point me out proper solution. thanks, roy you can use launchpad or sourceforge hosted solutions. hosting privately can @ fusionforge .

jQuery/JavaScript equivalent of each() for a single element? -

can tell me how update following code first item that's returned in object (data)? know using each() 1 item isn't efficient , improve it. $(data).each(function(num, entry){ if ( num > 1 ) return false; }); here's example of data is: [ { "id": 1, "title": "my post", "permalink":"http:\/\/site.com\/page.html\/", "date":" 2011-05-10 } ] update 2: as data array (i assume json parsed (if not can use jquery.parsejson or json.parse )), can first element simple array access: var first = data[0]; read more arrays . old answer: try $(data).first() // returns jquery object // or $(data).eq(0) // returns jquery object // or $(data).get(0) // returns dom object // or $(data)[0] // returns dom object depending on data have , want do. update: if data javascript object, there no need pass jquery (jquery work

How can I label exclusively by Changeset in TFS? -

we planning move starteam tfs source control , in midst of refining our alm procedures. maybe misunderstanding how labels work in tfs, appears can apply label files changeset . trying create label on only files/versions in specific changeset . i have attempted so: 1) main menu -> source control -> apply label 2) 'new label' dialog appears 3) leave path (dev branch) 4) select 'changeset' 'version' dropdown, enter changeset # 5) click create. ... results in entire branch getting labeled. changeset may 1 - 100s of files, individually labeling files not practical. we time in starteam: label changesets related features, move build label onto labeled changeset. missing fundamental? (thanks guidance) note name... labeling by changeset not labeling a changeset. labeling in tfs marking point in time. when label changeset saying source control looked @ point in time. it sounds more area saying want able find set of changes (chang

Admob on Android - Status bar area not covered when activity is resumed -

i'm experiencing nasty bug trying implement admob in application. thought problem in code, after investigation found present in android-banner-essentials example (available download here ). wonder if ever met problem or maybe knows how deal it. basically, when application has both status , title bar disabled, should use full screen. banner essentials example displays nothing admob banner on top of area available. downloaded example, changed 2 things: added publisher id compile , receive ads ;) added 1 param activity's manifest disable title , status bar: android:theme="@android:style/theme.notitlebar.fullscreen" compiled binary, no matter device launched on (tried nexus one, g1, desire, different android versions), affected same issue: when ad banner displayed press home, once taken home screen press , hold home see launched apps, select banner essentials app. my tests reveal 50% reproduction chance admob banner doesn't go position -the top of

PHP Basic encryption/decryption for URL parameters -

i'm creating standard 'framework' in php own projects. on point want have url parameters encrypted. variables not contain data need hide anyone. there restrictions. no security involved @ all decryption basic characters (a-z,a-z,0-9) optionally salt optionally limit length i've searched internet, contained characters did not prefer due htaccess standards. people asked same question point @ security leaving no suitable answer in case. has encountered this, , has solution think must basic? many in advance. i think not understands want ( including me ). want make "strange cool url" ? replace string want. $string ="ace"; $letters =array( "a"=>'1',"b"=>'2',"c"=>'3',"d"=>'4',"e"=>'5');#etc. $numbers = strtr($string, $letters); ## outputs : 135 edit : think figured out want. making tiny url youtube does. take h

php - Detect session/cookie variable in wordpress to prevent access to documents -

hey guys, i've gotten far code below, trying create ajax search form 'safe' on wordpress blog, detecting session variable or cookie or something <?php @session_start(); if (!array_key_exists(‘authed’, $_session)) { include ‘not_authed.inc’; exit(); } // go business. ?> and i'm trying add this: <?php function checkvalues($value) { // use function on values want check both sql injection , cross site scripting //trim value $value = trim($value); // stripslashes if (get_magic_quotes_gpc()) { $value = stripslashes($value); } // convert &lt;, &gt; etc. normal html , strip these $value = strtr($value,array_flip(get_html_translation_table(html_entities))); // strip html tags $value = strip_tags($value); // quote value $value = mysql_real_escape_string($value); return $value; } mysql_connect ("mysql.*****.com", "****","$*****") or die

activerecord - rails metasearch undefined method 'company_id' -

i'm new rails , need should simple problem. when run code: @search = user.search(params[:search]) @foundusers = @search.all.paginate :page => params[:page], :per_page => 20 @user = @search.where("users.id = ?", params[:id]) if @user.nil? @user = @foundusers.first end unless @user.company_id.nil? @company = company.find(@user.company_id) end i following error statement: undefined method `company_id' # i dont understand because query on database correct (select users .* users left outer join companies on companies . id = users . company_id ((( users . firstname '%s%' or users . lastname '%s%') or companies . name '%s%')) , (users.id = '11')) and company_id user not empty. when type puts @user.name, instead of giving me user name, gives me 'user' many help. @user.name prints user because .where("users.id = ?", params[:id]) still return array try this @users = @search.where(

iphone - CLLocationManager never calls delegate methods -

this question has answer here: why cllocationmanager delegate not getting called in iphone sdk 4.0? 4 answers hi i'm playing around locations on iphone , right start ran problems. i've localized problem , determined it's cllocationmanager that's bugging me. so developed simple application. have view controller cllocationmanager in it. on view did load initialize cllocationmanager , start updating. i've implemented 2 methods didfailwitherror , didupdatetolocation . i've read lot of questions , have learned fare this. have retain cllocationmanager during initialization. it's wise set cllocationmanagers delegate nil during unloading of view (something messages passing cllocationmanager because framework retains , it's never release) all in cant find decent explanation on , how make work. here's code if figure out app

Visual Studio 2008 crashes and has to be restarted when I start the debugger -

my visual studio crashes each time try debug asp.net application. i've been working on application months , has issue come up. i've tried rebooting no avail. when press f5, visual studio freezes , displays no error message. exact same behavior when use "attach process" option start debugger. the problem happens particular application i'm working on. if create new project, can debug project, open original project, it's same story on again. also, should point out "development server" icons appear in system tray , not disappear after frozen visual studio 2008 terminated. has else encountered this? i had sysadmin re-install vs2k8 me. fixed problem. for odd reason, uninstall process took long time surprised sysadmin uninstalled , reinstalled me. wonder if have problem. anyhow, reinstall got me , running again.

ruby on rails - Image in related record won't display on index page -

i have 2 tables, 1 of venuetypes , 1 of mapicons. venuetype belongs mapicon. each mapicon has name , image uploaded paperclip. when view venuetype record have associated mapicon displayed using bit of code: <%= image_tag @venuetype.mapicon.mapicon.url(:mapicon) %> i have table of venues each venue belongs venuetype. however when view venue record on index page mapicon doesn't display image, shows blank div properties set in css class. this code im using atempt display mapicon: <div id="venue_map_icon_<%= venue.id %>" style="position:absolute;" <%= image_tag (venue.venuetype.mapicon.mapicon.url(:mapicon)), :class => "mapicon" %></div> i hope question makes sense, wil try clarify if needed, appreciated! edit mapicon model class mapicon < activerecord::base has_many :venuetypes has_attached_file :mapicon, :styles => { :mapicon => "20x20" } end venuetype model clas

objective c - Do I have to subclass in this case? -

i have uiviewcontroller , uitextview in it. want touchesbegan method in uiviewcontroller, of course, it's being blocked b uitextview. so, have subclass uitextview override resignsfirstresponder? there's got antoher way, otherwise going have create 2 files override method returns no. thanks. update: want display uiactionsheet whenever user taps on screen. want uitextview scrollable. you set uitextview.userinteractionenabled = no (this can done in interface builder/xcode 4). touches pass through view behind uitextview. use uicontrol instead of uiview view controller's view if want intercept touches view controller's view. can tell more interaction you're trying create?

Incrementing pointers in C++ -

why 2 following code segments not equivalent? void print (char* s) { if (*s == '\0') return; print(s+1); cout << *s; } void print (char* s) { if (*s == '\0') return; print(++s); cout << *s; } since looks op changed print(s++) print(++s) , hugely different, here's explanation new version. in first example, have: print(s+1); cout << *s; s+1 not modify s. if s 4, , print(s+1) , afterwards s still 4. print(++s); cout << *s; in case, ++s modifies local value of s. increments 1. if 4 before print(++s) , 5 afterwards. in both cases, value equivalent s+1 passed print function, causing print next character. so difference between 2 functions first 1 recursively print character #0, 1, 2, 3, ..., while second function prints 1, 2, 3, 4, ... (it skips first character , prints "\0" afterwards). example: s+1 version, print("hello") result in h e l l o ++s version, pri

Django: any way to avoid querying for request.user on every request? -

for website pretty every page has header bar displaying "welcome, abc" "abc" username. means request.user called every single request resulting in database hits on , on again. but once user logged in, should able store user instance in cookie , encrypt it. way can avoid hitting database repeatedly , retrieve request.user cookie instead. how modify django this? there django plugins need? thanks you want use session middleware, , you'll want read documentation . session middleware supports multiple session engines . ideally you'd use memcached or redis, you write own session engine store data in user's cookie . once enable middleware, it's available part of request object. interact request.session , acts dict, making easy use. here couple of examples docs: this simplistic view sets has_commented variable true after user posts comment. doesn’t let user post comment more once: def post_comment(request, new_comment): if reque

reporting services - Include Empty Values in SSAS MDX query to use in SSRS -

i have cube derived 1 fact table has key , 3 other attributes fact_event (eventid, ageband, location, type) i want use reporting services create report following layout select [event].[location].members on columns, [event].[type].members on rows, [event].[ageband].members on pages [events] [measures].[event count] reporting services likes query flattened , measure in column such as select [measures].[event count] on columns { [event].[location].members * [event].[type].members * [event].[ageband].members } on rows [events] but when performed rows , columns not contain value removed. age band "[0-30]" might have "new york", "london", "sydney" "[31-60]" have "new york", "sydney" i have mdx query return 0 london month. the same goes event type event types mightn't occur particular month row of zeros appear month. create dimensions bas

php - need ideas to only display some pixels and gray out the remaining pixels -

i'm looking ideas ...brainstorming new project client ....i have image ...300px x 300px ...i need display image 1 random pixel @ time until entire image revealed. basically, @ intervals, pixel revealed , remains revealed while other pixels still blank. @ each interval, pixel @ random revealed , remains revealed join other revealed pixels. eventually, pixels revealed. any suggestions on how make happen? i make numerous copies of image , manually reveal 1 random pixel, surely can done programatically :) oh, , cannot form of flash. edit: realize mis-interpreted needed do, thought cool anyway , applied problem... see working demo of following → i threw in jquery. made each pixel 3x3 box instead because otherwise take way long process. seems work pretty on in client side, though haven't tested ie yet. <div id="w"> <img id="i" src="yourimage.jpg" width="300" height="300" /> </div> $

iphone - Writing file to secure server -

i'm trying write text file secure server ..... -(ibaction) startupload{ nslog(@"start upload"); nsstring *mystring = @"testtext"; nsurl *myurl = [nsurl urlwithstring:@"ftp://username:password@72.167.1.1/testfile.plist"]; nserror *error; bool ok = [mystring writetourl:myurl atomically:no encoding:nsutf8stringencoding error:&error]; if (!ok) { // if not ok nslog(@"error writing file @ %@, %@, %@",myurl,[error localizedfailurereason],[error localizeddescription]); } } ... , error message .... error writing file @ ftp://username:password@72.167.1.1/testfile.plist , (null), operation couldn’t completed. (cocoa error 518.) all appreciated i think ftp not supported nsurl, take question: nsurl http:// works fine ftp:// not also take one upload photo arbitrary ftp iphone app

android device OS upgrade for app development -

i thinking getting used htc droid incredible develop android apps, think has android 2.2 on it. os upgradable current android version? if using old android os 2.2 testing of apps, apps work on more current versions of android devices, such honeycomb? they still allow , awesome handset. have 1 rooted cyangenmod 7.0.3 have android 2.3.3. extremely easy bill said. also, use mine tether laptop , wii stream netflix etc @ least verizon hasn't killed free tethering yet. long try avoid using things listed deprecated, should fine running on more up-to-date androids. let me know if need or whatever getting htc inc set developing, love mine.

objective c - Communicating With iPhone With libusb -

i have program wants able have user plug in iphone or ipod touch, receive info based on device using , firmware version have. have read libusb little, i'm unsure on how communicate , info need device. help? take @ irecovery . it's open source tool used assist in jailbreaking ipods , iphones. uses libusb , should started.

mysql - SQL - select the most frequency item -

suppose have table below: id | name ---------- 01 | tony 02 | peter 03 | tony 04 | tony 05 | john .. | .. 99 | david how can use sql statement frequency of field name(tony)? something along lines of: select name table_name group name order count(*) desc limit 1;

C++ Destructor Exception -

i novice programmer working on code school. when following code executed, word bad output. not understand why letter c in destructor not output when writelettersobj object terminated. // lab 1 // #include "stdafx.h" #include <iostream> #include <conio.h> using namespace std; class writeletters { public: writeletters(); void writeoneletter(); ~writeletters(); } writelettersobj; writeletters::writeletters() { cout << "b"; } void writeletters::writeoneletter() { cout << "a"; } writeletters::~writeletters() { cout << "c" << endl; } int main() { writelettersobj.writeoneletter(); cout << "d"; getch(); return 0; } you mixing iostream non-ansi conio.h. make change: // getch(); cin.get(); hey presto, c appears. @ least on os x does. , ubuntu.

asp.net - Align text at bottom of div -

Image
here css .frontslideshow { display:block; overflow: none; height: 323px; margin-bottom: 12px; background-color:#005596; background-image: url(/*edited*/); background-repeat: repeat-x; width:754px; font-family: verdana; font-size:large; color:#ffffff; clear:both; } .frontslideshow .slideshowimage { float: left; vertical-align:text-bottom; padding-right: 24px; } .frontslideshow .slideshowsubtitle { vertical-align: text-bottom; margin-bottom: 10px; } here markup <div class="frontslideshow"> <div class="slideshowmaintitle"> <asp:label id="lblslidetitle" runat="server"></asp:label> </div> <div class="slideshowimage"> <asp:image id="imgslide" runat="server" /> </div> <div class="slideshowsubtitle"> <asp:label id

How does jQuery's "document ready" function work? -

how jquery checking if document loaded? how checking document load finished? check out function bindready in source code . they bind domcontentloaded event (or onreadystatechange on browsers). have fallback regular load event, in case domcontentloaded isn't supported or not fired other reasons. on browsers supporting it, use call: document.addeventlistener( "domcontentloaded", domcontentloaded, false ); on ie <9: document.attachevent( "onreadystatechange", domcontentloaded); the second instance of domcontentloaded in these calls own function - reference ready function right above bindready in source code. function check dom tree done checking document.body . if doesn't exist yet, wait millisecond (using settimeout) , check again. when document.body exists, traverse list of callbacks you've set.

entity framework 4 - EntityList / EntityCollection - MVVM Example -

i'm working new entitylist in april toolkit expose collection in viewmodel. have fk exposed entitycollections. i thought expose collection ienumerable, handles exposure of collection using generic interfaces. leaves fk bind grids/list .... can create enumerable embeded object using entitycollection? "right" way? i've built number of user controls, each own viewmodel. mean page should have viewmodel, other viewmodels aggregated within it? should each control stand on it's own, instanciating it's own viewmodel when user control embedded in page? i know jump on poco classes, i'm on tight deadline, , minimize plumbing code. i'm newbie on testing code, i'm hoping when have more time, can go , fill in. so learn, little time! thanks in advance... you might interested in booklibrary sample application of wpf application framework (waf) . shows how combine entity framework 4 mvvm.

sql server 2008 - How to do write this Join Statement? -

in sql i'm select data more 1 table using join. want select multiple condition , therefor using , , or. here need if jobcode is=1 select data jobcode 1, if jobcode 2 show data jobcode 2.but error when puting jobcode=1 swoing data, 2 same data, 0 same data. i'm making mistake. me. use [recruitment] go /****** object: storedprocedure [dbo].[sp_advancesearch] script date: 05/11/2011 09:47:43 ******/ set ansi_nulls on go set quoted_identifier on go alter procedure [dbo].[sp_advancesearch] @callval int=9, @jobcode int=0, @location_id int=0, @position varchar(20)='', @flag char(1)='', @jobdesc varchar(max)='', @poststreamid varchar(10)='', @graduquali varchar(100)='', @ten2streamid varchar(10)='', @streamid varchar(10)='', @reqexp varchar(15)='', @salary varchar(25)='', @joblocation varchar(15)='', @postdate datetime='', @enddate datetime='', @c_f_name varchar(15)='', @c

c# - How to trace the unsecured http requests from a secured webpage -

i need make website secured after user logged website.but in https pages getting http requests.how can trace them or remove code? one way enable extended logging on iis server , check referrer header fields submitted user-agents.

r - find contiguous responses greater than x -

i'm trying find the point @ participants reach 8 contiguous responses in row greater 3. example: x <- c(2,2,4,4,4,4,5,5,5,5,7) i want return value 10. i tried code (thanks @dwin): which( rle(x)$values>3 & rle(x)$lengths >= 8) sum(rle(x)$lengths[ 1:(min(which(rle(x)$lengths >= 8))-1) ]) + 8 the problem above code works if responses identical , greater 3. code returns zero. if: x <- c(2,2,4,4,4,4,4,4,4,4,7) the code works fine. isn't how data looks. thanks in advance! why don't create new vector contains identical values rle needs work properly? can use ifelse() , put function: fun <- function(x, value, runlength) { x2 <- ifelse(x > value, 1, 0) ret <- sum(rle(x2)$lengths[ 1:(min(which(rle(x2)$lengths >= runlength))-1) ]) + runlength return(ret) } > fun(x, value = 3, runlength = 8) [1] 10

What's the best way to do UJS in rails when you have a re-usable widget? -

in current project have couple instances have re-usable form exists inside rails partial. form submits specific controller via ajax (:remote => true). controller stuff , returns appropriate js.erb modify page via javascript. this works fine when have single view. problem seems happen when re-usable partial exists on multiple views. in view 1 might want issue different set of javascript commands in view 2. as concrete example, have comments controller has normal crud operations. i have partial called _comments_box.erb. _comments_box.erb contains ability submit comment via simple line: - form_for comment, :url => post_comments_path(post), :remote => true |f| this submits comments_controller.rb create method looks somethings this: def create ... stuff, create new comments model respond_to |format| # respond create.js.erb format.js end end the create.js.erb in turn adds comment view, perhaps doing bunch of other updates dom. say render _

iphone - UIKeyboardTypeDecimalPad - change comma to dot -

i use method show keyboard decimal separator mytextfield.keyboardtype=uikeyboardtypedecimalpad; how can change comma dot separator? i have finnish locale. comma, decimals doesn't work on app. -(ibaction)calculate { float x = ([paino.text floatvalue]) / ([pituus.text floatvalue]) *10000; label.text = [[nsstring alloc] initwithformat:@"%0.02f", x]; } ok edit text field using numeric keyboard, dependent on current locale, , text representation of number, dependendt on current locale, too. after editing has finished read , want transform number. to convert use nsnumberformatter this: nsnumberformatter *nf = [[nsnumberformatter alloc] init]; you can setup formatter will, setting locale (!), limits, formatting, decimal/grouping separator, number of decimal digits etc. use it: float number = [nf numberfromstring: field.text]; and that's all! have number if text includes comma, provided let both: keyboard , formatter, have same forma

.net - Is there a scalable alternative to SQL Server Query Notifications for raising events in an application from SQL Server? -

sql server query notifications great tool, doesn't seem built scale well. every application wants/needs notifications has keep open connection database duration of time wants notifications (typically entire time application running). i open creative solutions. off top of head thought of putting service on server subscribe sql server query notifications notify client applications. in case have 1 database connection open (and why not leave open time), , client applications subscribe service notification. ideas?? you may want building own solution using sql server service broker , db_mail or external activators.

admin - Configuration error in django -

i using django mod_python (i know deprecated -- doing exercise), , getting following error -- "could not import project.views. error was: no module named app.models" i getting 'no module named app.models" in several other places well. syncdb working fine, , if go manage.py shell can import models fine. why occurring , need change? thank you. you should use absolute imports everywhere. if project structured so: /project/settings.py /project/app/models.py /project/app/views.py in installed_apps use project.app . in app you'd import models views: import project.app.models , etc. alternately can try adjusting pythonpath imports work. when run ./manage.py in project folder, , python automatically adds pythonpath . doesn't happen automatically in deployment scenarios ( mod_python or other wise).

help in android Edit Text -

Image
hi have lil problem in android edit text made app in m using 2 text fields user name , password , set edittext size manually in 200dip format. when there no text in edit text in perfect size in image below when start typing text , text exceeds size of edittext field expand downwards in second image below. what want when text exceeds size of edittext, should not change size. please help android:singleline="true" should work.

windows - Where should I create a PID/lock file when writing a portable application -

i modifying application have written prevent multiple instances running @ same time. my first thought, (according the linux fhs ) store pid file in /var/run . in way, can check if pid file exists, , exit error if does. now, if want app portable, have consider /var/run not exist on every system (f.ex. windows). what best practice in case? note: not have pid file. 0-byte "lock" file trick well. pid file have advantage of providing pid whomever need investigate problems. clarification: application backup script run defined user. one of way make application rely on porting framework (like qt). such framework provides abstraction of platform, allowing put @ "correct place" (e.g. windows, changes between xp, vista/7). might example have @ qsettings if can't rely on framework, digging code might provide advanced answer.

php - download file from ajax -

i'm setting html exporting excel , doing via jquery $.post. result data $.post('/exporttoexcel.php', function(data) { // data file want download now... how trigger it? }); data returned value (the file) server, doing alert(data) output bigger window full of lol. how trigger file able download? you cannot using ajax. load file in iframe, , send http header file: content-disposition: attachment

ios4 - Place UIButton randomly on the view -

thank great site, biginner in ios programming , find site immensely helpfull. actualy have 2 questions: 1) how transform nsstring nsaray of chars? 2) how place uibutons randomly on view when each button.title shows 1 char new char array? i programaticaly . to transform nsstring nsaray of chars: nsmutablearray *characters = [[nsmutablearray alloc] initwithcapacity:[mystring length]]; (int i=0; < [mystring length]; i++) { nsstring *ichar = [nsstring stringwithformat:@"%c", [mystring characteratindex:i ]]; [characters addobject:ichar]; } 2.place uibutons randomly on view when each button.title shows 1 char new char array uibutton *charbutton = [[uibutton alloc]initwithframe:cgrect(<your required frame>)]; charbutton.titlelabel.text = [characters objectatindex:<ur required value>]; [self.view addsubview:charbutton]

sql server - What is the difference between Index Scan, Table Scan, and an Index Seek? -

can 1 briefly explain what's difference between these 3 index scan, table scan, , index seek? index scan index scan scans each , every record in index. table scan table processed row row beginning end. if index clustered index index scan table scan. since scan touches every row in table whether or not qualifies, cost proportional total number of rows in table. hence, scan efficient strategy if table small. index seek since seek touches rows qualify , pages contain these qualifying rows, cost proportional number of qualifying rows , pages rather total number of rows in table.

c++ - Library to Implement Cross-Platform Unix-More/Less? -

i want show output of c++ program in scrollable fashion shown using programs "more" or "less". need want have additional functionality on top of feature i.e. cscope-like selection of choices . want keep program cross-platform running on windows, linux , mac.

jquery - Set a class or not depending of the item index -

i'm rendering table jquery-tmpl, , don't how pyjama. want set class "shadowed" items index%2==0 . i'm trying with code , apparently have little mess jquery-tmpl syntax: <script id="thecommenttemplate" type="text/x-jquery-tmpl"> <tr {{if ${$item.dataarrayindex($item.data)} %2==0 }} class="shadowed" {{/if}}><td>${reviewer}</td><td>${date}</td><td>${statusfrom}</td><td>${statusto}</td><td>${comments}</td></tr> </script> and call: $.getjson('@url.action("getphotoaudit","photos")/' + id, function (jsondata) { $('#thecommenttemplate').tmpl(jsondata, { dataarrayindex: function (item) { return $.inarray(item, jsondata); } } ).appendto("#audit tbody"); }); what correct sy

functional programming in Java -

how can emulate functional programming in java, specifically, doing things map function collection of items? map(func, new string[]{"a","b","c"}); what's least verbose & awkward way it? unfortunately attempts of functional programming have part of verbose and/or awkward in java. the direct way provide function interface (such this 1 form guava ) , provide kinds of methods take , call (such collections#transfrom() think map() method should do). the bad thing need implement function , anonymous inner class, has terribly verbose syntax: collection<outputtype> result = collections.transform(input, new function<inputtype,outputtype>() { public outputtype apply(inputtype input) { return frobnicate(input); } }); it should noted planned lambda feature of java 8 make considerably easier (and possibly faster!). equivalent code in (the current form of) lambdas this: collection<outputtype> res

touch - Disable a right click (press and hold) in WPF application. -

i working on touch screen application running on windows xp standard. current hardware invoke right click user has click , hold couple of seconds, might interfere other actions holding repeat button in scrollviewer, have decide disable right click. i ideally wan't disable right click on application level, if not possible, disable right click on windows level work me. you can override onpreviewmouserightbuttondown on window , set handled true. need handle onpreviewmouserightbuttonup (thanks vitalij pointing out) that should trick.

delphi - How to set the MirrorType/Stretch options of a slide background in PowerPoint -

i can background image exported, however, when set background tiled "mirror type" option set "both" default. want set "none" , want able set of offsets in stetch options. i have imported 2010 type library delphi can't seem find these options anywhere. tried messing macros in 2010 still couldn't seem see it. tried options thought strecth options e.g. left/incrementleft etc kept getting exceptions like: "shaperange (unknown member): invalid request. operation can't applied background shape." here doing @ moment: slide.background.fill.userpicture('c:\path\to\image.jpg') if dotile begin slide.background.fill.texturetile := msotrue // need set mirror type none end else // need change of stretch offsets

android - noHistory and child activity result -

i have following case: activity a -> activity b (nohistory set) -> activity c i need have result c returned a when c finishes. possible? the way achieve retaining history b , forwarding result c via it. thus, though, if b launched , program restored background, b displayed. prefer b not kept on stack. as confirmed kamen, flag_activity_forward_result should used in such case. tutorial says: if set , intent being used launch new activity existing one, reply target of existing activity transfered new activity. way new activity can call setresult(int) , have result sent reply target of original activity.

file upload - disable request buffering in nginx -

it seems nginx buffers requests before passing updstream server,while ok cases me bad :) my case this: i have nginx frontend server proxy 3 different servers: apache typical php app shaveet(a open source comet server) built me python , gevent a file upload server built again gevent proxies uploads rackspace cloudfiles while accepting upload client. #3 problem, right have nginx buffers request , sends file upload server in turn sends cloudfiles instead of sending each chunk gets (those making upload faster can push 6-7mb/s cloudfiles). the reason use nginx have 3 different domains 1 ip if can't have move fileupload server machine. according gunicorn , suggest use nginx buffer clients , prevent slowloris attacks. buffering thing. however, see option further down on link provided talks removing proxy buffer, it's not clear if within nginx or not, looks though is. of course under assumption have gunicorn running, not. perhaps it's still useful you.

c# 3.0 - WCF OperationContract for both duplex and non-duplex endpoints -

i trying host wcf service supports wshttpbinding , basichttpbinding . reason desktop clients need duplex , windows mobile clients don't. lets have 3 operationcontracts, 2 of them need duplex , 1 of them not. so possible expose 2 operationcontract wshttpbinding , last 1 basichttpbinding ? because when tried error : contract requires session, binding 'basichttpbinding' doesn't support or isn't configured support it. is there way make work? or have make separate wcf services each binding? thanks advice , help. every endpoint exposes all operations service it's representing. you cannot expose "basic" endpoint 1 method of service1 , , duplex endpoint 2 others. if need able kind of flexibility, need create 2 separate service implementations - 1 handles duplex operations, 1 handles others.

javascript - What's the difference between event.stopPropagation and event.preventDefault? -

they seem doing same thing... 1 modern , 1 old? or supported different browsers? when handle events myself (without framework) check both , execute both if present. (i return false , have feeling doesn't work events attached node.addeventlistener ). so why both? should keep checking both? or there difference? (i know, lot of questions, they're sort of same =)) stoppropagation stops event bubbling event chain. preventdefault prevents default action browser makes on event. let's have <div id="foo"> <button id="but" /> </div> $("#foo").click(function() { // mouse click on div }); $("#but").click(function(ev) { // mouse click on button ev.stoppropagation(); }); example $("#but").click(function(event){ event.preventdefault(); }); $("#foo").click(function(){ alert("parent click event fired !"); }); <script src="https://ajax.

qt - Linux, execl(), Why do I lose keyboard input to the application? -

my linux program has name myprogram_0001 , newer versions higher numbers. when started app looks newer version in same directory , if finds 1 calls via execl(). works great, while mouse continues work new version not keyboard input, if click in window beforehand. calling app gone, other running programs continue keyboard input ... ideas ? program written c++ qt designer 4.7 application, shouldn't important, or maybe :-) ? ok, more information ... here's code catches keys , calls slots ... // define own event handler // capture key presses ... bool layout10::eventfilter(qobject *obj, qevent *event) { if (event->type() == qevent::keypress) { qkeyevent *keyevent = static_cast<qkeyevent*>(event); // directly exit on alt-keys if (keyevent->modifiers()&qt::altmodifier) return true; // normal keyboard if ((!(keyevent->modifiers()&qt::keypadmodifier))&&(keyboard_on)) switch (keyevent->key())

How can I animate an object in orbit using HTML5 Canvas? -

lets i've drawn objects, sun in middle , couple of circles planets. can enlighten me how make these objects move around in circular fashion? don't need gravity etc suppose sweet bonus! thanks :) here's crude solution: var canvas = document.getelementbyid('scene'); var ctx = canvas.getcontext('2d'); var w = canvas.width; var h = canvas.height; var circle = function(color, r) { ctx.fillstyle = color; ctx.beginpath(); ctx.arc(0, 0, r, 0, 2 * math.pi, true); ctx.closepath(); ctx.fill(); } var = 0; var redraw = function() { ctx.save(); // paint bg ctx.fillstyle = 'black'; ctx.fillrect(0, 0, w, h); // set origin center ctx.translate(w / 2, h / 2); // draw sun circle('yellow', 20); // rotate + move along x ctx.rotate(i / 100); ctx.translate(100, 0); // draw planet circle('green', 10); ctx.restore(); i++; window.requestanimationfra

winforms - TFS automatically checks out a windows form when the form is opened in VS2010 -

i have vs2010 winforms project several forms , user controls, integrated tfs. every time open 1 of forms in designer, checks out , acts changes have been made, though none have. happens working project, , happens 1 particular form. have idea causing this? i think winforms designer regenerates form.designer.cs file whenever open it, causing checkout. of course file doesn't end different code, got rewritten again. also, if have code in constructor, run designer. maybe code is setting property on control (but not new value) causes designer want regenerate file.

.net - How to effectively use a Visual studio installer for building installations for application? -

i using visual studio installer application. when rebuild application (for setup project created) need lot of manual work create new installation: in application project set new version of build. in project setup need remove old exe-file , add new one. also, shortcuts should recreated , icons should chosen again. doing wrong? there human way build new installation application. your deployment project should in same solution app, , can target 'primary output' of app's project rather manually selecting .exe file: each time project built, uses project output, don't need upgrade except change version of deployment project , build solution in configuration set build deployment project.

c# - MyType<T> DataContract is in the Silverlight client MyTypeOfT -

i have wcf service property<t> datacontract (with knowntype, et cetera...), in silverlight client have propertyofint, propertyofstring, ... types, need in silverlight generic type. how? the soap standard doesn't support concept of generics not supported directly in wcf. however, can achieve this support if control both client , wcf service sharing servicecontract dll between client , service. make sure want since not recommended soa best practice. here is article describes how approach works. sharing servicecontract ( not service implementation dll) , using wcf channelfactory class not need generate proxy class since channelfactory class dynamically you. servicecontract assembly need contain referenced datamember marked classes main flaw of approach because logic contain shared. long datamember classes data transfer objects (dto) you're not bending soa tenents entirely out of shape. article explains how wcf clientbase class.

.net - For Condition VB.NET vs C# -

c#: static class module1 { public static void main() { (index = 1; index <= getcount(); index++) { console.writeline("for {0}", index); } console.readkey(); } public static int getcount() { console.writeline("getcount"); return 10; } } result (c# rechecks condition): getcount 1 getcount 2 getcount 3 getcount 4 getcount 5 getcount 6 getcount 7 getcount 8 getcount 9 getcount 10 getcount vb.net module module1 sub main() index = 1 getcount() console.writeline("for {0}", index) next console.readkey() end sub public function getcount() integer console.writeline("getcount") return 10 end function end module result (vb.net not recheck condition): getcount 1 2 3 4 5 6 7 8 9 10 a) why doesn't vb.net respect "rule" of recheck condition on each iteration? b) is there way force vb re-check conditi

sql server - login timeout expired error on first sql query -

i'm running sql server 2005 , using iis asp scripts. i have problem sql when run sql query (exp : http://[host name] localhost [host name]) @ first time (like when start windows) or when session times out due being idle long, error happens : login timeout expired but after when refresh page, ok , works should be. it looks takes long time run sproc "first" time, on takes less sec execute sproc. sql server generate execution plan stored procedure when runs first time, cause long duration. next times sql can reuse exection plan duration becomes shorter. duration of 46secs abnormal, can try create clustered index on table, in order speed query.

user interface - jquery ui dialog ui-widget-overlay height problem -

i developing facebook app. in app using jquery ui dialog show div content (which comes ajax response). the dialog opens showing content returned ajax call. there weird behavior occurring. page (seems app being called in fb iframe) continuously refreshing if posting data in perpetuity. more, height of "ui-widget-overlay" div , generated dynamically ui dialog, continuously increasing , never seems stable. may these 2 strange behaviors related somehow. can't figure out. due this, if using " modal : true " property dialog, can access whole page behind dialog. a snippet of code: $.ajax({ type : "post", data : "id=1", url : site_url + "lists/add_new", success : function(response) { $('#new_box').html(response); $('#new_box').dialog({ modal: true, position: 'top

Check once per user session - asp.net -

i make call underlying backend 1 time when user first initiates user session. while session up, same call shall never made again. create singleton tied particular session or there better way this? you can place method call in global.asax session_start event. list of available events listed here .

collections - Scala: build a Map from a List of tuples, but fail if there are contradictory entries -

i think might common operation. maybe it's inside api can't find it. i'm interested in efficient functional/simple solution if not. given sequence of tuples ("a" -> 1, "b" ->2, "c" -> 3) want turn map. that's easy using traversableonce.tomap . want fail construction if resulting map "would contain contradiction", i.e. different values assigned same key. in sequence ("a" -> 1, "a" -> 2) . duplicates shall allowed. currently have (very imperative) code: def buildmap[a,b](in: traversableonce[(a,b)]): option[map[a,b]] = { val map = new hashmap[a,b] val = in.toiterator var fail = false while(it.hasnext){ val next = it.next() val old = map.put(next._1, next._2) fail = old.isdefined && old.get != next._2 } if(fail) none else some(map.tomap) } side question is final tomap necessary? type error when omitting it, think should work. implementation of tomap c

sorting - code igniter pagination with sort options -

i'm not sure if i'm ask possible or not.. i'm thinking not thought ask anyways. is there way reset pagination? i've got page has pagination , sort option on it. works fine when 1 of sort options changed send user first page. (i'm pretty sure way i'm doing isn't @ best way result want if have suggestions improvements please feel free.) $array = explode ("_",$this->uri->segment(4)); if(count($array) > 1){ $search_id = $array[1]; $start = $this->uri->segment(5); $uri_segment = 5; }else{ $start = $this->uri->segment(4); $uri_segment = 4; $search_id = null; } $config['per_page'] = $this->settings['products_per_page']; $config['total_rows'] = $this->categories_model->get_num_rows($cat_id , $search_type, $search_data); $query = $this->categories_model->get_category_pages($cat_id

Organizing data output with MySQL -

i have following table data: t1 (results): card_id group_id project_id user_id the tables contain actual labels are: t2 (groups): id project_id label t3 (cards): id project_id label there multiple entries different users. i need writing query display results in table format totals counts corresponding card/group. here's start i'm not sure i'm on right track... select count(card_id) ctotal, count(group_id) gtotal project_id = $projid unless i'm mistaken, seems need group card_id , group_id given project_id , pull out count each group select card_id, group_id, count(user_id) mytable project_id = 001 group (card_id, group_id); edit: taking account card , group tables involves joins, query fundamentally same. still grouping card , group, , constraining project id select c.label, g.label, count(t1.user_id) mytable t1 join groups g on t1.group_id=g.id join cards c on t1.card_is=c.id t1.project_id = 001 gr

Why use sysprep for Sharepoint 2010 Developer VMs? -

i have read several articles creating sharepoint developer vm. "sysprep" them. why (exactly) must sysprep done? kind of problems (and why) run if don't sysprep them? (i suppose asking is, difference in doing "sysprep" , bringing vm, changing name/ip, reboot install sp?) i've had success in past copying hyper-v vhd's method of cloning vm's - however, use sysprep when cloning of machines it's been mentioned best practice in many places. and, nice things allowing cleaning bunch of stuff don't want duplicate , letting me choose new name machine on boot. ms sysprep technical reference : sysprep prepares computer disk imaging or delivery customer configuring computer create new computer security identifier (sid) when computer restarted. in addition, sysprep cleans user- , computer-specific settings , data must not copied destination computer. and may want read russinovich's post on the machine sid duplic

SQL Parentheses use in an OR clause -

was wondering whether know why use parentheses in sql: so, format goes follows: name,location , department of service of employees name starts or b. (a rough translation french). i answered following way: select service.nom_serv, localite.ville, localite.departemen service, localite, employe service.code_loc=localite.code_loc , employe.service=service.code_serv , ((employe.nom 'a%') or (employe.nom 'b%')) basically, last , concerned where, couldn't without parenthesis in order have sql select me employees name starting either or b? difference positioning parenthesis in way make? , ahy there double use of parentheses? or prioritize or in last clause, since , preceding it? take @ operator precedence in sql server (you've not specified that, i'd imagine it's same rdbms). means ands (without parenthesis) evaluated before ors. so in specific case, without parenthesis, conditions are: employe.service=service.code_serv , employe.nom &

python - I want make a query in django opposing of where? -

e.g have models class question(models.model): question = models.charfield(max_length="200") class answer(models.model): question= models.foreignkey(question) so, want question's don't have in answers e.g in answer have question 1 question 2 and in question have question 1 question 2 question 3 question 4 and want result of query question 3 , question 4 thanks i think want is: unanswered_questions = question.objects.filter(answer__isnull=true)

android - Listing all extras of an Intent -

for debugging reasons want list extras (and values) of intent. now, getting keys isn't problem set<string> keys = intent.getextras().keyset(); but getting values of keys 1 me, because values strings, boolean... how values in loop (looping through keys) , write values logfile? hint! here's used information on undocumented (3rd-party) intent: bundle bundle = data.getextras(); if (bundle != null) { (string key : bundle.keyset()) { object value = bundle.get(key); log.d(tag, string.format("%s %s (%s)", key, value.tostring(), value.getclass().getname())); } } (make sure check if bundle null before loop)

javascript - Create an array of objects from fields on a page -

i have page displays hotel data in list. have data on page: <input type="hidden" class="name" value="hotel1" /> <input type="hidden" class="latitude" value="-12.3456" /> <input type="hidden" class="longitude" value="12.3456" /> <input type="hidden" class="name" value="hotel2" /> <input type="hidden" class="latitude" value="98.7654" /> <input type="hidden" class="longitude" value="-98.7654" /> i'd create array of objects values, can loop through each hotel , this: $.each(hotels, function (index, obj) { var name = obj.name; var lat = obj.latitude; var long = obj.longitude; }); you might need change how select dom elements, more-or-less right thing: var $names = $('input[type="hidden"].name'), hotels = $names.map(func