Posts

Showing posts from January, 2014

android - ontouch on frame by frame animation -

how implement on touch on image view used frame frame animation... using follow final animationdrawable newtonanimation = (animationdrawable) animation.getbackground(); animationstart(newtonanimation); animation.setontouchlistener(l); public void animationstart(final animationdrawable newanimation){ thread timer=new thread(){ @override public void run(){ try{ sleep(40); }catch(exception e){} finally{ newton_lawsactivity.this.runonuithread(new runnable() { public void run(){ newanimation.start(); }}); } } }; timer.start(); } g...

android - Show immediate changes when data deleted from database -

view database xml file: <?xml version="1.0" encoding="utf-8"?> <linearlayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical" android:background="@drawable/wood_bg" > <textview android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="center_horizontal" android:layout_marginbottom="10dp" android:layout_margintop="10dp" android:text="daily fruit log" android:textappearance="?android:attr/textappearancelarge" android:textstyle="bold"/> <tablelayout android:layout_width="fill_parent" android:layout_height="wrap_content" > <tablerow> <textview android:layout_width=...

sql - MySQL Insert from another table with 2 option WHERE statement -

i have done research can not figure out how this. super simple insert table want include statements. i want insert value of single column, column_q table table b's column_q table a's column_w = '100' , column_q not exist in table b. i tried: insert b (column_q) select distinct(column_q) column_w = 100 , b.column_q<>a.column_q; where doing wrong? ps. both tables contain values. no field null. insert b (q) select distinct q a.w = 100 , a.q not in ( select q b ) if b.q has unique constraint defined on it, use: insert ignore b (q) select q w = 100

html - CSS drop down sub menu disappears when using Internet Explorer 9 -

i'm having trouble following site in ie9. may notice sub menu disappears mouse hovers over. vinehousefarm-farmshop.co.uk html: http://pastebin.com/juwsgyfm css: http://pastebin.com/yeq8mcwm many in advance!! the problem margin-top:4px on li. causes cursor loose focus on anchor element. better use padding-top on anchors in submenu.

opengl es 2.0 - How to know when data has been allocated on GPU memory -

how can determine if buffer has been allocated on gpu memory on three.js? the first time call renderer.render(), renders mesh without textures (looks black) makes me think textures not available yet on gpu memory when function called. after 5-10 calls, texture appears on screen. why important? i'm triggering render function when view needs updating. if new model loaded, render function should wait until data available rendering. how can assure data ready used on gpu? pseudo code: textures = loadtextures() material = creatematerial(textures) geometry = loader.load( "path/to/file" ) if( materialloaded && geometryloaded ) { needsupdate = true } if( needsupdate ) { renderer.render() needsupdate = false } this seems problem fact images aren't loaded before render.

c++ - Weird output in MPI using MPI_Comm_spawn to spawn processes -

amaey helped me fix problem. i trying learn mpi_comm_spawn function spawn processes, because i'm working on migrating project pvm mpi . found example program here . decided change bit make parent process send message 2 child processes, , make child processes output message. thing child process rank 0 doesn't receive message properly, receives part of it, while child process rank 1 receives message , outputs normally. can please explain why happening, i'm doing wrong or how can fix this. lot can help! #include "mpi.h" #include <stdio.h> #include <stdlib.h> #include <iostream> #define num_spawns 2 // based on example from: http://mpi.deino.net/mpi_functions/mpi_comm_spawn.html int main( int argc, char *argv[] ) { int my_rank; int size; int np = num_spawns; int errcodes[num_spawns]; mpi_comm parentcomm, intercomm; char greeting[100]; char greeting2[100]; char greeting3[100]; mpi_init( &argc, &ar...

SharePoint 2010 - One email to combine changes for multiple lists -

i need 1 email sent out when changes multiple lists on site. make more complicated email needs go out weekly , include changes in past week. users have alerts set up, complaining receiving many emails. need way combine these 1 email. is possible? thanks, ninel yes, timerjob friend: create storage list, in list keep changes other lists want ( on itemupdated or itemcreated ). run job weekly , send email cumulative updates. -p

regex - I can't accurately understand how does JavaScript's method string.match(regexp)'s g flag work -

