Posts

Showing posts from August, 2015

c# - How to Convert Value into 2 decimal in expression column of data table -

c# - How to Convert Value into 2 decimal in expression column of data table - i want convert value 2 decimal part in look column of datatable. e.g. value = 23.2546876 i want = 23.25 please help me.... i found solution .... there no function convert value 2 decimal might seek using next expression: convert(x * 100, 'system.int32')/100 c# datatable expression

How to use Criterion to measure performance of Haskell programs? -

How to use Criterion to measure performance of Haskell programs? - i'm trying measure performance of simple haar dwt programme using criterion framework. (it erroneously slow, i'll leave question). can't find documentation on web, unfortunately. 2 primary problems are how can 1 pass info 1 benchmark another? want time each stage of program. how sampling work, , avoid lazy evaluation reusing previous computations? this source relatively pared down; first function getrandlist generates list of random numbers; haarstep transforms input signal differences , sums, , haardwt calls former , recurses on sums. i'm trying pass getrandlist haardwt via lazy evaluation, perhaps usage wrong / unsupported. timings don't seem create sense. {-# language viewpatterns #-} import control.arrow import qualified data.vector.unboxed v import system.random import criterion.main invsqrt2 = 0.70710678118654752440 getrandlist :: randomgen g => g -> int -> [f...

css - Inline form fields: search box and button in jQuery-Mobile -

css - Inline form fields: search box and button in jQuery-Mobile - this trying achieve: this get: please view jsfiddle of web-kit browser (chrome or safari): http://jsfiddle.net/kqeqn/ this happening when narrow screen there's still visibly plenty space button. i've looked css trying find sort of padding right of button couldn't. hell horizontal line comes from? i'm not familiar jquery mobile, might doing wrong. guess must add together classes instead of overriding jquery mobile's theme. the prepare involves: .ui-input-search { width: 50px; display: inline-block; } check in action here: http://jsfiddle.net/nqfhq/ css jquery-mobile mobile-webkit

php - How to get Mysqli Stmt to fetch multiple rows correctly? -

php - How to get Mysqli Stmt to fetch multiple rows correctly? - i've been reaching end of ideas crazy problem. using mysqli run next query select * `shop_cart` `tmpid`=? it should homecoming each row in array this: array ( [0] => array ( [id] => 1 [tmpid] => af83abab7fdee8eb0cf8919f171cdeec [pid] => 800 [qty] => 2 [time] => 1310076898 ) [1] => array ( [id] => 2 [tmpid] => af83abab7fdee8eb0cf8919f171cdeec [pid] => 797 [qty] => 1 [time] => 1310076903 ) [2] => array ( [id] => 3 [tmpid] => af83abab7fdee8eb0cf8919f171cdeec [pid] => 883 [qty] => 1 [time] => 1310076907 ) [3] => array ( [id] => 4 [tmpid] => af83abab7fdee8eb0cf8919f171c...

c++ - Regulating IPC between two processes with mutex -

c++ - Regulating IPC between two processes with mutex - i working on project creates 2 processes , want regulate ipc between them. the processes created createproces function, , want utilize mutex ipc. in linux semaphores, have read ipc in windows have utilize mutex. in windows can't seem work. first create treads this: createprocess(ipapplicationname, null, null, null, false, create_new_console, null, null, &startinfo, &processinfo); createprocess(ipapplicationname, null, null, null, false, create_new_console, null, null, &startinfo2, &processinfo2); the processes start normal when remove releasemutex phone call 1 process won't kept waiting in process. here process one: volatile handle hmutex; // global hmutex object int main() { hmutex=createmutex(null,false,null); while(1) { waitforsingleobject(hmutex,infinite); printf("thread writing database...\n"); sleep(2000); ...

sql - get .BAT file or SQLCMD to prompt user for input -

sql - get .BAT file or SQLCMD to prompt user for input - i attempting run next query sqlcmd -stemp7 -e -devolive_base -w256 -qexit("declare @r int exec @r = usp_addtoobservationtbl $,$,$ select @r") i attempting bat file inquire user 3 variables.... can help me ? you can utilize set /p variables: set /p var1=enter variable 1 set /p var2=enter variable 2 set /p var3=enter variable 3 ...then utilize them in command line: sqlcmd -stemp7 -e -devolive_base -w256 -qexit("declare @r int exec @r = usp_addtoobservationtbl %var1%,%var2%,%var3% select @r") bear in mind still leaves open sql injection attacks or entering destructive. sql sql-server-2008 batch-file sqlcmd

iphone - How to disable Copy and Paste in UIWebView -

iphone - How to disable Copy and Paste in UIWebView - when user long-press within uiwebview, there re-create & paste popup. possible disable scheme popup re-create & paste function, still allow user click on links , goto new pages? you can seek injecting javascript webview. code works on iphone when page loaded. http://javascript.internet.com/page-details/disable-text-selection.html or http://solidlystated.com/scripting/proper-way-to-disable-text-selection-and-highlighting/ to work when page half loaded or still loading you'll proably have utilize setup similar 1 inject disabling javascript start selecting. http://www.icab.de/blog/2010/07/11/customize-the-contextual-menu-of-uiwebview/ uiwebview without copy/paste , selection rectangle when showing documents iphone uiwebview uigesturerecognizer

android - Creating Multi-Column Layout with ArrayAdapter -

