Posts

Showing posts from February, 2013

javascript - plus signs in the JS code - why aren't they optional here -

i'm curious answer taken dagg nabbit @ so here: convert hh:mm:ss string seconds in javascript var seconds = (+a[0]) * 60 * 60 + (+a[1]) * 60 + (+a[2]); right, var seconds = (a[0]) * 60 * 60 + (a[1]) * 60 + (a[2]); doesnt work expected - doesn't calculate number of seconds. why? they cause implicit conversion of string number. in browser's debug console, try: > typeof +'1' "number" > typeof '1' "string"

Image in Java web service -

i developing server part in java restful web service (using apache tomcat), planning deploy on cloud web service. want web service provide images client (mobile devices or browsers), user can upload or replace images dynamically later. question 1: should store images @ server ? options-- 1].save images in database (as blob) 2].local file system of server. question 2: how process client request options-- 1].i can retrieve locally , give image response. 2].i can give public url of image response, , client can download url. can suggest me option should opt optimize server side processing , storage cost, w.r.t security. answer 1: while subject debate, usual answer is: local file system. can add entry in database location of file , metadata actual binary blob should on file system. answer 2: if pass along public url, supposes have public http server can access , provide images requested. if case consider opting because http servers can optimize out of box (e.g. caching...

validating html field for database value -

i have registration form , in have enter teacher_id , primary key in database. problem cant give same id 2 teachers how can validate according database values. of validate accept numbers using jquery. can me in this.

c# - Rendering a partial view with jquery -

the problem; i have view 2 partial views 1 view handle client side msgs , gridview. the gridview form , can delete update items. when deleting or updating error/success msgs generated in tempdata grid partialview being rendered actionresult functions. i need way render messages partial view without posting or redirecting controller since data exists in tempdata. view: <div id="page-knownrecipient"> @html.partial("clientsidemessages") @html.partial("_tabspartial") @if(model != null) { using (html.beginform()) { @html.partial("_editmodepartial", model);//grid } } </div> all callback routing gridview returns partialview editmodepartial , since view never reloaded messages should displayed in "clientsidemessages" partial never rendered after delete/ update callbacks. accordingly need way render "clientsidemessages" partialview using jquery, ...

struts2 - Server side validation error message are repeated in Struts 2 -

i using struts2 xml validaion (action-validation.xml). problem when clicked save button more 1 time, error message appears repeatedly. how resolve issue? you should prevent submitting form (and saving data) twice, instead of caring double error messages, go away automatically once you'll solve real problem. to prevent double form submission, disable submit button javascript; prevent f5 landing page, use post redirect pattern, or history.pushstate(). prevent multiple submissions when crafted, use token (tokeninterceptor in struts2). read more: 4 ways prevent duplicate form submission how prevent multiple form submit client side? prevent double submission of forms in jquery avoid duplicate submission of struts 2 jsp page

android - Scale buttons in in widget -

Image
i want create widget has number of buttons scaled horizontally when screen size changed. can single layout.xml? i tried illustrate image below : you can achieve setting android:layout_weight="" tag in linearlayout . see below example. <linearlayout android:id="@+id/linearlayout1" android:layout_width="match_parent" android:layout_height="wrap_content" > <button android:id="@+id/crop" android:layout_width="0dp" android:layout_height="50dp" android:layout_weight="1" android:background="@drawable/crop_drawable" > </button> <button android:id="@+id/rotate" android:layout_width="0dp" android:layout_height="50dp" ...

How to make javascript file update take effect immediately on IIS for asp.net web sites? -

Image
i'm writing asp.net project. when trying fix bug, updated 1 of javascript files , deployed new version on server's iis 6.0. can see new javascript file has been updated on physical folder of website. however, when verifying bug local machine found it's not fixed. after investigation, realized it's because javascript file received browser not latest version. deleted ie's caches , problem still exists. tried download javascript directly website using url like: http://myserver.mydomain.com/mywebsite/scripts/myscript.js , found out downloaded javascript file of old version. realized caused cache on server side. tried set server's iis: on site's "output caching" option, unchecked "enable cache" , "enable kernel cache" : also added rules .js , .css file: after taking these actions, updated javascript file on server, restarted iis , tried download local machine again.however, javascript downloaded still not late...

php - Multi Tenancy Databases with Symfony2 and Doctrine: How to separate Tenant Data? -

we building multi-tenancy application tenants data stored in same database/tables. every table has column "tenant_id" identifies tenant. how can achieve goal using symfony2 , doctrine? for symfony 1, there plugin called sfmultitenantplugin seems not exist in symfony2. plugin added tenant_id dynamically queries database. what best practice use doctrine orm described data structure? thank help!

javascript - Facebook JS SDK - How to post custom story to timeline -

Image
i trying post custom story user's timeline. when try post story, not appear in user's timeline, appears in user's activity log (under user's profile). in order story show in timeline has select in activity log , choose "show on timeline". not want. there way can make show directly in timeline? i using following code: var parent = this; fb.api( 'me/' + parent.facebook_app_namespace + ':score', 'post', { newscore: "http://mydomain.com/open-graph/newscore?app_id=" + parent.facebook_app_id + "&game_id=" + parent.my_app_id + "&score=" + params.score + "&access_token=" + parent.facebook_app_access_token }, function(response) { console.log(response); } ); the code returns object id, indicates story has been posted successfully. thanks. most due fact app in development mode- in case stories not published on wall visible in activity log. you can swi...

javascript - compile scss with nodemon and node-sass -

i'm playing around node.js, express , node-sass , watching file changes nodemon. i added bit app.js compile scss (according node-sass docs) it's not doing anything. sass compile when nodemon runs app.js every time make changes project. i'm not sure if work nodemon running node app.js in console without nodemon nothing must i'm doing wrong. app.js file /** * module dependencies. */ var express = require('express'); var routes = require('./routes'); var user = require('./routes/user'); var http = require('http'); var path = require('path'); var sass = require('node-sass') var app = express(); // environments app.set('port', process.env.port || 3000); app.set('views', path.join(__dirname, 'views')); app.set('view engine', 'ejs'); app.use(express.favicon(__dirname + '/public/favicon.ico')); app.use(express.logger('dev')); app.use(express.json()); app.use(e...

c++ - Virtual inheritance crashes application -

the following code crashes (access violation error) because used virtual inheritance. afaik virtual inheritance solves diamond problem forcing use of single instance of class. in case derived class inherits 1 instance of iobject so there should no problem, crashes. class iobject { public: virtual int gettype()=0; }; class base : public iobject { protected: int val; public: base() { val = 1; } virtual int gettype(); }; int base::gettype() { return val; } class derived : public virtual base //if remove virtual keyword here problem solved. { public: derived() { val = 2; } }; int getval( void* ptr ) { return ((iobject*)ptr)->gettype(); } int main() { void* ptr = new derived(); cout << getval(ptr) << endl; return 0; } the problem chain of casts incorrect: derived* -> void* -> iobject* undefined behavior resulting mixing c , c++ concepts. more specifically, rules around void* inherited c without adaptation object...

javascript - Create sqlLit database using JQuery -

hi new jquery have done r&d on different fields tried create sqllit database using jquery have done google found code when insert username , mail id , enter save button data disrepair my problem data stored , remaining fields (rest,update,drop) not working <!doctype html public> <html> <head> <title>exercise 3</title> <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.0/jquery.min.js"></script> <style> html, body, h1, form, fieldset, legend, ol, li { margin: 0; padding: 0; } body{ background: #ffffff; color: #111111; font-family: georgia, "times new roman", times, serif; padding : 20px; } form#mycontact{ background: #9cbc2c; -moz-border-radius: 5px; -webkit-border-rad...

Do DOM objects get garbage collected in javascript? -

var domelementreference = $(document.createelement('div')); will dom element destroyed if don't insert on page (once domelementreference gets out of scope)? if not: if have constructor-function creates dom elements, there automatic way clear them in javascript? what tought append them on element, , use mychildnode.parentnode.removechild(mychildnode); but again have manually call function when object getting out of scope, , kind of messes whole 'garbage-collection' idea. patterns automatically destroy object? if elements haven't been inserted dom , no other references exist, yes garbage collected, other variables. modern browsers use mark-and-sweep algorithm garbage collection, means garbage collector , garbage collect objects unreachable. if create elements in function, don't assign reference elsewhere or don't insert them dom, eligible garbage collection after function completes. there no need manually try free memory in jav...

sorting - how to calculate the time complexity of kurskal's algorithm which is may be O(E log E) = O(E log V).? -

please tell me procedure how calculate time complexity of kruskal's theorem? know algorithm of kruskal algorithm didn't know pseudo code , calculation of time complexity ... complexity of kruskal algo o(e log e) = o(e log v) (wikipedia). didn't know how calculate that.. kruskal's algorithm based on union-find of forests until form single tree. @ each step connecting 2 trees using single edge. the pseudo code (from wikipedia ): tree = {} each v: make-set(v) each edge (u,v) ordered w(u,v): if find(u) != find(v): tree.add((u,v)) union(u,v) return tree the bottleneck of algorithm sorting edges according weight. sorting done in o(nlogn) @ best, , sorting list of size e , giving total of o(eloge)=o(elog(v^2))=o(2elogv)=o(elogv)

java - Why do we make private fields instead of package local -

is there overhead when using default access level on class field in java? mean "any", nanoseconds on startup. heard jvm makes graph of scopes fields, possible reason overhead. i'm lazy write private keyword. there reason write private keyword instead of package-local? package local seems local enough. "is there reason write private"? yes there reason. not want private members accessed. see site summary of access modifiers , when , why should use them, http://docs.oracle.com/javase/tutorial/java/javaoo/accesscontrol.html private = not okay them changed other mother class. no modifier = okay them changed class within same package. protected = same no modifier + okay changed subclass public = okay them changed in general. if clicked link above heed warning recommendation use restrictive access level makes sense particular member. use private unless have reason not to. if put no modifier saying, "i explicitly want other ...

ruby on rails - Image width and height using carrierwave, not being saved to hstore column, although .persisted? returns true -

ruby 2.1.1p76 (2014-02-24 revision 45161) rails 4.1.0.rc1 postgres 9.3, using gems: gem 'carrierwave' , gem 'mini_magick' the issue got unknown reasons uploaded images width , height not being saved database (although without after :store, :set_image_geometry facebook url , twitter url being saved (using same form, same hstore column)) screencast: http://quick.as/dvvrhnjx schema.rb - column want store avatar_height , avatar_width create_table "users", force: true |t| ... t.hstore "settings", default: {}, null: false end avataruploader.rb include carrierwave::minimagick after :store, :set_image_geometry ... def set_image_geometry version if self.file.present? && file.exist?(self.file.path) img = minimagick::image.open(self.file.path) self.model.settings['avatar_width'] = img['width'] self.model.settings['avatar_height'] = img['height...

C++ factorial program give infinity for any number greater than 2 -

Image
so it's 5:00 a.m. , confused , frustrated hell. i've created program before can't understand going on. i've created simple factorial program , have double checked logic, every time enter number greater 2 program goes loop printing out "inf". can't see wrong program itself. :( #include <iostream> using namespace std; int main() { double usernumber = 0; double = 1; cout << "this program calculate factorial of number enter.\nplease enter number now: "; cin >> usernumber; ( = 1; < usernumber; i++ ) { usernumber *= i; cout << usernumber; } cout << "\n\nthe factorial " << usernumber << "." << endl; return 0; } it works 1 , 2: but 3 or greater.... i haven't created c++ program in while can't life of me see wrong. super obvious syntax error, or computer breaking down on me? edit: changed numbers double int ,...

android - Custom ImageView fits to its parent width and height -

Image
i've been creating image processing application. image get's blackened(technically drawing on canvas paint , path on touchevent ). here's layout used blackened screen <?xml version="1.0" encoding="utf-8"?> <framelayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent"> <framelayout android:id="@+id/blacken_imageview" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="center" /> </framelayout> in blacken activity : public void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.drawingpad_layout); drawingpadlayout = (framelayout) findviewbyid(r.id.blacken_imageview); mdrawingview=new drawingview(this); mdrawingview.setbackgrounddrawable(drawable.create...

Authentication Issue Using PostgreSQL dblink -

how create dblink connection in postgres without supplying username & password (for security reasons)? running following query returns error: select dblink_connect('conn_1','dbname=adatabase'); "could not establish connection 08001" my pgpass.conf file has following entry , i'm running script postgres user in pgadmin: localhost:5432:*:postgres:apassword using dblink_connect_u returns same error. i'm running postgres 9.2 on windows 2012 server if you're connecting postgresql database, can modify your pg_hba.conf on server you're connecting (for example) passwordless connections allowed user local machine: local youruser trust host youruser 127.0.0.1/32 trust host youruser ::1/128 trust ideally, create postgresql user on server dblink, , grant necessary rights (only select on specific tables, example).

android - Cordova - detect that app is in the background -

i have feature in cordova app lets user when user shakes phone (i'm using shake.js purpose). phone vibrates when happens. the problem that, when "alt tab" away app , it's in background, shake/vibrate combo still works. user might using different app , phone still vibrate. is there way detect app in background, or better yet, freeze app somehow when it's going background? i have problem on android (haven't tested on ios yet). you can bind pause event , remove shake feature app. according documentation (pause) event fires when application put background. you can listen resume event put shake feature. usual in documentation can find complete code examples.

jquery - Angular JS - repeat image tag for numbers in array -

i'm modifying question bit since not able proper solution previously. i have array products_page=["7","8","6","9","5","7","8","9","8","7"] each time below table's ng-repeated based on json values, image tag (commented as: please note image tag needs repeated) needs repeated 7 times on first ng-repeat, 8 times on second ng-repeat, 6 times on third ng-repeat , on.... <table class="table table-bordered"> <tbody> <tr ng-repeat="user in users[0].tvseries | filter: searchtext | filter: genre.config | orderby:predicate"> <td> <img ng-src="{{user.thumbnail}}" alt="" /> </td> <td> <div>{{user.tv_show_name}}</div> <div>{{user.brief_description}}</div> <div>ra...

html - Open Android app via scheme without using url -

i have android scheme name: android.scheme , want open android app when click on: android.scheme://serversettings?personalizationhost=192.168.32.122&personalizationport=8080&vpnhost=192.168.32.122 how can help? i know how can achieve same using putting in html page , opening page open app this: <!doctype html> <html lang="en-us"> <head> <script type="text/javascript"> window.location.href = "android.scheme://serversettings?personalizationhost=192.168.32.122&personalizationport=8080&vpnhost=192.168.32.122"</script> <title>authenticvpn settings</title> </head> <body> </body> </html> but don't want click on url , open app. want click on android.scheme directly opens app. appreciated? you don't need create separate page redirects uri android.scheme scheme. can create link on original page using same scheme...

ios - MFMessageComposeViewController having the message body repeated twice -

when using following code setup in-app sms message using mfmessagecomposeviewcontroller: if([mfmessagecomposeviewcontroller cansendtext]) { // add cocos view & stop anims [[[ccdirector shareddirector] view] addsubview:self.view]; [[ccdirector shareddirector] pause]; [[ccdirector shareddirector] stopanimation]; mfmessagecomposeviewcontroller *controller = [[mfmessagecomposeviewcontroller alloc] init]; controller.body = @"test"; controller.recipients = nil; controller.messagecomposedelegate = self; // cocos window view present [[[[ccdirector shareddirector] view] window] addsubview:controller.view]; [[ccdirector shareddirector] presentviewcontroller:controller animated:yes completion:^{nslog(@"test open");}]; } the view appears correctly message body text appearing twice. in editable text field has 'test', 'test' again on following line. i've tried adding title , using various different...

python - Modifying list elements based on key word of the element -

i have many lists want operations on specific elements. if have like: list1 = ['list1_itema', 'list1_itemb', 'list1_itemc', 'list1_itemd'] list2 = ['list2_itema', 'list2_itemc','list2_itemb'] what interest me item 'itemc' wherever occurs in lists , need isolate element contain itemc next manipulations on it. thought sorting lists in such way itemc occupies first index achieved list[0] method. but in case itema, itemb, itemc , itemd biological species names , dont know how force list element occupy first index (that element string e.g 'cow' in analysis or 'itemc' here). possible python? you can extract items containing "itemc" without ordering, or worrying how many there are, "generator expression": itemcs = [] lst in (list1, list2): itemcs.extend(item item in lst if "itemc" in item) this gives itemcs == ['list1_itemc', 'list2_itemc']...

How to create label text using html helper from Model in ASP.Net MVC 5 (Razor View) -

i trying create label text using html helper model roomavailabilitysummary view design: @model ienumerable<wbe.model.roomavailabilitysummary> @using(ajax.beginform("roomsavail", new ajaxoptions { updatetargetid = "roomsavaildata", insertionmode = insertionmode.replace })) { @html.antiforgerytoken() <div class="container paddingzero"> <div class="row rowbackground"> @html.displayfor(model => model.arrdat) </div> <div class="row rowbackground"> @html.editorfor(model => model.arrdat) </div> <div class="row rowbackground"> @html.displayfor(model => model.depdat) </div> <div class="row rowbackground"> @html.editorfor(model => model...

javascript - When will be the extender function will get called -

i newbie knockout js. want implement dynamic validations 1 observable. want use extender function. not calling. have created jsfiddle . doubt when called. the code is // here's data model var viewmodel = function(first, last) { this.firstname = ko.observable(first).extend({logchange: "sri" }); this.lastname = ko.observable(last); this.fullname = ko.computed(function() { // knockout tracks dependencies automatically. knows fullname depends on firstname , lastname, because these called when evaluating fullname. return this.firstname() + " " + this.lastname(); }, this); ko.extenders.logchange = function(target, option) { alert("log change function") target.subscribe(function(newvalue) { alert("subscribe function: "+option + ": " + newvalue); }); return target; }; }; ko.applybindings(new viewmodel("hello", "world")); // makes knockout work regards, srinivas although...

r - error unlisting result of lapply -

i have run lapply like: paper_author_name<-lapply(train_author,function(x){ as.data.frame(paper_author$author_name[which(paper_author$author_id%in%x)]) }) i getting result as: [[1]] paper_author$author_name[which(paper_author$author_id %in% x)] emanuele buratti emanuele buratti abdiub bahir now need unlist result by unlist(paper_author_name[1]) but getting error error in structure(res, levels = lv, names = nm, class = "factor") : 'names' attribute [135] must same length vector [1] how unlist result. thanks

dynamics crm 2013 - Display Opportunities from Sub Accounts on Parent -

i want display opportunities linked parent account, including sub accounts, not ones directly linked account. opportunities relating account appear @ moment. possible change opportunities linked sub accounts appear? to there think need report. unfortunately build , advanced find query requirements it's not possible. report hard "sub opportunities" if tree of accounts bigger 1 level: parent account lv1 child account (parent: parent account) lv2 child account (parent: lv1 child account) if have structure lv2 child account opportunities not possible if it's online crm, , complex if it's on premises.

javascript - opening angularjs app in google chrome 32 shows blank page -

i'm working on web app mom's startup, , because thought full server-side framework overkill, decided write using angularjs. i've gotten basic layout done, wrote subpages, wired routes , wrote controllers, when try , launch app, shows layout. i've tried several things things work including: addressing jshint/jslint issues. fixing errors raised chrome devtools. moving javascript file js/ directory root of project , updating html. moving subpages pages/ directory root of project , updating routes. all no results. i'm not sure terms google for, skipped that. contents of index.html <!doctype html> <html dir="ltr" lang="en"> <head> <title>{{ page.title() }}</title> <meta charset="utf-8"> <meta name="description" content="life in face of emergency base template."> <meta name="keywords" content="emergency, life, ...

Creating PostgreSQL C extensions on Windows platform -

i'm having problems getting simple test functions postgres link and/or run on windows, having tried both command line , visual studio. have found little documentation , no working templates this. i'm not used compiling tools in windows , i'm new postgres may missing basic. directions appreciated! using: windows 8.0 (64-bit), cl.exe 18.00.21005.1, link.exe 12.00.21005.1, postgresql v.9.3.4 (binary install). this sample code documentation have simple, added pgdllexport invocation: #include "postgres.h" #include "fmgr.h" pg_module_magic; pg_function_info_v1(add_one); pgdllexport datum add_one(pg_function_args) { int32 arg = pg_getarg_int32(0); pg_return_int32(arg + 1); } in cl command file collected following include paths: /i "c:\program files\postgresql\9.3\include\server\port\win32_msvc" /i "c:\program files\postgresql\9.3\include\server\port\win32" /i "c:\program files\postgresql\9.3\include\server\p...

mocking - How to Mock a Custom Type in Rspec-Puppet -

i able test custom types using rspec-puppet due implementing answer of this question. however, avoid create symlink custom folder in every puppet-module mocking cystom types . the question how mock custom puppet types in rspec-puppet. i have found example regarding mocking of custom puppet function looking example mock puppet custom types . puppet code class vim::ubuntu::config { custom_multiple_files { 'line_numbers': ensure => 'present', parent_dir => '/home', file_name => '.vimrc', line => 'set number'; } } rspec-puppet code require 'spec_helper' describe "vim::ubuntu::config" ? end a place go looking examples on mocking collection of puppet's own unit tests . i'm not sure if there specialties needs considered, within puppet's spec test, mocking works this: let(:type) { puppet::type.type(:custom_file_line) } "should whatever...

android - Custom progress bar, doesn't show progress -

in application i'm inserting custom progress bar. problem is not shown progress. when in code call setprogress , bar remains background color. whereas if in layout setting setprogress shown normally. before inserting custom toolbar, worked perfectly here code: drawable/customprogressbar.xml <?xml version="1.0" encoding="utf-8"?> <layer-list xmlns:android="http://schemas.android.com/apk/res/android"> <!-- define background properties color etc --> <item android:id="@android:id/background"> <shape> <corners android:radius="5dip" /> <gradient android:startcolor="#5c5c5b" android:endcolor="#9d9d9c" android:centery="1" android:angle="270" /> </shape> </item> <!-- define progress properties start color, end colo...

canvas - Kineticsjs drawing arc with Kinetic.Shape -

hi want build loading animation, doughnut chart becoming bigger , bigger. need custom shape, because need hole in middle other animations. far is: var stage = new kinetic.stage({ container: 'loader', width: 600, height: 200 }); var layer = new kinetic.layer(); var circle = new kinetic.circle({ x: stage.getwidth() / 2+200, y: stage.getheight() / 2, radius: 70, fill: 'red' }); var x = stage.width / 2; var y = stage.height / 2; var radius = 75; var startangle = 1.1 * math.pi; var endangle = 1.9 * math.pi; var counterclockwise = false; var arc = new kinetic.shape({ scenefunc: function(context) { context.beginpath(); context.arc(x, y, radius, startangle, endangle, counterclockwise); context.closepath(); // kineticjs specific context method context.fillstrokeshape(this); }, fill: 'green', stroke: 'red', strokewidth: 4 }); // add shape layer layer.ad...

Caching for session state not working in Azure Emulator -

i have azure cloud service comprising 1 web role , cache worker role. web role runs fine except when try add session state provider uses cache worker: <sessionstate mode="custom" customprovider="afcachesessionstateprovider"> <providers> <add name="afcachesessionstateprovider" type="microsoft.web.distributedcache.distributedcachesessionstatestoreprovider, microsoft.web.distributedcache" cachename="default" datacacheclientname="default" applicationname="afcachesessionstate"/> </providers> </sessionstate> <datacacheclients> <datacacheclient name="default"> <autodiscover isenabled="true" identifier="mycacheworkerrole" /> <!--<localcache isenabled="true" sync="timeoutbased" objectcount="100000" ttlvalue="300" />--> </datacacheclient> when try debug, azure comp...

Javascript regex: ignore every letter after backslash -

i want retrieve free variables in lambda expression. example \z.\x.(xy) , "\" stand lambda symbol: through regex, need letters don't follow backslash. in example, free variables {y} since "y" variable not bounded "\". how that? in advance. you can use /\\(\w+)/g , iterate exec : var r = /\\(\w+)/g, m, s = "\\z.\\x.(xy)"; while (m = r.exec(s)) console.log(m[1]); it logs "z" "x" . demonstration to answer new question: to names not following \ , may use /([^\\]|^)(\w+)/g (and use second capturing group third element in returned array). demonstration

c# - Custom MenuItemPanel (How add Items on Design Time?) -

the problem follows: in user control have label list (list ) fills adding labels uc through "smart tag" (using designeractionmethoditem). the problem works correctly when in design time, example, add 3 items @ design time, when test application these items disappear if had never added. p.s.: i have: mycontrol class, [designer(typeof(menuitempaneldesigner ))] public partial class menuitempanel : usercontrol { private list<label> _listaitems; public menuitempanel() { initializecomponent(); } public list<label> listaitems { { if (this._listaitems == null) { this._listaitems = new list<label>(); } return this._listaitems; } } public void agregaritem() { label nuevoitem = new label(); nuevoitem.text = "item " + this._listaitems.count; nuevoitem.autosize = false; nuevoit...

php - Ajax route works offline, not on server + Silex -

Image
i'm having problems ajax call on server. full routes.php file: <?php $app->post('translations/get/trans', 'translations\controller\indexcontroller::ajaxgettagstranslations')->bind('translations.gettrans'); $app->get('/{_locale}/dashboard', 'dashboard\controller\indexcontroller::indexaction')->bind('dashboard.index'); $app->match('/api/todo/{user}/{accesskey}', 'api\controller\indexcontroller::todoaction')->method('post|get'); $app->match('/api/getdailymessage/{user}/{accesskey}', 'api\controller\indexcontroller::getdailymessageaction')->method('post|get'); $app->match('/api/todo/out', 'api\controller\indexcontroller::todooutaction')->method('post|get'); $app->match('/api/finisharea', 'api\controller\indexcontroller::finishareaaction')->method('post|get'); $app->match('/api/activity'...

javascript - Is this a bug in html 5 or am i mad? -

am mad or following bug in html 5? im coding "game map". simple, here drawing code: g2d.clearrect(0, 0, width, height); for(var = minx; < maxx; i++){ for(var j = miny; j < maxy; j++){ var drawx = * tilewidth + posx; var drawy = j * tileheight + posy; g2d.drawimage(images["image0"], drawx, drawy); g2d.filltext("x: " + i, drawx + 3, drawy + 10); g2d.filltext("y: " + j, drawx + 3, drawy + 20); g2d.rect(drawx, drawy, tilewidth, tileheight); g2d.stroke(); } } for(var = 0; < bases.length; i++){ var position = bases[i]["position"].split(":"); var x = parseint(position[0]); var y = parseint(position[1]); g2d.drawimage(images["image1"], x * t...

activemq with camel: rate limit across all vs across one -

i researching activemq, in particular, integrating java app using camel. our architecture involves queuing jobs across multiple multithreaded vms. need in particular 2 kinds of rate limits: per vm per time period (all threads) per vms per time period is there way specify these in camel, or rate limits implemented on per-consumer basis? with of throttler , think can setup rate limit per route. exchange information not share across camel route, don't think can work vms.

java - Bean Validation doesn't work? -

Image
i'm looking solution problem still haven't found. in bean i'm using annotations validations doesn't work , i'm looking in internet work. i'm using: vaadin 7 , maven i this. /** person's bean */ @entity public class person{ @id @generatedvalue private integer id; @notnull @notempty @size(min=5, max=50, message="insert first name") private string firstname; @notnull @notempty @email private string email; //get , set } //my app public class loginview extends verticallayout{ private textfield firstname, email; private beanfieldgroup<person> binder; private formlayout form; public loginview(){ form = new formlayout(); binder = new beanfieldgroup<person>(person.class); field<?> field = null; field = binder.buildandbind("firstname", "firstname"); firstname = (textfield)binder.getfield("firstname"); form.addcomp...

c++ - How do I get an accurate stack base address on OS X? -

pthread_attr_getstackaddr gives me value 0xfffffffffff80000 doesn't seem valid base address. pthread_get_stackaddr_np , such documented in this answer , appears undocumented , non-portable, gives me value 0x00007fff5fc00000 seems more sensible. when place random breakpoint in program (with either gdb or lldb) , print stackpointer addresses below 1 returned above (such 0x00007fff5fbfe7e0 ). all operations done on pthread_self , never switch threads. ideas? on mac os x (and on x86 family processors in general) stack grows down, higher lower addresses. variables supposed below stack base address.

jquery - Hiding and showing button on click in twitter bootstrap -

i have following jquery , css i've used , worked, in new solution (which copy of existing one) not work: <script> $("#inprogress_btn").click(function () { if (!($("#inprogress_btn").is(":visible"))) { $("#onhold_btn").show(); $("#inprogress_btn").hide(); } else { $("#onhold_btn").hide(); $("#inprogress_btn").show(); } }) </script> <button style="margin-top:50px;" id="onhold_btn" class="btn btn-block btn-danger">on hold</button> <button id="inprogress_btn" class="btn btn-block btn-success">in progress</button> what doing wrong? ...