Posts

Showing posts from January, 2011

Bash Script Leet Text Convertor: How to get array to recognize spaces -

the issue code below can not seem array recognize when text has spaces in or not. figured adding ' ' value in array handle this, wrong. haven't found luck searches how array recognize spaces in bash scripting. #!/bin/bash if [ "$1" == "-e" ]; # if cli argument -e opt="encrypt"; # set option encrypt elif [ "$1" == "-d" ]; # if cli argument -d opt="decrypt"; # set option decrypt else # else show proper usage echo "usage - encrypt text: ./l33t.sh -e text"; echo "usage - decrypt text: ./l33t.sh -d text"; exit; fi #creating array leet text , plain text declare -a leet=('ɐ' 'ß' '©' 'Ð' '€' 'ƒ' '&' '#' 'i' '¿' 'x' '£' 'm' '?' 'ø' 'p' 'o' 'Я' '§' '†' 'µ' '^' 'w' '×' '¥' 'z...

sql server - Can I map a decimal property to a float db column -

i'm writing .net web app on top of existing db app (sql server). original developer stored money in float columns instead of money or decimal . want use decimal inside pocos (especially because doing further operations on values after them). unfortunately, cannot touch db schema. there way still use decimal in pocos , tell ef "it's ok, know decimal , float don't along. don't either. best." with no special configuration, error: the specified cast materialized 'system.double' type 'system.decimal' type not valid. i tried using modelbuilder.entity(of mypocotype).property(function(x) x.moneyproperty).hascolumntype("float") , gets me error: schema specified not valid. errors: (195,6) : error 0063: precision facet isn't allowed properties of type float. (195,6) : error 0063: scale facet isn't allowed properties of type float. something work: public class mypocotype { public float floatprop...

vim - Count() function in vimscript -

i reading .vimrc spf13-vim on github, , there didn't understand: " snippets & autocomplete if count(g:spf13_bundle_groups, 'snipmate') bundle 'garbas/vim-snipmate' bundle 'honza/vim-snippets' " source support_function.vim support vim-snippets. if filereadable(expand("~/.vim/bundle/vim-snippets/snippets/support_functions.vim")) source ~/.vim/bundle/vim-snippets/snippets/support_functions.vim endif elseif count(g:spf13_bundle_groups, 'neocomplcache') bundle 'shougo/neocomplcache' bundle 'shougo/neosnippet' bundle 'honza/vim-snippets' elseif count(g:spf13_bundle_groups, 'neocomplete') bundle 'shougo/neocomplete.vim.git' bundle 'shougo/neosnippet' bundle 'honza/vim-snippets' endif what count() function here? check if item (snipmate or neocomplcache...

Java, dynamic class loading from github sources -

okay, trying following: i have java-files on github. want load these dynamic @ runtime. there possibility ? think urlclassloader not working, because dont have url containing folder of files, have url file itself. thanks in advance you can: download java file local system use javacompiler standardjavafilemanager (cf example in javacompiler javadoc) compiler java file class file can save on local system use urlclassloader load class file

c++ - Compiler can't find base class method when called from derived, and the derived defines same named method with additional parameter -

here's link ideone simple code paste: http://ideone.com/bbck3b . the base class has paramtereless function, whereas derived has 1 parameter. public. why compiler fails find a::foo() when called instance of b? the code: #include <iostream> using namespace std; class { public: virtual void foo() { cout << "a::foo" << endl; } }; class b : public { public: void foo(int param) { cout << "b::foo " << param << endl; } }; int main() { b b; b.foo(); } the compiler error: prog.cpp: in function ‘int main()’: prog.cpp:25:11: error: no matching function call ‘b::foo()’ b.foo(); ^ prog.cpp:25:11: note: candidate is: prog.cpp:16:10: note: void b::foo(int) void foo(int param) ^ prog.cpp:16:10: note: candidate expects 1 argument, 0 provided this standard c++ behaviour: base class method hidden derived-class method of same name, regardl...

javascript - baseUrl issue - requireJS -

