Posts

Showing posts from June, 2015

sql - indexing multi-column index with Rails / Postgresql -

i have doubt correct indexing. use rails 3.2.13, using posgresql behind. btw, more relational databases/indexing question... i have table: # table name: exams # # id :integer not null, primary key # cognomenome :string(255) # matricola :string(255) # corsolaurea :string(255) # annoaccademico :string(255) # blablabla # # indexes # # index_exams_on_annoaccademico (annoaccademico) # index_exams_on_cognomenome (cognomenome) # index_exams_on_corsolaurea (corsolaurea) # index_exams_on_matricola (matricola) i'd query thousands record table (the nymber of records increase every year linearly, 500 items evey years, i.e. 5000-6000 in ten years); i have make these kind of queries: select "exams".* "exams" (upper(cognomenome) '%giorgio%') order annoaccademico desc, corsolaurea, cognomenome limit 50 offset 0 or that: select "exams".* "exams" (matricola '%8327483274%&

oracle - SQL how to check whether a variable contrains non-integer character and remov the non-integer character -

i trying check whether variable 'prodno' contains non-integer character. if does, remove non-integer character. -- expected output: prodno a18 prodno k67 drop table ass3_product cascade constraints; create table ass3_product ( prodno varchar2(30) primary key, prodname varchar2(30), purchasecost number(6,2) ); insert ass3_product values ('23','prod one', 10); insert ass3_product values ('54','prod two', 50); insert ass3_product values ('a18','prod three', 35); insert ass3_product values ('9','prod four', 4); insert ass3_product values ('k67','prod five', 15); select prodno ass3_product prodno '%[abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz]%'; like not support ranges seem think - supports wildcard search using % , _ . need use regular expressions this to remove non-integer value use regexp_replace : select regexp_replace(prodno, '\d', '') ass3_

ruby on rails - gem install bouncy-castle-java for full support -

