Posts

Showing posts from March, 2014

jboss - EJB - Could not parse configuration: hibernate.cfg.xml -

this first question here, i'm quite new in hibernate please forgive me if question shouldn't posted here. i know, forums full question , there different answer haven't been able solve problem. i try deploy ear contains ejb project , web project. ejb project has bean tries initialize hibernate, same error time. use jboss 7.1.1. if move classes related hibernate , database web project work well, can access db. same hibernate.cfg.xml , same java packages , classes. please, take @ hibernate.cfg.xml , please advice. in advance. hibernate.cfg.xml: <?xml version="1.0" encoding="utf-8"?> <!doctype hibernate-configuration public "-//hibernate/hibernate configuration dtd 3.0//en" "http://www.hibernate.org/dtd/hibernate-configuration-3.0.dtd"> <hibernate-configuration> <session-factory> <property name="hibernate.bytecode.use_reflection_optimizer">false</property> &

c - bad output from pipe with multiple processes -

in following code, have 2 pipes, one, fd[] handles ferrying range variable child processes. other pipe rw[] responsible printing results of method. fd works correctly, rw prints garbage. both range , narc_num long , have sucessfully printed string , char through rw pipe. ideas? thanks. #include <stdio.h> #include <stdlib.h> #include <unistd.h> #include <math.h> #include <string.h> /** * process propigating version of narcisstic base-10 number generator **/ /** * narcissistic number number of digits, when raised power n n number of digits in number, equla number itseld. * examples: * 2^1 = 2 **/ void isnarcissisticnumber(int rw[], long min, long max){ // printf("min %ld max %ld\n", min, max); long n; for(n = min; n <= max; n++){ long num = n; int digits = floor(log10(num)) + 1; int digit_arr[digits]; long narc_num = 0; int index = 0; do{ digit_arr[index++] = num%10;

Why doesn't linking Javascript files from header work but only at the end of the html works? -