android - Creating Multi-Column Layout with ArrayAdapter - i've been trying prepare problem while , have exhausted different google searches think of. i'm beginner android, understand of fundamentals (i think). anyways, i'm trying display list of info in multi-column layout spreadsheet style. i'm using listview because need users able click on row more detailed @ info since much can fit in row. have working using simpleadapter, since amount of info can large, 500 entries, wanted alter on lazy loader scheme users don't have stare @ black screen 20 seconds while loads. think can manage lazy loader part, can't figure out how switch on multi-columned format simpleadapter arrayadapter lazy loader examples use. here's illustration of simpleadapter code: simpleadapter adapter = new simpleadapter(this, fillmaps, r.layout.grid_item, from, to); fillmaps list of hashmaps inserted. 'grid_item' layout entries inserted into. 'from...

Ruby Gem for File Downloads -

Ruby Gem for File Downloads - this unnessary question because regards that's painless write yourself...but it's nice utilize existing gem anyway. is there gem downloads urls inquire , keeps track of local copies (and maybe remote changes) in little database , gives me nice object access through? sort of download manager in ruby? ruby gem downloading

php array() w/ foreach only loops if using .= to build the result -

php array() w/ foreach only loops if using .= to build the result - i have frustrating problem cannot result. not adding up. i passing array process on foreach() so: if (is_array($seminar)) { foreach ($seminar $sem_id) $sem_id_list .= "$sem_id"; echo "$sem_id<br />"; } as can see array() $seminar, , output looks so: array ( [0] => 3 [1] => 8 [2] => 9 [3] => 13 [4] => 14 [5] => 15 ) as can see in code, building block w/ =. like: *$sem_id_list .= "$sem_id";* , when echoed out looks like: 389131415 expected. but when trying iterate through , print each value like: *echo "$sem_id";* lastly array() item!! i've never run problem before. guessing missing dead simple here, experience should working , printing results fine. as side note, var_dump($seminar); produces too: array(6) { [0]=> string(1) "3" [1]=> string(1) "8" [2]=> string(1) ...

android - Trouble going back to main activity -

android - Trouble going back to main activity - i'm new android programming , making game. problem dealing multiple activities on stack. have gameover activity phone call when player dies. activity, want homecoming main menu on hitting button. problem when go main menu, , click again, goes gameover screen. have override on in main menu end application? or there improve way this? typically if want activity removed history stack phone call finish() the thing is, unless "game over" started main menu should not go other out of game when press main activity, how many screens , how getting each one main calls startactivityforresult(new intent(a,my.class),intentid); myclass calls etc. android android-activity android-intent stack

objective c - xcode iphone found cause of problem but don't know fix - ad the launching app store -

objective c - xcode iphone found cause of problem but don't know fix - ad the launching app store - i have code in place: - (bool)webview:(uiwebview *)webview shouldstartloadwithrequest:(nsurlrequest *)request navigationtype:(uiwebviewnavigationtype)navigationtype { if ( [request.maindocumenturl.relativepath isequaltostring:@"/upload"] ) { viewcontroller.view.hidden = no; [viewcontroller pushpick:nil]; homecoming no; } homecoming yes; } it supposed intercept webview request when location called equal "/upload", works, when other requests made such url launch app store not work. when remove code admob advertisement launches app store fine, code not. "return yes" not continuing request app store launch. how can prepare this? a uiwebview never opens app store on own. you're overriding different implementation of delegate method handles opening app store, instead of returning yes, should phon...

javascript - Resolve two anonymous functions to the same definition point? -

javascript - Resolve two anonymous functions to the same definition point? - i have code in next form in user may specify callback called @ later time: class="lang-js prettyprint-override"> var _deferred = []; var deferred = function(callback) { _deferred.push(callback); } var dodeferred = function() { for(var = 0, max = _deferred.length; < max; i++) { _deferred[i].call(); } } for(var = 0; < 5; i++) { deferred(function() { console.log("some deferred stuff"); }); } dodeferred(); i recognize callback specified deferred() anonymous function resolving same origin, , allow added once. aka in bottom loop throw exception when = 1. like: class="lang-js prettyprint-override"> var deferred = function(callback) { if(_deferred.indexof(callback) !== -1) { throw "already added!"; } _deferred.push(callback); } i can think of many ways of doing addin...

c++ - How can writing memory to a filebuffer mutate it? -

c++ - How can writing memory to a filebuffer mutate it? - for while now, have been experiencing extremely odd problem when trying write memory filebuffer in c++. problem occurs on mingw. when compile under gcc/linux, fine. debugging session displaying problem so basically, i'm writing code memory buffer filebuffer, , binary representation in file ends beingness different memory wrote. no, file not beingness modified @ later point, ensured using debugger exit programme after closing file. have no thought how possible, used valgrind see if there memory allocation problems, nope. i'll paste of related code. /// struct holding info info file class resourcefile { public: string name; uint32 size; char* data; resourcefile(string name, uint32 size); }; resourcefile::resourcefile(string name, uint32 size) : name(name), size(size) { // free'd in resourcebuilder's destruction info = (char*) malloc(size * sizeof(char)); } /// ...

Facebook FQL: get UIDs who likes a url -

Facebook FQL: get UIDs who likes a url - i want utilize graph api or javascipt sdk. i've tried https://api.facebook.com/method/fql.query?access_token=<accestoken>&query=select user_id object_id="http://www.google.se" but didnt results. don't know how using javascript sdk. any help appreciated, thanks. you can't user id of people page. if have authenticated user, table can used pages current user or friends like, can see likes across facebook specific page. facebook facebook-graph-api facebook-fql facebook-javascript-sdk

How do parentheses work in Perl 5? -

