Posts

Showing posts from May, 2011

ruby on rails - Alias/Override helpers loaded using ActiveSupport.on_load -

devise provide several helper methods such current_user . uses activesupport's on_load lazily load these helpers controllers. however means when first starts rails, attempt alias these helper methods not work correctly. example: # in applicationcontroller alias_method :devise_current_user, :current_user def current_user user = devise_current_user if !user && !devise_controller? foo end return user end this cause "method not found error" when rails first initialized. can start rails first, add these code, work (correctly aliasing , overriding method). how aliasing/overriding these on_load helpers?

if statement - Java Program in course not working -

i have been following java course http://www.programmingbydoing.com , stuck on 1 of assignments code here: http://pastebin.com/raw.php?i=si49cbn9 public static void main( string[] args ) { scanner keyboard = new scanner ( system.in ); int age; string name; system.out.println( "what name" ); name = keyboard.next(); system.out.println( "so " + name + "how old you? ") age = keyboard.nextint(); if ( age < 16 ); { system.out.println( "you cant drive"); } else ( age <= 17 ); { system.out.println( "you can drive, not vote." ); } else ( age <= 24 ); { system.out.println( "you can vote not rent car" ); } else if { system.out.println( "you can pretty anything" ); } } the assignments is: using if statements, else if, , else statements, make program displays different message depending on age given.

powershell - Get Disk IO performance counter -

i need page faults , disk io of system while particular process running. i can page faults not able disk io: $arraydio = @() $arraypf = @() $cmdprocess = start-process cmd -passthru while (-not $cmdprocess.hasexited) { $arraydio += %{ (get-wmiobject win32_perfformatteddata_perfproc_process).iowriteoperationspersec } $arraypf += %{ (get-wmiobject win32_perfformatteddata_perfos_memory).pagefaultspersec } sleep 2 } $arraypf | measure-object -average -maximum -minimum | out-file -filepath c:\details.txt $arraydio | measure-object -average -maximum -minimum | out-file -filepath c:\details.txt -append rather get-wmiobject , use built-in command getting performance data, get-counter : get-counter '\process(*)\io data operations/sec' get-counter '\memory\page faults/sec'

csv - Need to Change ids of records from SugarCRM Export for Accounts and Contacts -

i have bit of complex issue deal here @ moment , love please. i have exported data sugarcrm in csv format imported in new app. app works differently in terms of database schema. use auto-incrementing integers id's sugarcrm uses long alphanumeric strings dc4c072c-ec0e-26b6-8780-4a9e7ec8375d. i need able take data accounts , contacts, using sugarcrm pivot table export accounts_contacts, , change id's, while keeping them linked correctly. need use changed data import in database, each record in contacts table contains account_id field links them accounts, rather pivot table. now, first thoughts import required data in clean database , use lookup table 4 fields in change id's. have old_account_id, new_account_id, old_contact_id, new_contact_id. i'd use table find right id's , amend data. the issue have this, sql isn't amazing, i'm having difficulty visualising , writing query use lookup table , change data. love this. also, once have query , correc

java - Proper way to chain 2 async tasks in android -

i have 2 async tasks, namely task 1 , task 2. i need run task 1 first , task 2 after not want couple 2 calling task 2 in onpostexecute implementation of task 1; because use task 1 stand alone in other circumstances. i there way have 2 async tasks defined without being bounded each other , chain them in specific circumstances? thank help. you can try this: final executor directexecutor = new executor() { public void execute(runnable r) { r.run(); } }; asynctask.execute(new runnable() { task1.executeonexecutor(directexecutor, params1); task2.executeonexecutor(directexecutor, params2); }); i don't have android sdk on machine now, can't verify it.

c++ - Stack overflow due to too big char array -

c++ beginner here, encountered first stack overflow error ever! i've made program parses through 2 big files (a couple of million lines) 1 line @ time. subfunction below gets 2 ifstream objects (&referencepop , &wantedpop) , parses through them fstreams getline(). due few lines in files being really huge had increase size of charbuf arrays, program crashed stack overflow error... if make them small while loop break before reaching eof , if large = overflow... i have different version of program using std::string , std::stringstream parsing managed parse through whole file, painfully slow however. wanted try below , compare performance... is there way change charbuf arrays size match of getline each line? many lines few characters (char[128] should enough)... there performance hit having unnecessary large char arrays on these lines? char charbufa[512000], charbufb[512000]; char *next_tokena = null; char *next_tokenb = null; bool nextline; int c

Backbone.Marionette and Backbone.Paginator. CompositeView rerendering -

i'm working on infinite pagination ( http://addyosmani.github.io/backbone.paginator/examples/infinite-paging/index.html ) i'm using compositeview pagination view. and i've got following problem. each time after new portions of data paginator's collection removes old data , adds new makes compositeview rerender , erase old results. how can resolve problem? i'm thinking disabling rerender functionality how should done properly? thanks in advance! var basefeedchronocompositeview = backbone.marionette.compositeview.extend({ tagname: "div", template: _.template(chronofeedcomposite_html), itemview: article, events: { 'click #loadmore-button-manual': function (e) { e.preventdefault(); this.collection.requestnextpage(); }, appendhtml: function (collectionview, itemview, index) { collectionview.$("#chronofeed-content").append(itemview.$el); } });

