Posts

Showing posts from July, 2012

ios - static tableview connect to an another dynamic tableview -

i play around uitableviews. have 1 static table view connect dynamic table view. click on row static table view, should change , show detail in dynamic table view. problem is, change, table view empty. but, if try show first dynamic table view, work fine... how impossible? it looks that: https://www.dropbox.com/s/cr6m50bqdic6yrk/bildschirmfoto%202015-06-25%20um%2018.20.26.png?dl=0 code dynamic table view: - (void)viewdidload { [super viewdidload]; self.weekdays = [nsmutablearray arraywithobjects:@"a", @"b", @"c", @"d", @"e", @"f", @"g", nil]; } -(void)viewdidappear:(bool)animated{ } - (nsinteger)numberofsectionsintableview:(uitableview *)tableview { return 1; } - (nsinteger)tableview:(uitableview *)tableview numberofrowsinsection:(nsinteger)section { return [self.weekdays count]; } - (uitableviewcell *)tableview:(uitableview *)tableview cellforrowatindexpath:(nsindexpath *)inde

Eomonth in Excel -

how can use function in user defined function ? cannot reference cell. function sonxmonth() sonxmonth = eomonth(a1,0) + 1 end func you need use worksheetfunction used container microsoft excel worksheet functions can called visual basic. function sonxmonth() sonxmonth = worksheetfunction.eomonth(range("a1"), 0) end func

enums - Get value from ComboBox? -