How do parentheses work in Perl 5? - here's devel::repl session (my perl version v5.10.1). explain results, please? 0:main$ $x = 1,2,4 [ 1, 2, 4 ] 0:main$ $y = (1,2,4) useless utilize of constant in void context @ (eval 296) line 8. 4 i'm origin learning perl , still have troubles grokking contexts. anyways, think understand why sec assignment does. that's because we've got scalar context, that's why no list constructed @ all, , end executing comma operator repeatedly, whilst opetator returns right operand. right? however, what's wrong first assignment? shouldn't equivalent sec one? @ point, thought parentheses don't provide magic semantics build lists - grouping elements together, , if elements end beingness used in list context, transformed list. apparently, that's not true. well, ok. special role of parentheses then? devel::repl evaluating each input line in list context, , printing resultant list. first line l...

Can Amazon Web Services (AWS) be used for huge databases? -

Can Amazon Web Services (AWS) be used for huge databases? - i have project requires storage of several dozens of tbs of data. @ first, few tbs of info stored. then, info expected grow @ pace of 5 gb per day. based on business logic, able split across 10,000s of files / tables (each file / table consist of info of size ~ 1 [gb] ). (note: @ given point in time, 10-20 [gb] (say, 20 tables) considered hot data i'll actively query against.) can amazon web services (aws) used store & query such huge amount of data? if instead i'd store info in-house, best way approach (for instance, clear cannot have of info on 1 machine etc...)? lacking info info format, schema, etc, here's how i'd handle it: store info in s3 in map/reduce friendly format use hadoop (or elastic map reduce) query entire dataset when needed. typical pattern utilize m/r answers need ahead of time , store much smaller results in other database. if there's nee...

list of android market to publish app -

list of android market to publish app - hello friends, i need publish app in different-different market not in https://market.android.com/ . need list of can 1 help me? thanks nik websites http://www.appbrain.com, http://www.androidpit.com , http://www.androidblip.com/, market aggregators. scrape market info on new apps (ratings, comments, etc). , set them on website searchable , sortable. don't have special applications on these websites, find app , add together listing. android market official market can to. problem is, there still countries cannot purchase apps in android market. turn alternative markets seek , reach business places. short list include: 1. google android market 2. slideme 3. andappstore 4. handango 5. androidgear 6. phoload 7. mobihand 8. appslib 9. insyde market 10. netdragon 11. kuqu 12. noverca 13. getjar plainly copied http://android.stackexchange.com/questions/2099/where-to-upload-android-application android

c++ - Qt: open context menu on mouse press -

c++ - Qt: open context menu on mouse press - i'm trying alter default behavior of context menus: instead of opening on release event of right mouse button, want open on press event, , it's actions triggered on release event). on 1 widget overload mousepressevent() , fire custom contextmenu event, want global context menus of program... any ideas? thanks. i trying implement widget base of operations on top of qwidget custom way handle context menu suit needs when realize using actionscontextmenu policy actions straight own widget behavior expecting. (qt 4.6.2 & 4.7 on linux, didn't seek on windows yet don't know why behavior should different). is policy can utilize ? if don't really need external menus, i'll suggest go solution. otherwise have create own widget base of operations custom qmenu member. should utilize qt::preventcontextmenu policy guarantee right click end in void mousepressevent(qmouseevent *event) of widget....

iphone - Facebook integration using sharekit? -

iphone - Facebook integration using sharekit? - i did integration facebook using sharekit api .but every time taking username , password entered in .and opening straight sharing screen need open username , password screen , has filled username , password entered , show alternative login different username.how can 1 share code...this code... sharing text.. // create item share (in example, url) nsstring *sometext = @"sharekit facebook integration easiest amoung methods available in ios"; shkitem *item = [shkitem text:sometext]; // sharekit action sheet shkactionsheet *actionsheet = [shkactionsheet actionsheetforitem:item]; // display action sheet [actionsheet showfromtoolbar:self.navigationcontroller.toolbar]; logging out / removing stored logins there 3 methods remove stored credentials: // remove credentials services [shk logoutofall]; // remove credentials specific service // utilize service's class name: ex shktwitter, shkd...

php - Converting a unix time stamp to twitter/facebook style -

php - Converting a unix time stamp to twitter/facebook style - i'm trying convert unix time stamp display facebook , twitter. example, when see tweets or comments placed on twitter/facebook see date/time displayed so: '2 mins ago' or '2 days ago' or '2 weeks ago' does 1 know of function working this. i'm guessing custom one. any help much appreciated if using php might want seek next function posted matt jones http://www.mdj.us/web-development/php-programming/another-variation-on-the-time-ago-php-function-use-mysqls-datetime-field-type/ // displays comment post time "1 year, 1 week ago" or "5 minutes, 7 seconds ago", etc... function time_ago($date,$granularity=2) { $date = strtotime($date); $difference = time() - $date; $periods = array('decade' => 315360000, 'year' => 31536000, 'month' => 2628000, 'week' => 604800, '...

Rails/Formtastic many-to-many ordered list HTML -

Rails/Formtastic many-to-many ordered list HTML - i have post model many-to-many category association. in post form, phone call f.input :categories, :as => :check_boxes , nice ordered list of check boxes. there anyway add together class each <li> using category's name (or category data)? example: <li class="<%= category.name %>">...label , input...</li> <li class="<%= category.name %>">...label , input...</li> <li class="<%= category.name %>">...label , input...</li> thanks! try like f.input :categories, :as => :check_boxes, :value_as_class => true ruby-on-rails formtastic

html - Why double bottom border? -

