Posts

Showing posts from June, 2011

database - Combine separate spreadsheets into one master sheet in Excel? -

i need combine 3 excel spreadsheets 1 "master" sheet quickly. the first sheet has following columns: customer (company name) email telephone fax contact contact's telephone contact's fax contact's email the second sheet has following columns: customer (company name) delivery street delivery country delivery zip the last sheet has following columns: customer (company name) sales representative i tasked combining above information 1 excel sheet within next few hours. if customer lists identical copy columns , call day. sheets have duplicates, , in 3 sheets customers not identical. need "master" set of data following columns: customer id (auto-assign) customer sales representative contact contact email contact telephone contact fax company telephone company email delivery info i have excel 2013, if helps. you copy customer (company name) lists single sheet , perform remove duplicates , use 'mast

Magento product page stops rendering. No errors -

i'm having problem on magento product page. page stops rendering part way through. by deleting parts of view.phtml file have traced problem line <?php echo $this->getchildhtml('media') ?> removing line allows page render. template using base/default media.phtml file don't see problems this. i can't meaningul errors out of magento. have error logging enabled in end, have moved errors/local.xml.sample errors/local.xml , have enabled display_errors in index.php . i'm bit stuck now. i had same problem. noticed images not uploaded in admin. started digging , figured out die happens in: /lib/varien/image/adapter/gd2.php throw new exception("required php extension '{$value}' not loaded."); somehow , still cannot figure out, exception not shown, changed echo , gd extension. after simple apt-get install php5-gd became working!

php - Dynamic namespaced class with alias -

so, i have issue dynamic object creation using namespaces. here's namespace code: namespace foo { class bar { } } now, i'm trying create object of class bar with: include('namespace.php'); $sname = 'bar'; $sclass = '\\foo\\'.$sname; $robj = new $sclass; //correct object and going that. but, want use alias , doing like: include('namespace.php'); use foo baz; $sname = 'bar'; $sclass0= '\\foo\\'.$sname; $sclass1= '\\baz\\'.$sname; $robj = new $sclass0; //correct object $robj = new $sclass1; //fatal error and i'm unable instantiate object such way (and accessing via full name still works well). so, question - possible access class via alias somehow, and, if yes, how? i've tried access when using $sclass1='baz\\'.$sname - no success. also, i've checked declared classes via get_declared_classes() function, shows have \foo\bar class (no reference alias). i'm not

c++ - Best approach using Qt for a messaging application like Skype -

which widgets should use implement chat similar style of skype desktop? need put both incoming , outcoming messages, images, , other stuff. think qwebview choice don't know how append html code. widget recommend me purpose? regards,

iphone - Is there a way to persist application data between application installs and uninstalls in iOS -

i developing application needs perform expensive calculations @ start up. so, first time application runs, application calculations , store result in file. if user decides uninstall application , re-install later, calculations have done again , avoid re-calculate. notice not talking updates of application uninstall / re-install. i wondering if there way persist data accessible application can survive uninstalls. the solution can inside device (using kind of files / preferences / ...) or based in server. example, possible solution send device id result server , store there, device id has been deprecated in ios 5, not valid solution anymore. thank answers. jaime you don't how data, following options: icloud keychain dropbox the "universal" option, devices have , cannot disabled, keychain though limited amount of space can use. personally, nothing. if user deletes app think it's fair game have recompute stuff on reinstallation.

c++ - Is there a similar library as Thrust (parallel STL for GPU), but for GPGPU AMD Radeon? -

