Posts

Showing posts from May, 2015

c# - How to construct Actionlinks -

i have following page structure in asp.net mvc 4. department full time employees part time employees ----------- --------------------------------------------- department 1 |1. employee 1 department 2 |2. employee 2 | where department 1, department 2, full time employees , part time employees links. clicking on link results in displaying employees. here possible options when user browse page first time, full time employees in first department (department 1) displayed. when user clicks department 2, full time employees department 2 displayed (since full time link selected default) when user clicks part time, part time employees displayed selected department. i don't know how construct action links these different links. target result aiming @ like www.example.com/department1/fulltime www.example.com/department1/parttime www.example.com/department2/fulltime www.example.com/depar

php - JW Player not working in Chrome -

iam using jw player in website play youtube videos. have used embed code that. working in browsers when executing file local diretory. not working in google chrome when executing file server. below code. <embed id="ply" height="384" width="430" flashvars="autostart=true&repeat=always&file=http:/www.youtube.com/watch?v=cnbfihpwthm&screencolor=000000&backcolor=000000&frontcolor=ffffff&skin=http://www.creatingafamily.org/modules/mod_jwmedia/skins/snel.swf" wmode="transparent" allowscriptaccess="always" allowfullscreen="true" quality="high" bgcolor="#000000" name="ply" style="" src="http://www.creatingafamily.org/modules/mod_jwmedia/player.swf" type="application/x-shockwave-flash"/> please achieve this. in advance. first of , should let jwplayer's javascript build html code. initilaize jwplayer js, , use html5

excel vba - VBA Outlook AppointmentItem calendar folder -

can tell me correct property use in appointmentitem (meetingstatus = olmeeting), change calendar or email i'm using schedule meeting? because it's still using default account no matter what. need alternate between accounts configured in outlook. i tested these properties: .sendusingaccount .organizer the organizer property of appointmentitem class read-only. so, possible way re-create appointment in appropriate calendar/folder. see how to: create new outlook appointment item possible ways.

gwt - Grails + SmartGWT -

trying make grails + smartgwt work together. setup: grails 2.2.1 (installed both, gwt + smartgwt plugin) smartgwt 3.1 gwt 2.5 after couple of hours playing around it, tomcat started. (created application , compiled modules) project resides under: zuhause:8080/gwt3/ default module foo.bar default index.gsp looks ok <script> var isomorphicdir = "${createlinkto(dir: 'gwt/foo.bar.foobar/sc/')}"; </script> <!-- --> <!-- script loads compiled module. --> <!-- if add gwt meta tags, must --> <!-- added before line. --> <!-- --> <script type="text/javascript" src="${createlinkto(dir: 'gwt/foo.bar.foobar', file: 'foo.bar.foobar.nocache.js')}"></script> the nocache.js found inside compiled "nocache.js" there reference zuhause:8080/gwt3/static/gwt/foo.bar.foo

ios - How to stop streaming mp3 file in UIWebview -

i want stop streaming mp3 file in uiwebview without reload page. so don't want reload page stop. it's not best way. suggest idea me ? thanks in advance ! you load blank page stop streaming mp3 file. like : [self.yrwebcontent loadrequest:nsurlrequestfromstring(@"about:blank")]; update: solution, play sound using avaudioplayer instead nsurl *url = [nsurl fileurlwithpath:self.sfilepath]; nsdata *yrsound = [nsdata datawithcontentsofurl:url]; avaudioplayer *soundplayer = [[avaudioplayer alloc] initwithdata:yrsound error:null]; soundplayer.numberofloops = 0; [soundplayer play]; then, stop using : [soundplayer stop];

Rails 4 Params not passed to the controller from the form -

i using form "get" method. created text field (in testing.html.erb) user enter name. want name passed controller , based on name, want retrieve data database through query. problem here not getting instance variable in controller action (nothing printed on screen when display @testing in "testing.html.erb"). below routes.rb file. rails.application.routes.draw resources :users # priority based upon order of creation: first created -> highest priority. # see how routes lay out "rake routes". # can have root of site routed "root" # root 'welcome#index' # example of regular route: 'index' => 'users#index' 'testing' => 'users#testing' # example of named route can invoked purchase_url(id: product.id) # 'products/:id/purchase' => 'catalog#purchase', as: :purchase ..... this testing.html.erb file <h1> testing page </h1> <%= form_for

razor - Assembly error while using Model in MVC4 view -

@using system.data.entity; @model surveybuilderviewmodel.surveyviewmodel @{ viewbag.title = "addquestions"; layout = "~/views/shared/_layout.cshtml"; } @html.textboxfor(m => model.questionmodel.questionstatement); it gives me error type 'system.data.objects.dataclasses.entityobject' defined in assembly not referenced. must add reference assembly 'system.data.entity, version=4.0.0.0, culture=neutral, publickeytoken=b77a5c561934e089' how can fix , doing wrong..???? i think problem pretty clear you must add reference assembly 'system.data.entity, version=4.0.0.0, culture=neutral, publickeytoken=b77a5c561934e089' reference dll in project.