C# get name of object as string -

i have object named 'account' , following code: account objacc = new account(); objacc.name = "test"; the above working fine, expected. have list of values follows: string props = "name,address,telephone"; now, want see if "name" exists in list. have object use though (hard coding case statement etc isn't possible object dynamic), objacc.name, somehow need "name" that, , see if it's in list. thanks in advance, hope it's clear enough, dave string test = objacc.gettype().getproperty("name") == null ? "" : objacc.gettype().getproperty("name").name; bool result = "name,address,telephone".split(',').contains(test); you may use following method if like: public bool propertyexists<t>(string propertyname, ienumerable<string> propertylist,t obj) { string test = obj.gettype().getproperty(propertyname) == null ? "" : obj.gettype().getpr

iphone - Rotating device while using accelerometer -

i'm using accelerometer in first cocos2d game , work fine, i'm able move sprite using below code however, when change orientation landscapeleft landscaperight, sprite stops responding y coordination, , sprite goes top of screen , doesn't respond... believe it's because of changing device orientation, i'm not sure since i'm pretty new app development, appreciated. here sample code i'm using... - (void)accelerometer:(uiaccelerometer *)accelerometer didaccelerate:(uiacceleration *)acceleration { //this determines how sensitive accelerometer reacts (higher = more sensitive) nsuserdefaults *defaulobj = [nsuserdefaults standarduserdefaults]; float sensitivity = [defaulobj floatforkey:@"sensitivity"]; //10.0f if (!sensitivity) { sensitivity = 6; } // controls how velocity decelerates (lower = quicker change direction) float deceleration = 0.4f; static float xval = 0; if (!self.isflag) { xva

android - Failed to initiate ap scan : how avoid it? -

i want make many ap scan htc phone under android 1.6. use method : wifimanager.startscan(); i want repeat 4 ms. problem : actually, logcat shows many times : "failed initiate ap scan". searched on website , found method : wifi.startscanactive(); but eclipse doesn't know it. if method exist android 1.6, better method case startscan? so main question : how can avoid message "failed initiate ap scan" in order improve rate of successful scan? it's not possible scan fast 4ms on android. you expect 400-500ms minimum depending on different phones. startscanactive() hidden api, can access via reflect method method = wifimanager.class.getmethod("startscanactive"); method.setaccessible(true); object r = method.invoke(null); // null static hidden method

passing value from html to python using django -

i have html page consists of tables . need send id of cells python whenever user clicks on 1 of cells : here's code i've used of : ############ the html file:(search.html) <body> <button type="button" action="/hello/" onclick="/hello/">try it</button> <table width="1000" table border="3"> <tr> <td ><div id="0" onclick="parent.location='{% url "view.search :request,454 " %}'">copy text</div></td> <td>hell</td> </tr> <tr> <td ><div id="1" onclick="copytext(id)">copy text</div></td> <td>hell</td> </tr> <tr> <td ><div id="2" onclick="copytext(id)">copy text</div></td> <td>hell</td> </tr> <table> </body> ########## python views file in django : def search(request,

while loop - PHP: Whileloop return all rows -

i having trouble in returning rows while loop. when checking print_r($item) it's returning rows when user return in while loop returning first row. think because return loop @ first time. so how can return rows.. here trying while($item = db_assoc($query)){ return '<p>'.$item['title'].'</p>'; } the while loop within class method , have return value can't use echo thanks lot.... like say, you're returning after first row. try following: $output = ''; while ($item = db_assoc($query)) { $output .= "<p>{$item['title']}</p>"; } return $output;

android - How to set color for each item listView -

if send text, edittext, listview want give color. how supposed that? could use hex-code too? tried far. code: @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_main); sendbutton = (button) findviewbyid(r.id.sendbtn); textbox = (edittext) findviewbyid(r.id.textbox); listview = (listview) findviewbyid(r.id.listview); arraylist<string> listviewlist = new arraylist<string>(); adapter = new arrayadapter<string>(this, android.r.layout.simple_list_item_1, listviewlist); listview.setadapter(adapter); sendbutton.setonclicklistener(new onclicklistener() { public void onclick(view arg0) { adapter.add("ik typte: " + textbox.gettext().tostring()); adapter.remove(textbox.gettext().tostring()); adapter.notifydatasetchanged(); } });} @override public boolean oncreateoptions

How can i find my current login status - facebook API android -