is there similar library thrust(parallel stl gpu, can use openmp/tbb, c++ cuda), gpgpu amd radeon (eg using opencl instead of using cuda)? required standard stl-algorithms (sort, merge, remove/copy if, in/exclusive scan, etc), optimal implemented in parallel in gpu amd radeon in win/*nix (amp not fit). amd provide bolt c++ template library. lib support both amp , opencl backend. http://developer.amd.com/tools-and-sdks/heterogeneous-computing/amd-accelerated-parallel-processing-app-sdk/bolt-c-template-library/

c++ - Detect if mouse button is down -

i new c++ , trying activate line of code only when left mouse button held down. in example, code works seems toggles it. when click, spams h key then, when click again, stops. currently have code: if ((getkeystate(vk_lbutton))) { keybd_event(vkkeyscan('h'),0,0,0); sleep ( 30 ); } edit: i have inside function: int winapi winmain ( hinstance hinst, hinstance p, lpstr cmd, int nshowcmd ); use determine if button pressed. if((getkeystate(vk_lbutton) & 0x100) != 0) http://vcpptips.wordpress.com/tag/vk_lbutton/

javascript - IFrame and Video Streaming Consuming my website bandwidth? -

i created website pages containing iframes stream videos. i'm planning host website @ webhost indicate me have limited amount of bw per month, question is: suppose have 1000 users per/ day , users watch videos in iframes (10 iframes watched per user in day) iframe streaming consume website bandwidth webhost allowed me? have 20 gb of allowed traffic ? what's in iframes? http transfers host thing consuming bandwidth. if "src" of iframe youtube, same user being on youtubes site, framed in site. now if plan host videos yourself, need ton of bandwidth , sort of cloud, edge, location based server type stuff , department.

Getting Word Recognition in Windows Phone Speech -

i working windows phone speech recognition , able take following speech: i walked 1 hundred miles and able able know, in app, hundred means 100 any ideas? according documentation recognizedphrase.text property should contain display text format asking for. as part of speech recognition process, speech recognizer performs speech-to-text normalization of recognized input display form. for example, spoken input, "twenty 5 dollars", generates recognition result words property contains words, "twenty", "five", , "dollars", , text property contains phrase, "$25.00" . more information text normalization, see replacementtext.

Are all hosted jQuery the same? -

jquery has many hosts, google , microsoft. jquery libraries hosted different companies vary? or, same same version? they same each version. can pick 1 like. when importing them website it's idea go minified versions. the difference may found in initial comment before library starts (sourcemappingurl) far library identical. i'd recommend using google's hosted jquery: <script src="//ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script> since have decreased latency , better caching..

How do c++ and g++ deal with unicode? -

i'm trying figure out proper way deal unicode in c++. want understand how g++ handles literal wide character strings, , regular c strings containing unicode characters. have set basic tests , don't understand happening. wstring ws1(l"«¬.txt"); // these first 2 characters correspond 0xab, 0xac string s1("«¬.txt"); ifstream in_file( s1.c_str() ); // wifstream in_file( s1.c_str() ); // throws exception when // call in_file >> s; string s; in_file >> s; // s contains «¬ wstring ws = texttowide(s); wcout << ws << endl; // these 2 lines work independently of each other, // combining them makes second 1 print incorrectly cout << s << endl; printf( "%s", s.c_str() ); // same case here, these work independently of 1 another, // calling 1 after other makes second call // print incorrectly wprintf( l"

Django - Modelform is_valid()=True but form.errors returns [{}, {}, {}, {}] -

the formset pass is_valid() verification {{ formset.errors }} returns [{}, {}, {}, {}] in template. (one {} each form in modelformset_factory formset. i dont understand form saved anyway... def setmapoptions(request, map_name): map_selected = ezmap.objects.get(map_name=map_name, created_by=request.user) layers_ordered = layermapoptions.objects.filter(ezmap=map_selected).order_by('position') layerform = modelformset_factory(layermapoptions, form=layermapoptionsform, extra=0) if request.post: pk_list = [int(x) x in request.post.get("layersorder").split(',')] formset = layerform(request.post, queryset=layers_ordered) if formset.is_valid(): form in formset: instance = form.instance instance.position = pk_list.index(instance.pk) instance.save() else: formset = ezmapoptionformset(user=request.user, instance=map_selected) formset2 = lay

performance - Android ProgressBar skipping frames -

i'm loading twenty items (webviews) linearlayout , while loading i'm showing progressbar hides linearlayout provide feedback user i'm doing work. the problem progress wheel freezes , warning in logcat choreographer saying "skipped frames! application may doing work on main thread." to avoid problem tried change using linearlayout 20 items , using listview adapter. ran webview recycling problems, eliminated recycling , used array of 20 items , every time listview needs load item, loads array if inflated before. then got problem can't scroll specified item because listview loads webviews when necessary can't calculate amount of scrolling needs done since heights of webviews vary. conclusion, had linearlayout implementation adding webviews it. is there solution problem? if there isn't, i'm thinking showing "loading..." textview instead of animated progressbar. by way, before asks, i'm using nexus 4 test app , not emulat

exchangewebservices - How to save message as msg using exchange webservices -

my requirement email messages mailbox on exchange 2010 server. need save attachments , messages file system. have no problem retrieving , saving attachments, wat ews allow me save message .eml file. these files going document repository system display .msg files, not .eml files. using web service application retrieve emails , attachments using ews. use console application call web service , complete process files go document repository system. thought converting .eml files .msg, can't find way that. thought getting id of message in web service , using id in console app using outlook interop retrieve message file , save .msg, can't find id match in both ews , outlook interop. i not have option use third party code or tools. i think set flexible, can't find way these messages file system .msg files. any appreciated. tshaffer this solution ews , .msg file format. uses third party api, works great http://www.independentsoft.de/exchangewebservices/tutorial

java - Multiple Subdomains in Apache / Tomcat with mod_jk -

i trying setup 2 subdomains 2 separate applications running 1 tomcat server , having hard time getting going. without subdomains able configure 1 virtualhost 2 mount points , able @ applications way ( looks http:// url/confluence ) not optimal. my set follows: subdomain - youtrack.url.com subdomain - confluence.url.com tomcat7 running 2 war files context paths of /confluence , /youtrack apache 2 running mod_jk against tomcat instance here httpd.conf setup jkworkersfile /etc/httpd/conf/workers.properties jkloglevel info namevirtualhost *:80 <virtualhost *:80> servername youtrack.url.com serveralias www.youtrack.url.com jkmount /youtrack* tomcat documentroot /var/www/html/youtrack </virtualhost> <virtualhost *:80> servername confluence.url.com serveralias www.confluence.url.com jkmount /confluence* tomcat documentroot /var/www/html/confluence </virtualhost> here workers.properties worker.list=tomcat worker

ubuntu - Keyword for 64 bit ineteger in Linux Assembly Programming -

i new linux assembly programming , running x86_64 ubuntu 13.04 . far know . registers in 64 bits rax - 64 bit eax - 32 bit ax - 16 bit , again ah , al 8 bits but int in both 32 , 64 bit os 32 bits i.e int32. so if try copy int vaue in (say rax) take eax ( if know mean ) , simple question keyword(datatype) used 64 bit integers in linux assembly programming ? .int 32 bit inetger tried long , it's using 32 bit , dont know why. if need other info, reply below . you're looking .quad directive.

Asana API Adding an Attachment via cURL/PHP -

experiencing difficulty trying add attachment task using curl/php. $data = array("file" => "@$filename"); $headers = array("authorization: basic " . base64_encode($asana_api_key) . ":")); $ch = curl_init(); curl_setopt($ch, curlopt_url, "https://app.asana.com/api/1.0/tasks/$task_id/attachments"); curl_setopt($ch, curlopt_postfields, $data); curl_setopt($ch, curlopt_httpheader, $headers); curl_exec($ch); assume $filename, $asana_api_key, , $task_id set properly. should straightforward... unknown reason following response: {"errors":[{"message":"server error","phrase":"19 snobby warthogs cheer busily"}]} oddly enough, running request using curl command line works perfectly. i've tinkered hours no avail. any ideas issue may be? this bug on our end, , should fixed. had way curl sending filename, namely, entire path file. browsers typically send basename (without

php - combining two different queries into one merged foreach -

i'll try , explain best can. have 2 queries pulling data mysql, 1 pulls data on park reviews, other pulls data on ride reviews. both queries sorted review date . what want on web page 1 list of reviews sorted review date park reviews , ride reviews mixed in 1 list. almost 2 foreach loops running, 1 each query taking in turns based on date. these 2 queries: rides $query4= 'select review_id, review, tpf_reviews_rides.user, date_format(date_ridden, "%d %m %y") date_ridden, date_format(review_date, "%d %m %y") review_date, tpf_rides.name ride_name, rating, tpf_parks.name park_name, country tpf_reviews_rides inner join tpf_rides on tpf_reviews_rides.ride_id = tpf_rides.ride_id inner join tpf_ratings_rides on tpf_reviews_rides.rating_link = tpf_ratings_rides.rating_id inner join tpf_parks on tpf_reviews_rides.park_id = tpf_parks.park_id order review_date desc, review_id desc limit '.$start_from.' , '.$limit.''; for parks:

Batch: nested for variable cannot be compared -

i need compare 2 text files , lines appear in both of them. code: @echo off /f "tokens=*" %%a in (%1.txt) ( /f "tokens=*" %%b in (%2.txt) ( echo %%a %%b if %%a==%%b echo ok ) ) i test files a.txt (lines a, c , d) , b.txt (lines a, b , c). output: a b c c c b c c d d b d c if substitute %%a==%%b %%a==a, output following: a ok b ok c ok c c b c c d d b d c while test %%b==a instead, output same @ %%a==%%b. it seems me %%b couldn't compared anything. doing wrong? your code correct, second file (b.txt) has trailing spaces.

ruby on rails - N+1 detected on parent of parent model -

here model associations: expense belongs_to supplier belongs_to concept # example: "adsl connection , telephone july 2" > comcast > internet "water bill august 20" > pg&e > water i'm trying list of expenses, , show both company it's paid to, , concept belong to. the bullet gem alerting me n+1 query , recommend include it: n+1 query detected supplier => [:payment_concept] add finder: :include => [:payment_concept] and in controller, included supplier (for n+1) issue, when try include :payment_concept error it's not recognized symbol: @expenses = expense.all(:include => [:supplier, :payment_concept]) # in view: .rows - expense in @expenses .item p.date.lato= expense.date_made p.supplier.lato= expense.supplier.name p.payment_concept.lato= expense.supplier.payment_concept.name p.payment_type.lato= expense.payment_type.name p.account.lato= expense.account p.price.lato=

awt - Tracking mouse movement in java -

i've been working on basic tower defense game , looking track movements of mouse. don't need track mouse movement when dragging when hovering on screen user can see tower going placed. i've extended mouseadapter make controller , clicking place tower works can't figure how track mouse movement otherwise. should overriding mousemoved this? tried little success. after putting print statement see event not firing. have currently: public class mousecontroller extends mouseadapter { private final board my_board; private final int square_size; public mousecontroller(final board the_board, final int the_square_size) { my_board = the_board; square_size = square_size; } @override public void mouseclicked(final mouseevent e) { super.mouseclicked(e); point p = e.getpoint(); my_board.placetower(p.x / square_size, p.y / square_size - 1); } @override public void mousemoved(final mouseevent e) {

ruby on rails - How to reference attributes in deep associations -

summary rails 3.2 refinerycms 2.0. these pseudocode models: industry name has_many companies has_many works through companies company name has_many works belongs_to industry work name belongs company from instance of work, can work.company.name , name of associated company. expect follow company.industry.name without problem. however, getting unhelpful error: wrong constant name refinery:industries what follow associations way ie work.company.industry.name, chain broken between company , industry seems. doing wrong here? here's code in more detail. code here models. idea prevent me accessing industry attributes associated company given industries have_many companies (companys lol) , companies belong_to industry? appreciated. industry model module refinery module industries class industry < refinery::core::basemodel ... attr_accessible :name, :description, :position has_many :companys, :class_name => 

linux - finding file size for a conditional -

i'm trying write conditional statement if file greater 1gb prints name of file, in file, , skips processing it. #!/bin/bash f in *.dmp if [ ! $(stat -c %s $f > 1000000000) ]; name=`basename ${f%.dmp}` if [ -f ../tshark/$name.dat ]; echo "file exists, moving on..."; else echo "processing" $name; tshark -pvx -r "$f" > ../tshark/$name.dat; echo $name "complete, moving on..."; fi else echo $f "too large"; echo $f "\n" > toolarge.txt; fi done the problem ! $(stat -c %s $f > 1000000000) isn't working. i'd appreciate suggestions. so, if haven't seen advanced bash scripting guide , should. yes, it's focused around bash, it's great reference things conditional. now, you've written tries execute stat -c %s $f > 1000000000 command (it's inside parens on $() cons

c# - DirectShow in asp.net needs controller handle -

im building asp.net webcam website , need help. (using directshowlib) in order show webcam stream need controller handle pass. in asp.net there no handle property controller. i know can create windows form controller , import website requires clients approval , want avoid it. any ideas can use instead? make class library project , add user control form display webcam . make activex control , use in asp.net project. check here more information. mark answer if helps..!!!

java - How to parse this JSON in android (returned from .NET webservice) -

i have asp.net webservice return person object in json format. please see following webservice code: [webmethod] [scriptmethod(responseformat = responseformat.json)] public person person() { person me = new person(); me.name = "mark"; me.lastname = "brawn"; return me; } public class person { public string name; public string lastname; } then tried parse response in android client , following json output: { "d": { "__type": "webservice+person", "name": "mark", "lastname": "brawn" } } this output seems valid json format, know how properties output ( name, lastname...). in android parsed output: jsonobject json = new jsonobject(result); json.getstring("name"); but exception: 07-12 19:07:14.708: w/system.err(21575): org.json.jsonexception: no value name so value "name", , "lastname" json. appriciated. the

fullcalendar - Show only Months with Events In them? -

would there way limit next/prev buttons show months events registered in them? have courses fill , don't want users have fast forward through blank months there no availability of events. i'm including holiday events basic google public holidays calendar , don't want include events. as long know, option not exist in fullcalendar yet. if retrieving events month month: can bind fullcalendar's next , previous events new function. inside function, events , if there no events, function must call next or previous again. if retrieving events @ once can bind fullcalendar's next , previous events new function. inside function, events , first date out of current month. set fullcalendar's current date month , refresh it.

java - Heap memory vs object memory -

according paper java memory , characteristics: "... the memory score partitions 2 types: heap memory, memory consumed application during runtime, , object memory, memory allocated various objects used in program, such integers , strings, etc. ..." do mean stack memory when object memory, or mean? (confused since, if not wrong, objects allocated in heap in java) second question, if want measure total size of heap , stack during full program execution, tool should use? have been looking around , tried out built-in java profiler in netbeans 7.3.1 , yourkit 12.0.6 , able inspect heap when comes studying "objects" , variables placed on stack, can not find way! to sum up, how measure paper describing: total heap memory used total object memory used thanks! heap memory : storage java objects. when use new keyword create instance of class. stack memory : used store local variables, method call, etc. jvm can decide , use store objects

jquery - FancyBox 2 Background Issue -

i'm trying use fancybox ( http://fancyapps.com/fancybox/ ) show image automatically on page, background (greyed-out) portion not working. ideas? see example @ http://www.southshoreopera.org the issue if open fancybox programmatically before dom ready, somehow overlay not appended body element. this : <script type="text/javascript"> $(".fancybox").fancybox({ // api options }); $(".fancybox").eq(0).trigger('click'); </script> ... trigger fancybox on page load without overlay (a manual click link thereafter won't reproduce issue though) you should wrap @ least .trigger() method inside .ready() method : <script type="text/javascript"> $(".fancybox").fancybox({ // api options }); $(document).ready(function(){ $(".fancybox").eq(0).trigger('click'); }); </script> you can leave fancybox init outside .ready() method if initializing @ bottom of page

Retrieve HTML from jsBin to use as template in another bin -

i'm building example of angular views in jsbin that's not acting how expect. know in jsbin can request javascript bin when there no html appending js address of bin. e.g. http://jsbin.com/acufuca/1/js //works javascript so far not seem case html. there way have jsbin return markup have in html section out wrapping or injecting other parts of document (css, javascript)? when view source of bin has html see there still script tags being added. i have tried raw url: http://jsbin.com/onudenu/1 using same syntax used javascript: http://jsbin.com/onudenu/1/html whim of: http://jsbin.com/onudenu/1/?html the demo trying build , use jsbin source of templates... http://jsbin.com/ovubehi/4/edit there's no way just html alone in jsbin. wasn't sure there ever use case...as .html contains script tags , jsbin combining you. if follow correctly, you're trying html can use template (in example), right? if that's case, way can creating second bin c

jQuery Address Plugin with Navigation and Tabs -

i'm having little problem jquery address plugin. i must add navigation , tabs @ same time. there 2 problems seems can't figure out. 1) when clicking on navigation element, instead of changing location path path + href of link, adds " home.html#/about.html ". 2) , when go tab part change "id" since page not changed location.path adds firs page clicked. => " home.html#direction-tab " , when happens, can't link tab since it's pointing home page instead of contact page. i read documentation tabs (using jquery ui), since html structure little different prefer added custom. js: $.address.change(function(event) { if ( event.value != undefined && event.value != '/' ) { $('#content').load(event.value.replace(/\//,'')+ ' #content') } }) i tried add titles links , work them 1 of exmaples in live site, didn't seems quite logic behind it. jsfiddle it seems figu

CakePHP: Can't login when using Members Controller instead of Users Controller -

i have strange issue cannot figure out anymore. setup cakephp project , using users controller handle authentication , working perfectly, 100%. however, decided drop users controller, model , views , replace members 1 because members primary users 1 or 2 admin's need login. what have in members model, controllers , views identical had in users default cakephp wants use users model , users table. did lot of debugging , got cakephp use members instead of users cannot login keep getting your username , password incorrect, please try again error message. here's have way of code, i'm hoping can point me in right direction. appcontroller.php function beforefilter() { $this->auth->usermodel = 'member'; $this->auth->authorize = array('member'); $this->auth->allow(array('view', 'index', 'add', 'edit', 'delete')); } public $helpers = array ('html', 'form', 'session&

java - Android setPrompt custom font -

i have got spinner set , have spinnermode set dialog. using custom font everywhere in program, , want know how set prompt of spinner use custom font. have looked everywhere on how , have yet find it. here how have setup spinner far. arrayadapter<string> adapter = new arrayadapter<string>(this, r.layout.my_spinner_style, items) { public view getview(int position, view convertview, viewgroup parent) { view v = super.getview(position, convertview, parent); typeface tf = typeface.createfromasset(getassets(), "fonts/exo-bold.otf"); ((textview) v).settypeface(tf); return v; } public view getdropdownview(int position, view convertview, viewgroup parent) { view v = super.getdropdownview(position, convertview, parent); typeface tf = typeface.createfromasset(getassets(), "font

javascript - Menu in Joomla site appears behind content -

i asked update joomla site 1.5 2.5. in order had update site 1.5.26 in order use jupgrade. but upgrading site 1.5.26 went wrong menu. appears behind content. tried use z-index in many css template has resolve problem nothing seems work. css knowledge appears not enough crack nut. the strangest thing me problem chrome , ff, in ie works allright (normally...) any advise appreciated, live site. edit: deleted client side address as quick fix adding following css should work: #horiz-menu li:hover ul { visibility: visible !important; opacity: 1 !important; } long term should fix root of issue (likely javascript looks of things). it appears opacity set 0 1 fine - problem once reaches 1 transitions 0 again ... i'm not entirely sure why happening, why menu appears briefly dissapears. this should act lesson never upgrade cmses live - always test locally, upload, upgrading seems break things. it's never fun have fix on live site. edit: incidentally

c# - ListBox in WPF while using ItemContainerGenerator returns null -

Image
i have listbox in xaml, few checkbox , filter button. application generates loads of logs display in listbox. when have data in listbox, xaml user check\uncheck checkbox. based on data in listbox filtered when button clicked. depending on data want show different forecolor , background color on each item. private void filterbutton_click ( object sender , routedeventargs e ) { //whenever filter button clicked, check checkbox status. whichever //checkbox on add checkbox name dictionary. read string listbox , extract particular keyword , match dictionary key. if //matches modify background , foreground color particualr //listbox items. problem here listbox items updated rest of them //unchaged. when debugged found itemcontainergenerator returns null other //items. ( int = 0 ; < listbox1.items.count ; i++ ) { listboxitem item1 = ( listboxitem )listbox1.itemcontainergenerator.containerfromindex(i); string recordtype; string [] contentarray;

css3 - CSS Animation Fade In Slide Down -

i'm trying recreate flash animation html/css got stuck. this actual animation, first image dark background fades in, next image slide down http://www.learner.org/series/econusa/interactivelabs/graphing-lab_moose-synthesizer-co/ here's got far... how can add second image slide down? http://jsfiddle.net/tetonline/qznut/2/ html <img onload="this.style.opacity='1';" src="https://tchuatocolearner.eppi.com/temp/graphinglab/images/blur.png" /> css img { opacity:0; -moz-transition: opacity 3s; /* firefox 4 */ -webkit-transition: opacity 3s; /* safari , chrome */ -o-transition: opacity 3s; transition: opacity 3s; } i created rough version can work uses css3 animations along 2 javascript functions add/remove animation classes. check out here this perform better javascript/jquery version. also, recommend making slide down elements div s opposed img s can have content within buttons added. here relevant code <div

