Posts

Showing posts from July, 2015

f# - FSharp data type provider for Postgresql -

i trying fsharp data provider against postgresql using npgsql. , busted @ first line. when trying create sqldataconnection throwing error message connection string not correct. the type provider 'microsoft.fsharp.data.typeproviders.designtime.dataproviders' reported error: keyword not supported: 'port:5432;database'. now, test connection string , data using servicestack.ormlite. uses idbconnection. so, connection correct. don't know why type provider not working. here code. //type dbschema = sqldataconnection<connectionstring = "server=localhost;port=5432; database=testdb;user id=postgres;password=g00gle*92;" > [<climutable>] type person = { id : int; firstname : string; lastname : string } [<entrypoint>] let main args = let dbfactory = ormliteconnectionfactory ( "server=localhost;port=5432; database=testdb;user id=postgres;password=*****;",

facebook - Error Parsing URL Error parsing input URL, no data was scraped -

this yet question vague facebook error message: "error parsing url error parsing input url, no data scraped", other posts regarding issue went unanswered: #1. vincent guyard #2. daniel tiru #3. fernando quirino #4. user1964054 and list goes on.. our case bit different, have purchased new domain name , performed transition our old domain new one. before transition able promote , advertise our website on facebook. after transition cannot neither our new domain name nor our old domain, attempting general error message: "you've selected object cannot promoted. please choose different object". as if have been black-listed reasons beyond our knowledge. the transition self straight forward adding new binding our website on our iis server incoming requests our new domain name, is, have not changed our contents, nor did change in our website pages code or structure, or matter changed our ip or migrated server. when tried debug our url with:

android - Using ViewPager with sliding Screen always getting 5 pages? -

i using viewpager sliding screen given here : http://developer.android.com/training/animation/screen-slide.html . but getting 5 pages have changed num in activity .but still displaying 5 pages. there limit . if yes how overcome problem need show around 20 pages of this? please ? private static final int num_pages = 5; private class screenslidepageradapter extends fragmentstatepageradapter { public screenslidepageradapter(fragmentmanager fm) { super(fm); } @override public fragment getitem(int position) { return new screenslidepagefragment(); } @override public int getcount() { return num_pages; } } your adapter returning 5 getcount method. change size of collection

net.sf.jasperreports.engine.JRRuntimeException: java.io.IOException: can not reading font data -