i experiencing baseurl issue, 404 error, telling me root-app/js/module.js not found. here's how comes first, call <script data-main="js/main" src="js/lib/requirejs/require.js"></script> then in js/main.js , have (for testing mean) require({ paths: { upload: 'js/vendor/module.min' } }, ['js/vendor/main.js'], function(app) { app.add(2, 2); }); but in js/vendor/module.min.js itself, there declarations define(["module"]... , , 1 trigger 404 error. how can circumvent problem ? (sure, can move js/vendor/module.min js/module.min want keep code organized ;). necessary change define(["module"]... define(["vendor/module"]... ? in fact, problem here paths: { upload: 'js/vendor/module.min' } because of declaration define(["module"] in js/vendor/module.min.js suppose can't rename path uplaod , expecting paths: { modu...

usege of uploadify in a spring webflow flow -

this first question here please point me right direction if wrong. i'm experiencing difficulties while trying use uploadify flash based multi file uploader inside spring webflow flow. here detailed explanation of case: here versions of libraries i'm using: spring-webflow 2.3.2 spring-web 3.2.1 springwebmvc 3.2.1 uploadify v3.2 commons-fileupload 1.2.2 commons-io 2.4 commons-codec 1.8 apache tiles 3.0.1 webflow conf <webflow:flow-executor id="flowexecutor"> <webflow:flow-execution-listeners> <webflow:listener ref="loggingflowexecutionlistener" /> </webflow:flow-execution-listeners> <!-- max execution sayisina ciktiktan sonra mevcut execution'larin hepsini kill ediyor --> <webflow:flow-execution-repository max-executions="10" /> </webflow:flow-executor> <webflow:flow-registry id="flowregistry" base-path="/web-inf/views" flow-builder-services...

Use jQuery to make a NEW instance of angularJS array -

i working angular , jquery i have div "a", pulling content via angular <div class="a"> <p ng-repeat="banana in bananas">{{banana}}</p> </div> i have ul class "b" <ul class="b"> <li>content 1</li> <li>content 2</li> <li>content 3</li> <ul> when of li inside "b" clicked insert li in .accordion //this works fine $(".b li").click(function () { $(this).clone().appendto(".accordion"); }); the problem when want same thing div "a"... div "a" inserted on last appended li jquery accordion div, empty, <div class="accordion"> </div> and trying create new instance of div "a" everytime li clicked must inserted new child of accordion can work independently class "a" must created within jquery, inserted myvar = $("<div class=...

asp.net - DateTime Not working in Global.asax in c# -

i trying use datetime in global.asax give name file gives error. please assist? the code using datetime; public void callfilecreate() { string path = configurationmanager.appsettings["logfilefolder"].tostring(); string filename = httpcontext.current.server.mappath(path + "\\log_" + datetime.now.toshortdatestring().replace("/", ".") + "_" + (datetime.now.tolongtimestring()).replace(":", "_") + ".txt"); tracefilepath = httpcontext.current.server.mappath(path + "\\scheduler" + datetime.now.toshortdatestring().replace("/", ".") + "_" + (datetime.now.tolongtimestring()).replace(":", "_") + ".txt"); filestream fs = null, fs1 = null; fs = file.create(filename); fs1 = file.create(tracefilepath); errorfilepath = filename; } you should use path class if work paths: string path = configurationmanager...

extjs - JavaScript error in IE8 but not in IE 10 -

Image
i using ie 10 , developed tree panel using extjs 4.1. when run application in ie 10 works fine switch ie 8 (within ie 10 using ie developer toolbar browser mode option), javascript error. have never seen such inconsistent behavior far extjs. please using following fiddle reproduce issue. http://jsfiddle.net/byqrn/20/ ext.create('ext.tree.panel', { title: 'simple tree', renderto: ext.getbody(), width: 400, height: 400, store: { root: { expanded: true, children: [{ checked: false, text: "1 detention", expanded: true, children: [{ checked: false, text: '1.1 foo', leaf: false, children: [{ checked: false, text: "1.1.1 india", expanded: true }, { ...

ios - Automatically sending SMS message -

this question has answer here: send mail iphone app without using user interaction ios5? 2 answers how can write sms sending application. details given below: i have button, when click button, sms should automatically sent recipient without opening message writing area. should pop message saying "sms sent". sms content default content. please me full code. you can't. apple not provide functionality, thankfully: malicious apps use send sms premium services.

c++ - Can I restrict a test for a nested enum using SFINAE to a class without base classes? -

when use sfinae detect @ compile time if class has type, seems include derived types. ideally test existence of enum, shows same effect: both tests work in general, return true if class derives type or enum. live example here! #include <iostream> struct { enum { istagged }; struct istaggedstruct{}; }; struct b :a {}; struct c {}; template< int > struct hastag; template< class tst > struct check { template< class t2 > static char (&test( ... ))[1]; template< class t2 > static char (&test( hastag<t2::istagged>* ))[2]; //template< class t2 > static char (&test( typename t2::istaggedstruct* ))[2]; static const bool value = sizeof(test<tst>(0))==sizeof(char[2]); }; int main(int argc, char* argv[]) { std::cout << "value a=" << check< >::value << std::endl; std::cout << "value b=" << check< b >::value << std::endl; std::cout ...

sqlite - Android - Could not open database -

i have db.sqlite file in asset folder , error when try open it: android.database.sqlite.sqlitecantopendatabaseexception: unknown error (code 14): not open database i've tried different paths , names (with , without extension) can't make work. package com.example.app.db; import java.io.file; import java.io.fileoutputstream; import java.io.ioexception; import java.io.inputstream; import java.io.outputstream; import android.content.context; import android.database.sqlexception; import android.database.sqlite.sqlitedatabase; import android.database.sqlite.sqliteexception; import android.database.sqlite.sqliteopenhelper; import android.widget.toast; public class databasehelper extends sqliteopenhelper { // android's default system path of application database. private static string db_path = "/data/data/com.example.app/databases/"; private static string db_name = "app"; private sqlitedatabase mydatabase; private final context mycontext; ...

jquery - get value from textbox does not work -

for javascript code tried 2 alternative solutions in get value in input text box , answer 2 rjd22, pls see code below. option works fine, option b doesnt; console shows 'undefined' when enter figure (or text). any idea why b not work? use option want validate form field has been filled in, , val() description ( http://api.jquery.com/val/ ) cannot see val() returns when no value has been filled in. thnx comments in advance. html code: </label> <input id="usage" type="text" name="usage"> javascript code: this.usage = $("#usage").val(); //option a: works this.usage = $("#usage").attr("value"); //option b: doesnt work console.log(this.usage); val() returns '' (empty string) when no value has been entered. should use val() instead of prop or attr . fiddle.

keyboard emulation with windows and python -

i'm trying achieve same under windows have achieved in linux environment. serial keyboard input, please or point me in right direction. i'd should simple possible, tried failed. import serial import time import uinput import binascii ser = serial.serial( port='/dev/ttyusb0',\ baudrate=115200,\ parity=serial.parity_none,\ stopbits=serial.stopbits_one,\ bytesize=serial.eightbits,\ timeout=0) ser.open() device = uinput.device([uinput.key_a, uinput.key_b]) time.sleep(1) while true: datain=ser.read(1) if datain=='': continue datain_int=int(binascii.hexlify(datain), 16) datain_bin=bin(datain_int) if datain_int==0: continue if datain_int==128: device.emit_click(uinput.key_a) elif datain_int==64: device.emit_click(uinput.key_b) i'm not sure you're trying exactly, here's script once wrote build hotkey cheat engine gta san andreas import pyhook import pytho...

azure - Microsoft reporting services 2012 deployable to the cloud -

i have quick question on microsofts reporting service. know ssrs 2012 desktop version , have azure reporting services, know possible host ssrs 2012 on cloud , use directly. picking contradicting advice on web regards this, worried using azure because limit using azure database. what i'm looking do, have reporting service hosted on cloud without restriction on data sources. thanks mark

javascript - Issue with my CSS template when the mouse is over the tiles -

here's want : i've created 1 generic template feed several tiles. when mouse on tile, shows transparent-black square icon on tile. works fine, problem when got multiple tiles using template on same page, no matter tile mouse over, transprent-black square on first tile. here's code, it's mixed css/javascript code (it works) i've tried create js function can't make work. <div class="hover" style="width: 100%; height: 100%; overflow: auto;" onmouseover="document.getelementbyid('tag').style.display='';" onmouseout="document.getelementbyid('tag').style.display='none';"> <div style=" background-repeat: no-repeat; background-position: center; background-size:27px 27px; background-image:url('/static/img/icons/search.png'); background-color: black; width: 100%; height: 70%;...

Prototype and jQuery UI interference -

ok i've been researching while , reordered javascript files knows how many times. know prototype , jquery not work eachother. however, jquery working, jquery ui functions not. i'm listing js files in order: - prototype.js - jquery.js - jquery-ui.js - jquery-noconflict.js my jquery no conflict file looks this: jquery.noconflict(); ok of junk in tags. later on in page, i'm doing this: <div class="product_tabs clearfix"> <ul> <?php if ($_description): ?> <li><a href="#tabs-1"><?php echo $this->__('details') ?></a></li> <?php endif; ?> <li><a href="#tabs-2">review</a></li> <li><a href="#tabs-3">tags</a></li> </ul> <div class="std clearfix"> <?php if ($_description): ?> <div id="tabs-1"><?php echo $this->helper('catal...

javascript - Switch between .bind() and .on() - dynamically -

i want this, because working third-party scripts releated internet marketing. of them may contain jquery library included within , interfere recent or latest jquery library included on website. hence, i'd switch between .on() , .bind() dynamically upon website load of variable. for example, let's have global variable: var incjs = false; and depending of third-party script, know if have older lib included i'd use this. function tpnetwork () { incjs = true; startgateway('xxxxx'); $('#fancybox-outer') .delay(1000) .fadeto(300, 1); preventgtw(); widgetstyle(); } now may see there's function @ bottom widgetstyle() that function contain loads of things, important part following: $(window).on('resize', function () { if ($('.widget_wrap').length) widgetcenter_horizontal(); }); it has .on() method there. not supported in old jquery that's been used third-party network. i'd sw...

php - Daily Average for 1 Week -

i attempting daily averages in query below, each day in 1 week period. select avg(`carbs`) carbs, avg(`sugar`) sugar, avg(`units`) units, date_format(`trackedon`, '%m/%d/%y') date `tracking` `trackedon` between adddate(now(), interval -7 day) , now() however, returning me 1 days worth of averages (but think it's averaging in 1 week, , displaying first day) can me achieve this? here dummy data, table structure: -- -- table structure table `tracking` -- drop table if exists `tracking`; create table if not exists `tracking` ( `trackid` bigint(20) not null auto_increment, `userid` bigint(20) not null, `tracktype` int(11) not null, `carbs` decimal(10,3) not null, `sugar` decimal(10,3) not null, `units` decimal(10,3) not null, `trackedon` datetime not null, `tracklocation` geometry not null, primary key (`trackid`) ) engine=myisam default charset=latin1 auto_increment=11 ; -- -- dumping data table `tracking` -- insert `tracking` (`trackid`, `us...

angularjs - How to stub out a controller method called during object construction -

i have angularjs controller calls own refresh() method while being constructed. method in question accesses template elements not present during unit testing. function listcontroller($scope) { /// ... $scope.refresh = function() { var tabid = angular.element('#id li.active a').attr('href'); //etc } //initialise $scope.refresh(); } the refresh method causes unit tests fail while controller being constructed. work irrelevant tests, want override method stub , test has been called. jasmine's spy functionality looks way go, can't find way of setting 1 object before constructed. how this? you should move directive's link function. link function result of compile know sure element compiled , ready, , make "refresh" function unnecessary. in general, should never access dom via jqlite or jquery controller. also, link function provides direct access element, scope, , attributes (even href) nice. ...

javascript - strange "not defined" error -

i have below code in viewmodel: ca = function (clientnum) { this.caname = null; this.caadress = null; this.caidnum = null; this.cacontact = null; this.canote = null; this.catype = null; this.clnum = clientnum; }, viewmodelnewcredit = function () { var creditrows = ko.observablearray(), showview = ko.observable(), sessionticket = ko.observable(), loggeduser = ko.observable() newcreditrows = function () { console.log(this.clientnum()); this.creditrows.push(new ca(this.clientnum())); console.log(creditrows()); }, remove = function (ca) { this.creditrows.remove(ca); }; return { creditrows: creditrows, showview: showview, sessionticket: sessionticket, loggeduser: loggeduser, viewmodelnewcredit: viewmodelnewcredit, remove: remove }; }, and in html have: <tbody data-bind="foreach: ...

asp.net - Dynamically changing the connection string for a gridview with a button? -

i have log file in several sql databases. i want have grid on asp page bound 1 of them. i want have several buttons on page change table fills gridview. this asp vb web site project. can help? thanks! just have buttons bind data through different methods. example, button calls method uses connection string fill gridview.

html - Safari transform rotatex bug -

i have weird bug safari... i have 3 divs captions, hidden rotatex(-91deg) . on :hover caption comes down via rotatex(0deg) . works in chrome etc. when hover in safari works on first div. when hover on 2. or 3. animation doesn't work. check out demo: http://jsbin.com/aseced/28/edit html: <article class="tile2x1"> <section class="caption"></section> </article> <article class="tile2x1"> <section class="caption"></section> </article> <article class="tile2x1"> <section class="caption"></section> </article> css: [class*="tile"] > section.caption { padding-top: 20px; width: 100%; background-color: blue; height: 100px; transform-origin: top; -o-transform-origin: top; -moz-transform-origin: top; -webkit-transform-origin: top; transform: perspective( 600px ) rotatex( -91deg ); -o-tr...

python - Search and replace in current file with Sublime Text plugin -

i trying port sublime text build system plugin. the build system receive current file , go through code: for line in fileinput.input(inplace=1): sys.stdout.write(makereplacements(line)) now, in plugin syntax go fact way current file's content is: input = self.view.substr( sublime.region(0, self.view.size()) ) but i'm not sure should next operation. for line in input(inplace=1): how make replacements in file on-the-fly , save it? i don't think sublime text plugin api can save buffer, use file_name() method in sublime.view class , work file directly. as noted @mattdmo, file can saved using view.run_command('save') . it may easier use file name if old build file worked that.

javascript - ng-repeat empty on load when applying ng-model filter -

i have code : <input type="text" placeholder="search..." ng-model="query" /> <table ng-controller="employees" ng-init="init()"> <tr ng-repeat="employee in employees | filter:{ name: query }"> <td>{{employee.name}}</td> </tr> </table> the problem when page loads, there nothing in table, until type in search input. matching appears, , if clear input, employees displayed (as should on load). i don't have problem if write filter: query instead of filter:{ name: query } . how can have data displayed on load filter:{ name: query } ? add line employees controller: $scope.query = '';

python - What's the way of record traceback info into a file using LOGBOOK -

i'm new python 3rd party logging module logbook. after reading documents provided auther, not find equivalence to: logging.exception which record traceback info me. am missing information docs? , how can implement this? thanks in advance! logging.exception convenience method calls .exception method of root logger instance. logbook doesn't seem have such method on module itself, you'll have initialize new logger (in respect, api compatible). from logbook import logger log = logger('exceptions') try: raise exception() except: log.exception()

c# - Resetting Context for Entity Framework 5 so it thinks its working with a initialised Database - Code First -

linked question: cannot split table ef 5 - code first - existing database but think answer question not problem code first did whilst developing. the scenario this: had existing database , used begin creating data context began working realised naming conventions poor , tables needed remodelling. decided create new database better conventions existing tables taken across , remodelled new bits updated context @ new database even though migrations not enabled, getting errors database being out of sync (even though until morning still pulling data) i enabled migrations (comment in other question) , output script. , can see sync changes things table names , id properties etc. i can't move forwards, context seems not when switch databases on (which point brittle). need somehow reset context doesn't think changes have been made database , thinks working initial database again. i have deleted migrations folder, nothing. there sort of way can happen? ...

java - Ajax Post request to a Jax-rs service -

i'm trying simple post request browser , 415 unsupported media show in browser's console, in console says type is text/html , maybe i'm mising stupid here i'm doing post request android client , find server side, guess (since i'm not familiar js) it's javascript problem i'm having here, here portions of interest of code: ajax (this function called send , things before create json, part it's ok , tested, json being genereated successfully): $.ajax({ url: 'webresources/serverconfig/save/', type: 'post', datatype:'json', data: jsonobj }); how call javascript in html form: <form action="javascript:send()" method="post"> jax-rs service: @path("serverconfig/") public class configurationsaverservice { @post @path("save/") @consumes(mediatype.application_json) public void save(configuration configuration){ //config stuffs ...

null - If you nullify spent objects in javascript, are you saving possible silly garbage collections? -

if nullify spent objects in javascript, saving possible silly garbage collections? for example. if iterate through users in javascript: var users = [ { firstname: "chris", lastname: "pearson" }, { firstname: "kate", lastname: "johnson" }, { firstname: "josh", lastname: "sutherland" }, { firstname: "john", lastname: "ronald" }, { firstname: "steve", lastname: "pinkerton" } ]; // data, perhaps put in table users = null; is worth nullifying list? have science behind performance gains or if it's waste of time etc? it's quite hard explain people why way, know it's saved bacon on many occasions in, ofcourse, c++, in javascript, there experiment find out if it's worth in javascript? find sizeof function can trust, making me cry... if has done kind of experiment, i'd grateful see have come with! it depends on situation. example, he...

bash - Using variable with sed -

first of apologise in case has been answered before couldn't solve problem. i need search pattern , replace line of text comprising of both text , variable.btw using bash.. say $var = "stacko.ver/rulz=" **note: $var contain double quotes & = & dot , /** i want follow 1.search ;te.xt = note: value search contain ; & = , dot 2.replace textnum=$var of course $var should replaced actual value my attempts sed -i "s/;te.xt =/textnum=$var/" file sed -i "s/;te.xt =/textnum="$var"/" file sed -i "s/";te.xt ="/"textnum=$var"/" file none of these worked , either sed giving me error or value of $var not shown in file thanks regards quoting doesn't since sed issue, not bash issue. pick sed s-expression delimiter doesn't appear in text: sed -i "s|;te.xt =|textnum=$var|" file you can pick delimiter s doesn't appear in input. sed -e 'streetlight...

c# - Publishing ASP.NET vs. copying files -

i want know sure if there possible issues not publishing asp.net solution. in company current policy (strangely) copy web project dll, , needed references dlls, web.config , global.asax , image files on existing ones on iis web server(virtual directory created). do see issue above? your feedback appreciated. don't see problem this. it's sort of do. publish folder - folder, check web.config against live, zip up. create change request, referencing zip file & pass hosting team deploy. this works great us, has different views & circumstances. don't see technical issue, more of business process issue.

c++ - How to set up use of camera on Android with OpenCV + Qt5 -

there numerous questions around here, qt sites , opencv sites, none of them quite match case. (and lot unanswered anyway.) i'm using opencv android 2.4.6 (the prebuilt version downloadable official site) build native app android (4.1.2) on samsung galaxy note 2 qt 5.0.1 android (using qtcreator 2.7.2) on x86_64 linux host. i've linked against libraries in ../sdk/native/libs/armeabi-v7a folder. (i haven't built opencv source, i'm using in downloaded package). includes libopencv_androidcam.a library. (and i've tried libnative_camera_r4.1.1.so shared lib.) i've downloaded market app "opencv manager". the sample .apks samples directory work on phone, haven't tried build them on own, don't have java development environment set up. starting application, contains cv::videocapture inputcapture(cv_cam_android); statement, following error , no camera input: e/opencv::camera(15299): camerawrapperconnector::connecttolib error: cannot dlopen ...

model - How to store variables in all pages requestScopes within Spring -

i add objects in jsp requestscopes using controllers. for example, if need list categories in "localhost/products/viewall", change productscontroller adding like @requestmapping("/products/viewall") public void viewcategories(model model) { list<category> categories = service.findallcategories(); model.addattribute("categories", categories); } so, method adds list of categories requestscope. i need same, pages of website (since variable need used in layout of site). how can add pages requestscopes spring? i think have @ least 2 possible options this: using mvc interceptor . interceptor can perform common operations requests. can extend handlerinterceptoradapter , add common model data in posthandle using @modelattribute annotation within controller. can use add common data request mappings within controller. can use @controlleradvice (with @modelattribute annotated methods inside) if want provide model data con...

loops - Python: Looping over 2mln lines -

i have loop on large file 2mln lines, looks p61981 1433g_human p61982 1433g_mouse q5rc20 1433g_ponab p61983 1433g_rat p68253 1433g_sheep currently have following function, take every entry in list, , if entry in large file - took row occurence, it's slow (~10min). due looping scheme, can please suggest optimization? up = "database.txt" def mplist(somelist): newlist = [] open(up) u: row in u: in somelist: if in row: newlist.append(row) return newlist example of somelist somelist = [ 'p68250', 'p31946', 'q4r572', 'q9cqv8', 'a4k2u9', 'p35213', 'p68251' ] if somelist contains values found in first column, split line , test first value against set , not list : def mplist(somelist): someset = set(somelist) open(up) u: return [line line in u if line.split(none, 1)[0] in someset] t...

ORM Entities vs. Domain Entities under Entity Framework 6.0 -

i stumbled upon following 2 articles first , second in author states in summary orm entities , domain entities shouldn't mixed up. i face problem @ moment code ef 6.0 using code first approach. use poco classes entities in ef domain/business objects. find myself in situation define property public or navigation property virtual because ef framework forces me so. i don't know take bottom line of 2 articles? should create example customeref class entity framework , customerd domain. create repository consumes customerd maps customeref queries , maps received customeref customerd. thought ef mapping domain entities data. so please give me advice. overlook important thing ef able provide me with? or problem can not solved ef? in latter case way manage problem? i agree general idea of these posts. orm class model part of data access layer first , foremost (even if consists of so-called pocos). if conflict of interests arises between persistence , business logic ...

c# - How to have application use different databases via wcf dataservice -

we building c# .net application sold clients, sql server database hosted us. have database each client. not sure if can use 1 wcf data service access different databases. using entity framework build database. how can accomplish client can pass in correct database name or connection string? this different databases using wcf dataservice said possible, doesn't specifics. this wcf service multiple clients database(each client) looks same question, has no answers. make wcf-service session based, provide login-method , in method have decide database use, can either change connectionstring edmx if datamodel same or if have differnt datamodels each client have create edmx instance each client! here simple pseude-code, entityid identifies client for creating entityconnectionstring check out link to create session-based wcf service have define service interface that [servicecontract(sessionmode = sessionmode.required)] public interface isampleservice { [o...

c++ - Double pointer of Mat initialization -

i trying make mat array using opencv. array store number n of region of interest, , each region have store information of last 5 frames. i'm trying use double pointer mat . question how initialize it? i'm trying this: in header of class: mat *objs_avgwb[25]; and initialize in source file: vseg.objs_avgwb = new mat[vseg.avgw][25]; instead of mucking around pointers , new , better option use containers provided standard library. don't need worry how you'll initialize them, since can resized dynamically. for each set of features in frame, create std::vector of cv::mat objects, 1 each region of interest. then, use std::deque hold features each frame. std::deque<std::vector<cv::mat>> roi_history; on each new frame, push_back each roi onto std::vector representing rois in frame: std::vector<cv::mat> new_rois; new_rois.push_back(roi1); new_rois.push_back(roi2); // etc... you pop off oldest frame , push new data keep 5 frames ...

java - Problems with migration from WAS 6.1 to WAS 7.0 cookie is always null -

i have problem: i migrate applications 6.1 7.0 using migration tool in c:\program files\ibm\sdp\runtimes\base_v7\bin\migration the application running fine in 6.1 server when migrated there problem 1 cookie need getting division user. after debugging while realize cookie getting created reason don't know cookie not getting put httpservletresponse , when try retrieve value cookie says null . here's snippet of code used this: public static void setdivisioncookie( string div, httpservletresponse res ){ cookie cookie = new cookie(user_division_cookie_name, div); cookie.setmaxage(integer.max_value); cookie.setpath("/"); res.addcookie( cookie ); } i have application running struts (these jar's i'm using struts-1.2.9 , struts2-core-2.1.8.1 , struts-taglib-1.3.8 ) each web application get/put cookies under servlet context path. example cookie.setpath(request.getcontextpath());

sql server - How to run a Sum on a DateTime Field in SQL with join on Single Column -

using ssms ( sql server management studio ) - 2012 please me finish building sql query. first table sites client,market,project,sitenumber grum , lad , aaa , 12345 gla , daa , h11 , 56789 second table sitesstatus sitenumber,statusname,date(datetime),byuser 12345 , sta1 , 8/7/13 15:33:22, hec 12345 , sta1 , 8/7/13 15:43:22, hec 12345 , sta2 , 8/7/13 15:53:22, hec 12345 , sta2 , 8/7/13 16:03:22, hec 12345 , sta2 , 8/7/13 16:13:22, hec 56789 , sta1 , 8/7/13 15:22:22, hec 56789 , sta2 , 8/7/13 15:32:22, hec desired results client,market,project,totalsites, sta1 ,totstattime, sta2 ,totstat2time,byuser grum , lad , aaa , 5 , 2 , 10 , 3 , 20 , hec gla , daa , h11 , 2 , 1 , inprogress, 1 , inprogress , hec it have show hours of row of date column in table 2 correspond sitenumber table 1, place inprogress column/row of result if didn't fin...

c# - Abuse using and Dispose() for scope handling of not to be released objects? -

for convenience , safety reasons i'd use using statement allocation , release of objects from/to pool public class resource : idisposable { public void dispose() { resourcepool.releaseresource(this); } } public class resourcepool { static stack<resource> pool = new stack<resource>(); public static resource getresource() { return pool.pop(); } public static void releaseresource(resource r) { pool.push(r); } } and access pool like using (resource r = resourcepool.getresource()) { r.dosomething(); } i found topics on abusing using , dispose() scope handling of them incorporate using (blah b = _new_ blah()) . here objects not freed after leaving using scope kept in pool. if using statement expands plain try dispose() should work fine there more happening behind scenes or chance won't work in future .net versions? this not abuse @ - common scope-handling idiom of c#. examp...

r - Find quantiles of gamma like distribution -

Image
the data gamma distributed. to replicate data this: a) first find distrib. parameters of true data: fitdist(datag, "gamma", optim.method="nelder-mead") b) use parameters shape, rate, scale simulate data: data <- rgamma(10000, shape=0.6, rate=4.8, scale=1/4.8) to find quantiles using qgamma function in r, just: edit: qgamma(c(seq(1,0.1,by=-0.1)), shape=0.6, rate =4.8, scale = 1/4.8, log = false) how can find quantiles true data (not simulated rgamma)? please note quantile r function returns desired quantiles of true data (datag) these understand assuming data distributed. can see not. quantile(datag, seq(0,1, by=0.1), type=7) what function in r use or otherwise how obtain statistically quantiles highly skewed data? in addition, make sense somewhat? still not getting lower values! fn <- ecdf(datag) fn(seq(0.1,1,by=0.1)) quantiles returned "q" functions, in case qgamma . data eyeball integration suggests of dat...

javascript - jQuery - TypeError: "".match is not a function -

(function( $ ) { $(function() { $( '.addrow' ).delegate( 'click', function() { var $this = $( ), $tbody = $this.parents( '.tbody' ); $tbody.find( 'td:nth-child(-2)' ).css( 'background', 'red' ); }); }); })( jquery ); i'm getting following error : timestamp: 07/08/2013 21:02:49 error: typeerror: "".match not function source file: file:///c:/program%20files/wamp/www/kbd-creator/v5/jquery-1.10.2.min.js line: 5 i tried changing .delegate .on , error doesn't appear anymore. doing wrong .delegate ? you're missing parameter .delegate() . should use .on() anyway, though note if call 2 parameters it's not going delegated handler setup.

Python in C++: Unresolved external -

i try embed python in c++ application, linker keeps saying error: [ilink32 error] error: unresolved external '_pymodule_create2tracerefs' referenced e:\cpp projects\anderlicht\win32\debug\anderlicht.obj i'm using embarcadero c++ builder xe2, converted python33.lib coff2omf.exe. this code in main.cpp: #include "anderlicht.c" #pragma comment(lib, "python33_omf.lib") // in main(): pyimport_appendinittab("anderlicht",pyinit_anderlicht); py_setprogramname(programname.w_str()); py_initialize(); in anderlicht.c python.h included. have fix error? the problem you're using different compiler flags in building code used in building python dll. in particular, pymodule_create2tracerefs defined if have -dpy_trace_refs (which passed in via extra_cflags in make command on unix; have no idea how embarcadero c++ builder on windows). usually, isn't defined—in particular, if you're using dll pre-build python binary, won'...

c# - Sending mail and pulling data from app.config -

i have situation. html code standard 3 text boxes , 1 button: <add key="cma_contact_form_email" value="somec@gmail.com"/> <add key="cma_contact_to_address" value="some@gmail.com"/> <add key="smtpserver" value="smtp.gmail.com" /> <add key="enablessl" value = "true"/> <add key="smtpport" value="993" /> <add key="smtpuser" value="some@gmail.com" /> <add key="smtppass" value="pass" /> code behind: protected void imagebutton_click(object sender, eventargs e){ mailmessage msg = new mailmessage(); msg.to.add(configurationmanager.appsettings["cma_contact_form_email"]); msg.from = new mailaddress(configurationmanager.appsettings["cma_contact_to_address"]); msg.body += "name: " + txtname.text + "\n"; msg.body += "em...

php - highcharts JSON google earth -

i show pie chart (using highcharts library) inside placemark's popup box (google earth desktop) data taken mysql database residing on live server. the chart intended dynamic , realtime. from research found can using json formatted data taken php script in server , sent html file pre-processed. i put html code (highcharts.html) inside placemark popup , refers retrieve_data.php file residing in server . the php file fetching dummy data (if access address of php script referenced inside html code can see them) seems json encoding done. the thing how send them @ google earth placemark (or google earth placemark fetch them).... am missing in communication server or wrong?? note: first contact json data transfer! below files use. thank in advance help <!doctype html> <html lang="en"> <head> <meta charset="utf-8" /> <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/...

sql - alternate for IN operator -

i have below query question alternate way use in clause in where clause, taking lot of time pull records. there 1000 records in table need 64 records few of them in clause below. query effecting performance. select distinct t6.name ord_job_code t6 t6.name in ('g23.08', 'g10.01', 'g10.02', 'g10.03', 'g10.04', 'g10.05', 'g10.06', 'g10.07', 'g10.08','g10.09', 'g8.01','g8.02','g8.03','g8.04') please me in solving performance issue.

android - Establishing if a device is connected to a particular site -

i trying establish if device has connection particular site. if should start intent, if doesn't should throw toast. it seems throw toast though if device can see site:- public void gotostation(view v) { try { inetaddress ina = inetaddress.getbyname("http://www.lisbury.co.uk"); ina.isreachable(10000); { intent myintent = new intent(mainactivity.this, customizedlistviewstation.class); startactivityforresult(myintent, 0); } } catch (ioexception ioe) { toast.maketext(this, "you need data connection view safety zones", toast.length_long).show(); } } inetaddress ina = inetaddress.getbyname("www.lisbury.co.uk"); but isreachable doesn't guarantee device can connect site - isreachable using icmp echo , tcp port 7, both can filtered out, yet host available, , vice versa - host can available, web server down