Posts

Showing posts from January, 2010

java - how to decode byte array to bitmap without OOM Exception -

i stuck in out of memory. i’m trying load image byte array ever i’ve done wouldn’t work. bitmap decoder error guess. these code : string password = prefs.getstring("bookkey", ""); bufferedinputstream buf = new bufferedinputstream(new fileinputstream(file)); buf.read(bytes, 0, bytes.length); buf.close(); byte[] bytesdecrpy = decrypt(bytes, password); bitmapfactory.options options = new bitmapfactory.options(); options.indither = true; options.injustdecodebounds = false; options.inpreferredconfig = bitmap.config.argb_8888; options.intempstorage = new byte[32 * 1024]; options.inbitmap = bitmapfactory.decodebytearray(bytesdecrpy, 0, bytesdecrpy.length, options); bm = bitmap.createbitmap(options.outwidth, options.outheight, bitmap.config.argb_8888); imageview.setimage(imagesource.bitmap(bm)); i read byte array encrypt png device file i havin...

Use awk to selectively zero left-pad certain fields only -

my file has following format: 1/2/2559,11:58:00,4/1/2559,09:36:04,10,55,my name i want use awk (among other things) left-pad 0 6th column. for e.g., output may be: my name,1/2/2559/11:58:00,10,0055,4/1/2559,09:35:04 so in example above, both 5th , 6th columns number fields want left pad 1 of fields. the printf examples got other posts far (say using printf ($7,$1,$2,$5,"%04d\n",$6,$3,$4) seems scope in fields or terminates current row upon reaching field left-padded. would appreciate pointers on this, thanks. this doesn't match expected output posted don't see how input posted may you're looking for: $ awk -f, '{printf "%s,%s,%s,%s,%04d,%s,%s\n",$7,$1,$2,$5,$6,$3,$4}' file name,1/2/2559,11:58:00,10,0055,4/1/2559,09:36:04 if not edit question explain mapping between sample input , expected output. consider also: $ awk 'begin{fs=ofs=","} {$6=sprintf("%04d",$6)} 1' file 1/2/2559,11:58:0...

Google Maps API - How to add floating addres label over a marker -

in google maps, when click on marker label pops on marker. how can programmatically activate label starting marker? im putting answer reason name used google isnt overly intuitive specific use: https://developers.google.com/maps/documentation/javascript/examples/infowindow-simple if searching under same terms asked question can use link find answer.

shell - zsh function wrapping grep output only returns a few lines -

i'm trying create small zsh function allows me grep history - hgrep test should return every command i've typed containts test . on machine returns 6 results. when type history | grep test lot more results. gives? hgrep (){ history | grep $1 } the output - complete! ➜ ~ hgrep test 7887 mkd test 7889 rm -r test 7894 hgrep test 7896 history | grep test this incomplete output. also, notice first results much earlier ➜ ~ history | grep test 252 cp mgroup /test 254 cp mgroup /test 322 vi test.js 324 node test.js 325 vi test.js ... after poking around appears difference in behavior related when .zshrc sourced. on new terminal see unwanted behavior. if source ~/.zshrc works. however, i'm still confused why happen. it seems history command alias ed else (for example fc -l 1 ) after definition of hgrep function. so, put hgrep function definition after alias setups. or, define hgrep function (and functions) not ...

javascript - RethinkDB, add elements to an array that's nested -

using example here , i've added 1 more level notes , it's mapped object elements hold arrays { id: 10001, name: "bob smith", notes: { alpha:['note1','note2','note3'], beta:['note1','note2','note3'] } } cannot life of me figure out how append elements alpha , beta however. i've tried variations of this: update({ notes:{ alpha: r.row("alpha").append('note4') } }) but not getting anywhere. appreciated~ oh , error message no attribute 'alpha' in object: you following: r.db('test') .table('user') .get('10001') .update({ notes: { alpha: r.row('notes')('alpha').append('note4'), beta: r.row('notes')('beta').append('note4') } }).run();

c# - Generate one MVC model to be used in multiple views -

i'm new concepts of mvc , asp.net , i'm wondering if there possibility create object of model once , use throughout different views. i'm writing application gets json object through web service call contains information populate. web service call needs id create right json object. since json object quite large web service call takes 2 seconds download json object. when switching views model generated (including download of json object) every time, adds enormous overhead. generating different view models different views not work, since download bottleneck. any ideas how tackle problem? can downloaded json string stored somehow used in different views? possible download json object if id changes? regards something along these lines work: public actionresult myview(int someid) { string json = this.getjson(someid); var model = new myviewmodel(json); return this.view(model); } private string getjson(int id) { string cachekey =...

Required HTML template for web application release notes -

i want provide release note web application, , wanted know there readymade html template available on web ? here 1 apache software foundation https://github.com/apache/incubator-blur/blob/master/docs/release-notes.template.html

javascript - Make classes work with jquery after updated by jquery -

i working on project, want make click on object change class , afterwards making next click depend on same jquery. i can work first time - afterwards won't work. source follows: $(document).ready(function(){ $("a.activate").click(function(){ var elmid = $(this).attr('id'); $.ajax({ type: "post", datatype: "json", url: "/advertisement/activate", // url of perl script data: {adid: $(this).prev("input.ad_id").val()}, success: function(data){ if (data.error) { $('div#create_createresult').text(data.msg); $('div#create_createresult').addclass("text-danger"); $("form#createform input#createform_submit").removeattr('disabled'); } else { var src = $("a...

put H2 between Div jQuery -

i have this <h2></h2> <h2></h2> <h2></h2> <h2></h2> i want using jquery if can please <div class="dotted"> <h2></h2> </div> <div class="dotted"> <h2></h2> </div> <div class="dotted"> <h2></h2> </div> <div class="dotted"> <h2></h2> </div> try this, use .wrap() $('h2').wrap('<div class="dotted"></div>') demo

python - error using L-BFGS-B in scipy -

i puzzling result when using 'l-bfgs-b' method in scipy.optimize.minimize: import scipy.optimize optimize import numpy np def testfun(): prec = 1e3 func0 = lambda x: (float(x[0]*prec)/prec+0.5)**2+(float(x[1]*prec)/prec-0.3)**2 func1 = lambda x: (float(round(x[0]*prec))/prec+0.5)**2+(float(round(x[1]*prec))/prec-0.3)**2 result0 = optimize.minimize(func0, np.array([0,0]), method = 'l-bfgs-b', bounds=((-1,1),(-1,1))) print result0 print 'func0 @ [0,0]:',func0([0,0]),'; func0 @ [-0.5,0.3]:',func0([-0.5,0.3]),'\n' result1 = optimize.minimize(func1, np.array([0,0]), method = 'l-bfgs-b', bounds=((-1,1),(-1,1))) print result1 print 'func1 @ [0,0]:',func1([0,0]),'; func1 @ [-0.5,0.3]:',func1([-0.5,0.3]) def main(): testfun() func0() , func1() identical quadratic functions precision difference of 0.001 input values. 'l-bfgs-b' method works func0. however, adding round() f...

ios - UITextField doesn't scroll to the end after implementing textRectForBounds and editingRectForBounds in a subclass? -

i have uitextfield subclass implementing methods below: - (cgrect)textrectforbounds:(cgrect)bounds { return cgrectinset(bounds , 30, 7); } -(cgrect) editingrectforbounds:(cgrect)bounds { return cgrectinset(bounds , 30, 7); } because of these 2 methods, uitextfield doesn't scroll end when text entered gets bigger width of uitextfield . there solution this? its not working because of font size of text have declared in uitextfield , cgrectinset applying. should per font size setting. example, font size of 14.0, change method below: - (cgrect)textrectforbounds:(cgrect)bounds { return cgrectinset(bounds , 30, 6); } -(cgrect) editingrectforbounds:(cgrect)bounds { return cgrectinset(bounds , 30, 6); } the reason drawing rectangle of text. example, when set font size of uitextfield 14.0 requires @ least height of 18.0 adjust text in frame. needs 4 pixel around text, can overlay frame. due which, in case, condition not satisfying because far guess have...

python - float64 to float32 Cython Error -

i've created cython code make matrix operations between dense matrix , sparse vector,as follows (as i'm learning cython i'm not sure code, it's best come far): import numpy np cimport numpy np ctypedef np.float64_t dtype_t ctypedef np.int32_t dtypei_t cimport cython @cython.boundscheck(false) @cython.wraparound(false) @cython.nonecheck(false) def cdensexsparse(np.ndarray[dtype_t, ndim = 2] y, np.ndarray[dtype_t, ndim = 1] v, np.ndarray[dtypei_t, ndim = 1] i, np.ndarray[dtype_t, ndim = 1] = none): """ computes = y * (v_i) """ if y none: raise valueerror("input cannot null") = np.zeros(y.shape[1]) cdef py_ssize_t i, indice cdef dtype_t s in range(a.shape[0]): s = 0 indice in range(len(i)): s += y[i[indice], i] * v[indice] a[i] = s return it works fine. when change third lin...

