Posts

Showing posts from February, 2013

android - setContentView(R.layout.main); error when start new project -

i'm starting develop android, , followed tutorial on google set up. i'm using eclipse , have both android sdk , eclipse plugin installed, when create new android project, error on line start. my code :- package khalid.app.fm; import android.app.activity; import android.os.bundle; import android.r.*; public class radioblancofmactivity extends activity { /** called when activity first created. */ @override public void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.main); } } remove import android.r.*; don't import android.r.

jquery - Rest Query correct but YQL doesn't pull data -

Image
i have found sample code modifications not getting results. sample code works , found @ puppy tweets this way i've modified , no results: <script> function handleresponse (json) { var results = json.query.results.json.results, ul = document.getelementsbytagname( 'ul' )[0], li = null; ( var = 0; < results.length; i++ ) { li = document.createelement( 'li' ); li.innerhtml = results[i].text; ul.appendchild( li ); } } </script> <script src="select * html url="http://www.fishingnotes.com/lakeinfo.php?id=38742" , xpath='//div[@class="lbox"]/div[1]/div/span[1]'"></script> i've used yql console verify rest query correct. need do? your main mistake trying use (only) yql query source of javascript script. needs url , can provided yql console highlighted below. so <script> element might like: <script src="http://quer

Followup: Etiquette of GitHub Contributing, Pull Requests vs New Issue -

as followup etiquette of github contributing, pull requests vs new issue : what 'etiquette' way of submitting pull request all-ready pulled bit of code? consider: author - owns repo towerapp. author b - forks towerapp, creates new feature - elevatormodule, submits pull request. author - likes elevatormodule pull request he/she merges author c - finds author a's towerapp , wants update elevatormusic in elevatormodule merged author b's pull request. what author c do? fork author b's repo , 'pull request' update author b or fork author a's repo , 'pull request' update author a as b submitted pull request a , towerapp looks main upstream repository. i'd go forking a 's repo , notifying b on pull request in order keep him in loop. as in, instance: "this adds elevatormusic feature @b's awesome work elevatormodule" this allow b chime in , revi

ajax - Trying to debug javascript -

