Posts

Showing posts from April, 2011

database - Best practices for huge volumes of data load/unload? -

database - Best practices for huge volumes of data load/unload? - my question applies etl scenarios, transformation performed outside of database (completely). if extract, transform, , load huge volumes of info (20+ 1000000 records or more) , databases involved : oracle , mssql server, best way to: effectively read source database : there way avoid querying on network? have heard things direct path extract method/ mass unload method - i'm quite not sure how work, presume need dump file of sorts kind of non-network based info read/import? effectively write transformed info target database?: should consider apache hadoop? help me start transformation , parallely load info destination database? - faster say, oracle's mass load utility? if not,, there way remote invoke mass load utlities on oracle/mssql server? appreciate thoughts/suggestions. i utilize db's mass load facilities this. remote command of mass loads sysadmin issue; there way this....

wordpress - Insert PHP within function -

wordpress - Insert PHP within function - i have kid theme in wordpress , want insert code @ end of each single post: <?php the_tags(); ?> i don't want edit single.php. insert code via functions.php i found thread , used code in answer: https://wordpress.org/support/topic/insert-info-into-bottom-of-posts#post-3990037 it worked me, cannot figure out how insert php code. these things tried didn't reflect wanted in front end end: $content.= '<?php the_tags(); ?>'; $content.= ' the_tags();'; $content.= <?php the_tags(); ?>; $content.= the_tags(); how can alter code in wordpress thread include php? thank you. you're attempting concatenate output of the_tags onto $content , the_tags not homecoming anything. when phone call the_tags sends output browser itself. the_tags pretty much wrapper around get_the_tag_list homecoming content string rather outputting it. try: $content .= get_the_tag_list(); ...

Google Chrome javascript debugger: object inspect not working -

Google Chrome javascript debugger: object inspect not working - i have been using chrome debug node.js code node-inspector while now. however, lately started having issue debugger , don't know why. when seek inspect object, instead of expanding , show me it's property tries modify value, "object". way found see value type in console "obj.property". i have problem in console when objects printed. in image below, can see can expand local , global scope, not of reddish marked variables. also, in console can expand bar, not bar.foo. feels marked format "variablename: type" cannot expanded. apparently node-inspector out of date (though not showing when typing npm outdated -g) i updated manually , fixes problem javascript google-chrome debugging

php - Yii: How to define parent object to related childs? -

php - Yii: How to define parent object to related childs? - 2 tables: threads , comments (e.g.) => thread & comment models thread.php public function relations() { homecoming array( 'comments'=>array(self::has_many, 'comment', 'thread_id'), ); } how define property parent thread object each comment child? something this: $model = thread::model()->with('comments')->findall(); foreach($model->comments $comment) echo $model->id == $comment->thread->id; // 1 p.s. sorry english, know it's bad. you need define rule in comment model: public function relations() { homecoming array( 'thread'=>array(self::belongs_to, 'thread', 'thread_id'), ); } this means each comment belongs 1 thread. now, structure, can following: $comments = comment::model()->with("thread")->findall(); foreach($comments $comment) ... ...

Session is null on first request -

Session is null on first request - i'm using spring-session , it. think i'm missing something. in application flow goes this: 1) user requests homepagecontroller , controller tries set attribute in request: httpservletrequest request = ((servletrequestattributes) requestcontextholder.currentrequestattributes()).getrequest(); final string sessionids = sessionstrategy.getrequestedsessionid(request); if (sessionids != null) { final expiringsession session = sessionrepository.getsession(sessionids); if (session != null) { session.setattribute("attr", "value"); sessionrepository.save(session); model.addattribute("session", session); } } as can see seek sessionid request-cookie, , if there's session id in repository utilize (add attribute). perfect, after second request. why? because if restart server cookie left old value, , first request not find session in...

mysql - html textbox posted to php create table columns -

