Posts

Showing posts from February, 2013

php - Read Excel Data (Rich Excel Data) -

i want read data form excel file , show in html . know there several libraries phpexcel , php-exelreader so. but, want keep format in excel file. example : −19×10 −17 j should parsed −19&times;10<sup>−17</sup> j and m 1 r 1 : m 2 r 2 m<sub>1</sub>r<sub>1</sub> : m<sub>2</sub>r<sub>2</sub> . is there library so? have googled did not solution this. please recommend libraries or tutorial task. any highly appreciated. update - want store data in database. got solution. it's phpexcel . while fetching values cells, did following. $value = $cell->getvalue(); if($value instanceof phpexcel_richtext) { $cellvalueasstring = ''; $elements = $value->getrichtextelements(); foreach ($elements $element) { if ($element instanceof phpexcel_richtext_run) { if ($element->getfont()->getsuperscript()) { $cell

javascript - get date from today to weekend -

i have 1 datepicker function , there small code:- $('ul li').click(function(){ var dat = $.datepicker.formatdate('yy/mm/dd', new date()); $('#date').append(dat); }) this html:- <div> <ul> <li>this weekend</li></ul></div> <p id="date"> </p> my try demo jsfiddle : - http://jsfiddle.net/pmmkc/1/ here try click on li this weekend want date today weekend. don't know how work. please me out this. thanks. try $('ul li').click(function(){ var date = new date(); var day = date.getday(); while(day < 7){ $('#date').append($.datepicker.formatdate('yy/mm/dd', date)); date.setdate(date.getdate() + 1); day++; } }) demo: fiddle

c# - Entity Framework v5 loading relational data -

i have 2 simple poco want connect through 1 many relation public class menu { public int menuid { get; set; } public bool isactive { get; set; } public icollection<menumember> menumembers { get; set; } } public class menumember { public int menumemberid { get; set; } public int menuid { get; set; } public string viewroute { get; set; } public bool isactive{ get; set; } } public class efdbcontext : dbcontext { public dbset<page> pages { get; set; } public dbset<menu > menus { get; set; } public dbset<menumember> menumembers{ get; set; } } now have simple , resources on internet suprisingly vague (or dumb) i want write lambda expression for select * menu inner join menumembers on menu.menuid = menumembers.menuid menu.menuid = 1 i have used ienumerable<menu> menu = repository.menus.where(x => x.menuid == menuid); but when iterate on it, menu.menunumbers stays null. believe sort of

Chinese characters in watermark not shown properly when iTextSharp is used. Some characters are shown as questionmark -

while adding watermark pdf file using itextsharp, chinese characters shown question marks. i tried base font helvetica , tried options cp1252. tried giving font name present in windows fonts , supports chinese. every time question marks displayed in final pdf file instead of chinese characters. helvetica contains limited number of latin glyphs. explained in itext documentation , can't use font create chinese characters. need font file, such arialuni.ttf , use create basefont object. use basefont object add string @ absolute position or create font object use in high-level object. here examples: how use font file such arialbd.ttf: encodingexample in case, you'd use arialuni.ttf , encoding identity_h how use true type collection if don't have ttf file: ttcexample how create string contains glyphs require different fonts: fontselectionexample all these examples taken chapter 11 of book itext. if browse documentation, you'll find pdf examples,

c# - ajax dropdown extender at runtime -

Image
i've got textbox ajax dropdown extender. how make image 2 @ runtime , not when hovering on textbox. textbox "downbutton" should image 2 @ design time how do or reading material on how this? edit all i've done far i'm trying first display correctly, otherwise have find way: <asp:content id="bodycontent" runat="server" contentplaceholderid="maincontent"> <asp:scriptmanager id="scriptmanager1" runat="server"> </asp:scriptmanager> <div> <asp:textbox id="txtresidence" runat="server"></asp:textbox> <asp:dropdownextender id="txtresidence_dropdownextender" runat="server" dynamicservicepath="" enabled="true" targetcontrolid="txtresidence" dropdowncontrolid="pnlres"> </asp:dropdownextender> </div> <div>

How to click a link in WebDriver using Python? -

<tr><td class=wb><a href="javascript:void(fight())" style='text-decoration:none'><b>click here!</a></td></tr> hi, how click url? i'm not sure, try this: elements = driver.find_elements_by_tag_name("td") element in elements: if element.text == "click here!": element.click() or: elements = find_elements_by_class_name("wb") element in elements: if element.text == "click here!": element.click()

Simple Login Screen using LDAP in GWT -

hi friends, i have simple login authentication using ldap in gwt. had done in java.but don't know implement same in gwt. me if knows... pasted here java source here : package com.ldap.test; import java.util.*; import javax.naming.*; import javax.naming.directory.*; public class ldaptest { @suppresswarnings("unchecked") public static void main(string[] args) { try { @suppresswarnings("rawtypes") hashtable env = new hashtable(); env.put(context.initial_context_factory, "com.sun.jndi.ldap.ldapctxfactory"); env.put(context.provider_url, "ldap://localhost:389"); //replace server url/ip //only digest-md5 works our windows active directory env.put(context.security_authentication, "simple"); //no other sals worked me env.put(context.security_principal

