Posts

Showing posts from May, 2012

security - Decrypt stored secret using HTTPS transport -

i considering developing software safely storing files on server. let's have secret document stored on client computer want upload server. requirements here file on server should encrypted @ times , since private key on client, unreadable accessing server directly. maybe can javascript or maybe need develop full fledged app handle upload. either way ok need able download , decrypt file using web browser only. this got me thinking. can configure https (ssl) in way can precalculate encrypted response server client. in case can while uploading , when document requested can return pre-encrypted data decrypted ssl stack on client. i know there random number exchange prevents this. there way configure ssl response server client same always. in case replay attacks server client acceptable , not issue. in ssl handshake, client generates pre-master secret used derive session key. since appear have control on server, cannot prevent client steering conversation in particula

sql - PHP $stmt->bind_param() Number of variables doesn't match -

for unknown reason code doesn't seem working. have checked on google, no 1 else seems have same problem. bug php? the error get: warning: mysqli_stmt::bind_param() [mysqli-stmt.bind-param]: number of variables doesn't match number of parameters in prepared statement in /home/a9684274/public_html/system/db.php on line 102 the code: $stmt = $mysqli->prepare("select * users username='?'") $name = "vilsol"; $stmt->bind_param("s", $name); thanks in advance! remove single quotes ' : $stmt = $mysqli->prepare("select * users username=?") in code interpreted string value , not parametrizable value.

Will code from Matlab R2012b work in Matlab R2013a environment? -

will code matlab r2012b work in matlab r2013a environment? i not sure if should switch matlab r2012b matlab r2013a? heard there nice new features, major concern whether code 2012b work 2013a. please let me know if have major warnings this. thanks it very rare new version incompatible code of previous versions (unless upgrade dinosaur versions).

c# - Error Panel Row Updating -

i want show error panel on row updating not show error panel. what's wrong code? protected void grades_gridview_rowupdating(object sender, gridviewupdateeventargs e) { string lettergrade = grades_gridview.datakeys[e.rowindex].values["letter_grade"].tostring(); textbox txtmingrade = (textbox)grades_gridview.rows[e.rowindex].findcontrol("txtmingrade"); textbox txtmaxgrade = (textbox)grades_gridview.rows[e.rowindex].findcontrol("txtmaxgrade"); if (convert.todecimal(txtmingrade.text) > convert.todecimal(txtmaxgrade.text)) { panelerror.visible = true; labelerrorstring.text = "minimum grade must not greater maximum grade!"; } else { admin.updategraderanges(lettergrade, txtmingrade.text, txtmaxgrade.text); } grades_gridview.editindex = -1; fillgraderangesingrid(); }