mysql - html textbox posted to php create table columns - i new php , trying learn. illustration not going live! i have html textbox , posted php. trying break string using explode function , want add together seperate strings select database , table database "columns". help or advice great thanks $getmessage = $_post["dbmessages"]; $questions = $_post["dbmessagesname"]; $answers = $_post["dbmessages"]; $combined = array_combine($questions, $answers); $dbconnectiont = mysqli_connect($host, $user, $password, $dbname); // create loop assign input boxes foreach($combined $question => $answer) { // create tables , columns message text box $sqlcreatetable = "create table " . $question . "( add together reply column names )"; $answersplit = explo...

linux - execute some action after specific shell command => ( Track installed packages ) -

linux - execute some action after specific shell command => ( Track installed packages ) - i installed fresh new linux distro, , track new packages install. hence, each time run sudo apt-get install packagename , log specific bundle maintain track of configuration. then, new installation, write simple script take whether or not want install old packages. any of have solution ? maybe simple track file installed packages ? sure there many dependencies, , not basic ones ? the thought watch permanently shell entry , save matching string ( bundle name ) maybe not best solution. thanks in advance help. you create script serves alias install command remembers each newly installed package, maybe appending each entry file somewhere. script have alternative reinstall packages if selected, iterate through each remembered bundle , prompt if install it. if backup script , file of installed packages on clean machine re-create files , reinstall desired packages. alt...

mysql - Coldfusion / ORM -- Row was updated or deleted by another transaction (or unsaved-value mapping was incorrect) -

