Posts

Showing posts from February, 2011

messagebroker - Convert MbElement to W3C Node in WebSphere Message Broker 7.0.0 -

i trying convert com.ibm.broker.plugin.mbelement org.w3c.dom.node . environment websphere message broker 7.0.0. i know version iib 9.0.0 has methods getdomnode() returns org.w3c.dom.node . cannot upgrade environment various reasons , pointers suggestions doing in 7.0.0. thanks in advance you should not parse message in message flow, leaving in blob. in java compute access message byte array , parse in java org.w3c.dom.document, this: how convert array byte org.w3c.dom.document

android - What is a divider color attribute in ListView? -

i want create divider, divider in listview , depend on current theme. <view android:id="@+id/first_line" android:layout_width="match_parent" android:layout_below="@+id/description" android:layout_height="1dp" android:layout_marginbottom="7dp" android:layout_margintop="7dp" android:background="?attr/colorprimarydark"/> which attribute should specify in line android:background="attr/colorprimarydark" handle this? check android styles file. divider in listview it's drawable. example: <style name="widget.listview" parent="widget.abslistview"> <item name="listselector">@drawable/list_selector_background</item> <item name="cachecolorhint">?attr/colorbackgroundcachehint</item> <item name="divider">@drawable/divider_horizontal_d...

ios - Highlight just the text in a UILabel -

