Posts

Showing posts from June, 2012

javascript - How to get all text from all textboxes with class txt_Answer -

<table id="tb_answers"> <tbody> <td> <input class="txt_answer" placeholder="enter answer"> </td> <td> <td colspan="4"> </tr> </tbody> <tr> <td> <input class="txt_answer" placeholder="enter answer"> </td> <td> <td> </tr> <tr> <td> <input class="txt_answer" placeholder="enter answer"> </td> </tr> </table> i got 3 inputs answers.how text/answer class txt_answer tried this $('*[class="txt_answer"]').val() but returns me first value not of thaem by iterating , creating array $.map : var values = $.map($('input.txt_answer'), function(el) {return el.value;}); fiddle you should validate html, it's not valid

How to solve Illegal inheritance from final class in Scala -

i have code in scala when define a value, call methods in object setstr , useful , amazing. when define aclass final, compiler throws exception illegal inheritance final class. in cases should use final classes , type of method calling after class initiation useful me, , question how solve problem test("test function call") { val a: aclass = new aclass { setstr("pooya") func1(this) } } class aclass { // when declare class final, compiler raise error private var str:string="" def setstr(str:string)={ this.str=str } def amethod() = print(str) } def func1(a: aclass) { a.amethod() } when new aclass { ... } creating anonymous class extends class. when class final cannot extended. one way want that: val a: aclass = new aclass import a._ setstr("pooya") func1(this) following @vladimir's suggestion, cleaner way: val a: aclass = { val = new aclass import a._ sets

ruby on rails - Updating password with BCrypt -

when login username , password bcrypt checks no problem, fine. but when go through process of recovering password , try login new password bcrypt never returns true. the code have follows: before_save :encrypt_password before_update :encrypt_password def authenticate player = player.find_by(mail: self.mail) unless player.nil? current_password = bcrypt::password.new(player.password) if current_password == self.password player else nil end end end private def encrypt_password unless self.password.nil? self.password = bcrypt::password.create(self.password) end i'm using rails 4 you don't need before_update callback. when creating new record (user in case), before_save triggered. right behavior. but when updating record, both before_update , before_save triggered, means password column encrypted twice. that's why unexpected behavior. check this page more information callbacks. what's more, think it&#

html5 - Is it okay not to close HTML tags like <img> with />? -

i learned close html tags img , meta etc. this: <img src="..." /> <meta charset="..." /> <hr /> <br /> <input type="..." /> but i've seen numerous sites don't put /> @ end. put > @ end. results in: <img src="..."> <meta charset="..."> <hr> <br> <input type="..."> but me doesn't seem right... how can browser know if tag still needs closed somewhere when that? that's how learned years ago. but twitter bootstrap closing input tags without /> @ end. is valid html? , preferred way of doing it? <foo /> xml syntax. meaningful in xml (including xhtml). however, let deal html. how can browser know if tag still needs closed somewhere when that? some elements have required end tags. these must have explicit </foo> some elements cannot have child nodes , must not have explicit </foo> . example

android - Specifying resource qualifier -

my app being developed region users have english default language. however, app allows user choose local language. since user not setting device's overall language, default string resources called. possible resource specific qualifier e.g. values-myqualifier/strings.xml? if want set diffrent locale application can use following code: locale locale = new locale(countycode); locale.setdefault(locale); configuration config = new configuration(); config.locale = locale; getbasecontext().getresources().updateconfiguration(config, getbasecontext().getresources().getdisplaymetrics()); oncreate(null); check resourcebundle

Perl- print hash values while the key is matched -

i trying print hash values using html tags inside perl code. instead of values 1 . happens when try print hash values inside sub . right way ? package shembull; %rhash= ( lbl_name => "l", lbl_surname => "g", txt_nameemri => "n", txt_surname => "m", btn_submit => "submit", ); sub lbl_input { $value = @_; return "<label>".$value."</label>"; } sub txt_input { $value = @_; return "<textarea>".$value."</textarea>"; } sub btn_input { $value = @_; return"<button>".$value."</button>"; } foreach $tmp (keys %rhash){ if($tmp =~/lbl/){ print lbl_input ($rhash{$tmp}); } elsif($tmp =~/txt/){ print txt_input ($rhash{$tmp}); } elsif($tmp =~/btn/){ print btn_input ($rhash{$tmp}); } } what may e reason? thank ! my $value = @_; this put number o

java ee - selectOneMenu Converter -

this question has answer here: validation error: value not valid 2 answers hi every body i'm working on primfaces pages , have make selectonemenu wich items database tried make way still have problem's converter source codes folowing : selectonemenu : <p:selectonemenu id="devises" required="true" value="#{pret.devise}" effect="fade" converter="devise"> <f:selectitem itemlabel="select one" itemvalue="" /> <f:selectitems value="#{devise.listdevise()}" var="devise" itemlabel="#{devise.nomdevise}" itemvalue="#{devise}"/> </p:selectonemenu> converter code: @facesconverter(value = "devise") public class deviseconverter implements converter{ public static list<devise> devises = devise.

mongodb - Mongo query where parameter starts with field value -

i have preference objects like: {_id: ..., group: 'mycode', path: '/some/path/' value: 123} and want lookup preferences match specific url, e.g. /some/path/123 i can't $regex since parameter longer field value, looking @ doing $where query like: db.coll.find({group: 'mycode', $where: "'/some/path/123'.indexof(this.path) >= 0"}); it feels there should better way of doing this, since it's basic feature of sql. missing better way?

database design - Rails complex association: has_and_belongs_to_many from two classes to one -

in application, have user model , artist model. both users , artists should able "follow" multiple artists. i'm not sure how describe relationship, , i'm lost regarding underlying migration. i've tried having has_and_belongs_to_many :artists in both classes, , additional has_and_belongs_to_many :users in artist , seems messy, , don't know how write migration. i've looked @ association docs migration; i'm not sure if simpler have third-class , use :through association, or if need 1 user-to-artist , artist-to-artist, or if 1 additional class enough. help appreciated, in advance!

php - Trying to get the Parent ID of the Parent ID -

i working on e-commerce site scratch using php , mysql . have 1 table categories, column id , column parent_id . when displaying products on categories.php , have set display products parent_id or id equals $_get['id'] field. i've run problem. in "groceries" category, have "cleaning & home" subcategory, , under "cleaning & home" have several categories "laundry", "bathroom supplies", etc. my problem products in third level don't display in "groceries" category, because technically parent id of "laundry" "cleaning & home". there never more 3 levels (parent, child, grandchild), categories in grandchild level display in parent level. i've tried looking through mysql documentation , on other forums far no luck. this requires couple of joins top parent: select c.*, coalesce(cp2.id, cp.id, p.id) mostparentid categories c left outer join cate

java - println error when printing bytes -

i have wrote simple program below output hello in arabic language :"سلام" it's output on console not correct: import static java.lang.integer.tobinarystring; import java.util.arrays; public class testofprintln { public static void main(string []strings){ string test="salam"; string test2="سلام";//unicode , arabic byte []strbytes=test.getbytes(); int i=1; for(byte bb:strbytes) system.out.println(i++ + " -> " + bb); byte []strbytes2=test2.getbytes(); i=1; for(byte bb2:strbytes2){ system.out.println(i++ + " -> " + bb2); } } } and output: 1 -> 115 2 -> 97 3 -> 108 4 -> 97 5 -> 109 1 -> -40 2 -> -77 3 -> -39 4 -> -124 5 -> -40 6 -> -89 7 -> -39 8 -> -123 why there "-" character before bytes? example: -123 tnx.

mysql - Trouble loading data for TableView from server -

im using web-service api load information db (mysql). when transitioning uitableviewcontroller, retrieve array contains categories in viedidload method. however, not able display array of categories got table view cells. when init category nsmutubalearray , hardcode on otherhand, tableview display information. trying understand i'm doing wrong in steps of loading array , populating onto tableview. here code: - (void)viewdidload { [super viewdidload]; //when init _categorylist way below, displays info. //_categorylist = [[nsmutablearray alloc] initwithobjects:@"trending",@"sports",@"portraits", @"art",@"iduser", nil]; _tocategory = [[nsstring alloc]init]; //when try populate server doesnt work. _categorylist = [[nsmutablearray alloc]init]; //just call "getcategories" command web api [[api sharedinstance] commandwithparams:[nsmutabledictionary dictionarywithobjectsandkeys:

jar - Getting started with JavaCC -

i new javacc , cannot figure out how running. using mac os x , installed javacc-6.0.zip , unzipped it. unable make javacc script accessible path on typing javacc on terminal following message: -bash: javacc: command not found how make javacc script accessible path? my unzipped folder javacc-6.0 in following directory: /users/rishabh/desktop/javacc so following on terminal: path=$path\:/users/rishabh/desktop/javacc/javacc-6.0/ typing javacc next gives me same message. the version of javacc 6.0 downloaded today (2013.07.22) did not have complete bin directory. missing script files! remedied soon. for os x , other unix/linux variants, missing script file called javacc, should executable, , should contain following: #!/bin/sh jar="`dirname $0`/lib/javacc.jar" case "`uname`" in cygwin*) jar="`cygpath --windows -- "$jar"`" ;; esac java -classpath "$jar" javacc "$@" add bin directory

How to Update a record if it exists otherwise insert a new record in MySQL -

i trying write mysql query update record if exists otherwise create new record 2 different tables. found information online can't seems nail it. this current query set @time_now := now(); if exists(select 1 phone_calls account_id = 8 , call_code_id = 5 , status = 1) begin update phone_calls set trigger_on=@time_now, isappointment=1, modified_by = 2, modified_on = @time_now account_id =8 , call_code_id = 5 , status = 1; end else begin insert phone_calls (mid_id, account_id, call_code_id, trigger_on, created_on, call_subject, status, next_call_id , call_direction, owner_id, workflow_generated, call_notes, total_attempts, isappointment) values (1, 8, 5, @time_now, @time_now, 'this test', 1, 0 , "outbound", 2, 1, "", 0, 0); insert inventory_engine_history(phone_call_id, new_phone_call_id, created_

java - Spring MVC & Freemarker session attribute not exposed -

i've got problem freemarker's viewresolver spring - session attributes not exposed view, in spring's internalresourceviewresolver. now, important part is: when change spring's resolver freemarker's one, session attribute not passed, it's null. when spring's resolver working, session passed. my code: dispatcher-servlet.xml: <?xml version="1.0" encoding="utf-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xmlns:p="http://www.springframework.org/schema/p" xmlns:context="http://www.springframework.org/schema/context" xmlns:mvc="http://www.springframework.org/schema/mvc" xsi:schemalocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.1.xsd http://www.springframework.org/schema/context http://www.springf

Palindrome program in python using file i/o -

i new python , working on few programs hang of it. making palindrome program takes input file , prints out words palindromes. here code have far def ispalindrome(word): if len(word) < 1: return true else: if word[0] == word[-1]: return ispalindrome(word[1:-1]) else: return false def fileinput(filename): file = open(filename,'r') filecontent = file.readlines() if(ispalindrome(filecontent)): print(filecontent) else: print("no palindromes found") file.close() this file moom mam madam dog cat bat i output of no palindromes found. the contents of file read in list, filecontent end as: filecontent = file.readlines() filecontent => ["moon\n", "mam\n", "madam\n", "dog\n", "cat\n", "bat\n"] you fix by: def fileinput(filename): palindromes = false line in open(filename): if ispa

css3 - CSS lower-right position dependant on the page height -

see http://jsfiddle.net/2a3xz/ issue i'm facing. image should on lowest right corner after scrolling, not in lowest right corner of viewport first drawn. using .someclass { position: relative; } .image { position: absolute; bottom: 0px; right: 0px; } and containing divs inside each other not work reason (the entire image disappears). missing here? used position: fixed; instead of position: absolute; . here fiddle showing this: http://jsfiddle.net/vbv3p/ edit: after op's comment: you should able apply position: relative; body. please see following: html: <body> <div class="corner"> <img src="http://wtactics.org/wiki/images/2/2b/box.png" /> </div>this <br>is <br>the <br>site <br>content <br>which <br>will <br>cause <br>the <br>page <br>to <br>scroll <br>vertically <br>because <br>of <br>its <

sql - Greatest date from list of date -

i have simple data base: 7/2/2013 7/13/2013 i write simple sql statement select greatest date list of date. try use (max function) follow: select max([p_date]) [baldb].[dbo].[tab_product] the result incorrect; gives me smallest date not greatest follow: 7/2/2013 so please me know problem in sql statement , how can solve problem: greatest date list of date or compare local date , take greater!! the sql max function returns largest value of selected column, in case since data type nvarchar largest value alphabetically larger, in case 7/2/2013 (since "2" greater "1" in "13"). what need @david mentioned, either chance data type of column or if isn't feasible can cast in query datetime for example select max(cast([p_date] datetime)) [baldb].[dbo].[tab_product]

php - Corresponding file start downloading automatically after form submission -

can recommend best solution this? i add reveal popup on wordpress site. in website there download page contain 6 pdf file. integrate popup it, when click on download button of pdf file popup appears automatically. popup contain subscription form name, email address, address field. popup, form works properly. need- corresponding file(depends on link clicked) start downloading automatically after form submission. html code <div style="width:100%;"> <div style="width:30%; float:left;"> <h6>top tips make vs. buy decisions</h6> <p>make vs. buy (mvb) integral part of purchasing function. have give information , make decisions on best strategic fit of our manufacturing operations whether in-house or in supply chain. here pointers right.</p> <a href="pdffile1.pdf" class="big-link" data-reveal-id="mymodal"><img src="http://inxpresssheffield.co.uk/wp-content/

ember.js - Right way to architect two paths for adding users -

right have following app - http://jsbin.com/okoxim/7/edit it allows person browse users name or class. if browsing users, , click new user, new form no default values, , upon save directed user details. when browsing class want give option add new user , new form should default current class on when new user option selected , upon save, should route class saved. what right way setup routes facilitate scenario , how should reuse existing new controller this? you can use custom event manage inside route. view/controller bubble event route, takes care of adding student given data. app.applicationroute = em.route.extend({ events: { createstudent: function(student, gradeid) { var grade = app.grade.find(gradeid); var newstudent = app.student.create({ name: student.name, address: student.address, grade: grade }); newstudent.save(); // other application related stuff } } }); and controller use send dis

keyboard - How can I use a toggle switch as a momentary switch on my arduino? -

i have specific switch need use , happens toggle. problem is, need send keyboard stroke computer time button pushed on or off. tried 1 modification of basic example on arduino website, isn't working me: const int buttonpin = 2; // number of pushbutton pin int prior = 0; int buttonstate = 0; // variable reading pushbutton status void setup() { pinmode(ledpin, output); pinmode(buttonpin, input); keyboard.begin(); } void loop() { prior = buttonstate; buttonstate = digitalread(buttonpin); if (buttonstate != prior) { keyboard.write(32); } } you can debug issue breaking 2 part. first debug whether able toggle of switch can switch led on/off whenever toggle switch (assuming leds working fine) in loop. once done. debug keyboard.write() send characters pc @ fixed delay may 1sec in loop. if both working fine above program might work. try adding delay after keyboard.write().

php - Get FB Full Name by ID -

is possible somebody's facebook name id? it's possible file_get_contents it's disabled on server i'm afraid. believe there's curl work around i've not used curl before i'm not quite sure use. $pagecontent = file_get_contents('http://graph.facebook.com/1157451330'); $parsedjson = json_decode($pagecontent); echo $parsedjson->name; any appreciated. you can use curl, so: $url = 'http://graph.facebook.com/4?fields=name'; $ch = curl_init(); curl_setopt($ch, curlopt_returntransfer, 1); curl_setopt($ch,curlopt_url,$url); $result = curl_exec($ch); curl_close($ch); $result = json_decode($result); echo $result->name; output: mark zuckerberg

list - Append a dictionary in Python -

how can append dictionary following in python? list1 = {'value1':1} list2 = {'value2':2} list1.append(list2) when appending: 'dict' object has no attribute 'append' how can join both list then? these dictionaries, not lists. try list1.update(list2) the semantics of update , append different, because underlying data structures different. values existing keys in dictionary overwritten values in argument dictionary. the section of python tutorial on data structures goes through , whole lot more.

json - Correct way to pass string array member to MVC WebApi controller -

i'm starting angularjs , trying pass json object strings array member mvc webapi method, cannot let webapi controller receive correct value it. i'm missing obvious, suggest solution? in js, call like: $http({ url: "/api/test", method: "get", params: { //... fields: ["one", "two"] }}); on server side, here corresponding model: public sealed class mymodel { //... public list<string> fields { get; set; } } and controller's signature: public dynamic get([fromuri] mymodel model) when inspect model, find fields array 1 item, right "raw" json string, e.g. contains ["one","two"] (square brackets , quotes included), rather array 2 items 1 , two. possible fix this? thanx! try creating client side javascript model object 1 field 'fields' of type array , set fields. var myobj = {} myobj.fields = []; myobj.fields.push("one") myob

ember.js - Emberjs controller needs with Binding -

i have nested resources: this.resource('foo', {path: '/foo/:foo_id'}, function() { this.route('makesomethingwithfoo'); this.resource('bar', {path: 'bar/:bar_id'}, function() { this.route('makesomethingwithbar'); i want use properties model foo in, while i'm in #/foo/321421/bar/231421 . barindexcontroller looks this: ... = ember.objectcontroller.extend({ needs:'fooindex', //mybinding: 'controllers.fooindex', ....}); in template if use controllers.fooindex.desiredproperty can access property of model foo . wanted use mybinding in order spare writing few characters more ( controllers.fooindex ). think did right, @ least seems right according documentation . error: uncaught error: assertion failed: cannot delegate set('my', <(subclass of ember.objectcontroller):ember238>) 'content' property of object proxy <(subclass

sql - python: query a DATETIME field in a sqlite db for a date range -

have sqlite db i've created in python has datetime field: import sqlite3 con = sqlite3.connect('some.db',detect_types=sqlite3.parse_decltypes) con: cur = con.cursor() cur.execute("create table table(...date datetime...)") ... date = datetime.datetime(<a format resolves correct datetime object>) ... altogether = (..., date, ...) cur.execute("insert table values(...?...)", altogether) con.commit() this populates correctly. later want able query db datetime, , have function manage queries generally: def query_db(path, query, args=(), one=false): connection = sqlite3.connect(path) cur = connection.execute(query, args) rv = [dict((cur.description[idx][0], value) idx, value in enumerate(row)) row in cur.fetchall()] return (rv[0] if rv else none) if 1 else rv local_folder = os.getcwd() samplequery = "select * table" dbfile = os.path.join(local_folder, "some.db"

ios - object instantiated by UINib not showing its proper class? -

i have xib file, view, , have designated fooview class. when allocate it: uinib *fooviewxib = [uinib nibwithnibname:@"fooview" bundle:[nsbundle mainbundle]]; fooview *fooview = [[fooviewxib instantiatewithowner:self options:nil] lastobject]; fooview.lollabel.text = @"lol"; if ask it: [fooview iskindofclass:[fooview class]]; it says no... yet, if nslog fooview object, says it's fooview. , if nslog class of fooview object directly, shows fooview class. why iskindofclass not correctly identify object, , how can so? instead of using lastobject , loop through array until find view correct class. this nsarray *nibviews = [[nsbundle mainbundle] loadnibnamed:@"fooview" owner:self options:nil]; fooview *view; (id object in nibviews) if ([object iskindofclass:[fooview class]) view = object; // whatever want view this ensure view correct class.

Python Random Map Generation with Perlin Noise -

recently, i've been attempting defeat 1 of main weaknesses in programming in general, random generation. thought easy thing do, lack of simple information killing me on it. don't want sound dumb, feels me of information places this written mathematicians went college graduate in theoretical mathematics. don't understand i'm meant information in order apply programming in language such python. i've been working few days staring @ equations , attempting attempt after attempt, still after days, after ripping code apart again , again, that's been working entire time noise generator generate basic noise: import random import math random.seed(0) def generatewhitenoise(width,height): noise = [[r r in range(width)] in range(height)] in range(0,height): j in range(0,width): noise[i][j] = random.randint(0,1) return noise noise = generatewhitenoise(50,12) in noise: print() o in i: if(o == 0): pri

html - Can a multi column list have individually elastic columns? -

this list of speakers jquery portland uses 3 column layout (at desktop browser widths) in individual elements can grow displace items beneath them, without affecting other columns. downside requires 3 column containers in markup. is possible same effect simple list, , no column containers css? i've never used flexbox before, can't seem make items wrap without coupling rows between columns codepen example . is possible same effect simple list, , no column containers css? answer this: can use column-count demo

java - Spring security: Session is invalidated when user isn't authenticated -

whenever run web application , go default page, role_anonymous user inside authorities expected. however, when go idle, session times out causes invalid-session-url triggered. there anyway exclude unauthenticated users session timeout? edit: easiest way found setting invalidsessionstrategy . problem is, don't know how to. don't need create own implementation of sessionmanagementfilter . want control of how application handle invalid-session-url . can me out? having session practice un-authenticated users. implement invalid-session-url in way checks authentication before redirecting. if user not authenticated, redirect session-idle-timeout page.

php - Laravel: Unable to echo $message variable after Reirection with $message -

i redirecting using following code return redirect::to("update/a/product") ->with("message", "product updated"); but when try echo $message variable inside view, error of undefined variable. how defining/echoing $message ? since returning redirect flash data , access using session::get() , can check there first session::has() <?php if (session::has('message')) { $message = session::get('message'); echo $message; } ?>

(SQL) Match users belong to which group given user_id[] -

user table id | name 1 | ada 2 | bob 3 | tom group table id | name 1 | group 2 | group b 3 | group c user_group table user_id | group_id 1 | 1 2 | 1 1 | 2 2 | 2 3 | 2 1 | 3 3 | 3 given group of user ids : [1, 2, 3] how query group users in above list belongs to? (in case: group b) to groups contain specified users (i.e. specified users , no other users) declare @numusers int = 3 select ug.group_id --the max doesn't here because --groups same group id have same name. --max used can select group name eventhough --we aren't aggregating across group names , max(g.name) name user_group ug --filter groups 3 users join (select group_id user_group group group_id having count(*) = @numusers) ug2 on ug.group_id = ug2.group_id join [group] g on ug.group_id = g.id user_id in (1, 2, 3) group ug.group_id --the distinct necessary if user_group --isn't keyed group

actionscript 3 - How to change null values? -

the code works returns following error - typeerror: error # 1009: can not access property or method of null object reference.at lost_fla ::maintimeline / check () [lost_fla.maintimeline :: frame1: 44] trace (smb_btn) = null trace (check) = function () {} trace (txt_inpt) = null what can done change null values​​? import fl.controls.button import fl.controls.textinput import flash.utils.timer import flash.events.mouseevent smb_btn.addeventlistener (mouseevent.click, check); function check (e:mouseevent):void{ if (txt_inpt.text == "12345"){ hotel++ gotoandplay (952, "cena 2"); trace(smb_btn) trace(txt_inpt) } if (txt_inpt.text == "131313"){ gotoandplay (735, "cena 3"); } if (txt_inpt.text == "t"){ gotoandplay (693, "cena 3");

java - My ByteBuffer is not placing it's bytes into a bytes array properly -

here code byte data[] = new byte[1024]; fout = new fileoutputstream(filelocation); bytebuffer bb = bytebuffer.allocate(i+i); // size of download readablebytechannel rbc = channels.newchannel(url.openstream()); while( (dat = rbc.read(bb)) != -1 ) { bb.get(data); fout.write(data, 0, 1024); // write data file speed.settext(string.valueof(dat)); } in code try download file given url, file doesn't complete it's way. i don't know error happened, readablebytechannel's fault? or didn't put bytes bytebuffer byte[] properly. when read bytebuffer , offset of buffer changed. means, after read, need rewind bytebuffer : while ((dat = rbc.read(bb)) != -1) { fout.write(bb.array(), 0, bb.position()); bb.rewind(); // prepare byte buffer read } but in case, don't need bytebuffer anyway, using plain byte ar

elisp - GNU+Linux Build Framework in Emacs Lisp? -

i'm working on linux-libre version of "linux scratch" based upon christophe jarry's "gnu/linux-libre source code" build book. however, rather write build framework shell scripts or perl, i'm interested in extending emacs lisp chops. having used emacs lisp within emacs , org-mode extension language, have tips/tricks/or links projects have done similar? reason important me end product minimal gnu+linux-libre system emacs-centered interface, , round out project nicely. tia, , cheers! i'm not entirely sure question here, if want writing executable elisp scripts, might find these useful: emacs shell scripts - how put initial options script? idomatic batch processing of text in emacs? run elisp program without emacs? alternatively, might @ using guile , supports elisp source language.

copy - Lotus Notes 7 - scheduled Agent for copying parent & response docs. without changing UNID -

Image
i asked question ( lotus notes 7 - copy / move docs. ( parent & response docs ) without changing unid ? ) , received answer helped me lot! knut hermann! it works ok, agent working on selecting documents. wondering if it's possible create schedule agent runs 1 time per day? means user shouldn't manually selecting documents , run agent. thank time , sharing info! yes, can. here . can set schedule in agent's properties: you can select documents selected. in example database's documents selected. if select "none" it's select documents in agents's code in e.g. notesdocumentcollection. for case easiest select documents , add if statement test if document not yet in target database: set docsource = col.getfirstdocument() while not docsource nothing if doctarget.getdocumentbyunid(docsource.universalid) nothing set doctarget = dbtarget.createdocument() call docsource.copyallitems(doctarget, true) doctarg

iphone - Update badge icon when app is closed -

i trying update badge icon app(closed) when received pn. i have tried adding codes it's not working when app closed. works when app running in foreground. - (bool)application:(uiapplication *)application didfinishlaunchingwithoptions:(nsdictionary *)launchoptions { nsdictionary *remotenotif = [launchoptions objectforkey: uiapplicationlaunchoptionsremotenotificationkey]; //accept push notification when app not open if (remotenotif) { [application setapplicationiconbadgenumber:100]; return yes; } } -(void) application:(uiapplication *)application didreceiveremotenotification:(nsdictionary *)userinfo { [[uiapplication sharedapplication] setapplicationiconbadgenumber: 30]; } if app closed or in background, push notification won't wake up. need server side , include number want see on icon in notification payload: { "aps" : { "alert" : "your notification message",

I'm getting warn on cassandra log - "Pausing until token count stabilizes" -

someone can please me understand warning mean? "pausing until token count stabilizes (target=256, actual=282)" and how can fix it? thanks ahead ! =) i guess shuffle operates in stages, prevent data loss. add tokens nodes take on tokens. wait nodes have data transferred them. @ stage nodes have tokens. remove tokens nodes no longer responsible them. remove data nodes no longer responsible it. i'm guessing message saying process @ stage 2.

jsf - Euro symbol on Primefaces Ajax update -

Image
i trying write euro currency symbol on page. works perfect when load page, when make partial update through ajax euro symbol not being loaded correctly. tried 3 different approaches: <h:outputtext value="&euro;" /> <h:outputtext value="&#x26;euro;" /> <h:outputtext value="€" /> when loading page, works first approach. results following: € euro; € when making partial update ajax, none of them works correctly: ? &euro; € same result above when implementing filter described in unicode input retrieved via primefaces input components become corrupted i spent entire day trying solve this. appreciate help. thanks, douglas. the answer found applies decoding of http request parameters (the submitted form values). not applicable in case. you've problem encoding of http response (the html/xml output generation). the encoding of http response can controlled in @ least 2 ways: the encoding declare

ruby - How do I parse and scrape the meta tags of a URL with Nokogiri? -

i using nokogiri pull <h1> , <title> tags, having trouble getting these: <meta name="description" content="i design , develop websites , applications."> <meta name="keywords" content="web designer,web developer"> i have code: url = 'https://en.wikipedia.org/wiki/emma_watson' page = nokogiri::html(open(url)) puts page.css('title')[0].text puts page.css('h1')[0].text puts page.css('description') puts meta description puts meta keywords i looked in docs , didn't find anything. use regex this? thanks. here's how i'd go it: require 'nokogiri' doc = nokogiri::html(<<eot) <meta name="description" content="i design , develop websites , applications."> <meta name="keywords" content="web designer,web developer"> eot contents = %w[description keywords].map { |name| doc.at("meta[name='

c# - wpf windows project like Outlook Layout -

i need design wpf windows application c# . there side menu. same entire application. when click on each menu item, corresponding page should display on right side of application, don't want tabbed document what want application navigation, take @ this msdn link navigation , like this understand how using mvvm. the idea have pages bound navigation item selection. read datatemplates , datatype attribute of it.

c# - WPF Toolkit Chart: How to save them as Image -

i looking save chart image merge in pdf report. wpf toolkit chart , can save image them if displayed on form. but, since working on background service, don't have visual element show up, , hence have no clue how save image, image saving code : renderbitmap = new rendertargetbitmap(400, 400, 96, 96, pixelformats.pbgra32); drawingvisual isolatedvisual = new drawingvisual(); drawing.drawrectangle(new visualbrush(mychart), null, new rect(new point(), bounds.size)); renderbitmap.render(isolatedvisual); gives black image only. here mychart chart control , if add mychart window shows chart fine. so, know chart control working, doesn't render when not on window. edit: do mychart.measure(size); mychart.arrange(new rect(size)); mychart.updatelayout(); but still getting blank image , control not rendering on image. i had same problem rendertargetbitmap producing black image. i use method: public static void saveasimage( frameworkelement element, stri

javascript - automatic slideshow of JSPs in a Java Project -

i have java project, collection of jsps. there 1 jsp displays charts & corresponding table dynamically. jsp contains different charts drawn using dojo, javascripts , fetches data db. each set of data displayed on jsp page has it's own set of drop-down cluster boxes , each value of cluster displays different chart. requirement is, want these charts & corresponding tables of single jsp page displayed slideshow.i understand ppt doesn't work because should able change charts in page drop down. there way solve this. please help. you can achieve using dojox/widget/rotator or dojox/widget/autorotator widget. can find more information @ reference guide . each pane should contentpane (or have contentpane child). if want execute javascript on these jsps can use dojox/layout/contentpane . if use declarative markup or don't have javascript code in slide-jsps, can use basic dijit/layout/contentpane . they both have attribute called href can use load externa

ruby - Why my eventmachine client code doesn't work asynchronously? -

def index p "index, #{fiber.current.object_id}" # <- #1 eventmachine.run { http = eventmachine::httprequest.new('http://google.com/').get :query => {'keyname' => 'value'} http.errback { p "uh oh, #{fiber.current.object_id}"; em.stop } # <- #2 http.callback { p "#{http.response_header.status}, #{fiber.current.object_id}" # <- #3 p "#{http.response_header}" p "#{http.response}" eventmachine.stop } } render text: 'test1' end in code, expected getting different fiber id @ #1 , #2 , #3 line. fiber objects' id same. tried thread.current.object_id , same result too. misunderstaning? code executes asynchronously? p.s i'm using ruby 2.0 , code running rails4 http://ruby-doc.org/core-2.0/fiber.html fibers primitives implementing light weight cooperative concurrency in ruby. means of creating code blocks can pause

selector - iOS Use callback -

please excuse english, i'm french. so, i'm newbie in ios development. i've developed method must call callback function after async task. i've made search selectors, can't understand how works... this code : nsstring *const baseurlstring = @"http://mywebsite.fr/"; + (void) getadverts:(sel *)myselector { // 1 nsurl *baseurl = [nsurl urlwithstring:[nsstring stringwithformat:baseurlstring]]; // 2 afhttpclient *client = [[afhttpclient alloc] initwithbaseurl:baseurl]; [client registerhttpoperationclass:[afjsonrequestoperation class]]; [client setdefaultheader:@"accept" value:@"application/json"]; [client getpath:@"jsoncall" parameters:nil success:^(afhttprequestoperation *operation, id responseobject) { nsdictionary *jsondict = (nsdictionary *) responseobject; nsarray *adverts = [jsondict objectforkey:@"advert"]; nsmutablearray *advertlist = [[nsmutablearray all

Magento: Query Database for products with no assigned categories -

i'm new magento , i'm looking find way list of products in catalog not assigned categories. can offer how can achieved? many thanks. you can product collection using following code : $product = mage::getmodel('catalog/product'); $productcollection = $product->getcollection() ->addattributetoselect('*'); foreach ( $productcollection $_product ) { echo $_product->getname().'<br/>'; } but requirement can idea following links,may you. how product category information using collections in magento

cannot understand interface in java -

i looking @ interface chapter provided on java website using interface type understanding whole point of interface is class it's not possible form objects it, page says how use interface data type. line relatable obj1 = (relatable)object1; seems create object of type relatable interface. although must new keyword has not been used here, not creating reference object of type relatable . cause line not creating object of type relatable ? again, further says if make point of implementing relatable in wide variety of classes, objects instantiated of classes can compared findlargest() method—provided both objects of same class. what mean? mean implements relatable can call findlargest() ? if it's so, why provided both objects of same class ? ----- edit ----- previous chapters of tutorial: definition of relatable: public interface relatable { // (object calling islargerthan) // , other must instances of // same class returns 1, 0, -1

java - I am not able to select the dropdown using selenium webdriver please -

i trying select drop down of site , proceed buy show, not able please help. system.setproperty("webdriver.chrome.driver", "c:/selenium/chromedriver.exe"); webdriver driver = new chromedriver(); driver.get("http://www.theatrepeople.com/"); driver.findelement(by.id("edit-show")).click(); new select(driver.findelement(by.id("edit-show"))).selectbyvisibletext("the 39 steps"); driver.findelement(by.id("edit-date-datepicker-popup-0")).click(); driver.findelement(by.linktext("27")).click(); driver.findelement(by.id("edit-ticket-no")).click(); new select(driver.findelement(by.id("edit-ticket-no"))).selectbyvisibletext("1 ticket"); driver.findelement(by.id("edit-submit-1")).click(); use following code. uses java script select text based upon it's valued. nice question. got learn. static webdriver driver; public static void ma

python - How to find the position of specific element in a list? -

i have list this: website = ['http://freshtutorial.com/install-xamp-ubuntu/', 'http://linuxg.net/how-to-install-xampp-on-ubuntu-13-04-12-10-12-04/', 'http://ubuntuforums.org/showthread.php?t=2149654', 'http://andyhat.co.uk/2012/07/installing-xampp-32bit-ubuntu-11-10-12-04/', 'http://askubuntu.com/questions/303068/error-with-tar-command-cannot-install-xampp-1-8-1-on-ubuntu-13-04', 'http://askubuntu.com/questions/73541/how-to-install-xampp'] i want search if following list contain url or not. url in format : url = 'http://freshtutorial.com' the website 1st element of list. thus, want print 1 not 0 . i want in loop if there's no website url, go again , dynamically generate list , again search website. i have done upto now: for in website: if url in website: print "true" i can't seem print position , wrap in loop. also, better use regex or if in that syntax. thanks here

autowired - Spring Security AuthenticationProvider No Bean Defined -

i implementing own authenticator provider spring security 3.1.4. but when running application on tomcat receive log error tomcat. org.springframework.beans.factory.nosuchbeandefinitionexception: no bean named 'myappauthenticationprovider' defined in web.xml y have others things. <context-param> <param-name>contextconfiglocation</param-name> <param-value> /web-inf/applicationcontext.xml, /web-inf/myapp-datasource.xml, /web-inf/myapp-security.xml </param-value> </context-param> <filter> <filter-name>springsecurityfilterchain</filter-name> <filter-class>org.springframework.web.filter.delegatingfilterproxy</filter-class> </filter> <filter-mapping> <filter-name>springsecurityfilterchain</filter-name> <url-pattern>/*</url-pattern> </filter-mapping> in myapp-servlet.xml y have others things. <!-- activa l

Upload video to facebook using graph api -

i using following code uploading videos users wall: if( isset($_post['submitvideo']) ) { $img = $_files['source']['name']; $ret_obj = $facebook->api('/me/videos', 'post', array( 'source' => '@' . $img, 'title' => "this test", 'description' => 'test9000', 'privacy' => json_encode(array( 'value' => 'everyone' )), ) ); echo '<pre>video id: ' . $ret_obj['id'] . '</pre>'; } the form looks this: <form target="uploadtarget" enctype="multipart/form-data" method="post"> <input name="source" type="file"> <input type="submit" value="upload" name="submitvideo" /> </form> my problem source of images. correct use this: $img = $_files['source']['name&#

NullPointerException on listview.getCount() method -

application crashes throwing null pointer exception on line roomlist.getadapter().getcount() . need fetch each edit text value listview , apply computations on it, after searching various posts, have found out solution not working properly. roomlist = (listview) vi.findviewbyid(r.id.list2); (int = 0; < roomlist.getadapter().getcount(); i++) { view view = roomlist.getchildat(i); edittext edit = (edittext) view.findviewbyid(r.id.editroom); log.d("value each edit text", edit.gettext().tostring()); } you have npe because roomlist.getadapter() returns null . maybe didn't call roomlist.setadapter(listadapter adapter) . by way, should change name roomlist roomlist , stick java convention . roomlist.getadapter() @ first glance looks static method call of roomlist class.

Accessing arrays(hashmap) in javascript -

im populating hashmap this var temp = ${task.get(i).id}; wf.map[temp]=${task.get(i).isconnected()}; while accessing map, im accessing in way var temp = taskid.value; var connected= this.map[temp]; here, im getting connected undefined. in case, temp = "00000114000000000002" . accessing this.map["00000114000000000002"} gives me same problem. instead if access this.map[00000114000000000002] , works absolutely fine. i tried typecast temp number, int , no luck. how deal issue?

iphone - Sorting NSDocumentDirectory by name -

i want sort nsdocumentdirectory filename folders should first name , files sorted name. in document directory, have lots of files , folders also. i have array like, _filepathsarray =[[nsfilemanager defaultmanager] contentsofdirectoryatpath:_selectedpath error:nil]; thanks in advance you can sort array alphabetically following way. not sure folders comes first. [myarray sortusingselector:@selector(caseinsensitivecompare:)]; or sortedarray = [anarray sortedarrayusingselector:@selector(localizedcaseinsensitivecompare:)];

visual studio - ASP.Net Configuration Tool Windows 8 issues -

ever since updated windows 8 have noticed while using .net configuration tool's security tab, when try add or manage users recieve "cannot connect database" error. other parts work fine apart fact slow. i carried same project windows 7 pc , encountered no errors. checked firewall settings , saw no difference. what reason? both windows 8 , visual studio 2012 up-to-date. firewall issue , have allow specific port?

R: Ordering and transforming irregular time strings -

i have similar problem following question on transforming irregular time strings. have time series of character class order. r: transform irregular time strings rather commas, milliseconds in separated ʻ.ʻ. however, when try apply gsub step, data replaced semi-colons. head(time, n=5) [1] "05:48:59.306" "05:48:56.246" "05:48:53.214" "05:48:52.662" "05:48:50.203" time.new <- gsub(".", ":", time) head(time.new, n=10) [1] "::::::::::::" "::::::::::::" "::::::::::::" "::::::::::::" "::::::::::::" if through step, in theory calculate decimal minutes column , order based on decimal minutes. missing gsub part? :p any appreciated. you should use 2 \ before . in gsub() . gsub("\\.", ":", time)