html - Why double bottom border? - i'm asking help me solving mysterious issue: when visit web page http://www.legrandclub.net/members using ie8 it's displayed double border bottom below search field. how possible? i've checked lot of times css rules haven't found rules can reason of issue. can help me? thanks first search next lines. it's invalid redefine same id. <div id="container"> <div id="content"> <div id="container"> <div id="content"> line 1033 tr not finished properly also line 1059 </div> closing div appear not necessary. html css wordpress internet-explorer-8

java - swt table has limitation on text length in a cell? -

java - swt table has limitation on text length in a cell? - i utilize jface tableviewer , databinding display info of database table, columns have long text, found text cutting out. if activate text editor associated cell, can see total text. does swt table has limitation on text length in cell ? or os has such limitation ?(i using eclipse 3.6 , windows 7 32 bit) /******************************************************************************* * copyright (c) 2006 tom schindl , others. * rights reserved. programme , accompanying materials * made available under terms of eclipse public license v1.0 * accompanies distribution, , available @ * http://www.eclipse.org/legal/epl-v10.html * * contributors: * tom schindl - initial api , implementation *******************************************************************************/ bundle org.eclipse.jface.snippets.viewers; import org.eclipse.jface.viewers.istructuredcontentprovider; import org.eclipse.jface.view...

regex - Parse git - log file with python -

regex - Parse git - log file with python - so need parse thing : commit e397a6e988c05d6fd87ae904303ec0e17f4d79a2 author: name <email@email.com> date: sat jul 9 21:29:10 2011 +0400 commit message 1 files changed, 21 insertions(+), 11 deletions(-) and author name , number of insertions , deletions. for name have this: re.findall(r"author: (.+) <",gitlog) for numbers have this: re.findall(r" (\d+) insertions\s+, (\d+) deletions",gitlog) but want list of tuples of name,insertions , delitions 1 regular-expression. i tryed somthing like re.findall(r"author: (.+) <.+ (\d+) insertions\s+, (\d+) deletions",gitlog,re.dotall) but returns nothing... so mistake? how regular-expression should like? upadte: wrar right, somehow when read file , seek parse whole file name , , lastly insertion , deletion, matches whole file not single commit... [.+] gets whole file not part of commit... if have access repo ,...

how to use jquery tabs on-click function? -

how to use jquery tabs on-click function? - i using jquery create tabs on gui. question is, want execute function upon clicking on 1 of tabs. found next info jquery site. new jquery, however, , can't understand ".selector" means. how can identify specific tab's name? have id whole tab set. also, there 2 segments of code jquery website. can take utilize either one? thanks! directly jquery ui website: this event triggered when clicking tab. code examples supply callback function handle select event init option. $( ".selector" ).tabs({ select: function(event, ui) { ... } }); bind select event type: tabsselect. $( ".selector" ).bind( "tabsselect", function(event, ui) { ... }); first, selector way select dom element. basic selectors follow css , regular javascript format. # id , . class so in jquery, select div id of "my-div" this: $('#my-div') this grabs jquery node, which, can modif...

load - Can Google Analytics be loaded via AJAX? -

load - Can Google Analytics be loaded via AJAX? - the typical google analytics code (or rather - 1 told add) looks this: <script type="text/javascript"> var _gaq = _gaq || []; _gaq.push(['_setaccount', 'ua-123456-7']); _gaq.push(['_setdomainname', '.mydomain.example']); _gaq.push(['_trackpageview']); (function() { var ga = document.createelement('script'); ga.type = 'text/javascript'; ga.async = true; ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js'; var s = document.getelementsbytagname('script')[0]; s.parentnode.insertbefore(ga, s); })(); </script> note ga.async = true; part. allows conformant browsers load script asynchronously, there still plenty of browsers around don't. i'm worried performance - i've seen many pages freeze in loading w...

How to change the selected entry in TYPO3 pagetree -

How to change the selected entry in TYPO3 pagetree - i making backend extension that, changes page working on upon clicking link in work area right of pagetree. problem is: pagetree doesn't update according id presented in work area. the id changed passing query parameter id mod.php-module, , works expected. have tried updating page tree via t3lib_befunc::openpagetree($this->id); t3lib_befunc::setupdatesignal('updatepagetree'); and later <script type="text/javascript">'.t3lib_befunc::getupdatesignalcode().'</script> to included in output. works (the pagetree refreshed, , hidden subpages of passed id revealed), except greyness indicating current page in page tree left @ previous position. any thought how create pagetree reflect new $this->id ? here's how did it. in php code of module, called openpagetree so: t3lib_befunc::openpagetree(76,false); i did not phone call setupdatesignal because ...

javascript - iframe dynamic height adjust -

javascript - iframe dynamic height adjust - i trying adjust height of iframe when user checks input box (the checked input box expands list). can not utilize ajax solution. has done iframe , not parent. within iframe, can phone call function on page hosting iframe: parent.adjustiframeheight(); javascript

MVC like logic separation of Android apps -

MVC like logic separation of Android apps - i began create first android app, and, while learning tricks, messed code not separating logic. wondered if there exists sort of standard logic separation on android (like mvc). appreciate if show me ways of packaging app in mvc manner, or other pattern, if any. thanks check below links given illustration in mvc architecture of android application. link-1 link-2 android

Open source c++ debugger for windows -

Open source c++ debugger for windows - does know open source c++ debugger windows? it doesn't have good, has work. (i'd prefer 1 written in c++) thanks :) gdb ofcourse! and assured works debugger :) c++ windows debugging

installer - C# WIX Uninstall Permanent File? -

