Posts

Showing posts from January, 2015

javascript - Swap tuple elements with destructuring assignments -

i thought swap elements of tuple in place using destructuring assignment follows: var = [1,2]; [a[1], a[0]] = a; however, yields [1, 1] . babel compiles as a[1] = a[0]; a[0] = a[1]; i have thought should compiled as let tmp0 = a[0]; let tmp1 = a[1]; a[0] = tmp1; a[1] = tmp0; traceur behaves identically babel. guess specified behavior? i want swap 2 elements in place . way... let tmp = a[0]; a[0] = a[1]; a[1] = tmp; but thought above destructuring assignment supposed let me avoid having do. i'm capable of reversing order of 2 elements of array, not question. simple a.push(a.shift()) , meets criteria of swapping being in-place. i'm interested here in why destructuring doesn't work way seems ought to. i'd use function this let swap = ([a,b]) => [b,a]; swap([1,2]); // => [2,1]

php - Delete a row from MySql -

i attempting add button html table allow user delete specific row when clicked. i have following far not understand why corresponding database table row not being deleted when click borrar (delete) button. what part missing? <?php { ?> <table width="263" border="1"> <tr> <td><?php echo $row_recordset1['name']; ?></td> <td><form id="form1" name="form1" method="post" action=""> <input type="submit" name="borrar" id="borrar" value="borrar" /> </form></td> </tr> </table> <?php } while ($row_recordset1 = mysql_fetch_assoc($recordset1)); ?> <?php if(isset($_post['borrar'])){ if ((isset($_post['id'])) && ($_post['id'] != "")) { $deletesql = sprintf("delete carrito id=%s",

javascript - How to edit MDN sidebar contents? -

i think javascript contents of mdn 1 of best out there. it's easy contribute click edit icon of page(for example: https://developer.mozilla.org/en-us/docs/web/javascript ), type code/text , save changes. but there know how edit sidebar contents - {{jssidebar}}? thanks.

How to draw 3d object javascript -

i making simple javascript program draws rotated prism. have vectors contain x, y , z coordinates of every point , point connected. problem having cannot find perfect way compare dots in 2d. when figure rotates, has little, still visible, defects , looks lines become longer , shorter. paste important parts of code. var canvas = document.getelementbyid("canvas-id"); canvas.width = 1200; canvas.height = 500; var ctx = canvas.getcontext("2d"); var dx=[],dy=[],dz=[],dh=[],dgo=[],h=10,ang=10*math.pi/360; var pause=false; for(var i=0;i<h/2;i++){ dx[i]=math.cos(i/h*4*math.pi+math.pi/4)*70.71; dy[i]=math.sin(i/h*4*math.pi+math.pi/4)*70.71; console.log(i/h*2*360); dz[i]=150; dh[i]=3; dgo[i]=[]; dgo[i][0]=i+h/2; dgo[i][1]=i+1; dgo[i][2]=i-1; dx[i+h/2]=math.cos(i/h*4*math.pi+math.pi/4)*70.71; dy[i+h/2]=math.sin(i/h*4*math.pi+math.pi/4)*70.71; dz[i+h/2]=250; dh[i+h/2]=3; dgo[i+h/2]=[]; dgo[i+h/2][0]=i;

.net - How do you enable array extensions? -

i can create new vs2013 vb.net project following code, compiles , runs fine: dim ii(12) integer if ii.contains(5) ... end if i have converted vs2008 vb.net project vs2013. when add code array extensions .contains , .tolist , causes compile error "'contains' [or 'tolist'] not member of 'system.array'". the "imports" , references identical between projects, , don't see relevant difference in project properties. there way enable these array extensions? you need .net 3.5+, , reference system.linq extension method. ( imports not necessary.) you when compare both projects, don't see differences in "imports" , references. perhaps, difference working project implicitly importing system.linq , , that's why don't notice difference. go working project, , go my project . go references section, , have under imported namespaces . you'll find system.linq checked in working project, not in project

android - Ellipsize not working (for single line) -

i'm trying ellipsize work single line of text inside textview. i've tried workarounds (e.g. scrollhorizontally, singleline, lines, etc.) below previous questions, nothing seems happen. code (tested on htc 1 m8 (5.0.1)): <relativelayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="48dp" android:background="@drawable/file_tile_background" > <imageview android:id="@+id/file_tile_imageview" android:layout_width="wrap_content" android:layout_height="match_parent" android:layout_marginleft="16dp" android:layout_marginright="24dp" android:src="@drawable/ic_insert_drive_file_black" android:contentdescription="@string/file_tile_imageview_description" /> <textview android:id="@+id/file_tile_textview" android:layout_width="match_parent&

r - How can I use multiple conditionals and match to create a new variable? -

i have following data name <- c("kobe bryant", "kobe bryant", "kobe bryant", "kobe bryant", "kobe bryant", "kobe bryant", "lebron james", "lebron james", "lebron james", "lebron james", "kevin durant", "kevin durant", "kevin durant", "kevin durant", "kevin durant") date <- as.date(c("2015-05-14", "2015-05-15", "2015-05-19", "2015-05-21", "2015-05-24", "2015-05-28", "2015-05-14", "2015-05-20", "2015-05-21", "2015-05-23", "2015-05-22", "2015-05-24", "2015-05-28", "2015-06-02", ""2015-06-04")) df <- data.frame c(name, date) desired_output <- c(1, 1, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0) df

Excel vba -- Object required error at Sub line -

so getting error @ beginning of code, error didn't use last time opened , edited vba code. ideas? here part of it. when try step through code, error: "object required" , sub line (first line) highlighted. ideas how can fix this? sub managercashflow() '---------------------------declare variables--------------------------- '------define object names------ 'dim integer 'dim c integer dim aum_cash_projections_folder_pathname string dim aum_cash_projections_folder_yearmonth_pathname string dim aum_cash_projections_filename_date string dim aumcshf_wb workbook dim mngrcshf_wb workbook 'dim cshf_lr integer 'dim pe_r integer 'dim lstmanager_r integer '------set/call objects destination------ 'worksheets 'manager cashflow set mngrcshf_wb = thisworkbook set mcf_current_ws = mngrcshf_wb.sheets("sheet1") 'aum cash projections set aum_cash_projections_folder_pathna

asp.net - Do I always have to "wait" for page loads when using selenium on non-ajax pages? -

i'm writing bdd tests using cucumber, selenium , xunit legacy asp.net application. way pages designed, every "click" leads new page being fetched server. if have automate tests particular page, should have line similar following after every "click"? webdriverwait wait = new webdriverwait(driver, timespan.fromseconds(timeout)); wait.until(...); //wait until page true i'm not sure if selenium wait implicitly page loads without explicitly having state time. recommended pattern handle scenario? it's cumbersome have idea of "some element" can put in until method , leads brittle tests. asp.net pages littered lots of dynamic controls , whole slew of page refreshes makes test code quite unreadable. my proposed solution: write extension method waiting implicitly , takes parameter of element-id wait on. i'm refactoring above problem more manageable place. still have wait explicitly performed. there no way eliminate it? selenium have obv

Using buildbot slaves -

i saw waterfall display buildbot have builds , tests categorized device types. how type of display. buildbot automatically generate different columns different slaves? right using 1 slave , handling scheduling of tests python script. possible use buildbot slaves achieve parallel tests? in waterfall page buildbot generates columns per builder. can add , configure builders in master.cfg file. have @ this more info. you can achive parallel builds adding multiple builders slave, , in slave configuration increasing max_builds parameter like` config['slaves'].append(buildslave('my-slave', 'password', max_builds=5)) this allow run 5 builds in parallel example.

Populate part of an HTML form with data from php database -

i want create html form connects table have in database in phpmyadmin. have 3 columns: name, decision, time - along submit button. want pull name phpmyadmin table , populate in form , have them select decision drop down menu, , time auto update time when hit submit. can figure out how have drop down menu, not prepopulate name field or auto update time field. if can part of great. have attached script have here: <html> <head> <title>untitled document</title> <meta http-equiv="content-type" content="text/html; charset=iso-8859-1"> </head> <body> <table> <tr> <td align="center">linker tracker</td> </tr> <tr> <td> <table border="1"> <?php include "db.inc.php";//database connection $result = mysqli_query("select * tester"); while ($row=mysqli_fetch_array($result))?> <form actio

c# - Returning 2 Json lists and accessing the data? -

i'm returning 2 lists so: return json(new { firstlist = alllocations, secondlist = openinghours }, jsonrequestbehavior.allowget); but when try , access data being returned, getting no values success: function (data) { (index = 0; index < data.length; ++index) { console.log(data[index].firstlist.locationname); any great i assume you're trying concatenate 2 different json objects one? if that's case, need deserialize individual objects first, combine them new json object. return jsonconvert.serializeobject(new [] {jsonconvert.deserializeobject(firstlist), jsonconvert.deserializeobject(secondlist)}) this should point in right direction.

Did Android 5.0 change the result of ACTION_IMAGE_CAPTURE intent? -

intent captureimageintent = new intent(mediastore.action_image_capture); startactivityforresult(captureimageintent, take_first_image_request_code); in onactivityresult(int requestcode, int resultcode, intent data) string mediakey = "data"; case take_first_image_request_code: mimageuri1 = data.getdata(); if (mimageuri1 != null) { mimagebitmap1 = (bitmap) data.getextras().get(mediakey); postcaptureimg1(); } else { logd(tag, "mimageuri1 == null"); } break; the code works fine on android version < 5.0. however, on 5.0, no longer works, mimageuri1 null. anything changed in android 5.0 causes this? the code works fine on android version < 5.0 no, not. happened work in limited testing because particular camera app used happened return uri (presumably, value supplied via extra_output ). however, there nothing in the documentation action_image_capture requires camera apps return uri . there

c# - How to register types in class libraries with vnext? -

is there way register types (i.e. repositories) mvc 6 (vnext) application within dnx class libraries? don't want call addtransient<,>() within startup class hundreds of times. n-tier application seems not best approach. basic ioc vnext use doesn't have scanning abilities/batch registration. in case should use of "big" ioc containers ninject, unity, structruremap...

python - Insert image on current plot without deformation -

Image
in matplotlib, appropriate way plot image native aspect ratio, , optionally native size, inside existing axes @ specific data location? for instance: from matplotlib.pyplot import plot matplotlib.image import imread matplotlib.cbook import get_sample_data plot([50,60],[1000,2000]) im = imread(get_sample_data("grace_hopper.png", asfileobj=false)) now want plot im instance centered @ coordinates (57,1200) scaling or max height , without deformation. i imagine mix between matplotlib.offsetbox.anchoredoffsetbox , matplotlib.offsetbox.offsetimage should trick, i'm not familiar these classes. as expected, solution in matplotlib.offsetbox module: from matplotlib.pyplot import plot, gca, show matplotlib.image import imread matplotlib.cbook import get_sample_data matplotlib.offsetbox import offsetimage, annotationbbox plot([50,60],[1000,2000]) im = imread(get_sample_data("grace_hopper.png", asfileobj=false)) oi = offsetimage(im, zoom=0.

regex - Using RegExp in express routes -

i'm trying write middleware, (e.g make logs) each /api/* request. i wrote follow middleware, it's not working /api/me var app = require('express'); app.all(/\/api/, function(req, res, next) { console.log('hello'); }); what's wrong? make sure middleware called before /api/ routes defined, , call next() , otherwise request hang. var app = require('express'); app.use('/api/', function(req, res, next) { console.log('hello'); next(); });

embedded - Hex file generation without compilation -

i heard of use-case / tool in hex file (executable can flashed embedded memory area) can generated without compilation or linking. i amazed such thing possible. experts in area can tell, tool , how ? i know use-case - post-build configuration variant. hex file : some basics : http://embeddedfun.blogspot.com/2011/07/anatomy-of-hex-file.html thanks, msam a hex file, intel hex format isn't "executable" such. it's plain-text format describing binary data. typically used data written embedded device. often, @ least part of data executed. format used describe configuration data. you can write hex file text editor. write meaningful program using text editor not advisable... there tools, the intelhex python package allows manipulate hex files @ higher level, instance, merge multiple hex files 1 (e.g. bootloader, application , configuration hex files single hex file). or replace placeholder unique id/serial number whatever before writing hex file o

c++ - What does the const keyword do in an operator definition? -

i don't understand const keyword used in front of return type , after parameter list of operator definition. taken example book. const char& operator [] (int num) const { if (num < getlength()) return buffer[num]; } the c++ const keyword means "something cannot change, or cannot delegate operations change onto other entities." refers specific variable: either arbitrary variable declaration, or implicitly this in member function. the const before function name part of return type: const char& this reference const char , meaning not possible assign new value it: foo[2] = 'q'; // error the const @ end of function definition means "this function cannot change this object , cannot call non-const functions on any object." in other words, invoking function cannot change any state. const char& operator [] (int num) const { this->modifysomething(); // error buffer.modifysomething(); // error r

javascript - JSDoc - proper way to create custom type in a separated file -

i want create custom type in order example code completion, in separated file named custom-types.js , in way found in rzslider angular repository , in file rzslider.js file @ bottom: /** * * @name author * @property {number} id * @property {string} name * @property {string} surname */ is proper way document own types? it's important should in separated file, pollute code little possible jsdoc comments. using jsdoc 3 plugin bounded intellij 14, thank in advance helping me. about documenting angular codes jsdoc, have answered similar question. please refer here .

django - How can I set a custom Template for djangocms-blog? -

Image
i have djangocms based website , have app small blog section. now, have integrate djangocms-blog in website, when trying see post, template (a custom template made me) not rendered , post (made blog admin) thrown on page. can me out issue ? additional info in order me out ? my template looks this: {% extends "base.html" %} {% load cms_tags %} {% block title %}{% page_attribute "page_title" %}{% endblock title %} {% block content %} <div class="spacer"></div> <div class="page-header page-header-blog-post-1 white"> <div class="page-header-container container"> <div class="page-header-content"> <h1 class="heading">blog</h1> </div> </div> </div> <div class="blog-container blog-single container"> <div class="row"> <div c

python - SetTextColour doesn't work while SetBackgroundColour works -

i have grid in wxpython , i'm itarating on rows , want rows qualified condition colored in red. when i'm doing: attr = gridlib.gridcellattr() attr.setbackgroundcolour('#ff0000') grid.setrowattr(i, attr) it works , row gets red background... if do: attr = gridlib.gridcellattr() attr.settextcolour('#ff0000') grid.setrowattr(i, attr) it doesn't work. nothing happen. i row index. i want text red not background. why doesn't work? the following minimal example works me set colour of text in row red, import wx import wx.grid gridlib class myform(wx.frame): def __init__(self): wx.frame.__init__(self, parent=none, title="grid") panel = wx.panel(self) self.grid = gridlib.grid(panel) self.grid.creategrid(3, 3) sizer = wx.boxsizer(wx.vertical) sizer.add(self.grid, 1, wx.expand) panel.setsizer(sizer) def set_row_colour(self, row): attr = gridlib.gri

python - Using django GeoIP and MaxMind database -

i'm trying setup geoip in django identify source of connection (to tailor content different countries) running problem. first execute: from django.contrib.gis import geoip geo = geoip.geoip('path maxmind db') then geo.country('www.google.com') returns you'd expect. other popular websites work fine. however when try on own client ip empty record. example: geo.country('127.6.89.129') returns {'country_name': none, 'country': none} what missing here? maxmind database cover popular sites can't used if want identify source of connection? i'm using browser locale settings identify language unfortunately need geo-location tailor of content independently of language. your ip forwarded def foo(request): g = geoip() country = g.country(get_client_ip(request)) country_code = country['country_code'] def get_client_ip(request): x_forwarded_for = request.meta.get('http_x_forwarded_f

python - SQL Alchemy Query with Eagerly Loaded Relationships? -

i'm having trouble using sa's eager relationship loading within query. i have 2 tables declared so: class score(base): __tablename__ = 'score' school = relationship("school", backref='score') schoolkey = column('schoolkey', integer, primary_key=true) class school(base): __tablename__ = 'school' schoolkey = deferred(column('schoolkey', integer, primary_key=true)) schoolname = column('schoolname', string) schooldistrict = deferred(column('schooldistrict', string), group = 'district') schooldistrictid = deferred(column('schooldistrictid', integer), group = 'district') i want query score table filter condition coming school table concisely possible. have relationship eagerly loaded. right when query cannot work: session.query(score).filter(school.schoolname == 'randomname') (this crashes computer) anyone have idea how work? cont

c++ - How to view the exact command cmake_automoc is running? -

i have issue automoc in moc fails parse error @ "boost_join" . tried "least evil" hack outlined here , no avail (speficially, added set(cmake_automoc_moc_options "-dboost_tt_has_operator_hpp_included") cmakelists.txt ). further, when try moc offending file myself, seems work. i'd know exact command cmake running can continue debugging this. if ninja -v , (equivalent of make verbose=1 ), like: cd projdir && cmake -e cmake_automoc projdir/cmakefiles/proj_automoc.dir/ debug if run myself, sure enough same parse error @ "boost_join" message, still don't know how cmake calling moc . cmake --debug-output -e cmake_automoc ... throws usage error. once have done cmake configure step , generated build scripts (eithe vs solution files or unix makefiles), can use cmake build option described in manual cmake(1) . if using makefiles, can use: make verbose=1 for visual studio, see there option produce more 'verb

bash - Why would a correct shell script give a wrapped/truncated/corrupted error message? -

i have shell script command seems should work, instead fails odd wrapped/truncated/corrupted error message. example: $ ls -l myfile -rw-r----- 1 me me 0 aug 7 12:36 myfile $ cat myscript ls -l myfile $ bash myscript : no such file or directory the file exist, if didn't, kind of error message get: $ ls -l idontexist ls: cannot access idontexist: no such file or directory notice how includes tool name ls , message string , filename while mine not. here's if try use mysql instead. error message looks it's been wrapped, , starts quote: command: mysql -h myhost.example.com expected: error 2005 (hy000): unknown mysql server host 'myhost.example.com' (0) actual: ' (0) 2005 (hy000): unknown mysql server host 'myhost.example.com and here's trivial ssh command should work, or @ least give normal error message, instead wrapped start colon , ends strange clobbering: command: ssh myhost expected: ssh: not resolve hostname myhost: name or se

php - Model store with different column than primaryKey -

i have laravel/octobercms model interface exchangemodel. it's 1 sided relationship exchangemodel. stores in customer database table via exchangemodel.id. i'd store exchangemodel.currencyiso, 3 letter country code. what need setup in relation laravel store via other field try define via otherkey or key instead of primarykey(id)? <?php namespace phuntime\client\models; use model; /** * customer model */ class customer extends model { /** * @var string database table used model. */ public $table = 'customer'; public $primarykey = 'customernumber'; /** * @var array relations */ public $belongsto = ['currency' => ['phuntime\exchangerate\models\exchangemodel', 'key' => 'currencyiso',// eur,usd,yen 'otherkey' => 'currencyiso' ]]; } clarification of structure: - customer - id - name - currency(varchar(3)) <-- rela

c# - How to change the greeting message on ASP.Net from UserName to First Name or any other field? -

how can change below mentioned code show: hello "first name" instead of hello "username". i have created custom fields inside identity user table such "firstname","middlename","lastname". below mentioned code inside site.master. <li> <a runat="server" href="~/account/manage" title="manage account"> hello, <%: context.user.identity.getusername() %> ! </a> </li> i appreciate efforts in reaching solution problem. first add microsoft.aspnet.identity.owin namespace in web.config <configuration> <namespaces> <!-- other namespaces --> <add namespace="microsoft.aspnet.identity.owin"/> </namespaces> </configuration> then replace code with: <li> <a runat="server" href="~/account/manage" title="manage account"> hello, <%: httpconte

android - Using Clock-Widget in a Fragment possible? -

Image
i have fragment in mainactivity, displays digital clock. works: shows current system time. looks rather simple. before start trying style clock wanted ask, if there way, use systems digital-clock widget? screenshot of widget, i'd use in fragment: fragmentclock.java: public class fragmentclock extends fragment { @override public view oncreateview(layoutinflater inflater, viewgroup container, bundle savedinstancestate) { super.oncreate(savedinstancestate); view view = inflater.inflate(r.layout.fragment_clock, container, false); return view; } } fragment_clock.xml: <?xml version="1.0" encoding="utf-8"?> <linearlayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/linearlayoutclockdisplay" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="v

Spring Validation: Null ModelAndView returned to DispatcherServlet -

i pretty sure problem has not been described here before. pretty sure stupid mistake on part. the problem in brief: i have created user login form. when user login information either correct or fails @ service layer, works when user input validation fails, following message spring: "null modelandview returned dispatcherservlet name 'assessmentadmin': assuming handleradapter completed request handling" i 400 error on web page:"the request sent client syntactically incorrect." it seems me that: when login info correct, model not null. can see logs (see below). when user input not meet validation requirements, aop calls validation made controller method not called (again, see logs). jsps : login form: <%@ page contenttype="text/html; charset=utf-8"%> <%@taglib uri="http://www.springframework.org/tags" prefix="spring"%> <%@taglib uri="http://www.springframework.org/tags/form" pre

java - SingleThreadExecutor and ThreadFactory -

am right every time, when performing several submit operations: executorservice executor = executors.newsinglethreadexecutor( new mythreadfactory("someexecutor")); executor.submit(...); executor.submit(...); executor.submit(...); method java.util.concurrent.threadfactory#newthread executes once? or executes every time , creates new thread per submit call? it reuses same thread everytime. that beauty of thread pools: avoid cost of creating new thread reducing per-task invocation overhead. you can read more how threads created in threadpoolexecutor documentation.

tsql - “Incorrect syntax” using a table-valued function in SELECT clause of T-SQL query -

i have sql 2008 database compatibility level of 80 (i.e. sql 2000). have been able use cross apply functions, when add table-valued function, not allow me proceed. i have member ids following format: ebs_322002_0397204_e i need second piece of dynamically, since first piece may not been 3 characters long; otherwise, use substring function , call day. this split function: alter function [dbo].[fnsplit] (@sep char(1),@string varchar(8000)) returns table --with schemabinding return ( pieces(pn, [start], [stop]) ( select 1, 1, charindex(@sep, @string) union select pn + 1, [stop] + 1, charindex(@sep, @string, [stop] + 1) pieces [stop] > 0 ) select pn, substring(@string, [start], case when [stop] > 0 [stop]-[start] else len(@string) end) string pieces ) first attempt: with members ( select distinct memberid mytable ) select * members m cross apply dbo.fnsplit('_',m.memberid) b produced error: msg 102,

android - Do I have to close the Cursor object whenever I call rawQuery()? -

i'm planning use android sqlite first time. cursor c = db.rawquery("some select command here", null); // jobs cursor.. c = db.rawquery("another select command here", null); // jobs cursor.. c.close(); db.close(); c = null; db = null; as can see, i'm trying call rawquery() method several times. do have close cursor before call rawquery() method again ? do have assign null variables after closing cursor , database above? do have close cursor before call rawquery() method again? close cursor whenever finished reading it. release resources opened cursor, yes, should close first cursor before second query. do have assign null variables after closing cursor , database above? it depends on scope of variables. if code looks this... class foo { void dosomething() { sqlitedatabase db = ... cursor c = db.rawquery... // other stuff c.close(); db.close(); } } ... there's no p

winjs - Nested ListView or Nested Repeater -

i trying created nested repeater or nested list view using winjs 4.0, unable figure out how bind data source of inner listview/repeater. here sample of trying (note control repeater, prefer): html: <div id="mylist" data-win-control="winjs.ui.listview"> <span data-win-bind="innertext: title"></span> <div data-win-control="winjs.ui.listview"> <span data-win-bind="innertext: name"></span> </div> </div> js: var mylist = element.queryselector('#mylist).wincontrol; var mydata = [ { title: "line 1", items: [ {name: "item 1.1"}, {name: "item 1.2"} ] }, { title: "line 2", items: [ {name: "item 2.1"}, {name: "item 2.2"} ] } ];

c# - Return string from Main() with CSharpCodeProvider -

i'm trying compile c# code(nothing complex, main() ) using csharpcodeprovider. code returns string, can't understand how pass value function. possible? public string execute(list<string> code, list<string> _referencedassemblies) { compilerparameters cp = new compilerparameters(); (int = 0; < _referencedassemblies.count; i++) { cp.referencedassemblies.add(_referencedassemblies[i]); } stringbuilder sb = new stringbuilder(); (int = 0; < code.count; i++) { sb.append(code[i]); } csharpcodeprovider provider = new csharpcodeprovider(); compilerresults result = provider.compileassemblyfromsource(cp, sb.tostring());

ruby - Can't find mechanize gem error require -

so i've been using mechanize gem fine on osx machine when i'm trying use on win10 machine i've run issues. can't find mechanize gem reason. c:/ruby21-x64/lib/ruby/2.1.0/rubygems/core_ext/kernel_require.rb:55:in require': cannot load such file -- mechanize (loaderror) are able use other gems on win10 machine without error? it looks error nokogiri not mechanize. version of nokogiri have installed? i try updating gems gem update --system

google api - Android Studio: ImageManager get image from web -

when use code covers imageloadedlistener red , says not recognize such method. first time using imagemager if tell me wrong , may give me sample code, can check usage of imagemanager. there way safe image on device , string or int(for r.id.drawable) image in future references? imageview iv; setcontentview(r.layout.activity_main); iv = (imageview)findviewbyid(r.id.imageview); imagemanager imagemanager; uri uri; try { uri = new uri("http://suburban-k9.com/wp-content/uploads/2011/03/small-dog-sydrome-300x300.jpg"); } catch (urisyntaxexception e) { e.printstacktrace(); uri=null; } context context = getapplication().getapplicationcontext(); imagemanager = imagemanager.create(context); log.v("app", "loadimagefromgoogle manager created image #" + id); imagemanager.loadimage(new onimageloadedlistener() { @override

c# - Clear Back Stack Navigation Windows 10 -

i want clear navigation stack history ... i tried use this.navigationservice.removebackentry(); didn't work. how in windows 10? if you're in page code behind, have tried doing: this.frame.backstack.clear(); or if you're somewhere else (like viewmodel), have tried: var frame = window.current.content frame; frame.backstack.clear();

Obtain all of the columns from sql server using php in one command? -

is there way data sql server table. trying acheive have sql table 5 columns. have x amount of entries, of them have x amount. example 5 columns have a,b,c,d,e. of them have 10 entries or 20 entries. now know how run query 1 of them $servername = "server"; //servername\instancename $connectioninfo = array( "database"=>"db", "uid"=>"u/n", "pwd"=>"pass"); $conn = sqlsrv_connect( $servername, $connectioninfo); $sql = "select table"; $query = sqlsrv_query($conn, $sql); if ($query === false){ echo "could not link sql server"; } $i = 0; while ($row = sqlsrv_fetch_array($query)) { $a[$i] = "$row[a]"; $i++; } sqlsrv_free_stmt($query); sqlsrv_close( $conn ); so in code values of column , stored in $a array of length $i. question can (and if yes how), column @ once without copying code. k

Mapping a Collection without using DBRef (Spring Data MongoDB) -

i've been reading lot use of dbref collection mapping in spring data/mongodb discouraged. so, how can implement mapping stores array of objectid taken objects inside students collection? assuming have following pojo model: @document (collection = "courses") public class course { @id private string id; private string name; private list<student> students = new linkedlist<student>(); //.. constructors, getters , setters .. } public interface courserepository extends mongorepository<course, string> { } the result should this: courses { _id : objectid("foo"), _class: "model.course", name: "mongodb dummies", students: [ objectid("foo2"), objectid("foo3"), ... ] } instead of this: courses { _id : objectid("foo"), _class: "model.course", name: "mongodb dummies", students: [ dbref("student&quo

c++ - reverse linked list using recursion -

i trying reverse linked list using recursion. made reverse() function reverse list. created linked list in main() , defined print() method. don't know mistake making. please me correct it. code snippets given below. struct node { int data; struct node *next; }*head; void reverse(node **firstnode,node *n) { if(n==null) { head=n; return; } reverse(&head,n->next); struct node *q=n->next; n->next=q; q->next=null; } void main() { ...... head=first; reverse(&first,first); print(head); } it may not address question directly. however, mentioned c++11 in tags. so, take @ std::forward_list . standard container based on single linked-list.

Delphi Undeclared identifier ansistring -

i use delphi xe8. i error when compile programm on step cyrstr = type ansistring(1251) "undeclared identifier ansistring" what library need use? you compiling target doesn't support ansistring. mobile compilers don't support ansistring while desktop compilers do.

sql - Split string by space and character as delimiter in Oracle with regexp_substr -

i'm trying split string regexp_subtr, can't make work. so, first, have query select regexp_substr('helloworld - test!' ,'[[:space:]]-[[:space:]]') dual which nicely extracts delimiter - blank - blank but then, when try split string option, doesn't work. select regexp_substr('helloworld - test!' ,'[^[[:space:]]-[[:space:]]]+')from dual the query returns nothing. help appreciated! thanks sql fiddle oracle 11g r2 schema setup : create table test( str ) select 'hello world - test-test! - test' dual union select 'hello world2 - test2 - test-test2' dual; query 1 : select str, column_value occurrence, regexp_substr( str ,'(.*?)([[:space:]]-[[:space:]]|$)', 1, column_value, null, 1 ) split_value test, table( cast( multiset( select level dual connect level < regexp_count( str ,'(.*?)([[:space:]

python - Dataframe reindex on a column -

this dataframe ticker date datevalue 549 rcg 2015-01-02 10 692 rcg 2015-01-05 8 i want have have reindex foo = foo.reindex(index=['2015-01-01', '2015-01-02']) ticker date datevalue rcg 2015-01-01 n/a rcg 2015-01-02 10 instead get ticker date datevalue 2015-01-01 nan nan nan 2015-01-02 nan nan nan you can set index: df = pd.dataframe({'ticker': ['rcg','rcg'], 'date': ['2015-01-02','2015-01-05'], 'datevalue':[10,8]}, index=[549, 692]) df.set_index('date', inplace=true) print(df) datevalue ticker date 2015-01-02 10 rcg 2015-01-05 8 rcg is expected result ?

java - Eclipse Luna, m2eclipse: empty dependency when dependency is a workspace project -

i working eclipse luna. i have dynamic web project workspace: project-web. project depends on project workspace: project-lib. so scenario: project-web[:war] ---depends on--> project-lib[:jar] i have checked "resolve dependences workspace projects" option properties -> maven web project. when run "mvn clean package" project-web maven creates war file target directory have issue. if explode war file, find empty folder called "project-lib" web-inf/lib directory. since library empty java exceptions on tomcat startup. how create war project-web correctly? thanks in advance. enrico

events - ServerEventsClient concurrent model in ServiceStack -

i use servereventsclient listen server events. use jsonserviceclient, available through property serviceclient of servereventsclient class, send messages server. while serviceclient waits response server (which may take time) whether servereventsclient receive events server , send heartbeats? yes, servereventsclient uses separate long-lived asynchronous connection server events /event-stream can concurrently use serviceclient perform additional requests.

git - What are the recipients of Jenkins Email Extension Plugin email notifications? -

when adding trigger, possible select developers culprits suspects causing build begin failing and more options. when using git scm, how recipient lists exactly determined? there explanation @ email-ext plugin page: developers : send email checked in code last build. plugin generate email address based on committer's id , appended "default email suffix" jenkins's global configuration page. instance, if change committed id "first.last", , default email suffix "@somewhere.com", email sent "first.last@somewhere.com" culprits : sends email list of users committed change since last non-broken build till now. list @ least include people made changes in build, if previous build failure includes culprit list there. i guess algorithm determine culprint's email same developer.

javascript - why js can Improved code efficiency use function? -

when use mongodb in js,i found code's efficiency different between example1(122ms) , example2(390ms),example1 put code in function() example2 not. why? example1: var timepage2 = function(){ var start = (new date()).gettime(); var page1; for(var i= 0; < 10000; i++){ page1 = db.test.find({"n":{"$gt":i*100}}).limit(100); } var end = (new date()).gettime(); var timediff = end - start; print("update took2:" + timediff+"ms"); } timepage2() example2: //var timepage2 = function(){ var start = (new date()).gettime(); var page1; for(var i= 0; < 10000; i++){ page1 = db.test.find({"n":{"$gt":i*100}}).limit(100); } var end = (new date()).gettime(); var timediff = end - start; print("update took2:" + timediff+"ms"); // } // timepage2()

visual studio 2015 - Update Build Controller/Agents to build C# 6 /.NET 4.6 application -

here's scene: we use visual studio online , on-premise build server in our company network tfs 2013 build our solution after gated check-ins , releases. now upgraded visual studio 2013 visual studio 2015 enterprise , upgraded new .net version. eager make use of new features of c# 6 after first check-in experienced build failed. (sorry no image here have lack of reputation) exception message: msbuild error 1 has ended build. can find more specific information cause of error in above messages. (type buildprocessterminateexception) exception stack trace: @ system.activities.statements.throw.execute(codeactivitycontext context) @ system.activities.codeactivity.internalexecute(activityinstance instance, activityexecutor executor, bookmarkmanager bookmarkmanager) @ system.activities.runtime.activityexecutor.executeactivityworkitem.executebody(activityexecutor executor, bookmarkmanager bookmarkmanager, location resultlocation) applicationmanager.cs (33,

c++ - OpenCV image conversion goes wrong -

i have algorithm stuff. among them, there conversion works fine if i'm working on cv_8uc3 image goes wrong if file type c_16uc3 . code: //new image created mat3w img(100,100,vec3w(1000,0,0)); //image conversion - error! cv::mat inputsource; //saving image here work img.convertto(inputsource, cv_64fc3); //saving image here not work -> black image the problem cv_16uc3 image's processing result image of right dimensions black. problem in conversion because saving image right before give legit 1 while saving right after give white one. edit: i made changes: cut off useless code , added inputsource declaration. now, while trying stuff, arrived @ conclusion either haven't understood cv types, or strange happening. thought number in type indicating number of bits per channel. so, in head, cv_16uc3 3 channel 16bits per channel. idea strengthened fact image save during tests