Posts

Showing posts from February, 2010

javascript - When I click a link, click a link on another page? -

really struggling think of solution problem. have thought anchor links might (using #example on end of link scroll position on page) not sure how best implement them. so on homepage of site have list of links, correlate tabs on page. the links on homepage: (what e-bate, rebates etc.) links when click 1 of tabs on other page, activates script shows div below: tabs this how tabs shown: html: <div class="page-links"> <ul> <li><a href="#" onclick="return false;" class="whatebate">what e-bate?</a></li> <li><a href="#" onclick="return false;" class="whatrebate">what rebates?</a></li> <li><a href="#" onclick="return false;" class="ebatefeat">e-bate features</a></li> <li><a href="#" onclick="return false;" class="howebate">how e-bate works</a></li...

java - Rendering xml file in Android Studio -

this xml code in android studio. facing rendering problem in xml file. <?xml version="1.0" encoding="utf-8"?> <relativelayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" android:paddingbottom="@dimen/activity_vertical_margin" android:paddingleft="@dimen/activity_horizontal_margin" android:paddingright="@dimen/activity_horizontal_margin" android:paddingtop="@dimen/activity_vertical_margin" app:layout_behavior="@string/appbar_scrolling_view_behavior" tools:context="com.example.admin.myapp1.mainactivity1" tools:showin="@layout/activity_main1"> <textview android:layout_width="wrap_conten...

javascript - How to auto select users state in data-bind options select in Knockout -

i have drop down of states , id: <select data-bind="options: states, optionstext: 'text', value: selectedstate"></select> javascript function viewmodel() { this.states = ko.observablearray(states); this.selectedstate = ko.observable(usersstate); }; var states = [ { value: 10, text: "california" }, { value: 3, text: "new york" }, { value: 9, text: "florida" } ]; ko.applybindings(new viewmodel()); usersstate variable may or maynot contain users info. default null. if user has logged in should populate users selected state. example, users has logged in , select state 9 florida. so declared usersstate = 9; @ top. what trying auto select florida in drop down based on users info. not sure why not selecting it. here fiddle: http://jsfiddle.net/neosketo/sw9dzjk1/2/ the selectedstate refers state object . initial selection number . you'll have find state object co...

The wiki editor generates a link "Template:Multiple Image" (to a page that does not exist) when I try to use the multiple image template -

i editing wiki , want insert multiple images {{multiple image}} template . here code: {{multiple image | footer = foo | image1 = foo1.png | caption1 = foo 1 | image2 = foo2.jpg | caption2 = foo 2 }} however code generates link template:multiple image page not exist. i read wiki documentation , looked answer on web , on stackoverflow find nothing bug. doing wrong ?

python 2.7 - Kivy- Packaging to Windows fails: "No module named ConfigParser" -

i trying package kivy application windows, , after following instructions in kivy website example touchtracer app, importerror: no module named configparser message when trying open .exe file in dist folder. i running python 2.7.11 , kivy 1.9.1. also, while executing command python -m pyinstaller... , output includes line says: 12612 warning: attempted add python module twice different upper/lowercases: configparser below traceback printed when attempting open .exe file. traceback (most recent call last): file "c:\users\acasall1\desktop\touchapp\demo\touchtracer\main.py", line 22, in <module> import kivy file "c:\users\acasall1\appdata\local\temp\pip-build-21skkd\pyinstaller\pyins taller\loader\pyimod03_importers.py", line 389, in load_module file "c:\python27\lib\site-packages\kivy\__init__.py", line 306, in <module> kivy.config import config file "c:\users\acasall1\appdata\local\temp\pip-build-21skk...

Best python way to return the initializing value of class if of that same class -

i have class want accept instance of same class initialization; in such case, return instance. the reason want class accept myriad of initialization values , proceeding code can use object known properties, independent on how initialized. i have thought of like: class c(object): def __new__(cls, *args, **kwargs): if isinstance(args[0], c): return args[0] else: return super(c, cls).__new__(cls, *args, **kwargs) the problem don't want __init__() called when initialized in manner. there other way? thanks! you want use factory (f.e. see question details or google). or use class method want, f.e.: class c(object): @classmethod def new(cls, *args, **kwargs): if isinstance(args[0], cls): return args[0] else: return cls(*args, **kwargs) obj = c.new() obj2 = c.new(obj)

javascript - Display image before reloading the page -

i trying create tic tac toe game using jquery. this code : var i, j, m, k; $(document).ready(function() { = 0; m = new array(3); (var l = 0; l < 3; l++) { m[l] = new array(3); (k = 0; k < 3; k++) m[l][k] = null; } }); $(".game").click(function() { var img; var col = $(this).index(); var row = $(this).closest('tr').index(); if (i % 2 == 0) { img = '<img src="file:///c:/nnk/tictactoe/tictactoev1/webcontent/web-inf/tictactoeo.jpe"/>'; m[row][col] = 'o'; } else { img = '<img src="file:///c:/nnk/tictactoe/tictactoev1/webcontent/web-inf/tictactoex.jpe"/>'; m[row][col] = 'x'; } $(this).prepend(img); $(this).off(); i++; var col = $(this).index(); var row = $(this).closest('tr').index(); if (i <= 8) { if (winhor(row, col)) { alert(m[row][col] + " won!"); location.reloa...

ASP.Net Web Application Localhost Refused to Connect after Save -

i writing first asp.net web application using vs2015 , iis 7.5. after make changes in code , save, right click , hit view in browser see page. new tab opens in chrome , page comes fine, when go aspx page , make changes , resave, when try , refresh browser tab opened earlier 'this site can't reached localhost refused connect'. have go vs , right click , view in browser again opens new tab , page works. there anyway keep original tab opened persistent can refresh show code changes? it's bit tedious having open new tab every change. thanks. edit: seems timeout issue doesn't matter if make changes @ all. trying refresh browser after 20 or seconds causing connection refused error. go tools-options under projects , solution -> build run select "always build" under "on run, when projects out of date"

Link Column in Django Tables 2 -

i'm trying add link column table have created using django tables 2. i'm using following code documentation class peopletable(tables.table): name = tables.linkcolumn('people_detail', text='static text', args=[a('pk')]) view.py urlpatterns = patterns('', url('people/(\d+)/', views.people_detail, name='people_detail') ) the problem is, when try load webpage following error: reverse 'people_detail' arguments '(1,)' , keyword arguments '{}' not found. 0 pattern(s) tried: [] can see problem here? edit: url.py looks following: urlpatterns = [ url(r'^$', views.indexview, name='index'), url(r'^search/$', views.searchview, name='search'), url(r'^people/(\d+)/$', views.myview,{}, name='people_detail'), url(r'^comment/$', views.licensecomment, name='comment'), url(r'^copylicense/$', views.copylicense, name='co...

sql - Running Count in sqlite -

i have table in sqlite: student |class |grade | | 17 | b | 15 | c | 12 b | b | 14 b | c | 12 b | | 10 and want select top 2 grades in each class, each student , this: student |class |grade | | 17 | b | 15 b | b | 14 b | c | 12 is there simple way this? thanks!

scala - Would you use a type class in this case? -

suppose i've got adt this: sealed trait extends product serializable object { case class a1() extends case class a2() extends case class a3() extends case class a4() extends } suppose have trait afoo that: type foo = ... trait afoo { def asfoo(a: a): foo } now need provide 2 different implementations afoo . writing that: abstract class afoosupport extends afoo { protected def asfoo1(a1: a1): foo protected def asfoo2(a2: a2): foo protected def asfoo3(a3: a3): foo protected def asfoo4(a4: a4): foo def asfoo(a: a) = match { case a1: a1 => asfoo1(a1) case a2: a2 => asfoo2(a2) case a3: a3 => asfoo3(a3) case a4: a4 => asfoo4(a4) } } class afoo1 extends afoosupport { // implement asfoo1, asfoo2, asfoo3, asfoo4 } class afoo2 extends afoosupport { // implement asfoo1, asfoo2, asfoo3, asfoo4 } this approach work wonder if there better way it. use type class in case ? there 1 function (a => foo) concrete...

amazon web services - Can i use aws loadbalancer to manage multiple glusterfs aws ec2-instances -

for high availability file system cluster, idea use amazon load balancer manage ec2-instances have setup gluster cluster. if can use aws load balancer possible create init script can specify instance type,gluster installation steps in load balancer. thanks. i don't think it's idea. why don't want use amazon s3 data storage? it's redundant , highly available design. you can set cross-region replication replication in order have ultimate high-availability.

javascript - How to push the returned value from this js function to a seperate JSON file? -

the following js outputs data in json format (i "believe" syntax proper json format). question - how can data automatically sent separate file on server, e.g. listings.json, each time user opens page , executes script? fetch('http://www.jamapi.xyz', { method: 'post', headers: { 'accept': 'application/json', 'content-type': 'application/json' }, body: json.stringify({ url: 'https://theskint.com/', json_data: '{"listing": [{"elem": ".entry-content > p:nth-child(n+2)" , "value": "text"}] }' }) }).then(function(response) { return response.json(); });

javascript - Polymer: Stop children from toggling mouseenter/out events -

i have polymer component has listeners on-mouseenter , on-mouseout . listeners: { mouseenter: 'mouseenter', mouseout: 'mouseout', } and: mouseenter: function (e) { console.log('\n\nenter'); this.$.deletebtn.style.display = 'block'; }, mouseout: function (e) { console.log('\n\nout'); this.$.deletebtn.style.display = 'none'; } inside multiple other elements. the issue is, events trigger child elements , not parent container. mouseout seems trigger multiple times. want them triggered when host entered or exited, not individual children. otherwise causes kinds of unexpected behaviour. this solved, if didnt use polymer listeners, consistent , have proper scope, not option. missing? you should use mouseleave instead of mouseout , because mouseout triggered each child element. see here , here more info.

c# - ASP.Net MVC code first. How force a get only attrubute to be stored on db? -

the fallowing attribute defined on poco class. public int total { get{ return sub_total_1 + sub_total_2; }} when new migration added attribute not created nor stored on table. i tried add [column("total")] annotation without success. is possible make attribute stored on db "cache" future queries? thanks. for ef able monitor property, needs have public (1) getter , setter. for you're doing, unless need in database operations there, you're fine leaving readonly property in poco class. operation of adding 2 integers not @ performance worry, , slower push , pull database. (1) setter can protected internal if want "read only" except database. as example of how store value in database caching purposes, can this: private int? total; public int total { { return total ?? sub_total_1 + sub_total_2; } protected internal set { total = value; } } in example, new private total variable st...

passing index Parameters for Flann matcher using opencv on android -

i'm trying customize flann matcher in opencv editing index parameters, i'm using java android, , don't know how works. found answer don't know how apply in correct way here code i've tried string yamlparam="%yaml:1.0\n" + "indexparams:\n" + " -\n" + " name: algorithm\n" + " type: 23\n" + " value: 1\n" + " -\n" + " name: trees\n" + " type: 4\n" + " value: 4\n"; file outputf = file.createtempfile("flannfdetectorparams", ".yaml", outputdir); writetofile(outputf,yamlparam); descriptormatcher.read(outputf.getpath()); and here's error i'm getting opencv error: assertion failed (sp.type() == filenode::seq) in virtual void cv::flannbasedmatcher::read(const cv::filenode &) ...

python - edit django form widget rendering -

i have django form 1 of fields defined as: widgets = { 'name': forms.checkboxselectmultiple() } the template renders them in loop with: {% field in form %} <fieldset class="article-form__field"> {{ field.label_tag }} {{ field }} </fieldset> {% endfor %} this rendered as: <fieldset class="article-form__field"> <label for="category-name_0">category:</label> <ul id="category-name"> <li><label for="category-name_0"><input id="category-name_0" name="category-name" type="checkbox" value="gen" /> general information</label></li> <li><label for="category-name_1"><input id="category-name_1" name="category-name" type="checkbox" value="foo" /> food , drinks</label></li> </ul> </fieldset...

How to make pie charts with transparency on matlab? -

Image
i having trouble while adding transparency pie charts. can't set using facealpha or edgealpha , using alpha alone kind of rips edges of chart when compiling eps file. any tips? figure; subplot(1,2,1) h=pie3(p1,[0 0 0 1 1]) set(h,'edgecolor','none','linestyle','none') hold on colormap cool hold on subplot(1,2,2) h=pie3([pf pg],[1 0 ],{'x1','x2'}) set(h,'edgecolor','none') colormap cool %alpha(0.5) print teste -depsc2 the output of pie3 array of handles. handles surfaces, patches, , others text. need select sub-set of these handles have edgealpha , facealpha properties. can using findobj . h = pie3(rand(1,5), [0 0 0 1 1]); set(findobj(h, '-property', 'facealpha'), 'facealpha', 0.2); set(findobj(h, '-property', 'edgealpha'), 'edgealpha', 0); when exporting eps though, transparency not supported. also, since have transparency in figure, matla...

nginx... why do I need the additional location block? -

i wondering if clarify why adding did able fix problem although problem fixed, i'm not sure why works , wasn't working in setup before. the old setup: i have files served @ following address: http://192.168.33.1:3000/bower_components/... e.g., ( http://192.168.33.1:3000/bower_components/animate.css/animate.css ) i have nginx reverse proxy set @ http://192.168.33.10:80/ i have following location block: location /content { proxy_pass http://192.168.33.1:3000/; proxy_redirect off; proxy_set_header host $host; proxy_set_header x-real-ip $remote_addr; proxy_set_header x-forwarded-for $proxy_add_x_forwarded_for; proxy_max_temp_file_size 0; client_max_body_size 10m; client_body_buffer_size 128k; proxy_connect_timeout 90; proxy_send_timeout 90; proxy_read_timeout 90; proxy_buffer_size 4k; proxy_buffers 4 32k; proxy_busy_buffers_size 64k; proxy_temp_file_write_size 64k; } in setup, following url load: http://192.168.33.10/con...

javascript - how to use jquery alert plugin with asp.net button control? -

i have bootstrap modal register users.i want show jquery alert user after successful register or alerts.here button. <div class="modal-footer"> <asp:button id="btnn_register" runat="server" cssclass="btn btn-primary" text="register" onclick="btnn_register_click" validationgroup="aaa" /> </div> the code behind: protected void btnn_register_click(object sender, eventargs e) { //some code if (bluser.check_username() == true) { this.clientscript.registerclientscriptblock(this.gettype(), "asdf", "info()", true); } else { //do if (page.isvalid) { //some codes } and script: <script> notie.setoptions({ colorsuccess: '#57bf57', colorwarning: '#d6a14d...

c# - Detect Windows Insider Build in UWP? -

is possible detect windows build number of given device app? if can please post link or tell me how it? i'm trying deploy quick workaround bug affects users on specific insider build. thanks! found answer: string devicefamilyversion = analyticsinfo.versioninfo.devicefamilyversion; ulong version = ulong.parse(devicefamilyversion); ulong major = (version & 0xffff000000000000l) >> 48; ulong minor = (version & 0x0000ffff00000000l) >> 32; ulong build = (version & 0x00000000ffff0000l) >> 16; ulong revision = (version & 0x000000000000ffffl); var osversion = $"{major}.{minor}.{build}.{revision}"; https://social.msdn.microsoft.com/forums/en-us/2d8a7dab-1bad-4405-b70d-768e4cb2af96/uwp-get-os-version-in-an-uwp-app?forum=wpdevelop

javascript - How to make sure event won't trigger again if it hasn't stopped yet? -

so, here's thing. there's menu bar on side of website. when click on it, menu holder rolls in side (the menu opened), when click on bar again, menu holder rolls , hides menu. pretty simple far. on tat bar, there icon text 'menu'. when open menu, icon changes , text changes 'close'. when close menu, returns normal. still not big deal. this how looks like: closed menu opened menu (the 'zatvoriŤ' caption means 'close' don't worry that) now let's fancy. need effect, text transition make cool , smooth. when menu closed, there's no caption. there's menu icon. text show when user hovers on bar. user hovers on bar, 'menu' caption appear letter letter . means, first letter appear 'm', second 'e'... 'n'... 'u'. whole caption appear in few hundred milliseconds, maybe half second. when user hovers away, caption disappear letter latter . 'men' ... 'me' ... 'm'... ...

html - How do i use floats for images while using <figure> so that <figcaption> still shows under image? -

when use <figure> , <figcaption> floating images, e.g <figure> <img id="one" src="xxx" /> <figcaption>text</figcaption> </figure> and in css: #one { float: right; } the captions kind of stay on page regular text instead of appearing under respective <img> . how fix that? have display ? use clear on figcaption element: figcaption { clear: both; }

linux - Escape double quote inside a single quote -

for x in $(cat raw_tables.txt) echo '{ "type" : "jdbc", "jdbc" : { "url" : "jdbc:mysql://localhost:3306/test", "user" : "root", "password" : "<pass>", "sql" : "select * "'$x'"", "elasticsearch" { "cluster" : "search", "host": "<ip>", "port": 9300 }, "index" : ""'$x'"", "type": ""'$x'"" } }' | java \ -cp "/etc/elasticsearch/elasticsearch-jdbc-2.3.3.1/lib/*" \ -dlog4j.configurationfile=/etc/elasticsearch/elasticsearch-jdbc-2.3.3.1/bin/log4j2.xml \ org.xbib.tools.runner \ org.xbib.tools.jdbcimporter cat raw_tables.txt table1 table2 table3 when run comes out ...

javascript - Unknown provider: accordionDirectiveProvider -

could me figure out mistake is? used this example build sortable accordion on page. example works well, i've put code app , got error angular.js:68 uncaught error: [$injector:modulerr] failed instantiate module app due to: error: [$injector:unpr] unknown provider: accordiondirectiveprovider http://errors.angularjs.org/1.5.7/ $injector/unpr?p0=accordiondirectiveprovider @ http://localhost:63342/myapp%202.0/libs/angular/angular.js:68:20 @ http://localhost:63342/myapp%202.0/libs/angular/angular.js:4502:27 @ object.getservice [as get] ( http://localhost:63342/myapp%202.0/libs/angular/angular.js:4655:53 ) @ object.decorator ( http://localhost:63342/myapp%202.0/libs/angular/angular.js:4577:49 ) @ http://localhost:63342/myapp%202.0/js/app/app.js:56:18 @ object.invoke ( http://localhost:63342/myapp%202.0/libs/angular/angular.js:4709:31 ) @ runinvokequeue ( http://localhost:63342/myapp%202.0/libs/angular/angul...

ios - Back button position on navigation controller -

i'm trying develop custom search ios app. i have managed search controller appearing , search bar appearing properly, although problem need button appear on right of navigation bar rather left, see below (as can see button on left need on right) http://imgur.com/qlpoifg here code: import uikit class searchtop10controller: uitableviewcontroller, uisearchresultsupdating { override func viewdidload() { super.viewdidload() let searchcontroller = uisearchcontroller(searchresultscontroller: self); self.definespresentationcontext = true; searchcontroller.searchresultsupdater = self; // searchcontroller.hidesnavigationbarduringpresentation = true; searchcontroller.dimsbackgroundduringpresentation = false; searchcontroller.searchbar.sizetofit(); self.navigationitem.titleview = searchcontroller.searchbar; self.tableview.tableheaderview = searchcontroller.searchbar; } override func viewdidappear(animated: bool) { } func updates...

javascript - Protractor E2E could not find angular exceeded -

i know there lot of error here, in stackoverflow, other solution didn't work me i'm asking: i'm trying simple login test , protractor giving me error: error: angular not found on page http://localhost:5555/# : retries looking angular exceeded configuration file is: const config = { baseurl: 'http://localhost:5555/', specs: [ //'./testes/teste3.js' './testes/cadastronorma.js' //'./testes/cadastrocargo.js' ], //identificando o framework escolhido para escrita de testes. framework: 'jasmine', jasminenodeopts: { showcolors: true, isverbose: false, includestacktrace: false, }, directconnect: true, capabilities: { browsername: 'chrome' }, //função que será executado antes dos inicios de testes. fazendo o login no sistema. onprepare: function() { browser.get('#'); // needed custom class decorators require("reflect-metadata"); ...

javascript - Directive template update when scope property updates -

i have component i'm trying build accepts user_id , loads user information in background, , drops element on page directive attached it. so far have <user-popover user-id="item.item_high_bid_user_id"></user-popover> angular.module('bidradminapp') .directive('userpopover', ['data', function (data) { return { template: '<a bb-popover-template="user-popover-content.html">{{user.user_name}}</a><i ng-hide="{{user}}" class="fa fa-spinner fa-spin" aria-hidden="true"></i>', scope: { userid: '=', user: '=*' }, restrict: 'e', controller: function($scope, $element, $attrs, data){ data.getuser($scope.userid).then(function(userdata){ $scope.user = userdata.data; }); }, }; }]); i'm getting data loading in background data service , user.user_name in t...

java - How do I change the sprite in the timer when the object is created but is not visible camera? -

i want change sprite after time if object not visible camera. have method creates object private void spawnraindrop() { rectangle raindrop = new rectangle(); raindrop.x = mathutils.random(0, drop.width - 100); raindrop.y = drop.width; raindrop.width = 100; raindrop.height = 100; raindrops.add(raindrop); lastdroptime = timeutils.nanotime(); } have method changes time interval through sprites: public void timerspritechange() { timer timer = new timer(); timer.schedule(new timer.task() { @override public void run() { index = ((int) (math.random() * max_sprites)); } } , 0, 5); } here check , compare time , call method if (timeutils.nanotime() - lastdroptime > 1000000000) { spawnraindrop(); } orthographiccamera camera; have thought of making boolean 'raindropvisibl...

java - Android HttpURLConnection write post data -

i'm trying send post data through httpurlconnection , doesn't seem send post data. i'm able output data through toast before trying send post request, when check on server side makes connects php file, post data empty. so, know data exists in jsonobject. know makes try catch statement, when connect it's not being sent or received properly. try { url url = new url(emailurl); httpurlconnection conn = (httpurlconnection) url.openconnection(); conn.setdooutput(true); conn.setrequestmethod( "post" ); conn.setrequestproperty( "content-type", "application/json"); conn.setrequestproperty( "charset", "utf-8"); conn.setrequestproperty( "content-length", integer.tostring( jsonobject.tostring().length() )); conn.setusecaches( false ); outputstreamwriter wr = new outputstreamwriter(conn.getoutputstream()); wr.write(jsonobject.t...

Return an object using its name in python -

so, i've create global objects can accessed method. have return objects method this. def get_my_obj (obj_name): if obj_name == "abc": return abc elif obj_name == "xyz": return xyz elif obj_name == "def": return def is there simpler way achieve this? have hundreds of these objects. through use of globals() in appropriate file, entirely possible achieve such evil act. # file1.py abc = 'foo' xyz = 'bar' dfe = 'baz' def get_my_obj(obj_name): return globals()[obj_name] # file2.py file1 import get_my_obj print(get_my_obj('abc')) # 'foo' globals() retrieves variables within current module. in case, may file executed. can it? yes. it? no. business decide if should anyway? no.

SUBLIME TEXT 3 JAVA BUILD RESULT NOT WORKING -

i have problem in sublime text 3. after successful build not getting output . build result not working hello world java program , no output please me enter image description here import java.io.*; class h{ public static void main(string args[]){ system.out.println("hello world"); }} building means have program. in order output, have run it. run it, find h.class file , run: java h this should print message you're looking for. also if you're having sort of basic problem, helps narrow things down figure out problem coming from. example have first tried without using sublime text @ all, this: $ javac h.java (nothing printed should have h.class file) $ java h hello world if nothing else, make better stackoverflow question.

css - Vertical alignment within thead in table with scrolling tbody -

i have table header th values wrap , not, resulting in floating top. can't seem align values, , border, bottom of header. working code here: jsfiddle i tried following, had no effect: th { vertical-align: bottom; } do not overwrite display table , elements. used html table , changed via css blocks. why? delete this: .table, thead, tbody, tr, th, td { display: block; } also can't float table cells. delete this: th, td { float: left; width: 25%; } update: after op stated wants table fixed header , scrollable content suggest following based on requirements. following solution based on original code fixed column widths , column counts. not kind of solutions @ case sufficient. /* set table layout fixed prevent uneven column widths */ .table { table-layout: fixed; } /* set thead , tbody display block */ .table thead, .table tbody { display: block; } /* enable table layout again each row */ .table tr { width: 100%; ...

c# - How to connect 2 tables using LINQ ASP.NET -

images table structure: id accountid url slides table structure: id accountid imageid i have 2 requests: viewbag.userid = user.id; viewbag.images = context.images.where(c => c.accountid == user.id).select(c => c); viewbag.slides = context.slides.where(c => c.accountid == user.id).select(c => c); question : how can change code viewbag.slides = result slides.imageid = images.id . i'm trying url of image. you can linq join var slidesforuser= ( in context.images join b in context.slides on a.id equals b.imageid a.accountid == user.id select b).tolist(); slidesforuser variable list of slides (for recors matches join , condition). if prefer select 1 property (ex :imageurl), update select part select b.imageurl

android - E/RecyclerView: No adapter attached; skipping layout (Using FRAGMENTS) -

i modified code according answers found similar questions none of them worked. using tabfragments , recyclerviews. console displays error "e/recyclerview: no adapter attached; skipping layout" 4 times. (when modifying gave me error "java.lang.nullpointerexception: attempt invoke virtual method 'void android.support.v7.widget.recyclerview.setlayoutmanager(android.support.v7.widget.recyclerview$layoutmanager)' on null object reference", maybe correlated). adapter public class ingredientadapter extends recyclerview.adapter<ingredientadapter.viewholder>{ public arraylist<ingredient> dataset = new arraylist<>(); public context ctx; public static class viewholder extends recyclerview.viewholder { public view view; public viewholder(view itemview) { super(itemview); view = itemview; } } public ingredientadapter(context ctx){ super(); this.ctx = ctx; } @override public ingredientadapter.viewholde...

mysql - Comparing records in one table to another for large databases in PHP -

i have 2 tables in mysql database. lets there 1800 records in table 1 , 20000 records in table 2. want compare each record in table 1 table 2 , update fields in table 2 records matched. i want know optimized way this. the efficient operation update statement using join. this: update table_2 t2 inner join table_1 t1 on t1.some_id = t2.some_id set t2.some_col = t1.some_col;

java - Drools - Not all actions are executed when rule fires -

Image
at moment, have large decision table lot of conditions/actions. decision table has worked until have added new action. not seem executing. as i'm unable show whole file, extract of important columns (be aware there more conditions): below actions defined on "orig" object: the following fields updated through setter: prm_lib01 prm_lib09 prm_lib10 however, prm_lib18 not being updated. if switch around action of prm_lib10 , prm_lib18, it's column of prm_lib10 gets updated. when debug through code, see rulebuildcontext holds setters first rule: so based on this, expect execute setprm_lib18("gc") well, not happen. so i've tried see class file drools generates see whether seems fine, i'm unable view generated bytecode. i'm @ loss why doesn't work. have clue or how debug actual calling of actions maybe see why it's not executed? this quite unlikely. how ascertain action isn't executed? there rule might modi...

c++ - CMFCPropertyGridProperty questions -

i have c++ mfc application, , using cmfcpropertygridcontrol cmfcpropertygridproperty . wondering if it's possible modify behavior of control following occurs: looking have drop down arrow appear on cmfcpropertygridproperty there available options choose. user required double click on row in order drop down arrow appear on control. users may not aware there other options select. when user double clicks on cmfcpropertygridproperty 3 options choose from, control changes selected option next option. don't want option change option unless user selects different option using drop down menu. for cmfcpropertygridproperty enabled spin control, spin control not display until user first clicks on row in property grid, , double clicks on property. spin control display. any suggestions or @ appreciated.

javascript - populate handlebars.js template with an array of strings from js -

i have no clue if possible, have spent lot of time trying figure out how it. have array of string values in .js file include html tags. array similar this: var values = [ <h1>introduction</h1>, <h3>words</h3>, <p>more words</p> ] i attempting have them inserted handlebars template, can't seem find way it. have tried using variation of {{ #each _ }} method node.js no avail. please let me know how this, or if it's possible. here's current code. trying array of data display when it's hard-coded in html. getting no errors, code not display. esoms tutorial <script src="https://cdnjs.cloudflare.com/ajax/libs/handlebars.js/4.0.5/handlebars.js"></script> <script language="javascript" type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script> <script language="javascript" type...

json.net - Reading Large JSON file into variable in C#.net -

i trying parse json files , insert sql db.my parser worked fine long files small (less 5 mb). i getting "out of memory exception" when trying read large(> 5mb) files. if (system.io.directory.exists(jsonfilepath)) { string[] files = system.io.directory.getfiles(jsonfilepath); foreach (string s in files) { var jsonstring = file.readalltext(s); filename = system.io.path.getfilename(s); parsejson(jsonstring, filename); } } i tried jsonreader approach, no luck on getting entire json string or variable.please advise. use 64 bit, check rredcat's answer on similar question: newtonsoft.json - out of memory exception while deserializing big object newtonsoft jason performance tips read article david cox tokenizing: " the basic approach use jsontextreader object, par...

How can I make a firefox add-on contentscript inject and run a script before other page scripts? -

i'm working on browser extension/add-on. have working in chrome, i'm trying working in firefox. i've gotten add-on load in firefox developer edition 49.0a2 (2016-07-25). my extension involves content_script set run_at: document_start , can inject script tag before other page scripts run, can make object globally available websites. this has seemed work fine in chrome, in firefox has proven bit of race condition, other page resources loading first of time. is there strategy load content script in way can inject & load script before other page scripts run? when add logs, can isolate happening pretty nicely. in example content-script: // inject in-page script console.log('step 1, happens first') var scripttag = document.createelement('script') scripttag.src = chrome.extension.geturl('scripts/inpage.js') scripttag.onload = function () { this.parentnode.removechild(this) } var container = document.head || document.documentelement // a...

python - Biopython bootstrapping phylogenetic trees with custom distance matrix -

i trying create bootstrapped phylogenetic tree instead of using raw multiple sequence alignment data , standard scoring system, want use own custom distance matrix have created. have looked @ http://biopython.org/wiki/phylo , have been able create single tree using own custom distance matrix using following code: dm = treeconstruction._distancematrix(tfs,dmat) treeconstructor = distancetreeconstructor(method = 'upgma') upgmatree = treeconstructor.upgma(dm) phylo.draw(upgmatree) where dmat lower triangle distance matrix, , tfs list of names used columns/rows. when looking @ bootstrapping examples, seems of input needs raw sequence data , not distance matrix used above, know workaround problem? thanks! short answer: no, cannot use distance matrix bootstrap phylogeny. long answer: first step in bootstrapping phylogeny calls creating set of data pseudoreplicates. dna sequences, nucleotide positions randomly drawn alignment (the whole column) repetitions to...

sql - truncate date to week and compare against existing variable -

i have column called actuals_date , want insert dates table on rolling basis such previous 6 weeks , next 8 weeks loaded table. for previous 6 weeks, have following sql structure (from tableau) [actuals date] > dateadd('week',-6,datetrunc('week', today()) - 1) , [actuals date] <= datetrunc('week', today()) - 1 and next 8 weeks, following syntax tableau: [forecast date] >= datetrunc('week', today()) - 1 , [forecast date] <= dateadd('week', 7,datetrunc('week', today()) - 1) can please me convert sql query? one way accomplish goal use dateadd() previous 6 weeks: select f.mycolumns dbo.mytable f f.mydatefield between dateadd(week,-6,cast(getdate() date)) , cast(getdate() date) next 8 weeks: select f.mycolumns dbo.mytable f f.mydatefield between cast(getdate() date) , dateadd(week,8,cast(getdate() date)) note: assumes f.mydatefield date without time. if f.mydatefield has time, want cast date s...

javascript - Angular2 - OnInit accessing functions -

i keep running issues oninit accessing functions within same component class. my basic setup follows: import {component, oninit} '@angular/core'; ... export class appcomponent implements oninit { login(){...} ngoninit() { this.login(); //1 document.onkeypress = function(e){ if ( document.body === document.activeelement ) { this.login(); //2 } }; 1 fire login function on page load expected, 2 complains login isn't function. how appropriately access login function within appcomponent? this has scoping. time call this.login onkeypress callback this refers global object this.login equal window.login in case undefined possible solutions cache this var _this = this; document.onkeypress = function(e){ if ( document.body === document.activeelement ) { _this.login(); //2 } }; explicitly set context .bind document.onkeypress = function(e){ if ( document.body === document.activeelemen...