Posts

Showing posts from January, 2015

java - Encrypt and Decrypt a String with RSA -

i new bee java security , crypto. below code not return me correct decryption. also please let me know recommendation using algorithm make strong key. below code has 2 methods 1 encryption string , other decryption. public class testsecuritydiscussions { public static byte[] encryptdata(keypair keys){ string rawdata = "hi how you>?"; cipher cipher = cipher.getinstance("rsa"); try { cipher.init(cipher.encrypt_mode, keys.getpublic()); } catch (exception e) { // todo auto-generated catch block e.printstacktrace(); } byte[] encrypted = cipher.dofinal(rawdata.getbytes()); return encrypted; } public static string decryptdata(byte[] encrypted,keypair keys) { cipher cipher = cipher.getinstance("rsa"); try { cipher.init(cipher.decrypt_mode, keys.getprivat

asp.net mvc 3 - Show error message with alert box -

i show error message alert box in asp.net mvc3 razor. used dataanootation model. please see below. <required(errormessage:="name required")> _ public name string in client side. @html.textboxfor(function(model) model.content) @html.validationmessagefor(function(model) model.content, "please type name") @html.validationsummary() but error message show label beside of textbox. want show alert box error message. all. <script type="text/javascript"> @if (!viewcontext.viewdata.modelstate.isvalid) { var sb = new stringbuilder(); foreach (var modelstate in viewcontext.viewdata.modelstate.values) { foreach (var error in modelstate.errors) { sb.append(error.errormessage); } } @:alert('@sb.tostring()'); } </script>

Google Custom Search API- Get results specific user location -

as in normal google search page, google returns me results specific location. considering/assuming this, gets ip address request, find uses location , returns results. i writing proxy server search engines. user browser requests search terms , server returns search results. i curious know, if custom search api can such results based on ip address provide or that, can mock user location in proxy server , pretend google custom search user , location specific results ps.i new search engine api world, please understand me. yes, can, country, not exact location. here docs parameters of query request: https://developers.google.com/custom-search/json-api/v1/reference/cse/list @ 'gl' parameter. i'm not aware of way specify location more precisely this.

javascript - when i copy my html file in jsp and css file then my page design change -

i working on project.initially worked in dreamweaver , created html files , css project interface. when run index.html , in case of single folder contain html files , css run no change in design , every div in proper place , using neatbean , tomcat run project in java purpose when copy html file code in jsp along css , after deployment when run index.jsp design got changed , mixed each other example menu , header mixed each other , page design corrupted. 1 tell me how can fix it. maybe because open new file project, , copy code of html,css directly, if have open new project in netbeans example default folder of project in c:\users\nameuser\documents\netbeansprojects if case, change project folder html one

javascript - I want to addEventListener on php variable -

i want addeventlistener on variable $html_tab when clicked go www.google.com $html_tab .= '<td align="center" valign="middle">'. $row['numeunitate'] . '</td>'; echo "<script language='javascript'> window.addeventlistener('click', function() { var location.href = 'http://www.google.com'; }); </script>"; ok, after i've seen error, understand question. var location.href = 'http://www.google.com'; don't use keywort var in here. work. otherwise browser thinks, want declare new variable! so, write only location.href = 'http://www.google.com';

c# - Azure Entity Framework connection string failing -

everything works great when run project locally, when deploy azure following error. "code generated using t4 templates database first , model first development may not work correctly if used in code first mode. continue using database first or model first ensure entity framework connection string specified in config file of executing application. use these classes, generated database first or model first, code first add additional configuration using attributes or dbmodelbuilder api , remove code throws exception." my connection string is: add name="lifeentities" connectionstring="server=tcp:abc000000ab.database.windows.net,1433;database=life;user id=myid@abc000000ab;password=mypw;trusted_connection=false;encrypt=true;connection timeout=30;" providername="system.data.sqlclient" i'm getting error when code tries open context of entity framework database. note, i'm using pretty basic mvc project template asp.net identity well.

php - multiple attribute form output -

i have had made number of changes below program stumped on last task- need multiple attribute pull multiple 'teams' data (points,goal difference etc) php form. can single teams work not multiple. see screen attached , heres code below. ![enter image description here][1] <html> <head> <style> .red {color: red} </style> <title>table</title> </head> <body> <?php if ($_server["request_method"] == "post" ){ $tablespage = "http://www.bbc.com/sport/football/tables"; if(!empty($_post["team"])){ $teamdata= getteamdata($_post["team"] , $tablespage); //get associative array of team data if(!empty($_post["data"]) && $_post["data"] == "results"){ echo getresults($teamdata); } else if(!empty($_post["data"]) && $_post["data"] == "position&q

PHP Accessing variables stored in an object in a class -

i have dived in php objects , trying set/get properties. i think understanding getters , setters , magic methods, @ least pros conns of using them. (i'm using magic method right now, have less code maintain while learn, , not sure how many bits of info need store user) i have $_userdata object set of properties. loggedin (true false) firstname(firstname of user) lastname (lastname of user) ....and others i having problems setting , getting values require_once('facebook/facebook.php'); // require facebook sdk require_once('config.class.php'); // require config class require_once('dbconn.class.php'); //require database connector class user{ public $_userdata; // holds information of our user private $conn; // our database connection public $facebook; // facebook sdk public $fbuser; // facebook user //constructor public function __construct(array $properties=array()) { $this->conn = dbconn::getinstance(); //get db

node.js - Auto-increment in Native MongoDB -

yeah, might here thinking "this rather duplicated question", might indeed, after couple hours searching answer of problem, fail find 1 single answer solve problems, , honest of people asked same thing. i'm gonna try make different question, here goes. has manage port function below described in mongo doco mongodb native driver? i'm using nodejs , i'm having hard time trying port it's native driver. function insertdocument(doc, targetcollection) { while (1) { var cursor = targetcollection.find( {}, { _id: 1 } ).sort( { _id: -1 } ).limit(1); var seq = cursor.hasnext() ? cursor.next()._id + 1 : 1; doc._id = seq; targetcollection.insert(doc); var err = db.getlasterrorobj(); if( err && err.code ) { if( err.code == 11000 /* dup key */ ) continue; else print( "unexpected error inserting data: " + tojson( err ) ); }

javascript - fadeIn() / fadeOut() animation not playing -

below have piece of code use filter products using drop-down menu. content of #child_cat division changes based on value attribute of anchor tag: $('#brandsort').change(function(){ $('#child_cat a').fadeout(500); $('[value="' + $(this).val() + '"]').fadein(); if ($('#brandsort option:selected').text() === "") { $('#child_cat a').fadein(500); } }); the code filter out products not match option value, won't play animation. right now, acts more delayed .show() / .hide() function anything. please enlighten me wrongdoing in code or possibly doing wrong aside that. edit: i know people on hands-on 1 of you, in case asking "enlightenment". verbal input of have been doing wrong. to fulfill request of providing html, you'll find here: http://jsfiddle.net/hjpn8/3/ there few mistakes in logic made not work. firstly, reason couldn't see fade animate happen becaus

java - JPA persist many to many Fetch=FetchType.Lazy -

i have pretty standard scenario whereby have table of employe , table of unite ewith . 2 tables related via many many relationship (ie. emoloye can have many unite , unite can applied many employe) , subsequently have joining table called effectif_unite. 2 columns . have generated entity classes (see below) , have no problem persisting data employe , unite tables have failed miserably persist employe_has_unite . // method en application client public void add(int mat, string grade, string fonction, int cnprs, int cin, string np, string adress, string tel, int disp, date date, arraylist uns) { employe emp = new employe(); grade gr = bean.grade_emp(grade); fonction f = bean.fonction_emp(fonction); emp.setmatemp(mat); emp.setnumgrd(gr.getnumgrd()); emp.setnumfon(f.getnumfon()); emp.setcnprs(cnprs); emp.setcin(cin); emp.setadress(adress); emp.settel(tel); emp.setnp(np); emp.setdispo(disp); emp.setdtrt(date); emp.setunitelist(

php - Unable to see the uploaded file on Google drive -

i using php , service account connect , upload test file google drive. not give me error when login using account google drive , check file. dont find it. why? please help. i've used following code: <!doctype html> <html> <head> </head> <body> <?php set_include_path( get_include_path() . path_separator . 'google-api-php-client-master/src' ); require_once 'google-api-php-client-master/src/google/client.php'; require_once 'google-api-php-client-master/src/google/service/drive.php'; require_once "google-api-php-client-master/src/google/service/oauth2.php"; session_start(); $drive_scope = 'https://www.googleapis.com/auth/drive'; $service_account_email = '<xyz>@developer.gserviceaccount.com'; $service_account_pkcs12_file_path = '<abc>-privatekey.p12'; $key = file_get_contents($service_account_pkcs12_file_path); $auth = new google_auth_assertioncredentials(

c# - How does a cache actually store data in the "offset"? -

so computer architecture class have simulate cache/memory relationship on c# , i'm not sure how cache stores data. concept of cache tag, don't offset. so have ram holds 256 32bit integers. want have caching system have cache holds 8 32bit integers. in 32bit integers in cache need add tag , valid bit, makes sized down 26 bits or so. how can store 32 bit data in remaining 26 bits? here code have right now, it's still work in progress class memory { public list<uint32> instructions = new list<uint32>(); const int directcachesize = 8; ulong[] directcache = new ulong[directcachesize]; private int[] stack = new int[256]; public int this[int i] { { int directmapindex = % directcachesize; if (directcache[directmapindex] == convert.touint64(stack[i])) { return convert.toint32(directcache[directmapindex] - 18446744069414584320); } else

node.js - NodeJS stream response to prevent out of memory errors -

i have following code: response.writehead(200 , { 'content-type': 'application/vnd.ms-excel', 'content-encoding': 'gzip', "content-disposition": "attachment; filename="+getfilename() }); var zlib = require("zlib"); var data = getdata(); //some arbitrary data method var outputstr = ""; var header = "some header"; var footer = "some footer"; outputstr+= header; for(i=0;i<data.length;i++) { outputstr+= data[i].utils.generatestring(); //xml parser , various whatnots resulting in string } outputstr+= footer; zlib.gzip(outputstr, function(err, result) { response.end(result); //works on small strings }) sometimes, string length exceeds 512mb limit (which fine), thus, on 32 bit system, i'll get: fatal error: call_and_retry_0 allocation failed - process out of memory i've been reading streams, examples talk abour reading files, rather generated values. how can

java - How to populate H2 in-memory DB from a file (populate.sql)? -

i want add h2 in-memory db spring mvc application. orm i’m using hibernate. here configs: [hibernate.cfg.xml] <?xml version="1.0" encoding="utf-8"?> <!doctype hibernate-configuration public "-//hibernate/hibernate configuration dtd 3.0//en" "http://www.hibernate.org/dtd/hibernate-configuration-3.0.dtd"> <hibernate-configuration> <session-factory> <property name="hibernate.connection.driver_class">org.h2.driver</property> <property name="hibernate.connection.url">jdbc:h2:~/mydb</property> <property name="hibernate.dialect">org.hibernate.dialect.h2dialect</property> <property name="hibernate.connection.username">sa</property> <property name="hibernate.connection.password">qwerty</property> <property name="show_sql">true</p

mysql - pairing dates under same column in my sql -

how pair dates under same column in sql? table looks this: id | user | type | date ---+------------+-------------+------------- 1 | 1 | login | 2014-03-19 15:41:52 2 | 1 | login | 2014-03-19 19:41:52 3 | 1 | logout | 2014-03-19 21:41:52 4 | 2 | login | 2014-03-20 19:41:52 5 | 2 | logout | 2014-03-20 20:41:52 6 | 3 | login | 2014-03-21 19:41:52 7 | 4 | login | 2014-03-21 19:42:52 8 | 4 | logout | 2014-03-21 21:41:52 10 | 5 | login | 2014-03-19 21:45:52 11 | 5 | login | 2014-03-19 21:46:52 12 | 3 | logout | 2014-03-19 21:51:52 13 | 5 | logout | 2014-03-19 22:41:52 the aim pair 1 login 1 logout. in example user 1 has 2 logins , 1 logout. the first login should disregarded, , recent login should paired minimum logout: pairing login id=2 , logout id=3 something may

javascript - jQuery hide validation errors on dropdown change -

i have form shows additional fields based on selected option is. when form validated (with error), error message appears under additional field has been shown. that's expected behaviour. if select different option, old option input hides (expected) old validation error message remains. how can hide validation error message? form code: <div class="row"> <section class="col col-12"> <label class="label">type</label> <label class="select"> <select id="type" name="type"> <option value="" selected>select cancelation type</option> <option value="c1">cancel , keep payments</option> <option value="c2">cancel , issue deposit refund</option> <option value="c3">cancel , issue partial refund</option> <option value="c4">cancel , issu

android - making an already existing app paid -

i have free app in android play store. want give user 2 options. 1 free , other paid paid app has no advertisements , other feature enhancements is there way in android? well, in different ways. as @ken wolf said add system in exists app let user pay remove ads same application have without need install different version. system have 1 apk , should check if user has paid application if yes enable pro features , disable ads. or, if want create 2 different versions create basic application , "pro" , using library project keep unique code shared between 2 versions. and, of course code of "pro" features in pro apk version... same resources, layouts, drawable etc. other answers found you: best approach free , paid versions of android application? best way have paid , free version of android app

filter vertices on number of outgoing edges in gremlin titan in java -

i want query , filter vertices more 500 outgoing edges in titan using gremlin in java...how do this?i have started off below pipe=pipe.start(graph.getvertices()); you need filter function p.start( g.getvertices() .filter(new pipefunction<vertex,boolean>() { public boolean compute(vertex v) { // write logic here count edges on vertex , // return true if on 500 , false otherwise })); using gremlinpipeline in java described more here

javascript - How to make dropdownlist editable? -

i need develop application need have dropdownlist able type in data further added database table. cannot use third party controls though. can use jquery/javascript , if can how? thank you since tagged jquery, i'll assume jquery ui not out of question. autocomplete running combobox should want. example taken page linked to. <!doctype html> <html lang="en"> <head> <meta charset="utf-8"> <title>jquery ui autocomplete - combobox</title> <link rel="stylesheet" href="//code.jquery.com/ui/1.10.4/themes/smoothness/jquery-ui.css"> <script src="//code.jquery.com/jquery-1.9.1.js"></script> <script src="//code.jquery.com/ui/1.10.4/jquery-ui.js"></script> <link rel="stylesheet" href="/resources/demos/style.css"> <style> .custom-combobox { position: relative; display: inline-block; } .custom-combobox-toggle { position: a

contentpane - Java getContentPane() NullPointerException on JFormatterTextField -

i trying create jformatted text field, when try add it, nullpointerexception gets thrown @ me. checked if stuff in correct order or if isn't null, doesn't seem so. might wrong though. here block of code public static void showtopic(string path) throws ioexception{ path = "topics/"+path+".txt"; system.out.println(path); string[] topicfile = login.readfile(path); int b = login.readlines(path); topic.main(null); jformattedtextfield formattedtextfield = new jformattedtextfield(); formattedtextfield.seteditable(false); formattedtextfield.setbounds(50, 50, 100, 100); (int i=0;i<b;i++) formattedtextfield.settext(topicfile[i]); topic.contentframe.getcontentpane().add(formattedtextfield); } and window frame import java.awt.eventqueue; public class topic { static jframe contentframe; /** * launch application. */ public static void main(string[] args) { eventqueue.in

how to store a huge string (length 50000) in mysql using python -

how store huge string (length 50000) in mysql using python. have big string of length 50000 .i have store mysql. suggested store string blob or text type. can me how convert string blob type def main(): stringkey='' stringvalues='' keys=ccv.keys() //ccv dictionary data structure vectors=ccv.values() //ccv dictionary data structure key in keys: stringkey='#'.join(key key in keys) value in vectors: stringvalues='$'.join(str(value) value in vectors) insert(stringkey,stringvalues) print 'insert successful' def insert(k,v): db = mysql.connector.connect(user='root', password='abhi', host='localhost', database='cbir') sql= 'insert ccv(key,vector) values(%s,%s)' args = (k,v) cursor=db.cursor() cursor.execute(sql,args) db.commit() db.close() error: p

C - separating name and surname using comma with strtok -

i have problem strtok. i'm trying separate first name last name using comma. when try using scanf , type "vincent,van gogh", returns vincent first name, last name returns van. however, when use preset string, shows last name van gogh. printf("enter name , surname: "); char name[100];// = "vincent,van gogh"; char firstname [100]; char lastname [100]; char* token; scanf("%s", &name); token = strtok(name, ","); strcpy(firstname, token); token = strtok(null, ","); strcpy(lastname, token); puts(firstname); puts(lastname); is there i'm missing in order make user input work?

How to join with three tables with multiple conditions? -

i want join 3 tables multiple conditions. below table structure , expected result users_id users_first_name 1 rocky 2 james 3 john meeting_details_id meeting_title users_id meeting_lead close_meeting (no) 1 newmeet 3 1 no 2 testmeet 2 2 no attended_meetings project_meeting_attendeeid meeting_details_id users_id access_type (attendee) 1 1 2 attendee expected output: query should check if meeting attended or users meeting lead meeting_title creator meeting_lead close_meeting (no) newmeet john rocky no testmeet james james no try this: select m.meeting_title,u1.users_first_name creator,u2.users_first_name meeting_lead,m.close_meeting meetingtable m left outer join u

Place divs around a centered div in CSS -

i have 3 divs. 'middle' div needs centered in containing element (a seperate div width of page, basically) while other 2 divs should on either side of 'middle' div. here i've tried far, can see, if left , right divs aren't in width, push 'middle' div off center. <div class='cont'> <div class='name2'>the man 6 fingers</div> <div class='vs'>vs.</div> <div class='name1'>i. montoya</div> </div> .cont{ position:fixed; top:0px; width:100%; background-color:red; text-align:center; } .cont >div{ display:inline-block; } http://jsfiddle.net/7tlsa/ the solution needs work in webkit since in mobile app. i adjusted widths, min-width, , white space tweak responsiveness. you're looking for? see demo .name1, .name2 { width:30%; min-width:160px; white-space:nowrap; }

vb.net - how to edit/delete records in a datagridview? -

i'm using code deleting of records in datagridview using vb.net , sql -12 private sub delete_click(byval sender object, byval e eventargs) handles delete.click if messagebox.show("delete item?", "delete!", messageboxbuttons.yesno, messageboxicon.warning) = windows.forms.dialogresult.yes me.datagridview.rows.removeat(me.datagridview.currentrow.) else datagridview.update() end if end sub when i'm using this, record gets deleted temporarily not permanently database. how should delete records permanently? same case when i'm editing field. it's temporary. then set deletecommand sqldataadapter. code depends on table's keyid name , type, among other things. dim connection sqlconnection dim adapter sqldataadapter = new sqldataadapter() ... (here wrote dataadapter fill code) ... dim cmddelete new sqlcommand("delete customers keyid = @keyid", connection) cmddelete.parameters.add("@keyid",

Android: Control input in EditText -

i want control input in edittext. if null show text message "null" , if not null show "not null". used code below not work me. edittext edittext = (edittext) findviewbyid(r.id.edittext1); string aa=edittext.tostring(); if("".equalsignorecase(aa)==false) toast.maketext(getapplicationcontext(), "champs non vide", toast.length_long).show(); else toast.maketext(getapplicationcontext(), "champs vide", toast.length_long).show(); also used nothing. edittext edittext = (edittext) findviewbyid(r.id.edittext1); string aa=edittext.tostring(); if(aa!=null) toast.maketext(getapplicationcontext(), "champs non vide", toast.length_long).show(); else toast.maketext(getapplicationcontext(), "champs vide", toast.length_long).show(); how can ? in advance help. to check edittext i

c# - Entity Framework Check virtual Lists after disposing of ObjectContext -

my scenario have object foo has virtual list<bar> property on it. being auto generated ef. after load foo dispose of data context, turning foo business object through dto. example var newfoo = foo_dto.change(foo); inside of foo_dto.change want check if virtual list property empty/null. i understand closing objectcontext , checking navigation property throw error . in data layer there times when return foo list , foo without list. my question how check navigation property see if list has been populated or not , avoid objectcontext error generating thank much!! edit from comments section, purposely want context closed before check see if loaded list<bar> property. no, can't, other ugly way of trying , catching exception. can determine whether collection loaded getting owner's dbentityentry , can obtain through context instance. but if know front collection may addressed outside scope of context, need load while context alive, or no

php - Parse error: syntax error, unexpected ';', expecting identifier (T_STRING) or variable (T_VARIABLE) -

i have problem code. (i've looked solution didn't found anything, thats why i'm posting topic) error: parse error: syntax error, unexpected ';', expecting identifier (t_string) or variable (t_variable) or '{' or '$' in xxxxxx on line 13 line 13: echo $view->;htmlerror(); my code: <?php require_once 'classes/view.php'; echo db_hostname; //output: hostname $view = new view(); if ($htmlstring = $view->tablethreads()) { echo $htmlstring; } else { echo $view->;htmlerror(); } echo $view->buttonpostthread(); ?> view.php // need class db make object require_once 'database.php'; //we'll need recaptcha helper later require_once 'helpers/recaptcha.php'; class view{ private $db; function __construct() { $this->db = new database(); } function tablethreads() { $content = ""; if (($threads = $this->db->getthreads())

Neo4j-Store and retrieve images with cypher queries -

what best way store images (binary arrays) in neo4j? stored them binary arrays how can retrieve them cypher queries? have query in picture has been stored binary arrays, seems there exception. match (n:`employees`) employeeid='1' return n.picture this full stack trace: (image size 12kb) org.neo4j.rest.graphdb.restresultexception: unhandled array type: class [b @ unsupportedoperationexception org.neo4j.server.helpers.propertytypedispatcher.dispatcharray(propertytypedispatcher.java:720) org.neo4j.server.helpers.propertytypedispatcher.dispatchnumberarray(propertytypedispatcher.java:715) org.neo4j.server.helpers.propertytypedispatcher.dispatchbytearrayproperty(propertytypedispatcher.java:675) org.neo4j.server.helpers.propertytypedispatcher.dispatchbytearrayproperty(propertytypedispatcher.java:280) org.neo4j.server.helpers.propertytypedispatcher.dispatchprimitivearray(propertytypedispatcher.java:135) org.neo4j.server.helpers.propertytypedispatcher.dispatc

javascript - Selection of variant based on probabilities -

sorry not english. new theme me (i mean speak first time using english :) can make mistakes). so problem. i have, example 3 variants. probabilities : 0.5, 0.2, 0.3 example. how can choose variant choose right now? think can this way: create interval [0; 1]. separate smaller intervals (3 in example). [0; 0.5), [0.5, 0.7), [0.7, 1]. generate random number 0 1 (float, double) detect interval number belongs to for example 0.3 generated, 1st interval, first variant. is right approach? how code using javascript or @ least show pseudo code. p.s.: have dynamic amount of variants every time. thank you. it right approach , can working this: var rand = math.random(); if (rand < 0.5) { // first variant } else if (rand < 0.7) { // second variant } else { // third variant } you don't need completly specify intervals in conditions because math.random() generates real numbers interval [0,1]. for dynamic amount of variants can create arra

Ruby on Rails login opportunities -

i new ruby on rails. want know login opportunies available. simple 1 is: - email , password (plaintext) i know not best idea, know one. can tell me can choose/do else ? (encoding/encrypting - authification etc.) authlogic gem into. when first got started rails easier me understand devise, , looking think helped me understand how rails works overall.

r - preprocess center and scale produces an error -

from caret package i have vector library(caret) a<-c(-1,1-1,3,2,-2,-1,5,2,3,-3) i preprocess center , scale above vector, have tried vector, data.frame , matrix. doing using preprocess function not manually taking mean end substracting data etc. missing something? #preprocess(a, method = c("center", "scale")) #error en apply(x, 2, mean, na.rm = na.remove) : #dim(x) must have positive length thank data frame works library(caret) test <- preprocess(data.frame(a = c(-1,1-1,3,2,-2,-1,5,2,3,-3))) predict(test, data.frame(a = c(-1,1-1,3,2,-2,-1,5,2,3,-3))) # #1 -0.6994725 #2 -0.3108767 #3 0.8549108 #4 0.4663150 #5 -1.0880683 #6 -0.6994725 #7 1.6321024 #8 0.4663150 #9 0.8549108 #10 -1.4766641

css3 - CSS Card Flip backface background color not visible on first flip -

i'm trying standard 3d card flip. however, background of backside "card" not showing until open developer tools or flip card again. here's codepen have it. http://codepen.io/spidy88/pen/hsfjc i've looked @ simple example , part code identical. tried changing front face , face absolute sizes issue still occuring. http://desandro.github.io/3dtransforms/docs/card-flip.html after couple hours of playing around, took adding empty div. should note issue found , tested on google chrome 33.0.1750.154. not sure previous or future versions.

ubuntu - Gitlab push origin master -

i have new version of gitlab installed nginx. can access front end no problem, can create users/add keys, , create projects. after creating first project attempted follow directions on project page, keep getting error. have checked logs , can't find relevant: git push -u origin master returns /home/git/gitlab-shell/lib/gitlab_net.rb:71:in `get': undefined method `request_uri' #<uri::generic:0x00000001ca76b8> (nomethoderror) /home/git/gitlab-shell/lib/gitlab_net.rb:31:in `allowed?' /home/git/gitlab-shell/lib/gitlab_shell.rb:59:in `validate_access' /home/git/gitlab-shell/lib/gitlab_shell.rb:23:in `exec' /home/git/gitlab-shell/bin/gitlab-shell:16:in `<main>' fatal: not read remote repository. please make sure have correct access rights and repository exists. as per other found online tried: ssh git@myhost and get: pty allocation request failed on channel 0 /home/git/gitlab-shell/lib/gitlab_net.rb:71:in `get':

haskell - Defining fmap for a binary search tree -

i'm working through exercises in book "beginning haskell." exercise 4-8 make binary search tree instance of functor , define fmap. tree looks like: data binarytree = node (binarytree a) (binarytree a) | leaf deriving show because search tree, operations on tree must maintain invariant values in left subtree < node's value , values in right subtree > node's value. means values in tree must ordinal ( ord => binarytree a ). two questions: since fmap :: (a -> b) -> binarytree -> binarytree b , how enforce b ordinal? if didn't have functor, fmapord :: (ord a, ord b) => (a -> b) -> binarytree -> binarytree b , functor typeclass doesn't enforce ord contraints. what efficient implementation like? first thought fold on tree, , build new tree out of mapped values. unfortunately, didn't far because of (1). the point of functor s , fmap works a , b can stored in data s

c# - Why an identifier is expected while declaring a delegate? -

when create delegate in c#, point function definite signature (parameter set), asks specify identifier each type. public delegate void mydelegate(int x, int y); if try write prototype declaration as: public delegate void mydelegate(int, int) it shows compile time error saying identifier expected . but according me, when specifying prototype method, why compiler needs identifier distinguish between 2 methods different signature: public delegate void firstdelegate(int); and public delegate void seconddelegate(int, int); are sufficient , clear declaration distinguish between them. think so i think people got me?? it can make difference @ point of invocation. example: using system; class test { delegate void foo(int x, int y); static void main() { foo foo = (x, y) => console.writeline("x={0}, y={1}", x, y); foo(x: 5, y: 10); foo(y: 10, x: 5); } } the output x=5, y=10 both lines, because argum

android - how to get an URI from a Bundle? -

i got intent takes photo, after taking photo bundle with this.imagen = imagereturnedintent; this.lol = imagen.getextras(); i got "extra" on bundle, need in uri because after getting "data" send asyntask: uploaddatabaseasynctask async = new uploaddatabaseasynctask(); async.execute(data); // "data" should uri edit: tried uri data null intent.getdata();

wpf - Error in references -

i not sure why there error in references. oxyplot.wpf.lineseries oxyplot.series.series best overloaded method match system.collections.objectmodel.collection.add(oxyplot.axes.axis) has invalid arguments. using system; using system.collections.generic; using system.linq; using system.text; using system.threading.tasks; using oxyplot; using oxyplot.wpf; using oxyplot.axes; namespace points { public class psdtest { public static plotmodel filteringinvalidpoints() { var plotmodel1 = new plotmodel(); plotmodel1.title = "filtering invalid points"; var linearaxis1 = new linearaxis(); linearaxis1.position = axisposition.bottom; linearaxis1.title = "x-axis"; plotmodel1.axes.add(linearaxis1); var linearaxis2 = new linearaxis(); linearaxis2.title = "y-axis"; plotmodel1.axes.add(linearaxis2); var lineseries1 = new lineseries();

javascript - HTML5 Video - position of clicks -

okay, want user able click on particular area of video , x happens, otherwise nothing happens, pure javascript, not jquery... i've got: document.getelementbyid('videoele').addeventlistener('click',handleclick,false); function handleclick() { if(video.currenttime > 24.5 && video.currenttime < 29) { console.log("good timed click: " + video.currenttime); } else { console.log(video.currenttime); } } there's things intend change src of video if click in right time , right position, can't find on positional clicking on html5 video element. possible yet? i using customised buttons, not should make difference. thanks in advance! try using this: videoelement = document.getelementbyid("videoele"); videoelement.addeventlistener("mousedown", handleclick, false); handleclick = function(e) { if(videoelement.currenttime > 24.5 && videoelement.currenttime < 29)

how to get ringer mode in android application -

iam making application changes silent mode ringer mode if specific user call. application convert silent normal or normal silent. main question how can previous state(ringer mode)??... previous mean state before convert mode because need state when idle ... plz me visit ringer mode change listener broadcast receiver? ? use audiomanager.getringermode() before changing it.

asp.net - PhantomJS as web job in Azure -

i have deployed asp.net mvc website in azure , trying deploy phantomjs web job support web site. have uploaded zip file necessary dependencies run phantomjs , web job starts after running batch file. log reports server , running @ 127.0.0.1:8080 . when try hit phantomjs app @ url 127.0.0.1:8080 azure site hosted under someproject.azurewebsites.net times out no other error message. specifically trying deploy phantomjs application hosts web endpoint ( https://github.com/thelgevold/phantomsnapshot ) enable me convert web pages pdf if pass url website phantomjs process. the website pass url phantomjs respond pdf file can downloaded. have working outside of azure, curious if phantomjs process can hosted web job does know if possible deploy phantomjs in manner? running site under "free" configuration. phantomjs not working on azure webjobs. i tried execute through cmd shell [yoursite].scm.azurewebsites.net/debugconsole , hanges when call raserize.js script.

java - Hanoi Towers, working but not supposed to -

so have classical hanoi problem, im getting recursion thing, , doozie! functioning, don't understand how be! i've understood it, n, print "from + " going " + thru", happen each time n approaches 1. 1 think @ n=1, code stop, , yet printouts of "thru + " going " + to" (last printout). if n=1 terminating condition, how can possibly last part of code "for free?". i expected code @ least execute last printout on every iteration, no! also, examples of include 2 recursive calls, works fine one! hell going on? how code execute, step step? have misunderstood basic fact recursive methods? (compiled on eclipse compiler). public static void hanoi(char from, char to, char thru, int n) { if (n==1) { system.out.println(from + " going " + to); } else { system.out.println (from + " going " + thru); hanoi(from, to, thru, n-1); system.out.println (thru + " going " + to); } } have misund

Copy db table from one server to another server using groovy -

is there easy way query data 1 server (select * table_abc) , insert result different server (insert table_abc) ? both server using eg. db2, oracle etc. , tables containing various datatyps (varchar, varchar bitdata, binary blobs etc.) cheers lza here worked me... import groovy.sql.sql // establish connections //progress openedge db connection def db1 = [url:'jdbc:datadirect:openedge://yourservername:20007; databasename=demo;', user:'user1', password:'', driver:'com.ddtek.jdbc.openedge.openedgedriver'] def sql1 = sql.newinstance(db1.url, db1.user, db1.password, db1.driver) //sql connection (on local machine) def db2 = [url:'jdbc:sqlserver://localhost;databasename=test;', user:'sa', password:'abc123', driver:'com.microsoft.sqlserver.jdbc.sqlserverdriver'] def sql2 = sql.newinstance(db2.url, db2.user, db2.password, db2.driver) // delete stale data in table 'newpersons' sql2.execute(

io:format with multiple variables - Erlang -

i trying use following multiple parameters: io:format("message number ~s: blah, blah", [mynum]) i tried: io:format("message number ~s: ~s", [mynum, mymessage]) but doesn't work. possible erlang? cannot seem find examples of how this. try: io:format("message number ~p: ~p", [mynum, mymessage]) if mynum or message not strings/atoms, need use ~p

python - Get path of process file -

i'm trying program needs catch full path of files being used (anywhere in system) straight example. opened file called "notify.py" whichis in /home/miguel/dropbox/prog/python/notify/ directory. when call ps aux in linux shell, process line corresponding file's process is miguel 11798 0.7 0.4 512320 34176 pts/2 sl 22:41 0:06 gedit notify.py which doesn't path of file opened! wanted (and have been looking hours, using ps, lsof or python's psutil) way full path of file corresponding process, is, i'd like, process, directory line referenced above. thanks answers you might try readlink(2) file /proc/<pid>/exe , should want: $ ls -l /proc/$$/exe lrwxrwxrwx 1 aw aw 0 apr 7 00:02 /proc/11700/exe -> /bin/zsh $ but note not overly portable. should work on linux , @ least freebsd, might fail on other unices. that's reason why e.g. sshd want's called full path, sufficient take $0 (or argv[0] or whate

python - Building an array in a loop -

i writing python program imports 1000s of data point in blocks of 10 points @ time. each block of 10 data points maximum set found, program loops next 10 data points , continues. of works fine, need build array hold maximum data point created once per loop, can plot them later. how can create array within loop, here have: for count in range(self.files/self.block_length): rss = scipy.fromfile(self.hfile2, dtype=self.datatype, count=self.block_length) maxrss = np.max(rss)#takes greatest value in array of size defined block_length here maxrss works great save file or print screen, program loops; however, @ end of loop holds last value , need hold of max values found not sure if answer want... assuming for loop breaks 1000s of points correctly chunks of 10 (which don't see in example), create array within array, need make maxrss list , append things it: maxrss = [] count in range(self.files/self.block_length): rss = scipy.fromfile(self.hfile2, dtype=

sql - Stop getting same result twice in mySQL -

i'm doing microblogging site (like twitter) using mysql database. in database have 3 tables: 1 users, 1 messages , 1 control follows who. when user enters site want show own messages , people follows, use query: select * messages inner join users on users.id = messages.author inner join followers on followers.main_user = 2 messages.author = followers.followed_user or messages.author = 2 order date desc; being '2' user that's entering site. the thing messages written person enters (2, in example) twice, , once people follows. have clue how solve this? user 2 doesn't follow himself.