Posts

Showing posts from February, 2015

javascript - AngularJS using ng-click inside a div -

i can't ng-click work, i'm trying pass url inside div when user clicks goes next page, when click on div can see getting right link instead of going next page returns home. <div ng-repeat="contatoscliente in contatos" class="conteudo" type="item-link" ng-click="urlcontato('#/app/contatos/' + contatoscliente.contatos_id)"> {{contatoscliente.nome}} <i class="ion-ios-arrow-right" style="border: none; padding-right: 11px"></i> </div> and controller: $scope.urlcontato = function ( path ) { $location.path( path ); }; $location.path should called forward slash, without hash. https://docs.angularjs.org/api/ng/service/$location <div ng-repeat="contatoscliente in contatos" class="conteudo" type="item-link" ng-click="urlcontato('/app/contatos/' + conta...

javascript - Why does my loop gone infinite loop? -

i writing function find prime factors of number. in function, has got 2 loops. 1 finding factors, finding prime factors first loop. second loop has gone infinite, haven't spotted anywhere in loop make infinite. did miss? function findprimefactors(num) { var factors = []; var primefactors = []; var currindex = 0; var initfactorslen; var currcompose; (i = 1; <= num; ++i) { if (num % == 0) { factors.push(i); } } var initfactorslen = factors.length; (i = 0; <= initfactorslen; ++i) { //this infinite loop console.log("i " + + " , factors " + factors); currcompose = factors[i]; var primetest = isprime(currcompose); if (primetest == true) { primefactors.push(currcompose); } } return primefactors; } function isprime(num) { var sqrtnum = math.sqrt(num); var ceilednum = math.ceil(sqrtnum); if (num == 1 || num == 0) { return false; } else if (num == 2) { return true; } else { (i = 2; <= ceilednum; ++i) ...

create vertical tabs in tabpane javafx -

Image
by default if create tabpane in scene builder , add tabs in horizontal order on top of tabpane, how can add vertical tabs on left side of tabpane? thanks just select "left" under dropdown "side":

excel - Incorrect answer when matching rows on two criteria -

this should simple, yet painful. i merely want find recent scores each id. data looks this: id date score1 score2 747 1/4/12 1 -6 747 1/28/11 1 -6 747 4/21/10 0 1 747 2/6/13 1 -6 747 3/4/09 1 -6 747 3/19/08 1 -6 747 11/8/06 1 -6 2442 5/3/12 1 -6 2442 1/13/15 1 -6 2442 5/4/11 1 -6 2442 6/2/10 1 -6 2442 5/8/09 1 -6 the result should this: id date score1 score2 747 2/6/13 1 -6 2442 1/13/15 1 -6 i think 1 of common operations imaginable in excel. i googled around , found out pivot table isn't right solution multiple criteria. found nice tutorial here . the formula =index(a2:d431,match(1,(a:a=a2)*(b:b=max(b2)),0),1) makes sense me. reason keep getting incorrect date. don't understand wrong simple formula. data here . any advice appreciated. if 2 id's found in g2...

SQL update from same table / multiple lists and items -

i need update table looks this: no. item location score available price some_more_text 1 water london 0,00 1 water amsterdam 1 yes 1,11 alpha 1 water burges 1 yes 1,11 alpha 2 honey london 0,00 2 honey amsterdam 5 yes 5,55 omega 2 honey burges 5 yes 5,55 omega 3 spoon london 4 yes 3,33 gamma 3 spoon amsterdam 4 yes 3,33 gamma 3 spoon burges 4 yes 3,33 gamma 4 books london 0,00 4 books amsterdam 1 no 2,55 alpha 4 books burges 1 no 2,55 alpha 5 juice london 0,00 5 juice amsterda...

SQL Server --- using raiserror without status accident -

i wanted user raiserror in sql-server codes noticed status code have interruption built-in sql error statuses... for example status code "1" used "devide 0 error", , dont wanna use more... want see status codes safe use withour interruption ? if want use own msgid use value of greater 50000. values below 50000 reserved built in messages. see list of existing messages can 'select * sys.messages'. 50000 used when value msgid not provided.

javascript - An object of array must contain specific members/names -

how can validate object of arrays that's passed parameter jquery plugin make sure contains specific members/names? for example, want validate if object below has 'name', 'id' & 'location', 3 members, in case should true. var arr = [{ name: 'johny', id: 1, location: 'usa' }, { name: 'mike', id: 4, location: 'can' }]; thanks in advance. johny you can use array.prototype.every method test every object in array conforms necessary keys rules: var valid = arr.every(function(obj) { var keys = object.keys(obj); return keys.length === 3 && 'name' in obj && 'id' in obj && 'location' in obj; });

