Posts

Showing posts from July, 2015

javascript - jQuery wrap multiple div elements on same class -

hello use jquery wrap sets of class elements in div can't find solution html: <div class="view-content"> <div class="first">content</div> <div class="first">content</div> <div class="second">content</div> <div class="third">content</div> <div class="third">content</div> </div> desired result: <div class="view-content"> <div class="column"> <div class="first">content</div> <div class="first">content</div> </div> <div class="column"> <div class="second">content</div> </div> <div class="column"> <div class="third">content</div> <div class="third">content</div> </div> ...

java - How to switch Off / Turn Off Android Tablet through coding? -

i having micromax fun book android version 4.0.3 , want turn off tablet through android code. actually want turn off tablet application exits. may need hardware permission. not sure it. you can reboot device using powermanager api. may need have reboot permission in manifest though. http://developer.android.com/reference/android/os/powermanager.html#reboot(java.lang.string ) http://developer.android.com/reference/android/manifest.permission.html#reboot

java - Can I ensure that one of my Spring ApplicationListeners gets executed last? -

i have several services listening spring events make changes underlying data model. these work implementing applicationlistener<foo> . once of foo listeners modify underlying data model, user interface needs refresh reflect changes (think firetabledatachanged() ). is there way ensure specific listener foo last? or there way call function when other listeners done? i'm using annotation based wiring , java config, if matters. all beans implementing applicationlistener should implement ordered , provide reasonable order value. lower value, sooner listener invoked: class firstlistener implements applicationlistener<foo>, ordered { public int getorder() { return 10; } //... } class secondlistener implements applicationlistener<foo>, ordered { public int getorder() { return 20; } //... } class lastlistener implements applicationlistener<foo>, ordered { public int getorder() { return low...

vb6 - VBScript: Assigning an array(2) via createobject -

i'm having problem converting vb6 code vbscript. i'm calling out com object create array emailaddresstype. here working vb6 code: 'assign to: addresses dim toadresses(2) new emailaddresstype toadresses(0).emailaddress = "someone@whocares.com" toadresses(0).routingtype = "smtp" toadresses(1).emailaddress = "someoneelse@whocares.com" toadresses(1).routingtype = "smtp" email.torecipients = toadresses i can't seem figure out how convert vbscript. i've tried following type mismatch error once email.torecipients = toadresses 'assign to: addresses dim toadresses(2) set toadresses(0) = createobject("ews.ewswebsvc.emailaddresstype") set toadresses(1) = createobject("ews.ewswebsvc.emailaddresstype") toadresses(0).emailaddress = "someone@whocares.com" toadresses(0).routingtype = "smtp" toadresses(1).emailaddress = "someoneelse@whocares.com" toadres...

Exit python properly -

i knew sys.exit() raises exit exception, when run knew wouldn't exit: in [25]: try: ....: sys.exit() ....: except: ....: print "oops" ....: oops but thought os._exit() meant exit using c call, it's causing exception: in [28]: try: ....: os._exit() ....: except: ....: print "oops" ....: oops is there way of doing without killing pid? don't use except without exception class, sys.exit work fine without triggering exception handling: >>> import sys >>> try: ... sys.exit() ... except exception: ... print 'oops' ... $ there other exceptions triggered plain except clause (and in general shouldn't), keyboardinterrupt .

javascript - Move div element from one parent div to another -

so let's assume have set of nested divs: <div id="likelytobecalled"> <div id="likelyoddheader" class="row"> <div id="likelyodda" class="left" name="test1">test1</div> <div id="likelyoddb" class="middle"><img src="image002.png"/></div> <div id="timezone" class="right">west</div> </div> and further down page: <div id="unlikelytobecalled"> <div id="likelyoddheader" class="row"> <div id="likelyodda" class="left">test2</div> <div id="likelyoddb" class="middle"><img src="image002.png"/></div> <div id="timezone" class="right">west</div> </div> how move test1 "unlikelytobecalled"....

oauth - Getting user information when using OAuth2 - is the following reasonable? -

i creating api (restlet, gae) , implemented openid authentication , oauth2 protect access api. when testing client web app built, fine. when user hits part of web app wants access api, user asked login via openid , asked grant access web app grab resources api. however, noticed web app doesn't know user (!). web app has auth token. thus, web app can't "hello, username", since doesn't know user is. with restlet technology, authentication essentially: // authentication code openidverifier verifier = new openidverifier(openidverifier.provider_yahoo); verifier.addrequiredattribute(attributeexchange.email); authenticator au = new myredirectauthenticator(getcontext(), verifier, null); while following handles both authentication , oauth2 authorization: // authentication + oauth code: oauthparameters params = new oauthparameters("2345678901", "secret2", "http://localhost:8888/v3/", roles); oauthpro...

c# - using SQL Server Management Objects (SMO) Developer Machine 32 bit - SQL Server 64 bit -

