Posts

Showing posts from August, 2011

python - Scrapy Clusters kafka_monitor.py interrupted -

scrapy clusters great new way scale large, continuous scrapy projects. setup within vm , runs several instances different tools. i've built vm out , installed necessary tools such redis, kafka, , zookeeper. i'm stuck on simple line prior first test crawl , don't know if it's python issue, installation issue, or what. when try python kafka_monitor.py run i get: traceback (most recent call last): file "kafka_monitor.py", line 512, in sys.exit(main()) file "kafka_monitor.py", line 497, in main kafka_monitor.run() file "kafka_monitor.py", line 413, in run self._setup_kafka() file "kafka_monitor.py", line 232, in _setup_kafka ret_val = _hidden_setup() file "/usr/local/lib/python2.7/dist-packages/scutils/method_timer.py", line 46, in f2 retval = f(*args) file "kafka_monitor.py", line 218, in _hidden_setup self.kafka_conn = kafkaclient(self.se...

service - Android AlarmManager defaulting to 5 minutes when phone screen is off -

so having issue alarmmanager. trying run code every 2 minutes, works okay while phone awake, not when device goes sleep - during sleep, intervals 5 minutes apart. since desired interval 2 minutes, 250% off target interval, specific application not acceptable. i aware of changes in api 19, , have followed suggestions re-schedule alarm using setexact() within broadcastreceiver. code below: the code used trigger broadcastreceiver: intent intent = new intent(this, alarmreceiver.class); final pendingintent pendingintent = pendingintent.getbroadcast(this, 0, intent, 0); malarmmanager = (alarmmanager) this.getsystemservice(context.alarm_service); malarmmanager.setexact(alarmmanager.elapsed_realtime_wakeup, systemclock.elapsedrealtime() + 3000, pendingintent); and code in broadcastreceiver re-schedules alarm: @override public void onreceive(context context, intent intent) { toast.maketext(context, "alarmservice triggered.", toast.length_short).sh...

Linux fill all files recursivelly with random or pseudo random data -

i want fill random bytes files recursivelly root directory. files, folders left untoutched i don´t want delete files, fill them random bytes in research, fill command single file like: dd if=/dev/random of=target-files bs=1m and find files recursivelly should use: find . -name "* .*" my questions are: is possible achieve goal joining 2 commands? (pipe them? how?) is there easier way achieve same results? thanks ;-) you may try pipe find result while loop, , dd /dev/udrandom each files. $ find myfolder -type f |while read fd; dd if=/dev/urandom of=$fd bs=1m count=1;done if want retain file size, may calculation on finding 1k block count , pass args in dd. $ find myfolder -type f|while read fd; fsiz=`stat -c %s $fd`; cnt=`expr $fsiz / 1024`;dd if=/dev/urandom of=$fd bs=1k count=$cnt;done

How to merge matrix and array of different size in MATLAB? -

i have 1 matrix of size 12 , array of size 4 given below: a=[23,45,1;4,6,7;9,5,0;145,65,32]; b=[3,2,4,6]; i want new array c c=[23,45,1,4,6,7,9,5,0,145,65,32,3,2,4,6]; i did following : a=[23,45,1;4,6,7;9,5,0;145,65,32]; b=[3,2,4,6]; a=reshape(a',12,1); b=b(:); c=[a b]; but giving error : error using ==> horzcat cat arguments dimensions not consistent. a = a(:); b = b(:); c = [a; b]; note difference between [a b] or [a, b] , [a; b].

java - Is websocket connection reliable? -

i thought web socket guarantees delivery of data built on top of tcp reliable. reading java web socket api documentation on link https://docs.oracle.com/javaee/7/api/javax/websocket/remoteendpoint.html says there no guarantee of successful delivery of web socket message peer, if action of sending message causes error known container, api throws it. shouldn't tcp gurantee message delivery? reliable != guaranteed. reliable means you'll notified if there failure (or success) - if end users unplugs lan cable, tcp can't 'guarantee delivery.'

gherkin - Can we bind single cucumber step to two different methods in two different classes -

i have 2 feature files in project 1 step common in these 2 files need call 2 different step definition function depending upon file on steps written. do have configuration that? so if understand correctly, have 1 line in cucumber needs execute 2 different methods? far know not possible. cucumber keep on telling there multiple methods same name. - title. what explanation different. have 2 feature files common step. 1 feature file getting steps classfile , other feature file getting steps classfile b? in case, can best extend public classes can use code class file in feature file.

ruby on rails 3 - Routes error on nested controller when submitting form, databasedotcom-gem -

i using databasedotcom & databasedotcom-rails gem generate leads salesforce form submissions. working standalone until nested controller under parent, , when press submit routes error: no route matches [post] "/events/516ee9a0421aa9c44e000001/leads/new" here code: resources :events resources :leads end class leadscontroller < applicationcontroller include databasedotcom::rails::controller def new @lead = lead.new respond_to |format| format.html # new.html.erb format.json { render :json => @lead } end end def create @lead = lead.new(params[:lead]) @lead.event_id = params[:event_id] @lead['ownerid'] = '005b0000000wxqe' @lead['isconverted'] = false @lead['isunreadbyowner'] = false respond_to |format| if @event_lead.save format.html { redirect_to @lead, :notice => 'lead created.' } format.json { render :json => @lead, :status => :created, :location ...

unix - Removing newline character from record -

below data , not able remove newline character sed or awk command . when use tr command, records merge single record , sed , awk not able help. can please let me know command if 1 faced type of data. "2016-03-05 00:48:11|0|i|not set ||||||||||||||||2014-01-13-12.27.15.234361|2014-01-14| |0|" "pls rpl 2 tr-ns fatal error |2 tr-ns fatal error |trblrprt|bdtrrpl|bwrinerr|0||| || " "2016-03-05 00:48:11|0|i|not set ||||||||||||||||2014-03-30-16.08.41.215789|2014-04-01| |0|" "pls rplc bad tr |pls rplc bad tr |trblrprt|bdtrrpl| |0||| || " "2016-03-05 00:48:11|0|i|not set ||||||||||||||||2014-04-08-13.32.59.536559|2014-04-09| |0|fatal error 3 please refer" "to ete| ...

java - Cannot read XML file using JAXB? -

having issues reading following xml file create. <?xml version="1.0" encoding="utf-8" standalone="yes"?> <prsettings> <prsetting> <players> <player> <lastdateentered>0</lastdateentered> <lasttournament>1</lasttournament> <playerid>0</playerid> <playersstatus>unrated</playersstatus> <playerstag>asfd</playerstag> <score>5.0</score> <setsplayed>0</setsplayed> <tourneyswhileinactive>0</tourneyswhileinactive> </player> <player> <lastdateentered>0</lastdateentered> <lasttournament>1</lasttournament> <playerid>1</playerid> <playersstatus>unrated</playersstatus> <playerstag>ba</playerst...

Ambari repository on CentOS 7 -

we trying install ambari server following manual https://cwiki.apache.org/confluence/display/ambari/install+ambari+2.2.1+from+public+repositories when tried install ambari server command yum install ambari-server returns nothing do. the ambari.repo is: #version_number=2.2.1.0-161 [updates-ambari-2.2.1.0] name=ambari-2.2.1.0 - updates baseurl=http://public-repo-1.hortonworks.com/ambari/centos7/2.x/updates/2.2.1.0 gpgcheck=1 gpgkey=http://public-repo-1.hortonworks.com/ambari/centos7/rpm-gpg-key/rpm-gpg-key-jenkins enabled=1 priority=1 someone can us? the problem os installed of 32 bits , obligatory install 64 bits os.

How to change base branch in git? -

Image
problem described in image giving error in text. i don't know why question being downvoted, because it's legitimate , common mistake beginner users make when using git. you accidentally created branch br-02 branch br-01 . 1 solution create branch using correct base, , cherry-pick commits have made on br-02 onto correct branch. git checkout bs-00 # switch correct branch git checkout -b br-03 # create correct branch using bs-00 base git cherry-pick <sha-1> # cherry-pick commit br-02 here <sha-1> hash of commit on branch br-02 wish keep. can find out value switching br-02 , typing git log terminal. note merging commit made on branch br-02 branch br-03 , there might conflicts. finally, can delete bad branch br-02 since don't need anymore: git branch -d br-02 # delete wrong branch br-02 locally git push origin :br-02 # delete wrong branch br-02 on remote

html - PHP Mailer Office 365 -

i getting started in web development , tasked creating web-mail php form. able pull resource online , works flawlessly gmail, outlook.com , every other email service throw @ it, when add office 365 account never receive message. email godaddy @a2plcpnl0560.prod.iad2.secureserver.net domain, not on office 365 email. have been through forums , don't have enough knowledge @ moment know begin tackle problem. have seen examples of phpmailer being used , attempted make code work on domain never got confirmation message form itself. not sure if there need configure in admin center of office 365 work or not. information appreciated. <?php if(isset($_post['email'])) { // edit 2 lines below required $email_to = "info@office365.com"; $email_subject = "inquiry"; function died($error) { // error code can go here echo "we sorry, there error(s) found form submitted. "; echo "these errors appear below....

Gradle's javadoc goal does not copy files from doc-files -

i found gradle's javadoc task not copy files doc-files subdirectories of package directories. is possible fix it? probably yes. can add action javadoc << : javadoc << { //copy files here } or create task finalize javadoc , copy files: task copysub(type: copy) { //configuration goes here } javadoc.finalizedby(copysub)

data fitting - Python - trying to perform a more robust linear fit -

Image
i have data fit linear function , fit determines other work (never mind, not important). i'm using numpy.polyfit , , when include data , degree of fit, nothing else, produces plot: now, fit okay, general consensus line of best fit being skewed red data points above , should fitting data below forms nice linear shape (beginning around congested blob of blue points). attempted add weighting call polyfit , , chose arbitrary weighting of 1/sqrt(y-values), smaller y-values weighted towards more favourably. gave following: which admittedly better i'm still unsatisfied, appears line low . ideally middle-ground, since chose arbitrary weighting, wondering if in general there way perform more robust fit using python, or if can done using polyfit ? using separate package if works fine too. this question doesn't have programming or python , more statistics or linear algebra. you try seeing error difference between best fit line or best fit quadratic see has less ...

shell - Add preceding zeros to all lines in a file -

i have simple text file containing random number on every line. wish add preceding zeros numbers less in digits. there way on command line (unix) input file: 235 25 1 963258 45 1356924 output file: 0000235 0000025 0000001 0963258 0000045 1356924 using awk - printf : $ cat testfile 235 25 1 963258 45 1356924 $ awk '{printf("%07d\n", $1)}' testfile # %07d pad 0s. 0000235 0000025 0000001 0963258 0000045 1356924

performance - Difference between declaring data source via tomcat context file and spring context -

is there difference between declaring datasource in meta-if/context.xml file , spring bean using jndi lookup (approach 1), or declaring datasource directly via spring (approach 2) : @bean(destroymethod = "close") datasource datasource(environment env) { hikariconfig datasourceconfig = new hikariconfig(); datasourceconfig.setdriverclassname(env.getrequiredproperty(property_name_db_driver_class)); datasourceconfig.setjdbcurl(env.getrequiredproperty(property_name_db_url)); datasourceconfig.setusername(env.getrequiredproperty(property_name_db_user)); datasourceconfig.setpassword(env.getrequiredproperty(property_name_db_password)); return new hikaridatasource(datasourceconfig); } i think second approach better because not tied specefic server, means if use first approach , 1 day migrate server must adapt strategie of context file in second server (not true ?). thanks some points first approach (jndi lookup of datasource defined in con...

css - How to do split select like ui bootstrap slipt dropdown -

i want split normal selectbox should default ui bootstrap dropdown. have used uibootstrap dropdown, problem selected dropdown value not displayed on top normal dropdown do. please let me know how split select.? you can use current selected item button label ui bootstrap split button this: <!-- split button --> <div class="btn-group dropdown" uib-dropdown="" style=""> <button id="split-button" type="button" class="btn btn-danger">{{selecteditem || 'choose item'}}</button> <button type="button" class="btn btn-danger dropdown-toggle" uib-dropdown-toggle="" aria-haspopup="true" aria-expanded="true"> <span class="caret"></span> </button> <ul uib-dropdown-menu="" role="menu" aria-labelledby="split-button" class="dropdown-menu"> <li role=...

php - Send Email to Customer Information on Stripe -

i trying pass email stripe checkout charge.php page send dashboard users confirmation email. here working code: <input class="form-control" type="number" id="custom-donation-amount" placeholder="50.00" min="0" value="50" step="10.00"/> <script src="https://checkout.stripe.com/checkout.js"></script> <button id="custombutton" class="pay-button"> <h4 class="donate-text button">donate <img src="http://#.com/testing/credit-card.png" ></h4> </button> <script> var handler = stripecheckout.configure({ key: 'pk_test_*************', image: 'assets/img/#.png', locale: 'auto', token: function(token) { //this sending custom amount, works great. thought same email. $.post( "charge.php", { stripetoken: token.id, amount:$...

powershell - Is it possible for DSC to deal with the creation and advanced configuration of Virtual Machines? -

i'm trying create configuration, using powershell dsc, me create sharepoint farm using virtual machines. assuming have windows 10 machine hyper-v installed configuration script create required vms, example dc, spa1, spw1, spw2 , spdb1, configure network connections , connect domain controller (dc1), proceed install sharepoint/sql server prerequisites , installation before going on configure farm, once available. i've created configurations complete various stages unable figure out how connect them work in orchestrated manor. example can create vms or perform install , configuration of sharepoint can't these configurations work in tandem. having read dsc documentation thought might possible using composite resources unable configuration continue onto new virtual machine after creation. from composite resource documentation: configuration renamevm { import-dscresource -module testcompositeresource node localhost { xvirtualmachine vm ...

java - fragment not refreshing immediately in android -

i want likes posted on home page fragment. counts not add in profile page fragments,taking time load count. this code postfragment . public class postfragment extends fragment { listview recyclerview; custompostadapter adapter; private list<feeditem> feedslist = new arraylist<feeditem>(); private string liveurl,liveurl1, userid; public static final string my_prefs_name = "myprefsfile"; public static final string tag = "postfragment"; imagebutton btnback; textview emptyview; boolean delete=false; string like="like",unlike="unlike"; //progresswheel progresswheel pw; resetpasswordactivity obj=new resetpasswordactivity(); public postfragment() { // required empty public constructor } public static fragment newinstance(string userid) { fragment fragment = new postfragment(); bundle args = new bundle(); args.putstring("userid...

ios - i can not import swiftHTTP (rapidAPI) -

i add swifthttp.xcodeproject project, in build phases: add 4 swifthttp.framework viewcontroller --- import swifthttp error = "no such module swifthttp" both xcode 6.4 , 7.1 have error do either in settings of project: depending if want "include library in final release or not" without, use whilst debugging , coding: 1) under general settings says "linked frameworks , libraries" @ bottom, click on + below , choose framework list appears with it: 2) under general settings says "embedded binaries" @ bottom, click on + below , choose framework list appears i'd suggest sticking "linking it" rather embedding until release code. cheers, a

c - isdigit() and isalpha() return type 0? or whats going on here.? -

#include <stdio.h> #include <ctype.h> void printsquare( char c, int size); int main(){ int usernum; char userchar; printf("enter character : \n"); scanf("%s",&userchar); while(isalpha(userchar) == 0){ printf("enter character : \n"); scanf("%s",&userchar); } printf("enter number(3-10) : \n"); scanf("%d",&usernum); while(isdigit(usernum) == 0){ printf("enter number(3-10) : \n"); scanf("%d",&usernum); } printsquare(userchar,usernum); } /*printsquare function gets char , number user, number user enters how many letters , rows printed output. so if user enters 'a' , number '3' output abc \n bcd \n cde im having trouble validation in main. using function isalpha() check if return value if 0, if yes continue prompting user char tried doing same thing isdigit() goes infite lo...

html - asp:TextBox with TextMode="MultiLine" Wrap="True" will not wrap -

update: below question still valid, tested page in chrome , works expected. when hit page in ie not wrap. start researching difference. let me know if know of ie fix this. thanks i have asp:textbox not wrap. i've run across multiple articles must have textmode="multiline" wrap="true" , , do, text still runs out of text box. i don't think need post full page, tell me if do. here's asp:textbox, , css class acting on <td> . please let me know if see why text not wrapping?! <td class="auto-style130" > <asp:textbox id="lbl_pain1_drug" width="400px" runat="server" rows="4" textmode="multiline" wrap="true" readonly="true" borderstyle="none" borderwidth="0" font-names="tahoma" height="55px" style="overflow:hidden" ...

html - MYSQL sort by desc or asc -

below website add sort of image sorter when button clicked sort image asc/desc depending on image date. since haven't specified problem, here basic mysql code problem. select column_name table_name order column_name asc \ desc; order by asc \ desc responsible making order. other things usual mysql elements

javascript - CSS3 Animations on mobile browsers -

so presently developing webapp used via mobile devices. i using animate.css animations. while animations work fine on desktop browser, laggy , uneven on mobile browser. since animate.css using plain css3 animations, don't understand why animations not working. so, why mobile browsers bad in rendering css3 animations ? is there faster way render animations on mobile browser ? (for eg. using javascript maybe)

java - Found class io.netty.buffer.ByteBuf, but interface was expected -

i have tried several versions of netty-all doesnt seem work. idea going wrong ? exception in thread "main" java.lang.incompatibleclasschangeerror: found class io.netty.buffer.bytebuf, interface expected @ org.vertx.java.core.buffer.buffer.<init>(buffer.java:72) @ org.vertx.java.core.eventbus.impl.defaulteventbus.<clinit>(defaulteventbus.java:58) @ org.vertx.java.core.impl.defaultvertx.<init>(defaultvertx.java:73) @ org.vertx.java.core.impl.defaultvertxfactory.createvertx(defaultvertxfactory.java:29) @ org.vertx.java.core.vertxfactory.newvertx(vertxfactory.java:33) @ osiam.createuser.main(createuser.java:21)

groovy - How can I execute SQL file which contains several other SQL files using gradle? -

how can execute sql file contains several other sql files using gradle? i tried using following code: gradle.class.classloader.addurl(new file('sql/ojdbc6.jar').touri().tourl()) def sql = groovy.sql.sql.newinstance(jdbcurl, db_prop_schema, db_prop_password, 'oracle.jdbc.driver.oracledriver') string sqlfilepath = "testsql.sql" string sqlstring = new file(sqlfilepath).text sql.execute(sqlstring) sql.close()

ios - AFNetworking 2.0 Send Post Request with array of dictionary Parameters -

i want try post parameter in following api parameter not getting passed properly, , response received gives message that, data required. can please sort out problem. my url forapp.com/api/getcontacts.php?data=[ {"name":"abc","phone":"1234567890"},{"name":"kate bell","phone":"9925992599"} ] so how can pass type of request api afhttprequestoperationmanager *manager = [afhttprequestoperationmanager manager]; nsdictionary *params = @{@"name": @"hello", @"phone": @"1234567890"}; nslog(@"dict %@",params); manager.responseserializer.acceptablecontenttypes = [manager.responseserializer.acceptablecontenttypes setbyaddingobject:@"text/html"]; [manager post:@"http://forapp.com/api/getcontacts.php" parameters:params success:^(afhttprequestoperation *operation, id responseobject) { ...

serialization - How to serialize groovys LazyMap in Java -

i use distributed java application groovy scripting support. when comes serialization notserializableexception groovys lazymap . checked source code of lazymap , not seem preventing serialization. how can use java serialization on such objects? should byte code manipulate or there easier way? since talking distributed applications 1 can assume talking huge amount of data , therefore want avoid recursively copy laymap one. i wrap possible groovy objects wrapper class , use kryo inside of class, seems work quite (at least prototype). public class wrapper implements serializable { private static final long serialversionuid = 889826451319869803l; private transient object wrapped; public wrapper() { } public wrapper(object wrapped) { this.wrapped = wrapped; } private void writeobject(java.io.objectoutputstream stream) throws ioexception { kryo kryo = new kryo(); bytearrayoutputstream bos = new bytearrayoutputstream(); ...

javascript - Use laravel elixir to transpile es6 that uses "import" statements -

trying use laravel-elixir transpile code working fine jspm, following snippets, end result error in browser complaining jquery not being loaded ( uncaught referenceerror: $ not defined ). i'm told because browserify needs run babelify transform (or run in babelify transform mode?), not sure means, obvious first time experience these tools. app.js import $ 'jquery'; import pbnumberset './class/pbnumberset'; var primary = new pbnumberset('#primary_pbset'); gulpfile gulp.task('default', () => { var elixir = require('laravel-elixir'); elixir(function(mix) { mix.sass('app.scss') .browserify([ 'app.js' ], 'public/js/app.js') .version([ 'css/app.css', 'js/app.js' ]); }); }); the generated file: if use $ in pbnumberset.js, should import $ in file, not in app.js. i sup...

yii2 - How to remove first word from string that ends with forwordslash(/) in php -

$pathinfo = $_server['redirect_url']; this code , return: /google/agency/create however, need agency/create /google dynamic word. you can explode url string, unset first value , implode again. <?php $url = "/google/agency/create"; $exp = explode("/", trim($url, "/")); // trim '/' url , explode unset($exp[0]); // unset first value $final_arr = implode("/", $exp); // form string again print_r($final_arr); ?> output: agency/create working example

asp.net - Return Database Name Dynamically -

i using entity framework asp.net need return database name dynamically model using following code return empty string resturantentities db = new resturantentities(); string databasename = db.connection.database; any

Android Support Repository doesn't show up in Android Studio SDK Manager -

Image
as trying use espresso android test tools, need add android support repository in sdk, cannot find it, nor can find standalone manager. sdks , android studio latest version. in sdk manager, android support repository called local maven repository support libraries .

php - cant insert the difference of this into table -

this insert section $total_minutes , $total_hour cant inserted in table $year = $_post['year']; $month = $_post['month']; $day = $_post['day']; $hour = $_post['hour']; $min = $_post['min']; $sec = $_post['sec']; $year1 = $_post['year1']; $month1 = $_post['month1']; $day1 = $_post['day1']; $hour1 = $_post['hour1']; $min1 = $_post['min1']; $sec1 = $_post['sec1']; $time_in = $year.'-'.$month.'-'.$day.' '.$hour.'-'.$min.'-'.$sec; $time_out = $year1.'-'.$month1.'-'.$day1.' '.$hour1.'-'.$min1.'-'.$sec1; $total_minutes = $total_min; $total_hour = $total_hr; $sql = "insert time (year, month, day, hour, min, sec, year1, month1, day1, hour1, min1, sec1, time_in, time_out, total_minutes, total_hour) values ('$year','$month','$day','$hour','$mi...

csv - Read Excel lines into Python -

i want import data lines saved in excel csv. how can save each line's data list? the excel file has following type of data: name b c d itemid 3 3 4 height 5 5 7 length 6 5 8 i want save [b,c,d] in list named name , , [3,3,4] list named itemid . tried used following code, returns last line of file. f = open('part.csv', 'r') csv_f=csv.reader(f,delimiiter=',') row in csv_f: name.append(row[1]) numid.append(row[2]) height.append(row[3]) length.append(row[4]) highly recommend consider using pandas python data analysis library. import pandas pd csv_df = pd.read_csv('part.csv') df_t = csv_df.t print df_t['itemid'].tolist() print df_t.index.tolist()

asp.net - Unable to access website externally from windows server 2012 r2 -

added dns entries site. when i'm hitting www.site.example.com in browser i'm getting windows server iis screen. when i'm hitting www.site.example.com:83 no screen displayed , browser showing error this site can’t reached . when on server i'm hitting localhost:83 works expected. you should check firewall allows connections on port 83. plus if using azure, amazon ec2 or similar, have allow port 83 there too

Populating a treeview with two tables using vb.net -

Image
hello have 2 tables: then want result using treeview: id department category 1 mis system 1 mis networking 1 mis programmer 2 audit operations 2 audit ds 3 hrd pa 3 hrd payben 3 hrd ps 3 hrd pld 4 acounting sup 4 acounting fmcg 5 procurement null or this mis -system -networking -programmer audit -operations -ds hrd -pa -payben -ps -pld acounting -sup -fmcg can please guide me, thank you. i'm having trouble finding solution on internet , i'm new vb.net language. in code below, give logic. need query tables now. tell me if need explanations. treeview1.nodes.clear() 'create first node , select dim root treenode = treeview1.nodes.add("test") tr...

angularjs - How to prevent an ui-router parameter override? -

i'm working on site multiple sub-routes, , i'd create simple url user profiles, example: mydomain.com/someusername but current ui-router state configuration, overrides of other urls, guess because considers other routes parameter too. .state('profile', { url: '/{username}', template: '...', controller: '...', }) .state('other', { url: '/other', template: '...', controller: '...', }); (like in example, 'other' state considered parameter in profile state) i've tried subclassing root state, didn't worked either. can around problem using keyword in front of usernames (eg: mydomain.com/user/someusername ), that's bit more complicated user experience viewpoint. is there way i'm trying to? the order of state definition important.. switch them // more specific .state('other', { url: '/other', template: '...', controller: '......

javascript - Convert numerous inputs values into array of values -

i have several textbox below: <input type="text" id="name1" name="name1"> <input type="text" id="name2" name="name2"> <input type="text" id="name3" name="name3"> <input type="text" id="name4" name="name4"> need pass save values in array (name[]) , want receive data "name[]" the server side file use php $_post['name'] fetch data. thanks. one of many solutions can function myfunction() { var result = []; var x = document.queryselectorall("[name^=name]"); (var = 0; < x.length ; i++){ result.push(x[i].value); } }

Error connecting to Firebird with JDBC -

i trying connect java application firebird database (i don't have access source code). the application requires driver class, jdbc url, username , password. no matter parameters passing, getting following exception: error trying connect 'jdbc:firebirdsql://localhost:3050/c:/temp/employee.fdb': specified properties contain reference dpb parameter under original , alias names: original name isc_dpb_password, alias : password

php - insert postgis geometry with GET values -

i'm trying make insert using st_makepoint values, run 500 error. this php code: <?php try { $user = 'user'; $dbh = new pdo('pgsql:host=localhost;dbname=userdb', $user); $stmt = $dbh->prepare("insert table(id_a, id_b, geom) values (?,?,?);"); if ($stmt->execute(array($_get['id_a'], $_get['id_b'], st_setsrid(st_makepoint($_get['lat'], $_get['long']),4326)))) { print_r("ok"); } else { print_r("error"); } } catch (pdoexception $e) { print "error!: " . $e->getmessage() . "<br/>"; die(); } ?> if run query pgadmin, runs well: insert table(id_a, id_b, geom) values (1,1,st_setsrid(st_makepoint(2, 2),4326)); do know how fix problem in php code? i solved in way: $stmt = $dbh->prepare("insert table(id_a, id_b, geom) values (?,?,st_setsrid(st_makepoint(?, ?),4326));"); if ($stmt->e...

Filtering search results with django-haystack / solr produces solr syntax error -

i think may have identified bug in haystack / solr i'm not sure , wanted see if i'm doing wrong first. i'm using: django 1.8 haystack 2.4.1 solr 4.10.4 when try filter searchqueryset, solr complains of invalid syntax on filter query genenerated haystack. bizarrely, stepping through code in pdb works, fails under normal circumstances. relevant portion of code is: # built query string resolves applicable_filters = {'job_type__in':['pe', 'te'], 'sector__in':['12','13']} # query. sqs = searchqueryset().models(self._meta.queryset.model).filter(**applicable_filters).order_by(order).load_all().auto_query(request.get.get('q', '')) if not sqs: sqs = emptysearchqueryset() when executing query, solr throws following: [vagrant@127.0.0.1:2222] out: failed query solr using '(job_type:("pe" or "te") , sector:("12" or "13") , )': [reason...

java - Not able to locate FactoryRegistry class when using GeoTools -

i trying load , parse shapefile using geotools library. however, when try load file following call resulting dependency failure org.geotools.factory.factoryregistry : datastore newstore = datastorefinder.getdatastore(connect); error: org/geotools/factory/factoryregistry java.lang.noclassdeffounderror: org/geotools/factory/factoryregistry i have included following dependencies in gradle: compile files ('libs/geotools/gt-opengis-14.2.jar') compile files ('libs/geotools/gt-api-14.2.jar') compile files ('libs/geotools/gt-shapefile-14.2.jar') compile files ('libs/geotools/gt-cql-14.2.jar') compile files ('libs/geotools/gt-main-14.2.jar') compile files ('libs/geotools/gt-referencing-14.2.jar') compile files ('libs/geotools/gt-epsg-hsql-14.2.jar') i not sure if of them needed none of them have missing class. there other dependency missing? class documented here . the easy answer problem use maven manage dependenc...

c# - Convert Code from Unity 4 To Unity 5 -

i new installed unity 5. have problem in code. if (transform.parent.rigidbody) parentmagnitude = transform.parent.rigidbody.velocity.magnitude * 0.05f; you can't access rigidbody old shorthand code. rigidbody rb = transform.parent.getcomponent<rigidbody>(); if(rb != null) { parentmagnitude = rb.velocity.magnitude * 0.05f; }

ios - show a button through alertview button in view controller -

i have alertview appears every time when app launched. want show button on viewcontroller when clicked show button of alertview when clicked on cancel button button not show. using code this. - (void )alertview:(uialertview *)alertview clickedbuttonatindex:(nsinteger)buttonindex { if (buttonindex == 0) { viewcontroller *controller = [[viewcontroller alloc]init]; controller.button.hidden= no; } and in viewcontroller create outlet of button. , done below code in view did load of view controller unable show button - (void)viewdidload { [super viewdidload]; self.button.hidden = yes; } uialertview deprecated. use uialertcontroller preferredstyle of uialertcontrollerstylealert instead. https://developer.apple.com/library/ios/documentation/uikit/reference/uialertcontroller_class/ - (void)viewdidload { [super viewdidload]; //init hide button self.button.hidden = yes; uialertcontroller *alert = [uialertcontroller alertcontrollerwithtitle:@...

java - How to check String values equal null? -

this question has answer here: check whether string not null , not empty 24 answers i'm new in java programming. have problem when have string variable equals null. when check condition on string error : exception in thread "main" java.lang.nullpointerexception . this code : public class test { static string a=null; public static void main(string[] args) { if(a.equals(null)){ system.out.println("null"); } } } instead of a.equals(null) should doing a == null . if(a == null) { system.out.println("null"); } alternatively, can use stringutils check if string null or empty doing: if(stringutils.isempty(a)) { system.out.println("null"); }

Avoid download of previously downloaded files using Java FTP -

i have desktop application downloads files on server.when new file added want download newer file. well know 1 "new one" have create map/or other datastructure , put pair of name/metadata creationtime(or last modified time)which 1 suits best , when iterate on files see metadata path file = ...; basicfileattributes attr = files.readattributes(file, basicfileattributes.class); attr.creationtime(); //or attr.lastmodifiedtime(); when compare these times 1 on server decide download 1 latest time. either way have keep track of @ least name/time modified(or created) @ previous download , compare these. if application on desktop not kind of service runs nonstop,find way persist data on system,serialization or embed database h2/hsqldb within it.use streams conncurent iteration/ parralelstream check these times , compare ,in case use java8 edit- metadata url, check question get last modified date of url

r - How to add the same inputs into two tabItems in shinydashboard? -

i using shinydashboard create interface of shiny app. want 1 input appear in 2 tabmenu. in example below, want textinput i_test appears in menu menu1 , menu2 . how should implement it? suggestions. library(shiny) library(shinydashboard) # side bar boardy sidebar <- dashboardsidebar( sidebarmenu( id = 'menu_tabs' , menuitem('menu1', tabname = 'menu1') , menuitem('menu2', tabname = 'menu2') , menuitem('menu3', tabname = 'menu3') ) ) # body board body <- dashboardbody( tabitems( tabitem( tabname = 'menu1', textinput('i_test', 'test') ), tabitem( tabname = 'menu2' ) ) ) # shiny ui ui <- dashboardpage( title = 'test', dashboardheader(), sidebar, body ) server <- function(input, output, session) { } shinyapp(ui, server) it seems sh...

angular - angular2 ngFormControl select not working -

my code fragment in .ts file this.signupform= _fb.group({ 'fname': ['',validators.compose([validators.required,ndformvalidation.alphaonly])] 'lname': ['',validators.compose([validators.required,ndformvalidation.alphaonly])], 'gender':['',validators.compose([validators.required,ndformvalidation.gender])] }); this.fname = this.signupform.controls['fname']; this.lname = this.signupform.controls['lname']; this.gender = this.signupform.controls['gender']; my code fragment in .html file <form [ngformmodel]="signupform" (ngsubmit)="onsubmit(signupform.value)"> <div class="input-field"> <label for="txtfirstname">first name</label> <input type="text" id="txtfirstname" [ngformcontrol]="fname" placeholder="john"/> <span *ngif="fname.haserror('required...

android - Inflation of View Failing -

Image
i've been trying programatically inflate linearlayout of buttons using loop, doesn't show in ui @ all. array gets populated, however. my button xml: <button xmlns:android="http://schemas.android.com/apk/res/android" style="@style/blackkey"> </button> my style resource: <style name="blackkey"> <item name="android:layout_height">0dp</item> <item name="android:layout_width">match_parent</item> <item name="android:layout_weight">2</item> <item name="android:background">@color/black</item> <item name="android:layout_margin">3dp</item> </style> my initialization code: container = (framelayout) findviewbyid(r.id.mainframe); public button [] blackkeys = new button[5]; linearlayout blackkeys = new linearlayout(this); blackkeys.setlayoutparams(new linearlayout.layoutparams(viewgroup.lay...

c# - Selenium not running when using [TestFixture(typeof(ChromerDriver))] -

so i've gone basics blank project test out, i'm trying use example... [testfixture(typeof(chromedriver))] public class testwithmultiplebrowsers<twebdriver> twebdriver : iwebdriver, new() { private iwebdriver driver; [setup] public void createdriver() { this.driver = new twebdriver(); } [test] public void googletest() { driver.navigate().gotourl("http://www.google.com/"); iwebelement query = driver.findelement(by.name("q")); query.sendkeys("bread" + keys.enter); thread.sleep(2000); assert.areequal("bread - google search", driver.title); driver.quit(); } } however not run. if remove testfixture typeof parameter though , set driver manually works fine. [testfixture] public class testwithmultiplebrowsers { private iwebdriver driver; [setup] public void createdriver() { this.driver = new chromedriver(); ...