Posts

Showing posts from May, 2010

ruby on rails - ActiveRecord Relation size strange behavior -

i have encountered strange behavior of activerecord relation recently. suppose, have stat model following properies: clicks views created_at and others further suppose have following scope: scope :aggregated, select('sum(clicks) clicks, sum(views) views).group('date(created_at)') as result expect array of stat object info aggregated day, , is. consider this: # in 1 place = stat.aggregated #in other place if a.size > 0 'do stuff' else 'do other stuff' end and it works fine if a relation is loaded , when a not loaded fails method undefined error. turns out when relation not loaded size calls count on relation, changes query, returns hash, , brakes code. is implied behavior? for me kind of counter-intuitive change method semantics depending on whether relation loaded or not. that's how activerecord relation works. can convert array , size on it. a = stat.aggregated.to_a #in other place if a.size > ...

java - ImageIcon exception -

im new java, , while running on eclipse linux mint java-7-openjdk (i think , although dont know if eclipse has own sun jdt), public class gui extends jframe{ private jcombobox box; private jlabel picture; private static string[] filename = {"b.png","x.png"}; private icon[] pics = {new imageicon(getclass().getresource(filename[0])), new imageicon(getclass().getresource(filename[1]))}; exception in thread "main" java.lang.nullpointerexception @ javax.swing.imageicon.<init>(imageicon.java:205) @ bucky.gui.<init>(gui.java:10) @ bucky.apples.main(apples.java:12) i cant see problem (linux mint 15 cinnamon) this exception thrown in imageicon constructor , states getclass().getresource(filename[0]) or getclass().getresource(filename[1]) null the path specified isn't correct. make sure folder these images in classpath an easy check can made: file f = new file("b.png"); system.out.println(f.exists()); sh...

c# - Get Repeater Label in the current "row" being accessed -

i have following repeater: <asp:repeater id="rptleaverequests" runat="server" onitemdatabound="rptleaverequests_itemdatabound"> <itemtemplate> <table id="tableitem" runat="server"> <tr> <td style="width: 100px;"> <asp:label id="lbldate" runat="server" text='<%#eval("date", "{0:dd/m/yyyy}") %>'></asp:label> </td> <td style="width: 100px;"> <asp:label id="lblhours" runat="server" text='<%#eval("hours") %>'></asp:label> </td> <td style="width: 200px;"> <asp:label id="lblperiod" runat="server" text='<%#eval("amorpm") %>'></asp:label> </td> ...

php - Globally disable all MySQL writes -

i using php's pdo mysql create web application. wish put web application in "demo" mode. means writes (updates, inserts, deletes) disabled, , applicable continues out errors. arguments sake, application in demo mode if $_session['demo_mode']=1. without putting conditionals around each write statement, how can done. $dbh->exec("insert t1(c1, c2) values ('v1', 'v2')"); $dbh->lastinsertid(); $q=$dbh->query("select c1 t2 c2=123"); $v=$q->fetchcolumn(); you can modify rights of user application connects as, gets select and similar rights. here comprehensive list of individual rights can grant user. example (to adapted need, of course): revoke privileges on yourdatabase.* 'application_user'@'host'; grant select on yourdatabase.* 'application_user'@'host'; obviously, produce errors when application tries write anything. app should prepared fail graciously if planni...

SQL Server filtered index - can anyone explain this error I am seeing? -

okay, have table filtered index. here script create table, add data , add index: create table supplier ( supplierid int not null, supplierlinkid int null, suppliername varchar(50)); insert supplier values (1, 2, 'test supplier 1'); insert supplier values (2, null, 'test supplier 2'); insert supplier values (3, null, 'test supplier 3'); create unique nonclustered index uq$supplier$supplierlinkid on supplier (supplierlinkid) supplierlinkid not null; then decide want add new column, supplier code, table , maintainability reasons don't want @ end of table. can't use: alter table supplier add suppliercode varchar(50); instead go table designer, highligh supplierlinkid column , right-click, insert column , enter details: column name = suppliercode; data type = varchar(50); allow nulls = when click save error: 'supplier' table - unable create index 'uq$supplier$supplierlinkid'. create unique index stateme...

iphone - Identifying an UIImageView without tag -

i have generic generated imageviews in scrollview each of these images have 2 gesturerecognizer single/double tapping on imageview. problem how identify whether imageview tapped first or second time. in scenarios it's easy use tag of imageview, have 2 different gesturerecognizer on each imageview , every gesturerecognizer uses different identification method based on tag number, identify image. here generate imageviews dynamically: -(void) initlevels{ _level = [level alloc]; _unit = [unit alloc]; self->_units = [[nsmutablearray alloc] init]; _keys = [[nsmutablearray alloc] init] ; int x = 0; int y = 0; int = 0; (nsobject *object in self->_levels) { if ([object iskindofclass:_level.class] && != 0) { x = x + margin_right + object_width; y = 0; } else if ([object iskindofclass:_unit.class]){ _unit = (unit *) object; [self->_units addobject:_unit.description]; uiimageview *imageview = [[uiimageview alloc]...

Git push new local branch to remote, without having to specify name -

when working on patch fixes specific, tracked issue, our workflow looks like: 1. git checkout patch; git pull upstream patch; # make sure we're up-to-date 2. git checkout -b issue-435-db-integrity-exception 3. # code awesome 4. git commit -am "fixes issue #435" 5. git push -u origin issue-435-db-integrity-exception then open pull request origin/435 upstream/patch , code review can take place on github/bitbucket. start on step #1. but , though may sound bit whiny, great if didn't have explicitly name remote branch want create: git push -u origin issue-435-db-integrity-exception it's not lot of fun type branch name on again, , disagree changing 435 or more compact. is there way (1) force git push current branch named branch, creating if necessary without explicitly naming it? not globally , on-the-spot kind of flag. or, possible (2) access current branch in git alias, , write like: [alias] pnew = push -u origin $(git symbolic-ref --short ...

java - Regular expression for lines starts with capital letter word -

i have below lines of text in text file, james working in london program developed in java program working i want lines have starting word capital letter james working in london program working thanks for english language, can use this ^[a-z].* the ^ start of line. , [a-z] means capital letter.

Dotcover report (nunit) not covering all classes in assembly. -

dotcover report (nunit) not covering classes in assembly. when see report generated dotcover using nunit-console.exe (2.4.1), find couple of classes assembly not all. i don’t use nunit dotcover, there common things. did check dotcover config file? probably, there filters there. more info here: http://www.jetbrains.com/dotcover/webhelp/dotcover__introducing_console_runner.html

ssh keys - ssh still asking for password -

i have 2 servers called: "eps" , "dev". on server dev have added public key of eps authorized_keys file. have restarted ssh service on dev server ensure picks new public key added authorized_keys file. however when try , ssh "dev" "eps", i'm prompted passphrase key. exact prompt is: enter passphrase key '/home/webmaster/.ssh/id_rsa': why happening? thought should log me dev server right away. when creating ssh key using ssh-keygen prompted password secure private key. therefore ssh use key password has entered unlock private key locally, why seeing "enter passphrase key". not same password authenticate user on ssh server. in order have password-less login need create keyfile ssh-keygen has empty password.

How to get Windows 8 Surface (Tablet) Unique ID -

how windows surface unique device id?. i tried below api device id changing based on bluetooth settings: hardwareidentification.getpackagespecifictoken(nonce) as answered here, windows.system.profile.hardwareidentification.getpackagespecifictoken(null).id converted string work id. not sure if best practice, works nonetheless.

Sending mail via Java API: How to send the mail even if attachment fails? -

this code: try { mimemessage message = new mimemessage(session); message.setfrom(new internetaddress(from)); message.addrecipient(message.recipienttype.to, new internetaddress(to)); message.setsubject(messagesubject); message.settext(messagebody); bodypart messagebodypart1 = new mimebodypart(); messagebodypart1.settext(messagebody); mimebodypart messagebodypart2 = new mimebodypart(); string filename = attachment; datasource source = new filedatasource(filename); messagebodypart2.setdatahandler(new datahandler(source)); messagebodypart2.setfilename(filename); multipart multipart = new mimemultipart(); multipart.addbodypart(messagebodypart1); multipart.addbodypart(messagebodypart2); message.setcontent(multipart ); transport.send(message); } catch (messagingexception mex) { mex.printstacktrace(); } how can still send email if mail attachment fails reason? atm if attachment fails, email not sent, bad in c...

java - Why is there no BigDecimal.setPrecision() method? -

why there bigdecimal.setscale() method sets decimals value , no mathcontext.setscale() method constructor mathcontext(precision) or other way around why there no bigdecimal.setprecision() method? edit: there no method mathcontext.setprecision() , constructor mathcontext(precision) . edited text. sorry that. edit2: wanted understand why there 2 ways of approaching scale / precision setting. seems there no real reason have 2 of them regarding answer of richard sitze. see example makes clear can have strange results playign precision , scale: mathcontext mc = new mathcontext(2); bigdecimal test = new bigdecimal("100.234", mc); system.out.println("scale: " + test.scale() + ", value: " + test); test.setscale(6); system.out.println("scale: " + test.scale() + ", value: " + test); test = test.add(new bigdecimal("100")); system.out.println("scale: " + test.scale() + ", value: " + test); results in:...

Facebook API pending requests -

i know have been asked several times, , have read several posts in here, somehow doesn't work me. when gave myself permissions , not 'read_requests'. i have been trying fql try { $me = $facebook->api('/me'); $currentpage=1; $currentpost=1; $currentdate=""; $list=""; $arrdate=array(); $fql = "select uid_from friend_request uid_to = me()"; $param = array( 'method' => 'fql.query', 'query' => $fql, 'callback' => '' ); $fqlresult = $facebook->api($param); var_dump($fqlresult); foreach($fqlresult $row){ var_dump($row); } } catch (facebookapiexception $e) { echo 'error: <pre>'; var_dump($e); } and in graph explorer following line my_id?fields=friendrequests.fields(created_time),name but graph explorer says don't have permission, when gave myself full permission. can doing wrong?

How to translate Oracle package to SQL Server? -

in oracle have lots of stored procedures using package stores (encapsulates) , initializes variables used these procedures. there 1 function in package takes care of initializing it's package variables. my question is: how port sql server? my first attempt declare package variables , use them output parameters procedure initialize them, need declare these variables on , on again in each procedure using them (and there lots of them in package). there better (and dry) way on sql server? some code explain it: oracle : the package: create or replace package myparams /** param container */ type rc_params record ( var1 varchar2(30), var2 integer ); /** init param container use: v_params rc_pkp_plan_params := myparams.f_get_params(initvar) */ function f_get_params(initvar number) return rc_params; end myparams; / the package body: create or replace package body myparams function f_get_params(initvar number) return rc_params ret...

android - How to show google map v2 in Fragment? -

i have frame layout, show fragments, how can show google map frame_layout. make next: get api key add google play services library nullpointerexeption, maybe knows examples how use it? car_waches.xml fragment class: public class fragmentcarwashes extends sherlockfragment { view v; @override public view oncreateview(layoutinflater inflater, viewgroup container, bundle savedinstancestate) { googlemap map = ((supportmapfragment) getfragmentmanager().findfragmentbyid(r.id.mapfragment)) .getmap(); v = inflater.inflate(r.layout.fragment_car_washes, null); return v; } } manifet file <?xml version="1.0" encoding="utf-8"?> <uses-sdk android:minsdkversion="10" android:targetsdkversion="17" /> <permission android:name="com.example.cars51ru.permition.maps_receive" android:protectionlevel="signature" /> <uses-permission android:name="com....

ios - Some startBrowsingForNearbyPlayersWithReachableHandler questions -

i'm trying local matchmaking working in gamekit using [[gkmatchmaker sharedmatchmaker] startbrowsingfornearbyplayerswithreachablehandler:] . essentially, i'm trying implement interface-less local matches: long there's player in local vicinity, want connect , start match. importantly, only want local players: never want match automatically on internet. i've enabled game center app in itunes connect , signed different sandbox account on every device i'm using test. i've tried both matchmaking gkmatchmakerviewcontroller (after authenticating local player) , programmatic matchmaking startbrowsingfornearbyplayerswithreachablehandler: , running same code on iphone 4 , 4th gen ipod touch sitting next each other on desk. neither ever finds other; when using gkmatchmakerviewcontroller interface finding nearby players remains @ finding players... spinner, , when using startbrowsingfornearbyplayerswithreachablehandler: , notification block never gets ca...

program in C launches correctly but printf doesnt show anything -

i run programm , console appears printf doesnt print anything, how can fix this? #include<stdio.h> main() { float fa; int cel; cel=0; while(cel<=200); { fa=9.000*(cel+32.000)/5.000; printf("%d\t%.3f\n",cel,fa); cel=cel+20; } } in addition have similar program runs correctly #include<stdio.h> main() { float celsius; int fahr; fahr = 0; while(fahr<=100){ celsius=5.0000*(fahr-32.0000)/9.0000; printf("%d\t%.4f\n",fahr,celsius); fahr=fahr+1; } } i ran both programs in c-free 5 infinite loop: while(cel<=200); because of trailing ; equivalent to: while(cel<=200) {} which means printf() never reached , cel never modified. remove ; correct.

java - Using Ant condition tag -

i want this <target name="init" description="create build directories. > <mkdir dir="bin" /> <mkdir dir="dist" /> <!-- check presence of dependent jars --> <condition property="dependent.files.available"> <and> <available file="../../xx.jar" /> <available file="../../yy.jar" /> </and> </condition> </target> <!--- compile --> <target name="compile" depends="init" description="compile java sources , create classes"> <if> <isset property="dependent.files.available"/> <then> <javac srcdir="src" destdir="bin" classpathref="ext_jar_classpath"/> </then> <else> ...

Writing whole alphabet in Vim -

i need write whole alphabet abcd…z , hate typing letter letter in vim's insert mode. there exist method more efficiently? i know ga command gives me ascii code of character cursor … don't know how mix standard solution type numbers 1 (for example) 5000: a1escqqyyp^aq4998@q … using set nrformats+=alpha : ia<esc>qqylp<c-a>q24@q step step: ia<esc> " start 'a' qqylp<c-a>q " @q duplicate last character , increment 24@q " append c..z

iphone - Load UIViewController on another UIViewController in UIStoryboard from xib -

i have uiviewcontroller(say a). separate nib file loaded popup on view controller. when popup closed clicking uibutton, want load view controller(say b) in uistoryboard. uiviewcontrollers in storyboard. i tried delegates pattern. delegate method returns self.storyboard nil . please suggest how handle (either performsegue b or pushing new instance of b on navigation controller nib file) here code used delegate: **in customviewnewprescription.h file:** @class customviewnewprescription; @protocol customviewnewprescriptiondelegate <nsobject> -(void)savecustomviewnewprescription; @end @interface customviewnewprescription : uiview{ id<customviewnewprescriptiondelegate>delegate; } @property(nonatomic,strong) id<customviewnewprescriptiondelegate>delegate; **in .m:** - (ibaction)btncancel:(uibutton *)sender{ [self.delegate savecustomviewnewprescription]; } delegate synthesized , initialised. **in addne...

memory - java loitering and garbage collection -

i have bit of code stack's pop method , i'm trying figure out how avoids loitering while still returning element our index pointing to: public string pop() { // remove item top of stack. string item = a[--n]; a[n] = null; // avoid loitering (see text). if (n > 0 && n == a.length/4) resize(a.length/2); return item; } from can understand pointing reference item of our string object indexed element(we start last element using it's current size n-1 hence decrements) of our array a. if returning reference why setting indexed element our reference pointing null before doing so? doesnt make item point nothing , return nothing? an object can't garbage collected long reachable. if change index --n not nullify a[n] , keep reference object, preventing garbage collection if client code not reference object longer. that 1 of cases need nullify variable in java. you seem misunderstand references are. a[n] contains value points object in memory. when ...

java - Processing a String with ANTLR4 -

i'm trying convert grammar v3 v4 , having trouble finding right pieces. in v3 process string, used: public static dataextractor create(string dataspec) { charstream stream = new antlrstringstream(dataspec); dataspecificationlexer lexer = new dataspecificationlexer(stream); commontokenstream tokens = new commontokenstream(lexer); dataspecificationparser parser = new dataspecificationparser(tokens); return parser.dataspec(); } how change work in v4? the changes made are: antlrstringstream has been replaced constructor in antlrinputstream takes string parser rules return context object has public field named according returns clause of rule. so if dataspec rule says " returns [dataextractor extractor] ", v4 method becomes: public static dataextractor create(string dataspec) { charstream stream = new antlrinputstream(dataspec); dataspecificationlexer lexer = new dataspecificationlexer(stream); commontokenstream ...

c# - How would I do this the best way? -

i got viewmodel following attributes: int balance int withdrawamount a view of mine in asp.net mvc4 application lets user withdraw money balance. when page accessed through request users balance , pass view through withdrawviewmodel displaying user - in model withdrawamount since user haven't specified amount withdraw yet. the user enters desired amount withdraw , submits post request sending withdraw amount. now bind withdrawamount withdrawviewmodel again in order automatically check if modelstate valid (is amount above 0). finally withdraw amount etc. the thing wanna know if there's better way accomplish this? me seems foolish use same viewmodel when values differ (either balance in model or withdrawamount in model) - virtually making them 2 different models. can in better way? if need withdrawamount, have controller action method take int parameter. [httppost] [authorize] public viewresult mymethod(int withdrawamount){ ... }

Haskell Snap Framework - Dynamic hyperlinks with Heist -

i trying create dynamic links using heist templating system. problem links appearing text rather being interpreted html. there specific method create dyamic lists heist? the function link constructed: rendercategories :: monad m => db.category -> i.splice m rendercategories (db.category catid catname catdesc) = i.runchildrenwithtext [ ("categoryid", t.concat $ ["<a href='http://localhost:8000/thread_home?cateid=", t.pack . show $ catid, "'>", t.pack . show $ catid, "</a>"]) , ("categoryname", catname) , ("categorydesc", catdesc)] the tag appears "http://localhost:8000/thread_home?cateid=1'>1" text on webpage. , source shows follows: &lt;a href='http://localhost:8000/thread_home?cateid=1'&gt;1&lt;/a&gt; i figure need have print actual < , > not sure how achieve this. running runchildrenwithtext populate heist template changing ...

postgresql - Sum(Case when) resulting in multiple rows of the selection -

i have huge table of customer orders , want run 1 query list orders month past 13 months 'user_id'. have (below) works instead of listing 1 row per user_id lists 1 row each order user_id has. ex: 1 user has 42 total orders on life lists user_id in 42 rows , each row has 1 payment. typically throw in pivot table in excel i'm on million row limit need right , have had 0 success. read out this: user_id | jul_12 | aug_12 | 123456 | 150.00 | 150.00 | not this: user_id | jul_12 | aug_12 | 123456 | 0.00 | 150.00 | 123456 | 150.00 | 0.00 | etc. 40 more rows select ui.user_id, sum(case when date_part('year', o.time_stamp) = 2012 , date_part('month', o.time_stamp) = 07 o.amount else 0 end) jul_12, sum(case when date_part('year', o.time_stamp) = 2012 , date_part('month', o.time_stamp) = 08 o.amount else 0 end) aug_12, orders o join users_info ui on ui.user_id = o.user_id user_id = '123456' group ui.user_id, o.time...

corona - attempt to index global 'physics' (a nil value) -

i'm new corona/lua , i'm can't find solution thing. i'm trying spawn object fall top down , should stop @ bottom of screen. i'll create touch event etc etc.. but problem recieve error: attempt index global 'physics' (a nil value) and objects ofc doesn't fall down. here code: ----------------------------------------------------------------------------------------- -- -- main.lua -- ----------------------------------------------------------------------------------------- local buttony = display.contentwidth * 0.02 local buttonwidth = display.contentwidth * 0.1 local buttonheight = display.contentwidth * 0.1 background = display.newimage("graphics/background.jpg") local localgroup = display.newgroup() local spawntable = {} function spawnlattina(params) local object = display.newimage(params.image, params.buttonx,50); object.objtable = params.objtable; object.index = #object.objtable+1; object.name = "object:...

javascript - How can I display own Events in Chrome dev tools -

Image
i measure application, performance sensitive. to know if there option in chrome dev tools or in else view it's provided in network tab, own, js triggered events in (like red / blue line). is there way so? the obvious solution use console. gives more tools simple console.log : formatting ( console.log("%cthis formatted large, blue text", "color: blue; font-size: x-large"); ) measuring time ( console.time("array initialize"); longrunningoperation(); console.timeend("array initialize"); ) grouping ( console.group("authenticating user '%s'", user); authentication(); console.groupend(); ) marking events on timeline ( console.timestamp("adding result"); ) this should more enough create readable log of custom events. see official docs more tips on using console.

javascript - Ember.js: Howto create routes that only execute code -

my app has main view hidden elements can activated user. typical sidebar on mobiles slides in left. or cart reveals details when tap on it. the information in hidden elements date since content mapped in main app template. routes not need render dom. the transitions js based. want states reflected in url, in order consistent button behavior. how can achieve using ember framework? update make more clear, talking about: to understanding triggering routes in ember has 2 side-effects: represent new state in url, enabling consistent browser history support. render templates manipulate dom based on data in case, when instance user taps on minimized cart need: represent new state in url, enabling consistent browser history support. execute showcart() js function (no dom changes, no template rendering) when user taps on browser button, closecart() should executed (based on fact state in url carries information cart open). you can use activate , deactiva...

jquery - TinyMCE 4 links plugin modal in not editable -

Image
i using tinymce4 editor inside boostrap modal dialog. when clicked on link icon opens new modal dialog box, displayed fine input areas not editable. <div id="editing" class="modal hide fade" tabindex="-1" role="dialog" aria-labelledby="mymodallabel" aria-hidden="true"> <form> <label> <span>description</span> <div id="description"></div> </label> <form> </div> <script> tinymce.init({ selector: 'div#description', inline: false, theme : "modern", schema: "html5", add_unload_trigger: false, statusbar: false, plugins: "link", toolbar: "link | undo redo", menubar: false }); </script> any suggestions thanks in advance from https://github.com/tinymce/tinymce/issues/782 for jquery ui dialogs can this: $.wid...

c - Can a int16_t to int conversation result in implementation-defined behavior? -

in section 7.18.1.1 paragraph 1 of c99 standard: the typedef name intn_t designates signed integer type width n , no padding bits, , two’s complement representation. according c99 standard, exact-width signed integer types required have two's complement representation. means, example, int8_t has minimum value of -128 opposed one's complement minimum value of -127 . section 6.2.6.2 paragraph 2 allows implementation decide whether interpret sign bit sign , magnitude , two's complement , or one's complement : if sign bit one, value shall modified in 1 of following ways: — corresponding value sign bit 0 negated ( sign , magnitude ); — sign bit has value -(2 n ) ( two’s complement ); — sign bit has value -(2 n - 1) ( ones’ complement ). the distinct between methods important because minimum value of integer in two's complement ( -128 ) can outside range of values representable in ones' complement ( -127 127 ). suppose i...

html5 - Commenting out HTML code on mobile devices -

this first question on stack overflow - please gentle. ;) i working on html5 website , have decided implement html5 video @ top of home page. i've got video working fine, html code relies on "autoplay" being enabled on video - "no go" on ios (and, assume, other mobile devices): <div class="bg1"> <div id="overlay"></div> <video autoplay loop class="fillwidth"> <source src="video/filename.mp4" type="video/mp4"/> <source src="video/filename.ogg" type="video/ogg"/> <source src="video/filename.webm" type="video/webm"/> <img src="/images/bg1.jpg" title="your browser not support <video> tag" /> </video> </div> notes: 1) "overlay" div contains transparent png sits above video (with transparent areas video shows through). 2) "fillwidth" cla...

bison - Flex lexer start condition not being recognized -

i have scanner maintains 2 exclusive states (word , defn) %option noyywrap %s word %s defn %% %{ begin(word); %} <word>{ "|" { begin(defn); return ws_pipe; } } <defn>{ [^;]+ { printf("ds: %s\n", yytext); return wd_string; } ";" { return wd_semicolon; } } \n|. { printf("u: %s\n", yytext); } %% but simple input "| text;", when pipe parsed state not being changed, parsing of "some text;" fails. the state being changed defn when | encountered in state word . however, next time yylex called (to token following pipe), state reset word block %{ begin(word); %} from flex manual (emphasis added): in rules section, indented or %{ %} enclosed text appearing before first rule may used declare variables local scanning routine , (after declarations) code executed whenever scanning routine entered . you're better off using initial start condition...

android - achartengine - different colors for different points and lines -

Image
i'm using achartengine visualize measurement values in line chart view. visualization works 1 important part missing , have no idea how implement it. each circle represents measurement value , color of each circle depends on value of measurement. know how change color of circle shown in image? thx , cheers, chris one suggestion create several series of data. each series responsible rendering points of given color.

python - Looping same program for different data files -

for following program, trying save time copying , pasting tons of code. program plot using data file 19_6.txt , aux.19_6, , continue plotting files 11,12,20,28,27, , 18 in 19's place same code , onto same plot. appreciated. thanks! from numpy import * import matplotlib.pyplot plt datasim19 = loadtxt("/home/19_6.txt") data19 = loadtxt("/home/aux.19_6") no1=1 no2=2 no3=3 no4=4 no5=5 no7=7 no8=8 no9=9 no10=10 simrecno1inds19 = nonzero(datasim19[:,1]==no1)[0] simrecno2inds19 = nonzero(datasim19[:,1]==no2)[0] simrecno3inds19 = nonzero(datasim19[:,1]==no3)[0] simrecno4inds19 = nonzero(datasim19[:,1]==no4)[0] simrecno5inds19 = nonzero(datasim19[:,1]==no5)[0] simrecno7inds19 = nonzero(datasim19[:,1]==no7)[0] simrecno8inds19 = nonzero(datasim19[:,1]==no8)[0] simrecno9inds19 = nonzero(datasim19[:,1]==no9)[0] simrecno10inds19 = nonzero(datasim19[:,1]==no10)[0] recno1inds19 = nonzero(data19[:,1]==no1)[0] recno2i...

c# - LinqToTwitter Error - The remote certificate is invalid according to the validation procedure -

i've found several different questions error, none of them seem outline scenario. i creating website pulls in tweets our company's twitter account, , displaying them on social wall. using c# asp.net webforms. c# code uses linqtotwitter library handle authentication , "tweet pulling." grabs tweets , dumps them onto aspx file big long string of json. have jquery script reads through json , displays tweets on page nice , pretty like. the code works perfect on dev box. when push code production .net error: the remote certificate invalid according validation procedure i'll provide code in bit here, first let me give little background. have no idea if information relevant or not, knows. website part of larger project fit several tiny 1 page microsites marketing onto 1 server reduce overhead cause. these microsites can have different host name, point same ip address. httpmodule lives on server, , intercepts requests coming in, , redirects them a...

How should I use Nuget for internal enterprise development? -

we use nuget our internal development allow share code across teams. run issues when 1 person working on code deployed across multiple nuget packages @ same time. instance a depends on b depends on c. a, b , c have artifacts pushed nuget , that's how manage dependencies between a, b , c. trouble find if developer wants make changes in c , see changes reflected in a, have go through following process. make change in c. push change git ci picks change c , builds , deploys new nuget package. go b , update reference c using nuget update package command. push change packages.config file git ci picks change b , builds , deploys new nuget package b now open , change reference b , nuget update package make changes in go along changes in b(and transitively c) this seems extremely painful , causing of our developers question choice of nuget our internally developed code. still consuming external packages. is there better workflow using nuget internally? in our...

asp.net mvc - How to include a large inline SVG in my View? -

i avoid cluttering view (.cshtml) svg-data. there way put in separate file , input file in view (like latex' \input{} )? does make sense use partial view? yes, highly suggest rendering partial views. easy way separate large amounts of html out if representative of data. might consider rendering partial view template if have model includes many occurrences of same data. just replace applicable html/data call @html.partial("viewname") or @html.partial("viewname", model) you'd clean clutter. see this discussion on efficiency of partial views vs. using model templates separate html out of view.

sql - How can I drop a table in a database if another table exists? -

i'm trying drop table in database if table exists. i made backup of table using query: alter table appprofile rename appprofile_backup now i'd restore backup table , delete appprofile via like: drop table appprofile if exists table appprofile_backup (alter table appprofile_backup rename appprofile) if not exists appprofile however, syntax errors both lines, near "if" token. for background problem, i'm using sqliteopenhelper class in android. can execute raw sql in environment making call [db_handler_instance].getwritabledatabase().execsql("random query"); what doing in java? can query data dictionary ... string sql = "select 1 " + " sqlite_master " + " type = 'table' " + " , name = 'appprofile_backup'"; cursor cursor = db.rawquery(sql, null); ... , drop table, if backup table existing: if (cursor.movetonext()) db.execsql(...

actionscript 3 - ByTeArray AS3 function from C# function help needed -

i noob bytearray use in as3 , need help. trying reproduce "header" function in as3 returning bytearray c# function (code provided bellow). can point me in right direction? i got point , not sure how continue: private function header():bytearray { var header:bytearray = new bytearray(); header.writeutfbytes("a"); header.writeutfbytes("b"); header.writeutfbytes("c"); header.writeutfbytes("d"); ... } thank you private enum packettype { pthelo = 0x01, ptbye = 0x02, ptbutton = 0x03, ptmouse = 0x04, } private const byte bv = 2; private const byte mv = 0; private byte[] header(packettype packettype, int numberofpackets, int currentpacket, int payloadsize) { var header = new byte[headersize]; header[0] = (byte)'a'; header[1] = (byte)'b'; header[2] = (byte)'c...

convert python list of list into dictionary -

i have list of lists in python need convert json dictionary. list follows: [ ['[{"name":"david","level":"k","xaxis":[[]],"yaxis":[[]],', '"count":[[2011, 6], [2012, 0], [2013, 11]]},'], ['{"name":"marshall","level":"n","xaxis":[[]],"yaxis":[[]],', '"count":[[2008, 130], [2009, 53], [2010, 10], [2011, 17], [2012, 0], [2013, 142]]}]'] ] what need is: { [ { "name": "david", "level": "k", "xaxis": [[]], "yaxis": [[]], "count":[[2011, 6], [2012, 0], [2013, 11]] }, { "name": "diana", "level": "k", "xaxis": [[]], "yaxis": [[]], "count":[[2011, 6], [2012, 0], [2013, 11]] } ] } so basically, dictionary containing sub...