Posts

Showing posts from May, 2013

osx - How to build files as root in sublime on mac? -

today after updated os x 10.9.5 , xcode on mac , encounter problem sublime text 2 when write hello world program in c++, , run build, says agreeing xcode/ios license requires admin privileges, please re-run root via sudo. agreeing xcode license outside sublime text may resolve issue. running sudo xcrun cc should bring cli version of xcode license agreement. option open xcode.app , agree in gui.

python pandas parse_dates column wildcard for sqlalchemy in pandas 0.14.1? -

i'm using sqlalchemy allows sql queries released 0.14.1 version of pandas. import pandas pd dateutil import parser sqlalchemy import create_engine import datetime a=[['datetime', 'now date', 'numbers', 'mixed'], ['1/2/2014', datetime.datetime.now(),6, 'z1'], ['1/3/2014', datetime.datetime.now(), 3, 'z1']] df = pd.dataframe(a[1:],columns=a[0]) df['datetime']=df['datetime'].map(lambda x: parser.parse(x)) engine=create_engine('sqlite:///:memory:') df.to_sql('db_table',engine, index=false) df_new=pd.read_sql_query("select * db_table ",engine) >>> df.dtypes datetime datetime64[ns] date datetime64[ns] numbers int64 mixed object dtype: object >>> df_new.dtypes datetime object date object numbers int64 mixed object dtype: object as can see, original datetime format lost when feeding engine. pandas gives w

substr - Substract a part of a string considering some delimiters in php -

i have variable in php witch can have shape: $a = 'help&type=client'; $b = 'account#client'; $c = 'info&type=client#new'; i need create substract function work this: echo myfunction($a); //&type=client echo myfunction($b); //#client echo myfunction($c); //&type=client#new i rate more simplified answere. i think simplest way using strpbrk . $a = 'help&type=client'; $b = 'account#client'; $c = 'info&type=client#new'; echo strpbrk($a, '&#') . php_eol; //&type=client echo strpbrk($b, '&#') . php_eol; //#client echo strpbrk($c, '&#') . php_eol; //&type=client#new

windows phone 8 - Detect network roaming when there is no Internet connection -

i detect network roaming, while there not internet connection on windows phone 8 , 8.1. used code determine if user in roaming: connectionprofile profile = windows.networking.connectivity.networkinformation.getinternetconnectionprofile(); if (profile == null) return false; else return profile.getconnectioncost().roaming; with code easy find if phone in roaming when there internet access. problem occurs when there not connection , connectionprofile returns null. searched internet , stack overflow detecting network roaming, without results. suggested use mnc , mcc, windows phone doesn't provide such information or more detailed network info. didn't find either function android telephonymanager.isnetworkroaming(). is there function, api or method detect user in roaming, when internet connection down? you try this, using microsoft.phone.net.networkinformation; private void button1_click(object sender, routedeventargs e) {

php - __autoload() vs include,will __autoload() output something? -

i developing programm , it's based on third-party.i write class , use __autoload() load class. program runs following: 1.i upload script remote server. 2.the third-party server request script param. 3.my script return str , third-party server check str,if str same param,it's valid,if not,it's not valid. now,the problem is: when use __autoload(),it raise error , when replace __autoload include/require run exactly. code following: wechat.class.php public function __construct($options){ $this->_token=isset($options['token'])?$options['token']:''; } public function test(){ var_dump($this->_token); } private function checksignature(){ $signature = isset($_get["signature"])?$_get["signature"]:''; $timestamp = isset($_get["timestamp"])?$_get["timestamp"]:''; $nonce = isset($

c# - Row Command Event not fired for Dynamically created buttons inside gridView -

i have gridview in dynamically creating label , button on gv_rowdatabound. .cs label tagvalue = new label(); tagvalue.id = "lbltags_"+i; //tagvalue.cssclass = "tagbubble tagbubbledelete"; tagvalue.text = tag; button delete = new button(); delete.id = "btndelete_" + i; delete.tooltip = "delete"; delete.cssclass = "tagbubbledelete"; delete.commandname = "delete"; delete.commandargument = imageid.text; the problem "rowcommand" function not getting fired. not able reach e.commandname=="delete". what can done fire rowcommand event dynamically created button inside gridview. any appreciated. *******edit .aspx <asp:gridview runat="server" id="mygv" allowsorting="false" allowpaging="false" pagesize="20" autogeneratecolumns="false" datasourceid="ldsgv"

how to get the value from json in android -

hi getting following json pentaho server,how need date json "queryinfo":{ "totalrows":"1" }, "resultset":[ [ "09-09-2014" ] ], "metadata":[ { "colindex":0, "coltype":"string", "colname":"dt" } ] } the best way use gson deserilize string: create class in separate file. import java.util.list; import com.google.gson.annotations.serializedname; public class pentaho { public queryinfo queryinfo; public static class queryinfo { public list<result> metadata; public static class result { @serializedname("colindex") public string colindexstr; @serializedname("coltype") public string coltypestr; @serializedname("colname") public string colnamestr; } } } in activity

maps,filter,folds and more? Do we really need these in Erlang? -