pug - Changing a variable inside a if - jade/pugjs -

i'm trying make div have location inside of based on state of 2 variables, example if $city = 'new york' , $state = 'ny' div display new york, ny . however, it's not working , think has scoping. here's jade: $city = data.city $state = data.state $locstring = "" if $city != "" $locstring = $locstring + $city if $city != "" && $state != "" $locstring = $locstring + ", " if $state != "" $locstring = $locstring + $state .location #{$locstring} this ending $locstring being empty, if print off $locstring inside if statements has added value, suggesting redeclaring local copy of variable inside of each if statement. can't find in reference http://jade-lang.com/reference/ i woud suggest this: - var city = data.city - var state = data.state - var locstring = "" if city != "" - locstring = locstring + city if city != "" &&am

android - Add items to a Set<String> in proper order Java -

i creating song playback app. have set keep in sharedpreferences. want add , remove file names it, , keep them in same order added them in example: recentsp = getsharedpreferences("recentkey", context.mode_private); recent = recentsp.getstringset("recent", recent); recentedited = recent; if (recentedited.contains(string) { recentedited.remove(string); log.i(tag, "recent exists, removing song"); sharedpreferences.editor editor = recentsp.edit(); editor.clear(); editor.putstringset("recent", recentedited); editor.commit(); } recentedited.add(string); log.i(tag, "adding song recent"); sharedpreferences.editor editor = recentsp.edit(); editor.clear(); editor.putstringset("recent", recentedited); editor.commit(); but problem arises when view these in listview. want them in order add them can have played section, do

javascript - java script i want to add two variables x=y -

what meaning of following syntax var demop=document.getelementbyid("demo"); demop.innerhtml="x=" + x; and "x=" + x; getelementbyid() method accesses first element specified id. thus , document.getelementbyid("demo") access element id demo . the innerhtml sets inner html of element.it used modify document's html on fly. for example: <head> <script type="text/javascript"> function myfunction() { var x = 100; var demop = document.getelementbyid("demo") demop.innerhtml = "x=" + x; } </script> </head> <body> <div id="demo"/> <p> <a href="#" onclick="myfunction()"> click call function</a> </p> </body> </html> in above code, when event fired clicking link,js method myfunction() called.in method,demop contains element id demo .

Nagios - Notifications - Not sending -

please me nagios , notifications. in service configuration specify "contacts" . contact have specified in contacts.cfg and there problem, notifications wont come. please me, why notification not come dominik , dominik1 ? thank you there host.cfg define service { use generic-service host_name myserver service_description ping check_command check_ping!100.0,20%!500.0,60% contacts dominik, dominik2 notification_interval 1 } there contacts.cfg define contact{ contact_name dominik use generic-contact alias dominik email dominik@dominik.com } define contact{ contact_name dominik1

php linkedin api not working -

i found repo: https://github.com/mahmudahsan/linkedin---simple-integration-for-your-website in copied oauth.php , linkedin.php files , put api key , secret , here i'm getting: my profile info 404 1454454187300 n0jyr99yqa 0 not find person based on: ~ performing search for: ?company-name=facebook&count=10 search url: http://api.linkedin.com/v1/people-search:(people:(id,first-name,last-name,picture-url,site-standard-profile-request,headline),num-results)?company-name=facebook&count=10 people worked in facebooksimplexmlelement object ( [status] => 403 [timestamp] => 1454454187323 [request-id] => dth9gfly2t [error-code] => 0 [message] => people search must done on behalf of member. ) any idea doing wrong?

ruby on rails - rake db:create - Mysql2::Error: Unknown database -

i trying create database using rake db:create task. when running command bundle exec rake db:create create database , load schema, following error: rake aborted! mysql2::error: unknown database 'xxx_development' my database.yml : development: adapter: mysql2 host: localhost reconnect: true username: user password: password pool: 50 database: xxx_development i checked mysql server running , able connect using password/username have in database.yml i understand can go ahead , create database in mysql , run bundle exec rake db:create isn't rake task db:create creates database in case doesn't exists? the rails version 3.2.22 . , mysql2 version 2.9.13 . any pointers highly appreciated. if using ohmyzsh bundler plugin makes rake run default bundle exec , can use unbundled_rake db:create

Delphi: TRichEdit Text in non-default non-Unicode system language as String (ANSI) -

so here's setup: make new delphi 7 application trichedit control on it. talking non-unicode applications here. install new input language in windows' regional , language options, that has different encoding encoding of default language non-unicode programs - example greek. add button in application, , in onclick handler add button1.caption := richedit1.text; , , set font.charset charset of input language installed ( greek_charset if stick example). run application, switch new (greek) input language, type few letters in richedit , press button - button's caption has ???? symbols instead of greek characters. now, if set default language non-unicode programs greek (windows restart required), problem disappear - greek characters appear properly. set default language non-unicode programs before , problem there again. so guess trichedit works unicode internally, changing font.charset value never changes - richedit accepts installed input language properly, ,

How to save namespaces of XML in dictoinary in Python and Lxml -

i have xml file many namespaces: <root xmlns:ser="https://some_address" xmlns:mirror="https://some_mirror_address"> <ser:use server="some_server_address"/> <mirror:use default="some_mirror_address"/> </root> i using lxml , python parse type of file. now, requirement is, when parse xml file need store namespaces in dictionary like: nsd = {'ser' : 'https://some_address', 'mirror' : 'https://some_mirror_address'} the intention of this, namespaces not predetermined. when parse xml need store namespaces in dictionary , proceed further activities. is possible achieve in lxml? assuming you're using etree api, given element, can access nsmap property. holds dictionary you're looking for.

r - Returning anonymous functions from lapply - what is going wrong? -

when trying create list of similar functions using lapply , find functions in list identical , equal final element should be. consider following: pow <- function(x,y) x^y pl <- lapply(1:3,function(y) function(x) pow(x,y)) pl [[1]] function (x) pow(x, y) <environment: 0x09ccd5f8> [[2]] function (x) pow(x, y) <environment: 0x09ccd6bc> [[3]] function (x) pow(x, y) <environment: 0x09ccd780> when try evaluate these functions identical results: pl[[1]](2) [1] 8 pl[[2]](2) [1] 8 pl[[3]](2) [1] 8 what going on here, , how can result desire (the correct functions in list)? r passes promises , not values themselves. promise forced when first evaluated, not when passed, , time index has changed if 1 uses code in question. code can written follows force promise @ time outer anonymous function called , make clear reader: pl <- lapply(1:3, function(y) { force(y); function(x) pow(x,y) } )

version control - convert exsisting git repository to git-lfs -

i acctualy trying convert git repository git-lfs. downloaded bitbucket test server, created repository , enabled lfs in options of repo , server. if call git-lfs track "*.psd" files, works fine. if push .psd files stored in git lfs location.the problem is, if push exsisting repository(clientside) empty git-lfs repo, files not stored inside git-lfs storage. however, if push .psd file after that, works fine. do guys have idea how conver repo git-lfs ? have keep history etc. is. saw guides on that, nothing rly worked vor me. looking @ git-lfs-migrate , another script , other things. nothing of pushing tracked files lfs dir. directory thanks helping me out ! frossy the issue you're having when execute git lfs track *.psd , affects happens photoshop files subsequently use git add on - either modifications existing files or new files. has been committed remain as-is, embedded within git repo itself. it possible convert repository history , extract large

jquery - How to use the plugin aSimpleTour with the browser IE7? -

i use $.asimpletour(options); but not work, there message error page in ie7 well, plugin not have support ie7, maybe ie8 have. can post error sent ie7? thanks!

Bind datetime data to Listbox in window phone 7 -

i have listbox , want bind data it. have datetime field. have saved data in datetime field eg. 01/01/2013 12.00.00. when bind data listbox display saved want display 01/01/2013. xaml code: <grid x:name="contentpanel" > <listbox x:name="listexpense" selectionchanged="listexpense_selectionchanged"> <listbox.itemtemplate> <datatemplate > <!--<button x:name="btndetails" width="460" height="65" borderthickness="1" margin="0,-20,0,0" click="btndetails_click"> <button.content>--> <stackpanel orientation="vertical"> <stackpanel.background> <lineargradientbrush endpoint="0.5,1" startpoint="0.5,0">

lisp - As of 2016, is there a Scheme implementation which supports 100% of R7RS (small) with no deviations? -

i willing learn scheme. want stick r7rs since it's last standard. however, seems there lot of fragmentation on scheme current implementations, , of them staying @ r5rs or part of r6rs. the 1 have found supports part of r7rs kawa, runs on jvm, doesn't support tail call optimization, , strong point against implementation. is scheme world fragmented there not r7rs full implementation yet? asking, because if there not, catch up, planning on building one; but, if there exists one, better not reinvent wheel , contribute implementation. please, if have information, appreciate not answering names, proper further information (official website of implementation or extract mailing group useful reference). and way, not considering racket, it's not scheme anymore. the chairman of r7rs small language (" working group 1 ") committee, alex shinn, created chibi scheme standard evolved. believe compliant. bytecode compiler. larceny has (totally?) compliant

android - Rotate a layout like a PENDULUM -

can move inflated layout or dialog or(another way) etc pendulum. inflated layout contain image view , text view . possible through animation or not thanks in advance you can use rotateanimation , assign parent view. however, swing effect (like pendulum) need provide proper values pivot , degrees. <rotate xmlns:android="http://schemas.android.com/apk/res/android" android:pivotx="50%" android:pivoty="50%" android:fromdegrees="-135" android:todegrees="-45" android:drawable="@drawable/imagefile_to_rotate" android:repeatcount="infinite" /> in case need layer-list drawable combine image text. see this. http://developer.android.com/guide/topics/resources/drawable-resource.html#layerlist however, can use drawable , not view in layerlist. thing cannot use view have create custom drawable.

How to use "Restrict JWT Issuing option for Windows 8 apps" in Live Connect? -

based on descriptions on http://msdn.microsoft.com/en-us/library/live/hh826544.aspx#restrict_jwt , still don't know how use feature. understanding that: i need create 2 win8 apps. example, appa , appb configure them live service on configuring app. only specify 1 app redirection uri. example, specify "url://appa" redirection uri appa. make sure both 2 win8 apps' "restrict jwt issuing" option set "no" for appb, use redirection uri appa initialize liveauthclient object: var authclient = new liveauthclient("url://appa"); after that, authentication token appb live connect should able parsed appa's client secret. turned out authentication failed , no authentication token returned. can 1 point out whether understanding correct. in advance.

C# String Extension Overloading -

i want create extension class string overloads compareto method following: public static bool compareto(this string input, string comparevalue, bool ignorecase, bool removeextrawhitespaces) { if (removeextrawhitespaces) { input = input.removenullsandwhitespace(" ").trim(); comparevalue = comparevalue.removenullsandwhitespace(" ").trim(); } return (string.compare(input, comparevalue, ignorecase)==0); } however, when attempt use in normal class file such: currentauthor.firstname.compareto(previousauthor.firstname, true, true) i getting compile error stating there no overload method compareto takes 3 parameters. is idea possible? i know in normal classes can overload until son comes home. whether static or non-static class. is there exception extensions? have not worked them lot. i've confirmed setting dotnetfiddle, see here: https://dotnetfiddle.net/62hhq8 . you'r

css - d3.select.attr only working with some attributes when called from a hover action -

i'm trying action work when hover on table row. want table row turn gray, stroke of chart corresponds table row turn red width of 5, every other stroke turn gray. here snippet of code: var paths = d3.selectall("path"); var rows = tbody.selectall("tr") .data(data) .enter() .append("tr") .on("mouseover", function(d,i) { d3.select(this) .style("background-color","gray"); //this works d3.select(paths[0][i]).attr("stroke-width", 5); //this sets them gray d3.selectall("path").attr("stroke", "gray"); //this doesn't work??? d3.select(paths[0][i]).attr("stroke", "red"); }); my thought first turn them gray, turn individual 1 red. reason, changing stroke attribute on 1 of paths doesn't work, changing stroke attribute on paths works , changing stroke-width attribute o

