Posts

Showing posts from August, 2010

asp.net mvc - creating nuget package on local machine imported project ...Microsoft.WebApplication.targets... cannot be found -

i'm trying make nuget package of mvc 5 project, , following error in console. c:\projects>nuget pack webapplication3\webapplication3\webapplication3.csproj attempting build package 'webapplication3.csproj'. imported project "c:\program files (x86)\msbuild\microsoft\visualstudio\v10.0\webapplications\microsoft.webapplication.targets" not found. confirm path in declaration correct, , file exists on disk. c:\users\michael\documents\visual studio 2013\projects\webapplication3\webapplication3\webapplication3.csproj in .csproj <import project="$(msbuildbinpath)\microsoft.csharp.targets" /> <import project="$(vstoolspath)\webapplications\microsoft.webapplication.targets" condition="'$(vstoolspath)' != ''" /> <import project="$(msbuildextensionspath32)\microsoft\visualstudio\v10.0\webapplications\microsoft.webapplication.targets" condition="false" /> i don't hav

android - Drawable setColorFilter not work on Nexus 7 -

i want change color of android design drawable blue. piece of code in application class oncreate method: drawable drawable = getresources().getdrawable(r.drawable.rating_not_important); drawable.setcolorfilter(0xff1565c0, mode.src_atop); drawable = getresources().getdrawable(r.drawable.rating_important); drawable.setcolorfilter(0xff1565c0, mode.src_atop); it works on emulator (api 4.0.3) , xperia p mobile device (api 4.1.2), not work on nexus 7 tablet. star drawable has default white color no change.i have tested mode.multiply , mode.lighten , no success. please help!

forms - PHP - preg_match to validate date format mm/yyyy -

for check of birthday date (format: dd/mm/yyyy) in form i've used code , works fine. if (!preg_match("/([012]?[1-9]|[12]0|3[01])\/(0?[1-9]|1[012])\/([0-9]{4})/",$date)){ $error[1]= "insert valid date"; } but when want check date format mm/yyyy , use code, doesn't work anymore. when try example put 33/2014 in input php validation doesn't show error. if (!preg_match("/(0?[1-9]|1[012])\/([0-9]{4})/",$date2)){ $error[2]= "insert valid date"; } where go wrong? thank help. based on tim's checkdate based solution: the extraction of day, month , year can done using explode as: list($dd,$mm,$yyyy) = explode('/',$cnt_birthday); if (!checkdate($mm,$dd,$yyyy)) { $error = true; }

javascript - Angular Bootstrap dropdown toggle not working -

i have angular bootstrap dropdown menu doesn't seem toggling dropdown. on click, nothing shows up, although can see list items on inspect element. html: <div ng-controller="dropdownctrl"> <!-- simple dropdown --> <span class="dropdown" dropdown on-toggle="toggled(open)"> <a href class="dropdown-toggle {{ disabledropdown }}" dropdown-toggle> <i class="fa fa-align-justify"></i> </a> <ul class="dropdown-menu port-dropdown-menu"> <li>test</li> <li>test2</li> <li ng-repeat="choice in dropdown.items"> <a ui-sref="portfolio.port({portid: choice.id})">{{ choice.title }}</a> </li> </ul> </span>

PHP for loop : equal or smaller than - works, equal to - creates infinte loop -

this code works <?php ($x = 0; $x <= 10; $x++) { echo "the number is: $x <br>"; } ?> but if instead of " <= " use " = " php gets infinite loop timesout <?php ($x = 0; $x = 10; $x++) { echo "the number is: $x <br>"; } ?> is expected behavior? yes, you're using assignment operator instead of comparison operator. there's no way loop end.

php - Multiple checkbox database insert with mysql prepare -

