Posts

Showing posts from March, 2013

CORS initial connection for OPTION + GET -

i'm using cors make cross domain request, have: a preflight option call a get call i'd know why have initial connection each request , whereas have keep-alive of 5s , option request takes 700ms ? thanks :)

How could I generate a customized javadoc of a class, package ... to pdf in eclipse or something in maven? -

how generate customized javadoc of class, package ... pdf in eclipse or in maven? <plugin> <groupid>org.apache.maven.plugins</groupid> <artifactid>maven-javadoc-plugin</artifactid> <version>2.10.2</version> <reportsets> <reportset> <id>pdf</id> <reports> <report>javadoc</report> </reports> <configuration> <name>pdf</name> <description>this documentation on pdf.</description> <destdir>pdf</destdir> <doclet>com.tarsec.javadoc.pdfdoclet.pdfdoclet</doclet> <docletpath>${basedir}\..\..\tools\pdfdoclet-1.0.3-all.jar</docletpath> <usestandarddocletoptions>false</usestandarddocletoptions> <addition...

c# - Multiple validation errors with INotifyDataErrorInfo, old messages don't disappear -

in wpf project, i'm validating textbox input inotifydataerrorinfo implementation. multiple errors can occur. when input causes multiple errors, validation errors displayed. however, when fix 1 error, validation message doesn't change, means false error messages shown. when fix errors message disappears. is problem implementation, or wpf implementation re-fetch validation message if haserrors changed? stepping through debugger, however, can see geterrors , haserrors both called. steps reproduce attached example: enter 333333. 2 validation messages shown. change leading 3 2. still, both validation messages shown, although first error has been fixed. change second 3 0. both messages disappear change second digit 3 again. second validation message shown. change leading digit 3 again. second validation message shown, although should display both. and yes, example doesn't make sense, since rid of first check, since it's included in second check. the view...

ruby on rails - Testing a redirect_to(:back) on successful from completion isn't working -

i'm trying run test has redirect_to(:back) on successful form completion, error when run line assert_difference 'comment.count', 1 post comments_path, comment: { body: "optc", commentable_id: 1, commentable_type: 'post'} end error actioncontroller::redirectbackerror: no http_referer set in request action, redirect_to :back not called successfully. if test, make sure specify request.env["http_referer"]. looking this see need request.env['http_referer'] = 'http://test.com/' added setup. gives error nomethoderror: undefined method 'env' nil:nilclass now i'm not sure do. how can first error go away? update im using rails 4 here header of test file require 'test_helper' class categoryitemshowpagetest < actiondispatch::integrationtest def setup @user = users(:michael) @user1 = users(:archer) @guide = guide.find(1) @category = category.find(1) @category_item...

html - Flex box fix for IE? -

Image
i using flex portion of web page doesn't great in ie. what's best fix this? demo: https://jsfiddle.net/8otrpjt8/ /* latest compiled , minified css included external resource*/ /* optional theme */ @import url('//netdna.bootstrapcdn.com/bootstrap/3.0.0/css/bootstrap-theme.min.css'); body { margin: 10px; } .row-flex, .row-flex > div[class*='col-'] { display: -webkit-box; display: -moz-box; display: -ms-flexbox; display: -webkit-flex; display: flex; flex:1 1 auto; } .row-flex-wrap { -webkit-flex-flow: row wrap; align-content: flex-start; flex:0; } .row-flex > div[class*='col-'], .container-flex > div[class*='col-'] { margin:-.2px; /* hack adjust wrapping */ } .container-flex > div[class*='col-'] div,.row-flex > div[class*='col-'] div { width:100%; } .flex-col { display: flex; display: -webkit-flex; flex: ...

c++ - General swap implementation in terms of byte swap -

