Posts

javascript - Swap position of number in a 4 digit number without array -

in 4 digit number how swap 1 number 3 , 2 4 number need solve 1 problem in javascript.thank you try this: x = '1234' x.replace(/(.)(.)(.)(.)/,'$3$4$1$2') result: "3412"

c# - nested repeater control and item count of child repeater -

Image
i have designed employee data using nested employee data.i have 2 table emp , dept .table information emp-empid(pk),empname,empjob,empsalary,deptid dept-deptid(fk),deptname i have shown data in department wise.parent repeater shows department table , child repeater shows emp details.and want count total number of employee department wise total salary.like wise in last want count grand total employee , grand total salary.but problem i'm facing in counting no of employee , salary department wise.here aspx.cs page .. if not getting me what's problem .. see output i've attached 1 screenshot using system; using system.collections.generic; using system.linq; using system.web; using system.web.ui; using system.web.ui.webcontrols; using system.data; using system.data.sqlclient; using system.configuration; public partial class repeatercontrolnested : system.web.ui.page { sqlconnection cn = null; sqlcommand cmd = null; sqldataadapter da = null; dataset ds =...

java - Android Studio - FileNotFound exception in editor -

i'm getting error in android studio ide before hitting "run". unhandled exception: java.io.filenotfoundexception with class: (the function in class not yet being called!) import java.io.*; public class fileio { public static byte[] readbinaryfilefromassets(file file) { byte[] data = null; datainputstream dis = new datainputstream(new fileinputstream(file)); dis.readfully(data); dis.close(); return data; } } thanks. its bothering because haven't handled potential file not found exception. surround try/catch or throw exception. public static byte[] readbinaryfilefromassets(file file) { byte[] data = null; datainputstream dis = null; try { dis = new datainputstream(new fileinputstream(file)); dis.readfully(data); dis.close(); } catch (filenotfoundexception e) { e.printstacktrace(); } catch (ioexception e) { e.print...

Passing variables using jquery and ajax php -

i'm following tutorial, issue is: have code here, tables. <tr id="<?php echo $id; ?>" class="edit_tr"> <td class="edit_td"> <span id="first_<?php echo $id; ?>" class="text"><?php echo $kodi; ?></span> <input type="text" value="<?php echo $kodi; ?>" class="editbox" id="first_input_<?php echo $id; ?>" /&gt; </td> <td class="edit_td"> <span id="last_<?php echo $id; ?>" class="text"><?php echo $vlera; ?></span> <input type="text" value="<?php echo $vlera; ?>" class="editbox" id="last_input_<?php echo $id; ?>"/> </td> </tr> now, script: <script type="text/javascript"> $(document).ready(function() { $(".edit_tr").click(function() { var id=$(this).attr('id'); $...

jquery - Symfony 2 with AJAX: Submitting Formatted Request to Controller Method -

i have controller method takes in json request. controller returns data submitted form , updated data asynchronously loaded page. form should able re-submitted number of times without reloading page. the problem running has json data being read controller method differently following initial form submission. the relevant controller code is: /** * creates new hoursspecial entity. * * @route("/", name="hoursspecial_postcreate") * @method("post") */ public function postcreateaction(request $request){ $requestdata = $request->request->all(); $date = $requestdata['eventdate']; ... } and here ajax code: /* handle submission of special hours form */ $('.specialhours_form').on('submit', function(event){ var targetform = $(this); event.preventdefault(); ajaxobject = { url: $(this).attr("action"), type: 'post', contenttype: "application/json; ...

add on - Android: Option menu like on Motorola Gallery app? -

Image
i'd design option menus of new app similar option menu in motorola gallery app. when click on album, screen darkens, , on bottom right corner, option menu buttons scroll up. do know add-on, library or whatever achieve such behaviour or have program own (that means darkening screen, animations on buttons,...) you can in way. first create layout of window <relativelayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:background="#7f000000"> <button android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="close"/> </relativelayout> in onclicklistner method of item (say album) can write code open dialog listview.setonitemlongclicklistener(new adapterview.onitemlongclicklistener() { @overri...

python 2.7 - AndroidViewClient: How to check if "Id/Text/Image" exist before touch it? -

how can check if exist id/text before touch it? i trying this: # class=android.widget.imageview com_evernote___id_close = vc.findviewbyidorraise("com.evernote:id/close") if not com_evernote___id_close: vc.sleep(1) else: com_evernote___id_close.touch() after login on evernote. shows info. if exits want close if not script continue executing. and when not exist shows error: file "/usr/local/lib/python2.7/dist-packages/androidviewclient-11.0.10-py2.7.egg/com/dtmilano/android/viewclient.py", line 3352, in findviewbyidorraise raise viewnotfoundexception("id", viewid, root) com.dtmilano.android.viewclient.viewnotfoundexception: couldn't find view id='com.evernote:id/close' in tree root=root if don't want raise exception if view not found use viewclient.findviewbyid() instead of viewclient.findviewbyidorraise() . check if returned values not none . simple!