Posts

Showing posts from May, 2011

c# - Data Lost from UserControl when I use RadGrid EditForm with UserControl -

Image
i use radgrid editform usercontrol sample telerik sample <telerik:radgrid id="persongrid" runat="server" autogeneratecolumns="false" oneditcommand="persongrid_editcommand" onupdatecommand="persongrid_updatecommand"> <mastertableview datakeynames="id" commanditemdisplay="top"> <editformsettings usercontrolname="personitemsuc.ascx" editformtype="webusercontrol"> </editformsettings> <columns> <telerik:gridboundcolumn uniquename="id" display="false" headertext="id" datafield="id"> </telerik:gridboundcolumn> <telerik:gridboundcolumn uniquename="name" headertext="name" datafield="name"> </telerik:gridboundcolumn> <telerik:gridboundcolumn uniquename=...

jquery - javascript input field get cleared when page postback -

i working vb asp.net , end sql in have choose date calendar used javascript calendar client side coding , other controls , when page postback lost calendar value selected have keep date till click save button here textbox input <input name="txtpodate" id="inputfield00" type="text" style="width:28px; font-family:segoe ui; font-size:14pt; height: 20pt; background-color: #3366ff;" onclick ="a();" /> i have used hidden field , onblur , onfocus events not working, the calendar function is <link rel="stylesheet" type="text/css" media="all" href="jsdatepick_ltr.min.css" /> <script type="text/javascript" src="jsdatepick.min.1.3.js" ></script> <script type="text/javascript" id ="calender"> function setcurrentdate() { var d = new date(); ...

javascript - Setting up onclick handlers into for -

this question has answer here: javascript closure inside loops – simple practical example 31 answers how generate event handlers loop in javascript? [duplicate] 3 answers i have array this.conds = ["addr", "acc"] example. have these dom objects in html tree. piece of code: for(cond in this.conds) { this.searchby[this.conds[cond]] = { "btn": $("#" + this.conds[cond] + "btn"), "fields": $("#" + this.conds[cond] + "fields"), "active": false }; // handlers __this = this; this.searchby[this.conds[cond]].btn.click(function() { __this.setallunactive(); __this.searchby[__this.conds[con...

ios - Controller not deallocated when popping it -

dealloc not called in controller b popped nav stack. ie (very normal) setup: nav controller has controller root , button tap pushes b on top. button in controller b unwinds controller a. made through storyboard interface in ib (i use custom segue class uses no animation on push). (when using xibs , non-arc) call dealloc in controller b popped. not, in case. normal behaviour of storyboards? or if not, made mistake somewhere, hanging onto controller b. fyi i'm using arc , not explicitly creating controller b anywhere in code. it alarming because noticed constructor of controller b called each push of (even after going b a). mean b controllers leak.

sql server ce - How to read & update data in the Sql ce database located in Windows phone app data folder? -

i have placed sql ce database file in installation folder of windows phone application.i want perform read , write operations on database saying access database file not allowed. please suggest me how can achieve this you need copy database isolated storage on first run, installation folder read-only. need change connection string: data source=isostore://mydb.sdf see more in blog post here: http://erikej.blogspot.dk/2013/04/generate-windows-phone-8-local-database.html

java - How to make session attribute threadsafe -

i have bean stored in session bean provides functionality. in order make functionality provided bean thread safe should develop bean in thread safe manner or session access bean should made thread safe? if object thread-safe, can have 100 places in code access object, , thread-safe every time. if object isn't thread-safe, you'll have make sure every 1 of 100 places access bean in common way guarantees thread-safety. i'd make object thread-safe.

android - How may i use the thread in my program? -

i want move image on screen using thread have tried not working fine due improper code of thread. able image , want move image on screen in code want move ovalshaped image , dont want must effect jerry image problem thread implementing on margenmaxx, margenxy maximum width , height public class animatedview extends imageview { public animatedview(context context) { super(context); resources res = context.getresources(); drawable = res.getdrawable(r.drawable.jerry); mdrawable = new shapedrawable(new ovalshape()); mdrawable.getpaint().setcolor(0xffffac23); } protected void ondraw(final canvas cc) { final context context = null; drawable.setbounds(x , y , x + width, y + height); drawable.draw(cc); invalidate(); thread thread = new thread() { @override public void...

python - 500 internel server error -

i trying fetch data facebook api. here code sending message django application what doing combine status asd@@@@@qe@@@@@@ form , try split form in django part. however, have post http://chaop.webfactional.com/get-message/ 500 (internal server error) problem var getposts = function (response) { if(response.data != null) { (var i=0; i<response.data.length; i++) { console.log(response.data[i].message) if(response.data[i].message != null) { message = message + response.data[i].message; message = message + '%%%%%' console.log(message) } } if(response.paging != null){ nextpage = response.paging.next; console.log(nextpage); $.get(nextpage, getposts, "json") } else $.post('/get-message/',{message: message,csrfmiddlewaretoken:'{{csrf_token}}'}); } } fb.api('/me/feed', function(response) { if (response.data.length >0){ (var i=0; i<response.data.length; i++) { conso...

jsf - How can make commandButton change the url src in ui:include with ajax -

i build template jsf. template has div contain other jsf file /////////////////////// <h:panelgroup id="maincenterbox" styleclass="maincenterbox" layout="block"> <ui:include id="centerview" src="messageboardview.xhtml"/> </h:panelgroup> \\\\\\\\\\\\ how can change src in ui:include view other page when cleck commandbutton ajax hi thank vasil lukach replay wont know how can send parameter form commandbutton bean , below code \\\\\\\\\\\\\ bean file import javax.enterprise.context.requestscoped; import javax.inject.named; @named("urls") @requestscoped public class urlpagesbean { private string urlsrc = ""; public string geturlsrc() { return urlsrc; } public void seturlsrc(string urlsrc) { this.urlsrc = urlsrc; } public string geturl() { string url = ""; if(urlsrc == "page1" || urlsrc == "...

objective c - Sprite goes above/below the limits of grid movement system -

i'm trying implement grid movement in game. grid has 1 column , 3 lines. [ ] y3 - 60 % of height [ ] y2 - 40% of height [ ] y1 - 20% of height in iphone 3.5 inch, these height are: [ ] y3 - 193px [ ] y2 - 128px [ ] y1 - 64px when user taps screen above npc, npc should move next cell above him (e.g. if npc in y1, should go y2). , same thing should happen in opposite direction. but, npc should never com above 193px or below 64px. not happening. if tap twice, when npc moving, starts moving faster , ignores grind, , go above/below boundaries. this code. how can improve want? -(void) touchbegan:(uitouch *)touch withevent:(uievent *)event { cgpoint touchlocation = [touch locationinnode:self]; positiony1 = self.contentsize.height*.2; positiony2 = self.contentsize.height*.40; positiony3 = self.contentsize.height*.60; float playermove; if (touchlocation.y > _player.position.y) { if (_player.position.y >= positiony3) { nslog(@"decisao 1"); ...

haskell - How can I reuse a class instance for a newtype? -

i have defined type called natural positive integer includes 0: newtype natural = natural integer deriving (eq, ord) instance show natural show (natural i) = show tonatural :: (integral i) => -> natural tonatural x | x < 0 = error "natural cannot negative" | otherwise = natural $ tointeger x fromnatural :: natural -> integer fromnatural (natural i) = instance num natural frominteger = tonatural x + y = tonatural (fromnatural x + fromnatural y) x - y = let r = fromnatural x - fromnatural y in if r < 0 error "subtraction yielded negative value" else tonatural r x * y = tonatural (fromnatural x * fromnatural y) abs x = x signum x = tonatural $ signum $ fromnatural x instance enum natural toenum = tonatural . tointeger fromenum = frominteger . fromnatural in code common newtype s take natural parameter. , since wa...

php - how to do multiple file upload in zend framework -

i implement multiple file upload. getting code single file uploading. how implement multiple file upload form code $docupload=new zend_form_element_file('docupload',array('multiple' => 'multiple')); $docupload->addvalidator(new zend_validate_file_extension('doc,docx,pdf,txt')); $docupload->setisarray(true); in controller if(is_array($_files['docupload']['name'])) { $params = $this->_form->getvalues(); foreach($_files['docupload']['name'] $key=>$files) { $file_name=$_files['docupload']['name'][$key]; $temp_image_path = $_files['docupload']['tmp_name'][$key]; $file_name=implode(",", $file_name); $temp_image_path=implode(",", $temp_image_path); ...

sql - How to connect several html/php files to form a complete website? -

i've made different html files work php on wamp server, , want know how put them together? for example, have login page. i'd user able login , see next html file main page or something. i found header function in php , i'd know if it's formal way of redirecting user page page. you can use html links; <a href="nextpage.html">next page</a> you can use header in php files; header("location:nextpage.php");

GTM OAuth for IOS not working with Grails OAuth 2 provider -

i working on ios app , want use oauth authenticate app grails system have in place. grails system has oauth2 provider setup using plugin @ link below: https://github.com/adaptivecomputing/grails-spring-security-oauth2-provider the oauth provider setup , work have tested url's shown below , authorisation code expected once access has been granted: http://localhost:8080/app/oauth/authorize?response_type=code&client_id=clientid&redirect_uri=http://localhost:8080/app/ the issue having when use gtm oauth plugin ios google have set follows: static nsstring *const kmyclientid = @"1"; static nsstring *const kmyclientsecret = @"secret"; static nsstring *const kkeychainitemname = @"systemkeychain"; - (gtmoauth2authentication *)systemauth { // set token url system token endpoint. nsurl *tokenurl = [nsurl urlwithstring:@"http://www.systemurl.co.uk/oauth/token"]; // set bogus redirect uri. won't used redirect /...

Checkered square table in Haskell -

sometimes need checkered data structure, example if model chess board. simplest way represent checkered data via list of lists. [[0,1,0], [1,0,1], [0,1,0]] the above example of checkered list. first attempt: import data.list checker :: integral => -> -> -> [[a]] checker n b = generictake n $ intersperse (generictake n xs2) $ repeat (generictake n xs1) xs1 = checker' b xs2 = drop 1 xs1 checker' :: -> -> [a] checker' b = intersperse b $ repeat the code verbose, while result correct: *main> checker 5 0 1 [[0,1,0,1,0],[1,0,1,0,1],[0,1,0,1,0],[1,0,1,0,1],[0,1,0,1,0]] how write function create such list arbitrary size in haskell? evenrow = 0:oddrow -- evenrow = 0:1:evenrow oddrow = 1:evenrow board = evenrow:oddrow:board here's infinite checkered board. saw off rectangular part: smallboard = take 17 $ map (take 11) board parameterize needed. edit: haven't used cycle here sake of illustra...

embed - Remove Google Map Marker Text -

Image
i have client has embedded google maps showing location of new hospital building. until showed pin marker, showing longitude , latitude next pin. have tried remove text none of options in query string appear anything. i think google has updated embed code can't find documentation though. have suggestions? thanks john from research did, seems new google maps pretty rigid , there isn't simple way. think require more complex api stuff. this post found described limitations removing info window embedded map in new google maps sorry realize doesn't help.

html - How to automatically change words and color in a phrase with css? -

i create dynamic phrase doyouimpress.com the code use html is: source <section class="rw-wrapper"> <h1 class="rw-sentence"> phrase 1 <div class="rw-words rw-words-1"> <span>word 1</span> <span>word 2</span> <span>word 3</span> </div> </h1> </section> <h2 class="rw-sentence-ie">phrase internet explorer</h2> the code use css is: (i have errors when pasting css here, please see source.) with code words automatically change phrase not change position when words long or short. what wrong , how can similar effect to: doyouimpress.com it looks css left-aligning sentence gets changed with: text-align: left; if change text-align: center; you might find sentence/phrase changes position when it's different word.

how can I connect the SharePoint with the SQL server? -

i'm new in learning sharepoint, , knew few things it. have sql server database , want connect sharepoint database,i downloaded " sharepoint videos essential training" there weren't videos show me how connect sql server. 1 show me how please,

java - A system exception occurred during an invocation on EJB -

warning: ejb5184:a system exception occurred during invocation on ejb empfacade, method: public java.util.list com.session.abstractfacade.findall() warning: javax.ejb.ejbexception @ com.sun.ejb.containers.ejbcontainertransactionmanager.processsystemexception(ejbcontainertransactionmanager.java:748) @ com.sun.ejb.containers.ejbcontainertransactionmanager.completenewtx(ejbcontainertransactionmanager.java:698) @ com.sun.ejb.containers.ejbcontainertransactionmanager.postinvoketx(ejbcontainertransactionmanager.java:503) @ com.sun.ejb.containers.basecontainer.postinvoketx(basecontainer.java:4475) @ com.sun.ejb.containers.basecontainer.postinvoke(basecontainer.java:2009) @ com.sun.ejb.containers.basecontainer.postinvoke(basecontainer.java:1979) @ com.sun.ejb.containers.ejblocalobjectinvocationhandler.invoke(ejblocalobjectinvocationhandler.java:220) @ com.sun.ejb.containers.ejblocalobjectinvocationhandlerdelegate.invoke(ejblocalobjectinvocationhandlerdel...

algorithm - Understanding the code for finding the permutation of numbers x and y,(less than n) such that x*y is a perfect square and y -x is maximum (x < y) -

i read function in programming blog aforementioned task,but i'm unable understand . (also x*y should maximum).also preference maximizing x*y more y-x . long long ans = 0; int x,y; for( = 2;i <= n / i;++i){ int k = n / (i * i); int y = k *i*i; int x = k * (i - 1) * (i - 1); if((long long)x * y > ans){ ans = (long long)x * y; x = x; y = y; } } i <= n / i ensures values x , y less n , derived square of i , inside loop. ( k derived n , i . , x , y in turn derived k , i .) int k = n / (i * i); , int y = k * * i; , int x = k * (i - 1) * (i - 1); ensures value x * y perfect square. (since x * y = k * k * * * (i - 1) * (i - 1) . i.e x * y perfect square of k * * (i - 1) ). also, x less y because x derives (i - 1) whereas y i . the 3 statements in if loop @ end keep track of pair having largest x * y .

php - mysql insert rows in multiple tables -

i have database multiple tables, in al tables there have row because else query going wrong. in 1 of insert pages insert al rows seperatly in tables. there more efficient , safe way this? maybe in mysql (cascade)? afaik there no other way same data different tables in same statement. can try using transactions. start transaction; insert t1 (field1, field2) values ('data1','data2'); after inserting data can check them if ok , if expected commit queries: commit; or rollback, removes changes sience "start transaction". rollback;

javascript - Can't access to socket.io.js on Raspberry Pi with Lighttpd [Node.JS & Socket.IO] -

i'm new node.js , socket.io since yesterday. i try make node.js , socket.io work on raspberry pi doesn't seem to. i can't access <myip>:1337/socket.io/socket.io.js . have followed this tutorial lighttpd.conf file seems so: $http["host"] == "<myurltomywebsite>" { proxy.server = (" " => (( "host" => "<myip>", "port" => 1337) ) ) my server.js so: var http = require('http'); httpserver = http.createserver(function(req, res) { res.end('hello world!'); }); httpserver.listen(1337); var io = require('socket.io').listen(httpserver); var clients = 0; io.sockets.on('connection', function(socket) { ++clients; socket.on('disconnect', function(data) { --clients; io.sockets.emit('disusr', clients); }); io.sockets.emit('newusr', clients); }); and bind disusr , newusr...

hdfs - how to store XML files in hadoop? -

i have installed hadoop-2.2.0 on ubuntu 12.04. want store xml files of 2-4 kb. can guide me how should it? formate namenode...start hadoop system , then... just store file, can use hadoop fs -copyfromlocal file.xml / to check file stored on hdfs run this... or in web-browser type url "hostname:50070" - hostname==ip address of machine on hadoop namenode installed. (if not single node cluster). hadoop fs -ls / to read file on hdfs shell hadoop fs -cat /file.xml

LinkedIn Connections List code is Required for android application -

i new in android , working on project shows different friend list of different social network. here @ stage fail linkedin connections list , have searched rest of internet couldn't find way. . . if know code please me. . . in advance. . cheer! sample code here bellow. . . final linkedinoauthservice oauthservice = linkedinoauthservicefactory .getinstance().createlinkedinoauthservice( config.linkedin_consumer_key,config.linkedin_consumer_secret, config.scopeparams); final linkedinapiclientfactory factory = linkedinapiclientfactory .newinstance(config.linkedin_consumer_key, config.linkedin_consumer_secret); linkedinrequesttoken litoken; linkedinapiclient client; linkedinaccesstoken accesstoken = null; @targetapi(build.version_codes.gingerbread) @suppresslint("newapi") @override public void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.main); if( build...