java - Hibernate search range in a List<Integer> -

i starting hibernate search , struggling query on list<integer> i created bridge translate list<integer> string. this, able search keyword exact matches on item on list, don't seem able query using range. my entity has attribute "b" defined list. i know if can me query entities have of b elements inside defined range? for example: instance following collection {1,10, 15}, should come in following queries on "b" attribute: below(20), above(14), below(2) but not in search like: above(16), below(0). i hope made myself clear. in advance! change bridge storing same field multiple times, each value of integer list. assuming field called myint, store myint = 1, myint = 10 , myint = 15, example code: public class mybridge implements fieldbridge { public void set(string name, object value, document document, luceneoptions luceneoptions) { if (value instanceof list){ for(object myint:(list)value){

sql - Releasing an .MDF File in VB.NET -

i have application checks see if it's recent version. if not, updates using file.copy replace db attached application fresh 1 (that may or may not have had changes made it). in attempt keep data being deleted, created backup system writes data xml file before database deleted , restores data once database has been copied. i having problem file.copy method, however, in error pops telling me .mdf being used process. i told stopping sql server work, hasn't. i've been told can use smo, have not been able make work. seeming close complete, smo seems won't necessary. my code this: 'this backup. make sure close sql connection when process complete. dim db string = "c:\ace db\localacetest.mdf" dim dblog string = "c:\ace db\localacetest_log.ldf" if file.exists(db) = true 'backup process '... end if '"data/localacetest.mdf" referenced below file loca

