Posts

Showing posts from January, 2014

php - How To Regex Search and Replace array_key_exists with isset? -

whats best way regex search , replace instances of array_key_exists() more efficient isset() ? please, no donald knuth quotes regarding optimizations , yes, i'm aware of differences between 2 functions . this i'm using in netbeans search , replace: search for: array_key_exists\s*\(\s*'([^']*)'\s*,([^)]*)\) replace with: isset($2['$1']) it works , changing this: array_key_exists('my_key',$my_array) to isset($my_array['my_key']) but doesn't pick instances this: array_key_exists($my_key,$my_array) not elegant solution, adding current regex find both types of search criteria. array_key_exists\s*(\s*'|$['|\s]\s*,([^)]*))

python - Numpy arrays containing iterable objects -

normally it's possible put arbitrary objects numpy arrays: class foo(object): pass np.array([ foo() ]) >>> array([<__main__.foo object @ 0x10d7c3610>], dtype=object) however, appears objects implementing __len__ , __getitem__ "unpacked" automatically: class foo(object): def __len__(self): return 3 def __getitem__(self, i): return i*11 np.array([ foo() ]) >>> array([[0, 11, 22]]) is there way stop numpy unpacking objects in way? want put objects numpy array , have them stored objects themselves, without being unpacked. desired behavior is: class foo(object): def __len__(self): return 3 def __getitem__(self, i): return i*11 np.array([ foo() ]) >>> array([<__main__.foo object @ 0x10d7c3610>], dtype=object) now understand duck typing idea implies numpy should unpack looks list. perhaps it's possible mark class foo in way tell numpy not unpack it? example, abc like: numpy.nonenumerable.register

javascript - Capture image from camera video feed into a canvas element, a Context2D instance, or an instance of ImageData -

i'm having trouble finding example of how capture image camera video feed works. i've found this great example , this great one gets me of way, image capture part fails. how can image grabbed webcam video feed , placed in canvas element, context2d instance, or instance of imagedata? you can use canvas element. try code below: var video = document.getelementbyid('myvideo'); var canvas = document.getelementbyid('mycanvas'); var ctx = canvas.getcontext('2d'); ctx.drawimage(video, 0, 0, canvas.width, canvas.height); this article might help.

ios - Adjusting Cell fields - Objective C -

