Sunday 15 August 2010

python - Stacking images as numpy array -



python - Stacking images as numpy array -

i'm trying utilize for-loop stack 6 different images 1 on top of create 3d stack.i'm new python...and not able figure out. how can create stack , how can access each image in stack later? code this...

image = data.camera() noisyimage = np.zeros(image.shape(0),image.shape(1)) fig = plt.figure(figsize=(12,4)) in range(6): noisyimage = util.random_noise(image,mode='gaussian',seed=i) result = np.dstack(noisyimage,noisyimage) ax = plt.subplot(2,3,i)

try this:

# reshape array (n,m) 1 (n,m,1) no increment in size happens. n1=np.reshape(noisyimage,noisyimage.shape+(1,)) if(i==1): result=n1 else: # concatenate n,m,1 version of array stack using 3rd index (last index) axis. result=np.concatenate(result,n1,axis=n1.ndim-1)

the code below more general implementation (from reply above taken) apply function designed applied single channel channels in image.

def matrixtomultichannel(f,x,*args,**kwargs): nchannels=x.shape[-1] y=np.reshape(x,(x.size/nchannels,nchannels)) in range(0,nchannels): yi=np.reshape(y[:,i],x.shape[:x.ndim-1]) m1=genericf(f,yi,*args, **kwargs) m1=np.reshape(m1,m1.shape+(1,)) if(i==0): fout=m1 else: fout=np.concatenate((fout,m1),axis=m1.ndim-1) homecoming fout

python arrays image numpy

html5 - How to reset the slider value based on checkbox using JavaScript? -



html5 - How to reset the slider value based on checkbox using JavaScript? -

i have range slier & trying reset it's value default if checkbox clicked. can tell how this?

this tried:

html:

<input type="range" id="myrange" max="10000" min="60"> <input type="checkbox" id="lala" onclick="myfunction()"> checkme

javascript:

function myfunction() { document.getelementbyid('myrange').value=60; }

fiddle

you seek phone call undefined function, i´ve edited fiddle http://jsfiddle.net/3kqyaaup/2/ (move js <head>) , works.

<script> function myfunction() { document.getelementbyid('myrange').value=60; } </script> <input type="range" id="myrange" max="10000" min="60"> <input type="checkbox" id="lala" onclick="myfunction()"> checkme

javascript html5 checkbox rangeslider

node.js - "Sandbox" for using multiple instances of a javascript lib -



node.js - "Sandbox" for using multiple instances of a javascript lib -

i'm using js lib, create global variable "av" used everywhere in webapp. want create "sandbox"(not strict sandbox because of no secure concern) utilize multiple different "av"s in 1 webapp.

i wrote wrap browser below , works.

var avcontexts = { app1: null, app2: null } var contextloader = function (appid, appkey) { this.av = null; this.runinthis = function (script) { eval(this.script); this.av.initialize(appid, appkey); } this.loadcontext = function (appid, appkey) { $.ajax({ url: 'js/av.js', datatype: "text", context: }).done(function (data) { this.script = data; this.runinthis.call(this); }).fail(function () { console.log('failed'); }); } this.loadcontext(appid, appkey); } avcontexts.app1 = new contextloader( "[appid]", "[appkey]" ); avcontexts.app2 = new contextloader( "[appid]", "[appkey]" ); // var testobject = avcontexts.app1.av.object.extend("testobject"); var testobject = new testobject(); testobject.save({foo: "bar"}, { success: function (object) { alert("avos cloud works!"); } });

but when move nodejs. error occurred @

this.runinthis.call(this); error: cannot phone call method 'call' of undefined

any idea?

you should cache "this", this:

var me = this;

before utilize $.ajax. , then,

$.ajax().done(function() { me.runinthis.call(); });

if want know reason,

run

console.log(this);

before

this.runinthis.call(this);

you know reason.

javascript node.js

java - Mocking static fields with Mockito -



java - Mocking static fields with Mockito -

i have (it 3rd party library have work design):

classa.conn1.getobjecta().getintvalue()

classa normal class, , within there public static field (conn1). conn1 class have connection , other values used in application (in case objecta).

this value passed parameter in dao mocking. value mocked matchers.anyint() nullpointerexception because conn1 null (not expected int)

i tried things powermockito, whitebox, without success. have done this, same nullpointerexception

mockito.when(classa.conn1.getobjecta()).thenreturn(new objecta(2));

the question is, how can mock objecta or int value of objecta

import static x.y.z.mockito.*; objecta objecta = mock(objecta.class); when(objecta.getintvalue()).thenreturn(1)); conn conn1 = mock(conn.class); when(conn1.getobjecta()).thenreturn(objecta); classa.conn1 = conn1;

java unit-testing mocking mockito

php - Do I need to sanitize POST data when writing to a text file? -



php - Do I need to sanitize POST data when writing to a text file? -

i have post input performing mysql queries with.

i sanitizing post thoroughly before using database queries...no problem there.

now think want start logging in text file users putting in input field ... improve sense users looking for. writing txt file...got covered..no issues

my question is... can safely utilize raw(pre-sanitized) post info string writing text file? see if there funny business beingness posted there test site defenses... injection attempts, etc etc etc. assume fine writing text file ... or wrong , bad practice?

this won't indefinite info gathering on input field, bit see customers looking for.

yes :-)

just little advise, save file outside webroot, nobody can read via web.

php security fopen

php - Opencart Case sensitive search? -



php - Opencart Case sensitive search? -

i'm using opencart version 1.5.6.4 , search results appear case sensitive?

if search "product name" , actual product name "product name" opencart homecoming no results.

is there anyway of ignoring case?

this has been resolved.

i had updated previous version of opencart , imported product info (utf8_bin). since 1.5 database has been switched utf8_general_ci collation text matching in queries no longer case sensitive.

just updated database collation utf8_general_ci. issue resolved.

php search opencart

startswith - Xpath - Selecting attributes using starts-with -



startswith - Xpath - Selecting attributes using starts-with -

i trying write xpath look selects div tags have attribute id start companycalendar. below snippet of html looking at:

<td class="some class" align="center" onclick="calendar_dayclicked(this,'eventcont','event');"> <span class="text"></span> <div id="companycalendar02.21" class="pop calendarclick" style="right: 200px; top: 235px;"></div>

there multiple divs have id companycalendar02.21 each new month in calendar, alter id. example, next month companycalendar02.22. able select of divs equal companycalendar*

i rather new @ using illustration off net seek , xpath look work no avail. help appreciated.

i trying write xpath look selects div tags have attribute id start companycalendar.

the next look perhaps looking for:

//div[starts-with(@id,'companycalendar')]

what does, in plain english, is

return div elements in xml document have attribute id attribute value starts "companycalendar".

xpath startswith

html - Getting Div tag to extend to the bottom of the Page w/out covering elements already on the page -



html - Getting Div tag to extend to the bottom of the Page w/out covering elements already on the page -

i have tried absolute footer remain on bottom of page covers elements @ bottom instead of going underneath them. fixed similar thing except if page longer cover elements in center of page. literally want backgound color of div extend bottom of page , have logo , text remain in between div @ set height. here's i've got.

<!doctype html> <html> <head> <link rel="stylesheet" type="text/css" href="main.css"/> <title> </title> <div class="heading"> <img src="images/redbird.gif" alt="redbird" style="float:left; padding-left:15px; padding-top:15px; width:150px;height:90px"> <form> search: <input type="search" name="search" style="float:right;"> </form> <br></br> <button type="button" id="login">login</button> <button type="button" id="login">create new account</button> <h1>technology blog</h1> <a href="index.html"> <img src="images/house.png" alt="home" style="width:35px; height:35px;"> </a> </div> <div class="table"> <table style+"width:100%"> <tr> <td><a href="phones.html">phones & tablets</a></td> <td>computers & laptops</td> <td>internships</td> <td>troubleshooting</td> <td>product ratings & reviews</td> </tr> </table> </div> </head> <body> <div class="welcome"> <h2>welcome</h2> <p>welcome illinois state university's technology blog. here can view , post questions, answers, reviews, , other info related technology. website illinois state university students only! must sign in or create business relationship view or post on website.</p> </div> <div class="slideshow"> <img src="images/dellcomps.jpg" alt="computers" style="width: 397px; height: 298px"> </div> </body> <div class="footer"> <img src="images/seal.png" alt="isu seal" style="width: 40px; height: 40px; padding-bottom: 10px; padding-top: 10px"> copyright 2014 @ tec 319 grouping <br/> illinois sate university </div> </html>

heres css. need edit .footer tag believe