installer - C# WIX Uninstall Permanent File? - i using custom action during install write text file install directory. when uninstall, file not removed nor corresponding install directory. else uninstalled properly. i understand reason wix cannot uninstall file using uninstaller, i'm wondering what's best way phone call "clean up" action on uninstall in can manually delete directory/file? you include removefile element in whatever component text file closely associated. when component uninstalled, text file deleted well. <removefile id="cleanuplogfile" on="uninstall" name="log.txt"/> c# installer wix

html - Background color property not being obeyed in IE8 -

html - Background color property not being obeyed in IE8 - i have problem site found here: http://minecraftskinner.com if view site in browser other ie8, background looks bluish way should be. if seek in ie8 however, background bluish changes solid white after page has loaded. i've looked on css , @ first thought *{} selector used (i've changed now, used when didn't know bad) didn't prepare it. facebook iframe isn't @ fault, i've commented out of html , still happens. it's worth noting happens on homepage , on other page of site. any ideas whats going wrong here? i've been @ hours , i'm clueless. here's sites css, think html output of page little big copy. body { background-color: #8cbdff; font-family: "trebuchet ms"; font-size: 1em; margin: 0; } #container { width: 836px; margin: 0 auto; padding: 0; } #header { width: 836px; height: 120px; } p { padding: 0; margin: 0; ...

Actionscript 3, addChild to stage and addEventListener not working together -

Actionscript 3, addChild to stage and addEventListener not working together - i wanna add together image library on stage , have event listener on when click on it, something. imgfrommylib set image want library. please help. easiest way ? import flash.display.bitmap; import flash.events.*; import flash.display.sprite; function pwned(evt:mouseevent):void { trace ("a"); } var myimg:imgfrommylib = new imgfrommylib(); var mybitmap:bitmap = new bitmap(myimg); mybitmap.addeventlistener(mouseevent.click, pwned); addchild(mybitmap); var myimg:imgfrommylib = new imgfrommylib(0,0); var mybitmap:bitmap = new bitmap(myimg); var mc:movieclip = new movieclip(); mc.graphics.beginfill(0x333333,1); mc.graphics.drawrect(0,0,mybitmap.width, mybitmap.height); mc.graphics.endfill(); addchild(mc); mc.addeventlistener(mouseevent.click, pwned); mc.addchild(mybitmap); function pwned(evt:mouseevent):void { trace ("a"); } try this.... actionscr...

xsl fo - Get FOP to add space-before and space-after -

xsl fo - Get FOP to add space-before and space-after - i have 2 paragraphs. how fop add together values of space-after attribute of first , space-before attribute of sec paragraph? for example: <fo:block space-after="20mm">text 1</fo:block> <fo:block space-before="20mm">text 2</fo:block> i want space between 2 blocks 40mm instead of 20mm. tried .minimum, .optimum , space-after.conditionality="retain", nil seems work. thanks help you need utilize .precedence="force" sub-property, perchance on both space-after , space-before. otherwise, neighboring spaces collapse largest space of set (simplified rule). the ".conditionality" sub-property omitting space first or lastly space on reference area (ex. page). not used resolve neighboring spaces. xsl-fo fop

vim - Automatic window resizing -

vim - Automatic window resizing - i'm trying write simple function in vim if buffer has little number of lines, after special key-pressing window fit whole buffer. here think " total lines of current buffer function! <sid>totallines() allow n = 0 line in getline(1,'$') allow n+=1 endfor homecoming n endfunction " resize window function! <sid>resizecurrentwindow() if has("gui_running") allow linesnumber = <sid>totallines() if linesnumber < (&lines / 2) execute ':resize linesnumber' endif endif endfunction nnoremap <silent> <leader>rs :call <sid>resizecurrentwindow()<cr> well, resizecurrentwindow() function doesn't work: obtain 1-line-height window. if write execute 'echo linesnumber' function works , output right result. suggestion? there fastest solution? thanks try: execute ':resize ...

sdl - How do you implement Signals and Events in C++? -

