Posts

Showing posts from May, 2014

windows - Unknown error occurred in terasso library, unable to connect to teradata using vba -

i have simple code. last line return such error, use not english version, might bit different: " the data source not found , default driver not specified ". private objconn new adodb.connection 'connection... private objrs new adodb.recordset 'recordset... private objerr adodb.error 'errors... dim strsql string, intjobcoderequested integer 'prompt user job code... intjobcoderequested = inputbox("please enter job code desired: ", "teradata program", " ") 'connect database using dsl set in odbc setup... objconn.open "driver=teradatadsn; server=teradata server name; database=database name; uid=user id; pwd=password" so after that: i run 32 bit odbc data source administrator, pressed "add" selected "teradata" list pressed "finish" as result error message unknown error occurred in terasso library i`m using teradata v 14.1. oldp driver installed, according registry.

Changing SQL NOT IN to JOINS -

Image
hello guys, our aim script insert missing pairs of product - taxcategory in intermediate table (producttaxcategory) the following script correctly working trying find way optimize it: insert producttaxcategory (producttaxcategory_taxcategoryid,producttaxcategory_productid) select taxcategoryid ,productid product pr cross join taxcategory tx pr.productid not in ( select producttaxcategory_productid producttaxcategory ) or pr.productid in ( select producttaxcategory_productid producttaxcategory ) , tx.taxcategoryid not in ( select producttaxcategory_taxcategoryid producttaxcategory producttaxcategory_productid = pr.productid ) how can optimize query ? try (full statement now): insert producttaxcategory (producttaxcategory_taxcategoryid,producttaxcategory_productid) select taxcategoryid, productid product pr cross join taxcategory tx not exists (select 1 producttaxcategory producttaxcategory_p

php - Gmail mails fetching with oauth -

http://appdeal.com/appdeal/getmail2.php i trying fetch email. i have when register in website email. link email website using gmail oath. have use these oath token read mails after interval , parse these mails important text email in form of html, parse using xpath. can on this? for fetching e-mails , have 2 options: either use gmail api or using service context.io . if use context.io, can access other inboxes , not gmail. if work gmail api, make sure ask offline access when getting oauth token, otherwise won't able pull e-mails @ later point in time. fetching e-mails directly via imap in php seems quite complex. when comes parsing e-mails , please keep in mind html of e-mails not accurate , xpath method fail when there slight changes in layout. out of experience (i'm founder of mailparser.io ) suggest rely on text patterns parsing. search things can identify "order id:" regular expressions example.

z80 - What is the behavior of the carry flag for CP on a Game Boy? -

on page 87 of the game boy cpu manual claimed cp n instruction sets carry flag when there no borrow , means a < n . seems conflict itself, because carry flag set when a > n . an example: if a=0 , b=1 , cp b sets flags sub a, b , 0 - 1. becomes 0 + 255 = 255 , carry flag not set, though a < b . i came across same issue in other z80 documents well, don't believe typo. am misunderstanding how borrow , sub work or there else going on? sub not equal add two's complement in terms of flags? the gameboy cpu manual has backwards. sub , sbc , cp set carry flag when there borrow. if sub/sbc/cp a,n executed carry set if n > a otherwise clear. this consistent z-80 (and 8080) operation. mame , mess implement carry the same way .

google chrome - How to use the Nacl module compiled by linux Toolchain in Html -

i run "make toolchain=linux" messaging example located under examples/api directory.other toolchains pnacl,newlib,glibc working properly.for linux toolchain generates .so file,nmf not automatically generated,so created using create_nmf command.when change html linux toolchain like <body data-name='messaging' data-tools='linux' data-configs='release' data-path='{tc}/{config}> error "this plugin not supported".i dont know whether possible in way.whether can access .so nexe/pexe.i supposed use linux toolchain because using "alsa/asoundlib.h" available in linux , chrome os platform.finaly tell how access .so file in html. you can run messaging sample linux (native) toolchain invoking: toolchain=linux make run please note, native toolchain support provided debugging aid. shipping applications need built nacl or pnacl toolchain. when run described above, browser launched command-line options allow .so load

java - How to change Content-Location header in SDR association resource? -

in spring project i'm using neo4j database layer, , it's own graphid not entirely reliable, using textual ids (e.g. email address users) nodes. i can change hateoas links in response resources, , work fine. is there way change link in content-location header well?

c# - Incorrect Website Mapping in local folder from TFS -

Image
somehow in tfs, in esqwire service solution website esqwireservice. host has been moved tfs path (in tfs folder structure showing correct) $/esqwire/dev/esqwireservice/esqwireservice/tests/esqwireservice. host but when latest version tfs, website esqwireservice. host showing under wrong path i.e c:\anitha_2\dev\esqwireservice\esqwireservice\esqwireservice. host i had removed mapping tfs on folder esqwireservice. host , after latest version, esqwireservice. host there in correct path in tfs. when try open solution, asks me "new projects added solution open? (because there dependent projects added) . when click ok esqwireservice. host moving wrong path i.e c:\anitha_2\dev\esqwireservice\esqwireservice\esqwireservice. host the correct path should same tfs path c:\anitha_2\dev\esqwireservice\esqwireservice\tests\esqwireservice. host you must edit work space definition on tfs. writing steps. step-1 => open team explorer on visiual studio. step-2 =&g

jquery - Bootstrap table header issue -

Image
have bootstrap table. table header not render in chrome browser. , table css changes when perform append operation. please check code. <div class="panel-body"> <table id="tablerelease" data-height="400" data-search="true" data- click-to-select="true"> <thead> <tr> <th data-field="state" data-checkbox="true"> </th> <th data-field="id" data-sortable="true">sequence</th> <th data-field="stepname" data-sortable="true">step type</th> <th data-field="parameter" data-sortable="true">parameter(s)</th> <th data-field="packageno" data-sortable="true">package no</th> </tr> <

java - Sobel operator doesn't work with rectangle images -

Image
i try implement sobel operator in java result mix of pixels. int i, j; fileinputstream infile = new fileinputstream(args[0]); bufferedimage inimg = imageio.read(infile); int width = inimg.getwidth(); int height = inimg.getheight(); int[] output = new int[width * height]; int[] pixels = inimg.getraster().getpixels(0, 0, width, height, (int[])null); double gx; double gy; double g; for(i = 0 ; < width ; i++ ) { for(j = 0 ; j < height ; j++ ) { if (i==0 || i==width-1 || j==0 || j==height-1) g = 0; else{ gx = pixels[(i+1)*height + j-1] + 2*pixels[(i+1)*height +j] + pixels[(i+1)*height +j+1] - pixels[(i-1)*height +j-1] - 2*pixels[(i-1)*height+j] - pixels[(i-1)*height+j+1]; gy = pixels[(i-1)*height+j+1] + 2*pixels[i*height +j+1] + pixels[(i+1)*height+j+1] - pixels[(i-1)*height+j-1] - 2*pixels[i*hei

html - PHP MySQL Options using JOIN -

i have table... table: forums for_id for_name for_des for_mem 1 forum 1 description 1 mem1@email.com, mem2@email.com 2 forum 2 description 2 null 3 forum 3 description 3 mem1@email.com then have table: members mem_id mem_name mem_email ... 1 jane mem1@email.com 2 jack mem2@email.com 3 smith mem3@email.com i trying create html options list. multi select list display columns in members , select in forums when editing information. example: editing for_id = 1 should display users , select users in for_id=1 's for_mem currently using: <? $data = explode(',',$row[for_mem]); ?> <div class="col-md-9"> <select name="for_mem" id="" multiple class="form-control"> <?php foreach($data $key => $value){?> <option value="<?php echo $value; ?>"><?php echo $value;

php - Static Url of a web application -

my web application url http://www.example.com now want end user see http://www.example.com in there browser inseted of http://www.example.com/index or thing after / not show end user i.e http://www.example.com/abc.php?id= 'someid' will display in user browser http://www.example.com thank in advance , sorry bad english..... there several ways that. rest web service, url shortening, changing alias or creating .htacces file. an easy way creating .htaccess file in root directory. if you’re running apache, can creating redirect in site’s .htaccess file. if don’t have one, create new file called “.htaccess” in site’s web root. save inside .htaccess file: <ifmodule mod_rewrite.c> rewriteengine on # send would-be 404 requests craft rewritecond %{request_filename} !-f rewritecond %{request_filename} !-d rewriterule ^(.*)$ /index.php?/$1 [l] </ifmodule> that rewrite rule says, “if request coming in doesn’t map existing folde

Checking NULL in C# LINQ expression -

i have linq expression converts dateformat utc date format of user culture. for (int = 0; < datexml.count ; i++) { if (datatype.tolower() == "date") { mylist.select(c => { ((object[])(c))[i] = convertfromutcdate( convert.todatetime (((object[])(c))[i]), usertimezone); return c; }).tolist(); } } some times date value in (object[])(c))[i] null or have string or decimal if value wrongly stored in db. how check if values not null , has date , convert in expression. to avoid adding more complexity , being able read , maintain code easily, extract anonymous method , make named method from c => { ((object[])(c))[i] = convertfromutcdate( convert.todatetime (((object[])(c))[i]), usertimezone); return c; } to public datetime convertfromobjecttodate(object dbdate){ if(dbdate null || !(dbdate datetime))return datetime.minvalue; var result = convertfromutcdate(convert.todatetime (dbdate),usertimezone);

Python two loops running one iteration each at a time -

i'm doing experimenting python args , kwargs , ran unexpected issue. code is: def argsandkwargs(*args,**kwargs): sum = 0 arg in args: sum += arg print(sum) i, j in kwargs.items(): print('i ' + + ' , j ' + j) argsandkwargs(5,2,3,6,3,7,actor='rdj',movie='iron man') the output is: 5 movie , j iron man actor , j rdj 7 movie , j iron man actor , j rdj 10 movie , j iron man actor , j rdj 16 movie , j iron man actor , j rdj 19 movie , j iron man actor , j rdj 26 movie , j iron man actor , j rdj if args , kwargs loops separate, expect see: 5 7 10 16 19 26 5 movie , j iron man actor , j rdj why python behaving way? looks it's running 1 iteration @ time each loop, instead of iterations each loop before moving next. double check you're not mixing spaces , tabs. python thinks second loop indented same level print statement above it. thank @kevin, had spaces first loops, , indents secon

php - How to configure XAMPP to send mail from localhost? -

i trying send mail localhost. unable send mail localhost can tell me how reconfigure xampp send mail localhost you can send mail localhost sendmail package , sendmail package inbuild in xampp. if using xampp can send mail localhost. for example can configure c:\xampp\php\php.ini , c:\xampp\sendmail\sendmail.ini gmail send mail. in c:\xampp\php\php.ini find extension=php_openssl.dll , remove semicolon beginning of line make ssl working gmail localhost. in php.ini file find [mail function] , change smtp=smtp.gmail.com smtp_port=587 sendmail_from = my-gmail-id@gmail.com sendmail_path = "\"c:\xampp\sendmail\sendmail.exe\" -t" now open c:\xampp\sendmail\sendmail.ini . replace existing code in sendmail.ini following code [sendmail] smtp_server=smtp.gmail.com smtp_port=587 error_logfile=error.log debug_logfile=debug.log auth_username=my-gmail-id@gmail.com auth_password=my-gmail-password force_sender=my-gmail-id@gmail.com now have done!! cre

java - mousePressed method won't respond -

i'm trying basic: write program draw line on frame between 2 points: point mouse pressed on , point mouse released on. i have these classes: import java.awt.graphics; public class line implements drawable{ private int x1,x2,y1,y2; public line( int x1,int x2,int y1,int y2){ this.x1=x1; this.x2=x2; this.y1=y1; this.y2=y2; } public void draw(graphics g){ g.drawline(x1, y1, x2, y2); } } import java.awt.graphics; public interface drawable { public void draw(graphics g); } import java.awt.graphics; import java.awt.point; import java.awt.event.mouseadapter; import java.awt.event.mouseevent; import java.util.arraylist; import javax.swing.jpanel; @suppresswarnings("serial") public class linepanel extends jpanel { arraylist<line> lines = new arraylist<line>(); public linepanel() { addmouselistener(new mouseadapter() { point p1, p2; @override

php - Unable to Login with Symfony -

i'm doing project symfony version = '2.5.10' . everything's working fine until changed our database , update entities. tried different ways yet still can't log in system. whenever run on either prod or dev environment, gives me error: authentication request not processed due system problem i tried clearing cache manually or through command prompt, tried running these commands: php app\console doctrine:schema:update --dump-sql php app\console doctrine:schema:update --force and tried creating new user using this: php app\console fos:user:create testuser test@example.com p@ssw0rd and saved in database. here's log file: [2015-07-02 08:24:06] event.debug: notified event "kernel.response" listener "symfony\component\httpkernel\eventlistener\responselistener::onkernelresponse". [] [] [2015-07-02 08:24:06] event.debug: notified event "kernel.response" listener "symfony\component\security\http\rememberme\respon

php - Magento system log 2015-07-14T14:48:34+00:00 ERR (3): Warning: Mage_Core_Model_App::dispatchEvent(): Node no longer exists -

we receiving following error on , on , filling system.log file: 2015-07-14t14:48:34+00:00 err (3): warning: mage_core_model_app::dispatchevent(): node no longer exists in /chroot/home/website/html/app/code/core/mage/core/model/app.php on line 1281 this line 1281 1287. how fix this? i'm sure means. foreach ($eventconfig->observers->children() $obsname=>$obsconfig) { $observers[$obsname] = array( 'type' => (string)$obsconfig->type, 'model' => $obsconfig->class ? (string)$obsconfig->class : $obsconfig->getclassname(), 'method'=> (string)$obsconfig->method, 'args' => (array)$obsconfig->args, ); we have flushed cache, re indexed, re run , disable compiler.

android graph view not shown when the data is the same -

i'm using android graph view here works fine , when y value of data same doesn't show thing more whole view visibility gone. can handle appending fake value data point doesn't fine.does have idea. lot! part of code /... datapoint[] datapoints = new datapoint[length]; // populate datapoints linegraphseries<datapoint> series = new linegraphseries<datapoint>( datapoints); graph.removeallseries(); graph.addseries(series); // make other stuff /... you don't need append fake value. in case have mentioned (same value y) works correctly, line created coincides on x-axis y-axis starting y value have set, not zero. changing line colour adding following lines code, able see drawn line. graph.setbackgroundcolor(getresources().getcolor(android.r.color.holo_blue_bright)); series.setcolor(color.green); graph.getviewport().setscalable(true); graph.getviewport().setscrollable(true);

jquery - Javascript function that can be used by many elements and then distinguish which element clicked it -

for example have 12 div tags each represent month. when clicked each 1 display div month , hide other months divs the 12 month divs have class month in common. sections each contain content month have month_section in common , name of month represent uncommon. my javascript code far: $("#january,#february,#march,#april").click(function(e)){ $(".month").removeclass("highlight"); $(".month_sections").removeclass("show"); $(".month_sections").addclass("hide"); if(this == "#january"){(this).addclass("highlight");$(".january").addclass("show");} else if(this == "#february"){(this).addclass("highlight");$(".february").addclass("show");} else if(this == "#march"){(this).addclass("highlight");$(".march").addclass("show");} else if(this == "#april"){(this).addclass("h

html - Div still has height:0px -

i have div has content still has height:0px; , in example can see "index-slideshow" has height:0px; , need "position:absolute;" because photos must 1 above other jquery slideshow. this div has contents hasn't height. what's problem? jsfiddle demo #index-slideshow { margin: 0px; position: relative; width: 100%; padding: 0px; max-width: 100%; box-sizing: border-box; z-index: -1; } #index-slideshow > img { position: absolute; top: 0px; left: 0px; width: 100%; max-width: 100%; margin: auto; box-sizing: border-box; } .wrap { margin: 0 auto; width: 950px; max-width: 93%; border: 0px; padding: 0px 10px 10px 10px; background-color: blue; color: white; } <div id="index-slideshow"> <img src="http://lorempixel.com/400/200"> <img src="http://lorempixel.com/g/400/200"> </div> <div class="wrap"> <p>l

r - Store function definition as a character object -

take following example function temp_fn <- function(){ print("hello world") } i know typing function name without parenthesis return function definition, is: > temp_fn function(){ print("hello world") } however, can't figure out how store printed out character object. example > store_temp_fn <- as.character(temp_fn) error in as.character(temp_fn) : cannot coerce type 'closure' vector of type 'character' you can use capture.output() in combination function name this: temp_fn <- function(){ print("hello world") } temp_fn_string <- cat(paste(capture.output(temp_fn), collapse = "\n")) > temp_fn_string function(){ print("hello world") }>

How to set encoding in IntelliJ javadoc generating? -

while generating javadocs within intellij getting multiple errors files: unmappable character encoding cp1251 file encodings utf-8 . found no places encoding control while javadoc generating. you can pass options javadoc tool intellij idea. adding -encoding utf8 -docencoding utf8 -charset utf8 in other command line arguments text field should fix problem. -encoding specifies encoding of source files. -docencoding encoding of output html files , -charset charset specified in html head section of output files.

jquery - Update element within a cloned div -

i have div <div id="mydiv"><h3 id="myheader"></h3 ></div> and have created few clones of div var $divclone1 = $('#mydiv').clone(); var $divclone2 = $('#mydiv').clone(); var $divclone3 = $('#mydiv').clone(); i want able set value of myheader different in each of 3 clones - idea list individual clones screen different myheader values. how can achieved jquery? ids should unique on page. i'd suggest using class names instead of ids. if need unique ids each element, apply them after cloning. i use jquery once reference original div, make clones of that. <div class="mydiv"><h3 class="myheader"></h3 ></div> var $mydiv = $('.mydiv'), $divclone1 = $mydiv.clone(), $divclone2 = $mydiv.clone(), $divclone3 = $mydiv.clone(); $divclone1.find('.myheader').attr('id', 'clone1').text('clone1'); // a

android - Keep listview item selected even if view changes -

i have listview in fragment. when select listview item, gets highlighted , open fragment. now, want is, when move previous fragment, list item should stay selected. how can that? i have implemented like add 2 methods in adapter private int selectedindex = listview.no_id; public int getselectedindex() { return selectedindex; } public void setselectedindex(int index) { this.selectedindex = index; // re-draw list informing view of changes notifydatasetchanged(); } and in adapter getview(...) // highlight selected item in list if (selectedindex != -1 && selectedindex == position) { yourview.setbackgroundresource(r.color.lightred); } and implement in fragment in setonitemclicklistener onitemclick(...) like adapter.setselectedindex(position); save selected value in preferences , when come again call in fragment on resume(...) adapter.setselectedindex(selectedindex);

replace - In Python, how could I convert a whitespace-delimited log output to a Markdown-formatted table? -

in python, how convert whitespace-delimited log output markdown-formatted table? i have output log contains printouts of following form: - e_jets cutflow: cut events 1 initial 13598 2 grl 7250 3 el_n 25000 >= 1 326 4 el_n 25000 == 1 313 5 mu_n 25000 == 0 313 6 jetclean loosebad 313 7 jet_n 25000 >= 1 113 8 jet_n 25000 >= 2 26 9 jet_n 25000 >= 3 8 10 jet_n 25000 >= 4 2 11 mva_btag mv2c20 -0.4434 2 12 variables 2 13 save 2 - mu_jets cutflow: cut events

ftp - How to specify destination path using mget command -

i trying copy multiple files linux machine windows using mget . files getting downloaded, i'm not able specify destination directory (windows directory) the mget not allow explicitly specify target local directory. it downloads files current local working directory. though, can change local working directory using lcd command: ftp> lcd c:\path local directory c:\path. ftp> mget *.*

vba - How to create a mergefield with a formula containing mergefields -

i want build mergefields decide between data coming 2 different mergefields. example «field_1» should contain: if «field_1» > "" "«field_1»" "«field_2»" i tried following way: sub createfield() dim mergestring string mergestring = "if{mergefield field_1}>"""" ""{mergefield field_1}""""{mergefield field_2}""" selection.fields.add range:=selection.range, type:=wdfieldempty, preserveformatting:=false selection.typetext text:=mergestring end sub also insertformula: sub createfield() dim mergestring string mergestring = "if{mergefield field_1}>"""" ""{mergefield field_1}""""{mergefield field_2}""" selection.insertformula formula:= mergestring end sub but it's mess. unfortunately, code insert text regular string rather mergefields. if insert fields in word manua

javascript - How to add top margin when using html2canvas and jspdf, when the canvas is split on multiple pages? -

i'm using html2canvas , jspdf create pdf of dynamic webpage, when size of canvas great 1 page add page , re-add image shifting next page. working can not figure out how set top margin , result 2nd page onward content on top of page. there way set top margin pages? html2canvas($("#formpdfarea"), { onrendered: function(canvas) { var imgdata = canvas.todataurl( 'image/png'); var doc = new jspdf('l', 'mm', 'letter'); doc.addimage(imgdata, 'png', 5, 0); //output 96dpi, additional pages added if output greater 816 pixels (816p/96dpi = 8.5 inches) if(canvas.height > 816){ for(i=1; i*816<canvas.height; i++){ doc.addpage(); //-215.89mm -8.5inches doc.addimage(imgdata, 'png',5,-215.89*i);

mysql - Why this database migration error after I upgrade my version django-mptt? -

Image
my django application has requirements.txt file (shown here ) use install modules in virtual environment. works fine. however, i'm trying upgrade django-mptt 0.6.1 latest version. (i don't care upgrade django-mptt. want upgrade version of django. seems upgrade django, must first upgrade django-mptt described here ). pip install -u django-mptt . causes django-mptt go 0.6.1 0.7.4 , django go 1.7.1 1.8.2. , causes django-cache-machine origin master. can see changes in screenshot below. then when manage.py runserver prompts me migrate. that. no problems. subsequently if drop tables , run migrate again, error during migration: django.db.utils.operationalerror: (1005, 'can\'t create table `mydb_instance`.`#sql-21b_1e` (errno: 150 "foreign key constraint incorrectly formed")') full stack trace here . what error? have fact i'm using mariadb (server version: 10.0.15-mariadb homebrew) instead of mysql database? edit: portion below point adde

r - Setting weightages for Jarowinkler in compare.linkage -

i'm using compare.linkage method in record linkage package in r compare similarity of 2 set of strings. default string comparing method jarowinkler 3 default weightages set @ 1/3, 1/3 , 1/3. i want overwrite default weightages 4/9, 4/9 , 1/9. how do that? in advance. the default script is: rpairs <- compare.linkage(stringset1, stringset2, strcmp = true, strcmpfun = jarowinkler) you have create own comparison function, compares 2 strings. in function can call jarowinkler . easiest way create closure : jw <- function(w_1, w_2, w_3) { function(str1, str2) { jarowinkler(str1, str2, w_1, w_2, w_3) } } this function pass weight parameters want use. function returns comparison function can use in compare.linkage call: rpairs <- compare.linkage(stringset1, stringset2, strcmp = true, strcmpfun = jw(4/9, 4/9, 1/9)) the jaro-winkler algorithm counts number of characters match (withing bandwidth) m . 2 strings john , johan there 4 characters mat

swift - How to forward streaming media (music ) in ios? -

var url = nsurl(string: musicarr?.objectatindex(count) as! string) player = mpmovieplayercontroller(contenturl: url) self.view.addsubview(player.view) player.moviemediatypes.rawvalue player.preparetoplay() player.play() using movie player , playing media remote url! if click on middle of slider mp3 should start there.

c# - "The ConnectionString property has not been initialized." Error in SQL bulkcopy upload -

Image
i created mvc 4 application,in application have function upload excel file database. this working fine in localhost . but when deploy in iis , try upload excel file.i'm getting following error the connectionstring property has not been initialized. these connection strings i'm using upload excel files <add name="dbconnection" connectionstring="data source="000.000.00.00";initial catalog=affhec_db;persist security info=true;user id=**;password=****" providername="system.data.sqlclient" /> <add name="constr" connectionstring="data source=000.000.0.000;initial catalog=affhec_db;user id=**;password=*****;" /> <add name="excel07+constring" connectionstring="provider=microsoft.ace.oledb.12.0;data source={0};extended properties='excel 8.0;hdr=yes';" /> <add name="excel03constring" connectionstring="provider=microsoft.jet.oledb.4.0;data source={

how to get all combinations between 1 2 3 4 5 6 7 8 using each number once python -

first of inform don't have knowledge python. tryed figure basics searching trough beginner tutorials can't wrap head around those. as have specific thing i'd generate hope theres on here me out. i need possible combinations between numbers 1,2,3,4,5,6,7,8 first , last number have 1 , numbers can't used twice. for example: 1 2 3 4 5 6 7 8 1 - 1 2 3 4 5 6 8 7 1 - 1 2 3 4 5 7 8 6 1 - 1 2 3 4 5 7 6 8 1 - 1 2 3 4 5 8 6 7 1 - 1 2 3 4 5 8 7 6 1 - and on :) from itertools import permutations in permutations(range(2, 9)): = (1,) + + (1,) print(a) for learning more try this: how-to-generate-all-permutations-of-a-list-in-python

php random element from array no siblings -

trying item randomly array( $colors ) without having 2 same colors next each other. <div class="list"> <?php foreach ($team $member): $index++; ?> <div class="member location-<?php echo strtolower($member->location); ?>"> <a style="background: #fff url('<?php echo $member->profileimage; ?>') no-repeat;" data-start-date="<?php echo $member->startdate; ?>"> <?php shuffle($colors); // shuffle array ?> <span class="name" style="background-color: #<?php echo array_pop($colors)->color; ?>"><?php echo $member->name; ?></span> <span class="job-title"><span class="text"><?php echo $member->jobtitle; ?></span></span> </a> </div> <?php endforeach; ?> </div> right have cases when i'm getting color next each other.

javascript - How I pass remoteFunction Value to Java Script in Grails -

can 1 me sort out problem. why javascript file not getting value controller . here javacript code $("#email").click(function() { alert("dhukse"); ${remotefunction( controller: 'login', action:'checknumber', update:'mydiv', params:'\'number=\'+$(\'#phone\').val()' )}; alert(${number}); }); here controller function def checknumber(){ def number=params.number println params.number def key def user=login.findbyphone(params.number) println user if(user){ key=1 } else{ key=0 } println key //println user.phone [number:key] } file.gsp: <div id="mydiv"></div>

sails.js - undefined is not a function- Error in Sails -

i facing following error in sails when run sails lift follows usr/local/lib/node_modules/sails/node_modules/waterline/lib/waterline/util /schema.js:59 attributes[key].type = attributes[key].type.tolowercase(); typeerror: undefined not function @ /usr/local/lib/node_modules/sails/node_modules/waterline/lib/waterline/util s/schema.js:59:51 @ array.foreach (native) @ object.schema.normalizeattributes (/usr/local/lib/node_modules/sails/node_modules/waterline/lib/waterline/uti ls/schema.js:45:22) @ module.exports (/usr/local/lib/node_modules/sails/node_modules/waterline/lib/waterline/core/index.js:42:34) @ module.exports (/usr/local/lib/node_modules/sails/node_modules/waterline/lib/waterline/collection/index.js:44:8) @ new child (/usr/local/lib/node_modules/sails/node_modules/waterline/lib/waterline/utils/extend.js:17:39) @ initialize (/usr/local/lib/node_modules/sails/node_modules/waterline/lib/waterline/collection/loader.js:

performance - Data transfer in SQL Server 2008 R2 -

i have following requirement in sql server 2008 r2, trying implement in stored procedure source table t 100000 records, needs insert destination table t1 . job scheduled , run 24x7 every hour (both tables on same server in different schema) during data transfer if process fails because of source data issue specific record process should update record has data issue in source table t (data issue) , before whatever records inserted destination table t1 should have commit , update source table (success). in next run process avoid records , pick new records source t transfer t1 . performance main factor destination db server extremely busy , process should not have overload database. can please share solution requirement. thanks in advance.

C# Multiple Interface Inheritance does not allow public access modifier with same name -

so has me perplexed. suppose 2 interfaces. public interface { void foo(); } public interface b { void foo(); } both of interfaces have function foo, have class provides explicit implementation: public class alpha : a, b { // why can't put access modifier here? // how able hide derived class void a.foo() { console.writeline("a"); } void b.foo() { console.writeline("b"); } } and class derived alpha public class beta : alpha { } how make foo private or protected since alpha doesn't allow access modifiers on explicit imlementation, can stop calling: var = new beta(); (be b).foo(); edit how come when don't explicitly provide implementation can provide access modifier? public class alpha : a, b { //why compile? public void foo() { console.writeline("both"); } } since interface a public, class implements a must make methods of a public

internationalization - Change InternationalizationCheck from JSTL '<fmt:message key>' format? -

in sonarqube web plugin, internationalizationcheck rule searches internationalization in form of <fmt:message key=...> . there way change this? internationalization in format <f: message key=...> . assume alterable in 'attributes' section, haven't figured out section for, or put there. for example, rule searches internationalization in form of <fmt:message key="login.label.username" /> as described in rule's noncompliant/compliant code example. however, in application, internationalization takes form of <f:message key="login.label.username" /> which incorrectly labelled error rule. nothing in internationalizationcheck's source code shows how explicitly looks format, need find way make accept format acceptable line of code instead of giving false positive. is there way specify internationalizationcheck different format of internationalization, other jstl taglib prefix of 'fmt'?

c# - Using unmanaged function in managed code giving error:Attempted to read or write protected memory -

Image
i trying use c++ dll methods in c# project , 1 of method working fine other 1 giving error:attempted read or write protected memory. indication other memory corrupt. don't know reason behind it. pure guesswork of mine: in c++ long different thing in c#. if c++ functions have parameters long or unsigned long , in c# should use int , uint respectively. i guess issue, since using c#/long client port strange. don't need 64bit number that. if that's signature mismatch, third stirng parameter response damaged during marshalling , c++ side invalid pointer there. your current c# implementation corresponds c++ signature: long fk_sendresponse(string addr, long port, string response); //<-> int64 fk_sendresponse(char const* addr, int64 port, char* response) i guess wanted use: /*c#*/ int fk_sendresponse(string addr, int port, string response); //<-> /*c++*/ long fk_sendresponse(char const* addr, long port, char* response) or /*c#*/ uin

scope - PHP - Accessing variables in an included script from an included script -

i have list of files require_once @ beginning of main scripts. in 1 of files, have bunch of functions. in 1 of files, have bunch of constants (which variables @ moment, constants). main.php require_once \constants.php require_once \functions.php from within main.php, able call functions , call constants respective scripts... able call functions , pass constants constants.php parameters functions. however, not able use functions have constants embedded within them. in other words, cannot use functions functions.php have variables constants.php file within functions, able use functions functions.php if not have variables other included files within function. function firstfunction(){ echo $constant1; return 1 } firstfunction() uses $constant1 constants.php , not work. function secondfunction($param){ echo $param; return 1 } secondfunction() can passed $constant1 constants.php parameter , works fine. questions: is there way me able use main.php call function fi

Algorithm for finding connected subgraph of a vertex weighted graph with a sum close to a given value -

Image
given vertex weighted graph g (depicted below), vertex v graph , integer value x, there known algorithm finding connected sub graph of g such target vertex in sub graph , sum of weights of sub graph close x possible? moreover, if exact match of x cannot found, algorithm should still return sub graphs closest x possible. some examples given graph below: v = f, x = 12. a,b,f,i , f,g,c,d solutions. v = c, x = 16. c,d,e,h solution. finding solution looks variant of knapsack problem me, additional constraint items in knapsack must form connected graph. one approach check possible subgraphs containing v , searching maximum weight (up x ): you use kind of greedy algorithm, starting node v , adding 1 adjacent node after another, keeping track of total subgraph weight. if reach x , finished, if overshoot x , must backtrack , select other nodes subgraph. during whole algorithm, keep track of "best" subgraph, if no exact solution found in end, still have best

MacVim still uses the built-in Vim location when changing themes -

i new vim. have been trying change theme macvim 7.4, when added theme file papercolor.vim ~/applications/macvim7.4/colors , restarted it, nothing changed. but when added theme file papercolor.vim ~/.vim/colors , macvim changed theme successfully. notice have aliased command vim to: ~/applications/macvim7.4/macvim.app/contents/macos/vim is because did not change default path macvim? thank you. ~/.vim/ is only location should put third party scripts.

javascript - JS load image on click only -

i need function in js load image on click only. use api , if load captcha image every page load after few requests bans me because not visitors enter captcha. o have http://site.tld/?captcha_image=3382894 wich if load every time page loads got banned flood. so need when visitor uses api let's appears text "click here enter captcha", when clicks image loaded. i don't know js @ all, appreciate help... thanks! $("button").click(function () { var imgurl = $(this).data('rel'); $("#area").html("<img src='" + imgurl + "' alt='description' />"); }); <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script> <button data-rel="http://www.lemis.com/grog/photos/20110726/big/capcha.gif">click</button> <div id="area"></div> reference link

c# 4.0 - error : is a field but used as a type -

using system; using system.collections.generic; using system.componentmodel; using system.data; using system.drawing; using system.linq; using system.text; using system.windows.forms; using system.io; namespace windowsformsapplication5 { public class clientcontext { private string p; public clientcontext(string p) { // todo: complete member initialization this.p = p; } } public partial class form1 : form { public form1() { initializecomponent(); } //first construct client context, object responsible //communication sharepoint: private clientcontext context = new clientcontext("@url"); //then hold of list item want download, example public list list; public clientcontext { list = context.web.lists.getbytitle("001_cfr_dpv_cost_rev_sharing"); } //note data has not been loaded yet. in