Posts

Showing posts from September, 2014

sql - select record for recent n years -

how select records 3 recent years, considering year instead of whole date dd-mm-yy . let's year 2013, query should display records 2013,2012 , 2011. if next year 2014, records shall in 2014, 2013, 2012 , on.... table foo id date ----- --------- a0001 20-may-10 a0002 20-may-10 a0003 11-may-11 a0004 11-may-11 a0005 12-may-11 a0006 12-jun-12 a0007 12-jun-12 a0008 12-jun-12 a0009 12-jun-13 a0010 12-jun-13 i think clearest way use year() function: select * t year("date") >= 2011; however, use of function in where clause prevents index being used. so, if have large amount of data , index on date column, uses current date better. following takes approach: select * t "date" >= trunc(add_months(sysdate, -3*12), 'yyyy')

Traverse through an index variable backwards, Python -

i have simple piece of code in python 2.7 must use while loop traverse index backwards. getting print out goes backwards, while loop not stop @ end , therefore produces out of range error , not know why. trying dope out failing. here code: fruit = 'banana' print len(fruit) index = 0 while index <= len(fruit): letter = fruit[index - 1] print letter index = index - 1 what think going on here initializing var index 0 , asking python work var fruit while index less or equal size of fruit. problem when index gets 0, have tried using < way wrote code seems still goes beyond 0, not sure though. your index goes 0, -1, -2... whereas length either 0 or positive, once negative indices go beyond -len(lst) limit out of bounds error. >>> test = [1, 2, 3] >>> test[-1] 3 >>> test[-2] 2 >>> test[-4] traceback (most recent call last): file "<pyshell#75>", line 1, in <module> test[-4] i

javascript - Reduce gap between jquery mobile listview thumbnail and text -

