Posts

Showing posts from April, 2015

javascript - fb.ui error "An error occurred. Please try again later." -

hey guys have script i'm using share post website, on facebook. i'm using fb.ui sdk, , keep getting error: "an error occurred. please try again later.". it set pop when page loads. i noticed app_id has no id in secure url facebook generates pop up. because hidden, or not being sent? here clipping of url: " https://www.facebook.com/dialog/feed?app_id=&caption=info& " here code: index.php: <html> <head> <title>post facebook</title> <script src="http://connect.facebook.net/en_us/all.js"></script> </head> <body> <div id="fb-root"></div> <script> window.fbasyncinit = function() { fb.init({ appid : '1404387053111932', channelurl : 'http://website.com/fb/channel.html', status : true, xfbml : true }); }; (function(d, s, id){ var js, fjs = d.ge...

jsf - Using new xmlns.jcp.org namespace on composites causes java.lang.NullPointerException at java.util.concurrent.ConcurrentHashMap.putIfAbsent -

i reading java ee 7 tutorial http://docs.oracle.com/javaee/7/tutorial/doc/jsf-facelets005.htm#giqzr after typed example code in chapter 8.5 composite components in ide , run example on glassfish4.0, got error java.lang.nullpointerexception @ java.util.concurrent.concurrenthashmap.putifabsent(concurrenthashmap.java:1078) @ com.sun.faces.util.cache.get(cache.java:116) @ com.sun.faces.application.view.faceletviewhandlingstrategy.getcomponentmetadata(faceletviewhandlingstrategy.java:237) @ com.sun.faces.application.applicationimpl.createcomponent(applicationimpl.java:951) @ javax.faces.application.applicationwrapper.createcomponent(applicationwrapper.java:648) then check older version of tutorial, found difference. in java ee 7 version email.xhtml code following: <!doctype html public "-//w3c//dtd xhtml 1.0 transitional//en" "http://www.w3.org/tr/xhtml1/dtd/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xh...

zend framework2 - Improve ZF2 performance -

how can improve performance of zf2 application in general? i using templatemap, classmap , module config caching. still feel application quite slow. check performance zend-developer-toolbar. database take @ twentieth of run time. example, page loads within 420 ms , database queries take 20 ms of time on development machine. afraid kill server when going live. what can improve performance zend framework 2 application. well, you're taking pretty account can. there's couple of little tricks , little things use. example: edpsuperluminal , that's not center of problem. now, don't know on os testing, can tell experiences. point on, zf2 + windows + xampp = effing slow. don't know if that's case, due higher amount of classes needed (read: files parsed on hdd) takes longer. sql on local machine slower production one, too. whenever switch local decelopment/staging, run ~500-750ms down 100-150ms. , numbers without sort of caching enabled. turning on so...

html5 - 12 or 16 column grid for a full width website like pinterest/vevo.com -

so i'm looking right answer grid system: 1) should use 12 or 16 column grid full width website like: http://xfinitytv.comcast.net http://pinterest.com http://www.vevo.com 2) can use bootstrap3 16 width 3) challenges 16 columns grid vs traditional 12 column grid? thanks. paulmars,its upto , design.you can use both 12 column , 16 column grids. yes can use bootstrap give css layout components needed javascript.bootstrap nice choice.

JQuery Validation Engine with knockout and bootstrap -

i using bootstrap , knockout in project . before using knockout validation , have use jquery validation engine knockout view models , bootstrap html . suppose html <fieldset> <div class="form-group"> <label for="name">name</label> <input type="text" class="form-control placeholder" id="personname" placeholder="your name" data-bind="value: name" /> </div> <div class="form-group"> <label for="email">email address</label> <input type="email" class="form-control placeholder" id="personemail" placeholder="your email" data-original-title="your activation email sent address." data-bind="value: email, event: { change: checkduplicateemail }" /> </div> <div class="form-group"> <label for="passwo...

linux - Play videos automatically in Raspberry Pi Qt -

i want play videos on raspberry pi built qt well. thing have try out example on github link seems not working me. want play videos using omx player automatically once have uploaded xml config file clue if want use omxplayer, should checkout here: https://github.com/popcornmix/omxplayer . see code can controlled using pipe. edit: omxplayer has dbus interface.

url - Page with .htm redirect to 500 internal server error in Joomla -

whenever tried access of webpage through .htm extension, leads 500 server error, although webpages accessible without ant extension or .html extension, important me because of pages linked other websites .htm extension , whenever use click on links, page redirect 500 internal server error, cannot remove links, , cannot redirect them .html extension my website http://www.gautampolymers.com my .htaccess file # rewritebase / ## begin - joomla! core sef section. #rewriterule .* - [e=http_authorization:%{http:authorization}] # # if requested path , file not /index.php , request # has not been internally rewritten index.php script rewritecond %{request_uri} !^/index\.php # , request within component folder, # or site root, or extensionless url, or #requested url ends 1 of listed extensions rewritecond %{request_uri} /component/|(/[^.]*|\.(php|html?|htm?|feed|pdf|vcf|raw))$ [nc] , requested path , file doesn't directly match physical file rewritecond %{request_filename} !-f # ,...

Checkboxes instead of drop down list in PHP, MySQL -

i have working code below, i'd change drop down list checkboxes, multiple options can selected , passed further action instead of 1 drop down list allows. i'm fairy new php , have done tons of searching on without success. appreciated. $l = $_post['lt']; $pals = ''; $r = mysql_query("select distinct pal_num pl_tab lt_num='$l'"); while($row = mysql_fetch_assoc($r)) { $pals .= '<option>'.$row['pal_num'].'</option>'; } if($pal == '') echo ''; else echo '<form name="get_pal" action="post.php" method="post">'; echo '<select name="pal_numb"><option>select pal</option>'.$pals.'</select>'; echo '<input type="submit" name="post" value="go!">'; echo '</form>'; with checkb...

c# - What is the meaning of RollingFileAppender in log4net -

i read documentation of don't understand it.it says: rollingfileappender can roll log files based on size or date or both depending on setting of rollingstyle property. when set size log file rolled once size exceeds maximumfilesize. when set date log file rolled once date boundary specified in datepattern property crossed. when set composite log file rolled once date boundary specified in datepattern property crossed, within date boundary file rolled once size exceeds maximumfilesize. when set once log file rolled when appender configured. means log file can rolled once per program execution. i trying find way everytime use file appender new file created not append same one. rollingfileappender means system creates log file based on filters, way can have log files based on dates (one file each day), or file splitted small chunks when hits size. from point of view, , depending on loggin do, best option in roll flat each day. way have log i...

Adding new element to array in MongoDb -

i have mongodb collection this:- { "_id": objectid("52174bcb834806830e5447"), "roles": [ { "role": "admin" }, { "role": "user" } ] } i need add new 'role' roles array. {"role": "guest" } . how do that? you can $push-operator this should work: db.collection.update( { _id: objectid("52174bcb834806830e5447") }, { $push: { roles: { role: "guest" } } } );

PHP foreach loop is taking time to load thousands of table data in Google Chrome -

on page have 8500 employees shown in table data in form of <tr> , <td> . name of employees shown checkbox in front of each name of employee. when click on checkboxes insert employees data (employee name , employee id) session. everything working fine problem when click on check checkbox employees checkboxes selected there button named "view selected". on click of button want selected employees. when user click on button new child window opened selected employee data in form table row , data. i doing using session have created on click of employees checkboxes. everything working on mozilla firefox when check of google chrome not working , getting browser message killpages or wait. loader image of chrome shown data not loading. my new child window page code reading session , running for-each loop print data in form of table data. <?php require_once("../../includes/global.php"); $sessionname = rq('sessionname'); $emplo...

bash - awk grep the last 30 days of logs by keyword -

trying precise query of log files (i.e. bounces in last 30 days). i seam missing 2 factors, don't think stdin pull zcat info , think there error passing variable awk. home # lastdate=$(date -d "last month" 2>&1 {$1, $2, $3}) | cat /var/log/messages | zcat /var/log/messages-* | awk '$0>=from&&$0<=to' from='{ print date +"%m-%d"}' to=$lastdate '{print to}' | grep -i reject awk: fatal: cannot open file `{print to}' reading (no such file or directory) where broke: lastdate=$(date -d "last month" 2>&1 {$1, $2, $3})|awk '{print lastdate}' no error, no output date -d "last month" fri jul 26 07:13:40 utc 2013 do not use tics, use parentheses: awk 'tolower($0)~/reject/ && $0~date' date=$(date -d'now-30 days' +[%d/%b:%h:%m:%s) /var/log/messages && zcat /var/log/messages-* in post, not use date, records regardless date is p...

eclipse - Tryint to generate "Cloud Endpoint Client Library" from Google-app-engine project failed in MAC OS X -

i'm trying generate "cloud endpoint client library" google app-engine project using eclipse plug-in, fails exception: invocationtargetexception - "all api classes same api name , version must have exact same api-wide configuration". i'm using eclipse 4.2 google app-engine plug-in 1.8.3 on mac os x 10.8.4. strange thing is: on pc running windows same eclipse , plug-in versions, generating libraries project doesn't raise exception. i having same problem. ended removing resource attribute of endpoint classes, difference. @api(name = "shoppingassistant", // resource = "deviceinfos", version = "v1", namespace = @apinamespace(ownerdomain = apikeysandids.api_owner, ownername = apikeysandids.api_owner, packagepath = apikeysandids.api_package_path), clientids = { apikeysandids.android_client_id, apikeysandids.ios_client_id, apikeysandids.web_client_id }, audiences = { apikeysandids.audience_id }) the project ...

Synchronizing stored procedures in mysql -

i have 2 applications, both of them using same stored procedure in mysql. procedure synchronized, while 1 applications calls it, other 1 has wait. is there way without altering codes of applications (that modifying stored procedure)? thanks, krisy you can absolutely within stored procedure without changing application code, bear in mind you're introducing locking issues , possibility of timeouts. use get_lock() , release_lock() take care of synchronization. run get_lock perform synchronization @ start of stored procedure, , release_lock once you're done: if (get_lock('lock_name_for_this_sp', 60)) .... body of sp release_lock('lock_name_for_this_sp'); else .... lock timed out end if you'll need take care application timeouts longer lock timeout don't incur other problems.

ruby - Is there a better way than scoping to apply user-specific changes to models in Rails 3.2? -

in application i'm attempting update rails 3.2 working fine in rails 3.0, there scoping rules use with_scope apply user-specific manipulations of model depending on user's permissions. trivial model: class item < activerecord::base attr_accessible :value end testing scope behaviour: require 'test_helper' class itemtest < activesupport::testcase test "scoping create" item.with_scope({ :create => { :value => 42 }}) item = item.create! assert_equal 42, item.value end end test "scoping create when caller tries override" item.with_scope({ :create => { :value => 42 }}) item = item.create!(:value => 37) assert_equal 42, item.value end end test "scoping update" item.with_scope({ :create => { :value => 42 }}) item = item.create! item.update_attributes!(:value => 37) assert_equal 42, item.value end end end under rails 3.2, ...

C# do some work after all events are raised (or combine events) -

i'd subscribe event raised when of multiple other events raised. suppose have multiple tasks ( a ) first (for example animating multiple independent views), can subscribe event task complete, , i'd other work ( b ) after of these events finished. the amount of first tasks ( a ) can differ each time, @ moment set counter number of tasks a , subscribe n events, , in event handler task completion decrement counter, , when it's zero, task b. is there nicer way combine these events using counter? if understand question correctly, increment counter when start tasks , when each task completed, decrement counter in event handler. in event handler, check see (after decrementing counter) if counter zero. if so, task b. i suggest @ tasks ( aka "task parallel library (tpl)" ), allows this: task.whenall( new task[] { task.run(()=> { //... work a1... }, task.run(()=> { //... work a2... }, task.run(()=> { //... work a3... }}) .con...

eclipse - push specific files using egit -

i thought no pbrainer, reason can't find on issue - there way push specific files egit? our repository contains lrage number of files of no interest me, , every time try push many dirty_tree errors in files don't care about. right-clicking on file , attempting push, tryes push entire repository i'm using eclipse juno mac, , bitbucket repository thanks! git push deals commit objects, not files. if want push specific files, have make commit contains files. in case, might want @ git update-index --assume-unchanged <files> command, or @ .git/info/exclude file, .gitignore except it's local repository (doesn't shared upstream repo).

html - Passing file type variable from one external javascript to another external javascript -

is possible? saw lot of questions passing values 1 external js external js, didn't (or maybe didn't notice) see passing file 1 external js another. the thing is, building web page consisting of 3 pages on it. first page uploading file using drag , drop, 2nd page formdata input , submitting formdata using ajax, while 3rd page show responsetext ajax. each page has own external script, because if try cram codes 1 external javascript, show error cannot call method 'addeventlistener' of null whenever moved 2nd or 3rd page, because drag , drop box located on 1st page. but need file dropped external js handles 1st page external js handles 2nd page, because need append file along other data formdata, before submitting ajax. want know if there anyway can pass file (along file info obtained filereader) external js 1st page external js 2nd page? , if possible, method doesn't involve server side scripting (like php, jsp).

python - subprocess's Popen closes stdout/stderr filedescriptors used in another thread when Popen errors -

an internal library heavily uses subprocess.popen() started failing automated tests when upgraded python 2.7.3 python 2.7.5. library used in threaded environment. after debugging issue, able create short python script demonstrates error seen in failing tests. this script (called "threadedsubprocess.py"): import time import threading import subprocess def subprocesscall(): p = subprocess.popen( ['ls', '-l'], stdin=subprocess.pipe, stdout=subprocess.pipe, stderr=subprocess.pipe, ) time.sleep(2) # simulate popen call takes time complete. out, err = p.communicate() print 'succeeding command in thread:', threading.current_thread().ident def failingsubprocesscall(): try: p = subprocess.popen( ['thiscommandsurelydoesnotexist'], stdin=subprocess.pipe, stdout=subprocess.pipe, stderr=subprocess.pipe, ) except excep...

c++ - Writing traversal methods for classes (TreeNode) that are designed to be inside (arbitrary) containers -

i have class (when simplified) looks this: class treenode { ptrdiff_t sibling_offset, first_child_offset; public: long whatever; // ... }; the tree nodes must contain offsets instead of pointers, because needs possible them embedded in containers (like std::vector ) may reallocate storage when necessary, without having spend time re-linking nodes. now, if have suitably defined class treeiterator<iter> (perhaps defined friend of treenode ) job iterate on treenode 's children, any stl-style client of class should able use iterate on children of node in standard, stl fashion: typedef std::vector<treenode> tree; tree tree = ...; treeiterator<tree::iterator> const root = tree.begin(); (treeiterator<tree::iterator> = root->begin(); != root->end(); ++i) { foo(i->whatever); process_further(i); } the trouble is, root->begin() impossible because treenode doesn't know container it's in . (and shouldn't!...

python - Linked List and manipulation -

i need constructing linkedlist no constructor parameters in python 3.3; resulting in empty linkedlist object. want able add , remove elements in front , in end of list. far can prepend , add things front. i'm little iffy on how else works. here's have far: class node: def __init__(self, d, n): self.data = d self.next = n class linkedlist: def __init__(self): self._head = none self._size = 0 def __len__(self): return self._size def append(self, item): pass def prepend(self, item): self._head = node(item, self._head) self._size += 1 def remove_first(self): pass def remove_last(self): pass does have clue? bunch! you can use deque object collections module in standard library. prepend method called appendleft in deque object. in other way, can modify linkedlist class reference last node of list: class linkedlist: def __init__(self): se...

c# - Convert into proper XML format -

i getting input string in xml format symbols in codes. how can convert input in proper xml format using function? or should manually replace codes symbols? for example: %3cusers%3e %3cuser%3e %3cuserid%3e 567844d3-9ee8-463b-a1a0-9d7a8a59a66a %3c/userid%3e %3cemailid%3e activation1@dealertrack.com %3c/emailid%3e %3c/users%3e convert <users> <user> <userid> 567844d3-9ee8-463b-a1a0-9d7a8a59a66a </userid> <emailid> activation1@site.com </emailid> </users> ps: xml contains other symbols also. add reference system.web , use httpserverutility.urldecode method (string) : var decodedxml = system.web.httputility.urldecode(xml);

php - Session variable not working in real time -

i have user comment system in time of comment displayed using utc timestamp stored in database along comments. the time offset used set session timeoffset variable using javascript post request user local time. i have done because user diffrent timezone , cannot store time in 1 time zone alone have stored in utc , displayed using timeoffset of timezone. this system not working in real time working after refresh. comments.php <?php session_save_path('session/store'); session_start(); ?> <script type="text/javascript" src="jquery/jquery.js"></script> <script type="text/javascript"> var timeoffset = new date().gettimezoneoffset(); $.post('timeoffset.php', {timeoffset:timeoffset}, function(data){ //alert(data); }); </script> <?php if(isset($_session['timeoffset'])&&!empty($_session['timeoffset'])){ date_default_timezone_set('utc'); $timeoffset = (int)...

c++ - BOOST_PP_REPEAT with array -

i have struct : struct e1 { typedef boost::tuple< boost::optional< n::type_a >, // n - namespace boost::optional< n::type_b >, ................... boost::optional< n::type_x > //arbitrary number of, maximal 7 > data_type; // access name boost::optional<n::type_a> const& type_a() const { return boost::get<0>(data); } boost::optional<n::type_b> const& type_b() const { return boost::get<1>(data); } ..................................... boost::optional<n::type_x> const& type_x() const { return boost::get<2>(data); } data_type data; }; q: how may create structure using boost preprocessors? me known type_a, type_b, ..., type_x name of types. it's need me, because must create lot of structures that, changing type_a, type_b, ... types. in common case, can use boost preprocessor array or set? you this: #define types (type_a)(type_b)(type_x) ...

Denying download of specific files in ASP.NET MVC -

i have couple of files sitting in root of project web files, not: package.json , gruntfile.js example. unfortunately, user can navigate files in root path. i'd avoid this. there must way? of other files in folder aren't accessable. the simplest way, be: create 2 routes, /package.json , /gruntfile.js controller respond http 403. another, create global filter, match routes , respond http 403 well.

vba - Making excel graphs appear/disappear -

i want graph appear when condition fulfilled. more precise: have drop down menu changes content of graph. if menu point "total revenue" clicked, want second graph appear. new vba , came far: sub iffuntion() dim selectedchart range dim notvisible boolean if range("d100").value = range("e100").value activesheet.chartobjects("testchart").visible = true else activesheet.chartobjects("testchart").visible = notvisible end if end sub it works, have execute vba make graph appear/disappear , happen automatically. condition should in worksheet keep sheet graphs nice , tidy. read achieve have toi have activate other worksheet. recommend way or there better solution? thanks , best regards! pete edit: here link sample file proposed solution of cor_blimey, couldn't work properly. interconnections in excel more complicated have be, wanted accurate ad possible in displaying happening in excel. taking look! https://dl.dropboxuserconten...

Convert string to Unicode hex representation and back in C++ -

i want convert string string contains characters of given string in unicode hex notation , again. target language c++. for example, given german word hände , want able convert string it's unicode hex notation u+0068 u+00e4 u+006e u+0064 u+0065 , , original representation hände . how can accomplished in c++? according comment, stop use simple conversation? std::u16string in = u"hände"; stringstream out; (auto x : in) out << hex << "u+" << x << " "; cout << out.str(); output: u+48 u+e4 u+6e u+64 u+65

angularjs - How do I integrate an existing modal framework written in JQuery in angular? -

we have purchased css whole bunch of our ui. includes things tabs, wizards , modals. template uses jquery rendering. have read angular discourages jquery , should try in angular. unfortunately 3rd party tool , our team sold on it. we have number of screens display grid. page includes 1 'add new' button , 'edit' button each row displayed on grid. when user clicks 'add new' button need show modal allows him capture new entity (whatever is). when user clicks 'edit' opens similar modal , populates fields. the modal needs opened jquery calls plugin. able use jquery angular in controllers can open theme's modal. i jquery that. rest stick angular way far possible. first of all, not forbidden use jquery angularjs. highly recommended use possible because lose of it's data-bind , events power don't need code. when using 3rd-party, have 3 choices. you can use bridge exists 1 bootstrap: ( http://angular-ui.github.io/bootstrap/ ) y...

jasper reports - How JasperReports display CLOB field with HTML tags -

i want show value in detail band. line oracle db data type clob , value contain html tag i error message: error filling print... error evaluating expression :      source text : $f{discharge_text}.getsubstring( 1l, ( new long( $f{discharge_text}.length() ) ).intvalue()) net.sf.jasperreports.engine.fill.jrexpressionevalexception: error evaluating expression :       source text : $f{discharge_text}.getsubstring( 1l, ( new long( $f{discharge_text}.length() ) ).intvalue())       at net.sf.jasperreports.engine.fill.jrevaluator.evaluate(jrevaluator.java:195)       at net.sf.jasperreports.engine.fill.jrcalculator.evaluate(jrcalculator.java:589)       at net.sf.jasperreports.engine.fill.jrcalculator.evaluate(jrcalculator.java:557)       at net.sf.jasperreports.engine.fill.jrfillelement.evaluateexpression(jrfillelement.java:929)       at net.sf.jasperreports.engine.fill.jrfilltextfield.evaluatetext(jrfilltextfield.java:383)       at net.sf.jasperreports.engine.fill.jrfilltextfield....

java - Exception while input a date into a MySQL database -

i have mysql database , want write row it. problem mysql not query , why? code : java.sql.timestamp date = new java.sql.timestamp(new java.util.date().gettime()); (integer articlevalue : articlesendlist) { (integer suppliervalue : suppliersendlist) { connection.executequery("insert bestellungen(bestellung_id, artikel_id, lieferant_id, datum, preis) values (" + maxorder + ", " + articlevalue + ", " + suppliervalue + ", " + date + ", null)"); } } a small description code. articlesendlist contains ids selected values jtabel . same applies suppliersendlist . want write ids table " bestellung ". variable maxorder current id table " bestellung ". if need it, exception is: you have error in sql syntax; check manual corresponds mysql server version right syntax use near '12:45:06.164, null)' @ line 1 please not comment/answer other links, searched problem , read several si...

google cloud messaging - Android GCM doesnt register device -

code: string msg = ""; try { if (gcm == null) { gcm = googlecloudmessaging .getinstance(orfografapplication.this); } string senderid = constants.gcm_sender_id; gcm_registration_id = gcm.register(constants.gcm_sender_id); msg = "device registered, registration id=" + gcm_registration_id; setregistrationid(orfografapplication.this, gcm_registration_id); } catch (ioexception ex) { log.w(tag, ex.getmessage()); msg = "error :" + ex.getmessage(); } return msg; exception message service_not_available in logcat : w/gcm(749): dir: /data/data/com.google.android.gms/app_app /data/data/com.google.android.gsf it worked fine, stoped @ 23 of august. see answers on service_not_available gcm . there can many reasons same. 1 of them either device can't read response or there 500/503 server. apparently there bug report also, hasn't been resolved yet. see ...

extjs - Insert data to db -

i have checkbox grid , button. when push button want insert selected rows data db. the checkbox part succeed , rows out cant figure hout how insert data db. i know simple stuck on days , cant figure out docs or google. var temp = ''; (i=0; i<=checkboxselection.length-1; i++){ temp = temp + checkboxselection[i].get('vendor_name') + ","; } alert(temp); this store: var v_url = 'getbiddingrows.jsp'; store: ext.create('ext.data.store', { fields:[ {name: 'stat_data', type: 'date' , sorttype: 'asdate', format: 'y-m-d h:m:s'}, {name: 'operator_desc'}, {name: 'vendor_name'}, {name: 'currency'}, {name: 'rate', type: 'float', sorttype: 'asfloat'} ], proxy: { type: 'ajax', timeout: 1...

Adding an index to mongodb collection hash field with dynamic key values -

i m using mongoid , rails 4. have model has 'data' field of type hash. field store dynamic key value pairs. know can add indexing static fields possible add indexing keys of 'data' , how should done. you can add in same way if index not in dynamic field, this: class person field :data, type: hash index('data.foo' => 1) end i pretty sure mongoid dont validate if fields exists, can create index on model. if dont have docs containing field, add sparse option index, save space in memory.

jquery - toggleClass when maximum amount of appended items is reached -

is possible use toggleclass on button when maximum amount of appended items reached? i want 6 appended divs/items maximum. i've added variable counter. increases when item appended , decreases when removebutton clicked. last step toggleclass button (like disabled button). when maximum amount reached, button toggleclass = red. what want: on sixth appended item, button background changes red , doesn't append anymore items (disabled). when user removes one, button toggles it's original state , button fire append event again. how can integrate toggleclass in code? html <div id="addbutton">add</div> <div id="box"></div> js var amount = 0; var div = '<div>' + '<input type="text"/>' + '<input type="button" class="removebtn" value="delete"/>' + '</div>'; $('#addbutton').click(function () { amount++; ...

How to search through all items of a combobox in C#? -

i have combobox, , search through every element in it. how can this? (also number of items not same everytime, not important). i using c# windows form application. you can this for (int = 0; < mycombobox.items.count; i++) { string value = mycombobox.getitemtext(mycombobox.items[i]); }

android - Twitter followers list not getting -

i know twitter api update 1.1 , have token & tokensecret i have checked both api https://api.twitter.com/1/friends/ids.json?cursor=-1&screen_name=myscreenname response getting {"errors": [{"message": "the twitter rest api v1 no longer active. please migrate api v1.1. https://dev.twitter.com/docs/api/1.1/overview.", "code": 68}]} https://api.twitter.com/1.1/friends/ids.json?cursor=-1&screen_name=myscreenname response getting {"errors":[{"message":"bad authentication data","code":215}]} please me response of followers ids list. just tried execute request ( https://api.twitter.com/1.1/friends/ids.json?cursor=-1&screen_name=myscreenname ) in dev console , works charm. seems you've missed authorization step (autorization with oauth required api v1.1), verify authorized valid credentials. you can read more auth on twitter here or check out documentation libr...

How to iterate over a JSON returned array in freemarker? -

i have json array in format : { "productlist" : [ { "noderef" : "workspace:\/\/spacesstore\/55f8dd88-dccd-4c09-9a67-bb3f2d5f02d4", "photoproduit" : "api\/node\/workspace\/spacesstore\/60f80999-0d2b-4798-abbb-786d5fe13a85\/content\/thumbnails\/doclib", "typeproduit" : "bonbon", "unitequantite" : "48", "tarifunitaire" : "1.89", "descriptionproduit": "sweets product update test 2" } , { "noderef" : "workspace:\/\/spacesstore\/c2ffb3c1-9091-47fb-9b01-ce6b0d30a869", "photoproduit" : "api\/node\/workspace\/spacesstore\/77264862-54a4-4248-acf0-8e36c400dc1a\/content\/thumbnails\/doclib", "typeproduit" : "post notes", "unitequantite" : "10", "tarifunitaire" ...

custom user login with ASP.NET using SQL and C# -

i've been working on asp.net application , i've managed create login , register webpage linked sql database using c# server-side code. problem: couldn't find method keep user logged in while opening different pages, best method 100% customizable, preferably tot using "logincontrols". time! the user tied session . pages have property available. it's httpsessionstate object, , can house logged in user information. now, can encapsulate lot of work building user class has static accessors pull data out of session. example: public static class user { public static bool isauthenticated { { var session = httpcontext.current.session; return !string.isnullorempty(session["loggedinuser"]); } } public static string username { { return session["loggedinuser"]; } } public static bool login(string username, string passw...

javascript - Add one xml element into another xml -

please let me know how following thing. xml document 1 : <tag1 id="id1" name="myname"> <tag_child1 child1id="child1"></tag_child1> </tag1> xml document 2 : <tag_child2> <tagchild2_child3 child_childid = "child_child3"> </tagchild2_child3> </tag_child2> final document : <tag1 id="id1" name="myname"> <tag_child1 child1id="child1"></tag_child1> <!-- document 2 --> <tag_child2> <tagchild2_child3 child_childid = "child_child3"> </tagchild2_child3> </tag_child2> </tag1> i tried using appendchild() function in javascript.but wasn't able it. please help. thanks pulls out glass ball... you have been trying nodefromdoc1.appendchild(nodefromdoc2); and error said cannot append child nodes not belong different document. try var othernode ...

java - How to process servlet requests during long shutdown -

we need implement graceful shutdown mechanism our servlet application. edit: want make simple possible, handling kill signal sent via operating system's function. allow system admins use built in shell utilities (kill or taskkill on windows), otherwise have install utility "talk" server. this mechanism works in 2 phases: upon shutdown request, deny critical activities block until initiated critical actions completed; these may take several hours phase #1 implemented in our dao layer. phase #2 implemented in our servletcontextlistener#contextdestroyed method our problem once contextdestroyed called servlet container stops servicing further http requests. edit: contextdestroyed called when calling operating system's kill function on server's process. we let application alive during phase #2, notifying users activities unavailable. use filter keep list of critical requests. when "prepare shutdown" request received, filter s...

xpath - How to specify the service instance in an external WS-policy attachment file? -

i trying create ws-policy attachment file in order attach policy activity of particular process instance. have read endpoint reference(epr) should included in appliesto element problem don't know how specify process instance. following code attaches policy invoke activity for instances of process myprocess . <wsp:policyattachment> xmlns:wsp="http://schemas.xmlsoap.org/ws/2002/12/policy" xmlns:q4b="http://www.example.com/q4b" xmlns:ns="http://www.example.com/processes" <wsp:appliesto> <q4b:process name="ns:myprocess" expressionlanguage="xpath1.0"> /process/inovoke[2] </q4b:process> </wsp:appliesto> <wsp:policyreference> uri="http://www.example.com/policies/mypolicy"/> </wsp:policyattachment> the appliesto element defines policy subject. includes new defined xml-type called q4b:process specifies name of process , includes xpath expression select seco...

jpa - Upgrading GlassFish 3.1.2.2 to use JSF 2.2 -

i working glassfish 3.1.2.2 , can not upgrade 4 due os restrictions. i'm interested in upgrading jpa 2.0 jpa 2.1 , jsf 2.1 jsf 2.2 in glassfish 3.1.2.2. how can achieve this? i can't speak jpa, jsf it's matter of replacing javax.faces.jar file in /modules directory desired version. don't forget clean glassfish cache , work folders before deploying, because older jsf version may still hang in there , cause conflicts.

Angularjs - Populate select box using ng-options -

i have json object below keyword = { application: ["athena","ewindow","ews","fact","ftp","hardware","pen","hermes","infrastructure","lng tracker","m2m","maintenance","microsite","oracle","platts.com","pmc","pto task","sametime","third party data","user error","vendor","web channels","xml-dd","customer request","mark logic","sbb","market engagement form","lotus notes database","oracle11i","external news","stringers","prp","kingsman","hermes-1"], incidenttype: ["publishing failure","brand damage","security failure","content creation failure","internal failure","external failure",...

php - MySQL Error: Commands out of sync; you can't run this command now -

mysql error: commands out of sync; can't run command now i above error when try execute sql procedure more once each time. i've found has "store result", i've been trying figure out while, haven't succeeded yet. here php code: $query = "call getobjectsvalue(".$formid.")"; if( $res = $mysqli->query($query) ) { $mysqli->store_result(); while ($row = $res->fetch_assoc()) { ... } $res->free(); } for reason, recordset stored procedures 1 has loop through using next_result() command. not case if recordset comes directly execution of sql query (select). $query="call getobjectsvalue($formid)"; if($res=$mysqli->query($query)) { { $row = $res->fetch_assoc() ... } while($mysqli->next_result()); //loop through recordset $res->free(); }

function - Java get method from generic Class object -

i have method following class holds list of objects of 2 different classes can passed in. public class datatableentity { list<objects> objectcontainer; public void setlinks(class cls){ for(object obj : objectcontainer){ //the cls variable hold type of object //so need somehow if 'dog' obj going through dog // , method dog.getname else might cat , cat.getcatname etc. } } this function gets told list , should format property of objects in list correctly before being sent out client. different objects have different setter , getter names these properties. need somehow take generic class object, see kind of class can know method, ".getabc/.setabc" or ".getxyz/.setxyz" use. is possible? like ? public class datatableentity { list<objects> objectcontainer; // objects know class are, no need pass public void setlinks() { for(object obj : objectcontainer) { if(obj instanceof classa) { ...

java - Connect collection of points by finding neighborhood points -

Image
i have swing application in have arraylist of points on image. want connect points such each point connected nearest neighbors. like this: so started this: minuatiae.java public class minutiae { private int x; private int y; public minutiae(int x, int y){ this.x = x; this.y = y; } public int getx() { return x; } public void setx(int x) { this.x = x; } public int gety() { return y; } public void sety(int y) { this.y = y; } } manager.java list<minutiae> minuatiaepoints = new arraylist<minutiae>(minutiae); for(int = 0; i<minuatiaepoints.size(); i++){ minutiae mpoint = minuatiaepoints.get(i); minutiae minpoint = minuatiaepoints.get((i+1) % minuatiaepoints.size()); int minxdistance = minpoint.getx()-mpoint.getx(); int minydistance = minpoint.gety()-mpoint.gety(); double mindist = math.hypot(minxdistance, minydistance); for(i...

c# - Sequencing ASP.NET custom validators and difference between Validator's Text and ErrorMessage properties -

i have textbox 2 validators. first validator checks if textbox empty or not. second validator checks value of textbox contains spaces or not. when run project , try validate without text in textbox , shows both validators' error messages. want should not execute second validator until first validator validated successfully. <asp:customvalidator id="customvalidator1" runat="server" controltovalidate="textbox3" errormessage="please enter value." font-names="segoe ui" onservervalidate="customvalidator1_servervalidate" setfocusonerror="true"></asp:customvalidator> <br /> <asp:customvalidator id="customvalidator2" runat="server" controltovalidate="textbox3" errormessage="spaces not allowed." font-names="segoe ui" onservervalidate="customvalidator2_servervalidate" setfocusonerror="true"></asp:customvalidator> ...

html - Clear: both overrides margin: 0 auto? -

i'm having positioning problem need deal with. in container div have 2 divs, both should horizontally centered under each other. however, i'm having problems positioning of second div. if add clear:both div 2 gets on new line, desired. however, if using clear:both margin: 0 auto; doesn't work. use instead make div centered? html: <div class="row-fluid"> <div class="span6 offset3 text-center header"> <h1>title...</h1> <p>text...</p> </div> <div class="span3 offset4"> <form> ... </form> </div> </div> css: .register .span3 { width: 270px; clear: both; margin: 0 auto; } output: - without clear:both ____________________________________ | | | ______ ______ | | | | | | | | | div 1| ...

python - remove empty lines from HTML, except in <code></code> blocks -

Image
i'm using editorial write posts of wordpress blog markdown. the markdown parser outputs html code perfectly, , editorial embedded viewer shows result spected format , style. when paste html in wordpress mobile editor, shows text in wrong format, showing empty lines. for example: # header hello world, **this markdown!** other markdown paragraph!. is parsed to: <h1>header</h1> <p>hello world, <strong>this markdown!</strong></p> <p>other markdown paragraph!. </p> which showed in viewer as: which expected. the wordpress mobile app, on other hand, shows html code as: as can see, there empty lines. i think css sheet of wordpress has margin of paragraphs , headers configured put 1 empty line above, , 1 empty line bellow. but cannot modify css , brute-force solution remove blank lines between paragraphs in html code. works fine, process tedious. so want use powerful tools of editorial build work...

api - Resource path is not callable in Custom Magento Module -

sei que tem alguns topicos relacionado aqui no stackoverflow, mas nenhum conseguiu me atender devidamente. segue minha api.xml <?xml version="1.0"?> <config> <api> <resources> <verificaintegrador_api translate="title" module="verificaintegrador"> <title>myapi</title> <acl>verificaintegrador/api</acl> <model>verificaintegrador/api</model> <methods> <verificarintegradoron translate="title" module="verificaintegrador"> <title>verificarintegradoron</title> <acl>verificaintegrador/verificarintegradoron</acl> </verificarintegradoron> <alterarstatusintegrador translate="ti...