Posts

Showing posts from July, 2013

css - div at incorrect position on Firefox -

i'm making card css animations, , on chrome/safari works great, on firefox 1 of divs getting out of position. open this fiddle on chrome/safari , on firefox see going on. know fix/workarround this? i managed firefox play nicer adding .perspective { ... position: relative; } that seems specify object left side absolutely positioned. must differ default between webkit , firefox. unfortunately looks there's timing issue now, @ least you're 1 step closer! cool looking effect nonetheless xd!

.net - How to check textbox text changed -

i have textbox of label "name" need disable button(that next button) long textbox empty. appproach private void planname_textchanged(object sender, textchangedeventargs e) { if (planname.text.length != 0) { parent.enableordisablenextbutton("enable") ; } } this working first time if user again clear name next button remain enable s or if cut whole field. how this? you need disable else: private void planname_textchanged(object sender, textchangedeventargs e) { if (planname.text.length != 0) { parent.enableordisablenextbutton("enable"); } else parent.enableordisablenextbutton("disable"); }

java - Server validation in other domain -

i need solution general problem have. i have site domain called foo.com , cross domain called foo_goo.com in foo.com there form several fields: username, firstname, lastname, email... when user press submit button (in form) need make server validation on fields, server make validation in cross domain ( foo_goo.com ). any solution problem? (ajax, json, servlet...) what prefer why it? i recommend php, proxy, there other solutions jsonp or feature in html5 might you: cross domain solutions full client main options found interesting: jsonp php proxy html5 window.postmessage

RapidMiner 5.2 Converting Numeric to Nominal and Reverse -

i clustering bunch of words k-means algorithm in rapidminer 5.2 converting nominal numerical before clustering. however, view clustering, need view numbers word. how can convert back? use parse numbers or guess types operators.

MetaData Error in a SSIS Package -

i have package load csv source files table. have 2 typs of source files, employee , employeedetails. for example employee csv file has 4 columns eid, ename, designation, age. employeedetails csv file has 6 columns eid, ename, designation, age, depatname, deptid . my destination table has eid, ename, designation, age, depatname, deptid. now, want load 2 files based on file type variable in variables collection. have completed part also. so instead of using 2 dataflow tasks, used one. dft has following transformations inside it. rawfilesource | derived column transformation | oledb destination table in control flow have used execute package task whcih calls child package when give filetype employee, runs employee package takes employee csv file , loads rawfile destination. if select file type employeedetails, runs employeedetails package takes employeedetails csv file , loads rawfile destination. now take raw file , need load destination table. ...

ruby on rails - db:create misreports database existence -

after creating new site commands rails new board --skip-bundle ... rake db:create i have message "xxxxx exists" not consistent , indicates goes wrong. reproducing: rails new board --skip-bundle ... $ rake db:migrate rake aborted! fatal: database "boardio" not exist tasks: top => db:migrate (see full trace running task --trace) if try create db then: $ rake db:create boardio exists it says here "exists". said "does not exist": why rake gives wrong message? going wrong? after migration seems runs ok: $ rake db:migrate == createmytables: migrating ================================================= -- create_table("users") notice: create table create ........column "users.id" ............. details versions: $ ruby --version ruby 1.9.2p290 (2011-07-09 revision 32553) [i686-linux] $ rails --version rails 3.1.3 thank you. without knowing more, i'm not sure what's causing odd behavior...

Optimizing JQuery based animation by caching selector result? -

