Posts

Showing posts from August, 2013

https - How to specify CAFile path inline with the GIT command? -

i'm trying clone repository on https , reason local config says take cafile tries use value global config. local config: [http] sslcainfo = c:/../cacert-client.pem global config: [http] sslcainfo = /bin/curl-ca-bundle.crt when i'm executing clone command see instead of local value trying use global cafile value. how specify http.sslcainfo inline git clone command? c:/your/path/to/cacert-client.pem should work ,supposing ' /../ ' in question stands your/path/to (otherwise c:/../xx points non-existent path). if doesn't work, can try other syntax: git config http.sslcainfo /c/your/path/to/cacert-client.pem you can set git_curl_verbose 1 , see more of git using. getting path right (either git config , or environment variable git_ssl_cainfo ) bettern alternative: git_ssl_no_verify=true or git config --global http.sslverify false .

wolfram mathematica - ListPlot: individual point colors -

Image
i've got simple listplot like list2 = table[{x, sqrt[x]}, {x, 0, 100}]; now want color specific points red, every 5th point, tried mycolor[x_] /; mod[x, 5] == 0 = red; mycolor[_] = blue; now listplot[#, plotstyle -> absolutepointsize[3], colorfunction -> mycolor[#[[all, 1]], colorfunctionscaling -> false]] &[list2] doesnt work quite right, points still blue. wrong here? thanks, archi here easy way result you're after :- list2 = table[{x, sqrt[x]}, {x, 0, 100}]; mycolor[x_] := if[mod[x, 5] == 0, red, blue]; mycolors = mycolor /@ list2[[all, 1]]; listplot[list /@ list2, plotstyle -> map[{absolutepointsize[3], #} &, mycolors]] alternatively, colour function, rm -rf's answer on george's link :- list2 = table[{x, sqrt[x]}, {x, 0, 100}]; mycolor = function[{x, y}, if[mod[x, 5] == 0, red, blue]]; listlineplot[list2, plotstyle -> absolutepointsize[3], colorfunction -> mycolor, colorfunctionscaling -> false]

sql - "Select count (*)" vs count of results from "Select 1" : which is more efficient way to get the rows count in DB2? -

i have 2 approaches count of rows in table in db2. 1 way is select count(*) foo col1 = val1; another way count results (number 1's list) retrived following query method in java code select 1 foo col1 = val1; here "list of number 1's" second query , size of list in java code count. can explain efficient way rows count ? select count faster - because database needs return single number rather potentially long list.

Get video object (or video id) from Facebook timeline post -

i'm trying facebook video object timeline post : i'm getting posts graph api /me/home i can photo object via returned object_id the problem there no object_id value video post type { "id": "750834774_10152138100019775", "from": { "id": "750834774", "name": "emilie volpi" }, "message": "haha le monde qui fait une analyse geopolitique de games of thrones^^ une bonne manière de se remettre à jour pour la nouvelle saison demain !!!!!", "picture": "https://fbexternal-a.akamaihd.net/safe_image.php?d=aqcclqte2bpmicry&w=130&h=130&url=http%3a%2f%2fs2.dmcdn.net%2fehfv4%2f526x297-mo8.jpg", "link": "http://www.dailymotion.com/video/x1lu3ke_game-of-thrones-comprendre-la-crise-a-westeros-en-4-minutes_news", "source": "http://www.dailymotion.com/swf/video/x1lu3ke?autoplay=1", &qu

php - Why won't my prepared statement function properly? -

i have ajax call affiliated php handler has prepared statement in it. and won't work. no error caught. it stopped working when changed deprecated mysql_real_escape pdo prepared statememt. here code : $create_pdo=new pdo("mysql:host=$dbhost;dbname=$dbname",$dbuser,$dbpass); $statement=$create_pdo->prepare("insert registry (fname, lname, email, password, age, sex, city, timereg, frcode) values (:fname_received, :lname_received, :email_received, :password_received, :dob_received, :sex_received, :city_received, :timepassreg, :frcode)"); $statement->bindparam(':fname_received', $fname_received); $statement->bindparam(':lname_received', $lname_received); $statement->bindparam(':email_received', $email_received); $statement->bindparam(':password_received', $password_received); $statement->bindparam(':dob_received', $dob_received); $statement->bindparam(':sex_received', $sex_received); $st

cluster computing - how to get the job id from qsub -

i using cluster. use qsub command distribute job, want can job id can monitor job. basically, want thing this: #!/bin/bash jobid=$( qsub job1 ) # monitoring base on $jobid i found page http://wiki.ibest.uidaho.edu/index.php/tutorial:_submitting_a_job_using_qsub , , talks variable pbs_jobid don't know how use it. know how it? (my solution jobid='qsub task | cut -d ' ' -f 3' ) qsub has predictable output. many automated submission systems (such grid interfaces) parse output qsub , looking jobid. an example of parsing available blahp project (european grid middleware). jobid=`${pbs_binpath}/qsub $bls_tmp_file` # actual submission ... # job id first numbers in string (slurm support) jobid=`echo $jobid | awk 'match($0,/[0-9]+/){print substr($0, rstart, rlength)}'` ( source ) this code has been used in production many years, , has worked qsub in both pbs, pbs pro, , slurm.

javascript - text into textbox when onclick -

i want create link if user presses edit link, text turn text box information still in user inputted? have following code: ( when press edit button 'text here' should turn textbox, doesn't notify code has gone wrong :) appreciated. <html> <head> <title>span text box - demo</title> <style type="text/css"> .replace { display:none; } </style> <script type="text/javascript"> function exchange(id){ var ie=document.all&&!window.opera? document.all : 0 var frmobj=ie? ie[id] : document.getelementbyid(id) var toobj=ie? ie[id+'b'] : document.getelementbyid(id+'b') toobj.style.width=frmobj.offsetwidth+7+'px' frmobj.style.display='none'; toobj.style.display='inline'; toobj.value=frmobj.innerhtml } </script> </head> <body> <p class="edit" onclick="exchange(item)">edit</p><input id="i

C# Odd method call casting -

i encouter following code snippet, during try learn wpf. ((dependencyobject)targetobject).setvalue(dp, finalvalue); what code snippet mean? know instance method setvalue going call, (dependencyobject) not understand. casting? targetobject cast dependencyobject , setvalue method of dependencyobject type can called. my guess targetobject of type object, , doesn't have setvalue method available - until cast. if removed (dependencyobject) , should become clear - object type doesn't have setvalue method.

gruntjs - HTMLmin - How to dynamically compress all files inside a certain folder -

i want minify html pages , maintain page's name , path on dist folder. want loop through folders. the code below works fine parent folder (which case app/views ). grunt.initconfig({ htmlmin: { dev: { files: [{ expand: true, cwd: 'app/views/**', src: '{,*/}*.html', dest: 'dist/views' }] } } }); as can notice, tried magic star @ path app/views/** , had no luck. this folder structure: app/views/ ├── page1.html ├── blocks │   └── block.html ├── page2.html └── page3.html in case, every template gets minified, except ones under app/views/blocks folder. cwd: 'app/views', src: '**/*.html',

javascript - How to access Struct framework ( JSP ) form variable for Ajax query -

please help. have implemented registration form of website using struct framework validation. <html:form action="servletregister.do" method="post" style="width: 95%"> <tr> <td>user id : * </td> <td><html:text property="userid" /> <html:errors property="userid"/></td> td> <html:button property="button" value="check availability" style="color:#ffffff; background-color: #11bdd1; width: 130px;" onclick="test();" /> <div id="ajax"> // ajax query result show </div> </tr> problem is, want validate userid using ajax . function test(){ var userid = document.getelementbyid("userid").value; if(userid=="") { alert("please enter userid"); } els

xml - PHP DOMDocument not returning or loading first elements -

i have problem loading xml document. xml file is <?xml version="1.0" encoding="utf-8"?> <!doctype gallery [ <!element gallery (category*)> <!element category (image*)> <!element image (title,comment,password,owner,rating)> <!element title any> <!element comment any> <!element password any> <!element owner any> <!element rating any> <!attlist category name cdata #required> <!attlist image date cdata #required> ]> <gallery> <category name="entertainment"> <image date="monday"> <title>1</title> <comment>2</comment> <password>3</password> <owner>4</owner> <rating>5</rating> </image> <image date="friday"> <title>11</title> <comment>22</comment>

java - Display image on jsp page through Servlet -

this question has answer here: how retrieve , display images database in jsp page? 4 answers i making small application uploads image authenticated user database , displays images uploaded dynamically through servlet. i retrieve images @ page load database using code: <head> <meta http-equiv="content-type" content="text/html; charset=iso-8859-1"> <jsp:include page="/retrieveimagesservlet.do"></jsp:include> </head> this sets user images in page request , working fine. now display image data in table format use jstl. since user image objects contains image in byte[] format invoke servlet print image file below. <c:foreach var="imagedto" items="${requestscope.userimages}"> <tr> <td><c:out value="${imagedto.getserialnumb

ios - Xcode *Apple Mach-0 Error -

got error , i'm not sure what's problem haven't touched project in few weeks, appreciated... check here images http://s24.postimg.org/nmsnnsxol/screen_shot_2014_04_03_at_21_50_32.png http://s21.postimg.org/jmfzvludj/screen_shot_2014_04_03_at_21_50_55.png your library search paths not proper , why warnings there directory not found . since cant find directory compilation fails classes not available. go build settings - library paths , make sure paths proper based on project directory. there should not jumbled \ strings in it.

python - Update iPython to version 2.0 on Mac OS -

i have canopy installed on mac os. see version 2.0 of ipython been released , want install it. but when trying install next message: $ enpkg ipython prefix: /users/demas/library/enthought/canopy_64bit/user no update necessary, 'ipython' up-to-date. ipython-1.2.1-2.egg installed on: sun apr 6 17:08:21 2014 why python installation can not find new version of ipython ? update: i have updated package using: pip install ipython --upgrade but not sure, save way upgrade packages in canopy distribution ? for recent version of already-installed packages (only enpkg version 4.6 or higher): $ enpkg --update-all display available updates of already-installed packages: $ enpkg --whats-new try this: enpkg --remove ipython enpkg ipython

iOS - Share image + text to WhatsApp? -

i'm using uidocumentinteractioncontroller method share images app whatsapp (explained in how send image whatsapp application? , whatsapp image sharing ios ). i'm aware of share via uri option, used share texts (explained here: https://www.whatsapp.com/faq/iphone/23559013 ). is there way share both image , caption in single share? from experience , knowledge "uidocumentinteractioncontroller" way of doing now...

javascript - Meteor.users access with string argument -

i trying list members of project team, stored userids in projectmembers array. use {{#each projectmember}} iterate on current members display either username (if exists) or email address. unfortunately, error haven't been able debug. the console logs show appropriate userid getting sent string element meteor.users.findone(), there error showing on console. string {0: "o", 1: "o", 2: "t", 3: "w", 4: "4", 5: "t", 6: "i", 7: "5", 8: "j", 9: "u", 10: "l", 11: "5", 12: "v", 13: "b", 14: "f", 15: "x", 16: "r", length: 17} createproject.js?5f1e645071dc1f451f671ec1d93aa9051ebadc0b:26 exception deps recompute function: typeerror: object 0 has no method 'substr' @ http://localhost:3000/packages/minimongo.js?4ee0ab879b747ffce53b84d2eb80d456d2dcca6d:1370:13 @ function._.each._.foreach (http://localhost:3000/p

OpenGl dots look like dash -

what cause opengl dots dash lines? trying draw 2 separate lines. 1 contains dashes , other 1 contain dots. supposed dotted line, appears dashes when compile , run program. here code: #include <windows.h> #include <gl/gl.h> #include <gl/glu.h> #include <gl/glut.h> // (or others, depending on system in use) //#include <stdlib.h> void init() { glclearcolor (1.0, 1.0, 1.0, 0.0); /* set display-window color white. r,g,b,alpha alpha 0.0 transparent */ glmatrixmode (gl_projection); // set projection parameters. gluortho2d (0.0, 250.0, 0.0, 250.0); // set display area } void linesegment() { glclear (gl_color_buffer_bit); // clear display window. color buffer glcolor3f (0.0, 0.0, 1.0); // set line segment color green. //glenable(gl_line_stipple); int p1 [] = {0,80}; int p2 [] = {50, 50}; int p3 [] = {100, 100}; int p4 [] = {150, 75}; int p5 [] = {200, 120}; int p6 [] = {0, 50

CYK algorithm implementation java -

i'm trying implement cyk algorithm based on wikipedia pseudocode. when test string "a b" grammar input: s->a b a->a b->b gives me false, , think should true. have arraylist called allgrammar contains rules. example above contain: [0]: s->a b [1]: a->a [2]: b->b for example s->hello , input string hello gives me true should. more complex tests (more productions) gives me false :s public static boolean cyk(string entrada) { int n = entrada.length(); int r = allgrammar.size(); //vector<string> startingsymbols = getsymbols(allgrammar); string[] ent = entrada.split("\\s"); n = ent.length; system.out.println("length of entry" + n); //let p[n,n,r] array of booleans. initialize elements of p false. boolean p[][][] = initialize3dvector(n, r); //n-> number of words of string entrada, //r-> number of nonterminal symbols //this grammar contains subset rs set of start symbol

sql - Qt/MySQLITE errors on simple query which MySQL accepts -

i have qsqldatabase of qsqlite type give me error near "auto_increment": syntax error unable execute statement on statement (which mysql executes correctly) create table `student` ( `id` int not null auto_increment primary key , `fullname` text not null , `date_of_birth` timestamp not null , `date_enrolled` timestamp not null , `current_academic_year` int not null ) i tried changing auto_increment autoincrement , id not null integer primary key but neither made difference. what's wrong it? the correct syntax is: create table `student` ( "id" integer primary key autoincrement not null , "fullname" text not null , "date_of_birth" datetime not null , "date_enrolled" datetime not null , "current_academic_year" integer not null )

How to get fluent api mapped entity table name EF -

i'm having problems getting mapped table name when using fluent api. when use data annotations it's easy because can use tableattribute in order table name specific entity, when use fluent api can't find way that. i need because i'm implementing audit trail overriding savechanges on dbcontext. thanks i figure out. in order information entity when using fluent api did this: // actual entity set // dataspace.sspace = storage part of model has info shape of our tables var entityset = workspace.getitems<system.data.entity.core.metadata.edm.entitycontainer>(system.data.entity.core.metadata.edm.dataspace.sspace) .selectmany(e => e.entitysets).tolist().where(a => a.name == entitytypename).firstordefault(); and finally: // table name string tablename = entityset.table; hope can others!

android - Why does it say "unfortunately -- has stopped"? -

Image
i'm working on note app. pretty new , wonder why says "unfortunately -- has stopped". start activity called start , when button pressed should "pg2" activity app stopps. think abot getsharedpreferences. please help, here link: https://dl.dropboxusercontent.com/u/97063669/error.png assuming error occurs when click of reftext, error caused when attempt string string out of shared preferences. should supply actual string, empty one, default rather null. so line like: final string string=sgareprefences.getstring("string", "");

Compilation error when trying to compile a singleton in c++ -

i'm trying study c++. wrote file "singleton.h" follows: class singleton { private: static singleton* m_this; singleton(); public: static singleton* getinstance(){ return m_this; } virtual ~singleton(); }; my singleton.cpp file: #include "stdafx.h" #include "singleton.h" singleton::singleton(){} singleton::~singleton(){} i call in main method getinstance method follows: singleton* s = null; s = singleton.getinstance(); but, compile error: error c2275: 'singleton' : illegal use of type expression do know why that? s = singleton::getinstance(); not . , :: (scope resolution operator) static methods.

python - Exposing reusable functions to deal with HTTP POST methods -

i'm using flask & python write various api methods. example, 1 method checks database ascertain whether or not username being used. looks bit this: @app.route('/register/checkuser', methods=['post']) def checkuser(): if request.method == "post": conn = connection('localhost', 27017) db = conn['user-data'] usertable = db["logins"] usertocheck = request.form['usertocheck'] #search user check if exists doesexist = str(usertable.find_one({"username": usertocheck})) conn.close() if doesexist == "none": return "username available" elif doesexist.find("objectid") != -1: return "username taken." else: return "error" in short, allow checkuser() function able called elsewhere in flask application (possibly following other decorators). example, before create user account. how should go doing t

javascript - Using a value from a dropdown list in a handler -

i use if can spare time. trying access value of dropdownlist (dropdownlist1) on master page content page , use variable in hanlder in .ashx code page. test trying display varialble in message box. ideas appreciated. content page (dropdownlist on master page) $(document).ready(function $("#dropdownlist1").change(function () { location.reload; alert($(this).val()); strtrail = $(this).val(); alert(strtrail); }); handler case "searchbylocation" dim firsttime integer = 0 dim latitude string = "42.9901009" 'context.request("latitude") dim longitude string = "-81.146698" 'context.request("longitude") 'dim fromdate string = context.request("#dropdownlist1").val dim strtrail string = context.request("#dropdownlist1") msgbox("now") msgbox(st

android - Can an appwidget onClick PendingIntent be set from any class? if so, How -

i have appwidget , want set onclick pending intent. pendingintent set updateservice class, not widgetprovider class. i've unsuccessfully tried in same way widgetprovider class. edit 2: issue caused me post question turned out unrelated. having confirmation possible it, kept trying , found problem caused onclick appwidget layout item being obscured higher layers in appwidget layout. (edit 1 removed code irrelevant.) step #1: have updateservice obtain instance of appwidgetmanager , via the static getinstance() method . step #2: call updateappwidget() on appwidgetmanager .

sql - mysql result using query -

i've got table in mysql 2 two fields (age, sex) need avg(age) sex (m or f), can me solve ? how should 1 query getting both of looks like? try this: select avg(case when sex = 'm' age end) avg_male , avg(case when sex = 'f' age end) avg_female , name, book_date reviews r inner join books b on b.id = r.book_id age<30 <-------------- group book_id <-------- can group here column like. demo here

javascript - Java Script / jQuery - How to redirect to another page -

i have mvc 5/c# application. have button on form allows user delete record db. when clicked button calls js function below. html allows user delete current row is: <a class="btn btn-default" href="javascript:deletelocation(@model.rowid);">delete</a> the js function looks follows: function deletelocation(rowid) { var url = "/userlocation/delete"; var redirecturl = "/userlocation/index" $.get(url, { rowid: rowid }, function () { $.get(redirecturl); }); } my c# delete method looks follows: [authorize] public void delete(int rowid) { userlocationdata userlocationdata = new userlocationdata(); userlocationdata.delete(rowid); } half of working perfectly. c# method getting called when user clicks button. however, after delete, page want redirect isn't getting displayed. tried putting redirecttoaction in c# method didn't work either.

java - Identifying all the names from a given text -

i want identify names written in text, using imdb movie reviews. i using stanford pos tagger, , analysing proper nouns (as proper noun names of person,things,places), slow. firstly tagging input lines, checking words nnp in end, slow process. is there efficient substitute achieve task? library (preferably in java). thanks. do know input language? if yes match each word against dictionnary , flag word proper noun if not in dictionnary. require complete dictionnary declensions of each word of language, , pay attention numbers , other special cases. edit: see this answer in official faq : have tried change model used?

java - Play Framework 2.x: How do i make a HTTP-GET for an reverse lookup (nominatim OSM)? -

i make simple http playframework (java) doesn't work. i've googled lot read in documentation of play 2.x nothing helped me. examples in documentation did not help. i write method calls reverse geoconding service (for example this ) , gives json data back. need response data jsonnode or that. i tried following piece of code play homepage should give name of road, did not work. public static promise<result> reverselookup() {//string lat, string lon final promise<result> resultpromise = ws.url("http://nominatim.openstreetmap.org/reverse?format=json&lat=51.510809&lon=-0.092875").get().map( new function<ws.response, result>() { public result apply(ws.response response) { return ok("road:" + response.asjson().findpath("road")); } } ); return resultpromise; } i got error here: [runtimeexception: com.fasterxml.jackson.core.jsonp

python - Perform n linear regressions, simultaneously -

i have y - 100 row 5 column pandas dataframe i have x - 100 row 5 column pandas dataframe for i=0,...,4 want regress y[:,i] against x[:,i]. i know how using loop. but there way vectorise linear regression, don't have loop in there? as far know, there no way put @ once in optimized fortran library, lapack, since each regression it's own independent optimization problem. note loop on 4 items not taking time relative regression itself, need compute because each regression isolated linear algebra problem... don't think there time save here...

mysql - understanding Java JDBC error -

i hoping have assistance in understanding error. making simple connection database, , reason doesn't input, failing understand error occurring. assistance appreciated- thanks. my code: package db; import java.sql.*; import java.util.arraylist; import java.util.iterator; import java.util.list; import java.util.scanner; public class bankaccount { private static string jdbc_driver = "com.mysql.jdbc.driver"; private static string db_url = "jdbc:mysql://localhost:3306/cs565"; private static string db_username = "cs"; private static string db_password = "java"; // public string name; // public string action; // public double amount; // create table public static void createtable(){ try { class.forname(jdbc_driver); connection conn = drivermanager.getconnection(db_url, db_username, db_password); statement stmt = conn.createstatement(); string sqldropstatement = "drop table mytable_tran

javascript - Go to link when pressing keyboard arrows -

i have 2 links: <a href='leftlink.php'><< prev</a> , <a href='rightlink.php'>next >></a> . can possible go leftlink when pressing left arrow keyboard , , rightlink.php when pressing right arrow keyboard ? advice welcome thank in advance. give both links id , setup listener keyup event, check keycode pressed appropriate link, , trigger click on it. html <a id="prevlink" href='leftlink.php'><< prev</a> <a id="nextlink" href='rightlink.php'>next >></a>. js document.addeventlistener("keyup",function(e){ var key = e.which||e.keycode; switch(key){ //left arrow case 37: document.getelementbyid("prevlink").click(); break; //right arrow case 39: document.getelementbyid("nextlink").click(); break; } });

Printing Queries in Python -

this question has answer here: what numbers starting 0 mean in python? 7 answers i new python, in way new programming. was trying teach myself python basics... , came across weird thing... please find below printing results... >>> print 1,000,000 1 0 0 >>> print 1,112,231 1 112 231 >>> print 000 0 >>> print 1,001,002 1 1 2 >>> print 1,100,001,0010 1 100 1 8 while understand 0010 binary equivalent of 8 (in last one), not understand why python so? embedded logic of language or else? the remaining, able figure out; if can give brief explanation great! python literals preceded '0' tells express in in octal. literals preceded '0x' hexadecimal. literals preceded '0b' binary. print 0010 8 print 0b110011 51 print 0x100 256 i have tested '0o' on python 2.7.6 , gotten print

javascript - canvas how to move rect using arrows -

i started learning canvas today, started off creating simple rectangle, need make rectangle move using arrow keys, moveto function doesn't seem anything, how can achieve this. code far <html> <head> <title></title> </head> <body> <canvas id="mycanvas" width="600" height="250" style="border:1px solid black;"> </canvas> <script type="text/javascript"> var canvas = document.getelementbyid("mycanvas"); var context = canvas.getcontext("2d"); context.fillstyle = "green"; var x = 50,y=5,w=100,h=100; context.fillrect(x,y,w,h); document.onkeydown = function move() { switch(window.event.keycode) { case 37: { //left context.moveto(x++,y);

python - Is there any guide for local django project to deploy it to vps with sqlite setup? -

i coded local django project , deploy naive sqlite db vps. prefer use apache since still hosts wordpress site. there guide follow without pain ? suggestion appreciated. i've done setting separate virtual host django project, in past. virtual host configuration below example of used small project. apache foundation contains more documentation on how configure , manage virtualhost. note : in paths below, /path/to/django/projects/app needs modified match path system , should contain full, absolute path. wsgipythonpath /path/to/django/projects/app <virtualhost *:80> documentroot /path/to/django/projects/app servername subdomain.example.com wsgiscriptalias / /path/to/django/projects/app/<subdir>/wsgi.py errorlog /var/log/httpd/app-error_log customlog /var/log/httpd/app-access_log common alias /robots.txt /path/to/django/projects/app/static/robots.txt alias /favicon.ico /path/to/django/projects/app/static/favicon.ico

perl - How can I use the until function with appropriate way -

i have file want filter that: ##matrix=axtchain 16 91,-114,-31,-123,-114,100,-125,-31,-31,-125,100,-114,-123,-31,-114,91 ##gappenalties=axtchain o=400 e=30 chain 21455232 chr20 14302601 + 37457 14119338 chr22 14786829 + 3573 14759345 1 189 159 123 24 30 22 165 21 20 231 105 0 171 17 19 261 0 2231 222 2 0 253 56 48 chain 164224 chr20 14302601 + 1105938 1125118 chr22 14786829 + 1081744 1100586 8 221 352 334 24 100 112 34 56 56 26 50 47 ……………………. chain 143824 chr20 14302601 + 1105938 1125118 chr22 14786829 + 1081744 1100586 8 so, briefly,there blocks separated blank line. each block begins line " chain xxxxx " , continues lines numbers. want filter out file , keep blocks chain , number follows greater 3000. wrote following script that: #!/usr/bin/perl use strict; use warnings; use posix; $chain = $argv[0]; #it filters chains chains >= 3000. open $chain_fi

sql - SpringData jparepository AND / OR operators -

i need jparepository: select * table ( propertytwo '%something%' or propertythree '%something%' or propertyfour '%something%' ) , propertyone in (a,b); i this: findbypropertyoneinandpropertytwocontainingorpropertythreecontainingorpropertyfourcontaining(list param1, string param2, string param3, string param4) but method this: select * table propertytwo '%something%' or propertythree '%something%' or propertyfour '%something%' , propertyone in (a,b); which different first sql query above. how can achieve correct result? like slava said, should do: @query("from table t t.propertyone in :param1 , (t.propertytwo :param2 or t.propertythree :param3 or t.propertyfour :param4)") list<table> findbyparams(@param("param1") list<string> param1, @param("param2") string param2, @param("param3") string param3, @param("param4") string param4);

c# - unrecognized namespace 'umbraco' -

building umbraco 6.1.5 mvc site in .net 4.5 framework using vs2012. when trying use couple of common packages, cultiv contact form , google maps datatype green squiggly underline under word "umbraco" in following instance:- <umbraco:macro filelocation="~/macroscripts/cultivcontactform.cshtml" mailfrom="website@abc.com.com" runat="server" /> the error shown if mouse on "umbraco" "unrecognized namespace 'umbraco'". the top of file has:- @inherits umbraco.web.mvc.umbracotemplatepage @using umbraco; i cannot understand why "@using umbraco" doesn't fix problem. any advice appreciated. because - , looks - ah - sorry razor pages have different syntax old asp.net user controls. it looks me think can magically use user control in razor page. bad news - no.

php round down 5 minutes time -

what correct way round down current time 5 minutes in php minus 5 minutes? need output time string, in 2 decimals in format: $today = date("dmyhi"); example: 16:32 -> 16:25 18:54 -> 18:45 20:04 -> 19:55 thanks lot! try this: $date = new datetime(); $hours = $date->format('h') $minutes = (integer) $date->format('i'); // round down nearest multiple of 5 $minutes = floor($minutes / 5 ) * 5; // if $minutes 0 or 5 add trailing 0 if($minutes < 10) { $minutes = '0' . $minutes; } // output echo $hours . ':' . $minutes;

java - Validate null fields in prepared statement -

i have gui takes in fields inserted inside query. when fields empty, it's expected java throws format exception when fields don't match specified type. however, user know input invalid. there way validate when fields inserted in prepared statement empty? snippet: string query = "delete racewinners racename = ? " + "and raceyear = ? , ridername = ? " + "and distance = ? " + "and winning_time = ?"; try { statement = connection.preparestatement(query); statement.setstring(1, race_name); statement.setint(2, race_year); statement.setstring(3, rider_name); statement.setint(4, distance); statement.setobject(5, winning_time); } catch(sqlexception e) { system.out.println(e1.getmessage()); } to check null , since java 7, have objects.requirenonnull(somevariable); or use overloaded method can specify message. method throw exception if argument passed null

angularjs - Add ng-click in link function of directive -

i have following function in link-function in directive: var add_todos = function(todos) { html += "<ul>"; (var = 0; < todos.length; i++) { html += '<li> <input type="checkbox">'+ todos[i].title; add_todos(todos[i].children); html += '</li>'; } html += "</ul>"; }; i use element.replacewith(html) . works well, want use ng-if in checkbox. however, if did html += '<li> <input type="checkbox" ng-click="myfunction()">'+ todos[i].title; , wouldn't work, because, html isn't evaluated angular anymore. i know if used template, evaluate ng-click() , don't know how use template while maintaining linking function. i've been thinking having angularjs regard html template, mean evaluate ng-click() . have no idea, however, how this. other, perhaps more efficient means of getting work, welcome too,

java - Double checking exception and try-catch logic -

so started unit , answered couple questions outta book. answers show proper understanding of exceptions , try-catch blocks? wanted verify before start working try-catch blocks/exceptions :) what classes (and subclasses) examples of unchecked exceptions? answer: ioexceptions, classnotfoundexception, runtimeexception (its subclasses: arithmeticexception, nullpointerexception, indexoutofboundsexception, illegalargumentexception what 2 different ways programmer can deal checked exceptions avoid compil answer: use either try-catch block or declare exception in method header beforehand. describe steps occur when exception not caught in current method answer: if exception not caught in current method, java exits method, passes exception method invoke method, , continues same process find handler. if no handler found in chain of methods being invoked, program terminates , prints error message on console. (ths process of finding ‘handler’ called catching , exception. how ‘chai

Gif Animation in Gnuplot -

Image
i have data file separated 2 lines. each section of data ~50 lines. i'm trying make .gif file. know how plot them individually or in group can't .gif work. my problem similar 1 worked out glen maclachlan in youtube channel, part 5. instead of 1 point, have ~50 data points each data section. solves problem utilizing $index feature, , tried same mine doesn't work. what missing? have plot data separately .png files , group them .gif file? what i've done::: i edited data file. there 2 columns x, , y. now, have them in 2nd , 3rd column, , first column index 0 50. each block of data has similar index. bash script create plot file for ((i=0;i < 50; i++)) echo "plot 'data.txt' u 2:3 w circles index $i"; done >>simulate.plt it plots data points why don't show have tried? the following should work fine: set terminal gif animate delay 100 set output 'foobar.gif' stats 'datafile' nooutput set xrange [-0.

HTML Form Action Attribute: Difference Between Values -

i learning html forms , in particular action attribute has me bit confused. difference between following values , when best use each case? action="" action="?" action="?page" action="?page=main" action="." action="../" action="/" action="#" from w3 form documentation : this [action] attribute specifies form processing agent that is, form, when submitted, sends values wherever action set to. part noted actions submit form same page form displayed on. leave action out together or use <?php echo $_server['php_self']; ?> (if you're on php page) obtain same effect. now, "?page=main" technically go same page well, page value set "main" (might used processing output somehow example). use if need page value, otherwise 1 of blank ones.

python - Context manager, multiple function calls and transactions -

say do: with my_connection: o.first_call() where my_connection 's __exit__ method calls rollback and o.first_call in execution calls j.second_call , calls z.third_call . z.third_call inserted record in database, j.second_call inserts record, o.first_call craps out. rollback state before first entered context of my_connection or rollbacked state between o.first_call , j.second_call ? edit: clear, i'm hoping entire thing gets rolled before ever called o.first_call edit2: i'm hoping if there magic in __enter__ , kind of context say, whatever called 1 big transaction. transactions rolled-back last commit call. per database api specification v2.0 : .commit() commit pending transaction database. .rollback() ... causes database roll start of pending transaction. so depends on mean "successfully inserted". if insertion finalized call commit , rollback not remove insertion. however, if there no commit, insert

node.js - Piping Readable -> Writable streams -- emit vs data? -

i have code uses max ogden's websocket-stream library ( https://github.com/maxogden/websocket-stream ), pretty nifty. when this: websocketstream.on('data', function(data){ console.log(data); }); i arraybuffer in client (what want, binary websocket stream). when try implement writable stream (using prototypes or whatever), i'm getting arraybufferview in _write instead of bare arraybuffer :-(. i'm using objectmode:true. the simplest example is: var s = new writable({objectmode:true}); s._write = function(chunk, enc, next){ console.log(chunk); // arraybufferview console.log(enc); // `buffer` next(); } websocketstream.pipe(s); who's newing buffer view, , how can stop them? the workaround take chunk in write , grab .buffer. i'm doing best understand 'implementors' side of newer streams interface, , love things correctly.

angularjs - BreezeJS - binding to all entities -

my app based on notifications server, using signalr getting entities , adding them using manager.createentity(entitytype, entity, breeze.entitystate.unchanged); the ui based on angular grid bind entities of type, how ever when adding new entity grid isn't being updated, assumption bind cache , not other collection. same issue when removing entity as @pwkad pointed out in comments above, getentities function builds array each time called, returning entities cache match parameters. resulting array won't updated when cache changes. in case, should store array that's returned getentities, add each new entity after that: scope.gridlist = manager.getentities(entitytype); // ... later: scope.gridlist.push(manager.createentity(entitytype, entity, breeze.entitystate.unchanged));

java - Preference when setting and adding an item at the some position in an arraylist -

i guess i'm asking difference between order of these 2 operations on arraylist. suppose have following arraylists arraylist<string> list = new arraylist<string>(); arraylist<string> list2 = new arraylist<string>(); list.add("tom"); list.add("jerry"); list.add(1,"harry"); list.set(1,"klaus"); system.out.println(list); output [tom, klaus, jerry] then same thing list2 except switch last 2 statements list2.add("tom"); list2.add("jerry"); list2.set(1,"harry"); list2.add(1,"klaus"); system.out.println(list2); output [tom, klaus, harry] when value set at posiotion why list add an item @ position+1 when attempt add new item @ position as in second list . shouldn't list2 be? [tom, klaus] and shouldn't list have [tom, klaus] its simple add inserts new value @ given index and set replace value @ given index. have @ output after e

tomcat - java jax rs access files on server -

running tomcat 7.0 have file in web-inf folder accessible through browser by: http://localhost:8080/wsdarwin_1.0.0/hello.txt how go accessing file , contents in java code ( using relative links, guess ). can access fine using buffered reader , accessing full url such: url requesturl = new url(path_prefix_two+"/request.txt"); bufferedreader testin = new bufferedreader(new inputstreamreader(requesturl.openstream())); but isn't there way access 'locally' ? i'm not using maven for example, accessing file locally permits me this: bufferedreader testin = new bufferedreader(new filereader(new file(path_prefix+"/request.txt"))); path_prefix = "c:/users/username/.../hello.txt"; if change path_prefix "/hello.txt", not access ( file not found error ) not sure if you're looking for, if file deployed in web-inf/classes or in jar in web-inf/lib, can access via thread.currentthread().getcontextclassloader

ios - UIToolbar at the bottom of container view -

Image
i'm making app parallax effect. use qmbparallaxscrollviewcontroller , , created 2 child views. what need have uitoolbar @ bottom of view, user can scroll have bar. if use in scroll detail child view, @ bottom of scroll. put in detail view controller root view, when child view enter container, bar behind. what can have @ bottom , front? i find answer it's not necessary add toolbar. navigation controller have default, hidden. show it: - (void)viewwillappear:(bool)animated { [self.navigationcontroller settoolbarhidden:no animated:yes]; } - (void)viewwilldisappear:(bool)animated { [self.navigationcontroller settoolbarhidden:yes animated:yes]; }

ruby - Methodology for identifying grocery items from a OCR read -

i'm writing ruby application reads text off of grocery store receipt , allows user see how paying per ounce , possibly serving based on ingredients. i'm using tesseract gem pretty straight forward. however, line items wrong, comically so, in case of "burly parsley" "curly parsley". i assume solving problem in way natural language processing problem don't have background know direction go in. first idea hack ideas of others, make google request , if suggest different, use that. however, i'd read , learn how problem might solved correctly. so how should go solving burly parsley problem? there lot of ways go dealing problem this. here's 1 off top of head: dictionaries - if you're restricting vertical - retail in case - should possible build dictionary of possible items encounter. proceed compare results ocr read words in dictionary using form of string similarity/matching. i'd written an article on subject here whil

wordpress - Why are Woocommerce product names showing the word line [line] in square brackets after? -

Image
as title suggests, can please advise why woocommerce showing word line in square brackets '[line]' after product names? please see image below: i using latest version of wordpress (3.8.1), yith socute theme , woocommerce following plugins: wow slider woocommerce compare woocommerce ajax navigation woocommerce wish list woocommerce magnifier i think there may simple explanation missing; however, can't find answers using google and, have spent far time looking (a full day). so, it's time ask help. thanks everyone. the [line] been added page piece of code: add_action( 'woocommerce_single_product_summary', create_function( '', 'echo do_shortcode("[line]");' ) ); in woocommerce/content-single-product.php file to remove [line] 1 of 2 things: change piece of code to add_action( 'woocommerce_single_product_summary', create_function( '', 'echo do_shortcode("&nbsp;")

python - file size differences - requests module vs chrome -

i really puzzled issue i'm running into. have script downloading image files off of imgur. script leverages requests module. in essence, request made open link byte stream, , file downloaded chunks , placed in in-memory buffer. here simple version of do: page_binary_string = io.bytesio response = requests.get(url, stream=true) chunk in response.iter_content(chunk_size, decode_unicode): page_binary_string.write(chunk) in case, decode_unicode going set false. write resulting stream file using image_file = open(path, 'wb') # open file updating image_file.write(page_binary_string.read(page_binary_string.size)) when @ resultant file in file system, 1/20 of size of file browser downloaded!!! here link experimenting @ moment: http://i.imgur.com/vbauzys.jpg if download file browser, can see 244kb. when @ file on disk, 10kb. size difference obvious when opening image. quality has drastically deteriorated. anyone have ideas why happening , how fix it? http

java - Infinispan Server : How to enable JMX monitoring? -

i have infinispan server , version 6.0.x, 1 derived jboss 7.2, , working fine caching. however, when try monitor jmx can't. url type in jconsole.bat : service:jmx:remoting-jmx://my.ip.address.here:9999 but error : exception in thread "vmpanel.connect" java.util.serviceconfigurationerror: javax.management.remote.jmxconnectorprovider: provider org.jboss.remotingjmx.remotingconnectorprovider not instantiated: java.lang.noclassdeffounderror: org/jboss/logging/logger @ java.util.serviceloader.fail(serviceloader.java:224) @ java.util.serviceloader.access$100(serviceloader.java:181) @ java.util.serviceloader$lazyiterator.next(serviceloader.java:377) @ java.util.serviceloader$1.next(serviceloader.java:445) @ javax.management.remote.jmxconnectorfactory.getconnectorasservice(jmxconnectorfactory.java:472) @ javax.management.remote.jmxconnectorfactory.newjmxconnector(jmxconnectorfactory.java:341) @ javax.management.remote.jmxconnectorfactory.