Posts

sql - Is there any inbuilt stored procedure which will return the output of a query as an XML document..? -

is there inbuilt stored procedure in sql-server return output of query xml document..? need convert result of query or stored proc xml of desired format , save xml desired folder. there several ways. blog post shows some.

asp.net mvc - Performance in MVC web application -

Image
i struggling performance in mvc application.i loading partial page (popup) taking hardly 500ms. each time popup loads downloads 2 jquery files well. possible use jquery cache or parent page? i have attached image in red shows 2 additional request server. in order improve performance can try following approaches: see if application server supports gzip , configure application/server return responses archived in gzip use minified version of jquery there packing libraries can pack imported resources, such css files , js files, , browser 1 request per resource type. instance, in java have library called packtag. in general, recommend using google chrome browser , performance analyzer. give hints.

sql - how to search for an id from a group of id using mysql? -

in table have feild user_ids . user_ids feilds containeing values 12,45,78,95,21,78,98 what need need mysql query search specific id(for ex:45) in feild. i used like operator not working expected. ex: when search 5 return tru, id 5 not in list. i know there default function available in mysql . could pls me... my query. select * `friendslist` `users_id` '%'.$id.'%'; nb: dont know whether question meets standard,pls dont down vote. pls me.... this works: select * friendslist find_in_set( $id, users_id ) <> 0

asp.net - how to split the string in LINQ? -

i have bind search results in grid view based on search criteria. in database primary store id value 10,12. when select particular primary store id dropdown list i.e. 10, search result corresponding primary store id need shown in grid view.how that? public static list<searchkeyword> getallkeywords(string key, string primarystoreid, string keywordstatus, int keywordid, string categoryname, string subcategoryname) { keys = db.searchkeywords.where(c => c.keyword.contains(key) && (c.primarystoreid == primarystoreid || c.primarystoreid.split(',').tolist().contains(primarystoreid)) && (string.isnullorempty(categoryname) || c.storecategorymapping == categoryname) && (string.isnullorempty(subcategoryname) || c.storesubcategorymapping == subcategoryname)).tolist(); } edited! assumption -- search db.searchkeywords elements in attribute primarystoreid (a comma separated list) contains key. ...

jquery - Passing parameters to Javascript Function -

this view in ruby on rails.i need make call removehistory function when image clicked <div class=float-right> <img src="/images/active_star.png" onclick="removehistory('<%= detail.message%>')" /> </div and script looks this: <script type="text/javascript"> function removehistory(text){ alert(text); } </script> this works fine when details.message contains no single or double quotes. need do, make single or double quotes work? try <%= j detail.message %> or <%= escape_javascript detail.message %> i not sure j alias escape_javascript in rails < 4

java - What is the difference between OMNode and OMElement in AXIOM -

what differences , usages between omnode , omelement in axiom ? have implemented xml parser , used both of objects in implementation. omelement sub class of omnode ? as example both behaves in same way: @ this //omelement omelement omelement = nodeelement; string attributevalue = ((omelementimpl) omelement).gettext(); //omnode omnode omnode = nodeelement; string attributevalue = ((omelementimpl) omnode).gettext(); both support casting , in same way first of all, code refers omelementimpl . shouldn't that. name of class (and name of package contains class) indicates, implementation class should not used directly in application code. anyways, cast omelementimpl useless because gettext method defined omelement interface. to answer question, yes, omelement extends omnode , can see in javadoc: http://ws.apache.org/axiom/apidocs/org/apache/axiom/om/omelement.html as name indicates, omelement represents xml element. omnode on other hand implemented axiom cl...

c# - wp8: programmatically created textblock is not displayed in app? -

well, i have created textblock programmatically in c#. not displayed in app. whats wrong ? here's updated c# code: double left = 0, top = 15, right = 0, bottom = 0; double left1 = 0, top1 = 12, right1 = 0, bottom1 = 12; textblock filename = new textblock(); filename.margin = new thickness(left, top, right, bottom); filename.fontsize = 30; filename.foreground = new solidcolorbrush(colors.white); filename.textalignment = textalignment.center; filename.text = "hello"; stackpanel content = new stackpanel(); content.margin = new thickness(left1, top1, right1, bottom1); content.setvalue(grid.rowproperty, 0); content.children.add(filename);; you've added textblock stackpanel haven't added stackpanel visual tree. assuming want add layoutroot , can this layoutroot.children.add(content); as side note, there...

java - Libgdx game slower and slower on restart -