i have in myform combobox ( mycombobox ) enumtype myenumtype . in modified method , want value. i used code looklike: if (mycombobox.enumtypevalue() == myenumtype::value1 ) { //action } or anothe way if (mycombobox.enumtype(myenumtype::value1) ) { //action } in both cases can not take value. what way? thanks, all! enjoy! to value of combobox use selection method, if(mycombobox.selection() == myenumtype::value1) { //action }

twitter - <IPython.core.display.HTML object> instead of graph -

i trying achieve following twitter-visualization project in ipython: http://www.amypeniston.com/web/visualizing-twitter-data for last step, code is: %pylab dogs = pd.read_csv(' c:/users/alex/mongodb/bin/outputtweets.csv') dogs['created_at'] = pd.to_datetime(pd.series(dogs['created_at'])) dogs.set_index('created_at', drop=false, inplace=true) dogs.index = dogs.index.tz_localize('gmt').tz_convert('est') dogs.index = dogs.index - dateoffset(hours = 12) dogs.index dogs1m = dogs['created_at'].resample('1t', how='count') v.core.initialize_notebook() area = v.area(dogs1m) area.colors(brew='spectral') area.display() however, in return is: ipython.core.display.html object

javascript - How to add and remove a class on an element when Bootstraps Affix is affixed or not -

on dev page , scroll, green "sticky" nav scrolls , sticks top. when sticks top, class on ".sticky_cta" changes "affix-top" "affix" (using bootstrap affix plugin). i'd add css class (called stickyoffset ) element on page ( .belowbrandnav ) when sticky bar sticks, essentially. class bump down 60px text isn't hidden under "sticky nav" when click 1 of industry icons "jump" anchor. this code make sticky bar stick, , change class "affix" . // make sub nav stick top $('.sticky_cta').each(function () { if ($(this).hasclass('affix')) { $('.belowbrandnav').addclass("stickyoffset"); } }); jquery(function ($) { $(document).ready(function () { $('.sticky_cta').affix({ offset: { top: $('.abovebrandnav').height() + 70 } }); }); }); i tried code below , works if scroll bar to

reflection - C# Runtime DLL loading and ref parameters -

in short, wish load .dll file @ runtime, , ask modify ref value passed parameter. (the .dll written in c#) don't know suitable technique be. i have class "alotofdata" contains ~1 gigabyte worth of variables in it. i want dynamically load .dll file contains method "dowork(ref alotofdata thedata){ thedata.value = ... } then execute method, , unload dll, , same dll. (very important have ability load/unload dlls @ runtime) obviously, solution pass copy of value itself, return modified copy, , put class. however, not possible, if dll file have make decision. based on data, data modify (consider: potentially needs access data). merely copying entire package of data is... absolutely horrible idea, whole entirety of data 1 gigabyte large. how can go importing method .dll dynamically (at run time) , pass parameter it, ref, , mean, pass reference, not copy it? (very important pass ref class, without copying) a psuedo-code might explain point: class

sql - Use Variable value in a SELECT statement -

i have declared variable @s , storing sub query value in returning more 1 record , want use in select statement , can possible, here query trying getting error must declare scalar variable "@s" declare @s nvarchar(max) set @s = '(select es.firstname [user] es es.userid in (select customeruserid orderinfo))' select orderinfoid, borrowerfirstname consumerfirstname, borrowerlastname consumerlastname, requestedurl, requests, select @s, u.firstname +'' ''+ u.lastname affiliate, o.requestdatetime dateoftransaction, o.requestipaddress originatingipaddress, o.requests status orderinfo o inner join [user] u on o.affiliateid = u.userid is possible that. appreciated if want append as single string result of sub-query every row produced main query, then, first of have initialize @s : declare @s nvarchar(max) = '' then set it: select @s = @s

COUNT and GROUP BY SQL -

Image
this question has answer here: how group , count using mysql 4 answers i have example data in left table , expected output on right side. the requirement of output are: the count counts serial , group time , model. if there more 1 serial have same value, choose last one. for example, @ time 6, there 3 model serial number 1,2,7, count serial 7 because first row (1-a-6) has duplicate serial next row (1-a-7) don't count (1-a-6). the question is, how can make sql query data output in 1 query? the technique below uses row_number , subqueries last instance of each serial, group by count perform aggregate. these should supported common dbms's (since didn't specify sql server or mysql or whatever). select [time], [model], count(*) [count] ( select [time], [model], [serial], -- paritioning

php - Doctrine Extensions REGEXP not working in Symfony2 -

i using doctrine 2.1 , need use regexp in mysql. regexp not supported in default installation of doctrine using beberlei/doctrineextensions i cannot doctrine recognize regexp, have followed example on so . i'm using doctrine 2.1 , symfony 2.7.1 here's code, ideas? config # config.yml # doctrine configuration doctrine: dbal: driver: "%database_driver%" host: "%database_host%" port: "%database_port%" dbname: "%database_name%" user: "%database_user%" password: "%database_password%" charset: utf8 keep_slave: true slaves: %database_slaves% orm: auto_generate_proxy_classes: "%kernel.debug%" auto_mapping: true metadata_cache_driver: apc query_cache_driver: apc result_cache_driver: type: service id: cache dql: string_fun

backbone.js - MarionetteJS - cannot reference this in template function -

i have view marionette itemview. access other parameters on view using "this" inside template function undefined , i'm unsure why. define(['jquery', 'hbs!templates/template', 'backbone'], function ($, template, backbone) { "use strict"; return backbone.marionette.itemview.extend({ name: "depth", el: ".card", template: function(serializedmodel){ var self = this; // self undefined, can't reference this.name, depth var data = {isdepth: true, cardtitle: self.name, injecthtml: template()}; .... stuff ... return template(); } }); } ); you can use underscore's bindall bind template marionetteitem view's whenever called . : backbone.marionette.itemview.extend({ initialize: function(){ _.bindall(this, 'template'); }, temp

firebase - Is there any way to break Javascript function within an anonymous function? -

i want check if data i'm insert allready exists on firebase, , if want break add function: fbdb.addcampain=function (campain){ campiansref.once('value',function(snapshot){ snapshot.foreach(function(childsnapshot){ if(campain.name==childsnapshot.val().name){ console.log("campain allredy exists on db"); return false; //i want break addcampain function here! } }); }); var newcampainref = campiansref.push(); campain.id = newcampainref.key(); newcampainref.set(campain,function(error){ if(error){ console.log("an error occured campain did not add db, error:" ,+error); return false; } else{ console.log("campain succssesfuly added db"); return true; } }); }; what happens if campaign exists on database still continues actual adding code. there must way "break" addcamp

c# - Need to change a config setting of a deployed .net app without rebuilding it -

long ago created winforms app vs 2005. app still deployed , working using web services, accesses sql server database. database server changing credentials because of move. need somehow provide new connectionstring app without rebuilding it, dont know assemblies change , how, appreciated!

yii - Yii2 attributeLabels - wrap part of the label in a tag -

inside user model, using attributelabels method create text field: public function attributelabels() { return [ 'terms' => 'i accept terms , coditions' ]; } and in view using standard $form->field method show input field: <?php $form->field($model, 'terms')->checkbox() ?> i need wrap terms , coditions inside tag link. how can this? the checkbox() method takes options array can override default label: $form->field($model, 'terms')->checkbox([ 'label' => 'i accept <a href="/tos.html" target="_blank">terms , conditions</a>' ]); detailed checkbox options in api documentation @ http://www.yiiframework.com/doc-2.0/yii-widgets-activefield.html#checkbox()-detail

java - I need this calculator to redirect the user for input incase he enters the wrong one -

in third input, asks number entered specific operation. when example "5" entered, doesn't automatically send default section display message "the value doesn't exist.". in addition that, need display input prompt again , ask number 1 through 4 entered. thx import java.io.bufferedreader; import java.io.inputstreamreader; public class specialized { public static void main(string[] args) { string s1 = getinput("enter number: "); string s2 = getinput("enter number: "); string op = getinput("enter: 1 = add, 2 = subtract, 3 = multiply, 4 = divide "); int opint = integer.parseint(op); double result= 0; switch (opint) { case 1: result = addvalues(s1,s2); break; case 2: result = subtractvalues(s1,s2); break; case 3: result = multiplyvalues(s1,s2); break; case 4:

css - HTML/BOOTSTRAP "COL-MD-8" NOT CENTERING -

the problem 3rd row , 4th don't center! <!--|--------------------------------------------------------------------------------------------|--> <div class="container"> <div class="row"> <div class="col-md-12 imagemfundo"> <!--|---------------------------------------rows-------------------------------------------------|--> <div id="1" class="row rowprincipal "> <div class="container" > <div class="col-md-2"> </div> <div class="col-md-8 colprincipal2 borderrow"> <!-----------------------------panel-------------------------------------|--> <div class="panel panel-default paneltop"> <div class="panel-heading&qu

parse.com - Parse image resolutions for ios -

whats effective way of dealing different image resolutions in parse different ios devices? for instance would better have 1 image in parse @ highest res , download every device? (slower download speeds lower res devices) have 1x 2x , 3x versions of image in parse , download relevant device. (takes more storage space on parse) run cloud code on parse resize images correct resolution downloaded devices. (possible slower download speed devices?) any other options can think of welcome. al i depends on usage case. example, if have profile picture, recommend uploading in 2-3 versions, pictures may downloaded (for example in social networking app have profile pictures in posts, user profiles, messages, etc.). when picture downloaded high amount of times, rather download smaller 1 minimise download time , save parse data transfer resources. on other hand, pictures aren't downloaded other ones, i'd recommend storing them in high-res format, , scaling them down

categories - Prestashop 1.6: How to make subcategories appear in a filter on the layered navigation block? -

i trying make different subcategories of given categories c show in filter on layered navigation block. category c has multiple subcategories , sub-categories filter abled in "layered navigation block" module reason particular filter not showing! thanks help did set depth in configuration of module? go modules->modules, , find layered navigation module. click configure almost bottom can change categories depth (set 0 unlimited, or max depth use) if still have problem uninstall , reinstall layered navigation module.

r - Unexpected quantile relationship -

Image
i want fit quantile regression model observed data, show triangular relationship between response , predictor variables: when do: library("quantreg") m1 <- rq(y~ x, tau = 0.75, data=mydata) summary(m1) call: rq(formula = y ~ x, tau = 0.75, data = mydata) tau: [1] 0.75 coefficients: coefficients lower bd upper bd (intercept) 3.42758 1.80850 4.74463 x 0.27879 0.07132 0.82591 it founds positive relationship (in red), when should negative looking @ points in graph, right? maybe i'm missing looks wrongh tau value. tried t=0.97 , t=0.90 (in gray), same pattern produced. then, when do: m1.all <- rq(y~ x, tau = seq(0.05, 0.95, = 0.05), data=mydata) m1.plot <- summary(m1.all) warning messages: 1: in rq.fit.br(x, y, tau = tau, ci = true, ...) : solution may nonunique 2: in rq.fit.br(x, y, tau = tau, ci = true, ...) : solution may nonunique 3: in rq.fit.br(x, y, tau = tau, c

How to make a parameter follows the waveform of another parameter - C code -

Image
in c code, gets input hardware (altera nios ii system), input "vref" sinusoidal waveform. edit: in altera quartus in vhdl, generates sinusoidal waveform "vref" becomes input c code. (c code used program processor nios ii) in c code, have input "vref_new", "vref_new" variable value keeps changing based on calculations. edit: "vref_new" new value amplitude "vref" edit: should when plot "vref_new" output on graph, "vref_new" plotted sinuisoial waveform instead of amplitude? frequency , sample rate of "vref_new" should follow of "vref". vref sinewave, vref_new updated amplitude replace amplitude in vref. if know amplitude of "vref" constant 40, can this: vref_new= vref_new*vref*(1/40); but trouble don't know amplitude of "vref" not constant. edit: reason divide 40 correct amplitude given "vref_new". edit: vref sine wave generated vhdl custo

vb.net - VB Collection Conversion to c# LinkedList -

hi how things? i life of me haven't been able figure out. have been converting gis application. have collection in vb , need convert linkedlist in c#. any getting started appreciated. vb code below imports esri.arcgis.esrisystem public class clsfeature private m_oid integer private m_geometry esri.arcgis.geometry.igeometry public sub new(byref ioid integer, byref pgeometry esri.arcgis.geometry.igeometry) m_oid = ioid m_geometry = pgeometry end sub public readonly property oid() integer oid = m_oid end end property public readonly property geometry() esri.arcgis.geometry.igeometry geometry = m_geometry end end property end class friend class clsfeaturecollection implements system.collections.ienumerable ' linkedlist??????????????????????????????????????? private m_ocol collection private m_ocolreverse collection public sub new() mybase.new() m_ocol = new collection m_ocolreverse = new collection end sub p

swing - Creating a dynamic search box/table in Java -

what i'm trying achieve jtextfield jtable on bottom, every time change occurs on jtextfield (type or delete character) jtable update showing results it's list of strings match written on jtextfield , , showing results if empty. what don't know how : how set event on jtextfield triggers everytime text changes making jtable update values in efficient way, without using memory add documentlistener jtextfield . update tablemodel belonging jtable matches. jtable update in response.

csv - Python Csvwriter Randomize Rows -

is possible make randomizer randomizes entire rows using csvwriter? code have similar this: in range(45): count=count+1 writer.writerow((count,pattern)) where pattern number corresponds count. example: when count=1 pattern=1; count=2 pattern=9; count=3 pattern=17, , on... want way randomize rows correct count corresponds correct pattern still. appreciated! load 2 dimensional array storing count in a[i][0] , pattern in a[i][1] shuffle write them csv file. import random count = 0 = [] in range(45): count = count + 1 a.append([count,pattern]) random.shuffle(a) in range(len(a)): writer.writerow(a[i][0], a[i][1]) #a[i][0] = count, a[i][1] = pattern

azure - Using Office 365 API with only one account -

i trying use office 365 api write events calendars of @ our organization. should not involve users logging in office 365 @ point. events add written out @ various points during day (when user own event may not @ computer), per-user token approach doesn't make sense. it appears microsoft provides alternative uses service account. account can used write any user's calendar (or sending email user, etc.). however, can't find documentation on doing this. provide link it? i found blog post on topic: http://blogs.msdn.com/b/exchangedev/archive/2015/01/21/building-demon-or-service-apps-with-office-365-mail-calendar-and-contacts-apis-oauth2-client-credential-flow.aspx also, if aren't using microsoft's client library (for example, if use linux), you'll need see too: office 365 rest api - daemon week authentication

Chef failed to install MySQL: no resouce, method or variable named create -

hi im trying install mysql on fresh centos 6.6 using chef from project https://github.com/chef-cookbooks/mysql worte following script include_recipe 'selinux::disabled' mysql_service 'default' port '3306' version '5.7' initial_root_password 'youllneverguess' action [:create, :start] end the metadata.rb looks this depends 'selinux' depends 'mysql' the configuration couldn't simpler. when run script obtain info -- m-01-centos-66: ================================================================================ info -- m-01-centos-66: error executing action `create` on resource 'mysql_service[default]' info -- m-01-centos-66: ================================================================================ info -- m-01-centos-66: info -- m-01-centos-66: nameerror info -- m-01-centos-66: --------- info -- m-01-centos-66: no resource, method, or local variable named `cr

javascript - multiple values from cookie to var in angular -

my code looks like: var ietms = $cookies.get('items'); i can values back, there multiples such as: testvalue1|testvalue2|testvalue3 i want able split 3 items lets multiple vars, like: var ietms = $cookies.get('items')[0]; var ietms2 = $cookies.get('items')[1]; var ietms3 = $cookies.get('items')[2]; but split value based on '|' separating values if returned data string, can use var splititems = ietms.split('|') create 1 array consisting of individual values. hard if applies question, because return type of testvalue1|..|.. unclear

ios - How to find TableView section header Index Path? -

i want kind of action according tableview section header index path. there method trace section header index path? how func headerviewforsection ? override func tableview(tableview: uitableview, headerviewforsection section: int) -> uitableviewheaderfooterview { let headercell = tableview.dequeuereusablecellwithidentifier("headercell") // stuf, e.g. switch (section) { case 0: headercell.backgroundcolor = uicolor.cyancolor() default: headercell.backgroundcolor = uicolor.redcolor() } return headercell }

Eclipse C++: having trouble with including a file with extension ji -

maybe title not helpful wasn't sure how put few words. problem. have c++ projects in eclipse , want use part of project julia code. have downloaded , installed latest version of julia on machine , want embed julia inside c++ project in eclipse, able write directly julia code inside c++ project. such option possible , there this guidance on how it. in eclipse both path include julia.h , julia library, , can build project, when try run receive following error: "system image file "/home/kostav/workspace/juli/debug/../lib/x86_64-linux-gnu/julia/sys.ji" not found " now file exist , path included in eclipse, don't understand why receive error , should in order fix it. suggestion helpful me. jl_init_with_image jl_init_with_image("pathtosysji", "sys.ji"); the path must abs path. ie: /home/kostav/workspace/juli/debug/../lib/x86_64-linux-gnu/julia/sys.ji

python - mocking subprocess.Popen dependant on import style -

when attempting mock popen can succeed if importing of subprocess matches in both unit test code , main module code. given following module listdir.py: from subprocess import popen, pipe def listdir(dir): cmd = ['ls', dir] pc = popen(cmd, stdout=pipe, stderr=pipe) out, err = pc.communicate() if pc.returncode != 0: raise exception return out and following unit test code test_listdir.py import subprocess import listdir import mock @mock.patch.object(subprocess, 'popen', autospec=true) def test_listdir(mock_popen): mock_popen.return_value.returncode = 0 mock_popen.return_value.communicate.return_value = ("output", "error") listdir.listdir("/fake_dir") for reason popen not being mocked, due import style being different between 2 python modules, , running test raises exception. if change listdir.py import of subproces e.g. import subprocess def listdir(dir): cmd = ['ls', di

How click on standart android button in autotest using Ruby, Appium? -

help please. i use:win 7, ruby 2.0.0, appium 1.3.7.0 i test android app. in test suite, in steps define: appium.back i try tap on hardware(native) button e.g. back, home. but if run test, appears next error : nomethoderror: undefined method 'back' appium:module ansver question in env.rb write $capy_driver = capybara.current_session.driver and use in steps $capy_driver.go_back or $capy_driver.appium_driver.press_keycode 4

c - Let a macro count its invocations -

i've huge c project module reading , managing configuration data. if have add new configuration parameter, i'll have edit several functions, e.g. pseudo-code: void read_configuration(config *c) { read_param("p1", c->p1); read_param("p2", c->p2); read_param("p3", c->p3); /* ... */ } void dump_configuration(config *c) { dump_param("p1", c->p1); dump_param("p2", c->p2); dump_param("p3", c->p3); /* ... */ } is there way ensure macro at compile time , each location has @ least same count of parameters? thought of making dump_param kind of macro counting invocations , add like #if nr_read != nr_dump #error "you forgot something, idiot!" #endif at end of module. can't find method make macro count invocations, though... since list of parameters same in both functions, how factoring that out , avoid possible mismatch ? using x-macros

php - how to count the mysql data when match rules -

i show how many promotion code left function. find out how query latest promotion. show code how many left. now have 2 table, this t1. +--------------+--------------------------+----------------------+ | id | name | description | +--------------+--------------------------+----------------------+ | 1 | gg | gg | | 2 | abc defg | abc ddddd | | 3 | ccard | gooooo | +--------------+--------------------------+----------------------+ this t2 +---------+------------+-------------------+------------------+ | id | kaid | code | timestamp | +---------+------------+-------------------+------------------+ | 1 | 2 | zzzzaaaaa | 123456789 | | 2 | 2 | aaazzadwww | 123344444 | | 3 | 1 | asfasdffff | 123333333

angularjs - What's the best practice for binding service data to views in Angular (1.3) -

i'm new angular, have fair amount of experience in coding , having trouble getting data binding in views "right". my approach broadly: keep logic out of controllers , encapsulate them in services (see this blog ) use controlleras syntax per john papa's style guide . the confusion i'm having not having explicit $scope object obfuscates model in mvc philosophy. there passing comment effect in blog post, didn't see real conclusion on matter. the angular docs state model "the single point of truth" data. perhaps read (is "truth" of values between v , c?) suggests that, if you're using controlleras syntax, controller properties model -- , "single point of truth". if that's given, and want abstract logic services, see it, can't away 1 of 2 pretty ugly alternatives keeping controller properties in sync service values: expose service view. i.e. mycontroller.data = service.data . works, pretty gross, be

java - get current user in service layer -

i want current user in service layer i tried following code null pointer exception @service public class myservice{ @autowired todorepository todorepository; public void execute(){ authentication auth = securitycontextholder.getcontext().getauthentication(); todo todo = new todo(); todo.setdomain(auth.getname()); todorepository.save(todo); } can show me how can login user spring security in service layer ? this find authenticated user : @override public person getcurrentlyauthenticateduser() { authentication authentication = securitycontextholder.getcontext().getauthentication(); if (authentication == null) { return null; } else { // line below calls method person database, search users email(username) return persondao.findpersonbyusername(authentication.getname()); } } hope helps. if not, please let me kno,w delete answer.

c++ - Stl algorithms as function template -

i trying benchmark of stl algorithm on structures : using namespace std; template<typename a, typename t> void test(){ t c(1000); a(c.begin(), c.end(), true); } int main(){ test<find,vector<bool>>(); } but template argument deduction/substitution failed everyone's answer good, let me add note. to make code work without changing much.. has happen. #include <vector> #include <algorithm> template< typename searchfunctiontype, typename containertype > void test( searchfunctiontype fsearch, const containertype& container){ fsearch(container.begin(), container.end(), true); } int main(){ std::vector<bool> v(1000); test(std::find<std::vector<bool>::const_iterator, bool>, v); } std::find not type pointed out everyone. std::find function. may pass function pointer. look, std::find again template function, , compiler has no clue template argument std::find have. that's why don'

c# - StructureMap in multi-layer solution -

in solution have 3 projects: webapi, businesslayer , datalayer. in webapi have structuremap configured use defaultregistry: public class defaultregistry : registry { public defaultregistry() { scan( scan => { scan.thecallingassembly(); scan.withdefaultconventions(); }); for<business.interfaces.ibusinessclass>().use(ctx => new business.businessclass()); for<data.interfaces.idataclass>().use(ctx => new data.dataclass()); } } a controller class in webapi looks this: public class mycontroller : apicontroller { private readonly ibusinessclass _businessclass; public mycontroller(ibusinessclass businessclass) { _businessclass = businessclass; } public httpresponsemessage get(int id) { var success = _businessclass.dosomething(); return success ? request.createresponse(httpstatuscode.ok) : request.createerr

azure - How to get full list of CloudConfiguration from inside a web service at runtime? -

configurationmanager has appsettings name-value collection cloudconfigurationmanager has getsetting(string) method can config settings 1 1 if know key. is there way whole config of role runtime? the root cause want make strong typed configuration in order abstract away , make code more testable. using cloudconfigurationmanager directly implicit dependency want remove abstraction want stub in tests. find practical. brings me question. i not want use library fx.configuration.azure because have carry dependency altogether because requires inheritance of base class. afaik, there's no direct method available give information. however there's workaround can use. involves making use of service management api's get deployment operation. operation return xml , 1 of element there configuration contains service configuration file in base64 encoded format. can read element, convert string , parse xml configurationsettings elements. it's child elements contai

android - Set listview single item can be clicked at a time -

this listview. have used code clicked position of row. when i'm clicking on more item @ same time, app crashes. understand why. how set list.setchoicemode(listview.choice_mode_single) piece here? i'm using arraylist item position , not list item position. please help. public void onitemclick(int mposition) { listmodel tempvalues = customlistviewvaluesarr.get(mposition); totalwords = integer.parseint(tempvalues.gettextwords2()); string statusbarpercentage=tempvalues.gettextpercentage(); int pos = mposition + 2; intent intent = new intent(getapplicationcontext(), find.class); intent.putextra("wordlength", pos); // parameters startactivity(intent); } this code i've written take position listview. adapter class: public class customadapter extends baseadapter implements view.onclicklistener { //--------------code------------ /** * ****** called when item click in listview *********** */ private class onitemclicklistener implements view.onclicklistener {

python - Using MongoEngine for Django, how do I filter the QuerySet by the size of a list and greater than a value? -

i using django 1.6.8 , mongoengine 0.8.2. i have 2 classes, servicedocument , optiondocument. servicedocument keeps list of optiondocuments. there millions of servicedocuments (2.5 million +). i want select every servicedocument has more 2 optiondocuments. i "want" work, 0 result: servicedocument.objects.filter(options__size__gt=2).count() this work: >>> servicedocument.objects.filter(options__size=1).count() 6582 >>> servicedocument.objects.filter(options__size=2).count() 2734321 >>> servicedocument.objects.filter(options__size=3).count() 25165 >>> servicedocument.objects.all().count() 2769768 lastly, if had fewer servicedocuments and/or iterator working loop through them myself, segfaults after memory fills after few seconds (i'm guessing operation on .all() try collect them in memory). for iterator, tried following without success: iter(servicedocument.objects.all()) well think need find work around mon

java - Unpredictable results when sending HTTP POST using DefaultHttpClient -

i'm using defaulthttpclient send http post request containing json raw data: defaulthttpclient httpclient = new defaulthttpclient(); httppost httppostreq = new httppost(post_url); stringentity se = new stringentity(json.tostring()); // json jsonobject se.setcontenttype("application/json;charset=utf-8"); se.setcontentencoding(new basicheader(http.content_type,"application/json;charset=utf-8")); httppostreq.setentity(se); httpresponse httpresponse = httpclient.execute(httppostreq); string responsetext = entityutils.tostring(httpresponse.getentity()); i'm using send 5 requests, , result must json-raw-response, although i'm getting first 2 responses predicted other 3 i'm getting html code of webpage: <!doctype html> <html> <head> <meta charset="utf-8"><title>web service</title> <link rel="stylesheet" href="/css/merge.css"/> <script t

dockerhub - Docker push already in progress -

i interrupted following command : docker push <user>/docker-whale . if try running again, : error response daemon: push <user>/docker-whale in progress i understand upload still running in background , interrupted client output. however, is there way back? also, if it's somehow stuck, how restart push operation? this happens because stopped pushing before finished. don't need remove containers; restart boot2docker(or docker service). command maybe: boot2docker restart (on mac) service docker restart (on linux) after that, can push image again, luck!

Selecting the shortest item string from dropdownlist in C# Asp.net -

i have multiple dynamically generated dropdownlists bound database. want shortest string value shown @ index 0 in each dropdown. the sample code is: dropdownlist ddltemplate = new dropdownlist(); ddltemplate.id = "ddltemplate|" + j.tostring(); ddltemplate.appenddatabounditems = true; ddltemplate.datatextfield = "templatename"; ddltemplate.datavaluefield = "templatename"; ddltemplate.width = unit.pixel(200); ddltemplate.autopostback = true; ddltemplate.datasource = null; ddltemplate.datasource = dsmultipletemplate.tables[j].defaultview; ddltemplate.databind(); if can achieved through database query please guide me. thanks as arnt answering comment, maybe looking that: list<int> stringlength = new list<int> { }; // storing every length foreach (string entry in ddltemplate.items) { stringlength.add(entry.length); // saving each string-length } int index = stringlength.findindex(a => == string

html - How to create .txt file using JavaScript / HTML5? -

i new javascript . codes available on internet related create text file using javascript not working in laptop. can give me idea or possible code. this code should work, give try , if doesn't work may issue browser: (function () { var textfile = null, maketextfile = function (text) { var data = new blob([text], {type: 'text/plain'}); // if replacing generated file need // manually revoke object url avoid memory leaks. if (textfile !== null) { window.url.revokeobjecturl(textfile); } textfile = window.url.createobjecturl(data); return textfile; }; var create = document.getelementbyid('create'), textbox = document.getelementbyid('textbox'); create.addeventlistener('click', function () { var link = document.getelementbyid('downloadlink'); link.href = maketextfile(textbox.value); link.style.display = 'block'; }, false); })(); and html: <textarea id=&quo

Need a Basic Batch file script for Health Check on Servers -

i looking simple batch file can give me below details list of servers. there single domain. hostname ip address domain disk detailous cpu information physical memory os details type of server i have made 1 myself, not seem run list of servers, runs many times single server. please me, below code: for /f %%x in (computers.txt) systeminfo | findstr /c:"host name" >> c:\temp\output.txt /f %%x in (computers.txt) wmic cpu name >> c:\temp\output.txt /f %%x in (computers.txt) systeminfo | findstr /c:"domain" >> c:\temp\output.txt /f %%x in (computers.txt) systeminfo | findstr /c:"os name" >> c:\temp\output.txt /f %%x in (computers.txt) systeminfo | findstr /c:"os version" >> c:\temp\output.txt /f %%x in (computers.txt) systeminfo | findstr /c:"system manufacturer" >> c:\temp\output.txt /f %%x in (computers.txt) systeminfo | findstr /c:"system model" >> c:\temp\output.txt /f

angularjs - How to add class name with the existing class name -

i getting classname server red , blue or green . trying add class element. nothing happening. any 1 correct me please? here try: <span class="prostatus" ng-class="{activeapp.status}"> //class not adds {{activeapp.status}} //i getting `blue` here. </span> just put as, <span class="prostatus {{activeapp.status}}"> ... or more efficiently <span class="prostatus" ng-class="activeapp.status"> .... here doc it says can bind scope value as, $scope.classname = 'this-is-class-name'; <span class="prostatus" ng-class="classname"> why use { } in ng-class if want apply css class based on condition below, <span class="prostatus" ng-class="{ 'classname' : applyclass }"> css class classname apply span when applyclass sets true

android - Weird NavigationView Checkable behavior -

Image
this menu xml file <menu xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:tools="http://schemas.android.com/tools" tools:context="ng.edu.binghamuni.bhu.ui.activity.homeactivity"> <group android:checkablebehavior="single"> <item android:id="@+id/drawer_item_today" android:icon="@drawable/ic_schedule_black_48dp" android:orderincategory="100" android:title="@string/today" app:showasaction="never" /> <item android:id="@+id/drawer_item_classes" android:icon="@drawable/ic_chrome_reader_mode_black_48dp" android:orderincategory="100" android:title="@string/action_classes" app:showasaction="never" /> </group> <item android:id="@+id/drawer_item_