Posts

Showing posts from January, 2014

.net - Attributes in external assembly -

i using sqlite-net . uses attribute [ignore] skip field during serialization. i have class property: [ignore] public observablecollection<myentity> myentities { get; set; } it works fine when create table: _connection.createtableacync<myclass>().wait(); now move class external assembly (project) , have error when sqlite-net trying create table. error messages said there unknown type observablecollection. looks [ignore] attribute doesn't work if class in external assembly (project). i trying debug sqlite-net code. here the fragment : var ignore = p.getcustomattributes (typeof(ignoreattribute), true).count() > 0; if (p.canwrite && !ignore) { cols.add (new column (p, createflags)); } i have ignore == false field [ignore] attribute. i newbie in .net not sure in case. are attributes working classes in external assemblies (project)? if are, error in sqlite-net ?

excel - Sorting multiple sheets - code clean up -

looking guidance on sorting columns across multiple sheets. i have 2 data sets (tab1: abc , tab2: xyz). i'm trying sort both sheets (range column column j) column in descending order. this have far... recorded. clean code , better ways approach sorting columns. help/tips appreciated. sub sortingcolumns() application.goto reference:="abc!a1" activeworkbook.worksheets("abc").sort.sortfields.clear activeworkbook.worksheets("abc").sort.sortfields.add key:=range("a1"), _ sorton:=xlsortonvalues, order:=xldescending, dataoption:= _ xlsorttextasnumbers activeworkbook.worksheets("abc").sort .setrange range("a2:k187") .header = xlno .matchcase = false .orientation = xltoptobottom .sortmethod = xlpinyin .apply end application.goto reference:="xyz!rc" activeworkbook.worksheets("xyz").sort.sortfields.clear activeworkbook.worksheets("xyz").sort.sortfields.add

sql server - getting error on pivot for syntax when converting rows as column -

i using sql server , wants table rows columns when convert query give me error on keyword incorrect syntax near '1'. query select strvalue,1,2 (select strvalue,nsectionattributeid, (row_number() on (partition nsectionattributeid order nsectionattributeid ) ) colum tblattributedata )temp pivot ( max(nsectionattributeid) colum in (1,2) )piv select strvalue,1,2 (select strvalue,nsectionattributeid, (row_number() on (partition nsectionattributeid order nsectionattributeid ) ) colum tblattributedata )temp pivot ( max(nsectionattributeid) colum in ([1],[2]) )piv

r - Allocating id/factor/categories based on a group of values for each factor -

