Posts

Showing posts from March, 2010

C++ sorting and keeping track of indexes -

using c++, , standard library, want sort sequence of samples in ascending order, want remember original indexes of newly samples. for example, have set, or vector, or matrix of samples a : [5, 2, 1, 4, 3] . want sort these b : [1,2,3,4,5] , want remember original indexes of values, can set be: c : [2, 1, 4, 3, 0 ] - corresponds index of each element in 'b', in original 'a'. for example, in matlab can do: [a,b]=sort([5, 8, 7]) = 5 7 8 b = 1 3 2 can see way this? using c++11 lambdas template <typename t> vector<size_t> sort_indexes(const vector<t> &v) { // initialize original index locations vector<size_t> idx(v.size()); iota(idx.begin(), idx.end(), 0); // sort indexes based on comparing values in v sort(idx.begin(), idx.end(), [&v](size_t i1, size_t i2) {return v[i1] < v[i2];}); return idx; } now can use returned index vector in iterations such as for (auto i: sort_indexes(v)) { c

.htaccess - pretty url not working -

below main.php 'urlmanager' => [ 'enableprettyurl' => true, 'showscriptname' => false, 'rules' => [ '<controller:\w+>/<id:\d+>' => '<controller>/view', '<controller:\w+>/<action:\w+>/<id:\d+>' => '<controller>/<action>', '<controller:\w+>/<action:\w+>' => '<controller>/<action>', ], ], i have enabled pretty url (i think), getting lot of 404's, like 192.168.1.3/~user/urshow/frontend/web/movies/movies_all have work fine if 192.168.1.3/~user/urshow/frontend/web/index.php?r=movies/movies_all , no links working worked perfect previously. try this... create .htaccess file in root folder , add following code rewriteengine on rewritecond %{request_filename} !-f rewritecond %{request_

python - How do I use Liclipse to write a ParaView script? -

i've tried following the directions here without success. here of environment variables: path: c:\python34\;c:\python34\scripts;...;c:\program files (x86)\paraview 4.3.1\lib\paraview-4.3\site-packages;c:\program files (x86)\paraview 4.3.1\lib\paraview-4.3\site-packages\vtk pythonpath: c:\program files (x86)\paraview 4.3.1\lib\paraview-4.3\site-packages;c:\program files (x86)\paraview 4.3.1\lib\paraview-4.3\site-packages\vtk;c:\program files (x86)\paraview 4.3.1\lib\paraview-4.3 if i'm in liclipse , type c = cone() gets underlined in red , "undefined variable" message, whether have from paraview.simple import * @ top or not. can, however, type things paraview.simple.getactivesource() , paraview.simple.demo1() without seeing problem if i've imported paraview.simple . then, if try run code command prompt, message says: file "c:\program files (x86)\paraview 4.3.1\lib\paraview-4.3\site-packages\paraview\vtk__init__.py", line 7, in module

preg match - php search within string for word? -

i'm using php's preg_match determine value of string. code ever prints 1 or 2. why aren't last 2 cases of if statement ever matched? $atype = strtolower($userdata['user_type']); // let data :: company introducer if ($atype == "individual introducer" || $atype == "individualintroducer" || (preg_match('/i/',$atype) , preg_match('/int/',$atype)) ) { $atype = 1 ; } elseif ($atype == "individual investor" || $atype == "individualinvestor" || (preg_match('/i/',$atype) , preg_match('/inv/',$atype)) ) { $atype = 2; } elseif ($atype == "company introducer" || $atype == "companyintroducer" || (preg_match('/c/',$atype) , preg_match('/int/',$atype)) ){ $atype = 3; } elseif ($atype == "company investor" || $atype == "companyinvestor" || (preg_match('/c/',$atyp

php - Sort datatable by month name column -

i want sort datatable month name , month names in french how . have searched alot didn't result. of great use . thank you you have searched? dont think so order field(month,'january','february','march',...) select leave_balance.balance, monthname(leave_balance.date_added) month leave_balance leave_balance.staff_id_staff = $iid group month, leave_balance.leave_type_id_leave_type having leave_balance.leave_type_id_leave_type = $leavebaltypid order field(month,'january','february','march',...,'december'); duplicate from: mysql - order monthname first google result datatables, bad, , still, first result ;) var monthnames = ["january", "february", "march", "april", "may", "june", "july", "august", "september", "october", "november", "december"]; jquery.fn.datatableext.

c# - Syntax for 2 sql connections in a return statement -

i have grid view being populated 1 connected table. code below: private void bindgridcontent() { datatable dtinfo = getcontent(); if (dtinfo.rows.count > 0) { // bind data uxnoticegv.datasource = dtinfo; uxnoticegv.databind(); // show gridview uxnoticegv.visible = true; // hide grid message uxgridmessagelbl.visible = false; } else { // hide gridview uxnoticegv.visible = false; // display grid message uxgridmessagelbl.visible = true; } uxgridviewheader.setgridviewheader(uxnoticegv, dtinfo.rows.count); } the issue i'm having current table doesn't have description of fields i'm returning in gridview. id values being displayed instead. can't join table unless create linked server, don't have permission do. (linked server answers ruled out) below da

javascript - angular js - not assign value to dynamically generated textbox from controller using ng-model -

i have generated dynamic form html using angular js directive , want assign values generated textbox using values provided (values may come database or array) when not sending parameter dynamically, run following code , assign value textbox $scope.submitted = function() { $scope.title = "submitted"; }; but when sending dynamic value form not working. the function got called directive after click , showing alert function value not assigning textbox model. here code $scope.submitted = function(par) { alert(par); $scope.title = par; }; please findout code on following plunker: http://plnkr.co/edit/hcm7dx46fdl68axs2ol2?p=preview the problem each dynamic directive compiled in isolated child scope. when later set outer scope property title not affect local directives scope. what can inside of $scope.submitted function set ngrepeat child scope title , pass value directive scope config object: $scope.submitted = function(par) {

node.js - Error while using npm install -g generator-jhipster -

i following installation steps @ https://jhipster.github.io/installation.html . every thing went fine till generator-jhipster. when run npm install -g generator-jhipster, getting following errors, can 1 me fix this? c:\users\smart>npm install -g generator-jhipster / > spawn-sync@1.0.13 postinstall c:\users\smart\appdata\roaming\npm\node_module s\generator-jhipster\node_modules\yeoman-generator\node_modules\cross-spawn\node _modules\spawn-sync > node postinstall npm err! windows_nt 6.3.9600 npm err! argv "c:\\program files\\nodejs\\\\node.exe" "c:\\program files\\nodejs \\node_modules\\npm\\bin\\npm-cli.js" "install" "-g" "generator-jhipster" npm err! node v0.12.7 npm err! npm v2.11.3 npm err! path c:\users\smart\appdata\roaming\npm-cache\isarray\0.0.1\package\p ackage.json npm err! code eperm npm err! errno -4048 npm err! error: eperm, rename 'c:\users\smart\appdata\roaming\npm-cache\isarra y\0.0.1\package\package.

javascript - How to have a widget on your app that can open without the need for passcode? -

i'm designing app in phonegap i'm using html, css, javascript etc. this app uses phones camera (a qr scanner exact) , want users able use app quick possible. so, on android device can access camera without typing password, there way can same app ? application still in design stages i'm getting first make sure want can developed before start development, thank you. in java can define attribute widgetcategory in appwidget-provider home_screen|keyguard <appwidget-provider xmlns:android="http://schemas.android.com/apk/res/android" android:minwidth="40dp" android:minheight="40dp" android:updateperiodmillis="86400000" android:previewimage="@drawable/preview" android:initiallayout="@layout/example_appwidget" android:configure="com.example.android.exampleappwidgetconfigure" android:resizemode="horizontal|vertical"

How to extract date based on condition over two different variables in R -

i have dataset of 100 observations contain patient id,drugcode,prescription date. want create new column "index date" date when patient changed drug third time. patientid drugcode prescriptiondate a1 3 07-08-2014 a1 3 08-09-2014 a1 7 19-09-2014 a1 5 30-09-2014 a2 4 11-07-2014 a2 4 21-07-2014 a2 3 13-08-2014 a2 5 26-08-2014 a2 5 30-09-2014 a3 2 16-08-2014 a3 3 17-09-2014 a4 5 08-06-2014 a4 5 29-06-2014 a4 6 20-08-2014 a4 6 24-09-2014 a4 4 22-10-2014 a4 4 25-10-2014 the data set should this: patientid drugcode prescriptiondate indexdate a1 3 07-08-2014 30-09-2014 a1 3 08-09-2014 30-09-2014 a1 7 19-09-2014 30-09-2014 a1 5 30-09-2014 30-09-2014 a2 4 11-07-2014 26-08-2014 a2 4 21-07-2014 26-08-2014 a2 3 13-08-2014 26-08-2014 a2 5 26-08-2014 26-08-2014 a2 5 30-09-2014 26-08-2014 a3 2 16-08-2014 na a3 3

How to remove image info tab from CKEditor? -

i'm using ckeditor. want remove image info tab image upload dialog box , keep upload tab. try remove image info tab ckeditor if ( dialogname == 'image' ) { // fckconfig.imagedlghideadvanced = true dialogdefinition.removecontents( 'info' ); }

mod rewrite - Apache mod_rewrite catch all (.*) does not work as intended -

following excerpt of httpd.conf . want catch unmatched requests @ [2] , reverse proxy http://localhost:8585 . however, links sent http://localhost:8585/var/ww/html/ documentroot "/var/www/html" <directory /> options followsymlinks allowoverride none rewriteengine on rewriterule testing/(.*) http://localhost:8585/mytesting/$1 [p,l] # [1] rewriterule (.*) http://localhost:8585/$1 [p,l] # [2] catch rule </directory> here test tried , result after rewrite good result http://localhost/testing/ => http://localhost:8585/mytesting/ [3] http://localhost/testing/goodone => http://localhost:8585/mytesting/goodone [4] bad result http://localhost:8080/testing => http://localhost:8585/var/www/html/testing [5] expect http://localhost:8585/testing http://localhost:8080/ => http://localhost:8585/var/www/html/ [6] expect http://localhost:8585/ the problem obvious last rewriterule prepended documentroot (/var/www/htm

.net - Date.TryParse incorrect results -

when using date.tryparse , why string input of "2015-03-02-01" succeed during conversion string date , result of "3/1/2015 8:00:00 pm"? using vs2013 targeting .net 4.0. i expect date.tryparse return false in case. if did succeed, expect return either "3/ 2 /2015" ignoring final "-01" "3/1/2015 11 :00:00 pm" if treated final "-01" minus 1 hour "2015-03-02" "3/1/2015 7 :00:00 pm" if treated final "-01" minus 1 hour , applied current eastern daylight time utc offset of -4 well. any idea of going on here internally cause return "3/1/2015 8 :00:00 pm"? here test case: <testmethod()> public sub testdatetryparse() dim s string = "2015-03-02-01" dim d date if date.tryparse(s, d) assert.fail("date parsed when should have failed. input: ""{0}"", output: ""{1}""", s, d) end if end sub

ios - SceneKit object from function does not appear in Simulator -

hello trying run 2 examples on xcode. first apple's demobots example , other coin push example found on github. both times same single error, 'method not override method superclass' , stuck on best way correct these. these respective lines of code 1. override func supportedinterfaceorientations() -> int { if uidevice.currentdevice().userinterfaceidiom == .phone { return int(uiinterfaceorientationmask.allbutupsidedown.rawvalue) } else { return int(uiinterfaceorientationmask.all.rawvalue) } } 2. override func observevalueforkeypath(keypath: string?, ofobject object: anyobject?, change: [string: anyobject]?, context: unsafemutablepointer<void>) { // check if kvo notification need. if context == &progressscenekvocontext && keypath == "fractioncompleted" && object === progress { // update progress ui on main queue. dispatch_async(dispatch_get_main_q

c# - How do I test with multiple input combinations? -

i have piece of code need test, layered in 3 parts: web api controller persistence/logic layer system calls persistence it's basic get/post/put/delete call system. instance, in controller have getall method calls get in second layer, in turn calls either sql database method either web api method. the scenarios: mock second layer , call controller . mock system calls , call second layer . mock system calls , call controller . for each scenario, have multiple test inputs, each method in controller/second layer. what best way it? want have little possible code duplication. i can use datasource attribute on test , have each test layer value select type of mocking do, , each layer value, add test data(input parameters). test data common layer values, mean have duplicate each layer value. have same layer values methods in controller/persistence layer, again duplicate. i factor out in way layer values, common tests(think of class level values) , have speci

ios - How to upload hundreds of pictures by AFNetworking? -

i upload pictures, ranging few hundred 1000, using afnetwoking methods, there drawback, reads image data 1 time, memory up,for example: nsoperationqueue *operationqueue = [[nsoperationqueue alloc]init]; [operationqueue setmaxconcurrentoperationcount:1]; (nsurl *fileurl in filestoupload) { nsurlrequest *request = [[afhttprequestserializer serializer] multipartformrequestwithmethod:@"post" urlstring:@"http://example.com/upload" parameters:nil constructingbodywithblock:^(id<afmultipartformdata> formdata) { [formdata appendpartwithfileurl:fileurl name:@"images[]" error:nil]; }]; afhttprequestoperation *operation = [[afhttprequestoperation alloc] initwithrequest:request]; [operationqueue addoperation:operation]; } this read pictures's data before upload, how can create queue reduced memory consumption

automation - Invoke a shell script execution using nagios -

hi having script restarts components(.jar files) present in server (/scripts/startall.sh) . whenever server goes down, want invoke execution of script using nagios, running on different linux server. possible so? kindly on how invoke execution of script using nagios? event handlers nagios , naemon allow executing custom scripts, both hosts , services entering 'problem state.' since implementation restarting specific applications, yours need service event handlers. from nagios documentation : event handlers can enabled or disabled on program-wide basis using enable_event_handlers in main configuration file. host- , service-specific event handlers can enabled or disabled using event_handler_enabled directive in host , service definitions. host- , service-specific event handlers not executed if global enable_event_handlers option disabled. enabling , creating event handler commands service or host first, enable event handlers modifyin

Write list to csv file c# -

imagine have 2 lists filled values. want elements first list, written first column, elements second list written second column , on. if both list have same size, works fine: (int = 0; < valuearray.count(); i++) { var newline = string.format("{0},{1}", valuearray.elementat(i), secondvaluearray.elementat(i)); sw.write(newline); } my problem if lists have different sizes, code fails out of range exception obviously. tried adding ',' between columns it's not working. instead of elementat should use elementatordefault : according msdn returns element @ specified index in sequence or default value if index out of range.

php - How to create lists in Symfony? -

Image
i'm new symfony framework. i'd create list of records this: i need filters @ top, list of items in middle , pagination @ bottom. list should have support both editable , read mode. in read mode user browse data while in edit mode able update values in multiple fields , columns. since i'll making lot of these lists i'd use interface forms in symfony2 rather tweaking twig templates time. am missing functionality of symfony forms create lists this? there other common way implement this? can give me hints form related classes extend create support lists? in order turn symfony forms lists created new form type listtype accepts arbitrary nested collection type. way can create lists various columns. like: class listtype extends abstracttype { public function buildform(formbuilderinterface $builder, array $options) { if (empty($options['collection_type']) || !$options['collection_type'] instanceof abstracttype) {

android - How to turn on robolectric logging -

i need simple way robolectric 3.0 turn on logging. want see output robolectric, not tests. tried off web not working. where stick this? robolectric.logging.enabled = true i tried following: in robolectric.properties file in test/java/res in robolectric.properties file in test/java/resources in robolectric.properties file in test/res in robolectric.properties file in test/resources in gradle: afterevaluate { project.tasks.withtype(test) { systemproperties.put('robolectric.logging.enable', 'true') } } in gradle: tasks.withtype(test) { testlogging.exceptionformat = 'full' systemproperties.put('robolectric.logging.enable', 'true') } you can add tests: @before public void init() { shadowlog.stream = system.out; } then use: gradle test -i source: unable log.d or output robolectrict + gradle or add in build.gradle : tasks.withtype(test) { systemproperty "robolectric.log

ios - Play a password protected .m3u audio stream with AVPlayer or similar -

i need play password protected .m3u audio stream within ios app. i've had working avplayer identical non-password protected stream: self.player = avplayer.playerwithurl(nsurl(string: "http://<server-here>:<port-here>/live.m3u")!) as! avplayer self.player.play() however appears @ first glance avplayer not support kind of authentication. by putting proxy on connection when using other clients support password protected streams, can see request made stream, fails 401. same request made authentication details in http header , stream request succeeds. it's pretty basic http authentication going on , nothing particularly fancy. does know of way of achieving using avfoundation , or have resort low level 3rd party streaming library achieve this?

java - Load data into a fragment, then use that data in other classes -

Image
how 1 correctly import data file, inside fragment, use data global variables, in other classes/activities/fragments? i have this: assetmanager manager = getactivity().getassets(); in myfragment class. the fragment instantiated inside other fragment: myfragment mf = new myfragment(); in order able variables contain data loaded file. i had no issues whatsoever using myfragment class in java, , load files whatever folder, here, need context, , files assets folder. still, when want getassets() in myfragment class, null (even though there files inside folder). here code of myfragment: public class filereader extends fragment { private assetmanager manager; private inputstream is; public void loadids(){ // try { manager = getactivity().getassets(); // } catch (nullpointerexception e){ // e.printstacktrace(); // } //file file = new file("ids.txt"); try { = manager.open("

html - Internet Explorer disable text and text field -

in website text , text field not editable in ie , when enable compatibility view in ie ,this thing solved problem want know there way active compatibility view coding or meta tag (this happening in windows 7 , 8, have check on internet explorer 8 windows xp working great) <input type="text" maxlength="10" value="" name="discount_id"> short answer: no long answer: no you can not force users have internet explorer browsers go in compatibility view, coding.

sql server - SSIS OnPreExecute Event Handler for Sequence Container firing multiple times -

i have sequence container called "extract". inside have 2 data flow tasks, , 1 execute sql task. neither of data flow or execute sql tasks have event handlers created them. on sequence container, have created execute sql task on onpreexecute event logs 1 row in "processstep" table. problem running there appears 4 records inserted database per run. assume event being executed 3 tasks in container , container itself. tried turning 3 tasks "disableeventhandlers" property true, , loggingmode property disabled, still logging 4 records each time. suggestions??

laravel - <? not recognized as php delimiter -

this question has answer here: how set short tag(<?) in php? 6 answers i'm using xampp php 5.6. developing project using laravel , encountered following issue: <? not recognized php delimiter within blade templating. from official documentation: php allows short open tag <? (which discouraged since available if enabled using short_open_tag php.ini configuration file directive, or if php configured --enable-short-tags option) http://php.net/manual/en/language.basic-syntax.phptags.php

How to set .classpath in STS (eclipse) by gradle for AspectJ and spring-aspects -

i have project using compile time weaving @configurable spring-aspects classes using @configurable. use spring tool suite 3.7.0 , got running if use gradle tasks build , start application. (thanks plugin: https://github.com/eveoh/gradle-aspectj ). now want use aspectj eclipse nature. manually got running turning project aspectj , adding spring-aspects.jar aspectj inpath. want gradle well. turn project aspectj nature possible by: eclipse { project { buildcommand('org.eclipse.ajdt.core.ajbuilder') natures += 'org.eclipse.ajdt.ui.ajnature' } how to configure gradle step "add spring-aspects.jar inpath"? when compare .classpath file difference one: <classpathentry exported="true" kind="con" path="org.eclipse.jst.j2ee.internal.web.container"> <attributes> <attribute name="org.eclipse.ajdt.inpath.restriction" value="spring-aspects-4.1.7.release.jar"/>

python - Aldryn - DjangoCMS install addons not present in "Manage Addons" -

i quite django n00b, , figured using aldryn first real django site idea! i have installed , implementer aldryn news & blog . install aldryn search not accessible "manage addons" under aldryn control panel. i confused on how install addon aldryn search not accessible within "manage addons". should somehow use "add custom addon" , register package new custom addon. or should create local development environment , somehow install addon , upload it? (does exist tutorial this?) thank you! there various ways in install arbitrary django packages aldryn project. the quick, easy way the easiest, quickest way place module(s) need project directory, placing them on python path. need make sure settings.py , urls.py , on appropriately configured. can push these changes aldryn itself. described in adding new application aldryn project - quick , easy way . the create-an-addon way a more involved way it, has benefits long-term use , re-u

Load all R data files from specific folder -

i've got lot of rdata files want combine in 1 dataframe. my files, example, are: file1.rdata file2.rdata file3.rdata all datafiles have structure: datafile$a , datafile$b. of files above load take variable $a and add , existing dataframe called md . problem isn't loading files global environment, processing data in rdata file. my code far, doesn't work. library(dplyr) files <- list.files("correct directory", pattern="*.rdata") this returns correct list of files. i know need lapply on function. lapply(files, myfun) my problem in function. i've got @ moment: myfun <- function(files) { load(files) df <- data.frame(datafile$a) md <- bind_rows(md, df) } the code above doesn't work, idea how work? try library(dplyr) bind_rows(lapply(files, myfun)) # #1 1 #2 2 #3 3 #4 4 #5 5 #6 1 #7 2 #8 3 #9 4 #10 5 #11 6 #12 7 #13 8 #14 9 #15 10 #16 11 #17 12 #18 13 #19 14 #20 1

python - Pandas Dataframe resample -

i have quite huge dataframe, , need average on 15 second intervals. can see index not timestamp, need re-sample on column ts (timestamp). till have been using matplotlib.dates.num2date(table.index), quite time consuming, , gives me memory errors. there anyway use re-sample on , other column? if there faster way average every 15th second re-sample, please let me know. relevant code below. import pandas pd import numpy np import matplotlib.dates pltd >>> table[ts] 735381.370833 2014-05-28 08:54:00 735381.379109 2014-05-28 09:05:55 735381.379155 2014-05-28 09:05:59 735381.380556 2014-05-28 09:08:00 735381.382014 2014-05-28 09:10:06 735381.407407 2014-05-28 09:46:40 table.index = pltd.num2date(table.index) table = table.resample('15s') table.index = pltd.date2num(table.index.to_pydatetime())

asp.net mvc - Return Error or message of a view on another view in mvc -

there login modal on _layout.cshtml page , user can login @ time or @ page. when modal load ,we appending 'login' view modal $("#divmodal").load("/login/index"); while submitting form , works fine. wondering if there way display error or custom message "login failed" on dialogbox on same page except using jquery ajax. 1) tried return view() redirecting page login/index page. 2) can't use partial view have pass login model every other models. besides using jquery ajax , there other way achieve this. you can use jsonresult if error occurs. write custom action filter on server catches exception , transforms them json response: public class myerrorhandlerattribute : filterattribute, iexceptionfilter { public void onexception(exceptioncontext filtercontext) { filtercontext.exceptionhandled = true; filtercontext.result = new jsonresult { data = new { success = false, error = filtercont

windows - AutoHotkey - persistent keystroke expansion? - HotStrings -

i having trouble understanding how product works. in old days of windows 3.1 , 95 used these things called "hotkeys" where, no matter in windows, hit key combination , happen. assumed program did. scripting language? i followed "quick start" tutorial in file , talks creating script , how set strings keystroke patterns expand into. however, created simple script , put in ahk file on desktop: ::gsell:: great seller! a++++++++++++++++++++++++++++++++ return when run script desktop appears complete pretty instantly, , of course nothing because on desktop. assumed there way use these hotkeys in other applications, not obvious me , i've made fair effort. automation scripting language, or there simple way set simple hotkeys , have them persist across applications? hotkeys , hotstrings available globally default. issue expansion because have special characters need escaped. try following: ::gsell::great seller{!} a{+} ; simple hotk

html - How do I make sure my text stays on same line when I add a 'space' inside <li> element? -

i find myself browsing sof , have yet post here is. i'm building new website , relative beginner css. struggling basic nav menu , can't quite research how solve problem.. here website , if under 'contact dropdown you'll see first list item on 2 lines when want on 1 see under 'downloads' drop down. in case wants code .nav{ width:100%; background-color: #0066b9; font-family: verdana; font-weight: bold; padding-top: 4px; padding-bottom: 4px; max-height: 31px; } .nav ul{ top: 0; width:960px; margin:0 auto; list-style: none; padding-left: 0px; display: inherit; } .nav li{ display: inline; position: relative; background-color: #003e64; padding-top: 4px; padding-bottom: 4px; } .nav ul li a{ color: white; text-decoration: none; padding: 10px; line-height: 21px; } .nav ul li a:hover{ background-color: purple; color: black; padding-top: 4px; padding-bottom: 4px; } .nav ul li ul{ display: none; position: absolute; margin: 0px; background-color: #003e64; width: a

javascript - Angular bootstrap scope on screen size change -

my angular elements on different screen size sharing same controller. why when modify select options on small screen size ( sm ) , when shrink screen small ( xs ) changes has been lost? i have 2 separate html files in order keep each file smaller , more structured. since design tablet , phones might different. what should in order keep changes while switching between different screen sizes? thanks help! index.html sm.html <div ng-controller="passengercontroller pd"> <div class="col-sm-2"> <div class="form-group"> <label class="control-label" for="selectsmfrom12">12+ years</label> <select ng-init="adults" ng-model="adults" ng-options="value value value in adultvalues" class="form-control" id="selectsmfrom12"></select> </div> </div&

group by - SQL Select from a single compound table -

i'm new sql, apologies if got nomenclature wrong (or if solution blindingly obvious). my code like: select client_id, max(year_end_date), acct_nbr ( -- ** subquery ** ) aa group client_id, acct_nbr; the columns in subquery same main query. duplicates in answer - meaning same given client_id db2 returns multiple rows different dates - example client_id | year_end_date | acct_nbr ------------------------------------- 20001 2003-12-31 01 20001 2005-12-31 01 any idea why? try this: select '>>' || client_id || '<<', max(year_end_date), '>>' || acct_nbr || '<<' ( -- ** subquery ** ) aa group client_id, acct_nbr; you can try calling trim() on client_id , acc_nbr fields in sub-query. think have hidden spaces there.

css - How to customize Bootstrap Stylus variables using my own .styl file out of the bootstrap stylus folder? -

i'm trying customize remove border radius of bootstrap stylus. i'm importing stylus main file called index.styl own style.styl, then, i'm importing custom-variables.styl same of variables.styl used bootstrap stylus, when use grunt-contrib-stylus never use custom variables values. i trying import variables after style.styl file , didn't work. now, it's solved, i'm importing variables before style.styl.

How do I use qqplot with r -f -

i have little script library(ggplot2) print(qplot(1:10, 1:10)) readlines("stdin", n = 1) that trying run with r -f littlescript.r unfortunately, expected plot not displayed. in fact, nothing displayed @ all. understand should use print() on qplot() 's output, yet, doesn't in case. when running script, r doesn't invoke graphics default. you can add command x11() enable it: library(ggplot2) x11() print(qplot(1:10, 1:10)) readlines("stdin", n = 1) alternatively save plot adding call jpeg/pdf etc etc: library(ggplot2) jpeg("myfilepath.jpg") print(qplot(1:10, 1:10)) dev.off() readlines("stdin", n = 1)

javascript - saveTextAsFile is not defined -

i'm trying save file getting error 'savetextasfile not defined' see below <script type='text/javascript' src='savetextasfile.js'></script> <textarea id="inputtexttosave" style="width:512px;height:256px"></textarea> <table> <tr> <td>filename save as:</td> <td><input id="inputfilenametosaveas"></input></td> <td><button onclick="savetextasfile()">save text file</button></td> </tr> </table> i have function savetextasfile() in file savetextasfile.js in same directory html: function savetextasfile() { var texttowrite = document.getelementbyid("inputtexttosave").value; var textfileasblob = new blob([texttowrite], {type:'text/plain'}); var filenametosaveas = document.getelementbyid("inputfilenametosaveas").value; var downloadlink =

scala: How to handle Option in a functional way -

i new scala question stupid. if have existing method below. adding these 4 lines method. there better way handle option value? def processdata(input: string, datamap: map[string, string]): option[string] = { //4 lines adding. val data: option[string] = datamap.get(input) if (data.isempty) { return none } //how avoid line val datavalue = data.get //20-25 lines of code in here bunch of pattern matching case statements cleandata(datavalue) dosomethingelse("apple", datavalue, "test") } essentially want avoid having "data.get" in below code. somehow feels wrong call that. wrote differently using pattern matching below. 20-25 lines of code have bunch of case statements , dont want create layer on top of them. def processdata(input: string, datamap: map[string, string]): option[string] = { datamap.get(input) match { case some(datavalue) => { //20-25 lines of code in here bunch of pattern matching case state

Android The import com.google.android.gms.plus.PlusClient cannot be resolved -

i updated , imported google-play-services_lib project , added library project still show same error import com.google.android.gms.plus.plusclient cannot resolved on import com.google.android.gms.plus.plusclient; and plusclient cannot resolved type on private plusclient mplusclient; plusclient not available in updated play services. from this link private googleapiclient buildgoogleapiclient() { // when build googleapiclient specify connected , // connection failed callbacks should returned, google apis our // app uses , oauth 2.0 scopes our app requests. return new googleapiclient.builder(signinactivity.this).addconnectioncallbacks(this) .addonconnectionfailedlistener(this).addapi(plus.api, plus.plusoptions.builder().build()) .addscope(plus.scope_plus_login).build(); }

java - Get the SNMP request message using adventnet/WebNMS in hex format -

i using webnms/adventnet , set snmp command on device. i access programmatically request , response data printed in hex format when debug mode on. import com.adventnet.snmp.snmp2.snmpapi; import com.adventnet.snmp.snmp2.snmpexception; import com.adventnet.snmp.snmp2.snmpoid; import com.adventnet.snmp.snmp2.snmppdu; import com.adventnet.snmp.snmp2.snmpsession; import com.adventnet.snmp.snmp2.udpprotocoloptions; public class snmpwebnms { //need both request , response in hex format //it prints in log , request , response data in hex format public static void main(string[] args) throws snmpexception { snmpapi api=new snmpapi(); api.setdebug(true); snmpsession session=new snmpsession(api); session.open(); snmppdu pdu=new snmppdu(); udpprotocoloptions options=new udpprotocoloptions("192.168.0.1"); pdu.setprotocoloptions(options); pdu.setcommunity("dummy"); pdu.setcommand(snmpapi.get_req_msg); snmpoid oid=new snmpoid

android - Restart application after onSharedPreferenceChanged has been called -

how restart application after onsharedpreferencechanged has been called? activitypreferences.java: [..] public static class fragmentpreferences extends preferencefragment { private context context; @override public void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); context = getactivity(); preferencemanager.setdefaultvalues(getactivity(), r.xml.preferences, false); addpreferencesfromresource(r.xml.preferences); final sharedpreferences sp = context.getsharedpreferences("preference_key", context.mode_private); sharedpreferences.onsharedpreferencechangelistener spchanged = new sharedpreferences.onsharedpreferencechangelistener() { @override public void onsharedpreferencechanged(sharedpreferences sharedpreferences, string key) { context.finish(); startactivity(new intent(activi

androidmanifest.xml not found android studio -

i have imported eclipse project android studio worked fine on eclipse when try run on android studion gives me error error:android source generator: [myschoolapp1] androidmanifest.xml file not found in android section of build.gradle file, can try adding sourcesets manifest.srcfile variable. android { sourcesets { main { manifest.srcfile 'todolist/src/main/androidmanifest.xml' } } } that path may need adjusted slightly. reference : androidmanifest.xml file not found https://developer.android.com/studio/intro/migrate.html

apache - Redirect scenarios with my domain name to https://www.foo.com/bar/index.xhtml? -

i have domain foo.com running on apache 2.2 ssl. time types following in browser: - foo.com - http://foo.com - www.foo.com - https://foo.com i want redirected to: https://www.foo.com/bar/index.xhtml i've tried suggestions apache site: rewritecond %{http_host} !^www\.example\.com [nc] rewritecond %{http_host} !^$ rewritecond %{server_port} !^80$ rewriterule ^/(.*) http://www.example.com:%{server_port}/$1 [l,r] but not working. happy rewrite rule scenarios listed; not everything.

android - Atomically update multiple related tables -

i working sqlite in android. have model object contains 3 lists, 1 of list of lists. have 5 tables: object, b list of lists, c lists, , d , e other 2 lists. case has me stumped if user updating existing object, , may or may not have made changes lists. think have query each table b through e records foreign keys match primary key of record i'm updating, , loop through results see if have matching item in lists, manually deleting/inserting/updating necessary. seems me there should better way? related questions: if wrap whole operation in begintransaction() , settransactionsuccessful() , need else ensure atomicity? have never dealt directly locks in databases, need add error checking existing queries handle event in blocked? there error case in need manually cancel transaction, or occur automatically when close database connection? have on sqlite triggers here , need. if error has occurred somewhere after begintransaction() , try catch exception , not mark transacti

css - Columns goes downwards in some pages -

i working woocommerce. after try add products page. columns goes downwards can see here: http://citereja.pe.hu/nb/produktai/ have checked properties , if change line-height 0% columns displayed in 1 line. if ruins other things not solution. don't know why in other page displays propertly: http://citereja.pe.hu/lt/apie-mus/ i sorry not being specific, because not sure problem is. thank you

java - Appending to a workbook using poi sxssfworkbook -

i need append rows sheet of workbook. using org.apache.poi.xssf.streaming.sxssfworkbook not able achieve low memory footprint. following code: import java.io.bufferedinputstream; import java.io.fileinputstream; import java.io.filenotfoundexception; import java.io.fileoutputstream; import java.io.ioexception; import java.io.inputstream; import java.util.arraylist; import java.util.hashmap; import java.util.iterator; import org.apache.poi.ss.usermodel.cell; import org.apache.poi.ss.usermodel.row; import org.apache.poi.ss.usermodel.sheet; import org.apache.poi.xssf.streaming.sxssfworkbook; import org.apache.poi.xssf.usermodel.xssfworkbook; public class excelhelper { public static void createexcelfilewithlowmemfootprint( arraylist<hashmap<string, object>> data, arraylist<string> fieldnames, string filename, int rownum) { try { if (rownum == 0) { // creating new workbook , writing top heading here

html - Bootstrap CDN overwrites despite loading order in Jade, Stylus -

i using stylus , jade frontend. convenience getting bootstrap cdn source , overwriting few rules here , there. of rules okay, can't seem overwrite rule in navbar. changed background-color fine can't change links in dropdown. my layout.jade looks this: include mixins doctype html head title #{title} - project name link(href='//netdna.bootstrapcdn.com/bootstrap/3.1.1/css/bootstrap.min.css', rel='stylesheet') // js imports script(src='//ajax.googleapis.com/ajax/libs/jquery/2.0.0/jquery.min.js') script(src='https://maxcdn.bootstrapcdn.com/bootstrap/3.3.0/js/bootstrap.min.js') script(src='https://google-code-prettify.googlecode.com/svn/loader/run_prettify.js') link(rel='stylesheet', href='/stylesheets/style.css') body +nav("project name", "dropdown_menu") +nav_item( "/") home +nav_item( "/about" ) +nav_item( "/" ) contact +nav_item_dropdown(

PyCharm performance better than CMD python command -

i developing python script serial communications. i'm developing in pycharm 4.5, python27 , windows , realised when execute on pycharm works faster whe use command python main.py or python -u main.py it seems script runs faster on pycharm in batchfile this: c:\python27\python.exe .\main.py there option configure execution faster? [at same speed pycharm] thanks in advance.

json - AngularJS search by file's name -

i have bunch of .svg files different names in img folder , json file. 1 of json's value similar name of .svg files. how can go through image files , "cca2" compare names json's value , if match display 1 in img tag? i'm doing project angularjs. example of json file: [ { "cca2": "aw" }, { "cca2": "ua" }, ..... ] images: aw.svg, ua.svg etc. "aw", "ua" , etc. values want compared names of image files for(var = 0; < $scope.totalitems; i++){ if($scope.countries[i].currency + "" === "uah"){ console.log("good"); } } "uah" needs replaced names of .svg files structure of img folder: http://s18.postimg.org/8xvtnmzop/untitled_1.jpg

sql server - SSIS Excel definite cell with rows -

i have excel spreadsheet this: c1 - 100100 g1 - 01.01.2015 h1 - 15.05.2015 from a5: id animal sales 123123 bear 100 213213 zebra 200 321321 lion 150 and need move data sql server database using ssis. resulting table should like id animal sales date1 date2 region 123123 bear 100 01.01.2015 15.05.2015 100100 213213 zebra 200 01.01.2015 15.05.2015 100100 321321 lion 150 01.01.2015 15.05.2015 100100 any appreciated. the way have handled problem in past to: define 2 excel connection managers, 1 firstrowhascolumnname true , 1 false. create excel source, use first connection manager, , point rowset tablename$a5:zz, create 3 more excel sources point rowsets tablename$c1:c1, tablename$g1:g1, , tablename$h1:h1 add derived column each of these, set it, , union based on derived column. original source well. when doing had problems metadata column names c1

java - Is it ok to have static final map in stateless ejb to save sate? -

stateless ejb's should not have non-final static fields used save state because not work in distributed apps more 1 jvm. if have static final map in ejb save few parameters our distributed applications state ok , updates on map visible applications running on separate jvms? the whole point behind stateless ejbs cheap because don't need replicated in distributed environment. therefore state changes in static final map not replicated. you better off using distributed cache such ehcache, infinispan or memcache purpose.

java - Converting POJO to protocol buffer request message -

instead of using relationship.relationshipgetrequest request , response. there way convert request/response pojo? i've seen solution bit more complicated i'm looking for: converting protocol buffer pojo i'm using retrofit , google protocol buffers. what have: public interface relationshipservice { @post("/relation/get") observable<relationships.relationshipgetresponse> getrelationship( @body() relationship.relationshipgetrequest request ); } what want use: public interface relationshipservice { @post("/relation/get") observable<relationship> getrelationship( @body() relationship request ); } relationship: public class relationship { private long mrelationshipid; private string mname; // etc. 10 other properties.. } my request ends being request has built here.. mclient.createservice(relationshipservice.class).getrelationship(relationships.relationshipgetreq

mysql - How do I merge these two queries together? -

select min( a.severity ), concat_ws(",", a.dev_id, a.object_id ) tuple net.alerts inner join net.deviceinfo c on c.id = a.dev_id , c.peer = ( select value local.settings setting="server_id" ) 1 , (a.dev_id, a.object_id) in ( (13,4164),(45,-1),(145,995),(188,-1) ) group tuple select min( a.severity ), concat_ws(",", b.device_id, b.object_id ) tuple net.alerts inner join local.conditions b on a.condition_id = b.condition_id 1 and(b.device_id, b.object_id) in ((13,4164),(45,-1),(145,995),(188,-1) ) group tuple i have these tables, , in alerts , conditions tables, have device_id , object_id, maybe different, i'm trying retrieve data of composite. i'm not sure understand try guess need use union . by way why write where 1 , condition , not where condition ?

sqlgeography - SQL, How to improve the speed of STGeomFromText and STDistance in this query? -

Image
i trying geo distance using query seems slow (taking 10 seconds on table of 15k records). there way improve this? select count(contact_id) matcher_contact (geography::stgeomfromtext('point(-71.4536835 42.3240042)', 4326).stdistance(geography) <= 25000) and here image of execution plan. seems of time spent on filtering in clause additional info: matcher_contact has 15k records geography 1 of columns here examples of values in geography column: 0xe6100000010c5b4645f707b14440e0dae44b036252c0 0xe6100000010c4e93beb5b8854440885ae4e83b8552c0 0xe6100000010cb5368dedb51045400aab67f71a0554c0 0xe6100000010ca3a5e14a2cbe454008da2e7ee49f51c0

python - How Can I Find the Area/Vertices Occupied By a Widget in Kivy? -

i have 10 x 10 gridlayout 100 image widgets, , on_touch_down, want picture touched change different picture. since touch signal bubble through gridlayout , 100 image children, want check in on_touch_down see if touch coordinates within area occupied image touched. how can find vertices of image, or there alternative approach? calculating each image's 4 vertices added rather difficult since stretching these images. many in advance. :) self.pos , self.size have sufficed. how silly of me.

jquery - How can I hide controls in a youtube video when a user checked a input? -

i create "movie mode" users can watch video without controls or video title. idea this: <iframe src="//youtube.com/embed/8qgnzcaa9pk" allowfullscreen="" style="overflow-x: hidden; overflow-y: hidden;" height="569" frameborder="0"></iframe> <input type="checkbox" id="hide-controlls"> hide controlls, in movie! <script src="//code.jquery.com/jquery-1.11.1.js"></script> <script> $('#hide-controlls').click(function () { $(".html5-video-controls").toggle(this.checked); }); </script> but looks dosen't work, , don't know why, becouse code seems correct, check box dosen't anything. wrong? from https://developers.google.com/youtube/player_parameters controls=0 – player controls not display in player. iframe embeds, flash player loads immediately. controls=1 (default) – player controls display in p

c# - ASP.NET page is blocking in code behind -

an asp.net page blocking inside code behind, when accessed second time within same session. 2 calls within same session sort of serialized, shouldn't. it not disable session state page: <%@ page enablesessionstate="false" %> ... <div runat="server" id="lblmsg"></div> code behind part: using system; namespace sysweb { public partial class blocktest2page : system.web.ui.page { protected void page_load(object sender, system.eventargs e) { // show time this.lblmsg.innerhtml += datetime.now.tostring() + "<br />"; system.threading.thread.sleep(4000); this.lblmsg.innerhtml += datetime.now.tostring() + "<br />"; } } } when open 2 tabs in browser (tested in firefox , chrome), , call same page same url, times shown on each page show 1 call blocke