django - i can't posting data from view to another view using reverse and HttpResponseRedirect? -

Image
i'm trying sending data submitted form view in app forms.py class filterform(forms.form): currency = forms.choicefield(choices=currency_choices) continent = forms.choicefield(choices=select_continent()) country = forms.choicefield(choices=select_country()) views.py view #1 def filtrer(request): if request.method == 'post': form = filterform(request.post) if form.is_valid(): currency = form.cleaned_data['currency'] continent = form.cleaned_data['continent'] country = form.cleaned_data['country'] url = reverse('affiche_filter', args=(), kwargs={'continent':continent,'country':country,'currency':currency}) return httpresponseredirect(url) else: form =filterform() return render_to_response('filter.html', {'form': form }, requestcontext(request)) view#2 def affiche_filter(request,c

javascript - Define is not a function using SystemJS -

Image
i'm using systemjs module system in angular 2. index.html file <html> <head> <base href="/"> <meta http-equiv="content-type" content="text/html; charset=utf-8"> <meta name="viewport" content="initial-scale=1, maximum-scale=1, user-scalable=no" /> <title>home</title> <link rel="stylesheet" href="//js.arcgis.com/3.15/esri/css/esri.css"> <!-- ie required polyfills, in exact order --> <script src="es6-shim/es6-shim.min.js"></script> <script src="systemjs/dist/system-polyfills.js"></script> <script src="angular2/bundles/angular2-polyfills.js"></script> <script src="systemjs/dist/system.src.js"></script> <script src="rxjs/bundles/rx.js"></script> <script src="angular2/bundles/angular2.dev.j

