Posts

Showing posts from April, 2014

java - Access bean inside repeat in jsf -

this question has answer here: commandbutton/commandlink/ajax action/listener method not invoked or input value not updated 9 answers i have userprofilebean can access outside of repeat when do <ui:repeat id="reqlistid" var="reqlist" value="#{userprofilebean.friendrequestslist}"> jmeno: #{reqlist.jmeno} <br/> prijmeni: #{reqlist.prijmeni} <br/> id: #{reqlist.id} <br/> <p:commandbutton id="allowfriendbutton" action="#{userprofilebean.allowfriend()}" value="přidat" update="reqlistid"> </p:commandbutton> then allowfriend method doesn't called , netbeans says unknown property. missing something? edit: replies. still doesn't work. state this. <h:form> <p:commandbu...

python - wxpython, passing user datas to html2 -

i trying develop python gui access webpages. below example working fine. need pass user credentials(username/password) in code. i dont want click on button. need fill text boxes in login page import wx import wx.html2 class mybrowser(wx.dialog): def __init__(self, *args, **kwds): wx.dialog.__init__(self, *args, **kwds) sizer = wx.boxsizer(wx.vertical) self.browser = wx.html2.webview.new(self) self.browser.loadurl("http://wiki.python.org/moin/guiprogramming?action=login") sizer.add(self.browser, 1, wx.expand, 10) self.setsizer(sizer) self.setsize((700, 700)) if __name__ == '__main__': app = wx.app() dialog = mybrowser(none, -1) dialog.show() app.mainloop() the "use javascript" answer helpful, recent versions of wxpython anyway, won't run unless wx.html2.evt_web_view_loaded changed wx.html2.evt_webview_loaded ("web_view changed "webview").

Hibernate : aggregate two entities in one class to retrieve data with one HQL query -

i have 1 class : public class bookauthor { private book book; private author author; } book , author defined entities. when try retrieve data, way : final string selectcols = "new bookauthor(b,a)"; final org.hibernate.query q = createquery(selectcols, params, filters); result = q.list(); return result; when hibernate executes "q.list()", performs 1 query retrieve book's , author's ids, , iterates results information authors , books. is, in log, there : select a.id, b.id authors , books b and each row : select a.id, a.name a.id = ? select b.id, b.title b.id = ? is there way tell hibernate results 1 query improve performance ? : select a.id, a.name, b.id, b.title authors , books b thanks in advance. edit : entities defined referring tables , column names like: public static final string table_name = "author"; @column(name = "id", nullable = false) protected long id; i think there no db constraint betw...

Swiftmailer not sending mail in php -

error_reporting(e_all); require_once 'swift_required.php'; //create transport $transport = swift_smtptransport::newinstance('mail.your_domain.com', 25) ->setusername('name@your_domain.com') ->setpassword('your_password') ; //create mailer using created transport $mailer = swift_mailer::newinstance($transport); //create message $message = swift_message::newinstance('php message') ->setfrom(array('name@your_domain.com')) ->setto(array('name@your_domain.com')) ->setbody('php swift mailer sent authentication') ; //send message $result = $mailer->send($message); if (!$mailer->send($message, $failures)) { echo "failures:"; print_r($failures); } this code used sending email. not working properly. there not error or fail message. wrong? your code seems work fine if smtp server address valid , reachable credentials provided. perhaps smtp server address or login credentials incorr...

java - how to read properties file using spring and exposed to class -

i using spring 3.0.5 , trying read properties files make kind of validation datasource. getting null when use @value ,below cfg. in applicationcontext.xml <bean id="propertyconfigurer" class="org.springframework.beans.factory.config.propertyplaceholderconfigurer"> <property name="location" value="classpath:database.properties"/> <bean id="mydatasource" class="org.apache.commons.dbcp.basicdatasource" destroy-method="close"> <property name="driverclassname" value="${jdbc.driverclassname}" /> <property name="url" value="${jdbc.url}" /> <property name="username" value="${jdbc.username}" /> <property name="password" value="${jdbc.password}" /> </bean>// here establishing data-source. the class want exposed values of properti...

python - Selenium Expected Conditions - possible to use 'or'? -

i'm using selenium 2 / webdriver python api, follows: from selenium.webdriver.support import expected_conditions ec # code causes ajax query run webdriverwait(driver, 10).until( ec.presence_of_element_located( \ (by.css_selector, "div.some_result"))); i want wait either result returned ( div.some_result ) or "not found" string. possible? kind of: webdriverwait(driver, 10).until( \ ec.presence_of_element_located( \ (by.css_selector, "div.some_result")) \ or ec.presence_of_element_located( \ (by.css_selector, "div.no_result")) \ ); i realise css selector ( div.no_result, div.some_result ), there way using selenium expected conditions method? i did this: class anyec: """ use webdriverwait combine expected_conditions in or. """ def __init__(self, *args): self.ecs = args def __call__(self, driver): fn in self.ecs: ...

