Posts

Showing posts from May, 2013

iphone - Playhavan more games widget -

Image
i used these calls show playhavan more game widget on button press. -(void)showplayhavanmoregamepage { phpublishercontentrequest *request = [phpublishercontentrequest requestforapp:play_havan_token secret:play_havan_secret placement:@"more_games_list" delegate:self]; [request send]; } it shows interstitial ads first shows more games page. how can avoid interstitial fullscreen ads on more game button tap , show moregame widget ? image-1: image-2: i wish show moregame widget shown in image 2 on 'more games' button tap, how avoid ads in image 1? on playhaven dashboard, edit "more games button" , make sure "enable featured game preroll" uncheck. can't insert image answer heres link screenshot. http://screencast.com/t/vdnsb7ry

sql - Returning results within Latitude / Longitude rectagle -

here example of table: create table [dbo].[addresses] ( [id] int not null identity(1,1) , [latitude] float(53) null, [longitude] float(53) null ) from our application getting 2 sets of latitude , logitude points in bounding box format: {"upperright":[32.91052662576775,-79.5290690551758],"lowerleft":[32.6420709033305,-80.33313094482423]} so, based on comes in bounding box results, need pass information sql query find of addresses within rectangle. to duplicate latitude , longitude with dup_latlong ( select row_number() on (partition latitude, longitude order rpropid1) rownumber, uniquevalue, convert(varchar(50),latitude)+convert(varchar(50),longitude) check_cond yourtable) select uniquevalue,latitude, longitude, convert(varchar(50),latitude)+convert(varchar(50),longitude) yourtable convert(varchar(50),latitude)+convert(varchar(50),longitude) in (select check_cond dup_latlong rownumber > 1) order 7

python - Elementary, unresolved import from my_app.views in Django (PyDev) -

my project tree in home/djangoprojects/django_bookmarks/env/django_bookmarks looks like: django_bookmarks/ #project django_bookmarks/ __init__.py settings.py urls.py wsgi.py bookmarks/ #made python manage.py startapp bookmarks __init__.py models.py test.py views.py manage.py in ../bookmarks/views have: from django.http import httpresponse def main_page(request): output = ''' <html> <head><title>%s</title></head> <body> <h1>%s</h1><p>%s</p> </body> </html> ''' % ( 'django bookmarks', 'welcome django bookmarks', 'where can store , share bookmarks!' ) return httpresponse(output) in .../django_bookmarks/urls have: from django.conf.urls import patterns, include, url bookmarks.views import main_page # unresolved import: main_page # b

opengl - What does the last parameter of glVertexAttribPointer mean? -