Spotify Apps API: Spotify crashes all the time -

i'm working on spotify app, spotify application keeps crashing on me. have been trying debug own javascript code, see goes wrong, seems bit random. happens when app loses focus (i.e. switch app). there compatibility issue jquery perhaps? unfortunately can't find crash-logs or anything, spotify. there any? i hope can me along here, because problem makes developing cool spotify apps impossible. edit: clarify, i'm using spotify 0.8.8.450.gd9413514, on windows 8 64-bit, i've experienced same on windows 7 , mac os x 10.6. using windows 7, can create crash log accessing task manager, right clicking spotify process , selecting "create dump file". if you're on mac os x, can crash dump opening activity monitor, selecting spotify process , clicking 'sample process'.

c# - Get location from bing map on Tap event in mvvm -

i'm trying location, when tap on bing map control. know how it, want make in viewmodel. tap event use interactions. <map:map copyrightvisibility="collapsed" logovisibility="collapsed"> <map:maptilelayer> <map:maptilelayer.tilesources> <custommap:openstreettile /> </map:maptilelayer.tilesources> </map:maptilelayer> <map:maplayer> <map:pushpin location="{binding location}" /> </map:maplayer> <i:interaction.triggers> <i:eventtrigger eventname="tap"> <cmd:eventtocommand command="{binding addpushpincommand}" passeventargstocommand="true" /> </i:eventtrigger> </i:interaction.triggers> </map:map> i can position eventarguments getposition

