Posts

Showing posts from September, 2013

php - Can I get a form_multiselect() to return the values I pass in rather than indexes? -

i have form_multiselect() perform search on items associated tags. form: <div class="control-group"> <?= form_label('tags: ', 'tag', $label_attr);?> <div class="controls"> <?= form_multiselect('tag[]',$tags,'','id="tag-select"');?> </div> </div> i fill form get_tags() model: public function get_tags() { $this->db->select('tag_name'); $this->db->distinct(); $this->db->from('offers_tags'); $query = $this->db->get(); $results = $query->result_array(); $tags_arr= array(); $i = 0; foreach ($results $id => $tag_name){ foreach ($tag_name $name){ $tags_arr[$i] = $name; ++$i; } } return $tags_arr; } i loop through associative $results array returned query. if not, form filled indexes , associated arrays, when w...

SQL Server 2012 Witness suspended -

we have 2 sql server 2012 servers configured in mirrored setup , using offsite (non-domain) server our witness. setup has been working fine time. yesterday had internet outage of course meant witness server not contacted either of sql servers. confirmed going management studio , seeing witness listed 'disconnected'. around 4 hours later internet connection restored , see witness (from networking perspective) sql server refused use or acknowledge again. we have run kinds of tests prove previous working configuration still valid why won't sql server accept witness, can contacted again? there have on 2 sql servers resume witness functionality? things tried: we've removed witness , added back. run netstat on witness server can see 2 sql servers connected on port 7024. if stop sql service on witness see these ports dropped. once service started again ports opened , connects 2 sql servers again. proves not network / firewall sql server problem. don't know...

fortran - omp sum reduction not updating variable -

i having issues using openmp sum reduction in code. en_par = 0.0d0 !$omp parallel reduction(+:en_par) default(private) shared(r,listvar,it,ic) !--- loop on neighboring cells cell_index = 1,26 !-- new_cell int. neighbor of cell ic new_cell = listvar%cv(cell_index,ic)%cnum !--- loop on atoms in cell neigh_cell j = 1, listvar%cl(new_cell)%num !--- pick particle in cell list !--- particle integer particle = listvar%cl(new_cell)%cmem(j) !--- obtain displacements !--- apply minimum image here !--- min variables doubls dx = r(1,particle)-r(1,it)-listvar%cv(cell_index,ic)%min_x dy = r(2,particle)-r(2,it)-listvar%cv(cell_index,ic)%min_y dz = r(3,particle)-r(3,it)-listvar%cv(cell_index,ic)%min_z dxmin = r(1,particle)-r(1,it) dymin = r(2,particle)-r(2,it) dzmin = r(3,particle)-r(3,it) dr2 = dx*dx+dy*dy+dz*dz if(dr2.lt.param%rcut2)then dr2i = 1.0d0/dr2 dr6i ...

lua - How to lower alpha behind overlay with composer? -

i trying figure out how fade parent screen reducing it's alpha when overlay shown, return alpha 1 after overlay goes away. i can seem make work following function lorebuttontap:tap(e) transition.to(scenegroup,{ alpha= .5, time= 400 }) composer.showoverlay("westeroslore", { effect ="fromtop", time = 800 }) loretap = display.newrect(_w,_h,_w*2,_h*2); display.getcurrentstage():setfocus(loretap) loretap.alpha = 0; loretap.ishittestable = true; loretap:addeventlistener("tap", loretap); function loretap:tap(e) transition.to(scenegroup,{ alpha= 1, time= 400 }) composer.hideoverlay("slideup",400); display.getcurrentstage():setfocus(nil) end i doing of inside of parent window. problem if player rapidly presses lorebuttontap (spams fast), crashes game claiming composer.hideoverlay("slideup",400); has become nil . a...

java - Calculating the distance between 2 Points in 2D and 3D -

i'm trying solve simple problem, have minor isses. hope can out beginner real quick ;) i have 2 classes 'point' , 'point3d' that: public class point { protected double x; protected double y; point(double xcoord, double ycoord){ this.x = xcoord; this.y = ycoord; } public double getx(){ return x; } public double gety(){ return y; } public static double distance(point a, point b) { double dx = a.x - b.x; double dy = a.y - b.y; return math.sqrt(dx * dx + dy * dy); } public static void main(string[] args) { point p1 = new point(2,2); point p2 = new point(5,6); system.out.println("distance between them " + point.distance(p1, p2)); } } and this: public class point3d extends point { protected double z; point3d(double x, double y, double zcoord){ super(x, y); this.z = zcoord; } public ...

javascript - Error passing arguements between promises in AngularJS -

