Posts

Showing posts from July, 2011

android - How can I change Application name, project name, package name, and its icon? -

i have existing project. want change application name project name package name icon is possible set them again? use eclipse ide. for changing: app name: go res->values->string.xml -> change appname app icon: go android manifest -> android:icon = "@drawble/youricon" package name: in eclipse, right click on project android tools->rename application packege . detail follow link project name: select project, go file menu -> rename or press f2 .

Joining Summed data that has nulls - SQL Server -

how retain acct_name field appropriate when summing data below amount column , grouping line_num field? "null" values in line_num column cause problem in grouping terms when account name added. accounts c , d both have null values in line_num . if add acct_name group by clause, lose ability sum values line_num field. i attempting sum lines of accounting , group based on line number. null data isn't doing, unfortunately it's data set handed. original data: acct_name id line_num amount acct 1 1_01 100.0000 acct 1 1_01 -50.0000 acct 1 1_02 75.0000 acct 1 _02 125.0000 acct b 2 2_01 200.0000 acct b 2 2_01 50.0000 acct b 2 2_02 25.0000 acct c 3 3_01 75.0000 acct c 3 3_02 50.0000 acct c 3 3_03 -25.0000 acct c 3 null 65.0000 acct d 4 null 300.0000 a

javascript - Local script/css vs. CDN on mobile PhoneGap app -

i understand benefits of including scripts and/or css through cdn on standard web page. however, seems in case of phonegap app in javascripts , css can downloaded app, cdn decrease performance. so question is: there benefits using cdn mobile phonegap app? you right. common mistake new phonegap result in slow application start-up. depend on scenario, may disbenefit use cdn mobile phonegap app. due webview/browser behavior, phonegap picky on having it's resources locally. if want application load fast, initial resources should local. if web developer, you've come across suggestion of loading js file @ end of body tag rather in head tag. webview/browser thread availability same reason why it's better have file local in phonegap. remember have wait body onload before phonegap deviceready event. now, on other hand, if load blogs/articles on subsequent single page application view ajax, benefit cdn hosting of blog/article static contents.

ruby on rails - Image attribute not saving in test with FactoryGirl -

app i have column bg_image in table user uses carrierwave uploader mount_uploader :bg_image, userlogouploader it gets set in activeadmin/formtastic form below: f.input :bg_image, :label => "background image", :as => :file tests (where problem is) i have factory user make basic version required fields (which works in other tests), when try add bg_image doesn't saved. factory: factorygirl.define factory :user stuff "set in factory" end end test file: let!(:user) { create(:user, :something => "that works", :bg_image => "doesntwork.png") } "inspects element" puts user.inspect end prints out #<user id: 1, stuff: "set in factory", something: "that works", bg_image: nil> i can't seem figure out why doesn't save! i tried few things setting file object won't work because needs string im pretty sure not working because in tests using bg_

editor - insert numerical sequence in large text file -

i need create file in format : item0000001 item0000002 item0000003 item0000004 item0000005 i doing ultraedit has column mode including insert number ( start + increment including leading zeros ). unfortunately, ultraedit bombs out above 1 million rows. does know of text editor large file capacity has similar operation? baltostar has not written version of ultraedit used , how has tried create file. however, here ultraedit script can used create file lines containing incrementing number leading zeros according last number. to use script ultraedit v14.20 or uestudio v9.00 or later version, copy code block of script , paste new ascii file dos line terminations in ultraedit/uestudio. save file example createlineswithincrementingnumber.js preferred directory of ue/ues scripts. now run script clicking on menu item run active script in menu scripting . the script prompts user first , last value of incrementing number, , strings left , right of incrementing numbe

windows - How do I draw lines inside a Visual C++ PictureBox -

i want draw black lines inside visual c++ forms picturebox plot information. can how should go doing this? can picturebox used or should use else instead? to draw on winforms control, handle paint event, graphics object, , call drawline or other methods heart's content. there's example of on msdn .

Writing a JSON (or TXT) file in WPF C# -