i have checkboxes generated code: while($row = $result->fetch_assoc()) { echo "<input type='checkbox' name='branch[]' value='".$row['id']."'> ".$row['name']."<br>"; } and need insert value of every checkbox in mysql database. code have inserts every checkbox $member_id , $branch inserted 0. doing wrong? $sql = "select id members email='$email'"; $result = mysqli_query($mysqli,$sql); $row = mysqli_fetch_array($result,mysqli_assoc); $member_id = $row["id"]; $checked_arr = $_post['branch']; $branch_count = count($checked_arr); ($i = 0; $i < $branch_count; $i++) { if ($insert_stmt_branch = $mysqli->prepare("insert members_branch (member, branch) values (?, ?)")){ $insert_stmt_branch->bind_param('ss', $member_id, $branch); if (! $insert_stmt_branch->execute()) { echo "error: branch ins

ember.js - Ember: how to fire observers when any Em.A inside an Em.Object change -

let's have like property: em.object.create(foo: em.a([]), bar: em.a([])), onanyarraychange: function(){ //some code }.observes('what here??') thing don't want explicitly .observes('property.foo.[]', 'property.bar.[]') i'd love like .observes('property.each_key.[]') is there way it? yes possible @each property. see: http://emberjs.com/api/classes/ember.array.html#property__each what need convert property ember.object ember.arrayproxy this: property: em.arrayproxy.create({ content: [ em.a([]), // used foo em.a([]) // used bar ] }); and can: .observes('property.@each.[]')

javascript - Programatically scrape Facebook meta tags -

i making "generate ___ name" generator , having trouble facebook share portion. basically user fills out form gets results. first idea have results in iframe have unique url because of parameters, generated correct facebook share info. problem link shared go directly "results" iframe. i decided instead keep on 1 page, , submit form via post, reload page , show results. if there no post data, shows default page. problem re-scraping facebook data in order share correct "generated" image. (programatically, not @ https://developers.facebook.com/tools/debug/ ). found script below supposed that, haven't had luck. does know of alternative way of doing show correct "generated" image in facebook link original page others can generate own name? this example here it, haven't been able reverse-engineer doing: http://www.zimbio.com/generator/d_rn-gyttd2/what's+your+'game+of+thrones'+warrior+name <meta property="og:tit

python - luigi target for non-existent table -

i'm trying set simple table existence test luigi task using luigi.hive.hivetabletarget i create simple table in hive make sure there: create table test_table (a int); next set target luigi: from luigi.hive import hivetabletarget target = hivetabletarget(table='test_table') >>> target.exists() true great, next try table know doesn't exist make sure returns false. target = hivetabletarget(table='test_table_not_here') >>> target.exists() and raises exception: traceback (most recent call last): file "<stdin>", line 1, in <module> file "/usr/lib/python2.6/site-packages/luigi/hive.py", line 344, in exists return self.client.table_exists(self.table, self.database) file "/usr/lib/python2.6/site-packages/luigi/hive.py", line 117, in table_exists stdout = run_hive_cmd('use {0}; describe {1}'.format(database, table)) file "/usr/lib/python2.6/site-packages/luigi/h

php - mysql query to get the min values according to the latesttime stamp -

hi have try find solution query minvalues along latest time stamp. i have following tables table1 sno user_id name subject rank timestamp 1 10 ss maths1 1 2014-12-05 17:24:33 2 10 ss maths2 2 2014-12-05 17:24:33 3 10 ph phy1 3 2014-12-05 17:24:33 4 10 ph phy2 4 2014-12-05 17:24:33 5 10 ss maths1 2 2014-12-04 17:24:33 6 10 ss maths2 1 2014-12-04 17:24:33 7 10 ph phy1 3 2014-12-04 17:24:33 8 10 ph phy2 4 2014-12-04 17:24:33 tabe12 sno name status 1 ss active 2 ph active 3 inactive so trying following result sno userid name subject rank timpestamp 1 10 ss maths1 1 2014-12-05 17:24:33 2 10 ph phy1 3 2014-12-05 17:24:33 so far tried query able latest time , least rank values subjects distinct name. not connected each other means getting latesttim

query last image in shopify liquid -

i’m trying add link size guide image having pull last image collection. but right it’s pulling images, not last. how pull last? <!-- size guide --> <div id=“size_guide”> {% image in product.images %} <a href=“{{ image.src | product_img_url: ‘master’ }}” class=“fancybox-media {% cycle ‘,last’ %}”> size guide</a> {% endfor %} </div> </div> try using last array filter . e.g: <a href="{{ product.images.last | product_img_url: 'master' }}">size guide</a>

Is it more performant to defer CSS to :hover if possible? -

consider following: .element { cursor: pointer; } .element:hover { cursor: pointer; } to me, these 2 css snippets identical. cursor seen when hovering element. either method of decorating cursor works equally well. i'm curious how works under hood. there preference here using 1 or other? if so, why? let's analysis here. difference hover pseudo-element, declaratively indicates change rendering in response user actions. the cursor property description in css3 spec contains following: this property specifies type of cursor displayed pointing device when on element's border, padding, , content. this can interpreted modifying cursor response mouseover event. on other end :hover pseudo selector description in css3 spec contains following: a visual user agent apply pseudo-class when cursor (mouse pointer) hovers on box generated element. this applies whole set of properties element in question response mouseover event, mean rep

postgresql - Simplify and/or optimize sql query with INTERSECT or HAVING -

i have following data: tag_id | taggable_id --------+------------- 1 | 1 2 | 1 3 | 1 4 | 1 1 | 2 2 | 2 5 | 2 6 | 2 7 | 3 8 | 3 9 | 3 10 | 3 and want bring taggable_ids in group of tag_ids , in group , another... (max 4 groups). example: if search taggable_ids tag_id 1 or 7 , tag_id 4 should return 1 if search taggable_ids tag_id 1 , tag_id 6 , tag_id 2 or 8 should return 2 if search taggable_ids tag_id 8 , tag_id 5 should not return ids in gross way(for second example), query following: select taggable_id taggings tag_id in (1) intersect select taggable_id taggings tag_id in (6) intersect select taggable_id taggings tag_id in (2,8) i think simplifying it, looks like: select taggable_id taggings tag_id in (1,2,6,8) group taggable_id having count(*)=3 but i'm wondering

php - Load different Database Symfony2 -

how can load different database production , development environment ? in parameters.yml have main database configuration, don't know how add dev database differets parameters. i'm looking on google can't find help. maybe config_dev.yml , config_prod.yml? i'm not sure how that. any appreciated. thanks. i this: files hierarchy: 1) parameters.yml - common parameters 2) create parameters_dev.yml - dev db connection params 3) create parameters_prod.yml - prod db connection params in head of config files: 1) config.yml imports: - { resource: parameters.yml } 2) config_dev.yml imports: - { resource: config.yml } - { resource: parameters_dev.yml } 3) config_prod.yml imports: - { resource: config.yml } - { resource: parameters_prod.yml}