in book "javascript: parts", explains method string.match(regexp) below: the match method matches string , regular expression. how depends on g flag. if there no g flag, result of calling string .match( regexp ) same calling regexp .exec( string ). however, if regexp has g flag, produces array of matches excludes capturing groups: then book provides code example: var text = '<html><body bgcolor=linen><p>this <b>bold<\/b>!<\/p><\/body><\/html>'; var tags = /[^<>]+|<(\/?)([a-za-z]+)([^<>]*)>/g; var a, i; = text.match(tags); (i = 0; < a.length; += 1) { document.writeln(('// [' + + '] ' + a[i]).entityify()); } // result // [0] <html> // [1] <body bgcolor=linen> // [2] <p> // [3] // [4] <b> // [5] bold // [6] </b> // [7] ! // [8] </p> // [9] </body> // [10] </html> my question can't understand "but excl...

function pointers in c++ : error: must use '.*' or '->*' to call pointer-to-member function in function -

code snippet follows. not able understand why getting error. void sipobj::check_each_field() { map <std::string, sip_field_getter>::iterator msg; string str; char name[20]; bool res = false; sscanf(get_payload(), "%s %*s", name); loginfo(lc()) << "invite:" << name; str = name; msg = sip_field_map.find(str); if (msg != sip_field_map.end()) { sip_field_getter sip_field = msg->second; res = (this).*sip_field(); } } typedef bool (sipobj::*sip_field_getter)(); static map <std::string, sip_field_getter> sip_field_map; sip_field_getter place holder function names (this).*sip_field(); there 2 problems expression: this pointer, must use ->* call member function via pointer on it. the function call ( () ) has higher precedence member-by-pointer operators (either .* or ->* ), need parentheses correctly group expression. the correct expression is: (this->*sip_field)();

Cannot use Maven Central Repository -

even proxy setting in ../.m2/setting.xml file cannot access maven central repository. told have use local repository. wondering because of limitation way local repository build , use thereby use maven effectively? you (or admin) can have local repo mirror central repo , set settings.xml file use local repo mirror (see nexus repo documentation put in settings.xml). when build, maven attempt pull resources local repo; if they're not there, repo automatically pull them central , store them. next time build, artifacts come local repo , not central.

javascript - How to resize an image that has a gradient according to the current page height? -

i using image background site. has black/white gradient, , 1px wide. the css: background-image:url('../image/gradient.png'); which makes repeat itself. height of image 2000px. is possible change height of image dynamically, fits page sizes: if height of page less 2000px, height of image should smaller, if height of page bigger, image should bigger. thanks in advance i have tried various in-browser gradient techniques, , dont seem work same on browsers. maybe not getting right context of question, can somethin like #someimg.src { width: 100%; position: absolute; top: 0; left: 0; } resize page see action: http://css-tricks.com/examples/imagetobackgroundimage/

SQL query to retrieve discrepancies in punch order -

Image
consider table below. the rule - employee cannot take break (needs clock out) job num 1 before clocking in job num 2. in case employee "a" supposed clock out instead of break on jobnum 1 because later clocked in jobnum#2 is possible write query find in plain sql? idea check if next record proper one. find next record 1 has find first punchtime after current same employee. once information retrieved 1 can isolate record , check fields of interest, jobnum same , [optionally] punch_type 'in'. if not, not exists evaluates true , record output. select * @punch p -- isolate breaks p.punch_type = 'break' -- ones having no proper entry , not exists ( select null -- same table @punch a.emplid = p.emplid , a.jobnum = p.jobnum -- next record has punchtime subquery , a.punchtime = (select min (n.punchtime) @punch n n.emplid = p.emplid , ...

javascript - retrieving original movie size on client / server side -

is there way retrieve flash movie size on client / server side? assuming have various games many providers , don't know size of it, but when place on html page wanna hit correct size. thanks in advanced! if using php on server side use getimagesize() method. then can create embed code accordingly.

android - using of intent for linking activities -

i want link 2 activites clicking on button have written following code public class ihbcaptureactivity extends activity implements onclicklistener { /** called when activity first created. */ imageview iv; textview tx; button b1; @override public void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.main); iv=(imageview)findviewbyid(r.id.imageview1); tx=(textview)findviewbyid(r.id.textview1); b1 = (button) findviewbyid(r.id.button1); b1.setonclicklistener(this); } @override public void onclick(view v) { intent calintent; **calintent = new intent(ihbcaptureactivity.this, loginactivity.class);** startactivity(calintent); } } error cumes in line calintent = new intent(ihbcaptureactivity.this, loginactivity.class); for loginactivity.class that loginactivity cannot resolved type . how solve it? h...

groovy - Sorting a resultset during the iteration over them -