i have been trying make sense of http://msdn.microsoft.com/en-us/library/sfezx97z.aspx uses savefiledialog, hard me understand. have following code: fileinfo existingfile = new fileinfo("c:\\users\\cle1394\\desktop\\apple foreign tax payment sample layout proposed - sample data.xlsx"); consoleapplication2.program.exceldata data = consoleapplication2.program.getexceldata(existingfile); var json = new javascriptserializer().serialize(data); how can output contents of json .json or .txt file? i let user either see link/ button click download/ save file location on computer, or, display save file dialog box can save file location on computer. edit (to let op comment on parts not clear): savefiledialog savefiledialog1 = new savefiledialog(); savefiledialog1.showdialog(); if(savefiledialog1.filename != "") { file.writealltext(savefiledialog1.filename,json); } you looking this, then: file.writealltext(@"c:\some\path\json.txt"

Custom inputView breaks apart when UITextField is enabled in iOS -

Image
i working on creating custom keypad ipad app. created keypad custom inputview , assigning inputview attribute each textfield. built keypad in storyboard, , when place cursor in textfield, delegate method: -(bool)textfieldshouldbeginediting:(uitextfield *)textfield{ nslog(@"how here?"); return yes; } gets called, keypad weird reason breaks , spread on screen. have no idea why happening. here screen looks when app first loads: and here how app looks after place cursor in textfield calls above method: here screen looks when turn autolayout off: i have no idea why happening. doing wrong? thanks in advance reply.

PHP see if a 'last sent' date was 30+ days ago -

i have php code: $last_sent=strtotime('2013-08-12'); if($last_sent < strtotime('now +30 days')) { echo 'send survey'; } else { echo 'dont send survey'; } i need see if $last_sent date 30 days ago or more 30 days ago. doesnt seem working though. i change last sent date 2013-07-12 (exactly 30 days ago) echoes send survey , when change date today (2013-08-12) still says 'send survey' instead of strtotime('now +30 days') use strtotime('-30 days') .

c# - Custom ProgressBar control issue -

i created simple cool progressbar control using tutorial. however, i'm facing issue. code: using system; using system.collections.generic; using system.drawing; using system.drawing.drawing2d; using system.linq; using system.text; using system.threading.tasks; using system.windows.forms; namespace revarz { class graphicshelper { public graphicspath createround(int x, int y, int width, int height, int cornerradius) { graphicspath gfxpath = new graphicspath(); try { gfxpath.addarc(x, y, cornerradius, cornerradius, 180, 90); gfxpath.addarc(x + width - cornerradius, y, cornerradius, cornerradius, 270, 90); gfxpath.addarc(x + width - cornerradius, y + height - cornerradius, cornerradius, cornerradius, 0, 90); gfxpath.addarc(x, y + height - cornerradius, cornerradius, cornerradius, 90, 90); gfxpath.closeallfigures(); return gfxpath;

unix - Feedback on Assembly answer -

i have been asked provide solution following question; 1.a) in mips assembly, there many ways of copying contents of 1 register register, using 1 instruction. write 5 single instructions, each copy contents of $s0 $s1 . cannot use mips pseudo-instructions. i have worked out following solutions, unable find way "mark" them please reply if there "easier" ways or if think of following wrong; add $s1, $s0, $zero addi $s1, $s0, 0 sub $s1, $s0, $zero lw $s1, 0($s0) , $s1, $s0, $zero as further point have following question, has thrown me, due double ^ involved; 1.b) if execute following grep command: grep -e "^[^a][bc].*" which of following lines (typed on console) matched? abc abx zc zchello abno bb bdbc bca cba bbbbb any of course appreciated. 4 out of 5 fine me. however operation: lw $s1, 0($s0) does not want. x(reg) syntax indirect addressing . let's $s0 contains 1165. in case, lw $s1, 0($s0) put $s1 value stored @

python - Most efficient method of querying MYSQL Table -

so have table, in future contain thousands of rows. the rows contain date , other data need return. i have array of dates need query original table return appropriate data. currently have setup whole original table copied array, each date, use loop copy data. for un in range(0,listc) in range(0,bigtablec) if list[un] == bigtable[i][1] a[un] = bigtable[i][2] so above example of how works. my question whether using multiple select queries on bigtable quicker above method. so each of "for un in range(0,listc)" query table corresponding date in list array. data single returned row. appologies if obvious question. this not solution. you should try bring data in 1 network round trip rather having 1 per date in list. you don't how data represents in memory. you'll want careful "copy whole table array". the efficiency of query combination of explain plan, indexes on table, , how many network round trips n