SQL Server 2012 Developer version on Windows 7 -

i've installed developer version of sql server 2012 on pc running windows 7 professional. sql server works locally. can't "find" when attempting set odbc connection on pc access sql server installation. basic permissions issue. can give pointers or reference step-by-step instructions type of configuration? - tom enable tcp protocol in sql configuration manager. http://msdn.microsoft.com/en-us/library/ms191294(v=sql.110).aspx

javascript - ckeditor insertHtml() form jquery.load -

<script type="text/javascript"> $( "#x_img" ).load( "../x_img.php?id=123" ); $("#x_img").delegate("img", "click",function() { ckeditor.instances.editor1.inserthtml('<img src="'+$(this).attr('alt')+'" />'); }); </script> i have function loads images (x_img) user use. x_img jq.load in page. using code click image insert, works ok. but, cannot image src value! ckeditor shows this: <img src="undefined" /> is problem image on page? if editor showing <img src="undefined" /> then $(this).attr('alt') will return undefined because img node doesn't have alt='something' attribute. undefined being concated img 's src attribute. try changing image tag following: <img alt="/images/funtimesatthebeach.jpg" /> then, code should load image @ /images/funtimesatthebeach.jpg .

spring - thymeleaf generate REST url with dynamic parameters/elements -

i create rest url thymeleaf. i've this: <a th:href="@{customer/(${c.id})/edit}">edit</a> the output is: http://localhost:8080/app/customer/($%7bs.id%7d)/edit but get: http://localhost:8080/app/customer/4/edit how can achive this? please help. what need called preprocessing , follow link! in case, should this: <a th:href="@{customer/__${c.id}__/edit}">edit</a>

Why would I get python UnboundLocalError when calling super()? -

my class this: from openerp import tools openerp.osv import osv, fields import requests import logging import json _logger = logging.getlogger(__name__) class stock_move(osv.model): _inherit = 'stock.move' def create(self, cr, uid, vals, context=none): new_id = super(stock_move, self).create(cr, uid, vals, context=context) but when run it, this: file "/opt/odoo/ebuynow/ebn_oddjobs/models.py", line 15, in create new_id = super(stock_move, self).create(cr, uid, vals, context=context) unboundlocalerror: local variable 'stock_move' referenced before assignment i'm pretty sure correct way use super(), because code working fine on system. question more asking if there out there knows might in system or python environment cause not recognize stock_move class name purpose of calling parent class's create() method. system ubuntu server 14.04, python 2.7.6. previous system code ran on ubuntu desktop 14.04 running python 2.7.6

html - JavaScript: Defined Function Undefined -

so have js: document.getelementbyid("config2").addeventlistener("click", function(){ config3(); console.log("in function config.onclick()..."); }); function config3() { document.body.innerhtml+="<div style=\"opacity:0;\" class=\"popoutcont\" id=\"formcont\"><div style=\"opacity:0;\"><div class=\"popoutform\"></div></div>"; setinterval(function(){document.getelementbyid("formcont").style.opacity+=0.01;if(document.getelementbyid("formcont").style.opacity===1){clearinterval(this)}}, 1); console.log("in function config..."); } and html: <p class='spectxt' style='font-weight:normal;' id='config2'><strong>payload configuration:</strong> seats: 2</p>" first of all, event never occurs. no output sent console. second, chrome devtools js console says config3 unde

java - Flash AS3 Pass my var data to another frame -

i'm using as3 / air 3.2 android. i'm having trouble passing variable data frame. read forums i'm new don't have yet idea. have input text , button in frame 1 user input name data entered save. (i used sharedobject) data inputted appear on frame 2. while frame 2 dynamic text data appear. code frame 1 import flash.net.sharedobject; var myname:string; myresult.text = ""; var myso:sharedobject = sharedobject.getlocal("test"); if (myso1.data.myname != null){ myresult.text = myso1.data.myname; } else { myresult.text = "no name"; } submit_btn.addeventlistener(mouseevent.click, gotomynextframe); function gotomynextframe(event:mouseevent):void { nextframe(); myname = myinputname.text; trace(myname); myresult.text = myname; myso.data.myresult = myinputname.text; myso.flush(); trace(myso.data.myresult); } error: error #1009: cannot access property or method of null object reference. think because i'm