java - Using JooQ to "batch insert" from a CSV _and_ keep track of inserted records at the same time? -

i have csv is... 34 million lines long. yes, no joking. this csv file produced parser tracer imported corresponding debugging program . and problem in latter. right import rows 1 one: private void insertnodes(final dslcontext jooq) throws ioexception { try ( final stream<string> lines = files.lines(nodespath, utf8); ) { lines.map(csvtonode) .peek(ignored -> status.incrementprocessednodes()) .foreach(r -> jooq.insertinto(nodes).set(r).execute()); } } csvtonode mapper turn string (a line of csv) nodesrecord insertion. now, line: .peek(ignored -> status.incrementprocessednodes()) well... method name tells pretty everything; increments counter in status reflects number of rows processed far. what happens status object queried every second information status of loading process (we talking 34 million rows here; take 15 minutes load). but jooq has (taken documentation) can load dir...

git - Multiple Unsynced versions of repo -

Image
currently have 2 unsynced versions of repo. tried sync last night , because wifi connection poor, timed out after hour. deleted of larger files in repo in hopes of being able sync, , made other changes. my question: when press sync, attempt sync latest version of repo or have sync 1 yesterday well? sidenote: there way improve speed of sync besides finding better connection? by default, you'll whole history in repository yes, it'll sync changes yesterday well. what can do, if repo not synced anywhere else (otherwise, you'll messy stuff), interactive rebase of changes before added big files. concretely, find commit ok , rebase editing subsequent commits (or leaving them out).

ruby on rails - Rspec: Testing nested destroy action -

i trying test 'destroy' action nested comments controller. post has_many comments . have ran similar issues before , understand need pass id, i'm still running familiar error... failures: 1) commentscontroller#delete destroy deletes comment failure/error: delete :destroy, comment: create(:comment), post_id: @post actioncontroller::urlgenerationerror: no route matches {:action=>"destroy", :comment=>"1", :controller=>"comments", :post_id=>"1"} # ./spec/controllers/comments_controller_spec.rb:19:in `block (3 levels) in <top (required)>' comments_controller_spec.rb rspec.describe commentscontroller, :type => :controller before :each @post = factorygirl.create(:post) end .... describe '#delete destroy' 'deletes comment' delete :destroy, comment: create(:comment), post_id: @post expect(respo...

python - Heroku Sporadic High Response Time -

Image
this specific, try brief: we running django app on heroku . 3 servers: test (1 web, 1 celery dyno) training (1 web, 1 celery dyno) prod (2 web, 1 celery dyno). we using gunicorn gevents , 4 workers on each dyno . we experiencing sporadic high service times . here example logentries: high response time: heroku router - - at=info method=get path="/accounts/login/" dyno=web.1 connect=1ms service=6880ms status=200 bytes=3562 i have been googling weeks now. unable reproduce @ experience these alerts 0 5 times day. notable points : occurs on 3 apps (all running similar code) occurs on different pages, including simple pages such 404 , /admin occurs @ random times occurs varying throughput. 1 of our instances drives 3 users/day. not related sleeping dynos because ping new relic , issue can occur mid-session unable reproduce @ will. have experienced issue once. clicking page executes in 500ms resulted in 30 second delay , app error screen...

Get text of td following the second occurrence of an element in Selenium using Python -

i'm trying find text after remarks field in form. however, table has multiple remarks fields. want able grab text in td follows td of second remarks field. have following html: <table> <tbody> <tr>...</tr> <tr>...</tr> <tr> <td>remarks:</td> <td>this first remarks field </tr> <tr> <td>anotherfield:</td> <td>content of field</td> </tr> <tr> <td>remarks:</td> <td>this second remarks field</td> </tr> <tr>...</tr> </tbody> </table> to grab text out of first remarks field, can following: ret = driver.find_element_by_xpath("//td[contains(text(),'remarks')]/following::td") print ret.text however, need grab content out of second remarks field. has done based on index of occurrences of 'remarks', not based on inde...

web development server - How I can get user input from browser using python -

i in middle of personal website development , using python create "comment section" visitors leave comments @ there in public (which means, can see it, don't worry user name registration things). set sql database store data thing haven't figured out yet how user input (their comments) browser. so, there modules in python that? (like, "charfield" things in django, unfortunately don't use django) for need web framework bottle or flask. bottle simple wsgi based web framework python. using either of these may write simple rest based apis, 1 set , other get. "set" 1 accept data client side , store on database "get" api should return data reading db. hope helps.

.net - Webforms ScriptResource.axd ArgumentTypeException - Ajax -

using .net 4.5, have set of controls contained within updatepanel. 1 of these controls drop down partial page postback. if enter form , click submit button outside of updatepanel , select item in drop down within updatepanel, im getting js error scriptresource.axd sys>argumenttypeexceltion: object of type object cannot converted type string. parameter name value. the server side postback event on drop down not fired in case, due form containing hidden field id of "action"

linking javascript file to wordpress child theme -

i'm trying link javascript file child theme. i've looked @ wordpress codex , numerous examples, still not working. i'm working on localhost, have read, want use get_stylesheet_directory(). i've echoed out , pointing correct path. below code placed in functions.php child theme: add_action( 'wp_enqueue_scripts', 'theme_js' ); function theme_js() { wp_enqueue_script( 'theme_js', get_stylesheet_directory() . '/js/theme.js', array('jquery'), '', true ); } my javascript file looks this: /** * custom theme styles */ ( function( $ ) { $('.main-navigation li a').click(function() { var link = $(this).attr('href'); $('html, body').animate({ scrolltop: $(link).offset().top }, 1500); }); })( jquery ); the src string in enqueue needs url, not path, need use get_stylesheet_directory_uri() instead of get_stylesheet_directory() : add_action( 'wp_enqueue_scripts...

javascript - What is the difference between !!variable and variable -

this question has answer here: when use double not (!!) operator in javascript 2 answers i have seen developers use variables in way not make sense me, , have seen more commonly in angularjs. consider code: var somevariable = (someothervariable === 'true'); if (!!somevariable) { // stuff here } why not leave out 2 exclamation marks? not same? benefit of doing this? the double not operator !! coerces (potentially non-boolean) value boolean. in specific example: var somevariable = (someothervariable === 'true'); if (!!somevariable) { // stuff here } somevariable guaranteed boolean (since result of === comparison boolean) coercing boolean not change operation in way , pretty wasted code. if wasn't boolean, don't need coerce boolean test if (somevariable) either there's yet reason not use !! here. when !!...

python - Format a string with a space between every two digits -

input: string = 53434951 i need split string output reads: 53 43 49 51 you use like: s = "534349511" print ' '.join([s[i:i+2] in range(0,len(s),2)]) note work lists of uneven length -- you'll have single digit @ end, after space.

int - Read address using Console.ReadLine() C# -

i tried read memory address using: int address = console.readline(); as see doesn't work, how can this? value read: 0x007fcb20 capture string first. e.g. string address = console.readline(); then convert string integer: int32 addressint = convert.toint32(address, 16);

java - Paint doesnt seem to be painting things -

Image
i've been trying tp paint image of cheetah mess around paint method , such, doesn't seem working, idea why? i've tried ton of stuff found on here nothing seems toi work @ all, button, know actual paint method not working because doesn't pain hello string. here's main class: package dev.main; import javax.swing.jframe; import javax.swing.jpanel; import dev.angora.gui.gamegui; @suppresswarnings("serial") public class main extends jframe { public static jframe p = new jframe("angora realms"); public static void main (string[] args) { new main(); } public main() { p.setdefaultcloseoperation(jframe.exit_on_close); p.pack(); p.setsize(640, 800); p.setvisible(true); p.setlayout(null); gamegui g = new gamegui(); g.creategui(p); } } and here class try paint in: package dev.gui; import java.awt.button; import java.awt.graphics; import java.awt.gra...

Bash test if #- in string but NOT #-# or #-#-# -

i have 5 different references file , locations in it, in; search | contents #- | some.htm#9-22 called pat= #-# | some.htm#1-some.htm#3 called pat2= #-#-# | some.htm#21-some.htm#-some.htm#4 called pat3= ; | some.htm#6-some.htm#13;some.htm#22-23 called pat4= else | some.htm# there 550 of these references in csv data file. the problem having figuring out how test variable contains reference see if contains search colum listed above. know contains special characters. have not found reference searching them in test online. pat=[#-] if [[ $aliyah == $pat ]]; shir1="$(echo "$aliyah" |awk -f \# '{print $1}')" start1="$(echo "$aliyah" |awk -f \# '{print $2}'|awk -f - '{print $1}')" end1="$(echo "$aliyah" |awk -f - '{print $2}')" return thanks so made changes recommended below have no joy. test...

Pointers in C Programming- Coordinate conversion -

i should write program convert cartesian coordinates polar , vice versa use of pointers, wrote following code function gives me segmentation fault. tried without pointers , still doesn't send numbers function, can modify pointer code? i'm new c. #include <stdio.h> #include <math.h> void cart(float *radius,float *degree) { float *x,*y,*radians; *radians= (3.14159265359/180) * *degree; *x= *radius * cos(*radians); *y= *radius * sin(*radians); } int main() { float radius, radians, degree; float x,y; int m; char c,p; printf(" enter c if converting cartesian polar \n"); printf(" enter p if converting polar cartesian \n"); scanf("%c",&m); if (m=='p') { printf("enter radius , angle separated comma \n"); scanf("%f,%f",&radius,&degree); cart(&radius,&degree); printf("cartesian form (%f,%f) \n",x...

graph - Graphing in R - combining factors -

this odd request, don't know if function exist, hoping there might be. basically, have number of variables i'm looking @ give outcome , typical data below sample daylength expt line protein 1 ld l k 100 2 sd s r 150 3 ld l r 200 4 sd s k 120 5 ld l k 95 6 sd s r 160 7 ld l r 195 8 sd s k 130 so have 3 dependant variables (daylength, expt, line) , 1 outcome variable of protein. however, i'd looking @ in graph comparing protein levels showing bars l , s experiments an example of code use draw bar graph ggplot2 is: ggplot(data=results, aes(x=daylength, y=protein, fill=line)) + geom_bar(stat="identity", position=position_dodge()) and give me graph showing results ld , sd experiments lines offering separate series. however, n...

Solve the Closest Pair Algorithm with recursion(Divide and Conquer) -

i understand how solve infamous "closest pair problem" using brute force, simple algorithm in o(n^2) running time might work recursively? problem is given set of n points, write code find closest pair of points what simple recursive function can used solve problem? here's test problem, first number number of points , following lines contain points themselves: 6 0 5 1 13 5 9 1 8 3 10 6 10 this code finds nearest pair of points of using divide , conquer, , runs in o(n^2) time. efficient algorithm (which you're trying understand) replaces part starts "for left in pl": instead of comparing every pair of points left , right sides, compares @ 6 points right side every point on left. the closest function here returns distance squared of nearest pair pair of points. that's convenient taking min s. import itertools def dist2(a, b): return (a[0] - b[0]) ** 2 + (a[1] - b[1]) ** 2 def closest(a): if len(a) <= 3: return ...

Get HTML Equivalent of Google Doc contents -

i trying html google doc's contents. methods have found seem use deprecated items. want use doc template email. have working except getting html version of text. yes, want full html version including tables, images, , else can place in doc. is there way this? regards, karl s i believe following method works: open google doc want work with click file --> publish web click link , publish copy link tab view source page , copy inside , including <div id="contents"> this should complete html document. verified works document of mine. let me know if doesn't.

ios - Hide controls in AVPlayerViewController -- only at start -

if set avplayerviewcontroller.showsplaybackcontrols false, controls not show @ all. if tap screen. i want controls start out hidden, still able summon them tapping. if set mentioned property true, start out visible. (yes fade after few seconds.) there way start hidden, still accessible? update: ended making own controls better customization. it's more difficult worth time. please read apple's sample code reference. it's implementing pip making custom controls: https://developer.apple.com/library/prerelease/ios/samplecode/avfoundationpipplayer/introduction/intro.html update: when tapped, avplayerviewcontroller fires touchesbegan event, , not touchesended event. it's enough show controls. first need hide control. put code right before present avplayerviewcontroller youravplayerviewcontroller.showsplaybackcontrols = false then subclass avplayerviewcontroller , add function: override func touchesbegan(touches: set<uitouch>, withevent event: ...

.net - C++/CLI WinForms: BeginInvoke Error -

i unable figure out reason error: invoke or begininvoke cannot called on control until window handle has been created. here (stripped) code: private: delegate void mydelegate(object^ openfiledialog1); listview^ mydelegate; private: void import_links(object^ openfiledialog1) { mydelegate = (gcnew system::windows::forms::listview()); mydelegate->begininvoke( gcnew mydelegate( this, &form1::import_links ), openfiledialog1); //do work here } private: system::void import_linkclicked(system::object^ sender, system::windows::forms::linklabellinkclickedeventargs^ e) { openfiledialog^ openfiledialog1 = gcnew openfiledialog; if ( openfiledialog1->showdialog() == system::windows::forms::dialogresult::ok ) { thread^ importthread = gcnew thread(gcnew parameterizedthreadstart(this,&form1::import_links)); importthread->start(openfiledialog1); } } please let me know sol...

Does an Android class exist with similarities to both Spinner and AutoCompleteTextView? -

i trying take autocompletetextview and, through onlistitemclicklistener , return id database. more specific, want user able type in, click on 1 of options pops up, , then, rather completing typed word, click returns id associated word user. i know that, through custom adapter, can return id through spinner , want user able type in they're looking for. there way through autocompletetextview , or class exist can this? thank you! afik there no such class both functionalities. you can try following code that... final autocompletetextview mautocompletetextview; final arrayadapter<string> madapter = new arrayadapter<string>( getactivity(), android.r.layout.simple_dropdown_item_1line, getresources().getstringarray(r.array.items)); mautocompletetextview = (autocompletetextview) view.findviewbyid(r.id.name_txt); mautocompletetextview.setadapter(madapter); mautocompletetextview.setonclicklistener(new view.onclicklist...

for loop - Python Text Document Translation Comparison -

fairly simple question. i'm trying create "translation comparison" program reads , compares 2 documents , returns every word isn't in other document. beginner class, i'm trying avoid using obscure internal methods, if means less efficient code. have far... def translation_comparison(): import re file1 = open("desktop/file1.txt","r") file2 = open("desktop/file2.txt","r") text1 = file1.read() text2 = file2.read() text1 = re.findall(r'\w+',text1) text2 = re.findall(r'\w+',text2) item in text2: if item not in text1: return item you might try #######test data #file1.txt = test #file2.txt = test #results# #is def translation_comparison(): open("file1.txt", 'r') f1: f1 = f1.read().split() open("file2.txt", 'r') f2: f2 = f2.read().split() word in f1: if word not in f2: pri...

symfony - DQL - JOIN WITH properties of a relation -

my question similar this, different. can join on subquery doctrine 2 dql? i want rooms regardless, , left join occupants belong booking exists on given date. for example (a plain mysql result set - doctrine return objects): room id | occupant id | booking id | booking start | booking end 1 | 1 | 1 | before today | after today 1 | 2 | 1 | before today | after today 2 | null | null | null | null here's i'm trying: select r, a, b mybundle:room r left join r.occupants a.booking not null left join a.booking b b.enrolmentstart <= :date , b.enrolmentend >= :date , b.status = 1 order r.number asc unfortunately, gets rooms, people ever stayed in room ever, bookings exist on given date. on other hand, if change following, i'm given rooms have bookings on given date. left join r.occupants a.booking not null join a.booking b if try following, doctrine says didn't ...

Possible to display public images using instagram -

how can load public images using instagram without use access tokens , client id.what things required show public photos of instagram. if going retrieving media information instagram's api, @ least need access token. here endpoint retrieving public, popular media https://instagram.com/developer/endpoints/media/#get_media_popular : https://api.instagram.com/v1/media/popular?access_token=access-token

ios - How can I detect if a photo has already been imported to a photo album? -

i've got app copies screenshots device onto ios device , adds them photo album, using [alassetslibrary assetforurl] , [alassetsgroup addasset] . every time adds screenshots if they've been added previously. there way of knowing whether i've imported image? can't use filename because screenshots use simple index gets incremented.

php - How to store login details like time of login and which machine (ip address) -

i beginner php. my project in php , backend sql. i have login form.i want maintain activity log.how that? that includes: 1.login time logout time 2. machine name(ip address) 3.status( sign in pass/fail) thanks in advance. you need use php functionality here. do this: 1.login time logout time $time = date('y-m-d h:i:s'); 2. machine name(ip address) $ipaddr = $_server['remote_addr'] 3.status( sign in pass/fail) need check using mysql query. let me know more help.

mysql - php smarty if else loops not working -

basically putting if elses array. {if $array| count eq 0 || $array| count lt 10} <p>equal 0, less 10</p> {/if} {if $array| count gte, ge 10} <p>greater or equal 10</p> {else} <p>blah</p> {/if} which not working fine. problem? how this. can use gte or ge, not both. {if $array| count lt 10} <p>equal 0, less 10</p> {/if} {if $array| count ge 10} <p>greater or equal 10</p> {else} <p>blah</p> {/if}

apache - Hadoop DistributedCache caching files without absolute path? -

i in process of migrating yarn , seems behavior of distributedcache changed. previously, add files cache follows: for (string file : args) { path path = new path(cache_root, file); uri uri = new uri(path.touri().tostring()); distributedcache.addcachefile(uri, conf); } the path typically /some/path/to/my/file.txt which pre-exists on hdfs , end in distributedcache /$distro_cache/some/path/to/my/file.txt i symlink in current working directory , use distributedcache.getlocalcachefiles() with yarn, seems file instead ends in cache as: /$distro_cache/file.txt ie, 'path' part of file uri got dropped , filename remains. how work different absolute paths ending same filename? consider following case: distributedcache.addcachefile("some/path/to/file.txt", conf); distributedcache.addcachefile("some/other/path/to/file.txt", conf); arguably use fragments: distributedcache.addcachefile("some/path/to/file.txt#file1", conf)...

javascript - I called Socket.io function and Uncaught TypeError: undefined is not a function -

i'm making socket.io chat application, , got trouble @ javascript. this javascript file (client) <script src="https://cdn.socket.io/socket.io-1.2.0.js"></script> <script src="https://code.jquery.com/jquery-1.10.2.js"></script> <script> $(document).ready(function() { // make new chat div $("#topic_button").click(function(e) { e.preventdefault() var domelement = $('<div class="content"><div class="messages"><ul class = "other_message" class="title"><h3>'+$("#m").val()+'</h3></ul>'+'상대방'+'<div class="my_message">'+'내메시지' +'</div></div><div class="type_div"><form action="" class="chat_form" onsubmit="event.preventdefault();"><input autocomplete="off" /><button class=...

java code for deadlock situation? -

here code public class testdeadlockexample1 { public static void main(string[] args) { final string resource1 = "xyz"; final string resource2 = "pqr"; // t1 tries lock resource1 resource2 thread t1 = new thread() { public void run() { synchronized (resource1) { system.out.println("thread 1: locked resource 1"); try { thread.sleep(10000);} catch (exception e) {} synchronized (resource2) { system.out.println("thread 1: locked resource 2"); } } } }; // t2 tries lock resource2 resource1 thread t2 = new thread() { public void run() { synchronized (resource2) { system.out.println("thread 2: locked resource 2...

swing - Java setResizable issue -

package data; import java.awt.eventqueue; import javax.swing.jframe; import javax.swing.jpanel; public class main extends jframe implements runnable { private jpanel contentpane; private jpanel pp = new jpanel(); thread page = new thread(); public void run() { while (!thread.interrupted()) { } } public main() { setdefaultcloseoperation(jframe.exit_on_close); setbounds(100, 100, 640 + 16, 480 + 39); contentpane = new jpanel(); contentpane.setbounds(0, 0, 640, 480); contentpane.setlayout(null); setcontentpane(contentpane); pp.setbounds(0, 0, 640, 480); pp.setbackground(color.black); contentpane.add(pp); } public static void main(string[] args) { eventqueue.invokelater(new runnable() { public void run() { try { main frame = new main(); frame.setvisible(true); fra...

javascript - Get value of an array based on priority -

i have object array based on priority need form object array. below code tried var data_res = [{ "action_type": "create", "execution_type": "n_execution" }, { "action_type": "create", "execution_type": "r_pre_execution" } ]; var arr = ["r_pre_execution", "s_pre_execution", "n_execution"]; (var = 0; < data_res.length; i++) { (var temp in arr) { if (data_res[i].rule_execution_type.indexof(arr[temp])>-1) { console.log("data") console.log(json.stringify(data_res[temp])) } } the output i'm getting is data undefined data {"action_type":"create","execution_type":"n_execution"} i want data based on array arr . first r_pre_execution data must formed s_pre_execution , n_pre_execution , don't know i'm going wrong. it looks want sort data_res according orde...

scope - As a Member is to a List, What is a List to a Member? -

i'm not quite sure if should under cstheory.stackexchange.com, or here, i'm posting here because feels less out of place me. question terminology. a piece of data stored in object called member. storing object in array, int in object or object in object. if want talk object accessing contains, say: "should foo able access it's member bar". what if want talk reverse in abstract? "should bar able access it's ___, foo". examples: what game's map objects stores? what game-state map , user interface stores? what renderer objects renders (potentially different?)

postgresql - The function pg_query() gives an error in php -

i want insert data in pgsql database. function pg_query() gives error when want insert data. error is: warning: pg_query() [function.pg-query]: query failed: error: array value must start "{" or dimension information line 1: insert demo_insert(id, name) values ('1234', 'abcd') ^ in c:\wamp\www\netbeansprojects\phpproject1\index1.php on line 19 my code follows: <?php require_once "connection.php"; //page connection database pg_set_client_encoding($dbconn, "unicode"); //$dbconn variable pg_connect() executed $id="1234"; $name="abcd"; $query = "insert demo_insert(id, name) values ('$id', '$name')"; $result = pg_query($dbconn, $query); if($result) { echo "1 row inserted"; } ?> can please tell me solution of error? it looks 1 of columns array type, not "normal" type. show table definitions?...

.net - get multiple values form the database and show in combo box and different text boxes when the index change c# -

try { // var model =execute.q"select product.id, product.productname, product.unitid, product.productcode, units.name product inner join units on product.unitid = units.id"; string query1 = "select product.id, product.productname, product.unitid, product.productcode, units.name product inner join units on product.unitid = units.id"; command = dbconnectivity.getcommandforquery(query1, connection); dataset = new dataset(); adapter = new sqldataadapter(command); adapter.fill(dataset); int reslut = command.executenonquery(); this.cbproductname.displaymember = "productname"; this.cbproductname.valuemember = "id"; datarow = dataset.tables[0].newrow(); datarow["productname"] = "select product"; dataset.tables[0].rows.insertat(datarow, 0); this.cbproductname.datasour...

javascript - Data dismiss in modal being called twice on click -

i've been working modal gets dismissed when user clicks 'cancel' button. working fine until button developed bug. when click on 'cancel' button, modal dismissed, closes , opens again. 1 needs click dismiss button twice close modal. this 'bootstrap' modal , haven't made changes js file. css , html have been tinkered with. on inspecting in browser, see following function being called twice. <div class="modal-backdrop fade in"></div> how fix error? have no idea start! following modal code. note: same error being encountered 'cross' aria label @ top-right corner of modal. <div class="modal fade bs-example-modal-sm" tabindex="-1" role="dialog" aria-labelledby="mysmallmodallabel" aria-hidden="true"> <div class="modal-dialog modal-sm"> <div class="modal-content"> ...

android - How can I close the fragment? -

i have fragment on activity. fragment has button. if click on button, fragment must close. how did this? public class itemfragment extends fragment{ private imageview btnapply; private clickbutton clickbutton = new clickbutton(); @override public view oncreateview(layoutinflater inflater, viewgroup container, bundle savedinstancestate) { view rootview = inflater.inflate(r.layout.item_info, container, false); btnapply = (imageview) rootview.findviewbyid(r.id.btnsenditem); btnapply.setonclicklistener(clickbutton); return rootview; } private class clickbutton implements view.onclicklistener { @override public void onclick(view v) { if (r.id.btnsenditem == v.getid()) { toast.maketext(getactivity(),"close",toast.length_long).show(); return; } } } } there's no such thing close fragment , can r...

c++ - Error message glibc detected Malloc(): memory corruption (fast) -

i got error. weird thing is, not getting error message... *** glibc detected *** ./a.out: malloc(): memory corruption (fast): 0x0000000002134dc0 *** ======= backtrace: ========= /lib/x86_64-linux-gnu/libc.so.6(+0x76a16)[0x7fa62b164a16] /lib/x86_64-linux-gnu/libc.so.6(+0x7a2f8)[0x7fa62b1682f8] /lib/x86_64-linux-gnu/libc.so.6(__libc_malloc+0x70)[0x7fa62b1698a0] /usr/lib/x86_64-linux-gnu/libstdc++.so.6(_znwm+0x1d)[0x7fa62b97607d] /usr/lib/x86_64-linux-gnu/libstdc++.so.6(_znss4_rep9_s_createemmrksaice+0x59)[0x7fa62b9d1999] /usr/lib/x86_64-linux-gnu/libstdc++.so.6(_znss4_rep8_m_cloneerksaicem+0x28)[0x7fa62b9d2708] /usr/lib/x86_64-linux-gnu/libstdc++.so.6(_znss7reserveem+0x30)[0x7fa62b9d27f0] /usr/lib/x86_64-linux-gnu/libstdc++.so.6(_znss6appendepkcm+0xb5)[0x7fa62b9d2ab5] ./a.out[0x40758f] ./a.out[0x403279] ./a.out[0x405202] ./a.out[0x406332] ./a.out[0x406c90] /lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xfd)[0x7fa62b10cead] ./a.out[0x402189] ======= memory map: ======== 00400000...

xcode6 - is there any way to share on facebook without showing the share dialog box in ios -

here code getting invalid publish_streem . there way share on facebook without showing share dialog box in ios? acaccountstore *accountstore = [[acaccountstore alloc] init]; acaccounttype *facebookaccounttype = [accountstore accounttypewithaccounttypeidentifier:acaccounttypeidentifierfacebook]; //acaccount *facebookaccount; // specify app id , permissions nsdictionary *options = @{acfacebookappidkey:@"565048226932112",acfacebookpermissionskey:@[@"publish_stream", @"publish_actions"],acfacebookaudiencekey:acfacebookaudiencefriends}; [accountstore requestaccesstoaccountswithtype:facebookaccounttype options:options completion:^(bool granted, nserror *error) { if (granted) { nsarray *accounts = [accountstore accountswithaccounttype:facebookaccounttype]; } else{ uialertview *alert = [[uialertview alloc] initwithtitle:@"error" message:[nsstring stringwithformat:@"%@...

javascript - jQuery dynamic Right-to-Left CSS processing -

i have list might this: <ul> <li>table</li> <!-- english --> <li>मेज</li> <!-- hindi --> <li>میز</li> <!-- urdu --> </ul> i want use jquery read characters in list-item , if finds characters in arabic unicode range (0x0600 - 0x06ff), underline it. here have: $("li:contains(/[\u0600-\u06ff]/)").css( "text-decoration", "underline" ); it should match third item i'm doing wrong. perhaps regular expressions not allowed :contains in jquery selectors... you can use filter() regexp . try following: var regex = new regexp(/[\u0600-\u06ff]/); $("li").filter(function() { return regex.test($(this).text()); }).css("text-decoration", "underline");

objective c - iOS supportedInterfaceOrientations loop crashing -

i receiving error, , have no idea may causing it. happening in ios 8.2 on both iphone , ipad. crashed: com.apple.main-thread exc_bad_access kern_protection_failure @ 0x00554ff4 raw 0 libobjc.a.dylib lookupimporforward + 3 4 libobjc.a.dylib -[nsobject respondstoselector:] + 38 5 uikit -[uiwindow _supportedinterfaceorientationsforrootviewcontroller] + 56 6 uikit -[_uifallbackpresentationviewcontroller supportedinterfaceorientations] + 60 7 uikit -[_uifallbackpresentationviewcontroller supportedinterfaceorientations] + 60 ... 510 uikit -[_uifallbackpresentationviewcontroller supportedinterfaceorientations] + 60 i read somewere should solve these kind of issues, did not work. -(nsuinteger)application:(uiapplication *)application supportedinterfaceorientationsforwindow:(uiwindow *)window { if ( idiom == ipad ) { return uiinterfaceorientationmaskportrait | uiinterfaceorientationmaskportraitupsidedown; } else { return uiinterfaceorientationmaskportrait; ...

scala - Scalatest assume database is available in each test -

many of tests dependent on database. use following check connection before running test case: assume(database.isavailable, "database down") when add each test case, correct !!! canceled !!! correct message displayed in output. when add beforeeach method: override def beforeeach() = { assume(database.isavailable, "database down") } all can see exception encountered when attempting run suite class name , *** aborted *** (on line assume call). do need add assumption each testcase? apparently intended. see http://www.scalatest.org/user_guide/sharing_fixtures mix in before-and-after trait when want aborted suite, not failed test, if fixture code fails. on same page there other alternatives. possibly worths withfixture

linux - Can I copy the pi1b system to pi2b? -

i have raspberry pi 1b, amd bought pi2b. wonder if can use image tools copy pi1system pi2? may copy pi1's sd card .img file, use file create data of pi2's micro sd card. i knew cpu of both pis different. is available ? did tried? if so, will there hidden bugs inside system can't find affect system work properly? any suggestion appreciated! short answer yes can, make sure os has armv7 kernel. long answer some quotes official raspberry pi blog : broadcom willing step new soc, bcm2836. retains features of bcm2835, replaces single 700mhz arm11 900mhz quad-core arm cortex-a7 complex: else remains same, there no painful transition or reduction in stability. note: armv7 backwards compatible armv6, quote below proves it. at launch, using same armv6 raspbian userland on both raspberry pi 1 , 2 there hidden issues it won't caused upgrading pi 1 model b pi 2 model b. caused copying image. if or system hardcoded network interface's...