mysql - Coldfusion / ORM -- Row was updated or deleted by another transaction (or unsaved-value mapping was incorrect) - i working on application using coldbox , orm. have local environment, development environment, , actual production environment. when trying import info spreadsheet , store results database, local environment works without error. if utilize same code , seek upload info production or development environments, error saying row updated or deleted transaction (or unsaved-value mapping incorrect). contract 145 145 145 201 do { seek { monthlyusage = getmonthlyusageservice().new({ commodity = structfind(usagereport, "commodity"), term = structfind(usagereport, "term"), usage = structfind(usagereport, "usage"), startdate = structfind(usagereport, "startdate"), end...

mysql output into php arrary -

mysql output into php arrary - i's trying transform info mysql $books below doenst seem working $books = array( "phil" => array("my girl" => 2.5, "the god delusion" => 3.5, "tweak" => 3, "the shack" => 4, "the birds in life" => 2.5, "new moon" => 3.5) ) this how tried doing: $sql = "select * rating user_id=11 limit 5"; $db_result = mysql_db_query($dbname,$sql) or trigger_error(mysql_error()); $num_rows = mysql_num_rows($db_result) or trigger_error(mysql_error()); while ($row = mysql_fetch_array($db_result)) { $one = $row['bookid']; $two = $row['user_id']; $three = $row['rating']; $array= array( $two => array($one=>$three) ); print_r($array); } but : array ( [11] => array ( [123715] => 5 ) ) array ( [11] =...

flex - How to handle D-n-D to a Sprite? -

flex - How to handle D-n-D to a Sprite? - i need observe when user drag-n-drop object sprite. here's sample app illustrates issue. never gets alert: tks. <?xml version="1.0" encoding="utf-8"?> <s:application xmlns:fx="http://ns.adobe.com/mxml/2009" xmlns:s="library://ns.adobe.com/flex/spark" xmlns:mx="library://ns.adobe.com/flex/mx" creationcomplete="ini(event)"> <s:layout> <s:verticallayout /> </s:layout> <fx:script> <![cdata[ import mx.controls.alert; import mx.controls.image; import mx.core.dragsource; import mx.core.iuicomponent; import mx.core.uicomponent; import mx.effects.effectclasses.addremoveeffecttargetfilter; import mx.events.dragevent; import mx.events.flexevent; import mx.graphics.imagesnapshot; import mx.managers.dragmanager; private var sprite:sprite; private var uiref:uicomponent = new uicom...

c - Read Certificate files from memory instead of file OpenSSL -

c - Read Certificate files from memory instead of file OpenSSL - i have server hear on https using openssl. this, have provide certificate use. however, current implementation uses filename provided openssl api. want cert info read memory, don't have ship certificate file opening. tried google, didn't come options. is possible? there samples/tutorials available on web can go through? other pointers/help. ps: code written in c. the next code did job me: ssl_ctx *ctx; x509 *cert = null; rsa *rsa = null; bio *cbio, *kbio; const char *cert_buffer = ""; const char *key_buffer = ""; cbio = bio_new_mem_buf((void*)cert_buffer, -1); cert = pem_read_bio_x509(cbio, null, 0, null); assert(cert != null); ssl_ctx_use_certificate(ctx, cert); kbio = bio_new_mem_buf((void*)key_buffer, -1); rsa = pem_read_bio_rsaprivatekey(kbio, null, 0, null); assert(rsa != null); ssl_ctx_use_rsaprivatekey(ctx, rsa); c openssl certificate

Trying to use Moles with NUnit. Getting "Moles requires tests to be an instrumented process" -

Trying to use Moles with NUnit. Getting "Moles requires tests to be an instrumented process" - i trying utilize moles nunit , getting next error "moles requires tests instrumented process". using visual nunit within visual studio 2008 working. help welcome. this did in order create moles work nunit: grab archive @ c:\program files (x86)\microsoft moles\documentation\moles.samples.zip , extract moles solution folder. build nunit project in visual studio (2008) release. copy output files microsoft.moles.nunit.dll , microsoft.moles.nunit.xml ...\moles\nunit\bin\release\ c:\program files (x86)\nunit 2.5.9\bin\net-2.0\addins\ . suspect step of re-compiling nunit addin instead of using 1 coming download & install actual solving point. in vs test project, create sure add together reference c:\program files (x86)\nunit 2.5.9\bin\net-2.0\addins\microsoft.moles.nunit.dll copied. in vs test class, mark test method [moled] attribute (this r...

css - Combining different responsive frameworks -

css - Combining different responsive frameworks - so have done little research responsive frameworks out there, , here found. of frameworks exists out there: famous ,foundation, amazium, responsivebp, tuktuk, , of course of study bootstrap. of them got different features , seek alter default design of website every framework got it's thing makes special. thing i haven't found during research website/project combine couple frameworks and creates new amazing look. so asking here is, has thought thought combine couple of frameworks , create new astonishing design , how can implement ? (i'm not talking creating new framework) css twitter-bootstrap responsive-design frameworks

c++ - text adventure - how to add items to 'inventory' struct/class without defining each in advance? -

c++ - text adventure - how to add items to 'inventory' struct/class without defining each in advance? - so far awkward thing i've come about. have set integers mark how many potions, keys, player has, i'm not sure how can random items, rocks, cpu (in case of dunnet), stick, shovel, etc. i dont want have figure out every item in game , assign variable. there has easier way. thought of using 2 arrays, 1 string , 1 int, job - wont work variety of reasons 1 beingness cant string stringname[10], see problems associating two, and... list goes on, i'm sure wont work way. everything else class btw, dont using structs (but going used throughout code, , accessed everywhere), far code struct inventory{ int keys; int potions; int getinventory() const { homecoming keys, potions; } void addkey(int amt){ keys += amt; } void addpotion(int amt){ potions += amt; } void usepotion(){potions -= 1;} void usekey() { if (keys >> 0...

unit testing - Not able to inject mock objects -

unit testing - Not able to inject mock objects - i newe mockito , junit, have written unit test cases testing rest service , made utilize of mockito injecting mocks. , code below: billcontrollertest.java: @runwith(springjunit4classrunner.class) @springapplicationconfiguration(classes = application.class) @webappconfiguration public class billcontrollertest{ private mockmvc mockmvc; @autowired private webapplicationcontext webapplicationcontext; @injectmocks private billcontroller billcontroller; @mock private billservice mockbillservice; @before public void setupcontroller() { mockitoannotations.initmocks(this); this.mockmvc = webappcontextsetup(webapplicationcontext).build(); } @test public void testbills() throws exception { // false info final list<bill> fakebilllist = new arraylist<>(); fakebilllist.add(cpsfake.bill("1234")); when(mockbillservice.getbills(bill_uid)) .thenreturn(fakebilllist.stream()); ...

wordpress - Can't edit specific CSS file -

wordpress - Can't edit specific CSS file - when in wordpress can edit http://.../wp-content/themes/enigma/style.css?ver=4.0.1 however need edit http://.../wp-content/themes/enigma/css/enigma-theme.css?ver=4.0.1 how go gaining access , edit file? style.css adding css site. add together css file edits enigma-theme.css may overwritten if update theme. you could: use plugin simple custom css add together css site. download enigma-theme.css file, edit , re-upload utilize filezilla download , upload file. download whole theme alter name see here prevent overwrites if theme updates custome theme @ point hope helps css wordpress

parse.com - Detecting arrival of push notifications in android app -

parse.com - Detecting arrival of push notifications in android app - is possible observe arrival of force notifications programmatically on android app? how should 1 proceed implement same? as @drees suggested in comment, can create custom broadcastreceiver extends parsepushbroadcastreceiver. like this: public class parsecustombroadcastreceiver extends parsepushbroadcastreceiver { @override public void onreceive(context context, intent intent) { seek { // sample code jsonobject json = new jsonobject(intent.getextras().getstring("com.parse.data")); final string notificationtitle = json.getstring("title").tostring(); final string notificationcontent = json.getstring("alert").tostring(); final string uri = json.getstring("uri"); //create taskstack builder - sample(incomplete) give thought intent resultintent = null; taskstackbuilder stackb...

python - Sorting points on multiple lines -

python - Sorting points on multiple lines - given have 2 lines on graph (i noticed inverted numbers on y axis, mistake, should go 11-1) and care whole number x axis intersections we need order these points highest y value lowest y value regardless of position on x axis (note did these pictures hand may not line perfectly). i have couple of questions: 1) have assume known problem, have particular name? 2) there known optimal solution when dealing tens of billions (or hundreds of millions) of lines? our current process of manually calculating each point , comparing giant list requires hours of processing. though may have hundred 1000000 lines typically want top 100 or 50,000 results of them far "below" other lines calculating points unnecessary. your info construction set of tuples lines = {(y0, Δy0), (y1, Δy1), ...} you need ntop points, hence build set containing top ntop yi values, single pass on data top_points = choose(lines,...

html - Reordering columns in a semantic-ui stackable grid -

html - Reordering columns in a semantic-ui stackable grid - i playing around sementic-ui framework responsive capabilities , nail wall when using stackable grid. specifically, trying replicate classic front end page layout big paragraphs , pictures layout in 1 3rd , 2 thirds columns, alternating left , right. <div class="ui stackable grid"> <div class="sixteen wide column"> <h2>full width header</h2> </div> <div class="six wide column"> <img alt="left image" /> </div> <div class="ten wide column"> <p>right content</p> </div> </div> <div class="ui stackable grid"> <div class="sixteen wide column"> <h2>full width header</h2> </div> <div class="ten wide column"> <p>left content</p> </div>...

c++ - Why this program sometimes doesn't display the output, and sometimes yes? (Rainfall program) -

c++ - Why this program sometimes doesn't display the output, and sometimes yes? (Rainfall program) - i finished working on programme calculates total, average, highest , lowest rainfall during year. programme requires user type rainfall each month, , create calculations. when lowest , highest numbers, programme should display month corresponding numbers, not number itself. my programme runs fine , don't error @ all. however, notice sometimes, depending on output, 1 of these 3 cases: the programme displays month highest number, doesn't display month lowest number. the programme displays month lowest number, doesn't display month highest number. the programme displays without problems the code following: #include<iostream> #include<string> using namespace std; int main() { //array containing months string months[12] = { "january", "february", "march", "april", "may", "june...

c# - Can one implement an interface property on an Entity Object interface? -

c# - Can one implement an interface property on an Entity Object interface? - i'm using entity framework , have created interface lease transactions: public interface ileasetransaction { int id { get; } datetime date { get; } decimal amount { get; } } then implement interface on entity object created empty partial class: public partial class type1leasetransaction : ileasetransaction { } this works fine, transactions can have 0 or 1 voids entity objects. attempted implement voids follows: public interface ileasetransactionvoid { int transactionid { get; } datetime date { get; } int typeid { get; } } and empty partial class...: public partial class type1leasetransactionvoid : ileasetransactionvoid { } the problem running when seek add together ileasetransactionvoid property leasetransaction interface: public interface ileasetransaction { int id { get; } datetime date { get; } decimal amount { get; } ileaset...

c# - Trying to restrict subsequent same character occurrences -

c# - Trying to restrict subsequent same character occurrences - i trying implement similar functionality of alter directory (cd) in command prompt. the restriction that, 1 . directory names must contain alphabets. 2 . root directory "/" 3 . parent directory ".." 4 . path separator "/" the input new path name . input might . 1. directory name alone. - valid 2. directory/directory/directory - valid 3. directory//directory - invalid 4. .. - valid 5. directory/.. - valid 6. directory/... - invalid and other combinations that. to avoid complexity tried split check to check input must contain letters, used ^[a-za-z]+$ this. but don't know how restrict / , dot(.) characters subsequent occurences 1 , 2 respectively thanks you can utilize string.indexof , check against it's homecoming value. var is_only_one_slash = input.indexof("\\\\") == -1; var is_only_two_dots = input.indexof("..") > -1; if(...

javascript - How would you switch focus to an input text upon clicking an item on a dropdown menu? -

javascript - How would you switch focus to an input text upon clicking an item on a dropdown menu? - i have website has dropdown menu , input box. user comfort, thinking nice have when user clicks on alternative in dropdown menu, mouse cursor focused within input box can begin typing right away, rather having click every time. how can achieved? here jsfiddle: http://jsfiddle.net/mlynn/jyrbepyz/3/ thank you. html <section id="heady"> <div style="text-align: left;padding:25px 70px;display:inline-block;float:left;"><b><a href="index.html">site</b></a></p></div> <div style="text-align: right;padding:25px 70px;display:inline-block;float:right;"> <a href="index.html">home</a> | <a href="index.html">generic</a> | <a href="index.html">elements</a> | <a hr...

sorting - How to sort a matrix/data.frame by all columns in R -

sorting - How to sort a matrix/data.frame by all columns in R - i have matrix, e.g. a = rep(0:1, each=4) b = rep(rep(0:1, each=2), 2) c = rep(0:1, times=4) mat = cbind(c,b,a) i need sort columns of matrix. know how sorting specific columns (i.e. limited number of columns). mat[order(mat[,"c"],mat[,"b"],mat[,"a"]),] c b [1,] 0 0 0 [2,] 0 0 1 [3,] 0 1 0 [4,] 0 1 1 [5,] 1 0 0 [6,] 1 0 1 [7,] 1 1 0 [8,] 1 1 1 however, need generic way of doing without calling column names, because have number of columns. how can sort big number of columns? here's concise solution: mat[do.call(order,as.data.frame(mat)),]; ## c b ## [1,] 0 0 0 ## [2,] 0 0 1 ## [3,] 0 1 0 ## [4,] 0 1 1 ## [5,] 1 0 0 ## [6,] 1 0 1 ## [7,] 1 1 0 ## [8,] 1 1 1 the phone call as.data.frame() converts matrix data.frame in intuitive way, i.e. each matrix column becomes list component in new data.frame. that, can pass each matrix column single invocation of...

why are Key events c++ WxWidgets not being caught? -

why are Key events c++ WxWidgets not being caught? - good day guys i using wxwidgets 2.8. have created grid interface using text boxes. alter values in text boxes navigating them using arrow keys. i have set panel in text boxes placed, added onkeydown event should display message when key pressed. not work. i have tried oncharevent, , adding the events wxframe. why can not grab key events? only focused window gets key events , frame never have focus if has children taking it, such text controls. also consider using wxwidgets 3.0 new code, in particular provides bind() can convenient handling key events controls in single place if want do. c++ wxwidgets

bash - Git branches to be merged in shell script variable -

bash - Git branches to be merged in shell script variable - i'm creating script merge branches defined in shell script variable. here part of script # here how setting variable 'branches' all_branches=`git ls-remote . | cutting -d $'\t' -f 2` # include folder prefix includepattern= if [[ -n "$include_pattern" ]] ; export ifs="," pattern in $include_pattern; includepattern="$includepattern -e $remote_folder$pattern" done fi branches=`echo "$all_branches" | eval "grep $includepattern"` echo "b = $branches" echo "c = git merge -q --no-edit $branches" git merge -q --no-edit $branches this output b = refs/remotes/origin/xxx refs/remotes/origin/xxy c = git merge -q --no-edit refs/remotes/origin/xxx refs/remotes/origin/xxy merge: refs/remotes/origin/xxx refs/remotes/origin/xxy - not can merge why not working? info: when copy&paste of command (printed echo "c = .....

javascript - Breeze.js query not updating knockout view at all -

javascript - Breeze.js query not updating knockout view at all - i'm new breeze , struggling having results of breeze query linked knockout observable array , array not updating view when populated. found this questoin, similar problem, mine won't bind first time around. did seek of things suggested in thread, though, no luck. i've been working off of breeze.js todo demo (here). using console.log, info coming query looking same info demo code. query pulling list of breweries table i'm trying, now, bind list (eventually drop-down). there tiny thing i'm missing here? thanks, in advance, help! view model code: viewmodel = (function () { var self = this; self.breweries = ko.observablearray(); function getbreweries() { dataservice().getbreweries().then(querysucceeded).fail(queryfailed); function querysucceeded(data) { self.breweries(data.results); } function queryfailed(error) { alert(e...

css - How do i resize an SVG? -

css - How do i resize an SVG? - for project using highcharts, style defined javascript , wondering if somehow possible resize svg or parents container? here's code: <div id="beteiligungs_chart"> <div class="highcharts-container" id="highcharts-0" style="position: relative; overflow: hidden; width: 1706px; height: 400px; text-align: left; line-height: normal; z-index: 0; font-family: 'lucida grande', 'lucida sans unicode', verdana, arial, helvetica, sans-serif; font-size: 12px; cursor: auto;"> <svg xmlns="http://www.w3.org/2000/svg" version="1.1" width="1706" height="400"> <defs> <clippath id="highcharts-1"> <rect rx="0" ry="0" fill="none" x="0" y="0" width="9999" height="400" stroke-width="0.000001"></rect> ...

java - Meaning of this error in Eclipse -

java - Meaning of this error in Eclipse - this question has reply here: java.util.nosuchelementexception: no line found 3 answers exception in thread "main" java.util.nosuchelementexception: no line found @ java.util.scanner.nextline(unknown source) @ lineio.main(lineio.java:39) there no lines reddish out. i'll post code... import java.io.file; import java.io.filenotfoundexception; import java.io.printwriter; import java.util.scanner; public class lineio { public static void main(string[] args)throws filenotfoundexception{ scanner console = new scanner(system.in); system.out.print("enter input file name: "); string inputfilename = console.next(); system.out.print("output file: "); string outputfilename = console.next(); file inputfile = new file(inputfilena...

ios - How to add spacing and rounded corners to a tableview? -

ios - How to add spacing and rounded corners to a tableview? - i'm trying figure out how add together margin tableview. right looks this: but, this: i tried insetting, didn't work right. i'm new, not quite sure how cgrect works. i writing in swift. try self.tableview.layoutmargins = uiedgeinsetszero ios uitableview swift

html - Background change effect by rotation on hover via CSS3 -

html - Background change effect by rotation on hover via CSS3 - i web developer. client's website need set effect on hover specific div shown in website . when hover on div background should alter rotating. how can this. can ease effect background alter using css3 transition. there way same without using jquery ? see scrrenshot jsbin i simulate provide animation without jquery. key accomplish utilize parent & chidl relation , understand key point when animation play. class="snippet-code-css lang-css prettyprint-override"> .hover{ position: relative; width: 200px; height: 200px; background-color: #1cf; } .background{ position: absolute; width: 100%; height: 100%; color: #fff; text-align: center; line-height:10; background-color: #c33; transition: 0.3s; z-index: 2; font-size: 20px; } .content{ position: absolute; width: 100%; height: 100%; background-color: #fff; text-align: cen...

php - filter custom post type archive page using meta_query with multiple arrays using acf relationship field -

php - filter custom post type archive page using meta_query with multiple arrays using acf relationship field - as title suggests i'm trying filter custom post type archive page using meta_query multiple arrays using acf relationship field. this have far using documentation , tutorials @ acf. both keywords filter , project_ref filter work independently if utilize 'relation' => 'and' keywords works using 'or' , never together. also, project_ref post id. // functions.php $meta_query = $query->get('meta_query'); // allow url alter query if( !empty($_get['keywords']) or !empty($_get['project_ref']) ) { $keywords = explode(',', $_get['keywords']); $projects = $_get['project_ref']; // add together our meta query original meta queries $meta_query[] = array( 'relation' => 'or', array( ...

Overload operator++ for a linked list -

Overload operator++ for a linked list - i trying overload ++ operator utilize in loop move next object in linked list. example: for(pcurrent = pheader; pheader->m_next != null; ++pcurrent) { if (p_current == search_value){ dosomething(pcurrent); break; } i'm not sure how overload ++ operator. i've tried this: const node& operator++(node* p_node){ p_node = p_node->p_next_node; homecoming p_node; } linked-list operator-overloading nodes

python 3.x - my prime number function keeps a returning a TypeError -

python 3.x - my prime number function keeps a returning a TypeError - so i'm writing is_prime function, , keeps returning typeerror when set argument float. function returns returns true if num prime. number x prime if divisible 1 , x. can consider numbers 0 , 1 prime , returns false if num not prime. also, if argument not integer or num < 0, function should homecoming none. so examples: input argument "hello!", should homecoming none, because input argument string for input argument "23", should homecoming none, because input argument string for input argument 12.34, should homecoming none, because input argument float. for input argument 1, should homecoming true for input argument 4, should homecoming false (number 4 divisible 2) so here code, don't know problem, help or criticism appreciated...: def is_prime(num): if num type(num) , type(str) , num < 0: homecoming none in range(1, num): if num % 2 == ...

mysql - SQL QUERY problem bookid -

mysql - SQL QUERY problem bookid - how find books (show titles, authors , prices) on 'civil war' (i.e., title field contains 'civil war'), available in 'audio' format. this schema * books (bookid, title, author, year) * customers (customerid, name, email) * purchases (customerid, bookid, year) * reviews (customerid, bookid, rating) * pricing (bookid, format, price) i did did not work select b.title, b.author, p.price books b,pricing p inner bring together books on p.bookid b.title '%civil war%' , p.format '%audio%' grouping p.format, p.price it looks on clause incomplete. try this: select b.title, b.author, p.price books b inner bring together pricing p on p.bookid = b.bookid b.title '%civil war%' , p.format '%audio%' grouping p.format, p.price see = b.bookid @ end of inner join? that's issue. mysql

ipc - python interprocess querying/control -

ipc - python interprocess querying/control - i have python based service daemon doing lot of multiplexed io (select). from script (also python) want query service daemon status/information and/or command processing (e.g. pause it, shut down, alter parameters, etc). what best way send command messages ("from on process this!") , query processed info ("what result of that?") using python? i read somewhere named pipes might work, don't know much named pipes, in python - , whether there improve alternatives. both background service daemon , frontend programmed me, options open :) i using linux. pipes , named pipes solution communicate between different processes. pipes work shared memory buffer has interface mimics simple file on each of 2 ends. 1 process writes info on 1 end of pipe, , reads info on other end. named pipes similar above , except pipe associated real file in computer. more details @ http://www.softpanorama.org/s...

authentication - Locally reading S3 files through Spark (or better: pyspark) -

authentication - Locally reading S3 files through Spark (or better: pyspark) - i want read s3 file (local) machine, through spark (pyspark, really). now, maintain getting authentication errors like java.lang.illegalargumentexception: aws access key id , secret access key must specified username or password (respectively) of s3n url, or setting fs.s3n.awsaccesskeyid or fs.s3n.awssecretaccesskey properties (respectively). i looked everywhere here , on web, tried many things, apparently s3 has been changing on lastly year or months, , methods failed one: pyspark.sparkcontext().textfile("s3n://user:password@bucket/key") (note s3n [ s3 did not work]). now, don't want utilize url user , password because can appear in logs, , not sure how them ~/.aws/credentials file anyway. so, how can read locally s3 through spark (or, better, pyspark) using aws credentials standard ~/.aws/credentials file (ideally, without copying credentials there yet config...

shell - Prevent a command being executed from a source'd file in Bash -

shell - Prevent a command being executed from a source'd file in Bash - for security purposes, how can prevent command beingness executed in file source 'd? example: #!/bin/sh source file.cfg wanted: get="value" unintended: command long story short, can't. debate how seek prevent commands beingness executed if security major concern here, source no-go. looking proper configuration facility — while source intended execute code. for example, next code provides trivial key-value configuration file parsing: while read -r x; declare +x -- "${x}" done < file.cfg but both far flexibility source gives you, , far secure solution either. doesn't handle specific escaping, multi-line variables, comments… , doesn't filter assigned variables, config can override precious variables. +x argument declare ensures config file @ to the lowest degree won't modify environment exported programs. if want go rout...

python - Invalid filter: 'revision' -

python - Invalid filter: 'revision' - when using next code: {% ""|add:revision.width|add:"x"|revision.height dimensions %} {% thumbnail revision.image dimensions thumb %} {% endwith %} i receive next error: django version: 1.6.11 exception type: templatesyntaxerror exception value: invalid filter: 'revision' exception location: /usr/local/lib/python2.7/site-packages/django/template/base.py in find_filter, line 366 python executable: /usr/local/bin/python python version: 2.7.9 why? , can prepare it? the problem lastly applied filter in chain ( revision.height ). replace: {% ""|add:revision.width|add:"x"|revision.height dimensions %} with: {% ""|add:revision.width|add:"x"|add:revision.height dimensions %} you can assign variables revision.width , revision.height : {% width=revision.width height=revision.height %} {% ""|add:width|add:"x...

java - JLabel-Array create on Button push -

java - JLabel-Array create on Button push - i want create jlabel of array on button push. i've never done arrays, maybe it's sort of training. tried it, won't work. expected result: everytime force button, 1 of 20 jlabels created. here's class: public class jlabelarray { static jframe frame; static jbutton button; public static void main(string[] args) { final jlabel[] label = new jlabel[20]; // button = new jbutton("push me"); button.setbounds(0, 0, 100, 30); button.addactionlistener(new actionlistener() { public void actionperformed(actionevent e) { // new jlabel should created (int = 0; < label.length; i++) { label[i] = new jlabel("label" + i); label[i].setbounds(button.getx(), button.gety()+ 10 + * 15, 50, 50); frame.add(label[i]); frame.revalidate(); frame.repaint(); } } });...

Hosting a process in C#.Net form disables some process's buttons -

Hosting a process in C#.Net form disables some process's buttons - i trying host .exe within .net application (mainly video viewing software) applications not allow me utilize menu's or controls. has had problem before or thought of why happening? here code host application: #region methods/consts embedding window [dllimport("user32.dll", entrypoint = "getwindowthreadprocessid", setlasterror = true, charset = charset.unicode, exactspelling = true, callingconvention = callingconvention.stdcall)] private static extern long getwindowthreadprocessid(long hwnd, long lpdwprocessid); [dllimport("user32.dll", setlasterror = true)] private static extern intptr findwindow(string lpclassname, string lpwindowname); [dllimport("user32.dll", setlasterror = true)] private static extern long setparent(intptr hwndchild, intptr hwndnewparent); [dllimport("user32.dll", entrypoint = ...

android - How to make a bottom bar in Material theme Drawer activity -

android - How to make a bottom bar in Material theme Drawer activity - for music application, add together bottom bar works current playback display. utilize 1 fragments, add together in mainactivity. i'm not sure how in layout way. may help me there? <android.support.v4.widget.drawerlayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/drawer_layout" android:layout_width="match_parent" android:fitssystemwindows="true" android:background="@color/sonatic_darker" android:layout_height="match_parent"> <!-- framelayout display fragments --> <framelayout android:id="@+id/frame_container" android:fitssystemwindows="true" android:cliptopadding="true" android:layout_width="match_parent" android:layout_height="match_parent" /> <!-- <listview android:id="@+id/list_slidermenu" andro...