Posts

Showing posts from May, 2013

Moving background to infinite scroll help Swift Sprite Kit -

i'm having trouble understanding did wrong here. it's supposed infinite scroll downwards , can't fix it. help! func movebackground() { let movebackground = skaction.movebyx(0, y: -self.size.height, duration: 1.0) let repeatbackground = skaction.repeatactionforever(movebackground) let removebackground = skaction.removefromparent() let sequencethis = skaction.sequence([movebackground, repeatbackground, removebackground]) } func repeatbackground() { let generatebackground = skaction.sequence([ skaction.runblock(self.movebackground), skaction.waitforduration(2.7)]) let endlessaction = skaction.repeatactionforever(generatebackground) runaction(endlessaction) } override func didmovetoview(view: skview) { scene?.scalemode = .aspectfill var backgroundtexture = sktexture(imagenamed: "background.png") background.position = cgpoint(x: self.frame.size.width/2, y: self.frame.size.height/2) background.tex

c# - .Net RabbitMQ client Subscriber.Next hangs -

i using rabbitmq .net client in windows service. have millions of messages coming in bulk processed , output put on queue. creating connection factory heartbeat of 30 , creating connection whenever connection or subscriber lost. in production, code probably works in cases. however, in integration tests, know failing of time. here code: public void receiveall(func<idictionary<ulong, byte[]>, ionstreamwatchresult> onreceiveallcallback, int batchsize, cancellationtoken cancellationtoken) { imodel channel = null; subscription subscription = null; while (!cancellationtoken.iscancellationrequested) { if (subscription == null || subscription.model.isclosed) { channel = _channelfactory.createchannel(ref _connection, _messagequeueconfig, _connectionfactory); // instructs channel not prefetch more batch count shared queue channel.basicqos(0, convert.touint16(batchsize), false); subscription = n

Java ArrayList to Kotlin Array -

is there simple way of converting java arraylist kotlin array? following code: fun test(): array<string> { val elems = arraylist<string>() return elems.toarray() } gives error: main.kt:2:15: error: unresolved reference: arraylist val elems = arraylist<string>() ^ i'm parsing json , don't know how many elements i'm going end with, once i've read them don't need modify data in way thought i'd go kotlin arrays data type. why use array? kotlin arrays mutable java arrays. should use kotlin list, opposed mutablelist, immutable. why code doesn't compile: toarray returns object[], if want string[] list need use toarray version takes array it's argument.

c# - Vertical and Horizontal ScrollBars are not working - WPF -

i have following code: <dockpanel> <grid> <grid.columndefinitions> <!--this make control in column of grid take 1/10 of total width--> <columndefinition width="1*" /> <!--this make control in column of grid take 4/10 of total width--> <columndefinition width="4*" /> <!--this make control in column of grid take 4/10 of total width--> <columndefinition width="4*" /> <!--this make control in column of grid take 1/10 of total width--> <columndefinition width="1*" /> </grid.columndefinitions> <grid.rowdefinitions> <rowdefinition /> </grid.rowdefinitions> <border borderbrush="black" borderthickness="1" grid.row="0" gr

java - Convert json decimal number to short with hexadecimal value -

i have jsonobject contains string decimal value this: private static registerin parseregisterin(jsonobject object) { registerin toreturn = new registerin(); try { toreturn.setusername(object.getstring("username")); toreturn.setcertificate(new short(integer.tohexstring(object.get("certificate")))); } catch (jsonexception e) { e.printstacktrace(); } return toreturn; } the certificate object value 15879 corresponds 3e07 in hexadecimal. want recover jsonobject , save in short attribute. , has that. i've tried access parameter , recover posted above, following exception: java.lang.numberformatexception: invalid int: "3e07" how can decimal value, convert hexadecimal, , save in short value? note: toreturn.setcertificate(...) is short type. you need use, short.parseshort(object.getstring("certificate"), 16);

java - Read all byte from InputStream -

i want asynchronously read bytes inputstream of active tcp connection. there nothing in inputbuffer, in case want empty byte array[] , not read/timeout. i tried this: byte[] bytes = ioutils.tobytearray(tcpinputstream); but if there nothing in inputstream read hangs until tcp timeout , exception thrown. you can use non blocking socketchannels: import java.net.inetsocketaddress; import java.nio.bytebuffer; import java.nio.channels.socketchannel; ... socketchannel socketchannel = socketchannel.open(); socketchannel.connect(new inetsocketaddress("127.0.0.1", 80)); bytebuffer buffer = bytebuffer.allocate(2048); int bytesread; while ((bytesread = socketchannel.read(buffer)) >= 0) { if (bytesread == 0) thread.sleep(1000); // usefull stuff else { // use bytes , prepare buffer next read buffer.clear(); } } socketchannel.close(); also prepare ioexception when server closes connection.

How to make ssh connection in workflow through groovy script by using sand box in Jenkins? -

how make ssh connection in workflow through groovy script using sand box in jenkins? need make ssh connection server , run particular script on server particular user id.. is there way that? i had similar requirement our build system, , started this ssh.gradle task . it comes down using ant's sshexec follows: class sshtask extends defaulttask { // various properties host etc @input @optional string host @input @optional string username @input @optional string password @input @optional string keyfile @input @optional string passphrase private static boolean antinited = false sshtask() { if (!antinited) { antinited = true initant() } } protected initant() { project.configurations { sshanttask } project.dependencies { sshanttask "org.apache.ant:ant-jsch:1.8.2" } ant.taskdef(name: 'sshexec', classname: '

javascript - Where should store refetch action be made in Flux app after authentication? -

suppose have messages , loginform components, messagestore , userstore (for keeping logged-in user info). anonymous users can view messages, favoriting , other properties available authenticated. loginform modal , when user logged-in need reload data api messagestore messages objects containing user's specific properties. i can digest login_success in messagestore (or each interested store) , fire refetch action inside store. i can fire refetch action controller-view after userstore changes. in case need know stores should refetch after user logged-in. what right way doing logic in flux application? in app made uses login page , fetches user-specific events api, structure used: loginpage (on submit) -> webapiutils.login(email, password) webapiutils.login contacts api, upon response -> actions.receivelogin(response) receivelogin calls dispatcher actiontype of login response my sessionstore listens dispatch, , in switch statement case of lo

scala - How to implement `append[A](x: List[A], y: List[A]): List[A]` in tail-recursive version? -

here recursive version of append 2 lists: def append[a](x: list[a], y: list[a]): list[a] = x match { case nil => y case h :: t => h :: append(t, y) } how convert tail-recursive version? try this, though x prepended in reverse order. intended? import scala.annotation.tailrec @tailrec def append[a](x: list[a], y: list[a]): list[a] = x match { case nil => y case h :: t => append(t, h :: y) } if want prepend x in order comes with, you'ld have this: import scala.annotation.tailrec def append[a](x: list[a], y: list[a]): list[a] = { @tailrec def innerappend[a](x: list[a], y: list[a]): list[a] = x match { case nil => y case h :: t => innerappend(t, h :: y) } innerappend(x.reverse, y) }

opencobol - Invoke Java class from GnuCobol -

apologies if question has been asked previously... i'm working on proof of concept requires gnucobol(opencobol) call/execute java class. googling through number of pages suggested use of invoke statement instantiating java class. unfortunately invoke yet supported in gnucobol. pointers on how integration achieved appreciated. thanks moving comment answer, completeness. you want @ jni. gnucobol uses c application binary interface, hello world example on wikipedia jni should have hints need started. if lucky enough classes awt related, cobjapi thing bing google for. c code swig generates directly callable gnucobol, it's path , will, @ least, give set of skeletal files work from.

sql - Provider type could not be represented as a .NET type OracleTypeException -

so have application writing oracle database, reading data same database. when line dim msgtime timespan = reader.gettimespan(2) , exception (see below). the oracle documentation says interval day second (which how i'm storing data in db) can converted timespan (see here ) does know causes exception, , how avoid it? thanks. exception: oracle.dataaccess.types.oracletypeexception provider type not represented .net type @ oracle.dataaccess.types.timespanconv.gettimespan(opoitlvalctx* pvalctx, oracledbtype oratype) @ oracle.dataaccess.client.oracledatareader.gettimespan(int32 i) @ myprogram.polldatabase(object sender, doworkeventargs e) write db code: dim ocommand new oraclecommand("insert logtable(pk, mid,mdate,mtime,status,severity,origq,message) values (:pk, :msgid, :msgdate, :msgtime, :status, :severity, :message)") ocommand.parameters.add("pk", oracledbtype.varchar2, guid.newguid().tostring().substring(0, 12), parameterdirection.

javascript - How to remove svg inside a div -

i using d3.js . markup : <div class="graph-container"> <!--graph svg--> </div> <div class="graph-container"> <!--graph svg--> </div> <div> <!--some other svg--> </div> i using following js remove svg elements: d3.selectall("svg > *").remove(); but want remove svgs present inside class graph-container . how can that? d3.selectall('.graph-container svg').remove();

Modify an HTML object with Javascript in a Google Script -

like of other examples provided google on google scripts, modifying html through javascript inside success handler doesn't seem work. the example is: <script> function updateurl(url) { var div = document.getelementbyid('output'); div.innerhtml = '<a href="' + url + '">got it!</a>'; } </script> <form id="myform"> <input name="myfile" type="file" /> <input type="button" value="submit" onclick="google.script.run .withsuccesshandler(updateurl) .processform(this.parentnode)" /> </form> <div id="output"></div> and i've done quite similar: <script> function clearlist(somevalue){ document.getelementbyid('studentsform').reset() } function setstatus(somevalue){ var status = document.getelementbyid('status'); status.i

java - Btrace not returning Anything -

so introducing myself btrace getting no output out of it. script : package com.sun.btrace.samples; import com.sun.btrace.annotations.*; import static com.sun.btrace.btraceutils.*; @btrace public class alllines { @onmethod( clazz="/.*/", location=@location(value=kind.line, line=-1) ) public static void online(@probeclassname string pcn, @probemethodname string pmn, int line) { print(strings.strcat(pcn, ".")); print(strings.strcat(pmn, ":")); println(line); } } this come straight samples directory, changed "clazz="/.*/"," out of desperation printed out. no luck. the pid pointing btrace @ simple java program developped testing purpose calls method on loop. running through eclipse. any ideas missing ? thanks! update: turned on debug mode find out hanging @ "debug: checking port availability: 2020 ". ideas ? are classes trying trace compiled javac -g or @ least javac -g:lines ? need

pandas - Plot Multicolored line based on conditional in python -

Image
i have pandas dataframe 3 columns , datetime index date px_last 200dma 50dma 2014-12-24 2081.88 1953.16760 2019.2726 2014-12-26 2088.77 1954.37975 2023.7982 2014-12-29 2090.57 1955.62695 2028.3544 2014-12-30 2080.35 1956.73455 2032.2262 2014-12-31 2058.90 1957.66780 2035.3240 i make time series plot of 'px_last' column colored green if on given day 50dma above 200dma value , colored red if 50dma value below 200dma value. have seen example, can't seem make work case http://matplotlib.org/examples/pylab_examples/multicolored_line.html here example without matplotlib.collections.linecollection . idea first identify cross-over point , using plot function via groupby. import pandas pd import numpy np import matplotlib.pyplot plt # simulate data # ============================= np.random.seed(1234) df = pd.dataframe({'px_last': 100 + np.random.randn(1000).cumsum()}, index=pd.date_range('2010-01-01', periods=1000

c# - How to get object having constructor as other object in spring? -

i integrating .net application spring. have trouble getting object having constructor object. my object patterns like: public class bar { private foo foo; public void setfoo(foo foo) { this.foo = foo; } public string tostring() { return "bar! foo : \n" + foo; } } public class foo { string id { get; set; } string name { get; set; } } my old c# code: foo foo1 = new foo(); foo1.id = 1; foo1.name= "object 1, foo1"; foo foo2 = new foo(); foo2.id = 2; foo2.name= "object 2, foo2"; bar b1 = new bar(foo1); bar b2 = new bar(foo2); like without constructor using: bar bar = (bar)contextregistry.getcontext().getobject("bar"); i have searched on net , found need add foo in xml can't dynamic per call. i know spring configuration , here is: in spring.config\ <object id="bar" type="namespace.bar, projectname&

c# - why datagridview not showing private property of binded class type -

i have datagridview dgvdtmudetails show list of class blclsstaffmember public void showdata() { blclsstaffmember oblclsstaffmember = new blclsstaffmember(); list<blclsstaffmember> listaffmember = new list<blclsstaffmember>(); listaffmember = oblclsstaffmember.getallstaffmember(); dgvdtmudetails.datasource = listaffmember; } where defination of class is: public class blclsstaffmember { private int perno { get; set; } private string surname { get; set; } private string forename { get; set; } private string name { get; set; } public list<blclsstaffmember> getallstaffmember() { dtmuentities odtmuentities = new dtmuentities(); return odtmuentities.staff_member.select(s => new { s.perno, s.surname, s.forename }).tolist().distinct().select(s1 => new

angularjs - WinJS Angular Pivot Directive cannot be rendered -

it seems win-pivot angular directive not render actual pivot or pivot items on windows phone 8.1 javascript app. i'm using following setup. in addition default code created new javascript pivot app project, have added following directive on default.html file. from following code left , right pivot headers rendering (without styles). have move else reference old css files (winjs 2.1) latests. setup windows phone 8.1 vs project winjs 4.1 angular js 1.4.1 directive html <div> <win-pivot> <win-pivot-left-header>custom left header</win-pivot-left-header> <win-pivot-item header="'first'"> pivots useful varied content </win-pivot-item> <win-pivot-item header="'second'"> pivot boring however, has things data bindings: {{ratings.length}} </win-pivot-item> <win-pivot-item header="'tail...'">

Install Mapnik on Centos 7: ICU C++ Library Not Found -

problem/introduction: i'm trying install mapnik on centos 7 . i've had year unix experience in professional environment, still beginner. i've compiled , installed boost knowledge comes icu c++ libraries. unfortunately when run ./configure mapnik installation following error: exiting... following required dependencies not found: - icuuc (icu c++ library | configure icu_libs & icu_includes or use icu_lib_name specify custom lib name | more info: http://site.icu-project.org/) how install library? can't find internet resources, or maybe i'm looking in wrong places. thanks in advance. yum install freetype-devel libtool-ltdl-devel libpng-devel libtiff-devel libjpeg-devel gcc-c++ libicu-devel python-devel bzip2-devel boost libwebp-devel libtiff-devel libjpeg-turbo-devel libpng-devel sqlite-devel gdal-devel gdal-python wget https://mapnik.s3.amazonaws.com/dist/v3.0.10/mapnik-v3.0.10.tar.bz2 tar -xf ./mapnik-v3.0.10.tar.bz2 cd ./mapnik-v3.

java - How to access an IUnknown com interface on com -

as understand, every program using com communication has implement iunknown interface. the query interface method method calls query interface. my question how can use method or access iunknown interface, using jacob jar or vbscript? if possible i'd code example in vbscript. set x = createobject("object.name") that's vbscript. this in appendix of automation programming reference. note vbs getobject/createobject. cocreateinstance gets iunknown. used query idispatch. other interfaces inheiret iunknown queryref on interface iunknown's methods in every interface. **component automation** mapping visual basic automation visual basic provides full support automation. following table lists how visual basic statements translate ole apis. visual basic statement ole apis createobject (progid) clsidfromprogid cocreateinstance queryinterface idispatch interface. getobject (filename, progid) clsidfromprogid cocreateinstance q

angular directive - When and why to use &?, =?, @? in AngularJS? -

i follow tutorials make angular directives. in isolate scope, tutorials define scope like: scope: { model: '=?', data: '@?' } and tutorials define scope without question mark like: scope: { model: '=', data: '@' } can explain me difference or purpose of these proper example. thank you. the & , @ , , = symbols used define bindings (one-way, bi-directional, etc) isolated scope objects, know. here pretty thorough tutorial on how works . the ? symbol used indicate parent scope property isolated scope binding refers optional . means if reason parent scope property doesn't exist, application continue run without throwing non_assignable_model_expression exception.

NetLogo: hubnet-broadcast-message adds unwanted newline -

when sending message hubnet clients using hubnet-broadcast-message or hubnet-send-message newline added. not happen when broadcasting message using hubnet control center. example: hubnet-broadcast-message "test" hubnet-broadcast-message "test2" shows in clients as: test test2 (*another newline here*) the broadcast message option in hubnet control center gives: 3:28:19 <leader> test 3:28:21 <leader> test2 my question how broadcast message code without added newline? last message visible clients due newline.

android - Weekly repeating alarm -

i'm working on small android radio application. app fetching radio stream internet , plays on media player . works fine, next problem adding alarm in same app. alarm start radio on specific date (day,hour,minute). alarm looks same android official alarm clock. layout is: alarm.xml <?xml version="1.0" encoding="utf-8"?> <relativelayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical" android:background="#ff4379df"> <timepicker android:layout_width="wrap_content" android:layout_height="wrap_content" android:id="@+id/timepicker" android:layout_alignparenttop="true" android:layout_centerhorizontal="true" /> <linearlayout android:weightsum="7"

Androids Calendar.MINUTE does not return the correct Minute -

so have loop want poll data every 5 minutes keep api requests down minimum. problem currentmin not update when minute on android phone does. starts off correct fails stay current. ideas how can make poll data every 5 minutes? while (x==false) { currentmin= c.get(calendar.minute); //get current min system.out.println(currentmin); if (currentmin%5==0) {//poll data every 5 min ***poll data*** } } from how run method every x seconds : use handler . never, , mean never schedule tasks while in android. battery dry within minutes, lock ui , make application slow. handler h = new handler(); int delay = 1000; //interval in milliseconds h.postdelayed(new runnable(){ public void run(){ //pool data h.postdelayed(this, delay); } }, delay);

.htaccess - Redirecting SSL and Non-SSL to a different domain -

so, use couple brain cells today, life of me cannot figure out why not working rewritecond %{https} =on [or] rewritecond %{server_port} 443 rewritecond %{http_host} ^domain1.com$ [or] rewritecond %{http_host} ^www.domain1.com$ rewriterule (.*)$ http://www.domain2.com/$1 [r=301,l] rewritecond %{http_host} ^domain1.com$ [or] rewritecond %{http_host} ^www.domain1.com$ rewriterule (.*)$ http://www.domain2.com/$1 [r=301,l] while non-ssl redirects work fine, ssl redirects nothing... please help? you can use 1 rule both http , https/www , non-www rewritecond %{https} off [or] rewritecond %{https} on rewritecond %{http_host} ^(www\.)?domain1.com$ rewriterule ^(.*)$ http://www.domain2.com/$1 [r=301,l]

How to set a connection proxy in JMeter for a single thread group? -

there @ least 2 ways of setting connection proxy jmeter, i.e., in command-line parameters or in http request defaults . set connection proxy soap/xml-rpc request single thread group. @ moment, see 1 option: use regular http request sampler , set values required soap request, e.g., soap action, in headers. in doing so, can define proxy settings in aforementioned http request defaults. there better way achieve goal? thank you! in workbench of testsuite, add http proxy (right click on workbench > non-testing element > http proxy). within element, can set target controller or test fragment proxy should applied to.

javascript - MongoDB reject duplicates with compound unique index -

i'm trying reject duplicates when save new documents. my documents this: { "station_id" : "klfi", "timeasdate" : 1437656400000, "time" : "231500z", "myvisibility" : 9600, "skyconditions" : { "1" : { "cloud_base_ft_amsl" : 5009.8424, "cloud_base_ft_agl" : "5000", "sky_cover" : 3 }, "2" : 0, "3" : 0 }, "latitude" : 37.07, "longitude" : -76.37, "_id" : objectid("55b0e0df80e44b30365e41de"), "__v" : 0 } while importing new documents be, there duplicates want reject documents, have same station_id , time (only in same document). if station_id same , time different want keep it. i believe can compound unique index this: db.meteo.createindex

javascript - Nav-slider using buttons and jQuery code wont work in Safari or IE -

i created slider displays different content, customer reviews. used jquery , css add , remove classes. when next or prev button clicked reviews change. code works in chrome, not in other browsers. can't figure out why is. please help. below display html, css, , jquery code relates this. var main = function() { "use strict"; $('.arrow-next').click(function() { var currentslide = $('.active-slide'); var nextslide = currentslide.next(); var currentdot = $('.active-dot'); var nextdot = currentdot.next(); if(nextslide.length === 0) { nextslide = $('.slide').first(); nextdot = $('.dot').first(); } currentslide.fadeout(600).removeclass('active-slide'); nextslide.fadein(600).addclass('active-slide'); currentdot.removeclass('active-dot'); nextdot.addclass('active-dot'); }); $('.arrow-prev'

GSL Incorrect values with numerical Integration -

Image
i have integrand reads static double integrand(double k , void * params) { long double *p = (long double *)params; long double masssquared = p[0]; long double temp = p[1]; long double sign = p[2]; long double exp = std::exp(-std::sqrt(k*k+masssquared/(temp*temp))); double res = 0; if(sign == -1) { res = k*k*std::log(1-exp(-std::sqrt(k*k+masssquared/(temp*temp)))); } else if(sign == +1) { res = k*k*std::log(1+exp(-std::sqrt(k*k+masssquared/(temp*temp)))); } return res; }; this 1 in class called veffclass. my integration routine be long double veffclass::numintinf(long double low, double sign, long double masssquared, long double temp) { //long double res = 0; double = std::sqrt(std::log(c_threshold)*std::log(c_threshold)- masssquared/(temp*temp)); long double stepsize = (up-low)/c_intsteps; long double par[3] = {masssquared, temp, sign}; if(temp == 0) return 0; gsl_integration_workspace *w = gsl_integration_workspace_alloc(5e+5); double

java - Try to use Agent in Webapplication for bytecode Manupulation -

i'm not in java have webapplication running on wildfly. have 3 threads call function insert logs in in , function saves logs database , after every thread sends time how long did takes this. send data programm wrote has 3 threads call 1 of 3 server threads. so try bytecode manipulation every thread on server saves datetime call log function waits 1 second , returns time needed. 1 thread write in logfile before or after waitet 1 second. part wait second , call log function want inject every 3 threads bytecode manipulation. public class mytransformer implements classfiletransformer { @override public byte[] transform(classloader loader, string classname, class redefiningclass, protectiondomain protectiondomain, byte[] bytes) throws illegalclassformatexception { return transformclass(redefiningclass, bytes); } private byte[] transformclass(class classtotransform, byte[] b) { classpool pool = classpool.getdefault(); ctclass cl = null; try { cl = po

python - Numpy: add a vector to matrix column wise -

a out[57]: array([[1, 2], [3, 4]]) b out[58]: array([[5, 6], [7, 8]]) in[63]: a[:,-1] + b out[63]: array([[ 7, 10], [ 9, 12]]) this row wise addition. how add them column wise in [65]: result out[65]: array([[ 7, 8], [11, 12]]) i don't want transpose whole array, add , transpose back. there other way? add newaxis end of a[:,-1] , has shape (2,1) . addition b broadcast along column (the second axis) instead of rows (which default). in [47]: b + a[:,-1][:, np.newaxis] out[47]: array([[ 7, 8], [11, 12]]) a[:,-1] has shape (2,) . b has shape (2,2) . broadcasting adds new axes on left default. when numpy computes a[:,-1] + b broadcasting mechanism causes a[:,-1] 's shape changed (1,2) , broadcasted (2,2) , values along axis of length 1 (i.e. along rows) broadcasted. in contrast, a[:,-1][:, np.newaxis] has shape (2,1) . broadcasting changes shape (2,2) values along axis of length 1 (i.e. along columns)

database - python flask cursors.execute() of INSERT and DELETE doesn't work -

i'm new python development , trying update database following function, sadly doesn't work: def db_update_favourite(user_id, id_layer,favourite): connection = g.db cursor = connection.cursor() cursor.execute(schema) chiave="favourite_layers"; if(favourite): query = ("""insert users_properties (id_user,chiave,index,val_bigint) values(%s,%s,(select max(index)+1 users_properties),%s) """) else: query = ("""delete users_properties id_user=%s , chiave=%s , val_bigint=%s """) print query %(user_id,chiave,id_layer) try: res= cursor.execute(query, (user_id,chiave,id_layer)) except exception e: print e print res print cursor.rowcount return cursor.rowcount>=1 if go , check database see function didn't change database @ all. if instead, try 2 queries manually psql

c# - Why is there a difference in using for or foreach with TabPage.Controls? -

i have problem, that: tabpage tab = new tabpage(); [...] (int = 0; < tab.controls.count; i++) { debug.writeline(i + " - " + tab.controls[i].name + " - " + tab.controls[i].text); } has not same result than: tabpage tab = new tabpage(); [...] int j = 0; foreach (control ctl in tab.controls) { debug.writeline(j + " - " + ctl.name + " - " + ctl.text); j++; } the for loop has in case result 53 items ( count shows 53) foreach loop has result 27 items. i cannot understand this. reason? i solve problem own: the second sourcecode wasn't posted this: tabpage tab = new tabpage(); [...] int j = 0; foreach (control ctl in tab.controls) { debug.writeline(j + " - " + ctl.name + " - " + ctl.text); tab2.controls.add(ctl); j++; } => moved accidental control during foreach loop, want clone , answer how it: clone controls - c# (winform) now fixed that: foreach (control ctl in

nlp - Natural Language Processing books or resource for entry level person? -

can gives suggestions natural language processing book. following factors have in mind: it gives overview of these huge topics without depth. concepts need explain in picture form. sample code in java/python/r. you can @ online courses nlp. oftain contain videos, exercices, writing documents, suggested readings... i 1 : https://www.coursera.org/course/nlp (see suggested readings section instance). can access lectures here : https://class.coursera.org/nlp/lecture (pdf + video + subtitles).

JavaScript Module assignment pattern -

i reading a javascript module pattern , , wondering why bother module assignment firing immediate anonymous function call this: yahoo.myproject.mymodule = function () { return { mypublicproperty: "i'm accessible yahoo.myproject.mymodule.mypublicproperty.", mypublicmethod: function () { yahoo.log("i'm accessible yahoo.myproject.mymodule.mypublicmethod."); } }; }(); instead of directly assign object yahoo.myproject.mymodule this: yahoo.myproject.mymodule = { mypublicproperty: "i'm accessible yahoo.myproject.mymodule.mypublicproperty.", mypublicmethod: function () { yahoo.log("i'm accessible yahoo.myproject.mymodule.mypublicmethod."); } }; in example, there isn't point. didn't read enough of document linked to. section 3 add "private" methods , variables in anonymous function prior return statement. , , demon

performance - Improving the code for Lemoine's conjecture -

i trying improve following code: the code written solve following equation: 2*n + 1 = p + 2*q this equation denotes given integer number n value 2*n + 1 can represented p + 2*q p , q prime numbers. has been proved many years ago , called lemoine's conjecture . the input code number ( n>2 ) , output matrix including 2 columns of valid prime numbers. n = 23; s = 2*n+1; p = primes(s); v = []; kk = 1; ii=1:length(p) jj=1:length(p) if (s == p(ii)+2*p(jj)) v(kk,:) = [p(ii) p(jj)]; kk = kk + 1; end end end the result ; v = 13 17 37 5 41 3 43 2 and instance: 2*23+1 = 43 + 2*2 is there way rid of loops in matlab? update: suggested @daniel, works n = 23; s = 2*n+1; p = primes(s); ii=1:length(p) if ismember(s - p(ii),p) v(kk,:) = [p(ii) s-p(ii)]; end end you can replace loops vectorized solution using bsxfun - [r,c] = find(bsxfun(@

Cannot connect to remote interpreter in Phpstorm 9 -

i have remote server (ubuntu 14) setup under settings,deployment name remoteserver connecting via ssh + private key. can browse remote files, edit, upload download etc. under tools, start ssh-session, can use terminal. but when try add remote server languages & frameworks,php, interpreter - cannot working. (i have equivalent setup vagrant working fine - have deployment server called vagrant-ssh , using interpreter there in project). attempt connect server fails when in interpreters dialog. clicking on deployment host url: - ssh://me@remotesite.com:22 - brings test sftp connection dialog - connection 'mysite.com' failed.connection failed. but, when first add php interpreter, uploads helpers ~/.phpstorm_helpers. claims php not installed @ /usr/bin/php (that command work). clicking browse button again tells me error in connecting mysite.com. tried setting ssh credentials same result (every key error related aes256-cbc not being supported - [i tried both putty .ppk , o

android - NotificationCompat not grouping notifications -

i'm trying group notifications apparently keep coming separately. notificationmanager mnotificationmanager = (notificationmanager) this.getsystemservice(context.notification_service); intent resultintent = new intent(this, splashscreenbaseactivity.class); resultintent.putextra(arguments.arg_notification_type, news_type); taskstackbuilder stackbuilder = taskstackbuilder.create(this); stackbuilder.addnextintent(resultintent); pendingintent resultpendingintent = stackbuilder.getpendingintent( 0, pendingintent.flag_update_current ); notificationcompat.builder mbuilder = new notificationcompat.builder(this) .setsmallicon(r.drawable.ic_launcher_small) .setlargeicon(bitmapfactory.decoderesource(getresources(), r.mipmap.ic_launcher)) .setcontenttitle(contenttitle) .setcontenttext(contenttext) .setautocancel(true)

jquery - calling inline onclick method of javascript to anonymous not working -

i have below code in html file <a onclick="getrestauranttiming({{ $afternoontiming[$j]->id}});">hi</a> i have anonymous function in restaurant.js file var restaurant = (function ($) { function getrestauranttiming(id) { alert('hi'); } })(jquery) i want call anonymous function in onclick method. <a onclick="restaurant.getrestauranttiming({{$afternoontiming[$j]->id}});">hi</a> please help. you should return this cause not instantiate object new. function inside getrestauranttiming should binded this . var restaurant = (function($) { function getrestauranttiming(id) { alert('hi'); } this.getrestauranttiming = getrestauranttiming; return this; })(jquery); restaurant.getrestauranttiming(1);

php - if statment inside isset function not wokring -

i trying validate form using php, using isset function check if submit button has been clicked. when click submit button code inside isset function not execute. //html <div style="width:800px; margin:0px auto 0px auto;"> <table> <tr> <td width ="60%" valign="top"> <h2>join find friends today</h2> </td> <td width ="40%" valign="top"> <h2>sign below</h2> <form action ="" method"post"> <input type="text" name="fname" size ="25" placeholder="firstname" /><br/><br/> <input type="text" name="lname" size ="25" placeholder="lastname" /><br/><br/> <input type="text"

javascript - Disabling AngularJS debug data in a gulp / typescript production build -

what best way disable debug data gulp production build? documented way disable debug data is: myapp.config(['$compileprovider', function ($compileprovider) { $compileprovider.debuginfoenabled(false); }]); i'm using gulp-typescript build app. since typescript has no conditional compilation, have no idea how set parameter true false in gulp production build without changing code. the solution can think of conditionally add debug.ts or release.ts gulp.src gulp-typescript . know better solution? you can use gulp-ng-constant application configuration. here is practical example. thing constant s available during config phase, suits case. but adding config files conditionally appropriate way.

Accessing Evernote in offline mode in Windows -

hi iam creating app in evernote , want create notes offine app if app not connected internet, api changes done or changes done in settings can me out edit: apparently had (very) old (and bad) information. evernote's windows com api has never been public or officially supported evernote ( link ). for local api @ evernote's documentation page windows command line interface: https://dev.evernote.com/doc/articles/enscript.php the evernote sdk windows (link: https://github.com/evernote/evernote-cloud-sdk-windows ) provides api via com interacts evernote application , not evernote's cloud service. if user has set evernote windows app on computer can access data managed evernote app on windows device using com api (setup info here: https://github.com/evernote/evernote-cloud-sdk-windows/tree/master/com%20setup ) or via command line: https://dev.evernote.com/doc/articles/enscript.php

eclipse - Spring Security ACL Domains Error: The type xxx is already defined -

Image
i using eclipse, grails 2.4.5 , spring security acl plugin . created domain classes manage acl data command: s2-create-acl-domains after these domains have been generated eclipse reports classes have been defined. the error log shows: in buildconfig.groovy have: compile ":spring-security-core:2.0-rc5" runtime ':spring-security-acl:2.0-rc2' is there way fix eclipse not show errors? beside error code running fine. edit: here classes generated grails s2-create-acl-domains . did not change except in aclobjectidentity objectid type long string. here classes have been generated: aclclass : package grails.plugin.springsecurity.acl class aclclass { string classname @override string tostring() { "aclclass id $id, classname $classname" } static mapping = { classname column: 'class' version false } static constraints = { classname unique: true, blank: false } }

centos - FFMPEG undefined reference to `x264_encoder_open_146' -

when configuring ffmpeg below modules show error, # ./configure --enable-shared --enable-shared --enable-nonfree --enable-gpl --enable-pthreads --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libfaac --enable-libmp3lame --enable-libtheora --enable-libvorbis --extra-libs=-lx264 --enable-libxvid --extra-cflags=-i/usr/local/cpffmpeg/include/ --extra-ldflags=-l/usr/local/cpffmpeg/lib --enable-version3 --extra-version=syslin --enable-libass --enable-libvpx --enable-zlib --extra-ldflags=-l/usr/local/lib --enable-libx264 cc ffmpeg_filter.o ld ffmpeg_g libavcodec/libavcodec.so: undefined reference `x264_encoder_open_146' collect2: ld returned 1 exit status make: **** [ffmpeg_g] error 1 i found lib files, # ls /usr/local/lib | grep libx264 libx264.a libx264.so@ libx264.so.144* libx264.so.146* how fixed it.? finally found solution, may package installed version conflict , find installed packages , remove it, # rpm -qa | grep x264

javascript - Adding Discount code button to Paypal buy now button -

i'm trying add discount code paypal button, javascript works , says discount code valid isn't taking discount off amount when click buy button pay. can me please <form action="https://www.paypal.com/cgi-bin/webscr" method="post"> <p>please click on link pay</p> <input type="hidden" name="cmd" value="_cart" /> <input type="hidden" name="upload" value="1" /> <input type="hidden" name="business" value="<?php echo c_our_email; ?>" /> <input type="hidden" name="first_name" value="<?php echo strfordisp($ofirstname); ?>" /> <input type="hidden" name="last_name" value="<?php echo strfordisp($olastname); ?>" /> <input type="hidden" name="address1" value="<?php echo strfordisp($theorder["oaddress"]); ?>&q

angularjs - Get list of objects not yet in a relation in Parse.com Angular javascript -

i building angularjs crud site add data parse.com used mobile apps read it. (the crud easier on real keyboard due amount of data added.) first step create , save child objects (ingredients , steps), , create , save recipe object has relation ingredients , steps. need use relation , not pointers these. (because may need many many in future) here's problem: writing query find ingredients , steps created not yet part of relation, find ones added new recipe. the examples in javascript sdk don't show scenario, show query relation exists, not have additional attribute on related item (comments posts post doesn't have image). recipe has ingredients, relation<ingredient>, , steps, relation<step>. this doesn't work ingredients not yet related recipe. var recipe = parse.object.extend("recipe"); var ingr = parse.object.extend("ingredient"); recipequery= new parse.query(recipe); recipequery.exists("ingredients&qu