i getting warning message on deployment server, when start server or running console. openssl asn1/pkey/x509/netscape/pkcs7 implementation unavailable gem install bouncy-castle-java full support. also, when try generate key following command. openssl::pkey::rsa.new(public_key) i following exception openssl::pkey::rsaerror: neither pub key nor priv key: org/jruby/ext/openssl/pkeyrsa.java:278:in `initialize' i bit confused message. have bouncy-castle-java installed on machine. still confused message. i not sure abt issue. can explain issue, or give me directions. i have fixed issue on end installing jruby openssl 0.8.8 on server. as far remember there conflict jruby , openssl gem used in gem list(so had update gem)

c++ - Function signature as a function template parameter -

i'd use function signature template argument. works great classes, when try same trick function templates, msvc throws error: error c2768: 'func' : illegal use of explicit template arguments here's code: template <typename signature> void func(); template <typename r, typename a1> void func<r(a1)>(); what should make work? you cannot partially specialize function template, not supported language. can create partially specialized class template static member function, , possibly trampoline function instantiate class template , invoke static function. something this: namespace detail { template<typename signature> struct helper; template<typename r, typename a1> struct helper<r(a1)> { static void call() { // stuff r , a1... } }; } template<typename signature> void func() { detail::helper<signature>::call(); }

css - What is so great about having 5 selectors to format a specific html tag? -

why people make complicated , not create id below selector parade body > header > h1, span.title, .header-title { /* set background-image here */ } just like #myheadertitle { /* set background-image here */ } what great having 5 selectors format specific html tag? why not use id directly? i can agree times nested selectors may overused, if assign id elements want select not wery flexible. my rule of tumb: if want apply style 1 spesific element, , not elements use uniform selector. ok use id if want apply rule multiple elements similar nested selector "fingerprint" select nested selector use yous enogh nested selectors shure want hit undisired elements. eks: logo image on top of page might use id. anchors inside menu this: <div class="menu"> <ul> <li> <a href="http://example.com">link</a> </li> </ul> </div> i use ".menu ul li a"

Android page curl with images streaming from web? -

so, using https://github.com/harism/android_page_curl , project achieve curl functionality create book. want achieve same while streaming images web directly, in asynchronous manner. but require opengl , progress bar same. don't have knowledge in opengl , how can go tweaking code , achieve functionality want. also , have @ question more clear view of want achieve... pagecurl(magazine) image web package fi.harism.curl; public class curlactivity extends activity { private curlview mcurlview; button btn; private aquery aq; drawable d =null; textview mtext; list<string> data; mediaplayer mplayer; @override public void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.main); int index = 0; if (getlastnonconfigurationinstance() != null) { index = (integer) getlastnonconfigurationinstance(); } mcurlview = (curlview) fi

jquery - Mega dropdown menu background hover issue -

i using css3 mega drop down menu on site create menu bar. have used li id of nodrop stop "home" link on page creating dropdown menu background: <ul class="menu"><!-- begin menu --> <li id="nodrop"><a href="http://www.eco-fireplaces.co.uk">home</a></li> <li><a href="" class="drop">fireplaces</a><!-- begin 1 column item --> <div class="dropdown_1column"><!-- begin 1 column container --> <div class="col_1 firstcolumn"> <ul class="levels"> <li><a href="#">freelanceswitch</a></li> <li><a href="#" class="parent">creattica</a> <ul> css nodrop "home" link: .menu li#nodrop { z-index:2; float:left; te

java - How make method in GUI running in background -

i want create lan chat app udp method transfer information. here, have problem app.i have 2 essential guis. general gui , private chat gui. in general gui there jlist displays online users (users playing app). , in private chat gui, have jtext displays chat history. my problem is, how make method runs continuously, can update jlist inform list of online users , jtext inform every chat came , sent back. have @ jgroups, want, , think have sample chat application. http://www.jgroups.org/

c# - TextBox addHandler for onFocus programmatically wp7 -

i trying add event handler textboxes in grid i'v written code below---> // code foreach (var child in (o grid).children) { if (child.gettype() == typeof(textbox)) { child.addhandler(ongotfocus, new routedeventhandler(textbox_gotfocus), true); //<---error } } in above code want add event handler onfocus child textboxes . but getting error here invalid arguments , can 1 fix this? solved problem---> txtbox.gotfocus += (sender, eargs) => { if (txtbox.text == startingtext[index]) txtbox.text = ""; }; txtbox.lostfocus += (sender, eargs) => { if (txtbox.text == "") txtbox.text = startingtext[index]; };

javascript - Cross browser issue with TinyMCE iframe resize -

after found solution resize tinymce instances ( readonly ). faced problem can't solve hours... when init tinymce ok, in internet explorer , versions of chrome doesn't work tinymce.init({ mode: "textareas", theme: "advanced", readonly: true, theme_advanced_path: false, theme_advanced_resize_horizontal: false, autoresize: true, width: "870", setup: function(ed) { ed.onloadcontent.add(function(ed, o) { var iframeid = "#" + ($(this).attr('id')) + "_ifr"; $(iframeid).height($(iframeid).contents().find("html").height()); //iframeid.height = iframeid.contentwindow.document.body.scrollheight + "px"; }); } }); also java script attempt bellow jquery not works. more happy if got solution this! in advance! and here configuration worked me! tinym

c# - Processing .txt files into arrays, and manipulating the array data -

i figure i'd post whole program i'm working with. i've pretty finished main method. need create 3 classes. fileroutines, student, , students. fileroutine main problem i'm running into. has 2 public classes. loadstudents, , loadassignments. load students supposed read of lines in student input file, create student object each line, , returns students object contains array of student objects. load assignments supposed read of lines in assignment input file , associate each assignment corresponding student based on student number. 2 text files this: students.txt 122338 weltzer teresa 123123 wang choo 123131 adams james 123132 binkley joshua 123139 howard tyler 123160 king alma assignments.txt 122338 hw1 93 0.05 123123 hw1 100 0.05 123131 hw1 90 0.05 123132 hw1 85 0.05 123139 hw1 89 0.05 123160 hw1 90 0.05 122338 quiz1 94 0.08 123123 quiz1 83 0.08 123131 quiz1 93 0.08 123132 quiz1 72 0.08 123139 quiz1 0 0.08 123

Convert string that contains HTML to sentences and also keep separator using Javascript -

this string. contains html: first sentence. here <a href="http://google.com">google</a> link in second sentence! third sentence might contain image <img src="http://link.to.image.com/hello.png" /> , ends !? last sentence looks <b>this</b>?? i want split string sentences (array), keep html separator. this: [0] = first sentence. [1] = here <a href="http://google.com">google</a> link in second sentence! [2] = third sentence might contain image <img src="http://link.to.image.com/hello.png" /> , ends !? [3] = last sentence looks <b>this</b>?? can suggest me way please? may using regex , match? this close i’m after, not html bits: javascript split regular expression keep delimiter the easy part parsing; can wrapping element around string. splitting sentences more intricate; first stab @ it: var s = 'first sentence. here <a href="http://google.com">g

Space character inside an argument (emacs lisp) -

in windows, set variable inferior-lisp-program (shell-quote-argument "d:/program files/ccl/wx86cl.exe") . but when run inferior lisp command run-lisp , emacs responds: searching program: no such file or directory, "d:/program it seemed emacs treats "d:/program files/ccl/wx86cl.exe" 2 arguments "d:/program , files/ccl/wx86cl.exe" separated space character. how can make emacs treat "d:/program files/ccl/wx86cl.exe" whole? try using old "progra~1" compatibility name "program files" . so, (setq inferior-lisp-program "d:/progra~1/ccl/wx86cl.exe")

Set boost on fields using Lucene -

i implementing word search using lucene. want ad 2 fields each document: title field, contains first 100 characters document , contents field, contains rest of characters document. contenthandler handler = new bodycontenthandler(); try { parser.parse(is, handler, metadata); } { is.close(); } document doc = new document(); field titlefield = new field("title", handler.tostring().substring(0, 100), field.store.yes, field.index.analyzed_no_norms); field contentsfield = new field("contents", handler.tostring().substring(101), field.store.yes, field.index.analyzed_no_norms); i want add boosting each field: want title count 70% , content count 30%. i doing this: titlefield.setboost(1.70f); doc.add(titlefield); doc.add(contentsfield); doc.ad

dataGridView not updating c#? -

i have filled datagridview using code below this.empinfotableadapter1.fill(this.empdata.empinfo); but when updating table gridview updating orginal database. not showing update in form. i have searched google , found similar question. of them custom data binding. not using this.empinfotableadapter1.fill(this.empdata.empinfo); so, posted question. if asp.net application need call databind() like: gridview1.databind(); if winform application need assign datasoure again like: gridview1.datasource = this.empdata.empinfo;

xamarin android : Executing code before first intent -

in xamarin.android app, need display splash screen image comes http remote server. so, need execute code (webclient...) before mainlauncher activity displayed (my mainlauncher activity imageview , progressbar). if add webclient code in mainlauncher activity's oncreate, during download black screen displayed. execute webclient code before mainlauncher displayed. or kind of trick ok! hope clear... you can create class extends android.app.application , add code oncreate method. called before mainlauncher activity on application startup. pointed out here , code invoked when app first loaded. for example, add application.cs (you can use xamarin studio's new file template android activity) top level of project contents follows: using system; using system.collections.generic; using system.linq; using system.text; using android.app; using android.content; using android.os; using android.runtime; using android.views; using android.widget; using myapp.core;

algorithm - What are some ways to combine a number of (potentially incompatible) sorted sub-sets of a total set into a (partial) ordering of the total set? -

i have sorting problem i'm pretty sure doesn't have canonical "answer" - has number of different approaches, each pros/cons. i'm interested in hearing different approaches. suppose bunch of people {p_i | i=1,...,m} ranking favorite ice cream flavors. in total there n different flavors, single person p_i ranks n_i << n flavors or familiar with. i'm interested in combining these sub-rankings plausible overall ranking of n flavors. for concrete situation: m , n both 1000 (by coincidence), , each n_i 20 . can assume there's enough overlap in flavors people rank such no flavor "isolated". again, i'm interested in hearing different ways approach this, if there isn't single clear answer. thanks! one way approach problem construct directed cyclic graph representing of constraints on ordering of elements. nodes in graph represent different elements compared , have edge first node second node if had ranked first e

php - Edit row of table with ajax (no jquery) -

i want change row numbers 1, 2 , 3 number 4, 5 , 6 ajax (no jquery) when push button. how can it? because code can't. this main .php: <!doctype html> <html> <head> <title>hola mundo con ajax</title> <script> function loadxmldoc() { 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) { document.getelementbyid("mydiv").innerhtml=xmlhttp.responsetext;

How to call a javascript function after the page loads with a chrome extension? -

there's function on page want call after loads. not own page, can't insert html it. can please provide specific examples how chrome extension or greasemonkey? (function submitaction() ). both chrome extensions , greasemonkey offer ways specify when script inject if executed. in chrome extension, you set in manifest : "content_scripts": [ { "run_at" : "document_idle", in greasemonkey compatible userscripts, set in metadata // @run-at document-end in both cases, have add script if want ensure resources loaded when function executed : document.addeventlistener('load', submitaction);

iphone - UIImage not stretching on iOS 5 -

i have uiimage 1024 x 1 pixels. image has stretch fill uiimageview 1024 x 50 pixels. this image loaded on nsarray , this: uiimage *image = nil; if ([uiimage respondstoselector:@selector(resizableimagewithcapinsets:resizingmode:)]) { // ios >= 6.0 image = [[myimages objectatindex:0] resizableimagewithcapinsets:uiedgeinsetszero resizingmode:uiimageresizingmodestretch]; } else { image = [[myimages objectatindex:0] stretchableimagewithleftcapwidth:0.0f topcapheight:0.0f]; } this works great on ios 6 not on ios 5. why? i mean, image stretches beautifully , fills uiimageview on ios 6 not on 5. the uiimageview set these parameters: uiimageview myimageview = [[uiimageview alloc] initwithframe:cgrectmake(0,0,1024,50)]; [myimageview setcontentmode:uiviewcontentmodescaletofill | uiviewcontentmoderedraw]; [myimageview setimage:image]; call resizableimagewithcapinsets: edge insets value instead of uiedgeinsetszero . so, work out width , hei

How to make this function run more than once JavaScript/jQuery -

i need code run more once. runs when click button append images, , click button remove them. third click doesn't append images again <button class="" onclick="showimages(this,'100000,jpg','1111111.jpg','5');"></button> <div id="5" class=""> ... //when run function appends <img> tag here </div> function showimages(button, image1, image2, id) { //user clicks button "show" if (image2 == "") { //if there 1 image $('#show' + id + '').append('<img class=\"one\" src=\"images/' + image1 + '\" />'); //creates div 1 image button.onclick = function () { //clicks second time $('#show' + id + '').empty(); //removes div image }; } else { //if there 2 images $('#show' + id + '').append('<img class=\"two\" src=\"image

linux - C — using chdir() function -

i'm trying use chdir() function can't work out. i'm reading user , find out if using "cd". error. doing wrong? code: int * status=0; char * buf = 0; char arguments[2048]; buf = getcwd(buf,path_max); printf("%s >",buf); fgets(arguments,2048,stdin); if( strncmp(arguments,"quit",4)==0 ){ printf("exit...\n"); break; } else if(strncmp(arguments,"cd",2)==0 ){ int ret; printf("\ngot = %s\n",(arguments+2)); ret = chdir ((arguments+2)); if(ret!=0){ perror("error:"); } } if line being entered like: cd xyzzy then directory starts @ offset 3, not 2. in addition, fgets gives line newline character @ end you'll want remove well, such as: if (strlen (line) > 0) if (line[strlen (line) - 1] == '\n') line[strlen (line) - 1] = '\0'; you should tokenising i

java - Download a generated pdf from client -

i'm new in stackoverflow first post. please excuse poor english... have spent hours on related topics no anwser met needs. i'm working on address book , want users able download pdf contacts list whenever want. seems go in fact client never download pdf file, though can see in request using chrome developer tool. here code: public void dopost( httpservletrequest request, httpservletresponse response ) throws ioexception, servletexception { try { document document = new document(); pdfwriter.getinstance( document, response.getoutputstream() ); document.open(); document.add( new paragraph( "you've selected " + request.getparameter("number") + " contacts." ) ); response.setcontenttype("application/pdf"); response.setheader( "content-disposition", "attachment; filename=\"contacts.pdf\"" ); document.close(); } catch( documentexception

java - Running Redmon with a Service -

i trying use redmon 1.7 on windows xp sp2 desktop machine. process data provided redmon myprogram.exe , write out stdout redmon sends printer port. but myprogram.exe(written in java) taking 5 seconds execute(as being run on pentium 4 processor). so, trying optimize application , 1 thing planning try is, running myprogram.exe service, oppose program. save me time of launching program , reading data in memory persistence storage(hard disk) every time issue print command. so had few questions , hoping if can me them:- 1) can run application windows service(myservice.exe) instead of normal program i.e. redmon pass printer data stdin of myservice.exe , read data stdout ? if not, there way can this, can avoid having launch program again , again. 2) redmon run service or launched every time when print command sent. thanks! manas

c++ - Replicating the CMOS contents from one PC to many others -

we have 100 pcs of same brand , model manufactured in 2010. need change in these pcs, periodically , manually, system , user passwords through bios , automate procedure through software , had following idea: the motherboard manufacturer sent me program read , write cmos. starts setting these passwords on single pc, saving content file , after program, write de cmos others machines. detail: program used boot disk dos. as carry procedure through central server, copying file new cmos data specific folder existent on machines. in each pc there process running on windows xp sp3 received file, make reading contents, writing new passwords in cmos, deletes file folder , restarts yourself. theory should work, not, inclusive on same machine created file. happens every time update cmos, changed settings retained, passwords come clean, i.e. without protection access bios. now i'm basing work on 1 program called cmospwd can found on site www.cgsecurity.org, no options works on motherb

singularitygs - Still confused with nested grids -

i've found time test singularity, , im problem had before cant find obvious solution. my issue nested grids. let's have simple 12 column grid $grids: add-grid(12 @ $break2); and layout uses main content area extends 9 of 12 columns: @include breakpoint($break2) { @include grid-span(9, 3); border: 1px solid red; } the, inside content area, need create section divided in 3 columns, means each article inside span 3 columns of parent container (which 9 of 9 columns). i've tried following code, cant work. .highlights{ overflow: hidden; border: 1px solid black; article{ @include float-span(3); &:nth-child(3n){ @include float-span(1, 'last'); } } } my goal have simple declaration, have generic article declaration every article, passing rule last article in each row i've done above. maybe confusion because im used current grid system im using, can this. what's best , pratical wa

php - Mysql multiple SUM in one query - novice -

i counting clicks per category of ads. curently passing category function, have 10 cats, calling function 10 times number of clicks each category. trying figure out possible in 1 query. started mysql code: select sum(clicks) 'clicks' wp_cb_ads_manager category = '.$cat.' and gives me array ( [0] => stdclass object ( [clicks] => 11 ) ) is possible on 1 query, retrieve sum per each category in array. here screen of how 2 tables looks like: http://awesomescreenshot.com/00018kly6d http://awesomescreenshot.com/06418kltcc in first keep list of categories, , in second keep ads 1 field used check in category ad. if i'm reading screenshots correctly, display sum grouped category; select category, sum(clicks) clicks wp_cb_ads_manager group category

javascript - Why doesn't this code result in recursion? -

given code: function foo() { if (!foo) { //blah blah blah code here foo = true; } } what do? why not creating recursive call? this might create recursion : function foo() { if (!foo()) // <=== notice () { //blah blah blah code here foo = true; } } but there, without parenthesis, foo isn't executed. tests checks variable foo doesn't evaluate true, , replaces boolean true . it's weird code not recursion. note we're not sure, inside function, foo function, code : function foo() { if (!foo) { //blah blah blah code here foo = true; } } var f = foo; foo = 0; f(); // result in foo being true

android - onItemClickListener and view not clickable -

<?xml version="1.0" encoding="utf-8"?> <linearlayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_height="wrap_content" android:orientation="horizontal" android:layout_width="fill_parent" android:clickable="false" android:focusable="false"> <linearlayout android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginleft="10dp" android:layout_margintop="5dp" android:clickable="false" android:focusable="false" android:orientation="vertical" > <textview android:id="@+id/mxname" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_weight="1" android:clickable="false" android:focusable="false" android:gravity="left" android:text="slashdot"

Error while creating Maven Project in eclipse juno -

Image
i trying create maven project using eclipse juno , getting errors in below images. i have added below maven plugins eclipse: m2e-wro4j maven integration eclipse maven integration eclipse wtp (incubation) i have selected webapp-j2ee14 archetype. note: pc using stand alone.

ruby on rails - How to eager load with a condition -

i have classic post has_many relationship on comments. want fetch of approved posts related comments have been approved. have approved scope in place each not sure how enable on comments. this have far returns comments approved postings. best way without having specify condition on has_many limit use of association other queries. post.approved.includes(:comments) your example used in documentation . should use association: class post < activerecord::base has_many :approved_comments, :class_name => 'comment', :conditions => ['approved = ?', true] end post.includes(:approved_comments)

grand central dispatch - GCD objects as Objective-C objects -

grand central dispatch objects said behave objective-c objects when compiled objective-c compiler. that's little unclear me. objective-c objects are, in fact, structures have, @ least, 1 field: pointer (the isa pointer) object's class structure. other fields, if any, correspond object's ivars. so, can gcd objects casted structures first field pointer objective-c class structure? since dispatch objects participate in arc, compiler do: send retain , release messages objects (like objc_msgsend(obj, @selector(retain)) , example) or generate dispatch_object_retain , dispatch_object_release calls? mean, gcd objects respond objc messages in [obj mesg] fashion? gcd objects actual objects, , compiler doesn't treat them specially. can add them cocoa collections, po them in debugger, etc... however, runtime bit of special handling them. isa pointer points dispatch vtable rather regular objc class.

ios - How to create UIScrollView with different page sizes (page snapping, bounce) -

i'm trying create custom vertical uiscrollview handle multiple pages different page heights. assumptions: page height equal or greater screen height if page taller screen height, scrolls usual uiscrollview – bouncing on top , bottom if user ends scrolling , "page break" in middle of screen if there no velocity - page snaps closest if there velocity - page changes 1 in direction of swipe i've tried many approaches achieve this, i've stumbled upon many uiscrollview quirks, make hard. problems: uipangesturerecognizer has unreliable method getting velocity (velocityinview:) scrollviewwillenddragging:withvelocity:targetcontentoffset: method gives me headache, because arbitrarily can destroy attempts animate setting content offset i don't know how achieve bounce in 1 of middle pages, i'm afraid have rewrite whole scrolling handling when try override setting content offset when uiscrollview decelerating, my content offset set decelerati

symfony - Understanding PHP caching - what happens to JavaScript? - using Symfony2 -

i'm trying understand php caching. i'm using symfony 2 , trying together. image gateway cache or reverse proxy cache caches full page. how javascript affected this? so imagine had page changed (maybe once week) - cache week. imagine had javascript function did on page, collapsible script. imagine default html shows panels open, , js remembers value in local storage , after page load closes panels need (remembering state). how affect caching? so me best way html cached , js gets executed afterward anyway (and no doubt js files cached). or sort of take screenshot , if page cached half collapsible panels open , half closed (until cache cleared). i'm trying work out if esi better, or how should create able utilise caching still keep dynamic features. best way cache html , allow js, css , else run again cached js/css file, whatever is. any caching how data gets server client (e.g. web browser); has nothing how data interpreted client. (think of slow php scri

android - NullPointerException when using LocalBroadcastManager -

i'm trying use localbroadcastmanager custom intents. seems it's picky intents , if send intent way: in myintents.java declare public static final string location_update = "com.example.myapp.location_update"; later on in broadcast sender do: intent intent = new intent(myintents.location_update); localbroadcastmanager.sendbroadcast(intent); then i'm getting exception: 05-05 02:23:29.914: e/androidruntime(6952): fatal exception: main 05-05 02:23:29.914: e/androidruntime(6952): java.lang.nullpointerexception 05-05 02:23:29.914: e/androidruntime(6952): @ android.support.v4.content.localbroadcastmanager.executependingbroadcasts(localbroadcastmanager.java:297) 05-05 02:23:29.914: e/androidruntime(6952): @ android.support.v4.content.localbroadcastmanager.access$000(localbroadcastmanager.java:46) 05-05 02:23:29.914: e/androidruntime(6952): @ android.support.v4.content.localbroadcastmanager$1.handlemessage(localbroadcastmanager.java:116) 05-05 02:23:29

java - LibGDX - Does modifying a Group affects children? -

i wonder if there way affect actors children when parent group modified ? attached him. modifying mean doing conventional actions translation, rotation, scale ... i know possible parent alpha affect children's alpha via draw() method, other attributes ? for example if add translationaction group want affect children. so did miss in scene2d api or have code own (not hard, want avoid if possible) ? if it's not possible actual api purpose of using group ? the answer question yes , no. because scene2d api designed around using spritebatch sets sorts of transformation information between parent , children actors. if using spritebatch (i.e. drawing textures, , such it) yes actions applied parent affect children. there couple of exceptions actors if remember correctly think has things color, etc. if not using spritebatch (i.e. drawing geometry directly opengl, or custom drawing actions (such meshes) outside of offered scene2d api) no actions not affe

html - Apply CSS to a singly word -

is possible apply css in such way detect whenever there word in element , mark word in way? know can add <span style="...">word</span> or <span class="...">word</span> inline html, won't automatically detect word. there way entirely in css? appreciated. theres no way in css. replace instances of word wrapped version , apply style per example http://jsfiddle.net/w9vbp/ : js var word = 'hello'; var replacement = '<span class="theword">' + word + '</span>'; var re = new regexp(word, 'ig'); document.body.innerhtml = document.body.innerhtml.replace(re, replacement); css .theword { color:red; }

html5 - Android/iOS/Win: force browser to save HTML/JS/CSS indefinitely -

we're going create data-driven mobile html5 app. thinking can access using default browser on each platform. read caching behavior of browsers on latest versions of ios , android, wasn't able find information possibility of telling browser, using sort of headers or whatever, store particular resource, html or js or css or image, indefinitely in cache until date, ex. possible? the idea here users open application regularly not often. browsing fill cache other data; need "pin" or "anchor" our app stay there despite cache being filled, "higher priority". any other suggestions welcome (ie., creating "shell" native app, etc.) these links answered question: http://www.w3schools.com/html/html5_app_cache.asp http://www.html5rocks.com/en/tutorials/appcache/beginner/#toc-updating-cache

php - How to: Copy files from a source to a destination -

i looking way have files in source, say: /public_html/source/sourcefiles/ and when, in admin panel, create new 'game' (in case), might called category, or et cetera in other projects, copy source files directory such as: /public_html/games/gamename/sourcefiles_copied_here/ is there way this? if possible, i'd need way delete them when game/category deleted. http://php.net/manual/en/function.copy.php the php copy function useful copying files source, new directory. it used this: copy(sourcedir, destdir); keep in mind files exist in destination directory same name files being copied overwritten. to move file, use rename function.

tfs - Project name change keeps asking to checkout -

i have solution few ssis projects, in tfs. helping guy fix project names consistent other projects in solution. after updating names, checked in project , solution files. when got latest (i tried both getlatest , getspecific), tfs kept asking me checkout project files , got pretty annoying , ended checking them out , undid changes on project files. does know why keeps doing that?

matlab - Plot many horizontal Bar Plots in the same graph -

Image
i need plot x-y function, shows histograms @ x-values. similar bottom plot of next figure: i tried use matlab's "barh", can't plot many in same figure. ideas? or, maybe displacing origin (baseline, basevalue in barseries properties) of successive plots work. how barh? thanks. using 'position' of axes property % generate "data" m = rand( 40,10 ); [n x] = hist( m, 50 ); % actual plotting figure; ma = axes('position',[.1 .1 .8 .8] ); % "parent" axes n = size(n,2); % number of vertical bars ii=1:n, % create axes inside parent axes ii-the barh sa = axes('position', [0.1+(ii-1)*.8/n, 0.1, .8/n, .8]); % position ii-th barh barh( x, n(:,ii), 'parent', sa); axis off; end

map - Incompatibility of numpy.sum() with Python 3 -

in python 2.7 1 write: sum(map(int, "123")) in python 3 became: sum(x x in map(int, "123")) is there way make more concise? edit: i running pylab, imports sum() numpy changing semantics of first snippet. idle produces same results both python 2.7 , python 3.3 dsm noticed. note: i appreciate down voting question leave comment short explanation. edited title (originally: is there way concise notation map() in python 3? ) reflect better understanding of underlying issue. else bothers you? map still exists in python 3; in fact, first code snippet should still work.

web services - Android save login user details in application -

i web developer , new android , studying ... first step made user login system using php-mysql web services. the application communicating web service pretty , check user exists. if user exists return user details if user exists. my question in web application there session / cookie handling in android application ? eg if can save session not need login @ each , every time. i sure there way because lots of apps working feature. since new android please advice bit. not knowing correct word googling. "savepreferences". thanks in advance i think looking sharedpreferences . stores data persistently in (key, value) pair have check box @ login screen if check stores boolean value , username key . when login screen , choose username checks value , if true doesn't require password. assuming allow more 1 user login app. however, if have 1 person logging in app device, send value web server when open app can skip login screen. besides links docs provid

cmd - compare folders and copying non identical folders and files -

i have 2 folders folder1 , folder2 folder1 has file1 file2 folder3 folder4 and folder2 has file1 file2 file3 folder3 folder5 here want copy thats not present in folder1 folder2 in case copy file3 , folder5 folder1 thanks in advance answers. try this: xcopy /e /s /d "folder2" "folder1"

javascript - how to get a desired order of this java script object? -

lets see, have jquery parsed json object (but bigger): [ {answered: 0, caller: 4, callid: 4, expired: 0, groupid: 2, location: "jubin", name: "vahid", personid: 3, presense: 1367323732, response: null, text: null, time: 1367336754, type: 0}, {answered: 0, caller: 6, callid: 5, expired: 0, groupid: 2, location: "jubin", name: "vahid", personid: 3, presense: 1367323732, response: null, text: null, time: 1367336766, type: 0}, {answered: 0, caller: 4, callid: 4, expired: 0, groupid: 2, location: "jubin", name: "reza", personid: 1, presense: 1367392633, response: null, text: null, time: 1367336754, type: 0}, {answered: 0, caller: 6, callid: 5, expired: 0, groupid: 2, location: "jubin", name: null, personid: 1, presense: 1367392633, response: null, text: null, time: 1367336766, type: 0} ] and have this(short version): [ { callid: 4, name: {"vahid", "reza"} }, { callid: 5, name: {"v

javascript - HTML is not compiled inside angular directive -

angular.module("vtapp.directives"). directive('multirangeslider', function ($compile) { return { restrict: 'e', replace: true, link: function (scope, element, attrs) { var variances, values, options, template, compile; scope.variances = eval (attrs.variances); scope.values = scope.$eval(attrs.values); var htmltext = '<div id="'+attrs.id+'"><table class="crc"><tbody><tr>'; (var i=0; i<scope.values.length; i++) { htmltext += '<td id="val' + + '" style="width:' + scope.values[i] + '%;"> ' + scope.variances[i] + ': <strong>{{ranges[' + + ']}}%</strong></td>'; } htmltext += '</tr></tbody></table></div>'; template = angular.element(htmltext);

Unexpected output from lex program -

i have written simple lex program perform average of positive numbers , program compiling fine i'm not able expected output.i'm passing input program file giving filename commandline argument.the output of lex program blank showing no result , i'm beginner in lex , appreciated . have attached code below. code written in redhat linux kernel version 2.4. %{ #include <stdio.h> #include <stdlib.h> %} %% [0-9]+ return atoi(yytext); %% void main() { int val, total = 0, n = 0; while ( (val = yylex()) > 0 ) { total += val; n++; } if (n > 0) printf(“ave = %d\n”, total/n); } the input file contains numbers 3,6 , 4 , name of file passed command line argument. ./a.out < input your program works me. i'm bit suspicious of yywrap missing, link -lfl (or alike) option. library contains yywrap , main . though i'm not able reproduce see, i'm wary maybe main libfl used. i'm assuming newlines in input file on output.

pexpect - Python - In Windows, how to intertact with the serial port? -

under linux, use fdpexpect module interact serial port, such as: fd = os.open(tty, os.o_nonblock|os.o_rdwr|os.o_noctty) child = fdpexpect.fdspawn(fd) in windows, how implement above? i got working on weekend on windows 7. here how did it: first, fdpexpect module seem way "chat" serial port in python 2.7. latest python pexpect module docs says can take integer (int) file descriptor (like fdpexpect), doesn't work on ubuntu 12.10 install. seems fdpexpect way go. if from: http://www.opensource.apple.com/source/lldb/lldb-69/test/pexpect-2.4/fdpexpect.py second, fdpexpect module requires file descriptor input. although python pyserial module ("import serial") cross-platform, use fdpexpect 1 must use serial.fileno() method int file descriptor serial port. serial.fileno() method not exist in windows python; exists in posix python, integer file descriptors used. fortunately, can made work using cygwin. cygwin free posix-like environment w

Unit test neo4j with TestNG - newImpermanentDatabase -

when want create graphdatabaseservice in setup() method below: private graphdatabaseservice graphdb; @beforemethod public void setup() throws exception { graphdb = new testgraphdatabasefactory().newimpermanentdatabase(); } i error: java.lang.abstractmethoderror: org.neo4j.test.impl.ephemeralfilesystemabstraction.autocreatepath(ljava/io/file;)v @ org.neo4j.kernel.storelocker.lock(storelocker.java:73) @ org.neo4j.kernel.internalabstractgraphdatabase.create(internalabstractgraphdatabase.java:287) @ org.neo4j.kernel.internalabstractgraphdatabase.run(internalabstractgraphdatabase.java:227) @ org.neo4j.kernel.embeddedgraphdatabase.<init>(embeddedgraphdatabase.java:79) @ org.neo4j.test.impermanentgraphdatabase.<init>(impermanentgraphdatabase.java:78) @ org.neo4j.test.testgraphdatabasefactory$1.newdatabase(testgraphdatabasefactory.java:46) @ org.neo4j.graphdb.factory.graphdatabasebuilder.newgraphdatabase(graphda

android - need help to fix code for getting current view in viewpager -

need fix code saw in https://stackoverflow.com/a/9275732/1938357 . solution need current view onany page in viewpager based application below code reference public view getcurrentview(viewpager pager) { (int = 0; < pager.getchildcount(); i++) { view child = pager.getchildat(i); if (child.getx() <= pager.getscrollx() + pager.getwidth() && child.getx() + child.getwidth() >= pager.getscrollx() + pager.getwidth()) { return child; } } return getchildat(0); i trying access current view in view pager , used code above. works fine when scroll forwards. when scroll backwards after 2 backward scrolls stops working. public class myactivity extends fragmentactivity //variable declarations protected void oncreate(bundle savedinstancestate) { viewpager mpager = (viewpager) findviewbyid(r.id.pager); mpageradapter = new screenslidepageradapter(getsupportfragmentmanager()); mpager.setadapter(mpageradapter); view currview; onpagechangelistene