i began learning opengl, don't understand last parameter in glvertexattribpointer means. it's pointer offset array you're using. however, it's byte count have cast pointer, isn't intuitive. if you're using interleaved attributes, it's number of bytes beginning first instance of attribute. example: vvvnnnttvvvnntt where vertex position data, n normal vector, , t texture corodinate. the offset v 0 (it's @ beginning) the offset n (glvoid*) (3*sizeof(vertex data type)) the offset t (glvoid*) (3*sizeof(vertex data type) + 3*sizeof(normal data type) ) furthermore, if have successive attributes, starting point each attribute well. example: vvvv...vvvnnn...nnntt...tt the offset v 0 (it's @ beginning) the offset n (glvoid*) (3*sizeof(vertex data type)*number_of_vertices) the offset t (glvoid*) (3*sizeof(vertex data type)*number_of_vertices + 3*sizeof(normal data type)*number_of_normals)

How to set RTS/DTR using libusb? -

i can't see setter rts/dtr functions in both libusb-0.1 , libusb-1.0. should send smth special using usb_control_msg() ? usb device cdc-device (not ftdi) libusb can't - should send 'control state' cdc-device or ftdi-specific commands ftdi-device. for cdc: http://cscott.net/usb_dev/data/devclass/usbcdc11.pdf `6.2.14 setcontrollinestate request generates rs-232/v.24 style control signals. ... d1 carrier control half duplex modems. signal corresponds v.24 signal 105 , rs-232 signal rts. 0 - deactivate carrier 1 - activate carrier device ignores value of bit when operating in full duplex mode d0 indicates dce if dte present or not. signal corresponds v.24 signal 108/2 , rs-232 signal dtr. 0 - not present 1 - present` ps. xiaofan libusb-devel mailing list.

java - Maven default locale not same with OS locale -

when type mvn --version in command prompt see: default locale : en_us however system locale tr_tr when start java se project without maven , run locale.getdefault() tr_tr returns fine. when run maven project , locale.getdefault() returns en_us not like. how can tell maven default locale tr ? you can use command set maven_opts= -duser.language=tr anyway best solution put these informations in pom file , never command line. in particular have deal configuration of maven-surefire-plugin <plugin> <groupid>org.apache.maven.plugins</groupid> <artifactid>maven-surefire-plugin</artifactid> <version>2.9</version> <configuration> <systempropertyvariables> <user.language>tr</user.language> <user.region>tr</user.region> </systempropertyvariables> </configuration> </pl

angularjs - Angular JS with Google Feed API - strange behaviour -

in 1 of controller functions in angular.js application, i'm trying use google's rss feed api fetch feed entries populate in scope.items model. it's behaving quite strangely, console output in innermost part being '2' while console output in outermost loop being '0' , '1' (which correct since length of items array). i'm thinking have google api thing being async request , hasn't finished before try manipulate (?). still doesn't make sense iterator variable become '2' though! code: function itemlistctrl($scope, item) { $scope.items = item.query({}, function() { // using json service (var = 0; < $scope.items.length; i++) { // length 2 here. $scope.items[i].entries = []; console.log(i); // gives '0' , '1' output in iterations. var feed = new google.feeds.feed($scope.items[i].feedurl); feed.load(function(result) { console.log(i); // gives '2' output

mysql - Combining SQL SUM clauses -

i have script requires executing 4 rather large mysql queries on same subset of data. there way combine them 1 query? here query looks like: select sum(value) ( select lat, lng, value `pop_geo_199` ( (lat between 38.1768916977 , 39.6131083023) , (lng between -77.9596650363 , -76.1143349637)) ) firstcut (acos(0.627895140732*sin(radians(lat)) + 0.778297945677*cos(radians(lat))*cos(radians(lng)-(-1.34454929586))) * 6371 < 79.85) as can tell, geographic query of latitude , longitude points. query first create simple square subset of total table ( firstcut ), , runs trig functions on circular area. from can tell, part of query slow firstcut , because table drawing on has 2.8 million rows. firstcut , though, in instance, has 27,922 rows, trig part goes super fast comparison. the issue is, have run few of these. can use same firstcut , though, since different radii centered on same area. i'd love able pull off 1 query instead of four. here second

JavaScript call function not working - simple example -

i trying call javascript function (plain old js.. not jquery or other library) having issues. seems simple maybe doing silly. have html element id of testbutton. here javascript.. document.getelementbyid("testbutton").onclick = function() { makerequest('test.html'); }; function makerequest(url) { alert('clicked'); } it's onclick , not onclick document.getelementbyid("testbutton").onclick = function() { makerequest('test.html'); }; function makerequest(url) { alert('clicked'); }

regex - How to capture this optional multiline string? -

Image
how can capture optional group? (i mean consuming multiple lines) green group ->optional group red line ->new segment(same patterns repeat) my pattern: (\t{2}<idx:entry name="dic">\r\n)(\t{4}<idx:orth>)(.+\r\n)(\t{4}<idx:infl>[^</idx:infl>]+)? any idea how capture optional group doesn't have fixed length? try this: \s*<idx:entry name="dic">\s*<idx:orth>[^<]*\s*(<idx:infl>\s*.*\s*</idx:infl>) whitespace between tags ignored in xml shouldn't have specify exact number of tabs , linebreaks in regex. use \s signify whitespace (this includes spaces, tabs , line breaks). everything in between parantheses () captured , can access group using \1 or $1 depending on regex engine. however, when parsing xml it's better idea use proper dom parser xpath .

javascript - Dynamic controllers bound from scope -

i create "components" dynamically, based on data received backend. goal display parts of application, without using server side templating : instead of displaying components server-side, server sends json data containing components should displayed. here i've got far : var module = angular.module('testapp', []); module.controller('ctrl1', ['$scope', function ($scope) { $scope.test = "test 1"; }]) .controller('ctrl2', ['$scope', function ($scope) { $scope.test = "test 2"; }]) .controller('componentscontroller', ['$scope', function ($scope) { // json returned backend $scope.components = [{ name: "wd1", controller: "ctrl1", }, { name: "wd2", controller: "ctrl2", }]; $scope.test = "test"; }]); and view : <div ng-app="testapp"> <div ng-controller="compo

android - How can I set the screen size to 4'7 in in bluestacks emulator? -

Image
i trying give emulator 4'7 screen size (i don't know height , width dimentions). @ moment trying set in avd manager. trying edit 1 of available emulator. isn't working. there better way it? step-1: in windows go run step-2: start registry editor navigate till framebuffer-> 0 shown in snapshot step-3: change value guestheight , guestwidth , windowheight , windowwidth shown in images below guestheight guestwidth windowheight windowwidth final-output-in-emulator

c# - Join + Group + Aggregate in LINQ -

i have following query, put datagrid : var balanceperaccount = bal in data.balancedetails join acc in data.userpaymentdetails on bal.username equals acc.username bal.paymentid == 0 group bal bal.username g g.sum(p => p.rebatebeforeservice) >= 20 select new { username = g.key, amount = g.sum(p => p.rebatebeforeservice), }; dgpaymentspending.datasource = balanceperaccount; dgpaymentspending.databind(); what add inside acc in select . example add paymentprovider = acc.paymentprovider . tried flipping every way think of, including getting first() group , trying access there, can't seem find way access it. might missing simple, have been looking around google time , can't seem find comparable example. have idea? extend grouping source

java - Repeatable start of thread -

this code contains moveable pacman, shoots little oval after pressing space button.so boolean variable default false.it becomes true after pressing space button, , oval drawn.after pressing space button, new thread started.this thread contains code moves oval forward, , once reaches coords dissapears.so when press space first time, works fine.actually works fine after more times, elclipse keeps throwing illegalthreadstateexception.i decided put thread code while(c!=22) block, because ball dissapears when c=21, thought thread keep being runnable because while condition can't fullfilled.so point make oval moving each time press space button. this not whole code.just important part. if you'd need whole code, let me know it. thank you!! thread: thread=new thread(){ public void run(){ while(c!=22){ try{ (c=0;c<=20;c++){ newx=newx+c; repaint=true; thread.sleep(100);

php - In what date format does the mysql date datatype return data? -

so, have date stored in mysql date datatype , when come calling echo $row_myrecordset['date']; // dreamweaver generated in date format return date (eg. yy-mm-dd ) can use moment.js? it yyyy-mm-dd, e.g. 2013-07-21 (see mysql reference )

jquery - Why doesn't my alert alert or my log log? -

i've got large json file that, if has unexpected entries in various elements, fails. so, rather copy in few "recods" @ time see breaks (it works, time-consuming , tedious), i've tried let me know how far it's getting alerting me progress: $.getjson('content/pulitzers.json', function (data) { $.each(data, function (i, datapoint) { if (isyear(datapoint.category)) { htmlbuilder += '<div class=\"yearbanner\">' + datapoint.category + '</div>'; alert(datapoint.category); } else { ...and, when didn't work (better idea, anyway), log message: . . . if (isyear(datapoint.category)) { htmlbuilder += '<div class=\"yearbanner\">' + datapoint.category + '</div>'; console.log(datapoint.category); . . . ...however, work when fed in good, anyway. iow, i'll see "2013" down "2009&

javascript - Checking a box in one checkboxgroup disables or hides a box with the same value in another checkboxgroup -

i have extjs window has 2 separate panels checkboxgroups . both show same values, user cannot select same item both checkboxgroups . i want deal little fancier checking , alerting warning in both ckeckboxgroup's listeners when user selects selected value in checkboxgroup . to avoid alerts, want either hide or disable box. i have tried add hidden:true or disabled:true no luck: ext.create('widget.window', { title : 'select value', draggable : true, modal : true, closable : true, closeaction : 'destroy', width : 400, height : 350, layout: { type : 'hbox', align : 'stretch' }, items : [{ xtype : 'panel', title : 'success', autoscroll : true, flex : 1, items : [{ xtype : 'checkboxgroup', itemid : 'success',

mysql - Multiple interrelated loops in sql -

loop1 derived through easy logic. loop2 derived through complex logic. loop3 simple derived adding 2 loop2 now, want derive loop4 through combination of loop1, loop2 & loop3. problem loop2 heavy logic , query running slow if derive logic again inside loop3. provide more clarity, finding loop3 using loop1&2 , loop4 using loop1,2&3. please suggest way query work. select sre.shipmentid, loop1.try1, loop2.try2, loop3.try3, (select case when u>0 loop1.try1 when u>1 loop2.try2 else loop3.try3 end) loop4 `shipmentrouteevent` sre left join (select sre1.shipmentid s1, (case when .....>0 .... end) ad try1 `shipmentrouteevent` sre1 sre1.updatedate='2013-07-01' ) loop1 on sre.id=try1.id left join (select heavy logic modify try1 try2) loop2 left join (select (try2+2) try3) loop3 sre.updatedate='2013-07-01' i think want nested subqueries: from (select . . . fro (select . . .

cfml - ColdFusion - how to edit a record? -

i want edit record2 when click edit button display info of record1. if click other edit buttons display info of record1. how know record want edit? please help. thank you. <cfform name="formname" action="edit.cfm" method="post"> ....some additional codes..... <cfloop query="qryname"> record1_data edit button record2_data edit button record3_data edit button record4_data edit button </cfloop> ....some additional codes..... </cfform> unless there's reason i'd shy away using cfform there's reason use it you need pass in sort of form variable has corresponding id you're pulling database. <form name="formname" action="edit.cfm" method="post"> <cfloop query="qryname"> <input type="checkbox" name="record" value="#qryname.id#" /> record #qryname.id# </cfloop> </form>

osx - Is header importing broken in Xcode 4? -

i made jump xcode 2 xcode 4 , discovered header importing doesn't work. e.g. if make header file defines single variable, foo, import header class a.h , class b.h app fails compile linker error: duplicate symbol _foo in: /users/myself/library/developer/xcode/deriveddata/testcrap-grlgbsgwysjmmzagvozfywcwafar/build/intermediates/testcrap.build/debug/testcrap.build/objects-normal/x86_64/class a.o /users/myself/library/developer/xcode/deriveddata/testcrap-grlgbsgwysjmmzagvozfywcwafar/build/intermediates/testcrap.build/debug/testcrap.build/objects-normal/x86_64/class b.o ld: 1 duplicate symbol architecture x86_64 -clang: error: linker command failed exit code 1 (use -v see invocation) wtf? it's xcode 4 doesn't know import means. how fix this? try make sure didn't #import/#include code files, make sure checked on right hand column building, , ensure don't externally link them @ later stage. if absolutely need import/include code files, uncheck file buil

javascript - Need to change text information related to video -

https://dl.dropboxusercontent.com/u/99737964/video%20online/sermonvideos.html i new jquery, javascript , coding in general. have made media player can click on , have different videos appear in box, wondering how can make text appear right of video box display video title , information. have text appear now, not understand how previous text disappear after clicking on new video. check url see. help! get source code site. use .html() or .text() functions of jquery , give id or class element contain title , information of clicked video like: <script src="//ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script> <script> $(document).ready(function() { $('.videos').click(function() { var value = $(this).attr('title'); $('#myinfo').html(value); //this should trick or $('#myinfo').text(value); //this should trick }) }); </script>

loops - python two dictionaries into one? mixed up keys and values -

i've got 2 dictionaries, d1, , d2 each entry (a, b) in d1, if not key of d2 add (a,b) new dictionary each entry (a, b) in d2, if not key of d1 (i.e., not in d1) add (a,b) new dictionary example if d1 {2:3, 8:19, 6:4, 5:12} , d2 {2:5, 4:3, 3:9}, new dictionary should {8:19, 6:4, 5:12, 4:3, 3:9}. here's code far. d3 = {} in d1.items(): if i[1] not in d2.keys(): d3[i[0]] = d2[i[1]] if you're on python 2.7, can take key views of each dict, symmetric difference, , pick value each key dict had key: result = {key: d1[key] if key in d1 else d2[key] key in d1.viewkeys() ^ d2.viewkeys()} in python 3.x, it's pretty same, except viewkeys keys : result = {key: d1[key] if key in d1 else d2[key] key in d1.keys() ^ d2.keys()} before 2.7, there no dict views or dict comprehensions, can use set s , dict constructor generator expression: result = dict((key, d1[key] if key in d1 else d2[key]) key in set(d1).symmetr

How is my data stored in R? -

so, i'm trying figure out larger problem, , think may stem what's happening when import data .txt file. regular beginning commands are: data<-read.table("mydata.txt",header=t) attach(data) so if data has say, 3 columns headers "var1" , "var2" , "var3" , how imported? seems though imported 3 separate vectors, bound together, similar using cbind() . my larger issue modifying data. if row in data frame has empty spot (in column) need remove it: data <- data[complete.cases(data),] perfect - original data frame had 100 rows, 5 of had empty slot. new data frame should have 95 rows, right? if try: > length(var1) [1] 100 > length(data$var1) [1] 95 so seems original column labelled var1 unaffected line rewrote entire data frame. why believe when import data, have 3 separate columns stored somewhere called var1 , var2 , var3 . far getting r recognize want modified version of column, think need along lines of: var

javascript - How to save the content of TinyMCE using HTML in Google Chrome? -

does know how save content in tinymce editor flat files (.txt) using html & javascript in google chrome? the content in tinymce editor retrieved flat file called hi.txt , once it's edited, needs saved inside hi.txt . i embedded tinymce editor webpage , webpage hosted via dropbox. not possible. browsers don't have access local filesystem. can submit contents of editor server, , have server send file new hi.txt download.

html - CSS & Entypo font not playing nicely -

i've run out of options particular issue i'm having. i'm using entypo font display few icons dimensions seem out of whack , can't seem control or modify them enough desired result. all want is: email icon : email me email@email.com i've tried normal inline elements, placed them in divs try , force them , resorted putting them in table(exasperation) still no joy. would mind have this fiddle , seeing if can see fix might be? links must accompanied code? http://jsfiddle.net/kafdh/ many thanks! apologis of css, may seem illogical, trying sorts of wild wacky things. it's though icon has large invisible space above it. i'm not sure if fiddle save, but: http://jsfiddle.net/kafdh/2/ seems bring me. "h4" forcing white space, think. tried bold, instead, , font looked same. had put entire line in span, though hope more real estate won't necessary. <span id="entypofont" class="mail icon"> <

javascript - How can I add new content to the contents of a variable and then replace that variable? -

my title might not worded , i'm sorry that. essentially, want done this: newc = 'wow' jquery(".bleh").each(function(i){ var bluh = *this changes everytime statement run. lets call x1, x2 , on* var newc = bluh + newc }); suppose .each() function run twice (because there 2 elements class "bleh"). need newc 'x2x1wow' . in first time ran add value if bluh (x1) 'wow' (initial value of newc) second time adds new value of bluh (x2) 'x1wow' (because value of newc now) return newc = x2x1wow how achieve this? you need create variable outside function, otherwise changes lost when function exits: var newc = 'wow' jquery(".bleh").each(function(i) { var bluh = *this changes everytime statement run. lets call x1, x2 , on* newc = bluh + newc }); the problem in side each callback variable newc declared local variable resetted in every iteration. need modify closure variab

yui - Avoid duplicate JavaScript in YUI3 -

i created 3 widgets added yui modules. widgets use same javascript library (commons.js) using y.get.js method. these widgets defined in separate js files (i need these widgets standalone). of them loaded html file , rendered. however, inspecting elements of html file in browser, turns out commons.js file included 3 times in html file, different ids: <script charset="utf-8" id="yui_3_5_0_1_1374466627361_24" src="js/common.js"></script> <script charset="utf-8" id="yui_3_5_0_1_1374466627361_32" src="js/common.js"></script> <script charset="utf-8" id="yui_3_5_0_1_1374466627361_38" src="js/common.js"></script> is there way in yui avoid duplication? thank you! y.get.js called when include module if used in module's body. here suggestions: put contents of common.js yui module. best choice use yui load , wrap automatically module: example

php - WordPress - get shortcode attribute name -

please tell how retrieve available attributes of shortcode. i have available shortcode won't show attribute name global $shortcode_tags; print_r($shortcode_tags); someone told me use php reflection api.. a working plugin code shortcode attribute: class shortcodereference { /** * shortcode * @var string */ private $_shortcode; /** * @var reflectionfunction */ private $_function_reflection; /** * @var string */ private $_filepath; /** * flat doccomments. * @var string */ private $_description; /** * @var array */ private $_attributes; /** * @var string */ private $_function_name; /** * tags found in documentation * @var array */ private $_known_tags; /** * - function name * - attribute(s) * - plugin or core */ public function __construct($shortcode){ global $shortcode_tags; if (

Generate extjs 4.2 app with sencha cmd, default theme name did not work -

i use flow command : sencha -sdk d:\dev\ext\ext-4.2.1.883 generate app -t ext-theme-neptune msg .\ then check /.sencha/app/sencha.cfg file, app.theme still app.theme=ext-theme-classic, and bootstrap.css still @import 'ext/packages/ext-theme-classic/build/resources/ext-theme-classic-all.css'. how change app theme using sencha cmd? i haven't tried generating app includes specifying theme. anyways, can change theme app editing app.theme=ext-theme-classic app.theme=ext-theme-neptune found on project directory .sencha/app/sencha.cfg then, execute sencha app refresh

sql server 2008 r2 - How to get records of last month of this year, -

i need fetch records of last month of year, getting records of past years also. please me out i had query this: select empcode,eventdate1 eventdate,intime, case when outtime null 'n/a' else outtime end outtime tms_hourcalc datepart(m, eventdate) = datepart(m, dateadd(m, -1, getdate())) , empcode='13658' group empcode, intime,outtime, eventdate1,intime1 order intime1; you need check year condition well. select empcode,eventdate1 eventdate,intime, case when outtime null 'n/a' else outtime end outtime tms_hourcalc datepart(m, eventdate) = datepart(m, dateadd(m, -1, getdate())) , datepart(y, eventdate) = datepart(y, dateadd(m, -1, getdate())) , empcode='13658' group empcode, intime,outtime, eventdate1,intime1 order intime1;

heatmap - filled.contour() in R: nonlinear key range -

Image
i using filled.contour() plot data stored in matrix. data generated (highly) non-linear function, hence distribution not uniform @ , range large. consequently, have use option "levels" fine tune plot. however, filled.contour() not use these custom levels make appropriate color key heat map, find quite surprising. here simple example of mean: x = c(20:200/100) y = c(20:200/100) z = as.matrix(exp(x^2)) %*% exp(y^2) filled.contour(x=x,y=y,z=z,color.palette=colorramppalette(c('green','yellow','red')),levels=c(1:60/3,30,50,150,250,1000,3000)) as can see, color key produced code above pretty useless. use sort of projection (perhaps sin(x) or tanh(x)?), upper range not over-represented in key (in linear way). at point, to: 1) know if there simple/obvious missing, e.g.: option make "key range adapting" automagically; 2) seek suggestions/help on how myself, should answer 1) negative. thanks lot! ps: apologize englis

joomla2.5 - How to get current user login details in joomla -

i have 1 doubt in joomla. can able user login details while accessing index.php...whereas if created new folder named test , inside folder have created index.php , have used below code in case user details not showing. please me on $user =& jfactory::getuser(); if (!$user->guest) { echo 'you logged in as:<br />'; echo 'user name: ' . $user->username . '<br />'; echo 'real name: ' . $user->name . '<br />'; echo 'user id : ' . $user->id . '<br />'; } as far understand problem can access joomla function within it's scope. other words can not access joomla core function if framework not included in page running. to access core functions outside of joomla include framework so. please google , see how should done.

keyvaluepair - Create a time-based map in C -

so have map key -> struct my key devices ip address , value(struct) hold devices ip address , time after amount of time has elapsed make key-value pair expire , deleted map. i new @ wondering way go it. i have googled around , seem find lot on time-based maps in java only edit after coming across this think may have create map items in , , have deque in parallel references each elem. periodically call clean , if has been in there longer x amount of time delete it. is correcto r can suggest more optimal way of doing ? i've used 3 approaches solve problem this. use periodic timer. once every time quantum, expiring elements , expire them. keep elements in timer wheels, see scheme 7 in paper ideas. overhead here periodic timer kick in when has nothing , buckets have constant memory overhead, efficient thing can if add , remove things map more expire elements it. check elements shortest expiry time. schedule timer kick in after amount of time. in timer,

asp.net mvc 3 - MVC pagedlist.mvc and aspx view -

i have got page im using nuget package pagedlist.mvc 3.0.18 (the latest version mvc3). problem when i'm listing pages makes pages list of like previous 1 2 3 4 next instead of < 1,2,3,4,5,6,7.. > my view looks like <%@ page title="" language="c#" masterpagefile="~/views/shared/site.master" inherits="system.web.mvc.viewpage<ipagedlist<news>>" %> <%@ import namespace="pagedlist" %> <%@ import namespace="pagedlist.mvc" %> <asp:content id="content2" contentplaceholderid="maincontent" runat="server"> <table> <tr> <td> <% foreach (var v in model) {%> <%: v.content %><br /> <%: v.datecreated %><br /> <%: v.email %><br /> <%} %> <h2>news</h2> <%: html.pagedlistpager(model, page => url.action("news", new { page }), pagedl

asp.net - How do I populate gridview based on dropdownlist selected value using C#? -

i need populate grid based on dropdownlist selected value: c# coding is protected void atddroplist_selectedindexchanged(object sender, eventargs e) { empatdlistbi c = new empatdlistbi(); dbconnection b = new dbconnection(); sqldataadapter da = new sqldataadapter(); datatable dt = new datatable(); dataset ds = new dataset(); if (atddroplist.selectedindex == 1) { b.openconnection(); dt = c.loadrecords(emptext.text); gridview1.datasource = dt; gridview1.databind(); b.closeconnection(); } } with coding iam unable see grid in output. please me out we can check few things - autopostback of dropdown set true - getting data in dt - if necessary can put grid in updatepanel on page

java - Embedded Jetty 8 and configuration of JNDI MySQL connection pool with no XML -

i have been searching while now, , not able find tutorials or answers question. in project there 1 xml-file, pom.xml, server embedded jetty 8, programmatically defined servletcontexthandler handles incoming requests. point is, no webappcontext or war-file(as seems tutorials expect web-inf, webappcontext, web.xml, jetty-env.xml or war file). i want add jndi-datasource pooling sql-connections programmatically in java. there point me tutorial, or give tips on how achieve this? you have chosen embedded-jetty special servletcontexthandler without complete web container (that's not meant criticism, path have followed far). if target environment well, why need jndi on top of this? has provide jndi implementation. add connection pool bonecp, c3po etc. , use without jndi. on other hand, if target environment requires use connection pool, can add own method on top of both providers: pseudo code: public class myconnectionfactory // replaced property lookup etc. pri

apache - Access control in Cgit -

i introduce access control cgit once cgi of cgit has been launched. idea list repos available in gitolite enable/disable directory listing based on user authentication. i managed access control before apache executing cgit cgi: allowoverride none authtype basic authname "restricted files" authuserfile /var/lib/git_alfonso/passwords options +execcgi order allow,deny allow alias /cgit.png /var/www/htdocs/cgit/cgit.png alias /cgit.css /var/www/htdocs/cgit/cgit.css scriptalias /cgit "/var/www/htdocs/cgit/cgit.cgi" rewriterule ^$ / [r] rewriterule ^/(.*)$ /cgit.cgi/$1**** but don't know how same effect once repositories paths accessed, tried directory directive , adding authentication there once cgit launched apache doesn't apply other directive stated in http.conf file. any clue on how achieve it? thanks lot in advance. br alfonso. i have done precisely in own cgit config . # cgit on @port_http_cgit@ listen @port_htt

How to get numeric, hexadecimal and ISO of html-entities in JavaScript -

is there function in javascript can give me conversion html entity (name) either numeric, or hexadecimal, or iso slash character (to used in css)? e.g., the cent symbol's ( ¢ ) html : &cent; . its numeric value &#162; can used in html mark-up well hexadecimal value %a2 iso \00a2 - can use directly in css content property. like follows: .cents:after { font-style: italic; content: "\00a2"; } i more interested in iso value therefore. the cent symbol's ( ¢ ) html : &cent; . //will need work against list of items or char code set need its numeric value &#162; can used in html mark-up well '&#' + '¢'.charcodeat(0); hexadecimal value %a2 escape('¢'); iso \00a2 - can use directly in css content property. var iso = ['\\', '0', '0', '0', '0']; var hex = '¢'.charcodeat(0).tostring(16).split(''); for(var i=4; >= 0 &&am

google play - Android app not listing in playstore -

i published android app in google play store. app not getting listed, when search using app name. can see app if search using developer name. published app on yesterday. chance solve problem? check if app published in beta or alpha version.

c# - TransactionScope performance issues -

i have performance issues when using transactionscope class in server side code (wcf). my code gets request client, creates transactionscope , performs short operations (usually 100 ms). see bellow attached code simulates server side code. problem when there 100 , more concurrent users, takes more 1 second !!! create new transactionscope (see gettransaction() method). and when goes 200 concurrent users, transactionaborted thrown . do have ideas? class program { private static concurrentqueue<double> m_queue = new concurrentqueue<double>(); static void main(string[] args) { console.writeline("press key start ..."); console.readkey(); (int = 0; < 100; i++) { thread t = new thread(new threadstart(method)); t.isbackground = true; t.start(); } thread.sleep(2000); console.writeline("max {0}, min {1}, avg {2}, total {3}&qu

sql server - SQL pivot get products by orderNr -

i have 2 tables: 'orderheader' columns ordernr , ordercontact. 'orderdetail columns ordernr , orderserial. for each ordernr there max 3 orderserials. so, i'm trying table columns: ordernr odercontact orderserial1 orderserial2 orderserial3 i'm stuck pivot select ordernr, odercontact, [1] orderserial1, [2] orderserial2, [3] orderserial3 (select h.ordernr ordernr, ordercontact odercontact, orderserialsnr orderheader h inner join orderdetail d on h.ordernr = d.ordernr ) pivsource pivot (count(orderserialsnr) orderserialsnr in([1],[2],[3])) pvt i used adventureworks db this. use [adventureworks2008r2] go create view [test].[orderheader] (ordernr,ordercontact) select salesorderid, firstname + ' ' + lastname sales.salesorderheader inner join sales.customer on sales.salesorderheader.customerid = sales.customer.customerid inn

c# - How to get a Previous request value -

i calling webservice , getting double value below code. double exchangevalue = exchangerate.conversionrate(currencyexchange.currency.inr, currencyexchange.currency.aed); once connected internet getting double value webservice , doing stuff. suppose not connected internet,so not value previous line of code,because can't call webservice . want value previous request. how store previous request value can use value when internet connection off. any kind of appreciated. well,you mentioned want use ' previous value ',than when value web service,store somewhere @ client. there many options storing it. when don't have internet connection ,get stored value , perform operation.when internet connection,obtain value again , update replacing stored one. regards..

sql server - TSQL foreach record join a cte and insert -

i need create sql-query uses recursive cte fetch records tablea. (tree-structure). pass him "leaf" , want know way root. this works @some_id variable ;with cte_recursive ( select id, sub_id tablea sub_id = @some_id union select parent.id, parent.sub_id tablea parent inner join cte_recursive child on child.id = parent.sub_id ) what need acchieve is, take every record tableb , use tableb.some_id cte expression , create insert tablec foreach record cte generates plus fields tableb (cte_recursive.child_id, tableb.somevalue, tableb.someothervalue) so question here is, how pass tableb.some_id cte expression ? so in tablea got this: id, sub_id 1 , 2 2 , 3 2 , 4 2 , 5 5 , 6 7 , 8 8 , 9 if pass him sub_id = 5, cte returns me records #1, #2, #3, #4, #5 sub_id = 5 child of child of child... of id = 1 you can create table valued

c++ - Issue with string::operator+= -

i tried append 2 letters string, seems string not changed: void fun() { string str; str += 'a' + 'b'; cout << str; } i checked source code of stl , found implementation of operator+= , still don't know why. basic_string& operator+=(_chart __c) { this->push_back(__c); return *this; } by adding 'a' + 'b' have 2 chars added form char. add string += . this code want: std::string str; ( str += 'a' ) += 'b'; std::cout << str;

C# HasValue vs !=null -

this question has answer here: which preferred: nullable<>.hasvalue or nullable<> != null? 6 answers my question might sound little foolish bugs me every time face it. difference between : where value.hasvalue and where value != null does hasvalue checks if value null? they both same thing, pick 1 , stick have consistency. there nothing gain using either in end.

gradient descent using python and numpy -

Image
def gradient(x_norm,y,theta,alpha,m,n,num_it): temp=np.array(np.zeros_like(theta,float)) in range(0,num_it): h=np.dot(x_norm,theta) #temp[j]=theta[j]-(alpha/m)*( np.sum( (h-y)*x_norm[:,j][np.newaxis,:] ) ) temp[0]=theta[0]-(alpha/m)*(np.sum(h-y)) temp[1]=theta[1]-(alpha/m)*(np.sum((h-y)*x_norm[:,1])) theta=temp return theta x_norm,mean,std=featurescale(x) #length of x (number of rows) m=len(x) x_norm=np.array([np.ones(m),x_norm]) n,m=np.shape(x_norm) num_it=1500 alpha=0.01 theta=np.zeros(n,float)[:,np.newaxis] x_norm=x_norm.transpose() theta=gradient(x_norm,y,theta,alpha,m,n,num_it) print theta my theta above code 100.2 100.2 , should 100.2 61.09 in matlab correct. i think code bit complicated , needs more structure, because otherwise you'll lost in equations , operations. in end regression boils down 4 operations: calculate hypothesis h = x * theta calculate loss = h - y , maybe squared cost (loss^2)/2m

log4j - Jboss AS 7 logging on wrong level -

i have been trying use own log4j.xml file logging, suggested here: https://docs.jboss.org/author/display/as71/how+to#howto-howdoiuselog4j.propertiesorlog4j.xmlinsteadofusingtheloggingsubsystemconfiguration%3f i did following things: - created jboss-deployment-structure.xml file in web-inf (since application war file) corresponding content; - put log4j-1.2.16.jar in build path; - created log4j.xml in src/main/resources (this spring roo put file when generated project). this way, logging messages classes displayed ok, errors bubble , caught dispatcherservlet shown @ debug level in console: 12:06:30,668 debug [org.springframework.web.servlet.dispatcherservlet] (http-localhost- 127.0.0.1-8080-3) handler execution resulted in exception - forwarding resolved error view: modelandview: reference view name 'uncaughtexception'; model {exception=java.lang.nullpointerexception}: java.lang.nullpointerexception @ ro.radcom.muzee.bo.impl.jmsserviceimpl.sendmessage(jmsserviceimpl.j

JQuery object of an array to string -

i retrieved object of array code behind(php) jquery , get: array ( [0] => stdclass object ( [mfid] => 1 [mfname] => customer id [ftid] => 1 [dtid] => 1 [mfkey] => 0 [mfwskey] => [mfwsname] => [mfrequired] => 1 [mfdefaultvalue] => [mfmin] => 0 [mfmax] => 0 [mfduedate] => 0 [mftobepaid] => 0 [mfmaxlength] => 50 [mforderno] => 1 [mfstatus] => 1 ) ) i want mfname array input object, lets say $("#fname").val(data[0]['mfname']); but not work. usually in php before returning client, $val = $array[0]->mfname; how can in jquery? // return json encoded array in php side var arr = json.parse(yourarray); alert(arr[0].mfname); hope find using this

asp.net - try/catch in TransactionScope in C# -

i'm using transaction in c# code. in transactionscope log make sure done in testing. if happens in transaction , goes catch log class doesn't write anything. in localhost change transactionscopeoption " suppress " because database not in server. when i'm debugging ok, can write log file.but when change " required " if gave error, canceled usual can't write first log. how can fix this? my code sample: transactionoptions tr = new transactionoptions(); tr.isolationlevel = system.transactions.isolationlevel.serializable; using (transactionscope scope = new transactionscope(transactionscopeoption.required, tr, system.transactions.enterpriseservicesinteropoption.automatic))//system.timespan.maxvalue)) { bool status = false; // log must written anyway won't when gives error. logprocess log = new logprocess(ssession["dbname"], new guid(), "transaction begun."); try { // process 1 // process

ios - MapView on TableViewCell issue -

Image
i trying show map view in tableviewcell. have crated cell view , tried merge main view. have issue can't see map view. why empty map pin? when run app this when touch cell i hope achieve same , achieved same adding: [cell addsubview:self.mapview]; cheers!! let me know if need more clarification. addition: [self.mapview setscrollenabled:false];

Ogone payment gateway integration? -

i trying create application ogone payment gateway integration. can please tell me can start , there api or available? rohit i working c# , have problems integration of payment provider. in search have found 1 usefull link: https://cheddargetter.com/developers#add-customer wish helps you. if found more concrete, inform you. most of posible manipulations ogone payment provider can found in direct link api: http://www.productivecomputing.com/docs/docs_library/fm_creditcard/ogone_directlink_en.pdf

Camera.lock, unlock() managed automatically for you since Android 4.0? -

i started android development , wrote simple camera app using tutorial: http://developer.android.com/guide/topics/media/camera.html#custom-camera there read: "note: starting android 4.0 (api level 14), camera.lock() , camera.unlock() calls managed automatically." but mean? camera app supports android 16 (4.1.2) , 17 (4.2.2) if discard lock , unlock calls error mediarecorder (-19). how let handle android it? or mean "managed automatically"? as android documentation states lock() called automatically in mediarecorder.start() . think couldn't remove unlock() call because when start() method call lock() method on camera, locked default, find camera locket , rise runtimeexception . since api level 14, camera automatically locked applications in start(). applications can use camera (ex: zoom) after recording starts. there no need call after recording starts or stops.