cmd /C set variable -

the short: trying make 1 line command script sets , uses variable. right came with: cmd /c "set var=127.0.0.1 & echo %var%" i expect output 127.0.0.1, instead prints %var%. the long: using keepass password manager , trying make automatically launch rdp session me. put following in url: cmd://cmd /c "cmdkey /generic:termsrv/127.0.0.1 /user:{username} /pass:{password} & mstsc.exe /v:127.0.0.1 & cmdkey /delete:termsrv/127.0.0.1" this works, if need update ipaddress, have touch 3 places instead of 1. tried changing following, didn't work: cmd://cmd /c "set sserver=127.0.0.1 & cmdkey /generic:termsrv/%sserver% /user:{username} /pass:{password} & mstsc.exe /v:%sserver% & cmdkey /delete:termsrv/%sserver%" josefz comment worked perfectly. following command can placed in "url:" field in keepass. when double click url or else launches url automatically launch rpd , log in. cmd://cmd /c "for /f &qu

class - Fortran convert string to number -

i want have subroutine converts contents of numeric string numeric type (int, real, double precision, real(real128)). however getting error when trying use class(*) . error shown below: gfortran -o build/lib/larsa.o -c -ffree-form -g -j./build/lib lib/larsa.f lib/larsa.f:1933.35: read (s, frmt, iostat=ios) num 1 error: data transfer element @ (1) cannot polymorphic unless processed defined input/output procedure lib/larsa.f:1935.32: read (s, *, iostat=ios) num 1 error: data transfer element @ (1) cannot polymorphic unless processed defined input/output procedure this subroutine have written. subroutine converts_str_to_num & ( & s, num, & fmt, wrn & ) character (len=*), intent (in) :: s character (len=*), intent (in), optional :: fmt class (*) :: num character (len=*), intent (inout), optional :: wrn intege

java - Printing a method -