maps, filters, folds , more : http://learnyousomeerlang.com/higher-order-functions#maps-filters-folds the more read ,the more confused. can body simplify these concepts? i not able understand significance of these concepts.in use cases these needed? i think majorly because of syntax,diff find flow. the concepts of mapping, filtering , folding prevalent in functional programming simplifications - or stereotypes - of different operations perform on collections of data. in imperative languages these operations loops. let's take map example. these 3 loops take sequence of elements , return sequence of squares of elements: // c - lot of bookkeeping int data[] = {1,2,3,4,5}; int squares_1_to_5[sizeof(data) / sizeof(data[0])]; (int = 0; < sizeof(data) / sizeof(data[0]); ++i) squares_1_to_5[i] = data[i] * data[i]; // c++11 - less bookkeeping, still not obvious std::vec<int> data{1,2,3,4,5}; std::vec<int> squares_1_to_5; (auto = begin(data);

How do I modify the legend in a Matlab plot? -

Image
i draw 4 circles of 2 colors. i'm using circle function draw circle. i'm facing problem legend() . colors 2 data same color. function main clear clc circle([ 10, 0], 3, 'b') circle([-10, 0], 3, 'b') circle([ 10, 10], 3, 'r') circle([-10, 10], 3, 'r') % nested function draw circle function circle(center,radius, color) axis([-20, 20, -20 20]) hold on; angle = 0:0.1:2*pi; grid on x = center(1) + radius*cos(angle); y = center(2) + radius*sin(angle); plot(x,y, color, 'linewidth', 2); xlabel('x-axis'); ylabel('y-axis'); title('est vs tr') legend('true','estimated'); end end the following picture shows problem. both colored blue instead 1 of them red. any suggestions? the thing draw 4 things , have 2 entries in legend. such pick color of first 4 things color legend. not in opportunity try myself now, guess ea

How to debug direct_mail under TYPO3 6.2 -

Image
i have made first typo3 4.5>6.2 update , seems quite fine. i have issue direct_mail though didn't find mentioned anywhere. the direct_mail 4.0 module stays empty, no matter module choose. there no php errors thrown. sysfolders used direct_mail configured "use container > contains plugin". how can debug this? go install tool , enable development-preset. after enabling, error messages should appear. updated direct_mail installation 4.4 typo3 6.2 while ago , got working.

javascript - AngularJS: calling $watchGroup from scope -

how can call $watctgroup form link function of directive. i've got 2 simple scope elements (integer) , i'd watch them in pair. suppose $watchgroup more effective use $watch('[element1, element2'],..). like this: scope.element1=1; scope.element2=2; scope.$watchgroup(['element1','element2'], function(){/* code here */}); update: bare in mind $watchgroup started being available in angularjs 1.3, if using previous version won't work. example of how use $watchgroup in directive: angular.module ('testapp' , []) .directive ('testdirective', function (){ return{ restrict:'a', replace:true, template: '<div ng-click="inc()">{{element1}} <br/> {{element2}}</div>', link: function(scope, element, attrs){ scope.element1=0; scope.element2=0; scope.inc = function(){scope.element1++;scope.element2--};

python - Flask partial view like MVC 3 -

is there .net mvc 3's partial view in flask? want embed widget in 1 view page,and widget has own logic. there several ways include content in jinja2 template: the include statement render supplied view (with current context default): {# in your_view_template.jinja #} {# ... code ... #} {% include "widgets/your_widget.jinja" %} {# ... code ... #} you can define macros , import them view template: {# in your_view_template.jinja #} {% import "widgets/your_widget.jinja" your_widget %} {# ... code ... #} {{ you_widget.render(your, important, variables, etc.) }} {# ... code ... #} both import , include can use variables, possible: # in view if complex_conditions.are_true(): widget = "widgets/special_custom_widget.jinja" else: widget = "widgets/boring_widget.jinja" render_template("your_view.jinja", widget=widget) {# in your_view_template.jinja #} {% include widget %} {# import widget sidebar_widget

c# - Open windows explorer with taskbar programmatically in Windows 8 -

i'm working wpf application in windows 8. app set os's shell, upon start up, app automatically launches. though, want upon closure of app, re-launch explorer w/ task bar. i've tried using process.start(environment.systemdirectory + "\\..\\explorer.exe"); which works great in windows 7, when ran under windows 8, explorer window appears (w/out taskbar). is there special need in windows 8? looking c# solution.

search - How do I find my jsperf tests? -

now noob question of week. how find jsperf tests? there's no "account" far can find out, , looking name or url doesn't appear help! i'd search name, website, etc., , "personal" search queries of others know. -- owen since jsperf not have user accounts, easiest way search via search engine. search "jsperf" + your_name (as entered on jsperf) find tests you've run under name search "jsperf" + title_of_test find specific test have run go github url https://github.com/mathiasbynens/jsperf.com find more info on files used create jsperf, license, , other tips

python - How to use text user input in pygame using a Mac -

i need know how download , set module on mac. i need know how use text user input pygame on mac. raw_input pygame. is there can do? i make comment reputation low don't know there different on mac in windows use: import nameofmodule for text input use tkinter or other gui or maybe pygame inputbox or eztext gui-es don't work after compilation you'll need debugging , inputbox , eztext doesn't nice , have bugs(to close inputbox must press pygame x button confuses user).i suggest use tkinter , fight compilation errors it's easier(at least me) trying debug inputbox or someone's work if don't want compile it. please correct me if i'm wrong inputbox that's whathappend me.