i have large data table following: id var1 var2 1 1 2 2 d 3 6 d 4 4 b 5 6 d 6 8 i need assign category in var2 based on values in var1 . categories not follow order respect var1 values included in each category. instance: lista <- c(1,5,7) listb <- c(4,9) listd <- c(2,6) i have tried 2 approaches unsuccessfully. using which function: which: dt[which(var1 %in% lista), var2 := "a"] , on listb , listd . it didn't work function approach (which may slow large data table have many elseif clauses). wrote: matchfun <- function(value){ if (var1 %in% lista){ value <- as.character(a)} else { return(value)}} any idea or comment on how allocate factor/categories group of values welcome. i'd suggest merge here. let dt original data table. dt <- data.table(id=1:6,var1=c(1,2,6,4,6,8)) first, need store mapping in table: matchdt <- rbindlist(list( data.table(var1=lista,var2="a&quo

jquery - How to force user to input value in javascript prompt? -

i have jquery code, open prompt box. problem whether user inputs value in or not, still proceeds code if user click ok. there anyway force user input value in, click ok else can not click ok button. here tried did not work. $(function() { $(".adminapprovepost").click(function(){ var id = $(this).attr("id"); var tag = prompt("you must enter 1 keyword approve post"); if(tag!=null) { $.ajax({ type: "post", url: "/admin/admin-approve-post.php", data: {id:id,tag:tag}, success: function(){ } }); $(this).parents(".postrecord").animate({ backgroundcolor: "#fbc7c7" }, "fast") .animate({ opacity: "hide" }, "slow"); } return false; }); }); it should work this: $(function() { $(".adminapprovepost").click(function(){ var id = $(this).attr("id"); var proceed = true; while(proceed) { tag = prompt("you m

ios - Setting an image after retreaving the result of a post request takes 17s -

i making post request server returns string, says if user exist or not nickname, post notification works flawless , prints out returned result in under 1s inside completion handler, takes additional 17 20 set image based on returned result... here code using: - (void)textfielddidbeginediting:(uitextfield *)textfield{ // each textfield selected checkl previous text field formating if (textfield == registeremailaddresstextfield) { //check if nickname @ least 6 charactes if (registernicknametextfield.text.length < 6) { nslog(@"emial text field"); [registernicknamecheckmarklabel setimage:[uiimage imagenamed:@"wrong_checkmark.png"]]; }else{ nslog(@"checking nickname"); //check if nickname exists or not nsurl *url = [nsurl urlwithstring:@"myurl"]; //create session custom configuration nsurlsessionconfiguration *sessi

javascript - Combining react and jade -

i working on isomorphic javascript app express + react. started out using jade server side templates static content, combining 2 becoming unwieldy. have ended this: in express routes: router.get("/", function(req, res) { var webpackstats = require('../../config/webpack-stats.json'); var reacthtml = react.rendertostring(hiwapp({})); var slideshowhtml = react.rendertostring(slideshowapp({})); var config = { webpackstats: webpackstats, reactoutput: reacthtml, slideshowhtml: slideshowhtml }; res.render("how_it_works/howitworks", config); }); in jade: body .company-logo.center #react-main-mount != reactoutput include ./content_block_1.jade include ./content_block_2.jade #slideshow-main-mount != slideshowhtml this brittle-if want jsx jade template more jsx, have make sure order right. my idea all jsx. know there react.rendertostaticmarkup sort of thing, doesn't solve problem of mixing dynamic static

php - Check if object contains an property matching a string -

stdclass object ( [id] => 11 [type] => 5 [color_a] => 57 [color_b] => 3 [date] => 2 ) how check if object has attributes contain string "color" ? i tried array_diff_key , array_filter cannot use array_filter_use_key because runs on php 5.4. no loops if possible :) this should work you: (here cast object array , search preg_grep() in array_keys() . flip array array_flip() ) $result = array_flip(preg_grep("/\bcolor/", array_keys((array)$o))); print_r($result); output: array ( [color_a] => 2 [color_b] => 3 ) and if want use check true or false in_array() don't need flip , can use this: if(preg_grep("/\bcolor/", array_keys((array)$o))) echo "match";

c - Why can't we assign int* x=12 or int* x= "12" when we can assign char* x= "hello"? -

what correct way use int* x ? mention related link if possible unable find one. a string literal creates array object . object has static storage duration (meaning exists entire execution of program), , initialized characters in string literal. the value of string literal value of array. in contexts, there implicit conversion char[n] char* , pointer initial (0th) element of array. this: char *s = "hello"; initializes s point initial 'h' in implicitly created array object. pointer can point object ; not point value . (incidentally, should const char *s , don't accidentally attempt modify string.) string literals special case. integer literal not create object; merely yields value. this: int *ptr = 42; // invalid is invalid, because there no implicit conversion of 42 int* int . this: int *ptr = &42; // invalid is invalid, because & (address-of) operator can applied object (an "lvalue"), , there no object apply to

sql server 2008 - SQL generating multiple count columns -

i have developed sql generate statistics on our local tickets database table (sql server 2008). can see code, want select tickets, joining group group name, grouping group code year/month. i want create totals (counts) how many tickets open, closed, closed outside of sla (past due date), , sla%. this code works, i'm not happy having code nested (select counts); seems not strategy multiple re-scans. is there better design generating multiple "counts" columns single select on table ... or standard approach? select g.group_name [group], year(tm.date_open) year, month(tm.date_open) month, count(*) [tickets opened], (select count(*) tickets tm2 tm2.group_code = tm.group_code , year(tm2.completion_date) = year(tm.date_open) , month(tm2.completion_date) = month(tm.date_open) ) [tickets closed], (select count(*) tickets tm2 tm2.group_code = tm.group_code

css - Why random margins between HTML Div tags -

Image
i trying fill data in div tag using angularjs loop. <div> <div class='box' ng-repeat="product in products | filter:{'scid': scid.tostring()}:true | orderby:'pname'"> <br> <b>{{product.bname}} </b> <br>{{ product.pname }} <br> <img src="http://localhost/{{ product.image_path }}" alt="" border=3 height=75 width=75></img> </div> </div> this css class. .box { margin : 5px; display : inline-block; width: 150px; height: 250px; background-color: grey; text-align:center; } but not rendering properly. (some random margin top , bottom) can doing wrong?? add vertical-align: top; to css

html - How can I reference a specific DIV tag INSIDE an XML tag with jquery? -

title says basically. i using ebay trading api , trying extract text message sent user. api unhelpfully returns ton of html actual user message inside div id userinputtedtext . i trying data out using jquery - raw xml response in format: <xmlresponse> <messages> <message> <text> "<!doctype html public ...>\n\n\n<html ...>\n\n <div id="userinputtedtext"> ****message user **** so have been trying use variation of... $xml = $.parsexml( xmlresponse ) $xml.find("message").find('text').find('userinputtedtext').html() ...but nothing seems work. i should perhaps note can text node , data out in more complicated multi-step process feel there must simpler way. in fact notice node seems have html wrapped in " , interspersed bunch of \n line breaks seems weird me. can shed light on why is? you need

css - Responsive Site Blank Print Preview -

i've tried know our responsive site http://www.usalight.com print. i've tried adding @media queries our stylesheets below: @media print { * { text-shadow: none !important; color: #000 !important; background: transparent !important; box-shadow: none !important; } } i've tried adding separate print.css stylesheet linked in our header below: <link rel="stylesheet" type="text/css" href="/css/print.css" media="print"> i've added media="print,screen" our stylesheets no avail. don't why can't show in print preview. ideas? it seems have fact page inside .navbar-default div. adding ending div tag before #main-body id allows of page print.

python - access a file with a specific link in django -

in django, have file foo.txt in static folder, can accessed through www.example.com/static/foo.txt. how possible access file simple doing www.example.com/foo.txt? (without redirections) thanks in advance! i think selcuk right, save file on server directories, or static files, simple point url there <a href="/static/files/foo.txt">foo text file</a> watch file permissions though

How Can I get the last inserted sequence value for respective to a web session in JSP and Oracle? -

first of beg request you, please not treat duplicate. have seen threads issue none of type. developing online registration system using jboss 6 , oracle 11g. want give every registrant unique form number sequentially. this, think oracle's sequence_name.nextval primary key field best inserting unique yet sequential number , retrieving same use sequence_name.currval . till hope, it's ok. ensure parity if 2 or more concurrent users submits web form simultaneously? (i mean there overlap of interchange of value among concurrent users?) more precisely, session dependent? let me give 2 hypothetical situations matter becomes clearer. say there 2 users, user1 , user2 trying register @ same time sitting @ newyork , paris respectively. max(form_no) 100 before click submit button. now, in code have written insert member(....) values(seq_form_no.nextval,....). now since 2 users invoke same query sitting @ 2 different terminals own sequential id or user1 user2's o

templates - Is this code from old Alexandrescu's C++ book valid? -

i reading old alexandrescu's book c++ templates , came across following code snippet explained abstractfactory pattern implementation (chapter 9.3). here is: template <class, class, class> class genlinearhierachy; template <class, class> class opnewfactoryunit; template <class> class reverse; //definitions template < class abstractfact, template <class, class> class creator = opnewfactoryunit class tlist = typename abstractfact::productlist > class concretefactory : public genlinearhierarchy< typename tl::reverse<tlist>::result, creator, abstractfact> //here. { public: typedef typename abstractfact::productlist productlist; typedef tlist concreteproductlist; }; i don't why code valid. didn't defined tl anywhere in snippet. no, code you've posted not correct. there's few typos aren't relevant i'll mention them. may in book or maybe made when posted this. don't have book ca

sql - Submit Date After 7 -

i have table in there 2 columns date status create table status ( date nvarchar(20), status bit ) now want select records status = false , date after 7 days of submit, if today have insert 2 records false status want query show record after 7 day on 8-04-2015 records of 1-04-2015 status false should show. if understand question; please tell do. as @gvee stated in comment above, should store dates either date or datetime field. allow query so: select [date], [status] <yourtable> [date] <= dateadd(d, -7, getdate()) , [status] = 0 this give results false status 7 days or older. alternatively, where clause this: where datediff(d, [date], getdate()) >= 7 , [status] = 0 if absolutely must keep column nvarchar data type, date format provided, can convert datetime so: convert(datetime, [date], 105) so where clause this: where datediff(d, convert(datetime, [date], 105), getdate()) >= 7 , [status] = 0

How to assign an object property value to a variable in Java? -

the following code i'm having issues understanding: public class rectangle { public rectangle() { double width = 1; double height = 1; } public rectangle(double w, double h) { double width = w; double height = h; } public double getarea(double w, double h) { return (w*h); } public double getperimeter(double w, double h) { return ((2*w)+(2*h)); } public static void main(string[] args) { rectangle oldrectangle = new rectangle(4, 40); rectangle newrectangle = new rectangle(3.5, 35.9); double height1 = oldrectangle.height; double height2 = newrectangle.height; double width1 = oldrectangle.width; double width2 = newrectangle.width; system.out.println("width of rectangle 1 is: " + 4); system.out.println("height of rectangle 1 is: " + 40); system.out.println("area of rectangle 1 is: " + oldrect

c# - How to get Notification when "switch User" happen in window7 -

i building window application in c# notify me when switch user happen. right m using "sessionswitch" event notification. private void startlisning() { microsoft.win32.systemevents.sessionswitch +=new microsoft.win32.sessionswitcheventhandler(systemevents_sessionswitch); this.eventhandlercreated = true; } private void systemevents_sessionswitch(object sender, eventargs e) { system.io.file.appendalltext(path.combine(environment.getfolderpath(environment.specialfolder.applicationdata), "testtest.txt"), "switchuser\t" + datetime.now.tostring() + environment.newline); } but in case sending notification when "unlock" happen . don't want. need when user switch user in system application should notification , log log file. should log when lock or switchuser happen. thanks in advance. private void form1_load(object sender, eventargs e) { startlisning(); } private bool eventhandlercr

calling method from another activity android -

i have methods in class, mainactivity, want move class clean bit. when call method mainactivity works perfectly. when call other class, mainactivity2, java.lang.nullpointerexception here how calling mainactivity: mainactivity2 ma = new mainactivity2(); ma.onlongclick(); my mainactivity2 extends mainactivity sorry stupid questions, confused why having problem thought knew how call methods other classes... this works me: mainactivity2 doesn't extend mainactivity i use following code: new mainactivity2().onlongclick(); try , tell if works ;)

Execute multiple exchange online cmdlets using C# , ASP.NET with only 1 runspace -

i working on asp.net webapplication can connect exchange online , run commandlets. the following working codebehind single button, gets list of mailboxes in asp.net protected void finalconnection_click(object sender, eventargs e) { string username = ""; string password = ""; securestring securestring = new securestring(); foreach (char pass in password) { securestring.appendchar(pass); } pscredential pscred = new pscredential(username,securestring); wsmanconnectioninfo connectioninfo = new wsmanconnectioninfo(new uri("https://ps.outlook.com/powershell"), "http://schemas.microsoft.com/powershell/microsoft.exchange", pscred); connectioninfo.authenticationmechanism = authenticationmechanism.basic; connectioninfo.maximumconnectionredirectioncount = 2; using (runspace runspace = runspacefactory.createrunspace(connectioninfo)) {

how to show 2 decimal places regardless of the number of digits after decimal in swift? -

i writing app in swift , have used below code . output rounded 2 decimal places expected. this working well. if result less 2 decimal places shows 1 digit. basic example have results either whole number or 10 decimal places. want them show .xx 1.2345 => 1.23 1.1 => 1.1 how results display 2 decimal places regardless of number of digits after decimal point ? e.g: 1.1 => 1.10 i have searched extensively answer eludes me. code have tried far : @iboutlet var odds: uitextfield! @iboutlet var oddslabel: uilabel! var enteredodds = nsstring(string: odds.text).doublevalue var numberofplaces = 2.0 var multiplier = pow(10.0, numberofplaces) var enteredoddsrounded = round(enteredodds * multiplier) / multiplier oddslabel.text = "\(enteredoddsrounded)" println("\(enteredoddsrounded)") thanks comments. have amended follows: @iboutlet var odds: uitextfield! @iboutlet var oddslabel: uilabel! var enteredodds = nsstring(string: odds.text).do

regex - Replacing just the match of regular expression in Eclipse find and replace -

Image
so have ton of files need changed. this string example=/abc/def/pattern/ghi and want change pattern else, let's fix what is: string example=/abc/def/fix/ghi what i'm getting is: fix (the whole line gets changed, want match changed) this regular expression i'm using, trying avoid commented lines ^(?!\s*(//|\*)).*/pattern/ you may wrap part of pattern need keep after replacement capturing parentheses , use backreference in replacement string: search for : ^(?!\s*(?://|\*))(.*/)pattern/ replace :    $1fix/ now, pattern matches: ^ - start of line (?!\s*(?://|\*)) - if not followed 0+ whitespaces , // or * (note non-capturing grop (?:...) used simplify backreference usage) (.*/) - group 1 capturing 0+ chars other linebreak symbols last / pattern/ - literal substring pattern/ . in replacement pattern, $1 re-inserts whole line start / before pattern/ , , fix/ literal replacement part.

c# - ReactiveUI - Views not rendering properly (or in full) -

i'm in process of starting new project, using reactiveui , mahapps.metro . first hurdle i've hit problem of views not showing in entirety. have window , , in window have viewmodelviewhost rxui library. simple container nested view-model. activeitem binding binded view-model of user control, , button user control visible on screen. what expect see window dark gray background , button in middle. see window default background , button in middle. not right. if remove button, see nothing on window , default background. it seems viewmodelviewhost showing actual contents of usercontrol , disregarding isn't considered real control, such grids etc. has come across behaviour before? <mah:metrowindow x:class="...mainwindow" xmlns:mah="clr-namespace:mahapps.metro.controls;assembly=mahapps.metro" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://sc

java - Requiring user to enter only 1 char for a letter grade for a gpa program -

i trying finish java assignment , stuck on last bit. need make when user enters letter grade in order calculate g.p.a. can enter 1 letter. for example, need receive error if enter aaa instead of a . i stuck on how go doing this. works except 1 thing. new java great. here class: public class gpa { private int sumcredits; private int sumpoints; public int getpointsforgrade(char letter) { int gradepoints; switch (letter) { case 'a': case 'a': gradepoints = 4; break; case 'b': case 'b': gradepoints = 3; break; case 'c': case 'c': gradepoints = 2; break; case 'd': case 'd': gradepoints = 1; break; case 'f': case 'f': gradepoints = 0; break; default: gradepoints = -1; break; } return gradepoints; } public void constructor(){ sumcredits = 0; sumpoints

c++ - Sending more than one character from Qt to Arduino -

first of all: sorry i'm not english. i'm making serial communication between qt (c++) , arduino. first tried send 1 character ('1') arduino turn led on , worked. want send more 1 character. how can send more characters each character variable in arduino code? this qt code 1 character: void mainwindow::on_pushbutton_clicked() { serial.setportname("com17"); serial.setbaudrate(qserialport::baud9600); serial.setdatabits(qserialport::data8); serial.setparity(qserialport::noparity); serial.setstopbits(qserialport::onestop); serial.setflowcontrol(qserialport::noflowcontrol); serial.open(qiodevice::readwrite); serial.write("'0'"); } i suppose using qserialport class qt. as can see documentation ( http://doc.qt.io/qt-5/qserialport-members.html ), have 3 functions overloading write(...), super class write(const char *, qint64) : qint64 write(const char *) : qint64 write(const qbytearray &) :

what is the difference between the using of viewData dictionary and viewData.Model in asp.net mvc -

i need help. please explain me difference between using of viewdata dictionary , viewdata.model in asp.net mvc. for example can write viewdata["list"] = list; and can write viewdata.model = list; so difference between them , when use each one; explanation example appreciated. viewdata.model way pass model object controller's action view. can use method ensure view's model strongly-typed, , can reference object using "@model" within view. @model.someproperty alternatively (and preferably), pass model object action view using "return view(t);" t = object. return view(myobject); lastly, using viewdata.["somename"] = someobject would loosely-typed object, , couldn't reference object using @model view. instead, you'd have cast viewdata model-type within view able reference it. example: // in action: viewdata["obj"] = someobject; // in view: var objdata = viewdata["obj"] m

Android AsyncTask called "multiple" times -

i'm new android programming. have main activity gets data db through service handler (url). want insert data well, on different activity, , want main activity date each time been called (onresume(),onrestart()). i've found on android api reference asynctask: the task can executed once (an exception thrown if second execution attempted.) mean cannot call asynctask whenever activity resumes, or cannot have multiple "instances" of asynctask running @ same time? it literally means, while asynctask running, cannot launch again. in mainactivity.class have line: task.execute(); if task either finished or not , call method again exception thrown. and put method in onresume () practice. 1 thing notice is: if put in onrestart () remember, callback works when change configuration, not called if create activity . the doc lifecycle of activity .

data binding - SAPUI5 / OpenUI5 Databinding for Custom Controls -

i'm working sapui5 , openui5. i'ved developed custom controls never used 2-way databinding controls...i've tried omycontrol.bindproperty("somevalue", "omodel>/testbindingvalue") what i've seen is: when watching model in debugger field abindings have 1 entry: spath: "/testbindingvalue" sinternaltype: "int" and correct sinternaltype of controls property type (in case "int"). but when i'm watching array omodel.odata empty , omodel.getproperty("/testbindingvalue") returning undefined...but control has value "somevalue"...so, have idea? thanks, alex update: here see workflow: first creating model: var omodel = new sap.ui.model.json.jsonmodel(); sap.ui.getcore().setmodel(omodel, 'omodel'); then initializing control: var omycontrol = new mycontrol({ somevalue: "test value of control" }); omycontrol.bindproperty("somevalue", "o

java - How to start file browser app from Android application? -

i have app started "share via" menu , list of selected files input. now, let user able run file browsing app app , results. i know example can start phonebook , obtain choosen contact(s) following code: intent intent = new intent(intent.action_pick, contactscontract.contacts.content_uri); startactivityforresult(intent, pick_contact); so question is: there similar way run file browser , in return list of files selected? edit: "possible duplicated post" partially similar, ask how start file manager inside specific path, , way hasn't accepted answer. need, if possible, start file manager (if there one) specific path , in return selected files. thank much cristiano ok, found answer here on , combining davidjohns comment i've got need. thank cristiano

java - Sequence number using thread Synchronization -

i want print series of 1 100 number using n number of threads (lets take 10 threads this). condition 1st thread have sequence number 1, 11,21....91, 2nd thread have sequence 2,12,22.....92 , on. other threads have sequence number that. want print number in sequence 1 100. know can use synchronization, wait , notify method , using variable or flag counter don't think idea use it. want use without concurrency (like executors etc) how that. please suggest. public class printnumbersequenceusingrunnable { int notifyvalue = 1; public static void main(string[] args) { printnumbersequenceusingrunnable sequence = new printnumbersequenceusingrunnable(); thread f = new thread(new first(sequence), "fisrt"); thread s = new thread(new second(sequence), "second"); thread t = new thread(new third(sequence), "third"); f.start(); s.start(); t.start(); } } class first implements runnable { pr

c++ - Storing intermediate results in a class's attribute -

assume have class containing 3 methods , attribute. class supposed encode values in array called result. 3 functions run in order last encoded result stored in result. class a{ public: int size; int* result; a(int si){ size=si; result=new int[size]; for(int i=0;i<size;i++) result[i]=5; } void func_1(){ for(int i=0;i<size;i++) result[i]=i+1; } void func_2(){ for(int j=0;j<size;j++) result[j]=j+10; } void func_3(){ for(int k=0;k<size;k++) result[k]=k+4; } }; int main(){ a(10); a.func_1(); // consider each method encoding function (e.g. encryption, randomization, etc) a.func_2(); a.func_3(); return 0; } here stored intermediate results in data member array called result. my question whether storing intermediate results in c

Android mime messages to send email -

currently have , android app uses api javax.mail send emails. want same thing api more lightweight it. trying using org.apache.commons.net smtpclient , have achieved send simple text emails. problem don't know how add , attachment email. solution seems create manually mime messages. exist android lightweight api build mime messages can send using smpt? thanks

PHP Parse XML response with many namespaces -

is there way parse through xml response in php, taking account namespaced nodes , convert object or array without knowing node names? for example, converting this: <?xml version="1.0" encoding="iso-8859-1"?> <serv:message xmlns:serv="http://www.webex.com/schemas/2002/06/service" xmlns:com="http://www.webex.com/schemas/2002/06/common" xmlns:att="http://www.webex.com/schemas/2002/06/service/attendee"> <serv:header> <serv:response> <serv:result>success</serv:result> <serv:gsbstatus>primary</serv:gsbstatus> </serv:response> </serv:header> <serv:body> <serv:bodycontent xsi:type="att:lstmeetingattendeeresponse" xmlns:xsi="http://www.w3.org/2001/xmlschema-instance"> <att:attendee> <att:person> <com:name&g

how to use different layout for different pages in ruby on rails? -

i know application.html.erb default every page .i want use different layout when user login .i mean dashboard after login should of different layout rather default one(application.html.erb). create new layout eg app/views/layouts/dunno.html.erb . use in controller class dashboardcontroller < applicationcontroller layout 'dunno' end or per action class dashboardcontroller < applicationcontroller def index render layout: 'dunno' end end see docs details

php - MYSQL INNER JOIN syntax error -

i have been trying fix issue on since morning :) i have 2 tables. table1= post table2=users. need extract data both tables. searched how use inner join, found codes. run query inside phpmyadmin , works fine here sql query select post.topic_id, post.category_id, post.topic_id, post.post_creator, post.post_date, post.post_content, users.username, users.gender, users.id post inner join users on post.post_creator=users.id post.post_creator=users.id , post.topic_id=19 order post.post_date desc but when use sql query inside php gives me error you have error in sql syntax; check manual corresponds mysql server version right syntax use near 'inner join users on post.post_creator=users.id order post.post_date asc' @ line 1 below php code <?php include_once './forum_scripts/connect_to_mysql.php'; $cid = $_get['cid']; if(isset($_session['uid'])){ $logged = " | <a href ='

ios - change first responders in uitableviewcell textfield -

i developing app using storyboard. there custom class uitableviewcell ( moneyentrytableviewcell ) contains uitextfield . question: want move focus other text fields, added in other cells, press previous/next ( <> ) in keyboard. in .h file @interface moneyentrytableviewcell : uitableviewcell @property (strong, nonatomic) iboutlet uilabel *lblmemname; @property (strong, nonatomic) iboutlet uitextfield *textamount; @property (strong, nonatomic) iboutlet uilabel *lblmemid; // hidden @end in .m file @implementation moneyentrytableviewcell @synthesize lblmemname,textamount; - (void)awakefromnib { } - (void)setselected:(bool)selected animated:(bool)animated { [super setselected:selected animated:animated]; } @end in controller, cellforrowatindexpath func... - (uitableviewcell *)tableview:(uitableview *)tableview cellforrowatindexpath:(nsindexpath *)indexpath { moneyentrytableviewcell *cell = (moneyentrytableviewcell *)[tableview dequeuereusablecellwith

arm64 - ARMv8 exception vector significance of EL0_SP -

i new armv8 architecture , while reading v8 exception vectors not able understand significance of adding sp_el0 level vectors while sp_elx vector set exists. trying find use case useful. understand when exception taken @ same level default stack of same exception level used example if el2 (hyp) mode defined if exception occurs while being @ el2 level stack defined @ el2 used not sure if configure use el0 level stack under use cases useful ? can 1 give use case , explain ? also while going through spec seems these 2 different stack usage idea taken cortex-m architecture not clear thread , handler modes well. can 1 explain ? just wanted add here armv7 doesn't have thread , handler concept not clear requirement in armv8. thanks sp_el0 "normal" stack pointer. code runs in el should running on sp_el0 whenever can. sp_el1/2/3 "exception" stack pointer mode. when exception, fault, or interrupt happens, processor switches stack (and possibly switc

javascript - Backbone click event being fired multiple times -

i have seen many questions this, no 1 solving problem. i have page main div has 1 div one-image default. there button can add other div s. have event click appends other div template "remove" button. this: image stack <div class="image-stack"> <div class="one-image"> ... <a id="addimage">add image</a> ... </div> </div> image template <script type="text/template" id="another-image-template"> <div class="one-image"> ... <a id="addimage">add image</a> <a id="removeimage">remove image</a> ... </div> </script> view events: { 'click #addimage' : 'addanotherimage', 'click #removeimage' : 'removethisimage' }, addanotherimage: function(e) { var = $('#another-image-template').html(); $('.ima

mysql - Combine 3 columns (date, time, timezone as VARCHAR) and represent as UTC -

due specific reasons storing events' dates 3 separate columns (instead of single datetime column): day_begin (column type: date) hour_begin (column type: time) timezone (column type: varchar) here's example row of data data these 3 columns: 2015-01-27 09:00:00 europe/rome based on information, select , rows, start date within specific utc interval (e.g. these utc start utc end of january 2015). this quite trivial if time stored in single datetime column, since can't change product accomodate specific need - need work mysql gives functions compare utc. solution: select convert_tz(concat_ws(" ", day_begin, hour_begin), timezone, "utc") the function concatenates date , hour columns , uses value timezone column second parameter convert_tz() handles time zone conversions.

android - How to keep ListView Item Selected when we navigate and again come on the same fragment? -

i have 1 list view in fragment. clicking item keeping selected because used following code in listselected.xml <item android:state_pressed="true"> <shape android:shape="rectangle"> <solid android:color="#646973" /> </shape> </item> <item android:state_selected="true"> <shape android:shape="rectangle"> <solid android:color="#646973" /> </shape></item> <item android:state_activated="true"> <shape android:shape="rectangle"> <solid android:color="#646973" /> </shape></item> <item android:state_accelerated="false"> <shape android:shape="rectangle"> <solid android:color="#646973" /> </shape> </item> but when go 1 fragment , when again visit same fragment removed want that

ibm mobilefirst - i got this exception java.io.IOException: Expected chunk of type 0x11c0200, read 0x1200200 -

i got exception r @ com.ibm.ws.util.threadpool$worker.run(threadpool.java:1604) r java.io.ioexception: expected chunk of type 0x11c0200, read 0x1200200. r @ com.ibm.puremeap.util.android.readutil.readchecktype(readutil.java:32) r @ com.ibm.puremeap.util.android.androidresourceparser.readpackage(androidresourceparser.java:80) r @ com.ibm.puremeap.util.android.androidresourceparser.read(androidresourceparser.java:62) r @ com.ibm.puremeap.util.android.androidapkresolver.resolve(androidapkresolver.java:138) r @ com.ibm.puremeap.util.android.aapt.getmetadata(aapt.java:362) r @ com.ibm.puremeap.services.uploadservice.fileuploaded(uploadservice.java:153) r @ com.ibm.puremeap.services.uploadservice.__fileuploadedjson__(uploadservice.java:106) r @ sun.reflect.nativemethodaccessorimpl.invoke0(native method) r @ sun.reflect.nativemethodaccessorimpl.invoke(nativemethodaccessorimpl.java:60) r @ sun.reflect.delegatingmethoda

c# - Is good practice to create controls as partial views in .NET MVC5? -

i'm pretty new in mvc , planing something, i'm not sure practice or not. create ui controls partial views. example, have autocomplete control, have autocomplete partial views scripts needed , everything, , pass model through renderpartial? so, hear comments? mvc offers lot of options separate view code might confusing in begging. main 4 of them are: partial views @helper methods html helpers display/editor templates i not go in details here because there lot of info them. example @helper methods vs html helpers vs partial views . or editor/display templates vs partial views . for complicated controls autocomplete suggest use partial views or html helpers.

preg replace - PHP preg_replace supplement link URL pattern -

i have following urls structure: http://example.com/item/example-descriptions/6454986 http://example.com/item/example-bla-bla-bla/6545455 http://example.com/item/example-other-url/5454555 i need add text numbers (add "/demo/" , "?id=test") http://example.com/item/example-descriptions/demo/6454986?id=test http://example.com/item/example-bla-bla-bla/demo/6545455?id=test http://example.com/item/example-other-url/demo/5454555?id=test here couple of ways imperfect: $myurl = 'http://example.com/item/example-descriptions/6454986'; if (substr_count($myurl, 'example.com')){ $url = "$myurl.html"; $url = preg_replace('/^(.*)\/([^.]+)\.html$/','$1/demo/$2?id=test', $url); echo "$url"; } else { echo "$myurl"; } and $myurl = 'http://example.com/item/example-descriptions/6454986'; if (substr_count($myurl, 'example.com')){ $url = explode('

java - Contact Listener has no effect in Libgdx -

i working on libgdx collision detection between bodies , tried implementing using contact listener has no effect in code. here code public class firstlevel implements screen{ ...... private player player; ...... ... gdx.input.setinputprocessor(player); world.setcontactlistener(player); .... } "player" class implements contactlistener , inputprocessor. here player class public class player implements screen, inputprocessor,contactlistener { private body polybody,polybodys; private player player; private world world; boolean colliding ; private body enemybody; private sprite polysprite; public final float width,height; private rectangle rectangle; private vector2 movement=new vector2(); private float speed=580; private body rec; public player(world world,float x,float y,float width) { this.width=width; //imp height=width*2; bodydef polygon=new bodydef(); polygon.type=bodytype.dynamicbody; polygon.position.set(x,y); // polygonsha