Posts

Showing posts from August, 2010

plsql - Sequence and Trigger PL/SQL script for Automatic ID generation on a table -

can me fix code. doesn´t run on pl/sql (sqlplus @script.sql), giving sp2-0552: bind variable "new" not declared. script.sql prompt creating table systemdatalog; declare counter1 integer; counter2 integer; begin select count(*) counter1 all_tables table_name='systemdatalog' , owner='mzmesdb'; if counter1 = 1 drop table systemdatalog; end if; select count(*) counter2 all_sequences sequence name='seqsystemdatalog'; if counter2 = 1 drop sequence seqsystemdatalogid; endif; create table "mzmesdb"."systemdatalog" ( "id" integer not null , "datetime" date not null , "type" varchar2(64) not null, "severity" integer not null, "source" varchar2(64) not null, "user" varchar2(64) not null,...

android - Get instance of current visible activity -

how instance of visible activity in android? i've read can componentname of activity using activitymanager list of tasks , messing that, that's recipe disaster. is there way instance of topmost activity, or if activity isn't mine , can't access it, null? to instance of visible activity, context as: context mcontext = getapplicationcontext(); or mcontext = this; now use activity related tasks. or instance of activity; keep static activityclass instance somewhere else , use getter setter set instance like: public void setactivity(myactivity activity) { myactivity = activity; } public myactivity getmyactivity() { return myactivity; }

javascript - AJAX PHP Submission not working -

i'm trying execute php script updates mysql db on click of image. i'm using snippet found online so: function execute(filename,var1,var2) { var xmlhttp; if(window.xmlhttprequest) { //code ie7+, firefox, chrome, opera, safari xmlhttp = new xmlhttprequest(); } else if(window.activexobject) { //code ie6, ie5 xmlhttp = new activexobject("microsoft.xmlhttp"); } else { alert("your browser not support ajax!"); } var url = filename+"?"; var params = "id="+var1+"&complete="+var2; xmlhttp.open("post", url, true); xmlhttp.onreadystatechange=function() { if(xmlhttp.readystate==4) { //below line fill div id 'response' //with reply server. can use troubleshoot //document.getelementbyid('response').innerhtml=xmlhttp.responsetext; x...

not equal sign not working in javascript -

this question has answer here: ! operator in javascript 5 answers i using not equal sign convert false true giving false. have tried 0 , 1 working fine. when changing value "false" "true" working problem "false" only. <script type="text/javascript"> var test= "false"; alert(!test) </script> you assigning string "false" , assign boolean false var test = false; alert(!test);

android - Custom RatingBar doesn't work on Dialog -

Image
i have set custom ratingbar style inside style.xml code: <item name="android:ratingbarstyle">@style/ratingbarstyle</item> <style name="ratingbarstyle" parent="android:widget.ratingbar"> <item name="android:progressdrawable">@drawable/ratingbar</item> <item name="android:minheight">13dip</item> <item name="android:maxheight">13dip</item> </style> now have created custom layout dialog (xml) [is inside relativelayout]: <ratingbar android:id="@+id/custom_dialog_vota_ratingbar" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignleft="@+id/custom_dialog_vota_label_ratingbar" android:layout_below="@+id/custom_dialog_vota_label_ratingbar" android:layout_margintop="2dp" android:max="5" android:numstars="...

button - How to add soundButton(on&off) on a activity in android apps? -

i have created branch activity .now wanted add 2 button on branch activity. when click on 'sound on' button beep sound on start , when clicked on 'sound off' beep sound off. , hide simultaneously. thank's my code on activity @override protected void oncreate(bundle savedinstancestate) { // todo auto-generated method stub super.oncreate(savedinstancestate); setcontentview(r.layout.sound_layout); soundbttnon =(button) findviewbyid(r.id.soundbttnon); soundbttnon.setonclicklistener( new onclicklistener(){ @override public void onclick(view v) { startmediaplayer(); } } ); soundbttnoff =(button) findviewbyid(r.id.soundbttnoff); soundbttnoff.setonclicklistener( new onclicklistener(){ @override public void onclick(view v) { stopmediaplayer(); } } ...

c# - Entity Framework Code First - Cast smallint and integer to int32 -

im working on small service tool database. problem due last update, smallint-colums had be changed integer. public class test { public int id { get; set; } //public int16 id { get; set; } public string test { get; set; } } i changed type int16 int. works fine, except can't use old version of database anymore. exception "system.int32 expected, found typ system.int16". is there way cast smallint , integer int32? any ideas? environment: entityframework 5.0.0 .net 4.5 firebirdclient 3.0.2.0 i tried force cast in modelbuilder: modelbuilder.entity<test>() .property(p => p.id) .hascolumntype("smallint"); exception: error 2019: member mapping specified not valid. type 'edm.int32[nullable=false,defaultvalue=]' of member 'id' in typ 'contextrepository.test' not compatible 'firebirdclient.smallint[nullable=false,defaultvalue=,storegeneratedpattern=identity]' of member '...

mysql - Update multiple rows from results from a SELECT query to the same table -

i'm trying figure out how combine these 2 queries. select `o`.`order_id` `orders` `o` join `customerdetails` `cd` on `cd`.`customer_id` = `o`.`customer_id` `o`.`orderplaceservertime` >= '2013-06-01 00:00:00' , `o`.`orderplaceservertime` <= '2013-06-31 23:59:59' , `cd`.`salesrep_id` = 6 this gives me list of order_id s need update salesrep_id = 6 above query. after list of order_id s query above use... update orders set salesrep_id = '6' (order_id = 541304 or order_id = 541597 or order_id = 542318) doing updates orders correct salesrep_id . ultimately i'd combine these make 1 query change salesrep_id a solution proper update syntax join mysql update orders o join customerdetails d on d.customer_id = o.customer_id set o.salesrep_id = 6 o.orderplaceservertime >= '2013-06-01 00:00:00' , o.orderplaceservertime <= '2013-06-31 23:59:59' , d.salesrep_id = 6 here sqlfiddle demo

php - Codeigniter config file change at runtime -

is possible edit config file @ runtime? i'm developing module manager , has able change aspects of configuration dynamically. this means being able read , writte file @ runtime, , modify example line. $config ['webtitle'] = 'foo'; some tips? pd: dont wont create new table in database store configuration. alternatives? edit: after searching time found answer quite similar i'm looking for, have not had success. it might. htaccess block this? link response : link it sounds want modify config file. if so, yes, can it. need make sure file writable web server. fopen() file, fread() memory, change what's needed, fwrite() out again. easy! :) please keep in mind there security risk if in shared hosting situation. if doing setup process, may want check permissions call fileperms(). if permissions not correct, tell user need ftp account , make file writable. then, after setup done, tell user mark file non-writable again.

html - Is there a header alternative to <base>? -

might ignorant question client-side application uses it's resources. html page rendered server involves template engine , template variable because base url changes. wondering if there alternative base (maybe header?). way can let server serve html , set header , not have deal template engine , such. the document controls base, not protocol (http). can, however, use javascript change value. see: how set page's base href in javascript?

How to keep jQuery Validation plugin from adding 'error' class to input box -

i have jquery validation plugin: //name validation cnform.validate({ rules: { customername: { required: true, minlength: 3 }, date: { required: true, dateregex: /^(0[1-9]|1[012])[- \/.](0[1-9]|[12][0-9]|3[01])[- \/.](19|20)\d\d$/, maxlength: 10 } }, onkeyup: false, onclick: false, onfocusout: false, messages: { customername: { required: "unable proceed, search field empty" }, date: { required: "unable proceed, search field empty" } }, errorplacement: function(error, element) { var trigger = element.next('.ui-datepicker-trigger'); error.insertafter(trigger.length > 0 ? trigger : element); } });...

c# - 'Global' variables Razor -

i'm creating form members of site can change passwords accounts, , i'd display message explaining mistakes users made while filling fields (such password short, needs @ least non-alphanumeric character, etc.). i'd display these messages in same page, beside field names. here's code: @helper renderform() { <form method="post"> <p>change password below</p> <div><label for="currentpassword">current password</label> <input type="password" id="currentpassword" name="currentpassword"/></div> <div><label for="newpassword">new password:</label> <input type="password" id="newpassword" name="newpassword"/></div> <div><label for="confirmpassword">confirm new password</label> <input type="password" id="confirmpassword" name=...

matlab - specific column [Remove elements up to last zero element, then remove elements from first zero element to the end] -

this specific question. have m*3 matrix. first column contains m set of elements. may follow this. 0 0 0 0 1 1 1 1 1 1 1 1 1 0 0 0 0 0 my interest 1s , corresponding other column values. can remove zeros new set of matrix 1s, may follow this: 1 1 1 0 0 0 0 0 1 1 1 1 1 1 1 1 1 1 1 1 1 0 0 1 1 when situation above want disregard 1s in beginning , remove elements in m*3 matrix first 1, when reaches second start of zeros in column can remove values end of column. (so 13*3 matrix). i'm doing in matlab. thank :) let's call matrix a: firstcol = a(:, 1); indices = find(firstcol); check = find(diff(indices) ~= 1); if (isempty(check) ) afinal = a(indices, :); else indices2 = indices(check(1)+1:1:check(2)); afinal = a(indices2, :); end afinal should output you're looking for.

debugging - Chrome debugger stops working when paused at unknown point in jquery file -

Image
chrome debugger stops working @ point. know sometime execution stopped in jquery.js file @ unknown point , can resume execution using resume button, happens that button doesn't work , way resume execution have close debugger, no other buttons in debugger window works. seeing long time since started using debugger, never came know why happens. i want know why happens pause of execution shown in jquery.js file, pause not set me. when such pause occurs button in image below not work, not other button in window works. can tell me why happens?

iphone - CGContextFillRects: invalid context - Objective C -

i have piece of code give images color need: - (uiimage*)converttomask: (uiimage *) image { uigraphicsbeginimagecontextwithoptions(image.size, no, image.scale); cgrect imagerect = cgrectmake(0.0f, 0.0f, image.size.width, image.size.height); cgcontextref ctx = uigraphicsgetcurrentcontext(); // draw white background (for white mask) cgcontextsetrgbfillcolor(ctx, 1.0f, 1.0f, 1.0f, 0.9f); cgcontextfillrect(ctx, imagerect); // apply source image's alpha [image drawinrect:imagerect blendmode:kcgblendmodedestinationin alpha:1.0f]; uiimage* outimage = uigraphicsgetimagefromcurrentimagecontext(); uigraphicsendimagecontext(); return outimage; } everything works great in first view when add detail view, gives me error (it still works): cgcontextsetrgbfillcolor: invalid context 0x0. serious error. application, or library uses, using invalid context , thereby contributing overall degradation of system stability , reliability. n...

Removing blank Excel Pivot Table entries -

i have pivot table based on powerpivot multiple levels in rows section. quite few of elements blank. there way suppress blank rows? my pivot table looks @ moment. product1 release 1 iteration 1 (blank) iteration 2 (blank) release 2 (blank) (blank) product2 (blank) product3 release 1 iteration 1 sprint 1 (blank) (blank) (blank) this want like product1 release 1 iteration 1 iteration 2 release 2 product2 product3 release 1 iteration 1 sprint 1 that's example. i've tried set filters each level not display blanks if filter each level hide blank fields pivot table doesn't have items in it. seems excel ends filtering each level out has blank values. not sure if made sense or provided enough information troubleshooting. i'm pretty brain dead @ moment apologize. please let me know if doesn't mak...

c++ - Should std::chrono::steady_clock::now be noexcept? -

i've noticed std::chrono::steady_clock::now has noexcept specifier in documentation @ cplusplus.com . however, haven't found provision in latest c++11 draft (unfortunately don't have copy of standard). is mistake in cplusplus.com documenation or should std::chrono::steady_clock::now have noexcept specifier? § 20.11.7.2 of c++11 standard's definition of steady_clock : class steady_clock { public: typedef unspecified rep; typedef ratio<unspecified , unspecified > period; typedef chrono::duration<rep, period> duration; typedef chrono::time_point<unspecified, duration> time_point; static const bool is_steady = true; static time_point now() noexcept; }; so yes, std::steady_clock::now() should noexcept , isn't error in documentation. it seems cppreference says same .

jquery - Select first drop down and focus -

what selector first select node (drop down)? this works first input need find first select (drop down). $('.modal :input:first').focus(); this not find dropdown. $('.modal select:first').focus(); try this $("select:first").focus();

iphone - Xcode env variables not set -

i downloaded new xcode5 preview , have found cannot build main project. ok in 4.6.3 . aware xcode5 in beta , should not discussed in public forums question not specific xcode5 . the reason project not building environment variables not being set build_components empty build_dir , build_root not being set i can see variables set using xcodebuild showbuildsettings command can tell me these variables pulled use xcode can fix issue thanks

objective c - Force early call to background task expiration handler on iOS devices for testing -

i testing , debugging expiration block in - beginbackgroundtaskwithexpirationhandler: . is there way force block call happens quicker, instead of waiting 10 minutes each time need debug it? i not interested in debugging actual code in block, rather interested in sequence of calls , backtrace, etc.; that's why need callback happen, 10 minutes each time long! yep, basically, isolate background task block, call using nstimer or `- (void)performselector:(sel)aselector withobject:(id)anargument afterdelay:(nstimeinterval)delay` at least thats how it.

how to return a function in a different class in python 3.3 -

i know bad description how can work: class test1(): def test_p1(): print("this part 1 of test1") def test2(): return test_p1() thanks in advance! well, there several options. the basic are: create instance first class test1(): def test_p1(self): print("this part 1 of test1") def test2(): return test1().test_p1() however, should use when having new instance makes sense (depends on api). make class method class test1(): @classmethod def test_p1(cls): print("this part 1 of test1") def test2(): return test1.test_p1() make static method (discouraged) class test1(): @staticmethod def test_p1(): print("this part 1 of test1") def test2(): return test1.test_p1() alternative: use inheritance in cases (maybe case too, not know) makes sense utilize inheritance: create class inherit test1 . way can override parts of , refer parent methods. example: class t...

Can an iOS app "reregister" to handle a URL scheme without reinstallation? -

an ios app can register handle url scheme when it's installed. officially, "if more 1 third-party app registers handle same url scheme, there no process determining app given scheme," according the "communicating other apps" section of apple's "advanced app tricks" . in practice, though, seems app registered handle url scheme 1 it's given to. in event second app has registered handle url scheme app registered, possible first app somehow "reregister" handler url scheme without reinstallation? i have no proof @ hand, pretty sure registration url schemes registration file type handling etc. installation time procedure. however, experience, providing update via app store , updating app triggers installation procedure (since updated app may register new url schemes). hence, if keep apps "up date" providing frequent updates, ios should prefer (and point of view, unofficial rule recent handler used, makes sense)....

asp.net - RegularExpressionValidator is not working -

i'm total newbie in using asp.net , have regular expression validator working fine before after made huge edit textboxes not working anymore. in before edit, when try submit form, if textbox empty or value = "" show error message , not redirect page. in after edit, when try submit form, whether textbox empty or not redirect page. not stopping page redirecting or showing validator before edit. <asp:textbox id="txttstimmlen" cssclass="forimmlentb" runat="server" width="118" text="enter value here" onclick="this.value=''" onblur="tryplaceholder(this,'enter value here')" ></asp:textbox> <asp:regularexpressionvalidator id="vldtstimmlen" controltovalidate="txttstimmlen" display="dynamic" errormessage="immersion length" text="*" validationexpression="(0*[1-9]\d*)" runat="server"/> after edit...

java - Way to enforce coding rules with check ins -

currently have verbal agreement in checking code code should complied without errors, unit tested (with unit tests passed), @ least 80% coverage, complexity less 10, documented java comments , should reviewed team. @ point should fine check in (using perforce). know visual studio have team edition can enforce rules , prevent check ins unless rules have been satisfied. use sonar test our code, want prior checking in enforce dev team follow these rules. there such method java perforce or eclipse? thanks you can use perforce pre-submit trigger, here few examples: http://public.perforce.com/wiki/pre-submit_trigger_examples update: since "change-content" pre-commit triggers give access not list of files content of changed files, in principle write trigger applies these changes full content of branch , runs sonar on it. however, sense triggers typically used brief validations rather more complex processing takes long time execute. longer validations tend belong...

c# - Passing collection from backgroundworker DoWork to backgroundworker Completed and perform a foreach -

my goal here is: user types full or partial computername combobox button click event starts background worker passing computername dowork method dowork method searches activedirectory computername , passes collection workercompleted method workercompleted method adds each computername combobox items. my error @ foreach loop in backgroundworker_runworkercompleted method. "foreach statement cannot operate on variables of type 'object' because 'object' not contain public definition 'getenumerator'" if messagebox.show(results.first().tostring()); in dowork method, can view first computername in collection. (forgive me if collection correct term) if messagebox.show(e.result.tostring()); in dowork , workercompleted method, this: "system.directoryservices.accountmanagement.principalsearchresult`1[system.directoryservices.accountmanagement.principal]" i picked c# month ago , i'm coming powershell apologize in advance if...

javascript - How to pass data to AJAX call -

can tell me how pass data jsp making ajax call ? trying: here ajax call: $.get("gridedit.jsp", { before: "row", time: "2pm" }) .done(function(data) { alert("data loaded: " + data); }); here gridedit.jsp <% string b=request.getparameter("before"); if(b.equalsignorecase("row")) { system.out.println("row row row boat"); out.println("bummer"); } %> i want store value returned gridedit.jsp javascript variable. how should ? please help thanks edit: here tried $.ajax({ url: "gridedit.jsp", async: true, cache: false, type:"get", data: { before:'row', }, error: function(msg) { alert(msg); }, complete: function (xhr...

objective c - How to parse JSON query from ON CONNECT -

i have json [ { "tmsid": "mv004613580000", "rootid": "9756367", "title": "2 guns", "titlelang": "en", "descriptionlang": "en", "releaseyear": 2013, "runtime": "pt01h49m", "showtimes": [ { "theatre": { "id": "5658", "name": "regal fenway stadium 13" }, "barg": true, "datetime": "2013-08-06t10:00", "ticketuri": "http://www.fandango.com/tms.asp?t=aaovd&m=126005&d=2013-08-06", "quals": "descriptive video services|rpx|no passes or super savers|stadium seating|closed captioned" } under showtimes want save "id" , "name" attributes nsstrings variables. any suggestions how approach json? ...

javascript - images in Aptana 3 project not displaying -

i adding images existing webapp, using aptana 3 on windows 7. first cut , pasted images folder, didn't work, created new folder in project directory , imported files. when run code error in firebug saying 'file not found'. i can click on image aptana directory, , opens in windows photo viewer. path given same path given firebug. have refreshed folder , enclosing folders, , have ran app ie, firefox , chrome, still cannot see images in app. i tried running code using aptana's internal server (set firefox) , tried mount code on our development server...no images in either case. the images added in html/css so: (html:) <div class="image"></div> (css:) .image{ height:15px; width:15px; background-image: url(../images/legend/image.png); background-position: center top; } ..in existing code, there several other images added in same way (by else), , these images show in app. can tell me wrong here? try removing ../ ...

newtonscript - How do I set custom buttons when using protoApp instead of newtApplication? -

i'm developing newton os app in newtonscript , protoapp proto fits application type better newtapplication proto (i.e. newtapp). protoapp provides title & status bar close box, how insert custom buttons in status bar (since shows clock)? i found this thread on newtontalk , paul guyot says: you don't need use protoapp. can use protofloater instead. can add nicer newtonos 2.x-like status bar replace ugly clock/battery picker of protoapp , put close box on bar. trick steal bar newtapp framework, i.e. use newtstatusbarnoclose. did several projects, it's documented in doc (the fact can use newtstatusbar[noclose] instead of protostatusbar) , can take advantage of buttons handling code (to align them automatically on left , on right). it turns out suggestion of using newtstatusbar instead of protostatus is documented in newton programmer's guide (2.0) on page 7-19: note new status bar protos newtstatusbarnoclose ...

ios - Rotating a UIView around a center point without rotating the view itself -

i rotate uiview around center point without rotating uiview itself. more cars of ferris wheel (always staying upright) opposed hands of clock. the times i've rotated uiviews around center point, i've used layer position/anchorpoint/transform accomplish effect. changes orientation of view itself. any help? keller this pretty easy in core animation. i've used pretty boring static values example, you'll want make modifications. show how move view along circular uibezierpath. uiview *view = [uiview new]; [view setbackgroundcolor:[uicolor redcolor]]; [view setbounds:cgrectmake(0.0f, 0.0f, 50.0f, 50.0f)]; [view setcenter:[self pointaroundcircumferencefromcenter:self.view.center withradius:140.0f andangle:0.0f]]; [self.view addsubview:view]; uibezierpath *path = [uibezierpath bezierpathwithovalinrect:cgrectmake(cgrectgetmidx(self.view.frame) - 140.0f, cgrectgetmidy(self.view.frame) - 140.0f, 280.0f, 280.0f)]; cakeyframeanimation *pathanimation = [cakeyfr...

mysql - How do I identify which id is used from a distinct list? -

i have following data id -> company_name -> chain -> subchain -> number 1 -> account 555 -> 555 -> 555zz -> 123450 2 -> account 745 -> 745 -> 745aa -> 123451 3 -> account 745 -> 745 -> 745aa -> 123452 4 -> account 745 -> 745 -> 745bb -> 123453 5 -> account 745 -> 745 -> 745cc -> 123454 6 -> account 555 -> 555 -> 555zz -> 123455 what trying list of column "number" , column "id" distinct list of columns "chain" , "subchain". so need know number, id records has same chain , different subchain. this code give me distinct list not number , id of once selected. how can handle using mysql? select distinct chain, subchain records the following result need id -> company_name -> chain -> subchain -> number 1 -> account 555 -> 555 -> 555zz...

java - Access to the color palette in an XSSFWorkbook -

when using poi, cells , fonts in excel documents contain color information not return rgb value , offers index value. indexed value must looked against color. in hssfworkbook (xls) there method available palette: inputstream in = new fileinputstream("sheet.xls"); hssfworkbook wb = new hssfworkbook(in); wb.getcustompalette(); when accessing xssfworkbook (xlsx) there no such method , in fact can find no palette information anywhere in related classes. able index value xssfont , cell, way color "name" match against indexedcolors enum. returns me same original problem; still have no rgb value use. inputstream in = new fileinputstream("sheet.xlsx"); xssfworkbook wb = new xssfworkbook (in); wb.getcustompalette(); <-- fail! i getting xssfcolor way of cellstyle, so: cellstyle style = cell.getcellstyle(); xssfcolor color = style.getfillbackgroundcolorcolor(); to color name via indexedcolors: for (indexedcolors c : indexedcolors.values()) { if (...

javascript - Self-Executing JS Function -

i doing codecademy js training review course i'm taking soon. hit creditcheck function exercise wants function evaluates integer , returns 1 value above 100, , 1 below. thought code below should work, running without being called. why happening? creditcheck = function(income) { income *= 1; // 1 way convert variable income number. if (income>100) { console.log("you earn lot of money! qualify credit card."); return true; // actual return value, console.log() returns "undefined" } else { console.log("alas not qualify credit card. capitalism cruel that."); return false; } }; console.log("if log executing in function def should print second. otherwise it's being executed coding script itself.\n\n") resolution (maybe): tested script in console off of codecademy site. doesn't self execute anywhere except on site. leads me believe there fun...

multithreading - How to realize Multi-Threading connection in PHP -

i have application developed in php. in app, have hundreds of systems in record. every 15 mins, need connect systems track status (like cpu usage), , return them web page. problem code connect each system , execute query command 1 one, makes program slow. now, takes more 15 mins track system status, means that, @ second 15 min, has not finished first time's query. there way connect systems in parallel in php? example, ssh first 10 systems using 1 thread, , in mean time, ssh 10 using thread. thanks. put connection information (host names or ip addresses) of systems in array, loop on them , fork every system. after forking, execute queries towards system. every query happen in new thread, running asynchronously other queries. wait forked children finish work, exit script. this work lot faster running every query synchronously since don't have wait every response before moving on next query. depending on server specs , amount of remote systems, might want limi...

php - Authentication engine for CodeIgniter -

what best user authentication engine(system/framework) codeigniter framework in php? i'm new php, have huge java skills. in java use shiro or spring security, should use in php (especially codeigniter)? there multitude of auth libraries available codeigniter. take here article on few of them. in personal experience, rolled own authentication wasn't difficult, if have time , wish so. also take note ellislab no longer supporting codeigniter. if new project looking maintain foreseeable future, might suggest taking @ laravel. has become increasingly popular, robust, has great community, , has no shortage of information , tutorials around web learn from.

iteration - Iterate elements on multiple python lists -

how can achieve iterate multiple lists in pythonic way? say have 2 lists: l1 = [1, 2, 3] l2 = [4, 5, 6] how can achieve iteration on whole set of elements in l1 , l2 without altering l1 , l2? i can join both lists , iterate on result: l3 = l1[:] l3.extend(l2) e in l3: # ... whatever e but solution not sounds me pythonic, nor efficient, i'm looking better way. you can directly iterate on l1 + l2 : >>> l1 = [1, 2, 3] >>> l2 = [4, 5, 6] >>> >>> e in l1 + l2: ... print e

c# - Optimizing IIS7 for .NET development and debugging -

it seems spend half of time in .net twiddling thumbs waiting iis spin instead of developing. it's pretty simple: whenever make chance code-behind file, , refresh, takes anywhere 15 seconds on minute iis recycle. is there way improve this? it's maddening. i'm working in web site projects (not web application projects), running windows 7 , working in .net 4 framework. machine few months old, ssd, don't think hardware should bottleneck. also, i'm not debugging application of time, though runs slower. edit no matter type of iis use, 1 of best ways speed things create ram drive , point temp , especially asp.net temporary files folders it. asp.net temporary files contains compiled binaries pages. asp.net checks folder when starts , recompiles pages have changes. putting folder on ram drive increase startup time orders of magnitude. technique described in multiple articles, eg. in " slash asp.net compile/load time without hard work " as...

Text Import Window suppression when importing CSV Data in LibreOffice Calc -

in libreoffice, when 1 imports .csv file within calc, 1 obtains dialog named “text import”, in 1 can select several options, including “separated by” option (where 1 select “comma” instance). appears software not allow 1 suppress display of window, , set “comma” option default 1 (similar done in excel). thus, how set option “comma” , suppress dialog in code?

javascript - Jquery zoom plugin to zoom a div -

i've been searching little bit on internet jquery plugin letting me zoom image. i found many of them, doing in several ways, favorites ones zoom image in separate area , not directly original image. ex http://i-like-robots.github.io/easyzoom/ (one of many) but these plugins seems work directly on img tag instead zoom div src attribute referring image. (the html main structure given cannot change much). do know plugin doing or know how it? (would better if t works ojn ie8-9, if it's not must) thanks use zoomooz plugins there free , simple use see simple zoom demo zoomooz on jsfiddle $("#zoom").click(function () { $(this).zoomto({ targetsize: 1.0, root: $(".container") }); });

Google Fonts inside CSS file https link -

i using google web fonts inside css stylesheet below @font-face { font-family: 'open sans'; font-style: normal; font-weight: 400; src: local('open sans'), local('opensans'), url(http://themes.googleusercontent.com/static/fonts/opensans/v6/cjzkeoubrn4kerxqtauh3t8e0i7kzn-epnyo3hzu7kw.woff) format('woff');} but when website goes secured page, getting "only secured content being displayed". used google chrome resource inspector , pointed above issue how can add secured link google web font in css file thanks you don't need @font-face use google font. just add in html code: <link href='http://fonts.googleapis.com/css?family=open+sans' rel='stylesheet' type='text/css'> then add font name in css. example: body{font-family: 'open sans', sans-serif;}

Using the has() method a Laravel BelongsTo relation -

i have activity model , level model. each activity has 1 level, have following on activity: function level() { return $this->belongsto('level'); } and on level: function activities() { return $this->hasmany('activity'); } i need search activities have particular level, doing this: $searchdata = 'beginner'; $query = $query->has(array('level' => function($query) use ($searchdata) { $query->where('name', 'like', '%' . $searchdata . '%'); })); using throws logicexception: has method invalid on "belongsto" relations. so i've either got relationship wrong or need build query in different way. any suggestions? just close one, off answered in comments @torkiljohnsen. i'd taken code part of application has many many relationship , pivot table. looking @ again beginning, activity model has level_id can this: $query->wherelevel_id(x) just out of int...

ios - How to modify a Done button programmatically from UIActionSheet? -

i have method create action sheet , uipicker: -(void)presentnewpicker{ self.aac = [[uiactionsheet alloc] initwithtitle:@"what city?" delegate:self cancelbuttontitle:nil destructivebuttontitle:nil otherbuttontitles:@"ok", nil]; self.pickrview = [[uipickerview alloc] initwithframe:cgrectmake(0.0, 44.0, 0.0, 0.0)]; self.pickrview.showsselectionindicator = yes; self.pickrview.datasource = self; self.pickrview.delegate = self; self.citynames = [[nsarray alloc] initwithobjects: @"phoenix", @"tahoe", @"nevada", @"lime", @"florida", nil]; uitoolbar *pickerdatetoolbar = [[uitoolbar alloc] initwithframe:cgrectmake(0, 0, 320, 44)]; pickerdatetoolbar.barstyle = uibarstyleblackopaque; [pickerdatetoolbar size...

html - C# - Embedding .swf file with parameters into WPF and make it look native? -

i have shockwave flash file needs parameters passed ( assume! ) because i'm not involved in stuff. it looks when embedded html page : <html> <head> <link rel="stylesheet" href="style.css" type="text/css"/> <script language=javascript> var message="function disabled!"; function clickie4(){ if (event.button==2){ return false; } } function clickns4(e){ if (document.layers||document.getelementbyid&&!document.all){ if (e.which==2||e.which==3){ return false; } } } if (document.layers){ document.captureevents(event.mousedown); document.onmousedown=clickns4; } else if (document.all&&!document.getelementbyid){ document.onmousedown=clickie4; } document.oncontextmenu=new function("return false") </script> </head> <body> <div id="main"> <object id="radioplayer" width="406" height="150" classid="clsid:d27cdb6e-ae6d-11cf-96b8-4...

javascript - Detecting each character inputed in field and run conditionals -

i building web app. believe easiest if try explain want user experience before ask question. i want user go on site , begin type in text field. when each character inputted, want run conditional statement on character decided if should added text field. if character inputted not 1 want, character isn't added. i have validations in model after text submited, want real time. i'm guessing relates javascript , not comfortable enough in coding know search for/research. can assist me in (tutorials, concepts, etc)? thank taking time read this. you can preventdefault method on event object passed keydown event. tells browser not preform default action (which on text field appending letter field). here implementation using jquery brevity, can implement same functionality in pure javascript well: $('input').on('keydown', function(event) { // event.which character code if ( /* condition */ ) event.preventdefault(); }); and here fiddl...

mapreduce - Hadoop Pig count number -

i learning how use hadoop pig now. if have input file this: a,b,c,true s,c,v,false a,s,b,true ... the last field 1 need count... want know how many 'true' , 'false' in file. i try: records = load 'test/input.csv' using pigstorage(','); boolean = foreach records generate $3; groups = group boolean all; now gets stuck. want use: count = foreach groups generate count('true');" to number of "true" error: 2013-08-07 16:32:36,677 [main] error org.apache.pig.tools.grunt.grunt - error 1070: not resolve count using imports: [, org.apache.pig.builtin., org.apache.pig.impl.builtin.] details @ logfile: /etc/pig/pig_1375911119028.log can tell me problem is? two things. firstly, count should count . in pig, builtin functions should called all-caps. secondly, count counts number of values in bag, not value. therefore, should group true/false, count : boolean = foreach records generate $3 true...

Rails, how to create a scope where a habtm is populated? -

i have user accounts has habtm relationship companies. users can have 0 companies. write scope users belong 1 or more companies. how can accomplish this? example model: class user < activerecord::base has_and_belongs_to_many :companies scope :independent, # ???? end for no companies: scope :independent, -> { where(:companies => []) } for 1 or more companies: scope :independent, -> { where("companies <> []") }

datetime - How to get the total hour from starting time to end time in php -

how can total hour start time end time. $start_time = '11:00:00 pm'; // of 07/08/2013 $end_time = '01:00:00 am'; // of 08/08/2013 then output should be: $total = '02:00:00'; // 12 hour format you can convert date strings time values, subtract difference in seconds between two, divide 3600 difference in hours: $t1 = strtotime('2013-08-07 23:00:00'); $t2 = strtotime('2013-08-08 01:00:00'); $differenceinseconds = $t2 - $t1; $differenceinhours = $differenceinseconds / 3600;

c# - How to compile an assembly from source code -

i have downloaded extended version of windows phone toolkit link , , don't know how compile source code. used nutget install wptoolkit 1 here can't installed it. anyway love learn how compile assembly source code. ps: still beginner. thank you.

datetime - How is the Date/Time formatted in Android notifications? -

what android os use format dates , times in notifications? i assumed used dateutils.formatsamedaytime , not that. logic appears same, format not same. instance, notification show me "2013-08-06" (based on system settings) when formatsamedaytime returns "8/6/13". edit: here's current solution. best? public static final charsequence formatsamedaytimecustom(context context, long then) { if (dateutils.istoday(then)) { return dateformat.gettimeformat(context).format(new date(then)); } else { final string format = settings.system.getstring(context.getcontentresolver(), settings.system.date_format); return new simpledateformat(format).format(new date(then)); } }

java - TabHost.TabSpec content not appearing -

i have tabhost in 1 of activity layouts 4 tabspecs. have set content each tabspec different linearlayout, first tabspec displays linearlayout. have tried many things still can't figure out what's wrong. here's code: public class conversionactivity extends activity { phconversion phc = new phconversion(); @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_conversions); tabhost th = (tabhost) findviewbyid(r.id.tabhost); th.setup(); tabspec spec1 = th.newtabspec("tab 1"); spec1.setcontent(r.id.tab1); spec1.setindicator("ph"); tabspec spec2 = th.newtabspec("tab 2"); spec2.setindicator("temp"); spec2.setcontent(r.id.tab2); tabspec spec3 = th.newtabspec("tab 3"); spec3.setcontent(r.id.tab3); spec3.setindicator("length"); tabspec spec4 = th.newtabspec("tab 4"); spec...

cabal - How can I disable OpenGL in the Haskell Platform? -

i'm on shared linux server can't install software. seems installing opengl source major pain (i stopped after finding mesa depends on libxml2), , don't use in of haskell programs. how disable opengl in haskell platform? got around configure checks deleting those, when add --disable-openglraw or --without-openglraw ./configure options, says "unrecognized options" , doesn't disable packages. also, i've tried using cabal-install bootstrap, reason cabal-install 0.14.0 doesn't work ghc 7.6.3. thank much!! you can use cabal-install 1.16.x ghc 7.6.3. 'cabal' webpage lags - seems no 1 considers job update page. see hackage page instead ( http://hackage.haskell.org/package/cabal-install ).

Android JSON Parsing not working -

i'm using androidhive tutorials data json file , view list or grid. when run application, app crashes , exits. couldn't find error on code. can download source code above tutorial link. provided class files here. please me solve problem possible. in advanced. androidjsonparsingactivity.java package com.example.samplejsonparsing; import java.util.arraylist; import java.util.hashmap; import org.json.jsonarray; import org.json.jsonexception; import org.json.jsonobject; import android.app.listactivity; import android.content.intent; import android.os.bundle; import android.util.log; import android.view.view; import android.widget.adapterview; import android.widget.adapterview.onitemclicklistener; import android.widget.listadapter; import android.widget.listview; import android.widget.simpleadapter; import android.widget.textview; public class androidjsonparsingactivity extends listactivity { // url make request private static string url = "http://api.and...