Posts

Showing posts from February, 2015

c# - How to get the window handle for a VBA MsgBox? -

i'm running c# script on large number of excel workbooks involves calling macro in each workbook; macro produces msgbox because of error handler, , pauses execution of script until click "ok" in msgbox. the title text of msgbox "error in processsub", , main text "error (type mismatch)". i thought maybe have concurrent thread finds open windows, , if finds msgbox, clicks "ok". i'm trying find window using this: using system.diagnostics; public process geterrorwindow() { process[] processlist = process.getprocesses(); foreach (process process in processlist) { if (process.mainwindowtitle=="error in processsub") { return process; } } } but doesn't find anything. when through processlist[] , seems find main excel window, , not of child windows vba code produces. there way find msgbox , click ok button? you can us...

html - Avoid the margin inside pre tag -

Image
this question has answer here: removing leading whitespace indented html source in pre/code tags 5 answers how avoid margin inside pre tag: <p>some text</p> <pre> <code> code </code> </pre> <p>some text</p> <style> pre { background-color: rgb(255,247,229); border: 1px solid red; } </style> the current output: the desired output: the current solution manually remove indentation in markup, shown below. however, understand, not optimal way. <pre> <code> code </code> </pre> you can try changing default value of white-space <pre> tag pre pre-line . pre-line sequences of whitespace collapsed. lines broken @ newline characters, @ <br> , , necessary fill line boxes. read more white-space on mdn . ...

c# - ASP.NET How to access multiple form labels text property with foreach loop -