android - ViewPager is empty after replace transaction of fragment -

| btn1 | btn2 | btn3 | btn4 | =---------------------------= container =---------------------------= hi there, i'm having 4 buttons make fragment transaction view pager fragment. first click on buttons works fine, second click causes view pager empty although values in adapter correct container empty (offset pages empty if i'm swiping create other pages correctly!) madapter.notifydatasetchanged(); for view pager adapter didn't work out. , option : public int getitemposition(object object) { return position_none; } is create pages beginning cannot done need save of views , pages. the solution have in mind run on current page , offset: madapter.instantiateitem(mpager, mpager.getcurrentitem()); madapter.instantiateitem(mpager, mpager.getcurrentitem() + ); is there clean , nice solution solve issue? thanks help

xcode5 - Where is objc_msgSend once you upgrade to Xcode 5? -

this code working yesterday: id urlnsstring = objc_msgsend(objc_getclass("nsstring"), sel_registername("stringwithutf8string:"), "http://zmangames.com/product-details.php?id=1246"); objc_msgsend(objc_getclass("eaglview"), sel_registername("openurl:"), urlnsstring); i upgraded xcode 5, , says function not defined. i'm doing #include <objc/message.h> #include <objc/objc.h> #include <objc/runtime.h> which seems in /usr/include/objc, , seems include definitions of function. don't other complaints whole project. codesense says definition looks this: objc_export id objc_msgsend(id self, sel op, ...) __osx_available_starting(__mac_10_0, __iphone_2_0); try #import <objc/runtime.h> instead.