i need call method returns code below. using in enhanced loop objects in array. however, when try print out, error. public string tostring(){ return string.format("length:%d\nwidth:%d\nheight:%d\n", length,width,height); this used main. for(box n:boxes) system.out.printf(n.tostring()); the error is exception in thread "main" java.util.illegalformatconversionexception: d != java.lang.double

php - How to select DISTINCT with Datatables 1.10.4 -

i have 2 columns named col1 , col2 in database, , select distinct col1 name_table is there way datatables 1.10.4 ? haven't found answer in forums. i use ssp class via url : http://www.datatables.net/examples/data_sources/server_side.html i found answer. perhaps someone. it needs change ssp class : select sql_calc_found_rows '.implode("`, `", self::pluck($columns, 'db')); to select distinct '.implode("`, `", self::pluck($columns, 'db')); so create ssp class parameter or extend ssp class function named distinct() example.

machine learning - Model selection with dropout training neural network -

i've been studying neural networks bit , learned dropout training algorithm. there excellent papers out there understand how works, including ones authors. so built neural network dropout training (it easy) i'm bit confused how perform model selection. understand, looks dropout method used when training final model obtained through model selection. as test part, papers talk using complete network halved weights, not mention how use in training/validation part (at least ones read). i thinking using network without dropout model selection part. makes me find net performs n neurons. then, final training (the 1 use train network test part) use 2n neurons dropout probability p=0.5. assures me have n neurons active on average, using network @ right capacity of time. is correct approach? by way, i'm aware of fact dropout might not best choice small datasets. project i'm working on has academic purposes, it's not needed use best model data, long stick machine

python - Django: getting previous url -

i have post model requires category before being added database, , want category generated automatically. clicking addpost button takes different page , category determined taking part of previous page url. is there way previous page url string? thanks edit: have added addpost button here. <aside class="addpost"> <article> <form action="/forum/addpost"> <input type="submit" name="submit" value="add post"/> </form> </article> </aside> you can using self.request.meta['http_referer'] , exist if tab previous page website, else there no http_referer in meta dict . careful , make sure using .get() notation instead. # returns none if user came website referer = self.request.meta.get('http_referer')

templates - Add Title To SAS Output Graphs -

i'm using template , sgrender in sas create heatmaps based on different class variable. i'd output update title based off of class variable each time value of class variable. far, code (it prints string title if tell to, can't vary depending on variable): proc template; define statgraph heatmapparm; begingraph; entrytitle 'insert title here'; *update title here based on classvar; layout overlay; heatmapparm x=magx2 y=magz2 colorresponse=percent / colormodel=(blue yellow red) name="heatmapparm" xbinaxis=false ybinaxis=false datatransparency=0; continuouslegend "heatmapparm" / location=outside valign=bottom; endlayout; endgraph; end; run; title #byval(classvar); proc sgrender data=dataset template=heatmapparm; classvar; run; thank all! use macro variables alter titles. here example %let classvar=variablevalue1; title &classvar.; proc sgrender data=dataset t

jquery - how to prevent ajax returned json encoded result to appear in console? -

i'm trying build autosuggeset feature in website. users enter in text field, ajax send data php side, ran query in database, , return result array page. problem don't want browser console shows what's being returned. here basic structures: main.php: <input type="text" id="title" /> <div id="suggest_box" style="display:none"></div> javascript: $("input#title").keyup(function(){ var url = "suggest.php"; var data = $(this).val(); $.post (url, data) .success (function(result){ var jsonobj = $.parsejson( result ); var suggestobj = jsonobj.title_list; }); }); suggest.php // returning result array $json = new stdclass(); $json->title_list = $result; echo json_encode($json, json_unescaped_unicode); i have checked autosuggest feature in other popular websites, didn't show in console, doing wrong?

c# - String constants embedded twice in .Net? -

say have simple (the simplest?) c# program: class program { static void main() { system.console.writeline("hello, world"); } } if, compile code , @ resultant .exe, see "hello, world" string in exe image expected. if refactor code to: class program { const string greeting = "hello, world"; static void main() { system.console.writeline(greeting); } } if compile code , @ resultant .exe, see "hello, world" string literal in exe image twice. surprising me. under impression string literals shared, , therefor show in image 1 time. can explain this? perhaps second copy of string needed reflection metadata? the ecma-335 cli specification sheds light on this. c# const declared static literal field in il. section i.8.6.1.2 (emphasis mine): the literal constraint promises value of location fixed value of built-in type. value specified part of constraint. compilers required replace reference

r - How to create tidy data with a Dataset where values are duplicated over many rows -

sorry if large of example. looks more real life have hard time thinking of example better explain situation. what want tidy data.frame can use medical conditions in summaries (avg) , in plots (edited) what need answered trying accomplish correctly. want row huge string values divided commas? need split more columns? reports our data base vendor (actual data changed). the reports not give unique key. in data.frames person.id unique in , others multi rows of person.id , values. person.id <- c("1017", "1018", "1018", "1018", "1018", "1018", "1018", "1018", "1018", "1018", "1018", "1019", "1019", "1020", "1020") med.condition <- c(na, "allergic rhinitis", "allergic rhinitis", "atopic dermatitis", "atopic dermatitis",

ruby - Composing slices of slices -

i've been thinking problem couple of days , can't find elegant solution life of me. in app have text class wrapper around string : class text < struct.new(:string, :style) def [](start, len) text.new(string[start, len], style) end def length string.length end def to_s case style when :bold "**" + string + "**" when :italic "_" + string +"_" else string end end def inspect "<[#{style}] #{string}>" end end i have line class array of text objects: class line < struct.new(:texts) def [](start, len) # todo should return new line object. end def length texts.map(&:length).reduce(&:+) end def to_s texts.map(&:to_s).join end def inspect texts.map(&:inspect).join(" ") end end the question is, how can implement #[] in line returns new line object "correctly" slices contained text objects? t

c# - Determine sender when second form opens? -

i have been learning c# , wpf on recent project of mine , have run issue determining sender when form opens. have main form listbox bound list of objects. used following code handle user double clicking line in list box: <listbox.itemcontainerstyle> <style targettype="{x:type listboxitem}" basedon="{staticresource {x:type listboxitem}}"> <eventsetter event="mousedoubleclick" handler="listboxitem_mousedoubleclick"/> </style> </listbox.itemcontainerstyle> where have run issue want launch second form (named "addproject") when user double clicks, launch same form , button on main form. need determine (the double click or button click) launched secondary form can change appropriately. in main form, can use window_loaded method, , read sender name, when try use same in secondary form, doesn't work. works in main form, not secondary:

php - Trouble with URL parameters -

i working on search form post searched values in url. having trouble getting url include parameters however. post if key in values in view( if instead of $this->search_zip key '12345'). search works desired except url. getting search terms form, need change controller setup them url instead? if case how filter? ultimately url read: results/12345/otherparam i getting results no matter variables key form. module config return array( 'router' => array( 'routes' => array( 'home' => array( 'type' => 'segment', 'options' => array( 'route' => '/', 'constraints' => array( 'action' => '[a-za-z][a-za-z0-9_-]*', ), 'defaults' => array( 'con

css - Why does my twitter boostrap page go off edges of the page? -

i new twitter bootstrap , having problems following structure <container> - using fluid container <row 1> <column 1> - covers 6 columns <row 1> - electricity <row 2> - electricity graph <row 3> - electricity table </column 1> <column 2> - covers 6 columns <row 1> - gas <row 2> - gas graph <row 3> - gas table </column 2> </row 1> <row 2> - covers entire width table </row 2> <container> see here page as can see content has gone off edge of page on left does know cause this? how can reliable small margin left , right? chrome has issues rendering first header somehow content wider actual browser width has caused horizontal scroll bar, although there not big overlap? the markup big post here here link it. there seems 2 different things going on. first off paul mentions in comments above svg

javascript - Rendering local templates using Handlebars.js -

i've started using handlebars.js in attempt move away rendering dynamic data ugly way using string concat , injection. trying separate template script main html file , render template file via function call. here i've got: script.js ---------- $(function() { var mydata = { requests: [ {id: "1", firstname: "roger", lastname: "jones", age: 24}, {id: "2", firstname: "phillip", lastname: "green", age: 44} ]}; $.ajax({ url: 'templates/requests.html', datatype: 'html', cache: false, success: function(data, status, response) { var template = handlebars.compile(response.responsetext); var context = mydata; $('#injecttemplate_requests').html(template(context)); } }); }); index.html ------------- <!doctype html> <html lang="en"> <head> <meta charset="utf-8"> <title>

Visual Studio 2012 combobox and textbox -

friends, have combo box , text box. want when choose combobox, automatically textbox filled automatically autogenerate number in textbox, "an example: chose combobox letter" m ", want in textbox appear" m.0001 ", please support master, , ?? using visual studio 2012 you can set text shown in textbox using textboxname.text = "your text" and can read combobox text using string s = combobox1.text; well thing need listener. can use listener of combobox called "selectedindexchanged". fire whenever select element in combobox: http://msdn.microsoft.com/de-de/library/system.windows.forms.combobox.selectedindexchanged(v=vs.110).aspx so have combine these 3 things. if tell me programming language use, give short code snippet.

plot - accessing / plotting rows and columns from tables - R -

ratings = read.table("ratings.txt", sep="\t", col.names=c("user", "mid", "rating"), fill=false, strip.white=true) l = colnames(ratings)[2] this give me 2nd column - ("mid") however third row in column "mid" i try: k = colnames(ratings)[2][3] but give me n/a. how access rows , columns. , if can, plot them like: plot(mid~rating)

javascript - How do I stop and start a function? -

i'm looking pointed in right direction here. i'm beginner javascript there's sort of fundamental thing i'm not understanding. google searches didn't seem since apparently question never asked. i have game there 60 second countdown once go button pressed. when 60 second countdown running want run function orientationstuff() sorts of stuff on orientationchange. no problem...however i want orientationstuff() run during 60 second countdown. once hits 0, there no more orientationstuff() going on. once click go again want countdown start again (and consequently orientationstuff() the simple answer use settimeout function want execute , 60000 milliseconds settimeout(function(){ // whatever want happen here },60000) in terms of starting jquery, if had button class go use $(document).on('click','.go',function(){ settimeout(function(){ // game on man! game over!! },60000) }); i guess want stop timer - if player wins

c++ - Brace Enclosed Initializer List? convert to vector -

so have piece of code attempting test. code checking few vectors (these elements of structs) equivalent known vectors @ points, running issue. when attempt compare vector known vector follows, assert((class1.getattr().getattr().getvec(key) == {4,3,2,2})) i following error: assertall.cpp:105:82: error: not convert ‘{4,3,2,2}’ ‘<brace-enclosed initializer list>’ ‘std::vector<int>’ the rest of code correct, , lval of assert vector should be. compiling flags, -std=c++11 -wall -wextra -pedantic -o in g++. know how fix this? there way typecast bracket enclosed initializer list vector, or there better way this? does know how fix this? there way typecast bracket enclosed initializer list vector interestingly, different error on clang 3.5 , gcc 4.9.2 when try similar, can use initializer list syntax construct vector in place (not quite typecasting, guess): assert((class1.getattr().getattr().getvec(key) == std::vector<int>{4,3,2,2})) i'm not s

Eclipse Output Folder Not Working -

i have changed project build path webcontent folder, doesn't generate class file new folder, still generate class file /target/classes. i have checked "allow output folders source folders", , give default , output folder webcontent folder. eclipse still build older folder. restart. eclipse version version: luna service release 1 (4.4.1) build id: 20140925-1800 with m2e installed hope have changed "default output folder" in project->properties->java build path ->default output folder

protocols - Calculate PES_packet_data_byte count when PES_packet_length == 0 -

in mpeg-ts stream, in pes bitstream pes_packet_length can 0 pes packet size determined payload_unit_start_indicator==1 of ts packet (first ts packet of next pes packet), right ? now when total size of pes packet known pes_packet_length unknown (0) how calculate stuffing_byte count , pes_packet_data_byte count ? pes_packet_length can 0 true video frames. audio frames can not of length 0. in case, stuffing bytes not allowed, , adaption field padding should used instead. (af size can 0, if 1 padding byte needed)

javascript - Call function for all array elements without passing item as parameter -

in javascript can this: var show = function(w) { alert(w); }; var words = ['a', 'b', 'c']; words.foreach(show); note don't need pass array item parameter. is there way same in ruby? like: def show(w) puts w end words = ['a', 'b', 'c'] words.each(show) ps: know can doing: words.each { |w| show(w) } . question if can in javascript, without passing item parameter. sure, passing method, in ecmascript: words.each(&method(:show)) note way make ruby example work. however, ruby method not closest analogue ecmascript function in ruby. proc closer match: show = -> w { puts w } words.each(&show) this reads close ecmascript 6 version: const show = w => alert(w); words.foreach(show);

javascript - Get outer xml structure of xml file to a string with jquery -

i don't know if possible or not javascript/jquery. have number of xml files read , disply xpath, xml files structured html elements this: <?xml version="1.0" encoding="utf-8"?> <catalog> <outcome> <title>1.1</title> <section> <p>some text intro: <ul> <li>part of list</li> <li>part of list</li> </ul> </p> <p>more text</p> </section> </outcome> <outcome> <title>1.2</title> <section> <p>some text intro: <ul> <li>part of list</li> <li>part of list</li> </ul> </p> <p>more text</p> </section> </outcome> </catalog> i want display children , descendants of select element. using javascript, know how load xml , select element need, , know how loop through n

rest - PUT Request not happening at all in Fantom -

i having trouble put requests google sheets api. have code spreadsheet_inputer := webclient(`$google_sheet_uri_cells/r3c6?access_token=$accesstoken`) xml_test := xdoc{ xelem("entry") { addattr("xmlns","http://www.w3.org/2005/atom") addattr("xmlns:gs","http://schemas.google.com/spreadsheets/2006") xelem("id") { xtext("https://spreadsheets.google.com/feeds/cells/$spreadsheet_id/1/private/full/r3c6?access_token=$accesstoken"), }, xelem("link") { addattr("rel","edit");addattr("type","application/atom+xml");addattr("href","https://spreadsheets.google.com/feeds/cells/$spreadsheet_id/1/private/full/r3c6?access_token=$accesstoken"); }, xelem("gs:cell") { addattr("row","3");addattr("col","6");addattr("inputvalue","testing 1

PHP JSON Array - Group by the same value -

i'm thinking how group array objects same value. i have result mysql query: date starttime endtime 2014-12-01 08:00 12:00 2014-12-01 10:00 16:00 2014-12-02 12:00 18:00 2014-12-03 10:00 20:00 i have data in php variable called $data . is possible json array php: ? [ { "2014-12-01": [ { "starttime": "08:00", "endtime": "12:00" }, { "starttime": "10:00", "endtime": "16:00" } ] }, { "2014-12-02": [ { "starttime": "12:00", "endtime": "18:00" } ] }, { "2014-12-03": [ {

facebook - An open FBSession must be specified for calls to this endpoint in iOS -

i newbie in ios development. want upload image on facebook page.when image picked camera.for write code below got error "fbsession must specified calls endpoint". please give me solution it. my code -(ibaction)camerabuttonpressed:(id)sender { if (fbsession.activesession.isopen) { uiimage *uploadimage=[uiimage imagenamed:@"2.png"]; nsdictionary *params = [nsdictionary dictionarywithobjectsandkeys:accesstoken, @"caacedeose0cbaafij51qowoobfocobm1e3v1zbzcnybszayspbqcxpuzcdzc620brwyvchxgd96zaosmnyrza9tyd9teq9q1m67wkx0n66yjtiyzbxczkizb7t3tulo5rysnbzbfgwezcenmxrf7xobe6dq6450nmb0hrjzi8prt18wzafu878ghnryp5vw4up3jgzcwpwmumxdzaozaxvosyzbnkq6i", postingstring, @"message",uploadimage,@"source", nil]; fbrequest *requesttopost = [[fbrequest alloc] initwithsession:nil graphpath:@"/me/feed"

c# - property type of 'System.Data.Linq.Binary' which cannot be mapped to a primitive type -

i converting mvc 3 linq-to-sql application mvc 5 entity framework 6.1. using model first import tables. save binary images in ms sql server: used following: public emptyresult uploadvisionimage (ienumerable<httppostedfilebase> image, string desc) { var httppostedfilebases = image httppostedfilebase[] ?? image.toarray(); if (image == null || !httppostedfilebases.any()) return new emptyresult(); httppostedfilebase file = httppostedfilebases.first(); if (file.contentlength > 0) { var vi = new visionimage(); vi.description = desc; vi.filename = file.filename.split('\\').last(); vi.contenttype = file.contenttype; // save full size image. var tempimage = new byte[file.contentlength].toarray(); file.inputstream.read(tempimage, 0, file.contentlength); vi.imagedata = new binary(tempimage); // cr

c# - having trouble with getting file from drop box and saving on my server, please help me -

here java script code choose file drop box, when try save file server using c# able see file on server empty.when trying open file file giving error 'file corrupted'. using signalr. options = { // required. called when user selects item in chooser. success: function (files) { alert("here's file link: " + files[0].link) hub.server.servermethod(files[0].link, files[0].name); }, // optional. called when user closes dialog without selecting file // , not include parameters. cancel: function () { }, // optional. "preview" (default) preview link document sharing, // "direct" expiring link download contents of file. more // information link types, see link types below. linktype: "preview", // or "direct" // optional. value of false (default) limits selection single file, while // true enables multiple file selection. multiselect: false, // or true

python - How to change matplotlib axes so that that it does not display in scientific notation? -

Image
this question has answer here: how prevent numbers being changed exponential form in python matplotlib figure 3 answers how change matplotlib axes that not display in scientific notation? (i.e. displaying 626.70 ... 626.77 in case) tried changing x ticks doing ax.xaxis.set_ticks(np.arange(626.720, 626.727, 0.001)) , axes crammed on left hand side. thanks. x_formatter = matplotlib.ticker.scalarformatter(useoffset=false) x_formatter.set_scientific(false) ax.xaxis.set_major_formatter(x_formatter)

Android notification, vibrates but no sound -

i've read of other posts on subject , think code should sounding alarm, it's not. vibrate, no sound. suggestions on how convey sound ? another part of program able play ringtone problem seems specific routine. this in class extends service @override public int onstartcommand(intent intent, int flags, int startid) { uri sound = ringtonemanager.getdefaulturi(ringtonemanager.type_notification); if (sound == null) { log.i("receiver", "sound null"); } notificationmanager mynm = (notificationmanager)getsystemservice(notification_service); intent intentmain = new intent(this.getapplicationcontext(), mainactivity.class); pendingintent pintent = pendingintent.getactivity(this, 0, intentmain, 0); long[] pattern = {500,500,500,500,500,500,500,500,500}; notification mynote = new notification.builder(this) .setcontenttitle("notificationdemo") .setcontenttext("notificatindemo")

c# - how to get values from xml response -

how address , netmask values following xml response <?xml version="1.0" encoding="utf-8" ?> - <controls> <manualcalib>0</manualcalib> <maintmode>0</maintmode> <antenable>0</antenable> <chgbeamenable>1</chgbeamenable> <modemresponse>options show eth0_1 [eth0_1] address = 10.171.74.1 netmask = 255.255.255.0 rip_enabled = 0 [rmt:416] admin@telnet:::ffff:127.0.0.1;4709 ></modemresponse> </controls> the best solution find out exact structure of modemresponse string. write regular expression capture values need, or have more robust parsing logic. if don't know exact structure, write hacky code done in cases: var xd = xdocument.parse(xml); var modemresponse = xd.element("controls").element("modemresponse").value; string address = string.empty, netmask = string.empty; var to

jquery - scrolling event not triggering Javascript -

$(window).scroll(function() { if($(window).scrolltop() == $(document).height() - $(window).height()) { alert('d'); } }); is there wrong above code? wish infinite scrolling stuck in phase. no error in console wonder why. it's working in pure js, not in angularjs's controller.

How to run flash from android application -

i trying create application can read "swf" flash file not working in may app. is there jar/library should include in project run "swf" file smoothly. my code : webview wv = (webview) findviewbyid(r.id.wbmyview); websettings ws = wv.getsettings(); ws.setpluginstate(pluginstate.on); ws.setjavascriptenabled(true); ws.setallowfileaccess(true); wv.loadurl("http://www.myweb.com/myflash/file1.swf"); please 1 can me. try this webview.getsettings().setpluginsenabled(true); deprecated method try targeting min sdk version 8 (2.2) , setting webview.getsettings().setpluginstate(websettings.pluginstate.on); reference

sails.js - access controller object from a javascript file in sails js -

i new sails js. passing object controller view in sails js. can access object ejs (embedded javascript) file. need access object javascript file. should need use object in hidden field or there better way object javascript file. you have send data in hidden field. not possible access controller variables front-end. also, use sockets .

c - Read strings from console -

this question has answer here: how read string keyboard using c? getting segmentation fault passing in char * 5 answers i wanna write program array of pointers char store strings read console in it. string determined \n. ideas how can this? code mix of pseudocode far: char** arr; arr = malloc(sizeof(char*) * 5); arr = malloc(sizeof(char) * 10); while (no \n read) { // store string in array } i have no clue how this. #include <stdio.h> #include <stdlib.h> int main(){ int i; char **arr; arr = malloc(sizeof(char*) * 5);//for 5 string for(i=0;i<5;++i){ arr[i] = malloc(sizeof(char) * 10);//reserved storage space length 9 scanf("%9[^\n]%*c", arr[i]);//read until \n, , discard \n } printf("\n"); //check print , free for(i=0;i<5;++i){ puts(arr[i]); fre

kendo ui - KendoUI Multiselect Remove Multiple -

i using kendo ui multiselect: http://demos.kendoui.com/web/multiselect/events.html i have data: var data = [ { text: "shirt-black", value: "1" }, { text: "shirt-brown", value: "2" }, { text: "shirt-blue", value: "3" }, { text: "cap-green", value: "4" }, { text: "cap-red", value: "5" }, { text: "cap-white", value: "6" }, { text: "jacket-denim", value: "7" } ]; now want if select "shirt-brown" rest entries shirt i.e. "shirt-black" , "shirt-blue" should not appear in list means user should not able choose shirt of 2 colors. similarly, if "cap" of color has been chosen user should not able choose "cap" of other color. is there way achieve this? this not build-in functionality. can't use datasource filter() method