Tuesday 15 May 2012

machine learning - Convolutional neural networks: Aren't the central neurons over-represented in the output? -



machine learning - Convolutional neural networks: Aren't the central neurons over-represented in the output? -

[this question posed @ cross validated]

the question in short

i'm studying convolutional neural networks, , believe these networks not treat every input neuron (pixel/parameter) equivalently. imagine have deep network (many layers) applies convolution on input image. neurons in "middle" of image have many unique pathways many deeper layer neurons, means little variation in middle neurons has strong effect on output. however, neurons @ border of image have 1 way (or, depending on exact implementation, of order of 1) pathways in info flows through graph. seems these "under-represented".

i concerned this, discrimination of border neurons scales exponentially depth (number of layers) of network. adding max-pooling layer won't halt exponential increase, total connection brings neurons on equal footing. i'm not convinced reasoning correct, though, questions are:

am right effect takes place in deep convolutional networks? is there theory this, has ever been mentioned in literature? are there ways overcome effect?

because i'm not sure if gives sufficient information, i'll elaborate bit more problem statement, , why believe concern.

more detailed explanation

imagine have deep neural network takes image input. assume apply convolutional filter of 64x64 pixel on image, shift convolution window 4 pixels each time. means every neuron in input sends it's activation 16x16 = 265 neurons in layer 2. each of these neurons might send activation 265, such our topmost neuron represented in 265^2 output neurons, , on. is, however, not true neurons on edges: these might represented in little number of convolution windows, causing them activate (of order of) 1 neuron in next layer. using tricks such mirroring along edges won't help this: second-layer-neurons projected still @ edges, means that second-layer-neurons underrepresented (thus limiting importance of our border neurons well). can seen, discrepancy scales exponentially number of layers.

i have created image visualize problem, can found here (i'm not allowed include images in post itself). network has convolution window of size 3. numbers next neurons indicate number of pathways downwards deepest neuron. image reminiscent of pascal's triangle.

https://www.dropbox.com/s/7rbwv7z14j4h0jr/deep_conv_problem_stackxchange.png?dl=0

why problem?

this effect doesn't seem problem @ first sight: in principle, weights should automatically adjust in such way network it's job. moreover, edges of image not of import anyway in image recognition. effect might not noticeable in everyday image recognition tests, still concerns me because of 2 reasons: 1) generalization other applications, , 2) problems arising in case of very deep networks. 1) there might other applications, speech or sound recognition, not true middle-most neurons important. applying convolution done in field, haven't been able find papers mention effect i'm concerned with. 2) deep networks notice exponentially bad effect of discrimination of boundary neurons, means central neurons can overrepresented multiple order of magnitude (imagine have 10 layers such above illustration give 265^10 ways central neurons can project information). 1 increases number of layers, 1 bound nail limit weights cannot feasibly compensate effect. imagine perturb neurons little amount. central neurons cause output alter more several orders of magnitude, compared border neurons. believe general applications, , deep networks, ways around problem should found?

i quote sentences , below write answers.

am right effect takes place in deep convolution networks

i think wrong in general right according 64 64 sized convolution filter example. while structuring convolution layer filter sizes, never bigger looking in images. in other words - if images 200by200 , convolve 64by64 patches, these 64by64 patches larn parts or image patch identifies category. thought in first layer larn edge-like partial of import images not entire cat or auto itself.

is there theory this, has ever been mentioned in literature? , there ways overcome effect?

i never saw in paper have looked through far. , not think issue deep networks.

there no such effect. suppose first layer learned 64by64 patches in action. if there patch in top-left-most corner fired(become active) show 1 in next layers topmost left corner hence info propagated through network.

(not quoted) should not think 'a pixel beingness useful in more neurons when gets closer center'. think 64x64 filter stride of 4:

if pattern 64x64 filter in top-most-left corner of image propagated next layers top corner, otherwise there nil in next layer.