jquery - How to use Tagedit plugin in Asp.Net -

i want add tagedit plugin in project add names textbox. requirements are: 1. textbox should have autocomplete existing names. 2. should able accept new names if not found in existing data, similar tags textbox in stack overflow below links plugin: http://tagedit.webwork-albrecht.de/ http://tagedit.webwork-albrecht.de/playground.html for purpose have used ajax json & webservice values database step1: added controls aspx page <form id="form1" runat="server"> <div> <asp:toolkitscriptmanager id="toolkitscriptmanager1" runat="server"> </asp:toolkitscriptmanager> <asp:textbox id="txtempnames" runat="server" ></asp:textbox> <img alt="" src="" /> </div> <input type="hidden" id="hfjsondata" /> </form> step2: added related links of jquery , css page <link href=&quo

mysql - Find Next Previous records with sorting -

i'd make navigation links of search result, not sure how previous , next ids in mysql? let's say, user searching stuff , ordered year, , result set like: id year 444 2013 333 2013 555 2013 <---- user clicks here (i.e. known id 555) 777 2012 111 2012 how previous , next ids (333, 777)? updated answer you can try query this, if can you. select id tablename phones '99091505' , id = 555 order year union (select id tablename phones '99091505' , id < 555 order year desc limit 1) union (select id tablename phones '99091505' , id > 555 order year asc limit 1) old answer this not specific solution general idea achieve want! at first, should save total number of rows found somewhere specific search. so when user first time shown search result, show him first link, , keep track next 2nd link. so user clicks next button, create query select xvy tablename abc=def order year limit 1,1 so if user on 5th search

ios - NSNotificationCenter 'selector' working more than once is single Network status change -

in app want detect network status changes operations @ time. have added following code in app-delegate. when turn on net connection " networkstatuschanged: " method called once correct. , when turn off net-connection calls twice. can me find out problem please...... [[nsnotificationcenter defaultcenter] addobserver:self selector:@selector(networkstatuschanged:) name:kreachabilitychangednotification object:nil]; reachability = [[reachability reachabilityforinternetconnection] retain]; [reachability startnotifier]; it doing once lost wifi connection , second time lost cell data connection.

spidermonkey - What is NSString internally? -

can assign char* or wchar_t* nsstring , avoid copying how? i need pass unicode (utf16 le) string spidermonkey uiview subclass, , goal avoid copying if possible, or @ least avoid intermediate conversion utf8. thank you. see - (instancetype)initwithbytesnocopy:(void *)bytes length:(nsuinteger)length encoding:(nsstringencoding)encoding freewhendone:(bool)flag method of nsstring class.

android - Waze-like notification icon that returns to app -