the current implementation general swap in standard library like template <class t> void swap(t& a, t& b) { t c(move(a)); = move(b); b = move(c); } i'm wondering whether can following instead. template <class t> void swap(t& a, t& b) { unsigned char x; auto pa = reintepret_cast<unsigned char*>(&a); auto pb = reintepret_cast<unsigned char*>(&b); auto pc = pa + sizeof(a); while (pa != pc) { x = *pa; *pa = *pb; *pb = x; ++pa, ++pb; } } i think implementation better in terms of space usage, takes 1 byte. there many considerations need addressed when swapping classes. pod types, swapping bytes works correctly. more complicated classes, however, may rely on invariants byte-swapping won't respect. example, consider reference member variable: struct foo { foo() : bar{}, barref{bar} {}; int bar; int& barref; // expected refer neighboring `bar` }; int main() { ...

Modifying the sort order of module in oscommerce -

how can modify sort order of modules in oscommerce. i cannot find module_admin_dashboard_xxxxx_sort_order defined. in administration panel under "modules" -> "dashboard". can set sort order of each item individually.

php - check if row exists with mysql -

i need checking if row exists. getting "email no longer exists publisher@example.com". is there better way check if row exists mysqli? if (count($_post)) { $email = $dbl->real_escape_string(trim(strip_tags($_post['email']))); $passwd = $dbl->real_escape_string(trim(strip_tags($_post['passwd']))); $query = "select `email` `tbluser` `email` = '$email'"; $result = mysqli_query($dbl,$query); if(is_resource($result) && mysqli_num_rows($result) == 1 ){ $row = mysqli_fetch_assoc($result); echo $email . " email exists " . $row["email"] . "\n"; } else{ echo "email no longer exists" . $email . "\n"; } } the following tried, tested , proven methods check if row exists. (some of use myself, or have used in past). edit: made previous error in syntax used mysqli_query() twice. please consult revisi...

javascript - Target dynamic element in jQuery -

i have select menu being created dynamically in javascript file. have set css display:none styling can happen silently before loaded. however, having trouble targeting make display again. what's fool-proof way target (or dynamically created select menu) once it's attached dom? insight. initial code loading select menu: createdropdown:function(oletter){ var dropdwn = create({type:"select",id:"glossaryworddropdown", classname:"glossaryselect"}); for(var i=0;i<oletter.arwords.length;i++){ var oword = oletter.arwords[i]; $('<option />', {value: oword.id, text: oword.id}).appendto(dropdwn); } $(dropdwn).on('change', this.ondropdown.bind(this)); //add wordholder box var wordholderelement = this._screen.getelementbyid("wordholder"); wordholderelement._container.innerhtml = ""; $(wordholderelement._container).append(dropdwn); }, css: .glossaryselect ...

c# - Why NullReferenceException is not being caught? -

i have generic catch(exception ex) block in method. why not catching nullreferenceexception exception ? happens once in while. public bool changeorder(string conumber, string recepitnumber, string webserviceurl, string username, string password,ref string error) { error = ""; bool result = false; try { movexapi objmovexapi = new movexapi(); objmovexapi.apiname = "zoi100mi"; objmovexapi.transactionname = "chghead"; objmovexapi.url = webserviceurl; objmovexapi.maxrecords = 0; objmovexapi.inputkeyvaluepair = new dictionary<string, string>(); objmovexapi.returncolumns = new list<string>(); string url = objmovexapi.url + objmovexapi.apiname + "/" + objmovexapi.transactionname; string returncols = string.join(",", objmovexapi.returncolumns.select(s => s.tostring()).toarray()); string maxrecords = objmovexapi.maxr...

sql server - locked table by stored procedures in sql -

this question exact duplicate of: sql table locked when update can select [closed] i have table name called cusdec_boi table publish transaction replication,and client update table always,problem times lock table. have stored procedure name called isautodochrg,this sp runing every 3min.when lock cusdec_boi table.i found schedule sp's taken long time running.i think problem in following sp's please tell me there errors found following sps use [isdb] go /****** object: storedprocedure [dbo].[isautodocchrg] script date: 5/15/2010 2:12:44 ******/ set ansi_nulls on go set quoted_identifier on go create procedure [dbo].[isautodocchrg] /* ----------------------------------------curser valriable>>>>>>>>>>>>>>> */ declare @consigneetin varchar(17), @instanceid nchar(10), @ppc varchar(17), @officecd varchar(5), @noticedate datetime, @ide_typ_typ char(1), @dec...

c# - Code Behind ASPX Page can see the Classes in AppCode but not their properties -

my code behind can see classes in appcode file none of attributes/variables/properties of classes. i have set classes compile. variables , classes public. have tried adding using 'project'.appcode top. incredibly frustrating. i have copy pasted alot of code project ensure it's not configuration issue. my code behind page can see classes. doesn't know of them have properties. instantiating new 1 uses blank constructor when there isn't one. for example, within appcode folder customer class. public class customer { public string fname { get; set; } public string lname { get; set; } public string address { get; set; } public string city { get; set; } public province prov { get; set; } public string pcode { get; set; } public string email { get; set; } public list<phonenumber> pnums { get; set; } public list<pet> pets { get; set; } public string efname { get; set; } public string elname { get; set; } ...

yaml - "docker-compose build" is showing me help text when I specify a file -

when specify compose file during build: docker-compose build -f compose-production.yml the images don't built, , in stead i'm shown help-text: $ docker-compose build -f compose-production.yml build or rebuild services. services built once , tagged `project_service`, e.g. `composetest_db`. if change service's `dockerfile` or contents of build directory, can run `docker-compose build` rebuild it. usage: build [options] [service...] options: --force-rm remove intermediate containers. --no-cache not use cache when building image. --pull attempt pull newer version of image. anyone knows what's going on? run with: docker-compose -f compose-production.yml build -f option docker-compose not option command build

vaadin7 - Vaadin Upload Component Upload Button, changing it's Style? -

vaadin 7.6.2 how apply setstylename("small") on upload component’s upload button , have work? if requires custom css great see example of looks like. question upload button, not "browse" button, has been hidden setimmediate(true) in case. use scss small upload buttons: .v-upload-small .v-button { height: 31px; padding: 0 14px; font-size: 14px; border-radius: 4px; } and on upload button use addstylename("small") instead of setstylename(...)

conditional compilation - Can complex logical expressions be used in #ifdef in C++? -

i have found 1 can combine multiple #ifdef s using command #if defined(stuff) way: #if defined(_bla1) || defined(_bla2) or #if defined(_bla1) && defined(_bla2) but can use parentheses combine more refined definitions, such as: #if (defined(_bla1) || defined(_bla2)) && (defined(_bla3) || defined(_bla4)) ? yes, works fine. have tested in xcode, uses llvm compiler.

jquery - Wikipedia API JSONP request blocked mime type mismatch -

i trying random pages wikipedia api using jsonp. in chrome , ie11 gives me url name "was blocked due mime type mismatch". here jsonp request. $.ajax({ url: "https://en.wikipedia.org/w/api.php?action=query&list=random&rnlimit=5", jsonp: "callback", datatype: "jsonp", format: "json", success: function( data ) { console.log( data ); } }); if paste url in browser , check html response find instructions in there. have add format=json query string parameter. try following ajax call: $.ajax({ url: "https://en.wikipedia.org/w/api.php?action=query&list=random&rnlimit=5&format=json", datatype: "jsonp", success: function( data ) { console.log( data ); } });

doctrine2 - Symfony 2 form checkbox checked based on entity data? -

ok have built form type accounts entity , within have entity type field panels account entitled have, following works, $results = $options['data']->getresellerpanelops()->toarray(); <- data from! ->add('panels', 'entity', ['label' => 'panels', 'class' => 'bundle:panels', 'choice_label' => 'panels.title', 'multiple' => true, 'expanded' => true, 'required' => false, 'mapped' => false, 'attr' => ['class' => 'panels'], 'query_builder' => function(entityrepository $er) use ($results) { ...

objective c - iOS application goes to dashboard when it comes from background to foreground? -

i experiencing problem switching app background foreground. it tab bar based app. if launch app redirects view controller left off. if launch after 5/10 min(basically after period). launches app initial screen. from google, read if app in background while, killed operating system based on need of ram other application. 1. reason above problem or other reasons ? this main reason can happen. can maybe increase time takes happen implementing didreceivememorywarning method , adding sufficient code free() / release lot of resources can later recreated. give chance of not getting killed in cases , maybe buy time.

c# - .Net messaging pub/sub pattern -

so have .net application running on nancyfx (needs platform agnostic). have requirement need send notification when event happens (subscription). notification implement interface: public interface inotification { public void notify(); } there many different implementations e.g. email, pushbullet, pushover etc. what struggling how implement implementations of inotification execute notify() when there subscription. can point me in right direction. i don't want use sort of external queues, since application running on users machines. so application self-hosted, client , server located on users machine , not talk outside world, it's internal. excuse me second, i'll want make sure got right. have not written what's exact problem, assume stuck somewhere @ basics. i'll ignore nancyfx, don't know it, assume if supported case, you'd find in docs. to let client know has changed, have 3 options: (a) there's list of old events on s...

c++ - Searching a Linked List -

below have linked list search function. function not searches element in list, set previous node's address, later used in delete function. if value found in list, node's address returned, otherwise previous node null , function returns null. receiving segmentation fault , unsure why. can explain me why? thanks. struct intnodetype { int value; intnodetype * next; intnodetype (int v=0, intnodetype * p=null):value(v),next(p) { } }; intnodetype * search (intnodetype * firstnodeptr, int value, intnodetype * & prevnode) { intnodetype * cur; intnodetype * prev; cur = firstnodeptr; prev = prevnode; while (cur!=null) { if (cur->value==value) { prev -> next = cur; return cur; } cur = cur->next; //update p current node's next field } prevnode = null; ...

android - java.lang.IllegalArgumentException: ViewPager does not have a PagerAdapter set -

**i trying add swipe tab dynamically, while adding tab setupwithviewpager shows below exception in tablayout.setupwithviewpager(viewpager) 03-17 15:01:24.593 3683-3718/info.androidhive.materialtabs i/openglrenderer: initialized egl, version 1.4 03-17 15:01:24.611 3683-3718/info.androidhive.materialtabs d/openglrenderer: enabling debug mode 0 03-17 15:01:24.691 3683-3683/info.androidhive.materialtabs i/timeline: timeline: activity_idle id: android.os.binderproxy@3feea074 time:133990912 03-17 15:01:26.807 3683-3683/info.androidhive.materialtabs i/timeline: timeline: activity_launch_request id:info.androidhive.materialtabs time:133993028 03-17 15:01:26.854 3683-3683/info.androidhive.materialtabs d/action: called in setviewpager 03-17 15:01:26.857 3683-3683/info.androidhive.materialtabs d/androidruntime: shutting down vm 03-17 15:01:26.862 3683-3683/info.androidhive.materialtabs e/androidruntime: fatal exception: main ...

php - Error Handling in Slim Framework Custom Middleware -

i trying handle errors in slim framework custom middle ware dont know how in code doing if request not of 4 specific types through error want handel in errorhandler appropriate message , status code returning status in postman blank screen in response body. not familiar slim. in advance <?php require 'vendor/autoload.php'; use \slim\app; $c = new \slim\container(); $c['notallowedhandler'] = function ($c) { return function ($request, $response, $methods) use ($c) { return $c['response'] ->withstatus(405) ->withheader('allow', implode(', ', $methods)) ->withheader('content-type', 'application/json') ->write(json_encode(array("c_status"=>"405","message"=>"bad request"))); }; }; $c['notfoundhandler'] = function ($c) { return function ($request, $response) use ($c) { return $c['re...

java - Selenium webdriver code takes time to exit while loop -

the code have works when while loop breaks, takes 20 seconds what's below while loop execute. here code: driver.manage().timeouts().pageloadtimeout(3, timeunit.seconds); try { driver.get("website"); } catch (timeoutexception e) { string x = driver.findelement(by.cssselector("b")).gettext(); driver.get("website"); driver.findelement(by.id("479510558845313")).sendkeys(instagramaievx.spamusernameinput); driver.findelement(by.id("263795143794707")).sendkeys(instagramaievx.spamcommentinput); driver.findelement(by.id("u_0_4")).sendkeys(x); driver.findelement(by.id("u_0_5")).click(); while (true){ webelement button = null; try { button = driver.findelement(by.cssselector("a[action='cancel']")); } catch (nosuchelementexception ex){ break; } ...

mysql - Q:Bookshelf.js:How to query by bookshelfjs? -

i use method bookshelfjs.org query datas. there bug! code. var defray = db.model.extend({ tablename: 'defray', idattribute: 'id' }); new defray.query('where', 'purchaseid', '=', '2').fetch().then(function(model) { console.log(model); }); the database mysql,and want use sql like select * defray purchaseid = 2; bug info is var model = this.forge(); ^ typeerror: this.forge not function @ new model.(anonymous function).collection.(anonymous function) (e:\wordspace\javascript\hekr_end\node_modules\bookshelf\lib\bookshelf.js:329:24) @ object.<anonymous> (e:\wordspace\javascript\hekr_end\database\model.js:30:1) @ module._compile (module.js:435:26) @ object.module._extensions..js (module.js:442:10) @ module.load (module.js:356:32) @ function.module._load (module.js:313:12) @ module.require (module.js:366:17) @ require (module.js:385:17) @ object.<anonym...

java - Check compressed archive for corruption -

i creating compressed archives tar , bzip2 using jarchivelib utilizes org.apache.commons.compress . try { archiver archiver = archiverfactory.createarchiver(archiveformat.tar, compressiontype.bzip2); file archive = archiver.create(archivename, destination, sourcefilesarr); } catch (ioexception e) { e.printstacktrace(); } sometimes can happen created file corrupted, want check , recreate archive if necessary. there no error thrown , detected corruption when trying decompress manually tar -xf file.tar.bz2 ( note: extracting tar -xjf file.tar.bz2 works flawlessly) tar: archive contains `\2640\003\203\325@\0\0\0\003\336\274' numeric off_t value expected tar: archive contains `\0l`\t\0\021\0' numeric mode_t value expected tar: archive contains `\003\301\345\0\0\0\0\006\361\0p\340' numeric time_t value expected tar: archive contains `\0\210\001\b\0\233\0' numeric uid_t value expected tar: archive contains `l\001\210\0\210\001\263' numeric gid_t...

Ask for permissions with API 22 Android -

in project i'm working, have set of permissions, , 3 of them, tagged dangerous . in devices android < android 6.0.0 there no problems, newest version, app can't work properly. so, searching in google permissions, arrived google documentation page, talk how request it: http://developer.android.com/intl/es/training/permissions/requesting.html they use code. if (contextcompat.checkselfpermission(thisactivity, manifest.permission.read_contacts) != packagemanager.permission_granted) { ... } where contextcompat.checkselfpermission(..) in api 23. but problem comes tha specifications right in project (bosses, etc...) can't upgrade api 23 , use library compats contains method. so question is: there way handle request of permissions, doing workaround? permissions: <uses-permission android:name="xx.xx.otr.app.providers.imps.permission.read_only" /> <uses-permission android:name="xx.xx.otr.app.providers.imps....