the thought maintain meaningful parts of image live while suppressing non-meaningful, dull parts, , combining these meaningful parts in next layers. in case of learning "an uppercase letter a-a" please @ images in old paper of fukushima 1980 (http://www.cs.princeton.edu/courses/archive/spr08/cos598b/readings/fukushima1980.pdf) figure 7 , 5. hence there no importance of pixel, there importance of image patch size of convolution layer.

the central neurons cause output alter more several orders of magnitude, compared border neurons. believe general applications, , deep networks, ways around problem should found?

suppose looking auto in image,

and suppose in 1st illustration auto in 64by64 top-left-most part of 200by200 image, in 2nd illustration auto in 64by64 bottom-right-most part of 200by200 image

in sec layer pixel values 0, 1st image except 1 in top-left-most corner , 2nd image except 1 in bottom-right-most corner.

now, center part of image mean nil forwards , backward propagation because values 0. corner values never discarded , effect learning weights.

machine-learning neural-network convolution

xml - Moving nodes down using XSLT -



xml - Moving nodes down using XSLT -

after puting question here, managed move node (moving nodes using xslt). after thought understood tried opposite move node down. didn't work. did:

my input info called debtors.xml:

<?xml version="1.0" ?> <eexact xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xsi:nonamespaceschemalocation="eexact-schema.xsd"> <accounts> <account code=" 001" status="a" type="c"> <name>name</name> <contacts> <contact default="1" gender="m" status="a"> <note>patient: 1</note> <firstname></firstname> <addresses> <address type="d" desc=""> <addressline1>street</addressline1> <addressline2></addressline2> <addressline3></addressline3> <postalcode>0000 aa</postalcode> <city>&apos;city</city> <country code="nl"/> <phone></phone> <fax></fax> </address> </addresses> <language code="nl"/> <jobdescription>--</jobdescription> <phone></phone> <phoneext></phoneext> <fax></fax> <mobile></mobile> <email></email> <webaccess>0</webaccess> </contact> </contacts> <debtor number=" 1" code=" 1"> <currency code="eur"/> </debtor> </account> </accounts> </eexact>

my xsl called test2.xsl

<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/xsl/transform"> <!-- indentation in xsl --> <xsl:output method="xml" version="1.0" omit-xml-declaration="yes" encoding="utf-8" indent="yes"/> <!-- removing blank lines in xsl --> <xsl:strip-space elements="*"/> <!-- identity rule --> <xsl:template match="@*|node()"> <xsl:copy> <xsl:apply-templates select="@*|node()" /> </xsl:copy> </xsl:template> <!-- special rules ... --> <xsl:template match="account"> <xsl:copy> <!-- exclude name --> <xsl:apply-templates select="@* | node()[not(self::name)]"/> </xsl:copy> </xsl:template> <xsl:template match="contacts"> <xsl:copy> <!-- include name --> <xsl:apply-templates select="@* | node() | contact/name"/> </xsl:copy> </xsl:template> </xsl:stylesheet>

wanted output:

<?xml version="1.0" ?> <eexact xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xsi:nonamespaceschemalocation="eexact-schema.xsd"> <accounts> <account code=" 001" status="a" type="c"> <contacts> <contact default="1" gender="m" status="a"> <name>name</name> <note>patient: 1</note> <firstname></firstname> <addresses> <address type="d" desc=""> <addressline1>street</addressline1> <addressline2></addressline2> <addressline3></addressline3> <postalcode>0000 aa</postalcode> <city>&apos;city</city> <country code="nl"/> <phone></phone> <fax></fax> </address> </addresses> <language code="nl"/> <jobdescription>--</jobdescription> <phone></phone> <phoneext></phoneext> <fax></fax> <mobile></mobile> <email></email> <webaccess>0</webaccess> </contact> </contacts> <debtor number=" 1" code=" 1"> <currency code="eur"/> </debtor> </account> </accounts> </eexact>

my problem xsl node "name" deleted, doesn't come kid of contact. hope help me?

i'd recommend few changes:

to suppress name, add together template rule matches nothing. to add together name contact, add together template rule matches contact , copies usual inserts name. eliminate template matching contacts (plural); general identity rule can handle fine.

here's finish stylesheet updated mentioned:

<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/xsl/transform"> <!-- indentation in xsl --> <xsl:output method="xml" version="1.0" omit-xml-declaration="yes" encoding="utf-8" indent="yes"/> <!-- removing blank lines in xsl --> <xsl:strip-space elements="*"/> <!-- identity rule --> <xsl:template match="@*|node()"> <xsl:copy> <xsl:apply-templates select="@*|node()" /> </xsl:copy> </xsl:template> <!-- special rules ... --> <xsl:template match="name"/> <xsl:template match="contact"> <xsl:copy> <!-- include name --> <xsl:apply-templates select="@*"/> <name><xsl:value-of select="../../name"/></name> <xsl:apply-templates select="node()"/> </xsl:copy> </xsl:template> </xsl:stylesheet>

given sample input xml, above xslt produces requested output xml:

<eexact xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xsi:nonamespaceschemalocation="eexact-schema.xsd"> <accounts> <account code=" 001" status="a" type="c"> <contacts> <contact default="1" gender="m" status="a"> <name>name</name> <note>patient: 1</note> <firstname/> <addresses> <address type="d" desc=""> <addressline1>street</addressline1> <addressline2/> <addressline3/> <postalcode>0000 aa</postalcode> <city>'city</city> <country code="nl"/> <phone/> <fax/> </address> </addresses> <language code="nl"/> <jobdescription>--</jobdescription> <phone/> <phoneext/> <fax/> <mobile/> <email/> <webaccess>0</webaccess> </contact> </contacts> <debtor number=" 1" code=" 1"> <currency code="eur"/> </debtor> </account> </accounts> </eexact>

xml xslt

c# - How do I implement scrolling for a Custom Control? -



c# - How do I implement scrolling for a Custom Control? -

how implement scrolling custom control? command custom drawn , height variable, , part of command contains menu if there many items in control, i'll need able set scroll bars there. i've not been able find clues on how this. did see scrollablecontrol, i'm still not sure if that's need.

also, how command know when needs show scroll bars? because command custom drawn there's no real "controls" in there it's bunch of pixels drawn onto it's not can set autoscroll true , can't anyway because it's not main part of command needs scrolling, it's particular location on command need have scrollbars.

if custom command inherits panel control, set size of content in custom command setting:

this.autoscrollminsize = new size(yourwidth, yourheight);

if control's clientsize.height greater yourheight, won't scrollbars. if it's less, scrollbar.

in paint method, add together beginning:

protected override void onpaint(painteventargs e) { e.graphics.translatetransform(this.autoscrollposition.x, this.autoscrollposition.y);

now paint gets automatically transformed scrolling coordinates.

c# .net winforms gdi+ gdi

networking - c - netmap - Tun/tap vs netmap/pf_ring/dpdk -



networking - c - netmap - Tun/tap vs netmap/pf_ring/dpdk -

would tun/tap device avoid netmap/pf_ring/dpdk installation ? if tun/tap allow bypass kernel, isn't same thing ?

or codes bring many optimizations overclass tun os bypass strategy ?

the final goal port tcp/ip kernel user space, testing purposes.

i don't quite understand here.

thanks

no. userspace tcpip implementation see lwip or rumpkernel. dpdk/pfring/netmap know getting packets userspace fast possible. tun/tap virtual interface things. not you're after.

networking tcp c stack

java - Unable to connect to the Eclipse Luna Market -



java - Unable to connect to the Eclipse Luna Market -

i cant connect eclipse luna distribution market install maven 2 pluggin. configuration :

eclipse : - eclipse luna m5 release, configured proxy

my computer : - windows xp 32bits

this error message :

!session 2014-03-03 14:55:53.568 ----------------------------------------------- eclipse.buildid=4.4.0.i20140123-1600 java.version=1.6.0_29 java.vendor=sun microsystems inc. bootloader constants: os=win32, arch=x86, ws=win32, nl=fr_fr framework arguments: -product org.eclipse.epp.package.standard.product command-line arguments: -os win32 -ws win32 -arch x86 -product org.eclipse.epp.package.standard.product !entry org.eclipse.core.net 1 0 2014-03-03 14:56:01.676 !message scheme property http.proxyhost not set should <myproxy_url>. !entry org.eclipse.core.net 1 0 2014-03-03 14:56:01.692 !message scheme property http.proxyport not set should <myproxy_port>. !entry org.eclipse.core.net 1 0 2014-03-03 14:56:01.692 !message scheme property https.proxyhost not set should <myproxy_url>. !entry org.eclipse.core.net 1 0 2014-03-03 14:56:01.692 !message scheme property https.proxyport not set should <myproxy_port>. !entry org.eclipse.core.net 1 0 2014-03-03 14:56:01.692 !message scheme property https.proxyhost not set should <myproxy_url>. !entry org.eclipse.core.net 1 0 2014-03-03 14:56:01.708 !message scheme property https.proxyport not set should <myproxy_port>. !entry org.eclipse.epp.mpc.ui 4 0 2014-03-03 14:56:14.988 !message cannot open eclipse marketplace !stack 1 org.eclipse.core.runtime.coreexception: cannot install remote marketplace locations: bad http request: http://marketplace.eclipse.org/catalogs/api/p @ org.eclipse.epp.internal.mpc.ui.commands.marketplacewizardcommand.execute(marketplacewizardcommand.java:101) @ org.eclipse.ui.internal.handlers.handlerproxy.execute(handlerproxy.java:290) @ org.eclipse.ui.internal.handlers.e4handlerproxy.execute(e4handlerproxy.java:90) @ sun.reflect.nativemethodaccessorimpl.invoke0(native method) @ sun.reflect.nativemethodaccessorimpl.invoke(unknown source) @ sun.reflect.delegatingmethodaccessorimpl.invoke(unknown source) @ java.lang.reflect.method.invoke(unknown source) @ org.eclipse.e4.core.internal.di.methodrequestor.execute(methodrequestor.java:56) @ org.eclipse.e4.core.internal.di.injectorimpl.invokeusingclass(injectorimpl.java:243) @ org.eclipse.e4.core.internal.di.injectorimpl.invoke(injectorimpl.java:224) @ org.eclipse.e4.core.contexts.contextinjectionfactory.invoke(contextinjectionfactory.java:132) @ org.eclipse.e4.core.commands.internal.handlerservicehandler.execute(handlerservicehandler.java:163) @ org.eclipse.core.commands.command.executewithchecks(command.java:499) @ org.eclipse.core.commands.parameterizedcommand.executewithchecks(parameterizedcommand.java:508) @ org.eclipse.e4.core.commands.internal.handlerserviceimpl.executehandler(handlerserviceimpl.java:222) @ org.eclipse.e4.ui.workbench.renderers.swt.handledcontributionitem.executeitem(handledcontributionitem.java:776) @ org.eclipse.e4.ui.workbench.renderers.swt.handledcontributionitem.handlewidgetselection(handledcontributionitem.java:668) @ org.eclipse.e4.ui.workbench.renderers.swt.handledcontributionitem.access$6(handledcontributionitem.java:652) @ org.eclipse.e4.ui.workbench.renderers.swt.handledcontributionitem$4.handleevent(handledcontributionitem.java:584) @ org.eclipse.swt.widgets.eventtable.sendevent(eventtable.java:84) @ org.eclipse.swt.widgets.display.sendevent(display.java:4353) @ org.eclipse.swt.widgets.widget.sendevent(widget.java:1061) @ org.eclipse.swt.widgets.display.rundeferredevents(display.java:4172) @ org.eclipse.swt.widgets.display.readanddispatch(display.java:3761) @ org.eclipse.e4.ui.internal.workbench.swt.partrenderingengine$9.run(partrenderingengine.java:1122) @ org.eclipse.core.databinding.observable.realm.runwithdefault(realm.java:332) @ org.eclipse.e4.ui.internal.workbench.swt.partrenderingengine.run(partrenderingengine.java:1006) @ org.eclipse.e4.ui.internal.workbench.e4workbench.createandrunui(e4workbench.java:146) @ org.eclipse.ui.internal.workbench$5.run(workbench.java:615) @ org.eclipse.core.databinding.observable.realm.runwithdefault(realm.java:332) @ org.eclipse.ui.internal.workbench.createandrunworkbench(workbench.java:566) @ org.eclipse.ui.platformui.createandrunworkbench(platformui.java:150) @ org.eclipse.ui.internal.ide.application.ideapplication.start(ideapplication.java:125) @ org.eclipse.equinox.internal.app.eclipseapphandle.run(eclipseapphandle.java:196) @ org.eclipse.core.runtime.internal.adaptor.eclipseapplauncher.runapplication(eclipseapplauncher.java:109) @ org.eclipse.core.runtime.internal.adaptor.eclipseapplauncher.start(eclipseapplauncher.java:80) @ org.eclipse.core.runtime.adaptor.eclipsestarter.run(eclipsestarter.java:372) @ org.eclipse.core.runtime.adaptor.eclipsestarter.run(eclipsestarter.java:226) @ sun.reflect.nativemethodaccessorimpl.invoke0(native method) @ sun.reflect.nativemethodaccessorimpl.invoke(unknown source) @ sun.reflect.delegatingmethodaccessorimpl.invoke(unknown source) @ java.lang.reflect.method.invoke(unknown source) @ org.eclipse.equinox.launcher.main.invokeframework(main.java:636) @ org.eclipse.equinox.launcher.main.basicrun(main.java:591) @ org.eclipse.equinox.launcher.main.run(main.java:1450) caused by: org.eclipse.core.runtime.coreexception: bad http request: http://marketplace.eclipse.org/catalogs/api/p @ org.eclipse.equinox.internal.p2.transport.ecf.repositorytransport.stream(repositorytransport.java:180) @ sun.reflect.nativemethodaccessorimpl.invoke0(native method) @ sun.reflect.nativemethodaccessorimpl.invoke(unknown source) @ sun.reflect.delegatingmethodaccessorimpl.invoke(unknown source) @ java.lang.reflect.method.invoke(unknown source) @ org.eclipse.epp.internal.mpc.core.util.abstractp2transportfactory.invokestream(abstractp2transportfactory.java:35) @ org.eclipse.epp.internal.mpc.core.util.transportfactory$1.stream(transportfactory.java:69) @ org.eclipse.epp.internal.mpc.core.service.remotemarketplaceservice.processrequest(remotemarketplaceservice.java:131) @ org.eclipse.epp.internal.mpc.core.service.remotemarketplaceservice.processrequest(remotemarketplaceservice.java:85) @ org.eclipse.epp.internal.mpc.core.service.remotemarketplaceservice.processrequest(remotemarketplaceservice.java:72) @ org.eclipse.epp.internal.mpc.core.service.defaultcatalogservice.listcatalogs(defaultcatalogservice.java:36) @ org.eclipse.epp.internal.mpc.ui.commands.marketplacewizardcommand$5.run(marketplacewizardcommand.java:254) @ org.eclipse.jface.operation.modalcontext$modalcontextthread.run(modalcontext.java:122) caused by: org.eclipse.ecf.filetransfer.incomingfiletransferexception: httpcomponents connection error response code 400. @ org.eclipse.ecf.provider.filetransfer.httpclient4.httpclientretrievefiletransfer.openstreams(httpclientretrievefiletransfer.java:665) @ org.eclipse.ecf.provider.filetransfer.retrieve.abstractretrievefiletransfer.sendretrieverequest(abstractretrievefiletransfer.java:879) @ org.eclipse.ecf.provider.filetransfer.retrieve.abstractretrievefiletransfer.sendretrieverequest(abstractretrievefiletransfer.java:570) @ org.eclipse.ecf.provider.filetransfer.retrieve.multiprotocolretrieveadapter.sendretrieverequest(multiprotocolretrieveadapter.java:106) @ org.eclipse.equinox.internal.p2.transport.ecf.filereader.sendretrieverequest(filereader.java:422) @ org.eclipse.equinox.internal.p2.transport.ecf.filereader.read(filereader.java:273) @ org.eclipse.equinox.internal.p2.transport.ecf.repositorytransport.stream(repositorytransport.java:172) ... 12 more contains: bad http request: http://marketplace.eclipse.org/catalogs/api/p org.eclipse.ecf.filetransfer.incomingfiletransferexception: httpcomponents connection error response code 400. @ org.eclipse.ecf.provider.filetransfer.httpclient4.httpclientretrievefiletransfer.openstreams(httpclientretrievefiletransfer.java:665) @ org.eclipse.ecf.provider.filetransfer.retrieve.abstractretrievefiletransfer.sendretrieverequest(abstractretrievefiletransfer.java:879) @ org.eclipse.ecf.provider.filetransfer.retrieve.abstractretrievefiletransfer.sendretrieverequest(abstractretrievefiletransfer.java:570) @ org.eclipse.ecf.provider.filetransfer.retrieve.multiprotocolretrieveadapter.sendretrieverequest(multiprotocolretrieveadapter.java:106) @ org.eclipse.equinox.internal.p2.transport.ecf.filereader.sendretrieverequest(filereader.java:422) @ org.eclipse.equinox.internal.p2.transport.ecf.filereader.read(filereader.java:273) @ org.eclipse.equinox.internal.p2.transport.ecf.repositorytransport.stream(repositorytransport.java:172) @ sun.reflect.nativemethodaccessorimpl.invoke0(native method) @ sun.reflect.nativemethodaccessorimpl.invoke(unknown source) @ sun.reflect.delegatingmethodaccessorimpl.invoke(unknown source) @ java.lang.reflect.method.invoke(unknown source) @ org.eclipse.epp.internal.mpc.core.util.abstractp2transportfactory.invokestream(abstractp2transportfactory.java:35) @ org.eclipse.epp.internal.mpc.core.util.transportfactory$1.stream(transportfactory.java:69) @ org.eclipse.epp.internal.mpc.core.service.remotemarketplaceservice.processrequest(remotemarketplaceservice.java:131) @ org.eclipse.epp.internal.mpc.core.service.remotemarketplaceservice.processrequest(remotemarketplaceservice.java:85) @ org.eclipse.epp.internal.mpc.core.service.remotemarketplaceservice.processrequest(remotemarketplaceservice.java:72) @ org.eclipse.epp.internal.mpc.core.service.defaultcatalogservice.listcatalogs(defaultcatalogservice.java:36) @ org.eclipse.epp.internal.mpc.ui.commands.marketplacewizardcommand$5.run(marketplacewizardcommand.java:254) @ org.eclipse.jface.operation.modalcontext$modalcontextthread.run(modalcontext.java:122) !subentry 1 org.eclipse.epp.mpc.ui 4 0 2014-03-03 14:56:14.988 !message cannot install remote marketplace locations: bad http request: http://marketplace.eclipse.org/catalogs/api/p !stack 1 org.eclipse.core.runtime.coreexception: bad http request: http://marketplace.eclipse.org/catalogs/api/p @ org.eclipse.equinox.internal.p2.transport.ecf.repositorytransport.stream(repositorytransport.java:180) @ sun.reflect.nativemethodaccessorimpl.invoke0(native method) @ sun.reflect.nativemethodaccessorimpl.invoke(unknown source) @ sun.reflect.delegatingmethodaccessorimpl.invoke(unknown source) @ java.lang.reflect.method.invoke(unknown source) @ org.eclipse.epp.internal.mpc.core.util.abstractp2transportfactory.invokestream(abstractp2transportfactory.java:35) @ org.eclipse.epp.internal.mpc.core.util.transportfactory$1.stream(transportfactory.java:69) @ org.eclipse.epp.internal.mpc.core.service.remotemarketplaceservice.processrequest(remotemarketplaceservice.java:131) @ org.eclipse.epp.internal.mpc.core.service.remotemarketplaceservice.processrequest(remotemarketplaceservice.java:85) @ org.eclipse.epp.internal.mpc.core.service.remotemarketplaceservice.processrequest(remotemarketplaceservice.java:72) @ org.eclipse.epp.internal.mpc.core.service.defaultcatalogservice.listcatalogs(defaultcatalogservice.java:36) @ org.eclipse.epp.internal.mpc.ui.commands.marketplacewizardcommand$5.run(marketplacewizardcommand.java:254) @ org.eclipse.jface.operation.modalcontext$modalcontextthread.run(modalcontext.java:122) caused by: org.eclipse.ecf.filetransfer.incomingfiletransferexception: httpcomponents connection error response code 400. @ org.eclipse.ecf.provider.filetransfer.httpclient4.httpclientretrievefiletransfer.openstreams(httpclientretrievefiletransfer.java:665) @ org.eclipse.ecf.provider.filetransfer.retrieve.abstractretrievefiletransfer.sendretrieverequest(abstractretrievefiletransfer.java:879) @ org.eclipse.ecf.provider.filetransfer.retrieve.abstractretrievefiletransfer.sendretrieverequest(abstractretrievefiletransfer.java:570) @ org.eclipse.ecf.provider.filetransfer.retrieve.multiprotocolretrieveadapter.sendretrieverequest(multiprotocolretrieveadapter.java:106) @ org.eclipse.equinox.internal.p2.transport.ecf.filereader.sendretrieverequest(filereader.java:422) @ org.eclipse.equinox.internal.p2.transport.ecf.filereader.read(filereader.java:273) @ org.eclipse.equinox.internal.p2.transport.ecf.repositorytransport.stream(repositorytransport.java:172) ... 12 more !subentry 2 org.eclipse.equinox.p2.transport.ecf 4 1002 2014-03-03 14:56:14.988 !message bad http request: http://marketplace.eclipse.org/catalogs/api/p !stack 1 org.eclipse.ecf.filetransfer.incomingfiletransferexception: httpcomponents connection error response code 400. @ org.eclipse.ecf.provider.filetransfer.httpclient4.httpclientretrievefiletransfer.openstreams(httpclientretrievefiletransfer.java:665) @ org.eclipse.ecf.provider.filetransfer.retrieve.abstractretrievefiletransfer.sendretrieverequest(abstractretrievefiletransfer.java:879) @ org.eclipse.ecf.provider.filetransfer.retrieve.abstractretrievefiletransfer.sendretrieverequest(abstractretrievefiletransfer.java:570) @ org.eclipse.ecf.provider.filetransfer.retrieve.multiprotocolretrieveadapter.sendretrieverequest(multiprotocolretrieveadapter.java:106) @ org.eclipse.equinox.internal.p2.transport.ecf.filereader.sendretrieverequest(filereader.java:422) @ org.eclipse.equinox.internal.p2.transport.ecf.filereader.read(filereader.java:273) @ org.eclipse.equinox.internal.p2.transport.ecf.repositorytransport.stream(repositorytransport.java:172) @ sun.reflect.nativemethodaccessorimpl.invoke0(native method) @ sun.reflect.nativemethodaccessorimpl.invoke(unknown source) @ sun.reflect.delegatingmethodaccessorimpl.invoke(unknown source) @ java.lang.reflect.method.invoke(unknown source) @ org.eclipse.epp.internal.mpc.core.util.abstractp2transportfactory.invokestream(abstractp2transportfactory.java:35) @ org.eclipse.epp.internal.mpc.core.util.transportfactory$1.stream(transportfactory.java:69) @ org.eclipse.epp.internal.mpc.core.service.remotemarketplaceservice.processrequest(remotemarketplaceservice.java:131) @ org.eclipse.epp.internal.mpc.core.service.remotemarketplaceservice.processrequest(remotemarketplaceservice.java:85) @ org.eclipse.epp.internal.mpc.core.service.remotemarketplaceservice.processrequest(remotemarketplaceservice.java:72) @ org.eclipse.epp.internal.mpc.core.service.defaultcatalogservice.listcatalogs(defaultcatalogservice.java:36) @ org.eclipse.epp.internal.mpc.ui.commands.marketplacewizardcommand$5.run(marketplacewizardcommand.java:254) @ org.eclipse.jface.operation.modalcontext$modalcontextthread.run(modalcontext.java:122) !subentry 3 org.eclipse.ecf.identity 4 0 2014-03-03 14:56:14.988 !message httpcomponents connection error response code 400. !subentry 2 org.eclipse.equinox.p2.transport.ecf 4 1002 2014-03-03 14:56:14.988 !message bad http request: http://marketplace.eclipse.org/catalogs/api/p !stack 1 org.eclipse.ecf.filetransfer.incomingfiletransferexception: httpcomponents connection error response code 400. @ org.eclipse.ecf.provider.filetransfer.httpclient4.httpclientretrievefiletransfer.openstreams(httpclientretrievefiletransfer.java:665) @ org.eclipse.ecf.provider.filetransfer.retrieve.abstractretrievefiletransfer.sendretrieverequest(abstractretrievefiletransfer.java:879) @ org.eclipse.ecf.provider.filetransfer.retrieve.abstractretrievefiletransfer.sendretrieverequest(abstractretrievefiletransfer.java:570) @ org.eclipse.ecf.provider.filetransfer.retrieve.multiprotocolretrieveadapter.sendretrieverequest(multiprotocolretrieveadapter.java:106) @ org.eclipse.equinox.internal.p2.transport.ecf.filereader.sendretrieverequest(filereader.java:422) @ org.eclipse.equinox.internal.p2.transport.ecf.filereader.read(filereader.java:273) @ org.eclipse.equinox.internal.p2.transport.ecf.repositorytransport.stream(repositorytransport.java:172) @ sun.reflect.nativemethodaccessorimpl.invoke0(native method) @ sun.reflect.nativemethodaccessorimpl.invoke(unknown source) @ sun.reflect.delegatingmethodaccessorimpl.invoke(unknown source) @ java.lang.reflect.method.invoke(unknown source) @ org.eclipse.epp.internal.mpc.core.util.abstractp2transportfactory.invokestream(abstractp2transportfactory.java:35) @ org.eclipse.epp.internal.mpc.core.util.transportfactory$1.stream(transportfactory.java:69) @ org.eclipse.epp.internal.mpc.core.service.remotemarketplaceservice.processrequest(remotemarketplaceservice.java:131) @ org.eclipse.epp.internal.mpc.core.service.remotemarketplaceservice.processrequest(remotemarketplaceservice.java:85) @ org.eclipse.epp.internal.mpc.core.service.remotemarketplaceservice.processrequest(remotemarketplaceservice.java:72) @ org.eclipse.epp.internal.mpc.core.service.defaultcatalogservice.listcatalogs(defaultcatalogservice.java:36) @ org.eclipse.epp.internal.mpc.ui.commands.marketplacewizardcommand$5.run(marketplacewizardcommand.java:254) @ org.eclipse.jface.operation.modalcontext$modalcontextthread.run(modalcontext.java:122) !subentry 3 org.eclipse.ecf.identity 4 0 2014-03-03 14:56:14.988 !message httpcomponents connection error response code 400. !entry org.eclipse.egit.ui 2 0 2014-03-03 14:56:17.457 !message warning: egit couldn't observe installation path "gitprefix" of native git. hence egit can't respect scheme level git settings might configured in ${gitprefix}/etc/gitconfig under native git installation directory. of import of these settings core.autocrlf. git windows default sets parameter true in scheme level configuration. git installation location can configured on team > git > configuration preference page's 'system settings' tab. warning can switched off on team > git > confirmations , warnings preference page. !entry org.eclipse.egit.ui 2 0 2014-03-03 14:56:17.472 !message warning: environment variable home not set. next directory used store git user global configuration , define default location store repositories: 'c:\documents , settings\ombinte'. if not right please set home environment variable , restart eclipse. otherwise git windows , egit might behave differently since see different configuration options. warning can switched off on team > git > confirmations , warnings preference page.

with proxy servers there appears problem httpclient libraries used eclipse 4.4. workaround utilize jre http client putting line in eclipse.ini:

-dorg.eclipse.ecf.provider.filetransfer.excludecontributors=org.eclipse.ecf.provider.filetransfer.httpclient4

eclipse bug discussion

disabling apache httpclient

java eclipse maven eclipse-plugin maven-plugin

How does Cucumber differ from JUnit? -



How does Cucumber differ from JUnit? -

can explain difference me between cucumber , junit

from understanding both used test java code although not sure of difference?

are difference implementations of same test suite or aimed @ testing different things?

cucumber , junit different , solve different things.

cucumber behavior driven design (bdd) framework takes "stories" or scenarios written in human readable languages such english language , turns human readable text software test.

here's illustration cucumber story:

cucumber knows how turn text software test create sure software works described. output tell if story software , if not, different:

here's code fixed create cucumber test pass:

this makes called "executable specification" nice way of documenting of features software supports. different normal documentation because without corresponding test, reading document doesn't know if documentation date.

other benefits of executable specifications:

non-programmers can read , understand tests non-programmers can write tests since in plain english.

bdd results , executable specifications high level. cover overall features , perhaps few border cases examples don't test every possible status or every code path. bdd tests "integration tests" in test how code modules work together, don't test thoroughly.

this junit comes in.

junit lower level "unit test" tool allows developers test every possible code path in code. each module of code (or classes, or methods) tested in isolation. much more low level bdd framework. using same calculator story cucumber example, junit tests test lots of different calculation examples , invalid inputs create sure programme responds correctly , computes values correctly.

hope helps

junit cucumber

java - Can access TextView but not LinearLayout declared in the same way -



java - Can access TextView but not LinearLayout declared in the same way -

i want add together textview linearlayout in java, access linearlayout linlay_container in make_systematics(), nullpointerexception. have exact same code defining linearlayout , textview textview_systematics within of linearlayout. can access textview, not linearlayout. wrong here?

this layout fragment , included <fragment>-tag, in case important.

the xml file (fragment_species_systematics.xml):

<?xml version="1.0" encoding="utf-8"?> <linearlayout xmlns:android="http://schemas.android.com/apk/res/android" android:id = "@+id/linlay_fragment_species_systematics" android:layout_width = "match_parent" android:layout_height = "wrap_content" android:orientation = "vertical" > <textview android:id = "@+id/textview_fragment_species_systematics" android:layout_width = "match_parent" android:layout_height = "wrap_content" /> </linearlayout>

the java file:

public class fragment_species_systematics extends fragment { linearlayout linlay_container; textview textview_systematics; view view; public fragment_species_systematics() {} @override public view oncreateview(layoutinflater inflater, viewgroup container, bundle savedinstancestate) { view = inflater.inflate(r.layout.fragment_species_systematics, container, false); homecoming view; } @override public void onactivitycreated(bundle savedinstancestate) { super.onactivitycreated(savedinstancestate); linlay_container = (linearlayout) getactivity().findviewbyid(r.id.linlay_fragment_species_systematics); textview_systematics = (textview) getactivity().findviewbyid(r.id.textview_fragment_species_systematics); } public void make_systematics(string json_systematics) { if (textview_systematics.isattachedtowindow()) {log.i("debug", "tv attached");} else {log.i("debug", "tv not attached");} if (linlay_container.isattachedtowindow()) {log.i("debug", "ll attached");} else {log.i("debug", "ll not attached");} } }

figured out, unfortunately without finding reason why have following: apparently 1 can not access "global" linearlayout. have include linearlayout , access that one, works.

my working xml file:

<?xml version="1.0" encoding="utf-8"?> <linearlayout xmlns:android="http://schemas.android.com/apk/res/android" > <linearlayout android:id = "@+id/linlay_fragment_species_systematics" android:layout_width = "match_parent" android:layout_height = "wrap_content" android:orientation = "vertical" > <textview android:id = "@+id/textview_fragment_species_systematics" android:layout_width = "match_parent" android:layout_height = "wrap_content" /> </linearlayout> </linearlayout>

java android-fragments nullpointerexception android-linearlayout

c# - How to get buttons with specifications from an array list -



c# - How to get buttons with specifications from an array list -

i have array:

button[] rightarr = new button[12] { button13, button14, button15, button16, button17, button18, button19, button20, button21, button22, button23, button24, };

i want check if there 4 greenish backcolor buttons , if there something, example: messagebox.show("there 4 greenish buttons");

how can that?

you can utilize linq this. have assumed, greenish buttons = buttons backcolor green. sense free alter that.

var greenbtns = (from m in rightarr m.backcolor == color.green select m).tolist(); if (greenbtns.count >= 4) { messagebox.show("there 4 greenish buttons"); }

c#

ember.js - Ember Object attribute access -



ember.js - Ember Object attribute access -

i wondering if there alter in way ember.objects created. given code below, not expect full_name homecoming "joe smith" not using ".get()" property accessor, found worked , homecoming "joe smith". when safe utilize simple dot notation , when should utilize ".get('property')"?

note -this code works ember 1.7

var person = ember.object.extend({ first_name: '', last_name: '', full_name: function() { homecoming this.first_name + ' ' + this.last_name; }.property() }); var joe = person.create({first_name: 'joe', last_name: 'smith'}); console.log(joe.get('full_name'));

actually getting/setting property right off of object has worked since pre-ember. place hurts when property getting computed property or proxy property or you're setting , it's beingness observed (by anything, including dom).

computed property

computed properties stored in meta of object, , need evaluated in order provide value.

var person = ember.object.extend({ first_name: '', last_name: '', full_name: function() { homecoming this.first_name + ' ' + this.last_name; }.property('first_name', 'last_name') }); var joe = person.create({first_name: 'joe', last_name: 'smith'}); console.log(joe.full_name); // undefined

example: http://emberjs.jsbin.com/kaxil/edit?html,css,js,console,output

proxy property

this apparent in controllers , ember data. calling get/set on objectcontroller effort get/set property on model instead of on mimicking decorator pattern. ember info proxies gets/sets downwards chain of possible locations of property (dirty, in transit, committed data).

var person = ember.object.extend({ first_name: '', last_name: '', full_name: function() { homecoming this.first_name + ' ' + this.last_name; }.property('first_name', 'last_name') }); var joe = person.create({first_name: 'joe', last_name: 'smith'}); var c = ember.objectcontroller.create({ model: joe }); console.log(c.first_name); // undefined console.log(c.get('first_name')); // joe

example: http://emberjs.jsbin.com/bebavi/edit?html,css,js,console,output

setter problem (being observed)

so, beingness said, if know property exists right on object , isn't beingness proxied downwards object there no harm in using obj.property getting. if changing property obj.property = 'foo'; there lot more possible harm. since ember uses observer pattern triggered through utilize of .set(...) run risk of changing dependent property won't notify dependent properties it's changed.

var person = ember.object.extend({ first_name: '', last_name: '', full_name: function() { homecoming this.first_name + ' ' + this.last_name; }.property('first_name', 'last_name') }); var joe = person.create({first_name: 'joe', last_name: 'smith'}); console.log(joe.get('full_name')); joe.first_name = 'foo'; console.log("should foo smith:" + joe.get('full_name')); // should foo smith joe.set('first_name','asdf'); console.log(joe.get('full_name'));

example showing set not updating: http://emberjs.jsbin.com/cagufe/edit

you safer using getters/setters, though i'm admittedly lazy in few situations know don't need utilize getter.

ember.js

android - Edittext: set right icon size -



android - Edittext: set right icon size -

i using next code set right icon: edittex.setcompounddrawableswithintrinsicbounds(0, 0, r.drawable.icon_valid, 0);

icon size 12*12 looks smaller.i need set 24*24 @ least. tried using:

drawable dr = getresources().getdrawable(r.drawable.somedrawable); bitmap bitmap = ((bitmapdrawable) dr).getbitmap(); drawable d = new bitmapdrawable(getresources(), bitmap.createscaledbitmap(bitmap, 24, 24, true));

but setcompounddrawableswithintrinsicbounds gets input parameter int not drawable

set dimensions dimens.xml file in res/values

android android-edittext

windows - Colored output in python -



windows - Colored output in python -

i'm using python 2.7 , in:

print in terminal colors using python?

python terminal menu? terminal coloring? terminal progress display?

and still getting same error. running code is:

print '\033[1;31m' + '@%s:' + '[1;m' + '\033[1;32m' + '%s - id = %s\n' + '\033[1;m' % (status.text1.encode('utf-8'), status.text2.encode('utf-8'), status.text3.encode('utf-8'))

and error obatained is:

traceback (most recent phone call last): file "<pyshell#4>", line 1, in <module> mostrar() file "c:\documents , settings\administrador.desktop\mis documentos\test.py", line 16, in mostrar print '\033[1;31m' + '@%s:' + '[1;m' + '\033[1;32m' + '%s - id = %s\n' + '\033[1;m' % (status.text1.encode('utf-8'), status.text2.encode('utf-8'), status.text3.encode('utf-8')) typeerror: not arguments converted during string formatting

like can see, i'm using python in windows.

the question how avoid error? utilize colorama, , error same.

try putting parentheses around format strings concatenating. % binds higher precedence +, error comes from:

'\033[1;m' % (... 3 arguments ...)

python windows python-2.7

fmt.Scanf not working properly in Go -



fmt.Scanf not working properly in Go -

i'm trying out snippet supposed test out fmt.scanf, doesn't seem work expected:

package main import ( "fmt" "time" ) func main() { fmt.println("what favorite color?") var favoritecolor string fmt.scanf("%s", &favoritecolor) fmt.println("fave color is", favoritecolor) fmt.println("what favorite food?") var myfood string fmt.scanf("%s", &myfood) fmt.printf("i %s too!\n", myfood) fmt.printf("wait 2 seconds please...\n") time.sleep(2000 * time.millisecond) fmt.printf("your favorite color %s, , nutrient best %q\n", favoritecolor, myfood) }

however first reply taken, programme continues end , returns:

what favorite color? reddish fave color reddish favorite food? too! wait 2 seconds please... favorite color red, , nutrient best ""

why sec scanf function beingness ignored? makes no sense me.

i installed go using recent 64bit bundle on windows 7.

put \n after %s consumes newline type. otherwise newline goes next scan.

go scanf

Makefile, C++ build error: forward declaration -



Makefile, C++ build error: forward declaration -

hello i'm pass construction var file function using create utility getting below error ppz help prepare it

1) var has incomplete type 2) header.h:error: foward declaration of struct st