c# - Why is Unity (P&P) loading very slow in Windows XP 64 bit SP2? -

i've created new windows forms .net v3.5 solution , added patterns , practices unity references following command using package manager console on visual studio: install-package unity -version 2.1.505.2 to simplify, little app doesn't trying instantiate unitycontainer in loading method: private void form1_load(object sender, eventargs e) { stopwatch stopwatch = stopwatch.startnew(); new unitycontainer(); stopwatch.stop(); debug.writeline(string.format("winforms unity initialization took {0}", stopwatch.elapsed)); this.close(); } on windows 7 runs quickly, process exits in less second. stopwatch log shows less millisecond instantiate unity. in windows xp 64 bit sp2 experience time of 30 seconds until little app quits, debug log still shows instantiating unity took less millisecond . so thought maybe long time has jit compiler producing native code unity's il code: i've used ants performance profiler in order deter...

XSLT pivot data by date -

i have xml records show sales date. need pivot information table shows sales week. here xml: <?xml version="1.0"?> -<data> <report datetime="9/24/2013 10:27 am"/> <reportnumber displayas="report number">7</reportnumber> <businessdate displayas="business date">08/19/2013 08/25/2013</businessdate> <businesssiteids displayas="store">nebo enchiladas</businesssiteids> <colheaders> -<colheader day7="08/25/2013" day7name="sunday" day6="08/24/2013" day6name="saturday" day5="08/23/2013" day5name="friday" day4="08/22/2013" day4name="thursday" day3="08/21/2013" day3name="wednesday" day2="08/20/2013" day2name="tuesday" day1="08/19/2013" day1name="monday"/> </colheaders> <row reportamtdaily="0.00...

