Posts

Showing posts from May, 2010

apache - Redirect to SSL except when URL matches a certain criteria -

this htaccess code: rewriteoptions inherit rewriteengine on rewritecond %{server_port} 80 rewriterule ^(.*)$ https://www.domain.com/$1 [r=301,l] adddefaultcharset utf-8 rewritecond %{http:authorization} ^(.*) rewriterule ^(.*) - [e=http_cgi_authorization:%1] rewritecond %{request_filename} !-f rewriterule ^([0-9a-za-z]{12})(\/.+|\.html?|$) /cgi-bin/index_dl.cgi?op=download1&id=$1&fname=$2 [l] rewriterule ^ot:(.*) /cgi-bin/index_dl.cgi?op=download1&otid=$1 [l,b] currently redirecting ssl. want when filename fulfills criteria rewriterule ^([0-9a-za-z]{12})(\/.+|\.html?|$) /cgi-bin/index_dl.cgi?op=download1&id=$1&fname=$2 [l] it needs allow non-ssl i've googled , googled can't figure out how this. any appreciated :) in rule redirect, add exclusion condition: rewritecond %{https} off rewritecond %{request_uri} !^/([0-9a-za-z]{12})(\/.+|\.html?|$) rewriterule ^(.*)$ https://www.domain.com/$1 [r=301,l] or ...

git: best way to resolve merge conflicts in notes branch of git -

what best approach resolving merge conflicts in notes branch of git repository? i ran scenario in when try fetch content of notes branch remote repository, error saying non-fast-forward, fetch rejected. suggestions? i found out way merge in notes branch of git. below approach using. please let me know if right/wrong. git checkout refs/notes/commits git fetch origin refs/notes/commits:refs/notes/origin/commits git merge fetch_head git update-ref refs/notes/commits please let me know if right approach???

javascript - Problems loading external script that worked when I loaded it from my view -