i'm playing around kinetic.js , noticed linking javascript @ end of body work. wouldn't adding javascript in head work? here html <!doctype html> <html> <head> <title>tictactoe</title> <meta http-equiv="content-script-type" content="type"> </head> <body> <div id="container"></div> <script type="text/javascript" src="http://d3lp1msu2r81bx.cloudfront.net/kjs/js/lib/kinetic-v4.4.0.min.js"></script> <script type="text/javascript" src="javascript.js"></script> </body> </html> and here javascript file: var stage = new kinetic.stage({ container: 'container', width: 500, height: 500 }); var layer = new kinetic.layer(); var rect = new kinetic.rect({ x: 239, y: 75, width: 150, height: 50, fill: 'green',

Why is Rails app sending two Ajax requests instead of one, only when using Firefox and on my local server? -

i'm learning rails development , building reddit-like app voting on comments , posts learn. have ajax-ified voting, , on local machine when vote post/comment or down sends 2 requests , creates 2 votes on either object. these votes viewable in votes table. this occurs in firefox (not chrome or ie), , occurs on local machine (it's fine in heroku). verified firebug sending 2 requests, can't figure out why. don't believe asset pipeline causing trouble because there isn't in there. this started once modified voting behavior reloading page on each vote using ajax display vote totals. note user can vote many times he/she wants right now my code on github here: https://github.com/hellomcfly/tl_postit2 my app on heroku here: http://fathomless-waters-1981.herokuapp.com i don't know code help, here in postscontroller: def vote @vote = vote.create(voteable: @post, user: current_user, vote: params[:vote]) respond_to |format| format.html

How to deep link a Facebook like from external website -

is possible create link facebook content, such photo, outside of facebook? i've tried play around passing facebook urls standard button tools doesn't seem work. ideas appreciated! so possible. got working setting facebook app , creating basic authentication. after authentication completed, use js pull access_token param returned url , form via post submit desired photo passing photo's fbid , user's access_token via graph.facebook.com. looks this. <form> <a id="facebook-authentication" href="https://graph.facebook.com/oauth/authorize?type=user_agent&client_id=[your_app_id_goes_here]&redirect_uri=[your_desired_redirect_page_goes_here]&scope=offline_access,publish_stream"> <div id="facebook-authentication-button"> start vote! </div> </a> </form> some additional js used automatically submit form upon redirect, that's not necess

mysql - Issues creating daily event -

trying create daily event in mysql: create event resetstatus on schedule every 1 day begin if (date('2013-04-05') = curdate()) update mytable set resetstatus = 1 id = (select pid usertable priority = 'a'); end if; end; get error: lookup error - mysql database error: have error in sql syntax; check manual corresponds mysql server version right syntax use near '' @ line 12 if take update statement , place in toad , run, runs no errors. as documented under defining stored programs : if use mysql client program define stored program containing semicolon characters, problem arises. default, mysql recognizes semicolon statement delimiter, must redefine delimiter temporarily cause mysql pass entire stored program definition server. you need set client use statement delimiter other ; , thinks first semicolon encounters (at end of update

ruby on rails - ActiveRecord boolean resets to default on update -

i have boolean field has default value of false in joining table of has many through relationship: tags , tag lists. add_column :taggings, :tag_visible, :boolean, :default => false the theory tag list can have many tags (and vice versa) tags visibility can turned off/on per tag list. part of nested resource: document has_one :tag_list for part working. default value set on creation , updating each instance ajax call. however when update document includes tag_list token input field resets of tagging's visibility false regardless of previously. any leads appreciated. turns out in tags token_input setter inside tag_list model deleting , recreating new record in tagging model instead of updating it. old code: self.taggings = tag.ids_from_tokens(tokens, user_id).each_with_index.map {|t,i| tagging.new(:tag_id => t, :tag_colour => tag_colours[i % tag_colours.size]) } fix: self.tag_ids = tag.ids_from_tokens(tokens, user_id) self.taggings.each_with_in

asp.net - How to pass parameter to asynchronous task in c# -

during asp.net web request need kick off asynchronous task , return control web page. can show me code calling below method? clear, want function called async , web request complete returning control calling page while function still processing. private void functiontocall(iinterface objectiwanttopassin) { // stuff } you'll want spawn thread creating task task = task.factory.startnew(action, "arg"); then you'll want maybe when task done: task.continuewith(anotheraction); of course action , otheraction void methods in case.

How to combine filter coefficients for multiple stop band filters - Matlab -

Image
i combine several stop band filters single filter understand how filter changes phase when there mutiple bands removed. this question provides solution 2 filters, if there more 2 filter bands? here image showing gains , phase of each separate filter. so questions are: what happens phase if filter data in 5 separate operations can combine filtering steps single step? i using butter , freqz functions in matlab. [b,a] = butter(order,cutoff/(fs/2),'high'); [h,w] = freqz(b,a,fs); thanks. the phases , magntudes (db) sum. if want see on matlab need cascate filter, exemple: % computes coefficients [b1,a1]=butter(8,0.6); [b2,a2]=butter(8,0.4,'high'); [b3,a3]=butter(8,0.2,'high'); % creates filters h1=dfilt.df2t(b1,a1); h2=dfilt.df2t(b2,a2); h3=dfilt.df2t(b3,a3); % creates cascate filter hcas=dfilt.cascade(h1,h2,h3) % plot hcas.freqz()

java - Multiple inputs with arrays using String - Names -

i need write program have user enter list of tutor names. 10 peer tutors may hired. then, program present each name, based on list alphabetized last name. have far, not work , don't know do. need continue run until stop , continue more of program. import javax.swing.joptionpane; import java.util.arrays; public class report { public static void main(string[] args) { int numtutors = 10; string[] listnames = gettutornames(); } public static string[] gettutornames() { string firstname; string lastname; string[] listnames = new string[10]; (int x = 0; x < listnames.length; x++) { firstname = joptionpane.showinputdialog(null, "enter tutor's first name: "); lastname = joptionpane.showinputdialog(null, "enter tutor's last name: "); if (firstname.equals("")) && lastname.equals("")) { break; // loop en

php - str_replace not working on database return -

i'm getting stumped should simple str_replace function. in database, have field minecraft server motd(message of day). when collect data servers store data including motd in database. servers able color motds adding color code, have stored in database &sect number specifying color. i'm trying use str_replace turn &sectnumber html element actual color. came following code: if ($server_data['show_motd'] == 1) { $motd = $server_data['motd']; $motd = str_replace("&sect0","</span><span style=\"color:#000\">", $motd); $motd = str_replace("&sect1","</span><span style=\"color:#00a\">", $motd); $motd = str_replace("&sect2","</span><span style=\"color:#0a0\">", $motd); $motd = str_replace("&sect3","</span><span style=\"color:#0aa\">",

breadcrumbs - Simple Bread Crumb with regex -

i trying create simple bread crumb regex splitting given url: input url in form - http://someurl.com:1000/sites/site1/pages/programs/programs1/programs2/somepage.aspx?a=b;c=d output expected - here: sites>site1>pages>programs>programs1>programs2>somepage and here code have used: <script type="text/javascript"> var url ="http://someurl:1000/sites/site1/pages/programs/programs1/programs2/somepage.aspx?a=b;c=d" var newurl = url.replace(new regexp( "^(?:([^:/?#]+):)?(?://((?:(([^:@]*):?([^:@]*))?@)?([^:/?#]*)(?::(\\d*))?))?((((?:[^?#/]*/)*)([^?#]*))(?:\\?([^#]*))?(?:#(.*))?)", "g"), function( $0, $1, $2, $3, $4, $5, $6, $7, $8, $9){ var domain = $1+ "://" + $2; var href = domain; var urlstrippeddown = $9; //split folders/pages within path /sites/site1/pages/programs/programs1/programs2/somepage.aspx var pieces = urlstrippeddown.replace( new regexp (\\w+.aspx)|(\\w+), //form brea

Rails - Count atribute before save -

i have class aluno has :telefone attribute. want limit same telefone number in 3 times. it's possible have 3 telefone numbers in :telefone column. before create new aluno, have check if have 3 alunos same telefone. it "select count(telefone) alunos telefone = '_form.telefone' if count = 3 message "max 3 telefones reached" how that? thanks all! yes, need create custom validator in model. below. class aluno < activerecord::base ... validate :there_are_three_max_telefone def there_are_three_max_telefone alunos = aluno.find_all_by_telefone(telefone) if alunos.count >= 3 errors[:base] << "max 3 telefones reached" end end end

asp.net mvc - MVC - How to download a csv file using ajax in mvc3 -

i have problem in downloading csv file using $.ajax(); code. i have controller returning file below. public actionresult exportex() { stringbuilder sb = new stringbuilder(); sb.append("<table>"); sb.append("<tr>"); sb.append("<td>1</td>"); sb.append("<td>2</td>"); sb.append("<td>3</td>"); sb.append("<td>4</td>"); sb.append("</tr>"); sb.append("<table>"); httpcontext.response.addheader("content-disposition", "attachment; filename=student_" + datetime.now.year.tostring() + ".xls"); this.response.contenttype = "application/vnd.ms-excel"; byte[] buffer = system.text.encoding.utf8.getbytes(sb.tostring()); return file(buffer, "application/vnd.ms-excel"); } i have index.cshtml fil

php - How to load gif image while ajax content is loading and javascript -

this question has answer here: loading gif image while jquery ajax running 4 answers jquery ajax loading image 4 answers i have been trying load gif image until ajax load data , show it. feeling comforted it. i hope can me out there..this code advance search. now want add loading gif this. $.ajax({ type: 'post', url: base_rul+'site/advancedsearch', data: { keyvalues: keyvalues }, datatype: 'json', success: function(data) { var content = ['']; if(data.status=='1') { //for(var k=1;k<=2;k++){ //for chapter1 starts if( data.item.chapter[1] && data.item.chapter[1].length>=1){ for(i=0;i<data.item.chapter[1].leng

ruby on rails - How to loop through attributes and an array to create a table in a form -

i'm creating survey, , have bunch of columns named :movie_1 through :movie_5 loop through make table in form. best way so? so far have started out below, can't figure out how format loop. survey.rb model attr_accessible :movie_1, :movie_2, :movie_3, :movie_4, :movie_5 movies = ["rocky", "wayne's world", "the godfather", "alien", "toy story"] new.html.erb survey form <%= form_for @survey |f| <table> <tr> <th>movie name</th> <th>rating</th> </r> <% 5.times.each |n| %> <tr> <th><%= f.label survey::movies[n] %></th> # how can loop through movies array? <th><%= f.text_field :movie_n %></th> # how can loop through different columns? </tr> <% end %> </table> <% end %> this should work: <% survey::movies.each_with_index |movie

iphone - all tableCells in different sections got selected of same row (using NSIndexPath) -

i tried create simple checklist style tableview following: - (void)tableview:(uitableview *)tableview didselectrowatindexpath:(nsindexpath *)indexpath { if ([_selectedrows containsobject:indexpath]) { [_selectedrows removeobject:indexpath]; [tableview cellforrowatindexpath:indexpath].accessorytype = uitableviewcellaccessorynone; } else { [_selectedrows addobject:indexpath]; [tableview cellforrowatindexpath:indexpath].accessorytype = uitableviewcellaccessorycheckmark; } [tableview deselectrowatindexpath:indexpath animated:yes]; } however, when select first item , scroll, found out first items in same section has checkmark besides it. doesn't nsindexpath contain both row , section? made items got selected here? :( thanks! - (uitableviewcell *)tableview:(uitableview *)tableview cellforrowatindexpath:(nsindexpath *)indexpath { uitableviewcell *cell = [tableview dequeuereusablecellwithidentifier:cell_identifier]; if (!cell)

android - How to Compare two arrays objects with nested objects? -

i writing test case need compare 2 array objects contains nested objects. here sample code please check. class testgeonames { private status status; public void setstatus(status lstatus) { status = lstatus; } public class status { private string mesg; private string value; public string getmesg() { return mesg; } public void setmesg(string mesg) { this.mesg = mesg; } public string getvalue() { return value; } public void setvalue(string value) { this.value = value; } } } here testcase code: list<testgeonames > result = networkmanager.executebyjson(request, testgeonames .class); list<testgeonames > cacheresult = cachemanager.getresponsefromcache(request); assertnotnull(result); assertnotnull(cacheresult); testgeonamesbean[] tgb = new testgeonamesbean[0]; testgeonamesbean[] cacheresu

c++ function making for a file reading through delimiter but in different style -

i want make parser , read line txt file file like: indore|nj|201568|a| ujjain|ab|3458|b| is inbuilt function read 1 line @ time... catch values in correspoding variable, through format specifier.. separate values | delimiter . parser(str,'|',"%s|%s|%s|%s",location,name,phno,tok); location , name ,...etc variables. i found function in matlab " strread ", type of thing. assuming str is stream, since variables appear strings, can simple use std::getline '|' delimiter. std::getline(str, location, '|'); std::getline(str, name, '|'); std::getline(str, phno, '|'); std::getline(str, tok, '|'); you wrap variadic template function takes parameters want read into. void readparams(std::istream& stream, char delim) { } template<typename ... tail> void readparams(std::istream& stream, char delim, std::string& string, tail& ... t) { std::getline(stream, string, delim); readpa

website - Change <href> to <script> javascript? -

how make href thing script executed when enter webpage? <a href="javascript:void();" onclick="document.getelementbyid('underlay').style.display='block';document.getelementbyid('lightbox').style.display='block';">click here</a> <div id="underlay"> </div> <div id="lightbox"> <a href="javascript:void();" onclick="document.getelementbyid('underlay').style.display='none'; document.getelementbyid('lightbox').style.display='none';">close</a> </div> place <script> tag @ end of body. you can place in head, although has wait until page loads: <script> window.addeventlistener('load', function () { document.getelementbyid('underlay').style.display='block'; document.getelementbyid('lightbox').style.display='block'; }, false); </script>

Matlab - z(x:y) - vectoring is not working -

vectoring not working z = 10:-1:1; x = 1:9; y = 2:10; z(x:y) ans = 10 9 no vectorization index range? if want pairs, you'll have use >> z([x; y]) ans = 10 9 8 7 6 5 4 3 2 9 8 7 6 5 4 3 2 1 resp. >> z([x; y].') ans = 10 9 9 8 8 7 7 6 6 5 5 4 4 3 3 2 2 1

Create Registration form in Mule -

i newbie muleesb . want create registration form using mule stuck. i don't know how display index.jsp on start-up of application. gone through bookstore example couldn't efficient information. i created web.xml under src->main->app->webapps->web-inf->web.xml *<web-app....> <listener> <listener-class>org.mule.config.builders.mulexmlbuildercontextlistener</listener-class> </listener> <welcome-file-list> <welcome-file>index.jsp</welcome-file> </welcome-file-list> </web-app>* any or suggestions. you're missing web application context directory under: src->main->app->webapps->web-inf->web.xml , ie should have like: src->main->app->webapps->my-context->web-inf->web.xml . follow bookstore example , should have no difficulty reaching goal.

horizontal legend at the bottom of graph in jqplot -

i m able horizontal legend of jqplot graph using enhancedlegendrenderer plugin.but need horizontal legend @ bottom of graph .any suggestion? you should show work when posting stack overflow. helps understand problem. i think having problem enhancedledgendrenderer based on description. this code looks achieve 1 row, 3 column legend. legend: { // renderer needed advance legends. renderer: jquery.jqplot.enhancedlegendrenderer, show: true, location: 's', placement: 'outside', // breaks ledgend horizontal. rendereroptions: { numberrows: '1', numbercolumns: '3' }, seriestoggle: true }, also, getting down voted because of punctuation , lack of capitalization.

web applications - JavaFX 2.0 with web based MySQL Database? -

any ideas on how make desktop application (build on top of javafx 2.0) connect web-based mysql database? any ideas, reference, insights appreciated. thanks in advance. i have done before time ago using javafx. first need download mysql/j java connector here follow this blog post how use , set use inside of javafx application.

java - how to select 2nd button using selenium code if 3 buttons are same -

error when select 1 of them i have 3 button , wants select 2nd 1 using selenium testing java code <p> <button class="btn btn-primary pull-right" ng-click="openmediacreator=true">add</button> </p> <p> <button class="btn btn-primary pull-right" ng-click="openmediacreator=true">add</button> </p> <p> <button class="btn btn-primary pull-right" ng-click="openmediacreator=true">add</button> </p> i use code select 2nd button public basketdetailsobject addyoutubevideo(string url){ try { getdriver().findelement(by.linktext("add")).click(); } catch (exception e) { system.out.println("there error on add youtube video"+e); } return getfactory().create(basketdetailsobject.class); } but knw not works please give me wright code that u

c# - When do (not) two strings with same content share the same memory? -

coming question will 2 strings same content stored in same memory location? having java code string s1="java"; will string allocated in same memory location (or multipe): if launch same program multiple times executing in parallel (concurrently)? possible answer: i c# developer (though programmed in java in previous millennium). i asked question because believed same between .net clr , java (jvm) , hoping answer .net apps (but somehow in doubt encountered "application" pool terms). so, seems (sorry not exhaustively searching before asking): does clr/jvm keep 1 single intern pool running .net/java apps? with answer string intern pool shared per instances/programs of same jvm or .net clr. @gennady-vanin-novosibirsk.... string s1="java";string s2="java";string s3="java";string s4="java"; the above objects available in stringconstantpool location objects pointing 1 ("

java - Docx4j - Images in the document -

how can remove image docx4j. say have 10 images, , want replace 8 images own byte array/binary data, , want delete remaining 2. i having trouble in locating images. is somehow possible replace text placeholders in document images? refer post : http://vixmemon.blogspot.com/2013/04/docx4j-replace-text-placeholders-with.html for(object obj : elemetns){ if(obj instanceof tbl){ tbl table = (tbl) obj; list rows = getallelementfromobject(table, tr.class); for(object trobj : rows){ tr tr = (tr) trobj; list cols = getallelementfromobject(tr, tc.class); for(object tcobj : cols){ tc tc = (tc) tcobj; list texts = getallelementfromobject(tc, text.class); for(object textobj : texts){ text text = (text) textobj; if(text.getvalue().equalsignorecase("${my_place_holder}")){ file file = new file("c:\\image.jpeg");

c# - EWS save/export EmailMessage in other format -

i'm working ews managed api 2.0. @ moment can save emailmessages harddrive *.eml files. can't open them correctly show content. how can emailmessage (.eml) saved .html, .doc or .txt file directly? use following code if want save .eml message.load(new propertyset(itemschema.mimecontent)); mimecontent mimcon = message.mimecontent; filestream fstream = new filestream("c:\test.eml", filemode.create); fstream.write(mimcon.content, 0, mimcon.content.length); fstream.close(); for msg file @ following link: http://msdn.microsoft.com/en-us/library/cc463912%28exchg.80%29.aspx after saving .eml file can @ following post parsing it: recommendations on parsing .eml files in c# hope helpful.

php - How to translate URL's in zend framework 1.11 -

i want translate dutch : http://example.com/login => http://example.com/inloggen german http://example.com/login => http://example.com/anmelden take on doc http://framework.zend.com/manual/1.11/en/zend.controller.router.html#zend.controller.router.routes.standard.translated-segments hope helps!

pkcs#12 - Prevent private key exposure using custom openssl engine -

is possible have engine generate keypair, have application 'use' private key (e.g. sign) without exposing key ? e.g. openssl return kind of reference not key itself. there should way store keypair (and associated certificate chains) , retrieve them later. thinking of storing in pkcs12 struct. could give me pointers how in c ? this possible using hardware security module ( http://en.wikipedia.org/wiki/hardware_security_module ) supported openssl. i have used ncipher hsm openssl in past, not supported vendor.

java - Regex to check for string with 2 or more spaces -

i tried write regex validating following string, good <3 spaces> morning the regex tried \s{2,}. regex match failed the string must match entirly "good morning".matches(".*\\s{2}.*");

Internal Error accessing Drive API -

when try access google drive api https://www.googleapis.com/drive/v2/files?q=title+%3d+%27data%27&alt=json&key=myapikey 500 internal error . assuming it's api horrible guess query wrong. know how fix or better how @ actual error?

javascript - How to post all options in a select element with stringify the text and values? -

there select element have options created dynamically. want post these options text-value pairs via ajax etc... is possible make them stringify text-value pairs? or suggestions without stringifying text-value pairs. thanks. use if don't have jquery function getselectoptions(id){ var select = document.getelementbyid('x'); var obj = {}; for(var i=0; i< select.options.length; i++){ var option = select.options[i]; obj[option.value] = option.innerhtml; } return obj; } var opts = getselectoptions('x'); console.log(opts, json.stringify(opts)) demo: fiddle with jquery function getselectoptions(id){ var select = $('#' + id); var obj = {}; $('option', select).each(function(i, v){ var $this = $(this); obj[$this.val()] = $this.text(); }); return obj; } var opts = getselectoptions('x'); console.log(opts, json.stringify(opts)) demo: fiddle

junit - how do I generate a test file form a java file using Parasoft -

i new @ parasoft. using parasoft plugin eclipse. today used first time on java file right click , parasoft -> test using -> user-defined -> my_configuration. how generate new test file java file using parasoft? how modify test file created java file? make changes in java file , should modify test file. think there should option somewhere didn't founded on web. in parasoft/test using/builtin? if go "parasoft -> test using -> builtin -> generate , run unit tests" can generate new test file java file. want add test cases automatically existing test file. in header of test file have: * created jtest on 10/2/12 9:07:30 am. * updated jtest on 10/25/12 2:35:22 pm, 12 test cases added. i need update file in second line above"* updated jtest on 10/25/12 2:35:22 pm, 12 test cases added.". thanks, dorian the automation test class creation configured in test configuraion tab generaiton . more find in help, outstanding , requi

Antlr4 How to Capture Evaluation Order of expressions -

i have following grammar grammar expr; prog: expr; expr: lp expr rp | expr lp expr rp | lp expr rp expr | expr '*' '{' ',' expr | expr op=not expr | expr op=and expr | expr op=or expr | id ; newline:'\r'? '\n' ; not: '~'; and: '&'; or: '|'; lp : '('; rp : ')'; // lexer/terminal rules start upper case letter id : ( 'a'..'z' | 'a'..'z' | '0'..'9' | ' ' | ('+'|'-'|'*'|'/'|'_') | '=' | '~' | '{' | '}' | ',' )+ ; ws : [ \t\n]+ -> skip ; i want extract nodes of expression being evaluated , need in order in evaluated. expression such 1*{a42,a53,a16,a3}&(a26|a41)&(a51=p&a2=f|a7=c) evaluated in following order a26 | a41 a51 & a2=f a51 & a2f | af=c 1*{a42,a53,a16,a3}&(a26|a41) 1*{a42,a53,a1

c# - Sort Key/Pair based on a calculation -

i have keyvaluepair in value contains generic list of 1 of class. so each value calculate 1 column , based on value display in table format. but here problem is: each list of values contains 1 row 0 column value calculation. so want value on top place. right can @ place. so how can sort based on calculation.? here code: @foreach (keyvaluepair<string, list<myclass>> keyvaluepair in aclient.eselectiondictionary) { foreach (myclass edata in keyvaluepair.value) { string weight; ............ //here comes calculations ............ if (weight == 0d) { addclass = "class=hidden"; } else { addclass = "class=main"; } } } so here values in edata , weight 0d except 1 value. create new dictionary based on previous 1 list ordered custom function calculate column index: var reshuffled = aclient.eselectiondictionary.todict

html - HTML5 : How to pass extra data to HTML5 video player -

how pass data html5 video player, "video name" play display "video name" on screen. or "video copy control info" browser restrict user save file. i not find attributes in video tag specify these things. please pass data html space browser's internal. thanks in advance. how pass data html5 video player, "video name" play display "video name" on screen. video elements provide no special features that. create paragraph, heading, div, or other element. put text node in it. add dom (e.g. after video element). add css taste. or "video copy control info" browser restrict user save file. you cannot prevent users saving files browser has download in order play.

android - Calling AsyncTask from the Activity -

for code snippet( have excluded doinbackground(), postexecute() etc. ) how should pass activity parameter while calling async task checkserver activity? public class checkserver extends activity{ @override protected void oncreate(bundle savedinstancestate) { // todo auto-generated method stub super.oncreate(savedinstancestate); httpticket ticket= new httpticket(); //how line done? param should passed? } @suppresswarnings("unused") private class httpticket extends asynctask<string, string, string> { private activity activity; private progressdialog dialog; public httpticket(activity activity) { this.activity = activity; } you can sipmly do httpticket mhttpticket = new httpticket(this); mhttpticket.execute(); you delete constructor, , pass onpreexecute param. give in execute(this);

double ID exception throws when parse date parameter in ksoap in android -

i working soap parsing in android. actually problem when trying pass date parameter throws doubleid exception. my code follows: public soapprimitive getuserlist() { soapprimitive result = null; string isnewtask = null; soapobject request = new soapobject(namespace, method_name); string starttime = "02-06-2013"; simpledateformat dateformat = new simpledateformat("mm-dd-yyyy"); try { date1 = dateformat.parse(starttime); system.out.println(date1); } catch (parseexception e1) { // todo auto-generated catch block log.i("parseexception",e1.getmessage()); } request.addproperty("fromdate", date1); request.addproperty("todate", date1); soapserializationenvelope envelope = new soapserializationenvelope(soapenvelope.ver11); envelope.dotnet = true; envelope.setoutputsoapobject(request); new marshaldate().register(envelope);

javascript - Convert area,city,state,country to latitude and longitude in googlep maps api v3? -

i need latitude , longitude string consists of areaname,cityname,statename , countryname using google maps api v3... how posssible ? this called geocoding . here's example request. need separate 4 sections of location commas: http://maps.googleapis.com/maps/api/geocode/json?address=kemp+town,+brighton,%20east%20sussex,+uk&sensor=true

javascript - class vs addClassName jscript -

what difference, in using class vs addclassname jscript? in loop, whenever adding class existing class, after each loop cycle adding new class it. condition enter loop changing after each time. when used class instead of addclassname started work should be. after each reverse session loop matching condition. how can explained? working version: (var = 0; < fields.length; i++) //instead of .each { alert(0.5); alert(fields[i].classname); if (fields[i].classname == 'text' || fields[i].classname == 'date' || fields[i].classname == 'number' || fields[i].classname == 'text error' || fields[i].classname == 'date error' || fields[i].classname == 'number error' || fields[i].classname == 'text valid' || fields[i].classname == 'date valid' || fields[i].classname == 'number valid' || fields[i].classname == 'text valid error' || fields[i].classname == 'date v

ios - How to increase the size and height of view by dragging the view from the corners in UITapGestureRecognizer in iphone? -

i doing project in have show 1 image, when click on image 1 "white view "will come on upper side of image. , when double click on "two pins" come out on "white view". when pull these 2 pins width , height of white view increase , decrease. i not able this. any idea experts highly welcome. second_view.h file #import <uikit/uikit.h> @interface second_view : uiviewcontroller<uigesturerecognizerdelegate>{ uitapgesturerecognizer *tap; uiswipegesturerecognizer *swipe; uipangesturerecognizer *pan; cgpoint startlocation; cgfloat lastscale; cgfloat firstx; cgfloat firsty; cgpoint lastlocation; uiimageview *imagevw; } @property (nonatomic) cgpoint center; @property (nonatomic) nsinteger count; @property(nonatomic,retain) uiimageview *imagevw; @end second_view.m file - (void)viewdidload { [super viewdidload]; // additional setup after loading view. self.view.backgroundcolor = [uicolor graycolor]; imagevw = [[uiimageview alloc]i