iphone - Free non-consumable in-app purchases with ios -

i noticed there free tier non-consumable in-app purchases on itunesconnect. however, have seen conflicting reports whether purchases function same when prices set tier. can clarify few points? what happens when setting existing purchase free tier? are new purchases approved when set free? (bonus) how long has free tier non-consumables existed?

ruby on rails - With Omniauth, How to record all requests for authentication? -

with omniauth in app, have user use google oauth2 authenticate redirect user to: /users/auth/google_oauth2 if users approves request, authenticationscontroller#create called. with authenticationscontroller#create - can add event tracking record # of users approve google auth. don't have number sent approve meaning don't have conversion rate. how can track # of people hit url around making requests connect. a nasty solution build filter around method strategy#request_call , tracking there. inside initializer: omniauth::strategy.class_eval def request_call_with_tracking log :info, "im running before actual request_call" tracker.hit(name) #name return provider request_call_without_tracking end alias_method_chain :request_call, :tracking end

python - argparse fails when called from unittest test -

in file (say parser.py ) have: import argparse def parse_cmdline(cmdline=none): parser = argparse.argumentparser() parser.add_argument('--first-param',help="does foo.") parser.add_argument('--second-param',help="does bar.") if cmdline not none: args = parser.parse_args(cmdline) else: args = parser.parse_args() return vars(args) if __name__=='__main__': print parse_cmdline() sure enough, when called command line works , give me pretty expect: $ ./parser.py --first-param 123 --second-param 456 {'first_param': '123', 'second_param': '456'} but want unittest it, write test_parser.py file: import unittest parser import parse_cmdline class testparser(unittest.testcase): def test_parse_cmdline(self): parsed = parse_cmdline("--first-param 123 --second-param 456") self.assertequal(parsed['first_param'],'123')

