Posts

Showing posts from March, 2013

How can I create a 2D heatmap grid in R? -

Image
i have data set this head(data) v1 v2 [1,] na na [2,] na na [3,] na na [4,] 5 2 [5,] 5 2 [6,] 5 2 where unique(data$v1) [1] na 5 4 3 2 1 0 6 7 9 8 unique(data$v2) [1] na 2 6 1 5 3 7 4 0 8 9 what plot similar this plot(df$v1,df$v2) but colour indicator indicating how many match there grid instead of points. can me? it looks may want - first tabulate using table() , plot heatmap of table using heatmap() : set.seed(1) data <- data.frame(v1=sample(1:10,100,replace=true),v2=sample(1:10,100,replace=true)) foo <- table(data) heatmap(foo,rowv=na,colv=na)

Issue with designing a website - css/html -

i have little problem @ designing website: in website have top navigation bar , composed : number of search results found, search bar, login methods. asking how can set "websitelocation" div , search input aligned left , "loginmethods" div aligned right (in topbar of course). want mention tried on loginmethods div left:0; css property did nothing. here jsfiddle setup of layout : http://jsfiddle.net/uzspz/ . code : html <body> <nav> <a href="#"><h1 class="logo">project</h1></a> <ul> <li id="events_list"> <a href="#events"> <img src="img/menu/services2.png" width="35px" height="35px" style="margin-top:0px;margin-bottom:0xp;padding:0px;" /> <p class="ename">events</p> </a> <...

Facebook SDK for iOS doesn't post a photo along with the link -

i'm trying post message including link , image, on post can't see image. don't error. post published correctly, displaying both message , link, photo not show. -(void)postonfacebook { if (fbsession.activesession.isopen) [self postonwall]; else { [fbsession openactivesessionwithpublishpermissions:[nsarray arraywithobjects:@"publish_actions", nil] defaultaudience:fbsessiondefaultaudienceeveryone allowloginui:yes completionhandler:^(fbsession *session, fbsessionstate status, nserror *error) { if (error) nslog(@"login failed"); else if (fb_issessionopenwithstate(status)) [self postonwall]; }]; }; } - (void)postonwall { fbrequestconnection *newconnection = [[fbreq...

c++ - DFS in boost::graph with changing the graphs content -

minimal example: #include <boost/graph/graph_traits.hpp> #include <boost/graph/adjacency_list.hpp> #include <boost/graph/depth_first_search.hpp> struct vertex { int number; }; struct edge {}; typedef boost::adjacency_list<boost::lists, boost::vecs, boost::directeds, vertex, edge> graph_t; typedef boost::graph_traits<graph_t>::vertex_descriptor vertex_t; typedef boost::graph_traits<graph_t>::edge_descriptor edge_t; struct vertex_visitor : public boost::default_dfs_visitor { void discover_vertex(vertex_t v, graph_t& g) { g[v].number = 42; } }; int main() { graph_t g; vertex_t v1 = boost::add_vertex(g); vertex_t v2 = boost::add_vertex(g); boost::add_edge(v1, v2, g); vertex_visitor vis; boost::depth_first_search(g, boost::visitor(vis)); return 0; } it not work because graph needs referenced const in vertex_visitor::discover_vertex() . is there better method want writing own dfs algo...

c# 4.0 - Make multiple async calls in a single call in C# -

i want make multiple asynchronous calls in single call without using loop. example, i'd pass list of uris , and retrieve of them asynchronously in 1 call. possible via c#? here's example in java similar looking for. you can list of tasks - example: var tasks = uris.select(async uri => { using (var client = new httpclient()) { return await client.getstringasync(uri) } }) .tolist(); note if want use async/await, you'll need c# 5, not c# 4. can still use .net 4.0 if use microsoft.bcl.async nuget package, must use c# 5 compiler.

javascript - jQuery open div on hover; automatic scroll through -

