Posts

Showing posts from July, 2012

mime types - Ignoring mimetype in git -

mime types - Ignoring mimetype in git - is possible not ignore on filename only, on mimetype well? since mimetype depends on "magical numbers" in file, can generate additional disambiguation between different kind of files. git mime-types gitignore

knockout.js - ko.validation.group is not working as expected ? Knockout -

knockout.js - ko.validation.group is not working as expected ? Knockout - i been trying clear display of errors onload errors should display on farther action after load . i got solution felt can been done in improve way working solution: this clear onload messages ko.utils.arrayforeach(self.main(), function (s) { ko.utils.arrayforeach(s.stdata(), function (s1) { ko.utils.arrayforeach(s1.sdata(), function (s2) { if (s2.validation.errors().length > 0) { s2.validation.errors.showallmessages(false); } }); }); }); tried usign group stuck error i.e object doesn't back upwards property or method 'ismodified' in knokcout validation . not working : var result= ko.validation.group(self.main(), { deep: true }); if (!self.main().isvalid()) { // rightly getting isvalid false , showing error text under . result.showallmessages(false); // error @ li

java - How to get result on same page why input is required? -

java - How to get result on same page why input is required? - in project updating details created action, gives me exception in response as no result defined action org.employee.actions.employeemyprofileaction , result input in struts.xml (before) <action name="savepersonaldetails" class="org.employee.actions.employeemyprofileaction" method="updateemployeedetails"> <result name="success">empmyprofile.jsp</result> </action> (after) <action name="savepersonaldetails" class="org.employee.actions.employeemyprofileaction" method="updateemployeedetails"> <result name="success">empmyprofile.jsp</result> <result name="input">emp-personal-form.jsp</result> </action> ajax call function checkpersonal(id) { if (checkeverythingp()) { $.ajax({ type : 'post', url :

java - Netbeans Platform application using the plugin system -

java - Netbeans Platform application using the plugin system - i writing netbeans platform application. want give application client while in development state , whenever there updates on specific module want handle in way client can utilize netbeans plugin updater update modules. hence server host different modules, signing jars no problem. in way have host modules , how can specify modules updatable? how have specify/declare server modules hosted? looks there quite bit of documentation out there. how update netbeans platform application silently? free chapter on update center definitive guide netbeans™ platform 7 netbeans how create update center how create own update center? generating update center netbeans rcp how secure netbeans platform update center java netbeans netbeans-platform netbeans-plugins

java - How do I use decimals when spacing a graphic -

java - How do I use decimals when spacing a graphic - i'm trying space lines on graphic creating cant seem yo able input decimal number (3.5) value space between lines in graphics. @ moment have input value 4 code wrong. the code using below; for (int = 0; < 3; i++) g.drawline(185, 130 - 4*i, 260, 130 - 4*i); does have suggestions how input decimals value? you should utilize graphics2d object instead. code this: graphics2d g2d = (graphics2d) g; (int = 0; < 3; i++) g.draw(new line2d.double(185, 130 - 3.5*i, 260, 130 - 3.5*i); java graphics

nsfetchrequest - NSSortDescriptor sorting using NSDate in Swift -

nsfetchrequest - NSSortDescriptor sorting using NSDate in Swift - how sort nsfetchrequest date property of managed object. creates array dates going in order? here code far... var request : nsfetchrequest = nsfetchrequest(entityname: "history"); request.predicate = nspredicate(format: "counts = %@", true) request.sortdescriptors = [???] <- should set here? var results : [nsmanagedobject] = context.executefetchrequest(request, error: nil) [nsmanagedobject] // newest first request.sortdescriptors = [nssortdescriptor(key: "date", ascending: false)] nb: not need : [nsmanagedobject] if have as [nsmanagedobject] . you not need : nsfetchrequest when utilize mill method of nsfetchrequest . swift nsfetchrequest nssortdescriptor

php - Bind_param() on a non-object-error when using variables as input -

php - Bind_param() on a non-object-error when using variables as input - trying update using mysqli, calling class function this: $nyvaegt = 10; $navn = 'ord'; $nyoevelse = new oevelse(); $nyoevelse->opdateroevelse( $nyvaegt, $navn ); and corresponding class function: public function opdateroevelse ( $nyvaegt, $navn) { $this->nyvaegt = $nyvaegt; $this->navn = $navn; global $mysqli; $stmtopdateroevelseihistorik = $mysqli->prepare("update oevelser set `vaegt12reps`=? `navn`='?' values (?, ?)"); var_dump($stmtopdateroevelseihistorik); $stmtopdateroevelseihistorik->bind_param( "ds", $nyvaegt, $navn); $stmtopdateroevelseihistorik->execute(); if ( $stmtopdateroevelseihistorik ) echo "query success!<br>"; else echo "query failed!<br>"; } i

asp.net mvc - Dependency Injection without Repository Pattern using with Entity Framework -

asp.net mvc - Dependency Injection without Repository Pattern using with Entity Framework - so far i've been implementing in projects repository pattern , dependency injection. utilize entity framework orm , have service layer manages repositories. i kind of sense doing not essential problems @ hand. not alter database or orm. little projects have no need implement tests. but thought of not sending requests database each time fetch data, if it's in memory there. my question is: if utilize entiry framework illustration in asp.net mvc application, , not utilize repository pattern, still using di on ef's dbcontext, can benefit of performance preventing roundtrips database server reads? by implementing di on dbcontext mean ninject example: kernel.bind<mydbcontext>().toself().inrequestscope(); thanks adding repository pattern on top of ef dbcontext not help in performance optimization. the dbcontext unit of work keeps track of loaded/

algorithm - given prefix, how to find most frequently words effiecitly -

algorithm - given prefix, how to find most frequently words effiecitly - this interview question extended one: http://www.geeksforgeeks.org/find-the-k-most-frequent-words-from-a-file/ but question required on more thing: given prefix for example, given "bl" homecoming words such "bloom, blame, bloomberg" etc. so using trie must. then, how efficitnly build heap? it's not right or pratical build heap each prefix @ run time. solution. [suppose trie or info construction static, pre-build] thanks! keep trie words appearing in file , counts. if asked homecoming words prefix "bi", can efficiently using trie formed. since interested in giving occuring words prefix "bi", can utilize min-heap give reply efficiently has been done in post have linked to. also note since space usage of trie can grow large, can suggest interviewer utilize ternary search tree instead of trie. algorithm data-structures

fortran - Do loop not working, request your solutions -

fortran - Do loop not working, request your solutions - i think silly ask, but, loop isn't working seems. can take time re-check code ? here's code: program hexagonal implicit none integer::i,j,info integer::n1,n2 real::a,e0,ts,tsp,es,ep real, parameter :: pi = 3.1415927 real, allocatable :: kx(:,:) real, allocatable ::ky(:,:) real, allocatable :: epos(:,:) real, allocatable :: eneg(:,:) namelist /model_parameters/ a,e0,ts,tsp namelist /lattice_size/ n1,n2 open(unit=10, file='hexinput.txt',action="read", iostat=i) read(unit=10,nml=lattice_size,iostat=info) read(unit=10,nml=model_parameters,iostat=info) close(10) write(*,*) "n1=", n1, "n2=", n2, a, e0, ts, tsp ! allocate arrays if (allocated(kx)) deallocate(kx) allocate(kx(n1,n2)) if (allocated(ky)) deallocate(ky) allocate(ky(n1,n2)) if (allocated(epos)) deallocate(epos) allocate(epos(n1,n2)) if (allocated(eneg)) deallocate(eneg) a

android - What is the good example of using DI (Dagger) in terms of good architecture? -

android - What is the good example of using DI (Dagger) in terms of good architecture? - i'm trying create modular architecture android app , i'm looking dagger di library. it's awesome tool, don't want misuse , have numerous questions like: should wrap (like activities or fragments, or event separate views) modules or mutual used parts of app (likes services querying info login, info layer)? better utilize android annotations. android annotations cool library faced seems play ui layer making easy ealing views, fragments , removing boilerplate code. how doest play dagger? if have illustration of open source project using di please refer me. want follow best practices. take at: jake wharton's u2020 app; u2020-mortar - port of jake wharton's u2020 app utilize of mortar & flow; u2020-mvp - port live typing mvp pattern in mind. android dependency-injection dagger

AVRO schema for JSON with mixed record types -

AVRO schema for JSON with mixed record types - i have next problem, kindly inquire advice. have json file events of several types come mixed in same file. each event record linear construction (no nesting). events have identifier , event type, , depending on event type, construction of fields in event record different. need create avro schema file (.avsc), in order able transform json file binary avro format. given fragment of json below, can please suggest me how build corresponding avro schema, please? {"eventid":"ev1","eventtype":"a","timestamp": 1366150681, "fielda1": 10, "fielda2":"texta" } {"eventid":"ev2","eventtype":"a","timestamp": 1366150699, "fielda1": 11, "fielda2":"atext" } {"eventid":"ev3","eventtype":"b","timestamp": 1366150750, "fieldb1": &q

iphone - xcode distribution Provisioning profile "None" -

iphone - xcode distribution Provisioning profile "None" - in xcode 6: have problem while submitting app app store when archive apps,it show me provisioning profile "none" show in below image. i have install certificate in keychain well. can please tell me how show me such result. in xcode 5 : give me "no identity found" try next in xcode6: 1. xcode->preferences->accounts->view details->click refresh button 2. click project->click targets->click build settings tab->choose distribute provisioning profile in code signing then, seek submit app again. iphone ios7 sdk xcode5 xcode6

javascript - $(selector) equivalent in Ext 3 -

javascript - $(selector) equivalent in Ext 3 - i have menu component , trying select link selected adding class on click , removing class menu items before adding 1 time again newly clicked link. so find parent component , query find anchors. seek chx classes of anchors , remove one/ones "selected" class. var anchors = component.el.query("a"); ext.iterate(anchors, function(anchor, i){ anchor.removeclass('selected'); }); this.el.addclass('selected'); does not work. yet: var anchors = component.el.query("a"); ext.iterate(anchors, function(anchor, i){ $(anchor).removeclass('selected'); }); this.el.addclass('selected'); does work. ext native equivalent create work? with extjs 3 anchors[index] homecoming html specific node. utilize addclass or removeclass need utilize anchors.item(index); something work: ext.onready(function(){ var div = ext.get('test'), anchors = div.

java - Getting ArrayList.get() to return -

java - Getting ArrayList.get() to return - i trying write a simple function translating integer, , vice versa, 3bit binary string 0 padding. test inttobinary method created simple loop adding integers 1 5 , translating each number binary string, combine binary strings larger string. arraylist citylist = new arraylist(); string gene = ""; for(int = 1; i<5;i++){ citylist.add(i, i); gene += inttobinary(i); system.out.println(gene + "" + citylist.get(i)); } system.out.println(gene); when tried running little bit of code error @ citylist.get(i) shouldn't object.get(i) method returns variable @ index i? tried initializing int doing int citynum = (int)citylist.get(i) got error saying object found instead of int . the variable type used in object.add(int index, object) int method should homecoming int variable. if understand question, like for (int = 0; < math.pow(2, 3); i++) { stringbuilder sb = new strin

c# - Unable to cast object of type 'System.Collections.ArrayList' to type 'System.IConvertible' -

c# - Unable to cast object of type 'System.Collections.ArrayList' to type 'System.IConvertible' - i have count of rows based null value on 1 specific column. have used given below code. here cad assign column contains values , null values. have count how many null values on cad_assign, , based on have display values. protected void ddlcircle_selectedindexchanged(object sender, eventargs e) { arraylist list = new arraylist(); shadinganalysisdatasettableadapters.tbl_cadengineersteamtableadapter cd; cd = new shadinganalysisdatasettableadapters.tbl_cadengineersteamtableadapter(); datatable dt = new datatable(); dt = cd.getavailabledata(ddlcircle.selectedvalue);// dt values cad_assign null int x; foreach (datarow dtrow in dt.rows) { list.add(dtrow); // here getting dt count. } x = convert.toint32(list); // error popup here } sql query: select state1, district, site_id, site_name tbl_site_details (state1 = @state

using strings in c++ and cygwin -

using strings in c++ and cygwin - im new @ need little help. want allow input many characters , spaces neccesary fill input, example, typed cin>>name , cin>>birthday if person types first , lastly name skip next cin function. how avoid this, want able declare name sort of string or char without having go through whole name=first+last ordeal , having them input first , last..if gets im saying need header file , proper declarations..im new @ im sure sick understand complex answers might get use std::getline input on 1 line. std::string name; std::getline(std::cin, name); alternatively, if expect birthday on same line, this. std::string input; std::getline(std::cin, input); std::istringstream input_stream(input); std::string first_name, last_name, birthday; if (!(input_stream >> first_name)) std::cout << "input cannot empty.\n"; if (!(input_stream >> last_name)) std::cout << "you must have lastly name.\n"; if

Java - How to parse large int as command line argument? -

Java - How to parse large int as command line argument? - i need write short programme works values of n. n command line argument(args[0]). problem integer.parseint doesn't work big values such 20000000000. around problem? programme designed print values powerfulness of 2 until value >= n , n has argument[0]. public class poweroftwo{ public static void main(string[] args){ int k = 1; int n = integer.parseint(args[0]); if(n < 0){ system.out.println(""); }else{ for(int i=1; k <= n; i++){ k *= 2; if(k <= n){ system.out.println(k); }else{ system.out.println(); } } } } } use java.math.biginteger or java.math.bigdecimal. these can handle numbers of magnitude. your loop like: public static void main(string[] args) { final biginteger 2 = new biginteger("2"); biginteger k = biginteger.one; bigintege

c - substring of a string and print it out -

c - substring of a string and print it out - i want disect next string: char msg[30] ="hello 13 1"; char *psh; int num1; int num2; char s[30],s[30]; i seek but: pch = strtok (msg," "); while (pch != null) { printf ("%s\n",pch); pch = strtok (null, " "); } which outputs: hello 13 1 i want create number '13' equal num1, number '1' equal num2: printf("%d\n",num1); output: 13 printf("%d\n",num2); output: 1 i try: sscanf(sc, "%s %d %d", &s, &num1, &num2); which outputs: segmentation fault thanks [edit] char * pch char s[30]; char sc[30]; char num1[30]; char num2[30]; pch = strtok (s," "); while (pch != null) { printf ("%s\n",pch); pch = strtok (null, " "); } sscanf(sc, "%s %d %d", pch, &num1, &num2); use sscanf function: sscanf(msg,

giving 'java.library.path' in netbeans for .dll/.so files -

giving 'java.library.path' in netbeans for .dll/.so files - how give path .dll or .so file in netbeans load library using system.loadlibrary("foo") i read this on netbeans page couldn't help me. gives unsatisfied link error. these 2 things tried : in next snapshot created lib folder within netbeans project , placed dll files within it. in sec snapshot created lib folder within modules folder , placed dll files within lib folder stated in link. but both of them give me unsatisfied link error exception. how set java.library.path in netbeans can straight test application netbeans, without having go , write on terminal ? its working now. little bit setting have netbean ide.only of netbean ide. follow steps :- ==>right click on project ==>properties ==>click on run ==>vm options : -djava.library.path="c:\your directory dll present" ==>ok its working 100%. have done in own project. jav

tomcat - How to setup SpagoBI on AWS Instance -

tomcat - How to setup SpagoBI on AWS Instance - i want setup spagobi on aws (amazon web services) ec2 instance. have downloaded in 1 bundle , moved aws. ran startup script. have done same steps on local machine , working fine. on aws ec2 have opened port 8080 tomcat , 80 http. can't access software. any thought on how can prepare issue, highly appreciated! could this? https://forums.aws.amazon.com/thread.jspa?messageid=312167#312167 initially looks iptables running on instance, checks show filtered ports, need add together rule allow port 8080, or disable firewall on instance itself. you can verify running root "service iptables stop" , see if can connect on port 8080. tomcat amazon-web-services amazon-ec2 spagobi

vb.net - How to add picture to Dynamically created Picturebox, on a drag drop event -

vb.net - How to add picture to Dynamically created Picturebox, on a drag drop event - i have function mentioned below. need add together n number of picturebox if user drop little image on panel. code below (on drag , drop event of form) able add together dynamic picturebox. facing 2 problems. it adds 1 picturebox. if drag , drop something, replace image in picturebox. i need add together new picturebox in row , column wise, depending on width of panel public function addpic(byval pic image, byval pname string) dim pb new picturebox pb .name = pname .sizemode = pictureboxsizemode.centerimage .location = new system.drawing.point(5, 5) .size = new size(50, 50) .backgroundimagelayout = imagelayout.center .image = pic ' note can set more of picbox's properties here end thepanel.controls.add(pb) richtextbox1.controls.add(pb) ' line catches people out! 'me.controls.add(

php-redis - Is there a way to store PHP object in Redis without serializing it? -

php-redis - Is there a way to store PHP object in Redis without serializing it? - i trying store user' request url key , php object corresponding key value in redis. tried following: $redisclient = new redis(); $redisclient->connect('localhost', 6379); $redisclient->set($_server['request_uri'], $this->page); $redistest = $redisclient->get($_server['request_uri']); var_dump($redistest); however, code value of url key beingness stored in redis type of string value equal 'object' instead of actual php object. there way store php object without serializing it? as can see in redis info types, redis supports these 5 info types: stirng list set hash sorted set so, there no object data-type , therefor not able store object straight value. have serialize first (or json-encode json_encode function example). is there problem serializing insist on storing objects directly? update: according said in comments, can u

SQL Server Aggregate using like -

SQL Server Aggregate using like - i have table 2 columns, 1 1/0 flag whether they've opened email, sec email address (ie joe123@domain.com). opened email 0 joe123@domain.com 1 sue234@email.net ... ... i'm trying find if patterns in user names impact open rates using regex patterns in unsure of syntax rows match , not match pattern. for instance, can do: select email, sum(opened) table1 email '%joe%' but gives me rows match. i'd rows , don't match in same output. i'd this: pattern opened 'joe' 55 not_joe 15987 'sue' 78 not_sue 15964 ... ... what's best way this? if you've got list of patterns, can accomplish like/not using cross bring together (warning: performance hit). see below example. note: can potentially improve performance of in select statement - t

java - Getting started with EHCache -

java - Getting started with EHCache - i getting started ehcache , downloaded required .tar file location: ehcache downloads. extracted .tar file , added below jars classpath. ehcache-2.9.0 slf4j-api-1.7.7 slf4j-jdk14-1.7.7 i not able find cachemanager.java in of above mentioned jars. located in other .jar file? the ehcache-2.9.0.jar not contain java source file. contain compiled class file net.sf.ehcache.cachemanager. if want source file can found in src directory of unpacked distribution. java jar ehcache

c# - JavaScriptSerializer.Deserialize Gives Null Fields -

c# - JavaScriptSerializer.Deserialize Gives Null Fields - i sent next json wcf service accepts stream parameter. {"reservationstream": {"clientfirstname":"abe", "clientlastname":"lincoln", "clientphone":"0544944860", "clientemail":"abe@mail.com", "pickuplocationid":"3699", "pickupaddressstring":"jfk airport terminal 1", "pickupflightnumber":"ly001", "pickupairline":"el al", "pickupairportname":"john f kennedy intl", } } in debugger, stream variable shows values expected. want deserialize class defined follows: public class reservationstream { public string clientfirstname { get; set; } public string clientlastname { get; set; } public string clientphone { get; set; } public string clientemail { get; set; } public string pickuplocationid { get; s

9 equal columns inside column-fluid class in twitter bootstrap -

9 equal columns inside column-fluid class in twitter bootstrap - i want have 9 equal columns on page building , can't seem understand how through using bootstrap version 3.2.0 is possible create 7 equal columns within class .col-lg-12 ? it possible extend boostrap grid https://github.com/adamheins/bootstrap-grid-extension-generator but still dont see whata want accomplish? twitter-bootstrap twitter-bootstrap-3

python - How do you change a one dimensional list into two dimensional using existing elements? -

python - How do you change a one dimensional list into two dimensional using existing elements? - this question has reply here: how split list evenly sized chunks in python? 45 answers i reading in text file containing several lists each on own line. elements in given list non-integer x,y co-ordinates need placed array such that: [x1, y1, x2, y2, x3, y3,....xn, yn] becomes: x1 x2 x3....xn y1 y2 y3....yn but in same 2d array. i'm new coding , have tried various methods no avail. right looping on number of co-ordinate pairs , trying append values within loop unsure how this. this how have started it: with open('textfile.txt', 'r') infile: line in infile: array=[] number=(line.count(" ")+1)/2 #number of x,y pairs in list in range(0, number-1): now don't know go here help appreciat

apache camel - cameltest case with bean -

apache camel - cameltest case with bean - in java class have below: from("direct:dcrm:input") .routeid("dcrm-route" .convertbodyto(message.class) .setheader( "recipientlistheader", simple("activemq:"+rdvrqueuename+ ".${body.controllerid}?jmsmessagetype=text&timetolive=" + rdvrmessagetimetolive + "&deliverypersistent=" + deliverypersistent)) .choice() .when(simple("${body.messagetype} == 'rdvr'")) .bean(new dcrmmessagehandler(), "process") .marshal(requestmessage) .recipientlist(header("recipientlistheader")) .onprepare(new messsageprocessor()).parallelprocessing() .end() .setbody(constant(statuscode.success)) .otherwise()

Python on android -

Python on android - besides official pygame port android requires python 2.7.1 3.4.1 better. besides kivy, way set pygame or python module on android? if you're looking ways of running python on android, i'd utilize android scripting. provides back upwards python 2.x , exposes api's calling hardware features on droid. note in state of development wouldn't utilize in production. android python pygame kivy

intentfilter - In android is there any event trigger, when network type change -

intentfilter - In android is there any event trigger, when network type change - in android there availability of different types of network 3g,edge,lte etc. searching event when user network type alter border 3g,lte , vice versa. there broadcast receiver called whenever network state changes(connection lost,changed,etc). in receiver class have figure out kind of network network intrested in. connectivity manager class help figure out type of connected network. boolean iswifi = activenetwork.gettype() == connectivitymanager.type_wifi; update: you can utilize telephonymanager.getnetworktype() not aware of broadcast receiver can registered notified alter in network. android intentfilter discussion-board

machine learning - SVM Algorithm Implementation on Python -

machine learning - SVM Algorithm Implementation on Python - i have dataset stanford on film reviews - movie review dataset. has both training info , testing info - of them text files in 2 folders - positive , negative. how implement text classification using svm algorithm on it? (using python library) check scikit-learn, it's great machine learning framework. have @ working text data classification of text documents using sparse features example, feature extractions. there ntlk, it's not powerful in ur case, check thread more details. python machine-learning

windows - How do I ping the default gateway without specifying the IP address? -

windows - How do I ping the default gateway without specifying the IP address? - i'm trying write batch file tests network connectivity pinging default gateway of given network. however, want automated process logs results text file, i'd able ping gateway on various networks, without having change/enter ip address. is there generic term or command ping default gateway network you're connected to? (i have commands output options etc.) so far, have this.... @echo off goto :network1 :network1 ipconfig echo . set /p gateway=please come in gateway ip address (shown above): if /i "%gateway%" equ "exit" goto :exit if /i not "%gateway%" equ "exit" goto :network2 :network2 echo closing window abort connectivity test. echo . >> "c:\network test results %date:/=.%.txt" echo time: >> "c:\network test results %date:/=.%.txt" time /t >> "c:\network test results %date:/=.%.txt" ping %

desire2learn - how to Create a provider of insert-stuff elements: in the list of Insert Stuff sources for Desire to learn LMS -

desire2learn - how to Create a provider of insert-stuff elements: in the list of Insert Stuff sources for Desire to learn LMS - i trying find samples or code help me build provider of insert-stuff elements: in list of insert stuff sources, want larn custom service. example same alternative of youtube in insert on html editor any pointers or guidance appreciated. have checked out remote plugin test service sample? there's blog post sample in dev cop blog (https://community.brightspace.com/devcop/blog/making_development_easier_with_the_remote_plugins_test_service~1) , sample includes insert stuff remote plugin. desire2learn

javascript - How to get count of Markers within circle radius in Google Maps API v3 -

javascript - How to get count of Markers within circle radius in Google Maps API v3 - i have google map populate multiple markers, add together addlistener right click event. on right click, add together temp marker circle radius of 50000 meters,upon dropping marker, count of markers fall within radius. thanks, should have posted code front, managed resolve on own. per below. var loc1 = location; //marker radius co-ords var loc2 = new google.maps.latlng(latsplit, lonsplit); //marker co-ords var diff = (google.maps.geometry.spherical.computedistancebetween(loc1, loc2)); if (diff < circle.getradius()) { alert(loc2 + " within radius"); } else { alert(loc2 + " outside radius"); } javascript jquery google-maps-api-3 google-maps-markers

cql3 - Datastax: Re-preparing already prepared query warning -

cql3 - Datastax: Re-preparing already prepared query warning - i have code uuid notuuid = uuids.timebased(); preparedstatement pstmt = cqlsession.prepare("insert mytable(userid, notifid, notification, time, read, deleted) values(?, ?, ?, ?, ?, ?)"); boundstatement boundstatement = new boundstatement(pstmt); cqlsession.execute(boundstatement.bind(userid, notuuid, notfmsg, system.currenttimemillis(), migificconstants.unread, "false")); when run code, in log shows re-preparing prepared query insert mytable(userid, notifid, notification, time, read, deleted) values(?, ?, ?, ?, ?, ?). please note preparing same query more 1 time anti-pattern , impact performance. consider preparing statement once. is code part of method called multiple times? statements need prepared 1 time per cluster instance, should in initialization part of application. cql3 datastax-java-driver

How to reload a specific service in java? -

How to reload a specific service in java? - how can reload specific .class without having restart entire program? possible accomplish using public void reload () ? if is, how going declare that? want restart .class files (service.class) using service.getinstance ().reload() trigger if possible. if want load new implementation of class you've loaded, you'll need create new classloader find new implementation , request class and/or object instance through that. note not alter of instances of class in use. tutorials classloader exist on web; i'll refer them details. if want modify class behind objects are active... that's hot-swapping. not jvms back upwards it, , has limitations in changes can made (nothing changes function signatures, example). it's intended utilize interactive debugging tools, beingness able modify line of code , test new version in context important... , fragility isn't problem because if swap can't made that's lost

mysql - How to union different multiple selects in one query? -

mysql - How to union different multiple selects in one query? - is possible combine tables in 1 or maybe 2 queries? i tried utilize union need access each row in query. and biggest problem me sort of order by. for illustration need print first query rows in 1 div, sec query rows in div , on.. (select link rellink, date reldate, title reltitle torrent moderate = 1 order date desc limit 0,12), (select torrent torlink1, date tordate1, title tortitle1 torrents moderate = 1 , genre = 1 order date desc limit 10), (select date tordate2, torrent torlink2, title tortitle2 torrents moderate = 1 , genre = 2 order date desc limit 10), (select link newslink1, date newsdate1, title newstitle1 news moderate = 1 order date desc limit 0,10), (select link newslink2, date newsdate2, title newstitle2 news moderate = 1 order date

Printf having unusual behavior in C program -

Printf having unusual behavior in C program - i'm creating server in c on ubuntu, i've problem printf function doesn't work. code. i'd terminal prints "dd" programme starts, doesn't anything. suggestions? #include <stdio.h> #include <stdlib.h> #include <string.h> #include <unistd.h> #include <arpa/inet.h> #include <sys/types.h> #include <netinet/in.h> #include <sys/socket.h> #include <netdb.h> void main(){ printf("dd"); int ds_sock; struct sockaddr_in my_addr; ds_sock=socket(af_inet,sock_stream,0); memset(&my_addr,0,sizeof(my_addr)); my_addr.sin_family=af_inet; my_addr.sin_port=htons(25000); my_addr.sin_addr.s_addr=inaddr_any; bind(ds_sock,(struct sockaddr *)&my_addr,sizeof(my_addr)); listen(ds_sock,3); printf("dd"); int ds_sock_acc; struct sockaddr_in addr; size_t sin_size = sizeof(struct sockaddr_in); ds_sock_acc = accept(ds_sock,(struct sockaddr *)&addr,&a

sublimetext2 - Sublime Text 2: How to open new sublime text window in different workspace on Ubuntu? -

sublimetext2 - Sublime Text 2: How to open new sublime text window in different workspace on Ubuntu? - in ubuntu, when i'm working multiple workspaces, if open sublime-text via terminal or search bar, doesn't open new window. instead points me sublime-text window in other workspace. counterintuitive since point of workspaces have separate work pieces. is there way prepare this? thank you. you can utilize subl -n to open new sublime window. sublimetext2

osx - Git Config issue -

osx - Git Config issue - i think may have misconfigured config file git's command-line tools. whenever trying install using git repository url, next error: fatal: '.insteadofgithub.com/angular/bower-angular.git' not appear git repository i played url replacing git:// http:// , but, unfortunately, it's not reverting back. is there command line re-configure urls? it seems insteadof misused. if utilize https:// instead of git:// , or else, can use: git config --global url."https://".insteadof git:// this add together next content, in ${home}/.gitconfig file: [url "https://"] insteadof = git:// osx git github terminal repository

Variation of Edit distance algorithm that only tracks substitutions and insertions -

Variation of Edit distance algorithm that only tracks substitutions and insertions - does know of edit-distance algorithm counts substitutions , insertions. basically, levenshtein distance algorithm without deletions. you can utilize same dynamic programming solution used computing normal levenshtein distance, without transitions correspond deletions. algorithm levenshtein-distance edit-distance

c - How can I convert float array to GLfloat array? -

c - How can I convert float array to GLfloat array? - how can convert float array glfloat array? need create graph , need send array of floats display function. float array global variable/ glfloat typedef float . don't need convert between two. c

interface - No suitable method found to override c# despite there being one? -

interface - No suitable method found to override c# despite there being one? - i trying find solution here issue , sense problem little cannot figure out going wrong. telling me rectangle.draw(): no suitable method found override. public interface shape { void draw(); } //concrete classes implemenet interfaces public class rectangle : shape { public override void draw() { console.writeline(this.gettype().name + "'s within function (generate stuff here) "); } } the error correct. can override method if nowadays in inherited base of operations class. rectangle class doesn't inherit anything; implements interface "shape". remove "override" keyword , fine. c# interface override

jquery - anchor as button with accesskey is behaving different from an actual button -

jquery - anchor as button with accesskey is behaving different from an actual button - i have anchor accesskey assigned. anchor used button, has anchor since page uses jquery ui theme styling. in chrome, working fine, can "click" button using <alt> + accesskey. however, in ie, button "selected" when utilize <alt> + accesskey. how can create sure button "clicked" (without having press "enter" afterwards)? see fiddle example: http://jsfiddle.net/5yu6anpf/ html: <a accesskey="a" href="#">anchor (a)</a> <button accesskey="b">button (b)</button> <span id="status">use alt + a/b</span> javascript: $("a, button") .button() .click(function() { $("#status").text($(this).text()) }); ie gives focus access-key, can observe focus event triggering click $("a, button") .button() .focu

Python dictionary key assign -

Python dictionary key assign - i've created dictionary tuple, can't seem find reply how i'd switch keys , values without editing original tuple. have far: tuples = [('a', '1'), ('b', '1'), ('c', '2'), ('d', '3')] dic = dict(tuples) print dic this gives output: {'a': '1', 'b': ''1', 'c': '2', 'd': '3'} but i'm looking for: {'1': 'a' 'b', '2': 'c', '3': 'd'} is there simple code produce this? build dictionary in loop, collecting values lists: result = {} value, key in tuples: result.setdefault(key, []).append(value) the dict.setdefault() method set , homecoming default value if key isn't present. here used set default empty list value if key not present, .append(value) applied list object, always. don't seek create mix of single

c# - Silverlight; Change Grid's background on mouseover -

c# - Silverlight; Change Grid's background on mouseover - simply want alter grid's background color (in silverlight) when mouse enters , reset when mouse leaves. tried different ways no success. here have tried: 1: using eventtriggers: <grid.triggers> <eventtrigger routedevent="mouseenter"> <beginstoryboard storyboard="{staticresouce mouseenter}"/> </eventtrigger> </grid.triggers> this doesn't work , say: the fellow member "ismouseover" not recognized or not accessible 2. using style.triggers i tried setting simple triggers in style targettype="grid" in silverlight seems there no way create style.triggers in xaml. here code: <grid.style> <style targettype="grid"> <style.triggers> </style.triggers> </style> </grid.style> but says: the attachable property 'triggers' not found

OpenSSL does not match Python hashlib -

OpenSSL does not match Python hashlib - i new using openssl library , cannot output match output python's crypto libraries. below example. python code: import hmac secret = "asdf1234" string = '{"request"}' hmac.new(secret, string, hashlib.sha384).hexdigest() '92904f1b3c210a4fb19f476c19f24452717e85329aa9ffaba4a5fbe1111c2e3fa7f5a5fb35fdc58b3d158f5f886c3d02' openssl: echo -n {"request"} | openssl dgst -sha384 -hmac asdf1234 -hex (stdin)= 4c3d525b8a7095b9063a3bd974e56f0a5872399365912297d6ee18e400d2b55d0142395ba5fb4f33655ceca209ba9570 what doing wrong? either implementation correct? to match openssl output, python string should '{request}' rather '{"request"}' . import hmac import hashlib secret = "asdf1234" string = '{request}' hmac.new(secret, string, hashlib.sha384).hexdigest() yields '4c3d525b8a7095b9063a3bd974e56f0a5872399365912297d6ee18e400d2b5

what is the correct antlr comment lexer rule to exlude ampersand but only if it is at the end? -

what is the correct antlr comment lexer rule to exlude ampersand but only if it is at the end? - i need lexer rule comment not include '&' @ end of line. '&' line continuation valid character in middle of comment. here grammar: grammar test; begin : line+ ; line : command? new_line #commandline ; command : print stringliteral ; stringliteral : '"' .*? '"' ; print : 'print'; new_line : ('\r'? '\n') | '\\' ; line_continue : '&' [ \t]* new_line -> channel(hidden) ; comment : '!' ~[\r\n!&]* '!'? -> channel(hidden) ; ws : [ \t]+ -> channel(hidden) ; the above works until have comment like: ! stone & roll here valid text need parse: print "hello world" ! stone & roll print ! comment here & "hello world" here output: line 1:

android - How can I start a new activity when I click on infoWindowAdapter? -

android - How can I start a new activity when I click on infoWindowAdapter? - hi guys i'm beginner android, wanna start new activity when force on infowindowadapter in map. code seems easy doesn't work, don't know why. can help me? have declared new activity (moreinfoactivity) in manifest , wanna phone call main activity. below can find "moreinfoactivity" source, phone call mainactivity , declaration within manifest. give thanks much call mainactivity when force on infowindowadapter: [updated] final activity thiz = this; map.setoninfowindowclicklistener(new oninfowindowclicklistener() { @override public void oninfowindowclick(marker marker) { /*nuova chiamata di united nations activity (scelta perché più pratica e la richiamiamo anche dalla listview)*/ /*************************************************************************************************/ string nome_luogo = marker.gettitle(); intent piu_info = new intent(thiz, moreinfoactivi

javascript - Why is there no x or y axis shown on this d3 chart? -

javascript - Why is there no x or y axis shown on this d3 chart? - i have d3 chart follows. html: <svg></svg> js: var margin = {top: 10, right: 10, bottom: 10, left: 10}, width = 960, height = 500; var startofweek = moment().startof("week").todate(); var endofweek = moment().endof("week").todate(); var dxsyncevents = []; var = moment(); var times = []; var sites = []; /* stuff pushes js date objects onto times[] , strings onto sites[] */ var xscale = d3.time.scale().domain([startofweek, endofweek]).range([0, 960]); var yscale = d3.scale.ordinal().domain(sites).rangepoints(500, 10); var xaxis = d3.svg.axis().scale(xscale).orient("bottom") .ticks(d3.time.hours, 12) .tickformat(d3.time.format('%h:%m')) .ticksize(8) .tickpadding(8); var yaxis = d3.svg.axis().scale(yscale).orient("left"); d3.select("svg") .attr("width", width) .attr("height", height) .

jquery validation issue with checkboxes -

jquery validation issue with checkboxes - having problem jquery validation. have 2 checkboxes... on sec requiring checked. the validation works, however, there 2 problems : 1 - if there error (2nd box not checked) removes <span> first totally unrelated it... still shows error message sec should. 2 - when there error on 2nd... checking not remove error message. also, checking , unchecking multiple times causes multiple error messages displayed on each 'uncheck'. html : <form id="downloadinstall" method="post" action="/process/p_module_dl.php"> <div class="row"> <div class="col-md-12 margin-bottom-30 form-group"> <p class="f-15 margin-bottom-15"><b>select options :</b></p> <div class="checkbox-list"> <label <input type="checkbox" name="settings[c

metaprogramming - Metaprogrammatically defining Ruby methods that take keyword arguments? -

metaprogramming - Metaprogrammatically defining Ruby methods that take keyword arguments? - struct lets me create new class takes arguments , has nice semantics. however, arguments aren't required, , order requires consulting definition: point = struct.new(:x, :y) point.new(111, 222) #=> <point instance x = 111, y = 222> point.new(111) #=> <point instance x = 111, y = nil> i'd similar struct, uses keyword arguments instead: point = stricterstruct.new(:x, :y) point.new(x: 111, y: 222) #=> <point instance x = 111, y = 222> point.new(x: 111) #=> argumenterror that might this: module stricterstruct def self.new(*attributes) klass = class.new klass.instance_eval { ... } klass end end but should go in braces define initialize method on klass such that: it requires keyword arguments no default value; the keywords given array of symbols in attributes ; and the initialize method assigns them instance variab

android 2.x Dialog with windowAnimationStyle cannot be dismissed -

android 2.x Dialog with windowAnimationStyle cannot be dismissed - i find on android 2.3.3(emulator) , 2.3.4(huawei phone), dialog windowanimationstyle cannot dismissed. here code in activity: private dialog mdialog; private view mdialogview; @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_main); } handler mhandler = new handler() { @override public void handlemessage(message msg) { mdialog.dismiss(); super.handlemessage(msg); } }; public void clickbutton2(view view) { mdialog = new dialog(this, r.style.toalog); mdialogview = layoutinflater.from(this).inflate(r.layout.toast_view, null); mdialog.setcontentview(mdialogview); mdialog.settitle("title"); mdialog.show(); message msg = mhandler.obtainmessage(); mhandler.sendmessagedelayed(msg, 1000); } and code in style.xml <style name="toalog" parent=&q

java - Status Code 415: No MessageBodyReader Found for multipart/form-data, FormDataMultiPart -

java - Status Code 415: No MessageBodyReader Found for multipart/form-data, FormDataMultiPart - i'm running problem posting multipart/form-data restful web service i've made. trying upload media files (images, video, audio) via restful web service. googled around find best way , found posting multipart/form-data best solution. the problem when post multipart/form-data error message in tomcat server: severe messagebodyreader not found media type=multipart/form-data; boundary=----webkitformboundarytg7uvlcyj3lsbpqe, type=class org.glassfish.jersey.media.multipart.formdatamultipart, generictype=class org.glassfish.jersey.media.multipart.formdatamultipart. i did seek looking on stackoverflow find reply , problem seemed mimepull.jar missing many people. checked create sure mimepull.jar in classpath , indeed is, not issue. @ point i'm stuck. here dependencies in pom.xml: <dependencies> <dependency> <groupid>org.eclipse.persistenc

c# - Using COM component fails as admin -

c# - Using COM component fails as admin - i have .net wrapper on native dll. seek register component current user based on : link runs fine, except if right click executable , "run admin.." tool fail cannot find class. this code use, there missing , think might related : link thanks! public int register(serveraction action, string servername) { int hr = 0; string szfunction = (action == serveraction.register) ? "dllregisterserver" : "dllunregisterserver"; logger.info("filereader->try " + szfunction + " " + servername); seek { intptr hmod = loadlibrary(servername); if (hmod.toint32() != 0) { intptr registerdllserver_procaddress = getprocaddress(hmod, szfunction); dllregisterserverinvoker pfndllproc = (dllregisterserverinvoker)marshal.getdelegateforfunctionpointer(registerdllserver_procaddress, typeof(dllregi

c++ - Error Message "invalid conversion from ‘void*’ to ‘unsigned int’" -

c++ - Error Message "invalid conversion from ‘void*’ to ‘unsigned int’" - i have unsigned int function (it's given function task) // read info virtual memory unsigned int read(const int index) { homecoming speicher[index]; } in speicher[index] number, have decode in 4 components. first component value of speicher[index] mod 16 , sec component value of (speicher[index])/(16*16)mod16 think , on. other illustration error message. maybe can't understand function does: for me function read(const int index) should homecoming unsigned int number, can utilize "normal" other unsigned int number in program. unsigned int index = 0; unsigned int test = 1; { unsigned int hexzahl = read(index); test = read(index); index = index + 1; } while (index <= 255 && read(index) != 0); // 37 want, programme breaks if content of read(index) 0 i can't understand error message: main.cpp: in function ‘int main()’:

javascript - ajax returned form is not prevented using event.preventdefault() -

javascript - ajax returned form is not prevented using event.preventdefault() - i have 2 files testjquery.php , abcd.php on form submit calling ajax phone call , submitting ajax method. first times prevents forms defaultevent using event.preventdefault , loads response info other page div . when 1 time again seek submit it, event.preventdefault doesnt work on form. please help. in advance. // testjquery.php <!doctype html public "-//w3c//dtd xhtml 1.0 transitional//en" "http://www.w3.org/tr/xhtml1/dtd/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="content-type" content="text/html; charset=utf-8" /> <title>untitled document</title> <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script> </head> <body> <div id="abc">