html{ height: 100%; position: relative; } h1{ text-align: center; font-family: impact; font-style: italic; } .heading{ background-color: #ca0000; height:150px; } td{ border:5px solid black; text-align:center; background-color:#790000; color:white; padding:10px; font-family: helvetica; font-style: italic; font-size: 15px; } table{ width:100% } .table{ background-color:black; height:53px; } form{ float:right; } button{ float:right; } .slideshow img{ display: block; position: center; margin-left: auto; margin-right: auto; } .footer img{ display: block; position: center; margin-left: auto; margin-right: auto; } .footer{ margin-top: 40px; text-align: center; background-color: #d8d8d8; padding-bottom: 20px; width: 100%; } .preview td{ display: block; text-align: left; color: black; background-color: white; } .blog td{ display: block; text-align: left; color: black; background-color: white; border: 0px; } .newpost h2{ display: block; position: center; margin-left:auto; margin-right: auto; vertical-align: middle; color: white; background-color: #790000; border: 5px solid black; border-collapse: collapse; width: 250px; text-align: center; } h3 { color: white; background-color: #790000; border: 5px solid black; } h4{ text-align: left; font-size: 14pt; color:#790000 } .back h2{ display: block; position: left; border:5px solid black; background-color:#790000; color:white; padding:10px; font-family: helvetica; font-style: italic; font-size: 15px; width: 100px; } form.comment{ float:left; size } a.blogtitle:link { color: #790000; text-decoration: none; } a.blogtitle:visited{ color: #790000; text-decoration: none; } a.blogtitle:active{ color: #790000; text-decoration: none; } a.blogtitle:hover{ color: #ca0000; text-decoration: none; } a:link { color: white; text-decoration: none; } a:visited{ color: white; text-decoration: none; } a:active{ color: white; text-decoration: none; } a:hover{ color: #ca0000; text-decoration: none; }

you need set footer position relative have respect other elements on page. both absolute , fixed remove element page flow, causes overlapping.

demo

change position:relative fixed in demo css , uncomment bottom see difference. can play height on body tag see how behavior changes.

<div id="content"> <p>content</p> </div> <div id="footer"> <p>footer stuff</p> </div> body { margin:0; padding:0; } #content { height:1200px; width:100px; background-color:#eee; position:relative; margin:0; padding:0; border:1px solid black; } #footer { width:100px; position:relative; /* bottom:0; */ background-color:#eee; margin:0; padding:0; border:1px solid black; }

html css

windows - Way to automate enumerating and inserting subfolders into a command line -



windows - Way to automate enumerating and inserting subfolders into a command line -

using robocopy merge 2 user home directories shares 2 different servers new server, can't utilize /purge mirror deletes because delete other servers stuff.

i need way enumerate folder names users$ share on each server, , add together both path statements in command below, can purge @ users subfolder level.

robocopy command:

robocopy "\currentserver1\users$" "f:\users" /e /b /copy:datsou /r:1 /w:1 /mt /log:"c:\robocopylogs\mirrorusers1.txt"

can batch or vbscript that?

thanks in advance help can provide.

you merge both source folders staging folder, mirror staging folder destination folder:

mkdir c:\staging robocopy \\server1\src c:\staging /e /b ... robocopy \\server2\src c:\staging /e /b ... robocopy c:\staging c:\dst /mir /b ... rmdir /s /q c:\staging

windows batch-file vbscript

HAProxy and Mysql Cluster Topology -



HAProxy and Mysql Cluster Topology -

i've installed mysql cluster 2 info node,2 sqlnode , 1 management server on different hosts.in add-on i've 3 different app instances.

now want install haproxy in front end of mysql cluster not sure topology.i searched on google confused lot more since of examples utilize additional components galera cluster etc. should install haproxy on different host or haproxy must on same host app instaces or sqlnodes?i read each 1 has pros , cons latency introduced wonder 1 more accepted , used ?or reference or tutorial on this? (apps written in php running on centos 6 32bit way)

mysql haproxy mysql-cluster

c# - How to edit spacing of TreeView nodes -



c# - How to edit spacing of TreeView nodes -

in programme have treeview view element displays nodes strings. add together more space between each node (basically create not condensed). there way through xaml? have looked through of properties in treeview control , have not had luck finding corresponding property. if cannot xaml, how go in c#?

this treeview style implementation:

<style targettype="treeviewitem" > <setter property="isexpanded" value="{binding isexpanded}" /> <style.triggers> <datatrigger binding="{binding hascommands}" value="false"> <setter property="contextmenu" value="{staticresource treeviewemptymenu}" /> </datatrigger> <datatrigger binding="{binding hascommands}" value="true"> <setter property="contextmenu" value="{staticresource treeviewitemcontextmenu}"/> </datatrigger> </style.triggers> </style>

update: right click options using @chris w.'s answer

so if go take @ default template see in there contentpresenter , itemspresenter either go , set hard value margin on margin="0,5" or whatever space need. or bind template come in value inline @ instance.

you can quick right-click on treeview in document outline or on design editor , take edit template->edit current or edit copy, or should able nail item template choosing edit additional templates->edit item, if edit current, you'll edit base of operations default template, if take create re-create assign style template explicitly instance. xaml should required here, no code otherwise, , it's easy peazy.

hope helps, cheers.

c# wpf xaml treeview

c# - How to display output of a python program in a text box located in a .aspx Web Form? -



c# - How to display output of a python program in a text box located in a .aspx Web Form? -

i have simple python programme named hello.py

import sys def simple(): print "hello python"

how display output of programme in text box located in web form of type .aspx.cs

protected void textbox1_textchanged(object sender, eventargs e) { textbox1.text = // output of hello.py asigned textbox1.text }

you have follow these steps accomplish this.

host python file in cgi, lets link http://localhost/cgi-bin/test.py , invoke using webclient , output. next code invoking url using webclient.

protected void textbox1_textchanged(object sender, eventargs e) { webclient client = new webclient(); string reply = client.downloadstring("http://localhost/cgi-bin/test.py"); // address = cgi hosted url textbox1.text = reply; }

else

assumption: have python installed in windows system.

save python script file , abc.py. you can straight execute python script, using "c:\python26\python.exe" "abc.py". utilize in next step. using process execution, can execute above command c# , output. example- var proc = new process { startinfo = new processstartinfo { filename = "c:\python26\python.exe", arguments = "abc.py", useshellexecute = false, redirectstandardoutput = true, createnowindow = true } }; proc.start(); while (!proc.standardoutput.endofstream) { string line = proc.standardoutput.readline(); // line textbox1.text = line; }

or - utilize link http://blog.luisrei.com/articles/flaskrest.html - shows , how create python code rest based thing, , can invoke straight rest api in asp.net code.

c# python asp.net

search - Adding an OOTB Web Part to an App for SharePoint -



search - Adding an OOTB Web Part to an App for SharePoint -

i'm attempting add together ootb web part (actually create variation of search page) in app sharepoint using office 365 development site development happens ootb web part. default code when create page of course of study this:

<%@ page language="c#" masterpagefile="~masterurl/default.master" inherits="microsoft.sharepoint.webpartpages.webpartpage, microsoft.sharepoint, version=15.0.0.0, culture=neutral, publickeytoken=71e9bce111e9429c" %> <%@ register tagprefix="utilities" namespace="microsoft.sharepoint.utilities" assembly="microsoft.sharepoint, version=15.0.0.0, culture=neutral, publickeytoken=71e9bce111e9429c" %> <%@ register tagprefix="webpartpages" namespace="microsoft.sharepoint.webpartpages" assembly="microsoft.sharepoint, version=15.0.0.0, culture=neutral, publickeytoken=71e9bce111e9429c" %> <%@ register tagprefix="sharepoint" namespace="microsoft.sharepoint.webcontrols" assembly="microsoft.sharepoint, version=15.0.0.0, culture=neutral, publickeytoken=71e9bce111e9429c" %> <asp:content contentplaceholderid="placeholderadditionalpagehead" runat="server"> <sharepoint:scriptlink name="sp.js" runat="server" ondemand="true" loadafterui="true" localizable="false" /> </asp:content> <asp:content contentplaceholderid="placeholdermain" runat="server"> <webpartpages:webpartzone runat="server" frametype="titlebaronly" id="full" title="loc:full" /> </asp:content>

and want add, say, searcharea web part zone on testing: "cannot create xmlserializers web part"

this seems simple , yet error. happens ootb web part. doing wrong? again, have app sharepoint deploy heavily customized search experience, must utilize ootb sharepoint controls search in areas.

thoughts?

search sharepoint sharepoint-apps webpartpage

UTF-8 fonts in maven-pdf-plugin -



UTF-8 fonts in maven-pdf-plugin -

is there way attach custom fonts maven proejct has documentation generated maven-pdf-plugin? project has documentation written in latex , wanted integrate with maven build. problem see no way attach custom fonts, default ones contain ansi characters.

or maybe there other plugin capable of processing maven site sources , dumping them pdf?

maven pdf apache-fop maven-pdf-plugin

angularjs - CSS Transition not showing with directive -



angularjs - CSS Transition not showing with directive -

i'm playing transitions , directives. i've created card directive should show clone of self in fullscreen when clicked. transition doesn't happen if don't apply altering css class in timeout. how should done?

<div ng-app='trans'> <div data-card class='card'>timeout</div> <div data-card='notimeout' class='card'>not timeout</div> </div>

between original position , fullscreen mode should transition spin. goto class can add/remove transitions card doesn't transition widht/height when window resized. think reads nice =)

.card { width:10vh; height:14vh; background-color:pink; margin: 10px; } .card.goto.fullscreen { transition: 0.6s linear; } .card.fullscreen { height:95vh; width: 68vh; position:absolut; position: absolute; top: 50% !important; left: 50% !important; margin: 0; transform: translate(-50%, -50%) rotatey(360deg); }

this simplified version of directive.

var app = angular.module('trans', []); app.directive('card', ['$document', '$timeout', function ($document, $timeout) { homecoming { restrict: 'a', link: link, scope: {} }; function link(scope, element, attrs) { var clone; element.on('click', function () { if (clone) { clone.off().remove(); } clone = element.clone(); var spec = getcardspecifications(); clone.css({ 'margin': '0', 'top': spec.top + 'px', 'left': spec.left + 'px', 'position': 'absolute' }); $document.find('body').append(clone); clone.addclass('goto'); if (attrs.card == 'notimeout') { clone.addclass('fullscreen'); } else { $timeout(function () { clone.addclass('fullscreen'); }, 0); } }); function getcardspecifications() { var spec = {}; spec.top = element.prop('offsettop'); spec.left = element.prop('offsetleft'); spec.height = element[0].offsetheight; spec.width = element[0].offsetwidth; homecoming spec; } } }]);

i've created jsfiddle demonstrates problem.

the problem doesn't have angular itself, creating new dom node , setting class on right after. such problem described e.g. here, , uses same solution yours in first example.

disclaimer: real angular way of doing nganimate. follows solution same op's, , 1 you'd want utilize if don't want depend on module – it's ~11kb uncompressed, , 4kb gzipped. take wisely!

what worked me waiting dom node ready:

clone.ready(function() { clone.addclass('fullscreen'); });

this amounts same thing using 0ms timeout, a. more descriptive , b. works in cases, while timeout solution apparently fails in firefox (see linked article).

the sec solution given in article reads little more hackish (matter of opinion, really), , you'll have retrieve actual dom element instead of jqlite wrapper around utilize it.

why happens, though adding class "after appending", wasn't able find out. perhaps appendchild, append uses internall, asynchronous (i.e. pushes dom manipulation task onto event queue)? more googling might useful if you're interested in cause of problem.

angularjs angularjs-directive css-transitions

php - Security.yml file is wrong, can't get users from the database -



php - Security.yml file is wrong, can't get users from the database -

i have troubles security.yml file:

# can read more security in related section of documentation # http://symfony.com/doc/current/book/security.html security: # http://symfony.com/doc/current/book/security.html#encoding-the-user-s-password encoders: #symfony\component\security\core\user\user: plaintext login\loginbundle\entity\user: sha512 # http://symfony.com/doc/current/book/security.html#hierarchical-roles role_hierarchy: role_admin: role_user role_super_admin: [role_user, role_admin, role_allowed_to_switch] # http://symfony.com/doc/current/book/security.html#where-do-users-come-from-user-providers providers: users: entity: { class: loginloginbundle:user, property: username } in_memory: memory: users: user: { password: userpass, roles: [ 'role_user' ] } admin: { password: adminpass, roles: [ 'role_admin' ] } # main part of security, can set firewalls # specific sections of app firewalls: secured_area: pattern: ^/ anonymous: ~ form_login: provider: users login_path: login check_path: login_check access_control: - { path: ^/login, roles: is_authenticated_anonymously }

i have website has login form. users located in database. can login username: user , password: userpass how can work users database?

i have read userinterfaces , fooled around it, without succes.

maybe user entity helpfull, here is:

<?php namespace login\loginbundle\entity; utilize doctrine\orm\mapping orm; utilize symfony\component\security\core\user\userinterface; /** * user */ class user implements userinterface, \serializable { /** * @var string */ private $username; /** * @var string */ private $email; /** * @var string */ private $password; /** * @var integer */ private $money; /** * @var integer */ private $userid; /** * @var \login\loginbundle\entity\team */ private $teamteamid; /** * @inheritdoc */ public function getsalt() { // *may* need real salt depending on encoder // see section on salt below homecoming null; } /** * @inheritdoc */ public function getroles() { homecoming array('role_user'); } /** * @inheritdoc */ public function erasecredentials() { } /** * @see \serializable::serialize() */ public function serialize() { homecoming serialize(array( $this->id, $this->username, $this->password, // see section on salt below // $this->salt, )); } /** * @see \serializable::unserialize() */ public function unserialize($serialized) { list ( $this->id, $this->username, $this->password, // see section on salt below // $this->salt ) = unserialize($serialized); } /** * set username * * @param string $username * @return user */ public function setusername($username) { $this->username = $username; homecoming $this; } /** * username * * @return string */ public function getusername() { homecoming $this->username; } /** * set email * * @param string $email * @return user */ public function setemail($email) { $this->email = $email; homecoming $this; } /** * email * * @return string */ public function getemail() { homecoming $this->email; } /** * set password * * @param string $password * @return user */ public function setpassword($password) { $this->password = $password; homecoming $this; } /** * password * * @return string */ public function getpassword() { homecoming $this->password; } /** * set money * * @param integer $money * @return user */ public function setmoney($money) { $this->money = $money; homecoming $this; } /** * money * * @return integer */ public function getmoney() { homecoming $this->money; } /** * userid * * @return integer */ public function getuserid() { homecoming $this->userid; } /** * set teamteamid * * @param \login\loginbundle\entity\team $teamteamid * @return user */ public function setteamteamid(\login\loginbundle\entity\team $teamteamid = null) { $this->teamteamid = $teamteamid; homecoming $this; } /** * teamteamid * * @return \login\loginbundle\entity\team */ public function getteamteamid() { homecoming $this->teamteamid; } }

what proper way edit security.yml file , acces database users?

php symfony2

objective c - How do I animate and move a circle across a bezier path? -



objective c - How do I animate and move a circle across a bezier path? -

hey i'm pretty new objc , coding in general. want create circle move across uibezier path (close sin function) 1 'unit' every hr , create shadow little , yellow, brigger , white, little , dim 1 time again moves , downwards curve. crest of sin function should midday (noon), , 'tails' of curve should midnight on both sides. possible? , can find resources help me? couldn't seem find online help me since don't know need accomplish this. thanks!

you utilize cakeyframeanimation class move view along path. create path, , animate position property of view's layer. illustration of in apple's core animation documentation in "using keyframe animation alter layer properties" section. other things want shadow, can done cabasicanimation. can animate shadow's color, offset, radius, path, , opacity.

objective-c uibezierpath

windows - How to check if port is in use (remote machine) -



windows - How to check if port is in use (remote machine) -

is there possibility check if specific port on remote windows machine (for illustration 3389 rdp) in use? localy utilize netstat, want check remotely. can telnet? or something?

edit: tried portqry (proposed user3365848: http://www.gfi.com/blog/scan-open-ports-in-windows-a-quick-guide/), give me info if scheme listening on 3389 port, not if have active rdp session. or maybe i'm doing wrong?

windows port telnet netstat

CSS Remove after if element has two classes -



CSS Remove after if element has two classes -

say have next css :after

<div class="bob"></div> .bob:after{ background:#ff0000; height:10px; width:10px; }

is possible remove after using sec class?

<div class="bob geff"></div> .bob:after{ background:#ff0000; height:10px; width:10px; } .bob.geff:after{ background:none; height:0px; width:0px; }

your :after won't have effect unless assign content. default value content none,

.bob:after{ content:''; background:#ff0000; display: inline-block; height:10px; width:10px; } .bob.geff:after{ content: none; }

should work. fiddle

css

c - change of one pointer affect other pointer -



c - change of one pointer affect other pointer -

how possible komv->next become null on code before end of while loop? notice become null after line town->previous->next=town->next cant understand why happened. programme terminated segmentation fault.

komv=list->first; while ((komv->next)!=null) { if(town->num>=komv->next->num) { town->previous->next=town->next; if(town->next!=null) town->next->previous=town->previous; town->next=komv->next; town->previous=komv; komv->next->previous=town; // gdb komv->next=null komv->next=town; break; } komv=komv->next; }

if komv node preceding town in list, town->previous == komv. if town lastly node town->next == null. when true @ same time, this:

town->previous->next=town->next;

reduces to:

komv->next = null;

in case, looks there no need modify list, prepare problem modifying status to

if ((town != komv->next) && (town->num >= komv->next->num)) {

there might improve solution, too, depending on assumptions , behavior want. example, if acceptable insert town after nodes having same num instead of before, utilize condition:

if (town->num > komv->next->num) {

c pointers struct

php - Symfony 2.5 & twig: how to clean up this code? -



php - Symfony 2.5 & twig: how to clean up this code? -

i'm new symfony , utilize best-practices possible. code below works feels kinda dirty.

i worry, if write much code here. maybe miss symfony-background-magic don't know yet. details below.

what alter (why)? appreciate every advice become improve developer. in advance!

routing.yml:

items_edit: path: /items/edit/{id} defaults: { _controller: mybundle:items:edit, id: null } # null = if not set? requirements: id: \d+

itemcontroller.php:

do have pass $item or info anyhow else gettable via twig?

public function editaction($id, request $request) { $em = $this->getdoctrine()->getmanager(); $repo = $em->getrepository('itemsrepo'); $item = $repo->find($id); $form = $this->createform(new itemformtype(), $item); if ($request->ismethod('post')) { $form->handlerequest($request); if ($form->isvalid()) { $em->persist($item); $em->flush(); $this->get('session')->getflashbag()->add('info', 'saved.'); homecoming $this->redirect($this->generateurl('items_list')); } } homecoming $this->render('edit.html.twig', array( 'form' => $form->createview(), 'item' => $item // !!! )); }

edit.html.twig:

do have add together {id: item.id} here?

{% block content %} <form action="{{ path('items_edit', {id: item.id}) }}" method="post" {{ form_enctype(form) }}> {# ... custom stuff ... #} {{ form_end(form) }} {% endblock %}

id: null \d+ requirement in route useless, because of you're editing existing entity, improve remove it; $em->persist($item); unnecessary, because of you've persisted , flushed on creation, time don't need persist again, flush it. abount passing $item form, if want show info user, "editing item title of some_title", or if there image field want show thumbnail .., can pass , retreive field value, it's u you.. additional note, /items/edit/{id} not pretty, it's done /items/{id}/edit, /items/{id}/delete...

php symfony2 doctrine twig yaml

Discard/stop tracking property value change (soapui project) -



Discard/stop tracking property value change (soapui project) -

i'm using soapui write tests, , git (sourcetree bitbucket) version control. after changes of properties value (after run), sourcetree prompt alter of file (value change).

is there way avoid these changes of properties values ? or discard manually?

you have 2 options:

discard changes, suggested. create little test case teardown script: testcase.setpropertyvalue(property, default), reset property value default.

personally give preference #2, not mess else checking stuff source control.

soapui

swing - Java: actionPerformed throws exceptions and refuses to work -



swing - Java: actionPerformed throws exceptions and refuses to work -

i working on programme takes txt file list of movies , selects random film it. working there gui problem. can't create jlabel alter text selected film when press button.

in fact, whatever set in actionperformed method refuses work , throws bunch of exceptions.

i not know how prepare since should working fine(at to the lowest degree me).

you can see in main method called system.out.println print out film list , works way. , tried putting same system.out.println command in actionperformed, didn't work.

here's code: moviepick.java

import java.awt.*; import java.awt.event.*; import javax.swing.*; public class moviepick implements actionlistener{ private jbutton button; private jlabel display; public static void main(string[] args) { readlist list = new readlist(); moviepick gui = new moviepick(); list.openfile(); list.readfile(); list.closefile(); gui.setup(); //this works system.out.println(list.getrandom()); } public void setup(){ jframe frame = new jframe("random film picker"); frame.setsize(250,100); frame.setresizable(false); frame.setlocationrelativeto(null); button = new jbutton("get random movie"); display = new jlabel("movie"); button.addactionlistener(this); button.setpreferredsize(new dimension(240,25)); frame.setlayout(new flowlayout(flowlayout.center)); frame.add(display); frame.add(button); frame.setvisible(true); } @override public void actionperformed(actionevent event){ readlist random = new readlist(); //this doesn't work display.settext(random.getrandom()); } }

readlist.java

import java.io.file; import java.util.arraylist; import java.util.scanner; public class readlist { private scanner f; private arraylist<string> thelist = new arraylist<string>(); public void openfile(){ try{ f = new scanner(new file("list.txt")); }catch(exception e){ system.out.println("file not found!"); } } public void readfile(){ while(f.hasnextline()){ thelist.add(f.nextline()); } } public void closefile(){ f.close(); } public void getlist(){ for(string mov : thelist){ system.out.println(mov); } } public string getrandom() { int rand = (int) (math.random()*thelist.size()); string chosenone = thelist.get(rand); homecoming chosenone; } }

the reason doesn't work because have these methods in main method, not in actionperformed one

list.openfile(); list.readfile(); list.closefile();

without those, these lines fail

int rand = (int) (math.random()*thelist.size()); string chosenone = thelist.get(rand); homecoming chosenone;

because thelist.size() 0, thelist.get(0) throws exception, since there nil in list get.

java swing exception actionevent

monotouch - UITapGestureRecognizer Crashes on iOS Simulator -



monotouch - UITapGestureRecognizer Crashes on iOS Simulator -

my ios simulator crashes when seek utilize uitapgesturerecognizer.

this gesture:

uitapgesturerecognizer tap = new uitapgesturerecognizer (new nsaction(delegate { if(settingstapped != null){ settingstapped(this, eventargs.empty); } }));

i adding gesture uiview , add together view uitableviewcell. app crashes after touching view (every time), showing no exception.

her output simulator log file:

nov 4 10:49:47 administorsmini xxxxx[11073]: assertion failed: 13e28 12b411: libsystem_sim_trace.dylib + 19982 [bee53863-0dec-33b1-bffb-8f7ae595cc73]: 0x4 nov 4 10:49:49 administorsmini xxxxx[11073]: stacktrace: nov 4 10:49:49 administorsmini xxxxx[11073]: @ <unknown> <0xffffffff> nov 4 10:49:49 administorsmini xxxxx[11073]: @ (wrapper managed-to-native) monotouch.uikit.uiapplication.uiapplicationmain (int,string[],intptr,intptr) <il 0x000a6, 0xffffffff> nov 4 10:49:49 administorsmini xxxxx[11073]: @ monotouch.uikit.uiapplication.main (string[],intptr,intptr) [0x00005] in /developer/monotouch/source/monotouch/src/uikit/uiapplication.cs:62 nov 4 10:49:49 administorsmini xxxxx[11073]: @ monotouch.uikit.uiapplication.main (string[],string,string) [0x00038] in /developer/monotouch/source/monotouch/src/uikit/uiapplication.cs:46 nov 4 10:49:49 administorsmini xxxxx[11073]: @ xxxxx.application.main (string[]) [0x00008] in /users/norman/desktop/xxxxx/xxxxx/main.cs:17 nov 4 10:49:49 administorsmini xxxxx[11073]: @ (wrapper runtime-invoke) <module>.runtime_invoke_void_object (object,intptr,intptr,intptr) <il 0x00050, 0xffffffff> nov 4 10:49:49 administorsmini xxxxx[11073]: native stacktrace: nov 4 10:49:49 administorsmini xxxxx[11073]: ================================================================= got sigsegv while executing native code. indicates fatal error in mono runtime or 1 of native libraries used application. ================================================================= nov 4 10:49:49 administorsmini com.apple.coresimulator.simdevice.27b5d497-b641-4bca-8fa0-ef9e28e07143.launchd_sim[10951] (uikitapplication:com.your-company.xxxxx[0x7041][11073]): service exited due signal: abort trap: 6 nov 4 10:49:49 administorsmini springboard[10962]: application 'uikitapplication:com.your-company.xxxxx[0x7041]' crashed. nov 4 10:49:49 administorsmini assertiond[10966]: notify_suspend_pid() failed error 7 nov 4 10:49:49 administorsmini assertiond[10966]: assertion failed: 13e28 12b411: assertiond + 11523 [3f572a0b-7e12-378d-afee-ea491baf2c36]: 0x1

what can now? don´t want develop on device...

edit

i ended overriding uiview , utilize touchesbegan() method. there many approaches create clickable why can´t utilize 1 above??

here's bit of code i'am using in application

private void addtapgesture() { imglogo.userinteractionenabled = true; var tapgesture = new uitapgesturerecognizer(this, new selector("resendtrigger:")); tapgesture.numberoftapsrequired = 5; imglogo.addgesturerecognizer(tapgesture); } [export("resendtrigger:")] public void resendtrigger(uigesturerecognizer sender) { system.diagnostics.debug.writeline("triggered");}

first argument of constructor (this) points object contains definition of method specified export attribute if define selector , method within view nsobject target reference of view if method want phone call exist illustration in cell cell reference target.editbased on comment assumed may using uitableviewsource . think case similar mine seek approach :declare event in uitablesource public event eventhandler<databasemodels.savedactions> onactionselected;then in getcell assign tap gesture view , within method have reference sender objec, cast uiview , retain tag identify corresponding record

ios monotouch xamarin uitapgesturerecognizer

PHP cut text from a specific word in an HTML string -



PHP cut text from a specific word in an HTML string -

i cutting every text ( image alt included ) in html string form specific word.

for illustration string:

<?php $string = '<div><a href="#"><img src="img.jpg" alt="cut text form here" />cut text form here</a></div>'; ?>

and output

<div> <a href="#"> <img src="img.jpg" alt="cut text" /> cutting text </a> </div>

the $string element of object didn't wanted set long code here. can't utilize explode because kill html markup. , str_replace or substr out because length before or after word needs cutting not constant.

so can achive this?

ok solved problem , post reply question because help someone.

so did:

<?php $string = '<div><a href="#"><img src="img.jpg" alt="cut text form here" />cut text form here</a></div>'; $txt_only = strip_tags($string); $explode = explode(' from', $txt_only); $find_txt = array(' from', $explode[1]); $new_str = str_replace($find_txt, '', $string); echo $new_str; ?>

this might not best solution quick , did not involve dom parse. if wants seek create sure href or src or ather attribute needs untouched doesn't have of chars in same way , order in $find_txt else replace too.

php string

ios - Can't set cell title's text -



ios - Can't set cell title's text -

i'm writing simple notes app, when seek assign title note.title got error.

-(notez*)createnotewithtitle:(nsstring*)titlenote andtext:(nsstring*)textnote { notez *newnote = [notez new]; if (!_notesarray) { _notesarray = [nsmutablearray new]; } newnote.datecreated = [nsdate new]; newnote.title = [nsstring stringwithformat:@"23"]; newnote.text = [nsstring stringwithformat:@"233"]; [_notesarray addobject:newnote]; homecoming newnote; }

notez.h : #import

@interface notez : nsobject @property nsstring *text; @property nsstring *title; @property nsdate* datecreated; -(notez*)createnotewithtitle:(nsstring*)title andtext:(nsstring*)text; -(void)save; +(instancetype)sharedmanager; -(nsarray*)sortednotes; -(void)removenoteatindex:(nsuinteger)index; @end

note.datecreated ok, note.title , note.text isn't.

they both nsstring...

- (ibaction)addnote:(id)sender { [[notez sharedmanager] createnotewithtitle:@"note title" andtext:@"note text"]; }

since declared title , text properties, reason exception: [notez settitle:]: unrecognized selector sent instance, apparently

i can create guess here. usually, when declaring property, setter , getter method it. way can omit writing these hand if have lot of instance variables on class.

using dot notation equivalent calling setter or getter. in case

newnote.title = [nsstring stringwithformat:@"23"];

is equivalent to:

[newnote settitle:[nsstring stringwithformat:@"23"]];

now, exception suggests setter method: settitle: not exist on object. i'm not sure reason might be, seek explicitly synthesize properties.

therefor, in .m-file add together next lines of code:

@synthesize title; @synthesize text;

not sure if solve issue, hope explanation of properties, getters , setters helps understand little more what's going on.

ios objective-c nsstring

.net - C# Set Variable in Thread -



.net - C# Set Variable in Thread -

i'm trying work threads private project , have question is, think easy answer.

is possible set variable in thread?

here little code illustration show i'm trying do:

public class partyclass { public boolean partytime = true; public void makeparty() { while(partytime) console.writeline("i'm making party here"); console.writeline("the party ended. please leave now"); } public void stopparty() { partytime = false; } } public class mainthread { public static int main(string[] args) { partyclass party = new partyclass(); thread partythread = new thread(new threadstart(party.makeparty())); partythread.start(); while (!partythread.isalive) ; system.threading.thread.sleep(5000); // want somehow phone call stopparty() method } }

i don't know if it's stupid i'm trying think nice way stop "partythread" in clean way.

is possible or there improve solution this? ideas.

(i didn't test code - wrote out of head)

you phone call stop method way called start method:

party.stopparty();

in order ensure changes made in thread aren't cached, partytime field should marked volatile well.

c# .net multithreading network-programming threadpool

android - How do you filter by application name wildcard using logcat command line -



android - How do you filter by application name wildcard using logcat command line -

so in eclipse, filter app:com.foo, , com.foo, com.foo.bar, com.foo.baz, etc...

is there way on command line?

reference: http://developer.android.com/tools/debugging/debugging-log.html

from command line, can filter logcat messages tag , level. example

adb logcat myapplicationtag:i *:s

will show of messages "myapplicationtag" tag, @ info level (note ":i") or above. "*:s" silences other message.

==================================

to show messages multiple tags:

adb logcat myapplicationtag:i com.foo.bar:i com.foo.baz:i *:s

==================================

to accomplish asked (filtering via wildcard specification), allow shell filtering. seek following:

adb logcat | grep ^./com\.foo*

android command-line android-logcat

How can i dynamically change the tray icon image in JavaFX like dropbox tray icon -



How can i dynamically change the tray icon image in JavaFX like dropbox tray icon -

in dropbox, tray icon dynamically change. when file uploading, sync icon shown. when file synchronized, dropbox show other icon(latest status icon).

https://mockupstogo.mybalsamiq.com/projects/icons/dropbox

i want develop same function using javafx

at first call, trayicon.setimage working (blue color tray icon shown). sec call, not working (gray color tray icon not shown). show empty box.

is javafx bugs?

package application; import java.awt.dimension; import java.awt.graphics; import java.awt.image.bufferedimage; import java.io.ioexception; import java.text.dateformat; import java.text.simpledateformat; import java.util.date; import java.util.timer; import java.util.timertask; import javafx.application.application; import javafx.application.platform; import javafx.geometry.pos; import javafx.scene.node; import javafx.scene.scene; import javafx.scene.control.label; import javafx.scene.control.treeview; import javafx.scene.layout.stackpane; import javafx.scene.layout.vbox; import javafx.scene.paint.color; import javafx.stage.stage; import javafx.stage.stagestyle; public class main extends application { // 1 icon location shared between application tray icon , task bar icon. // utilize multiple icons allow clean display of tray icons on hi-dpi devices. //private static final string iconimageloc = // "http://icons.iconarchive.com/icons/scafer31000/bubble-circle-3/16/gamecenter-icon.png"; //private static final string iconimageloc1 = // "http://icons.iconarchive.com/icons/icons-land/metro-halloween/96/cauldron-icon.png"; // application stage stored can shown , hidden based on scheme tray icon operations. private stage stage; // timer allowing tray icon provide periodic notification event. private timer notificationtimer = new timer(); // format used display current time in tray icon notification. private dateformat timeformat = simpledateformat.gettimeinstance(); private treeview<string> treeview; // sets javafx application. // tray icon setup icon, main stage remains invisible until user // interacts tray icon. @override public void start(final stage stage) { // stores reference stage. this.stage = stage; // instructs javafx scheme not exit implicitly when lastly application window shut. platform.setimplicitexit(false); // sets tray icon (using awt code run on swing thread). javax.swing.swingutilities.invokelater(this::addapptotray); // out stage translucent, give transparent style. stage.initstyle(stagestyle.transparent); // create layout javafx stage. stackpane layout = new stackpane(createcontent()); layout.setstyle( "-fx-background-color: rgba(255, 255, 255, 0.5);" ); layout.setprefsize(300, 200); // dummy app hides when app screen clicked. // real app might have interactive ui , separate icon hides app window. layout.setonmouseclicked(event -> stage.hide()); // scene transparent fill necessary implement translucent app window. scene scene = new scene(layout); scene.setfill(color.transparent); stage.setscene(scene); } /** * dummy app, (javafx scenegraph) content, says "hello, world". * real app, might load fxml or that. * * @return main window application content. */ private node createcontent() { label hello = new label("hello, world"); hello.setstyle("-fx-font-size: 40px; -fx-text-fill: forestgreen;"); label instructions = new label("(click hide)"); instructions.setstyle("-fx-font-size: 12px; -fx-text-fill: orange;"); vbox content = new vbox(10, hello, instructions); content.setalignment(pos.center); homecoming content; } /** * sets scheme tray icon application. */ private void addapptotray() { seek { // ensure awt toolkit initialized. java.awt.toolkit.getdefaulttoolkit(); // app requires scheme tray support, exit if there no support. if (!java.awt.systemtray.issupported()) { system.out.println("no scheme tray support, application exiting."); platform.exit(); } // set scheme tray icon. java.awt.systemtray tray = java.awt.systemtray.getsystemtray(); /* url imageloc = new url( iconimageloc ); url imageloc1 = new url( iconimageloc1 ); java.awt.image image = imageio.read(imageloc); java.awt.image image1 = imageio.read(imageloc1);*/ dimension size = tray.gettrayiconsize(); bufferedimage bi = new bufferedimage(size.width, size.height, bufferedimage.type_int_rgb); graphics g = bi.getgraphics(); g.setcolor(java.awt.color.blue); g.fillrect(0, 0, size.width, size.height); system.out.println(size.width); system.out.println(size.height); java.awt.trayicon trayicon = new java.awt.trayicon(bi); // if user double-clicks on tray icon, show main app stage. trayicon.addactionlistener(event -> platform.runlater(this::showstage)); // if user selects default menu item (which includes app name), // show main app stage. java.awt.menuitem openitem = new java.awt.menuitem("hello, world"); openitem.addactionlistener(event -> platform.runlater(this::showstage)); // convention tray icons seems to set default icon opening // application stage in bold font. java.awt.font defaultfont = java.awt.font.decode(null); java.awt.font boldfont = defaultfont.derivefont(java.awt.font.bold); openitem.setfont(boldfont); // exit application, user must go scheme tray icon // , select exit option, shutdown javafx , remove // tray icon (removing tray icon shut downwards awt). java.awt.menuitem exititem = new java.awt.menuitem("exit"); exititem.addactionlistener(event -> { notificationtimer.cancel(); platform.exit(); tray.remove(trayicon); }); // setup popup menu application. final java.awt.popupmenu popup = new java.awt.popupmenu(); popup.add(openitem); popup.addseparator(); popup.add(exititem); trayicon.setpopupmenu(popup); // create timer periodically displays notification message. notificationtimer.schedule( new timertask() { @override public void run() { javax.swing.swingutilities.invokelater(() -> trayicon.displaymessage( "hello", "the time " + timeformat.format(new date()), java.awt.trayicon.messagetype.info ) ); system.out.println(size.width); system.out.println(size.height); bufferedimage bi = new bufferedimage(size.width, size.height, bufferedimage.type_int_rgb); graphics g = bi.getgraphics(); g.fillrect(0, 0, size.width, size.height); g.setcolor(java.awt.color.gray); trayicon.setimage(bi); } }, 5_000, 60_000 ); // add together application tray icon scheme tray. tray.add(trayicon); //trayicon.setimage(image1); //} grab (java.awt.awtexception | ioexception e) { } grab (java.awt.awtexception e) { system.out.println("unable init scheme tray"); e.printstacktrace(); } } /** * shows application stage , ensures brought ot front end of stages. */ private void showstage() { if (stage != null) { stage.show(); stage.tofront(); } } public static void main(string[] args) throws ioexception, java.awt.awtexception { // launches javafx application. // due way application coded, application remain running // until user selects exit menu alternative tray icon. launch(args); } }

i think problem in different image sizes , alter sec icon sizes of first!

javafx javafx-2 awt javafx-8 trayicon

javascript - When to exit when using nested open() functions? -



javascript - When to exit when using nested open() functions? -

i encountered problems in utilize of phantomjs. refer this article. tried nest open() functions, did not results want namely opening 4 urls , printing 4 console.logs.

code :

var page = require('webpage').create(); //新建一个页面 url1 = "-----"; url2 = "-----"; url3 = "-----"; url4 = "http://-----/"; page.open(url1, function(status) { //导航到第一个url console.log('111111111111'); if (status == "fail") phantom.exit(); //如果发生错误,退出程序 page.open(url2, function(status) { //否则在页面加载完成的回调函数中继续导航到第二个url,依次类推 console.log('22222222222222'); if (status == "fail") phantom.exit(); page.open(url3, function(status) { console.log('3333333333333333'); if (status == "fail") phantom.exit(); page.open(url4, function(status) { console.log('444444444444444'); if (status == "fail") phantom.exit(); }); }); }); console.log('close'); phantom.exit(); });

result:

$ phantomjs test.js 111111111111 close

you have exit phantomjs when you're done executing , seems done after open url4:

page.open(url1, function(status) { console.log('111111111111'); if (status == "fail") phantom.exit(); page.open(url2, function(status) { console.log('22222222222222'); if (status == "fail") phantom.exit(); page.open(url3, function(status) { console.log('3333333333333333'); if (status == "fail") phantom.exit(); page.open(url4, function(status) { console.log('444444444444444'); if (status == "fail") phantom.exit(); console.log('close'); phantom.exit(); }); }); }); });

phantomjs asynchronous nicolas says in blog. you're exiting early.

javascript phantomjs

javascript - Backbone large scale web application -



javascript - Backbone large scale web application -

i having problem getting started big scale backbone web application, have api built , ready use, , have decided utilize backbone create front end end. under model/view/collection organisation of backbone, struggling how utilize router, little breakdown of our app on dashboard user greeted list of items. clicking item launches view view modal window, @ point want url alter #dashboard #item/edit/9 (9 beingness item id) link can emailed , same model open recipient.

what best practices when creating big scale backbone applications, around routing , file organisation.

javascript backbone.js

neo4j - Cypher FOREACH MERGE not hitting the index -



neo4j - Cypher FOREACH MERGE not hitting the index -

i've got next parametrized cypher query:

merge (p:person {pid: {personid}}) on create set p.value=rand() merge (c:page {url: {pageurl}}) on create set c.value=rand() merge p-[:rel]->c foreach (tagvalue in {tags} | merge (t:tag {value:tagvalue}) merge c-[:hastag]->t)

this slow, profiling shows:

emptyresult | +updategraph(0) | +eager(0) | +updategraph(1) | +eager(1) | +updategraph(2) +----------------+------+--------+------------------------------+------------------------------------------------------------------------------+ | operator | rows | dbhits | identifiers | other | +----------------+------+--------+------------------------------+------------------------------------------------------------------------------+ | emptyresult | 0 | 0 | | | | updategraph(0) | 1 | 79222 | | foreach | | eager(0) | 1 | 0 | | | | updategraph(1) | 1 | 5 | p, c, unnamed163 | mergepattern | | eager(1) | 1 | 0 | | | | updategraph(2) | 1 | 14 | p, p, c, c | mergenode; {personid}; :person(pid); mergenode; {pageurl}; :page(url) | +----------------+------+--------+------------------------------+------------------------------------------------------------------------------+ total database accesses: 79241

as can see, it's apparently not using index i've defined on :tag(value)

any ideas how prepare this? i'm running out of ideas , i'm starting think might connected https://github.com/neo4j/neo4j/issues/861

fyi, merges convenient me , query matches (or if worked:) usage need info ingestion.

hmmm, utilize index if utilize unwind instead of foreach?

merge (p:person {pid: {personid}}) on create set p.value=rand() merge (c:page {url: {pageurl}}) on create set c.value=rand() merge p-[:rel]->c c unwind {tags} tagvalue merge (t:tag {value:tagvalue}) merge c-[:hastag]->t

neo4j cypher

angularjs - Protractor E2E Test - Blocked Browser Plugins -



angularjs - Protractor E2E Test - Blocked Browser Plugins -

i creating suite of tests rich angular app in protractor. site requires macromedia , proprietary plugin operate appropriately. have manually set "always allowed" flag on relevant plugins. when these plugins fail initialize, detection automatically prompts user install/update plugin. since browser blocks them when beingness run on selenium server, blocks standard anticipated flow of attempted e2e test.

right focusing on chrome testing.

is there setting haven't been able sleuth out either way permanently allow these in spawned chrome instance(s) or speedy plenty cursor allow blocked plugins.

can point me @ method of allowing these plugins?

about 30 seconds after posting question, found answer.

in protractor config file, adding capabilities chromeoptions :{args:['--always-authorize-plugins']} did trick.

class="snippet-code-js lang-js prettyprint-override">exports.config = { //... capabilities: { browsername: 'chrome', chromeoptions: { args: ['--always-authorize-plugins'] } } //... };

angularjs protractor npapi ppapi

python - Custom aggregate annotation in Django -



python - Custom aggregate annotation in Django -

i have many groups each has revision , each revision has months.

i want output grouping objects annotation.

for each grouping should select latest revision , sum months.

i'm not sure if can done in django. tried like

group.objects.annotate( month_sum=revision.objects.filter(date__lte=my_date).latest('date').aggregate(sum('months__amount')) )

and hoped queryset groups each has sum month_sum.

can seek one:

qs = group.objects.filter(revision__date__lte=my_date).annotate(month_sum=sum('months__amount'))

you can debug , seek undestand how create right query printing generated db query in shell:

print str(qs.query)

edit:

to show groups old revision think django-aggregate-if may help you

run pip install django-aggregate-if

from django.db.models import q aggregate_if import sum revision = revision.objects.filter(revision__date__lte=my_date).latest() qs = group.objects.all().annotate(month_sum=sum('months__amount', only=q(revision=revision)))

python django django-models django-views django-queryset

postgresql - SQL Reactivation Revenue -



postgresql - SQL Reactivation Revenue -

i'm looking query sum reactivation revenue given date on. have next query;

select advertisable, extract(year day), extract(month day), round(sum(cost)/1e6) adcube dac advertisable_eid in (select advertisable adcube dac grouping advertisable having sum(cost)/1e6 > 100) grouping advertisable, extract(year day), extract(month day) order advertisable, extract(year day), extract(month day)

from export excel , check accounts thay have stopped spending 4 months , reactivated. track new revenue new reactivtion month.

is possible sql query without need of excel?

thanks

assuming 4 months nowadays in data, can using window functions. can find n things in row taking difference between 2 row_numbers(). here idea:

with t ( select advertisable, extract(year day) yy, extract(month day) mon, round(sum(cost)/1e6) val adcube dac advertisable_eid in (select advertisable adcube dac grouping advertisable having sum(cost)/1e6 > 100 ) grouping advertisable, extract(year day), extract(month day) ) select advertisable, min(yy * 10000 + mon) yyyymm (select t.*, (row_number() on (partition advertisable order yy, mon) - row_number() on (partition advertisable, val order yy, mon) ) grp t ) grouping advertisable, grp, val having count(*) >= 4 , val = 0;

sql postgresql

unix - sql output as a list in ksh -



unix - sql output as a list in ksh -

i have script sql output of function multiple rows (one column) , i'm trying loop through loop function can't seem work...

rslt=sqlquery {} echo $rslt 1 2 3 4 in $rslt echo "lvl$i" done

but loop...i maintain getting 4 times

lvl1 2 3 4

where want back...

lvl1 lvl2 lvl3 lvl4

how that?

to loop on values in ksh array, need utilize ${array[@]} syntax:

$ set -a rslt 1 2 3 4 $ in ${rslt[@]} > > echo "lvl$i" > done lvl1 lvl2 lvl3 lvl4

unix ksh

.htaccess - default language root level -



.htaccess - default language root level -

hi i run multilingual website organized follow: site.com/fr/ (france), site.com/be/ (belgium), site.com/uk/ (uk) ... , site.com page can select countries/ languages.

i heard , read it's not practice so, should rather set default language site.com

my question are: 1- should add together illustration english language default language? 2- remove /fr/ , set permanent redirect root (.com/fr/product redirected .com/product) 3- or maybe have improve suggestions?

thanks much in advance

i same thing 1 of sites. but, in php, alter position of root (with or without /fr/ links). way can utilize default language: site.com/

i take language automatically, user browser language preferences. first page, , after link right language (or others links). me, it's best seo solution.

i have add together rel="canonical" link elements, avoid duplicate or similar content: google: utilize canonical urls

.htaccess seo url-redirection

python - How can I exponentially scale the Y axis with matplotlib -



python - How can I exponentially scale the Y axis with matplotlib -

i'm trying create matplotlib plot exponential(?) y axis false 1 i've mocked below. info want spread values out approach max y value. , i'd compress values y gets close zero.

all normal 'log' examples opposite: compress values away zero. 'log' of course. how can create exponential(?) scaling instead?

i assume mean x axis because in mock figure, x axis exponential, not y axis.

you can this:

... ax = plt.subplot(111) ax.plot(xs,ys,color='blue',linewidth=2) .... xlabs = [pow(10,i) in range(0,6)] ax.set_xticklabels(xlabs) ax.set_xticks(xlabs)

what doing here manually creating list of 6 xs each represented 10^i, i.e., 10^1,10^2,.... set x tick marks, , label them correctly, @ [1, 10, 100, 1000, 10000, 100000]. if need more labels, alter 6.

python matplotlib

c++ - Is it possible to disable google test assertions with some macro? -



c++ - Is it possible to disable google test assertions with some macro? -

consider have hot function loop , there gtest assertion in it:

for (i = 0; < big_number; i++) { expect_true(a[i] > 0.) << "a[i] = " << a[i]; c[i] = a[i] + b[i]; }

i want have 2 different build types program:

with assertions enabled (debug type) with assertions disabled (release type)

is possible?

maybe possible re-define macro expect_true?

first, can't imagine wanting this, except locally, create tests run faster more exotic cases; expect_true et al. useful in google test environment, , should appear in unit tests, not in body of code.

locally, i'd utilize separate macro (so reading code knows immediatly conditional test), cond_expect_true (for conditional expect_true), defined like:

#ifdef all_tests #define cond_expect_true expect_true #else #define cond_expect_true dummyoutput #endif

, dummyoutput unopened std::ofstream somewhere. (or if want sure, can define nullstream class, outputs lean air. in case, , conversions in output still occur; in unopened std::ofstream, fact in error state inhibits conversions.)

c++ macros googletest

Soundcloud add songs to playlist (ios) -



Soundcloud add songs to playlist (ios) -

this problem has troubled me 1 day, without associated cocoa code examples on soundcoud. feeling defeated, hope help

i used afnetworking , illustration here work: https://github.com/soundcloud/soundcloud-ruby

[parameters setobject:@"your token" forkey:@"oauth_token"]; [[afnetworkingclient sharedclient] get:[nsstring stringwithformat:@"me/playlists/%@.json",@"some id"] parameters:parameters success: ^(nsurlsessiondatatask *task, id responseobject) { nsmutablearray * ids = [[nsmutablearray alloc]init]; (id trackdictionary in [responseobject objectforkey:@"tracks"]) { track * track = [[track alloc]initwithdictionary:trackdictionary error:nil]; [ids addobject:track.id]; } // ids [ids addobject:@"new id"]; // add together new id array nsmutablearray * idarray = [[nsmutablearray alloc]init]; (nsnumber *idnumber in ids) { [idarray addobject:@{@"id":idnumber}]; // create array of dictionarys } //[{@"id":23232},{@"id":345454}] nsmutabledictionary * parameters = [[nsmutabledictionary alloc]init]; [parameters setobject:@"your token"]; [parameters setobject:@{@"tracks":idarray} forkey:@"playlist"]; [[afnetworkingclient sharedclient] put:[nsstring stringwithformat:@"me/playlists/%@.json",playlist.id] parameters:parameters success: ^(nsurlsessiondatatask *task, id responseobject) { } failure: ^(nsurlsessiondatatask *task, nserror *error) { }]; } failure: ^(nsurlsessiondatatask *task, nserror *error) { }];

ios soundcloud

rust - Implementing trait for multiple newtypes at once -



rust - Implementing trait for multiple newtypes at once -

i have bunch newtypes wrapping string object:

#[deriving(show)] struct is(pub string); #[deriving(show)] struct hd(pub string); #[deriving(show)] struct ei(pub string); #[deriving(show)] struct rp(pub string); #[deriving(show)] struct pl(pub string);

now, #[deriving(show)], produces next output: ei(mystringhere), , output mystringhere. implementing show explicitly works, there way implement these newtypes @ once?

there no such way in language itself, can employ macros easily:

#![feature(macro_rules)] struct is(pub string); struct hd(pub string); struct ei(pub string); struct rp(pub string); struct pl(pub string); macro_rules! newtype_show( ($($t:ty),+) => ($( impl ::std::fmt::show $t { fn fmt(&self, f: &mut ::std::fmt::formatter) -> ::std::fmt::result { write!(f, "{}", self.0[]) } } )+) ) newtype_show!(is, hd, ei, rp, pl) fn main() { allow hd = hd("abcd".to_string()); println!("{}", hd); }

(try here)

rust

javascript - Add modules to my Angular App Dynamically -



javascript - Add modules to my Angular App Dynamically -

how can load modules(selected based on user after logged in) in angular app dynamically?

lazy loading modules in angular not trivial task can done. here article regarding topic:

http://web.archive.org/web/20150513130815/http://blog.getelementsbyidea.com/load-a-module-on-demand-with-angularjs/

the related code can fount on github: oclazyload

javascript angularjs angularjs-module

c# - How do I rewrite this code to accept user input? -



c# - How do I rewrite this code to accept user input? -

i have next code prints area of right triangle. can see dimensions of triangles hard coded program. wish user input values x , y. how go changing below programme user prompted come in these values?

public class triangle { private int height, length; public triangle(int x, int y) { length = x; height = y; } public double triarea() { double area; area = 0.5 *(height * length); homecoming area; } } class trianglearea { public static void main() { triangle tri1 = new triangle(15, 10); console.writeline("area 1=" + tri1.triarea()); triangle mytriangle = new triangle(12, 5); console.writeline("my triangle area =" + mytriangle.triarea()); console.readline(); } } }

a naïve approach following.

console.writeline("add integer x: "); int x = convert.toint32(console.readline()); console.writeline("add integer y: "); int y = convert.toint32(console.readline()); triangle tri1 = new triangle(x, y); console.writeline("area 1=" + tri1.triarea());

a more robust approach validate user input , have input loop user can calculate area of more 1 triangle. following:

static void main(string[] args) { bool keepprompting = true; while (keepprompting) { bool wehavevalidxvalue = false; int x = 0, y = 0; while (!wehavevalidxvalue) { console.writeline("enter value x , press return:"); string xvalue = console.readline(); wehavevalidxvalue = int.tryparse(xvalue, out x); if (!wehavevalidxvalue || x <= 0) { wehavevalidxvalue = false; console.writeline("invalid value"); } } bool wehavevalidyvalue = false; while (!wehavevalidyvalue) { console.writeline("enter value y , press return:"); string yvalue = console.readline(); wehavevalidyvalue = int.tryparse(yvalue, out y); if(!wehavevalidyvalue || y <= 0) { wehavevalidyvalue = false; console.writeline("invalid value"); } } triangle mytriangle = new triangle(x, y); console.writeline("my triangle area = {0}", mytriangle.triarea()); console.writeline("continue? (y/n)"); string response = console.readline(); if(response.equals("n", stringcomparison.invariantcultureignorecase)) { keepprompting = false; } } }

c#

javascript - Add Hidden Input onCheck -



javascript - Add Hidden Input onCheck -

can tell me best way go adding hidden input field form when user checks checkbox , remove if user unchecks checkbox?

below form post paypal. have build of fields before post. want include checkbox in form when clicked add together hidden field "pet fee".

<form id='paypalcheckout' action='https://www.paypal.com/cgi-bin/webscr' method='post' style="margin-bottom: 10px"> <input type="hidden" name="item_name_1" value="demo holiday home" /> <input type="hidden" name="item_number_1" value="demo-vacation-home" /> <input type="hidden" name="amount_1" value="4" /> <input type="hidden" name="quantity_1" value="1" /> <input type="hidden" name="item_name_2" value="refundable harm deposit" /> <input type="hidden" name="item_number_2" value="refundable-damage-deposit" /> <input type="hidden" name="amount_2" value="3" /> <input type="hidden" name="quantity_2" value="1" /> <input type="hidden" name="item_name_3" value="cleaning fee" /> <input type="hidden" name="item_number_3" value="cleaning-fee" /> <input type="hidden" name="amount_3" value="2" /> <input type="hidden" name="quantity_3" value="1" /> <input type="hidden" name="item_name_4" value="12% reservation fee" /> <input type="hidden" name="item_number_4" value="12%-reservation-fee" /> <input type="hidden" name="amount_4" value="0.48" /> <input type="hidden" name="quantity_4" value="1" /> <input type="hidden" name="item_name_5" value="8% taxation rate" /> <input type="hidden" name="item_number_5" value="8%-tax-rate" /> <input type="hidden" name="amount_5" value="0.32" /> <input type="hidden" name="quantity_5" value="1" /> <input type='hidden' name='business' value='juliocpreciado@gmail.com' /> <input type='hidden' name='shopping_url' value='http://www.dreamhomevacationrentals.com/cart/' /> <input type='hidden' name='lc' value='en_us' /> <input type='hidden' name='cmd' value='_cart' /> <input type='hidden' name='charset' value='utf-8'> <input type='hidden' name='upload' value='1' /> <input type='hidden' name='no_shipping' value='2' /> <input type='hidden' name='currency_code' value='usd' id='currency_code' /> <input type='hidden' name='custom' value='|||' /> <input type='hidden' name='notify_url' value='http://www.dreamhomevacationrentals.com/store/ipn/'> <input type='hidden' name='return' value='http://www.dreamhomevacationrentals.com/thank-you/' /> <input id='paypalcheckoutbutton' type='image' src='https://www.paypal.com/en_us/i/btn/btn_xpresscheckout.gif' value='checkout paypal' /> </form>

to create hidden replace type="text" type="hidden" :)

jquery:

<form id="myform"> <input onclick="addremovehiddeninput('testid', 'testname', 'testvalue')" type="checkbox" id="mc" name="paymentmethod" value="mastercard"><label for="mc"> mastercard</label> </form> <script> function addremovehiddeninput(id, name, value) { if ( $('#' + id).length > 0 ) { $('#' + id).remove(); } else { $('#myform').append('<input type="text" name="' + name + '" value="' + value + '" id="' + id + '" />'); } } </script>

fiddle: http://jsfiddle.net/9w5g3swr/

plain javascript:

<form id="myform"> <input onclick="addremovehiddeninput('testid', 'testname', 'testvalue')" type="checkbox" id="mc" name="paymentmethod" value="mastercard"><label for="mc">mastercard</label> </form> <script> function addremovehiddeninput(id, name, value) { var hiddeninput = document.getelementbyid(id); if ( hiddeninput != null ) { hiddeninput.parentnode.removechild(hiddeninput); } else { document.getelementbyid('myform').innerhtml = document.getelementbyid('myform').innerhtml + '<input type="text" name="' + name + '" value="' + value + '" id="' + id + '" />'; } } </script>

fiddle: http://jsfiddle.net/uu1ftnhg/

javascript jquery forms function

xcode6 - Landscape game using swift in xcode 6 -



xcode6 - Landscape game using swift in xcode 6 -

in gameviewcontroller

override func viewdidload() { super.viewdidload() } override func viewdidlayoutsubviews() { if allow scene = gamescene.unarchivefromfile("gamescene") as? gamescene { // configure view. allow skview = self.view skview var boo = bool(); boo = true; skview.showsfps = boo; skview.showsnodecount = boo; skview.showsphysics = boo; skview.showsfps = true skview.showsnodecount = true /* sprite kit applies additional optimizations improve rendering performance */ skview.ignoressiblingorder = true /* set scale mode scale fit window */ scene.scalemode = .aspectfill skview.presentscene(scene) } }

and in didmovetoview

var hero = skspritenode(color: uicolor.redcolor(), size: cgsize(width: 40, height: 40)); allow hero_body = skphysicsbody(rectangleofsize: hero.size); hero.position = cgpoint(x:self.frame.size.width/2, y:50); self.addchild(hero)

i dont understand how position work.. when y 50, rectangle not showing. before in xcode 5 objective-c in order node in bottom of screen do

-self.frame.size.height/2 + hero.size.height/2

but in here doesn't work

the comment right. -self.frame.size.height/2 + hero.size.height/2 worked when anchor point cgpointmake(0.5f,0.5f); seems in case anchor point never changed (0,0). alter it, utilize self.anchorpoint = cgpointmake(0.5f, 0.5f); method in scene.

swift xcode6 landscape

android - Send uiautomator command over Command Line and get a return value -



android - Send uiautomator command over Command Line and get a return value -

i'm working android uiautomtor , want confirm pop-up-windows bluetooth requests. pop-up appears when want turn on bluetooth visibility. have confirm pressing button text "yes". phone call method of uiautomator using command line pc , works well!

i utilize code:

uiobject obj; boolean success; obj = new uiobject(new uiselector().text("yes")); success = obj.click();

this code working in test automation testing ui of android device. programm, calls method, runs long time , want know if button clicked correctly or not. click()-method returns true if id of ui-object found. need homecoming value analyze tests.

so here question:

is possible return/send boolean value of click()-method uiautomator testcase class command line?

if want see value of "success", use:

system.out.println("success = " + success);

it's not clear me if want farther utilize value in other parts of program.

android android-testing android-uiautomator

java - Is it possible to deploy war file into WebSphere 7? -



java - Is it possible to deploy war file into WebSphere 7? -

i able deploy ear file 7. same project unable deploy war file websphere 7. possible deploy war file websphere 7?

websphere 7 java-ee 5 application server , provides both ejb , servlet container. it's indeed possible deploy war.

if web-application (war) part of java-ee application (ear) have bundle within ear, otherwise can deploy alone.

see packaging application

java websphere

python resize image without losing sharpness -



python resize image without losing sharpness -

from pil import image import sys image = image.open(sys.argv[1]) basewidth = 1200 img = image wpercent = (basewidth / float(img.size[0])) hsize = int((float(img.size[1]) * float(wpercent))) img = img.resize((basewidth, hsize), image.bicubic) img.save('sompic1.jpg') print "image %s" % (str(img.size))

i want resize 1200xauto , without losing ratio image must maintain shartness etc etc.

but resized images somehow destroyed in sharpness. used antialias also, no change. how possible not lose sharpness?

original image: (600x450)

new 1 (1200x630):

you trying resize image larger size original, normal loose quality.

to resize image smaller size, may have @ module created: python-image-resize

image python-2.7 python-imaging-library

jquery - place javascript function result inside html tag -



jquery - place javascript function result inside html tag -

i want insert homecoming value of function tags attribute value in html

<video width="400" controls="controls"> <source src="xxxxx" /> </video> function returnvideolink() { homecoming "aa.mp4"; }

in above codes want functions homecoming value in above video tags src field marked xxxx

use jquery code:

<script src="//ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script> <script> function returnvideolink() { homecoming "aa.mp4"; } $(function(){ var src = returnvideolink(); $('source').attr('src', src); }); </script>

javascript jquery html html5

Possible to visualize neo4j graph in ruby on rails application? -



Possible to visualize neo4j graph in ruby on rails application? -

i'm quite novice neo4j. find out if can query neo4j database ruby on rails application , utilize result create graph visualization in application. have looked @ d3.js, problably can it. know if possible utilize graphgist in ruby on rails application , create graph visualization can seen here. if can utilize graphgist can find more info how utilize in ruby on rails project? if cannot utilize graphgist d3.js selection of vizualizing neo4j graphs in ruby in rails project?

i wrote simple single html page neo4j console can utilize larn how it.

the master branch uses alchemy.js library http://jexp.github.io/cy2neo

and neod3 branch uses visualization graphgist project.

if clone locally , check out branch , run file in browser should able see visualization.

ruby-on-rails ruby d3.js neo4j

html - Regex To Remove Script And Style Tags + Content Javascript -



html - Regex To Remove Script And Style Tags + Content Javascript -

i've scenario have finish web pages having javascript, css , html. need remove script , style tags plus contents completely. have achieved in php using next regex:

$str = preg_replace('#<script(.*?)>(.*?)</script>#is', '', $html); preg_replace('#<style(.*?)>(.*?)</style>#is', '', $str);

but can't done in javascript. want have equivalent of

<script(.*?)>(.*?)</script> //in javascript

i want replace occurrences within html. have stripped out others html tags this

puretext.replace(/<(?:.|\n)*?>/gm, ''); //just reference

i want have equivalent of <script(.*?)>(.*?)</script> //in javascript

/<script([\s\s]*?)>([\s\s]*?)<\/script>/ig

use [\s\s]*? instead of .*? in regex because javascript won't back upwards s modifier (dotall modifier). [\s\s]*? match space or non-space character 0 or more times non-greedily.

javascript html regex

HEAD and master denotations using github -



HEAD and master denotations using github -

i have been fumbling around on github, , help have managed create branch local master. however, these lines guess tracking things have been changed. don't want them!! want current files become new master are.

what these lines for? , how suppress them?

<<<<<<< head ======= >>>>>>> master

those lines signal merge conflicts in git. when merge, git @ automatically working out how merge files together, there cases cannot - example, when both branches adding same kind of area in same file, merge conflict.

in these cases, lines drawn around boundary of conflict. section above ======= belongs head ref (or whatever displayed after <<<<<<<). section below belongs master ref (or whatever displayed after >>>>>>>).

it's delete these lines , create according edit code. if want take on head ref in final version of code (post-merge), delete below ====== line - , visa versa if want take on master branch. of course, can take both versions of code removing markers.

you can see the git manual more information.

github

excel - need to create salary data with salary bands -



excel - need to create salary data with salary bands -

looking create salary chart employees. should xy scatter plot salary info employees grouped title. want floating bar graph representing salary range title.

salary data:

employee,title,salary joe, eng 1, 15000 mike, eng 1, 16000 kelly, eng 3, 25000 steve, eng 2, 20000 jane, eng 3, 30000 michelle, eng 5, 60000 anan, eng 5, 70000

eng level salary band

title,min, max eng 1, 10000, 20000 eng 2, 15000, 30000 eng 3, 25000, 40000 eng 4, 30000, 60000 eng 5, 50000, 80000 eng 6, 60000, 100000

note wont have employees in every level, want show level on chart, levels should shown left right on graph eng 1 eng 6

i having hard time figure out how in excel...your help appreciated

we'll create floating bar chart salary bands, overlay xy scatter points individual data.

first, insert column between min , max salary in bands table, , utilize formula compute span between max , min, shown below. select shaded range , insert stacked column chart. looks top chart below.

format chart follows: remove title (or come in useful). remove legend. alter number format of vertical axis 0,"k" (the comma knocks off set of 3 zeros). format min series no border , no fill, invisible. format span series utilize lighter fill color. alter gap width of span series 75.

insert column contains number of salary band (or alter "eng x" "x") shown below left. re-create shaded range, select chart, take paste special paste dropdown on home tab of ribbon, , utilize options shown in dialog below right (add cells new series, series in columns, series names in first row, category labels in first column). chart looks got new set of stacked bars; we'll prepare shortly.

right click added series, take alter series chart type, , take xy scatter style markers , no lines (below left). select new series markers, press ctrl+1 shortcut format it, take primary axis, aligns nicely existing floating bars, , take format stands out. used dark bluish marker border , white marker fill (bottom left). add together labels using excel 2013 option, label contains value cells, or in older versions of excel, install rob bovey's chart labeler add-in (free http://appspro.com) add together arbitrary labels. also, should stretch chart vertically add together resolution (below right).

excel graph charts scatter-plot

scala - How to get rid of : class type required but T found -



scala - How to get rid of : class type required but T found -

how solve compilation error :

trait container { def getints() : seq[int] def getstrings() : seq[string] def put[t](t: t) def get[t] : seq[t] } class mutablecontainer extends container { val entities = new mutable.hashmap[class[_], mutable.set[any]]() mutable.multimap[class[_], any] override def getstrings(): seq[string] = entities.get(classof[string]).map(_.toseq).getorelse(seq.empty).asinstanceof[seq[string]] //strings override def getints(): seq[int] = entities.get(classof[int]).map(_.toseq).getorelse(seq.empty).asinstanceof[seq[int]] override def get[t]: seq[t] = entities.get(classof[t]).map(_.toseq).getorelse(seq.empty).asinstanceof[seq[t]] override def put[t](t: t): unit = entities.addbinding(t.getclass, t) }

here error :

[error] container.scala:23: class type required t found [error] override def get[t]: seq[t] = entities.get(classof[t]).map(_.toseq).getorelse(seq.empty).asinstanceof[seq[t]]

t not class type, type parameter. request classtag:

import scala.reflect._ override def get[t](implicit ct: classtag[t]): seq[t] = entities.get(ct.runtimeclass) .map(_.toseq) .getorelse(seq.empty) .asinstanceof[seq[t]]

but brings problem; not override!

so have modify base of operations class declare get follows:

def get[t: classtag]: seq[t]

scala

sql - Disable MySQL Stats on INSERT -



sql - Disable MySQL Stats on INSERT -

how can disable mysql updating statistics index's when mass inserting? i'm trying test performance drop select statement index before , after doing mass insert without statistics beingness updated.

if using myisam doing wrong. if using innnodb, innodb statistically (does random dives info set) calculate index statistics execution plans. can command why? trying gain poorly calculated indexing?

mysql sql database

c# - can't set image url from onclick event -



c# - can't set image url from onclick event -

i have problem setting image url image id

my button image is

<asp:imagebutton id="butim" runat="server" imageurl='<%# eval("image1") %>' commandargument='<%# eval("image1") %>' onclick="selectimage" width="100" height="100" />

this image button works correctly

my event

protected void selectimage(object sender, imageclickeventargs e) { string imagename = ((imagebutton)sender).commandargument; imgvw.imageurl = imagename; popimg.show(); }

my target popup

<ajaxtoolkit:modalpopupextender id="popimg" runat="server" popupcontrolid="panel1" backgroundcssclass="modalbackground" dropshadow="true" enabled="true" cancelcontrolid="cancel"> </ajaxtoolkit:modalpopupextender> <asp:panel id="panel1" runat="server" cssclass="modalpopup"> <asp:image id="imgvw" runat="server" /><br /> <asp:button id="cancel" runat="server" text="kembali" class="art-button" onclick="btncancel_click" /> </asp:panel>

my problem when set breakpoint on event, see url of imgvw.imageurl has right path can't display image. when input url manually on asp image id

<asp:image id="imgvw" imageurl="../image/image1.jpg" runat="server" />

popup can display image perfectly

can help me please?

c# asp.net url