java - Understanding Maven Dependencies -

i new using maven build projects. understand declare dependencies inside pom file outline jars needed project added build @ compile time. my question is, how work during development, when need jar file in order develop application? thought point of maven don't have have jar file, gets acquired , put war @ build time. if i'm developing , need jar file (say jersey example), still need go out , grab jar myself , put in lib directory in order development work, right, know classes/methods available me in .jar? can explain me missing? will import statements reference jersey classes resolved @ compile time, since right underlined in red since jar not present? once have specified dependency in maven pom, maven's responsibility download it. remember maven not bothered whether code has dependency on jar. in ide create maven project [not simple java project], add dependencies in pom, when save pom, dependencies downloaded. if dependencies not getting downloaded need c...

java - Does Mysql execute statement synchronously in one connection? -

connection connection = drivermanager.getconnection("jdbc:mysql://localhost:3306/","root", "password"); let's in java, can create mysql connection via code above. connection object, can create few statement objects below: statement = connection.createstatement(); i know, if execute statement object (by calling statement.executequery ) in different threads, execute synchronously or asynchronously in mysql database? because know is, 1 connection in mysql handled 1 thread, thinking is, statements created connection schedule in queue. correct? so, if have servlet below: public class helloservlet extends httpservlet { connection connection = drivermanager.getconnection("jdbc:mysql://localhost:3306/","root", "password"); public void doget(httpservletrequest request, httpservletresponse response) throws ioexception, servletexception { statement = connection.createstatement(); } ...

c# - Add a video to a data table in visual studio -

am able add video data table in local db. , if data type. using file upload controller upload videos , have 3 fields title, category & description. best practice or there other/better way of doing it? any appreciated thanks why want save whole of file database? can save path of uploaded video database , fetch path when needed.

wcf - Converting Json to .NET Object collection -

as part of wcf service, convert datatable json. on client side, want able convert json response .net collection. want able keep dynmaic, , bind data grid. trying figure out best way this. jay define collection , class properties match json data - use javascriptserializer class. bind grid collection: class acollection { public ienumerable<someclass> someclasslist { get; set; } } class someclass { public string field { get; set; } } javascriptserializer jsserializer = new javascriptserializer(); acollection list = jsserializer.deserialize<acollection>(jsonstring);

https getting converted to http -