given xml file following content <root> <group name="database"> <user name="thorsten"/> <user name="karl"/> <user name="beate"/> <user name="heinz"/> <user name="andreas"/> </group> </root> now can read groovy script this def out = ""; def result = new xmlslurper().parse(new file("d:\\user.xml")); result.group.user.each { out += it.@name.text()+ '\n'; } println out; the output in order appear in xml file thorsten karl beate heinz andreas is possible sort, in alphabetic order, resultset during iteration on them? georg during iteration? of course not. but if use xmlparser , this: def doc = new xmlparser().parse(new file("users.xml")); foo = doc.group.user.sort { it.@name }.collect { it.@name }.join("\n") println foo which outputs: andreas beate heinz karl thorsten...

tabs - Android TabHost setCurrentTab() -

i use tabhost , have 2 tabs 2 activityes want set second tab default tab when tabhost start load first tab1 , before tab2 wrong because in these 2 activityes load data webservice ! question how set current tab second tab without load first tab! my tabhost code: public class tabshandler extends tabactivity { private static tabhost tabhost; intent intent; private void setuptabhost() { tabhost = (tabhost) findviewbyid(android.r.id.tabhost); tabhost.setup(this.getlocalactivitymanager()); tabhost.setcurrenttab(1); } @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); if(!isonline()) utils.dialognointernet(this); string authtoken = getintent().getextras().getstring("token"); long role = getintent().getextras().getlong("role"); string eventidnotification =getintent().getextras().getstring("eventidnotificatio...

html - Replace non standard characters in php -

i'm trying replace non standard characters ë,Ë,ç,Ç numeric entities &#203; , &#039; etc ran bit of problem. when try replace them directly works fine: $string = "Ë"; $vname = str_replace("Ë","aaaa",$string); echo $vname."<br>"; an aaaa result. when try replace characters string form post doesn't change characters. here example: <?php if(isset($_post['submit'])) { $string = $_post['title']; if ($string == "Ë") echo "yes"; else echo "no"; $vname = str_replace("Ë","aaaa",$string); echo $vname."<br>"; echo $string; } ?> <form method="post" name="form"> title: <input name="title" type="text" value="" size="20"/> <input name="submit" type="submit" value="submit"/> </form> any great!! most characterset wrong...

Chinese database content within dynamic PHP pages using CodeIgniter -

i'm trying pull chinese database content dynamic php pages within our codeigniter website. php files make each page encoded utf-8 displays static chinese text correctly. however, chinese content database rendered question marks. for example 中华人民共和国 in database shows ??????? . as php code, tables collated utf8_unicode_ci . data shows correctly in database. ideas? many thanks! this sorted. line 50 of database.php in root -> application -> config should have read: correct: $db['default']['char_set'] = "utf8" incorrect: $db['default']['char_set'] = "utf-8" something simple! hope might others.

Android ndk-build command does nothing -

i have similar question posted here: android ndk: why ndk-build doesn't generate .so file , new libs folder in eclipse? ...though running windows 7, not mac os. ndk-build command run, gives no error doesn't create .so file (also, since i'm on windows should create .dll , not .so?). tried running command root, jni, src folders etc. got same result; cmd returns prompter after few seconds. ran again jni folder ndk_log=1 parameter see happening. here portion of transcript of log results after running ndk-build in jni folder (after identified platform, etc.)... android ndk: looking jni/android.mk in /workspace/ndkfooactivity/jni android ndk: looking jni/android.mk in /workspace/ndkfooactivity android ndk: found ! android ndk: found project path: /workspace/ndkfooactivity android ndk: ouput path: /workspace/ndkfooactivity/obj android ndk: parsing /cygdrive/c/android-ndk-r8/build/core/default-application.mk android ndk: found app_platform=android-15 in /works...

php - How to add an error page in a .htaccess file -

below .htaccess file. have default_rewrite.php file , content database have created. rewriteengine on rewriterule ^/?([a-z0-9-_]*)$ default-rewrite.php?page=$1 [l] when go known broken link e.g http://www.example.com/test/fgdhfuis goes default rewrite page doesn't go page have stored in database. e.g http://www.example.com/test/home i have tried errordocument 404 /404.php not me. any advice appreciated. below php edit: <?php if (!function_exists("getsqlvaluestring")) { function getsqlvaluestring($thevalue, $thetype, $thedefinedvalue = "", $thenotdefinedvalue = "") { if (php_version < 6) { $thevalue = get_magic_quotes_gpc() ? stripslashes($thevalue) : $thevalue; } $thevalue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($thevalue) : mysql_escape_string($thevalue); switch ($thetype) { case "text": $thevalue = ($thevalue != "") ? "'" . ...

root - Get WordPress installation folder path -

is there way path wordpress installed? i using following: $root = realpath($_server["document_root"]); it fine www.example.com -> /usr/local/pem/vhosts/165312/webspace/httpdocs it not fine www.example.com/blog since need hard code folder name (blog). later found way using this: $iroot = getcwd(); $folder = explode("/", $iroot); $dir = $folder[8]; // know 8 $root = realpath($_server["document_root"]); require "$root/$dir/wp-blog-header.php"; but still lot of complicated stuff. there simple way wordpress installed (the path) without hard coding? note: 1 wordpress functions not work since somehow outside wordpress. noted on last example, whole point of determine wordpress installation path require "wp-blog-header.php"; on multiple wordpress installations each installation uses different folder (example.com/blog-one , example.com/blog-two), not wordpress mu or multi site. note: 2 if instead of require "$root...

ruby on rails - How to use foreign key in model and form builder? -

i have 2 models: user , location below: class user < activerecord::base attr_accessible :location, :password, :user_name, :password_confirmation validates :location, :user_name, :presence => true validates :password, :presence => true, :confirmation => true has_one :location, :foreign_key => 'location' end class location < activerecord::base attr_accessible :loc_id, :loc_name belongs_to :user, :foreign_key => 'loc_id' end you can see use custom foreign_key models. use form builder build user sign form, when submit data error occurs: location(#2170327880) expected, got string i use simple_form build form, related code is: = f.input :location, :collection => location.all.collect {|c| [c.loc_name, c.loc_id]} how can resolve problem? or must use default foreign_key location_id association? thanks. update: when rename location field in user model loc_id , remove :foreign_key this: class user < active...

Android Satellite Map View with out Road/City/Country label -

Image
i want display satellite map view in android without road/city/country label overlapped on it. default in android how can this. i want show both view shown in picture. able show hybrid view not satellite view. you referring towns, buildings, cities, street name labels, there no api in android disable labels, might in future realize include in api, never know. have options example using javascript map api google maps javascript api v3 hope helps.

Javascript popup selector + PHP -

i have, of community written javascript , php page allows me pass value popup page parent page. this works 100% on internet explorer not in google chrome or on ipad / galaxt tablet. any idea on how can corrected? appreciated always. below portions of code parent page(newsale.php) , popup page(sku.php). know other methods recommended on using popup need solution working popup page application reasons. newsale.php parent page (code snippets, not entire page) <script type="text/javascript"> function selectvalue(id) { // open popup window , pass field id window.open('sku.php?id=' + encodeuricomponent(id),'popuppage', 'width=1000,toolbar=1,resizable=1,scrollbars=yes,height=200,top=100,left=100'); } function updatevalue(id, value) { // gets called popup window , updates field new value document.getelementbyid(id).value = value; } </script> <table> <tr id="r1"> <input...

iphone - Is it ok to re-assign the rootviewcontroller of the window again and again in this case...? -

i have splitviewcontroller based application, problem split view comes picture after 2 modal views. for login some other useful info user. now know splitview controller should root view controller. create 3 objects in appdelegate class. , b, , split view controller c. the order of navigation a-->b-->c; so in app delegate do.. self.loginviewcontroller=[[loginviewcontroller alloc] init]; self.window.rootviewcontroller = self.loginviewcontroller; and once login button pressed loginview controller.. tsappdelegate *appdelegate=(tsappdelegate *)[[uiapplication sharedapplication] delegate]; appdelegate.meetingsviewcontroller=[[meetingsviewcontroller alloc] init]; [uiview transitionwithview:appdelegate.window duration:0.8 options:uiviewanimationoptiontransitioncrossdissolve animations:^(void) { bool oldstate = [uiview areanimationsenabled]; ...

Query string passing in Ruby on Rails -

i want pass id=1 when press link. **link** **view/index.html.erb** <%=link_to "questions " ,:action=>"index" %> i want pass id value controller app/post_controller.rb please tell how access value also. you can this: <%= link_to "questions", :action => "index", :id => 1 %> and more readable version: <%= link_to "questions", questions_path, id: 1 %> however, there's propably better way want achieve. if want link question, should this: first retrieve question object in controller this: @question = question.find(2) # or params[:id] and in view this: <%= link_to "question", @question %>

rawData undefined for first POST action ExtJS -

i trying fill form server response data obtained whenever click on name in grid. part, have succeeded in doing this. however, reason, first time click on name in grid, "undefine" store.proxy.reader.rawdata. doesn't matter name click first, this. subsequent clicks return expected json string. using firebug me solve problem. the following code store 'persons' make ajax request: ext.define('cx.store.persons', { extend: 'ext.data.store', model: 'cx.model.personm', autoload: false, proxy: { type: 'ajax', actionmethods: { update:'post' }, url: '.../censusxphp/app/store/getuseridinfo.php', reader: { type: 'json' } } }); the following function within controller above store loaded. showmess: function(grid,record) { var tempid = record.get('transid'); //gr...

Django: overridden __hash__ not working for objects from database? -

i have problem django model objects have overridden __hash__ () complex uniqueness/distinctiveness constraints want enforce when use them. working fine objects have directly instantiated in memory, not ones retrieve database. like this: class animal(models.model): name = model.charfield('name', max_length=10) def__hash__(self): return len(self.name) # silly example purposes of illustration and this: >> = models.animal(name='cat') >> b = models.animal(name='dog') >> len(set((a,b)) > 1 >> a.save() >> b.save() >> len(set(models.animal.objects.all())) > 2 hmm. whatever hash function being used here, ain't mine. guess it's related lazy fetching / objects not yet in instantiated state, how round it? this because have implemented __hash__ without implementing __eq__ . implement __eq__ , should go. the length of set([a, b]) 1 because django defines default __eq__ function co...

javascript - Element`s absolute positioning issue -

is there way include children elements size position absolute there parents size , means : we have : markup <div class="parent"> <div class="children"> position absolute. </div> </div> css .parent // position default static { width:100%; height:auto; } .children { position :absolute; width:100%; height:auto; } my problem height of parent 0, may because of children absolute positioning. there workaround this? can use javascript? inman's position clearing method job you: http://shauninman.com/assets/examples/si-clear-children-1.0/si-clear-children-1.0.zip more info here: http://shauninman.com/archive/2006/05/22/clearance_position_inline_absolute

arrays - get specific content from file python -

i have file test.txt has array: array = [3,5,6,7,9,6,4,3,2,1,3,4,5,6,7,8,5,3,3,44,5,6,6,7] now want content of array , perform calculations array. problem when open("test.txt") outputs content string. array big, , if loop might not efficient. there way content without splitting , ? new ideas? does text file need python syntax? list of comma separated values usual way provide data: 1,2,3,4,5 then read/write csv module or numpy functions mentioned above. there's lot of documentation how read csv data in efficiently. once had csv reader data object set up, data stored like: data = [ map( float, row) row in csvreader]

Broken links when deploying Clojure webapps to Jetty with relative links and non-root context path -

i've been experimenting writing webapps in clojure, , it's been pretty easy until now. followed chas emerick's excellent screencast starting clojure , got url shortener , running pretty quickly. next wanted able deploy it, , that's when trouble started. when run in development or deploy jetty root webapp, fine, when deploy context path, doesn't. or, rather, works. compojure routes still work, form action links in html files broken , give me 404's. this compojure route setup: (defroutes app* (rt/resources "/") (get "/" request (homepage request)) (post "/shorten" request (let [id (shorten (-> request :params :url))] (response/redirect "/"))) (get "/:id" [id] (redirect id))) (def app (compojure.handler/site app*)) and here html homepage template: <!doctype html> <html> <head> <title>insert title here</title> <link...

interface - Java: returning subclass in superclass method signature -

i'm working on problem there several implementations of foo , accompanied several foobuilder 's. while foo 's share several common variables need set, have distinct variables require respective foobuilder implement specific functionality. succinctness, i'd have foobuilder 's setters use method chaining, like: public abstract class foobuilder { ... public foobuilder seta(int a) { this.a = a; return this; } ... } and public class fooimplbuilder extends foobuilder{ ... public fooimplbuilder setb(int b) { this.b = b; return this; } public fooimplbuilder setc(int c) { this.c = c; return this; } ... } and on, several different foobuilder implementations. technically want, however, approach sensitive order of methods calls when method chaining performed. following has method undefined compile errors: somefoo.seta(a).setb(b)... requiring developer think order of method calls in chain. avoid this, i'd have s...

html - PHP file_get_contents, execute the PHP on the included file before include -

currently use file_get_contents command include html of file. added php , causing problem. php being read html , not executed. how can retrieve file content php executed? oh , need content in tring. include doesn't work in case believe, right? thanks! ob_start(); include 'file_to_include.php'; $contents = ob_get_clean(); the content of included file (with php being executed) in $contents .

java - WatchService Api file watching throws exception when try access file in created event occur -

i have code below tracking file changes on dedicate folder path path = paths.get("f:\\logs"); watchservice watchservice = filesystems.getdefault().newwatchservice(); watchkey key = path.register(watchservice, standardwatcheventkinds.entry_create); while (true) { final watchkey watchkey = watchservice.take(); (watchevent<?> watchevent : key.pollevents()) { watchevent.kind<?> kind = watchevent.kind(); if (kind == standardwatcheventkinds.entry_create) { watchevent<path> eventpath = (watchevent<path>) watchevent; path newfilepath = eventpath.context(); boolean writable = false; system.out.println(writable); long size = files.size(newfilepath) / (1000 * 1000); system.out.println(newfilepath.toabsolutepath() + "wriable:" + writable + "size:" + size); watchkey.reset(); ...

Special characters in Yii framework menu -

i'm developing cms using yii framework. in developing theme have problem. in menus have special characters (the website in italian). html markups special characters doesn't work menu items. , if put character looks different. here code: <div class="horizontal-menu"> <?php $this->widget('zii.widgets.cmenu',array( 'items'=>array( array('label'=>'le attivit&agrave;', 'url'=>array('/site/page', 'view'=>'attivita')), array('label'=>'news', 'url'=>array('/site/page', 'view'=>'news')), ), )); ?> le attivitÀ 1 making problem. how can show special characters here? cmenu 's labels html-encoded default, should use array('label'=>'le attivitÀ', 'url'=>array('/site/page', 'view'=>'attivita')), . however i...

sql - Storing fixed number of items in mysql -

Image
i storing draw numbers (1-60) in fixed values , fixed order. one draw has 4 numbers has 6 numbers , 2 numbers my idea separate each draw type in separate sql table. question is, optimal store numbers in single column separated delimiter.... id(int) | numbers(varchar) or store each number in separate column instead? id(int) | num1(tinyint) | num2(tinyint) | num3(tinyint) | num4(tinyint) i won't needing search numbers when they're stored. if don't ever need search them separately or retrieve them separately, 1 opaque "blob" database perspective , won't violating principle of atomicity , 1nf storing them single filed. but , because that's case now, doesn't mean won't change in future. @ least use second option. also, allow dbms enforce integrity of domain , ensure these numbers , strings. however, future-proof data, i'd go further , use following structure: in addition treating numbers in uniform way , ...

c# - mvc 4 + iis7.5 application stop -

it's first time write here hope clear ! i've deployed mvc application on iis 7.5. in application_start starts operation download files on fixed interval. i've access windows server 2008 remote desktop on virtual machine. problem when logout virtual machine, application seems stop , not downloading anymore 'till don't start once time application. is normal or i've kind of problem in configuration ? i want application start 1 time , cycle kind of operations without stops.. on default application pool settings, normal (assuming have low traffic site). app pool shutdown after set inactivity period , take downloader offline it. believe default 20 minutes of inactivity. here's info on configuring timeout. http://technet.microsoft.com/en-us/library/cc771956(v=ws.10).aspx and here's info configuring iis auto start , run (to emulate windows service environment) http://weblogs.asp.net/scottgu/archive/2009/09/15/auto-start-asp-net-applicati...

graphics - R heatmap with diverging colour palette -

Image
i trying create simple heatmap in r, using diverging colour palette. want use gradient numbers below threshold n designated color (say purple), , numbers above threshold designated color (say orange). further away number threshold, darker color should be. here sample dataset: division,col1,col2,col3,col4,col5,col6,col7 division 1,31.9221884012222,75.8181694429368,97.0480443444103,96.295954938978,70.5677134916186,63.0451830103993,93.0396212730557 division 2,85.7012346852571,29.0621076244861,16.9130333233625,94.6443660184741,19.9103083927184,61.9562198873609,72.3791105207056 division 3,47.1665125340223,99.4153356179595,8.51091076619923,79.1276383213699,41.915355855599,7.45079894550145,24.6946100145578 division 4,66.0743870772421,24.6163331903517,78.694460215047,42.04714265652,50.2694897353649,73.0409651994705,87.3745442833751 division 5,29.6664374880493,35.4036891367286,19.2967326845974,5.48460693098605,32.4517334811389,15.5926876701415,76.0523204226047 division 6,95.496916491538...

php 5.3 - PHP Substring output with 2 params -

i have php code this,my output correct ?date format (yy/mm/dd) year month & date format >> 120924( it's 2012/09/24) $yearchk=(int)substr($date,0,4); $monthchk=(int)substr($date,5,2); $daychk=(int)substr($date,8,2); in here there's substring.is output correct in substring. my yearchk output > 12 monthck output > 09 daychk output > 24 is outputs correct ? don't use substr. use date , strtotime function, this. do way:- <? $userdate = "2012/09/24"; $y = date('y',strtotime($userdate)); $m = date('m',strtotime($userdate)); $d = date('d',strtotime($userdate)); echo 'year: ' . $y . ' month: ' . $m . ' date: ' . $d; refer live demo

login - rails,devise, heroku and multiple dynos -

we have application running on heroku, has multiple dynos. let's application has 2 dynos, , when user logs in, he's being served first dyno. if reason, subsequent requests served second dyno, appears not being logged in. the way fix ( tested ) seems setting session store cookie store. has else encountered problem before? i think didn't have other session store configured properly. did have cache service wired in memcached or redis, each dyno shared location finding session info? heroku memcache ruby

ios - Populating NSMutableArray from JSON -

i'm beginner working on presentation application lets pick 4 different categories. each category takes uitableview manually populated nsmutablearray looks this: slideshows = [[nsmutablearray alloc] init]; slideshow = [[slideshow alloc] init]; slideshow.presotitle=@"all ducks"; slideshow.presoinfo=@"preso1"; [slideshows addobject:slideshow]; slideshow = [[slideshow alloc] init]; slideshow.presotitle=@"the computer age"; slideshow.presoinfo=@"preso2"; [slideshows addobject:slideshow]; slideshow = [[slideshow alloc] init]; slideshow.presotitle=@"shovels , you"; slideshow.presoinfo=@"preso3"; [slideshows addobject:slideshow]; slideshow = [[slideshow alloc] init]; slideshow.presotitle=@"test em out"; slideshow.presoinfo=@"preso4"; [slideshows addobject:slideshow]; i made custom object called slideshow properties presotitle , presoinfo. slideshows name of array , slideshow (lower case) represents ...

haskell - promoted datatypes and class instances -

promoted datatypes have fixed number of types members of promoted data kind . in closed world make sense support calling function on typeclass without dictionary explicitly in scope? {-# language datakinds #-} {-# language polykinds #-} data datatype = constructor data datatypeproxy (e :: datatype) = datatypeproxy class class (e :: datatype) classfunction :: datatypeproxy e -> io () -- instance can created instance class 'constructor classfunction _ = return () -- adding class constraint fixes build break -- disp :: class e => datatypeproxy e -> io () disp :: datatypeproxy e -> io () disp = classfunction main :: io () main = disp (datatypeproxy :: datatypeproxy 'constructor) this contrived example doesn't work in ghc head. it's not @ surprising seems datakind extension might make possible. test.hs:18:8: no instance (class e) arising use of `classfunction' possible fix: add (class e) context of type signature dis...

c# - How to use dependency injection in enterprise projects -

imagine have application several hundreds of classes implementing dozens of "high level" interfaces (meaning component level). there recommend way of doing dependecy injection (like unity). should there "general container" can used bootstrapping, accessible singleton? should container passed around, instances can registerinstance? should done registertype somewhere in startup? how can container made accessible when needed. constructor injection seems false, controverse of being standard way, have pass down interfaces component level down used right on startup, or reference hold ending in "know live" antipattern. and: having container "available" may bring developers idea of resolving server components in client context. how avoid that? any discussion welcome! edit clarification i figured out realworld example have better picture of problems see. lets imagine application hifi system. system has cd player (integrated in cd-rack) , u...

assembly - Programming a microprocessor? -

i have little background java , arduino programming, , 1 thing have made can seen in youtube video arduino webcam bot . so far, have plugged in usb cable arduino, pressed "transfer" , program magically compiled , loaded arduino. now fun, hoping more insight in embedded systems otherwise. if try program processor in assembler, first of all, processor start off with, , how do own transfer of program onto processor? arduino uses atmega328 , @ least if you're using uno or previous version. since you're @ least familiar hardware now, i'd suggest keep using (you have hardware too!). move away arduino environment more of native environment, go atmel's website , download avr studio . you'll need purchase avr isp programmer, atavrisp2 . allow transfer code avr studio atmega chip on arduino. there quite bit of support documentation on atmel website should going.

java - @JoinTable to use Imported Key instead of primary key -

using jpa/hibernate 3.6/db2. i have got following exception: caused by: org.hibernate.annotationexception: secondarytable joincolumn cannot reference non primary key caused by: public class xrequest { @manytoone @jointable( name = "requestbatch", joincolumns = @joincolumn(name = "requestbatchid", referencedcolumnname="requestbatchid"), inversejoincolumns = @joincolumn(name = "requestversionid") ) private requestversion requestversion; } requestbatchid not primary key, imported key requestbatch table (and there, indeed primary key). why jointable have use primary key? mean, didn't define many-to-one association? why have primary key? to specify: tables like. xrequest ( requestid int (primary) requestbatchid int (imported key requestbatch) ) requestbatch ( requestbatchid int (primary) requestversionid int ) requestversion ( requestversionid int (primary) ) the wanted outcome sql query built me hibernate...

javascript - Responsive Galleria -

i'm trying use plugin galleria in responsive mode, means re draw based on container size window re-sizes. demo on link i've provided shows example. can see that, resize window, whole gallery adjusts accordingly. issue is, plugin won't let me initialize gallery unless height has been specified dom element used container. means, i've had write whole lot of javascript code respond window resizes - destroys point of having responsive mode quite bit - in website above, can find explicit height specified. can explain me i'm going wrong? i figured out myself. posting answer - when initializing gallery - specify height in percentages - below. i'm guessing takes 50% of window height value in case. way, don't need explicitly specify heights anywhere , works advertised galleria.run('#gallery', {responsive:true, height:0.5, debug:false});

Outlook 2010 - C# - Get the account associated to a mail -

i'm creating outlook add-in can save selected emails external database. using office.iribboncontrol can list of selected email, need know account mails associated. i mean, if outlook messages toto@exemple.com , otot@exemple.com , when want save message need know information. i can't use informations sender / receiver because can outcome income email. currently, have found using current folder path.. public void sayhello(office.iribboncontrol control) { messagebox.show( "folder: " + (control.context outlook.explorer).currentfolder.folderpath, "test", messageboxbuttons.ok, messageboxicon.information); } but method isn't enough. if open message ( in separated window ) , change current folder, fails. also, outlook.explorer.currentaccount not work expected. so here question : how can access related account having outlook.mailitem object ? you can parent folder ( mailitem.parent ) of outlook....

ruby on rails - Thinking Sphinx wild card search and fuzzy operator not found -

i trying implement full text set of models. heard power of sphinx in indexing speed , search time. wild card searches , nearest word match ( levenshtein distance) not working in this. post.search 'kar' returns no results while post.search 'karthik' returns 10 results matching exact string. tried star parameter post.search 'kar' , :star => true returns 0 results. i tried combinations ' kar* ' , ' krathik~ ' , etc in lucene flavored full text search engines , works fine. missing optional parameters or sphinx still lacks feature? have added following config/sphinx.yml file? development: min_infix_len: 2 sql_host: localhost sql_user: root

python - Is autopy installable locally? -

i seem have trouble installing autopy.h https://github.com/msanders/autopy/#introduction i tried installation via git: $ git clone git://github.com/msanders/autopy.git $ cd autopy $ python setup.py build but following error: >python setup.py build running build running build_py running build_ext building 'color' extension gcc -pthread -fno-strict-aliasing -dndebug -g -fwrapv -o2 -wall -wstrict-prototypes -fpic -dndebug=1 -dmm_little_endian -duse_x11 -i/usr/include/python2.6 -c src/autopy-color-module.c -o build/temp.linux-i686-2.6/src/autopy-color-module.o -wall -wparentheses -winline -wbad-function-cast -wdisabled-optimization -wshadow in file included src/autopy-color-module.c:1: src/autopy-color-module.h:5:20: error: python.h: no such file or directory in file included src/autopy-color-module.c:1: src/autopy-color-module.h:11: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘initcolor’ ... src/autopy-color-module.c:48: error: expected ‘=’, ‘,...

Hibernate mapping SQL View -

2012-06-13 18:09:47,777 error [main] schemaupdate - unsuccessful: alter table *************.******** add index fkbca22c66af04751f(xxxxxxx, zzzzzz), add constraint fkbca22c66af04751f foreign key (xxxxxxxx, zzzzzzz) references ***********.************* (categoria_id, azienda_id) 2012-06-13 18:09:47,779 error [main] schemaupdate - '************.********' not base table i've view in schema, don't understand correctly how mapping hibernate on project based log seems case try update definition of database view via schemaupdate . not want do. how avoid depends how configured hibernate. if via hibernate.cfg.xml, should remove following (or change update validate): <property name="hbm2ddl.auto">update</property>