i've made animation who's based on following jquery functions : hide(), show(), animate(). this animation consumes lot of cpu (the flash cpu usage), chrome tells me (through css selector profiling tool) i've lot of similar css selectors usage (css selector profile). does these selectors used rendering engine ? include jquery node search while using $() (i assumed it's called hide(), show() or animate()) ? if yes second question, how override function cache node ? (by hard coding few selectors result won't change in animation logics). edit : i'm implementing transition between frames, each frame ken burns effect on background edit2 : here's jquery plugin use css3 animation when possible https://github.com/benbarnett/jquery-animate-enhanced if doing alot of jquery animations using code following: $('div.myclass').show(); ... $('div.myclass').hide(); .... $('div.myclass').toggle(); you might want @ chaining jq...

iphone - Issue with ASIHTTPRequest -

i understand asihttprequest project abandoned ben, anyway late me switch else decided try deal issue have. i'm posting , request https protocole. i've disabled persistence connection on request. asiformdatarequest *request = [asiformdatarequest requestwithurl:url]; [request setusekeychainpersistence:yes]; [request setshouldattemptpersistentconnection:yes]; // set request timeout [request settimeoutseconds:request_time_out]; // upload image nsdata *imagedata = uiimagepngrepresentation(imagecontainer.mimage); [request setpostbody:[nsmutabledata datawithdata:imagedata]];; [request setdelegate:self]; [request setdidfinishselector:@selector(uploadrequestfinished:)]; [request setdidfailselector:@selector(uploadrequestfailed:)]; [request startasynchronous]; and i'm getting a connection failure occurred kcferrordomaincfnetwork error -1005 . i've enabled debug info in configs of asihttprequest project , have got...

search for a string in a pdf file using php -

i want search string pdf file in way strstr() does. when pdf read plain text, gives non-understandable junk. how do it? perhaps pdflib has solution, hosting provider doesn't me install it. you don't have pdflib library, can use fpdf or tcpdf . and 1 article pdf reading php here .

ASP.NET authentication design -

could please validate if authentication solution elegant , safe enough. web.config <authentication mode="forms"> <forms name=".aspxformsdemo" loginurl="logon.aspx" protection="all" path="/" timeout="30" /> </authentication> <authorization> <deny users ="?" /> <allow users = "*" /> </authorization> in logon.aspx.cs have 2 methods: private bool validateuser(string username, string password) private void loginbutton_click(object sender, eventargs e) inside validateuser method doing executing sql query check if entered credentials similar database records. if credentials match want perform redirection page called privateroom.aspx using response.redirect("privateroom.aspx", true); what guys think such design? how elegant , how secure? actually, how protect privateroom.aspx ag...

python - Getting list and dict values - Django -

i have problem. new django , trying figure out how can specific values out of list , dict views.py. have following dict output: {'meta_title': u'alaska state fair events', 'varos_id': 2886429l, 'longitude': -149.13053600000001, 'name': u'palmer', 'thumbnail_id': 8406l, 'image': u'photologue/photos/2c18fe09-275b-4770-aab6-230cff72b2ee.jpg', 'orszag_id': u'us', 'helyszin': u'alaska state fair, 2075 glenn highway palmer, ak 99645, united states ', 'slug': u'alaska-state-fair-palmer-ak', 'latitude': 61.580159999999999, 'allam_id': u'ak', 'nev': u'alaska state fair, palmer, ak', 'id': 2886429l} what want quite simple. want address variables image=szorakozohelyquery('image') result in image=photologue/photos/2c18fe09-275b-4770-aab6-230cff72b2ee.jpg is there easy way this? easiest way list? d.get(...

c# - AWS SDK for .NET ListBuckets error -

i using simple aws sdk .net documentation sample, in c# windows application, in order list buckets , receiving error below. can create buckets , upload files fine can not listing/getting of buckets/objects? please me out? thanks. error message - there error in xml document (2, 2). error inner exception - not expected." error stacktrace - @ system.xml.serialization.xmlserializer.deserialize(xmlreader xmlreader, string encodingstyle, xmldeserializationevents events)\r\n @ system.xml.serialization.xmlserializer.deserialize(xmlreader xmlreader)\r\n @ amazon.s3.amazons3client.processrequestresponse[t](httpwebresponse httpresponse, s3request request, type t, t& response, exception& cause)\r\n @ amazon.s3.amazons3client.handlehttpresponse[t](s3request userrequest, httpwebrequest request, httpwebresponse httpresponse, int32 retries, int64 lengthofrequest, t& response, exception& cause, httpstatuscode& statuscode)\r\n @ amazon.s3.amazons3client.getresponsecal...

database - What way is better when executing queries from Java -

i have following doubt. when have query db java application there several ways it. have came approaches, each of them have con. the first 1 is, have class eg. querymanager provides querying functionalities, executeupdate(...) , executequery(...) while hiding details of management of connections etc. (kind of facade pattern ). when need interact db, pass query string , manage resultset . the problem see if db changes, whether dbms or db itself, end going file file modifying sql. see huge dependency. also, exposing stucture of db , making each class handle resultset . on other hand, achive higher modularity using method, since models (i fan of mvc pattern ) of classes have package visibility. the second idea came mind creating querymanager class instead of providing methods querying, provide methods need. in other words, each time need use db, create method in class, sql inside, return information need. but, problem facing here is, have choose between returning resultset o...

RewriteLock hangs Apache on re-start when added to an otherwise working Rewrite / Rewritemap -

i on network solutions vps, 4 domain names share ip. have rewrite / rewritemap set works. rewrite in file example.com web address @ var/www/vhosts/example.com/conf/vhost.conf, rewrite being thing in vhost.conf file. not work in main httpd.conf file server. the rewritemap uses couple things in url typed in user (http://example.com/bb/cc) third piece of info (aa) matching database record, uses third piece of info query string load file, , leaves typed in url in address bar while showing file based on query string aa. here rewrite: options +followsymlinks rewriteengine on rewritemap newurl "prg://var/www/cgi-bin/examplemap.php" rewriterule ^/(example/.*) ${newurl:$1} [l] when add following either above or below rewritemap line: rewritelock /var/lock/mapexamplelock and try re-start apache, hangs , apache not re-start. have tried different file paths (thinking might permissions issue , hoping worked of course), taking away initial /, putting in quotes, different fi...

events - Sencha Touch 2 DataView itemtaphold not firing -

for life of me i'm unable dataview fire itemtaphold event no matter how attach event handler. itemtap event fires fine. closest i've been able come use longpress on dom elements doesn't give me reference control, dom element. itemtaphold event broken dataview on sencha touch 2 commercial? browsergrid.js: ext.define('myapp.view.browsergrid', { extend: 'ext.dataview.dataview', xtype: 'browsergrid', requires: [ 'myapp.view.browsergriditem', 'ext.dataview.*', 'ext.plugin.*' ], config: { usecomponents: true, cls: 'browser-grid', defaulttype: 'browsergriditem', scrollable:{ direction: 'vertical', directionlock: true }, plugins :[{xclass:'ext.plugin.listpaging',autopaging: true}], listeners: { itemtaphold: function() { console.log('tapped'); } } } }); browsergriditem.js ext.define('myapp.view.brow...

python - Installing MatPlotLib in windows -

i can't seem matplotlib work. downloaded , installed correct version (matplotlib-1.1.0.win32-py2.7.exe), , have numpy , scipy installed (and work no problems). this error get: c:\python code>python python 2.7.3 (default, apr 10 2012, 23:31:26) [msc v.1500 32 bit (intel)] on win 32 type "help", "copyright", "credits" or "license" more information. >>> import matplotlib.pyplot plt traceback (most recent call last): file "<stdin>", line 1, in <module> file "c:\python27\lib\site-packages\matplotlib\pyplot.py", line 95, in <module> new_figure_manager, draw_if_interactive, _show = pylab_setup() file "c:\python27\lib\site-packages\matplotlib\backends\__init__.py", line 25, in pylab_setup globals(),locals(),[backend_name]) file "c:\python27\lib\site-packages\matplotlib\backends\backend_tkagg.py", lin e 8, in <module> import tkinter tk, filedialog ...

python - Removing Selection, StyledTextCtrl - wxpython -

i function remove selection in styledtextctrl (select nothing) txt.setselection(-1,-1) #seems select txt.setselection(-1,0) # select first letter does know how can done? can't seem find in api try this: txt.setselection(0, 0)

asp.net - different view source content in browser and from httpwebrequest in c# -

i trying scrape content page: https://www.google.com/search?hl=en&biw=1920&bih=956&tbm=shop&q=xenon+12640&oq=xenon+12640&aq=f&gs_l=serp.3...3743.3743.0.3905.1.1.0.0.0.0.0.0..0.0.ekh..0.0.hq3xs7axfdu&sei=dr_mt_wom6no2awe25mtca&gbv=2 the problem experiencing opening url in browser need scrape scraping same link in code, 2 (important) pieces missing, reviews number , ratings, below price , seller info. here screenshot internal web client in c#: http://gyazo.com/908a37c7f70712fba1f82ec90a604d4d.png?1338822369 here code trying content: public string navget(string inurl, cookiecontainer incookiecontainer, bool gzip, string proxyaddress, int proxyport,string proxyusername, string proxypassword) { try { this.currenturl = inurl; httpwebrequest webrequest = (httpwebrequest)webrequest.create(inurl); webrequest.timeout = this.timeoutsetting; webrequest.cookiecontainer = incookiecontainer; ...

What is the best data structure in Perl to store tabular data? -

i have table following data 1.1.1.1 routera texas 2.2.2.2 routerb texas 3.3.3.3 routerc california what best data structure in perl store data? thinking of storing in hash of hash ip address key 1.1.1.1 routera => texas, 2.2.2.2 routerb => texas, 3.3.3.3 routerc => california but if want ip addresses in texas, data structure may not flexible enough. there better way store if care ip addresses in texas? pure perl task. think of table array of records. in perl speak, array of hash references. (an aoa may applicable @ times, remember timtowtdi) the keys of each hash reference correspond column/field name , values be, well, values particular record. converting op's example data structure: my @data = ( { ip => '1.1.1.1', router => 'routera', state => 'texas', }, { ip => '2.2.2.2', ...

Google Maps API v3 - GIcon is not defined -

i know issues v2 v3 can here fix it? gicon not supported v3? // google-map icon object var gmapicon = new gicon(g_default_icon); //change new google.maps.markerimage();??? // icon exist if ( mapelements[lmapelementindex]['icon'].tostring().length > 0) { gmapicon.image = html_entity_decode(mapelements[lmapelementindex]['icon']); gmapicon.shadow = ""; iconheight = mapelements[lmapelementindex]['iconheight']; iconwidth = mapelements[lmapelementindex]['iconwidth']; gmapicon.iconsize = new gsize(iconwidth,iconheight); gmapicon.iconanchor = new gpoint(0,0); gmapicon.infowindowanchor = new gpoint(15,10); } var markeroptions = { icon: gmapicon //change image? }; var marker = new google.maps.marker(point,markeroptions); found here https://developers.google.com/maps/documentation/javascript/overlays?hl=de-de#simpleicons thanks or tips! gicon not supported version 3, , not appea...

java - Equivalent in Objective c of BeanUtils.copyProperties. -

i know if have equivalent in objective c of java's methode "beanutils.copyproperties(bean1, bean2);" ? or other solution, cast motherobject childobject : @interface motherbean : nsobject{ ...} @interface childbean : motherbean { ...} motherbean m = [motherbean new]; childbean f = m; with first tests it's work have warning : "incompatible pointer types returning ..."; i use wsdl2objc , generate bean, , name of can change between 2 generation :-/ i prefere work child , change name in definition thanks anthony take @ commons-beanutils package. has lots of property method copy stuff. in particular: propertyutils.copyproperties(bean1, bean2); however, second question, you're trying downcast instance of parent class child class? i'm not sure how legal in oo language. sure can forcibly cast: // not legal because can't case 1 class anther // unless actual instance type (not declared type of variable, // constructe...

wordpress - check if field has new value in buddypress xprofile -

when user updates profile field "country" or "city" new value, want notified field has new value. curently i'm using doesn't tell fiels have been modified: add_action ('xprofile_updated_profile', 'profile_change_notify'); function profile_change_notify ($vars = array ()) { $user = new wp_user ($vars['user_id']); wp_mail ('myname@mydomain.com', 'subject ( ' . $user->user_login . ' updated profile )', 'message body goes here.'); } i appreciate help.. please use below code: function update_xprofile_country_state($user_id) { if (!empty($user_id)) { $user = new wp_user ($user_id); if (!empty($_post['country'])) { wp_mail ('myname@mydomain.com', 'subject ( ' . $user->user_login . ' updated profile )', 'message body goes here.'); } } } add_action('xprofile_updated_profile', ...

iis - PHP include_path not working as expected for PEAR -

system information: windows server 2003, iis6, mssql server 2008r2, php 5.2.19. i've attempted install pear on above server, installation going well. pear in path variable , runs fine, packages install without errors. php's include_path set in one-and-only php.ini file ".;c:\php5\pear" (which is, in fact, location of pear installation). phpinfo() call confirms change successful. however, can't include in pear directory - system.php or of packages. errors consistently of form: fatal error: require_once() [function.require]: failed opening required 'system.php' (include_path='.;c:\php5;c:\php5\pear') in... pulling command prompt , entering "edit c:\php5\pear\system.php" confirms file exists. of c:\php5 , subdirectories set read/execute permissions network_service, , full control others. have determined that, regardless of include_path set according phpinfo(), looking in working directory included files.

c# - ASP.NET Time Conversion on server (Daylight Savings) -

let me start off giving brief run down of our application! (please don't instantly turned off large post, quite simple scenario, descriptive!) have asp.net web site, c#, acts store front of stores within our franchise. each store in different timezone, need indicate on our site if store open or closed. the server has db hold rows indicate different time schedule different stores presented on our asp.net website. in database, have columns , rows hold location offset, , store hours in utc. example; locationid: 21 timezoneoffset: -5:00 sundayopen: 15:45 sundayclose: 16:20 i have come way determine on server if location open or not. having tough time determining if work daylight savings time. question is, account daylight savings time, , have gone scenario correctly, have not dealth time this? here's in server side code; //here important parts of class use hold store schedule db public class timeschedule { public timespan locationoffset { get; set; }...

character encoding - how to read/write text of specified charset in java -

i have scenario have read/write data from/into csv files. understand csv can read/written text file. what want know is, how handle charset? eg if piece of text has read chinese language csv file, how read it? try following: bufferedreader br = new bufferedreader(new inputstreamreader(myfile.getinputstream(), "iso-8859-15")); // give desired charset here

Selenium 'ant run-demo-in-parallel' command failure? -

i'm trying run selenium grid demo i'm having problem. i have hub set correctly 4 localhost remote controls. when try run them in parallel following result: [java] [java] =============================================== [java] selenium grid demo in parallel [java] total tests run: 4, failures: 4, skips: 0 [java] =============================================== [java] [build failed :\selenium grid\selenium-grid-1.0.8-bin\selenium-grid-1.0.8\build.xml:137: java returned: 1 total time: 1 second :\selenium grid\selenium-grid-1.0.8-bin\selenium-grid-1.0.8>] i have latest on version of: selenium webdriver remote control selenium grid apache ant is there workaround? selenium grid 1.x no longer supported. see notification here . per kevin - selenium grid 1 end of lifed please note selenium grid 1 no longer active project. repository exists historical artifact. new work has been going selenium grid 2, has been integrated directly selenium project , sourc...

How to store a line number in variable (shell script,unix)? -

file.txt below : gui : 789 gui : 789 gui : 789 gui : 789 abc : 120 the followibng gives o/p $ grep -n "gui : 789" file.txt | cut -f1 -d: 1 2 3 4 if there n number of such gui : 789 , how store line numbers of same ? you can use awk 1 liner: awk '/gui : 789/{print nr}' file to process inside loop: while read l echo $l done < <(awk '/gui : 789/{print nr}' file) edit: these command work number of matches in file. store output of above line numbers in array: arr=( $(awk '/gui : 789/{print nr}' x) ) later on process these array elements as: echo ${arr[0]} echo ${arr[1]} ... echo ${arr[5]}

PHP Popup Page show content of records in db -

i have links on php page lists records database. the links this: <a href="http://domain.com?id=1">view records</a> <--id @ end what want click on link , option popup shows fields id 1 what's easiest way show fields id=1 on popup when click link? for example: have table this: id | name | surname -------------------- 1 | bob | brown 2 | ken | blob and click on link looks this: <a href="http://domain.com?id=1">view records</a> i need popup open , display this: id - 1 name - bob surname - brown very rudimentary example of 1 (of many ways) popup window:: <a href="javascript:void(0)"onclick="window.open('http://domain.com/popup.php?id=1', 'view','width=300,height=200,menubar=yes,status=yes')">view records</a> popup.php: <?php $con = mysql_connect("localhost","username","password"); if (!$con) die('c...

drop down menu - jquery: remove spaces from selected state in option dropdown on change event -

in data query, tree structure: <select name="parent" id="select_parent"> <option> >administrator </option> <option> &nbsp;>manager </option> <option> &nbsp;&nbsp;>sales </option> <option> &nbsp;&nbsp;>operator </option> <option> &nbsp;>promoter </option> </select> obviously looks on combobox options, when select value ... shown complete spaces. want remove spaces when selected value. i tried this: $('#select_parent').bind("change",function() { var s = $('#select_parent option:selected').html(); $('#select_parent option:selected').html(s.replace(/&nbsp;/g, '')); }); but after eliminating spaces ... return see if item no longer has selected attribute? if you'd display selected list item still spacing while removing spacing in select's displayed text, can try hack: $('#s...

ios - in-app purchase, confused with guidelines -

i new ios, app building requires in-app purchase uses renewable-subscription model. user browse through many of available news letter options inside app , subscribe 1 or many of them individually. each of news letters individually available in-app purchases. my server requires these information stored in servers database(due logic use distribute news letters). user info. his subscriptions. i confused these 2 guidelines in-app purchases. auto-renewable subscriptions delivered of user’s devices in same way non-consumable products my understanding is, user's devices means, devices on user has logged on using same itunes account used purchase news letter subscription. please let me know if understanding correct. server product model: "...store kit not provide mechanism identify particular user. design may require provide mechanism identify user. if application requires these (for example, track subscriptions associated particular user), need design , imple...

java - Handle socket termination in android -

i connected device using following code. using socket code cam perfom tasks, need perform functions when server going down. not able find suitable method please help. edit i want detect when server disconnected client , means after doing transactions server disconnected can disable buttons , void sendrequest(){ try { this.clientsocket=new socket("192.168.1.11",2000); this.os=new dataoutputstream(this.clientsocket.getoutputstream()); this.in=new datainputstream(this.clientsocket.getinputstream()); sendfirtcommand(); client t=new client(); t.start(); }catch(exception e){ e.printstacktrace(); } }// end of sendrequest my thread code private class client extends thread{ int time; public void run(){ try{ while(true){ //if(in.read()==-1) break; int size =in.available(); if(size>0){ byte data[...

upload via admin using FileField in django -

i have weird. on win7 django 1.4. have following media_root/url settings : media_root = 'c:\project\uploads' media_url = '/media/' my url.py includes : urlpatterns += patterns('', (r'^media/(?p<path>.*)$', 'django.views.static.serve', { 'document_root': settings.media_root})) i have model the field : file = models.filefield(upload_to=media_root, blank = true) now, uploading file via admin site, file uploaded successfully. , when accessing file via admin see link file : http://127.0.0.1:8000/media/c:\project\uploads\[filename] i have no clue doing wrong. i think model wrong: file = models.filefield(upload_to=media_root, blank = true) upload_to expects relative path added media_root, expects file @ media_root/media_root makes no sense. try like: file = models.filefield(upload_to='files', blank = true) docs: filefield.upload_to local filesystem path appended medi...

wordpress - unexpected T_FUNCTION with php 5.2.17 but fine on localhost and php 5.3.10 -

i"m getting unexpected t_function php error after uploading wordpress files server running php version 5.2.17. the theme works fine on localhost (with mamp) , there no errors on own server runs php version 5.3.10. what can wrong or can done solve error? this line causes error: add_action('init', function() use($name, $args) { and entire functions.php file looks this: <?php /* add post type */ function add_post_type($name, $args = array() ) { if ( !isset($name) ) return; $name = strtolower(str_replace(' ', '_', $name)); add_action('init', function() use($name, $args) { $args = array_merge( array( 'label' => 'members ' . ucwords($name) . '', 'labels' => array('add_new_item' => "add new $name"), 'singular_name' => $name, 'public' => true, ...

javascript - Negative values not allowed -

what best way prevent users entering negative values in input text element? currently checking field value on blur, hoping has better solution. $(".payment").blur(function() { var payment = getamount($(this).val()); if(!isnan(payment) && amount >= 0) { $(this) .css("color", "black") .val(currency(payment)); } else { if(amount < 0) showmessage("negative amounts not allowed", "error"); $(this).css("color", "red"); } }); function getamount(stramount) { var amount = new string(stramount).replace(/\$/g, "").replace(/,/g, ""); return parsefloat(amount); } you use jquery's .keypress() , prevent default action - key. example: http://jsfiddle.net/5cgxg/ $("#target").keypress(function(event) { if ( event.which == 45 || event.which == 189 ) { event.preventdefault(); } }); ...

javascript - Issue with custom geometry and face normal -

i'm quite new threejs , have small issue (probably wrong usage). i'm trying create custom geometry , define faces normals myself. i create 1 normal in 1 direction , other 1 in opposite direction, mesh not 2 sided expect see 1 of face, can see both of them... idea of i'm doing wrong ? thanks! <body> <script src="../build/three.js"></script> <script src="js/stats.js"></script> <script> var container, stats; var camera, scene, renderer; container = document.createelement( 'div' ); document.body.appendchild( container ); scene = new three.scene(); camera = new three.perspectivecamera( 45, window.innerwidth / window.innerheight, 1, 2000 ); camera.up.x = 0; camera.up.y = 0; camera.up.z = 1; camera.position.x = 300; camera.position.y = -1000; camera.posi...

eigen - Using MPFR (mpreal) with Eigen3 -

i've seen on eigen3 website there "unsupported" module mpfr multi-precision data type. know how reliable is? my main goal not use mpreal, complex < mpreal >. it works fine far me , gives far can tell correct results. however run problems when trying complex others have pointed out complex works built in datatypes. don't know how produce arbitrary precission complex numbers.

pseudocode - Simple algorithm (pseudo-code) for line segment intersection -

i trying solve question, stuck on how make work. post question, , explain in it. given set of horizontal line segments , vertical lines of total size n, want compute number of horizontal segments intersected each vertical line. algorithm should of complexity o(n*logn), , should achieved sorting, following linear scan. horizontal segment specified 2 x-coordinates , y-coordinate, while vertical line specified single x-coordinate. output array of numbers count[l], 1 each vertical line l. for sorting, think sort entire set line finishes earliest (i.e. smallest second x-coordinate, or in case of vertical line, 1 x-coordinate) have linear progression through of lines. confused how linear scan following sorting should played out. if has hints, tips, or guidelines, appreciate it! ps: practise midterm, while it's not homework, still mark such. the question can written otherwise: foreach horizontal segment (x1,x2), find vertical lines intersect it. can sorting vertic...

jetty - JCS Admin page: Links on JSPAdmin.jsp do not work out of the box -

i have been working jcs while , seem have run issue jspadmin.jsp page comes bundled jcs download apache. page helps monitor cache elements in remote cache server setup. the links (summary | detail | clear) on page not seem work resource not found error when trying clicking those. jcs forums suggest tweaking couple of class files in jar enable did not work. the remote cache server setup within jetty. has run such issue , able configure pages links? main page works fine. thanks,

c# - Use a Web Service to Run SQL queries for a Windows Forms Client -

i need use windows application running on remote clients connect web service. web service access sql database verify users, , roles, , perform other tasks. using asp.net membership manage users , roles. have asp.net membership, , web service working on development machine. have windows client service reference works when access methods not access database, when try access service method access database method the user not associated trusted sql server connection. various permissions errors depending on try fix this, gist. don't want windows client need db permissions. want send user name, , password web service, web service wraps membership.validateuser(username, password) can tell me how set up? you should consider setting sql server use sql , windows authentication (mixed mode). it's running in windows authentication mode only. can take @ this link started. it sounds like, way have designed, have set account each user. in experience it's best create ...

ios - Push a uiviewcontroller on top of existing ViewController when my App becomes active again -

my app has multiple uiviewcontrollers can displayed user @ time. app can started document (for example, attachment mail app). the scenario following: - user starts app , navigates inside application - user puts app in background mode , goes mail app - mail app user selects mail attachment , opens attachment app - app enter in foreground , display attachment in specific view controller. - when user has finished attachment, should able return previous state in app (before attachment opened). i have overloaded following methods uiapplicationdelegate: - (bool)application:(uiapplication *)application didfinishlaunchingwithoptions:(nsdictionary *)launchoptions - (bool)application:(uiapplication *)application openurl:(nsurl *)url sourceapplication:(nsstring *)sourceapplication annotation:(id)annotation { - (void)applicationdidbecomeactive:(uiapplication *)application using these methods i'm able find if there's document displayed , if app started or not. my issue push s...

Android use SpannableString in widgets? -

can use spannablestrings in widget's textview? tried , rendered plain text. don't know if i'm doing wrong (most likely), or if isn't possible reason. here's code i'm using (nothing special really...) public static void updatewidgetstate(context paramcontext, string paramstring, integer appwidgetid) { spannablestring majorlabel = new spannablestring(""); spannablestring minorlabel = new spannablestring(""); if (position > -1) { majorlabel = getparsedmajorlabel(paramcontext); minorlabel = getparsedminorlabel(paramcontext); } remoteviews localremoteviews = buildupdate(paramcontext, paramstring, appwidgetid); localremoteviews.settextviewtext(r.id.majorlabel, majorlabel); localremoteviews.settextviewtext(r.id.minorlabel, minorlabel); } if display formatted text in textview , use fromhtml

xcode - TableView navigation - All the lables, textfields and images in one single ViewController or separate ones? -

i'm in start phase of first iphone app. tab based application each of tabs represent tableview menu x cells, leading other menus. i'm getting started, after watching several tutorials, reading lots of info apples database, here @ sof etc, , i'm confused i'm getting along in x-code.. basic things getting clearer, but.. there many options , many ways to things right , wrong, , i'm afraid of making big mistakes , screw up. point: what app red wine. guide/register on red wines sold in norway bottle imgs, info price, taste, etc. tableview main menu starting take form, i'm starting think wine register cells , how delegate info in detail view(s). should create 1 detailview winelistmasterviewcontroller, , add info wines lables/textfields/images onto background image in storyboard, coded show according cell press in list? with more 100 wines seems big mess lables in 1 view, seems more tidy make 100 views , make connections winelistmasterviewcontroller each of ...

asp.net mvc - is it possible to separate my admin section from regular web site without creating another web app project? -

i built web application using asp.net mvc3. need add admin pages monitor , manage user accounts , posts. right now, admin , regular web site sitting in same web application. if made small change admin pages, still need compile everything. way separate them, need upload admin without touching web site. solution can think of create web app. there way it? you can separate mvc application areas http://msdn.microsoft.com/en-us/library/ee671793.aspx areas better organize application won't let deploy area, vs2010 have deployment features. her's article http://weblogs.asp.net/scottgu/archive/2010/07/29/vs-2010-web-deployment.aspx

python - Strange error: AssertionError: Request global variable is not set -

im getting frustrated error. after updated sdk 1.6.6 im starting see following error first time run handlers. assertionerror: request global variable not set. the important part of stacktrace request global variable not set. traceback (most recent call last): file "/base/python27_runtime/python27_lib/versions/third_party/webapp2-2.5.1/webapp2.py", line 1536, in __call__ rv = self.handle_exception(request, response, e) file "/base/python27_runtime/python27_lib/versions/third_party/webapp2-2.5.1/webapp2.py", line 1530, in __call__ rv = self.router.dispatch(request, response) file "/base/python27_runtime/python27_lib/versions/third_party/webapp2-2.5.1/webapp2.py", line 1278, in default_dispatcher return route.handler_adapter(request, response) file "/base/python27_runtime/python27_lib/versions/third_party/webapp2-2.5.1/webapp2.py", line 1102, in __call__ return handler.dispatch() file "/base/data/home/apps/s~...

Kohana 3: Validation rule for has_many through relationship -

is possible create validation rule in kohana 3 validate has_many through relationship? using example on guide page , blog post can have many categories through categories_posts table. there validation rule can setup in post model verify @ least 1 category added? i tried following: public function rules() { return array( 'categories' => array( array(array($this, 'has'), array('categories')) ) ); } because see orm::has function return true/false. think because 'categories' relationship, , not field, rule wrote never gets checked. any ideas? you must save post before adding has_many relations. can check post categories after saving, , mark draft if not set.

javascript - InfoBubble open specific tab -

in javascript, found neat little plugin google maps api v3, called infobubble . great job @ making easy have highly customized info windows. can't seem find in there though how open specific tab through function call , not click on tab button. tried settabactive(index) 1 of functions of plugin doesn't seem work. missing obvious or more digging right function in js file? for reference, here's code: var center = new google.maps.latlng(//...getting lat/lng coords... var bubble = new infobubble( { map: mothermap, position: center, minheight: 250, maxheight: 250, minwidth: 250, maxwidth: 250, tabclassname: "contenttab", padding: 3 }); //...creating tabs, getting tab should opened, setting value of tabtoshow , on... //at point i've checked console.out() , tabtoshow number 0-2 bubble.settabactive(tabtoshow); even code, first tab opened every time. thoughts appreciated. edit : fixed problem myself right after posting here....

ruby on rails - Meta_search error with model associations -

i have these in controller: class accountscontroller < applicationcontroller def index @search = account.search(params[:search]) @accounts = @search.order("id desc").includes(:chef).page(params[:pagina]).per(10) end end my view: <%= f.text_field :username_or_email_or_chef_name_contains %> works fine! but, when search based on email , got error: activerecord::statementinvalid in accounts#index mysql2::error: column 'id' in order clause ambiguous: select `accounts`.`id` t0_r0, `accounts`.`chef_id` t0_r1,... if take off .includes(:chef) of account controller, works fine. question why error? performance reasons, wouldn't remove include account controller. the accounts table , chefs table each have id column, mysql doesn't know of columns should order by. try specifying table name in order clause: @accounts = @search.order("accounts.id desc").includes(:chef).page(params[:pagina]).per(10)

java - download a file using apache http -

i trying download zip file page requries username/password access ( html form based authentication). using apache http library it. earlier had worked on similar, page required password download file. here code defaulthttpclient httpclient = new defaulthttpclient(); httpclient.setredirectstrategy(new defaultredirectstrategy() { public uri lastredirecteduri; public boolean isredirected(httprequest request, httpresponse response, httpcontext context) { boolean isredirect = false; try { isredirect = super.isredirected(request, response, context); } catch (org.apache.http.protocolexception e) { ...

c# - Pivot Double Click - Show Detail event -

is there way can capture pivot double click event ? (the event generates detail view on sheet.) is there way can see whole datasource of selected pivot datatable ? i using c#, vsto programming. here's how you'd in vba. put code in worksheet's code module: private sub worksheet_beforedoubleclick(byval target range, cancel boolean) dim pt excel.pivottable on error resume next set pt = target.pivottable if err.number = 0 msgbox "captured" 'to cancel uncomment next line 'cancel = true end if end sub edit: "i looking after double click event, need capture range of values on new sheet." try then. put in thisworkbook module. uses module-level variable track whether pivot double-clicked , checks in newsheet event. private pivotdoubleclicked boolean private sub workbook_sheetbeforedoubleclick(byval sh object, byval target range, cancel boolean) dim pt excel.pivottable on error resume next set pt = target.pivottabl...

jade / express - when to use or not to use layouts -

i've started developing in express , new jade well. i'm having trouble deciding when it's appropriate use layouts , when not to. i'm having trouble deciding when it's appropriate use blocks vs. partials. any regarding appreciated. i'm little lost. it's matter of preference. if used wordpress have concept of header , footer include pages might not layouts. use layouts content blocks because non-layout way tends cause more repetition. as partials vs blocks. use partial items want reuse on different pages. while block chunk of html replaced child templates. an example of partial can html product. have thumbnail, title , description of product. might use partial while listing products in category. might use partial rendering list of search results. an example of partial can main layout contains header , navigation , content area. if want reuse main layout on multiple pages extend , overwrite block in child templates.

perl - How do i use Hypnotoad as a http server -

i trying use hypnotoad server serve static html pages. configuration need or shall keep static html files hypnotoad pick them. thanks!! iirc servers provided mojolicious , of hypnotoad one, serve static html folder named public . should need basic of applications start server. should enough simple use, #!/usr/bin/env perl use mojolicious::lite; # needed setup usual index.html landing '/' => sub { shift->render_static('index.html'); }; app->start; and run hypnotoad myapp.pl (assuming script saved myapp.pl , in same location public folder).

Facebook graph API won't return friends work history -

let's rule out obvious... my facebook app requests following permissions : user_work_history, friends_work_history ...so usual suspect (insufficient permissions) isn't source of problem. issue: the following graph api call works perfectly: /me/friends?fields=name,work i names, ids, work history, etc. you'd expect. but when replace /me user id of 1 apps users (who has authorized app), can see names , ids (no work or education fields). why this? the reason why, access token using not access token belonging user want at. check out token in linter tool (https://developers.facebook.com/tools/lint) , see belongs to. when user access token individual, can use friends. wont need specify /{userid}/friends?fields=name,work (although could), /me/friends?fields=name,work since access token belongs user id.

gwt-rpc delay window refresh -

i have following code in onmoduleload() of application: window.addwindowclosinghandler(new closinghandler() { @override public void onwindowclosing(closingevent event) { event.setmessage("if choose close, application sign out"); } }); //sign out on close window.addclosehandler(new closehandler<window>() { @override public void onclose(closeevent<window> event) { sendlogout(); } }); the sendlogout() function looks this: // set callback object. asynccallback<string> callback = new logoutcallback(this); // make call survey service. surveysystemservice.util.getinstance().logout(details, callback); where 'details' object. it works fine when window closed, if try refresh page, doesn't log out. figured since call asynchronous, doesn't finish getting message off server before module restarted. i've tried: 1. creating , call...

linux - Re-run bash script if another instance was invoked -

i have bash script may invoked multiple times simultaneously. protect state information (saved in /tmp file) script accesses, using file locking this: do_something() { ... } // check if there other instances of script; if exit exec 8>$lock if ! flock -n -x 8; exit 1 fi // script something... do_something now other instance invoked when script running exits. want script run 1 time if there n simultaneous invocations, not n-times, this: do_something() { ... } // check if there other instances of script; if exit exec 8>$lock if ! flock -n -x 8; exit 1 fi // script something... do_something // check if instance invoked, if re-run do_something again if [ condition ]; do_something fi how can go doing this? touching file inside flock before quitting , having file condition second if doesn't seem work. have 1 flag (lockfile) signal things needs doing, , set it. have separate flag unset execution part. request_fi...

Windows Azure - access webrole local storage from separate workerrole -

i'm running application on windows azure, mvc views need dynamic, started storing them records in database, quite keen move them physical location. my concept create physical file via code... worked great , speeds page load dramatically. of course before realised files available duration of role next looked @ start task create files when role started - realised separate instances weren't going sync unless monitored database changes. so moved start task function in run method of role checks database every 10 minutes see if changes have occurred. problem seems choke application (at least in warm stage). ideally move run function it's own worker role can sit there , push files out web role instances, i'm unsure on how go accessing web roles local storage worker role. can tell me whether possible? , point me in right direction achieve this? just clarify i'm trying achieve -view created in user interface running on web role , stored in database -separate ...

windows - Sorting directories named as guid -

Image
so in windows, if have bunch of directories named guid , sort on name, not sort alphabetically. think applies 7 , vista. have not found pattern either. windows thinking else? coding perspective, have legacy projects store assets in guid folders, , without sorting can difficult verify data. i mark ransom seems right how windows sorts. w7 seems natural sorting. "feature" can disabled using following instructions. however, 'tis stupid shame: cannot make these edits on windows 7 home premium. http://www.alliancegroup.co.uk/windows7-explorer-sort-order.htm barring can try: 1) type gpedit.msc in start menu’s search box , press enter. 2) navigate user configuration>administrative templates>windows components, , select windows explorer in left column of group policy editor. 3) disable numerical sorting in windows explorer in settings section of group policy editor.

Efficiently loading a csv file into a MySQL table -

the current way loading file is: load data local infile 'file_name' table tablea fields terminated ',' enclosed '"' lines terminated '\n'; is optimal way load in table in unix machine. create optimal table size? want table takes smallest space. myisam if table myisam, should following: set bulk_insert_buffer_size = 1024 * 1024 * 256; alter table tablea disable keys; load data local infile 'file_name' table tablea fields terminated ',' enclosed '"' lines terminated '\n'; alter table tablea enable keys; innodb if table innodb, should following: set bulk_insert_buffer_size = 1024 * 1024 * 256; load data local infile 'file_name' table tablea fields terminated ',' enclosed '"' lines terminated '\n'; no take least space (loading empty table), rows buffered in treelike structure in memory based on bulk_insert_buffer_size caching data quicker dur...

windows installer - Using Visual Studio to build a .msi file that has a custom action to run a .bat file -

i need use visual studio build .msi file execute commands have in .bat custom action. know can accomplish going .msi , altering tables , i've gotten work, it's short fix , need working. in particular want execute custom action on uninstall. first thing tried writing .exe called .bat. works stand-alone, whenever put files in file system , have custom action run .exe doesn't work. knows why.. the other thing did have custom action use cmd.exe .bat argument. error during uninstall , event viewer narrows down cmd.exe using /c "[targetdir]batfile.bat https://stackoverflow.com/a/6286046/1427105 . any thoughts can me out? what this? protected override void onbeforeuninstall(idictionary savedstate) { base.onbeforeuninstall(savedstate); string assemblypath = context.parameters["assemblypath"]; string parentdirectory = directory.getparent(assemblypath).fullname; string batch = path.combine(parentdirectory, "batfile.bat");...