php - $serviceUrl: Caught Exception: Missing serviceUrl configuration value -

i creating requestreport in php script. i seem stuck issue $serviceurl - giving me ol' fashion "caught exception: missing serviceurl configuration value. may obtain list of valid mws urls consulting mws developer's guide, or reviewing sample code published along side library. response status code: -1 error code: invalidserviceurl error type: request id: xml: responseheadermetadata: " am using correct url below? $serviceurl = " http://mws.amazonaws.com "; i have google'd few times , have seen 1 reading: $serviceurl = " http://mws.amazonaws.com/orders/10-01-2011 "; perhaps using wrong...but still no go. this works wonders in mws scratchpad, can't seem use correct "endpoint" script. your urls doesn't work : http://mws.amazonaws.com/orders/10-01-2011 http://mws.amazonaws.com/ try url : https://mws.amazonservices.com/ // use endpoint marketplace string serviceurl = "https:/

javascript - How to submit selected checkbox items? -

i have list of items need selected , take action based on user's request. user selects items , click on 1 of btns on items. my code following not sure how complete it. believe, need put them in form submitted or pass not sure how have form 2 submit btns, (if need have ). <body> <p><b>shopping cart</b></p> <table> <tbody> <c:foreach items="${mycart.items}" var="item"> <tr> <td> <input type="checkbox" name="items" value="${item.id}"/> </td> <td> name : ${item.name} </td> </tr> </c:foreach> </tbody> &

