Posts

Showing posts from August, 2015

json - set date without time in D3 js -

i working on d3 js. lerner , trying render multi line graph not able set proper date format.i wanted remove 12 pm .example april 12 pm wed 02 below code var margin = { top: 40, right: 40, bottom: 35, left: 85 }, width = 800 - margin.left - margin.right, height = 350 - margin.top - margin.bottom; var parsedate = d3.time.format("%y%m%d").parse; var x = d3.time.scale() .range([0, width]); var y = d3.scale.linear() .range([height, 0]); var color = d3.scale.category10(); var xaxis = d3.svg.axis() .scale(x) .orient("bottom"); var yaxis = d3.svg.axis() .scale(y) .orient("left"); var line = d3.svg.line() .interpolate("basis") .x(function (d) { return x(d.date); }) .y(function (d) { return y(d.request); }); var svg = d3.select("body").append("svg") .attr("width", width + margin.left + margin.right) .attr("height",...

Publish an app for Office that is packaged as an autohosted app for SharePoint Online Portal -

Image
my aim develop excel application , use on sharepoint online 2013 portal. developed excel task pane app on napa. downloaded visual studio , open on visual studio 2012. after changed it's project type app office auto hosted app sharepoint , publish it, got .app file. opened sharepoint online portal app catalog site , upload .app file apps sharepoint library. can see app(addresscleaner) below image. after of these steps went site content , click add app. can't see app in available apps. can't find solution. followed -> post what i'm missing? suggestion wrong? thanks i solved problem. didn't understand cause solved. downloaded project again napa , changed package type in visual studio. after uploaded apps sharepoint library in app catalog site. installed it. added catalog site trusted site excel file , inserted app. thats all.

mysql - How to store a value of the form 2.00 in databse in php? -

hii new in php , want store value 2.00 in database, storing 2 in database, used datatype int,double,float,decimal, no 1 works, please me sort out problem. in advance something decimal (10,2) . you can adjust scale , precision fit needs of numbers need store for ex:example: decimal(5,2) number has 3 digits before decimal , 2 digits after decimal

javascript - Jquery animation work only first time -

i have ajax load page after completion of ajax animate div (parent of changing content) animate once(first time). can give me description error or other way this. my code: $.ajax({ type: "post", url: "page.php", data:'', //data success: function(data){ $('#last_saved_text').html(displaycurrenttime()); /* below animation work once*/ $('#last_saved_text').parent('div').animate({'background-color':'rgb(212, 72, 54)'},{ duration: 1500, complete: function(e){ $('#last_saved_text').parent('div').css('background-color','rgb(249, 249, 249)');} }); }, fail: function( jqxhr, textstatus ) {} });

shell - Android root commands not working in application -

i experimenting shell commands on rooted nexus 7 tablet , found commands seem wouldn't need root privilege being executed. for example, if call: process process = runtime.getruntime().exec("su -c mkdir /sdcard/test"); the directory created. if call: process process = runtime.getruntime().exec("su -c mkdir /system/test"); nothing happens. (i have tried sorts of commands, , tried sorts of different syntax in case off, commands wouldn't need root access executed) when try execute command, popup superuser , grant application root privilege there else missing? have looked around , far can tell should work. thanks. you must quote argument mkdir , otherwise su assume /system/test user name , fail run. process process = runtime.getruntime().exec("su -c \"mkdir /path/to/test\""); some areas of filesystem, such /system , read due way filesystem organized/mounted. root access won't change that, command stil...

convert a code from java into python -

now trying change program java python, when fix 3 problems on code , run it. shows me error. traceback (most recent call last): file "serial.py", line 4, in <module> import serial file "/home/pi/serial.py", line , in <module> port=serial.serial( attributeerror:'module' object has no attribute 'serial' how can fix it? if need source code , problems had fix, let me know. please me it. you've named file serial.py or maybe serial.py. rename file else, "testserial.py" if you're desperate keep name. golden rule of python: never give file same name module importing from

MongoDB Java pull -

i tried remove embedded document without succcess. i'm looking java way of following instruction: db.games.update({'_id': 73}, {$pull: {'goals': {'goal': 4}}}) the java documentation pretty clear, constructing bson objects match respective json counterparts used in shell: basicdbobject query = new basicdbobject("_id", 73); basicdbobject fields = new basicdbobject("goals", new basicdbobject( "goal", 4)); basicdbobject update = new basicdbobject("$pull",fields); games.update( query, update );

java - ora-00913 too many values while using sequence -

in table have used sequence create id automatically how insert table using netbeans i tried code insert values , got following error [microsoft] [odbc driver oracle] [oracle]ora-00913:too many values the code is: private void jbutton1actionperformed(java.awt.event.actionevent evt) { try { string sql=("insert customer values(seq_user.nextval,?,?,?,?,?,?,?)"); pstmt=con.preparestatement(sql); pstmt.setstring(1,lname.gettext()); pstmt.setstring(2,fname.gettext()); pstmt.setstring(3,email.gettext()); pstmt.setstring(4,password.gettext()); pstmt.setstring(5,address1.gettext()); pstmt.setstring(6,address2.gettext()); pstmt.setstring(7,city.gettext()); pstmt.executeupdate(); } catch(sqlexception ex){ joptionpane.showmessagedialog(this,ex.getmessage()); }

modx - Wayfinder not respecting &level=`0`? -

i have following wayfinder call: [[wayfinder? &startid=`0` &level=`0` &includedocs=`5,6,7,11,12`]] this should show links listed resources, kept in parent resource. however, not. way can work include parent resource startid: [[wayfinder? &startid=`3` &level=`0` &includedocs=`5,6,7,11,12`]] this ok if resources under 1 parent, have variety of resources on variety of levels , parents can not display. does know doing wrong? if specify includedocs list docs, you'll need either set startid parent or include neccessary parents in includedocs call. (line 539 in wayfinder.class.php: ) /* if set, limit results specific resources */ if (!empty($this->_config['includedocs'])) { $c->where(array('modresource.id:in' => explode(',',$this->_config['includedocs']))); }

actionscript 3 - AS3 game performance on first start -

i have made game many objects on scene. objects loaded com.greensock.loading.loadermax instance. when play game after first loading in browser, performance bad. when try second time(all needed files in browser cache) works perfect. reason of poor performance on first loading?

python - How to find dict value by Key in list -

i have following list: lst = [ {'title1': {'link': 'zbelsw_tywa', 'episode': 'episode name'}}, {'title2': {'link': 'zbelsw_tywa', 'episode': 'episode name2'}}, ] now want search list word title1 how values of link , episode of key using list comprehension produce matches: [d[searchtitle] d in lst if searchtitle in d] where searchtitle contains 'title1' . result list of matching dictionaries. finding first match only: next((d[searchtitle] d in lst if searchtitle in d), none) which returns none if there no match, or dictionary matching key in it. demo: >>> lst = [ ... {'title1': {'link': 'zbelsw_tywa', 'episode': 'episode name'}}, ... {'title2': {'link': 'zbelsw_tywa', 'episode': 'episode name2'}}, ... ] >>> searchtitle = 'title1' >>> ...

verilog - How does undefined input affect the selection? -

Image
i writing verilog file. using following code function multiplexer: assign out = raddr_mux ? a:b however, output wave seems strange. as can see @ lower part of image, red line indicates raddr_mux not defined. however, sometimes, output out got value, output out has nothing. wondering how undefined affect selection behavior. thank you! an x on input means undefined, is either 0 or 1 . if both inputs mux @ same value not matter select value is, output still defined has 1 of inputs. in our example select x both inputs , output 0, 4 5. if inputs not same, output x , undefined either of input values.

c# - XNA RenderTarget Preserve Contents -

Image
i'm trying load texture rendertarget once on first draw , preserve contents draw same texture every frame without recreating it. this code have doesnt work , shows empty texture area , rendertarget2d rtarget = null; /// <summary> /// called when game should draw itself. /// </summary> /// <param name="gametime">provides snapshot of timing values.</param> protected override void draw(gametime gametime) { graphicsdevice.clear(gamebackgroundcolor); spritebatch.begin(); if (rtarget == null) { rtarget = new rendertarget2d(game.graphics.graphicsdevice, game.graphics.graphicsdevice.presentationparameters.backbufferwidth, game.graphics.graphicsdevice.presentationparameters.backbufferheight, false, ...

c# - How should I unit test a repository method implemented with Entity Framework? -

i have method in repository layer: public ienumerable<user> getactiveusers() { return dbcontext.users .where(u => u.isactive) .orderby(u => u.name) .tolist(); } should unit test method mocking dbcontext or should test actual database? i know stops being "unit" test when use actual database, don't see value in mocking dbcontext test repository methods thin in logic , calls ef's method directly. and if have use actual database, there standard strategy populate test data in database tests run independently , not alter state in database? probably not want hear, don't want mock dbcontext . know it's been done time , in ef6 it's been made easier before. there yet more interfaces , virtual methods available implement mock objects. technically it's not hard. it's behavior matters. even in small example there possible catch. mock dbset case-sensitive sorting. connected dbset recei...

html - Css break div in some unknown reason -

i trying view image width 100% width.and inner div should 25%.when zoom in div wont break.how can this.i giving html,css code below : html : <div class="container-a1"> <ul class="caption-style-1"> <li> <div class="hover-effect"> <div class="opacity"><img src="http://bassbrushes.diggsdev.com/wp-content/themes/diggsdesign_1/images/td1.png" alt="" width="225px" height="127px"></div> <h1><a href="#">styling & detangling</a></h1> <br/> </div> <div class="caption"> <div class="caption-text"> <img src="http://bassbrushes.diggsdev.com/wp-content/themes/diggsdesign_1/images/td2.png...

html - Run multiple functions based on a SINGLE form submission (method="post") using Node-express -

i looking perform multiple actions upon receiving html(or ejs) form content using post method. using node express, mongoose & mongodb. each of below post responses work individually unsure how proceed in updating multiple databases based on 1 single form submission. // insert passport db app.post('/signup', passport.authenticate('local-signup', { successredirect : '/index', // redirect secure profile section failureredirect : '/signup', // redirect signup page if there error failureflash : true // allow flash messages })); //insert database here [the content of in second function unimportant working fine , has been stripped down simplification.] app.post('/signup', function( req, res ) { new userdb( { user_id : req.body.content, first_name : req.body.fname, }).save( function( err, mysite, count ) { res.redirect( '/index' ); }); }); i have tried redirecting form conte...

Java Download file from url with download dialog -

i want download file url shows html, displays download dialog after 2-3 seconds. if this: try { url url = new url("http://my.url"); httpurlconnection con = (httpurlconnection) url.openconnection(); con.setrequestproperty("connection", "keep-alive"); con.setrequestproperty("content-length", integer.tostring(integer.max_value)); con.setreadtimeout(integer.max_value); con.setconnecttimeout(integer.max_value); con.connect(); bis = new bufferedinputstream(con.getinputstream(), 4096); bytearray = ioutils.tobytearray(bis); fileutils.writebytearraytofile(new file("myfile"), bytearray); } catch (exception e) { } i save displayed .html rather file displayed in save dialog. how should change code in order this? i'm guessing dialog has javascript waits couple seco...

objective c - Cocos2d Spritebuilder moving sprite and firing ammo -

i going through sprite builder tutorial , trying change things see how works , got myself stuck , in need of help. here's code problems marked //<---- i trying little character move right , left on screen based on how long press button. best find through searching below not smooth holding button down , moving character around. all actions appear take place on touches ending well, not when touched (began), how can modify that? static const cgfloat scrollspeed = 150.f; @implementation mainscene{ ccnode *hero; ccphysicsnode *physicsnode; } - (void)didloadfromccb { self.userinteractionenabled = true; } - (void)update:(cctime)delta { hero.position = ccp(hero.position.x + delta * scrollspeed, hero.position.y); physicsnode.position = ccp(physicsnode.position.x - (scrollspeed *delta), physicsnode.position.y); } - (void)jump {//make hero jump (still deciding on 400 or 600) [hero.physicsbody applyimpulse:ccp(0, 400.f)]; } - (void)fire { ccnode* ammo = [ccbreader load:@...

c# - How to get message body without downloading attachment -

i using imap4 client called: mailkit. works great, have problem on getting body of message without downloading attachments. want show mail's body text , attachments there are, if user clicks on attachment want download attachment. i've tried: var message = inbox.getmessage(uid, cancel.token); but gets entire message. also tried: uids[0] = uid; var ms = inbox.fetch(uids, messagesummaryitems.bodystructure , cancel.token); var bp1 = inbox.getbodypart(uid, ms.first().body, cancel.token); but again downloads attachment. with sample code, downloading entire message because requesting top-level body part of message. mime tree structure of "body parts". want traverse ms.first().body find part(s) want, , download them individually using getbodypart() method. take @ mailkit.bodypartmultipart, mailkit.bodypartmessage, mailkit.bodypartbasic , mailkit.bodyparttext. a bodypartmultipart contains other body parts. a bodypartmessage parts contains me...

c# - Form closing before new shows -

hello i'm making first windows forms app in c# using visual studio , have little problem. while i'm opening new form , closing previous one, when run app looks it's closing previous form before opens new one. doesn't , want avoid it. userpanel mdiuserpanel = new userpanel(username); mdiuserpanel.mdiparent = this.mdiparent; mdiuserpanel.show(); this.close(); i don't know going wrong. thankful help. wirth regards, darqscream @edit this doesn't seem case actually. propably : i have 3 forms mainform, login, loggeduser. mainform mdi container formborderstyle set on fixed single login child of mainform formborderstyle set on none loggeduser child of mainform formborderstyle set on none when application runned login form created in mainform. mainform never closed since container. but when move login form loggeduser form , vice-versa created formborderstyle = fixed single (normal windows window) , after 0.5~second changed none. editing didn...

ember.js - querying for records syntax, returns AdapterPopulatedRecordArray which I have no idea how to use -

i'm using querying records functionality guides here: http://emberjs.com/guides/models/finding-records/ my route looks this: app.catchallroute = ember.route.extend({ model: function(params) { var _self = this; return _self.store.find('article', { urlsegment: params.url }); } }); unlike times when i'm not passing object 2nd param find, end adapterpopulatedrecordarray have no idea data template. have solution this?

php - How can I pass the message content of postfix to the filter? -

i have been following postfix documentation , this guide. on this manual pipe, there appears no parameter entire message can directed argument filter. how can message passed filter without being saved in file on hard disk? when specify pipe filter in master.cf entire email (headers, from, to, body etc) sent filter/script. the guide showed sets postfix flag of f . change x means external script dictates final delivery , once it's delivered script set email delivered , not store anywhere else.

java - Android: Shared preferences not working -

i have following sharedpreferences set following: public class mainactivity extends activity implements onclicklistener { button openedlockers, closedlockers, checkout, admin; sharedpreferences.editor editor = getpreferences(mode_private).edit(); i have sharedpreferences else: private void runonce() { // todo auto-generated method stub sharedpreferences settings = getsharedpreferences("prefs_name", 0); mboolean = settings.getboolean("first_run", false); if (!mboolean) { // thing first time settings = getsharedpreferences("prefs_name", 0); sharedpreferences.editor editor = settings.edit(); editor.putboolean("first_run", true); editor.commit(); prepopulate(); } else { // other time app loads } } then call it: public boolean onoptionsitemselected(menuitem item) { // todo auto-genera...

doctrine2 - Doctrine 2 - Removing object from database, but keeping the entity data -

is there way remove record database, keep data in entity object? need able reinsert detached entities later. should work directly on unitofwork? thank you. i'm not sure of asking, looks basic behavior of doctrine $student = new student(); $student->setname("john doe"); $this->em->persist($student); $this->em->flush(); $this->printentity($student); $this->em->remove($student); $this->em->flush(); $this->printentity($student); this print out : student - id : "1", name : "john doe" student - id : "", name : "john doe" row deleted database entity still populated others data.

haskell - Where is the official source code of System.IO? -

where official source of system.io ? i looked here not there. when clicking on source says not here. confused because other links on this page seem work. edit: i found this: instance monad io {-# inline return #-} {-# inline (>>) #-} {-# inline (>>=) #-} m >> k = m >>= \ _ -> k return = returnio (>>=) = bindio fail s = failio s bindio :: io -> (a -> io b) -> io b bindio (io m) k = io $ \ s -> case m s of (# new_s, #) -> unio (k a) new_s here . if want know interface system.io supposed expose, check haskell report. believe nomative specification. if want internal implementation... well, it's hard-wired compiler. you'd have read through ghc source code. edit: io special. io magical. looking @ source won't tell interesting. bunch of code manipulates compiler's internal, low-level representation of how i/o works. whatever you're seeking unde...

javascript - Why Does The Browser Hang When Updating The Progress Bar? -

problem: have code runs , needs periodically update progress bar. seems work fine until part of code update occurs inside loop. after hangup, progress bar update whatever supposed after loop. instance in code: <!doctype html> <html> <head> <title>test</title> <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script> <script> $(document).ready(function(){ $('#button1').click(function(){ $("#progressbar").val(0); //reset 0 for(var = 0; < 100000; i++){ $("#progressbar").val(i/1000); //if(i === 50000){ // alert("half way there"); //} } }); }); </script> </head> <body> <button id="button1">simulate progress</button> <progress id="progressbar" value="0" max="100"></progress> </body...

python - Pandas converting String object to lower case and checking for string -

i have below code import pandas pd private = pd.read_excel("file.xlsx","pri") public = pd.read_excel("file.xlsx","pub") private["ish"] = private.holidayname.str.lower().contains("holiday|recess") public["ish"] = public.holidayname.str.lower().contains("holiday|recess") i following error: attributeerror: 'series' object has no attribute 'contains' is there anyway convert 'holidayname' column lower case , check regular expression ("holiday|recess") using .contains in 1 step? any appreciated private["ish"] = private.holidayname.str.contains("(?i)holiday|recess") the (?i) in regex pattern tells re module ignore case. the reason why getting error because series object not have contains method; instead series.str attribute has contains method. avoid error with: private["ish"] = private.holidayname.str.lower().str....

picturebox - Collision detection between PictureBoxes in C# -

i've 2 pictureboxes on form, 1 moving one, directions controlled keys, , other stable one, how possible detect collision between them.....here i've tried; failed..... using system; using system.collections.generic; using system.componentmodel; using system.data; using system.drawing; using system.linq; using system.text; using system.windows.forms; namespace windowsformsapplication1 { public partial class form1 : form { private enum disha { up, down, left, right }; private disha ekdisha = disha.down; public form1() { initializecomponent(); } private void form1_keydown(object sender, keyeventargs e) { if (e.keycode == keys.up) { ekdisha = disha.up; } else if (e.keycode == keys.down) { ekdisha = disha.down; } else if (e.keycode == keys.left) { ekdisha =...

How to add an existing project to a current solution programmatically in visual studio 2010 using c# -

how add existing project current solution programmatically in visual studio 2010 using c# . new c# . please suggest way this. edit : assignment automation. here solution you can use _solution.addfromtemplate method acieve this. according msdn - this method copies existing project file, , items or subdirectories contains, specified location , adds solution. here reference links- _solution.addfromtemplate method programmatically add existing project current solution

javascript - How to replace html href link with button -

i have html page has javascript in (see below). within html page there html code line calls javascript function. works should , looks : <a href="#" id="hour">hour</a> this code line calls last part of below javascript. i wish replace code line button. how can ? thank ps javascript use dygraph , did not write it. know little javascript. i'm looking replace above single line of html button same job or produce button through other minimalistic change. $(document).ready(function () { var r = [ ]; var base_time = date.parse("2014/03/05"); var num = 24 * 0.25 * 365; (var = 0; < num; i++) { r.push([ new date(base_time + * 3600 * 1000), + 50 * (i % 60), // line * (num - i) * 4.0 / num // parabola ]); } var orig_range = [ r[0][0].valueof(), r[r.length - 1][0].valueof() ]; // new code inserted - starts var one_mon...

python - py.test Tracebacks: Highlight my code, fold frames of framework -

tracebacks of tests long since use pytest. pytests includes surrounding code lines , lot of other information. i see information if traceback line (frame) code. don't want see it, if library or framework. i not find way filter or fold frames. any hints? i'm afraid not possible , enhancement request: https://bitbucket.org/hpk42/pytest/issue/283/traceback-filtering-hook the control have moment --tb=short etc.

angularjs - Confused about ui-router nesting -

i'm trying find way 1 of views have multiple states. let's have template: <body> <div ui-view="overlay"> <div ui-view="content"> </body> ...and these routes: $stateprovider .state('base', { url: '', abstract: true, views: { 'overlay': { templateurl: '/src/overlay.html' } } }) .state('base.page1', { url: '/page1/', views: { 'content@': { templateurl: '/src/page1.html' } } }) .state('base.page2', { url: '/page2/', views: { 'content@': { templateurl: '/src/page2.html', } } }); this allows me show "overlay" view on page1 , page2. the "overlay" view needs able change state without affecting else on page. can set "overlay" parent state , add children it, can't figure out way activate ...

powershell - Piping Read-Host does not wait for input -

i'm new powershell , want make tests. example command wait user input: powershell -command "read-host test" but if i'm piping "read-host test" powershell not waited input. here how looks in shell: ps f:\> powershell -command "read-host test" test: input input ps f:\> "read-host test" | powershell -command - test: ps f:\> does know why there difference on both commands? try this powershell -command "cat test.txt" | powershell -noexit -command - executes specified commands (and parameters) though typed @ windows powershell command prompt, , exits, unless noexit specified. value of command can "-", string. or script block.

c++ - Aborted: core dumped -

i have structure given below: struct reply_t { reply_t (unsigned int _xid){ xid = _xid; cb_present = false; buf = null; sz = 0; } unsigned int xid; bool cb_present; // whether reply buffer valid char *buf; // reply buffer int sz; // size of reply buffer }; i have std::map given below: std::map<unsigned int, std::list<reply_t> > reply_window_; now here problematic part: std::map<unsigned int, std::list<reply_t> > :: iterator rep_window; std::list<reply_t> rep_list; std::list<reply_t> :: iterator rep_it; rep_window = reply_window_.find(clt_nonce); if(rep_window!=reply_window_.end()){ for(rep_it=rep_window->second.begin(); \\ rep_it!=rep_window->second.end();rep_it++){ if((*rep_it).xid<=xid_rep){ (*rep_it).cb_present = false; free(...

java - Exceptions with okHttp and SPDY -

i have android application using okhttp communication server. detailed error handling on client side, reported bugsense, , i've gotten few confusing ioexceptions hoping explained me. exceptions are: 1. stream reset: cancel 2. connect failed: enetunreach (network unreachable) 3. stream reset: refused_stream 4. hostname 'myversion-dot-myapplication.appspot.com' not verified i don't recall seeing first 3 before migrating okhttp, specificlly spdy pieces. last 1 issue have struggled on app engine (ssl provided appengine seems throw error.) i checking connectivity before initiating transfer, happens when connectivity dropped while transferring? there else cause this? thanks! evan stream reset: cancel : spdy stream reset either local client or remote peer. example, server may cancel connection because has crashed or restarting. connect failed: enetunreach : spdy server isn't reachable. perhaps has disappeared since did connectivity check. stream r...

hyperlink - Magento adding new customer account navigation link -

i have issue adding new customer account navigation link password.phtml on customer account dashboard. @ post here bit confuse new in magento. below set of code. created /customer/account/password.phtml my module don_configs.xml <config> <modules> <don_configs> <active>true</active> <codepool>local</codepool> <version>0.1.0</version> </don_configs> </modules> </config> added local.xml <customer_account translate="label"> <reference name="left"> <block type="customer/account_navigation" name="customer_account_navigation" before="-" template="customer/account/navigation.phtml"> <action method="addlink" translate="label" module="customer"> <name>password</name> <path>customer/password/</path> ...

spring - Form is not getting submit after clicking on button -

please check below code: updated web.xml is: <display-name>spring mvc form handling</display-name> <servlet> <servlet-name>spring</servlet-name> <servlet-class> org.springframework.web.servlet.dispatcherservlet </servlet-class> <load-on-startup>1</load-on-startup> </servlet> <servlet-mapping> <servlet-name>spring</servlet-name> <url-pattern>*.do</url-pattern> </servlet-mapping> <servlet-mapping> <servlet-name>spring</servlet-name> <url-pattern>/</url-pattern> </servlet-mapping> <welcome-file-list> <welcome-file>index.jsp</welcome-file> </welcome-file-list> </web-app> thats why ui messed up. link: http://postimg.org/image/cf80ko6in/ , spring-servlet.xml is: <context:component-scan base-package="com.hrportal.controller" /...

To find duplicate entry in c++ using 2D Vector (std::vector) -

i wrote program find duplicate entry in table. beginner in c++ , hence don't know how program working efficient. there other idea write program? here have 3 tables (2d vector), 1) arecord_arr 2) maintable , 3) idxtable . idxtable use identify keys check duplicate entry. arecord_arr table add in maintable . if exist in maintable , show error "duplicate entry". check program, , give suggestions. typedef vector<string> rec_t; typedef vector<rec_t> tab_t; typedef vector<int> cn_t; int main() { tab_t arecord_arr= { {"a","apple","fruit"}, {"b","banana","fruit"} }; tab_t maintable = { {"o","orange","fruit"}, {"p","pineapple","fruit"}, {"b","banana","fruit"}, {"m","melon"...

security - Authorize attribute between requests -

this page describes how can use [authorize] attribute restrict access controllers , actions authenticated or authorized users. the authentication done setting thread.currentprincipal , allows access restricted controllers/actions provided user in required roles. when following method, thread.currentprincipal need set each request (e.g. in message handler), or web api have way of maintaining principal between requests? (as far know, web api stateless , there no session, i'm checking.) furthermore, if current principal not maintained between sessions, advantage [authorize] attribute provide on writing own custom access control scheme? you correct thread.currentprincipal needs set each request in message handler since server stateless. some benefits of authorize attribute allows add authorization on specific methods or entire controller you specify multiple authorization attributes on single action you can use [allowanonymousattribute] disable authoriza...

AngularJS - jQuery UI datepicker with alternative input not firing ng-model -

i'm using jquery ui datepicker, alternative input. so, when selecting date calendar, inputs value set jquery. the value being updated in input, ng-model not updating. <input type="text" name="date" ng-model="user.date" /> try .trigger('input'); ngmodel listens input event, make work have fire event . $('input[name="date"]').trigger('input');

c++ - Is QueryPerformanceFrequency accurate when using HPET? -

i'm playing around queryperformancefrequency . used return 3.6 mhz , not enough trying do. i've enabled hpet using command bcdedit /set useplatformclock true . returns 14.3 mhz . it's great it's more precise... excepted it's not. realized did not granularity expected. if try poll queryperformancecounter until ticks, smallest increment can 11 , means 1.27mhz . if try count number of different values can queryperformancecounter in 1 second, 1.26mhz . so wondering there way use 14.3 mhz full extent ? i'm using windows 7, 64 bit system, visual studio 2008. using hpet hardware source queryperformancecounter (qpc) known assosiated large overheads. qpc expensive call when configured hpet. it provides 14.3 mhz suggests high accuracy found, can't called fast enough resolve frequency. therefore microsoft has turned cpus time stamp counter (tsc) source qpc whenever hardware capable doing so. tsc queries have lower overhead. associated f...

Compilation GDB give error -

related problem 16611678 need new version of gdb in centos 6.5 64. try compile gdb (7.7, 7.6.2 , 7.5), without success, error related get_tty_state() in ser-unix.c : ser-unix.c:118:1: error: conflicting types ‘get_tty_state’ my gcc version 4.8.2 before function declaration there preprocessor directives defining hardwire_ttystate if have_termios defined , think problem come here (if needed can post piece of code), have_termios undefined. any appreciated! nathanaël

c - Deletion of a node in linked list passed to function by reference -

i want delete node in linked list doesn't work expected. i'm not sure how free deleted node @ points. here's source: typedef struct node { struct node *next; //there more values here take 1 simplicity int value; } node; void removenode(node **nh, node **n, node **np){ node *current = (*n); node *nodehead = (*nh); node *nodeprev = (*np); if(nodehead == current){ puts("head element detected"); if(current->next == null){ free(current); current = null; nodehead = null; } else{ current = current->next; } } else { if (current->next == null){ nodeprev->next = null; free(current); current = nodeprev; } else{ current = current->next; } } } void validatenodes(node **newnodes, node **mainnodes){ node *newhead = (*newnodes); node *newtmp = newhead; node *n...

wifi - Android Achartengine: Barchart dealing with big number of series -

i'm trying bar chart , of wifi channels , received signal strength. can create mannualy 2,3..series bat in reality have 25 bar display.so have different colors ,well how can set randomly colors bars.i know how manualy ,but can't 25 bars ,and specielly 25 number changing (25 represents access points detected ) code 2 series : public class truitonachartengineactivity extends actionbaractivity { private static int series_nr ; //the number of columns display, arraylist<scanresult> classobject = new arraylist<scanresult>(); int [ ] [ ] center_frequency_2 = { { 1,2,3,4,5,6,7,8,9,10,11,12,13,14 }, { 2412, 2417, 2422, 2427, 2432,2437,2442,2447,2452 ,2457,2462,2467,2472,2484}, }; @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_truiton_achart_engine); xymultipleseriesrenderer renderer = gettruitonbarrenderer(); mychartsettings(renderer); bundle v = get...

apache - .htaccess rewrite php to php file -

i trying write rewrite rule. want simplify entered url use index. input url www.example.com/home.php , rewritten www.example.com/index.php?r=page/home . i wrote .htaccess file: rewriteengine on rewriterule ^([^/]*)\.php$ /index.php?r=page/$1 [l] this configuration unfortunately gives me error 500. can understand caused fact if enter index.php instance, apache not know if must use index.php file or use rewritten url index.php?r=page/index . is possible accomplish kind of rewriting rule apache? if so, how can fix error 500? edit: please note rewriterule works fine if change extension .php else such .html , so: rewriterule ^([^/]*)\.html$ /index.php?r=page/$1 [l] you have 2 possibilities. first one rewriteengine on rewriterule ^index\.php$ - [l] rewriterule ^([^/]+)\.php$ /index.php?r=page/$1 [l] second one rewriteengine on rewritecond %{the_request} \ /([^/]+)\.php rewriterule ^.*$ /index.php?r=page/$1 [l]

c - making a word search puzzle? -

i've made program allows choose size of grid , allows enter 20 words. have insert entered words horizontally original array using function. function must return value success , value failure enter word puzzle board. need getting started actual function should along function prototype. pseudocode helpful. i'm new programmer great. thank you #include<stdio.h> #include<string.h> void printmatrix(char matrix[][20],int); void inserthor(char matrix[][20],int); int main(void) { //declare variables char matrix[20][20]; char words[20][100]; int x; int a,b; int i=0; int n=0; (a=0;a<20;a++) { (b=0;b<20;b++) { matrix[a][b] = '+'; } } while (x<10 || x>20) { printf("how large puzzle (between 10 , 20):\n"); scanf("%d",&x); } printmatrix(matrix,x); //part 3 printf("enter 20 words hide in puzzle.\n...

c# - ChangeCollection type into Appointment type EWS -

i doing syncing using exchange server web services(ews). sync need identify change items in calendar after last sync. this link lot. while using need take appointment start,end etc... changecollection<itemchange> allexchevents = service.syncfolderitems(new folderid(wellknownfoldername.calendar), propertyset.firstclassproperties, null, 512, syncfolderitemsscope.normalitems, ssyncstate); how convert change events appointment type ? after looking @ msdn document , blogs found answer. changecollection<itemchange> icc = service.syncfolderitems(new folderid(wellknownfoldername.calendar), propertyset.firstclassproperties, null, 512, syncfolderitemsscope.normalitems, ssyncstate); ssyncstate = icc.syncstate; if (icc.count == 0) { console.writeline("there no item changes synchronize."); } else { foreach (itemchange ic in icc) { **appointment ap = (appointment)ic.item;** } } use "ap" object retrieve appo...

Cannot map an error code returned from unixodbc using PostgreSQL database -

i using postgresql using unixodbc driver, , while trying connection, error. printing value of pfnativeerror of sqlerror, , value of '26'. i have gone through error codes returned postgresql, listed here: http://www.postgresql.org/docs/8.1/static/errcodes-appendix.html#errcodes-table i wanted know if unixodbc returns in pfnativeerror last 3 characters of error codes mentioned in link above? if true, assume possibility following error code: 22026 string data length mismatch string_data_length_mismatch do let me know if thinking in right direction. also, issue i've noticed when postgresql has millions of rows, , query results in connection failure trying fetch lot of data (10ks). can give idea why problem might happening? edit 1: if of help, i'm getting following values szerrormsg: error while executing query could not send query(connection dead) edit 2: '26' returned in integer, , codes mentioned in link above in hex. 26 in decimal corre...

regex - Regular Expression: search multiple string with linefeed delimited by ";" -

i have string such described structured data source: header whocares; sampletestplan 2 b c d; test abc; sampletestplan 3 e f g h l; wafer 01; endoffile; every field... ... starting "fieldname" ... ending ";" ... may contain linefeed my need find regular expression values of sampletestplan that's repeated twice. so... 1st value is: 2 b c d 2nd value is 3 e f g h l i've performed several attempts such search string: /sampletestplan(. \s) /gm /sampletestplan(. \s) ;/gm /sampletestplan(.*);/gm but need understand better how regular expression work i'm definitively newbie on them , need learn lot. thanks in advance may me! stefano, milan, italy you use following regex: (?<=\w\b)[^;]+(?=;) see working live here on regex101 ! how works: matches is: preceded sequence of characters: \w+ followed ; contains (at least 1 character) except ; (including newline s)....

c# - Tow to add a new worksheet to Excel with interop -

i can create excel 2 worksheets, , can write datatable's data sheet 1 , want write same data sheet 2 sheet 2 seems blank. why "sheet 2" blank? here code: microsoft.office.interop.excel.application xlapp = new microsoft.office.interop.excel.application(); if (xlapp == null) { console.writeline("excel not started. check office installation , project references correct."); return; } xlapp.visible = true; microsoft.office.interop.excel.workbook wb = xlapp.workbooks.add(microsoft.office.interop.excel.xlwbatemplate.xlwbatworksheet); microsoft.office.interop.excel.worksheet ws = (microsoft.office.interop.excel.worksheet)wb.worksheets[1]; { if (ws == null) { console.writeline("worksheet not created. check office installation , project references correct."); } microsoft.office.interop.excel.range arange = ws2.get_range("c1", "c7"); (int = 0; < main_dt.columns.count; i++) { w...