Posts

Showing posts from April, 2013

sql - Display all managers and employees without a manager -

i have table in sql server 2008 explanation purposes contains, id, employee , managerid. eg: id employee managerid 1 null 2 b 2 3 c 2 i want write query returns non related managerid 's , id 's managerid equal id . the result should this, id employee managerid 1 null 2 b 2 in essence no managers can managers of managers. at first thought simple using self join , exclude sql statement cannot work. prefer not use exclude statement actual table has more columns , related data return. if help, grateful. select employee, managerid your_table managerid null or managerid = id

java - In Activity.onCreate(), why does Intent.getExtras() sometimes return null? -

this false alarm, see my own answer . original question below: an activity has button takes user activity. launch new activity, populate our intent extras, , oncreate(), new activity reads extras via intent.getextras(). assumed returned bundle non-null, customer crash reports discovered, getextras() returns null. null-guarding extras, this answer shows , fine, if populate intent's extras, why ever return null later? there better place (like onresume()) read extras? edit: may because not following name convention required keys: the name must include package prefix, example app com.android.contacts use names "com.android.contacts.showall". this intent.putextras javadoc . happens if don't follow name convention; behavior defined? here's relevant code: class fromactivity extends activity { imagebutton button; @override public void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentvie

django - Set extra_context data according to login credentials for using in template -

well, following th documentation login in django site i'm using django.contrib.auth.views.login view in urls.py this: url(r'^login/$', 'django.contrib.auth.views.login',{'template_name': 'login.html'},name="my_login"), i can pass extra_context view, want according user credentials, in case of success login search relative data user print in template name, address, etc... storing in session or that, using example {{ request.user.username }} in template can retrieve username login request, that's want searching data according username in auth_user . can view or have implement own? regards! you can define new view using login view, in pass extra_settings : from django.contrib.auth.views import login auth_views_login def login(*args, **kwargs): extra_context = {'extra_value': 'some data here'} return auth_views_login(*args, extra_context=extra_context, **kwargs) then replace django view

Google Maps from Firefox addon (without SDK) -

i need add map in adddon , know how need in "common webpage", did here: http://jsfiddle.net/hcymp/6/ the problem don't know how to same in firefox addon. tryed importing scripts loadsubscript , tryed adding chrome html next line: <script src="https://maps.googleapis.com/maps/api/js?v=3.exp&sensor=false"></script> but nothing works. best solution found add part of code in this file (the code of script src) in function, import this file loadsubscript , , function executed empty div returned. components.utils.import("resource://gre/modules/services.jsm"); window.google = {}; window.google.maps = {}; window.google.maps.modules = {}; var modules = window.google.maps.modules; var loadscripttime = (new window.date).gettime(); window.google.maps.__gjsload__ = function(name, text) { modules[name] = text;}; window.google.maps.load = function(apiload) { delete window.google.maps.load; apiload([0.009999999776482582,[[["

django - Reusable app, define block only if not defined -

my app uses django's messaging middleware. in base template app have: {% extends "base.html" %} {% block messages %} <ul class="messagelist"> {% message in messages %} <li{% if message.tags %} class="{{ message.tags }}_message"{% endif %}>{{ message|capfirst }}</li> {% endfor %} </ul> {% endblock messages %} the problem override 'messages' block in site-scoped base.html . so if have styles defined in site base in example: {% block messages %} {% if messages %} <ul class="messagelist ui-state-highlight"> {% message in messages %} <li{% if message.tags %} class="{{ message.tags }}_message"{% endif %}>{{ message|capfirst }}</li> {% endfor %} </ul> {% endif %} {% endblock messages %} my 'reusable' template remove ui-state-highlight ... any way can define block messages in app's base if not defined? if follo

vb.net - No Data Returned on VB Report -