here code:

header.h

#include<iostream> #include<stdio.h> using namespace std; void fn(struct st);

main.cpp

#include"header.h" struct st { int x; char s[10]; };

fn.cpp

#include"header.h" void fn(struct st var) { cout<<var.x<<var.s<<endl; }

makefile

all: hello hello: main.o fn.o g++ main.cpp fn.cpp main.o: main.cpp g++ -c main.cpp fn.o:fn.cpp g++ -c fn.cpp

move struct st declaration header.h, before fn().

c++ makefile structure

Variable length of input dialogue box in matlab -



Variable length of input dialogue box in matlab -

i using inputdlg in matlab come in cost of component:

x= inputdlg( cellstr( num2str((1:n).', 'input cost of component %d') ) ); x=str2double(x);

where n no of component. create array of cost. problem is, value of n, i.e n=13, after became hard view , come in data. have 40 component.

matlab

sql server - SQL - Percentage of one count by the other -



sql server - SQL - Percentage of one count by the other -

i trying percentage of first count sec count. in other words, want nbfirstcallresolutions / totalcases * 100.

select (select count([incident].incidentid) [incident],[caseresolution] [incident].incidentid = [caseresolution].regardingobjectid , [caseresolution].firstcallresolution = 1 , [incident].createdon >= @parameter_startdate , [incident].createdon <= dateadd(day,1,@parameter_enddate) ) nbfirstcallresolutions, (select count([incident].incidentid) [incident] [incident].createdon >= @parameter_startdate , [incident].createdon <= dateadd(day,1,@parameter_enddate) ) totalcases --select nbfirstcallresolutions / totalcases * 100.0

not sure how approach one...

your query should able consolidated this:

select sum(coalesce([caseresolution].firstcallresolution, 0) / count([incident].incidentid) * 100 [incident] left bring together [caseresolution] on [incident].incidentid = [caseresolution].regardingobjectid , [caseresolution].firstcallresolution = 1 [incident].createdon >= @parameter_startdate , [incident].createdon <= dateadd(day,1,@parameter_enddate

notice summed 1 value of firstcallresolution, leaving nulls 0. equivalent of counting rows.

be sure check order of operations believe multiply occur first, followed divide.

sql sql-server count percentage

api - How to call GDAL Hillshade from C++ -



api - How to call GDAL Hillshade from C++ -

i writing c++ application uses open source gdal spatial library. there commandline executable comes gdal called gdaldem. it's capable of producing hillshade rasters digital elevation models.

can please tell me how phone call hillshade code, through gdal api. want phone call api straight , not utilize command line executable.

i'm afraid isn't part of libgdal api. however, can "borrow" parts of gdaldem.cpp, such structures , functions used processing hillshade.

c++ api gdal

android - Image not getting loaded using UIL, volley or picasso -



android - Image not getting loaded using UIL, volley or picasso -

i trying load image using various image loaders. failed. can tell me reason? have tried image url , working each of them. url: http://kbsi.in/images/books/gbp/front/i-have-a-dream.jpg

try aquery.

aquery maquery = new aquery(this); maquery.id(view.findviewbyid(r.id.imageview)).image("http://kbsi.in/images/books/gbp/front/i-have-a-dream.jpg", true, true);

i tested , works!

android

python possible indentation error? don't know what's gone wrong? -



python possible indentation error? don't know what's gone wrong? -

i'm having issues programme had completed it. don't see much wrong error saying "while" syntax error.

pass1 = raw_input("please come in password(must contain number,at to the lowest degree 1 capital letter , must longer 6 characters): ") time.sleep(1) pass2 = raw_input("please re-enter password: ") updown = any(map(str(isupper, pass1)) while not pass1 or not pass1 == pass2 or not num_there(pass1) == true or len(pass1) < 6: if updown == false: print "\n password not accepted!" pass1 = raw_input("please come in password(must contain number,at to the lowest degree 1 capital letter , must longer 6 characters): ") time.sleep(1) pass2 = raw_input("please re-enter password: ") else: go on else: print "password accepted!" f.write(pass1)

you missing closing parenthesis:

updown = any(map(str(isupper, pass1)) # ^ ^ ^ ^^? # \ \ \------------/// # \ ----------------// # --------------------

fix problem adding missing 3rd ):

updown = any(map(str(isupper, pass1)))

python allows logical lines implicitly span multiple physical lines, provided surround look in parentheses or brackets or braces.

but means if missing closing parenthesis, python doesn't find out there problem look until next line.

so, rule of thumb, if syntax error in python doesn't create sense, @ lines before , count brackets.

however, in case added opening parentheses should have used .. look tried utilize should be:

updown = any(map(str.isupper, pass1))

python syntax-error

c# - Is it possible to force launch mono runtime on x86? -



c# - Is it possible to force launch mono runtime on x86? -

i have simple program:

using system; public class programme { public static void main() { console.writeline(intptr.size); } }

let's build mono compiler x86 application , run on x64 mono:

$ uname -srvmpio ; lsb_release -d linux 3.13.0-32-generic #57-ubuntu smp tue jul 15 03:51:08 utc 2014 x86_64 x86_64 x86_64 gnu/linux description: ubuntu 14.04.1 lts $ mono --version mono jit compiler version 3.10.0 (tarball mon oct 27 14:33:41 ist 2014) copyright (c) 2002-2014 novell, inc, xamarin inc , contributors. www.mono-project.com tls: __thread sigsegv: altstack notifications: epoll architecture: amd64 disabled: none misc: softdebug llvm: supported, not enabled. gc: sgen $ mcs -platform:x86 program.cs $ mono program.exe 8

mono has launched program. has launched programme x64 application. if run binary file on windows microsoft .net runtime, 4 in console output (it run x86 application). so, possible forcefulness launch mono runtime x86?

the -platform:x86 flag compiler. has no bearing on memory space allocated programme mono runtime. if want run programs 64 bits utilize 64 bits mono runtime. if want run programs 32 bits utilize 32 bits mono runtime.

this question duplicate of mono interop: loading 32bit shared library not work on 64bit system

c# .net mono x86 64bit

Date Time format according to culture in MS SQL 2008 -



Date Time format according to culture in MS SQL 2008 -

this code converts datetime particular format i.e mm/dd/yyyy (culture:"en-us")

convert(varchar(max),getdate(),101)

i want convert datetime format depending on culture. example,

(1)date format of danish culture dd-mm-yyyy (da-dk)

(2)date format of german culture dd.mm.yyyy (de-de)

how can acheive in ms sql server 2008

in knowledge possible date , time per civilization defined, after sql server 2012 , above. below can accomplish making custom function per civilization homecoming date , time in required format.

sql-server-2008

html - iPhone 6 Plus website display issue -



html - iPhone 6 Plus website display issue -

i got new iphone 6+ , tried check website on (in both safari & chrome) , realised displaying funny.

there white strip runs downwards right side of website shouldn't there (click here)

it should (this xcode ios sim displays fine)

can confirm iphone 6/6+ ?

any ideas on , how prepare it? in advance!

sorry new here...

i wasn't sure causing problem because website displayed correctly on platforms iphone 6 plus (and mums old htc), , wasn't sure part of css code show all..

anyways managed prepare it.. changed css method using create total browser width header bar border script negative margin one... seemed prepare problem..

if else experiences , wants help can nail me up...

html css iphone ios8

c++ - Using static const class instance for a switch / case -



c++ - Using static const class instance for a switch / case -

i have class acts little enum, each instance of has unique int value starts @ 0 , increments @ every new instance.

class myenumlikeclass { static int nextid = 0; static const myenumlikeclass first; static const myenumlikeclass second; const int val_; public : myenumlikeclass() : val_(nextid++) { } operator int() const { homecoming val_; } //other methods (usually getters) omitted clarity }

i trying utilize in switch case can

myenumlikeclass value; switch(value) { case myenumlikeclass::first : break; case myenumlikeclass::second : break; default : }

i getting "case value not constant expression" errors seem because compiler doesn't know values @ compile time.

is there way work?

the argument case statement must integral constant look prior c++11. easiest way utilize const int or actual enum. if you're using c++11 can utilize built-in enum class support. see scoped enumerations.

c++ switch-statement constants

trigonometry exercise in C -



trigonometry exercise in C -

i need create programme calculate height of building, have few variable s, alfa, , beta. need find u, phi , high height. far have written programme starts 2 warnings s , u used uninitilized, , when start programme makes calculation phi, fails sum u , find h, 0.000000 h.

#include <stdio.h> #include <math.h> double u (double s, double alfa , double phi1) { double u1; u1 = s * (double)sin(alfa)/ sin(phi1); homecoming u1; } double phi (double alfa, double beta) { double phi1; phi1 = beta - alfa; homecoming phi1; } double high (double u1, double beta, double alfa) { double high1; double phi1; double s; phi1 = phi(alfa, beta); // solution, need phone call funktion before utilize them in high// u1 = u(s, alfa, phi1); high1 = u1 * sin (beta); homecoming high1; } int main () { double s; double alfa; double beta; double high1; double phi1; double u1; printf("give s:"); scanf("%lf", &s); printf("give alfa:"); scanf("%lf", &alfa); printf("give beta:"); scanf("%lf", &beta); high1 = high(u1, beta, alfa); phi1 = phi(alfa, beta); u1= u(s, alfa, phi1); printf("the tower has high of: %lf metern\n.", high1); printf("s is: %lf meter\n.", s); printf(" alfa %lf grad\n.", alfa); printf(" beta %lf grad\n.", beta); printf(" gama %lf grad\n.", phi1); homecoming 0 ; }

u1 uninitialized when used high.

c

sql - Collapsing resultset based on group by - Oracle -



sql - Collapsing resultset based on group by - Oracle -

input records in txn_ctry table:

txn_id ben_code ben_ctry ben_score orig_code orig_ctry orig_score 1 usa 1 zz unknown -1 2 ca canada 1 pr portugal 2.3 2 de federal republic of germany 1.5 mx united mexican states 8.5 2 fr french republic 2.5 zz unknown -1 3 aa anon -2 usa 1 3 ca canada 1 aa anon -2 3 usa 1 aa anon -2

output required:

txn_id ben_code ben_score orig_code orig_score 1 1 zz -1 2 fr 2.5 mx 8.5 3 ca 1 1

requirement find highest ben_score , orig_score per txn_id shown in output.

as shown in sample input info (more rows per txn_id can exist,but info snippet), txn_id = 1 has 1 row , hence straight forward.

txn_id = 2 has 3 rows , highest ben_score ben_code = fr , highest orig_score orig_code = mx

in case of tie between codes within txnid, code ascending alphabetical order needs selected case txn_id = 3 ben_code values of , ca have tie same high score of 1, ca should picked based on alphabetical order of corresponding ctry column (ben_ctry , orig_ctry).

i appreciate solutions desired output in single query.

this query implement requirements:

with enhanced_data ( select data.txn_id, first_value(ben_code ) on ( partition txn_id order ben_score desc, ben_code asc) first_ben_code, first_value(ben_score ) on ( partition txn_id order ben_score desc, ben_code asc) first_ben_score, first_value(orig_code ) on ( partition txn_id order orig_score desc, orig_code asc) first_orig_code, first_value(orig_score) on ( partition txn_id order orig_score desc, orig_code asc) first_orig_score info ) select distinct txn_id, first_ben_code, first_ben_score, first_orig_code, first_orig_score enhanced_data order txn_id

see sqlfiddle here.

i suspect you'll need proper indexing, if these big info sets.

sql oracle oracle11g

Java Regex Help on \p{Punct} -



Java Regex Help on \p{Punct} -

i have next regexes, 1 \p{punct} , other 1 without

snippet (1):

add(\s[\w\p{punct}]+)+(\s#\w+)*

snippet (2):

add(\s[\w]+)+(\s#\w+)*

if input "add purchase egg #grocery testing", result matching in (1) not matching in (2). thought happening?

your sec regex allows # @ start of lastly matched word in string stating "add" while in sentence # exists in word wasn't last. \p{punct} character class includes # character class [\w\p{punct}] lets match

\w alphabetic characters, digits , _ and \p{punct} punctuation: 1 of !"#$%&'()*+,-./:;<=>?@[]^_`{|}~

which lets #grocery matched if not lastly word.

java regex

node.js - Point subdomain and root/www to different Heroku apps -



node.js - Point subdomain and root/www to different Heroku apps -

i've been trying set dns couple of apps using same domain.

i want www.playfade.com , playfade.com redirect playfade.herokuapp.com, set cname , alias respectively point heroku app. works fine.

i want beta.playfade.com point @ soundedout.herokuapp.com. this, set cname beta.playfade.com soundedout.herokuapp.com. this, however, doesn't work. when access beta.playfade.com, i'm redirected www.playfade.com.

i used mxtoolbox check beta.playfade.com , given few errors:

class="snippet-code-html lang-html prettyprint-override"> bad glue detected parent server gave glue beta.playfade.com soundedout.herokuapp.com resolve hostname 176.34.187.173 at to the lowest degree 1 name server failed respond in timely manner failure detail: 176.34.187.173 local ns list not match parent ns list 50.31.242.53 reported parent, not locally 198.241.11.53 reported parent, not locally 198.241.10.53 reported parent, not locally 50.31.243.53 reported parent, not locally 176.34.187.173 reported locally, not parent serial numbers not match

i've set domains correctly in heroku dashboard well.

any help appreciated.

➜ ~ dig beta.playfade.com ; <<>> dig 9.8.3-p1 <<>> beta.playfade.com ;; global options: +cmd ;; got answer: ;; ->>header<<- opcode: query, status: nxdomain, id: 64369 ;; flags: qr rd ra; query: 1, answer: 0, authority: 1, additional: 0 ;; question section: ;beta.playfade.com. in ;; authorization section: playfade.com. 296 in soa ns1.dnsimple.com. admin.dnsimple.com. 2014110501 86400 7200 604800 300 ;; query time: 668 msec ;; server: 85.37.17.16#53(85.37.17.16) ;; when: thu nov 6 10:29:27 2014 ;; msg size rcvd: 90

there no cname configured hostname beta.playfade.com. create sure configure it, , create sure have no redirect configuration within app (or if have it, tweak accordingly).

node.js heroku dns dnsimple

php - display result from dropdown menu only when value from it is selected -



php - display result from dropdown menu only when value from it is selected -

this code demo part of search form. actual search form contains 3 dropdown list, values selected dropdown list acts keyword on basis of search conducted. dropdown list contains fruits such mango, apple, grapes etc. search code working fine. issue first alternative displayed in dropdown list select (that holds no value), below actual list of fruit starts, still value of first fruit getting selected when page getting loaded first time . trying when page loads first time i.e value in drop downwards list select nil should displayed , after when user selects value dropdown , hits submit button result should displayed

<div class="col-md-3 col-sm-5"> <div class="media"> <div class="media-body"> <?php $servername = "localhost"; $username = "root"; $password = ""; $dbname = "db"; // create connection $con = mysqli_connect($servername, $username, $password, $dbname); // check connection if (!$con) { die("connection failed: " . mysqli_connect_error()); } $sql = "select fruits fruits"; $result = $con->query($sql); echo "<label for='fruits'>treatment type: </label>"; echo "<select name='fruits' id='fruits' class='form-control'><option value=''>--select--</option>"; while($row = $result->fetch_assoc()) { echo "<option value='" . $row['fruits'] . "'>" . $row['fruits'] . "</option>"; } echo "</select>"; ?> </div> </div> </div>

code search part

<?php $con=mysqli_connect("","","","");// check connection if (mysqli_connect_errno()) { echo "failed connect mysql: " . mysqli_connect_error(); } $fruits = mysqli_real_escape_string($con, $_post['fruits']); $sql1 = "select * treatment fruits '%$fruits%'"; $result = mysqli_query($con, $sql1); echo "<table class='table table-striped table-bordered responsive'> <thead> <tr> <th>name</th> <th>type</th> <th>fruits</th> </tr> </thead>"; if (mysqli_num_rows($result) > 0) { while($row = mysqli_fetch_assoc($result)) { echo "<tbody data-link='row' class='rowlink'>"; echo "<tr>"; echo "<td><a href='#'>" . $row['name'] . "</a></td>"; echo "<td>" . $row['type'] . "</td>"; echo "<td>" . $row['fruits'] . "</td>"; echo "</tr>"; echo "</tbody>"; } } else { echo "0 results"; } echo "</table>"; mysqli_close($con); ?>

would appreciate if can guide me

p.s (edited part)

<div class="col-md-3 col-sm-5"> <div class="media"> <div class="media-body"> <?php $servername = "localhost"; $username = "root"; $password = ""; $dbname = "db"; // create connection $con = mysqli_connect($servername, $username, $password, $dbname); // check connection if (!$con) { die("connection failed: " mysqli_connect_error()); } $sql = "select fruits fruits"; $result = $con->query($sql); ?> echo "<label for="fruits">treatment type: </label>"; echo "<select name="fruits" id="fruits" class="form-control"> <option value="" <?php if(!isset($_post['fruits'])) { ?>selected<?php } ?>>--select--</option>"; <?php while($row = $result->fetch_assoc()) { ?> echo "<option value="<?php echo $row['fruits']; ?>" <?php if(isset($_post['fruits']) && $_post['fruits'] == $row['fruits']) { ?>selected<?php } ?>><?php echo $row['fruits']; ?></option>"; <?php } ?> </select> </div> </div> </div>

in <option> portions, modify bit. add together selected conditions:

<div class="col-md-3 col-sm-5"> <div class="media"> <div class="media-body"> <?php $servername = "localhost"; $username = "root"; $password = ""; $dbname = "db"; // create connection $con = mysqli_connect($servername, $username, $password, $dbname); // check connection if (!$con) { die("connection failed: " . mysqli_connect_error()); } $sql = "select fruits fruits"; $result = $con->query($sql); ?> <label for="fruits">treatment type: </label> <select name="fruits" id="fruits" class="form-control"> <option value="" <?php if(!isset($_post['fruits']) || (isset($_post['fruits']) && empty($_post['fruits']))) { ?>selected<?php } ?>>--select--</option> <?php while($row = $result->fetch_assoc()) { ?> <option value="<?php echo $row['fruits']; ?>" <?php if(isset($_post['fruits']) && $_post['fruits'] == $row['fruits']) { ?>selected<?php } ?>><?php echo $row['fruits']; ?></option> <?php } ?> </select> </div> </div> </div>

results page:

<?php $con = mysqli_connect("","","","");// check connection if(mysqli_connect_errno()) echo "failed connect mysql: " . mysqli_connect_error(); $fruits = mysqli_real_escape_string($con, $_post['fruits']); if(!empty($fruits)) { $sql1 = "select * treatment fruits '%$fruits%'"; $result = mysqli_query($con, $sql1); $count = mysqli_num_rows($result); } else $count = 0; ?> <table class='table table-striped table-bordered responsive'> <thead> <tr> <th>name</th> <th>type</th> <th>fruits</th> </tr> </thead> <?php if ($count > 0) { while($row = mysqli_fetch_assoc($result)) { ?> <tbody data-link='row' class='rowlink'>"; <tr> <td><a href='#'><?php echo $row['name']; ?></a></td> <td><?php echo $row['type']; ?></td> <td><?php echo $row['fruits']; ?></td> </tr> </tbody><?php } } else echo "0 results"; ?> </table> <?php mysqli_close($con); ?>

php html sql drop-down-menu mysqli

tfsbuild - My build time exceeds 8 hours - what to do? -



tfsbuild - My build time exceeds 8 hours - what to do? -

i made changes build server post-build optimizations such optimizing png , jpeg images, minifying javascript , css, , deploying total project production environment.

for js optimization using uglifyjs on every javascript file in website root. png images using pngcrush, brute-force best optimization technique every image (this 1 taking longest time). jpeg optimization using imagemagick.

in general, want know this: how larger corporations avoid having long build/deployment times?

i can live 8 hours of build time, since server builds @ saturdays, , @ night. however, can imagine problem getting worse.

am doing wrong?

pngcrush without -brute alternative runs 15 times fast "pngcrush -brute" achieves same compression. -brute alternative squeezes images little fraction of percent more, if any.

tfsbuild build-server

android - How to parse xml having only child nodes using SAX Parser -



android - How to parse xml having only child nodes using SAX Parser -

this xml info server. when seek parse using sax parser gives exception in end document saying "junk info found". reason is: tag1 considered startdocument , hence when first closing tag1 found considers enddocument found , rest info considered junk. how can go on parsing? solution this?

<tag1 id ="browse"> <title id = "title">xml</title> <text>text001<text> <text>text002</text> </tag1><tag1 id="status"> <title id = "title">xml source</title> <text>text003<text> <text>text004</text> </tag1>

ps: can't modify xml response server. response chunks of kid nodes without enclosing parent tag. java applet have uses property called: "parser.setproperty("http://apache.org/xml/features/continue-after-fatal-error", boolean.valueof(true));" works fine. gives saxnotfoundexception in android

android

java - How can I call this method in another activity? -



java - How can I call this method in another activity? -

in main activity, have method:

public void cancelalarms() { alarmmanager manager = (alarmmanager) getsystemservice(context.alarm_service); intent intent = new intent(context, alarmreceiver.class); pendingintent = pendingintent.getbroadcast(context, 0, intent, 0); manager.cancel(pendingintent); }

but want phone call in other activity.

how can phone call 1 activity another? also, alright if using context in method? context alter if phone call activity one?

you should move method utility class or base of operations activity class, reason mention: depends on context.

you won't able invoke method without having reference instance of activity in, because not marked static. , if did, utilize host activity--probably not intend.

instead, create utility class containing method. there 2 ways go this: pass context in function every time, or pass context 1 time class's constructor. former improve one-off convenience methods grouped utilities class, while latter bit more java-like , improve if class has definite function (like activityalarmwrangler).

finally, move function base of operations class. cleanest simple cases because don't have have different fellow member object in activity, if activity extends custom superclass, won't able utilize method unless willing modify superclass. because java doesn't have multiple inheritance (which useful in case), inheriting method hairy quickly.

java android

jquery - Putting javascript variable into xsl attribute -



jquery - Putting javascript variable into xsl attribute -

<script type="text/javascript"> var i=0; function increase() { i++; document.getelementbyid('slide').innerhtml= +i; document.getelementbyid('slidenum').innerhtml = document.getelementbyid('slide').innerhtml; } </script> <p> slide: <slide id="slide">0</slide> </p> <xsl:variable name="slidenum"> <slidenum id="slidenum">0</slidenum> </xsl:variable> <p> <xsl:variable name="imgsrcs"> <xsl:value-of select="//movie[@num='($slide)']/thumb_img"/> </xsl:variable>

here have function increment slide 1 every onclick forwards button. want set slide id imgsrcs variable says $slide onclick of forwards button go next film if possible don't know much css or javascript place larn how can create slideshow help.

assuming xslt runs outside of browser:

javascript runs when page displayed in browser, while xslt generating html before browser loads (on server side). there no way javascript have impact on xsl variables.

what can transform xml film info javascript dictionary, this:

<script type="text/javascript"> var thumbs = { <xsl:foreach select="//movie"> "<xsl:value-of select="@num"/>": "<xsl:value-of select="thumb_img"/>", </xsl:foreach> }; </script>

and update html using like:

var img=document.getelementbyid("..."); img.url = thumbs[$slide];

the code not tested, give thought how can that.

please note have check whether info needs escaped when generating javascript xml (f.e. create sure there no quotes in xml data).

javascript jquery html css xslt

xcode - Include non-modular header inside framework module with Allow non-modular includes set to YES -



xcode - Include non-modular header inside framework module with Allow non-modular includes set to YES -

background i'm building api framework in swift. want include reachability class can used internally , externally.

status i've copied source of reachability class provided tony million, added import statement header. .h file set public in headers section of build phases. i've set allow non-modular includes in framework modules yes in both project , target. whenever go build project, error:

include of non-modular header within framework module 'myframework.reachability'

on line imports ifaddrs.h.

question how can project build? there framework need link against isn't systemconfiguration?

have @ sample project: https://github.com/tomaskraina/swift-modules-reachability

it consists of apiframework , reachabilityapp , demonstrates how set can utilize reachability both internally in framework externally - in app.

xcode swift ios8 reachability

Jenkins job scheduler -



Jenkins job scheduler -

how can set jenkins run job @ particular time? if i'd set 8:30am every weekday , do

h 7 * * 1-5

this randomly picks 7:35am running time.

h pseudo-random number, based on hash of jobname.

when configured: h 7 telling it:

at 7 o'clock, @ random minute, same min time

here help straight jenkins (just click ? icon)

to allow periodically scheduled tasks produce load on system, symbol h (for “hash”) should used wherever possible. example, using 0 0 * * * dozen daily jobs cause big spike @ midnight. in contrast, using h h * * * still execute each job 1 time day, not @ same time, improve using limited resources.

the h symbol can used range. example, h h(0-7) * * * means time between 12:00 (midnight) 7:59 am. can utilize step intervals h, or without ranges.

the h symbol can thought of random value on range, hash of job name, not random function, value remains stable given project

if want @ 8:30 every weekday, must specify that: 30 8 * * 1-5

jenkins

SQL Server : login success but "The database [dbName] is not accessible. (ObjectExplorer)" -



SQL Server : login success but "The database [dbName] is not accessible. (ObjectExplorer)" -

i using windows 8.1 , sql server 2012.

i using os business relationship "manoj" accessing sql server windows authentication. have deleted user business relationship "manoj" of os , created new business relationship same name "manoj".

but scheme took new business relationship "manoj_2". alter keeps me out accessing old databases, have created.

it says

the database [dbname] not accessible. (objectexplorer)

whenever seek access of previous dbs have created.

i used create new login in sql server "manoj_2", default db "master". still problem persists.

i cannot able detach dbs. unable expand dbs.

note: in os, have admin rights "manoj" account.

please tell me, do? either os or sql server

for situation have connect database in single-user mode.

starting sql server in single-user mode enables fellow member of computer's local administrators grouping connect instance of sql server fellow member of sysadmin fixed server role.

here can find step-by-step instruction this.

in short must start sqlserver instance parameters -m, after start sql server management studio windows authentication.

now sysadmin, assign sysadmin role user, exit , remove -m parameter , restart sql server.

sql-server login

sql - Incorrect use of DISTINCT -



sql - Incorrect use of DISTINCT -

i have form view displays listingid, propertyid, listingagentid, salestatusid, endlistdate , askingprice database in sql.

i have dropdownlist displays lastnames of agents when selected returns relevent info in formview corresponding selection.

it's working, problem each lastly name in dropdownlist duplicated each have more 1 listing. need when selecting 1 lastly name dropdownlist returns 1 value in formview, while beingness able utilize paging view different listings agent.

the code in formview is:

select[listingid], [propertyid], [listingagentid], [salestatusid], [endlistdate], [askingprice] [listings] ([listingid] = @listingid)

the code in dropdownlist is:

select agents.lastname, listings.listingid, listings.propertyid, listings.listingagentid, listings.salestatusid, listings.beginlistdate, listings.endlistdate, listings.askingprice agents inner bring together listings on agents.agentid = listings.listingagentid

where ever seek , set distinct function returns error or doesn't work

thanks

for dropdown need id value , lastname display.

select distinct agents.lastname agents inner bring together listings on agents.agentid = listings.listingagentid

sql visual-studio-2012 distinct

command line - PowerShell Remove all users from a specific group -



command line - PowerShell Remove all users from a specific group -

i'm trying clean users local grouping test_group executing next command below on windows 2008 r2 standard, powershell 2.0.

get-adgroupmember "test_group" | foreach-object {remove-adgroupmember "test_group" $_ -confirm:$false}

it throws next error, because i'm using v2.0?:

the term 'get-adgroupmember' not recognized name of cmdlet, function, script file, or operable program. che ck spelling of name, or if path included, verify path right , seek again. @ line:1 char:18 + get-adgroupmember <<<< "test_group" | foreach-object {remove-adgroupmember "test_group" $_ -confirm:$false} + categoryinfo : objectnotfound: (get-adgroupmember:string) [], commandnotfoundexception + fullyqualifiederrorid : commandnotfoundexception

i tried many ideas article , comments, , couldn't work i'm not sysadmin , i'm not sure if i'm not missing something?: http://blogs.technet.com/b/heyscriptingguy/archive/2009/07/28/hey-scripting-guy-how-do-i-remove-all-group-members-in-active-directory.aspx

please help, have around 300 groups clean on mon , don't want manually...

not sure if if typo or how running command should get-adgroupmember

get-adgroupmember "test_group" | foreach-object {remove-adgroupmember "test_group" $_ -confirm:$false}

that worked me had refresh aduc ou see alter though

edit

import activedirectory module first seek , run command.

import-module activedirectory get-adgroupmember "test_group" | foreach-object {remove-adgroupmember "test_group" $_ -confirm:$false}

powershell command-line active-directory

excel - Power Query wont import any access files -



excel - Power Query wont import any access files -

hello , give thanks taking time read this, had microsoft office 2010 , 2013 on machine. causing problems opening excel 2010 instead of 2013, uninstalled 2010. after did have received error when seek connect access database.

"datasource.notfound: microsoft access: 'microsoft.ace.oledb.12.0' provider not registered on local machine.. access database engine 2010 access database engine oledb provider required connect read type of file."

i able connect other sources such web files , excel files, other files have tried connect to.

i have tried uninstall , reinstall powerfulness query; uninstall , reinstall office.

all help appreciated.

excel ms-access powerquery

c++ - Using SWIG and the Python/C API to wrap a function which returns a std::map -



c++ - Using SWIG and the Python/C API to wrap a function which returns a std::map -

i want wrap c++ routine returns std::map of integers , pointers c++ class instances. having problem getting work swig , appreciate help can offered. i've tried boil issue downwards essence through simple example.

the header test.h defined follows:

/* file test.h */ #include <stdlib.h> #include <stdio.h> #include <map> class test { private: static int n; int id; public: test(); void printid(); }; std::map<int, test*> get_tests(int num_tests);

the implementation defined in test.cpp below:

/* file test.cpp */ #include "test.h" std::map<int, test*> get_tests(int num_tests) { std::map<int, test*> tests; (int i=0; < num_tests; i++) tests[i] = new test(); homecoming tests; } int test::n = 0; test::test() { id = n; n++; } void test::printid() { printf("test id = %d", id); }

i have written swig interface file test.i seek accommodate routine can homecoming std::map<int, test*> dictionary in python:

%module test %{ #define swig_file_with_init #include "test.h" %} %include <std_map.i> %typemap(out) std::map<int, test*> { $result = pydict_new(); int size = $1.size(); std::map<int, test*>::iterator iter; test* test; int count; (iter = $1.begin(); iter != $1.end(); ++iter) { count = iter->first; test = iter->second; pydict_setitem($result, pyint_fromlong(count), swig_newpointerobj(swig_as_voidptr(test), swigtype_p_test, swig_pointer_new | 0)); } } %include "test.h"

i wrap routines , compile swig-generated wrapper code, , link shared library follows:

> swig -python -c++ -o test_wrap.cpp test.i > gcc -c test.cpp -o test.o -fpic -std=c++0x > gcc -i/usr/include/python2.7 -c test_wrap.cpp -o test_wrap.o -fpic -std=c++0x > g++ test_wrap.o test.o -o _test.so -shared -wl,-soname,_test.so

i want able next within python:

import test tests = test.get_tests(3) print tests test in tests.values(): test.printid()

if run script example.py, however, next output:

> python example.py {0: <swig object of type 'test *' @ 0x7f056a7327e0>, 1: <swig object of type 'test *' @ 0x7f056a732750>, 2: <swig object of type 'test *' @ 0x7f056a7329f0>} traceback (most recent phone call last): file "example.py", line 8, in <module> test.printid() attributeerror: 'swigpyobject' object has no attribute 'printid'

any ideas why swigpyobject instances output, rather swig proxies test? help appreciated!

as stands problem you're seeing caused default behaviours in swig provided std_map.i. supplies typemaps seek wrap std::map usage sensibly.

one of interfering own out typemap, if alter interface file be:

%module test %{ #define swig_file_with_init #include "test.h" %} %include <std_map.i> %clear std::map<int, test*>; %typemap(out) std::map<int, test*> { $result = pydict_new(); int size = $1.size(); std::map<int, test*>::iterator iter; test* test; int count; (iter = $1.begin(); iter != $1.end(); ++iter) { count = iter->first; test = iter->second; pyobject *value = swig_newpointerobj(swig_as_voidptr(test), swigtype_p_test, 0); pydict_setitem($result, pyint_fromlong(count), value); } } %include "test.h"

then illustration works. %clear suppresses default typemaps std_map.i, leaves definition itself. i'm not clear on causes problem beyond without more digging, utilize %template , default behaviours instead unless there's reason not to.

as aside, call:

swig_newpointerobj(swig_as_voidptr(test), swigtype_p_test, swig_pointer_new | 0));

probably doesn't wanted - transfers ownership of pointer python, meaning 1 time python proxy finished phone call delete , leave dangling pointer in map.

you can utilize $descriptor avoid having figure out swig's internal name mangling scheme, becomes:

// no ownership, lookup descriptor: swig_newpointerobj(swig_as_voidptr(test), $descriptor(test*), 0);

python c++ swig

How do I make a histogram from a csv file which contains a single column of numbers in python? -



How do I make a histogram from a csv file which contains a single column of numbers in python? -

i have csv file (excel spreadsheet) of column of 1000000 numbers. want create histogram of info frequency of numbers on y-axis , number quantities on x-axis. know matplotlib can plot histogram, main problem converting csv file string float since string can't graphed. have:

import matplotlib.pyplot plt import csv open('d1.csv', 'rb') data: rows = csv.reader(data, quoting = csv.quote_nonnumeric) floats = [[item number, item in enumerate(row) if item , (1 <= number <= 12)] row in rows] plt.hist(floats, bins=50) plt.title("histogram") plt.xlabel("value") plt.ylabel("frequency") plt.show()

you can in 1 line pandas:

import pandas pd pd.read_csv('d1.csv', quoting=2)['column_you_want'].hist(bins=50)

python csv matplotlib histogram

mysql - How apply SQL LIMIT for a three structure data? -



mysql - How apply SQL LIMIT for a three structure data? -

i utilize famous method showing 3 comment sql. how can display first 3 root comment sub-comment?

i tried create like:

select * names order pid limit 3 asc, id asc limit 3

but limit not supported sql each order by

the illustration can see here: http://sqlfiddle.com/#!2/a593d/4

more clear illustrated in loaded image

try below query

select * names inner bring together (select pid names grouping pid order pid limit 3) my_table using (pid)

demo

mysql sql tree binary-tree

How to include files with MySQL -



How to include files with MySQL -

this mse question closely related, couldn't find reply particular question here.

i wish accomplish next simple task : write file main.sql that, when it’s imported phpmyadmin, imports 4 files called create1.sql, create2.sql, create3.sql , create4.sql.

i tried writing next main.sql :

source create1.sql; source create2.sql; source create3.sql; source create4.sql;

but above doesn't work, next error message :

any help appreciated.

this works in command line ;)

mysql mysql-error-1064

ios - Automatic download Testflight builds on the device -



ios - Automatic download Testflight builds on the device -

is there way have iphone/ipad automatically download builds testflight become available?

i automated rest of building process, , when update bunch of apps sense kind of silly having go through testflight app (a webpage) , individually clicking apps updated , choosing download them.

i know if there such solution android.

if want automatically downloads, installs, , updates builds. you'll want go mobile device management vendor; such product appblade.

we given remote access ios/osx devices via api apple exposes us; , installation can triggered in browser or via apis. on android have appstore application in beta.

ios iphone ipad continuous-integration testflight

joomla - Gantry and less variables how to bridge the gap? -



joomla - Gantry and less variables how to bridge the gap? -

is there way update variables.less file variables user selection area in backend? such template-options.xml

or can made inline through styledeclaration.php?

you should read http://gantry-framework.org/documentation/joomla/advanced/less_css.md

you should write php reads template-options.xml , create /less/[less_file_name]-custom.less file variables, or pass variables array $gantry->addless() function.

joomla less

windows - Carriage return + Linefeed => Line feed -



windows - Carriage return + Linefeed => Line feed -

i understand mac os x uses unix convention of new line, windows uses carriage return, linefeed @ end of lines.

do know tools convert carriage homecoming + linefeed line feed working on mac os? or commands convert it?

if utilize mac utilize such dos2unix , unix2dos (http://sourceforge.net/projects/dos2unix/). if creating files on windows , moving them mac can utilize programme notepad , alter eol setting (eol conversion in notepad ++).

indiana university has page on @ https://kb.iu.edu/d/acux, if utilize perl method , scripting language convert many files @ once. utilize automator on mac create droplet drop 1 or more text files onto , automatically converts file.

windows osx terminal

php - Undefined variable Array Slim Application -



php - Undefined variable Array Slim Application -

i getting error runs fine on 1 of servers php 5.4 transfered code new server php 5.5.9 , getting error:

details

type: errorexception code: 8 message: undefined variable: propertylist file: /var/www/subdomains/api/index.php line: 57 trace

the code:

$app->get("/propertylist/", function () utilize ($app, $db) { $app->response()->header("content-type", "application/json"); ob_start('ob_gzhandler'); $req = $app->request(); $bed = $req->get('bed'); $bath = $req->get('bath'); $city = $req->get('city'); $zip = $req->get('zip'); if($bed ==''){$bed=0;} if($bath ==''){$bath=0;} if($zip ==''){ $properties = $db->rets_property_listing_mrmls_resi->limit(2500,0)->where("bedrooms >= ?", $bed)->where("city ?", "%$city%")->where("bathstotal >= ?", $bath); }else{ $properties = $db->rets_property_listing_mrmls_resi->limit(2500,0)->where("bedrooms >= ?", $bed)->where("zipcode ?", "%$zip%")->where("bathstotal >= ?", $bath); } foreach ($properties $property) { $propertylist[] = array( "mlsnumber" => $property["mlnumber"], "listprice" => number_format($property["listprice"]), "streetnumber" => $property["streetnumber"], "streetname" => $property["streetname"], "sqft" => $property["squarefootagestructure"], "propertydescription" => summarymode($property["propertydescription"],15), "bedrooms" => $property["bedrooms"], "bathstotal" => $property["bathstotal"], "lo_name" => $property["lo_name"] ); } echo json_encode($propertylist); });

you need create/define variable before use:

$app->get("/propertylist/", function () utilize ($app, $db) { $app->response()->header("content-type", "application/json"); ob_start('ob_gzhandler'); $req = $app->request(); $bed = $req->get('bed'); $bath = $req->get('bath'); $city = $req->get('city'); $zip = $req->get('zip'); if($bed ==''){$bed=0;} if($bath ==''){$bath=0;} if($zip ==''){ $properties = $db->rets_property_listing_mrmls_resi->limit(2500,0)->where("bedrooms >= ?", $bed)->where("city ?", "%$city%")->where("bathstotal >= ?", $bath); }else{ $properties = $db->rets_property_listing_mrmls_resi->limit(2500,0)->where("bedrooms >= ?", $bed)->where("zipcode ?", "%$zip%")->where("bathstotal >= ?", $bath); } $propertylist = array(); //create variable type array foreach ($properties $property) { $propertylist[] = array( "mlsnumber" => $property["mlnumber"], "listprice" => number_format($property["listprice"]), "streetnumber" => $property["streetnumber"], "streetname" => $property["streetname"], "sqft" => $property["squarefootagestructure"], "propertydescription" => summarymode($property["propertydescription"],15), "bedrooms" => $property["bedrooms"], "bathstotal" => $property["bathstotal"], "lo_name" => $property["lo_name"] ); } echo json_encode($propertylist); });

php arrays

c# - CPU-greedy loop when streaming music -



c# - CPU-greedy loop when streaming music -

to give context, i'm working on opensource alternative desktop spotify client, accessibility @ it's core. you'll see naudio in here.

i'm noticing pretty intense cpu usage playback starts. when paused, cpu high.

i ran visual studio's inbuilt profiler seek , shed lite on resource hogs might occuring. suspected, problem wasin playback manager's streaming loop.

the code profiler flags 1 of sample-rich follows:

const int secondstobuffer = 3; private void getstreaming(object state) { this.fullydownloaded = false; // secondstobuffer integer represent how many seconds should buffer @ 1 time prevent choppy playback on slow connections seek { { if (bufferedwaveprovider == null) { this.bufferedwaveprovider = new bufferedwaveprovider(new waveformat(44100, 2)); this.bufferedwaveprovider.bufferduration = timespan.fromseconds(20); // allow ahead of ourselves logger.writedebug("creating buffered wave provider"); this.gatekeeper.minimumsamplesize = bufferedwaveprovider.waveformat.averagebytespersecond * secondstobuffer; } // bit in particular seems hot point if (bufferedwaveprovider != null && bufferedwaveprovider.bufferlength - bufferedwaveprovider.bufferedbytes < bufferedwaveprovider.waveformat.averagebytespersecond / 4) { logger.writedebug("buffer getting full, taking break"); thread.sleep(500); } // have @ to the lowest degree double buffered sample's size in free space, in case else if (bufferedwaveprovider.bufferlength - bufferedwaveprovider.bufferedbytes > bufferedwaveprovider.waveformat.averagebytespersecond * (secondstobuffer * 2)) { var sample = gatekeeper.read(); if (sample != null) { bufferedwaveprovider.addsamples(sample, 0, sample.length); } } } while (playbackstate != streamingplaybackstate.stopped); logger.writedebug("playback stopped"); } { // no post-processing work here, right? } }

an naudio sample inspiration way of handling streaming in method. find total file's source code, can view here: http://blindspot.codeplex.com/sourcecontrol/latest#blindspot.playback/playbackmanager.cs

i'm newbie profiling , i'm not year on year expert on streaming either (both might obvious).

is there way can create loop less resource intensive. increasing sleep amount in if block buffer total help? or barking wrong tree here. seems would, i'd have thought half sec sufficient.

any help gratefully received.

basically, you've created infinite loop until buffer gets full. section you've marked with

// bit in particular seems hot point

probably appears calculations in if statement beingness repeated on , on again; can of them moved outside of loop?

i'd set thread.sleep(50) before while statement prevent thrashing , see if makes difference (i suspect will).

c# performance audio-streaming