Posts

Showing posts from January, 2013

python - Django Soft Delete -

since django's default user model uses is_active flag soft deletes, make sense name field is_active every other model needs soft deleted? is_deleted seems far more common, seems is_active keeps things consistent, better, right? i suppose it's more of preference. consistency's sake, is_active better. there might cases is_deleted might make more sense/feel more natural developer. it's worth, had both fields is_active , is_deleted in 1 of our projects. used is_deleted denote soft deletes , is_active mean whether or not model still actively participate/engage system.

html - Why is my header starting so low? -

it beginning 20px top , not aligned top. if margin-top: -15px; moves text , looks off, text more top . here css code: body { background-color: #1a1a1a; } header, h1 { text-align: center; font-family: cgf locust resistance; font-size: 50px; color: lightgray; -webkit-text-stroke: 1.5px black; } header { margin: 0; padding: 0; height: 100px; border-bottom: 0.5px solid #b3b3b3; background-image: url(omen.png); background-repeat: no-repeat; background-position: center; } nav { position: relative; top: -5px; margin: auto; padding: 0; list-style: none; width: 100%; text-align: center; border-bottom: 0.5px solid #b3b3b3; } nav ul li { display: inline; color: white; font-family: cgf locust resistance; font-size: 12.5px; padding: 20px; } .red { color: red; } here html <!doctype html> <html> <head> <link rel="stylesheet" ty

How should I manage deployments with kubernetes -

i hoping find way automate process of going code deployed application on kubernetes cluster. in order build , deploy app need first build docker image, tag it, , push ecr. need update deployment.yaml new tag docker image , run deployment kubectl apply -f deployment.yaml. this go , perform rolling deployment on kubernetes cluster updating pods new version of container image, once deployment has completed may need other application specific things such running database migrations, or cache clear/warming may or may not need run given deployment. i suppose write shell script runs of these commands, , run whenever want start new deployment, hoping there better/industry standard way solve these problems have missed. as writing question noticed stackoverflow recommend question: kubernetes deployments . 1 of answers seems imply @ least of looking coming kubernetes, want make sure if there better solution using @ least know it. my colleague has blog post topic: http://blo

python - Replicating GROUP_CONCAT for pandas.DataFrame -

i have pandas dataframe df: +------+---------+ | team | user | +------+---------+ | | elmer | | | daffy | | | bugs | | b | dawg | | | foghorn | | b | speedy | | | goofy | | | marvin | | b | pepe | | c | petunia | | c | porky | +------+--------- i want find or write function return dataframe return in mysql using following: select team, group_concat(user) df group team for following result: +------+---------------------------------------+ | team | group_concat(user) | +------+---------------------------------------+ | | elmer,daffy,bugs,foghorn,goofy,marvin | | b | dawg,speedy,pepe | | c | petunia,porky | +------+---------------------------------------+ i can think of nasty ways iterating on rows , adding dictionary, there's got better way. do following: df.groupby('team'

Firebase Cloud Messaging notification from Java instead of Firebase Console -

i new firebase , running errors such mismatch sender id , authentication error http status 401 when java application tries send notification/message using client's firebase token. note using firebase console, able send message client. for client app, did following: cloned firebase messaging quickstart app here -- https://github.com/firebase/quickstart-android/tree/master/messaging -- setup firebase dependencies , such. loaded cloned app in android studio . using firebase console, created new project called my notification client , added app using com.google.firebase.quickstart.fcm package name of android app. downloaded google-services.json file android app added newly created project , copied messaging/app/ folder , sync'd grade files within android studio . created emulator , ran app within android studio . when app got loaded in emulator, clicked log token button capture client's firebase token in android monitor tab in android studio . using firebas

javascript - Bootstrap Datepicker and Disable C#/JSON array of dates, -

i have list of dates want disable in bootstrap date picker . cannot datesdisabled function work array of dates returned json. work hard coded array of dates. is there need format dates returned json in order work? query: var datesbooked= jsonconvert.serializeobject(db.calendar.where(x => x.callocation != "off")).select(x => x.caldate).distinct().tolist()); in view: @html.textbox("addeddates", null, new { @class = "form-control small", @value = viewbag.seldate, autocomplete = "off" }) @section scripts { @scripts.render("~/bundles/jqueryval") <script src="~/scripts/jquery.unobtrusive-ajax.min.js"></script> <script src="~/scripts/jquery.timepicker.js"></script> <script src="~/scripts/bootstrap-datepicker.min.js"></script> <script> var unavailabledates= @html.raw(json.encode(model.datesbooked)); $input = $("#add

c++ - How can I dereference this 2D dynamic array? -

i having issues dereferencing 2d dynamic array in if statement's condition on line 5. typedef char* chararrayptr; void reserveseat(chararrayptr *m, char row, char seatletter){ for(int j = 1; j < 5; j++){ if(m[row - 1][j] == seatletter) m[row - 1][j] = 'x'; } } i've tried putting * in front, error message: indirection requires pointer operand ('int' invalid) any appreciated, in advance. if mean dereference 2d array operator *, please try following. typedef char* chararrayptr; void reserveseat(chararrayptr *m, char row, char seatletter){ for(int j = 1; j < 5; j++){ //if(m[row - 1][j] == seatletter) if( *( (char*)m + (row - 1)*5 + j ) == seatletter) m[row - 1][j] = 'x'; } }

microsoft metro - Access 2013 sql query help in displaying multiple columns and most recent log of the unique id on the top of the form -

i have log table mutiple columns such name, dob, contact type, loan number, entry date, etc. each loan number can have multiple row of logs because of diff contact type , entry dates. there entry dates same date well. now questin is, how write sql statement show columns table recent log of loan number shows on top of form created above table displayed datasheet view not s single view? the reason recent log of same loan no should displayed first. in design view of query, put max under total instead of group by. giving me error. i need display recent log on top of datasheet view in form.

android - Why value not same even call same variable -

this question has answer here: android: converting string int 7 answers //global getdatabasechart(); adddata(); public void adddata() { int a; = profile.gettotalbelum(); log.d("aa",""+a); final float[] ydata = {a}; ...... } public void getdatabasechart(){ //creating string request log.d("masuktak","masuktak"); stringrequest stringrequest = new stringrequest(request.method.post, config.url_web + "a.php", new response.listener<string>() { @override public void onresponse(string response) { // hidepdialog(); try { log.d("tgksini", response); jsonobject json = new jsonobject(response); int success

javascript - Why does my iterator variable keep resetting? -

i have array populated numbers. want display new number every 5 seconds in alert() popup. have appears working part, resets before showing number 3. @ first shows 1, shows 2, shows 1 again. can't figure out. maintain syntax part if can. don't understand why counter keeps resetting 0. var arr = [1, 2, 3, 4, 5]; var maxloops = number(arr.length); var counter = -1; (function next() { if (counter++ > maxloops); settimeout(function() { alert(arr[counter]); next(); }, 5000); })(); the issue here value of counter may change between setting timer , calling anonymous function within it. alleviate problem, value of counter must passed timer function. var arr = [1, 2, 3, 4, 5]; var maxloops = number(arr.length) - 1; var counter = -1; (function next() { if (counter++ >= maxloops) return; settimeout((function (c) { return (function() { alert(arr[c]); next(); }); })(counter), 5000);

python - Issue with ® symbol crashing IDLE -

i doing assessment university have scrape websites , display information using tkinter. website using uses ® symbol instead html code ®. every time run code, idle crashes. wondering if knows way around issue. urllib import urlopen re import findall tkinter import * htmlparser import * games_window = tk() games_window.title('top 10 games specials') games_window.geometry('1000x1000') games_contents = urlopen("http://store.steampowered.com/search/?specials=1").read() gam_info = findall('<img src="([\w\.:/]*.jpg[?t=0-9]*)[a-z\s?="<>/_]*([\w\.\-\(\) \':$&!®]*)[a-z\s/<>="_]*([\w ,]*)[\w\s/<>="&-;%#]*([0-9\.$]*)[\w\s/<>]*([0-9\.$]*)',games_contents) info01 = label(games_window, text = gam_info[0][1], font=("courier", 15), relief=sunken) info01.place(x = 230, y = 450) games_window.mainloop()

performance - Standard Method of Simplifying Polynomial Formulas -

i trying reduce time takes (mostly) polynomial formula complete, non-recursive. there exist method in order reduce amount of processing required complete task? for instance if run code: if(distance > sqrt(dx*dx + dy*dy)) { dosomething(); } this better implemented into: if(distance*distance > dx*dx + dy*dy) { dosomething(); } my question is, there standard way of knowing how simplify things this, kind of how if have formula, follow pemdas boiled down number. equation trying simplify this: offset = |distance*(xobj-xcamera)-base*(base-depth)-distance*base| / hypot(distance, base); //variables are: distance, xobj, xcamera, base, depth; i know couple of ways improve it, more i'd know if can solve methodically vs intuition.

php curl equivalent of post with content -

i have following get_file_contents code $opts = array('http' => array( 'method' => 'post', 'header' => 'content-type: application/vnd+cbnv+endpoint', 'content' => $encryptedstring )); $buff = @file_get_contents($url, false, stream_context_create($opts)); how can done using curl ? i trying $handle = curl_init(); curl_setopt($handle, curlopt_url, $url); curl_setopt($handle, curlopt_returntransfer, true); curl_setopt($handle, curlopt_post, true); curl_setopt($handle, curlopt_postfields, $encryptedstring); $ret = curl_exec($handle); curl_close($handle); $ret null , should string echo in @$url file thank you probably, have problem becouse foget add context header. try code: $handle = curl_init(); curl_setopt($handle, curlopt_url, $url); curl_setopt($handle, curlopt_returntransfer, true); curl_setopt($handle, curlopt_post, true); curl_setopt($handle, curlopt_postfields, $e

Why python pandas does not provide Linux whl files -

i wondering why python pandas not provide .whl files pip install on linux. whl files available mac , windows, though. see: https://pypi.python.org/pypi/pandas/0.18.1 i pip install pandas but involves time-consuming process of building source. have continuous-integration system includes pandas build dependency, i'd have benefit of fast install binary .whl file without building source. armin ronacher discusses @ length. fundamentally, linux distributions not sufficiently uniform , can't depend on presence of particular libraries link against; python library may inconsistent. you can build own wheel environments using , install them many times like, should work fine continuous integration system: $ pip wheel pandas collecting pandas downloading pandas-0.18.1.tar.gz (7.3mb) 100% |████████████████████████████████| 7.3mb 131kb/s ... built pandas $ ls pandas* pandas-0.18.1-cp35-cp35m-linux_x86_64.whl $ pip install pandas-0.18.1-cp35-cp35m-linux_x86_

ios - How to compile java code with swift in XCode -

i use j2objc xcode build rules in xcode(swift). write java file(people.java) 2.make settings build rules, , add custom script following: "${j2objc_home}/j2objc" -d ${derived_files_dir} -sourcepath "${project_dir}/iosapp-swift" --no-package-directories -use-arc ${input_file_path}; note: enable arc add bridging-header file , import people.h file. call function people class in viewcontroller file. when build project ,failed:'people.h not found'. and when build before importing , using people.h, implement import people.h file , calling function people class in viewcontroller file, , build project. works. i think problem caused j2objc not convert java file .h/.m file before build bridging-header file. knows how fix it? thanks you'll want add people.java xcode target's "compile sources" build phase. when phase run, compile each file using either built-in rules objective c files, or custom build rule java

matplotlib - Plt.show shows full graph but savefig is cropping the image (python) -

Image
my code succesfully saving images file, cropping important details right hand side. answers exist fixing problem when arises plt.show , savefig command incorrectly producing graph in example. how can fixed? the relevant sample of code: import glob import os file in glob.glob("*.oax"): try: spc_file = open(file, 'r').read() newname = file[6:8] + '-' + file[4:6] + '-' + file[0:4] + ' ' + file[8:12] + ' utc (observed) - no sea breeze day' plt.title(newname, fontsize=12, loc='left') plt.savefig('x:/' + newname + '.png') plt.show() except exception: pass and images (top plt.show , bottom file produced savefig : you may try plt.savefig('x:/' + newname + '.png', bbox_inches='tight') or may define figure size like fig = plt.figure(figsize=(9, 11)) ... plt.savefig(filename, bbox_inches = 'tight'

How using a pointer and definition from a #define in C -

i wondering how gattcharcfg_t within defined snippet being used. here #define snipped: // client characteristic configuration table (from ccc attribute value pointer) #define gatt_ccc_tbl( pvalue ) ( (gattcharcfg_t *)(*((ptr_type)(pvalue))) ) and here how being accessed in couple spots in given code: // characteristic configuration: voltage static gattcharcfg_t *voltdataconfig; // allocate client characteristic configuration table voltdataconfig = (gattcharcfg_t *)icall_malloc(sizeof(gattcharcfg_t) * linkdbnumconns); if (voltdataconfig == null) { return (blememallocerror); } i guess not understanding mechanics of how being accessed. appreciate more thorough explanation diving c. ( (gattcharcfg_t *)(*((ptr_type)(pvalue))) ) (ptr_type)(pvalue) - cast pvalue ptr_type (pointer) *((ptr_type)(pvalue)) - @ memory location pointed pointer (gattcharcfg_t *)(*

java - Can I make an exception to the counter in a for loop? -

i'm trying make program play rock, paper, scissors computer. however, part of assignment having player choose amount of rounds play computer. if there tie, round not supposed count towards game. my code looks -- i'm more focused on for part of program: int gameplays = 0; (int = 0; < gameplays; i++) { // if, else if, , else statements make game possible. // here example of part of code: if (cpuchoice.equals ("rock")) { if (userchoice.equals ("scissors")) { system.out.println("rock beats scissors, computer wins."); } else if (userchoice.equals ("paper")) { system.out.println("paper beats rock, computer wins."); } else { system.out.println("you both chose rock! it's tie."); } // rest else if cpuchoice.equals "paper" , else. } how exclude last else statement when it's tie counter? i've wrestled couple hours , can't find solutions. i

javascript - NodeJS Express - Want to run handler twice on single route -

i have route router.get('/generatedoc', handlerequest); , want run handlerequest twice. can suggest me how tackle situation. below code example. function handlerequest(req, res, next) { (var = 0; < 2; i++) { cacheservice.clean(); pdfcontroller.generatepdfs(req, res, next); } } it's odd thing require, can it: function handlerequestinnards(req, res, next) { cacheservice.clean(); pdfcontroller.generatepdfs(req, res, next); } function handlerequest(req, res, next) { handlerequestinnards(req, res, function() { handlerequestinnards(req, res, next); }); } you have more luck library bluebird can make promise , stuff like: function handlerequest(req, res, next) { promise.all([ handlerequest(req, res), handlerequest(req, res) ]).ascallback(next); }

ios - Is it Necessary to specify "use core data " while creating an app? -

i mid-way in creation of app , have not specified "use core data" during creation of project . want use "core data" in app , enough if add manually ? major difference ? or should start project again beginning ? you can add project, when want add framework related , delegate method of coredata to add in appdelegate file, work fine. later can create new file xcdatamodal type. hope helps.

android - FireBaseInstanceId service does not get registered -

i trying run demo given here . problem whenever app tries register instanceid, "background sync failed: missing_instanceid_service, retry in 320s" , when print token, says token null. tried changing instance_id_event instead of instanceid_event , other solution asked on stackoverflow, none of them works me. firebase won't run without google play services, check if available.

android listview refresh data come from server issue -

Image
i have activity have listview data come server.its working fine problem not refresh list automatically want listview update when data come server try not working.for me. please me how here activity code send , receive data server. public class datasendactivity extends activity { private static final string tag = registeractivity.class.getsimplename(); private button button; private button btnlinktologin; private edittext edittext; private edittext inputemail; private edittext inputpassword; private progressdialog pdialog; private sessionmanager session; private sqlitehandler db; string rremail = null; string myjson; private static final string tag_results = "result"; private static final string tag_data = "data"; private static final string tag_created_at = "created_at"; private static final string tag_sender_email = "sender_email"; private static final string tag_reciver

android - Xamarin GCM Component - Manifest Malformed -

Image
i developing android application xamarin.android. my application running perfectly, when add gcm component gives following error: android application debugging. application not started. ensure application has been installed target device , has launchable activity (mainlauncher = true). additionally, check build->configuration manager ensure project set deploy configuration. if remove component works fine. here image error: i have tried many solutions google, nothing has helped. how can prevent error happening? you need make sure package name not start uppercase letter - screenshot, looks " r estaurantapp". this known issue gcm , not bug in xamarin component: https://code.google.com/p/android/issues/detail?id=37658

php - how to decode binary string from certificate -

here code works fine , can parse data certificate. however, 1 of array key's seems have binary encoded value, how can go parsing it? [1.3.6.1.4.1.11129.2.4.2] => �jhv�� ��x����gp <5��߸�w�� �k;͋�g0e!���]���s�0�k/�����;#�sdθ�� f�������e���l�,gx�u�-=*��&,vv�/�������d�>�fv���\�u։��k;͎=g0e -�����>�㶍���`v$���|)�u�ӡ!�j�\�i�d����'i��mn�t����k��vh���d��:���(l�qq]g��d� g��oo��k;͋�g0e!��� ct����8�/��?��nbqŀ����� ��de�oaxlx����g`�:ny��=]���� full screenshot of output here: http://prnt.sc/b87cj9 here php script using parse certificate: $pemdata = "-----begin certificate----- miig1jccbb6gawibagiqwm6l42nrur9j5hogzv8ldzanbgkqhkig9w0baqsfadbx mqswcqydvqqgewjvuzevmbmga1uechmmdghhd3rllcbjbmmumtewlwydvqqdeyh0 agf3dgugrxh0zw5kzwqgvmfsawrhdglvbibtseeyntygu1nmienbmb4xdte1mdez mdawmdawmfoxdte3mdeyotizntk1ovowge8xezarbgsrbgeeayi3paibaxmcvvmx gtaxbgsrbgeeayi3paibagwirgvsyxdhcmuxftatbgnvbaomdfroyxd0zswgsw5j ljelmakga1uebhmcvvmxezarbgnvbagmcknhbglmb3juawexfjaubgnvba

android - How to redirect non supported Deep-link URL to Browser -

my app supports deep-linking email , external links. app opens , navigates specific screen based on url. don't support url path example, http://my-deeplink-url/page1 app should open , http://my-deeplink-url/page2 should open on browser. since app support my-deeplink-url uri path, both link app opens. ok, if app opens, needs redirect browser if url not supported. i tried starting activity using intent.action_view , again opens app , supports same deep-link url. what explicit intent open url in browser. you should able investigating pathprefix options: https://developer.android.com/guide/topics/manifest/data-element.html

javascript - How to connect by solClientjs? -

Image
i download solclientjs-7.1.1.3 demo website,and wanna use the sample connect own solace,but doesn't work. "readme" text file told "to run samples, must configure solace appliance accept connections samples. see chapter 'quick start' in api developer guide."i didn't find way configure solace appliance accept connections.how configure? the solace javascript api makes use of web messaging feature. note web messaging solace physical appliance requires separate product key unlock. different vmr, comes web messaging unlocked. please verify following: if using solace physical appliance (not vmr), need have web messaging product key. on cli, execute following verify. solace> show product-key product key : xxxx-xxxx-xxxx-xxxx-x-xxxx unlocked features : 1 web transport service verify web messaging service enabled, , configured web messaging port. necessary lines check in bold. default web messaging port 80. solace>

mysqli - Misunderstanding with password verifying php -

im trying verify user's login , compare 2 passwords (they hashed in database). im pretty sure stupid mistake or error can't find. how hash when saving db. $password = password_hash($_post["password"], password_bcrypt); , login method: if(isset($_post['login'])){ $stmt = $mysqli->prepare("select `password` users username=?"); $stmt->bind_param("s", $username); $username = $_post["username"]; $password = $_post["password"]; $stmt->execute(); $stmt->bind_result($result); if(password_verify($password, $result)){ header("location: http://localhost/test2/home.php"); } else{ echo "<script type='text/javascript'>alert('something went wrong!')</script>"; echo $mysqli->error; echo $stmt-&g

javascript - Why is this analytics event tracking code not working? -

my website offers downloads of various apps windows, mac, , linux platforms. want count number of times each individual software package downloaded. believe accomplished in google analytics setting event tracking code. i have javascript code @ top of page: (function(i,s,o,g,r,a,m){i['googleanalyticsobject']=r;i[r]=i[r]||function(){ (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new date();a=s.createelement(o), m=s.getelementsbytagname(o)[0];a.async=1;a.src=g;i have m.parentnode.insertbefore(a,m) })(window,document,'script','//www.google-analytics.com/analytics.js','ga'); ga('create', 'ua-xxxxxxxx-1', 'auto'); ga('send', 'pageview'); // necessary download tracking code work. var _gaq = _gaq || []; _gaq.push(['_setaccount', 'ua-xxxxxxxx-1']); _gaq.push(['_trackpageview']); downloads selected via dropdown menu, points javascript code gets right package downloa

reflection - Is there a way we can put the decorator /interceptor on all the objects that are being declared as field of a class? -

i have class teacher have 2 variables 1 collection of student class , student class object. intercept teacher class per understanding objects under teacher class should have interceptor attached it. instance 1 call getter method on student variable retrieved teacher class or list .it should call intercept method not called.this makes our axiom design false.so question : there way can automatically intercept objects declared within class , extend further down hierarchy within tree? below code : //teacher class package com.anz.interceptorproject; import java.util.arraylist; import java.util.list; /** * created mehakanand on 4/24/16. */public class teacher { private string username; private string cource; private list<student> students=new arraylist<student>( ); public student getcomplexobjectstudent() { return complexobjectstudent; } public void setcomplexobjectstudent( student complexobjectstudent ) { this.complexobjectstudent = comp

javascript - JQuery-bPopup Remove the old page from the popup and load a new page in same -

in jquery bpopup, how can remove old page popup , load new page in same popup without closing it? i have tried following 3 things, still no success: applied anchor tag in child page, opens new page in parent page applied $('.popup_content').bpopup({...}); in child page, opens new page along previous page, both page there in 2 rows. put 4 divs popup in parent page, , called bpopup() seperate popup divs in child pages. works well, keeps open overlay of old page. try function: function fnpopupclose1() { var popup = $('.popup1').bpopup(); popup.dispose = true; popup.close(); }

jsf 2 - datatable with columGroup has issue in responsive mode -

Image
i using sentinel 2.1 , primefaces 5.3, jsf 2.0, on weblogic 11g. we have production applications running on above spec long time now, , have no issues other below. i have datatable col span , row span. table looks fine in desktop mode, when seen in responsive mode, table looks odd , user cannot make sense out of data table. xhtml <p:datatable var="esl" value="#{estleaves.eleaves}" reflow="true" > <p:columngroup type="header"> <p:row> <p:column rowspan="2" headertext="employee" styleclass="wid10"/> <p:column colspan="4" headertext="jan" /> <p:column colspan="4" headertext="feb" /> </p:row> <p:row>

java - sending multiple data from one fragment to another fragment -

in app..one mainactivity..two fragment fragment , fragmentb.. created..and added 2 edittext in fragmenta..i want send edittext data framentb..and reuse itin..fragmentb..how this... should use interface concept..or..is concept.. public class fragmenta extends fragment { button nextt; edittext number; edittext alpha; } @override public void onstart() { super.onstart(); fm = ((mainactivity) context).getfragmentmanager(); } @override public void onclick(view view) { int viewid = view.getid(); fragmenttransaction ft; ft = fm.begintransaction(); fragmentb fragmentb = new fragmentb(); ft.replace(r.id.frame_content, fragmentb); ft.addtobackstack(null); ft.commit(); } @override public view oncreateview(layoutinflater inflater, viewgroup container, bundle savedinstancestate) { view vie

javascript - How to restrict user from selecting dates after 2months/60days from the date picker -

Image
hi trying restrict date entry present day next 60 days. restricting previous dates used mindate: 0 , worked fine. when used maxdate: 60 dates in stopped appearing. the code used: $('#dob').datetimepicker({ format:'y-m-d', formatdate:'y-m-d', mindate: 0, maxdate: 60 }); this shows while entering date: can please how rectify it? http://xdsoft.net/jqplugins/datetimepicker/ $('#dob').datetimepicker({ format:'y-m-d', formatdate:'y-m-d', mindate: 0, // mindate:'-1970/01/02',//yesterday minimum date(for today use 0 or -1970/01/01) // maxdate:'+1970/01/02'//tomorrow maximum date calendar maxdate: '+1970/03/03' // 2 months later, feb bit special. });

node.js - inserting document of collections to another collections in mongodb -

i have 2 different collection of documents in mongodb database. in recruits collection have plenty of documents. , want add document recruit collections employee collections here part of code function register(){ $http({ url:'/employee', method:'post', data:data // data findbyid query. }).then(function(result){ vm.cancel(); vm.toast(); },function(err){ console.log(err); }) here data findbyid recruits collections. same data want store in employees collection.i tried so: var emp = require('../models/employees.js'); router.post('/',function(req,res){ console.log(req.body); var register = new emp(req.body); //console.log(register); register.save(function(err, respond) { if (err) { throw err; } else { res.json(respond); } }) }); i think fine code console shows me mongoerror: e11000 duplicate key error index: h

java - wildfly migration from AS 7 to WF10 -

i new wildfly server. upgrading server as7 wildfly10. how add jars in wildfly10. in error log: getting missing dependencies(is because of not reading jars?). you need add jars given on wiki. sometimes need add module (if jar not shipped wildfly , define in jboss-deployment-structure.xml). sometimes, in case shipped (you may have search inside modules directory) , add in jboss-deployment-structure.xml again depends saying. dependency etc? https://docs.jboss.org/author/display/wfly10/class+loading+in+wildfly

paw app - Import dynamic variables from Postman into PAW -

i've set pretty extensive set of calls in collections using postman. use dynamic variables (e.g. {{username}}) in url, headers, , body of these calls dynamically replaced variables selected postman environment. i'd import collection (along environments) paw , have dynamic postman variables switched dynamic paw variables. i've looked @ how import postman , ensure of environment variables resolved? exact same question, answer (to use postman importer - https://luckymarmot.com/paw/extensions/postmanimporter ) doesn't seem work completely. i've tried latest version of importer (v2.0.0) , while appears convert dynamic variables define in headers of postman calls, not replace in url or request body. after importing paw still have, example, {{username}} in request body. any tips appreciated. we're working on large project enable paw import many api formats in lot nicer way (including postman), should have ready next week, , solve problem you're

Android Map Zooming to the current location when app loading do not working in Fragment -

i'm trying write code has map zooming current location when application loading. here code use zoom map. //zoom current location public location getmylocation() { locationmanager locationmanager = (locationmanager) getactivity().getsystemservice(context.location_service); criteria criteria = new criteria(); location location = locationmanager.getlastknownlocation(locationmanager.getbestprovider(criteria, false)); if (location != null) { map.animatecamera(cameraupdatefactory.newlatlngzoom( new latlng(location.getlatitude(), location.getlongitude()), 13)); cameraposition cameraposition = new cameraposition.builder() .target(new latlng(location.getlatitude(), location.getlongitude())) // sets center of map location user .zoom(17) // sets zoom .bearing(90) // sets orientation of camera east

ibm mobilefirst - worklight 6.2 how to schedule push notification to be send on 9 AM every day -

we using interval based polling event source push notifications new request. want send daily remainder daily devices @ 9am. how achieve using worklight. thanks in advance. you not need worklight achieve this. worklight not provide this. you need implement own custom external logic/script each day on 9am call adapter sends notifications devices.

java - How to catch exception in GUI -

i'm trying catch if user enter number (integer) instead of name (string) in textfield. but problem texts read string. so how can implement that: if user enters number in name field, show him error message? parse textfield int. int name = integer.parseint(jtextfield.gettext()); if textfield has name (e.g john, mary,etc..) come out exception. if textfield has int (e.g 1, 2 ,etc..) parse.you can check using way. or can try formatted text fields maskformatter.

javascript - Getting error in building project in using bower, nodejs, grunt -

i have created project using nodejs, bower packages installed not added tags in index.html, have manually inserted script tags ../bower_components so getting error http://localhost:9000/bower_components/angular-bootstrap/ui-bootstrap-tpls.min.js failed load resource: server responded status of 404 (not found) 2016-05-24 18:11:04.419 http://localhost:9000/bower_components/angular-ui-router/release/angular-ui-router.js failed load resource: server responded status of 404 (not found) 2016-05-24 18:11:04.581 angular.js:4587 uncaught error: [$injector:modulerr] failed instantiate module bulbulportal20app due to: error: [$injector:modulerr] failed instantiate module ui.bootstrap due to: error: [$injector:nomod] module 'ui.bootstrap' not available! either misspelled module name or forgot load it. if registering module ensure specify dependencies second argument. to avoid these errors in future have do?

jquery - my responsive menu doesn't work in mobile devices -

i made responsive menu-bar collapsed in screen max-width=850 pixel . working correctly in desktop different sizes . doesn't work in mobile devices . jquery responsive javascript menu-bar media-query css html $(document).ready(function(){ $(".showmenu").click(function(){ $(".objs").slidetoggle("slow"); }); }); #menu{ background-color: gray; height: 50px; } .obj{ display: inline-block; background-color: wheat; margin: 2px; width: 100px; text-align: center; height: 26px; border:0; } .showmenu { display: none; height: 100%; background-color: inherit; border: 0; color: black; outline: 0; } @media screen , (min-width: 850px){ .objs{ display: block !important; } .obj{ display: inline-block !important; }