Image
i'm attempting set background color/highlight text within uilabel . issue line breaks , spaces added uilabel keep text centered being highlighted. notice spacing before last line in uilabel highlighted. also, beginning , end of new lines highlighted. i'm creating example above following code: -(void)createsomelabel { // create , position label uilabel *somelabel = [[uilabel alloc] initwithframe:cgrectmake(0, 0, self.view.frame.size.width - 40, self.view.frame.size.height - 300)]; somelabel.center = cgpointmake(self.view.frame.size.width / 2, self.view.frame.size.height / 2); somelabel.textalignment = nstextalignmentcenter; somelabel.textcolor = [uicolor whitecolor]; somelabel.linebreakmode = nslinebreakbywordwrapping; somelabel.numberoflin...

sql - implicit conversion from data type varchar to varbinary is not allowed -

after run program, add data, , message: implicit conversion data type varchar varbinary not allowed i watched video on youtube , did same youtuber. works him not me. i trying add data visual studio sql database: here's code: imports system.data.sqlclient select convert(varchar(100), convert(varbinary(max),'0xffd8ffe000')) public class form1 dim conn sqlconnection dim cmd sqlcommand private sub button1_click(sender object, e eventargs) handles button1.click conn = new sqlconnection conn.connectionstring = "data source=byg-a101-moelka;initial catalog=app;integrated security=true" dim reader sqldatareader try conn.open() dim query string query = "insert person (id,firstname,lastname,age) values ('" & textbox1.text & "', '" & textbox2.text & "', '" & textbox3.text & "', '" & textbox4.text & "')...

android - Loadmore ListView Or RecyclerView -

i'm doing loadmore listview . when scrolled last item, event done loadmore. runs fine except 1 problem, complete data loadmore additional adapter can still recognize new adapter made scratch when see listview reloads rather appended listview earlier. class: public class storylistmenu extends activity{ private string url; listview listviewstory; private storylistmenuadapter adapter; private list<storymenu> liststory; private progressbar progressbar; private view progressloadmore; private boolean loadmorestatus; private boolean enableloadmore; private int page; private int currentitem; @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.layout_story_list_menu); page = 0; loadmorestatus = true; enableloadmore = true; currentitem = 0; progressbar = (progressbar) findviewbyid(r.id.progress_story_li...

apache - Unable to install httpd service on chef client(node) -

i new chef , following "learning chef" book "o'riely" learn chef basics. in chapter 07 have described install httpd service on chef client(node) chef host using cookbook. this how .kitchen.yaml file looks : --- driver: name: vagrant provisioner: name: chef_zero platforms: - name: centos_apache driver: box: learningchef/centos65 boxurl: learningchef/centos65 suites: - name: default run_list: - recipe[my_apache::default] attributes: the recipe installing httpd service looks : # # cookbook name:: my_apache # recipe:: default # # copyright (c) 2015 authors, rights reserved. # yum_package 'httpd' source "/home/vipul/downloads/httpd-2.2.15-39.el6.centos.x86_64.rpm" action :install end and log after executing command "kitchen converge" -----> starting kitchen (v1.4.0) -----> converging <default-centos-apache>... preparing files transfer preparing dna.json ...

php - Two Forms, One Button. Not sure of how to make this happen -

i have page prints out rows of information. in each row notes box: <?php <td style='font-size:12px;width:300px;'> {$row['notes']} <br /><center><br /> <form action=\"http://********/functions/notes.php\" id='formnotesform' method='post'> <input type='hidden' id='id' name='id' value='{$row['id']}' /> <textarea placeholder=\"add more notes here...\" name=\"notes\" rows=\"5\" cols=\"30\"'></textarea><br /> <input type='submit' name='formnotes' id='formnotes' value='add notes' /> </form> </center></td> ?> then there's button on page in each row. <form action=\"http://********/functions/archive.php\" method='post' id='formarchiveform' onclick=\"return checkarchive()\"> ...

javascript - Deploying nodejs app on a web server -

i new nodejs , learning, want know how make sample app using nodejs. have tried on localhost , working. trying host public server, not working. var http = require('http'); http.createserver(function (req, res) { res.writehead(200, {'content-type': 'text/plain'}); res.end('hello world\n'); }).listen(1337, '127.0.0.1'); console.log('server running @ http://127.0.0.1/'); this code saved in local machine m.js, run: $ node m.js it runs fine , when open in browser https://127.0.0.1:1337 i getting output : hello world i want same thing remote server i.e. have domain www.example.com , if open https://www.example.com:1337 should show on browser screen : hello world but not working. @annanta 127.0.0.1:1337 local machine ip address. please remove this. please find below sample code. try access remote server ipaddress. please note remote machine must have node , npm installed. var http = require(...

sql server - Python: Use JSON list as parameters in SQL -

res_vod = db.execute(""" select cast ((sum(r.salesvolume)/1000.0) decimal(6,1)) rawdata r inner join product p on r.productid = p.productid inner join calendar c on r.dayid = c.dayid c.weekcodeinyear between 30 , 50 , p.vodest in ('vod') , p.distributor in ({}) group c.weekcodeinyear order c.weekcodeinyear""".format(', '.join(["'" + studio + "'" studio in _studios])) ) the above code allows me add list parameter query. requirement add multiple parameters. in above code _studios list contains parameters. _studios = ["warner","tf1","gaumont","pathe","studiocanal","francetv","m6snd"] i have list like: _vodest = ["vod","est"] want add parameter p.vodest in query. i have done using % has noted list contains double quotes ("warner") sql query requires single quote ('warner') always...

php - MySQL: Syntax error when creating trigger -

why sql syntax throwing error? create trigger info after insert on inbox each row begin if substring(new.textdecoded,1,6)='telkom' insert outbox ( destinationnumber, coding, textdecoded, creatorid )values ( new.sendernumber, 'default_no_compression', (select nama data_dosen kode = substring(new.textdecoded,8,10)), '1'); else insert outbox (destinationnumber, coding, textdecoded, creatorid) values (new.sendernumber, 'default_no_compression', 'maaf format sms anda salah. ketik telkom<spasi>kode dosen', '1'); end if; end$$ you have error in sql syntax; check manual corresponds mysql server version right syntax use near '' @ line 4 you don't have delimiter definition before trigger. delimiter informs mysql characters end trigger. without it, mysql assumes semicolon default delimiter , fails upon first semicolon in code. check out this: delimiter $$ create trigger info after insert on inbox each row ...

php - Send and receive state of unknown number of checkboxes through html form -

i have mysql table , able modify through html form. mysql table has columns this: id (int) | name (text) | option1 (boolean) | option2 (boolean) the number of field options grow on time , not fixed, contains boolean data (0 or 1). number of rows not fixed well. i modify table html form looks this: <form action="file.php" method="post"> <table style="width:100%"> <tr> <th>name</th> <th>option1</th> <th>option2</th> </tr> <tr> <th>lili</th> <th><input type="checkbox" name="lili_1"checked></th> <th><input type="checkbox" name="lili_2"></th> </tr> <tr> <th>thor</th> <th><input type="checkbox" name="thor_1" checked></th> <th><input type="checkbox" name...

email - How to generate fixtures for testing Rails ActionMailer -

i thinking quite time how tdd using fixtures actionmailer. main problem how generate fixtures. want cover following scenarios: receiving of plain text mail receiving of html mail receiving of mail plain text , html receiving of mail attachments another relating question is: if i've generated fixtures want can pass content of them corresponding mailers receive method?

java - difference between maxHttpHeaderSize and content-length -

what difference between maxhttpheadersize in apache tomcat server.xml , content-length in httpservletrequest/httpservletresponse. maxhttpheadersize - maximum size of request , response http header, specified in bytes. if not specified, attribute set 4096 (4 kb). content-length -the content-length entity-header field indicates size of entity-body, in decimal number of octets, sent recipient or, in case of head method, size of entity-body have been sent had request been get. is there relation between these 2 parameters? there no direct connection between two. the content-length http header field specifies length of request body in octets (8-bit bytes). general field of http requests , has no specific connection apache tomcat. the maxhttpheadersize field configuration field in apache tomcat configuration file - limits size of http header sent/received server (for security/or network optimization reasons presume). httpservletrequest/httpservletresponse inte...

ios - KeyBoard gets locked after popover dismissal -

there multiple textfields in viewcontroller in of them customised (one tapping textfield launch popover controller, user can select option displayed in tapped textfield). i have tap gesture on view controller dismissing keyboard (if it's on screen). keypad gets locked(if it's visible) when open popover controller on taping customised textfield. keyboard not getting dismissed if tap on parent view or else on dismiss button in keypad. i have tried 2 snippets hide keyboard, it's not working [self.scrollview endediting:yes]; [[[uiapplication sharedapplication] keywindow] endediting:yes]; you can use textfields delegate prevent presenting keyboard , instead present popover implementing textfieldshouldbeginediting method - (bool)textfieldshouldbeginediting:(uitextfield *)textfield { if(textfield == mycustomtextfield) { [self opencustompopover]; return no; } return yes; } more on delegate methods here https://developer.apple.com...

PHP mixed with html mixed with wordpress tags gets wrong output -

this question specific , of guys maybe easy answer. i'm struggling website client 2 hours. try explain possible. made use of custom fields in wordpress customer can add images products. show images in lightbox (with plugin lightbox plus): <a rel="lightbox[<?php the_field('actietitel'); ?>]" href="<?php the_field('productafbeelding2'); ?>"> </a> . when there no "productafbeelding2 example, html still creat lightbox it's value null keeps loading. i'm trying fix 'if-else-statement' says: <?php if(the_field('actie-afbeelding2') != null) "<a rel='lightbox[" . the_field('actietitel'); "]' href='" . the_field('actie-afbeelding2') . "'> </a>" ?> but reason won't work (this hundreds attempt sorry if bad part of code). actually, works ...

sql - Merge two rows into single row with addition -

2 abc ds a@gmail.com 123 2000.00 1500.00 500.00 0.00 0.00 0.00 500.00 2 abc ds a@gmail.com 123 0.00 0.00 0.00 500.00 200.00 300.00 300.00 i want display single row addition of last column. as suggested need use simple group method , decide want each of columns do. i'm assuming want max value each column except last want sum of values. achieve need use this: select cola, max(colb), max(colc), max(cold), max(cole), max(colf), max(colg), sum(collast) table group cola

excel - Unable to rerun macro after delete the row -

i trying run code validate column "k". if cells in column "k" null error message should pop , cell should turn red. tried following code , working. following issue. run macro. macro detects null cell , pop error msg. deleted row null cell. run macro again. error msg pop again. last cell of column k turn red eventhough row doesnt have data. this code using sub errormsg () count2 = range("b:b").specialcells(xllastcell).row n = 2 count2 if range("k" & n).value = vbnullstring range("k" & n).interior.colorindex = 3 msgbox "error ! null value " exit sub end if next n end sub use column (like id or never going blank) , use in if statement too sub errormsg () count2 = range("b:b").specialcells(xllastcell).row n = 2 count2 if range("k" & n).value = vbnullstring , range("a" & n).value <> "" range("k" & n).interi...

How can i apply a theme to all my forms in C#? -

i want apply theme forms in c#. how can it? i have many forms. , should have same style( orange background , logo on top right) time consuming. once , apply forms. for asp.net webforms you can use masterpage , add content pages inside it. add master page in project designing in color logo , menus. add content pages have masterpage . forms have same theme. right click on website solution explorer . click add new item . select master page popup appears. for details see https://msdn.microsoft.com/en-us/library/wtxbf3hh(v=vs.140).aspx for windows forms you can use mdi parent . see this on how use mdi parent .

in IE8,Add a new row before the last row to HTML table using Jquery -

i need add new row before summary row table. able add new row before summary row problem cells have text field elements , non-editable. how create row taken consideration. please find below code adding new row before last row. <table id="samptable"> <thead> <tr> <td>column 1</td> <td>column 2</td> <td>column 3</td> <td>column 4</td> <td>column 5</td> </tr> </thead> <tbody> <tr> <td><input type="text"/></td> <td><input type="text"/></td> <td><input type="text"/></td> <td></td> <td></td> </tr> <tr id="summaryrow"> <td><input type=...

C# regex to parse PHP function call list file -

Image
i have simple problem. have php file contains lot of function-calls one: return self::_call('client_changepassword',array( $token, $password, $user_token )); the name , number of parameters can vary call have structure, including spaces , linebreaks. what need regular expression grab these calls php file , split them function name (client_changepassword) , group of parameters. since file has several hundreds of different calls, needs reasonably fast, too. the regular expression used within c# part of console application generate simple code analysis. basically, need list of methods plus parameters php calls in source , compare list of definitions stored in different project. our code reviews lot. no, not php-related though i'm trying parse php code. system can't run php code , don't want run php code. you can use following regex: return\s+self::_call\('(?<name>[^']+)'\s*,\s*[aa]rray\((?:\s+\$(?<param>[...

installation - How to install 2 different R versions on Debian? -

on our server, r 2.12.1 installed following instructions on http://cran.r-project.org/bin/linux/debian/ , using apt-get install etc etc. due circumstances old lenny machine hasn't been updated new stable debian, , looks isn't happen soon. of research here depends on latest version of vgam, need r 2.14.0 installed on debian. in order keep old code running, can't drop r 2.12.1 (installing vgam 0.8.4 on version gives errors). so need install 2 r-versions. little understood, if use apt-get upgrade old version replaced new. i've been going through heaps of documentation, can't find optimal way of doing so. the thing imagine now, try build latest r source, colleagues not keen on idea , prompted me first solution. info missed, or willing show me little trick done? if building source solution, i'd hear pitfalls or possible problems. as mentioned in comments, theoretically possible package families (emacs, postgresql, ...) allow multiple concurren...

Joomla css file rewrites it self -

i wondering why .css file rewrite on joomla. i have bought joomla template. in template manger under general settings using development mode on. if use development mode off not able change .css files. for example: using theme located in t3-assets/dev/ theme choose when use on mode find section want change, works. after time rewrites self. wondering how prevent if possible? some templates overwritten alone , go server , take off writing mode in template folder.

Get specific values from a string of php -

edited que.. value contains letters i have search through many questions couldn't find it. have string this: ab2cds value=284t810 shfn4wksn value=39h1047 hs2krj8dne value=3700p134 what want values in output like: 284t810 39h1047 3700p134 i used substr , strpos combine value removes portion of data ahead of first "value=" output like: 284t810 shfn4wksn value=39h1047 hs2krj8dne value=3700p134 i want delete else , keep numbered value after "value=" sorry if there confusion. using stackoverflow first time. i updated answer according edit!! use code: code strings after value= . think easiest solution. $str = 'b2cds value=284t810 shfn4wksn value=39h1047 hs2krj8dne value=3700p134'; preg_match_all('#value=([^\s]+)#', $str, $matches); echo implode(' ', $matches[1]); @kesh : \s means space. [^\s] means except space. , + means @ least 1 char. , () around selecting string can use after operation. ([^\s]+) m...

interpolation - Numpy: find mean coordinate of points along line -

i have bunch of points in 2d space reside on line (polygon). how can compute mean coordinate of these points on line? i don't mean centroid of points in 2d space (as @rth proposed in answer ), mean location of points along line on reside. basically, transform line 1d axis, compute mean location in 1d, , transform location of mean 2d space. maybe these necessary steps, think (or hope) there function in numpy/scipy allows me in 1 step. edit : approach describe in question indeed simplest way solving problem. here implementation calculates positions of vertices along line in 1d, takes mean, , calculates corresponding 2d position parametric interpolation, import numpy np scipy.interpolate import splprep, splev vert = np.random.randn(1000, 2) # vertices definition here # calculate euclidean distances between consecutive vertices # equivalent loop # dl[i] = ((vert[i+1, 0] - vert[i, 0])**2 + (vert[i+1,1] - vert[i,1])**2)**0.5 dl = (np.diff(vert, axis=0)**2).sum(axis...

javascript - Single finger scroll for Webpage - what technology? working example? -

setup: i have website hosted locally on desktop computer, have touchscreen hooked desktop. website viewed on touchscreen using firefox. requirements: enable one-finger scrolling website touchscreen. it should behave way iphone's one-finger scroll works. it needs work in firefox. questions: what best technology use in case? (jquery/javascript/css?) can provide working example/solution me? thanks much. for ios-style scrolling on touch-aware devices (works great on desktop, too) iscroll great solution. point touch-device in question demo url : http://lab.cubiq.org/iscroll/examples/simple/ features include: pinch / zoom pull up/down refresh improved speed , momentum snap element customizable scrollbars -via iscroll 4 docs

elasticsearch - How to retrieve all document ids (_id) in a specific index -

i trying retrieve documents in index, while getting _id field back. basically want retrieve document ids have. while using: { "query": { "match_all": {} }, "fields": [] } the hits contain: "_index", "_type", "_id" , "_score", "_source" way more need. edit(answer) : problem used kopf run queries, , results not accurate (got _source , more..)! when using curl got correct results! so above query achieved needed! can use: { "query": { "match_all": {} }, "_source": false, } or { "query": { "match_all": {} }, "fields": ["_id"] } for elasticsearch , can specific _source fields using fields array. _index , _type , _id , _score must returned elasticsearch . there no way remove them response.

Is important to use the setContentView(R.layout.name.xml) in android -

is important use setcontentview(r.layout.name.xml) in android? in following code, want draw line in relativelayout object without using setcontentview(r.layout.name.xml) . can compile successfully. stops execution time. draw.java class draw extends view { paint paint; public draw(context context) { super(context); paint = new paint(); } @override protected void ondraw(canvas canvas) { paint.setcolor(color.red); canvas.drawline(10,10,100,100,paint); super.ondraw(canvas); }} mainactivity.java class mainactivity extends activity { draw draw; @override public void oncreate(bundle s){ super.oncreate(s); relativelayout relativelayout = new relativelayout(this); draw = new draw(this); relativelayout.addview(draw,200,200); } } setcontentview() in android must called in oncreate() method before getting references views in activity. without setcontentview() activity won't inflated or...

django - My form instance is never valid -

i'm making social network in django , i've trouble user creation form. here's code: views.py def register(request): if request.method == 'post': form = userprofileform(request.post) # if form.is_valid(): u = userprofile.objects.create(first_name = form.cleaned_data['first_name'],...) u.set_password(u.password) u.save() return httpresponseredirect(...) else: return http404 else: form = userprofileform() return render_to_response(..., {'form': form}, context_instance=requestcontext(request)) forms.py class userprofileform(modelform): first_name = forms.charfield(help_text="por favor, introduzca su nombre", required=true) ... class meta: model = userprofile fields = ['first_name',...] def __init__(self, request=none, *args, **kwargs):...

Creating a dataframe where each cell is a vector in R -

i have following data: data.frame("color" = c( c("red", "red"), c("red"), c("red","green") ), rownames=letters[1:3] ) and make dataframe following structure: color c("red", "red") b c("red") c c("red", "green") where a , b , c rownames. the code have above doesn't produce this, how go creating such dataframe? edit: if try make rownames as: paste("a",0:2,sep="",collapse=','), get: color a0,a1,a2 c("red", "red") a0,a1,a2 c("red") a0,a1,a2 c("red", "green") when want is: color a0 c("red", "red") a1 c("red") a2 c("red", "green") how can rectify this? you can use i function , put vectors in list : data.frame("color" = i(list(c("red", "red"), ...

c# - Search function LINQ. Use checkbox values as parameters -

i have search function tales 7 parameters , 6 of them checkbox values. bools shown down below. have problem datetime search. if user check box if run serach function date not null in database. code @ moment. feedback how improve code better performance , code structure. public list<invoice> getallinvoicesbysearch(int merchant, long buyer, bool send, bool paid, bool firstreminder, bool secondreminder, bool invoiceclaim) { var sendvalue = new invoicestatus(); var paidvalue = new invoicestatus(); var firstremind = new datetime(); var secondremind = new datetime(); if (buyer <= 0) { return null; } if (send) { sendvalue = invoicestatus.sent; } if (paid) { paidvalue = invoicestatus.paid; } if (firstreminder) { firstremind = datetime.now; } if (secondreminder) { secondremi...

xpath - R: Getting the value of an attribute -

i retrieve value of "position" attribute html. here sample: <message> <meta date="20150707" expired="false" lastmod="jul 08, 2015 08:00:03" matched="11" position="jul 07, 2015 19:25:05" sentdate="jul 07, 2015 19:25:05"> <pubdate>tue, 07 jul 2015 23:25:05 +0000</pubdate> <summary>summaryhere</summary> <title>titlehere</title> </meta> <keywords>keywordshere</keywords> <category>news</category> </message> i tried use code date <- xpathsapply(data3,"//meta[@position]",xmlvalue) where data3 whole html source. however, returns following date [1] "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "...

c++ - How to check if the (default) value has not been set in the registry -

i need check if (default) value has not been set in registry using c++. whenever value has not been set , try access value, program crashes, , don't know how check if value has been set. here code: dword valuelength = 256; char* value = new char[valuelength]; auto queryvalueerrorcode = regqueryvalueex(key, null, null, null, (lpbyte) value, &valuelength); while(queryvalueerrorcode == error_more_data) { valuelength += 256; char* newvalue = new char[valuelength]; delete[] value; value = newvalue; queryvalueerrorcode = regqueryvalueex(key, null, null, null, (lpbyte) newvalue, &valuelength); } this code doesn't crash - when try access value when crashes, have check if value has been set or not. the (default) value not exist until has been set, check error code for error_file_not_found before trying access value.

android - Allow logged in user to click its row -

Image
i struggling following. have list view showing users in belong team. rows contain user's knickname , number of steps walked since every last midnight using google fit sdk. so see cerberus 33 walked 2342 steps , lenovo 0. i want logged in user cerberus 33 in phone,to click 1 row i.e. first one,so can see alert dialog leave team button. here part of code. i retrieve logged in username , password activity using shared preferences. sharedpreferences settings = preferencemanager.getdefaultsharedpreferences(this); username = settings.getstring("username", ""); password = settings.getstring("password", ""); and compare logged in username username database via volley library. private void getteamplayers(final string teamid, final string username, final string password) { string tag_json_obj = "json_obj_req"; final hashmap<string, string> postparams1 = new hashmap<string, string>(); ...

javascript - Want to prevent selecting specific item in jQuery UI AutoComplete -

i developing textbox autocomplete using jquery ui autocomplete. after that, can create textbox autocomplete, 1 issuce has occured now. in textbox, want prevent selecting specific item autocomplete list. if select specific item, autocomplete list display again or not close. $(function (prefixtext) { $("textbox").autocomplete({ autofocus: false, minlength: 0, delay: 50, source: function (request, response) { var data = "{ 'prefixtext': '" + prefixtext + "','count': '" + 30 + "','pixwidth': '" + 100 + "' }"; $.ajax({ type: "post", url: "example.asmx/" + method, cache: false, data: data, ...

c# - Is having class Thing that implements interface IThing a bad practice? -

i have class thing , , interface implements, named ithing . uses ithing can presume it's thing , since it's class implements interface, @ same time understands can access subset of public members of thing , , there's pretty design reason — basically, ithing read-only version of thing (it's little bit more complex that, let's pretend it's read-only/write distinction sake of question). is convention though? alternative, name interface ithingreadonly or name class thingwritable , or this, seems these names bulky , less readable in big codebase. i use extension methods extensively both interface , class, have thingextensions , ithingextensions well. it's useful, because reads code of extensions can operate assumption uses public members of thing , ithing , respectively. however, having both thingextensions , ithingextensions files sitting alongside in project seem little bit off reason. so, 1 better option — keep thing , ithing alongside, or...

angularjs - How to get the data for my controller when http request in progress? -

i have following controller 1) introctrl 2) articlectrl 3) articleservice (service) now sending http request introcrtl .controller('introctrl', function($scope, articleservice) { articleservice.getarticles(); }); and ariclectrl .controller('articlectrl', function($scope,$rootscope,articleservice) { $scope.articles = articleservice.fetcharticles(); }) and service is .service('articleservice', function ($http, $q) { var articlelist = []; var getarticles = function() { $http({ url: "muylink,co,", data: { starlimit: 0, endlimit: 150,created_date: 0 }, method: 'post', withcredentials: true, }).success(function (data, status, headers, config) { articlelist.push(data); }).error(function (err) { console.log(err); }) ...

android - How to select only one checkbox in Adapter's getView() -

cbchecked.setoncheckedchangelistener(new oncheckedchangelistener() { @override public void oncheckedchanged(compoundbutton buttonview, boolean ischecked) { // todo auto-generated method stub faxdialogactivity.record.get(position).ischecked = true; } }); but when check 1 checkbox, multiple checkboxes selected after scrolling listview. this because getview called everytime view recycles while scrolling list view.so u have store value , check in getview checked checkbox. try this 1> create arraylist of boolean object store state of each checkbox 2> initializes arraylist items default value false, means no checkbox checked yet. 3>when click on checkbox. set check against checked/unchecked state , store value in arraylist. now set position checkbox using setchecked() method. for complete code please refer this answer , blog

oracle11g - if clause in Oracle SQL -

i need query in oracle sql. here table example: time var '2015.07.08 01:00:01' 0.1 '2015.07.08 01:00:02' 0.15 '2015.07.08 01:00:03' 0.22 '2015.07.08 01:00:04' 0.13 '2015.07.08 01:00:05' 0 '2015.07.08 01:00:06' 0.1 '2015.07.08 01:00:07' 0.02 '2015.07.08 01:00:08' 0 '2015.07.08 01:00:20' 0.1 now need time differences object x+1 , x if var equal 0. example want see output in seconds: 1 # '2015.07.08 01:00:06' - '2015.07.08 01:00:05' 12 # '2015.07.08 01:00:20' - '2015.07.08 01:00:08' how statement for: if var==0 calculate time(row+1) - time(row) . help. use lag previous record: select (time - time_before) * 24 * 60 * 60 ( select time, var, lag(var) on (order time) var_before, lag(time) on (order time) time_before mytable ) var_before = 0 order time; oops, overly complicated. use l...

python - django admin error - cannot access admin page -

i started new django 1.8 project. created superuser , went 127.0.0.1:8000/admin/ , logged in that. after logging in, shows following error: (1054, "unknown column 'django_content_type.name' in 'field list'") i searched around , found 1 relevant question, here . as said in discussion there, dropped schema , recreated many times; still same error. django_content_type table in database has 3 fields: id, app_label , model. doesn't have 'name' deprecated. also, can access other urls /admin/auth/ , /admin/auth/users/ , trying add more users gives following error(i think coming due same problem above): error creating new content types. please make sure contenttypes migrated before trying migrate apps individually. i'm new django in general. appreciated. thanks. here's full error: operationalerror @ /admin/ (1054, "unknown column 'django_content_type.name' in 'field list'") request method: req...

javascript - Meteor JS: How to display only data that have certain words in Mongo? -

for example have posts = new mongo.collection('posts'); and insert in posts data this posts.insert({ tags: ["444","555"] }); posts.insert({ tags: ["111","222"] }); posts.insert({ tags: ["111","333"] }); now want show posts have in tags numbers 111 (string). question: how can ? post.find({ tags: "111" }); i believe should fine.

java - Why is getting a value from a variable preferred than getting it from an array? -

consider below program: int []array = {10, 20, 30, 40, 50}; int x = array[0]; for(int = 0; < array.length; i++) { system.out.println(x * array[i]); system.out.println(array[0] * array[i]); } when array declared, stored in memory reside together. array: [0] [1] [2] [3] [4] value: 10 20 30 40 50 location: 100 102 104 106 108 now when x assigned value first element of array(10) . x stored value in memory value 10 . variable : x value : 10 location : 120 now when call loop, the first print statement refer value @ location 120 , have value 10 . the second print statement refer location 100 , has value 10 . when both statements have memory location every time, why first statement more optimal? edit in same program if x used multiple times. int []array = {10, 20, 30, 40, 50}; int x = array[0]; for(int = 0; < array.length; i++) { system.out.println(x * array[i] + (x + 1) * array[i] - ( x + 2)); syste...

python - User got saved in django regardless of other two forms with it are valid or not -

userform got saved no matter if other 2 forms (studentorfacultyform , useridform) valid or not. user should not created if other 2 forms invalid. please help! models.py class studentorfaculty(models.model): student = 's' faculty = 'f' profile_choices = ( (student, 'student'), (faculty, 'faculty'), ) # links user model instance user = models.onetoonefield(user, related_name='fors') # additional attributes st_or_faculty = models.charfield(max_length=1, choices=profile_choices) def __str__(self): if(self.st_or_faculty == 's'): fullname = 'student' elif(self.st_or_faculty == 'f'): fullname = 'faculty' else: fullname = 'unknown' return str(self.user) + " " + fullname class useractivation(models.model): user = models.onetoonefield(user) activation_key = models.charfie...