c++ - Finding Values index position in vector -

i looking find index of searched value in array code. getting error,which has constant vector, not sure how fix it. int linearfind( const vector<int>& vec, int y){ vector<int>::iterator t=find(vec.begin(), vec.end(), y); if (t != vec.end()) return (t-vec.begin()); else return -1; } the problem that, vec passed const& , iterators returned begin , end std::vector<int>::const_iterator s, not std::vector<int>::iterator s. thus, find return std::vector<int>::const_iterator cannot converted std::vector<int>iterator drop const . so solve this, either use std::vector<int>::const_iterator t = find(vec.begin(), vec.end(), y); of, if use c++11 or later, easier auto t = find(vec.begin(), vec.end(), y);

structured programming - Are there any good published algorithms for restructuring procedural code? -

i've got ugly old program try organize/prettify. few thousand lines, few dozen labels , 100 goto's. goto's half forward , half backward. overlap every way, , there computed goto's , case statements spray goto's willy-nilly out of several of cases. bad things can program not branch thens, elses or cases. uses conditional branches backwards instead of loops, many of these within cases statements. i recall proved maybe 40 or 50 years ago goto's not needed if 1 has loops , if-then-else (not mention cases). question is: there manageable algorithms or sets of rules follow, hand or computer, proof proved possible, i.e. translate spaghetti reasonably readable code of goto's gone?

c++ - Meaning of Macro definition of the code below -

in header file code is: #define classtp(tnm, pnm) \ class tnm; \ typedef tpt<tnm> pnm; \ class tnm{ \ private: \ tcref cref; \ public: \ friend class tpt<tnm>; why there tnm{ there without } following form pair, legal? , have no idea what's meaning of piece os code. then in other files, macro definition used follows: classtp(tnotify, pnotify)//{ private: tnotify(const tnotify&); tnotify& operator=(const tnotify&); public: tnotify(){} virtual ~tnotify(){} virtual void onnotify(const tnotifytype& /*type*/, const tstr& /*msgstr*/){} virtual void onstatus(const tstr& /*msgstr*/){} virtual void onln(const tstr& /*msgstr*/){} virtual void ontxt(const tstr& /*msgstr*/){} // shortcuts easier formationg void onnotifyfmt(const tnotifytype& type, const char *fmtstr, ...); void onstatusfmt(const char *fmtstr, ...); void onlnfmt(const char *fmtstr, ...); void ontxtfmt(const char *fmtstr, .

php - Sphinx Search Result is not displaying value -

i have configured in sphinx , rotated indexes also. when search sphinx server(terminal command), displaying matches count below, have no idea on issue. [root@phpsalzer server]# sudo search -i gplay 'cut rope' sphinx 2.0.4-id64-release (r3135) copyright (c) 2001-2012, andrew aksyonoff copyright (c) 2008-2012, sphinx technologies inc (http://sphinxsearch.com) using config file '/etc/sphinx/sphinx.conf'... index 'gplay': query 'cut rope ': returned 2 matches of 2 total in 0.000 sec displaying matches: 1. document=6, weight=10515 2. document=3, weight=9482 words: 1. 'cut': 5 documents, 15 hits 2. 'the': 72 documents, 2162 hits 3. 'rope': 4 documents, 12 hits in above result, not displaying document values. please suggest me on issue. note: have running sphinx on centos lates version of sphinx like colin mentions, sphinx doesn't store raw text indexed - known fields. not stored can't returned. but if wan

What's the syntax for filtering out records with certain phrases in ElasticSearch -