sdl - How do you implement Signals and Events in C++? - i making gui library on top of sdl using c++. (don't inquire me why, doing gain knowledge out of practice in order understand how gui libraries made.) , want create signal connection scheme gtk+ or wxwidgets... g_signal_connect(mybutton,"clicked",gtk_main_quit); //gtk+ evt_menu(wxid_exit,onquit); //wxwidgets i understand can using function pointers. how add together functions main loop? or there improve way this? the simplest way borrowing library, illustration boost::signal or boost::signal2 . next best thing implementing own borrowing of features libraries boost::bind (to enable connections) or using c++0x features simplify generic connection of clients ( std::function / boost::function ). i recommend utilize boost , signals2 library, there many things can wrong , solved there. c++ sdl signals

hibernate - Is there a way to use hql without classes? -

hibernate - Is there a way to use hql without classes? - the scenario is: in system, user able define query database using kind of metadata. example: user define parameters such as: -databasetype: oracle 11g -connectionproperties: (user, password, server, etc) -tablename: tab1 -columns: col1, col2 -filters: col3=2 ; col2=5 that way, don't know returned, , don't have class matches resultset returned query. that said, problem is: can build hql query using these "metadata" without class match result (like tab1 col1 , col2)? faq: -"why want utilize hql , not sql" answer: database-independent. thanks, , please tell me if wasn't clear plenty :) hql operates on objects, no - hibernate complain doesn't find object referring to. hibernate

orchardcms - How to enable a client validation (Orchard CMS)? -

orchardcms - How to enable a client validation (Orchard CMS)? - i trying add together client validation user registration page in orchard cms. server-side validation implemented next (working well): if (string.isnullorempty(username)) { modelstate.addmodelerror("username", t("you must specify username.")); validate = false; } if (string.isnullorempty(email)) { modelstate.addmodelerror("email", t("you must specify email address.")); validate = false; } i've added jquery related scripts view, enabled client validation in web.config: <add key="clientvalidationenabled" value="true" /> <add key="unobtrusivejavascriptenabled" value="true" /> also added dataannotations userpart class properties , usercreateviewmodel class properties. no luck. so questions are: does orchard cms back upwards mvc 3.0 client validation dataannotations? what should create ...

css - :hover is not working properly in IE9 -

css - :hover is not working properly in IE9 - i have simple css dropdown menu iframe within it. when hover mouse on dropdown menu, menu drops down. when mouse hovers iframe within menu, menu goes back. here's simplified version of code: <div id="comments"> <a href="#" class="btn">view comments</a> <div id="comment-wrap"> <iframe src="http://www.facebook.com/plugins/comments.php?..."></iframe> </div> </div> <style type="text/css"> #comment-wrap{display:none;z-index:5;position:absolute;padding:10px;background-color:#fff;} #comments:hover #comment-wrap{display:block;} </style> this works in latest versions of ff, chrome, , opera. p.s. dropdown menu remain dropped downwards when mouse hovering padding of #comment-wrap. i have faced similar problems while working :hover psuedo class. started working fine when changed document mode of b...

logic - php - check for endless possibility and stop when reach the end -

logic - php - check for endless possibility and stop when reach the end - i got folder construction so css main.css home layout.css menu.css ... business relationship user.css menu.css user user.css level time.css ... ... you can see lot of files , folders nested in each other. want loop through folder css, read every files , folders in it. if file, run function do(), if folder run function make() , go on loop through folder check files , folders inside. repeat process until there no more folder , file left loop through. i can loop through files , folders if know how how many there are. problem don't know how many folders , files there are. there need special technique archive want ? this perfect recursivedirectoriterator class comes php. it'll loop through each file , folder recursively. each item iterate through subclass of splfileinfo contains many function can utilize (e.g. ...

haskell - HUnit/QuickCheck with Continuous Integration -

haskell - HUnit/QuickCheck with Continuous Integration - are there extensions hunit or quickcheck allow continuous integration scheme bamboo detailed reporting of test results? so far, best thought trigger tests part of build script, , rely on tests fail non-zero exit code. effective getting attending when test fails, confuses build failures test failures , requires wading through console output determine problem's source. if best alternative current tools, thought write reporting module hunit produce output in junit xml format, point ci tool @ though reporting on java project. seems hackish, though, i'd appreciate thoughts both on existing options , directions new development. the test-framework package provides tools integrating tests using different testing paradigms, including hunit , quickcheck, , console test runner can passed flag makes produce junit-compatible xml. utilize jenkins continuous integration. invocation example: $ ./test --jxml=tes...

asp.net - Keyword not supported: 'server' -

asp.net - Keyword not supported: 'server' - i've been trying edit connection string uploading website server. not experienced this. got exception: keyword not supported: 'server'. here connection string: <add name="albayanentities" connectionstring="server=xx.xx.xxx.xxx,xxxx;database=albayan;uid=bayan;password=xxxxx;" providername="system.data.entityclient" /> i've tried embed string old connection string works locally, didn't fit : s for entity framework (database-first or model-first; when have physical edmx model file) need utilize special type of connection string quite different straight ado.net connection strings else has mentioned far... the connection string must like: <add name="testentities" connectionstring="metadata=res://*/model1.csdl|res://*/model1.ssdl|res://*/model1.msl;provider=system.data.sqlclient;provider connection string=&quot;data source=(local);ini...

php - generate thumbnail on uploading image using zend framework -

php - generate thumbnail on uploading image using zend framework - i 1 time again question in zend framework. can explain me, how generate thumbnail images in zend framework after uploading image. thanks! zend seems not provide ability http://framework.zend.com/wiki/display/zfprop/zend_image+-+eric+potvin , propose utilize http://www.imagemagick.org/script/index.php. free utilize own way php zend-framework image-manipulation

caching - Zend apache2 mod_expires will not work on os x? -

caching - Zend apache2 mod_expires will not work on os x? - im coming form iis background apache2 still new me. have zend server version of apache2 running on os x snow leopard. im trying enable client-side caching on local machine can test caching of rest server calls. here have in httpd.conf loadmodule expires_module modules/mod_expires.so #<ifmodule expires_module> expiresactive on expiresbytype text/html a2592000 expiresbytype application/json a2592000 expiresbytype image/gif a2592000 expiresbytype image/jpeg a2592000 expiresbytype image/png a2592000 expiresbytype text/css "access plus 1 minutes" expiresbytype text/javascript "access plus 1 minutes" expiresbytype application/x-javascript "access plus 1 minutes" expiresbytype text/xml "access plus 1 minutes" #</ifmodule> that took me while working is, headers have not changed @ all. instance, here rest headers. date thu, 14 jul 2011 20:34:06 gmt server apache...

Rails 3 javascript sql query -

Rails 3 javascript sql query - i have question querying sqlite database in on of rails 3 app: the purpose of app locate user , show bunch of nearby locations. the locations stored in sqlite , utilize javascript geolocate user , show current position. have longitude , latitude want check database nearby locations. how query database long/lat javascript values? i can think of providing info server side .json , iterate trough javascript. thanks in advance you cannot access database straight javascript (assuming you're in browser), thought of providing info server side json approach any. (yes improve suited comment, won't allow me yet :p) javascript ruby-on-rails-3 sqlite3 geolocation

Problems with macports and patch on OSX 10.6.8 -

Problems with macports and patch on OSX 10.6.8 - well. thumbs down, 2 thumbs downwards , middle fingers up, on package. i can't seem install tool. problems inevitably arise when macports gets stage tries apply patches. croaks because apparently /usr/bin/patch has security patch prevents patching upwards in directory tree. typical error message: :info:patch /usr/bin/patch: ** rejecting file name ".." component: ../libunwind/include/libunwind.h i see various bug reports on issue such https://trac.macports.org/ticket/29871 , https://trac.macports.org/ticket/29813, no real solutions. is there flippin' patch patch? i not utilize macports (so cannot test possible solution), perhaps seek installing gnu version of patch . there indeed portfile within macports. installs gpatch , create symbolic link such /opt/bin/patch -> /opt/bin/gpatch . additionally, need ensure /opt/bin appears before /usr/bin in path. although portfile requires patch applie...

Is there a way to avoid typing whole package names in the Scala interpreter in Eclipse? -

Is there a way to avoid typing whole package names in the Scala interpreter in Eclipse? - i writing project in scala in eclipse , it's real hassle having type whole bundle names classes i've written. example: if write class sender in bundle com.ab.cd.ef.gh whenever seek , utilize object have like: val sender = com.ab.cd.ef.gh.sender.getsender or similar. there way set interpreter have type in val sender = sender.getsender ? use import com.ab.cd.ef.gh._ import whole package. see here more details on scala import statements eclipse scala

Newbie PHP: Insert a variable for echoing -

Newbie PHP: Insert a variable for echoing - i'd able echo $domain this $domain = $response['results']['$myvar']['shorturl']; i've tried curly braces , various other ways of formatting $myvar syntax wrong. help welcome ! edit --> var_dump($response): object(stdclass)#1 (4) { ["errorcode"]=> int(0) ["errormessage"]=> string(0) "" ["results"]=> object(stdclass)#2 (1) { ["http://www.domain.com"]=> object(stdclass)#3 (5) { ["userhash"]=> string(6) "osemki" ["shortkeywordurl"]=> string(0) "" ["hash"]=> string(6) "oms2zb" ["shortcnameurl"]=> string(20) "http://bit.ly/lalala" ["shorturl"]=> string(20) "http://bit.ly/lalala" } } ["statuscode"]=> string(2) "...

c# - How to upload a file to a document library given a HttpPostedFile -

c# - How to upload a file to a document library given a HttpPostedFile - i have httppostedfile object , after file gets uploaded locally onto server, want move temp file document library in sharepoint. here code: private void uploadwholefile(httpcontext context, list<filesstatus> statuses) { (int = 0; < context.request.files.count; i++) { httppostedfile file = context.request.files[i]; file.saveas(ingestpath + path.getfilename(file.filename)); string filename = path.getfilename(file.filename); } can give me illustration code this? have found tutorial streams, not quite sure if work same in situation replace 2 lines starting file.saveas following: var mydocumentlibrary = spcontext.current.web.folders["mydocumentlibrary"]; var myfile = mydocumentlibrary.files.add(file.name, file.filecontent, true); c# asp.net sharepoint

ruby on rails - Rails3 Update Boolean Checkbox from Index View -

ruby on rails - Rails3 Update Boolean Checkbox from Index View - i'm building simple tasks application our company part of ordering system. i have list of tasks number of rules. nil complex... i'm stuck on add-on of checkbox finish task. want done live, index view without having nail submit.. am not sure look. figure need utilize ajax - can recommend tutorial or tell me should looking for. have thought plugin, edit in place ones out there. thanks in advance --- edit 1 -- following advice @pcg79 below, i've added next application not understanding how go out changing status. in index view have this: <%= check_box_tag 'complete_task_1', '', false, { 'data-href' => tasks_path(@task) } %>< i've added next application.js (added # phone call properly) $('#complete_task_1').click(function() { $.ajax({ url: $(this).data('href'), type: 'put', datatype: 'html', ...

java - problem with setSelectedValue Method for JList -

java - problem with setSelectedValue Method for JList - i having troubles when run main class application. fact setselectedvalue method doesn't work. code main class following: databaseconnection.getinstance().connect("org.sqlite.jdbc", "jdbc:sqlite:db/universidad.sqlite"); databasetablemanagers managers = databasetablemanagers.getinstance(); databasemanagerjlist.getinstance().setselectedvalue("alumnos"); system.out.println(databasemanagerjlist.getinstance().devolver() + "1"); alumnostablemanager atm = alumnostablemanager.getinstance(); system.out.println(databasemanagerjlist.getinstance().devolver() + "2"); carrerastablemanager ctm = carrerastablemanager.getinstance(); system.out.println(databasemanagerjlist.getinstance().devolver() + "3"); managers.add(atm); system.out.println(databasemanagerjlist.getinstance().devolver() + "4"); managers.add(ctm); system.out.println(data...

.net - ReSharper & Implicitly Typed Variables -

.net - ReSharper & Implicitly Typed Variables - i using resharper help me spotting possible errors in code, and, although not error, keeps complaining should utilize var keyword instead of explicitly typing variables on declaration. personally, think much more clear me , reading code if write ilist<t> somevar = new list<t>(); instead of var somevar = new list<t>(); knowing there's no performance differences between both ways, should ignore these hints or stick `var´ keyword? matter of taste or practice implicitly type variables? i see @ to the lowest degree 2 reasons. first, matter of dry principle: don't repeat yourself. if in future decide alter type of variable list<> stack<> or linkedlist<> , var you'd have alter in 1 place, otherwise you'd have alter in 2 places. two, generic types declaration can quite long. dictionary<string, dictionary<int, list<myobject>>> anyone? do...

encoding - ' ', hexadecimal value 0x1F, is an invalid character. Line 1, position 1 -

encoding - ' ', hexadecimal value 0x1F, is an invalid character. Line 1, position 1 - i trying read xml file web , parse out using xdocument. works fine gives me error day: **' ', hexadecimal value 0x1f, invalid character. line 1, position 1** i have tried solutions google aren't working vs 2010 express windows phone 7. there solution replace 0x1f character string.empty code homecoming stream doesn't have replace method. s = s.replace(convert.tostring((byte)0x1f), string.empty); here code: void webclient_openreadcompleted(object sender, openreadcompletedeventargs e) { using (var reader = new streamreader(e.result)) { int[] counter = { 1 }; string s = reader.readtoend(); stream str = e.result; // s = s.replace(convert.tostring((byte)0x1f), string.empty); // byte[] str = convert.frombase64string(s); // stream memstream = new memorystream(str);...

javascript - Internet explorer and removeChild() -

javascript - Internet explorer and removeChild() - i have been using elem.removechild() remove elements document, saving javascript reference element, can add together them when appropriate. works fine in firefox , chrome. now notice that on ie7, elements destroyed in process, having children removed. when add together them same parent element, same type of element , have retained things class name, have no children elements. is expected behavior? know can alter app things differently, take couple hours of reworking , i'd avoid that. i've assumed ok remove elements, either using removechild() or setting parent's innerhtml empty string, , long had reference element (i.e. variable points element, not element id), ok add together , remove elements freely without having element messed up. is bug ie, somehow confused , else going on, or known , expected behavior? the spec removechild doesn't explicitly children of node beingness removed should kep...

javascript - jquery.address: $.address.change() runs twice when using $.address.queryString() -

javascript - jquery.address: $.address.change() runs twice when using $.address.queryString() - $.address.change() runs twice when using $.address.querystring() if have url of: www.example.com and run next code: $.address.change(function(event) { if(event.parameters['user_id']) { alert(event.parameters['user_id']) } }); $.address.querystring('user_id=902715614&user_name=james'); live example it alerts user_id twice however, shouldn't alert once? it's alerting when page loads (address changed...right?), , 1 time again when alter address. javascript jquery jquery-address

javascript - Highcharts - how to set textShadow for data labels -

javascript - Highcharts - how to set textShadow for data labels - i'm trying set textshadow property style of info labels doesn't work (ignored): var chart = new highcharts.chart({ chart: { renderto: 'container' }, xaxis: { categories: ['jan', 'feb', 'mar', 'apr', 'may', 'jun', 'jul', 'aug', 'sep', 'oct', 'nov', 'dec'] }, plotoptions: { series: { datalabels: { enabled: true, style: { fontweight:'bold', textshadow: "2px 2px #ff0000", } } } }, series: [{ data: [29.9, 71.5, 106.4, 129.2, 144.0, 176.0, 135.6, 148.5, 216.4, 194.1, 95.6, 54.4] }] }); http://jsfiddle.net/tjfby/ is there way apply drop shadow info labels? reason create labels similar graph line. if working in fiddle, should alter current jquery ...

php - OpenX alternative? -

php - OpenX alternative? - im looking open source other openx advertisement management system. know alternative available , can recommend on php mysql server? (this shouldn't here, but) have considered scheme external you, illustration doubleclick? there few advertisement management systems half-decent, understand wanting away openx ;-) php ads openx

CUDA incompatible with my gcc version -

CUDA incompatible with my gcc version - i have troubles compiling of examples shipped cuda sdk. have installed developers driver (version 270.41.19) , cuda toolkit, sdk (both 4.0.17 version). initially didn't compile @ giving: error -- unsupported gnu version! gcc 4.5 , not supported! i found line responsible in 81:/usr/local/cuda/include/host_config.h , changed to: //#if __gnuc__ > 4 || (__gnuc__ == 4 && __gnuc_minor__ > 4) #if __gnuc__ > 4 || (__gnuc__ == 4 && __gnuc_minor__ > 6) from point on got few of examples compile, stops with: in file included /usr/include/c++/4.6/x86_64-linux-gnu/bits/gthr.h:162:0, /usr/include/c++/4.6/ext/atomicity.h:34, /usr/include/c++/4.6/bits/ios_base.h:41, /usr/include/c++/4.6/ios:43, /usr/include/c++/4.6/ostream:40, /usr/include/c++/4.6/iterator:64, /usr/local/cuda/include/thrust/iterator/iterator_categories.h:38, ...

php - i want to check array's data with mysql_real_escape_string() function -

php - i want to check array's data with mysql_real_escape_string() function - this function create sql query array function yorumekle($kitapid,$array) { $sql = "insert yorumlar ('" . implode(",",array_keys($array)) . "') values ( '" . implode("','",$array) . "' )"; } but want utilize mysql_real_escape_string() how? you can utilize array_map function function yorumekle($kitapid,$array) { $array2 = array_map("mysql_real_escape_string",$array); $sql = "insert yorumlar ('" . implode("','",array_keys($array2)) . "') values ( '" . implode("','",$array2) . "' )"; } php mysql arrays