tcpdf - Redirect after output completed and file saved (not sure how to know when large PDF's fully saved) -

i use pdf generate pdf , save server this: $fp = fopen( '$createdid.'.pdf', 'wb' ); fwrite( $fp, $pdf->output('example_009.pdf', 's')); fclose( $fp ); a user design on our site move onto php page calls above code want them redirect cart can checkout. using jquery(document).ready(function() {redirect() }) doesn't seem wait pdf finish before redirecting. tried embedding large image pdf test...i tried leaving page straight away make sure output , saving isn't happening behind scenes after leaving page. how should make sure page isn't redirected until pdf created , saved server? thanks, joe an overview of i'm doing below - e.g building pdf obj, outputting pdf obj hoping redirect page after pdf completed // init pdf obj $pdf2 = new tcpdf(pdf_page_orientation, pdf_unit, pdf_page_format, true, 'utf-8', false); // set defaults setpdfdefaults($pdf2,$pl,$resolution); // add bg addbackground($p

vb.net - (VB) Timer carries on other forms -

basically, when continue onto next form timer still running, how can stop this? have used "timer1.enabled = false" private sub timer1_tick(sender object, e eventargs) handles timer1.tick msgbox("sorry, time has expired. please try again.", vbokonly, "warning") me.close() end sub i think using windows timer. if true first message box has unwanted side effect accumulate number of tick events in message queue of program. more time stay in video message box displayed more message boxes displayed because messages accumulate in queue you try solve situation global form variable dim timeelapsed boolean private sub timer1_tick(sender object, e eventargs) handles timer1.tick if timeelapsed = false timeelapsed = true ' important set immediatly true msgbox("sorry, time has expired. please try again.", vbokonly, "warning") me.close() dim t = ctype(sende

less - How to get value in percentage (%) or pixel (px) after doing some maths? | Lesscss -

i've little , simple question regarding lesscss. how can calculated value in percentage or pixel in lesscss. like, have : ((1 / 1) * 1) = 1 . know answer 1 , want "1" in percentage or pixel this: "1%" or "1px" . i need insert or put percentage (%) or pixel (px) sign in calculated value. i'd appreciate help. use: unit(@yourvalue,px) or unit(@yourvalue,~"%") read more here additional note: default first occurring unit in calculation assigned result. example unit((1 / 2 * 3),px); , (1px / 2% * 3rem) both return 1.5px .

c# - Encrypt a file and send it through -

i need encrypt file aes 192 , send client via socket. i'm using code encrypt file: string outputfile = "crypted"; //confidentiality rijndaelmanaged aes192confidentiality = new rijndaelmanaged(); aes192confidentiality.keysize = 192; aes192confidentiality.blocksize = 192; aes192confidentiality.iv = confiv; aes192confidentiality.key = confkey; aes192confidentiality.mode = ciphermode.cbc; filestream inputfilestream = new filestream(par.getfilepath(), filemode.open, fileaccess.read); filestream outputfilestream = new filestream(outputfile, filemode.create, fileaccess.write); byte[] inputfiledata = new byte[(int)inputfilestream.length]; inputfilestream.read(inputfiledata, 0, (int)inputfilestream.length); cryptostream encryptstream = new cryptostream(outputfilestream, aes192confidentiality.createencryptor(), cryptostreammode.write

geometry - Minimal surface solution in Python -

Image
i have set of 3d points defining 3d contour. want obtain minimal surface representation corresponding contour (see minimal surfaces in wikipedia) . requires solve nonlinear partial differential equation. in matlab straightforward using pdenonlin function (see matlab's documentation) . example of usage solving minimal surface problem can found here: minimal surface problem on unit disk . i need make such implementation in python, know haven't found web resources on how to this. can point me resources/examples of such implementation? thanks, miguel. update the 3d surface (ideally triangular mesh representation) want find bounded set of 3d points (as seen in figure, points lie in best-fit plane): ok, doing research found minimal surface problem related solution of biharmonic equation , , found thin-plate spline fundamental solution equation. so think approach try fit sparse representation of surface (given 3d contour of points) using thin-plate splines. foun

javascript - How to change page's html with ajax and jquery? -

i change page in mobile app. window.location.href = 'sth.html' works, problem is, time between change (when see white screen under changing). i know jquery mobile simple, don't want use jqm. are know methods? you can send http request sth.html ajax , make sure allow caching on server. only after request completes redirect. that cause browser load page sth.html cache , not server , should eliminate white screen.

iphone - Tap gesture doesn't work after setContentOffset -

i have uitapgesturerecognizer on uitableview. works great until call method scrolltorowatindexpath:atscrollposition:animated: . doesn't work once that's called. doesn't work once call setcontentoffset: . have scroll tableview finger little bit, , tap gesture work. how can work after setting contentoffset or scrolling row? -(void)viewdidload { // gesture doesn't work after 'setcontentoffset:' uitapgesturerecognizer *tap = [[uitapgesturerecognizer alloc] initwithtarget: self action: @selector(hideshowediting:)]; [tap setcancelstouchesinview: yes]; [tap setdelegate: self]; [self setedittap: tap]; [[self tableview] addgesturerecognizer: tap]; } -(bool)hideshowediting:(uigesturerecognizer *)gesture { cgpoint location = [gesture locationinview: [self tableview]]; nsindexpath *ip = [[self tableview] indexpathforrowatpoint: location]; taskcell *cell = (taskcell *)[[self tableview] cellforrowatindexpath: ip]; // no cell

c# - First arbitrary messages in signalR has no messageID? -

Image
i wrote simple code --when connected , should yield "first !" "welcome" 3 messages ( timer) this code : int = 0; protected override task onconnected(irequest request, string connectionid) { //first message connection.send(connectionid, "first !"); //first message //last messages timer _timer = new timer(runme, new {con = connectionid, req = request}, 2000, 1000); //second message return connection.send(connectionid, "welcome!"); //second message } void runme(dynamic state) { if (i < 3) { connection.send((string) state.con, "loop " + i); i++; } } and here js code ( inside document.ready block) : ... connection.received(function (data) { $('#messages').append('<li><b>data received = </b>' + data + "<b>connectionid =</b> " + connection.id +

javascript - getSVGDocument is returning NULL in Chrome -

this question has answer here: how check if embedded svg document loaded in html page? 7 answers i'm starting use svg , have following code: html <embed id="embed" src="svg.svg" type="image/svg+xml" width="400" height="300" > <object id="object" data="svg.svg" type="image/svg+xml" width="400" height="300"></object> javascript $(window).load(function (){ //alert("document loaded, including graphics , embedded documents (like svg)"); var svgdoc_embed = document.getelementbyid("embed").getsvgdocument(); alert("my svgdoc_embed => " + svgdoc_embed); var svgdoc_object = document.getelementbyid("object").getsvgdocument(); alert("my svgdoc_object => " + svgdoc_object); }

java - Add html tags to list view row text -

in app create listview , normal construction of string bellow : final listview listview = (listview) findviewbyid(r.id.listview); string[] values = new string[] { "one", "two", "three", "four"}; but want add html tag text appear on each row have refer text string bellow : one.settext(html.fromhtml(getstring(r.string.one))); two.settext(html.fromhtml(getstring(r.string.two))); three.settext(html.fromhtml(getstring(r.string.three))); four.settext(html.fromhtml(getstring(r.string.four))); which mean text appear in list view row can can created : string[] values = new string[] { "one", "two", "three", "four"}; or refered string-arry bellow : <string-array name="days"> <item>one</item> <item>two</item> <item>three</item> <item>four</item> </string-array> but not want , want retrive text str

php - Countdown for 7 hours then show ok -

how can countdown 7 hours variable time (i time table inserted timestamp), after 7 hours variable time update table. i need that $time = 2013-05-18 02:00:00 // comes database $target = $time + 7hours // time database +7hours 2013-05-18 09:00:00 $until = $target - $time i need below code if ($until > 0 ) { echo "you need wait $until hours" } else { echo "time ok"; // update table } convert time string using strtotime($time)+25200 7 hour =60*60*7=25200 sec , check , add file cron job.

python - Flask-login with static user always yielding 401- Unauthorized -

i trying build super simple web app own use. i'll user, don't feel need involve database user management. i'm trying use flask-login, though call login_user succeeds, i'm still met 401-unauthorized page after redirect page @login_required . here entirety of app: from flask import flask, render_template, request, flash, redirect, url_for flask.ext.login import loginmanager, login_user, logout_user, current_user, login_required, usermixin app = flask(__name__, static_url_path="") app.secret_key = "[redacted]" login_manager = loginmanager() login_manager.init_app(app) #login_manager.login_view = "login" class user(usermixin): def __init__(self, id): self.id = id nathan = user('nathan') @login_manager.user_loader def load_user(userid): if userid == 'nathan': return nathan else: return none @app.route("/logout") @login_required def logout(): logout_user() retur

Error while creating web service using apache CXF wizard -

i creating web service through apache cxf. while proceed(before wsdl gets created), receive following error exception in thread "main" java.lang.noclassdeffounderror: org/apache/cxf/tools/java2wsdl/javatowsdl this seems java2ws.bat file has error. statement in bat file "%java_home%\bin\java" -djava.endorsed.dirs="%cxf_home%\lib\endorsed" -cp "%cxf_jar%;%tools_jar%;%classpath%" -djava.util.logging.config.file="%cxf_home%\etc\logging.properties" org.apache.cxf.tools.java2ws.javatows %* it seems @ run time,jvm not able find cxf.jar.i added in classpath still same error please me solve issue the problem arises while creating jvm. can refer : java refuses start - not reserve enough space object heap it solved problem.

java - How to add JRBeanCollectionDataSource data into table of content in Jasper Report? -

i have data in jrbeancollectiondatasource. want add data table of content in jasper report. tried unable map structure. have added code below reference. arraylist<studentdetails> studentreportlist = new arraylist<studentdetails>(); studentreportlist = getstudentreportlist(); jasperreport jasperreport = null; jasperprint jasperprint = null; hashmap<string, object> reportparms = new hashmap<string, object>(); jasperdesign jasperdesign = jrxmlloader.load("studentreport.jrxml"); jasperreport = jaspercompilemanager.compilereport(jasperdesign); jrbeancollectiondatasource beancoldatasource = new jrbeancollectiondatasource(studentreportlist); jasperprint = jasperfillmanager.fillreport(jasperreport,reportparms,beancoldatasource); please find studentreport.xml file <?xml version="1.0" encoding="utf-8"?> <jasperreport xmlns="http://jasperreports.sourceforge.net/jasperreports" xmlns:xsi="http://www.w3.org/200

.net - How to display the members of a second Class in a Datagridview -

i have arraylist of objects (for example employees). employee class properties: name (string), email (string), telephone (string), workgroup (workgroup) the employee class has property workgroup, contains workgroup-object: workgroup class properties: name (string), email (string)). i tried display values , set datapropertyname of columns these values: " name ", " email ", " telephone ", " workgroup.name ", " workgroup.email ". but did not work workgroup-properties. is there simple way without writing wrapper-class, exposes properties of employee , workgroup? i have many objects similar relationships in project , want migrate datatables native sql object-relational-mapper nhibenate. expensive write additional mapper-classes views. i'm programming in java eclipse , there can solve problem using interface itablelabelprovider. friend class employee public name string public pho

rest - Meteor.js apps and API's -

i'm trying work out if meteor.js fit app build. the app web based require me implement restful api exposes of functionality. is doable meteor.js or express/sinatra better suited? it doable meteor using meteor-collectionapi atmosphere package. see is meteor option, if need additional rest api? .

c++ - How to declare a pointer to a function of return type X and input parameter A? -

what general form of declaring pointer function which, of return type x , accepts input parameter &y? is it: x my_function(y &y){ //code } x (*my_pointer) (y &y) = my_function; ? x (*fptr)(y&) = my_function; or: auto fptr = my_function; // c++11 or: std::function<x(y&)> fptr(my_function); // c++11, boost::function if not

javascript - JQuery Load, Notify Calling Window? -

i using jquery event "load" notify when entire html window has loaded scripts have executed. understand intention of function used in document.ready event. however, have 1 window spawning other windows , need parent window notified when child window finished loading can insert saved content. can please guide me in right direction. thank you! you can check loaded event using load event $('#iframe').on('load', function (e) { //....... });

playing audio in HTML5 after changing source with jQuery -

the strangest thing: have jquery function changes source of audio player. works if insert "alert()" in between. otherwise returns nan. jquery: $('.playpause').click(function(){ if (playmode==false){ audio = $('#player audio').get(0); $(audio).attr('src','newurl.mp3'); playmode = true; /*alert('wait minute!');*/ audio.play(); } else { audio.pause(); playmode = false;} }) i imagine has browser not having time load data? thoughts? thanks! works me :>> <script> jquery(document).ready(function ($) { $('.button').click(function(){ var myaudio=$(".playpause"); var audiosub = myaudio.get(0); var playmode=audiosub.paused; if (playmode){ myaudio.attr('src','song.mp3'); playmode = true; au

c# - Delete record from a sql table by selecting from gridview on button click -

i want delete record datagridview that's in 1 form pressing button in form. getting nullreferenceexception unhandled error. new c# if write me correct code appreciate it. here's got far. private void button1_click(object sender, eventargs e) { sqlconnection con = new sqlconnection(@" data source=home-d2cadc8d4f\sql;initial catalog=motociclete;integrated security=true"); sqlcommand cmd = new sqlcommand(); (int = 0; < datagridview1.rows.count; i++) { datagridviewrow dr = datagridview1.rows[i]; if (dr.selected == true) { datagridview1.rows.removeat(i); try { con.open(); cmd.commandtext = "delete motociclete codm=" + + ""; cmd.executenonquery(); con.close(); } catch (exception ex) { messagebox.show(ex.tostring()); } } } thi

ef code first - Unique index with fluent api -

i got table person, order , personorder. in table personorder have column personid , orderid. how can create unique index between these columns fluent api ? this try: modelbuilder.entity<personorder>() .haskey(l => new { l.personid , l.orderid}); [table("personorder")] public class personorder { public int personid { get; set; } public int orderid{ get; set; } public virtual person person { get; set; } public virtual order order { get; set; } } i had think while probably mean. think mean there non-unique indexes on personorder.personid , personorder.orderid . but there is unique index on primary key personorder.personid + personorder.orderid . , that's thing should unique. index on individual fields can never unique. mean association in fact not many-to-many, one-to-many. or you're after: have 1 (person) many (orders) association? (with unique personorder.orderid ). in case might model association regu

javascript - jQuery UI returning "undefined" for Timepicker add-on in Wordpress -

i attempting utilize trent richardson's timepicker jquery ui plugin add time picking widget wordpress plugin. jquery , jquery ui both enqueued should , working fine (the datepicker/slider requirements timepicker have both been verified included , working timepicker script loading fine). however, firebug giving me following error: typeerror: $.ui undefined the line in question this: $.ui.timepicker = $.ui.timepicker || {}; i understand it's occurring because reason script isn't finding $.ui (which assume standard notation referring jquery ui?) tried pre-defining $.ui @ top , got rid of undefined error, threw for $.datepicker that further on down in code on line 973. there doesn't seem lot of sense in explicitly defining $.ui , $.datepicker in top of script when should valid references jquery objects... i'm not sure how fix appears broken link. i ended finding timepicker plugin worked right "out of box" speak. literally changed

html - Linking external stylesheets on Linux Mint not working? -

i changed operating system windows 7 linux mint 14. i make web programs on computer practice, link external stylesheets , javascript files. for reason linux, when link external stylesheet, doesn't work. html , css in same folder/directory. here have tried: <link rel="stylesheet" type="text/css" href="finder.css"> and <link rel="stylesheet" type="text/css" href="/home/bradley/programming/finder.css"> i can't see figure out why neither of them working. solutions? able link files on windows fine.

extjs - Sencha Touch CMD installation issues -

Image
i have mamp server running on mac. in directory path: /applications/mamp/htdocs/myapp/sencha-touch-2.2.0-gpl/ sdk copied. i downloaded latest sencha cmd tool sencha touch website: http://www.sencha.com/products/sencha-cmd/download mac version 3.1.1 mac on installing sencha cmd tools: chose administrator/bin/ folder install into. got installed successfully. after that, opened terminal window of mac, navigated sdk folder , typed sencha command. got following issues: the sencha cmd not reflecting correct version. also, same warning error pops when try create new sencha app. could please guide correct method of installing sencha cmd or there thing have missed out? thanks, ankit tanna. for me it's in ~/.bash_profile . open text editor. should remove path sdk tools , add path sencha cmd if it's not there yet. for example, in ~/.bash_profile , have # export path=/users/titouanvanbelle/bin/sencha/cmd/3.0.2.288:$path export path=/users/titouanva

php - Put css into head but css is part of an imported file -

webpagetest.org tells me http://mypage.com/howitworks has css in document body: link node http://mypage.com/design_header.css should moved document head. this design_header.css stylesheet of header.php imported in body e.g. <body> <?php include 'header_login.php'; ?> </body> is there can this? i guess might tell you need decent php templating system views ( smarty ?). but, if you're looking quick solution, try leverage output buffering needs: <?php // @ top of parent page function move_css_to_head($buffer) { // dom manipulation here achieve goal $dom = new domdocument; $dom->loadhtml($buffer); $head = $dom->getelementsbytagname('head')->item(0); $body = $dom->getelementsbytagname('body')->item(0); $css_elms = $body->getelementsbytagname('link'); foreach ($css_elms $elm) { $head->appendchild($elm->clonenode()); $body->remov

Error Running Android Project in Intellij IDEA -

when run android project in intellij idea using avd error android-apt-compiler: cannot run program "/users/myaccount/documents/android-sdk-macosx/platform-tools/aapt": error=2, no such file or directory can help? in advance! i resolving on mac 10.8 copied aapt , lib\dx.jar , dx from build-tools/18.0.1 platform-tools

Ruby ternary operator structure -

puts bool ? "true" : "false" is proper, but bool ? puts "true" : puts "false" is not. can explain me why is? side note: bool ? ( puts "true" ) : ( puts "false" ) works fine well. when don't put parentheses on method call, ruby assumes want end of line arguments. say, these calls equivalent (and invalid): bool ? puts "true" : puts "false" bool ? puts("true" : puts "false")

authentication - Google script: cannot refer to users using Session.getActiveUser() -

i have google script executes me. in script, want know user's email. refer email of user accessing application session.getactiveuser().getemail() that's not working out @ all. google script giving error, saying session.getactiveuser().getemail() null. when manually enter dummy email instead of session.getactiveuser().getemail(), code works perfectly heeeeelp ps: app must execute me, because needs access contacts. you cannot have session.getactiveuser().getemail() return user's email id while app running you. there workarounds can try ask user's email id explicitly. write 2 scripts - 1 front end ui etc. run user accessing app (this allows session.getactiveuser().getemail() return user's email address). have second script tasks contacts accessed. call second script first using dopost , doget methods in second script. example, script 1: function whatever(){ urlfetchapp.fetch('service_url_of_script_2'); } script 2: function

c - How can I write an SPI driver for Zynq 7000 ARM development board? -

i'm going write spi driver arm devlopment board. not used linux. yesterday, read qspi driver xilinx provided , tried successfully. however, write own spi driver. here questions: what difference between qspi , spi on usage? if write driver based on qspi, work? if write driver scratch, basic procedure (read / write / initialize)? and finally, why must spi send , receive @ same time? thanks everybody. i think may easier start last question first. why must spi send , receive @ same time? the easy answer is part of protocol. data shifted out on mosi line master slave, data in slave's buffer shifted master on miso line. allows hardware use single register in each device both data being sent , data being received. there diagram of process here: http://en.wikipedia.org/wiki/serial_peripheral_interface_bus the not easy answer spi not defined standard. there different types of implementation depending on devices using. there variant mosi , miso li

codeigniter - Particular Issue - Git - Incorporating Multiple Repositories -

i planning start new website , use of libraries newly moved git. have made post commit hook bitbucket , have php deploy script in root of web host. intention when make push, deployed server. this question regarding how can organize content & libraries in website. i have customized version of codeigniter i have few libraries need use (from old projects) all of these git repos not following codeigniter folder structure my server doesn't have git the deploy script such download repo , extract it, nothing fancy all sources in [root]/src folder ideally, this. go src , sort of fetch codeigniter library got libraries folder , kind of fetch each library have when of these come stable release, go respective folder , update after doing reading am. i might able add remote codeigniter repo. when updated, rebase i use git submodules, not deploy src (i need src there deployment purposes) i can't add remote , fetch libraries don't follow codeigniter folder

Java Swing Button Listeners not working -

i have 2 button listeners game board using java swing. a tetris grid created , addition functionality within each button listener. i set board in play.java: final tetrisgame g = new tetrisgame(11,1); final boardgraphics graphics = new boardgraphics(tetrisboard.board_width, 40, g); the button listeners created in same play.java: graphics.btnstart.addactionlistener(new actionlistener() { public void actionperformed(actionevent e) { action arc = p.getaction(g); g.update(arc); graphics.colours.clear(); graphics.setcolor(g.getboard().getgrid()); while (arc instanceof store){ arc = p.getaction(g); g.update(arc); graphics.colours.clear(); graphics.setcolor(g.getboard().getgrid()); } graphics.tiles.redraw(); system.out.println(); system.out.println(g.tostrin

java - Creating multiple transactions in a single hibernate session -

i have created quartz job runs in background in jboss server , responsible updating statistical data @ regular interval (coupled database flags) to load , persist using hibernate 4. works fine except 1 hick up. the entire thread i.e. job wrapped in single transaction on period of time (as amount of data increases) becomes huge , worry some. trying break single large transaction multiple small ones, such each transaction process sub group of data. problem: tried lamely wrap code loop , start/end transaction @ start/end of loop. expected didn't work. have been looking around various forums figure out solution have not come across indicates managing multiple transaction in single session (where in 1 transaction active @ time). i relatively new hibernate , appreciate points me direction on achieving this. update: adding code demonstrate trying achieve , mean when breaking multiple transaction. , stack trace when executed. log.info("starting calculation job.&quo

How to set 'Automatic proxy configuration url' by tweaking Firefox preferences using Selenium WebDriver? -

for testing application, i've set 'automatic proxy configuration url' similar ' http://abc.xyz.com/tester/proxy ' in order that, did following: profile = selenium::webdriver::firefox::profile.new proxy = selenium::webdriver::proxy.new(:http => "abc.xyz.com/tester/proxy") profile.proxy = proxy driver = selenium::webdriver.for :firefox, :profile => profile but sets 'manual proxy configuration' please me on how set 'automatic proxy configuration url'? following code sets automatic proxy configuration url: require 'selenium-webdriver' profile = selenium::webdriver::firefox::profile.new profile['network.proxy.type'] = 2 profile['network.proxy.autoconfig_url'] = "http://abc.xyz.com/tester/proxy" driver = selenium::webdriver.for :firefox, :profile => profile

android - Application folder not found -

i'm trying save 1 image on application folder remove image when user un-install application, when try open application folder manually can't see it. example : "data/data/myapplicationfolder/" is there anyway make folder visible ? application folder data/data/ not visible user unless device rooted

c# - How can I export text and image to PDF using iTextSharp? -

Image
i having problems itextsharp , exporting .pdf i'm using itextsharp 5.1.2.0. issue is, however, when try export 1 rtf snippet referring image, image not display. also, if insert formatting document, rich formatting code appears instead of displaying interpreted text formatting. because image doesn't export, , document doesn't keep formatting, assume there's wrong code isn't allowing saved rich text document. my code exporting document pdf follows: savefiledialog dlg = new savefiledialog(); dlg.filter = "portable document format (.pdf)|*.pdf"; dlg.filterindex = 0; itextsharp.text.document mydocument = new itextsharp.text.document(pagesize.a4); dialogresult dialog = dlg.showdialog(); if (dialog == dialogresult.ok) try { filename = dlg.filename; pdfwriter.getinstance(mydocument, new filestream(dlg.filename, filemode.create)); mydo

ios - populating images in UIScrollView. And how to do it lazily -

well usual domain now, have managed functionality, need make better. i trying populate recent images camera roll. i'm pretty sure there more elegant way it. thing thats making me uneasy is, block > loop > block better solution or simplification appreciated. alassetslibrary *assetslibrary = [[alassetslibrary alloc] init]; [assetslibrary enumerategroupswithtypes:alassetsgroupsavedphotos usingblock:^(alassetsgroup *group, bool *stop) { if (nil != group) { [group setassetsfilter:[alassetsfilter allphotos]]; nslog(@"%d images found", group.numberofassets); for(int = group.numberofassets - 5; i<group.numberofassets - 1; i++){ [group enumerateassetsatindexes:[nsindexset indexsetwithindex:i]

google map api v2 it was appearing [Android] -

the map appearing gray blank screen zoom buttons, changed api key nothing changed re-install google play service in android sdk , nothing changed. any !! http://farm8.staticflickr.com/7347/8752555837_4bd5d0abee_m.jpg thanks you have incorrectly set api up. related api key.

jquery function call multiple times on class name need to prevent -

i need call js function on list item click when event fires calls event number of times js $('.first').click(function () {     //remove previous class , add clicked tab     items.removeclass('current');     $(this).addclass('current');     $('#v-nav>div.tab-content').hide().eq(items.index($(this))).show();     window.location.hash = $(this).attr('tab'); }); html <div id="v-nav"> <ul> <li tab="tab1" class=" first cmcltabcss current "> <span class="spn_inercom"> commercial sector </span> <span class="tab1current spn_nmbr"> </span></li> <li tab="tab2" class="first dmtabcss"><span class="spn_inerdip">diplomatic missions</span><span class="tab1currentd spn_nmbr"></span></li> <li

compilation - Android Studio Gradle error -

everything ok when try run gets 1 error gradle: : java.lang.nullpointerexception please me, because wanna throw stuff ntb down cliff, after 5 hours of configuring git, android studio , copying projects eclipse, still got this you need make sure gradle installed , configured in preferences.

matlab - crop image with fixed x/y ratio -

i want crop image using following code. want user can select crop area predefined x/y ratio.for example if x=2,y=2 ,then user can use mouse select area (x/y)=1 ratio. i = imread('image.jpg'); [rows columns numberofcolorbands] = size(i); i2 = imcrop(i); imshow(i), figure, imshow(i2) you use imrect produce coordinates, , pass imcrop. figure, imshow(i); h = imrect(gca,[10 10 100 100]); setfixedaspectratio(h,1); % fixes aspect ratio; user can change size/position position = wait(h); % returns coordinates in "position" when user doubleclicks on rectangle i2 = imcrop(i,position); figure, imshow(i2); in actual code, you'll have replace [10 10 100 100] of appropriate size/aspect ratio images. may want add other constraints imrect (for example stop user moving rectangle outside actual image).

wpf - ContextMenu for DataGrid ColumnHeader is not showing after applying this style? -

if apply style wpf datagrid, context menu columnheader not showing. shows if remove style. what's wrong or missing in style? <style x:key="defaultcolumnheader" targettype="{x:type datagridcolumnheader}"> <setter property="verticalcontentalignment" value="center" /> <setter property="template"> <setter.value> <controltemplate targettype="{x:type datagridcolumnheader}"> <dg:datagridheaderborder x:name="datagridheaderborder" margin="-1 0 0 0" verticalalignment="top" height="24" isclickable="{templatebinding canusersort}" ishovered="{templatebinding ismouseover}" ispressed="{templatebinding i

javascript - Is there a way to wrap this JS call neatly? -

let's have: var details = { method: 'post', url: 'http://example.com/', async: true, params: {'param1': '1', 'param2': '2'}, headers: {'if-modified-since': 'sat, 1 jan 2000 00:00:00 gmt', 'cache-control': 'max-age=0'}, contenttype: 'text' }; kango.xhr.send(details, function(data) { if (data.status == 200 && data.response != null) { var text = data.response; kango.console.log(text); } else { // went wrong kango.console.log('something went wrong'); } }); is there way wrap more neatly somehow - variables change / post, i'm thinking like: call('post', function(data) {}); is possible? i'm not familiar enough js. just wrap logic in function this: function getdata(method) { var details = { method: method,

android - setlayoutParams() throws an exception -

i'm working on subclass extends relativelayout, , have onscalegesturelistener . want when scale on view, height of change(it's scalaing, resizing object). takes me exception don't know how can interprete it. my code is: public class simpleonscalegesturelistener extends simpleonscalegesturelistener { @override public boolean onscale(scalegesturedetector detector) { tmpscale = detector.getcurrentspan() / detector.getpreviousspan(); log.d("debug", ".getcurrentspan() "+detector.getcurrentspan()); log.d("debug", ".getpreviousspan() "+detector.getpreviousspan()); log.d("debug", ".getscalefactor() "+detector.getscalefactor()); scaling = true; relativelayout.layoutparams params = new layoutparams(kticketwidth, (int) (getmeasuredheight()*mscalefactor)); setlayoutparams(params); //invalidate(); requestlayout(); return true; }

data structures - Number of binary tree with n node and n-3 height -

how many binary trees can find have n node , height of these tress n-3? the total number of binary tree possible n nodes = ( 2n c n ) / (n+1) . the minimum depth of binary tree ⌊log 2 n⌋ , maximum depth n-1 . so in each level level there [( 2n c n ) / (n+1)] / [(n-1) - (⌊log 2 n⌋)] nodes.

php - Backbutton With Ajax loading Content -

this load content page , change url. problem button , forward won't load content agin. change url. how can make them load function? <a onclick="load_content('p1');" >page1</a> <a onclick="load_content('p2');" >page2</a> function load_content(name) { window.history.pushstate(null, null, "/?page=" + name + ""); var xmlhttp; if (window.xmlhttprequest) {// code ie7+, firefox, chrome, opera, safari xmlhttp=new xmlhttprequest(); } else {// code ie6, ie5 xmlhttp=new activexobject("microsoft.xmlhttp"); } xmlhttp.onreadystatechange=function() { if (xmlhttp.readystate==4 && xmlhttp.status==200) { document.getelementbyid("response").innerhtml=xmlhttp.responsetext; } } xmlhttp.open("get","load_content.php?name=" + name + "",true); xmlh