the json looks this { "company": { "type": "sme", "name": "taylor corps" }, "contact": { "tel": "5334234234", "name": "jane doe" }, "affiliates": { "org": "taylor corps" } } image want filter out people has "taylor" in company.name or affiliates.org . i tried multi_field in bool filter doesn't seem working in filter. any advice? thank you! use following query: { "query": { "query_string": { "fields": [ "company.name" , "affiliates.org" ], "query": "taylor" } } }

windows 8 - I need to check whether user is authenticated or not by using linqtotwitter library in windows8 -

i need verify user authenticated or not his/her twitter account using linqtotwitter library.normally iam able login twitter account opening webview. not able find whether he/she authenticated. here code. var auth = new winrtauthorizer { credentials = new localdatacredentials { consumerkey = constants.twitter_consumerkey, consumersecret = constants.twitter_consumersecret }, usecompression = true, callback = new uri("http://linqtotwitter.codeplex.com/") }; if (auth == null || !auth.isauthorized) { await auth.authorizeasync(); } twitterctx = new twittercontext(auth); i able twitter context iam not able find whether login succeed or not. once user succeed need open popup. please me how can this. you can use account/verifycredentials, this: var accounts = acct in twitterctx.account

Proper JavaScript line breaking? -

is breaking long boolean expression this var x = === b && c === d && e === f; to more readable var x = === b && c === d && e === f; considered bad practice? long variable names former can become extremely long. you free put line breaks in expression this. not considered bad practice. in fact, it's practice keep code readable without lots of horizontal scrolling if line breaks required in order that, recommended. many corporate coding style guides specify max code line length easy reading , line breaks required in order follow types of guidelines. check out douglas crockford's javascript conventions or google's style guide select quote each: google javascript style guide when possible, function arguments should listed on same line. if doing exceed 80-column limit, arguments must line-wrapped in readable way. save space, may wrap close 80 possible, or pu

Integration Testing Entity Framework CRD operations -

i'm struggling integration tests when using entity framework. i seed database test data in test project, wondering how manange test create, update , delete operations. basicly have test data e.g. contains 5 customer entries... can write unit tests data based on these 5 entries. (e.g. return collection containing 5 items). but if have test deletes 1 customer, means getall test expect 5 customers, return 4 (if test executed after delete test) , fails. how work around issue? give order tests or reseed database before every test (but sounds bad?)... thanks ! an effective way use transaction scope . wraps sql calls , rolls changes if scope disposed without calling complete method. basic test this. public class transactionaltestsbase { private transactionscope _scope; [testinitialize] public void initialize() { _scope = new transactionscope(); } [testcleanup] public void testcleanup() { _scope.dispose(); }

Network usage of a process in linux -

i record total number of bytes transferred on network different versions of vnc. plan start vnc viewer, run script remotely performs actions , displays graphics , disconnects. how can record total network usage of 1 process in linux? don't want measure else happening on system. you run different versions of vnc viewers on different port numbers , record traffic ports tool such tcpdump. there may way of recording traffic per process doing port more obvious , simple crude example using perl add up/filter sudo tcpdump -li eth1 ' port 5900'|perl -ne 'print $c,"\n"; $c+=$1 if (/length (\d+)/);'

how to add elements to an array based on a condition in C#? -

i'm working on simple c# program adding elements array. allow user enter 5 numbers, , if user enters invalid valid have message that. issue whether users enters invalid number or not still want add 5 numbers array. code works, lets user enters 3 numbers , 2 words , end having 3 numbers, want 5 numbers no matter what. please me finding i'm doing wrong. thank in advance. here's code: int[] numbers = new int[5]; (int = 0; < 5; i++) { console.writeline("enter number: "); string c = console.readline(); int value; if (int.tryparse(c, out value)) { numbers[i] = value; } else { console.writeline("you did not enter number\n"); } } (int = 0; < numbers.length; i++ ) { console.write(numbers[i] + " "); } you can reduced incremen

r - Factor dropdown filter in DT::datatable in shiny dashboards not working -

Image
is me or bug if have factor column , add filter dt, dropdown cut-off in shiny dashboard. i using mtcars example , make cyl factor. (the numeric slider filter works fine, factor filter dont). here code , screen shot. ## app.r ## library(shinydashboard) library(dplyr) mtcars$cyl <- as.factor(mtcars$cyl) ui <- dashboardpage( dashboardheader(title = "simple dashboard"), ## sidebar content dashboardsidebar(sidebarmenu( menuitem( "dashboard", tabname = "dashboard", icon = icon("dashboard") ), menuitem("widgets", tabname = "widgets", icon = icon("th")) )), ## body content dashboardbody(tabitems( # first tab content tabitem(tabname = "dashboard", fluidrow( box(plotoutput("plot1", height = 250)), box( title = "controls", sliderinput("slider", "number of ob

ruby - Generating configuration hash with reduce in the Jekyll source code? -