i have dynamically set table view controller used populate news type feed. having trouble connecting 1 class other setting text, image, etc... of current cell. here gist: - (uitableviewcell *)tableview:(uitableview *)tableview cellforrowatindexpath:(nsindexpath *)indexpath { static nsstring *cellidentifier = @"timelinecell"; fbgtimelinecell *cell = (fbgtimelinecell *)[tableview dequeuereusablecellwithidentifier:cellidentifier]; cell.text = [self.googleplacesarrayfromafnetworking[indexpath.row] objectforkey:@"message"]; <!-- here want example, set title message within array. if (!cell) { cell = [[fbgtimelinecell alloc] initwithstyle:uitableviewcellstyledefault reuseidentifier:cellidentifier]; [cell setselectionstyle:uitableviewcellselectionstylenone]; [cell inittimelinecell]; } uiimage *img = [uiimage imagenamed:[nsstring stringwithformat:@"%d.jpg", indexpath.row]]; cell.photoview.image

Assistance with regex python -

i need regex pattern allows me below i'm not quite sure how to. command, = re.search(someregexpattern, string).groups() # or split list input: ".somecommand" command, = "somecommand", "" # "" because there nothing follows "somecommand" input: ".somecommand stuff" command, = "somecommand", "some stuff" input: ".somecommand long text after somecommand" command, = "somecommand", "some long text after somecommand" note somecommand dynamic not somecommand is there regex makes possible? command 1 thing , comes after command assigned extra? update : seems have not clarified enough of regex should i'm updating answer help. while true: text = input("input command: ") command, = re.search(someregexpattern, text).groups() example data # when text .random command = "random" = "" # when text .gis test (for google image sear

activerecord - Rails - get results of many to many query without nested loops -

i'm new rails , trying figure out better way outputted data query on many many relationship. here models: class user < activerecord::base has_many :takes has_many :tests, through: :takes has_many :provides has_many :tests, through: :provides end class test < activerecord::base has_many :takes has_many :users, through: :takes has_many :provides has_many :users, through: :provides end class provide < activerecord::base belongs_to :user belongs_to :test end class take < activerecord::base belongs_to :user belongs_to :test end here query: @test = test.includes(:users).where("id = ?", 1) and here how i'm working data, need able each row test.* data, user.* data, , provide.id. provide.id problem - can't seem it. <% @test.each |t| %> <% t.users.each |u| %> <tr> <td>&

android - Share onKeyDown between Preferences and Activity? -

my app allows users change hard keys on it. can choose each key in app preferences , on onkeydown fire action selected user. i noticed many of test functionality, first set hard key , immediatelly press key corroborate if change in effect. right onkeydown on mainactivity aren't getting right feedback. for reason want reuse onkeydown in both mainactivity , preferenceactivity. tried extend baseactivity can't work both preferenceactivity , regular one. there way through innheritance? how can it? you may not able via inheritance since preferenceactivity inherits activity you'd have write 2 classes anyway (which defeats purpose). you alternatively use mapping transforms keydown event 1 user has set. public class downkeymapper { private static map<integer, integer> mkeycodemap; public static void init(map<integer, integer> pkeymap) { // init here mappings preferences mkeycodemap = pkeymap; } public static void mapkey(int pfromkeycode, i

javascript - variable suddenly returns 'undefined' -

my variable directlinks gives me 'undefined' in chrome's javascript console when used inside console.log able work in 2 other occasions can see below. if (jquery(this).isonscreen() === true && directlinks.text() === "www.example.com") { jquery.ajax( { url: directlinks.attr("href").replace("www.", ""), aysnc: false, }) .done(function(data) { console.log(directlinks.attr("href")); var test = jquery(data).find("#left").children().children("div").eq(2).children("p").eq(1).children("a").attr("href"); directlinks.attr("href", test); }); }

java - SumDigits using Parameter -

okay, created digitssum application. class digitssum , contain static method called sumdigits(i done this). ( didn't part) names must match these including capitalization, sumdigits method should take single parameter, integer, , return sum of digits in integer, sumdigits method should not print anything, , should return answer using return statement. can use main method test sumdigits method, , printing should happen there. know whether if did fine or no..also method return should if entered number, suppose 345, output should 3+4+5=12 --> 1+2 = 3. doing wrong here? in advanced! import java.util.scanner; public class sumdigits { public static double sumdigits (int a){ int sum; int t= a%10; sum= t+t; = a/10; return (sum); } public static void main (string [] args){ double sumdigit; int integer;

html - How do I keep my footer text from appearing outside my footer -

i have problem. text in footer keeps appearing outside footer underneath. how stay inside footer div?here html code footer: <div id="footer"> <!-- if you'd support wordpress, having "powered by" link somewhere on blog best way; it's our promotion or advertising. --> <p>contact | privacy policy | call 1300 4 u (483 678)</p> <br /> <br /> <br /> <p><?php bloginfo('name'); ?> pty ltd 2000-2014 proudly powered by<a href="http://wordpress.org/">wordpress</a> , designed <a href="http://www.wpart.org/">wpart.</a> rights reserved. stathis arcade 262 maquarie street suite 2-3 | liverpool nsw 2170 <?php wp_footer(); ?></p> </div> here footer css: #footer { width: 960px; background-repeat: no-repeat; padding-top: 10px; padding-right:10px; height: 50px; font-family: tahoma, geneva, sans-serif; font-siz

php - Delete a Customer Progmatically in Magento -

how can delete customer in magento refering or using object mage::getmodel("customer/customer") ? i researched in google , bad luck found nothing. i find out. customer eav products can deleted using delete() method. flag object deleteable using $customer->setisdeleteable(true) because customer model class mage_customer_model_customer implements mage_core_model_abstract contains delete() method i used following codes below $customer->loadbyemail('test@test.com'); $customer->setisdeleteable(true); $customer->delete(); if want deletion workout in frontend(in case backend) need initiate mage::register('issecurearea', true)

java - non-static method towersOfHanoi(int, int, int, int) cannot be referenced from a static context? -

when compile tester, says in line 9: non-static method towersofhanoi(int, int, int, int) cannot referenced static context why cant reach towersofhanoi method? i provided 2 classes below. import java.io.*; import java.util.*; public class tester { public static void main(string args[]) { scanner swag = new scanner(system.in); int yolo = swag.nextint(); towersofhanoi.towersofhanoi(yolo,1,3,2); } } public class towersofhanoi { public void towersofhanoi (int n, int from, int to, int spare) { if(n== 1) { moveone(from, to); } else { towersofhanoi(n-1, from, spare, to); moveone(from, to); towersofhanoi(n-1, spare, to, from); } } private void moveone(int from, int to) { system.out.println(from + " ---> " + to); } } problem line towersofhanoi.towersofhanoi(yolo,1,3,2); either create object o

vagrant - Ubuntu guest can't see Vagrantfile in Window's host project directory -

i installed vagrant 1.4.3 on windows 7 64-bit , created ubuntu 13.10 (saucy) box using following: vagrant box add saucy64-20140226 http://cloud-images.ubuntu.com/vagrant/saucy/20140226/saucy-server-cloudimg-amd64-vagrant-disk1.box vagrant init saucy64-20140226 after doing: vagrant up i ssh'ed vagrant box using putty. point fine, when do: $ ls in /vagrant directory (on guest), not see 'vagrantfile' or other files host machine. also, files created in guest's /vagrant directory not show in host's synced directory. i noticed following when box/vm starting up: [default] guest additions on vm not match installed version of virtualbox! in cases fine, in rare cases can prevent things such shared folders working properly. if see shared folder errors, please make sure guest additions within virtual machine match version of virtualbox have installed on host , reload vm. after researching little more, found following s

php - ExpressionEngine source control via git -

im stuck supporting expressionengine sites , i'm trying check cms source control. i failing since cannot see way decouple database templates , other structures. i'd able version control aspects in cms including content , channel creation template creation , modification. i'm not sure why ee legacy system, pushed out v2.8 few days ago , have been updating system years. if you're familiar wordpress, process shouldn't different. need save templates files , version control along system files. you're not going version-controlling database similar way wouldn't doing wordpress. simply turning google give hundreds of answers how i'll leave consider definitive reading on subject: http://devot-ee.com/articles/item/version-control-for-expressionengine-using-git-part-1

ember.js - How can I send a message / call a method on all itemController children instances in Ember? -

i'm trying use "buffered proxy" pattern on collection of items in form hasmany model. when complete, i'm trying have "save" button, triggers save action, allow me save as-yet unsaved changes i've made. more info on bp in ember: http://coryforsyth.com/2013/06/27/ember-buffered-proxy-and-method-missing/ i can work fine top level model attribute, i'm confused how tell non-singleton itemcontrollers want them save buffers, able call grandparent save whole enchilada. hoping i'd able parent array controller: actions: { savestuff: function() { // possible? this.get('allthenonsingletonitemcontrollerchildren').send('savethosebuffers'); } } child controller: savethosebuffers: function() { var grandparent = this.get('parentcontroller').get('parentcontroller'); this.applybufferedchanges(); grandparent.saveentirerecord(); // not sure how work yet - can't use 'needs

Google plus API Issues -

Image
working google plus api, have enabled google+ api in developer console , regenrated appkey multiple times , trying access profile using profile.get everytime getting following issue: { "error": { "errors": [ { "domain": "usagelimits", "reason": "accessnotconfigured", "message": "access not configured. please use google developers console activate api project." } ], "code": 403, "message": "access not configured. please use google developers console activate api project." } } here link, trying do: https://www.googleapis.com/plus/v1/people/113377691202864347297?key= {mykey} passing generated key domain, getting above error. why not working screenshot of enabled api's i guessing you're using wrong api key. api key not client id or client secret - shouldn't have '.' in it. in new console ( https://developers.g

c - What is the difference between defining a function type and a function pointer type? -

as know, can define function type: typedef void (fn)(void); and can define function pointer type: typedef void (*pfn)(void); there 2 functions. first function's parameter type function, , other function pointer: void a(fn fn1) { fn1(); } void b(pfn fn1) { fn1(); } i implement function callback: void callback(void) { printf("hello\n"); } and pass argument , b: int main(void) { a(callback); b(callback); return 0; } both , b work well, , print "hello" . so want know difference between defining function type , function pointer type? or actually, same? given abuse can use function pointers ( &func , func , *func , **func , … end same value function func ), there few practical differences between two. can use fn * indicate pointer function, not trivial transform. however, here's mild adaptation of code, using non-parameter variable of type pfn , attempting (unsuccessfully) use non-paramete

python - twisted client transport.write not sending data, even after close -

i writing server in twisted needs propagate information other servers. implement this, have written simple client protocol writes given server. use deferreds call transport.write(), , have confirmed through print statements callback called, never output server. my code here: https://gist.github.com/sakekasi/9460002 maybe i'm preventing reactor running reason? i'm pretty sure haven't, don't use long running loops. thanks in advance. edit: quick walkthrough of code i'm instantiating 5 servers according dictionary ports. each server, create new factory , bind respective port. invalid commands: given invalid command, server must reply ? command iamat: 'iamat name lat lon time' must responded @ servername name lat lon time. in addition, server recieves command proceeds propagate servers under name in talks dictionary. so, instantiate clients client factory, , have them send message right port based on ports dictionary. for code details, @ resp

shell - How do I write an awk print command in a loop? -

i write loop creating various output files first column of each input file, respectively. so wrote for in $(\ls -d /home/*paired.isoforms.results) awk -f"\t" {print $1}' $i > $i.transcript_ids.txt done as example if there 5 files in home directory named a_paired.isoforms.results b_paired.isoforms.results c_paired.isoforms.results d_paired.isoforms.results e_paired.isoforms.results i print first column of each of these files seperate output file, i.e. have 5 output files called a.transcript_ids.txt b.transcript_ids.txt c.transcript_ids.txt d.transcript_ids.txt e.transcript_ids.txt or other name long 5 different names , can still link them original files. i understand, there problem double usage of $ in both awk , loop command, don't know how change that. is possible write command in loop? this should job: for file in /home/*paired.isoforms.results base=${file##*/} base=${base%%_*} awk -f"\t" '{print $1}'

elastix - asterisk hangup call when hold -

if dial , put them on hold, asterisk hang after few minutes. i'm thinking there setting somewhere i'm not finding. ideas? think change setting freepbx => tools => asterisk sip setting => media & rtp settings log excerpt: [mar 9 09:49:16] verbose[19807] pbx.c: -- executing [788787636@local-route:1] macro("sip/100-000804aa", "user-callerid,skipttl,") in new stack [mar 9 09:49:16] verbose[19807] pbx.c: -- executing [788787636@local-route:2] noop("sip/100-000804aa", "calling out route: to-outside") in new stack [mar 9 09:49:16] verbose[19807] pbx.c: -- executing [788787636@local-route:3] set("sip/100-000804aa", "mohclass=ros-moh") in new stack [mar 9 09:49:16] verbose[19807] pbx.c: -- executing [788787636@local-route:4] set("sip/100-000804aa", "_nodest=") in new stack [mar 9 09:49:16] verbose[19807] pbx.c: -- executing [788787636@local-route:5] macro("

How do I auto size columns through the Excel interop objects in AX 2012? -

hi working in microsoft dynamic ax 2012. how auto size columns through excel interop objects in ax 2012? why not use this answer : arange.columns.autofit(); why should ax different?

javascript - Uncaught TypeError: Cannot read property 'position' of undefined (D3.JS) -

this error popped when tried retrieve json data , make line graph. uncaught typeerror: cannot read property 'position' of undefined here's js : d3.json("../js/sample2.json", function(data) { var canvas = d3.select("body").append("svg") .attr("width", 500) .attr("height", 500); var = 0; var group = canvas.append("g") .attr("transform", "translate(100,100"); var line = d3.svg.line() .x(function(d, i) { console.log("x" + d[0].position[i]); return d[0].position[i]; }) .y(function(d, i) { console.log("y" + d[1].position[i]); return d[1].position[i]; }); group.selectall("path") .data([data]).enter() .append("path") .attr("d", line)

php - How to remove complete header and footer from checkout/cart and afterwards all pages in magento -

i have remove complete header , footer checkout/cart page onwards pages in magento 1.7. know need add <remove name="header"/> in "checkout.xml" file whenever i'm trying add same line, either nothing reflecting on front-end or blank page appear on front-end. in local.xml use below code to remove header , footer cart page: <checkout_cart_index> <remove name="header"/> <remove name="footer"/> </checkout_cart_index> to remove header , footer checkout onepage : <checkout_onepage_index> <remove name="header"/> <remove name="footer"/> </checkout_onepage_index>

akka - Spark 0.90 Stand alone connection refused -

i using spark 0.90 stand alone mode. when tried streaming application in stand alone mode, getting connection refused exception.i added hostname in /etc/hosts tried ip alone.in both cases worker got registered master without issues. is there way solve issue? 14/02/28 07:15:01 info master: akka.tcp://driverclient@127.0.0.1:55891 got disassociated, removing it. 14/02/28 07:15:04 info master: registering app twitter streaming 14/02/28 07:15:04 info master: registered app twitter streaming id app-20140228071504-0000 14/02/28 07:34:42 info master: akka.tcp://spark@127.0.0.1:33688 got disassociated, removing it. 14/02/28 07:34:42 info localactorref: message [akka.remote.transport.actortransportadapter$disassociateunderlying] actor[akka://sparkmaster/deadletters] actor[akka://sparkmaster/system/transports/akkaprotocolmanager.tcp0/akkaprotocol-tcp%3a%2f%2fsparkmaster%4010.165.35.96%3a38903-6#-1146558090] not delivered. [2] dead letters encountered. logging can turned off or adjusted co

java - How to show multiple tables depending on key in the Map using JSTL? -

i have map of string , list of object contains each datacenter , machine. , passing object jsp controller , iterating in jsp page show data. if map size one, able show data in jsp page , works fine. now suppose if map size two, show 2 tables 1 each key in map. not able make work. maximum size of map can 3 use case. below class holds data - public class datacentermachinemapping { private map<string, list<machinemetrics>> datacentermachines; // getters , setters } public class machinemetrics { private string machinename; private string t2_95; private string t2_99; private string syncs; private string syncsbehind; private string average; // getters , setters } and below method in controller need pass object jsp , iterate object in jsp show data in table - @requestmapping(value = "testoperation", method = requestmethod.get) public map<string, string> testdata() { final map<string, string> model

jsf - How to add tabs in tabview in primefaces, dynamically, on click of a command button? -

how add tabs in tabview in primefaces , dynamically, on click of command button using ajax? <p:tabview id="tabview" dynamic="true" cache="false" binding="#{testbean.tabview}" activeindex="0" scrollable="true"> <p:tab title="tab1" closable="true"> <h:outputlabel value="1"></h:outputlabel> </p:tab> <p:tab title="tab2" closable="true"> <h:outputlabel value="2"></h:outputlabel> </p:tab> <p:tab title="tab3" closable="true"> <h:outputlabel value="3"></h:outputlabel> </p:tab> </p:tabview> backing bean public class testbean { tabview tabview; int id=0; public testbean() { } public string addtab() { string tabid

java - How to make a string compare non case sensitive? -

i trying write code 1 of programs responds according answers. want make of variables not case sensitive. example if variable x equal "me" want equal "me" . possible? here code far: import java.util.scanner; class tutorial { public static void main (string args[]){ system.out.println("who goes there?"); scanner n = new scanner(system.in); string name = n.next(); if (name.equals("me") || name.equals("me")){ system.out.println("well, smartass."); system.exit(1); }else system.out.printf("nice meet you, %s.%n", name); system.out.print("how doing?"); scanner d1 = new scanner(system.in); string doing = d1.next(); switch(doing){ case "good": system.out.println("that nice hear."); case "well": system.out.println("that nice hear."); c

javascript - Jquery Chosen is updating cascading selects on step behind native select boxes -

i using jquery chosen on 4 select boxes being populated via database. the select box ids are: #year_395, #make_395, #model_395, #trim_395. i using following script "cascade" them second select box's options depend on option has been selected in first, options third dependent on second selection etc. function cascadeselect(parent, child){ var childoptions = child.find('option:not(.static)'); child.data('options',childoptions); parent.change(function(){ var parentvalue = (this.value).replace(" ", "_"); childoptions.remove(); child .append(child.data('options').filter('.sub_' + parentvalue)) .change(); }) childoptions.not('.static, .sub_' + parent.val()).remove(); } the native select boxes cascading correctly. problem when implement jquery chosen, new select boxes update, 1 step behind native boxes. using below code update options jq

c# - Showing text in below of image in asp.net menu control -

Image
i have tried show menu name below of menu icon,. don't know how that. my aspx code <asp:menu runat="server" itemwrap="true" orientation="horizontal"> <items> <asp:menuitem imageurl="~/images/admin.png" selectable="true" text="system" /> <asp:menuitem imageurl="~/images/user.png" selectable="true" text="user" /> <asp:menuitem imageurl="~/images/cut.png" selectable="true" text="cut" /> <asp:menuitem imageurl="~/images/edit-copy.png" selectable="true" text="copy" /> </items> </asp:menu> output please try putting <br> tag while setting text menu item . menu be <asp:menu runat="server" itemwrap="true" orientation=&

java - How to put value of day of month in my code -

how store string variable in date object? getting error: an error occurred @ line: 25 in jsp file: /date.jsp formatter cannot resolved <% try { calendar date = calendar.getinstance(); date.set(calendar.day_of_month, 1); date date1; dateformat df = new simpledateformat("dd/mm/yyyy"); string str=df.format(date.gettime()); //out.println(str); showing date formate 01/03/2014 date1 = (date)df.parse(str); out.println(date1); //but showing "sat mar 01 00:00:00 ist 2014" want show 01/03/2014 } catch(exception e) { } %> when print date, build string using java.util.calendar 's .get() method. string datestr = date.get(calendar.year) + "/" + (date.get(calendar.month)+1) + "/" + date.get(calendar.day_of_month); out.print(datestr); and put them in whatever order want them in. if need time element, @ documentation java.util.calendar see oth

c++ - Isavailable is not a member of QSound -

i want compile old qt project qt 5.2.1 , have many trouble, 1 of qsound problem: if(!qsound::isavailable()) { ui.grpsounds->setenabled(false); ui.grpsounds->settitle(tr("sounds (not available)")); } error: 'isavailable' not member of 'qsound' will me? newbie qt. thank you. if want notify user whether or not sounds can played best bet qaudiodeviceinfo . can query available input or output devices using static method qlist<qaudiodeviceinfo> qaudiodeviceinfo::availabledevices(qaudio::mode mode) for instance can replace qsound::isavailable() by !qaudiodeviceinfo::availabledevices(qaudio::audiooutput).isempty() edit: qsound part of gui module, part of multimedia module (which make more sense). need take @ changes in multimedia modules qt4 qt5 more info. may want @ qsoundeffect , seems have richer api

android - DDMS data drop down not working -

Image
i running application in htc sensation xe couldn't access data->data files click drop down nothing happens. tried reset connection fails time don't know issue can please. have tried find permissions couldn't find in phone settings. here screen shot of when open file explorer first: after clicking data drop down button noting happens button disappears there private files under /data/data. right can not see in it. what should root phone , remount /data/data partition.

Spring Static Resource Mapping -

i have been followed error since started using spring can't handle static content my dispatcher-servlet configuration <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xmlns:p="http://www.springframework.org/schema/p" xmlns:aop="http://www.springframework.org/schema/aop" xmlns:mvc="http://www.springframework.org/schema/mvc" xmlns:tx="http://www.springframework.org/schema/tx" xsi:schemalocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-3.0.xsd http://www.springframework.org/schema/aop http://www.sprin

sql - To display all records of table? -

to display records of table1 except containing 2 b containing 5 table1 ------ b - 8 5 2 9 null 4 2 5 select * table1 not in 2 , b not in 5; it doesn't work ,it display 0 rows selected try this: select * table1 (a null or != 2) , (b null or b != 5) edit sql fiddle, many nagaraj s

java - OSGi Application Patching mechanism -

is there recommended approach patch osgi application on runtime? i'm using equinox implementation of osgi. if stop particular bundle , install patched bundle. how affect other bundles @ runtime?.. i saw osgi application patching strategy , not give clear answer. thanks. i suppose depends on how bundles are. there example in "osgi in action" book, on page 73. to try yourself: download examples , unpack file , build "chapter03" examples ant ( osgi-in-action/chapter03/build.xml ), copy chapter03/paint-example/bundles/*-3.0.jar files e.g. chapter03/shell-example/1 , in order make examples work (see issue ) need this: download latest apache felix framework distribution this page , @ moment it's 4.2.1, extract org.apache.felix.main.distribution-4.2.1.zip file, extract felix-framework-4.2.1/bin/felix.jar file, copy default.properties file osgi example's chapter03/shell-example/launcher.jar . now have ready: // in c

ios - Default to songs tab when presenting MPMediaPickerController -

when present mpmediapickercontroller in ios7 , default tab playlists tab. how change default tab songs tab? have searched everywhere , cannot find solution, know possible because see other apps have done this. here how i'm presenting media picker controller: - (void)showpicker { mpmediapickercontroller *mediapicker = [[mpmediapickercontroller alloc] initwithmediatypes:mpmediatypeanyaudio]; mediapicker.delegate = self; mediapicker.prompt = @"select song"; [mediapicker setallowspickingmultipleitems:yes]; [mediapicker setshowsclouditems:yes]; [self presentviewcontroller:mediapicker animated:yes completion:nil]; } you can not change default tab of mpmediapickercontroller , prior ios 7 defaults tab of mpmediapickercontroller songs tab, in ios 7 have changed playlist tab! applications might have seen have been running on ios 6 or less. for more info can check apple's documentation doesn't mention this. sorry, it's no

How to Import Preferences (.epf) in eclipse via command prompt? -

i wanted run bat file in can import preferences location (which exported manually). searched command import preferences but, not find any. there no existing code this. have write eclipse headless application this: ipreferencesservice service = platform.getpreferencesservice(); iexportedpreferences prefs = service.readpreferences(file input stream); // todo create ipreferencefilter array filter want service.applypreferences(prefs, filter array); see source of import preferences page org.eclipse.ui.internal.wizards.preferences.wizardpreferencesimportpage1 example.

html - groovy - displaying a String by using <br> -

i have string contains several values displayed in table def mystring = "123,234;12904,1989,8709,6745" i replace each value link <td>${mystring.replaceall(/[0-9]+/) { m -> '<a href="../mylink>'+m+'</a>'}}</td> the result is: 123,234;12904,1989,8709,6745,.... i constated string can long, added 'br' after each value: <td>${mystring.replaceall(/[0-9]+/) { m -> '<a href="../link>'+m+'<br></a>'}.replaceall(",","")}</td> the result is: 123 234 12904 1989 8709 6745 ... the result not suit me. the best solution me add 'br' after third value have like: 123,234;12904 1989,8709,6745 is there possibility have display code have? you try: mystring.findall( /[0-9]+/ ) // extract numeric elements .collect { "<a href='../mylink'>$it</a>" } // create li

dropbox api - Android - Downloading File by updating Progress Bar -

i have multiple files in dropbox account. downloading files. want show progress bar percentage when files gets downloaded.the progress bar finishes.i using asynctask downloading files.here code. public void onpreexecute(){ mdialog = new progressdialog(mcontext); mdialog.setprogressstyle(progressdialog.style_horizontal); mdialog.setmax(100); mdialog.show(); } public void downloadfiles(string filename){ log.i("item name",filename); file dir = null; boolean issdpresent = android.os.environment.getexternalstoragestate().equals(android.os.environment.media_mounted); if(issdpresent){ file sdcard = environment.getexternalstoragedirectory(); dir = new file (sdcard.getabsolutepath() + "/allsecure"); if (!dir.exists()) { dir.mkdirs(); } }else{ dir = mcontext.getdir("users", context.mode_private); //creating internal dir

wpf - DependencyProperty Registration in ViewModel -

i finding lot of discussions viewmodels , properties compare 2 approches: implementation of inotifypropertychanged or implementation via dependency properties . while doing inotifypropertychanged lot (and it's working) having difficulties implementing dp-approach. when registering dp in viewmodel this public static readonly dependencyproperty somepropertyproperty = dependencyproperty.register("someproperty", typeof(string), typeof(myusercontrol)); and trying use somewhere with: <mynamespace:myusercontrol someproperty="{binding ...}"/> there compiler error: the property 'someproperty' not exist in xml namespace 'clr-namespace:mynamespace'. what doing wrong?? edit1 the viewmodel looks this: public class myusercontrolvm : dependencyobject { public string someproperty { { return (string)getvalue(somepropertyproperty); } set { setvalue(somepropertyproperty, value); } } pu

iphone - collection view not working when app opens -

i have tab bar app , opening tab contains full screen collection view paging through images. when app opens paging doesn't work of rough , sporadic, however, if change tab , return initial 1 paging works absolutely fine. has experienced or know causing this? here code used: #import "homeviewcontroller.h" @interface homeviewcontroller () @end @implementation homeviewcontroller - (id)initwithnibname:(nsstring *)nibnameornil bundle:(nsbundle *)nibbundleornil { self = [super initwithnibname:nibnameornil bundle:nibbundleornil]; if (self) { // custom initialization } return self; } - (void)viewdidload { [super viewdidload]; [self createstonedata]; } - (void)createstonedata { self.homeimages = [nsmutablearray array]; [self.homeimages addobject:[[nsmutabledictionary alloc] initwithobjectsandkeys:@"biddlesdon wardrobes", @"name", @"_np

c++ - pthread_mutex_lock blocks but __lock = 0 -

i writing multi-threaded program, , running deadlock. one of threads blocks while other threads sleeping (cond_wait) so entered ctrl+c go gdb terminal (gdb) info thread 5 thread 0x1c6ff4a0 (lwp 723) __pthread_cond_wait (cond=0x420c50, mutex=0x420c34) @ pthread_cond_wait.c:156 3 thread 0x1bcf34a0 (lwp 721) __pthread_cond_wait (cond=0x41a530, mutex=0x41a514) @ pthread_cond_wait.c:156 * 1 thread 0x1b2c9720 (lwp 716) __lll_lock_wait (futex=0x1be08240, private=0) @ ../nptl/sysdeps/unix/sysv/linux/lowlevellock.c:46 (gdb) bt #0 __lll_lock_wait (futex=0x1be08240, private=0) @ ../nptl/sysdeps/unix/sysv/linux/lowlevellock.c:46 #1 0x1afa1540 in __pthread_mutex_lock (mutex=0x1be08240) @ pthread_mutex_lock.c:61 #2 0x1abb7984 in readerwait (frameinfo=0x1be08240, sem=0x1aad4000) @ camipcsource.cpp:282 ...... i can see thread blocked @ camipcsource.cpp:282 but when change frame #2 , print mutex (gdb) frame 2 #2 0x1abb7984 in readerwait (frameinfo=0x1be08240, sem=0x1aad4000)

ios - Global Variables in Objective C++ -

all, i have numerous arrays in top of .m file : @interface viewcontroller () @property nsarray *alllogos; @property nsarray *allcontent; @property nsarray *allpostode; @property nsarray *allname; @property nsarray *alladdress; @property nsarray *alladdress2; @property nsarray *alllat; @property nsarray *alllong; @property nsarray *alllocationsid; @property nsarray *alllocationscity; i need these global arrays, methods can see these. have forgot how make sure these nsarrays can seen in methods in .m file. need because methods update these arrays , tableviews , pickerviews need use them .count etc. if want access following arrays in class don't make property in .m class.declaration in .m if want make private. @interface viewcontroller : uiviewcontroller @property nsarray *alllogos; @property nsarray *allcontent; @property nsarray *allpostode; @property nsarray *allname; @property nsarray *alladdress; @property nsarray *alladdress2; @property nsarray *alllat; @pr

java - Properties setting via Servlet -

i want set data configures.properties via servlet. configures.properties locating in web-inf/classes . how i'm getting data: public static string getdbpassword() { properties prop = new properties(); try { // load properties file inputstream in = configures.class.getresourceasstream(input_file); prop.load(in); // property value return prop.getproperty("dbpassword"); } catch (ioexception ex) { ex.printstacktrace(); } return null; } but how set? how did: public static void setdbpassword(string str) { properties prop = new properties(); try { //load properties file inputstream in = configures.class.getresourceasstream(input_file); prop.load(in); prop.setproperty("dbpassword", str); prop.store(new fileoutputstream(input_file), null);