maven - How to deploy WAR using Netbeans 7.3.1 + JBoss AS7 -

this existing project builds , deploys fine using intellij + as7. want build , deploy using netbeans 7.3.1 created new maven project in netbeans, selecting "import project using maven pom.xml files" option. netbeans recognized modules , used maven build project successfully. nice. webapp assembled in [931 msecs] building war: g:\patrac_netbeans\patrac-web\target\patrac-web-1.0.war next, started jboss using netbeans' services panel. next, clicked run project button, expecting deployment occur, netbeans rebuilt project again. , remembered configuring intellij build & deploy using target directory. don't see way in netbeans. so, how set deployment using netbeans? update 8/20/2013: the deployment of ejb- , war modules work. here's output when deploying ejb: cd g:\patrac_netbeans\patrac-ejb; "java_home=c:\program files\java\jdk1.7.0_25" "\"g:\program files\netbeans 7.3.1\java\maven\bin\mvn.bat\"" -dnetbeans.de

coding style - C function headers location: .h or .c? -

this question has answer here: where document functions in c? 11 answers suppose have function (external considered here) int foo(int a, char *b), there header goes documenting function does, each parameter , return value does, etc. it'll in doxygen format too. habit such header should go .h files because that's interface defined , reader should have information in place. lot of people keep such headers in c file actual implimentation goes. i've seen in linux kernel code also. wrong? prefer? although header files can used in way, mechanism enable external linkage. you design api meant external consumption, , put required consume api (constants, types, prototypes) in header file(s). all other stuff, part of implementation, , doesn't need seen external users, can go in source files (if usage localized 1 file), or private headers can shared