i'm new vb please don't laugh loudly @ coding skills :) i have created dataset (dataset1) pulls 2 tables. sql on table adapter joins 2 tables. table adapters return data correctly. data sources on report viewer are: dataset1_uapowdercoat dataset1_uapowdercoattype and both instantiated binding sources. there report parameter (lot num) needs filter info in report data 1 row. code in form load event: me.reportviewer1.localreport.datasources.clear() me.reportviewer1.localreport.datasources.add(new microsoft.reporting.winforms.reportdatasource("dataset1_uapowdercoat", uapowdercoattableadapter.getdata())) me.reportviewer1.localreport.datasources.add(new microsoft.reporting.winforms.reportdatasource("dataset1_uapowdercoattype", uapowdercoattypetableadapter.getdata())) me.reportviewer1.refreshreport() and in report event: dim params(0) microsoft.reporting.winforms.reportparameter params(0) = new microsoft.report

PHP form reloads current page on POST action, rather than displaying 'success.php' page. Why? -

i have php form submits data database. form action code follows: <form action="<?php echo $editformaction; ?>" method="post" name="form1" id="form1"> the $editformaction references following block of code: $editformaction = $_server['php_self']; if (isset($_server['query_string'])) { $editformaction .= "?" . htmlentities($_server['query_string']); } if ((isset($_post["mm_insert"])) && ($_post["mm_insert"] == "form1")) { $insertsql = sprintf("insert gifts (giftid, customerid, itemtype, itemtitle, itemdescription, itemurl, dateadded, received, datereceived, vendor, ordernumber) values (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s)", getsqlvaluestring($_post['giftid'], "int"), getsqlvaluest

PHP SQL Query string concatenation with MySQLi prepared statement -

what correct syntax concatenating strings , variables in php mysqli prepared statements? the code have right this: if ($test_stmt2=$mysqli->prepare("update friends set friendslist=friendslist+','+? friendsuserid=? ")) { //insert userid , frienduserid friends table $test_stmt2->bind_param('si', $friendid, $userid); //bind parameters (friend user id, own user id) $test_stmt2->execute(); //execute prepared query echo "success"; } basically, want string in friendslist column, add comma it, add variable string ( $friendid ) cell in friends table. it seems need sql concatentation. however, shouldn't use purpose. database structure deadly sin against holy normal form. please, not store comma-separated values in database cell. create distinct table store corresponding values. userid | friendid 1 | 2 1 | 3 1 | 5 5 |

ajax - Rails Controller Check if Turbolinks Request -

i developing ruby on rails 4 application using turbolinks gem. have noticed when link clicked layout still rendered server side turbolinks javascript grabs body out of rendered content. question on controller side possible determine if request made via turbolinks or not. in event request made via turbolinks want set layout false not execute un-needed code. in applicationcontroller have following code: # don't use layout when ajax request layout proc { |controller| controller.request.xhr? ? false: "application" } this code prevents ajax request rendering header if make ajax request via jquery, doesn't seem when comes turbolinks. although bit of hack, found checking header "x-xhr-referer" seems trick. unless request.headers["x-xhr-referer"].present? do_some_stuff end it seems turbolinks add header redirection handling. may change in future though.

log4j - RollingFileAppender to create a log file -

following log4j.xml file, trying use rollingfileappender create file rolled on over daily basis. i have necessary jar files in lib folder , using tomcat 7.0 run application when server starts gives following message. log4j:warn continuable parsing error 13 , column 13 log4j:warn content of element type "appender" must match "(errorhandler?,param*,rollingpolicy?,triggeringpolicy?,connectionsource?,layout?,filter*,appender-ref*)". any idea wrong following code? - <logger name="com.vzw.issi.logger.util.alertmanager" additivity="false"> <level value="error"/> <appender-ref ref="email"/> </logger> <!-- rules logging debug < info < warn < error < fatal --> <root>

uiwebview - How to do independently scrolling rows and columns (a la Netflix app) on Android in a WebView? -

Image
in netflix's android app, there webview covers entire app's area. when drag row left right, scroll row, , using nice inertial scrolling. if drag , down, scroll whole page , down. i've managed duplicate functionality on ios (in uiwebview in safari proper), not on android. on android devices, either painfully slow scroll, or have careful scrolling vertically start touching in background area between rows. neither of acceptable. obviously, don't want scrolling animation in javascript, slow. i know netflix using webview, so....what trick using? i have tried using css properties (for row div): overflow-y: hidden; -webkit-overflow-scrolling-x: touch to no avail. if can't css android compatible particular webview, why not create server-side functionality outputs requested rows seperate webviews? i following: * query web server determine how many rows there are. * programmatically add amount of rows web server says has. example, if server r

java 2d graphics array over an image -

i have built jpanel painted based on 2d array of data user can draw on. i'm wondering if possible somehow allow user upload background picture, set size of array based on image allow them draw on filling in array cells. of course, rubbing out colour in cell should original segement of image. is @ possible? haven't found anything? have array @ moment , drawing using mousemotionlistener can't seem find way set 2d array size based on image , display behind 2d array. i'm wondering if possible somehow allow user upload background picture, set size of array based on image allow them draw on filling in array cells. of course, rubbing out colour in cell should original segement of image. yes possible. key in programming break down big problem little steps , try solve each small step, 1 @ time. is @ possible? haven't found anything? your question broad find complete or partial solution searching online. again can find solutions each individual

java - How can I check if a String is an IP in Groovy? -

from given string: string someip = // string how can check, if someip valid ip format? you can use inetaddressvalidator class check , validate weather string valid ip or not. import org.codehaus.groovy.grails.validation.routines.inetaddressvalidator ... string someip = // string if(inetaddressvalidator.getinstance().isvalidinet4address(someip)){ println "valid ip" } else { println "invalid ip" } ... try this..,.

mysql - Bring value from one webpage to another webpage in Ruby on Rails website without database -

summary i'm trying bring value 1 webpage webpage on ruby on rails site without saving second time mysql database. i'm new ruby, in advance patience. overview my website users can save map have created. now, want them able edit maps. i have webpage, newmaps.html.erb, renders map. map has unique id: <%= newsavedmap.id %> there's "edit" button under map. when user clicks "edit", want him taken webpage, maptry.html.erb , form lets user edit map. problem i want specific newsavedmap.id transfer on maptry.html.erb can load form newsavedmap.startingaddress, newsavedmap.endingaddress, , of other data associated record. i think i'm supposed use "post", i'm not sure how in situation. link has given me ideas, form not rails form i'm not sure how translate own solution: pass custom _form text field parameter second page rails maptry.html.erb <div id="control_panel"> <div> <

c++ - Why would you use the keyword const if you already know variable should be constant? -

many of books reading use keyword const when value of variable should not modified. apart specifying readers of code may cause errors if modify variable (you can use comments this), why need keyword part of programming language? seems me if don't want variable modified, don't. could clarify me? apart specifying readers of code may cause errors if modify variable(you can use comments this) not "may"; will cause errors in program. a c++ compiler enforce compilation failures , diagnostic messages ("compiler errors"), no need comments; a c compiler enforce for part , though standard library has holes legacy, such strchr , , has rather lenient implicit conversion rules can allow drop const ness without realising quite easily. however, because got successful compilation doesn't mean don't have errors; unfortunately, does mean errors can subtle bugs in program, big, spectacular crashes. either way, program guaranteed contain e

Error building Titanium android module -

i'm having trouble building brand new canned generated module out of titanium studio on mac os x. i'm able build fine on linux when try on mac i'm getting weird errors out of ant build: buildfile: /users/michael/documents/titanium_studio_workspace/titanium_rtmp/build.xml python.set.exec: python.check: [echo] testing python [exec] python 2.7.2 init: process.annotations: generate.v8.bindings: [java] generating /users/michael/documents/titanium_studio_workspace/titanium_rtmp/build/generated/jni/com.innoverselabs.titanium.rtmp.exampleproxy.h [java] generating /users/michael/documents/titanium_studio_workspace/titanium_rtmp/build/generated/jni/com.innoverselabs.titanium.rtmp.exampleproxy.cpp [java] generating /users/michael/documents/titanium_studio_workspace/titanium_rtmp/build/generated/jni/com.innoverselabs.titanium.rtmp.titaniumrtmpmodule.h [java] generating /users/michael/documents/titanium_studio_workspace/titanium_rtmp/build/genera

python - Folder organization for easy translation -

i'm making application in python released in different languages. so i'm wondering best way organize project don't have literal strings in source code , replace them hand. here's have far thinking , information gather: first have module each language contain every strings application: english.py: greeting = 'hello world!' french.py: greeting = 'bonjour le monde!' then code written mymodule.py: if lang == 'eng': #how mimick 'preprocessor' in python? import english str elif lang == 'fr': import french str if __name__ == '__main__': print(str.greeting) does make sense way? should every language have it's own module? how achieve preprocessing conditionals of c in pythonesque way? i'm thinking there's no way hasn't been asked before maybe it's cuz english isn't first language , i'm doing wrong can't find info on best practices this. my system fu

eclipse - How to pause Android Background Runnable Thread? -

i have method throwing invocationtargetexception every single time right after onpause called. happening on line of "long totalduration = mp.getduration();" how go stopping exception? /** * background runnable thread * */ private runnable mupdatetimetask = new runnable() { public void run() { long totalduration = mp.getduration(); long currentduration = mp.getcurrentposition(); // displaying total duration time songtotaldurationlabel.settext(""+utils.millisecondstotimer(totalduration)); // displaying time completed playing songcurrentdurationlabel.settext(""+utils.millisecondstotimer(currentduration)); // updating progress bar int progress = (int)(utils.getprogresspercentage(currentduration, totalduration)); //log.d("progress", ""+progress); songprogressbar.setprogress(progress); // running thread after 100 milliseconds mhandler.postdelayed

parsing - ANTLR4- dynamically inject token -

so i'm writing python parser , need dynamically generate indent , dedent tokens (because python doesn't use explicit delimiters) according python grammar specification . basically have stack of integers representing indentation levels. in embedded java action in indent token, check if current level of indentation higher level on top of stack; if is, push on; if not, call skip() . the problem is, if current indentation level matches level multiple levels down in stack, have generate multiple dedent tokens, , can't figure out how that. my current code: (note within_indent_block , current_indent_level managed elsewhere) fragment dent: {within_indent_block}? (space|tab)+; indent: {within_indent_block}? dent {if(current_indent_level > whitespace_stack.peek().intvalue()){ whitespace_stack.push(new integer(current_indent_level)); within_indent_block = false; }else{ skip(); }

templates - C++ get Index value in integer from iterator -

i trying index value iterator. keep getting error "indirection requires pointer operand ('long' invalid)" idea? need index. on following example, should output 2. template<typename t> void practice(t begin, t end) { t = begin; it++; it++; auto index = - begin; cout << *index; cout << index; no need * dereference.

jQuery Mobile: Swipe div inside virtual page -

i have jquery mobile project. requirement swipe divs inside virtual page. <div data-role="page" id="individual"> <div data-theme="a" data-role="header" data-position="fixed" data-theme="c"> </div> <div data-role="content" style="padding: 0px"> <div id="imagediv1"> </div> <div id="imagediv2"> </div> <div id="imagediv3"> </div> </div> <div data-role="footer" data-position="fixed" data-theme="a"> </div> </div> this jquery virtual page. want swipe between divs imagediv1 imagediv2 , imagediv3. how can implement this? please help, thanks. there

linux - Flex: Fails to compile .as files -

i've installed flex sdk 4.6 in ubuntu through this guide . there ~/helloworld.as . i'm trying compile : $ mxmlc ~/helloworld.as but fails compile , : mxmlc: command not found please tell me missing here ? try following command before using mxmlc. $ sudo chmod +x /opt/flex/bin/mxmlc

python - Longest equally-spaced subsequence -

i have million integers in sorted order , find longest subsequence difference between consecutive pairs equal. example 1, 4, 5, 7, 8, 12 has subsequence 4, 8, 12 my naive method greedy , checks how far can extend subsequence each point. takes o(n²) time per point seems. is there faster way solve problem? update. test code given in answers possible (thank you). clear using n^2 memory not work. far there no code terminates input [random.randint(0,100000) r in xrange(200000)] . timings. tested following input data on 32 bit system. a= [random.randint(0,10000) r in xrange(20000)] a.sort() the dynamic programming method of zellux uses 1.6g of ram , takes 2 minutes , 14 seconds. pypy takes 9 seconds! crashes memory error on large inputs. the o(nd) time method of armin took 9 seconds pypy 20mb of ram. of course worse if range larger. low memory usage meant test a= [random.randint(0,100000) r in xrange(200000)] didn't finish in few minutes gave py

python - Twisted memory leak when connect attempt failed -

i being tortured twisted memory leaks. here code: # python: python 2.6.6 (r266:84297, aug 24 2010, 18:46:32) [msc v.1500 32 bit (intel)] on win32 # twisted: twisted-12.2.0.win32-py2.6 # os: windows 7 (64bit) twisted.internet.protocol import protocol, clientfactory twisted.internet import reactor class echo(protocol): def __del__(self): print 'echo.__del__' def connectionmade(self): print 'echo.connectionmade' self.transport.write('hello world!') class echoclientfactory(clientfactory): def __del__(self): print 'echoclientfactory.__del__' def startedconnecting(self, connector): print 'started connecting ...' def buildprotocol(self, addr): print 'connected. %r' % addr return echo() def clientconnectionfailed(self, connector, reason): print 'connection failed.' def connect(ip, port): factory = echoclientfactory() rea

ios - after changing the product Name, my code cannot run anymore in the simulator? -

in project, building setting, changed product name {target name} like, found cannot run code in simulator more. anyone has similar experience before , how solve it? the easiest thing do change " cfbundledisplayname " property in info.plist file , leave product_name setting (which " ${target_name} ").

google play services - Plus One Button not working in Android -

i need add +1 button android app. try describe problem: i installed google-play-services through sdk manager i copied file google-play-services.jar libs folder placed in project. i don't use eclipse use android studio building of project, therefore have manually write gradle file linkig google play services library. i put dependency gradle file compile files('libs/google-play-services.jar') i used relevant things integrate +1 button according sites: https://developers.google.com/+/mobile/android/getting-started https://developers.google.com/+/mobile/android/recommend first problem rendering problem , occured in develope layout of app. android studio writes me in design builder in design mode: "rendering problems: following classes not instantiated: com.google.android.gms.plus.plusonebutton ...", in text mode no problem. second problem when build project , run him on mobile device android 2.3.1. compilation successful when running on mobile device

html - How to work with CSS Child Selector in a List? -

i tested following code, , don't know why same html structure not working in list. inside div container p works fine. p inside .level1 class gets bold . same structure inside ul doesn't work. why li element inside .level2 class bold ? <ul class="level1"> <li>level 1</li> <li>level 1</li> <li>level 1 <ul class="level2"> <li>level 2</li> <li>level 2</li> </ul> </li> <li>level 1</li> </ul> <div class="level1"> <p>level 1</p> <p>level 1</p> <p>level 1 <div class="level2"> <p>level 2</p> <p>level 2</p> </div> </p> <p>level 1</p> </div> .level1 > li { font-weight: bold; } .level1 > p { font-weight: bold; } <ul class="level1"> <li>level 1

Android - compile error when implementing ServiceConnection -

i working on adding in-app billing , working this official documentation and on section binding iinappbillingservice here code: public class communityactivity extends baseactivity implements serviceconnection { arrayadapter<chatmessage> adapter; dialog dialog; arraylist<chatmessage> chat = new arraylist <chatmessage>( ); iinappbillingservice mservice; serviceconnection mserviceconn = new serviceconnection() { @override public void onservicedisconnected(componentname name) { mservice = null; } @override public void onserviceconnected(componentname name, ibinder service) { mservice = iinappbillingservice.stub.asinterface(service); } }; /** called when activity first created. */ @override public void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); flurr

compiler construction - How to parse AST openMP with clang -

i'm new compilers , started clang. parse openmp pragma lines clang , question is possible? in fact saw lots of presentation supporting openmp couldn't find example how parse? if have or know useful example, send me? thanks lot take @ polly . supports openmp , based on llvm. polly generates llvm ir annotated gomp library calls , easy write own pass handle on these calls. if need pragma information in frontend, need dig code handle on pragmas. in case not need write own parser. detailed information how polly handles openmp pragmas can found in document .

java - What is best way to fetch jdbc connection in sub method -

i have query regarding fetching jdbc connection pool in sub method.following 2 method came across suggest me 1 best avoid connection leakage , tell if other solution. method 1: getconnection method return connection . void testmain(){ connection conn = getconnection(); submethod(conn) conn.close(); } void submethod(connection conn){ // use jdbc connection return; } method2: void testmain(){ connection conn = getconnection(); submethod() conn.close(); } void submethod(){ connection conn = getconnection(); conn.close(); return; } the place need connection should connection. the way ensure no resources "leaked" using java 7's try-with-resource syntax: public string fetchsomedata() { try (connection conn = getconnection()) { // line, syntax, ensure automatically closed in invisible "finally" block // need data, return or else } catch (sqlexception e) { // no need clean here

ruby on rails - Faker: Don't know how to build task 'enviroment' -

i have sample_data.rake file: namespace :db desc "fill patients sample data" task populate: enviroment patient.create!(name: ["example", "user"], email: "example@gmail.com" password: "foobar" password_confirmation: "foobar" age: "26" doctor_id: "3" dao: "true" active: "true") 350.times |n| name=faker::name.name email = "example-#{n+1}@gmail.com" password = "password" age = (25...45).sample doctor_id = [2,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22].sample dao = ["true", "false"].sample active = "true" patient.create!(name: name, email: email, password: password, password_

c# - How can i cast IQueryable<> query to IQueryable<obj.getType()>? -

how can factorize code? filter returns several type of document. difficult have query per type... generic method return correct query thanks if(this.comboboxtype.text.equals("vente")) { iqueryable<vente> queryv = contextedao.contextedonnees.vente .include("client") .include("paiement") .include("employe").orderby(v => v.venteid); if (this.tbxnomcli.text != "") queryv = queryv.where(v => v.client.nom.contains(this.tbxnomcli.text)); if (this.comboboxetat.text != "tous") queryv = queryv.where(v => v.etat == this.comboboxetat.text); if (this.checkboxdate.checked) queryv = queryv.where(v => v.date.equals(this.datetimepicker.value.date)); if (this.tbxtva.text != "") queryv = queryv.where(v => v.client.numentrep

Highcharts: How to apply dashStyle to one column of line chart? -

Image
i trying apply dotted line last column in highcharts line graph unable find solution. here highcharts code: } xaxis: { type: 'datetime', datetimelabelformats: { year: '%y' }, tickinterval: date.utc(2012, 0, 1) - date.utc(2011, 0, 1), title: { text: 'years', style: {color: '#333', fontfamily: 'sans-serif',} } } yaxis: { tickinterval: 5, title: { text: 'points', style: {color: '#333', fontfamily: 'sans-serif'} } }, series: [{ showinlegend: false color: '#000' pointinterval: 31557600000 pointstart: date.utc(2005, 0, 1) data: [data['points_2005'], data['points_2006'], data['points_2007'], data['points_2008'], data['points_2009'], data['points_2010'], data['points_2011'],

extjs - Sencha Cmd failed to resolve dependency PARRENTCLASS -

i'm having problem sencha cmd tool; when try build app, error: [dbg] adding implicit dependency ext.application call [dbg] creating virtual class definition myapp.app.application [dbg] detected application name : myapp [dbg] caching symbol declarations [dbg] linking class inheritance graph [err] failed resolve dependency parrentclass file myapp. [err] error executing page compilation unknown definition dependency : parrentclass does know means? parrentclass dependency , filename myapp strange, don't have file. my app.js : // not delete - directive required sencha cmd packages work. //@require @packageoverrides ext.application({ name: 'myapp', appfolder: 'app', autocreateviewport: true, controllers: ["breadcrumbs", "content", "lang", "login", "ping", "sidebarmenu", "topmenu"], requires: ['myapp.singleton.context', 'myapp.singleton.storerefresh'

ruby on rails - creating an object with has_many association results in item can not be blank -

i have following associations , related controller, in form adding every field should be. still error ratings item can't blank when try create item. using rails 4.0 . did searched extensively not still find doing wrong. thankyou! class item < activerecord::base has_many :ratings, dependent: :destroy accepts_nested_attributes_for :ratings, :allow_destroy => true validates :name , :length => { minimum: 3 } validates :category , :length => { minimum: 3 } end class ratings < activerecord::base belongs_to :user belongs_to :item default_scope -> { order('created_at desc') } validates :user_id, :presence => true validates :item_id, :presence => true validates_numericality_of :rating, :greater_than_or_equal_to => 0 validates_numericality_of :rating, :less_than_or_equal_to => 5 end class itemscontroller < applicationcontroller before_action :set_item, only: [:show] before_action :user_signed_in?, only: :create

transactions - how do non-ACID RethinkDB or MongoDB maintain secondary indexes for non-equal queries -

this more of 'inner workings' undestanding question: how nosql databases not support * a *cid (meaning cannot update/insert , rollback data more 1 object in single transaction) -- update secondary indexes ? my understanding -- in order keep secondary index in sync (other wise become stale reads) -- has happen withing same transaction. furthermore, if possible index reside on different host data -- distributed lock needs present and/or two-phase commit such update work atomically. but if these databases not support multi-object transactions (which means not two-phase commit on data across multiple host) , method use guarantee secondary indices reside in b-trees structures separate data not stale ? this great question. rethinkdb stores secondary indexes on same host primary index/data table. in case of joins, rethinkdb brings query data, secondary indexes, primary indexes, , data reside on same node. result, there no need distributed locking protocols such

javascript - How to make a requirejs module with multiple files -

i wondering how make requirejs module multiple files. e.x. require 1 file somehow gets multiple files. know this: define([all other files], function () { var mod = {}, files = [all other files]; arguments.foreach(function (i) { mod.[files[i]] = i; }); return mod; }); but wondering whether there better method? you want dynamic list of files(.txt,.tpl,.htm,.json), avoid change in js source code add more files. i don't know if there way that, must take care time take download files. suggest create json file files want download, , iterate through array of files using ajax them. if try module inside directory, need create js file: <package-all>.js encapsulate require([all files],function()); example. i believe way solve this.

How to send virtual keys to other application using delphi 2010? -

i need send several virtual keys (vk_return) delphi application (myapp.exe) application (target.exe). eg : send vk_return twice , myapp.exe , target.exe the os use windows 7 64 bit , windows xp. i read : how send "enter" key press application? , send ctrl+key 3rd party application (did not work me) , other previous asked question. still i'm getting confused. how set focus target application ? how send virtual keys targeted application ? simple example : want send vk_return twice notepad.exe or calc.exe (already loaded) or other program delphi application. how ? the simplest way in delphi 2010, please... ps : tried sndkey32.pass http://delphi.about.com/od/adptips2004/a/bltip1104_3.htm , got error : [dcc error] sndkey32.pas(420): e2010 incompatible types: 'char' , 'ansichar' if (length(keystring)=1) mkey:=vkkeyscan(keystring[1]) if target application isn't foreground window, need use postmessage send keystrokes w