i'm trying add notification icon application, function waze's notification icon - when open status bar , tap on "return myapp" line, application move foreground - same activity stack state had when moved background. i went on numerous questions, , found lot of answers if know in advance activity going shown when notification tapped. don't know activity it's going - can of app's activities. i tried sending broadcast when notification tapped. can broadcast in receiver alright, there i'm stuck exact same problem - don't know activity launch - can't find last activity (i can find last task, since app has 1 task, it's no help). you need create pending intent. like this: intent notifyintent = new intent(context, chat.class); pendingintent intent = pendingintent.getactivity(chat.this, 0, notifyintent, simple_notfication_id); notifydetails.setlatesteventinfo(context, contenttitle, contenttext, intent); notifyintent.setflags(i

pom.xml - maven profile dependent property -

my maven pom looks this: <...> <profiles> <profile> <...> <id>1</id> <properties> <my_var>asdf</my_var><...> <profile> <...> <id>2</id> <properties> <my_var>jklö</my_var><...> </profiles> <build> <...> </build> now want use my_var property in major -section in plugin. how do this.. scope problem? sincerely paul

javascript - Problems when using the insert() function in d3 java library when trying to insert SVG elements before another -

i have problems using insert() function of d3 visualization library. better not understand how use "before selector". red examples here , here , dod not help. i create svg element , append element it. append foreignobject-element group , afterward insert rectangle before foreignobject-element. here code var body = d3.select("body"); var svg = body.append("svg") .attr("width", '100%') .attr("height", '100%'); var group = svg.append("svg:g"); var html = group.append("foreignobject") .attr("x", 50) .attr("y", 25) .attr("width", 200) .attr("height", 100) .append("xhtml:div") .style("font", "14px 'helvetica neue'") .html("lorem ipsum dolor sit amet, consectetur adipiscing elit. donec eu enim quam."); var rect1 = group.insert("svg:rect", html) .attr("

c# - Microsoft.Xml.XQuery math expression error -

i'm newer in microsoft.xml.xquery, when i'm trying run xquery math expression sum have error : cannot apply add non integer data. xml: <book category="cooking"> <title lang="en">everyday italian</title> <author>giada de laurentiis</author> <year>2005</year> <price>30.00</price> </book> xquery: for $item in document("xqt")/bookstore/book[price < '30'] return $item/year/text() + $item/year/text() c#: xmldocument doc1 = new xmldocument(); doc1.loadxml(rtexml.text); xquerynavigatorcollection navcol = new xquerynavigatorcollection(); navcol.addnavigator(doc1.createnavigator(), "xqt"); xqueryexpression expr = new xqueryexpression(rtexquery.text.trim().replace("\\n", " ")); xquerynavigator nav = expr.execute(navcol); rteoutput.text = nav.toxml(); any ideas? for $ite

javascript - Data attribute changes not detected with jQuery -

i changing data-demo attribute of div element , when want check in event, shows me initial value of instead of current value. this code using: $('#showvalue').click(function(){ alert($('.value').data('demo')); }); $('.update').click(function(){ $('.value').text('updated').attr('data-demo', 'updated'); }); why happening? here's fiddle example talking about: http://jsfiddle.net/f5cpm/ thanks. the jquery .data() functions aren't supporting html5 dataset functionality, rather load in html5 dataset data own data collection. in consequence updates dataset changing attribute not reflected in jquery internal data collection. in other words, either need consequently use dataset.demo , $().data("demo") or $().attr("data-demo") . advantage of second being cross browser of course , part of jquery if you're using jquery rest of application.

javascript - Checking which span element is currently on the screen or the closest to it upwards -

this question has answer here: check if element visible after scrolling 37 answers i'm trying see span element visible on screen or closest upwards, i'm not sure how achieve this. page scroll able , spans visible. there selector visible on screen ? guess, should compare window.scrolltop() , element scrolltop values. p.s. not forget include element height

Matlab-like isosurface library for c++ -

is there c++ library has function isosurface matlab? here example of need: clc clear n = 30; x = linspace(-125,125,n); y = linspace(-125,125,n); z = linspace(-260,25,n); [x,y,z] = meshgrid(x,y,z); [x2,y2] = meshgrid(x,y); quan=abs(3.15*exp(-(x2.^2+y2.^2)/(2*(28.8)^2))); quan=repmat(quan,[1 1 n]); p=-z-10*quan pv=isosurface(x,y,z,p,0); pa=patch(pv); xi=pv.vertices(:,1); yi=pv.vertices(:,2); zi=pv.vertices(:,3); [zn]=griddata(xi,yi,zi,x2,y2); surf(zn);

osx - How to make Java app appear in Mac OS X dock with an icon -

i finished program, , has icon. when double click on .app, appears in dock java app, not using icon chose it. on snow leopard. how make icon choose 1 on dock? thanks in advance. does info.plist (in application bundle) specify icon? example: myapp.app/contents/info.plist: <key>cfbundleiconfile</key> <string>myicon.icns</string> and .app contain icon? example: myapp.app/contents/resources/myicon.icns

java - How to know if Static Block Initialization has been run? -

i trying rid of memory leaks. i'd reset static variables of classes (not mine) class loader. there classes attribute lists classes known classloader. so want loop on , reflection set static variables null. the problem classes have not been initialized (the static block initialization did not run). purpose reset values , unload classes, there no point initializing classes. moreover, when reset class root used in sbi of class child, running sbi of child can lead unexpected behavior... so question is: there way know if sbi has been run jvm or not. note: to proposing use findloadedclass of classloader, there in specification important sentence: *in post, there important note: "loaded" doesn't mean "initialized". initialization happens @ precise moments defined jls3 $12.4.1 * static block initialized if class loaded on jvm. is class loaded on jvm can detect classloader

Calling a javascript function from Amazon S3 -

it's simple context: have simple javascript file called myjs.js in amazon s3 bucket, this: <script type="text/javascript"> function myfunction() { alert("help my!!"); } </script> i want call it, django html template hosted in heroku, this: <html> <head> <title>calling s3's js heroku </title> <script type="text/javascript" src="https://s3-sa-east-1.amazonaws.com/js.mybucket/myjs.js"></script> </head> <body> <input type="button" name="test" value="click me" onclick="myfunction()"> </body> </html> it doesn't work. way: not mime trouble. your file shouldn’t contain <script> tags; it’s javascript, not html. (check browser’s console — tell syntax error is.)

C# Class that Returns Dictionary with a Custom Object & Multiple Strings Pair -

i'm looking create class returns constructed dictionary. i'm uncertain how code constructor return dictionary, how initialize multiple string values pair key, , examples i've found rough drafts. here's rough example: namespace myapp.helpers { public enum housesize { big, medium, small } class houses { public static dictionary<housesize, string> _dictionaryofhouses; public static dictionary<housesize, string> houses { { if (_dictionaryofhouses == null) loadhouses(); return _dictionaryofhouses; } } } private static void loadhouses() { _dictionaryofhouses = new dictionary<housesize, string>; _dictionaryofhouses.add(housesize.big, /*add string properties here red, 2 floor, built in 1975*/); _dictionaryofhouses.add(housesize.small, /*add string propertie

vb.net - How to get selected data from combobox and upload it to mysql database? -

i want selected data combobox , upload mysql database, it's not working expected. here code: try dim cmd2 new mysqlcommand dim insertstatment string = "insert comment (name,comment,reason) values (@name,@comment, @reason)" cmd2 = new mysqlcommand(insertstatment, db_con) cmd2.parameters.addwithvalue("@name", txtname.text) cmd2.parameters.addwithvalue("@comment", richtxtcomment.text) cmd2.parameters.addwithvalue("reason", combobox.selectedvalue) cmd2.executenonquery() messagebox.show("thank your comment") catch ex exception messagebox.show("bad") db_con.close() exit sub end try depending on how items in combobox added, there different properties use: selectedindex gets index of selected item. selecteditem gets object that's selected. selectedtext gets text that's selected. selec

c++ - Correct way to set the size of a std::vector -

from read, std::vector appropriate structure use when interfacing c function requiring contiguous memory byte array. wondering how can determine size of array in cases i have written small sample program illustrate mean. int main(int argc, char *argv[]) { std::vector<unsigned char>v; unsigned char p[1024]; sprintf((char*)&p[0], "%10d", 10); cout << "size: " << v.size() << " length: " << v.capacity() << endl; v.reserve(30); cout << "size: " << v.size() << " length: " << v.capacity() << endl; memcpy(&v[0], &p[0], 20); cout << "size: " << v.size() << " length: " << v.capacity() << endl; v.reserve(50); cout << "size: " << v.size() << " length: " << v.capacity() << endl; v.reserve(0); cout << "size:

javascript - IndexedDB - Storing and Retrieving Videos -

i'm trying make application stores , retrieves video files , indexeddb. however, having issues while retrieving in firefox , while storing in chrome. i'll post code: (function () { // indexeddb var indexeddb = window.indexeddb || window.webkitindexeddb || window.mozindexeddb || window.oindexeddb || window.msindexeddb, idbtransaction = window.idbtransaction || window.webkitidbtransaction || window.oidbtransaction || window.msidbtransaction, dbversion = 1.0; // create/open database var request = indexeddb.open("videofiles", dbversion); var db; var createobjectstore = function (database) { // create objectstore console.log("creating objectstore") database.createobjectstore("earth"); }, getvideofile = function () { // create xhr var xhr = new xmlhttprequest(), blob; xhr.open("get", &q

mysql - Facing problems in multiple table joins -

there 4 tables. items ( item_id, item_name, item_owner) groups ( grp_id, grp_name, grp_owner) users (grp_id, usr_ref) share (item_id, grp_id) my objective list of items item_owner = user_id ( 123 ) or user_id belongs group item shared. a basic query implementation retrieve items shared group particular user_id belongs select i.item_id items left outer join share on share.item_id = i.item_id left outer join users on users.grp_id = share.grp_id left outer join groups on groups.grp_id = share.grp_id users.usr_ref = user_id and include other elements of user_id owner, did select * items owner = user_id or item_id in ( select i.item_id items left outer join share on share.item_id = i.item_id left outer join users on users.grp_id = share.grp_id left outer join groups on groups.grp_id = share.grp_id users.usr_ref = user_id ) which suppose bad implementation item_id needs searched everytime in array obtained joins. how can improve sql statement. also there other way i

optimization - gcc optimisation with LEA -

this question has answer here: what's purpose of lea instruction? 14 answers i'm fiddling gcc's optimisation options , found these lines: int bla(int moo) { return moo * 384; } are translated these: 0: 8d 04 7f lea (%rdi,%rdi,2),%eax 3: c1 e0 07 shl $0x7,%eax 6: c3 retq i understand shifting represents multiplication 2^7. , first line must multiplication 3. so utterly perplexed "lea" line. isn't lea supposed load address? lea (%ebx, %esi, 2), %edi nothing more computing ebx + esi*2 , storing result in edi . even if lea designed compute , store effective address , can , used optimization trick perform calculation on not memory address. lea (%rdi,%rdi,2),%eax shl $0x7,%eax is equivalent : eax = rdi + rdi*2; eax = eax * 128; and since moo in

using php to compare mysql columns to SQL Server -

i have 2 databases, 1 online (mysql) , 1 in office (sql server) compare , update value different. i using php connect sql server database , run query retrieve information, connecting mysql database running query. need compare 2 queries , update necessary. is there somewhere can tips on how this, sketchy on php , struggling really. this far have got-: <?php $server = "**server**"; $user = "**user**"; $pass = "**password**"; $db = "**db**"; //connection database $dbhandle = mssql_connect($server, $user, $pass) or die("couldn't connect sql server on $server"); //select database work $selected = mssql_select_db($db, $dbhandle) or die("couldn't open database $db"); //declare sql statement query database $query = "select p.id, p.code, ps.onhand"; $query .= "from products p with(nolock)"; $query .= "inner join productstockonhanditems ps with(nolock)"; $query .= "on ps.pr

sql server - Loop through columns having name T-SQL -

i have query: select ac.*,cp.nomecampo fieldname optes op inner join artico art on art.id=op.idartico inner join sam.artcla3id13 ac on ac.idartico=art.id inner join campipers cp on cp.tabella = 'artcla3id3' op.id = 54782.000000 that returns this: rivestimento | numtaglienti | raggio | diamscarico | fieldname | _ __ _ __ _ __ _ __ _ __ _ __ _ __ _ __ _ __ _ __ _ __ _ __ _ _ nuda | 0 | 0 | 1 | diamscarico | nuda | 0 | 0 | 1 | diamscarico | how can have this? diamscarico | 1 raggio | 0 numtaglienti| 0 rivestimento| nuda thanks! you can put result of query xml variable , unpivot when querying xml. declare @xml xml set @xml = ( -- query goes here select * yourtable -- here xml path(''), type ) select t.x.value('local-name(.)', 'sysname') columnnaame, t.x.value('./text()[1]', '

parsing with flex and bison fails for space and brace -

i trying parse file this: (too simple actual purpose, beginning, ok) @book{key2, author="some2value" , title="value2" } the lexer is: [a-za-z"][^\\\" \n\(\),=\{\}#~_]* { yylval.sval = strdup(yytext); return key; } @[a-za-z][a-za-z]+ {yylval.sval = strdup(yytext + 1); return entrytype;} [ \t\n] ; /* ignore whitespace */ [{}=,] { return *yytext; } . { fprintf(stderr, "unrecognized character %c in input\n", *yytext); } and parsing with: %union { char *sval; }; %token <sval> entrytype %type <sval> value %token <sval> key %start input %% input: entry | input entry ; /* input 0 or more entires */ entry: entrytype '{' key ','{ b_entry.type = $1; b_entry.id = $3; b_entry.table = g_hash_table_new_full(g_str_hash, g_str_equal, free,

Find the difference of two arrays and print bidirectional changes PHP -

i have 2 arrays: $oldvalues = array(125 => 'hello', 126 => 'bye', 131 => 'hi', 141 => ''); $newvalues = array(125 => 'hello world', 126 => 'bye', 131 => 'h', 141 => 'abc'); now explain little better, $oldvalues holds values before user changes data on website. $newvalues holds new values after user has saved changes. multiple users access page @ same time, if 1 user didnt refresh page , makes changes , clicks on save want able display "hey else has updated settings before did, wanna see changes?" , able see following output: field changed changed 125 hello hello world 131 hi h 141 abc note 126 not included since there no changes. i have code using array_diff seems not work time. $allpossiblefields = array(125, 126, 131, 141); $insertiondiff = array_diff($newvalues, $old

emacs - AUCTeX: Delete all fonts -

this feels problem should have been discussed somewhere, , stupid find :( i have defined myself function \jf{} , want delete of in whole buffer @ once. example: bla bla bla \jf{colourful text} bla bla bla bla bla \jf{more colourful text} bla bla bla bla \jf{colour great} bla bla bla bla bla \jf{so great} bla bla should become shortcut: bla bla bla colourful text bla bla bla bla bla more colourful text bla bla bla bla bla colour great bla bla bla bla bla great text bla bla bla is there way in auctex so? help. the quickest way regular expressions (regexp). use m-x replace-regexp <ret> \\jf{\(.?\)} <ret> \1 this make emacs replace matches pattern \jf{some text} some text .

struts - Can i override a page title of portlet with JSP -

i have remote portlet page title 'a'. when action successful , forwarding jsp page need change page title 'b'. can me in fixing this. in advance. for websphere portal: as implementation of standard api portlet container not support dynamic titles websphere portal, dynamic titles not work, if remote portlet written according ibm portlet api. assume applicable other portlet containers (not sure) are using wps?

asp.net mvc - How to map a list of checkboxes options to a model first class? -

Image
i have list of options in web form: and want work model-first. i'm noob mvc , model-first, don't know how better represent in model class. should make 1 attribuite each item? or should make array each position 1 option (maybe using enums )? public bool[] comportamento { get; set; } // or public comportamento[] comportamento { get; set; } // or public bool manso { get; set; } public bool arisco { get; set; } ... you should have class compartamentoviewmodel looks this: public class compartamentoviewmodel { public int id { get; set; } public string description { get; set; } } then, in main view model: public class myviewmodel { // list of objects view public list<compartamentoviewmodel> compartamentos { get; set; } // list of ints retrieve selected values public list<int> selectedcompartamentos { get; set; } } in view, use description text , id value. in post, populate selectedcompartamentos list of selected ids.

Orbeon 4.1 custom REST persistence -

i have been struggling on week trying setup custom orbeon rest persistence. i using struts 2 mvc framework following configuration: <action name="/crud/{appname}/{formname}/form/form.xhtml" class="com.example.crudcontroller" method="executeform" /> <action name="/crud/{appname}/{formname}/data/{uuid}/data.xml" class="com.example.crudcontroller" method="executedata" /> <action name="/search/{appname}/{formname}" class="com.example.searchcontroller" /> the problem first action being called. from form builder, when click on form record (say "foo"), called: get http://localhost:8080/mycontext/app/crud/myapp/library/form/form.xhtml notice that, myapp correct application name library not correct form name (which should "foo"). from form runner, when try "foo" summary or new pages, called: get http://localhost:8080/mycontext/app/crud/myapp/foo/f

I can't do facebook login with windows 8 mobile application -

i developing windows 8 phone application c# , have use facebook login, use service connect database. have appid , app secret key. failing execute facebook login code. code available through link: http://www.developer.nokia.com/community/wiki/integrate_facebook_to_your_windows_phone_application . codes execute unable see login page. please me? please check once app-id , app secret same working me.

javascript - How to setTimeout only 1 time looping? -

how settimeout 1 time looping? this code looping forever , want loop 1 time. this code: <html> <head> <script language="javascript" type="text/javascript"> function dostuff() { document.myform.submit(); } var mytimer = settimeout(dostuff, 1000); </script> </head> <body> <form name="myform" action="" method="post"> </form> </body> </html> every time form submitted, page reloaded , settimeout called again. you have keep track of page each time it's loaded. example: sessionstorage.submitted = new date().tostring(); and check: if (!sessionstorage.submitted) var mytimer = settimeout(dostuff, 1000); (note: doesn't work in ie7-.) by way, what's point in submitting using post static html page? maybe there's php code we're not seeing?

javascript - JSON object returned but not accessible via $.ajax() -

i have asp.net mvc web api calling $.ajax() method. correct json returned api, object not accessible. error received in console when trying log value "name" is: uncaught typeerror: cannot read property 'name' of undefined json: [{"id":2,"name":"thom","picture":"thom.jpg","about":"i'm guy. profile. quit staring , out of here.","location":"london"}] jquery: $.ajax({ cache:false, type: 'get', datatype: 'json', url: 'http://localhost:3235/users/searchusers?callback=?&searchstring=' + searchstring, complete: function (data) { console.log(data[0].name); } }); any appreciated. thanks! i think mean use success function. complete function doesn't take data parameter.

python - Issue with zope.component subscriber adapters adapting multiple objects -

given following code: from zope.component import getglobalsitemanager, adapts, subscribers zope.interface import interface, implements class a(object): pass class b(object): pass class c(b): pass class ab(object): implements(interface) adapts(a, b) def __init__(self, a, b): pass class ac(object): implements(interface) adapts(a, c) def __init__(self, a, c): pass gsm = getglobalsitemanager() gsm.registersubscriptionadapter(ab) gsm.registersubscriptionadapter(ac) = a() c = c() adapter in subscribers([a, c], interface): print adapter the output produces is: <__main__.ab object @ 0xb242290> <__main__.ac object @ 0xb2422d0> why instance of ab returned? ab declares adapts , b. there way can achieve behavior ac returned? you listing subscribers . subscribers notified of things implement interface(s) interested in. c subclass of b , b subscriber interested, , notified. fact c implements little more of no

html - Turn an element's CSS on/off using JavaScript -

i have following block of html using highlight particular area of .png file: <div id="container"> <img src="http://www.placekitten.com/200/200" /> <div id="highlight"></div> </div> its corresponding css code looks this: #container { positioon:relative; } #highlight { position:absolute; width:75px; height:75px; top:75px; left:75px; background: rgba(255, 0, 0, 0.4); } both can seen working on following page . the code works fine, figure out way turn highlighting on/off having javascript function in control of feature. javascript novice, , not sure how approach this. want able pass variable javascript function, , based on boolean variable, either activate, or deactivate shading. can show me how this? thanks in advance reply. function togglehighlight(on) { var el = document.getelementbyid('highlight'); el.style['display'] = on ? 'block' :

java - itext transfers my letters to html letter codes -

i have pdf in user copies text desktop , on submit pdf generated. use itext-2.1.7 . since use non standard letter these converted html code character codes. servlet doc use "application/pdf;charset=utf-8". basefont bf; try { httpsession session = request.getsession(true); if (session.getattribute("taxnumber") == null || session.getattribute("email") == null || session.getattribute("password") == null) { request.setattribute("message", "the user not exist in our database"); request.getrequestdispatcher("/login.jsp").forward(request, response); } string title = request.getparameter("doctitle"); string date = request.getparameter("docdate"); string text = request.getparameter("brokerstext"); string[] newdate = date.split("/"); document document = new document(pagesize.a4); pdfwriter writer = pdfwriter.getinstance(document, response.getoutputstream()

Django: Built in way to generate HTML sitemaps (not XML) -

we're using django sitemap framework generate search engine friendly xml sitemap. works fine. it's nice use , customize own needs. i know rewrite template used xml sitemap or generate list of pages in our system normal db queries , alike, it's hard believe there not preconfigured solution such common problem. i want same list used in our xml sitemap in normal (html) frontend view. tl;dr: what's best/default way build html sitemap intended people finding stuff on our site (instead of bots)? you can embed xml generated sitemap processor in standard html url(r'^sitemap/','django.contrib.sitemaps.views.sitemap', \ {'sitemaps' : sitemaps, 'template_name' : '<yoursite>/usr_sitemap.html', 'mimetype' : 'none'}), setting 'mimetype' none allow include html code in template used generation. produces html c

c++ - What does this memory map mean when I compile my program? -

i using ubuntu lucid lynx, use kate code c++ programs , use g++ compile them. writing genetic algorithm program , works fine except memory map 80% of time execute program. cannot figure out memory map means or how solve it. here output: *** glibc detected *** ./main: double free or corruption (!prev): 0x0881fdc8 *** ======= backtrace: ========= [0x80da7f8] [0x80dec69] [0x80a5441] [0x80a546d] [0x8059227] [0x8058b2f] [0x8058f41] [0x80567ec] [0x80c075f] [0x8048191] ======= memory map: ======== 00149000-0014a000 r-xp 00000000 00:00 0 [vdso] 08048000-08165000 r-xp 00000000 08:02 2101716 /home/armandmaree/desktop/projek_fase2 (copy)/main 08166000-08168000 rw-p 0011d000 08:02 2101716 /home/armandmaree/desktop/projek_fase2 (copy)/main 08168000-08170000 rw-p 00000000 00:00 0 09a45000-09a67000 rw-p 00000000 00:00 0 [heap] b7600000-b7621000 rw-p 00000000 00:00 0 b7621000-b7700000 ---p 00000000 00:00 0 b77e2000-b77e3000 rw-p 00000000 00:00 0 bfc35000-bfc4a000 rw-p

php - What is the difference between CURLOPT_SSLKEY and CURLOPT_SSH_PRIVATE_KEYFILE? -

i looking @ this question and, try find mistake, went php manual seen 2 options : curlopt_ssh_private_keyfile file name private key. if not used, libcurl defaults $home/.ssh/id_dsa if home environment variable set, , "id_dsa" in current directory if home not set. if file password-protected, set password curlopt_keypasswd. curlopt_sslkey name of file containing private ssl key. op of question uses curlopt_ssh_public_keyfile guess should uses curlopt_ssh_private_keyfile instead of curlopt_sslkey , don't know difference between options. so here comes question : what difference between curlopt_sslkey , curlopt_ssh_private_keyfile ? well, found difference between ssh , ssl in it security question. thomas pornin answered : ssl , ssh both provide cryptographic elements build tunnel confidential data transport checked integrity. part, use similar techniques, , may suffer same kind of attacks, should provide si

ios - Mechanism about "did" and "will" and "should" method -

i want know when methods including key words stated in topic called. for example: – tableview:willselectrowatindexpath: – tableview:didselectrowatindexpath: - (bool)tableview:(nstableview *)atableview shouldselectrow:(nsinteger)rowindex when willselectrow method called? method mean including key words "will" "did" , "should" similarly, there viewdidappear , viewwillappear. it's obvious when viewdidappear method called. viewwillappear 1 quite beyond me. hope help;) willselectrow: tells delegate specified row selected. didselectrow : tells delegate specified row selected. should: returns whether table view should allow selection of specified row. it works same way viewdidappear , viewwillappear. viewdidappear: view has appeared. viewwillappear: view appear. you can learn more in apple documentation. i hope helped !

How to do a simple C++ generic callback? -

say have following code: class { public: a() {} int f(void*, void*) { return 0; } }; template <typename t> class f { public: f(int(t::*f)(void*,void*)) { this->f = f; } int(t::*f)(void*,void*); int call(t& t,void* a,void* b) { return (t.*f)(a,b); } }; a; f<a> f(&a::f); f.call(a, 0, 0); well works can call function how example have array of these without knowing type? i able call class f function callback. i'd use static or c function , done wanted experiment calling c++ member function. think of i'm trying delegates in c#. i've seen sophisticated implementations in boost , other places want bare minimum, no copying, creation, deletion etc required simple callback can call. is pipedream? advice appreciated. i think bare minimum implementation following: std::vector<std::function<bool(int, int)>> my_delegate; you can add many different type

How to get minimum value from 2D array in c# and the indices of that cell? -

i want minimum value 2 dimensional array [1024,9] ,and want position of minimum value. hint: last column flag "if flag == 0 : check row, else : skip row" i tried cod ,but did not me ... float min = fill_file[0, 0]; int ind = 0; int ind2 = 0; (int = 0; < 1024; i++) { (int j = 0; j < 8; j++) { if (fill_file[i, j] < min && fill_file[i, 8] == 0) { min = fill_file[i, j]; ind2 = i; ind = j; } } } this code based on request int t = 0; while (t < 1024) { float min = fill_file[0, 0]; int ind = 0; int ind2 = 0; (int = 0; < 1024; i++) { (int j = 0; j < 8; j++) { if (fill_file[i,

java - Shared border for all node's children -

Image
what easiest way create 1 common border children of given node? i have code result can see on first picture (created own treerenderer, border added in gettreecellrenderercomponent method). on second 1 there result wish achieve. 1. 2.

Azure Recovery Services - Backup not running automatically -

i configured windows azure backup on vm hosted on azure. did manage create , upload certificate following tutorial , tutorial . i downloaded server agent vm , configured it, managed perform manual backup , worked fine. however scheduled run every day @ 3am using wizard provided , it's not running. check every day, , last backup listed 1 did manually. dashboard in backup server agent shows it's scheduled, it's not running. i tried leaving agent open overnight, , didn't help. any insight on situation helpful. thanks, after checking vm's event log, figured out backup wasn't running expected due limited space in hd. after cleared space started running expected.

c# - WPF Validation not working -

i created wpf serves serial number client. part of process, i'm trying validate length of each segment 5 characters long , of characters letters or numbers. followed outline given here . the problem doesn't seem anything, , followed instructions submit button , submit incorrect data, whereas seems shouldn't validate if values aren't right. have binding path ? if not, why won't fields validate? the code validationrule looks this: namespace syncagent.installer { class licensevalidationrule : validationrule { public override validationresult validate(object value, cultureinfo cultureinfo) { if(!(value.tostring().length == 5)) return new validationresult(false,"incorrect number of characters."); regex rexp = new regex("^[a-z0-9]*$"); if (!rexp.ismatch(value.tostring().toupper())) { return new validationresult(false,"a key may contain numbers , letters."); }

sql - Mysql logic - how to change the selected value based on the data? -

i trying populate table phone number temp table. have wrote query no problem. peoblem here know if company has primary number or not so select 2 fields temp table called "cvsnumbers" 1) company_code (id) , phone number. i need add case statement change value of main_number field. if number has number main_number = 1 need insert 0 new phone number if there no main_number need insert 1 new phone number making primary phone number account. this query select ac.account_id, replace(replace(replace(replace(ta.phone_number, '-', ''), ' ', ''), ')', ''),'(','') phone, ifnull(ta.ext, '') extention, ifnull(ta.main_number, 0) mainnumber, ta.type contact_type, '2' created_by cvsnumbers ta inner join accounts ac on ac.account_id = ta.company_code length(replace(replace(replace(replace(ta.phone_number, '-', ''), &#

phpstorm - Xdebug on server can not connect to my computer -

i using phpstorm development in windows 7. trying setup xdebug. i installed xdebug server using pecl. i added these codes php.ini zend_extension="/usr/local/lib/php/extensions/no-debug-non-zts-20100525/xdebug. xdebug.remote_enable=1 xdebug.remote_host=212.2xx.179.83 xdebug.remote_port=9001 xdebug.idekey="phpstorm" xdebug.remote_log=/tmp/xdebug.log phpinfo() shows xdebug running. when use; netstat -aon | more on cmd can see listining in port 9001 tcp 0.0.0.0:9001 0.0.0.0:0 listening 4908 but xdebug can not connect phpstorm xdebug.log shows can not connect ip:port log opened @ 2013-05-02 17:20:55 i: connecting configured address/port: 212.2xx.179.83:9001. e: not connect client. :-( log closed @ 2013-05-02 17:20:58 log opened @ 2013-05-02 17:20:58 i: connecting configured address/port: 212.2xx.179.83:9001. e: not connect client. :-( log closed @ 2013-05-02 17:21:16 log opened @ 2013-05-02 17:21:16 i: connecting

knockout.js - Do I have to use the knockout with binding? -

i'm new knockout , trying understand how of bindings should work. i thought reference child observable in normal binding without need cannot working. my model , view model are; model = function(name) { this.name = ko.observable(name); }; viewmodel = function () { var list = ko.observablearray([new model("apple"), new model("pear")]), selecteditem = ko.observable(); function selectitem(item) { selecteditem(item); } return { list: list, selecteditem: selecteditem, selectitem: selectitem }; }; and here bindings: <div id="content"> <ul id="list" data-bind="foreach: list"> <li data-bind="text: name, click: $parent.selectitem"></li> </ul> </div> <