i trying create pdf report via jasperreport there broblem reading font data. have jasperreports_extension.properties & relevant ttf files in classpath. here error: java.io.ioexception: problem reading font data. java.awt.font.createfont(font.java:924) net.sf.jasperreports.engine.fonts.simplefontface.<init>(simplefontface.java:69) net.sf.jasperreports.engine.fonts.simplefontfamily.createfontface(simplefontfamily.java:316) net.sf.jasperreports.engine.fonts.simplefontfamily.setnormal(simplefontfamily.java:85) net.sf.jasperreports.engine.fonts.simplefontextensionhelper.parsefontfamily(simplefontextensionhelper.java:243) net.sf.jasperreports.engine.fonts.simplefontextensionhelper.parsefontfamilies(simplefontextensionhelper.java:214) net.sf.jasperreports.engine.fonts.simplefontextensionhelper.loadfontfamilies(simplefontextensionhelper.java:183) net.sf.jasperreports.engine.fonts.simplefontextensionhelper.loadfontfamilies(simplefontextensionhelpe

ios - how to increase the width of two image view in a main view whose sizes are different and get variation in width when changing their orientation -

Image
how increase width of 2 image views located inside main view landscape orientation through uiinterface nib file portrait orientation, sizes of image view different 1 another? i need increase in width proportional default size. explain setting constraint in nib file. example, image view1 in left corner of main view , image view2 in right corner of main view.both of same height width different.first in portrait setting in nib file.while running changing portrait view landscape either 1 of sizes gets increased.but requirement need expand width of both image view original width size in correct ratio.for how set constraint in nib file the image requirement in portrait orientation, and need in landscape orientation as, here 1 more doubt cant make correct streching size in horizontal orientation orange , white (height mentioning here) colour image views. use autosizing functionality. more info try link: http://www.raywenderlich.com/20881/beginning-auto-

Simple cross table with PHP and MySQL query -

i have table: date name hours -------------- 11 peter 12:00 11 peter 11:00 11 john 10:00 12 peter 9:00 12 john 13:00 13 peter 10:00 13 john 16:00 etc... i need make mysql query , php cross table (not sure correct term) looks this: 11 | 12 | 13 ----------------------------------------- john | 10:00 | 13:00 | 16:00 ----------------------------------------- peter | 12:00 | 9:00 | 10:00 11:00 | so far got : select date, group_concat(concat_ws('|', name, hours) order name) schedule days group date but thing got stuck on populating , making table 1 above. try query: select name ,group_concat(case when date = 11 hours else null end) `11` ,group_concat(case when date = 12 hours else null end) `12` ,group_concat(case when date = 13 hours else null end) `13` days group name you can use dynamic query same: set @sql = null; select group_concat(distinct concat( 'group_c

testing - BASH test exist directory with a variable as path -

i simple test know if directory exist in bash script. directory path in variable. test works path of file not work variable. # if [ -d $test ]; echo ok; fi # >> ### no output ### # if [ -d ~/dir/ ]; echo ok; fi # >> ok # echo $test # >> ~/dir/ i define variable mysef : # test="~/dir/" i don't understand why not work variable whereas contains same path. thanks your test doesn't work variable because contains tilde ( ~ ). you can use eval recommended approach use ${home} instead of ~ in variable. try: test="${home}/dir" [[ -d $test ]] && echo ok

silverlight spreadsheetgear WorkbookView read only mode -

is there way switch workbookview in read mode? so user not allowed edit cells, paste cells, use autofill feature, change width/height of columns/row, still able switch between sheets , copy text cells. your best option might use worksheet protection. involve ensuring irange. locked set true cells don't want modifiable (all cells in worksheet have locked set true default) , enforcing worksheet protection via either: iworksheet. protectcontents iworksheet. protect ( password ) users restricted editing, pasting or otherwise altering cell contents, changing width/height of row/column headers...etc. user still navigate other sheets or copy cell contents worksheet protection enabled.

python - create a list from a functions output? -

i building financial model , stuck on last bit of model have produce graphs output of functions. below final function , didn't put other functions code them large. model shows how (customers, orders, netsales etc) evolve per day through out year different customer type. if run function customer type 12, run day 1 day 365 showing how customers or other stuff have grown. def show_all_states_list(cust_type): s = get_state0(cust_type) all_states =[] day in range(365): s = state_evolution(s, cust_type) all_states.append(s) return all_states output function day 1 is(not including output) when run in python: s = show_all_states_list(12) >>> s[0] {'day': 1,'custtypea_nondp': 50.99574423351457,'delfeea_dp_cost': 0.45111124745572373, 'today_ordersa_nondp':0,'profit_current_vs_with_dp ': -5.4141382286616135, 'gross_profit_nondp_dp': 35441.52120017628, 'fixed_costs_nondp_dp ': -56407

google maps - ActionBar progress spinner while Adding 1000's Markers to android Googlemap -

i have android application can add 1000's of markers extended googlemap using android maps extensions. use requestwindowfeature(window.feature_indeterminate_progress); while markers being added map takes 2 - 5 seconds. problems are: i have add 1000's markers on ui thread. the indeterminate spinner running on ui thread "sticks" while map markers being added. how run indeterminate spinner in own thread isn't affected 1000's of markers being added extended map? extended map settings using these: final fragmentmanager fm = getsupportfragmentmanager(); final supportmapfragment f = (supportmapfragment) fm.findfragmentbyid(r.id.map); mgooglemap = f.getextendedmap(); final clusteringsettings settings = new clusteringsettings(); settings.icondataprovider(new towericondataprovider(getresources())); settings.addmarkersdynamically(true); mgooglemap.setclustering(settings); update discovered root cause of addmarker() performance issue; every time

c# - Single WCF service for all inheriting class types -

i've got base class structure follows. class mammal { ... } class human : mammal { ... } class tiger : mammal { ... } class snake : mammal { ... } since service performing actions based on properties in mammal class only, see no need create separate web method each type (and 1 use conditional statement otherwise). the error i'm getting need declare translator or , given recall discussion (can't find now, though), wonder if that's doable @ all. remember telling me inheritance structure not possible recreate when working wcf. is there way solve or should keep number of exposed services same call receive input of different types each? edit to clarify i'm looking for, i'd runt following code. human human = new human { ... }; tiger tiger = new tiger { ... }; snake snake = new snake { ... }; serviceclient client = new serviceclient(); client.dostuffto(human); client.dostuffto(tiger); client.dostuffto(snake); client.close(); the signature service

javascript - How to make a Simon Js game based on arrays? -

im writing js simple simon game , im clueless on how it. i know : i need create 2 arrays, , level(score) variable a randomly generated number 1 4 (inclusive) needs added first array, when 1 of 4 buttons pressed, value of added second array, if second array not the same size or bigger first array. each time value added second array, check value equal value in same position in first array, if not, clear both arrays, , set levelvar 1, , alert "gameover" means if one wrong, cannot continue. if length of second array matches level variable, add random number array one, clear array two, increment levelvar. but, clueless in aspect code. my jsfiddle : http://jsfiddle.net/jbwcg/2/ js: var x = [] var y = [] var levelvar = 1 document.getelementbyid("test").onclick= function() { document.getelementbyid("test").innerhtml=x }; document.getelementbyid("button1").onclick= function() { x.push("red") }; document.getelementb

android - adding layoutWeightSum in a table row through java -

i want show table row 3 columns ( textview ) want divide table row in 3 equal parts. this possible setting layoutweightsum in tablerow in xml , making layout_weight=1 theww textview . but adding table @ run time through java , not xml. all know tablerow.layoutparameter not provide thing weightsum. how can this? tablerow.layoutparams pmrow = new tablerow.layoutparams(tablerow.layoutparams.match_parent, tablerow.layoutparams.wrap_content); you can achieve following code. tablelayout layout = //...findviewbyid layout.setstretchallcolumns(true); and make width 0dp children (views) of tablerow below. <textview android:id="@+id/txt_no1" android:layout_width="0dp" android:layout_height="wrap_content" android:text="hi" /> note above xml layout design, can create run time code also. demonstration.

mql - Freebase Obtain All Information On One Subject -

i'm trying find best way information displayed on freebase page via mql query. i've tried topic api includes lot of metadata. i've tried using links/reflection in: { "id": "/en/samsung_electronics", "/type/reflect/any_master": [{ "link": { "master_property": null }, "name": null, "id": null }], "/type/reflect/any_reverse": [{ "link": { "master_property": null }, "name": null, "id": null }], "/type/reflect/any_value": [{ "link": { "master_property": null }, "value": null }] } but means i'll missing information, such number of employees because that's given "dated integer" which, of course, doesn't automatically expanded , won't know have expand in general. best attempts @ expanding objects nesting query

jquery - Slide DIV from left after load the website -

i need create jquery script slide div <left: -200px> to <left: 0px> after page loads. i've tried following, doesn't work: $(window).load(function () { $("divid").css("margin-left", -$(this).width()).animate({ marginleft: 0 }, 1000); }); i have no idea why answering .... should , learn how ask question in stackoverflow first .. looks first time.. but anyways....what need $.animate() perform custom animation of set of css properties. $('#divid').animate({ left: '0' }, 5000);

passing a textbox value to a javascript function asp.net -

i having little difficulty one. trying pass textbox value javascript function , undefined instead. advice perhaps on how can variable function <input type="image" runat="server" id="btnsearchfunction" src="images/searchicon.png" name="image" onclick="searchcontent();" width="16" height="20" /> <input type="hidden" name="searchvalue" value="<%#txtsearch.value %>" /> <input type="text" runat="server" id="txtsearch" name="searchvalue" class="input-medium search-query" placeholder="search ..."/> and function trying pass to function searchcontent() { var txtboxvalue = $(this).parent().find("input[name='searchvalue']").val(); alert(txtboxvalue); } how more direct: var txtboxvalue = $('#txtsearch').val(); alert(txtboxvalue);

liferay - Error opening Tomcat Page at port 8080 -

i managed copy entire liferay+tomcat 7 bundle onto server. when run startup.sh file, tomcat produces following results in catalina.out : jul 25, 2013 12:22:01 pm org.apache.catalina.core.aprlifecyclelistener init info: apr based apache tomcat native library allows optimal performance in production environments not found on java.library.path: /data/java/jdk1.6.0_37/jre/lib/amd64/server:/data/java/jdk1.6.0_37/jre/lib/amd64:/data/java/jdk1.6.0_37/jre/../lib/amd64:/usr/java/packages/lib/amd64:/usr/lib64:/lib64:/lib:/usr/lib jul 25, 2013 12:22:02 pm org.apache.coyote.abstractprotocol init info: initializing protocolhandler ["http-bio-8080"] jul 25, 2013 12:22:02 pm org.apache.coyote.abstractprotocol init info: initializing protocolhandler ["ajp-bio-8009"] jul 25, 2013 12:22:02 pm org.apache.catalina.startup.catalina load info: initialization processed in 1965 ms jul 25, 2013 12:22:02 pm org.apache.catalina.core.standardservice startinternal info: starting service

c# - Innerhtml not returning style tag -

i have html content within div <div id="divprint"> looks like. <html> <head> <meta http-equiv="content-type" content="text/html; charset=utf-16"> <meta http-equiv="x-ua-compatible" content="ie=emulateie7"> <title>05 july 2013</title> <style type="text/css">.index-departmentheading, .index-gazettetitle { font-weight: bold; font-size: 8pt; margin: 12pt 0px 8pt; }.index-noticetype { font-size: 8pt; margin-top: 6pt; }.index-noticetitle { font-size: 8pt; margin-top: 4pt; }</style> <link type="text/css" rel="stylesheet" href="../styles/bwcommon.css"> <link type="text/css" rel="stylesheet" href="../styles/sitecommon.css"> <link type="text/css" rel="stylesheet" href="../templates/itax_generic.css"> </head> <body onload="if(parent.settools)parent.settools(

c - valgrind error in ioctl() call, while sending an i2c message -

valgrind giving me following error on ioctl() line: not sure how avert such error. ==2764== error summary: 1 errors 1 contexts (suppressed: 0 0) ==2764== ==2764== 1 errors in context 1 of 1: ==2764== syscall param ioctl(i2c_rdwr).msgs points uninitialised byte(s) ==2764== @ 0x4e08efec: ioctl (syscall-template.s:81) ==2764== 0x871f: imxsend_i2cmsg (imx6qi2c_wrapper.c:54) ==2764== 0x87cb: imxsend_i2cbyte (imx6qi2c_wrapper.c:84) ==2764== 0x86d3: main (imx6qi2c_test.c:30) ==2764== address 0x7db99b82 on thread 1's stack ==2764== uninitialised value created stack allocation ==2764== @ 0x875c: imxsend_i2cbyte (imx6qi2c_wrapper.c:66) the code in imx6qi2c_wrapper.c following: int imxsend_i2cmsg(const int i2c_fd, struct i2c_msg *i2cmsgarray, const unsigned int arraysize){ int ret=0; struct i2c_rdwr_ioctl_data ioctl_pack; ioctl_pack.nmsgs=arraysize; ioctl_pack.msgs=i2c

ios - Creating transitions on the navigation stack that show both source and destination views? -

the native push transition shows source view, , transition on destination view seamlessly. the modal transition shows destination view overlaying source view bottom. i'd modal transition works navigation controller. so far have this: cabasicanimation *anim = [cabasicanimation animationwithkeypath:@"transform.translation.y"]; anim.duration = .2; anim.autoreverses = no; anim.removedoncompletion = yes; anim.fromvalue = [nsnumber numberwithint:sourceviewcontroller.view.frame.size.height]; anim.tovalue = [nsnumber numberwithint:0]; [sourceviewcontroller.navigationcontroller.view.layer addanimation:anim forkey:kcatransition]; [sourceviewcontroller.navigationcontroller pushviewcontroller:destinationcontroller animated:no]; this in -perform method in segue subclass. problem navigation controller push done immediately, , while transition takes place, nothing of source vie

view - ExtJS 4.2.1, treepanel disappearing -

i working extjs 4.2.1 i have button make appear panel. this panel containing treepanel, 5 checkboxes below, , 1 valid button (to close treepanel , valid fact checked nodes) , 1 cancel button (just cose treepanel). i can make panel appear , works fine. if click on cancel or valid button, panel hide (ok), , next time try show it doesn't contain treepanel anymore, 5 checkboxes , 2 buttons (attention, 2 panels different, panel containing treepanel). i don't understand because there no reason disappear. when check treepanel console.log() can see, passing treepanel.store.tree.root treepanel still exists , filled. when pass through treepanel.view.all can see right elements present in view. when check treepanel.body.dom chrome debugging can't see element (ordinary when pass on dom mouse on chrome debugging can see corresponding part of page colored). here concerned part of code: var button = ext.get('productselectionbutton'); var treeselector = createtre

Having trouble installing gem devise for my Rails project -

after adding gem 'devise' gem file , running $bundle install, following: installing bcrypt-ruby (3.1.1) native extensions gem::installer::extensionbuilderror: error: failed build gem native extension. /usr/local/rvm/rubies/ruby-1.9.3-p392/bin/ruby extconf.rb checking ruby/util.h... *** extconf.rb failed *** not create makefile due reason, lack of necessary libraries and/or headers. check mkmf.log file more details. may need configuration options. error occurred while installing bcrypt-ruby (3.1.1), , bundler cannot continue. make sure `gem install bcrypt-ruby -v '3.1.1'` succeeds before bundling. this returned terminal, tried install bcrypt separately, wont work. thank in advance ! anonyos-imac:omrails manny$ bundle install fetching gem metadata https://rubygems.org/........... fetching gem metadata https://rubygems.org/.. resolving dependencies... enter password install bundled rubygems system: using rake (10.1.0) using i18n (0.6.4) using multi_js

ember.js - didInsertElement event and unless block -

i'm trying this: didinsertelement: function(){ this.$('[data-hover="dropdown"]').dropdownhover(); }, and have anchor data-hover="dropdown" in {{unless}} block. but anchor isnt in dom @ didinsertelement. is there other event this? there few ways approach this. 1 possibility add observer watches changes same property unless block. when observer triggers add dropdownhover() code afterrender queue. far simpler make anchor tag custom view , customize it's didinsertelement hook. like: app.dropdownlink = ember.view.extend({ tagname: 'a' didinsertelement: function(){ this.$('[data-hover="dropdown"]').dropdownhover(); } })

javascript - Calculations in jQuery using keyup() and click() -

i building first app jquery mobile , 1 part of app following : http://jsfiddle.net/eriky/xbuk2/1/ basically input value, , depending on unit specify, have conversions made in 2 other units. i have spent lot of time trying different methods can't make work. value appears in first field before user enter own value of field (not present) on page. could explain me wrong , best way it? better perform calculations when concerned button clicked ? here code : $(document).ready(function(){ $("#ex").on("keyup", function() { var val = +this.value || 0; var ghz1 = (2.99792458 * val * 10) ; var nm1 = (ghz1 * math.pow(10,9) * math.pow((532 * math.pow(10,-9)),2) / (2.99792458*math.pow(10,8)*math.pow(10,-9))); var cm1 = val / (2.99792458 * 10); var nm2 = (val * math.pow(10,9) * math.pow((532 * math.pow(10,-9)),2) / (2.99792458*math.pow(10,8)*math.pow(10,-9))); var cm2 = (val / (2.99792458 * 10)); var ghz2 = 2.99792458 * val * 10; $("#ghz1")

html - Access Modifiers within javascript -

i trying access function in javascript saying not declared. trying set access modifier , wondering how within javascript. below function trying declare public. <script language ="javascript" type ="text/javascript"> function popuppicker(ctl, w, h) { var popupwindow = null; settings = 'width=' + w + ',height=' + h + ',location=no,directories=no, menubar=no,toolbar=no,status=no,scrollbars=no,resizable=no,dependent=no'; popupwindow = window.open(<%= getservername.getservername("/quoteman/datepicker.aspx?ctl=") %>); popupwindow.focus(); }; edit: trying call function. <asp:textbox id="dateintxt" runat="server" width="80px"></asp:textbox><asp:imagebutton id="imagebutton1" runat="server" borderstyle="none" imageurl="~/icons/vwicn063.gif" onclientclick="popuppicker(&

php - Zend_Form custom decorator on element using config ini -

i'm trying setting-up 1 custom decorator on 1 of elements. want in ini file. i'm experiencing issues other settings. there's collision between : ;remove tags don't need decorators.formelements.decorator = formelements decorators.form.decorator = form decorators.formerrors.decorator = formerrors ;i can't use element decorator because of these 3 lines elementdecorators.viewhelper.decorator = viewhelper elementdecorators.label.decorator = label elementdecorators.description.decorator = description and custom decorator : elementprefixpath.decorator.prefix = "my_decorator" elementprefixpath.decorator.path = "my/path/to/decorators/" elements.numero.options.decorators.simpleinput.decorator = "simpleinput" my way add anyway via php $v_form = new custom_form(); $v_element = $v_form->getelement(custom_form::numero); $v_element->setdecorators(array('simpleinput')); of course it's working want setting-up forms

numbers - Undesired effects when calculating 2 amounts with jQuery -

Image
i not getting desired output code. seems working except if example enter between 100 - 199. gives negative number in other box, when split balance both boxes. can see working example here: http://jsfiddle.net/bfjq2/ ( enter in 100 see mean ) not sure if there doing wrong, feel treating number decimal or something. appreciated. here js: // make sure both inputs equal balance $('input[id*="amount"]').on("blur", function() { var balance = $('#balance').val() ,thisamount = $(this) ,otheramount = $('input[id*="amount"]').not(this); // check if value less balance if(thisamount.val() < balance && thisamount.val() + otheramount.val() <= balance){ // if populate other input remaining amount otheramount.val(balance - thisamount.val()); } // check make sure amount not greater balance if((thisamount.val() + otheramount.val()) > balance){ $('inpu

geocoding - Are Google and Yandex maps similar? -

i heard google maps coordinates not compatible yandex map coordinates. true? can use same coords both map apps? both use ordinary latitude , longitude coordinates, else, see no reason why should not correspond.

data structures - Checking if the linked list is circular -

i reading tortoise , hare (slow , fast runner) algorithm here , don't understand why it's considered best solution. wouldn't less time consuming this: save root node travel through linked list at each new node, check if it's root node. just realized circular list doesn't need connecting head. can have loop somewhere in middle. makes 2 "runners" necessary. but if checking explicitly "snake eating own tail" kind of linked list, enough check equality of pointer root node, suggested before

ms access 2007 - Invalid use of null -

i hope last problem have database. wrote code: is averaging group of inputs. public sub calcoverallrating() dim li_calcvalue integer if isnull((forms![frm_csr]![pp1]!cbx_pp1.value) or _ isnull(forms![frm_csr]![pp2]!cbx_pp2.value) or _ isnull(forms![frm_csr]![pp3]!cbx_pp3.value) or _ isnull(forms![frm_csr]![pp4]!cbx_pp4.value) or _ isnull(forms![frm_csr]![pp5]!cbx_pp5.value) or _ isnull(forms![frm_csr]![pp6]!cbx_pp6.value) or _ isnull(forms![frm_csr]![pp7]!cbx_pp7.value)) 'don't calculate if values null else li_calcvalue = (forms![frm_csr]![pp1]!cbx_pp1.value + _ forms![frm_csr]![pp2]!cbx_pp2.value + _ forms![frm_csr]![pp3]!cbx_pp3.value + _ forms![frm_csr]![pp4]!cbx_pp4.value + _ forms![frm_csr]![pp5]!cbx_pp5.value + _ forms![frm_csr]![pp6]!cbx_pp6.value + _ forms![frm_csr]![pp7]!

database - How to have a version control in django? -

i have django webapp different content (e.g. posts, threads, comments) , want keep track of history. i'm trying create "version-control" "content". how i'm doing (skip end question): i have model create_content represents action: has actor ( editor ), set of modifications ( edition ), timestamp, , content acts on: class create_content(models.model): editor = models.foreignkey('user') edition = models.textfield() # pickled dictionary date = models.datetimefield(auto_now_add=true) content = models.foreignkey('content') which saved once because history cannot changed. i define content has: class content(models.model): last_edit = models.foreignkey(create_content, related_name='content_last_id') first_edit = models.foreignkey(create_content, related_name='content_first_id') def author(self): return self.first_edit.editor where last_edit last action performed it, , first_editio

c - Reduce matrix rows with CUDA -

windows 7, nvidia geforce 425m. i wrote simple cuda code calculates row sums of matrix. matrix has uni-dimensional representation (pointer float). the serial version of code below (it has 2 loops, expected): void serial_rowsum (float* m, float* output, int nrow, int ncol) { float sum; (int = 0 ; < nrow ; i++) { sum = 0; (int j = 0 ; j < ncol ; j++) sum += m[i*ncol+j]; output[i] = sum; } } inside cuda code, call kernel function sweeping matrix rows. below, kernel call snippet: dim3 threadsperblock((unsigned int) nthreadsperblock); // has multiple of 32 dim3 blockspergrid((unsigned int) ceil(nrow/(float) nthreadsperblock)); kernel_rowsum<<<blockspergrid, threadsperblock>>>(d_m, d_output, nrow, ncol); and kernel function performs parallel sum of rows (still has 1 loop): __global__ void kernel_rowsum(float *m, float *s, int nrow, int ncol) { int rowidx = threadidx.x + blockidx.x * blockdim.x;

java - Escaped HTML in XML node via XSLT into XSL-FO -

i have document has generated pdf. use xalan , apache fop processing xml xslt xsl-fo. in xml tree there node this: <root> <formula> <text>3+10*10^-6*l</text> <html>&lt;html xmlns="http://www.w3.org/1999/xhtml"&gt;3 &middot; + 10 &middot; 10&lt;sup&gt;-6&lt;/sup&gt; · &lt;i&gt;l&lt;/i&gt;&lt;/html&gt;</html> </formula> </root> how can not proper html (by using disable-output-escaping="yes" ) node-set ( exsl:node-set ?) can process later on? mean, want xsl-fo representation of html formula in order integrate pdf output. something like <xsl:template match="xhtml:b"> <fo:inline font-weight="bold"><xsl:apply-templates/></fo:inline> </xsl:template> there may solution using saxon:parse() . however, cannot switch xalan-j. is there solution in scenario? you can wri

css - Is it possible to style posts in octopress according to its tags? -

i need style posts in octopress have tag 'old' differently. like, show title , no image in archives , keep them separated! how can this? (note : there 1,500 posts old tag) you use tags css classes: <ul> {% post in site.posts %} <li><a href="{{ post.url }}" class="tags {{ post.tags | join:' ' }}">{{ post.title }}</a></li> {% endfor %} </ul> that way can style link via css tag.

unity3d - How can I code my game to work on every resolution of Android devices? (with Unity) -

i have game made in 480x320 resolution (i have set in build settings) in unity. publish game every android device every resolution. how can it, tell unity scale game device's resolution? possible do? thanks in advance! the answer question largely depends on how you've implemented game. if you've created using gui textures, largely depends on how you've placed/sized objects versus screen size, makes things little tricky. if majority of game done using objects (such planes, cubes, etc) there's 2 methods choose use. 1) first method easy implement, though doesn't good. can change camera's aspect ratio match 1 you've designed game around. in case, since you've designed game @ 4:3, you'd this: camera.aspect = 4f/3f; however, if someone's playing on screen meant 16:9, game end looking distorted , stretched. 2) second method isn't easy, requiring quite bit of work , calculations, give cleaner looking result you. if you

swing - How to reset JComboBox in Java in case of country field? -

on selecting country field, state field shown, , on selecting state feild, city field shown but in below code when select first time works fine when select country states gets added previous country's states , similar case city. read jcombobox.removeall() , defaultcomboboxmodel class don't know how use in current case. so,basically how reset jcombobox items? have on public countrycode{ } class, private void stateboxactionperformed, private void countryboxactionperformed functions answer:here worked me use statebox.removeallitems() before code r adding states in list database . here code of netbeans ---> import java.sql.connection; import java.sql.drivermanager; import java.sql.preparedstatement; import java.sql.resultset; import java.sql.sqlexception; import java.util.vector; import java.util.logging.level; import java.util.logging.logger; import javax.swing.defaultcomboboxmodel; import javax.swing.joptionpan

asp.net - Textbox.text does not show updated text in code -

when use code below reason when update clicked, hospitaltextbox.text not show current value in textbox? value selected. idea why not reading in textbox? dim reader sqldatareader = cmd.executereader() if (reader.read()) hospitaltextbox.text = reader(7) firstnametextbox.text = reader(9) session("id") = reader(0) end if protected sub cmdupdate_click(sender object, e eventargs) handles cmdupdate.click dim test string test = firstnametextbox.text try dim con sqlconnection dim cmd sqlcommand con = new sqlconnection con.connectionstring = "" con.open() cmd = new sqlcommand cmd.connection = con cmd.commandtext = "update tbltest set [teaching hospital name] = @teachinghospitalname, [physician first name] = @firstname id = @id" cmd.parameters.add(new sqlparameter("@id", (session("id")))) cmd.param

GWT: Competing Events ( Blur / Selection ) -

i have tree containing data , widgets editing data single tree node. data tree nodes updated if 1 of widgets looses focus ( blurhandler ). if other node selected, widgets updated, showing data selected tree node ( selectionhandler ). my problem is: if i'm done editing widgets content , choose new tree node, events ( onselection , onblur ) fired in no clear defined order. testing firefox, event order onblur > onselection. in ie, chrome , safari order onselection > onblur. so know if can define event order? or had similar problem , can tell me how can fix it? in body of handler event want go second , put following: scheduler.get().scheduledeferred(new scheduler.scheduledcommand() { @override public void execute() { // action goes here } });

c++ - Retries with locked SQLite databases in Poco 1.5.x -

from poco 1.3.4, poco::data::sqlite::sessionimpl supported properties maxretryattempts , maxretrysleep , , minretrysleep allowed control on automatic retries if database locked. these properties have been eliminated in poco 1.5.0. what proper way handle locked database retries using poco 1.5.x? looks porting change on 1.5.x forgotten. github issue has been created.

android - Calling an AsyncTask twice behavior -

i trying implement search bar automatically searches type. my idea have asynctask fetches search data server, can't figure how asynctask behave use of it. let's have searchasynctask . every time text field edited call new searchasynctask().execute(params); so here's question: behavior of be? starting many different threads return , call onpostexecute() ? or first task called stopped mid-task if instance called while it's still working? or totally different? what if write way? searchasynctask = new searchasynctask().execute(params); ... a.execute(params2); a.execute(params3); ... i have implemented app's search function in same way. use textwatcher build search results , when user types. keep reference of asynctask achieve this. asynctask declaration: searchtask mysearchtask = null; // declared @ base level of activity then, in textwatcher , on each character input, following: // s.tostring() user input if (s != null && !s

audio - Need to make Android app stop sounds from MediaPlayer when it detects a phone call -

i have android app in user presses buttons , sound plays based on button pressed (uses mediaplayer). when user gets phone call, sound still plays. want able detect when user getting call can stop sounds , resume sounds when user not talking on phone anymore. any appreciated, thank in advance i think looking registering broadcast receiver this action .

bash - Automatically chdir to vagrant directory upon "vagrant ssh" -

so, i've got bunch of vagrant vms running flavor of linux (centos, ubuntu, whatever). automatically ensure "vagrant ssh" "cd /vagrant" no-one has remember whenever log in. i've figured out (duh!) echo "\n\ncd /vagrant" >> /home/vagrant/.bashrc trick. don't know how ensure happens if cd command isn't there. i'm not shell expert, i'm confused here. :) cd bash shell built-in, long shell installed should there. also, aware ~/.bash_profile interactive login shell, if add cd /vagrant in ~vagrant/.bashrc , may not work. because distros ubuntu not have file -> ~/.bash_profile default , instead use ~/.bashrc , ~/.profile if creates ~/.bash_profile vagrant user on ubuntu, ~vagrant/.bashrc not read.