i have form runat= "server" id = "myform" . profile page lots of labels. getting input text sql database. if sql data base have null value, wish text changed "not specified". such reason using following code, not working. foreach (control item in myform.controls) { label lbl = null; bool labelisempty = false; try { lbl = (label)item; labelisempty = (lbl.text == string.empty && lbl != null); } catch { } if (labelisempty) { lbl.text = "not specified"; } } myform.controls gives collection contains controls withing container( not labels). have check type control while iterating collection in order avoid throwing exception. in additional comment ware specify label has default text "label" need include in condition. whole scenario can implemented following: foreach (control item in myform.controls) { if (item label) ...

Class for reusable layout android -

i have reusable layout called title <?xml version="1.0" encoding="utf-8"?> <textview android:id="@+id/title_text" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignparentleft="true" android:layout_alignparentright="true" android:layout_centervertical="true" android:gravity="center" android:text="@string/lesson_title" android:textsize="@dimen/title" /> <button android:id="@+id/title_book" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignparentbottom="true" android:layout_alignparentright="true" android:layout_alignparenttop="true" android:onclick="onclick" android:text="@string/book" /> <button android:id="...

ecmascript 6 - ES6 javascript tests using Tape and Nightmare.js -

i've been trying test es6 code using tape assertions , nightmare.js load test page. keep trying different es6 methods: async/await, yield, generators, , think i'm bit on head. i'm not sure when , when not use babel-tape . can following test pass, minute create evaluate block errors out. documentation scarce (or uses mocha). what's best practice here? import {test} "tape"; import {default nightmare} "nightmare"; const page = nightmare().goto("http://localhost:4000/index.html"); page.evaluate(() => document.getelementsbytagname("body").length).end() .then((result) => { test("detect page body", (assert) => { assert.equal(1, result); assert.end(); }); }); ps. i'm using babel-tape-runner run tests. i can following test pass, minute create evaluate block errors out. hm, you're calling .end() on nightmare instance. shouldn't interacting instance once e...

.htaccess - Get link and Redirect with Htaccess -

i have website domain example.com , have file example.com/example.php how redirect file other website there have same domain name different in extension redirect example.com/example.php example.net/example.php htaccess? much! try this: rewriteengine on rewritebase / rewritecond %{http_host} !newdomain.com$ [nc] rewriterule ^(.*)$ http://newdomain.com/$1 [l,r=301]

c# - retrieve files created within a time range in a local folder -

need retrieve files created within time range (in granular of minute level) in local folder (files flat in folder, no sub-directories). using windows os , want find if c# code refer to? current solution native, scan folder files , filter timestamp. works if there more neat windows api filter file timestamp, should more reliable code. you can use filesystemwatcher have event raises when file created: filesystemwatcher watcher = new filesystemwatcher() { path = "c:\\", includesubdirectories = true, notifyfilter = notifyfilters.lastwrite | notifyfilters.directoryname | notifyfilters.filename, filter = "*.*" }; watcher.created += (s, e) => { messagebox.show(e.fullpath); }; filesystemwatcher

swift - Use of Unresolved Identifier Error Code -

i wondering why keep getting error message, use of unresolved identifier 'changeinpercent'. not sure why keep getting error message help, appreciate it. here code. import uikit class stockstableviewcontroller: uiviewcontroller, uitableviewdatasource, uitableviewdelegate { //1 private var stocks: [(string,double)] = [("aapl",+1.5),("fb",+2.33),("goog",-4.3)] @iboutlet weak var tableview: uitableview! override func viewdidload() { super.viewdidload() //2 nsnotificationcenter.defaultcenter().addobserver(self, selector: "stocksupdated:", name: knotificationstocksupdated, object: nil) self.updatestocks() } override func didreceivememorywarning() { super.didreceivememorywarning() } //uitableviewdatasource func tableview(tableview: uitableview, numberofrowsinsection section: int) -> int { return stocks.count } func tableview(tableview: uitableview, cellforrowatindexpath indexpath: nsindexpath) -> uit...

c++ - Erase element from vector,and the vector is fill with struct -

something this: struct mystruct { char straddr[size]; int port; int id; ....... }; mystruct s1={......}; mystruct s2={......}; mystruct s3={......}; vector test; test.emplace_back(s1); test.emplace_back(s2); test.emplace_back(s3); now want erase element straddr="abc" , port = 1001. should do? , don't want this. for(auto = test.begin();it != test.end();) { if(it->port == port && 0 == strcmp(it->straddr,straddr)) = test.erase(it); else it++; } first of all, use std::string instead of char [size] can use == instead of strcmp , other such c-string functions. then use std::remove_if() along erase() as: test.erase ( std::remove_if( test.begin(), test.end(), [](mystruct const & s) { return s.port == 1001 && s.straddr == "abc"; } ), test.end() ); it idiomatic solution problem , can read more here: c++ i...

Amazon EC2 and Elastic Bean -

i have developed application using amazon java web project eclipse console, if try publish project, not publishing , showing error this , this . possibility create web project in amazon services through elastic beanstalk or else can create web project of our own , can uploaded ec2 instance???. if question foolish, please forgive. newbie amazon services. elastic beanstalk managed option. can deploy application on own instances.

c# interop winword.exe doesn't Quit()! -

i feed multiple docs below method , see winword.exe disapear expected on over 15 diferente pcs running winxp 32bit win8 64bit having office 2000 onwards. on 1 nightmare pc has trend's antivírus running, winword.exe (always, every time) interrupts loop "file in use" exception (turning trends off allows work again). ideias keep trends on? void loop() { microsoft.office.interop.word._application app = new microsoft.office.interop.word.application(); app.visible = false; app.screenupdating = false; app.displayalerts = wdalertlevel.wdalertsnone; microsoft.office.interop.word._document doc = app.documents.open(filepath, false, true, false); doc.activate(); doc.disablefeatures = true; doc.exportasfixedformat(newfilename, wdexportformat.wdexportformatpdf, false,wdexportoptimizefor.wdexportoptimizeforonscreen, wdexportrange.wdexportcurrentpage, 1, 1, wdexportitem.wdexportdocumentwithmarkup, false, false, wdexportcreatebookmarks.wdexportcreatenobookmarks, true, false, true,...

Dynamic linking to Wordpress database -

i intend use wp setup freelancers website (similar odesk) connect service providers service seekers in web 2.0 dynamic environment. site requires multiple forms enter , retrieve information using database , show them in filtered or non-filtered views in separate pages. please advise if there available plugins expedite developing site, or otherwise guidance appreciated. know how connect forms database , how retrieve information db. regards, you going have create own custom wordpress theme, using various custom php pages connect web forms database. think project beyond scope of simple wp plugin. if project, i'd ditch wordpress , go custom built in rails. wordpress enough cms, isn't fit looking accomplish.

Getting Margin size on 1000 pdf files and loaded fonts -

i have on 1000 pdf files need determine ones have margin size smaller 1/4 inch. have looked @ ghostscript, , looks promising, have not able figure out how more 1 pdf @ time. as second requirement, need check if pdf files have fonts loaded in them. stuck on requirement , have no clue can automate task. i limited in scripting knowledge , stick vbscript, vb, , wsh ghostscript has device -sdevice=bbox should you. the undocumented option -csp3 in cpdf uses ghostscript in way , extracts , prints results, 1 each page. feast: john$ ./cpdf -gs /usr/local/bin/gs -csp3 ~/trunk/pdftests/car.pdf 16.802291, 13.982754, 23.792892, 10.398033 16.882926, 14.002913, 8.798058, 13.134733 16.802291, 13.974525, 8.855073, 15.244272 16.802291, 13.962596, 8.862199, 13.391299 16.802291, 10.313868, 8.847946, 13.377045 16.802291, 13.962596, 8.855073, 17.040232 16.802291, 13.902119, 8.855073, 13.391299 for second problem: cpdf -missing-fonts file.pdf will print missing fonts out. ...

javascript - Ember 1.0.0 input type radio 'checked' binding not updated when property changes -

i've got problem: i've got property called 'active' on 1 of models, either string 'yes' or 'no', want use property check html radio button. so when 'active' 'yes' should checked otherwise should not checked. i've got work, when make action sets 'active' property 'no' or 'yes' radio buttons checked status doesn't update. here's bin: http://emberjs.jsbin.com/ohasezo/3/edit . when using checkbox same results: http://emberjs.jsbin.com/owiluru/3/edit i can't make sense of it, think should work, ideas? {{bind-attr}} doesn't work way - binds 1 way. here examples of how you'd go this: use {{view ember.checkbox checkedbinding="car.active"}} : jsbin example or use custom implementation of ember.radiobutton - {{view ember.radiobutton checkedbinding="car.active"}} : jsfiddle example credit ember.radiobutton : thoughts & ramblings of software developer...

linux - is there a ${SSH_CONNECTION%% *} equivalent in Telnet? -

so on redhat linux... i have rather unique application need determine address telnet connection occurring on. application use loopback address telnet it's self, , fed different information based on loopback address connects to. for ssh using ${ssh_connection%% *}. cannot find telnet equivalent. if there not 1 run second ssh daemon. powers rather run telnet. thank help. well command echoing out environment varibale ssh_connection you can telnet in , env , ip , see if there: or can who grep $(whoami)|awk '{print $nf}' run above

jquery - Scroll a div horizontally in an other div -

i want reproduce (which work perfectly) : http://jsfiddle.net/pvvdq/ but don't want apply on document.height, on div height. this script have if(positionydiapo<=middleheight){ $('#frame').css({position:'fixed', top: positiontop - $(window).scrolltop(), bottom:'auto'}).addclass('stuck').removeclass('anchored'); if(bottomdiapo<=bottomframe){ $('#frame').css({ 'position': 'absolute' }); $('#frame').css({ 'bottom': '0px' }); $('#frame').css({ 'top': 'auto' }); $('#frame').removeclass('stuck').addclass('anchored'); } var $horizontal = $('#frame'); var s = $(this).scrolltop(), d = $(document).height(), c = $(this).height(); scrollpercent = (s / (d - c)); ...

Does anyone know where I can still download flex 3.5 sdk? -

does know can still download flex 3.5 sdk? inherited project developed in flex 3.5. having trouble configuring flash builder 4.6 work it. you can here: http://download.macromedia.com/pub/flex/sdk/flex_sdk_3.5.zip are aware latest version 4.10? available here: http://flex.apache.org/

sql server - Dynamic SQL: Grouping by one variable, counting another for column names -

i trying dynamic sql query, similar have appeared on forum, life of me, cannot work. i using sql server 2008. have table series of order_ref numbers. each of these numbers has varying number of advice_refs associated it. advice_ref numbers unique (they key table). there @ least 1 advice_ref each order_ref. there bunch of columns describe information each advice_ref. what want create table row each unique order_ref, columns each advice_ref, in ascending order. columns advice01, advice02, ....advice10, advice11, etc. not advice# columns filled in every order_ref , number of advice# columns depend on order_ref greatest number of advice_refs. the table like: order advice01 advice02 advice03 advice04..... 1 1 2 3 2 5 8 9 20 3 25 the code i've tried use is: declare @sql nvarchar(max) declare @pvt nvarchar(max) select @sql = @sql + ', coalesce(' + quotename('advice' + ...

android - New cross platform mobile app places api -

i'm new app development , have few questions related google maps , places i usa resident , developing application programmer in india work on android , iphone. i'm wondering if can use apple maps on iphone , run google places on it. thought read paper work saying google places must run on google maps period. programming guy said fine because app free? , run google maps on iphone after have established people want app? have upgrade business edition of maps once app hits 10000 users means can use places on map. can confirm this? thanks james google places api usage must conform our terms of service . , yes, correct, need display google places api results on google map. have google maps sdk ios should reasonably easy accomplish. being free app doesn't absolve of conforming our terms of service, fwiw.

internet explorer - Using Selenium IE driver in C# to quickly post a large amount of text (10,000 lines) -

so i'm writing script automate simple, monotonous task using selenium internet explorer driver in c#. everything works great, tad bit slow @ 1 point in script , i'm wondering if there quicker way available want. the point in question when have fill out textbox lot of information. textbox filled 10,000 lines each line never exceeds 20 characters. however, following approach slow... // process sample file using linq query var items = file.readalllines(samplefile).select(a => a.split(',').first()); // process items want add textbox var stringbuilder = new stringbuilder(); foreach (var item in items) { stringbuilder.append(item + environment.newline); } inputtextbox.sendkeys(stringbuilder.tostring()); is there set value of textbox want? or bottleneck? thank time , patience! so suggested richard - ended using ijavascriptexecutor . the exact solution replace call sendkeys in following line of code: inputtextbox.sendkeys(stringbuilder.to...

oauth - Can't connect to gitlab 6.1 using google oauth2 -

i have setup gitlab 6.1 instance using documentation available here : https://github.com/gitlabhq/gitlabhq/blob/6-1-stable/doc/install/installation.md i run checks , green. i setup oauth setting in gitlab/config/gitlab.yml use google provider : production: &base omniauth: enabled: true allow_single_sign_on: true block_auto_created_users: false providers: - { name: 'google_oauth2', app_id: 'xxxxx.apps.googleusercontent.com', app_secret: 'xxxxx', args: { access_type: 'offline', approval_prompt: '' } } when try connect gitlab using google oauth authentication, replied "bad gateway" nginx. lookking @ gitlab logs don't have : e, [2013-09-24t18:30:27.609795 #1818] error -- : worker=0 pid:1903 timeout (31s > 30s), killing e, [2013-09-24t18:30:27.626498 #1818] error -- : reaped #<process::status: pid 1903 sigkill (signal 9)> worker=0 i, [2013-09-24t18:30:27.661134 #2058]...

java - How to Make Object.class Type Generic -

i create utility method takes 2 objects parameters , marshalls xml them. below code works if use actual object type parameter, how make generic? below wont compile since can't resolve object type. ideas? public static string getxml(object from){ stringwriter xml = new stringwriter(); try { jaxbcontext.newinstance(from.class).createmarshaller().marshal(from, xml); } catch (exception e) { e.printstacktrace(); } return xml.tostring(); } you can class instance of object so jaxbcontext.newinstance(from.getclass()) //... this explained in ojbect#getclass() javadoc. returns runtime class of object. note there aren't generics directly involved in code snippet.

.net - Adding Items at MenuStrip Combobox -

i have menu strip contains combobox. how put items in combobox during design stage, not @ runtime? changed property autocompletesource = customsource , put items inside autocompletecustomsource , still, no luck. should do? select menu bar item , go "properties" , "items"/(collection) hope helps

csv - Ruby: Why don't we need `attr_accessor`? -

i ran through example 1.9 pickaxe book , i'm confused why following program runs without using attr_accessor in csv_reader.rb file. book_in_stock.rb class bookinstock attr_accessor :price, :isbn def initialize(price, isbn) @price = float(price) @isbn = isbn end end aren't writing instance variable of csv_reader object appending new bookinstock objects it? csv_reader.rb require 'csv' require_relative 'book_in_stock' class csvreader def initialize @book_in_stock = [] end def read_in_csv_data(csv_file) csv.foreach(csv_file, headers: true) |row| @book_in_stock << bookinstock.new(row["price"], row["isbn"]) end end def total_value_in_stock sum = 0 @book_in_stock.each {|book| sum += book.price} sum end end test_data.csv "price","isbn" "44.12",'asdf34r13' "74.12",'asdf34r13' "14.12",'asdf34r13...

ios - mapView region latitude and longitude delta's decrease each search -

each time search on mapview map zooms desired location. yet, after first search zoomed region zoomed , continues zoom in more each additional search. i've tried adding regions latitude , longitude delta's doesn't increase. i've added code use zoom location searched. in advance. clplacemark *topresult = [placemarks objectatindex:0]; mkplacemark *placemark = [[mkplacemark alloc] initwithplacemark:topresult]; mkcoordinateregion region = self.mapview.region; region.center = placemark.region.center; region.span.longitudedelta /= 100.0; region.span.latitudedelta /= 100.0; [self.mapview setregion:region animated:yes]; [self.mapview addannotation:placemark]; nslog(@"region span long: %f",region.span.longitudedelta); ...

jquery - Get the text value from ASP.NET Hyperlink -

i'm trying figure out how use jquery text out of asp.net gridview hyperlink text. <asp:gridview id="g" runat="server" autogeneratecolumns="false" onrowcreated="g_rowcreated" onrowdatabound="g_rowdatabound" width="755px" > <columns> <asp:templatefield headertext="" itemstyle-horizontalalign="left" itemstyle-width="100%"> <itemtemplate> <asp:hyperlink id="hyperlink1" runat="server" navigateurl="javascript://" onclick="<%# eval(&quot;varid&quot;, &quot;return loaddata('{0}',this);&quot;)%>" text='<%# eval("varname","{0}") %>' ></asp:hyperlink> </itemtemplate> </asp:templatefield> hyperlink1 text value want grab can use column heading else on page. there w...

Git with putty on windows -

when attempting push / pull on ssh, git failing following error: "c:\program files\git\bin\git.exe" push -u --recurse-submodules=check -progress "testremote" project:project using username "git-receive-pack 'ec2-user". fatal error: disconnected: no supported authentication methods available (server sent: publickey) fatal: not read remote repository. please make sure have correct access rights , repository exists. done the remote "testremote" setup "ssh://ec2-user@sweeb.net:gittest.git" , i'm using existing keypair have used putty before without issue. pageant running, key loaded. i think issue line "using username "git-receive-pack 'ec2-user"." - assumed git's commands breaking on windows space in "program files" i've tried surround double quotes, doesn't seem working. has seen before? windows vars: git_ssh=c:\putty\plink.exe path=[...];"c:\program files\git\cmd...

python - Is it possible to get access to class-level attributes from a nose plugin? -

say have following test class: # file tests.py class mytests(object): nose_use_this = true def test_something(self): assert 1 i can write plugin run before test: class helloworld(plugin): # snip def starttest(self, test): import ipdb; ipdb.set_trace() the test want be, type of test nose.case.test : ipdb> str(test) 'tests.mytests.test_something' ipdb> type(test) <class 'nose.case.test'> and can't see allow me @ nose_use_this attribute defined in testcase-ish class. edit: i think best way access context startcontext / stopcontext method pair, , set attributes on instance there: class myplugin(plugin): def __init__(self, *args, **kwargs): super(myplugin, self).__init__(self, *args, **kwargs) self.using_this = none def startcontext(self, context): if hasattr(context, 'nose_use_this'): self.using_this = context.nose_use_this def stopconte...

playframework 2.0 - How to generate a new application.secret in Play 2.x -

apparently play 1.x had command 'play secret' create new application.secret, don't see equivalent command in play 2.x. recommended change key when moving development production, need find way make new key that. you right. think feature not yet implemented in 2.x version. afraid way create new project. each new project generate new secret key. , copy newly generated key. i think issue raised problem: https://github.com/n8han/giter8/issues/42 referenced in https://groups.google.com/forum/#!topic/play-framework/amym_fdglss good luck. edit 2015-05-11: as noted @myk implemented in sbt plugin, need run: sbt play-generate-secret or sbt play-update-secret edit 2015-07-02 using activator: activator playgeneratesecret

php / mysql sorting issue and form sanitizing? -

i'm pretty new scripting i've been following code logic pretty well. i've got 2 working scripts (posted below,) 1 posts form mysql database , pulls information on same page in table. i'm having trouble finding on following things want accomplish. 1.) sanitizing form, i've been told it's open injection/other. people submit text, , i'd them able post html links called , clickable second script. 2.) want callback script sort information recent post on top. (can create new mysql column alongside category , contents called "date" auto detects date/time , uses sorting? i'd love see example code of that. here's submit form <html> <div style="width: 330px; height: 130px; overflow: auto;"> <form style="color: #f4d468;" action="send_post.php" method="post"> category: <select style="color: #919191; font-family: veranda; font-weight: bold; font-size: 10px; backg...

python - Generating a matlibplot bar chart from two columns of data -

i trying build vertical bar chart based on examples provided in how plot simple bar chart (python, matplotlib) using input *.txt file? , pylab_examples example code: barchart_demo.py . # bar chart import numpy np import matplotlib.pyplot plt data = """100 0.0 5 500.25 2 10.0 4 5.55 3 950.0 3 300.25""" counts = [] values = [] line in data.split("\n"): x, y = line.split() values = x counts = y plt.bar(counts, values) plt.show() current receiving following error: assertionerror: incompatible sizes: argument 'height' must length 15 or scalar . not sure if plt.bar() function defined correctly. there may other issues have overlooked in trying replicate 2 mentioned examples. x, y = line.split() returns tuple of strings. believe need convert them ints , floats. need values.append(x) , values.append(y). import numpy np import matplotlib.pyplot plt data = """100 0...

c - How can I detect a space or newline at the end of scanf()? -

i'm writing program have accept commands user shell user can set values environment variables. problem i'm having if user types set var var-value need know user typed space instead of set , pressed enter different command. how can determine if user pressed space or enter using scanf() ? you'll know user pressed enter because scanf() won't return until user so. if you're trying read characters in real time user types, scanf() not work you. need use getchar() , getch() or getche() functions, or function provided os reading keyboard input. read characters 1 one array, scanning spaces , enter key read. see this question .

How to build a Lotus Domino Database using SVN and Ant, Maven or Gradle -

i'm having database in domino designer, under source-control. want automatically build database on build-server. does know, how create ant-script or maven or gradle, whatever working, valid database automatically build-server or commandline? thanks in advance this presentation ibmer given during user group meeting in late 2012 mentions (page 30) future possibility of doing command line builds. might still need notes client installed though. command line build nsf/ntf i've asked feature didn't answers.

apache - Exception while dispatching incoming RPC call : encodedRequest cannot be empty -

my gwt application deployed in servlet container apache tomcat 6.0.37 , linked apache http server using connectors coyote/jk2 (native module mod_jk/1.2.37 ). in addition, use module mod_auth_sspi/1.0.4 sso . found problem - when send request server ie 8 (requests firefox, example, successful) page not displayed , in tomcat logs following - severe: exception while dispatching incoming rpc call java.lang.illegalargumentexception: encodedrequest cannot empty @ com.google.gwt.user.server.rpc.rpc.decoderequest(rpc.java:232) @ org.spring4gwt.server.springgwtremoteserviceservlet.processcall(springgwtremoteserviceservlet.java:32) @ com.google.gwt.user.server.rpc.remoteserviceservlet.processpost(remoteserviceservlet.java:248) @ com.google.gwt.user.server.rpc.abstractremoteserviceservlet.dopost(abstractremoteserviceservlet.java:62) @ javax.servlet.http.httpservlet.service(httpservlet.java:643) @ javax.servlet.http.httpservlet.service(httpservlet.java:723) ...

java - Using JQuery Mask Plugin with JSF -

Image
i´m trying add mask <h:inputtext> monetary value: <h:inputtext id="preco" class="input-medium monetary-value" /> <script>$(function() {$('.monetary-value').mask('#.##0,00', {reverse: true});}</script> as stipulated in doc of plugin on link: http://igorescobar.github.io/jquery-mask-plugin/ , it's being compilated this: and doesn't let me type anything. changed 0 9, lets me type on place of zeros, it's still behaving diferent of demo on docs page. can me this?

android - How to make an Intent in Alertdialog clicking ListView item? -

hi, i'm trying these steps: 1)select item(song_title) on listview 2)once item selected alertdialog has started(with list of "listen" , "download") 3)selected 1 of 2 items on alertdialog 4)create intent start activity(download file) don't understand how implement steps 3 , 4. here part of code itemclicklistener: ls.setonitemclicklistener(new onitemclicklistener() { @override public void onitemclick(adapterview<?> parent, view view, int position, long id) { log.d(null, ". position: " + position ); showdialog(position); } }); and part creating dialog protected dialog oncreatedialog(int id){ alertdialog.builder adb = new alertdialog.builder(mainactivity.this); final string[] service = {"play music", "download"}; adb.settitle("choose service"); switch(id){ case 0: log.d(null, service[id] + ". position: " ); adb.setitems(...

sql - Oracle Column Based on Another Column -

i'm using oracle table. let's pretend have simple table has names , datetimestamps: name time --- --- joe 01jan1970:00:00:01 jane 04mar2010:20:55:11 julie 22dec1984:11:11:11 i want add third column. let's call date. want truncate off time. name time date --- --- --- joe 01jan1970:00:00:01 01jan1970 jane 04mar2010:20:55:11 04mar2010 julie 22dec1984:11:11:11 22dec1984 that accomplished enough update. trick is, if updates julie's time, want date automatically update well: name time date --- --- --- joe 01jan1970:00:00:01 01jan1970 jane 04mar2010:20:55:11 04mar2010 julie 02oct1999:22:22:22 02oct1999 is there simple way accomplish oracle 11g? can set trigger update column in row when column changes? edit: clarity in example i second jesse's advice use view returns whatever want. however, if want stored (e.g. in order create index on it), can use virtual column: ...

java - How to use Jenkins parameterized builds? -

Image
jenkins allows parameterize builds, can't figure out how make use of it: say kick ant build off command-line so: ant -buildfile /path/to/my/build.xml -dpackagetype=jar package this invoke build.xml 's package target, , make property named packagetype available it, value of jar . i'm assuming in screenshot above, name field specify packagetype , value? if jenkins wants me specify default value property, specify value project using? instance, might want default value of war , have jenkins job pass in value of jar (to override default). also, jenkins mean "... allows user save typing actual value. " user? type value anyways? thanks in advance! whenever user configures parameterised build in jenkins, parameter name taken environment variable the user can make use of such parameters using environment variable. for example, in case if packagetype parameter want pass, then specify name packagetype , value war you can use in s...

c# - Using Linq to return a Comma separated string -

i have class in application public class productinfo { public int productid {get;set;} public int producttype{get;set;} } i want write linq query can return me list of productids in comma separated format producttype equal number ? i tried using string.join linq statement didn't seem work. var s = string.join(",", products.where(p => p.producttype == sometype) .select(p => p.productid.tostring()));

python - How to align subscript and superscript with matplotlib? -

i'd put text r'$x=1_{-1}^{+1}$' matplotlib. used following code in ipython --pylab!: text(0.1, 0.1, r'$1_{-1}^{+1}$', size=100) in result, subscript , superscript not aligned, subscript slants little left compared superscript. when use normal latex (or, example, latexit), not have problem, , expect matplotlib. are there ways correct offset? matplotlib has 2 ways set mathtext: it's own internal engine or via external latex call. internal engine has advantage there , work, has limitations , and not complete implementation of latex. external calls give rendering full latex install, requires have latex installed, not given, , errors aren't handled super well. to enable type setting via external call latex set rcparams['text.usetex'] = true or add text.usetex: true to matplotlibrc file.

ruby - Why does my Rails App work after I disabled the Virtual Host? (Phusion Passenger + Apache2) -

today installed new home server , setup ruby on rails , server environment. used this guide things started phusion passenger (all exact same(besides servername)). after enabled virtual host , restarted apache2, none of routes work, files in public rails folder. googled solution found nothing, have helped me. so, after while, gave , disabled virtual host again. than, when visited site again, routes okay. though virtual host shouldn't point rails app anymore (i'm new apache2s virtual host, don't quite understand them). now question is, why work? , why url still point rails app? want understand it, can reproduce steps when needed. expressed myself enough. greetings if you're seeing files listed sounds have options indexes enabled where. try grepping through /etc/httpd/mods-enabled options indexes. <directory /path/to/directory> options indexes </directory> as why it's working after deleting virtual host. suggest looking through...

HTML button / php -

<a href="#" class="button">etiam posuere</a> </div> how can make call php use? since want in php: so button reading php, or can same does. if (isset($_post['do1'])){ $klasse = $_post['antall']; $klasse = strtolower($klasse); $dato = $_post['dato']; $fag = $_post['fag']; $tema = $_post['tema']; $info = $_post['info']; if ($info == "") { $info = "ukjent"; } if ($tema == "") { $tema = "ukjent"; } $exists = file_exists("proveload/prove$klasse.txt"); if(!$exists) { $ourfilename = "proveload/prove$klasse.txt"; $ourfilehandle = fopen($ourfilename, 'w') or die("noe er feil med filen"); $stringdata = "$dato $fag ($tema , $info)."; fwrite($ourfilehandle, $stringdata); fclose($ourfilehandle); echo "l...

sprite - I need help on a mini game that i am making in javascript -

hell everyone! thank type of help! so, trying make sort of sprite game , have problems loading more sprites. sprites loaded in separated js file. problem not load images , when move around seams crack , don't mean fails fact not load images , there moments when character disappears. engine.player = {}; engine.player.sprite = []; engine.player.spriteindex = 27;//the initial sprite 1 faces south engine.player.store = function(index, imgsrc) //function store img { var sprite = [new image(), false]; sprite[0].src = imgsrc; sprite[0].onload = function() { sprite[1] = true; } engine.player.sprite[index] = sprite; }; engine.player.retrieve = function(index) { return engine.player.sprite[index][0]; }; engine.player.allloaded = function() { var i; for(i=0; i<42; i++)//total number of img { if(engine.player.sprite[i][1] === false) { return f...

r - How to find homozygous recessive values -

stemming earlier question had trying check whether parent correct parent given child's genotype (see checking whether "string" expression in specified variable contained in several other variables ) now, i'm trying see whether if genotype of child recessive genotype (having 2 of same recessive values [alleles] gene). in case, child affected disease while parents not (the child proband). have tried figure out whether parents , child homozygous, , kinda worked out whether child matches parent's genotype.... these 2 pieces of information can't seem to work out whether child homozygous recessive... here have far (following similar answer above): homo <- read.table("/.../family1a/family1a_vcf.txt", sep="\t", header=t) d <- data.frame(list(mom = homo[c(1)], dad = homo[c(2)], child = homo[c(3)] ), stringsasfactors = false) check_homo <- function(x) { #homo m1 <...