Image
i have following code want able reduce gap between thumbnail image , description list inside each list view. my css .myparagraph.ui-li-desc { color:#333; overflow:show; white-space:normal; height:28px; margin-bottom:0px; } my markup listitems_markup = '<li><img src="' + itemthumbnail + '"><div class="myparagraph"><ul data-inline="true" style="font-size:60%; font-weight:normal;"><li style="white-space:normal">you viewed ' + itemname + '</li><li style="white-space:normal">you spent '+itemtimespent+' on activity</li><li style="white-space:normal">you '+itemrating+' item</li><p class="ui-li-aside">'+itemviewedtime+'</p></ul></div></li>'; this looks like you might want reduce left padding list automatically set brows

javascript - jQuery: ajaxSubmit / ajaxForm any significant difference? -

somehow ajaxsubmit , ajaxform kinda play same role. if so, then, there significant difference between them ? if so; use, when , why? the faq reads : what difference between ajaxform , ajaxsubmit ? there 2 main differences between these methods: ajaxsubmit submits form, ajaxform not. when invoke ajaxsubmit serializes form data , sends server. when invoke ajaxform adds necessary event listeners form can detect when form submitted user. when occurs ajaxsubmit called you. when using ajaxform submitted data include name , value of submitting element (or click coordinates if submitting element image). so, ajaxsubmit submits form destination while ajaxform preps , waits form submitted. your run ajaxsubmit in place of $("#formid").submit() update in response comment below uploadprogress options page on same site says: note: aside options listed below, can pass of standard $.ajax options ajaxform , ajaxsubmit.

c++ - Sorted Linked List: optimized add/remove/reordering of elements -

i'm doing implementation of a* pathfinding algorithm based on pseudocode wikipedia, , i'm trying optimize performance. i've noted of time wasted on handling nodes in "open" set of nodes (basically nodes examine), i've been doing best make faster. (background, feel free skip code) basically, have set of nodes , following: find node lowest score check if node contained within set remove node set add node set by using sorted linked list, finding lowest score goes checking elements fetching first. adding nodes becomes more complicated, doesn't require traversing entire list, saves time. removing same regardless. checking if node in set, use array map direct access can done @ cost of additional memory. class opennodeset { public: opennodeset(void); ~opennodeset(void); void add(graphnode *n); void remove(graphnode *n); void reinsert(graphnode *n); bool contains(graphnode *n); graphnode* top(void); int size(void)

javascript - Delete property by value -

this question has answer here: how remove property javascript object? 25 answers i have object this: var names = { 45: "jeff", 145: "peter", 11: "dandie", 879: "michael" } how remove "peter" object? try this delete names['145']; or delete names.145;

json - Edit URL string in iOS -

i have app parses json feed url links , stores url in string. works fine however, url links appear this: ( "http://instagram.com/p/ccefu9huxg/" ) how can rid of brackets , apostrophe's @ end of url? i need open url in uiwebview can't because of brackets , apostrophe's @ ends of url. the information json feed being presented in uitableview. when user taps 1 of cells of uitableview, relevant url cell stored in nsstring read uiwebview. here code: -(void)tableview:(uitableview *)tableview didselectrowatindexpath:(nsindexpath *)indexpath { int storyindex = [indexpath indexatposition: [indexpath length] - 1]; nsstring *storylink = [[[[_datasource objectatindex: storyindex] objectforkey:@"entities"] objectforkey:@"urls"] valueforkey:@"expanded_url"]; //[webviewer loadrequest:[nsurlrequest requestwithurl:[nsurl urlwithstring:storylink]]]; nslog(@"\n\n link: %@", storylink); [uiview beginanimations:@"animateadb

jquery - Add a div class parent to img and iframes with exception for blockquotes -

i'm using these jquery snippets: $(".post img").each(function(){ $(this).wrap('<div class="fwparent" />'); }); $(".post iframe").each(function(){ $(this).wrap('<div class="fwparent" />'); }); to wrap images , iframes fwparent div class. need them make exceptions blockquotes. it looks now: <div class="post"> ... <div class="fwparent"><img src="image.png"></div> <div class="fwparent"><iframe src="movie"></div> ... <blockquote> <div class="fwparent"><img src="image.png"></div> <div class="fwparent"><iframe src="movie"></div> </blockquote> ... </div> but want this: <div class="post"> ... <div class="fwparent"><img src="image.png"></div> <div class="fwparent&qu

c - Program crashing using malloc() and free() -

i appear crashing program when trying free memory sections. following overall structure of linked lists: typedef struct { char *dataitem; struct listelement *link; int16_t wordsize; int16_t (*libword)[q]; char gpiovalue; struct listelement *syllables; }listelement; the program crashes when calling function: recordedwordspointer = removeitem(recordedwordspointer); // rid of junk stored in recorded buffer where: volatile listelement *recordedwordspointer; has stored values in libword , points next link if there another, otherwise null. following shows happens when entering function: listelement * removeitem (listelement * listpointer) { cpu_irq_disable(); listelement * tempp = listpointer; while( listpointer->syllables != null ){ removesyllable(listpointer->syllable

spring mvc - How to access subdir within images folder (getting 404)? -

i've added new subdir within images folder , cannot new images resolve. failed load resource: ... 404 (not found) http://localhost:8080/mywebapp/content/images/subdir/mysubdirimage.png my directory structure: src -- main --java --webapp --content --images // <- these resolve --subdir // <- new subdir...resolve fail images i have tried adding following does't work: <mvc:resources mapping="/content/**" location="/content/" /> mvc-dispatcher-servelet.xml: <mvc:annotation-driven/> <mvc:default-servlet-handler /> <mvc:resources mapping="/content/**" location="/content/" /> //<-- added this..no go! <bean class="org.springframework.web.servlet.mvc.annotation.annotationmethodhandleradapter" /> <bean class="org.springframework.web.servlet.view.internalresourceviewresolver"> <property name="prefix">

javascript - Get text from <tr> and add to img alt in another <tr> -

i want copy text blogger blogspot caption table , add img alt, appear in fancybox slideshow title/caption. so, html have : <table cellpadding="0" cellspacing="0" class="tr-caption-container" style="float: right; text-align: right;"><tbody> <tr> <td style="text-align: center;"><a href="url"><img align="right" alt="" src="url" title="ghostly waves in valle de rocas" width="320" /></a></td> </tr> <tr> <td class="tr-caption" style="text-align: center;">this caption</td> </tr> </tbody></table> and script is: $("tr-caption").each(function(){ var caption = $(this).text(); if (caption && caption !== ''){ $(this).parent(img).attr('alt', caption ); } }); and output i

proxy - What's the best way to be able to continously be able to receive WebRTC calls in browser? -

need able continuously receive calls when chrome webpage open. how do users inside strict enterprise network? websockets? (but there's proxy problems doesn't know wss:// is) http? (but have poll?) other? since included "vline" tag, i'll reply information on how our webrtc platform behave in enterprise network. vline.js use secure websocket default if browser supports , fall https long polling. described here , secure websocket may work depending on exact proxy configuration. feel free test out using gittogether or creating own vline service testing.

cocoa - _OBJC_CLASS referenced from objc-class-ref in AppDelegate.o -

i trying set toolbar opens various windows according toolbar item user selects. each window has own xib file , own subclass of nswindowcontroller. have not made changes window controllers' h , m files. switch in appdelegate implementation file reads selected toolbar item's tag , allocs appropriate window controller, passes initwithwindownibname message. problem of windows work , others produce "undefined symbol" error regarding window controller's class name. have double checked imports , looked typos. difference i've spotted in window controller implementation files work, line "@interface windowcontrollername ()" recognizes windowcontrollername class name , colors blue, in files not work, remains black. have no idea causes difference. i have solved problem , posting answer, should else. did not have target's "target membership" checkbox checked in window controllers' implementation files. rookie error, guess.

How to implement gyroscope sensor in android? -

i'm trying write simplest implementation of gyroscope (only log orientation of screen when it's changed). provide simple example of this? this i'm trying right now: public class lessonfiveglsurfaceview extends glsurfaceview implements sensoreventlistener { private lessonfiverenderer mrenderer; public lessonfiveglsurfaceview(context context) { super(context); system.out.println("test"); } @override public void onsensorchanged(sensorevent event) { //output roll, pitch , yawn values system.out.println("orientation x (roll) :"+ float.tostring(event.values[2]) +"\n"+ "orientation y (pitch) :"+ float.tostring(event.values[1]) +"\n"+ "orientation z (yaw) :"+ float.tostring(event.values[0])); } however i'm getting error: &qu

What is the significance of a library being written in pure C# -

i have come across many c# libraries , many libraries written in pure c#. why advantage on other libraries. the advantage libraries not tied architecture (x86/x86_64/...). plus because: the library can recompiled under x64/x86/any cpu if have source (and if not). recompiling native code more difficult. the library can run on non-x86 devices arm microsoft surface tablets. means, can have application portable between desktop/tablets easily. as pointed out, can run code under mono on linux or under other version of .net framework .net micro framework (with limitations, of course).

c# - Get list of background windows. -

what best method retrieve reference of each window located in background in reference window? want apply blur animation every window except 1 has istopmost set true. goal focus attention on tool window displays updates on long running process. have static class holds reference each open window prevent multiple instances running. use that; however, want make code reusable in other apps. you don't need own list, there application.current.windows .

android - Programmatically set custom drawables for radio buttons -

i'm developing basic paint application in android , can't seem programmatically set custom drawables radio buttons. these radio buttons consist of layerdrawable white colordrawable borders , inset yellow (or whatever color is) colordrawable center. put layerdrawable along 1 (it has black borders indicate selection) in statelistdrawable preserve radiobutton functionality. but when try setbuttondrawable(mydrawable) , radiobutton occupies small region though specify width , height 30dp . and when try setbuttondrawable(null) , setbackground(mydrawable) , radiobutton no longer has functionality. here code private void setupcolorbuttons() { int[] colors = {color.red, color.green, color.blue, color.yellow, color.cyan, color.magenta}; int childcount = mcolorgroup.getchildcount(); (int = 0; < childcount; i++) { radiobutton colorbutton = (radiobutton) mcolorgroup.getchildat(i); colorbutton.setbuttondrawable(createcol

cmd - Override Windows environment variable value? -

i want permanently change value of "username" variable of windows fix problem of windows 8 user profile folder name. i've tried set new environment variable using setx tool this: setx /m username "value" ...the new variable generated, can see in registry other variables, not overrided 'cause if try display value of username variable displays old value. is possibly want? cmd reads system environment variables when starts. re-read variables need restart cmd . as variable %username% : variable automatically populated username of logged-in user. you'd have change username change value of variable. don't tamper it.

Regex or a function in php to help edit smokeping config file -

i try make regex catch variables config /etc/smokeping/config.d/targets, , later modify in config of variables , autoreload process. example text: + internet menu = internet title = internet probe = fpinginternet ++ google menu = google title = google +++ google-com menu = google.com title = google.com host = google.com ++ yahoo menu = yahoo title = yahoo +++ yahoo-com menu = yahoo.com title = yahoo.com host = yahoo.com i try make tree in array php like: array ( name => internet [0] => array( menu => internet, title => internet, probe => fpinginternet, [0] => array( name => google, menu => google, title => google, [0] => array( name => google-com, menu => google.com, title => google.com, host => google.com ), ), ), [1] => array(

jQuery/CoffeeScript: hide div if all radios are false, but show if any is true -

i have div need shown if user answers yes (clicks "true" radio) of 4 questions. if answer false all, hide div . i've been having trouble if user changes his/her mind , goes , chooses other option on question. i've written coffeescript method handle it: $ -> numberfalse = 0 numbertrue = 0 hideifallno = -> $('.legal-information').find('input[type=radio]').each -> if $(this).is(':checked') , $(this).val() 'false' if numberfalse >= 4 return else numberfalse += 1 if numbertrue >= 1 numbertrue -= 1 else numbertrue = 0 else if $(this).is(':checked') , $(this).val() 'true' if numbertrue >= 4 return else numbertrue += 1 if numberfalse >= 1 numberfalse -= 1 else numberfalse = 0 if numberfalse 4 $('.legal-info-extra-info').slideup('fast') if numbertrue >= 1 $('.legal-info-extra-info').slidedown('fast&

Filter file list in python/ lowercase and uppercase extension files -

i filtering file list using line: mylist = filter(lambda x: x.endswith(('.doc','.txt','.dat')), os.listdir(path)) the line above filter lowercase extension files. therefore, there elegant way make filter uppercase extension files? you need add .lower() lambda function mylist = filter(lambda x: x.lower().endswith(('.doc','.txt','.dat')), os.listdir(path)) i'd prefer use os.path.splitext list comprehension from os.path import splitext my_list = [x x in os.listdir(path) if splitext(x)[1].lower() in {'.doc', '.txt', '.dat'}] still bit single line, perhaps from os.path import splitext def valid_extension(x, valid={'.doc', '.txt', '.dat'}): return splitext(x)[1].lower() in valid my_list = [x x in os.listdir(path) if valid_extension(x)]

screen - All possible ways to detect TV as client side browser for CSS purposes -

i have web application follows responsive web design techniques. i'd serve different (bigger) font size tv , different (smaller) screen when both have same resolution. why? because when user uses 32" monitor screen, sits closer user uses tv. the code: body {font-size:14px;} @media (min-width:1900px) {body {font-size:20px;}} @media tv , (min-width:1900px) {body {font-size:30px;}} should work (if understand how media queries work right). don't - tv displays text font size 20px (it's because opera browser in sony bravia tv doesn't support tv - how ironic...). so question is: other techniques of tv detection possible? user-agent , there no standardized schema when tv comes party.

Exclude div jQuery -

<li id="menu-item-43" class="menu-item menu-item-type-custom menu-item-object-custom"> <a href="#"> <cufon class="cufon cufon-canvas" alt="jeden" style="width: 33px; height: 12px;"> <div class="menu-button-desc" style="padding-left: 3.80049px;"></div> </a> </li> spec.find($(".sub-menu li:not(:contains('pic-sub'), :contains('title-sub'), div.menu-button-desc)")).clone().prependto("#sub-menu ul"); i need exclude div.menu-button-desc . else works fine. i'm doing wrong... when select #menu-item-43 element, has div.menu-button-desc child. want clone whole node, drill down element want gone, .remove() it, .end() cloned element without "problem child". you have funky things going on w/ combining .find , toplevel selector ($()), , think selector string not doing anything. don't want s

What mode does vim enter when completion menu is up? -

i changed arrow keys map no-op force myself use vim navigation properly. when using word completion in vim word-list of possible completions pops up. used navigate using arrow keys, have use same mapping completion initiation iterate through. when menu pops up, vim stay in insert mode, change different mode or enter modified insert mode (similar paste-toggle does) can alter j , k mappings move through list? if not there way of calling method on pop-up open , close? navigate completions via <c-p> , <c-n> . see :h ins-completion more information.

html - Moving inline event handlers to javascript sheet for chrome extension -

i creating chrome extension of tic tac toe game. however, html code has inline event handlers not allowed because of content security. need figure out how transfer these event handlers javascript page. this html page, inline event handlers in buttons , call function gamestart: <head> <meta http-equiv="content-type" content="text/html; charset=utf-8"> <link href="game.css" rel="stylesheet" type="text/css" /> <script type="text/javascript" src="singleplayer.js"></script> </head> <body> <center><u><h1>single player mode</h1></u> <table> <tr><td> <button style="background-color:lightblue ; color: black" id="0" onclick = "gamestart(0)"> </button></td> <td> <button style="background-color:lightblue ; color: black" id="1" oncl

html5 - Adding placholder attribute to Magento CMS page -

i having trouble add placeholder attribute input elements in cms page of magento. this: <input type="text" placeholder="hello" /> i proceed save cms page, however, seems me magento overrides placeholder attribute, preventing placeholders seen in html being displayed. is there way achieve this? this one's little tricky. if check cms_page database table, you'll find magento saving html tag placeholder attribute. also, if view page via frontend , not admin interface, you'll find magento renders placeholder attribute. the problem is, magento's tinymce editor configured strip out invalid input attributes, , list hasn't been updated reflect changes in html5. if you're using reasonably modern version of magento, can fix inserting following javascript admin page after tinymce javascript loaded, before magento runs inline wysiwygpage_content = new tinymcewysiwygsetup... javascript. warning: threw together, may

java - Object initialized in the main class and using the same object in a method/function for different purpose? -

i have class contains following coding import java.util.scanner; import java.io.*; public class someclass { public static void main(string[] args) { product[] p= new product[3]; p[0] = new product(); p[1] = new product(); p[2] = new product(); p[0].name="john"; // product class contains variable string name; // , method getname() returning name; p[1].name="tony"; p[2].name="abraham"; someprintmethod(); } public static void someprintmethod() { for(int =0;i<3;i++) { system.out.println(p[i].getname()); } } } so question can use object defined in main class in other method other purpose in same class or there method use object because trying do , giving me error , cannot figure out how it. you can make p static variable, declared outside of main : static product[] p = new product[3]; but

java - How to stop the audio when open new JFrame -

i doing security warning if user enter wrong password more 5 time, pop out frame asking user unlock , frame keep on looping warning sound. after user unlock it, jump login frame. problem after unlock it, system jump login frame sound still running. why? this button code jump login frame staff s = new staff(); string id = m_id.gettext(); string pass = m_pass.gettext(); string position = "manager"; try{ string sql = "select * staff position='"+position+"'"; pst=conn.preparestatement(sql); rs=pst.executequery(); while(rs.next()){ string add = rs.getstring("staff_id"); s.setstaff_id(add); string add2 = rs.getstring("password"); s.setpassword(add2); } if((s.getstaff_id().equals(id)) && (s.getpassword().equals(pass))){ warning(clip);

android - Storage Summary Interface on Gingerbread -

Image
i want make such interface storage summary section in gingerbread. it's seekbar or progress bar can not customize it, show amount of out of total amount. here's pic can tell me call such interface or how make that? thanks for ui, can use progressbars . should easy calculate values place in each of them, surely need following: total storage capacity it possible total storage capacity? size of directory how can size of folder on sd card in android?

javascript - DOM Exception 19 for PUT request -

i'm making put request upload object s3 bucket using xmlhttprequest in javascript. cors set properly. code i'm trying with. var bucketpath = 'http://<bucket-name>.s3.amazon.com/' var filename = <name> + ".json"; var uploadpath = bucketpath + filename.replace(/\s/g,"+"); var xmlhttp; if (window.xmlhttprequest) {// code ie7+, firefox, chrome, opera, safari xmlhttp=new xmlhttprequest(); } else {// code ie6, ie5 xmlhttp=new activexobject("microsoft.xmlhttp"); } xmlhttp.onreadystatechange=function() { if (xmlhttp.readystate==4 && xmlhttp.status==200) { showdata(); } else{ showerror(); } }; xmlhttp.open("put",uploadpath,false); xmlhttp.send(json.stringify(jsonobject), rep

Purpose of "match_parent" in android:layout_width/height for top view in Android -

a noobish question. i curious purpose of having "match_parent" in 2 xml attributes top level layout view linearlayout. believe "match_parent" indicates view wants big parent. in case of top level layout view (linearlayout) there no parent..? the view u see on screen attached to window upper layout property "match_parent" window . see window class and window manager

php - Validate Log in -

i have problem in phonegap application. seems if-else method not functioning here. this code: function onsuccess(position){ $("#login").click(function(evt){ var username = $("#username").val(); var password = $("#password").val(); var d = new date(); var date = d.getutcdate(); var hour = d.getutchours()+8; var minutes = d.getutcminutes(); var secs = d.getutcseconds(); var year = d.getutcfullyear(); var mon = d.getutcmonth() + 1; var day = d.getutcday(); var time = year + "-" + mon + "-" + date + " " + hour + ":" + minutes + ":" + secs; var senddata = {"username": username, "password" : password, "time" : time}; $.ajax({ type: "post", url: "http://192.168.254.107/webs/main/ajax/validatelogin.php", data: senddata, success: function(data) { $("#info").html(data); var returnmessage

twitter bootstrap - How to stretch .divider (for nav) 100% to width of container? -

Image
how can stretch black .divider entire width of container? setting width 100% not working of course inner container has margins set accordingly. how can set width outer container margins looks it's 100% stretched across nav container? fiddle: http://jsfiddle.net/w3dh3/ <div class="well sidebar-nav left"> <ul class="nav nav-list"> <li class="divider"></li> // <-- how stretch 100% outer container margins <li class="nav-header">sidebar</li> <li class="active"><a href="#">link</a></li> <li><a href="#">link</a></li> <li><a href="#">link</a></li> <li><a href="#">link</a></li> </ul> </div><!--/.well --> </div><!--

composite component - Why is my JSF FacletContext==null? -

my faceletcontext try faceletcontext faceletcontext = (faceletcontext) context.getattributes().get(faceletcontext.facelet_context_key); is null . going wrong here? actually try add composite component dynamically bean. update: to more clear. have following bean: @named @sessionscoped public class groupcomponenttreebuilder implements serializable { public uicomponent getgrouptree() { uicomponent parent1 = uicomponent.getcurrentcomponent(facescontext.getcurrentinstance()); return includecompositecomponent(parent1, "group", "elementgroup.xhtml", "mynewsuperid"); } public static uicomponent includecompositecomponent(uicomponent parent, string libraryname, string resourcename, string id) { facescontext context = faces.getcontext(); application application = context.getapplication(); faceletcontext faceletcontext = faces.getfaceletcontext(); resource resource = application.getresourcehandler().createresource(resourc

node.js - Is there a way to isolate native-object extensions in javascript? -

you can extend native objects in javascript. example, sugar.js extends array, string, , function among other things. native-object extensions can useful, inherently break encapsulation - ie if uses same extension name (overwriting extension) things break. it incredibly nice if extend objects particular scope. e.g. being able in node.js: // myextension1.js object.prototype.x = 5 exports.speak = function() { var 6 = ({}.x+1) console.log("6 equals: "+six) } // myextension2.js object.prototype.x = 20 exports.speak = function() { var twenty1 = ({}.x+1) console.log("21 equals: "+twenty1) } and have work right: // test.js var 1 = require('myextension1') var 2 = require('myextension2') one.speak(); // 6 equals: 6 two.speak(); // 21 equals: 21 of course in reality, print out "6 equals: 21" first one. is there way, via mechanism, possible? mechanisms i'm interesting in hearing include: pure javascript node.js c

javascript - Backbone.js Calculator App Architechture (Singleton Model) -

i'm looking guidance on architecture app i'm building in backbone. it's multi-page app calculates data based on initial data-set. initial data-set country specific , getting pulled in json file. when app fires up, data-set used defaults: in main backbone.model. these defaults have processed/calculated , set additional model attributes. these attribute represent app state. can overridden ui. recap, i'm using singleton backbone.model store initial data, i'm building rest of data on models initialize method. i recalculate data-set attributes on model.change event. fires models custom method updateattributes() recalculates data. seems me it's pretty inefficient because i'm calculating attributes, first in initialize method, , again in updateattributes method. after values processed data set complete , can applied app templates. tricky part of calculated data in set editable ui. once these default attributes edited ui don't want updateattributes m

Proguard for shrinking JAR not correctly picking up dependent classes -

i newbie using proguard (which seems immensely useful!). wish create minimal jar (without obfuscation whatsover) using starting point (say public interface) , hoping proguard pick dependent classes transitively. dependent class seems lacking private members, public getter/setters , annotations constructor , tostring method available. concretely, specialservice interface refers specialobject (and maybe many others). wondering if possible mention specialservice keep class , dependent (non-library)c lasses (with of attributes - no obfuscation or optimization) should pulled in output jar. <options> <option>-keepattributes</option> <option>-keep @javax.ws.rs.path public class com.kilo.specialservice { private public protected *;}</option> </options> i have tried configurations, doesn't seem work. specialservice.java: @get @path("somecomplexobjectswithintinputs") list<specialobject> getsomecomplexobjectswithintinputs

asp.net mvc 4 - Bundling multiple versions of Jquery -

i have asp mvc application using jquery nuget. recently upgraded latest version on nuget 2.0.3. version doesn't support older browsers (specifically ie8). there trick around using conditional comments . my question best method make work bundling? bundles.add(new scriptbundle("~/bundles/jquery").include( "~/scripts/jquery-{version}.js")); i have added 2 bundles 1 bundles.add(new scriptbundle("~/bundles/jqueryold").include( "~/scripts/jquery-1.9*")); bundles.add(new scriptbundle("~/bundles/jquery").include( "~/scripts/jquery-2*")); then on layout @scripts.render("~/bundles/jqueryold") <![endif]--> <!--[if gte ie 9]><!--> @scripts.render("~/bundles/jquery") <!--<![endif]--> or there better way? suggestions appreciated. i think partly answered question can have bundles.add(new scriptbund

PHP - exec awk or fread faster for reading a column on very large file -

i have file containing plot data. each line has 4 coordinates in total data file can exceed 1 gb. let's say, third column in data file, method should consider practice , faster? using execute: exec("awk '{ print $3 }' data", $output); using php script: $data = file("data"); $points = array(); foreach($data $line) $points[] = $line[2]; moreover, since server not allow read large file, have use fread read file in several parts. fread not smart enough , work must done combine last line in each part. suggestion or better method read column on file in php? here /file 3.1 gb big file: root# time awk '{ print $3 }' /file >/dev/null real 1m42.430s user 1m0.241s sys 0m2.198s okay. ±1.7 minutes awk. let's test php (without field splitting, third char): root# time php -r '$fp = fopen("/file", "r"); while (($buf = fgets($fp)) !== false) echo $buf[2]; fclose($fp);' >/dev/null rea

php - Prepending a string to a Smarty variable -

i'm looking way prepend string smarty variable. have dynamic form having element-names input-1 (where 1 id of setting/field). i've tried {capture}{/capture} seems work first time (as fields displayed loop). is there opposite function |cat:'text' smarty, or have to: create own modifier rename inputs i'm not sure understand you're trying achieve, there alternative syntax cat , using backticks (and more elegant , clear imho): using cat: {"my string"|cat:$my_var|cat:"other string"|cat:$other_var} the same, using bacticks: {"my string `$my_var` other string `$other_var`"} using backticks, can place variables anywhere inside string: {"input-`$id`"}

javascript - Applying padding on td element throwing exception -

i have declared variable padding , in alert gives value without problems. however, when use: document.getelementsbytagname("td").style.height = padding; i error uncaught typeerror: cannot set property 'height' of undefined index.html:46 (anonymous function) ! and while padding correct value!!! what now, wrong!? note: index.html:46 line shown above. document.getelementsbytagname("td") returns nodelist , , array , can do: document.getelementsbytagname("td")[0].style.height = padding; or in loop: var tds = document.getelementsbytagname("td"); for(var i=0 , len = tds.length; i<len; i++){ tds[i].style.height = padding; }

performance - How many concurrent connections can MarkLogic server process? -

is there upper limit on how many concurrent connections marklogic can process? example, asp.net restricted processing 10 requests concurrently, regardless of infrastructure , hardware. there similar restriction in marklogic server? if not, there benchmarks give indication how many connections typical instance can handle? given large enough budget there no practical limit on number of concurrent connections. the basic limit application server thread count, although excess requests pile in backlog queue. according groups.xsd each application server limited @ 256 threads. backlog seems have no maximum, operating systems silently limit between 256-4096. depending on whether or not count backlog, single app server on single host have 256-4352 concurrent connections. after can use multiple app servers, , add hosts cluster. use load balancer if necessary. operating systems impose limit of around 32,000 - 64,000 open sockets per host, there no hard limit on number of hosts or

Binding text boxes and string dynamically in asp.net using placeholder -

i have following code in im using place holder hold dynamically created text boxes. pre init , loadviewstate overridden facilitate changes, method nextid incriment id 1 , render back. create method create new instance of textbox , add list. my question can replace "#" in string str textbox , rest of string should appended , on final ui user should see textboxes instead of "#" , other string values is. im sorry if question seems irrelevant, im newbie......any appreciated, thanks public partial class _default : system.web.ui.page { public void create() { textbox txt = new textbox(); txt.id = "txtfillup" + nextid.tostring(); dynamiccontrol.controls.add(txt); //dynamiccontrol.controls.add(new literalcontrol("<br>")); controllist.add(txt.id); } public list<string> controllist { { if (viewstate["controls"] == null) { viewstate["controls&quo

regex - How to use str.replace() with a dictionary of replacements? Python -

given dictionary of replacements, key = replaced , value = replacements , e.g.: replacements = {u'\u2014':'-', u'\u2019':"'", u'\u2018':"'", u'\u201d':'"', u'\u201c':'"'} how perform replace without iterating through replacements.keys() ? how same operation possible regex, re.sub() ? i have been doing way: for r in replacements: sentence = sentence.replace(r,replacements[r]) you looking unicode.translate() instead. takes mapping of unicode ordinals (integer numbers) , values should ordinals too, or unicode strings, or none signal delete character: replacements = {ord(k): ord(v) k, v in replacements.iteritems()} sentence = sentence.translate(replacements) demo: >>> replacements = {ord(k): ord(v) k, v in replacements.iteritems()} >>> replacements {8216: 39, 8217: 39, 8212: 45, 8221: 34, 8220: 34} >>> u'\u2019hello world!

Code sign error in XCode - is it related to Apple developer site down -

today got code signing error when building app in xcode. when visited apple developer portal, redirected address: http://devimages.apple.com/maintenance/ . kindly confirm me need wait until apple restore able build app in xcode. if have workaround this, great if can share me. thanks. if need download/refresh code signing identity first not able till maintenance over, otherwise there shouldn't problem besides getting app store (what isn't possible cause of maintenance)

android - Illegal strings logcat at eclipse -

Image
i have several devices. first (phone) worked correct. see in eclipse tab logcat normal strings. on second device (cube u30gt2), don't know why, see logcat string divided on two: date/tag , messages. how can fix this? this no error. you're app eating recources , gc worked. it's normally. that's happens on android 3+.

webrtc - chrome RTCPeerConnection event not fire after connected -

i have several listener peerconnection object, onconnection fired in firefox , works good, not fired in chrome, know why? pc1.onconnection = handleonconnection; pc1.oniceconnectionstatechange = handlestate; pc1.onreadystatechange = handlestate; so pc2. thanks help! rosone onconnection not part of interface in latest standard, that's why it's not implemented in chrome: http://dev.w3.org/2011/webrtc/editor/webrtc.html#interface-definition . the code in firefox lists onconnection mozilla extension: https://github.com/mozilla/mozilla-central/blob/master/dom/webidl/rtcpeerconnection.webidl#l98 . for more details, may want ask mozilla team on dev-media list.

javascript - Submit a form without using submit button -

i using form submit data records database. in form using 2 select tag options. so after selecting options form should submit without using submit button . waiting response submit form after selecting inputs without using submit button(or button) should submit automatically. make function check want has been set, , if has, submit form: function submitifformcomplete() { // check select has selected if (document.getelementbyid('selectone').selectedindex > 0) { document.getelementbyid('formid').submit(); } } then on select, bind onchange event run function. here working example: http://jsfiddle.net/je6am/ select car make: <select id='sel1' name='selectcar' onchange="checkandsubmit()"> <option value="0">select...</option> <option value="volvo">volvo</option> <option value="saab">saab</option> <option value="mercedes&quo

java - Importing package from target in OSGi bundle -

i'm having problems importing package in osgi bundle. the package called org.semanticweb.hermit.datatypes.xmlliteral included in jar file org.semanticweb.hermit.jar . jar included in target definition , selected in run configuration. target recognizes osgi bundle, shouldn't problem. when try import package in own bundle error saying no bundle exports package. knows problem? checking standard download "org.semanticweb.hermit.jar", has no export-package. therefore none of packages within jar usable other osgi components. update: the pax-url wrap plugin can wrap non-osgi jar osgi bundle , add arbitrary manifest lines. https://ops4j1.jira.com/wiki/display/paxurl/wrap+protocol there may reason don't include export-package. may want ask creator(s) directly make sure aren't looking trouble. you can update jar have, use when deploying. there ton of options actually. you can see how project it: http://iks-project.googlecode.com/svn-history

c# asp.net mvc static functions or instantiate -

i built web site , besides repositories functions part of instance, declared other functions in site static. guess knew other place used work in. try make site production , noticed site's iis process's ram accumulating , site stuck time time on same functions quick. static functions can cause of that? downsides of method? ideas improvements appreciated...

watir - Need to access elements of a admin server browser -

i new watir , below query: through browser, have connected linux server, , able automate process. now after logging in, browser opens admin page (webtop), need access elements of admin page, cannot. also, simple browser.text.include? "suplaonk" not giving output, same browser.title . not entirely sure webtop per link webtop pages defined in psml (portal standard markup language) i.e. not html. so, dont think watir best choice trying do. if think page html can post html using firebug? http://publib.boulder.ibm.com/infocenter/tivihelp/v8r1/index.jsp?topic=%2fcom.ibm.netcool_wt.doc%2fag%2fxf11248784180104.html