i develop windows forms application on 32 bit win7 machine , have sql server 2008 on same machine testing. database server of release inviroment has 64 bit. when install application on client (32 bit) in release inviroment connected 64 bit sql server following failure when code try use sql server management objects (smo): code causes failure: private static bool createdatabase(string dbname, string sqlpath, string connstr) { fileinfo file = new fileinfo(sqlpath + dbname + ".sql"); string strscript = file.opentext().readtoend(); bool result; string test = "create database [" + dbname + "]"; try { sqlconnection connection = new sqlconnection(connstr); using (connection) { using (sqlcommand sqlcmd = new sqlcommand(test, connection)) { connection.open(); sqlcmd.executenonquery(); ...

openlayers - Allow only zoom out until bounds -

i try figure out, how limit zoom factor bounds (defined via restrictedextent), means can zoom out, long not touch bounds on 2 sides of viewport. what found, question ( min/max zoom level in openlayers ) somehow not figure out how work. i working on actual openlayers version 2.11. any solutions?

php - Mysql - How to retrieve fields from two tables based on certain criteria? -

i trying retrieve post_id, post_year, post_desc, post_title, post_date 1 table , img_filename table post_id equal , is_thumb 1 (where have chosen image posts thumbnail) this far have got without luck: select post_id, post_year, post_desc, post_title, post_date, mjbox_posts join mjbox_images using (img_is_thumb) img_is_thumb = 1 , mjbox_images.post_id = mjbox_posts.post_id thanks select p.post_id, post_year, post_desc, post_title, post_date, img_filename mjbox_posts p join mjbox_images on i.post_id = p.post_id , i.img_is_thumb = 1 or, if prefer using syntax, select post_id, post_year, post_desc, post_title, post_date, img_filename mjbox_posts p join mjbox_images using (post_id) i.img_is_thumb = 1 the difference first query returns post_id both tables , need alias it.

Facebook App: Getting a user's name from ID -

i had fb app project turned on me, , i'm trying clean few items before goes live. the original programmer has user id number stored in database, doesn't display or name. i'd display user's name under picture upload. my code <?php echo $row['user_id']; ?> , there simple way convert user's name? call id api name field. https://graph.facebook.com/user_id?fields=name it should return { "name": "first lastname", "id": "user_id" } save variable , extract $user['name']; for more information http://developers.facebook.com/docs/reference/api/user/ an example without sdk/access token, $response = file_get_contents("https://graph.facebook.com/4?fields=name"); $user = json_decode($reponse,true); echo $user['name']; should print, 'mark zuckerberg'

google app engine - Iterate over object in Jinja2? -

i'm using jinja2 on google app engine. have listview renders generic template. @ moment, i'm not sure want display, want display each attribute of model. is there way iterate on object output each 1 in table cell? for example: {% record in records %} <tr> {% attribute in record %} <td>{{ attribute }}</td> {% endfor %} </tr> {% endfor %} any advice appreciated. thanks this trick in simple python code: for attribute in record.properties(): print '%s: %s' % (attribute, getattr(record, attribute)) you can put getattr function in context can call in jinja2 shown below: {% record in records %} <tr> {% attribute in record.properties() %} <td>{{ getattr(record, attribute) }}</td> {% endfor %} </tr> {% endfor %}

Create an L-shaped border with round corners using HTML and CSS -

Image
here picture of desired solution (note round corners): here have far: http://jsfiddle.net/cbwh8/1/ http://jsfiddle.net/cbwh8/2/ http://jsfiddle.net/cbwh8/3/ i don't think i'd ever approach problem markup , no images, since asked: http://jsfiddle.net/dcepr/

php - Finding open contiguous blocks of time for every day of a month, fast -

i working on booking availability system group of several venues, , having hard time generating availability of time blocks days in given month. happening server-side in php, concept language agnostic -- doing in js or else. given venue_id, month, , year (6/2012 example), have list of events occurring in range @ venue, represented unix timestamps start , end . data comes database. need establish what, if any, contiguous block of time of minimum length (different per venue) exist on each day. for example, on 6/1 have event between 2:00pm , 7:00pm. minimum time 5 hours, there's block open there 9am - 2pm , between 7pm , 12pm. continue 2nd, 3rd, etc... every day of june. (most) of days have nothing happening @ all, have 1 - 3 events. the solution came works, takes waaaay long generate data. basically, loop every day of month , create array of timestamps each 15 minutes of day. then, loop time spans of events day 15 minutes, marking "taken" timeslot false. remainin...

r - as.data.frame and cbind results in factor columns -

i have big data.frame mix of integer, character , strings columns. i'll need order data.frame numeric column. when combine original columns data.frame columns change factor, including column need sort. sort gives 1, 10, 100... instead of 1, 2, 3... here example of problem. a <- 1:10 b <- c(1,3,5,6,2,10,100,110,7,4) c <- letters[1:10] d <- as.data.frame(cbind(a, b, c)) # using construction e <- d[with(d, order(b)), ] how can fix this? actually need do: d <- data.frame(a, b, c, stringsasfactors=false) the last part stringsasfactors=false prevents column d$c being converted factors. include it, , strings stay strings. don't forget stringsasfactors=false - save untold misery, trust me!

.net - Visual Studio MSVCP110D.dll is missing -

i downloaded , installed visual studio 2012 rc , made program it. however, if try run compiled binary on computer error saying the program can't start because msvcp110d.dll missing computer. try reinstalling program fix problem. i don't error on computer. assume because visual studio installed file me. how compile program, it'll run on computer without dll file? i discovered (correct me if i'm wrong) dll file part of .net framework 4 or 4.5 beta. got thinking if compile program using earlier version of framework, 2.0 or 1.0, able work around error. well, able compile using version 2.0 , 1.0 of framework, still error message. how compile program that'll run without dll file file? oh , error on program compile. simple "hello world" program. again, don't error on machine since visual studio installed file me, on other machines try run programs on. oh, should mention i'm running visual studio on windows 7 ultimate 64-bit machine, co...

Which query is optimized when I get monthly data with respect to sale.purchase_date using MySQL? -

i have same result when execute both queries different functions. wanted know query optimized or logically correct (see query 1 , 2 below). i monthly data respect sale.purchase_date query 1 select sales.purchase_date `sales` sales.purchase_date '2012-06-%'; query 2 select sales.purchase_date `sales` month(sales.purchase_date) = '6' , year(sales.purchase_date) = '2012'; both of require table scan because need examine purchase_date see if row in , can't use index. suggest use between query can make use of index on purchase_date : where sales.purchase_date between '2012-06-01' , '2012-06-30'

html - css styles disappear over ssl -

when connected on ssl particular styles getting dropped stylesheet. can't figure rhyme or reason it's same styles consistently dropped. perhaps notably, elements hidden display:none; visible. list styles revert default browser settings , couple background images (not of them) dropped well. uri paths relative -- both page head stylesheets themselves. for example, following works... body { background: url(../images/bg-yellowstripes.jpg) repeat 0 0; } however, next line not... #masthead { background: url(../images/bg-header.jpg) repeat-x 0 100%; } anyone have experience page display , avoid ie mixed content warning? affect internet explorer btw. firefox, safari, chrome render page normally, without ssl warnings. it sounds you're loading css files absolute paths. example, if have site going served on http , https, should use relative path instead. absolute: (don't this, ie give security warnings when viewed on ssl) <link rel="stylesheet...

sql - How to connect an odbc database to my java code? -

i need connect odbc database java code. know connecting mdb database need use code doesn't work: class.forname("sun.jdbc.odbc.jdbcodbcdriver"); // set ms access db have on machine string filename = "c:/porogram/pro.mdb"; string database = "jdbc:odbc:driver={microsoft access driver(*.mdb)};dbq="; database+= filename.trim() + ";driverid=22;readonly=true}"; // add on end // can connection drivermanager connection con = drivermanager.getconnection( database ,"",""); statement s = con.createstatement(); thank much. currently i'm working jdbc-odbc bridge , code works me @ 100%: this.jdbcuser = proputil.getvalue(configfile, "jdbc.user"); this.jdbcpass = proputil.getvalue(configfile, "jdbc.pass"); this.jdbcurl = proputil.getvalue(configfile, "jdbc.url"); this.jdbcdriver = proputil.getvalue(configfile, "jdbc.driver"); //be sure load required jdbc driver class.forna...

.net - Visual Studio 2010: Can't create new connection to SQL Server Compact 4.0 -

i have installed sql server compact edition 4.0 on windows 7 machine. (note had sql server compact 3.5 sp2 on machine). however, in visual studio 2010 project, unable create new connection sql server compact edition 4.0 database... i.e. - doing following: in server explorer, right click "data connections" "add connection" "change data source" - microsoft sql server compact 4.0 not option (only version 3.5) how can make visual studio 2010 know installed copy of microsoft sql server compact 4.0? see sql server compact 4.0 tooling support in visual studio 2010 sp1 , visual web developer express 2010 sp1 and visual studio 2010 service pack 1 support sql server compact 4.0 released do have vs2010 sp1 installed? if not - download here

how to extract data from multiple iframes using jsoup and write it to one xml file -

i'm using jsoup extract data html page. i'm able extract data if page has 1 iframe. but, if page has links open iframe how extract data second iframe , write data 1 xml file. please me on this. one approach parse parent website iframe tags , extract "src". "src"-values can used download each iframe content , parse it, if necessary combine them. string url = "http://example.com/"; document document = jsoup.connect("url").get(); elements es = document.select("iframe"); string[] iframesrc; int iframecount = es.size(); iframesrc = new string [iframecount]; //extract iframe sources: int i=0; for(element e : es) { iframesrc[i] = e.getelementsbytag("iframe").attr("src"); i++; } //get iframe content document [] iframedoc; iframedoc = new document[iframecount]; int j = 0; (string s : iframesrc){ iframedoc[j] = jsoup.connect("url"+iframesrc[j]).get(); //pay attention co...

compilation - VS 2010: Compiling Class Project, Debug Release, looking for path from my PC on other developer's computers? -

we have common compiled code library accessible number of advanced developers within our company. build releases periodically, releasing 'release' version our dev, test environments , debug release developers use. oddly, when build debug release, references path of project on pc show when developer tries use debug version of dll on pc. haven't worked extensively compiling these dlls, should able build debug release , give other developers use within projects, correct? or not how works? references path of project on pc show when developer tries use debug version of dll on pc. haven't worked extensively compiling these dlls, should able build debug release , give other developers use within projects, correct? or not how works? when build debug version, you're building .pdb, contains symbols required debugging. going include file paths, line numbers, etc, , based on system library built. that's why see these paths. that being said, won...

Clojure: light weight jail -

context: in lua, it's trivial , cheap (4kb of memory) create new lua vm. thus, it's trivial create cheap lua "jails". then, if untrusted code misbehaves, kill lua vm. i'm aware of https://github.com/licenser/clj-sandbox appears wrap around java ... make untrusted code thread native java threads, powerless kill. question: is there anyway create cheap / light weight clojure jails? i'm (co)author of little library called clojail kind of rethinking of clj-sandbox. makes use of java sandbox, provides features sandboxing clojure-specific things. tryclj , 4clojure make use of it. i don't understand mean rest of that. jvm sandbox great in can prevent i/o. clojail goes rest of way allowing timeouts prevent long running code. if you're saying "people create threads , wouldn't able kill them", clojail kills threads created inside of sandbox , best prevent stray threads running away. jvm sandbox (and clojail specific stuff)...

clojure - Syntax: hash (pound) then symbol -

i following datomic sample schema , there's id entity defined as :db/id #db/id[:db.part/db] what's meaning of #db/id ? schema loaded read-string, guess it's valid clojure syntax. it's new feature in clojure 1.4: a reader literal .

css - Overlap a new Div created with Jquery? -

Image
so... it's kind of same problem before. want create new div when key pressed. create it, puts off background. function attack() { $("body").append("<div class='proj'></div>"); $(".proj").css("position", "absolute"); $(".proj").css("width", "32px"); $(".proj").css("height", "32px"); $(".proj").css("background-color", "#00ffff"); $(".proj").css("left", playerpositionleft); $(".prok").css("top", playerpositiontop); $(".proj").css("z-index", "2"); } the cyan box .proj need @ red square's location. hope can help! don't append <div class='proj'></div> in body . append in div containing big image. , please remember add position:relative div

onmouseover - javascript onmouseout works also on mouse over -

i'm trying show/hide some of text in button. button <button id="sos" onmouseover="show()" onmouseout="hide();"> <p>s.o.s</p> <div id="sos_left"> <?=$text_to_show_hide?></div> </button> and javascript code is <script type="text/javascript"> function show() { sos_left=document.getelementbyid('sos_left'); alert("mouseover"); sos_left.style.color = "red"; sos_left.style.fontsize = "28"; } function hide(){ sos_left=document.getelementbyid('sos_left'); alert("mouseout"); sos_left.style.color = "blue"; sos_left.style.fontsize = "0"; } </script> the thing mouse out alerts when i'm mouse overing. note: can't use jquery because site vbulletin based , use code on 1 of templates. you dont hide anything.. ...

Submit one select field in ajax (not entire form) to get it's value and filter another select in php on same page -

it's first programming experience in ajax (or jquery) appreciate kind of help. trying have 2 select inputs in html form want when first select changed (onchange) have value use filter second select in php dynamically generate options, must happen without submitting entire form first select. tried following code whenever first select changes submit entire form. ajax function: function showkadaa(str) { if (str=="") { document.getelementbyid("txthint").innerhtml=""; return; } if (window.xmlhttprequest) {// code ie7+, firefox, chrome, opera, safari xmlhttp=new xmlhttprequest(); } else {// code ie6, ie5 xmlhttp=new activexobject("microsoft.xmlhttp"); } xmlhttp.onreadystatechange=function() { if (xmlhttp.readystate==4 && xmlhttp.status==200) { document.getelementbyid("kop").innerhtml=xmlhttp.responsetext; } } xmlhttp.open("get","annonce.php?mid="+str,true); xmlhttp.send(); } the html code porti...

asp.net - Connection error in Visual Studio -

i'm developing web application using asp.net. database on server called dataserver . database server os windows server 2003 , uses sql server 2008 r2. problem when start computer , run application first time can't connect server , shows following error: a network-related or instance-specific error occurred while establishing connection sql server. server not found or not accessible i open my computer , type \\dataserver on address bar of windows explorer , browse server files. after doing problem disappears. how can fix it? this may name resolution problem - using domain controller or in workgroup? on , off vpn in order connect server? in case, can tell visual studio connect ip address of dataserver instead of name (either in connection you've added project or connection string explicitly specified in web.config). can add entry hosts file supersede dns resolution.

jquery mobile data trasfer between section -

i'm doing mobile website based on jqm , http://dl.dropbox.com/u/49735179/dialog-data-transfer.html . if click submit button 1 of search result on section "dialogpage", supposed shown on section "mainpage" of zip1, zip2, addr form. but form value of zip_code1, zip_code2, addr not tranfered section "mainpage". what problem in script? here full script + html. <!doctype html> <html> <head> <title>test dialog</title> <meta charset="utf-8" /> <meta name="viewport" content="height=device-height,width=device-width,initial-scale=1.0,maximum-scale=1.0,user-scalable=no" /> <link rel="stylesheet" href="http://code.jquery.com/mobile/1.0/jquery.mobile-1.0.min.css" /> <script src="http://code.jquery.com/jquery-1.6.4.min.js"></script> <script src="http://code.jquery.com/mobile/1.0/jquery.mobile-1.0.min.js"></sc...

How do i verify string content using Mockito in Java -

i new using mockito test framework. need unit test 1 method return the string content. same contents stored in 1 .js file (i.e. "8.js"). how verify the string contents returned method expected want. please find below code generating .js file: public string generatejavascriptcontents(project project) { try { // creating projectid.js file fileutils.mkdir(outputdir); fileoutputstream = new fileoutputstream(outputdir + project.getid() + ".js"); streamwriter = new outputstreamwriter(fileoutputstream, "utf-8"); stringtemplategroup templategroup = new stringtemplategroup("vitemplates", "/var/vi-xml/template/", defaulttemplatelexer.class); stringtemplate = templategroup.getinstanceof("standardjstemplate"); stringtemplate.setattribute("projectidval", project.getid()); stringtemplate.setattribute("widthval", pr...

haskell - How do I use Unboxed Vectors? -

i trying implement ray data type using vector type found here: http://www.haskell.org/haskellwiki/numeric_haskell:_a_vector_tutorial#importing_the_library the vector hold doubles, use unboxed version of vector type. here code trying compile: module main import qualified data.vector.unboxed vector data ray = ray data.vector.unboxed data.vector.unboxed the error is not in scope: type constructor or class `data.vector.unboxed' failed, modules loaded: none. the module data.vector.unboxed exports type constructor vector takes argument type want store. since renamed module vector well, qualified name type vector.vector . assuming want 2 vectors of doubles, should therefore use this: data ray = ray (vector.vector double) (vector.vector double)

oop - c++ implementation of access specifiers -

from understand, non-static data members in c++ class packed c-style struct. ignoring virtual functions , inheritance sake of simplifying discussion, how access-specifiers enforced in such scheme ? say class: class object { public: int i1; int i2; private: char i3; int i4; }; translates to: struct { int i1; int i2; char i3; int i4; } how c++ ensure private members i3 , i4 can not accessed outside class i1 , i2 can be? c++ has (some) safe guards protect against murphy, not machiavelli. what means const , volatile , access-qualifiers checked at compilation time , can bypassed (with variety of tricks). so... c++ not require implementing protection scheme. if program compiled, deemed correct (wrt qualifiers) , executed without runtime checks.

hyperlink - Connection-link selection not accurate using javascript library draw2d -

i want implement graph designer using draw2d library. in demo, click on connection-link accurate, otherwise in application click on links not accurate because of times connection not selected (the elements such vectorfigure don't have selection problems). difference between application , demo container of div called "paintarea"; in fact, don't use frame dedicated paintarea doesn't start form x=0 , y=0. can me? important...thanks in advance. did use scroll container/div? sometimes users enclose paintarea in scrollable div. in case should use setviewport ...or inspect viewport demo.

asp.net mvc - A localized scriptbundle solution -

hi using asp.net mvc 4 rc system.web.optimization. since site needs localized according user preference working jquery.globalize plugin. i want subclass scriptbundle class , determine files bundle according system.threading.thread.currentthread.currentuiculture . this: bundles.add(new localizedscriptbundle("~/bundles/jqueryglobal") .include("~/scripts/jquery.globalize/globalize.js") .include("~/scripts/jquery.globalize/cultures/globalize.culture.{0}.js", () => new object[] { thread.currentthread.currentuiculture }) )); for example if ui culture "en-gb" following files picked (minified of course , if possible cached aswell until script file or currentui culture changes). "~/scripts/jquery.globalize/globalize.js" "~/scripts/jquery.globalize/globalize-en-gb.js" <-- if file not exist on sever fi...

Need feedback on Ozeki (Voice Over IP) VoIP SIP SDK -

i work small company , boss told me around on market voice/video sdk. have found 1 called ozeki voip sip sdk. according description on website looks promising. if has used sdk please share few thoughts me, give better report boss. i have purchased , tested ozeki voip sdk months, development simple there serious issues sdk : 1- not reliable , after working hours cpu goes 100% or memory corrupt occurred. 2- no proper documentation available. 3- there many samples incomplete , same . 4- support not , there no answer. i recommend vaxtele www.vaxvoip.com more reliable , have support

oop - Java Extending a class and setting values -

animal base class public class animal { protected string pig; protected string dog; protected string cat; public void setpig(string pig_) { pig=pig_; } public void setcat(string cat_) { cat=cat_; } public void setdog(string dog_) { dog=dog_; } } animalaction class public class animalaction extends animal { public animalaction(string pig, string cat, string dog) { super.pig = pig; super.cat = cat; super.dog = dog; } } would correct way set protected variables? using protected variables correct way this? there more professional oo way do? you can use private variables instead of protected. more apt. can use constructor set value of super class. edited: public class animal{ private string pig; private string dog; private string cat; public animal(string pig,string dog,string cat){ this.pig=pig; this.dog=dog; this.cat=cat; } } public class animalaction extends animal { public anim...

nginx - Simulate poor bandwidth in a testing environment (Mac OS X)? -

we have customized flash/html5 video player use users on our site. i'm fleshing out experience users have 'suboptimal' bandwidth--basically we'd client side code able detect poor user experience due excessive buffering. test "poor bandwidth" handling code in local development environment. does know of techniques simulating "poor bandwidth" in local environment testing purposes? more have local browser connecting virtual machine instances of uwsgi, nginx, , python/django , able inject arbitrary amounts of delay delivery of content these systems. (i'm concerned doing nginx, video content delivery/streaming). edit: may relevant dev environment mac os x. just use nginx's configuration. while os x lion's network link conditioner works expected it's still annoying use when i'm trying test subset of web app's behavior--i.e., slow video buffering handling system. as such, i've found more convenient set rat...

php - Remove specific parameter from URL while preserving other parameters -

i want remove parameter url: $linkexample1='https://stackoverflow.com/?name=alaa&counter=1'; $linkexample2='https://stackoverflow.com/?counter=4&star=5'; i trying result: https://stackoverflow.com/?name=alaa& https://stackoverflow.com/?&star=5 i trying using preg_replace , i've no idea how can done. $link = preg_replace('~(\?|&)counter=[^&]*~','$1',$link);

javascript - Detect if browser has TLS enabled -

is there way check if browser has tls enabled? i'm limited using html , javascript. in javascript, utilizing activex, , intended ie7, (function(){ var key = "hkcu\\software\\microsoft\\windows\\currentversion\\internet settings\\secureprotocols"; var t = document.getelementbyid("detectreg_output"); var shell = new activexobject("wscript.shell"); var value = shell.regread(key); t.innerhtml = value; })(); this outputs bitfield, decimals equating to: 168 = ssl 3.0, ssl 2.0, tls 1.0 enabled 160 = ssl 3.0, tls 1.0 enabled 40 = ssl 3.0, ssl 2.0 enabled 8 = ssl 2.0 enabled 0 = none enabled msdn on ie7 , https

firefox - CSS: Turn Overflow Items into New Row -

i bought wp theme: http://demo.wpzoom.com/evertis/ , want modify "featured articles" section. instead of using scroll button view featured articles, want display featured articles (ie. every 3 articles on 1 row). i try modify css can not want. "overflow" articles texts. .scrollable { /* required settings */ position:relative; overflow:hidden; width: 930px; height:400px; } .slide { -webkit-border-radius: 5px; -khtml-border-radius: 5px; -moz-border-radius: 5px; border-radius: 5px; background:#e6eef4; padding:10px; margin:0 20px 0 0; float:left; width:270px; position:relative; display:inline; } i use firebug on firefox , tried different combinations of "display:block" , "float:auto", can not want exactly. can make display 1 article 1 row. merging in/adding css it: #thumbs { width: auto; position: static; overflow: hidden; } .scrollable { overflow: visibl...

php - Codeigniter: Simple echo of data from DB -

what best way create model can call controller this? $this->model_model->function->dbname i have following model rubbish: model: function systemname() { $query = $this->db->query("select cms_name options"); return $query->result(); } update: function systemoptions($options) { $this->db->select($options); $query = $this->db->get('options'); return $query->num_rows(); } why want to? why not call this?: $this->model_model->functionname('dbname'); a complete skeleton of model this: <?php class mymodel extends model { function get_some_entries($number_rows) { return $result = $this -> db -> query("select id, name tablename limit $number_rows"); } } ?>

java - PrintWriter getting set with error flag on redirection -

i developing web application uses dwr push mechanism. observed printwriter class in httpservletresponse getting set error. logic: dwr's custom flush method: printwriter out = reponse.getwriter(); public boolean flush() { out.flush(); if (out.checkerror()) { /* error occurred while sending response, resend response in next push */ return false; } /* response sent */ return true; } the strange thing though printwriter error sends response client side, since in above code out.checkerror() return true, response resent client. on further observation found following statement getting logged everytime when kind of misbehavior there: warn:oejh.httpgenerator:ignoring content this dependent on browser type , happening in chrome, firefox , not in opera, ie. is (httpgenerator: ignoring content) going update printwriter ? when printwriter sets error flag ? how browsers response kind ...

c# - asp.net sql query'ed text rendered with wrong charset -

i'm revamping old .net 2 website, , feel of our new ci. since there money left over, told review code behind well. as of now, ran serious problem charset: on pages german "special" characters ß ä ö ü rendered correct. on 1 page every special character rendered normal one. in case ö --> o; ä--> a; ß --> ? the text query grabbing database rendered correctly in debugger, gets messed rendered in browser. i've set charset in master page iso-8859-1 in config.web. help appreciated - in advance. marco have set metatag in head section of rendered html? i.e. < meta content="text/html; charset=iso-8859-1" http-equiv="content-type"> ah, sorry! i've misread line masterpage.

mysql - Error in php error handling (file upload) -

i want put out error message when uploaded image size on 3mb. current code. should put out error message when image on 3mb, nothing. what's wrong code? if ( $_files['file']['size'] != 0 ) { //image check start if ((($_files["file"]["type"] == "image/gif") || ($_files["file"]["type"] == "image/jpeg") || ($_files["file"]["type"] == "image/png") || ($_files["file"]["type"] == "image/pjpeg")) && ($_files["file"]["size"] < 3072000)) //image check end { if (file_exists($upload_path."/".$_files["file"]["name"])) { $file_tmp = $_files["file"]["name"]; } //link if there file identical file name else { $photoid = $upfile_idx.".".substr($_files['file']['name'],-3); move_upload...

what type of projects exist to php none framework for xss filltering and security -

what type of projects exist php none framework xss filltering , security? i know there owasp esapi php hardly update , not seem looking can give solution security part input filter , not this. looking best practice hehe, as if have tips around security if have nothing know here. you can try http://htmlpurifier.org/

c# - Finding X & Y positions -

i trying find x & y positions can draw images on part of game window, have no idea how , can't find information on how this, if appreciated, thanks. you can mouse state mouse class found in microsoft.xna.framework.input; mousestate mousestate = mouse.getstate(); var x = mousestate.x; var y = mousestate.y;

c# - Reversing the save method in the Open method -

fairly new programming. can't wrap head around how work in reverse. have save method , open method. save: idictionary<string, idictionary<string, object>> pluginstates = new dictionary<string, idictionary<string, object>>(); signaller.raisesaverequest(pluginstates); <--goes out , gets packed plugins //loop through plugins values , types //holds of plugin arrays dictionary<string, object> dictprojectstate = new dictionary<string, object>(); foreach (keyvaluepair<string,idictionary<string,object>> plugin in pluginstates) { //holds jsonrepresented values dictionary<string, object> dictjsonrep = new dictionary<string, object>(); //holds object types dictionary<string, object> dictobjrep = new dictionary<string, object>(); object[] arraydictholder = new object[2]; //holds of dictionaries string pluginkey = plugin.key; idictionary<string, object> pluginvalue = new dict...

postgresql - postgres tablefunc module using hql hibernate queries? -

would know how use postgres crosstab (tablefunc) function in hql query? need register function hibernate? this error i'm getting: unexpected token: crosstab near line 1, column 34 [select * crosstab('select ... thanks. you cannot in hql, since hql different language independent of database implementations. if want use features specific postgresql (such crosstab) need native query interface .

c# - Merge Multiple Word Documents while Preserving Headers - .Net Office Automation -

i want merge multiple word documents while preserving header , footer of each document. below code merging documents merges header , footer well: public static void merge(list filestomerge, string outputfilename) { application wordapplication = null; document worddocument = null; try { // create new microsoft word application object wordapplication = new application(); wordapplication.visible = false; wordapplication.screenupdating = false; // create new file based on our template object defaulttemplate = @"normal.dotm"; worddocument = wordapplication.documents.add(ref defaulttemplate); // make word selection object. selection selection = wordapplication.selection; // loop thru each of word documents foreach (string file in filestomerge) { // insert files our template selection.insertfile(file); object pagebreak = wdbrea...

Simulating serial port programmatically without installing driver -

Image
com0com great program have virtual serial ports. question: there library can use simulating serial ports (com, usb , on) programmatically in application without install software such virtual devices? something making virtual device in user space? os: windows free virtual serial ports hhd software ltd (license freeware). excerpt: this device driver implements functionality of virtual serial port device. operates in user mode space , unlike other device drivers, making system more stable , secure. read more .

xml - String (with spaces) to DOM in Java -

i have function converts string dom, , uses javax.xml.xpath.xpathfactory on dom object pull data. the xpathfactory works fine following string <root><test><name>a</name></test><test><name>b</name></test></root> but fails if have spaces between tags <root> <test> <name>a</name> </test> <test> <name>b</name> </test></root> i'm using xpathfactory ready values "a" , "b" dom. can tell me why xpathfactory failing when string has spaces in between tags. thanks --sd the xpath correct , works ok, think problem that list.item(i).getchildnodes().item(0).gettextcontent()); gets first child node of node matching xpath, in case of xml spaces spaces right after <employee> , whereas in case of xml without spaces <name> element. in other words in case spaces child nodes of first employee element (one per line): ...

linux - How to add a new LDAP'ed user to subversion -

our svn administrator on holidays, , need add new user subversion. we're using collabnet subversion on redhat box. i've found collabnet_subversion/conf/ directory configuration files, including auth file can see contains our users , groups belong to. all our users need log in ldap credentials, don't need change of that. it looks this: company_auth_production `[groups] it-leads = jsmith, hsimpson, pgriffin it-all = ajolie, rwitherspoon, @it-leads [/] * = [prod:/] @it-all = rw ` so added new user , restarted subversion. doesn't seem have done trick. missing else ? thanks a. have mention there "company_auth_production" file. please check if there other authorization file, "authz". can please provide more information on this. as per structure in file [prod:/] @it-all = rw should have given read write access users of "it-all" till path "prod". b. if not working pleas...

c# - Unit Testing Internal List<String> -

using system; using system.collections.generic; using system.text; [serializable] public class columndatafield { #region fields private int _columnindex; private string _datafields; #endregion fields #region properties /// <summary> /// column index /// </summary> public int columnindex { { return _columnindex; } set { _columnindex = value; } } /// <summary> /// data fields /// </summary> public string datafields { { return _datafields; } set { _datafields = value; } } /// <summary> /// convert datafields string data field list /// </summary> internal list<string> datafieldlist { { if (string.isnullorwhitespace(datafields)) return new list<string>(); string[] _array = datafields.split(new char[] { ',' }, stringsplitoptions.removeemptyentries); list...

windows - .pl files open in notepad -

i new xampp, , also, new perl programming. tried open file c:\xampp\cgi-bin\printenv.pl , made mistake. i chose default program open file extension notepad, option always use selected program open kind of file . now when try run .pl files cmd opens them in notepad instead of executing. please reply. in advance. type following @ shell prompt: assoc .pl=perlscript ftype perlscript="c:\...\bin\perl.exe" "%1" %* (replace ... correct path.)

post - Using HTTPWebRequest for postdata...what am I missing here? -

i've been designing program helps users navigate , use online dating sites. part of program allows users send message through program, i'm having trouble website pof.com. i've verified postdata variable turning out string matches browser send. here code assume problem lies: pofmessage = httputility.urlencode(pofmessage) dim postdata string = sendparameter1 & "=" & sendparameter1_value & "&autologinid=" & autologinid & "&message_id=" & messageid & "&u=" & u & "&p_id=" & p_id & "&receiver=" & receiver & "&profile_idb=" & profile_idb & "&usersendtob=" & usersendtob & "&i=" & & "&v=" & v & "&subject=" & pofsubject & "&message=" & pofmessage & "&sendmessage=send+quick+msg" dim encodin...

extjs - How to move between panels in Sencha touch -

when moving between panels following error [warn][ext.component#constructor] registering component id (`logoutbutton`) has been used. please ensure existing component has been destroyed (`ext.component#destroy()`. i can go previous screen cannot go forward again without getting above error. to combat have tried using code below, not work. can me out? var loginview = ext.getcmp('login'); if(!loginview){ ext.getcmp('logintest2').destroy(); loginview = ext.create('com.view.login'); } ext.viewport.setactiveitem('login'); i tried: if(ext.getcmp('login')){ ext.viewport.setactiveitem('login'); }else{ ext.viewport.setactiveitem(ext.create('com.view.login')); } neither of these work , result in same error , blank screen. using sencha touch 2. we can use following line navigate 1 panel another.. ext.viewport.animateactiveitem({ xtype: "cat" }, { type: "slide...

java - Initbinder for List of Strings -

hallo i'm trying use initbinder annotations in order match values receive multiply list box.the values list box string values.iinitially did following way match 1 choice(i didn't add multiply choice yet) , works fine. code following: at controller have this: @initbinder public void initbinderresearch(webdatabinder b) { b.registercustomeditor(research.class, new researcheditor()); } at debuging can see binding of research_area values not successful.but don't take exception or error.can tell me i'm doing wrong , not working? you can't override propertyeditor.setastext(list<string> text) because not exists in parent class , webdatabinder not use method make string object conversions. if register original researcheditor , change property type research type list<research> in backing form model, webdatabinder convert thems.

knockout.js - How to conditionally render a css class with knockoutjs -

i have html following: <div class="control-group"> <input type="text" data-bind="value: $data.dealcode" name="dealcode" class="input-mini" /> </div> however, ifnot: $data.dealcodeisvalid , need render following: <div class="control-group error"> <input type="text" data-bind="value: $data.dealcode" name="dealcode" class="input-mini" /> </div> note additional class "error" in div. there way knockoutjs? something like <div data-bind="css: {'control-group': true, error: (!$data.dealcodeisvalid)}"> check here more info

optimization - Combining imports in development CSS into 1 file for production -

is there can use merge multiple css imports 1 css file. for example, let's have main styles.css file has large number of imports during development: @import url('normalize.css'); @import url('1.css'); @import url('2.css'); ... @import url('10.css'); i separate them during development own sanity. i'd minimize http requests during production though 1 styles file, rather 11, 12 , etc. so, there something, other manually copy/pasting 1 file, can put these imports 1 file? does less or sass this? less , sass , more. there many server-side ways collate css files single document (less can js wouldn't recommend lose styling js off) yahoo yui compressor / rhino same if not mistaken: http://developer.yahoo.com/yui/compressor/#work if check global options, 1 works you: -o outfile place output in file outfile. if not specified, yui compressor default standard output, can redirect file. supports filter syntax expressi...

c# - Cannot implicitly convert type 'IEnumerable<XElement>' to 'bool' -

i want find xelement attribute.value children have concrete attribute.value. string fathername = xmlnx.descendants("assembly") .where(child => child.descendants("component") .where(name => name.attribute("name").value==item)) .select(el => (string)el.attribute("name").value); how can attribute.value? bool? edited have following xml: <assembly name="1"> <assembly name="44" /> <assembly name="3"> <component name="2" /> </assembly> </assembly> i need attribute.value children (xelement) has expecific attribute.value in example, string "3" because searching parent of child attribute.value == "2" because of how nested where clauses written. the inner clause reads child.descendants("component").where(name => ...

javascript - Selecting inside of DIVs -

let's have list this: <ul class="list"> <li><span class="pos"><div class="txt_pos">1</div></li> <li><span class="pos"><div class="txt_pos">2</div></li> <li><span class="pos"><div class="txt_pos">3</div></li> <li><span class="pos"><div class="txt_pos">4</div></li> <li><span class="pos"><div class="txt_pos">5</div></li> </ul> and js: $(".list span.pos").each(function(i) { var newone = i; newrank = getnth(newone); $("> .txt_pos").slidetoggle('slow'); $(this).text(newrank); $("> .txt_pos").slidetoggle('slow'); }); how make select each li because right now, it's doing every list item @ once. i'm tryi...

Change CSS3 animation-duration with a transition -

i try reduce animation duration this. @-webkit-keyframes rotate { { -webkit-transform: rotate(0deg); } { -webkit-transform: rotate(360deg); } } #platines .disc { background: url(../img/disc.png) no-repeat; height: 86px; width: 86px; margin-top: 1px; position: absolute; z-index: 1; -webkit-animation-name: rotate; -webkit-animation-duration: 0.9s; -webkit-animation-iteration-count: infinite; -webkit-animation-timing-function: linear; } #platines .disc.paused { -webkit-transition: -webkit-animation-duration 2s; -webkit-animation-duration: 60s; -webkit-animation-iteration-count: 4; } unfortunately, not work. found solution around problem? no, it's impossible. animation-duration not animatable. source on mdn if change value when animation running, restart animation without transitions.