performance - Show CPU cores utilization in MATLAB -

is anyway (any function etc) show cpu cores utilization in matlab in gui likes have in task manager of windows (performance tab)? thanks. to knowledge, there no matlab function can access system properties @ level of process usage. information 1 must call external classes. a search on internet can fetch java classes can query process properties. advantage of java approach is more cross-platform. for windows user, there still 2 ways of querying these information: direct call windows api (faster, quite complicated put in place in matlab), , using .net object (slower, uber easy matlab handle .net classes seamlessly). create object we need tell matlab instantiate system.diagnostics.performancecounter object. example /i create 2 of these objects, 1 looks @ system idle process (called idle ) , 1 looks @ matlab process (this 1 report matlab cpu usage). function mon = createmonitor matlabprocess = system.diagnostics.process.getcurrentprocess(); % "

ember.js - Ember Data embedded belongsTo relationship returning null -

i have 2 models: question = ds.model.extend answers: ds.hasmany("answer") answer = ds.model.extend question: ds.belongsto("question") the json serves answers embedded within questions: "questions": [{ "id":"1.04" "text":"what position or title of 1% being protested against?", "answers":[ { "text":"city mayor", "id":"1.04.02" }, { "text":"city council member", "id":"1.04.03" }, { "text":"ceo of company", "id":"1.04.01" } ] }] when call question.get('answers') , ember returns expected array of answers. if, however, call answer.get('question') , null. idea why happening? i think need tell ember relation embedded, done so. question = ds.model.extend answers: ds.hasmany("ans

Java: How to store a 2D array within a 1D array -

i trying store found 2d array 1d array faster processing later. however, keep getting nullpointerexception when try fill 1d array. happens txt file has number of rows , colums read first row , column amount doing 2d array. each index reads next data element on txt file , stores @ index until 50 000 integer values stored. works fine. now want take 2d array , store elements 1d array faster processing later when looking answers without using array list or put them in order, fine, int [][] data = null; int[] arraycount = null; (int row = 0; row < numberofrows; row++) { (int col = 0; col < numberofcols; col++) { data[row][col] = inputfile.nextint(); } } //doesn't work gives me excpetion data[0][0] = arraycount[0]; i tried in loops no matter nullpointerexception you haven't initialized data , arraycount variables, initialize follows : int[][] data = new int[numberofrows][numberofcols]; int[] arraycount = new int[numberofrows * num

c# - Why does using WMI to get CPU usage freeze my program for a few seconds? -

i use code usage value of 4 cores in cpu, , display each 1 own label: string[] cpuusage = new string[100]; int = 0; //get cpu usage values using wmi managementobjectsearcher searcher = new managementobjectsearcher("select * win32_perfformatteddata_perfos_processor"); foreach (managementobject obj in searcher.get()) { cpuusage[i] = obj["percentprocessortime"].tostring(); i++; } la_core1.content = "core usage: " + cpuusage[0] + "%"; la_core2.content = "core usage: " + cpuusage[1] + "%"; la_core3.content = "core usage: " + cpuusage[2] + "%"; la_core4.content = "core usage: " + cpuusage[3] + "%"; however, first time code run, freezes program around 10 seconds before displaying value. past first time, however, code runs n

oracle11g - Check if Oracle table exists with Puppet -

i'm setting puppet provision file install, configure , restore dump file oracle database. i include check in exec command in order check if restore successful. here have far: exec {"import-dump": command => "impdp system/password dumpfile=mydump.dmp logfile=import-dump.log schemas=myschema", path => "/u01/app/oracle/product/11.2.0/xe/bin/", -- check if import command runned --- require => exec["install-oracle"], } i use approach following: exec { "import-dump": command => "impdp system/password dumpfile=mydump.dmp logfile=import-dump.log schemas=myschema", path => "/u01/app/oracle/product/11.2.0/xe/bin/", unless => "/bin/grep 'terminated successfully' /path/to/import-dump.log", require => exec["install-oracle"], } in way can check if previous import job run successfully.

php - foreach not looping correctly for a webservice -

i have , array being produced webservice. array ( [tpa_extensions] => array ( [tparoomdetail] => array ( [guestcounts] => array ( [guestcount] => array ( [!agequalifyingcode] => 10 [!count] => 1 ) ) [!occupancy] => single [!occupancycode] => sgl ) ) [!isroom] => true [!quantity] => 1 [!roomtype] => palace gold club room [!roomtypecode] => pgc ) my foreach loop below foreach ($roomtype["tpa_extensions"]["tparoomdetail"]["guestcounts"]["guestcount"] $guestcount) { echo "guest count1->";print_r($guestcount); echo "guest count2->"; print_r($roomtype["tpa_extensions"]["tparoomdetail"]["guestcounts"]["guestcount"]); } the output guest count1->10 guest c

Spring boot app with web.xml in the .war file -

i have spring boot application works fine in tomcat embedded. when take .war file final output have no web-inf/web.xml file. deploy in pass need web.xml in final output .war. how can in built? if deploy in servlet 3.0 compatible container, don't need web.xml. can use webapplicationinitializer mechanism spring (check example springbootservletinitializer).

glpk - Reading CSV data into subscripted set -

i ask assistance problem i'm dealing week. have been looking everywhere solution. official doc not accurate enough , says nothing on matter. the problem following: part of csv file "food.csv". here copied 6 columns make small previe of data. name index e k c rice 1 0 0 0 0 lentils 2 0.39 5 0.05 44 carrot 3 167.05 7 132 59 potato 4 0.03 0 21 74 apple 5 0.38 1 6 0.04 i'm importing gnu mathprog linear program using table statement. problem is, each column i'm forced use separated parameter. prefer index columns single 2 dimensional parameter iterate on them easily. set fields; param kc{i in 1..card(fields)}, symbolic; # symbolic example, it's numeric table data in "csv" "food.csv": fields <- [index], kc~kcal; the problem way have use separate parameter each column, if have 40 collumns , 2 constraints each of columns, gives 80 constraints in separated lines, if want cha

MATLAB Matrix construction advice -

Image
i need use matlab solve following matrix equation: this matrix nxn, , can construct of matrix using following matlab code: e = ones(n,1); = h^(-2)*spdiags([e (h^2 - 2)*e e], [-1 0 1], n, n); what's way change first , last row? perhaps nice add nice matrix b first row [ 2/h 1/h^2 0 ... 0 0 0 ] , last row [ 0 0 0 ... 0 1/h^2 (2h + 1)/h^2] , take + b. how though? i think simplest way best in case aren't modifying of matrix have created: a(1,:)=a(1,:)+[2/h 1/h^2 zeros(1,n-2)]; a(n,:)=a(n,:)+[zeros(1,n-2) 1/h^2 2/h]; or replace individual elements rather rows.

sql - Is it possible to have a user input to a sort -

is possible have sql query , how sort user input textbox, trying records table date user input select orderdate date, orderpizzatotals 'pizzas sold', orderdrinktotals 'drinks sold', orderpricetotal 'transaction total' dbo.[order] sort "userinput.text" it possible sort based on dynamic information (e.g. parameter pass code) if use dynamic sql in sql server: declare @userinput nvarchar(100) = 'your_column' declare @sql nvarchar(1000) = n'select orderdate date, orderpizzatotals ''pizzas sold'', orderdrinktotals ''drinks sold'', orderpricetotal ''transaction total'' dbo.[order] order ' + @userinput exec sp_executesql @sql

innodb - mysql Fatal error: cannot allocate memory for the buffer pool -

hi have error log mysql, idea. website works time , mysql shutdown after couple of hours. 140919 10:48:27 [warning] using unique option prefix myisam-recover instead of myisam-recover-options deprecated , removed in future release. please use full name instead. 140919 10:48:27 [note] plugin 'federated' disabled. 140919 10:48:27 innodb: innodb memory heap disabled 140919 10:48:27 innodb: mutexes , rw_locks use gcc atomic builtins 140919 10:48:27 innodb: compressed tables use zlib 1.2.3.4 140919 10:48:28 innodb: initializing buffer pool, size = 128.0m innodb: mmap(137363456 bytes) failed; errno 12 140919 10:48:28 innodb: completed initialization of buffer pool 140919 10:48:28 innodb: fatal error: cannot allocate memory buffer pool 140919 10:48:28 [error] plugin 'innodb' init function returned error. 140919 10:48:28 [error] plugin 'innodb' registration storage engine failed. 140919 10:48:28 [error] unknown/unsupported storage engine: innodb 140919 10:48:28 [e

c++ - CMake not detecting CXX but detecting CPP files -

i'm trying learn cmake http://www.cmake.org/cmake/help/cmake_tutorial.html , running trouble first step of running simple file tutorial.cpp. the issue when have command in cmakelists.txt file add_executable(tutorial tutorial.cpp) it builds fine. however, when change to add_executable(tutorial tutorial.cxx) it gives following error -- configuring done cmake error @ src/cmakelists.txt:6 (add_executable): cannot find source file: tutorial.cxx tried extensions .c .c .c++ .cc .cpp .cxx .m .m .mm .h .hh .h++ .hm .hpp .hxx .in .txx -- build files have been written to: /home/vaisagh/workspace/test/build my directory structure this: . ├── build ├── cmakelists.txt └── src ├── cmakelists.txt └── tutorial.cpp 2 directories, 3 files cmakelists.txt #specify version being used aswell language cmake_minimum_required(version 2.8.11) #name project here project(tutorial) add_subdirectory(src) src/cmakelists.txt #specify version being used aswell l

java - MDB with spring beans doesn't autowire beans from another package -

i using following mdb connect wmq: @messagedriven(name = "eventlistener", activationconfig = { @activationconfigproperty(propertyname = "destinationtype", propertyvalue = "javax.jms.queue"), @activationconfigproperty(propertyname = "destination", propertyvalue = "abc"), @activationconfigproperty(propertyname = "hostname", propertyvalue = "abc"), @activationconfigproperty(propertyname = "port", propertyvalue = "abc"), @activationconfigproperty(propertyname = "channel", propertyvalue = "abc"), @activationconfigproperty(propertyname = "queuemanager", propertyvalue = "abc"), @activationconfigproperty(propertyname = "sslciphersuite", propertyvalue = "abc"), @activationconfigproperty(propertyname = "transporttype", propertyvalue = "client") }) @resourceadapter(value = "wmq.jmsra.rar")

wcf - DataContract Serialization gives "Index was outside the bounds of the array" exception ..C# -

i tried serialize large tree data structure in c# using datacontract serializer. got cyclic reference exception. marked [datacontract(isreference = true)] instead of [datacontract] against classes wherever required. "index outside bounds of array" exception. code follows: public void serialize(object obj, string file, type t) { using (filestream stream1 = new filestream(file, filemode.create)) { stream1.position = 0; datacontractserializer s = new datacontractserializer(t); s.writeobject(stream1, obj); } } the above code works other serializations . in case of serializing tree object, not work. have marked [datacontract(isreference = true)] against required classes , [datamember] against required attributes.please help i want suggest mark inherited classes datacontract(isreference = true) attribute. said done this. so, check again marks, , ensure of inherited classes marked. if in

inline - How not to repeat a statement that is repeating in my method in C#? -

i hate repeat line @ below function: public void print() { verticalposition += bodyfontheight; printdata(something); verticalposition += bodyfontheight; printdata(something else); verticalposition += bodyfontheight; printdata(something else else); } i thought write inline function in c/c++ , first attempt func delegate. but unfortunately func not allow using ref or out parameters. any ideas should done in case ? you can put things in collection want things = {something,something else, else else}; and then, loop on public void print() { foreach (thing in things){ verticalposition += bodyfontheight; printdata(thing); } }

Unable to run oracle forms with database 10.2.0.1 -

i have oracle forms , report 11gr2 (11.1.2.2) , oracle database - 10.2.0.1 , weblogic server - 10.3.5 , working on window-7 32 bit . i have try create form,i have create data block specific table.in case able run form without trigger,cursor or procedure displaying records work fine. but when try form search records table gets error. in form have drag , drop button , write trigger ( when-button-pressed ) on button.i have write select query on trigger , while compiling error - sql statement ignore . i not understand why error. please body me.

objective c - Attribute Unavailable Auto-enable Return Key prior ot iOS 7.0 -

hello guys working on upgrading application ios 8 compatible , found warning on xib file on uisearchbar i.e. attribut unavailable auto-enable return key prior ios 7.0. can 1 have idea why warning comes. and 1 more thing on screen time keyboard not shown when click on search bar. due warning? thanks i had , got rid of updating ios deployment target 7.0 of targets. had 1 target still on 6.0 had totally forgotten about.

android - Implementing conn.setPassword -

we developing multiple platform mobile application using xamarin . want protect database (sqlite) @ least password gain access it. we're not concerned our windows phone platform storage protected application has access it, android platform can lifted device , we'll developing iphone version soon. we use xamarin integrates .net , allows share business logic across platforms requires ui written separately each platform. as of present, september 2014, best way password protect database. recommended approach? update: currently xamarin points using 1 of these 2 methods: http://developer.xamarin.com/recipes/ios/data/sqlite/ we use sqlite.net, far can tell, neither allow me user method: conn.setpassword() is limitation in android version of sqlite or access layer not exposing functionality? update 2: seems ado.net version allow set password functionality. thanks. you can use sqlite encryption extension or sqlcipher here , here respectivel

css - Why nav-title-slide-ios7 doesn't works with align-title="left"? -

i have animation issue when use nav-title-slide-ios7 class align-tittle="left" . when center aligned works ok, when left aligned flashes when making animation. http://codepen.io/asdasd3333/pen/ixgpn <ion-nav-bar class="nav-title-slide-ios7 bar-positive" align-title="left"> <ion-nav-back-button class="button-icon ion-arrow-left-c"> </ion-nav-back-button> </ion-nav-bar> try after removing text-align:center style form .bar .title { position: absolute; top: 0; right: 0; left: 0; z-index: 0; overflow: hidden; margin: 0 10px; min-width: 30px; height: 43px; /* text-align: center; */ /** remove **/ text-overflow: ellipsis; white-space: nowrap; font-size: 17px; line-height: 44px; } because styles flows top bottom work fine edit here link of codepen http://codepen.io/anon/pen/gkuld

c# - asp.net mvc 5 sometimes forms authentication redirects to account/login instead of account/logon -

i using asp.net mvc 5.1.1 , facing weird issue. whenever deploy web app test server( having iis 8.5) current sessions become expired(which obvious) , redirects account/login instead of account/logon. normal log off or fresh page hit correctly takes user account/logon(and have set in configuration). after session expiration, shows weird behavior. checked , there no reference webmatrix.dll. this issue has not helped. please advice whats wrong. thanks edit 1: <authentication mode="forms"> <forms loginurl="~/account/logon" timeout="2880" /> </authentication> i had same issue, should check startupauth.cs this answer helped me lot: http://coding.abel.nu/2014/11/using-owin-external-login-without-asp-net-identity/ also add of entry helped: https://stackoverflow.com/a/6081661/79379 for future reference include relevant code here: <add key="loginurl" value="~/account/logon" /> public partial

android - FragmentTabHost return null when I get the tag of the tab -

here how create tabhost, tab when user click on tab. problem , return null instead of tag value. tabhost = (fragmenttabhost) findviewbyid(android.r.id.tabhost); tabhost.setup(this, getsupportfragmentmanager(), r.id.realtabcontent); tabhost.addtab( tabhost.newtabspec("home").setindicator("", getresources().getdrawable(r.drawable.meun_home)), homefragment.class, null); tabhost.addtab( tabhost.newtabspec("form").setindicator("", getresources().getdrawable(r.drawable.meun_register)), formfragment.class, null); tabhost.addtab( tabhost.newtabspec("calculator").setindicator("", getresources().getdrawable(r.drawable.meun_calculator)), calculatorfragment.class, null); tabhost.addtab( tabhost.newtabspec("news").setindicator("",

How to move files in Google Cloud Storage from one bucket to another bucket by Python -

are there api function allow move files in google cloud storage 1 bucket in bucket? the scenario want python move read files in bucket b bucket. knew gsutil not sure python can support or not. thanks. using google-api-python-client , there example on storage.objects.copy page. after copy, can delete source storage.objects.delete . destination_object_resource = {} req = client.objects().copy( sourcebucket=bucket1, sourceobject=old_object, destinationbucket=bucket2, destinationobject=new_object, body=destination_object_resource) resp = req.execute() print json.dumps(resp, indent=2) client.objects().delete( bucket=bucket1, object=old_object).execute()

spring - Relation table1_table2 does not exist Postgres -

i working using spring-mvc , hibernate. have 2 tables in database, table1 , table2. table1 has onetomany relationship table2. when run application query delete row table1 , children table2, error saying, relation table1_table2 not exist. code : @table(name="table1") class user{ @onetomany public set<accounts> accounts; //remove method query query = session.createquery("from user u left join fetch u.accounts u.id="+id) //then use loop go through accoutns , remove accounts. } @table(name="table2") class accounts{ @manytoone public user user; } @onetomany is unidirectional relationship can using jpa only. need replace following line onetomany. @onetomany(mappedby="user",cascade = cascadetype.all, orphanremoval = true)

json - Make dynamic name text field in Postman -

i'm using postman make rest api calls server. want make name field dynamic can run request unique name every time. { "location": { "name": "testuser2", // should unique, eg. testuser3, testuser4, etc "branding_domain_id": "52f9f8e2-72b7-0029-2dfa-84729e59dfee", "parent_id": "52f9f8e2-731f-b2e1-2dfa-e901218d03d9" } } in postman want use dynamic variables . the json post this: { "location": { "name": "{{$guid}}", "branding_domain_id": "52f9f8e2-72b7-0029-2dfa-84729e59dfee", "parent_id": "52f9f8e2-731f-b2e1-2dfa-e901218d03d9" } } note give guid (you have option use ints or timestamps) , i'm not aware of way inject strings (say, test file or data generation utility).

Find matching phrases and words in a string python -

using python, efficient way 1 extract common phrases or words given string? for example, string1="once upon time there large giant called jack" string2="a long time ago brave young man called jack" would return: ["a","time","there","was very","called jack"] how 1 go in doing efficiently (in case need on thousands of 1000 word documents)? you can split each string, intersect set s. string1="once upon time there large giant called jack" string2="a long time ago brave young man called jack" set(string1.split()).intersection(set(string2.split())) result set(['a', 'very', 'jack', 'time', 'was', 'called']) note matches individual words. have more specific on consider "phrase". longest consecutive matching substring? more complicated.

c# - Linq 2 SQL Convert to Outer Join -

i have linq sql query features several joins. want convert 1 of them outer join. problem query has clause. how can convert query use left join on ordercertification table instead of inner join? the following query did not work (caused app crash): var ordersummaries = os in dborder.queryordersummaries().where(os => orders.contains(os.orderid)) join o in dc.orders on os.orderid equals o.orderid join oa in dc.orderaddresses on os.orderid equals oa.orderid join d in dc.vdoctors on o.doctorid equals d.doctorid join c in dc.ordercertifications on os.orderid equals c.orderid oc certification in oc.defaultifempty() select new batchorderitem { ordersummary = os, order = o, shipto = oa, prescriber = d, certificationcontact = certification }; the trick using defaultifempty return rows first table. check out example: http://msdn.microsoft.com/en-us/library/bb397895.aspx

java - itext pdf doesn't show table when setHeaderRows -

i created table n columns header using setheaderrows(n), when add table n-1 records , deploy, nothing displayed, i.e. if create table has 5 columns header , add 4 records or less table, nothing displayed. sample code document document = new document(new rectangle(605, 784), 28, 28, 42, 28); pdfwriter writer = pdfwriter.getinstance(document, new fileoutputstream("/temp/tabla.pdf")); documento.open(); // create table pdfptable tabla = new pdfptable(5); tabla.setcomplete(false); tabla.setwidthpercentage(100); tabla.getdefaultcell().setbackgroundcolor(basecolor.white); tabla.setheaderrows(5); // add header rows for(int i=1; i<=5; i++) { celda = new pdfpcell(); paragraph encabezado = new paragraph("header "+i); celda.addelement(encabezado); celda.setgrayfill(0.8f); tabla.addcell(celda); } // add cells for(int k=0; k<19; k++) { celda = new pdfpcell(); paragraph contenido = new paragraph("cell "+

node.js - npm install fails with "Cannot find module 'glob'" -

here output on console: floydpink@mbp mean-app (master) $ npm install npm err! darwin 13.4.0 npm err! argv "node" "/usr/local/bin/npm" "install" npm err! node v0.10.32 npm err! npm v2.0.0 npm err! code module_not_found npm err! cannot find module 'glob' npm err! npm err! if need help, may report error at: npm err! <http://github.com/npm/npm/issues> npm err! please include following file support request: npm err! /users/floydpink/source/swara-server/mean-app/npm-debug.log floydpink@mbp mean-app (master) $ and npm-debug.log: 0 info worked if ends ok 1 verbose cli [ 'node', '/usr/local/bin/npm', 'install' ] 2 info using npm@2.0.0 3 info using node@v0.10.32 4 verbose node symlink /usr/local/bin/node 5 verbose stack error: cannot find module 'glob' 5 verbose stack @ function.module._resolvefilename (module.js:338:15) 5 verbose stack @ function.module._load (module.js:280:25) 5 verbose

java - Should I extend JPanel for custom class rendering in Swing? -

i have custom class representing spaceships rotate , fly around on screen. however, realized if want use swing, have render ships via paintcomponent(). this method going use rendering: public void render(graphics g){ affinetransform original = ((graphics2d) g).gettransform(); graphics2d g2d = (graphics2d) g; g2d.rotate(orientation, getgameposition().x, getgameposition().y); g2d.drawimage(spritedefault, position.x, position.y, null); g2d.settransform(original); } so in order use swing, should extend jpanel can override paintcomponent , put code inside method, or should jcomponent, or other way? i want make sure i'm on right track here...

c - How can I detect the file is forbidden when using open() in linux -

what open() return when try open file without permisson? when error occurs while using open function, file descriptor set -1. to find out specific error need check errno. (this have different values depending on error occurred) in case eaccess. this code, fd = open ("file.txt",o_rdonly); if (fd == -1) { if (errno == eacces) { printf ("permission denied \n"); } } hope helps!

web services - REST "POST" method with Lotus Script -

so got project send file via rest specific end point using lotus script ibm domino server. connected endpoint "post" option , selected required content type (text/csv) , i'm receiving response. the issue having can't send string through , don't know what's problem. other side has crappy admin doesn't understand of questions , info gave me url & content type. here code connect/select options: dim httpobject variant set httpobject = createobject("msxml2.serverxmlhttp.6.0") call httpobject.setoption( 2, 13056) call httpobject.open("post", myurl, false) call httpobject.setrequestheader("content-type", "text/csv") now send data other side have use this: call httpobject.send(mystring) yet doesn't work , gives me error line: parameter incorrect. however, , not sure if works since admin on other side doesn't know how check it, when try send pure text instead of string don't errors , seems cod

How can I upload file in liferay -

upload file in liferay can 1 me how can upload file in document , media folder using dlfileentry search didn't exact code. how can this. put file controller in jsp file. tries using following code uploadportletrequest uploadrequest = portalutil.getuploadportletrequest(actionrequest); string sourcefilename = uploadrequest.getfilename("filename"); system.out.println("file name " + sourcefilename); file file = uploadrequest.getfile("filename"); themedisplay themedisplay = (themedisplay) actionrequest.getattribute(webkeys.theme_display); system.out.println("user id " + themedisplay.getuserid() + ": " + themedisplay.getscopegroupid()); long folder_id = 0; long repositoryid = themedisplay.getscopegroupid(); long parentfolderid = dlfolderconstants.default_parent_folder_id; list<folder> lfolder = dlappserviceutil.getfolders(repositoryid, parentfolderid); (folder folder : lfolder) { system.out.println(lfolder); syst

for loop - Java returning int from ArrayList<Integer> method -

i've created simple method receives arraylist<integer> , , returns average number double . the code: public static arraylist<integer> tempgsnitt(arraylist<integer> temperatur){ double sum = 0; for(int = 1; < temperatur.size(); i++) sum += temperatur.get(i); sum = sum/temperatur.size(); return sum; } but i'm getting error method expects arraylist return. question is; how can return double arraylist method? your return type arraylist, change double. public static double tempgsnitt(arraylist<integer> temperatur){ double sum = 0; for(int = 1; < temperatur.size(); i++) sum += temperatur.get(i); sum = sum/temperatur.size(); return sum; }

sql server - SSIS, Change Tracking, and Snapshot Isolation -

i'm using sql server 2008 r2 change tracking (not change data capture) , ssis extract incremental changes several source databases. until now, i'd been using restored backups didn't need worry snapshot isolation. however, need point these packages @ production databases. i know setting snapshot isolation level on tracked databases recommended ensure consistency of etl extracts. i'm reluctant because of possible degradation in performance. since i'm extracting late @ night, there reason can't use following process? create database snapshot temporary use. get change tracking current version of production database. compare previous successful run version. extract database snapshot instead of production database. after successful load, drop database snapshot. we're using 2008 r2 enterprise edition. there downside this? missing something?

Dependency injection and unit test -

it wonderful when domain class want test depends upon stateless objects, can use dependency inject tricks can test function on class. if objects upon domain class depends stateful? can still employ dependency inject technique in case? mean "stateful object" object state initialized through constructor. can still use di container initialization?

css transforms - css blur filter on image with translate3d causing blurred edges -

i'm trying achieve blurred image effect css , works fine without -webkit-transform: translate3d(0,0,0); performance horrible, need included. transform, edges of container giving me unwanted blurred edge. there way around this? i using chrome 37. seems fine in safari 7. not supported in ff32. here fiddle

sql server - Match SQL Tables and find if entry exist in each group -

thanks response if scenario extended add third group_id 2 groupnames picks . please me in writing query match 2 tables , find group id in entries of second table match. table 1 group_id groupnames groupvalues 111 g1 111 g1 b 111 g1 c 111 g2 d 111 g2 e 111 g2 f 111 g3 g 222 g1 222 g1 b 222 g1 c 222 g2 e 222 g2 f 222 g3 g 333 g3 g 333 g1 b 333 g1 c table 2: groupvalues b d g h output 111 the output of query should "111" since has atleast 1 entry 3 group names "g1,g2,g3" . "222" missing entry group name g2 not returned. please

android - rotating a matrix in one direction -

is there way make image matrix rotates in 1 direction ie: anti-clock wise ? this rotate function void rotate(int x, int y) { this.matrix.postrotate((float) (this.startangle - this.currentangle), x, y); } and ma ontouch event case motionevent.action_move: ring_gear.setcurrentangle((float) ring_gear.getangle( event.getx(), event.gety())); ring_gear.rotate(ring_gear.width / 2, ring_gear.height / 2); ring.setimagematrix(ring_gear.matrix); ring_gear.startangle = ring_gear.currentangle; you're doing postrotate. concats previous rotation current, adding angle rotation on every move event. if understood you're trying correctly (move ring position of finger), need set rotation of ring, not add it. replace line: this.matrix.postrotate((float) (this.startangle - this.currentangle), x, y); to this: this.matrix.setrotation((float) (this.currentangle), x, y);

scanf - Scanset doesn't recognize carriage return in c, why? -

i trying take input carriage return press scanset, enter button press.( on windows equals \r\n , right? ). works if write %[^\n]s inside scanf() , not %[^\r]s understanding should work. catch here? #include <stdio.h> int main() { char str[120]; scanf("%[^\r]s", str); printf("%s",str); } you reading standard input. standard input text input stream. in text input streams end of line indicated \n character regardless of whether happens "on windows" or not. purpose of text input stream, among other things, make sure time input data gets scanf , data translated platform-independent form regard line endings @ least. "on windows" \r\n combination replaced lone \n time gets scanf . can't see \r\n reading standard windows input scanf (that unless reading windows text file using unix input stream).

asp.net - How to host a Website locally using iis to be accessed by other computers on same network? -

i have asp.net website , have hosted locally using iis. http:localhost:3314 i have tplink router ip 192.168.0.101 . when used ipconfig show ip address of device 192.168.0.101 , default gateway 192.168.0.1 . this laptop , connected via wifi. website locally hosted on laptop. then connect mobile via wifi show ip adress 192.168.0.101 mobile. my question how access website mobile or other computers. the devices cannot have same ip due conflicts! maybe dhcp enabled , have disable option.otherwise if device has example ip 192.168.1.56 site accessible via http://192.168.1.56 .if doesn't work, there chance there firewall running on computer, or httpd.conf listening on 127.0.0.1

r - ROC curve error in randomForest -

i trying create roc curve off below. error states error in prediction(bc_rf_predict_prob, bc_test$class) : number of cross-validation runs must equal predictions , labels. library(mlbench) #has breast cancer dataset in library(caret) data(breastcancer) #two class model bc_changed<-breastcancer[2:11] #removes variables not used #create train , test/holdout samples (works fine) set.seed(59) bc_rand <- bc_changed[order(runif(699)), ] #699 observations bc_rand <- sample(1:699, 499) bc_train <- bc_changed[ bc_rand,] bc_test <- bc_changed[-bc_rand,] #random forest decision tree (works fine) library(caret) library(randomforest) set.seed(59) bc_rf <- randomforest(class ~.,data=bc_train, ntree=500,na.action = na.omit, importance=true) #roc library(rocr) actual <- bc_test$class bc_rf_predict_prob<-predict(bc_rf, type="prob", bc_test) bc.pred = prediction(bc_rf_predict_prob,bc_test$class) #not work- error error-error in prediction(bc_rf_predi

Branching with Django Form Wizard -

is there way in django branch different existing formwizard option select on previous page? like example have 2 formwizard called pizzaform , sandwichform . first page ask if want pizza or sandwich , option select calls form wizard depending select. you can in view of first form. somethings this: from django.shortcuts import render_to_response def firts_page_view(request): if request.post.get('pizza', none): form = pizzaform() template_name = 'pizza_template.html' else:#sandwich form = sandwichform() template_name = 'sandwich_template.html' return render_to_response( 'sandwich.html', {'form': form} )