i’m building promise chain contains 4 functions. purpose of promise make few api calls. each api call affects following one, , require multiple arguments. the basic flow of code below this: geocodelocation first function, , takes $scope.location input gets geocoded result object containing lat , lng , , formattedaddress getsearchcount second function requires result previous function. function queries api using restangular , returns plucked_result object. savelocation function requires both result , plucked_result create new location, based on whether plucked_result.search_count less 1 or not. search_count variable returned function. getphotos requires result , search_count arguments. using these builds api request url gets fired off. when response comes back, photos saved db. the error occurs within savelocation function. error being returned is: typeerror: cannot read property 'search_count' of undefined here's code (with few comments o...

jboss7.x - How to deploy EJB EAR file to JBoss 7 with JDeveloper -

i have project done in jdeveloper 11g ejbs. can write these ear file. now, how deploy file jboss app server? deployed jboss 6 server ever since upgraded 7 , nothing works. same beans work in 7? you can try creating "application server" connection in jdeveloper jboss server , application menu choose deploy... server. or can create ear in jdeveloper, pick jboss admin console , deploy it. whether work depends on in application.

c++ - Gmock - matching structures -

how can match value of element in union input argument e.g - if mock method following signatiure - struct somestruct { int data1; int data2; }; void somemethod(somestruct data); how can match mock method called correct value in argument? after reading through google mock documentation in detail, solved problem documented in defining matchers section. (an example have been great!) so solution use matcher_p macros define custom matcher. matching somestruct.data1 defined matcher: matcher_p(data1areequal, ,"") { return (arg.data1 == somestructtocompare.data1); } to match in expectation used custom macro this: expect_call(somemock, somemethod(data1areequal(expectedsomestruct))); here, expectedsomestruct value of structure.data1 expecting. note that, suggested in other answers (in post , others), requires unit under test change make testable. should not necessary! e.g. overloading.

sublimetext2 - Sublime Text 2 unindents labels and access modifiers by default -

how can change that? don't see option in preferences nor know of plugin. i want avoid style: class foo { private: void bar(); } edit: i'm using c++ , style this: class foo { private: // half tab (or 2 spaces) void bar(); // 1 tab } while i'm used typing 2 spaces private: , hit enter ,now have type private: hit enter , navigate private re-indent it. it's kind of workflow kill. found best way disable auto unindent on public private , protected keywords, editing indentation rules.tmpreferences file in packages/c++. did comment out line: | ^ \s* (public|private|protected): \s* $ under decreaseindentpattern key.

Bootstrap Modal, modal-backdrop not dismissing modal -

i've got modal working fine. in click on link opens modal, , there button in there when clicked dismisses modal. however, if click modal-backdrop generated doesn't dismiss, supposed to. anyone know why is, site local can't show example. if using attribute data-backdrop="static" on button or similar call on javascript (don't know 1 you're using since haven't posted code), clicking backdrop not dismiss modal. remove attribute or javascript option , should working. here's bootstrap docs it: bootstrap 3 documentation, under section "options". if doesn't work, please post code , can better you.

php - SQL query with join shows only one result -

