Posts

Showing posts from April, 2014

rdf - Infer teacher-student relationships via courses? -

Image
i have created ontology university, 1 discussed in this series of youtube videos. there classes , instances of students, professors , courses. there "studies" , "teaches" properties relate students , professors classes. <objectpropertyassertion> <objectproperty iri="#teaches"/> <namedindividual iri="#cadbury"/> <namedindividual iri="#el101"/> </objectpropertyassertion> <objectpropertyassertion> <objectproperty iri="#studies"/> <namedindividual iri="#hechinger"/> <namedindividual iri="#el101"/> </objectpropertyassertion> is determining hechinger student of cadbury should able owl reasoning or inference in protege? is determining hechinger student of cadbury should able owl reasoning or inference in protege? if have isstudentof property, can define axioms make inference work. e.g., in case, you'

java - Zoom Levels with the JavaFX 8 Canvas -

i have following code within javafx 8 application, meant control scale of transform of canvas element added scene: import javafx.geometry.point2d; import javafx.scene.canvas.canvas; import javafx.scene.transform.affine; import me.mazeika.dengine.editor.input.mouse; import java.util.list; // classes implement transformer ones meant modify // canvas's transform based on input , nothing else public class scrolltransformer implements transformer { private static final double min_scale = .1; private static final double max_scale = 5; private double currentscale = 1; // called every frame animationtimer's handle() @override public void update(canvas canvas, affine transform, long now, long delta) { // when scroll up, example, integer +1 added list // (and -1 down). when method called, list cleared. list<integer> pendingscrolls = mouse.getandremovependingscrolls(); if (! pendingscrolls.isempty()) {

MATLAB: How to Retrieve Intensity-Based Registration Data (with imregister) to re-Perform Registration? -

i thought should simple task, can't find way it: i using 'imregister' (matlab) register 2 medical x-ray images. ensure best registration outcome possible, use image processing techniques such contrast enhancement, blackening of objects different between images , cropping. outcome of seems quite satisfying. now, want perform exact same registaration on original images, can display 2 original images automatically in alignment. i think output parameter such tform serves purpose of performing registration on 2 images, unfortunately 'imregister' not provide such parameter, far know. it provide output spatial referencing object r_reg might answer, still haven't figured out how use re-preform registration. i should mention since dealing medical x-ray images on non of feature-detecting algorithms seem work enough perform registration, can use intensity-based (as opposed feature-based) registration, , therefore using 'imregister'. does know how ca

Specific Facebook page plugin doesn't work on mobile -

i came across strange; facebok page plugin doesn't load on mobile if it's specific facebook page. my code: <div id="fb-root">&nbsp;</div> <script>(function(d, s, id) { var js, fjs = d.getelementsbytagname(s)[0]; if (d.getelementbyid(id)) return; js = d.createelement(s); js.id = id; js.src = "//connect.facebook.net/en_us/sdk.js#xfbml=1&version=v2.4&appid=1591121954498982"; fjs.parentnode.insertbefore(js, fjs); }(document, 'script', 'facebook-jssdk'));</script> <div class="fb-page" data-adapt-container-width="true" data-height="350" data-hide-cover="false" data-href="https://www.facebook.com/pages/סיפורי-פירות-fruit-story/410067012494711?fref=ts" data-show-facepile="true" data-show-posts="true" data-small-header="false">&nbsp;</div> changing line: data-href="

salesforce - Attachments in Apex SOQL Subquery -

i have custom objects team member , employment, , there's lookup relationship employment(many) team member(one), plus lookup record on team member called current employment . the employment record may have attachments. i want soql query, run in apex class, return attachments information specific team members. so far have this: sobject[] results = [select id,(select id,name attachments) employment__c id in (select current_employment__c team_member__c id=:id)]; wnen run query in schema browser, works ok , i'm able drill-down attachments, when run in apex (anonymous), result set not contain attachments: for (sobject result : results) { system.debug(result); } i can see employment id in results. how can attachments in apex? you following list of attachment related object. employment__c[] results = [select id,(select id,name attachments) employment__c id in (select current_employment__c team_member__c id=:id)]; (employment__c result : results)

Django: css specificity to a webpage -

i load static files in base.html . contents of master.css specific 1 webpage. how load css not in template, in specific webpage? {% load staticfiles %} <link rel="stylesheet" type="text/css" href="{% static 'incidents/css/master.css' %}"> you do: {% if request.get_full_path = "page/url/" %} <link rel="stylesheet" type="text/css" href="{% static 'incidents/css/master.css' %}"> {% endif %} also think can target template name doing: {% if views.templatename, %} <link rel="stylesheet" type="text/css" href="{% static 'incidents/css/master.css' %}"> {% endif %} don't hold me havent been on django in while.

AngularJS: ui-router: how to get state parameter from child state? -