i using facebook login button integrate facebook login app. when press facebook login button , authenticates credentials , if done , change text log out & go inside app. now when use app , go out of app , when again come login screen. here see logout - authenticate myself before , didn't logout. so question how differentiate when logged in or session expired ? here code using: loginbutton authbutton; authbutton = (loginbutton) findviewbyid(r.id.authbutton); // set permission list, don't forget add email authbutton.setreadpermissions(arrays.aslist("basic_info", "email")); authbutton.setsessionstatuscallback(new session.statuscallback() { @override public void call(session session, sessionstate state, exception exception) { authbutton.setreadpermissions(arrays.aslist("basic_info", "email")); system.out.println("inside call");

jquery - How to make html pages editable on button click? -

i working play 2.1.0 , using jquery design html pages. looking functionality when user first time signs in website, ui should in readonly mode. when user clicks on "edit" button fields across web pages become editable @ time. after edits done, user can save changes , web pages become readonly again. i searched jquery plugins, plug-ins work in different way. make particular html element editable on jquery events. text box become editable if user click/doubleclick on particular textbox only. jeditable plugin http://www.appelsiini.net/projects/jeditable is there plugin available per requirement? or there other way implement required functionality? edit i solved problem having separate file edit , view. maintain variable in session, , based on value render edit or view page. <script type="text/javascript"> $(function() { $('#editbutton').click(function(){ $('.input').show(); $('.label').hide(); }); </script&g

javascript - How do I give a default string value to a null cell in BIRT? -

i new birt , javascript. have made report in null values represented blanks. want replace these blanks default string, eg "--". how current report being displayed: date temperature pressure weight colour 20130717 102 red 20130716 100 blue 20130715 20 150 the blank spaces correspond null values of columns in database. now, want report displayed in following manner: date temperature pressure weight colour 20130717 102 -- -- red 20130716 -- -- 100 blue 20130715 -- 20 150 -- i.e., cells null values replaced default string "--". how do in birt using javascript or other method? also, datasets of type varchar. you don't data source is, if sql data base, use 1 of these sql functions convert null, in sql que

CRM 2011 Online via an ASP.net application does not work, same code via Console Application Works -> "Authentication Failure"-error -

i'm trying connect crm 2011 online environment. i'm able connect via "console application", when i'm trying connect via "asp.net"-application same code, doesn't work, gives me " authentication failure "-error ({"an unsecured or incorrectly secured fault received other party. see inner faultexception fault code , detail."}). is there special need make work on "asp.net" environment. tested out several solutions found on internet, gives me same error. a "code"-snippet of simplified code: private static clientcredentials getdevicecredentials() { return microsoft.crm.services.utility.deviceidmanager.loadorregisterdevice(); } protected void button1_click(object sender, eventargs e) { //authenticate using credentials of logged in user; string username = "*****"; //your windows live id string password = "*****"; // password

joomla2.5 - how to make $get_db = &JFactory::getDBO(); work in scripts outside joomla 2.5 framework? -

for joomla 1.5 used following code lines database object, whats equivalent code joomla 2.5? used many codes seems not working, including found on stackoverflow itself... want call php script ajax update drop-down through db... , im getting error 500: internal server error // joomla 1.5 code define( '_jexec', 1 ); define( 'ds', directory_separator ); define( 'jpath_base', $_server[ 'document_root' ] ); require_once( jpath_base . ds . 'includes' . ds . 'defines.php' ); require_once( jpath_base . ds . 'includes' . ds . 'framework.php' ); require_once( jpath_base . ds . 'libraries' . ds . 'joomla' . ds . 'factory.php' ); $mainframe =& jfactory::getapplication('site'); $get_db = &jfactory::getdbo(); my script file im calling ajax has following code... still responding internal server error, dont knwo whats wrong includes oor constants, if remove lines except last, works fine ,

android - CheckBox in ListView multiple select -

good day all. i have list view checkboxes near each textview. when check 1 checkbox , scroll down, random other checkboxes checked. i've read post , couple others here , state of each checkbox needs saved in boolean list @ getview() . how go doing that? thanks. edited code: this code of adapter, containing getview() method. public class mycustomadapter extends baseadapter { public arraylist<error> list; private context mcontext; private layoutinflater minflator; public mycustomadapter(context context, int textviewresourceid, arraylist<error> list) { this.list = list; this.mcontext = context; minflator = (layoutinflater) mcontext.getsystemservice(context.layout_inflater_service); } @override public int getcount() { return list.size(); } @override public error getitem(int position) { return list.get(position); } @override public long getitemid(int position) { return 0; } @override publ

java - How to load properties file from property file and database at the same time in Spring? -

i have app.properties file,which define database connection configuration such as #datasource jdbc.driver=com.mysql.jdbc.driver jdbc.url=jdbc\:mysql\://localhost/test?useunicode\=true&characterencoding\=utf-8 jdbc.username= jdbc.password= and place dynamic properties in database,load custom implementation of abstractfactorybean ,follow q&a https://stackoverflow.com/a/4601913 and applicationcontext.xml <context:property-placeholder location="classpath:app.properties" order="1" /> <context:property-placeholder properties-ref="props" order="2"/> <bean id="datasource" class="org.springframework.jdbc.datasource.simpledriverdatasource"> <property name="driverclass" value="${jdbc.driver}" /> .... </bean> cannot find class [${jdbc.driver}] . how can make sure abstractfactorybean load properties first ?

email - Method to detect the event when the e-mail ‘send’ button is pressed in Corona SDK -

Image
i need detect event when the e-mail send button pressed in 1 of corona application. referring composing e-mail , sms (posted on january 3, 2012. written jonathan beebe). can not able find such methods. the action similar to: -(void)mailcomposecontroller:(mfmailcomposeviewcontroller*)controller didfinishwithresult:(mfmailcomposeresult)result error:(nserror*)error of objective-c . edit: i'm adding sample image too: appreciable... thanks valuable replies. per research , answers, concluded there no way detect mail send/cancel action in corona sdk till now. i've achieve that: if person pressed send button, scene should changed, else he/she must stay on same page (for further edit). so, have done trick achieve this. done is: created custom alert . called alert small delay when trigger native.showpopup() , alert come under e-mail popup. while press send/cancel mail , alert shown , ask person either have send mail or cancelled . yes = scene chan

if statement - Comparing a color range using either hex or decimal in javascript -

i extracting main color picture, , want call different function depending on whether red, blue, green, yellow, purple etc. (the more options can have, better). able is: if(color < maxcolorvaluered && color > mincolorvaluered) { function1(); } else { if { ..... where maxcolorvalue , mincolorvalue either hexadecimal or decimal color values, , values between count same rough color - specify (roughly) minimum , maximum red colors, example. so have 2 questions: 1) can compare hexadecimals? , how? make life easier if rather decimal. 2) got handy chart giving color ranges? ordinary charts (i.e. can find on google) doing head in . . . looking @ them, i'm not 100% sure can specify range that? basically, i'm not entirely sure doable way - have suggestions getting same end result way? thanks in advance help. i can answer #1. can compare hexadecimal number converting base of 10. this var h1 = "ffff00", h2 = "ffff01"; if (parseint(

javascript - How does Google news pull news link from different news sites? -

how google news pull information newspapers of world. making cross domain request news sites individually? far know, think cross domain feature depends on server configuration too, how google pull news dummy news website has nothing implemented cross domain requests. sure google doesn't have api google news. in general, how google news work. google copy data (using http clients running on own computers) other sites on own servers , present there.

javascript - Is it possible to paint any country with any color in google maps by country name? -

i want paint country color , cover in google maps. find way draw polygon coordinates: var mypolygon; var polycoords = [ new google.maps.latlng(40.96985437850034, 45.871337890625), new google.maps.latlng(40.936664923030236, 49.00244140625), new google.maps.latlng(39.76454453848205, 47.50830078125) ]; mypolygon = new google.maps.polygon({ paths: polycoords, strokecolor: "#ff0000", strokeopacity: 1, strokeweight: 2, fillcolor: "#ff0000", fillopacity: 1 }); mypolygon.setmap(map); it works, not possible (or difficult) find border coordinates of country. asume possible. approximately, not exactly. is there way cover country color it's name? example, our country - azerbaijan : " az ".

jquery - ALT followed by Q (custome shortcut) is not working with browser in javascript -

i trying implement keyboard shortcut application. want use alt + q combination. however, when try run code , press alt key, sets focus on browsers menu bar control , fails. i tried stop event propagation several methods like, function keydowneventhandler() { if (event.keycode == 18) { //stop code } } stoppropagation(event); canclebubbling(); return false; event.preventdefault(); still behaves way. edit - actually problem not detection. when user press alt key , release , q key pressed after that, highlights browser menu. doesn't call function custom shortcut. is default behaviour of browser ? can override ? please in same. thanks update here fiddle detecting "alt+q" sequence: document.onkeydown = keycheck; var previouskeycode = 0; function keycheck(e) { var keyid = (window.event) ? event.keycode : e.keycode; switch (keyid) { case 18: previouskeycode = 18; break; case 81:

Android - AutoCompleteTextView only works when backspacing -

i have autocompletetextview dynamically updates list of suggestions user types. problem type list gets updated drop-down isn't shown! when delete character (backspace) drop-down shows up! i tried explicitly call autotext.showdropdown(); after text change doesn't work. here textchangedlistener : private textwatcher textchecker = new textwatcher() { @override public void beforetextchanged(charsequence charsequence, int i, int i2, int i3) { } @override public void ontextchanged(charsequence charsequence, int i, int i2, int i3) { if(autotext.length()>9){ new geotask().execute(); } } @override public void aftertextchanged(editable editable) { if(autotext.length()>9){ autotext.showdropdown(); log.i("update","showdropdown"); } } }; i tried resetting adapter above autotext.showdropdown(); still nothing: autotext.setadapter(null); autotext

azure - How to get the unprocessed message count from a Windows Service Bus Subscription of specific type? -

i have 1 topic 1 subscription. i'm creating messages this: brokeredmessage messagetaska = new brokeredmessage("new task"); messagetaska.properties["type"] = "a"; brokeredmessage messagetaskb = new brokeredmessage("new task"); messagetaskb.properties["type"] = "b"; i have total messages, total messages of type a, total message of type b counters: 1) total of messages in subscription: subscriptiondescription desc = namespacemanager.getsubscription("topicname", "subscriptionname"); totaltask = desc.messagecount; 2) total of messages in subscription of type a: ???? 3) total of messages in subscription of type b: ???? it's possible without using receive , abandon functions ? maybe using filters ? thanks in advance rui this not straightforward message including properties sits in serialized mode in service bus. can't view property of message unless dequeue it. i can th

windows phone 8 - MVVM detailedpage navigation -

Image
i not entirely sure how explain this, best way can databoundapp in windows phone 8 templates, when user navigates detailed page of listbox item, want user able navigate through items swiping left or right. not entirely sure begin this, or how search online. i dont understand question if want user can scroll items scrolling left or right u have 2 option either use panaroma view or pivot view both same changes in transition .....

vb.net - change data grid view row colour depend upon the value -

Image
i have datagridview this: i binding datagridview this: dim cmd new sqlcommand("dashbordfetch", con.connect) cmd.commandtype = commandtype.storedprocedure cmd.parameters.add("@locid", sqldbtype.int).value = locid da.selectcommand = cmd da.fill(ds) dgvdashboard.datasource = ds.tables(0) i want datagridview have red row color when value 1. how can that? working in vb.net. i have tried code in 1 of answers provided, looks this: try private sub dgvdashboard_cellformatting(byval sender object, byval e system.windows.forms.datagridviewcellformattingeventargs) handles dgvdashboard.cellformatting dim drv datarowview if e.rowindex >= 0 ' add condition here ignore following if e.rowindex <= ds.tables(0).rows.count - 1 drv = ds.tables(0).defaultview.item(e.rowindex) dim c color if drv.item("value").tostring = "

java - Fetch the most recent inserted element in LinkedHashSet efficiently -

this question has answer here: java linkedhashmap first or last entry 10 answers according linkedhashset 's javadoc, keep insertion order of inserted elements using doubly linked list internally. it maintains doubly-linked list running through of entries. linked list defines iteration ordering, order in elements inserted set (insertion-order) if want fetch first inserted element, can use code like: linkedhashset.iterator().next() this give me first inserted element in set in o(1). i trying solve problem, requires me access recent inserted element set in o(1), , let's assume there not duplicated element inserted set. example, linkedhashset.add(2); // recent inserted element in set 2 linkedhashset.add(3); // recent inserted element in set 3 linkedhashset.add(5); // recent inserted element in set 5 linkedhashset.remove(5); // recent inserted

Spring MVC - HTTP status code 400 (Bad Request) for missing field which is defined as being not required -

i have spring mvc application controller method. @requestmapping(value = "/add", method = requestmethod.post) public string addnumber(@requestparam(value="number", required=false) long number) { ... return "redirect:/showall/"; } in jsp have standard html form posting value named "number" controller method above. however, if leave out value (do not enter text field) , post data controller, before controller method called browser shows http status 400 - required long parameter 'number' not present although controller method annotation defines "number"-parameter not required. does have slight idea of going on? thank you. ps: exception being thrown follows: org.springframework.web.bind.missingservletrequestparameterexception: required long parameter 'number' not present edit: spring 3.2.3.release bug ( see here ). version 3.1.4.release not have problem anymore. i came across same situat

asp.net - Session has Expired in IE 10,9,8 -

my source application embeds third party application in source application iframe problem when use scenario in ie 10,9,8 on first request session has expired on consecutive request works fine. cant understand issue because in firefox , chrome , safari working fine , on ie working fine on first request gives session has expired error. scenario: source application post form third party application , in return put result in iframe of source application . application developed in asp.net can 1 me how can issue solved. browsers handle cookies differently in iframe situations. think this comment describes you're seeing.

javascript - easyUI datagrid inner edit combobox cannot selected default value -

easyui datagrid inner editor load combobox cannot selected default value jsfiddle link {field: "xx", title: "xx", width: 200, editor: { type: "combobox", options: { valuefield: "xx", data: [ {"xx": 1, text: "aaa", selected: true}, {"xx": 2, text: "bbb"}, {"xx": 3, text: "ccc"} ], onloadsuccess: function(rows) { for(var i=0; i<rows.length; i++) { if(rows[i].selected) { $(this).combobox("setvalue", rows[i].xx); return; } } } } you can try change line for(var i=0; i<rows.length; i++) { to one for(var i=0; i<data.length; i++) { it's tested , working. or can onloadsuccess: function(rows) { $(this).combobox("setvalue",rows[-1].xx); } this select first value

Getting last position in master-file-log (MySQL replication)? -

how retrieve last position in master's log-bin? example when write change master to... can't see master's status don't know master-file-pos... on master machine in mysql type: show master status; mysql> show master status; +---------------+----------+--------------+------------------+ | file | position | binlog_do_db | binlog_ignore_db | +---------------+----------+--------------+------------------+ | mysql-bin.003 | 73 | test | manual,mysql | +---------------+----------+--------------+------------------+

.net - What exactly WPF runtime does after raising the PropertyChanged event of INotifyPropertyChanged interface -

i have been asked question in interview "when want reflect changed value of propery on view when updates binded propery in backend in viewmodel, raise event given implementing inofitypropertychanged interface." "so, question dont bind event handler propertychanged event, wpf run time it. so, happens right after raising propertychanged event viewmodel. in wpf, dispatcher handles most(maybe all) ui work items in loops, queues. different work items have different priorities dispatcher can handle items high priority in time. raising property changed event transfer data binding task , put in dispatcher's queue databinding priority. dispatcher manage item's position inside queue , execute it, update data binding here, @ appropriate time.

javascript - Adding row data at the top row using Jquery -

here code, doing right adding data table? here sample code ..i have table data already..when add item should add first row...right adding after existing data..any suggestions.. edit use $("#datatable").prepend(tr); demo

python - BeautifulSoup return unexpected extra spaces -

i trying grab text html documents beautifulsoup. in relavant case me, originates strange , interesting result: after point, soup full of spaces within text (a space separates every letter following one). tried search web in order find reason that, met news opposite bug (no spaces @ all). do have suggestion or hint on why happens, , how solve problem?. this basic code created: from bs4 import beautifulsoup import urllib2 html = urllib2.urlopen("http://www.beppegrillo.it") prova = html.read() soup = beautifulsoup(prova) print soup and line taken results, line problem start appear: value=\"giuseppe labbate ogm? non vorremmo nuovi uccelli chiamati lontre\"><input onmouseover=\"tip('<cen t e r c l s s = \ \ ' t t l e _ v d e o \ \ ' > < b > g u s e p p e l b b t e o g m ? n o n v o r r e m m o n u o v u c c e l l c h m t l o n t r e < i believe bug lxml's html parser. try: from bs4

ios - How to specify view transitions on iPhone -

maybe i'm missing obvious here, using mvvmcross , loading view via command: public icommand loadanotherviewcommand { { return new mvxcommand(() => showviewmodel<myotherview>()); } } how can hook in , control animation occurs during transition? currently, transitions left-to-right sliding transitions, it's confusing when user navigates view , sees same left-to-right transition. update: i've been trying figure out how use class derived mvxtouchviewpresenter achieve little success. think need overload either show(cirrious.mvvmcross.viewmodels.mvxviewmodelrequest request) and/or show(cirrious.mvvmcross.touch.views.imvxtouchview view) , can quite figure out how make work. imvxtouchview derived uiviewcontroller can't use in uiview.transition . also, determining view requested , view i'm coming seems little confusing. if @ request.viewmodeltype expect type of view model being requested , instead appears view model coming from.

css - Why does GMail ignore my inline <sup> styling in HTML email -

i make html emails , understand different email clients , browsers have different rules render code differently. 1 thing have never been able figure out though why following code ignored: <sup style="vertical-align:baseline; position:relative; bottom:5px;">1,2</sup> this i've come through trial , error best solution not messing line heights across different clients, pesky ie7. works , looks fantastic in except gmail, in lies on baseline , ignores bottom:5px . i've tried adding !important after each style, still nothing. i've tried making class well, again, same result. any ideas why it's ignoring code? gmail strips "interesting" css properties position when displying emails in web interface. done prevent email covering gmail's ui. here list of supported properties.

java - CDI Interceptors working only while using Jrebel -

i'm experiencing cdi interceptors binding issues , couldn't figure out wrong. while i'm developing using eclipse, jrebel agent active, interceptors work well, when deploy same application, @ same glassfish instalation, time ear file using asadmin command, interceptors ignored. same happens when turn jrebel agent off. i'm using glassfish 3.1.2.2 weld 1.1.11 , jdk 1.6. my application multi-module maven project like: app \--module-ejb1 (annotation , interceptor resides here.) \--meta-inf\beans.xml (with interceptor declaration) \--module-ejb2 \--meta-inf\beans.xml (empty one) \--module-jar \--meta-inf\beans.xml (empty one) \--module-war \--web-inf\beans.xml (empty one) \--module-ear my annotation: @interceptorbinding @target({ type, method }) @retention(runtime) public @interface audited { } my interceptor class: @audited @interceptor public class auditinterceptor implements serializable { [...] } my intercepted method: @over

jQuery .load() but exclude script tags -

i using following jquery load in 5 pages current page $('.main').load('main.cfm'); $('.bu1').load('bu1.cfm'); $('.bu2').load('bu2.cfm'); $('.bu3').load('bu3.cfm'); $('.bu4').load('bu4.cfm'); but each .cfm has following script tags in them <script src="js/jquery.speedometer.js"></script> <script src="js/jquery.jqcanvas-modified.js"></script> <script src="js//excanvas-modified.js"></script> <script> $(function(){ $('#mdtq').speedometer({ backgroundimage: "url(speedo/background-r.png)", maximum: 15, scale: 15, suffix: '' }); $('.changespeedometer').click(function(){ $('#mdtq').s

hadoop - Phoenix Installation with client gives exception? -

i have configured hadoop1.0.3 on 3 machines distributed mode.on first machine below jobs running: 1) 4316 secondarynamenode 4006 namenode 4159 datanode 4619 tasktracker 4425 jobtracker 2) 2794 tasktracker 2672 datanode 3) 3338 datanode 3447 tasktracker now when run simple map reduce job on it,it takes longer time execute map reducejob.so installed hbase layer on hadoop.now have below processes hbase on 3 clusters. 1) 5115 hquorumpeer 5198 hmaster 5408 hregionserver 2) 3719 hregionserver 3) 2719 hregionserver now installed phoenix according instructions: https://github.com/forcedotcom/phoenix#installation dont understand install phoenix client?? installed on same master machine not able invoke following command. ./psql.sh master(zookeeper name) ../examples/web_stat.sql ../examples/web_stat.csv ../examples/web_stat_queries.sql it gives below error: com.salesforce.phoenix.exception.phoenixioexception: retried 10 times @ com.salesforce.ph

php - how to use jquery plugin to view images in laravel -

i trying use image viewing plugin in laravel not able so. when used without laravel worked fine when using laravel not working whats reason , how solve it?? plugin using visual light box got https://github.com/visuallightbox/visuallightbox also image cropping plugin not working laravel whereas working fine when used alone. downloaded https://github.com/mkrmpotic/simple-image-crop/tree/master/public thanks in advance help...

jpa - Entity with EmbeddedId throw EntityNotFoundException when refreshing -

i'm facing weird issue : entitynotfoundexception keeps being thrown when refresh entity embedded id. the code : @entity public class { @embeddedid private apk pk; public a(int id, date date) { pk = new apk(id, date); } ... } @embeddable public class apk { private int id; @temporal(temporaltype.timestamp) private date date; ... } then, in ejb method : a entity = new a(1, new date()); em.persist(entity); em.flush(); em.refresh(entity); -> here's exception thrown stacktrace : javax.persistence.entitynotfoundexception: entity no longer exists in database: [id=1, date=25-07-2013 15:02]. i'm using glassfish v3.1.2 eclipse link 2.4.2 jpa provider (but did same embedded provider). could me please? thanks.

Translate custom values in CakePHP 2.3 -

how can use __( ) in cakephp translate variable/custom values ? like, strings, integer or decimal values? for example: __('you have $16.52 in wallet') i try use sprintf but doesn't work, that: sprintf(__("table %s can't have status changed busy. please check number , try again"), $table_num) using >= 2.0: __('you have %s in wallet', '$16.52'); as __() has %s replacement built in now.

Python fabric quotes issue -

spent more 30 mins of time in trying different possibly. i'm exhausted. can please me on quote problem def remote_shell_func_execute(): settings(host_string='user@xxx.yyy.com',warn_only=true): process = run("subprocess.popen(\["/root/test/shell_script_for_test.sh func2"\],shell=true,stdin=subprocess.pipe,stdout=subprocess.pipe,stderr=subprocess.pipe)") process.wait() line in process.stdout.readlines(): print(line) when run fab, get fab remote_shell_func_execute traceback (most recent call last): file "/usr/local/lib/python2.7/site-packages/fabric-1.6.1-py2.7.egg/fabric/main.py",line 654, in main docstring, callables, default = load_fabfile(fabfile) file "/usr/local/lib/python2.7/site-packages/fabric-1.6.1-py2.7.egg/fabric/main.py",line 165, in load_fabfile imported = importer(os.path.splitext(fabfile)[0]) file "/home/fabfile.py", line 18 process = run(&q

wpf - loading ResourceDictionary from baml using Baml2006Reader -

how can read through baml stream contains resourcedictionaory using baml2006reader , without acually instantiating the resourcedictionary ? i can ready through regular baml contains usercontrol fine , can examine xaml tree using baml2006reader.nodetype etc. but once reader hits resourcedictionary , baml2006reader.member.name "deferrablecontent" , baml2006reader.value contains memorystream can not parsed instance of baml2006reader . can't event instantiate reader: system.io.endofstreamexception occurred hresult=-2147024858 message=unable read beyond end of stream. source=mscorlib stacktrace: @ system.io.memorystream.internalreadint32() @ system.windows.baml2006.baml2006reader.process_header() @ wpfapplication10.assemblyextensions.read(stream stream, list`1 result) in d:\documents\visual studio 2012\projects\wpfapplication10\wpfapplication10\assemblyextensions.cs:line 84 innerexception: it seems whenev

ruby on rails - radio inputs not working with angular -

i'm using radio inputs in form, put same ng-model on both of them. can't value in controller, can value of other ng-model fields. you can find code on jsfiddle , codepen (none of them working reasons) here haml form %form.project{'ng-submit' => "createnewproject()"} .name %input{'ng-model'=>'name', :type => :text, :placeholder => 'name', :name => "name"} .description %textarea{'ng-model'=>'description', :placeholder => 'description', :required=>true, :name => "description"} .orientation %input#portrait{'ng-model'=>'orientation', :type=>"radio", :name=>"orientation", :value=>"1", :checked=>true} %label{:for=>"portrait"} %input#landscape{'ng-model'=>'orientation', :type=>"radio", :name=>"ori

jquery - How to setup click events on results returned via ajax? -

i returning set of links database via ajax, so: function search_friends() { = $('input.search_term').val(); $.ajax({ type: "post", url: 'lib/search.php', data: {who:who}, success: function(data) { $('.search_results').html(data); } // datatype: 'json' }); return false; } that return like: <div class="search_results"> <p><b>results:</b></p> user1 <a href="add_friend.php?pid=3" class="3">add friend</a> <br> user2 <a href="add_friend.php?pid=4" class="4">add friend</a><br><hr> </div> but page loads (before search done), have like: $('.search_results a').click(function() { alert('code'); }); but doesn't work because .search_results div returned via ajax. how solve problem? you tryi

active directory - How do I remove Login Prompt on intranet when using Windows Authentication? -

i trying auto authenticate users on intranet using ldap in vb.net (.net framework 2.0) as far know, need activate window authentication in iis , configure web.config file, doing wrong. 1. when access page login prompt -> i have read of solutions let me show have done sofar. 2. iis 7 enable windows authentication -> (win 2008 r2 enterprise) 3. web.config file -> 4. set ie intranet security settings -> image settings below http://i.imgur.com/dblg6ps.jpg but still no luck. when type in credentials seems work, searches ad perfect no errors, want remove prompt works automatic intended. can please?

c# - Convert from hexadecimal to float -

i have string array has hexadecimal values in it. want convert float array. tried code below doesn't give me correct results: bufferarray string array contains hexadecimal values. float[] dblbffrarry = new float[bufferarray.length]; (int = 0; < bufferarray.length; i++) { long parsed = long.parse(bufferarray[i], numberstyles.allowhexspecifier); dblbffrarry[i] = parsed; } can point way it? maybe like: float[] floatbffrarry = bufferarray.select(s => convert.toint64(s, 16)) .select(i => (float)i).toarray(); edit: a different interpretation of ask is: float[] floatbffrarry6 = bufferarray.select(s => convert.touint64(s, 16)) .select(i => bitconverter.tosingle(bitconverter.getbytes(i), 0)).toarray(); it's hard know want when don't give examples of inputs , outputs. for both examples, of course there's no need have .select after each other; can 1 .select if substitute 1 lambda arrow => other.

jquery.mmenu how to jump directly to a child page -

i'm using mmenu plugin jquery -- http://mmenu.frebsite.nl/ the problem i'm having when open menu, want jump page has entry best matching current breadcrumb. finding element isn't problem. example vehicles land cars trains water dingies i find item want display, trigger("open.mm") on it. so if try open "land" page, works. sets "vehicles" being opened, , i'm @ page cars , trains. however if try directly open cars page, nothing happens. sets styles on land , cars, vehicles page still 1 that's displayed. what's trick jumping directly 3rd level page? i've come workaround. find item in menu want open, walk menu tree , record of nodes along way, recoding them in stack. think open each menu stack in order root way menu intended open. there's visible scrolling of pages, work. // walk , build stack of menu items open var menutoshow: jquery = this.sidemenu.find("

oracle11g - Oracle 11g - doing analytic functions on millions of rows -

my application allows users collect measurement data part of experiment, , needs have ability report on of measurements ever taken. below simplified version of tables have: create table experiments( expt_id int, expt_name varchar2(255 char) ); create table users( user_id int, expt_id int ); create table samples( sample_id int, user_id int ); create table measurements( measurement_id int, sample_id int, measurement_parameter_1 number, measurement_parameter_2 number ); in database there 2000 experiments, each of has 18 users. each user has 6 samples measure, , 100 measurements per sample. this means there 2000 * 18 * 6 * 100 = 21600000 measurements stored in database. i'm trying write query avg() of measurement parameter 1 , 2 each user - return 36,000 rows. the query have extremely slow - i've left running on 30 minutes , doesn't come anything. question is: there efficient way of getting averages? , possible results amount of data in re

python - wxpython use the same static text twice in FlexGridSizer.AddMany -

i duplicate column headings in first python gui. have tried following bfont = wx.font(10,wx.default,wx.normal,wx.bold) angle = wx.statictext(panel,label="angle") angle.setfont(bfont) count_c = wx.statictext(panel,label="counts (c)") count_c.setfont(bfont) count_u = wx.statictext(panel,label="counts (u)") count_u.setfont(bfont) fgs.addmany([(angle),(count_c), (count_u), (angle),(count_c), (count_u)]) vbox.add(fgs, proportion=1,flag=wx.all|wx.expand,border=5) however shows me second set of headers. how can done? you cannot add same widget 2 different locations. instead, you'll have create separate widgets each row. since want same thing on each row, can use loop: import wx ######################################################################## class mypanel(wx.panel): """""" #-----------------------------------------------------------------

design - Is the use of CFLOCATION good/bad practice for "next step" operations? -

i design step-by-step processes (i.e. shopping cart) in following way: form posts itself on post, validate entries. if not valid, display form error messages. if valid, save entries (to session or database, etc.), send user next step/page using <cflocation /> . my question is, proper use of <cflocation /> ? looking @ definition tag, seems should used actual "moved files", considering sends http header response code default, , allows enter another, if needed. in case, there's no "moved files", want send user page after they've completed task. if @ iis logs, misleading, seeing bunch of 301s. i'm looking best practice principle here, assuming cannot re-engineer whole process use ajax. seems fine me. cflocation 302 redirect default, it's fine temporary redirects. unless you're specifying 301 statuscode?