Image
i have sql query should shows records table swt_modules, shows first row. $query1 = mysql_query ("select swt_modules.id, swt_modules.name, swt_exam_regs.name exam_regs `swt_modules` join `swt_exam_regs` using ( `id` ) swt_exam_regs.id = swt_modules.exam_regulation order swt_modules.name desc , swt_modules.id desc limit " . $limit . ""); while ($fetch1 = mysql_fetch_array ($query1)) { ... } i have in table (swt_modules) 3 rows , in each of them value of field "exam_regulation" 1. in table swt_exam_regs have 1 row 2 columns - id , name. swt_modules.id stores id number. join should use able see records? i suggest using mysqli or pdo instead of deprecated mysql. $query1 = mysql_query (" select swt_modules.id, swt_modules.name, swt_exam_regs.name exam_regs sw...

wordpress - Real-Time validation for a Time Field in PHP -

i need employ real-time time validation in php form. basically, when visitor filling out form (it's order form btw), , comes "pickup time" field, visitor should allowed enter time that's 1 hour (60 minutes) time filling out form. if fail enter appropriate time, should echo error. i don't need real time validation, need real-time, time validation. mean: filling out form field, , have code check current time user putting in (eg. 2:00pm) , respond accordingly. if time 2:00pm while filling out field, error should occur because time not @ least 60 minutes current time (2:00pm). how this? php or otherwise, know html , css.

php - Keeping button state on page refresh? -

i have button on index.php page increments , changes "liked" when clicked. great. problem is, when reload page, "liked" button goes original "like" state. my question is, how keep button "liked" on page refresh? i'm assuming in likes table have set liked_unliked '1' when button clicked. how jquery changes state of button know there '1' meaning user has clicked 'like' on image, keep "liked" state on page refresh? here index.php : <!doctype html> <?php session_start(); ?> <html> <head> <?php include('header.php'); ?> <script> //send info like_button.php db $(document).ready(function(){ $(".button").click(function(){ $.ajax({url:"liked_button.php",success:function(result){ //do nothing }}); }); }); //change button when clicked $(document).ready(function(){ $(".button").click(function(){ var t=$(this); ...

php - Change CakeEmail SMTP authentication type -

how change authentication type cakeemail uses when using smtp transport? i error: smtp error: 504 5.7.4 unrecognized authentication type when trying send system doesn't support password authentication. supports ntlm. haven't seen setting authentication type in cookbook or api cakephp 2.5.1. there way manually change it? cakephps smtp transport supports basic username/password authentication , there no other authentication types implemented, , there's no specialized mechanism plugging in authentication adapters or like. so you'll have create custom/extended smtp transport. i'm not familiar ntlm, judging rfc should possible plug-in implementation of ntlm authentication flow in overridden smtptransport::_auth() method.

perl - Converting text MB/GB to value -

i have variable contains file size: my $tx = "41.4 mb"; or my $tx = "34.4 gb"; how go converting kb value. if tx contains mb * 1024, , if tx contains gb * 1024 * 1024? you need separate out , test units. use strict; use warnings; sub size_to_kb { $size = shift; ($num, $units) = split ' ', $size; if ($units eq 'mb') { $num *= 1024; } elsif ($units eq 'gb') { $num *= 1024 ** 2; } elsif ($units ne 'kb') { die "unrecognized units: $units" } return "$num kb"; } print size_to_kb("41.4 mb"), "\n"; print size_to_kb("34.4 gb"), "\n"; outputs: 42393.6 kb 36071014.4 kb < / hand holding >

ios - Show Blended Layers reveals red UIImage but it does not have an alpha channel -

i have image not have alpha channel - confirmed in finder's info panel. yet when put in uiimageview within uiscrollview , enable show blended layers, image red indicates it's trying apply transparency hit on performance. how can fix green ios knows in view opaque? i tried following did not remove red color: self.imageview.opaque = yes; self.scrollview.opaque = yes; by default, uiimage instances rendered in graphic context includes alpha channel. avoid it, need generate image using new graphic context opaque = yes . - (uiimage *)optimizedimagefromimage:(uiimage *)image { cgsize imagesize = image.size; uigraphicsbeginimagecontextwithoptions( imagesize, opaque, scale ); [image drawinrect: cgrectmake( 0, 0, imagesize.width, imagesize.height )]; uiimage *optimizedimage = uigraphicsgetimagefromcurrentimagecontext(); uigraphicsendimagecontext(); return optimizedimage; }

javascript - Pseudo-classes aren't working in IE for jQuery accordion -

i building accordion can expand on click each , has expand button. i've used ::before on accordion heads , on expand button. appears fine in chrome , firefox ie seems having issue showing psuedo-classes , margins. appreciated!! http://jsfiddle.net/jherh/ i can assume using ie8 test this. if case, ie8 supports single colon syntax before , after pseudo elements. ::after -> :after ::before -> :before i believe browsers support single colon syntax well, best use unless can drop edit - work around after looking @ fiddler, reason (still looking @ it), ie putting li elements empty tag. causing issues selector. have #nav > li > a in ie, sees them #nav > emptyel > li > a . the simplest way fix make selector not specific, #nav li a want now. edit 2 - solution so, @ least fiddler, have malformed html. encourage go through code , make sure every element has start , end should. to make work in fiddler, had add <tr><td> ...

php - Extract all MP3 and OGG Links from String with preg_match_all -

i trying create regular expressions extract mp3/ogg links example word could't! example word i'm trying extract mp3/ogg files it: this example word http://domain.com/sample.mp3 , second file https://www.mydomain.com/sample2.ogg. link third file <a href="http://seconddomain.com/files/music.mp3" target="_blank">download</a> and php part: $word = "this example word http://domain.com/sample.mp3 , second file https://www.mydomain.com/sample2.ogg. link third file <a href="http://seconddomain.com/files/music.mp3" target="_blank">download</a>"; $pattern = '/href=\"(.*?)\".mp3/'; preg_match_all($pattern,$word,$matches); print_r($matches); i tried too: $pattern = '/href="([^"]\.mp3|ogg)"/'; $pattern = '/([-a-z0-9_\/:.]+\.(mp3|ogg))/i'; so need fix code , extract mp3/ogg links example word. thank guys. to retrieve links, can use: ((https...

sass code style with media queries -

i'm doing code review sass code , came across using media queries inside code. practice? there better alternatives writing code? .col-md-push-8 { padding-top: 1.5em; .btn { &.btn-block { border: none; background-color: $footer-button; margin: 1em 0 .5em; width: 100%; padding: 7px 10px; border-radius: 8px; &:hover { background-color: $footer-button-hover; } @media (min-width: $screen-md-min) { color: #025191; &:hover .media span p.media-heading { color: #0070ca; } } } } } note: code illustration purpose , not shown here. i think way fine if you're using sass >= 3.2 (was buggy before). just 1 thing define media queries breakpoints more globally create mixin purpose re-use on each element need responsive. this way wh...

css - jqueryui menu's submenu -- how to keep in front -

i'm using jqueryui's menu feature, , submenu overlaps other elements on page. problem when select menu item brings submenu, submenu displayed beneath other elements. i'm not sure how menu configured, or if have override jqueryui css elements, in order display expected (over top of other page elements). the problem can seen tools menu @ http://jsbin.com/hexuw/2/ sorry code more complex necessary show minimal problem, menu call can seen few lines down in javascript file. thinking stacking problem tried setting navigation element z-index high number using .ontop class, didn't help. add line z-index:9999; under selector .ui-menu the css code be /* put navigation left (jquery ui) */ .ui-menu { width: 10%; float: left; z-index:9999; } js bin live demo

symfony - @UniqueEntity does not work for me with a simple string property -

i have "company" entity 3 fields : id, name , slug. name unique. when attempt create new company name used following error : an exception occurred while executing 'insert companies (name, slug) values (?, ?)' params ["test", "test-1"]: sqlstate[23000]: integrity constraint violation: 1062 duplicate entry 'test' key 'uniq_8244aa3a5e237e06' i don't know why, @uniqueentity not show error message. tried put line : @uniqueentity(fields={"name"}, groups={"company"}) here code of class : <?php namespace project\userbundle\entity; use symfony\component\validator\constraints assert; use doctrine\common\collections\arraycollection; use gedmo\mapping\annotation gedmo; use doctrine\orm\mapping orm; use symfony\bridge\doctrine\validator\constraints\uniqueentity; /** * company * * @orm\table(name="companies") * @uniqueentity(fields={"name"}, message="form.error.name.unique...

go - net/url package: strip query from url -

i wanted make sure wasn't missing on net/url package. there way url without query, without using using strings package strip out? package main import ( "fmt" "net/url" ) func main() { u, _ := url.parse("/url?foo=bar&foo=baz") fmt.printf("full uri: %#v\n", u.string()) fmt.printf("query: %#v", u.query()) } http://play.golang.org/p/injlx_elap i not sure if asking can use u.path attribute path of url or of attributes specified url type url struct { scheme string opaque string // encoded opaque data user *userinfo // username , password information host string // host or host:port path string rawquery string // encoded query values, without '?' fragment string // fragment references, without '#' } // scheme://[userinfo@]host/path[?query][#fragment] example: package main import ( "fmt" "net/url...

php - Laravel throwing parse error whenever model is referenced in Controller -

i have pretty major problem code. whenever reference model in controller, laravel throws parse error. have gone through code many times, , not see grammatical problems or anything. anyway, here code: <?php class casecontroller extends basecontroller{ public function index() { $cases = case::all(); return view::make('index', compact('cases')); } public function create(){ return view::make('create'); } public function handlecreate(){ $case = new case; $case->name= input::get('name'); $case->value= input::get('value'); $case->contentions= input::get('contentions'); $case->notes= input::get('notes'); $case->side= input::get('side'); $case->save(); } } here eloquent model: <?php class case extends eloquent{ } the parse error thrown on line: $cases = case:all(); however, when erase line $cases = case:all(); the pars...

visual studio 2012 - How to check in a new project to Team Foundation Server? -

i created new project in solution under newly created folder. not solution folder. placed under physical folder also. say, original solution this: mysolution - mysolution.web - mysolution.domain now structure is: mysolution - app - mysolution.web - lib - mysolution.domain - mysolution.repositories - mysolution.workerservices - test - mysolution.specs - mysolution.unit please note in addition newly added projects, mysolution.web , mysolution.domain moved physical subfolder also. to move mysolution.web app folder, moved files outside visual studio , edit mysolution.sln manually text editor project entry can point correct physical location. since 2 projects empty, don't care losing history. then find not check in change tfs! i got team foundation error , saying could not find part of path . as suggested comments/answers question, have done add items folder in source control explorer. new folders , projects have plus sign ahead of ...

javascript - Dynamically alter an underscore template for Backbone -

i'm using backbone underscore templates defined in html so: <script type="text/template" id="edittemplate"> <select id="scred" class="scredselect"> <!-- options --> </select> </script> and assigned backbone view template (via coffeescript) this: template: _.template $("#edittemplate").html() everything working intended. however... dynamically add options select scred . i've tried access scred select via $("#edittemplate").find('.scredselect') , of course, since inside of script tags not treated html, selector doesn't work. i can access element so... html = $("#edittemplate").html() $(html).find('.scredselect').dostuff() is there easier way accomplish this? or task better suited full blown templating engine handlebars or mustache?

Ruby Install/Init Not Finding dk.rb -

i'm trying download/install ruby on win7(i'm new ruby). i went url: http://rubyinstaller.org/downloads/ , downloaded version "ruby 1.9.3-p545" installed following folder/directory: c:\rubydevkit\ (no spaces in folder name). i'm getting following error when try init step: c:\rubydevkit>ruby dk.rb init ruby: no such file or directory -- dk.rb (loaderror) i ran on command line: c:\rubydevkit>ruby -v ruby 1.9.3p545 (2014-02-24) [i386-mingw32] so have ruby installed , i'm in correct directory(per link: loaderror when installing ruby devkit ) i tried , got same error: c:\rubydevkit>chcp 1252 active code page: 1252 i have aptana v3, build 3.4.2.201308081805 installed(but no other versions of ruby). can't find acutal file dk.rb anywhere through windows explorer/cmd line. c:\rubydevkit>dir volume in drive c local disk volume serial number 0cbf-3d16 directory of c:\rubydevkit 05/29/2014 03:04 pm <dir> . 05...

java - SocketTimeoutException cxf httpconduit PUT -

i have test takes lot of time , ended making timeout. tried solution bob , nothing not work. error occurs on tests put. my test : @test public void testupdateuse(){ setexpectedresponse("{\"id\":1,\"username\":\"test\",\"email\":\"bob@test.ca\"}"); user usertoupdate = new user(); usertoupdate.setemail("bob@test.ca"); usertoupdate.setusername("superbob"); usertoupdate.setid(1); userorganization userorganization = new userorganization(); userorganization.setorganizationid(1); list<userorganization> userorganizations = new arraylist<>(); userorganizations.add(userorganization); userorganizationunit userorganizationunit = new userorganizationunit(); userorganizationunit.setorganizationunitid(1); list<userorganizationunit> userorganizationunits = new arraylist<>(); userorganizationunits.add(userorganizationunit); usertou...

python - Using Flask-Security to authenticate REST API -

i using flask-security build web app has public rest api. trying figure out how add user registration , login using rest calls only. easy create user using user_datastore.create_user . how can login user, using rest call? if flask_security.utils.login_user took username+password or token argument, easy, takes user object instead? documentation shows how register , login using forms , views, need able register , login ios device (using restkit). you either want use flask_security.decorators.auth_token_required along security_token_authentication_key or security_token_authentication_header (depending on whether want pass token in url or in header) or can override flask_security.core.usermixin.get_auth_token user class , flask-security right thing.

angularjs and paper.js full width specific height canvas -

i trying create navigation on top of web page via canvas using angularjs , paperjs. my angularjs directive inits paper.js .directive('draw', function () { return { restrict: 'a', link: function postlink(scope, element, attrs) { onresize = function (event){ console.log('aaa') } function initpaper() { paper.install(window); paper.setup('canvas'); view.onresize = onresize; } initpaper(); } }; if write nav canvas html that: <canvas id="canvas" draw style='width:100% height:35px' ></canvas> everything works fine elements on canvas stretches according canvas size ( not want stretching , paperjs onresize event not work. if write nav canvas html that: <canvas id="canvas" draw resize style='height:35px'></canvas> canvas width not full... what can create canvas full width, 35p...

sql server - SQL query for selecting all items except given name and all rows with id of that given name -

Image
i apologize messy title. please consider following tables: car_model : car_model_id, car_name car_inventory : car_model_id, car_location_name, the user pass in car_location_name, , list of car_name excluding rows given car_location_name, , cars id of car_location_name. let me explain further. for join such, let's assume user passes in "germany." list excluding row #2 , #6, have car_location_name of "germany." exclude rows car_id of row germany. (in case car_id of 2 , 6, row car_id of 2 or 6 should eliminated.) in case, since germany has car_id of 2, rid of row car_location_name of "canada", since has car_id of 2. the result should be: what sql query (can sql server specific) can use achieve this? i'm sorry if explanation confusing - please ask questions if having trouble understanding i'm trying say. simplest join results usual, , eliminate car_model_ids exist in germany; select cm.car_model_id, ci.car_locatio...

c# - AjaxControlToolkit ComboBox cannot be enabled after disabling -

i have ajaxcontroltoolkit combobox follows: <atc:combobox id="cmbid1" runat="server" width="150px" rendermode="block" dropdownstyle="dropdownlist" autocompletemode="suggestappend"> </atc:combobox> elsewhere on page, have checkbox want use toggle combobox: <asp:checkbox id="lockcheckbox" runat="server" text="locked" enabled="false" oncheckedchanged="lockcheckbox_checkedchanged" autopostback="true" /> then have handler this: protected void lockcheckbox_checkedchanged(object sender, eventargs e) { if (lockcheckbox.checked) { cmbid1.enabled = false; enablecontrolnotlockeddown(); } else { cmbid1.enabled = true; } } instead of toggling combobox enabled disabled , vice versa, comobox gets disabled , never becomes enabled again. what doing wrong?

Replacing a section of the data in a cell for thousands of excel data -

i have large spreadsheet column data like: abc:1:i.0 abc:1:i.1 abc:1:i.2 abc:1:i.3 abc:2:i.0 abc:2:i.1 abc:2:i.2 abc:2:i.3 abc:3:i.0 abc:3:i.2 abc:3:i.3 abc:4:i.0 abc:4:i.1 abc:4:i.2 abc:4:i.3 abc:5:i.0 abc:5:i.1 abc:5:i.2 abc:5:i.3 etc. i need replace above following: abc:i.data[1].0 abc:i.data[1].1 abc:i.data[1].2 abc:i.data[1].3 abc:i.data[2].0 abc:i.data[2].1 abc:i.data[2].2 abc:i.data[2].3 abc:i.data[3].0 abc:i.data[3].2 abc:i.data[3].3 abc:i.data[4].0 abc:i.data[4].1 abc:i.data[4].2 abc:i.data[4].3 abc:i.data[5].0 abc:i.data[5].1 abc:i.data[5].2 abc:i.data[5].3 etc. here sample of data, of data follows similar format exception of naming "abc", can vary in size, might "abcd" , exception of letter "i", can "o" well. also, might missing values such abc:3:i.1 missing data. not familiar excel formulas or vba code. know how this? have no preference on method has done in don't mind learning vba code if provides me vba solution. ...

Installing lxml for Python 3.4 on Windows x 86 (32 bit) with Visual Studio C++ 2010 Express -

related related questions: error: unable find vcvarsall.bat lxml 3.3 python 3.3 on windows 7 32-bit related answers: https://stackoverflow.com/a/18045219/1175496 related comments: building lxml python 2.7 on windows "@ziyuang mean use python 3.3 uses microsoft visual studio 2010. if that's case answer yes, should install version." facts windows x86 (32-bit) installed both visual studio c++ 2008 ( from here ) express , visual studio c++ 2010 ( from here ) python 3.4.1 (apparently compiled with newer version visual studio 2008) i use pip (or pip3.4.exe; builtin python 3.4) pip install lxml distutils uses visual studio c++ 2010 express compile the last few lines of error, logged pip: cl : command line warning d9025 : overriding '/w3' '/w' lxml.etree.c c:\users\nathan~1\appdata\local\temp\pip_build_nathanielanderson\lxml\src\lxml\includes\etree_defs.h(9) : fatal error c1083: cannot open include file: ...

php - How to acces the second value -

i wondering if give 2 values ​​to class , acces second 1 post, (part of code): echo "<select name='selecttsk' id='selecttsk'>"; while($w = $bd->obtener_fila($tasker, 0)){ echo "<option class='opcion1' value ='".$w[1]/$w[2]."'>".$w[0]."</option>"; } echo "</select>"; ?> and need in other file $var = $_post[selecttsk]; but need $w[2] thanks i suppose $_post['selecttsk'] have values in following format: "foo/bar" you use "explode" in php second part (bar), example: $postvar = $_post['selecttsk']; $vars = explode("/", $postvar); // $var = $vars[1]; // $w[2] form look into: http://php.net/explode beware if $w[1] or $w[2] ever contains "/" might unexpected results, use limit function of explode mitigate issue. however - not recommend workflow. why need send 2 var...

arraylist - Java Integer[] to int[] -

this question has answer here: how convert list<integer> int[] in java? 17 answers i have list need convert int array (int[]) currently doing this: list<integer> filters = new arraylist<integer>(); // add elements filters int[] filteres = new int[filters.size()]; for(integer i=0 ; i<filters.size(); i++) filteres[i] = filters.toarray( new integer[filters.size()])[i].intvalue(); i think looks messy workaround , should somehow else this. there better way make such conversion? this can simplified using list.get() list interface: int[] filteres = new int[]; for(int i=0 ; i<filters.size(); i++) //auto unboxing takes care of converting integer int you, if it's not null. filteres[i] = filters.get(i);

javascript - .mouseup() and .mousedown() not working with .mousemove() -

for reason, .mouseup() event not being called. ideally i'd console.log when user activates mouseup() . would know wrong? http://jsfiddle.net/cbh3b/ $('.circle').mousedown(function () { console.log('mousedone'); $(document).mousemove(function (e) { console.log(e.pagey); $('.circle').offset({ left: e.pagex, top: e.pagey }); }); }); $('.circle').mouseup(function () { console.log('up'); }); var p = $('.square').position(); console.log(p.left); you moving circle away cursor once mousedown event triggered. time mouse button moved up, cursor no longer on circle, means $('.circle').mouseup event not called. if keep circle under mouse mouseup event captured. ( see jsfiddle demo .)

html - How to Add Expires Headers? -

i'm using yslow in safari try , improve website speed, , reported: grade f on add expires headers there 9 static components without far-future expiration date. (2014/5/29) http://fonts.googleapis.com/css?family=trade+winds (2012/4/15) http://mydomain.com/example.css what's best practice add expires headers in html? host godaddy, , .htaccess file provide blank. this i've tried far ... <ifmodule mod_expires.c> expiresactive on # perhaps better whitelist expires rules? perhaps. expiresdefault "access plus 1 month" # cache.appcache needs re-requests # in ff 3.6 (thx remy ~introducing html5) expiresbytype text/cache-manifest "access plus 0 seconds" # document html expiresbytype text/html "access plus 0 seconds" # data expiresbytype text/xml "access plus 0 seconds" expiresbytype application/xml "access plus 0 seconds" expiresbytype application/json "access plus 0 seconds" # rs...

c# - Looking for a way to find cursor position within excel worksheet -

i know system.windows.forms.cursor.position, not give cursor position within excel worksheet. looking way cursor position within worksheet, similar microsoft.office.interop.excel.shape.left all appreciated, in advance by cursor position, mean position of selected cell in worksheet, or mean position of text insertion point when editing cell? if former, can use selection.address . latter, not know answer.

Making Text look like it's being typed in the Python Shell -

so far method i've come clearing console displaying string 1 more letter. suggestions? current code: import os import time in=list(input("text displayed: ")) out="" move=[] print("-") while len(move)<len(in): move+=["/","|","\\","-"] in range(0,len(in)): if in[a]==" ": x=.3 elif in[a] in ",';:!@#$%^&*()_+-=[]{}": x=.25 elif in[a] in "aeiouzxcvbnm1234567890aeiouzxcvbnm": x=.2 else: x=.15 os.system('cls') out+=in[a] print(out+move[a]) time.sleep(x) os.system('cls') print(out) input() just use print() end='' stay on same line, , flush = true timing: import time move+=["/","|","\\","-"] text = input('text displayed: ') in text: print(i, end='', flush=true) time.sleep(0.1) print('\n') this runs as: ...

Java NoClassDefFoundError, Not Sure What's Wrong -

so i'm writing java program calculates difference between sum of squares of first 100 integers , square of sum of first 100 integers: class project_euler6 { public static int sum_of_squares(int start, int end) { int total = 0; while (start <= end) { total += (start * start); start++; } return total; } public static int square_of_sums(int start, int end) { int total = 0; while (start <= end) { total += start; start++; } total *= total; return total; } public static void main(string[] args) { int first_total = sum_of_squares(1, 100); int second_total = square_of_sums(1, 100); int difference = math.abs(first_total - second_total); system.out.println("the difference between sum of squares , square of sums of first 100 integers " + difference); } } when run it, strange error: exception...

Using provided scope with Android Studio and Gradle (0.5.8+ only) -

Image
using provided scope stopped working in android studio 0.5.8 java modules. for example, java module uses classes required android...(bad know, issue exists kind of provided lib). project compiles , runs fine ide shows provided classes red: everything worked fine before 0.5.8 of android studio. intellisense not work anymore....i feel savage coding without autocompletion filed bug, can see details of gradle file https://code.google.com/p/android/issues/detail?id=69481&thanks=69481&ts=1399651923 1 i want believe common setup, has run , come solutions?

php - isset($_POST['x']) only works if the submit button name="submit" -

i'm having trouble using postback because i've more 1 form , isset works name="submit" buttons. my code work fine if use name="submit" if changed name else, isset($_post['somethingelse']) false, why happen? edit: <input type="submit" name="submit" value="submit" onclick ="validate(document.getelementbyid('form')); return false;" /> if (isset($_post['submit'])) <-- works expected <input type="submit" name="asdf" value="submit" onclick ="validate(document.getelementbyid('form')); return false;" /> if (isset($_post['asdf'])) <-- not works expected edit2: <?php $validated = false; if (isset($_post['submit'])) { // preserve form values storing values $_post variables $test = $_post['test']; // validated true submit button submits if validated (script) $validated = tru...

javascript - Cache a variable exclusively on a function -

is there way cache global variable function within group of functions, without calling function directly another? for example, if have group of functions wrapped in parent function this: function parentfunction() { var myvariable; somediv.addeventlistener('click', function (e) { myvariable = e.target; }); anotherdiv.addeventlistener('click', function (e) { // use myvariable without changing when above fired again. }); } the global variable declared @ start, given value in first function, carries on second use. but how can stop continually updating in second function, if first function fires again? could add event-listener inside second function check if first fires again , ensure variable doesn't change? you can set variable once in first function: somediv.addeventlistener('click', function (e) { if (!clickedlink) { clickedlink = e.target; } }); or, can apply logic want there. sometimes, savi...

codeigniter - Extract value from href tag in table using php -

i have table td below. want extract value "abl" value of symbol href tag. <td> <a href="../detail.php?symbol=abl">ace bank limited</a> </td> i can extract ace bank limited using $td->nodevalue; how can extract abl using php only? try dom $html = '<td><a href="../detail.php?symbol=abl">ace bank limited</a></td>'; $dom = new domdocument; @$dom->loadhtml($html); foreach ($dom->getelementsbytagname('a') $tag) { $anchor = $tag->getattribute('href'); $text = explode('=', $anchor); echo $text[1]; //abl } or using preg_match preg_match('/=([^\"]+)/', $html, $matches); echo $matches[1]; //abl

android - How to customize dashboard view according to user settings -

i'm creating dashboard little different. in dashboard there 6 buttons views default. , have 1 setting page check lists of these buttons. problem dashboard views should according users preference settings.user select items in setting page ,those wants visible in dashboard. unchecked items should not visible in dashboard. please , in advance.! playbutton = (button) findviewbyid(r.id.play); playbutton.setvisibility(1); playbutton.setonclicklistener(new onclicklistener() { @override public void onclick(view v) { //when play clicked show stop button , hide play button playbutton.setvisibility(view.gone); stopbutton.setvisibility(view.visible); } }); this solution taken answer . more details go link . in setting take input user , apply accordingly.

plsql - ERROR at line 91: PLS-00103: Encountered the symbol ";" in oracle 10g -

create or replace procedure calculate_curve(e_year in nvarchar2,e_term in smallint,lecture_id in nvarchar2) cursor c1 select student_code, average transcript term=e_term , year=e_year , lecture_code=lecture_id update; student_id nvarchar2(10); avr number; e_grade nvarchar2(3); aa integer; ba integer; bb integer; cb integer; cc integer; dc integer; dd integer; fd integer; avrage number(5,2); sd number(5,2); diff2 number(5,2); n number(5,2); begin select avg(average) avrage transcript term=e_term , year=e_year , lecture_code=lecture_id; select sum(power(average-avrage,2)), count(*) diff2,n transcript term=e_term , year=e_year , lecture_code=lecture_id; if n>=30 n:=n-1; end if; select sqrt(diff2/n) sd dual; open c1; dbms_output.put_line(lecture_id); aa:=avrage+2*sd; if aa>90 aa:=90; ba:=avrage+3*sd/2; if ba>85 b...

avr - Interfacing PCA9955 I2C LED driver -

Image
i want interface atmega128 pca9955 led driver using twi communication mode. twi ok pca9955 doesn't acknowledge it. trying light led 14 without using pwm. code here. have connected ad0, ad1 , ad2 pins of pca9955 ground address device address 0x02. can tell me did miss here regarding pca9955 led driver ? void master_twi_init(void) { twsr = 0x03; twbr = 124; // scl frequency 1000hz (approximately) } void device_init(void) { stdout = &uart0_str; uart0_init(); master_twi_init(); } int main(void){ device_init(); _delay_ms(5); twi_tx_byte(0x05, 0b00010000); // set led 14 bright while(1){;} } void twi_tx_byte(uint8_t addr, uint8_t data) { twcr = (1<<twint)|(1<<twsta)|(0<<twsto)|(1<<twen); while (!(twcr & (1<<twint))); if ((twsr & 0xf8) != 0x08){printf("start error.\r\n");} _delay_ms(100); twdr = 0xc0; //for addresses connected ground twcr = (1<<twint)|...

c# - site freezes after closing the print window -

i using jquery.printelement.js print . when click on print button print window opens print , cancel button. if print document or cancel print window every thing works fine, if close window close button in title bar [x] stops working after dispose of print window on chrome version 35 . /// <reference path="http://code.jquery.com/jquery-1.4.1-vsdoc.js" /> /* * print element plugin 1.2 * * copyright (c) 2010 erik zaadi * * inspired printarea (http://plugins.jquery.com/project/printarea) , * http://stackoverflow.com/questions/472951/how-do-i-print-an-iframe-from-javascript-in-safari-chrome * * home page : http://projects.erikzaadi/jqueryplugins/jquery.printelement * issues (bug reporting) : http://github.com/erikzaadi/jqueryplugins/issues/labels/printelement * jquery plugin page : http://plugins.jquery.com/project/printelement * * david b (http://github.com/ungenio) , icgjohn (http://www.blogger.com/profile/11881116857076484100) * great contributio...

html - Can't get value checkbox checked form php -

my checkbox not value after sending form ... my form <input name="username" type="text" autocomplete="off" id="username" /> <input type="checkbox" id="atur_peg" name="atur_peg" value="ya" checked /> my php <?php echo $username=$_post['username']; // can value echo $atur_peg=$_post['atur_peg']; // , can't value ?> this full form <form class="cmxform" id="tambahuser" name="kepuasan_user" method="post" action="user/tambahuserproses.php"> <label>username</label> : <input name="username" type="text" autocomplete="off" id="username" size="40" maxlength="50" /> <span id="pesan"></span> <br /> <label>password</label> : <input name="password" type="password" au...