the script sat on ejs view tucked in between nice script tags. moved external file , did not work @ all, on click listener did nothing. moved down bottom of page right outside of body tag , allowed work , when did work slower before. first time have used pageinit instead of document.ready, assuming why can not figure out problem is. here code. help. var currentlist; var elementid; var id; $('#mowingmaster').on('pageinit', function (event) { $('li').each(function (index) { var elementid = $(this).attr('id'); elementid = '#' + elementid; $(function () { $(elementid).click(function (event) { var elementid = $(this).attr('id'); id = elementid; elementid = '#' + elementid; setelementid(id); $.mobile.changepage("#dailylist"); }); }); }); $("#dailylist").on(...

nearest neighbor - data structure for movable points in 3d -

i have many points (+100,000) in 3 dimensional space. need use nearest neighbor , range queries. firstly used kdtree (k=3) each point has velocity attribute. location not static, change location. problem begins here. easy nearest neighbor , range queries old locations. have calculate new locations according velocity. have find nearest neighbor , search in range after calculate new location. everytime points change locations must update kdtree costly. slows me down. have suggestion or there better data structure situation? an octree or octkey can faster. octkey uses morton curve or hilbert curve. reduces dimension , fills space. it's uses in map application. find orientation in 3d gray code can find correct quadrant. here interesting thread moving objects: http://xboxforums.create.msdn.com/forums/p/59841/368276.aspx . recommend quadtree, linked list or ternary trees.

CSS3 rotate3D cross-browser issue -

so have fiddle: http://jsfiddle.net/aa9rm/1/ . works fine in firefox, have issues in chrome, , can't understand why. in firefox if move mouse after hover in workhover container works fine, doesn't anything, in chrome if try click or move inch, starts move (shake) , don't want that. i use 3d rotations, css3, -moz-transform: rotatey(-90deg);; -webkit-transform:rotatey(-90deg); transform:rotatey(-90deg); solutions anyone? i think encounter same bug question : css flip transition between 2 <div>'s it looks chrome bug div you're trying rotate rotating bit much. can fix jsfiddle on chrome changing css (see webkit degree) : .cube:hover{ -moz-transform: rotatey(-90deg); -webkit-transform:rotatey(-89.9deg); transform:rotatey(-90deg); } it's quite hacky never found clean solution. can use pointer-events: none; property in way make works.

autocomplete - Bash alias autocompletion that considers only *.foo files -

whenever want start editing latex sources launching, e.g., command vim pdeoptaff.tex , find bash (tab)-autocompletion still tedious because folder typically contains bunch of files same name different endings: $ ls pdaeoptaff.aux pdaeoptaff.out pdaeoptaff.tex.latexmain pdaeoptaff.bbl pdaeoptaff.pdf pdaeoptaff.toc pdaeoptaff.blg pdaeoptaff.synctex.gz pdaeoptaff.log pdaeoptaff.tex since always want open the ~.tex file, love have filter makes autocomplete expand ~.tex files. in addition, have alias defined: alias g='gvim --remote-silent' . filter, in particular, should work alias. try: complete -f -x '!*.tex' g then, can type: g <tab> and completions. note: doesn't complete directories. else may have better solution using compgen . there's helpful autocomplete guide on the linux documentation project too.

java - How to open new JFrame instead of using this -

everytime wanted open new window when button clicked have used this: string password = new string(textocontraseña.getpassword()); string nombre = (string)botonnombreoperario.getselecteditem(); if(!nombre.equals("seleccione")) { if (trabajo.validaroperario(nombre,password)) { inicio.setnombrelogin(nombre); opcionesoperario rec = new opcionesoperario(); if (joptionpane.showconfirmdialog(this,rec,(string)botonnombreoperario.getselecteditem(), joptionpane.default_option,joptionpane.plain_message)==joptionpane.ok_option){ } // open new window } else { joptionpane.showmessagedialog(null, "contraseña incorrecta"); } } else { joptionpane.showmessagedialog(null, "seleccione un operario"); } the thing know not correct way of doing this, because i'm using joptionpane not used select option open new window. thing want right using jframe. example changed "opcionesope...

How to cache images in memcached in php? -

im trying cache images in memcached. tested code: ob_start(); $image = imagecreatefrompng(root_dir."/img/welcome.png"); imagepng($image); $memcache->set("my_image", ob_get_contents(), false, 3600); ob_end_clean(); but not works. suggestions?

javascript - How to replace doctype in html? -

this code: <!doctype html> <html> <head> <meta charset="utf-8"> <title>jquery checkbox , radio button styling</title> <style type="text/css"> /* * customradiocheck: jquery plugin checkbox , radio replacement * usage: $('input[type=checkbox], input[type=radio]').customradiocheck(); * author: cedric ruiz * license: mit */ .custom-label { display: inline-block; margin-right: .8em; cursor: pointer; } .custom-radio, .custom-check { vertical-align: middle; display: inline-block; position: relative; top: -.15em; /* adjust best fit */ margin: 0 .4em; width: 20px; height: 20px; background: url(img/customradiocheck.png) 0 0 no-repeat; } .custom-radio { background-position: 0 -20px; } .custom-check.focus { background-position: -20px 0; } .custom-radio.focus { background-position: -20px -20px; } .custom-check.checked { background-position: -40px 0; } .custom-radio.checked { backg...

bash - Command line - Remove directories if they contain a particular file type -

i'd remove directories if contain .png images whilst ignoring directories not. i need use command line (i'm using mingw). i imagine solution include rm , target directory if contains *.png . how can done? find -type f -name "*.png" -printf "%h\0" | uniq -z | xargs -0 rm -rf

inheritance - Inherit from Python's and override __str__ -

i interested in doing similar django doing lists, e.g: in django shell in [4]: timeportal.models import rules in [5]: rules.objects.all() out[5]: [<rules: day_limit>] i tried doing following: class timeentrylist(list): def __str__(self): return ';'.join([str(i) in self.__getslice__(0, self.__len__())]) which seems work in normal python shell: in [54]: a=timeentrylist(('1-2','2-3')) in [58]: print 1-2;2-3 in [59]: str(a) out[59]: '1-2;2-3' however in application timeentrylist instance list of timeentry objects defined this: class timeentry(object): def __init__(self, start, end): self.start = start self.end = end #self.duration = (self.end - self.start).seconds / 3600.0 @property def duration(self): return (self.end - self.start).seconds / 3600.0 @duration.setter def duration(self, value): self._duration = value def __str_...

javascript - What happens when we close the script two times? -

this might silly question want clarify this. happens when close javascript 2 times. <script type="text/javascript"> alert("hello"); </script> </script> i did not getting error.its closed script there wont execution no error trigger believe. create trouble under situation? why asking insert </script> @ end of plugin user submits script. don't have go coding on validation if works fine without creating trouble the browser treat extra, unexpected end tag. doesn't matter it's </script> , </link> or else allowed in same context. most browers silently ignore such tags unless enable strict / xml mode. strict mode, should errors in console. to wrap plugins supplied user, suggest strategy: always wrap them in own tags (so can sure structure correct). check string put between 2 tags <script , <script> , </script> , report error if find of them. the idea here users should never use...

javascript - selfish how to call parent initializer -

i'm using selfish javascript library make inheritance in javascript easier. example have 2 objects var foo = base.extend({ initialize: function(){ this.some_param = 1; } }), bar = base.extend({ initialize: function(){ this.another_param = 2; } }); how call bar initializer foo initializer? var foo = base.extend({ initialize: function(){ this.some_param = 1; } }), bar = base.extend({ initialize: function(){ foo.initialize.call(this); // <------- here this.another_param = 2; } });

python: string of hex values to binary -

this sample of input: a = 41cf4a077a7454 they represent hex values, x41 xcf x4a etc... i require convert them 1 string of binary (desired output): 01000001110011110100101000000111011110100111010001010100 x41 = 01000001 xcf = 11001111 x4a = 01001010 etc... the code used looked this: return bin(int(str(a), 16))[2:] however, produces string without 0 @ front: 1000001110011110100101000000111011110100111010001010100 it appears 0 gets chopped it's interpreted integer. there way can keep zero, because not every string being converted begins 0 in binary. i hope makes sense. thank you. this solution work you. >>> = '41cf4a077a7454' >>> b = [a[2*i]+a[2*i+1] in range(len(a)/2)] ['41', 'cf', '4a', '07', '7a', '74', '54'] >>> c = map(lambda x: "{0:08b}".format(int(x, 16)), b) ['01000001', '11001111', '01001010', '00000111'...

css - Cursor position centered and in the middle for javaFX TextArea -

i want have cursor of javafx textarea horizontally , vertically centered. tried using css attributes -fx-text-alignment: center; or -fx-text-origin: bottom; but didn't work :-(. can tell me if , maybe how works? -fx-alignment: center read documentation http://docs.oracle.com/javafx/2/api/javafx/scene/doc-files/cssref.html#textarea

ada - Preconditions don't work with GNAT? -

i'm still kind of new ada , think i'm misunderstanding use of preconditions, because looking through gnat rm seems checks aren't performed @ runtime. also, gnat rm precondition here doesn't specifiy exception thrown if precondition not met. here code i'm trying: procedure test begin generic type element_type private; use system.storage_elements; procedure byte_copy (destination : out element_type; source : in element_type; size : in storage_count := element_type'size) pre => size <= destination'size , size <= source'size; procedure byte_copy (destination : out element_type; source : in element_type; size : in storage_count := element_type'size) subtype byte_array storage_array (1 .. size / system.storage_unit); write, read : byte_array; write...

java - How to add Captcha on GWT project? -

i want add captcha inside dialogue box. first time using captcha in poroject captcha widget not loading. i used gwt-recaptcha-1.0.0.beta2.jar plugin show in client side. , public key generated givinmg url example.com, also included scripts , files follows: <script language="javascript" type="text/javascript" src="/js/jquery-1.10.2.min.js"></script> <script language="javascript" type="text/javascript" src="/js/jquery-ui-personalized-1.5.2.packed.js"></script> <script language="javascript" type="text/javascript" src="/js/sprinkle.js"></script> following error come com.google.gwt.event.shared.umbrellaexception: exception caught: exception caught: exception caught: (typeerror) @com.claudiushauptmann.gwt.recaptcha.client.recaptcha::create(ljava/lang/string;ljava/lang/string;ljava/lang/string;ljava/lang/string;i)([string: '6lctueysaaaa...

asp.net mvc - Inject repositories into service? -

i have following; interface irepository --interface irepositoryef: irepository --interface irepositorynh: irepository ----interface icategoryrepositoryef: irepositoryef ----interface icategoryrepositorynh: irepositorynh i want use categoryrepositoryef , categoryrepositorynh classes in service. how can inject them categoryservice? categoryservice(irepository repository) { } what best practice this? use repositoryfactory , inject service , create repositories in services? i mean following; categoryservice(categoryrepositoryfactory factory) { var categoryrepositoryef = factory.create("ef"); var categoryrepositorynh = factory.create("nh"); } is idea? or m wrong? the idea bit off. the purpose of repository interfaces abstract away data source. goal allow using classes fetch information without knowing data comes from. in case force classes know wether nhibernate or entityframework used. why? i wouldn't have irepository int...

c# - VSTO 4.0 Outlook AddIn signing -

users getting vsto exception while installing addin on computers without certificate installed (unknown certificate). certificate purchased code signing certificate class 2, working on application. i create installation files via clickonce. clickonce setup.exe gets signed , signing dll in post-build "c:\program files (x86)\microsoft sdks\windows\v7.1a\bin\signtool.exe" sign /f cert.pfx /p pw "$(projectdir)obj\release\myaddin.dll" i want deploy addin via c# code in application. if register addin in registry above error. if run setup.exe installing properly, not option since no silent install supported. how rid of error? or there other way install addin silently? thanks you can make msi vistual studio using "visual studio installer new project" in wizerd link project output setup project , copy manfiest file manually dependencies folder of setup(the project using make msi). can run msi silent via group policy. dont know if thats thats...

neo4j - Can UNION and WITH play together? -

is there way use results of union in sub-query using clause? i'm looking like ( match (me:person)-[:rates]->(r:rating)-[:rated_by]->(them:person) me.ident = {id} , r.date = {date} return them union match (me:person)<-[:rated_by]-(r:rating)<-[:rates]-(them:person) me.edent = {id} , r.date = {date} return them ) them return them.name, count( them.name) ratingcount order ratingcount desc limit 10 only nothing supported cypher. and yes, know in case should using match (me:person)-[:rates|rated_by]-(r:rating)-[:rates|rated_by]-(them:person) me.ident = {id} , r.date = {date} return them.name, count( them.name) ratingcount order ratingcount desc limit 10 which fine , dandy, think i'm going more complex requests down road won't work.

php - jQuery ajax request awkward issue -

so have ajax request. when user clicks edit link, fetch id of entry , refresh page data of entry loaded form. here's problem: works alert showing before ajax call. when leave out alert, ajax error (though id being posted) , php page reloads. moreover, works when put newdoc stuff success callback. exact same lines complete callback , page reloads. moreover, occurs in firefox only. jquery('a.edit').on('mousedown', function (e) { e.preventdefault(); var id = jquery(this).attr('data-title'); alert('test'); jquery.ajax({ url: document.location, data: { id: id }, success: function (data) { var newdoc = document.open("text/html", "replace"); newdoc.write(data); newdoc.close(); }, error: function () { alert('error'); } }); }); what can do? edit: must timing issue. noticed when click ,...

sql - Web Application hosting with amazon server -

myself trying host web application in amazon server takes data database.i tried make instance in amazon rds master username root , password.i have mysql workbench . don't know how import .sql files amazon rds.while going through tutorial getting confused wih security group , all.my questions 1.do need create security group job,to accesss application ip address? 2.how can create database amazon server in sql workbench/sql query browser. you can either create or add ip address in default security group access application database. amazon rds database maintained amazon you.no difference in usability, can connect mysql workbench providing rds details , can star using database.

Vim Navigation Requires Too Much Thinking -

i've been using vim few years , love how easy simple tasks insert above current line, delete whole line, etc. i've mapped caps lock escape because of it! one problem vim never on how thinking navigation requires compared mouse movements, after you've learned keys. know of movements %, ^, $, f/f, t/t , using numbers before command feel takes lot more effort use them , disrupt workflow. for example, need delete "/many/sections/" of url , cursor in middle of word "really": http://this/is/a/real|ly/long/url/with/many/sections/ with mouse, takes no thinking power click , select sections want remove , hit delete. if in vim, find myself thinking: ok, first $ brings cursor end. want delete sections can use '/' deliminator , have count how many of '/' want move back. it's 2 , have search backwards it's f , not f . think command should $d2f/ . alternatively, have used 'm' landmark cursor , delete end there i'd ...

indexing - Which way to save into an other index on elasticsearh the result of some operation make during indexation -

i need save data result of operation make during indexation operation (analyzer or other way) other elasticsearch index. example, i've got : doc 1.1; time 2s doc 1.2; time 5s doc 2.1; time 3s doc 2.2; time 7s i need save result of 1.1 - 1.2 example (here result 2 - 5 => 3), in other index (for performance). of course simplification, there other field. best manner this. i think you'll have wrap indexation in own code. index docs, , then, if successfull, compute others doc them or index response , index them in second index. i not sure undestood question, if it, i'm pretty sure (though wrong) es cannot seconds indexations itself, no matter how magical is. good luck.

Routing by linux iptables -

i have 3 virtual machines called vm1 vm2 , vm3. want ping vm1 vm3 via vm2. vm1 has interface eth0 having ip adress 192.168.221.10. similarly, vm3 has eth0 having ip adress 192.168.221.11. vm2 has 2 interfaces eth1 (192.168.221.1 ) , eth2 (192.168.221.2). want control connections on vm2 , route them commands below sudo iptables -t nat -a prerouting -i eth2 -j dnat --to 192.168.221.1 sudo iptables -t nat -a prerouting -i eth1 -j dnat --to 192.168.221.11 however cannot reach vm3 vm1 in way. idea of problem. lot. make sure have enabled ip forwarding on vm2 vm2 acting router. i've posted article on how configure ubuntu router using iptables.

visual c++ - unable to find stdio.h using scons with VC10 -

i using scons vc10. while compiling code getting error " unable find stdio.h". do need add compiler specific path scons stdio.h? but same code working in other machine. the code same. can please tell me reason error , how solve ?

jquery - Approaching Typeahead.js prefatched datums -

i'm using twitter typeahead.js this: $('.autocomplete').typeahead({ name: 'autocomplete', prefetch: https://localhost/datums.json }); is there possibility how approach datums.json values anywhere else in script? creating condition asking if value exists in typeahead's datums. if understand asking for, can use local instead of prefetch . use http client (xmlhttprequest, e.g.) read /datums.json yourself, , store reference in variable. pass variable local typeahead.

uiimagepickercontroller - Custom shape for camera controller IOS -

i trying give round shape camera view take image. circle should of 200 width , 200 height, , when open, user has able still interact background view. have managed until is: - (ibaction)usecameraphoto:(id)sender { if ([uiimagepickercontroller issourcetypeavailable: uiimagepickercontrollersourcetypecamera]) { uiimagepickercontroller *imagepicker = [[uiimagepickercontroller alloc] init]; imagepicker.delegate = self; imagepicker.sourcetype = uiimagepickercontrollersourcetypecamera; imagepicker.mediatypes = [nsarray arraywithobjects: (nsstring *) kuttypeimage, nil]; imagepicker.allowsediting = yes; [self presentviewcontroller:imagepicker animated:yes completion:nil]; newmedia = yes; }else{ nslog(@"camera not available"); uialertview *alert1 = [[uialertview alloc] initwithtitle:@"important message" message:@"unfortunately c...

java - Jackson csv writer doesn't use correct column separator -

i'm trying write csv file using jackson 2.2.2 (especially jackson-dataformat-csv) can't use ';' fileseparator. i'm using following code initialize writer: csvmapper mapper = new csvmapper(); csvschema schema = mapper.schemafor(myobject.class); schema = schema.withcolumnseparator(csv_column_separator); objectwriter myobjectwriter = mapper.writer(schema); to create csv following: fileoutputstream tempfileoutputstream = new fileoutputstream(tempfile); bufferedoutputstream bufferedoutputstream = new bufferedoutputstream(tempfileoutputstream, stream_buffer_size); writeroutputstream = new outputstreamwriter(bufferedoutputstream, file_encoding); myobjectwriter.writevalue(writeroutputstream, listofmyobjects); however resulting file still uses default ',' column separator. when check object debugger ';' set separator in object guess should work. know i'm doing wrong or bug? if want alternative, use open csv csvwriter : public c...

java - Save view like bitmap, I only get black screen -

i have drawing application , have methods saving pictures drawn. black bitmap picture save button. problem ? there xml <relativelayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:id="@+id/all" android:layout_width="match_parent" android:layout_height="match_parent" android:background="@color/black" tools:context=".circle" > <org.vkedco.mobappdev.draw_touch_drive_00001.krouzky android:id="@+id/pntr" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignparentleft="true" android:layout_alignparenttop="true" android:tag="painter" /> <textview android:id="@+id/textview3" android:layout_width="wrap_content" android:layout_height="wrap_content" android:lay...

javascript - AngularUI Modal dialog not working -

i'm trying include angularui modular dialog in app in controller.js define([ 'app' ], function(app) { app.controller('teacherclasses', [ '$scope', '$http', '$dialog','$location', 'anotherservice', function($scope, $http, $location, $dialog, anotherservice) { $scope.opts = { backdrop: true, keyboard: true, backdropclick: true, template: '/pathto/partial.html' }; $scope.opendialog = function(studentgroup){ $scope.newclass = angular.copy(studentgroup); var modal = $dialog.dialog($scope.opts); modal.open(); } }]); return app; }); i've added ui.bootstrap.dialog angular module in app.js var mymodule = angular.module('myapp', [ 'ngresource', 'ui', 'infinite-scroll', 'ngdragdrop', 'blueimp.fileupload','ui.bootstrap.dialog', 'ui.bootstrap.modal', 'ui.bootstrap.dr...

excel cannot complete this task with available resources -

when i'm trying copy data in 1 of worksheets new sheet using below code in excel 2007, windows 7, i'm facing error "excel cannot complete task available resources. choose less data or close other applications". when close other applications, showing same message. how resolve issue? please advise. with activesheet .range("a1").select .usedrange.specialcells(xlcelltypevisible).copy end thisworkbook set ws = .worksheets.add(after:=.sheets(.sheets.count)) newsheet = activesheet.name end activesheet .range("a1").select selection.pastespecial paste:=xlpastecolumnwidths selection.pastespecial xlpasteall .range("a1").select end when save xls .xls (97-2003) working fine. want run more data 65k i tested code on newly created excel document , copied 80k rows new sheet. code works... i did create macro sub routine , run multiple times check. but said saved document once xls. maybe got li...

css - Webfont size and memory issues -

i wanted know if loading huge webfonts can cause issues on browser ? have use korean font ( malgun ) 4mo. , bold 1 4 megs too. i use them on ipad exclusively phonegap project. there risk of taking lot of memory ( mean, 8mo ) browser ? thanks answers yes, affect browser in have download font when first visit site. pretty large font file, though. should consider taking font fontlab , truncating glyphs need. may want see if there vector or web version of font. if these aren't option, try asynchronously loading font. here great post on css tricks loading things asynchronously. substitute js file in example stylesheet containing @font-face declarations. note: method may cause flash of unstyled text.

c# - Handling error messages as exceptions -

can throw exception in 1 class , can catch exceptions in separate exception class in c#? now question when ever values == null displaying message there itself. have use exceptions if values equal null. can throw exception like if(customer == null) throw new customernullexception(); if(incometype == null) throw new incometypenullexception(); now can handle these exceptions in separate class?? exceptions bad idea handling errors. should rethink error handling architecture exceptions have huge overhead. please read exceptions , performance jon skeet.

java - NoClassDefFoundError: org.slf4j.LoggerFactory is a restricted class -

i using maven building gae/j web application. until haven't had problems whenever try run development server noclassdeffounderror: org.slf4j.loggerfactory restricted class . here extract of console log: ... info c.g.a.d.devappserverrunner - warning: failed jettycontainerservice$apiproxyhandler@4e4ad8a3: java.lang.noclassdeffounderror: org.slf4j.loggerfactory restricted class. please see google app engine developer's guide more details. info c.g.a.d.devappserverrunner - ago 28, 2013 1:36:53 pm com.google.apphosting.utils.jetty.jettylogger warn info c.g.a.d.devappserverrunner - warning: error starting handlers info c.g.a.d.devappserverrunner - java.lang.noclassdeffounderror: org.slf4j.loggerfactory restricted class. please see google app engine developer's guide more details. info c.g.a.d.devappserverrunner - @ com.google.appengine.tools.development.agent.runtime.runtime.reject(runtime.java:51) info c.g.a.d.devappserverrunner - @ com.starchu....

How to find the previous <div> element from a <div>? using jquery? -

here code: <div class="accordion-heading" onclick="$(this).parent().find(&quot;#badge_request_content&quot;).focus();"> <a class="accordion-toggle" data-toggle="collapse" data-parent="#accordion2" href="#collapsetwo"> <h4> <span class="ex-num complete-num wait_on_type"> <i class="icon-ok"></i> </span> <i class="icon-pencil"></i> write quick summary </h4> </a> </div> <div id="collapsetwo" class="accordion-body collapse"> actually want find tag class name of previous div shown above. <seconddiv id>.find(previous div span class name) does on this? wants done jquery? this $('divid').prev('div').find('span').attr('class')

javascript - how to rotate a vector based map? -

i need rotate map has been drawn based on vector map using canvas.i use map in navigation system runs in browser.is there simple way follow? you can context.rotate(angle) method. method not affect drawn on canvas, instead affects drawn after setting rotation. angle in radians, full circle pi * 2 = 6.28318530718. the rotation around point 0:0 of current internal coordinate system of canvas. recommend use context.translate(x, y) place in center of canvas instead of upper-left corner. draw map on invisible background canvas set transformation on visible canvas rotation-center set rotation on visible canvas use drawimage draw invisible canvas visible 1 (when use drawimage, source can canvas). drawimage call affected rotation , translation set. when have control on when , how original map drawn, can alternatively apply transformation , rotation original canvas before drawing it.

cordova / phonegap 3.0 device properties -

Image
i new phonegap / cordova 3.0 , seems have similar problem phonegap help: device properties, cordova v phonegap, xcode debugging . unfortunately couldn't find solution in internet now. after having created hello world example ios works fine in simulator. after having changed content in index.html code of example given device properties in den documentation screen of simulator shows "loading device properties.." nothing more. reason function ondeviceready() not work properly. highly appreciated here code of index.html device properties <!doctype html> device properties example <script type="text/javascript" charset="utf-8" src="cordova.js"></script> <script type="text/javascript" charset="utf-8"> // wait device api libraries load // document.addeventlistener("deviceready", ondeviceready, false); // device apis available ...

r - Loop does not print function output -

i'm trying make loop gives me bootstrapped confidence intervals regression analysis 1 intercept , 3 coefficients. programming bootstrapping function worked well. the problem have adress each object of regression within function boot.ci index (like index=1), because boot.ci doesn't know names of regression model coefficients. so did following: for (i in 2:inputnumberobjects) { cat(paste("boot confidence intervals coefficient ", inputnamesobjects[i], ":\n\n", sep="")) boot.ci(bootresults, type = "bca", index=i) ### result coefficients } before loop spefified number of objects , names of objects. the problem is, function somehow seems ignore boot.ci function within loop. for example if names of objects inputnamesobjects <- c("a", "b", "c", "d") then following output: boot confidence intervals coefficient a: boot confidence intervals coefficient b: boot confidence ...

mysql - Display New Column for Each Row Value -

Image
i'm trying add new column each time account number shows in query. query below pulls necessary information , totals amount of times row occurred same account number need next have create row each time dose given patient. so if have account number pulls 3 rows in table populate new column displaying individual value each row has account number in it. i need know add query below select lastname, firstname, patientno, count(*) 'occourances given' patient join medication on patient.medication_id = medication.id medication.id = 'variable' group patientno, lastname, firstname order lastname this output like. take total dose column , break down , show value of each dose was. thanks!

math - Issue with % operator in C -

i having issue % operator in c. know % operator gives remainder of division. when faced question 1 % 2 or 3 % 2 , confused. after googling this, found different solutions. some 1 / 2 0.5 , round down 0. 1 % 2 0. others 1 / 2 0.5 , instead round up, in maths, 1. 1 % 2 1. and therefore, confused. question is: what 1 % 2? thank in advance :):) simply put, both wrong methods. said % finds remainder of division. therefore 1/2 equal 0 remainder 1. and answer 1. also, experiment yourself, have used program: #include <stdio.h> main() { int remainder; remainder = 1 % 2; printf("1 %% 2 %d", remainder); return(0); } hope helps :)

Writing custom login for Spring Security (Grails) -

i'm trying write custom login spring security. if use form generated, works, when try manually redirect link (j_spring_security_check) method controller, tells me: sorry, not able find user username , password. here's did: def config = springsecurityutils.securityconfig def j_username = params.j_username def j_password = params.j_password redirect(url: "${request.contextpath}${config.apf.filterprocessesurl}", params: [j_username: j_username, j_password: j_password]) i've printed out myselft params, correct, doing wrong?

php - Most efficient method to store MYSQL options and values in database -

i'm hitting dead best practice storing large amount of options , values in mysql database , assigning them properties. way (example real estate) create table called "pool" have auto increment value id , varchar store value, in case "above ground" , row "in-ground". in property table have column "has_pool" proper id value "pool" table assigned. problem hundreds of options (fireplace, water view, etc) each property, number of database tables large, fast , left joins become out of control on front side. can point me in right direction on best practice populate new values property attributes , keep query count down minimum? feel there simple solution research far has not made apparent me. thank you! one way create 'options' table 4 columns: id, menuid, value create table called menus, 2 fields; id , name. add menu names (pool, fireplace etc.) menus table, , add possible values options table, including id ...

c++ - Is a local class in a method of a class a friend of this class? -

i have outer class a . has method a::fun . in method, has local or inner class b . question is: b friend of a ? i think not. right? if so, think let class b friend of a beneficial since b can access a 's private , protected members. , moreover, since b local in methods, not accessible others , safe friend of a . how work around let b access a 's private , protected members? no not friends. but local classes have same access names outside function function itself. the standard says : 9.8 local class declarations [class.local] a class can declared within function definition; such class called local class. name of local class local enclosing scope. the local class in scope of enclosing scope, , has same access names outside function enclosing function. declarations in local class shall not odr-use (3.2) variable automatic storage duration enclosing scope. the big difference take in count local class accessible inside function. but after :...

what this scala symbol ->_ means -

can assist me understanding code case "foo" foo(data) -> _ => { /*.. implementation */} i see usage of foo.unapply(data) don't understand part -> _ how , when use it looks being way clever own good. suppose i've got following: case class foo[a](command: string, data: a) object -> { def unapply[a, b](p: (a, b)) = some(p) } now can write this: scala> foo("foo", (42, 'whatever)) match { | case "foo" foo(data) -> _ => data | } res0: int = 42 thanks magic of scala's infix patterns, equivalent following: foo("foo", (42, 'whatever)) match { case foo("foo", data -> _) => data } except infix version guaranteed confuse , annoy code's future readers.

php - Why cant i just use public property and not be looked down at -

i see (and write) lot of code this: class myclass { private $_myproperty; public function setmypropert($myproperty) { $this->_myproperty = $myproperty; } public function getmyproperty() { return $this->_myproperty; } } since taught class properties should private. however, want in above scenario: class myclass { public $myproperty; } thats less code , easier read. other developers down on code , fail code reviews etc. if not, still never fear of else seeing , making judgement. why though? ingrained in developers of oop code? or there reason i'm missing, perhaps related testing, future maintenance or other non obvious technical reason. talking in scenario getter/setter noting more get/set. if doing nothing in getters , setters, yes, may make property public. setters typically used check value make sure it's valid: public function setfoo($foo) { if (!is_string($foo)) { throw new...

java.net.URL to refer to a CSS -

how create java.net.url refer css? posible? i've tried several other ways check if css page doesn't work (no errors tho, doesn't): int code = con.getresponsecode(); string type = con.getcontenttype(); con.disconnect(); //returns null if connection had problems or not contain css if (code != httpurlconnection.http_ok || !type.contains("stylesheet")) { return null; } any other posible solutions? try css page , print it. take code below example url url = new url("http://cdn.sstatic.net/stackoverflow/all.css?v=e97b23688ee8"); // css on site httpurlconnection con = (httpurlconnection) url.openconnection(); scanner scanner = new scanner(con.getinputstream()); while(scanner.hasnextline()) system.out.println(scanner.nextline()); system.out.println(con.getcontenttype()); // prints text/css you looking wrong content-type .

c++ - Cannot find ui_chatdialog.h in Qt 4.8.5 network example w/ VS 2008 -

i new developing qt , wish compile qt network chat example comes qt 4.8.5: http://qt-project.org/doc/qt-4.8/network-network-chat.html i'm working within vs 2012 compiling vs 2008. have following includes: c:\qt\4.8.5\include\qt; c:\qt\4.8.5\include\qtuitools; c:\qt\4.8.5\include; c:\qt\4.8.5\include\qtcore; c:\qt\4.8.5\include\qtgui; c:\qt\4.8.5\include\qtnetwork; %(additionalincludedirectories) i feel there step i'm missing in compilation process, perhaps generates ui_chatdialog.h file? can't figure out why missing example, , not exist in files came qt version (4.8.5) downloaded. this current output: >------ rebuild started: project: qtchatexample, configuration: release win32 ------ 1> chatdialog.cpp 1>c:\users\dustin\documents\qtchatexample\src\chatdialog.h(44): fatal error c1083: cannot open include file: 'ui_chatdialog.h': no such file or directory 1> client.cpp 1> connection.cpp 1> main.cpp 1>c:\users\dustin\documents\qtc...

android - Is the Samsung Galaxy S4 compatible with CyanogenMod's smart card emulation (NFC)? -

i have samsung galaxy s4 , scm sdi010 card reader. goal let s4 emulate smart card can read card reader. i tried apply pki applet example described here (installing cyanogenmod 10.2, starting se-emulator on s4 , starting se-pki-client on linux pc). connection establishment fails either "scard_w_unresponsive_card" or "scard_w_unpowered_card" exception on reader side. does know if nfc chip on s4 supported cyanogemod card emulation? do need explicitly activate card emulation on s4 not directly described in tutorial above? best regards no, cyanogenmod patches software card emulation work nxp chipsets (the modifications affect libnfc-nxp only). devices broadcom chipsets not (yet?) supported.

Why can’t you merge in a bare git repo? -

why can’t merge bare repo? bare repos don’t have head or working tree. in config file can see bare=true . you can’t pull in bare repo (because pull = fetch & merge , merge doesn't work). however, can push bare repo – why? far know, push contains merge, in case can well. so, question “how git merge work?”. why need head ? doing when merging? as chronial points out , pushing fast-forward merges or forced updates, moves references/branch pointers different commit. in actual non-fast-forward merge, need working copy in case conflicts need resolve. it's been mentioned before other stack overflow users; example, see this answer (emphasis mine): git performs merge-y operations (real merges, cherry-picks, rebases, patch application) on work tree. mentioned several times before, example in 1 of knowledgeable jakub narÄ™bski's answers: there no way merge (or rebase) can work without touching working directory (and index), there can merge con...

objective c - iOS create the inverse of a CAShapeLayer mask -

Image
so fresh ios developer working on ios drawing application plays user sketches using x/y coordinates , timestamps. draw simple pen events have uiview serves drawing view , draw view using cashapelayers so: if (index == 0){ cgpathmovetopoint(path, null, point.x, point.y); } else { cgpathaddlinetopoint(path, null, point.x, point.y); } …… cashapelayer *permlayer = [cashapelayer layer]; [permlayer setframe:cgrectmake(0, 0, 1024, 640)]; [permlayer setfillcolor:[[uicolor clearcolor] cgcolor]]; [permlayer setstrokecolor:currentcolor.cgcolor]; [permlayer setlinewidth:[event[@"strokeweight"] floatvalue]]; [permlayer setlinejoin:kcalinejoinround]; [permlayer setlinecap:kcalinecapround]; …… [[self layer] addsublayer:permlayer]; …… all , looks fine: now want have erase event looks like: i tried accomplish using cashapelayer mask , drawing cgpath of erase event mask. ended this: ….which exact opposite of wan...

c++ - Linker problems with eclipse -

i making eclipse project using both c , c++. current problem defining includes in "paths , symbols" properties menu . setting same paths in gnu c , in gnu c++ seems don't enough compiler says "undefined reference" functions needs includes. what missing? thanks!!!

ruby - sort an array of ranges -

how sort array of ranges ranges = [range.new(0, 3, true), range.new(3, 5, true), range.new(5, 7, true), range.new(7, 9, true), range.new(9, 11, true), range.new(11, 100, true)] ranges.sort => argumenterror: comparison of range range failed (irb):7:in `sort' (irb):7 /users/praveena/.rvm/rubies/ruby-2.0.0-p247/bin/irb:16:in `<main>' but when try 2.0.0p247 :022 > (3...4) <=> (4...8) => nil 2.0.0p247 :023 > (3...4) <=> (1...2) => nil am missing ? it seems range have implementation <=> , not complete. lets check: > range.new(3,4) <=> range.new(3,4) => 0 # seems correctly identify when 2 equals > range.new(3,4) <=> range.new(4,4) => nil # seems fails fail when both different! this method defined in range because defined on object class (!!!), every object has method defined, doesn't means works. implementation range default one. lets check this: # lets define dummy class class end => n...

java - Maven - deploy only static assets -

is there way rebuild or reinstall or redeploy static assets using maven (the terminology failing me here)? what want able make change javascript file , deploy without having rebuild/install/deploy entire project. thanks! edit: right now, in order change show have execute following: cd /project/dir && mvn package && \ cd deploy/ && mvn stack-tomcat:deploy if restricted maven command-line, see if tomcat:inplace goal of maven tomcat plugin suits needs. for local development, may find maven support various java ides gives faster edit-compile-run development cycle (e.g. m2e , m2e-wtp eclipse) , there jrebel .

checkout - Learning SVN properly -

i'm new using svn. have used git year , never had trouble doing simplest(?) things. i having easy time creating new svn repo on local machine (mac). understand leaving commit , viewing commit log, checking status of modified files, etc. i'm having hardest time pulling repo/syncing changes set svn repo on server. when run: svn co http://subdomain.site.com i get: svn: options of 'http://subdomain.site.com ': 200 ok (http://subdomain.site.com) double , triple checked url. far can tell, doing way wrong when pulling repo subdomain. (have managed pull , sync non-subdomain before...once) have watched/read many tutorials. skips past have issues. rather use git of old sites mess use svn. this link http://svn.haxx.se/dev/archive-2010-01/0211.shtml suggest after triple checking url wrong. btw: subversion repositories behind http server have longer url's. instance http://svnserver.insomedomain.com/svn/svnrepository/trunk/project or http://svnserve...

How to write to a specific element in the body from the head using JavaScript? -

i'm making application javascript code in head need output data table in body. i'm using following code head writes body. it's pretty sloppy, i'd prefer have in table. document.body.innerhtml = (document.body.innerhtml+'<br />'+place.name); how this?

java - Database locked while trying to open multiple jframes -

my problem , while opening jframe including different informations main jframe , when tried work on jframe, example inserting data sqlite manager's database . it's giving me database locked error.i can insert data main jframe i'm opening new jframes jcombobox. hink know source dont know how fix this. think need close main jframe open other frames. sqlite database can storage frames datas. here i'll give how can open jframes jcombobox , how i'm trying insert data database. please me or , leave comment what're thinking problem. wrong source idea or true. need helps guys. reading. 1: codes how i'm opening jframes combobox. public void comboselect(){ int d =combobox_name.getselectedindex(); if (d==0){ cezalıuye s=new cezalıuye(); s.setvisible(true); dispose(); } if(d==1){ deaktifuye z=new deaktifuye(); z.setvisible(true); dispose(); } if(d==2){ tatbikatform l=new ta...