css - Creating multiple classes with LESS function -

i want accomplish css (and more not posted brevity) less can have more control , auto creation of classes. not sure how less can me it. .m-xs { margin-top: 5px; margin-right: 5px; margin-bottom: 5px; margin-left: 5px; } .m-t-xs{ margin-top: 5px; } .m-r-xs{ margin-right: 5px; } .m-b-xs{ margin-bottom: 5px; } .m-l-xs{ margin-left: 5px; } .m-h-xs{ margin-right: 5px; margin-left: 5px; } .m-v-xs{ margin-top: 5px; margin-bottom: 5px; } i want repeated several sizes (xs, s, m, l, xl, etc) , other properties padding. how can use less kind of 'autocreate' thing ? possible without writing classes? never used less see heavy use of on bootstrap , think can achieved. tested few things looks it's advanced scenario because none of tutorials have covered. thanks! to generate classes you've mentioned there try parameterised mixins: .classes (@size) { .m-@{size} { margin-top: 5px; margin-right: 5px;

javascript - SignalR - Unable to get property 'client' of undefined or null reference -

i having problems using signalr in existing web application. receiving javaruntime exception "unable property 'client' of undefined or null reference" because when try retrieve hub $.connection object, returning null. before post code, wanted supply background , things have tried: - if run project locally, works fine. when deploy project iis location have issues. - have verified hub name correctly camel cased. again, works fine locally, , throws error after have deployed project iis. - have confirmed javascript has loaded. jquery library referenced once, , loads fine. signalr javascript, , dynamically created signalr/hubs. - if create new project, , run same code new web application running web app under existing web application, works fine (same code being used, in new project). anyone have thoughts on problem is? hub code: imports microsoft.aspnet.signalr public class testhub inherits hub public sub connect() try cl

c# - Access is denied (Running a .bat file) -

this code build .bat file , run it. stringbuilder batch = new stringbuilder(); batch.appendline("@echo off"); batch.appendline("taskkill /im " + process.getcurrentprocess().processname + ".exe /f"); batch.appendline("ping localhost > nul"); batch.appendline("del /f " + (char)34 + application.executablepath + (char)34); batch.appendline("ren " + (char)34 + application.startuppath + @"\update.exe" + (char)34 + " " + process.getcurrentprocess().processname); batch.appendline((char)34 + application.executablepath + (char)34); batch.appendline("del %0"); file.writealltext(application.startuppath + @"\update.bat", batch.tostring(), encoding.default); process.start(application.startuppath + @"\update.bat"); however, access denied, have run admin, how can it? not answer question, think not approaching best direction. instead see question provides robust a

html - Getting "cannot call method ... of undefined" error with JavaScript and Mustache -

i'm using html, javascript, , jquery mobile make kind of picture gallery. i'm following jqm demo at: http://jquerymobile.com/demos/1.3.0-beta.1/docs/demos/swipe/swipe-page.html make gallery, uses totally different html page each picture. plan gallery dynamic, don't have set number of pages or set list of picture names, etc, , thought might use mustache make picture template, , create pages dynamically. here basic layout of code: in index.html <!doctype html> <html> <head> ... <script src="mustache-0.7.0-min.js" type="text/javascript"></script> <script src="mobile.js" type="text/javascript"></script> <script id="test_template" type="text/html"> <h1>{{firstname}} {{lastname}}</h1> <p>{{temptext}}</p> </script> ... </head> ... and in mobile.js function showperson() { var pers

android - Why are all my Gradle product flavors building? -

i have 2 product flavors in android project build gradle. one of flavors declares dependency dependency used in both flavors. both flavors build, since 1 of flavors depends on library declared first flavor should not case. since 1 of flavors pro version in end should not have admob sdk in apk fear reason both flavors add admob sdk. i have following build.gradle file: buildscript { repositories { mavencentral() } dependencies { classpath 'com.android.tools.build:gradle:0.5.+' } } apply plugin: 'android' repositories { mavencentral() } android { compilesdkversion 18 buildtoolsversion "18.0.1" defaultconfig { minsdkversion 10 targetsdkversion 18 } productflavors { pro { packagename "de.janusz.journeyman.zinsrechner.pro" } free { dependencies { compile files('src/free/libs/admob.jar')

javascript - How can I export a DIV to an Image -

i'd export div png or jpg image. div has appended two.js object. two.js draws svg means can't use canvas todataurl alternatives guess. the two.js instance 400 400px box including basic grid (horizontal & vertical lines) made using two.makeline(x1,y1,x2,y2) . javascript should return generated image/screenshot of div or two.js object if possible. you can switch rendering contexts in two.js , two.js always provides reference elements creates. e.g: var 2 = new two({ type: two.types.canvas }).appendto(document.body); var canvas = two.renderer.domelement; var dataurl = canvas.todataurl('img/png'); // though data blank because there's nothing being rendered.

c++ - Making unordered initialization statc ordered -

the following class uses crtp attempt add types std::vector has schwarz counter ensuring initialization order. according 3.6.2/2 member h_ has unordered initialization. how change ensure has ordered initialization? deriving class have nothing more correctly inherit class. #ifndef p_h_ #define p_h_ #include "pr.h" template <typename t> class p { class helper { public: helper() { pr.push_back(typeid(t)); } }; static helper h_; }; template <typename t> typename p<t>::helper p<t>::h_; #endif the standard pattern type of problem use generator instead of exposing global static variable. (this old problem in c++) so change: static helper h_ ; to: static helper & h_() ; and define this: template <typename t> typename p<t>::helper & p<t>::h_() { static p<t>::helper value_ ; return value_ ; } thus guaranteed initialized before used.

operators - How does Python implement the modulo operation? -

i'm curious in regards time , space complexities of % operator in python. also, python use bitwise operation % 2 ? edit: i'm asking python 2.7's implementation, in case differs of python 3 python uses classic algorithm d knuth's 'the art of computer programming'. running time (generally) proportional product of lengths of 2 numbers. space proportional sum of lengths of 2 numbers. the actual division occurs in objects/longobject.c , see x_divrem() . background on internal representation of python long, see include/longintrepr.h . % 2 not use bitwise operations. standard idiom checking if number even/odd & 1 . python 2 , 3 use same algorithm.

java - Why is casting the class of a generic to Class<T> unsafe? -

i'm making methodpointer class in order simulate functionality of function pointers c++. @ first, doing object s, had thought -- why not make generic? the problem came in constructor, attempted call constructor signature methodpointer(class<t> clazz, string methodname, class<?> ... paramclasses) : public methodpointer(t object, string methodname, class<?> ... paramclasses) { this(object.getclass(), methodname, paramclasses); this.object = object; } i assumed work fine, received following compiler error: the constructor methodpointer<t>(class<capture#1-of ? extends object>, string, class<?>[]) undefined so, confused, did this: public methodpointer(t object, string methodname, class<?> ... paramclasses) { this((class<t>) object.getclass(), methodname, paramclasses); this.object = object; } it compiles, receive following warning: unchecked cast class<capture#1-of ? extends object> class<t>

html - Can i add css property shortcuts to sublime text? -

Image
can add more shortcuts 1 sublimetext? like 1 "m-a" expand margin: 0 auto; ? i apologize if has been asked. couldn't find answer. these called snippets . particular example, open tools menu , select new snippet... , paste in following: <snippet> <content><![cdata[margin: 0 auto;]]></content> <tabtrigger>m-a</tabtrigger> <scope>source.css</scope> </snippet> save file packages/user/css/margin auto.sublime-snippet , should go. open css file, type m-a , hit tab , , you're set. snippets pretty powerful, , allow tab stops enter customized data. example, set boilerplate code requires colors customized so: <snippet> <content><![cdata[body { max-width: 500px; _width: 500px; padding: 30px 20px 50px; border: 1px solid ${1:#b3b3b3}; border-radius: 4px; margin: 0 auto; box-shadow: 0 1px 10px ${2:#a7a7a7}, inset 0 1px 0 ${3:#fff}; backgrou

jquery - Twitter Bootstrap: Modal Wont Fire -

i'm using plugin: http://pongstr.github.io/pongstagr.am/# but cannot model open image in modal. i'm not sure is, issue in 'undefined' not function (evaluating '$('#' + imageid ).modal()') any idea issue be? here's link website: http://www.airmanstudios.com/tests/page9/ after investigation, believe you're not including of bootstrap files need. correct me if i'm wrong, couldn't find bootstrap-transition.js, required modal usage: http://getbootstrap.com/2.3.2/javascript.html#transitions hope helps!

Jenkins trigger call/build on other projects plugin not evaluating my env var -

in jenkins job, have "execute shell section" declaring new variables , adding values e.g installdir=/work/homes/x". following section have "trigger call/build on other projects" section. calling project , want send installdir predefined parameter. have turned on "current build parameters" , "predefined parameters". in predefined paramters, have given install_dir=$installdir. but not evaluating this. how can make evaluate installdir variable. fyi: have set installdir different path based on user input. execute shell place can this. you should use parameterized trigger plugin: https://wiki.jenkins-ci.org/display/jenkins/parameterized+trigger+plugin update: see comments thread info, parametrized trigger plugin not work particular use case.

java - Why is my code to enter input to a batch file not working? -

i'm trying write loaded batch file process, cannot figure out how equivalent of return. java code: import java.io.datainputstream; import java.io.dataoutputstream; import java.util.scanner; public class start { public static void main(string[] args) { try { process p = runtime.getruntime().exec("c:\\users\\max\\desktop\\test.bat");// runtime.getruntime().exec("keytool -genkey -alias " + name.replace(" ", "").trim() + " -keystore key"); datainputstream in = new datainputstream(p.getinputstream()); scanner scanner = new scanner(in); // system.out.println(scanner.nextline()); dataoutputstream out = new dataoutputstream(p.getoutputstream()); out.write("test\n\n".getbytes()); out.flush(); out.close(); }catch (exception e) { e.printstacktrace(); } } } batch code: @echo off set

javascript - Using replace to select part of a URL -

hello i'm new javascript , need little regex/replace i want take url example (url case 1) http://url.com/_t_lastupdate_2670619?location=50457347 or (url case 2) http://url.com/_t_2670619 i want select in case just _t_2680619 ignore after "?" , before (underscore)t(underscore) is possible regex/replace? thing managed select numbers with var _t__and_number = document.url.replace(/[^\d]/g, ''); alert(_t__and_number); but doesn't solve problem if there's url case 1 (if first number without (underscore)t(underscore) me lot. thanks solutions: onetrickpony /michaelb958: var _t__and_number = window.location.pathname; alert(_t__and_number); ermagana: var _t__and_number = document.url.replace(/\?.*/g, '').match(/.*\/(.*)/)[1]; alert(_t__and_number); as suggested onetrickpony , if url browsing, window.location.pathname yield part of url.

c# - break does not seem to return to previous loop -

i programming robot c# , using digitial compass direction. problem having when goes turn loop, doesnt come out of it. dragonboard controller talking too. how supposed work given set heading , time, turns left or right till heading matched drives forward set amount of time. problem having go forward when goes turn loop, stays there, , doesnt return loop. appreciated. private void drive(int heading, int time)//going start kit { int i; (i = 0; < time;i++ ) { dragonboard.write("w");//go forward while (int.parse(bearingtxt.text) - 1 > heading) { dragonboard.write("a");//turn left break; } while (int.parse(bearingtxt.text) +1 < heading) { dragonboard.write("d");//turn right break; } } dragonboard.write(" "); if (listbox1.selectedindex < listbox1.items.count - 1) { listbox1.selectedindex

jquery - Best way to send parameters to php controller with AJAX -

i want sent 2 parameters client ( jquery ) side server side ( php-codeigniter ). parameters id ( integer ) , text ( string ). tried: window.location.href="ajaxupdate/sendmessage/"+id+"/"+text; which has worked me in past using id, because text string can have spaces can get: http://localhost/b1/mycontroller/myfunction/3/gdfgdgd%20&nbsp;%20&nbsp;gd which gives: an error encountered uri submitted has disallowed characters. what best way prepare , transmit string server side using jquery? assume ajax used in way you can use jquery .ajax() function post data ( json ) php script, this: var postdata = { "param1" : some_value1, "param2" : some_value2 }; console.log(postdata); $.ajax({ type: "post", url: "test.php", data: postdata, success: function(){ alert(param1 + ' ' + param2); window.open("test.php"); } }); update: php sampl

ruby - LoadError on line ["51"] when trying compass watch command -

i new @ sass, have been trying use "compass watch config.rb" command when run get: loaderror on line ["51"] of /usr/local/rvm/rubies/ruby-1.9.3-p392/lib/ruby/site_ruby/1.9.1/rubygems/core_ext/kernel_require.rb: cannot load such file -- animation run --trace see full backtrace any offer great. i tried uninstalling , reinstalling sass , compass gems. i got going now. turns out needed install "animation" gemfile. gem install animation --pre thanks everyones help.

nginx - how to use PCRE match in access_log path -

i read article http://wiki.nginx.org/httplogmodule , seems possible. i'd have in config directives below doesn't seem work. can provide guidance? location ~ /foo/(.*) { access_log /var/log/$1.access.log; } there few things should keep in mind, must knowing of them ;). nginx has one parent process (master process) runs root . the default logs created (if doesn't exists) when nginx gets started/restarted/reloaded , root user . so obvious owner of /var/log/nginx root. drwxr-xr-x 2 root root 4096 aug 14 01:35 nginx/ or generalize, owner /var/log root, , root can write in it. any request processed the worker process ( owned & run 'nginx/nobody' user), not by the master process ( owned & run 'root' user). if no nginx user there worker processes run user nobody* . root 1272 0.0 0.1 12080 3932 ? ss 00:27 0:00 nginx: master process /usr/sbin/nginx -c /etc/nginx/nginx.conf nobody 4226

php - Laravel 4 - Trouble overriding model's save method -

i'm trying override post class's save() method can validate of fields saved record: // user.php <?php class post extends eloquent { public function save() { // code before save parent::save(); //code after save } } when try , run method in unit testing following error: ..{"error":{"type":"errorexception","message":"declaration of post::save() should compatible of illuminate\\database\\eloquent\\model::save()","file":"\/var\/www\/laravel\/app\/models\/post.php","line":4}} create model.php class extend in self-validating models app/models/model.php class model extends eloquent { /** * error message bag * * @var illuminate\support\messagebag */ protected $errors; /** * validation rules * * @var array */ protected static $rules = array(); /** * validator instance *

Building a product page with gallery using jQuery -

Image
i'm helping client build product site, 1 of pages displays details of products selling. 1 of requirements of product detail page have multiple images of product (which i'm fine with, going implement slider) product images in different colours. depending on colour user selects relevant product images shown. i'm having trouble how implement colour select option. i using bx-slider ( http://bxslider.com/ ) on page able reuse same slider. give me pointers? i've included design of product page here: would appreciate help!! i've never used bxslider, looks use advantage: http://bxslider.com/examples/custom-next-prev-selectors if create custom prev/next selectors can create index, know colour selected in slider , display corresponding image. custom selectors, done in jquery.click() functions of 2 spans (in example). $("#slider-next").click(...change image index + 1...); $("#slider-prev").click(...change image index - 1...);

Parsing complex text file in Python -

i have text file following: #some_line @another_line original_string1|new_string1 #some_other_line @and_another_line original_string2|new_string2 i want able associate every line @ preceding line #. cannot seem figure out strategy achieve in python. here current code: open(self.file, 'r') f: i, line in enumerate(f): line = line.strip(' \t\n\r') if '#' in line[:1]: self.parent[i] = line[1:] if '@' in line[:1]: self.child[i] = line[1:] if '|' in line: key, value = line.split('|') self.strings[key] = value i need able reference each parent entry , associate child entries it. lines '|' need associated parent well. i think want mapping child strings parent strings. or maybe want mapping child strings , parent strings line numbers. so here's i'll do: build ma

jquery - Javascript multi click event -

i need have link of output of have done below using javascript , html. http://i.imgbox.com/adlmvtix.jpg need when click on 1 circle other circle should disabled , 1 clicked should active..the problem when click on circle , click one..both stays active.. this javascript code have done far,please me out guys appreciate it! <head> <title></title> <!--scripts--> <script src="jquery/jquery-1.7.2.min.js" type="text/javascript"></script> <script src="scripts/main.js" type="text/javascript"></script> <!--styles--> <link href="styles/styles.css" rel="stylesheet" type="text/css" /> <script type="text/javascript"> $(document).ready(function () { $('#c1').click(function () { //$(this).css('background-color', '#005aa8'); $(this).css('wid

jsp - How to get a 'select-option' area updated automatically with the values from the database..? -

i want "select-option" option values updated automatically. mean is want specific values in database put in select-option area whenever updated in database when user registered in database want his/her registration number updated in "option-select" area same time.how do it. coding in java/jsp/servlet. i don't know if right point in question, key there use js-->java-->js @requestmapping("/url/loaddata") @responsebody public string loaddata() throws exception { jsonserializer s = new jsonserializer(); return s.serialize(classservice.getdata()); //method find parsing of data db } call mapping in js function loaddbdata() { $.ajaxutility({ url : '/url/loaddata.htm', showerrorprompt : true, showinfoprompt : false, success : function(data, xhr, s) { datafromdb = data; $(datafromdb).each(function(index, value){ $(&

Drupal Webform Submissions -

i have created job application webform on drupal , contains usual input fields: name, email , attach cv. form works fine, user completes form , on submission both user , myself automated email acknowledging submission. is there way to: add tick box next each individual submission in drupal email selected users (preferably directly drupal) cheers guys, rumman you can using form_alter hook webform. don't give facility anonymous users because can make send email else(spamming).

python - Django Multiple DB, authenticating from NON default db -

i have 2 databases configured in django project: default reports the reports database contains auth_user , while authenticating user, users checked in default database. how can use authenticate() reports database? you can custom database router, shown in the django documentation covers kind of situation: class authrouter(object): """ router control database operations on models in auth application. """ def db_for_read(self, model, **hints): """ attempts read auth models go reports. """ if model._meta.app_label == 'auth': return 'reports' return none def db_for_write(self, model, **hints): """ attempts write auth models go reports. """ if model._meta.app_label == 'auth': return 'reports' return none def allo

Getting Encrypted CAS User through serviceValidate -

i using oauth2.0 service token cas server. when trying validate token using /cas/servicevalidate url getting response <cas:serviceresponse xmlns:cas='http://www.yale.edu/tp/cas'> <cas:authenticationsuccess> <cas:user>jjuh5fmvz6lsq+4xwipe39iczx0=</cas:user> </cas:authenticationsuccess> </cas:serviceresponse> where user in encrypted format. know may user/pass admin/admin. how can identify user or encryption technique used. thanks,

semantic web - Why some rdf files does not contain <rdf:Description rdf:about=...>? -

i'm using jena write rdf file describes online posts. according sioc ontology/namespace i'm using there is, instance, following: class: sioc:post property: sioc:has_creator how can i, in jena, include sioc:post in file <sioc:post rdf:about="http://example.com/vb/1035092"> instead of <rdf:description rdf:about="http://example.com/vb/1035092"> and best practice? both of answers far make points: you should not pay attention particular serialization of rdf graph, because there lots of different serializations, , should accessing them using api exposes graph , not serialization. (see, instance, don't query rdf (or owl) xpath in 1 of previous answers, comments depending on particular xml serialization.) the difference you're seeing simple rdf/xml serialization use lots of rdf:description elements, , these contain rdf:type elements indicate types of described element. however, rdf/xml serialization format de

javascript - How to generate dynamic name and id for a textfield -

i have javascript function used generate textfield dynamically, when clicking previous textfield. html <input class="incfield" type="text" name="textfield" /> javascript $(function () { var createnewfield = function () { var $node = $('<input class="incfield" type="text" name="textfield"); $node.one('click', createnewfield); $(this).after($node); } }; $('input.incfield').one('click', createnewfield); }); the function working want textfield should have id , name tag, dynamically generated. for example: first textfield id=t1 t2,...etc. how can this? $(function () { var cnt= 0; var createnewfield = function () { var $node = $('<input class="incfield'+cnt+'" type="text" name="textfield'+cnt+'"/>'); $node.one('click', createnewfield); $(this).after($

dynamics crm 2011 - ADFS endpoint issue -

i trying access crm 2011 org like: using (organizationservice service = new organizationservice("crmconnection")) { } the connectionstring looks like: <connectionstrings> <add name="crmconnection" connectionstring="server=https://ourdomainname.ourdomainname.com;username=theuser;password=thepass" /> </connectionstrings> when run code throws below error: there no endpoint listening @ http://adfslogin.ourdomainname.com/adfs/services/trust/13/username accept message. caused incorrect address or soap action. please note can access url in ie using same credentials specified in web.config. can point out missing causing issue? please refer this: http://www.powerobjects.com/blog/2014/04/22/error-adfsifd-url-dynamics-crm/ it doesn't work, in cases does. idea make sure enough iisresets , reconfigurations possible , in different orders make sure right one. the steps described in article good, reason crm do

ios - UILabel tap working in simulator but not in iphone -

in ios appliation there label hidden , displayed when button clicked , when user taps on label should give alertview. user interact label enable userinteraction enabled , number of tap gestures 1 working in simulator not on iphone simulator works on ios6 , iphone on ios7 why use uilabel ? use uibutton with title text and set button type custom making background color clearcolor . also set action in touchupinside

java - equals() and == for the class object -

i have enumeration emulation class. both objects in main p , pp passing == , equals test. both tests passed in case when p = packettype.none; pp = packettype.none; and both prints nothing in case p = packettype.startofoperation; pp = packettype.none; what invoked in method equals , operator == ? think == should not pas because must if object have same pointer. in other words should same object (and in our case not). public class packettype { string name = "9"; public static final packettype none = new packettype("9"); public static final packettype startofoperation = new packettype("1"); packettype(string name) { this.name = name; } public string tostring() { return name; } public static void main(string[] args) { packettype p = packettype.none; packettype pp = packettype.startofoperation; if (p == pp) { system.out.print("==");

list - What is the core difference between strings and numbers in Common Lisp? -

being new cl, play lot simple algorithms. instance, tried implement function removing unique elements in list. (1 2 2 3 3 4 5 3) -> (2 2 3 3 3) first attempt lead code: (defun remove-unique (items) (let ((duplicates (set-difference items (remove-duplicates items :test #'equal)))) (append duplicates (remove-duplicates duplicates :test #'equal)))) this works ok strings return nil numbers. reading bit more set-difference i've learned isn't suppose work duplicate populated lists @ all, works somehow in case, abandoned approach unportable , moved along. another attempt is: (defun remove-unique (items) (loop item in items when (member item (cdr (member item items))) collect item)) and works ok numbers, returns nil strings. apparently there core difference between strings , numbers don't understand. how come list processing functions such member , set-difference work differently on them? strings more related lists numbe

r - Merging different size data frames and repeating values -

i need merge 2 different size data frames. larger 1 ( df1 ) has column several repeated values ( licto ), shorter 1 ( df2 ) has column licto , values not repeated. df2 has id column. need new column in df1 ids in df2 , repeated according repeated values in licto . example below make clearer. df1<-data.frame(licfrom=c(15470,16307,17121,15350,16982,17182,20319,16727,16946,16262,16605, 16607,15924,15399,15404,16739,16839,16842,16899,16157,15399), licto=c(17121,17121,17121,16982,16982,16982,16982,16946,16946,16262,16607, 16607,15924,16839,16839,16839,16839,16839,16839,16157,15399)) . df2<-data.frame(licto=c(17121,16982,16946,16607,15924,16839,16157,15399), fisherid=c(160,760,770,406,106,2196,17323,2441)) my data frames this: df1 df2 licfrom licto licto fisherid 15470 17121 17121 160 16307 17121 16982 760 17121 17121 16946 770 15350 16982 16262 947 16982 16982

c - API returning a structure -

what's best solution when: our api returns structure user we want user able read contents we don't want user change it, because might passed other api function , contents should correct? your function can return pointer const structure. then: the caller not permitted modify structure through pointer const structure. c implementation should enforce rule. if caller passes pointer const structure function in api, c rules permit function convert pointer const structure pointer non-const structure. if structure not defined const (e.g., created non-const, pointer converted pointer const structure), function permitted modify structure through newly converted pointer non-const structure. the c rules permit caller same conversion , modification. obviously, caller should not this, , relying on not so. thus, technique prevents inadvertent modifications through returned pointer not prevent malicious modifications through converted pointer. to go further that, ca