i using microsoft iis proxy requests weblogic server. i've enabled https on iis. [http://webserver gives error 'page must viewed on https' , https://webserver gives content of default.htm file] i've enabled https on weblogic server. [http://weblogic:7001/myapp/test.jsp , https://weblogic:7002/myapp/test.jsp both works] communication b/w iis , weblogic server on https. the issue when access application on https using webserver url (https://webserver/myapp/test.jsp) response (content of test.jsp) when print request.getrequesturl() in filter, http url (http://webserver/myapp/test.jsp) . causing issue while doing sendredirect()... why https urls getting converted http? idea? thanks. following solved issue: if plug-in communicating weblogic application server following – environments > servers > select server > general > advanced > check weblogic plug-in enabled thanks again.

c# - Error with second dropdownlist in DataList -

i have datalist have 2 dropdowns: first select table , second select column. far good. the problem starts when go next item in datalist , make selection on dropdownlist "ddltable". after doing this, second dropdownlist of previous changes value first possible item. can me out? how can stop doing this? here code: protected void page_load(object sender, eventargs e) { try { scriptmanager scriptmanager = scriptmanager.getcurrent(this.page); if (!scriptmanager.isinasyncpostback && !ispostback) { datalist_load(datalistitems); } } catch (exception ex) { throw ex; } } protected void datalist_load(int itens) { try { list<int> mylist = new list<int>(); (int = 0; < itens; i++) mylist.add(i); dlquery.datasource = mylist; dlquery.databind(); } catch (exception ex) { throw ex; } } protected void dlquery...

python - 'sleepymongoose' is not defined? -

i trying set sleepy.mongoose, mongodb rest interface using instructions here. i using windows 8, :( ...anyway... have python 3.3.2 installed , accessible cmd prompt. have pymongo installed, when enter help('modules') python, pymongo on list of available modules! but when try run python httpd.py sleepy.mongoose dir (thanks karthikr), error: c:\users\brook\desktop\sleepy.mongoose>python httpd.py traceback (most recent call last): file "httpd.py", line 1, in <module> sleepymongoose/httpd.py nameerror: name 'sleepymongoose' not defined now tried cd ing proper dir, other error: c:\users\brook\desktop\sleepy.mongoose\sleepymongoose>python httpd.py file "httpd.py", line 221 print "\n=================================" ^ syntaxerror: invalid syntax you using python 3 run python 2 code. syntax print amongst other things has changed. use python 2 or server...

c++ - array initialization unknowledge -

i know basic way initialize arrays.i error on compiler int array initialize on constructor not understand it.i need help. code is: cpp file: #include <iostream> using namespace std; #include "validationcontroller.h" validationcontroller::validationcontroller() { // todo auto-generated constructor stub monthtable[12]={0,3,3,6,1,4,6,2,5,0,3,5}; } validationcontroller::~validationcontroller() { // todo auto-generated destructor stub } and header file: #ifndef validationcontroller_h_ #define validationcontroller_h_ class validationcontroller { public: int monthtable[];//={0,3,3,6,1,4,6,2,5,0,3,5}; validationcontroller(); virtual ~validationcontroller(); }; #endif /* validationcontroller_h_ */ the error is: ..\src\validationcontroller.cpp:13: warning: extended initializer lists available -std=c++11 or -std=gnu++11 [enabled default] and ..\src\validationcontroller.cpp:13: error: cannot convert '' 'int...

json - getting a value of a known key in php failing -

i know it's syntax, can't find problem. i use loop turn json keys variables this: sent json: [{\"name\":\"dolly\",\"page\":\"a4\"}] $object = json_decode(stripslashes($_post['mydata'])); foreach ($object[0] $key => $value) { $$key = preg_replace('/--+/',' ',$value); } so now, eg, have $page = "a4". works fine. now, rather looping through that, want access 'page' key (that know going there every time), , disregard else. i thought it, falls on "cannot use object of type stdclass array": $object = json_decode(stripslashes($_post['mydata'])); $page = $object[0]['page']; this doesn't error out, returns nothing: $object = json_decode($_post['mydata']); $p = $object[0]->page; as does $p = $object->page; what screwing here? thanks taking look. you need combine approaches ;-) $object = json_decode(stripsla...

Embedding AngularJS view -

i have angularjs application believe pretty typical (alike many of examples). <html ng-app="myapp" ... <body> ... <div class="main" ng-view></div> ... there's $routeprovider i've set whole lot of when s direct users view (template partial controller), such as: $routeprovider.when('/incident/:identifier', {templateurl:'incident.html', controller:"incidentctrl"}); this working fine. users can go , forth between views. now, let's have view "incident". has form properties of "incident". (you can change values in form , "save", besides point here.) have following requirements: "add work order" button below existing form when button clicked, form (partial) loaded below existing form enter details new "work order" "save" button part of loaded form (partial) save new "work order" the form (partial) closed, unloaded or ...

bdd - behat fails with javascript but succeeds without -

i'm writing acceptance tests php application using behat/mink , found out strange thing: behat can not find input field when javascript on, while finds same field when javascript off. to precise: following scenario scenario: adding article keywords, no javascript used given on "articles/create" when fill in "articles[title]" "about properties" ... passes perfectly. add tag javascript above scenario @javascript scenario: adding article keywords given on "articles/create" when fill in "articles[title]" "about properties" it starts fail: when fill in "articles[title]" "about properties" # featurecontext::fillfield() form field id|name|label|value "articles[title]" not found. what might reason? the @javascript run feature using selenium driver, selenium may take time load page, try adding step 'i wait ...' right after 'i on ...'. hopefully, it...

64bit - Using Python API on Multi-Arch Linux -

i have code uses python api i'm going compile on debian wheezy 64 bit operating system , following error in compile time: /usr/include/python2.7/pyport.h:873:2: error: #error "long_bit definition appears wrong platform (bad gcc/glibc config?)." i've done search couldn't find out how should use 32 bit packages. i've installed ia32-libs , g++-multilib on wheezy still having stupid error. i've opened pyport.h , found error line: #if long_bit != 8 * sizeof_long /* 04-oct-2000 long_bit apparently (mis)defined 64 on recent * 32-bit platforms using gcc. try catch here @ compile-time * rather waiting integer multiplication trigger bogus * overflows. */ #error "long_bit definition appears wrong platform (bad gcc/glibc config?)." #endif from other threads got on multi-arch system there should folder this: /usr/include/ thanks in advance

javascript - JS not working in pc but works on JSFIddle -

the code works in jsfiddle not working when put on html file. can't find error myself. here working link fiddle demo and bellow code not working: <!doctype html public "-//w3c//dtd xhtml 1.0 transitional//en" "http://www.w3.org/tr/xhtml1/dtd/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="content-type" content="text/html; charset=utf-8" /> <title>untitled document</title> <script type="text/javascript" src="http://code.jquery.com/jquery-1.10.1.min.js"></script> <script type="text/javascript"> $('#checkbox1, #checkbox2').on('change', function () { console.log(); if ($('#checkbox1').is(':checked') && $('#checkbox2').is(':checked')) { $('#circle_2').css('background-color', '#999'); } else { ...

ios - NSURLconnection in a different class -

i'm trying develop app receive data web service displayed in views. in first version of app i've 1 view controller , 1 request web service (by means of nsurlconnection): methods nsurlconnection in viewcontroller , working well. now need add other views , make other requests thinking best thing apply mvc pattern: in particular have created class (fv_data) put requests , manage nsurlconnections, while in each viewcontroller call method (in fv_data class) needed request. my problem how return array data web service viewcontroller asked data: in first tests, nsurlconnection correctly started , array (in connectiondidfinishloading method) filled data web service in view controller array empty. i've read different posts can't understand i'm doing wrong. this code i've written (i omit code in methods work). thanks, corrado fv_data.h #import <foundation/foundation.h> @interface fv_data: nsobject { nsmutabledata *responsestatistic; nsmut...

error: ISO C++ forbids declaration of `__nomain' with no type -

i have simple c++ program here: #include <iostream> using namespace std; main () //no return type main. yet program compiles , runs ok { //when run itself. cout << "hi"; } but program no longer compiles if add blank unit test in file called newsimpletest1.cpp : #include <stdlib.h> #include <iostream> int main(int argc, char** argv) { } if run it, compiles , prints "hi" expected. if test project error: error: iso c++ forbids declaration of `__nomain' no type when add return type 'int' 'main', compiles , runs correctly. i'm trying figure out error trying tell me. i'm using windows xp compiling netbeans 7.1.2 using default g++ compiler. it says, in hosted environment, main should have type. quote c++ standard 3.6.1, paragraph 2 an implementation shall not predefine main function. function shall not overloaded. shall have return type of type int...

php - Split string into array then loop into HTML table -

i have string extracted database in example below. i'm trying loop through string html table display results in diagram. string can vary in length follow same format. $string = "18/05-01/06 01/06-06/07 06/07-22/08 22/08-14/09 dr record + 2 21.47 20.24 27.15 20.24 record + 2 24.05 22.68" _______________________________________________________________________ |18/05-01/06 | 01/06-06/07 | 06/07-22/08 | 22/08-14/09 | _______________________________________________________________________ dr record + 2 | 21.47 | 20.24 | 27.15 | 20.24 | _______________________________________________________________________ record + 2 | 24.05 | 22.68 | | | _______________________________________________________________________ everything i've tried doesn't seem work. ideas appreciated. this i've tried far $string = "18/05-01/06 01/06-06/07 06/07-22/08 22/08-14/09 dr record + 2 21.47 20.24 27...

ajax - CodeIgniter - Nothing is shown in the view -

i don’t know problem is. have ajax sends username controller: function my_profile(username){ $.ajax({ url: "member/my_profile", type: "get", data: "username="+username, success: function(){ window.location.href = 'member/my_profile'; } }); } and controller: function my_profile(){ $username = $this->input->get('username'); $data['username'] = $username; $this->load->view('my_profile' , $data); } i have echo $username test can alert(msg) ajax. works find. problem nothing shown in view: <h1>my profile</h1> <?php echo $username; ?> i don’t know why. tried initialized $data['username'] = 'adam' , works. the problem window.location.href = 'member/my_profile'; . redirect profile page without username value. you want do: window.location.href = 'member/my_profile?u...

php - Magento Admin Actions Log - How to capture mass action data? -

we've created module enterprise has 2 controller actions, 1 index , other save massaction. we're logging admin actions log following logging.xml: <?xml version="1.0" encoding="utf-8"?> <logging> <acme_productlabels translate="label"> <label>acme product labels</label> <actions> <productlabels_productlabels_print> <action>save</action> <post_dispatch>postdispatchgeneric</post_dispatch> </productlabels_productlabels_print> <productlabels_productlabels_index> <action>view</action> <post_dispatch>postdispatchsimplesave</post_dispatch> </productlabels_productlabels_index> </actions> </acme_productlabels> </logging> this uses custom route, added observer in config.xml accomplish th...

jquery - Remove inline CSS attribute from a subtag -

i used code: jquery $('a').css("line-height", "null") or $('a').removeattr('style'); html <div id="categories"> <nav> <ul id="nav"> <li class="first"> <a class="page_item_first" href="" title="home" style="line-height: 158px;">home</a> </li> </ul> </nav> </div> but didn't work. any advice please? that code works. load javascript/jquery scripts @ bottom of page.

php - Split output of .serialize() and create an insert statement for every splitted part -

i have 3 tables , output string .serialize() . tabel 1: parameter (parameterid, parametername) table 2: parametervalue (parametervalueid, parameterid_fk, appid_fk, parametervalue) table 3: app (appid, ..., ...) .serialize() output: 4=test&6=this test&9=19&15=bla bla bla&appid=19746 4 = parameterid, test=parametervalue, appid=19746 for every "part" of serialize output, want make insert statement, add parameterid , appid , parametervalue table parametervalue . how can split , add dynamically? "split" should done using php. use parse_str() : $str = '4=test&6=this test&9=19&15=bla bla bla&appid=19746'; $result = array(); parse_str($str, $result); print_r($result); output: array ( [4] => test [6] => test [9] => 19 [15] => bla bla bla [appid] => 19746 ) and now, insert , can loop through splitted array: foreach ($result $part) { // insert } demo!...

bash - Print the directory where the 'find' linux command finds a match -

i have bunch of directories; of them contain '.todo' file. /storage/bcc9f9d00663a8043f8d73369e920632/.todo /storage/bae9bbf30ccef5210534e875fc80d37e/.todo /storage/cbb46ff977ee166815a042f3deefb865/.todo /storage/8abcbf3194f5d7e97e83c4fd042ab8e7/.todo /storage/9db9411f403bd282b097cbf06a9687f5/.todo /storage/99a9ba69543cd48ba4bd59594169bbac/.todo /storage/0b6fb65d4e46cbd8a9b1e704cfacc42e/.todo i'd 'find' command print me directory, this /storage/bcc9f9d00663a8043f8d73369e920632 /storage/bae9bbf30ccef5210534e875fc80d37e /storage/cbb46ff977ee166815a042f3deefb865 ... here's have far, lists '.todo' file well #!/bin/bash storagefolder='/storage' find $storagefolder -name .todo -exec ls -l {} \; should dumb stupid, i'm giving :( to print directory name only, use -printf '%h\n' . recommended quote variable doublequotes. find "$storagefolder" -name .todo -printf '%h\n' if want process output: fi...

laravel - Laravel4 + Bootstrap: Icon + Warning message on the same line -

i have code warning messaging on validation on form: @if($errors->any()) <div class="alert alert-warning col-lg-12 centered"> <i class="glyphicon glyphicon-warning-sign"></i> <ul> {{ implode('', $errors->all('<li class="error">:message</li>')) }} </ul> </div> @endif it appear yellow box icon , errors. little issue icon on 1 line, , errors on line. how can keep icon on left, @ same line of errors? thank you add float left glyphicon like: .alert { float: left; font-size: 64px; margin-right: 32px; margin-left:16px; } example: http://bootply.com/84046

ios - UIButton modifying titlelabel seems to change its frame -

something strange happening. basically, trying recreate messaging app. when trying send button change grey blue when user has typed in @ least 1 character. the problem comes when trying change titlelabel, button disappear. later found out reverts old position (when keyboard not shown). why this? if not modify titlelabel works usual. however, if do, uibutton goes original location. if need sample code let me know, not sure put on here it's [self.button.titlelabel settextcolor: [uicolor bluecolor]; in uitextviewdidchange it's acting strange. thanks! alan you might fighting against auto-layout. saw similar behavior, , answered question here: why uibutton resize when access titlelabel property? . basically, suggested forego auto-layout or only use auto-layout (never set frames programmatically).

java - HashSet internally uses hashmap for its implementation, then why is hashmap faster than hashset? -

hashset internally uses hashmap implementation, why hashmap faster hashset? i tried reading above mentioned post in search unable find clear answer because hashset uses hashmap. must incur cost of using hashmap, plus overhead of hashset itself.

How do i prevent mongoid from saving default values when doing an update_attributes( )? -

is there way in mongoid? i existing fields stay nil , not take on model's 'default' property. there no way in mongoid, suggest open feature request https://github.com/mongoid/mongoid/issues/new

Ruby 2.0.0 doesn't work after update -

Image
i had ruby 1.9.3 installed on window box need run ruby 2.0.0 app installed pik , use switch between 2 different versions of ruby. i able switch between 2 versions when attempted run ruby 2.0.0 app, doesn't work. might had broken when changing path. or need install other gems supplement ruby 2.0.0? help, thought appreciated. (i installed ruby on rails using railsyinstaller window. why had ruby 1.9.3.) details: location of pik: c:\pik user path before attempting set ruby 2.0.0 default ruby version: c:\pik;c:\railsinstaller\git\cmd;c:\railsinstaller\ruby1.9.3\bin;c:\users\tina\appdata\roaming\npm; changed path to: c:\pik;c:\railsinstaller\git\cmd;c:\railsinstaller\devkit;c:\users\tina.pik\rubies\ruby-200-p195\bin;c:\users\tina\appdata\roaming\npm; i able run ruby 1.9.3 apps ruby 1.9.3, when attempted run ruby 2.0.0 app ruby 2.0.0 threw me error below:

c++ - can't pass function pointer to method in parent class through a variadic function--compiler bug? -

say have 2 structures, generic_a , generic_b . generic_b derived generic_a . why when generic_b tries access method in parent, generic_a , generates following error: test2.cpp: in function 'int main()': test2.cpp:26: error: no matching function call 'case1(void (generic_a::*)()' this code, compiled using gcc version 4.4.6, replicates problem: #include <stdio.h> struct generic_a { void p1() { printf("%s\n", __pretty_function__); }; }; struct generic_b : public generic_a { void p2() { printf("%s\n", __pretty_function__); }; }; template <class t,class... args> void case1( void (t::*p)(args...) ) { printf("%s\n", __pretty_function__); } template <class t> void case2( void (t::*p)() ) { printf("%s\n", __pretty_function__); } main() { //generates error case1<generic_b>(&generic_b::p1); //compiles fine case2<generic_b>(&generic_b::p1); } the apparent ...