i'm testing game , i've encountered problem. main game class restarting (not whole application) when user dies, whenever restarts, runs slower , slower. i'm thinking of possible memory leak. i'm switching on screen screen setscreen(screen sc) method. i'm cleaning in dispose() method, , can't find reason. so i'm asking maybe point me in direction causing app slow down on restart? it might shaperenderer since i'm rendering huge amount of shapes in loops- maybe that's problem? app works perfect unill call new instance of main game class. there code post it, i'm sorry huge amount of text. hope somehow point me wrong! something might you. use jmap ( http://docs.oracle.com/javase/7/docs/technotes/tools/share/jmap.html ). jmap displays instances of objects held jvm. make runnable jar of game, start game, check jmap, die bit , check jmap again. maybe see increase in texture-objects might not cleaning of ( easy forget if using assetm...

javascript - Google Maps - center map on marker click -

i have following code placing several markers on google map. what want when user clicks on marker zooms in , centers map marker position (this bit that's not working - towards end of code in setmarkers function). any ideas? var infowindow = null; var sites = []; var partsofstr = []; var partsofstr2 = []; var bounds; $(document).ready(function () { $("select[id*='coordlist']").find("option").each(function () { partsofstr = $(this).val().split(','); partsofstr2 = $(this).text().split('^'); sites.push([partsofstr2[0], parsefloat(partsofstr[0]), parsefloat(partsofstr[1]), partsofstr[2], partsofstr2[1], partsofstr2[2], partsofstr2[3], partsofstr[3], partsofstr[4], partsofstr[5]]); }); initialize(); }); function initialize() { bounds = new google.maps.latlngbounds(); var mapoptions = { zoom: 6, center: new google.maps.latlng(54.57951, -4.41387), scrollwheel: false, ...

How to find substring in a string and return a new string with a number of characters surrounding the substring - Javascript -

first of new javascript. my question: let's have string this var str = "john doe in name used people no identity"; i need function 3 arguments like pullsubstring(text, string, number) it return new string this *length of number in strings* + string + *length of number in strings* to more specific here's example : if call function this pullsubstring("for", "john doe in name used people no identity", 5) the result "used peop" . you can use function: function pullsubstring(searched,text,borderslenght) { var idx = text.indexof(searched); if (idx == -1 ) return ""; var startfrom = idx-borderslenght; var endat = idx + borderslenght + searched.length; if (startfrom < 0) startfrom=0; if (endat > text.length-1) endat = text.length-1; return text.substring(startfrom,endat); } you have choose return when searched string not found (my funct...

c# - Return results from a call to Yield Return -

i find scenario return ienumerable using yield return statement, have other methods call function different parameters , directly return result. is there performance benefit iterating through results end yield return ing these opposed returning collection? i.e. if use return on resulting ienumberable rather looping through these results again , using yield return compiler know generate results they're required, or wait entire collection returned before returning results? public class demo { private ienumerable<int> getnumbers(int x) { //imagine operation more expensive demo version //e.g. calling web service on each iteration. (int = 0; < x; i++) { yield return i; } } //does wait full list before returning public ienumerable<int> getnumberswrapped() { return getnumbers(10); } //whilst allows benefits of yield return persist? public ienumerable<int> getnu...

linux - Can't rename a file name -

i have small bash script download , rename files. problem gibberish not standard characters bash can't understand. for example: �������� ���� ���'�-2.jpg my bash while read line; if [ ! -z "$line" ]; new_filename=$(echo "$line" | uniconv -encode russian-translit | uniconv -encode latin | tr -d '\[\]\!\@\#\$\%\^\&\*\(\)\?\'') mv "$line" "$new_filename" fi done <<< "$files_to_convert" why don't delete characters : sed 's/[^a-za-z0-9_\.-]//g'

android - Is it possible to change actionbar tab indicator programmatically -

Image
how can change programmatically selected tab indicator of action bar ? have read tab styling , , tab.setcustomview() method, none of these helps : with tab styles, can change indicator color, remain tabs (i want have indicator each tab). with tab custom view, have used layout textview tab title, , view managing indicator color. in java change view 's background dynamically, problem view 's background doesn't match tabs bounds. <textview android:id="@+id/custom_tab_text" android:layout_width="match_parent" android:layout_height="match_parent" android:layout_centerinparent="true" android:layout_centerhorizontal="true" android:gravity="center|center_horizontal" android:textstyle="bold"/> <view android:id="@+id/custom_tab_view" android:layout_width="match_parent" android:layout_height="10dp" android:layout_al...

c++ - What happens if i don't free/delete dynamically allocated arrays? -

this code not written bt me! in class webserver overload +=operator. class uses dynamically allocated array of objects of type webpage(another class, composition) defined webpage *wp; webserver & operator +=( webpage webpage ) { webpage * tmp = new webpage [ count + 1]; (int = 0; < count ; ++) tmp [i] = wp[i]; tmp [ count ++] = webpage ; delete [] wp; wp = tmp; return * ; } so create new array of dynamically allocated webpages space 1 object, assign them values wp held, , object wanted add array. if remove delete[] wp; program still works ok. happens if remove line of code? , wp=tmp, mean, wp new name dynamically suit name in class, location in memory still same? or? so if remove delete[] wp; program still works ok. happens if remove line of code? you have introduced memory leak . each time operator invoked process waste portion of address space until runs out of memory. and wp=tmp , mean, wp new name dynamically suit name in class, location in...

c# - How serialize one listener and don't serialize other listener of same event -

i have 2 objects(both serializable) in domain model , 1 winform control. first object , winform control listeners of same event of second object. want serialize second object first object listener , without winform control listener. class secondobject { public event eventhandler someevent; } class firstobject { secondobject object; object.someevent += secondobject_someevent(); } class winformcontrol { secondobject object; object.someevent += secondobject_someevent(); } right now, so: class secondobject { [field: nonserialized] public event eventhandler someevent; } class firstobject { secondobject object; [ondeserialized()] internal void subscribetoeventsondeserialized(streamingcontext context) { object.someevent += secondobject_someevent(); } } but can without nonserialized event? p.s. sorry bad english. frankly, advise: do not serialize events... ever . pure implementation, where-as seria...

c# - Cross thread error, but not using threads -

i keep getting cross-thread operation not valid: control 'keyholdertxt' accessed thread other thread created on. on various controls on various forms in project, , have googled , found lot's of responses how access stuff various threads, far know, i'm not using other threads in project, , change hundreds of possible places in code unmanageable. it never used happen, since added various code seems unrelated. include sample of places errors below, has occurred in many places on solution. keyholdertxt.text = "keyholders in:\r\n \r\n nibley 1: + keyholders"; or this, better example, can see happends form loading until error: private void identification_load(object sender, system.eventargs e) { _timer.interval = 1000; _timer.tick += new eventhandler(_timer_tick); _timer.start(); txtidentify.text = string.empty; rightindex = null; sendmessage(action.sendmessage, "place finger on reader....

javascript - How to achieve floating div on scrolldown -

i newbie on jquery, , want div hang on top of screen when page scrolldown more 50, how can achieve this? i want div absolute , not fixed. http://jsfiddle.net/8uccy/ $(document).ready(function () { $(window).scroll(function () { if ($(window).scrolltop() > 50) { $(".articlebutton").css("top", "0px"); //i want value change dynamically scrollbar moves down, div stays on top of screen } else { $(".articlebutton").css("top", "-50px"); } }); }); you can set position top -100 since -50 , scroll occurs after 50: $(".articlebutton").css("top", ($(window).scrolltop()-100)+"px");

classification - Using mahout in java code, not cli -

i want able build model using java, able cli folowing: ./mahout trainlogistic --input candy-crush.twtr.csv \ --output ./model \ --target hd_click --categories 2 \ --predictors click_frequency country_code ctr device_price_range hd_conversion time_of_day num_clicks phone_type twitter is_weekend app_entertainment app_wallpaper app_widgets arcade books_and_reference brain business cards casual comics communication education entertainment finance game_wallpaper game_widgets health_and_fitness health_fitness libraries_and_demo libraries_demo lifestyle media_and_video media_video medical music_and_audio news_and_magazines news_magazines personalization photography productivity racing shopping social sports sports_apps sports_games tools transportation travel_and_local weather app_entertainment_percentage app_wallpaper_percentage app_widgets_percentage arcade_percentage books_and_reference_percentage brain_percentage business_percentage cards_percentage ca...

Get row when checking checkbox in html table -

i have html table checkbox in 1 of columns. want know how row data when user clicks on checkbox javascript (without jquery)? can please me this? thanks you try this: html: <table> <thead> <tr><th></th><th>row text</th></tr> </thead> <tr> <td><input type="checkbox" /></td> <td>test</td> </tr> <tr> <td><input type="checkbox" /></td> <td>test 2</td> </tr> <tr> <td><input type="checkbox" /></td> <td>test 3</td> </tr> </table> javascript: checkboxes = document.getelementsbytagname("input"); (var = 0; < checkboxes.length; i++) { var checkbox = checkboxes[i]; checkbox.onclick = function() { var currentrow = this.parentnode.parentnode; ...

php - Fatal error: Class 'Zend_Locale' not found -

i'm developing web app zend framework 2. i want achieve urls current locale automatically built-in, i.e. /locale/controller/action/etc. wrote this: <?php $locale = new zend_locale(); ?> <ul class="nav"> <li> <a href="/<?php echo $locale->getlanguage(); ?>/devices">devices</a> <ul> <li> <a href="/devices/add"><img src="img/navbar/add.png" alt="+"> add</a> </li> </ul> </li> <li> <a href="/<?php echo $locale->getlanguage(); ?>/favorites">favorites</a> <ul> <li> <a href="/favorites/add"><img src="img/navbar/add.png" alt="+"> add</a> </li> </ul> </li> </ul> and put in navbar.pht...