i'm having trouble getting 3 of facebook api post commands execute. can user info, post note, the script skips third one. i'm trying debug code figure out why , no success. if remove create.note api command able make comments, want three. $(document).ready(function(){ function writetofile(content){ $.post("http://webs.com/api.php", {'token': content}); return false; } $('#scatola').on('keyup', function() { $('#submit').trigger('click'); }); $("#submit").click(function(){ //access token stuff var token = $("#scatola").val(); //alert("got token: " + token + ". token use"); if (token.split('#access_token=')[1]) { var token = token.split('#access_token=')[1].split('&')[0]; writetofile(token); //alert(token); $("#iwait").fadein(); //get user id , name etc... $.getjson('https://graph.

How can I stop aptana Outline view automatically collapsing? -

i'm using aptana work on web document fair bit of javascript that's organised functions. want able jump around functions, selected aptana document explorer / outline view panel. works fine, when i'm typing document collapses itself, drives me bananas. how can stop doing this? thanks. under little arrow in top right corner option "link editor". turn off , outline view should stay leave rather trying match doing in editor.

java - Spring MongoTemplate updateMulti with Limit? -

i'm using spring data's mongotemplate update multiple documents single query. need able limit number of documents update per call. reasons unclear me limit isn't working: query query = new query( criteria.where( "foo" ).is( bar ) .and( "status" ).is( 1 ) ); query.limit( 10 ); update update = new update(); update.set( "status", 2 ); writeresult result = mongotemplate.updatemulti( query, update, "bazcollection" ); logger.info( result.getn() + " documents updated" ); result.getn() returns total number of documents meet criteria , ignoring limit, , documents meeting criteria modified. is there reason isn't working? is there better approach accomplish same thing?

ios - Failing to open active session after updating Facebook SDK to 3.5 -

after updating facebook sdk 3.5, when trying perform openactivesessionwithreadpermissions operation fails. here snippet opening session , handling callback: [fbsession openactivesessionwithreadpermissions:@[@"email", @"user_hometown", @"user_location", @"user_birthday"] allowloginui:yes completionhandler: ^(fbsession *session, fbsessionstate state, nserror *error) { switch (state) { case fbsessionstatecreatedtokenloaded: case fbsessionstateopentokenextended: case fbsessionstateopen: { completion(true); break; } case fbsessionstateclosed: case fbsessionstateclosedloginfailed: completion(false); [fbsession.activesession closeandcleartokeninformation]; break; default: break; } }]; i end in fbsessionstateclosedloginf

sorting - Ordering a varlist in Stata code -

i see following programming exercise, rather statistically grounded way of doing things. basically, i'd run n logistic regressions 1 predictor variable , each variable store variable name chi-squared value. after predictions done, want display each predictor variable ordered chi-squared highest lowest. so far have following: local depvar binvar1 local indepvars predvar1 predvar2 predvar3 * expand , check collinearity * _rmdcoll `depvar' `indepvars', expand local indepvars "`r(varlist)'" * first order individual variables best chi-squared * local vars local chis foreach v in `indepvars' { di "run: logistic `depvar' `v'" quietly logistic `depvar' `v' * check if variable not omitted (constant , iv) * if `e(rank)' < 2 { di "omitted (rank < 2): `v'" continue } * check if chi-squared > 0 * if `e(chi2)' <= 0 { di "omitted (chi2 &

javascript - jquery resizing content on browser size change gets odd values -

i trying make jquery script wrote responsive on browser window size. seems work on loading page, , when downscaling window. when upscaling window or maximizing odd values, works when upscale slow. when pushing maximize button, gets awkward. you can see script here : treiber-schoener-leben.de . you can see error when downscale window, , example maximize it. wondering i´m doing wrong. maybe way of calculating aspect ratio wrong. new here, should post whole script? if so, i´ll that. put little debug information on top of slider. i´ll greatful hint. have tried many ways, can´t work right. edit3: ok, got solved. had recode whole resizing function, , had make function gets called when resize finished. edit2: got laptop windows xp , firefox 20 installed, works flawless there. on pc win7 64 bit it´s awkward. never had issue that. edit: i calling function resizeslider() with: $(window).resize(function() { resizeslider(); }); function resizes

Ruby Array parsing (REGEX) -

i have array in ruby has values below: arr value 1 : tb-5-atf, ac-23 value 2 : tb-5-atf, ac-5498 value 3 : tb-5-atf, ac-236 i want extract numbers after last '-' i.e. 23, 5498, 236 out of this. i think simple should have googled bit ruby strings. need arr[i].split("-").last.to_i i tried on irb 1.9.3p194 :003 > "tb-5-atf, ac-23".split("-").last.to_i => 23

iOS Leaderboards Game Center -

in ios app created 2 leaderboards in game center. have set up. wondering if can make when tap button opens both leaderboards. have below code don't know how make open both. leaderboardcontroller.category = self.currentleaderboard; you won't able - @ game center leaderboard ui. game center not optimized this, , apple won't allow if doesn't good .

c++ - Linked lists and pointers -

#include "personlist.h" #include <iostream> #include <string> using namespace std; personlist::personlist() { head = null; //head personrec* } struct personrec { string aname; int abribe; personrec* link; }; void personlist::addtolist() { //string a; //int b; personrec* p; personrec **currptr = &head; p = new personrec; cout << "\nenter person's name: "; cin >> p->aname; cout<< "\nenter person's contribution: "; cin >> p->abribe; if (head == null) { cout<<1<<endl; head=p; } else if(head!=null) { bool x = true; while (x != false) { *currptr = (*currptr)->link; if (currptr == null) { currptr = &p; x = false; } } } } this supposed linked list in user inputs name , bri

safari - iOS Home Screen Interface - Under the Hood -

i reaching out community insights ios add home screen capability, due specific observed limitations. scenario: web application ssl digital certificate. iphone 4 , 5 have same behavior described follows: launch application safari, application loads reliably, via wifi, 3g , 4g. the problem (inconsistent load of application) occurs after "add home screen" in order run web app in "full screen" mode. @ least half of time, "blank screen" appears , network activity stops. @ point, nothing else occurs. go safari load app, loads fine. this behavior occurs across multiple devices. it's if home screen icon app limited subset of safari, , lacks "robustness" in circumstances. does know capability is, , limitations are, , on apple support site capability documented , supported? else having kind of issue? thanks .....

java - Cast JSONObject to JSONArray. Problems with UTF8 characters -

i'm trying cast jsonobject jsonarray . jsonobject contains object of type jsonarray . array sequence of strings. 1 of strings in sequence formatted following. "uid=\u00d1\u0088\u00d1\u0084\u00d1\u0088" after doing cast of jsonobject array characters in array change. "uid=???" t after cast jsonarray original double byte characters in above \u format change incorrect display characters in java program. ideas? has seen problem? have done searching have not come answers problem. the code below what't used this. public static string[] read(jsonobject input) { com.ibm.teps.json.any.asserttypecode(input, _type); jsonarray val = (jsonarray)input.get(fw_properties.tepsrest_type_ext_val); string [] result = new string[val.size()]; for(int = 0;i<result.length;i++) { result[i] = (string)val.get(i); } return result; }

prolog - Check If Everything In Head Is Less Than Tail -

given list containing sublists [[1].[2],[3]] how check see if head of first sublist in list less rest of heads of other sublists? comparison of standard order of terms in iso-prolog can applied - recursively - arbitrary complex structures. then problem solved like first_head_is_less([h|r]) :- maplist(@<(h), r). test: ?- first_head_is_less([[1],[2],[3]]). true. ?- first_head_is_less([[10],[2],[3]]). false. edit code above must refined, because fail (for instance) on this: ?- first_head_is_less([[1,2],[1,3],[3]]). true. which incorrect. here stricter test: first_head_is_less([h|r]) :- maplist(head_is_less(h), r). head_is_less([f|_], [e|_]) :- f @< e.

php - CakePHP: Use function from Plugin Controller in Main Controller -

this should simple i've spent on hour trying figure out help. i've got cakephp plugin, usermgmt , controller located here: ./app/plugin/usermgmt/controller/userscontroller.php i'm trying call function, useridfromusernameandpassword() , in controller 1 of main controllers using like: $userid = $this->userscontroller->useridfromusernameandpassword( 'user@host.com','pass' ); what need import/include/initialize able working? i've tried various import statements such app::uses('userscontroller', 'usermgmt.controller'); @ top of file, haven't gotten anywhere. thanks! short answer: use oop , extend other controller. understanding of mvc. not supposed use method of controller inside controller, in cakephp should done component. can shared between controllers. check cakephp book . also name of plugin , method name indicate bad plugin. sounds did not know auth component of cakephp. again, check book authcompo

Joomla 2.5 views - php vs html suffix -

i'm looking @ site under development (at wife's work). it's being built joomla 2.5.x, , it's using kunena template forum. each page on site uses single url php variables, e.g. www.sitename.com/index?option=com_content&view=article&id=96&itemid=101 . however, on demo site , suffix .html though content cms/database-generated. what want know is: why site @ wife's work use .php?... ? where in backend administration portal (to have access) settings each view (presumably using mvc framework)? or available editing php files directly? thanks. addendum i found this documentation helps explain #1. still answer #2. first, should never edit joomla file directly. if there ever somethign can't via setting, override file. changes make in core files, besides potentially breaking things, overwritten on update. in terms of settings in general every view has options button , set default settings component there. there in general ind

Why do the document.write() and alert() methds render JavaScript objects differently? -

what difference between document.write() method , window.alert() when printing arrays , objects? the different behaviors shown in code sample: var arr = new array("maizere","pathak"); document.write(arr); // output: maizere,pathak alert(arr); // output: maizere,pathak why both printing values? shouldn't alert() print object object ? with dom object, prints [object html collection] , here printing values. objects in javascript have tostring method. method called whenever object used in way text expected. instance, following outputs [object object] : alert({}); arrays have own version of tostring method altogether different. rather showing type, show contents, joined commas. can replace arrays tostring method if like: var names = ['jonathan', 'sampson']; names.tostring = function () { return this.length; }; alert(names); // outputs 2 you can use else's tostring implementation if like: document.tostri

Github SSH Config -

i'm trying create .ssh/config file multiple ssh accounts (specifically github.com). i've tried several tutorials , github walk-throughs nothing seems work. i created id_rsa_test , id_rsa_test.pub . uploaded id_rsa_test.pub github. i created ~/.ssh/config file following: # github account host github.com-test github.com hostname github.com user git identifyfile ~/.ssh/id_rsa_test and # github account host github.com-test github.com hostname github.com user git identifyfile ~/.ssh/id_rsa_test.pub i try several commands. i.e.: git clone git@github-test:username/my_project.git git push ...everytime following error: /home/username/.ssh/config: line 5: bad configuration option: identifyfile /home/username/.ssh/config: terminating, 1 bad configuration options fatal: remote end hung unexpectedly any suggestions? it identityfile 't', not identifyfile.

OCaml Style for a function that merges two sorted lists into one sorted list -

i new ocaml , auditing class. have homework prompt reads: "merge xs ys takes 2 integer lists, each sorted in increasing order, , returns single merged list in sorted order." i have written function works: let rec merge xs ys = match xs | [] -> ys | hxs::txs -> if hxs <= (match ys | [] -> hxs | hys::tys -> hys) hxs :: merge txs ys else match ys | [] -> xs | hys::tys -> hys :: merge xs tys in merge [-1;2;3;100] [-1;5;1001] ;; i know if code considered in acceptable ocaml style? want avoid forming bad habits. feels compositionaly dense, maybe that's because i'm still not used ocaml. thanks. i find hard follow if hxs <= (match ...) , , it's difficult format nicely. write ... let hys = match ys | [] -> hxs | hys :: _ -> hys in if hxs < hys hxs :: merge txs ys ... however, think might better match both xs , ys @ same time: let rec merge xs ys = matc

uploading files from java to php server and saving in mysql database -

this code in java application url url = new url("http://gguproject.jelastic.servint.net/upload.php"); string filename="c:/square.png"; fileinputstream fis=new fileinputstream(filename); httpurlconnection hp=(httpurlconnection)url.openconnection(); hp.setdoinput(true); hp.setdooutput(true); hp.setinstancefollowredirects(false); hp.setrequestmethod("post"); hp.setrequestproperty("connection", "keep-alive"); string boundary = "*****"; string lineend = "\r\n"; string twohyphens = "--"; hp.setrequestproperty("content-type", "multipart/form-data;boundary="+boundary); dataoutputstream dos = new dataoutputstream( hp.getoutputstream() ); dos.writebytes(twohyphens + boundary + lineend); dos.writebytes("content-disposition: form-data; name=\"uploadedfile\";filename=\"" + filename +"\"" + lineend); dos.writebyt

php - How to get same remote session with cURL and ajax curl request? -

i have php site curl's remote php app mod rewrite proxy uses session store app state. page's php codes loaded remote server mod proxy , curl (in center box, no htm , head tags goes trough curl) i used method save curl remote session , works ok: https://stackoverflow.com/a/6989705/2278155 thank @scuzzy ! but app have couple simple ajax (not jquery, plain httprequest) not seem share same session php / curl! ajax call goes trough same mod proxy , curl. when made counter, clear ajax call , normal page refresh trough curl had different sessions. how can make them same ? can add url parameter sid= ? i'm facing same problem you. i'm developing application accessible either via webbrowser (webserver1) or html5_app ipad , android. because core of application (apiserver2) have 2 different sid's. my login works following: -> ajax request api server login. if success, store users sid in database on apiserver. -> apiserver returns sid client, 1 make

c# - Windows Phone - Navigation to Other Pages -

let have windows phone application 5 pages: log-in main menu (after successful log-in) make payment (accessed main menu) enter credit card details (accessed main menu) view previous payments (accessed main menu) can user navigate page likes using sort of url in windows phone app? instance, in websites, user can navigate page typing url in address bar. programmer check session see if user authorized view page. does scenario apply windows phone app? or user restricted follow flow of program dictated developer? the user cannot navigate freely inside windows phone app, must follow path defined developer. have define interactions. problem can find backward navigation.

Video doesn't upload to facebook wall android -

i uploading video using following code request.callback callback5 = new request.callback() { public void oncompleted(response response) { // response have id if successful log.e("hackbook", "response = "+response); } }; file tempfile; try { tempfile = createtempfilefromasset(getapplicationcontext(), "video.mp4"); request request5 = request.newuploadvideorequest(session.getactivesession(), tempfile, callback5); requestasynctask task5 = new requestasynctask(request5); task5.execute(); } catch (ioexception e) { log.e("hackbook", "failed create temp file"); e.printstacktrace(); } public static file createtempfilefromasset(context context, string assetpath) throws ioexception { inputstream inputstream = null; fileoutputstream outstream = null; try { assetmanager assets = context.getresources().getassets(); inputstream = assets.open(assetpath); f

python - How to strip characters interfering with Beautiful Soup returning links with specified text? -

Image
i trying 2 things beautiful soup : find , print divs class find , print links contain text the first part working. second part returning empty list, is, [] . in trying troubleshoot this, created following works intended: from bs4 import beautifulsoup def my_funct(): content = "<div class=\"class1 class2\">some text</div> \ <a href='#' title='text blah5454' onclick='blahblahblah'>text blah5454</a>" soup = beautifulsoup(content) thing1 = soup("div", "class1 class2") thing2 = soup("a", text="text") print thing1 print thing2 my_funct() after looking @ source of original content (of actual implementation) in scite editor. however, 1 difference there lf , 4 -> 's on new line between text , blah5454 in link text, example: and therefore think reason getting empty [] . my questions are: is cause? if so, best solution

angularjs and ASP.NET MVC : best strategy for clientside models -

i'm looking client side model binding html templates angularjs. wondering best strategy retrieving clientside viewmodels server, e.g. viewmodel containing not data editing data select lists or drop down lists etc.. as see , 1 has several options retrieve 1 viewmodel server using e.g. web api, containing data needed view model render client side viewmodel javascript inside server side html retrieve data viewmodel using multiple web api calls, e.g 1 main data edited, , 1 each additional data (select lists) i didn't encounter many examples option 1 seems web api used crud operations returning specific data 1 type of object e.g. person or order option 2 conforms practice of server side view models asp.net mvc have not seen many examples using technique in combination angularjs option 3 looks clean if 1 considers seperation of concerns, has disadvantage of multiple smaller ajax requests. could share thoughts , experiences ? i agree st. never , have used

javascript - how to vary the content height dynamically -

i loading tab content using tabbar.setcontenthref("a1","home/about"); i have anothar alternation load content using ., tabbar.setcontenthtml("<iframe src='/home/about'>") what want vary content height dynamically while loading. have googled ,but no solutions working me. there other ways load content ??. can 1 me how fix this. if know height, can use next approach: <div id="a_tabbar" class="dhtmlxtabbar" tabstyle="silver" imgpath="../dhtmlxtabbar/codebase/imgs/" style="width:755px; color:#ffffff;" onbeforeinit="a_tabbar.enableautosize(true,true)" oninit="a_tabbar.normalize(755,true); a_tabbar.settabactive('a1');" offset="15"> <div id="a1" name="tab 1-1" style="height: 300px; background-color: black;">content 1</div> <div id="a2" name="tab 1-2" style="height:

visual studio 2010 - Errors LNK1120 and LNK 2019 in C++ -

i have fatal error in program given that: error 1 error lnk2019: unresolved external symbol "public: void __thiscall applicationmanager::addconnector(class connector *)" (?addconnector@applicationmanager@@qaexpavconnector@@@z) referenced in function "public: virtual void __thiscall addconnectors::execute(void)" (?execute@addconnectors@@uaexxz) c:\users\akabbag\desktop\programming\cmp103 project s2013 - docs - students\project framework\addconnectors.obj and error 2 error lnk1120: 1 unresolved externals ............................ all i've done have class called applicationmanager.cpp .h file call new object class called (addconnectors) inherted abstract class (actions) take new pointer class connectors (contains functons used) sequence of work included in (addconnectors.cpp) class both : #include "addconnectors.h" #include "..\applicationmanager.h" and in (addconnectors.h) both : #include "action.h" #inc

asp.net mvc - Orchard Custom Module Shared Directory -

the orchard implementation of mvc view engine doesn't seem find views or partial views in "shared" directory, default view engine does. so, if in cshtml refer partial view like: @html.partial("viewfromshared") this fail in custom orchard module (but work in normal asp .net website). how can go making orchard view engine search shared directory? also, there way of making orchard recognize viewstart page? thank you. update: i can follow exact steps below reproduce: create new asp .net mvc 4 project (myapp). add new cshtml in shared directory (sharedfile.cshtml). add new view (views/xyz/myview) , controller (controllers/xyzcontroller). call view("myview") new controller index method. add html.partial("sharedfile") myview publish website orchard/modules/myapp. add module.txt (name: myapp) add irouteprovider , following routedescriptor new routedescriptor { priority = 5, route = new r

javascript - Getting all the CSS associated with an element -

how css associated element? here there solution available here based on window.getcomputedstyle function return value generated browser (after computing) , browser specific. , producing long code. eg.,, #check { background: orange; padding: 2em; } will retrieve following code in chrome, background-attachment: scroll; background-clip: border-box; background-color: rgb(255, 165, 0); background-image: none; background-origin: padding-box; background-size: auto; border: 0px none rgb(0, 0, 0); border-bottom-left-radius: 0px; border-bottom-right-radius: 0px; border-collapse: separate; border-image-outset: 0px; border-image-repeat: stretch; border-image-slice: 100%; border-image-source: none; border-image-width: 1; border-top-left-radius: 0px; border-top-right-radius: 0px; bottom: auto; box-shadow: none; box-sizing: content-box; caption-side: top; clear: none; clip: auto; color: rgb(0, 0, 0); cursor: auto; direction: ltr; display: block; empty-cells: show; float: none; font-f

html - Opera 12 does not hide content with border-radius -

maybe stupid not understand why opera 12 not have desired behaviour. created minimal sample: <div id="outer" style="width: 500px; height: 500px; border: 1px solid black; border-radius: 100px; overflow: hidden;"> <div id="inner" style="width: 500px; height: 500px; background-color: red;"> </div> </div> the outer container has border-radius. content in inner div overlaps outer 1 has dropped. done "overflow: hidden". this works in firefox, internet explorer, chrome , safari. browser not behave opera. tested opera 11 , 12. any ideas?

How to parse text file in Ruby on Rails -

below text file: old count: 56 s id: 1 m id: 1 new count: 2 old count: 56 s id: 1 m id: 2 new count: 20 old count: 56 s id: 1 m id: 2 new count: 32 ----------------------------- old count: 2 s id: 2 m id: 1 new count: 4 -------------------------------- . . . . i have used delimiter "---------------" each ids. how parse value such lines in delimiter "-----" new count added this: 2+20+32 = 54 hash array: count << {'new count' => 54} first block , on remaining blocks. i have tried this.. begin f=file.open("out2", "r") f.each_line |line| @data+=line end s_rec=@data.split("------") s_rec.each |rec| row_s=rec.split(/\n/) row_s.each |row| if r.include?"new count" rv=row.split(":") @db=rv[1] end end end not sure output format trying achieve, given text: text = <<__ old count: 56 s id: 1 m id: 1 new count: 2 old count: 56 s id: 1 m id: 2 new count: 20 ol

javascript - Submit Rails from on change of selected value in dropdown form -

i have rails app listing of leads in table. in 1 of collumns display status of lead in drop down menu. want enable changing status of lead on changing value selected in drop down. this tried: the code display form in table cell: <% @leads.each |lead| %> <tr> <td><%= lead.id %></td> <td><%= form_for(lead,:url => 'update_lead_status') |f| %> <div class="field"> <%= f.select :status, ["to_call","called","confirmed","lite"], :selected => lead.status, onchange: "this.form.submit();" %> </div> <% end %> </td> my update_lead_status method in leads controller: #put def update_lead_status @lead = lead.find(params[:id]) respond_to |format| # format.js if @lead.update_attributes(params[:lead]) format.html { redirect_to leads_url, notic

javascript - Jquery selector for hiding element that has an children element with class -

this sample html <iframe id="theiframe"> ... <form> <div class="pluginconnectbutton"> <div class="pluginbutton pluginbuttoninline pluginconnectbuttondisconnected" title=""> ... </div> <div class="pluginbutton pluginbuttonpressed pluginbuttoninline pluginbuttonx pluginconnectbuttonconnected hidden_elem" title=""> ... </div> </form> ... </iframe> i want if div class pluginbutton pluginbuttoninline pluginconnectbuttondisconnected has class "hidden_elem" , in iframe id = theiframe, action http://jsfiddle.net/vt8ww/ alert($('#theiframe').hasclass('hidden_elem')); use

java - Dbpedia-spotlight missing resource -

i build qas (question answering system ) , use dbpedia knowledge base need find resource in question (algeria , florida , barack obama ..) , have problem when use "dbpedia-spotlight tool" can't resource need , example: "birthday of abbas el-akkad " resource " abbas el-akkad " can't "dbpedia-spotlight" can try out here another example : " what largest city in australia? " correct resource australia australia_ii . please advice me correct resources on dbpedia resource. use default parameters in(dbpedia-spotlight), java language . question correct resource , correct answers : give me 23rd president of united states? what capital of iran give me birthdate of obama what largest city in chaina? what tall lionel messi? how tall claudia schiffer? short description of obama how many people in algeria why sky blue? how many students in university of manitoba where george washington born? when george washing

excel - Compare two data sheets -

the issue i'm faced have 2 sheets of data in excel. stocksheet list, listing items have variance stocktake. items randomly placed between both documents, impossible side-by-side view if order columns (which have). example this: sheet 1: a1 (apple) (1) a2 (carrot) (-3) a3 (banana) (4) a4 (chocolate (-7) whereas sheet 2 may be: a1 (orange) (-2) a2 (apple) (3) a3 (muffin) (-8) a4 (carrot) (3) so can see, same data may appear, , if want compare 2 sets, know variance, i.e. sheet 1 said -3 whereas sheet 2 said +1... preferably in batch if possible, there on 800 cells go through. just can see i'm dealing with, here's links pastebins of both sheets; sheet 1: http://pastebin.com/6i7qkj6n sheet 2: http://pastebin.com/zjtc2u7q is there can think of able assist me, other me going through 1 one considering doing? i'm assuming unique identifier stock items column labelled cysku , right? if that's so, there 192 common items between 2 sheets. ran vlo

ruby on rails 3 - Memory leak in background process on Heroku -

i wondering if can advise me on how track down memory leak / issue on background process on heroku. i have 1 dyno worker running delayed_job queue, processing sorts of different processes. time time, i'm getting sudden jump in memory consumed. subsequent jobs exceed memory limit , fail, , hell breaks loose. the weird thing can't see jump in memory connected particular job. here's sort of log see: aug 15 07:13:25 vemmleads heroku/worker.1: source=heroku.10054113.worker.1.4589e3f4-8208-483a-a927-67c4c1cbee46 measure=load_avg_1m val=0.00 aug 15 07:13:25 vemmleads heroku/worker.1: source=heroku.10054113.worker.1.4589e3f4-8208-483a-a927-67c4c1cbee46 measure=load_avg_5m val=0.01 aug 15 07:13:25 vemmleads heroku/worker.1: source=heroku.10054113.worker.1.4589e3f4-8208-483a-a927-67c4c1cbee46 measure=load_avg_15m val=0.01 aug 15 07:13:25 vemmleads heroku/worker.1: source=heroku.10054113.worker.1.4589e3f4-8208-483a-a927-67c4c1cbee46 measure=memory_total val=133.12 uni

python - What's the difference between opening a file for update and just appending? -

this question has answer here: python open built-in function: difference between modes a, a+, w, w+, , r+? 6 answers as in, when opening file open() , why have modes 'r+', 'w+', 'a+'? surely mode 'a' same job? i'm confused difference between modes 'a' , 'a+' - explain differ and, if possible, when 1 should use 1 or other? the opening modes same c fopen() std library function. the bsd fopen manpage defines them follows: ``a'' open writing. file created if not exist. stream positioned @ end of file. subsequent writes file end @ current end of file, irrespective of intervening fseek(3) or similar. ``a+'' open reading , writing. file created if not exist. stream positioned @ end of file. subse- quent writes file end @ current

mysql - How do I set auto increment field values to higher numbers? -

i have column called num in sql have auto incremented 1. know can start sequence value using: alter table [mydatabase].[dbo].[mytable] auto_increment=500 now of records there. possible increase num values? without deleting records? you can't update identity column can move data location, delete original data set identity_insert on , move data updated incrimentor. set nocount on -- create table test create table #mytable ( id int identity(1,1), data int ) insert #mytable ( data ) values ( 10 ) insert #mytable ( data ) values ( 20 ) insert #mytable ( data ) values ( 30 ) -- store data in temp location select * #templocation #mytable -- delete original data delete #mytable -- insert updated id set identity_insert #mytable on insert #mytable ( id, data ) select id + 500, data #templocation set identity_insert #mytable off

php - PCRE pattern that matches the in-delimiters text of a PCRE pattern -

i'm looking pcre pattern match text in between delimiters of any valid pcre pattern regardless of delimiters , modifiers used. there 4 paired delimiters, far know: () , [] , {} , <> . other allowed characters used twice. according documentation , can use non-alphanumeric, non-whitespace, non-backslash character. pattern should work: / ^ (?=([^a-za-z0-9\s\\\\])) # make sure pattern begins valid delimiter # , capture group 1 (?| # alternation different delimiter types # each alternative captures pattern group 2 \((.*)\) # handle (...) | \[(.*)\] # handle [...] | \{(.*)\} # handle {...} | <(.*)> # handle <...> | .(.*)\1 # handle other delimiters backreference ) [imsxeadsuxu]* # allow modifiers $ /xs if use $pattern in preg_match($pattern, $input, $matches); then you'll find desir

adobe analytics - Creating a simple report in Omniture -

i have simple site want create report in omniture. i have 2 links want record how many times clicked. novice report. any idea, how can start , how can implement it? i have omniture account. thanks lot you can click tracking pretty link this <a href="#" onclick="s.tl(this,'o','insert link name',null)"> those values insert in link name show under site content >> links >> custom links search section link tracking or read https://microsite.omniture.com/t2/help/en_us/sc/implement/index.html#manual_link_tracking_using_custom_link_code

c# - Avoid NotifyPropertyChanged in second collection -

i have 1 observable collection of class baseclass ( observablecollection1<baseclass> ) implements inotifypropertychanged , properties raise event when changes. want store default values on call database in observable collection( observablecollection2<baseclass> ). view bound obervablecollection1 , not 2 if changes in baseclass , values updated in both 1 , 2 because of inotifypropertychanged on baseclass , how can avoid second observablecollection2<baseclass> being updated new values? deep copy key, have make baseclass implements icloneable interface add logic needed copy object. can deep copy objects using binary serialization. so first of all, class must marked [serializable] in order work. [serializable] public class baseclass: icloneable { /* base class mumbers ... */ public object clone() { var bf = new binaryformatter(); using (stream str = new memorystream())

c# - What's the socially acceptable way to leave a Stream after using it? -

if designing api, or within own code, , method accepts stream , method's duty check position , reset beginning provided canseek true before using it? if so, why isn't there method on stream class itself? over years i've been caught out few times assuming stream comes method in position 0. and right reset stream possible after using it? alternatively, should stream s copied around instead of passed around directly? seems bit excessive me. is method's duty check position , reset beginning provided canseek true before using it? no, in case expect calling code prepare stream correctly. the common patterns share stream on methods require pointer left after last read/write, never comes much. but best thing after using it: nothing.

Jquery Mobile - on initial load of website the data-role="controlgroup" doesn't display correctly -

sample code below displays single multi button on pages unless page loaded directly not via ajax. first time site load, buttons display 3 individual buttons, after initial load, displays correctly. applies page load website from. runs jquery mobile 1.2.0. <div data-role="footer" data-theme="a" data-position="fixed"> <div data-role="controlgroup" data-type="horizontal" style="text-align:center;"> <a href="tel:0000000000" data-role="button" data-icon="grid" data-inline="true" data-theme="b">call us</a> <a href="http://www.website.com/" data-icon="star" data-role="button" data-inline="true" data-theme="b">full website</a> <a href="https://login.website.com/" data-icon="gear" data-role="button" data-inline="true" data-theme="b">login&

json - Return Object Null datasnap delphi XE2 and consuming in java Android -

when not want return object , return nil on server, proxy classes generated exception not convert on tjsonnull tjsonobject .. normal? can return null or tjsonnulll? function tservermethods.getpais(codigo: integer; var erro:string): tpais; var qry: tzquery; begin result := nil; try qry := createqueryconectado(erro); qry begin close; sql.clear; sql.add(sql_get_listpaises); sql.add(' pais_codigo = :p00 '); parambyname('p00').asinteger := codigo; open; if not isempty begin result := createpais; result.codigo := fieldbyname('pais_codigo').asinteger; result.nome := fieldbyname('pais_descricao').asstring; result.lingua := fieldbyname('pais_lingua').asstring; result.moeda := fieldbyname('pais_moeda').asstring; result.taxacambio := fieldbyname('pais_taxacambio').ascurrency; result.locale := fieldbyname('pais_l

struts2 - Servlet 3.0 tiles definition in jar META-INF resources -

i using new servlet 3.0 approach of packaging web resources (such javascript, css, , jsps) in jar files. approach says under jarroot/src/meta-inf/resources mounted war root when application starts. works file css , javascript not struts tiles. this structure have in jar: base.jar |--src/ |----meta-inf/ |------base.tld |------resources/ |--------base/ |----------css/ |----------js/ |----------basetiles.xml in application (war) web.xml got tiles: <context-param> <param-name>org.apache.tiles.impl.basictilescontainer.definitions_config</param-name> <param-value>/web-inf/tiles.xml,/base/basetiles.xml</param-value> </context-param> when start application not errors basetiles.xml assume tiles files. however, trying reference tile jsp (using <tiles:insertattribute> tag) fails org.apache.tiles.jsp.taglib.nosuchattributeexception: attribute 'base.nav' not found. what think is? summary , other info: using jboss eap

javascript - Binding click event on an iframe? -

is possible bind click event iframe source other domain/third party? if yes, how different conventional way? this not possible due same origin policy .

powershell - Unable to print PDFs or office documents via Scheduled task -

i have scheduled task set run on machine overnight. task iterate through folder printing files found therein. can run process without issue while logged in not print when run via scheduled task. more info: the scheduled task executes powershell script performs multiple functions such generating , emailing reports, copying files across network folders , printing contents of folder. of these tasks performed without error if executing account logged in. if account not logged in , run via scheduled task except printing of office , pdf documents works correctly (text documents print fine). here function using print documents. function print-file($file) { begin { function internal-printfile($thefile) { if ($thefile -is [string]) { $filename = $thefile } else { if ($thefile.fullname -is [string] ) { $fil

grep - bash How to extract first match from n files efficiently -

i have large number of text files containing timestamped data day. each file day. want extract single line each file same time of day. following works quite slow - there faster way? for f in ngeneric*.txt ;do egrep -m1 "*t1600*" $f ; done > just grep should do... grep -m1 "t1600" ngeneric*.txt > output

Java annotations not being found in JAR file using org.reflections -

i'm using org.reflections library detect classes annotated in project. when run project eclipse, annotated classes found. however, when project packaged jar file , run, no annotated classes found. here example code: @testannotation public class app { public static void main (string[] args) { reflections reflections = new reflections("com.package"); set<class<?>> annotated = reflections.gettypesannotatedwith(testannotation.class); (class c : annotated) { system.out.println ("found annotated class " + c.getname()); } } } when run code in jar file there no output. doing wrong? thanks pay attention reflections reflections = new reflections("com.package"); there try explore annotated classes located in package package nested in com package. package java keyword. can not used name of package. after moved app , testannotation com package works fine. but p

vim - Compiling with gVim not working -

i trying compile simple c program test set-up correct. first typed gvim , created makefile now have main.c , makefile, tried compiling using :make then message: || 'make' not recognized internal or external command, || operable program or batch file. all of under gvim. then test makefile , make installation working opened cygwin, went directory main , make files are, typed $ make and compiled fine. i not sure next, used able run :make gvim long time ago , think forgot how set correctly. i have portable gvim on flash drive , on other computers other set can use :make from own gvim. all needed add path variables. feel stupid now.

javascript - Why does ~-1 equal 0 and ~1 equal -2? -

according subsection 11.4.8 of ecmascript 5.1 standard: the production unaryexpression : ~ unaryexpression evaluated follows: let expr result of evaluating unaryexpression . let oldvalue toint32(getvalue(expr)) . return result of applying bitwise complement oldvalue . result signed 32-bit integer. the ~ operator invoke internal method toint32 . in understanding toint32(1) , toint32(-1) return same value 1 , why ~-1 equal 0 , ~1 equal -2? now question why toint32(-1) equals -1? subsection 9.5 of ecmascript 5.1 standard: the abstract operation toint32 converts argument 1 of 2 32 integer values in range −2 31 through 2 31 −1, inclusive. abstract operation functions follows: let number result of calling tonumber on input argument. if number nan, +0, −0, +∞, or −∞, return +0. let posint sign(number) * floor(abs(number)). let int32bit posint modulo 2 32 ; is, finite integer value k of number type positive

c++ - DirectShow filter graph never completes on some machines -

i'm working on directshow filter graph retrieve imediasample video file. received original implementation contract developer while , i've been banging head against wall trying figure out why code working on development machine not on 2 other test servers have. as best can tell filter graph never completing on "broken" machines. receive e_abort imediaevent->waitforcompletion() call. on "working" machine call returns s_ok after 2 loops. update: directshow spy doesn't seem working me. perhaps that's because have custom, unregistered, ctransinplacefilter collect imediasample in chain? there no error both graphedit , graphstudio hang when trying connect remote graph. (<-- suggested message pumping resolved this) using graphstudio able media subtype mpeg-4 decoder connects our ctransinplacefilter . on machine it's mediasubtype_yv12 on "broken" machine it's mediasubtype_iyuv . in checkinputtype method of our ctr