i have ul list several links in it, , each item linked own div . when user hovers on ul link, proper div box shown. here html code: <ul class="productlist"> <li><a href="#" id="link0" class="product-link">link 1</a></li> <li><a href="#" id="link2" class="product-link">link 2</a></li> <li><a href="#" id="link3" class="product-link">link 3</a></li> </ul> <div class="panel-overview boxlink" id="boxlink0"> goes here 1 </div> <div class="panel-overview boxlink" id="boxlink1"> goes here 2 </div> <div class="panel-overview boxlink" id="boxlink2"> goes here 3 </div> and javascript makes work (not javascript expert, sorry): <script> $(function() { var $boxes = $('.boxlink'); $(...

Specify which timezone a datetime is in, in python -

i have datetime database, datetime utc datetime. when pull db, unaware of timezone. need do, convert datetime "seconds epoch" time function. problem this, system's time in pst , not able change specific reasons. so, want is, take datetime database, , tell python datetime utc datetime. every way have done that, results in losing time or gaining time due timezone conversions. again, not trying convert time, trying specify utc. if can great. thanks! example assume database_function() returns datetime data type '2013-06-01 01:06:18' datetime = database_function() epoch = datetime.strftime('%s') pytz.utc.localize(database_function()).datetime.strftime('%s') datetime.replace(tzinfo=pytz.utc).datetime.strftime('%s') both of these return epoch timestamp of 1370077578 but, should return timestamp of 1370048778 per http://www.epochconverter.com/ remember, timestamp utc timestamp using fabolous pytz : import datetime, py...

html button not working -

this simple html code, i've started learning writing these. of physical attributes working gui, of buttons not functional. 1st-works, 2nd-not working, 1st radio-works(sort of, answer missing y information), 2nd radio-not working, 3rd button-not working. insight might doing wrong appreciated!! <html> <head> </head> <body> <form name="form1"> <table> <tr> <td> <b><font color="00ff00">enter value a</font></b> </td> <td> <input type="text" name="box1" style="width:100%; background-color:c0c0ff; color:00ff00" size="8" value="0" onchange=""/> </td> </tr> <tr> <td> <i><font color="00ff00">enter value b</font></i> </td> <td> <input type="text" name="box2" style="width:100%; background-color:c0c0ff; color:00ff00...

Using array of pointers to object in C++ -

i need save objects pointers in dynamic array have problem. code, there 3 classes , need have array (arrayoftwo) of poiters class 2 work further class 3 , on. have 2 problems. 1 cant figure out how dynamically allocate space arrayoftwo (which need dynamically resize number of stored pointers) , second problem how store pointers objects without destroying object itself. here code: #include <cstdio> #include <cstdlib> #include <cstring> #include <iostream> using namespace std; class 1 { public: bool addtwo(int a); private: void getspace(void); class 2 { public: int a; private: class 3 { /*...*/ }; 3 arrayofthree[]; }; int freeindex; int allocated; 2 *arrayoftwo[]; }; void one::getspace(void){ // how allocate space array of pointers ? arrayoftwo=new *two[100]; allocated=100; } bool one::addtwo(int a){ 2 temp; temp.a=a; getspace(); arrayoftwo[freei...

jQuery: hide and show for div's -

i want show div 3 sec. , show next div 3 sec. , continue timer. code not working if there other code solve problem. var timer = setinterval(showdiv(3000)); var counter = 0; function showdiv() { if (counter ==0) counter++; $('#text1, #text2').stop().hide().filter(function() { return this.id.match('#text' + counter); }).show(); counter == 2? counter = 0 : counter++; } showdiv(); }); the filter function should return boolean value if element matches or not. here this.id.match returns array result of regular expression execution. instead of using function filter, can simplify this: setinterval(showdiv,3000); var counter = 0; function showdiv() { if (counter ==0) { counter++;} $('#text1, #text2') .stop() .hide() .filter('#text'+counter) .show(); counter == 2? counter = 0 : counter++; }

How to load dynamic contents to slider drawer in android? -

hi had created android app contains slider drawer.i want add dynamic contents slider drawer(load image,text server etc )when app runs .is possible?? please me , :) i have written demo on github .in demo,the navigationdrawerfragment file slider drawer ,the main list in drawer come code spinnet : mdrawerlistview.setadapter(new arrayadapter<string>( getactionbar().getthemedcontext(), android.r.layout.simple_list_item_1, android.r.id.text1, new string[]{ getstring(r.string.title_section1), getstring(r.string.title_section2), getstring(r.string.title_section3), })); so replace data load function , load dynamic contents in file.: public void loaddynamicdata(){ //1. show progress bar when data not ready. //2. use asynctask load data in background. //3. when data ready,replace progress bar data. } if want add actionbar-pulltorefresh libra...

android - How can I do automation tests using real mobile devices in rails -

i using webdriver-user-agent perform automation test in rails. the available options are: :browser :firefox (default) :chrome :agent :iphone (default) :ipad :android_phone :android_tablet :orientation :portrait (default) :landscape how can check automation request using real mobile devices such android/iphone/ipad,etc. that gem used mimic device's resolution/user-agent responsive design testing. can't run tests on actual device it. if want test web application on mobile browser, webdriver-user-agent should enough. for testing on device, you'd need appium .

c# - DateTimePicker Loop Through Weks -

i have 2 datetimepickers: startdate , enddate i need how loop through weeks between 2 dates. example weeks between 02/01/2013 - 02/01/2014. i want loop start @ 02/01/2013 , increment 7 days on each iteration until gets end date. i've been trying think of way achieve can't find solution. is possible? solved: for (datetime = datestart.value; <= dateend.value; = i.adddays(7)) { // on each iteration } will update answer in 8 hours. won't let me answer own question. here 1 way approach this: var startdate = new datetime(2013, 2, 1); var enddate = new datetime(2014, 2, 1); var totaldays = enddate.subtract(startdate).totaldays; // determine total number of weeks. var totalweeks = totaldays / 7; // initialize current date start date var currdate = startdate; // process each of weeks (var week = 0; week < totalweeks; week++) { // // next ...

java - Android Publish/Subscribe Singleton Example -

can provide simple example of using publish/subscribe singleton pattern pass information between fragments. last week asked passing data between fragments scenario below , method suggested; can't seem wrap head around it. i have application using navigation drawer layout, various "sub applications" perform standalone functions (for example, calculators app, unrelated "sub apps" income tax calculations, metric/imperial conversions, etc). given calculator, i'd have data entry/selection fragment , data presentation fragment displays calculation in meaningful type of way. thus, activity in application mainactivity, holding navigation drawer , content pane. question is: best way design application such various calculators pass data data representation fragments, on click of button? all examples in internet s...ks, uml diagrams absolutely unclear beginners , plenty of code experienced 1 can understand why using not that, 1 n...

python - Tweepy CustomStreamListener Class -

i have following code have made amendments class 'customstreamlistener': import sys import tweepy consumer_key="" consumer_secret="" access_key = "" access_secret = "" auth = tweepy.oauthhandler(consumer_key, consumer_secret) auth.set_access_token(access_key, access_secret) api = tweepy.api(auth) class customstreamlistener(tweepy.streamlistener): def on_status(self, status): hashtag in status.entities['hashtags']: if hashtag == 'turndownforwhat': print(hashtag['text']) print status.text def on_error(self, status_code): print >> sys.stderr, 'encountered error status code:', status_code return true # don't kill stream def on_timeout(self): print >> sys.stderr, 'timeout...' return true # don't kill stream sapi = tweepy.streaming.stream(auth, customstreamlistener()) sapi.fil...

Using Indexes in mysql do not improve query time -

i have sql query: select frage_id session_fragen ( userantwort1 = 0 , userantwort2 = 0 , userantwort3 = 0 , userantwort4 = 0 , userantwort5 = 0 ) , session_id = 17898 order sessionfrage_id asc limit 1; in beginning query run slow. added index improve speed. bevor using indexes scanned approx. 500.000 rows ... after using indexes reduced rows approx. 550 (depends on results) query still takes more 2 sec. run. i hope has improvementtips me... tanks lot! sql explain: id select_type table type possible_keys key key_len ref rows 1 simple session_fragen index session_fragen_big_index_2,session_fragen_big_inde... primary 8 null 535 using show indexes: session_fragen 0 primary 1 sessionfrage_id 626229 null null btree session_fragen 1 frage_id 1 frage_id 3479 null null btree session_fragen 1 session_fragen_big_index_2 1 userantwort1 ...

java - clone() method in LinkedList -

i learning java , going on collections framework currently. trying out api methods linkedlist , facing problem clone() method. below code import java.util.list; import java.util.arraylist; import java.util.collection; import java.util.listiterator; import java.util.linkedlist; public class linkedlisttest { public static void main(string[] args) { string[] colors1 = {"red", "blue"}; list<string> color1list = new linkedlist<string>(); for(string color:colors1) color1list.add(color); list clonedlist = (linkedlist) color1list.clone(); } } when compile program, following error: linkedlisttest.java:51: cannot find symbol symbol : method clone() location: interface java.util.list<java.lang.string> list<string> clonedlist = (linkedlist<string>)color1list.clone(); ^ 1 error i tried lookup u...

c - Varying number of maximum arguments, and diffrent failure results -

what maximum number of arguments executable on linux x64 ? i have reviewed: http://www.in-ulm.de/~mascheck/various/argmax/ https://psomas.wordpress.com/2011/07/15/arg_max-and-the-linux-kernel/ edit: according fs/exec.c 210-216: /* * limit 1/4-th stack size argv+env strings. * ensures that: * - remaining binfmt code not run out of stack space, * - program have reasonable amount of stack left * work from. */ the stack has soft limit of 8mb, , and no hard limit according ulimit, , getrlimit(). with constant environment variables, , homogeneous arguments (all "1\0"), number of arguments can run program varies. 2 diffrent behaviors when program fails run: segfualt the string "killed" printed console the maximum number of arguments can run program goes after previous runs, towards maximum. running program multiple times in row, if haven't exceeded maximum eventaully result in sucess. in 1 case 838325 arguments...

crash - wpf application go to not responding while working -

i have wpf application. while move 1 page take time (around 16 sec). checked resource manager @ time, if user wait application go not responding stage , come automatically if user click application crashed. application load ui check type in xml file , control names on page load depend on last page language. 1 language texts in resource of application , other language texts on page. while page load, check application culture t load control texts. got problem in machines not machines. can suggest solution?

in Ruby, conversion of float integer into %H %M %S time -

how convert float, 13.5, corresponding 24-hour time %h:%m:%s? (13.5 13:30:00, 8.25 8:15:00) i'm still figuring time class...it confuses me sec = (13.5 * 3600).to_i min, sec = sec.divmod(60) hour, min = min.divmod(60) "%02d:%02d:%02d" % [hour, min, sec] # => "13:30:00"

PHP: Error handling without throwing an exception -

i'm sending multiple emails php application, , want inform user of emails failed sent. what elegant way error handling when i don't want throw exception terminates sending of remaining emails the call goes through several method calls what want $notificationsucceeded suggestion::notifydeletiontoall() suggestioncontroller somehow nicely notifications. the depth of call stack made me doubt if returning through methods elegant way, when have return value suggestion::cancel(). is there better way? controller: class suggestioncontroller { function cancelsuggestion($suggestionid) { $suggestion = new suggestion(); $suggestion->fetch($suggestionid); $suggestiondeleted = $suggestion->cancel(); print json_encode(array( 'status' => 'ok', 'suggestiondeleted' => $suggestiondeleted, )); } } suggestion class: class suggestion { /** * cancels memb...

javascript - Stay in the same position after a jQuery's slideUp -

when click div (x) , expands using .slidedown() , height increased, when detect scroll pass element (when x no longer in viewport) , using inview plugin, close .slideup() , increased height goes normal state, instead of being @ (y) , i'm @ (z) after .slidedown() x x x x y <-- arrive here scrolling y z z after .slideup() x x <-- height decreased y <-- instead of being here.. y z <-- i'm here. z how can stay in same position after element's height decreased? demo whenever .slidedown() triggerd current srolltop position of page , set scroll position after .slideup() triggered. can use below code. //get current position of page var pageposition = $(window).scrolltop(); //set page position after `.slideup()` called $("html,body").scrolltop(pageposition);

c# - Update / Insert to SQL table using datatable with column mappings -

i'm wanting bulk copy of data 1 database another. needs dynamic enough when users of source database create new fields, there minimal changes @ destination end(my end!). i've done using sqlbulkcopy function, using column mappings set in seperate table, if new created need create new field , set mapping (no code or stored procedure changes): foreach (var mapping in columnmapping) { var split = mapping.split(new[] { ',' }); sbc.columnmappings.add(split.first(), split.last()); } try { sbc.writetoserver(sourcedatatable); } however, requirements have changed. need keep more data, sourced elsewhere, in other columns in table means can't truncate whole table , write sqlbulkcopy. now, need able insert new records or update relevant fields current records, still dynamic enough won't need code changes if users create new fields. does have ideas? comment on original question mdisibio - looks sql merge statement have been answer.

logging - Injecting Logger in Symfony 2 ODM Documents -

i developing symfony 2 application , want log when setters called in models. as see, there no way inject logger default or access via static registry in symfony 2, approach follows: i added static method , property base class of models , set logger there. added getter, available in models. i set logger in there via request kernel event, logger available after event. this solution works seems rather hacky me. got better idea how approach this? setup method not rely on request kernel event nice. method not rely on static properties nicer! attention! adding logger base document may lead issues serialization. i put second argument setter: supposing have entity solution ti following: //namespace declaration above class someentity { .... private $somefield; public function setsomefield($somefield,loggerservice $l) { $this->somefield=$somefield; $l->log(""somefield has been set""); } } note: instead of loggerservice re...

oop - how to define a custom method on the javascript object class -

i going on javascript parts , came across example, author trying explain how able call superclass: object.method('superior', function (name) { var = this, method = that[name]; return function ( ) { return method.apply(that, arguments); }; }); an example of using code: super_get_name = that.superior('get_name'); however chrome wouldn't recognize method on object. tried doing same thing using defineproperty didn't work either.. help? update : method cause known conflicts jquery? put following @ first js file in page: i error in line 2062 in jquery-1.11.0.js : uncaught typeerror: object function (name) { var = this, method = that[name]; return function ( ) { return method.apply(that, arguments); }; } has no method 'exec' this effected code: // filters ( type in expr.filter ) { if ( (match = matchexpr[ type ].exec( sofar )) && (!prefilters[ type ] || ...

ruby on rails - How to include criteria from a different model to a where clause? -

i have 2 models: employee , vote employee has_many votes vote belongs_to employee the employee model has badge_number attribute. how can retrieve votes belong employees badge numbers greater 1000? this work if employees table named according rails conventions. vote.joins(:employee).where('employees.badge_number > 1000') since name employee , work: vote.joins(:employee).where('employee.badge_number > 1000')

javascript - Exclude a class from fired event jquery -

i have table has on keyup events being fired if dynamically generated inputs modified exclude classes of input in table row events, have tried 2 options , both have failed $(document).on('keyup', '.tg > tbody > tr:not(.pd1)', function() {}); $(document).on('keyup', '.tg > tbody > tr:not(".pd1")', function() {}); //added quotes pd1 class sugestions! instead of registering event tr, use input $(document).on('keyup', '.tg > tbody input:not(.pd1)', function() {});

Using javascript to set Struts select list headerKey and headerValue -

i have struts select list use javascript set selected option default headerkey , headervalue specified when creating item. unable option set. under select list: struts select list <s:select id="relationshiptypeid" name="relationshiptypelist" headerkey= "0" headervalue="select relationship type" list="relationshiptypelist" listkey="id" listvalue="relationshipname"/> javascript this not work sets display item 0 default headerkey , headervalue. document.getelementbyid('relationshiptypeid').value = 0; this worked me after posted question document.getelementbyid('relationshiptypeid').setattribute('value',0);

postgresql - Why a npgsql query get a different now value as direct server query -

i'm trying execute stored procedure in postgres using .net , npgsql return now() value. running .net strsql = "select aa_realtime2();" cmd = new npgsqlcommand(strsql, connread) strsql = cmd.executescalar() i "2014-04-07 22:07:33.015+02" but if run server select aa_realtime2(); i "2014-04-07 15:38:11.734-04:30" my local time gmt -4:30 server ok. postgres , .net app on same pc. to me both values similar time given in different time zones. i'd quote http://www.depesz.com/2014/04/04/how-to-deal-with-timestamps/ because discusses similar issue. […] well, whenever dealing timestamptz values, if timezone not specified – postgresql uses configured timezone. and can configure in multiple ways: timezone “guc" in postgresql.conf alter database … set timezone = ‘…' alter user … set timezone = ‘…' set timezone = ‘…' first 1 used specify in timezone server is. or – default timezone used un...

oracle - NEXT_DAY in Crystal Reports -

is there oracle "next_day" function available in syntax crystal reports uses? i'm trying write formula output following monday @ 9:00am if datetime tested falls between friday @ 9:00pm , monday @ 9:00am. so far have if dayofweek ({datetimefrommydb}) in [7,1] or (dayofweek({datetimefrommydb}) = 6 , time({datetimefrommydb}) in time(21,00,00) time(23,59,59)) or (dayofweek({datetimefrommydb}) = 2 , time({datetimefrommydb}) in time(00,00,00) time(08,59,59)) ... i know can write seperate if statements different amount of dateadd each of fri, sat, sun, mon, if can keep concise lumping of these 1 prefer it. i'm going adding additional rules if datetime falls outside of business hours on other weekdays want as possible prevent becoming overgrown , ugly formula. since there no cr equivalent know of, can cheat , borrow next_day() function oracle database. can creating sql expression , entering like: -- sql expression {%nextday} (select next_day(...

shell - Two while loops behaving strangely, Bash script -

i'm new bash scripting. have written script me info using ssh bunch of servers. ip address of first set of devices 101 148, , other set 201 210. #!/bin/bash base=192.168.11 sd_start=101 sd_end=148 hd_start=201 hd_end=210 sd_counter=$sd_start hd_counter=$hd_start while [[ $sd_counter -le $sd_end ]] ip=$base.$sd_counter ssh $ip command1 sd_counter=$(($sd_counter +1)) if [ "$sd_counter"==148 ] while [[ $hd_counter -le $hd_end ]] ip=$base.$hd_counter ssh $ip command2 hd_counter=$(($hd_counter +1)) done fi done > log_sd_hd echo "done!" but reason command1 executed on 192.168.11.101 first, command2 executed on ip range 192.168.11.201-192.168.11.210 second while loop. after first while loop continues till end. why happening? want first while loop done before second while loop. please point out i'm doing wrong? @0x1cf's answer provides right poin...

Add user review to Google map from my application(Android) -

i trying create location-based services android application. had getting user reviews google places api following guidance link. https://developers.google.com/places/documentation/details i found many posts regarding how user reviews google places. want create function user can insert reviews application. there anyway that? thanks. no. there no api writing review. google+ mobile url doesn't have write review option last year. bug , google not fixing this. there 1 way write review through desktop url. have similar location base app in play store have done workaround show desktop site write review.

android - getDrawingCache causes app to freeze -

my app freezing on initialization. have narrowed down related getdrawingcache() call in snippet.. when take out, problem disappears. public shot getscreenshot(view view) throws drawingcacheexception { view.setdrawingcacheenabled(true); bitmap bitmap; try { bitmap drawingcache = view.getdrawingcache(); if (drawingcache == null) { throw new drawingcacheexception("cannot bitmap drawing cache"); } bitmap = bitmap.createbitmap(drawingcache); } { view.setdrawingcacheenabled(false); } //do postprocessing } the problem context. working, , haven't touched code @ all, did refactor class called it. and before mentions it, yes, running on activity's ui thread. i've quadruple-checked. so, interacting code cause freeze? the problem screenshotting, encoding afterwards, slow freezing app. not happening often, increasing delay fixed problem. time work on perf!

sql - Combining countries in a region and displaying it on the same column -

is there way combine countries groups , displaying them in same output column? don't want manipulate raw database. e.g. austria 10 belgium 30 switzerland 25 now at, be, ch group-1 countries, , in output want display below: austria 10 belgium 30 switzerland 25 group-1 65 select country_name, val country_table union select 'group-1' country_name, sum(val) val country_table you should add grouping , union both queries.

javascript - copyValue from another collection in MongoDb -

can copy field collection collection? i want copy values of bar foo collection, don't want type filed, , want insert in foo e new _id e field (userid) ( use node.js) collection bar { "_id" : objectid("77777777ffffff9999999999"), "type" : 0, "name" : "default", "index" : 1, "layout" : "1", } collection foo { "_id" : new object id, // "type" : 0, no in collection "userid" : objectid("77777777ffffff9999999911"), "name" : "default", "index" : 1, "layout" : "1", } i try db.bar.copyto("foo"); copy entire collection actually best option. when don't want new field in collection, remove using $unset : db.foo.update({ },{ "$unset": { "type": 1 } },false,true) that remove field documents in new collection in 1 stat...

Closing Excel from within Delphi -

would assist i'm sure basic error on part please. my goal open excel spreadsheet (invisibly), populate it, attach email, send , close everything. it close complete, except excel remains open - in task manager - after process complete. the block of code is: procedure tfmain.sendemail; var i, j, r: integer; vbody, vsavever: string; vattach: tidattachment; vmftqty: array [1 .. 2] of integer; vqtytot: array [1 .. 12] of integer; vnettot: array [1 .. 12] of real; oxl, owb, osheet: variant; begin idmessage1.from.address := 'sage@valid-email.co.uk'; idmessage1.from.domain := 'valid-email.co.uk'; idmessage1.from.text := 'sage <sage@valid-email.co.uk>'; idmessage1.subject := 'sage'; try sqlquery1.close; sqlquery1.sql.clear; sqlquery1.sql.add('select comp,dept,e_addr acc_email dept="' + emailquery.fieldbyname('dept').text + '"'); sqlquery1.open; while not sqlq...

webforms - Java ResourceBundle loads strings from wrong file -

i create jar file enbedded , called applet asp.net web forms application. i use resourcebundle load localized strings properties. i created 3 properties files: localizedstrings.properties localizedstrings_de.properties localizedstrings_en.properties and load strings with resourcebundle labels = resourcebundle.getbundle("localizedstrings", locale.german); however strings loaded strange location : login.aspx (which in same directory applet.jar) when call collections.list(labels.getkeys()).get(0) i see contents of login.aspx in there, unusual, have tried other bundle names , same results. what problem here? i not strange location. since haven't provided location really, natural place java classpath. if want change somehow, need use qualified name base name, i.e.: resourcebundle.getbundle("com.my.company.localizedstrings", locale.german); the doubt have, since use j# whether work. should.

javascript - jQuery on click starts working correctly after second button click -

(fiddle: http://jsfiddle.net/qdp3j/ ) i have div: <div id="addcontactlist"></div> i use ajax , change innerhtml like: <div id="<%= data[i].id %>"> <img src="<%= picture %>"> <button class="addasfriend">add friend</button> </div> in js, have $('#addcontactlist').on('click', '.addasfriend', function () { $(this).text('request sent!'); $(this).attr('disabled','disabled'); }); what happens when click on button first time, see click function ran; "request sent!" being shown reverts initial button. when click second time, works fine. i tried using event.stoppropagation , preventdefault same issue happens. as stated, comes ajax part: basically, have 3 input fields on page, , users can enter data in them. if there data in fields, posted , use data query database. there delay function of 250ms prevent post...

ajax - Rails js.erb response not sending locals to Haml partial -

i realize similar other questions, have been through fair number of , think i'm doing suggested, code still not working. so, title says, i'm attempting load partial js.erb file (in response ajax call.) however, not working correctly. full_list.html.haml: =link_to(test_path(@work), id: "privacy-button", remote: true) = render "privacy_button_content", locals: {:show_others => @work.show_others} _privacy_button_content.html.haml: -if locals[:show_others] == false -test_string = "twas false" -else -test_string = "twas true" %p = test_string works_controller.rb: def test_function @work.model_function respond_with(:layout => false) end test_function.js.erb: $("#privacy-button").html("<%= escape_javascript render(:partial => 'privacy_button_content', locals: {:show_others => @work.show_others}) %>"); so full_list has privacy_button, rendering partial, , r...

java - weblogic sample/example code -

i have tried couple of different installs here http://www.oracle.com/technetwork/middleware/weblogic/downloads/wls-for-dev-1703574.html but dont sample java code/apps in them they keep saying use "complete installation" or see below screens, dont select checkboxes - installs oepe , weblogic, no samples! http://docs.oracle.com/cd/e24329_01/doc.1211/e24492/install_screens.htm you need create blank domain , extend domain template http://docs.oracle.com/cd/e24329_01/web.1211/e24495/templates.htm#cihhfeag by default wlserver/samples has nothing in it after creating domain - source found in c:\share\weblogic\wls1212\user_projects\applications\examplesdomain\examples\src

drupal 7 Displaying data from different content type in single row in views using relationships -

i have taxonomies group , category hobbies, cv , have 3 content types. 1st content type company has field project code , has field called cv of type term reference taxonomies cv. there field called group , category both term reference of taxonomy group , category similarly have field called rm entity reference of type user , account manager entity reference of type user. another content type called cxo has fields name , number, , hobbies term reference taxonomy hobbies. in have field company entity reference of content type company created above person belongs 1 among companies. last content type coordinator has same fields cxo , has hobbies term reference. cxo have field company entity reference of content type company. so wanted view fields in 1 table. like project code, company , cv , category , group , rm , name cxo , number cxo , hobby cxo , name coordinator , number , hobbies of coordinator. all these data wanted come in single row, 1 project have these deta...

JS Bigquery example working in chrome/firefox but not in IE? -

the below example given in google developers, working in chrome/firfox out having issues not in ie , using ie version#11 (latest) in windows 8.1. the chart not displaying in ie , java script error getting.![enter image description here][1] note: 1. similar error getting when use google developers-json example also...to fetch records bigquery , showing in table...like executing in chrome/firefox not in ie??? 2. if possible can please provide , asp.net web application example, connect google bigquery , showing data in gridview c#.net (not asp.net mvc) <html> <head> <script src="https://apis.google.com/js/client.js"></script> <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script> <script type="text/javascript" src="http://www.google.com/jsapi"></script> <script type="text/javascript"> google.load('visualization', '1', { p...

How to give url to an asp.net image control where, image reside outside the application -

i want show image on website folder outside asp.net application on desktop. have tried not uploading image. <asp:image id="image2" runat="server" imageurl="c:\users\myname\desktop\images\0.jpg" /> is there other way give path. wrong doing. please advise. in advance.

c# - Microsoft.SharePoint.Portal.WebControls and Microsoft.Office.Server.UserProfiles -

i trying programmatically (c#) upload profile picture sharepoint. dont have sharepoint installed in system. came know microsoft.sharepoint.portal.webcontrols , microsoft.office.server.userprofiles dll's required achieve it. now question can include these dll's in folder , reference visual studio work me or installation of sharepoint must ? please help. can body provide alternative solution if in case doesn't work? what kind of solution developing? if want server-side solution need sharepoint farm debug , test anyway. maybe reference sharepoint dlls on local machine , compile project (i never tried this), face strange errors deploying later). option can create virtual machine, install there windows server , sharepoint in standalone mode development purposes. if want independent application communicate sharepoint, check out using client object model . doesn't depend on sharepoint libraries. as alternative can consume sharepoint web services manual...

sql - Use of + sign in query -

i came across (+) sign in 1 of queries , after research understood means left outer join. however, not able understand query. please rewrite query without (+) sign. select e.masterid streamed_events e, masters_encode m e.masterid = m.id (+) , company_id_r = m.company_id(+) , m.id null , m.company_id null thanks help.... the plus sign denotes optional table in join select e.masterid streamed_events e left outer join masters_encode m on e.masterid = m.id , company_id_r = m.company_id m.id null , m.company_id null documentation

How can bootstrap plugin disable for desktop -

i want disable bootstrap jquery plugin desktop , reinitialize on mobile, how can achieve when testing on desktop. there way. i didnt found pre built solution plugin, while foundation provide functionality data-interchange. @thelittlepig thanks.... using collapse plugin. i have figure out how achieve this, using responsive layout classes, example have fixed below: <h3 class="panel-title"> <span class="hidden-xs">flight details</span> <a class="visible-xs" data-toggle="collapse" data-parent="#accordion" href="#collapse-flight-details">flight details</a> </h3> <div id="collapse-flight-details" class="panel-collapse collapse in"> <div class="panel-body">hi</div> </div>

core data - How can I update the attributeMappings for RKObjectMapping -

because have core data objects same domain objects coming server using following code automatically setup mapping: rkobjectmapping *mapping = [rkentitymapping mappingforentityforname:entityclassname inmanagedobjectstore:managedobjectstore]; // list of attributes nsentitydescription* entityinfo = [nsentitydescription entityforname:entityclassname inmanagedobjectcontext:managedobjectcontext]; [mapping addattributemappingsfromarray:[[entityinfo attributesbyname] allkeys]]; later, because there 1 attribute specific need update mapping.attributemappings array. can not remove/clear old array read only. there official way how update array? no, create new mapping (and different response descriptor such switch between them without changing configuration of object manager). technically, subclass rkobjectmapping , or add category it, , modify mutablepropertymappings achieve goal.

asp.net - Run Web service as windows service -

i've got 1 silly question, forgot right words explain: how build web service (asp.net) runs on server non-stop, doing windows service? background worker, or should use timer ? though doesn't make complete sense have web service automatic continuous stuff w/o being called, this: host service in wcf. when service host started, start timer based event , work in task. have appropriate error handling. this ensures web service available servicing client requests. if #4 not valid, rethink web service , have windows service.

What is the file format of a git commit object? -

context: hoping able search through git commit messages , commits without having go through puzzlingly complex git grep command, decided see how git commit messages stored. i took in .git folder, , looks me commits stored in .git/objects the .git objects folder contains bunch of folders names a6 , 9b. these folders each contain file name looks commit sha 2f29598814b07fea915514cfc4d05129967bf7. when open 1 of files in text editor, gibberish. what file format gibberish / how git commit object stored? in git commit log, folder 9b contains 1 commit sha aed8a9f773efb2f498f19c31f8603b6cb2a4bc why, , there case more 1 commit sha stored in file 9b? is there way convert gibberish plain text can mess commits in text editor? before head down path further, might recommend read through the section in git manual internals . find knowing contents of chapter difference between liking git , hating it. understanding why git doing things way makes of sort of weird comma...

Matlab Butterworth filter returing NaN -

i trying apply butterworth filter in matlab. have set filter follows: [z,p,k] = butter(5,[30/2000,1000/2000]); i.e. cut off below 30 hz , above 1000 hz (sampling @ 2000 hz) the input data column in larger matrix, a. i applying filter follows: m=filter(z,p,a(:,2)); and have tried: m=filtfilt(z,p,a(:,2)); a has 1577563 rows. filter returns real values around row ~1700 after entries nan. have tried extracting selection of values a(:,2) generate nan in m, on own, these return numbers, assuming length of a, rather specific values. seem instability in filter function, since start of nan differs on different tests. i have tried reducing order, similar results 2nd , 1st order filters. if there way happily upload data in a(:,2) not sure how in stackexchange. i have perfect void idea of trying do. well, there huge issues on code , in concept: the butter frequencies must half sampling frequency. implementing 15hz , 500hz sampling @ 2000hz, im sure not need,...