the question sounds bit stupid. let me explane i'm going achieve. my simplified code: $stateprovider .state('course', { url: '/courses/:courseid', controller: 'coursecontroller' }); $stateprovider .state('course.topic', { url: '/topics/:topicid', controller: 'topiccontroller' }); without topicid it's not possible show content, know on course level if topic not set - should set first topic course. how ui-router? basically need param child state. what about $stateprovider .state('course', { abstract: true, url: '/courses/:courseid', controller: 'coursecontroller' }) .state('course.topic', { url: '/topics/:topicid', controller: 'topiccontroller' }) .state('course.firsttopic', { url: '', controller: 'topiccontroller' });

PhpStorm Port 9000 is busy with App Engine -

with phpstorm launched port 9000 busy error using this cookbook appengine/phpstorm v9 . can reset port in phpstorm how reset port in app engine php server , correct solution? dps-imac:~ dp$ sudo lsof -i :9000 password: command pid user fd type device size/off node name phpstorm 332 dp 288u ipv4 0x1fa7bde7767bedad 0t0 tcp *:cslistener (listen) dps-imac:~ dp$ mac os 10.10 phpstorm 9 appengine php v 1.9.24

cloudify - Undeploy application by recipe -

i'm using cloudify 2.7 openstack icehouse. i exit deploy process of service if condition happens in -service.groovy file. can suggest me how should it? it not entirely clear trying accomplish. if want instance stop processing further lifecycle events, have script exit non-zero exit code , use 'disableselfhealing' flag when install service ( http://getcloudify.org/guide/2.7/deploying/deploying_srvs.html ) if want uninstall service, need use rest api (or provided rest-client package - https://github.com/cloudifysource/cloudify/tree/master/rest-client ) uninstall service.

javascript - Pass PNG on form submit, Request URL Too long -

so have interesting question. have form user draws image on canvas (think signature pad). need send image c# controller (i using asp.net mvc 5). code have functions shorter strings, when try pass png data, long , recieve http error 414. request url long error. here code: html: <form id="mainform" action="submituseranswer" method="post"> <input type="hidden" id="useroutput" name="output" value="" /> //...other form elements, signature box, etc. </form> javascript: function gotonextquestion() { var output = $('#signature').jsignature("getdata"); $('#useroutput').val(output); $('#mainform').submit(); } c#: public actionresult submituseranswer() { //use useroutput whatever //submit string database, trigger stuff, whatever //go next question system.collections.specialized.namevaluecollecti

Python: How to generate list of every possible permutation of three characters given a length? -

this question has answer here: generating permutations repetitions in python 5 answers say have string "abc" i'd iterate on every possibility of characters 'a', 'b' , 'c' in string 5 characters long. desired output: ['a', 'a', 'a', 'a', 'a' ] ['a', 'a', 'a', 'a', 'b' ] ... ['c', 'c', 'c', 'c', 'c' ] i tried using [x x in itertools.permutations('abc', r=5) ] returns empty list. you need itertools.product : >>> list(product('abc',repeat=5)) [('a', 'a', 'a', 'a', 'a'), ('a', 'a', 'a', 'a', 'b'), ('a', 'a', 'a', 'a', 'c'), ('a', 'a', '

github - How do I conditionally, automatically, add information to git commits comments? -

i'm looking automatically add information git commit comments. for example, can run script in pre-commit phase , detect whether there changes sort of application configuration templates, , add comment git commit effect (say, "warning! commit changes configuration templates, may need full rebuild changes") does git provide through existing tool/extension/api call? there prepare-commit-msg hook can used generate initial commit message before opening editor: prepare-commit-msg hook invoked git commit right after preparing default log message, , before editor started. there commit-msg hook can used modify commit message: commit-msg hook invoked git commit, , can bypassed --no-verify option. takes single parameter, name of file holds proposed commit log message. exiting non-zero status causes git commit abort. either of 1 of these used implement behavior you're looking for. implement logic in either 1 of these,

How to change the shape of NEO4j nodes through the grass stylesheet? -

i provide better visual segregation between nodes in neo4j's web explorer. possible change grass styles allow square shaped node? below example of node style alter. possible within neo4j or must outside visualization library used? node { diameter: 40px; color: #dfe1e3; border-color: #d4d6d7; border-width: 2px; text-color-internal: #000000; caption: '{id}'; font-size: 10px; } right isn't possible, it's on todo list. what can have wider borders , more distinct border colors better distinction. can choose color palette more distinguishable colors backgrounds. if want can have previous http://localhost:7474/webadmin ui had more styling options. otherwise you'd have go can help: http://neo4j.com/developer/guide-data-visualization/

timer - Java @Singleton EJB executing method at most every 5 seconds -