i've been looking through jekyll source code, , stumbled upon method: # public: generate jekyll configuration hash merging default # options in _config.yml, , adding given options on top. # # override - hash of config directives override options in both # defaults , config file. see jekyll::defaults # list of option names , defaults. # # returns final configuration hash. def self.configuration(override) # convert symbol keys strings , remove old key/values override = override.reduce({}) { |hsh,(k,v)| hsh.merge(k.to_s => v) } # _config.yml may override default source location, until # then, need know _config.yml source = override['source'] || jekyll::defaults['source'] # configuration <source>/_config.yml or <source>/<config_file> config_file = override.delete('config') config_file = file.join(source, "_config.yml") if config_file.to_s.empty? be

xcode - How to change location of iPhone app icon? -

Image
okay, noob. must simple stuck here. i rigth-click , choose 'select file'. after choose file dialogue appears: i want keep icons not in root directory . can't figure out how this. tried different ways, create project scratch... please help. when bring image assets xcode in application bundle's root directory @ run time. it appears you've added file named "icon@2x.png" project @ 1 time already. go project's summary page in xcode click build phases , expand section titled copy bundle resources . there you'll find reference resources copied bundle @ run time. more on bundle structures here: https://developer.apple.com/library/mac/#documentation/corefoundation/conceptual/cfbundles/bundletypes/bundletypes.html anyway, way i've done in past to: remove existing image duplicate xcode , folder structure in finder. add new folder in finder call "/appicons" (or whatever). copy app icons folder in finder. dr

ubuntu - use SSH over Python -

how run ssh on python script? ssh gateway@192.168.0.189 'display=:0 notify-send "title" "description"' my python script ask raw_input() title , , 1 description . python run ssh inserting title , description typed user. import subprocess subprocess.check_call( '''ssh gateway@192.168.0.189 'display=:0 notify-send "{0}" "{1}"' '''.format(title, description), shell=true)

ini - Batch file for replacing text, or writing it if it's not there -

good morning, i'm having issue trying figure out how approach project i'm working on... basically what's happening i'm needing go text file, string of text, (i.e. columnseparator=y) , changing columnseparator=n. if "columnseparator=y/n" doesn't exist, need write ~4-5 lines of text add section of text file. appending fine. now, tricky part. file i'm editing, configuration file program used on ~850 machines, , every file little different, , depending on window xp vs windows 7, located in 2 different places. in windows 7 it's located in: c:\as400\s10138fd.ws in windows xp it's located in: c:\program files\ibm\client access\emulator\private\as400.ws any ideas?? thanks!! here *.ws file information need edit: [profile] id=ws description= version=9 [translation] ibmdefaultview=y defaultview= ibmdefaultdbcs=y defaultdbcs= [communication] autoconnect=y link=telnet5250 session=5250 forceconfigpanel=n [telnet5250] hostname=s10138fd se

javascript - i get error in jquery of piczoomer -

i error in line of pic zoomer js jquery.piczoomer.js picbdoffset = {x:$picbd.offset().left,y:$picbd.offset().top}; error : uncaught typeerror: cannot read property 'left' of undefined picbdoffset = {x:$picbd.offset()?$picbd.offset().left:0,y:$picbd.offset()?$picbd.offset().top:0};

html - string concatenation in css -

i want achieve following in css. how do in way works in ie8+ url('../img/icons/' + attr('type') + '_10.png') you can't dynamic string interpolation in way you're suggesting, if have limited number of possible values [type] attribute, create styles each one: .your .selector[type="foo"] { background-image: url('../img/icons/foo_10.png'); } .your .selector[type="bar"] { background-image: url('../img/icons/bar_10.png'); } .your .selector[type="baz"] { background-image: url('../img/icons/baz_10.png'); } if you've got unreasonable number of types, you'll need come better solution i've listed here.

jquery - Link Spacing Issue in CSS -

basically menu, on hover, separate image appear on both sides on link. got far can't seem rid of white spacing on link. there should no white space above link on hover. can't seem figure out i'm missing!? <li><a href="#" class="button">button 1</a></li> <li><a href="#" class="button">button 2</a></li> <li><a href="#" class="button">button 3</a></li> $(document).ready(function(){ $(".button").hover(function() { $(this).before('<div class="buttonimgleft"></div>'); $(this).after('<div class="buttonimgright"></div>'); }, function() { $(".buttonimgleft, .buttonimgright").remove(); }); }); body { margin: 0; } li { list-style: none; display: inline-block; margin-right: 15px; } .buttonimgright {

String getting split on '#' when passing to a RESTful Web Service in Java through GET method -

