Posts

Showing posts from August, 2012

machine learning - Sklearn for Python: Is there a way to see how close a prediction was? -

i using code perform predictions classify text: predicted = clf.predict(x_new_tfidf) my predictions either come out saying text snippet belongs subject or subject b. however, want further analysis on predictions shaky -- is, if model unsure whether or b, had pick 1 sake of it. there way extract relative confidence of predictions? code: x_train has ["sentence know belongs subject a", "another sentence describes subject a", "a sentence subject b", "another sentence subject b"...] , etc y_train contains corresponding classifiers: ["subject a", "subject a", "subject b", "subject b", ...] , etc. predict_these_x list of sentences wish classify: ["some random sentence", "another sentence", "another sentence again", ...] etc. count_vect = countvectorizer() tfidf_transformer = tfidftransformer() x_train_counts = count_vect.fit_transform(x_train) x_

java - add another layout to this layout while jsonarray exist -

im trying create timeline feed mean tango newsfeed json array this: {"salam":[{"matn":"something","user_esm":"some name","user_image":"image url","liked":1,"followed":0,"user_id":"hfgdlerm"},{"matn":"something 2","user_esm":"other name","user_image":"iamge url","liked":1,"followed":0,"user_id":"hfgdlerm",} and custom layout like: <?xml version="1.0" encoding="utf-8"?> <linearlayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:weightsum="1"> <textview android:layout_width="wrap_content" android:layout_height="124dp" android:text="new text" android:id=&quo

matlab - Finding the Angle of Intersection of elements from two images -

i trying analyze intersection points between 2 skeletonized, binary images. (an example of 2 images need compared linked here: http://tinypic.com/view.php?pic=2itrjix&s=8#.vywmewa-cho , http://tinypic.com/view.php?pic=2mhix38&s=8#.vywmbwa-cho ) using imagej can find intersect points are. however, need in matlab find these 2 images intersect , find out @ angle intersect. there many intersection points on each image can't "manual" process each intersection. once know angle of intersection need able sort intersection points based on calculated angle. any appreciated! thanks!

python - How to avoid scientific notation when annotating a seaborn clustermap? -

Image
i have dataframe contains percentages. if use seaborn make clusterplot somehow number 100 plotted 1+e01 . is there way avoid this? i tried rounding percentages before plotting them, not affect plot. use fmt="d" , in this example : import seaborn sns sns.set() flights_long = sns.load_dataset("flights") flights = flights_long.pivot("month", "year", "passengers") flights = flights.reindex(flights_long.iloc[:12].month) sns.heatmap(flights, annot=true, fmt="d") fmt parameter heatmap additional clustermap kwargs passed through main heatmap.

javascript - Split two sentences into words and characters and show them individually -

please me split 2 sentences array of words , characters , show them individually. my input string this: if didn't cry, give sweets. give home-made cakes. what had done till given below: $(function() { generatewords(); function generatewords() { $("#splitedwords").html(""); var input = "if didn't cry, give sweets. give home-made cakes."; var outputarray = input.split(/\s+/); // spliting each word // printing sorted words inside button (var = 0; < outputarray.length; i++) { $("#splitedwords").append($('<span>' + outputarray[i] + '</span><br/>')); } } }); <!doctype html> <html lang="en"> <head> <meta charset="utf-8" /> <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.10.1/jquery.min.js"></script> </head> <body> <h4>input&

html - Why is there always a dash in my title tag -

in aspx page haeve <%@ page title="sdvd" language="vb" masterpagefile="~/bannerlink/bannerlinkadmin.master" autoeventwireup="false" codefile="twilionumbers.aspx.vb" inherits="bannerlink_twilionumbers" %> i want "sdvd" show in tab on browser. reason tab has "sdvd -" why dash there? edit: haukurhaf asked here head area in master page <head runat="server"> <title>liquidustv - admin</title> <link rel="shortcut icon" href="admin.ico" type="image/x-icon" /> <link rel="icon" href="admin.ico" type="image/x-icon" /> <meta content="text/html; charset=iso-8859-1" http-equiv="content-type" /> <link href="styles/admin.css" rel="stylesheet" type="text/css" /> <script type="text/javascript" language="javascript" src=&qu

JSP Include textfile if it isn't empty -

i have jsp page supposed include content of multiline text file (wrapped in markup) if, and if , there content in file. the file exists, times empty, , times have content. i thinking of reading file string (or stringbuffer?), , test length of it. since multiline file, code breaks on linebreaks. p.s. i'm jsp n00b, bear on me, if stupidly easy (or impossible) task! :)

Ansible - actions BEFORE gathering facts -

does know how (like wait port / boot of managed node) before gathering facts? know can turn gathering facts off gather_facts: no and then wait port if need facts while still need wait until node boots up? gathering facts equivalent running setup module . can manually gather facts running it. it's not documented, add task this: - name: gathering facts setup: in combination gather_facts: no on playbook level facts fetched when above task executed.

java - Where is GLES30.glGetBufferSubData? how to read transform feedback data opengles 3.0 -

so following 1 of simplest examples find on transform feedback, here , , converting android/java, android seems missing glgetbuffersubdata function available in opengl es 3.0. i've tried searching android source see if method used when calling method under jni, not sure looking in correct place that. if function doesn't exist how can read data out transform feedback? i've looked @ glgettransformfeedbackvarying , glgetbufferpointerv , glreadbuffer none seem want. here code: import com.harmonicprocesses.penelopefree.opengl.myglrenderer; import android.opengl.gles30; import android.util.log; import java.nio.bytebuffer; import java.nio.floatbuffer; /** * created izzy on 6/24/15. */ public class transformfeedback { // vertex shader private final string vertexshadersrc = "in float invalue;\n" + "out float outvalue;\n" + "void main() {\n" + " outvalue = sqrt(invalue);\n" + &quo

java - My new dataModel doesn't replace the old one in my JList [UPDATED] -

i'm working in little program allows place things on map, give name or description. places can have category choose jlist defaultlistmodel. if have created categories , choose save project , continue other time, when load saved file loads perfect except categorylist. it's still blank, , if have project categories , load new project old categories still there.. can't figure out whats wrong, i've must have missed update here? package test; import javax.swing.*; import javax.swing.event.listselectionevent; import javax.swing.event.listselectionlistener; import javax.swing.filechooser.filenameextensionfilter; import java.awt.*; import java.util.list; import java.awt.event.*; import java.io.*; import java.io.file; import java.util.*; public class testar extends jframe { jcombobox place; jtextfield searchfield; jbutton searchbutton, hidebutton, deleteplacebutton, whatishere, hidecat, newcat, delcat; jfilechooser jfc = new jfilechooser("."); boolean

How to garbage collect ruby objects between requests in ruby 1.8.7 -

i looking memory leakage issue existing huge application (ruby 1.8.7, rails 3.0.19). finding out main problem areas, used oink gem log parser identify actions increase vm heap size. using able optimize code accordingly. but there way can garbage collect freed ruby objects between requests memory cleared , when required. thanks in advance! please go through below documentation link http://ruby-doc.org/core-1.8.7/gc.html also can check similar question asked me detecting memory leakage in ruby hopefully help.

Calling labels from the table function in R -

i using r convert data experiment high quality dataset. 1 of features of code detect repetitions of experiment , label them accordingly. have written following code this:- dayrep<-function(a){ caps<-c("a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p", "q","r","s","t","u","v","w","x","y","z") if (unique(table(a))==1 && length(unique(table(a)))==1){ return(a) } else{ (i in a){ if (table(a)[[i]]>=2){ caps.sum<-caps[1:as.vector(table(a)[[i]])-1] val<-c(i,paste0(i,caps.sum)) del<-a[!a %in% i] vec<-append(del,val,after=i-1) return(vec) } } } } i have used following vectors of day numbers testing , highl

Log4j logging all events which are not caught by the defined loggers -

i have little problem. i using log4j 1.2.17, , want log logs come packages don't have logger specified. example: in application have multiple frameworks use: primefaces, solr, atmosphere, etc. had configured log4j.xml logging app logs. works great, put "org.primefaces" package logger restricting info logs. now, in console, doesn't exists appender, because don't want have app output without being logged, appear logs atmosphere. not big problem because can put logger this, don't want this. why? because in future appear frameworks have add logger. log4j config file monstrous. how can create logger logging entire output not caught defined loggers? if problem not explained please let me know , add required information. thank much. you can define root logging entire output not caught defined loggers. <root> <appender-ref ref="rootappender " /> </root> and if want not propagate logging event root add additivity

centos - Eclipse X11 Forwarding Cent OS -

i'm trying eclipse work on centos 7 vm via x11 forwarding. x11 forwarding seems working, able run , see "xclock". however, whenever run eclipse, crashes message similar this: java.lang.unsatisfiedlinkerror: not load swt library. reasons: /home/centos/eclipse/configuration/org.eclipse.osgi/375/0/.cp/libswt-pi-gtk-4527.so: libgtk-x11-2.0.so.0: cannot open shared object file: no such file or directory no swt-pi-gtk in java.library.path /home/centos/.swt/lib/linux/x86_64/libswt-pi-gtk-4527.so: libgtk-x11-2.0.so.0: cannot open shared object file: no such file or directory can't load library: /home/centos/.swt/lib/linux/x86_64/libswt-pi-gtk.so this issue on web, , lot of solved soft linking files in /usr/lib/jni/ ~/.swt/lib/linux/x86/ but, not have a /usr/lib/jni directory. so, tried find libraries create folder upon installation , found these in stack overflow post: libswt-gtk-3-jni, libswt-gtk-3-java and can't seem find on centos provides

java - ConcurrentModificationException in HashMap<Object,DateTime> -

i have following code: iterator<ggitem> iter = ggitemtimestampmap.keyset().iterator(); ggitem gg; while (iter.hasnext()) { gg = iter.next(); if (datetime.now().isafter(ggitemtimestampmap.get(gg).plusseconds(10))) { log.v("ggitem 10 second limit:", gg.tostring()); //if hasn't been seen 10 seconds after last timestamp. remove arraylist , remove ggitemtimestampmap hashmap. ggitemtimestampmap.remove(gg); //todo probable problem causer. removeggitemfromlist(gg); } } i concurrentmodificationexception error on iter.next(); call , uncertain why? i realize cannot both access hashmap of object keys , timestamp values , modify @ same time, doesn't iterator counteract that? first of can change hashmap concurrenthashmap secondary may have try synchronize iter on class or of object. synchronized(this) // if not in static context { // synchronized body } synchronize

java - Fastest way to traverse all edge of a directed attributed graph which stores in adjacency matrix -

i have adjacency matrix represent directed attributed graph. want traverse of edge of graph. 1 way traverse rows of matrix problem when number of rows more 10000 performance of traversing edges degrade significantly. want know there efficient way that? bfs , dfs explained here: http://opendatastructures.org/ods-java/12_3_graph_traversal.html

javascript - Remove TinyMCE style -

using tinymce's setstyle ( http://www.tinymce.com/wiki.php/api3:method.tinymce.dom.domutils.setstyle ), set style of element such as: <img style="border-width: 3px; border-style: solid;" id="avatar" width="40" height="40" alt="avatar.png" src="avatar.png" > tinymce.dom.setstyle('avatar', 'border-width', '2px'); how can remove style? instance, wish remove border-width , border-style ? recognize set border-width zero, however, not wish creates other issues. looking through docs, there no "removestyle"-like option . maybe set value inherit?

Stata/Mata: ADO file error -

i posting on statalist figured cover bases since programming question. i'm trying use ado file didn't write, getting error. believe error linked mata syntax, i'm less familiar language difficult me debug. i'm using stata 13 on pc. the original ado file here , file here . i've pasted ado file inline below, test code , error message. first file: *beveridge & nelson multivariate program *this program using var-exact method *this prorgam allows i(0) variables in var - added january 31th *last update january 31th 2008 *by freddy rojas *stata 10 quie { mata: mata clear real matrix m(real scalar num, real scalar lagsn) { n_eb=rowshape(st_matrix("e(b)"),num)' f=j(1,rows(n_eb),0) g=i(rows(n_eb)-1),j(rows(n_eb)-1,1,0) f=f\g (i = 1; <=cols(st_matrix("dym")); i++) { f[lagsn*(i-1)+1,1...]=n_eb[1..rows(n_eb),i]' } h=j(lagsn*(cols(st_matrix("k"))),(cols(st_matrix("k"))),0) (j = 1; j <=cols(st_matrix("

java - Sort arraylist that contains subclass classes -

i have arraylist contains fruits. i have subclass of fruits called "apples". apples have "color" attribute other fruits subclasses don't have. how can sort list? (i have put "apple" objects in list.) fruits parent class, apple , others subclasses. using instanceof 1 way of doing that. fruits[] myfruits = ...... // array of fruits (int = 0; < myfruits.length; i++) { if (myfruits[i] instanceof apple) { // ... } else { // ... } }

c# - DrawToBitmap returns black Image from UserControl -

my first post here here goes, i have usercontrol 30 controls (labels, textboxes etc). make "screenshot" of it. used "drawtobitmap" method usercontrol. here samplecode //this usercontrol 30 controls var sampleusercontrol = new sampleusercontrol(); var bmp = new bitmap(sampleusercontrol.width, sampleusercontrol.height); sampleusercontrol.drawtobitmap(bmp, sampleusercontrol.bounds); if run code, returns me black image time. have no clue why. please help! edit: forgot usercontrol winforms usercontrol this had been working me years until started returning black image last week in production. interestingly, after applied new windows patch. able find posting issue: kb3057839 has broken windows forms control.drawtobitmap() when called application launched windows service you didn't mention how winforms control being created, in first case winforms app launched service. there case on telerik site control instantiated server-side iis crea

PHP MySQL Result displays twice why? -

Image
i have simple php script fetch results localhost wamp server, , when echo query displays 1 record twice every record have! result displayed shown in picture: here php mysql script <?php error_reporting(e_all ^ e_deprecated); $movie_lists = ""; $no_result = ""; $servername = "localhost"; $username = "root"; $password = "localpass"; $dbname = "movieadventuredb"; // create connection $conn = new mysqli($servername, $username, $password, $dbname); // check connection if ($conn->connect_error) { die("connection failed: " . $conn->connect_error); } //$sql = "select id, movie_quality, movie_release_date movielisting"; $sql = "select * movielisting order id desc limit 10"; $result = $conn->query($sql); if ($result->num_rows > 0) { // output data of each row while($row = $result->fetch_assoc()) { //echo "id: " . $row["id"]. " - name

php - Using Facebook Graph API without User Access Token -

what want achieve i want display posts of public facebook page on website. reason not make sense use user access token, since requires login. possible solution found i know can use app tokens . there related question on stackoverflow . tested using graph api explorer. https://graph.facebook.com/v2.3/google/statuses returns: (#100) requires user session https://graph.facebook.com/v2.3/google/posts returns: valid result, totally different result same request user access token (less posts). same request nike delivers better result. questions why same request deliver 2 diferent results? can grab posts app token? under conditions can full timeline without user access token? it's in docs. there's fundamental difference between posts , statuses , , permission requirements documented: https://developers.facebook.com/docs/graph-api/reference/v2.3/page/feed#readperms https://developers.facebook.com/docs/graph-api/reference/v2.3/status * quotes:

c# - ASP selectedindex of dropdownlist changes after the postback Event fired for controls -

so imagine there 3 dropdownlist controls.contro1,control2,control3. these controls filter each other's items.as in control1's selecteditem determines shown on control2 , control2 determines whats shown on control3 item list. in form have select item control 3 via code , edit contents(imagine each control 3 item invoice). so doing have set control1-control2-control3 selectedindexes appropriately,so can right invoice edit in page. problem is, after setting indexes of control1-control2-and control3(to right invoice),the postback event of control1 fires,and changes index of control2, which means messes control3's items... question tl dr: can keep selectedindex on control2,after control1's postback has fired? here code : <td>number one</td> <td> <asp:dropdownlist runat="server" id="dropa" autopostback="true" datasourceid="linqdatasource3" datatextfield="..." datavaluefield=&

nosql - Is 2 billion cells limit per partition in cassandra, is this configurable to increase the limit -

i new cassandra, documentation found there limit of 2 billion cells per partition. can configure limit in cassandra. impact on performance if increase limit. can please me on this. as far know limit cannot configured , addressing limitation. you wouldn't typically want use many cells in single partition, instead want spread data load out across many partitions multiple cassandra nodes share load. for example, if collecting time series data, might want add date field partition key each day use different partition.

python - pandas 'as_index' function doesn't work as expected -

this minimum reproducible example of original dataframe called 'calls': phone_number call_outcome agent call_number 0 83473306392 not interested orange 0 1 762850680150 call later orange 1 2 476309275079 not interested orange 2 3 899921761538 call later red 3 4 906739234066 call later orange 4 writing pandas command... most_calls = calls.groupby('agent') \ .count().sort('call_number', ascending=false) returns this... phone_number call_outcome call_number agent orange 2234 2234 2234 red 1478 1478 1478 black 750 750 750 green 339 339 339 blue 199 199 199 which correct, fact want 'agent' variable , not indexed. i've used as_index=false

javascript - IE : HTML select with huge options taking lot of time in loading -

my requirement load html drop down dynamically. ` <html> <head> <script type="text/javascript"> function addselectbox() { var parentdiv = document.getelementbyid ("main"); var selectelement = document.createelement ("select"); (var i=0;i < 6000;i++) { var option = new option ("option --- " + i, "value" + i); selectelement.options[selectelement.options.length] = option; } parentdiv.appendchild (selectelement); } </script> </head> <body> <div id="main"> <input type="button" onclick="addselectbox()" name="clickme" value="add select box" /> </div> </body> </html> ` in above code, on clicking of button, i'm creating dropdown options , adding

jsp - Java Desktop-App to Java-Web-App -

i new java-web-programming , non-gui netbeans-codes compiling whenever place jsp tags, gui netbeans-codes full of errors whenever place jsp tags:<%! %> , <% %>. below 1 of netbeans-gui codes simple "salary tagging system" 3 labels corresponding 3 textfields(dspid, dspname,dspsal). right jsp-tagging way? public class employee extends javax.swing.jframe { // variables declaration private javax.swing.jtextarea disparea; private javax.swing.jtextfield dispid; private javax.swing.jtextfield dispname; private javax.swing.jtextfield dispsal; private javax.swing.jbutton findbutton; private javax.swing.jlabel jlabel1; private javax.swing.jlabel jlabel2; private javax.swing.jlabel jlabel3; private javax.swing.jscrollpane jscrollpane1; // end of variables declaration public employee() { initcomponents(); } @suppresswarnings("unchecked") // <editor-fold defaultstate="collapsed" desc="generated code"&g

c# - how to change align of combobox item to right? -

Image
i create combobox in wpf (.net 4.5.1) following xaml code , how changed alignment of items right image? <combobox x:name="cmbpost" grid.row="2" grid.column="0" tabindex="6" width="150" margin="5" height="22" verticalalignment="top" horizontalalignment="right"> try add horizontalcontentalignment="right" combobox

mysql - Query takes too long to fetch data -

i aware of slow query log isnt queries exceed maximum execution time? question different (i think). i running below query , me doesnt seem should present problem. when run it, "running" time on 20 seconds , sits there "fetching" ages! point have stop due db performance issues. can explain going wrong here. coding newbie please gentle. select t1.oid, (select date_format(t2.date, '%d/%m/%y') 'avf date' t2 t1.oid = t2.fk_oid , t2.type = '-25' , year(t2.date) between 2005 , 2014 order t2.date asc limit 1) 'avf date', t2.site t1 left join t2 on t1.oid=t2.fk_oid update - ok need follows. have patient database , these patients have procedures recorded on database. trying return patient oid (t1.oid) along first procedure had (if between 2005 , 2014) , had (t2.date , t2.site respectively), if procedure of particular type (t2.type = '-25

android - Flip animation to disable button -

i working on simple animated ui should change buttons enabled disabled. rather changing color red grey button flip. i've tried simple animation on click of button can rotate button. any how create flip animation? flipping animation: <set android:ordering="sequentially"> <objectanimator android:duration="2000" android:propertyname="rotationy" android:valuefrom="0" android:valueto="360"> </objectanimator> </set> in class: animatorset set; set = (animatorset) animatorinflater.loadanimator(this, r.anim.flipping); set.settarget(img_logo); set.start(); timer timer = new timer(); timer.schedule(task, 2000);

html - Css3 Animation looping in webkit-animation -

i have problem css3 animation effect.i want know how continue looping without go start place. example. when clouds moving, webkit-animation time over, come first step , start animate again.so not nice because cloud go , again start moving (watch 7 seconds), want continue animation without cloud goes start. demo here css3 .sky { height:638px; background:#007fd5; position:relative; overflow:hidden; -webkit-animation:sky_background 50s ease-out infinite; -moz-animation:sky_background 50s ease-out infinite; -o-animation:sky_background 50s ease-out infinite; -webkit-transform:translate3d(0,0,0); -moz-transform:translate3d(0,0,0); -o-transform:translate3d(0,0,0) } .moon { background:url("http://montanaflynn.me/lab/css-clouds/images/moon.png"); position:absolute; left:0; height:85%; width:300%; -webkit-animation:moon 50s linear infinite

Swift generics and extensions need to workout -

Image
this question has answer here: array extension remove object value 13 answers im learning swift currently. while learning i'm stuck generics. im solving 1 simple problem -> return index of specified element in array import uikit extension array { func indexofletter<t:equatable>(item:t) -> int { var = 0 (index, value) in enumerate(self) { if value == item { return } i++ } return -1; } } var arrayofitems = ["a","b"] arrayofitems.indexofletter("a") in code i'm getting error can not compare 2 operands using == operator of type t. the answer problem becomes more clear if use letter other t our generic identifier. change method signature use letter u . , error message: binary operator '==' cannot applied operands of ty

mysql - How to define a default value for a column after a cast in a pgloader script? -

let's i'm migrating mysql database postgresql pgloader, using default sample on official website : load database mysql://root@localhost/sakila postgresql:///sakila include drop, create tables, no truncate, create indexes, reset sequences, foreign keys set maintenance_work_mem '128mb', work_mem '12mb', search_path 'sakila' cast type datetime timestamptz drop default drop not null using zero-dates-to-null, type date drop not null drop default using zero-dates-to-null materialize views film_list, staff_list -- including table names matching ~/film/, 'actor' -- excluding table names matching ~<ory> before load $$ create schema if not exists sakila; $$; let's assume in table 'foo', have column 'bar' datetime type, , want set new default value of '2015-01-01 00:00:00' when migrate postgresql (the old default value in mysql '

php - how to match a key value pair in a JSON -

[ {"category":["30","32","33"],"type":"30 days","price":"100","id":"0"}, {"category":["34","37","47"],"type":"30 days","price":"200","id":1}, {"category":["46"],"type":"40 days","price":"100","id":2} ] in above json, how category has type: 30days. expected output as. $categories = array{0=>30,1=>32,2=>33,3=>34,4=>37,4=>47} you can use array_walk as $json = '[ {"category":["30","32","33"],"type":"30 days","price":"100","id":"0"}, {"category":["34","37","47"],"type":"30 days","price":"200","id":1}, {&

asp.net web api - c#: JWT ValidateToken overriding? -

i have setup token authentication process , working quite well. using owin. i extending 2 specific points lets me control signing of jwt , validating of user credentials so. provider = new myoauthprovider(), accesstokenformat = new myjwtformatter() how hook part token being validated. searched google , appears there method can't validatetoken can override don't know is. i have following. need override here ? app.usejwtbearerauthentication( new jwtbearerauthenticationoptions { authenticationmode = authenticationmode.active, allowedaudiences = new[] { audience }, issuersecuritytokenproviders = new iissuersecuritytokenprovider[] { new symmetrickeyissuersecuritytokenprovider( issuer, secret)

node.js - How to use migrations in Sequelize? -

i have used orms such entityframework , waterline , mongoose . started using sequelize . have created sample model. later wanted add column table corresponding same model. when edit model, new field doesn't seem reflecting in table unless drop table. supposed use migrations? got confused after reading documentation . me out? yes, should use migrations if edit model in sequelize when application starts create table if doesn't exist. not check if schema different doesn't update schema of table. if you, install sequelize-cli , run sequelize init command. sets project ready use migrations. please note using sequelize migrations have explicitly define primary key, updatedat , createdat columns otherwise not great created! the docs not bad migrations: http://sequelize.readthedocs.org/en/latest/docs/migrations/

Invalid commands for child process in background in C -

i have following code in c: if ((childpid = fork()) == 0) { if (execvp(argv[0], argv) < 0) { //execute failed exit(1); } } else if (childpid < 0) { //fork failed } else { //if execvp failed don't here //else } what want is: i enter command. if not executable should not wait next entered command. if executable should things in parent process. if enter e.g. sleep 1m should execute in child process, things in parent process , should still able execute more jobs (this works fine). when execute abcdef (invalid command) stuff in parent process anyway. can tell me how code should like? i tried following: void signalhandler(int signal) { if (signal==sigchld) { printf("child ended\n"); wait(null); } } //in main signal(sigchld,signalhandler); //... if ((childpid = fork()) == 0) { if (execvp(t_ar

angularjs - Jasmine Test - Unknown provider $sceProvider -

i trying write jasmine test filter. here filter: angular.module('cpscore.filters').filter('texttohtmlsafe', ['$sce', function ($sce) { return function (text) { if (!text) return text; var htmltext = text.replace(/\<br \/\>/g, '\n'); htmltext = htmltext.replace(/\<br\/\>/g, '\n'); htmltext = htmltext.replace(/\<br\>/g, '\n'); htmltext = htmltext.replace(/\</g, '< '); htmltext = htmltext.replace(/\&/g, '& '); htmltext = htmltext.replace(/\n/g, '<br />'); return $sce.trustashtml(htmltext); }; }]); here jasmine test: describe('cpscore.filters', function() { var texttohtmlsafefilter, $sce; beforeeach(module('cpscore.filters')); beforeeach(inject(function (_$sce_, $filter) { $sce = _$sce_; texttohtmlsafefilter = $filter('texttohtmlsafe'); })); it('s

TableView insert data from list box javafx -

i have listbox populated data mysql database. wish add selected item in tableview listview. problem is, when click add button, selected item gets added in 1st cell. when select item click add, gets on written in 1st cell. here's code. button select= new button("select"); private tableview table = new tableview<>(); public void start(stage primarystage) throws exception{ tablecolumn<map, string> namecol = new tablecolumn<>("namecol"); tablecolumn<map, string> quantitycol = new tablecolumn<>("quantity"); tablecolumn<map, string> pricecol = new tablecolumn<>("price"); observablelist <string> items = fxcollections.observablearraylist ( "0" , "1" , "2" , "3" , "4" , "5" , "6" , "7" , "8" , "9" ); table.getcolumns().addall(namecol, quantitycol, pricecol); quantityc

mysql - SQL FK constraint fails -

i have 2 tables, office , user. want make relation onetomany (1 office has many users). but when run sql alter table izo_user add constraint fk_da8075cffa0c224 foreign key (office_id) references izo_office (id) create index idx_da8075cffa0c224 on izo_user (office_id) something goes wrong , error sqlstate[23000]: integrity constraint violation: 1452 cannot add or update child row: foreign key constraint fails (`izoplast`.`#sql-9842_1be9`, constraint `fk_da8075cffa0c224` foreign key (`office_id`) references `izo_office` (`id`)) my tables: http://oi57.tinypic.com/whhezr.jpg try if works you- alter table izo_user add index idx_office_id(office_id); alter table izo_user add constraint fk_da8075cffa0c224 foreign key (office_id) references izo_office (id);

java - How to fetch the logo of any website in android? -

i working on project in input url , output website logo. there websites facebook,youtube, yahoo etc uses css make logo attractive, how can fetch logo of these websites. have written following code fetch logo of websites uses logo image : elements elements = doc.getelementsbytag("img"); (element element : elements) { //searching src tag inside img tag logo =element.attr("src"); string logo1=logo; //if src link has substring logo if(logo1.tolowercase().contains("logo")|| element.attr("alt").tolowercase().contains("logo")) { if(!logo.contains("http")) { if(!logo.startswith("/")) logo=link + "/"+logo; else logo=link+logo; } system.out.println(logo); logoflag=

python - Error handling in PySpark reading in non existent files -

i have massive list of directories , files potentially read from. of them may not exist not problem - ignore error - using try method. there way can allow in pyspark. here returned error message: py4j.protocol.py4jjavaerror: error occurred while calling z:org.apache.spark.api.python.pythonrdd.collectandserve. : org.apache.hadoop.mapred.invalidinputexception: input path not exist: file: i building series of files @ following: sci = sc.textfile(",".join(paths)) where paths list of paths possible files. check file system , see if exist, there more elegent way of doing this? the following should work: for f in file_list: try: read_file(f) except org.apache.hadoop.mapred.invalidinputexception: deal_with_absent_file(f)

javascript - how add an arrow pointing to the y-axis on highcharts -

Image
how can show arrow pointing middle of y-axis on highcharts below image: and y-axis: yaxis: [{ gridlinewidth: 0, labels: { enabled: false }, title: { text: 'your starting point', style:{ font: '6px arial' } }, min: 0, max: 1000 }] you 1) using image, or icon font, in axis title 2) using highcharts renderer function draw arrow reference: http://api.highcharts.com/highcharts#renderer

javascript - Auto scroll down to next element -

i trying make rss feed customers of our website see news at. idea want have slow , smooth downward scroll animation purpose of revieling news not shown in visible div element. element contains these articles has set height , has own vertical scrollbar. articles height:100px;width:100% , have unique id, there 1 100 articles shown depending on rss feeds. how can make pure javascript task? using dojo in case have way of doing don't know about. it javascript generated html. post summary of structure reference. thanks. <table> <tbody> <tr> <td id="mainleft"> <div id="slider1_container" /> <div id="rssboxwrapper"> <table id="rssboxheader" /> <div id="newscontentwrapper"> <!--contains scroll bar & articles --> <table id="article0" />`` <table id="article1" /> <table id="article2" /&

css - Html <code> with placeholder -

how need add placeholder attribute < code> < /code> tag in < input> < /input> ? <input type="text" name="fname" placeholder="first name"><br> you can't have placeholders in <code></code> it's not input field... might want use <textarea placeholder="your placeholder"></textarea> inputing code... example showing difference here

.net - Passing a TFS Workspace object to c# code from Powershell? -

i working on creating powershell scripts create easier maintain build process in tfs 2013. part of process requires number of sql compares run update scripts. what i'm trying use 1 of our old custom build activities (from tf 2010), looked reasonably easy convert c# code file use within powershell. needed post build / pre unit test step. i'd make upgrades available unit tests, of db based integration tests not upgrading until following build. the issue is c# script requires tfs workspace, , i'm not sure how or instantiate properly. build activity using tfs code model, had inarguments properties, , handled of this. i've changed below run command in cut down c# example below: using system.io; using system.text.regularexpressions; using microsoft.teamfoundation.build.client; using microsoft.teamfoundation.build.workflow.activities; using microsoft.teamfoundation.versioncontrol.client; using system.activities; using system; using system.collections.generic;

python - Django template forloopcounter value is not working -

the list follows. here forloopcounter value not working. how fix? please let me know views. please note: static index value working, dynamic index value not working (forloopcounter) value = [ { "pk": 1, "rate": [ { "one": "one1" }, { "two": "two1" } ] }, { "pk": 2, "rate": [ { "one": "one2" }, { "two": "two2" } ] } ] {% in value %} {{i.rate.forloopcounter.one}} # here forloopcounter value not working {{i.rate.0.one}} # working properly. need dynamic index {% endfor %} i don't think you're using think you're using. {% in dict %} {{forloop.counter}} forloop.counter increments on each iteration through dictionar