hi implementing web application email sending functionality. in order our email server not blacklisted have send @ 1 email per 5 seconds. thinking create @singleton ejb email sender, in way 1 ejb instance responsible sending emails in whole application. how should implement 5 seconds counter in order send @ 1 email per 5 seconds? e.g class that @singleton public class emailsender { public void sendemail(string msg){ .... } } try using @schedule: @singleton public class emailsender { queue<email> queue; @schedule(second = "*/5", minute = "*", hour = "*") public void sendemail(string msg){ if (!queue.isempty()) { //get queue element , send email } } }

sql - Migrating from Oracle to MySQL. VARCHAR2 length defined using bytes. How to port? -

i have variable in oracle procedure declared this: mymsg varchar2(256 byte) how can port mysql? because when try declare in mysql procedure: declare mymsg varchar(256 byte); mysql throws me syntax error. how can port oracle variable definition mysql? it 256 byte part doesn't let me declare variable in mysql , need find similar 256 byte expression in mysql. in mysql, varchar colums declared this colname varchar(256), varchar(20) not null, etcetera. oracle syntax different. in stored code in mysql, inside function or procedure scope, variables declared this: declare mymsg varchar(256); if you're not aware of this, be: oracle pl/sql , mysql's little language stored code different each other.

c - Which is faster: Increment or equation with addition arithmetic -

example: a : ++i; b : i++; c : += 1; d : = + 1; assuming each of them abcd called simultaneous, 1 of them performed first ? in particular example 4 expressions have exact same externally observable result competent compiler should generate exact same code them. the compiler doesn't slavishly read code , generate few instructions each statement, compiler reasons result of code should according standard , generates code needed whole program behave required. therefore asking performance questions single statements meaningless. let me show example: void foo(unsigned int a, unsigned int b) { unsigned int = * b; } void bar(unsigned int a, unsigned int b) { unsigned int = + b; } which 1 faster? function foo or bar ? many "of course multiplication slower", answer is: both equally fast because simple dead store optimization see nothing uses i , there's no need compute it, compiler can optimize functions down nothing. let's try it: $ cat > foo.c

javascript - Chrome history issue -

i developing web application , business need's have change document.title dynamically. when i'm doing in firefox changes updates link name in history, if open history in chrome (cmd+y) see initial page <title/> .

javascript - Toggle checked status on input inconstant in jQuery function -

i fear i'm missing painfully obvious, jquery function appears working inconsistently. html: <label id="income_this_tax_year"> <div class="left"> <p>have had self-employment, sole trade or cis income during tax year?</p> </div> <div class="right"> <input type="radio" name="income_this_tax_year" value="yes" /> <input type="radio" name="income_this_tax_year" value="no" /> <button type="button" data-value="yes" class="button">yes</button> <button type="button" data-value="no" class="button">no</button> </div> <div class="float-clear"></div> </label> jquery: $(document).ready(function(){ $('button').on('click', function(e) { e.preventdefault(); var option = $(this).pa

jpa - Named Query to return a List<String> -

hello using dropwizard application. the resource class @path("/people") @produces(mediatype.application_json) public class peopleresource{ private persondao pdao; public peopleresource(persondao pdao) { this.pdao = pdao; } @get @timed @unitofwork public list<string> getallpeople() { return pdao.findall(); } } the dao class public class persondao extends abstractdao<person> { public persondao(sessionfactory factory) { super(factory); } public list<string> findall() { return list(namedquery("com.example.findall")); } public person create(person p) { return persist(p); } the person class @jsonignoreproperties(ignoreunknown = true) @entity @table(name = "person") @namedqueries({ @namedquery( name = "com.example.findall", query = "select distinct p.name person p" ) }) @jsonproperty string name; but when tr

How do I install an earlier version of Java SDK on OSX -

i have java 1.8.0_45 sdk installed on osx yosemite (10.10.4), because of bug in release need go 1.8.0_25 i have downloaded , installed earlier version (1.8.0_25) after reboot java -version still shows 1.8.0_45. i don't understand java resides on osx, how can system uses 1.8.0_25 try , add ~/.bashrc export java_home=/library/java/javavirtualmachines/jdk1.7.0_75.jdk/contents/home you can have multiple jre/jdk's installed, changing path, can specify 1 use each time open new shell. here use in .bashrc java_version=7 java_7_home=/library/java/javavirtualmachines/jdk1.7.0_75.jdk/contents/home java_8_home=/library/java/javavirtualmachines/jdk1.8.0_40.jdk/contents/home tmp="java_${java_version}_home" export java_home=${!tmp} export path=${!j}/bin:$path here, can change 7 8 . this change java_home, , append bin directory path general use command line. note may beed change java home's according specific release versions installed on machine

Difference between delay() and sleep() in C? -

both delay() , sleep() function suspends system amount of time, delay takes milisecond argument while sleep takes second argument. besides this, there differences between these 2 functions? , among them, gives more accurate result? they same thing except 1 sleeps number of seconds while other sleeps milliseconds. you should go reference std::this_thread::sleep_for : std::this_thread::sleep_for instead in c++ if can. windows.h have sleep , unix have usleep. this implementation found online might better fit needs: #if defined(__win32__) || defined(_win32) || defined(win32) || defined(__windows__) || defined(__tos_win__) #include <windows.h> inline void delay( unsigned long ms ) { sleep( ms ); } #else /* presume posix */ #include <unistd.h> inline void delay( unsigned long ms ) { usleep( ms * 1000 ); } #endif

excel vba - Error 91 in VBA using simple classes -

dim newcis cis dim newstring string private sub commandbutton1_click() newstring = "lol" newcis.contactname = newstring userform1.label1.caption = newcis.contactname end sub i run error 91 on line 6. here cis class: private strcontactname string property let contactname(name string) set strcontactname = name end property property contactname() string set contactname = strcontactname end property i've tried using set function instead of property let, leads error 91. there crucial knowledge object oriented programming in vba i'm missing? you forgot create new instance of class: private sub commandbutton1_click() newstring = "lol" set newcis = new cis newcis.contactname = newstring userform1.label1.caption = newcis.contactname end sub

php - How to store items recursively? -

i want collect& store data array while drilling structured data, when done, have array ex:: [{nodes:[{nodes:[], id:2}, {nodes:[{nodes:[], id:4}], id:3} ], id:1}] notice how store deeper nodes parent nodes,here attempt simplified, tried pass node reference able collect deeper nodes parent nodes: $parentnode= array('nodes'=>array()); scan ($parentnode, $excel, 0, 0); function scan (& $parentnode, $excel, $row, $column, $maxcolumn) { $childnode = array('nodes' => array(), 'id' => $excel[$row]['cr'.$column]); // make sure drilling expected, used echo: echo ($newnode['id'].','); // now, push child node passed reference parent node: array_push($parentnode['nodes'], $childnode); // keep drilling, pass child node parent: $this->scan($childnode, $excel, $row, $column + 1, $maxcolumn); } but, is: {nodes:[{nodes:[],id:1}]} why wouldn't expect? long pass childnode reference

Initializing table types in Oracle -

i have such simple procedure , typetest table type. create or replace procedure testprocedure (dayname out typetest )is begin dayname(1):='monday'; dayname(2):='1'; dayname(3):='good'; end testprocedure; create or replace type typetest table of varchar2(50); it compiles normally, when run it, gives such exception: "ora-06531:reference uninitialized collection". can me please? initialize dayname , extend (each time 1 or @ beginning 3): create or replace procedure testprocedure (dayname out typetest )is begin dayname := typetest(); dayname.extend(3); dayname(1):='monday'; dayname(2):='1'; dayname(3):='good'; end testprocedure; test: declare t typetest; begin testprocedure(t); in 1..t.count() loop dbms_output.put_line(t(i)); end loop; end; output: monday 1

objective c - Swipe does not work with UITableview's scrollview and Pull to Refresh in iOS -

i have created uitableview scrollview , given swipe gesture swipe left right , vice-versa between 3 different views. both of them don't seem work each other. on top of have pull refresh functionality on uitableview . have tried implement uigesturerecogniser delegate method doesn't seem work.any suggestions? i have realised when bouncing disabled on scrollview swipe functionality works fine, pull-to-refresh not work in case.

java - Hibernate throw TransientObjectException when I pass a transient object as parameter for a query after I implement the optimist locking -

i working in project hibernate entity manager, , nice until start implement optimistic lock in our entities. for example, have following named query returns addresses of person: @namedquery(name = "address.findbyperson", query = "select address a.person = :person") in order pass person object query, did this: person nperson = new person(); nperson.setid(1); typedquery<address> query = manager.createnamedquery("address.findbyperson", address.class); query.setparameter("person", nperson); query.getresultlist(); it fine until introduce @version inside person entity. after that, follow exception start occurs: java.lang.reflect.invocationtargetexception @ sun.reflect.nativemethodaccessorimpl.invoke0(native method) @ sun.reflect.nativemethodaccessorimpl.invoke(nativemethodaccessorimpl.java:62) @ sun.reflect.delegatingmethodaccessorimpl.invoke(delegatingmethodaccessorimpl.java:43) @ java.lang.reflect.method.invoke(

c++ - Whats the error in it. string assignment -

i take data struct elements internal elements. better way it. shows error: invalid array assignmen berror: invalid array ssignment error: invalid array assignment error: ‘strcpy’ not declared in scope. #include <iostream> #include <string> using namespace std; struct { char ip[16]; char port[6]; char sessionkey[32]; } int main() { char m_ip[16]; char m_port[6]; char m_sessionkey[32]; a; a.ip = "10.43.160.94111"; a.port = "12345"; a.sessionkey = "12abcd12345abcd12345abcd1234512"; strcpy(m_ip,a.ip); strcpy(m_port,a.port); strcpy(m_sessionkey,a.sessionkey); cout << "m_ip:" << m_ip << endl; cout << "m_port:" << m_port << endl; cout << "m_sessionkey:" << m_sessionkey << endl; } i think mean following (c string functions declared in header <cstring> ) #include <cstri

jquery - Clear all instances of an interval -

is possible remove instances of interval? code snippet: function callinterval() { theinterval = setinterval(function() { console.log("interval called"); }, 1000); } callinterval(); settimeout(callinterval, 4000); settimeout(clearthem, 8000); function clearthem() { clearinterval(theinterval); } the code snippet above removes 1 interval, other continues. the problem here overriding value of variable theinterval every time call callinterval , hold last reference. one easy solution here use array hold references , remove them when calling clear var theinterval = []; function callinterval(test) { theinterval.push(setinterval(function() { snippet.log("interval called: " + test); }, 1000)); } callinterval(1); settimeout(callinterval.bind(undefined, 2), 4000); settimeout(clearthem, 8000); function clearthem() { theinterval.foreach(clearinterval); clearinterval.length = 0; //hack clear array }

windows - AHK SetTitleMatch cannot match with webpages -

i cannot set script when trying use part of window title of webpage using internet explorer or chrome settitlematchmode, 2 #ifwinactive, bab.la italian-english dictionary - internet explorer ahk_class ieframe !space:: msgbox hello return #ifwinactive

how to use windows powershell to clean up (rename) filenames WITHOUT changing the file extention? -

on similar question on here found example of powershell script renames or better "replaces charakters" within many filenames @ once. might happen file extention itself, no good. so how can transform example still renames filenames, leaves file extention untouched ? here example replace dots within filename underscore: dir | rename-item -newname { $_.name -replace "\.","_" } and question is: how fix not replacing last dot (file extention) ? you can access filename minus extension basename property, can combine below: get-childitem | rename-item -newname { "$($_.basename -replace '\.','_')$($_.extension)" }

javascript - Change a css attributte from x to y over time -

here current code: jquery(function(){ $(document).ready(function(){ $('#cont').click(function(e){ $('#splashtext').fadeout(300, function(){ $('#bgimage').animate('filter: blur(0px)', 300); }); }); }); }) i trying have #splashtext fade out (which works fine), while @ same time #bgimage changes it's blur (set via filter: blur(5px); )from 5px 0px jquery. also, #cont button supposed trigger transition onclick. what you're doing passing callback fadeout , means animate function called after fadeout completes execution. try instead: $('#cont').click(function(e){ $('#splashtext').fadeout(300); $('#bgimage').animate(...); // animation here }); also, you're using animate() function wrong. this explanation on how use blur filter in jquery animate . relevant code: $('#bgimage').animate({blurradius: 10}, { dura

Python Kivy: AntiAliasing for Canvas -

when i'm creating widget, , draw circle on canvas, circle hasn't got smooth outline. fix that, thought effectwidget me, once did imagewidget on it. enabling fxaaeffect on after drawing circle on canvas didn't change anything. there way, directly enable antialiasing python kivy's canvas? (even images) the effectwidget effects work on child widgets, not own canvas (due technical limitations how works difficult resolve). add single child widget , try drawing circle on instaed. with kivy can enable in-hardware multisampling anti-aliasing, don't remember how, , think it's enabled (at least @ low level) if possible. edit: following: <youreffectwidget>: widget: canvas: color: rgba: 1, 1, 0, 1 ellipse: pos: 100, 100 size: 50, 50

How to use function in other class c# -

Image
i have app gui i put function checkproxy() in form1.cs works correctly , want move function checkproxy() other class if put checkproxy() in other class error invoke , richtextbox3 namespace test3 { public partial class form1 : form { public bool continuethreads = false; string[] proxylist = null; list<thread> threadlist = new list<thread>(); int proxynum = 0; public form1() { initializecomponent(); } private void button1_click(object sender, eventargs e) { int n = (int)numericupdown1.value; thread[] tl = new thread[n + 1]; threadlist = tl.tolist(); (int = 0; <= n; i++) { threadlist[i] = new thread(new threadstart(checkproxy)); } (int = 0; <= n; i++) { threadlist[i].start(); } continuethreads = true; proxylist = richtextbox1.lines; } public void ch

Visual Studio 2015 Community - Setup failed -

i have been trying install vs 2015 community past days, keep getting same error message. i - error message microsoft.net framework 4.6 - extended attributes inconsistent. microsoft visual studio services hub - user cancelled installation ii- computer description windows 8.1 pro x64-bit 8 gb ram thank help. to fix, turned off windows defender on windows 10. installing enterprise ed @ time. also, mine showing "extended attributes inconsistent" error after permission form pops up.

ios - jsonFile PHP server problems -

i trying server data dump table on iphone. flow standard server - php_interface - ios. trying echo json_encode(array) setup when doing wasnt able populate array, (with excellent stack users) switched setup , forwent json_encode(array) setup. realise need if ios connection. input @ end of current php code doesnt seem work. quite confident code on ios side working cuz build shows array isnt populating, , error message getting in xcode saying found 0 rows. please? current code (that trying work): $mysqli = mysqli_connect($dbhost, $dbuser, $dbpass, $dbname); $query = "select name, address, latitude, longitude locations"; $result = mysqli_query($mysqli, $query); if($result) { while ($row = mysqli_fetch_assoc($result)) { echo 'name: ' . $row['name'] . '<br />'; echo 'address: ' . $row['address'] . '<br>'; echo 'latitude: ' . $row['latitude'

javascript - Get HTML element with AngularJS -

i have form has input text , select using selectize.js . want access element entered in input , select via $scope , attribute ng-model , can't sent variables parameter function. when try access agencia , nome null. can me access elements? html <div class="form-group"> <h4>contatos</h4> <div ng-repeat="contato in contatos" class="form-group"> <label class="control-label col-sm-2">nome:</label> <div class="col-sm-10"> <input type="text" class="form-control" ng-model="contato.nome"> </div> <div class="form-group"> <h4>ag&ecirc;ncia</h4> <div class="control-group"> <select ng-model="contato.agencia" ng-options="agencia.nome agencia in listaagencias" class="demo-default" s

java - Get request out of onResponse -

i have method request using volley library public void get(string url) { // request string response provided url. stringrequest stringrequest = new stringrequest(request.method.get, url, new response.listener<string>() { @override public void onresponse(string response) { system.out.println("successfull response is: " + response); } }, createmyreqerrorlistener()) { @override public map<string, string> getheaders() throws authfailureerror { hashmap<string, string> headers = new hashmap<>(); headers.put(accept, accept_json); headers.put(auth_id, auth_id_value); headers.put(platform, platform_value); headers.put(cid, ""); system.out.println(headers.tostring()); return headers; } }; // add request requestqueue. queue.add

Generate SHA256 in c++ -

i need generate sha256 of data. found this example one. question can generate sha256 using own key. edit: first of all, sorry wrong question. don't mean change key used generate sha256. need that, convert following java code c++ public static string calculatehmac(string data, string key) throws exception { string result; try { // hmac_sha2 key raw key bytes secretkeyspec signingkey = new secretkeyspec(key.getbytes(), hmac_sha2_algorithm); // hmac_sha1 mac instance , initialize signing key mac sha256_hmac = mac.getinstance(hmac_sha2_algorithm); sha256_hmac.init(signingkey); // compute hmac on input data bytes byte[] rawhmac = sha256_hmac.dofinal(data.getbytes()); // base64-encode hmac stringbuilder sb = new stringbuilder(); char[] chararray = base64.encode(rawhmac); ( char : chararray){ sb.append(a); } result = sb.tostring(); } catch (exception e) { throw new signatureexce

Filter duplicates in file by using columns as parameters (grep linux) -

i looking pattern #type in set of files. output should return lines containing pattern. lines organized columns tab separator: <subject1> <#type> <object1> <subject2> <#type> <object1> <subject3> <#type> <object2> <subject4> <#type> <object2> <subject5> <#type> <object3> for purpose using command ack-grep : $ack-grep "#type" i can use sed as: sed -n -e "/#type/p;q" *.nt the problem duplicates should avoid objects . output should having: <subject1> <#type> <object1> <subject3> <#type> <object2> <subject5> <#type> <object3> why don't use old grep? should basically: grep '#type' *.nt to avoid duplicates in objectn part can use uniq --skip-fields option: grep '#type' *.nt | sort -k3,3 | uniq --skip-fields 2 however, output needs sorted before using uniq .

html - CSS nested div height 100% of screen instead of parent height -

i have div header fixed top of page nested div. div container has height of 70px, fixed height. i want nested div have height of 100% of screen, not of container div. this code: <div class="header"> <div class="nested">content</div> </div> my css: .header { height: 70px; width: 100%; background-color: #ccc; position: fixed; left: 0; top: 0; display: block; } .nested { display: block; position: absolute; top: 0; bottom: 0; left: 0; right: 0; margin: auto; overflow-x: visible; overflow-y: auto; background-color: #ddd; } how can nested div height of screen, not container? .header { height: 70px; width: 100%; background-color: #ccc; position: fixed; left: 0; top: 0; display: block; } .nested { display: block; position: relative; margin-top: 70px; height:100vh; background-color: #ddd; } fiddle: https

sql server - SQL wont import because the data will be truncated. How do get it to just cut the string off at 16 characters -

i need import .csv file sql server table. in table, 1 of columns of datatype varchar(16) , in .csv excel file, of entries in column 25 characters or more. need sql server cut string off @ 16 characters , import that. how this? have no idea how start code this i import table using anysql maestro import wizard by right clicking table clicking data management clicking import selecting .csv file type selecting columns .csv match columns in sql table clicking ok. if field in .csv right size, there no issue importing simple solution open .csv file excel. in excel keep first 16 characters , remove others (search left function) use sql server management studio import data excel file

Get IMSI Number of Android Dual SIM device -

i using android api public static string get_imsi_number(context context) { telephonymanager tel = (telephonymanager) context .getsystemservice(context.telephony_service); return tel.getsubscriberid(); } to imsi number. but unfortunately not getting imsi number if device dual sim , returning "null" always. i want imsi number of device( dual sim ) case 1: need read imsi numbers if device inserted 2 sims in it's 2 slots case 2 : need read imsi number if device inserted 1 sim in it's first slot , second slot left unused/blank case 3: need read imsi number if device inserted 1 sim in it's second slot , first slot left unused/blank i followed link " android : check whether phone dual sim " not worked. can 1 me sort out. note:the solution should work in android 4.0 , above versions , in vendors(samsung,motorola,htc,karbon etc). thanks in advance.

Entity Framework- Creating Index and ForeignKey name (Oracle) -

i have problem creating automatically names constraints , indexes. after length of constraint or index exceeds 30 characters name changed f.e: "fk_ot_personal_equi_1685080621" fortunately saw in method there parameter used name specific constraints , indexes. createtable( "otdba.ot_personal_equipment", c => new { equipment_id = c.decimal(nullable: false, precision: 10, scale: 0), active_time = c.decimal(nullable: false, precision: 19, scale: 0), show_mode = c.decimal(nullable: false, precision: 10, scale: 0), resource_id = c.decimal(nullable: false, precision: 10, scale: 0), }) .primarykey(t => t.equipment_id) .foreignkey("otdba.ot_resources", t => t.resource_id, cascadedelete: true,name: "fk_ot_equipment_resources") .index(t => t.resource_id);

android - How to hide actionbar while scrolling down a webview? -

i developing android app. in app there 1 webview fetches data internet , show user. actionbar consuming screen space. want hide actionbar while user scroll down in webview. have searched everywhere on internet not find proper way this. using appcompat actionbar , min sdk 10. you can use actionbar overlay mode . enable calling requestwindowfeature(window.feature_action_bar_overlay); before setcontentview() . , hide actionbar using getsupportactionbar().hide(); now scrolling event webview can follow answer in so edit: for hiding actionbar getsupportactionbar().hide(); for showing getsupportactionbar().show();

code generation - Add generated Python file as part of build -

i generating python files in setup.py part of build process. these files should part of installation. have added code generator pre-build step (by implementing own command , overriding default build include this). how copy generated files temporary directory build output? should copy myself using e.g. copy_file ? if so, how path build output? or should declare part of build somehow? i'd rather not clutter source directory tree generated files, hence prefer avoid copying files there , declaring them part of package. i solved subclassing build_py instead of build . turns out build_py has build_lib attribute path "build" directory. by looking @ source code think there no better way.

python - Make bokeh charts with interactive controls in django -

i have django application uses embedded bokeh visualizations. right using bokeh.embed.components function , template like: <body> {{the_div|safe}} {{the_script|safe}} </body> thanks this stackoverflow question . the thing need create more interactive visualizations, adding sliders, checkboxes , other controls. this example looks want, except couple of issues: i don't know how embed kind of object inside django. this way go, perhaps it's not. i'm little bit confused having use bokeh-server this. isn't there easy-to-use pure javascript solution? so, summarizing, know standard approach create dynamic chart interactions using django , bokeh. there 2 use cases: without server if can perform updates in js (don't need call actual python code), easy add interactions using customjs callbacks . there lots of examples @ link, basic simple code sample looks like: from bokeh.io import vform bokeh.models import customj

objective c - Data Transmission and Receivinge using RedPark L2DB9V SDK -

i using redpark sdk , serical cable l2-db9v communication between iphone , max 3232 board using max3232 usb digital converter. purpose have used demo app provided redpark understand functionality of sdk. sdk has " rscmgr class " in methods implemented communication purpose send , receive data example - (int) write:(uint8 *)data length:(uint32)length; - (int) read:(uint8 *)data length:(uint32)length; - (int) getreadbytesavailable; - (void) writedata:(nsdata *)data; delegate methods: - (void) cableconnected:(nsstring *)protocol; - (void) cabledisconnected; - (void) portstatuschanged; - (void) readbytesavailable:(uint32)length; in case, cable connection , disconnection methods have been called. sending data using: - (int) write:(uint8 *)data length:(uint32)length; and implemented loopback functionality receive data back. in case - (void) readbytesavailable:(uint32)length; should called not calling , unable find out cause. , there no way make sure data being

Regression in R with grouped variables -

the dependent variable value of data frame df predicted using independent variables mean , x , y in following way: df <- df %>% group_by(country, sex) %>% do({ mod = lm(value ~ mean + x + y, data = .) <- predict(mod, .) data.frame(., a) }) data grouped country , sex . so, fitting formula can expressed as: value(country, sex) = a0(country, sex) + a1(country, sex) mean + a2(country, sex) x + a3(country, sex) y however, want use formula: value(country, sex) = a0(country, sex) + a1(country, sex) mean + a2(country) x + a3(country) y where a2 , a3 independent of sex . how can it? i don't think can when grouping country , sex . group country , add interactions sex : df <- df %>% group_by(country) %>% do({ mod = lm(value ~ sex + mean*sex + x + y, data = .) <- predict(mod, .) data.frame(., a) }) or estimate model in 1 go adding interactions sex , country : mod <- lm(value

how to use curl in fatfree php -

i'm trying use or implement php curl in application i'm building using fatfree php framework. tried use curl in procedural code can't have working in fatfree. there plugin can use in fatfree subsitute php curl, or can me on how use curl in fatfree. first post on site, appreciate community.

google chrome - chromedriver on centos 6.5 can not run -

my os centos6.5 download chrome27 old version , can run succeeded google-chrome (google-chrome:8623): gtk-warning **: cannot open display: ) download chromedriver 2.10 version by https://code.google.com/p/chromedriver/issues/detail?id=361 setup chromedriver and run chromedriver (./chromedriver), show: /opt/google/chrome/google-chromedriver: /usr/lib64/libstdc++.so.6: version `glibcxx_3.4.15' not found (required /opt/google/chrome/google-chromedriver) what should do? if issue error -> "gtk: cannot open display" means can not find display attached device if have connected display can export address. 0.0 command "export display=:0.0" if doesn't work try changing 0.0 0 can find display , start on gui.

osx - case sensitivity when running OS X app from terminal -

i've noticed when run application terminal stating direct path, depends on case sensitivity. i've found out when macos written in lower case, fails run due lack plist file, can bee seen below : [13:37 zzz ~/ ] /applications/notes.app/contents/macos/notes 2015-07-23 13:37:34.924 notes[1205:12990] no info.plist file in application bundle or no nsprincipalclass in info.plist file, exiting whereas correct case manage run application. [13:37 zzz ~/ ]$ /applications/notes.app/contents/macos/notes can tell me reason behavior ? thanks actually, consequence of formatting of hard drive you're using. if hard drive (or ssd) had "case-sensitive" formatting, that's why need explicit macos instead of macos . if had formatted hard drive "journaled", away using caps. more information can found here , here .

android.support.v7.widget.RecyclerView null ? with LinearLayoutManager -

i'm trying view recycled objects add, have problems not understand. searched internet, , due not set "linearlayoutmanager" i not know error : error : 07-23 06:35:00.321 24842-24842/xxx.xxx.xxx.xxxe/androidruntime﹕ fatal exception: main java.lang.nullpointerexception @ android.support.v7.widget.recyclerview.onmeasure(recyclerview.java:1694) code , fragment2 extends fragment {} @override public view oncreateview(layoutinflater inflater, viewgroup container, bundle savedinstancestate) { // inflate layout fragment init(inflater.inflate(r.layout.fragment_fragment2, container, false)); return inflater.inflate(r.layout.fragment_fragment2, container, false); } public void init(view v){ arraylist<pusheen> pusheens = new arraylist<>(); pusheen pusheen = new pusheen(); pusheen.setid(1); pusheen.setname("pusheen"); pusheen.setpastime("blogger&q

python - Why is my dictionary empty? -

newbie question again. i'm getting pairs of information several url, bs4 &urllib create list of list of list of pair. e.g : pair couple (name,value) e.g : list of pairs 1 url e.g : list of list of pairs able classify got in dictionary. a list of list of pairs should : list_of_list_of_pairs = [ [ [a,1],[c,2],[e,3] ], [ [g,4],[r,6] ... ], ... ] here code i'm using : from bs4 import beautifulsoup import csv import urllib.request collections import * def parse_csv(content, delimiter = ';'): ##we use here ";" parse csv because of european way of dealing excel-csv csv_data = [] line in content.split('\n'): csv_data.append( [x.strip() x in line.split( delimiter )] ) # strips spaces return csv_data list_of_list_of_pairs=[] list_of_pairs=[] list_url=parse_csv(open('url.csv','ru').read()) in range(0,len(list_url)) : url=str(list_url[i][0]) ## read url array coming url-csv page=urllib.request.urlopen(