javascript - Button to Trigger Nav-Tab with Twitter Bootstrap -

this button triggers next tab load content, tab not switch, remains on first tab.. <br><a class="btn btn-primary" href="#tab2" data-toggle="tab">review</a><br> here code nav nav-tabs: <ul class="nav nav-tabs"> <li class="active"><a href="#tab1" data-toggle="tab">shipping</a></li> <li><a href="#tab2" data-toggle="tab">quantities</a></li> <li><a href="#tab3" data-toggle="tab">summary</a></li> </ul> any solution for switching both tab&content appreciated ..perhaps way change button trigger next() function in * bootstrap-tab.js v2.3.1: , activate: function ( element, container, callback) { var $active = container.find('> .active') , transition = callback && $.support.transition ...

php - Array_diff not taking in arguments -

i trying difference of 2 files: $first = file('lalala.json'); $second = file('alabala.json'); //print_r($first); //print_r($second); $first_result = array_diff($first[0], $second[0]); //$second_result = array_diff($second, $first); print_r($first_result); //print_r($second_result); the content of lalala.json is: `[{"name":"tim pearson","id":"17118"},{"name":"ashley danchen chen","id":"504829084"},{"name":"foisor veronica","id":"100005485446135"}]` while content of alabala.json `[{"name":"tim pearson","id":"17118"},{"name":"foisor veronica","id":"100005485446135"}]` however problem error, because content not recognised array (the error argument #1 not array ). if array_diff($first, $second) output content of $first array ( [0] => [{"name...

asp.net - Listbox without values -

this happens. don't understand why not working, because if copy code normal template works fine :s dont think code issue. im working asp , c#![enter image description here][1] http://s21.postimg.org/3jsi8351z/weird.png here prints screen took explain issue asp: <asp:panel id="pnltopico" runat="server" groupingtext="topico" height="100px" width="550px" visible="false" wrap="false"> <asp:dropdownlist id="droptopico" runat="server" autopostback="true" datasourceid="sqldatasource1" datatextfield="nome" datavaluefield="id_topico" height="22px" onselectedindexchanged="droptopicoselectedindexcha nged" width="169px"> </asp:dropdownlist> <asp:panel id="pnlpermissoestopico" runat="server" groupingtext="permissões" height="59px" style="margin-top: 0px...

dialog - Adding a custom image to AlertDialog [ANDROID] -

i'm trouble trying add image alertdialog. image not same, it's different everytime. what i'm trying do, adding image alertdialog (if it's possible imageview, , not icon of dialog) knowing name. trouble have thousand images. 1) so, when calling builder.seticon(int iconid) dunno how pass iconid instead of name of picture. considering i'm using different image every time. 2) advice on how put image imageview (considering there's layout associated dialog)? update have string s = scanqr.substring(start, 21); result of scan qr-code reader. this string contain name of image want put in alertdialog. now, here code dialog: @override public dialog oncreatedialog(bundle savedinstancestate) { alertdialog.builder builder = new alertdialog.builder(getactivity()); layoutinflater inflater = getactivity().getlayoutinflater(); builder.setview(inflater.inflate(r.layout.dialog_single_work, null)) //here icon (better imageview, dunno how it) ...

matlab - Create a larger matrix in special case -

i have 2 vectors: a=[1 2 3 4] b=[3 5 3 5] i want find matrix these vectors this: you can suppose c plot matrix , x-axis a , y-axis b : c = 0 4 0 4 3 0 3 0 0 0 0 0 0 0 0 0 or: c1= 0 1 0 1 1 0 1 0 0 0 0 0 0 0 0 0 my question how create automatically because have large vectors. i'm assuming a , b coordinates, , want "draw" plot in matrix form, try this: c = flipud(full(sparse(b, a, b))); i added flipud adjust positive direction of y-axis upwards. alternatively, can obtain binary matrix using this: c1 = flipud(full(sparse(b, a, ones(size(a))))); important: solution work, a , b must contain positive integer values. there no sense in try "plot" matrix non-positive or non-integer positions. example a = 1:4; b = [3, 4, 3, 4]; c = flipud(full(sparse(b, a, b))) c1 = flipud(full(sparse(b, a, ones(size(a))))) this r...

actionscript 3 - removeEventListener not working -

function drag(event:mouseevent):void { if ((event.target.parent == inventorymenu) && (event.target item)) { var picked:item = item(event.target); stage.addeventlistener(mouseevent.mouse_up, drop); inventoryarrowdown.addeventlistener(mouseevent.mouse_over, inventorynav("down")); inventoryarrowup.addeventlistener(mouseevent.mouse_over, inventorynav("up")); function drop(event:mouseevent):void { if ((event.target.parent == inventorymenu) && (event.target item)) { var dropped:item = item(event.target); if ((event.target item) && (event.target.parent == inventorymenu)) { if (picked.itemdata("workswith") == dropped.name) { var itemname:item = item(fetchresult(picked, dropped)); itemname.addchild(itemname.itemdata("filename")); inventorym...

How to mark AND as a query word not query operator in SOLR -

in solr use case don't have stopwords. found , considered query operator though. placed + in front of , and not considered word more. right way of solving or there more preferred way? plz use double quotes wrap it. example: q=field:"and"

javascript - Converting humanized strings to dates moment.js -

moment.js humanized , calendar dates, example: moment().calendar() "today @ 10:17 am" which gets current date object , converts calendar date, and is there way in reverse? if give "today @ 10:17 am" , returns date object todays date , 10:17 time? date.js can parse human readable dates: http://www.datejs.com/ sugarjs can parse natural language dates: http://sugarjs.com/dates it can deal stuff like: one day before yesterday 2 days after monday 2 weeks monday second ago 25 years last wednesday also, see related question: is there natural language parser date/times in javascript?

javascript - Two jquery submits, one action per -

i'm new js/jquery (i'm backend developer) , having trouble implementing something. working django , have template has text area needs have submit event when enter button pushed. here how i've implemented that. <div class="search multi-search"> {% if search_str %} <textarea name="search_str" id="search_str">{{ search_str }}</textarea> {% else %} <textarea name="search_str" id="search_str" placeholder="search lead id's or email addresses separated comma."></textarea> {% endif %} <button id="thebutton" type="submit" class="btn btn-icon btn-large btn-inverse"><i class="icon-search"></i></button> </div> <script> // overriding default enter action submit // search string on enter instead $('#search_str').keydown(function(e){ // checks see ...

jquery - append two javascript objects together -

i needing add 1 object , not sure how.i need add phonegroup forward object inside of frontdesk object. know how can done? mind there potential different object attached forward has scale-able var frontdesk = { "frontdesk": { "user": "", "waittime": "", "forward": {} } } var phonegroup = { "phonegroup": { "name": "", "users": [ "", "", "" ], "noanswer": { "forwardafterrings": "", "forwardafterseconds": "", "forwardto": "" } } } forward empty... need join objects, or can replace forward phonegroup? frontdesk.frontdesk.forward = phonegroup; will it, if can replace object.

asp.net - Selecting the wrong item because of old data in GridView -

i'm working in visual studio 2010 c#/asp.net , sql server database. i'm trying fix website allow managers assign employees various tasks. problem if 2 managers working @ same time, wrong employee may assigned task. list of employees represented in gridview. the problem seems occur because 1 of users looking @ old data in gridview. let’s first person loads list , gridview looks this: -employee 1 -employee 2 -employee 3 -employee 4 then second person comes in , makes assignment employee 2, removes employee 2 list. actual list looks this: -employee 1 -employee 3 -employee 4 but first person still sees because page hasn’t updated yet: -employee 1 -employee 2 -employee 3 -employee 4 the first person tries assign employee 3 task. still see old list. when click make assignment, page posts server (apparently selecting row in gridview control server side event, i’m not sure if there’s way around http://forums.asp.net/t/1706468.aspx/1 ). page reloads ,...

.net - Mono.Cecil GetTypeReference to ICommand -

the system.windows.input.icommand interface has been type forwarded of .net 4.5 being in presentationcore.dll system.dll. have 2 issues: how can import interface can use return type of property injecting class (don't need property injection, type resolution/importing)? how can sure resulting assembly work on .net 4 clients don't have .net 4.5 installed , such not have icommand type forwarded system.dll? the code intended used in custom fody weaver. you have handle explicitly. for example finding action can exist in diff assemblies. var mscorelibdefinition = assemblyresolver.resolve("mscorlib"); var mscoretypes = mscorelibdefinition.mainmodule.types; var systemdefinition = assemblyresolver.resolve("system"); var systemtypes = systemdefinition.mainmodule.types; var actiondefinition = mscoretypes.firstordefault(x => x.name == "action"); if (actiondefinition == null) { actiondefinition = systemtypes.first(x => x.na...

iphone - How to increment/decrement application.badge number for UILocalnotification -

i have uilocalnotification when multiple notification fired want application badge number increment , when notification seen want application badge number decrease depending upon how many notification cancelled / watched notification - (uilocalnotification *)schedulenotification :(int)remedyid { nsstring *descriptionbody; nsinteger frequency; uilocalnotification *notif = [[uilocalnotification alloc] init]; descriptionbody =[[self remedydetailsforremedyid:remedyid] objectforkey:@"remedytxtdic"]; frequency = [[[self remedydetailsforremedyid:remedyid] objectforkey:@"remedyfrequency"]intvalue]; nsarray *notificationfiredates = [self firedatesforfrequency:frequency]; (nsdate *firedate in notificationfiredates) { notif.timezone = [nstimezone defaulttimezone]; notif.repeatinterval = nsdaycalendarunit; notif.alertbody = [nsstring stringwithstring:des...

xsd - Is it preferred to define a separate plural complexType for multiple singular elements -

is there established standard inlining trivial plural complextypes vs. defining them separately? in detail: when defining xml schemas encounter cases want 1 element contain multiple child elements of same single type. example schema describes table in database has fields element can contain 1 or more field elements. can either create inline complextype within definition of plural fields element: <xs:element name="fields" minoccurs="1" maxoccurs="1"> <xs:complextype> <xs:sequence> <xs:element name="field" type="table-field" minoccurs="1" maxoccurs="unbounded" /> </xs:sequence> </xs:complextype> </xs:element> or can separately define trivial fields type , use that: <xs:element name="fields" type="table-field-collection" minoccurs="1" maxoccurs="1"> <!-- elsewhere: --> <x...

sql server - Relational algebra and SQL solving -

using following relations: consultant(id,name,skill) customercompany(id,name address, phone, email, webaddr,market) project(id,startdate,enddate,consultantid,customerid,days) invoice(id,date,customer,amount,status) im trying work out following scenario using sql , relational algebra find names of consultants , names of customers, consultant has worked customer, , customer received invoice in range of gbp 100k 200k using sql have: select i.amount, c.name customercompany c, invoice i.customer=c.id , >all(select c.name, con.name customercompany, con consultant i.amount between 100 , 200); relational algebra: amount = σ(invoice, amount>=100 , amount<=200) joininv= Ⓧ(amount, customer, customercompany, id) joincon Ⓧ(joiniv, consultant id, project, consultantid) Ï€ =(joincon, name, name) i wondering if write or wrong? thanks help! this trick select con.name customercompany custcomp inner join project pro on pro.customerid=custcomp.id i...

cordova - appframework/phonegap scroll is not working on android -

i'm developing phonegap application both ios , android platform. i'm using appframework intel (ex. jqmobi) , works charm in ios, works on android, thing scrolling not working in android 2.3.6 , can't figure out why. don't know if works in recent version of android on real device, it's not working there in emulator. thanks in advance suggestion... on android 2.3.5 & 2.3.6, jqm's header , footer scroll document , reposition (back top , bottom) after scrolling has stopped. happens when header , footer set data-position="fixed". it appears these versions of android have buggy css implementations of {position:fixed;} , therefore jqm's behavior appears erratic when compared other adjacent android versions.

SQL Server 2008 - Trying to edit dates - Syntax Error? -

i have database has startdate , enddate. trying run simple script find , replace dates. here script: set startdate = '2012-10-11 07:00' , enddate = '2012-10-13 20:00' startdate = '2012-10-12 07:00' , enddate = '2012-10-14 20:00' i run , receive error: incorrect syntax near '='.: set startdate => '2012-10-11 07:00' , enddate = '2012-10-13 20:00' startdate = '2012-10-12 07:00' , enddate = '2012-10-14 20:00' i have no idea why it's not running correctly, 1 of clever bod's here able point out incredibly dumb mistake! here's hoping! =0) you need separate columns update comma rather and : update yourtable set startdate = '2012-10-11 07:00', enddate = '2012-10-13 20:00' startdate = '2012-10-12 07:00' , enddate = '2012-10-14 20:00' you should use culture insensitive date format 'yyyymmdd hh:mm:ss', e.g. date 2012-10-11 0...

visual studio - Microsoft SSDT (10.3.21208.0)/Data-tier Project (MSVS 2010) and "Sharing"/Copied Certificates between the Project and Referenced Database Project -

i writing "framework" of sql server (targeting 2008r2 , 2012) stored procedures , common/reference tables. each ssdt/date-tier project represents different component (can within same database) within framework (e.g., masterdbextensions project has stored procedure extensions/add ons within master database, sqlserveragentextensions (msdb), etc). i developed farily strict security model heavily based on schema, database roles, , certificates. my issue how "share"/copied these certificates between active project , referenced projects when publish active project sql server certificates copied, etc. (btw need share/copy certificates cross-database object access not need turn trustworthy flag on, service broker, , linked server access). just clarification have tsql code represents mean: use [databasea] create certificate [mycertfroma] ... backup certificate [mycertfroma] file = 'mycertfroma.cert' use [databaseb] create certificate [mycertfroma] file =...

java - Gson Custom Serializer Not Called -

i have class doesn't serialize gson (class name , hashmap) wrote custom serializer print name , key, value pair hashmap. public jsonelement serialize(specificationgrouplist sgl, type typeoft, jsonserializationcontext context) { system.out.println("here"); jsonobject ret = new jsonobject(); ret.addproperty("groupname", sgl.getgroupname()); jsonarray jsonarray = new jsonarray(); ret.add("specificationpartlist", jsonarray); (entry<string, string> entry : sgl.getspecificationpairlist().entryset()) { jsonobject temp = new jsonobject(); temp.addproperty(entry.getkey(), entry.getvalue()); jsonarray.add(temp); } return ret; } to print appropriately, i've registered custom serializer when go print class, doesn't use serializer. can tell because have serializer printing "here" , never prints. private void printproducts() { gson gson = new gsonbuilder().setprettyprinting() .registertypeadapter(specificationg...

Convert from newer sql server to old style ansi sql without join keyword -

we migrating new database platform, polyhedra that strictly old school ansi sql without word 'join'. here trying if sql server: select a.* tbla left join tblb b on a.f1 = b.f1 b.f1 null i can't seem recreate put join in clause like: select a.* tbla a, tblb b a.f1 = b.f1 , b.f1 null obviously, doesn't return records when tblb empty. idea how done? your query doesn't require join @ all. select a.* tbla not exists (select 1 tblb b a.f1 = b.f1); i've had quick flick through polyhedra sql reference manual ( available here ), , can't see looks equivalent of *= or (+) sql-server , oracle use respectively, think might have resort left joins need columns (as far can tell polyhedra supports union): select a.f1 a, b.f1 b tbla a, tblb b a.f1 = b.f1 union select a.f1 a, null b tbla not exists (select 1 tblb b a.f1 = b.f1); example on sql fiddle (not in polyhedra) addendum since not exists not allowed, not in i...

php - how to pass variable values from a block to a node in drupal 7 -

i trying create system php-filtered block pass variable values current php filtered article (node). if put variables within article script works. if put them in block region right above article (node), don't work. not understand why variables not work since executed on same page. there must drupal doing not letting node php scripts access php variables values block. i did not want explain why doing doing because long, if think necessary. kept simple enough understand after without other details. thanks in advance help!

html parsing - Python eTree Parser isn't appending an element -

look @ log , see how says row i'm getting postgres has been turned string element (and print string, print element, print iselement boolean!) , yet when try append it, error it's not element. huff, puff. import sys htmlparser import htmlparser xml.etree import celementtree etree import xml.etree.elementtree et xml.etree.elementtree import element, subelement, tostring import psycopg2 import psycopg2.extras def main(): # connect existing database conn = psycopg2.connect(dbname="**", user="**", password="**", host="/tmp/", port="**") # open cursor perform database operations cur = conn.cursor(cursor_factory = psycopg2.extras.realdictcursor) cur.execute("select * landingpagedata;") rows = cur.fetchall() class linksparser(htmlparser): def __init__(self): htmlparser.__init__(self) self.tb = etree.treebuilder() def handle_starttag(self, tag, attributes): ...

toggle - JQuery: delay a toggleClass just when is adding -

i built code change div.mybutton when click on it. code wants allow .toggleclass() on red-text class in #bar condition .toggleclass() must delayed just when it's removing class. my code changes mybutton class mybutton2 , , adds black-text class #bar . can't second part: .removeclass() delay. here's code $(function () { $('div.mybutton').click(function () { $(this).toggleclass('mybutton2'); $('#bar').addclass("black-text"); $(this).removeclass('mybutton').addclass('mybutton2'); }); $('div.mybutton2').click(function () { $('#bar').delay(1000).queue(function (next) { $(this).removeclass("black-text"); next(); }); }); }); and here's jsfiddle demo http://jsfiddle.net/jmarti/gc5xt/2/

jquery - Javascript add 2nd array values together if first values are the same -

sorry if title isn't clear. kind of hard explain me, i'm not when comes multiple arrays. i have array: [ [21, 1000], [21, 500], [18, 100], [18, 200] ] now want resulting array: [ [21, 1500], [18, 300] ] how go doing this? i've tried using 21 , 18 array keys , way couldn't use array in for loop .length counting. ended total of 4 arrays working. edit: i want avoid using 21 , 18 values array keys. i want able iterate on resulting array/object, , use 21 , 18 "keys" well, make further changes page. thanks responses! you don't need jquery result array asked for: var 1 = [21, 18]; var 2 = [ [21, 1000], [21, 500], [18, 100], [18, 200] ]; var results = []; for(var in one) { results[i] = 0; for(var x in two) if(two[x][0] === one[i]) results[i] = results[i] + two[x][1]; results[i] = [one[i], results[i]]; } fiddle here

How do I get the haxe command back after installing Haxe 3 -

i installed haxe 3 on os x using manual install method on following page http://haxe.org/manual/haxe3#manual_installation manual installation cp haxe /usr/bin/haxe rm -rf /usr/lib/haxe mkdir /usr/lib/haxe cp -r std /usr/lib/haxe mkdir /usr/lib/haxe/lib chmod 777 /usr/lib/haxe/lib cp std/tools/haxelib/haxelib.sh /usr/bin/haxelib chmod +x /usr/bin/haxelib after doing if in new terminal window don't >haxe command. command not found. i figured out needed run first cp command sudo in front of , well. $> sudo cp haxe /usr/bin/haxe

jquery - JavaScript function problems -

i can't display alert fed function argument. have compared examples , can't see problem causing not work. have included html , javascript below, in i'm going wrong gratefully received. a html: <!doctype html> <html> <head> <meta charset="utf-8"> <title>untitled document</title> <script src="http://code.jquery.com/jquery.js"></script> <script src="testjs.js"></script> </head> <body> <div id = "testbed"> <a id = "testlink" href = "#number1">test click</a> </div> </body> </html> javascript: $(document).ready(function() { $.fn.newmodalcontrols = function(modelspec) { alert(modelspec); } // end newmodalcontrols $('#testlink').click(function() { $(this).parent().newmodelcontrols('number1'); }); // end testlink click function }); // end ready you have typo. change n...

javascript - Trying to make jquery work -

i having hard time getting jquery code work. i've tried examples , none work me. here example sort of works in chrome c drive, not dropbox on web, nor work @ in ie9. when 'sort of' working on chrome c drive, starts out displaying tabs instead of tab supposed to. after clicking 1 of links shows corresponding tab. my end goal modify website whole page doesn't flash while reloading every time click on menu item. <!-- found at: http://jsfiddle.net/ufgts/ --> <script type='text/javascript' src="http://code.jquery.com/jquery-1.9.1.min.js"></script> <script type='text/javascript'> $(window).on('hashchange', function() { $('div.tab').hide(); $(location.hash).show(); }); $('a.hash').on('click', function(e){ e.preventdefault(); location.hash = $(this).data('hash'); }); </script> <a href="#a" data-hash="a" class="hash">a...

C compare string literal with function returning char pointer -

why code: strcmp(myfunction(0), "ok"); where myfunction defined this: char *myfunction(int p) { if (p == 0) { return("ok"); } } give following error: warning: passing argument 1 of 'strcmp' makes pointer integer without cast do have prototype above call? function should either prototyped or defined before used. otherwise compiler assume has default return type of int . // prototype char *myfunction(int p); int main() { // use strcmp(myfunction(0), "ok"); } // definition char *myfunction(int p) { ... }

java - You will not be able to access files from your working directory on the production server -

when running gae app with: $ mvn appengine:devserver somewhere down line shows error: you not able access files working directory on production server. what mean, , how rid of it. it's hard give definitive answer because don't provide context, , because it's been while haven't used gae, here's guess. it means on real appengine, on google's machines, won't able access files in working directory (and won't able write file @ all), because forbidden in environment. and guess shows error because on development server, you're executing code accessing current directory. warns code, although working fine on development server, won't work on real app engine. to rid of warning, find code doing that, , modify it. read https://developers.google.com/appengine/docs/java/runtime#the_sandbox more details.

android - If one button press does something, other buttons pressed should do something else -

i have 5 buttons in activity. code should work follows : 1 (correct) button pressed should something. other 4 pressed, else should done... don't want used 5 onclicklistener if(button1 press) { } else if (button2 or button3 or button4 or button5 press) { else } why don't way: final button button1 = (button) findviewbyid(r.id.button1); final button button2 = (button) findviewbyid(r.id.button2); final button button3 = (button) findviewbyid(r.id.button3); final button button4 = (button) findviewbyid(r.id.button4); final button button5 = (button) findviewbyid(r.id.button5); onclicklistener listener = new onclicklistener() { @override public void onclick(view v) { if (v.equals(button1)) { // } else { // else } } }; button1.setonclicklistener(listener); button2.setonclicklistener(listener); button3.setonclicklistener(listener); button4.setonclicklistener(listener); button5.setonclicklistener(liste...

date conversion formula in excel -

i have dated in format "09-may-13 06.42.46.097127000 pm" , need convert format "2013-05-09t18:42:47.132z". goal find out happend earlier. not sure how format these dates. 2013-05-09t18:42:47.132z 09-may-13 06.42.46.097127000 pm 2013-05-08t20:56:55.821z 06-may-13 03.22.09.129443000 pm 2013-05-08t20:51:45.287z 06-may-13 03.03.22.975700000 pm 2013-05-08t20:55:34.719z 06-may-13 10.40.55.924181000 pm how can that?? i posted answer converted 1 of formats other. see need compare them, can convert format in a2 date/number values .... 09-may-13 06.42.46.097127000 pm .....with formula =substitute(substitute(a2,".",":",1),".",":",1)+0 and format in a3 2013-05-09t18:42:46.097z ....with formula =substitute(substitute(a3,"t"," "),"z","")+0 you can format results how like, leave numbers or format m/d/yyyy hh:mm:ss.000 or similar. can compare formula =b2...

php - making an array from database -

i'm going crazy issue, want array separated commas(string) example:(1,2,4,6) database , insert variable inside query like(select table id in($variable string). can me this? example: <?php //connect $sql = "select id users id=1"; //get results array insert variable inside query select table id in($variable); // ?> i tried multiple ways , have different issues. please need answer! implode() transforms array string of values separated char choose: $arr = array(1,2,3,4,5,6,7,8,9); // make array $list = implode(',',$arr); $sql = "select * table id in($list)";

javascript - Instagram : Liking a photo on an external site -

so i'm trying understand instagram api , i'm bit lost. i have site displaying 1 image instagram , have button. from can gather need client id , can send post request via ajax photo on instagram. first need authenticate user first? i'm stumped. there tutorial can walk me through this? when user clicks on pops window authenticate them , likes photo. i suggest reading instagram api documentation , take @ instagram javascript sdk have on github: https://github.com/instagram/instagram-javascript-sdk alternatively, there instagram js sdk use, written bryantchan - https://github.com/bryantchan/instagram-js-sdk an example bryan's sdk on authentication below: var ig = new instagram(); var param = { client_id : your_client_id, redirect_uri : your_redirect_uri, scope : your_scope, response_type: 'token' } ig.auth( param ); //then go authorize page //handle fn token var token = ig.gettoken(); //you need set token before ...

oop - Packet serialization in C++ -

i have project packet serialization of several different types( packet1 , packet2 ...). extend packetheader class , own serialization this approach seems messy , error-prone, number of fields grows. is there cleaner , more oop & c++ way serialization(without 3rd-party library)? class packetheader { uint8_t type; uint32_t id; uint32_t seqnum; virtual void serialize(uint8_t *buf, size_t size) { int offset = 0; packetheader n; n.type = type; n.id = htonl(id); n.seqnum = htonl(seqnum); memcpy(buf + offset, &(n.type), sizeof(n.type)); offset += sizeof(n.type); memcpy(buf + offset, &(n.id), sizeof(n.id)); offset += sizeof(n.id); memcpy(buf + offset, &n.seqnum, sizeof(n.seqnum)); offset += sizeof(n.seqnum); } } class packet1 : public packetheader { uint32_t payload; virtual void serialize(uint8_t *buf, size_t size) { int offset = packetheade...

jquery - AJAX + Codeigniter live page load with function -

updated: works 100%. these segements of code allowed user click delete button on view, sends ajax request controller interact (delete record) database. feed result of occured in callback function update current view (without page load) record deleted , hide element. view: <?php // output records if($result) { foreach ($result $rows => $row) { echo "<tr id=\"row" . $row['id'] . "\">"; echo "<td>" . $row['id'] . " - " . $row['name'] . "</td>"; echo "<td>" . $row['logo_path'] . "</td>"; echo "<td>" . $row['date_created'] . "</td>"; echo "<td>" . "<a href=\"#\" id=\"" . $row['id'] . "\" class=\"delete\">delete</a><br>" . "</td>...

c++ - Passing argument from heap to function -

here question. have pointer allocated memory class: class *pclass = new class(); now want pass object function, wich use object copy , not modify it. question how correctly pass object? void somefunc (const class &_class); { class *pclassinfunc = new class (_class); ... } ... somefunc (*pclass) or void somefunc (const class *_class); { class *pclassinfunc = new class (*_class); ... } ... somefunc (pclass) or void somefunc (class _class); { // use _class since it's copy ... } ... somefunc (*pclass) i've choosed first way, looks strange me, smth tells me it's not correct. second 1 looks more c-style (or not?). , last 1 creates copy in stack, not desireable. so, best solution? thank answers. edit: saw, forgot * before pclassinfunc. corrected, sorry. i vote last approach. design function doesn't care how calling code allocated object. if wants copy, take object value. makes intentions clearer user. it allows calle...

facebook - how can i get a pop up message and redirect to url in php? -

i have looked no answer seems suit needs. once user completes series of forms, need message thanks, confirm update , redirect main page. code: <?php require './facebook.php'; $facebook = new facebook(array( 'appid' => ' *************', 'secret' => '********************', 'cookie' => true, )); $status2 = $_post['status2']; $uid = $facebook->getuser(); $args = array( 'message' => $_post['status2'], 'link' => 'http://apps.facebook.com/geordie-status/', 'caption' => 'translate english geordie' ); if(isset($_post['post'])) $post_id = $facebook->api("/$uid/feed", "post", $args); $msg = "thanks translating status, has been posted wall."; header("location: http://apps.facebook.com/geordie-status/"); ?> when button clicked, update posted, there no message ...

ios - Parse Facebook Login App Must Ask For Basic Read Permission -

Image
i building parse driven ios application , having strange issues facebook login. upon initializing facebook permissions, asking @"email" , nothing else. login works when user not have facebook ios application installed on device - , authenticates through safari (or web browser). when user have facebook ios application installed , tries grant permission app, following error displayed: i have read through multiple tutorials , related stack overflow issues, , have yet figure 1 out. tested out both older version of facebook sdk , brand new 1 (3.5). neither of solutions appears work. have ideas? thank kindly. try both @"email" , @"basic_info". documented on android side, not ios, weird - https://developers.facebook.com/docs/howtos/androidsdk/3.0/native-login/

java - Synchronized method seems interrupted -

i'm writing applet multiple threads. i've had strange problems i've tracked them down class below. it's entire code, no snips. public class boundingbox { private volatile int top; private volatile int left; private volatile int bottom; private volatile int right; public static final int ignore = 0; public static final int top = -2; public static final int left = -1; public static final int bottom = 2; public static final int right = 1; boundingbox(int left, int top, int width, int height) { this.top = top; this.left = left; this.right = left + width; this.bottom = top + height; } public synchronized int top() { return top; } public synchronized int left() { return left; } public synchronized int bottom() { return bottom; } public synchronized int right() { return right; } public synchronized int width() ...

python - Setting up idle thread/signalling thread -

i'm using python wxpython writing app. the method i'm considering accomplish may not best - if that's case, let me know because i'm open refactoring. right now, have 1 gui form. main program start point instantiates instance of gui form runs wx.mainloop(), causes app's main initial thread block lifetime of app. we of course know when events happen in ui, ui thread runs code them. now, have thread - worker thread. thread needs sit idle, , when happens in ui thread, e.g. button clicked, want worker thread stop idling , else - run function, say. i can't envision right see app gets more complex having signal worker thread while it's busy doing something. i have 2 questions setup: how can make worker thread idle without using cpu time? doing while true: pass suck cpu time, while while true: time.sleep(0.1) not allow instantaneous reaction events. what's best way signal worker thread something? don't want ui thread execute something, ...

web - SolrCore shuts down, throws NullPointerException -

i configuring solr first time. google has yielded little insight. see questions postesd similar issue, not same. i have solrcore called collection1 in ~/solr-home/solr. have verified configuration read solr when starts up. here declaration core in ~solr-home/solr/solr.xml: <cores adminpath="/admin/cores" defaultcorename="collection1" host="${host:}" hostport="${jetty.port:}" hostcontext="${hostcontext:}" zkclienttimeout="${zkclienttimeout:15000}"> <core name="collection1" instancedir="collection1" /> solr running on ubuntu. attempting inmport microsoft sql server running on windows, don't far making jdbc connection. here data import declaration: <requesthandler name="/dataimport" class="org.apache.solr.handler.dataimport.dataimporhandler"> <lst name="defaults"> <str name="config">data-config.xml</str...

.net - Stream to Byte array conversion in Oxygene -

i'm trying find way out legacy delphi prism application. have never worked on delphi prism before. how convert stream type byte array type? please detailed code appreciated have no knowledge of delphi prism. basically want upload image using wcf service , want pass image data byte array. thanks. option 1) if using memorystream can use memorystream.toarray method directly. option 2) if using .net 4, copy content of source stream using copyto method memorystream , call memorystream.toarray function. like so method tmyclass.streamtobytearr(astream: stream): array of byte; begin using lstream: memorystream := new memorystream() begin astream.copyto(lstream); exit(lstream.toarray()); end end; option 3) using old verison of .net, can write custom function extract data source stream , fill memorystream method tmyclass.streamtobytearr(astream: stream): array of byte; var lbuffer: array of system.byte; rbytes: system.int32:=0; ...

php - something wrong with replace string? -

ok can me this: <?php $remove = $_get['hwid']; str_replace($_get['hwid']."<br />","",$str); ?> it doesnt delete text... i know dont have set html file have thats because don't know how string... let's have retrieved text (whether html or other form): $str="the html file: test test1 test2 test3"; this function remove "test2" string: $newstr=str_replace("test2","",$str); for more information of function take @ here just 1 more thing, if have <br> after each line in example, need same too.

Powershell Regex to replace XML tag values -

i'm trying parse following xml file using powershell without loading xml document using [xml] since document contain errors. <data> <company>walter & cooper</company> <contact_name>patrick o'brian</contact_name> </data> to load document need fix errors replacing special characters follows & &amp; < &lt; ' &apos; etc.. i know find , replace characters in document (get-content $filename) | foreach-object { $_-replace '&', '&amp;' ` -replace "'", "&apos;" ` -replace '"', '&quot;'} | set-content $filename but replace characters everywhere in file, i'm interest in checking characters inside xml tags <company> , replacing them xml safe entities resultant text valid document can load using [xml]. something should work each character need replace: $_-replace '(?<=\w)(&)(?=.*<\/.*>)...