Posts

Showing posts from May, 2012

performance - R: Speed up multiple lm() -

i want estimate parameters of non linear model. the model equation z = * exp(- * x) + b * exp(- b * y) + c x , y predictors a, b, a, b parameters estimate what did transform model linear problem doing exponential transformation before doing linear regression: for a , b between 0 , 1, compute exp_x = exp(- * x) , exp_y = exp(- b * y) i linear regression z ~ exp_x + exp_y it works can see in simulation x = 1:10 y = 1:10 combination = expand.grid(x = x, y = y) df = data.frame( x = combination$x, y = combination$y, z = 2 * exp(-0.3 * combination$x) + 5 * exp(-0.6 * combination$y) + rnorm(n = 100, mean = 0, sd = 0.1 ) ) a_hat = 0 b_hat = 0 best_ols = null best_rsquared = 0 (a in seq(0.01, 1, 0.01)){ (b in seq(0.01, 1, 0.01)){ df$exp_x = exp(- * df$x) df$exp_y = exp(- b *df$y) ols = lm(data = df, formula = z ~ exp_x + exp_y) r_squared = summary(ols)$r.squared if (r_squared > best_rsquared){ best_rsquared =...

c++ - how to create AVPacket manually with encoded AAC data to send mpegts? -

i'm developing app sends mpeg2ts stream using ffmpeg api.(avio_open, avformat_new_stream etc..) the problem app has aac-lc audio audio frame not need encoded because app bypass data received socket buffer. to open , send mpegts using ffmpeg, must have avformattcontext data created ffmpeg api encoder far know. can create avformatcontext manually encoded aac-lc data? or should decode , encode data? information know samplerate, codec, bitrate.. any appreciated. in advance. yes, can use encoded data as-is if container supports it. there 2 steps involved here - encoding , muxing. encoding compress data, muxing mixes in output file, packets interleaved. muxing example in ffmpeg distribution helped me this. you might take @ following class: https://sourceforge.net/p/karlyriceditor/code/head/tree/src/ffmpegvideoencoder.cpp - file 1 of projects, , contains video encoder. starting line 402 you'll see setup non-converted audio - kind of hackish way, worked. unfortu...

ruby on rails - "missing argument -c" when restarting Unicorn via Mina -

i trying deploy app server using mina , need server restarted automatically. unfortunately doesn't work , don't know why. here trying: require 'mina/bundler' require 'mina/rvm' require 'mina/rails' require 'mina/git' ... set :unicorn_conf, "#{shared_path}/config/unicorn.rb" set :unicorn_pid, "#{deploy_to}/current/tmp/pids/unicorn.pid" ... task :environment invoke :'rvm:use[ruby-2.2.3]' end task deploy: :environment deploy # put things prepare empty release folder here. # commands queued here run on new release directory. invoke :'git:clone' invoke :'deploy:link_shared_paths' invoke :'bundle:install' invoke :'rails:db_migrate' invoke :'rails:assets_precompile' invoke :restart_server end end task :restart_server if file.exists? unicorn_pid queue 'kill `cat #{unicorn_pid}`' end queue 'bundle exec unicor...

html - Works Cited page on website with everything except first line indented -

i have responsive site has bibliography. want text show works cited page, no matter width of browser is. so publications on page: http://www.lajsa.org/news-announcements/new-publications/ should have lines under first line indented 30px. image here: http://libguides.mjc.edu/mla/mlaworkscited i thought this: p { padding-left:30px;} p::first-line { padding-left: -30px !important;} or this: p:not(::first-line) { padding-left:30px;} but didn't work. here sample html: <p>aizenberg, edna. <em>on edge of holocaust: shoah in latin american literature , culture</em>. waltham: brandeis up/up of new england, 2016. 200 pp. 19 illustrations. isbn: 978-1-61168-856-6.</p> <p>aizenberg, edna. <em>parricide on pampa? new study , translation of alberto gerchunoff´s </em>los gauchos judíos. 2nd edition. madrid /frankfurt: iberoamericana /vervuert, 2015. 166 pp. isbn: 9788484898849. contains updated introduction , bibliography.</p> ...

Evoking and detaching bash scripts from current shell -

i'm have tad bit of difficulty developing bash based deployment scripts pipeline want run on openstack vm. there 4 scripts in total: head_node.sh - launches vm , attaches appropriate disk storage vm. once that's completed, runs scripts (2 , 3) sequentially passing command through ssh vm. install.sh - vm-side, installs of appropriate software needed pipeline. run.sh - vm-side, mounts storage on vm , downloads raw data object storage. runs final script, detaching process shell created ssh using nohup ./pipeline.sh & . reason want detach shell next portion largely compute , may take days finish. therefore, user shouldn't have keep shell open long , should run in background. pipeline.sh - vm-side, loop iterates through list of files, , sequential runs commands on , intermediate files. result analysed staged object storage. vm tells head node kill it. now i'm running problem nohup. if launch pipeline.sh script (i.e. without nohup) , keep attached shell, runs...

swift - https request working on chrome but not on iOS app -

i trying make ios app using swift requests data server. server running on https , when accessed using chrome, works fine. when try ios request, gives me error "nsurlsession/nsurlconnection http load failed (kcfstreamerrordomainssl, -9802)" i tried answers given allowing unsecured domains, secured domain (https not http). my ios code is: let url = nsurl(string: "https://subdomain.mydomain.com/homescreen.php?variablex=something") let task = nsurlsession.sharedsession().datataskwithurl(url!) {(data, response, error) in print(nsstring(data: data!, encoding: nsutf8stringencoding)as! string) self.embedlink = nsstring(data: data!, encoding: nsutf8stringencoding)as! string when run app , open in emulator crashes when click screen code in , displays "exc_bad_instruction (code=exc_i386_invop, subcode=0x0)" on third line - after as! string) and suggestions appreciated! for interested, solved issue. turns out there chain file ...

c# - The type or namespace name 'DescriptionAttribute' could not be found Asp.Net 5 -

i have simple class using system; using system.componentmodel; using system.reflection; namespace common { public static class extensionmethods { public static string description(this enum value) { fieldinfo fi = value.gettype().getfield(value.tostring()); descriptionattribute[] attributes = (descriptionattribute[])fi.getcustomattributes( typeof(descriptionattribute), false); if (attributes.length > 0) { return attributes[0].description; } return value.tostring(); } } } but i'm getting compile error - error cs0246 type or namespace name 'descriptionattribute' not found (are missing using directive or assembly reference?) my project.json { "version": "1.0.0-*", "description": "common class library", "authors": [ "bry...

jquery - Move an element one place up or down in the dom tree with javascript -

i want javascript way move element 1 place or down in dom tree within particular known parent using javascript (or jquery ok), want script know when element first or last element within parent , not moved. example, if have following ... <div id='parent_div'> <div id='div_1'></div> <div id='div_2'></div> <div id='div_3'></div> </div> on click of button, want pass known id (let's div_2 ) , move position above it, swapping position element before (in case div_1 ). ids of elements don't have change, , new position doesn't need known, @ least not unless moved again. with jquery: var e = $("#div_2"); // move up: e.prev().insertafter(e); // move down: e.next().insertbefore(e);

tkinter - Need help for a Python Snake game -

i'm creating snake game on python using tkinter library. right now, i've implemented movements, food system, , score system. still need on how can make snake grow when eats food. here's code (it's working , can test out!): from tkinter import * import os random import randint #coded nociph/alteus #---setting variables--- gamewindow = tk() gamewindow.title("atsnake") playerx1 = 100 playery1 = 100 playermov = 0 alreadymove = 0 foodx1 = 10 foodx2 = 20 foody1 = 10 foody2 = 20 foodpresent = 0 score = 0 def key(event): global playermov global alreadymove if event.char == 'z' , playermov != 3: playermov = 1 print("input:",event.char,"playerx1: ",playerx1," - playery1",playery1,"up") if event.char == 'q' , playermov != 4: playermov = 2 print("input:",event.char,"playerx1: ",playerx1," - playery1",playery1,"left...

How to get state from parent in react native? -

i have tabnavigator : <tabnavigator> <tabnavigator.item selected={this.state.selectedtab === 'home'} title="home" rendericon={() => <image source={icon1}/>} renderselectedicon={() => <image source={require('./img/slider-left.png')}/>} onpress={() => this.setstate({ selectedtab: 'home' })} > <mainnav selectedtab={this.state.selectedtab} getselectedtab = {() => this.state.selectedtab}/> </tabnavigator.item> <tabnavigator.item selected={this.state.selectedtab === 'profile'} title="profile" rendericon={() => <image source={icon1}/>} renderselectedicon={() => <image source={icon1}/>} onpress={() => this.setst...

mysql - Select from two tables without primary key but same three column field in sql -

my 2 tables has no primary key have same 3 column field.i select 2 tables , come out result following: table1: no code row price 001 0001 1 100 001 0001 2 200 002 0001 1 300 table2: no code row qty date 001 0001 1 10 2016 001 0001 2 20 2017 result table: no code row price qty date row2 001 0001 1 100 10 2016 1 001 0001 1 100 10 2016 2 001 0001 2 200 20 2017 1 001 0001 2 200 20 2017 2 my sql: select t2.no,t2.code,t2.row,t1.price,t2.qty,t2.date,t1.row row2 table1 t1 join table2 t2 on t1.no = t2.no , t1.code = t2.code order t2.code,t1.row i want result come out this: no code row price qty date row2 001 0001 1 100 10 2016 1 001 0001 2 200 20 2017 2 what should write sql? please advice me.. i'm new sql. if modify quer...

typescript - VS2015 + Cordova Unit Testing Excludes -

Image
i have vs2015 + cordova + typescript project includes unit testing. have tests folder unit .spec.ts files. is possible exclude folders (example ./scripts/test ) in root /scripts folder when publishing , still keep typescript intellisense excluded folder? note: aware of adding exclude attribute tsconfig.json file, when loose intellisense in .spec.ts files in ./scripts/test folder. ideally, when unit testing, run gulp script ( karma + jasmine ) compile ./script typescript files , place .karma folder. when publish project ios, android, windows devices using vs2015 exclude unit test file in app. it's not big problem, improve workflow , still rely on vs2015 publish mobile devices. maybe adding gulp file after build binding cleanup www/script/**/*.spec.js files solution?

ios - App gives exception on launch when added Exception Breakpoint in debugger -

Image
i developing tabbar based application , on launching app in debug mode exception @ app launch. this happened when add exception breakpoint. although can move ahead when switching breakpoint off , app can still run. wanted figure out why happening. i have attached stack track snapshot seen on thread 1 when debugger stops.

python - traversing two lists simultaneously with multiple iterators -

i trying write simple program looks through 2 text files , reports differences between 2 files. function, have 2 lists contain list of words each line (so they're 2d lists). go through , compare each word , report error if not same, storing of errors in list printed user. i iterator report line of error , 2 words reported. def compare(lines1, lines2): i, line1, line2 in izip(lines1, lines2): word1, word2 in izip(line1, line2): if word1 != word2: report_error(i, word1, word2) however, not working me. read on stackoverflow need use zip() or izip() function read 2 lists @ once still isn't working me. getting following error. file "debugger.py", line 28, in compare i, line1, line2 in izip(lines1, lines2): valueerror: need more 2 values unpack any idea i'm doing wrong? can provide full file if helpful. zip() , , similar functions, produce tuple s of length equal number of passed arguments. for word1,...

I can't seem to get Java to read my text document -

import java.util.scanner; public class average { public void average() { scanner in = (new scanner("j:\\ap comptuter science\\semester 2\\exeptions\\13.1\\numbers.txt")); try{ string test = in.nextline(); } catch(nullpointerexception i) { system.out.println("error: " + i.getmessage()); } int total = 0; int counter = 0; while(in.hasnextint()){ total = total + in.nextint(); counter++; } total = total / counter; system.out.println(total); } } i have project ap comp class , did work according notes, file "numbers" isn't being read , answer 0 when should huge number. firstly should correct path, , put in same directory class files. , instead of providing path scanner should give file. should this. import java.io.file; import java.io.filenotfoundexception; import java.util.scanner; public class averag...

java - Error:(136, 81) error: incompatible types: String cannot be converted to int -

i'm wanted show progress bar in listview . below code part of mycustombaseadapter . public class mycustombaseadapter extends baseadapter{ // listview private static arraylist<searchresults> searcharraylist; relativelayout footerlayout; private layoutinflater minflater; listview listview; public mycustombaseadapter(context context, arraylist<searchresults> results,listview listview,relativelayout footerlayout) { searcharraylist = results; this.listview=listview; this.footerlayout=footerlayout; minflater = layoutinflater.from(context); addorremovefooter(); } public view getview(int position, view convertview, viewgroup parent) { final searchresults search=getitem(position); viewholder holder; if (convertview == null) { convertview = minflater.inflate(r.layout.custom_row_view, null); holder = new viewholder(); holder.txtproject= (text...

javascript - Hover over menu element to show submenu -

i trying create menu has sub-menu (not dropdown) slides in left-to-right, when mouseover; , right-to-left when mouseout. jsfiddle: https://jsfiddle.net/z40xo01d/4/ two vertical menus side-by-side: html code: <aside class="nav-container"> <!--main navigation structure--> <ul id="nav-main"> <a href="#"><li class="fa fa-home fa-2x" id="home"></li><br/></a> <a href="#"><li class="fa fa-folder fa-2x" id="projects"></li><br/></a> <a href="#"><li class="fa fa-user fa-2x" id="about"></li><br/></a> <a href="#"><li class="fa fa-envelope fa-2x" id="contact"></li><br/></a> <!--additional navigation buttons--> <div id="nav-additionals"> ...

visual studio 2013 - Setup continuous integration / delivery on-premise with source control pointing to VS team services? -

our project development effort uses visual studio 2013 on our government client laptops, pull source code visual studio team services (externally). best approach setup continuous integration & delivery on our government servers (dev, staging , prod)? none of servers have internet access. you need continuous integration server installed on 1 of machines access visual studio team services, can setup tasks on ci server deployment on other machines not have access vsts. use teamcity ci server of choice, other ci servers have similar capabilities. to setup teamcity vsts see http://blog.jetbrains.com/teamcity/2014/09/teamcity-and-visual-studio-online-source-control/ to setup teamcity deploy asp.net applications see https://blog.jetbrains.com/teamcity/2014/04/continuous-delivery-to-iis-or-windows-azure-web-sites/

c++ - UrlToDownloadFile function not downloading -

i using urltodownloadfile function, doesn't download file. no error shown in compiler (using vstudio 2012) here code: #include <windows.h> #include "urlmon.h" #pragma lib "urlmon.lib" using namespace std; void dwfile(); int _tmain(int argc, _tchar* argv[]) { dwfile (); return 0; } void dwfile () { lpcstr url = ("http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2012/n3337.pdf"); lpcstr fpath = ("c:\\users\\andyy\\desktop\\test\\n3337.pdf"); hresult urldownloadtofile ((null, url, fpath, 0, null)); } your code not doing error handling, , string handling wrong. use instead: #include <windows.h> #include "urlmon.h" #pragma lib "urlmon.lib" using namespace std; void dwfile(); int _tmain(int argc, _tchar* argv[]) { dwfile (); return 0; } void dwfile () { lpctstr url = text("http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2012/n3337.pdf");...

api - Is it possible to load session by SID in php? -

i working on api, default cookies used, should possile load session data sid. so, scenario looks following: client makes request cookie and/or sid parameter we check, if sid defined - load session data sid if sid not defined - use sid, defined in cookie my first idea use session_id() function load session data specified sid, found function not - overwrites current session id, not load data specified sid. is possible load different session in php different sid? you need use session_id before call session_start

sql - Query all dates less than the given date (Month and Year) -

i have table: tblperson there 3 columns in tblperson id amort_date total_amort c000000004 12/30/2015 4584.00 c000000004 01/31/2016 4584.00 c000000004 02/28/2016 4584.00 the user have provide billing date @bill_date i want sum total amort of less date given user on month , year basis regardless of date for example @bill_date = '1/16/2016' result should: id sum_total_amort c000000004 9168.00 regardless of date want sum amort less january 2016 this query computes date january 2016, not include dates less it: declare @bill_date date set @bill_date='1/20/2016' declare @month int=month(@bill_date) declare @year int=year(@bill_date) select id,sum(total_amort)as'sum_total_amort' webloan.dbo.amort_guide loan_no='c000000004' , month(amort_date) = @month , year(amort_date) = @year group id you use aggregation , inequalities: select id, sum(total_am...

c# - Get parameter from url asp.net mvc 4 -

i want parameter url below: www.domain.com/controller/action/parameter in controller: public actionresult action() { //some codes } user enters url above , should navigate the specific controller. how 'parameter' in action of controller? example public actionresult action() { string param1 = this.request.querystring["param"]; }

typescript - How to add form values of a component which are created using dynamic component loader? -

i have component loads using dcl. want add control group parent form.i have made plunker demo . dont know how bind child control group parent. add() { this._dcl.loadintolocation(dynamiccmp, this._e, 'location').then((ref) => { ref.instance._ref = ref; ref.instance._idx = this.idx++; this._children.push(ref); }); } and how adding components.somebody please tell me how add child controls control in parent form i don't think can pass dlc component or vice versa. can do, , think handier solution use: this.completeform.addcontrol("sku", new control) look @ plunker: http://plnkr.co/edit/mahozqqkyv613n1ntelf?p=preview

pep8 - One Line if in Python Code Style -

looking this: if exits: sys.exit(msg) if not result: print(msg) if result: return msg how apply python code style? you can use 1 line if this: import sys sys.exit(msg) if exits else (msg if result else sys.stdout.write(msg))

Use rvm to force specific Ruby in Xcode Run Script build phase -

outside of xcode use specific version of ruby, using rvm manage multiple ruby installations. apple's command line dev tools install ruby @ /usr/bin/ruby , version 1.8.7. i use 1.9.3 through rvm. is there way force xcode use 1.9.3 installation when running run script build phases? i tried setting shell path full path of specific ruby, didn't seem make difference, mean particular gems have installed in 1.9.3 weren't available/visible script when run within xcode. if run project through xcodebuild on command line, run script phase uses specific ruby because it's being run within shell environment (even if shell path in project file set /usr/bin/ruby , still uses 1.9.3). what can make ide use 1.9.3 ruby install? try @ beginning of script in xcode: source "$home/.rvm/scripts/rvm"

add unique id to elements inside div using javascript -

i want add unique id each paragraph element inside function 'chatsubmit' seen in below code. dom generated dynamically , paragraph has id textdisplay has different newly added dom elements. here demo in fiddle: https://jsfiddle.net/phaneendra/89v4a7m3/ <div class="userlist"> <ul> <li onclick="openchat(this)">user1</li> <li onclick="openchat(this)">user2</li> <li onclick="openchat(this)">user3</li> <li onclick="openchat(this)">user4</li> <li onclick="openchat(this)">user5</li> </ul> </div> <div id="main"></div> function chatsubmit(form){ var sendinput = form.input; if(sendinput.value != ""){ var message = sendinput.value; var username = document.getelementbyid("username").innerhtml; docume...

angularjs - Ionic App launch external android app? -

how launch external android app ionic application. want connect pos printer app printing bill. cordova-npm plugin printer can't work printer. install pos printer android application on tablet want integrate ionic app , pos printing app install: cordova plugin add com.lampa.startapp install: cordova plugin add https://github.com/lampaa/com.lampa.startapp.git finally in ionic call external installed app: $scope.printer = function () { navigator.startapp.start("com.example.possdkforandroid", function (message) { /* success */ alert(" navigator called"); alert(message); }, function (error) { /* error */ console.log(error); alert(error); }); }

php - Why is JSON returning null? -

Image
i 'm making application handles registration.i use php mysql.when register ,the details entered correctly inserted table when echoed response returns null message. here picture when in application null json feed can't proceed further. what want is message should either success or failure.i don't know whats wong code.here php code: <?php include_once './dbconnect.php'; function createnewprediction() { $response = array(); $name = $_post["name"]; $college = $_post["college"]; $mobile = ($_post["mobile_no_"]); var_dump( $mobile); $email = $_post["email"]; $db = new dbconnect(); // mysql query mysql_query('set character set utf8'); $query = "insert register(name,college,mobile,email) values('{$name}','{$college}','{$mobile}','{$email}')"; $result = mysql_query($query) or die(mysql_error()); if ($resu...

automation - How to automate localization testing of WEB app? Selenium + Java -

need automate localization testing of web based application. there more 30 languages. automation of localization testing indeed interesting problem approach. give no details, here 2 things can start with: 1. obvious 1 comparing string content of elements on web page desired translation. 2. can (and should) combine first 1 making screenshots , looking them through make sure translation looks ok on page , doesn't brake layout or something. easier come more suggestions if give more info have tried and, maybe details of app trying test.

excel - I want to delete first characters in a cell and show it in another cell -

i want delete letters before date 20-01-2016 in cell for eg:- 19-01-2016 not on 20-01-2016 want leave 19-01-2016 half day on 20-01-2016 not feeling well 19-01-2016 chair broken on 20-01-2016 cup of tea image assuming data in separate rows in same column shown in image provided like: =right(a1,len(a1)-find("20-01-2016",a1)+1) copied down column b work.

jboss - Active Directory scanning and role mapping -

i running jbpm in jboss wildfly 8 , configured use active directory authentication. configuration follows: <security-domain name="jbpm_ldap_domain"> <authentication> <login-module code="ldapextended" flag="required"> <module-option name="java.naming.factory.initial" value="com.sun.jndi.ldap.ldapctxfactory"/> <module-option name="java.naming.provider.url" value="ldap://serverip"/> <module-option name="java.naming.security.authentication" value="simple" /> <module-option name="binddn" value="cn=administrator,cn=users,dc=domain,dc=com"/> <module-option name="bindcredential" value="secretpass"/> <module-option name="basectxdn" value="ou=myou,dc=domain,dc=com"/> <module-option name=...

java - Editing an already existing text file -

i'm trying edit existing file had created , far have no clue on how it's done. can show me how , please explain line line on code does? import java.io.*; public class hey { public static void main(string[] args)throws exception{ bufferedreader br = new bufferedreader (new inputstreamreader(system.in)); system.out.println("title"); string title = br.readline(); file f = new file(title +".txt"); f.createnewfile(); filewriter fw = new filewriter(f); bufferedwriter bw = new bufferedwriter(fw); system.out.println("what want input in text"); string text = br.readline(); bw.write(text); bw.flush(); bw.close(); } } bufferedreader br = new bufferedreader (new inputstreamreader(system.in)); creates read buffer standard input. string title = br.readline(); reads buffer until there's return character sequence found ('\n...

machine learning - How to use pickled file as dataset for keras -

i have build own dataset digit classification , worked convolutional network model developed lisa lab ( here ). wanted visualize weights , wanted through keras. keras documentation tries load mnist data this: (x_train, y_train), (x_test, y_test) = mnist.load_data() but want pickled dataset load instead of mnist default data. mnist module keras load it's dataset ? and, how can pass own dataset instead of use mnist module keras ? thanks in advance. you can lot of info method reading source: https://github.com/fchollet/keras/blob/master/keras/datasets/mnist.py in case, dataset pickle file loaded amazon s3 bucket. you write copy of function , use load different pickled dataset.

ios - SCRecorder : How to create SCRecordSession from local video -

i use screcorder customize videos. want import somes local videos make longer video , save camera roll . use screcord lib implement it. first, make each screcordsegment each local video: filepath = [nsstring stringwithformat:@"%@/%@", documentsdirectory,[nsstring stringwithformat:@"%@.mp4",videotitle]]; // create screcordsessionsegment *record = [[screcordsessionsegment alloc] initwithurl:[nsurl urlwithstring:filepath] info:nil]; then create recordsession : screcordsession *recordsession = [screcordsession recordsession]; [recordsession addsegment:record]; but crashes when save camera roll . - (void)savetocameraroll : (screcordsession *)recordsession{ self.navigationitem.rightbarbuttonitem.enabled = no; scassetexportsession *exportsession = [[scassetexportsession alloc] initwithasset:recordsession.assetrepresentingsegments]; exportsession.videoconfiguration.filter = nil; exportsession.videoconfiguration.preset = scpresethighestquality...

printing - WinAPI call to DeviceCapabilities(DC_ENUMRESOLUTIONS) for Epson P50 always report error -

i'm faced strange behaviour - seems impossible enum resolutions epson ink printers in windows. in particular code reports error: int r, err; char szbuffer[0x4000]; string prnname = "epson p50 series"; string portname = "usb002"; r = devicecapabilities(prnname.c_str(), portname.c_str(), dc_enumresolutions, null, null); err = getlasterror(); printf("\n 1.devcap.result = %d, err = %d", r, err); r = devicecapabilities(prnname.c_str(), portname.c_str(), dc_enumresolutions, szbuffer, null); err = getlasterror(); printf("\n 2.devcap.result = %d, err = %d", r, err); in output see following: 1.devcap.result = -1, err = 0 2.devcap.result = -1, err = 13 note: windows error 13 error_invalid_data . could please me understand - how interpret correcly? mean drivers epson ink printers not provide information on supported print resolutions? or there invalid parameters passed? if yes, 1 be? thank in advance. ps. please note following: 1) ...

How to get android studio Component(Button, text,etc...) size (Width, height or default size) -

Image
i developing android studio plugin using intellij , want component size(button or textview's width,height ) in intellij plugin. in picture, wrote code height="wrap_content" , width "wrap_content" . i want know button size( dp or px number). also when textview or component defined wrap_content , don't know width , height. i think, android studio components has default width , height. don't know defined! thank you! the default size android:minheight attribute set 48dip default. and take look: http://developer.android.com/reference/android/view/viewgroup.layoutparams.html wrap_content , means view wants big enough enclose content (plus padding) and of course: https://stackoverflow.com/a/23984754/4409113

javascript - For more than one text boxes in a tab not working -

for more 1 textboxes in tab following example not working. code jsfiddle . $(document).on('click', 'button[name="save"]', function() { var tabs = $('.tab-pane input'); $('.nav.nav-tabs li,.tab-pane').removeclass('active'); var bool = false; $.each(tabs, function(index, value) { if ($(this).val().length <= 0) { $('ul.nav li:eq(' + index + ')').addclass('active'); $('.tab-content .tab-pane:eq(' + index + ')').addclass('active'); $(this).focus(); return false; } }); return false; }); the reason example dosent work because trying access inputs based on tabs index. once add more inputs tab li:eq(' + index + ') not apply class active other inputs. however, shouldn't confusing user if more 1 input marked active @ time.

java - Can't get custom JPanel to show up on JDialog -

i have developed own properties type data structure setting basic data within application. using regular properties, wanted user able edit these , have notes, display order, , whether or not active. also, able group different properties. i created panel displays property "edit" button them make changes. then panel loads group , displays of properties group. both of panels seem work fine. when create jdialog should load of groups panel each, can't display. have toyed lots of layouts , no luck. in addition, need scrollpane when grow overtime. i not quite sure @ point...if add buttons panel, scrolls fine, assume wrong panel trying add. here property group class: import java.util.linkedhashmap; public class smokepropertygroup { private string name = null; private string notes = null; private int displayorder = 0; private boolean active = true; private linkedhashmap<string, smokeproperty> properties = new linkedhashmap<>(); public smokepropertygro...

c# - Parameter is not valid Exception in windowsForm -

i using multi panels making multi section project , using access database , inserting thing in below: private void addmoneypanel_firstload() { try { employee_list.items.clear(); connection.open(); oledbcommand command = new oledbcommand(); command.connection = connection; command.commandtext = "select ename,elastname employee"; oledbdatareader reader = command.executereader(); while(reader.read()) { employee_list.items.add(reader[0].tostring() + " \n" +reader[1].tostring()); } connection.close(); /*addmoneypanelmes.text = "با موفقیت ذخیره شد."; addmoneypanelmes.forecolor = color.green;*/ } catch (exception err) { addmoneypanelmes.text = "خظا در ارتباط با پایگاه داده."; addmoneypanelmes.forecolor = color.red; ...

sql - VB.NET Operand type clash: date is incompatible with int error -

i trying display records table named staffpresentee database using clause... i using visual studio 2010... the table design follows- .......fieldname..................datatype........allownull 1......staff_id (fk).............numeric(18,0)......yes 2.......date........................date.............no 3......present.....................char(1)..........yes note type of 2nd field date , not datetime... i want display records table have today's date int 'date' field... current query is- cmd = new sqlclient.sqlcommand("select * staffpresentee date=" & date.now.date, cn) dr = cmd.executereader for dr = cmd.executereader error "operand type clash: date incompatible int" i tried select * staffpresentee query without clause runs correctly. try putting date value in sigle quotes maybe. cmd = new sqlclient.sqlcommand("select * staffpresentee date='" & _ ...

C linking C++ static functions -

my question simple; is possible c linking ( extern "c" ) on c++ static class functions? - without using wrappers. no can't write wrapper function. class x { public: static void f(); }; extern "c" void call_x_f() { x::f(); }

c - initializing array of structure with array elements in it -

#include <stdio.h> int main() { typedef struct s { int a; int b[5]; char c[2]; }st; st vs[1]; vs[0] = {1,{1,2,3,4,5},{'c','d'}}; printf("%d:a\n",vs[1].a); printf("%d:b[0]\t %d:b[4]\n",vs[0].b[0],vs[0].b[4]); printf("%c:c[0]\t %c:c[1]\n",vs[0].c[0],vs[0].c[1]); return 0; } why doesn't work? on gcc -o main *.c i error main.c: in function 'main': main.c:15:12: error: expected expression before '{' token vs[0] ={1,{1,2,3,4,5},{'c','d'}}; but if have this: #include <stdio.h> int main() { typedef struct s { int a; int b[5]; char c[2]; }st; st vs[] = { {1,{1,2,3,...

java - How do i implement a Jbutton and event listener to close the application? -

the following code...the jbutton added in gui method. need jbutton add container , eventlistener enable application close when pushed. public class beetswk1 extends jframe{ public beetswk1(){ gui(); } public void gui(){ flowlayout layout = new flowlayout(); layout.setalignment(flowlayout.center); container container; container = getcontentpane(); container.setbackground(new color(052,062,138)); container.setlayout(layout); jlabel label = new jlabel(); label.settext ("hello world" ); label.setsize( 500, 400); label.setfont( new font( "sanserif", font.plain, 15) ); label.sethorizontalalignment( jlabel.center ); label.setforeground(color.white); container.add( label ); } public static void main(string[] args) { // todo code application logic here dimension dimension = new dimension(500, 500); beetswk1 window = new beetswk1(); ...

android - remove only double quotes from string before and after square bracket -

i trying remove double quotes before square bracket "[ , using following code says illegal escape charecter. str = str.replace("\[","["); i want remove double quotes ie " before square bracket ie [ . please guide me. you can use: str = str.replaceall("\"\\[", "[");

How to ensure that no two checkboxes are enabled in android -

i have custom list view , each item of has check box , text field. want disable check box in every other row of list view if check box of first row enabled. since stating if first check box clicked others should disabled, check in onbindview() see if checkbox checked. if is, set value is, , following list view entries set checkbox disabled. in oncheckchangedlistener(): checkbox1.setoncheckedchangelistener(new compoundbutton.oncheckedchangelistener() { @override public void oncheckedchanged(compoundbutton buttonview, boolean ischecked) { if(ischecked()){ firstcheckboxchecked = true; } }); then in onbindview rest: if(firstcheckboxchecked){ checkbox.setenabled(false); }

Python script won't exec from php when specific library is used -

im trying execute python script , set parameter server in ros. when run other simple python script example prints "hello", value in php. when run code: #!/usr/bin/env python import roslib import rospy import sys import re import string = rospy.get_param("param") print i empty echo. code works fine in terminal! all i'm doing in php is: $output = exec("python path/script.py") echo $output; i tried shell_exec, tried python in command, , without. tried /usr/bin/python still won't work specific code, works simple print! it turns out apache's user doesnt have required environment variables. have add environment variables paths need in apache's.. can set them out here