ruby - Self-reference in a Rails Model -

let's have 2 models: user , point. point belongs_to user. point has 'amount'. want define method in point model return user's total points. i'd call in such manner: user.points.total i don't know how define method in point model in such way don't have pass user's id. i'd imagine there simple way this, googlefu failing me. assuming user model has has_many :points you can in user model def total_points points.sum(:amount) end

javascript - Responsive web design using right floating elements -

i know lot of responsive design uses percentage width , absolute positioning adapt screen widths of different media types. if can take advantage of float right css style not commonly used highly cross browser compatible? demo: http://jsfiddle.net/3a89q/48/ .wrapper { width: 70%; margin: 0 auto; } div, span { display: block; float: left; position: relative; } .wrapper > div { width: 60px; } .b1 { background-color: blue; height: 132px; } .b2 { background-color: red; height: 88px; } .b3 { background-color: green; height: 44px; } .test { background-color: black; max-width: 160px; min-width: 100px; float: right; border: 2px solid black; } .test div { width: 16px; height: 16px; background-color: yellow; margin: 2px; } <section class="wrapper"> <div class="b1"></div> <div class="b2"></div> <div class="b3"></div> <span class="test"> <div></div>

java - How to get a HashMap value and compare it to a number -

i have list of entries in hashmap, string key, , long value. i'm trying check if value greater number, i'm not sure how can value , check it. i know incorrect, may show mean better can explain: long offlinetimelimit = (offlinetimelimitconfig*1000); long limit = (offlinetimelimit + system.currenttimemillis()); long playername = playertimecheck.get(p); if (playertimecheck.containsvalue( > limit)) { } this gets amount of time player allowed offline, offlimetimelimitconfig, multiplies 1000 (so it's in milliseconds), adds current time. want check if of values in hashmap greater current time plus time limit, execute code. i've been doing research, , i've found other ways store data (like treemap) , i'm not sure if may better way store data. here's rest of code: string p = event.getplayer().getname(); hashmap<string, long> playertimecheck = new hashmap<string, long>(); configurationsection section = getconfig().getconfigurationsectio

bash - permission denied (public key) -aws interface -

i'm kind of new bash programming, decided take online class in create t1 micro instance through aws , ssh in , of our work there. had been sshing through alias had made fine month, took short hiatus 2 weeks. when came got permission denied(public access) message. have looked @ other threads , gone .ssh files , compared files , like. might have fact generated new key pairs on t1 micro instance, don't know how fix it. when debug ssh -v key.pem get: openssh_5.2p1, openssl 0.9.8x 10 may 2012 debug1: reading configuration data /users/myname/.ssh/config debug1: reading configuration data /etc/ssh_config ssh: not resolve hostname key.pem: nodename nor servname provided, or not known it's issue 1 of systems not recognizing key pair, can't resolve it. everyone, comments welcome. the problem ssh command what want run is ssh -i key.pem [user]@[servername]

sql - Schema Change/Update script for Database deploy -

i have need change database schema . i'm planning write schema change , update scripts tracking database changes , updating them. followed versioning databases – change scripts for start, got gist of getting @ since haven't worked on sql scripts before, tutorial or start good. did research on web , came know people use automatic comparing tools generate script don't want obvious reason won't learn in process. i'm looking tutorials/links on how write change scripts , update scripts ? update scripts couln't find single script/pseudo-code on how update schema comparing schemachangelog table, connecting table using scripts... thanks in advance! i recommend using database migration tool liquibase . each change database captured changeset , liquibase automatically keep track of changesets have been applied database, enabling updates , rollbacks.

Customer IP address on Magento Order Email -

the customer's ip address stored against order record in end of magento (ver 1.7.0.2 not available variable add new order confirmation email. can me change email template can field added email? many thanks 6 months late maybe, you're looking for? $order->getremoteip() i've not tried in context of email template i'd guess this: {{var remote_ip}} or failing that, try: {{var order.getremoteip()}} fwiw found getremoteip() function used in app/design/adminhtml/default/default/template/sales/order/view/info.phtml.