i having restful java web service accepts long string '#' in between. when trying send string method while calling, string getting split on '#' , can retrieve [0] value alone. before sending message intact, after using this.. req.open("get","https://localhost:8443/registername/resources/registername/"+"my#name", true); req.send(); is problem. these first few lines in web service... @get @path("/{message}") public string validatename(@pathparam("message") string message) throws exception{ system.out.println(message); ...} and, displays "my" alone. can please me on why happening? thanks! in urls, # sign indicates "named anchor," local javascript, , not sent remote server, when have url: https://localhost:8443/registername/resources/registername/my#name name isn't sent server. need use different split character. see what when link has pound "#" sign in

php - Stupid SQL error with no leads -

ok, can't figure out why doesn't work @ all. $get_data = mysql_query("select * chatbox order id message = 'bla'"); while($data = mysql_fetch_assoc($get_data)) { *blablabla code* } this not work. gives me "warning: mysql_fetch_assoc(): supplied argument not valid mysql result resource" error. (with line number ofcourse) when remove "where message = 'bla'" part, works fine. tryed , without ' things around bla , around messages. message field excist in db, entry bla. tryed id field in db, number 1, not work @ all. wrong simple line of code. tryed everywhere, can't figure out... you using where clause after order by, can not work you. modified query: select * chatbox message = 'bla' order id you need follow sequence when crease mysql select statement : select .. columns .. .. .. order select manual reference side note: please use mysqli_* or pdo instead of mysql_* because

multithreading - Running Python multi-threaded process & interrupt a child thread with a signal -

i trying write python multi-threaded script following 2 things in different threads: parent: start child thread, simple task, stop child thread child: long running task. below simple way it. , works me: from multiprocessing import process import time def child_func(): while not stop_thread: time.sleep(1) if __name__ == '__main__': child_thread = process(target=child_func) stop_thread = false child_thread.start() time.sleep(3) stop_thread = true child_thread.join() but complication arises because in actuality, instead of while-loop in child_func() , need run single long-running process doesn't stop unless killed ctrl-c. cannot periodically check value of stop_thread in there. how can tell child process end when want to? i believe answer has using signals. haven't seen example of how use them in exact situation. can please modifying code above use signals communicate between child , parent thread. , making child-thre

windows phone 7 - text width inApplicationBarIconButton -

i use next: <shell:applicationbariconbutton iconuri="icon.png" click="near_click" text="some_long_word" /> and text trimmed. how can fix it? you can't fix it. can't have long text size in applicationbariconbutton.

android - create new group and add the name and number as one contact to new group. on create button create new group -

public class group extends appcompatactivity { string name, number; context context = null; string result = null; private edittext ed_group_name, ed_name, ed_number; private button btn_view, btn_create,btn_add_contact, btn_new_group, btn_cancel; private listview lv_group; private linearlayout ll_action, ll_create_new_group, ll_show_list; arraylist<string> group_name = new arraylist<string>(); arraylist<string[]> list1 = new arraylist<string[]>(); @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_group); toolbar toolbar = (toolbar) findviewbyid(r.id.toolbar); setsupportactionbar(toolbar); floatingactionbutton fab = (floatingactionbutton) findviewbyid(r.id.fab); fab.setonclicklistener(new view.onclicklistener() { @override public void onclick(view view) { snackbar.make(view, "replace own action", snackbar.length

How to make Intellisense in Visual Studio 2012 not to substitute text right to the cursor? -

while programming realize need add before typed code. example type name of variable: input[0] and realize array of type string , need convert it. so, move beginning of word (with ctrl-left arrow) , start typing convert.to|input[0] with pipe used show position of cursor. suggestions intellisense, including toint32() method looking for. long confirm suggestion tab or space, following: convert.toint32(|)[0] so, text cursor position end of word substituted suggestion, , not want. this problem not specific vs 2012 , might due extensions have installed, attempt pursue origin did not yield anything. have following extensions installed: resharper, powercommands, productivity power tools. if entering unrelated expression before identifier, add space before start typing new expression. prevent completion replacing existing identifier. for example, if | marks caret, following scenario avoid problem facing. convert.to| input this code completion feature designed p

payment gateway - Get oAuth token for Dwolla's Reflector/test account (Dwolla API)? -

can oauth token dwolla's "reflector"/test account? it's not clear documentation. no -- reflector's account sole purpose reflect money sent it. giving out oauth token account compromise security of funds temporarily holds.

performance - Efficient querying of partition master PostgreSQL table -

i'm talking this feature . i have master table: logstore=# \d history_log table "public.history_log" column | type | -----------+--------------------------+----------------------------------------------------------- id | bigint | not null default nextval('history_log__id_seq'::regclass) tstamp | timestamp time zone | not null default now() session | character varying(40) | action | smallint | not null userid | integer | urlid | integer | indices: "history_log__id_pkey" primary key, btree (id) triggers: insert_history_log_trigger before insert on history_log each row execute procedure history_log_insert_trigger() and set of child tables partitioned tstamp column: logstore=# \d history_log_201304 table "public.history_log_2