Posts

Showing posts from June, 2014

java - How do I save chronometer elapsed time in android app -

i'm developing sort of parking meter counter app few specific locations. app asks user (dropdown menu, saves column letter , number, a6) , shows screen given location, timer (chronometer class) counting 0 , price has paid on exit (calculated using elapsed hours * base price). this works nicely, until user or os kills app (task manager or memory management). then, next time user opens app, he's @ main menu , location, time , price has been lost. i need way save of user's information , able load on app restart. initially had thought save user's location , exact time chronometer started (datetime.now() maybe?) .txt file in internal storage read: mallname,columnletter,columnnumber,starttime this way, if app killed, or time app started scratch, mainactivity first check if file.txt exists in app's internal storage, if does, starts lastpage activity, reading .txt file pass values parameters (thus, comma separation). if there's no such file, carry on norm

python - Networkx: find way according to .dot file attribute -

i'm working digraph defined in dot language using networkx. need achieve this: x = networkx.read_dot('_t.dot') #loads dotfile def navigate_through_model(model, type): #model model, type -> string of desired 'comment' ..... return path if \__target\__== '\__main\__': print navigate_through_model(x, 'regression') # need return path, going through nodes comment == 'regression' (it can other attribute, comment question) and i'm kind lost in :( any appreciated. ok found (after sleep) can use weight of edges achieve same result. solution easy.. set lowest weight 'regression' path , generate shortest path. networkx(x, 'start', 'end', weight='weight') in order have edit networkx/algorithms/shortest_paths/weighted.py there kind of bug on row 342. vw_dist = dist[v] + edgedata.get(weight, 1) you have change to: vw_dist = dist[v] + float(edgedata.get(weight, 1)) #i

build - eclipse java project .class path reference ssue -

i imported javafx project eclipse helios. throwing out below error. "the project not built since build path incomplete. cannot find class file java.util.function.function" i had tried possible solutions like restarting eclipse cleaning project uninstalling other jres except jre1.8 javafx supported jre 1.8 removing , adding jre 1.8 removing unnecessary lines .classpath still same error seen in eclipse. me out in resolving this thank you

clojure - Ring/Compojure serving index.html in subfolders? -

my ressources/public directory contain many subfolders , each 1 contain index.html. how set routes watch ".../" path recursively , return index.html without showing file in url? one way explicitly set each route below i'm hoping not need define each path. (get "/" [] (resource-response "index.html" {:root "public"})) (get "/foo" [] (resource-response "foo/index.html" {:root "public"})) ... a small modification ring wrap-resources middleware trick: (defn wrap-serve-index-file [handler root-path] (fn [request] (if-not (= :get (:request-method request)) (handler request) (let [path (.substring (codec/url-decode (:uri request)) 1) final-path (if (= \/ (or (last path) \/)) (str path "index.html") path)] (or (response/resource-response path {:root root-path}) (handler request))))))

Rails: How do I pass a global variable from routes to controllers and helpers? -

i have rails app handles 2 domains. app set described in this blogpost . based on base url visited, routes.rb determines controller , action should triggered. the 2 domains share lot of files, e.g. layouts/application.html.haml , layouts/footer.html.haml , etc. in layouts/application.html.haml need reference different navigation files. write: = render "layouts/navigation" but multiple domains wish write like: = render "layouts/#{domain_constraint}/navigation" ... domain_constraint here depending on domain constraint matched in routes. so how pass on constraint routes, later on access constraint in helpers/application_helper.rb method , controllers/application_controller.rb method? in blog post referenced... looks request.domain should available within controllers , views. meaning should able key off of value of request.domain request header rendering layout. = render "layouts/#{request.domain}/navigation" then, suggest m

objective c - Best practice for asynch loads that may be same address -

i download images amazon's web services uitableview. use singleton cache recent images. wondering how best handle situation where, example, have 2 cells in view , both using same key (url same scenario if using nsurlsession). there's no need download image twice, checking cache not return result first download not complete when second 1 begins. current logic use additional nsdictionary singleton contain key each image downloading, not complete. check against after checking cache, , if key exists, add reference of uiimageview key's array - when download complete, array can utilized update uiimageviews referenced in array. isn't "clean" way in opinion - there better practice handling this? while question more conception, here's current code: custom_image_view.m -(void)set_image:(nsstring *)key desired_size:(cgsize)desired_size { singleton *caches = [singleton instance]; if (!key.length || [key isequaltostring:@"0"]) { return; } if (![ca

javascript - Outputting human readable times from timestamps on blockchain.info -

i want parse timestamps json responses blockchain.info's api. here example snippet https://blockchain.info/api/api_websocket so if at "time": 1331300839, i try , like var test = new date(1331300839); test.getfullyear(); and results circa 1970. i've tried using date object parse recent bitcoin transactions.. https://blockchain.info/rawaddr/1hy8lsovpit3z4qf7hr2pijxzfhzpsbaek , i'm still getting 1970. so how human readable output these timestamps? thanks. if wanna format date , times, best light-weight library can find out there moment.js var parsed = moment.unix(1331300839) now format moment instance, use format want list: http://momentjs.com/docs/#/displaying/ or use simple yet powerful moment.tostring() or moment.fromnow() parsed.tostring() // "fri mar 09 2012 14:47:19 gmt+0100" parsed.fromnow() // "2 years ago"

cocoa - OSX. Document & Window Controller design. How to interact with model -

Image
i working on personal os x app, using cocoa, , have trouble designing interaction between document , window controller. this summary of have far: a document (nsdocument subclass), owns "model data", , in charge of loading, saving data from/to files, etc. a window controller (nswindowcontroller subclass), attached document, creates window, , takes care "model data" displayed user. now, question: how window controller , document interact? more specifically: when event happens in view (e.g. user enters data), how window controller reaches model? see 2 options: the window controller takes care of updating data in model. seems straightforward, creates caos in how model accessed, since document 1 should manage model data. the window controller sends request document, , document takes care of updating model. keeps things more clear conceptually, implementation feels weird: window controller call document's "applychange:" method, , documen

Is there easy way to build privileges and users in Access forms project? -

i'm building access forms, need implement privileges users, there easy way achieve in access out writing many vba ? i'm using access 2013 .mdb files access database. if you're using .mdb file, can secure database using user-level security. there's plenty of information available how implement it, best place start search file "user-level security". assuming you've created .mdb, click on file tab, go info section. click on users , permissions , "user level security wizard". guide through setting new workgroup file (.mdw) , assigning permissions. it recommendation focus on securing tables first. although can secure forms, won't of use if can't data display. when setting security, try work groups - don't assign permissions individual users, or you'll create lot of work yourself. you need aware ms discouraging use of .mdb files - default format .accdb, , recommend using sql server express data storage, provide

security - Keystone configuration file permissions -

i'm playing around juju , openstack , installed keystone identity service on 1 of nodes. ssh-ing machine noticed permissions of configuration file /etc/keystone/keystone.conf 644 ( rw-r--r-- ) means readable user on system. keeping in mind file contains mysql username , password, wouldn't right file readable keystone user? note i've tried installing using both juju , hand using fresh ubuntu 14.04 same results. edit: forgot mention openstack documentation doesn't mention permissions in docs . i don't think other openstack services use keystone.conf. may change ownership keystone , change permission keystone can read. chown keystone:keystone /etc/keystone/keystone.conf chmod 600 /etc/keystone/keystone

JPA and Hibernate : one to one mapping causes three select queries -

jpa 2.0 hibernate 4.3.5 hi, following onetoone mapping (with example code assuming 1 customer can have 1 order) class customer { private order order; @onetoone(mappedby="customer", fetch=fetchtype.lazy) public order getorder() { return order; } public void setorder(order order) { this.order = order ; } } class order { private customer customer; @onetoone(fetch=fetchtype.lazy) @joincolumn(name="cust_id") public customer getcustomer() { return customer; } public void setcustomer(customer customer) { this.customer = customer; } } //calling code order order = em.find(order.class, 4); // line 1 system.out.println(order.getcustomer()); // line 2 </code> above calling code resulting in 3 select statements i.e line 1 causing select * order id = ? #1 line 2 causing following 2 statements select * customer id = ? #2 select * order cust_id = ? #3 my question: shouldn't 2 queries (i.e #1 ,

c# - How to to make /Home/Index redirect to / -

given default route, either of following urls navigate index method of home controller: 1. http://localhost 2. http://localhost/home/index i want make when user navigates localhost/home/index redirected localhost or presented not found result. ` my aim disable home/index address without removing default route (as useful in other places. i want achieve because have hard-coded relative urls in js work when relative localhost . the default route way, looks this: routes.maproute( "default", "{controller}/{action}/{id}", new { controller = "home", action = "index", id = urlparameter.optional } ); in route file, add this: routes.maproute( name: "homeredirect", url: "home/index", defaults: new { controller = "home", action = "index", redirect = true } ); in homecontroller public actionresult index(bool? redirect) { if

ios - property mapping not being associated correctly. Why? -

Image
edit 1 while understand particular scenario (and other alike) use mapping editor alone migrate store correctly values in persistent store don't jump around, that's not solution current problem avoids addressing root of problem. keen on sticking custom migration policy give me lot of control through migration process, future scenarious setting custom migration policy work me. long term solution , not scenario. i urge try , me solve current situation @ hand rather diverting me lightweight migration or advising me avoid using migration policy. thank you. i forward sorting out , valuable input/ideas on fix problem. what have done: have migration policy set source data can copied destination data version 1 of core model version 2 . this migration policy: - (bool)createdestinationinstancesforsourceinstance:(nsmanagedobject *)sinstance entitymapping:(nsentitymapping *)mapping manager:(nsmigrationmanager *)manager error:(nserror **)error { // create product manage

how to print this php array? -

in facebook api, have array. { "id": "587967941220651", "about": "", "can_post": true, ... and printed array this. $request = new facebookrequest( $session, 'get', '/page_name' ); $response = $request->execute(); // response $graphobject = $response->getgraphobject()->asarray(); // print profile data echo '<pre>' . print_r( $graphobject, 1 ) . '</pre>'; in web page, got results. array ( [id] => 587967941220651 [about] => [can_post] => 1 ... and time, have kind of array. { "data": [ { "id": "1444336682520148_1458726944414455", "from": { "id": "1444336682520148", "name": "james" }, "story": "james shared kevin's status update.", as see, there "data" in front. how can print kind of array? thank you.

printing - C# : Generate a document and print it? -

Image
there huge number of questions printing, no 1 of them want, here situation. what have : have 2 textboxes, , 1 picturebox (textbox1, textbox2, , picturebox1), , button (print). what want : want reorganise data entered text, picture, : and print them directly, or showing printdialog choose printer. pressing 1 button. what know till : know need use printdocument , printdialog don't know how. thanks in advance guys! when want print something, must specify coordinates each object want on page. there "automatic" way in .net 4 if i'm not mistaken, allows print application window, rigid , not reccomend it. have @ .pdf . examples vb.net it's same sh*... covers needs printing in .net.

Event::listen not catching laravel.query -

i pretty new laravel. working on rest api , trying @ queries being generated models. in routes have route group set up. route::(["before" => "auth", function() { route::model("juror_subject", "jurorsubject"); route::get("juror_subject", [ "as" => "juror_subject/index" "uses" => "jurorsubjectcontroller@index" ]); }); i wanted see query being run. watching video jeffrey way , mentions can use event::listen see query so. in routes: event::listen('laravel.query', function($sql){ var_dump($sql); }); however, when load url: localhost:8080/api/juror_subject it returns json response , never seems fire laravel.query event. am missing element needed event listeners work properly? type of routing using not firing query? if so, how go dumping queries using route group? laravel.query laravel 3 , use illuminate.query inste

javascript - build a post data structure from form with multiple variables -

i have form: <div class="form_style"> <input name="name" type="text" id="name" class="input username" placeholder="username" /> <textarea name="content_txt" id="contenttext" cols="45" rows="5" placeholder="enter text"></textarea> <input name="event_id" id="eventid" type="hidden" value="31"/> <button id="formsubmit">add comment</button> <img src="images/loading.gif" id="loadingimage" style="display:none" /> </div> i can post content_txt ajax php, data structure. how build data, variables? heres ajax code content txt: ar mydata = 'content_txt='+ $("#contenttext").val(); //build post data structure so wish pass 2 input (name, , event_id, testing yet.) and wish insert data sql database. everything working, con

How can I call a method from other Objective-C class? -

let's say, in a.h file: -(void)show; in a.m file: -(void)show{ //.... } in b.m: [self show]; how can call show b.m? imported a.h guess, has no effect. in order call method need instance of object on call method. example, if file a.h has class myclassa , call of show this: myclassa *instancea = [[myclassa alloc] init]; [instancea show];

return value - C++ - When is the destructor called for an object that is used but not assigned? -

example: std::unique_ptr<int> getptr() { return std::unique_ptr<int>(new int(5)); } ... void dosomething() { int x = 2 + *getptr(); } when destructor of unique_ptr returned getptr() called within dosomething? called after call 'operator+' or called once leave scope of 'dosomething'? thanks. the draft standard n3936 s12.2/3 says: temporary objects destroyed last step in evaluating full-expression (1.9) (lexically) contains point created. s1.9/10: a full-expression expression not subexpression of expression. s1.9/14: every value computation , side effect associated full-expression sequenced before every value computation , side effect associated next full-expression evaluated. note 8: 8) specified in 12.2, after full-expression evaluated, sequence of 0 or more invocations of destructor functions temporary objects takes place, in reverse order of construction of each temporary object. the full expression rhs o

java - How to get time difference between two dates in Android App? -

i'm trying implement time counter (counts 0) gets saved time variable (starttime, created user tapped button) , subtracts current time (calendar.getinstance() maybe?) result difference (in hh:mm:ss) between 2 times. method run on every tick of chronometer text view updated every second, creating timer. now, take roundabout route because it's way figure out conserve elapsed time if app killed. because starttime variable gets saved sharedpreferences it's created, , during each tick, system calculates timer on spot finding difference between starttime , current time. now, i've tried making starttime calendar variable , initialised such: calendar starttime = calendar.getinstance(); and then elapsedtime = starttime - calendar.getinstance(); but evidently, doesn't work. in similar project, written in c#, able work, albeit using datetime variable... there such way in android? if way convoluted, there better way conserve chronometer progress? please

Yammer API Find Pending Users -

is possible find list of yammer users in 'pending' state using api? (we have growing list of old invites need purged regularly) tried number of options: the find users endpoint, paging 50 per page seems return 'active' users (scanned 100+ pages). https://www.yammer.com/api/v1/users.json the find email endpoint returns user states, although requires knowing email. the export users api endpoint produces .zip file pending users added mentionable: https://about.yammer.com/yammer-blog/mentioning-pending-users-designing-building-testing-features-yammer should recent change have made pending users visible via users.json endpoint ? i know pending users can identified in manual user.csv extract having no join date, no deletion , no suspended date, although how can identified via api? users.json seems not provide functionality. has been able automate deletion of pending users in yammer via api? you can use data export api. extract users.csv zip file u

jquery - Verify if checkbox checked property is not empty using JavaScript -

i want verify checkboxes checked property. if of them not checked, display sentence in span: "you should select 1 of them" , when choose 1 of them, message must disappear. <form method="get"action="#" onsubmit="return vali();"> <span id="textspan" style="color:red"></span> <input type="checkbox" class='gender' id="male">male <input type="checkbox" class='gender' id="female">female <input type="submit" class="validate" value="send" /> </form> function vali() { var bool = true; var checkedcount = $('input[class="gender"]:checked').length; if (checkedcount == 0) { $("#textspan").html('select 1 of them'); bool = false; } if(checkedcount >= 1) { $("#textspan").html('');

pandas - Sorting data on column -

how sort dataframe based on first column in multiindexed column? mypivot url status 200 301 302 304 404 ip 900.43.91.8 1 1 1 nan 1 07.167.103.22 18 nan nan nan 1 17.211.102.92 18 nan nan nan 2 17.216.172.5 21 nan nan nan 1 18.151.211.10 19 nan nan nan 2 25.18.235.210 12 nan nan nan nan 34.139.155.135 733 2 nan 301 53 11.216.235.175 8 nan nan nan nan 7.228.106.211 18 nan nan nan 1 2.104.61.135 18 nan nan nan 1 9.58.151.168 2 nan nan nan nan 6.249.67.53 nan nan 1 nan 2 6.249.67.66 1 2 nan nan nan 6.249.67.79 1 nan 1 nan 1 9.37.224.70 1 nan nan nan nan 6.110.226.29 1 1 1 nan nan the ip address 34.139.155.135 should @ top because has maximum number 200 status. i have tried following 3 statements none of them sorting on 200 status column. mypivot.sort() mypivot.sort(ascending=false) m

Securing the connection between android and php -

i developing android app user can signup using android facebook sdk. using google volley library make http requests php page receive json data mysql database. want store personal information user , retrieve them later database. spent entire day looking on google ways on how secure android-php connection. 1 of popular solution came across send hash key post request , verify hash key via php. so: if($_post['secret'] != '3ch6kncsymva2fdghfdfgmf3jqmuctcm') { header('http/1.1 403 forbidden'); error_log("error: wrong secret: " . $_post['secret']); exit("access denied"); } the problem code above hackers can de-compile apk file , @ code , figure out key hash is. since don't have custom login system username , password authenticate user, can use secure connection between android , php? need example or link tutorial or suggestion established solutions such problem. this question isn't new on stack overflow, other s

javascript - Unable to call a specific Jquery tab -

i new jquery. trying build sign page website. had used jquery verticle tabs display login- tab 1, register- tab-2, , guest tab3. issue have hyperlink on log in tab says "dont have account- sign up".when clicking on hyperlink supposed go register tab in same page. i did try giving hyperlink getting appended in url not going tab. below code. please help. ![ <%@taglib prefix="html" uri="/web-inf/struts-html.tld" %> <%@taglib prefix="logic" uri="/web-inf/struts-logic.tld" %> <%@taglib prefix="bean" uri="/web-inf/struts-bean.tld" %> <%@page contenttype="text/html" pageencoding="utf-8"%> <html lang="en"> <head> <meta charset="utf-8"> <title>jquery ui tabs - vertical tabs functionality</title> <link rel="stylesheet" href="//code.jquery.com/ui/1.

Centering a legend title with line breaks in matplotlib -

Image
i use following code display legend title matplotlib: import matplotlib.pyplot plt # data all_x = [10,20,30] all_y = [[1,3], [1.5,2.9],[3,2]] # plot plt.plot(all_x, all_y) # add legend, title , axis labels plt.legend( [ 'lag ' + str(lag) lag in all_x], loc='lower right', title='hello hello hello \n world') plt.show() as can see, "world" not centered. centered, can achieve manually adding spaces: import matplotlib.pyplot plt # data all_x = [10,20,30] all_y = [[1,3], [1.5,2.9],[3,2]] # plot plt.plot(all_x, all_y) # add legend, title , axis labels plt.legend( [ 'lag ' + str(lag) lag in all_x], loc='lower right', title='hello hello hello \n world') plt.show() but that's cumbersome solution. is there more proper way achieve that? the alignment of multiline matplotlib text controlled keyword argument multialignment (see here example http://matplotlib.org/examples/pylab_examples/multiline

android - Intent to View Calendar for particular instance of event -

i've got trigger try open particular event in user's calendar application. problem here recurring events (somewhat expected) - opens event , , not event instance. i don't have query here, i'm hitting instances table event id, start time, , end time. public class calendaritem { long eventid; long starttime; long endtime; public calendaritem (long eventid, long starttime, long endtime) { this.eventid = eventid; this.starttime = starttime; this.endtime = endtime; } public void opencalendarwithintent(){ uri uri = contenturis.withappendedid(events.content_uri, eventid); intent calintent = new intent(intent.action_view).setdata(uri); //calintent.putextra(calendarcontract.extra_event_begin_time, starttime); //calintent.putextra(calendarcontract.extra_event_end_time, endtime); calintent.setflags(intent.flag_activity_new_task); context.st

javascript - Zopim Bubble hides when screen is resized -

i have wordpress website zopim live chat installed, when resize browser hides zopim bubble. should change in code, stays visible @ times? <!--start of zopim live chat script--> <script type="text/javascript"> window.$zopim || (function(d, s) { var z = $zopim = function(c) { z._.push(c) }, $ = z.s = d.createelement(s), e = d.getelementsbytagname(s)[0]; z.set = function(o) { z.set. _.push(o) }; z._ = []; z.set._ = []; $.async = !0; $.setattribute('charset', 'utf-8'); $.src = '//v2.zopim.com/?zopim_secret_key'; z.t = +new date; $. type = 'text/javascript'; e.parentnode.insertbefore($, e) })(document, 'script'); </script> perhaps it's set hide on mobile? check settings in zopim dashboard!

php - .htaccess Clean Url with multiple parameters -

i'm newbie in php , htaccess, , first post. have problem in url, wanted make clean. way, url have http://www.example.com/index.php?page=home&lesson=1.1 how can change http://www.example.com/home/1.1/ and here index.php code <?php include("page_check.php"); // program check requested page. include($page); // home.php, login.php , etc include("templates/layout.php"); //the template, contains html tags... ?> page_check.php code... <?php session_start(); $page = $_get['page']; $array_page=array('home','create_group','group','try_it_out','logout'); $page_no_session=array('login','register','email_confirmation'); $len; if (!empty($_session['login_state'])){ $len = count($page_no_session); for($i = 0; $i < $len; $i++){ if ($page_no_session[$i] == $page){ $page = "home&q

MySQL-PHP syntax error when outputting via php (there seems to be none) -

for reason code of mine wont go through, im darn right sure syntax of proper yet won't go. please help! insert users(username, name, password, type, accounts_prefix, comments, 0, 1, status) values('testuser', 'testuser', 'abc2', 'rslr', 'tes', 'testuseremailcom', 'username_owner', null, 'a') you have error in sql syntax; check manual corresponds mysql server version right syntax use near '0, 1, status) values('testuser', 'testuser', 'abc2', 'rslr', 'tes', 'testuserema' @ line 1 edit: insert function: function db_insert( $table, $values ) { if( count($values) == 0 ) return false; $sql = "insert $table("; foreach( $values $name => $value ) { $sql .= $name.", "; } $sql = substr($sql, 0, strlen($sql) - 2).") values("; foreach( $values $name => $value ) { if( gettype( $

Checking if jQuery variable is referring to a specific DOM element -

http://jsfiddle.net/vq062uhk/ var $currentrow = null; $(function() { $('.set').click(function() { $currentrow = $(this).closest('tr'); }); $('.check').click(function() { console.dir($(this).closest('tr')); if ($currentrow == $(this).closest('tr')) { alert('yes'); } else { alert('no'); } }); }); i have table , variable called $currentrow refers current tr element. want able check if item (in case button "is current?") in current row. i give tr's unique id's or attributes i'm wondering if can avoid that. try following code, $('.check').click(function(){ console.dir($(this).closest('tr')); if ($currentrow && $currentrow.is($(this).closest('tr'))) { alert('yes'); } else { alert('no'); } }); demo

php - Find min/max of complex 2D array -

php not language please bear me. i have (in opinion) poorly designed 2d array of product categories , min/max of 2 ratings per sub-category. sadly, cannot change layout of array: [[category, subcategory, overallrating, extrarating]] for example, sample data this: [["fridges", "samsung", 5, 6], ["fridges", "samsung", 2, 1], ["fridges", "samsung", 3, 4], ["fridges", "lg", 7, 5], ["washing machine", "letto", 5, 6], ["washing machine", "samsung", 5, 6], ["fridges", "samsung", 4, 4]] the output of should give me data such that: fridges, samsung: 2/5, 1/6 fridges, lg: 7/7, 5/5 (or 7, 5) washing machine, letto: 5, 6 (see above) washing machine, samsung: 5, 6 (see above) try this <?php $your_array = array(array("fridges", "samsung", 5, 6), array("fr

javascript - My website should not work in others website iframes without prior authorization. -

we offering iframe based application made php. client should place website iframe in website. requirement validate website accessing iframe. want place iframe in pre-authorized websites only. how block others place iframe in theit websites? know http_referer not giving correct referer always. thanks in advance. there's no guaranteed solution. web browser not required send http_referrer, , can lie if wanted anyway. the guaranteed solution client server (the 1 hosting iframe) connect php application , go through authorization process. perhaps authorization generate auth token... client server use auth token parameter in iframe's src url. php application validate auth token , return iframe's contents. @ point, invalidate unique auth token other page requests couldn't reuse it.

drools - AngularJS + Rule Engine -

is there way integrate rule engine (or rule engine concept apply business rules) angularjs application? i have heard drools. there api provided drools can used in angular project? my requirement input given user should first go match applicable rules, should pass angular-controller. possible? thanks in advance.! you need write rest (or other http-based) service wrap drools rules. way client-side javascript framework such angular js can call rest operations. the following example of angular js client-side application integrating drools on server: https://github.com/gratiartis/qzr although should warn it's work in progress, please don't complain lack of features or documentation. :)

Error while updating a record in APEX screen -

while updating record using mru failing below error. 1 error has occurred current version of data in database has changed since user initiated update process. current row version identifier = "c5f3645b026aa5646c00dc7b631c4d19" application row version identifier = "6a9323b62f641015fa4601421dfb03de" (row 1) this strange because not see change in data @ backend. any highly appreciated. thanks. aj

c# - Get property of listbox item -

i making project in winforms. have listbox populated on run, custom class objects list. each object, have associated button. want program return 1 of properties of associated object in listbox, when button clicked. want select item in listbox. population of listbox: private void updatelist() { listbox.items.addrange(custom_list.toarray()); } the event fired when clicking associated button: associatedbutton.mouseup += (sender, eventargs) => { button btn = (button)sender; (int j = 0; j < listbox.items.count; j++) { if (listbox.getitemtext(j) == btn.tag.tostring()) { listbox.selecteditem = j; } } } the point of code be, either myobject.id property (which string) of given object in list, or displayed text in listbox item (these 2 identical). btn.tag created store string id value of corresponding object. listbox.getitemtext(j) (or listbox.items(j).tostring()) not seem return value. not throw exception, if constr

node.js - Insert all javascript files from a dir as scripts in Jade programmatically -

i have jade file index.jade , have dir public\js contains few js script files. views index.jade public js a.js b.js ... is there way automatically , programmatically include them scripts in index.jade ? script(src='/js/a.js') script(src='/js/b.js') ...

spring - Hibernate, properties changes not tracked -

i'am writting web application spring webflow 2.4 , hibernate 4.3. have problem changes made on entities after calling persist(). changes not tracked , calling saveorupdate before end of flow doesn't (and should useless anyway). hib config <bean id="oracledatasource" class="org.springframework.jdbc.datasource.drivermanagerdatasource"> <property name="driverclassname" value="oracle.jdbc.driver.oracledriver" /> <property name="url" value="${db.oracle.url}" /> <property name="username" value="${db.oracle.user}" /> <property name="password" value="${db.oracle.password}" /> </bean> <bean id="oraclesessionfactory" class="org.springframework.orm.hibernate4.localsessionfactorybean"> <property name="datasource" ref="oracledatasource" /> <property n

android - Facebook publish_action -

i'm having strange problem. i'm developing integration of facebook inside app. managed make works, login , publish_actions can post user inside app. open page use code session.openforpublish(new session.openrequest(getactivity()).setpermissions(arrays.aslist("read_stream", "publish_stream", "publish_actions", "email", "manage_pages")).setcallback(callback)); the session opened , right token created. don't know why but, 2 weeks ago, company working changed app_id of app inside developer app page of facebook, , have bad issue : when use same code use login, in login popup https://fbcdn-dragon-a.akamaihd.net/hphotos-ak-xpa1/t39.2178-6/10173501_712654372111832_803467338_n.png with specificed this not let app post facebook i contact company , have done following steps on developer page app detail > configure app center permissions > added publish action permissions settings > add platform added android

javascript - What purpose does a <script> tag serve inside of a <noscript> tag? -

i've been on "view source" spree lately on websites interesting design , content. 1 of websites, squarespace , has blocks of <script> tags inside of <noscript> tag, so: <!-- page at: http://squarespace.com --> ... ... <noscript id="inline-deps"> <link rel="stylesheet" type="text/css" href="//cloud.typography.com/7811972/758964/css/fonts.css" /> <script type="text/javascript" src="https://static.squarespace.com/static/ta/5134cbefe4b0c6fb04df8065/7400/assets/logomark/logomark.min.js?37"></script> <link rel="stylesheet" href="https://static.squarespace.com/static/ta/5134cbefe4b0c6fb04df8065/7400/assets/logomark/logomark.min.css?37" type="text/css" /> </noscript> ... ... it struck me odd, , got me googling info see if there's kind of hidden functionality/purpose such odd bit of html, no avail. there kind of purpos

objective c - Is Swift a solution to "porting iOS app to OSX"? -

i've read bit swift , seems lot easier draw using swift. when porting ios app os x there's issue of nested uiview 's not working same way in os x, , have use calayer s lot instead of nsview s. swift solution issue? can swift me draw content os x originates ios? no, swift language. it's different syntax, cocoa , uikit don't change. swift can't drawing easier. swift has absolutely nothing porting apps.

java - Spring Security - Why have separate classes for user and role? -

i trying implement spring security app, , because of have been reading lot of articles on net. 1 thing have noticed there lot of examples user role class separated user class. why so, general best practice rule? or there possibility add role field user class , use enum data type, instead of heaving 2 tables in database authentication, have one? can me understand this... a user can have more 1 role. member of support team can have rules "user" , "support" can use system in same way normal user can verify problem reports, example. another example want fine grained roles. instead of "admin" , "user", can have different user roles guests , people may work on part of system. think ebay: have customers , sellers. sellers can more mere buyers. sellers need buy things if want. sellers may want split people "can add offers" , "can give discount." while employees have former, select few have latter.

javascript - Cannot find module 'parseuri' -

when create app.js content: var app = require('express')(); var http = require('http').server(app); var io = require('socket.io')(http); app.get('/', function(req, res){ res.sendfile(__dirname + '/views/index.html'); }); http.listen(3000, function(){ console.log('listening on *:3000'); }); i got error : module.js:340 throw err; ^ error: cannot find module 'parseuri' @ function.module._resolvefilename (module.js:338:15) @ function.module._load (module.js:280:25) @ module.require (module.js:364:17) @ require (module.js:380:17) @ object.<anonymous> (d:\workspace\node\node_modules\socket.io\lib\url.js:6:16) @ module._compile (module.js:456:26) @ object.module._extensions..js (module.js:474:10) @ module.load (module.js:356:32) @ function.module._load (module.js:312:12) @ module.require (module.js:364:17) thanks supporting ! wel

mysql - MAX(Column) returns me a wrong value -

Image
i want retrieve maximum invoice number invoice table returns following when select records can see maximum invoice no "10". select * invoice but when query for select max(invoice_number) maxinv invoice it returns me "9". why that? this situation can occur if invoice_number stored text column e.g. varchar(10) . in case, based on alphabetical order, 9 maximum value. ideally, should storing values on want perform numerical operations numeric datatypes e.g. int . however, if reason cannot change column datatype, can try casting column before applying max , so: select max (convert(invoice_number, signed integer)) maxinv invoice note: mention "values on want perform numerical operations" because there cases input text entirely numeric, such phone numbers or perhaps credit card numbers, there no scenario in want add 2 phone numbers, or take square root of credit card number. such values should stored text.

c# - Autofac - injected instance doesn't work as singleton -

i register necessary type autofac instanceperlifetimescope : builder.registertype<websecuritycontext>() .asself() .instanceperlifetimescope(); and resolve through interface: builder.register<iapplicationcontext>(context => { return context.resolve<websecuritycontext>(); }) .as<iapplicationcontext>(); i inject applicationcontext in webapi controller: public class medicalcentercontroller : baseapicontroller { private readonly iapplicationcontext applicationcontext; public medicalcentercontroller(iapplicationcontext applicationcontext) { this.applicationcontext = applicationcontext; } applicationcontext has medicalcenterid value. value should change after select of new medical center on ui. changing of medicalcenterid occurs in action filter contains necessary context. public class medicalcenterattribute : actionfilterattribute {

How can I workaround this android TextWatcher restriction? -

i have textwatcher defined on edittext field. within textwatcher.ontextchanged() method, reset edittext value empty string. when java.lang.indexoutofboundsexception: setspan (2 ... 3) ends beyond length 0 @ android.text.spannablestringbuilder.checkrange(spannablestringbuilder.java:934) can suggest workaround safely clear down edittext within textwatcher. my code ... textwatcher tw = new textwatcher() { public void ontextchanged (charsequence chars, int start, int before,int count) { // if user keys enter, process contents , clear down edittext if (chars.tostring().indexof("\n") > -1) { processchars(s.tostring().replace("\n", "")); edittextfield.settext(""); } } }; edittextfield.addtextchangedlistener(tw); as @pskink has mentioned in comments, " it error attempt make changes s this callback ". so, instead of changing edittext value directly, use

html - How can I show text and a picture in an ordered list? -

Image
i need create ordered list, has text , pictures. i.e. to this, have put text , images in tables. <ol> <li> <table> <tr> <td> tyrannasaurus </td> </tr> <tr> <td> <img style="float: left; margin-top: 5px;" src="tyrannasaurus.png" /> </td> </tr> </table> </li> <li> <table> <tr> <td> brontosaurus </td> </tr> <tr> <td> <img style="float: left; margin-top: 5px;" src="brontosaurus.png" /> </td> </tr> </table> </li> <li>

Log4net Custom level -

i trying print custom level logs in application using log4net. need create own levels applicationname.info , applicationname.error i don't know how create custom levels default levels can me? you seem doing wrong reasons. quoting log4j docs' faq: it possible, appropriate. [..] it's absolutely overkill , needless work override existing log-levels custom ones. log frameworks allow configuring templates according needs. use existing levels instead, else not correct approach current problem.

xml - Android custom ArrayAdapter efficiency -

i have implemented custom adapter class extends arrayadapter. have tried make efficient possible making use of viewholder approach, since learn, xml inflation performed in adapter's getview(...) method involved process should done few times possible. with in mind, here scenario: i have listview 6 possible items can displayed in list. 6 items alike, differences have different icons, different text , might have additional image/icon displayed in item itself. every time adapter's getview(...) method called therefore change icons, text , make elements visible/invisible based on item dealing with,but inflate single xml file - , done once. my question following: is current approach less efficient making 6 separate xml item layouts, inflating each of these 6 items once, , recycling these views each item. mean setvisibility(...), setimageresource(...) etc. methods no longer need called each time getview(...) called, inflating xml once each item type (6 inflations rather o

ios - Multiple font sizes for UITextField placeholder text -

i have placeholder text uitextfield 1 part should have larger font size rather rest of placeholder text. can using attributedplaceholder property ? not seems respect font size adding through attributed string. currently trying 1 font size , not seems work either , nsattributedstring *placeholder = [[nsattributedstring alloc] initwithstring:placeholdertext attributes:@{nsfontattributename : [uifont fontwithname:textfield.font.fontname size:8.0]}]; textfield.attributedplaceholder = placeholder; currently don't think possible attributedplaceholder . setattributedtext possible doing following uifont *futurafont = [uifont fontwithname:@"futura" size:18.0]; nsdictionary *futuradictionary = [nsdictionary dictionarywithobject: futurafont forkey:nsfontattributename]; nsmutableattributedstring *fattrstring = [[nsmutableattributedstring alloc] initwithstring:title attributes: futura

java - Trying to save current date permentently -

simpledateformat sdf = new simpledateformat("dd/mm/yyyy hh:mm"); date = new date(); string strdate = sdf.format(now); i trying display current date permanently. i have tried: date = new date(); string strdate = sdf.format(now); but returning error since have not posted error, , looking @ code looks fine, best guess getting following error: error: no suitable constructor found date() date = new date(); constructor date.date(long) not applicable (actual , formal argument lists differ in length) constructor date.date(int,int,int) not applicable (actual , formal argument lists differ in length) 1 error which happens when use java.sql.date instead of java.util.date , since simpledateformat.format() accepts parameter of type java.util.date . change import statement import java.util.date or worst case, have not added imports add following: import java.util.date import java.text.simpledateformat

Swing EditorPane Scala size not working -

i have created below editorpane scala.swing import scala.swing.{font, color, editorpane} val textarea = new editorpane() { font = new font("monospaced", java.awt.font.plain , 20 ) background = color.darkgray foreground = color.magenta size = new java.awt.dimension(30,50) } running above code generates error: value size_= not member of scala.swing.editorpane in scala.swing editorpane api ( http://www.scala-lang.org/api/2.10.4/index.html#scala.swing.editorpane ) refers size being java.awt.dimension can not see why code wrong. tried size.setsize(30,50) , compiles editorpane has 1 line means size not being set correctly. what problem here? ps : have latest scala version. editorpane inherits components uielement . uielement provides related setter methods like: minimumsize_=(x: dimension) maximumsize_=(x: dimension) preferredsize_=(x: dimension) there size method, no setter it. explains error. my personal interpretation: